UNPKG

tiptop-editor

Version:

Notion-like editor built with Tiptap v3 and HeroUI

1,712 lines 520 kB
import * as Bt from "react"; import G, { useRef as U, useImperativeHandle as hr, Children as nn, isValidElement as co, useContext as _e, useState as se, useEffect as ee, useMemo as Y, useCallback as W, createContext as si, forwardRef as on, useLayoutEffect as Uc, cloneElement as uo, useId as Wc, memo as Gc } from "react"; import { useCurrentEditor as ii, ReactRenderer as ai, posToDOMRect as Yc, useEditor as qc, EditorContent as Xc } from "@tiptap/react"; import Jc from "@tiptap/starter-kit"; import { BubbleMenuPlugin as Zc } from "@tiptap/extension-bubble-menu"; import li, { flushSync as fo, createPortal as ci } from "react-dom"; import { TextSelection as Ue, Plugin as ft, PluginKey as ot, Selection as Rt, AllSelection as Qc, NodeSelection as Se } from "prosemirror-state"; import "prosemirror-view"; import "prosemirror-keymap"; import { RemoveMarkStep as eu, Transform as tu, liftTarget as ru, joinPoint as ui, canSplit as _r, ReplaceStep as nu, ReplaceAroundStep as ou, canJoin as di } from "prosemirror-transform"; import { Fragment as Ft, Slice as su, Node as iu, Schema as au, DOMParser as vn } from "prosemirror-model"; import { createParagraphNear as lu, deleteSelection as cu, exitCode as uu, joinUp as du, joinDown as fu, joinBackward as pu, joinForward as hu, joinTextblockBackward as mu, joinTextblockForward as gu, lift as bu, liftEmptyBlock as vu, newlineInCode as yu, selectNodeBackward as xu, selectNodeForward as wu, selectParentNode as $u, selectTextblockEnd as ku, selectTextblockStart as Eu, setBlockType as Ko, wrapIn as Pu } from "prosemirror-commands"; import { liftListItem as Su, sinkListItem as Cu, wrapInList as Tu } from "prosemirror-schema-list"; import { flip as fi, shift as pi, offset as Mu, arrow as Au, size as Nu, autoPlacement as Iu, hide as Du, inline as Ou, computePosition as po } from "@floating-ui/dom"; import { icons as Lu } from "lucide-react"; import { LazyMotion as Vr, AnimatePresence as ho, m as Ur } from "framer-motion"; import Ru from "@tiptap/extension-code-block-lowlight"; import { createLowlight as Fu, all as ju } from "lowlight"; import Ku from "@tiptap/extension-horizontal-rule"; import _u from "@tiptap/extension-drag-handle-react"; import hi from "@tiptap/suggestion"; import { Placeholder as zu } from "@tiptap/extensions"; import { ListKit as Bu } from "@tiptap/extension-list"; import { TextStyle as Hu, Color as Vu } from "@tiptap/extension-text-style"; import Uu from "@tiptap/extension-highlight"; import Wu from "@tiptap/extension-subscript"; import Gu from "@tiptap/extension-superscript"; import Yu, { gitHubEmojis as qu } from "@tiptap/extension-emoji"; var $r = { exports: {} }, Qt = {}; /** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var _o; function Xu() { if (_o) return Qt; _o = 1; var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment"); function r(n, o, s) { var i = null; if (s !== void 0 && (i = "" + s), o.key !== void 0 && (i = "" + o.key), "key" in o) { s = {}; for (var a in o) a !== "key" && (s[a] = o[a]); } else s = o; return o = s.ref, { $$typeof: e, type: n, key: i, ref: o !== void 0 ? o : null, props: s }; } return Qt.Fragment = t, Qt.jsx = r, Qt.jsxs = r, Qt; } var er = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var zo; function Ju() { return zo || (zo = 1, process.env.NODE_ENV !== "production" && function() { function e(P) { if (P == null) return null; if (typeof P == "function") return P.$$typeof === j ? null : P.displayName || P.name || null; if (typeof P == "string") return P; switch (P) { case h: return "Fragment"; case v: return "Profiler"; case b: return "StrictMode"; case M: return "Suspense"; case A: return "SuspenseList"; case F: return "Activity"; } if (typeof P == "object") switch (typeof P.tag == "number" && console.error( "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." ), P.$$typeof) { case m: return "Portal"; case T: return (P.displayName || "Context") + ".Provider"; case k: return (P._context.displayName || "Context") + ".Consumer"; case I: var R = P.render; return P = P.displayName, P || (P = R.displayName || R.name || "", P = P !== "" ? "ForwardRef(" + P + ")" : "ForwardRef"), P; case L: return R = P.displayName || null, R !== null ? R : e(P.type) || "Memo"; case N: R = P._payload, P = P._init; try { return e(P(R)); } catch { } } return null; } function t(P) { return "" + P; } function r(P) { try { t(P); var R = !1; } catch { R = !0; } if (R) { R = console; var _ = R.error, z = typeof Symbol == "function" && Symbol.toStringTag && P[Symbol.toStringTag] || P.constructor.name || "Object"; return _.call( R, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", z ), t(P); } } function n(P) { if (P === h) return "<>"; if (typeof P == "object" && P !== null && P.$$typeof === N) return "<...>"; try { var R = e(P); return R ? "<" + R + ">" : "<...>"; } catch { return "<...>"; } } function o() { var P = y.A; return P === null ? null : P.getOwner(); } function s() { return Error("react-stack-top-frame"); } function i(P) { if (C.call(P, "key")) { var R = Object.getOwnPropertyDescriptor(P, "key").get; if (R && R.isReactWarning) return !1; } return P.key !== void 0; } function a(P, R) { function _() { D || (D = !0, console.error( "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", R )); } _.isReactWarning = !0, Object.defineProperty(P, "key", { get: _, configurable: !0 }); } function l() { var P = e(this.type); return x[P] || (x[P] = !0, console.error( "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." )), P = this.props.ref, P !== void 0 ? P : null; } function c(P, R, _, z, B, re, ne, X) { return _ = re.ref, P = { $$typeof: p, type: P, key: R, props: re, _owner: B }, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(P, "ref", { enumerable: !1, get: l }) : Object.defineProperty(P, "ref", { enumerable: !1, value: null }), P._store = {}, Object.defineProperty(P._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: 0 }), Object.defineProperty(P, "_debugInfo", { configurable: !1, enumerable: !1, writable: !0, value: null }), Object.defineProperty(P, "_debugStack", { configurable: !1, enumerable: !1, writable: !0, value: ne }), Object.defineProperty(P, "_debugTask", { configurable: !1, enumerable: !1, writable: !0, value: X }), Object.freeze && (Object.freeze(P.props), Object.freeze(P)), P; } function u(P, R, _, z, B, re, ne, X) { var J = R.children; if (J !== void 0) if (z) if (O(J)) { for (z = 0; z < J.length; z++) d(J[z]); Object.freeze && Object.freeze(J); } else console.error( "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." ); else d(J); if (C.call(R, "key")) { J = e(P); var ie = Object.keys(R).filter(function(fe) { return fe !== "key"; }); z = 0 < ie.length ? "{key: someKey, " + ie.join(": ..., ") + ": ...}" : "{key: someKey}", S[J + z] || (ie = 0 < ie.length ? "{" + ie.join(": ..., ") + ": ...}" : "{}", console.error( `A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, z, J, ie, J ), S[J + z] = !0); } if (J = null, _ !== void 0 && (r(_), J = "" + _), i(R) && (r(R.key), J = "" + R.key), "key" in R) { _ = {}; for (var oe in R) oe !== "key" && (_[oe] = R[oe]); } else _ = R; return J && a( _, typeof P == "function" ? P.displayName || P.name || "Unknown" : P ), c( P, J, re, B, o(), _, ne, X ); } function d(P) { typeof P == "object" && P !== null && P.$$typeof === p && P._store && (P._store.validated = 1); } var f = G, p = Symbol.for("react.transitional.element"), m = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), b = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), k = Symbol.for("react.consumer"), T = Symbol.for("react.context"), I = Symbol.for("react.forward_ref"), M = Symbol.for("react.suspense"), A = Symbol.for("react.suspense_list"), L = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), F = Symbol.for("react.activity"), j = Symbol.for("react.client.reference"), y = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, C = Object.prototype.hasOwnProperty, O = Array.isArray, E = console.createTask ? console.createTask : function() { return null; }; f = { react_stack_bottom_frame: function(P) { return P(); } }; var D, x = {}, w = f.react_stack_bottom_frame.bind( f, s )(), $ = E(n(s)), S = {}; er.Fragment = h, er.jsx = function(P, R, _, z, B) { var re = 1e4 > y.recentlyCreatedOwnerStacks++; return u( P, R, _, !1, z, B, re ? Error("react-stack-top-frame") : w, re ? E(n(P)) : $ ); }, er.jsxs = function(P, R, _, z, B) { var re = 1e4 > y.recentlyCreatedOwnerStacks++; return u( P, R, _, !0, z, B, re ? Error("react-stack-top-frame") : w, re ? E(n(P)) : $ ); }; }()), er; } var Bo; function Zu() { return Bo || (Bo = 1, process.env.NODE_ENV === "production" ? $r.exports = Xu() : $r.exports = Ju()), $r.exports; } var g = Zu(); function mr(e = {}) { const { strict: t = !0, errorMessage: r = "useContext: `context` is undefined. Seems you forgot to wrap component within the Provider", name: n } = e, o = Bt.createContext(void 0); o.displayName = n; function s() { var i; const a = Bt.useContext(o); if (!a && t) { const l = new Error(r); throw l.name = "ContextError", (i = Error.captureStackTrace) == null || i.call(Error, l, s), l; } return a; } return [o.Provider, s, o]; } function Qu(e) { return { UNSAFE_getDOMNode() { return e.current; } }; } function Wt(e) { const t = U(null); return hr(e, () => t.current), t; } process.env.NODE_ENV; process.env.NODE_ENV; function mo(e) { return Array.isArray(e); } function ed(e) { return mo(e) && e.length === 0; } function mi(e) { const t = typeof e; return e != null && (t === "object" || t === "function") && !mo(e); } function td(e) { return mi(e) && Object.keys(e).length === 0; } function rd(e) { return mo(e) ? ed(e) : mi(e) ? td(e) : e == null || e === ""; } function nd(e) { return typeof e == "function"; } var Q = (e) => e ? "true" : void 0; function gi(e) { var t, r, n = ""; if (typeof e == "string" || typeof e == "number") n += e; else if (typeof e == "object") if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (r = gi(e[t])) && (n && (n += " "), n += r); else for (t in e) e[t] && (n && (n += " "), n += t); return n; } function ge(...e) { for (var t = 0, r, n, o = ""; t < e.length; ) (r = e[t++]) && (n = gi(r)) && (o && (o += " "), o += n); return o; } var od = (e) => e ? e.charAt(0).toUpperCase() + e.slice(1).toLowerCase() : ""; function sd(e) { return `${e}-${Math.floor(Math.random() * 1e6)}`; } function bi(e) { for (const t in e) t.startsWith("on") && delete e[t]; return e; } function pt(e) { if (!e || typeof e != "object") return ""; try { return JSON.stringify(e); } catch { return ""; } } function id(e, t, r) { return Math.min(Math.max(e, t), r); } var Ho = {}; function ad(e, t, ...r) { const o = `[Hero UI] : ${e}`; if (!(typeof console > "u") && !Ho[o] && (Ho[o] = !0, process.env.NODE_ENV !== "production")) return console.warn(o, r); } function go(...e) { return (...t) => { for (let r of e) typeof r == "function" && r(...t); }; } var Vo = /* @__PURE__ */ new Map(); function ld(e, t) { if (e === t) return e; let r = Vo.get(e); if (r) return r.forEach((o) => o.current = t), t; let n = Vo.get(t); return n ? (n.forEach((o) => o.current = e), e) : t; } function ue(...e) { let t = { ...e[0] }; for (let r = 1; r < e.length; r++) { let n = e[r]; for (let o in n) { let s = t[o], i = n[o]; typeof s == "function" && typeof i == "function" && // This is a lot faster than a regex. o[0] === "o" && o[1] === "n" && o.charCodeAt(2) >= /* 'A' */ 65 && o.charCodeAt(2) <= /* 'Z' */ 90 ? t[o] = go(s, i) : (o === "className" || o === "UNSAFE_className") && typeof s == "string" && typeof i == "string" ? t[o] = ge(s, i) : o === "id" && s && i ? t.id = ld(s, i) : t[o] = i !== void 0 ? i : s; } } return t; } function cd(...e) { return e.length === 1 && e[0] ? e[0] : (t) => { let r = !1; const n = e.map((o) => { const s = Uo(o, t); return r || (r = typeof s == "function"), s; }); if (r) return () => { n.forEach((o, s) => { typeof o == "function" ? o?.() : Uo(e[s], null); }); }; }; } function Uo(e, t) { if (typeof e == "function") return () => e(t); e != null && "current" in e && (e.current = t); } function ud(e, t) { if (e != null) { if (nd(e)) { e(t); return; } try { e.current = t; } catch { throw new Error(`Cannot assign value '${t}' to ref '${e}'`); } } } function vi(...e) { return (t) => { e.forEach((r) => ud(r, t)); }; } var dd = (e, t) => { var r; let n = []; const o = (r = nn.map(e, (i) => co(i) && i.type === t ? (n.push(i), null) : i)) == null ? void 0 : r.filter(Boolean), s = n.length >= 0 ? n : void 0; return [o, s]; }, fd = /* @__PURE__ */ new Set([ "id", "type", "style", "title", "role", "tabIndex", "htmlFor", "width", "height", "abbr", "accept", "acceptCharset", "accessKey", "action", "allowFullScreen", "allowTransparency", "alt", "async", "autoComplete", "autoFocus", "autoPlay", "cellPadding", "cellSpacing", "challenge", "charset", "checked", "cite", "class", "className", "cols", "colSpan", "command", "content", "contentEditable", "contextMenu", "controls", "coords", "crossOrigin", "data", "dateTime", "default", "defer", "dir", "disabled", "download", "draggable", "dropzone", "encType", "enterKeyHint", "for", "form", "formAction", "formEncType", "formMethod", "formNoValidate", "formTarget", "frameBorder", "headers", "hidden", "high", "href", "hrefLang", "httpEquiv", "icon", "inputMode", "isMap", "itemId", "itemProp", "itemRef", "itemScope", "itemType", "kind", "label", "lang", "list", "loop", "manifest", "max", "maxLength", "media", "mediaGroup", "method", "min", "minLength", "multiple", "muted", "name", "noValidate", "open", "optimum", "pattern", "ping", "placeholder", "poster", "preload", "radioGroup", "referrerPolicy", "readOnly", "rel", "required", "rows", "rowSpan", "sandbox", "scope", "scoped", "scrolling", "seamless", "selected", "shape", "size", "sizes", "slot", "sortable", "span", "spellCheck", "src", "srcDoc", "srcSet", "start", "step", "target", "translate", "typeMustMatch", "useMap", "value", "wmode", "wrap" ]), pd = /* @__PURE__ */ new Set([ "onCopy", "onCut", "onPaste", "onLoad", "onError", "onWheel", "onScroll", "onCompositionEnd", "onCompositionStart", "onCompositionUpdate", "onKeyDown", "onKeyPress", "onKeyUp", "onFocus", "onBlur", "onChange", "onInput", "onSubmit", "onClick", "onContextMenu", "onDoubleClick", "onDrag", "onDragEnd", "onDragEnter", "onDragExit", "onDragLeave", "onDragOver", "onDragStart", "onDrop", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseMove", "onMouseOut", "onMouseOver", "onMouseUp", "onPointerDown", "onPointerEnter", "onPointerLeave", "onPointerUp", "onSelect", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart", "onAnimationStart", "onAnimationEnd", "onAnimationIteration", "onTransitionEnd" ]), Wo = /^(data-.*)$/, hd = /^(aria-.*)$/, kr = /^(on[A-Z].*)$/; function Xe(e, t = {}) { let { labelable: r = !0, enabled: n = !0, propNames: o, omitPropNames: s, omitEventNames: i, omitDataProps: a, omitEventProps: l } = t, c = {}; if (!n) return e; for (const u in e) s?.has(u) || i?.has(u) && kr.test(u) || kr.test(u) && !pd.has(u) || a && Wo.test(u) || l && kr.test(u) || (Object.prototype.hasOwnProperty.call(e, u) && (fd.has(u) || r && hd.test(u) || o?.has(u) || Wo.test(u)) || kr.test(u)) && (c[u] = e[u]); return c; } var [ky, Je] = mr({ name: "ProviderContext", strict: !1 }); const md = /* @__PURE__ */ new Set([ "Arab", "Syrc", "Samr", "Mand", "Thaa", "Mend", "Nkoo", "Adlm", "Rohg", "Hebr" ]), gd = /* @__PURE__ */ new Set([ "ae", "ar", "arc", "bcc", "bqi", "ckb", "dv", "fa", "glk", "he", "ku", "mzn", "nqo", "pnb", "ps", "sd", "ug", "ur", "yi" ]); function bd(e) { if (Intl.Locale) { let r = new Intl.Locale(e).maximize(), n = typeof r.getTextInfo == "function" ? r.getTextInfo() : r.textInfo; if (n) return n.direction === "rtl"; if (r.script) return md.has(r.script); } let t = e.split("-")[0]; return gd.has(t); } const Wr = { prefix: String(Math.round(Math.random() * 1e10)), current: 0 }, yi = /* @__PURE__ */ G.createContext(Wr), vd = /* @__PURE__ */ G.createContext(!1); let yd = !!(typeof window < "u" && window.document && window.document.createElement), yn = /* @__PURE__ */ new WeakMap(); function xd(e = !1) { let t = _e(yi), r = U(null); if (r.current === null && !e) { var n, o; let s = (o = G.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || o === void 0 || (n = o.ReactCurrentOwner) === null || n === void 0 ? void 0 : n.current; if (s) { let i = yn.get(s); i == null ? yn.set(s, { id: t.current, state: s.memoizedState }) : s.memoizedState !== i.state && (t.current = i.id, yn.delete(s)); } r.current = ++t.current; } return r.current; } function wd(e) { let t = _e(yi); t === Wr && !yd && process.env.NODE_ENV !== "production" && console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server."); let r = xd(!!e), n = t === Wr && process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${t.prefix}`; return e || `${n}-${r}`; } function $d(e) { let t = G.useId(), [r] = se(gr()), n = r || process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${Wr.prefix}`; return e || `${n}-${t}`; } const kd = typeof G.useId == "function" ? $d : wd; function Ed() { return !1; } function Pd() { return !0; } function Sd(e) { return () => { }; } function gr() { return typeof G.useSyncExternalStore == "function" ? G.useSyncExternalStore(Sd, Ed, Pd) : _e(vd); } const Cd = Symbol.for("react-aria.i18n.locale"); function xi() { let e = typeof window < "u" && window[Cd] || typeof navigator < "u" && (navigator.language || navigator.userLanguage) || "en-US"; try { Intl.DateTimeFormat.supportedLocalesOf([ e ]); } catch { e = "en-US"; } return { locale: e, direction: bd(e) ? "rtl" : "ltr" }; } let Fn = xi(), sr = /* @__PURE__ */ new Set(); function Go() { Fn = xi(); for (let e of sr) e(Fn); } function Td() { let e = gr(), [t, r] = se(Fn); return ee(() => (sr.size === 0 && window.addEventListener("languagechange", Go), sr.add(r), () => { sr.delete(r), sr.size === 0 && window.removeEventListener("languagechange", Go); }), []), e ? { locale: "en-US", direction: "ltr" } : t; } const Md = /* @__PURE__ */ G.createContext(null); function sn() { let e = Td(); return _e(Md) || e; } const Ad = Symbol.for("react-aria.i18n.locale"), Nd = Symbol.for("react-aria.i18n.strings"); let Mt; class an { /** Returns a localized string for the given key and locale. */ getStringForLocale(t, r) { let o = this.getStringsForLocale(r)[t]; if (!o) throw new Error(`Could not find intl message ${t} in ${r} locale`); return o; } /** Returns all localized strings for the given locale. */ getStringsForLocale(t) { let r = this.strings[t]; return r || (r = Id(t, this.strings, this.defaultLocale), this.strings[t] = r), r; } static getGlobalDictionaryForPackage(t) { if (typeof window > "u") return null; let r = window[Ad]; if (Mt === void 0) { let o = window[Nd]; if (!o) return null; Mt = {}; for (let s in o) Mt[s] = new an({ [r]: o[s] }, r); } let n = Mt?.[t]; if (!n) throw new Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`); return n; } constructor(t, r = "en-US") { this.strings = Object.fromEntries(Object.entries(t).filter(([, n]) => n)), this.defaultLocale = r; } } function Id(e, t, r = "en-US") { if (t[e]) return t[e]; let n = Dd(e); if (t[n]) return t[n]; for (let o in t) if (o.startsWith(n + "-")) return t[o]; return t[r]; } function Dd(e) { return Intl.Locale ? new Intl.Locale(e).language : e.split("-")[0]; } const Yo = /* @__PURE__ */ new Map(), qo = /* @__PURE__ */ new Map(); class Od { /** Formats a localized string for the given key with the provided variables. */ format(t, r) { let n = this.strings.getStringForLocale(t, this.locale); return typeof n == "function" ? n(r, this) : n; } plural(t, r, n = "cardinal") { let o = r["=" + t]; if (o) return typeof o == "function" ? o() : o; let s = this.locale + ":" + n, i = Yo.get(s); i || (i = new Intl.PluralRules(this.locale, { type: n }), Yo.set(s, i)); let a = i.select(t); return o = r[a] || r.other, typeof o == "function" ? o() : o; } number(t) { let r = qo.get(this.locale); return r || (r = new Intl.NumberFormat(this.locale), qo.set(this.locale, r)), r.format(t); } select(t, r) { let n = t[r] || t.other; return typeof n == "function" ? n() : n; } constructor(t, r) { this.locale = t, this.strings = r; } } const Xo = /* @__PURE__ */ new WeakMap(); function Ld(e) { let t = Xo.get(e); return t || (t = new an(e), Xo.set(e, t)), t; } function Rd(e, t) { return t && an.getGlobalDictionaryForPackage(t) || Ld(e); } function wi(e, t) { let { locale: r } = sn(), n = Rd(e, t); return Y(() => new Od(r, n), [ r, n ]); } function Fd(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); } function jd(e, t, r) { Fd(e, t), t.set(e, r); } const me = typeof document < "u" ? G.useLayoutEffect : () => { }; var xn; const Kd = (xn = G.useInsertionEffect) !== null && xn !== void 0 ? xn : me; function Ae(e) { const t = U(null); return Kd(() => { t.current = e; }, [ e ]), W((...r) => { const n = t.current; return n?.(...r); }, []); } function _d(e) { let [t, r] = se(e), n = U(null), o = Ae(() => { if (!n.current) return; let i = n.current.next(); if (i.done) { n.current = null; return; } t === i.value ? o() : r(i.value); }); me(() => { n.current && o(); }); let s = Ae((i) => { n.current = i(t), o(); }); return [ t, s ]; } let zd = !!(typeof window < "u" && window.document && window.document.createElement), jt = /* @__PURE__ */ new Map(), ir; typeof FinalizationRegistry < "u" && (ir = new FinalizationRegistry((e) => { jt.delete(e); })); function je(e) { let [t, r] = se(e), n = U(null), o = kd(t), s = U(null); if (ir && ir.register(s, o), zd) { const i = jt.get(o); i && !i.includes(n) ? i.push(n) : jt.set(o, [ n ]); } return me(() => { let i = o; return () => { ir && ir.unregister(s), jt.delete(i); }; }, [ o ]), ee(() => { let i = n.current; return i && r(i), () => { i && (n.current = null); }; }), o; } function Bd(e, t) { if (e === t) return e; let r = jt.get(e); if (r) return r.forEach((o) => o.current = t), t; let n = jt.get(t); return n ? (n.forEach((o) => o.current = e), e) : t; } function Kt(e = []) { let t = je(), [r, n] = _d(t), o = W(() => { n(function* () { yield t, yield document.getElementById(t) ? t : void 0; }); }, [ t, n ]); return me(o, [ t, o, ...e ]), r; } function kt(...e) { return (...t) => { for (let r of e) typeof r == "function" && r(...t); }; } const ce = (e) => { var t; return (t = e?.ownerDocument) !== null && t !== void 0 ? t : document; }, Fe = (e) => e && "window" in e && e.window === e ? e : ce(e).defaultView || window; function Hd(e) { return e !== null && typeof e == "object" && "nodeType" in e && typeof e.nodeType == "number"; } function Vd(e) { return Hd(e) && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in e; } let Ud = !1; function ln() { return Ud; } function he(e, t) { if (!ln()) return t && e ? e.contains(t) : !1; if (!e || !t) return !1; let r = t; for (; r !== null; ) { if (r === e) return !0; r.tagName === "SLOT" && r.assignedSlot ? r = r.assignedSlot.parentNode : Vd(r) ? r = r.host : r = r.parentNode; } return !1; } const Ce = (e = document) => { var t; if (!ln()) return e.activeElement; let r = e.activeElement; for (; r && "shadowRoot" in r && (!((t = r.shadowRoot) === null || t === void 0) && t.activeElement); ) r = r.shadowRoot.activeElement; return r; }; function le(e) { return ln() && e.target.shadowRoot && e.composedPath ? e.composedPath()[0] : e.target; } class Wd { get currentNode() { return this._currentNode; } set currentNode(t) { if (!he(this.root, t)) throw new Error("Cannot set currentNode to a node that is not contained by the root node."); const r = []; let n = t, o = t; for (this._currentNode = t; n && n !== this.root; ) if (n.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { const i = n, a = this._doc.createTreeWalker(i, this.whatToShow, { acceptNode: this._acceptNode }); r.push(a), a.currentNode = o, this._currentSetFor.add(a), n = o = i.host; } else n = n.parentNode; const s = this._doc.createTreeWalker(this.root, this.whatToShow, { acceptNode: this._acceptNode }); r.push(s), s.currentNode = o, this._currentSetFor.add(s), this._walkerStack = r; } get doc() { return this._doc; } firstChild() { let t = this.currentNode, r = this.nextNode(); return he(t, r) ? (r && (this.currentNode = r), r) : (this.currentNode = t, null); } lastChild() { let r = this._walkerStack[0].lastChild(); return r && (this.currentNode = r), r; } nextNode() { const t = this._walkerStack[0].nextNode(); if (t) { if (t.shadowRoot) { var r; let o; if (typeof this.filter == "function" ? o = this.filter(t) : !((r = this.filter) === null || r === void 0) && r.acceptNode && (o = this.filter.acceptNode(t)), o === NodeFilter.FILTER_ACCEPT) return this.currentNode = t, t; let s = this.nextNode(); return s && (this.currentNode = s), s; } return t && (this.currentNode = t), t; } else if (this._walkerStack.length > 1) { this._walkerStack.shift(); let n = this.nextNode(); return n && (this.currentNode = n), n; } else return null; } previousNode() { const t = this._walkerStack[0]; if (t.currentNode === t.root) { if (this._currentSetFor.has(t)) if (this._currentSetFor.delete(t), this._walkerStack.length > 1) { this._walkerStack.shift(); let o = this.previousNode(); return o && (this.currentNode = o), o; } else return null; return null; } const r = t.previousNode(); if (r) { if (r.shadowRoot) { var n; let s; if (typeof this.filter == "function" ? s = this.filter(r) : !((n = this.filter) === null || n === void 0) && n.acceptNode && (s = this.filter.acceptNode(r)), s === NodeFilter.FILTER_ACCEPT) return r && (this.currentNode = r), r; let i = this.lastChild(); return i && (this.currentNode = i), i; } return r && (this.currentNode = r), r; } else if (this._walkerStack.length > 1) { this._walkerStack.shift(); let o = this.previousNode(); return o && (this.currentNode = o), o; } else return null; } /** * @deprecated */ nextSibling() { return null; } /** * @deprecated */ previousSibling() { return null; } /** * @deprecated */ parentNode() { return null; } constructor(t, r, n, o) { this._walkerStack = [], this._currentSetFor = /* @__PURE__ */ new Set(), this._acceptNode = (i) => { if (i.nodeType === Node.ELEMENT_NODE) { const l = i.shadowRoot; if (l) { const c = this._doc.createTreeWalker(l, this.whatToShow, { acceptNode: this._acceptNode }); return this._walkerStack.unshift(c), NodeFilter.FILTER_ACCEPT; } else { var a; if (typeof this.filter == "function") return this.filter(i); if (!((a = this.filter) === null || a === void 0) && a.acceptNode) return this.filter.acceptNode(i); if (this.filter === null) return NodeFilter.FILTER_ACCEPT; } } return NodeFilter.FILTER_SKIP; }, this._doc = t, this.root = r, this.filter = o ?? null, this.whatToShow = n ?? NodeFilter.SHOW_ALL, this._currentNode = r, this._walkerStack.unshift(t.createTreeWalker(r, n, this._acceptNode)); const s = r.shadowRoot; if (s) { const i = this._doc.createTreeWalker(s, this.whatToShow, { acceptNode: this._acceptNode }); this._walkerStack.unshift(i); } } } function Gd(e, t, r, n) { return ln() ? new Wd(e, t, r, n) : e.createTreeWalker(t, r, n); } function $i(e) { var t, r, n = ""; if (typeof e == "string" || typeof e == "number") n += e; else if (typeof e == "object") if (Array.isArray(e)) { var o = e.length; for (t = 0; t < o; t++) e[t] && (r = $i(e[t])) && (n && (n += " "), n += r); } else for (r in e) e[r] && (n && (n += " "), n += r); return n; } function Yd() { for (var e, t, r = 0, n = "", o = arguments.length; r < o; r++) (e = arguments[r]) && (t = $i(e)) && (n && (n += " "), n += t); return n; } function ke(...e) { let t = { ...e[0] }; for (let r = 1; r < e.length; r++) { let n = e[r]; for (let o in n) { let s = t[o], i = n[o]; typeof s == "function" && typeof i == "function" && // This is a lot faster than a regex. o[0] === "o" && o[1] === "n" && o.charCodeAt(2) >= /* 'A' */ 65 && o.charCodeAt(2) <= /* 'Z' */ 90 ? t[o] = kt(s, i) : (o === "className" || o === "UNSAFE_className") && typeof s == "string" && typeof i == "string" ? t[o] = Yd(s, i) : o === "id" && s && i ? t.id = Bd(s, i) : t[o] = i !== void 0 ? i : s; } } return t; } const qd = /* @__PURE__ */ new Set([ "id" ]), Xd = /* @__PURE__ */ new Set([ "aria-label", "aria-labelledby", "aria-describedby", "aria-details" ]), Jd = /* @__PURE__ */ new Set([ "href", "hrefLang", "target", "rel", "download", "ping", "referrerPolicy" ]), Zd = /* @__PURE__ */ new Set([ "dir", "lang", "hidden", "inert", "translate" ]), Jo = /* @__PURE__ */ new Set([ "onClick", "onAuxClick", "onContextMenu", "onDoubleClick", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseMove", "onMouseOut", "onMouseOver", "onMouseUp", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart", "onPointerDown", "onPointerMove", "onPointerUp", "onPointerCancel", "onPointerEnter", "onPointerLeave", "onPointerOver", "onPointerOut", "onGotPointerCapture", "onLostPointerCapture", "onScroll", "onWheel", "onAnimationStart", "onAnimationEnd", "onAnimationIteration", "onTransitionCancel", "onTransitionEnd", "onTransitionRun", "onTransitionStart" ]), Qd = /^(data-.*)$/; function Ct(e, t = {}) { let { labelable: r, isLink: n, global: o, events: s = o, propNames: i } = t, a = {}; for (const l in e) Object.prototype.hasOwnProperty.call(e, l) && (qd.has(l) || r && Xd.has(l) || n && Jd.has(l) || o && Zd.has(l) || s && Jo.has(l) || l.endsWith("Capture") && Jo.has(l.slice(0, -7)) || i?.has(l) || Qd.test(l)) && (a[l] = e[l]); return a; } function We(e) { if (ef()) e.focus({ preventScroll: !0 }); else { let t = tf(e); e.focus(), rf(t); } } let Er = null; function ef() { if (Er == null) { Er = !1; try { document.createElement("div").focus({ get preventScroll() { return Er = !0, !0; } }); } catch { } } return Er; } function tf(e) { let t = e.parentNode, r = [], n = document.scrollingElement || document.documentElement; for (; t instanceof HTMLElement && t !== n; ) (t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && r.push({ element: t, scrollTop: t.scrollTop, scrollLeft: t.scrollLeft }), t = t.parentNode; return n instanceof HTMLElement && r.push({ element: n, scrollTop: n.scrollTop, scrollLeft: n.scrollLeft }), r; } function rf(e) { for (let { element: t, scrollTop: r, scrollLeft: n } of e) t.scrollTop = r, t.scrollLeft = n; } function cn(e) { var t; if (typeof window > "u" || window.navigator == null) return !1; let r = (t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands; return Array.isArray(r) && r.some((n) => e.test(n.brand)) || e.test(window.navigator.userAgent); } function bo(e) { var t; return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1; } function st(e) { if (process.env.NODE_ENV === "test") return e; let t = null; return () => (t == null && (t = e()), t); } const ut = st(function() { return bo(/^Mac/i); }), nf = st(function() { return bo(/^iPhone/i); }), ki = st(function() { return bo(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support. ut() && navigator.maxTouchPoints > 1; }), un = st(function() { return nf() || ki(); }), of = st(function() { return ut() || un(); }), vo = st(function() { return cn(/AppleWebKit/i) && !Ei(); }), Ei = st(function() { return cn(/Chrome/i); }), yo = st(function() { return cn(/Android/i); }), sf = st(function() { return cn(/Firefox/i); }), af = /* @__PURE__ */ si({ isNative: !0, open: uf, useHref: (e) => e }); function dn() { return _e(af); } function lf(e, t) { let r = e.getAttribute("target"); return (!r || r === "_self") && e.origin === location.origin && !e.hasAttribute("download") && !t.metaKey && // open in new tab (mac) !t.ctrlKey && // open in new tab (windows) !t.altKey && // download !t.shiftKey; } function Et(e, t, r = !0) { var n, o; let { metaKey: s, ctrlKey: i, altKey: a, shiftKey: l } = t; sf() && (!((o = window.event) === null || o === void 0 || (n = o.type) === null || n === void 0) && n.startsWith("key")) && e.target === "_blank" && (ut() ? s = !0 : i = !0); let c = vo() && ut() && !ki() && process.env.NODE_ENV !== "test" ? new KeyboardEvent("keydown", { keyIdentifier: "Enter", metaKey: s, ctrlKey: i, altKey: a, shiftKey: l }) : new MouseEvent("click", { metaKey: s, ctrlKey: i, altKey: a, shiftKey: l, bubbles: !0, cancelable: !0 }); Et.isOpening = r, We(e), e.dispatchEvent(c), Et.isOpening = !1; } Et.isOpening = !1; function cf(e, t) { if (e instanceof HTMLAnchorElement) t(e); else if (e.hasAttribute("data-href")) { let r = document.createElement("a"); r.href = e.getAttribute("data-href"), e.hasAttribute("data-target") && (r.target = e.getAttribute("data-target")), e.hasAttribute("data-rel") && (r.rel = e.getAttribute("data-rel")), e.hasAttribute("data-download") && (r.download = e.getAttribute("data-download")), e.hasAttribute("data-ping") && (r.ping = e.getAttribute("data-ping")), e.hasAttribute("data-referrer-policy") && (r.referrerPolicy = e.getAttribute("data-referrer-policy")), e.appendChild(r), t(r), e.removeChild(r); } } function uf(e, t) { cf(e, (r) => Et(r, t)); } function Pi(e) { let t = dn(); var r; const n = t.useHref((r = e?.href) !== null && r !== void 0 ? r : ""); return { href: e?.href ? n : void 0, target: e?.target, rel: e?.rel, download: e?.download, ping: e?.ping, referrerPolicy: e?.referrerPolicy }; } function df(e, t, r, n) { !t.isNative && e.currentTarget instanceof HTMLAnchorElement && e.currentTarget.href && // If props are applied to a router Link component, it may have already prevented default. !e.isDefaultPrevented() && lf(e.currentTarget, e) && r && (e.preventDefault(), t.open(e.currentTarget, e, r, n)); } let lt = /* @__PURE__ */ new Map(), jn = /* @__PURE__ */ new Set(); function Zo() { if (typeof window > "u") return; function e(n) { return "propertyName" in n; } let t = (n) => { if (!e(n) || !n.target) return; let o = lt.get(n.target); o || (o = /* @__PURE__ */ new Set(), lt.set(n.target, o), n.target.addEventListener("transitioncancel", r, { once: !0 })), o.add(n.propertyName); }, r = (n) => { if (!e(n) || !n.target) return; let o = lt.get(n.target); if (o && (o.delete(n.propertyName), o.size === 0 && (n.target.removeEventListener("transitioncancel", r), lt.delete(n.target)), lt.size === 0)) { for (let s of jn) s(); jn.clear(); } }; document.body.addEventListener("transitionrun", t), document.body.addEventListener("transitionend", r); } typeof document < "u" && (document.readyState !== "loading" ? Zo() : document.addEventListener("DOMContentLoaded", Zo)); function ff() { for (const [e] of lt) "isConnected" in e && !e.isConnected && lt.delete(e); } function Si(e) { requestAnimationFrame(() => { ff(), lt.size === 0 ? e() : jn.add(e); }); } function fn() { let e = U(/* @__PURE__ */ new Map()), t = W((o, s, i, a) => { let l = a?.once ? (...c) => { e.current.delete(i), i(...c); } : i; e.current.set(i, { type: s, eventTarget: o, fn: l, options: a }), o.addEventListener(s, l, a); }, []), r = W((o, s, i, a) => { var l; let c = ((l = e.current.get(i)) === null || l === void 0 ? void 0 : l.fn) || i; o.removeEventListener(s, c, a), e.current.delete(i); }, []), n = W(() => { e.current.forEach((o, s) => { r(o.eventTarget, o.type, s, o.options); }); }, [ r ]); return ee(() => n, [ n ]), { addGlobalListener: t, removeGlobalListener: r, removeAllGlobalListeners: n }; } function Ci(e, t) { let { id: r, "aria-label": n, "aria-labelledby": o } = e; return r = je(r), o && n ? o = [ .../* @__PURE__ */ new Set([ r, ...o.trim().split(/\s+/) ]) ].join(" ") : o && (o = o.trim().split(/\s+/).join(" ")), !n && !o && t && (n = t), { id: r, "aria-label": n, "aria-labelledby": o }; } function Qo(e, t) { const r = U(!0), n = U(null); me(() => (r.current = !0, () => { r.current = !1; }), []), me(() => { r.current ? r.current = !1 : (!n.current || t.some((o, s) => !Object.is(o, n[s]))) && e(), n.current = t; }, t); } function pf() { return typeof window.ResizeObserver < "u"; } function es(e) { const { ref: t, box: r, onResize: n } = e; ee(() => { let o = t?.current; if (o) if (pf()) { const s = new window.ResizeObserver((i) => { i.length && n(); }); return s.observe(o, { box: r }), () => { o && s.unobserve(o); }; } else return window.addEventListener("resize", n, !1), () => { window.removeEventListener("resize", n, !1); }; }, [ n, t, r ]); } function Ti(e, t) { me(() => { if (e && e.ref && t) return e.ref.current = t.current, () => { e.ref && (e.ref.current = null); }; }); } function ur(e, t) { if (!e) return !1; let r = window.getComputedStyle(e), n = /(auto|scroll)/.test(r.overflow + r.overflowX + r.overflowY); return n && t && (n = e.scrollHeight !== e.clientHeight || e.scrollWidth !== e.clientWidth), n; } function Mi(e, t) { let r = e; for (ur(r, t) && (r = r.parentElement); r && !ur(r, t); ) r = r.parentElement; return r || document.scrollingElement || document.documentElement; } function hf(e, t) { const r = []; for (; e && e !== document.documentElement; ) ur(e, t) && r.push(e), e = e.parentElement; return r; } let mf = 0; const wn = /* @__PURE__ */ new Map(); function gf(e) { let [t, r] = se(); return me(() => { if (!e) return; let n = wn.get(e); if (n) r(n.element.id); else { let o = `react-aria-description-${mf++}`; r(o); let s = document.createElement("div"); s.id = o, s.style.display = "none", s.textContent = e, document.body.appendChild(s), n = { refCount: 0, element: s }, wn.set(e, n); } return n.refCount++, () => { n && --n.refCount === 0 && (n.element.remove(), wn.delete(e)); }; }, [ e ]), { "aria-describedby": e ? t : void 0 }; } function Pr(e, t, r, n) { let o = Ae(r), s = r == null; ee(() => { if (s || !e.current) return; let i = e.current; return i.addEventListener(t, o, n), () => { i.removeEventListener(t, o, n); }; }, [ e, t, n, s, o ]); } function Ai(e, t) { let r = ts(e, t, "left"), n = ts(e, t, "top"), o = t.offsetWidth, s = t.offsetHeight, i = e.scrollLeft, a = e.scrollTop, { borderTopWidth: l, borderLeftWidth: c, scrollPaddingTop: u, scrollPaddingRight: d, scrollPaddingBottom: f, scrollPaddingLeft: p } = getComputedStyle(e), m = i + parseInt(c, 10), h = a + parseInt(l, 10), b = m + e.clientWidth, v = h + e.clientHeight, k = parseInt(u, 10) || 0, T = parseInt(f, 10) || 0, I = parseInt(d, 10) || 0, M = parseInt(p, 10) || 0; r <= i + M ? i = r - parseInt(c, 10) - M : r + o > b - I && (i += r + o - b + I), n <= h + k ? a = n - parseInt(l, 10) - k : n + s > v - T && (a += n + s - v + T), e.scrollLeft = i, e.scrollTop = a; } function ts(e, t, r) { const n = r === "left" ? "offsetLeft" : "offsetTop"; let o = 0; for (; t.offsetParent && (o += t[n], t.offsetParent !== e); ) { if (t.offsetParent.contains(e)) { o -= e[n]; break; } t = t.offsetParent; } return o; } function rs(e, t) { if (e && document.contains(e)) { let i = document.scrollingElement || document.documentElement; if (window.getComputedStyle(i).overflow === "hidden") { let l = hf(e); for (let c of l) Ai(c, e); } else { var r; let { left: l, top: c } = e.getBoundingClientRect(); e == null || (r = e.scrollIntoView) === null || r === void 0 || r.call(e, { block: "nearest" }); let { left: u, top: d } = e.getBoundingClientRect(); if (Math.abs(l - u) > 1 || Math.abs(c - d) > 1) { var n, o, s; t == null || (o = t.containingElement) === null || o === void 0 || (n = o.scrollIntoView) === null || n === void 0 || n.call(o, { block: "center", inline: "center" }), (s = e.scrollIntoView) === null || s === void 0 || s.call(e, { block: "nearest" }); } } } } function Kn(e) { return e.mozInputSource === 0 && e.isTrusted ? !0 : yo() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType; } function bf(e) { return !yo() && e.width === 0 && e.height === 0 || e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse"; } const vf = "react-aria-clear-focus", yf = "react-aria-focus"; function Ot(e) { return ut() ? e.metaKey : e.ctrlKey; } const xf = typeof Element < "u" && "checkVisibility" in Element.prototype; function wf(e) { const t = Fe(e); if (!(e instanceof t.HTMLElement) && !(e instanceof t.SVGElement)) return !1; let { display: r, visibility: n } = e.style, o = r !== "none" && n !== "hidden" && n !== "collapse"; if (o) { const { getComputedStyle: s } = e.ownerDocument.defaultView; let { display: i, visibility: a } = s(e); o = i !== "none" && a !== "hidden" && a !== "collapse"; } return o; } function $f(e, t) { return !e.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking. !e.hasAttribute("data-react-aria-prevent-focus") && (e.nodeName === "DETAILS" && t && t.nodeName !== "SUMMARY" ? e.hasAttribute("open") : !0); } function xo(e, t) { return xf ? e.checkVisibility() : e.nodeName !== "#comment" && wf(e) && $f(e, t) && (!e.parentElement || xo(e.parentElement, e)); } const wo = [ "input:not([disabled]):not([type=hidden])", "select:not([disabled])", "textarea:not([disabled])", "button:not([disabled])", "a[href]", "area[href]", "summary", "iframe", "object", "embed", "audio[controls]", "video[controls]", '[contenteditable]:not([contenteditable^="false"])', "permission" ], kf = wo.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])"; wo.push('[tabindex]:not([tabindex="-1"]):not([disabled])'); const Ef = wo.join(':not([hidden]):not([tabindex="-1"]),'); function Ni(e) { return e.matches(kf) && xo(e) && !Ii(e); } function Pf(e) { return e.matches(Ef) && xo(e) && !Ii(e); } function Ii(e) { let t = e; for (; t != null; ) { if (t instanceof t.ownerDocument.defaultView.HTMLElement && t.inert) return !0; t = t.parentElement; } return !1; } function $o(e, t, r) { let [n, o] = se(e || t), s = U(e !== void 0), i = e !== void 0; ee(() => { let c = s.current; c !== i && process.env.NODE_ENV !== "production" && console.warn(`WARN: A component changed from ${c ? "controlled" : "uncontrolled"} to ${i ? "controlled" : "uncontrolled"}.`), s.current = i; }, [ i ]); let a = i ? e : n, l = W((c, ...u) => { let d = (f, ...p) => { r && (Object.is(a, f) || r(f, ...p)), i || (a = f); }; typeof c == "function" ? (process.env.NODE_ENV !== "production" && console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"), o((p, ...m) => { let h = c(i ? a : p, ...m); return d(h, ...u), i ? p : h; })) : (i || o(c), d(c, ...u)); }, [ i, a, r ]); return [ a, l ]; } function _n(e, t = -1 / 0, r = 1 / 0) { return Math.min(Math.max(e, t), r); } let $n = /* @__PURE__ */ new Map(); function Sf(e) { let { locale: t } = sn(), r = t + (e ? Object.entries(e).sort((o, s) => o[0] < s[0] ? -1 : 1).join() : ""); if ($n.has(r)) return $n.get(r); let n = new Intl.Collator(t, e); return $n.set(r, n), n; } const qe = { top: "top", bottom: "top", left: "left", right: "left" }, Gr = { top: "bottom", bottom: "top", left: "right", right: "left" }, Cf = { top: "left", left: "top" }, zn = { top: "height", left: "width" }, Di = { width: "totalWidth", height: "totalHeight" }, Sr = {}; let Ee = typeof document < "u" ? window.visualViewport : null; function ns(e) { let t = 0, r = 0, n = 0, o = 0, s = 0, i = 0, a = {}; var l; let c = ((l = Ee?.scale) !== null && l !== void 0 ? l : 1) > 1; if (e.tagName === "BODY") { let m = document.documentElement; n = m.client