@bazza-ui/react 0.0.0 → 0.1.0-canary.10
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/ListboxStore-BYBpGrOz.d.ts +453 -0
- package/dist/ListboxStore-nmorsoqX.d.cts +453 -0
- package/dist/chunk-4C666HHU.js +2 -0
- package/dist/chunk-4C666HHU.js.map +1 -0
- package/dist/chunk-5T5B5SPR.cjs +2 -0
- package/dist/chunk-5T5B5SPR.cjs.map +1 -0
- package/dist/chunk-A4Z5BY7H.js +2 -0
- package/dist/chunk-A4Z5BY7H.js.map +1 -0
- package/dist/chunk-BFOY762U.js +2 -0
- package/dist/chunk-BFOY762U.js.map +1 -0
- package/dist/chunk-IT372NHF.js +2 -0
- package/dist/chunk-IT372NHF.js.map +1 -0
- package/dist/chunk-JFEVUUPC.cjs +2 -0
- package/dist/chunk-JFEVUUPC.cjs.map +1 -0
- package/dist/chunk-KO3DXT3Y.js +2 -0
- package/dist/chunk-KO3DXT3Y.js.map +1 -0
- package/dist/chunk-LXXK4S4Q.js +2 -0
- package/dist/chunk-LXXK4S4Q.js.map +1 -0
- package/dist/chunk-M4G6J7DP.cjs +2 -0
- package/dist/chunk-M4G6J7DP.cjs.map +1 -0
- package/dist/chunk-SCDHQZFI.cjs +2 -0
- package/dist/chunk-SCDHQZFI.cjs.map +1 -0
- package/dist/chunk-W4ACKMIZ.cjs +2 -0
- package/dist/chunk-W4ACKMIZ.cjs.map +1 -0
- package/dist/chunk-XMZZ62VJ.cjs +2 -0
- package/dist/chunk-XMZZ62VJ.cjs.map +1 -0
- package/dist/combobox/index.cjs +2 -0
- package/dist/combobox/index.cjs.map +1 -0
- package/dist/combobox/index.d.cts +1066 -0
- package/dist/combobox/index.d.ts +1066 -0
- package/dist/combobox/index.js +2 -0
- package/dist/combobox/index.js.map +1 -0
- package/dist/command-menu/index.cjs +2 -0
- package/dist/command-menu/index.cjs.map +1 -0
- package/dist/command-menu/index.d.cts +154 -0
- package/dist/command-menu/index.d.ts +154 -0
- package/dist/command-menu/index.js +2 -0
- package/dist/command-menu/index.js.map +1 -0
- package/dist/command-score-CTJ9NV6n.d.cts +23 -0
- package/dist/command-score-CTJ9NV6n.d.ts +23 -0
- package/dist/context-menu/index.cjs +2 -0
- package/dist/context-menu/index.cjs.map +1 -0
- package/dist/context-menu/index.d.cts +672 -0
- package/dist/context-menu/index.d.ts +672 -0
- package/dist/context-menu/index.js +2 -0
- package/dist/context-menu/index.js.map +1 -0
- package/dist/dropdown-menu/index.cjs +2 -0
- package/dist/dropdown-menu/index.cjs.map +1 -0
- package/dist/dropdown-menu/index.d.cts +699 -0
- package/dist/dropdown-menu/index.d.ts +699 -0
- package/dist/dropdown-menu/index.js +2 -0
- package/dist/dropdown-menu/index.js.map +1 -0
- package/dist/events-DOGItflK.d.ts +1776 -0
- package/dist/events-DPsuhBln.d.cts +1776 -0
- package/dist/input-C95v6jB0.d.cts +46 -0
- package/dist/input-CYweYB_i.d.ts +46 -0
- package/dist/internal/listbox/index.cjs +2 -0
- package/dist/internal/listbox/index.cjs.map +1 -0
- package/dist/internal/listbox/index.d.cts +272 -0
- package/dist/internal/listbox/index.d.ts +272 -0
- package/dist/internal/listbox/index.js +2 -0
- package/dist/internal/listbox/index.js.map +1 -0
- package/dist/internal/popup-menu/index.cjs +2 -0
- package/dist/internal/popup-menu/index.cjs.map +1 -0
- package/dist/internal/popup-menu/index.d.cts +238 -0
- package/dist/internal/popup-menu/index.d.ts +238 -0
- package/dist/internal/popup-menu/index.js +2 -0
- package/dist/internal/popup-menu/index.js.map +1 -0
- package/dist/items-B6HeFO_8.d.cts +37 -0
- package/dist/items-B6HeFO_8.d.ts +37 -0
- package/dist/kbd/index.cjs +2 -0
- package/dist/kbd/index.cjs.map +1 -0
- package/dist/kbd/index.d.cts +61 -0
- package/dist/kbd/index.d.ts +61 -0
- package/dist/kbd/index.js +2 -0
- package/dist/kbd/index.js.map +1 -0
- package/dist/loaders/index.cjs +2 -0
- package/dist/loaders/index.cjs.map +1 -0
- package/dist/loaders/index.d.cts +363 -0
- package/dist/loaders/index.d.ts +363 -0
- package/dist/loaders/index.js +2 -0
- package/dist/loaders/index.js.map +1 -0
- package/dist/loading-C6WZGUc3.d.cts +29 -0
- package/dist/loading-CC4n55sR.d.ts +29 -0
- package/dist/resolve-BYm41YfG.d.ts +406 -0
- package/dist/resolve-Dk_fAKb2.d.cts +406 -0
- package/dist/scroll-arrow-B81wZTZ2.d.cts +544 -0
- package/dist/scroll-arrow-CNd0tgME.d.ts +544 -0
- package/dist/select/index.cjs +2 -0
- package/dist/select/index.cjs.map +1 -0
- package/dist/select/index.d.cts +985 -0
- package/dist/select/index.d.ts +985 -0
- package/dist/select/index.js +2 -0
- package/dist/select/index.js.map +1 -0
- package/dist/separator-BiySI623.d.cts +275 -0
- package/dist/separator-De8l8DKO.d.ts +275 -0
- package/dist/surface-context-ClmxshBW.d.ts +14 -0
- package/dist/surface-context-DF-L-30G.d.cts +14 -0
- package/dist/type-guards-BC2B6bVi.d.cts +350 -0
- package/dist/type-guards-ybcHBB3C.d.ts +350 -0
- package/dist/types-DT4FOOa2.d.cts +51 -0
- package/dist/types-DT4FOOa2.d.ts +51 -0
- package/dist/use-listbox-item-NzZuY34-.d.cts +212 -0
- package/dist/use-listbox-item-NzZuY34-.d.ts +212 -0
- package/dist/video-player/index.cjs +3 -0
- package/dist/video-player/index.cjs.map +1 -0
- package/dist/video-player/index.d.cts +1391 -0
- package/dist/video-player/index.d.ts +1391 -0
- package/dist/video-player/index.js +3 -0
- package/dist/video-player/index.js.map +1 -0
- package/package.json +66 -12
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{makeEventPreventable as s,mergeProps as p}from"@base-ui/react/merge-props";function E(e,n){return p(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)=>(s(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"}export{E as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IT372NHF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/merge-element-props.ts"],"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"],"mappings":"AAAA,OAAS,wBAAAA,EAAsB,cAAAC,MAAkB,6BAM1C,SAASC,EAIdC,EAA8BC,EAA8B,CAC5D,OAAOH,EACLE,EACAE,EAAqBD,CAAa,CACpC,CACF,CAEA,SAASC,EACPC,EACA,CACA,IAAMC,EAAe,CAAE,GAAGD,CAAM,EAEhC,QAAWE,KAAYD,EAAc,CACnC,IAAME,EAAYF,EAAaC,CAAQ,EACnCE,EAAeF,EAAUC,CAAS,IACpCF,EAAaC,CAAQ,EAAI,CACvBG,KACGC,KAEHZ,EACEW,CACF,EACOF,EAAUE,EAAO,GAAGC,CAAI,GAGrC,CAEA,OAAOL,CACT,CAEA,SAASG,EACPG,EACAC,EACuE,CACvE,OACED,EAAI,WAAW,CAAC,IAAM,KACtBA,EAAI,WAAW,CAAC,IAAM,KACtBA,EAAI,WAAW,CAAC,GAAK,IACrBA,EAAI,WAAW,CAAC,GAAK,IACrB,OAAOC,GAAU,UAErB","names":["makeEventPreventable","mergeProps","mergeElementProps","internalProps","externalProps","wrapEventHandlers","props","wrappedProps","propName","propValue","isEventHandler","event","args","key","value"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
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 i={esc:"escape",return:"enter",del:"delete",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",space:"space",spacebar:"space",plus:"+"};function l(e){return _nullishCoalesce(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}var _react = require('react'); var o = _interopRequireWildcard(_react);function u(){if(typeof navigator>"u")return!1;let e=navigator,t=_optionalChain([e, 'access', _ => _.userAgentData, 'optionalAccess', _2 => _2.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]),_nullishCoalesce(e, () => (t))}exports.a = f; exports.b = c; exports.c = g; exports.d = u; exports.e = m;
|
|
2
|
+
//# sourceMappingURL=chunk-JFEVUUPC.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/kbd/utils/parse-keybinding.ts","../src/kbd/utils/platform.ts"],"names":["keyAliases","normalizeKey","key","createChord","parseKeybinding","keys","trimmed","chordValue","chord","tokenValue","token","getKeyLabel","platform","normalizedKey","getChordLabels","isCtrl","isMeta","labels","isApplePlatform","nav","usePlatform","override","setPlatform"],"mappings":"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","file":"/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/chunk-JFEVUUPC.cjs","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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var d=(e,n)=>Object.is(e,n);function l(e,n,t){return e==null||n==null?Object.is(e,n):t(e,n)}function o(e,n,t){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:l(r,n,t))}function f(e,n,t){return e.filter(r=>!l(r,n,t))}function a(e){return e??""}function i(e,n){if(!e)return;if(Array.isArray(e)){let r=e.find(u=>a(u.value)===n);return r?{label:r.label,keywords:r.keywords}:void 0}let t=e[n];if(t!==void 0)return{label:t}}function m(e,n){return i(e,n)?.label}function y(e,n){let t=n.filter(u=>!!u);if(t.length===0)return e;let r=e?[...e]:[];for(let u of t)r.includes(u)||r.push(u);return r}export{d as a,l as b,o as c,f as d,i as e,m as f,y as g};
|
|
2
|
+
//# sourceMappingURL=chunk-KO3DXT3Y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":"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","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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kianbazza/repos/bazzalabs/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":"/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/chunk-M4G6J7DP.cjs"}
|
|
@@ -0,0 +1,2 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":"/Users/kianbazza/repos/bazzalabs/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"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
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 _react = require('react'); var Io = _interopRequireWildcard(_react); var Do = _interopRequireWildcard(_react); var Xt = _interopRequireWildcard(_react); var wo = _interopRequireWildcard(_react); var _t = _interopRequireWildcard(_react); var eo = _interopRequireWildcard(_react); var oo = _interopRequireWildcard(_react); var xe = _interopRequireWildcard(_react); var ge = _interopRequireWildcard(_react); var Nr = _interopRequireWildcard(_react); var To = _interopRequireWildcard(_react); var Lr = _interopRequireWildcard(_react); var he = _interopRequireWildcard(_react); var ao = _interopRequireWildcard(_react); var _e = _interopRequireWildcard(_react); var Be = _interopRequireWildcard(_react); var Eo = _interopRequireWildcard(_react); var ae = _interopRequireWildcard(_react); var ce = _interopRequireWildcard(_react); var Fo = _interopRequireWildcard(_react); var Se = _interopRequireWildcard(_react); var zt = _interopRequireWildcard(_react); var Ho = _interopRequireWildcard(_react); var zo = _interopRequireWildcard(_react); var go = _interopRequireWildcard(_react); var bo = _interopRequireWildcard(_react); var It = _interopRequireWildcard(_react); var ot = _interopRequireWildcard(_react); var Ve = _interopRequireWildcard(_react); var Me = _interopRequireWildcard(_react); var _ = _interopRequireWildcard(_react); var qo = _interopRequireWildcard(_react); var Ze = _interopRequireWildcard(_react); var nt = _interopRequireWildcard(_react); var ve = _interopRequireWildcard(_react); var ue = _interopRequireWildcard(_react); var He = _interopRequireWildcard(_react); var Jo = _interopRequireWildcard(_react); var en = _interopRequireWildcard(_react); var Rt = _interopRequireWildcard(_react); var ke = _interopRequireWildcard(_react); var tn = _interopRequireWildcard(_react); var on = _interopRequireWildcard(_react); var Je = _interopRequireWildcard(_react); var nn = _interopRequireWildcard(_react); var rn = _interopRequireWildcard(_react); var an = _interopRequireWildcard(_react); var sn = _interopRequireWildcard(_react); var un = _interopRequireWildcard(_react); var Ge = _interopRequireWildcard(_react); var ps = _interopRequireWildcard(_react); var cn = _interopRequireWildcard(_react); var rt = _interopRequireWildcard(_react); var pn = _interopRequireWildcard(_react); var ls = _interopRequireWildcard(_react); var ln = _interopRequireWildcard(_react); var ds = _interopRequireWildcard(_react); var fs = _interopRequireWildcard(_react); var pe = _interopRequireWildcard(_react); var Y = _interopRequireWildcard(_react); var hn = _interopRequireWildcard(_react); var Rs = _interopRequireWildcard(_react); var Rn = _interopRequireWildcard(_react); var Sn = _interopRequireWildcard(_react); var et = _interopRequireWildcard(_react); var Ut = _interopRequireWildcard(_react); var Le = _interopRequireWildcard(_react); var dt = _interopRequireWildcard(_react);var yn=Io.createContext(null);function Pe(){let e=Io.useContext(yn);if(!e)throw new Error("FocusOwner components must be used within a FocusOwnerProvider");return e}var Mn=Do.createContext(null);function Ct(){let e=Do.useContext(Mn);if(!e)throw new Error("OpenChain components must be used within an OpenChainProvider");return e}var ut=Xt.createContext(null);function Te(){let e=Xt.useContext(ut);if(!e)throw new Error("PopupMenu components must be used within a PopupMenu.Root or ContextMenu.Root");return e}function it(){return Xt.useContext(ut)}var Bt=wo.createContext(null);function Ir(){return wo.useContext(Bt)}var No=_t.createContext(null);function Jt(){let e=_t.useContext(No);if(!e)throw new Error("SubmenuTrigger must be used within a Submenu");return e}function je(){return _t.useContext(No)}var Lo=eo.createContext(null);function to(){let e=eo.useContext(Lo);if(!e)throw new Error("Subpage components must be used within a PopupMenu.Subpage");return e}function ct(){return eo.useContext(Lo)}var no=oo.createContext(null);function vt(){let e=oo.useContext(no);if(!e)throw new Error("Subpage components must be used within a PopupMenu.Popup");return e}function ro(){return oo.useContext(no)}var _store = require('@base-ui/utils/store');var Ms={ownerId:_store.createSelector.call(void 0, e=>e.ownerId),isOwner:_store.createSelector.call(void 0, (e,o)=>e.ownerId===o)},so= exports.n =class extends _store.ReactStore{constructor(){super({ownerId:null},{},Ms)}setOwnerId(o){this.set("ownerId",o)}clearOwner(){this.set("ownerId",null)}};function Cn(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 Cs(e){let o="";for(let r=0;r<e.length;r+=1){let t=e.charCodeAt(r),s=t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===46||t===95||t===126||t===45;o+=s?String.fromCharCode(t):`%${t.toString(16).padStart(4,"0")}`}return o}function vn(e,o="surface"){return o==="menu"?e.definitionKey:e.definitionPath.map(Cs).join("/")}function kn(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 In(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 Vt(e){return e.kind==="submenu"||e.kind==="subpage"}function Dn(e,o,r,t){return e.map((s,n)=>{let i=kn(s),c=[...r,i],f={def:s,kind:s.kind,definitionKey:i,definitionPath:c,parent:o,children:[],depth:o?o.depth+1:0,index:n},p=t(f),a={...f,id:p};return a.children=Dn(In(s),a,Vt(s)?a.definitionPath:r,t),a})}function pt(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 wn(e,o,r,t,s){let n=kn(e),i=[...r,n],c={def:e,kind:e.kind,definitionKey:n,definitionPath:i,parent:o,children:[],depth:o?o.depth+1:0,index:t};return{definitionKey:n,definitionPath:i,id:s(c)}}function wr(e={}){let o=_nullishCoalesce(e.idScope, () => ("surface")),r=_nullishCoalesce(e.getResolvedId, () => ((d=>vn(d,o)))),t=[],s=null,n=new Map,i=new Map,c=new WeakMap,f=new Set,p=!1,a=new WeakMap,h=!1,b=new WeakMap,P={},g=d=>{if(o==="menu")return P;let R=d.parent;for(;R;){if(Vt(R.def))return R;R=R.parent}return P},S=d=>{process.env.NODE_ENV!=="production"&&console.warn(d)},M=d=>o==="menu"?"menu":d===P?"root surface":`surface "${d.definitionPath.join("/")}"`,L=d=>{if(process.env.NODE_ENV==="production")return;d.id===""&&(h||(h=!0,S(`[PopupMenu] Empty Resolved ID for ${d.kind} definition.`)));let R=i.get(d.id);!R||R===d||f.has(d.id)||(f.add(d.id),S(`[PopupMenu] Duplicate Resolved ID "${d.id}" in menu scope; ${R.kind} and ${d.kind} definitions conflict.`))},D=(d,R=P)=>{d.definitionKey===""&&(p||(p=!0,S(`[PopupMenu] Empty Definition Key in ${d.kind} definition (${M(R)}).`)));let x=b.get(R);x||(x=new Map,b.set(R,x));let w=x.get(d.definitionKey);w||(w=new Set,x.set(d.definitionKey,w));let F=[...w].find(m=>m!==d);if(F){let m=a.get(R);m||(m=new Set,a.set(R,m)),m.has(d.definitionKey)||(m.add(d.definitionKey),S(`[PopupMenu] Duplicate Definition Key "${d.definitionKey}" in ${M(R)}; ${F.kind} and ${d.kind} definitions conflict.`))}w.add(d),n.has(d.def)||n.set(d.def,d),L(d),i.has(d.id)||i.set(d.id,d);let T=o==="surface"&&Vt(d.def)?d:R;for(let m of d.children)D(m,T)},I=d=>{let R=g(d),x=b.get(R),w=_optionalChain([x, 'optionalAccess', _2 => _2.get, 'call', _3 => _3(d.definitionKey)]);w&&(w.delete(d),w.size===0&&_optionalChain([x, 'optionalAccess', _4 => _4.delete, 'call', _5 => _5(d.definitionKey)]),_optionalChain([x, 'optionalAccess', _6 => _6.size])===0&&b.delete(R)),n.get(d.def)===d&&n.delete(d.def),i.get(d.id)===d&&i.delete(d.id),c.delete(d);for(let F of d.children)I(F)},v=(d,R)=>d.length===R.length&&d.every((x,w)=>x===R[w]),u=d=>Vt(d.def)?d.definitionPath:d.parent?u(d.parent):[],l=(d,R,x,w)=>{let F=new Map;for(let N of d){let A=F.get(N.id);A?A.push(N):F.set(N.id,[N])}let T=[],m=new Set;for(let[N,A]of R.entries()){let{id:y}=wn(A,x,w,N,r),j=_optionalChain([F, 'access', _7 => _7.get, 'call', _8 => _8(y), 'optionalAccess', _9 => _9.find, 'call', _10 => _10(E=>!m.has(E)&&E.kind===A.kind)]);j?(m.add(j),T.push(j)):T.push(void 0)}let O=d.length===R.length;for(let N of d)m.has(N)||(O=!1,I(N));let G=R.map((N,A)=>{let y=T[A],{definitionKey:k,definitionPath:j,id:E}=wn(N,x,w,A,r);if(!y){O=!1;let H=Dn([N],x,w,r)[0];return H.index=A,H.id=wn(N,x,w,A,r).id,D(H,g(H)),H}if(y.def===N&&v(y.definitionPath,j))return(d[A]!==y||y.index!==A)&&(O=!1),y.index=A,y;O=!1,n.get(y.def)===y&&n.delete(y.def);let U=g(y),$=b.get(U),re=_optionalChain([$, 'optionalAccess', _11 => _11.get, 'call', _12 => _12(y.definitionKey)]);return re&&(re.delete(y),re.size===0&&_optionalChain([$, 'optionalAccess', _13 => _13.delete, 'call', _14 => _14(y.definitionKey)]),_optionalChain([$, 'optionalAccess', _15 => _15.size])===0&&b.delete(U)),y.def=N,y.definitionKey=k,y.definitionPath=j,y.index=A,y.id!==E&&(i.get(y.id)===y&&i.delete(y.id),y.id=E,L(y),i.has(E)||i.set(E,y)),n.has(N)||n.set(N,y),c.delete(y),y.children=l(y.children,In(N),y,Vt(N)?y.definitionPath:w),D(y,g(y)),y});return O?d:G};return{getResolvedId:r,idScope:o,get rootNodes(){return t},setContent(d){d!==s&&(t=l(t,d,null,[]),s=d)},graft(d,R){R!==c.get(d)&&(d.children=l(d.children,R,d,u(d)),c.set(d,R))},getNodeForDef(d){return n.get(d)},getNodeById(d){return i.get(d)}}}var ks={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)},Oo=class extends _store.ReactStore{constructor(){super({chain:[]},{},ks)}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 Is(e={}){let{onOpenChange:o,defaultOpen:r=!1,virtualized:t=!1,items:s,onHighlightChange:n,closeOnOutsidePress:i="pointerdown",disabled:c=!1,defaultDisabled:f=!1,getResolvedId:p,idScope:a="surface"}=e,h=xe.useRef(null);h.current===null&&(h.current=wr({getResolvedId:p,idScope:a}));let b=h.current,P=xe.useCallback((N,A,y)=>{_optionalChain([n, 'optionalCall', _16 => _16(N,N===null?null:_nullishCoalesce(b.getNodeById(N), () => (null)),A,y)])},[b,n]),[g,S]=xe.useState(f),M=c||g,L=xe.useCallback(N=>{S(N)},[]);xe.useEffect(()=>{_chunkXMZZ62VJcjs.c.call(void 0, )},[]);let D=xe.useRef(null),I=xe.useCallback((N,A)=>{if(!N&&A.reason===_chunkXMZZ62VJcjs.a.focusOut&&D.current){let y=D.current;D.current=null;let k=_chunkXMZZ62VJcjs.b.call(void 0, _chunkXMZZ62VJcjs.a.outsidePress,y);_optionalChain([o, 'optionalCall', _17 => _17(N,k)]),k.isCanceled&&A.cancel();return}D.current=null,_optionalChain([o, 'optionalCall', _18 => _18(N,A)])},[o]),v=_chunkXMZZ62VJcjs.y.useStore(void 0,{open:r},{onOpenChange:I}),u=v.useState("open"),l=xe.useRef(null);l.current||(l.current=new so);let d=l.current,R=xe.useRef(null);R.current||(R.current=new Oo);let x=R.current,w=xe.useRef(new Map),F=xe.useCallback((N,A)=>{let y=Math.random().toString(36).slice(2);return w.current.set(y,{depth:N,setOpen:A}),()=>{w.current.delete(y)}},[]),T=xe.useCallback((N=_chunkXMZZ62VJcjs.a.itemPress,A)=>{let y=[...w.current.values()].sort((k,j)=>j.depth-k.depth);for(let k of y)k.setOpen(!1);v.setOpen(!1,N,A),d.clearOwner(),x.clear()},[v,d,x]),m=xe.useRef(T);m.current=T,xe.useEffect(()=>{if(!u||M){D.current=null;return}let N=A=>{let y=A.target;if(!y)return;let k=y.closest("[data-open]")!==null,j=y.closest("[data-popup-open]")!==null;i==="pointerdown"&&!(k||j)?m.current(_chunkXMZZ62VJcjs.a.outsidePress,A):D.current=A};return document.addEventListener("pointerdown",N,!0),()=>{document.removeEventListener("pointerdown",N,!0),D.current=null}},[u,i,M]);let O=xe.useCallback((N,A=_chunkXMZZ62VJcjs.a.none,y)=>{let k=A===_chunkXMZZ62VJcjs.a.imperativeAction;M&&!k||(v.setOpen(N,A,y),N||(d.clearOwner(),x.clear()))},[v,d,x,M]),G=xe.useMemo(()=>{if(!(!t&&!n))return{virtualized:t,items:_nullishCoalesce(s, () => ([])),onHighlightChange:P}},[t,s,P,n]);return{menuTreeResolver:b,store:v,focusOwnerStore:d,openChainStore:x,registerSurface:F,closeAll:T,virtualization:G,handleOpenChange:O,disabled:M,setDisabled:L}}var Ds=140;function Ln(e){let{surfaceId:o,store:r}=e,[t,s]=ge.useState([]),n=ge.useRef(t);ge.useEffect(()=>{n.current=t},[t]);let i=ge.useRef(new Map),c=ge.useRef(new Set),f=ge.useRef(new Map),[,p]=ge.useState(0),[a,h]=ge.useState(!1),b=ge.useRef(null),P=ge.useCallback(()=>{b.current!==null&&(clearTimeout(b.current),b.current=null)},[]),g=ge.useCallback(()=>{h(!0),P(),b.current=setTimeout(()=>{b.current=null,h(!1)},Ds)},[P]);ge.useEffect(()=>P,[P]);let S=ge.useCallback(m=>{let O={surfaceId:m.surfaceId,closeRootOnEsc:m.closeRootOnEsc},G=f.current.get(m.pageId);return G?(process.env.NODE_ENV!=="production"&&!c.current.has(m.pageId)&&(c.current.add(m.pageId),console.warn(`PopupMenu: page ID "${m.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.`)),G.push(O)):(f.current.set(m.pageId,[O]),i.current.set(m.pageId,O),p(N=>N+1)),()=>{let N=f.current.get(m.pageId);if(!N)return;let A=N.indexOf(O);if(A===-1)return;let y=A===0;if(N.splice(A,1),!y)return;let k=N[0];if(k){i.current.set(m.pageId,k),p(j=>j+1);return}f.current.delete(m.pageId),i.current.delete(m.pageId),p(j=>j+1),s(j=>j.includes(m.pageId)?j.filter(U=>U!==m.pageId):j)}},[]),M=ge.useCallback(m=>{if(!i.current.has(m))return!1;let O=n.current;return O[O.length-1]===m?!1:(s(N=>[...N,m]),g(),!0)},[g]),L=ge.useCallback(()=>n.current.length===0?!1:(s(O=>O.slice(0,-1)),g(),!0),[g]),D=ge.useCallback(m=>_nullishCoalesce(_optionalChain([i, 'access', _19 => _19.current, 'access', _20 => _20.get, 'call', _21 => _21(m), 'optionalAccess', _22 => _22.surfaceId]), () => (null)),[]),I=ge.useCallback(()=>{s([]),h(!1),P()},[P]);ge.useEffect(()=>{if(!r)return;let m=r.context.onPopupCloseComplete,O=()=>{_optionalChain([m, 'optionalCall', _23 => _23()]),I()};return r.context.onPopupCloseComplete=O,()=>{r.context.onPopupCloseComplete===O&&(r.context.onPopupCloseComplete=m),P()}},[r,I,P]);let v=_nullishCoalesce(t[t.length-1], () => (null)),u=v===null?void 0:i.current.get(v),l=v===null?o:_nullishCoalesce(_optionalChain([u, 'optionalAccess', _24 => _24.surfaceId]), () => (o)),d=v===null?!0:_nullishCoalesce(_optionalChain([u, 'optionalAccess', _25 => _25.closeRootOnEsc]), () => (!0)),R=t.length>0,x=t,w=_nullishCoalesce(x[x.length-1], () => (null)),F=w!==null;return{subpageStackContextValue:ge.useMemo(()=>({activePageId:v,rootSurfaceId:o,activeSurfaceId:l,canGoBack:R,shouldCloseRootOnEsc:d,stack:t,registerPage:S,openPage:M,goBack:L,getSurfaceId:D}),[v,o,l,R,d,t,S,M,L,D]),isSubpageNavigating:a,hasOpenSubpage:F,subpageId:w,openSubpageIds:x}}var _popover = require('@base-ui/react/popover');var On=To.createContext(null);function q(){return To.useContext(On)}function W(e,o){if(e)return`bazzaui-${e}-${o}`}var _jsxruntime = require('react/jsx-runtime');var Ns=Nr.forwardRef(function(o,r){let t=q(),s=W(t,"arrow");return _jsxruntime.jsx.call(void 0, _popover.Popover.Arrow,{ref:r,...s?{[s]:""}:{},...o})});var Ts=Lr.forwardRef(function(o,r){let{showOn:t,...s}=o,n=je(),i=Ct(),c=Pe(),f=n!==null,p=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _26 => _26.childSurfaceId]), () => ("")),a=_nullishCoalesce(t, () => ((f?"focus":"open"))),h=i.useState("isOpen",p),b=i.useState("isLast",p),P=c.useState("isOwner",p),g=!0;f&&(a==="open"?g=h:b?g=P:g=h);let S=q(),M=W(S,"backdrop");if(!g)return null;let L={pointerEvents:"none",...s.style};return _jsxruntime.jsx.call(void 0, _popover.Popover.Backdrop,{ref:r,...M?{[M]:""}:{},...s,style:L})});var Tn=(b=>(b.slot="bazzaui-[component]-popup",b.open="data-open",b.closed="data-closed",b.side="data-side",b.align="data-align",b.startingStyle="data-starting-style",b.endingStyle="data-ending-style",b.instant="data-instant",b.focused="data-focused",b.hasOpenSubmenu="data-has-open-submenu",b.submenu="data-submenu",b.navigating="data-navigating",b))(Tn||{});var Or=ao.createContext(null);function Ai(){let e=ao.useContext(Or);if(!e)throw new Error("Combobox components must be used within a Combobox.Root");return e}function Ht(){return ao.useContext(Or)}var uo=_e.createContext(null),io= exports.z =_e.createContext(null);function Gn(){let e=_e.useContext(uo);if(!e)throw new Error("useDataSurfaceContext must be used within a DataSurface component");return e}function En(){return _e.useContext(uo)}function Go(){let e=_e.useContext(io);if(!e)throw new Error("Data components must be used within PopupMenu.Popup");return e}function Tr(){return _e.useContext(io)}var co=_e.createContext(null);function Es(){let e=_e.useContext(co);if(!e)throw new Error("useDataList must be used within a List component");return e}function As(){return _e.useContext(co)}var po=Eo.createContext(null);function Gr(){return Eo.useContext(po)}var An=ae.createContext(null);function kt(){return ae.useContext(An)}function lo(){return ae.useContext(An)}function Er(e){let{children:o,searchQuery:r}=e,[t,s]=ae.useState(()=>new Map),[n,i]=ae.useState(null),[c,f]=ae.useState(()=>new Map),[p,a]=ae.useState(null),h=ae.useCallback(k=>{i(k)},[]),b=ae.useCallback(()=>{i(null),a(null)},[]),P=ae.useCallback(k=>{i(j=>j&&{...j,result:k}),k.isError&&k.error?a(k.error):k.isError||a(null)},[]),g=ae.useCallback(k=>{s(j=>{let E=new Map(j);return E.set(k.id,k),E})},[]),S=ae.useCallback(k=>{s(j=>{let E=new Map(j);return E.delete(k),E}),f(j=>{let E=new Map(j);return E.delete(k),E})},[]),M=ae.useCallback((k,j)=>{s(E=>{let U=E.get(k);if(!U)return E;let $=new Map(E);return $.set(k,{...U,result:j}),$}),j.isError&&j.error?f(E=>{let U=new Map(E);return U.set(k,j.error),U}):j.isError||f(E=>{if(!E.has(k))return E;let U=new Map(E);return U.delete(k),U})},[]),L=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _27 => _27.config, 'access', _28 => _28.type])==="static"&&n.result.isFetching)return!0;for(let[,k]of t)if(k.config.type==="static"&&k.result.isFetching)return!0;return!1},[t,n]),D=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _29 => _29.config, 'access', _30 => _30.type])==="static"&&n.result.isLoading)return!0;for(let[,k]of t)if(k.config.type==="static"&&k.result.isLoading)return!0;return!1},[t,n]),I=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _31 => _31.config, 'access', _32 => _32.type])==="static"&&n.result.isInitialLoading)return!0;for(let[,k]of t)if(k.config.type==="static"&&k.result.isInitialLoading)return!0;return!1},[t,n]),v=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _33 => _33.config, 'access', _34 => _34.type])==="static"&&n.result.isRefetching)return!0;for(let[,k]of t)if(k.config.type==="static"&&k.result.isRefetching)return!0;return!1},[t,n]),u=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _35 => _35.config, 'access', _36 => _36.type])==="query"&&n.result.isFetching)return!0;for(let[,k]of t)if(k.config.type==="query"&&k.result.isFetching)return!0;return!1},[t,n]),l=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _37 => _37.config, 'access', _38 => _38.type])==="query"&&n.result.isLoading)return!0;for(let[,k]of t)if(k.config.type==="query"&&k.result.isLoading)return!0;return!1},[t,n]),d=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _39 => _39.config, 'access', _40 => _40.type])==="query"&&n.result.isInitialLoading)return!0;for(let[,k]of t)if(k.config.type==="query"&&k.result.isInitialLoading)return!0;return!1},[t,n]),R=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _41 => _41.config, 'access', _42 => _42.type])==="query"&&n.result.isRefetching)return!0;for(let[,k]of t)if(k.config.type==="query"&&k.result.isRefetching)return!0;return!1},[t,n]),x=(_nullishCoalesce(_optionalChain([n, 'optionalAccess', _43 => _43.result, 'access', _44 => _44.isFetching]), () => (!1)))||L||u,w=(_nullishCoalesce(_optionalChain([n, 'optionalAccess', _45 => _45.result, 'access', _46 => _46.isLoading]), () => (!1)))||D||l,F=(_nullishCoalesce(_optionalChain([n, 'optionalAccess', _47 => _47.result, 'access', _48 => _48.isInitialLoading]), () => (!1)))||I||d,T=(_nullishCoalesce(_optionalChain([n, 'optionalAccess', _49 => _49.result, 'access', _50 => _50.isRefetching]), () => (!1)))||v||R,m=ae.useMemo(()=>{if(t.size===0&&!n)return!1;for(let[,k]of t)if(!k.result.isRefetching)return!1;return n?n.result.isRefetching:!0},[t,n]),O=ae.useMemo(()=>_nullishCoalesce(_optionalChain([n, 'optionalAccess', _51 => _51.result, 'access', _52 => _52.isLoading]), () => (!1)),[n]),G=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _53 => _53.result, 'access', _54 => _54.isFetching]))return!1;for(let[,k]of t)if(k.result.isFetching)return!1;return!0},[t,n]),N=ae.useCallback(()=>{let k=[];_optionalChain([n, 'optionalAccess', _55 => _55.result, 'access', _56 => _56.data])&&!p&&k.push({kind:"root",nodes:n.result.data});for(let[j,E]of t)c.has(j)||E.result.data&&k.push({kind:"branch",id:j,nodes:E.result.data});return k},[t,c,n,p]),A=ae.useCallback(()=>{let k=[];p&&k.push({kind:"root",reason:"error"});for(let[j]of c)k.push({kind:"branch",id:j,reason:"error"});return{isLoading:w,isFetching:x,isInitialLoading:F,isRefetching:T,isAllRefetching:m,isStaticLoading:D,isStaticInitialLoading:I,isStaticRefetching:v,isQueryLoading:l,isQueryInitialLoading:d,isQueryRefetching:R,skippedMenus:k}},[x,w,F,T,m,D,I,v,l,d,R,c,p]),y=ae.useMemo(()=>({registerLoader:g,unregisterLoader:S,updateLoaderResult:M,registerRootLoader:h,unregisterRootLoader:b,updateRootLoaderResult:P,searchQuery:r,loaders:t,root:n,isAnyLoading:w,isAnyFetching:x,isAnyInitialLoading:F,isAnyRefetching:T,isAllRefetching:m,isRootLoading:O,isStaticLoading:D,isStaticFetching:L,isStaticInitialLoading:I,isStaticRefetching:v,isQueryLoading:l,isQueryFetching:u,isQueryInitialLoading:d,isQueryRefetching:R,allResolved:G,getAsyncNodes:N,erroredLoaders:c,rootError:p,getAsyncState:A}),[g,S,M,h,b,P,r,t,n,w,x,F,T,m,O,D,L,I,v,l,u,d,R,G,N,c,p,A]);return _jsxruntime.jsx.call(void 0, An.Provider,{value:y,children:o})}function Ar(e){return e.kind==="tree-item"}function be(e,o){return e.def.kind===o}function ze(e){let o=e.def.kind;return o==="item"||o==="radio-item"||o==="checkbox-item"||o==="submenu"||o==="subpage"||o==="tree-item"}function Bs(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 Vs(e,o){let r=_nullishCoalesce(e.minQueryLength, () => (1)),t=Bs(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 Fn(e,o,r){let t=e.def;if(!t.asyncNodes||!r)return;let s=r.loaders.get(e.id);if(!s)return;let n=t.asyncNodes.type==="query"?Vs(t.asyncNodes,o).isBelowMinLength:!1;return{status:s.result.status,fetchStatus:s.result.fetchStatus,loadingPhase:s.result.loadingPhase,isLoading:s.result.isLoading,isFetching:s.result.isFetching,isInitialLoading:s.result.isInitialLoading,isRefetching:s.result.isRefetching,isError:s.result.isError,error:s.result.error,isBelowMinLength:n}}function Ao(e,o=[],r=null){let t=[];for(let s of e){let n=s.def;if(n.kind!=="separator"){if(n.kind==="group"){t.push(...Ao(s.children,o,{id:n.id,label:n.label}));continue}if(n.kind==="radio-group"){if(n.hidden)continue;t.push(...Ao(s.children,o,null));continue}if(!n.hidden&&(n.kind==="submenu"||n.kind==="subpage")&&(n.kind==="subpage"&&t.push({node:s,pageId:s.id,context:{search:null,breadcrumbs:o,isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(n.disabled, () => (!1)),group:r,tree:null}}),s.children.length)){let i={node:n,menuNode:s,value:n.value,id:n.id};t.push(...Ao(s.children,[...o,i],null))}}}return t}function Fr(e){let{children:o}=e,r=kt(),t=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _57 => _57.searchQuery]), () => ("")),{dataSurfaceContext:s,resolvedNodes:n}=Go(),i=n&&(!s||n.content===s.content)?n:null,c=_nullishCoalesce(_optionalChain([i, 'optionalAccess', _58 => _58.nodes]), () => ([])),f=_nullishCoalesce(_optionalChain([i, 'optionalAccess', _59 => _59.graftVersion]), () => (0)),p=Be.useMemo(()=>Ao(c),[c,f]),a=Be.useCallback(b=>{let{node:P,context:g,pageId:S}=b,M=P.def,L={node:M,menuNode:P,value:M.value,id:M.id},D=(v,u)=>{let l=v.def,d=v.id;if(l.kind==="item")return _jsxruntime.jsx.call(void 0, Be.Fragment,{children:l.render({node:v,props:{id:d,value:l.value,disabled:_nullishCoalesce(l.disabled, () => (!1)),closeOnClick:l.closeOnClick,onSelect:l.onSelect,shortcut:l.shortcut},context:{...u,value:l.value,disabled:_nullishCoalesce(l.disabled, () => (!1))}})},d);if(l.kind==="checkbox-item")return _jsxruntime.jsx.call(void 0, Be.Fragment,{children:l.render({node:v,props:{id:d,value:l.value,checked:l.checked,onCheckedChange:l.onCheckedChange,disabled:_nullishCoalesce(l.disabled, () => (!1)),closeOnClick:l.closeOnClick},context:{...u,value:l.value,checked:l.checked,disabled:_nullishCoalesce(l.disabled, () => (!1))}})},d);if(l.kind==="radio-item")return _jsxruntime.jsx.call(void 0, Be.Fragment,{children:l.render({node:v,props:{id:d,value:l.value,disabled:_nullishCoalesce(l.disabled, () => (!1)),closeOnClick:l.closeOnClick,onSelect:l.onSelect,shortcut:l.shortcut},context:{...u,value:l.value,disabled:_nullishCoalesce(l.disabled, () => (!1))}})},d);if(l.kind==="submenu"){let w=Fn(v,t,r),F=pt(v),T={node:l,menuNode:v,value:l.value,id:l.id},m=O=>{let G=O.def;if(G.kind==="separator")return null;if(G.kind==="group"){let N=O.children.filter(y=>(y.def.kind==="item"||y.def.kind==="checkbox-item"||y.def.kind==="submenu"||y.def.kind==="subpage")&&!y.def.hidden);if(N.length===0)return null;let A=N.map(y=>D(y,{search:null,breadcrumbs:[...u.breadcrumbs,T],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(y.def.disabled, () => (!1)),group:{id:G.id,label:G.label},tree:null}));if(G.render){let y={search:null,matchCount:N.length,breadcrumbs:[...u.breadcrumbs,T],isDeepSearchResult:!1},k=O;return _jsxruntime.jsx.call(void 0, Be.Fragment,{children:G.render({node:k,props:{},context:{...y,label:G.label},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:A})})},G.id)}return _jsxruntime.jsx.call(void 0, "div",{role:"group","aria-label":G.label,children:A},G.id)}return G.kind==="radio-group"?I(O,[...u.breadcrumbs,T]):G.kind!=="item"&&G.kind!=="checkbox-item"&&G.kind!=="submenu"&&G.kind!=="subpage"?null:D(O,{search:null,breadcrumbs:[...u.breadcrumbs,T],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(G.disabled, () => (!1)),group:null,tree:null})};return _jsxruntime.jsx.call(void 0, Be.Fragment,{children:l.render({node:v,props:{id:d,value:l.value,disabled:_nullishCoalesce(l.disabled, () => (!1))},context:{...u,value:l.value,disabled:_nullishCoalesce(l.disabled, () => (!1)),async:w},nodes:F,asyncContent:l.asyncNodes,renderNode:m})},d)}if(l.kind!=="subpage")return null;let R=Fn(v,t,r),x=v.id;return _jsxruntime.jsx.call(void 0, Be.Fragment,{children:l.renderTrigger({node:v,props:{id:d,value:l.value,disabled:_nullishCoalesce(l.disabled, () => (!1)),targetPageId:x},context:{...u,value:l.value,disabled:_nullishCoalesce(l.disabled, () => (!1)),async:R}})},x)},I=(v,u=[])=>{let l=v.def,d=u.length>0,R={search:null,matchCount:l.nodes.length,breadcrumbs:u,isDeepSearchResult:d},x=v.children.map(w=>!ze(w)||w.def.hidden?null:D(w,{search:null,breadcrumbs:u,isDeepSearchResult:d,highlighted:!1,disabled:_nullishCoalesce(w.def.disabled, () => (!1)),group:null,tree:null}));return l.render?_jsxruntime.jsx.call(void 0, Be.Fragment,{children:l.render({node:v,props:{value:l.value,onValueChange:l.onValueChange,disabled:_nullishCoalesce(l.disabled, () => (!1))},context:{...R,label:l.label,value:l.value,disabled:_nullishCoalesce(l.disabled, () => (!1))},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:x})})},l.id):_jsxruntime.jsx.call(void 0, "div",{role:"radiogroup","aria-label":l.label,children:x},l.id)};return _jsxruntime.jsx.call(void 0, Be.Fragment,{children:_jsxruntime.jsx.call(void 0, po.Provider,{value:P,children:M.renderContent({node:P,pageId:S,context:{...g,value:M.value,disabled:_nullishCoalesce(M.disabled, () => (!1)),async:Fn(P,t,r)},nodes:pt(P),asyncContent:M.asyncNodes,renderNode:v=>{let u=v.def;if(u.kind==="separator")return null;if(u.kind==="group"){let l=v.children.filter(R=>(R.def.kind==="item"||R.def.kind==="checkbox-item"||R.def.kind==="submenu"||R.def.kind==="subpage")&&!R.def.hidden);if(l.length===0)return null;let d=l.map(R=>D(R,{search:null,breadcrumbs:[...g.breadcrumbs,L],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(R.def.disabled, () => (!1)),group:{id:u.id,label:u.label},tree:null}));if(u.render){let R={search:null,matchCount:l.length,breadcrumbs:[...g.breadcrumbs,L],isDeepSearchResult:!1},x=v;return _jsxruntime.jsx.call(void 0, Be.Fragment,{children:u.render({node:x,props:{},context:{...R,label:u.label},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:d})})},u.id)}return _jsxruntime.jsx.call(void 0, "div",{role:"group","aria-label":u.label,children:d},u.id)}return u.kind==="radio-group"?I(v,[...g.breadcrumbs,L]):u.kind!=="item"&&u.kind!=="checkbox-item"&&u.kind!=="submenu"&&u.kind!=="subpage"?null:D(v,{search:null,breadcrumbs:[...g.breadcrumbs,L],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(u.disabled, () => (!1)),group:null,tree:null})}})})},S)},[r,t]);if(!s)return null;let h={subpages:p,renderSubpageContent:a};return o?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:o(h)}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:p.map(a)})}function Br(e,o,r){return Math.min(r,Math.max(o,e))}function mo(e,o){return typeof e!="number"||Number.isNaN(e)?o:e}var Vr={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 Hr(e,o){let r=Vr;if(typeof e=="boolean")return{...r,enabled:e};if(!e)return{...r,enabled:!!o};let t=Br(mo(e.triangleFillOpacity,r.triangleFillOpacity),0,1),s=Br(mo(e.overlayOpacity,r.overlayOpacity),0,1),n=Math.max(0,mo(e.strokeWidth,r.strokeWidth)),i=Math.max(0,mo(e.dotRadius,r.dotRadius)),c=Math.max(0,mo(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:s,showStroke:_nullishCoalesce(e.showStroke, () => (r.showStroke)),strokeWidth:n,strokeDasharray:_nullishCoalesce(e.strokeDasharray, () => (r.strokeDasharray)),showDots:_nullishCoalesce(e.showDots, () => (r.showDots)),dotRadius:i,freezeOnPointerLeave:_nullishCoalesce(e.freezeOnPointerLeave, () => (r.freezeOnPointerLeave)),persistOnSuccess:_nullishCoalesce(e.persistOnSuccess, () => (r.persistOnSuccess)),showMissState:_nullishCoalesce(e.showMissState, () => (r.showMissState)),missFreezeDuration:c}}var Hs={showSafeTriangleArea:Vr,logAimGuardEvents:!1},Bn=Fo.createContext(Hs);function Bo(){return Fo.useContext(Bn)}var jr=ce.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}),jt=()=>ce.useContext(jr);function zr({children:e}){let{logAimGuardEvents:o}=Bo(),[r,t]=ce.useState(!1),[s,n]=ce.useState(null),[i,c]=ce.useState(null),[f,p]=ce.useState(null),a=ce.useRef(!1),h=ce.useRef(null),b=ce.useRef(null),P=ce.useRef(null);ce.useEffect(()=>{a.current=r},[r]),ce.useEffect(()=>{h.current=s},[s]),ce.useEffect(()=>{b.current=i},[i]),ce.useEffect(()=>{P.current=f},[f]);let g=ce.useRef(null),S=ce.useCallback((u,l)=>{!o||typeof window>"u"||console.log(`[PopupMenu][AimGuardProvider] ${u}`,{aimGuardActive:a.current,guardedTriggerId:h.current,guardedDepth:b.current,guardedSubmenuSurfaceId:P.current,...l})},[o]),M=ce.useCallback(()=>{a.current=!1,h.current=null,b.current=null,P.current=null,t(!1),n(null),c(null),p(null)},[]),L=ce.useCallback(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null),S("clear"),M()},[M,S]),D=ce.useCallback((u,l,d,R=450)=>{S("activate",{triggerId:u,depth:l,submenuSurfaceId:d,timeoutMs:R}),a.current=!0,h.current=u,b.current=l,P.current=d,n(u),c(l),p(d),t(!0),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{S("timeout-expired",{triggerId:u,depth:l,submenuSurfaceId:d}),M(),g.current=null},R)},[M,S]);ce.useEffect(()=>()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null),S("provider-unmount-clear")},[S]);let I=ce.useCallback(u=>a.current&&h.current!==u,[]),v=ce.useMemo(()=>({aimGuardActive:r,guardedTriggerId:s,guardedDepth:i,guardedSubmenuSurfaceId:f,activateAimGuard:D,clearAimGuard:L,aimGuardActiveRef:a,guardedTriggerIdRef:h,guardedDepthRef:b,guardedSubmenuSurfaceIdRef:P,isGuardBlocking:I}),[r,s,i,f,D,L,I]);return _jsxruntime.jsx.call(void 0, jr.Provider,{value:v,children:e})}var Qs=he.forwardRef(function(o,r){let{children:t,className:s,render:n,...i}=o,c=je(),{clearAimGuard:f,aimGuardActiveRef:p,guardedSubmenuSurfaceIdRef:a}=jt(),h=Pe(),b=Ct(),P=it(),g=_nullishCoalesce(_optionalChain([P, 'optionalAccess', _60 => _60.depth]), () => (0)),S=Ht(),M=he.useId(),L=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _61 => _61.childSurfaceId]), () => (M)),{subpageStackContextValue:D,isSubpageNavigating:I,hasOpenSubpage:v,subpageId:u,openSubpageIds:l}=Ln({surfaceId:L,store:_nullishCoalesce(_optionalChain([P, 'optionalAccess', _62 => _62.store]), () => (null))}),[d,R]=he.useState(null),[x,w]=he.useState(null),F=D.activeSurfaceId,T=he.useRef(0);he.useEffect(()=>{_optionalChain([c, 'optionalAccess', _63 => _63.open])&&(T.current=Date.now())},[_optionalChain([c, 'optionalAccess', _64 => _64.open])]);let m=h.useState("isOwner",F),O=b.useState("hasOpenSubmenu",g),G=he.useRef(null),N=he.useCallback(C=>{G.current=C,typeof r=="function"?r(C):r&&(r.current=C),_optionalChain([c, 'optionalAccess', _65 => _65.contentRef])&&(c.contentRef.current=C)},[r,c]);he.useEffect(()=>{g===0&&_optionalChain([P, 'optionalAccess', _66 => _66.store, 'access', _67 => _67.setPopupRef, 'call', _68 => _68(G)])},[g,P]);let A=he.useCallback(()=>{c&&p.current&&a.current===L&&f()},[c,p,a,L,f]);he.useEffect(()=>{_optionalChain([c, 'optionalAccess', _69 => _69.open])!==!1||!p.current||a.current!==L||f()},[_optionalChain([c, 'optionalAccess', _70 => _70.open]),p,a,L,f]),he.useEffect(()=>()=>{p.current&&a.current===L&&f()},[p,a,L,f]);let y=he.useCallback(C=>{if(Date.now()-T.current<100||!c)return;let B=C.target;if(!_optionalChain([G, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.contains, 'call', _73 => _73(B)]))return;let X=B instanceof Element?B:B.parentElement;if(X){let te=X.closest("[data-base-ui-focusable]");if(te&&te!==G.current)return}h.state.ownerId!==c.childSurfaceId&&h.setOwnerId(c.childSurfaceId)},[c,h]),k=c||S?!1:void 0,j=c||S?!1:void 0,E=_optionalChain([S, 'optionalAccess', _74 => _74.layout])==="input-embedded",U=!!c,$=he.useCallback(C=>({...C,isSubmenu:U,hasOpenSubpage:v,subpageId:u,openSubpageIds:l}),[v,U,l,u]),re=he.useMemo(()=>typeof s=="function"?C=>s($(C)):s,[s,$]),H=he.useMemo(()=>typeof n=="function"?(C,K)=>n(C,$(K)):n,[n,$]),ne=q(),Q=W(ne,"popup"),V=he.useMemo(()=>({dataSurfaceContext:d,setDataSurfaceContext:R,resolvedNodes:x,setResolvedNodes:w}),[d,x]);return _jsxruntime.jsx.call(void 0, Bt.Provider,{value:L,children:_jsxruntime.jsx.call(void 0, no.Provider,{value:D,children:_jsxruntime.jsx.call(void 0, io.Provider,{value:V,children:_jsxruntime.jsxs.call(void 0, _popover.Popover.Popup,{ref:N,initialFocus:k,finalFocus:j,className:re,render:H,"data-input-embedded":E?"":void 0,...Q?{[Q]:""}:{},"data-focused":m?"":void 0,"data-has-open-submenu":O?"":void 0,"data-submenu":U?"":void 0,"data-navigating":I?"":void 0,onPointerMove:C=>{A(),y(C),_optionalChain([i, 'access', _75 => _75.onPointerMove, 'optionalCall', _76 => _76(C)])},...i,children:[t,_jsxruntime.jsx.call(void 0, Fr,{})]})})})})});var Ws=_popover.Popover.Portal;var Qr=(c=>(c.availableWidth="--available-width",c.availableHeight="--available-height",c.anchorWidth="--anchor-width",c.anchorHeight="--anchor-height",c.transformOrigin="--transform-origin",c.positionerWidth="--positioner-width",c.positionerHeight="--positioner-height",c))(Qr||{});var _reactdom = require('react-dom');var Kr=.5;function $s(e){if(qr(e))return{side:"shift",align:"shift"}}function qr(e){return e==="left"||e==="right"||e==="inline-start"||e==="inline-end"}var Ys=Se.forwardRef(function(o,r){let{side:t,align:s,alignOffset:n,collisionAvoidance:i,virtualAnchor:c,style:f,...p}=o,{store:a,depth:h,virtualAnchor:b,menuType:P}=Te(),g=je(),S=Se.useRef(0),M=Se.useRef(!1),[,L]=Se.useReducer(Q=>Q+1,0),D=Se.useRef(!1),I=Se.useRef({first:null,second:null}),v=Se.useCallback(()=>{if(typeof window>"u"){I.current.first=null,I.current.second=null;return}I.current.first!==null&&(window.cancelAnimationFrame(I.current.first),I.current.first=null),I.current.second!==null&&(window.cancelAnimationFrame(I.current.second),I.current.second=null)},[]),u=Se.useCallback(()=>{v(),D.current=!1},[v]),l=Se.useCallback(()=>{v(),D.current=!0,!(typeof window>"u")&&(I.current.first=window.requestAnimationFrame(()=>{I.current.first=null,I.current.second=window.requestAnimationFrame(()=>{I.current.second=null,D.current=!1})}))},[v]),d=h>0,R=d?c:_nullishCoalesce(c, () => (b)),w=_nullishCoalesce(t, () => ((d?"right":"bottom"))),T=_nullishCoalesce(s, () => ((d||P==="context"?"start":"center"))),m=T==="list-start"&&qr(w),O=T==="list-start"?"start":T,G=_nullishCoalesce(_optionalChain([g, 'optionalAccess', _77 => _77.open]), () => (!1)),N=a.useState("inputActive"),A=a.context.hideUntilActive,y=Se.useRef(N),k=Se.useCallback(()=>{if(!m)return!1;let Q=_optionalChain([g, 'optionalAccess', _78 => _78.contentRef, 'access', _79 => _79.current]);if(!Q)return!1;let V=Q.getBoundingClientRect(),C=Q.querySelector('[role="listbox"]');if(!C){let fe=S.current;return S.current=0,Math.abs(fe)>Kr}let K=C.getBoundingClientRect(),B=getComputedStyle(C),X=Number.parseFloat(B.paddingTop)||0,te=-(K.top+X-V.top),J=S.current;return S.current=te,Math.abs(te-J)>Kr},[m,g]);Se.useLayoutEffect(()=>{!m||!G||M.current||(k(),M.current=!0,L())},[m,G,k]),Se.useLayoutEffect(()=>{if(!m||!G)return;let Q=_optionalChain([g, 'optionalAccess', _80 => _80.contentRef, 'access', _81 => _81.current]);if(!Q||typeof ResizeObserver>"u")return;let V=new ResizeObserver(()=>{D.current||k()&&_reactdom.flushSync.call(void 0, ()=>{L()})});V.observe(Q);let C=Q.querySelector('[role="listbox"]');return C&&V.observe(C),()=>{V.disconnect()}},[m,G,g,k]),Se.useLayoutEffect(()=>{let Q=y.current;y.current=N,!(!m||!G)&&A&&!Q&&N&&l()},[m,G,A,N,l]),Se.useEffect(()=>{G||(M.current=!1,S.current=0,u())},[G,u]),Se.useEffect(()=>u,[u]);let j=m?S.current+(typeof n=="number"?n:0):n,E=_nullishCoalesce(i, () => ($s(w))),U=R?{anchor:R}:{},re=m&&!M.current&&G?{...f,transition:"none"}:f,H=q(),ne=W(H,"positioner");return _jsxruntime.jsx.call(void 0, _popover.Popover.Positioner,{ref:r,side:w,align:O,alignOffset:j,collisionAvoidance:E,style:re,...ne?{[ne]:""}:{},"data-align":m?"list-start":void 0,...U,...p})});var Hn=Ho.createContext(null);function jo(){return Ho.useContext(Hn)}var jn=zo.createContext(null);function Qo(){return zo.useContext(jn)}var Ko= (_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 s=this.zones.get(o);return s||(s=new Map,this.zones.set(o,s)),s.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,s)=>t.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1):[]}}, _class);function _s(e){let{store:o,focusOwnerStore:r,openChainStore:t,disabled:s,depth:n,closeAll:i,explicitTabBehavior:c=!1,tabWithoutZones:f="close",registerSurface:p,virtualization:a,debug:h,virtualAnchor:b,menuType:P="dropdown",closeOnOutsidePress:g="pointerdown",componentName:S,children:M,menuTreeResolver:L}=e,D=zt.useRef(null);D.current||(D.current=new Ko);let I=zt.useMemo(()=>({store:o,disabled:s,depth:n,closeAll:i,explicitTabBehavior:c,tabWithoutZones:f,registerSurface:p,virtualization:a,virtualAnchor:b,menuType:P,closeOnOutsidePress:g}),[o,s,n,i,c,f,p,a,b,P,g]),v=zt.useMemo(()=>({store:o,depth:n,closeAll:i,registerSurface:p,virtualization:a}),[o,n,i,p,a]),u=zt.useMemo(()=>({showSafeTriangleArea:Hr(_optionalChain([h, 'optionalAccess', _93 => _93.showSafeTriangleArea]),_optionalChain([h, 'optionalAccess', _94 => _94.showSubmenuSafeTriangleArea])),logAimGuardEvents:_nullishCoalesce(_optionalChain([h, 'optionalAccess', _95 => _95.logAimGuardEvents]), () => (!1))}),[_optionalChain([h, 'optionalAccess', _96 => _96.showSafeTriangleArea]),_optionalChain([h, 'optionalAccess', _97 => _97.showSubmenuSafeTriangleArea]),_optionalChain([h, 'optionalAccess', _98 => _98.logAimGuardEvents])]);return _jsxruntime.jsx.call(void 0, jn.Provider,{value:L,children:_jsxruntime.jsx.call(void 0, On.Provider,{value:S,children:_jsxruntime.jsx.call(void 0, Bn.Provider,{value:u,children:_jsxruntime.jsx.call(void 0, ut.Provider,{value:I,children:_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.i.Provider,{value:v,children:_jsxruntime.jsx.call(void 0, zr,{children:_jsxruntime.jsx.call(void 0, yn.Provider,{value:r,children:_jsxruntime.jsx.call(void 0, Mn.Provider,{value:t,children:_jsxruntime.jsx.call(void 0, Hn.Provider,{value:D.current,children:M})})})})})})})})})}function Qe(e){let{closeOnClick:o=!0,disabled:r=!1,activatable:t=!0,...s}=e,{aimGuardActiveRef:n,guardedDepthRef:i}=jt(),{closeAll:c}=_chunkXMZZ62VJcjs.j.call(void 0, ),p=_nullishCoalesce(_optionalChain([it, 'call', _99 => _99(), 'optionalAccess', _100 => _100.disabled]), () => (!1)),a=r||p,h=go.useMemo(()=>({aimGuardActiveRef:n,guardedDepthRef:i}),[n,i]),b=go.useCallback(g=>{o&&c()},[o,c]),P=_chunkXMZZ62VJcjs.t.call(void 0, {...s,disabled:a,activatable:t,aimGuard:h,closeOnClick:o,onAfterSelect:b});return go.useMemo(()=>({...P,disabled:a}),[P,a])}function ho(e){let{store:o,surfaceId:r,focusOwnerStore:t,depth:s,submenuContext:n,subpageContext:i=null,enabled:c,disabled:f=!1,enableTypeToSearch:p=!1,onKeyDown:a,closeAll:h,skipFocusOwnerCheck:b=!1}=e,P=bo.useMemo(()=>n?{setOpen:M=>{M||(n.suppressAutoOpenRef.current=!0),n.setOpen(M)},parentSurfaceId:n.parentSurfaceId,closeRootOnEsc:n.closeRootOnEsc}:null,[n]),g=bo.useMemo(()=>i?{goBack:i.goBack,parentSurfaceId:i.parentSurfaceId,closeRootOnEsc:i.closeRootOnEsc}:null,[i]),S=bo.useCallback(M=>{M.itemId&&M.closeOnClick&&h()},[h]);return _chunkXMZZ62VJcjs.u.call(void 0, {store:o,surfaceId:r,enabled:c&&!f,onKeyDown:a,onSelect:S,closeAll:h,focusOwner:t,depth:s,submenuContext:P,subpageContext:g,enableTypeToSearch:p,skipFocusOwnerCheck:b})}var _userender = require('@base-ui/react/use-render');function $c(e){return e==null||e===""}function Wr(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 Ur(e,o){return e==null?"":o?o(e):typeof e=="object"&&"value"in e?String(e.value):String(e)}var Zr={slot:"bazzaui-[component]-icon",open:"data-popup-open"};var ea={open:e=>e?{[Zr.open]:""}:null},ta= exports.T =It.forwardRef(function(o,r){let{render:t,className:s,style:n,children:i,onPointerDown:c,onClick:f,...p}=o,{store:a}=Te(),h=a.useState("open"),b=Ht(),P=It.useMemo(()=>({open:h}),[h]),g=It.useCallback(D=>{b&&D.preventDefault(),_optionalChain([c, 'optionalCall', _101 => _101(D)])},[b,c]),S=It.useCallback(D=>{if(_optionalChain([f, 'optionalCall', _102 => _102(D)]),!D.defaultPrevented&&b)if(h)b.closeCombobox();else{if((b.multiple?b.values.length>0:b.value!=null)&&!b.multiple){let v=Ur(b.value,b.itemToStringValue),l=_nullishCoalesce(b.itemTextRegistry.get(v), () => (Wr(b.value,b.itemToStringLabel)));b.onInputValueChange(l)}b.openCombobox()}},[f,b,h]),M=q(),L=W(M,"icon");return _userender.useRender.call(void 0, {render:t,ref:r,state:P,stateAttributesMapping:ea,props:{...p,...L?{[L]:""}:{},className:s,style:n,children:i,onPointerDown:g,onClick:S},defaultTagName:"span"})});var na={first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null},ra= exports.U =ot.forwardRef(function(o,r){let{render:t,className:s,style:n,children:i,...c}=o,{store:f}=_chunkXMZZ62VJcjs.p.call(void 0, ),p=ot.useId(),[a,h]=ot.useState(null);ot.useLayoutEffect(()=>{if(a)return f.registerRow(p,a,{kind:"empty"})},[a,p,f]);let b=q(),P=W(b,"empty"),g=lo(),S=g?g.isRootLoading||g.isAnyLoading&&g.searchQuery.length>0:!1,M=f.useState("hasSearchWithNoResults"),L=!S&&M,D=f.useState("isFirstRow",p),I=f.useState("isLastRow",p),v=ot.useMemo(()=>({first:D,last:I}),[D,I]),u=_userender.useRender.call(void 0, {render:t,ref:[h,r],state:v,stateAttributesMapping:na,props:{...c,...P?{[P]:""}:{},role:"presentation",className:s,style:n,children:i},defaultTagName:"div"});return L?u:null});var aa=Ve.forwardRef(function(o,r){let{value:t,onValueChange:s,hideUntilActive:n=!1,backspaceGoesBack:i=!1,disabled:c=!1,render:f,className:p,style:a,onKeyDown:h,onPointerDown:b,...P}=o,{store:g,surfaceId:S}=_chunkXMZZ62VJcjs.p.call(void 0, ),{depth:M,closeAll:L}=_chunkXMZZ62VJcjs.j.call(void 0, ),D=je(),I=ct(),{disabled:v}=Te(),u=v||c,l=Pe(),d=Ve.useRef(null),R=g.useState("search"),x=g.useState("highlightedId"),w=g.context.listId,F=g.context.inputId;Ve.useEffect(()=>(g.setHideUntilActive(n),()=>g.setHideUntilActive(!1)),[g,n]);let T=g.useState("inputActive"),m=g.useState("pendingSearch"),O=!n||T;Ve.useEffect(()=>{if(O)return g.setHasInput(!0),()=>g.setHasInput(!1)},[g,O]);let N=t!==void 0?t:R;Ve.useEffect(()=>{m&&d.current&&(g.setSearch(m),_optionalChain([s, 'optionalCall', _103 => _103(m)]),g.setPendingSearch(""),d.current.focus())},[m,g,s]);let A=Ve.useCallback(H=>{let ne=H.target.value;g.setSearch(ne),_optionalChain([s, 'optionalCall', _104 => _104(ne)])},[s,g]),y=Ve.useCallback(H=>{_optionalChain([b, 'optionalCall', _105 => _105(H)]),!u&&l.state.ownerId!==S&&l.setOwnerId(S)},[b,u,l,S]),{handleKeyDown:k}=ho({store:g,surfaceId:S,focusOwnerStore:l,depth:M,submenuContext:D,subpageContext:I,enabled:!0,disabled:u,enableTypeToSearch:!1,onKeyDown:h,closeAll:L}),j=Ve.useCallback(H=>{if(i&&H.key==="Backspace"&&!H.repeat&&!H.nativeEvent.isComposing&&H.keyCode!==229&&N===""&&I&&I.goBack()){H.preventDefault(),I.parentSurfaceId&&l.setOwnerId(I.parentSurfaceId);return}k(H)},[i,N,I,l,k]),E=Ve.useMemo(()=>({active:T}),[T]),U=q(),$=W(U,"input"),re=_userender.useRender.call(void 0, {render:f,ref:[d,r],state:E,props:{...P,...$?{[$]:""}:{},id:F,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":!0,"aria-controls":w,"aria-activedescendant":_nullishCoalesce(x, () => (void 0)),autoComplete:"off",autoCorrect:"off",spellCheck:!1,disabled:u,className:p,style:a,value:N,onChange:A,onKeyDown:j,onPointerDown:y},defaultTagName:"input"});return O?re:null});var ia={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},zn= exports.W =qo.forwardRef(function(o,r){let{render:t,className:s,style:n,children:i,...c}=o,{store:f}=_chunkXMZZ62VJcjs.p.call(void 0, ),p=_chunkXMZZ62VJcjs.e.call(void 0, ),a=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _106 => _106.groupId]), () => ("")),h=f.useState("isFirstGroup",a),b=f.useState("isLastGroup",a),P=f.useState("isFirstRow",a),g=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _107 => _107.positional, 'optionalAccess', _108 => _108.firstGroup]), () => (h)),S=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _109 => _109.positional, 'optionalAccess', _110 => _110.lastGroup]), () => (b)),M=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _111 => _111.positional, 'optionalAccess', _112 => _112.first]), () => (P)),L=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _113 => _113.positional, 'optionalAccess', _114 => _114.last]), () => (!1)),D=qo.useMemo(()=>({first:M,last:L,firstGroup:g,lastGroup:S}),[M,L,g,S]),I=q(),v=W(I,"group-label");return _userender.useRender.call(void 0, {render:t,ref:r,state:D,stateAttributesMapping:ia,props:{...c,...v?{[v]:""}:{},role:"presentation","aria-hidden":"true",className:s,style:n,children:i},defaultTagName:"div"})});function Wo(e,o=!0,r=!0){let t=[];for(let s of e)if(s.def.kind!=="separator"){if(s.def.kind==="group"){t.push(...Wo(pt(s),o,r));continue}if(s.def.kind==="radio-group"){if(s.def.hidden)continue;t.push(...Wo(pt(s),o,r));continue}if(s.def.kind==="submenu"||s.def.kind==="subpage"){if(s.def.hidden)continue;let n=_nullishCoalesce(s.def.includeInDeepSearch, () => (o)),i=r&&n===!0&&s.def.deepSearch!==!1;s.def.asyncNodes&&i&&t.push({id:s.id,node:s,config:s.def.asyncNodes}),i&&t.push(...Wo(pt(s),o,!0))}}return t}function Uo(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 Qn(e,o=!0,r=!0){let t=new Set,s=[];for(let n of Wo(e,o,r))t.has(n.id)||(t.add(n.id),s.push(n));return s}function $r({resolver:e,content:o,asyncContent:r,coordinator:t,graftParent:s,isSubpageSurface:n,isResolutionRoot:i,includeInDeepSearch:c}){Ze.useMemo(()=>{!e||n||(s?e.graft(s,o):i&&e.setContent(o))},[e,o,s,n,i]);let f=Ze.useMemo(()=>n&&e?o.map(M=>e.getNodeForDef(M)).filter(M=>M!==void 0):[],[n,e,o]),p=n?_nullishCoalesce(_nullishCoalesce(s, () => (_optionalChain([f, 'access', _117 => _117[0], 'optionalAccess', _118 => _118.parent]))), () => (null)):null,[a,h]=Ze.useState(0),b=Ze.useMemo(()=>n?_nullishCoalesce(_optionalChain([p, 'optionalAccess', _119 => _119.children]), () => (f)):s?s.children:i&&e?e.rootNodes:[],[n,p,f,s,e,i,o,a]),P=Ze.useMemo(()=>Qn(b,c),[b,c]),g=Ze.useRef(new Set);return Ze.useEffect(()=>{if(!e||!t||n&&!p)return;let M=new Map(t.getAsyncNodes().filter(u=>u.kind==="branch").map(u=>[u.id,u.nodes])),L=!1,D=(u,l)=>{if(!u)return;let d=u.children;e.graft(u,l),L||=d!==u.children},I=_optionalChain([t, 'access', _120 => _120.getAsyncNodes, 'call', _121 => _121(), 'access', _122 => _122.find, 'call', _123 => _123(u=>u.kind==="root"), 'optionalAccess', _124 => _124.nodes]);if(n&&p){let u=_nullishCoalesce(p.def.nodes, () => ([]));D(p,I?r?I:[...u,...I]:u)}else{let u=I?r?I:[...o,...I]:o;if(s)D(s,u);else if(i){let l=e.rootNodes;e.setContent(u),L||=l!==e.rootNodes}}let v=new Set(P.map(u=>u.node));for(let u of g.current)v.has(u)||D(u,_nullishCoalesce(u.def.nodes, () => ([])));g.current=v;for(let u of P){let l=M.get(u.id),d=_nullishCoalesce(u.node.def.nodes, () => ([]));D(u.node,l?[...d,...l]:d)}L&&h(u=>u+1)},[e,_optionalChain([t, 'optionalAccess', _125 => _125.loaders]),_optionalChain([t, 'optionalAccess', _126 => _126.erroredLoaders]),_optionalChain([t, 'optionalAccess', _127 => _127.root]),o,r,P,s,n,p,i]),{nodes:Ze.useMemo(()=>n?_nullishCoalesce(_optionalChain([p, 'optionalAccess', _128 => _128.children]), () => (f)):s?s.children:i&&e?e.rootNodes:[],[n,p,f,s,e,i,o,a]),graftVersion:a,asyncSubmenus:P}}function ca(e){return e}function Ro(e){return"kind"in e&&e.kind==="group"}function So(e){return"kind"in e&&e.kind==="radio-group"}function Po(e){return"kind"in e&&e.kind==="separator"}function pa(e){return"kind"in e&&e.kind==="row"}function Zo(e){let o=[];for(let r of e)be(r,"tree-item")||be(r,"item")||be(r,"submenu")?o.push(r):process.env.NODE_ENV!=="production"&&console.warn(`Unsupported ${r.kind} child skipped inside tree-item.`);return o}function ht(e,o={}){let{deep:r=!1,includeInDeepSearch:t=!0,descendantsIncluded:s=!0,breadcrumbs:n=[],group:i=null,radioGroup:c=null,inheritedKeywords:f=[]}=o,p=[];for(let a of e)if(!be(a,"separator")){if(be(a,"group")){let h={id:a.def.id,label:a.def.label,groupDef:a.def,menuNode:a};p.push(...ht(a.children,{deep:r,includeInDeepSearch:t,descendantsIncluded:s,breadcrumbs:n,group:h,radioGroup:null,inheritedKeywords:f}));continue}if(be(a,"radio-group")){if(a.def.hidden)continue;let h={id:a.def.id,label:a.def.label,radioGroupDef:a.def,menuNode:a};p.push(...ht(a.children,{deep:r,includeInDeepSearch:t,descendantsIncluded:s,breadcrumbs:n,group:null,radioGroup:h,inheritedKeywords:f}));continue}if(ze(a)&&!a.def.hidden){if(be(a,"item")||be(a,"radio-item")||be(a,"checkbox-item")){p.push({node:a,breadcrumbs:n,group:i,radioGroup:c,inheritedKeywords:f});continue}if(be(a,"tree-item")){if(a.def.selectable!==!1&&p.push({node:a,breadcrumbs:n,group:i,radioGroup:c,inheritedKeywords:f}),a.children.length&&a.def.deepSearch!==!1){let h={node:a.def,menuNode:a,value:a.def.value,id:a.def.id};p.push(...ht(Zo(a.children),{deep:r,includeInDeepSearch:t,descendantsIncluded:s,breadcrumbs:[...n,h],group:i,radioGroup:c,inheritedKeywords:[...f,a.def.value]}))}continue}if(be(a,"submenu")||be(a,"subpage")){let h=_nullishCoalesce(a.def.includeInDeepSearch, () => (t));if((!r||s&&h!==!1)&&p.push({node:a,breadcrumbs:n,group:i,radioGroup:c,inheritedKeywords:f}),r&&s&&h===!0&&a.def.deepSearch!==!1&&a.children.length){let g={node:a.def,menuNode:a,value:a.def.value,id:a.def.id},S=[...n,g];p.push(...ht(a.children.filter(M=>M.kind==="tree-item"?(process.env.NODE_ENV!=="production"&&console.warn("Unsupported tree-item child skipped inside submenu/subpage."),!1):!0),{deep:r,includeInDeepSearch:t,descendantsIncluded:!0,breadcrumbs:S,group:null,radioGroup:null,inheritedKeywords:f}))}}}}return p}function Kn(e,o,r,t,s,n,i){let c=Zo(e.children).filter(b=>!b.def.hidden),f={depth:t,hasChildren:c.length>0,isLastChild:i,ancestorsLast:s,header:e.def.selectable===!1},p=[{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:f}}],a={node:e.def,menuNode:e,value:e.def.value,id:e.def.id},h=[...n,a];return c.forEach((b,P)=>{let g=P===c.length-1;if(be(b,"tree-item")){p.push(...Kn(b,o,r,t+1,[...s,i],h,g));return}p.push({kind:"row",node:b,context:{search:null,breadcrumbs:h,isDeepSearchResult:!1,highlighted:b.def.id===o,disabled:_nullishCoalesce(b.def.disabled, () => (!1)),group:r,tree:{depth:t+1,hasChildren:be(b,"submenu")&&b.children.length>0,isLastChild:g,ancestorsLast:[...s,i],header:!1}}})}),p}function qn(e,o){let r=[];for(let t of e){if(be(t,"separator")){r.push({kind:"separator",node:t});continue}if(be(t,"group")){let n=[],i=t.children.filter(c=>ze(c)&&!c.def.hidden);for(let c of t.children){if(be(c,"separator")||be(c,"group")||be(c,"radio-group")||!ze(c)||c.def.hidden)continue;if(be(c,"tree-item")){n.push(...Kn(c,o,{id:t.def.id,label:t.def.label},0,[],[],c===i.at(-1)));continue}let f={search:null,breadcrumbs:[],isDeepSearchResult:!1,highlighted:c.def.id===o,disabled:_nullishCoalesce(c.def.disabled, () => (!1)),group:{id:t.def.id,label:t.def.label},tree:null};n.push({kind:"row",node:c,context:f})}if(n.length>0){let c={search:null,matchCount:n.length,breadcrumbs:[],isDeepSearchResult:!1};r.push({kind:"group",node:t,context:c,items:n,bestScore:1})}continue}if(be(t,"radio-group")){if(t.def.hidden)continue;let n=[];for(let i of t.children){if(!ze(i)||i.def.hidden)continue;let c={search:null,breadcrumbs:[],isDeepSearchResult:!1,highlighted:i.def.id===o,disabled:_nullishCoalesce(i.def.disabled, () => (!1)),group:null,tree:null};n.push({kind:"row",node:i,context:c,radioGroup:{id:t.def.id,label:t.def.label}})}if(n.length>0){let i={search:null,matchCount:n.length,breadcrumbs:[],isDeepSearchResult:!1};r.push({kind:"radio-group",node:t,context:i,items:n,bestScore:1})}continue}if(!ze(t)||t.def.hidden)continue;if(be(t,"tree-item")){let n=e.filter(i=>ze(i)&&!i.def.hidden);r.push(...Kn(t,o,null,0,[],[],t===n.at(-1)));continue}let s={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:s})}return r}function Wn(e,o,r){return e.map(t=>{let s=t.breadcrumbs.length>0,n={search:o?{query:o,score:t.score}:null,breadcrumbs:t.breadcrumbs,isDeepSearchResult:s,highlighted:t.node.def.id===r,disabled:_nullishCoalesce(t.node.def.disabled, () => (!1)),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 xo(e,o,r){let t=e.breadcrumbs.length>0,s={search:o?{query:o,score:e.score}:null,breadcrumbs:e.breadcrumbs,isDeepSearchResult:t,highlighted:e.node.def.id===r,disabled:_nullishCoalesce(e.node.def.disabled, () => (!1)),group:e.group?{id:e.group.id,label:e.group.label}:null,tree:null};return{kind:"row",node:e.node,context:s,radioGroup:e.radioGroup?{id:e.radioGroup.id,label:e.radioGroup.label}:void 0}}function $o(e,o,r=_chunkXMZZ62VJcjs.r){let t=r(o);if(!t)return e.map(({node:n,breadcrumbs:i,group:c,radioGroup:f})=>({node:n,score:1,breadcrumbs:i,group:c,radioGroup:f}));let s=[];for(let{node:n,breadcrumbs:i,group:c,radioGroup:f,inheritedKeywords:p}of e){let a=_chunkXMZZ62VJcjs.r.call(void 0, n.def.value),h=[..._nullishCoalesce(n.def.keywords, () => ([])),...p].map(g=>_chunkXMZZ62VJcjs.r.call(void 0, g)).filter(Boolean),b=_chunkXMZZ62VJcjs.w.call(void 0, a,t,h.length>0?h:void 0),P=_nullishCoalesce(n.def.forceScore, () => (b));P>0&&s.push({node:n,score:P,breadcrumbs:i,group:c,radioGroup:f})}return s}function Dt(e){return _nullishCoalesce(e.forceOrder, () => (0))}function Qt(e,o){let r=Dt(e.node.def)-Dt(o.node.def);return r!==0?r:o.score-e.score}function Un(e){return e==="submenu"||e==="subpage"?1:0}function Zn(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 Yo(e){if(e.length===0)return 0;let o=Number.POSITIVE_INFINITY;for(let r of e){let t=Dt(r.node.def);t<o&&(o=t)}return o===Number.POSITIVE_INFINITY?0:o}function $n(e){return[...e].sort(Qt)}function Yn(e){let o=new Map;for(let s of e){let n=Dt(s.node.def),i=_nullishCoalesce(o.get(n), () => ({items:[],branches:[]}));s.node.kind==="item"||s.node.kind==="radio-item"||s.node.kind==="checkbox-item"||s.node.kind==="tree-item"?i.items.push(s):i.branches.push(s),o.set(n,i)}let r=[...o.keys()].sort((s,n)=>s-n),t=[];for(let s of r){let n=o.get(s);n&&t.push(...n.items,...n.branches)}return t}function Xn(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 Yr=e=>e;function la(e){let{query:o,normalizeQuery:r,nodes:t,highlightedId:s,deepSearch:n=!0,includeInDeepSearch:i=!0,minLength:c=0,radioGroupSearchBehavior:f="preserve"}=e,p=n&&o.length>=c,a=ht(t,{deep:p,includeInDeepSearch:i}),h=new Map;if(f==="preserve-show-all"){for(let u of a)if(u.radioGroup){let l=h.get(u.radioGroup.id);l?l.items.push(u):h.set(u.radioGroup.id,{radioGroupDef:u.radioGroup.radioGroupDef,menuNode:u.radioGroup.menuNode,items:[u],breadcrumbs:u.breadcrumbs})}}let b=$o(a,o,r),P=new Map,g=[];for(let u of b)if(u.radioGroup)if(f==="flatten")g.push(u);else{let l=P.get(u.radioGroup.id);l?l.items.push(u):P.set(u.radioGroup.id,{radioGroupDef:u.radioGroup.radioGroupDef,menuNode:u.radioGroup.menuNode,items:[u],breadcrumbs:u.breadcrumbs})}else g.push(u);let S=$n(g),M=Yn(S),L=Xn(M),D=Wn(L,o,s),I=[];if(f!=="flatten")for(let[u,{items:l,breadcrumbs:d}]of P){let R;if(f==="preserve-show-all"){let T=h.get(u);if(T){let m=new Map(l.map(O=>[O.node.id,O.score]));R=T.items.map(O=>({node:O.node,score:_nullishCoalesce(m.get(O.node.id), () => (0)),breadcrumbs:O.breadcrumbs,group:O.group,radioGroup:O.radioGroup}))}else R=l}else R=l;R.sort(Qt);let x=Math.max(...R.map(T=>T.score),0),w=d.length>0,F={search:o?{query:o,bestScore:x}:null,matchCount:l.length,breadcrumbs:d,isDeepSearchResult:w};I.push({kind:"radio-group",node:P.get(u).menuNode,context:F,items:R.map(T=>xo(T,o,s)),bestScore:x})}let v=[...D.map(u=>({node:u,score:_nullishCoalesce(_optionalChain([u, 'access', _129 => _129.context, 'access', _130 => _130.search, 'optionalAccess', _131 => _131.score]), () => (0)),forceOrder:Dt(u.node.def),kindRank:Un(u.node.kind)})),...I.map(u=>({node:u,score:u.bestScore,forceOrder:Yo(u.items),kindRank:0}))];return v.sort(Zn),{displayNodes:v.map(u=>u.node),isDeepSearching:p}}function da(e){let{query:o,normalizeQuery:r,nodes:t,highlightedId:s,deepSearch:n=!0,includeInDeepSearch:i=!0,minLength:c=0,sortGroups:f=!0,radioGroupSearchBehavior:p="preserve"}=e,a=n&&o.length>=c,h=ht(t,{deep:a,includeInDeepSearch:i}),b=new Map;if(p==="preserve-show-all"){for(let u of h)if(u.radioGroup){let l=b.get(u.radioGroup.id);l?l.items.push(u):b.set(u.radioGroup.id,{radioGroupDef:u.radioGroup.radioGroupDef,menuNode:u.radioGroup.menuNode,items:[u],breadcrumbs:u.breadcrumbs})}}let P=$o(h,o,r),g=new Map,S=new Map,M=[];for(let u of P)if(u.radioGroup)if(p==="flatten")M.push(u);else{let l=S.get(u.radioGroup.id);l?l.items.push(u):S.set(u.radioGroup.id,{radioGroupDef:u.radioGroup.radioGroupDef,menuNode:u.radioGroup.menuNode,items:[u],breadcrumbs:u.breadcrumbs})}else if(u.group){let l=g.get(u.group.id);l?l.items.push(u):g.set(u.group.id,{groupDef:u.group.groupDef,menuNode:u.group.menuNode,items:[u],breadcrumbs:u.breadcrumbs})}else M.push(u);let L=[];for(let[u,{items:l,breadcrumbs:d}]of g){l.sort(Qt);let R=Math.max(...l.map(F=>F.score),0),x=d.length>0,w={search:o?{query:o,bestScore:R}:null,matchCount:l.length,breadcrumbs:d,isDeepSearchResult:x};L.push({kind:"group",node:g.get(u).menuNode,context:w,items:l.map(F=>xo(F,o,s)),bestScore:R})}let D=[];if(p!=="flatten")for(let[u,{items:l,breadcrumbs:d}]of S){let R;if(p==="preserve-show-all"){let T=b.get(u);if(T){let m=new Map(l.map(O=>[O.node.id,O.score]));R=T.items.map(O=>({node:O.node,score:_nullishCoalesce(m.get(O.node.id), () => (0)),breadcrumbs:O.breadcrumbs,group:O.group,radioGroup:O.radioGroup}))}else R=l}else R=l;R.sort(Qt);let x=Math.max(...R.map(T=>T.score),0),w=d.length>0,F={search:o?{query:o,bestScore:x}:null,matchCount:l.length,breadcrumbs:d,isDeepSearchResult:w};D.push({kind:"radio-group",node:S.get(u).menuNode,context:F,items:R.map(T=>xo(T,o,s)),bestScore:x})}let I=M.sort(Qt).map(u=>xo(u,o,s)),v=[...L.map(u=>({node:u,score:u.bestScore,forceOrder:Yo(u.items),kindRank:0})),...D.map(u=>({node:u,score:u.bestScore,forceOrder:Yo(u.items),kindRank:0})),...I.map(u=>({node:u,score:_nullishCoalesce(_optionalChain([u, 'access', _132 => _132.context, 'access', _133 => _133.search, 'optionalAccess', _134 => _134.score]), () => (0)),forceOrder:Dt(u.node.def),kindRank:Un(u.node.kind)}))];return f&&v.sort(Zn),{displayNodes:v.map(u=>u.node),isDeepSearching:a}}function _n(e){let{query:o,nodes:r,highlightedId:t,groupSearchBehavior:s="preserve"}=e,i=(_nullishCoalesce(e.normalizeQuery, () => ((0, _chunkXMZZ62VJcjs.r))))(o),c=i===o?{...e,normalizeQuery:Yr}:{...e,query:i,normalizeQuery:Yr};return i?s==="preserve"?da(c):la(c):{displayNodes:qn(r,t),isDeepSearching:!1}}function Jn(e,o,r,t,s){if(!o&&!r)return null;let n=`${e}-label`;return r?_jsxruntime.jsx.call(void 0, _.Fragment,{children:r({node:t,props:{id:n},context:s})},n):_jsxruntime.jsx.call(void 0, zn,{id:n,children:o},n)}function fa(e){let o=[];for(let r of e)if(Ro(r))for(let t of r.items)!t.node.def.disabled&&t.node.id&&o.push(t.node.id);else if(So(r))for(let t of r.items)!t.node.def.disabled&&t.node.id&&o.push(t.node.id);else Po(r)||!r.node.def.disabled&&r.node.id&&o.push(r.node.id);return o}function ma(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 er(e){return e.map(o=>_nullishCoalesce(o.id, () => (o.value))).join(">")}function Xr(e){return Ro(e)?`group:${e.node.def.id}:${er(e.context.breadcrumbs)}`:So(e)?`radio-group:${e.node.def.id}:${er(e.context.breadcrumbs)}`:Po(e)?`separator:${_nullishCoalesce(e.node.def.id, () => ("separator"))}`:`row:${e.node.def.kind}:${_nullishCoalesce(e.node.def.id, () => (""))}:${e.node.def.value}:${er(e.context.breadcrumbs)}`}var ga=e=>e;function ba(e,o){let r=e.map(a=>[Xr(a),a]),t=new Map(r),s=r.map(([a])=>a),n=o.filter(a=>t.has(a)),i=new Set(n),c=s.filter(a=>!i.has(a)),f=[...n,...c];return{orderedNodes:f.map(a=>t.get(a)).filter(a=>a!==void 0),nextOrder:f}}function ha(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 tr(e,o){let r=_nullishCoalesce(e.minQueryLength, () => (1)),t=ha(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 Ra({info:e,query:o,enabled:r}){let t=kt(),{config:s,id:n}=e,i=s.Loader,c=_.useMemo(()=>s.type!=="query"?null:tr(s,o),[s,o]),f=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _135 => _135.effectiveQuery]), () => (o)),p=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _136 => _136.enabled]), () => (!0));return r||Uo(s)?_jsxruntime.jsx.call(void 0, i,{query:f,enabled:p,children:h=>_jsxruntime.jsx.call(void 0, _r,{kind:"branch",id:n,config:s,result:h,coordinator:t})}):null}function _r({kind:e,id:o,config:r,result:t,coordinator:s}){let n=_.useRef(r),i=_.useRef(s),c=_.useRef(t),f=_.useRef(null);return n.current=r,i.current=s,c.current=t,_.useEffect(()=>{let p=i.current;if(p)return e==="root"?p.registerRootLoader({config:n.current,result:c.current}):p.registerLoader({id:o,config:n.current,result:c.current}),()=>{e==="root"?p.unregisterRootLoader():p.unregisterLoader(o)}},[e,o]),_.useEffect(()=>{let p=i.current;if(!p)return;let a=f.current;(a===null||a.data!==t.data||a.status!==t.status||a.fetchStatus!==t.fetchStatus||a.loadingPhase!==t.loadingPhase||a.isLoading!==t.isLoading||a.isFetching!==t.isFetching||a.isInitialLoading!==t.isInitialLoading||a.isRefetching!==t.isRefetching||a.isPending!==t.isPending||a.isSuccess!==t.isSuccess||a.isError!==t.isError||a.isPaused!==t.isPaused||a.hasData!==t.hasData||a.hasFetched!==t.hasFetched||a.error!==t.error)&&(f.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"?p.updateRootLoaderResult(t):p.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 Sa({query:e}){let o=Gn(),r=kt(),{asyncContent:t}=o,s=_.useMemo(()=>_optionalChain([t, 'optionalAccess', _137 => _137.type])!=="query"?null:tr(t,e),[t,e]),n=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _138 => _138.effectiveQuery]), () => (e)),i=_nullishCoalesce(_optionalChain([s, 'optionalAccess', _139 => _139.enabled]), () => (!0));if(!t)return null;let c=t.Loader;return _jsxruntime.jsx.call(void 0, c,{query:n,enabled:i,children:f=>_jsxruntime.jsx.call(void 0, _r,{kind:"root",config:t,result:f,coordinator:r})})}var Jr=_.forwardRef(function(o,r){let{children:t,content:s,asyncContent:n,deepSearchConfig:i,includeInDeepSearch:c,search:f,normalizedSearch:p,store:a,label:h="Menu",remeasureDependencies:b,...P}=o,g=Qo(),{setResolvedNodes:S}=Go(),M=Gr(),{depth:L}=_chunkXMZZ62VJcjs.j.call(void 0, ),D=ct(),I=ro(),v=!!(D&&_optionalChain([I, 'optionalAccess', _140 => _140.getSurfaceId, 'call', _141 => _141(D.pageId)])),u=L===0&&!v,l=kt(),d=_nullishCoalesce(i.minLength, () => (0)),R=i.enabled!==!1&&p.length>=d,{nodes:x,graftVersion:w,asyncSubmenus:F}=$r({resolver:g,content:s,asyncContent:n,coordinator:l,graftParent:M,isSubpageSurface:v,isResolutionRoot:u,includeInDeepSearch:c}),T=R||F.some(Q=>Uo(Q.config))||n&&n.loadStrategy==="eager";_.useEffect(()=>{v||S({nodes:x,graftVersion:w,content:s})},[v,S,x,w,s]);let m=_.useRef(0);_.useEffect(()=>{!v||w===0||m.current!==w&&(m.current=w,S(Q=>Q&&{...Q,graftVersion:Q.graftVersion+1}))},[v,S,w]);let O=_.useRef(null),{displayNodes:G,isDeepSearching:N}=_.useMemo(()=>{let Q=_n({query:p,normalizeQuery:ga,nodes:x,highlightedId:null,deepSearch:i.enabled,includeInDeepSearch:c,minLength:i.minLength,groupSearchBehavior:i.groupSearchBehavior,radioGroupSearchBehavior:i.radioGroupSearchBehavior,sortGroups:i.sortGroups}),V=_nullishCoalesce(i.asyncResultBehavior, () => ("stream")),C=F.length+(n?1:0),K=C>0,B=V==="block"&&Q.isDeepSearching&&K&&l!==null&&(l.loaders.size+(l.root?1:0)<C||l.isAnyLoading),X=Q.displayNodes;if(B)O.current=null,X=[];else if(V==="stream"&&Q.isDeepSearching){let te=O.current;if(!te||te.query!==p)O.current={query:p,order:X.map(Xr)};else{let{orderedNodes:J,nextOrder:fe}=ba(X,te.order);X=J,O.current={query:p,order:fe}}}else O.current=null;return{displayNodes:X,isDeepSearching:Q.isDeepSearching}},[p,x,w,i,c,F.length,n,l,_optionalChain([l, 'optionalAccess', _142 => _142.isAnyLoading]),_optionalChain([l, 'optionalAccess', _143 => _143.loaders])]),A=_.useRef([]),y=_.useRef(null),k=_.useRef("replace"),j=_.useMemo(()=>fa(G),[G]),E=_.useMemo(()=>{let Q=A.current,V=j;if(Q.length!==V.length||Q.some((K,B)=>K!==V[B])){let B=(_nullishCoalesce(i.asyncResultBehavior, () => ("stream")))==="stream"&&N&&y.current===p&&ma(Q,V);return k.current=B?"append":"replace",A.current=V,y.current=p,V}return Q},[j,i.asyncResultBehavior,N,p]);_.useEffect(()=>{a.setOrderedItems(E,{reason:k.current})},[a,E]);let U=_.useCallback(Q=>{let V=Q.node,C=V.def,{context:K}=Q,B=V.id,X=te=>{if(!te.def.asyncNodes||!l)return;let J=l.loaders.get(te.id);if(!J)return;let fe=te.def.asyncNodes.type==="query"?tr(te.def.asyncNodes,p).isBelowMinLength:!1;return{status:J.result.status,fetchStatus:J.result.fetchStatus,loadingPhase:J.result.loadingPhase,isLoading:J.result.isLoading,isFetching:J.result.isFetching,isInitialLoading:J.result.isInitialLoading,isRefetching:J.result.isRefetching,isError:J.result.isError,error:J.result.error,isBelowMinLength:fe}};if(C.kind==="item")return _jsxruntime.jsx.call(void 0, _.Fragment,{children:C.render({node:V,props:{id:B,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1)),closeOnClick:C.closeOnClick,onSelect:C.onSelect,shortcut:C.shortcut,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...K,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1))}})},B);if(C.kind==="tree-item")return _jsxruntime.jsx.call(void 0, _.Fragment,{children:C.render({node:V,props:{id:B,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1)),selectable:C.selectable!==!1,closeOnClick:C.closeOnClick,onSelect:C.onSelect,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...K,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1))}})},B);if(C.kind==="radio-item")return _jsxruntime.jsx.call(void 0, _.Fragment,{children:C.render({node:V,props:{id:B,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1)),closeOnClick:C.closeOnClick,onSelect:C.onSelect,shortcut:C.shortcut,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...K,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1))}})},B);if(C.kind==="checkbox-item")return _jsxruntime.jsx.call(void 0, _.Fragment,{children:C.render({node:V,props:{id:B,value:C.value,checked:C.checked,onCheckedChange:C.onCheckedChange,disabled:_nullishCoalesce(C.disabled, () => (!1)),closeOnClick:C.closeOnClick,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...K,value:C.value,checked:C.checked,disabled:_nullishCoalesce(C.disabled, () => (!1))}})},B);if(C.kind==="submenu"){let te=X(V),J=pt(V),fe={node:C,menuNode:V,value:C.value,id:C.id},Oe=Ke=>{let me=Ke,ie=Ke.def;if(ie.kind==="separator")return null;if(ie.kind==="group"){let $e=me.children.filter(Ce=>ze(Ce)&&(Ce.kind==="item"||Ce.kind==="checkbox-item"||Ce.kind==="submenu"||Ce.kind==="subpage")&&!Ce.def.hidden);if($e.length===0)return null;let we=$e.map(Ce=>{let Z={search:null,breadcrumbs:[...K.breadcrumbs,fe],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(Ce.def.disabled, () => (!1)),group:{id:ie.id,label:ie.label},tree:null};return U({kind:"row",node:Ce,context:Z})});if(ie.render){let Ce={search:null,matchCount:$e.length,breadcrumbs:[...K.breadcrumbs,fe],isDeepSearchResult:!1};return _jsxruntime.jsx.call(void 0, _.Fragment,{children:ie.render({node:me,props:{},context:{...Ce,label:ie.label},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:we})})},ie.id)}return _jsxruntime.jsx.call(void 0, "div",{role:"group","aria-label":ie.label,children:we},ie.id)}if(ie.kind==="radio-group")return $(me,[...K.breadcrumbs,fe]);if(ie.kind!=="item"&&ie.kind!=="checkbox-item"&&ie.kind!=="submenu"&&ie.kind!=="subpage")return null;let Ee={search:null,breadcrumbs:[...K.breadcrumbs,fe],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(ie.disabled, () => (!1)),group:null,tree:null};return U({kind:"row",node:me,context:Ee})};return _jsxruntime.jsx.call(void 0, _.Fragment,{children:_jsxruntime.jsx.call(void 0, po.Provider,{value:V,children:C.render({node:V,props:{id:B,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1)),forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...K,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1)),async:te},nodes:J,asyncContent:C.asyncNodes,renderNode:Oe})})},B)}if(C.kind==="subpage"){let te=X(V),J=V.id;return _jsxruntime.jsx.call(void 0, _.Fragment,{children:C.renderTrigger({node:V,props:{id:B,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1)),targetPageId:J},context:{...K,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1)),async:te}})},B)}return null},[l,p,N]),$=_.useCallback((Q,V=[])=>{let C=Q.def,K=V.length>0,B={search:null,matchCount:C.nodes.length,breadcrumbs:V,isDeepSearchResult:K},X=Q.children.map(te=>{if(!ze(te)||te.def.hidden)return null;let J={search:null,breadcrumbs:V,isDeepSearchResult:K,highlighted:!1,disabled:_nullishCoalesce(te.def.disabled, () => (!1)),group:null,tree:null};return U({kind:"row",node:te,context:J,radioGroup:{id:C.id,label:C.label}})});return C.render?_jsxruntime.jsx.call(void 0, _.Fragment,{children:C.render({node:Q,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:X})})},C.id):_jsxruntime.jsxs.call(void 0, "div",{role:"radiogroup","aria-label":C.label,children:[Jn(C.id,C.label,C.renderLabel,Q,{...B,label:C.label,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1))}),X]},C.id)},[U]),re=_.useCallback(Q=>{if(Ro(Q)){let V=Q.node,{context:C,items:K}=Q,B=V.def,X=K.map(te=>U(te));return B.render?_jsxruntime.jsx.call(void 0, _.Fragment,{children:B.render({node:V,props:{},context:{...C,label:B.label},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:X})})},B.id):_jsxruntime.jsxs.call(void 0, "div",{role:"group","aria-label":B.label,children:[Jn(B.id,B.label,B.renderLabel,V,{...C,label:B.label}),X]},B.id)}if(So(Q)){let V=Q.node,{context:C,items:K}=Q,B=V.def,X=K.map(te=>U(te));return B.render?_jsxruntime.jsx.call(void 0, _.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:X})})},B.id):_jsxruntime.jsxs.call(void 0, "div",{role:"radiogroup","aria-label":B.label,children:[Jn(B.id,B.label,B.renderLabel,V,{...C,label:B.label,value:B.value,disabled:_nullishCoalesce(B.disabled, () => (!1))}),X]},B.id)}if(Po(Q)){let V=Q.node.def;return V.render?_jsxruntime.jsx.call(void 0, _.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(Q)},[U]),H=_.useMemo(()=>l?l.getAsyncState():{isLoading:!1,isFetching:!1,isInitialLoading:!1,isRefetching:!1,isAllRefetching:!1,isStaticLoading:!1,isStaticInitialLoading:!1,isStaticRefetching:!1,isQueryLoading:!1,isQueryInitialLoading:!1,isQueryRefetching:!1,skippedMenus:[]},[l,_optionalChain([l, 'optionalAccess', _144 => _144.loaders]),_optionalChain([l, 'optionalAccess', _145 => _145.erroredLoaders]),_optionalChain([l, 'optionalAccess', _146 => _146.root])]),ne=_.useMemo(()=>({search:f,nodes:G,renderNode:re,count:G.length,isDeepSearching:N,async:H}),[f,G,re,N,H]);return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[T&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, Sa,{query:p}),F.map(Q=>_jsxruntime.jsx.call(void 0, Ra,{info:Q,query:p,enabled:R},Q.id))]}),_jsxruntime.jsx.call(void 0, co.Provider,{value:ne,children:_jsxruntime.jsx.call(void 0, or,{ref:r,label:h,...P,remeasureDependencies:[N,..._nullishCoalesce(b, () => ([]))],children:t})})]})});var nr=(o=>(o.rowWidth="--row-width",o))(nr||{});var or=Me.forwardRef(function(o,r){let{children:t,label:s="Suggestions",measureRowWidth:n=!0,maxRowWidth:i,scrollContainerRef:c,remeasureDependencies:f,render:p,className:a,style:h,onKeyDown:b,onPointerDown:P,...g}=o,{store:S,surfaceId:M}=_chunkXMZZ62VJcjs.p.call(void 0, ),{depth:L,closeAll:D}=_chunkXMZZ62VJcjs.j.call(void 0, ),I=je(),v=ct(),{disabled:u}=Te(),l=Pe(),d=Ht(),R=Me.useRef(null),x=Me.useRef(null);Me.useEffect(()=>{S.setListRef(R)},[S]),Me.useEffect(()=>{if(c)return S.setListScrollContainerRef(c),()=>{S.setListScrollContainerRef({current:null})}},[S,c]),Me.useLayoutEffect(()=>{if(!n||!R.current)return;let K=R.current.closest("[data-open]");x.current=K},[n]);let{queueMeasurement:w,resetMeasurements:F,clearMeasuredIds:T}=_chunkXMZZ62VJcjs.v.call(void 0, {listRef:R,targetRef:x,maxWidth:i,enabled:n}),m=Me.useRef(null),O=Me.useRef(!1);Me.useEffect(()=>{let K=_nullishCoalesce(m.current, () => ([])),B=O.current;if(m.current=_nullishCoalesce(f, () => (null)),O.current=!0,!n||!B)return;let X=_nullishCoalesce(f, () => ([]));if(K.length!==X.length||X.some((J,fe)=>!Object.is(J,K[fe]))){T();for(let[J,fe]of S.context.refs.itemRefs)fe.current&&w(fe.current,J)}}),Me.useEffect(()=>{if(n)return S.context.onCloseComplete=F,()=>{S.context.onCloseComplete=void 0}},[n,F,S]);let G=Me.useMemo(()=>n?{queueMeasurement:w}:null,[n,w]),N=S.useState("search"),A=S.useState("filteredCount"),y=S.useState("hasInput"),k=S.useState("highlightedId"),j=S.context.listId,E=!y&&!u,{handleKeyDown:U}=ho({store:S,surfaceId:M,focusOwnerStore:l,depth:L,submenuContext:I,subpageContext:v,enabled:E,disabled:u,enableTypeToSearch:!0,onKeyDown:b,closeAll:D}),$=Me.useCallback(K=>{K.target instanceof HTMLInputElement||K.preventDefault(),_optionalChain([P, 'optionalCall', _147 => _147(K)])},[P]),re=Me.useMemo(()=>({search:N,filteredCount:A}),[N,A]),H=typeof t=="function"?t(re):t,ne=G?_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.l.Provider,{value:G,children:H}):H,Q=_optionalChain([d, 'optionalAccess', _148 => _148.layout])==="input-embedded",V=q(),C=W(V,"list");return _userender.useRender.call(void 0, {render:p,ref:[R,r],props:{...g,...C?{[C]:""}:{},id:j,role:"listbox","aria-label":s,"aria-activedescendant":E?_nullishCoalesce(k, () => (void 0)):void 0,tabIndex:E?0:-1,"data-popup-menu-list":"","data-input-embedded":Q?"":void 0,className:a,style:h,onKeyDown:U,onPointerDown:$,children:ne},defaultTagName:"div"})}),xa= exports.ba =Me.forwardRef(function(o,r){let t=En(),{store:s}=_chunkXMZZ62VJcjs.p.call(void 0, ),n=s.useState("search"),i=s.useState("normalizedSearch");return t?_jsxruntime.jsx.call(void 0, Jr,{ref:r,...o,content:t.content,asyncContent:t.asyncContent,deepSearchConfig:t.deepSearchConfig,includeInDeepSearch:t.includeInDeepSearch,search:n,normalizedSearch:i,store:s}):_jsxruntime.jsx.call(void 0, or,{ref:r,...o})});var Ma={first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null},Ca= exports.ca =nt.forwardRef(function(o,r){let{forceMount:t=!1,render:s,className:n,style:i,children:c,...f}=o,{store:p}=_chunkXMZZ62VJcjs.p.call(void 0, ),a=nt.useId(),[h,b]=nt.useState(null);nt.useLayoutEffect(()=>{if(h)return p.registerRow(a,h,{kind:"loading"})},[h,a,p]);let P=q(),g=W(P,"loading"),S=lo(),M=S?S.isRootLoading||S.isAnyLoading&&S.searchQuery.length>0:!1,L=t||M,D=p.useState("isFirstRow",a),I=p.useState("isLastRow",a),v=nt.useMemo(()=>({first:D,last:I}),[D,I]),u=_userender.useRender.call(void 0, {render:s,ref:[b,r],state:v,stateAttributesMapping:Ma,props:{...f,...g?{[g]:""}:{},role:"presentation",className:n,style:i,children:c},defaultTagName:"div"});return L?u:null});var es={slot:"bazzaui-[component]-scroll-[up|down]-arrow",direction:"data-direction",side:"data-side"};var ka={direction:e=>e?{[es.direction]:String(e)}:null,visible:e=>({"data-visible":e?"true":"false"})},ts=ve.forwardRef(function(o,r){let{direction:t,keepMounted:s=!1,scrollSpeed:n=10,render:i,className:c,style:f,children:p,...a}=o,{store:h}=_chunkXMZZ62VJcjs.p.call(void 0, ),[b,P]=ve.useState(!1),g=ve.useRef(!1),S=ve.useRef(null),L=h.useState("openMethod")==="touch",D=ve.useCallback(()=>{if(L){P(!1);return}let F=_optionalChain([h, 'access', _149 => _149.context, 'access', _150 => _150.refs, 'access', _151 => _151.listRef, 'optionalAccess', _152 => _152.current]);if(!F){P(!1);return}if(t==="up")P(F.scrollTop>0);else{let T=F.scrollTop+F.clientHeight>=F.scrollHeight-1;P(!T)}},[h,t,L]);ve.useEffect(()=>{let F=_optionalChain([h, 'access', _153 => _153.context, 'access', _154 => _154.refs, 'access', _155 => _155.listRef, 'optionalAccess', _156 => _156.current]);if(!F)return;D(),F.addEventListener("scroll",D,{passive:!0});let T=new ResizeObserver(D);return T.observe(F),()=>{F.removeEventListener("scroll",D),T.disconnect()}},[h,D]);let I=h.useState("filteredCount");ve.useEffect(()=>{requestAnimationFrame(D)},[I,D]);let v=ve.useCallback(()=>{g.current=!0;let w=()=>{if(!g.current)return;let T=_optionalChain([h, 'access', _157 => _157.context, 'access', _158 => _158.refs, 'access', _159 => _159.listRef, 'optionalAccess', _160 => _160.current]);if(T){let m=t==="up"?-n:n;T.scrollTop+=m}S.current=requestAnimationFrame(w)};S.current=requestAnimationFrame(w)},[h,t,n]),u=ve.useCallback(()=>{g.current=!1,S.current&&(cancelAnimationFrame(S.current),S.current=null)},[]);ve.useEffect(()=>()=>{S.current&&cancelAnimationFrame(S.current)},[]);let l=ve.useMemo(()=>({direction:t,visible:b}),[t,b]),d=b||s,R=q(),x=W(R,t==="up"?"scroll-up-arrow":"scroll-down-arrow");return _userender.useRender.call(void 0, {render:i,ref:r,state:l,stateAttributesMapping:ka,props:{...a,...x?{[x]:""}:{},className:c,style:f,onPointerEnter:w=>{v(),_optionalChain([a, 'access', _161 => _161.onPointerEnter, 'optionalCall', _162 => _162(w)])},onPointerLeave:w=>{u(),_optionalChain([a, 'access', _163 => _163.onPointerLeave, 'optionalCall', _164 => _164(w)])},children:p},defaultTagName:"div",enabled:d})}),Ia= exports.da =ve.forwardRef(function(o,r){return _jsxruntime.jsx.call(void 0, ts,{ref:r,direction:"up",...o})}),Da= exports.ea =ve.forwardRef(function(o,r){return _jsxruntime.jsx.call(void 0, ts,{ref:r,direction:"down",...o})});var _useStableCallback = require('@base-ui/utils/useStableCallback');var ns="a[href], button, input, select, textarea, [tabindex]";function Xo(e){let o=Array.from(e.querySelectorAll(ns));return(e.matches(ns)?[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 La({children:e}){let{store:o}=_chunkXMZZ62VJcjs.p.call(void 0, ),r=o.useState("normalizedSearch");return _jsxruntime.jsx.call(void 0, Er,{searchQuery:r,children:e})}var Oa=ue.forwardRef(function(o,r){let{filter:t=_chunkXMZZ62VJcjs.x,normalizeSearch:s=_chunkXMZZ62VJcjs.r,search:n,onSearchChange:i,defaultSearch:c="",loop:f=!0,autoHighlightFirst:p=!0,clearSearchOnClose:a="after-exit",resetScrollOnSearch:h=!0,skipAutoFocus:b=!1,orderedItems:P,content:g,asyncContent:S,deepSearch:M,includeInDeepSearch:L=!0,render:D,className:I,style:v,onKeyDown:u,onFocus:l,onPointerDown:d,onPointerMove:R,children:x,...w}=o,F=ue.useMemo(()=>_optionalChain([g, 'optionalAccess', _165 => _165.map, 'call', _166 => _166(ee=>Cn(ee)?ee.def:ee)]),[g]),T=g!==void 0||S!==void 0||M!==void 0||o.includeInDeepSearch!==void 0,{store:m,depth:O,virtualization:G}=_chunkXMZZ62VJcjs.j.call(void 0, );m.initializeDefaultSearch(c);let N=je(),A=ct(),y=ro(),k=Pe(),j=ue.useRef(0),E=ue.useId(),U=ue.useId(),$=ue.useId(),H=_nullishCoalesce(_nullishCoalesce(Ir(), () => (_optionalChain([N, 'optionalAccess', _167 => _167.childSurfaceId]))), () => ($)),ne=jo(),Q=ue.useMemo(()=>y?A&&y.getSurfaceId(A.pageId)?y.activePageId===A.pageId:y.activePageId===null:!0,[y,A]),V=k.useState("isOwner",H),C=_useStableCallback.useStableCallback.call(void 0, ee=>{_optionalChain([i, 'optionalCall', _168 => _168(ee)])});ue.useEffect(()=>{m.context.filter=T?!1:t,m.setSearchNormalizer(s),m.context.loop=f,m.context.autoHighlightFirst=p,m.context.clearSearchOnClose=a,m.context.resetScrollOnSearch=h,m.context.listId=E,m.context.inputId=U,m.context.onSearchChange=C,G&&(m.setVirtualized(G.virtualized),m.setVirtualItems(G.items),m.setOnHighlightChange(G.onHighlightChange)),typeof p=="string"&&m.applyAutoHighlight()},[m,t,s,f,p,a,h,E,U,C,G,T]);let K=Te(),B=ue.useMemo(()=>typeof M=="boolean"||M===void 0?{enabled:_nullishCoalesce(M, () => (!0)),minLength:0,groupSearchBehavior:"preserve",radioGroupSearchBehavior:"preserve",sortGroups:!0,asyncResultBehavior:"stream"}:{enabled:_nullishCoalesce(M.enabled, () => (!0)),minLength:_nullishCoalesce(M.minLength, () => (0)),groupSearchBehavior:_nullishCoalesce(M.groupSearchBehavior, () => ("preserve")),radioGroupSearchBehavior:_nullishCoalesce(M.radioGroupSearchBehavior, () => ("preserve")),sortGroups:_nullishCoalesce(M.sortGroups, () => (!0)),asyncResultBehavior:_nullishCoalesce(M.asyncResultBehavior, () => ("stream"))},[M]),X=ue.useId(),te=ue.useMemo(()=>({content:_nullishCoalesce(F, () => ([])),asyncContent:S,deepSearchConfig:B,includeInDeepSearch:L,listId:X}),[F,S,B,L,X]),fe=_optionalChain([Tr, 'call', _169 => _169(), 'optionalAccess', _170 => _170.setDataSurfaceContext]),Oe=!!(A&&_optionalChain([y, 'optionalAccess', _171 => _171.getSurfaceId, 'call', _172 => _172(A.pageId)]));ue.useEffect(()=>{if(!(!T||!fe||Oe))return fe(te),()=>{fe(ee=>ee===te?null:ee)}},[T,fe,te,Oe]),ue.useEffect(()=>{P&&m.setOrderedItems(P)},[m,P]),m.useControlledProp("searchProp",n);let Ke=m.useState("open"),me=ue.useRef(null);ue.useEffect(()=>{Ke&&(j.current=Date.now())},[Ke]),ue.useEffect(()=>{Q&&O===0&&Ke&&k.setOwnerId(H)},[O,Ke,H,k,Q]),ue.useEffect(()=>{if(!(!ne||!Q)&&K.explicitTabBehavior)return ne.registerSurface(H,{parentSurfaceId:_nullishCoalesce(_optionalChain([N, 'optionalAccess', _173 => _173.parentSurfaceId]), () => (null)),close:N?()=>{N.suppressAutoOpenRef.current=!0,N.setOpen(!1)}:()=>{}})},[ne,Q,K.explicitTabBehavior,H,N]);let ie=ue.useRef(!1);ue.useEffect(()=>{(!Q||!Ke)&&(ie.current=!1)},[Q,Ke]),ue.useEffect(()=>{if(!Q||!V||b)return;let ee=setTimeout(()=>{requestAnimationFrame(()=>{if(!me.current)return;let qe=_nullishCoalesce(_optionalChain([ne, 'optionalAccess', _174 => _174.getZoneElements, 'call', _175 => _175(H)]), () => ([])),Pt=!ie.current;ie.current=!0;let wt=qe.some(mt=>document.activeElement!==null&&mt.contains(document.activeElement));if(K.explicitTabBehavior&&document.activeElement&&me.current.contains(document.activeElement)&&!(Pt&&wt))return;let Nt=Array.from(me.current.querySelectorAll("input")).find(mt=>!qe.some(Lt=>Lt.contains(mt))),xt=me.current.querySelector('[role="listbox"]'),Xe=qe.flatMap(Xo)[0],ft=_nullishCoalesce(_nullishCoalesce(Nt, () => (xt)), () => (Xe));ft&&ft instanceof HTMLElement&&ft.focus()})},0);return()=>clearTimeout(ee)},[Q,V,b,K.explicitTabBehavior,ne,H]);let Ee=ue.useMemo(()=>({store:m,surfaceId:H}),[m,H]),$e=ue.useCallback(ee=>{ee.target instanceof HTMLInputElement||ee.preventDefault(),_optionalChain([d, 'optionalCall', _176 => _176(ee)])},[d]),we=ue.useCallback(ee=>{if(_optionalChain([R, 'optionalCall', _177 => _177(ee)]),Date.now()-j.current<100)return;let Pt=ee.target;_optionalChain([me, 'access', _178 => _178.current, 'optionalAccess', _179 => _179.contains, 'call', _180 => _180(Pt)])&&k.state.ownerId!==H&&k.setOwnerId(H)},[R,H,k]),Ce=ue.useCallback(ee=>{if(_optionalChain([u, 'optionalCall', _181 => _181(ee)]),ee.defaultPrevented||ee.key!=="Tab"||!K.explicitTabBehavior)return;let qe=ee.target;if(!_optionalChain([me, 'access', _182 => _182.current, 'optionalAccess', _183 => _183.contains, 'call', _184 => _184(qe)]))return;let wt=(_nullishCoalesce(_optionalChain([ne, 'optionalAccess', _185 => _185.getZoneElements, 'call', _186 => _186(H)]), () => ([]))).flatMap(Xo);if(wt.length===0){if(!ne){if(K.tabWithoutZones==="inert"){ee.preventDefault();return}K.closeAll(_chunkXMZZ62VJcjs.a.focusOut,ee.nativeEvent);return}let yt=[],Ot=H;for(;;){let z=ne.getParentSurfaceId(Ot);if(!z){if(K.tabWithoutZones==="inert"){ee.preventDefault();return}K.closeAll(_chunkXMZZ62VJcjs.a.focusOut,ee.nativeEvent);return}yt.push(Ot);let oe=ne.getZoneElements(z).flatMap(Xo);if(oe.length>0){ee.preventDefault();for(let ye of yt)ne.closeSurface(ye);k.setOwnerId(z),_optionalChain([(ee.shiftKey?oe[oe.length-1]:oe[0]), 'optionalAccess', _187 => _187.focus, 'call', _188 => _188()]);return}Ot=z}}let Zt=m.state.hasInput?m.context.inputId:m.context.listId,Nt=Zt?document.getElementById(Zt):null,xt=new Set;Nt instanceof HTMLElement&&xt.add(Nt);for(let yt of wt)xt.add(yt);let Xe=[...xt];ee.preventDefault();let ft=document.activeElement,mt=ft?Xe.indexOf(ft):-1,Lt=ee.shiftKey?-1:1;_optionalChain([(mt===-1?ee.shiftKey?Xe[Xe.length-1]:Xe[0]:Xe[(mt+Lt+Xe.length)%Xe.length]), 'optionalAccess', _189 => _189.focus, 'call', _190 => _190()])},[u,K,m,ne,H,k]),Z=ue.useCallback(ee=>{if(_optionalChain([l, 'optionalCall', _191 => _191(ee)]),!K.explicitTabBehavior)return;let qe=ee.target;_optionalChain([me, 'access', _192 => _192.current, 'optionalAccess', _193 => _193.contains, 'call', _194 => _194(qe)])&&k.state.ownerId!==H&&k.setOwnerId(H)},[l,K,k,H]),Ye=q(),se=W(Ye,"surface"),Ie=T?_jsxruntime.jsx.call(void 0, uo.Provider,{value:te,children:_jsxruntime.jsx.call(void 0, La,{children:x})}):x,St=_userender.useRender.call(void 0, {render:D,ref:[me,r],props:{...w,...se?{[se]:""}:{},className:I,style:v,onPointerDown:$e,onPointerMove:we,onKeyDown:Ce,onFocus:Z,children:Ie},enabled:Q,defaultTagName:"div"});return _jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.o.Provider,{value:Ee,children:St})});var sr=Jo.createContext(null);function rs(){let e=Jo.useContext(sr);if(!e)throw new Error("PopupMenu.CheckboxItemIndicator must be used within PopupMenu.CheckboxItem");return e}var Ea={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},Aa= exports.ga =He.forwardRef(function(o,r){let{id:t,checked:s,defaultChecked:n=!1,onCheckedChange:i,value:c,keywords:f,disabled:p=!1,onSelect:a,forceMount:h=!1,closeOnClick:b=!1,shortcut:P,forceOrder:g,forceScore:S,render:M,className:L,style:D,onClick:I,onPointerDown:v,onPointerMove:u,children:l,...d}=o,[R,x]=He.useState(n),w=s!==void 0,F=w?s:R,T=He.useCallback(($=_chunkXMZZ62VJcjs.a.itemPress,re)=>{let H=!F,ne=_chunkXMZZ62VJcjs.b.call(void 0, $,re);_optionalChain([i, 'optionalCall', _195 => _195(H,ne)]),!ne.isCanceled&&(w||x(H))},[F,w,i]),m=Qe({id:t,value:c,keywords:f,disabled:p,forceMount:h,shortcut:P,forceOrder:g,forceScore:S,closeOnClick:b,children:l}),O=m.disabled;He.useEffect(()=>{let $=()=>{O||(T(),_optionalChain([a, 'optionalCall', _196 => _196()]))};return m.registerSelect($)},[O,T,a,m]);let G=He.useMemo(()=>({highlighted:m.isHighlighted,disabled:O,checked:F,first:m.positional.first,last:m.positional.last,firstInGroup:m.positional.firstInGroup,lastInGroup:m.positional.lastInGroup}),[m.isHighlighted,O,F,m.positional]),N=He.useMemo(()=>({...m.contextValue,checked:F,toggle:T}),[m.contextValue,F,T]),A=He.useCallback($=>{_optionalChain([I, 'optionalCall', _197 => _197($)]),$.defaultPrevented||m.handlers.onClick($)},[I,m.handlers]),y=He.useCallback($=>{m.handlers.onPointerDown($),_optionalChain([v, 'optionalCall', _198 => _198($)])},[m.handlers,v]),k=He.useCallback($=>{_optionalChain([u, 'optionalCall', _199 => _199($)]),$.defaultPrevented||m.handlers.onPointerMove($)},[u,m.handlers]),j=q(),E=W(j,"checkbox-item"),U=_userender.useRender.call(void 0, {render:M,ref:[m.ref,m.rowRef,r],state:G,stateAttributesMapping:Ea,props:{...d,...E?{[E]:""}:{},id:m.id,role:"menuitemcheckbox",tabIndex:-1,"aria-checked":F,"aria-disabled":O||void 0,className:L,style:D,onClick:A,onPointerMove:k,onPointerDown:y,children:l},enabled:m.isVisible,defaultTagName:"div"});return m.isVisible?_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:m.contextValue,children:_jsxruntime.jsx.call(void 0, sr.Provider,{value:N,children:U})}):null});var Ba={checked:e=>e?{"data-checked":""}:{"data-unchecked":""},disabled:e=>e?{"data-disabled":""}:null},Va= exports.ha =en.forwardRef(function(o,r){let{keepMounted:t=!1,render:s,className:n,style:i,children:c,...f}=o,{checked:p,highlighted:a,disabled:h,toggle:b}=rs(),P=en.useMemo(()=>({checked:p,highlighted:a,disabled:h,toggle:b}),[p,a,h,b]),g=t||p,S=q(),M=W(S,"checkbox-item-indicator");return _userender.useRender.call(void 0, {render:s,ref:r,state:P,stateAttributesMapping:Ba,props:{...f,...M?{[M]:""}:{},"aria-hidden":!0,className:n,style:i,children:c},enabled:g,defaultTagName:"span"})});var ja={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},ar= exports.ia =Rt.forwardRef(function(o,r){let{id:t,value:s,keywords:n,disabled:i=!1,activatable:c=!0,onSelect:f,forceMount:p=!1,closeOnClick:a=!0,shortcut:h,forceOrder:b,forceScore:P,render:g,className:S,style:M,onClick:L,onPointerDown:D,onPointerMove:I,children:v,...u}=o,l=Qe({id:t,value:s,keywords:n,disabled:i,activatable:c,forceMount:p,shortcut:h,forceOrder:b,forceScore:P,onSelect:f,closeOnClick:a,children:v}),d=l.disabled,R=Rt.useMemo(()=>({highlighted:l.isHighlighted,disabled:d,first:l.positional.first,last:l.positional.last,firstInGroup:l.positional.firstInGroup,lastInGroup:l.positional.lastInGroup}),[l.isHighlighted,d,l.positional]),x=Rt.useCallback(G=>{_optionalChain([L, 'optionalCall', _200 => _200(G)]),G.defaultPrevented||l.handlers.onClick(G)},[L,l.handlers]),w=Rt.useCallback(G=>{l.handlers.onPointerDown(G),_optionalChain([D, 'optionalCall', _201 => _201(G)])},[l.handlers,D]),F=Rt.useCallback(G=>{_optionalChain([I, 'optionalCall', _202 => _202(G)]),G.defaultPrevented||l.handlers.onPointerMove(G)},[I,l.handlers]),T=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:l.contextValue,children:v}),m=q(),O=W(m,"item");return _userender.useRender.call(void 0, {render:g,ref:[l.ref,l.rowRef,r],state:R,stateAttributesMapping:ja,props:{...u,...O?{[O]:""}:{},id:l.id,role:"option",tabIndex:-1,"aria-selected":l.isHighlighted,"aria-disabled":d||void 0,className:S,style:M,onClick:x,onPointerMove:F,onPointerDown:w,children:T},enabled:l.isVisible,defaultTagName:"div"})});var Mo=tn.createContext(null);function as(){let e=tn.useContext(Mo);if(!e)throw new Error("PopupMenu.RadioItem must be used within PopupMenu.RadioGroup");return e}var Ka={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},qa= exports.ja =ke.forwardRef(function(o,r){let{value:t,defaultValue:s,onValueChange:n,disabled:i=!1,forceMount:c=!1,render:f,className:p,style:a,children:h,...b}=o,{store:P}=_chunkXMZZ62VJcjs.p.call(void 0, ),g=Te(),S=ke.useId(),M=ke.useRef(null),[L,D]=ke.useState(null),I=i||g.disabled,[v,u]=ke.useState(s),l=t!==void 0,d=l?t:v,R=ke.useCallback((E,U=_chunkXMZZ62VJcjs.a.itemPress,$)=>{let re=_chunkXMZZ62VJcjs.b.call(void 0, U,$);_optionalChain([n, 'optionalCall', _203 => _203(E,re)]),!re.isCanceled&&(l||u(E))},[l,n]);ke.useEffect(()=>P.registerGroup(S,M),[S,P]),ke.useLayoutEffect(()=>{if(L)return P.registerRow(S,L,{kind:"group"})},[L,S,P]);let x=P.useState("isGroupVisible",S),w=c||x,F=P.useState("isFirstGroup",S),T=P.useState("isLastGroup",S),m=P.useState("isFirstRow",S),O=P.useState("isLastRow",S),G=ke.useMemo(()=>({value:d,setValue:R,disabled:I}),[d,R,I]),N=ke.useMemo(()=>({groupId:S}),[S]),A=ke.useMemo(()=>({disabled:I,firstGroup:F,lastGroup:T,first:m,last:O}),[I,F,T,m,O]),y=q(),k=W(y,"radio-group"),j=_userender.useRender.call(void 0, {render:f,ref:[M,D,r],state:A,stateAttributesMapping:Ka,props:{...b,...k?{[k]:""}:{},role:"group","aria-disabled":I||void 0,className:p,style:a,children:h},enabled:w,defaultTagName:"div"});return w?_jsxruntime.jsx.call(void 0, Mo.Provider,{value:G,children:_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.d.Provider,{value:N,children:j})}):null});function Wa(e){let{value:o,onValueChange:r,disabled:t=!1,children:s}=e,n=on.useCallback((c,f=_chunkXMZZ62VJcjs.a.itemPress,p)=>{let a=_chunkXMZZ62VJcjs.b.call(void 0, f,p);_optionalChain([r, 'optionalCall', _204 => _204(c,a)])},[r]),i=on.useMemo(()=>({value:o,setValue:n,disabled:t}),[o,n,t]);return _jsxruntime.jsx.call(void 0, Mo.Provider,{value:i,children:s})}var ur=nn.createContext(null);function is(){let e=nn.useContext(ur);if(!e)throw new Error("PopupMenu.RadioItemIndicator must be used within PopupMenu.RadioItem");return e}var Ya={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},Xa= exports.la =Je.forwardRef(function(o,r){let{id:t,value:s,keywords:n,disabled:i=!1,onSelect:c,forceMount:f=!1,closeOnClick:p=!1,shortcut:a,forceOrder:h,forceScore:b,render:P,className:g,style:S,onClick:M,onPointerDown:L,onPointerMove:D,children:I,...v}=o,u=as(),l=i||u.disabled,d=u.value===s,R=Qe({id:t,keywords:n,disabled:l,forceMount:f,shortcut:a,forceOrder:h,forceScore:b,closeOnClick:p,children:I}),x=R.disabled;Je.useEffect(()=>{let y=()=>{x||(u.setValue(s),_optionalChain([c, 'optionalCall', _205 => _205()]))};return R.registerSelect(y)},[x,u,s,c,R]);let w=Je.useMemo(()=>({highlighted:R.isHighlighted,disabled:x,checked:d,first:R.positional.first,last:R.positional.last,firstInGroup:R.positional.firstInGroup,lastInGroup:R.positional.lastInGroup}),[R.isHighlighted,x,d,R.positional]),F=Je.useMemo(()=>({...R.contextValue,checked:d}),[R.contextValue,d]),T=Je.useCallback(y=>{_optionalChain([M, 'optionalCall', _206 => _206(y)]),y.defaultPrevented||R.handlers.onClick(y)},[M,R.handlers]),m=Je.useCallback(y=>{R.handlers.onPointerDown(y),_optionalChain([L, 'optionalCall', _207 => _207(y)])},[R.handlers,L]),O=Je.useCallback(y=>{_optionalChain([D, 'optionalCall', _208 => _208(y)]),y.defaultPrevented||R.handlers.onPointerMove(y)},[D,R.handlers]),G=q(),N=W(G,"radio-item"),A=_userender.useRender.call(void 0, {render:P,ref:[R.ref,R.rowRef,r],state:w,stateAttributesMapping:Ya,props:{...v,...N?{[N]:""}:{},id:R.id,role:"menuitemradio",tabIndex:-1,"aria-checked":d,"aria-disabled":x||void 0,className:g,style:S,onClick:T,onPointerMove:O,onPointerDown:m,children:I},enabled:R.isVisible,defaultTagName:"div"});return R.isVisible?_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:R.contextValue,children:_jsxruntime.jsx.call(void 0, ur.Provider,{value:F,children:A})}):null});var Ja={checked:e=>e?{"data-checked":""}:{"data-unchecked":""},disabled:e=>e?{"data-disabled":""}:null},eu= exports.ma =rn.forwardRef(function(o,r){let{keepMounted:t=!1,render:s,className:n,style:i,children:c,...f}=o,{checked:p,highlighted:a,disabled:h}=is(),b=rn.useMemo(()=>({checked:p,highlighted:a,disabled:h}),[p,a,h]),P=t||p,g=q(),S=W(g,"radio-item-indicator");return _userender.useRender.call(void 0, {render:s,ref:r,state:b,stateAttributesMapping:Ja,props:{...f,...S?{[S]:""}:{},"aria-hidden":!0,className:n,style:i,children:c},enabled:P,defaultTagName:"span"})});function qt(e){let{surfaceId:o}=_chunkXMZZ62VJcjs.p.call(void 0, ),r=jo(),t=sn.useId();sn.useLayoutEffect(()=>{if(!(!r||!e))return r.registerZone(o,t,e)},[r,o,t,e])}var ou=an.forwardRef(function(o,r){let{render:t,className:s,style:n,...i}=o,[c,f]=an.useState(null);qt(c);let p=q(),a=W(p,"focus-zone");return _userender.useRender.call(void 0, {render:t,ref:[f,r],state:{},props:{...i,...a?{[a]:""}:{},className:s,style:n},defaultTagName:"div"})});var ru=un.forwardRef(function(o,r){let{render:t,className:s,style:n,...i}=o,[c,f]=un.useState(null);qt(c);let p=q(),a=W(p,"footer");return _userender.useRender.call(void 0, {render:t,ref:[f,r],state:{},props:{...i,...a?{[a]:""}:{},className:s,style:n},defaultTagName:"div"})});var au={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},uu= exports.pa =Ge.forwardRef(function(o,r){let{forceMount:t=!1,render:s,className:n,style:i,children:c,...f}=o,{store:p}=_chunkXMZZ62VJcjs.p.call(void 0, ),a=Ge.useId(),h=Ge.useRef(null),[b,P]=Ge.useState(null);Ge.useEffect(()=>p.registerGroup(a,h),[a,p]),Ge.useLayoutEffect(()=>{if(b)return p.registerRow(a,b,{kind:"group"})},[b,a,p]);let g=p.useState("isGroupVisible",a),S=t||g,M=p.useState("isFirstGroup",a),L=p.useState("isLastGroup",a),D=p.useState("isFirstRow",a),I=p.useState("isLastRow",a),v=Ge.useMemo(()=>({groupId:a}),[a]),u=Ge.useMemo(()=>({hidden:!S,firstGroup:M,lastGroup:L,first:D,last:I}),[S,M,L,D,I]),l=q(),d=W(l,"group"),R=_userender.useRender.call(void 0, {render:s,ref:[h,P,r],state:u,stateAttributesMapping:au,props:{...f,...d?{[d]:""}:{},role:"presentation",className:n,style:i,children:c},enabled:S,defaultTagName:"div"});return S?_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.d.Provider,{value:v,children:R}):null});function cu(e){let{groupId:o,positional:r,children:t}=e,s=ps.useMemo(()=>({groupId:o,positional:r}),[o,r]);return _jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.d.Provider,{value:s,children:t})}var du=cn.forwardRef(function(o,r){let{render:t,className:s,style:n,...i}=o,[c,f]=cn.useState(null);qt(c);let p=q(),a=W(p,"header");return _userender.useRender.call(void 0, {render:t,ref:[f,r],state:{},props:{...i,...a?{[a]:""}:{},className:s,style:n},defaultTagName:"div"})});var mu={first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null},gu= exports.sa =rt.forwardRef(function(o,r){let{alwaysRender:t=!1,render:s,className:n,style:i,...c}=o,{store:f}=_chunkXMZZ62VJcjs.p.call(void 0, ),p=rt.useId(),[a,h]=rt.useState(null);rt.useLayoutEffect(()=>{if(a)return f.registerRow(p,a,{kind:"separator"})},[a,p,f]);let g=f.useState("normalizedSearch").length>0&&!t,S=f.useState("isFirstRow",p),M=f.useState("isLastRow",p),L=rt.useMemo(()=>({first:S,last:M}),[S,M]),D=q(),I=W(D,"separator"),v=_userender.useRender.call(void 0, {render:s,ref:[h,r],state:L,stateAttributesMapping:mu,props:{...c,...I?{[I]:""}:{},role:"none",className:n,style:i},defaultTagName:"div"});return g?null:v});var hu={highlighted:e=>e?{"data-highlighted":""}:null},Ru= exports.ta =pn.forwardRef(function(o,r){let{children:t,render:s,className:n,style:i,...c}=o,{shortcut:f,highlighted:p}=_chunkXMZZ62VJcjs.g.call(void 0, ),a=pn.useMemo(()=>({shortcut:f,highlighted:p}),[f,p]),h=typeof t=="function"?t(a):_nullishCoalesce(t, () => (f)),b=q(),P=W(b,"shortcut");return _userender.useRender.call(void 0, {render:s,ref:r,state:a,stateAttributesMapping:hu,props:{...c,...P?{[P]:""}:{},className:n,style:i,children:h},defaultTagName:"kbd"})});var ir=ln.createContext(null);function Wt(){return ln.useContext(ir)}var Pu={depth:e=>({"data-depth":String(e)})},xu= exports.ua =ls.forwardRef(function(o,r){let{render:t,className:s,style:n,children:i,...c}=o,f=(_nullishCoalesce(_optionalChain([Wt, 'call', _209 => _209(), 'optionalAccess', _210 => _210.depth]), () => (0)))+1,p=q(),a=W(p,"tree"),b=_userender.useRender.call(void 0, {render:t,ref:r,state:{depth:f},stateAttributesMapping:Pu,props:{...c,...a?{[a]:""}:{},role:"presentation",className:s,style:n,children:i},defaultTagName:"div"});return _jsxruntime.jsx.call(void 0, ir.Provider,{value:{depth:f},children:b})});function dn(e,o){return typeof e=="function"?r=>({...e(r),"--tree-depth":o}):{...e,"--tree-depth":o}}var Cu={depth:e=>({"data-depth":String(e)})},vu= exports.va =ds.forwardRef(function(o,r){let{depth:t,render:s,className:n,style:i,children:c,...f}=o,p=Wt(),a=_nullishCoalesce(_nullishCoalesce(t, () => (_optionalChain([p, 'optionalAccess', _211 => _211.depth]))), () => (0)),h=q(),b=W(h,"tree-connector");return _userender.useRender.call(void 0, {render:s,ref:r,state:{depth:a},stateAttributesMapping:Cu,props:{...f,...b?{[b]:""}:{},"aria-hidden":"true","data-depth":a,className:n,style:dn(i,a),children:c},defaultTagName:"span"})});var ku=fs.forwardRef(function(o,r){let{selectable:t=!0,depth:s,style:n,children:i,...c}=o,f=Wt(),p=_nullishCoalesce(_nullishCoalesce(s, () => (_optionalChain([f, 'optionalAccess', _212 => _212.depth]))), () => (0)),a=q(),h=W(a,"tree-item");return _jsxruntime.jsx.call(void 0, ar,{...c,ref:r,activatable:t,style:dn(n,p),...h?{[h]:""}:{},"data-tree-item":"","data-depth":p,...t===!1?{"data-header":""}:{},children:i})});function wu(e){let{open:o,onOpenChange:r,defaultOpen:t=!1,closeRootOnEsc:s=!0,virtualized:n=!1,items:i,onHighlightChange:c,onOpenChangeComplete:f,disabled:p=!1,actionsRef:a,children:h,...b}=e,P=_chunkXMZZ62VJcjs.k.call(void 0, ),g=it(),S=_nullishCoalesce(_optionalChain([P, 'optionalAccess', _213 => _213.depth]), () => (0)),M=_optionalChain([P, 'optionalAccess', _214 => _214.closeAll]),L=_optionalChain([P, 'optionalAccess', _215 => _215.registerSurface]),D=Qo(),I=pe.useCallback((V,C,K)=>{_optionalChain([c, 'optionalCall', _216 => _216(V,V===null?null:_nullishCoalesce(_optionalChain([D, 'optionalAccess', _217 => _217.getNodeById, 'call', _218 => _218(V)]), () => (null)),C,K)])},[D,c]),{surfaceId:v}=_chunkXMZZ62VJcjs.p.call(void 0, ),u=pe.useId(),l=pe.useRef(null),d=pe.useRef(null),R=pe.useRef(!1),x=_chunkXMZZ62VJcjs.y.useStore(void 0,{open:t}),[w,F]=pe.useState(!1),T=(_nullishCoalesce(_optionalChain([g, 'optionalAccess', _219 => _219.disabled]), () => (!1)))||p||w,m=pe.useCallback(V=>{F(V)},[]),O=pe.useCallback(V=>{V&&T||x.setOpen(V)},[x,T]);x.useControlledProp("openProp",o);let G=Ct(),N=x.useState("open");pe.useEffect(()=>{N?G.open(u):G.close(u)},[N,u,G]);let A=pe.useCallback((V,C)=>{_optionalChain([r, 'optionalCall', _220 => _220(V,C)]),!C.isCanceled&&O(V)},[O,r]),y=pe.useCallback(V=>{!V&&x.context.clearSearchOnClose==="after-exit"&&(x.clearSearch(),x.setInputActive(!1)),V||(x.clearHighlight(),_optionalChain([x, 'access', _221 => _221.context, 'access', _222 => _222.onCloseComplete, 'optionalCall', _223 => _223()]),_optionalChain([x, 'access', _224 => _224.context, 'access', _225 => _225.onPopupCloseComplete, 'optionalCall', _226 => _226()])),_optionalChain([f, 'optionalCall', _227 => _227(V)])},[x,f]),[k,j]=pe.useState(!0);pe.useEffect(()=>{if(!P)return;let V=P.store,C=()=>{let B=V.state.open;j(B)};return C(),V.observe("open",C)},[P]),pe.useEffect(()=>{k||O(!1)},[k,O]);let E=S+1;pe.useEffect(()=>{if(L)return L(E,V=>O(V))},[L,E,O]);let U=pe.useRef(null);pe.useImperativeHandle(a,()=>({close:()=>{_optionalChain([U, 'access', _228 => _228.current, 'optionalAccess', _229 => _229.close, 'call', _230 => _230()])},unmount:()=>{_optionalChain([U, 'access', _231 => _231.current, 'optionalAccess', _232 => _232.unmount, 'call', _233 => _233()])},setDisabled:m}),[m]);let $=pe.useMemo(()=>({open:N,setOpen:O,suppressAutoOpenRef:R,triggerRef:l,contentRef:d,parentSurfaceId:v,childSurfaceId:u,closeRootOnEsc:s}),[N,O,v,u,s]),re=pe.useCallback(()=>()=>{},[]),H=pe.useMemo(()=>{if(!(!n&&!c))return{virtualized:n,items:_nullishCoalesce(i, () => ([])),onHighlightChange:I}},[n,i,I,c]),ne=pe.useMemo(()=>({store:x,depth:E,closeAll:_nullishCoalesce(M, () => ((()=>x.setOpen(!1)))),registerSurface:_nullishCoalesce(L, () => (re)),virtualization:H}),[x,E,M,L,re,H]),Q=pe.useMemo(()=>({store:x,disabled:T,depth:E,closeAll:_nullishCoalesce(M, () => ((()=>O(!1)))),explicitTabBehavior:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _234 => _234.explicitTabBehavior]), () => (!1)),tabWithoutZones:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _235 => _235.tabWithoutZones]), () => ("close")),registerSurface:_nullishCoalesce(L, () => (re)),virtualization:H,virtualAnchor:_optionalChain([g, 'optionalAccess', _236 => _236.virtualAnchor]),menuType:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _237 => _237.menuType]), () => ("dropdown")),closeOnOutsidePress:_nullishCoalesce(_optionalChain([g, 'optionalAccess', _238 => _238.closeOnOutsidePress]), () => ("pointerdown"))}),[x,T,E,M,_optionalChain([g, 'optionalAccess', _239 => _239.explicitTabBehavior]),_optionalChain([g, 'optionalAccess', _240 => _240.tabWithoutZones]),L,O,re,H,_optionalChain([g, 'optionalAccess', _241 => _241.virtualAnchor]),_optionalChain([g, 'optionalAccess', _242 => _242.menuType]),_optionalChain([g, 'optionalAccess', _243 => _243.closeOnOutsidePress])]);return _jsxruntime.jsx.call(void 0, No.Provider,{value:$,children:_jsxruntime.jsx.call(void 0, ut.Provider,{value:Q,children:_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.i.Provider,{value:ne,children:_jsxruntime.jsx.call(void 0, _popover.Popover.Root,{...b,open:N,onOpenChange:A,onOpenChangeComplete:y,actionsRef:a?U:void 0,children:h})})})})}function ms(e,o,r){let t=[],s=e.left-o;s>0&&t.push({side:"left",gap:s});let n=o-e.right;n>0&&t.push({side:"right",gap:n});let i=e.top-r;i>0&&t.push({side:"top",gap:i});let c=r-e.bottom;if(c>0&&t.push({side:"bottom",gap:c}),t.length>0)return t.sort((p,a)=>a.gap-p.gap),t[0].side;let f=[{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 f.sort((p,a)=>p.value-a.value),f[0].side}function mn(e,o,r,t){if(o){let s=(o.left+o.right)/2,n=(o.top+o.bottom)/2;return ms(e,s,n)}if(t===void 0){if(r<e.left)return"left";if(r>e.right)return"right";let s=(e.left+e.right)/2;return r<=s?"left":"right"}return ms(e,r,t)}function cr(e,o,r,t,s,n){let i=0,c=0,f=Math.min(Math.max(e.length-1,0),4);for(let a=e.length-f-1;a<e.length-1;a++){if(a<0)continue;let[h,b]=e[a],[P,g]=e[a+1];i+=P-h,c+=g-b}if(Math.hypot(i,c)<.5){let a=s?(s.left+s.right)/2:o,h=s?(s.top+s.bottom)/2:r;if(t==="left"||t==="right"){let b=t==="right"?n.right:n.left,P=(n.top+n.bottom)/2;i=b-a,c=P-h}else{let b=t==="top"?n.top:n.bottom;i=(n.left+n.right)/2-a,c=b-h}}return{dx:i,dy:c}}function pr(e,o,r,t,s,n){let{dx:i,dy:c}=r,f=s==="left"||s==="right",p=f?i:c;if(Math.abs(p)<.01||s==="left"&&i<=0||s==="right"&&i>=0||s==="top"&&c<=0||s==="bottom"&&c>=0)return!1;let h=((s==="left"?t.left:s==="right"?t.right:s==="top"?t.top:t.bottom)-(f?e:o))/p;if(h<=0)return!1;let b=f?o+h*c:e+h*i,P=n?f?n.height:n.width:null,g=P?P*.75:28,S=Math.max(12,Math.min(36,g)),M=(f?t.top:t.left)-S*.25,L=(f?t.bottom:t.right)+S*.25;return b>=M&&b<=L}function Co(e,o=!1){let r=["mouse","pen"];return o||r.push("",void 0),r.includes(e)}var bn=new Set,gn=null;function Nu(){if(gn!==null||typeof window>"u")return;let e=o=>{for(let r of bn){let t=r.trailRef.current;t.push([o.clientX,o.clientY]),t.length>r.limit&&t.shift()}};window.addEventListener("pointermove",e,{passive:!0}),gn=()=>{window.removeEventListener("pointermove",e),gn=null}}function Lu(){bn.size===0&&_optionalChain([gn, 'optionalCall', _244 => _244()])}function gs(e=4){let o=hn.useRef([]);return hn.useEffect(()=>{let r={trailRef:o,limit:e};return bn.add(r),Nu(),()=>{bn.delete(r),o.current=[],Lu()}},[e]),o}function bs(){let[e,o]=Rn.useState([0,0]);return Rn.useEffect(()=>{let r=t=>{o([t.clientX,t.clientY])};return window.addEventListener("pointermove",r,{passive:!0}),()=>{window.removeEventListener("pointermove",r)}},[]),e}function Ss(e){let{config:o,contentRef:r,triggerRef:t,tone:s,contentRectOverride:n,triggerRectOverride:i,mousePointOverride:c}=e,[f,p]=bs(),a=Rs.useMemo(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)").matches:!1,[]),h=r.current,b=_nullishCoalesce(n, () => (_optionalChain([h, 'optionalAccess', _245 => _245.getBoundingClientRect, 'call', _246 => _246()])));if(!b||a||typeof document>"u"||!document.body)return null;let P=_nullishCoalesce(i, () => ((t.current?t.current.getBoundingClientRect():null))),g=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _247 => _247[0]]), () => (f)),S=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _248 => _248[1]]), () => (p)),M=b.left,L=b.top,D=b.width,I=b.height;if(!D||!I)return null;let v=mn(b,P,g,S);if(v==="top"||v==="bottom"||v==="left"&&g>=M||v==="right"&&g<=M+D)return null;let u=2,l=Math.max(0,Math.min(100,(S-L)/I*100)),d=v==="left"?Math.max(M-g,10)+u:Math.max(g-(M+D),10)+u,R=Math.max(0,Math.min(1,o.overlayOpacity)),x=Math.max(0,Math.min(1,o.triangleFillOpacity)),w=o.showStroke?Math.max(0,o.strokeWidth):0,F=o.showDots?Math.max(0,o.dotRadius):0,T=Math.max(1,Math.min(d,I)/2),m=Math.min(Math.max(F,w/2)+.5,T),O=o.showDots?Math.max(0,Math.min(F,m-w/2-.5)):0,G=Math.max(m,Math.min(I-m,l/100*I)),N=v==="left"?M-d:M+D,A=o.idleColor;s==="activated"?A=o.successColor:s==="missed"&&(A=o.missColor);let y=v==="left"?[[d-m,m],[m,G],[d-m,I-m]]:[[m,m],[m,I-m],[d-m,G]],k=y.map(([E,U])=>`${E},${U}`).join(" "),j=_jsxruntime.jsxs.call(void 0, "svg",{"data-bazzaui-submenu-safe-triangle-area":"","data-safe-triangle-tone":s,"aria-hidden":!0,viewBox:`0 0 ${d} ${I}`,style:{position:"fixed",top:L,left:N,width:d,height:I,pointerEvents:"none",zIndex:Number.MAX_SAFE_INTEGER,transform:"translateZ(0)",opacity:R},children:[_jsxruntime.jsx.call(void 0, "polygon",{points:k,fill:A,fillOpacity:x,stroke:o.showStroke?A:"none",strokeWidth:w,strokeDasharray:o.showStroke?o.strokeDasharray:void 0,strokeLinecap:"round",strokeLinejoin:"round"}),o.showDots?y.map(([E,U])=>_jsxruntime.jsx.call(void 0, "circle",{cx:E,cy:U,r:O,fill:A},`${E}-${U}`)):null]});return _reactdom.createPortal.call(void 0, j,document.body)}var Au={popupOpen:e=>e?{"data-popup-open":""}:null,popupFocused:e=>e?{"data-popup-focused":""}:null},Fu= exports.ya =Sn.forwardRef(function(o,r){let{render:t,className:s,style:n,children:i,...c}=o,{open:f,childSurfaceId:p}=Jt(),h=Pe().useState("isOwner",p),b=Sn.useMemo(()=>({popupOpen:f,popupFocused:h}),[f,h]),P=q(),g=W(P,"submenu-trigger-indicator");return _userender.useRender.call(void 0, {render:t,ref:r,state:b,stateAttributesMapping:Au,props:{...c,...g?{[g]:""}:{},"aria-hidden":!0,className:s,style:n,children:i},defaultTagName:"span"})});var Hu={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},ju= exports.za =Y.forwardRef(function(o,r){let{id:t,value:s,keywords:n,disabled:i=!1,forceMount:c=!1,openOnHighlight:f=!0,delay:p,closeDelay:a=0,closeOnPointerLeave:h=!0,forceOrder:b,forceScore:P,render:g,className:S,style:M,onPointerDown:L,onPointerMove:D,onPointerEnter:I,onPointerLeave:v,children:u,...l}=o,d=Y.useMemo(()=>typeof p=="number"?{pointer:p,keyboard:p}:{pointer:_nullishCoalesce(_optionalChain([p, 'optionalAccess', _249 => _249.pointer]), () => (0)),keyboard:_nullishCoalesce(_optionalChain([p, 'optionalAccess', _250 => _250.keyboard]), () => (150))},[p]),{store:R}=_chunkXMZZ62VJcjs.p.call(void 0, ),{depth:x}=_chunkXMZZ62VJcjs.j.call(void 0, ),w=x-1,F=Jt(),{open:T,setOpen:m,suppressAutoOpenRef:O,triggerRef:G,contentRef:N,childSurfaceId:A}=F,y=Y.useRef(null),k=Y.useRef(null),j=Y.useRef(null),E=Y.useRef(null),U=Y.useCallback(()=>{y.current!==null&&(clearTimeout(y.current),y.current=null)},[]),$=Y.useCallback(()=>{k.current!==null&&(clearTimeout(k.current),k.current=null)},[]),re=Y.useCallback(()=>{if(h){if($(),a<=0){m(!1);return}k.current=setTimeout(()=>{k.current=null,m(!1)},a)}},[$,a,h,m]),H=Y.useCallback(()=>{j.current&&(j.current(),j.current=null),E.current!==null&&(clearTimeout(E.current),E.current=null)},[]);Y.useEffect(()=>()=>{U(),$(),H()},[U,$,H]);let ne=Pe(),{aimGuardActive:Q,guardedTriggerId:V,guardedDepth:C,aimGuardActiveRef:K,guardedTriggerIdRef:B,guardedDepthRef:X,activateAimGuard:te,clearAimGuard:J}=jt(),fe=gs(4),{showSafeTriangleArea:Oe,logAimGuardEvents:Ke}=Bo(),me=Oe.enabled,[ie,Ee]=Y.useState("hidden"),[$e,we]=Y.useState(null),Ce=Y.useRef(null),Z=Qe({id:t,value:s,keywords:n,disabled:i,forceMount:c,forceOrder:b,forceScore:P,isSubmenuTrigger:!0,closeOnClick:!1,children:u}),Ye=Z.disabled,se=Y.useCallback((z,oe)=>{Ke&&console.log(`[PopupMenu][AimGuard] ${z}`,{triggerId:Z.id,triggerStoreId:Z.storeId,parentDepth:w,aimGuardActive:K.current,guardedTriggerId:B.current,guardedDepth:X.current,...oe})},[Ke,Z.id,Z.storeId,w,K,B,X]),Ie=Y.useCallback(()=>{Ce.current!==null&&(clearTimeout(Ce.current),Ce.current=null)},[]);Y.useEffect(()=>Ie,[Ie]);let St=Y.useCallback(z=>{me&&(Ie(),Oe.freezeOnPointerLeave?we(z):we(null),Ee("activated"))},[me,Oe.freezeOnPointerLeave,Ie]),ee=Y.useCallback(z=>{if(Ie(),!me||!Oe.showMissState){Ee("hidden"),we(null);return}Ee("missed"),we(z);let oe=Oe.missFreezeDuration;if(oe<=0){Ee("hidden"),we(null);return}Ce.current=setTimeout(()=>{Ce.current=null,Ee("hidden"),we(null)},oe)},[Ie,me,Oe.showMissState,Oe.missFreezeDuration]),qe=Y.useCallback((z,oe,Re,ye,st,Tt)=>{if(H(),se("leave-monitor-start",{anchor:z,initialHit:Re,timeoutMs:ye,closeDelay:a,triggerRect:oe,initialPointerX:st,initialPointerY:Tt}),ye<=0){se("leave-monitor-skip-timeout",{timeoutMs:ye});return}let Mt=Re,tt=st,$t=Tt,Yt=fr=>{if(!Co(fr.pointerType))return;let at=_optionalChain([N, 'access', _251 => _251.current, 'optionalAccess', _252 => _252.getBoundingClientRect, 'call', _253 => _253()]);if(!at){se("leave-monitor-stop-no-content-rect"),H();return}let{clientX:Ae,clientY:Fe}=fr,Ps=Ae>=at.left&&Ae<=at.right&&Fe>=at.top&&Fe<=at.bottom,Gt=z==="left"||z==="right"?Ae-tt:Fe-$t;if(tt=Ae,$t=Fe,Ps){se("leave-monitor-inside-popup",{clientX:Ae,clientY:Fe}),$(),H();return}let mr=z==="left"&&Gt<=-2||z==="right"&&Gt>=2||z==="top"&&Gt<=-2||z==="bottom"&&Gt>=2;if(se("leave-monitor-pointermove",{anchor:z,clientX:Ae,clientY:Fe,axisDelta:Gt,movedAwayFromSubmenu:mr,lastHit:Mt}),Mt&&mr){let xs={contentRect:at,triggerRect:oe,pointerX:Ae,pointerY:Fe};Mt=!1,se("leave-monitor-reversal-close",{anchor:z,clientX:Ae,clientY:Fe,axisDelta:Gt}),ee(xs),J(),re(),(a<=0||!h)&&H();return}let gr=cr(fe.current,Ae,Fe,z,oe,at),vo=pr(Ae,Fe,gr,at,z,oe);if(se("leave-monitor-hit-eval",{anchor:z,clientX:Ae,clientY:Fe,hit:vo,lastHit:Mt,heading:gr}),vo===Mt)return;let br={contentRect:at,triggerRect:oe,pointerX:Ae,pointerY:Fe};if(Mt=vo,vo){se("leave-monitor-hit-transition",{anchor:z,clientX:Ae,clientY:Fe}),St(br),$(),te(Z.id,w,A,600),R.setHighlightedId(Z.storeId),m(!0);return}se("leave-monitor-miss-transition",{anchor:z,clientX:Ae,clientY:Fe}),ee(br),J(),re(),(a<=0||!h)&&H()};window.addEventListener("pointermove",Yt,{passive:!0}),j.current=()=>{se("leave-monitor-cleanup-remove-listener"),window.removeEventListener("pointermove",Yt)},E.current=setTimeout(()=>{E.current=null,se("leave-monitor-timeout-expired",{timeoutMs:ye}),H()},ye)},[H,se,N,$,fe,St,te,Z.id,w,A,R,Z.storeId,m,ee,J,re,a,h]);Y.useEffect(()=>{me||(Ie(),Ee("hidden"),we(null))},[me,Ie]),Y.useEffect(()=>{if(!me||Oe.persistOnSuccess||ie!=="activated")return;Q&&V===Z.id&&C===w||(Ie(),Ee("hidden"),we(null))},[me,Oe.persistOnSuccess,ie,Q,V,C,Z.id,w,Ie]),Y.useEffect(()=>{ie!=="activated"||T||(Ie(),Ee("hidden"),we(null))},[ie,T,Ie]),Y.useEffect(()=>{T||($(),H())},[T,$,H]),Y.useEffect(()=>{T||!K.current||B.current!==Z.id||X.current!==w||J()},[T,Z.id,w,K,B,X,J]),Y.useEffect(()=>{Z.isVisible||!K.current||B.current!==Z.id||X.current!==w||J()},[Z.isVisible,Z.id,w,K,B,X,J]),Y.useEffect(()=>()=>{K.current&&B.current===Z.id&&X.current===w&&J()},[Z.id,w,K,B,X,J]),Y.useEffect(()=>{if(!T)return;let z=N.current;if(!z)return;let oe=()=>{$(),H()},Re=()=>{$(),H()};return z.addEventListener("pointerenter",oe),z.addEventListener("pointermove",Re,{passive:!0}),()=>{z.removeEventListener("pointerenter",oe),z.removeEventListener("pointermove",Re)}},[T,N,$,H]),Y.useEffect(()=>R.registerSubmenuOpen(Z.storeId,()=>{m(!0),ne.setOwnerId(A),requestAnimationFrame(()=>{let z=_optionalChain([N, 'access', _254 => _254.current, 'optionalAccess', _255 => _255.querySelector, 'call', _256 => _256("input")]),oe=_optionalChain([N, 'access', _257 => _257.current, 'optionalAccess', _258 => _258.querySelector, 'call', _259 => _259('[role="listbox"]')]),Re=_nullishCoalesce(z, () => (oe));Re&&Re instanceof HTMLElement&&Re.focus()})}),[Z.storeId,R,m,ne,A,N]),Y.useEffect(()=>R.registerSubmenuClose(Z.storeId,()=>m(!1)),[Z.storeId,R,m]);let Pt=ne.useState("isOwner",A);Y.useEffect(()=>{!Z.isVisible&&T&&m(!1)},[Z.isVisible,T,m]),Y.useEffect(()=>{Z.isHighlighted||(O.current=!1)},[Z.isHighlighted,O]),Y.useEffect(()=>{if(!f)return;if(!Z.isHighlighted||R.state.highlightSource!=="keyboard"){U();return}if(O.current)return;let z=d.keyboard;return z<=0?m(!0):y.current=setTimeout(()=>{y.current=null,!O.current&&m(!0)},z),U},[Z.isHighlighted,R,d.keyboard,m,U,f]),Y.useEffect(()=>(G.current=Z.ref.current,()=>{G.current=null}),[G,Z.ref]);let wt=Y.useCallback(z=>{z.preventDefault(),T&&(O.current=!0,se("pointerdown-suppress-auto-open",{clientX:z.clientX,clientY:z.clientY})),_optionalChain([L, 'optionalCall', _260 => _260(z)])},[T,se,L,O]),Zt=Y.useCallback(z=>{if(_optionalChain([D, 'optionalCall', _261 => _261(z)]),z.defaultPrevented||Ye||!Co(z.pointerType)||!R.shouldAllowPointerHighlight(z.clientX,z.clientY))return;if(K.current&&X.current===w&&B.current!==Z.id){se("pointermove-blocked-by-guard",{clientX:z.clientX,clientY:z.clientY,blockedByTriggerId:B.current});return}if(R.setHighlightedId(Z.storeId),!f||T)return;if(O.current){se("pointermove-open-suppressed-after-explicit-close",{clientX:z.clientX,clientY:z.clientY});return}H(),$();let oe=d.pointer;if(oe<=0){m(!0);return}y.current===null&&(y.current=setTimeout(()=>{y.current=null,m(!0)},oe))},[D,Ye,K,X,w,B,Z.id,Z.storeId,f,T,O,H,$,d.pointer,m,se,R]),Nt=Y.useCallback(z=>{if(_optionalChain([I, 'optionalCall', _262 => _262(z)]),z.defaultPrevented||Ye||!Co(z.pointerType))return;if(K.current&&X.current===w&&B.current!==Z.id){se("pointerenter-blocked-by-guard",{clientX:z.clientX,clientY:z.clientY,blockedByTriggerId:B.current,blockedByDepth:X.current});return}if(se("pointerenter-submenu-trigger",{clientX:z.clientX,clientY:z.clientY}),me&&(Ie(),we(null),Ee("hover")),R.setHighlightedId(Z.storeId),!f)return;if(O.current){se("pointerenter-open-suppressed-after-explicit-close",{clientX:z.clientX,clientY:z.clientY});return}H(),J(),U(),$();let oe=d.pointer;oe<=0?m(!0):y.current=setTimeout(()=>{y.current=null,m(!0)},oe)},[I,Ye,K,X,B,Z.id,Z.storeId,R,f,O,H,J,U,$,Ie,me,d.pointer,m,se,w]),xt=Y.useCallback(z=>{if(_optionalChain([v, 'optionalCall', _263 => _263(z)]),z.defaultPrevented||Ye||!Co(z.pointerType))return;if(U(),se("pointerleave-submenu-trigger",{clientX:z.clientX,clientY:z.clientY}),K.current&&X.current===w&&B.current!==Z.id){se("pointerleave-blocked-by-guard",{clientX:z.clientX,clientY:z.clientY,blockedByTriggerId:B.current,blockedByDepth:X.current});return}let oe=_optionalChain([N, 'access', _264 => _264.current, 'optionalAccess', _265 => _265.getBoundingClientRect, 'call', _266 => _266()]);if(!oe){se("pointerleave-no-content-rect"),H(),Ie(),Ee("hidden"),we(null),J(),re();return}let{clientX:Re,clientY:ye}=z,st=_nullishCoalesce(_optionalChain([G, 'access', _267 => _267.current, 'optionalAccess', _268 => _268.getBoundingClientRect, 'call', _269 => _269()]), () => (null)),Tt={contentRect:oe,triggerRect:st,pointerX:Re,pointerY:ye};if(Re>=oe.left&&Re<=oe.right&&ye>=oe.top&&ye<=oe.bottom){se("pointerleave-inside-popup-success",{clientX:Re,clientY:ye}),St(Tt),$(),H(),J();return}let tt=mn(oe,st,Re,ye),$t=cr(fe.current,Re,ye,tt,st,oe),Yt=pr(Re,ye,$t,oe,tt,st);se("pointerleave-hit-eval",{anchor:tt,hit:Yt,clientX:Re,clientY:ye,heading:$t}),Yt?(se("pointerleave-hit-activate-guard",{anchor:tt,clientX:Re,clientY:ye}),St(Tt),te(Z.id,w,A,600),R.setHighlightedId(Z.storeId),m(!0),qe(tt,st,!0,600,Re,ye)):(se("pointerleave-miss-close",{anchor:tt,clientX:Re,clientY:ye}),ee(Tt),J(),re(),h&&a>0?qe(tt,st,!1,a,Re,ye):H())},[v,Ye,U,K,X,B,Z.id,Z.storeId,a,h,N,H,Ie,J,St,ee,m,$,re,qe,G,fe,te,w,A,R,se]),Xe=Y.useMemo(()=>({submenuTrigger:!0,popupOpen:T,popupFocused:Pt,highlighted:Z.isHighlighted,disabled:Ye,first:Z.positional.first,last:Z.positional.last,firstInGroup:Z.positional.firstInGroup,lastInGroup:Z.positional.lastInGroup}),[T,Pt,Z.isHighlighted,Ye,Z.positional]),ft=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:Z.contextValue,children:u}),mt=q(),Lt=W(mt,"submenu-trigger"),dr=_userender.useRender.call(void 0, {render:g,ref:[Z.ref,Z.rowRef,r],state:Xe,stateAttributesMapping:Hu,props:{...l,...Lt?{[Lt]:""}:{},id:Z.id,role:"menuitem","aria-haspopup":"menu","aria-expanded":T,tabIndex:-1,"aria-disabled":Ye||void 0,className:S,style:M,onPointerMove:Zt,onPointerDown:wt,onPointerEnter:Nt,onPointerLeave:xt,children:ft},defaultTagName:"div"}),yt=Y.useMemo(()=>ie==="hover"?"hover":ie==="activated"?"activated":ie==="missed"?"missed":null,[ie]),Ot=_jsxruntime.jsx.call(void 0, _popover.Popover.Trigger,{nativeButton:!1,render:dr});return Z.isVisible?!me||yt===null?Ot:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[Ot,_jsxruntime.jsx.call(void 0, Ss,{config:Oe,contentRef:N,triggerRef:G,tone:yt,contentRectOverride:_optionalChain([$e, 'optionalAccess', _270 => _270.contentRect]),triggerRectOverride:_optionalChain([$e, 'optionalAccess', _271 => _271.triggerRect]),mousePointOverride:$e?[$e.pointerX,$e.pointerY]:null})]}):null});function Ku(e){let{pageId:o,closeRootOnEsc:r=!1,children:t}=e,s=_chunkXMZZ62VJcjs.k.call(void 0, ),n=it(),i=vt();if(!s||!n)throw new Error("PopupMenu.Subpage must be used within PopupMenu.Popup");let c=_chunkXMZZ62VJcjs.y.useStore(void 0,{open:!1}),f=et.useId(),p=s.store.useState("open"),a=i.activePageId,h=i.stack,b=i.registerPage,P=i.goBack,g=i.getSurfaceId,S=i.rootSurfaceId,M=a===o&&g(o)===f;et.useEffect(()=>b({pageId:o,surfaceId:f,closeRootOnEsc:r}),[b,o,f,r]),et.useEffect(()=>{c.setOpen(p&&M)},[c,p,M]),et.useEffect(()=>s.registerSurface(s.depth,l=>c.setOpen(l)),[s,c]);let L=et.useMemo(()=>{let l=h.lastIndexOf(o);if(l<=0)return S;let d=h[l-1];return d===void 0?null:g(d)},[h,o,g,S]),D=et.useMemo(()=>({pageId:o,surfaceId:f,parentSurfaceId:L,isActive:M,closeRootOnEsc:r,goBack:P}),[o,f,L,M,r,P]),I=et.useMemo(()=>({store:c,depth:s.depth,closeAll:s.closeAll,registerSurface:s.registerSurface,virtualization:s.virtualization}),[c,s]),v=et.useMemo(()=>({store:c,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}),[c,n]),u=M;return _jsxruntime.jsx.call(void 0, Lo.Provider,{value:D,children:_jsxruntime.jsx.call(void 0, Bt.Provider,{value:f,children:_jsxruntime.jsx.call(void 0, ut.Provider,{value:v,children:_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.i.Provider,{value:I,children:u?t:null})})})})}var Wu={canGoBack:e=>e?{"data-can-go-back":""}:null,disabled:e=>e?{"data-disabled":""}:null},Uu= exports.Ba =Ut.forwardRef(function(o,r){let{disabled:t=!1,render:s,className:n,style:i,onClick:c,children:f,...p}=o,a=to(),h=vt(),b=Pe(),P=Te(),g=t||P.disabled,S=Ut.useCallback(I=>{if(_optionalChain([c, 'optionalCall', _272 => _272(I)]),I.defaultPrevented||g)return;a.goBack()&&a.parentSurfaceId&&b.setOwnerId(a.parentSurfaceId)},[c,g,a,b]),M=Ut.useMemo(()=>({canGoBack:h.canGoBack,disabled:g}),[h.canGoBack,g]),L=q(),D=W(L,"subpage-back");return _userender.useRender.call(void 0, {render:s,ref:r,state:M,stateAttributesMapping:Wu,props:{...p,...D?{[D]:""}:{},type:"button",disabled:g,className:n,style:i,onClick:S,children:f},defaultTagName:"button"})});var $u={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},Yu= exports.Ca =Le.forwardRef(function(o,r){let{id:t,value:s,keywords:n,disabled:i=!1,forceMount:c=!1,onSelect:f,onSelectAsync:p,render:a,className:h,style:b,onClick:P,onPointerMove:g,onPointerDown:S,children:M,...L}=o,D=to(),I=Pe(),[v,u]=Le.useState(!1),l=Le.useRef(null);Le.useEffect(()=>()=>{_optionalChain([l, 'access', _273 => _273.current, 'optionalAccess', _274 => _274.abort, 'call', _275 => _275()])},[]);let d=Le.useCallback(()=>{let y=D.goBack();return y&&D.parentSurfaceId&&I.setOwnerId(D.parentSurfaceId),y},[D,I]),R=Le.useCallback(()=>{if(p){if(v)return;_optionalChain([l, 'access', _276 => _276.current, 'optionalAccess', _277 => _277.abort, 'call', _278 => _278()]);let y=new AbortController;l.current=y,u(!0);let k=!1,j={goBack:()=>{let E=d();return E&&(k=!0),E},signal:y.signal};p(j).then(E=>{y.signal.aborted||E!==!1&&!k&&j.goBack()}).catch(()=>{}).finally(()=>{y.signal.aborted||u(!1)});return}_optionalChain([f, 'optionalCall', _279 => _279()]),d()},[f,p,d,v]),x=Qe({id:t,value:s,keywords:n,disabled:i||v,forceMount:c,closeOnClick:!1,onSelect:R,children:M}),w=x.disabled,F=Le.useMemo(()=>({subpageBackItem:!0,highlighted:x.isHighlighted,disabled:w,first:x.positional.first,last:x.positional.last,firstInGroup:x.positional.firstInGroup,lastInGroup:x.positional.lastInGroup}),[x.isHighlighted,w,x.positional]),T=Le.useCallback(y=>{_optionalChain([P, 'optionalCall', _280 => _280(y)]),y.defaultPrevented||x.handlers.onClick(y)},[P,x.handlers]),m=Le.useCallback(y=>{x.handlers.onPointerDown(y),_optionalChain([S, 'optionalCall', _281 => _281(y)])},[x.handlers,S]),O=Le.useCallback(y=>{_optionalChain([g, 'optionalCall', _282 => _282(y)]),y.defaultPrevented||x.handlers.onPointerMove(y)},[g,x.handlers]),G=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:x.contextValue,children:M}),N=q(),A=W(N,"subpage-back-item");return _userender.useRender.call(void 0, {render:a,ref:[x.ref,x.rowRef,r],state:F,stateAttributesMapping:$u,props:{...L,...A?{[A]:""}:{},id:x.id,role:"option",tabIndex:-1,"aria-selected":x.isHighlighted,"aria-disabled":w||void 0,className:h,style:b,onClick:T,onPointerMove:O,onPointerDown:m,children:G},enabled:x.isVisible,defaultTagName:"div"})});var Ju={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},ei= exports.Da =dt.forwardRef(function(o,r){let{id:t,value:s,keywords:n,disabled:i=!1,forceMount:c=!1,forceOrder:f,forceScore:p,targetPageId:a,render:h,className:b,style:P,onClick:g,onPointerDown:S,onPointerMove:M,children:L,...D}=o,I=Pe(),v=vt(),u=v.activePageId,l=v.openPage,d=v.getSurfaceId,R=dt.useCallback(()=>{if(!l(a))return;let U=d(a);U&&I.setOwnerId(U)},[l,d,a,I]),x=Qe({id:t,value:s,keywords:n,disabled:i,forceMount:c,forceOrder:f,forceScore:p,isSubmenuTrigger:!1,closeOnClick:!1,onSelect:R,children:L}),w=x.disabled,F=u===a,T=d(a),m=I.useState("isOwner",_nullishCoalesce(T, () => (""))),O=dt.useCallback(E=>{x.handlers.onPointerDown(E),_optionalChain([S, 'optionalCall', _283 => _283(E)])},[x.handlers,S]),G=dt.useCallback(E=>{_optionalChain([g, 'optionalCall', _284 => _284(E)]),E.defaultPrevented||x.handlers.onClick(E)},[x.handlers,g]),N=dt.useCallback(E=>{_optionalChain([M, 'optionalCall', _285 => _285(E)]),E.defaultPrevented||x.handlers.onPointerMove(E)},[M,x.handlers]),A=dt.useMemo(()=>({subpageTrigger:!0,popupOpen:F,popupFocused:m,highlighted:x.isHighlighted,disabled:w,first:x.positional.first,last:x.positional.last,firstInGroup:x.positional.firstInGroup,lastInGroup:x.positional.lastInGroup}),[F,m,x.isHighlighted,w,x.positional]),y=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:x.contextValue,children:L}),k=q(),j=W(k,"subpage-trigger");return _userender.useRender.call(void 0, {render:h,ref:[x.ref,x.rowRef,r],state:A,stateAttributesMapping:Ju,props:{...D,...j?{[j]:""}:{},id:x.id,role:"menuitem","aria-haspopup":"menu","aria-expanded":F,tabIndex:-1,"aria-disabled":w||void 0,className:b,style:P,onPointerDown:O,onClick:G,onPointerMove:N,children:y},enabled:x.isVisible,defaultTagName:"div"})});exports.a = Pe; exports.b = Ct; exports.c = ut; exports.d = Te; exports.e = it; exports.f = Bt; exports.g = Jt; exports.h = je; exports.i = to; exports.j = ct; exports.k = no; exports.l = vt; exports.m = ro; exports.n = so; exports.o = Cn; exports.p = vn; exports.q = Is; exports.r = Ln; exports.s = Ns; exports.t = Ts; exports.u = Tn; exports.v = Or; exports.w = Ai; exports.x = Ht; exports.y = uo; exports.z = io; exports.A = Gn; exports.B = En; exports.C = co; exports.D = Es; exports.E = As; exports.F = kt; exports.G = lo; exports.H = Ar; exports.I = Fr; exports.J = Qs; exports.K = Ws; exports.L = Qr; exports.M = Ys; exports.N = _s; exports.O = Qe; exports.P = ho; exports.Q = $c; exports.R = Wr; exports.S = Ur; exports.T = ta; exports.U = ra; exports.V = aa; exports.W = zn; exports.X = ca; exports.Y = Ro; exports.Z = So; exports._ = Po; exports.$ = pa; exports.aa = nr; exports.ba = xa; exports.ca = Ca; exports.da = Ia; exports.ea = Da; exports.fa = Oa; exports.ga = Aa; exports.ha = Va; exports.ia = ar; exports.ja = qa; exports.ka = Wa; exports.la = Xa; exports.ma = eu; exports.na = ou; exports.oa = ru; exports.pa = uu; exports.qa = cu; exports.ra = du; exports.sa = gu; exports.ta = Ru; exports.ua = xu; exports.va = vu; exports.wa = ku; exports.xa = wu; exports.ya = Fu; exports.za = ju; exports.Aa = Ku; exports.Ba = Uu; exports.Ca = Yu; exports.Da = ei;
|
|
2
|
+
//# sourceMappingURL=chunk-W4ACKMIZ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/chunk-W4ACKMIZ.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":"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","file":"/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/chunk-W4ACKMIZ.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"]}
|