(function() {
var wp;
(wp ||= {}).editWidgets = (() => {
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 name2 in all)
__defProp(target, name2, { get: all[name2], 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/blocks
var require_blocks = __commonJS({
"package-external:@wordpress/blocks"(exports, module) {
module.exports = window.wp.blocks;
}
});
// package-external:@wordpress/data
var require_data = __commonJS({
"package-external:@wordpress/data"(exports, module) {
module.exports = window.wp.data;
}
});
// package-external:@wordpress/deprecated
var require_deprecated = __commonJS({
"package-external:@wordpress/deprecated"(exports, module) {
module.exports = window.wp.deprecated;
}
});
// package-external:@wordpress/element
var require_element = __commonJS({
"package-external:@wordpress/element"(exports, module) {
module.exports = window.wp.element;
}
});
// package-external:@wordpress/block-library
var require_block_library = __commonJS({
"package-external:@wordpress/block-library"(exports, module) {
module.exports = window.wp.blockLibrary;
}
});
// package-external:@wordpress/core-data
var require_core_data = __commonJS({
"package-external:@wordpress/core-data"(exports, module) {
module.exports = window.wp.coreData;
}
});
// package-external:@wordpress/widgets
var require_widgets = __commonJS({
"package-external:@wordpress/widgets"(exports, module) {
module.exports = window.wp.widgets;
}
});
// package-external:@wordpress/preferences
var require_preferences = __commonJS({
"package-external:@wordpress/preferences"(exports, module) {
module.exports = window.wp.preferences;
}
});
// package-external:@wordpress/api-fetch
var require_api_fetch = __commonJS({
"package-external:@wordpress/api-fetch"(exports, module) {
module.exports = window.wp.apiFetch;
}
});
// package-external:@wordpress/i18n
var require_i18n = __commonJS({
"package-external:@wordpress/i18n"(exports, module) {
module.exports = window.wp.i18n;
}
});
// package-external:@wordpress/notices
var require_notices = __commonJS({
"package-external:@wordpress/notices"(exports, module) {
module.exports = window.wp.notices;
}
});
// package-external:@wordpress/components
var require_components = __commonJS({
"package-external:@wordpress/components"(exports, module) {
module.exports = window.wp.components;
}
});
// package-external:@wordpress/primitives
var require_primitives = __commonJS({
"package-external:@wordpress/primitives"(exports, module) {
module.exports = window.wp.primitives;
}
});
// vendor-external:react/jsx-runtime
var require_jsx_runtime = __commonJS({
"vendor-external:react/jsx-runtime"(exports, module) {
module.exports = window.ReactJSXRuntime;
}
});
// package-external:@wordpress/viewport
var require_viewport = __commonJS({
"package-external:@wordpress/viewport"(exports, module) {
module.exports = window.wp.viewport;
}
});
// package-external:@wordpress/compose
var require_compose = __commonJS({
"package-external:@wordpress/compose"(exports, module) {
module.exports = window.wp.compose;
}
});
// package-external:@wordpress/plugins
var require_plugins = __commonJS({
"package-external:@wordpress/plugins"(exports, module) {
module.exports = window.wp.plugins;
}
});
// vendor-external:react
var require_react = __commonJS({
"vendor-external:react"(exports, module) {
module.exports = window.React;
}
});
// vendor-external:react-dom
var require_react_dom = __commonJS({
"vendor-external:react-dom"(exports, module) {
module.exports = window.ReactDOM;
}
});
// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
var require_use_sync_external_store_shim_development = __commonJS({
"node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) {
"use strict";
(function() {
function is(x, y) {
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
}
function useSyncExternalStore$2(subscribe, getSnapshot) {
didWarnOld18Alpha || void 0 === React59.startTransition || (didWarnOld18Alpha = true, console.error(
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
));
var value = getSnapshot();
if (!didWarnUncachedGetSnapshot) {
var cachedValue = getSnapshot();
objectIs(value, cachedValue) || (console.error(
"The result of getSnapshot should be cached to avoid an infinite loop"
), didWarnUncachedGetSnapshot = true);
}
cachedValue = useState21({
inst: { value, getSnapshot }
});
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
useLayoutEffect4(
function() {
inst.value = value;
inst.getSnapshot = getSnapshot;
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
},
[subscribe, value, getSnapshot]
);
useEffect26(
function() {
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
return subscribe(function() {
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
});
},
[subscribe]
);
useDebugValue2(value);
return value;
}
function checkIfSnapshotChanged(inst) {
var latestGetSnapshot = inst.getSnapshot;
inst = inst.value;
try {
var nextValue = latestGetSnapshot();
return !objectIs(inst, nextValue);
} catch (error2) {
return true;
}
}
function useSyncExternalStore$1(subscribe, getSnapshot) {
return getSnapshot();
}
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
var React59 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState21 = React59.useState, useEffect26 = React59.useEffect, useLayoutEffect4 = React59.useLayoutEffect, useDebugValue2 = React59.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
exports.useSyncExternalStore = void 0 !== React59.useSyncExternalStore ? React59.useSyncExternalStore : shim;
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
})();
}
});
// node_modules/use-sync-external-store/shim/index.js
var require_shim = __commonJS({
"node_modules/use-sync-external-store/shim/index.js"(exports, module) {
"use strict";
if (false) {
module.exports = null;
} else {
module.exports = require_use_sync_external_store_shim_development();
}
}
});
// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
var require_with_selector_development = __commonJS({
"node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) {
"use strict";
(function() {
function is(x, y) {
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
}
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
var React59 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef27 = React59.useRef, useEffect26 = React59.useEffect, useMemo24 = React59.useMemo, useDebugValue2 = React59.useDebugValue;
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
var instRef = useRef27(null);
if (null === instRef.current) {
var inst = { hasValue: false, value: null };
instRef.current = inst;
} else inst = instRef.current;
instRef = useMemo24(
function() {
function memoizedSelector(nextSnapshot) {
if (!hasMemo) {
hasMemo = true;
memoizedSnapshot = nextSnapshot;
nextSnapshot = selector(nextSnapshot);
if (void 0 !== isEqual && inst.hasValue) {
var currentSelection = inst.value;
if (isEqual(currentSelection, nextSnapshot))
return memoizedSelection = currentSelection;
}
return memoizedSelection = nextSnapshot;
}
currentSelection = memoizedSelection;
if (objectIs(memoizedSnapshot, nextSnapshot))
return currentSelection;
var nextSelection = selector(nextSnapshot);
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
return memoizedSnapshot = nextSnapshot, currentSelection;
memoizedSnapshot = nextSnapshot;
return memoizedSelection = nextSelection;
}
var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
return [
function() {
return memoizedSelector(getSnapshot());
},
null === maybeGetServerSnapshot ? void 0 : function() {
return memoizedSelector(maybeGetServerSnapshot());
}
];
},
[getSnapshot, getServerSnapshot, selector, isEqual]
);
var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]);
useEffect26(
function() {
inst.hasValue = true;
inst.value = value;
},
[value]
);
useDebugValue2(value);
return value;
};
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
})();
}
});
// node_modules/use-sync-external-store/shim/with-selector.js
var require_with_selector = __commonJS({
"node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) {
"use strict";
if (false) {
module.exports = null;
} else {
module.exports = require_with_selector_development();
}
}
});
// package-external:@wordpress/theme
var require_theme = __commonJS({
"package-external:@wordpress/theme"(exports, module) {
module.exports = window.wp.theme;
}
});
// package-external:@wordpress/private-apis
var require_private_apis = __commonJS({
"package-external:@wordpress/private-apis"(exports, module) {
module.exports = window.wp.privateApis;
}
});
// package-external:@wordpress/a11y
var require_a11y = __commonJS({
"package-external:@wordpress/a11y"(exports, module) {
module.exports = window.wp.a11y;
}
});
// package-external:@wordpress/block-editor
var require_block_editor = __commonJS({
"package-external:@wordpress/block-editor"(exports, module) {
module.exports = window.wp.blockEditor;
}
});
// package-external:@wordpress/hooks
var require_hooks = __commonJS({
"package-external:@wordpress/hooks"(exports, module) {
module.exports = window.wp.hooks;
}
});
// package-external:@wordpress/media-utils
var require_media_utils = __commonJS({
"package-external:@wordpress/media-utils"(exports, module) {
module.exports = window.wp.mediaUtils;
}
});
// package-external:@wordpress/patterns
var require_patterns = __commonJS({
"package-external:@wordpress/patterns"(exports, module) {
module.exports = window.wp.patterns;
}
});
// package-external:@wordpress/keyboard-shortcuts
var require_keyboard_shortcuts = __commonJS({
"package-external:@wordpress/keyboard-shortcuts"(exports, module) {
module.exports = window.wp.keyboardShortcuts;
}
});
// package-external:@wordpress/keycodes
var require_keycodes = __commonJS({
"package-external:@wordpress/keycodes"(exports, module) {
module.exports = window.wp.keycodes;
}
});
// package-external:@wordpress/url
var require_url = __commonJS({
"package-external:@wordpress/url"(exports, module) {
module.exports = window.wp.url;
}
});
// package-external:@wordpress/dom
var require_dom = __commonJS({
"package-external:@wordpress/dom"(exports, module) {
module.exports = window.wp.dom;
}
});
// packages/edit-widgets/build-module/index.mjs
var index_exports = {};
__export(index_exports, {
initialize: () => initialize,
initializeEditor: () => initializeEditor,
reinitializeEditor: () => reinitializeEditor,
store: () => store2
});
var import_blocks3 = __toESM(require_blocks(), 1);
var import_data33 = __toESM(require_data(), 1);
var import_deprecated6 = __toESM(require_deprecated(), 1);
var import_element70 = __toESM(require_element(), 1);
var import_block_library = __toESM(require_block_library(), 1);
var import_core_data12 = __toESM(require_core_data(), 1);
var import_widgets5 = __toESM(require_widgets(), 1);
var import_preferences10 = __toESM(require_preferences(), 1);
// packages/edit-widgets/build-module/store/index.mjs
var import_api_fetch = __toESM(require_api_fetch(), 1);
var import_data8 = __toESM(require_data(), 1);
// packages/edit-widgets/build-module/store/reducer.mjs
var import_data = __toESM(require_data(), 1);
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, import_data.combineReducers)({
blockInserterPanel,
inserterSidebarToggleRef,
listViewPanel,
listViewToggleRef,
widgetAreasOpenState,
widgetSavingLock
});
// packages/edit-widgets/build-module/store/resolvers.mjs
var resolvers_exports = {};
__export(resolvers_exports, {
getWidgetAreas: () => getWidgetAreas,
getWidgets: () => getWidgets
});
var import_blocks2 = __toESM(require_blocks(), 1);
var import_core_data2 = __toESM(require_core_data(), 1);
// packages/edit-widgets/build-module/store/actions.mjs
var actions_exports2 = {};
__export(actions_exports2, {
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
});
var import_i18n8 = __toESM(require_i18n(), 1);
var import_notices = __toESM(require_notices(), 1);
// 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;
}
var clsx_default = clsx;
// packages/interface/build-module/components/complementary-area/index.mjs
var import_components4 = __toESM(require_components(), 1);
var import_data6 = __toESM(require_data(), 1);
var import_i18n = __toESM(require_i18n(), 1);
// packages/icons/build-module/library/caution.mjs
var import_primitives = __toESM(require_primitives(), 1);
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
var caution_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { d: "M12 8L12 13M12 14.5L12 16M4.75 12C4.75 7.99593 7.99594 4.75 12 4.75C16.0041 4.75 19.25 7.99594 19.25 12C19.25 16.0041 16.0041 19.25 12 19.25C7.99594 19.25 4.75 16.0041 4.75 12Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/check.mjs
var import_primitives2 = __toESM(require_primitives(), 1);
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
var check_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { d: "M7 12L10 15L17 8", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/chevron-down.mjs
var import_primitives3 = __toESM(require_primitives(), 1);
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "M7 11L12 15L17 11", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/close-small.mjs
var import_primitives4 = __toESM(require_primitives(), 1);
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.Path, { d: "M7.75 16.25L16.25 7.75M16.25 16.25L7.75 7.75", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/drawer-left.mjs
var import_primitives5 = __toESM(require_primitives(), 1);
var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
var drawer_left_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { d: "M9.75 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V18C4.75 18.6904 5.30964 19.25 6 19.25H9.75M9.75 4.75H18C18.6904 4.75 19.25 5.30964 19.25 6V18C19.25 18.6904 18.6904 19.25 18 19.25H9.75M9.75 4.75V19.25", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/drawer-right.mjs
var import_primitives6 = __toESM(require_primitives(), 1);
var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
var drawer_right_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.Path, { d: "M14.25 19.25L18 19.25C18.6904 19.25 19.25 18.6904 19.25 18L19.25 6C19.25 5.30964 18.6904 4.75 18 4.75L14.25 4.75M14.25 19.25L6 19.25C5.30964 19.25 4.75 18.6904 4.75 18L4.75 6C4.75 5.30964 5.30965 4.75 6 4.75L14.25 4.75M14.25 19.25L14.25 4.75", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/error.mjs
var import_primitives7 = __toESM(require_primitives(), 1);
var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
var error_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M12 9L12 14M12 15.5V17M11.1284 5.04947L3.83827 18.0097C3.46331 18.6763 3.94502 19.5 4.70985 19.5H19.2902C20.055 19.5 20.5367 18.6763 20.1617 18.0097L12.8716 5.04947C12.4893 4.36982 11.5107 4.36982 11.1284 5.04947Z", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/external.mjs
var import_primitives8 = __toESM(require_primitives(), 1);
var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
var external_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.Path, { d: "M9.5 6.25H6.5C5.80964 6.25 5.25 6.80964 5.25 7.5V17.5C5.25 18.1904 5.80964 18.75 6.5 18.75H16.5C17.1904 18.75 17.75 18.1904 17.75 17.5V14.5M11.5 12.5L18.75 5.25M12.5 5.25H18.75V11.5", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/info.mjs
var import_primitives9 = __toESM(require_primitives(), 1);
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
var info_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.Path, { d: "M12 16V11M12 9.5V8M19.25 12C19.25 16.0041 16.0041 19.25 12 19.25C7.99594 19.25 4.75 16.0041 4.75 12C4.75 7.99594 7.99594 4.75 12 4.75C16.0041 4.75 19.25 7.99594 19.25 12Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/layout.mjs
var import_primitives10 = __toESM(require_primitives(), 1);
var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
var layout_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.Path, { d: "M9.75 19.25H18C18.6904 19.25 19.25 18.6904 19.25 18V9.75M9.75 19.25H6C5.30964 19.25 4.75 18.6904 4.75 18V9.75M9.75 19.25V9.75M19.25 9.75V6C19.25 5.30964 18.6904 4.75 18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V9.75M19.25 9.75H9.75M9.75 9.75H4.75", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/list-view.mjs
var import_primitives11 = __toESM(require_primitives(), 1);
var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
var list_view_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.Path, { d: "M10 17.5H21M6.5 12H17.5M3 6.5H14", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/more-vertical.mjs
var import_primitives12 = __toESM(require_primitives(), 1);
var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.75 18.25L12.25 18.25L12.25 17.75L11.75 17.75L11.75 18.25Z", fill: "currentColor", stroke: "none" }),
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.75 12.25L12.25 12.25L12.25 11.75L11.75 11.75L11.75 12.25Z", fill: "currentColor", stroke: "none" }),
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.75 6.25L12.25 6.25L12.25 5.75L11.75 5.75L11.75 6.25Z", fill: "currentColor", stroke: "none" }),
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.75 18.25L12.25 18.25L12.25 17.75L11.75 17.75L11.75 18.25Z", vectorEffect: "non-scaling-stroke" }),
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.75 12.25L12.25 12.25L12.25 11.75L11.75 11.75L11.75 12.25Z", vectorEffect: "non-scaling-stroke" }),
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.75 6.25L12.25 6.25L12.25 5.75L11.75 5.75L11.75 6.25Z", vectorEffect: "non-scaling-stroke" })
] });
// packages/icons/build-module/library/plus.mjs
var import_primitives13 = __toESM(require_primitives(), 1);
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
var plus_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.Path, { d: "M12 18V6M18 12H6", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/published.mjs
var import_primitives14 = __toESM(require_primitives(), 1);
var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
var published_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M12 19.25C16.0041 19.25 19.25 16.0041 19.25 12C19.25 7.99594 16.0041 4.75 12 4.75C7.99594 4.75 4.75 7.99594 4.75 12C4.75 16.0041 7.99594 19.25 12 19.25Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }),
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M9 12L11 14L15 10", vectorEffect: "non-scaling-stroke" })
] });
// packages/icons/build-module/library/redo.mjs
var import_primitives15 = __toESM(require_primitives(), 1);
var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
var redo_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.Path, { d: "M15 15L18.5 11L15 7M18.5 11H8C5 11 4.75 13.8 4.75 17", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/star-empty.mjs
var import_primitives16 = __toESM(require_primitives(), 1);
var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
var star_empty_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.Path, { d: "M12 5.71576L13.6106 8.97924C13.7563 9.27438 14.0379 9.47895 14.3636 9.52628L17.965 10.0496L15.359 12.5899C15.1233 12.8196 15.0157 13.1506 15.0714 13.475L15.6866 17.0619L12.4653 15.3684C12.174 15.2152 11.826 15.2152 11.5347 15.3684L8.31341 17.0619L8.92861 13.475C8.98425 13.1506 8.8767 12.8196 8.64102 12.5899L6.03497 10.0496L9.63644 9.52628C9.96215 9.47895 10.2437 9.27438 10.3894 8.97924L12 5.71576Z", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/star-filled.mjs
var import_primitives17 = __toESM(require_primitives(), 1);
var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
var star_filled_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.Path, { d: "M12 5.71576L13.6106 8.97924C13.7563 9.27438 14.0379 9.47895 14.3636 9.52628L17.965 10.0496L15.359 12.5899C15.1233 12.8196 15.0157 13.1506 15.0714 13.475L15.6866 17.0619L12.4653 15.3684C12.174 15.2152 11.826 15.2152 11.5347 15.3684L8.31341 17.0619L8.92861 13.475C8.98425 13.1506 8.8767 12.8196 8.64102 12.5899L6.03497 10.0496L9.63644 9.52628C9.96215 9.47895 10.2437 9.27438 10.3894 8.97924L12 5.71576Z", fill: "currentColor", vectorEffect: "non-scaling-stroke" }) });
// packages/icons/build-module/library/undo.mjs
var import_primitives18 = __toESM(require_primitives(), 1);
var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
var undo_default = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.Path, { d: "M8.25 15L4.75 11L8.25 7M4.75 11H15.25C18.25 11 18.5 13.8 18.5 17", vectorEffect: "non-scaling-stroke" }) });
// packages/interface/build-module/components/complementary-area/index.mjs
var import_element3 = __toESM(require_element(), 1);
var import_viewport = __toESM(require_viewport(), 1);
var import_preferences3 = __toESM(require_preferences(), 1);
var import_compose2 = __toESM(require_compose(), 1);
var import_plugins2 = __toESM(require_plugins(), 1);
// packages/interface/build-module/components/complementary-area-toggle/index.mjs
var import_components = __toESM(require_components(), 1);
var import_data5 = __toESM(require_data(), 1);
var import_plugins = __toESM(require_plugins(), 1);
// packages/interface/build-module/store/index.mjs
var import_data4 = __toESM(require_data(), 1);
// packages/interface/build-module/store/actions.mjs
var actions_exports = {};
__export(actions_exports, {
closeModal: () => closeModal,
disableComplementaryArea: () => disableComplementaryArea,
enableComplementaryArea: () => enableComplementaryArea,
openModal: () => openModal,
pinItem: () => pinItem,
setDefaultComplementaryArea: () => setDefaultComplementaryArea,
setFeatureDefaults: () => setFeatureDefaults,
setFeatureValue: () => setFeatureValue,
toggleFeature: () => toggleFeature,
unpinItem: () => unpinItem
});
var import_deprecated2 = __toESM(require_deprecated(), 1);
var import_preferences = __toESM(require_preferences(), 1);
// packages/interface/build-module/store/deprecated.mjs
var import_deprecated = __toESM(require_deprecated(), 1);
function normalizeComplementaryAreaScope(scope) {
if (["core/edit-post", "core/edit-site"].includes(scope)) {
(0, import_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, name2) {
if (scope === "core" && name2 === "edit-site/template") {
(0, import_deprecated.default)(`edit-site/template sidebar`, {
alternative: "edit-post/document",
version: "6.6"
});
return "edit-post/document";
}
if (scope === "core" && name2 === "edit-site/block-inspector") {
(0, import_deprecated.default)(`edit-site/block-inspector sidebar`, {
alternative: "edit-post/block",
version: "6.6"
});
return "edit-post/block";
}
return name2;
}
// packages/interface/build-module/store/actions.mjs
var setDefaultComplementaryArea = (scope, area) => {
scope = normalizeComplementaryAreaScope(scope);
area = normalizeComplementaryAreaName(scope, area);
return {
type: "SET_DEFAULT_COMPLEMENTARY_AREA",
scope,
area
};
};
var enableComplementaryArea = (scope, area) => ({ registry, dispatch: dispatch2 }) => {
if (!area) {
return;
}
scope = normalizeComplementaryAreaScope(scope);
area = normalizeComplementaryAreaName(scope, area);
const isComplementaryAreaVisible = registry.select(import_preferences.store).get(scope, "isComplementaryAreaVisible");
if (!isComplementaryAreaVisible) {
registry.dispatch(import_preferences.store).set(scope, "isComplementaryAreaVisible", true);
}
dispatch2({
type: "ENABLE_COMPLEMENTARY_AREA",
scope,
area
});
};
var disableComplementaryArea = (scope) => ({ registry }) => {
scope = normalizeComplementaryAreaScope(scope);
const isComplementaryAreaVisible = registry.select(import_preferences.store).get(scope, "isComplementaryAreaVisible");
if (isComplementaryAreaVisible) {
registry.dispatch(import_preferences.store).set(scope, "isComplementaryAreaVisible", false);
}
};
var pinItem = (scope, item) => ({ registry }) => {
if (!item) {
return;
}
scope = normalizeComplementaryAreaScope(scope);
item = normalizeComplementaryAreaName(scope, item);
const pinnedItems = registry.select(import_preferences.store).get(scope, "pinnedItems");
if (pinnedItems?.[item] === true) {
return;
}
registry.dispatch(import_preferences.store).set(scope, "pinnedItems", {
...pinnedItems,
[item]: true
});
};
var unpinItem = (scope, item) => ({ registry }) => {
if (!item) {
return;
}
scope = normalizeComplementaryAreaScope(scope);
item = normalizeComplementaryAreaName(scope, item);
const pinnedItems = registry.select(import_preferences.store).get(scope, "pinnedItems");
registry.dispatch(import_preferences.store).set(scope, "pinnedItems", {
...pinnedItems,
[item]: false
});
};
function toggleFeature(scope, featureName) {
return function({ registry }) {
(0, import_deprecated2.default)(`dispatch( 'core/interface' ).toggleFeature`, {
since: "6.0",
alternative: `dispatch( 'core/preferences' ).toggle`
});
registry.dispatch(import_preferences.store).toggle(scope, featureName);
};
}
function setFeatureValue(scope, featureName, value) {
return function({ registry }) {
(0, import_deprecated2.default)(`dispatch( 'core/interface' ).setFeatureValue`, {
since: "6.0",
alternative: `dispatch( 'core/preferences' ).set`
});
registry.dispatch(import_preferences.store).set(scope, featureName, !!value);
};
}
function setFeatureDefaults(scope, defaults) {
return function({ registry }) {
(0, import_deprecated2.default)(`dispatch( 'core/interface' ).setFeatureDefaults`, {
since: "6.0",
alternative: `dispatch( 'core/preferences' ).setDefaults`
});
registry.dispatch(import_preferences.store).setDefaults(scope, defaults);
};
}
function openModal(name2) {
return {
type: "OPEN_MODAL",
name: name2
};
}
function closeModal() {
return {
type: "CLOSE_MODAL"
};
}
// packages/interface/build-module/store/selectors.mjs
var selectors_exports = {};
__export(selectors_exports, {
getActiveComplementaryArea: () => getActiveComplementaryArea,
isComplementaryAreaLoading: () => isComplementaryAreaLoading,
isFeatureActive: () => isFeatureActive,
isItemPinned: () => isItemPinned,
isModalActive: () => isModalActive
});
var import_data2 = __toESM(require_data(), 1);
var import_deprecated4 = __toESM(require_deprecated(), 1);
var import_preferences2 = __toESM(require_preferences(), 1);
var getActiveComplementaryArea = (0, import_data2.createRegistrySelector)(
(select) => (state, scope) => {
scope = normalizeComplementaryAreaScope(scope);
const isComplementaryAreaVisible = select(import_preferences2.store).get(
scope,
"isComplementaryAreaVisible"
);
if (isComplementaryAreaVisible === void 0) {
return void 0;
}
if (isComplementaryAreaVisible === false) {
return null;
}
return state?.complementaryAreas?.[scope];
}
);
var isComplementaryAreaLoading = (0, import_data2.createRegistrySelector)(
(select) => (state, scope) => {
scope = normalizeComplementaryAreaScope(scope);
const isVisible = select(import_preferences2.store).get(
scope,
"isComplementaryAreaVisible"
);
const identifier = state?.complementaryAreas?.[scope];
return isVisible && identifier === void 0;
}
);
var isItemPinned = (0, import_data2.createRegistrySelector)(
(select) => (state, scope, item) => {
scope = normalizeComplementaryAreaScope(scope);
item = normalizeComplementaryAreaName(scope, item);
const pinnedItems = select(
import_preferences2.store
).get(scope, "pinnedItems");
return pinnedItems?.[item] ?? true;
}
);
var isFeatureActive = (0, import_data2.createRegistrySelector)(
(select) => (state, scope, featureName) => {
(0, import_deprecated4.default)(
`select( 'core/interface' ).isFeatureActive( scope, featureName )`,
{
since: "6.0",
alternative: `select( 'core/preferences' ).get( scope, featureName )`
}
);
return !!select(import_preferences2.store).get(scope, featureName);
}
);
function isModalActive(state, modalName) {
return state.activeModal === modalName;
}
// packages/interface/build-module/store/reducer.mjs
var import_data3 = __toESM(require_data(), 1);
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_default2 = (0, import_data3.combineReducers)({
complementaryAreas,
activeModal
});
// packages/interface/build-module/store/constants.mjs
var STORE_NAME = "core/interface";
// packages/interface/build-module/store/index.mjs
var store = (0, import_data4.createReduxStore)(STORE_NAME, {
reducer: reducer_default2,
actions: actions_exports,
selectors: selectors_exports
});
(0, import_data4.register)(store);
// packages/interface/build-module/components/complementary-area-toggle/index.mjs
var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
function roleSupportsCheckedState(role) {
return [
"checkbox",
"option",
"radio",
"switch",
"menuitemcheckbox",
"menuitemradio",
"treeitem"
].includes(role);
}
function ComplementaryAreaToggle({
as = import_components.Button,
scope,
identifier: identifierProp,
icon: iconProp,
selectedIcon,
name: name2,
shortcut,
...props
}) {
const ComponentToUse = as;
const context = (0, import_plugins.usePluginContext)();
const icon = iconProp || context.icon;
const identifier = identifierProp || `${context.name}/${name2}`;
const isSelected = (0, import_data5.useSelect)(
(select) => select(store).getActiveComplementaryArea(scope) === identifier,
[identifier, scope]
);
const { enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data5.useDispatch)(store);
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
ComponentToUse,
{
icon: selectedIcon && isSelected ? selectedIcon : icon,
"aria-controls": identifier.replace("/", ":"),
"aria-checked": roleSupportsCheckedState(props.role) ? isSelected : void 0,
onClick: () => {
if (isSelected) {
disableComplementaryArea2(scope);
} else {
enableComplementaryArea2(scope, identifier);
}
},
shortcut,
...props
}
);
}
// packages/interface/build-module/components/complementary-area-header/index.mjs
var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
var ComplementaryAreaHeader = ({
children,
className,
toggleButtonProps
}) => {
const toggleButton = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ComplementaryAreaToggle, { icon: close_small_default, ...toggleButtonProps });
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
"div",
{
className: clsx_default(
"components-panel__header",
"interface-complementary-area-header",
className
),
tabIndex: -1,
children: [
children,
toggleButton
]
}
);
};
var complementary_area_header_default = ComplementaryAreaHeader;
// packages/interface/build-module/components/complementary-area-more-menu-item/index.mjs
var import_compose = __toESM(require_compose(), 1);
var import_element2 = __toESM(require_element(), 1);
// packages/interface/build-module/components/action-item/index.mjs
var import_components2 = __toESM(require_components(), 1);
var import_element = __toESM(require_element(), 1);
var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
function ActionItemSlot({
name: name2,
as: Component2 = import_components2.MenuGroup,
fillProps = {},
children,
...props
}) {
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components2.Slot, { name: name2, fillProps, children: (fills) => {
const items = import_element.Children.toArray(fills);
if (!items.length) {
return null;
}
if (typeof children === "function") {
return children(items);
}
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Component2, { ...props, children: items });
} });
}
function ActionItem({ name: name2, as, onClick, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components2.Fill, { name: name2, children: ({ as: slotAs = import_components2.MenuItem, onClick: slotOnClick }) => {
const Component2 = as ?? slotAs;
const handlers = [onClick, slotOnClick].filter(Boolean);
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
Component2,
{
onClick: handlers.length ? (...args) => handlers.forEach(
(handler) => handler(...args)
) : void 0,
...props
}
);
} });
}
ActionItem.Slot = ActionItemSlot;
var action_item_default = ActionItem;
// packages/interface/build-module/components/complementary-area-more-menu-item/index.mjs
var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
var menuItems = (0, import_compose.observableMap)();
function useHasComplementaryAreaMenuItem(scope, target) {
return !!(0, import_compose.useObservableValue)(menuItems, `${scope}/${target}`);
}
function DefaultComplementaryAreaMoreMenuItem({
scope,
target,
...props
}) {
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
ComplementaryAreaToggle,
{
as: (toggleProps) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
action_item_default,
{
name: `${scope}/plugin-more-menu`,
...toggleProps
}
),
role: "menuitemcheckbox",
name: target,
scope,
...props
}
);
}
// packages/interface/build-module/components/pinned-items/index.mjs
var import_components3 = __toESM(require_components(), 1);
var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
function PinnedItems({ scope, ...props }) {
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components3.Fill, { name: `PinnedItems/${scope}`, ...props });
}
function PinnedItemsSlot({
scope,
className,
...props
}) {
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components3.Slot, { name: `PinnedItems/${scope}`, ...props, children: (fills) => fills?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
"div",
{
className: clsx_default(
className,
"interface-pinned-items"
),
children: fills
}
) });
}
PinnedItems.Slot = PinnedItemsSlot;
var pinned_items_default = PinnedItems;
// packages/interface/build-module/components/complementary-area/index.mjs
var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
var ANIMATION_DURATION = 0.3;
function ComplementaryAreaSlot({
scope,
...props
}) {
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components4.Slot, { name: `ComplementaryArea/${scope}`, ...props });
}
var variants = {
// `auto` leaves the width to the area's own stylesheet, so it stays in one
// place. framer-motion measures the element to animate, then restores
// `auto`.
open: { width: "auto" },
// Resolved with the `custom` value passed to `AnimatePresence`, which is
// the only way an already removed element can be given a fresh transition.
closed: (transition) => ({
width: 0,
transition
})
};
function renderContainer(render, props) {
if ((0, import_element3.isValidElement)(render)) {
return (0, import_element3.cloneElement)(render, {
...props,
className: clsx_default(render.props.className, props.className),
style: { ...render.props.style, ...props.style }
});
}
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ...props });
}
function ComplementaryAreaFill({
activeArea,
isActive,
scope,
children,
className,
id,
render
}) {
const disableMotion = (0, import_compose2.useReducedMotion)();
const isMobileViewport = (0, import_compose2.useViewportMatch)("medium", "<");
const previousActiveArea = (0, import_compose2.usePrevious)(activeArea);
const isSwitchingAreas = !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea;
const transition = {
type: "tween",
duration: disableMotion || isMobileViewport || isSwitchingAreas ? 0 : ANIMATION_DURATION,
ease: [0.6, 0, 0.4, 1]
};
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components4.Fill, { name: `ComplementaryArea/${scope}`, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components4.__unstableAnimatePresence, { initial: false, custom: transition, children: isActive && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
import_components4.__unstableMotion.div,
{
variants,
initial: "closed",
animate: "open",
exit: "closed",
transition,
className: "interface-complementary-area__fill",
children: renderContainer(render, {
id,
className,
children
})
}
) }) });
}
function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
const previousIsSmallRef = (0, import_element3.useRef)(false);
const shouldOpenWhenNotSmallRef = (0, import_element3.useRef)(false);
const { enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data6.useDispatch)(store);
(0, import_element3.useEffect)(() => {
if (isActive && isSmall && !previousIsSmallRef.current) {
disableComplementaryArea2(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;
enableComplementaryArea2(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,
disableComplementaryArea2,
enableComplementaryArea2
]);
}
function ComplementaryArea({
children,
className,
closeLabel = (0, import_i18n.__)("Close plugin"),
identifier: identifierProp,
header,
headerClassName,
icon: iconProp,
isPinnable = true,
panelClassName,
render,
scope,
name: name2,
title,
toggleShortcut,
isActiveByDefault
}) {
const context = (0, import_plugins2.usePluginContext)();
const icon = iconProp || context.icon;
const identifier = identifierProp || `${context.name}/${name2}`;
const [isReady, setIsReady] = (0, import_element3.useState)(false);
const {
isLoading,
isActive,
isPinned,
activeArea,
isSmall,
isLarge,
showIconLabels
} = (0, import_data6.useSelect)(
(select) => {
const {
getActiveComplementaryArea: getActiveComplementaryArea2,
isComplementaryAreaLoading: isComplementaryAreaLoading2,
isItemPinned: isItemPinned2
} = select(store);
const { get } = select(import_preferences3.store);
const _activeArea = getActiveComplementaryArea2(scope);
return {
isLoading: isComplementaryAreaLoading2(scope),
isActive: _activeArea === identifier,
isPinned: isItemPinned2(scope, identifier),
activeArea: _activeArea,
isSmall: select(import_viewport.store).isViewportMatch("< medium"),
isLarge: select(import_viewport.store).isViewportMatch("large"),
showIconLabels: get("core", "showIconLabels")
};
},
[identifier, scope]
);
const hasMenuItem = useHasComplementaryAreaMenuItem(scope, name2);
const isMobileViewport = (0, import_compose2.useViewportMatch)("medium", "<");
useAdjustComplementaryListener(
scope,
identifier,
activeArea,
isActive,
isSmall
);
const {
enableComplementaryArea: enableComplementaryArea2,
disableComplementaryArea: disableComplementaryArea2,
pinItem: pinItem2,
unpinItem: unpinItem2
} = (0, import_data6.useDispatch)(store);
(0, import_element3.useEffect)(() => {
if (isActiveByDefault && activeArea === void 0 && !isSmall) {
enableComplementaryArea2(scope, identifier);
} else if (activeArea === void 0 && isSmall) {
disableComplementaryArea2(scope);
}
setIsReady(true);
}, [
activeArea,
isActiveByDefault,
scope,
identifier,
isSmall,
enableComplementaryArea2,
disableComplementaryArea2
]);
if (!isReady) {
return;
}
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
isPinnable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(pinned_items_default, { scope, children: isPinned && /* @__PURE__ */ (0, import_jsx_runtime24.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
}
) }),
name2 && isPinnable && !hasMenuItem && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
DefaultComplementaryAreaMoreMenuItem,
{
target: name2,
scope,
icon,
identifier,
children: title
}
),
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
ComplementaryAreaFill,
{
activeArea,
isActive,
className: clsx_default("interface-complementary-area", className),
scope,
id: identifier.replace("/", ":"),
render,
children: [
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
complementary_area_header_default,
{
className: headerClassName,
toggleButtonProps: {
label: closeLabel,
size: "compact",
shortcut: toggleShortcut,
scope,
identifier
},
children: header || /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: "interface-complementary-area-header__title", children: title }),
isPinnable && !isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
import_components4.Button,
{
className: "interface-complementary-area__pin-unpin-item",
icon: isPinned ? star_filled_default : star_empty_default,
label: isPinned ? (0, import_i18n.__)("Unpin from toolbar") : (0, import_i18n.__)("Pin to toolbar"),
onClick: () => (isPinned ? unpinItem2 : pinItem2)(
scope,
identifier
),
isPressed: isPinned,
size: "compact"
}
)
] })
}
),
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components4.Panel, { className: panelClassName, children })
]
}
)
] });
}
ComplementaryArea.Slot = ComplementaryAreaSlot;
var complementary_area_default = ComplementaryArea;
// node_modules/@base-ui/utils/useControlled.mjs
var React = __toESM(require_react(), 1);
// node_modules/@base-ui/utils/createLogOnce.mjs
var loggedMessages;
if (true) {
loggedMessages = /* @__PURE__ */ new Set();
}
function createLogOnce(severity, prefix) {
return function logOnce(...messages) {
if (true) {
const message = messages.join(" ");
const output = prefix ? `${prefix}: ${message}` : message;
const key = `${severity}:${output}`;
if (!loggedMessages.has(key)) {
loggedMessages.add(key);
if (severity === "warn") {
console.warn(output);
} else {
console.error(output);
}
}
}
};
}
// node_modules/@base-ui/utils/error.mjs
var error = createLogOnce("error", "Base UI");
// node_modules/@base-ui/utils/useControlled.mjs
function useControlled({
controlled,
default: defaultProp,
name: name2,
state = "value"
}) {
const {
current: isControlled
} = React.useRef(controlled !== void 0);
const [valueState, setValue] = React.useState(defaultProp);
const value = isControlled && controlled !== void 0 ? controlled : valueState;
if (true) {
React.useEffect(() => {
if (isControlled !== (controlled !== void 0)) {
error([`A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name2} to be ${isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${name2} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join("\n"));
}
}, [state, name2, controlled]);
const {
current: defaultValue
} = React.useRef(defaultProp);
React.useEffect(() => {
if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) {
error([`A component is changing the default ${state} state of an uncontrolled ${name2} after being initialized. To suppress this warning opt to use a controlled ${name2}.`].join("\n"));
}
}, [defaultProp]);
}
const setValueIfUncontrolled = React.useCallback((newValue) => {
if (!isControlled) {
setValue(newValue);
}
}, []);
return [value, setValueIfUncontrolled];
}
function serializeToDevModeString(input) {
let nextId = 0;
const seen = /* @__PURE__ */ new WeakMap();
try {
const result = JSON.stringify(input, function replacer(key, value) {
if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) {
return void 0;
}
if (typeof value === "bigint") {
return `__bigint__:${value}`;
}
if (value !== null && typeof value === "object") {
const id = seen.get(value);
if (id !== void 0) {
return `__object__:${id}`;
}
seen.set(value, nextId);
nextId += 1;
}
return value;
});
return result ?? `__top__:${typeof input}`;
} catch {
return "__unserializable__";
}
}
// node_modules/@base-ui/utils/safeReact.mjs
var React2 = __toESM(require_react(), 1);
var SafeReact = {
...React2
};
// node_modules/@base-ui/utils/useRefWithInit.mjs
var React3 = __toESM(require_react(), 1);
var UNINITIALIZED = {};
function useRefWithInit(init, initArg) {
const ref = React3.useRef(UNINITIALIZED);
if (ref.current === UNINITIALIZED) {
ref.current = init(initArg);
}
return ref;
}
// node_modules/@base-ui/utils/useStableCallback.mjs
var useInsertionEffect = SafeReact.useInsertionEffect;
var useSafeInsertionEffect = (
// React 17 doesn't have useInsertionEffect.
useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late.
useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn()
);
function useStableCallback(callback) {
const stable = useRefWithInit(createStableCallback).current;
stable.next = callback;
useSafeInsertionEffect(stable.effect);
return stable.trampoline;
}
function createStableCallback() {
const stable = {
next: void 0,
callback: assertNotCalled,
trampoline: (...args) => stable.callback?.(...args),
effect: () => {
stable.callback = stable.next;
}
};
return stable;
}
function assertNotCalled() {
if (true) {
throw (
/* minify-error-disabled */
new Error("Base UI: Cannot call an event handler while rendering.")
);
}
}
// node_modules/@base-ui/utils/warn.mjs
var warn = createLogOnce("warn", "Base UI");
// node_modules/@base-ui/utils/empty.mjs
function NOOP() {
}
var EMPTY_ARRAY = Object.freeze([]);
var EMPTY_OBJECT = Object.freeze({});
// node_modules/@base-ui/utils/useIsoLayoutEffect.mjs
var React4 = __toESM(require_react(), 1);
var noop = () => {
};
var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop;
// node_modules/@base-ui/react/internals/useRenderElement.mjs
var React7 = __toESM(require_react(), 1);
// node_modules/@base-ui/utils/useMergedRefs.mjs
function useMergedRefs(a, b, c, d) {
const forkRef = useRefWithInit(createForkRef).current;
if (didChange(forkRef, a, b, c, d)) {
update(forkRef, [a, b, c, d]);
}
return forkRef.callback;
}
function useMergedRefsN(refs) {
const forkRef = useRefWithInit(createForkRef).current;
if (didChangeN(forkRef, refs)) {
update(forkRef, refs);
}
return forkRef.callback;
}
function createForkRef() {
return {
callback: null,
cleanup: null,
refs: []
};
}
function didChange(forkRef, a, b, c, d) {
return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
}
function didChangeN(forkRef, newRefs) {
return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]);
}
function update(forkRef, refs) {
forkRef.refs = refs;
if (refs.every((ref) => ref == null)) {
forkRef.callback = null;
return;
}
forkRef.callback = (instance) => {
if (forkRef.cleanup) {
forkRef.cleanup();
forkRef.cleanup = null;
}
if (instance != null) {
const cleanupCallbacks = Array(refs.length).fill(null);
for (let i = 0; i < refs.length; i += 1) {
const ref = refs[i];
if (ref == null) {
continue;
}
switch (typeof ref) {
case "function": {
const refCleanup = ref(instance);
if (typeof refCleanup === "function") {
cleanupCallbacks[i] = refCleanup;
}
break;
}
case "object": {
ref.current = instance;
break;
}
default:
}
}
forkRef.cleanup = () => {
for (let i = 0; i < refs.length; i += 1) {
const ref = refs[i];
if (ref == null) {
continue;
}
switch (typeof ref) {
case "function": {
const cleanupCallback = cleanupCallbacks[i];
if (typeof cleanupCallback === "function") {
cleanupCallback();
} else {
void ref(null);
}
break;
}
case "object": {
ref.current = null;
break;
}
default:
}
}
};
}
};
}
// node_modules/@base-ui/utils/getReactElementRef.mjs
var React6 = __toESM(require_react(), 1);
// node_modules/@base-ui/utils/reactVersion.mjs
var React5 = __toESM(require_react(), 1);
var majorVersion = parseInt(React5.version, 10);
function isReactVersionAtLeast(reactVersionToCheck) {
return majorVersion >= reactVersionToCheck;
}
// node_modules/@base-ui/utils/getReactElementRef.mjs
function getReactElementRef(element) {
if (!/* @__PURE__ */ React6.isValidElement(element)) {
return null;
}
const reactElement = element;
const propsWithRef = reactElement.props;
return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
}
// node_modules/@base-ui/utils/mergeObjects.mjs
function mergeObjects(a, b) {
if (a && !b) {
return a;
}
if (!a && b) {
return b;
}
if (a || b) {
return {
...a,
...b
};
}
return void 0;
}
// node_modules/@base-ui/react/internals/getStateAttributesProps.mjs
function getStateAttributesProps(state, customMapping) {
const props = {};
for (const key in state) {
const value = state[key];
if (customMapping?.hasOwnProperty(key)) {
const customProps = customMapping[key](value);
if (customProps != null) {
Object.assign(props, customProps);
}
continue;
}
if (value === true) {
props[`data-${key.toLowerCase()}`] = "";
} else if (value) {
props[`data-${key.toLowerCase()}`] = value.toString();
}
}
return props;
}
// node_modules/@base-ui/react/utils/resolveClassName.mjs
function resolveClassName(className, state) {
return typeof className === "function" ? className(state) : className;
}
// node_modules/@base-ui/react/utils/resolveStyle.mjs
function resolveStyle(style, state) {
return typeof style === "function" ? style(state) : style;
}
// node_modules/@base-ui/react/merge-props/mergeProps.mjs
var EMPTY_PROPS = {};
function mergeProps(a, b, c, d, e) {
if (!c && !d && !e && !a) {
return createInitialMergedProps(b);
}
let merged = createInitialMergedProps(a);
if (b) {
merged = mergeInto(merged, b);
}
if (c) {
merged = mergeInto(merged, c);
}
if (d) {
merged = mergeInto(merged, d);
}
if (e) {
merged = mergeInto(merged, e);
}
return merged;
}
function mergePropsN(props) {
if (props.length === 0) {
return EMPTY_PROPS;
}
if (props.length === 1) {
return createInitialMergedProps(props[0]);
}
let merged = createInitialMergedProps(props[0]);
for (let i = 1; i < props.length; i += 1) {
merged = mergeInto(merged, props[i]);
}
return merged;
}
function createInitialMergedProps(inputProps) {
if (isPropsGetter(inputProps)) {
return {
...resolvePropsGetter(inputProps, EMPTY_PROPS)
};
}
return copyInitialProps(inputProps);
}
function mergeInto(merged, inputProps) {
if (isPropsGetter(inputProps)) {
return resolvePropsGetter(inputProps, merged);
}
return mutablyMergeInto(merged, inputProps);
}
function copyInitialProps(inputProps) {
const copiedProps = {
...inputProps
};
for (const propName in copiedProps) {
const propValue = copiedProps[propName];
if (isEventHandler(propName, propValue)) {
copiedProps[propName] = wrapEventHandler(propValue);
}
}
return copiedProps;
}
function mutablyMergeInto(mergedProps, externalProps) {
if (!externalProps) {
return mergedProps;
}
for (const propName in externalProps) {
const externalPropValue = externalProps[propName];
switch (propName) {
case "style": {
mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
break;
}
case "className": {
mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
break;
}
default: {
if (isEventHandler(propName, externalPropValue)) {
mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
} else {
mergedProps[propName] = externalPropValue;
}
}
}
}
return mergedProps;
}
function isEventHandler(key, value) {
const code0 = key.charCodeAt(0);
const code1 = key.charCodeAt(1);
const code2 = key.charCodeAt(2);
return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
}
function isPropsGetter(inputProps) {
return typeof inputProps === "function";
}
function resolvePropsGetter(inputProps, previousProps) {
if (isPropsGetter(inputProps)) {
return inputProps(previousProps);
}
return inputProps ?? EMPTY_PROPS;
}
function mergeEventHandlers(ourHandler, theirHandler) {
if (!theirHandler) {
return ourHandler;
}
if (!ourHandler) {
return wrapEventHandler(theirHandler);
}
return (...args) => {
const event = args[0];
if (isSyntheticEvent(event)) {
const baseUIEvent = event;
makeEventPreventable(baseUIEvent);
const result2 = theirHandler(...args);
if (!baseUIEvent.baseUIHandlerPrevented) {
ourHandler?.(...args);
}
return result2;
}
const result = theirHandler(...args);
ourHandler?.(...args);
return result;
};
}
function wrapEventHandler(handler) {
if (!handler) {
return handler;
}
return (...args) => {
const event = args[0];
if (isSyntheticEvent(event)) {
makeEventPreventable(event);
}
return handler(...args);
};
}
function makeEventPreventable(event) {
event.preventBaseUIHandler = () => {
event.baseUIHandlerPrevented = true;
};
return event;
}
function mergeClassNames(ourClassName, theirClassName) {
if (theirClassName) {
if (ourClassName) {
return theirClassName + " " + ourClassName;
}
return theirClassName;
}
return ourClassName;
}
function isSyntheticEvent(event) {
return event != null && typeof event === "object" && "nativeEvent" in event;
}
// node_modules/@base-ui/react/internals/useRenderElement.mjs
var import_react = __toESM(require_react(), 1);
function useRenderElement(element, componentProps, params = {}) {
let renderProp = componentProps.render;
if (params.enabled !== false) {
renderProp = unwrapLazyRenderProp(renderProp);
}
const outProps = useRenderElementProps(componentProps, params, renderProp);
if (params.enabled === false) {
return null;
}
const state = params.state ?? EMPTY_OBJECT;
return evaluateRenderProp(element, renderProp, outProps, state);
}
function useRenderElementProps(componentProps, params, renderProp) {
const {
className: classNameProp,
style: styleProp
} = componentProps;
const {
state = EMPTY_OBJECT,
ref,
props,
stateAttributesMapping: stateAttributesMapping2,
enabled = true
} = params;
const className = enabled ? resolveClassName(classNameProp, state) : void 0;
const style = enabled ? resolveStyle(styleProp, state) : void 0;
const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping2) : EMPTY_OBJECT;
const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0;
const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;
if (typeof document !== "undefined") {
if (!enabled) {
void useMergedRefs(null, null);
} else if (Array.isArray(ref)) {
outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);
} else {
outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
}
}
if (!enabled) {
return EMPTY_OBJECT;
}
if (className !== void 0) {
outProps.className = mergeClassNames(outProps.className, className);
}
if (style !== void 0) {
outProps.style = mergeObjects(outProps.style, style);
}
return outProps;
}
function resolveRenderFunctionProps(props) {
if (Array.isArray(props)) {
return mergePropsN(props);
}
return mergeProps(void 0, props);
}
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
var LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
function unwrapLazyRenderProp(render) {
if (render?.$$typeof !== REACT_LAZY_TYPE) {
return render;
}
const unwrapped = React7.Children.toArray(render)[0];
return /* @__PURE__ */ React7.isValidElement(unwrapped) ? unwrapped : render;
}
function evaluateRenderProp(element, render, props, state) {
if (render) {
if (typeof render === "function") {
if (true) {
warnIfRenderPropLooksLikeComponent(render);
}
return render(props, state);
}
const mergedProps = mergeProps(props, render.props);
mergedProps.ref = props.ref;
if (true) {
if (!/* @__PURE__ */ React7.isValidElement(render)) {
throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n"));
}
}
return /* @__PURE__ */ React7.cloneElement(render, mergedProps);
}
if (element) {
if (typeof element === "string") {
return renderTag(element, props);
}
}
throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8));
}
function warnIfRenderPropLooksLikeComponent(renderFn) {
const functionName = renderFn.name;
if (functionName.length === 0) {
return;
}
if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {
return;
}
if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {
return;
}
warn(`The \`render\` prop received a function named \`${functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={}` or `render={(props) => }` instead.", "https://base-ui.com/r/invalid-render-prop");
}
function renderTag(Tag, props) {
if (Tag === "button") {
return /* @__PURE__ */ (0, import_react.createElement)("button", {
type: "button",
...props,
key: props.key
});
}
if (Tag === "img") {
return /* @__PURE__ */ (0, import_react.createElement)("img", {
alt: "",
...props,
key: props.key
});
}
return /* @__PURE__ */ React7.createElement(Tag, props);
}
// node_modules/@base-ui/utils/useId.mjs
var React8 = __toESM(require_react(), 1);
var globalId = 0;
function useGlobalId(idOverride, prefix = "mui") {
const [defaultId, setDefaultId] = React8.useState(idOverride);
const id = idOverride || defaultId;
React8.useEffect(() => {
if (defaultId == null) {
globalId += 1;
setDefaultId(`${prefix}-${globalId}`);
}
}, [defaultId, prefix]);
return id;
}
var maybeReactUseId = SafeReact.useId;
function useId(idOverride, prefix) {
if (maybeReactUseId !== void 0) {
const reactId = maybeReactUseId();
return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);
}
return useGlobalId(idOverride, prefix);
}
// node_modules/@base-ui/react/internals/useBaseUiId.mjs
function useBaseUiId(idOverride) {
return useId(idOverride, "base-ui");
}
// node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs
var React11 = __toESM(require_react(), 1);
// node_modules/@base-ui/react/internals/reason-parts.mjs
var reason_parts_exports = {};
__export(reason_parts_exports, {
cancelOpen: () => cancelOpen,
chipRemovePress: () => chipRemovePress,
clearPress: () => clearPress,
closePress: () => closePress,
closeWatcher: () => closeWatcher,
decrementPress: () => decrementPress,
disabled: () => disabled,
drag: () => drag,
escapeKey: () => escapeKey,
focusOut: () => focusOut,
imperativeAction: () => imperativeAction,
incrementPress: () => incrementPress,
initial: () => initial,
inputBlur: () => inputBlur,
inputChange: () => inputChange,
inputClear: () => inputClear,
inputPaste: () => inputPaste,
inputPress: () => inputPress,
itemPress: () => itemPress,
keyboard: () => keyboard,
linkPress: () => linkPress,
listNavigation: () => listNavigation,
missing: () => missing,
none: () => none,
outsidePress: () => outsidePress,
pointer: () => pointer,
scrub: () => scrub,
siblingOpen: () => siblingOpen,
swipe: () => swipe,
trackPress: () => trackPress,
triggerFocus: () => triggerFocus,
triggerHover: () => triggerHover,
triggerPress: () => triggerPress,
wheel: () => wheel,
windowResize: () => windowResize
});
var none = "none";
var triggerPress = "trigger-press";
var triggerHover = "trigger-hover";
var triggerFocus = "trigger-focus";
var outsidePress = "outside-press";
var itemPress = "item-press";
var closePress = "close-press";
var linkPress = "link-press";
var clearPress = "clear-press";
var chipRemovePress = "chip-remove-press";
var trackPress = "track-press";
var incrementPress = "increment-press";
var decrementPress = "decrement-press";
var inputChange = "input-change";
var inputClear = "input-clear";
var inputBlur = "input-blur";
var inputPaste = "input-paste";
var inputPress = "input-press";
var focusOut = "focus-out";
var escapeKey = "escape-key";
var closeWatcher = "close-watcher";
var listNavigation = "list-navigation";
var keyboard = "keyboard";
var pointer = "pointer";
var drag = "drag";
var wheel = "wheel";
var scrub = "scrub";
var cancelOpen = "cancel-open";
var siblingOpen = "sibling-open";
var disabled = "disabled";
var missing = "missing";
var initial = "initial";
var imperativeAction = "imperative-action";
var swipe = "swipe";
var windowResize = "window-resize";
// node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs
function createChangeEventDetails(reason, event, trigger, customProperties) {
let canceled = false;
let allowPropagation = false;
const custom = customProperties ?? EMPTY_OBJECT;
const details = {
reason,
event: event ?? new Event("base-ui"),
cancel() {
canceled = true;
},
allowPropagation() {
allowPropagation = true;
},
get isCanceled() {
return canceled;
},
get isPropagationAllowed() {
return allowPropagation;
},
trigger,
...custom
};
return details;
}
// node_modules/@base-ui/react/internals/useTransitionStatus.mjs
var React10 = __toESM(require_react(), 1);
// node_modules/@base-ui/utils/useOnMount.mjs
var React9 = __toESM(require_react(), 1);
function useOnMount(fn) {
React9.useEffect(fn, EMPTY_ARRAY);
}
// node_modules/@base-ui/utils/useAnimationFrame.mjs
var EMPTY = null;
var LAST_RAF = globalThis.requestAnimationFrame;
var Scheduler = class {
/* This implementation uses an array as a backing data-structure for frame callbacks.
* It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
* never calls the native `cancelAnimationFrame` if there are no frames left. This can
* be much more efficient if there is a call pattern that alterns as
* "request-cancel-request-cancel-…".
* But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
* frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
callbacks = [];
callbacksCount = 0;
nextId = 1;
startId = 1;
isScheduled = false;
tick = (timestamp) => {
this.isScheduled = false;
const currentCallbacks = this.callbacks;
const currentCallbacksCount = this.callbacksCount;
this.callbacks = [];
this.callbacksCount = 0;
this.startId = this.nextId;
if (currentCallbacksCount > 0) {
for (let i = 0; i < currentCallbacks.length; i += 1) {
currentCallbacks[i]?.(timestamp);
}
}
};
request(fn) {
const id = this.nextId;
this.nextId += 1;
this.callbacks.push(fn);
this.callbacksCount += 1;
const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);
if (!this.isScheduled || didRAFChange) {
requestAnimationFrame(this.tick);
this.isScheduled = true;
}
return id;
}
cancel(id) {
const index2 = id - this.startId;
if (index2 < 0 || index2 >= this.callbacks.length) {
return;
}
if (this.callbacks[index2] === null) {
return;
}
this.callbacks[index2] = null;
this.callbacksCount -= 1;
}
};
var scheduler = new Scheduler();
var AnimationFrame = class _AnimationFrame {
static create() {
return new _AnimationFrame();
}
static request(fn) {
return scheduler.request(fn);
}
static cancel(id) {
return scheduler.cancel(id);
}
currentId = EMPTY;
/**
* Executes `fn` after `delay`, clearing any previously scheduled call.
*/
request(fn) {
this.cancel();
this.currentId = scheduler.request(() => {
this.currentId = EMPTY;
fn();
});
}
cancel = () => {
if (this.currentId !== EMPTY) {
scheduler.cancel(this.currentId);
this.currentId = EMPTY;
}
};
disposeEffect = () => {
return this.cancel;
};
};
function useAnimationFrame() {
const timeout = useRefWithInit(AnimationFrame.create).current;
useOnMount(timeout.disposeEffect);
return timeout;
}
// node_modules/@base-ui/react/internals/useTransitionStatus.mjs
function useTransitionStatus(open3, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) {
const [transitionStatus, setTransitionStatus] = React10.useState(open3 && enableIdleState ? "idle" : void 0);
const [mounted, setMounted] = React10.useState(open3 && !animateInitialOpen);
if (open3 && !mounted) {
setMounted(true);
setTransitionStatus("starting");
}
if (!open3 && mounted && transitionStatus !== "ending" && !deferEndingState) {
setTransitionStatus("ending");
}
if (!open3 && !mounted && transitionStatus === "ending") {
setTransitionStatus(void 0);
}
useIsoLayoutEffect(() => {
if (!open3 && mounted && transitionStatus !== "ending" && deferEndingState) {
const frame = AnimationFrame.request(() => {
setTransitionStatus("ending");
});
return () => {
AnimationFrame.cancel(frame);
};
}
return void 0;
}, [open3, mounted, transitionStatus, deferEndingState]);
useIsoLayoutEffect(() => {
if (!open3 || enableIdleState) {
return void 0;
}
const frame = AnimationFrame.request(() => {
setTransitionStatus(void 0);
});
return () => {
AnimationFrame.cancel(frame);
};
}, [enableIdleState, open3]);
useIsoLayoutEffect(() => {
if (!open3 || !enableIdleState) {
return void 0;
}
if (open3 && mounted && transitionStatus !== "idle") {
setTransitionStatus("starting");
}
const frame = AnimationFrame.request(() => {
setTransitionStatus("idle");
});
return () => {
AnimationFrame.cancel(frame);
};
}, [enableIdleState, open3, mounted, transitionStatus]);
return {
mounted,
setMounted,
transitionStatus
};
}
// node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs
function useCollapsibleRoot(parameters) {
const {
open: openParam,
defaultOpen = false,
onOpenChange,
disabled: disabled2
} = parameters;
const [open3, setOpen] = useControlled({
controlled: openParam,
default: defaultOpen,
name: "Collapsible",
state: "open"
});
const {
mounted,
setMounted,
transitionStatus
} = useTransitionStatus(open3, true, true);
const defaultPanelId = useBaseUiId();
const [registeredPanelId, setPanelIdState] = React11.useState();
const panelId = registeredPanelId === null ? void 0 : registeredPanelId ?? defaultPanelId;
const handleTrigger = useStableCallback((event) => {
const nextOpen = !open3;
const eventDetails = createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent);
onOpenChange(nextOpen, eventDetails);
if (eventDetails.isCanceled) {
return;
}
setOpen(nextOpen);
});
return React11.useMemo(() => ({
defaultPanelId,
disabled: disabled2,
handleTrigger,
mounted,
open: open3,
panelId,
setMounted,
setOpen,
setPanelIdState,
transitionStatus
}), [defaultPanelId, disabled2, handleTrigger, mounted, open3, panelId, setMounted, setOpen, setPanelIdState, transitionStatus]);
}
// node_modules/@base-ui/react/collapsible/root/CollapsibleRootContext.mjs
var React12 = __toESM(require_react(), 1);
var CollapsibleRootContext = /* @__PURE__ */ React12.createContext(void 0);
if (true) CollapsibleRootContext.displayName = "CollapsibleRootContext";
function useCollapsibleRootContext() {
const context = React12.useContext(CollapsibleRootContext);
if (context === void 0) {
throw new Error(true ? "Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within ." : formatErrorMessage_default(15));
}
return context;
}
// node_modules/@base-ui/react/internals/TransitionStatusDataAttributes.mjs
var TransitionStatusDataAttributes_exports = {};
__export(TransitionStatusDataAttributes_exports, {
endingStyle: () => endingStyle,
startingStyle: () => startingStyle
});
var startingStyle = "data-starting-style";
var endingStyle = "data-ending-style";
// node_modules/@base-ui/react/internals/stateAttributesMapping.mjs
var STARTING_HOOK = {
[startingStyle]: ""
};
var ENDING_HOOK = {
[endingStyle]: ""
};
var transitionStatusMapping = {
transitionStatus(value) {
if (value === "starting") {
return STARTING_HOOK;
}
if (value === "ending") {
return ENDING_HOOK;
}
return null;
}
};
// node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelDataAttributes.mjs
var open = "data-open";
var closed = "data-closed";
var startingStyle2 = TransitionStatusDataAttributes_exports.startingStyle;
var endingStyle2 = TransitionStatusDataAttributes_exports.endingStyle;
// node_modules/@base-ui/react/collapsible/trigger/CollapsibleTriggerDataAttributes.mjs
var panelOpen = "data-panel-open";
// node_modules/@base-ui/react/utils/collapsibleOpenStateMapping.mjs
var PANEL_OPEN_HOOK = {
[open]: ""
};
var PANEL_CLOSED_HOOK = {
[closed]: ""
};
var triggerOpenStateMapping = {
open(value) {
if (value) {
return {
[panelOpen]: ""
};
}
return null;
}
};
var collapsibleOpenStateMapping = {
open(value) {
if (value) {
return PANEL_OPEN_HOOK;
}
return PANEL_CLOSED_HOOK;
}
};
// node_modules/@base-ui/react/internals/use-button/useButton.mjs
var React15 = __toESM(require_react(), 1);
// 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();
}
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
} = getComputedStyle2(element);
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
}
function isTableElement(element) {
return /^(table|td|th)$/.test(getNodeName(element));
}
function isTopLayer(element) {
try {
if (element.matches(":popover-open")) {
return true;
}
} catch (_e) {
}
try {
return element.matches(":modal");
} catch (_e) {
return false;
}
}
var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
var containRe = /paint|layout|strict|content/;
var isNotNone = (value) => !!value && value !== "none";
var isWebKitValue;
function isContainingBlock(elementOrCss) {
const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
}
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 (isWebKitValue == null) {
isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
}
return isWebKitValue;
}
function isLastTraversableNode(node) {
return /^(html|body|#document)$/.test(getNodeName(node));
}
function getComputedStyle2(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).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) : []);
} else {
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
}
}
function getFrameElement(win) {
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
}
// node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs
var React13 = __toESM(require_react(), 1);
var CompositeRootContext = /* @__PURE__ */ React13.createContext(void 0);
if (true) CompositeRootContext.displayName = "CompositeRootContext";
function useCompositeRootContext(optional = false) {
const context = React13.useContext(CompositeRootContext);
if (context === void 0 && !optional) {
throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within ." : formatErrorMessage_default(16));
}
return context;
}
// node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs
var React14 = __toESM(require_react(), 1);
function useFocusableWhenDisabled(parameters) {
const {
focusableWhenDisabled,
disabled: disabled2,
composite = false,
tabIndex: tabIndexProp = 0,
isNativeButton
} = parameters;
const isFocusableComposite = composite && focusableWhenDisabled !== false;
const isNonFocusableComposite = composite && focusableWhenDisabled === false;
const props = React14.useMemo(() => {
const additionalProps = {
// allow Tabbing away from focusableWhenDisabled elements
onKeyDown(event) {
if (disabled2 && focusableWhenDisabled && event.key !== "Tab") {
event.preventDefault();
}
}
};
if (!composite) {
additionalProps.tabIndex = tabIndexProp;
if (!isNativeButton && disabled2) {
additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
}
}
if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) {
additionalProps["aria-disabled"] = disabled2;
}
if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {
additionalProps.disabled = disabled2;
}
return additionalProps;
}, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);
return {
props
};
}
// node_modules/@base-ui/utils/owner.mjs
function ownerDocument(node) {
return node?.ownerDocument || document;
}
// node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs
function dispatchClickWithModifiers(target, sourceEvent, {
detail = 0
} = {}) {
target.dispatchEvent(new (getWindow(target)).PointerEvent("click", {
bubbles: true,
cancelable: true,
composed: true,
detail,
shiftKey: sourceEvent.shiftKey,
ctrlKey: sourceEvent.ctrlKey,
altKey: sourceEvent.altKey,
metaKey: sourceEvent.metaKey
}));
}
// node_modules/@base-ui/react/internals/use-button/useButton.mjs
function useButton(parameters = {}) {
const {
disabled: disabled2 = false,
focusableWhenDisabled,
tabIndex = 0,
native: isNativeButton = true,
composite: compositeProp
} = parameters;
const elementRef = React15.useRef(null);
const compositeRootContext = useCompositeRootContext(true);
const isCompositeItem = compositeProp ?? compositeRootContext !== void 0;
const {
props: focusableWhenDisabledProps
} = useFocusableWhenDisabled({
focusableWhenDisabled,
disabled: disabled2,
composite: isCompositeItem,
tabIndex,
isNativeButton
});
if (true) {
React15.useEffect(() => {
if (!elementRef.current) {
return;
}
const isButtonTag = isButtonElement(elementRef.current);
if (isNativeButton) {
if (!isButtonTag) {
const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
const message = "A component that acts as a button expected a native