"use strict";
var wp;
(wp ||= {}).components = (() => {
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 __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
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, from2, except, desc) => {
if (from2 && typeof from2 === "object" || typeof from2 === "function") {
for (let key of __getOwnPropNames(from2))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, 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/primitives
var require_primitives = __commonJS({
"package-external:@wordpress/primitives"(exports, module) {
module.exports = window.wp.primitives;
}
});
// package-external:@wordpress/i18n
var require_i18n = __commonJS({
"package-external:@wordpress/i18n"(exports, module) {
module.exports = window.wp.i18n;
}
});
// package-external:@wordpress/compose
var require_compose = __commonJS({
"package-external:@wordpress/compose"(exports, module) {
module.exports = window.wp.compose;
}
});
// package-external:@wordpress/element
var require_element = __commonJS({
"package-external:@wordpress/element"(exports, module) {
module.exports = window.wp.element;
}
});
// vendor-external:react
var require_react = __commonJS({
"vendor-external:react"(exports, module) {
module.exports = window.React;
}
});
// vendor-external:react/jsx-runtime
var require_jsx_runtime = __commonJS({
"vendor-external:react/jsx-runtime"(exports, module) {
module.exports = window.ReactJSXRuntime;
}
});
// 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(x2, y3) {
return x2 === y3 && (0 !== x2 || 1 / x2 === 1 / y3) || x2 !== x2 && y3 !== y3;
}
function useSyncExternalStore$2(subscribe2, getSnapshot) {
didWarnOld18Alpha || void 0 === React37.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 = useState86({
inst: { value, getSnapshot }
});
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
useLayoutEffect24(
function() {
inst.value = value;
inst.getSnapshot = getSnapshot;
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
},
[subscribe2, value, getSnapshot]
);
useEffect80(
function() {
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
return subscribe2(function() {
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
});
},
[subscribe2]
);
useDebugValue(value);
return value;
}
function checkIfSnapshotChanged(inst) {
var latestGetSnapshot = inst.getSnapshot;
inst = inst.value;
try {
var nextValue = latestGetSnapshot();
return !objectIs(inst, nextValue);
} catch (error) {
return true;
}
}
function useSyncExternalStore$1(subscribe2, getSnapshot) {
return getSnapshot();
}
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
var React37 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState86 = React37.useState, useEffect80 = React37.useEffect, useLayoutEffect24 = React37.useLayoutEffect, useDebugValue = React37.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 !== React37.useSyncExternalStore ? React37.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();
}
}
});
// vendor-external:react-dom
var require_react_dom = __commonJS({
"vendor-external:react-dom"(exports, module) {
module.exports = window.ReactDOM;
}
});
// package-external:@wordpress/deprecated
var require_deprecated = __commonJS({
"package-external:@wordpress/deprecated"(exports, module) {
module.exports = window.wp.deprecated;
}
});
// node_modules/@emotion/is-prop-valid/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
function memoize(fn) {
var cache2 = /* @__PURE__ */ Object.create(null);
return function(arg) {
if (cache2[arg] === void 0) cache2[arg] = fn(arg);
return cache2[arg];
};
}
var init_emotion_memoize_esm = __esm({
"node_modules/@emotion/is-prop-valid/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js"() {
}
});
// node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js
var emotion_is_prop_valid_esm_exports = {};
__export(emotion_is_prop_valid_esm_exports, {
default: () => isPropValid
});
var reactPropsRegex, isPropValid;
var init_emotion_is_prop_valid_esm = __esm({
"node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js"() {
init_emotion_memoize_esm();
reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
isPropValid = /* @__PURE__ */ memoize(
function(prop) {
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
}
/* Z+1 */
);
}
});
// node_modules/deepmerge/dist/cjs.js
var require_cjs = __commonJS({
"node_modules/deepmerge/dist/cjs.js"(exports, module) {
"use strict";
var isMergeableObject = function isMergeableObject2(value) {
return isNonNullObject(value) && !isSpecial(value);
};
function isNonNullObject(value) {
return !!value && typeof value === "object";
}
function isSpecial(value) {
var stringValue = Object.prototype.toString.call(value);
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
}
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
function isReactElement(value) {
return value.$$typeof === REACT_ELEMENT_TYPE;
}
function emptyTarget(val) {
return Array.isArray(val) ? [] : {};
}
function cloneUnlessOtherwiseSpecified(value, options2) {
return options2.clone !== false && options2.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options2) : value;
}
function defaultArrayMerge(target, source, options2) {
return target.concat(source).map(function(element) {
return cloneUnlessOtherwiseSpecified(element, options2);
});
}
function getMergeFunction(key, options2) {
if (!options2.customMerge) {
return deepmerge2;
}
var customMerge = options2.customMerge(key);
return typeof customMerge === "function" ? customMerge : deepmerge2;
}
function getEnumerableOwnPropertySymbols(target) {
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol4) {
return Object.propertyIsEnumerable.call(target, symbol4);
}) : [];
}
function getKeys2(target) {
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
}
function propertyIsOnObject(object, property) {
try {
return property in object;
} catch (_) {
return false;
}
}
function propertyIsUnsafe(target, key) {
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
}
function mergeObject(target, source, options2) {
var destination = {};
if (options2.isMergeableObject(target)) {
getKeys2(target).forEach(function(key) {
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options2);
});
}
getKeys2(source).forEach(function(key) {
if (propertyIsUnsafe(target, key)) {
return;
}
if (propertyIsOnObject(target, key) && options2.isMergeableObject(source[key])) {
destination[key] = getMergeFunction(key, options2)(target[key], source[key], options2);
} else {
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options2);
}
});
return destination;
}
function deepmerge2(target, source, options2) {
options2 = options2 || {};
options2.arrayMerge = options2.arrayMerge || defaultArrayMerge;
options2.isMergeableObject = options2.isMergeableObject || isMergeableObject;
options2.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
var sourceIsArray = Array.isArray(source);
var targetIsArray = Array.isArray(target);
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
if (!sourceAndTargetTypesMatch) {
return cloneUnlessOtherwiseSpecified(source, options2);
} else if (sourceIsArray) {
return options2.arrayMerge(target, source, options2);
} else {
return mergeObject(target, source, options2);
}
}
deepmerge2.all = function deepmergeAll(array, options2) {
if (!Array.isArray(array)) {
throw new Error("first argument should be an array");
}
return array.reduce(function(prev2, next2) {
return deepmerge2(prev2, next2, options2);
}, {});
};
var deepmerge_1 = deepmerge2;
module.exports = deepmerge_1;
}
});
// node_modules/fast-deep-equal/es6/index.js
var require_es6 = __commonJS({
"node_modules/fast-deep-equal/es6/index.js"(exports, module) {
"use strict";
module.exports = function equal(a3, b3) {
if (a3 === b3) return true;
if (a3 && b3 && typeof a3 == "object" && typeof b3 == "object") {
if (a3.constructor !== b3.constructor) return false;
var length2, i3, keys;
if (Array.isArray(a3)) {
length2 = a3.length;
if (length2 != b3.length) return false;
for (i3 = length2; i3-- !== 0; )
if (!equal(a3[i3], b3[i3])) return false;
return true;
}
if (a3 instanceof Map && b3 instanceof Map) {
if (a3.size !== b3.size) return false;
for (i3 of a3.entries())
if (!b3.has(i3[0])) return false;
for (i3 of a3.entries())
if (!equal(i3[1], b3.get(i3[0]))) return false;
return true;
}
if (a3 instanceof Set && b3 instanceof Set) {
if (a3.size !== b3.size) return false;
for (i3 of a3.entries())
if (!b3.has(i3[0])) return false;
return true;
}
if (ArrayBuffer.isView(a3) && ArrayBuffer.isView(b3)) {
length2 = a3.length;
if (length2 != b3.length) return false;
for (i3 = length2; i3-- !== 0; )
if (a3[i3] !== b3[i3]) return false;
return true;
}
if (a3.constructor === RegExp) return a3.source === b3.source && a3.flags === b3.flags;
if (a3.valueOf !== Object.prototype.valueOf) return a3.valueOf() === b3.valueOf();
if (a3.toString !== Object.prototype.toString) return a3.toString() === b3.toString();
keys = Object.keys(a3);
length2 = keys.length;
if (length2 !== Object.keys(b3).length) return false;
for (i3 = length2; i3-- !== 0; )
if (!Object.prototype.hasOwnProperty.call(b3, keys[i3])) return false;
for (i3 = length2; i3-- !== 0; ) {
var key = keys[i3];
if (!equal(a3[key], b3[key])) return false;
}
return true;
}
return a3 !== a3 && b3 !== b3;
};
}
});
// package-external:@wordpress/warning
var require_warning = __commonJS({
"package-external:@wordpress/warning"(exports, module) {
module.exports = window.wp.warning;
}
});
// node_modules/react-is/cjs/react-is.development.js
var require_react_is_development = __commonJS({
"node_modules/react-is/cjs/react-is.development.js"(exports) {
"use strict";
if (true) {
(function() {
"use strict";
var hasSymbol = typeof Symbol === "function" && Symbol.for;
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
function isValidElementType(type) {
return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
}
function typeOf(object) {
if (typeof object === "object" && object !== null) {
var $$typeof = object.$$typeof;
switch ($$typeof) {
case REACT_ELEMENT_TYPE:
var type = object.type;
switch (type) {
case REACT_ASYNC_MODE_TYPE:
case REACT_CONCURRENT_MODE_TYPE:
case REACT_FRAGMENT_TYPE:
case REACT_PROFILER_TYPE:
case REACT_STRICT_MODE_TYPE:
case REACT_SUSPENSE_TYPE:
return type;
default:
var $$typeofType = type && type.$$typeof;
switch ($$typeofType) {
case REACT_CONTEXT_TYPE:
case REACT_FORWARD_REF_TYPE:
case REACT_LAZY_TYPE:
case REACT_MEMO_TYPE:
case REACT_PROVIDER_TYPE:
return $$typeofType;
default:
return $$typeof;
}
}
case REACT_PORTAL_TYPE:
return $$typeof;
}
}
return void 0;
}
var AsyncMode = REACT_ASYNC_MODE_TYPE;
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
var ContextConsumer = REACT_CONTEXT_TYPE;
var ContextProvider = REACT_PROVIDER_TYPE;
var Element2 = REACT_ELEMENT_TYPE;
var ForwardRef = REACT_FORWARD_REF_TYPE;
var Fragment11 = REACT_FRAGMENT_TYPE;
var Lazy = REACT_LAZY_TYPE;
var Memo = REACT_MEMO_TYPE;
var Portal3 = REACT_PORTAL_TYPE;
var Profiler = REACT_PROFILER_TYPE;
var StrictMode = REACT_STRICT_MODE_TYPE;
var Suspense = REACT_SUSPENSE_TYPE;
var hasWarnedAboutDeprecatedIsAsyncMode = false;
function isAsyncMode(object) {
{
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
hasWarnedAboutDeprecatedIsAsyncMode = true;
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
}
}
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
}
function isConcurrentMode(object) {
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
}
function isContextConsumer(object) {
return typeOf(object) === REACT_CONTEXT_TYPE;
}
function isContextProvider(object) {
return typeOf(object) === REACT_PROVIDER_TYPE;
}
function isElement2(object) {
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
}
function isForwardRef(object) {
return typeOf(object) === REACT_FORWARD_REF_TYPE;
}
function isFragment(object) {
return typeOf(object) === REACT_FRAGMENT_TYPE;
}
function isLazy(object) {
return typeOf(object) === REACT_LAZY_TYPE;
}
function isMemo(object) {
return typeOf(object) === REACT_MEMO_TYPE;
}
function isPortal(object) {
return typeOf(object) === REACT_PORTAL_TYPE;
}
function isProfiler(object) {
return typeOf(object) === REACT_PROFILER_TYPE;
}
function isStrictMode(object) {
return typeOf(object) === REACT_STRICT_MODE_TYPE;
}
function isSuspense(object) {
return typeOf(object) === REACT_SUSPENSE_TYPE;
}
exports.AsyncMode = AsyncMode;
exports.ConcurrentMode = ConcurrentMode;
exports.ContextConsumer = ContextConsumer;
exports.ContextProvider = ContextProvider;
exports.Element = Element2;
exports.ForwardRef = ForwardRef;
exports.Fragment = Fragment11;
exports.Lazy = Lazy;
exports.Memo = Memo;
exports.Portal = Portal3;
exports.Profiler = Profiler;
exports.StrictMode = StrictMode;
exports.Suspense = Suspense;
exports.isAsyncMode = isAsyncMode;
exports.isConcurrentMode = isConcurrentMode;
exports.isContextConsumer = isContextConsumer;
exports.isContextProvider = isContextProvider;
exports.isElement = isElement2;
exports.isForwardRef = isForwardRef;
exports.isFragment = isFragment;
exports.isLazy = isLazy;
exports.isMemo = isMemo;
exports.isPortal = isPortal;
exports.isProfiler = isProfiler;
exports.isStrictMode = isStrictMode;
exports.isSuspense = isSuspense;
exports.isValidElementType = isValidElementType;
exports.typeOf = typeOf;
})();
}
}
});
// node_modules/react-is/index.js
var require_react_is = __commonJS({
"node_modules/react-is/index.js"(exports, module) {
"use strict";
if (false) {
module.exports = null;
} else {
module.exports = require_react_is_development();
}
}
});
// node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js
var require_hoist_non_react_statics_cjs = __commonJS({
"node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js"(exports, module) {
"use strict";
var reactIs = require_react_is();
var REACT_STATICS = {
childContextTypes: true,
contextType: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
getDerivedStateFromError: true,
getDerivedStateFromProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
callee: true,
arguments: true,
arity: true
};
var FORWARD_REF_STATICS = {
"$$typeof": true,
render: true,
defaultProps: true,
displayName: true,
propTypes: true
};
var MEMO_STATICS = {
"$$typeof": true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
function getStatics(component) {
if (reactIs.isMemo(component)) {
return MEMO_STATICS;
}
return TYPE_STATICS[component["$$typeof"]] || REACT_STATICS;
}
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = Object.prototype;
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== "string") {
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
}
var keys = getOwnPropertyNames(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
var targetStatics = getStatics(targetComponent);
var sourceStatics = getStatics(sourceComponent);
for (var i3 = 0; i3 < keys.length; ++i3) {
var key = keys[i3];
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
try {
defineProperty(targetComponent, key, descriptor);
} catch (e3) {
}
}
}
}
return targetComponent;
}
module.exports = hoistNonReactStatics;
}
});
// node_modules/highlight-words-core/dist/index.js
var require_dist = __commonJS({
"node_modules/highlight-words-core/dist/index.js"(exports, module) {
module.exports = /******/
(function(modules) {
var installedModules = {};
function __webpack_require__(moduleId) {
if (installedModules[moduleId])
return installedModules[moduleId].exports;
var module2 = installedModules[moduleId] = {
/******/
exports: {},
/******/
id: moduleId,
/******/
loaded: false
/******/
};
modules[moduleId].call(module2.exports, module2, module2.exports, __webpack_require__);
module2.loaded = true;
return module2.exports;
}
__webpack_require__.m = modules;
__webpack_require__.c = installedModules;
__webpack_require__.p = "";
return __webpack_require__(0);
})([
/* 0 */
/***/
(function(module2, exports2, __webpack_require__) {
module2.exports = __webpack_require__(1);
}),
/* 1 */
/***/
(function(module2, exports2, __webpack_require__) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
var _utils = __webpack_require__(2);
Object.defineProperty(exports2, "combineChunks", {
enumerable: true,
get: function get() {
return _utils.combineChunks;
}
});
Object.defineProperty(exports2, "fillInChunks", {
enumerable: true,
get: function get() {
return _utils.fillInChunks;
}
});
Object.defineProperty(exports2, "findAll", {
enumerable: true,
get: function get() {
return _utils.findAll;
}
});
Object.defineProperty(exports2, "findChunks", {
enumerable: true,
get: function get() {
return _utils.findChunks;
}
});
}),
/* 2 */
/***/
(function(module2, exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", {
value: true
});
var findAll2 = exports2.findAll = function findAll3(_ref11) {
var autoEscape = _ref11.autoEscape, _ref$caseSensitive = _ref11.caseSensitive, caseSensitive = _ref$caseSensitive === void 0 ? false : _ref$caseSensitive, _ref$findChunks = _ref11.findChunks, findChunks = _ref$findChunks === void 0 ? defaultFindChunks : _ref$findChunks, sanitize2 = _ref11.sanitize, searchWords = _ref11.searchWords, textToHighlight = _ref11.textToHighlight;
return fillInChunks({
chunksToHighlight: combineChunks({
chunks: findChunks({
autoEscape,
caseSensitive,
sanitize: sanitize2,
searchWords,
textToHighlight
})
}),
totalLength: textToHighlight ? textToHighlight.length : 0
});
};
var combineChunks = exports2.combineChunks = function combineChunks2(_ref25) {
var chunks = _ref25.chunks;
chunks = chunks.sort(function(first, second) {
return first.start - second.start;
}).reduce(function(processedChunks, nextChunk) {
if (processedChunks.length === 0) {
return [nextChunk];
} else {
var prevChunk = processedChunks.pop();
if (nextChunk.start <= prevChunk.end) {
var endIndex = Math.max(prevChunk.end, nextChunk.end);
processedChunks.push({ highlight: false, start: prevChunk.start, end: endIndex });
} else {
processedChunks.push(prevChunk, nextChunk);
}
return processedChunks;
}
}, []);
return chunks;
};
var defaultFindChunks = function defaultFindChunks2(_ref32) {
var autoEscape = _ref32.autoEscape, caseSensitive = _ref32.caseSensitive, _ref3$sanitize = _ref32.sanitize, sanitize2 = _ref3$sanitize === void 0 ? defaultSanitize : _ref3$sanitize, searchWords = _ref32.searchWords, textToHighlight = _ref32.textToHighlight;
textToHighlight = sanitize2(textToHighlight);
return searchWords.filter(function(searchWord) {
return searchWord;
}).reduce(function(chunks, searchWord) {
searchWord = sanitize2(searchWord);
if (autoEscape) {
searchWord = escapeRegExpFn(searchWord);
}
var regex = new RegExp(searchWord, caseSensitive ? "g" : "gi");
var match5 = void 0;
while (match5 = regex.exec(textToHighlight)) {
var _start = match5.index;
var _end = regex.lastIndex;
if (_end > _start) {
chunks.push({ highlight: false, start: _start, end: _end });
}
if (match5.index === regex.lastIndex) {
regex.lastIndex++;
}
}
return chunks;
}, []);
};
exports2.findChunks = defaultFindChunks;
var fillInChunks = exports2.fillInChunks = function fillInChunks2(_ref42) {
var chunksToHighlight = _ref42.chunksToHighlight, totalLength = _ref42.totalLength;
var allChunks = [];
var append2 = function append3(start, end, highlight) {
if (end - start > 0) {
allChunks.push({
start,
end,
highlight
});
}
};
if (chunksToHighlight.length === 0) {
append2(0, totalLength, false);
} else {
var lastIndex = 0;
chunksToHighlight.forEach(function(chunk) {
append2(lastIndex, chunk.start, false);
append2(chunk.start, chunk.end, true);
lastIndex = chunk.end;
});
append2(lastIndex, totalLength, false);
}
return allChunks;
};
function defaultSanitize(string) {
return string;
}
function escapeRegExpFn(string) {
return string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
})
/******/
]);
}
});
// node_modules/remove-accents/index.js
var require_remove_accents = __commonJS({
"node_modules/remove-accents/index.js"(exports, module) {
var characterMap = {
"\xC0": "A",
"\xC1": "A",
"\xC2": "A",
"\xC3": "A",
"\xC4": "A",
"\xC5": "A",
"\u1EA4": "A",
"\u1EAE": "A",
"\u1EB2": "A",
"\u1EB4": "A",
"\u1EB6": "A",
"\xC6": "AE",
"\u1EA6": "A",
"\u1EB0": "A",
"\u0202": "A",
"\u1EA2": "A",
"\u1EA0": "A",
"\u1EA8": "A",
"\u1EAA": "A",
"\u1EAC": "A",
"\xC7": "C",
"\u1E08": "C",
"\xC8": "E",
"\xC9": "E",
"\xCA": "E",
"\xCB": "E",
"\u1EBE": "E",
"\u1E16": "E",
"\u1EC0": "E",
"\u1E14": "E",
"\u1E1C": "E",
"\u0206": "E",
"\u1EBA": "E",
"\u1EBC": "E",
"\u1EB8": "E",
"\u1EC2": "E",
"\u1EC4": "E",
"\u1EC6": "E",
"\xCC": "I",
"\xCD": "I",
"\xCE": "I",
"\xCF": "I",
"\u1E2E": "I",
"\u020A": "I",
"\u1EC8": "I",
"\u1ECA": "I",
"\xD0": "D",
"\xD1": "N",
"\xD2": "O",
"\xD3": "O",
"\xD4": "O",
"\xD5": "O",
"\xD6": "O",
"\xD8": "O",
"\u1ED0": "O",
"\u1E4C": "O",
"\u1E52": "O",
"\u020E": "O",
"\u1ECE": "O",
"\u1ECC": "O",
"\u1ED4": "O",
"\u1ED6": "O",
"\u1ED8": "O",
"\u1EDC": "O",
"\u1EDE": "O",
"\u1EE0": "O",
"\u1EDA": "O",
"\u1EE2": "O",
"\xD9": "U",
"\xDA": "U",
"\xDB": "U",
"\xDC": "U",
"\u1EE6": "U",
"\u1EE4": "U",
"\u1EEC": "U",
"\u1EEE": "U",
"\u1EF0": "U",
"\xDD": "Y",
"\xE0": "a",
"\xE1": "a",
"\xE2": "a",
"\xE3": "a",
"\xE4": "a",
"\xE5": "a",
"\u1EA5": "a",
"\u1EAF": "a",
"\u1EB3": "a",
"\u1EB5": "a",
"\u1EB7": "a",
"\xE6": "ae",
"\u1EA7": "a",
"\u1EB1": "a",
"\u0203": "a",
"\u1EA3": "a",
"\u1EA1": "a",
"\u1EA9": "a",
"\u1EAB": "a",
"\u1EAD": "a",
"\xE7": "c",
"\u1E09": "c",
"\xE8": "e",
"\xE9": "e",
"\xEA": "e",
"\xEB": "e",
"\u1EBF": "e",
"\u1E17": "e",
"\u1EC1": "e",
"\u1E15": "e",
"\u1E1D": "e",
"\u0207": "e",
"\u1EBB": "e",
"\u1EBD": "e",
"\u1EB9": "e",
"\u1EC3": "e",
"\u1EC5": "e",
"\u1EC7": "e",
"\xEC": "i",
"\xED": "i",
"\xEE": "i",
"\xEF": "i",
"\u1E2F": "i",
"\u020B": "i",
"\u1EC9": "i",
"\u1ECB": "i",
"\xF0": "d",
"\xF1": "n",
"\xF2": "o",
"\xF3": "o",
"\xF4": "o",
"\xF5": "o",
"\xF6": "o",
"\xF8": "o",
"\u1ED1": "o",
"\u1E4D": "o",
"\u1E53": "o",
"\u020F": "o",
"\u1ECF": "o",
"\u1ECD": "o",
"\u1ED5": "o",
"\u1ED7": "o",
"\u1ED9": "o",
"\u1EDD": "o",
"\u1EDF": "o",
"\u1EE1": "o",
"\u1EDB": "o",
"\u1EE3": "o",
"\xF9": "u",
"\xFA": "u",
"\xFB": "u",
"\xFC": "u",
"\u1EE7": "u",
"\u1EE5": "u",
"\u1EED": "u",
"\u1EEF": "u",
"\u1EF1": "u",
"\xFD": "y",
"\xFF": "y",
"\u0100": "A",
"\u0101": "a",
"\u0102": "A",
"\u0103": "a",
"\u0104": "A",
"\u0105": "a",
"\u0106": "C",
"\u0107": "c",
"\u0108": "C",
"\u0109": "c",
"\u010A": "C",
"\u010B": "c",
"\u010C": "C",
"\u010D": "c",
"C\u0306": "C",
"c\u0306": "c",
"\u010E": "D",
"\u010F": "d",
"\u0110": "D",
"\u0111": "d",
"\u0112": "E",
"\u0113": "e",
"\u0114": "E",
"\u0115": "e",
"\u0116": "E",
"\u0117": "e",
"\u0118": "E",
"\u0119": "e",
"\u011A": "E",
"\u011B": "e",
"\u011C": "G",
"\u01F4": "G",
"\u011D": "g",
"\u01F5": "g",
"\u011E": "G",
"\u011F": "g",
"\u0120": "G",
"\u0121": "g",
"\u0122": "G",
"\u0123": "g",
"\u0124": "H",
"\u0125": "h",
"\u0126": "H",
"\u0127": "h",
"\u1E2A": "H",
"\u1E2B": "h",
"\u0128": "I",
"\u0129": "i",
"\u012A": "I",
"\u012B": "i",
"\u012C": "I",
"\u012D": "i",
"\u012E": "I",
"\u012F": "i",
"\u0130": "I",
"\u0131": "i",
"\u0132": "IJ",
"\u0133": "ij",
"\u0134": "J",
"\u0135": "j",
"\u0136": "K",
"\u0137": "k",
"\u1E30": "K",
"\u1E31": "k",
"K\u0306": "K",
"k\u0306": "k",
"\u0139": "L",
"\u013A": "l",
"\u013B": "L",
"\u013C": "l",
"\u013D": "L",
"\u013E": "l",
"\u013F": "L",
"\u0140": "l",
"\u0141": "l",
"\u0142": "l",
"\u1E3E": "M",
"\u1E3F": "m",
"M\u0306": "M",
"m\u0306": "m",
"\u0143": "N",
"\u0144": "n",
"\u0145": "N",
"\u0146": "n",
"\u0147": "N",
"\u0148": "n",
"\u0149": "n",
"N\u0306": "N",
"n\u0306": "n",
"\u014C": "O",
"\u014D": "o",
"\u014E": "O",
"\u014F": "o",
"\u0150": "O",
"\u0151": "o",
"\u0152": "OE",
"\u0153": "oe",
"P\u0306": "P",
"p\u0306": "p",
"\u0154": "R",
"\u0155": "r",
"\u0156": "R",
"\u0157": "r",
"\u0158": "R",
"\u0159": "r",
"R\u0306": "R",
"r\u0306": "r",
"\u0212": "R",
"\u0213": "r",
"\u015A": "S",
"\u015B": "s",
"\u015C": "S",
"\u015D": "s",
"\u015E": "S",
"\u0218": "S",
"\u0219": "s",
"\u015F": "s",
"\u0160": "S",
"\u0161": "s",
"\u0162": "T",
"\u0163": "t",
"\u021B": "t",
"\u021A": "T",
"\u0164": "T",
"\u0165": "t",
"\u0166": "T",
"\u0167": "t",
"T\u0306": "T",
"t\u0306": "t",
"\u0168": "U",
"\u0169": "u",
"\u016A": "U",
"\u016B": "u",
"\u016C": "U",
"\u016D": "u",
"\u016E": "U",
"\u016F": "u",
"\u0170": "U",
"\u0171": "u",
"\u0172": "U",
"\u0173": "u",
"\u0216": "U",
"\u0217": "u",
"V\u0306": "V",
"v\u0306": "v",
"\u0174": "W",
"\u0175": "w",
"\u1E82": "W",
"\u1E83": "w",
"X\u0306": "X",
"x\u0306": "x",
"\u0176": "Y",
"\u0177": "y",
"\u0178": "Y",
"Y\u0306": "Y",
"y\u0306": "y",
"\u0179": "Z",
"\u017A": "z",
"\u017B": "Z",
"\u017C": "z",
"\u017D": "Z",
"\u017E": "z",
"\u017F": "s",
"\u0192": "f",
"\u01A0": "O",
"\u01A1": "o",
"\u01AF": "U",
"\u01B0": "u",
"\u01CD": "A",
"\u01CE": "a",
"\u01CF": "I",
"\u01D0": "i",
"\u01D1": "O",
"\u01D2": "o",
"\u01D3": "U",
"\u01D4": "u",
"\u01D5": "U",
"\u01D6": "u",
"\u01D7": "U",
"\u01D8": "u",
"\u01D9": "U",
"\u01DA": "u",
"\u01DB": "U",
"\u01DC": "u",
"\u1EE8": "U",
"\u1EE9": "u",
"\u1E78": "U",
"\u1E79": "u",
"\u01FA": "A",
"\u01FB": "a",
"\u01FC": "AE",
"\u01FD": "ae",
"\u01FE": "O",
"\u01FF": "o",
"\xDE": "TH",
"\xFE": "th",
"\u1E54": "P",
"\u1E55": "p",
"\u1E64": "S",
"\u1E65": "s",
"X\u0301": "X",
"x\u0301": "x",
"\u0403": "\u0413",
"\u0453": "\u0433",
"\u040C": "\u041A",
"\u045C": "\u043A",
"A\u030B": "A",
"a\u030B": "a",
"E\u030B": "E",
"e\u030B": "e",
"I\u030B": "I",
"i\u030B": "i",
"\u01F8": "N",
"\u01F9": "n",
"\u1ED2": "O",
"\u1ED3": "o",
"\u1E50": "O",
"\u1E51": "o",
"\u1EEA": "U",
"\u1EEB": "u",
"\u1E80": "W",
"\u1E81": "w",
"\u1EF2": "Y",
"\u1EF3": "y",
"\u0200": "A",
"\u0201": "a",
"\u0204": "E",
"\u0205": "e",
"\u0208": "I",
"\u0209": "i",
"\u020C": "O",
"\u020D": "o",
"\u0210": "R",
"\u0211": "r",
"\u0214": "U",
"\u0215": "u",
"B\u030C": "B",
"b\u030C": "b",
"\u010C\u0323": "C",
"\u010D\u0323": "c",
"\xCA\u030C": "E",
"\xEA\u030C": "e",
"F\u030C": "F",
"f\u030C": "f",
"\u01E6": "G",
"\u01E7": "g",
"\u021E": "H",
"\u021F": "h",
"J\u030C": "J",
"\u01F0": "j",
"\u01E8": "K",
"\u01E9": "k",
"M\u030C": "M",
"m\u030C": "m",
"P\u030C": "P",
"p\u030C": "p",
"Q\u030C": "Q",
"q\u030C": "q",
"\u0158\u0329": "R",
"\u0159\u0329": "r",
"\u1E66": "S",
"\u1E67": "s",
"V\u030C": "V",
"v\u030C": "v",
"W\u030C": "W",
"w\u030C": "w",
"X\u030C": "X",
"x\u030C": "x",
"Y\u030C": "Y",
"y\u030C": "y",
"A\u0327": "A",
"a\u0327": "a",
"B\u0327": "B",
"b\u0327": "b",
"\u1E10": "D",
"\u1E11": "d",
"\u0228": "E",
"\u0229": "e",
"\u0190\u0327": "E",
"\u025B\u0327": "e",
"\u1E28": "H",
"\u1E29": "h",
"I\u0327": "I",
"i\u0327": "i",
"\u0197\u0327": "I",
"\u0268\u0327": "i",
"M\u0327": "M",
"m\u0327": "m",
"O\u0327": "O",
"o\u0327": "o",
"Q\u0327": "Q",
"q\u0327": "q",
"U\u0327": "U",
"u\u0327": "u",
"X\u0327": "X",
"x\u0327": "x",
"Z\u0327": "Z",
"z\u0327": "z",
"\u0439": "\u0438",
"\u0419": "\u0418",
"\u0451": "\u0435",
"\u0401": "\u0415"
};
var chars2 = Object.keys(characterMap).join("|");
var allAccents = new RegExp(chars2, "g");
var firstAccent = new RegExp(chars2, "");
function matcher(match5) {
return characterMap[match5];
}
var removeAccents5 = function(string) {
return string.replace(allAccents, matcher);
};
var hasAccents = function(string) {
return !!string.match(firstAccent);
};
module.exports = removeAccents5;
module.exports.has = hasAccents;
module.exports.remove = removeAccents5;
}
});
// package-external:@wordpress/rich-text
var require_rich_text = __commonJS({
"package-external:@wordpress/rich-text"(exports, module) {
module.exports = window.wp.richText;
}
});
// package-external:@wordpress/a11y
var require_a11y = __commonJS({
"package-external:@wordpress/a11y"(exports, module) {
module.exports = window.wp.a11y;
}
});
// package-external:@wordpress/keycodes
var require_keycodes = __commonJS({
"package-external:@wordpress/keycodes"(exports, module) {
module.exports = window.wp.keycodes;
}
});
// 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;
}
});
// node_modules/gradient-parser/build/node.js
var require_node = __commonJS({
"node_modules/gradient-parser/build/node.js"(exports) {
var GradientParser = GradientParser || {};
GradientParser.stringify = /* @__PURE__ */ (function() {
var visitor = {
"visit_linear-gradient": function(node2) {
return visitor.visit_gradient(node2);
},
"visit_repeating-linear-gradient": function(node2) {
return visitor.visit_gradient(node2);
},
"visit_radial-gradient": function(node2) {
return visitor.visit_gradient(node2);
},
"visit_repeating-radial-gradient": function(node2) {
return visitor.visit_gradient(node2);
},
"visit_gradient": function(node2) {
var orientation = visitor.visit(node2.orientation);
if (orientation) {
orientation += ", ";
}
return node2.type + "(" + orientation + visitor.visit(node2.colorStops) + ")";
},
"visit_shape": function(node2) {
var result = node2.value, at = visitor.visit(node2.at), style2 = visitor.visit(node2.style);
if (style2) {
result += " " + style2;
}
if (at) {
result += " at " + at;
}
return result;
},
"visit_default-radial": function(node2) {
var result = "", at = visitor.visit(node2.at);
if (at) {
result += at;
}
return result;
},
"visit_extent-keyword": function(node2) {
var result = node2.value, at = visitor.visit(node2.at);
if (at) {
result += " at " + at;
}
return result;
},
"visit_position-keyword": function(node2) {
return node2.value;
},
"visit_position": function(node2) {
return visitor.visit(node2.value.x) + " " + visitor.visit(node2.value.y);
},
"visit_%": function(node2) {
return node2.value + "%";
},
"visit_em": function(node2) {
return node2.value + "em";
},
"visit_px": function(node2) {
return node2.value + "px";
},
"visit_calc": function(node2) {
return "calc(" + node2.value + ")";
},
"visit_literal": function(node2) {
return visitor.visit_color(node2.value, node2);
},
"visit_hex": function(node2) {
return visitor.visit_color("#" + node2.value, node2);
},
"visit_rgb": function(node2) {
return visitor.visit_color("rgb(" + node2.value.join(", ") + ")", node2);
},
"visit_rgba": function(node2) {
return visitor.visit_color("rgba(" + node2.value.join(", ") + ")", node2);
},
"visit_hsl": function(node2) {
return visitor.visit_color("hsl(" + node2.value[0] + ", " + node2.value[1] + "%, " + node2.value[2] + "%)", node2);
},
"visit_hsla": function(node2) {
return visitor.visit_color("hsla(" + node2.value[0] + ", " + node2.value[1] + "%, " + node2.value[2] + "%, " + node2.value[3] + ")", node2);
},
"visit_var": function(node2) {
return visitor.visit_color("var(" + node2.value + ")", node2);
},
"visit_color": function(resultColor, node2) {
var result = resultColor, length2 = visitor.visit(node2.length);
if (length2) {
result += " " + length2;
}
return result;
},
"visit_angular": function(node2) {
return node2.value + "deg";
},
"visit_directional": function(node2) {
return "to " + node2.value;
},
"visit_array": function(elements2) {
var result = "", size3 = elements2.length;
elements2.forEach(function(element, i3) {
result += visitor.visit(element);
if (i3 < size3 - 1) {
result += ", ";
}
});
return result;
},
"visit_object": function(obj) {
if (obj.width && obj.height) {
return visitor.visit(obj.width) + " " + visitor.visit(obj.height);
}
return "";
},
"visit": function(element) {
if (!element) {
return "";
}
var result = "";
if (element instanceof Array) {
return visitor.visit_array(element);
} else if (typeof element === "object" && !element.type) {
return visitor.visit_object(element);
} else if (element.type) {
var nodeVisitor = visitor["visit_" + element.type];
if (nodeVisitor) {
return nodeVisitor(element);
} else {
throw Error("Missing visitor visit_" + element.type);
}
} else {
throw Error("Invalid node.");
}
}
};
return function(root) {
return visitor.visit(root);
};
})();
var GradientParser = GradientParser || {};
GradientParser.parse = /* @__PURE__ */ (function() {
var tokens = {
linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,
repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,
radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,
repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
positionKeywords: /^(left|center|right|top|bottom)/i,
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
radianValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))rad/,
startCall: /^\(/,
endCall: /^\)/,
comma: /^,/,
hexColor: /^\#([0-9a-fA-F]+)/,
literalColor: /^([a-zA-Z]+)/,
rgbColor: /^rgb/i,
rgbaColor: /^rgba/i,
varColor: /^var/i,
calcValue: /^calc/i,
variableName: /^(--[a-zA-Z0-9-,\s\#]+)/,
number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/,
hslColor: /^hsl/i,
hslaColor: /^hsla/i
};
var input = "";
function error(msg) {
var err = new Error(input + ": " + msg);
err.source = input;
throw err;
}
function getAST() {
var ast = matchListDefinitions();
if (input.length > 0) {
error("Invalid input not EOF");
}
return ast;
}
function matchListDefinitions() {
return matchListing(matchDefinition);
}
function matchDefinition() {
return matchGradient(
"linear-gradient",
tokens.linearGradient,
matchLinearOrientation
) || matchGradient(
"repeating-linear-gradient",
tokens.repeatingLinearGradient,
matchLinearOrientation
) || matchGradient(
"radial-gradient",
tokens.radialGradient,
matchListRadialOrientations
) || matchGradient(
"repeating-radial-gradient",
tokens.repeatingRadialGradient,
matchListRadialOrientations
);
}
function matchGradient(gradientType, pattern, orientationMatcher) {
return matchCall(pattern, function(captures) {
var orientation = orientationMatcher();
if (orientation) {
if (!scan(tokens.comma)) {
error("Missing comma before color stops");
}
}
return {
type: gradientType,
orientation,
colorStops: matchListing(matchColorStop)
};
});
}
function matchCall(pattern, callback) {
var captures = scan(pattern);
if (captures) {
if (!scan(tokens.startCall)) {
error("Missing (");
}
var result = callback(captures);
if (!scan(tokens.endCall)) {
error("Missing )");
}
return result;
}
}
function matchLinearOrientation() {
var sideOrCorner = matchSideOrCorner();
if (sideOrCorner) {
return sideOrCorner;
}
var legacyDirection = match5("position-keyword", tokens.positionKeywords, 1);
if (legacyDirection) {
return {
type: "directional",
value: legacyDirection.value
};
}
return matchAngle();
}
function matchSideOrCorner() {
return match5("directional", tokens.sideOrCorner, 1);
}
function matchAngle() {
return match5("angular", tokens.angleValue, 1) || match5("angular", tokens.radianValue, 1);
}
function matchListRadialOrientations() {
var radialOrientations, radialOrientation = matchRadialOrientation(), lookaheadCache;
if (radialOrientation) {
radialOrientations = [];
radialOrientations.push(radialOrientation);
lookaheadCache = input;
if (scan(tokens.comma)) {
radialOrientation = matchRadialOrientation();
if (radialOrientation) {
radialOrientations.push(radialOrientation);
} else {
input = lookaheadCache;
}
}
}
return radialOrientations;
}
function matchRadialOrientation() {
var radialType = matchCircle() || matchEllipse();
if (radialType) {
radialType.at = matchAtPosition();
} else {
var extent = matchExtentKeyword();
if (extent) {
radialType = extent;
var positionAt = matchAtPosition();
if (positionAt) {
radialType.at = positionAt;
}
} else {
var atPosition = matchAtPosition();
if (atPosition) {
radialType = {
type: "default-radial",
at: atPosition
};
} else {
var defaultPosition = matchPositioning();
if (defaultPosition) {
radialType = {
type: "default-radial",
at: defaultPosition
};
}
}
}
}
return radialType;
}
function matchCircle() {
var circle = match5("shape", /^(circle)/i, 0);
if (circle) {
circle.style = matchLength() || matchExtentKeyword();
}
return circle;
}
function matchEllipse() {
var ellipse = match5("shape", /^(ellipse)/i, 0);
if (ellipse) {
ellipse.style = matchPositioning() || matchDistance() || matchExtentKeyword();
}
return ellipse;
}
function matchExtentKeyword() {
return match5("extent-keyword", tokens.extentKeywords, 1);
}
function matchAtPosition() {
if (match5("position", /^at/, 0)) {
var positioning = matchPositioning();
if (!positioning) {
error("Missing positioning value");
}
return positioning;
}
}
function matchPositioning() {
var location = matchCoordinates();
if (location.x || location.y) {
return {
type: "position",
value: location
};
}
}
function matchCoordinates() {
return {
x: matchDistance(),
y: matchDistance()
};
}
function matchListing(matcher) {
var captures = matcher(), result = [];
if (captures) {
result.push(captures);
while (scan(tokens.comma)) {
captures = matcher();
if (captures) {
result.push(captures);
} else {
error("One extra comma");
}
}
}
return result;
}
function matchColorStop() {
var color2 = matchColor();
if (!color2) {
error("Expected color definition");
}
color2.length = matchDistance();
return color2;
}
function matchColor() {
return matchHexColor() || matchHSLAColor() || matchHSLColor() || matchRGBAColor() || matchRGBColor() || matchVarColor() || matchLiteralColor();
}
function matchLiteralColor() {
return match5("literal", tokens.literalColor, 0);
}
function matchHexColor() {
return match5("hex", tokens.hexColor, 1);
}
function matchRGBColor() {
return matchCall(tokens.rgbColor, function() {
return {
type: "rgb",
value: matchListing(matchNumber)
};
});
}
function matchRGBAColor() {
return matchCall(tokens.rgbaColor, function() {
return {
type: "rgba",
value: matchListing(matchNumber)
};
});
}
function matchVarColor() {
return matchCall(tokens.varColor, function() {
return {
type: "var",
value: matchVariableName()
};
});
}
function matchHSLColor() {
return matchCall(tokens.hslColor, function() {
var lookahead = scan(tokens.percentageValue);
if (lookahead) {
error("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");
}
var hue = matchNumber();
scan(tokens.comma);
var captures = scan(tokens.percentageValue);
var sat = captures ? captures[1] : null;
scan(tokens.comma);
captures = scan(tokens.percentageValue);
var light = captures ? captures[1] : null;
if (!sat || !light) {
error("Expected percentage value for saturation and lightness in HSL");
}
return {
type: "hsl",
value: [hue, sat, light]
};
});
}
function matchHSLAColor() {
return matchCall(tokens.hslaColor, function() {
var hue = matchNumber();
scan(tokens.comma);
var captures = scan(tokens.percentageValue);
var sat = captures ? captures[1] : null;
scan(tokens.comma);
captures = scan(tokens.percentageValue);
var light = captures ? captures[1] : null;
scan(tokens.comma);
var alpha2 = matchNumber();
if (!sat || !light) {
error("Expected percentage value for saturation and lightness in HSLA");
}
return {
type: "hsla",
value: [hue, sat, light, alpha2]
};
});
}
function matchPercentage() {
var captures = scan(tokens.percentageValue);
return captures ? captures[1] : null;
}
function matchVariableName() {
return scan(tokens.variableName)[1];
}
function matchNumber() {
return scan(tokens.number)[1];
}
function matchDistance() {
return match5("%", tokens.percentageValue, 1) || matchPositionKeyword() || matchCalc() || matchLength();
}
function matchPositionKeyword() {
return match5("position-keyword", tokens.positionKeywords, 1);
}
function matchCalc() {
return matchCall(tokens.calcValue, function() {
var openParenCount = 1;
var i3 = 0;
while (openParenCount > 0 && i3 < input.length) {
var char2 = input.charAt(i3);
if (char2 === "(") {
openParenCount++;
} else if (char2 === ")") {
openParenCount--;
}
i3++;
}
if (openParenCount > 0) {
error("Missing closing parenthesis in calc() expression");
}
var calcContent = input.substring(0, i3 - 1);
consume(i3 - 1);
return {
type: "calc",
value: calcContent
};
});
}
function matchLength() {
return match5("px", tokens.pixelValue, 1) || match5("em", tokens.emValue, 1);
}
function match5(type, pattern, captureIndex) {
var captures = scan(pattern);
if (captures) {
return {
type,
value: captures[captureIndex]
};
}
}
function scan(regexp) {
var captures, blankCaptures;
blankCaptures = /^[\n\r\t\s]+/.exec(input);
if (blankCaptures) {
consume(blankCaptures[0].length);
}
captures = regexp.exec(input);
if (captures) {
consume(captures[0].length);
}
return captures;
}
function consume(size3) {
input = input.substr(size3);
}
return function(code) {
input = code.toString().trim();
if (input.endsWith(";")) {
input = input.slice(0, -1);
}
return getAST();
};
})();
exports.parse = GradientParser.parse;
exports.stringify = GradientParser.stringify;
}
});
// package-external:@wordpress/dom
var require_dom = __commonJS({
"package-external:@wordpress/dom"(exports, module) {
module.exports = window.wp.dom;
}
});
// package-external:@wordpress/date
var require_date = __commonJS({
"package-external:@wordpress/date"(exports, module) {
module.exports = window.wp.date;
}
});
// package-external:@wordpress/escape-html
var require_escape_html = __commonJS({
"package-external:@wordpress/escape-html"(exports, module) {
module.exports = window.wp.escapeHtml;
}
});
// package-external:@wordpress/html-entities
var require_html_entities = __commonJS({
"package-external:@wordpress/html-entities"(exports, module) {
module.exports = window.wp.htmlEntities;
}
});
// node_modules/fast-memoize/src/index.js
var require_src = __commonJS({
"node_modules/fast-memoize/src/index.js"(exports, module) {
function memoize4(fn, options2) {
var cache2 = options2 && options2.cache ? options2.cache : cacheDefault;
var serializer = options2 && options2.serializer ? options2.serializer : serializerDefault;
var strategy = options2 && options2.strategy ? options2.strategy : strategyDefault;
return strategy(fn, {
cache: cache2,
serializer
});
}
function isPrimitive(value) {
return value == null || typeof value === "number" || typeof value === "boolean";
}
function monadic(fn, cache2, serializer, arg) {
var cacheKey = isPrimitive(arg) ? arg : serializer(arg);
var computedValue = cache2.get(cacheKey);
if (typeof computedValue === "undefined") {
computedValue = fn.call(this, arg);
cache2.set(cacheKey, computedValue);
}
return computedValue;
}
function variadic(fn, cache2, serializer) {
var args = Array.prototype.slice.call(arguments, 3);
var cacheKey = serializer(args);
var computedValue = cache2.get(cacheKey);
if (typeof computedValue === "undefined") {
computedValue = fn.apply(this, args);
cache2.set(cacheKey, computedValue);
}
return computedValue;
}
function assemble(fn, context, strategy, cache2, serialize2) {
return strategy.bind(
context,
fn,
cache2,
serialize2
);
}
function strategyDefault(fn, options2) {
var strategy = fn.length === 1 ? monadic : variadic;
return assemble(
fn,
this,
strategy,
options2.cache.create(),
options2.serializer
);
}
function strategyVariadic(fn, options2) {
var strategy = variadic;
return assemble(
fn,
this,
strategy,
options2.cache.create(),
options2.serializer
);
}
function strategyMonadic(fn, options2) {
var strategy = monadic;
return assemble(
fn,
this,
strategy,
options2.cache.create(),
options2.serializer
);
}
function serializerDefault() {
return JSON.stringify(arguments);
}
function ObjectWithoutPrototypeCache() {
this.cache = /* @__PURE__ */ Object.create(null);
}
ObjectWithoutPrototypeCache.prototype.has = function(key) {
return key in this.cache;
};
ObjectWithoutPrototypeCache.prototype.get = function(key) {
return this.cache[key];
};
ObjectWithoutPrototypeCache.prototype.set = function(key, value) {
this.cache[key] = value;
};
var cacheDefault = {
create: function create2() {
return new ObjectWithoutPrototypeCache();
}
};
module.exports = memoize4;
module.exports.strategies = {
variadic: strategyVariadic,
monadic: strategyMonadic
};
}
});
// package-external:@wordpress/hooks
var require_hooks = __commonJS({
"package-external:@wordpress/hooks"(exports, module) {
module.exports = window.wp.hooks;
}
});
// package-external:@wordpress/private-apis
var require_private_apis = __commonJS({
"package-external:@wordpress/private-apis"(exports, module) {
module.exports = window.wp.privateApis;
}
});
// packages/components/build-module/index.js
var index_exports = {};
__export(index_exports, {
AlignmentMatrixControl: () => alignment_matrix_control_default,
AnglePickerControl: () => angle_picker_control_default,
Animate: () => animate_default,
Autocomplete: () => Autocomplete,
BaseControl: () => base_control_default,
BlockQuotation: () => import_primitives36.BlockQuotation,
BorderBoxControl: () => component_default24,
BorderControl: () => component_default21,
BoxControl: () => box_control_default,
Button: () => button_default,
ButtonGroup: () => button_group_default,
Card: () => component_default27,
CardBody: () => component_default29,
CardDivider: () => component_default31,
CardFooter: () => component_default32,
CardHeader: () => component_default33,
CardMedia: () => component_default34,
CheckboxControl: () => checkbox_control_default,
Circle: () => import_primitives36.Circle,
ClipboardButton: () => ClipboardButton,
ColorIndicator: () => color_indicator_default,
ColorPalette: () => color_palette_default,
ColorPicker: () => LegacyAdapter,
ComboboxControl: () => combobox_control_default,
Composite: () => Composite22,
CustomGradientPicker: () => custom_gradient_picker_default,
CustomSelectControl: () => custom_select_control_default,
Dashicon: () => dashicon_default,
DatePicker: () => date_default,
DateTimePicker: () => date_time_default2,
Disabled: () => disabled_default,
Draggable: () => draggable_default,
DropZone: () => drop_zone_default,
DropZoneProvider: () => DropZoneProvider,
Dropdown: () => dropdown_default,
DropdownMenu: () => dropdown_menu_default,
DuotonePicker: () => duotone_picker_default,
DuotoneSwatch: () => duotone_swatch_default,
ExternalLink: () => external_link_default,
Fill: () => Fill3,
Flex: () => component_default3,
FlexBlock: () => component_default5,
FlexItem: () => component_default4,
FocalPointPicker: () => focal_point_picker_default,
FocusReturnProvider: () => Provider3,
FocusableIframe: () => FocusableIframe,
FontSizePicker: () => font_size_picker_default,
FormFileUpload: () => form_file_upload_default,
FormToggle: () => form_toggle_default,
FormTokenField: () => form_token_field_default,
G: () => import_primitives36.G,
GradientPicker: () => gradient_picker_default,
Guide: () => guide_default,
GuidePage: () => GuidePage,
HorizontalRule: () => import_primitives36.HorizontalRule,
Icon: () => icon_default3,
IconButton: () => deprecated_default,
IsolatedEventContainer: () => isolated_event_container_default,
KeyboardShortcuts: () => keyboard_shortcuts_default,
Line: () => import_primitives36.Line,
MenuGroup: () => menu_group_default,
MenuItem: () => menu_item_default,
MenuItemsChoice: () => menu_items_choice_default,
Modal: () => modal_default,
NavigableMenu: () => menu_default2,
Navigator: () => Navigator3,
Notice: () => notice_default,
NoticeList: () => list_default,
Panel: () => panel_default,
PanelBody: () => body_default,
PanelHeader: () => header_default,
PanelRow: () => row_default,
Path: () => import_primitives36.Path,
Placeholder: () => placeholder_default,
Polygon: () => import_primitives36.Polygon,
Popover: () => popover_default,
ProgressBar: () => progress_bar_default,
QueryControls: () => query_controls_default,
RadioControl: () => radio_control_default,
RangeControl: () => range_control_default,
Rect: () => import_primitives36.Rect,
ResizableBox: () => resizable_box_default,
ResponsiveWrapper: () => responsive_wrapper_default,
SVG: () => import_primitives36.SVG,
SandBox: () => sandbox_default,
ScrollLock: () => scroll_lock_default,
SearchControl: () => search_control_default,
SelectControl: () => select_control_default,
Slot: () => Slot3,
SlotFillProvider: () => Provider,
Snackbar: () => snackbar_default,
SnackbarList: () => list_default2,
Spinner: () => spinner_default,
TabPanel: () => tab_panel_default,
TabbableContainer: () => tabbable_default,
TextControl: () => text_control_default,
TextHighlight: () => text_highlight_default,
TextareaControl: () => textarea_control_default,
TimePicker: () => time_default,
Tip: () => tip_default2,
ToggleControl: () => toggle_control_default,
Toolbar: () => toolbar_default,
ToolbarButton: () => toolbar_button_default,
ToolbarDropdownMenu: () => toolbar_dropdown_menu_default,
ToolbarGroup: () => toolbar_group_default,
ToolbarItem: () => toolbar_item_default,
Tooltip: () => tooltip_default,
TreeSelect: () => tree_select_default,
VisuallyHidden: () => component_default2,
__experimentalAlignmentMatrixControl: () => alignment_matrix_control_default,
__experimentalApplyValueToSides: () => applyValueToSides,
__experimentalBorderBoxControl: () => component_default24,
__experimentalBorderControl: () => component_default21,
__experimentalBoxControl: () => box_control_default,
__experimentalConfirmDialog: () => component_default37,
__experimentalDivider: () => component_default30,
__experimentalDropdownContentWrapper: () => dropdown_content_wrapper_default,
__experimentalElevation: () => component_default25,
__experimentalGrid: () => component_default22,
__experimentalHStack: () => component_default9,
__experimentalHasSplitBorders: () => hasSplitBorders,
__experimentalHeading: () => component_default19,
__experimentalInputControl: () => input_control_default,
__experimentalInputControlPrefixWrapper: () => input_prefix_wrapper_default,
__experimentalInputControlSuffixWrapper: () => input_suffix_wrapper_default,
__experimentalIsDefinedBorder: () => isDefinedBorder,
__experimentalIsEmptyBorder: () => isEmptyBorder,
__experimentalItem: () => component_default35,
__experimentalItemGroup: () => component_default36,
__experimentalNavigation: () => navigation_default,
__experimentalNavigationBackButton: () => back_button_default,
__experimentalNavigationGroup: () => group_default,
__experimentalNavigationItem: () => item_default2,
__experimentalNavigationMenu: () => menu_default3,
__experimentalNavigatorBackButton: () => NavigatorBackButton2,
__experimentalNavigatorButton: () => NavigatorButton2,
__experimentalNavigatorProvider: () => NavigatorProvider,
__experimentalNavigatorScreen: () => NavigatorScreen2,
__experimentalNavigatorToParentButton: () => NavigatorToParentButton2,
__experimentalNumberControl: () => number_control_default,
__experimentalPaletteEdit: () => palette_edit_default,
__experimentalParseQuantityAndUnitFromRawValue: () => parseQuantityAndUnitFromRawValue,
__experimentalRadio: () => radio_default,
__experimentalRadioGroup: () => radio_group_default,
__experimentalScrollable: () => component_default28,
__experimentalSpacer: () => component_default6,
__experimentalStyleProvider: () => style_provider_default,
__experimentalSurface: () => component_default26,
__experimentalText: () => component_default8,
__experimentalToggleGroupControl: () => component_default12,
__experimentalToggleGroupControlOption: () => component_default14,
__experimentalToggleGroupControlOptionIcon: () => component_default15,
__experimentalToolbarContext: () => toolbar_context_default,
__experimentalToolsPanel: () => component_default39,
__experimentalToolsPanelContext: () => ToolsPanelContext,
__experimentalToolsPanelItem: () => component_default40,
__experimentalTreeGrid: () => tree_grid_default,
__experimentalTreeGridCell: () => cell_default,
__experimentalTreeGridItem: () => item_default3,
__experimentalTreeGridRow: () => row_default2,
__experimentalTruncate: () => component_default7,
__experimentalUnitControl: () => unit_control_default,
__experimentalUseCustomUnits: () => useCustomUnits,
__experimentalUseNavigator: () => useNavigator,
__experimentalUseSlot: () => useSlot,
__experimentalUseSlotFills: () => useSlotFills,
__experimentalVStack: () => component_default18,
__experimentalView: () => component_default,
__experimentalZStack: () => component_default41,
__unstableAnimatePresence: () => AnimatePresence,
__unstableComposite: () => Composite4,
__unstableCompositeGroup: () => CompositeGroup4,
__unstableCompositeItem: () => CompositeItem4,
__unstableDisclosureContent: () => DisclosureContent22,
__unstableGetAnimateClassName: () => getAnimateClassName,
__unstableMotion: () => motion,
__unstableUseAutocompleteProps: () => useAutocompleteProps,
__unstableUseCompositeState: () => useCompositeState,
__unstableUseNavigateRegions: () => useNavigateRegions,
createSlotFill: () => createSlotFill,
navigateRegions: () => navigate_regions_default,
privateApis: () => privateApis,
useBaseControlProps: () => useBaseControlProps,
useNavigator: () => useNavigator,
withConstrainedTabbing: () => with_constrained_tabbing_default,
withFallbackStyles: () => with_fallback_styles_default,
withFilters: () => withFilters,
withFocusOutside: () => with_focus_outside_default,
withFocusReturn: () => with_focus_return_default,
withNotices: () => with_notices_default,
withSpokenMessages: () => with_spoken_messages_default
});
var import_primitives36 = __toESM(require_primitives());
// node_modules/clsx/dist/clsx.mjs
function r(e3) {
var t4, f3, n3 = "";
if ("string" == typeof e3 || "number" == typeof e3) n3 += e3;
else if ("object" == typeof e3) if (Array.isArray(e3)) {
var o4 = e3.length;
for (t4 = 0; t4 < o4; t4++) e3[t4] && (f3 = r(e3[t4])) && (n3 && (n3 += " "), n3 += f3);
} else for (f3 in e3) e3[f3] && (n3 && (n3 += " "), n3 += f3);
return n3;
}
function clsx() {
for (var e3, t4, f3 = 0, n3 = "", o4 = arguments.length; f3 < o4; f3++) (e3 = arguments[f3]) && (t4 = r(e3)) && (n3 && (n3 += " "), n3 += t4);
return n3;
}
var clsx_default = clsx;
// packages/components/build-module/alignment-matrix-control/index.js
var import_i18n4 = __toESM(require_i18n());
var import_compose2 = __toESM(require_compose());
var import_element17 = __toESM(require_element());
// node_modules/@ariakit/react-core/esm/__chunks/3YLGPPWQ.js
var __defProp2 = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a3, b3) => {
for (var prop in b3 || (b3 = {}))
if (__hasOwnProp2.call(b3, prop))
__defNormalProp(a3, prop, b3[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b3)) {
if (__propIsEnum.call(b3, prop))
__defNormalProp(a3, prop, b3[prop]);
}
return a3;
};
var __spreadProps = (a3, b3) => __defProps(a3, __getOwnPropDescs(b3));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
// node_modules/@ariakit/core/esm/__chunks/3YLGPPWQ.js
var __defProp3 = Object.defineProperty;
var __defProps2 = Object.defineProperties;
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues2 = (a3, b3) => {
for (var prop in b3 || (b3 = {}))
if (__hasOwnProp3.call(b3, prop))
__defNormalProp2(a3, prop, b3[prop]);
if (__getOwnPropSymbols2)
for (var prop of __getOwnPropSymbols2(b3)) {
if (__propIsEnum2.call(b3, prop))
__defNormalProp2(a3, prop, b3[prop]);
}
return a3;
};
var __spreadProps2 = (a3, b3) => __defProps2(a3, __getOwnPropDescs2(b3));
var __objRest2 = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp3.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols2)
for (var prop of __getOwnPropSymbols2(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop))
target[prop] = source[prop];
}
return target;
};
// node_modules/@ariakit/core/esm/__chunks/PBFD2E7P.js
function noop(..._) {
}
function shallowEqual(a3, b3) {
if (a3 === b3) return true;
if (!a3) return false;
if (!b3) return false;
if (typeof a3 !== "object") return false;
if (typeof b3 !== "object") return false;
const aKeys = Object.keys(a3);
const bKeys = Object.keys(b3);
const { length: length2 } = aKeys;
if (bKeys.length !== length2) return false;
for (const key of aKeys) {
if (a3[key] !== b3[key]) {
return false;
}
}
return true;
}
function applyState(argument, currentValue) {
if (isUpdater(argument)) {
const value = isLazyValue(currentValue) ? currentValue() : currentValue;
return argument(value);
}
return argument;
}
function isUpdater(argument) {
return typeof argument === "function";
}
function isLazyValue(value) {
return typeof value === "function";
}
function hasOwnProperty(object, prop) {
if (typeof Object.hasOwn === "function") {
return Object.hasOwn(object, prop);
}
return Object.prototype.hasOwnProperty.call(object, prop);
}
function chain(...fns) {
return (...args) => {
for (const fn of fns) {
if (typeof fn === "function") {
fn(...args);
}
}
};
}
function normalizeString(str) {
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
}
function omit(object, keys) {
const result = __spreadValues2({}, object);
for (const key of keys) {
if (hasOwnProperty(result, key)) {
delete result[key];
}
}
return result;
}
function pick(object, paths) {
const result = {};
for (const key of paths) {
if (hasOwnProperty(object, key)) {
result[key] = object[key];
}
}
return result;
}
function identity(value) {
return value;
}
function invariant(condition, message3) {
if (condition) return;
if (typeof message3 !== "string") throw new Error("Invariant failed");
throw new Error(message3);
}
function getKeys(obj) {
return Object.keys(obj);
}
function isFalsyBooleanCallback(booleanOrCallback, ...args) {
const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback;
if (result == null) return false;
return !result;
}
function disabledFromProps(props) {
return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true";
}
function removeUndefinedValues(obj) {
const result = {};
for (const key in obj) {
if (obj[key] !== void 0) {
result[key] = obj[key];
}
}
return result;
}
function defaultValue(...values) {
for (const value of values) {
if (value !== void 0) return value;
}
return void 0;
}
// node_modules/@ariakit/react-core/esm/__chunks/SK3NAZA3.js
var import_react = __toESM(require_react(), 1);
function setRef(ref, value) {
if (typeof ref === "function") {
ref(value);
} else if (ref) {
ref.current = value;
}
}
function isValidElementWithRef(element) {
if (!element) return false;
if (!(0, import_react.isValidElement)(element)) return false;
if ("ref" in element.props) return true;
if ("ref" in element) return true;
return false;
}
function getRefProperty(element) {
if (!isValidElementWithRef(element)) return null;
const props = __spreadValues({}, element.props);
return props.ref || element.ref;
}
function mergeProps(base, overrides) {
const props = __spreadValues({}, base);
for (const key in overrides) {
if (!hasOwnProperty(overrides, key)) continue;
if (key === "className") {
const prop = "className";
props[prop] = base[prop] ? `${base[prop]} ${overrides[prop]}` : overrides[prop];
continue;
}
if (key === "style") {
const prop = "style";
props[prop] = base[prop] ? __spreadValues(__spreadValues({}, base[prop]), overrides[prop]) : overrides[prop];
continue;
}
const overrideValue = overrides[key];
if (typeof overrideValue === "function" && key.startsWith("on")) {
const baseValue = base[key];
if (typeof baseValue === "function") {
props[key] = (...args) => {
overrideValue(...args);
baseValue(...args);
};
continue;
}
}
props[key] = overrideValue;
}
return props;
}
// node_modules/@ariakit/core/esm/__chunks/DTR5TSDJ.js
var canUseDOM = checkIsBrowser();
function checkIsBrowser() {
var _a;
return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement);
}
function getDocument(node2) {
if (!node2) return document;
if ("self" in node2) return node2.document;
return node2.ownerDocument || document;
}
function getWindow(node2) {
if (!node2) return self;
if ("self" in node2) return node2.self;
return getDocument(node2).defaultView || window;
}
function getActiveElement(node2, activeDescendant = false) {
const { activeElement } = getDocument(node2);
if (!(activeElement == null ? void 0 : activeElement.nodeName)) {
return null;
}
if (isFrame(activeElement) && activeElement.contentDocument) {
return getActiveElement(
activeElement.contentDocument.body,
activeDescendant
);
}
if (activeDescendant) {
const id3 = activeElement.getAttribute("aria-activedescendant");
if (id3) {
const element = getDocument(activeElement).getElementById(id3);
if (element) {
return element;
}
}
}
return activeElement;
}
function contains(parent, child) {
return parent === child || parent.contains(child);
}
function isFrame(element) {
return element.tagName === "IFRAME";
}
function isButton(element) {
const tagName = element.tagName.toLowerCase();
if (tagName === "button") return true;
if (tagName === "input" && element.type) {
return buttonInputTypes.indexOf(element.type) !== -1;
}
return false;
}
var buttonInputTypes = [
"button",
"color",
"file",
"image",
"reset",
"submit"
];
function isVisible(element) {
if (typeof element.checkVisibility === "function") {
return element.checkVisibility();
}
const htmlElement = element;
return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
}
function isTextField(element) {
try {
const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
const isTextArea = element.tagName === "TEXTAREA";
return isTextInput || isTextArea || false;
} catch (error) {
return false;
}
}
function isTextbox(element) {
return element.isContentEditable || isTextField(element);
}
function getTextboxValue(element) {
if (isTextField(element)) {
return element.value;
}
if (element.isContentEditable) {
const range = getDocument(element).createRange();
range.selectNodeContents(element);
return range.toString();
}
return "";
}
function getTextboxSelection(element) {
let start = 0;
let end = 0;
if (isTextField(element)) {
start = element.selectionStart || 0;
end = element.selectionEnd || 0;
} else if (element.isContentEditable) {
const selection = getDocument(element).getSelection();
if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains(element, selection.anchorNode) && selection.focusNode && contains(element, selection.focusNode)) {
const range = selection.getRangeAt(0);
const nextRange = range.cloneRange();
nextRange.selectNodeContents(element);
nextRange.setEnd(range.startContainer, range.startOffset);
start = nextRange.toString().length;
nextRange.setEnd(range.endContainer, range.endOffset);
end = nextRange.toString().length;
}
}
return { start, end };
}
function getPopupRole(element, fallback) {
const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"];
const role = element == null ? void 0 : element.getAttribute("role");
if (role && allowedPopupRoles.indexOf(role) !== -1) {
return role;
}
return fallback;
}
function getPopupItemRole(element, fallback) {
var _a;
const itemRoleByPopupRole = {
menu: "menuitem",
listbox: "option",
tree: "treeitem"
};
const popupRole = getPopupRole(element);
if (!popupRole) return fallback;
const key = popupRole;
return (_a = itemRoleByPopupRole[key]) != null ? _a : fallback;
}
function getScrollingElement(element) {
if (!element) return null;
const isScrollableOverflow = (overflow) => {
if (overflow === "auto") return true;
if (overflow === "scroll") return true;
return false;
};
if (element.clientHeight && element.scrollHeight > element.clientHeight) {
const { overflowY } = getComputedStyle(element);
if (isScrollableOverflow(overflowY)) return element;
} else if (element.clientWidth && element.scrollWidth > element.clientWidth) {
const { overflowX } = getComputedStyle(element);
if (isScrollableOverflow(overflowX)) return element;
}
return getScrollingElement(element.parentElement) || document.scrollingElement || document.body;
}
function sortBasedOnDOMPosition(items, getElement) {
const pairs = items.map((item2, index2) => [index2, item2]);
let isOrderDifferent = false;
pairs.sort(([indexA, a3], [indexB, b3]) => {
const elementA = getElement(a3);
const elementB = getElement(b3);
if (elementA === elementB) return 0;
if (!elementA || !elementB) return 0;
if (isElementPreceding(elementA, elementB)) {
if (indexA > indexB) {
isOrderDifferent = true;
}
return -1;
}
if (indexA < indexB) {
isOrderDifferent = true;
}
return 1;
});
if (isOrderDifferent) {
return pairs.map(([_, item2]) => item2);
}
return items;
}
function isElementPreceding(a3, b3) {
return Boolean(
b3.compareDocumentPosition(a3) & Node.DOCUMENT_POSITION_PRECEDING
);
}
// node_modules/@ariakit/core/esm/__chunks/QAGXQEUG.js
function isTouchDevice() {
return canUseDOM && !!navigator.maxTouchPoints;
}
function isApple() {
if (!canUseDOM) return false;
return /mac|iphone|ipad|ipod/i.test(navigator.platform);
}
function isSafari() {
return canUseDOM && isApple() && /apple/i.test(navigator.vendor);
}
function isFirefox() {
return canUseDOM && /firefox\//i.test(navigator.userAgent);
}
function isMac() {
return canUseDOM && navigator.platform.startsWith("Mac") && !isTouchDevice();
}
// node_modules/@ariakit/core/esm/utils/events.js
function isPortalEvent(event) {
return Boolean(
event.currentTarget && !contains(event.currentTarget, event.target)
);
}
function isSelfTarget(event) {
return event.target === event.currentTarget;
}
function isOpeningInNewTab(event) {
const element = event.currentTarget;
if (!element) return false;
const isAppleDevice = isApple();
if (isAppleDevice && !event.metaKey) return false;
if (!isAppleDevice && !event.ctrlKey) return false;
const tagName = element.tagName.toLowerCase();
if (tagName === "a") return true;
if (tagName === "button" && element.type === "submit") return true;
if (tagName === "input" && element.type === "submit") return true;
return false;
}
function isDownloading(event) {
const element = event.currentTarget;
if (!element) return false;
const tagName = element.tagName.toLowerCase();
if (!event.altKey) return false;
if (tagName === "a") return true;
if (tagName === "button" && element.type === "submit") return true;
if (tagName === "input" && element.type === "submit") return true;
return false;
}
function fireEvent(element, type, eventInit) {
const event = new Event(type, eventInit);
return element.dispatchEvent(event);
}
function fireBlurEvent(element, eventInit) {
const event = new FocusEvent("blur", eventInit);
const defaultAllowed = element.dispatchEvent(event);
const bubbleInit = __spreadProps2(__spreadValues2({}, eventInit), { bubbles: true });
element.dispatchEvent(new FocusEvent("focusout", bubbleInit));
return defaultAllowed;
}
function fireKeyboardEvent(element, type, eventInit) {
const event = new KeyboardEvent(type, eventInit);
return element.dispatchEvent(event);
}
function fireClickEvent(element, eventInit) {
const event = new MouseEvent("click", eventInit);
return element.dispatchEvent(event);
}
function isFocusEventOutside(event, container) {
const containerElement = container || event.currentTarget;
const relatedTarget = event.relatedTarget;
return !relatedTarget || !contains(containerElement, relatedTarget);
}
function queueBeforeEvent(element, type, callback, timeout) {
const createTimer = (callback2) => {
if (timeout) {
const timerId2 = setTimeout(callback2, timeout);
return () => clearTimeout(timerId2);
}
const timerId = requestAnimationFrame(callback2);
return () => cancelAnimationFrame(timerId);
};
const cancelTimer = createTimer(() => {
element.removeEventListener(type, callSync, true);
callback();
});
const callSync = () => {
cancelTimer();
callback();
};
element.addEventListener(type, callSync, { once: true, capture: true });
return cancelTimer;
}
function addGlobalEventListener(type, listener, options2, scope = window) {
const children = [];
try {
scope.document.addEventListener(type, listener, options2);
for (const frame2 of Array.from(scope.frames)) {
children.push(addGlobalEventListener(type, listener, options2, frame2));
}
} catch (e3) {
}
const removeEventListener = () => {
try {
scope.document.removeEventListener(type, listener, options2);
} catch (e3) {
}
for (const remove of children) {
remove();
}
};
return removeEventListener;
}
// node_modules/@ariakit/react-core/esm/__chunks/ABQUS43J.js
var import_react2 = __toESM(require_react(), 1);
var React = __toESM(require_react(), 1);
var _React = __spreadValues({}, React);
var useReactId = _React.useId;
var useReactDeferredValue = _React.useDeferredValue;
var useReactInsertionEffect = _React.useInsertionEffect;
var useSafeLayoutEffect = canUseDOM ? import_react2.useLayoutEffect : import_react2.useEffect;
function useInitialValue(value) {
const [initialValue2] = (0, import_react2.useState)(value);
return initialValue2;
}
function useLiveRef(value) {
const ref = (0, import_react2.useRef)(value);
useSafeLayoutEffect(() => {
ref.current = value;
});
return ref;
}
function useEvent(callback) {
const ref = (0, import_react2.useRef)(() => {
throw new Error("Cannot call an event handler while rendering.");
});
if (useReactInsertionEffect) {
useReactInsertionEffect(() => {
ref.current = callback;
});
} else {
ref.current = callback;
}
return (0, import_react2.useCallback)((...args) => {
var _a;
return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args);
}, []);
}
function useTransactionState(callback) {
const [state, setState] = (0, import_react2.useState)(null);
useSafeLayoutEffect(() => {
if (state == null) return;
if (!callback) return;
let prevState = null;
callback((prev2) => {
prevState = prev2;
return state;
});
return () => {
callback(prevState);
};
}, [state, callback]);
return [state, setState];
}
function useMergeRefs(...refs) {
return (0, import_react2.useMemo)(() => {
if (!refs.some(Boolean)) return;
return (value) => {
for (const ref of refs) {
setRef(ref, value);
}
};
}, refs);
}
function useId(defaultId) {
if (useReactId) {
const reactId = useReactId();
if (defaultId) return defaultId;
return reactId;
}
const [id3, setId] = (0, import_react2.useState)(defaultId);
useSafeLayoutEffect(() => {
if (defaultId || id3) return;
const random = Math.random().toString(36).slice(2, 8);
setId(`id-${random}`);
}, [defaultId, id3]);
return defaultId || id3;
}
function useTagName(refOrElement, type) {
const stringOrUndefined = (type2) => {
if (typeof type2 !== "string") return;
return type2;
};
const [tagName, setTagName] = (0, import_react2.useState)(() => stringOrUndefined(type));
useSafeLayoutEffect(() => {
const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type));
}, [refOrElement, type]);
return tagName;
}
function useAttribute(refOrElement, attributeName, defaultValue2) {
const initialValue2 = useInitialValue(defaultValue2);
const [attribute, setAttribute2] = (0, import_react2.useState)(initialValue2);
(0, import_react2.useEffect)(() => {
const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement;
if (!element) return;
const callback = () => {
const value = element.getAttribute(attributeName);
setAttribute2(value == null ? initialValue2 : value);
};
const observer = new MutationObserver(callback);
observer.observe(element, { attributeFilter: [attributeName] });
callback();
return () => observer.disconnect();
}, [refOrElement, attributeName, initialValue2]);
return attribute;
}
function useUpdateEffect(effect, deps) {
const mounted = (0, import_react2.useRef)(false);
(0, import_react2.useEffect)(() => {
if (mounted.current) {
return effect();
}
mounted.current = true;
}, deps);
(0, import_react2.useEffect)(
() => () => {
mounted.current = false;
},
[]
);
}
function useForceUpdate() {
return (0, import_react2.useReducer)(() => [], []);
}
function useBooleanEvent(booleanOrCallback) {
return useEvent(
typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback
);
}
function useWrapElement(props, callback, deps = []) {
const wrapElement = (0, import_react2.useCallback)(
(element) => {
if (props.wrapElement) {
element = props.wrapElement(element);
}
return callback(element);
},
[...deps, props.wrapElement]
);
return __spreadProps(__spreadValues({}, props), { wrapElement });
}
function usePortalRef(portalProp = false, portalRefProp) {
const [portalNode, setPortalNode] = (0, import_react2.useState)(null);
const portalRef = useMergeRefs(setPortalNode, portalRefProp);
const domReady = !portalProp || portalNode;
return { portalRef, portalNode, domReady };
}
function useMetadataProps(props, key, value) {
const parent = props.onLoadedMetadataCapture;
const onLoadedMetadataCapture = (0, import_react2.useMemo)(() => {
return Object.assign(() => {
}, __spreadProps(__spreadValues({}, parent), { [key]: value }));
}, [parent, key, value]);
return [parent == null ? void 0 : parent[key], { onLoadedMetadataCapture }];
}
function useIsMouseMoving() {
(0, import_react2.useEffect)(() => {
addGlobalEventListener("mousemove", setMouseMoving, true);
addGlobalEventListener("mousedown", resetMouseMoving, true);
addGlobalEventListener("mouseup", resetMouseMoving, true);
addGlobalEventListener("keydown", resetMouseMoving, true);
addGlobalEventListener("scroll", resetMouseMoving, true);
}, []);
const isMouseMoving = useEvent(() => mouseMoving);
return isMouseMoving;
}
var mouseMoving = false;
var previousScreenX = 0;
var previousScreenY = 0;
function hasMouseMovement(event) {
const movementX = event.movementX || event.screenX - previousScreenX;
const movementY = event.movementY || event.screenY - previousScreenY;
previousScreenX = event.screenX;
previousScreenY = event.screenY;
return movementX || movementY || false;
}
function setMouseMoving(event) {
if (!hasMouseMovement(event)) return;
mouseMoving = true;
}
function resetMouseMoving() {
mouseMoving = false;
}
// node_modules/@ariakit/react-core/esm/__chunks/LMDWO4NN.js
var React2 = __toESM(require_react(), 1);
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
function forwardRef2(render) {
const Role3 = React2.forwardRef((props, ref) => render(__spreadProps(__spreadValues({}, props), { ref })));
Role3.displayName = render.displayName || render.name;
return Role3;
}
function memo2(Component9, propsAreEqual) {
return React2.memo(Component9, propsAreEqual);
}
function createElement(Type, props) {
const _a = props, { wrapElement, render } = _a, rest = __objRest(_a, ["wrapElement", "render"]);
const mergedRef = useMergeRefs(props.ref, getRefProperty(render));
let element;
if (React2.isValidElement(render)) {
const renderProps = __spreadProps(__spreadValues({}, render.props), { ref: mergedRef });
element = React2.cloneElement(render, mergeProps(rest, renderProps));
} else if (render) {
element = render(rest);
} else {
element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Type, __spreadValues({}, rest));
}
if (wrapElement) {
return wrapElement(element);
}
return element;
}
function createHook(useProps) {
const useRole3 = (props = {}) => {
return useProps(props);
};
useRole3.displayName = useProps.name;
return useRole3;
}
function createStoreContext(providers = [], scopedProviders = []) {
const context = React2.createContext(void 0);
const scopedContext = React2.createContext(void 0);
const useContext210 = () => React2.useContext(context);
const useScopedContext = (onlyScoped = false) => {
const scoped = React2.useContext(scopedContext);
const store = useContext210();
if (onlyScoped) return scoped;
return scoped || store;
};
const useProviderContext = () => {
const scoped = React2.useContext(scopedContext);
const store = useContext210();
if (scoped && scoped === store) return;
return store;
};
const ContextProvider = (props) => {
return providers.reduceRight(
(children, Provider4) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider4, __spreadProps(__spreadValues({}, props), { children })),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(context.Provider, __spreadValues({}, props))
);
};
const ScopedContextProvider = (props) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContextProvider, __spreadProps(__spreadValues({}, props), { children: scopedProviders.reduceRight(
(children, Provider4) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider4, __spreadProps(__spreadValues({}, props), { children })),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(scopedContext.Provider, __spreadValues({}, props))
) }));
};
return {
context,
scopedContext,
useContext: useContext210,
useScopedContext,
useProviderContext,
ContextProvider,
ScopedContextProvider
};
}
// node_modules/@ariakit/react-core/esm/__chunks/VDHZ5F7K.js
var ctx = createStoreContext();
var useCollectionContext = ctx.useContext;
var useCollectionScopedContext = ctx.useScopedContext;
var useCollectionProviderContext = ctx.useProviderContext;
var CollectionContextProvider = ctx.ContextProvider;
var CollectionScopedContextProvider = ctx.ScopedContextProvider;
// node_modules/@ariakit/react-core/esm/__chunks/P7GR5CS5.js
var import_react3 = __toESM(require_react(), 1);
var ctx2 = createStoreContext(
[CollectionContextProvider],
[CollectionScopedContextProvider]
);
var useCompositeContext = ctx2.useContext;
var useCompositeScopedContext = ctx2.useScopedContext;
var useCompositeProviderContext = ctx2.useProviderContext;
var CompositeContextProvider = ctx2.ContextProvider;
var CompositeScopedContextProvider = ctx2.ScopedContextProvider;
var CompositeItemContext = (0, import_react3.createContext)(
void 0
);
var CompositeRowContext = (0, import_react3.createContext)(
void 0
);
// node_modules/@ariakit/core/esm/__chunks/BCALMBPZ.js
function getInternal(store, key) {
const internals = store.__unstableInternals;
invariant(internals, "Invalid store");
return internals[key];
}
function createStore(initialState, ...stores) {
let state = initialState;
let prevStateBatch = state;
let lastUpdate = Symbol();
let destroy = noop;
const instances = /* @__PURE__ */ new Set();
const updatedKeys = /* @__PURE__ */ new Set();
const setups = /* @__PURE__ */ new Set();
const listeners = /* @__PURE__ */ new Set();
const batchListeners = /* @__PURE__ */ new Set();
const disposables = /* @__PURE__ */ new WeakMap();
const listenerKeys = /* @__PURE__ */ new WeakMap();
const storeSetup = (callback) => {
setups.add(callback);
return () => setups.delete(callback);
};
const storeInit = () => {
const initialized = instances.size;
const instance = Symbol();
instances.add(instance);
const maybeDestroy = () => {
instances.delete(instance);
if (instances.size) return;
destroy();
};
if (initialized) return maybeDestroy;
const desyncs = getKeys(state).map(
(key) => chain(
...stores.map((store) => {
var _a;
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
if (!storeState) return;
if (!hasOwnProperty(storeState, key)) return;
return sync(store, [key], (state2) => {
setState(
key,
state2[key],
// @ts-expect-error - Not public API. This is just to prevent
// infinite loops.
true
);
});
})
)
);
const teardowns = [];
for (const setup2 of setups) {
teardowns.push(setup2());
}
const cleanups2 = stores.map(init);
destroy = chain(...desyncs, ...teardowns, ...cleanups2);
return maybeDestroy;
};
const sub = (keys, listener, set2 = listeners) => {
set2.add(listener);
listenerKeys.set(listener, keys);
return () => {
var _a;
(_a = disposables.get(listener)) == null ? void 0 : _a();
disposables.delete(listener);
listenerKeys.delete(listener);
set2.delete(listener);
};
};
const storeSubscribe = (keys, listener) => sub(keys, listener);
const storeSync = (keys, listener) => {
disposables.set(listener, listener(state, state));
return sub(keys, listener);
};
const storeBatch = (keys, listener) => {
disposables.set(listener, listener(state, prevStateBatch));
return sub(keys, listener, batchListeners);
};
const storePick = (keys) => createStore(pick(state, keys), finalStore);
const storeOmit = (keys) => createStore(omit(state, keys), finalStore);
const getState = () => state;
const setState = (key, value, fromStores = false) => {
var _a;
if (!hasOwnProperty(state, key)) return;
const nextValue = applyState(value, state[key]);
if (nextValue === state[key]) return;
if (!fromStores) {
for (const store of stores) {
(_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
}
}
const prevState = state;
state = __spreadProps2(__spreadValues2({}, state), { [key]: nextValue });
const thisUpdate = Symbol();
lastUpdate = thisUpdate;
updatedKeys.add(key);
const run = (listener, prev2, uKeys) => {
var _a2;
const keys = listenerKeys.get(listener);
const updated = (k2) => uKeys ? uKeys.has(k2) : k2 === key;
if (!keys || keys.some(updated)) {
(_a2 = disposables.get(listener)) == null ? void 0 : _a2();
disposables.set(listener, listener(state, prev2));
}
};
for (const listener of listeners) {
run(listener, prevState);
}
queueMicrotask(() => {
if (lastUpdate !== thisUpdate) return;
const snapshot = state;
for (const listener of batchListeners) {
run(listener, prevStateBatch, updatedKeys);
}
prevStateBatch = snapshot;
updatedKeys.clear();
});
};
const finalStore = {
getState,
setState,
__unstableInternals: {
setup: storeSetup,
init: storeInit,
subscribe: storeSubscribe,
sync: storeSync,
batch: storeBatch,
pick: storePick,
omit: storeOmit
}
};
return finalStore;
}
function setup(store, ...args) {
if (!store) return;
return getInternal(store, "setup")(...args);
}
function init(store, ...args) {
if (!store) return;
return getInternal(store, "init")(...args);
}
function subscribe(store, ...args) {
if (!store) return;
return getInternal(store, "subscribe")(...args);
}
function sync(store, ...args) {
if (!store) return;
return getInternal(store, "sync")(...args);
}
function batch(store, ...args) {
if (!store) return;
return getInternal(store, "batch")(...args);
}
function omit2(store, ...args) {
if (!store) return;
return getInternal(store, "omit")(...args);
}
function pick2(store, ...args) {
if (!store) return;
return getInternal(store, "pick")(...args);
}
function mergeStore(...stores) {
const initialState = stores.reduce((state, store2) => {
var _a;
const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
if (!nextState) return state;
return Object.assign(state, nextState);
}, {});
const store = createStore(initialState, ...stores);
return Object.assign({}, ...stores, store);
}
function throwOnConflictingProps(props, store) {
if (false) return;
if (!store) return;
const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => {
var _a;
const stateKey = key.replace("default", "");
return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}${stateKey.slice(1)}`;
});
if (!defaultKeys.length) return;
const storeState = store.getState();
const conflictingProps = defaultKeys.filter(
(key) => hasOwnProperty(storeState, key)
);
if (!conflictingProps.length) return;
throw new Error(
`Passing a store prop in conjunction with a default state is not supported.
const store = useSelectStore();
^ ^
Instead, pass the default state to the topmost store:
const store = useSelectStore({ defaultValue: "Apple" });
See https://github.com/ariakit/ariakit/pull/2745 for more details.
If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit
`
);
}
// node_modules/@ariakit/react-core/esm/__chunks/YV4JVR4I.js
var React3 = __toESM(require_react(), 1);
var import_shim = __toESM(require_shim(), 1);
var { useSyncExternalStore } = import_shim.default;
var noopSubscribe = () => () => {
};
function useStoreState(store, keyOrSelector = identity) {
const storeSubscribe = React3.useCallback(
(callback) => {
if (!store) return noopSubscribe();
return subscribe(store, null, callback);
},
[store]
);
const getSnapshot = () => {
const key = typeof keyOrSelector === "string" ? keyOrSelector : null;
const selector2 = typeof keyOrSelector === "function" ? keyOrSelector : null;
const state = store == null ? void 0 : store.getState();
if (selector2) return selector2(state);
if (!state) return;
if (!key) return;
if (!hasOwnProperty(state, key)) return;
return state[key];
};
return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot);
}
function useStoreStateObject(store, object) {
const objRef = React3.useRef(
{}
);
const storeSubscribe = React3.useCallback(
(callback) => {
if (!store) return noopSubscribe();
return subscribe(store, null, callback);
},
[store]
);
const getSnapshot = () => {
const state = store == null ? void 0 : store.getState();
let updated = false;
const obj = objRef.current;
for (const prop in object) {
const keyOrSelector = object[prop];
if (typeof keyOrSelector === "function") {
const value = keyOrSelector(state);
if (value !== obj[prop]) {
obj[prop] = value;
updated = true;
}
}
if (typeof keyOrSelector === "string") {
if (!state) continue;
if (!hasOwnProperty(state, keyOrSelector)) continue;
const value = state[keyOrSelector];
if (value !== obj[prop]) {
obj[prop] = value;
updated = true;
}
}
}
if (updated) {
objRef.current = __spreadValues({}, obj);
}
return objRef.current;
};
return useSyncExternalStore(storeSubscribe, getSnapshot, getSnapshot);
}
function useStoreProps(store, props, key, setKey) {
const value = hasOwnProperty(props, key) ? props[key] : void 0;
const setValue = setKey ? props[setKey] : void 0;
const propsRef = useLiveRef({ value, setValue });
useSafeLayoutEffect(() => {
return sync(store, [key], (state, prev2) => {
const { value: value2, setValue: setValue2 } = propsRef.current;
if (!setValue2) return;
if (state[key] === prev2[key]) return;
if (state[key] === value2) return;
setValue2(state[key]);
});
}, [store, key]);
useSafeLayoutEffect(() => {
if (value === void 0) return;
store.setState(key, value);
return batch(store, [key], () => {
if (value === void 0) return;
store.setState(key, value);
});
});
}
function useStore(createStore2, props) {
const [store, setStore] = React3.useState(() => createStore2(props));
useSafeLayoutEffect(() => init(store), [store]);
const useState210 = React3.useCallback(
(keyOrSelector) => useStoreState(store, keyOrSelector),
[store]
);
const memoizedStore = React3.useMemo(
() => __spreadProps(__spreadValues({}, store), { useState: useState210 }),
[store, useState210]
);
const updateStore = useEvent(() => {
setStore((store2) => createStore2(__spreadValues(__spreadValues({}, props), store2.getState())));
});
return [memoizedStore, updateStore];
}
// node_modules/@ariakit/core/esm/__chunks/CYQWQL4J.js
function getCommonParent(items) {
var _a;
const firstItem = items.find((item2) => !!item2.element);
const lastItem = [...items].reverse().find((item2) => !!item2.element);
let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement;
while (parentElement && (lastItem == null ? void 0 : lastItem.element)) {
const parent = parentElement;
if (lastItem && parent.contains(lastItem.element)) {
return parentElement;
}
parentElement = parentElement.parentElement;
}
return getDocument(parentElement).body;
}
function getPrivateStore(store) {
return store == null ? void 0 : store.__unstablePrivateStore;
}
function createCollectionStore(props = {}) {
var _a;
throwOnConflictingProps(props, props.store);
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const items = defaultValue(
props.items,
syncState == null ? void 0 : syncState.items,
props.defaultItems,
[]
);
const itemsMap = new Map(items.map((item2) => [item2.id, item2]));
const initialState = {
items,
renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, [])
};
const syncPrivateStore = getPrivateStore(props.store);
const privateStore = createStore(
{ items, renderedItems: initialState.renderedItems },
syncPrivateStore
);
const collection = createStore(initialState, props.store);
const sortItems = (renderedItems) => {
const sortedItems = sortBasedOnDOMPosition(renderedItems, (i3) => i3.element);
privateStore.setState("renderedItems", sortedItems);
collection.setState("renderedItems", sortedItems);
};
setup(collection, () => init(privateStore));
setup(privateStore, () => {
return batch(privateStore, ["items"], (state) => {
collection.setState("items", state.items);
});
});
setup(privateStore, () => {
return batch(privateStore, ["renderedItems"], (state) => {
let firstRun = true;
let raf = requestAnimationFrame(() => {
const { renderedItems } = collection.getState();
if (state.renderedItems === renderedItems) return;
sortItems(state.renderedItems);
});
if (typeof IntersectionObserver !== "function") {
return () => cancelAnimationFrame(raf);
}
const ioCallback = () => {
if (firstRun) {
firstRun = false;
return;
}
cancelAnimationFrame(raf);
raf = requestAnimationFrame(() => sortItems(state.renderedItems));
};
const root = getCommonParent(state.renderedItems);
const observer = new IntersectionObserver(ioCallback, { root });
for (const item2 of state.renderedItems) {
if (!item2.element) continue;
observer.observe(item2.element);
}
return () => {
cancelAnimationFrame(raf);
observer.disconnect();
};
});
});
const mergeItem = (item2, setItems, canDeleteFromMap = false) => {
let prevItem;
setItems((items2) => {
const index2 = items2.findIndex(({ id: id3 }) => id3 === item2.id);
const nextItems = items2.slice();
if (index2 !== -1) {
prevItem = items2[index2];
const nextItem = __spreadValues2(__spreadValues2({}, prevItem), item2);
nextItems[index2] = nextItem;
itemsMap.set(item2.id, nextItem);
} else {
nextItems.push(item2);
itemsMap.set(item2.id, item2);
}
return nextItems;
});
const unmergeItem = () => {
setItems((items2) => {
if (!prevItem) {
if (canDeleteFromMap) {
itemsMap.delete(item2.id);
}
return items2.filter(({ id: id3 }) => id3 !== item2.id);
}
const index2 = items2.findIndex(({ id: id3 }) => id3 === item2.id);
if (index2 === -1) return items2;
const nextItems = items2.slice();
nextItems[index2] = prevItem;
itemsMap.set(item2.id, prevItem);
return nextItems;
});
};
return unmergeItem;
};
const registerItem = (item2) => mergeItem(
item2,
(getItems) => privateStore.setState("items", getItems),
true
);
return __spreadProps2(__spreadValues2({}, collection), {
registerItem,
renderItem: (item2) => chain(
registerItem(item2),
mergeItem(
item2,
(getItems) => privateStore.setState("renderedItems", getItems)
)
),
item: (id3) => {
if (!id3) return null;
let item2 = itemsMap.get(id3);
if (!item2) {
const { items: items2 } = privateStore.getState();
item2 = items2.find((item22) => item22.id === id3);
if (item2) {
itemsMap.set(id3, item2);
}
}
return item2 || null;
},
// @ts-expect-error Internal
__unstablePrivateStore: privateStore
});
}
// node_modules/@ariakit/react-core/esm/__chunks/C3IKGW5T.js
function useCollectionStoreProps(store, update, props) {
useUpdateEffect(update, [props.store]);
useStoreProps(store, props, "items", "setItems");
return store;
}
// node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js
function toArray(arg) {
if (Array.isArray(arg)) {
return arg;
}
return typeof arg !== "undefined" ? [arg] : [];
}
function flatten2DArray(array) {
const flattened = [];
for (const row of array) {
flattened.push(...row);
}
return flattened;
}
function reverseArray(array) {
return array.slice().reverse();
}
// node_modules/@ariakit/core/esm/__chunks/AJZ4BYF3.js
var NULL_ITEM = { id: null };
function findFirstEnabledItem(items, excludeId) {
return items.find((item2) => {
if (excludeId) {
return !item2.disabled && item2.id !== excludeId;
}
return !item2.disabled;
});
}
function getEnabledItems(items, excludeId) {
return items.filter((item2) => {
if (excludeId) {
return !item2.disabled && item2.id !== excludeId;
}
return !item2.disabled;
});
}
function getItemsInRow(items, rowId) {
return items.filter((item2) => item2.rowId === rowId);
}
function flipItems(items, activeId, shouldInsertNullItem = false) {
const index2 = items.findIndex((item2) => item2.id === activeId);
return [
...items.slice(index2 + 1),
...shouldInsertNullItem ? [NULL_ITEM] : [],
...items.slice(0, index2)
];
}
function groupItemsByRows(items) {
const rows = [];
for (const item2 of items) {
const row = rows.find((currentRow) => {
var _a;
return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item2.rowId;
});
if (row) {
row.push(item2);
} else {
rows.push([item2]);
}
}
return rows;
}
function getMaxRowLength(array) {
let maxLength = 0;
for (const { length: length2 } of array) {
if (length2 > maxLength) {
maxLength = length2;
}
}
return maxLength;
}
function createEmptyItem(rowId) {
return {
id: "__EMPTY_ITEM__",
disabled: true,
rowId
};
}
function normalizeRows(rows, activeId, focusShift) {
const maxLength = getMaxRowLength(rows);
for (const row of rows) {
for (let i3 = 0; i3 < maxLength; i3 += 1) {
const item2 = row[i3];
if (!item2 || focusShift && item2.disabled) {
const isFirst = i3 === 0;
const previousItem = isFirst && focusShift ? findFirstEnabledItem(row) : row[i3 - 1];
row[i3] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
}
}
}
return rows;
}
function verticalizeItems(items) {
const rows = groupItemsByRows(items);
const maxLength = getMaxRowLength(rows);
const verticalized = [];
for (let i3 = 0; i3 < maxLength; i3 += 1) {
for (const row of rows) {
const item2 = row[i3];
if (item2) {
verticalized.push(__spreadProps2(__spreadValues2({}, item2), {
// If there's no rowId, it means that it's not a grid composite, but
// a single row instead. So, instead of verticalizing it, that is,
// assigning a different rowId based on the column index, we keep it
// undefined so they will be part of the same row. This is useful
// when using up/down on one-dimensional composites.
rowId: item2.rowId ? `${i3}` : void 0
}));
}
}
}
return verticalized;
}
function createCompositeStore(props = {}) {
var _a;
const syncState = (_a = props.store) == null ? void 0 : _a.getState();
const collection = createCollectionStore(props);
const activeId = defaultValue(
props.activeId,
syncState == null ? void 0 : syncState.activeId,
props.defaultActiveId
);
const initialState = __spreadProps2(__spreadValues2({}, collection.getState()), {
id: defaultValue(
props.id,
syncState == null ? void 0 : syncState.id,
`id-${Math.random().toString(36).slice(2, 8)}`
),
activeId,
baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null),
includesBaseElement: defaultValue(
props.includesBaseElement,
syncState == null ? void 0 : syncState.includesBaseElement,
activeId === null
),
moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0),
orientation: defaultValue(
props.orientation,
syncState == null ? void 0 : syncState.orientation,
"both"
),
rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false),
virtualFocus: defaultValue(
props.virtualFocus,
syncState == null ? void 0 : syncState.virtualFocus,
false
),
focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false),
focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false),
focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
});
const composite = createStore(initialState, collection, props.store);
setup(
composite,
() => sync(composite, ["renderedItems", "activeId"], (state) => {
composite.setState("activeId", (activeId2) => {
var _a2;
if (activeId2 !== void 0) return activeId2;
return (_a2 = findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
});
})
);
const getNextId = (direction = "next", options2 = {}) => {
var _a2, _b;
const defaultState = composite.getState();
const {
skip = 0,
activeId: activeId2 = defaultState.activeId,
focusShift = defaultState.focusShift,
focusLoop = defaultState.focusLoop,
focusWrap = defaultState.focusWrap,
includesBaseElement = defaultState.includesBaseElement,
renderedItems = defaultState.renderedItems,
rtl: rtl2 = defaultState.rtl
} = options2;
const isVerticalDirection = direction === "up" || direction === "down";
const isNextDirection = direction === "next" || direction === "down";
const canReverse = isNextDirection ? rtl2 && !isVerticalDirection : !rtl2 || isVerticalDirection;
const canShift = focusShift && !skip;
let items = !isVerticalDirection ? renderedItems : flatten2DArray(
normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift)
);
items = canReverse ? reverseArray(items) : items;
items = isVerticalDirection ? verticalizeItems(items) : items;
if (activeId2 == null) {
return (_a2 = findFirstEnabledItem(items)) == null ? void 0 : _a2.id;
}
const activeItem = items.find((item2) => item2.id === activeId2);
if (!activeItem) {
return (_b = findFirstEnabledItem(items)) == null ? void 0 : _b.id;
}
const isGrid2 = items.some((item2) => item2.rowId);
const activeIndex = items.indexOf(activeItem);
const nextItems = items.slice(activeIndex + 1);
const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId);
if (skip) {
const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2);
const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one.
nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
return nextItem2 == null ? void 0 : nextItem2.id;
}
const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical");
const canWrap = isGrid2 && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical");
const hasNullItem = isNextDirection ? (!isGrid2 || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false;
if (canLoop) {
const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId);
const sortedItems = flipItems(loopItems, activeId2, hasNullItem);
const nextItem2 = findFirstEnabledItem(sortedItems, activeId2);
return nextItem2 == null ? void 0 : nextItem2.id;
}
if (canWrap) {
const nextItem2 = findFirstEnabledItem(
// We can use nextItems, which contains all the next items, including
// items from other rows, to wrap between rows. However, if there is a
// null item (the composite container), we'll only use the next items in
// the row. So moving next from the last item will focus on the
// composite container. On grid composites, horizontal navigation never
// focuses on the composite container, only vertical.
hasNullItem ? nextItemsInRow : nextItems,
activeId2
);
const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
return nextId;
}
const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2);
if (!nextItem && hasNullItem) {
return null;
}
return nextItem == null ? void 0 : nextItem.id;
};
return __spreadProps2(__spreadValues2(__spreadValues2({}, collection), composite), {
setBaseElement: (element) => composite.setState("baseElement", element),
setActiveId: (id3) => composite.setState("activeId", id3),
move: (id3) => {
if (id3 === void 0) return;
composite.setState("activeId", id3);
composite.setState("moves", (moves) => moves + 1);
},
first: () => {
var _a2;
return (_a2 = findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
},
last: () => {
var _a2;
return (_a2 = findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
},
next: (options2) => {
if (options2 !== void 0 && typeof options2 === "number") {
options2 = { skip: options2 };
}
return getNextId("next", options2);
},
previous: (options2) => {
if (options2 !== void 0 && typeof options2 === "number") {
options2 = { skip: options2 };
}
return getNextId("previous", options2);
},
down: (options2) => {
if (options2 !== void 0 && typeof options2 === "number") {
options2 = { skip: options2 };
}
return getNextId("down", options2);
},
up: (options2) => {
if (options2 !== void 0 && typeof options2 === "number") {
options2 = { skip: options2 };
}
return getNextId("up", options2);
}
});
}
// node_modules/@ariakit/react-core/esm/__chunks/4CMBR7SL.js
function useCompositeStoreOptions(props) {
const id3 = useId(props.id);
return __spreadValues({ id: id3 }, props);
}
function useCompositeStoreProps(store, update, props) {
store = useCollectionStoreProps(store, update, props);
useStoreProps(store, props, "activeId", "setActiveId");
useStoreProps(store, props, "includesBaseElement");
useStoreProps(store, props, "virtualFocus");
useStoreProps(store, props, "orientation");
useStoreProps(store, props, "rtl");
useStoreProps(store, props, "focusLoop");
useStoreProps(store, props, "focusWrap");
useStoreProps(store, props, "focusShift");
return store;
}
function useCompositeStore(props = {}) {
props = useCompositeStoreOptions(props);
const [store, update] = useStore(createCompositeStore, props);
return useCompositeStoreProps(store, update, props);
}
// node_modules/@ariakit/core/esm/__chunks/RCQ5P4YE.js
function createDisclosureStore(props = {}) {
const store = mergeStore(
props.store,
omit2(props.disclosure, ["contentElement", "disclosureElement"])
);
throwOnConflictingProps(props, store);
const syncState = store == null ? void 0 : store.getState();
const open = defaultValue(
props.open,
syncState == null ? void 0 : syncState.open,
props.defaultOpen,
false
);
const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false);
const initialState = {
open,
animated,
animating: !!animated && open,
mounted: open,
contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null),
disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null)
};
const disclosure = createStore(initialState, store);
setup(
disclosure,
() => sync(disclosure, ["animated", "animating"], (state) => {
if (state.animated) return;
disclosure.setState("animating", false);
})
);
setup(
disclosure,
() => subscribe(disclosure, ["open"], () => {
if (!disclosure.getState().animated) return;
disclosure.setState("animating", true);
})
);
setup(
disclosure,
() => sync(disclosure, ["open", "animating"], (state) => {
disclosure.setState("mounted", state.open || state.animating);
})
);
return __spreadProps2(__spreadValues2({}, disclosure), {
disclosure: props.disclosure,
setOpen: (value) => disclosure.setState("open", value),
show: () => disclosure.setState("open", true),
hide: () => disclosure.setState("open", false),
toggle: () => disclosure.setState("open", (open2) => !open2),
stopAnimation: () => disclosure.setState("animating", false),
setContentElement: (value) => disclosure.setState("contentElement", value),
setDisclosureElement: (value) => disclosure.setState("disclosureElement", value)
});
}
// node_modules/@ariakit/react-core/esm/__chunks/WYCIER3C.js
function useDisclosureStoreProps(store, update, props) {
useUpdateEffect(update, [props.store, props.disclosure]);
useStoreProps(store, props, "open", "setOpen");
useStoreProps(store, props, "mounted", "setMounted");
useStoreProps(store, props, "animated");
return Object.assign(store, { disclosure: props.disclosure });
}
function useDisclosureStore(props = {}) {
const [store, update] = useStore(createDisclosureStore, props);
return useDisclosureStoreProps(store, update, props);
}
// node_modules/@ariakit/core/esm/__chunks/FZZ2AVHF.js
function createDialogStore(props = {}) {
return createDisclosureStore(props);
}
// node_modules/@ariakit/react-core/esm/__chunks/BM6PGYQY.js
function useDialogStoreProps(store, update, props) {
return useDisclosureStoreProps(store, update, props);
}
function useDialogStore(props = {}) {
const [store, update] = useStore(createDialogStore, props);
return useDialogStoreProps(store, update, props);
}
// node_modules/@ariakit/core/esm/__chunks/ME2CUF3F.js
function createPopoverStore(_a = {}) {
var _b = _a, {
popover: otherPopover
} = _b, props = __objRest2(_b, [
"popover"
]);
const store = mergeStore(
props.store,
omit2(otherPopover, [
"arrowElement",
"anchorElement",
"contentElement",
"popoverElement",
"disclosureElement"
])
);
throwOnConflictingProps(props, store);
const syncState = store == null ? void 0 : store.getState();
const dialog = createDialogStore(__spreadProps2(__spreadValues2({}, props), { store }));
const placement = defaultValue(
props.placement,
syncState == null ? void 0 : syncState.placement,
"bottom"
);
const initialState = __spreadProps2(__spreadValues2({}, dialog.getState()), {
placement,
currentPlacement: placement,
anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null),
popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null),
arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null),
rendered: Symbol("rendered")
});
const popover = createStore(initialState, dialog, store);
return __spreadProps2(__spreadValues2(__spreadValues2({}, dialog), popover), {
setAnchorElement: (element) => popover.setState("anchorElement", element),
setPopoverElement: (element) => popover.setState("popoverElement", element),
setArrowElement: (element) => popover.setState("arrowElement", element),
render: () => popover.setState("rendered", Symbol("rendered"))
});
}
// node_modules/@ariakit/react-core/esm/__chunks/O2PQ2652.js
function usePopoverStoreProps(store, update, props) {
useUpdateEffect(update, [props.popover]);
useStoreProps(store, props, "placement");
return useDialogStoreProps(store, update, props);
}
// node_modules/@ariakit/react-core/esm/__chunks/S6EF7IVO.js
var ctx3 = createStoreContext();
var useDisclosureContext = ctx3.useContext;
var useDisclosureScopedContext = ctx3.useScopedContext;
var useDisclosureProviderContext = ctx3.useProviderContext;
var DisclosureContextProvider = ctx3.ContextProvider;
var DisclosureScopedContextProvider = ctx3.ScopedContextProvider;
// node_modules/@ariakit/react-core/esm/__chunks/RS7LB2H4.js
var import_react4 = __toESM(require_react(), 1);
var ctx4 = createStoreContext(
[DisclosureContextProvider],
[DisclosureScopedContextProvider]
);
var useDialogContext = ctx4.useContext;
var useDialogScopedContext = ctx4.useScopedContext;
var useDialogProviderContext = ctx4.useProviderContext;
var DialogContextProvider = ctx4.ContextProvider;
var DialogScopedContextProvider = ctx4.ScopedContextProvider;
var DialogHeadingContext = (0, import_react4.createContext)(void 0);
var DialogDescriptionContext = (0, import_react4.createContext)(void 0);
// node_modules/@ariakit/react-core/esm/__chunks/MTZPJQMC.js
var ctx5 = createStoreContext(
[DialogContextProvider],
[DialogScopedContextProvider]
);
var usePopoverContext = ctx5.useContext;
var usePopoverScopedContext = ctx5.useScopedContext;
var usePopoverProviderContext = ctx5.useProviderContext;
var PopoverContextProvider = ctx5.ContextProvider;
var PopoverScopedContextProvider = ctx5.ScopedContextProvider;
// node_modules/@ariakit/react-core/esm/__chunks/VEVQD5MH.js
var import_react5 = __toESM(require_react(), 1);
var ComboboxListRoleContext = (0, import_react5.createContext)(
void 0
);
var ctx6 = createStoreContext(
[PopoverContextProvider, CompositeContextProvider],
[PopoverScopedContextProvider, CompositeScopedContextProvider]
);
var useComboboxContext = ctx6.useContext;
var useComboboxScopedContext = ctx6.useScopedContext;
var useComboboxProviderContext = ctx6.useProviderContext;
var ComboboxContextProvider = ctx6.ContextProvider;
var ComboboxScopedContextProvider = ctx6.ScopedContextProvider;
var ComboboxItemValueContext = (0, import_react5.createContext)(
void 0
);
var ComboboxItemCheckedContext = (0, import_react5.createContext)(false);
// node_modules/@ariakit/react-core/esm/__chunks/OMU7RWRV.js
var TagName = "div";
var usePopoverAnchor = createHook(
function usePopoverAnchor2(_a) {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
const context = usePopoverProviderContext();
store = store || context;
props = __spreadProps(__spreadValues({}, props), {
ref: useMergeRefs(store == null ? void 0 : store.setAnchorElement, props.ref)
});
return props;
}
);
var PopoverAnchor = forwardRef2(function PopoverAnchor2(props) {
const htmlProps = usePopoverAnchor(props);
return createElement(TagName, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js
var NULL_ITEM2 = { id: null };
function flipItems2(items, activeId, shouldInsertNullItem = false) {
const index2 = items.findIndex((item2) => item2.id === activeId);
return [
...items.slice(index2 + 1),
...shouldInsertNullItem ? [NULL_ITEM2] : [],
...items.slice(0, index2)
];
}
function findFirstEnabledItem2(items, excludeId) {
return items.find((item2) => {
if (excludeId) {
return !item2.disabled && item2.id !== excludeId;
}
return !item2.disabled;
});
}
function getEnabledItem(store, id3) {
if (!id3) return null;
return store.item(id3) || null;
}
function groupItemsByRows2(items) {
const rows = [];
for (const item2 of items) {
const row = rows.find((currentRow) => {
var _a;
return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item2.rowId;
});
if (row) {
row.push(item2);
} else {
rows.push([item2]);
}
}
return rows;
}
function selectTextField(element, collapseToEnd = false) {
if (isTextField(element)) {
element.setSelectionRange(
collapseToEnd ? element.value.length : 0,
element.value.length
);
} else if (element.isContentEditable) {
const selection = getDocument(element).getSelection();
selection == null ? void 0 : selection.selectAllChildren(element);
if (collapseToEnd) {
selection == null ? void 0 : selection.collapseToEnd();
}
}
}
var FOCUS_SILENTLY = Symbol("FOCUS_SILENTLY");
function focusSilently(element) {
element[FOCUS_SILENTLY] = true;
element.focus({ preventScroll: true });
}
function silentlyFocused(element) {
const isSilentlyFocused = element[FOCUS_SILENTLY];
delete element[FOCUS_SILENTLY];
return isSilentlyFocused;
}
function isItem(store, element, exclude) {
if (!element) return false;
if (element === exclude) return false;
const item2 = store.item(element.id);
if (!item2) return false;
if (exclude && item2.element === exclude) return false;
return true;
}
// node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js
var import_react6 = __toESM(require_react(), 1);
var FocusableContext = (0, import_react6.createContext)(true);
// node_modules/@ariakit/core/esm/utils/focus.js
var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
function hasNegativeTabIndex(element) {
const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10);
return tabIndex < 0;
}
function isFocusable(element) {
if (!element.matches(selector)) return false;
if (!isVisible(element)) return false;
if (element.closest("[inert]")) return false;
return true;
}
function isTabbable(element) {
if (!isFocusable(element)) return false;
if (hasNegativeTabIndex(element)) return false;
if (!("form" in element)) return true;
if (!element.form) return true;
if (element.checked) return true;
if (element.type !== "radio") return true;
const radioGroup = element.form.elements.namedItem(element.name);
if (!radioGroup) return true;
if (!("length" in radioGroup)) return true;
const activeElement = getActiveElement(element);
if (!activeElement) return true;
if (activeElement === element) return true;
if (!("form" in activeElement)) return true;
if (activeElement.form !== element.form) return true;
if (activeElement.name !== element.name) return true;
return false;
}
function getAllFocusableIn(container, includeContainer) {
const elements2 = Array.from(
container.querySelectorAll(selector)
);
if (includeContainer) {
elements2.unshift(container);
}
const focusableElements2 = elements2.filter(isFocusable);
focusableElements2.forEach((element, i3) => {
if (isFrame(element) && element.contentDocument) {
const frameBody = element.contentDocument.body;
focusableElements2.splice(i3, 1, ...getAllFocusableIn(frameBody));
}
});
return focusableElements2;
}
function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
const elements2 = Array.from(
container.querySelectorAll(selector)
);
const tabbableElements = elements2.filter(isTabbable);
if (includeContainer && isTabbable(container)) {
tabbableElements.unshift(container);
}
tabbableElements.forEach((element, i3) => {
if (isFrame(element) && element.contentDocument) {
const frameBody = element.contentDocument.body;
const allFrameTabbable = getAllTabbableIn(
frameBody,
false,
fallbackToFocusable
);
tabbableElements.splice(i3, 1, ...allFrameTabbable);
}
});
if (!tabbableElements.length && fallbackToFocusable) {
return elements2;
}
return tabbableElements;
}
function getFirstTabbableIn(container, includeContainer, fallbackToFocusable) {
const [first] = getAllTabbableIn(
container,
includeContainer,
fallbackToFocusable
);
return first || null;
}
function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
const activeElement = getActiveElement(container);
const allFocusable = getAllFocusableIn(container, includeContainer);
const activeIndex = allFocusable.indexOf(activeElement);
const nextFocusableElements = allFocusable.slice(activeIndex + 1);
return nextFocusableElements.find(isTabbable) || (fallbackToFirst ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? nextFocusableElements[0] : null) || null;
}
function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
return getNextTabbableIn(
document.body,
false,
fallbackToFirst,
fallbackToFocusable
);
}
function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
const activeElement = getActiveElement(container);
const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
const activeIndex = allFocusable.indexOf(activeElement);
const previousFocusableElements = allFocusable.slice(activeIndex + 1);
return previousFocusableElements.find(isTabbable) || (fallbackToLast ? allFocusable.find(isTabbable) : null) || (fallbackToFocusable ? previousFocusableElements[0] : null) || null;
}
function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
return getPreviousTabbableIn(
document.body,
false,
fallbackToFirst,
fallbackToFocusable
);
}
function getClosestFocusable(element) {
while (element && !isFocusable(element)) {
element = element.closest(selector);
}
return element || null;
}
function hasFocus(element) {
const activeElement = getActiveElement(element);
if (!activeElement) return false;
if (activeElement === element) return true;
const activeDescendant = activeElement.getAttribute("aria-activedescendant");
if (!activeDescendant) return false;
return activeDescendant === element.id;
}
function hasFocusWithin(element) {
const activeElement = getActiveElement(element);
if (!activeElement) return false;
if (contains(element, activeElement)) return true;
const activeDescendant = activeElement.getAttribute("aria-activedescendant");
if (!activeDescendant) return false;
if (!("id" in element)) return false;
if (activeDescendant === element.id) return true;
return !!element.querySelector(`#${CSS.escape(activeDescendant)}`);
}
function focusIfNeeded(element) {
if (!hasFocusWithin(element) && isFocusable(element)) {
element.focus();
}
}
function disableFocus(element) {
var _a;
const currentTabindex = (_a = element.getAttribute("tabindex")) != null ? _a : "";
element.setAttribute("data-tabindex", currentTabindex);
element.setAttribute("tabindex", "-1");
}
function disableFocusIn(container, includeContainer) {
const tabbableElements = getAllTabbableIn(container, includeContainer);
for (const element of tabbableElements) {
disableFocus(element);
}
}
function restoreFocusIn(container) {
const elements2 = container.querySelectorAll("[data-tabindex]");
const restoreTabIndex = (element) => {
const tabindex = element.getAttribute("data-tabindex");
element.removeAttribute("data-tabindex");
if (tabindex) {
element.setAttribute("tabindex", tabindex);
} else {
element.removeAttribute("tabindex");
}
};
if (container.hasAttribute("data-tabindex")) {
restoreTabIndex(container);
}
for (const element of elements2) {
restoreTabIndex(element);
}
}
function focusIntoView(element, options2) {
if (!("scrollIntoView" in element)) {
element.focus();
} else {
element.focus({ preventScroll: true });
element.scrollIntoView(__spreadValues2({ block: "nearest", inline: "nearest" }, options2));
}
}
// node_modules/@ariakit/react-core/esm/__chunks/LVA2YJMS.js
var import_react7 = __toESM(require_react(), 1);
var TagName2 = "div";
var isSafariBrowser = isSafari();
var alwaysFocusVisibleInputTypes = [
"text",
"search",
"url",
"tel",
"email",
"password",
"number",
"date",
"month",
"week",
"time",
"datetime",
"datetime-local"
];
var safariFocusAncestorSymbol = Symbol("safariFocusAncestor");
function isSafariFocusAncestor(element) {
if (!element) return false;
return !!element[safariFocusAncestorSymbol];
}
function markSafariFocusAncestor(element, value) {
if (!element) return;
element[safariFocusAncestorSymbol] = value;
}
function isAlwaysFocusVisible(element) {
const { tagName, readOnly, type } = element;
if (tagName === "TEXTAREA" && !readOnly) return true;
if (tagName === "SELECT" && !readOnly) return true;
if (tagName === "INPUT" && !readOnly) {
return alwaysFocusVisibleInputTypes.includes(type);
}
if (element.isContentEditable) return true;
const role = element.getAttribute("role");
if (role === "combobox" && element.dataset.name) {
return true;
}
return false;
}
function getLabels(element) {
if ("labels" in element) {
return element.labels;
}
return null;
}
function isNativeCheckboxOrRadio(element) {
const tagName = element.tagName.toLowerCase();
if (tagName === "input" && element.type) {
return element.type === "radio" || element.type === "checkbox";
}
return false;
}
function isNativeTabbable(tagName) {
if (!tagName) return true;
return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a";
}
function supportsDisabledAttribute(tagName) {
if (!tagName) return true;
return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea";
}
function getTabIndex(focusable, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) {
if (!focusable) {
return tabIndexProp;
}
if (trulyDisabled) {
if (nativeTabbable && !supportsDisabled) {
return -1;
}
return;
}
if (nativeTabbable) {
return tabIndexProp;
}
return tabIndexProp || 0;
}
function useDisableEvent(onEvent, disabled) {
return useEvent((event) => {
onEvent == null ? void 0 : onEvent(event);
if (event.defaultPrevented) return;
if (disabled) {
event.stopPropagation();
event.preventDefault();
}
});
}
var isKeyboardModality = true;
function onGlobalMouseDown(event) {
const target = event.target;
if (target && "hasAttribute" in target) {
if (!target.hasAttribute("data-focus-visible")) {
isKeyboardModality = false;
}
}
}
function onGlobalKeyDown(event) {
if (event.metaKey) return;
if (event.ctrlKey) return;
if (event.altKey) return;
isKeyboardModality = true;
}
var useFocusable = createHook(
function useFocusable2(_a) {
var _b = _a, {
focusable = true,
accessibleWhenDisabled,
autoFocus,
onFocusVisible
} = _b, props = __objRest(_b, [
"focusable",
"accessibleWhenDisabled",
"autoFocus",
"onFocusVisible"
]);
const ref = (0, import_react7.useRef)(null);
(0, import_react7.useEffect)(() => {
if (!focusable) return;
addGlobalEventListener("mousedown", onGlobalMouseDown, true);
addGlobalEventListener("keydown", onGlobalKeyDown, true);
}, [focusable]);
if (isSafariBrowser) {
(0, import_react7.useEffect)(() => {
if (!focusable) return;
const element = ref.current;
if (!element) return;
if (!isNativeCheckboxOrRadio(element)) return;
const labels = getLabels(element);
if (!labels) return;
const onMouseUp = () => queueMicrotask(() => element.focus());
for (const label of labels) {
label.addEventListener("mouseup", onMouseUp);
}
return () => {
for (const label of labels) {
label.removeEventListener("mouseup", onMouseUp);
}
};
}, [focusable]);
}
const disabled = focusable && disabledFromProps(props);
const trulyDisabled = !!disabled && !accessibleWhenDisabled;
const [focusVisible, setFocusVisible] = (0, import_react7.useState)(false);
(0, import_react7.useEffect)(() => {
if (!focusable) return;
if (trulyDisabled && focusVisible) {
setFocusVisible(false);
}
}, [focusable, trulyDisabled, focusVisible]);
(0, import_react7.useEffect)(() => {
if (!focusable) return;
if (!focusVisible) return;
const element = ref.current;
if (!element) return;
if (typeof IntersectionObserver === "undefined") return;
const observer = new IntersectionObserver(() => {
if (!isFocusable(element)) {
setFocusVisible(false);
}
});
observer.observe(element);
return () => observer.disconnect();
}, [focusable, focusVisible]);
const onKeyPressCapture = useDisableEvent(
props.onKeyPressCapture,
disabled
);
const onMouseDownCapture = useDisableEvent(
props.onMouseDownCapture,
disabled
);
const onClickCapture = useDisableEvent(props.onClickCapture, disabled);
const onMouseDownProp = props.onMouseDown;
const onMouseDown = useEvent((event) => {
onMouseDownProp == null ? void 0 : onMouseDownProp(event);
if (event.defaultPrevented) return;
if (!focusable) return;
const element = event.currentTarget;
if (!isSafariBrowser) return;
if (isPortalEvent(event)) return;
if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return;
let receivedFocus = false;
const onFocus = () => {
receivedFocus = true;
};
const options2 = { capture: true, once: true };
element.addEventListener("focusin", onFocus, options2);
const focusableContainer = getClosestFocusable(element.parentElement);
markSafariFocusAncestor(focusableContainer, true);
queueBeforeEvent(element, "mouseup", () => {
element.removeEventListener("focusin", onFocus, true);
markSafariFocusAncestor(focusableContainer, false);
if (receivedFocus) return;
focusIfNeeded(element);
});
});
const handleFocusVisible = (event, currentTarget) => {
if (currentTarget) {
event.currentTarget = currentTarget;
}
if (!focusable) return;
const element = event.currentTarget;
if (!element) return;
if (!hasFocus(element)) return;
onFocusVisible == null ? void 0 : onFocusVisible(event);
if (event.defaultPrevented) return;
element.dataset.focusVisible = "true";
setFocusVisible(true);
};
const onKeyDownCaptureProp = props.onKeyDownCapture;
const onKeyDownCapture = useEvent((event) => {
onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event);
if (event.defaultPrevented) return;
if (!focusable) return;
if (focusVisible) return;
if (event.metaKey) return;
if (event.altKey) return;
if (event.ctrlKey) return;
if (!isSelfTarget(event)) return;
const element = event.currentTarget;
const applyFocusVisible = () => handleFocusVisible(event, element);
queueBeforeEvent(element, "focusout", applyFocusVisible);
});
const onFocusCaptureProp = props.onFocusCapture;
const onFocusCapture = useEvent((event) => {
onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
if (event.defaultPrevented) return;
if (!focusable) return;
if (!isSelfTarget(event)) {
setFocusVisible(false);
return;
}
const element = event.currentTarget;
const applyFocusVisible = () => handleFocusVisible(event, element);
if (isKeyboardModality || isAlwaysFocusVisible(event.target)) {
queueBeforeEvent(event.target, "focusout", applyFocusVisible);
} else {
setFocusVisible(false);
}
});
const onBlurProp = props.onBlur;
const onBlur = useEvent((event) => {
onBlurProp == null ? void 0 : onBlurProp(event);
if (!focusable) return;
if (!isFocusEventOutside(event)) return;
setFocusVisible(false);
});
const autoFocusOnShow = (0, import_react7.useContext)(FocusableContext);
const autoFocusRef = useEvent((element) => {
if (!focusable) return;
if (!autoFocus) return;
if (!element) return;
if (!autoFocusOnShow) return;
queueMicrotask(() => {
if (hasFocus(element)) return;
if (!isFocusable(element)) return;
element.focus();
});
});
const tagName = useTagName(ref);
const nativeTabbable = focusable && isNativeTabbable(tagName);
const supportsDisabled = focusable && supportsDisabledAttribute(tagName);
const styleProp = props.style;
const style2 = (0, import_react7.useMemo)(() => {
if (trulyDisabled) {
return __spreadValues({ pointerEvents: "none" }, styleProp);
}
return styleProp;
}, [trulyDisabled, styleProp]);
props = __spreadProps(__spreadValues({
"data-focus-visible": focusable && focusVisible || void 0,
"data-autofocus": autoFocus || void 0,
"aria-disabled": disabled || void 0
}, props), {
ref: useMergeRefs(ref, autoFocusRef, props.ref),
style: style2,
tabIndex: getTabIndex(
focusable,
trulyDisabled,
nativeTabbable,
supportsDisabled,
props.tabIndex
),
disabled: supportsDisabled && trulyDisabled ? true : void 0,
// TODO: Test Focusable contentEditable.
contentEditable: disabled ? void 0 : props.contentEditable,
onKeyPressCapture,
onClickCapture,
onMouseDownCapture,
onMouseDown,
onKeyDownCapture,
onFocusCapture,
onBlur
});
return removeUndefinedValues(props);
}
);
var Focusable = forwardRef2(function Focusable2(props) {
const htmlProps = useFocusable(props);
return createElement(TagName2, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/ITI7HKP4.js
var import_react8 = __toESM(require_react(), 1);
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
var TagName3 = "div";
function isGrid(items) {
return items.some((item2) => !!item2.rowId);
}
function isPrintableKey(event) {
const target = event.target;
if (target && !isTextField(target)) return false;
return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
}
function isModifierKey(event) {
return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta";
}
function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) {
return useEvent((event) => {
var _a;
onKeyboardEvent == null ? void 0 : onKeyboardEvent(event);
if (event.defaultPrevented) return;
if (event.isPropagationStopped()) return;
if (!isSelfTarget(event)) return;
if (isModifierKey(event)) return;
if (isPrintableKey(event)) return;
const state = store.getState();
const activeElement = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element;
if (!activeElement) return;
const _b = event, { view } = _b, eventInit = __objRest(_b, ["view"]);
const previousElement = previousElementRef == null ? void 0 : previousElementRef.current;
if (activeElement !== previousElement) {
activeElement.focus();
}
if (!fireKeyboardEvent(activeElement, event.type, eventInit)) {
event.preventDefault();
}
if (event.currentTarget.contains(activeElement)) {
event.stopPropagation();
}
});
}
function findFirstEnabledItemInTheLastRow(items) {
return findFirstEnabledItem2(
flatten2DArray(reverseArray(groupItemsByRows2(items)))
);
}
function useScheduleFocus(store) {
const [scheduled, setScheduled] = (0, import_react8.useState)(false);
const schedule = (0, import_react8.useCallback)(() => setScheduled(true), []);
const activeItem = store.useState(
(state) => getEnabledItem(store, state.activeId)
);
(0, import_react8.useEffect)(() => {
const activeElement = activeItem == null ? void 0 : activeItem.element;
if (!scheduled) return;
if (!activeElement) return;
setScheduled(false);
activeElement.focus({ preventScroll: true });
}, [activeItem, scheduled]);
return schedule;
}
var useComposite = createHook(
function useComposite2(_a) {
var _b = _a, {
store,
composite = true,
focusOnMove = composite,
moveOnKeyPress = true
} = _b, props = __objRest(_b, [
"store",
"composite",
"focusOnMove",
"moveOnKeyPress"
]);
const context = useCompositeProviderContext();
store = store || context;
invariant(
store,
"Composite must receive a `store` prop or be wrapped in a CompositeProvider component."
);
const ref = (0, import_react8.useRef)(null);
const previousElementRef = (0, import_react8.useRef)(null);
const scheduleFocus = useScheduleFocus(store);
const moves = store.useState("moves");
const [, setBaseElement] = useTransactionState(
composite ? store.setBaseElement : null
);
(0, import_react8.useEffect)(() => {
var _a2;
if (!store) return;
if (!moves) return;
if (!composite) return;
if (!focusOnMove) return;
const { activeId: activeId2 } = store.getState();
const itemElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element;
if (!itemElement) return;
focusIntoView(itemElement);
}, [store, moves, composite, focusOnMove]);
useSafeLayoutEffect(() => {
if (!store) return;
if (!moves) return;
if (!composite) return;
const { baseElement, activeId: activeId2 } = store.getState();
const isSelfAcive = activeId2 === null;
if (!isSelfAcive) return;
if (!baseElement) return;
const previousElement = previousElementRef.current;
previousElementRef.current = null;
if (previousElement) {
fireBlurEvent(previousElement, { relatedTarget: baseElement });
}
if (!hasFocus(baseElement)) {
baseElement.focus();
}
}, [store, moves, composite]);
const activeId = store.useState("activeId");
const virtualFocus = store.useState("virtualFocus");
useSafeLayoutEffect(() => {
var _a2;
if (!store) return;
if (!composite) return;
if (!virtualFocus) return;
const previousElement = previousElementRef.current;
previousElementRef.current = null;
if (!previousElement) return;
const activeElement = (_a2 = getEnabledItem(store, activeId)) == null ? void 0 : _a2.element;
const relatedTarget = activeElement || getActiveElement(previousElement);
if (relatedTarget === previousElement) return;
fireBlurEvent(previousElement, { relatedTarget });
}, [store, activeId, virtualFocus, composite]);
const onKeyDownCapture = useKeyboardEventProxy(
store,
props.onKeyDownCapture,
previousElementRef
);
const onKeyUpCapture = useKeyboardEventProxy(
store,
props.onKeyUpCapture,
previousElementRef
);
const onFocusCaptureProp = props.onFocusCapture;
const onFocusCapture = useEvent((event) => {
onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event);
if (event.defaultPrevented) return;
if (!store) return;
const { virtualFocus: virtualFocus2 } = store.getState();
if (!virtualFocus2) return;
const previousActiveElement = event.relatedTarget;
const isSilentlyFocused = silentlyFocused(event.currentTarget);
if (isSelfTarget(event) && isSilentlyFocused) {
event.stopPropagation();
previousElementRef.current = previousActiveElement;
}
});
const onFocusProp = props.onFocus;
const onFocus = useEvent((event) => {
onFocusProp == null ? void 0 : onFocusProp(event);
if (event.defaultPrevented) return;
if (!composite) return;
if (!store) return;
const { relatedTarget } = event;
const { virtualFocus: virtualFocus2 } = store.getState();
if (virtualFocus2) {
if (isSelfTarget(event) && !isItem(store, relatedTarget)) {
queueMicrotask(scheduleFocus);
}
} else if (isSelfTarget(event)) {
store.setActiveId(null);
}
});
const onBlurCaptureProp = props.onBlurCapture;
const onBlurCapture = useEvent((event) => {
var _a2;
onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
if (event.defaultPrevented) return;
if (!store) return;
const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState();
if (!virtualFocus2) return;
const activeElement = (_a2 = getEnabledItem(store, activeId2)) == null ? void 0 : _a2.element;
const nextActiveElement = event.relatedTarget;
const nextActiveElementIsItem = isItem(store, nextActiveElement);
const previousElement = previousElementRef.current;
previousElementRef.current = null;
if (isSelfTarget(event) && nextActiveElementIsItem) {
if (nextActiveElement === activeElement) {
if (previousElement && previousElement !== nextActiveElement) {
fireBlurEvent(previousElement, event);
}
} else if (activeElement) {
fireBlurEvent(activeElement, event);
} else if (previousElement) {
fireBlurEvent(previousElement, event);
}
event.stopPropagation();
} else {
const targetIsItem = isItem(store, event.target);
if (!targetIsItem && activeElement) {
fireBlurEvent(activeElement, event);
}
}
});
const onKeyDownProp = props.onKeyDown;
const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
const onKeyDown = useEvent((event) => {
var _a2;
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
if (event.defaultPrevented) return;
if (!store) return;
if (!isSelfTarget(event)) return;
const { orientation, renderedItems, activeId: activeId2 } = store.getState();
const activeItem = getEnabledItem(store, activeId2);
if ((_a2 = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a2.isConnected) return;
const isVertical = orientation !== "horizontal";
const isHorizontal = orientation !== "vertical";
const grid = isGrid(renderedItems);
const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End";
if (isHorizontalKey && isTextField(event.currentTarget)) return;
const up = () => {
if (grid) {
const item2 = findFirstEnabledItemInTheLastRow(renderedItems);
return item2 == null ? void 0 : item2.id;
}
return store == null ? void 0 : store.last();
};
const keyMap = {
ArrowUp: (grid || isVertical) && up,
ArrowRight: (grid || isHorizontal) && store.first,
ArrowDown: (grid || isVertical) && store.first,
ArrowLeft: (grid || isHorizontal) && store.last,
Home: store.first,
End: store.last,
PageUp: store.first,
PageDown: store.last
};
const action = keyMap[event.key];
if (action) {
const id3 = action();
if (id3 !== void 0) {
if (!moveOnKeyPressProp(event)) return;
event.preventDefault();
store.move(id3);
}
}
});
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CompositeContextProvider, { value: store, children: element }),
[store]
);
const activeDescendant = store.useState((state) => {
var _a2;
if (!store) return;
if (!composite) return;
if (!state.virtualFocus) return;
return (_a2 = getEnabledItem(store, state.activeId)) == null ? void 0 : _a2.id;
});
props = __spreadProps(__spreadValues({
"aria-activedescendant": activeDescendant
}, props), {
ref: useMergeRefs(ref, setBaseElement, props.ref),
onKeyDownCapture,
onKeyUpCapture,
onFocusCapture,
onFocus,
onBlurCapture,
onKeyDown
});
const focusable = store.useState(
(state) => composite && (state.virtualFocus || state.activeId === null)
);
props = useFocusable(__spreadValues({ focusable }, props));
return props;
}
);
var Composite = forwardRef2(function Composite2(props) {
const htmlProps = useComposite(props);
return createElement(TagName3, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/KUU7WJ55.js
var import_react9 = __toESM(require_react(), 1);
var TagName4 = "button";
function isNativeClick(event) {
if (!event.isTrusted) return false;
const element = event.currentTarget;
if (event.key === "Enter") {
return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A";
}
if (event.key === " ") {
return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT";
}
return false;
}
var symbol = Symbol("command");
var useCommand = createHook(
function useCommand2(_a) {
var _b = _a, { clickOnEnter = true, clickOnSpace = true } = _b, props = __objRest(_b, ["clickOnEnter", "clickOnSpace"]);
const ref = (0, import_react9.useRef)(null);
const [isNativeButton, setIsNativeButton] = (0, import_react9.useState)(false);
(0, import_react9.useEffect)(() => {
if (!ref.current) return;
setIsNativeButton(isButton(ref.current));
}, []);
const [active, setActive] = (0, import_react9.useState)(false);
const activeRef = (0, import_react9.useRef)(false);
const disabled = disabledFromProps(props);
const [isDuplicate, metadataProps] = useMetadataProps(props, symbol, true);
const onKeyDownProp = props.onKeyDown;
const onKeyDown = useEvent((event) => {
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
const element = event.currentTarget;
if (event.defaultPrevented) return;
if (isDuplicate) return;
if (disabled) return;
if (!isSelfTarget(event)) return;
if (isTextField(element)) return;
if (element.isContentEditable) return;
const isEnter = clickOnEnter && event.key === "Enter";
const isSpace = clickOnSpace && event.key === " ";
const shouldPreventEnter = event.key === "Enter" && !clickOnEnter;
const shouldPreventSpace = event.key === " " && !clickOnSpace;
if (shouldPreventEnter || shouldPreventSpace) {
event.preventDefault();
return;
}
if (isEnter || isSpace) {
const nativeClick = isNativeClick(event);
if (isEnter) {
if (!nativeClick) {
event.preventDefault();
const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]);
const click = () => fireClickEvent(element, eventInit);
if (isFirefox()) {
queueBeforeEvent(element, "keyup", click);
} else {
queueMicrotask(click);
}
}
} else if (isSpace) {
activeRef.current = true;
if (!nativeClick) {
event.preventDefault();
setActive(true);
}
}
}
});
const onKeyUpProp = props.onKeyUp;
const onKeyUp = useEvent((event) => {
onKeyUpProp == null ? void 0 : onKeyUpProp(event);
if (event.defaultPrevented) return;
if (isDuplicate) return;
if (disabled) return;
if (event.metaKey) return;
const isSpace = clickOnSpace && event.key === " ";
if (activeRef.current && isSpace) {
activeRef.current = false;
if (!isNativeClick(event)) {
event.preventDefault();
setActive(false);
const element = event.currentTarget;
const _a2 = event, { view } = _a2, eventInit = __objRest(_a2, ["view"]);
queueMicrotask(() => fireClickEvent(element, eventInit));
}
}
});
props = __spreadProps(__spreadValues(__spreadValues({
"data-active": active || void 0,
type: isNativeButton ? "button" : void 0
}, metadataProps), props), {
ref: useMergeRefs(ref, props.ref),
onKeyDown,
onKeyUp
});
props = useFocusable(props);
return props;
}
);
var Command = forwardRef2(function Command2(props) {
const htmlProps = useCommand(props);
return createElement(TagName4, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/X5NMLKT6.js
var import_react10 = __toESM(require_react(), 1);
var TagName5 = "button";
var useButton = createHook(
function useButton2(props) {
const ref = (0, import_react10.useRef)(null);
const tagName = useTagName(ref, TagName5);
const [isNativeButton, setIsNativeButton] = (0, import_react10.useState)(
() => !!tagName && isButton({ tagName, type: props.type })
);
(0, import_react10.useEffect)(() => {
if (!ref.current) return;
setIsNativeButton(isButton(ref.current));
}, []);
props = __spreadProps(__spreadValues({
role: !isNativeButton && tagName !== "a" ? "button" : void 0
}, props), {
ref: useMergeRefs(ref, props.ref)
});
props = useCommand(props);
return props;
}
);
var Button = forwardRef2(function Button2(props) {
const htmlProps = useButton(props);
return createElement(TagName5, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/P4IRICAX.js
var import_react11 = __toESM(require_react(), 1);
var TagName6 = "button";
var symbol2 = Symbol("disclosure");
var useDisclosure = createHook(
function useDisclosure2(_a) {
var _b = _a, { store, toggleOnClick = true } = _b, props = __objRest(_b, ["store", "toggleOnClick"]);
const context = useDisclosureProviderContext();
store = store || context;
invariant(
store,
"Disclosure must receive a `store` prop or be wrapped in a DisclosureProvider component."
);
const ref = (0, import_react11.useRef)(null);
const [expanded, setExpanded] = (0, import_react11.useState)(false);
const disclosureElement = store.useState("disclosureElement");
const open = store.useState("open");
(0, import_react11.useEffect)(() => {
let isCurrentDisclosure = disclosureElement === ref.current;
if (!(disclosureElement == null ? void 0 : disclosureElement.isConnected)) {
store == null ? void 0 : store.setDisclosureElement(ref.current);
isCurrentDisclosure = true;
}
setExpanded(open && isCurrentDisclosure);
}, [disclosureElement, store, open]);
const onClickProp = props.onClick;
const toggleOnClickProp = useBooleanEvent(toggleOnClick);
const [isDuplicate, metadataProps] = useMetadataProps(props, symbol2, true);
const onClick = useEvent((event) => {
onClickProp == null ? void 0 : onClickProp(event);
if (event.defaultPrevented) return;
if (isDuplicate) return;
if (!toggleOnClickProp(event)) return;
store == null ? void 0 : store.setDisclosureElement(event.currentTarget);
store == null ? void 0 : store.toggle();
});
const contentElement = store.useState("contentElement");
props = __spreadProps(__spreadValues(__spreadValues({
"aria-expanded": expanded,
"aria-controls": contentElement == null ? void 0 : contentElement.id
}, metadataProps), props), {
ref: useMergeRefs(ref, props.ref),
onClick
});
props = useButton(props);
return props;
}
);
var Disclosure = forwardRef2(function Disclosure2(props) {
const htmlProps = useDisclosure(props);
return createElement(TagName6, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/AXB53BZF.js
var TagName7 = "button";
var useDialogDisclosure = createHook(
function useDialogDisclosure2(_a) {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
const context = useDialogProviderContext();
store = store || context;
invariant(
store,
"DialogDisclosure must receive a `store` prop or be wrapped in a DialogProvider component."
);
const contentElement = store.useState("contentElement");
props = __spreadValues({
"aria-haspopup": getPopupRole(contentElement, "dialog")
}, props);
props = useDisclosure(__spreadValues({ store }, props));
return props;
}
);
var DialogDisclosure = forwardRef2(function DialogDisclosure2(props) {
const htmlProps = useDialogDisclosure(props);
return createElement(TagName7, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/7HVFURXT.js
var import_react12 = __toESM(require_react(), 1);
var GroupLabelContext = (0, import_react12.createContext)(void 0);
// node_modules/@ariakit/react-core/esm/__chunks/YUOJWFSO.js
var import_react13 = __toESM(require_react(), 1);
var TagName8 = "div";
var useGroupLabel = createHook(
function useGroupLabel2(props) {
const setLabelId = (0, import_react13.useContext)(GroupLabelContext);
const id3 = useId(props.id);
useSafeLayoutEffect(() => {
setLabelId == null ? void 0 : setLabelId(id3);
return () => setLabelId == null ? void 0 : setLabelId(void 0);
}, [setLabelId, id3]);
props = __spreadValues({
id: id3,
"aria-hidden": true
}, props);
return removeUndefinedValues(props);
}
);
var GroupLabel = forwardRef2(function GroupLabel2(props) {
const htmlProps = useGroupLabel(props);
return createElement(TagName8, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/SWSPTQMT.js
var TagName9 = "div";
var useCompositeGroupLabel = createHook(function useCompositeGroupLabel2(_a) {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
props = useGroupLabel(props);
return props;
});
var CompositeGroupLabel = forwardRef2(function CompositeGroupLabel2(props) {
const htmlProps = useCompositeGroupLabel(props);
return createElement(TagName9, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/36LIF33V.js
var import_react14 = __toESM(require_react(), 1);
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1);
var TagName10 = "div";
var useGroup = createHook(
function useGroup2(props) {
const [labelId, setLabelId] = (0, import_react14.useState)();
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GroupLabelContext.Provider, { value: setLabelId, children: element }),
[]
);
props = __spreadValues({
role: "group",
"aria-labelledby": labelId
}, props);
return removeUndefinedValues(props);
}
);
var Group = forwardRef2(function Group2(props) {
const htmlProps = useGroup(props);
return createElement(TagName10, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/YORGHBM4.js
var TagName11 = "div";
var useCompositeGroup = createHook(
function useCompositeGroup2(_a) {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
props = useGroup(props);
return props;
}
);
var CompositeGroup = forwardRef2(function CompositeGroup2(props) {
const htmlProps = useCompositeGroup(props);
return createElement(TagName11, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/EYKMH5G5.js
var import_react15 = __toESM(require_react(), 1);
var CheckboxCheckedContext = (0, import_react15.createContext)(false);
// node_modules/@ariakit/react-core/esm/__chunks/5JCRYSSV.js
var import_react16 = __toESM(require_react(), 1);
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1);
var TagName12 = "span";
var checkmark = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
"svg",
{
display: "block",
fill: "none",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: 1.5,
viewBox: "0 0 16 16",
height: "1em",
width: "1em",
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polyline", { points: "4,8 7,12 12,4" })
}
);
function getChildren(props) {
if (props.checked) {
return props.children || checkmark;
}
if (typeof props.children === "function") {
return props.children;
}
return null;
}
var useCheckboxCheck = createHook(
function useCheckboxCheck2(_a) {
var _b = _a, { store, checked } = _b, props = __objRest(_b, ["store", "checked"]);
const context = (0, import_react16.useContext)(CheckboxCheckedContext);
checked = checked != null ? checked : context;
const children = getChildren({ checked, children: props.children });
props = __spreadProps(__spreadValues({
"aria-hidden": true
}, props), {
children,
style: __spreadValues({
width: "1em",
height: "1em",
pointerEvents: "none"
}, props.style)
});
return removeUndefinedValues(props);
}
);
var CheckboxCheck = forwardRef2(function CheckboxCheck2(props) {
const htmlProps = useCheckboxCheck(props);
return createElement(TagName12, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/UQQRIHDV.js
var import_react17 = __toESM(require_react(), 1);
var TagName13 = "div";
function getMouseDestination(event) {
const relatedTarget = event.relatedTarget;
if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) {
return relatedTarget;
}
return null;
}
function hoveringInside(event) {
const nextElement = getMouseDestination(event);
if (!nextElement) return false;
return contains(event.currentTarget, nextElement);
}
var symbol3 = Symbol("composite-hover");
function movingToAnotherItem(event) {
let dest = getMouseDestination(event);
if (!dest) return false;
do {
if (hasOwnProperty(dest, symbol3) && dest[symbol3]) return true;
dest = dest.parentElement;
} while (dest);
return false;
}
var useCompositeHover = createHook(
function useCompositeHover2(_a) {
var _b = _a, {
store,
focusOnHover = true,
blurOnHoverEnd = !!focusOnHover
} = _b, props = __objRest(_b, [
"store",
"focusOnHover",
"blurOnHoverEnd"
]);
const context = useCompositeContext();
store = store || context;
invariant(
store,
"CompositeHover must be wrapped in a Composite component."
);
const isMouseMoving = useIsMouseMoving();
const onMouseMoveProp = props.onMouseMove;
const focusOnHoverProp = useBooleanEvent(focusOnHover);
const onMouseMove = useEvent((event) => {
onMouseMoveProp == null ? void 0 : onMouseMoveProp(event);
if (event.defaultPrevented) return;
if (!isMouseMoving()) return;
if (!focusOnHoverProp(event)) return;
if (!hasFocusWithin(event.currentTarget)) {
const baseElement = store == null ? void 0 : store.getState().baseElement;
if (baseElement && !hasFocus(baseElement)) {
baseElement.focus();
}
}
store == null ? void 0 : store.setActiveId(event.currentTarget.id);
});
const onMouseLeaveProp = props.onMouseLeave;
const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd);
const onMouseLeave = useEvent((event) => {
var _a2;
onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event);
if (event.defaultPrevented) return;
if (!isMouseMoving()) return;
if (hoveringInside(event)) return;
if (movingToAnotherItem(event)) return;
if (!focusOnHoverProp(event)) return;
if (!blurOnHoverEndProp(event)) return;
store == null ? void 0 : store.setActiveId(null);
(_a2 = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a2.focus();
});
const ref = (0, import_react17.useCallback)((element) => {
if (!element) return;
element[symbol3] = true;
}, []);
props = __spreadProps(__spreadValues({}, props), {
ref: useMergeRefs(ref, props.ref),
onMouseMove,
onMouseLeave
});
return removeUndefinedValues(props);
}
);
var CompositeHover = memo2(
forwardRef2(function CompositeHover2(props) {
const htmlProps = useCompositeHover(props);
return createElement(TagName13, htmlProps);
})
);
// node_modules/@ariakit/react-core/esm/__chunks/RZ4GPYOB.js
var import_react18 = __toESM(require_react(), 1);
var TagName14 = "div";
var useCollectionItem = createHook(
function useCollectionItem2(_a) {
var _b = _a, {
store,
shouldRegisterItem = true,
getItem = identity,
element
} = _b, props = __objRest(_b, [
"store",
"shouldRegisterItem",
"getItem",
// @ts-expect-error This prop may come from a collection renderer.
"element"
]);
const context = useCollectionContext();
store = store || context;
const id3 = useId(props.id);
const ref = (0, import_react18.useRef)(element);
(0, import_react18.useEffect)(() => {
const element2 = ref.current;
if (!id3) return;
if (!element2) return;
if (!shouldRegisterItem) return;
const item2 = getItem({ id: id3, element: element2 });
return store == null ? void 0 : store.renderItem(item2);
}, [id3, shouldRegisterItem, getItem, store]);
props = __spreadProps(__spreadValues({}, props), {
ref: useMergeRefs(ref, props.ref)
});
return removeUndefinedValues(props);
}
);
var CollectionItem = forwardRef2(function CollectionItem2(props) {
const htmlProps = useCollectionItem(props);
return createElement(TagName14, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/P2CTZE2T.js
var import_react19 = __toESM(require_react(), 1);
var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
var TagName15 = "button";
function isEditableElement(element) {
if (isTextbox(element)) return true;
return element.tagName === "INPUT" && !isButton(element);
}
function getNextPageOffset(scrollingElement, pageUp = false) {
const height = scrollingElement.clientHeight;
const { top } = scrollingElement.getBoundingClientRect();
const pageSize = Math.max(height * 0.875, height - 40) * 1.5;
const pageOffset = pageUp ? height - pageSize + top : pageSize + top;
if (scrollingElement.tagName === "HTML") {
return pageOffset + scrollingElement.scrollTop;
}
return pageOffset;
}
function getItemOffset(itemElement, pageUp = false) {
const { top } = itemElement.getBoundingClientRect();
if (pageUp) {
return top + itemElement.clientHeight;
}
return top;
}
function findNextPageItemId(element, store, next2, pageUp = false) {
var _a;
if (!store) return;
if (!next2) return;
const { renderedItems } = store.getState();
const scrollingElement = getScrollingElement(element);
if (!scrollingElement) return;
const nextPageOffset = getNextPageOffset(scrollingElement, pageUp);
let id3;
let prevDifference;
for (let i3 = 0; i3 < renderedItems.length; i3 += 1) {
const previousId = id3;
id3 = next2(i3);
if (!id3) break;
if (id3 === previousId) continue;
const itemElement = (_a = getEnabledItem(store, id3)) == null ? void 0 : _a.element;
if (!itemElement) continue;
const itemOffset = getItemOffset(itemElement, pageUp);
const difference = itemOffset - nextPageOffset;
const absDifference = Math.abs(difference);
if (pageUp && difference <= 0 || !pageUp && difference >= 0) {
if (prevDifference !== void 0 && prevDifference < absDifference) {
id3 = previousId;
}
break;
}
prevDifference = absDifference;
}
return id3;
}
function targetIsAnotherItem(event, store) {
if (isSelfTarget(event)) return false;
return isItem(store, event.target);
}
var useCompositeItem = createHook(
function useCompositeItem2(_a) {
var _b = _a, {
store,
rowId: rowIdProp,
preventScrollOnKeyDown = false,
moveOnKeyPress = true,
tabbable = false,
getItem: getItemProp,
"aria-setsize": ariaSetSizeProp,
"aria-posinset": ariaPosInSetProp
} = _b, props = __objRest(_b, [
"store",
"rowId",
"preventScrollOnKeyDown",
"moveOnKeyPress",
"tabbable",
"getItem",
"aria-setsize",
"aria-posinset"
]);
const context = useCompositeContext();
store = store || context;
const id3 = useId(props.id);
const ref = (0, import_react19.useRef)(null);
const row = (0, import_react19.useContext)(CompositeRowContext);
const disabled = disabledFromProps(props);
const trulyDisabled = disabled && !props.accessibleWhenDisabled;
const {
rowId,
baseElement,
isActiveItem,
ariaSetSize,
ariaPosInSet,
isTabbable: isTabbable2
} = useStoreStateObject(store, {
rowId(state) {
if (rowIdProp) return rowIdProp;
if (!state) return;
if (!(row == null ? void 0 : row.baseElement)) return;
if (row.baseElement !== state.baseElement) return;
return row.id;
},
baseElement(state) {
return (state == null ? void 0 : state.baseElement) || void 0;
},
isActiveItem(state) {
return !!state && state.activeId === id3;
},
ariaSetSize(state) {
if (ariaSetSizeProp != null) return ariaSetSizeProp;
if (!state) return;
if (!(row == null ? void 0 : row.ariaSetSize)) return;
if (row.baseElement !== state.baseElement) return;
return row.ariaSetSize;
},
ariaPosInSet(state) {
if (ariaPosInSetProp != null) return ariaPosInSetProp;
if (!state) return;
if (!(row == null ? void 0 : row.ariaPosInSet)) return;
if (row.baseElement !== state.baseElement) return;
const itemsInRow = state.renderedItems.filter(
(item2) => item2.rowId === rowId
);
return row.ariaPosInSet + itemsInRow.findIndex((item2) => item2.id === id3);
},
isTabbable(state) {
if (!(state == null ? void 0 : state.renderedItems.length)) return true;
if (state.virtualFocus) return false;
if (tabbable) return true;
if (state.activeId === null) return false;
const item2 = store == null ? void 0 : store.item(state.activeId);
if (item2 == null ? void 0 : item2.disabled) return true;
if (!(item2 == null ? void 0 : item2.element)) return true;
return state.activeId === id3;
}
});
const getItem = (0, import_react19.useCallback)(
(item2) => {
var _a2;
const nextItem = __spreadProps(__spreadValues({}, item2), {
id: id3 || item2.id,
rowId,
disabled: !!trulyDisabled,
children: (_a2 = item2.element) == null ? void 0 : _a2.textContent
});
if (getItemProp) {
return getItemProp(nextItem);
}
return nextItem;
},
[id3, rowId, trulyDisabled, getItemProp]
);
const onFocusProp = props.onFocus;
const hasFocusedComposite = (0, import_react19.useRef)(false);
const onFocus = useEvent((event) => {
onFocusProp == null ? void 0 : onFocusProp(event);
if (event.defaultPrevented) return;
if (isPortalEvent(event)) return;
if (!id3) return;
if (!store) return;
if (targetIsAnotherItem(event, store)) return;
const { virtualFocus, baseElement: baseElement2 } = store.getState();
store.setActiveId(id3);
if (isTextbox(event.currentTarget)) {
selectTextField(event.currentTarget);
}
if (!virtualFocus) return;
if (!isSelfTarget(event)) return;
if (isEditableElement(event.currentTarget)) return;
if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return;
if (isSafari() && event.currentTarget.hasAttribute("data-autofocus")) {
event.currentTarget.scrollIntoView({
block: "nearest",
inline: "nearest"
});
}
hasFocusedComposite.current = true;
const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget);
if (fromComposite) {
focusSilently(baseElement2);
} else {
baseElement2.focus();
}
});
const onBlurCaptureProp = props.onBlurCapture;
const onBlurCapture = useEvent((event) => {
onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event);
if (event.defaultPrevented) return;
const state = store == null ? void 0 : store.getState();
if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) {
hasFocusedComposite.current = false;
event.preventDefault();
event.stopPropagation();
}
});
const onKeyDownProp = props.onKeyDown;
const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown);
const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress);
const onKeyDown = useEvent((event) => {
onKeyDownProp == null ? void 0 : onKeyDownProp(event);
if (event.defaultPrevented) return;
if (!isSelfTarget(event)) return;
if (!store) return;
const { currentTarget } = event;
const state = store.getState();
const item2 = store.item(id3);
const isGrid2 = !!(item2 == null ? void 0 : item2.rowId);
const isVertical = state.orientation !== "horizontal";
const isHorizontal = state.orientation !== "vertical";
const canHomeEnd = () => {
if (isGrid2) return true;
if (isHorizontal) return true;
if (!state.baseElement) return true;
if (!isTextField(state.baseElement)) return true;
return false;
};
const keyMap = {
ArrowUp: (isGrid2 || isVertical) && store.up,
ArrowRight: (isGrid2 || isHorizontal) && store.next,
ArrowDown: (isGrid2 || isVertical) && store.down,
ArrowLeft: (isGrid2 || isHorizontal) && store.previous,
Home: () => {
if (!canHomeEnd()) return;
if (!isGrid2 || event.ctrlKey) {
return store == null ? void 0 : store.first();
}
return store == null ? void 0 : store.previous(-1);
},
End: () => {
if (!canHomeEnd()) return;
if (!isGrid2 || event.ctrlKey) {
return store == null ? void 0 : store.last();
}
return store == null ? void 0 : store.next(-1);
},
PageUp: () => {
return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true);
},
PageDown: () => {
return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down);
}
};
const action = keyMap[event.key];
if (action) {
if (isTextbox(currentTarget)) {
const selection = getTextboxSelection(currentTarget);
const isLeft = isHorizontal && event.key === "ArrowLeft";
const isRight = isHorizontal && event.key === "ArrowRight";
const isUp = isVertical && event.key === "ArrowUp";
const isDown = isVertical && event.key === "ArrowDown";
if (isRight || isDown) {
const { length: valueLength } = getTextboxValue(currentTarget);
if (selection.end !== valueLength) return;
} else if ((isLeft || isUp) && selection.start !== 0) return;
}
const nextId = action();
if (preventScrollOnKeyDownProp(event) || nextId !== void 0) {
if (!moveOnKeyPressProp(event)) return;
event.preventDefault();
store.move(nextId);
}
}
});
const providerValue = (0, import_react19.useMemo)(
() => ({ id: id3, baseElement }),
[id3, baseElement]
);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }),
[providerValue]
);
props = __spreadProps(__spreadValues({
id: id3,
"data-active-item": isActiveItem || void 0
}, props), {
ref: useMergeRefs(ref, props.ref),
tabIndex: isTabbable2 ? props.tabIndex : -1,
onFocus,
onBlurCapture,
onKeyDown
});
props = useCommand(props);
props = useCollectionItem(__spreadProps(__spreadValues({
store
}, props), {
getItem,
shouldRegisterItem: id3 ? props.shouldRegisterItem : false
}));
return removeUndefinedValues(__spreadProps(__spreadValues({}, props), {
"aria-setsize": ariaSetSize,
"aria-posinset": ariaPosInSet
}));
}
);
var CompositeItem = memo2(
forwardRef2(function CompositeItem2(props) {
const htmlProps = useCompositeItem(props);
return createElement(TagName15, htmlProps);
})
);
// node_modules/@ariakit/react-core/esm/__chunks/VGCJ63VH.js
var import_react20 = __toESM(require_react(), 1);
var import_react_dom = __toESM(require_react_dom(), 1);
var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
var TagName16 = "div";
function afterTimeout(timeoutMs, cb) {
const timeoutId = setTimeout(cb, timeoutMs);
return () => clearTimeout(timeoutId);
}
function afterPaint2(cb) {
let raf = requestAnimationFrame(() => {
raf = requestAnimationFrame(cb);
});
return () => cancelAnimationFrame(raf);
}
function parseCSSTime(...times) {
return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => {
const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3;
const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier;
if (currentTime > longestTime) return currentTime;
return longestTime;
}, 0);
}
function isHidden(mounted, hidden, alwaysVisible) {
return !alwaysVisible && hidden !== false && (!mounted || !!hidden);
}
var useDisclosureContent = createHook(function useDisclosureContent2(_a) {
var _b = _a, { store, alwaysVisible } = _b, props = __objRest(_b, ["store", "alwaysVisible"]);
const context = useDisclosureProviderContext();
store = store || context;
invariant(
store,
"DisclosureContent must receive a `store` prop or be wrapped in a DisclosureProvider component."
);
const ref = (0, import_react20.useRef)(null);
const id3 = useId(props.id);
const [transition, setTransition] = (0, import_react20.useState)(null);
const open = store.useState("open");
const mounted = store.useState("mounted");
const animated = store.useState("animated");
const contentElement = store.useState("contentElement");
const otherElement = useStoreState(store.disclosure, "contentElement");
useSafeLayoutEffect(() => {
if (!ref.current) return;
store == null ? void 0 : store.setContentElement(ref.current);
}, [store]);
useSafeLayoutEffect(() => {
let previousAnimated;
store == null ? void 0 : store.setState("animated", (animated2) => {
previousAnimated = animated2;
return true;
});
return () => {
if (previousAnimated === void 0) return;
store == null ? void 0 : store.setState("animated", previousAnimated);
};
}, [store]);
useSafeLayoutEffect(() => {
if (!animated) return;
if (!(contentElement == null ? void 0 : contentElement.isConnected)) {
setTransition(null);
return;
}
return afterPaint2(() => {
setTransition(open ? "enter" : mounted ? "leave" : null);
});
}, [animated, contentElement, open, mounted]);
useSafeLayoutEffect(() => {
if (!store) return;
if (!animated) return;
if (!transition) return;
if (!contentElement) return;
const stopAnimation = () => store == null ? void 0 : store.setState("animating", false);
const stopAnimationSync = () => (0, import_react_dom.flushSync)(stopAnimation);
if (transition === "leave" && open) return;
if (transition === "enter" && !open) return;
if (typeof animated === "number") {
const timeout2 = animated;
return afterTimeout(timeout2, stopAnimationSync);
}
const {
transitionDuration,
animationDuration,
transitionDelay,
animationDelay
} = getComputedStyle(contentElement);
const {
transitionDuration: transitionDuration2 = "0",
animationDuration: animationDuration2 = "0",
transitionDelay: transitionDelay2 = "0",
animationDelay: animationDelay2 = "0"
} = otherElement ? getComputedStyle(otherElement) : {};
const delay2 = parseCSSTime(
transitionDelay,
animationDelay,
transitionDelay2,
animationDelay2
);
const duration = parseCSSTime(
transitionDuration,
animationDuration,
transitionDuration2,
animationDuration2
);
const timeout = delay2 + duration;
if (!timeout) {
if (transition === "enter") {
store.setState("animated", false);
}
stopAnimation();
return;
}
const frameRate = 1e3 / 60;
const maxTimeout = Math.max(timeout - frameRate, 0);
return afterTimeout(maxTimeout, stopAnimationSync);
}, [store, animated, contentElement, otherElement, open, transition]);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogScopedContextProvider, { value: store, children: element }),
[store]
);
const hidden = isHidden(mounted, props.hidden, alwaysVisible);
const styleProp = props.style;
const style2 = (0, import_react20.useMemo)(() => {
if (hidden) {
return __spreadProps(__spreadValues({}, styleProp), { display: "none" });
}
return styleProp;
}, [hidden, styleProp]);
props = __spreadProps(__spreadValues({
id: id3,
"data-open": open || void 0,
"data-enter": transition === "enter" || void 0,
"data-leave": transition === "leave" || void 0,
hidden
}, props), {
ref: useMergeRefs(id3 ? store.setContentElement : null, ref, props.ref),
style: style2
});
return removeUndefinedValues(props);
});
var DisclosureContentImpl = forwardRef2(function DisclosureContentImpl2(props) {
const htmlProps = useDisclosureContent(props);
return createElement(TagName16, htmlProps);
});
var DisclosureContent = forwardRef2(function DisclosureContent2(_a) {
var _b = _a, {
unmountOnHide
} = _b, props = __objRest(_b, [
"unmountOnHide"
]);
const context = useDisclosureProviderContext();
const store = props.store || context;
const mounted = useStoreState(
store,
(state) => !unmountOnHide || (state == null ? void 0 : state.mounted)
);
if (mounted === false) return null;
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DisclosureContentImpl, __spreadValues({}, props));
});
// node_modules/@ariakit/react-core/esm/__chunks/63XF7ACK.js
function isBackdrop(element, ...ids) {
if (!element) return false;
const backdrop = element.getAttribute("data-backdrop");
if (backdrop == null) return false;
if (backdrop === "") return true;
if (backdrop === "true") return true;
if (!ids.length) return true;
return ids.some((id3) => backdrop === id3);
}
// node_modules/@ariakit/react-core/esm/__chunks/K2ZF5NU7.js
var cleanups = /* @__PURE__ */ new WeakMap();
function orchestrate(element, key, setup2) {
if (!cleanups.has(element)) {
cleanups.set(element, /* @__PURE__ */ new Map());
}
const elementCleanups = cleanups.get(element);
const prevCleanup = elementCleanups.get(key);
if (!prevCleanup) {
elementCleanups.set(key, setup2());
return () => {
var _a;
(_a = elementCleanups.get(key)) == null ? void 0 : _a();
elementCleanups.delete(key);
};
}
const cleanup = setup2();
const nextCleanup = () => {
cleanup();
prevCleanup();
elementCleanups.delete(key);
};
elementCleanups.set(key, nextCleanup);
return () => {
const isCurrent = elementCleanups.get(key) === nextCleanup;
if (!isCurrent) return;
cleanup();
elementCleanups.set(key, prevCleanup);
};
}
function setAttribute(element, attr, value) {
const setup2 = () => {
const previousValue = element.getAttribute(attr);
element.setAttribute(attr, value);
return () => {
if (previousValue == null) {
element.removeAttribute(attr);
} else {
element.setAttribute(attr, previousValue);
}
};
};
return orchestrate(element, attr, setup2);
}
function setProperty(element, property, value) {
const setup2 = () => {
const exists = property in element;
const previousValue = element[property];
element[property] = value;
return () => {
if (!exists) {
delete element[property];
} else {
element[property] = previousValue;
}
};
};
return orchestrate(element, property, setup2);
}
function assignStyle(element, style2) {
if (!element) return () => {
};
const setup2 = () => {
const prevStyle = element.style.cssText;
Object.assign(element.style, style2);
return () => {
element.style.cssText = prevStyle;
};
};
return orchestrate(element, "style", setup2);
}
function setCSSProperty(element, property, value) {
if (!element) return () => {
};
const setup2 = () => {
const previousValue = element.style.getPropertyValue(property);
element.style.setProperty(property, value);
return () => {
if (previousValue) {
element.style.setProperty(property, previousValue);
} else {
element.style.removeProperty(property);
}
};
};
return orchestrate(element, property, setup2);
}
// node_modules/@ariakit/react-core/esm/__chunks/AOUGVQZ3.js
var ignoreTags = ["SCRIPT", "STYLE"];
function getSnapshotPropertyName(id3) {
return `__ariakit-dialog-snapshot-${id3}`;
}
function inSnapshot(id3, element) {
const doc = getDocument(element);
const propertyName = getSnapshotPropertyName(id3);
if (!doc.body[propertyName]) return true;
do {
if (element === doc.body) return false;
if (element[propertyName]) return true;
if (!element.parentElement) return false;
element = element.parentElement;
} while (true);
}
function isValidElement3(id3, element, ignoredElements) {
if (ignoreTags.includes(element.tagName)) return false;
if (!inSnapshot(id3, element)) return false;
return !ignoredElements.some(
(enabledElement) => enabledElement && contains(element, enabledElement)
);
}
function walkTreeOutside(id3, elements2, callback, ancestorCallback) {
for (let element of elements2) {
if (!(element == null ? void 0 : element.isConnected)) continue;
const hasAncestorAlready = elements2.some((maybeAncestor) => {
if (!maybeAncestor) return false;
if (maybeAncestor === element) return false;
return maybeAncestor.contains(element);
});
const doc = getDocument(element);
const originalElement = element;
while (element.parentElement && element !== doc.body) {
ancestorCallback == null ? void 0 : ancestorCallback(element.parentElement, originalElement);
if (!hasAncestorAlready) {
for (const child of element.parentElement.children) {
if (isValidElement3(id3, child, elements2)) {
callback(child, originalElement);
}
}
}
element = element.parentElement;
}
}
}
function createWalkTreeSnapshot(id3, elements2) {
const { body } = getDocument(elements2[0]);
const cleanups2 = [];
const markElement2 = (element) => {
cleanups2.push(setProperty(element, getSnapshotPropertyName(id3), true));
};
walkTreeOutside(id3, elements2, markElement2);
return chain(setProperty(body, getSnapshotPropertyName(id3), true), () => {
for (const cleanup of cleanups2) {
cleanup();
}
});
}
// node_modules/@ariakit/react-core/esm/__chunks/2PGBN2Y4.js
function getPropertyName(id3 = "", ancestor = false) {
return `__ariakit-dialog-${ancestor ? "ancestor" : "outside"}${id3 ? `-${id3}` : ""}`;
}
function markElement(element, id3 = "") {
return chain(
setProperty(element, getPropertyName(), true),
setProperty(element, getPropertyName(id3), true)
);
}
function markAncestor(element, id3 = "") {
return chain(
setProperty(element, getPropertyName("", true), true),
setProperty(element, getPropertyName(id3, true), true)
);
}
function isElementMarked(element, id3) {
const ancestorProperty = getPropertyName(id3, true);
if (element[ancestorProperty]) return true;
const elementProperty = getPropertyName(id3);
do {
if (element[elementProperty]) return true;
if (!element.parentElement) return false;
element = element.parentElement;
} while (true);
}
function markTreeOutside(id3, elements2) {
const cleanups2 = [];
const ids = elements2.map((el) => el == null ? void 0 : el.id);
walkTreeOutside(
id3,
elements2,
(element) => {
if (isBackdrop(element, ...ids)) return;
cleanups2.unshift(markElement(element, id3));
},
(ancestor, element) => {
const isAnotherDialogAncestor = element.hasAttribute("data-dialog") && element.id !== id3;
if (isAnotherDialogAncestor) return;
cleanups2.unshift(markAncestor(ancestor, id3));
}
);
const restoreAccessibilityTree = () => {
for (const cleanup of cleanups2) {
cleanup();
}
};
return restoreAccessibilityTree;
}
// node_modules/@ariakit/react-core/esm/__chunks/XL7CSKGW.js
var TagName17 = "div";
var elements = [
"a",
"button",
"details",
"dialog",
"div",
"form",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"header",
"img",
"input",
"label",
"li",
"nav",
"ol",
"p",
"section",
"select",
"span",
"summary",
"textarea",
"ul",
"svg"
];
var useRole = createHook(
function useRole2(props) {
return props;
}
);
var Role = forwardRef2(
// @ts-expect-error
function Role2(props) {
return createElement(TagName17, props);
}
);
Object.assign(
Role,
elements.reduce((acc, element) => {
acc[element] = forwardRef2(function Role3(props) {
return createElement(element, props);
});
return acc;
}, {})
);
// node_modules/@ariakit/react-core/esm/__chunks/63FEHJZV.js
var import_react21 = __toESM(require_react(), 1);
var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
function DialogBackdrop({
store,
backdrop,
alwaysVisible,
hidden
}) {
const ref = (0, import_react21.useRef)(null);
const disclosure = useDisclosureStore({ disclosure: store });
const contentElement = useStoreState(store, "contentElement");
(0, import_react21.useEffect)(() => {
const backdrop2 = ref.current;
const dialog = contentElement;
if (!backdrop2) return;
if (!dialog) return;
backdrop2.style.zIndex = getComputedStyle(dialog).zIndex;
}, [contentElement]);
useSafeLayoutEffect(() => {
const id3 = contentElement == null ? void 0 : contentElement.id;
if (!id3) return;
const backdrop2 = ref.current;
if (!backdrop2) return;
return markAncestor(backdrop2, id3);
}, [contentElement]);
const props = useDisclosureContent({
ref,
store: disclosure,
role: "presentation",
"data-backdrop": (contentElement == null ? void 0 : contentElement.id) || "",
alwaysVisible,
hidden: hidden != null ? hidden : void 0,
style: {
position: "fixed",
top: 0,
right: 0,
bottom: 0,
left: 0
}
});
if (!backdrop) return null;
if ((0, import_react21.isValidElement)(backdrop)) {
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Role, __spreadProps(__spreadValues({}, props), { render: backdrop }));
}
const Component9 = typeof backdrop !== "boolean" ? backdrop : "div";
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Role, __spreadProps(__spreadValues({}, props), { render: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Component9, {}) }));
}
// node_modules/@ariakit/react-core/esm/__chunks/IGR4SXG2.js
function isFocusTrap(element, ...ids) {
if (!element) return false;
const attr = element.getAttribute("data-focus-trap");
if (attr == null) return false;
if (!ids.length) return true;
if (attr === "") return false;
return ids.some((id3) => attr === id3);
}
// node_modules/@ariakit/react-core/esm/__chunks/ESSM74HH.js
function hideElementFromAccessibilityTree(element) {
return setAttribute(element, "aria-hidden", "true");
}
// node_modules/@ariakit/react-core/esm/__chunks/677M2CI3.js
function supportsInert() {
return "inert" in HTMLElement.prototype;
}
// node_modules/@ariakit/react-core/esm/__chunks/KZAQFFOU.js
function disableTree(element, ignoredElements) {
if (!("style" in element)) return noop;
if (supportsInert()) {
return setProperty(element, "inert", true);
}
const tabbableElements = getAllTabbableIn(element, true);
const enableElements = tabbableElements.map((element2) => {
if (ignoredElements == null ? void 0 : ignoredElements.some((el) => el && contains(el, element2))) return noop;
const restoreFocusMethod = orchestrate(element2, "focus", () => {
element2.focus = noop;
return () => {
delete element2.focus;
};
});
return chain(setAttribute(element2, "tabindex", "-1"), restoreFocusMethod);
});
return chain(
...enableElements,
hideElementFromAccessibilityTree(element),
assignStyle(element, {
pointerEvents: "none",
userSelect: "none",
cursor: "default"
})
);
}
function disableTreeOutside(id3, elements2) {
const cleanups2 = [];
const ids = elements2.map((el) => el == null ? void 0 : el.id);
walkTreeOutside(
id3,
elements2,
(element) => {
if (isBackdrop(element, ...ids)) return;
if (isFocusTrap(element, ...ids)) return;
cleanups2.unshift(disableTree(element, elements2));
},
(element) => {
if (!element.hasAttribute("role")) return;
if (elements2.some((el) => el && contains(el, element))) return;
cleanups2.unshift(setAttribute(element, "role", "none"));
}
);
const restoreTreeOutside = () => {
for (const cleanup of cleanups2) {
cleanup();
}
};
return restoreTreeOutside;
}
// node_modules/@ariakit/react-core/esm/__chunks/YKJECYU7.js
var import_react22 = __toESM(require_react(), 1);
var import_react_dom2 = __toESM(require_react_dom(), 1);
function useRootDialog({
attribute,
contentId,
contentElement,
enabled
}) {
const [updated, retry] = useForceUpdate();
const isRootDialog = (0, import_react22.useCallback)(() => {
if (!enabled) return false;
if (!contentElement) return false;
const { body } = getDocument(contentElement);
const id3 = body.getAttribute(attribute);
return !id3 || id3 === contentId;
}, [updated, enabled, contentElement, attribute, contentId]);
(0, import_react22.useEffect)(() => {
if (!enabled) return;
if (!contentId) return;
if (!contentElement) return;
const { body } = getDocument(contentElement);
if (isRootDialog()) {
body.setAttribute(attribute, contentId);
return () => body.removeAttribute(attribute);
}
const observer = new MutationObserver(() => (0, import_react_dom2.flushSync)(retry));
observer.observe(body, { attributeFilter: [attribute] });
return () => observer.disconnect();
}, [updated, enabled, contentId, contentElement, isRootDialog, attribute]);
return isRootDialog;
}
// node_modules/@ariakit/react-core/esm/__chunks/BGQ3KQ5M.js
var import_react23 = __toESM(require_react(), 1);
function getPaddingProperty(documentElement) {
const documentLeft = documentElement.getBoundingClientRect().left;
const scrollbarX = Math.round(documentLeft) + documentElement.scrollLeft;
return scrollbarX ? "paddingLeft" : "paddingRight";
}
function usePreventBodyScroll(contentElement, contentId, enabled) {
const isRootDialog = useRootDialog({
attribute: "data-dialog-prevent-body-scroll",
contentElement,
contentId,
enabled
});
(0, import_react23.useEffect)(() => {
if (!isRootDialog()) return;
if (!contentElement) return;
const doc = getDocument(contentElement);
const win = getWindow(contentElement);
const { documentElement, body } = doc;
const cssScrollbarWidth = documentElement.style.getPropertyValue("--scrollbar-width");
const scrollbarWidth = cssScrollbarWidth ? Number.parseInt(cssScrollbarWidth) : win.innerWidth - documentElement.clientWidth;
const setScrollbarWidthProperty = () => setCSSProperty(
documentElement,
"--scrollbar-width",
`${scrollbarWidth}px`
);
const paddingProperty = getPaddingProperty(documentElement);
const setStyle = () => assignStyle(body, {
overflow: "hidden",
[paddingProperty]: `${scrollbarWidth}px`
});
const setIOSStyle = () => {
var _a, _b;
const { scrollX: scrollX2, scrollY: scrollY2, visualViewport } = win;
const offsetLeft = (_a = visualViewport == null ? void 0 : visualViewport.offsetLeft) != null ? _a : 0;
const offsetTop = (_b = visualViewport == null ? void 0 : visualViewport.offsetTop) != null ? _b : 0;
const restoreStyle = assignStyle(body, {
position: "fixed",
overflow: "hidden",
top: `${-(scrollY2 - Math.floor(offsetTop))}px`,
left: `${-(scrollX2 - Math.floor(offsetLeft))}px`,
right: "0",
[paddingProperty]: `${scrollbarWidth}px`
});
return () => {
restoreStyle();
if (true) {
win.scrollTo({ left: scrollX2, top: scrollY2, behavior: "instant" });
}
};
};
const isIOS = isApple() && !isMac();
return chain(
setScrollbarWidthProperty(),
isIOS ? setIOSStyle() : setStyle()
);
}, [isRootDialog, contentElement]);
}
// node_modules/@ariakit/react-core/esm/__chunks/TOU75OXH.js
var import_react24 = __toESM(require_react(), 1);
var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
var NestedDialogsContext = (0, import_react24.createContext)({});
function useNestedDialogs(store) {
const context = (0, import_react24.useContext)(NestedDialogsContext);
const [dialogs, setDialogs] = (0, import_react24.useState)([]);
const add2 = (0, import_react24.useCallback)(
(dialog) => {
var _a;
setDialogs((dialogs2) => [...dialogs2, dialog]);
return chain((_a = context.add) == null ? void 0 : _a.call(context, dialog), () => {
setDialogs((dialogs2) => dialogs2.filter((d3) => d3 !== dialog));
});
},
[context]
);
useSafeLayoutEffect(() => {
return sync(store, ["open", "contentElement"], (state) => {
var _a;
if (!state.open) return;
if (!state.contentElement) return;
return (_a = context.add) == null ? void 0 : _a.call(context, store);
});
}, [store, context]);
const providerValue = (0, import_react24.useMemo)(() => ({ store, add: add2 }), [store, add2]);
const wrapElement = (0, import_react24.useCallback)(
(element) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NestedDialogsContext.Provider, { value: providerValue, children: element }),
[providerValue]
);
return { wrapElement, nestedDialogs: dialogs };
}
// node_modules/@ariakit/react-core/esm/__chunks/HLTQOHKZ.js
var import_react25 = __toESM(require_react(), 1);
function usePreviousMouseDownRef(enabled) {
const previousMouseDownRef = (0, import_react25.useRef)();
(0, import_react25.useEffect)(() => {
if (!enabled) {
previousMouseDownRef.current = null;
return;
}
const onMouseDown = (event) => {
previousMouseDownRef.current = event.target;
};
return addGlobalEventListener("mousedown", onMouseDown, true);
}, [enabled]);
return previousMouseDownRef;
}
// node_modules/@ariakit/react-core/esm/__chunks/WBDYNH73.js
var import_react26 = __toESM(require_react(), 1);
function isInDocument(target) {
if (target.tagName === "HTML") return true;
return contains(getDocument(target).body, target);
}
function isDisclosure(disclosure, target) {
if (!disclosure) return false;
if (contains(disclosure, target)) return true;
const activeId = target.getAttribute("aria-activedescendant");
if (activeId) {
const activeElement = getDocument(disclosure).getElementById(activeId);
if (activeElement) {
return contains(disclosure, activeElement);
}
}
return false;
}
function isMouseEventOnDialog(event, dialog) {
if (!("clientY" in event)) return false;
const rect = dialog.getBoundingClientRect();
if (rect.width === 0 || rect.height === 0) return false;
return rect.top <= event.clientY && event.clientY <= rect.top + rect.height && rect.left <= event.clientX && event.clientX <= rect.left + rect.width;
}
function useEventOutside({
store,
type,
listener,
capture,
domReady
}) {
const callListener = useEvent(listener);
const open = useStoreState(store, "open");
const focusedRef = (0, import_react26.useRef)(false);
useSafeLayoutEffect(() => {
if (!open) return;
if (!domReady) return;
const { contentElement } = store.getState();
if (!contentElement) return;
const onFocus = () => {
focusedRef.current = true;
};
contentElement.addEventListener("focusin", onFocus, true);
return () => contentElement.removeEventListener("focusin", onFocus, true);
}, [store, open, domReady]);
(0, import_react26.useEffect)(() => {
if (!open) return;
const onEvent = (event) => {
const { contentElement, disclosureElement } = store.getState();
const target = event.target;
if (!contentElement) return;
if (!target) return;
if (!isInDocument(target)) return;
if (contains(contentElement, target)) return;
if (isDisclosure(disclosureElement, target)) return;
if (target.hasAttribute("data-focus-trap")) return;
if (isMouseEventOnDialog(event, contentElement)) return;
const focused = focusedRef.current;
if (focused && !isElementMarked(target, contentElement.id)) return;
if (isSafariFocusAncestor(target)) return;
callListener(event);
};
return addGlobalEventListener(type, onEvent, capture);
}, [open, capture]);
}
function shouldHideOnInteractOutside(hideOnInteractOutside, event) {
if (typeof hideOnInteractOutside === "function") {
return hideOnInteractOutside(event);
}
return !!hideOnInteractOutside;
}
function useHideOnInteractOutside(store, hideOnInteractOutside, domReady) {
const open = useStoreState(store, "open");
const previousMouseDownRef = usePreviousMouseDownRef(open);
const props = { store, domReady, capture: true };
useEventOutside(__spreadProps(__spreadValues({}, props), {
type: "click",
listener: (event) => {
const { contentElement } = store.getState();
const previousMouseDown = previousMouseDownRef.current;
if (!previousMouseDown) return;
if (!isVisible(previousMouseDown)) return;
if (!isElementMarked(previousMouseDown, contentElement == null ? void 0 : contentElement.id)) return;
if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return;
store.hide();
}
}));
useEventOutside(__spreadProps(__spreadValues({}, props), {
type: "focusin",
listener: (event) => {
const { contentElement } = store.getState();
if (!contentElement) return;
if (event.target === getDocument(contentElement)) return;
if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return;
store.hide();
}
}));
useEventOutside(__spreadProps(__spreadValues({}, props), {
type: "contextmenu",
listener: (event) => {
if (!shouldHideOnInteractOutside(hideOnInteractOutside, event)) return;
store.hide();
}
}));
}
// node_modules/@ariakit/react-core/esm/__chunks/6GXEOXGT.js
function prependHiddenDismiss(container, onClick) {
const document2 = getDocument(container);
const button = document2.createElement("button");
button.type = "button";
button.tabIndex = -1;
button.textContent = "Dismiss popup";
Object.assign(button.style, {
border: "0px",
clip: "rect(0 0 0 0)",
height: "1px",
margin: "-1px",
overflow: "hidden",
padding: "0px",
position: "absolute",
whiteSpace: "nowrap",
width: "1px"
});
button.addEventListener("click", onClick);
container.prepend(button);
const removeHiddenDismiss = () => {
button.removeEventListener("click", onClick);
button.remove();
};
return removeHiddenDismiss;
}
// node_modules/@ariakit/react-core/esm/__chunks/ZWYATQFU.js
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
var TagName18 = "div";
var useFocusableContainer = createHook(function useFocusableContainer2(_a) {
var _b = _a, { autoFocusOnShow = true } = _b, props = __objRest(_b, ["autoFocusOnShow"]);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FocusableContext.Provider, { value: autoFocusOnShow, children: element }),
[autoFocusOnShow]
);
return props;
});
var FocusableContainer = forwardRef2(function FocusableContainer2(props) {
const htmlProps = useFocusableContainer(props);
return createElement(TagName18, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/CZ4GFWYL.js
var import_react27 = __toESM(require_react(), 1);
var HeadingContext = (0, import_react27.createContext)(0);
// node_modules/@ariakit/react-core/esm/__chunks/5M6RIVE2.js
var import_react28 = __toESM(require_react(), 1);
var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
function HeadingLevel({ level, children }) {
const contextLevel = (0, import_react28.useContext)(HeadingContext);
const nextLevel = Math.max(
Math.min(level || contextLevel + 1, 6),
1
);
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(HeadingContext.Provider, { value: nextLevel, children });
}
// node_modules/@ariakit/react-core/esm/__chunks/XX67R432.js
var TagName19 = "span";
var useVisuallyHidden = createHook(
function useVisuallyHidden2(props) {
props = __spreadProps(__spreadValues({}, props), {
style: __spreadValues({
border: 0,
clip: "rect(0 0 0 0)",
height: "1px",
margin: "-1px",
overflow: "hidden",
padding: 0,
position: "absolute",
whiteSpace: "nowrap",
width: "1px"
}, props.style)
});
return props;
}
);
var VisuallyHidden = forwardRef2(function VisuallyHidden2(props) {
const htmlProps = useVisuallyHidden(props);
return createElement(TagName19, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/W3VI7GFU.js
var TagName20 = "span";
var useFocusTrap = createHook(
function useFocusTrap2(props) {
props = __spreadProps(__spreadValues({
"data-focus-trap": "",
tabIndex: 0,
"aria-hidden": true
}, props), {
style: __spreadValues({
// Prevents unintended scroll jumps.
position: "fixed",
top: 0,
left: 0
}, props.style)
});
props = useVisuallyHidden(props);
return props;
}
);
var FocusTrap = forwardRef2(function FocusTrap2(props) {
const htmlProps = useFocusTrap(props);
return createElement(TagName20, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/AOQQTIBO.js
var import_react29 = __toESM(require_react(), 1);
var PortalContext = (0, import_react29.createContext)(null);
// node_modules/@ariakit/react-core/esm/__chunks/O37CNYMR.js
var import_react30 = __toESM(require_react(), 1);
var import_react_dom3 = __toESM(require_react_dom(), 1);
var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
var TagName21 = "div";
function getRootElement(element) {
return getDocument(element).body;
}
function getPortalElement(element, portalElement) {
if (!portalElement) {
return getDocument(element).createElement("div");
}
if (typeof portalElement === "function") {
return portalElement(element);
}
return portalElement;
}
function getRandomId(prefix2 = "id") {
return `${prefix2 ? `${prefix2}-` : ""}${Math.random().toString(36).slice(2, 8)}`;
}
function queueFocus(element) {
queueMicrotask(() => {
element == null ? void 0 : element.focus();
});
}
var usePortal = createHook(function usePortal2(_a) {
var _b = _a, {
preserveTabOrder,
preserveTabOrderAnchor,
portalElement,
portalRef,
portal = true
} = _b, props = __objRest(_b, [
"preserveTabOrder",
"preserveTabOrderAnchor",
"portalElement",
"portalRef",
"portal"
]);
const ref = (0, import_react30.useRef)(null);
const refProp = useMergeRefs(ref, props.ref);
const context = (0, import_react30.useContext)(PortalContext);
const [portalNode, setPortalNode] = (0, import_react30.useState)(null);
const [anchorPortalNode, setAnchorPortalNode] = (0, import_react30.useState)(
null
);
const outerBeforeRef = (0, import_react30.useRef)(null);
const innerBeforeRef = (0, import_react30.useRef)(null);
const innerAfterRef = (0, import_react30.useRef)(null);
const outerAfterRef = (0, import_react30.useRef)(null);
useSafeLayoutEffect(() => {
const element = ref.current;
if (!element || !portal) {
setPortalNode(null);
return;
}
const portalEl = getPortalElement(element, portalElement);
if (!portalEl) {
setPortalNode(null);
return;
}
const isPortalInDocument = portalEl.isConnected;
if (!isPortalInDocument) {
const rootElement = context || getRootElement(element);
rootElement.appendChild(portalEl);
}
if (!portalEl.id) {
portalEl.id = element.id ? `portal/${element.id}` : getRandomId();
}
setPortalNode(portalEl);
setRef(portalRef, portalEl);
if (isPortalInDocument) return;
return () => {
portalEl.remove();
setRef(portalRef, null);
};
}, [portal, portalElement, context, portalRef]);
useSafeLayoutEffect(() => {
if (!portal) return;
if (!preserveTabOrder) return;
if (!preserveTabOrderAnchor) return;
const doc = getDocument(preserveTabOrderAnchor);
const element = doc.createElement("span");
element.style.position = "fixed";
preserveTabOrderAnchor.insertAdjacentElement("afterend", element);
setAnchorPortalNode(element);
return () => {
element.remove();
setAnchorPortalNode(null);
};
}, [portal, preserveTabOrder, preserveTabOrderAnchor]);
(0, import_react30.useEffect)(() => {
if (!portalNode) return;
if (!preserveTabOrder) return;
let raf = 0;
const onFocus = (event) => {
if (!isFocusEventOutside(event)) return;
const focusing = event.type === "focusin";
cancelAnimationFrame(raf);
if (focusing) {
return restoreFocusIn(portalNode);
}
raf = requestAnimationFrame(() => {
disableFocusIn(portalNode, true);
});
};
portalNode.addEventListener("focusin", onFocus, true);
portalNode.addEventListener("focusout", onFocus, true);
return () => {
cancelAnimationFrame(raf);
portalNode.removeEventListener("focusin", onFocus, true);
portalNode.removeEventListener("focusout", onFocus, true);
};
}, [portalNode, preserveTabOrder]);
props = useWrapElement(
props,
(element) => {
element = // While the portal node is not in the DOM, we need to pass the
// current context to the portal context, otherwise it's going to
// reset to the body element on nested portals.
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PortalContext.Provider, { value: portalNode || context, children: element });
if (!portal) return element;
if (!portalNode) {
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
"span",
{
ref: refProp,
id: props.id,
style: { position: "fixed" },
hidden: true
}
);
}
element = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
preserveTabOrder && portalNode && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
FocusTrap,
{
ref: innerBeforeRef,
"data-focus-trap": props.id,
className: "__focus-trap-inner-before",
onFocus: (event) => {
if (isFocusEventOutside(event, portalNode)) {
queueFocus(getNextTabbable());
} else {
queueFocus(outerBeforeRef.current);
}
}
}
),
element,
preserveTabOrder && portalNode && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
FocusTrap,
{
ref: innerAfterRef,
"data-focus-trap": props.id,
className: "__focus-trap-inner-after",
onFocus: (event) => {
if (isFocusEventOutside(event, portalNode)) {
queueFocus(getPreviousTabbable());
} else {
queueFocus(outerAfterRef.current);
}
}
}
)
] });
if (portalNode) {
element = (0, import_react_dom3.createPortal)(element, portalNode);
}
let preserveTabOrderElement = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
preserveTabOrder && portalNode && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
FocusTrap,
{
ref: outerBeforeRef,
"data-focus-trap": props.id,
className: "__focus-trap-outer-before",
onFocus: (event) => {
const fromOuter = event.relatedTarget === outerAfterRef.current;
if (!fromOuter && isFocusEventOutside(event, portalNode)) {
queueFocus(innerBeforeRef.current);
} else {
queueFocus(getPreviousTabbable());
}
}
}
),
preserveTabOrder && // We're using position: fixed here so that the browser doesn't
// add margin to the element when setting gap on a parent element.
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-owns": portalNode == null ? void 0 : portalNode.id, style: { position: "fixed" } }),
preserveTabOrder && portalNode && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
FocusTrap,
{
ref: outerAfterRef,
"data-focus-trap": props.id,
className: "__focus-trap-outer-after",
onFocus: (event) => {
if (isFocusEventOutside(event, portalNode)) {
queueFocus(innerAfterRef.current);
} else {
const nextTabbable = getNextTabbable();
if (nextTabbable === innerBeforeRef.current) {
requestAnimationFrame(() => {
var _a2;
return (_a2 = getNextTabbable()) == null ? void 0 : _a2.focus();
});
return;
}
queueFocus(nextTabbable);
}
}
}
)
] });
if (anchorPortalNode && preserveTabOrder) {
preserveTabOrderElement = (0, import_react_dom3.createPortal)(
preserveTabOrderElement,
anchorPortalNode
);
}
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
preserveTabOrderElement,
element
] });
},
[portalNode, context, portal, props.id, preserveTabOrder, anchorPortalNode]
);
props = __spreadProps(__spreadValues({}, props), {
ref: refProp
});
return props;
});
var Portal = forwardRef2(function Portal2(props) {
const htmlProps = usePortal(props);
return createElement(TagName21, htmlProps);
});
// node_modules/@ariakit/react-core/esm/__chunks/JC64G2H7.js
var import_react31 = __toESM(require_react(), 1);
var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
var TagName22 = "div";
var isSafariBrowser2 = isSafari();
function isAlreadyFocusingAnotherElement(dialog) {
const activeElement = getActiveElement();
if (!activeElement) return false;
if (dialog && contains(dialog, activeElement)) return false;
if (isFocusable(activeElement)) return true;
return false;
}
function getElementFromProp(prop, focusable = false) {
if (!prop) return null;
const element = "current" in prop ? prop.current : prop;
if (!element) return null;
if (focusable) return isFocusable(element) ? element : null;
return element;
}
var useDialog = createHook(function useDialog2(_a) {
var _b = _a, {
store: storeProp,
open: openProp,
onClose,
focusable = true,
modal = true,
portal = !!modal,
backdrop = !!modal,
hideOnEscape = true,
hideOnInteractOutside = true,
getPersistentElements,
preventBodyScroll = !!modal,
autoFocusOnShow = true,
autoFocusOnHide = true,
initialFocus,
finalFocus,
unmountOnHide,
unstable_treeSnapshotKey
} = _b, props = __objRest(_b, [
"store",
"open",
"onClose",
"focusable",
"modal",
"portal",
"backdrop",
"hideOnEscape",
"hideOnInteractOutside",
"getPersistentElements",
"preventBodyScroll",
"autoFocusOnShow",
"autoFocusOnHide",
"initialFocus",
"finalFocus",
"unmountOnHide",
"unstable_treeSnapshotKey"
]);
const context = useDialogProviderContext();
const ref = (0, import_react31.useRef)(null);
const store = useDialogStore({
store: storeProp || context,
open: openProp,
setOpen(open2) {
if (open2) return;
const dialog = ref.current;
if (!dialog) return;
const event = new Event("close", { bubbles: false, cancelable: true });
if (onClose) {
dialog.addEventListener("close", onClose, { once: true });
}
dialog.dispatchEvent(event);
if (!event.defaultPrevented) return;
store.setOpen(true);
}
});
const { portalRef, domReady } = usePortalRef(portal, props.portalRef);
const preserveTabOrderProp = props.preserveTabOrder;
const preserveTabOrder = useStoreState(
store,
(state) => preserveTabOrderProp && !modal && state.mounted
);
const id3 = useId(props.id);
const open = useStoreState(store, "open");
const mounted = useStoreState(store, "mounted");
const contentElement = useStoreState(store, "contentElement");
const hidden = isHidden(mounted, props.hidden, props.alwaysVisible);
usePreventBodyScroll(contentElement, id3, preventBodyScroll && !hidden);
useHideOnInteractOutside(store, hideOnInteractOutside, domReady);
const { wrapElement, nestedDialogs } = useNestedDialogs(store);
props = useWrapElement(props, wrapElement, [wrapElement]);
useSafeLayoutEffect(() => {
if (!open) return;
const dialog = ref.current;
const activeElement = getActiveElement(dialog, true);
if (!activeElement) return;
if (activeElement.tagName === "BODY") return;
if (dialog && contains(dialog, activeElement)) return;
store.setDisclosureElement(activeElement);
}, [store, open]);
if (isSafariBrowser2) {
(0, import_react31.useEffect)(() => {
if (!mounted) return;
const { disclosureElement } = store.getState();
if (!disclosureElement) return;
if (!isButton(disclosureElement)) return;
const onMouseDown = () => {
let receivedFocus = false;
const onFocus = () => {
receivedFocus = true;
};
const options2 = { capture: true, once: true };
disclosureElement.addEventListener("focusin", onFocus, options2);
queueBeforeEvent(disclosureElement, "mouseup", () => {
disclosureElement.removeEventListener("focusin", onFocus, true);
if (receivedFocus) return;
focusIfNeeded(disclosureElement);
});
};
disclosureElement.addEventListener("mousedown", onMouseDown);
return () => {
disclosureElement.removeEventListener("mousedown", onMouseDown);
};
}, [store, mounted]);
}
(0, import_react31.useEffect)(() => {
if (!mounted) return;
if (!domReady) return;
const dialog = ref.current;
if (!dialog) return;
const win = getWindow(dialog);
const viewport = win.visualViewport || win;
const setViewportHeight = () => {
var _a2, _b2;
const height = (_b2 = (_a2 = win.visualViewport) == null ? void 0 : _a2.height) != null ? _b2 : win.innerHeight;
dialog.style.setProperty("--dialog-viewport-height", `${height}px`);
};
setViewportHeight();
viewport.addEventListener("resize", setViewportHeight);
return () => {
viewport.removeEventListener("resize", setViewportHeight);
};
}, [mounted, domReady]);
(0, import_react31.useEffect)(() => {
if (!modal) return;
if (!mounted) return;
if (!domReady) return;
const dialog = ref.current;
if (!dialog) return;
const existingDismiss = dialog.querySelector("[data-dialog-dismiss]");
if (existingDismiss) return;
return prependHiddenDismiss(dialog, store.hide);
}, [store, modal, mounted, domReady]);
useSafeLayoutEffect(() => {
if (!supportsInert()) return;
if (open) return;
if (!mounted) return;
if (!domReady) return;
const dialog = ref.current;
if (!dialog) return;
return disableTree(dialog);
}, [open, mounted, domReady]);
const canTakeTreeSnapshot = open && domReady;
useSafeLayoutEffect(() => {
if (!id3) return;
if (!canTakeTreeSnapshot) return;
const dialog = ref.current;
return createWalkTreeSnapshot(id3, [dialog]);
}, [id3, canTakeTreeSnapshot, unstable_treeSnapshotKey]);
const getPersistentElementsProp = useEvent(getPersistentElements);
useSafeLayoutEffect(() => {
if (!id3) return;
if (!canTakeTreeSnapshot) return;
const { disclosureElement } = store.getState();
const dialog = ref.current;
const persistentElements = getPersistentElementsProp() || [];
const allElements = [
dialog,
...persistentElements,
...nestedDialogs.map((dialog2) => dialog2.getState().contentElement)
];
if (modal) {
return chain(
markTreeOutside(id3, allElements),
disableTreeOutside(id3, allElements)
);
}
return markTreeOutside(id3, [disclosureElement, ...allElements]);
}, [
id3,
store,
canTakeTreeSnapshot,
getPersistentElementsProp,
nestedDialogs,
modal,
unstable_treeSnapshotKey
]);
const mayAutoFocusOnShow = !!autoFocusOnShow;
const autoFocusOnShowProp = useBooleanEvent(autoFocusOnShow);
const [autoFocusEnabled, setAutoFocusEnabled] = (0, import_react31.useState)(false);
(0, import_react31.useEffect)(() => {
if (!open) return;
if (!mayAutoFocusOnShow) return;
if (!domReady) return;
if (!(contentElement == null ? void 0 : contentElement.isConnected)) return;
const element = getElementFromProp(initialFocus, true) || // If no initial focus is specified, we try to focus the first element
// with the autofocus attribute. If it's an Ariakit component, the
// Focusable component will consume the autoFocus prop and add the
// data-autofocus attribute to the element instead.
contentElement.querySelector(
"[data-autofocus=true],[autofocus]"
) || // We have to fallback to the first focusable element otherwise portaled
// dialogs with preserveTabOrder set to true will not receive focus
// properly because the elements aren't tabbable until the dialog receives
// focus.
getFirstTabbableIn(contentElement, true, portal && preserveTabOrder) || // Finally, we fallback to the dialog element itself.
contentElement;
const isElementFocusable = isFocusable(element);
if (!autoFocusOnShowProp(isElementFocusable ? element : null)) return;
setAutoFocusEnabled(true);
queueMicrotask(() => {
element.focus();
if (!isSafariBrowser2) return;
element.scrollIntoView({ block: "nearest", inline: "nearest" });
});
}, [
open,
mayAutoFocusOnShow,
domReady,
contentElement,
initialFocus,
portal,
preserveTabOrder,
autoFocusOnShowProp
]);
const mayAutoFocusOnHide = !!autoFocusOnHide;
const autoFocusOnHideProp = useBooleanEvent(autoFocusOnHide);
const [hasOpened, setHasOpened] = (0, import_react31.useState)(false);
(0, import_react31.useEffect)(() => {
if (!open) return;
setHasOpened(true);
return () => setHasOpened(false);
}, [open]);
const focusOnHide = (0, import_react31.useCallback)(
(dialog, retry = true) => {
const { disclosureElement } = store.getState();
if (isAlreadyFocusingAnotherElement(dialog)) return;
let element = getElementFromProp(finalFocus) || disclosureElement;
if (element == null ? void 0 : element.id) {
const doc = getDocument(element);
const selector2 = `[aria-activedescendant="${element.id}"]`;
const composite = doc.querySelector(selector2);
if (composite) {
element = composite;
}
}
if (element && !isFocusable(element)) {
const maybeParentDialog = element.closest("[data-dialog]");
if (maybeParentDialog == null ? void 0 : maybeParentDialog.id) {
const doc = getDocument(maybeParentDialog);
const selector2 = `[aria-controls~="${maybeParentDialog.id}"]`;
const control = doc.querySelector(selector2);
if (control) {
element = control;
}
}
}
const isElementFocusable = element && isFocusable(element);
if (!isElementFocusable && retry) {
requestAnimationFrame(() => focusOnHide(dialog, false));
return;
}
if (!autoFocusOnHideProp(isElementFocusable ? element : null)) return;
if (!isElementFocusable) return;
element == null ? void 0 : element.focus();
},
[store, finalFocus, autoFocusOnHideProp]
);
const focusedOnHideRef = (0, import_react31.useRef)(false);
useSafeLayoutEffect(() => {
if (open) return;
if (!hasOpened) return;
if (!mayAutoFocusOnHide) return;
const dialog = ref.current;
focusedOnHideRef.current = true;
focusOnHide(dialog);
}, [open, hasOpened, domReady, mayAutoFocusOnHide, focusOnHide]);
(0, import_react31.useEffect)(() => {
if (!hasOpened) return;
if (!mayAutoFocusOnHide) return;
const dialog = ref.current;
return () => {
if (focusedOnHideRef.current) {
focusedOnHideRef.current = false;
return;
}
focusOnHide(dialog);
};
}, [hasOpened, mayAutoFocusOnHide, focusOnHide]);
const hideOnEscapeProp = useBooleanEvent(hideOnEscape);
(0, import_react31.useEffect)(() => {
if (!domReady) return;
if (!mounted) return;
const onKeyDown = (event) => {
if (event.key !== "Escape") return;
if (event.defaultPrevented) return;
const dialog = ref.current;
if (!dialog) return;
if (isElementMarked(dialog)) return;
const target = event.target;
if (!target) return;
const { disclosureElement } = store.getState();
const isValidTarget = () => {
if (target.tagName === "BODY") return true;
if (contains(dialog, target)) return true;
if (!disclosureElement) return true;
if (contains(disclosureElement, target)) return true;
return false;
};
if (!isValidTarget()) return;
if (!hideOnEscapeProp(event)) return;
store.hide();
};
return addGlobalEventListener("keydown", onKeyDown, true);
}, [store, domReady, mounted, hideOnEscapeProp]);
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(HeadingLevel, { level: modal ? 1 : void 0, children: element }),
[modal]
);
const hiddenProp = props.hidden;
const alwaysVisible = props.alwaysVisible;
props = useWrapElement(
props,
(element) => {
if (!backdrop) return element;
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
DialogBackdrop,
{
store,
backdrop,
hidden: hiddenProp,
alwaysVisible
}
),
element
] });
},
[store, backdrop, hiddenProp, alwaysVisible]
);
const [headingId, setHeadingId] = (0, import_react31.useState)();
const [descriptionId, setDescriptionId] = (0, import_react31.useState)();
props = useWrapElement(
props,
(element) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DialogScopedContextProvider, { value: store, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DialogHeadingContext.Provider, { value: setHeadingId, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DialogDescriptionContext.Provider, { value: setDescriptionId, children: element }) }) }),
[store]
);
props = __spreadProps(__spreadValues({
id: id3,
"data-dialog": "",
role: "dialog",
tabIndex: focusable ? -1 : void 0,
"aria-labelledby": headingId,
"aria-describedby": descriptionId
}, props), {
ref: useMergeRefs(ref, props.ref)
});
props = useFocusableContainer(__spreadProps(__spreadValues({}, props), {
autoFocusOnShow: autoFocusEnabled
}));
props = useDisclosureContent(__spreadValues({ store }, props));
props = useFocusable(__spreadProps(__spreadValues({}, props), { focusable }));
props = usePortal(__spreadProps(__spreadValues({ portal }, props), { portalRef, preserveTabOrder }));
return props;
});
function createDialogComponent(Component9, useProviderContext = useDialogProviderContext) {
return forwardRef2(function DialogComponent(props) {
const context = useProviderContext();
const store = props.store || context;
const mounted = useStoreState(
store,
(state) => !props.unmountOnHide || (state == null ? void 0 : state.mounted) || !!props.open
);
if (!mounted) return null;
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Component9, __spreadValues({}, props));
});
}
var Dialog = createDialogComponent(
forwardRef2(function Dialog2(props) {
const htmlProps = useDialog(props);
return createElement(TagName22, htmlProps);
}),
useDialogProviderContext
);
// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
var min = Math.min;
var max = Math.max;
var round = Math.round;
var floor = Math.floor;
var createCoords = (v3) => ({
x: v3,
y: v3
});
var oppositeSideMap = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
};
var oppositeAlignmentMap = {
start: "end",
end: "start"
};
function clamp(start, value, end) {
return max(start, min(value, end));
}
function evaluate(value, param) {
return typeof value === "function" ? value(param) : value;
}
function getSide(placement) {
return placement.split("-")[0];
}
function getAlignment(placement) {
return placement.split("-")[1];
}
function getOppositeAxis(axis) {
return axis === "x" ? "y" : "x";
}
function getAxisLength(axis) {
return axis === "y" ? "height" : "width";
}
var yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]);
function getSideAxis(placement) {
return yAxisSides.has(getSide(placement)) ? "y" : "x";
}
function getAlignmentAxis(placement) {
return getOppositeAxis(getSideAxis(placement));
}
function getAlignmentSides(placement, rects, rtl2) {
if (rtl2 === void 0) {
rtl2 = false;
}
const alignment = getAlignment(placement);
const alignmentAxis = getAlignmentAxis(placement);
const length2 = getAxisLength(alignmentAxis);
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl2 ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
if (rects.reference[length2] > rects.floating[length2]) {
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
}
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
}
function getExpandedPlacements(placement) {
const oppositePlacement = getOppositePlacement(placement);
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
}
function getOppositeAlignmentPlacement(placement) {
return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
}
var lrPlacement = ["left", "right"];
var rlPlacement = ["right", "left"];
var tbPlacement = ["top", "bottom"];
var btPlacement = ["bottom", "top"];
function getSideList(side, isStart, rtl2) {
switch (side) {
case "top":
case "bottom":
if (rtl2) return isStart ? rlPlacement : lrPlacement;
return isStart ? lrPlacement : rlPlacement;
case "left":
case "right":
return isStart ? tbPlacement : btPlacement;
default:
return [];
}
}
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl2) {
const alignment = getAlignment(placement);
let list = getSideList(getSide(placement), direction === "start", rtl2);
if (alignment) {
list = list.map((side) => side + "-" + alignment);
if (flipAlignment) {
list = list.concat(list.map(getOppositeAlignmentPlacement));
}
}
return list;
}
function getOppositePlacement(placement) {
return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
}
function expandPaddingObject(padding2) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...padding2
};
}
function getPaddingObject(padding2) {
return typeof padding2 !== "number" ? expandPaddingObject(padding2) : {
top: padding2,
right: padding2,
bottom: padding2,
left: padding2
};
}
function rectToClientRect(rect) {
const {
x: x2,
y: y3,
width,
height
} = rect;
return {
width,
height,
top: y3,
left: x2,
right: x2 + width,
bottom: y3 + height,
x: x2,
y: y3
};
}
// node_modules/@floating-ui/core/dist/floating-ui.core.mjs
function computeCoordsFromPlacement(_ref11, placement, rtl2) {
let {
reference,
floating
} = _ref11;
const sideAxis = getSideAxis(placement);
const alignmentAxis = getAlignmentAxis(placement);
const alignLength = getAxisLength(alignmentAxis);
const side = getSide(placement);
const isVertical = sideAxis === "y";
const commonX = reference.x + reference.width / 2 - floating.width / 2;
const commonY = reference.y + reference.height / 2 - floating.height / 2;
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
let coords;
switch (side) {
case "top":
coords = {
x: commonX,
y: reference.y - floating.height
};
break;
case "bottom":
coords = {
x: commonX,
y: reference.y + reference.height
};
break;
case "right":
coords = {
x: reference.x + reference.width,
y: commonY
};
break;
case "left":
coords = {
x: reference.x - floating.width,
y: commonY
};
break;
default:
coords = {
x: reference.x,
y: reference.y
};
}
switch (getAlignment(placement)) {
case "start":
coords[alignmentAxis] -= commonAlign * (rtl2 && isVertical ? -1 : 1);
break;
case "end":
coords[alignmentAxis] += commonAlign * (rtl2 && isVertical ? -1 : 1);
break;
}
return coords;
}
var computePosition = async (reference, floating, config) => {
const {
placement = "bottom",
strategy = "absolute",
middleware: middleware2 = [],
platform: platform2
} = config;
const validMiddleware = middleware2.filter(Boolean);
const rtl2 = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
let rects = await platform2.getElementRects({
reference,
floating,
strategy
});
let {
x: x2,
y: y3
} = computeCoordsFromPlacement(rects, placement, rtl2);
let statefulPlacement = placement;
let middlewareData = {};
let resetCount = 0;
for (let i3 = 0; i3 < validMiddleware.length; i3++) {
const {
name,
fn
} = validMiddleware[i3];
const {
x: nextX,
y: nextY,
data,
reset
} = await fn({
x: x2,
y: y3,
initialPlacement: placement,
placement: statefulPlacement,
strategy,
middlewareData,
rects,
platform: platform2,
elements: {
reference,
floating
}
});
x2 = nextX != null ? nextX : x2;
y3 = nextY != null ? nextY : y3;
middlewareData = {
...middlewareData,
[name]: {
...middlewareData[name],
...data
}
};
if (reset && resetCount <= 50) {
resetCount++;
if (typeof reset === "object") {
if (reset.placement) {
statefulPlacement = reset.placement;
}
if (reset.rects) {
rects = reset.rects === true ? await platform2.getElementRects({
reference,
floating,
strategy
}) : reset.rects;
}
({
x: x2,
y: y3
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl2));
}
i3 = -1;
}
}
return {
x: x2,
y: y3,
placement: statefulPlacement,
strategy,
middlewareData
};
};
async function detectOverflow(state, options2) {
var _await$platform$isEle;
if (options2 === void 0) {
options2 = {};
}
const {
x: x2,
y: y3,
platform: platform2,
rects,
elements: elements2,
strategy
} = state;
const {
boundary = "clippingAncestors",
rootBoundary = "viewport",
elementContext = "floating",
altBoundary = false,
padding: padding2 = 0
} = evaluate(options2, state);
const paddingObject = getPaddingObject(padding2);
const altContext = elementContext === "floating" ? "reference" : "floating";
const element = elements2[altBoundary ? altContext : elementContext];
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements2.floating)),
boundary,
rootBoundary,
strategy
}));
const rect = elementContext === "floating" ? {
x: x2,
y: y3,
width: rects.floating.width,
height: rects.floating.height
} : rects.reference;
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements2.floating));
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
x: 1,
y: 1
} : {
x: 1,
y: 1
};
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
elements: elements2,
rect,
offsetParent,
strategy
}) : rect);
return {
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
};
}
var arrow = (options2) => ({
name: "arrow",
options: options2,
async fn(state) {
const {
x: x2,
y: y3,
placement,
rects,
platform: platform2,
elements: elements2,
middlewareData
} = state;
const {
element,
padding: padding2 = 0
} = evaluate(options2, state) || {};
if (element == null) {
return {};
}
const paddingObject = getPaddingObject(padding2);
const coords = {
x: x2,
y: y3
};
const axis = getAlignmentAxis(placement);
const length2 = getAxisLength(axis);
const arrowDimensions = await platform2.getDimensions(element);
const isYAxis = axis === "y";
const minProp = isYAxis ? "top" : "left";
const maxProp = isYAxis ? "bottom" : "right";
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
const endDiff = rects.reference[length2] + rects.reference[axis] - coords[axis] - rects.floating[length2];
const startDiff = coords[axis] - rects.reference[axis];
const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
clientSize = elements2.floating[clientProp] || rects.floating[length2];
}
const centerToReference = endDiff / 2 - startDiff / 2;
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length2] / 2 - 1;
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
const min$1 = minPadding;
const max3 = clientSize - arrowDimensions[length2] - maxPadding;
const center = clientSize / 2 - arrowDimensions[length2] / 2 + centerToReference;
const offset3 = clamp(min$1, center, max3);
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset3 && rects.reference[length2] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length2] / 2 < 0;
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max3 : 0;
return {
[axis]: coords[axis] + alignmentOffset,
data: {
[axis]: offset3,
centerOffset: center - offset3 - alignmentOffset,
...shouldAddOffset && {
alignmentOffset
}
},
reset: shouldAddOffset
};
}
});
var flip = function(options2) {
if (options2 === void 0) {
options2 = {};
}
return {
name: "flip",
options: options2,
async fn(state) {
var _middlewareData$arrow, _middlewareData$flip;
const {
placement,
middlewareData,
rects,
initialPlacement,
platform: platform2,
elements: elements2
} = state;
const {
mainAxis: checkMainAxis = true,
crossAxis: checkCrossAxis = true,
fallbackPlacements: specifiedFallbackPlacements,
fallbackStrategy = "bestFit",
fallbackAxisSideDirection = "none",
flipAlignment = true,
...detectOverflowOptions
} = evaluate(options2, state);
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
return {};
}
const side = getSide(placement);
const initialSideAxis = getSideAxis(initialPlacement);
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
const rtl2 = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements2.floating));
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl2));
}
const placements2 = [initialPlacement, ...fallbackPlacements];
const overflow = await detectOverflow(state, detectOverflowOptions);
const overflows = [];
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
if (checkMainAxis) {
overflows.push(overflow[side]);
}
if (checkCrossAxis) {
const sides3 = getAlignmentSides(placement, rects, rtl2);
overflows.push(overflow[sides3[0]], overflow[sides3[1]]);
}
overflowsData = [...overflowsData, {
placement,
overflows
}];
if (!overflows.every((side2) => side2 <= 0)) {
var _middlewareData$flip2, _overflowsData$filter;
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
const nextPlacement = placements2[nextIndex];
if (nextPlacement) {
const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
// overflows the main axis.
overflowsData.every((d3) => d3.overflows[0] > 0 && getSideAxis(d3.placement) === initialSideAxis)) {
return {
data: {
index: nextIndex,
overflows: overflowsData
},
reset: {
placement: nextPlacement
}
};
}
}
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d3) => d3.overflows[0] <= 0).sort((a3, b3) => a3.overflows[1] - b3.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
if (!resetPlacement) {
switch (fallbackStrategy) {
case "bestFit": {
var _overflowsData$filter2;
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d3) => {
if (hasFallbackAxisSideDirection) {
const currentSideAxis = getSideAxis(d3.placement);
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
// reading directions favoring greater width.
currentSideAxis === "y";
}
return true;
}).map((d3) => [d3.placement, d3.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a3, b3) => a3[1] - b3[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
if (placement2) {
resetPlacement = placement2;
}
break;
}
case "initialPlacement":
resetPlacement = initialPlacement;
break;
}
}
if (placement !== resetPlacement) {
return {
reset: {
placement: resetPlacement
}
};
}
}
return {};
}
};
};
var originSides = /* @__PURE__ */ new Set(["left", "top"]);
async function convertValueToCoords(state, options2) {
const {
placement,
platform: platform2,
elements: elements2
} = state;
const rtl2 = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements2.floating));
const side = getSide(placement);
const alignment = getAlignment(placement);
const isVertical = getSideAxis(placement) === "y";
const mainAxisMulti = originSides.has(side) ? -1 : 1;
const crossAxisMulti = rtl2 && isVertical ? -1 : 1;
const rawValue = evaluate(options2, state);
let {
mainAxis,
crossAxis,
alignmentAxis
} = typeof rawValue === "number" ? {
mainAxis: rawValue,
crossAxis: 0,
alignmentAxis: null
} : {
mainAxis: rawValue.mainAxis || 0,
crossAxis: rawValue.crossAxis || 0,
alignmentAxis: rawValue.alignmentAxis
};
if (alignment && typeof alignmentAxis === "number") {
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
}
return isVertical ? {
x: crossAxis * crossAxisMulti,
y: mainAxis * mainAxisMulti
} : {
x: mainAxis * mainAxisMulti,
y: crossAxis * crossAxisMulti
};
}
var offset = function(options2) {
if (options2 === void 0) {
options2 = 0;
}
return {
name: "offset",
options: options2,
async fn(state) {
var _middlewareData$offse, _middlewareData$arrow;
const {
x: x2,
y: y3,
placement,
middlewareData
} = state;
const diffCoords = await convertValueToCoords(state, options2);
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
return {};
}
return {
x: x2 + diffCoords.x,
y: y3 + diffCoords.y,
data: {
...diffCoords,
placement
}
};
}
};
};
var shift = function(options2) {
if (options2 === void 0) {
options2 = {};
}
return {
name: "shift",
options: options2,
async fn(state) {
const {
x: x2,
y: y3,
placement
} = state;
const {
mainAxis: checkMainAxis = true,
crossAxis: checkCrossAxis = false,
limiter = {
fn: (_ref11) => {
let {
x: x3,
y: y4
} = _ref11;
return {
x: x3,
y: y4
};
}
},
...detectOverflowOptions
} = evaluate(options2, state);
const coords = {
x: x2,
y: y3
};
const overflow = await detectOverflow(state, detectOverflowOptions);
const crossAxis = getSideAxis(getSide(placement));
const mainAxis = getOppositeAxis(crossAxis);
let mainAxisCoord = coords[mainAxis];
let crossAxisCoord = coords[crossAxis];
if (checkMainAxis) {
const minSide = mainAxis === "y" ? "top" : "left";
const maxSide = mainAxis === "y" ? "bottom" : "right";
const min3 = mainAxisCoord + overflow[minSide];
const max3 = mainAxisCoord - overflow[maxSide];
mainAxisCoord = clamp(min3, mainAxisCoord, max3);
}
if (checkCrossAxis) {
const minSide = crossAxis === "y" ? "top" : "left";
const maxSide = crossAxis === "y" ? "bottom" : "right";
const min3 = crossAxisCoord + overflow[minSide];
const max3 = crossAxisCoord - overflow[maxSide];
crossAxisCoord = clamp(min3, crossAxisCoord, max3);
}
const limitedCoords = limiter.fn({
...state,
[mainAxis]: mainAxisCoord,
[crossAxis]: crossAxisCoord
});
return {
...limitedCoords,
data: {
x: limitedCoords.x - x2,
y: limitedCoords.y - y3,
enabled: {
[mainAxis]: checkMainAxis,
[crossAxis]: checkCrossAxis
}
}
};
}
};
};
var limitShift = function(options2) {
if (options2 === void 0) {
options2 = {};
}
return {
options: options2,
fn(state) {
const {
x: x2,
y: y3,
placement,
rects,
middlewareData
} = state;
const {
offset: offset3 = 0,
mainAxis: checkMainAxis = true,
crossAxis: checkCrossAxis = true
} = evaluate(options2, state);
const coords = {
x: x2,
y: y3
};
const crossAxis = getSideAxis(placement);
const mainAxis = getOppositeAxis(crossAxis);
let mainAxisCoord = coords[mainAxis];
let crossAxisCoord = coords[crossAxis];
const rawOffset = evaluate(offset3, state);
const computedOffset = typeof rawOffset === "number" ? {
mainAxis: rawOffset,
crossAxis: 0
} : {
mainAxis: 0,
crossAxis: 0,
...rawOffset
};
if (checkMainAxis) {
const len = mainAxis === "y" ? "height" : "width";
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
if (mainAxisCoord < limitMin) {
mainAxisCoord = limitMin;
} else if (mainAxisCoord > limitMax) {
mainAxisCoord = limitMax;
}
}
if (checkCrossAxis) {
var _middlewareData$offse, _middlewareData$offse2;
const len = mainAxis === "y" ? "width" : "height";
const isOriginSide = originSides.has(getSide(placement));
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
if (crossAxisCoord < limitMin) {
crossAxisCoord = limitMin;
} else if (crossAxisCoord > limitMax) {
crossAxisCoord = limitMax;
}
}
return {
[mainAxis]: mainAxisCoord,
[crossAxis]: crossAxisCoord
};
}
};
};
var size = function(options2) {
if (options2 === void 0) {
options2 = {};
}
return {
name: "size",
options: options2,
async fn(state) {
var _state$middlewareData, _state$middlewareData2;
const {
placement,
rects,
platform: platform2,
elements: elements2
} = state;
const {
apply = () => {
},
...detectOverflowOptions
} = evaluate(options2, state);
const overflow = await detectOverflow(state, detectOverflowOptions);
const side = getSide(placement);
const alignment = getAlignment(placement);
const isYAxis = getSideAxis(placement) === "y";
const {
width,
height
} = rects.floating;
let heightSide;
let widthSide;
if (side === "top" || side === "bottom") {
heightSide = side;
widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements2.floating)) ? "start" : "end") ? "left" : "right";
} else {
widthSide = side;
heightSide = alignment === "end" ? "top" : "bottom";
}
const maximumClippingHeight = height - overflow.top - overflow.bottom;
const maximumClippingWidth = width - overflow.left - overflow.right;
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
const noShift = !state.middlewareData.shift;
let availableHeight = overflowAvailableHeight;
let availableWidth = overflowAvailableWidth;
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
availableWidth = maximumClippingWidth;
}
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
availableHeight = maximumClippingHeight;
}
if (noShift && !alignment) {
const xMin = max(overflow.left, 0);
const xMax = max(overflow.right, 0);
const yMin = max(overflow.top, 0);
const yMax = max(overflow.bottom, 0);
if (isYAxis) {
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
} else {
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
}
}
await apply({
...state,
availableWidth,
availableHeight
});
const nextDimensions = await platform2.getDimensions(elements2.floating);
if (width !== nextDimensions.width || height !== nextDimensions.height) {
return {
reset: {
rects: true
}
};
}
return {};
}
};
};
// node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
function hasWindow() {
return typeof window !== "undefined";
}
function getNodeName(node2) {
if (isNode(node2)) {
return (node2.nodeName || "").toLowerCase();
}
return "#document";
}
function getWindow2(node2) {
var _node$ownerDocument;
return (node2 == null || (_node$ownerDocument = node2.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
}
function getDocumentElement(node2) {
var _ref11;
return (_ref11 = (isNode(node2) ? node2.ownerDocument : node2.document) || window.document) == null ? void 0 : _ref11.documentElement;
}
function isNode(value) {
if (!hasWindow()) {
return false;
}
return value instanceof Node || value instanceof getWindow2(value).Node;
}
function isElement(value) {
if (!hasWindow()) {
return false;
}
return value instanceof Element || value instanceof getWindow2(value).Element;
}
function isHTMLElement(value) {
if (!hasWindow()) {
return false;
}
return value instanceof HTMLElement || value instanceof getWindow2(value).HTMLElement;
}
function isShadowRoot(value) {
if (!hasWindow() || typeof ShadowRoot === "undefined") {
return false;
}
return value instanceof ShadowRoot || value instanceof getWindow2(value).ShadowRoot;
}
var invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
function isOverflowElement(element) {
const {
overflow,
overflowX,
overflowY,
display
} = getComputedStyle2(element);
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
}
var tableElements = /* @__PURE__ */ new Set(["table", "td", "th"]);
function isTableElement(element) {
return tableElements.has(getNodeName(element));
}
var topLayerSelectors = [":popover-open", ":modal"];
function isTopLayer(element) {
return topLayerSelectors.some((selector2) => {
try {
return element.matches(selector2);
} catch (_e2) {
return false;
}
});
}
var transformProperties = ["transform", "translate", "scale", "rotate", "perspective"];
var willChangeValues = ["transform", "translate", "scale", "rotate", "perspective", "filter"];
var containValues = ["paint", "layout", "strict", "content"];
function isContainingBlock(elementOrCss) {
const webkit = isWebKit();
const css6 = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
return transformProperties.some((value) => css6[value] ? css6[value] !== "none" : false) || (css6.containerType ? css6.containerType !== "normal" : false) || !webkit && (css6.backdropFilter ? css6.backdropFilter !== "none" : false) || !webkit && (css6.filter ? css6.filter !== "none" : false) || willChangeValues.some((value) => (css6.willChange || "").includes(value)) || containValues.some((value) => (css6.contain || "").includes(value));
}
function getContainingBlock(element) {
let currentNode = getParentNode(element);
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
if (isContainingBlock(currentNode)) {
return currentNode;
} else if (isTopLayer(currentNode)) {
return null;
}
currentNode = getParentNode(currentNode);
}
return null;
}
function isWebKit() {
if (typeof CSS === "undefined" || !CSS.supports) return false;
return CSS.supports("-webkit-backdrop-filter", "none");
}
var lastTraversableNodeNames = /* @__PURE__ */ new Set(["html", "body", "#document"]);
function isLastTraversableNode(node2) {
return lastTraversableNodeNames.has(getNodeName(node2));
}
function getComputedStyle2(element) {
return getWindow2(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(node2) {
if (getNodeName(node2) === "html") {
return node2;
}
const result = (
// Step into the shadow DOM of the parent of a slotted node.
node2.assignedSlot || // DOM Element detected.
node2.parentNode || // ShadowRoot detected.
isShadowRoot(node2) && node2.host || // Fallback.
getDocumentElement(node2)
);
return isShadowRoot(result) ? result.host : result;
}
function getNearestOverflowAncestor(node2) {
const parentNode = getParentNode(node2);
if (isLastTraversableNode(parentNode)) {
return node2.ownerDocument ? node2.ownerDocument.body : node2.body;
}
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
return parentNode;
}
return getNearestOverflowAncestor(parentNode);
}
function getOverflowAncestors(node2, list, traverseIframes) {
var _node$ownerDocument2;
if (list === void 0) {
list = [];
}
if (traverseIframes === void 0) {
traverseIframes = true;
}
const scrollableAncestor = getNearestOverflowAncestor(node2);
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node2.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
const win = getWindow2(scrollableAncestor);
if (isBody) {
const frameElement = getFrameElement(win);
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
}
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
}
function getFrameElement(win) {
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
}
// node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
function getCssDimensions(element) {
const css6 = getComputedStyle2(element);
let width = parseFloat(css6.width) || 0;
let height = parseFloat(css6.height) || 0;
const hasOffset = isHTMLElement(element);
const offsetWidth = hasOffset ? element.offsetWidth : width;
const offsetHeight = hasOffset ? element.offsetHeight : height;
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
if (shouldFallback) {
width = offsetWidth;
height = offsetHeight;
}
return {
width,
height,
$: shouldFallback
};
}
function unwrapElement(element) {
return !isElement(element) ? element.contextElement : element;
}
function getScale(element) {
const domElement = unwrapElement(element);
if (!isHTMLElement(domElement)) {
return createCoords(1);
}
const rect = domElement.getBoundingClientRect();
const {
width,
height,
$: $3
} = getCssDimensions(domElement);
let x2 = ($3 ? round(rect.width) : rect.width) / width;
let y3 = ($3 ? round(rect.height) : rect.height) / height;
if (!x2 || !Number.isFinite(x2)) {
x2 = 1;
}
if (!y3 || !Number.isFinite(y3)) {
y3 = 1;
}
return {
x: x2,
y: y3
};
}
var noOffsets = /* @__PURE__ */ createCoords(0);
function getVisualOffsets(element) {
const win = getWindow2(element);
if (!isWebKit() || !win.visualViewport) {
return noOffsets;
}
return {
x: win.visualViewport.offsetLeft,
y: win.visualViewport.offsetTop
};
}
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
if (isFixed === void 0) {
isFixed = false;
}
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow2(element)) {
return false;
}
return isFixed;
}
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
if (includeScale === void 0) {
includeScale = false;
}
if (isFixedStrategy === void 0) {
isFixedStrategy = false;
}
const clientRect = element.getBoundingClientRect();
const domElement = unwrapElement(element);
let scale2 = createCoords(1);
if (includeScale) {
if (offsetParent) {
if (isElement(offsetParent)) {
scale2 = getScale(offsetParent);
}
} else {
scale2 = getScale(element);
}
}
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
let x2 = (clientRect.left + visualOffsets.x) / scale2.x;
let y3 = (clientRect.top + visualOffsets.y) / scale2.y;
let width = clientRect.width / scale2.x;
let height = clientRect.height / scale2.y;
if (domElement) {
const win = getWindow2(domElement);
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow2(offsetParent) : offsetParent;
let currentWin = win;
let currentIFrame = getFrameElement(currentWin);
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
const iframeScale = getScale(currentIFrame);
const iframeRect = currentIFrame.getBoundingClientRect();
const css6 = getComputedStyle2(currentIFrame);
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css6.paddingLeft)) * iframeScale.x;
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css6.paddingTop)) * iframeScale.y;
x2 *= iframeScale.x;
y3 *= iframeScale.y;
width *= iframeScale.x;
height *= iframeScale.y;
x2 += left;
y3 += top;
currentWin = getWindow2(currentIFrame);
currentIFrame = getFrameElement(currentWin);
}
}
return rectToClientRect({
width,
height,
x: x2,
y: y3
});
}
function getWindowScrollBarX(element, rect) {
const leftScroll = getNodeScroll(element).scrollLeft;
if (!rect) {
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
}
return rect.left + leftScroll;
}
function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
if (ignoreScrollbarX === void 0) {
ignoreScrollbarX = false;
}
const htmlRect = documentElement.getBoundingClientRect();
const x2 = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
// RTL
scrollbar.
getWindowScrollBarX(documentElement, htmlRect)
));
const y3 = htmlRect.top + scroll.scrollTop;
return {
x: x2,
y: y3
};
}
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref11) {
let {
elements: elements2,
rect,
offsetParent,
strategy
} = _ref11;
const isFixed = strategy === "fixed";
const documentElement = getDocumentElement(offsetParent);
const topLayer = elements2 ? isTopLayer(elements2.floating) : false;
if (offsetParent === documentElement || topLayer && isFixed) {
return rect;
}
let scroll = {
scrollLeft: 0,
scrollTop: 0
};
let scale2 = createCoords(1);
const offsets = createCoords(0);
const isOffsetParentAnElement = isHTMLElement(offsetParent);
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isHTMLElement(offsetParent)) {
const offsetRect = getBoundingClientRect(offsetParent);
scale2 = getScale(offsetParent);
offsets.x = offsetRect.x + offsetParent.clientLeft;
offsets.y = offsetRect.y + offsetParent.clientTop;
}
}
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
return {
width: rect.width * scale2.x,
height: rect.height * scale2.y,
x: rect.x * scale2.x - scroll.scrollLeft * scale2.x + offsets.x + htmlOffset.x,
y: rect.y * scale2.y - scroll.scrollTop * scale2.y + offsets.y + htmlOffset.y
};
}
function getClientRects(element) {
return Array.from(element.getClientRects());
}
function getDocumentRect(element) {
const html = getDocumentElement(element);
const scroll = getNodeScroll(element);
const body = element.ownerDocument.body;
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
let x2 = -scroll.scrollLeft + getWindowScrollBarX(element);
const y3 = -scroll.scrollTop;
if (getComputedStyle2(body).direction === "rtl") {
x2 += max(html.clientWidth, body.clientWidth) - width;
}
return {
width,
height,
x: x2,
y: y3
};
}
function getViewportRect(element, strategy) {
const win = getWindow2(element);
const html = getDocumentElement(element);
const visualViewport = win.visualViewport;
let width = html.clientWidth;
let height = html.clientHeight;
let x2 = 0;
let y3 = 0;
if (visualViewport) {
width = visualViewport.width;
height = visualViewport.height;
const visualViewportBased = isWebKit();
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
x2 = visualViewport.offsetLeft;
y3 = visualViewport.offsetTop;
}
}
return {
width,
height,
x: x2,
y: y3
};
}
var absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
function getInnerBoundingClientRect(element, strategy) {
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
const top = clientRect.top + element.clientTop;
const left = clientRect.left + element.clientLeft;
const scale2 = isHTMLElement(element) ? getScale(element) : createCoords(1);
const width = element.clientWidth * scale2.x;
const height = element.clientHeight * scale2.y;
const x2 = left * scale2.x;
const y3 = top * scale2.y;
return {
width,
height,
x: x2,
y: y3
};
}
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
let rect;
if (clippingAncestor === "viewport") {
rect = getViewportRect(element, strategy);
} else if (clippingAncestor === "document") {
rect = getDocumentRect(getDocumentElement(element));
} else if (isElement(clippingAncestor)) {
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
} else {
const visualOffsets = getVisualOffsets(element);
rect = {
x: clippingAncestor.x - visualOffsets.x,
y: clippingAncestor.y - visualOffsets.y,
width: clippingAncestor.width,
height: clippingAncestor.height
};
}
return rectToClientRect(rect);
}
function hasFixedPositionAncestor(element, stopNode) {
const parentNode = getParentNode(element);
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
return false;
}
return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
}
function getClippingElementAncestors(element, cache2) {
const cachedResult = cache2.get(element);
if (cachedResult) {
return cachedResult;
}
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
let currentContainingBlockComputedStyle = null;
const elementIsFixed = getComputedStyle2(element).position === "fixed";
let currentNode = elementIsFixed ? getParentNode(element) : element;
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
const computedStyle = getComputedStyle2(currentNode);
const currentNodeIsContaining = isContainingBlock(currentNode);
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
currentContainingBlockComputedStyle = null;
}
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
if (shouldDropCurrentNode) {
result = result.filter((ancestor) => ancestor !== currentNode);
} else {
currentContainingBlockComputedStyle = computedStyle;
}
currentNode = getParentNode(currentNode);
}
cache2.set(element, result);
return result;
}
function getClippingRect(_ref11) {
let {
element,
boundary,
rootBoundary,
strategy
} = _ref11;
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
const firstClippingAncestor = clippingAncestors[0];
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
accRect.top = max(rect.top, accRect.top);
accRect.right = min(rect.right, accRect.right);
accRect.bottom = min(rect.bottom, accRect.bottom);
accRect.left = max(rect.left, accRect.left);
return accRect;
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
return {
width: clippingRect.right - clippingRect.left,
height: clippingRect.bottom - clippingRect.top,
x: clippingRect.left,
y: clippingRect.top
};
}
function getDimensions(element) {
const {
width,
height
} = getCssDimensions(element);
return {
width,
height
};
}
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
const isOffsetParentAnElement = isHTMLElement(offsetParent);
const documentElement = getDocumentElement(offsetParent);
const isFixed = strategy === "fixed";
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
let scroll = {
scrollLeft: 0,
scrollTop: 0
};
const offsets = createCoords(0);
function setLeftRTLScrollbarOffset() {
offsets.x = getWindowScrollBarX(documentElement);
}
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isOffsetParentAnElement) {
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
offsets.x = offsetRect.x + offsetParent.clientLeft;
offsets.y = offsetRect.y + offsetParent.clientTop;
} else if (documentElement) {
setLeftRTLScrollbarOffset();
}
}
if (isFixed && !isOffsetParentAnElement && documentElement) {
setLeftRTLScrollbarOffset();
}
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
const y3 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
return {
x: x2,
y: y3,
width: rect.width,
height: rect.height
};
}
function isStaticPositioned(element) {
return getComputedStyle2(element).position === "static";
}
function getTrueOffsetParent(element, polyfill) {
if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
return null;
}
if (polyfill) {
return polyfill(element);
}
let rawOffsetParent = element.offsetParent;
if (getDocumentElement(element) === rawOffsetParent) {
rawOffsetParent = rawOffsetParent.ownerDocument.body;
}
return rawOffsetParent;
}
function getOffsetParent(element, polyfill) {
const win = getWindow2(element);
if (isTopLayer(element)) {
return win;
}
if (!isHTMLElement(element)) {
let svgOffsetParent = getParentNode(element);
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
return svgOffsetParent;
}
svgOffsetParent = getParentNode(svgOffsetParent);
}
return win;
}
let offsetParent = getTrueOffsetParent(element, polyfill);
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
}
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
return win;
}
return offsetParent || getContainingBlock(element) || win;
}
var getElementRects = async function(data) {
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
const getDimensionsFn = this.getDimensions;
const floatingDimensions = await getDimensionsFn(data.floating);
return {
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
floating: {
x: 0,
y: 0,
width: floatingDimensions.width,
height: floatingDimensions.height
}
};
};
function isRTL(element) {
return getComputedStyle2(element).direction === "rtl";
}
var platform = {
convertOffsetParentRelativeRectToViewportRelativeRect,
getDocumentElement,
getClippingRect,
getOffsetParent,
getElementRects,
getClientRects,
getDimensions,
getScale,
isElement,
isRTL
};
function rectsAreEqual(a3, b3) {
return a3.x === b3.x && a3.y === b3.y && a3.width === b3.width && a3.height === b3.height;
}
function observeMove(element, onMove) {
let io = null;
let timeoutId;
const root = getDocumentElement(element);
function cleanup() {
var _io;
clearTimeout(timeoutId);
(_io = io) == null || _io.disconnect();
io = null;
}
function refresh(skip, threshold) {
if (skip === void 0) {
skip = false;
}
if (threshold === void 0) {
threshold = 1;
}
cleanup();
const elementRectForRootMargin = element.getBoundingClientRect();
const {
left,
top,
width,
height
} = elementRectForRootMargin;
if (!skip) {
onMove();
}
if (!width || !height) {
return;
}
const insetTop = floor(top);
const insetRight = floor(root.clientWidth - (left + width));
const insetBottom = floor(root.clientHeight - (top + height));
const insetLeft = floor(left);
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
const options2 = {
rootMargin,
threshold: max(0, min(1, threshold)) || 1
};
let isFirstUpdate = true;
function handleObserve(entries) {
const ratio = entries[0].intersectionRatio;
if (ratio !== threshold) {
if (!isFirstUpdate) {
return refresh();
}
if (!ratio) {
timeoutId = setTimeout(() => {
refresh(false, 1e-7);
}, 1e3);
} else {
refresh(false, ratio);
}
}
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
refresh();
}
isFirstUpdate = false;
}
try {
io = new IntersectionObserver(handleObserve, {
...options2,
// Handle