@bazza-ui/react 0.1.0-canary.16 → 0.1.0-canary.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/combobox/index.cjs +1 -1
- package/dist/combobox/index.cjs.map +1 -1
- package/dist/combobox/index.d.ts +842 -834
- package/dist/combobox/index.js +1 -1
- package/dist/combobox/index.js.map +1 -1
- package/dist/command-menu/index.cjs +1 -1
- package/dist/command-menu/index.cjs.map +1 -1
- package/dist/command-menu/index.d.ts +123 -96
- package/dist/command-menu/index.js +1 -1
- package/dist/command-menu/index.js.map +1 -1
- package/dist/context-menu/index.cjs +1 -1
- package/dist/context-menu/index.cjs.map +1 -1
- package/dist/context-menu/index.d.ts +701 -658
- package/dist/context-menu/index.js +1 -1
- package/dist/context-menu/index.js.map +1 -1
- package/dist/dropdown-menu/index.cjs +1 -1
- package/dist/dropdown-menu/index.cjs.map +1 -1
- package/dist/dropdown-menu/index.d.ts +723 -680
- package/dist/dropdown-menu/index.js +1 -1
- package/dist/dropdown-menu/index.js.map +1 -1
- package/dist/events-DDOsDu4X.d.ts +2091 -0
- package/dist/index-Cabqj7qI.d.ts +2003 -0
- package/dist/index-D8OrKThQ.d.ts +977 -0
- package/dist/internal/listbox/index.cjs +1 -2
- package/dist/internal/listbox/index.d.ts +2 -272
- package/dist/internal/listbox/index.js +1 -2
- package/dist/internal/popup-menu/index.cjs +1 -2
- package/dist/internal/popup-menu/index.d.ts +4 -238
- package/dist/internal/popup-menu/index.js +1 -2
- package/dist/items-CD2hw6-3.js +2 -0
- package/dist/items-CD2hw6-3.js.map +1 -0
- package/dist/items-DYDljwnt.cjs +2 -0
- package/dist/items-DYDljwnt.cjs.map +1 -0
- package/dist/{items-B6HeFO_8.d.cts → items-ceX--VIv.d.ts} +21 -19
- package/dist/kbd/index.cjs +1 -1
- package/dist/kbd/index.cjs.map +1 -1
- package/dist/kbd/index.d.ts +35 -35
- package/dist/kbd/index.js +1 -1
- package/dist/kbd/index.js.map +1 -1
- package/dist/listbox-CnwUlLZA.js +2 -0
- package/dist/listbox-CnwUlLZA.js.map +1 -0
- package/dist/listbox-DYvJTiF6.cjs +2 -0
- package/dist/listbox-DYvJTiF6.cjs.map +1 -0
- package/dist/loaders/index.cjs +1 -1
- package/dist/loaders/index.cjs.map +1 -1
- package/dist/loaders/index.d.ts +218 -188
- package/dist/loaders/index.js +1 -1
- package/dist/loaders/index.js.map +1 -1
- package/dist/merge-element-props-0mpNO7ZH.cjs +2 -0
- package/dist/merge-element-props-0mpNO7ZH.cjs.map +1 -0
- package/dist/merge-element-props-PxUvRHax.js +2 -0
- package/dist/merge-element-props-PxUvRHax.js.map +1 -0
- package/dist/platform-C-sxBTRa.cjs +2 -0
- package/dist/platform-C-sxBTRa.cjs.map +1 -0
- package/dist/platform-C4_cGUkS.js +2 -0
- package/dist/platform-C4_cGUkS.js.map +1 -0
- package/dist/popup-menu-BBAzAXIe.cjs +2 -0
- package/dist/popup-menu-BBAzAXIe.cjs.map +1 -0
- package/dist/popup-menu-HmBMJEZc.js +2 -0
- package/dist/popup-menu-HmBMJEZc.js.map +1 -0
- package/dist/resolve-state-props-C-zbhdXd.cjs +2 -0
- package/dist/resolve-state-props-C-zbhdXd.cjs.map +1 -0
- package/dist/resolve-state-props-D31kizRZ.js +2 -0
- package/dist/resolve-state-props-D31kizRZ.js.map +1 -0
- package/dist/rolldown-runtime-5lHFv1cW.cjs +1 -0
- package/dist/rolldown-runtime-DK3Fl9T5.js +1 -0
- package/dist/select/index.cjs +1 -1
- package/dist/select/index.cjs.map +1 -1
- package/dist/select/index.d.ts +835 -828
- package/dist/select/index.js +1 -1
- package/dist/select/index.js.map +1 -1
- package/dist/suggestion-menu/index.cjs +4 -0
- package/dist/suggestion-menu/index.cjs.map +1 -0
- package/dist/suggestion-menu/index.d.ts +359 -0
- package/dist/suggestion-menu/index.js +4 -0
- package/dist/suggestion-menu/index.js.map +1 -0
- package/dist/types-BbN28E3_.d.ts +50 -0
- package/dist/video-player/index.cjs +2 -2
- package/dist/video-player/index.cjs.map +1 -1
- package/dist/video-player/index.d.ts +964 -1000
- package/dist/video-player/index.js +2 -2
- package/dist/video-player/index.js.map +1 -1
- package/package.json +14 -5
- package/dist/ListboxStore-B8oTpM57.d.cts +0 -453
- package/dist/ListboxStore-CV5vPUUc.d.ts +0 -453
- package/dist/chunk-3HMQLMSF.js +0 -2
- package/dist/chunk-3HMQLMSF.js.map +0 -1
- package/dist/chunk-4C666HHU.js +0 -2
- package/dist/chunk-4C666HHU.js.map +0 -1
- package/dist/chunk-5T5B5SPR.cjs +0 -2
- package/dist/chunk-5T5B5SPR.cjs.map +0 -1
- package/dist/chunk-A4Z5BY7H.js +0 -2
- package/dist/chunk-A4Z5BY7H.js.map +0 -1
- package/dist/chunk-IT372NHF.js +0 -2
- package/dist/chunk-IT372NHF.js.map +0 -1
- package/dist/chunk-JFEVUUPC.cjs +0 -2
- package/dist/chunk-JFEVUUPC.cjs.map +0 -1
- package/dist/chunk-KO3DXT3Y.js +0 -2
- package/dist/chunk-KO3DXT3Y.js.map +0 -1
- package/dist/chunk-LXXK4S4Q.js +0 -2
- package/dist/chunk-LXXK4S4Q.js.map +0 -1
- package/dist/chunk-M4G6J7DP.cjs +0 -2
- package/dist/chunk-M4G6J7DP.cjs.map +0 -1
- package/dist/chunk-MPPIEWSL.js +0 -2
- package/dist/chunk-MPPIEWSL.js.map +0 -1
- package/dist/chunk-PCNHYMD6.cjs +0 -2
- package/dist/chunk-PCNHYMD6.cjs.map +0 -1
- package/dist/chunk-RTG6U56O.cjs +0 -2
- package/dist/chunk-RTG6U56O.cjs.map +0 -1
- package/dist/chunk-SCDHQZFI.cjs +0 -2
- package/dist/chunk-SCDHQZFI.cjs.map +0 -1
- package/dist/chunk-XMZZ62VJ.cjs +0 -2
- package/dist/chunk-XMZZ62VJ.cjs.map +0 -1
- package/dist/combobox/index.d.cts +0 -1066
- package/dist/command-menu/index.d.cts +0 -154
- package/dist/command-score-CTJ9NV6n.d.cts +0 -23
- package/dist/command-score-CTJ9NV6n.d.ts +0 -23
- package/dist/context-menu/index.d.cts +0 -696
- package/dist/dropdown-menu/index.d.cts +0 -723
- package/dist/events-BTHQ2OoH.d.ts +0 -1860
- package/dist/events-DVcrtGe3.d.cts +0 -1860
- package/dist/input-C95v6jB0.d.cts +0 -46
- package/dist/input-CYweYB_i.d.ts +0 -46
- package/dist/internal/listbox/index.cjs.map +0 -1
- package/dist/internal/listbox/index.d.cts +0 -272
- package/dist/internal/listbox/index.js.map +0 -1
- package/dist/internal/popup-menu/index.cjs.map +0 -1
- package/dist/internal/popup-menu/index.d.cts +0 -238
- package/dist/internal/popup-menu/index.js.map +0 -1
- package/dist/items-B6HeFO_8.d.ts +0 -37
- package/dist/kbd/index.d.cts +0 -61
- package/dist/loaders/index.d.cts +0 -363
- package/dist/loading-C6WZGUc3.d.cts +0 -29
- package/dist/loading-CC4n55sR.d.ts +0 -29
- package/dist/resolve-B-j0eW24.d.cts +0 -406
- package/dist/resolve-B1F-a3P1.d.ts +0 -406
- package/dist/scroll-arrow-BBoKckL_.d.cts +0 -544
- package/dist/scroll-arrow-fl3B5sVO.d.ts +0 -544
- package/dist/select/index.d.cts +0 -1005
- package/dist/separator-Dn15rte3.d.ts +0 -275
- package/dist/separator-NjsBVzek.d.cts +0 -275
- package/dist/surface-context-CGLDpMej.d.ts +0 -14
- package/dist/surface-context-CN4Lb_6F.d.cts +0 -14
- package/dist/type-guards-BHHzjRvZ.d.cts +0 -351
- package/dist/type-guards-C0e_GpeY.d.ts +0 -351
- package/dist/types-DT4FOOa2.d.cts +0 -51
- package/dist/types-DT4FOOa2.d.ts +0 -51
- package/dist/use-listbox-item-NzZuY34-.d.cts +0 -212
- package/dist/use-listbox-item-NzZuY34-.d.ts +0 -212
- package/dist/video-player/index.d.cts +0 -1391
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/item-equality.ts","../src/utils/items.ts"],"sourcesContent":["/**\n * Type for custom item equality comparison functions.\n * Used to compare object values in Select and Combobox components.\n */\nexport type ItemEqualityComparer<Value = unknown> = (\n itemValue: Value,\n value: Value,\n) => boolean\n\n/**\n * Default equality comparer using Object.is.\n * Handles primitives and object reference equality.\n */\nexport const defaultItemEquality: ItemEqualityComparer = (item, value) =>\n Object.is(item, value)\n\n/**\n * Compare two items for equality using a custom comparer.\n * Handles null/undefined values separately using Object.is.\n */\nexport function compareItemEquality<Value>(\n item: Value | null | undefined,\n value: Value | null | undefined,\n comparer: ItemEqualityComparer<Value>,\n): boolean {\n // Handle null/undefined with Object.is for consistent behavior\n if (item == null || value == null) {\n return Object.is(item, value)\n }\n return comparer(item, value)\n}\n\n/**\n * Check if a collection includes a specific value using custom equality.\n */\nexport function itemIncludes<Value>(\n collection: readonly Value[] | undefined | null,\n value: Value | null | undefined,\n comparer: ItemEqualityComparer<Value>,\n): boolean {\n if (!collection || collection.length === 0) {\n return false\n }\n return collection.some((item) => {\n if (item === undefined) {\n return false\n }\n return compareItemEquality(item, value, comparer)\n })\n}\n\n/**\n * Find the index of a value in a collection using custom equality.\n * Returns -1 if not found.\n */\nexport function findItemIndex<Value>(\n collection: readonly Value[] | undefined | null,\n value: Value,\n comparer: ItemEqualityComparer<Value>,\n): number {\n if (!collection || collection.length === 0) {\n return -1\n }\n return collection.findIndex((item) => {\n if (item === undefined) {\n return false\n }\n return compareItemEquality(item, value, comparer)\n })\n}\n\n/**\n * Remove a value from a collection using custom equality.\n * Returns a new array without the matching item.\n */\nexport function removeItem<Value>(\n collection: readonly Value[],\n value: Value,\n comparer: ItemEqualityComparer<Value>,\n): Value[] {\n return collection.filter(\n (item) => !compareItemEquality(item, value, comparer),\n )\n}\n","import type * as React from 'react'\n\n/**\n * A single entry in the array form of the `items` prop passed to\n * `Select.Root` / `Combobox.Root`.\n */\nexport interface ItemsEntry {\n /**\n * The item's value.\n *\n * Use `null` to describe a clearable/placeholder item (its label is used as\n * the trigger placeholder and selecting it clears the value).\n */\n value: string | null\n /** The label to display for this item. */\n label: React.ReactNode\n /**\n * Additional keywords to match against when filtering, on top of the label.\n * Useful for aliases or synonyms.\n */\n keywords?: string[]\n}\n\n/**\n * Data structure describing the items rendered in a Select/Combobox popup.\n *\n * Either a record mapping a value to its label, or an array of entries. Only\n * the array form can express `keywords` or a `null` (clearable) value.\n */\nexport type Items = Record<string, React.ReactNode> | Array<ItemsEntry>\n\n/**\n * The resolved metadata for a single item looked up from the `items` prop.\n */\nexport interface ResolvedItem {\n label: React.ReactNode\n keywords?: string[]\n}\n\n/** Serialize an entry value to the string key used for registry lookups. */\nfunction entryKey(value: string | null): string {\n return value == null ? '' : value\n}\n\n/**\n * Resolve the full entry (label + keywords) from the `items` prop for a given\n * serialized value key. Returns `undefined` when there is no match.\n */\nexport function resolveItemFromItems(\n items: Items | undefined,\n valueKey: string,\n): ResolvedItem | undefined {\n if (!items) return undefined\n\n if (Array.isArray(items)) {\n const entry = items.find((i) => entryKey(i.value) === valueKey)\n if (!entry) return undefined\n return { label: entry.label, keywords: entry.keywords }\n }\n\n const label = items[valueKey]\n if (label === undefined) return undefined\n return { label }\n}\n\n/**\n * Resolve just the label from the `items` prop for a given serialized value\n * key. Returns `undefined` when there is no match.\n */\nexport function resolveLabelFromItems(\n items: Items | undefined,\n valueKey: string,\n): React.ReactNode | undefined {\n return resolveItemFromItems(items, valueKey)?.label\n}\n\n/**\n * Merge a set of extra keyword strings into an existing keywords array,\n * preserving order and removing duplicates. Returns the original `keywords`\n * reference untouched when there is nothing to add.\n */\nexport function mergeKeywords(\n keywords: string[] | undefined,\n extra: Array<string | undefined>,\n): string[] | undefined {\n const additions = extra.filter((k): k is string => Boolean(k))\n if (additions.length === 0) return keywords\n\n const merged = keywords ? [...keywords] : []\n for (const keyword of additions) {\n if (!merged.includes(keyword)) merged.push(keyword)\n }\n return merged\n}\n"],"mappings":"AAaO,IAAMA,EAA4C,CAACC,EAAMC,IAC9D,OAAO,GAAGD,EAAMC,CAAK,EAMhB,SAASC,EACdF,EACAC,EACAE,EACS,CAET,OAAIH,GAAQ,MAAQC,GAAS,KACpB,OAAO,GAAGD,EAAMC,CAAK,EAEvBE,EAASH,EAAMC,CAAK,CAC7B,CAKO,SAASG,EACdC,EACAJ,EACAE,EACS,CACT,MAAI,CAACE,GAAcA,EAAW,SAAW,EAChC,GAEFA,EAAW,KAAML,GAClBA,IAAS,OACJ,GAEFE,EAAoBF,EAAMC,EAAOE,CAAQ,CACjD,CACH,CA0BO,SAASG,EACdC,EACAC,EACAC,EACS,CACT,OAAOF,EAAW,OACfG,GAAS,CAACC,EAAoBD,EAAMF,EAAOC,CAAQ,CACtD,CACF,CC3CA,SAASG,EAASC,EAA8B,CAC9C,OAAOA,GAAgB,EACzB,CAMO,SAASC,EACdC,EACAC,EAC0B,CAC1B,GAAI,CAACD,EAAO,OAEZ,GAAI,MAAM,QAAQA,CAAK,EAAG,CACxB,IAAME,EAAQF,EAAM,KAAMG,GAAMN,EAASM,EAAE,KAAK,IAAMF,CAAQ,EAC9D,OAAKC,EACE,CAAE,MAAOA,EAAM,MAAO,SAAUA,EAAM,QAAS,EAD1C,MAEd,CAEA,IAAME,EAAQJ,EAAMC,CAAQ,EAC5B,GAAIG,IAAU,OACd,MAAO,CAAE,MAAAA,CAAM,CACjB,CAMO,SAASC,EACdL,EACAC,EAC6B,CAC7B,OAAOF,EAAqBC,EAAOC,CAAQ,GAAG,KAChD,CAOO,SAASK,EACdC,EACAC,EACsB,CACtB,IAAMC,EAAYD,EAAM,OAAQE,GAAmB,EAAQA,CAAE,EAC7D,GAAID,EAAU,SAAW,EAAG,OAAOF,EAEnC,IAAMI,EAASJ,EAAW,CAAC,GAAGA,CAAQ,EAAI,CAAC,EAC3C,QAAWK,KAAWH,EACfE,EAAO,SAASC,CAAO,GAAGD,EAAO,KAAKC,CAAO,EAEpD,OAAOD,CACT","names":["defaultItemEquality","item","value","compareItemEquality","comparer","itemIncludes","collection","removeItem","collection","value","comparer","item","compareItemEquality","entryKey","value","resolveItemFromItems","items","valueKey","entry","i","label","resolveLabelFromItems","mergeKeywords","keywords","extra","additions","k","merged","keyword"]}
|
package/dist/chunk-LXXK4S4Q.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var i={esc:"escape",return:"enter",del:"delete",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",space:"space",spacebar:"space",plus:"+"};function l(e){return i[e]??e}function p(){return{meta:!1,ctrl:!1,alt:!1,shift:!1,mod:!1,key:null}}function f(e){let t=e.trim();return t.length===0?{chords:[]}:{chords:t.split(/\s+/).map(a=>{let n=p();for(let s of a.split("+")){let r=s.trim().toLowerCase();if(r!=="")if(r==="mod")n.mod=!0;else if(r==="meta"||r==="cmd"||r==="command"||r==="win"||r==="super")n.meta=!0;else if(r==="ctrl"||r==="control")n.ctrl=!0;else if(r==="alt"||r==="option"||r==="opt")n.alt=!0;else if(r==="shift")n.shift=!0;else{if(n.key!==null)throw new Error(`Keybinding chord "${a}" contains multiple keys: "${n.key}" and "${r}"`);n.key=l(r)}}return n})}}function c(e,t){let a=e.toLowerCase();switch(a){case"enter":return t==="apple"?"\u21B5":"Enter";case"escape":return"Esc";case"backspace":return t==="apple"?"\u232B":"Backspace";case"delete":return t==="apple"?"\u2326":"Del";case"tab":return t==="apple"?"\u21E5":"Tab";case"space":return"Space";case"arrowup":return"\u2191";case"arrowdown":return"\u2193";case"arrowleft":return"\u2190";case"arrowright":return"\u2192";default:return a.length===1?a.toUpperCase():a.charAt(0).toUpperCase()+a.slice(1)}}function g(e,t){let a=e.ctrl||t==="other"&&e.mod,n=e.meta||t==="apple"&&e.mod,s=[];return a&&s.push(t==="apple"?"\u2303":"Ctrl"),e.alt&&s.push(t==="apple"?"\u2325":"Alt"),e.shift&&s.push(t==="apple"?"\u21E7":"Shift"),n&&s.push(t==="apple"?"\u2318":"Win"),e.key!==null&&s.push(c(e.key,t)),s}import*as o from"react";function u(){if(typeof navigator>"u")return!1;let e=navigator,t=e.userAgentData?.platform||e.platform||e.userAgent;return/mac|iphone|ipad|ipod/i.test(t)}function m(e){let[t,a]=o.useState("other");return o.useEffect(()=>{e===void 0&&u()&&a("apple")},[e]),e??t}export{f as a,c as b,g as c,u as d,m as e};
|
|
2
|
-
//# sourceMappingURL=chunk-LXXK4S4Q.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/kbd/utils/parse-keybinding.ts","../src/kbd/utils/platform.ts"],"sourcesContent":["export interface KeyChord {\n meta: boolean\n ctrl: boolean\n alt: boolean\n shift: boolean\n mod: boolean\n key: string | null\n}\n\nexport interface Keybinding {\n chords: KeyChord[]\n}\n\ntype Platform = 'apple' | 'other'\n\nconst keyAliases: Record<string, string> = {\n esc: 'escape',\n return: 'enter',\n del: 'delete',\n up: 'arrowup',\n down: 'arrowdown',\n left: 'arrowleft',\n right: 'arrowright',\n space: 'space',\n spacebar: 'space',\n plus: '+',\n}\n\nfunction normalizeKey(key: string): string {\n return keyAliases[key] ?? key\n}\n\nfunction createChord(): KeyChord {\n return {\n meta: false,\n ctrl: false,\n alt: false,\n shift: false,\n mod: false,\n key: null,\n }\n}\n\nexport function parseKeybinding(keys: string): Keybinding {\n const trimmed = keys.trim()\n\n if (trimmed.length === 0) {\n return { chords: [] }\n }\n\n return {\n chords: trimmed.split(/\\s+/).map((chordValue) => {\n const chord = createChord()\n\n for (const tokenValue of chordValue.split('+')) {\n const token = tokenValue.trim().toLowerCase()\n\n if (token === '') {\n // Skip empty tokens from trailing/leading/double \"+\" (e.g. \"mod+\").\n // A literal \"+\" key is expressed with the \"plus\" alias.\n continue\n }\n\n if (token === 'mod') {\n chord.mod = true\n } else if (\n token === 'meta' ||\n token === 'cmd' ||\n token === 'command' ||\n token === 'win' ||\n token === 'super'\n ) {\n chord.meta = true\n } else if (token === 'ctrl' || token === 'control') {\n chord.ctrl = true\n } else if (token === 'alt' || token === 'option' || token === 'opt') {\n chord.alt = true\n } else if (token === 'shift') {\n chord.shift = true\n } else {\n if (chord.key !== null) {\n throw new Error(\n `Keybinding chord \"${chordValue}\" contains multiple keys: \"${chord.key}\" and \"${token}\"`,\n )\n }\n\n chord.key = normalizeKey(token)\n }\n }\n\n return chord\n }),\n }\n}\n\nexport function getKeyLabel(key: string, platform: Platform): string {\n const normalizedKey = key.toLowerCase()\n\n switch (normalizedKey) {\n case 'enter':\n return platform === 'apple' ? '↵' : 'Enter'\n case 'escape':\n return 'Esc'\n case 'backspace':\n return platform === 'apple' ? '⌫' : 'Backspace'\n case 'delete':\n return platform === 'apple' ? '⌦' : 'Del'\n case 'tab':\n return platform === 'apple' ? '⇥' : 'Tab'\n case 'space':\n return 'Space'\n case 'arrowup':\n return '↑'\n case 'arrowdown':\n return '↓'\n case 'arrowleft':\n return '←'\n case 'arrowright':\n return '→'\n default:\n if (normalizedKey.length === 1) {\n return normalizedKey.toUpperCase()\n }\n\n return normalizedKey.charAt(0).toUpperCase() + normalizedKey.slice(1)\n }\n}\n\nexport function getChordLabels(chord: KeyChord, platform: Platform): string[] {\n const isCtrl = chord.ctrl || (platform === 'other' && chord.mod)\n const isMeta = chord.meta || (platform === 'apple' && chord.mod)\n const labels: string[] = []\n\n if (isCtrl) {\n labels.push(platform === 'apple' ? '⌃' : 'Ctrl')\n }\n\n if (chord.alt) {\n labels.push(platform === 'apple' ? '⌥' : 'Alt')\n }\n\n if (chord.shift) {\n labels.push(platform === 'apple' ? '⇧' : 'Shift')\n }\n\n if (isMeta) {\n labels.push(platform === 'apple' ? '⌘' : 'Win')\n }\n\n if (chord.key !== null) {\n labels.push(getKeyLabel(chord.key, platform))\n }\n\n return labels\n}\n","'use client'\n\nimport * as React from 'react'\n\ntype Platform = 'apple' | 'other'\n\ninterface NavigatorWithUserAgentData extends Navigator {\n userAgentData?: {\n platform?: string\n }\n}\n\nexport function isApplePlatform(): boolean {\n if (typeof navigator === 'undefined') {\n return false\n }\n\n const nav = navigator as NavigatorWithUserAgentData\n const platform = nav.userAgentData?.platform || nav.platform || nav.userAgent\n\n return /mac|iphone|ipad|ipod/i.test(platform)\n}\n\n/**\n * Returns the current platform while keeping the first client render aligned with\n * SSR. Without an override, this starts as \"other\" and corrects to \"apple\" after\n * mount when appropriate, avoiding hydration mismatches.\n */\nexport function usePlatform(override?: Platform): Platform {\n const [platform, setPlatform] = React.useState<Platform>('other')\n\n React.useEffect(() => {\n if (override === undefined && isApplePlatform()) {\n setPlatform('apple')\n }\n }, [override])\n\n return override ?? platform\n}\n"],"mappings":"AAeA,IAAMA,EAAqC,CACzC,IAAK,SACL,OAAQ,QACR,IAAK,SACL,GAAI,UACJ,KAAM,YACN,KAAM,YACN,MAAO,aACP,MAAO,QACP,SAAU,QACV,KAAM,GACR,EAEA,SAASC,EAAaC,EAAqB,CACzC,OAAOF,EAAWE,CAAG,GAAKA,CAC5B,CAEA,SAASC,GAAwB,CAC/B,MAAO,CACL,KAAM,GACN,KAAM,GACN,IAAK,GACL,MAAO,GACP,IAAK,GACL,IAAK,IACP,CACF,CAEO,SAASC,EAAgBC,EAA0B,CACxD,IAAMC,EAAUD,EAAK,KAAK,EAE1B,OAAIC,EAAQ,SAAW,EACd,CAAE,OAAQ,CAAC,CAAE,EAGf,CACL,OAAQA,EAAQ,MAAM,KAAK,EAAE,IAAKC,GAAe,CAC/C,IAAMC,EAAQL,EAAY,EAE1B,QAAWM,KAAcF,EAAW,MAAM,GAAG,EAAG,CAC9C,IAAMG,EAAQD,EAAW,KAAK,EAAE,YAAY,EAE5C,GAAIC,IAAU,GAMd,GAAIA,IAAU,MACZF,EAAM,IAAM,WAEZE,IAAU,QACVA,IAAU,OACVA,IAAU,WACVA,IAAU,OACVA,IAAU,QAEVF,EAAM,KAAO,WACJE,IAAU,QAAUA,IAAU,UACvCF,EAAM,KAAO,WACJE,IAAU,OAASA,IAAU,UAAYA,IAAU,MAC5DF,EAAM,IAAM,WACHE,IAAU,QACnBF,EAAM,MAAQ,OACT,CACL,GAAIA,EAAM,MAAQ,KAChB,MAAM,IAAI,MACR,qBAAqBD,CAAU,8BAA8BC,EAAM,GAAG,UAAUE,CAAK,GACvF,EAGFF,EAAM,IAAMP,EAAaS,CAAK,CAChC,CACF,CAEA,OAAOF,CACT,CAAC,CACH,CACF,CAEO,SAASG,EAAYT,EAAaU,EAA4B,CACnE,IAAMC,EAAgBX,EAAI,YAAY,EAEtC,OAAQW,EAAe,CACrB,IAAK,QACH,OAAOD,IAAa,QAAU,SAAM,QACtC,IAAK,SACH,MAAO,MACT,IAAK,YACH,OAAOA,IAAa,QAAU,SAAM,YACtC,IAAK,SACH,OAAOA,IAAa,QAAU,SAAM,MACtC,IAAK,MACH,OAAOA,IAAa,QAAU,SAAM,MACtC,IAAK,QACH,MAAO,QACT,IAAK,UACH,MAAO,SACT,IAAK,YACH,MAAO,SACT,IAAK,YACH,MAAO,SACT,IAAK,aACH,MAAO,SACT,QACE,OAAIC,EAAc,SAAW,EACpBA,EAAc,YAAY,EAG5BA,EAAc,OAAO,CAAC,EAAE,YAAY,EAAIA,EAAc,MAAM,CAAC,CACxE,CACF,CAEO,SAASC,EAAeN,EAAiBI,EAA8B,CAC5E,IAAMG,EAASP,EAAM,MAASI,IAAa,SAAWJ,EAAM,IACtDQ,EAASR,EAAM,MAASI,IAAa,SAAWJ,EAAM,IACtDS,EAAmB,CAAC,EAE1B,OAAIF,GACFE,EAAO,KAAKL,IAAa,QAAU,SAAM,MAAM,EAG7CJ,EAAM,KACRS,EAAO,KAAKL,IAAa,QAAU,SAAM,KAAK,EAG5CJ,EAAM,OACRS,EAAO,KAAKL,IAAa,QAAU,SAAM,OAAO,EAG9CI,GACFC,EAAO,KAAKL,IAAa,QAAU,SAAM,KAAK,EAG5CJ,EAAM,MAAQ,MAChBS,EAAO,KAAKN,EAAYH,EAAM,IAAKI,CAAQ,CAAC,EAGvCK,CACT,CCxJA,UAAYC,MAAW,QAUhB,SAASC,GAA2B,CACzC,GAAI,OAAO,UAAc,IACvB,MAAO,GAGT,IAAMC,EAAM,UACNC,EAAWD,EAAI,eAAe,UAAYA,EAAI,UAAYA,EAAI,UAEpE,MAAO,wBAAwB,KAAKC,CAAQ,CAC9C,CAOO,SAASC,EAAYC,EAA+B,CACzD,GAAM,CAACF,EAAUG,CAAW,EAAU,WAAmB,OAAO,EAEhE,OAAM,YAAU,IAAM,CAChBD,IAAa,QAAaJ,EAAgB,GAC5CK,EAAY,OAAO,CAEvB,EAAG,CAACD,CAAQ,CAAC,EAENA,GAAYF,CACrB","names":["keyAliases","normalizeKey","key","createChord","parseKeybinding","keys","trimmed","chordValue","chord","tokenValue","token","getKeyLabel","platform","normalizedKey","getChordLabels","isCtrl","isMeta","labels","React","isApplePlatform","nav","platform","usePlatform","override","setPlatform"]}
|
package/dist/chunk-M4G6J7DP.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/ui/ui/packages/react/dist/chunk-M4G6J7DP.cjs"],"names":[],"mappings":"AAAA,6EAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc","file":"/home/runner/work/ui/ui/packages/react/dist/chunk-M4G6J7DP.cjs"}
|
package/dist/chunk-MPPIEWSL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/resolve-state-props.ts"],"sourcesContent":["import type * as React from 'react'\n\n/**\n * A `className` prop: a string, or a function of the part's state.\n */\nexport type StateClassName<State> =\n | string\n | ((state: State) => string | undefined)\n | undefined\n\n/**\n * A `style` prop: a style object, or a function of the part's state.\n */\nexport type StateStyle<State> =\n | React.CSSProperties\n | ((state: State) => React.CSSProperties | undefined)\n | undefined\n\n/**\n * Resolves a `className` prop against the part's state.\n *\n * Base UI's `useRender` only resolves `className` functions passed at the top\n * level of its parameters, not inside `props`. Parts that merge `className`\n * into `props` must resolve it first, or the function reaches the DOM.\n */\nexport function resolveClassName<State>(\n className: StateClassName<State>,\n state: State,\n): string | undefined {\n return typeof className === 'function' ? className(state) : className\n}\n\n/**\n * Resolves a `style` prop against the part's state.\n *\n * See {@link resolveClassName} for why this is needed before `useRender`.\n */\nexport function resolveStyle<State>(\n style: StateStyle<State>,\n state: State,\n): React.CSSProperties | undefined {\n return typeof style === 'function' ? style(state) : style\n}\n\n/**\n * Combines a consumer `style` prop with internal styles without resolving it.\n *\n * Use this when forwarding `style` to a Base UI component, which resolves\n * `style` functions with its own state. Spreading a function (`{ ...style }`)\n * would silently drop it, so a function `style` stays a function here.\n *\n * @param style The consumer's `style` prop.\n * @param build Builds the final style from the resolved consumer style.\n */\nexport function composeStyle<State>(\n style: StateStyle<State>,\n build: (style: React.CSSProperties | undefined) => React.CSSProperties,\n): React.CSSProperties | ((state: State) => React.CSSProperties) {\n if (typeof style === 'function') {\n return (state: State) => build(style(state))\n }\n return build(style)\n}\n"],"mappings":"AAyBO,SAASA,EACdC,EACAC,EACoB,CACpB,OAAO,OAAOD,GAAc,WAAaA,EAAUC,CAAK,EAAID,CAC9D,CAOO,SAASE,EACdC,EACAF,EACiC,CACjC,OAAO,OAAOE,GAAU,WAAaA,EAAMF,CAAK,EAAIE,CACtD,CAYO,SAASC,EACdD,EACAE,EAC+D,CAC/D,OAAI,OAAOF,GAAU,WACXF,GAAiBI,EAAMF,EAAMF,CAAK,CAAC,EAEtCI,EAAMF,CAAK,CACpB","names":["resolveClassName","className","state","resolveStyle","style","composeStyle","build"]}
|
package/dist/chunk-PCNHYMD6.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});function r(t,e){return typeof t=="function"?t(e):t}function a(t,e){return typeof t=="function"?t(e):t}function n(t,e){return typeof t=="function"?S=>e(t(S)):e(t)}exports.a = r; exports.b = a; exports.c = n;
|
|
2
|
-
//# sourceMappingURL=chunk-PCNHYMD6.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/resolve-state-props.ts"],"names":["resolveClassName","className","state","resolveStyle","style","composeStyle","build"],"mappings":"AAyBO,kFAASA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACoB,CACpB,OAAO,OAAOD,CAAAA,EAAc,UAAA,CAAaA,CAAAA,CAAUC,CAAK,CAAA,CAAID,CAC9D,CAOO,SAASE,CAAAA,CACdC,CAAAA,CACAF,CAAAA,CACiC,CACjC,OAAO,OAAOE,CAAAA,EAAU,UAAA,CAAaA,CAAAA,CAAMF,CAAK,CAAA,CAAIE,CACtD,CAYO,SAASC,CAAAA,CACdD,CAAAA,CACAE,CAAAA,CAC+D,CAC/D,OAAI,OAAOF,CAAAA,EAAU,UAAA,CACXF,CAAAA,EAAiBI,CAAAA,CAAMF,CAAAA,CAAMF,CAAK,CAAC,CAAA,CAEtCI,CAAAA,CAAMF,CAAK,CACpB,CAAA,4CAAA","file":"/home/runner/work/ui/ui/packages/react/dist/chunk-PCNHYMD6.cjs","sourcesContent":["import type * as React from 'react'\n\n/**\n * A `className` prop: a string, or a function of the part's state.\n */\nexport type StateClassName<State> =\n | string\n | ((state: State) => string | undefined)\n | undefined\n\n/**\n * A `style` prop: a style object, or a function of the part's state.\n */\nexport type StateStyle<State> =\n | React.CSSProperties\n | ((state: State) => React.CSSProperties | undefined)\n | undefined\n\n/**\n * Resolves a `className` prop against the part's state.\n *\n * Base UI's `useRender` only resolves `className` functions passed at the top\n * level of its parameters, not inside `props`. Parts that merge `className`\n * into `props` must resolve it first, or the function reaches the DOM.\n */\nexport function resolveClassName<State>(\n className: StateClassName<State>,\n state: State,\n): string | undefined {\n return typeof className === 'function' ? className(state) : className\n}\n\n/**\n * Resolves a `style` prop against the part's state.\n *\n * See {@link resolveClassName} for why this is needed before `useRender`.\n */\nexport function resolveStyle<State>(\n style: StateStyle<State>,\n state: State,\n): React.CSSProperties | undefined {\n return typeof style === 'function' ? style(state) : style\n}\n\n/**\n * Combines a consumer `style` prop with internal styles without resolving it.\n *\n * Use this when forwarding `style` to a Base UI component, which resolves\n * `style` functions with its own state. Spreading a function (`{ ...style }`)\n * would silently drop it, so a function `style` stays a function here.\n *\n * @param style The consumer's `style` prop.\n * @param build Builds the final style from the resolved consumer style.\n */\nexport function composeStyle<State>(\n style: StateStyle<State>,\n build: (style: React.CSSProperties | undefined) => React.CSSProperties,\n): React.CSSProperties | ((state: State) => React.CSSProperties) {\n if (typeof style === 'function') {\n return (state: State) => build(style(state))\n }\n return build(style)\n}\n"]}
|
package/dist/chunk-RTG6U56O.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;var _chunkXMZZ62VJcjs = require('./chunk-XMZZ62VJ.cjs');var _chunkPCNHYMD6cjs = require('./chunk-PCNHYMD6.cjs');var _react = require('react'); var Lo = _interopRequireWildcard(_react); var Oo = _interopRequireWildcard(_react); var eo = _interopRequireWildcard(_react); var To = _interopRequireWildcard(_react); var to = _interopRequireWildcard(_react); var no = _interopRequireWildcard(_react); var so = _interopRequireWildcard(_react); var Me = _interopRequireWildcard(_react); var Re = _interopRequireWildcard(_react); var Er = _interopRequireWildcard(_react); var Fo = _interopRequireWildcard(_react); var Ar = _interopRequireWildcard(_react); var Se = _interopRequireWildcard(_react); var co = _interopRequireWildcard(_react); var tt = _interopRequireWildcard(_react); var Ae = _interopRequireWildcard(_react); var Vo = _interopRequireWildcard(_react); var ue = _interopRequireWildcard(_react); var le = _interopRequireWildcard(_react); var jo = _interopRequireWildcard(_react); var xe = _interopRequireWildcard(_react); var qt = _interopRequireWildcard(_react); var Ko = _interopRequireWildcard(_react); var Wo = _interopRequireWildcard(_react); var Ro = _interopRequireWildcard(_react); var So = _interopRequireWildcard(_react); var wt = _interopRequireWildcard(_react); var st = _interopRequireWildcard(_react); var Ke = _interopRequireWildcard(_react); var ke = _interopRequireWildcard(_react); var ee = _interopRequireWildcard(_react); var $o = _interopRequireWildcard(_react); var _e = _interopRequireWildcard(_react); var at = _interopRequireWildcard(_react); var De = _interopRequireWildcard(_react); var ce = _interopRequireWildcard(_react); var qe = _interopRequireWildcard(_react); var nn = _interopRequireWildcard(_react); var rn = _interopRequireWildcard(_react); var xt = _interopRequireWildcard(_react); var Je = _interopRequireWildcard(_react); var Ne = _interopRequireWildcard(_react); var sn = _interopRequireWildcard(_react); var an = _interopRequireWildcard(_react); var ot = _interopRequireWildcard(_react); var un = _interopRequireWildcard(_react); var cn = _interopRequireWildcard(_react); var ln = _interopRequireWildcard(_react); var pn = _interopRequireWildcard(_react); var dn = _interopRequireWildcard(_react); var Be = _interopRequireWildcard(_react); var hs = _interopRequireWildcard(_react); var fn = _interopRequireWildcard(_react); var it = _interopRequireWildcard(_react); var mn = _interopRequireWildcard(_react); var Rs = _interopRequireWildcard(_react); var gn = _interopRequireWildcard(_react); var Ss = _interopRequireWildcard(_react); var Ps = _interopRequireWildcard(_react); var fe = _interopRequireWildcard(_react); var _ = _interopRequireWildcard(_react); var xn = _interopRequireWildcard(_react); var vs = _interopRequireWildcard(_react); var yn = _interopRequireWildcard(_react); var Mn = _interopRequireWildcard(_react); var nt = _interopRequireWildcard(_react); var Yt = _interopRequireWildcard(_react); var Te = _interopRequireWildcard(_react); var gt = _interopRequireWildcard(_react);var kn=Lo.createContext(null);function ye(){let e=Lo.useContext(kn);if(!e)throw new Error("FocusOwner components must be used within a FocusOwnerProvider");return e}var In=Oo.createContext(null);function It(){let e=Oo.useContext(In);if(!e)throw new Error("OpenChain components must be used within an OpenChainProvider");return e}var pt=eo.createContext(null);function Ee(){let e=eo.useContext(pt);if(!e)throw new Error("PopupMenu components must be used within a PopupMenu.Root or ContextMenu.Root");return e}function lt(){return eo.useContext(pt)}var jt=To.createContext(null);function Or(){return To.useContext(jt)}var Go=to.createContext(null);function oo(){let e=to.useContext(Go);if(!e)throw new Error("SubmenuTrigger must be used within a Submenu");return e}function Ue(){return to.useContext(Go)}var Eo=no.createContext(null);function ro(){let e=no.useContext(Eo);if(!e)throw new Error("Subpage components must be used within a PopupMenu.Subpage");return e}function dt(){return no.useContext(Eo)}var ao=so.createContext(null);function Dt(){let e=so.useContext(ao);if(!e)throw new Error("Subpage components must be used within a PopupMenu.Popup");return e}function io(){return so.useContext(ao)}var _store = require('@base-ui/utils/store');var ws={ownerId:_store.createSelector.call(void 0, e=>e.ownerId),isOwner:_store.createSelector.call(void 0, (e,o)=>e.ownerId===o)},uo= exports.n =class extends _store.ReactStore{constructor(){super({ownerId:null},{},ws)}setOwnerId(o){this.set("ownerId",o)}clearOwner(){this.set("ownerId",null)}};function Dn(e){return typeof e=="object"&&e!==null&&"def"in e&&typeof e.id=="string"&&typeof e.definitionKey=="string"&&Array.isArray(e.definitionPath)&&Array.isArray(e.children)&&typeof e.depth=="number"&&"parent"in e}function Ls(e){let o="";for(let r=0;r<e.length;r+=1){let t=e.charCodeAt(r),a=t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===46||t===95||t===126||t===45;o+=a?String.fromCharCode(t):`%${t.toString(16).padStart(4,"0")}`}return o}function Nn(e,o="surface"){return o==="menu"?e.definitionKey:e.definitionPath.map(Ls).join("/")}function wn(e){switch(e.kind){case"group":case"radio-group":return e.id;case"separator":return e.id;default:return _nullishCoalesce(e.id, () => (_chunkXMZZ62VJcjs.s.call(void 0, e.value)))}}function Ln(e){switch(e.kind){case"group":case"radio-group":return e.nodes;case"submenu":case"subpage":case"tree-item":return _nullishCoalesce(e.nodes, () => ([]));default:return[]}}function zt(e){return e.kind==="submenu"||e.kind==="subpage"}function On(e,o,r,t){return e.map((a,n)=>{let c=wn(a),p=[...r,c],g={def:a,kind:a.kind,definitionKey:c,definitionPath:p,parent:o,children:[],depth:o?o.depth+1:0,index:n},l=t(g),i={...g,id:l};return i.children=On(Ln(a),i,zt(a)?i.definitionPath:r,t),i})}function ft(e){let o=e.def.nodes;if(!o||o.length===0)return[];let r=new Set(o);return e.children.filter(t=>r.has(t.def))}function Tn(e,o,r,t,a){let n=wn(e),c=[...r,n],p={def:e,kind:e.kind,definitionKey:n,definitionPath:c,parent:o,children:[],depth:o?o.depth+1:0,index:t};return{definitionKey:n,definitionPath:c,id:a(p)}}function Gr(e={}){let o=_nullishCoalesce(e.idScope, () => ("surface")),r=_nullishCoalesce(e.getResolvedId, () => ((u=>Nn(u,o)))),t=[],a=null,n=new Map,c=new Map,p=new WeakMap,g=new Set,l=!1,i=new WeakMap,d=!1,m=new WeakMap,S={},b=u=>{if(o==="menu")return S;let h=u.parent;for(;h;){if(zt(h.def))return h;h=h.parent}return S},R=u=>{process.env.NODE_ENV!=="production"&&console.warn(u)},y=u=>o==="menu"?"menu":u===S?"root surface":`surface "${u.definitionPath.join("/")}"`,L=u=>{if(process.env.NODE_ENV==="production")return;u.id===""&&(d||(d=!0,R(`[PopupMenu] Empty Resolved ID for ${u.kind} definition.`)));let h=c.get(u.id);!h||h===u||g.has(u.id)||(g.add(u.id),R(`[PopupMenu] Duplicate Resolved ID "${u.id}" in menu scope; ${h.kind} and ${u.kind} definitions conflict.`))},I=(u,h=S)=>{u.definitionKey===""&&(l||(l=!0,R(`[PopupMenu] Empty Definition Key in ${u.kind} definition (${y(h)}).`)));let P=m.get(h);P||(P=new Map,m.set(h,P));let D=P.get(u.definitionKey);D||(D=new Set,P.set(u.definitionKey,D));let F=[...D].find(f=>f!==u);if(F){let f=i.get(h);f||(f=new Set,i.set(h,f)),f.has(u.definitionKey)||(f.add(u.definitionKey),R(`[PopupMenu] Duplicate Definition Key "${u.definitionKey}" in ${y(h)}; ${F.kind} and ${u.kind} definitions conflict.`))}D.add(u),n.has(u.def)||n.set(u.def,u),L(u),c.has(u.id)||c.set(u.id,u);let T=o==="surface"&&zt(u.def)?u:h;for(let f of u.children)I(f,T)},N=u=>{let h=b(u),P=m.get(h),D=_optionalChain([P, 'optionalAccess', _2 => _2.get, 'call', _3 => _3(u.definitionKey)]);D&&(D.delete(u),D.size===0&&_optionalChain([P, 'optionalAccess', _4 => _4.delete, 'call', _5 => _5(u.definitionKey)]),_optionalChain([P, 'optionalAccess', _6 => _6.size])===0&&m.delete(h)),n.get(u.def)===u&&n.delete(u.def),c.get(u.id)===u&&c.delete(u.id),p.delete(u);for(let F of u.children)N(F)},M=(u,h)=>u.length===h.length&&u.every((P,D)=>P===h[D]),v=u=>zt(u.def)?u.definitionPath:u.parent?v(u.parent):[],s=(u,h,P,D)=>{let F=new Map;for(let k of u){let E=F.get(k.id);E?E.push(k):F.set(k.id,[k])}let T=[],f=new Set;for(let[k,E]of h.entries()){let{id:x}=Tn(E,P,D,k,r),z=_optionalChain([F, 'access', _7 => _7.get, 'call', _8 => _8(x), 'optionalAccess', _9 => _9.find, 'call', _10 => _10(A=>!f.has(A)&&A.kind===E.kind)]);z?(f.add(z),T.push(z)):T.push(void 0)}let G=u.length===h.length;for(let k of u)f.has(k)||(G=!1,N(k));let O=h.map((k,E)=>{let x=T[E],{definitionKey:w,definitionPath:z,id:A}=Tn(k,P,D,E,r);if(!x){G=!1;let H=On([k],P,D,r)[0];return H.index=E,H.id=Tn(k,P,D,E,r).id,I(H,b(H)),H}if(x.def===k&&M(x.definitionPath,z))return(u[E]!==x||x.index!==E)&&(G=!1),x.index=E,x;G=!1,n.get(x.def)===x&&n.delete(x.def);let U=b(x),$=m.get(U),ae=_optionalChain([$, 'optionalAccess', _11 => _11.get, 'call', _12 => _12(x.definitionKey)]);return ae&&(ae.delete(x),ae.size===0&&_optionalChain([$, 'optionalAccess', _13 => _13.delete, 'call', _14 => _14(x.definitionKey)]),_optionalChain([$, 'optionalAccess', _15 => _15.size])===0&&m.delete(U)),x.def=k,x.definitionKey=w,x.definitionPath=z,x.index=E,x.id!==A&&(c.get(x.id)===x&&c.delete(x.id),x.id=A,L(x),c.has(A)||c.set(A,x)),n.has(k)||n.set(k,x),p.delete(x),x.children=s(x.children,Ln(k),x,zt(k)?x.definitionPath:D),I(x,b(x)),x});return G?u:O};return{getResolvedId:r,idScope:o,get rootNodes(){return t},setContent(u){u!==a&&(t=s(t,u,null,[]),a=u)},graft(u,h){h!==p.get(u)&&(u.children=s(u.children,h,u,v(u)),p.set(u,h))},getNodeForDef(u){return n.get(u)},getNodeById(u){return c.get(u)}}}var Ts={isOpen:_store.createSelector.call(void 0, (e,o)=>e.chain.includes(o)),isLast:_store.createSelector.call(void 0, (e,o)=>e.chain.length>0&&e.chain[e.chain.length-1]===o),hasOpenSubmenu:_store.createSelector.call(void 0, (e,o)=>e.chain.length>o)},Ao=class extends _store.ReactStore{constructor(){super({chain:[]},{},Ts)}open(o){if(this.state.chain.includes(o))return;let r=[...this.state.chain,o];this.set("chain",r)}close(o){let r=this.state.chain.filter(t=>t!==o);this.set("chain",r)}clear(){this.set("chain",[])}};function Gs(e={}){let{onOpenChange:o,defaultOpen:r=!1,virtualized:t=!1,items:a,onHighlightChange:n,closeOnOutsidePress:c="pointerdown",disabled:p=!1,defaultDisabled:g=!1,getResolvedId:l,idScope:i="surface"}=e,d=Me.useRef(null);d.current===null&&(d.current=Gr({getResolvedId:l,idScope:i}));let m=d.current,S=Me.useCallback((k,E,x)=>{_optionalChain([n, 'optionalCall', _16 => _16(k,k===null?null:_nullishCoalesce(m.getNodeById(k), () => (null)),E,x)])},[m,n]),[b,R]=Me.useState(g),y=p||b,L=Me.useCallback(k=>{R(k)},[]);Me.useEffect(()=>{_chunkXMZZ62VJcjs.c.call(void 0, )},[]);let I=Me.useRef(null),N=Me.useCallback((k,E)=>{if(!k&&E.reason===_chunkXMZZ62VJcjs.a.focusOut&&I.current){let x=I.current;I.current=null;let w=_chunkXMZZ62VJcjs.b.call(void 0, _chunkXMZZ62VJcjs.a.outsidePress,x);_optionalChain([o, 'optionalCall', _17 => _17(k,w)]),w.isCanceled&&E.cancel();return}I.current=null,_optionalChain([o, 'optionalCall', _18 => _18(k,E)])},[o]),M=_chunkXMZZ62VJcjs.y.useStore(void 0,{open:r},{onOpenChange:N}),v=M.useState("open"),s=Me.useRef(null);s.current||(s.current=new uo);let u=s.current,h=Me.useRef(null);h.current||(h.current=new Ao);let P=h.current,D=Me.useRef(new Map),F=Me.useCallback((k,E)=>{let x=Math.random().toString(36).slice(2);return D.current.set(x,{depth:k,setOpen:E}),()=>{D.current.delete(x)}},[]),T=Me.useCallback((k=_chunkXMZZ62VJcjs.a.itemPress,E)=>{let x=[...D.current.values()].sort((w,z)=>z.depth-w.depth);for(let w of x)w.setOpen(!1);M.setOpen(!1,k,E),u.clearOwner(),P.clear()},[M,u,P]),f=Me.useRef(T);f.current=T,Me.useEffect(()=>{if(!v||y){I.current=null;return}let k=E=>{let x=E.target;if(!x)return;let w=x.closest("[data-open]")!==null,z=x.closest("[data-popup-open]")!==null;c==="pointerdown"&&!(w||z)?f.current(_chunkXMZZ62VJcjs.a.outsidePress,E):I.current=E};return document.addEventListener("pointerdown",k,!0),()=>{document.removeEventListener("pointerdown",k,!0),I.current=null}},[v,c,y]);let G=Me.useCallback((k,E=_chunkXMZZ62VJcjs.a.none,x)=>{let w=E===_chunkXMZZ62VJcjs.a.imperativeAction;y&&!w||(M.setOpen(k,E,x),k||(u.clearOwner(),P.clear()))},[M,u,P,y]),O=Me.useMemo(()=>{if(!(!t&&!n))return{virtualized:t,items:_nullishCoalesce(a, () => ([])),onHighlightChange:S}},[t,a,S,n]);return{menuTreeResolver:m,store:M,focusOwnerStore:u,openChainStore:P,registerSurface:F,closeAll:T,virtualization:O,handleOpenChange:G,disabled:y,setDisabled:L}}var Es=140;function En(e){let{surfaceId:o,store:r}=e,[t,a]=Re.useState([]),n=Re.useRef(t);Re.useEffect(()=>{n.current=t},[t]);let c=Re.useRef(new Map),p=Re.useRef(new Set),g=Re.useRef(new Map),[,l]=Re.useState(0),[i,d]=Re.useState(!1),m=Re.useRef(null),S=Re.useCallback(()=>{m.current!==null&&(clearTimeout(m.current),m.current=null)},[]),b=Re.useCallback(()=>{d(!0),S(),m.current=setTimeout(()=>{m.current=null,d(!1)},Es)},[S]);Re.useEffect(()=>S,[S]);let R=Re.useCallback(f=>{let G={surfaceId:f.surfaceId,closeRootOnEsc:f.closeRootOnEsc},O=g.current.get(f.pageId);return O?(process.env.NODE_ENV!=="production"&&!p.current.has(f.pageId)&&(p.current.add(f.pageId),console.warn(`PopupMenu: page ID "${f.pageId}" is registered more than once in this popup. The first registration wins. Give each Subpage a unique pageId; data-first subpages use the node's Resolved ID.`)),O.push(G)):(g.current.set(f.pageId,[G]),c.current.set(f.pageId,G),l(k=>k+1)),()=>{let k=g.current.get(f.pageId);if(!k)return;let E=k.indexOf(G);if(E===-1)return;let x=E===0;if(k.splice(E,1),!x)return;let w=k[0];if(w){c.current.set(f.pageId,w),l(z=>z+1);return}g.current.delete(f.pageId),c.current.delete(f.pageId),l(z=>z+1),a(z=>z.includes(f.pageId)?z.filter(U=>U!==f.pageId):z)}},[]),y=Re.useCallback(f=>{if(!c.current.has(f))return!1;let G=n.current;return G[G.length-1]===f?!1:(a(k=>[...k,f]),b(),!0)},[b]),L=Re.useCallback(()=>n.current.length===0?!1:(a(G=>G.slice(0,-1)),b(),!0),[b]),I=Re.useCallback(f=>_nullishCoalesce(_optionalChain([c, 'access', _19 => _19.current, 'access', _20 => _20.get, 'call', _21 => _21(f), 'optionalAccess', _22 => _22.surfaceId]), () => (null)),[]),N=Re.useCallback(()=>{a([]),d(!1),S()},[S]);Re.useEffect(()=>{if(!r)return;let f=r.context.onPopupCloseComplete,G=()=>{_optionalChain([f, 'optionalCall', _23 => _23()]),N()};return r.context.onPopupCloseComplete=G,()=>{r.context.onPopupCloseComplete===G&&(r.context.onPopupCloseComplete=f),S()}},[r,N,S]);let M=_nullishCoalesce(t[t.length-1], () => (null)),v=M===null?void 0:c.current.get(M),s=M===null?o:_nullishCoalesce(_optionalChain([v, 'optionalAccess', _24 => _24.surfaceId]), () => (o)),u=M===null?!0:_nullishCoalesce(_optionalChain([v, 'optionalAccess', _25 => _25.closeRootOnEsc]), () => (!0)),h=t.length>0,P=t,D=_nullishCoalesce(P[P.length-1], () => (null)),F=D!==null;return{subpageStackContextValue:Re.useMemo(()=>({activePageId:M,rootSurfaceId:o,activeSurfaceId:s,canGoBack:h,shouldCloseRootOnEsc:u,stack:t,registerPage:R,openPage:y,goBack:L,getSurfaceId:I}),[M,o,s,h,u,t,R,y,L,I]),isSubpageNavigating:i,hasOpenSubpage:F,subpageId:D,openSubpageIds:P}}var _popover = require('@base-ui/react/popover');var An=Fo.createContext(null);function q(){return Fo.useContext(An)}function W(e,o){if(e)return`bazzaui-${e}-${o}`}var _jsxruntime = require('react/jsx-runtime');var Fs=Er.forwardRef(function(o,r){let t=q(),a=W(t,"arrow");return _jsxruntime.jsx.call(void 0, _popover.Popover.Arrow,{ref:r,...a?{[a]:""}:{},...o})});var Hs=Ar.forwardRef(function(o,r){let{showOn:t,...a}=o,n=Ue(),c=It(),p=ye(),g=n!==null,l=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _26 => _26.childSurfaceId]), () => ("")),i=_nullishCoalesce(t, () => ((g?"focus":"open"))),d=c.useState("isOpen",l),m=c.useState("isLast",l),S=p.useState("isOwner",l),b=!0;g&&(i==="open"?b=d:m?b=S:b=d);let R=q(),y=W(R,"backdrop");if(!b)return null;let L=_chunkPCNHYMD6cjs.c.call(void 0, a.style,I=>({pointerEvents:"none",...I}));return _jsxruntime.jsx.call(void 0, _popover.Popover.Backdrop,{ref:r,...y?{[y]:""}:{},...a,style:L})});var Fn=(m=>(m.slot="bazzaui-[component]-popup",m.open="data-open",m.closed="data-closed",m.side="data-side",m.align="data-align",m.startingStyle="data-starting-style",m.endingStyle="data-ending-style",m.instant="data-instant",m.focused="data-focused",m.hasOpenSubmenu="data-has-open-submenu",m.submenu="data-submenu",m.navigating="data-navigating",m))(Fn||{});var Fr=co.createContext(null);function Zu(){let e=co.useContext(Fr);if(!e)throw new Error("Combobox components must be used within a Combobox.Root");return e}function Qt(){return co.useContext(Fr)}var po=tt.createContext(null),lo= exports.z =tt.createContext(null);function Bn(){let e=tt.useContext(po);if(!e)throw new Error("useDataSurfaceContext must be used within a DataSurface component");return e}function Vn(){return tt.useContext(po)}function Bo(){let e=tt.useContext(lo);if(!e)throw new Error("Data components must be used within PopupMenu.Popup");return e}function Br(){return tt.useContext(lo)}var fo=tt.createContext(null);function zs(){let e=tt.useContext(fo);if(!e)throw new Error("useDataList must be used within a List component");return e}function Qs(){return tt.useContext(fo)}var mo=Vo.createContext(null);function Vr(){return Vo.useContext(mo)}var Hn=ue.createContext(null);function Nt(){return ue.useContext(Hn)}function go(){return ue.useContext(Hn)}function Hr(e){let{children:o,searchQuery:r}=e,[t,a]=ue.useState(()=>new Map),[n,c]=ue.useState(null),[p,g]=ue.useState(()=>new Map),[l,i]=ue.useState(null),d=ue.useCallback(w=>{c(w)},[]),m=ue.useCallback(()=>{c(null),i(null)},[]),S=ue.useCallback(w=>{c(z=>z&&{...z,result:w}),w.isError&&w.error?i(w.error):w.isError||i(null)},[]),b=ue.useCallback(w=>{a(z=>{let A=new Map(z);return A.set(w.id,w),A})},[]),R=ue.useCallback(w=>{a(z=>{let A=new Map(z);return A.delete(w),A}),g(z=>{let A=new Map(z);return A.delete(w),A})},[]),y=ue.useCallback((w,z)=>{a(A=>{let U=A.get(w);if(!U)return A;let $=new Map(A);return $.set(w,{...U,result:z}),$}),z.isError&&z.error?g(A=>{let U=new Map(A);return U.set(w,z.error),U}):z.isError||g(A=>{if(!A.has(w))return A;let U=new Map(A);return U.delete(w),U})},[]),L=ue.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _27 => _27.config, 'access', _28 => _28.type])==="static"&&n.result.isFetching)return!0;for(let[,w]of t)if(w.config.type==="static"&&w.result.isFetching)return!0;return!1},[t,n]),I=ue.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _29 => _29.config, 'access', _30 => _30.type])==="static"&&n.result.isLoading)return!0;for(let[,w]of t)if(w.config.type==="static"&&w.result.isLoading)return!0;return!1},[t,n]),N=ue.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _31 => _31.config, 'access', _32 => _32.type])==="static"&&n.result.isInitialLoading)return!0;for(let[,w]of t)if(w.config.type==="static"&&w.result.isInitialLoading)return!0;return!1},[t,n]),M=ue.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _33 => _33.config, 'access', _34 => _34.type])==="static"&&n.result.isRefetching)return!0;for(let[,w]of t)if(w.config.type==="static"&&w.result.isRefetching)return!0;return!1},[t,n]),v=ue.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _35 => _35.config, 'access', _36 => _36.type])==="query"&&n.result.isFetching)return!0;for(let[,w]of t)if(w.config.type==="query"&&w.result.isFetching)return!0;return!1},[t,n]),s=ue.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _37 => _37.config, 'access', _38 => _38.type])==="query"&&n.result.isLoading)return!0;for(let[,w]of t)if(w.config.type==="query"&&w.result.isLoading)return!0;return!1},[t,n]),u=ue.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _39 => _39.config, 'access', _40 => _40.type])==="query"&&n.result.isInitialLoading)return!0;for(let[,w]of t)if(w.config.type==="query"&&w.result.isInitialLoading)return!0;return!1},[t,n]),h=ue.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _41 => _41.config, 'access', _42 => _42.type])==="query"&&n.result.isRefetching)return!0;for(let[,w]of t)if(w.config.type==="query"&&w.result.isRefetching)return!0;return!1},[t,n]),P=(_nullishCoalesce(_optionalChain([n, 'optionalAccess', _43 => _43.result, 'access', _44 => _44.isFetching]), () => (!1)))||L||v,D=(_nullishCoalesce(_optionalChain([n, 'optionalAccess', _45 => _45.result, 'access', _46 => _46.isLoading]), () => (!1)))||I||s,F=(_nullishCoalesce(_optionalChain([n, 'optionalAccess', _47 => _47.result, 'access', _48 => _48.isInitialLoading]), () => (!1)))||N||u,T=(_nullishCoalesce(_optionalChain([n, 'optionalAccess', _49 => _49.result, 'access', _50 => _50.isRefetching]), () => (!1)))||M||h,f=ue.useMemo(()=>{if(t.size===0&&!n)return!1;for(let[,w]of t)if(!w.result.isRefetching)return!1;return n?n.result.isRefetching:!0},[t,n]),G=ue.useMemo(()=>_nullishCoalesce(_optionalChain([n, 'optionalAccess', _51 => _51.result, 'access', _52 => _52.isLoading]), () => (!1)),[n]),O=ue.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _53 => _53.result, 'access', _54 => _54.isFetching]))return!1;for(let[,w]of t)if(w.result.isFetching)return!1;return!0},[t,n]),k=ue.useCallback(()=>{let w=[];_optionalChain([n, 'optionalAccess', _55 => _55.result, 'access', _56 => _56.data])&&!l&&w.push({kind:"root",nodes:n.result.data});for(let[z,A]of t)p.has(z)||A.result.data&&w.push({kind:"branch",id:z,nodes:A.result.data});return w},[t,p,n,l]),E=ue.useCallback(()=>{let w=[];l&&w.push({kind:"root",reason:"error"});for(let[z]of p)w.push({kind:"branch",id:z,reason:"error"});return{isLoading:D,isFetching:P,isInitialLoading:F,isRefetching:T,isAllRefetching:f,isStaticLoading:I,isStaticInitialLoading:N,isStaticRefetching:M,isQueryLoading:s,isQueryInitialLoading:u,isQueryRefetching:h,skippedMenus:w}},[P,D,F,T,f,I,N,M,s,u,h,p,l]),x=ue.useMemo(()=>({registerLoader:b,unregisterLoader:R,updateLoaderResult:y,registerRootLoader:d,unregisterRootLoader:m,updateRootLoaderResult:S,searchQuery:r,loaders:t,root:n,isAnyLoading:D,isAnyFetching:P,isAnyInitialLoading:F,isAnyRefetching:T,isAllRefetching:f,isRootLoading:G,isStaticLoading:I,isStaticFetching:L,isStaticInitialLoading:N,isStaticRefetching:M,isQueryLoading:s,isQueryFetching:v,isQueryInitialLoading:u,isQueryRefetching:h,allResolved:O,getAsyncNodes:k,erroredLoaders:p,rootError:l,getAsyncState:E}),[b,R,y,d,m,S,r,t,n,D,P,F,T,f,G,I,L,N,M,s,v,u,h,O,k,p,l,E]);return _jsxruntime.jsx.call(void 0, Hn.Provider,{value:x,children:o})}function jr(e){return e.kind==="link-item"}function zr(e){return e.kind==="tree-item"}function he(e,o){return e.def.kind===o}function Ze(e){let o=e.def.kind;return o==="item"||o==="link-item"||o==="radio-item"||o==="checkbox-item"||o==="submenu"||o==="subpage"||o==="tree-item"}function qs(e){return e.initialQueryBehavior!==void 0?e.initialQueryBehavior===!1?!1:{value:_nullishCoalesce(e.initialQueryBehavior.value, () => ("")),loadWhen:_nullishCoalesce(e.initialQueryBehavior.loadWhen, () => ("needed"))}:e.initialQuery!==void 0?{value:e.initialQuery,loadWhen:"needed"}:{value:"",loadWhen:"needed"}}function Ws(e,o){let r=_nullishCoalesce(e.minQueryLength, () => (1)),t=qs(e);return o.length>=r?{effectiveQuery:o,enabled:!0,isBelowMinLength:!1}:t!==!1?{effectiveQuery:t.value,enabled:!0,isBelowMinLength:!1}:{effectiveQuery:"",enabled:!1,isBelowMinLength:!0}}function jn(e,o,r){let t=e.def;if(!t.asyncNodes||!r)return;let a=r.loaders.get(e.id);if(!a)return;let n=t.asyncNodes.type==="query"?Ws(t.asyncNodes,o).isBelowMinLength:!1;return{status:a.result.status,fetchStatus:a.result.fetchStatus,loadingPhase:a.result.loadingPhase,isLoading:a.result.isLoading,isFetching:a.result.isFetching,isInitialLoading:a.result.isInitialLoading,isRefetching:a.result.isRefetching,isError:a.result.isError,error:a.result.error,isBelowMinLength:n}}function Ho(e,o=[],r=null){let t=[];for(let a of e){let n=a.def;if(n.kind!=="separator"){if(n.kind==="group"){t.push(...Ho(a.children,o,{id:n.id,label:n.label}));continue}if(n.kind==="radio-group"){if(n.hidden)continue;t.push(...Ho(a.children,o,null));continue}if(!n.hidden&&(n.kind==="submenu"||n.kind==="subpage")&&(n.kind==="subpage"&&t.push({node:a,pageId:a.id,context:{search:null,breadcrumbs:o,isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(n.disabled, () => (!1)),group:r,tree:null}}),a.children.length)){let c={node:n,menuNode:a,value:n.value,id:n.id};t.push(...Ho(a.children,[...o,c],null))}}}return t}function Qr(e){let{children:o}=e,r=Nt(),t=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _57 => _57.searchQuery]), () => ("")),{dataSurfaceContext:a,resolvedNodes:n}=Bo(),c=n&&(!a||n.content===a.content)?n:null,p=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _58 => _58.nodes]), () => ([])),g=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _59 => _59.graftVersion]), () => (0)),l=Ae.useMemo(()=>Ho(p),[p,g]),i=Ae.useCallback(m=>{let{node:S,context:b,pageId:R}=m,y=S.def,L={node:y,menuNode:S,value:y.value,id:y.id},I=(M,v)=>{let s=M.def,u=M.id;if(s.kind==="item")return _jsxruntime.jsx.call(void 0, Ae.Fragment,{children:s.render({node:M,props:{id:u,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1)),closeOnClick:s.closeOnClick,onSelect:s.onSelect,shortcut:s.shortcut},context:{...v,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1))}})},u);if(s.kind==="link-item")return _jsxruntime.jsx.call(void 0, Ae.Fragment,{children:s.render({node:M,props:{id:u,value:s.value,href:s.href,disabled:_nullishCoalesce(s.disabled, () => (!1)),closeOnClick:s.closeOnClick,onSelect:s.onSelect,shortcut:s.shortcut,forceOrder:s.forceOrder,forceScore:s.forceScore},context:{...v,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1))}})},u);if(s.kind==="checkbox-item")return _jsxruntime.jsx.call(void 0, Ae.Fragment,{children:s.render({node:M,props:{id:u,value:s.value,checked:s.checked,onCheckedChange:s.onCheckedChange,disabled:_nullishCoalesce(s.disabled, () => (!1)),closeOnClick:s.closeOnClick},context:{...v,value:s.value,checked:s.checked,disabled:_nullishCoalesce(s.disabled, () => (!1))}})},u);if(s.kind==="radio-item")return _jsxruntime.jsx.call(void 0, Ae.Fragment,{children:s.render({node:M,props:{id:u,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1)),closeOnClick:s.closeOnClick,onSelect:s.onSelect,shortcut:s.shortcut},context:{...v,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1))}})},u);if(s.kind==="submenu"){let D=jn(M,t,r),F=ft(M),T={node:s,menuNode:M,value:s.value,id:s.id},f=G=>{let O=G.def;if(O.kind==="separator")return null;if(O.kind==="group"){let k=G.children.filter(x=>(x.def.kind==="item"||x.def.kind==="link-item"||x.def.kind==="checkbox-item"||x.def.kind==="submenu"||x.def.kind==="subpage")&&!x.def.hidden);if(k.length===0)return null;let E=k.map(x=>I(x,{search:null,breadcrumbs:[...v.breadcrumbs,T],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(x.def.disabled, () => (!1)),group:{id:O.id,label:O.label},tree:null}));if(O.render){let x={search:null,matchCount:k.length,breadcrumbs:[...v.breadcrumbs,T],isDeepSearchResult:!1},w=G;return _jsxruntime.jsx.call(void 0, Ae.Fragment,{children:O.render({node:w,props:{},context:{...x,label:O.label},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:E})})},O.id)}return _jsxruntime.jsx.call(void 0, "div",{role:"group","aria-label":O.label,children:E},O.id)}return O.kind==="radio-group"?N(G,[...v.breadcrumbs,T]):O.kind!=="item"&&O.kind!=="link-item"&&O.kind!=="checkbox-item"&&O.kind!=="submenu"&&O.kind!=="subpage"?null:I(G,{search:null,breadcrumbs:[...v.breadcrumbs,T],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(O.disabled, () => (!1)),group:null,tree:null})};return _jsxruntime.jsx.call(void 0, Ae.Fragment,{children:s.render({node:M,props:{id:u,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1))},context:{...v,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1)),async:D},nodes:F,asyncContent:s.asyncNodes,renderNode:f})},u)}if(s.kind!=="subpage")return null;let h=jn(M,t,r),P=M.id;return _jsxruntime.jsx.call(void 0, Ae.Fragment,{children:s.renderTrigger({node:M,props:{id:u,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1)),targetPageId:P},context:{...v,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1)),async:h}})},P)},N=(M,v=[])=>{let s=M.def,u=v.length>0,h={search:null,matchCount:s.nodes.length,breadcrumbs:v,isDeepSearchResult:u},P=M.children.map(D=>!Ze(D)||D.def.hidden?null:I(D,{search:null,breadcrumbs:v,isDeepSearchResult:u,highlighted:!1,disabled:_nullishCoalesce(D.def.disabled, () => (!1)),group:null,tree:null}));return s.render?_jsxruntime.jsx.call(void 0, Ae.Fragment,{children:s.render({node:M,props:{value:s.value,onValueChange:s.onValueChange,disabled:_nullishCoalesce(s.disabled, () => (!1))},context:{...h,label:s.label,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1))},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:P})})},s.id):_jsxruntime.jsx.call(void 0, "div",{role:"radiogroup","aria-label":s.label,children:P},s.id)};return _jsxruntime.jsx.call(void 0, Ae.Fragment,{children:_jsxruntime.jsx.call(void 0, mo.Provider,{value:S,children:y.renderContent({node:S,pageId:R,context:{...b,value:y.value,disabled:_nullishCoalesce(y.disabled, () => (!1)),async:jn(S,t,r)},nodes:ft(S),asyncContent:y.asyncNodes,renderNode:M=>{let v=M.def;if(v.kind==="separator")return null;if(v.kind==="group"){let s=M.children.filter(h=>(h.def.kind==="item"||h.def.kind==="link-item"||h.def.kind==="checkbox-item"||h.def.kind==="submenu"||h.def.kind==="subpage")&&!h.def.hidden);if(s.length===0)return null;let u=s.map(h=>I(h,{search:null,breadcrumbs:[...b.breadcrumbs,L],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(h.def.disabled, () => (!1)),group:{id:v.id,label:v.label},tree:null}));if(v.render){let h={search:null,matchCount:s.length,breadcrumbs:[...b.breadcrumbs,L],isDeepSearchResult:!1},P=M;return _jsxruntime.jsx.call(void 0, Ae.Fragment,{children:v.render({node:P,props:{},context:{...h,label:v.label},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:u})})},v.id)}return _jsxruntime.jsx.call(void 0, "div",{role:"group","aria-label":v.label,children:u},v.id)}return v.kind==="radio-group"?N(M,[...b.breadcrumbs,L]):v.kind!=="item"&&v.kind!=="link-item"&&v.kind!=="checkbox-item"&&v.kind!=="submenu"&&v.kind!=="subpage"?null:I(M,{search:null,breadcrumbs:[...b.breadcrumbs,L],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(v.disabled, () => (!1)),group:null,tree:null})}})})},R)},[r,t]);if(!a)return null;let d={subpages:l,renderSubpageContent:i};return o?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:o(d)}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:l.map(i)})}function Kr(e,o,r){return Math.min(r,Math.max(o,e))}function ho(e,o){return typeof e!="number"||Number.isNaN(e)?o:e}var qr={enabled:!1,idleColor:"#0088ff",successColor:"#00aa66",missColor:"#ff3b30",triangleFillOpacity:.2,overlayOpacity:1,showStroke:!0,strokeWidth:1.5,strokeDasharray:"6 4",showDots:!0,dotRadius:4,freezeOnPointerLeave:!0,persistOnSuccess:!0,showMissState:!1,missFreezeDuration:220};function Wr(e,o){let r=qr;if(typeof e=="boolean")return{...r,enabled:e};if(!e)return{...r,enabled:!!o};let t=Kr(ho(e.triangleFillOpacity,r.triangleFillOpacity),0,1),a=Kr(ho(e.overlayOpacity,r.overlayOpacity),0,1),n=Math.max(0,ho(e.strokeWidth,r.strokeWidth)),c=Math.max(0,ho(e.dotRadius,r.dotRadius)),p=Math.max(0,ho(e.missFreezeDuration,r.missFreezeDuration));return{...r,...e,enabled:_nullishCoalesce(e.enabled, () => (!0)),idleColor:_nullishCoalesce(e.idleColor, () => (r.idleColor)),successColor:_nullishCoalesce(e.successColor, () => (r.successColor)),missColor:_nullishCoalesce(e.missColor, () => (r.missColor)),triangleFillOpacity:t,overlayOpacity:a,showStroke:_nullishCoalesce(e.showStroke, () => (r.showStroke)),strokeWidth:n,strokeDasharray:_nullishCoalesce(e.strokeDasharray, () => (r.strokeDasharray)),showDots:_nullishCoalesce(e.showDots, () => (r.showDots)),dotRadius:c,freezeOnPointerLeave:_nullishCoalesce(e.freezeOnPointerLeave, () => (r.freezeOnPointerLeave)),persistOnSuccess:_nullishCoalesce(e.persistOnSuccess, () => (r.persistOnSuccess)),showMissState:_nullishCoalesce(e.showMissState, () => (r.showMissState)),missFreezeDuration:p}}var Us={showSafeTriangleArea:qr,logAimGuardEvents:!1},zn=jo.createContext(Us);function zo(){return jo.useContext(zn)}var Ur=le.createContext({aimGuardActive:!1,guardedTriggerId:null,guardedDepth:null,guardedSubmenuSurfaceId:null,activateAimGuard:()=>{},clearAimGuard:()=>{},aimGuardActiveRef:{current:!1},guardedTriggerIdRef:{current:null},guardedDepthRef:{current:null},guardedSubmenuSurfaceIdRef:{current:null},isGuardBlocking:()=>!1}),Kt=()=>le.useContext(Ur);function Zr({children:e}){let{logAimGuardEvents:o}=zo(),[r,t]=le.useState(!1),[a,n]=le.useState(null),[c,p]=le.useState(null),[g,l]=le.useState(null),i=le.useRef(!1),d=le.useRef(null),m=le.useRef(null),S=le.useRef(null);le.useEffect(()=>{i.current=r},[r]),le.useEffect(()=>{d.current=a},[a]),le.useEffect(()=>{m.current=c},[c]),le.useEffect(()=>{S.current=g},[g]);let b=le.useRef(null),R=le.useCallback((v,s)=>{!o||typeof window>"u"||console.log(`[PopupMenu][AimGuardProvider] ${v}`,{aimGuardActive:i.current,guardedTriggerId:d.current,guardedDepth:m.current,guardedSubmenuSurfaceId:S.current,...s})},[o]),y=le.useCallback(()=>{i.current=!1,d.current=null,m.current=null,S.current=null,t(!1),n(null),p(null),l(null)},[]),L=le.useCallback(()=>{b.current!==null&&(window.clearTimeout(b.current),b.current=null),R("clear"),y()},[y,R]),I=le.useCallback((v,s,u,h=450)=>{R("activate",{triggerId:v,depth:s,submenuSurfaceId:u,timeoutMs:h}),i.current=!0,d.current=v,m.current=s,S.current=u,n(v),p(s),l(u),t(!0),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>{R("timeout-expired",{triggerId:v,depth:s,submenuSurfaceId:u}),y(),b.current=null},h)},[y,R]);le.useEffect(()=>()=>{b.current!==null&&(window.clearTimeout(b.current),b.current=null),R("provider-unmount-clear")},[R]);let N=le.useCallback(v=>i.current&&d.current!==v,[]),M=le.useMemo(()=>({aimGuardActive:r,guardedTriggerId:a,guardedDepth:c,guardedSubmenuSurfaceId:g,activateAimGuard:I,clearAimGuard:L,aimGuardActiveRef:i,guardedTriggerIdRef:d,guardedDepthRef:m,guardedSubmenuSurfaceIdRef:S,isGuardBlocking:N}),[r,a,c,g,I,L,N]);return _jsxruntime.jsx.call(void 0, Ur.Provider,{value:M,children:e})}var Ys=Se.forwardRef(function(o,r){let{children:t,className:a,render:n,...c}=o,p=Ue(),{clearAimGuard:g,aimGuardActiveRef:l,guardedSubmenuSurfaceIdRef:i}=Kt(),d=ye(),m=It(),S=lt(),b=_nullishCoalesce(_optionalChain([S, 'optionalAccess', _60 => _60.depth]), () => (0)),R=Qt(),y=Se.useId(),L=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _61 => _61.childSurfaceId]), () => (y)),{subpageStackContextValue:I,isSubpageNavigating:N,hasOpenSubpage:M,subpageId:v,openSubpageIds:s}=En({surfaceId:L,store:_nullishCoalesce(_optionalChain([S, 'optionalAccess', _62 => _62.store]), () => (null))}),[u,h]=Se.useState(null),[P,D]=Se.useState(null),F=I.activeSurfaceId,T=Se.useRef(0);Se.useEffect(()=>{_optionalChain([p, 'optionalAccess', _63 => _63.open])&&(T.current=Date.now())},[_optionalChain([p, 'optionalAccess', _64 => _64.open])]);let f=d.useState("isOwner",F),G=m.useState("hasOpenSubmenu",b),O=Se.useRef(null),k=Se.useCallback(C=>{O.current=C,typeof r=="function"?r(C):r&&(r.current=C),_optionalChain([p, 'optionalAccess', _65 => _65.contentRef])&&(p.contentRef.current=C)},[r,p]);Se.useEffect(()=>{b===0&&_optionalChain([S, 'optionalAccess', _66 => _66.store, 'access', _67 => _67.setPopupRef, 'call', _68 => _68(O)])},[b,S]);let E=Se.useCallback(()=>{p&&l.current&&i.current===L&&g()},[p,l,i,L,g]);Se.useEffect(()=>{_optionalChain([p, 'optionalAccess', _69 => _69.open])!==!1||!l.current||i.current!==L||g()},[_optionalChain([p, 'optionalAccess', _70 => _70.open]),l,i,L,g]),Se.useEffect(()=>()=>{l.current&&i.current===L&&g()},[l,i,L,g]);let x=Se.useCallback(C=>{if(Date.now()-T.current<100||!p)return;let B=C.target;if(!_optionalChain([O, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.contains, 'call', _73 => _73(B)]))return;let J=B instanceof Element?B:B.parentElement;if(J){let ne=J.closest("[data-base-ui-focusable]");if(ne&&ne!==O.current)return}d.state.ownerId!==p.childSurfaceId&&d.setOwnerId(p.childSurfaceId)},[p,d]),w=p||R?!1:void 0,z=p||R?!1:void 0,A=_optionalChain([R, 'optionalAccess', _74 => _74.layout])==="input-embedded",U=!!p,$=Se.useCallback(C=>({...C,isSubmenu:U,hasOpenSubpage:M,subpageId:v,openSubpageIds:s}),[M,U,s,v]),ae=Se.useMemo(()=>typeof a=="function"?C=>a($(C)):a,[a,$]),H=Se.useMemo(()=>typeof n=="function"?(C,j)=>n(C,$(j)):n,[n,$]),se=q(),K=W(se,"popup"),V=Se.useMemo(()=>({dataSurfaceContext:u,setDataSurfaceContext:h,resolvedNodes:P,setResolvedNodes:D}),[u,P]);return _jsxruntime.jsx.call(void 0, jt.Provider,{value:L,children:_jsxruntime.jsx.call(void 0, ao.Provider,{value:I,children:_jsxruntime.jsx.call(void 0, lo.Provider,{value:V,children:_jsxruntime.jsxs.call(void 0, _popover.Popover.Popup,{ref:k,initialFocus:w,finalFocus:z,className:ae,render:H,"data-input-embedded":A?"":void 0,...K?{[K]:""}:{},"data-focused":f?"":void 0,"data-has-open-submenu":G?"":void 0,"data-submenu":U?"":void 0,"data-navigating":N?"":void 0,onPointerMove:C=>{E(),x(C),_optionalChain([c, 'access', _75 => _75.onPointerMove, 'optionalCall', _76 => _76(C)])},...c,children:[t,_jsxruntime.jsx.call(void 0, Qr,{})]})})})})});var Js=_popover.Popover.Portal;var $r=(p=>(p.availableWidth="--available-width",p.availableHeight="--available-height",p.anchorWidth="--anchor-width",p.anchorHeight="--anchor-height",p.transformOrigin="--transform-origin",p.positionerWidth="--positioner-width",p.positionerHeight="--positioner-height",p))($r||{});var _reactdom = require('react-dom');var Yr=.5;function oa(e){if(Xr(e))return{side:"shift",align:"shift"}}function Xr(e){return e==="left"||e==="right"||e==="inline-start"||e==="inline-end"}var na=xe.forwardRef(function(o,r){let{side:t,align:a,alignOffset:n,collisionAvoidance:c,virtualAnchor:p,style:g,...l}=o,{store:i,depth:d,virtualAnchor:m,menuType:S}=Ee(),b=Ue(),R=xe.useRef(0),y=xe.useRef(!1),[,L]=xe.useReducer(K=>K+1,0),I=xe.useRef(!1),N=xe.useRef({first:null,second:null}),M=xe.useCallback(()=>{if(typeof window>"u"){N.current.first=null,N.current.second=null;return}N.current.first!==null&&(window.cancelAnimationFrame(N.current.first),N.current.first=null),N.current.second!==null&&(window.cancelAnimationFrame(N.current.second),N.current.second=null)},[]),v=xe.useCallback(()=>{M(),I.current=!1},[M]),s=xe.useCallback(()=>{M(),I.current=!0,!(typeof window>"u")&&(N.current.first=window.requestAnimationFrame(()=>{N.current.first=null,N.current.second=window.requestAnimationFrame(()=>{N.current.second=null,I.current=!1})}))},[M]),u=d>0,h=u?p:_nullishCoalesce(p, () => (m)),D=_nullishCoalesce(t, () => ((u?"right":"bottom"))),T=_nullishCoalesce(a, () => ((u||S==="context"?"start":"center"))),f=T==="list-start"&&Xr(D),G=T==="list-start"?"start":T,O=_nullishCoalesce(_optionalChain([b, 'optionalAccess', _77 => _77.open]), () => (!1)),k=i.useState("inputActive"),E=i.context.hideUntilActive,x=xe.useRef(k),w=xe.useCallback(()=>{if(!f)return!1;let K=_optionalChain([b, 'optionalAccess', _78 => _78.contentRef, 'access', _79 => _79.current]);if(!K)return!1;let V=K.getBoundingClientRect(),C=K.querySelector('[role="listbox"]');if(!C){let ge=R.current;return R.current=0,Math.abs(ge)>Yr}let j=C.getBoundingClientRect(),B=getComputedStyle(C),J=Number.parseFloat(B.paddingTop)||0,ne=-(j.top+J-V.top),te=R.current;return R.current=ne,Math.abs(ne-te)>Yr},[f,b]);xe.useLayoutEffect(()=>{!f||!O||y.current||(w(),y.current=!0,L())},[f,O,w]),xe.useLayoutEffect(()=>{if(!f||!O)return;let K=_optionalChain([b, 'optionalAccess', _80 => _80.contentRef, 'access', _81 => _81.current]);if(!K||typeof ResizeObserver>"u")return;let V=new ResizeObserver(()=>{I.current||w()&&_reactdom.flushSync.call(void 0, ()=>{L()})});V.observe(K);let C=K.querySelector('[role="listbox"]');return C&&V.observe(C),()=>{V.disconnect()}},[f,O,b,w]),xe.useLayoutEffect(()=>{let K=x.current;x.current=k,!(!f||!O)&&E&&!K&&k&&s()},[f,O,E,k,s]),xe.useEffect(()=>{O||(y.current=!1,R.current=0,v())},[O,v]),xe.useEffect(()=>v,[v]);let z=f?R.current+(typeof n=="number"?n:0):n,A=_nullishCoalesce(c, () => (oa(D))),U=h?{anchor:h}:{},ae=f&&!y.current&&O?{...g,transition:"none"}:g,H=q(),se=W(H,"positioner");return _jsxruntime.jsx.call(void 0, _popover.Popover.Positioner,{ref:r,side:D,align:G,alignOffset:z,collisionAvoidance:A,style:ae,...se?{[se]:""}:{},"data-align":f?"list-start":void 0,...U,...l})});var Kn=Ko.createContext(null);function qo(){return Ko.useContext(Kn)}var qn=Wo.createContext(null);function Uo(){return Wo.useContext(qn)}var Zo= (_class =class{constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }__init() {this.zones=new Map}__init2() {this.surfaces=new Map}registerSurface(o,r){return this.surfaces.set(o,r),()=>{this.surfaces.get(o)===r&&this.surfaces.delete(o)}}getParentSurfaceId(o){return _nullishCoalesce(_optionalChain([this, 'access', _82 => _82.surfaces, 'access', _83 => _83.get, 'call', _84 => _84(o), 'optionalAccess', _85 => _85.parentSurfaceId]), () => (null))}closeSurface(o){_optionalChain([this, 'access', _86 => _86.surfaces, 'access', _87 => _87.get, 'call', _88 => _88(o), 'optionalAccess', _89 => _89.close, 'call', _90 => _90()])}registerZone(o,r,t){let a=this.zones.get(o);return a||(a=new Map,this.zones.set(o,a)),a.set(r,t),()=>{let n=this.zones.get(o);_optionalChain([n, 'optionalAccess', _91 => _91.delete, 'call', _92 => _92(r)]),n&&n.size===0&&this.zones.delete(o)}}getZoneElements(o){let r=this.zones.get(o);return r?[...r.values()].sort((t,a)=>t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1):[]}}, _class);function sa(e){let{store:o,focusOwnerStore:r,openChainStore:t,disabled:a,depth:n,closeAll:c,explicitTabBehavior:p=!1,tabWithoutZones:g="close",registerSurface:l,virtualization:i,debug:d,virtualAnchor:m,menuType:S="dropdown",closeOnOutsidePress:b="pointerdown",componentName:R,children:y,menuTreeResolver:L}=e,I=qt.useRef(null);I.current||(I.current=new Zo);let N=qt.useMemo(()=>({store:o,disabled:a,depth:n,closeAll:c,explicitTabBehavior:p,tabWithoutZones:g,registerSurface:l,virtualization:i,virtualAnchor:m,menuType:S,closeOnOutsidePress:b}),[o,a,n,c,p,g,l,i,m,S,b]),M=qt.useMemo(()=>({store:o,depth:n,closeAll:c,registerSurface:l,virtualization:i}),[o,n,c,l,i]),v=qt.useMemo(()=>({showSafeTriangleArea:Wr(_optionalChain([d, 'optionalAccess', _93 => _93.showSafeTriangleArea]),_optionalChain([d, 'optionalAccess', _94 => _94.showSubmenuSafeTriangleArea])),logAimGuardEvents:_nullishCoalesce(_optionalChain([d, 'optionalAccess', _95 => _95.logAimGuardEvents]), () => (!1))}),[_optionalChain([d, 'optionalAccess', _96 => _96.showSafeTriangleArea]),_optionalChain([d, 'optionalAccess', _97 => _97.showSubmenuSafeTriangleArea]),_optionalChain([d, 'optionalAccess', _98 => _98.logAimGuardEvents])]);return _jsxruntime.jsx.call(void 0, qn.Provider,{value:L,children:_jsxruntime.jsx.call(void 0, An.Provider,{value:R,children:_jsxruntime.jsx.call(void 0, zn.Provider,{value:v,children:_jsxruntime.jsx.call(void 0, pt.Provider,{value:N,children:_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.i.Provider,{value:M,children:_jsxruntime.jsx.call(void 0, Zr,{children:_jsxruntime.jsx.call(void 0, kn.Provider,{value:r,children:_jsxruntime.jsx.call(void 0, In.Provider,{value:t,children:_jsxruntime.jsx.call(void 0, Kn.Provider,{value:I.current,children:y})})})})})})})})})}function Fe(e){let{closeOnClick:o=!0,disabled:r=!1,activatable:t=!0,...a}=e,{aimGuardActiveRef:n,guardedDepthRef:c}=Kt(),{closeAll:p}=_chunkXMZZ62VJcjs.j.call(void 0, ),l=_nullishCoalesce(_optionalChain([lt, 'call', _99 => _99(), 'optionalAccess', _100 => _100.disabled]), () => (!1)),i=r||l,d=Ro.useMemo(()=>({aimGuardActiveRef:n,guardedDepthRef:c}),[n,c]),m=Ro.useCallback(b=>{o&&p()},[o,p]),S=_chunkXMZZ62VJcjs.t.call(void 0, {...a,disabled:i,activatable:t,aimGuard:d,closeOnClick:o,onAfterSelect:m});return Ro.useMemo(()=>({...S,disabled:i}),[S,i])}function Po(e){let{store:o,surfaceId:r,focusOwnerStore:t,depth:a,submenuContext:n,subpageContext:c=null,enabled:p,disabled:g=!1,enableTypeToSearch:l=!1,onKeyDown:i,closeAll:d,skipFocusOwnerCheck:m=!1}=e,S=So.useMemo(()=>n?{setOpen:y=>{y||(n.suppressAutoOpenRef.current=!0),n.setOpen(y)},parentSurfaceId:n.parentSurfaceId,closeRootOnEsc:n.closeRootOnEsc}:null,[n]),b=So.useMemo(()=>c?{goBack:c.goBack,parentSurfaceId:c.parentSurfaceId,closeRootOnEsc:c.closeRootOnEsc}:null,[c]),R=So.useCallback(y=>{y.itemId&&y.closeOnClick&&d()},[d]);return _chunkXMZZ62VJcjs.u.call(void 0, {store:o,surfaceId:r,enabled:p&&!g,onKeyDown:i,onSelect:R,closeAll:d,focusOwner:t,depth:a,submenuContext:S,subpageContext:b,enableTypeToSearch:l,skipFocusOwnerCheck:m})}var _userender = require('@base-ui/react/use-render');function ip(e){return e==null||e===""}function _r(e,o){if(e==null)return"";if(o)return o(e);if(typeof e=="object"&&"label"in e){let r=e.label;if(typeof r=="string")return r}return String(e)}function Jr(e,o){return e==null?"":o?o(e):typeof e=="object"&&"value"in e?String(e.value):String(e)}var es={slot:"bazzaui-[component]-icon",open:"data-popup-open"};var ia={open:e=>e?{[es.open]:""}:null},ua= exports.U =wt.forwardRef(function(o,r){let{render:t,className:a,style:n,children:c,onPointerDown:p,onClick:g,...l}=o,{store:i}=Ee(),d=i.useState("open"),m=Qt(),S=wt.useMemo(()=>({open:d}),[d]),b=wt.useCallback(I=>{m&&I.preventDefault(),_optionalChain([p, 'optionalCall', _101 => _101(I)])},[m,p]),R=wt.useCallback(I=>{if(_optionalChain([g, 'optionalCall', _102 => _102(I)]),!I.defaultPrevented&&m)if(d)m.closeCombobox();else{if((m.multiple?m.values.length>0:m.value!=null)&&!m.multiple){let M=Jr(m.value,m.itemToStringValue),s=_nullishCoalesce(m.itemTextRegistry.get(M), () => (_r(m.value,m.itemToStringLabel)));m.onInputValueChange(s)}m.openCombobox()}},[g,m,d]),y=q(),L=W(y,"icon");return _userender.useRender.call(void 0, {render:t,ref:r,state:S,stateAttributesMapping:ia,props:{...l,...L?{[L]:""}:{},className:_chunkPCNHYMD6cjs.a.call(void 0, a,S),style:_chunkPCNHYMD6cjs.b.call(void 0, n,S),children:c,onPointerDown:b,onClick:R},defaultTagName:"span"})});var pa={first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null},la= exports.V =st.forwardRef(function(o,r){let{render:t,className:a,style:n,children:c,...p}=o,{store:g}=_chunkXMZZ62VJcjs.p.call(void 0, ),l=st.useId(),[i,d]=st.useState(null);st.useLayoutEffect(()=>{if(i)return g.registerRow(l,i,{kind:"empty"})},[i,l,g]);let m=q(),S=W(m,"empty"),b=go(),R=b?b.isRootLoading||b.isAnyLoading&&b.searchQuery.length>0:!1,y=g.useState("hasSearchWithNoResults"),L=!R&&y,I=g.useState("isFirstRow",l),N=g.useState("isLastRow",l),M=st.useMemo(()=>({first:I,last:N}),[I,N]),v=_userender.useRender.call(void 0, {render:t,ref:[d,r],state:M,stateAttributesMapping:pa,props:{...p,...S?{[S]:""}:{},role:"presentation",className:_chunkPCNHYMD6cjs.a.call(void 0, a,M),style:_chunkPCNHYMD6cjs.b.call(void 0, n,M),children:c},defaultTagName:"div"});return L?v:null});var fa=Ke.forwardRef(function(o,r){let{value:t,onValueChange:a,hideUntilActive:n=!1,backspaceGoesBack:c=!1,disabled:p=!1,render:g,className:l,style:i,onKeyDown:d,onPointerDown:m,...S}=o,{store:b,surfaceId:R}=_chunkXMZZ62VJcjs.p.call(void 0, ),{depth:y,closeAll:L}=_chunkXMZZ62VJcjs.j.call(void 0, ),I=Ue(),N=dt(),{disabled:M}=Ee(),v=M||p,s=ye(),u=Ke.useRef(null),h=b.useState("search"),P=b.useState("highlightedId"),D=b.context.listId,F=b.context.inputId;Ke.useEffect(()=>(b.setHideUntilActive(n),()=>b.setHideUntilActive(!1)),[b,n]);let T=b.useState("inputActive"),f=b.useState("pendingSearch"),G=!n||T;Ke.useEffect(()=>{if(G)return b.setHasInput(!0),()=>b.setHasInput(!1)},[b,G]);let k=t!==void 0?t:h;Ke.useEffect(()=>{f&&u.current&&(b.setSearch(f),_optionalChain([a, 'optionalCall', _103 => _103(f)]),b.setPendingSearch(""),u.current.focus())},[f,b,a]);let E=Ke.useCallback(H=>{let se=H.target.value;b.setSearch(se),_optionalChain([a, 'optionalCall', _104 => _104(se)])},[a,b]),x=Ke.useCallback(H=>{_optionalChain([m, 'optionalCall', _105 => _105(H)]),!v&&s.state.ownerId!==R&&s.setOwnerId(R)},[m,v,s,R]),{handleKeyDown:w}=Po({store:b,surfaceId:R,focusOwnerStore:s,depth:y,submenuContext:I,subpageContext:N,enabled:!0,disabled:v,enableTypeToSearch:!1,onKeyDown:d,closeAll:L}),z=Ke.useCallback(H=>{if(c&&H.key==="Backspace"&&!H.repeat&&!H.nativeEvent.isComposing&&H.keyCode!==229&&k===""&&N&&N.goBack()){H.preventDefault(),N.parentSurfaceId&&s.setOwnerId(N.parentSurfaceId);return}w(H)},[c,k,N,s,w]),A=Ke.useMemo(()=>({active:T}),[T]),U=q(),$=W(U,"input"),ae=_userender.useRender.call(void 0, {render:g,ref:[u,r],state:A,props:{...S,...$?{[$]:""}:{},id:F,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":!0,"aria-controls":D,"aria-activedescendant":_nullishCoalesce(P, () => (void 0)),autoComplete:"off",autoCorrect:"off",spellCheck:!1,disabled:v,className:_chunkPCNHYMD6cjs.a.call(void 0, l,A),style:_chunkPCNHYMD6cjs.b.call(void 0, i,A),value:k,onChange:E,onKeyDown:z,onPointerDown:x},defaultTagName:"input"});return G?ae:null});var ga={first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null,firstGroup:e=>e?{"data-first-group":""}:null,lastGroup:e=>e?{"data-last-group":""}:null},Wn= exports.X =$o.forwardRef(function(o,r){let{render:t,className:a,style:n,children:c,...p}=o,{store:g}=_chunkXMZZ62VJcjs.p.call(void 0, ),l=_chunkXMZZ62VJcjs.e.call(void 0, ),i=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _106 => _106.groupId]), () => ("")),d=g.useState("isFirstGroup",i),m=g.useState("isLastGroup",i),S=g.useState("isFirstRow",i),b=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _107 => _107.positional, 'optionalAccess', _108 => _108.firstGroup]), () => (d)),R=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _109 => _109.positional, 'optionalAccess', _110 => _110.lastGroup]), () => (m)),y=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _111 => _111.positional, 'optionalAccess', _112 => _112.first]), () => (S)),L=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _113 => _113.positional, 'optionalAccess', _114 => _114.last]), () => (!1)),I=$o.useMemo(()=>({first:y,last:L,firstGroup:b,lastGroup:R}),[y,L,b,R]),N=q(),M=W(N,"group-label");return _userender.useRender.call(void 0, {render:t,ref:r,state:I,stateAttributesMapping:ga,props:{...p,...M?{[M]:""}:{},role:"presentation","aria-hidden":"true",className:_chunkPCNHYMD6cjs.a.call(void 0, a,I),style:_chunkPCNHYMD6cjs.b.call(void 0, n,I),children:c},defaultTagName:"div"})});function Yo(e,o=!0,r=!0,t="exclude"){let a=[];for(let n of e)if(n.def.kind!=="separator"){if(n.def.kind==="group"){a.push(...Yo(ft(n),o,r,t));continue}if(n.def.kind==="radio-group"){if(n.def.hidden)continue;a.push(...Yo(ft(n),o,r,t));continue}if(n.def.kind==="submenu"||n.def.kind==="subpage"){if(n.def.hidden)continue;let c=Un(n.def,o,t),p=r&&c===!0&&n.def.deepSearch!==!1;n.def.asyncNodes&&p&&a.push({id:n.id,node:n,config:n.def.asyncNodes}),p&&a.push(...Yo(ft(n),o,!0,t))}}return a}function Un(e,o,r="exclude"){return e.includeInDeepSearch!==void 0?e.includeInDeepSearch:e.disabled&&r==="exclude"?"trigger-only":o}function Xo(e){return e.type==="query"&&(e.initialQueryBehavior===!1?"needed":_nullishCoalesce(_optionalChain([e, 'access', _115 => _115.initialQueryBehavior, 'optionalAccess', _116 => _116.loadWhen]), () => ("needed")))==="parent-open"?!0:e.loadStrategy==="eager"}function Zn(e,o=!0,r=!0,t="exclude"){let a=new Set,n=[];for(let c of Yo(e,o,r,t))a.has(c.id)||(a.add(c.id),n.push(c));return n}function ts({resolver:e,content:o,asyncContent:r,coordinator:t,graftParent:a,isSubpageSurface:n,isResolutionRoot:c,includeInDeepSearch:p,disabledBranchBehavior:g}){_e.useMemo(()=>{!e||n||(a?e.graft(a,o):c&&e.setContent(o))},[e,o,a,n,c]);let l=_e.useMemo(()=>n&&e?o.map(L=>e.getNodeForDef(L)).filter(L=>L!==void 0):[],[n,e,o]),i=n?_nullishCoalesce(_nullishCoalesce(a, () => (_optionalChain([l, 'access', _117 => _117[0], 'optionalAccess', _118 => _118.parent]))), () => (null)):null,[d,m]=_e.useState(0),S=_e.useMemo(()=>n?_nullishCoalesce(_optionalChain([i, 'optionalAccess', _119 => _119.children]), () => (l)):a?a.children:c&&e?e.rootNodes:[],[n,i,l,a,e,c,o,d]),b=_e.useMemo(()=>Zn(S,p,!0,g),[S,p,g]),R=_e.useRef(new Set);return _e.useEffect(()=>{if(!e||!t||n&&!i)return;let L=new Map(t.getAsyncNodes().filter(s=>s.kind==="branch").map(s=>[s.id,s.nodes])),I=!1,N=(s,u)=>{if(!s)return;let h=s.children;e.graft(s,u),I||=h!==s.children},M=_optionalChain([t, 'access', _120 => _120.getAsyncNodes, 'call', _121 => _121(), 'access', _122 => _122.find, 'call', _123 => _123(s=>s.kind==="root"), 'optionalAccess', _124 => _124.nodes]);if(n&&i){let s=_nullishCoalesce(i.def.nodes, () => ([]));N(i,M?r?M:[...s,...M]:s)}else{let s=M?r?M:[...o,...M]:o;if(a)N(a,s);else if(c){let u=e.rootNodes;e.setContent(s),I||=u!==e.rootNodes}}let v=new Set(b.map(s=>s.node));for(let s of R.current)v.has(s)||N(s,_nullishCoalesce(s.def.nodes, () => ([])));R.current=v;for(let s of b){let u=L.get(s.id),h=_nullishCoalesce(s.node.def.nodes, () => ([]));N(s.node,u?[...h,...u]:h)}I&&m(s=>s+1)},[e,_optionalChain([t, 'optionalAccess', _125 => _125.loaders]),_optionalChain([t, 'optionalAccess', _126 => _126.erroredLoaders]),_optionalChain([t, 'optionalAccess', _127 => _127.root]),o,r,b,a,n,i,c]),{nodes:_e.useMemo(()=>n?_nullishCoalesce(_optionalChain([i, 'optionalAccess', _128 => _128.children]), () => (l)):a?a.children:c&&e?e.rootNodes:[],[n,i,l,a,e,c,o,d]),graftVersion:d,asyncSubmenus:b}}function ba(e){return e}function xo(e){return"kind"in e&&e.kind==="group"}function yo(e){return"kind"in e&&e.kind==="radio-group"}function Mo(e){return"kind"in e&&e.kind==="separator"}function ha(e){return"kind"in e&&e.kind==="row"}function _o(e){let o=[];for(let r of e)he(r,"tree-item")||he(r,"item")||he(r,"submenu")?o.push(r):process.env.NODE_ENV!=="production"&&console.warn(`Unsupported ${r.kind} child skipped inside tree-item.`);return o}function Pt(e,o={}){let{deep:r=!1,includeInDeepSearch:t=!0,disabledBranchBehavior:a="exclude",descendantsIncluded:n=!0,breadcrumbs:c=[],group:p=null,radioGroup:g=null,inheritedKeywords:l=[]}=o,i=[];for(let d of e)if(!he(d,"separator")){if(he(d,"group")){let m={id:d.def.id,label:d.def.label,groupDef:d.def,menuNode:d};i.push(...Pt(d.children,{deep:r,includeInDeepSearch:t,disabledBranchBehavior:a,descendantsIncluded:n,breadcrumbs:c,group:m,radioGroup:null,inheritedKeywords:l}));continue}if(he(d,"radio-group")){if(d.def.hidden)continue;let m={id:d.def.id,label:d.def.label,radioGroupDef:d.def,menuNode:d};i.push(...Pt(d.children,{deep:r,includeInDeepSearch:t,disabledBranchBehavior:a,descendantsIncluded:n,breadcrumbs:c,group:null,radioGroup:m,inheritedKeywords:l}));continue}if(Ze(d)&&!d.def.hidden){if(he(d,"item")||he(d,"radio-item")||he(d,"checkbox-item")||he(d,"link-item")){i.push({node:d,breadcrumbs:c,group:p,radioGroup:g,inheritedKeywords:l});continue}if(he(d,"tree-item")){if(d.def.selectable!==!1&&i.push({node:d,breadcrumbs:c,group:p,radioGroup:g,inheritedKeywords:l}),d.children.length&&d.def.deepSearch!==!1){let m={node:d.def,menuNode:d,value:d.def.value,id:d.def.id};i.push(...Pt(_o(d.children),{deep:r,includeInDeepSearch:t,disabledBranchBehavior:a,descendantsIncluded:n,breadcrumbs:[...c,m],group:p,radioGroup:g,inheritedKeywords:[...l,d.def.value]}))}continue}if(he(d,"submenu")||he(d,"subpage")){let m=Un(d.def,t,a);if((!r||n&&m!==!1)&&i.push({node:d,breadcrumbs:c,group:p,radioGroup:g,inheritedKeywords:l}),r&&n&&m===!0&&d.def.deepSearch!==!1&&d.children.length){let R={node:d.def,menuNode:d,value:d.def.value,id:d.def.id},y=[...c,R];i.push(...Pt(d.children.filter(L=>L.kind==="tree-item"?(process.env.NODE_ENV!=="production"&&console.warn("Unsupported tree-item child skipped inside submenu/subpage."),!1):!0),{deep:r,includeInDeepSearch:t,disabledBranchBehavior:a,descendantsIncluded:!0,breadcrumbs:y,group:null,radioGroup:null,inheritedKeywords:l}))}}}}return i}function $n(e,o,r,t,a,n,c){let p=_o(e.children).filter(m=>!m.def.hidden),g={depth:t,hasChildren:p.length>0,isLastChild:c,ancestorsLast:a,header:e.def.selectable===!1},l=[{kind:"row",node:e,context:{search:null,breadcrumbs:n,isDeepSearchResult:!1,highlighted:e.def.id===o,disabled:_nullishCoalesce(e.def.disabled, () => (!1)),group:r,tree:g}}],i={node:e.def,menuNode:e,value:e.def.value,id:e.def.id},d=[...n,i];return p.forEach((m,S)=>{let b=S===p.length-1;if(he(m,"tree-item")){l.push(...$n(m,o,r,t+1,[...a,c],d,b));return}l.push({kind:"row",node:m,context:{search:null,breadcrumbs:d,isDeepSearchResult:!1,highlighted:m.def.id===o,disabled:_nullishCoalesce(m.def.disabled, () => (!1)),group:r,tree:{depth:t+1,hasChildren:he(m,"submenu")&&m.children.length>0,isLastChild:b,ancestorsLast:[...a,c],header:!1}}})}),l}function Yn(e,o){let r=[];for(let t of e){if(he(t,"separator")){r.push({kind:"separator",node:t});continue}if(he(t,"group")){let n=[],c=t.children.filter(p=>Ze(p)&&!p.def.hidden);for(let p of t.children){if(he(p,"separator")||he(p,"group")||he(p,"radio-group")||!Ze(p)||p.def.hidden)continue;if(he(p,"tree-item")){n.push(...$n(p,o,{id:t.def.id,label:t.def.label},0,[],[],p===c.at(-1)));continue}let g={search:null,breadcrumbs:[],isDeepSearchResult:!1,highlighted:p.def.id===o,disabled:_nullishCoalesce(p.def.disabled, () => (!1)),group:{id:t.def.id,label:t.def.label},tree:null};n.push({kind:"row",node:p,context:g})}if(n.length>0){let p={search:null,matchCount:n.length,breadcrumbs:[],isDeepSearchResult:!1};r.push({kind:"group",node:t,context:p,items:n,bestScore:1})}continue}if(he(t,"radio-group")){if(t.def.hidden)continue;let n=[];for(let c of t.children){if(!Ze(c)||c.def.hidden)continue;let p={search:null,breadcrumbs:[],isDeepSearchResult:!1,highlighted:c.def.id===o,disabled:_nullishCoalesce(c.def.disabled, () => (!1)),group:null,tree:null};n.push({kind:"row",node:c,context:p,radioGroup:{id:t.def.id,label:t.def.label}})}if(n.length>0){let c={search:null,matchCount:n.length,breadcrumbs:[],isDeepSearchResult:!1};r.push({kind:"radio-group",node:t,context:c,items:n,bestScore:1})}continue}if(!Ze(t)||t.def.hidden)continue;if(he(t,"tree-item")){let n=e.filter(c=>Ze(c)&&!c.def.hidden);r.push(...$n(t,o,null,0,[],[],t===n.at(-1)));continue}let a={search:null,breadcrumbs:[],isDeepSearchResult:!1,highlighted:t.def.id===o,disabled:_nullishCoalesce(t.def.disabled, () => (!1)),group:null,tree:null};r.push({kind:"row",node:t,context:a})}return r}function os(e,o){return e.disabled?!0:o.some(r=>r.node.kind!=="tree-item"&&r.node.disabled===!0)}function Xn(e,o,r){return e.map(t=>{let a=t.breadcrumbs.length>0,n={search:o?{query:o,score:t.score}:null,breadcrumbs:t.breadcrumbs,isDeepSearchResult:a,highlighted:t.node.def.id===r,disabled:os(t.node.def,t.breadcrumbs),group:t.group?{id:t.group.id,label:t.group.label}:null,tree:null};return{kind:"row",node:t.node,context:n,radioGroup:t.radioGroup?{id:t.radioGroup.id,label:t.radioGroup.label}:void 0}})}function Co(e,o,r){let t=e.breadcrumbs.length>0,a={search:o?{query:o,score:e.score}:null,breadcrumbs:e.breadcrumbs,isDeepSearchResult:t,highlighted:e.node.def.id===r,disabled:os(e.node.def,e.breadcrumbs),group:e.group?{id:e.group.id,label:e.group.label}:null,tree:null};return{kind:"row",node:e.node,context:a,radioGroup:e.radioGroup?{id:e.radioGroup.id,label:e.radioGroup.label}:void 0}}function Jo(e,o,r=_chunkXMZZ62VJcjs.r){let t=r(o);if(!t)return e.map(({node:n,breadcrumbs:c,group:p,radioGroup:g})=>({node:n,score:1,breadcrumbs:c,group:p,radioGroup:g}));let a=[];for(let{node:n,breadcrumbs:c,group:p,radioGroup:g,inheritedKeywords:l}of e){let i=_chunkXMZZ62VJcjs.r.call(void 0, n.def.value),d=[..._nullishCoalesce(n.def.keywords, () => ([])),...l].map(b=>_chunkXMZZ62VJcjs.r.call(void 0, b)).filter(Boolean),m=_chunkXMZZ62VJcjs.w.call(void 0, i,t,d.length>0?d:void 0),S=_nullishCoalesce(n.def.forceScore, () => (m));S>0&&a.push({node:n,score:S,breadcrumbs:c,group:p,radioGroup:g})}return a}function Lt(e){return _nullishCoalesce(e.forceOrder, () => (0))}function Wt(e,o){let r=Lt(e.node.def)-Lt(o.node.def);return r!==0?r:o.score-e.score}function _n(e){return e==="submenu"||e==="subpage"?1:0}function Jn(e,o){let r=e.forceOrder-o.forceOrder;if(r!==0)return r;let t=e.kindRank-o.kindRank;return t!==0?t:o.score-e.score}function en(e){if(e.length===0)return 0;let o=Number.POSITIVE_INFINITY;for(let r of e){let t=Lt(r.node.def);t<o&&(o=t)}return o===Number.POSITIVE_INFINITY?0:o}function er(e){return[...e].sort(Wt)}function tr(e){let o=new Map;for(let a of e){let n=Lt(a.node.def),c=_nullishCoalesce(o.get(n), () => ({items:[],branches:[]}));a.node.kind==="item"||a.node.kind==="link-item"||a.node.kind==="radio-item"||a.node.kind==="checkbox-item"||a.node.kind==="tree-item"?c.items.push(a):c.branches.push(a),o.set(n,c)}let r=[...o.keys()].sort((a,n)=>a-n),t=[];for(let a of r){let n=o.get(a);n&&t.push(...n.items,...n.branches)}return t}function or(e){let o=new Set,r=[];for(let t of e)o.has(t.node.id)||(o.add(t.node.id),r.push(t));return r}var ns=e=>e;function Ra(e){let{query:o,normalizeQuery:r,nodes:t,highlightedId:a,deepSearch:n=!0,includeInDeepSearch:c=!0,disabledBranchBehavior:p="exclude",minLength:g=0,radioGroupSearchBehavior:l="preserve"}=e,i=n&&o.length>=g,d=Pt(t,{deep:i,includeInDeepSearch:c,disabledBranchBehavior:p}),m=new Map;if(l==="preserve-show-all"){for(let s of d)if(s.radioGroup){let u=m.get(s.radioGroup.id);u?u.items.push(s):m.set(s.radioGroup.id,{radioGroupDef:s.radioGroup.radioGroupDef,menuNode:s.radioGroup.menuNode,items:[s],breadcrumbs:s.breadcrumbs})}}let S=Jo(d,o,r),b=new Map,R=[];for(let s of S)if(s.radioGroup)if(l==="flatten")R.push(s);else{let u=b.get(s.radioGroup.id);u?u.items.push(s):b.set(s.radioGroup.id,{radioGroupDef:s.radioGroup.radioGroupDef,menuNode:s.radioGroup.menuNode,items:[s],breadcrumbs:s.breadcrumbs})}else R.push(s);let y=er(R),L=tr(y),I=or(L),N=Xn(I,o,a),M=[];if(l!=="flatten")for(let[s,{items:u,breadcrumbs:h}]of b){let P;if(l==="preserve-show-all"){let f=m.get(s);if(f){let G=new Map(u.map(O=>[O.node.id,O.score]));P=f.items.map(O=>({node:O.node,score:_nullishCoalesce(G.get(O.node.id), () => (0)),breadcrumbs:O.breadcrumbs,group:O.group,radioGroup:O.radioGroup}))}else P=u}else P=u;P.sort(Wt);let D=Math.max(...P.map(f=>f.score),0),F=h.length>0,T={search:o?{query:o,bestScore:D}:null,matchCount:u.length,breadcrumbs:h,isDeepSearchResult:F};M.push({kind:"radio-group",node:b.get(s).menuNode,context:T,items:P.map(f=>Co(f,o,a)),bestScore:D})}let v=[...N.map(s=>({node:s,score:_nullishCoalesce(_optionalChain([s, 'access', _129 => _129.context, 'access', _130 => _130.search, 'optionalAccess', _131 => _131.score]), () => (0)),forceOrder:Lt(s.node.def),kindRank:_n(s.node.kind)})),...M.map(s=>({node:s,score:s.bestScore,forceOrder:en(s.items),kindRank:0}))];return v.sort(Jn),{displayNodes:v.map(s=>s.node),isDeepSearching:i}}function Sa(e){let{query:o,normalizeQuery:r,nodes:t,highlightedId:a,deepSearch:n=!0,includeInDeepSearch:c=!0,disabledBranchBehavior:p="exclude",minLength:g=0,sortGroups:l=!0,radioGroupSearchBehavior:i="preserve"}=e,d=n&&o.length>=g,m=Pt(t,{deep:d,includeInDeepSearch:c,disabledBranchBehavior:p}),S=new Map;if(i==="preserve-show-all"){for(let s of m)if(s.radioGroup){let u=S.get(s.radioGroup.id);u?u.items.push(s):S.set(s.radioGroup.id,{radioGroupDef:s.radioGroup.radioGroupDef,menuNode:s.radioGroup.menuNode,items:[s],breadcrumbs:s.breadcrumbs})}}let b=Jo(m,o,r),R=new Map,y=new Map,L=[];for(let s of b)if(s.radioGroup)if(i==="flatten")L.push(s);else{let u=y.get(s.radioGroup.id);u?u.items.push(s):y.set(s.radioGroup.id,{radioGroupDef:s.radioGroup.radioGroupDef,menuNode:s.radioGroup.menuNode,items:[s],breadcrumbs:s.breadcrumbs})}else if(s.group){let u=R.get(s.group.id);u?u.items.push(s):R.set(s.group.id,{groupDef:s.group.groupDef,menuNode:s.group.menuNode,items:[s],breadcrumbs:s.breadcrumbs})}else L.push(s);let I=[];for(let[s,{items:u,breadcrumbs:h}]of R){u.sort(Wt);let P=Math.max(...u.map(T=>T.score),0),D=h.length>0,F={search:o?{query:o,bestScore:P}:null,matchCount:u.length,breadcrumbs:h,isDeepSearchResult:D};I.push({kind:"group",node:R.get(s).menuNode,context:F,items:u.map(T=>Co(T,o,a)),bestScore:P})}let N=[];if(i!=="flatten")for(let[s,{items:u,breadcrumbs:h}]of y){let P;if(i==="preserve-show-all"){let f=S.get(s);if(f){let G=new Map(u.map(O=>[O.node.id,O.score]));P=f.items.map(O=>({node:O.node,score:_nullishCoalesce(G.get(O.node.id), () => (0)),breadcrumbs:O.breadcrumbs,group:O.group,radioGroup:O.radioGroup}))}else P=u}else P=u;P.sort(Wt);let D=Math.max(...P.map(f=>f.score),0),F=h.length>0,T={search:o?{query:o,bestScore:D}:null,matchCount:u.length,breadcrumbs:h,isDeepSearchResult:F};N.push({kind:"radio-group",node:y.get(s).menuNode,context:T,items:P.map(f=>Co(f,o,a)),bestScore:D})}let M=L.sort(Wt).map(s=>Co(s,o,a)),v=[...I.map(s=>({node:s,score:s.bestScore,forceOrder:en(s.items),kindRank:0})),...N.map(s=>({node:s,score:s.bestScore,forceOrder:en(s.items),kindRank:0})),...M.map(s=>({node:s,score:_nullishCoalesce(_optionalChain([s, 'access', _132 => _132.context, 'access', _133 => _133.search, 'optionalAccess', _134 => _134.score]), () => (0)),forceOrder:Lt(s.node.def),kindRank:_n(s.node.kind)}))];return l&&v.sort(Jn),{displayNodes:v.map(s=>s.node),isDeepSearching:d}}function nr(e){let{query:o,nodes:r,highlightedId:t,groupSearchBehavior:a="preserve"}=e,c=(_nullishCoalesce(e.normalizeQuery, () => ((0, _chunkXMZZ62VJcjs.r))))(o),p=c===o?{...e,normalizeQuery:ns}:{...e,query:c,normalizeQuery:ns};return c?a==="preserve"?Sa(p):Ra(p):{displayNodes:Yn(r,t),isDeepSearching:!1}}function rr(e,o,r,t,a){if(!o&&!r)return null;let n=`${e}-label`;return r?_jsxruntime.jsx.call(void 0, ee.Fragment,{children:r({node:t,props:{id:n},context:a})},n):_jsxruntime.jsx.call(void 0, Wn,{id:n,children:o},n)}function Pa(e){let o=[];for(let r of e)if(xo(r))for(let t of r.items)!t.context.disabled&&t.node.id&&o.push(t.node.id);else if(yo(r))for(let t of r.items)!t.context.disabled&&t.node.id&&o.push(t.node.id);else Mo(r)||!r.context.disabled&&r.node.id&&o.push(r.node.id);return o}function xa(e,o){if(e.length===0||o.length<=e.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==o[r])return!1;return!0}function sr(e){return e.map(o=>_nullishCoalesce(o.id, () => (o.value))).join(">")}function rs(e){return xo(e)?`group:${e.node.def.id}:${sr(e.context.breadcrumbs)}`:yo(e)?`radio-group:${e.node.def.id}:${sr(e.context.breadcrumbs)}`:Mo(e)?`separator:${_nullishCoalesce(e.node.def.id, () => ("separator"))}`:`row:${e.node.def.kind}:${_nullishCoalesce(e.node.def.id, () => (""))}:${e.node.def.value}:${sr(e.context.breadcrumbs)}`}var ya=e=>e;function Ma(e,o){let r=e.map(i=>[rs(i),i]),t=new Map(r),a=r.map(([i])=>i),n=o.filter(i=>t.has(i)),c=new Set(n),p=a.filter(i=>!c.has(i)),g=[...n,...p];return{orderedNodes:g.map(i=>t.get(i)).filter(i=>i!==void 0),nextOrder:g}}function Ca(e){return e.initialQueryBehavior!==void 0?e.initialQueryBehavior===!1?!1:{value:_nullishCoalesce(e.initialQueryBehavior.value, () => ("")),loadWhen:_nullishCoalesce(e.initialQueryBehavior.loadWhen, () => ("needed"))}:e.initialQuery!==void 0?{value:e.initialQuery,loadWhen:"needed"}:{value:"",loadWhen:"needed"}}function ar(e,o){let r=_nullishCoalesce(e.minQueryLength, () => (1)),t=Ca(e);return o.length>=r?{effectiveQuery:o,enabled:!0,isBelowMinLength:!1}:t!==!1?{effectiveQuery:t.value,enabled:!0,isBelowMinLength:!1}:{effectiveQuery:"",enabled:!1,isBelowMinLength:!0}}function va({info:e,query:o,enabled:r}){let t=Nt(),{config:a,id:n}=e,c=a.Loader,p=ee.useMemo(()=>a.type!=="query"?null:ar(a,o),[a,o]),g=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _135 => _135.effectiveQuery]), () => (o)),l=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _136 => _136.enabled]), () => (!0));return r||Xo(a)?_jsxruntime.jsx.call(void 0, c,{query:g,enabled:l,children:d=>_jsxruntime.jsx.call(void 0, ss,{kind:"branch",id:n,config:a,result:d,coordinator:t})}):null}function ss({kind:e,id:o,config:r,result:t,coordinator:a}){let n=ee.useRef(r),c=ee.useRef(a),p=ee.useRef(t),g=ee.useRef(null);return n.current=r,c.current=a,p.current=t,ee.useEffect(()=>{let l=c.current;if(l)return e==="root"?l.registerRootLoader({config:n.current,result:p.current}):l.registerLoader({id:o,config:n.current,result:p.current}),()=>{e==="root"?l.unregisterRootLoader():l.unregisterLoader(o)}},[e,o]),ee.useEffect(()=>{let l=c.current;if(!l)return;let i=g.current;(i===null||i.data!==t.data||i.status!==t.status||i.fetchStatus!==t.fetchStatus||i.loadingPhase!==t.loadingPhase||i.isLoading!==t.isLoading||i.isFetching!==t.isFetching||i.isInitialLoading!==t.isInitialLoading||i.isRefetching!==t.isRefetching||i.isPending!==t.isPending||i.isSuccess!==t.isSuccess||i.isError!==t.isError||i.isPaused!==t.isPaused||i.hasData!==t.hasData||i.hasFetched!==t.hasFetched||i.error!==t.error)&&(g.current={data:t.data,status:t.status,fetchStatus:t.fetchStatus,loadingPhase:t.loadingPhase,isLoading:t.isLoading,isFetching:t.isFetching,isInitialLoading:t.isInitialLoading,isRefetching:t.isRefetching,isPending:t.isPending,isSuccess:t.isSuccess,isError:t.isError,isPaused:t.isPaused,hasData:t.hasData,hasFetched:t.hasFetched,error:t.error},e==="root"?l.updateRootLoaderResult(t):l.updateLoaderResult(o,t))},[e,o,t.data,t.status,t.fetchStatus,t.loadingPhase,t.isLoading,t.isFetching,t.isInitialLoading,t.isRefetching,t.isPending,t.isSuccess,t.isError,t.isPaused,t.hasData,t.hasFetched,t.error]),null}function ka({query:e}){let o=Bn(),r=Nt(),{asyncContent:t}=o,a=ee.useMemo(()=>_optionalChain([t, 'optionalAccess', _137 => _137.type])!=="query"?null:ar(t,e),[t,e]),n=_nullishCoalesce(_optionalChain([a, 'optionalAccess', _138 => _138.effectiveQuery]), () => (e)),c=_nullishCoalesce(_optionalChain([a, 'optionalAccess', _139 => _139.enabled]), () => (!0));if(!t)return null;let p=t.Loader;return _jsxruntime.jsx.call(void 0, p,{query:n,enabled:c,children:g=>_jsxruntime.jsx.call(void 0, ss,{kind:"root",config:t,result:g,coordinator:r})})}var as=ee.forwardRef(function(o,r){let{children:t,content:a,asyncContent:n,deepSearchConfig:c,includeInDeepSearch:p,search:g,normalizedSearch:l,store:i,label:d="Menu",remeasureDependencies:m,...S}=o,b=Uo(),{setResolvedNodes:R}=Bo(),y=Vr(),{depth:L}=_chunkXMZZ62VJcjs.j.call(void 0, ),I=dt(),N=io(),M=!!(I&&_optionalChain([N, 'optionalAccess', _140 => _140.getSurfaceId, 'call', _141 => _141(I.pageId)])),v=L===0&&!M,s=Nt(),u=_nullishCoalesce(c.minLength, () => (0)),h=c.enabled!==!1&&l.length>=u,{nodes:P,graftVersion:D,asyncSubmenus:F}=ts({resolver:b,content:a,asyncContent:n,coordinator:s,graftParent:y,isSubpageSurface:M,isResolutionRoot:v,includeInDeepSearch:p,disabledBranchBehavior:c.disabledBranchBehavior}),T=h||F.some(K=>Xo(K.config))||n&&n.loadStrategy==="eager";ee.useEffect(()=>{M||R({nodes:P,graftVersion:D,content:a})},[M,R,P,D,a]);let f=ee.useRef(0);ee.useEffect(()=>{!M||D===0||f.current!==D&&(f.current=D,R(K=>K&&{...K,graftVersion:K.graftVersion+1}))},[M,R,D]);let G=ee.useRef(null),{displayNodes:O,isDeepSearching:k}=ee.useMemo(()=>{let K=nr({query:l,normalizeQuery:ya,nodes:P,highlightedId:null,deepSearch:c.enabled,includeInDeepSearch:p,disabledBranchBehavior:c.disabledBranchBehavior,minLength:c.minLength,groupSearchBehavior:c.groupSearchBehavior,radioGroupSearchBehavior:c.radioGroupSearchBehavior,sortGroups:c.sortGroups}),V=_nullishCoalesce(c.asyncResultBehavior, () => ("stream")),C=F.length+(n?1:0),j=C>0,B=V==="block"&&K.isDeepSearching&&j&&s!==null&&(s.loaders.size+(s.root?1:0)<C||s.isAnyLoading),J=K.displayNodes;if(B)G.current=null,J=[];else if(V==="stream"&&K.isDeepSearching){let ne=G.current;if(!ne||ne.query!==l)G.current={query:l,order:J.map(rs)};else{let{orderedNodes:te,nextOrder:ge}=Ma(J,ne.order);J=te,G.current={query:l,order:ge}}}else G.current=null;return{displayNodes:J,isDeepSearching:K.isDeepSearching}},[l,P,D,c,p,F.length,n,s,_optionalChain([s, 'optionalAccess', _142 => _142.isAnyLoading]),_optionalChain([s, 'optionalAccess', _143 => _143.loaders])]),E=ee.useRef([]),x=ee.useRef(null),w=ee.useRef("replace"),z=ee.useMemo(()=>Pa(O),[O]),A=ee.useMemo(()=>{let K=E.current,V=z;if(K.length!==V.length||K.some((j,B)=>j!==V[B])){let B=(_nullishCoalesce(c.asyncResultBehavior, () => ("stream")))==="stream"&&k&&x.current===l&&xa(K,V);return w.current=B?"append":"replace",E.current=V,x.current=l,V}return K},[z,c.asyncResultBehavior,k,l]);ee.useEffect(()=>{i.setOrderedItems(A,{reason:w.current})},[i,A]);let U=ee.useCallback(K=>{let V=K.node,C=V.def,{context:j}=K,B=V.id,J=ne=>{if(!ne.def.asyncNodes||!s)return;let te=s.loaders.get(ne.id);if(!te)return;let ge=ne.def.asyncNodes.type==="query"?ar(ne.def.asyncNodes,l).isBelowMinLength:!1;return{status:te.result.status,fetchStatus:te.result.fetchStatus,loadingPhase:te.result.loadingPhase,isLoading:te.result.isLoading,isFetching:te.result.isFetching,isInitialLoading:te.result.isInitialLoading,isRefetching:te.result.isRefetching,isError:te.result.isError,error:te.result.error,isBelowMinLength:ge}};if(C.kind==="item")return _jsxruntime.jsx.call(void 0, ee.Fragment,{children:C.render({node:V,props:{id:B,value:C.value,disabled:j.disabled,closeOnClick:C.closeOnClick,onSelect:C.onSelect,shortcut:C.shortcut,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...j,value:C.value}})},B);if(C.kind==="link-item")return _jsxruntime.jsx.call(void 0, ee.Fragment,{children:C.render({node:V,props:{id:B,value:C.value,href:C.href,disabled:j.disabled,closeOnClick:C.closeOnClick,onSelect:C.onSelect,shortcut:C.shortcut,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...j,value:C.value}})},B);if(C.kind==="tree-item")return _jsxruntime.jsx.call(void 0, ee.Fragment,{children:C.render({node:V,props:{id:B,value:C.value,disabled:j.disabled,selectable:C.selectable!==!1,closeOnClick:C.closeOnClick,onSelect:C.onSelect,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...j,value:C.value}})},B);if(C.kind==="radio-item")return _jsxruntime.jsx.call(void 0, ee.Fragment,{children:C.render({node:V,props:{id:B,value:C.value,disabled:j.disabled,closeOnClick:C.closeOnClick,onSelect:C.onSelect,shortcut:C.shortcut,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...j,value:C.value}})},B);if(C.kind==="checkbox-item")return _jsxruntime.jsx.call(void 0, ee.Fragment,{children:C.render({node:V,props:{id:B,value:C.value,checked:C.checked,onCheckedChange:C.onCheckedChange,disabled:j.disabled,closeOnClick:C.closeOnClick,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...j,value:C.value,checked:C.checked}})},B);if(C.kind==="submenu"){let ne=J(V),te=ft(V),ge={node:C,menuNode:V,value:C.value,id:C.id},Ge=$e=>{let be=$e,pe=$e.def;if(pe.kind==="separator")return null;if(pe.kind==="group"){let et=be.children.filter(Ce=>Ze(Ce)&&(Ce.kind==="item"||Ce.kind==="link-item"||Ce.kind==="checkbox-item"||Ce.kind==="submenu"||Ce.kind==="subpage")&&!Ce.def.hidden);if(et.length===0)return null;let Le=et.map(Ce=>{let Z={search:null,breadcrumbs:[...j.breadcrumbs,ge],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(Ce.def.disabled, () => (!1)),group:{id:pe.id,label:pe.label},tree:null};return U({kind:"row",node:Ce,context:Z})});if(pe.render){let Ce={search:null,matchCount:et.length,breadcrumbs:[...j.breadcrumbs,ge],isDeepSearchResult:!1};return _jsxruntime.jsx.call(void 0, ee.Fragment,{children:pe.render({node:be,props:{},context:{...Ce,label:pe.label},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:Le})})},pe.id)}return _jsxruntime.jsx.call(void 0, "div",{role:"group","aria-label":pe.label,children:Le},pe.id)}if(pe.kind==="radio-group")return $(be,[...j.breadcrumbs,ge]);if(pe.kind!=="item"&&pe.kind!=="link-item"&&pe.kind!=="checkbox-item"&&pe.kind!=="submenu"&&pe.kind!=="subpage")return null;let Ve={search:null,breadcrumbs:[...j.breadcrumbs,ge],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(pe.disabled, () => (!1)),group:null,tree:null};return U({kind:"row",node:be,context:Ve})};return _jsxruntime.jsx.call(void 0, ee.Fragment,{children:_jsxruntime.jsx.call(void 0, mo.Provider,{value:V,children:C.render({node:V,props:{id:B,value:C.value,disabled:j.disabled,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...j,value:C.value,async:ne},nodes:te,asyncContent:C.asyncNodes,renderNode:Ge})})},B)}if(C.kind==="subpage"){let ne=J(V),te=V.id;return _jsxruntime.jsx.call(void 0, ee.Fragment,{children:C.renderTrigger({node:V,props:{id:B,value:C.value,disabled:j.disabled,targetPageId:te},context:{...j,value:C.value,async:ne}})},B)}return null},[s,l,k]),$=ee.useCallback((K,V=[])=>{let C=K.def,j=V.length>0,B={search:null,matchCount:C.nodes.length,breadcrumbs:V,isDeepSearchResult:j},J=K.children.map(ne=>{if(!Ze(ne)||ne.def.hidden)return null;let te={search:null,breadcrumbs:V,isDeepSearchResult:j,highlighted:!1,disabled:_nullishCoalesce(ne.def.disabled, () => (!1)),group:null,tree:null};return U({kind:"row",node:ne,context:te,radioGroup:{id:C.id,label:C.label}})});return C.render?_jsxruntime.jsx.call(void 0, ee.Fragment,{children:C.render({node:K,props:{value:C.value,onValueChange:C.onValueChange,disabled:_nullishCoalesce(C.disabled, () => (!1))},context:{...B,label:C.label,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1))},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:J})})},C.id):_jsxruntime.jsxs.call(void 0, "div",{role:"radiogroup","aria-label":C.label,children:[rr(C.id,C.label,C.renderLabel,K,{...B,label:C.label,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1))}),J]},C.id)},[U]),ae=ee.useCallback(K=>{if(xo(K)){let V=K.node,{context:C,items:j}=K,B=V.def,J=j.map(ne=>U(ne));return B.render?_jsxruntime.jsx.call(void 0, ee.Fragment,{children:B.render({node:V,props:{},context:{...C,label:B.label},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:J})})},B.id):_jsxruntime.jsxs.call(void 0, "div",{role:"group","aria-label":B.label,children:[rr(B.id,B.label,B.renderLabel,V,{...C,label:B.label}),J]},B.id)}if(yo(K)){let V=K.node,{context:C,items:j}=K,B=V.def,J=j.map(ne=>U(ne));return B.render?_jsxruntime.jsx.call(void 0, ee.Fragment,{children:B.render({node:V,props:{value:B.value,onValueChange:B.onValueChange,disabled:_nullishCoalesce(B.disabled, () => (!1))},context:{...C,label:B.label,value:B.value,disabled:_nullishCoalesce(B.disabled, () => (!1))},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:J})})},B.id):_jsxruntime.jsxs.call(void 0, "div",{role:"radiogroup","aria-label":B.label,children:[rr(B.id,B.label,B.renderLabel,V,{...C,label:B.label,value:B.value,disabled:_nullishCoalesce(B.disabled, () => (!1))}),J]},B.id)}if(Mo(K)){let V=K.node.def;return V.render?_jsxruntime.jsx.call(void 0, ee.Fragment,{children:V.render({props:{id:V.id}})},_nullishCoalesce(V.id, () => ("separator"))):_jsxruntime.jsx.call(void 0, "div",{role:"none"},_nullishCoalesce(V.id, () => ("separator")))}return U(K)},[U]),H=ee.useMemo(()=>s?s.getAsyncState():{isLoading:!1,isFetching:!1,isInitialLoading:!1,isRefetching:!1,isAllRefetching:!1,isStaticLoading:!1,isStaticInitialLoading:!1,isStaticRefetching:!1,isQueryLoading:!1,isQueryInitialLoading:!1,isQueryRefetching:!1,skippedMenus:[]},[s,_optionalChain([s, 'optionalAccess', _144 => _144.loaders]),_optionalChain([s, 'optionalAccess', _145 => _145.erroredLoaders]),_optionalChain([s, 'optionalAccess', _146 => _146.root])]),se=ee.useMemo(()=>({search:g,nodes:O,renderNode:ae,count:O.length,isDeepSearching:k,async:H}),[g,O,ae,k,H]);return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[T&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, ka,{query:l}),F.map(K=>_jsxruntime.jsx.call(void 0, va,{info:K,query:l,enabled:h},K.id))]}),_jsxruntime.jsx.call(void 0, fo.Provider,{value:se,children:_jsxruntime.jsx.call(void 0, ir,{ref:r,label:d,...S,remeasureDependencies:[k,..._nullishCoalesce(m, () => ([]))],children:t})})]})});var ur=(o=>(o.rowWidth="--row-width",o))(ur||{});var ir=ke.forwardRef(function(o,r){let{children:t,label:a="Suggestions",measureRowWidth:n=!0,maxRowWidth:c,scrollContainerRef:p,remeasureDependencies:g,render:l,className:i,style:d,onKeyDown:m,onPointerDown:S,...b}=o,{store:R,surfaceId:y}=_chunkXMZZ62VJcjs.p.call(void 0, ),{depth:L,closeAll:I}=_chunkXMZZ62VJcjs.j.call(void 0, ),N=Ue(),M=dt(),{disabled:v}=Ee(),s=ye(),u=Qt(),h=ke.useRef(null),P=ke.useRef(null);ke.useEffect(()=>{R.setListRef(h)},[R]),ke.useEffect(()=>{if(p)return R.setListScrollContainerRef(p),()=>{R.setListScrollContainerRef({current:null})}},[R,p]),ke.useLayoutEffect(()=>{if(!n||!h.current)return;let j=h.current.closest("[data-open]");P.current=j},[n]);let{queueMeasurement:D,resetMeasurements:F,clearMeasuredIds:T}=_chunkXMZZ62VJcjs.v.call(void 0, {listRef:h,targetRef:P,maxWidth:c,enabled:n}),f=ke.useRef(null),G=ke.useRef(!1);ke.useEffect(()=>{let j=_nullishCoalesce(f.current, () => ([])),B=G.current;if(f.current=_nullishCoalesce(g, () => (null)),G.current=!0,!n||!B)return;let J=_nullishCoalesce(g, () => ([]));if(j.length!==J.length||J.some((te,ge)=>!Object.is(te,j[ge]))){T();for(let[te,ge]of R.context.refs.itemRefs)ge.current&&D(ge.current,te)}}),ke.useEffect(()=>{if(n)return R.context.onCloseComplete=F,()=>{R.context.onCloseComplete=void 0}},[n,F,R]);let O=ke.useMemo(()=>n?{queueMeasurement:D}:null,[n,D]),k=R.useState("search"),E=R.useState("filteredCount"),x=R.useState("hasInput"),w=R.useState("highlightedId"),z=R.context.listId,A=!x&&!v,{handleKeyDown:U}=Po({store:R,surfaceId:y,focusOwnerStore:s,depth:L,submenuContext:N,subpageContext:M,enabled:A,disabled:v,enableTypeToSearch:!0,onKeyDown:m,closeAll:I}),$=ke.useCallback(j=>{j.target instanceof HTMLInputElement||j.preventDefault(),_optionalChain([S, 'optionalCall', _147 => _147(j)])},[S]),ae=ke.useMemo(()=>({search:k,filteredCount:E}),[k,E]),H=typeof t=="function"?t(ae):t,se=O?_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.l.Provider,{value:O,children:H}):H,K=_optionalChain([u, 'optionalAccess', _148 => _148.layout])==="input-embedded",V=q(),C=W(V,"list");return _userender.useRender.call(void 0, {render:l,ref:[h,r],props:{...b,...C?{[C]:""}:{},id:z,role:"listbox","aria-label":a,"aria-activedescendant":A?_nullishCoalesce(w, () => (void 0)):void 0,tabIndex:A?0:-1,"data-popup-menu-list":"","data-input-embedded":K?"":void 0,className:_chunkPCNHYMD6cjs.a.call(void 0, i,{}),style:_chunkPCNHYMD6cjs.b.call(void 0, d,{}),onKeyDown:U,onPointerDown:$,children:se},defaultTagName:"div"})}),Da= exports.ca =ke.forwardRef(function(o,r){let t=Vn(),{store:a}=_chunkXMZZ62VJcjs.p.call(void 0, ),n=a.useState("search"),c=a.useState("normalizedSearch");return t?_jsxruntime.jsx.call(void 0, as,{ref:r,...o,content:t.content,asyncContent:t.asyncContent,deepSearchConfig:t.deepSearchConfig,includeInDeepSearch:t.includeInDeepSearch,search:n,normalizedSearch:c,store:a}):_jsxruntime.jsx.call(void 0, ir,{ref:r,...o})});var wa={first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null},La= exports.da =at.forwardRef(function(o,r){let{forceMount:t=!1,render:a,className:n,style:c,children:p,...g}=o,{store:l}=_chunkXMZZ62VJcjs.p.call(void 0, ),i=at.useId(),[d,m]=at.useState(null);at.useLayoutEffect(()=>{if(d)return l.registerRow(i,d,{kind:"loading"})},[d,i,l]);let S=q(),b=W(S,"loading"),R=go(),y=R?R.isRootLoading||R.isAnyLoading&&R.searchQuery.length>0:!1,L=t||y,I=l.useState("isFirstRow",i),N=l.useState("isLastRow",i),M=at.useMemo(()=>({first:I,last:N}),[I,N]),v=_userender.useRender.call(void 0, {render:a,ref:[m,r],state:M,stateAttributesMapping:wa,props:{...g,...b?{[b]:""}:{},role:"presentation",className:_chunkPCNHYMD6cjs.a.call(void 0, n,M),style:_chunkPCNHYMD6cjs.b.call(void 0, c,M),children:p},defaultTagName:"div"});return L?v:null});var is={slot:"bazzaui-[component]-scroll-[up|down]-arrow",direction:"data-direction",side:"data-side"};var Ta={direction:e=>e?{[is.direction]:String(e)}:null,visible:e=>({"data-visible":e?"true":"false"})},us=De.forwardRef(function(o,r){let{direction:t,keepMounted:a=!1,scrollSpeed:n=10,render:c,className:p,style:g,children:l,...i}=o,{store:d}=_chunkXMZZ62VJcjs.p.call(void 0, ),[m,S]=De.useState(!1),b=De.useRef(!1),R=De.useRef(null),L=d.useState("openMethod")==="touch",I=De.useCallback(()=>{if(L){S(!1);return}let F=_optionalChain([d, 'access', _149 => _149.context, 'access', _150 => _150.refs, 'access', _151 => _151.listRef, 'optionalAccess', _152 => _152.current]);if(!F){S(!1);return}if(t==="up")S(F.scrollTop>0);else{let T=F.scrollTop+F.clientHeight>=F.scrollHeight-1;S(!T)}},[d,t,L]);De.useEffect(()=>{let F=_optionalChain([d, 'access', _153 => _153.context, 'access', _154 => _154.refs, 'access', _155 => _155.listRef, 'optionalAccess', _156 => _156.current]);if(!F)return;I(),F.addEventListener("scroll",I,{passive:!0});let T=new ResizeObserver(I);return T.observe(F),()=>{F.removeEventListener("scroll",I),T.disconnect()}},[d,I]);let N=d.useState("filteredCount");De.useEffect(()=>{requestAnimationFrame(I)},[N,I]);let M=De.useCallback(()=>{b.current=!0;let D=()=>{if(!b.current)return;let T=_optionalChain([d, 'access', _157 => _157.context, 'access', _158 => _158.refs, 'access', _159 => _159.listRef, 'optionalAccess', _160 => _160.current]);if(T){let f=t==="up"?-n:n;T.scrollTop+=f}R.current=requestAnimationFrame(D)};R.current=requestAnimationFrame(D)},[d,t,n]),v=De.useCallback(()=>{b.current=!1,R.current&&(cancelAnimationFrame(R.current),R.current=null)},[]);De.useEffect(()=>()=>{R.current&&cancelAnimationFrame(R.current)},[]);let s=De.useMemo(()=>({direction:t,visible:m}),[t,m]),u=m||a,h=q(),P=W(h,t==="up"?"scroll-up-arrow":"scroll-down-arrow");return _userender.useRender.call(void 0, {render:c,ref:r,state:s,stateAttributesMapping:Ta,props:{...i,...P?{[P]:""}:{},className:_chunkPCNHYMD6cjs.a.call(void 0, p,s),style:_chunkPCNHYMD6cjs.b.call(void 0, g,s),onPointerEnter:D=>{M(),_optionalChain([i, 'access', _161 => _161.onPointerEnter, 'optionalCall', _162 => _162(D)])},onPointerLeave:D=>{v(),_optionalChain([i, 'access', _163 => _163.onPointerLeave, 'optionalCall', _164 => _164(D)])},children:l},defaultTagName:"div",enabled:u})}),Ga= exports.ea =De.forwardRef(function(o,r){return _jsxruntime.jsx.call(void 0, us,{ref:r,direction:"up",...o})}),Ea= exports.fa =De.forwardRef(function(o,r){return _jsxruntime.jsx.call(void 0, us,{ref:r,direction:"down",...o})});var _useStableCallback = require('@base-ui/utils/useStableCallback');var ps="a[href], button, input, select, textarea, [tabindex]";function tn(e){let o=Array.from(e.querySelectorAll(ps));return(e.matches(ps)?[e,...o]:o).filter(t=>t.tabIndex>=0&&!t.hasAttribute("disabled")&&!(t instanceof HTMLInputElement&&t.type==="hidden")&&t.closest('[hidden], [inert], [aria-hidden="true"]')===null)}function Ba({children:e}){let{store:o}=_chunkXMZZ62VJcjs.p.call(void 0, ),r=o.useState("normalizedSearch");return _jsxruntime.jsx.call(void 0, Hr,{searchQuery:r,children:e})}var Va=ce.forwardRef(function(o,r){let{filter:t=_chunkXMZZ62VJcjs.x,normalizeSearch:a=_chunkXMZZ62VJcjs.r,search:n,onSearchChange:c,defaultSearch:p="",loop:g=!0,autoHighlightFirst:l=!0,clearSearchOnClose:i="after-exit",resetScrollOnSearch:d=!0,skipAutoFocus:m=!1,orderedItems:S,content:b,asyncContent:R,deepSearch:y,includeInDeepSearch:L=!0,render:I,className:N,style:M,onKeyDown:v,onFocus:s,onPointerDown:u,onPointerMove:h,children:P,...D}=o,F=ce.useMemo(()=>_optionalChain([b, 'optionalAccess', _165 => _165.map, 'call', _166 => _166(oe=>Dn(oe)?oe.def:oe)]),[b]),T=b!==void 0||R!==void 0||y!==void 0||o.includeInDeepSearch!==void 0,{store:f,depth:G,virtualization:O}=_chunkXMZZ62VJcjs.j.call(void 0, );f.initializeDefaultSearch(p);let k=Ue(),E=dt(),x=io(),w=ye(),z=ce.useRef(0),A=ce.useId(),U=ce.useId(),$=ce.useId(),H=_nullishCoalesce(_nullishCoalesce(Or(), () => (_optionalChain([k, 'optionalAccess', _167 => _167.childSurfaceId]))), () => ($)),se=qo(),K=ce.useMemo(()=>x?E&&x.getSurfaceId(E.pageId)?x.activePageId===E.pageId:x.activePageId===null:!0,[x,E]),V=w.useState("isOwner",H),C=_useStableCallback.useStableCallback.call(void 0, oe=>{_optionalChain([c, 'optionalCall', _168 => _168(oe)])});ce.useEffect(()=>{f.context.filter=T?!1:t,f.setSearchNormalizer(a),f.context.loop=g,f.context.autoHighlightFirst=l,f.context.clearSearchOnClose=i,f.context.resetScrollOnSearch=d,f.context.listId=A,f.context.inputId=U,f.context.onSearchChange=C,O&&(f.setVirtualized(O.virtualized),f.setVirtualItems(O.items),f.setOnHighlightChange(O.onHighlightChange)),typeof l=="string"&&f.applyAutoHighlight()},[f,t,a,g,l,i,d,A,U,C,O,T]);let j=Ee(),B=ce.useMemo(()=>typeof y=="boolean"||y===void 0?{enabled:_nullishCoalesce(y, () => (!0)),minLength:0,groupSearchBehavior:"preserve",radioGroupSearchBehavior:"preserve",sortGroups:!0,asyncResultBehavior:"stream",disabledBranchBehavior:"exclude"}:{enabled:_nullishCoalesce(y.enabled, () => (!0)),minLength:_nullishCoalesce(y.minLength, () => (0)),groupSearchBehavior:_nullishCoalesce(y.groupSearchBehavior, () => ("preserve")),radioGroupSearchBehavior:_nullishCoalesce(y.radioGroupSearchBehavior, () => ("preserve")),sortGroups:_nullishCoalesce(y.sortGroups, () => (!0)),asyncResultBehavior:_nullishCoalesce(y.asyncResultBehavior, () => ("stream")),disabledBranchBehavior:_nullishCoalesce(y.disabledBranchBehavior, () => ("exclude"))},[y]),J=ce.useId(),ne=ce.useMemo(()=>({content:_nullishCoalesce(F, () => ([])),asyncContent:R,deepSearchConfig:B,includeInDeepSearch:L,listId:J}),[F,R,B,L,J]),ge=_optionalChain([Br, 'call', _169 => _169(), 'optionalAccess', _170 => _170.setDataSurfaceContext]),Ge=!!(E&&_optionalChain([x, 'optionalAccess', _171 => _171.getSurfaceId, 'call', _172 => _172(E.pageId)]));ce.useEffect(()=>{if(!(!T||!ge||Ge))return ge(ne),()=>{ge(oe=>oe===ne?null:oe)}},[T,ge,ne,Ge]),ce.useEffect(()=>{S&&f.setOrderedItems(S)},[f,S]),f.useControlledProp("searchProp",n);let $e=f.useState("open"),be=ce.useRef(null);ce.useEffect(()=>{$e&&(z.current=Date.now())},[$e]),ce.useEffect(()=>{K&&G===0&&$e&&w.setOwnerId(H)},[G,$e,H,w,K]),ce.useEffect(()=>{if(!(!se||!K)&&j.explicitTabBehavior)return se.registerSurface(H,{parentSurfaceId:_nullishCoalesce(_optionalChain([k, 'optionalAccess', _173 => _173.parentSurfaceId]), () => (null)),close:k?()=>{k.suppressAutoOpenRef.current=!0,k.setOpen(!1)}:()=>{}})},[se,K,j.explicitTabBehavior,H,k]);let pe=ce.useRef(!1);ce.useEffect(()=>{(!K||!$e)&&(pe.current=!1)},[K,$e]),ce.useEffect(()=>{if(!K||!V||m)return;let oe=setTimeout(()=>{requestAnimationFrame(()=>{if(!be.current)return;let Xe=_nullishCoalesce(_optionalChain([se, 'optionalAccess', _174 => _174.getZoneElements, 'call', _175 => _175(H)]), () => ([])),Mt=!pe.current;pe.current=!0;let Ot=Xe.some(ht=>document.activeElement!==null&&ht.contains(document.activeElement));if(j.explicitTabBehavior&&document.activeElement&&be.current.contains(document.activeElement)&&!(Mt&&Ot))return;let Tt=Array.from(be.current.querySelectorAll("input")).find(ht=>!Xe.some(Gt=>Gt.contains(ht))),Ct=be.current.querySelector('[role="listbox"]'),We=Xe.flatMap(tn)[0],bt=_nullishCoalesce(_nullishCoalesce(Tt, () => (Ct)), () => (We));bt&&bt instanceof HTMLElement&&bt.focus()})},0);return()=>clearTimeout(oe)},[K,V,m,j.explicitTabBehavior,se,H]);let Ve=ce.useMemo(()=>({store:f,surfaceId:H}),[f,H]),et=ce.useCallback(oe=>{oe.target instanceof HTMLInputElement||oe.preventDefault(),_optionalChain([u, 'optionalCall', _176 => _176(oe)])},[u]),Le=ce.useCallback(oe=>{if(_optionalChain([h, 'optionalCall', _177 => _177(oe)]),Date.now()-z.current<100)return;let Mt=oe.target;_optionalChain([be, 'access', _178 => _178.current, 'optionalAccess', _179 => _179.contains, 'call', _180 => _180(Mt)])&&w.state.ownerId!==H&&w.setOwnerId(H)},[h,H,w]),Ce=ce.useCallback(oe=>{if(_optionalChain([v, 'optionalCall', _181 => _181(oe)]),oe.defaultPrevented||oe.key!=="Tab"||!j.explicitTabBehavior)return;let Xe=oe.target;if(!_optionalChain([be, 'access', _182 => _182.current, 'optionalAccess', _183 => _183.contains, 'call', _184 => _184(Xe)]))return;let Ot=(_nullishCoalesce(_optionalChain([se, 'optionalAccess', _185 => _185.getZoneElements, 'call', _186 => _186(H)]), () => ([]))).flatMap(tn);if(Ot.length===0){if(!se){if(j.tabWithoutZones==="inert"){oe.preventDefault();return}j.closeAll(_chunkXMZZ62VJcjs.a.focusOut,oe.nativeEvent);return}let vt=[],Et=H;for(;;){let Q=se.getParentSurfaceId(Et);if(!Q){if(j.tabWithoutZones==="inert"){oe.preventDefault();return}j.closeAll(_chunkXMZZ62VJcjs.a.focusOut,oe.nativeEvent);return}vt.push(Et);let re=se.getZoneElements(Q).flatMap(tn);if(re.length>0){oe.preventDefault();for(let ve of vt)se.closeSurface(ve);w.setOwnerId(Q),_optionalChain([(oe.shiftKey?re[re.length-1]:re[0]), 'optionalAccess', _187 => _187.focus, 'call', _188 => _188()]);return}Et=Q}}let Xt=f.state.hasInput?f.context.inputId:f.context.listId,Tt=Xt?document.getElementById(Xt):null,Ct=new Set;Tt instanceof HTMLElement&&Ct.add(Tt);for(let vt of Ot)Ct.add(vt);let We=[...Ct];oe.preventDefault();let bt=document.activeElement,ht=bt?We.indexOf(bt):-1,Gt=oe.shiftKey?-1:1;_optionalChain([(ht===-1?oe.shiftKey?We[We.length-1]:We[0]:We[(ht+Gt+We.length)%We.length]), 'optionalAccess', _189 => _189.focus, 'call', _190 => _190()])},[v,j,f,se,H,w]),Z=ce.useCallback(oe=>{if(_optionalChain([s, 'optionalCall', _191 => _191(oe)]),!j.explicitTabBehavior)return;let Xe=oe.target;_optionalChain([be, 'access', _192 => _192.current, 'optionalAccess', _193 => _193.contains, 'call', _194 => _194(Xe)])&&w.state.ownerId!==H&&w.setOwnerId(H)},[s,j,w,H]),Ye=q(),ie=W(Ye,"surface"),we=T?_jsxruntime.jsx.call(void 0, po.Provider,{value:ne,children:_jsxruntime.jsx.call(void 0, Ba,{children:P})}):P,yt=_userender.useRender.call(void 0, {render:I,ref:[be,r],props:{...D,...ie?{[ie]:""}:{},className:_chunkPCNHYMD6cjs.a.call(void 0, N,{}),style:_chunkPCNHYMD6cjs.b.call(void 0, M,{}),onPointerDown:et,onPointerMove:Le,onKeyDown:Ce,onFocus:Z,children:we},enabled:K,defaultTagName:"div"});return _jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.o.Provider,{value:Ve,children:yt})});var pr=nn.createContext(null);function ls(){let e=nn.useContext(pr);if(!e)throw new Error("PopupMenu.CheckboxItemIndicator must be used within PopupMenu.CheckboxItem");return e}var za={checked:e=>e?{"data-checked":""}:{"data-unchecked":""},highlighted:e=>e?{"data-highlighted":""}:null,disabled:e=>e?{"data-disabled":""}:null,first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null,firstInGroup:e=>e?{"data-first-in-group":""}:null,lastInGroup:e=>e?{"data-last-in-group":""}:null},Qa= exports.ha =qe.forwardRef(function(o,r){let{id:t,checked:a,defaultChecked:n=!1,onCheckedChange:c,value:p,keywords:g,disabled:l=!1,onSelect:i,forceMount:d=!1,closeOnClick:m=!1,shortcut:S,forceOrder:b,forceScore:R,render:y,className:L,style:I,onClick:N,onPointerDown:M,onPointerMove:v,children:s,...u}=o,[h,P]=qe.useState(n),D=a!==void 0,F=D?a:h,T=qe.useCallback(($=_chunkXMZZ62VJcjs.a.itemPress,ae)=>{let H=!F,se=_chunkXMZZ62VJcjs.b.call(void 0, $,ae);_optionalChain([c, 'optionalCall', _195 => _195(H,se)]),!se.isCanceled&&(D||P(H))},[F,D,c]),f=Fe({id:t,value:p,keywords:g,disabled:l,forceMount:d,shortcut:S,forceOrder:b,forceScore:R,closeOnClick:m,children:s}),G=f.disabled;qe.useEffect(()=>{let $=()=>{G||(T(),_optionalChain([i, 'optionalCall', _196 => _196()]))};return f.registerSelect($)},[G,T,i,f]);let O=qe.useMemo(()=>({highlighted:f.isHighlighted,disabled:G,checked:F,first:f.positional.first,last:f.positional.last,firstInGroup:f.positional.firstInGroup,lastInGroup:f.positional.lastInGroup}),[f.isHighlighted,G,F,f.positional]),k=qe.useMemo(()=>({...f.contextValue,checked:F,toggle:T}),[f.contextValue,F,T]),E=qe.useCallback($=>{_optionalChain([N, 'optionalCall', _197 => _197($)]),$.defaultPrevented||f.handlers.onClick($)},[N,f.handlers]),x=qe.useCallback($=>{f.handlers.onPointerDown($),_optionalChain([M, 'optionalCall', _198 => _198($)])},[f.handlers,M]),w=qe.useCallback($=>{_optionalChain([v, 'optionalCall', _199 => _199($)]),$.defaultPrevented||f.handlers.onPointerMove($)},[v,f.handlers]),z=q(),A=W(z,"checkbox-item"),U=_userender.useRender.call(void 0, {render:y,ref:[f.ref,f.rowRef,r],state:O,stateAttributesMapping:za,props:{...u,...A?{[A]:""}:{},id:f.id,role:"menuitemcheckbox",tabIndex:-1,"aria-checked":F,"aria-disabled":G||void 0,className:_chunkPCNHYMD6cjs.a.call(void 0, L,O),style:_chunkPCNHYMD6cjs.b.call(void 0, I,O),onClick:E,onPointerMove:w,onPointerDown:x,children:s},enabled:f.isVisible,defaultTagName:"div"});return f.isVisible?_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:f.contextValue,children:_jsxruntime.jsx.call(void 0, pr.Provider,{value:k,children:U})}):null});var qa={checked:e=>e?{"data-checked":""}:{"data-unchecked":""},disabled:e=>e?{"data-disabled":""}:null},Wa= exports.ia =rn.forwardRef(function(o,r){let{keepMounted:t=!1,render:a,className:n,style:c,children:p,...g}=o,{checked:l,highlighted:i,disabled:d,toggle:m}=ls(),S=rn.useMemo(()=>({checked:l,highlighted:i,disabled:d,toggle:m}),[l,i,d,m]),b=t||l,R=q(),y=W(R,"checkbox-item-indicator");return _userender.useRender.call(void 0, {render:a,ref:r,state:S,stateAttributesMapping:qa,props:{...g,...y?{[y]:""}:{},"aria-hidden":!0,className:_chunkPCNHYMD6cjs.a.call(void 0, n,S),style:_chunkPCNHYMD6cjs.b.call(void 0, c,S),children:p},enabled:b,defaultTagName:"span"})});var Za={highlighted:e=>e?{"data-highlighted":""}:null,disabled:e=>e?{"data-disabled":""}:null,first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null,firstInGroup:e=>e?{"data-first-in-group":""}:null,lastInGroup:e=>e?{"data-last-in-group":""}:null},lr= exports.ja =xt.forwardRef(function(o,r){let{id:t,value:a,keywords:n,disabled:c=!1,activatable:p=!0,onSelect:g,forceMount:l=!1,closeOnClick:i=!0,shortcut:d,forceOrder:m,forceScore:S,render:b,className:R,style:y,onClick:L,onPointerDown:I,onPointerMove:N,children:M,...v}=o,s=Fe({id:t,value:a,keywords:n,disabled:c,activatable:p,forceMount:l,shortcut:d,forceOrder:m,forceScore:S,onSelect:g,closeOnClick:i,children:M}),u=s.disabled,h=xt.useMemo(()=>({highlighted:s.isHighlighted,disabled:u,first:s.positional.first,last:s.positional.last,firstInGroup:s.positional.firstInGroup,lastInGroup:s.positional.lastInGroup}),[s.isHighlighted,u,s.positional]),P=xt.useCallback(O=>{_optionalChain([L, 'optionalCall', _200 => _200(O)]),O.defaultPrevented||s.handlers.onClick(O)},[L,s.handlers]),D=xt.useCallback(O=>{s.handlers.onPointerDown(O),_optionalChain([I, 'optionalCall', _201 => _201(O)])},[s.handlers,I]),F=xt.useCallback(O=>{_optionalChain([N, 'optionalCall', _202 => _202(O)]),O.defaultPrevented||s.handlers.onPointerMove(O)},[N,s.handlers]),T=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:s.contextValue,children:M}),f=q(),G=W(f,"item");return _userender.useRender.call(void 0, {render:b,ref:[s.ref,s.rowRef,r],state:h,stateAttributesMapping:Za,props:{...v,...G?{[G]:""}:{},id:s.id,role:"option",tabIndex:-1,"aria-selected":s.isHighlighted,"aria-disabled":u||void 0,className:_chunkPCNHYMD6cjs.a.call(void 0, R,h),style:_chunkPCNHYMD6cjs.b.call(void 0, y,h),onClick:P,onPointerMove:F,onPointerDown:D,children:T},enabled:s.isVisible,defaultTagName:"div"})});var Xa={highlighted:e=>e?{"data-highlighted":""}:null,disabled:e=>e?{"data-disabled":""}:null,first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null,firstInGroup:e=>e?{"data-first-in-group":""}:null,lastInGroup:e=>e?{"data-last-in-group":""}:null},_a= exports.ka =Je.forwardRef(function(o,r){let{id:t,value:a,keywords:n,disabled:c=!1,onSelect:p,forceMount:g=!1,closeOnClick:l=!1,shortcut:i,forceOrder:d,forceScore:m,render:S,className:b,style:R,onClick:y,onPointerDown:L,onPointerMove:I,children:N,...M}=o,{closeAll:v}=_chunkXMZZ62VJcjs.j.call(void 0, ),s=Je.useRef(null),u=Fe({id:t,value:a,keywords:n,disabled:c,forceMount:g,shortcut:i,forceOrder:d,forceScore:m,closeOnClick:l,children:N}),h=u.disabled;Je.useEffect(()=>{let k=()=>{h||_optionalChain([s, 'access', _203 => _203.current, 'optionalAccess', _204 => _204.click, 'call', _205 => _205()])};return u.registerSelect(k)},[h,u]);let P=Je.useMemo(()=>({highlighted:u.isHighlighted,disabled:h,first:u.positional.first,last:u.positional.last,firstInGroup:u.positional.firstInGroup,lastInGroup:u.positional.lastInGroup}),[u.isHighlighted,h,u.positional]),D=Je.useCallback(k=>{if(_optionalChain([y, 'optionalCall', _206 => _206(k)]),!k.defaultPrevented){if(h){k.preventDefault();return}_optionalChain([p, 'optionalCall', _207 => _207()]),l&&!k.metaKey&&!k.ctrlKey&&!k.shiftKey&&!k.altKey&&v()}},[y,h,p,l,v]),F=Je.useCallback(k=>{u.handlers.onPointerDown(k),_optionalChain([L, 'optionalCall', _208 => _208(k)])},[u.handlers,L]),T=Je.useCallback(k=>{_optionalChain([I, 'optionalCall', _209 => _209(k)]),k.defaultPrevented||u.handlers.onPointerMove(k)},[I,u.handlers]),f=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:u.contextValue,children:N}),G=q(),O=W(G,"link-item");return _userender.useRender.call(void 0, {render:S,ref:[u.ref,u.rowRef,s,r],state:P,stateAttributesMapping:Xa,props:{...M,...O?{[O]:""}:{},id:u.id,role:"option",tabIndex:-1,"aria-selected":u.isHighlighted,"aria-disabled":h||void 0,className:_chunkPCNHYMD6cjs.a.call(void 0, b,P),style:_chunkPCNHYMD6cjs.b.call(void 0, R,P),onClick:D,onPointerMove:T,onPointerDown:F,children:f},enabled:u.isVisible,defaultTagName:"a"})});var ko=sn.createContext(null);function fs(){let e=sn.useContext(ko);if(!e)throw new Error("PopupMenu.RadioItem must be used within PopupMenu.RadioGroup");return e}var ti={disabled:e=>e?{"data-disabled":""}:null,firstGroup:e=>e?{"data-first-group":""}:null,lastGroup:e=>e?{"data-last-group":""}:null,first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null},oi= exports.la =Ne.forwardRef(function(o,r){let{value:t,defaultValue:a,onValueChange:n,disabled:c=!1,forceMount:p=!1,render:g,className:l,style:i,children:d,...m}=o,{store:S}=_chunkXMZZ62VJcjs.p.call(void 0, ),b=Ee(),R=Ne.useId(),y=Ne.useRef(null),[L,I]=Ne.useState(null),N=c||b.disabled,[M,v]=Ne.useState(a),s=t!==void 0,u=s?t:M,h=Ne.useCallback((A,U=_chunkXMZZ62VJcjs.a.itemPress,$)=>{let ae=_chunkXMZZ62VJcjs.b.call(void 0, U,$);_optionalChain([n, 'optionalCall', _210 => _210(A,ae)]),!ae.isCanceled&&(s||v(A))},[s,n]);Ne.useEffect(()=>S.registerGroup(R,y),[R,S]),Ne.useLayoutEffect(()=>{if(L)return S.registerRow(R,L,{kind:"group"})},[L,R,S]);let P=S.useState("isGroupVisible",R),D=p||P,F=S.useState("isFirstGroup",R),T=S.useState("isLastGroup",R),f=S.useState("isFirstRow",R),G=S.useState("isLastRow",R),O=Ne.useMemo(()=>({value:u,setValue:h,disabled:N}),[u,h,N]),k=Ne.useMemo(()=>({groupId:R}),[R]),E=Ne.useMemo(()=>({disabled:N,firstGroup:F,lastGroup:T,first:f,last:G}),[N,F,T,f,G]),x=q(),w=W(x,"radio-group"),z=_userender.useRender.call(void 0, {render:g,ref:[y,I,r],state:E,stateAttributesMapping:ti,props:{...m,...w?{[w]:""}:{},role:"group","aria-disabled":N||void 0,className:_chunkPCNHYMD6cjs.a.call(void 0, l,E),style:_chunkPCNHYMD6cjs.b.call(void 0, i,E),children:d},enabled:D,defaultTagName:"div"});return D?_jsxruntime.jsx.call(void 0, ko.Provider,{value:O,children:_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.d.Provider,{value:k,children:z})}):null});function ni(e){let{value:o,onValueChange:r,disabled:t=!1,children:a}=e,n=an.useCallback((p,g=_chunkXMZZ62VJcjs.a.itemPress,l)=>{let i=_chunkXMZZ62VJcjs.b.call(void 0, g,l);_optionalChain([r, 'optionalCall', _211 => _211(p,i)])},[r]),c=an.useMemo(()=>({value:o,setValue:n,disabled:t}),[o,n,t]);return _jsxruntime.jsx.call(void 0, ko.Provider,{value:c,children:a})}var dr=un.createContext(null);function gs(){let e=un.useContext(dr);if(!e)throw new Error("PopupMenu.RadioItemIndicator must be used within PopupMenu.RadioItem");return e}var ii={checked:e=>e?{"data-checked":""}:{"data-unchecked":""},highlighted:e=>e?{"data-highlighted":""}:null,disabled:e=>e?{"data-disabled":""}:null,first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null,firstInGroup:e=>e?{"data-first-in-group":""}:null,lastInGroup:e=>e?{"data-last-in-group":""}:null},ui= exports.na =ot.forwardRef(function(o,r){let{id:t,value:a,keywords:n,disabled:c=!1,onSelect:p,forceMount:g=!1,closeOnClick:l=!1,shortcut:i,forceOrder:d,forceScore:m,render:S,className:b,style:R,onClick:y,onPointerDown:L,onPointerMove:I,children:N,...M}=o,v=fs(),s=c||v.disabled,u=v.value===a,h=Fe({id:t,keywords:n,disabled:s,forceMount:g,shortcut:i,forceOrder:d,forceScore:m,closeOnClick:l,children:N}),P=h.disabled;ot.useEffect(()=>{let x=()=>{P||(v.setValue(a),_optionalChain([p, 'optionalCall', _212 => _212()]))};return h.registerSelect(x)},[P,v,a,p,h]);let D=ot.useMemo(()=>({highlighted:h.isHighlighted,disabled:P,checked:u,first:h.positional.first,last:h.positional.last,firstInGroup:h.positional.firstInGroup,lastInGroup:h.positional.lastInGroup}),[h.isHighlighted,P,u,h.positional]),F=ot.useMemo(()=>({...h.contextValue,checked:u}),[h.contextValue,u]),T=ot.useCallback(x=>{_optionalChain([y, 'optionalCall', _213 => _213(x)]),x.defaultPrevented||h.handlers.onClick(x)},[y,h.handlers]),f=ot.useCallback(x=>{h.handlers.onPointerDown(x),_optionalChain([L, 'optionalCall', _214 => _214(x)])},[h.handlers,L]),G=ot.useCallback(x=>{_optionalChain([I, 'optionalCall', _215 => _215(x)]),x.defaultPrevented||h.handlers.onPointerMove(x)},[I,h.handlers]),O=q(),k=W(O,"radio-item"),E=_userender.useRender.call(void 0, {render:S,ref:[h.ref,h.rowRef,r],state:D,stateAttributesMapping:ii,props:{...M,...k?{[k]:""}:{},id:h.id,role:"menuitemradio",tabIndex:-1,"aria-checked":u,"aria-disabled":P||void 0,className:_chunkPCNHYMD6cjs.a.call(void 0, b,D),style:_chunkPCNHYMD6cjs.b.call(void 0, R,D),onClick:T,onPointerMove:G,onPointerDown:f,children:N},enabled:h.isVisible,defaultTagName:"div"});return h.isVisible?_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:h.contextValue,children:_jsxruntime.jsx.call(void 0, dr.Provider,{value:F,children:E})}):null});var pi={checked:e=>e?{"data-checked":""}:{"data-unchecked":""},disabled:e=>e?{"data-disabled":""}:null},li= exports.oa =cn.forwardRef(function(o,r){let{keepMounted:t=!1,render:a,className:n,style:c,children:p,...g}=o,{checked:l,highlighted:i,disabled:d}=gs(),m=cn.useMemo(()=>({checked:l,highlighted:i,disabled:d}),[l,i,d]),S=t||l,b=q(),R=W(b,"radio-item-indicator");return _userender.useRender.call(void 0, {render:a,ref:r,state:m,stateAttributesMapping:pi,props:{...g,...R?{[R]:""}:{},"aria-hidden":!0,className:_chunkPCNHYMD6cjs.a.call(void 0, n,m),style:_chunkPCNHYMD6cjs.b.call(void 0, c,m),children:p},enabled:S,defaultTagName:"span"})});function Zt(e){let{surfaceId:o}=_chunkXMZZ62VJcjs.p.call(void 0, ),r=qo(),t=pn.useId();pn.useLayoutEffect(()=>{if(!(!r||!e))return r.registerZone(o,t,e)},[r,o,t,e])}var fi=ln.forwardRef(function(o,r){let{render:t,className:a,style:n,...c}=o,[p,g]=ln.useState(null);Zt(p);let l=q(),i=W(l,"focus-zone");return _userender.useRender.call(void 0, {render:t,ref:[g,r],state:{},props:{...c,...i?{[i]:""}:{},className:_chunkPCNHYMD6cjs.a.call(void 0, a,{}),style:_chunkPCNHYMD6cjs.b.call(void 0, n,{})},defaultTagName:"div"})});var gi=dn.forwardRef(function(o,r){let{render:t,className:a,style:n,...c}=o,[p,g]=dn.useState(null);Zt(p);let l=q(),i=W(l,"footer");return _userender.useRender.call(void 0, {render:t,ref:[g,r],state:{},props:{...c,...i?{[i]:""}:{},className:_chunkPCNHYMD6cjs.a.call(void 0, a,{}),style:_chunkPCNHYMD6cjs.b.call(void 0, n,{})},defaultTagName:"div"})});var hi={first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null,firstGroup:e=>e?{"data-first-group":""}:null,lastGroup:e=>e?{"data-last-group":""}:null},Ri= exports.ra =Be.forwardRef(function(o,r){let{forceMount:t=!1,render:a,className:n,style:c,children:p,...g}=o,{store:l}=_chunkXMZZ62VJcjs.p.call(void 0, ),i=Be.useId(),d=Be.useRef(null),[m,S]=Be.useState(null);Be.useEffect(()=>l.registerGroup(i,d),[i,l]),Be.useLayoutEffect(()=>{if(m)return l.registerRow(i,m,{kind:"group"})},[m,i,l]);let b=l.useState("isGroupVisible",i),R=t||b,y=l.useState("isFirstGroup",i),L=l.useState("isLastGroup",i),I=l.useState("isFirstRow",i),N=l.useState("isLastRow",i),M=Be.useMemo(()=>({groupId:i}),[i]),v=Be.useMemo(()=>({hidden:!R,firstGroup:y,lastGroup:L,first:I,last:N}),[R,y,L,I,N]),s=q(),u=W(s,"group"),h=_userender.useRender.call(void 0, {render:a,ref:[d,S,r],state:v,stateAttributesMapping:hi,props:{...g,...u?{[u]:""}:{},role:"presentation",className:_chunkPCNHYMD6cjs.a.call(void 0, n,v),style:_chunkPCNHYMD6cjs.b.call(void 0, c,v),children:p},enabled:R,defaultTagName:"div"});return R?_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.d.Provider,{value:M,children:h}):null});function Pi(e){let{groupId:o,positional:r,children:t}=e,a=hs.useMemo(()=>({groupId:o,positional:r}),[o,r]);return _jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.d.Provider,{value:a,children:t})}var Mi=fn.forwardRef(function(o,r){let{render:t,className:a,style:n,...c}=o,[p,g]=fn.useState(null);Zt(p);let l=q(),i=W(l,"header");return _userender.useRender.call(void 0, {render:t,ref:[g,r],state:{},props:{...c,...i?{[i]:""}:{},className:_chunkPCNHYMD6cjs.a.call(void 0, a,{}),style:_chunkPCNHYMD6cjs.b.call(void 0, n,{})},defaultTagName:"div"})});var vi={first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null},ki= exports.ua =it.forwardRef(function(o,r){let{alwaysRender:t=!1,render:a,className:n,style:c,...p}=o,{store:g}=_chunkXMZZ62VJcjs.p.call(void 0, ),l=it.useId(),[i,d]=it.useState(null);it.useLayoutEffect(()=>{if(i)return g.registerRow(l,i,{kind:"separator"})},[i,l,g]);let b=g.useState("normalizedSearch").length>0&&!t,R=g.useState("isFirstRow",l),y=g.useState("isLastRow",l),L=it.useMemo(()=>({first:R,last:y}),[R,y]),I=q(),N=W(I,"separator"),M=_userender.useRender.call(void 0, {render:a,ref:[d,r],state:L,stateAttributesMapping:vi,props:{...p,...N?{[N]:""}:{},role:"none",className:_chunkPCNHYMD6cjs.a.call(void 0, n,L),style:_chunkPCNHYMD6cjs.b.call(void 0, c,L)},defaultTagName:"div"});return b?null:M});var Di={highlighted:e=>e?{"data-highlighted":""}:null},Ni= exports.va =mn.forwardRef(function(o,r){let{children:t,render:a,className:n,style:c,...p}=o,{shortcut:g,highlighted:l}=_chunkXMZZ62VJcjs.g.call(void 0, ),i=mn.useMemo(()=>({shortcut:g,highlighted:l}),[g,l]),d=typeof t=="function"?t(i):_nullishCoalesce(t, () => (g)),m=q(),S=W(m,"shortcut");return _userender.useRender.call(void 0, {render:a,ref:r,state:i,stateAttributesMapping:Di,props:{...p,...S?{[S]:""}:{},className:_chunkPCNHYMD6cjs.a.call(void 0, n,i),style:_chunkPCNHYMD6cjs.b.call(void 0, c,i),children:d},defaultTagName:"kbd"})});var fr=gn.createContext(null);function $t(){return gn.useContext(fr)}var Li={depth:e=>({"data-depth":String(e)})},Oi= exports.wa =Rs.forwardRef(function(o,r){let{render:t,className:a,style:n,children:c,...p}=o,g=(_nullishCoalesce(_optionalChain([$t, 'call', _216 => _216(), 'optionalAccess', _217 => _217.depth]), () => (0)))+1,l=q(),i=W(l,"tree"),d={depth:g},m=_userender.useRender.call(void 0, {render:t,ref:r,state:d,stateAttributesMapping:Li,props:{...p,...i?{[i]:""}:{},role:"presentation",className:_chunkPCNHYMD6cjs.a.call(void 0, a,d),style:_chunkPCNHYMD6cjs.b.call(void 0, n,d),children:c},defaultTagName:"div"});return _jsxruntime.jsx.call(void 0, fr.Provider,{value:{depth:g},children:m})});function bn(e,o){return _chunkPCNHYMD6cjs.c.call(void 0, e,r=>({...r,"--tree-depth":o}))}var Ei={depth:e=>({"data-depth":String(e)})},Ai= exports.xa =Ss.forwardRef(function(o,r){let{depth:t,render:a,className:n,style:c,children:p,...g}=o,l=$t(),i=_nullishCoalesce(_nullishCoalesce(t, () => (_optionalChain([l, 'optionalAccess', _218 => _218.depth]))), () => (0)),d=q(),m=W(d,"tree-connector"),S={depth:i};return _userender.useRender.call(void 0, {render:a,ref:r,state:S,stateAttributesMapping:Ei,props:{...g,...m?{[m]:""}:{},"aria-hidden":"true","data-depth":i,className:_chunkPCNHYMD6cjs.a.call(void 0, n,S),style:_chunkPCNHYMD6cjs.b.call(void 0, bn(c,i),S),children:p},defaultTagName:"span"})});var Fi=Ps.forwardRef(function(o,r){let{selectable:t=!0,depth:a,style:n,children:c,...p}=o,g=$t(),l=_nullishCoalesce(_nullishCoalesce(a, () => (_optionalChain([g, 'optionalAccess', _219 => _219.depth]))), () => (0)),i=q(),d=W(i,"tree-item");return _jsxruntime.jsx.call(void 0, lr,{...p,ref:r,activatable:t,style:bn(n,l),...d?{[d]:""}:{},"data-tree-item":"","data-depth":l,...t===!1?{"data-header":""}:{},children:c})});function Hi(e){let{open:o,onOpenChange:r,defaultOpen:t=!1,closeRootOnEsc:a=!0,virtualized:n=!1,items:c,onHighlightChange:p,onOpenChangeComplete:g,disabled:l=!1,actionsRef:i,children:d,...m}=e,S=_chunkXMZZ62VJcjs.k.call(void 0, ),b=lt(),R=_nullishCoalesce(_optionalChain([S, 'optionalAccess', _220 => _220.depth]), () => (0)),y=_optionalChain([S, 'optionalAccess', _221 => _221.closeAll]),L=_optionalChain([S, 'optionalAccess', _222 => _222.registerSurface]),I=Uo(),N=fe.useCallback((V,C,j)=>{_optionalChain([p, 'optionalCall', _223 => _223(V,V===null?null:_nullishCoalesce(_optionalChain([I, 'optionalAccess', _224 => _224.getNodeById, 'call', _225 => _225(V)]), () => (null)),C,j)])},[I,p]),{surfaceId:M}=_chunkXMZZ62VJcjs.p.call(void 0, ),v=fe.useId(),s=fe.useRef(null),u=fe.useRef(null),h=fe.useRef(!1),P=_chunkXMZZ62VJcjs.y.useStore(void 0,{open:t}),[D,F]=fe.useState(!1),T=(_nullishCoalesce(_optionalChain([b, 'optionalAccess', _226 => _226.disabled]), () => (!1)))||l||D,f=fe.useCallback(V=>{F(V)},[]),G=fe.useCallback(V=>{V&&T||P.setOpen(V)},[P,T]);P.useControlledProp("openProp",o);let O=It(),k=P.useState("open");fe.useEffect(()=>{k?O.open(v):O.close(v)},[k,v,O]);let E=fe.useCallback((V,C)=>{_optionalChain([r, 'optionalCall', _227 => _227(V,C)]),!C.isCanceled&&G(V)},[G,r]),x=fe.useCallback(V=>{!V&&P.context.clearSearchOnClose==="after-exit"&&(P.clearSearch(),P.setInputActive(!1)),V||(P.clearHighlight(),_optionalChain([P, 'access', _228 => _228.context, 'access', _229 => _229.onCloseComplete, 'optionalCall', _230 => _230()]),_optionalChain([P, 'access', _231 => _231.context, 'access', _232 => _232.onPopupCloseComplete, 'optionalCall', _233 => _233()])),_optionalChain([g, 'optionalCall', _234 => _234(V)])},[P,g]),[w,z]=fe.useState(!0);fe.useEffect(()=>{if(!S)return;let V=S.store,C=()=>{let B=V.state.open;z(B)};return C(),V.observe("open",C)},[S]),fe.useEffect(()=>{w||G(!1)},[w,G]);let A=R+1;fe.useEffect(()=>{if(L)return L(A,V=>G(V))},[L,A,G]);let U=fe.useRef(null);fe.useImperativeHandle(i,()=>({close:()=>{_optionalChain([U, 'access', _235 => _235.current, 'optionalAccess', _236 => _236.close, 'call', _237 => _237()])},unmount:()=>{_optionalChain([U, 'access', _238 => _238.current, 'optionalAccess', _239 => _239.unmount, 'call', _240 => _240()])},setDisabled:f}),[f]);let $=fe.useMemo(()=>({open:k,setOpen:G,suppressAutoOpenRef:h,triggerRef:s,contentRef:u,parentSurfaceId:M,childSurfaceId:v,closeRootOnEsc:a}),[k,G,M,v,a]),ae=fe.useCallback(()=>()=>{},[]),H=fe.useMemo(()=>{if(!(!n&&!p))return{virtualized:n,items:_nullishCoalesce(c, () => ([])),onHighlightChange:N}},[n,c,N,p]),se=fe.useMemo(()=>({store:P,depth:A,closeAll:_nullishCoalesce(y, () => ((()=>P.setOpen(!1)))),registerSurface:_nullishCoalesce(L, () => (ae)),virtualization:H}),[P,A,y,L,ae,H]),K=fe.useMemo(()=>({store:P,disabled:T,depth:A,closeAll:_nullishCoalesce(y, () => ((()=>G(!1)))),explicitTabBehavior:_nullishCoalesce(_optionalChain([b, 'optionalAccess', _241 => _241.explicitTabBehavior]), () => (!1)),tabWithoutZones:_nullishCoalesce(_optionalChain([b, 'optionalAccess', _242 => _242.tabWithoutZones]), () => ("close")),registerSurface:_nullishCoalesce(L, () => (ae)),virtualization:H,virtualAnchor:_optionalChain([b, 'optionalAccess', _243 => _243.virtualAnchor]),menuType:_nullishCoalesce(_optionalChain([b, 'optionalAccess', _244 => _244.menuType]), () => ("dropdown")),closeOnOutsidePress:_nullishCoalesce(_optionalChain([b, 'optionalAccess', _245 => _245.closeOnOutsidePress]), () => ("pointerdown"))}),[P,T,A,y,_optionalChain([b, 'optionalAccess', _246 => _246.explicitTabBehavior]),_optionalChain([b, 'optionalAccess', _247 => _247.tabWithoutZones]),L,G,ae,H,_optionalChain([b, 'optionalAccess', _248 => _248.virtualAnchor]),_optionalChain([b, 'optionalAccess', _249 => _249.menuType]),_optionalChain([b, 'optionalAccess', _250 => _250.closeOnOutsidePress])]);return _jsxruntime.jsx.call(void 0, Go.Provider,{value:$,children:_jsxruntime.jsx.call(void 0, pt.Provider,{value:K,children:_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.i.Provider,{value:se,children:_jsxruntime.jsx.call(void 0, _popover.Popover.Root,{...m,open:k,onOpenChange:E,onOpenChangeComplete:x,actionsRef:i?U:void 0,children:d})})})})}function xs(e,o,r){let t=[],a=e.left-o;a>0&&t.push({side:"left",gap:a});let n=o-e.right;n>0&&t.push({side:"right",gap:n});let c=e.top-r;c>0&&t.push({side:"top",gap:c});let p=r-e.bottom;if(p>0&&t.push({side:"bottom",gap:p}),t.length>0)return t.sort((l,i)=>i.gap-l.gap),t[0].side;let g=[{side:"left",value:Math.abs(o-e.left)},{side:"right",value:Math.abs(o-e.right)},{side:"top",value:Math.abs(r-e.top)},{side:"bottom",value:Math.abs(r-e.bottom)}];return g.sort((l,i)=>l.value-i.value),g[0].side}function Rn(e,o,r,t){if(o){let a=(o.left+o.right)/2,n=(o.top+o.bottom)/2;return xs(e,a,n)}if(t===void 0){if(r<e.left)return"left";if(r>e.right)return"right";let a=(e.left+e.right)/2;return r<=a?"left":"right"}return xs(e,r,t)}function mr(e,o,r,t,a,n){let c=0,p=0,g=Math.min(Math.max(e.length-1,0),4);for(let i=e.length-g-1;i<e.length-1;i++){if(i<0)continue;let[d,m]=e[i],[S,b]=e[i+1];c+=S-d,p+=b-m}if(Math.hypot(c,p)<.5){let i=a?(a.left+a.right)/2:o,d=a?(a.top+a.bottom)/2:r;if(t==="left"||t==="right"){let m=t==="right"?n.right:n.left,S=(n.top+n.bottom)/2;c=m-i,p=S-d}else{let m=t==="top"?n.top:n.bottom;c=(n.left+n.right)/2-i,p=m-d}}return{dx:c,dy:p}}function gr(e,o,r,t,a,n){let{dx:c,dy:p}=r,g=a==="left"||a==="right",l=g?c:p;if(Math.abs(l)<.01||a==="left"&&c<=0||a==="right"&&c>=0||a==="top"&&p<=0||a==="bottom"&&p>=0)return!1;let d=((a==="left"?t.left:a==="right"?t.right:a==="top"?t.top:t.bottom)-(g?e:o))/l;if(d<=0)return!1;let m=g?o+d*p:e+d*c,S=n?g?n.height:n.width:null,b=S?S*.75:28,R=Math.max(12,Math.min(36,b)),y=(g?t.top:t.left)-R*.25,L=(g?t.bottom:t.right)+R*.25;return m>=y&&m<=L}function Io(e,o=!1){let r=["mouse","pen"];return o||r.push("",void 0),r.includes(e)}var Pn=new Set,Sn=null;function ji(){if(Sn!==null||typeof window>"u")return;let e=o=>{for(let r of Pn){let t=r.trailRef.current;t.push([o.clientX,o.clientY]),t.length>r.limit&&t.shift()}};window.addEventListener("pointermove",e,{passive:!0}),Sn=()=>{window.removeEventListener("pointermove",e),Sn=null}}function zi(){Pn.size===0&&_optionalChain([Sn, 'optionalCall', _251 => _251()])}function ys(e=4){let o=xn.useRef([]);return xn.useEffect(()=>{let r={trailRef:o,limit:e};return Pn.add(r),ji(),()=>{Pn.delete(r),o.current=[],zi()}},[e]),o}function Ms(){let[e,o]=yn.useState([0,0]);return yn.useEffect(()=>{let r=t=>{o([t.clientX,t.clientY])};return window.addEventListener("pointermove",r,{passive:!0}),()=>{window.removeEventListener("pointermove",r)}},[]),e}function ks(e){let{config:o,contentRef:r,triggerRef:t,tone:a,contentRectOverride:n,triggerRectOverride:c,mousePointOverride:p}=e,[g,l]=Ms(),i=vs.useMemo(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)").matches:!1,[]),d=r.current,m=_nullishCoalesce(n, () => (_optionalChain([d, 'optionalAccess', _252 => _252.getBoundingClientRect, 'call', _253 => _253()])));if(!m||i||typeof document>"u"||!document.body)return null;let S=_nullishCoalesce(c, () => ((t.current?t.current.getBoundingClientRect():null))),b=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _254 => _254[0]]), () => (g)),R=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _255 => _255[1]]), () => (l)),y=m.left,L=m.top,I=m.width,N=m.height;if(!I||!N)return null;let M=Rn(m,S,b,R);if(M==="top"||M==="bottom"||M==="left"&&b>=y||M==="right"&&b<=y+I)return null;let v=2,s=Math.max(0,Math.min(100,(R-L)/N*100)),u=M==="left"?Math.max(y-b,10)+v:Math.max(b-(y+I),10)+v,h=Math.max(0,Math.min(1,o.overlayOpacity)),P=Math.max(0,Math.min(1,o.triangleFillOpacity)),D=o.showStroke?Math.max(0,o.strokeWidth):0,F=o.showDots?Math.max(0,o.dotRadius):0,T=Math.max(1,Math.min(u,N)/2),f=Math.min(Math.max(F,D/2)+.5,T),G=o.showDots?Math.max(0,Math.min(F,f-D/2-.5)):0,O=Math.max(f,Math.min(N-f,s/100*N)),k=M==="left"?y-u:y+I,E=o.idleColor;a==="activated"?E=o.successColor:a==="missed"&&(E=o.missColor);let x=M==="left"?[[u-f,f],[f,O],[u-f,N-f]]:[[f,f],[f,N-f],[u-f,O]],w=x.map(([A,U])=>`${A},${U}`).join(" "),z=_jsxruntime.jsxs.call(void 0, "svg",{"data-bazzaui-submenu-safe-triangle-area":"","data-safe-triangle-tone":a,"aria-hidden":!0,viewBox:`0 0 ${u} ${N}`,style:{position:"fixed",top:L,left:k,width:u,height:N,pointerEvents:"none",zIndex:Number.MAX_SAFE_INTEGER,transform:"translateZ(0)",opacity:h},children:[_jsxruntime.jsx.call(void 0, "polygon",{points:w,fill:E,fillOpacity:P,stroke:o.showStroke?E:"none",strokeWidth:D,strokeDasharray:o.showStroke?o.strokeDasharray:void 0,strokeLinecap:"round",strokeLinejoin:"round"}),o.showDots?x.map(([A,U])=>_jsxruntime.jsx.call(void 0, "circle",{cx:A,cy:U,r:G,fill:E},`${A}-${U}`)):null]});return _reactdom.createPortal.call(void 0, z,document.body)}var Ui={popupOpen:e=>e?{"data-popup-open":""}:null,popupFocused:e=>e?{"data-popup-focused":""}:null},Zi= exports.Aa =Mn.forwardRef(function(o,r){let{render:t,className:a,style:n,children:c,...p}=o,{open:g,childSurfaceId:l}=oo(),d=ye().useState("isOwner",l),m=Mn.useMemo(()=>({popupOpen:g,popupFocused:d}),[g,d]),S=q(),b=W(S,"submenu-trigger-indicator");return _userender.useRender.call(void 0, {render:t,ref:r,state:m,stateAttributesMapping:Ui,props:{...p,...b?{[b]:""}:{},"aria-hidden":!0,className:_chunkPCNHYMD6cjs.a.call(void 0, a,m),style:_chunkPCNHYMD6cjs.b.call(void 0, n,m),children:c},defaultTagName:"span"})});var Xi={submenuTrigger:e=>e?{"data-submenu-trigger":""}:null,popupOpen:e=>e?{"data-popup-open":""}:null,popupFocused:e=>e?{"data-popup-focused":""}:null,highlighted:e=>e?{"data-highlighted":""}:null,disabled:e=>e?{"data-disabled":""}:null,first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null,firstInGroup:e=>e?{"data-first-in-group":""}:null,lastInGroup:e=>e?{"data-last-in-group":""}:null},_i= exports.Ba =_.forwardRef(function(o,r){let{id:t,value:a,keywords:n,disabled:c=!1,forceMount:p=!1,openOnHighlight:g=!0,delay:l,closeDelay:i=0,closeOnPointerLeave:d=!0,forceOrder:m,forceScore:S,render:b,className:R,style:y,onPointerDown:L,onPointerMove:I,onPointerEnter:N,onPointerLeave:M,children:v,...s}=o,u=_.useMemo(()=>typeof l=="number"?{pointer:l,keyboard:l}:{pointer:_nullishCoalesce(_optionalChain([l, 'optionalAccess', _256 => _256.pointer]), () => (0)),keyboard:_nullishCoalesce(_optionalChain([l, 'optionalAccess', _257 => _257.keyboard]), () => (150))},[l]),{store:h}=_chunkXMZZ62VJcjs.p.call(void 0, ),{depth:P}=_chunkXMZZ62VJcjs.j.call(void 0, ),D=P-1,F=oo(),{open:T,setOpen:f,suppressAutoOpenRef:G,triggerRef:O,contentRef:k,childSurfaceId:E}=F,x=_.useRef(null),w=_.useRef(null),z=_.useRef(null),A=_.useRef(null),U=_.useCallback(()=>{x.current!==null&&(clearTimeout(x.current),x.current=null)},[]),$=_.useCallback(()=>{w.current!==null&&(clearTimeout(w.current),w.current=null)},[]),ae=_.useCallback(()=>{if(d){if($(),i<=0){f(!1);return}w.current=setTimeout(()=>{w.current=null,f(!1)},i)}},[$,i,d,f]),H=_.useCallback(()=>{z.current&&(z.current(),z.current=null),A.current!==null&&(clearTimeout(A.current),A.current=null)},[]);_.useEffect(()=>()=>{U(),$(),H()},[U,$,H]);let se=ye(),{aimGuardActive:K,guardedTriggerId:V,guardedDepth:C,aimGuardActiveRef:j,guardedTriggerIdRef:B,guardedDepthRef:J,activateAimGuard:ne,clearAimGuard:te}=Kt(),ge=ys(4),{showSafeTriangleArea:Ge,logAimGuardEvents:$e}=zo(),be=Ge.enabled,[pe,Ve]=_.useState("hidden"),[et,Le]=_.useState(null),Ce=_.useRef(null),Z=Fe({id:t,value:a,keywords:n,disabled:c,forceMount:p,forceOrder:m,forceScore:S,isSubmenuTrigger:!0,closeOnClick:!1,children:v}),Ye=Z.disabled,ie=_.useCallback((Q,re)=>{$e&&console.log(`[PopupMenu][AimGuard] ${Q}`,{triggerId:Z.id,triggerStoreId:Z.storeId,parentDepth:D,aimGuardActive:j.current,guardedTriggerId:B.current,guardedDepth:J.current,...re})},[$e,Z.id,Z.storeId,D,j,B,J]),we=_.useCallback(()=>{Ce.current!==null&&(clearTimeout(Ce.current),Ce.current=null)},[]);_.useEffect(()=>we,[we]);let yt=_.useCallback(Q=>{be&&(we(),Ge.freezeOnPointerLeave?Le(Q):Le(null),Ve("activated"))},[be,Ge.freezeOnPointerLeave,we]),oe=_.useCallback(Q=>{if(we(),!be||!Ge.showMissState){Ve("hidden"),Le(null);return}Ve("missed"),Le(Q);let re=Ge.missFreezeDuration;if(re<=0){Ve("hidden"),Le(null);return}Ce.current=setTimeout(()=>{Ce.current=null,Ve("hidden"),Le(null)},re)},[we,be,Ge.showMissState,Ge.missFreezeDuration]),Xe=_.useCallback((Q,re,Pe,ve,ut,At)=>{if(H(),ie("leave-monitor-start",{anchor:Q,initialHit:Pe,timeoutMs:ve,closeDelay:i,triggerRect:re,initialPointerX:ut,initialPointerY:At}),ve<=0){ie("leave-monitor-skip-timeout",{timeoutMs:ve});return}let kt=Pe,rt=ut,_t=At,Jt=Rr=>{if(!Io(Rr.pointerType))return;let ct=_optionalChain([k, 'access', _258 => _258.current, 'optionalAccess', _259 => _259.getBoundingClientRect, 'call', _260 => _260()]);if(!ct){ie("leave-monitor-stop-no-content-rect"),H();return}let{clientX:He,clientY:je}=Rr,Is=He>=ct.left&&He<=ct.right&&je>=ct.top&&je<=ct.bottom,Ft=Q==="left"||Q==="right"?He-rt:je-_t;if(rt=He,_t=je,Is){ie("leave-monitor-inside-popup",{clientX:He,clientY:je}),$(),H();return}let Sr=Q==="left"&&Ft<=-2||Q==="right"&&Ft>=2||Q==="top"&&Ft<=-2||Q==="bottom"&&Ft>=2;if(ie("leave-monitor-pointermove",{anchor:Q,clientX:He,clientY:je,axisDelta:Ft,movedAwayFromSubmenu:Sr,lastHit:kt}),kt&&Sr){let Ds={contentRect:ct,triggerRect:re,pointerX:He,pointerY:je};kt=!1,ie("leave-monitor-reversal-close",{anchor:Q,clientX:He,clientY:je,axisDelta:Ft}),oe(Ds),te(),ae(),(i<=0||!d)&&H();return}let Pr=mr(ge.current,He,je,Q,re,ct),Do=gr(He,je,Pr,ct,Q,re);if(ie("leave-monitor-hit-eval",{anchor:Q,clientX:He,clientY:je,hit:Do,lastHit:kt,heading:Pr}),Do===kt)return;let xr={contentRect:ct,triggerRect:re,pointerX:He,pointerY:je};if(kt=Do,Do){ie("leave-monitor-hit-transition",{anchor:Q,clientX:He,clientY:je}),yt(xr),$(),ne(Z.id,D,E,600),h.setHighlightedId(Z.storeId),f(!0);return}ie("leave-monitor-miss-transition",{anchor:Q,clientX:He,clientY:je}),oe(xr),te(),ae(),(i<=0||!d)&&H()};window.addEventListener("pointermove",Jt,{passive:!0}),z.current=()=>{ie("leave-monitor-cleanup-remove-listener"),window.removeEventListener("pointermove",Jt)},A.current=setTimeout(()=>{A.current=null,ie("leave-monitor-timeout-expired",{timeoutMs:ve}),H()},ve)},[H,ie,k,$,ge,yt,ne,Z.id,D,E,h,Z.storeId,f,oe,te,ae,i,d]);_.useEffect(()=>{be||(we(),Ve("hidden"),Le(null))},[be,we]),_.useEffect(()=>{if(!be||Ge.persistOnSuccess||pe!=="activated")return;K&&V===Z.id&&C===D||(we(),Ve("hidden"),Le(null))},[be,Ge.persistOnSuccess,pe,K,V,C,Z.id,D,we]),_.useEffect(()=>{pe!=="activated"||T||(we(),Ve("hidden"),Le(null))},[pe,T,we]),_.useEffect(()=>{T||($(),H())},[T,$,H]),_.useEffect(()=>{T||!j.current||B.current!==Z.id||J.current!==D||te()},[T,Z.id,D,j,B,J,te]),_.useEffect(()=>{Z.isVisible||!j.current||B.current!==Z.id||J.current!==D||te()},[Z.isVisible,Z.id,D,j,B,J,te]),_.useEffect(()=>()=>{j.current&&B.current===Z.id&&J.current===D&&te()},[Z.id,D,j,B,J,te]),_.useEffect(()=>{if(!T)return;let Q=k.current;if(!Q)return;let re=()=>{$(),H()},Pe=()=>{$(),H()};return Q.addEventListener("pointerenter",re),Q.addEventListener("pointermove",Pe,{passive:!0}),()=>{Q.removeEventListener("pointerenter",re),Q.removeEventListener("pointermove",Pe)}},[T,k,$,H]),_.useEffect(()=>h.registerSubmenuOpen(Z.storeId,()=>{f(!0),se.setOwnerId(E),requestAnimationFrame(()=>{let Q=_optionalChain([k, 'access', _261 => _261.current, 'optionalAccess', _262 => _262.querySelector, 'call', _263 => _263("input")]),re=_optionalChain([k, 'access', _264 => _264.current, 'optionalAccess', _265 => _265.querySelector, 'call', _266 => _266('[role="listbox"]')]),Pe=_nullishCoalesce(Q, () => (re));Pe&&Pe instanceof HTMLElement&&Pe.focus()})}),[Z.storeId,h,f,se,E,k]),_.useEffect(()=>h.registerSubmenuClose(Z.storeId,()=>f(!1)),[Z.storeId,h,f]);let Mt=se.useState("isOwner",E);_.useEffect(()=>{!Z.isVisible&&T&&f(!1)},[Z.isVisible,T,f]),_.useEffect(()=>{Z.isHighlighted||(G.current=!1)},[Z.isHighlighted,G]),_.useEffect(()=>{if(!g)return;if(!Z.isHighlighted||h.state.highlightSource!=="keyboard"){U();return}if(G.current)return;let Q=u.keyboard;return Q<=0?f(!0):x.current=setTimeout(()=>{x.current=null,!G.current&&f(!0)},Q),U},[Z.isHighlighted,h,u.keyboard,f,U,g]),_.useEffect(()=>(O.current=Z.ref.current,()=>{O.current=null}),[O,Z.ref]);let Ot=_.useCallback(Q=>{Q.preventDefault(),T&&(G.current=!0,ie("pointerdown-suppress-auto-open",{clientX:Q.clientX,clientY:Q.clientY})),_optionalChain([L, 'optionalCall', _267 => _267(Q)])},[T,ie,L,G]),Xt=_.useCallback(Q=>{if(_optionalChain([I, 'optionalCall', _268 => _268(Q)]),Q.defaultPrevented||Ye||!Io(Q.pointerType)||!h.shouldAllowPointerHighlight(Q.clientX,Q.clientY))return;if(j.current&&J.current===D&&B.current!==Z.id){ie("pointermove-blocked-by-guard",{clientX:Q.clientX,clientY:Q.clientY,blockedByTriggerId:B.current});return}if(h.setHighlightedId(Z.storeId),!g||T)return;if(G.current){ie("pointermove-open-suppressed-after-explicit-close",{clientX:Q.clientX,clientY:Q.clientY});return}H(),$();let re=u.pointer;if(re<=0){f(!0);return}x.current===null&&(x.current=setTimeout(()=>{x.current=null,f(!0)},re))},[I,Ye,j,J,D,B,Z.id,Z.storeId,g,T,G,H,$,u.pointer,f,ie,h]),Tt=_.useCallback(Q=>{if(_optionalChain([N, 'optionalCall', _269 => _269(Q)]),Q.defaultPrevented||Ye||!Io(Q.pointerType))return;if(j.current&&J.current===D&&B.current!==Z.id){ie("pointerenter-blocked-by-guard",{clientX:Q.clientX,clientY:Q.clientY,blockedByTriggerId:B.current,blockedByDepth:J.current});return}if(ie("pointerenter-submenu-trigger",{clientX:Q.clientX,clientY:Q.clientY}),be&&(we(),Le(null),Ve("hover")),h.setHighlightedId(Z.storeId),!g)return;if(G.current){ie("pointerenter-open-suppressed-after-explicit-close",{clientX:Q.clientX,clientY:Q.clientY});return}H(),te(),U(),$();let re=u.pointer;re<=0?f(!0):x.current=setTimeout(()=>{x.current=null,f(!0)},re)},[N,Ye,j,J,B,Z.id,Z.storeId,h,g,G,H,te,U,$,we,be,u.pointer,f,ie,D]),Ct=_.useCallback(Q=>{if(_optionalChain([M, 'optionalCall', _270 => _270(Q)]),Q.defaultPrevented||Ye||!Io(Q.pointerType))return;if(U(),ie("pointerleave-submenu-trigger",{clientX:Q.clientX,clientY:Q.clientY}),j.current&&J.current===D&&B.current!==Z.id){ie("pointerleave-blocked-by-guard",{clientX:Q.clientX,clientY:Q.clientY,blockedByTriggerId:B.current,blockedByDepth:J.current});return}let re=_optionalChain([k, 'access', _271 => _271.current, 'optionalAccess', _272 => _272.getBoundingClientRect, 'call', _273 => _273()]);if(!re){ie("pointerleave-no-content-rect"),H(),we(),Ve("hidden"),Le(null),te(),ae();return}let{clientX:Pe,clientY:ve}=Q,ut=_nullishCoalesce(_optionalChain([O, 'access', _274 => _274.current, 'optionalAccess', _275 => _275.getBoundingClientRect, 'call', _276 => _276()]), () => (null)),At={contentRect:re,triggerRect:ut,pointerX:Pe,pointerY:ve};if(Pe>=re.left&&Pe<=re.right&&ve>=re.top&&ve<=re.bottom){ie("pointerleave-inside-popup-success",{clientX:Pe,clientY:ve}),yt(At),$(),H(),te();return}let rt=Rn(re,ut,Pe,ve),_t=mr(ge.current,Pe,ve,rt,ut,re),Jt=gr(Pe,ve,_t,re,rt,ut);ie("pointerleave-hit-eval",{anchor:rt,hit:Jt,clientX:Pe,clientY:ve,heading:_t}),Jt?(ie("pointerleave-hit-activate-guard",{anchor:rt,clientX:Pe,clientY:ve}),yt(At),ne(Z.id,D,E,600),h.setHighlightedId(Z.storeId),f(!0),Xe(rt,ut,!0,600,Pe,ve)):(ie("pointerleave-miss-close",{anchor:rt,clientX:Pe,clientY:ve}),oe(At),te(),ae(),d&&i>0?Xe(rt,ut,!1,i,Pe,ve):H())},[M,Ye,U,j,J,B,Z.id,Z.storeId,i,d,k,H,we,te,yt,oe,f,$,ae,Xe,O,ge,ne,D,E,h,ie]),We=_.useMemo(()=>({submenuTrigger:!0,popupOpen:T,popupFocused:Mt,highlighted:Z.isHighlighted,disabled:Ye,first:Z.positional.first,last:Z.positional.last,firstInGroup:Z.positional.firstInGroup,lastInGroup:Z.positional.lastInGroup}),[T,Mt,Z.isHighlighted,Ye,Z.positional]),bt=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:Z.contextValue,children:v}),ht=q(),Gt=W(ht,"submenu-trigger"),hr=_userender.useRender.call(void 0, {render:b,ref:[Z.ref,Z.rowRef,r],state:We,stateAttributesMapping:Xi,props:{...s,...Gt?{[Gt]:""}:{},id:Z.id,role:"menuitem","aria-haspopup":"menu","aria-expanded":T,tabIndex:-1,"aria-disabled":Ye||void 0,className:_chunkPCNHYMD6cjs.a.call(void 0, R,We),style:_chunkPCNHYMD6cjs.b.call(void 0, y,We),onPointerMove:Xt,onPointerDown:Ot,onPointerEnter:Tt,onPointerLeave:Ct,children:bt},defaultTagName:"div"}),vt=_.useMemo(()=>pe==="hover"?"hover":pe==="activated"?"activated":pe==="missed"?"missed":null,[pe]),Et=_jsxruntime.jsx.call(void 0, _popover.Popover.Trigger,{nativeButton:!1,disabled:Ye,render:hr});return Z.isVisible?!be||vt===null?Et:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[Et,_jsxruntime.jsx.call(void 0, ks,{config:Ge,contentRef:k,triggerRef:O,tone:vt,contentRectOverride:_optionalChain([et, 'optionalAccess', _277 => _277.contentRect]),triggerRectOverride:_optionalChain([et, 'optionalAccess', _278 => _278.triggerRect]),mousePointOverride:et?[et.pointerX,et.pointerY]:null})]}):null});function tu(e){let{pageId:o,closeRootOnEsc:r=!1,children:t}=e,a=_chunkXMZZ62VJcjs.k.call(void 0, ),n=lt(),c=Dt();if(!a||!n)throw new Error("PopupMenu.Subpage must be used within PopupMenu.Popup");let p=_chunkXMZZ62VJcjs.y.useStore(void 0,{open:!1}),g=nt.useId(),l=a.store.useState("open"),i=c.activePageId,d=c.stack,m=c.registerPage,S=c.goBack,b=c.getSurfaceId,R=c.rootSurfaceId,y=i===o&&b(o)===g;nt.useEffect(()=>m({pageId:o,surfaceId:g,closeRootOnEsc:r}),[m,o,g,r]),nt.useEffect(()=>{p.setOpen(l&&y)},[p,l,y]),nt.useEffect(()=>a.registerSurface(a.depth,s=>p.setOpen(s)),[a,p]);let L=nt.useMemo(()=>{let s=d.lastIndexOf(o);if(s<=0)return R;let u=d[s-1];return u===void 0?null:b(u)},[d,o,b,R]),I=nt.useMemo(()=>({pageId:o,surfaceId:g,parentSurfaceId:L,isActive:y,closeRootOnEsc:r,goBack:S}),[o,g,L,y,r,S]),N=nt.useMemo(()=>({store:p,depth:a.depth,closeAll:a.closeAll,registerSurface:a.registerSurface,virtualization:a.virtualization}),[p,a]),M=nt.useMemo(()=>({store:p,depth:n.depth,closeAll:n.closeAll,explicitTabBehavior:n.explicitTabBehavior,tabWithoutZones:n.tabWithoutZones,registerSurface:n.registerSurface,virtualization:n.virtualization,virtualAnchor:n.virtualAnchor,menuType:n.menuType,disabled:n.disabled,closeOnOutsidePress:n.closeOnOutsidePress}),[p,n]),v=y;return _jsxruntime.jsx.call(void 0, Eo.Provider,{value:I,children:_jsxruntime.jsx.call(void 0, jt.Provider,{value:g,children:_jsxruntime.jsx.call(void 0, pt.Provider,{value:M,children:_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.i.Provider,{value:N,children:v?t:null})})})})}var nu={canGoBack:e=>e?{"data-can-go-back":""}:null,disabled:e=>e?{"data-disabled":""}:null},ru= exports.Da =Yt.forwardRef(function(o,r){let{disabled:t=!1,render:a,className:n,style:c,onClick:p,children:g,...l}=o,i=ro(),d=Dt(),m=ye(),S=Ee(),b=t||S.disabled,R=Yt.useCallback(N=>{if(_optionalChain([p, 'optionalCall', _279 => _279(N)]),N.defaultPrevented||b)return;i.goBack()&&i.parentSurfaceId&&m.setOwnerId(i.parentSurfaceId)},[p,b,i,m]),y=Yt.useMemo(()=>({canGoBack:d.canGoBack,disabled:b}),[d.canGoBack,b]),L=q(),I=W(L,"subpage-back");return _userender.useRender.call(void 0, {render:a,ref:r,state:y,stateAttributesMapping:nu,props:{...l,...I?{[I]:""}:{},type:"button",disabled:b,className:_chunkPCNHYMD6cjs.a.call(void 0, n,y),style:_chunkPCNHYMD6cjs.b.call(void 0, c,y),onClick:R,children:g},defaultTagName:"button"})});var au={subpageBackItem:e=>e?{"data-subpage-back-item":""}:null,highlighted:e=>e?{"data-highlighted":""}:null,disabled:e=>e?{"data-disabled":""}:null,first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null,firstInGroup:e=>e?{"data-first-in-group":""}:null,lastInGroup:e=>e?{"data-last-in-group":""}:null},iu= exports.Ea =Te.forwardRef(function(o,r){let{id:t,value:a,keywords:n,disabled:c=!1,forceMount:p=!1,onSelect:g,onSelectAsync:l,render:i,className:d,style:m,onClick:S,onPointerMove:b,onPointerDown:R,children:y,...L}=o,I=ro(),N=ye(),[M,v]=Te.useState(!1),s=Te.useRef(null);Te.useEffect(()=>()=>{_optionalChain([s, 'access', _280 => _280.current, 'optionalAccess', _281 => _281.abort, 'call', _282 => _282()])},[]);let u=Te.useCallback(()=>{let x=I.goBack();return x&&I.parentSurfaceId&&N.setOwnerId(I.parentSurfaceId),x},[I,N]),h=Te.useCallback(()=>{if(l){if(M)return;_optionalChain([s, 'access', _283 => _283.current, 'optionalAccess', _284 => _284.abort, 'call', _285 => _285()]);let x=new AbortController;s.current=x,v(!0);let w=!1,z={goBack:()=>{let A=u();return A&&(w=!0),A},signal:x.signal};l(z).then(A=>{x.signal.aborted||A!==!1&&!w&&z.goBack()}).catch(()=>{}).finally(()=>{x.signal.aborted||v(!1)});return}_optionalChain([g, 'optionalCall', _286 => _286()]),u()},[g,l,u,M]),P=Fe({id:t,value:a,keywords:n,disabled:c||M,forceMount:p,closeOnClick:!1,onSelect:h,children:y}),D=P.disabled,F=Te.useMemo(()=>({subpageBackItem:!0,highlighted:P.isHighlighted,disabled:D,first:P.positional.first,last:P.positional.last,firstInGroup:P.positional.firstInGroup,lastInGroup:P.positional.lastInGroup}),[P.isHighlighted,D,P.positional]),T=Te.useCallback(x=>{_optionalChain([S, 'optionalCall', _287 => _287(x)]),x.defaultPrevented||P.handlers.onClick(x)},[S,P.handlers]),f=Te.useCallback(x=>{P.handlers.onPointerDown(x),_optionalChain([R, 'optionalCall', _288 => _288(x)])},[P.handlers,R]),G=Te.useCallback(x=>{_optionalChain([b, 'optionalCall', _289 => _289(x)]),x.defaultPrevented||P.handlers.onPointerMove(x)},[b,P.handlers]),O=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:P.contextValue,children:y}),k=q(),E=W(k,"subpage-back-item");return _userender.useRender.call(void 0, {render:i,ref:[P.ref,P.rowRef,r],state:F,stateAttributesMapping:au,props:{...L,...E?{[E]:""}:{},id:P.id,role:"option",tabIndex:-1,"aria-selected":P.isHighlighted,"aria-disabled":D||void 0,className:_chunkPCNHYMD6cjs.a.call(void 0, d,F),style:_chunkPCNHYMD6cjs.b.call(void 0, m,F),onClick:T,onPointerMove:G,onPointerDown:f,children:O},enabled:P.isVisible,defaultTagName:"div"})});var pu={subpageTrigger:e=>e?{"data-subpage-trigger":""}:null,popupOpen:e=>e?{"data-popup-open":""}:null,popupFocused:e=>e?{"data-popup-focused":""}:null,highlighted:e=>e?{"data-highlighted":""}:null,disabled:e=>e?{"data-disabled":""}:null,first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null,firstInGroup:e=>e?{"data-first-in-group":""}:null,lastInGroup:e=>e?{"data-last-in-group":""}:null},lu= exports.Fa =gt.forwardRef(function(o,r){let{id:t,value:a,keywords:n,disabled:c=!1,forceMount:p=!1,forceOrder:g,forceScore:l,targetPageId:i,render:d,className:m,style:S,onClick:b,onPointerDown:R,onPointerMove:y,children:L,...I}=o,N=ye(),M=Dt(),v=M.activePageId,s=M.openPage,u=M.getSurfaceId,h=gt.useCallback(()=>{if(!s(i))return;let U=u(i);U&&N.setOwnerId(U)},[s,u,i,N]),P=Fe({id:t,value:a,keywords:n,disabled:c,forceMount:p,forceOrder:g,forceScore:l,isSubmenuTrigger:!1,closeOnClick:!1,onSelect:h,children:L}),D=P.disabled,F=v===i,T=u(i),f=N.useState("isOwner",_nullishCoalesce(T, () => (""))),G=gt.useCallback(A=>{P.handlers.onPointerDown(A),_optionalChain([R, 'optionalCall', _290 => _290(A)])},[P.handlers,R]),O=gt.useCallback(A=>{_optionalChain([b, 'optionalCall', _291 => _291(A)]),A.defaultPrevented||P.handlers.onClick(A)},[P.handlers,b]),k=gt.useCallback(A=>{_optionalChain([y, 'optionalCall', _292 => _292(A)]),A.defaultPrevented||P.handlers.onPointerMove(A)},[y,P.handlers]),E=gt.useMemo(()=>({subpageTrigger:!0,popupOpen:F,popupFocused:f,highlighted:P.isHighlighted,disabled:D,first:P.positional.first,last:P.positional.last,firstInGroup:P.positional.firstInGroup,lastInGroup:P.positional.lastInGroup}),[F,f,P.isHighlighted,D,P.positional]),x=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:P.contextValue,children:L}),w=q(),z=W(w,"subpage-trigger");return _userender.useRender.call(void 0, {render:d,ref:[P.ref,P.rowRef,r],state:E,stateAttributesMapping:pu,props:{...I,...z?{[z]:""}:{},id:P.id,role:"menuitem","aria-haspopup":"menu","aria-expanded":F,tabIndex:-1,"aria-disabled":D||void 0,className:_chunkPCNHYMD6cjs.a.call(void 0, m,E),style:_chunkPCNHYMD6cjs.b.call(void 0, S,E),onPointerDown:G,onClick:O,onPointerMove:k,children:x},enabled:P.isVisible,defaultTagName:"div"})});exports.a = ye; exports.b = It; exports.c = pt; exports.d = Ee; exports.e = lt; exports.f = jt; exports.g = oo; exports.h = Ue; exports.i = ro; exports.j = dt; exports.k = ao; exports.l = Dt; exports.m = io; exports.n = uo; exports.o = Dn; exports.p = Nn; exports.q = Gs; exports.r = En; exports.s = Fs; exports.t = Hs; exports.u = Fn; exports.v = Fr; exports.w = Zu; exports.x = Qt; exports.y = po; exports.z = lo; exports.A = Bn; exports.B = Vn; exports.C = fo; exports.D = zs; exports.E = Qs; exports.F = Nt; exports.G = go; exports.H = jr; exports.I = zr; exports.J = Qr; exports.K = Ys; exports.L = Js; exports.M = $r; exports.N = na; exports.O = sa; exports.P = Fe; exports.Q = Po; exports.R = ip; exports.S = _r; exports.T = Jr; exports.U = ua; exports.V = la; exports.W = fa; exports.X = Wn; exports.Y = ba; exports.Z = xo; exports._ = yo; exports.$ = Mo; exports.aa = ha; exports.ba = ur; exports.ca = Da; exports.da = La; exports.ea = Ga; exports.fa = Ea; exports.ga = Va; exports.ha = Qa; exports.ia = Wa; exports.ja = lr; exports.ka = _a; exports.la = oi; exports.ma = ni; exports.na = ui; exports.oa = li; exports.pa = fi; exports.qa = gi; exports.ra = Ri; exports.sa = Pi; exports.ta = Mi; exports.ua = ki; exports.va = Ni; exports.wa = Oi; exports.xa = Ai; exports.ya = Fi; exports.za = Hi; exports.Aa = Zi; exports.Ba = _i; exports.Ca = tu; exports.Da = ru; exports.Ea = iu; exports.Fa = lu;
|
|
2
|
-
//# sourceMappingURL=chunk-RTG6U56O.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/ui/ui/packages/react/dist/chunk-RTG6U56O.cjs","../src/internal/popup-menu/contexts/focus-owner-context.ts","../src/internal/popup-menu/contexts/open-chain-context.ts","../src/internal/popup-menu/contexts/popup-menu-context.ts","../src/internal/popup-menu/contexts/popup-surface-id-context.ts","../src/internal/popup-menu/contexts/submenu-context.ts","../src/internal/popup-menu/contexts/subpage-context.ts","../src/internal/popup-menu/contexts/subpage-stack-context.ts","../src/internal/popup-menu/store/FocusOwnerStore.ts","../src/internal/popup-menu/hooks/use-popup-menu-root.ts","../src/internal/popup-menu/menu-tree/resolve.ts"],"names":["FocusOwnerContext","useFocusOwner","context","OpenChainContext","useOpenChain","PopupMenuContext","usePopupMenuContext","useMaybePopupMenuContext","PopupSurfaceIdContext","usePopupSurfaceId","SubmenuContext","useSubmenuContext","useMaybeSubmenuContext","SubpageContext","useSubpageContext","useMaybeSubpageContext","SubpageStackContext","useSubpageStack","useMaybeSubpageStack","selectors","createSelector","state","surfaceId","FocusOwnerStore","ReactStore","id","isPopupMenuNode","value","encodeDefinitionPathEntry","entry","encoded","index","codeUnit","isSafe"],"mappings":"AAAA,ugCAAyM,wDAAwD,+2FCE1O,IAOjBA,EAAAA,CAA0B,EAAA,CAAA,aAAA,CAAsC,IAAI,CAAA,CAEnE,SAASC,EAAAA,CAAAA,CAAiC,CAC/C,IAAMC,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWF,EAAiB,CAAA,CAClD,EAAA,CAAI,CAACE,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,gEACF,CAAA,CAEF,OAAOA,CACT,CCjBA,IAOMC,EAAAA,CAAyB,EAAA,CAAA,aAAA,CAAqC,IAAI,CAAA,CAEjE,SAASC,EAAAA,CAAAA,CAA+B,CAC7C,IAAMF,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWC,EAAgB,CAAA,CACjD,EAAA,CAAI,CAACD,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,+DACF,CAAA,CAEF,OAAOA,CACT,CCjBA,IAiGMG,EAAAA,CAAyB,EAAA,CAAA,aAAA,CAA4C,IAAI,CAAA,CAMxE,SAASC,EAAAA,CAAAA,CAA6C,CAC3D,IAAMJ,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWG,EAAgB,CAAA,CACjD,EAAA,CAAI,CAACH,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,+EACF,CAAA,CAEF,OAAOA,CACT,CAMO,SAASK,EAAAA,CAAAA,CAAyD,CACvE,OAAa,EAAA,CAAA,UAAA,CAAWF,EAAgB,CAC1C,CCvHA,IAaMG,EAAAA,CAA8B,EAAA,CAAA,aAAA,CAA6B,IAAI,CAAA,CAE9D,SAASC,EAAAA,CAAAA,CAAmC,CACjD,OAAa,EAAA,CAAA,UAAA,CAAWD,EAAqB,CAC/C,CCjBA,IA8BME,EAAAA,CAAuB,EAAA,CAAA,aAAA,CAA0C,IAAI,CAAA,CAEpE,SAASC,EAAAA,CAAAA,CAAyC,CACvD,IAAMT,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWQ,EAAc,CAAA,CAC/C,EAAA,CAAI,CAACR,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,8CAA8C,CAAA,CAEhE,OAAOA,CACT,CAEO,SAASU,EAAAA,CAAAA,CAAqD,CACnE,OAAa,EAAA,CAAA,UAAA,CAAWF,EAAc,CACxC,CC1CA,IAiBMG,EAAAA,CAAuB,EAAA,CAAA,aAAA,CAA0C,IAAI,CAAA,CAEpE,SAASC,EAAAA,CAAAA,CAAyC,CACvD,IAAMZ,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWW,EAAc,CAAA,CAC/C,EAAA,CAAI,CAACX,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,4DACF,CAAA,CAEF,OAAOA,CACT,CAEO,SAASa,EAAAA,CAAAA,CAAqD,CACnE,OAAa,EAAA,CAAA,UAAA,CAAWF,EAAc,CACxC,CC/BA,IA+BMG,EAAAA,CACE,EAAA,CAAA,aAAA,CAA+C,IAAI,CAAA,CAEpD,SAASC,EAAAA,CAAAA,CAA4C,CAC1D,IAAMf,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWc,EAAmB,CAAA,CACpD,EAAA,CAAI,CAACd,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,0DAA0D,CAAA,CAE5E,OAAOA,CACT,CAEO,SAASgB,EAAAA,CAAAA,CAAwD,CACtE,OAAa,EAAA,CAAA,UAAA,CAAWF,EAAmB,CAC7C,CC9CA,6CAA2C,IAerCG,EAAAA,CAAY,CAChB,OAAA,CAASC,mCAAAA,CAAgBC,EAA2BA,CAAAA,CAAM,OAAO,CAAA,CACjE,OAAA,CAASD,mCAAAA,CACNC,CAAAA,CAAwBC,CAAAA,CAAAA,EAAsBD,CAAAA,CAAM,OAAA,GAAYC,CACnE,CACF,CAAA,CAaaC,EAAAA,aAAN,MAAA,QAA8BC,iBAInC,CACA,WAAA,CAAA,CAAc,CACZ,KAAA,CAAM,CAAE,OAAA,CAAS,IAAK,CAAA,CAAG,CAAC,CAAA,CAAGL,EAAS,CACxC,CAMA,UAAA,CAAWM,CAAAA,CAAmB,CAC5B,IAAA,CAAK,GAAA,CAAI,SAAA,CAAWA,CAAE,CACxB,CAMA,UAAA,CAAA,CAAa,CACX,IAAA,CAAK,GAAA,CAAI,SAAA,CAAW,IAAI,CAC1B,CACF,CAAA,CCvDA,SCOgBC,EAAAA,CAAgBC,CAAAA,CAAwC,CACtE,OACE,OAAOA,CAAAA,EAAU,QAAA,EACjBA,CAAAA,GAAU,IAAA,EACV,KAAA,GAASA,CAAAA,EACT,OAAQA,CAAAA,CAAwB,EAAA,EAAO,QAAA,EACvC,OAAQA,CAAAA,CAAwB,aAAA,EAAkB,QAAA,EAClD,KAAA,CAAM,OAAA,CAASA,CAAAA,CAAwB,cAAc,CAAA,EACrD,KAAA,CAAM,OAAA,CAASA,CAAAA,CAAwB,QAAQ,CAAA,EAC/C,OAAQA,CAAAA,CAAwB,KAAA,EAAU,QAAA,EAC1C,QAAA,GAAYA,CAEhB,CAEA,SAASC,EAAAA,CAA0BC,CAAAA,CAAuB,CACxD,IAAIC,CAAAA,CAAU,EAAA,CACd,GAAA,CAAA,IAASC,CAAAA,CAAQ,CAAA,CAAGA,CAAAA,CAAQF,CAAAA,CAAM,MAAA,CAAQE,CAAAA,EAAS,CAAA,CAAG,CACpD,IAAMC,CAAAA,CAAWH,CAAAA,CAAM,UAAA,CAAWE,CAAK,CAAA,CACjCE,CAAAA,CACHD,CAAAA,EAAY,EAAA,EAAQA,CAAAA,EAAY,EAAA,EAChCA,CAAAA,EAAY,EAAA,EAAQA,CAAAA,EAAY,GAAA,EAChCA,CAAAA,EAAY,EAAA,EAAQA,CAAAA,EAAY,EAAA,EACjCA,CAAAA,GAAa,EAAA,EACbA,CAAAA,GAAa,EAAA,EACbA,CAAAA,GAAa,GAAA,EACbA,CAAAA,GAAa,EAAA,CACfF,CAAAA,EAAWG,CAAAA,CACP,MAAA,CAAO,YAAA,CAAaD,CAAQ,CAAA,CAC5B,CAAA,CAAA,EAAIA,CAAAA,CAAS,QAAA,CAAS,EAAE,CAAA,CAAE,QAAA,CAAS,CAAA,CAAG,GAAG,CAAC,CAAA,CAAA","file":"/home/runner/work/ui/ui/packages/react/dist/chunk-RTG6U56O.cjs","sourcesContent":[null,"'use client'\n\nimport * as React from 'react'\nimport type { FocusOwnerStore } from '../store/FocusOwnerStore.js'\n\n// ============================================================================\n// Focus Owner Context\n// ============================================================================\n\nconst FocusOwnerContext = React.createContext<FocusOwnerStore | null>(null)\n\nexport function useFocusOwner(): FocusOwnerStore {\n const context = React.useContext(FocusOwnerContext)\n if (!context) {\n throw new Error(\n 'FocusOwner components must be used within a FocusOwnerProvider',\n )\n }\n return context\n}\n\nexport function useMaybeFocusOwner(): FocusOwnerStore | null {\n return React.useContext(FocusOwnerContext)\n}\n\nexport { FocusOwnerContext }\n","'use client'\n\nimport * as React from 'react'\nimport type { OpenChainStore } from '../store/OpenChainStore.js'\n\n// ============================================================================\n// Open Chain Context\n// ============================================================================\n\nconst OpenChainContext = React.createContext<OpenChainStore | null>(null)\n\nexport function useOpenChain(): OpenChainStore {\n const context = React.useContext(OpenChainContext)\n if (!context) {\n throw new Error(\n 'OpenChain components must be used within an OpenChainProvider',\n )\n }\n return context\n}\n\nexport function useMaybeOpenChain(): OpenChainStore | null {\n return React.useContext(OpenChainContext)\n}\n\nexport { OpenChainContext }\n","'use client'\n\nimport * as React from 'react'\nimport type {\n ListboxStore,\n VirtualItem,\n} from '../../listbox/store/ListboxStore.js'\nimport type {\n HighlightChangeEventDetails,\n PopupMenuOpenChangeReason,\n} from '../events.js'\n\n// ============================================================================\n// Popup Menu Context\n// ============================================================================\n// Shared root-level context for popup menus (DropdownMenu, ContextMenu).\n// Provides core menu functionality to all child components.\n\n/**\n * Virtual anchor for positioning the menu at a specific point.\n * Used by ContextMenu to position at cursor location.\n */\nexport interface VirtualAnchor {\n getBoundingClientRect(): DOMRect\n}\n\n/**\n * Virtualization configuration passed from Root/Submenu to Surface.\n */\nexport interface VirtualizationConfig {\n /** Whether virtualization mode is enabled */\n virtualized: boolean\n /** Pre-registered items for virtualization */\n items: VirtualItem[]\n /**\n * Callback when highlighted item changes (for scroll sync).\n * The third parameter contains event details including the reason for the change.\n */\n onHighlightChange?: (\n id: string | null,\n index: number,\n eventDetails: HighlightChangeEventDetails,\n ) => void\n}\n\n/**\n * Shared context value for popup menus.\n * Both DropdownMenu.Root and ContextMenu.Root provide this context.\n */\nexport interface PopupMenuContextValue {\n /** The Listbox store instance */\n store: ListboxStore\n /** Whether this menu tree currently ignores user interaction. */\n disabled: boolean\n /** Nesting depth: 0 = root menu, 1+ = submenu */\n depth: number\n /** Close the entire menu tree (deepest submenu to root, sequentially) */\n closeAll: (reason?: PopupMenuOpenChangeReason, event?: Event) => void\n /**\n * Internal: when true, Surface handles Tab explicitly (close the tree, or\n * cycle through focus zones). Enabled only by DropdownMenu.Root and\n * ContextMenu.Root — never Select or Combobox.\n */\n explicitTabBehavior: boolean\n /**\n * Internal: what Tab does under `explicitTabBehavior` when the surface (and\n * its ancestors) have no focus-zone tabbables. `'close'` closes the whole\n * tree (dropdown/context-menu). `'inert'` swallows the event, keeping focus\n * where it is (command palette).\n */\n tabWithoutZones: 'close' | 'inert'\n /** Register a surface (submenu) for closeAll tracking. Returns unregister function. */\n registerSurface: (\n depth: number,\n setOpen: (open: boolean) => void,\n ) => () => void\n /** Virtualization configuration (if enabled) */\n virtualization?: VirtualizationConfig\n /**\n * Virtual anchor for positioning.\n * Used by ContextMenu to position at cursor location.\n * DropdownMenu uses the Popover's anchor (trigger button) instead.\n */\n virtualAnchor?: VirtualAnchor\n /**\n * Type of menu for positioning logic.\n * - 'dropdown': positions relative to trigger button\n * - 'context': positions at cursor with fixed positioning\n */\n menuType: 'dropdown' | 'context'\n /**\n * When to close the menu on outside interactions.\n * - 'pointerdown': Close immediately when pointer is pressed outside (default)\n * - 'click': Close when a full click (pointerdown + pointerup) occurs outside\n * @default 'pointerdown'\n */\n closeOnOutsidePress: 'click' | 'pointerdown'\n}\n\nconst PopupMenuContext = React.createContext<PopupMenuContextValue | null>(null)\n\n/**\n * Hook to access the popup menu context.\n * Throws if used outside a popup menu.\n */\nexport function usePopupMenuContext(): PopupMenuContextValue {\n const context = React.useContext(PopupMenuContext)\n if (!context) {\n throw new Error(\n 'PopupMenu components must be used within a PopupMenu.Root or ContextMenu.Root',\n )\n }\n return context\n}\n\n/**\n * Hook to optionally access the popup menu context.\n * Returns null if used outside a popup menu.\n */\nexport function useMaybePopupMenuContext(): PopupMenuContextValue | null {\n return React.useContext(PopupMenuContext)\n}\n\n// Re-export for convenience\nexport type { VirtualItem }\nexport { PopupMenuContext }\n","'use client'\n\nimport * as React from 'react'\n\n// ============================================================================\n// Popup Surface ID Context\n// ============================================================================\n\n/**\n * Context for passing surfaceId from Popup to Surface.\n * This ensures Popup and Surface share the same ID for data attribute tracking.\n *\n * For root menus, Popup generates the ID and provides it via this context.\n * For submenus, the ID comes from SubmenuContext.childSurfaceId instead.\n */\nconst PopupSurfaceIdContext = React.createContext<string | null>(null)\n\nexport function usePopupSurfaceId(): string | null {\n return React.useContext(PopupSurfaceIdContext)\n}\n\nexport { PopupSurfaceIdContext }\n","'use client'\n\nimport * as React from 'react'\n\nexport interface SubmenuContextValue {\n /** Whether the submenu is open */\n open: boolean\n /** Set the submenu open state */\n setOpen: (open: boolean) => void\n /**\n * Latch set by explicit close actions (keyboard ArrowLeft/Ctrl+H/Escape-in-submenu,\n * or clicking the open trigger). While set and the trigger remains highlighted,\n * pointer/keyboard auto-open is suppressed. Reset when highlight leaves the trigger.\n */\n suppressAutoOpenRef: React.MutableRefObject<boolean>\n /** Reference to the trigger element */\n triggerRef: React.RefObject<HTMLElement | null>\n /** Reference to the submenu content element (for aim guard rect calculations) */\n contentRef: React.RefObject<HTMLElement | null>\n /** Surface ID of the parent menu (for keyboard navigation back) */\n parentSurfaceId: string\n /** Surface ID of this submenu (for keyboard navigation into) */\n childSurfaceId: string\n /**\n * Whether pressing Escape in this submenu closes the entire menu from the root.\n * When true, Escape closes the entire menu tree.\n * When false, Escape only closes this submenu and moves focus to the parent.\n * @default true\n */\n closeRootOnEsc: boolean\n}\n\nconst SubmenuContext = React.createContext<SubmenuContextValue | null>(null)\n\nexport function useSubmenuContext(): SubmenuContextValue {\n const context = React.useContext(SubmenuContext)\n if (!context) {\n throw new Error('SubmenuTrigger must be used within a Submenu')\n }\n return context\n}\n\nexport function useMaybeSubmenuContext(): SubmenuContextValue | null {\n return React.useContext(SubmenuContext)\n}\n\nexport { SubmenuContext }\n","'use client'\n\nimport * as React from 'react'\n\nexport interface SubpageContextValue {\n /** Current page ID. */\n pageId: string\n /** Surface ID for this page. */\n surfaceId: string\n /** Surface ID for the previous page, if available. */\n parentSurfaceId: string | null\n /** Whether this page is currently active. */\n isActive: boolean\n /** Whether Escape should close the entire menu tree from this page. */\n closeRootOnEsc: boolean\n /** Navigate back one page. Returns true when navigation happened. */\n goBack: () => boolean\n}\n\nconst SubpageContext = React.createContext<SubpageContextValue | null>(null)\n\nexport function useSubpageContext(): SubpageContextValue {\n const context = React.useContext(SubpageContext)\n if (!context) {\n throw new Error(\n 'Subpage components must be used within a PopupMenu.Subpage',\n )\n }\n return context\n}\n\nexport function useMaybeSubpageContext(): SubpageContextValue | null {\n return React.useContext(SubpageContext)\n}\n\nexport { SubpageContext }\n","'use client'\n\nimport * as React from 'react'\n\nexport interface SubpageRegistration {\n pageId: string\n surfaceId: string\n closeRootOnEsc: boolean\n}\n\nexport interface SubpageStackContextValue {\n /** Active page ID; `null` when the root surface is active. */\n activePageId: string | null\n /** Surface ID of the root surface. */\n rootSurfaceId: string\n /** Surface ID for the currently active page. */\n activeSurfaceId: string\n /** Whether there is a previous page to navigate back to. */\n canGoBack: boolean\n /** Whether Escape in the active page should close the entire menu tree. */\n shouldCloseRootOnEsc: boolean\n /** Open page IDs, bottom to top; empty at root. */\n stack: readonly string[]\n /** Register a page and return an unregister cleanup. */\n registerPage: (registration: SubpageRegistration) => () => void\n /** Push a page onto the stack. Returns true when navigation happened. */\n openPage: (pageId: string) => boolean\n /** Pop one page from the stack. Returns true when navigation happened. */\n goBack: () => boolean\n /** Resolve a surface ID for a page ID. */\n getSurfaceId: (pageId: string) => string | null\n}\n\nconst SubpageStackContext =\n React.createContext<SubpageStackContextValue | null>(null)\n\nexport function useSubpageStack(): SubpageStackContextValue {\n const context = React.useContext(SubpageStackContext)\n if (!context) {\n throw new Error('Subpage components must be used within a PopupMenu.Popup')\n }\n return context\n}\n\nexport function useMaybeSubpageStack(): SubpageStackContextValue | null {\n return React.useContext(SubpageStackContext)\n}\n\nexport { SubpageStackContext }\n","import { createSelector, ReactStore } from '@base-ui/utils/store'\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface FocusOwnerState {\n /** Which surface currently owns focus (surfaceId or null) */\n ownerId: string | null\n}\n\n// ============================================================================\n// Selectors\n// ============================================================================\n\nconst selectors = {\n ownerId: createSelector((state: FocusOwnerState) => state.ownerId),\n isOwner: createSelector(\n (state: FocusOwnerState, surfaceId: string) => state.ownerId === surfaceId,\n ),\n}\n\n// ============================================================================\n// Store\n// ============================================================================\n\n/**\n * Tracks which menu surface owns DOM focus.\n * Single instance per menu tree (created at root, shared via context).\n *\n * Used by: DropdownMenu, ContextMenu\n * Not used by: Select, CommandMenu (single surface)\n */\nexport class FocusOwnerStore extends ReactStore<\n FocusOwnerState,\n Record<string, never>,\n typeof selectors\n> {\n constructor() {\n super({ ownerId: null }, {}, selectors)\n }\n\n /**\n * Set the owner surface ID.\n * Call this when focus should transfer to a new surface.\n */\n setOwnerId(id: string | null) {\n this.set('ownerId', id)\n }\n\n /**\n * Clear the owner (set to null).\n * Call this when the menu tree closes.\n */\n clearOwner() {\n this.set('ownerId', null)\n }\n}\n\nexport type { FocusOwnerState as State }\n","'use client'\n\nimport * as React from 'react'\nimport type { ChangeEventDetails } from '../../../utils/events/index.js'\nimport {\n createChangeEventDetails,\n REASONS,\n} from '../../../utils/events/index.js'\nimport { ensureInputModalityTracking } from '../../../utils/input-modality.js'\nimport { ListboxStore, type VirtualItem } from '../../listbox/index.js'\nimport type { VirtualizationConfig } from '../contexts/popup-menu-context.js'\nimport type {\n HighlightChangeEventDetails,\n PopupMenuHighlightChangeHandler,\n PopupMenuOpenChangeReason,\n} from '../events.js'\nimport type { MenuTreeResolver } from '../menu-tree/resolver.js'\nimport { createMenuTreeResolver } from '../menu-tree/resolver.js'\nimport type { GetResolvedIdFn, PopupMenuIdScope } from '../menu-tree/types.js'\nimport { FocusOwnerStore } from '../store/FocusOwnerStore.js'\nimport { OpenChainStore } from '../store/OpenChainStore.js'\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface UsePopupMenuRootParams {\n /**\n * Computes canonical Resolved IDs for data-first content from the Unresolved Menu Node (definitional facts only).\n * @default explicit `def.id` verbatim, else the joined definition path\n * Read once when the menu root mounts — later changes have no effect.\n */\n getResolvedId?: GetResolvedIdFn\n /** Definition Key uniqueness scope. Read once when the menu root mounts. */\n idScope?: PopupMenuIdScope\n /**\n * Callback when the open state changes.\n * The second parameter contains event details including the reason for the change.\n */\n onOpenChange?: (\n open: boolean,\n eventDetails: ChangeEventDetails<string>,\n ) => void\n\n /**\n * Whether the menu is initially open.\n * @default false\n */\n defaultOpen?: boolean\n\n /**\n * Whether virtualization mode is enabled.\n * @default false\n */\n virtualized?: boolean\n\n /**\n * Pre-registered items for virtualization.\n */\n items?: VirtualItem[]\n\n /**\n * Callback when the highlighted item changes. `id` is first; `node` is the\n * resolved menu node enrichment and may be null.\n * The fourth parameter contains event details including the reason for the change.\n */\n onHighlightChange?: PopupMenuHighlightChangeHandler<HighlightChangeEventDetails>\n\n /**\n * When to close the menu on outside interactions.\n * - 'pointerdown': Close immediately when pointer is pressed outside (default)\n * - 'click': Close when a full click (pointerdown + pointerup) occurs outside\n * @default 'pointerdown'\n */\n closeOnOutsidePress?: 'click' | 'pointerdown'\n\n /**\n * Whether the menu should ignore user interaction.\n * Can be controlled declaratively via this prop, or imperatively via actionsRef.setDisabled().\n * @default false\n */\n disabled?: boolean\n\n /**\n * Initial disabled state for imperative usage.\n * Ignored when `disabled` prop is true.\n * @default false\n */\n defaultDisabled?: boolean\n}\n\nexport interface PopupMenuRootActions {\n /** Close the menu tree imperatively. */\n close: () => void\n /** Unmount the popup imperatively (when keep-mounted mode is enabled). */\n unmount: () => void\n /** Enable/disable the menu tree imperatively. */\n setDisabled: (disabled: boolean) => void\n}\n\nexport interface UsePopupMenuRootReturn {\n /** The menu-tree resolver for this menu root. */\n menuTreeResolver: MenuTreeResolver\n /** The Listbox store instance */\n store: ListboxStore\n /** The FocusOwner store instance */\n focusOwnerStore: FocusOwnerStore\n /** The OpenChain store instance */\n openChainStore: OpenChainStore\n /** Register a surface (submenu) for closeAll tracking */\n registerSurface: (\n depth: number,\n setOpen: (open: boolean) => void,\n ) => () => void\n /** Close the entire menu tree */\n closeAll: (reason?: PopupMenuOpenChangeReason, event?: Event) => void\n /** Virtualization configuration (if enabled) */\n virtualization: VirtualizationConfig | undefined\n /** Handle open state change (updates store and clears stores on close) */\n handleOpenChange: (\n open: boolean,\n reason?: PopupMenuOpenChangeReason,\n event?: Event,\n ) => void\n /** Whether the menu currently ignores user interaction. */\n disabled: boolean\n /** Update imperative disabled state. */\n setDisabled: (disabled: boolean) => void\n}\n\n// ============================================================================\n// Hook\n// ============================================================================\n\n/**\n * Hook that creates and manages the core stores and utilities for popup menus.\n * Used by both DropdownMenu.Root and ContextMenu.Root.\n *\n * Provides:\n * - ListboxStore for item management\n * - FocusOwnerStore for focus tracking across submenus\n * - OpenChainStore for tracking open submenu chain\n * - Surface registry for closeAll functionality\n */\nexport function usePopupMenuRoot(\n params: UsePopupMenuRootParams = {},\n): UsePopupMenuRootReturn {\n const {\n onOpenChange,\n defaultOpen = false,\n virtualized = false,\n items: itemsProp,\n onHighlightChange,\n closeOnOutsidePress = 'pointerdown',\n disabled: disabledProp = false,\n defaultDisabled = false,\n getResolvedId,\n idScope = 'surface',\n } = params\n\n const menuTreeResolverRef = React.useRef<MenuTreeResolver | null>(null)\n if (menuTreeResolverRef.current === null) {\n menuTreeResolverRef.current = createMenuTreeResolver({\n getResolvedId,\n idScope,\n })\n }\n const menuTreeResolver = menuTreeResolverRef.current\n\n const handleHighlightChange = React.useCallback(\n (\n id: string | null,\n index: number,\n eventDetails: HighlightChangeEventDetails,\n ) => {\n onHighlightChange?.(\n id,\n id === null ? null : (menuTreeResolver.getNodeById(id) ?? null),\n index,\n eventDetails,\n )\n },\n [menuTreeResolver, onHighlightChange],\n )\n\n const [imperativeDisabled, setImperativeDisabled] =\n React.useState(defaultDisabled)\n const disabled = disabledProp || imperativeDisabled\n\n const setDisabled = React.useCallback((nextDisabled: boolean) => {\n setImperativeDisabled(nextDisabled)\n }, [])\n\n // Begin tracking global input modality so the store can attribute opens to\n // mouse/touch/pen/keyboard. Idempotent; installed once for the whole app.\n React.useEffect(() => {\n ensureInputModalityTracking()\n }, [])\n\n // Track outside pointer events to distinguish outside-press from focus-out\n // When a pointerdown happens outside the menu, we store it so that if a\n // focus-out close happens immediately after, we can treat it as outside-press\n const outsidePointerEventRef = React.useRef<PointerEvent | null>(null)\n\n // Create stable callback wrapper for onOpenChange that converts focus-out to outside-press\n // when the close was triggered by a pointer event outside the menu\n const stableOnOpenChange = React.useCallback(\n (open: boolean, eventDetails: ChangeEventDetails<string>) => {\n // If closing due to focus-out but we have a stored outside pointer event,\n // convert the reason to outside-press for better cancel() support\n if (\n !open &&\n eventDetails.reason === REASONS.focusOut &&\n outsidePointerEventRef.current\n ) {\n const pointerEvent = outsidePointerEventRef.current\n outsidePointerEventRef.current = null\n\n // Create new event details with outside-press reason and the pointer event\n const convertedDetails = createChangeEventDetails(\n REASONS.outsidePress,\n pointerEvent,\n )\n\n onOpenChange?.(open, convertedDetails)\n\n // If the converted callback canceled, also cancel the original\n if (convertedDetails.isCanceled) {\n eventDetails.cancel()\n }\n return\n }\n\n // Clear the pointer event ref if we're not using it\n outsidePointerEventRef.current = null\n\n onOpenChange?.(open, eventDetails)\n },\n [onOpenChange],\n )\n\n // Create the store instance\n const store = ListboxStore.useStore(\n undefined,\n { open: defaultOpen },\n {\n onOpenChange: stableOnOpenChange,\n },\n )\n\n // Get current open state for the pointer event listener\n const isOpen = store.useState('open')\n\n // Create focus owner store (single instance for entire menu tree)\n const focusOwnerStoreRef = React.useRef<FocusOwnerStore | null>(null)\n if (!focusOwnerStoreRef.current) {\n focusOwnerStoreRef.current = new FocusOwnerStore()\n }\n const focusOwnerStore = focusOwnerStoreRef.current\n\n // Create open chain store (single instance for entire menu tree)\n const openChainStoreRef = React.useRef<OpenChainStore | null>(null)\n if (!openChainStoreRef.current) {\n openChainStoreRef.current = new OpenChainStore()\n }\n const openChainStore = openChainStoreRef.current\n\n // Registry for tracking open submenus (for closeAll)\n type SurfaceEntry = { depth: number; setOpen: (open: boolean) => void }\n const surfaceRegistryRef = React.useRef<Map<string, SurfaceEntry>>(new Map())\n\n // Register a surface (submenu) for closeAll tracking\n const registerSurface = React.useCallback(\n (depth: number, setOpen: (open: boolean) => void) => {\n const id = Math.random().toString(36).slice(2)\n surfaceRegistryRef.current.set(id, { depth, setOpen })\n return () => {\n surfaceRegistryRef.current.delete(id)\n }\n },\n [],\n )\n\n // Close the entire menu tree from deepest submenu to root\n const closeAll = React.useCallback(\n (reason: PopupMenuOpenChangeReason = REASONS.itemPress, event?: Event) => {\n // Sort surfaces by depth (deepest first)\n const surfaces = [...surfaceRegistryRef.current.values()].sort(\n (a, b) => b.depth - a.depth,\n )\n\n // Close each submenu from deepest to shallowest\n for (const surface of surfaces) {\n surface.setOpen(false)\n }\n\n // Finally close the root\n store.setOpen(false, reason, event)\n\n // Clear focus ownership and open chain\n focusOwnerStore.clearOwner()\n openChainStore.clear()\n },\n [store, focusOwnerStore, openChainStore],\n )\n\n // Ref to hold closeAll for use in the pointerdown effect\n const closeAllRef = React.useRef(closeAll)\n closeAllRef.current = closeAll\n\n // Listen for pointerdown events on document to detect outside clicks\n // This is a single listener at the root level that handles the entire menu tree.\n // Behavior depends on closeOnOutsidePress:\n // - 'pointerdown': Close immediately when pointer is pressed outside\n // - 'click': Store event and convert focus-out to outside-press reason\n React.useEffect(() => {\n if (!isOpen || disabled) {\n outsidePointerEventRef.current = null\n return\n }\n\n const handlePointerDown = (event: PointerEvent) => {\n const target = event.target as Element | null\n if (!target) return\n\n // Check if the pointerdown is inside any part of the menu tree or its triggers\n // base-ui sets data-open on popups and data-popup-open on triggers\n const isInsidePopup = target.closest('[data-open]') !== null\n const isInsideTrigger = target.closest('[data-popup-open]') !== null\n const isInside = isInsidePopup || isInsideTrigger\n\n if (closeOnOutsidePress === 'pointerdown' && !isInside) {\n // Close entire menu tree immediately on pointerdown outside\n closeAllRef.current(REASONS.outsidePress, event)\n } else {\n // Store the event for focus-out-to-outside-press conversion\n outsidePointerEventRef.current = event\n }\n }\n\n // Use capture phase to see the event before any stopPropagation\n document.addEventListener('pointerdown', handlePointerDown, true)\n return () => {\n document.removeEventListener('pointerdown', handlePointerDown, true)\n outsidePointerEventRef.current = null\n }\n }, [isOpen, closeOnOutsidePress, disabled])\n\n // Handle open state change\n const handleOpenChange = React.useCallback(\n (\n newOpen: boolean,\n reason: PopupMenuOpenChangeReason = REASONS.none,\n event?: Event,\n ) => {\n const isImperativeAction = reason === REASONS.imperativeAction\n\n // Ignore user-driven open/close interactions while disabled.\n if (disabled && !isImperativeAction) {\n return\n }\n\n store.setOpen(newOpen, reason, event)\n // Clear focus ownership and open chain when menu closes\n if (!newOpen) {\n focusOwnerStore.clearOwner()\n openChainStore.clear()\n }\n },\n [store, focusOwnerStore, openChainStore, disabled],\n )\n\n // Memoize listbox wiring config\n const virtualization = React.useMemo(() => {\n if (!virtualized && !onHighlightChange) {\n return undefined\n }\n\n return {\n virtualized,\n items: itemsProp ?? [],\n onHighlightChange: handleHighlightChange,\n }\n }, [virtualized, itemsProp, handleHighlightChange, onHighlightChange])\n\n return {\n menuTreeResolver,\n store,\n focusOwnerStore,\n openChainStore,\n registerSurface,\n closeAll,\n virtualization,\n handleOpenChange,\n disabled,\n setDisabled,\n }\n}\n","import { slugify } from '../../listbox/utils/normalize.js'\nimport type { NodeDef } from '../data-first/types.js'\nimport type {\n GetResolvedIdFn,\n PopupMenuIdScope,\n PopupMenuNode,\n UnresolvedMenuNode,\n} from './types.js'\n\nexport function isPopupMenuNode(value: unknown): value is PopupMenuNode {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'def' in value &&\n typeof (value as PopupMenuNode).id === 'string' &&\n typeof (value as PopupMenuNode).definitionKey === 'string' &&\n Array.isArray((value as PopupMenuNode).definitionPath) &&\n Array.isArray((value as PopupMenuNode).children) &&\n typeof (value as PopupMenuNode).depth === 'number' &&\n 'parent' in value\n )\n}\n\nfunction encodeDefinitionPathEntry(entry: string): string {\n let encoded = ''\n for (let index = 0; index < entry.length; index += 1) {\n const codeUnit = entry.charCodeAt(index)\n const isSafe =\n (codeUnit >= 0x41 && codeUnit <= 0x5a) ||\n (codeUnit >= 0x61 && codeUnit <= 0x7a) ||\n (codeUnit >= 0x30 && codeUnit <= 0x39) ||\n codeUnit === 0x2e ||\n codeUnit === 0x5f ||\n codeUnit === 0x7e ||\n codeUnit === 0x2d\n encoded += isSafe\n ? String.fromCharCode(codeUnit)\n : `%${codeUnit.toString(16).padStart(4, '0')}`\n }\n return encoded\n}\n\n/** Default Resolved ID, using surface-scoped encoded paths unless menu scope is selected. */\nexport function defaultGetResolvedId(\n node: UnresolvedMenuNode,\n idScope: PopupMenuIdScope = 'surface',\n): string {\n if (idScope === 'menu') return node.definitionKey\n return node.definitionPath.map(encodeDefinitionPathEntry).join('/')\n}\n\n/** Definition Key for a def: explicit `id` verbatim, else slugified `value`. */\nexport function definitionKeyForDef(def: NodeDef): string {\n switch (def.kind) {\n case 'group':\n case 'radio-group':\n return def.id\n case 'separator':\n return def.id\n default:\n return def.id ?? slugify(def.value)\n }\n}\n\n/** Child defs of a def, in def order; empty for leaf kinds. */\nexport function childDefsOf(def: NodeDef): readonly NodeDef[] {\n switch (def.kind) {\n case 'group':\n case 'radio-group':\n return def.nodes\n case 'submenu':\n case 'subpage':\n case 'tree-item':\n return def.nodes ?? []\n default:\n return []\n }\n}\n\n/** Kinds whose Definition Key is part of their descendants' definition paths. */\nexport function contributesDefinitionPath(def: NodeDef): boolean {\n return def.kind === 'submenu' || def.kind === 'subpage'\n}\n\n/**\n * Resolve a def list into node instances under `parent`.\n * `basePath` is the path segments contributed by ancestors (the parent's\n * `definitionPath` when the parent contributes a segment, otherwise the parent's\n * own base path); pass `[]` for roots.\n */\nexport function resolveNodeDefs(\n defs: readonly NodeDef[],\n parent: PopupMenuNode | null,\n basePath: readonly string[],\n getResolvedId: GetResolvedIdFn,\n): PopupMenuNode[] {\n return defs.map((def, index) => {\n const definitionKey = definitionKeyForDef(def)\n const definitionPath = [...basePath, definitionKey]\n const unresolved: UnresolvedMenuNode = {\n def,\n kind: def.kind,\n definitionKey,\n definitionPath,\n parent,\n children: [],\n depth: parent ? parent.depth + 1 : 0,\n index,\n }\n // Call the seam before spreading so the node reflects any reads the seam\n // performs on the final definitional facts (spread-then-call would copy\n // the fields before the seam runs).\n const id = getResolvedId(unresolved)\n const node: PopupMenuNode = { ...unresolved, id }\n node.children = resolveNodeDefs(\n childDefsOf(def),\n node,\n contributesDefinitionPath(def) ? node.definitionPath : basePath,\n getResolvedId,\n )\n return node\n })\n}\n\n/**\n * The branch's resolved static children: the Menu Nodes whose def is one of\n * the branch def's authored `nodes`, in `children` order. Loader results are\n * grafted as children too but are never in `def.nodes`, so they are excluded\n * whether the graft appended to or replaced the static children.\n */\nexport function staticChildrenOf(branch: PopupMenuNode): PopupMenuNode[] {\n const authored = (branch.def as { nodes?: readonly NodeDef[] }).nodes\n if (!authored || authored.length === 0) return []\n const authoredSet = new Set<NodeDef>(authored)\n return branch.children.filter((child) => authoredSet.has(child.def))\n}\n"]}
|
package/dist/chunk-SCDHQZFI.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _mergeprops = require('@base-ui/react/merge-props');function E(e,n){return _mergeprops.mergeProps.call(void 0, e,l(n))}function l(e){let n={...e};for(let t in n){let r=n[t];m(t,r)&&(n[t]=(o,...a)=>(_mergeprops.makeEventPreventable.call(void 0, o),r(o,...a)))}return n}function m(e,n){return e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90&&typeof n=="function"}exports.a = E;
|
|
2
|
-
//# sourceMappingURL=chunk-SCDHQZFI.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/merge-element-props.ts"],"names":["mergeElementProps","internalProps","externalProps","mergeProps","wrapEventHandlers","props","wrappedProps","propName","propValue","isEventHandler","event","args","makeEventPreventable","key","value"],"mappings":"AAAA,iIAAiD,SAMjCA,CAAAA,CAIdC,CAAAA,CAA8BC,CAAAA,CAA8B,CAC5D,OAAOC,oCAAAA,CACLF,CACAG,CAAAA,CAAqBF,CAAa,CACpC,CACF,CAEA,SAASE,CAAAA,CACPC,CAAAA,CACA,CACA,IAAMC,CAAAA,CAAe,CAAE,GAAGD,CAAM,CAAA,CAEhC,GAAA,CAAA,IAAWE,EAAAA,GAAYD,CAAAA,CAAc,CACnC,IAAME,CAAAA,CAAYF,CAAAA,CAAaC,CAAQ,CAAA,CACnCE,CAAAA,CAAeF,CAAAA,CAAUC,CAAS,CAAA,EAAA,CACpCF,CAAAA,CAAaC,CAAQ,CAAA,CAAI,CACvBG,CAAAA,CAAAA,GACGC,CAAAA,CAAAA,EAAAA,CAEHC,8CAAAA,CAEA,CAAA,CACOJ,CAAAA,CAAUE,CAAAA,CAAO,GAAGC,CAAI,CAAA,CAAA,CAGrC,CAEA,OAAOL,CACT,CAEA,SAASG,CAAAA,CACPI,CAAAA,CACAC,CAAAA,CACuE,CACvE,OACED,CAAAA,CAAI,UAAA,CAAW,CAAC,CAAA,GAAM,GAAA,EACtBA,CAAAA,CAAI,UAAA,CAAW,CAAC,CAAA,GAAM,GAAA,EACtBA,CAAAA,CAAI,UAAA,CAAW,CAAC,CAAA,EAAK,EAAA,EACrBA,CAAAA,CAAI,UAAA,CAAW,CAAC,CAAA,EAAK,EAAA,EACrB,OAAOC,CAAAA,EAAU,UAErB,CAAA,cAAA","file":"/home/runner/work/ui/ui/packages/react/dist/chunk-SCDHQZFI.cjs","sourcesContent":["import { makeEventPreventable, mergeProps } from '@base-ui/react/merge-props'\nimport type * as React from 'react'\n\ntype ElementType = React.ElementType\ntype ElementProps<T extends ElementType> = React.ComponentPropsWithRef<T>\n\nexport function mergeElementProps<\n T extends ElementType,\n InternalProps extends Record<string, unknown> = ElementProps<T>,\n ExternalProps extends Partial<ElementProps<T>> = Partial<ElementProps<T>>,\n>(internalProps: InternalProps, externalProps: ExternalProps) {\n return mergeProps<T>(\n internalProps as ElementProps<T>,\n wrapEventHandlers<T>(externalProps) as ElementProps<T>,\n ) as InternalProps & ExternalProps\n}\n\nfunction wrapEventHandlers<T extends ElementType>(\n props: Partial<ElementProps<T>>,\n) {\n const wrappedProps = { ...props } as Record<string, unknown>\n\n for (const propName in wrappedProps) {\n const propValue = wrappedProps[propName]\n if (isEventHandler(propName, propValue)) {\n wrappedProps[propName] = (\n event: React.SyntheticEvent,\n ...args: unknown[]\n ) => {\n makeEventPreventable(\n event as Parameters<typeof makeEventPreventable>[0],\n )\n return propValue(event, ...args)\n }\n }\n }\n\n return wrappedProps as Partial<ElementProps<T>>\n}\n\nfunction isEventHandler(\n key: string,\n value: unknown,\n): value is (event: React.SyntheticEvent, ...args: unknown[]) => unknown {\n return (\n key.charCodeAt(0) === 111 &&\n key.charCodeAt(1) === 110 &&\n key.charCodeAt(2) >= 65 &&\n key.charCodeAt(2) <= 90 &&\n typeof value === 'function'\n )\n}\n"]}
|