@bazza-ui/react 0.1.0-canary.13 → 0.1.0-canary.14

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.
Files changed (57) hide show
  1. package/dist/{ListboxStore-nmorsoqX.d.cts → ListboxStore-DCGGpiBg.d.cts} +1 -1
  2. package/dist/{ListboxStore-BYBpGrOz.d.ts → ListboxStore-DZ73dOaC.d.ts} +1 -1
  3. package/dist/chunk-NNGWBSWK.js +2 -0
  4. package/dist/chunk-NNGWBSWK.js.map +1 -0
  5. package/dist/chunk-Z2RGBRJP.cjs +2 -0
  6. package/dist/{chunk-EYMK7XHC.cjs.map → chunk-Z2RGBRJP.cjs.map} +1 -1
  7. package/dist/combobox/index.cjs +1 -1
  8. package/dist/combobox/index.d.cts +8 -8
  9. package/dist/combobox/index.d.ts +8 -8
  10. package/dist/combobox/index.js +1 -1
  11. package/dist/command-menu/index.cjs +1 -1
  12. package/dist/command-menu/index.cjs.map +1 -1
  13. package/dist/command-menu/index.d.cts +9 -9
  14. package/dist/command-menu/index.d.ts +9 -9
  15. package/dist/command-menu/index.js +1 -1
  16. package/dist/command-menu/index.js.map +1 -1
  17. package/dist/context-menu/index.cjs +1 -1
  18. package/dist/context-menu/index.cjs.map +1 -1
  19. package/dist/context-menu/index.d.cts +39 -15
  20. package/dist/context-menu/index.d.ts +39 -15
  21. package/dist/context-menu/index.js +1 -1
  22. package/dist/context-menu/index.js.map +1 -1
  23. package/dist/dropdown-menu/index.cjs +1 -1
  24. package/dist/dropdown-menu/index.cjs.map +1 -1
  25. package/dist/dropdown-menu/index.d.cts +39 -15
  26. package/dist/dropdown-menu/index.d.ts +39 -15
  27. package/dist/dropdown-menu/index.js +1 -1
  28. package/dist/dropdown-menu/index.js.map +1 -1
  29. package/dist/{events-DOGItflK.d.ts → events-D6K5-_aP.d.ts} +71 -3
  30. package/dist/{events-DPsuhBln.d.cts → events-DuKEM5sQ.d.cts} +71 -3
  31. package/dist/internal/listbox/index.d.cts +4 -4
  32. package/dist/internal/listbox/index.d.ts +4 -4
  33. package/dist/internal/popup-menu/index.cjs +1 -1
  34. package/dist/internal/popup-menu/index.cjs.map +1 -1
  35. package/dist/internal/popup-menu/index.d.cts +9 -9
  36. package/dist/internal/popup-menu/index.d.ts +9 -9
  37. package/dist/internal/popup-menu/index.js +1 -1
  38. package/dist/loaders/index.d.cts +1 -1
  39. package/dist/loaders/index.d.ts +1 -1
  40. package/dist/{resolve-Dk_fAKb2.d.cts → resolve-C5shwZ1S.d.cts} +1 -1
  41. package/dist/{resolve-BYm41YfG.d.ts → resolve-DA6nHdAi.d.ts} +1 -1
  42. package/dist/{scroll-arrow-CNd0tgME.d.ts → scroll-arrow-CxHg9cFW.d.ts} +2 -2
  43. package/dist/{scroll-arrow-B81wZTZ2.d.cts → scroll-arrow-rsrV6nun.d.cts} +2 -2
  44. package/dist/select/index.cjs +1 -1
  45. package/dist/select/index.d.cts +8 -8
  46. package/dist/select/index.d.ts +8 -8
  47. package/dist/select/index.js +1 -1
  48. package/dist/{separator-De8l8DKO.d.ts → separator-DaXKN0QW.d.ts} +2 -2
  49. package/dist/{separator-BiySI623.d.cts → separator-DzfgGPjS.d.cts} +2 -2
  50. package/dist/{surface-context-ClmxshBW.d.ts → surface-context-BMizU8oI.d.ts} +1 -1
  51. package/dist/{surface-context-DF-L-30G.d.cts → surface-context-r2eYfQth.d.cts} +1 -1
  52. package/dist/{type-guards-BC2B6bVi.d.cts → type-guards-BO8iCz9M.d.cts} +5 -4
  53. package/dist/{type-guards-ybcHBB3C.d.ts → type-guards-BOg6-eFO.d.ts} +5 -4
  54. package/package.json +1 -1
  55. package/dist/chunk-65TSJ7MA.js +0 -2
  56. package/dist/chunk-65TSJ7MA.js.map +0 -1
  57. package/dist/chunk-EYMK7XHC.cjs +0 -2
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;var _chunkXMZZ62VJcjs = require('./chunk-XMZZ62VJ.cjs');var _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 $e = _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}){$e.useMemo(()=>{!e||n||(s?e.graft(s,o):i&&e.setContent(o))},[e,o,s,n,i]);let f=$e.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]=$e.useState(0),b=$e.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=$e.useMemo(()=>Qn(b,c),[b,c]),g=$e.useRef(new Set);return $e.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:$e.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 Ye=me.children.filter(Ce=>ze(Ce)&&(Ce.kind==="item"||Ce.kind==="checkbox-item"||Ce.kind==="submenu"||Ce.kind==="subpage")&&!Ce.def.hidden);if(Ye.length===0)return null;let we=Ye.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:Ye.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 We=_nullishCoalesce(_optionalChain([ne, 'optionalAccess', _174 => _174.getZoneElements, 'call', _175 => _175(H)]), () => ([])),Pt=!ie.current;ie.current=!0;let wt=We.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=>!We.some(Lt=>Lt.contains(mt))),xt=me.current.querySelector('[role="listbox"]'),Xe=We.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]),Ye=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 We=ee.target;if(!_optionalChain([me, 'access', _182 => _182.current, 'optionalAccess', _183 => _183.contains, 'call', _184 => _184(We)]))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 We=ee.target;_optionalChain([me, 'access', _192 => _192.current, 'optionalAccess', _193 => _193.contains, 'call', _194 => _194(We)])&&k.state.ownerId!==H&&k.setOwnerId(H)},[l,K,k,H]),qe=q(),se=W(qe,"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:Ye,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"),[Ye,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}),qe=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]),We=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||qe||!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,qe,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||qe||!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,qe,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||qe||!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),We(tt,st,!0,600,Re,ye)):(se("pointerleave-miss-close",{anchor:tt,clientX:Re,clientY:ye}),ee(Tt),J(),re(),h&&a>0?We(tt,st,!1,a,Re,ye):H())},[v,qe,U,K,X,B,Z.id,Z.storeId,a,h,N,H,Ie,J,St,ee,m,$,re,We,G,fe,te,w,A,R,se]),Xe=Y.useMemo(()=>({submenuTrigger:!0,popupOpen:T,popupFocused:Pt,highlighted:Z.isHighlighted,disabled:qe,first:Z.positional.first,last:Z.positional.last,firstInGroup:Z.positional.firstInGroup,lastInGroup:Z.positional.lastInGroup}),[T,Pt,Z.isHighlighted,qe,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":qe||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,disabled:qe,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([Ye, 'optionalAccess', _270 => _270.contentRect]),triggerRectOverride:_optionalChain([Ye, 'optionalAccess', _271 => _271.triggerRect]),mousePointOverride:Ye?[Ye.pointerX,Ye.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-EYMK7XHC.cjs.map