@bazza-ui/react 0.1.0-canary.15 → 0.1.0-canary.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/combobox/index.cjs +1 -1
  2. package/dist/combobox/index.cjs.map +1 -1
  3. package/dist/combobox/index.d.ts +842 -834
  4. package/dist/combobox/index.js +1 -1
  5. package/dist/combobox/index.js.map +1 -1
  6. package/dist/command-menu/index.cjs +1 -1
  7. package/dist/command-menu/index.cjs.map +1 -1
  8. package/dist/command-menu/index.d.ts +123 -96
  9. package/dist/command-menu/index.js +1 -1
  10. package/dist/command-menu/index.js.map +1 -1
  11. package/dist/context-menu/index.cjs +1 -1
  12. package/dist/context-menu/index.cjs.map +1 -1
  13. package/dist/context-menu/index.d.ts +701 -658
  14. package/dist/context-menu/index.js +1 -1
  15. package/dist/context-menu/index.js.map +1 -1
  16. package/dist/dropdown-menu/index.cjs +1 -1
  17. package/dist/dropdown-menu/index.cjs.map +1 -1
  18. package/dist/dropdown-menu/index.d.ts +723 -680
  19. package/dist/dropdown-menu/index.js +1 -1
  20. package/dist/dropdown-menu/index.js.map +1 -1
  21. package/dist/events-DDOsDu4X.d.ts +2091 -0
  22. package/dist/index-Cabqj7qI.d.ts +2003 -0
  23. package/dist/index-D8OrKThQ.d.ts +977 -0
  24. package/dist/internal/listbox/index.cjs +1 -2
  25. package/dist/internal/listbox/index.d.ts +2 -272
  26. package/dist/internal/listbox/index.js +1 -2
  27. package/dist/internal/popup-menu/index.cjs +1 -2
  28. package/dist/internal/popup-menu/index.d.ts +4 -238
  29. package/dist/internal/popup-menu/index.js +1 -2
  30. package/dist/items-CD2hw6-3.js +2 -0
  31. package/dist/items-CD2hw6-3.js.map +1 -0
  32. package/dist/items-DYDljwnt.cjs +2 -0
  33. package/dist/items-DYDljwnt.cjs.map +1 -0
  34. package/dist/{items-B6HeFO_8.d.cts → items-ceX--VIv.d.ts} +21 -19
  35. package/dist/kbd/index.cjs +1 -1
  36. package/dist/kbd/index.cjs.map +1 -1
  37. package/dist/kbd/index.d.ts +35 -35
  38. package/dist/kbd/index.js +1 -1
  39. package/dist/kbd/index.js.map +1 -1
  40. package/dist/listbox-CnwUlLZA.js +2 -0
  41. package/dist/listbox-CnwUlLZA.js.map +1 -0
  42. package/dist/listbox-DYvJTiF6.cjs +2 -0
  43. package/dist/listbox-DYvJTiF6.cjs.map +1 -0
  44. package/dist/loaders/index.cjs +1 -1
  45. package/dist/loaders/index.cjs.map +1 -1
  46. package/dist/loaders/index.d.ts +218 -188
  47. package/dist/loaders/index.js +1 -1
  48. package/dist/loaders/index.js.map +1 -1
  49. package/dist/merge-element-props-0mpNO7ZH.cjs +2 -0
  50. package/dist/merge-element-props-0mpNO7ZH.cjs.map +1 -0
  51. package/dist/merge-element-props-PxUvRHax.js +2 -0
  52. package/dist/merge-element-props-PxUvRHax.js.map +1 -0
  53. package/dist/platform-C-sxBTRa.cjs +2 -0
  54. package/dist/platform-C-sxBTRa.cjs.map +1 -0
  55. package/dist/platform-C4_cGUkS.js +2 -0
  56. package/dist/platform-C4_cGUkS.js.map +1 -0
  57. package/dist/popup-menu-BBAzAXIe.cjs +2 -0
  58. package/dist/popup-menu-BBAzAXIe.cjs.map +1 -0
  59. package/dist/popup-menu-HmBMJEZc.js +2 -0
  60. package/dist/popup-menu-HmBMJEZc.js.map +1 -0
  61. package/dist/resolve-state-props-C-zbhdXd.cjs +2 -0
  62. package/dist/resolve-state-props-C-zbhdXd.cjs.map +1 -0
  63. package/dist/resolve-state-props-D31kizRZ.js +2 -0
  64. package/dist/resolve-state-props-D31kizRZ.js.map +1 -0
  65. package/dist/rolldown-runtime-5lHFv1cW.cjs +1 -0
  66. package/dist/rolldown-runtime-DK3Fl9T5.js +1 -0
  67. package/dist/select/index.cjs +1 -1
  68. package/dist/select/index.cjs.map +1 -1
  69. package/dist/select/index.d.ts +835 -828
  70. package/dist/select/index.js +1 -1
  71. package/dist/select/index.js.map +1 -1
  72. package/dist/suggestion-menu/index.cjs +4 -0
  73. package/dist/suggestion-menu/index.cjs.map +1 -0
  74. package/dist/suggestion-menu/index.d.ts +359 -0
  75. package/dist/suggestion-menu/index.js +4 -0
  76. package/dist/suggestion-menu/index.js.map +1 -0
  77. package/dist/types-BbN28E3_.d.ts +50 -0
  78. package/dist/video-player/index.cjs +2 -2
  79. package/dist/video-player/index.cjs.map +1 -1
  80. package/dist/video-player/index.d.ts +964 -1000
  81. package/dist/video-player/index.js +2 -2
  82. package/dist/video-player/index.js.map +1 -1
  83. package/package.json +14 -5
  84. package/dist/ListboxStore-B8oTpM57.d.cts +0 -453
  85. package/dist/ListboxStore-CV5vPUUc.d.ts +0 -453
  86. package/dist/chunk-4C666HHU.js +0 -2
  87. package/dist/chunk-4C666HHU.js.map +0 -1
  88. package/dist/chunk-5T5B5SPR.cjs +0 -2
  89. package/dist/chunk-5T5B5SPR.cjs.map +0 -1
  90. package/dist/chunk-A4Z5BY7H.js +0 -2
  91. package/dist/chunk-A4Z5BY7H.js.map +0 -1
  92. package/dist/chunk-BEWVWSAW.cjs +0 -2
  93. package/dist/chunk-BEWVWSAW.cjs.map +0 -1
  94. package/dist/chunk-EDZTZHQ4.js +0 -2
  95. package/dist/chunk-EDZTZHQ4.js.map +0 -1
  96. package/dist/chunk-IT372NHF.js +0 -2
  97. package/dist/chunk-IT372NHF.js.map +0 -1
  98. package/dist/chunk-JFEVUUPC.cjs +0 -2
  99. package/dist/chunk-JFEVUUPC.cjs.map +0 -1
  100. package/dist/chunk-KO3DXT3Y.js +0 -2
  101. package/dist/chunk-KO3DXT3Y.js.map +0 -1
  102. package/dist/chunk-LXXK4S4Q.js +0 -2
  103. package/dist/chunk-LXXK4S4Q.js.map +0 -1
  104. package/dist/chunk-M4G6J7DP.cjs +0 -2
  105. package/dist/chunk-M4G6J7DP.cjs.map +0 -1
  106. package/dist/chunk-SCDHQZFI.cjs +0 -2
  107. package/dist/chunk-SCDHQZFI.cjs.map +0 -1
  108. package/dist/chunk-XMZZ62VJ.cjs +0 -2
  109. package/dist/chunk-XMZZ62VJ.cjs.map +0 -1
  110. package/dist/combobox/index.d.cts +0 -1066
  111. package/dist/command-menu/index.d.cts +0 -154
  112. package/dist/command-score-CTJ9NV6n.d.cts +0 -23
  113. package/dist/command-score-CTJ9NV6n.d.ts +0 -23
  114. package/dist/context-menu/index.d.cts +0 -696
  115. package/dist/dropdown-menu/index.d.cts +0 -723
  116. package/dist/events-BTHQ2OoH.d.ts +0 -1860
  117. package/dist/events-DVcrtGe3.d.cts +0 -1860
  118. package/dist/input-C95v6jB0.d.cts +0 -46
  119. package/dist/input-CYweYB_i.d.ts +0 -46
  120. package/dist/internal/listbox/index.cjs.map +0 -1
  121. package/dist/internal/listbox/index.d.cts +0 -272
  122. package/dist/internal/listbox/index.js.map +0 -1
  123. package/dist/internal/popup-menu/index.cjs.map +0 -1
  124. package/dist/internal/popup-menu/index.d.cts +0 -238
  125. package/dist/internal/popup-menu/index.js.map +0 -1
  126. package/dist/items-B6HeFO_8.d.ts +0 -37
  127. package/dist/kbd/index.d.cts +0 -61
  128. package/dist/loaders/index.d.cts +0 -363
  129. package/dist/loading-C6WZGUc3.d.cts +0 -29
  130. package/dist/loading-CC4n55sR.d.ts +0 -29
  131. package/dist/resolve-B-j0eW24.d.cts +0 -406
  132. package/dist/resolve-B1F-a3P1.d.ts +0 -406
  133. package/dist/scroll-arrow-BBoKckL_.d.cts +0 -544
  134. package/dist/scroll-arrow-fl3B5sVO.d.ts +0 -544
  135. package/dist/select/index.d.cts +0 -1005
  136. package/dist/separator-Dn15rte3.d.ts +0 -275
  137. package/dist/separator-NjsBVzek.d.cts +0 -275
  138. package/dist/surface-context-CGLDpMej.d.ts +0 -14
  139. package/dist/surface-context-CN4Lb_6F.d.cts +0 -14
  140. package/dist/type-guards-BHHzjRvZ.d.cts +0 -351
  141. package/dist/type-guards-C0e_GpeY.d.ts +0 -351
  142. package/dist/types-DT4FOOa2.d.cts +0 -51
  143. package/dist/types-DT4FOOa2.d.ts +0 -51
  144. package/dist/use-listbox-item-NzZuY34-.d.cts +0 -212
  145. package/dist/use-listbox-item-NzZuY34-.d.ts +0 -212
  146. package/dist/video-player/index.d.cts +0 -1391
@@ -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 Do = _interopRequireWildcard(_react); var wo = _interopRequireWildcard(_react); var _t = _interopRequireWildcard(_react); var No = _interopRequireWildcard(_react); var Jt = _interopRequireWildcard(_react); var to = _interopRequireWildcard(_react); var no = _interopRequireWildcard(_react); var xe = _interopRequireWildcard(_react); var be = _interopRequireWildcard(_react); var Or = _interopRequireWildcard(_react); var Go = _interopRequireWildcard(_react); var Tr = _interopRequireWildcard(_react); var he = _interopRequireWildcard(_react); var uo = _interopRequireWildcard(_react); var Je = _interopRequireWildcard(_react); var Ge = _interopRequireWildcard(_react); var Ao = _interopRequireWildcard(_react); var ae = _interopRequireWildcard(_react); var ce = _interopRequireWildcard(_react); var Bo = _interopRequireWildcard(_react); var Se = _interopRequireWildcard(_react); var Qt = _interopRequireWildcard(_react); var jo = _interopRequireWildcard(_react); var Qo = _interopRequireWildcard(_react); var bo = _interopRequireWildcard(_react); var ho = _interopRequireWildcard(_react); var Dt = _interopRequireWildcard(_react); var nt = _interopRequireWildcard(_react); var ze = _interopRequireWildcard(_react); var Ce = _interopRequireWildcard(_react); var _ = _interopRequireWildcard(_react); var Wo = _interopRequireWildcard(_react); var $e = _interopRequireWildcard(_react); var rt = _interopRequireWildcard(_react); var ke = _interopRequireWildcard(_react); var ue = _interopRequireWildcard(_react); var Qe = _interopRequireWildcard(_react); var en = _interopRequireWildcard(_react); var tn = _interopRequireWildcard(_react); var St = _interopRequireWildcard(_react); var Ye = _interopRequireWildcard(_react); var Ie = _interopRequireWildcard(_react); var on = _interopRequireWildcard(_react); var nn = _interopRequireWildcard(_react); var et = _interopRequireWildcard(_react); var rn = _interopRequireWildcard(_react); var sn = _interopRequireWildcard(_react); var un = _interopRequireWildcard(_react); var an = _interopRequireWildcard(_react); var cn = _interopRequireWildcard(_react); var Ae = _interopRequireWildcard(_react); var ms = _interopRequireWildcard(_react); var pn = _interopRequireWildcard(_react); var st = _interopRequireWildcard(_react); var ln = _interopRequireWildcard(_react); var gs = _interopRequireWildcard(_react); var dn = _interopRequireWildcard(_react); var bs = _interopRequireWildcard(_react); var hs = _interopRequireWildcard(_react); var le = _interopRequireWildcard(_react); var Y = _interopRequireWildcard(_react); var Rn = _interopRequireWildcard(_react); var ys = _interopRequireWildcard(_react); var Sn = _interopRequireWildcard(_react); var Pn = _interopRequireWildcard(_react); var tt = _interopRequireWildcard(_react); var Zt = _interopRequireWildcard(_react); var Le = _interopRequireWildcard(_react); var ft = _interopRequireWildcard(_react);var Mn=Do.createContext(null);function Pe(){let e=Do.useContext(Mn);if(!e)throw new Error("FocusOwner components must be used within a FocusOwnerProvider");return e}var Cn=wo.createContext(null);function vt(){let e=wo.useContext(Cn);if(!e)throw new Error("OpenChain components must be used within an OpenChainProvider");return e}var it=_t.createContext(null);function Te(){let e=_t.useContext(it);if(!e)throw new Error("PopupMenu components must be used within a PopupMenu.Root or ContextMenu.Root");return e}function ct(){return _t.useContext(it)}var Vt=No.createContext(null);function wr(){return No.useContext(Vt)}var Lo=Jt.createContext(null);function eo(){let e=Jt.useContext(Lo);if(!e)throw new Error("SubmenuTrigger must be used within a Submenu");return e}function Ke(){return Jt.useContext(Lo)}var Oo=to.createContext(null);function oo(){let e=to.useContext(Oo);if(!e)throw new Error("Subpage components must be used within a PopupMenu.Subpage");return e}function pt(){return to.useContext(Oo)}var ro=no.createContext(null);function kt(){let e=no.useContext(ro);if(!e)throw new Error("Subpage components must be used within a PopupMenu.Popup");return e}function so(){return no.useContext(ro)}var _store = require('@base-ui/utils/store');var Is={ownerId:_store.createSelector.call(void 0, e=>e.ownerId),isOwner:_store.createSelector.call(void 0, (e,o)=>e.ownerId===o)},ao= exports.n =class extends _store.ReactStore{constructor(){super({ownerId:null},{},Is)}setOwnerId(o){this.set("ownerId",o)}clearOwner(){this.set("ownerId",null)}};function vn(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 Ds(e){let o="";for(let r=0;r<e.length;r+=1){let t=e.charCodeAt(r),a=t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===46||t===95||t===126||t===45;o+=a?String.fromCharCode(t):`%${t.toString(16).padStart(4,"0")}`}return o}function kn(e,o="surface"){return o==="menu"?e.definitionKey:e.definitionPath.map(Ds).join("/")}function In(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 Dn(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 Ht(e){return e.kind==="submenu"||e.kind==="subpage"}function wn(e,o,r,t){return e.map((a,n)=>{let c=In(a),p=[...r,c],m={def:a,kind:a.kind,definitionKey:c,definitionPath:p,parent:o,children:[],depth:o?o.depth+1:0,index:n},l=t(m),i={...m,id:l};return i.children=wn(Dn(a),i,Ht(a)?i.definitionPath:r,t),i})}function lt(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 Nn(e,o,r,t,a){let n=In(e),c=[...r,n],p={def:e,kind:e.kind,definitionKey:n,definitionPath:c,parent:o,children:[],depth:o?o.depth+1:0,index:t};return{definitionKey:n,definitionPath:c,id:a(p)}}function Lr(e={}){let o=_nullishCoalesce(e.idScope, () => ("surface")),r=_nullishCoalesce(e.getResolvedId, () => ((u=>kn(u,o)))),t=[],a=null,n=new Map,c=new Map,p=new WeakMap,m=new Set,l=!1,i=new WeakMap,d=!1,g=new WeakMap,P={},b=u=>{if(o==="menu")return P;let h=u.parent;for(;h;){if(Ht(h.def))return h;h=h.parent}return P},R=u=>{process.env.NODE_ENV!=="production"&&console.warn(u)},y=u=>o==="menu"?"menu":u===P?"root surface":`surface "${u.definitionPath.join("/")}"`,L=u=>{if(process.env.NODE_ENV==="production")return;u.id===""&&(d||(d=!0,R(`[PopupMenu] Empty Resolved ID for ${u.kind} definition.`)));let h=c.get(u.id);!h||h===u||m.has(u.id)||(m.add(u.id),R(`[PopupMenu] Duplicate Resolved ID "${u.id}" in menu scope; ${h.kind} and ${u.kind} definitions conflict.`))},I=(u,h=P)=>{u.definitionKey===""&&(l||(l=!0,R(`[PopupMenu] Empty Definition Key in ${u.kind} definition (${y(h)}).`)));let S=g.get(h);S||(S=new Map,g.set(h,S));let w=S.get(u.definitionKey);w||(w=new Set,S.set(u.definitionKey,w));let B=[...w].find(f=>f!==u);if(B){let f=i.get(h);f||(f=new Set,i.set(h,f)),f.has(u.definitionKey)||(f.add(u.definitionKey),R(`[PopupMenu] Duplicate Definition Key "${u.definitionKey}" in ${y(h)}; ${B.kind} and ${u.kind} definitions conflict.`))}w.add(u),n.has(u.def)||n.set(u.def,u),L(u),c.has(u.id)||c.set(u.id,u);let T=o==="surface"&&Ht(u.def)?u:h;for(let f of u.children)I(f,T)},D=u=>{let h=b(u),S=g.get(h),w=_optionalChain([S, 'optionalAccess', _2 => _2.get, 'call', _3 => _3(u.definitionKey)]);w&&(w.delete(u),w.size===0&&_optionalChain([S, 'optionalAccess', _4 => _4.delete, 'call', _5 => _5(u.definitionKey)]),_optionalChain([S, 'optionalAccess', _6 => _6.size])===0&&g.delete(h)),n.get(u.def)===u&&n.delete(u.def),c.get(u.id)===u&&c.delete(u.id),p.delete(u);for(let B of u.children)D(B)},M=(u,h)=>u.length===h.length&&u.every((S,w)=>S===h[w]),k=u=>Ht(u.def)?u.definitionPath:u.parent?k(u.parent):[],s=(u,h,S,w)=>{let B=new Map;for(let v of u){let A=B.get(v.id);A?A.push(v):B.set(v.id,[v])}let T=[],f=new Set;for(let[v,A]of h.entries()){let{id:x}=Nn(A,S,w,v,r),z=_optionalChain([B, 'access', _7 => _7.get, 'call', _8 => _8(x), 'optionalAccess', _9 => _9.find, 'call', _10 => _10(E=>!f.has(E)&&E.kind===A.kind)]);z?(f.add(z),T.push(z)):T.push(void 0)}let G=u.length===h.length;for(let v of u)f.has(v)||(G=!1,D(v));let O=h.map((v,A)=>{let x=T[A],{definitionKey:N,definitionPath:z,id:E}=Nn(v,S,w,A,r);if(!x){G=!1;let H=wn([v],S,w,r)[0];return H.index=A,H.id=Nn(v,S,w,A,r).id,I(H,b(H)),H}if(x.def===v&&M(x.definitionPath,z))return(u[A]!==x||x.index!==A)&&(G=!1),x.index=A,x;G=!1,n.get(x.def)===x&&n.delete(x.def);let U=b(x),$=g.get(U),re=_optionalChain([$, 'optionalAccess', _11 => _11.get, 'call', _12 => _12(x.definitionKey)]);return re&&(re.delete(x),re.size===0&&_optionalChain([$, 'optionalAccess', _13 => _13.delete, 'call', _14 => _14(x.definitionKey)]),_optionalChain([$, 'optionalAccess', _15 => _15.size])===0&&g.delete(U)),x.def=v,x.definitionKey=N,x.definitionPath=z,x.index=A,x.id!==E&&(c.get(x.id)===x&&c.delete(x.id),x.id=E,L(x),c.has(E)||c.set(E,x)),n.has(v)||n.set(v,x),p.delete(x),x.children=s(x.children,Dn(v),x,Ht(v)?x.definitionPath:w),I(x,b(x)),x});return G?u:O};return{getResolvedId:r,idScope:o,get rootNodes(){return t},setContent(u){u!==a&&(t=s(t,u,null,[]),a=u)},graft(u,h){h!==p.get(u)&&(u.children=s(u.children,h,u,k(u)),p.set(u,h))},getNodeForDef(u){return n.get(u)},getNodeById(u){return c.get(u)}}}var Ns={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)},To=class extends _store.ReactStore{constructor(){super({chain:[]},{},Ns)}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 Ls(e={}){let{onOpenChange:o,defaultOpen:r=!1,virtualized:t=!1,items:a,onHighlightChange:n,closeOnOutsidePress:c="pointerdown",disabled:p=!1,defaultDisabled:m=!1,getResolvedId:l,idScope:i="surface"}=e,d=xe.useRef(null);d.current===null&&(d.current=Lr({getResolvedId:l,idScope:i}));let g=d.current,P=xe.useCallback((v,A,x)=>{_optionalChain([n, 'optionalCall', _16 => _16(v,v===null?null:_nullishCoalesce(g.getNodeById(v), () => (null)),A,x)])},[g,n]),[b,R]=xe.useState(m),y=p||b,L=xe.useCallback(v=>{R(v)},[]);xe.useEffect(()=>{_chunkXMZZ62VJcjs.c.call(void 0, )},[]);let I=xe.useRef(null),D=xe.useCallback((v,A)=>{if(!v&&A.reason===_chunkXMZZ62VJcjs.a.focusOut&&I.current){let x=I.current;I.current=null;let N=_chunkXMZZ62VJcjs.b.call(void 0, _chunkXMZZ62VJcjs.a.outsidePress,x);_optionalChain([o, 'optionalCall', _17 => _17(v,N)]),N.isCanceled&&A.cancel();return}I.current=null,_optionalChain([o, 'optionalCall', _18 => _18(v,A)])},[o]),M=_chunkXMZZ62VJcjs.y.useStore(void 0,{open:r},{onOpenChange:D}),k=M.useState("open"),s=xe.useRef(null);s.current||(s.current=new ao);let u=s.current,h=xe.useRef(null);h.current||(h.current=new To);let S=h.current,w=xe.useRef(new Map),B=xe.useCallback((v,A)=>{let x=Math.random().toString(36).slice(2);return w.current.set(x,{depth:v,setOpen:A}),()=>{w.current.delete(x)}},[]),T=xe.useCallback((v=_chunkXMZZ62VJcjs.a.itemPress,A)=>{let x=[...w.current.values()].sort((N,z)=>z.depth-N.depth);for(let N of x)N.setOpen(!1);M.setOpen(!1,v,A),u.clearOwner(),S.clear()},[M,u,S]),f=xe.useRef(T);f.current=T,xe.useEffect(()=>{if(!k||y){I.current=null;return}let v=A=>{let x=A.target;if(!x)return;let N=x.closest("[data-open]")!==null,z=x.closest("[data-popup-open]")!==null;c==="pointerdown"&&!(N||z)?f.current(_chunkXMZZ62VJcjs.a.outsidePress,A):I.current=A};return document.addEventListener("pointerdown",v,!0),()=>{document.removeEventListener("pointerdown",v,!0),I.current=null}},[k,c,y]);let G=xe.useCallback((v,A=_chunkXMZZ62VJcjs.a.none,x)=>{let N=A===_chunkXMZZ62VJcjs.a.imperativeAction;y&&!N||(M.setOpen(v,A,x),v||(u.clearOwner(),S.clear()))},[M,u,S,y]),O=xe.useMemo(()=>{if(!(!t&&!n))return{virtualized:t,items:_nullishCoalesce(a, () => ([])),onHighlightChange:P}},[t,a,P,n]);return{menuTreeResolver:g,store:M,focusOwnerStore:u,openChainStore:S,registerSurface:B,closeAll:T,virtualization:O,handleOpenChange:G,disabled:y,setDisabled:L}}var Os=140;function On(e){let{surfaceId:o,store:r}=e,[t,a]=be.useState([]),n=be.useRef(t);be.useEffect(()=>{n.current=t},[t]);let c=be.useRef(new Map),p=be.useRef(new Set),m=be.useRef(new Map),[,l]=be.useState(0),[i,d]=be.useState(!1),g=be.useRef(null),P=be.useCallback(()=>{g.current!==null&&(clearTimeout(g.current),g.current=null)},[]),b=be.useCallback(()=>{d(!0),P(),g.current=setTimeout(()=>{g.current=null,d(!1)},Os)},[P]);be.useEffect(()=>P,[P]);let R=be.useCallback(f=>{let G={surfaceId:f.surfaceId,closeRootOnEsc:f.closeRootOnEsc},O=m.current.get(f.pageId);return O?(process.env.NODE_ENV!=="production"&&!p.current.has(f.pageId)&&(p.current.add(f.pageId),console.warn(`PopupMenu: page ID "${f.pageId}" is registered more than once in this popup. The first registration wins. Give each Subpage a unique pageId; data-first subpages use the node's Resolved ID.`)),O.push(G)):(m.current.set(f.pageId,[G]),c.current.set(f.pageId,G),l(v=>v+1)),()=>{let v=m.current.get(f.pageId);if(!v)return;let A=v.indexOf(G);if(A===-1)return;let x=A===0;if(v.splice(A,1),!x)return;let N=v[0];if(N){c.current.set(f.pageId,N),l(z=>z+1);return}m.current.delete(f.pageId),c.current.delete(f.pageId),l(z=>z+1),a(z=>z.includes(f.pageId)?z.filter(U=>U!==f.pageId):z)}},[]),y=be.useCallback(f=>{if(!c.current.has(f))return!1;let G=n.current;return G[G.length-1]===f?!1:(a(v=>[...v,f]),b(),!0)},[b]),L=be.useCallback(()=>n.current.length===0?!1:(a(G=>G.slice(0,-1)),b(),!0),[b]),I=be.useCallback(f=>_nullishCoalesce(_optionalChain([c, 'access', _19 => _19.current, 'access', _20 => _20.get, 'call', _21 => _21(f), 'optionalAccess', _22 => _22.surfaceId]), () => (null)),[]),D=be.useCallback(()=>{a([]),d(!1),P()},[P]);be.useEffect(()=>{if(!r)return;let f=r.context.onPopupCloseComplete,G=()=>{_optionalChain([f, 'optionalCall', _23 => _23()]),D()};return r.context.onPopupCloseComplete=G,()=>{r.context.onPopupCloseComplete===G&&(r.context.onPopupCloseComplete=f),P()}},[r,D,P]);let M=_nullishCoalesce(t[t.length-1], () => (null)),k=M===null?void 0:c.current.get(M),s=M===null?o:_nullishCoalesce(_optionalChain([k, 'optionalAccess', _24 => _24.surfaceId]), () => (o)),u=M===null?!0:_nullishCoalesce(_optionalChain([k, 'optionalAccess', _25 => _25.closeRootOnEsc]), () => (!0)),h=t.length>0,S=t,w=_nullishCoalesce(S[S.length-1], () => (null)),B=w!==null;return{subpageStackContextValue:be.useMemo(()=>({activePageId:M,rootSurfaceId:o,activeSurfaceId:s,canGoBack:h,shouldCloseRootOnEsc:u,stack:t,registerPage:R,openPage:y,goBack:L,getSurfaceId:I}),[M,o,s,h,u,t,R,y,L,I]),isSubpageNavigating:i,hasOpenSubpage:B,subpageId:w,openSubpageIds:S}}var _popover = require('@base-ui/react/popover');var Tn=Go.createContext(null);function q(){return Go.useContext(Tn)}function W(e,o){if(e)return`bazzaui-${e}-${o}`}var _jsxruntime = require('react/jsx-runtime');var Gs=Or.forwardRef(function(o,r){let t=q(),a=W(t,"arrow");return _jsxruntime.jsx.call(void 0, _popover.Popover.Arrow,{ref:r,...a?{[a]:""}:{},...o})});var Fs=Tr.forwardRef(function(o,r){let{showOn:t,...a}=o,n=Ke(),c=vt(),p=Pe(),m=n!==null,l=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _26 => _26.childSurfaceId]), () => ("")),i=_nullishCoalesce(t, () => ((m?"focus":"open"))),d=c.useState("isOpen",l),g=c.useState("isLast",l),P=p.useState("isOwner",l),b=!0;m&&(i==="open"?b=d:g?b=P:b=d);let R=q(),y=W(R,"backdrop");if(!b)return null;let L={pointerEvents:"none",...a.style};return _jsxruntime.jsx.call(void 0, _popover.Popover.Backdrop,{ref:r,...y?{[y]:""}:{},...a,style:L})});var Gn=(g=>(g.slot="bazzaui-[component]-popup",g.open="data-open",g.closed="data-closed",g.side="data-side",g.align="data-align",g.startingStyle="data-starting-style",g.endingStyle="data-ending-style",g.instant="data-instant",g.focused="data-focused",g.hasOpenSubmenu="data-has-open-submenu",g.submenu="data-submenu",g.navigating="data-navigating",g))(Gn||{});var Gr=uo.createContext(null);function Ki(){let e=uo.useContext(Gr);if(!e)throw new Error("Combobox components must be used within a Combobox.Root");return e}function jt(){return uo.useContext(Gr)}var io=Je.createContext(null),co= exports.z =Je.createContext(null);function En(){let e=Je.useContext(io);if(!e)throw new Error("useDataSurfaceContext must be used within a DataSurface component");return e}function An(){return Je.useContext(io)}function Eo(){let e=Je.useContext(co);if(!e)throw new Error("Data components must be used within PopupMenu.Popup");return e}function Er(){return Je.useContext(co)}var po=Je.createContext(null);function Vs(){let e=Je.useContext(po);if(!e)throw new Error("useDataList must be used within a List component");return e}function Hs(){return Je.useContext(po)}var lo=Ao.createContext(null);function Ar(){return Ao.useContext(lo)}var Fn=ae.createContext(null);function It(){return ae.useContext(Fn)}function fo(){return ae.useContext(Fn)}function Fr(e){let{children:o,searchQuery:r}=e,[t,a]=ae.useState(()=>new Map),[n,c]=ae.useState(null),[p,m]=ae.useState(()=>new Map),[l,i]=ae.useState(null),d=ae.useCallback(N=>{c(N)},[]),g=ae.useCallback(()=>{c(null),i(null)},[]),P=ae.useCallback(N=>{c(z=>z&&{...z,result:N}),N.isError&&N.error?i(N.error):N.isError||i(null)},[]),b=ae.useCallback(N=>{a(z=>{let E=new Map(z);return E.set(N.id,N),E})},[]),R=ae.useCallback(N=>{a(z=>{let E=new Map(z);return E.delete(N),E}),m(z=>{let E=new Map(z);return E.delete(N),E})},[]),y=ae.useCallback((N,z)=>{a(E=>{let U=E.get(N);if(!U)return E;let $=new Map(E);return $.set(N,{...U,result:z}),$}),z.isError&&z.error?m(E=>{let U=new Map(E);return U.set(N,z.error),U}):z.isError||m(E=>{if(!E.has(N))return E;let U=new Map(E);return U.delete(N),U})},[]),L=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _27 => _27.config, 'access', _28 => _28.type])==="static"&&n.result.isFetching)return!0;for(let[,N]of t)if(N.config.type==="static"&&N.result.isFetching)return!0;return!1},[t,n]),I=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _29 => _29.config, 'access', _30 => _30.type])==="static"&&n.result.isLoading)return!0;for(let[,N]of t)if(N.config.type==="static"&&N.result.isLoading)return!0;return!1},[t,n]),D=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _31 => _31.config, 'access', _32 => _32.type])==="static"&&n.result.isInitialLoading)return!0;for(let[,N]of t)if(N.config.type==="static"&&N.result.isInitialLoading)return!0;return!1},[t,n]),M=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _33 => _33.config, 'access', _34 => _34.type])==="static"&&n.result.isRefetching)return!0;for(let[,N]of t)if(N.config.type==="static"&&N.result.isRefetching)return!0;return!1},[t,n]),k=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _35 => _35.config, 'access', _36 => _36.type])==="query"&&n.result.isFetching)return!0;for(let[,N]of t)if(N.config.type==="query"&&N.result.isFetching)return!0;return!1},[t,n]),s=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _37 => _37.config, 'access', _38 => _38.type])==="query"&&n.result.isLoading)return!0;for(let[,N]of t)if(N.config.type==="query"&&N.result.isLoading)return!0;return!1},[t,n]),u=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _39 => _39.config, 'access', _40 => _40.type])==="query"&&n.result.isInitialLoading)return!0;for(let[,N]of t)if(N.config.type==="query"&&N.result.isInitialLoading)return!0;return!1},[t,n]),h=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _41 => _41.config, 'access', _42 => _42.type])==="query"&&n.result.isRefetching)return!0;for(let[,N]of t)if(N.config.type==="query"&&N.result.isRefetching)return!0;return!1},[t,n]),S=(_nullishCoalesce(_optionalChain([n, 'optionalAccess', _43 => _43.result, 'access', _44 => _44.isFetching]), () => (!1)))||L||k,w=(_nullishCoalesce(_optionalChain([n, 'optionalAccess', _45 => _45.result, 'access', _46 => _46.isLoading]), () => (!1)))||I||s,B=(_nullishCoalesce(_optionalChain([n, 'optionalAccess', _47 => _47.result, 'access', _48 => _48.isInitialLoading]), () => (!1)))||D||u,T=(_nullishCoalesce(_optionalChain([n, 'optionalAccess', _49 => _49.result, 'access', _50 => _50.isRefetching]), () => (!1)))||M||h,f=ae.useMemo(()=>{if(t.size===0&&!n)return!1;for(let[,N]of t)if(!N.result.isRefetching)return!1;return n?n.result.isRefetching:!0},[t,n]),G=ae.useMemo(()=>_nullishCoalesce(_optionalChain([n, 'optionalAccess', _51 => _51.result, 'access', _52 => _52.isLoading]), () => (!1)),[n]),O=ae.useMemo(()=>{if(_optionalChain([n, 'optionalAccess', _53 => _53.result, 'access', _54 => _54.isFetching]))return!1;for(let[,N]of t)if(N.result.isFetching)return!1;return!0},[t,n]),v=ae.useCallback(()=>{let N=[];_optionalChain([n, 'optionalAccess', _55 => _55.result, 'access', _56 => _56.data])&&!l&&N.push({kind:"root",nodes:n.result.data});for(let[z,E]of t)p.has(z)||E.result.data&&N.push({kind:"branch",id:z,nodes:E.result.data});return N},[t,p,n,l]),A=ae.useCallback(()=>{let N=[];l&&N.push({kind:"root",reason:"error"});for(let[z]of p)N.push({kind:"branch",id:z,reason:"error"});return{isLoading:w,isFetching:S,isInitialLoading:B,isRefetching:T,isAllRefetching:f,isStaticLoading:I,isStaticInitialLoading:D,isStaticRefetching:M,isQueryLoading:s,isQueryInitialLoading:u,isQueryRefetching:h,skippedMenus:N}},[S,w,B,T,f,I,D,M,s,u,h,p,l]),x=ae.useMemo(()=>({registerLoader:b,unregisterLoader:R,updateLoaderResult:y,registerRootLoader:d,unregisterRootLoader:g,updateRootLoaderResult:P,searchQuery:r,loaders:t,root:n,isAnyLoading:w,isAnyFetching:S,isAnyInitialLoading:B,isAnyRefetching:T,isAllRefetching:f,isRootLoading:G,isStaticLoading:I,isStaticFetching:L,isStaticInitialLoading:D,isStaticRefetching:M,isQueryLoading:s,isQueryFetching:k,isQueryInitialLoading:u,isQueryRefetching:h,allResolved:O,getAsyncNodes:v,erroredLoaders:p,rootError:l,getAsyncState:A}),[b,R,y,d,g,P,r,t,n,w,S,B,T,f,G,I,L,D,M,s,k,u,h,O,v,p,l,A]);return _jsxruntime.jsx.call(void 0, Fn.Provider,{value:x,children:o})}function Br(e){return e.kind==="link-item"}function Vr(e){return e.kind==="tree-item"}function ge(e,o){return e.def.kind===o}function qe(e){let o=e.def.kind;return o==="item"||o==="link-item"||o==="radio-item"||o==="checkbox-item"||o==="submenu"||o==="subpage"||o==="tree-item"}function zs(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 Qs(e,o){let r=_nullishCoalesce(e.minQueryLength, () => (1)),t=zs(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 Bn(e,o,r){let t=e.def;if(!t.asyncNodes||!r)return;let a=r.loaders.get(e.id);if(!a)return;let n=t.asyncNodes.type==="query"?Qs(t.asyncNodes,o).isBelowMinLength:!1;return{status:a.result.status,fetchStatus:a.result.fetchStatus,loadingPhase:a.result.loadingPhase,isLoading:a.result.isLoading,isFetching:a.result.isFetching,isInitialLoading:a.result.isInitialLoading,isRefetching:a.result.isRefetching,isError:a.result.isError,error:a.result.error,isBelowMinLength:n}}function Fo(e,o=[],r=null){let t=[];for(let a of e){let n=a.def;if(n.kind!=="separator"){if(n.kind==="group"){t.push(...Fo(a.children,o,{id:n.id,label:n.label}));continue}if(n.kind==="radio-group"){if(n.hidden)continue;t.push(...Fo(a.children,o,null));continue}if(!n.hidden&&(n.kind==="submenu"||n.kind==="subpage")&&(n.kind==="subpage"&&t.push({node:a,pageId:a.id,context:{search:null,breadcrumbs:o,isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(n.disabled, () => (!1)),group:r,tree:null}}),a.children.length)){let c={node:n,menuNode:a,value:n.value,id:n.id};t.push(...Fo(a.children,[...o,c],null))}}}return t}function Hr(e){let{children:o}=e,r=It(),t=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _57 => _57.searchQuery]), () => ("")),{dataSurfaceContext:a,resolvedNodes:n}=Eo(),c=n&&(!a||n.content===a.content)?n:null,p=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _58 => _58.nodes]), () => ([])),m=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _59 => _59.graftVersion]), () => (0)),l=Ge.useMemo(()=>Fo(p),[p,m]),i=Ge.useCallback(g=>{let{node:P,context:b,pageId:R}=g,y=P.def,L={node:y,menuNode:P,value:y.value,id:y.id},I=(M,k)=>{let s=M.def,u=M.id;if(s.kind==="item")return _jsxruntime.jsx.call(void 0, Ge.Fragment,{children:s.render({node:M,props:{id:u,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1)),closeOnClick:s.closeOnClick,onSelect:s.onSelect,shortcut:s.shortcut},context:{...k,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1))}})},u);if(s.kind==="link-item")return _jsxruntime.jsx.call(void 0, Ge.Fragment,{children:s.render({node:M,props:{id:u,value:s.value,href:s.href,disabled:_nullishCoalesce(s.disabled, () => (!1)),closeOnClick:s.closeOnClick,onSelect:s.onSelect,shortcut:s.shortcut,forceOrder:s.forceOrder,forceScore:s.forceScore},context:{...k,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1))}})},u);if(s.kind==="checkbox-item")return _jsxruntime.jsx.call(void 0, Ge.Fragment,{children:s.render({node:M,props:{id:u,value:s.value,checked:s.checked,onCheckedChange:s.onCheckedChange,disabled:_nullishCoalesce(s.disabled, () => (!1)),closeOnClick:s.closeOnClick},context:{...k,value:s.value,checked:s.checked,disabled:_nullishCoalesce(s.disabled, () => (!1))}})},u);if(s.kind==="radio-item")return _jsxruntime.jsx.call(void 0, Ge.Fragment,{children:s.render({node:M,props:{id:u,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1)),closeOnClick:s.closeOnClick,onSelect:s.onSelect,shortcut:s.shortcut},context:{...k,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1))}})},u);if(s.kind==="submenu"){let w=Bn(M,t,r),B=lt(M),T={node:s,menuNode:M,value:s.value,id:s.id},f=G=>{let O=G.def;if(O.kind==="separator")return null;if(O.kind==="group"){let v=G.children.filter(x=>(x.def.kind==="item"||x.def.kind==="link-item"||x.def.kind==="checkbox-item"||x.def.kind==="submenu"||x.def.kind==="subpage")&&!x.def.hidden);if(v.length===0)return null;let A=v.map(x=>I(x,{search:null,breadcrumbs:[...k.breadcrumbs,T],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(x.def.disabled, () => (!1)),group:{id:O.id,label:O.label},tree:null}));if(O.render){let x={search:null,matchCount:v.length,breadcrumbs:[...k.breadcrumbs,T],isDeepSearchResult:!1},N=G;return _jsxruntime.jsx.call(void 0, Ge.Fragment,{children:O.render({node:N,props:{},context:{...x,label:O.label},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:A})})},O.id)}return _jsxruntime.jsx.call(void 0, "div",{role:"group","aria-label":O.label,children:A},O.id)}return O.kind==="radio-group"?D(G,[...k.breadcrumbs,T]):O.kind!=="item"&&O.kind!=="link-item"&&O.kind!=="checkbox-item"&&O.kind!=="submenu"&&O.kind!=="subpage"?null:I(G,{search:null,breadcrumbs:[...k.breadcrumbs,T],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(O.disabled, () => (!1)),group:null,tree:null})};return _jsxruntime.jsx.call(void 0, Ge.Fragment,{children:s.render({node:M,props:{id:u,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1))},context:{...k,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1)),async:w},nodes:B,asyncContent:s.asyncNodes,renderNode:f})},u)}if(s.kind!=="subpage")return null;let h=Bn(M,t,r),S=M.id;return _jsxruntime.jsx.call(void 0, Ge.Fragment,{children:s.renderTrigger({node:M,props:{id:u,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1)),targetPageId:S},context:{...k,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1)),async:h}})},S)},D=(M,k=[])=>{let s=M.def,u=k.length>0,h={search:null,matchCount:s.nodes.length,breadcrumbs:k,isDeepSearchResult:u},S=M.children.map(w=>!qe(w)||w.def.hidden?null:I(w,{search:null,breadcrumbs:k,isDeepSearchResult:u,highlighted:!1,disabled:_nullishCoalesce(w.def.disabled, () => (!1)),group:null,tree:null}));return s.render?_jsxruntime.jsx.call(void 0, Ge.Fragment,{children:s.render({node:M,props:{value:s.value,onValueChange:s.onValueChange,disabled:_nullishCoalesce(s.disabled, () => (!1))},context:{...h,label:s.label,value:s.value,disabled:_nullishCoalesce(s.disabled, () => (!1))},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:S})})},s.id):_jsxruntime.jsx.call(void 0, "div",{role:"radiogroup","aria-label":s.label,children:S},s.id)};return _jsxruntime.jsx.call(void 0, Ge.Fragment,{children:_jsxruntime.jsx.call(void 0, lo.Provider,{value:P,children:y.renderContent({node:P,pageId:R,context:{...b,value:y.value,disabled:_nullishCoalesce(y.disabled, () => (!1)),async:Bn(P,t,r)},nodes:lt(P),asyncContent:y.asyncNodes,renderNode:M=>{let k=M.def;if(k.kind==="separator")return null;if(k.kind==="group"){let s=M.children.filter(h=>(h.def.kind==="item"||h.def.kind==="link-item"||h.def.kind==="checkbox-item"||h.def.kind==="submenu"||h.def.kind==="subpage")&&!h.def.hidden);if(s.length===0)return null;let u=s.map(h=>I(h,{search:null,breadcrumbs:[...b.breadcrumbs,L],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(h.def.disabled, () => (!1)),group:{id:k.id,label:k.label},tree:null}));if(k.render){let h={search:null,matchCount:s.length,breadcrumbs:[...b.breadcrumbs,L],isDeepSearchResult:!1},S=M;return _jsxruntime.jsx.call(void 0, Ge.Fragment,{children:k.render({node:S,props:{},context:{...h,label:k.label},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:u})})},k.id)}return _jsxruntime.jsx.call(void 0, "div",{role:"group","aria-label":k.label,children:u},k.id)}return k.kind==="radio-group"?D(M,[...b.breadcrumbs,L]):k.kind!=="item"&&k.kind!=="link-item"&&k.kind!=="checkbox-item"&&k.kind!=="submenu"&&k.kind!=="subpage"?null:I(M,{search:null,breadcrumbs:[...b.breadcrumbs,L],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(k.disabled, () => (!1)),group:null,tree:null})}})})},R)},[r,t]);if(!a)return null;let d={subpages:l,renderSubpageContent:i};return o?_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:o(d)}):_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:l.map(i)})}function jr(e,o,r){return Math.min(r,Math.max(o,e))}function go(e,o){return typeof e!="number"||Number.isNaN(e)?o:e}var zr={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 Qr(e,o){let r=zr;if(typeof e=="boolean")return{...r,enabled:e};if(!e)return{...r,enabled:!!o};let t=jr(go(e.triangleFillOpacity,r.triangleFillOpacity),0,1),a=jr(go(e.overlayOpacity,r.overlayOpacity),0,1),n=Math.max(0,go(e.strokeWidth,r.strokeWidth)),c=Math.max(0,go(e.dotRadius,r.dotRadius)),p=Math.max(0,go(e.missFreezeDuration,r.missFreezeDuration));return{...r,...e,enabled:_nullishCoalesce(e.enabled, () => (!0)),idleColor:_nullishCoalesce(e.idleColor, () => (r.idleColor)),successColor:_nullishCoalesce(e.successColor, () => (r.successColor)),missColor:_nullishCoalesce(e.missColor, () => (r.missColor)),triangleFillOpacity:t,overlayOpacity:a,showStroke:_nullishCoalesce(e.showStroke, () => (r.showStroke)),strokeWidth:n,strokeDasharray:_nullishCoalesce(e.strokeDasharray, () => (r.strokeDasharray)),showDots:_nullishCoalesce(e.showDots, () => (r.showDots)),dotRadius:c,freezeOnPointerLeave:_nullishCoalesce(e.freezeOnPointerLeave, () => (r.freezeOnPointerLeave)),persistOnSuccess:_nullishCoalesce(e.persistOnSuccess, () => (r.persistOnSuccess)),showMissState:_nullishCoalesce(e.showMissState, () => (r.showMissState)),missFreezeDuration:p}}var Ks={showSafeTriangleArea:zr,logAimGuardEvents:!1},Vn=Bo.createContext(Ks);function Vo(){return Bo.useContext(Vn)}var Kr=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}),zt=()=>ce.useContext(Kr);function qr({children:e}){let{logAimGuardEvents:o}=Vo(),[r,t]=ce.useState(!1),[a,n]=ce.useState(null),[c,p]=ce.useState(null),[m,l]=ce.useState(null),i=ce.useRef(!1),d=ce.useRef(null),g=ce.useRef(null),P=ce.useRef(null);ce.useEffect(()=>{i.current=r},[r]),ce.useEffect(()=>{d.current=a},[a]),ce.useEffect(()=>{g.current=c},[c]),ce.useEffect(()=>{P.current=m},[m]);let b=ce.useRef(null),R=ce.useCallback((k,s)=>{!o||typeof window>"u"||console.log(`[PopupMenu][AimGuardProvider] ${k}`,{aimGuardActive:i.current,guardedTriggerId:d.current,guardedDepth:g.current,guardedSubmenuSurfaceId:P.current,...s})},[o]),y=ce.useCallback(()=>{i.current=!1,d.current=null,g.current=null,P.current=null,t(!1),n(null),p(null),l(null)},[]),L=ce.useCallback(()=>{b.current!==null&&(window.clearTimeout(b.current),b.current=null),R("clear"),y()},[y,R]),I=ce.useCallback((k,s,u,h=450)=>{R("activate",{triggerId:k,depth:s,submenuSurfaceId:u,timeoutMs:h}),i.current=!0,d.current=k,g.current=s,P.current=u,n(k),p(s),l(u),t(!0),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>{R("timeout-expired",{triggerId:k,depth:s,submenuSurfaceId:u}),y(),b.current=null},h)},[y,R]);ce.useEffect(()=>()=>{b.current!==null&&(window.clearTimeout(b.current),b.current=null),R("provider-unmount-clear")},[R]);let D=ce.useCallback(k=>i.current&&d.current!==k,[]),M=ce.useMemo(()=>({aimGuardActive:r,guardedTriggerId:a,guardedDepth:c,guardedSubmenuSurfaceId:m,activateAimGuard:I,clearAimGuard:L,aimGuardActiveRef:i,guardedTriggerIdRef:d,guardedDepthRef:g,guardedSubmenuSurfaceIdRef:P,isGuardBlocking:D}),[r,a,c,m,I,L,D]);return _jsxruntime.jsx.call(void 0, Kr.Provider,{value:M,children:e})}var Us=he.forwardRef(function(o,r){let{children:t,className:a,render:n,...c}=o,p=Ke(),{clearAimGuard:m,aimGuardActiveRef:l,guardedSubmenuSurfaceIdRef:i}=zt(),d=Pe(),g=vt(),P=ct(),b=_nullishCoalesce(_optionalChain([P, 'optionalAccess', _60 => _60.depth]), () => (0)),R=jt(),y=he.useId(),L=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _61 => _61.childSurfaceId]), () => (y)),{subpageStackContextValue:I,isSubpageNavigating:D,hasOpenSubpage:M,subpageId:k,openSubpageIds:s}=On({surfaceId:L,store:_nullishCoalesce(_optionalChain([P, 'optionalAccess', _62 => _62.store]), () => (null))}),[u,h]=he.useState(null),[S,w]=he.useState(null),B=I.activeSurfaceId,T=he.useRef(0);he.useEffect(()=>{_optionalChain([p, 'optionalAccess', _63 => _63.open])&&(T.current=Date.now())},[_optionalChain([p, 'optionalAccess', _64 => _64.open])]);let f=d.useState("isOwner",B),G=g.useState("hasOpenSubmenu",b),O=he.useRef(null),v=he.useCallback(C=>{O.current=C,typeof r=="function"?r(C):r&&(r.current=C),_optionalChain([p, 'optionalAccess', _65 => _65.contentRef])&&(p.contentRef.current=C)},[r,p]);he.useEffect(()=>{b===0&&_optionalChain([P, 'optionalAccess', _66 => _66.store, 'access', _67 => _67.setPopupRef, 'call', _68 => _68(O)])},[b,P]);let A=he.useCallback(()=>{p&&l.current&&i.current===L&&m()},[p,l,i,L,m]);he.useEffect(()=>{_optionalChain([p, 'optionalAccess', _69 => _69.open])!==!1||!l.current||i.current!==L||m()},[_optionalChain([p, 'optionalAccess', _70 => _70.open]),l,i,L,m]),he.useEffect(()=>()=>{l.current&&i.current===L&&m()},[l,i,L,m]);let x=he.useCallback(C=>{if(Date.now()-T.current<100||!p)return;let F=C.target;if(!_optionalChain([O, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.contains, 'call', _73 => _73(F)]))return;let X=F instanceof Element?F:F.parentElement;if(X){let te=X.closest("[data-base-ui-focusable]");if(te&&te!==O.current)return}d.state.ownerId!==p.childSurfaceId&&d.setOwnerId(p.childSurfaceId)},[p,d]),N=p||R?!1:void 0,z=p||R?!1:void 0,E=_optionalChain([R, 'optionalAccess', _74 => _74.layout])==="input-embedded",U=!!p,$=he.useCallback(C=>({...C,isSubmenu:U,hasOpenSubpage:M,subpageId:k,openSubpageIds:s}),[M,U,s,k]),re=he.useMemo(()=>typeof a=="function"?C=>a($(C)):a,[a,$]),H=he.useMemo(()=>typeof n=="function"?(C,j)=>n(C,$(j)):n,[n,$]),ne=q(),K=W(ne,"popup"),V=he.useMemo(()=>({dataSurfaceContext:u,setDataSurfaceContext:h,resolvedNodes:S,setResolvedNodes:w}),[u,S]);return _jsxruntime.jsx.call(void 0, Vt.Provider,{value:L,children:_jsxruntime.jsx.call(void 0, ro.Provider,{value:I,children:_jsxruntime.jsx.call(void 0, co.Provider,{value:V,children:_jsxruntime.jsxs.call(void 0, _popover.Popover.Popup,{ref:v,initialFocus:N,finalFocus:z,className:re,render:H,"data-input-embedded":E?"":void 0,...K?{[K]:""}:{},"data-focused":f?"":void 0,"data-has-open-submenu":G?"":void 0,"data-submenu":U?"":void 0,"data-navigating":D?"":void 0,onPointerMove:C=>{A(),x(C),_optionalChain([c, 'access', _75 => _75.onPointerMove, 'optionalCall', _76 => _76(C)])},...c,children:[t,_jsxruntime.jsx.call(void 0, Hr,{})]})})})})});var Ys=_popover.Popover.Portal;var Wr=(p=>(p.availableWidth="--available-width",p.availableHeight="--available-height",p.anchorWidth="--anchor-width",p.anchorHeight="--anchor-height",p.transformOrigin="--transform-origin",p.positionerWidth="--positioner-width",p.positionerHeight="--positioner-height",p))(Wr||{});var _reactdom = require('react-dom');var Ur=.5;function Js(e){if(Zr(e))return{side:"shift",align:"shift"}}function Zr(e){return e==="left"||e==="right"||e==="inline-start"||e==="inline-end"}var ea=Se.forwardRef(function(o,r){let{side:t,align:a,alignOffset:n,collisionAvoidance:c,virtualAnchor:p,style:m,...l}=o,{store:i,depth:d,virtualAnchor:g,menuType:P}=Te(),b=Ke(),R=Se.useRef(0),y=Se.useRef(!1),[,L]=Se.useReducer(K=>K+1,0),I=Se.useRef(!1),D=Se.useRef({first:null,second:null}),M=Se.useCallback(()=>{if(typeof window>"u"){D.current.first=null,D.current.second=null;return}D.current.first!==null&&(window.cancelAnimationFrame(D.current.first),D.current.first=null),D.current.second!==null&&(window.cancelAnimationFrame(D.current.second),D.current.second=null)},[]),k=Se.useCallback(()=>{M(),I.current=!1},[M]),s=Se.useCallback(()=>{M(),I.current=!0,!(typeof window>"u")&&(D.current.first=window.requestAnimationFrame(()=>{D.current.first=null,D.current.second=window.requestAnimationFrame(()=>{D.current.second=null,I.current=!1})}))},[M]),u=d>0,h=u?p:_nullishCoalesce(p, () => (g)),w=_nullishCoalesce(t, () => ((u?"right":"bottom"))),T=_nullishCoalesce(a, () => ((u||P==="context"?"start":"center"))),f=T==="list-start"&&Zr(w),G=T==="list-start"?"start":T,O=_nullishCoalesce(_optionalChain([b, 'optionalAccess', _77 => _77.open]), () => (!1)),v=i.useState("inputActive"),A=i.context.hideUntilActive,x=Se.useRef(v),N=Se.useCallback(()=>{if(!f)return!1;let K=_optionalChain([b, 'optionalAccess', _78 => _78.contentRef, 'access', _79 => _79.current]);if(!K)return!1;let V=K.getBoundingClientRect(),C=K.querySelector('[role="listbox"]');if(!C){let fe=R.current;return R.current=0,Math.abs(fe)>Ur}let j=C.getBoundingClientRect(),F=getComputedStyle(C),X=Number.parseFloat(F.paddingTop)||0,te=-(j.top+X-V.top),J=R.current;return R.current=te,Math.abs(te-J)>Ur},[f,b]);Se.useLayoutEffect(()=>{!f||!O||y.current||(N(),y.current=!0,L())},[f,O,N]),Se.useLayoutEffect(()=>{if(!f||!O)return;let K=_optionalChain([b, 'optionalAccess', _80 => _80.contentRef, 'access', _81 => _81.current]);if(!K||typeof ResizeObserver>"u")return;let V=new ResizeObserver(()=>{I.current||N()&&_reactdom.flushSync.call(void 0, ()=>{L()})});V.observe(K);let C=K.querySelector('[role="listbox"]');return C&&V.observe(C),()=>{V.disconnect()}},[f,O,b,N]),Se.useLayoutEffect(()=>{let K=x.current;x.current=v,!(!f||!O)&&A&&!K&&v&&s()},[f,O,A,v,s]),Se.useEffect(()=>{O||(y.current=!1,R.current=0,k())},[O,k]),Se.useEffect(()=>k,[k]);let z=f?R.current+(typeof n=="number"?n:0):n,E=_nullishCoalesce(c, () => (Js(w))),U=h?{anchor:h}:{},re=f&&!y.current&&O?{...m,transition:"none"}:m,H=q(),ne=W(H,"positioner");return _jsxruntime.jsx.call(void 0, _popover.Popover.Positioner,{ref:r,side:w,align:G,alignOffset:z,collisionAvoidance:E,style:re,...ne?{[ne]:""}:{},"data-align":f?"list-start":void 0,...U,...l})});var jn=jo.createContext(null);function zo(){return jo.useContext(jn)}var zn=Qo.createContext(null);function Ko(){return Qo.useContext(zn)}var qo= (_class =class{constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }__init() {this.zones=new Map}__init2() {this.surfaces=new Map}registerSurface(o,r){return this.surfaces.set(o,r),()=>{this.surfaces.get(o)===r&&this.surfaces.delete(o)}}getParentSurfaceId(o){return _nullishCoalesce(_optionalChain([this, 'access', _82 => _82.surfaces, 'access', _83 => _83.get, 'call', _84 => _84(o), 'optionalAccess', _85 => _85.parentSurfaceId]), () => (null))}closeSurface(o){_optionalChain([this, 'access', _86 => _86.surfaces, 'access', _87 => _87.get, 'call', _88 => _88(o), 'optionalAccess', _89 => _89.close, 'call', _90 => _90()])}registerZone(o,r,t){let a=this.zones.get(o);return a||(a=new Map,this.zones.set(o,a)),a.set(r,t),()=>{let n=this.zones.get(o);_optionalChain([n, 'optionalAccess', _91 => _91.delete, 'call', _92 => _92(r)]),n&&n.size===0&&this.zones.delete(o)}}getZoneElements(o){let r=this.zones.get(o);return r?[...r.values()].sort((t,a)=>t.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1):[]}}, _class);function oa(e){let{store:o,focusOwnerStore:r,openChainStore:t,disabled:a,depth:n,closeAll:c,explicitTabBehavior:p=!1,tabWithoutZones:m="close",registerSurface:l,virtualization:i,debug:d,virtualAnchor:g,menuType:P="dropdown",closeOnOutsidePress:b="pointerdown",componentName:R,children:y,menuTreeResolver:L}=e,I=Qt.useRef(null);I.current||(I.current=new qo);let D=Qt.useMemo(()=>({store:o,disabled:a,depth:n,closeAll:c,explicitTabBehavior:p,tabWithoutZones:m,registerSurface:l,virtualization:i,virtualAnchor:g,menuType:P,closeOnOutsidePress:b}),[o,a,n,c,p,m,l,i,g,P,b]),M=Qt.useMemo(()=>({store:o,depth:n,closeAll:c,registerSurface:l,virtualization:i}),[o,n,c,l,i]),k=Qt.useMemo(()=>({showSafeTriangleArea:Qr(_optionalChain([d, 'optionalAccess', _93 => _93.showSafeTriangleArea]),_optionalChain([d, 'optionalAccess', _94 => _94.showSubmenuSafeTriangleArea])),logAimGuardEvents:_nullishCoalesce(_optionalChain([d, 'optionalAccess', _95 => _95.logAimGuardEvents]), () => (!1))}),[_optionalChain([d, 'optionalAccess', _96 => _96.showSafeTriangleArea]),_optionalChain([d, 'optionalAccess', _97 => _97.showSubmenuSafeTriangleArea]),_optionalChain([d, 'optionalAccess', _98 => _98.logAimGuardEvents])]);return _jsxruntime.jsx.call(void 0, zn.Provider,{value:L,children:_jsxruntime.jsx.call(void 0, Tn.Provider,{value:R,children:_jsxruntime.jsx.call(void 0, Vn.Provider,{value:k,children:_jsxruntime.jsx.call(void 0, it.Provider,{value:D,children:_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.i.Provider,{value:M,children:_jsxruntime.jsx.call(void 0, qr,{children:_jsxruntime.jsx.call(void 0, Mn.Provider,{value:r,children:_jsxruntime.jsx.call(void 0, Cn.Provider,{value:t,children:_jsxruntime.jsx.call(void 0, jn.Provider,{value:I.current,children:y})})})})})})})})})}function Ee(e){let{closeOnClick:o=!0,disabled:r=!1,activatable:t=!0,...a}=e,{aimGuardActiveRef:n,guardedDepthRef:c}=zt(),{closeAll:p}=_chunkXMZZ62VJcjs.j.call(void 0, ),l=_nullishCoalesce(_optionalChain([ct, 'call', _99 => _99(), 'optionalAccess', _100 => _100.disabled]), () => (!1)),i=r||l,d=bo.useMemo(()=>({aimGuardActiveRef:n,guardedDepthRef:c}),[n,c]),g=bo.useCallback(b=>{o&&p()},[o,p]),P=_chunkXMZZ62VJcjs.t.call(void 0, {...a,disabled:i,activatable:t,aimGuard:d,closeOnClick:o,onAfterSelect:g});return bo.useMemo(()=>({...P,disabled:i}),[P,i])}function Ro(e){let{store:o,surfaceId:r,focusOwnerStore:t,depth:a,submenuContext:n,subpageContext:c=null,enabled:p,disabled:m=!1,enableTypeToSearch:l=!1,onKeyDown:i,closeAll:d,skipFocusOwnerCheck:g=!1}=e,P=ho.useMemo(()=>n?{setOpen:y=>{y||(n.suppressAutoOpenRef.current=!0),n.setOpen(y)},parentSurfaceId:n.parentSurfaceId,closeRootOnEsc:n.closeRootOnEsc}:null,[n]),b=ho.useMemo(()=>c?{goBack:c.goBack,parentSurfaceId:c.parentSurfaceId,closeRootOnEsc:c.closeRootOnEsc}:null,[c]),R=ho.useCallback(y=>{y.itemId&&y.closeOnClick&&d()},[d]);return _chunkXMZZ62VJcjs.u.call(void 0, {store:o,surfaceId:r,enabled:p&&!m,onKeyDown:i,onSelect:R,closeAll:d,focusOwner:t,depth:a,submenuContext:P,subpageContext:b,enableTypeToSearch:l,skipFocusOwnerCheck:g})}var _userender = require('@base-ui/react/use-render');function np(e){return e==null||e===""}function $r(e,o){if(e==null)return"";if(o)return o(e);if(typeof e=="object"&&"label"in e){let r=e.label;if(typeof r=="string")return r}return String(e)}function Yr(e,o){return e==null?"":o?o(e):typeof e=="object"&&"value"in e?String(e.value):String(e)}var Xr={slot:"bazzaui-[component]-icon",open:"data-popup-open"};var ra={open:e=>e?{[Xr.open]:""}:null},sa= exports.U =Dt.forwardRef(function(o,r){let{render:t,className:a,style:n,children:c,onPointerDown:p,onClick:m,...l}=o,{store:i}=Te(),d=i.useState("open"),g=jt(),P=Dt.useMemo(()=>({open:d}),[d]),b=Dt.useCallback(I=>{g&&I.preventDefault(),_optionalChain([p, 'optionalCall', _101 => _101(I)])},[g,p]),R=Dt.useCallback(I=>{if(_optionalChain([m, 'optionalCall', _102 => _102(I)]),!I.defaultPrevented&&g)if(d)g.closeCombobox();else{if((g.multiple?g.values.length>0:g.value!=null)&&!g.multiple){let M=Yr(g.value,g.itemToStringValue),s=_nullishCoalesce(g.itemTextRegistry.get(M), () => ($r(g.value,g.itemToStringLabel)));g.onInputValueChange(s)}g.openCombobox()}},[m,g,d]),y=q(),L=W(y,"icon");return _userender.useRender.call(void 0, {render:t,ref:r,state:P,stateAttributesMapping:ra,props:{...l,...L?{[L]:""}:{},className:a,style:n,children:c,onPointerDown:b,onClick:R},defaultTagName:"span"})});var ua={first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null},ia= exports.V =nt.forwardRef(function(o,r){let{render:t,className:a,style:n,children:c,...p}=o,{store:m}=_chunkXMZZ62VJcjs.p.call(void 0, ),l=nt.useId(),[i,d]=nt.useState(null);nt.useLayoutEffect(()=>{if(i)return m.registerRow(l,i,{kind:"empty"})},[i,l,m]);let g=q(),P=W(g,"empty"),b=fo(),R=b?b.isRootLoading||b.isAnyLoading&&b.searchQuery.length>0:!1,y=m.useState("hasSearchWithNoResults"),L=!R&&y,I=m.useState("isFirstRow",l),D=m.useState("isLastRow",l),M=nt.useMemo(()=>({first:I,last:D}),[I,D]),k=_userender.useRender.call(void 0, {render:t,ref:[d,r],state:M,stateAttributesMapping:ua,props:{...p,...P?{[P]:""}:{},role:"presentation",className:a,style:n,children:c},defaultTagName:"div"});return L?k:null});var pa=ze.forwardRef(function(o,r){let{value:t,onValueChange:a,hideUntilActive:n=!1,backspaceGoesBack:c=!1,disabled:p=!1,render:m,className:l,style:i,onKeyDown:d,onPointerDown:g,...P}=o,{store:b,surfaceId:R}=_chunkXMZZ62VJcjs.p.call(void 0, ),{depth:y,closeAll:L}=_chunkXMZZ62VJcjs.j.call(void 0, ),I=Ke(),D=pt(),{disabled:M}=Te(),k=M||p,s=Pe(),u=ze.useRef(null),h=b.useState("search"),S=b.useState("highlightedId"),w=b.context.listId,B=b.context.inputId;ze.useEffect(()=>(b.setHideUntilActive(n),()=>b.setHideUntilActive(!1)),[b,n]);let T=b.useState("inputActive"),f=b.useState("pendingSearch"),G=!n||T;ze.useEffect(()=>{if(G)return b.setHasInput(!0),()=>b.setHasInput(!1)},[b,G]);let v=t!==void 0?t:h;ze.useEffect(()=>{f&&u.current&&(b.setSearch(f),_optionalChain([a, 'optionalCall', _103 => _103(f)]),b.setPendingSearch(""),u.current.focus())},[f,b,a]);let A=ze.useCallback(H=>{let ne=H.target.value;b.setSearch(ne),_optionalChain([a, 'optionalCall', _104 => _104(ne)])},[a,b]),x=ze.useCallback(H=>{_optionalChain([g, 'optionalCall', _105 => _105(H)]),!k&&s.state.ownerId!==R&&s.setOwnerId(R)},[g,k,s,R]),{handleKeyDown:N}=Ro({store:b,surfaceId:R,focusOwnerStore:s,depth:y,submenuContext:I,subpageContext:D,enabled:!0,disabled:k,enableTypeToSearch:!1,onKeyDown:d,closeAll:L}),z=ze.useCallback(H=>{if(c&&H.key==="Backspace"&&!H.repeat&&!H.nativeEvent.isComposing&&H.keyCode!==229&&v===""&&D&&D.goBack()){H.preventDefault(),D.parentSurfaceId&&s.setOwnerId(D.parentSurfaceId);return}N(H)},[c,v,D,s,N]),E=ze.useMemo(()=>({active:T}),[T]),U=q(),$=W(U,"input"),re=_userender.useRender.call(void 0, {render:m,ref:[u,r],state:E,props:{...P,...$?{[$]:""}:{},id:B,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":!0,"aria-controls":w,"aria-activedescendant":_nullishCoalesce(S, () => (void 0)),autoComplete:"off",autoCorrect:"off",spellCheck:!1,disabled:k,className:l,style:i,value:v,onChange:A,onKeyDown:z,onPointerDown:x},defaultTagName:"input"});return G?re:null});var da={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},Qn= exports.X =Wo.forwardRef(function(o,r){let{render:t,className:a,style:n,children:c,...p}=o,{store:m}=_chunkXMZZ62VJcjs.p.call(void 0, ),l=_chunkXMZZ62VJcjs.e.call(void 0, ),i=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _106 => _106.groupId]), () => ("")),d=m.useState("isFirstGroup",i),g=m.useState("isLastGroup",i),P=m.useState("isFirstRow",i),b=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _107 => _107.positional, 'optionalAccess', _108 => _108.firstGroup]), () => (d)),R=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _109 => _109.positional, 'optionalAccess', _110 => _110.lastGroup]), () => (g)),y=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _111 => _111.positional, 'optionalAccess', _112 => _112.first]), () => (P)),L=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _113 => _113.positional, 'optionalAccess', _114 => _114.last]), () => (!1)),I=Wo.useMemo(()=>({first:y,last:L,firstGroup:b,lastGroup:R}),[y,L,b,R]),D=q(),M=W(D,"group-label");return _userender.useRender.call(void 0, {render:t,ref:r,state:I,stateAttributesMapping:da,props:{...p,...M?{[M]:""}:{},role:"presentation","aria-hidden":"true",className:a,style:n,children:c},defaultTagName:"div"})});function Uo(e,o=!0,r=!0,t="exclude"){let a=[];for(let n of e)if(n.def.kind!=="separator"){if(n.def.kind==="group"){a.push(...Uo(lt(n),o,r,t));continue}if(n.def.kind==="radio-group"){if(n.def.hidden)continue;a.push(...Uo(lt(n),o,r,t));continue}if(n.def.kind==="submenu"||n.def.kind==="subpage"){if(n.def.hidden)continue;let c=Kn(n.def,o,t),p=r&&c===!0&&n.def.deepSearch!==!1;n.def.asyncNodes&&p&&a.push({id:n.id,node:n,config:n.def.asyncNodes}),p&&a.push(...Uo(lt(n),o,!0,t))}}return a}function Kn(e,o,r="exclude"){return e.includeInDeepSearch!==void 0?e.includeInDeepSearch:e.disabled&&r==="exclude"?"trigger-only":o}function Zo(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,t="exclude"){let a=new Set,n=[];for(let c of Uo(e,o,r,t))a.has(c.id)||(a.add(c.id),n.push(c));return n}function _r({resolver:e,content:o,asyncContent:r,coordinator:t,graftParent:a,isSubpageSurface:n,isResolutionRoot:c,includeInDeepSearch:p,disabledBranchBehavior:m}){$e.useMemo(()=>{!e||n||(a?e.graft(a,o):c&&e.setContent(o))},[e,o,a,n,c]);let l=$e.useMemo(()=>n&&e?o.map(L=>e.getNodeForDef(L)).filter(L=>L!==void 0):[],[n,e,o]),i=n?_nullishCoalesce(_nullishCoalesce(a, () => (_optionalChain([l, 'access', _117 => _117[0], 'optionalAccess', _118 => _118.parent]))), () => (null)):null,[d,g]=$e.useState(0),P=$e.useMemo(()=>n?_nullishCoalesce(_optionalChain([i, 'optionalAccess', _119 => _119.children]), () => (l)):a?a.children:c&&e?e.rootNodes:[],[n,i,l,a,e,c,o,d]),b=$e.useMemo(()=>qn(P,p,!0,m),[P,p,m]),R=$e.useRef(new Set);return $e.useEffect(()=>{if(!e||!t||n&&!i)return;let L=new Map(t.getAsyncNodes().filter(s=>s.kind==="branch").map(s=>[s.id,s.nodes])),I=!1,D=(s,u)=>{if(!s)return;let h=s.children;e.graft(s,u),I||=h!==s.children},M=_optionalChain([t, 'access', _120 => _120.getAsyncNodes, 'call', _121 => _121(), 'access', _122 => _122.find, 'call', _123 => _123(s=>s.kind==="root"), 'optionalAccess', _124 => _124.nodes]);if(n&&i){let s=_nullishCoalesce(i.def.nodes, () => ([]));D(i,M?r?M:[...s,...M]:s)}else{let s=M?r?M:[...o,...M]:o;if(a)D(a,s);else if(c){let u=e.rootNodes;e.setContent(s),I||=u!==e.rootNodes}}let k=new Set(b.map(s=>s.node));for(let s of R.current)k.has(s)||D(s,_nullishCoalesce(s.def.nodes, () => ([])));R.current=k;for(let s of b){let u=L.get(s.id),h=_nullishCoalesce(s.node.def.nodes, () => ([]));D(s.node,u?[...h,...u]:h)}I&&g(s=>s+1)},[e,_optionalChain([t, 'optionalAccess', _125 => _125.loaders]),_optionalChain([t, 'optionalAccess', _126 => _126.erroredLoaders]),_optionalChain([t, 'optionalAccess', _127 => _127.root]),o,r,b,a,n,i,c]),{nodes:$e.useMemo(()=>n?_nullishCoalesce(_optionalChain([i, 'optionalAccess', _128 => _128.children]), () => (l)):a?a.children:c&&e?e.rootNodes:[],[n,i,l,a,e,c,o,d]),graftVersion:d,asyncSubmenus:b}}function fa(e){return e}function So(e){return"kind"in e&&e.kind==="group"}function Po(e){return"kind"in e&&e.kind==="radio-group"}function xo(e){return"kind"in e&&e.kind==="separator"}function ma(e){return"kind"in e&&e.kind==="row"}function $o(e){let o=[];for(let r of e)ge(r,"tree-item")||ge(r,"item")||ge(r,"submenu")?o.push(r):process.env.NODE_ENV!=="production"&&console.warn(`Unsupported ${r.kind} child skipped inside tree-item.`);return o}function Rt(e,o={}){let{deep:r=!1,includeInDeepSearch:t=!0,disabledBranchBehavior:a="exclude",descendantsIncluded:n=!0,breadcrumbs:c=[],group:p=null,radioGroup:m=null,inheritedKeywords:l=[]}=o,i=[];for(let d of e)if(!ge(d,"separator")){if(ge(d,"group")){let g={id:d.def.id,label:d.def.label,groupDef:d.def,menuNode:d};i.push(...Rt(d.children,{deep:r,includeInDeepSearch:t,disabledBranchBehavior:a,descendantsIncluded:n,breadcrumbs:c,group:g,radioGroup:null,inheritedKeywords:l}));continue}if(ge(d,"radio-group")){if(d.def.hidden)continue;let g={id:d.def.id,label:d.def.label,radioGroupDef:d.def,menuNode:d};i.push(...Rt(d.children,{deep:r,includeInDeepSearch:t,disabledBranchBehavior:a,descendantsIncluded:n,breadcrumbs:c,group:null,radioGroup:g,inheritedKeywords:l}));continue}if(qe(d)&&!d.def.hidden){if(ge(d,"item")||ge(d,"radio-item")||ge(d,"checkbox-item")||ge(d,"link-item")){i.push({node:d,breadcrumbs:c,group:p,radioGroup:m,inheritedKeywords:l});continue}if(ge(d,"tree-item")){if(d.def.selectable!==!1&&i.push({node:d,breadcrumbs:c,group:p,radioGroup:m,inheritedKeywords:l}),d.children.length&&d.def.deepSearch!==!1){let g={node:d.def,menuNode:d,value:d.def.value,id:d.def.id};i.push(...Rt($o(d.children),{deep:r,includeInDeepSearch:t,disabledBranchBehavior:a,descendantsIncluded:n,breadcrumbs:[...c,g],group:p,radioGroup:m,inheritedKeywords:[...l,d.def.value]}))}continue}if(ge(d,"submenu")||ge(d,"subpage")){let g=Kn(d.def,t,a);if((!r||n&&g!==!1)&&i.push({node:d,breadcrumbs:c,group:p,radioGroup:m,inheritedKeywords:l}),r&&n&&g===!0&&d.def.deepSearch!==!1&&d.children.length){let R={node:d.def,menuNode:d,value:d.def.value,id:d.def.id},y=[...c,R];i.push(...Rt(d.children.filter(L=>L.kind==="tree-item"?(process.env.NODE_ENV!=="production"&&console.warn("Unsupported tree-item child skipped inside submenu/subpage."),!1):!0),{deep:r,includeInDeepSearch:t,disabledBranchBehavior:a,descendantsIncluded:!0,breadcrumbs:y,group:null,radioGroup:null,inheritedKeywords:l}))}}}}return i}function Wn(e,o,r,t,a,n,c){let p=$o(e.children).filter(g=>!g.def.hidden),m={depth:t,hasChildren:p.length>0,isLastChild:c,ancestorsLast:a,header:e.def.selectable===!1},l=[{kind:"row",node:e,context:{search:null,breadcrumbs:n,isDeepSearchResult:!1,highlighted:e.def.id===o,disabled:_nullishCoalesce(e.def.disabled, () => (!1)),group:r,tree:m}}],i={node:e.def,menuNode:e,value:e.def.value,id:e.def.id},d=[...n,i];return p.forEach((g,P)=>{let b=P===p.length-1;if(ge(g,"tree-item")){l.push(...Wn(g,o,r,t+1,[...a,c],d,b));return}l.push({kind:"row",node:g,context:{search:null,breadcrumbs:d,isDeepSearchResult:!1,highlighted:g.def.id===o,disabled:_nullishCoalesce(g.def.disabled, () => (!1)),group:r,tree:{depth:t+1,hasChildren:ge(g,"submenu")&&g.children.length>0,isLastChild:b,ancestorsLast:[...a,c],header:!1}}})}),l}function Un(e,o){let r=[];for(let t of e){if(ge(t,"separator")){r.push({kind:"separator",node:t});continue}if(ge(t,"group")){let n=[],c=t.children.filter(p=>qe(p)&&!p.def.hidden);for(let p of t.children){if(ge(p,"separator")||ge(p,"group")||ge(p,"radio-group")||!qe(p)||p.def.hidden)continue;if(ge(p,"tree-item")){n.push(...Wn(p,o,{id:t.def.id,label:t.def.label},0,[],[],p===c.at(-1)));continue}let m={search:null,breadcrumbs:[],isDeepSearchResult:!1,highlighted:p.def.id===o,disabled:_nullishCoalesce(p.def.disabled, () => (!1)),group:{id:t.def.id,label:t.def.label},tree:null};n.push({kind:"row",node:p,context:m})}if(n.length>0){let p={search:null,matchCount:n.length,breadcrumbs:[],isDeepSearchResult:!1};r.push({kind:"group",node:t,context:p,items:n,bestScore:1})}continue}if(ge(t,"radio-group")){if(t.def.hidden)continue;let n=[];for(let c of t.children){if(!qe(c)||c.def.hidden)continue;let p={search:null,breadcrumbs:[],isDeepSearchResult:!1,highlighted:c.def.id===o,disabled:_nullishCoalesce(c.def.disabled, () => (!1)),group:null,tree:null};n.push({kind:"row",node:c,context:p,radioGroup:{id:t.def.id,label:t.def.label}})}if(n.length>0){let c={search:null,matchCount:n.length,breadcrumbs:[],isDeepSearchResult:!1};r.push({kind:"radio-group",node:t,context:c,items:n,bestScore:1})}continue}if(!qe(t)||t.def.hidden)continue;if(ge(t,"tree-item")){let n=e.filter(c=>qe(c)&&!c.def.hidden);r.push(...Wn(t,o,null,0,[],[],t===n.at(-1)));continue}let a={search:null,breadcrumbs:[],isDeepSearchResult:!1,highlighted:t.def.id===o,disabled:_nullishCoalesce(t.def.disabled, () => (!1)),group:null,tree:null};r.push({kind:"row",node:t,context:a})}return r}function Jr(e,o){return e.disabled?!0:o.some(r=>r.node.kind!=="tree-item"&&r.node.disabled===!0)}function Zn(e,o,r){return e.map(t=>{let a=t.breadcrumbs.length>0,n={search:o?{query:o,score:t.score}:null,breadcrumbs:t.breadcrumbs,isDeepSearchResult:a,highlighted:t.node.def.id===r,disabled:Jr(t.node.def,t.breadcrumbs),group:t.group?{id:t.group.id,label:t.group.label}:null,tree:null};return{kind:"row",node:t.node,context:n,radioGroup:t.radioGroup?{id:t.radioGroup.id,label:t.radioGroup.label}:void 0}})}function yo(e,o,r){let t=e.breadcrumbs.length>0,a={search:o?{query:o,score:e.score}:null,breadcrumbs:e.breadcrumbs,isDeepSearchResult:t,highlighted:e.node.def.id===r,disabled:Jr(e.node.def,e.breadcrumbs),group:e.group?{id:e.group.id,label:e.group.label}:null,tree:null};return{kind:"row",node:e.node,context:a,radioGroup:e.radioGroup?{id:e.radioGroup.id,label:e.radioGroup.label}:void 0}}function Yo(e,o,r=_chunkXMZZ62VJcjs.r){let t=r(o);if(!t)return e.map(({node:n,breadcrumbs:c,group:p,radioGroup:m})=>({node:n,score:1,breadcrumbs:c,group:p,radioGroup:m}));let a=[];for(let{node:n,breadcrumbs:c,group:p,radioGroup:m,inheritedKeywords:l}of e){let i=_chunkXMZZ62VJcjs.r.call(void 0, n.def.value),d=[..._nullishCoalesce(n.def.keywords, () => ([])),...l].map(b=>_chunkXMZZ62VJcjs.r.call(void 0, b)).filter(Boolean),g=_chunkXMZZ62VJcjs.w.call(void 0, i,t,d.length>0?d:void 0),P=_nullishCoalesce(n.def.forceScore, () => (g));P>0&&a.push({node:n,score:P,breadcrumbs:c,group:p,radioGroup:m})}return a}function wt(e){return _nullishCoalesce(e.forceOrder, () => (0))}function Kt(e,o){let r=wt(e.node.def)-wt(o.node.def);return r!==0?r:o.score-e.score}function $n(e){return e==="submenu"||e==="subpage"?1:0}function Yn(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 Xo(e){if(e.length===0)return 0;let o=Number.POSITIVE_INFINITY;for(let r of e){let t=wt(r.node.def);t<o&&(o=t)}return o===Number.POSITIVE_INFINITY?0:o}function Xn(e){return[...e].sort(Kt)}function _n(e){let o=new Map;for(let a of e){let n=wt(a.node.def),c=_nullishCoalesce(o.get(n), () => ({items:[],branches:[]}));a.node.kind==="item"||a.node.kind==="link-item"||a.node.kind==="radio-item"||a.node.kind==="checkbox-item"||a.node.kind==="tree-item"?c.items.push(a):c.branches.push(a),o.set(n,c)}let r=[...o.keys()].sort((a,n)=>a-n),t=[];for(let a of r){let n=o.get(a);n&&t.push(...n.items,...n.branches)}return t}function Jn(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 es=e=>e;function ga(e){let{query:o,normalizeQuery:r,nodes:t,highlightedId:a,deepSearch:n=!0,includeInDeepSearch:c=!0,disabledBranchBehavior:p="exclude",minLength:m=0,radioGroupSearchBehavior:l="preserve"}=e,i=n&&o.length>=m,d=Rt(t,{deep:i,includeInDeepSearch:c,disabledBranchBehavior:p}),g=new Map;if(l==="preserve-show-all"){for(let s of d)if(s.radioGroup){let u=g.get(s.radioGroup.id);u?u.items.push(s):g.set(s.radioGroup.id,{radioGroupDef:s.radioGroup.radioGroupDef,menuNode:s.radioGroup.menuNode,items:[s],breadcrumbs:s.breadcrumbs})}}let P=Yo(d,o,r),b=new Map,R=[];for(let s of P)if(s.radioGroup)if(l==="flatten")R.push(s);else{let u=b.get(s.radioGroup.id);u?u.items.push(s):b.set(s.radioGroup.id,{radioGroupDef:s.radioGroup.radioGroupDef,menuNode:s.radioGroup.menuNode,items:[s],breadcrumbs:s.breadcrumbs})}else R.push(s);let y=Xn(R),L=_n(y),I=Jn(L),D=Zn(I,o,a),M=[];if(l!=="flatten")for(let[s,{items:u,breadcrumbs:h}]of b){let S;if(l==="preserve-show-all"){let f=g.get(s);if(f){let G=new Map(u.map(O=>[O.node.id,O.score]));S=f.items.map(O=>({node:O.node,score:_nullishCoalesce(G.get(O.node.id), () => (0)),breadcrumbs:O.breadcrumbs,group:O.group,radioGroup:O.radioGroup}))}else S=u}else S=u;S.sort(Kt);let w=Math.max(...S.map(f=>f.score),0),B=h.length>0,T={search:o?{query:o,bestScore:w}:null,matchCount:u.length,breadcrumbs:h,isDeepSearchResult:B};M.push({kind:"radio-group",node:b.get(s).menuNode,context:T,items:S.map(f=>yo(f,o,a)),bestScore:w})}let k=[...D.map(s=>({node:s,score:_nullishCoalesce(_optionalChain([s, 'access', _129 => _129.context, 'access', _130 => _130.search, 'optionalAccess', _131 => _131.score]), () => (0)),forceOrder:wt(s.node.def),kindRank:$n(s.node.kind)})),...M.map(s=>({node:s,score:s.bestScore,forceOrder:Xo(s.items),kindRank:0}))];return k.sort(Yn),{displayNodes:k.map(s=>s.node),isDeepSearching:i}}function ba(e){let{query:o,normalizeQuery:r,nodes:t,highlightedId:a,deepSearch:n=!0,includeInDeepSearch:c=!0,disabledBranchBehavior:p="exclude",minLength:m=0,sortGroups:l=!0,radioGroupSearchBehavior:i="preserve"}=e,d=n&&o.length>=m,g=Rt(t,{deep:d,includeInDeepSearch:c,disabledBranchBehavior:p}),P=new Map;if(i==="preserve-show-all"){for(let s of g)if(s.radioGroup){let u=P.get(s.radioGroup.id);u?u.items.push(s):P.set(s.radioGroup.id,{radioGroupDef:s.radioGroup.radioGroupDef,menuNode:s.radioGroup.menuNode,items:[s],breadcrumbs:s.breadcrumbs})}}let b=Yo(g,o,r),R=new Map,y=new Map,L=[];for(let s of b)if(s.radioGroup)if(i==="flatten")L.push(s);else{let u=y.get(s.radioGroup.id);u?u.items.push(s):y.set(s.radioGroup.id,{radioGroupDef:s.radioGroup.radioGroupDef,menuNode:s.radioGroup.menuNode,items:[s],breadcrumbs:s.breadcrumbs})}else if(s.group){let u=R.get(s.group.id);u?u.items.push(s):R.set(s.group.id,{groupDef:s.group.groupDef,menuNode:s.group.menuNode,items:[s],breadcrumbs:s.breadcrumbs})}else L.push(s);let I=[];for(let[s,{items:u,breadcrumbs:h}]of R){u.sort(Kt);let S=Math.max(...u.map(T=>T.score),0),w=h.length>0,B={search:o?{query:o,bestScore:S}:null,matchCount:u.length,breadcrumbs:h,isDeepSearchResult:w};I.push({kind:"group",node:R.get(s).menuNode,context:B,items:u.map(T=>yo(T,o,a)),bestScore:S})}let D=[];if(i!=="flatten")for(let[s,{items:u,breadcrumbs:h}]of y){let S;if(i==="preserve-show-all"){let f=P.get(s);if(f){let G=new Map(u.map(O=>[O.node.id,O.score]));S=f.items.map(O=>({node:O.node,score:_nullishCoalesce(G.get(O.node.id), () => (0)),breadcrumbs:O.breadcrumbs,group:O.group,radioGroup:O.radioGroup}))}else S=u}else S=u;S.sort(Kt);let w=Math.max(...S.map(f=>f.score),0),B=h.length>0,T={search:o?{query:o,bestScore:w}:null,matchCount:u.length,breadcrumbs:h,isDeepSearchResult:B};D.push({kind:"radio-group",node:y.get(s).menuNode,context:T,items:S.map(f=>yo(f,o,a)),bestScore:w})}let M=L.sort(Kt).map(s=>yo(s,o,a)),k=[...I.map(s=>({node:s,score:s.bestScore,forceOrder:Xo(s.items),kindRank:0})),...D.map(s=>({node:s,score:s.bestScore,forceOrder:Xo(s.items),kindRank:0})),...M.map(s=>({node:s,score:_nullishCoalesce(_optionalChain([s, 'access', _132 => _132.context, 'access', _133 => _133.search, 'optionalAccess', _134 => _134.score]), () => (0)),forceOrder:wt(s.node.def),kindRank:$n(s.node.kind)}))];return l&&k.sort(Yn),{displayNodes:k.map(s=>s.node),isDeepSearching:d}}function er(e){let{query:o,nodes:r,highlightedId:t,groupSearchBehavior:a="preserve"}=e,c=(_nullishCoalesce(e.normalizeQuery, () => ((0, _chunkXMZZ62VJcjs.r))))(o),p=c===o?{...e,normalizeQuery:es}:{...e,query:c,normalizeQuery:es};return c?a==="preserve"?ba(p):ga(p):{displayNodes:Un(r,t),isDeepSearching:!1}}function tr(e,o,r,t,a){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:a})},n):_jsxruntime.jsx.call(void 0, Qn,{id:n,children:o},n)}function ha(e){let o=[];for(let r of e)if(So(r))for(let t of r.items)!t.context.disabled&&t.node.id&&o.push(t.node.id);else if(Po(r))for(let t of r.items)!t.context.disabled&&t.node.id&&o.push(t.node.id);else xo(r)||!r.context.disabled&&r.node.id&&o.push(r.node.id);return o}function Ra(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 or(e){return e.map(o=>_nullishCoalesce(o.id, () => (o.value))).join(">")}function ts(e){return So(e)?`group:${e.node.def.id}:${or(e.context.breadcrumbs)}`:Po(e)?`radio-group:${e.node.def.id}:${or(e.context.breadcrumbs)}`:xo(e)?`separator:${_nullishCoalesce(e.node.def.id, () => ("separator"))}`:`row:${e.node.def.kind}:${_nullishCoalesce(e.node.def.id, () => (""))}:${e.node.def.value}:${or(e.context.breadcrumbs)}`}var Sa=e=>e;function Pa(e,o){let r=e.map(i=>[ts(i),i]),t=new Map(r),a=r.map(([i])=>i),n=o.filter(i=>t.has(i)),c=new Set(n),p=a.filter(i=>!c.has(i)),m=[...n,...p];return{orderedNodes:m.map(i=>t.get(i)).filter(i=>i!==void 0),nextOrder:m}}function xa(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 nr(e,o){let r=_nullishCoalesce(e.minQueryLength, () => (1)),t=xa(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 ya({info:e,query:o,enabled:r}){let t=It(),{config:a,id:n}=e,c=a.Loader,p=_.useMemo(()=>a.type!=="query"?null:nr(a,o),[a,o]),m=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _135 => _135.effectiveQuery]), () => (o)),l=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _136 => _136.enabled]), () => (!0));return r||Zo(a)?_jsxruntime.jsx.call(void 0, c,{query:m,enabled:l,children:d=>_jsxruntime.jsx.call(void 0, os,{kind:"branch",id:n,config:a,result:d,coordinator:t})}):null}function os({kind:e,id:o,config:r,result:t,coordinator:a}){let n=_.useRef(r),c=_.useRef(a),p=_.useRef(t),m=_.useRef(null);return n.current=r,c.current=a,p.current=t,_.useEffect(()=>{let l=c.current;if(l)return e==="root"?l.registerRootLoader({config:n.current,result:p.current}):l.registerLoader({id:o,config:n.current,result:p.current}),()=>{e==="root"?l.unregisterRootLoader():l.unregisterLoader(o)}},[e,o]),_.useEffect(()=>{let l=c.current;if(!l)return;let i=m.current;(i===null||i.data!==t.data||i.status!==t.status||i.fetchStatus!==t.fetchStatus||i.loadingPhase!==t.loadingPhase||i.isLoading!==t.isLoading||i.isFetching!==t.isFetching||i.isInitialLoading!==t.isInitialLoading||i.isRefetching!==t.isRefetching||i.isPending!==t.isPending||i.isSuccess!==t.isSuccess||i.isError!==t.isError||i.isPaused!==t.isPaused||i.hasData!==t.hasData||i.hasFetched!==t.hasFetched||i.error!==t.error)&&(m.current={data:t.data,status:t.status,fetchStatus:t.fetchStatus,loadingPhase:t.loadingPhase,isLoading:t.isLoading,isFetching:t.isFetching,isInitialLoading:t.isInitialLoading,isRefetching:t.isRefetching,isPending:t.isPending,isSuccess:t.isSuccess,isError:t.isError,isPaused:t.isPaused,hasData:t.hasData,hasFetched:t.hasFetched,error:t.error},e==="root"?l.updateRootLoaderResult(t):l.updateLoaderResult(o,t))},[e,o,t.data,t.status,t.fetchStatus,t.loadingPhase,t.isLoading,t.isFetching,t.isInitialLoading,t.isRefetching,t.isPending,t.isSuccess,t.isError,t.isPaused,t.hasData,t.hasFetched,t.error]),null}function Ma({query:e}){let o=En(),r=It(),{asyncContent:t}=o,a=_.useMemo(()=>_optionalChain([t, 'optionalAccess', _137 => _137.type])!=="query"?null:nr(t,e),[t,e]),n=_nullishCoalesce(_optionalChain([a, 'optionalAccess', _138 => _138.effectiveQuery]), () => (e)),c=_nullishCoalesce(_optionalChain([a, 'optionalAccess', _139 => _139.enabled]), () => (!0));if(!t)return null;let p=t.Loader;return _jsxruntime.jsx.call(void 0, p,{query:n,enabled:c,children:m=>_jsxruntime.jsx.call(void 0, os,{kind:"root",config:t,result:m,coordinator:r})})}var ns=_.forwardRef(function(o,r){let{children:t,content:a,asyncContent:n,deepSearchConfig:c,includeInDeepSearch:p,search:m,normalizedSearch:l,store:i,label:d="Menu",remeasureDependencies:g,...P}=o,b=Ko(),{setResolvedNodes:R}=Eo(),y=Ar(),{depth:L}=_chunkXMZZ62VJcjs.j.call(void 0, ),I=pt(),D=so(),M=!!(I&&_optionalChain([D, 'optionalAccess', _140 => _140.getSurfaceId, 'call', _141 => _141(I.pageId)])),k=L===0&&!M,s=It(),u=_nullishCoalesce(c.minLength, () => (0)),h=c.enabled!==!1&&l.length>=u,{nodes:S,graftVersion:w,asyncSubmenus:B}=_r({resolver:b,content:a,asyncContent:n,coordinator:s,graftParent:y,isSubpageSurface:M,isResolutionRoot:k,includeInDeepSearch:p,disabledBranchBehavior:c.disabledBranchBehavior}),T=h||B.some(K=>Zo(K.config))||n&&n.loadStrategy==="eager";_.useEffect(()=>{M||R({nodes:S,graftVersion:w,content:a})},[M,R,S,w,a]);let f=_.useRef(0);_.useEffect(()=>{!M||w===0||f.current!==w&&(f.current=w,R(K=>K&&{...K,graftVersion:K.graftVersion+1}))},[M,R,w]);let G=_.useRef(null),{displayNodes:O,isDeepSearching:v}=_.useMemo(()=>{let K=er({query:l,normalizeQuery:Sa,nodes:S,highlightedId:null,deepSearch:c.enabled,includeInDeepSearch:p,disabledBranchBehavior:c.disabledBranchBehavior,minLength:c.minLength,groupSearchBehavior:c.groupSearchBehavior,radioGroupSearchBehavior:c.radioGroupSearchBehavior,sortGroups:c.sortGroups}),V=_nullishCoalesce(c.asyncResultBehavior, () => ("stream")),C=B.length+(n?1:0),j=C>0,F=V==="block"&&K.isDeepSearching&&j&&s!==null&&(s.loaders.size+(s.root?1:0)<C||s.isAnyLoading),X=K.displayNodes;if(F)G.current=null,X=[];else if(V==="stream"&&K.isDeepSearching){let te=G.current;if(!te||te.query!==l)G.current={query:l,order:X.map(ts)};else{let{orderedNodes:J,nextOrder:fe}=Pa(X,te.order);X=J,G.current={query:l,order:fe}}}else G.current=null;return{displayNodes:X,isDeepSearching:K.isDeepSearching}},[l,S,w,c,p,B.length,n,s,_optionalChain([s, 'optionalAccess', _142 => _142.isAnyLoading]),_optionalChain([s, 'optionalAccess', _143 => _143.loaders])]),A=_.useRef([]),x=_.useRef(null),N=_.useRef("replace"),z=_.useMemo(()=>ha(O),[O]),E=_.useMemo(()=>{let K=A.current,V=z;if(K.length!==V.length||K.some((j,F)=>j!==V[F])){let F=(_nullishCoalesce(c.asyncResultBehavior, () => ("stream")))==="stream"&&v&&x.current===l&&Ra(K,V);return N.current=F?"append":"replace",A.current=V,x.current=l,V}return K},[z,c.asyncResultBehavior,v,l]);_.useEffect(()=>{i.setOrderedItems(E,{reason:N.current})},[i,E]);let U=_.useCallback(K=>{let V=K.node,C=V.def,{context:j}=K,F=V.id,X=te=>{if(!te.def.asyncNodes||!s)return;let J=s.loaders.get(te.id);if(!J)return;let fe=te.def.asyncNodes.type==="query"?nr(te.def.asyncNodes,l).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:F,value:C.value,disabled:j.disabled,closeOnClick:C.closeOnClick,onSelect:C.onSelect,shortcut:C.shortcut,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...j,value:C.value}})},F);if(C.kind==="link-item")return _jsxruntime.jsx.call(void 0, _.Fragment,{children:C.render({node:V,props:{id:F,value:C.value,href:C.href,disabled:j.disabled,closeOnClick:C.closeOnClick,onSelect:C.onSelect,shortcut:C.shortcut,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...j,value:C.value}})},F);if(C.kind==="tree-item")return _jsxruntime.jsx.call(void 0, _.Fragment,{children:C.render({node:V,props:{id:F,value:C.value,disabled:j.disabled,selectable:C.selectable!==!1,closeOnClick:C.closeOnClick,onSelect:C.onSelect,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...j,value:C.value}})},F);if(C.kind==="radio-item")return _jsxruntime.jsx.call(void 0, _.Fragment,{children:C.render({node:V,props:{id:F,value:C.value,disabled:j.disabled,closeOnClick:C.closeOnClick,onSelect:C.onSelect,shortcut:C.shortcut,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...j,value:C.value}})},F);if(C.kind==="checkbox-item")return _jsxruntime.jsx.call(void 0, _.Fragment,{children:C.render({node:V,props:{id:F,value:C.value,checked:C.checked,onCheckedChange:C.onCheckedChange,disabled:j.disabled,closeOnClick:C.closeOnClick,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...j,value:C.value,checked:C.checked}})},F);if(C.kind==="submenu"){let te=X(V),J=lt(V),fe={node:C,menuNode:V,value:C.value,id:C.id},Oe=We=>{let me=We,ie=We.def;if(ie.kind==="separator")return null;if(ie.kind==="group"){let Xe=me.children.filter(ye=>qe(ye)&&(ye.kind==="item"||ye.kind==="link-item"||ye.kind==="checkbox-item"||ye.kind==="submenu"||ye.kind==="subpage")&&!ye.def.hidden);if(Xe.length===0)return null;let we=Xe.map(ye=>{let Z={search:null,breadcrumbs:[...j.breadcrumbs,fe],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(ye.def.disabled, () => (!1)),group:{id:ie.id,label:ie.label},tree:null};return U({kind:"row",node:ye,context:Z})});if(ie.render){let ye={search:null,matchCount:Xe.length,breadcrumbs:[...j.breadcrumbs,fe],isDeepSearchResult:!1};return _jsxruntime.jsx.call(void 0, _.Fragment,{children:ie.render({node:me,props:{},context:{...ye,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,[...j.breadcrumbs,fe]);if(ie.kind!=="item"&&ie.kind!=="link-item"&&ie.kind!=="checkbox-item"&&ie.kind!=="submenu"&&ie.kind!=="subpage")return null;let Fe={search:null,breadcrumbs:[...j.breadcrumbs,fe],isDeepSearchResult:!1,highlighted:!1,disabled:_nullishCoalesce(ie.disabled, () => (!1)),group:null,tree:null};return U({kind:"row",node:me,context:Fe})};return _jsxruntime.jsx.call(void 0, _.Fragment,{children:_jsxruntime.jsx.call(void 0, lo.Provider,{value:V,children:C.render({node:V,props:{id:F,value:C.value,disabled:j.disabled,forceOrder:C.forceOrder,forceScore:C.forceScore},context:{...j,value:C.value,async:te},nodes:J,asyncContent:C.asyncNodes,renderNode:Oe})})},F)}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:F,value:C.value,disabled:j.disabled,targetPageId:J},context:{...j,value:C.value,async:te}})},F)}return null},[s,l,v]),$=_.useCallback((K,V=[])=>{let C=K.def,j=V.length>0,F={search:null,matchCount:C.nodes.length,breadcrumbs:V,isDeepSearchResult:j},X=K.children.map(te=>{if(!qe(te)||te.def.hidden)return null;let J={search:null,breadcrumbs:V,isDeepSearchResult:j,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:K,props:{value:C.value,onValueChange:C.onValueChange,disabled:_nullishCoalesce(C.disabled, () => (!1))},context:{...F,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:[tr(C.id,C.label,C.renderLabel,K,{...F,label:C.label,value:C.value,disabled:_nullishCoalesce(C.disabled, () => (!1))}),X]},C.id)},[U]),re=_.useCallback(K=>{if(So(K)){let V=K.node,{context:C,items:j}=K,F=V.def,X=j.map(te=>U(te));return F.render?_jsxruntime.jsx.call(void 0, _.Fragment,{children:F.render({node:V,props:{},context:{...C,label:F.label},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:X})})},F.id):_jsxruntime.jsxs.call(void 0, "div",{role:"group","aria-label":F.label,children:[tr(F.id,F.label,F.renderLabel,V,{...C,label:F.label}),X]},F.id)}if(Po(K)){let V=K.node,{context:C,items:j}=K,F=V.def,X=j.map(te=>U(te));return F.render?_jsxruntime.jsx.call(void 0, _.Fragment,{children:F.render({node:V,props:{value:F.value,onValueChange:F.onValueChange,disabled:_nullishCoalesce(F.disabled, () => (!1))},context:{...C,label:F.label,value:F.value,disabled:_nullishCoalesce(F.disabled, () => (!1))},children:_jsxruntime.jsx.call(void 0, _jsxruntime.Fragment,{children:X})})},F.id):_jsxruntime.jsxs.call(void 0, "div",{role:"radiogroup","aria-label":F.label,children:[tr(F.id,F.label,F.renderLabel,V,{...C,label:F.label,value:F.value,disabled:_nullishCoalesce(F.disabled, () => (!1))}),X]},F.id)}if(xo(K)){let V=K.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(K)},[U]),H=_.useMemo(()=>s?s.getAsyncState():{isLoading:!1,isFetching:!1,isInitialLoading:!1,isRefetching:!1,isAllRefetching:!1,isStaticLoading:!1,isStaticInitialLoading:!1,isStaticRefetching:!1,isQueryLoading:!1,isQueryInitialLoading:!1,isQueryRefetching:!1,skippedMenus:[]},[s,_optionalChain([s, 'optionalAccess', _144 => _144.loaders]),_optionalChain([s, 'optionalAccess', _145 => _145.erroredLoaders]),_optionalChain([s, 'optionalAccess', _146 => _146.root])]),ne=_.useMemo(()=>({search:m,nodes:O,renderNode:re,count:O.length,isDeepSearching:v,async:H}),[m,O,re,v,H]);return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[T&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, Ma,{query:l}),B.map(K=>_jsxruntime.jsx.call(void 0, ya,{info:K,query:l,enabled:h},K.id))]}),_jsxruntime.jsx.call(void 0, po.Provider,{value:ne,children:_jsxruntime.jsx.call(void 0, rr,{ref:r,label:d,...P,remeasureDependencies:[v,..._nullishCoalesce(g, () => ([]))],children:t})})]})});var sr=(o=>(o.rowWidth="--row-width",o))(sr||{});var rr=Ce.forwardRef(function(o,r){let{children:t,label:a="Suggestions",measureRowWidth:n=!0,maxRowWidth:c,scrollContainerRef:p,remeasureDependencies:m,render:l,className:i,style:d,onKeyDown:g,onPointerDown:P,...b}=o,{store:R,surfaceId:y}=_chunkXMZZ62VJcjs.p.call(void 0, ),{depth:L,closeAll:I}=_chunkXMZZ62VJcjs.j.call(void 0, ),D=Ke(),M=pt(),{disabled:k}=Te(),s=Pe(),u=jt(),h=Ce.useRef(null),S=Ce.useRef(null);Ce.useEffect(()=>{R.setListRef(h)},[R]),Ce.useEffect(()=>{if(p)return R.setListScrollContainerRef(p),()=>{R.setListScrollContainerRef({current:null})}},[R,p]),Ce.useLayoutEffect(()=>{if(!n||!h.current)return;let j=h.current.closest("[data-open]");S.current=j},[n]);let{queueMeasurement:w,resetMeasurements:B,clearMeasuredIds:T}=_chunkXMZZ62VJcjs.v.call(void 0, {listRef:h,targetRef:S,maxWidth:c,enabled:n}),f=Ce.useRef(null),G=Ce.useRef(!1);Ce.useEffect(()=>{let j=_nullishCoalesce(f.current, () => ([])),F=G.current;if(f.current=_nullishCoalesce(m, () => (null)),G.current=!0,!n||!F)return;let X=_nullishCoalesce(m, () => ([]));if(j.length!==X.length||X.some((J,fe)=>!Object.is(J,j[fe]))){T();for(let[J,fe]of R.context.refs.itemRefs)fe.current&&w(fe.current,J)}}),Ce.useEffect(()=>{if(n)return R.context.onCloseComplete=B,()=>{R.context.onCloseComplete=void 0}},[n,B,R]);let O=Ce.useMemo(()=>n?{queueMeasurement:w}:null,[n,w]),v=R.useState("search"),A=R.useState("filteredCount"),x=R.useState("hasInput"),N=R.useState("highlightedId"),z=R.context.listId,E=!x&&!k,{handleKeyDown:U}=Ro({store:R,surfaceId:y,focusOwnerStore:s,depth:L,submenuContext:D,subpageContext:M,enabled:E,disabled:k,enableTypeToSearch:!0,onKeyDown:g,closeAll:I}),$=Ce.useCallback(j=>{j.target instanceof HTMLInputElement||j.preventDefault(),_optionalChain([P, 'optionalCall', _147 => _147(j)])},[P]),re=Ce.useMemo(()=>({search:v,filteredCount:A}),[v,A]),H=typeof t=="function"?t(re):t,ne=O?_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.l.Provider,{value:O,children:H}):H,K=_optionalChain([u, 'optionalAccess', _148 => _148.layout])==="input-embedded",V=q(),C=W(V,"list");return _userender.useRender.call(void 0, {render:l,ref:[h,r],props:{...b,...C?{[C]:""}:{},id:z,role:"listbox","aria-label":a,"aria-activedescendant":E?_nullishCoalesce(N, () => (void 0)):void 0,tabIndex:E?0:-1,"data-popup-menu-list":"","data-input-embedded":K?"":void 0,className:i,style:d,onKeyDown:U,onPointerDown:$,children:ne},defaultTagName:"div"})}),va= exports.ca =Ce.forwardRef(function(o,r){let t=An(),{store:a}=_chunkXMZZ62VJcjs.p.call(void 0, ),n=a.useState("search"),c=a.useState("normalizedSearch");return t?_jsxruntime.jsx.call(void 0, ns,{ref:r,...o,content:t.content,asyncContent:t.asyncContent,deepSearchConfig:t.deepSearchConfig,includeInDeepSearch:t.includeInDeepSearch,search:n,normalizedSearch:c,store:a}):_jsxruntime.jsx.call(void 0, rr,{ref:r,...o})});var Ia={first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null},Da= exports.da =rt.forwardRef(function(o,r){let{forceMount:t=!1,render:a,className:n,style:c,children:p,...m}=o,{store:l}=_chunkXMZZ62VJcjs.p.call(void 0, ),i=rt.useId(),[d,g]=rt.useState(null);rt.useLayoutEffect(()=>{if(d)return l.registerRow(i,d,{kind:"loading"})},[d,i,l]);let P=q(),b=W(P,"loading"),R=fo(),y=R?R.isRootLoading||R.isAnyLoading&&R.searchQuery.length>0:!1,L=t||y,I=l.useState("isFirstRow",i),D=l.useState("isLastRow",i),M=rt.useMemo(()=>({first:I,last:D}),[I,D]),k=_userender.useRender.call(void 0, {render:a,ref:[g,r],state:M,stateAttributesMapping:Ia,props:{...m,...b?{[b]:""}:{},role:"presentation",className:n,style:c,children:p},defaultTagName:"div"});return L?k:null});var rs={slot:"bazzaui-[component]-scroll-[up|down]-arrow",direction:"data-direction",side:"data-side"};var Na={direction:e=>e?{[rs.direction]:String(e)}:null,visible:e=>({"data-visible":e?"true":"false"})},ss=ke.forwardRef(function(o,r){let{direction:t,keepMounted:a=!1,scrollSpeed:n=10,render:c,className:p,style:m,children:l,...i}=o,{store:d}=_chunkXMZZ62VJcjs.p.call(void 0, ),[g,P]=ke.useState(!1),b=ke.useRef(!1),R=ke.useRef(null),L=d.useState("openMethod")==="touch",I=ke.useCallback(()=>{if(L){P(!1);return}let B=_optionalChain([d, 'access', _149 => _149.context, 'access', _150 => _150.refs, 'access', _151 => _151.listRef, 'optionalAccess', _152 => _152.current]);if(!B){P(!1);return}if(t==="up")P(B.scrollTop>0);else{let T=B.scrollTop+B.clientHeight>=B.scrollHeight-1;P(!T)}},[d,t,L]);ke.useEffect(()=>{let B=_optionalChain([d, 'access', _153 => _153.context, 'access', _154 => _154.refs, 'access', _155 => _155.listRef, 'optionalAccess', _156 => _156.current]);if(!B)return;I(),B.addEventListener("scroll",I,{passive:!0});let T=new ResizeObserver(I);return T.observe(B),()=>{B.removeEventListener("scroll",I),T.disconnect()}},[d,I]);let D=d.useState("filteredCount");ke.useEffect(()=>{requestAnimationFrame(I)},[D,I]);let M=ke.useCallback(()=>{b.current=!0;let w=()=>{if(!b.current)return;let T=_optionalChain([d, 'access', _157 => _157.context, 'access', _158 => _158.refs, 'access', _159 => _159.listRef, 'optionalAccess', _160 => _160.current]);if(T){let f=t==="up"?-n:n;T.scrollTop+=f}R.current=requestAnimationFrame(w)};R.current=requestAnimationFrame(w)},[d,t,n]),k=ke.useCallback(()=>{b.current=!1,R.current&&(cancelAnimationFrame(R.current),R.current=null)},[]);ke.useEffect(()=>()=>{R.current&&cancelAnimationFrame(R.current)},[]);let s=ke.useMemo(()=>({direction:t,visible:g}),[t,g]),u=g||a,h=q(),S=W(h,t==="up"?"scroll-up-arrow":"scroll-down-arrow");return _userender.useRender.call(void 0, {render:c,ref:r,state:s,stateAttributesMapping:Na,props:{...i,...S?{[S]:""}:{},className:p,style:m,onPointerEnter:w=>{M(),_optionalChain([i, 'access', _161 => _161.onPointerEnter, 'optionalCall', _162 => _162(w)])},onPointerLeave:w=>{k(),_optionalChain([i, 'access', _163 => _163.onPointerLeave, 'optionalCall', _164 => _164(w)])},children:l},defaultTagName:"div",enabled:u})}),La= exports.ea =ke.forwardRef(function(o,r){return _jsxruntime.jsx.call(void 0, ss,{ref:r,direction:"up",...o})}),Oa= exports.fa =ke.forwardRef(function(o,r){return _jsxruntime.jsx.call(void 0, ss,{ref:r,direction:"down",...o})});var _useStableCallback = require('@base-ui/utils/useStableCallback');var us="a[href], button, input, select, textarea, [tabindex]";function _o(e){let o=Array.from(e.querySelectorAll(us));return(e.matches(us)?[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 Ea({children:e}){let{store:o}=_chunkXMZZ62VJcjs.p.call(void 0, ),r=o.useState("normalizedSearch");return _jsxruntime.jsx.call(void 0, Fr,{searchQuery:r,children:e})}var Aa=ue.forwardRef(function(o,r){let{filter:t=_chunkXMZZ62VJcjs.x,normalizeSearch:a=_chunkXMZZ62VJcjs.r,search:n,onSearchChange:c,defaultSearch:p="",loop:m=!0,autoHighlightFirst:l=!0,clearSearchOnClose:i="after-exit",resetScrollOnSearch:d=!0,skipAutoFocus:g=!1,orderedItems:P,content:b,asyncContent:R,deepSearch:y,includeInDeepSearch:L=!0,render:I,className:D,style:M,onKeyDown:k,onFocus:s,onPointerDown:u,onPointerMove:h,children:S,...w}=o,B=ue.useMemo(()=>_optionalChain([b, 'optionalAccess', _165 => _165.map, 'call', _166 => _166(ee=>vn(ee)?ee.def:ee)]),[b]),T=b!==void 0||R!==void 0||y!==void 0||o.includeInDeepSearch!==void 0,{store:f,depth:G,virtualization:O}=_chunkXMZZ62VJcjs.j.call(void 0, );f.initializeDefaultSearch(p);let v=Ke(),A=pt(),x=so(),N=Pe(),z=ue.useRef(0),E=ue.useId(),U=ue.useId(),$=ue.useId(),H=_nullishCoalesce(_nullishCoalesce(wr(), () => (_optionalChain([v, 'optionalAccess', _167 => _167.childSurfaceId]))), () => ($)),ne=zo(),K=ue.useMemo(()=>x?A&&x.getSurfaceId(A.pageId)?x.activePageId===A.pageId:x.activePageId===null:!0,[x,A]),V=N.useState("isOwner",H),C=_useStableCallback.useStableCallback.call(void 0, ee=>{_optionalChain([c, 'optionalCall', _168 => _168(ee)])});ue.useEffect(()=>{f.context.filter=T?!1:t,f.setSearchNormalizer(a),f.context.loop=m,f.context.autoHighlightFirst=l,f.context.clearSearchOnClose=i,f.context.resetScrollOnSearch=d,f.context.listId=E,f.context.inputId=U,f.context.onSearchChange=C,O&&(f.setVirtualized(O.virtualized),f.setVirtualItems(O.items),f.setOnHighlightChange(O.onHighlightChange)),typeof l=="string"&&f.applyAutoHighlight()},[f,t,a,m,l,i,d,E,U,C,O,T]);let j=Te(),F=ue.useMemo(()=>typeof y=="boolean"||y===void 0?{enabled:_nullishCoalesce(y, () => (!0)),minLength:0,groupSearchBehavior:"preserve",radioGroupSearchBehavior:"preserve",sortGroups:!0,asyncResultBehavior:"stream",disabledBranchBehavior:"exclude"}:{enabled:_nullishCoalesce(y.enabled, () => (!0)),minLength:_nullishCoalesce(y.minLength, () => (0)),groupSearchBehavior:_nullishCoalesce(y.groupSearchBehavior, () => ("preserve")),radioGroupSearchBehavior:_nullishCoalesce(y.radioGroupSearchBehavior, () => ("preserve")),sortGroups:_nullishCoalesce(y.sortGroups, () => (!0)),asyncResultBehavior:_nullishCoalesce(y.asyncResultBehavior, () => ("stream")),disabledBranchBehavior:_nullishCoalesce(y.disabledBranchBehavior, () => ("exclude"))},[y]),X=ue.useId(),te=ue.useMemo(()=>({content:_nullishCoalesce(B, () => ([])),asyncContent:R,deepSearchConfig:F,includeInDeepSearch:L,listId:X}),[B,R,F,L,X]),fe=_optionalChain([Er, 'call', _169 => _169(), 'optionalAccess', _170 => _170.setDataSurfaceContext]),Oe=!!(A&&_optionalChain([x, '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&&f.setOrderedItems(P)},[f,P]),f.useControlledProp("searchProp",n);let We=f.useState("open"),me=ue.useRef(null);ue.useEffect(()=>{We&&(z.current=Date.now())},[We]),ue.useEffect(()=>{K&&G===0&&We&&N.setOwnerId(H)},[G,We,H,N,K]),ue.useEffect(()=>{if(!(!ne||!K)&&j.explicitTabBehavior)return ne.registerSurface(H,{parentSurfaceId:_nullishCoalesce(_optionalChain([v, 'optionalAccess', _173 => _173.parentSurfaceId]), () => (null)),close:v?()=>{v.suppressAutoOpenRef.current=!0,v.setOpen(!1)}:()=>{}})},[ne,K,j.explicitTabBehavior,H,v]);let ie=ue.useRef(!1);ue.useEffect(()=>{(!K||!We)&&(ie.current=!1)},[K,We]),ue.useEffect(()=>{if(!K||!V||g)return;let ee=setTimeout(()=>{requestAnimationFrame(()=>{if(!me.current)return;let Ze=_nullishCoalesce(_optionalChain([ne, 'optionalAccess', _174 => _174.getZoneElements, 'call', _175 => _175(H)]), () => ([])),xt=!ie.current;ie.current=!0;let Nt=Ze.some(gt=>document.activeElement!==null&&gt.contains(document.activeElement));if(j.explicitTabBehavior&&document.activeElement&&me.current.contains(document.activeElement)&&!(xt&&Nt))return;let Lt=Array.from(me.current.querySelectorAll("input")).find(gt=>!Ze.some(Ot=>Ot.contains(gt))),yt=me.current.querySelector('[role="listbox"]'),_e=Ze.flatMap(_o)[0],mt=_nullishCoalesce(_nullishCoalesce(Lt, () => (yt)), () => (_e));mt&&mt instanceof HTMLElement&&mt.focus()})},0);return()=>clearTimeout(ee)},[K,V,g,j.explicitTabBehavior,ne,H]);let Fe=ue.useMemo(()=>({store:f,surfaceId:H}),[f,H]),Xe=ue.useCallback(ee=>{ee.target instanceof HTMLInputElement||ee.preventDefault(),_optionalChain([u, 'optionalCall', _176 => _176(ee)])},[u]),we=ue.useCallback(ee=>{if(_optionalChain([h, 'optionalCall', _177 => _177(ee)]),Date.now()-z.current<100)return;let xt=ee.target;_optionalChain([me, 'access', _178 => _178.current, 'optionalAccess', _179 => _179.contains, 'call', _180 => _180(xt)])&&N.state.ownerId!==H&&N.setOwnerId(H)},[h,H,N]),ye=ue.useCallback(ee=>{if(_optionalChain([k, 'optionalCall', _181 => _181(ee)]),ee.defaultPrevented||ee.key!=="Tab"||!j.explicitTabBehavior)return;let Ze=ee.target;if(!_optionalChain([me, 'access', _182 => _182.current, 'optionalAccess', _183 => _183.contains, 'call', _184 => _184(Ze)]))return;let Nt=(_nullishCoalesce(_optionalChain([ne, 'optionalAccess', _185 => _185.getZoneElements, 'call', _186 => _186(H)]), () => ([]))).flatMap(_o);if(Nt.length===0){if(!ne){if(j.tabWithoutZones==="inert"){ee.preventDefault();return}j.closeAll(_chunkXMZZ62VJcjs.a.focusOut,ee.nativeEvent);return}let Mt=[],Tt=H;for(;;){let Q=ne.getParentSurfaceId(Tt);if(!Q){if(j.tabWithoutZones==="inert"){ee.preventDefault();return}j.closeAll(_chunkXMZZ62VJcjs.a.focusOut,ee.nativeEvent);return}Mt.push(Tt);let oe=ne.getZoneElements(Q).flatMap(_o);if(oe.length>0){ee.preventDefault();for(let Me of Mt)ne.closeSurface(Me);N.setOwnerId(Q),_optionalChain([(ee.shiftKey?oe[oe.length-1]:oe[0]), 'optionalAccess', _187 => _187.focus, 'call', _188 => _188()]);return}Tt=Q}}let $t=f.state.hasInput?f.context.inputId:f.context.listId,Lt=$t?document.getElementById($t):null,yt=new Set;Lt instanceof HTMLElement&&yt.add(Lt);for(let Mt of Nt)yt.add(Mt);let _e=[...yt];ee.preventDefault();let mt=document.activeElement,gt=mt?_e.indexOf(mt):-1,Ot=ee.shiftKey?-1:1;_optionalChain([(gt===-1?ee.shiftKey?_e[_e.length-1]:_e[0]:_e[(gt+Ot+_e.length)%_e.length]), 'optionalAccess', _189 => _189.focus, 'call', _190 => _190()])},[k,j,f,ne,H,N]),Z=ue.useCallback(ee=>{if(_optionalChain([s, 'optionalCall', _191 => _191(ee)]),!j.explicitTabBehavior)return;let Ze=ee.target;_optionalChain([me, 'access', _192 => _192.current, 'optionalAccess', _193 => _193.contains, 'call', _194 => _194(Ze)])&&N.state.ownerId!==H&&N.setOwnerId(H)},[s,j,N,H]),Ue=q(),se=W(Ue,"surface"),De=T?_jsxruntime.jsx.call(void 0, io.Provider,{value:te,children:_jsxruntime.jsx.call(void 0, Ea,{children:S})}):S,Pt=_userender.useRender.call(void 0, {render:I,ref:[me,r],props:{...w,...se?{[se]:""}:{},className:D,style:M,onPointerDown:Xe,onPointerMove:we,onKeyDown:ye,onFocus:Z,children:De},enabled:K,defaultTagName:"div"});return _jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.o.Provider,{value:Fe,children:Pt})});var ur=en.createContext(null);function is(){let e=en.useContext(ur);if(!e)throw new Error("PopupMenu.CheckboxItemIndicator must be used within PopupMenu.CheckboxItem");return e}var Va={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},Ha= exports.ha =Qe.forwardRef(function(o,r){let{id:t,checked:a,defaultChecked:n=!1,onCheckedChange:c,value:p,keywords:m,disabled:l=!1,onSelect:i,forceMount:d=!1,closeOnClick:g=!1,shortcut:P,forceOrder:b,forceScore:R,render:y,className:L,style:I,onClick:D,onPointerDown:M,onPointerMove:k,children:s,...u}=o,[h,S]=Qe.useState(n),w=a!==void 0,B=w?a:h,T=Qe.useCallback(($=_chunkXMZZ62VJcjs.a.itemPress,re)=>{let H=!B,ne=_chunkXMZZ62VJcjs.b.call(void 0, $,re);_optionalChain([c, 'optionalCall', _195 => _195(H,ne)]),!ne.isCanceled&&(w||S(H))},[B,w,c]),f=Ee({id:t,value:p,keywords:m,disabled:l,forceMount:d,shortcut:P,forceOrder:b,forceScore:R,closeOnClick:g,children:s}),G=f.disabled;Qe.useEffect(()=>{let $=()=>{G||(T(),_optionalChain([i, 'optionalCall', _196 => _196()]))};return f.registerSelect($)},[G,T,i,f]);let O=Qe.useMemo(()=>({highlighted:f.isHighlighted,disabled:G,checked:B,first:f.positional.first,last:f.positional.last,firstInGroup:f.positional.firstInGroup,lastInGroup:f.positional.lastInGroup}),[f.isHighlighted,G,B,f.positional]),v=Qe.useMemo(()=>({...f.contextValue,checked:B,toggle:T}),[f.contextValue,B,T]),A=Qe.useCallback($=>{_optionalChain([D, 'optionalCall', _197 => _197($)]),$.defaultPrevented||f.handlers.onClick($)},[D,f.handlers]),x=Qe.useCallback($=>{f.handlers.onPointerDown($),_optionalChain([M, 'optionalCall', _198 => _198($)])},[f.handlers,M]),N=Qe.useCallback($=>{_optionalChain([k, 'optionalCall', _199 => _199($)]),$.defaultPrevented||f.handlers.onPointerMove($)},[k,f.handlers]),z=q(),E=W(z,"checkbox-item"),U=_userender.useRender.call(void 0, {render:y,ref:[f.ref,f.rowRef,r],state:O,stateAttributesMapping:Va,props:{...u,...E?{[E]:""}:{},id:f.id,role:"menuitemcheckbox",tabIndex:-1,"aria-checked":B,"aria-disabled":G||void 0,className:L,style:I,onClick:A,onPointerMove:N,onPointerDown:x,children:s},enabled:f.isVisible,defaultTagName:"div"});return f.isVisible?_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:f.contextValue,children:_jsxruntime.jsx.call(void 0, ur.Provider,{value:v,children:U})}):null});var za={checked:e=>e?{"data-checked":""}:{"data-unchecked":""},disabled:e=>e?{"data-disabled":""}:null},Qa= exports.ia =tn.forwardRef(function(o,r){let{keepMounted:t=!1,render:a,className:n,style:c,children:p,...m}=o,{checked:l,highlighted:i,disabled:d,toggle:g}=is(),P=tn.useMemo(()=>({checked:l,highlighted:i,disabled:d,toggle:g}),[l,i,d,g]),b=t||l,R=q(),y=W(R,"checkbox-item-indicator");return _userender.useRender.call(void 0, {render:a,ref:r,state:P,stateAttributesMapping:za,props:{...m,...y?{[y]:""}:{},"aria-hidden":!0,className:n,style:c,children:p},enabled:b,defaultTagName:"span"})});var qa={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},ir= exports.ja =St.forwardRef(function(o,r){let{id:t,value:a,keywords:n,disabled:c=!1,activatable:p=!0,onSelect:m,forceMount:l=!1,closeOnClick:i=!0,shortcut:d,forceOrder:g,forceScore:P,render:b,className:R,style:y,onClick:L,onPointerDown:I,onPointerMove:D,children:M,...k}=o,s=Ee({id:t,value:a,keywords:n,disabled:c,activatable:p,forceMount:l,shortcut:d,forceOrder:g,forceScore:P,onSelect:m,closeOnClick:i,children:M}),u=s.disabled,h=St.useMemo(()=>({highlighted:s.isHighlighted,disabled:u,first:s.positional.first,last:s.positional.last,firstInGroup:s.positional.firstInGroup,lastInGroup:s.positional.lastInGroup}),[s.isHighlighted,u,s.positional]),S=St.useCallback(O=>{_optionalChain([L, 'optionalCall', _200 => _200(O)]),O.defaultPrevented||s.handlers.onClick(O)},[L,s.handlers]),w=St.useCallback(O=>{s.handlers.onPointerDown(O),_optionalChain([I, 'optionalCall', _201 => _201(O)])},[s.handlers,I]),B=St.useCallback(O=>{_optionalChain([D, 'optionalCall', _202 => _202(O)]),O.defaultPrevented||s.handlers.onPointerMove(O)},[D,s.handlers]),T=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:s.contextValue,children:M}),f=q(),G=W(f,"item");return _userender.useRender.call(void 0, {render:b,ref:[s.ref,s.rowRef,r],state:h,stateAttributesMapping:qa,props:{...k,...G?{[G]:""}:{},id:s.id,role:"option",tabIndex:-1,"aria-selected":s.isHighlighted,"aria-disabled":u||void 0,className:R,style:y,onClick:S,onPointerMove:B,onPointerDown:w,children:T},enabled:s.isVisible,defaultTagName:"div"})});var Za={highlighted:e=>e?{"data-highlighted":""}:null,disabled:e=>e?{"data-disabled":""}:null,first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null,firstInGroup:e=>e?{"data-first-in-group":""}:null,lastInGroup:e=>e?{"data-last-in-group":""}:null},$a= exports.ka =Ye.forwardRef(function(o,r){let{id:t,value:a,keywords:n,disabled:c=!1,onSelect:p,forceMount:m=!1,closeOnClick:l=!1,shortcut:i,forceOrder:d,forceScore:g,render:P,className:b,style:R,onClick:y,onPointerDown:L,onPointerMove:I,children:D,...M}=o,{closeAll:k}=_chunkXMZZ62VJcjs.j.call(void 0, ),s=Ye.useRef(null),u=Ee({id:t,value:a,keywords:n,disabled:c,forceMount:m,shortcut:i,forceOrder:d,forceScore:g,closeOnClick:l,children:D}),h=u.disabled;Ye.useEffect(()=>{let v=()=>{h||_optionalChain([s, 'access', _203 => _203.current, 'optionalAccess', _204 => _204.click, 'call', _205 => _205()])};return u.registerSelect(v)},[h,u]);let S=Ye.useMemo(()=>({highlighted:u.isHighlighted,disabled:h,first:u.positional.first,last:u.positional.last,firstInGroup:u.positional.firstInGroup,lastInGroup:u.positional.lastInGroup}),[u.isHighlighted,h,u.positional]),w=Ye.useCallback(v=>{if(_optionalChain([y, 'optionalCall', _206 => _206(v)]),!v.defaultPrevented){if(h){v.preventDefault();return}_optionalChain([p, 'optionalCall', _207 => _207()]),l&&!v.metaKey&&!v.ctrlKey&&!v.shiftKey&&!v.altKey&&k()}},[y,h,p,l,k]),B=Ye.useCallback(v=>{u.handlers.onPointerDown(v),_optionalChain([L, 'optionalCall', _208 => _208(v)])},[u.handlers,L]),T=Ye.useCallback(v=>{_optionalChain([I, 'optionalCall', _209 => _209(v)]),v.defaultPrevented||u.handlers.onPointerMove(v)},[I,u.handlers]),f=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:u.contextValue,children:D}),G=q(),O=W(G,"link-item");return _userender.useRender.call(void 0, {render:P,ref:[u.ref,u.rowRef,s,r],state:S,stateAttributesMapping:Za,props:{...M,...O?{[O]:""}:{},id:u.id,role:"option",tabIndex:-1,"aria-selected":u.isHighlighted,"aria-disabled":h||void 0,className:b,style:R,onClick:w,onPointerMove:T,onPointerDown:B,children:f},enabled:u.isVisible,defaultTagName:"a"})});var Co=on.createContext(null);function ps(){let e=on.useContext(Co);if(!e)throw new Error("PopupMenu.RadioItem must be used within PopupMenu.RadioGroup");return e}var _a={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},Ja= exports.la =Ie.forwardRef(function(o,r){let{value:t,defaultValue:a,onValueChange:n,disabled:c=!1,forceMount:p=!1,render:m,className:l,style:i,children:d,...g}=o,{store:P}=_chunkXMZZ62VJcjs.p.call(void 0, ),b=Te(),R=Ie.useId(),y=Ie.useRef(null),[L,I]=Ie.useState(null),D=c||b.disabled,[M,k]=Ie.useState(a),s=t!==void 0,u=s?t:M,h=Ie.useCallback((E,U=_chunkXMZZ62VJcjs.a.itemPress,$)=>{let re=_chunkXMZZ62VJcjs.b.call(void 0, U,$);_optionalChain([n, 'optionalCall', _210 => _210(E,re)]),!re.isCanceled&&(s||k(E))},[s,n]);Ie.useEffect(()=>P.registerGroup(R,y),[R,P]),Ie.useLayoutEffect(()=>{if(L)return P.registerRow(R,L,{kind:"group"})},[L,R,P]);let S=P.useState("isGroupVisible",R),w=p||S,B=P.useState("isFirstGroup",R),T=P.useState("isLastGroup",R),f=P.useState("isFirstRow",R),G=P.useState("isLastRow",R),O=Ie.useMemo(()=>({value:u,setValue:h,disabled:D}),[u,h,D]),v=Ie.useMemo(()=>({groupId:R}),[R]),A=Ie.useMemo(()=>({disabled:D,firstGroup:B,lastGroup:T,first:f,last:G}),[D,B,T,f,G]),x=q(),N=W(x,"radio-group"),z=_userender.useRender.call(void 0, {render:m,ref:[y,I,r],state:A,stateAttributesMapping:_a,props:{...g,...N?{[N]:""}:{},role:"group","aria-disabled":D||void 0,className:l,style:i,children:d},enabled:w,defaultTagName:"div"});return w?_jsxruntime.jsx.call(void 0, Co.Provider,{value:O,children:_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.d.Provider,{value:v,children:z})}):null});function eu(e){let{value:o,onValueChange:r,disabled:t=!1,children:a}=e,n=nn.useCallback((p,m=_chunkXMZZ62VJcjs.a.itemPress,l)=>{let i=_chunkXMZZ62VJcjs.b.call(void 0, m,l);_optionalChain([r, 'optionalCall', _211 => _211(p,i)])},[r]),c=nn.useMemo(()=>({value:o,setValue:n,disabled:t}),[o,n,t]);return _jsxruntime.jsx.call(void 0, Co.Provider,{value:c,children:a})}var cr=rn.createContext(null);function ds(){let e=rn.useContext(cr);if(!e)throw new Error("PopupMenu.RadioItemIndicator must be used within PopupMenu.RadioItem");return e}var ru={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},su= exports.na =et.forwardRef(function(o,r){let{id:t,value:a,keywords:n,disabled:c=!1,onSelect:p,forceMount:m=!1,closeOnClick:l=!1,shortcut:i,forceOrder:d,forceScore:g,render:P,className:b,style:R,onClick:y,onPointerDown:L,onPointerMove:I,children:D,...M}=o,k=ps(),s=c||k.disabled,u=k.value===a,h=Ee({id:t,keywords:n,disabled:s,forceMount:m,shortcut:i,forceOrder:d,forceScore:g,closeOnClick:l,children:D}),S=h.disabled;et.useEffect(()=>{let x=()=>{S||(k.setValue(a),_optionalChain([p, 'optionalCall', _212 => _212()]))};return h.registerSelect(x)},[S,k,a,p,h]);let w=et.useMemo(()=>({highlighted:h.isHighlighted,disabled:S,checked:u,first:h.positional.first,last:h.positional.last,firstInGroup:h.positional.firstInGroup,lastInGroup:h.positional.lastInGroup}),[h.isHighlighted,S,u,h.positional]),B=et.useMemo(()=>({...h.contextValue,checked:u}),[h.contextValue,u]),T=et.useCallback(x=>{_optionalChain([y, 'optionalCall', _213 => _213(x)]),x.defaultPrevented||h.handlers.onClick(x)},[y,h.handlers]),f=et.useCallback(x=>{h.handlers.onPointerDown(x),_optionalChain([L, 'optionalCall', _214 => _214(x)])},[h.handlers,L]),G=et.useCallback(x=>{_optionalChain([I, 'optionalCall', _215 => _215(x)]),x.defaultPrevented||h.handlers.onPointerMove(x)},[I,h.handlers]),O=q(),v=W(O,"radio-item"),A=_userender.useRender.call(void 0, {render:P,ref:[h.ref,h.rowRef,r],state:w,stateAttributesMapping:ru,props:{...M,...v?{[v]:""}:{},id:h.id,role:"menuitemradio",tabIndex:-1,"aria-checked":u,"aria-disabled":S||void 0,className:b,style:R,onClick:T,onPointerMove:G,onPointerDown:f,children:D},enabled:h.isVisible,defaultTagName:"div"});return h.isVisible?_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:h.contextValue,children:_jsxruntime.jsx.call(void 0, cr.Provider,{value:B,children:A})}):null});var uu={checked:e=>e?{"data-checked":""}:{"data-unchecked":""},disabled:e=>e?{"data-disabled":""}:null},iu= exports.oa =sn.forwardRef(function(o,r){let{keepMounted:t=!1,render:a,className:n,style:c,children:p,...m}=o,{checked:l,highlighted:i,disabled:d}=ds(),g=sn.useMemo(()=>({checked:l,highlighted:i,disabled:d}),[l,i,d]),P=t||l,b=q(),R=W(b,"radio-item-indicator");return _userender.useRender.call(void 0, {render:a,ref:r,state:g,stateAttributesMapping:uu,props:{...m,...R?{[R]:""}:{},"aria-hidden":!0,className:n,style:c,children:p},enabled:P,defaultTagName:"span"})});function Wt(e){let{surfaceId:o}=_chunkXMZZ62VJcjs.p.call(void 0, ),r=zo(),t=an.useId();an.useLayoutEffect(()=>{if(!(!r||!e))return r.registerZone(o,t,e)},[r,o,t,e])}var pu=un.forwardRef(function(o,r){let{render:t,className:a,style:n,...c}=o,[p,m]=un.useState(null);Wt(p);let l=q(),i=W(l,"focus-zone");return _userender.useRender.call(void 0, {render:t,ref:[m,r],state:{},props:{...c,...i?{[i]:""}:{},className:a,style:n},defaultTagName:"div"})});var du=cn.forwardRef(function(o,r){let{render:t,className:a,style:n,...c}=o,[p,m]=cn.useState(null);Wt(p);let l=q(),i=W(l,"footer");return _userender.useRender.call(void 0, {render:t,ref:[m,r],state:{},props:{...c,...i?{[i]:""}:{},className:a,style:n},defaultTagName:"div"})});var mu={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},gu= exports.ra =Ae.forwardRef(function(o,r){let{forceMount:t=!1,render:a,className:n,style:c,children:p,...m}=o,{store:l}=_chunkXMZZ62VJcjs.p.call(void 0, ),i=Ae.useId(),d=Ae.useRef(null),[g,P]=Ae.useState(null);Ae.useEffect(()=>l.registerGroup(i,d),[i,l]),Ae.useLayoutEffect(()=>{if(g)return l.registerRow(i,g,{kind:"group"})},[g,i,l]);let b=l.useState("isGroupVisible",i),R=t||b,y=l.useState("isFirstGroup",i),L=l.useState("isLastGroup",i),I=l.useState("isFirstRow",i),D=l.useState("isLastRow",i),M=Ae.useMemo(()=>({groupId:i}),[i]),k=Ae.useMemo(()=>({hidden:!R,firstGroup:y,lastGroup:L,first:I,last:D}),[R,y,L,I,D]),s=q(),u=W(s,"group"),h=_userender.useRender.call(void 0, {render:a,ref:[d,P,r],state:k,stateAttributesMapping:mu,props:{...m,...u?{[u]:""}:{},role:"presentation",className:n,style:c,children:p},enabled:R,defaultTagName:"div"});return R?_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.d.Provider,{value:M,children:h}):null});function hu(e){let{groupId:o,positional:r,children:t}=e,a=ms.useMemo(()=>({groupId:o,positional:r}),[o,r]);return _jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.d.Provider,{value:a,children:t})}var Pu=pn.forwardRef(function(o,r){let{render:t,className:a,style:n,...c}=o,[p,m]=pn.useState(null);Wt(p);let l=q(),i=W(l,"header");return _userender.useRender.call(void 0, {render:t,ref:[m,r],state:{},props:{...c,...i?{[i]:""}:{},className:a,style:n},defaultTagName:"div"})});var yu={first:e=>e?{"data-first":""}:null,last:e=>e?{"data-last":""}:null},Mu= exports.ua =st.forwardRef(function(o,r){let{alwaysRender:t=!1,render:a,className:n,style:c,...p}=o,{store:m}=_chunkXMZZ62VJcjs.p.call(void 0, ),l=st.useId(),[i,d]=st.useState(null);st.useLayoutEffect(()=>{if(i)return m.registerRow(l,i,{kind:"separator"})},[i,l,m]);let b=m.useState("normalizedSearch").length>0&&!t,R=m.useState("isFirstRow",l),y=m.useState("isLastRow",l),L=st.useMemo(()=>({first:R,last:y}),[R,y]),I=q(),D=W(I,"separator"),M=_userender.useRender.call(void 0, {render:a,ref:[d,r],state:L,stateAttributesMapping:yu,props:{...p,...D?{[D]:""}:{},role:"none",className:n,style:c},defaultTagName:"div"});return b?null:M});var vu={highlighted:e=>e?{"data-highlighted":""}:null},ku= exports.va =ln.forwardRef(function(o,r){let{children:t,render:a,className:n,style:c,...p}=o,{shortcut:m,highlighted:l}=_chunkXMZZ62VJcjs.g.call(void 0, ),i=ln.useMemo(()=>({shortcut:m,highlighted:l}),[m,l]),d=typeof t=="function"?t(i):_nullishCoalesce(t, () => (m)),g=q(),P=W(g,"shortcut");return _userender.useRender.call(void 0, {render:a,ref:r,state:i,stateAttributesMapping:vu,props:{...p,...P?{[P]:""}:{},className:n,style:c,children:d},defaultTagName:"kbd"})});var pr=dn.createContext(null);function Ut(){return dn.useContext(pr)}var Du={depth:e=>({"data-depth":String(e)})},wu= exports.wa =gs.forwardRef(function(o,r){let{render:t,className:a,style:n,children:c,...p}=o,m=(_nullishCoalesce(_optionalChain([Ut, 'call', _216 => _216(), 'optionalAccess', _217 => _217.depth]), () => (0)))+1,l=q(),i=W(l,"tree"),g=_userender.useRender.call(void 0, {render:t,ref:r,state:{depth:m},stateAttributesMapping:Du,props:{...p,...i?{[i]:""}:{},role:"presentation",className:a,style:n,children:c},defaultTagName:"div"});return _jsxruntime.jsx.call(void 0, pr.Provider,{value:{depth:m},children:g})});function fn(e,o){return typeof e=="function"?r=>({...e(r),"--tree-depth":o}):{...e,"--tree-depth":o}}var Ou={depth:e=>({"data-depth":String(e)})},Tu= exports.xa =bs.forwardRef(function(o,r){let{depth:t,render:a,className:n,style:c,children:p,...m}=o,l=Ut(),i=_nullishCoalesce(_nullishCoalesce(t, () => (_optionalChain([l, 'optionalAccess', _218 => _218.depth]))), () => (0)),d=q(),g=W(d,"tree-connector");return _userender.useRender.call(void 0, {render:a,ref:r,state:{depth:i},stateAttributesMapping:Ou,props:{...m,...g?{[g]:""}:{},"aria-hidden":"true","data-depth":i,className:n,style:fn(c,i),children:p},defaultTagName:"span"})});var Gu=hs.forwardRef(function(o,r){let{selectable:t=!0,depth:a,style:n,children:c,...p}=o,m=Ut(),l=_nullishCoalesce(_nullishCoalesce(a, () => (_optionalChain([m, 'optionalAccess', _219 => _219.depth]))), () => (0)),i=q(),d=W(i,"tree-item");return _jsxruntime.jsx.call(void 0, ir,{...p,ref:r,activatable:t,style:fn(n,l),...d?{[d]:""}:{},"data-tree-item":"","data-depth":l,...t===!1?{"data-header":""}:{},children:c})});function Fu(e){let{open:o,onOpenChange:r,defaultOpen:t=!1,closeRootOnEsc:a=!0,virtualized:n=!1,items:c,onHighlightChange:p,onOpenChangeComplete:m,disabled:l=!1,actionsRef:i,children:d,...g}=e,P=_chunkXMZZ62VJcjs.k.call(void 0, ),b=ct(),R=_nullishCoalesce(_optionalChain([P, 'optionalAccess', _220 => _220.depth]), () => (0)),y=_optionalChain([P, 'optionalAccess', _221 => _221.closeAll]),L=_optionalChain([P, 'optionalAccess', _222 => _222.registerSurface]),I=Ko(),D=le.useCallback((V,C,j)=>{_optionalChain([p, 'optionalCall', _223 => _223(V,V===null?null:_nullishCoalesce(_optionalChain([I, 'optionalAccess', _224 => _224.getNodeById, 'call', _225 => _225(V)]), () => (null)),C,j)])},[I,p]),{surfaceId:M}=_chunkXMZZ62VJcjs.p.call(void 0, ),k=le.useId(),s=le.useRef(null),u=le.useRef(null),h=le.useRef(!1),S=_chunkXMZZ62VJcjs.y.useStore(void 0,{open:t}),[w,B]=le.useState(!1),T=(_nullishCoalesce(_optionalChain([b, 'optionalAccess', _226 => _226.disabled]), () => (!1)))||l||w,f=le.useCallback(V=>{B(V)},[]),G=le.useCallback(V=>{V&&T||S.setOpen(V)},[S,T]);S.useControlledProp("openProp",o);let O=vt(),v=S.useState("open");le.useEffect(()=>{v?O.open(k):O.close(k)},[v,k,O]);let A=le.useCallback((V,C)=>{_optionalChain([r, 'optionalCall', _227 => _227(V,C)]),!C.isCanceled&&G(V)},[G,r]),x=le.useCallback(V=>{!V&&S.context.clearSearchOnClose==="after-exit"&&(S.clearSearch(),S.setInputActive(!1)),V||(S.clearHighlight(),_optionalChain([S, 'access', _228 => _228.context, 'access', _229 => _229.onCloseComplete, 'optionalCall', _230 => _230()]),_optionalChain([S, 'access', _231 => _231.context, 'access', _232 => _232.onPopupCloseComplete, 'optionalCall', _233 => _233()])),_optionalChain([m, 'optionalCall', _234 => _234(V)])},[S,m]),[N,z]=le.useState(!0);le.useEffect(()=>{if(!P)return;let V=P.store,C=()=>{let F=V.state.open;z(F)};return C(),V.observe("open",C)},[P]),le.useEffect(()=>{N||G(!1)},[N,G]);let E=R+1;le.useEffect(()=>{if(L)return L(E,V=>G(V))},[L,E,G]);let U=le.useRef(null);le.useImperativeHandle(i,()=>({close:()=>{_optionalChain([U, 'access', _235 => _235.current, 'optionalAccess', _236 => _236.close, 'call', _237 => _237()])},unmount:()=>{_optionalChain([U, 'access', _238 => _238.current, 'optionalAccess', _239 => _239.unmount, 'call', _240 => _240()])},setDisabled:f}),[f]);let $=le.useMemo(()=>({open:v,setOpen:G,suppressAutoOpenRef:h,triggerRef:s,contentRef:u,parentSurfaceId:M,childSurfaceId:k,closeRootOnEsc:a}),[v,G,M,k,a]),re=le.useCallback(()=>()=>{},[]),H=le.useMemo(()=>{if(!(!n&&!p))return{virtualized:n,items:_nullishCoalesce(c, () => ([])),onHighlightChange:D}},[n,c,D,p]),ne=le.useMemo(()=>({store:S,depth:E,closeAll:_nullishCoalesce(y, () => ((()=>S.setOpen(!1)))),registerSurface:_nullishCoalesce(L, () => (re)),virtualization:H}),[S,E,y,L,re,H]),K=le.useMemo(()=>({store:S,disabled:T,depth:E,closeAll:_nullishCoalesce(y, () => ((()=>G(!1)))),explicitTabBehavior:_nullishCoalesce(_optionalChain([b, 'optionalAccess', _241 => _241.explicitTabBehavior]), () => (!1)),tabWithoutZones:_nullishCoalesce(_optionalChain([b, 'optionalAccess', _242 => _242.tabWithoutZones]), () => ("close")),registerSurface:_nullishCoalesce(L, () => (re)),virtualization:H,virtualAnchor:_optionalChain([b, 'optionalAccess', _243 => _243.virtualAnchor]),menuType:_nullishCoalesce(_optionalChain([b, 'optionalAccess', _244 => _244.menuType]), () => ("dropdown")),closeOnOutsidePress:_nullishCoalesce(_optionalChain([b, 'optionalAccess', _245 => _245.closeOnOutsidePress]), () => ("pointerdown"))}),[S,T,E,y,_optionalChain([b, 'optionalAccess', _246 => _246.explicitTabBehavior]),_optionalChain([b, 'optionalAccess', _247 => _247.tabWithoutZones]),L,G,re,H,_optionalChain([b, 'optionalAccess', _248 => _248.virtualAnchor]),_optionalChain([b, 'optionalAccess', _249 => _249.menuType]),_optionalChain([b, 'optionalAccess', _250 => _250.closeOnOutsidePress])]);return _jsxruntime.jsx.call(void 0, Lo.Provider,{value:$,children:_jsxruntime.jsx.call(void 0, it.Provider,{value:K,children:_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.i.Provider,{value:ne,children:_jsxruntime.jsx.call(void 0, _popover.Popover.Root,{...g,open:v,onOpenChange:A,onOpenChangeComplete:x,actionsRef:i?U:void 0,children:d})})})})}function Rs(e,o,r){let t=[],a=e.left-o;a>0&&t.push({side:"left",gap:a});let n=o-e.right;n>0&&t.push({side:"right",gap:n});let c=e.top-r;c>0&&t.push({side:"top",gap:c});let p=r-e.bottom;if(p>0&&t.push({side:"bottom",gap:p}),t.length>0)return t.sort((l,i)=>i.gap-l.gap),t[0].side;let m=[{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 m.sort((l,i)=>l.value-i.value),m[0].side}function gn(e,o,r,t){if(o){let a=(o.left+o.right)/2,n=(o.top+o.bottom)/2;return Rs(e,a,n)}if(t===void 0){if(r<e.left)return"left";if(r>e.right)return"right";let a=(e.left+e.right)/2;return r<=a?"left":"right"}return Rs(e,r,t)}function lr(e,o,r,t,a,n){let c=0,p=0,m=Math.min(Math.max(e.length-1,0),4);for(let i=e.length-m-1;i<e.length-1;i++){if(i<0)continue;let[d,g]=e[i],[P,b]=e[i+1];c+=P-d,p+=b-g}if(Math.hypot(c,p)<.5){let i=a?(a.left+a.right)/2:o,d=a?(a.top+a.bottom)/2:r;if(t==="left"||t==="right"){let g=t==="right"?n.right:n.left,P=(n.top+n.bottom)/2;c=g-i,p=P-d}else{let g=t==="top"?n.top:n.bottom;c=(n.left+n.right)/2-i,p=g-d}}return{dx:c,dy:p}}function dr(e,o,r,t,a,n){let{dx:c,dy:p}=r,m=a==="left"||a==="right",l=m?c:p;if(Math.abs(l)<.01||a==="left"&&c<=0||a==="right"&&c>=0||a==="top"&&p<=0||a==="bottom"&&p>=0)return!1;let d=((a==="left"?t.left:a==="right"?t.right:a==="top"?t.top:t.bottom)-(m?e:o))/l;if(d<=0)return!1;let g=m?o+d*p:e+d*c,P=n?m?n.height:n.width:null,b=P?P*.75:28,R=Math.max(12,Math.min(36,b)),y=(m?t.top:t.left)-R*.25,L=(m?t.bottom:t.right)+R*.25;return g>=y&&g<=L}function vo(e,o=!1){let r=["mouse","pen"];return o||r.push("",void 0),r.includes(e)}var hn=new Set,bn=null;function Bu(){if(bn!==null||typeof window>"u")return;let e=o=>{for(let r of hn){let t=r.trailRef.current;t.push([o.clientX,o.clientY]),t.length>r.limit&&t.shift()}};window.addEventListener("pointermove",e,{passive:!0}),bn=()=>{window.removeEventListener("pointermove",e),bn=null}}function Vu(){hn.size===0&&_optionalChain([bn, 'optionalCall', _251 => _251()])}function Ss(e=4){let o=Rn.useRef([]);return Rn.useEffect(()=>{let r={trailRef:o,limit:e};return hn.add(r),Bu(),()=>{hn.delete(r),o.current=[],Vu()}},[e]),o}function Ps(){let[e,o]=Sn.useState([0,0]);return Sn.useEffect(()=>{let r=t=>{o([t.clientX,t.clientY])};return window.addEventListener("pointermove",r,{passive:!0}),()=>{window.removeEventListener("pointermove",r)}},[]),e}function Ms(e){let{config:o,contentRef:r,triggerRef:t,tone:a,contentRectOverride:n,triggerRectOverride:c,mousePointOverride:p}=e,[m,l]=Ps(),i=ys.useMemo(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)").matches:!1,[]),d=r.current,g=_nullishCoalesce(n, () => (_optionalChain([d, 'optionalAccess', _252 => _252.getBoundingClientRect, 'call', _253 => _253()])));if(!g||i||typeof document>"u"||!document.body)return null;let P=_nullishCoalesce(c, () => ((t.current?t.current.getBoundingClientRect():null))),b=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _254 => _254[0]]), () => (m)),R=_nullishCoalesce(_optionalChain([p, 'optionalAccess', _255 => _255[1]]), () => (l)),y=g.left,L=g.top,I=g.width,D=g.height;if(!I||!D)return null;let M=gn(g,P,b,R);if(M==="top"||M==="bottom"||M==="left"&&b>=y||M==="right"&&b<=y+I)return null;let k=2,s=Math.max(0,Math.min(100,(R-L)/D*100)),u=M==="left"?Math.max(y-b,10)+k:Math.max(b-(y+I),10)+k,h=Math.max(0,Math.min(1,o.overlayOpacity)),S=Math.max(0,Math.min(1,o.triangleFillOpacity)),w=o.showStroke?Math.max(0,o.strokeWidth):0,B=o.showDots?Math.max(0,o.dotRadius):0,T=Math.max(1,Math.min(u,D)/2),f=Math.min(Math.max(B,w/2)+.5,T),G=o.showDots?Math.max(0,Math.min(B,f-w/2-.5)):0,O=Math.max(f,Math.min(D-f,s/100*D)),v=M==="left"?y-u:y+I,A=o.idleColor;a==="activated"?A=o.successColor:a==="missed"&&(A=o.missColor);let x=M==="left"?[[u-f,f],[f,O],[u-f,D-f]]:[[f,f],[f,D-f],[u-f,O]],N=x.map(([E,U])=>`${E},${U}`).join(" "),z=_jsxruntime.jsxs.call(void 0, "svg",{"data-bazzaui-submenu-safe-triangle-area":"","data-safe-triangle-tone":a,"aria-hidden":!0,viewBox:`0 0 ${u} ${D}`,style:{position:"fixed",top:L,left:v,width:u,height:D,pointerEvents:"none",zIndex:Number.MAX_SAFE_INTEGER,transform:"translateZ(0)",opacity:h},children:[_jsxruntime.jsx.call(void 0, "polygon",{points:N,fill:A,fillOpacity:S,stroke:o.showStroke?A:"none",strokeWidth:w,strokeDasharray:o.showStroke?o.strokeDasharray:void 0,strokeLinecap:"round",strokeLinejoin:"round"}),o.showDots?x.map(([E,U])=>_jsxruntime.jsx.call(void 0, "circle",{cx:E,cy:U,r:G,fill:A},`${E}-${U}`)):null]});return _reactdom.createPortal.call(void 0, z,document.body)}var Ku={popupOpen:e=>e?{"data-popup-open":""}:null,popupFocused:e=>e?{"data-popup-focused":""}:null},qu= exports.Aa =Pn.forwardRef(function(o,r){let{render:t,className:a,style:n,children:c,...p}=o,{open:m,childSurfaceId:l}=eo(),d=Pe().useState("isOwner",l),g=Pn.useMemo(()=>({popupOpen:m,popupFocused:d}),[m,d]),P=q(),b=W(P,"submenu-trigger-indicator");return _userender.useRender.call(void 0, {render:t,ref:r,state:g,stateAttributesMapping:Ku,props:{...p,...b?{[b]:""}:{},"aria-hidden":!0,className:a,style:n,children:c},defaultTagName:"span"})});var Zu={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},$u= exports.Ba =Y.forwardRef(function(o,r){let{id:t,value:a,keywords:n,disabled:c=!1,forceMount:p=!1,openOnHighlight:m=!0,delay:l,closeDelay:i=0,closeOnPointerLeave:d=!0,forceOrder:g,forceScore:P,render:b,className:R,style:y,onPointerDown:L,onPointerMove:I,onPointerEnter:D,onPointerLeave:M,children:k,...s}=o,u=Y.useMemo(()=>typeof l=="number"?{pointer:l,keyboard:l}:{pointer:_nullishCoalesce(_optionalChain([l, 'optionalAccess', _256 => _256.pointer]), () => (0)),keyboard:_nullishCoalesce(_optionalChain([l, 'optionalAccess', _257 => _257.keyboard]), () => (150))},[l]),{store:h}=_chunkXMZZ62VJcjs.p.call(void 0, ),{depth:S}=_chunkXMZZ62VJcjs.j.call(void 0, ),w=S-1,B=eo(),{open:T,setOpen:f,suppressAutoOpenRef:G,triggerRef:O,contentRef:v,childSurfaceId:A}=B,x=Y.useRef(null),N=Y.useRef(null),z=Y.useRef(null),E=Y.useRef(null),U=Y.useCallback(()=>{x.current!==null&&(clearTimeout(x.current),x.current=null)},[]),$=Y.useCallback(()=>{N.current!==null&&(clearTimeout(N.current),N.current=null)},[]),re=Y.useCallback(()=>{if(d){if($(),i<=0){f(!1);return}N.current=setTimeout(()=>{N.current=null,f(!1)},i)}},[$,i,d,f]),H=Y.useCallback(()=>{z.current&&(z.current(),z.current=null),E.current!==null&&(clearTimeout(E.current),E.current=null)},[]);Y.useEffect(()=>()=>{U(),$(),H()},[U,$,H]);let ne=Pe(),{aimGuardActive:K,guardedTriggerId:V,guardedDepth:C,aimGuardActiveRef:j,guardedTriggerIdRef:F,guardedDepthRef:X,activateAimGuard:te,clearAimGuard:J}=zt(),fe=Ss(4),{showSafeTriangleArea:Oe,logAimGuardEvents:We}=Vo(),me=Oe.enabled,[ie,Fe]=Y.useState("hidden"),[Xe,we]=Y.useState(null),ye=Y.useRef(null),Z=Ee({id:t,value:a,keywords:n,disabled:c,forceMount:p,forceOrder:g,forceScore:P,isSubmenuTrigger:!0,closeOnClick:!1,children:k}),Ue=Z.disabled,se=Y.useCallback((Q,oe)=>{We&&console.log(`[PopupMenu][AimGuard] ${Q}`,{triggerId:Z.id,triggerStoreId:Z.storeId,parentDepth:w,aimGuardActive:j.current,guardedTriggerId:F.current,guardedDepth:X.current,...oe})},[We,Z.id,Z.storeId,w,j,F,X]),De=Y.useCallback(()=>{ye.current!==null&&(clearTimeout(ye.current),ye.current=null)},[]);Y.useEffect(()=>De,[De]);let Pt=Y.useCallback(Q=>{me&&(De(),Oe.freezeOnPointerLeave?we(Q):we(null),Fe("activated"))},[me,Oe.freezeOnPointerLeave,De]),ee=Y.useCallback(Q=>{if(De(),!me||!Oe.showMissState){Fe("hidden"),we(null);return}Fe("missed"),we(Q);let oe=Oe.missFreezeDuration;if(oe<=0){Fe("hidden"),we(null);return}ye.current=setTimeout(()=>{ye.current=null,Fe("hidden"),we(null)},oe)},[De,me,Oe.showMissState,Oe.missFreezeDuration]),Ze=Y.useCallback((Q,oe,Re,Me,at,Gt)=>{if(H(),se("leave-monitor-start",{anchor:Q,initialHit:Re,timeoutMs:Me,closeDelay:i,triggerRect:oe,initialPointerX:at,initialPointerY:Gt}),Me<=0){se("leave-monitor-skip-timeout",{timeoutMs:Me});return}let Ct=Re,ot=at,Yt=Gt,Xt=gr=>{if(!vo(gr.pointerType))return;let ut=_optionalChain([v, 'access', _258 => _258.current, 'optionalAccess', _259 => _259.getBoundingClientRect, 'call', _260 => _260()]);if(!ut){se("leave-monitor-stop-no-content-rect"),H();return}let{clientX:Be,clientY:Ve}=gr,Cs=Be>=ut.left&&Be<=ut.right&&Ve>=ut.top&&Ve<=ut.bottom,Et=Q==="left"||Q==="right"?Be-ot:Ve-Yt;if(ot=Be,Yt=Ve,Cs){se("leave-monitor-inside-popup",{clientX:Be,clientY:Ve}),$(),H();return}let br=Q==="left"&&Et<=-2||Q==="right"&&Et>=2||Q==="top"&&Et<=-2||Q==="bottom"&&Et>=2;if(se("leave-monitor-pointermove",{anchor:Q,clientX:Be,clientY:Ve,axisDelta:Et,movedAwayFromSubmenu:br,lastHit:Ct}),Ct&&br){let vs={contentRect:ut,triggerRect:oe,pointerX:Be,pointerY:Ve};Ct=!1,se("leave-monitor-reversal-close",{anchor:Q,clientX:Be,clientY:Ve,axisDelta:Et}),ee(vs),J(),re(),(i<=0||!d)&&H();return}let hr=lr(fe.current,Be,Ve,Q,oe,ut),ko=dr(Be,Ve,hr,ut,Q,oe);if(se("leave-monitor-hit-eval",{anchor:Q,clientX:Be,clientY:Ve,hit:ko,lastHit:Ct,heading:hr}),ko===Ct)return;let Rr={contentRect:ut,triggerRect:oe,pointerX:Be,pointerY:Ve};if(Ct=ko,ko){se("leave-monitor-hit-transition",{anchor:Q,clientX:Be,clientY:Ve}),Pt(Rr),$(),te(Z.id,w,A,600),h.setHighlightedId(Z.storeId),f(!0);return}se("leave-monitor-miss-transition",{anchor:Q,clientX:Be,clientY:Ve}),ee(Rr),J(),re(),(i<=0||!d)&&H()};window.addEventListener("pointermove",Xt,{passive:!0}),z.current=()=>{se("leave-monitor-cleanup-remove-listener"),window.removeEventListener("pointermove",Xt)},E.current=setTimeout(()=>{E.current=null,se("leave-monitor-timeout-expired",{timeoutMs:Me}),H()},Me)},[H,se,v,$,fe,Pt,te,Z.id,w,A,h,Z.storeId,f,ee,J,re,i,d]);Y.useEffect(()=>{me||(De(),Fe("hidden"),we(null))},[me,De]),Y.useEffect(()=>{if(!me||Oe.persistOnSuccess||ie!=="activated")return;K&&V===Z.id&&C===w||(De(),Fe("hidden"),we(null))},[me,Oe.persistOnSuccess,ie,K,V,C,Z.id,w,De]),Y.useEffect(()=>{ie!=="activated"||T||(De(),Fe("hidden"),we(null))},[ie,T,De]),Y.useEffect(()=>{T||($(),H())},[T,$,H]),Y.useEffect(()=>{T||!j.current||F.current!==Z.id||X.current!==w||J()},[T,Z.id,w,j,F,X,J]),Y.useEffect(()=>{Z.isVisible||!j.current||F.current!==Z.id||X.current!==w||J()},[Z.isVisible,Z.id,w,j,F,X,J]),Y.useEffect(()=>()=>{j.current&&F.current===Z.id&&X.current===w&&J()},[Z.id,w,j,F,X,J]),Y.useEffect(()=>{if(!T)return;let Q=v.current;if(!Q)return;let oe=()=>{$(),H()},Re=()=>{$(),H()};return Q.addEventListener("pointerenter",oe),Q.addEventListener("pointermove",Re,{passive:!0}),()=>{Q.removeEventListener("pointerenter",oe),Q.removeEventListener("pointermove",Re)}},[T,v,$,H]),Y.useEffect(()=>h.registerSubmenuOpen(Z.storeId,()=>{f(!0),ne.setOwnerId(A),requestAnimationFrame(()=>{let Q=_optionalChain([v, 'access', _261 => _261.current, 'optionalAccess', _262 => _262.querySelector, 'call', _263 => _263("input")]),oe=_optionalChain([v, 'access', _264 => _264.current, 'optionalAccess', _265 => _265.querySelector, 'call', _266 => _266('[role="listbox"]')]),Re=_nullishCoalesce(Q, () => (oe));Re&&Re instanceof HTMLElement&&Re.focus()})}),[Z.storeId,h,f,ne,A,v]),Y.useEffect(()=>h.registerSubmenuClose(Z.storeId,()=>f(!1)),[Z.storeId,h,f]);let xt=ne.useState("isOwner",A);Y.useEffect(()=>{!Z.isVisible&&T&&f(!1)},[Z.isVisible,T,f]),Y.useEffect(()=>{Z.isHighlighted||(G.current=!1)},[Z.isHighlighted,G]),Y.useEffect(()=>{if(!m)return;if(!Z.isHighlighted||h.state.highlightSource!=="keyboard"){U();return}if(G.current)return;let Q=u.keyboard;return Q<=0?f(!0):x.current=setTimeout(()=>{x.current=null,!G.current&&f(!0)},Q),U},[Z.isHighlighted,h,u.keyboard,f,U,m]),Y.useEffect(()=>(O.current=Z.ref.current,()=>{O.current=null}),[O,Z.ref]);let Nt=Y.useCallback(Q=>{Q.preventDefault(),T&&(G.current=!0,se("pointerdown-suppress-auto-open",{clientX:Q.clientX,clientY:Q.clientY})),_optionalChain([L, 'optionalCall', _267 => _267(Q)])},[T,se,L,G]),$t=Y.useCallback(Q=>{if(_optionalChain([I, 'optionalCall', _268 => _268(Q)]),Q.defaultPrevented||Ue||!vo(Q.pointerType)||!h.shouldAllowPointerHighlight(Q.clientX,Q.clientY))return;if(j.current&&X.current===w&&F.current!==Z.id){se("pointermove-blocked-by-guard",{clientX:Q.clientX,clientY:Q.clientY,blockedByTriggerId:F.current});return}if(h.setHighlightedId(Z.storeId),!m||T)return;if(G.current){se("pointermove-open-suppressed-after-explicit-close",{clientX:Q.clientX,clientY:Q.clientY});return}H(),$();let oe=u.pointer;if(oe<=0){f(!0);return}x.current===null&&(x.current=setTimeout(()=>{x.current=null,f(!0)},oe))},[I,Ue,j,X,w,F,Z.id,Z.storeId,m,T,G,H,$,u.pointer,f,se,h]),Lt=Y.useCallback(Q=>{if(_optionalChain([D, 'optionalCall', _269 => _269(Q)]),Q.defaultPrevented||Ue||!vo(Q.pointerType))return;if(j.current&&X.current===w&&F.current!==Z.id){se("pointerenter-blocked-by-guard",{clientX:Q.clientX,clientY:Q.clientY,blockedByTriggerId:F.current,blockedByDepth:X.current});return}if(se("pointerenter-submenu-trigger",{clientX:Q.clientX,clientY:Q.clientY}),me&&(De(),we(null),Fe("hover")),h.setHighlightedId(Z.storeId),!m)return;if(G.current){se("pointerenter-open-suppressed-after-explicit-close",{clientX:Q.clientX,clientY:Q.clientY});return}H(),J(),U(),$();let oe=u.pointer;oe<=0?f(!0):x.current=setTimeout(()=>{x.current=null,f(!0)},oe)},[D,Ue,j,X,F,Z.id,Z.storeId,h,m,G,H,J,U,$,De,me,u.pointer,f,se,w]),yt=Y.useCallback(Q=>{if(_optionalChain([M, 'optionalCall', _270 => _270(Q)]),Q.defaultPrevented||Ue||!vo(Q.pointerType))return;if(U(),se("pointerleave-submenu-trigger",{clientX:Q.clientX,clientY:Q.clientY}),j.current&&X.current===w&&F.current!==Z.id){se("pointerleave-blocked-by-guard",{clientX:Q.clientX,clientY:Q.clientY,blockedByTriggerId:F.current,blockedByDepth:X.current});return}let oe=_optionalChain([v, 'access', _271 => _271.current, 'optionalAccess', _272 => _272.getBoundingClientRect, 'call', _273 => _273()]);if(!oe){se("pointerleave-no-content-rect"),H(),De(),Fe("hidden"),we(null),J(),re();return}let{clientX:Re,clientY:Me}=Q,at=_nullishCoalesce(_optionalChain([O, 'access', _274 => _274.current, 'optionalAccess', _275 => _275.getBoundingClientRect, 'call', _276 => _276()]), () => (null)),Gt={contentRect:oe,triggerRect:at,pointerX:Re,pointerY:Me};if(Re>=oe.left&&Re<=oe.right&&Me>=oe.top&&Me<=oe.bottom){se("pointerleave-inside-popup-success",{clientX:Re,clientY:Me}),Pt(Gt),$(),H(),J();return}let ot=gn(oe,at,Re,Me),Yt=lr(fe.current,Re,Me,ot,at,oe),Xt=dr(Re,Me,Yt,oe,ot,at);se("pointerleave-hit-eval",{anchor:ot,hit:Xt,clientX:Re,clientY:Me,heading:Yt}),Xt?(se("pointerleave-hit-activate-guard",{anchor:ot,clientX:Re,clientY:Me}),Pt(Gt),te(Z.id,w,A,600),h.setHighlightedId(Z.storeId),f(!0),Ze(ot,at,!0,600,Re,Me)):(se("pointerleave-miss-close",{anchor:ot,clientX:Re,clientY:Me}),ee(Gt),J(),re(),d&&i>0?Ze(ot,at,!1,i,Re,Me):H())},[M,Ue,U,j,X,F,Z.id,Z.storeId,i,d,v,H,De,J,Pt,ee,f,$,re,Ze,O,fe,te,w,A,h,se]),_e=Y.useMemo(()=>({submenuTrigger:!0,popupOpen:T,popupFocused:xt,highlighted:Z.isHighlighted,disabled:Ue,first:Z.positional.first,last:Z.positional.last,firstInGroup:Z.positional.firstInGroup,lastInGroup:Z.positional.lastInGroup}),[T,xt,Z.isHighlighted,Ue,Z.positional]),mt=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:Z.contextValue,children:k}),gt=q(),Ot=W(gt,"submenu-trigger"),mr=_userender.useRender.call(void 0, {render:b,ref:[Z.ref,Z.rowRef,r],state:_e,stateAttributesMapping:Zu,props:{...s,...Ot?{[Ot]:""}:{},id:Z.id,role:"menuitem","aria-haspopup":"menu","aria-expanded":T,tabIndex:-1,"aria-disabled":Ue||void 0,className:R,style:y,onPointerMove:$t,onPointerDown:Nt,onPointerEnter:Lt,onPointerLeave:yt,children:mt},defaultTagName:"div"}),Mt=Y.useMemo(()=>ie==="hover"?"hover":ie==="activated"?"activated":ie==="missed"?"missed":null,[ie]),Tt=_jsxruntime.jsx.call(void 0, _popover.Popover.Trigger,{nativeButton:!1,disabled:Ue,render:mr});return Z.isVisible?!me||Mt===null?Tt:_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[Tt,_jsxruntime.jsx.call(void 0, Ms,{config:Oe,contentRef:v,triggerRef:O,tone:Mt,contentRectOverride:_optionalChain([Xe, 'optionalAccess', _277 => _277.contentRect]),triggerRectOverride:_optionalChain([Xe, 'optionalAccess', _278 => _278.triggerRect]),mousePointOverride:Xe?[Xe.pointerX,Xe.pointerY]:null})]}):null});function _u(e){let{pageId:o,closeRootOnEsc:r=!1,children:t}=e,a=_chunkXMZZ62VJcjs.k.call(void 0, ),n=ct(),c=kt();if(!a||!n)throw new Error("PopupMenu.Subpage must be used within PopupMenu.Popup");let p=_chunkXMZZ62VJcjs.y.useStore(void 0,{open:!1}),m=tt.useId(),l=a.store.useState("open"),i=c.activePageId,d=c.stack,g=c.registerPage,P=c.goBack,b=c.getSurfaceId,R=c.rootSurfaceId,y=i===o&&b(o)===m;tt.useEffect(()=>g({pageId:o,surfaceId:m,closeRootOnEsc:r}),[g,o,m,r]),tt.useEffect(()=>{p.setOpen(l&&y)},[p,l,y]),tt.useEffect(()=>a.registerSurface(a.depth,s=>p.setOpen(s)),[a,p]);let L=tt.useMemo(()=>{let s=d.lastIndexOf(o);if(s<=0)return R;let u=d[s-1];return u===void 0?null:b(u)},[d,o,b,R]),I=tt.useMemo(()=>({pageId:o,surfaceId:m,parentSurfaceId:L,isActive:y,closeRootOnEsc:r,goBack:P}),[o,m,L,y,r,P]),D=tt.useMemo(()=>({store:p,depth:a.depth,closeAll:a.closeAll,registerSurface:a.registerSurface,virtualization:a.virtualization}),[p,a]),M=tt.useMemo(()=>({store:p,depth:n.depth,closeAll:n.closeAll,explicitTabBehavior:n.explicitTabBehavior,tabWithoutZones:n.tabWithoutZones,registerSurface:n.registerSurface,virtualization:n.virtualization,virtualAnchor:n.virtualAnchor,menuType:n.menuType,disabled:n.disabled,closeOnOutsidePress:n.closeOnOutsidePress}),[p,n]),k=y;return _jsxruntime.jsx.call(void 0, Oo.Provider,{value:I,children:_jsxruntime.jsx.call(void 0, Vt.Provider,{value:m,children:_jsxruntime.jsx.call(void 0, it.Provider,{value:M,children:_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.i.Provider,{value:D,children:k?t:null})})})})}var ei={canGoBack:e=>e?{"data-can-go-back":""}:null,disabled:e=>e?{"data-disabled":""}:null},ti= exports.Da =Zt.forwardRef(function(o,r){let{disabled:t=!1,render:a,className:n,style:c,onClick:p,children:m,...l}=o,i=oo(),d=kt(),g=Pe(),P=Te(),b=t||P.disabled,R=Zt.useCallback(D=>{if(_optionalChain([p, 'optionalCall', _279 => _279(D)]),D.defaultPrevented||b)return;i.goBack()&&i.parentSurfaceId&&g.setOwnerId(i.parentSurfaceId)},[p,b,i,g]),y=Zt.useMemo(()=>({canGoBack:d.canGoBack,disabled:b}),[d.canGoBack,b]),L=q(),I=W(L,"subpage-back");return _userender.useRender.call(void 0, {render:a,ref:r,state:y,stateAttributesMapping:ei,props:{...l,...I?{[I]:""}:{},type:"button",disabled:b,className:n,style:c,onClick:R,children:m},defaultTagName:"button"})});var ni={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},ri= exports.Ea =Le.forwardRef(function(o,r){let{id:t,value:a,keywords:n,disabled:c=!1,forceMount:p=!1,onSelect:m,onSelectAsync:l,render:i,className:d,style:g,onClick:P,onPointerMove:b,onPointerDown:R,children:y,...L}=o,I=oo(),D=Pe(),[M,k]=Le.useState(!1),s=Le.useRef(null);Le.useEffect(()=>()=>{_optionalChain([s, 'access', _280 => _280.current, 'optionalAccess', _281 => _281.abort, 'call', _282 => _282()])},[]);let u=Le.useCallback(()=>{let x=I.goBack();return x&&I.parentSurfaceId&&D.setOwnerId(I.parentSurfaceId),x},[I,D]),h=Le.useCallback(()=>{if(l){if(M)return;_optionalChain([s, 'access', _283 => _283.current, 'optionalAccess', _284 => _284.abort, 'call', _285 => _285()]);let x=new AbortController;s.current=x,k(!0);let N=!1,z={goBack:()=>{let E=u();return E&&(N=!0),E},signal:x.signal};l(z).then(E=>{x.signal.aborted||E!==!1&&!N&&z.goBack()}).catch(()=>{}).finally(()=>{x.signal.aborted||k(!1)});return}_optionalChain([m, 'optionalCall', _286 => _286()]),u()},[m,l,u,M]),S=Ee({id:t,value:a,keywords:n,disabled:c||M,forceMount:p,closeOnClick:!1,onSelect:h,children:y}),w=S.disabled,B=Le.useMemo(()=>({subpageBackItem:!0,highlighted:S.isHighlighted,disabled:w,first:S.positional.first,last:S.positional.last,firstInGroup:S.positional.firstInGroup,lastInGroup:S.positional.lastInGroup}),[S.isHighlighted,w,S.positional]),T=Le.useCallback(x=>{_optionalChain([P, 'optionalCall', _287 => _287(x)]),x.defaultPrevented||S.handlers.onClick(x)},[P,S.handlers]),f=Le.useCallback(x=>{S.handlers.onPointerDown(x),_optionalChain([R, 'optionalCall', _288 => _288(x)])},[S.handlers,R]),G=Le.useCallback(x=>{_optionalChain([b, 'optionalCall', _289 => _289(x)]),x.defaultPrevented||S.handlers.onPointerMove(x)},[b,S.handlers]),O=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:S.contextValue,children:y}),v=q(),A=W(v,"subpage-back-item");return _userender.useRender.call(void 0, {render:i,ref:[S.ref,S.rowRef,r],state:B,stateAttributesMapping:ni,props:{...L,...A?{[A]:""}:{},id:S.id,role:"option",tabIndex:-1,"aria-selected":S.isHighlighted,"aria-disabled":w||void 0,className:d,style:g,onClick:T,onPointerMove:G,onPointerDown:f,children:O},enabled:S.isVisible,defaultTagName:"div"})});var ui={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},ii= exports.Fa =ft.forwardRef(function(o,r){let{id:t,value:a,keywords:n,disabled:c=!1,forceMount:p=!1,forceOrder:m,forceScore:l,targetPageId:i,render:d,className:g,style:P,onClick:b,onPointerDown:R,onPointerMove:y,children:L,...I}=o,D=Pe(),M=kt(),k=M.activePageId,s=M.openPage,u=M.getSurfaceId,h=ft.useCallback(()=>{if(!s(i))return;let U=u(i);U&&D.setOwnerId(U)},[s,u,i,D]),S=Ee({id:t,value:a,keywords:n,disabled:c,forceMount:p,forceOrder:m,forceScore:l,isSubmenuTrigger:!1,closeOnClick:!1,onSelect:h,children:L}),w=S.disabled,B=k===i,T=u(i),f=D.useState("isOwner",_nullishCoalesce(T, () => (""))),G=ft.useCallback(E=>{S.handlers.onPointerDown(E),_optionalChain([R, 'optionalCall', _290 => _290(E)])},[S.handlers,R]),O=ft.useCallback(E=>{_optionalChain([b, 'optionalCall', _291 => _291(E)]),E.defaultPrevented||S.handlers.onClick(E)},[S.handlers,b]),v=ft.useCallback(E=>{_optionalChain([y, 'optionalCall', _292 => _292(E)]),E.defaultPrevented||S.handlers.onPointerMove(E)},[y,S.handlers]),A=ft.useMemo(()=>({subpageTrigger:!0,popupOpen:B,popupFocused:f,highlighted:S.isHighlighted,disabled:w,first:S.positional.first,last:S.positional.last,firstInGroup:S.positional.firstInGroup,lastInGroup:S.positional.lastInGroup}),[B,f,S.isHighlighted,w,S.positional]),x=_jsxruntime.jsx.call(void 0, _chunkXMZZ62VJcjs.f.Provider,{value:S.contextValue,children:L}),N=q(),z=W(N,"subpage-trigger");return _userender.useRender.call(void 0, {render:d,ref:[S.ref,S.rowRef,r],state:A,stateAttributesMapping:ui,props:{...I,...z?{[z]:""}:{},id:S.id,role:"menuitem","aria-haspopup":"menu","aria-expanded":B,tabIndex:-1,"aria-disabled":w||void 0,className:g,style:P,onPointerDown:G,onClick:O,onPointerMove:v,children:x},enabled:S.isVisible,defaultTagName:"div"})});exports.a = Pe; exports.b = vt; exports.c = it; exports.d = Te; exports.e = ct; exports.f = Vt; exports.g = eo; exports.h = Ke; exports.i = oo; exports.j = pt; exports.k = ro; exports.l = kt; exports.m = so; exports.n = ao; exports.o = vn; exports.p = kn; exports.q = Ls; exports.r = On; exports.s = Gs; exports.t = Fs; exports.u = Gn; exports.v = Gr; exports.w = Ki; exports.x = jt; exports.y = io; exports.z = co; exports.A = En; exports.B = An; exports.C = po; exports.D = Vs; exports.E = Hs; exports.F = It; exports.G = fo; exports.H = Br; exports.I = Vr; exports.J = Hr; exports.K = Us; exports.L = Ys; exports.M = Wr; exports.N = ea; exports.O = oa; exports.P = Ee; exports.Q = Ro; exports.R = np; exports.S = $r; exports.T = Yr; exports.U = sa; exports.V = ia; exports.W = pa; exports.X = Qn; exports.Y = fa; exports.Z = So; exports._ = Po; exports.$ = xo; exports.aa = ma; exports.ba = sr; exports.ca = va; exports.da = Da; exports.ea = La; exports.fa = Oa; exports.ga = Aa; exports.ha = Ha; exports.ia = Qa; exports.ja = ir; exports.ka = $a; exports.la = Ja; exports.ma = eu; exports.na = su; exports.oa = iu; exports.pa = pu; exports.qa = du; exports.ra = gu; exports.sa = hu; exports.ta = Pu; exports.ua = Mu; exports.va = ku; exports.wa = wu; exports.xa = Tu; exports.ya = Gu; exports.za = Fu; exports.Aa = qu; exports.Ba = $u; exports.Ca = _u; exports.Da = ti; exports.Ea = ri; exports.Fa = ii;
2
- //# sourceMappingURL=chunk-BEWVWSAW.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/ui/ui/packages/react/dist/chunk-BEWVWSAW.cjs","../src/internal/popup-menu/contexts/focus-owner-context.ts","../src/internal/popup-menu/contexts/open-chain-context.ts","../src/internal/popup-menu/contexts/popup-menu-context.ts","../src/internal/popup-menu/contexts/popup-surface-id-context.ts","../src/internal/popup-menu/contexts/submenu-context.ts","../src/internal/popup-menu/contexts/subpage-context.ts","../src/internal/popup-menu/contexts/subpage-stack-context.ts","../src/internal/popup-menu/store/FocusOwnerStore.ts","../src/internal/popup-menu/hooks/use-popup-menu-root.ts","../src/internal/popup-menu/menu-tree/resolve.ts"],"names":["FocusOwnerContext","useFocusOwner","context","OpenChainContext","useOpenChain","PopupMenuContext","usePopupMenuContext","useMaybePopupMenuContext","PopupSurfaceIdContext","usePopupSurfaceId","SubmenuContext","useSubmenuContext","useMaybeSubmenuContext","SubpageContext","useSubpageContext","useMaybeSubpageContext","SubpageStackContext","useSubpageStack","useMaybeSubpageStack","selectors","createSelector","state","surfaceId","FocusOwnerStore","ReactStore","id","isPopupMenuNode","value","encodeDefinitionPathEntry","entry","encoded","index","codeUnit","isSafe"],"mappings":"AAAA,ugCAAyM,82FCElL,IAOjBA,EAAAA,CAA0B,EAAA,CAAA,aAAA,CAAsC,IAAI,CAAA,CAEnE,SAASC,EAAAA,CAAAA,CAAiC,CAC/C,IAAMC,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWF,EAAiB,CAAA,CAClD,EAAA,CAAI,CAACE,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,gEACF,CAAA,CAEF,OAAOA,CACT,CCjBA,IAOMC,EAAAA,CAAyB,EAAA,CAAA,aAAA,CAAqC,IAAI,CAAA,CAEjE,SAASC,EAAAA,CAAAA,CAA+B,CAC7C,IAAMF,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWC,EAAgB,CAAA,CACjD,EAAA,CAAI,CAACD,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,+DACF,CAAA,CAEF,OAAOA,CACT,CCjBA,IAiGMG,EAAAA,CAAyB,EAAA,CAAA,aAAA,CAA4C,IAAI,CAAA,CAMxE,SAASC,EAAAA,CAAAA,CAA6C,CAC3D,IAAMJ,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWG,EAAgB,CAAA,CACjD,EAAA,CAAI,CAACH,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,+EACF,CAAA,CAEF,OAAOA,CACT,CAMO,SAASK,EAAAA,CAAAA,CAAyD,CACvE,OAAa,EAAA,CAAA,UAAA,CAAWF,EAAgB,CAC1C,CCvHA,IAaMG,EAAAA,CAA8B,EAAA,CAAA,aAAA,CAA6B,IAAI,CAAA,CAE9D,SAASC,EAAAA,CAAAA,CAAmC,CACjD,OAAa,EAAA,CAAA,UAAA,CAAWD,EAAqB,CAC/C,CCjBA,IA8BME,EAAAA,CAAuB,EAAA,CAAA,aAAA,CAA0C,IAAI,CAAA,CAEpE,SAASC,EAAAA,CAAAA,CAAyC,CACvD,IAAMT,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWQ,EAAc,CAAA,CAC/C,EAAA,CAAI,CAACR,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,8CAA8C,CAAA,CAEhE,OAAOA,CACT,CAEO,SAASU,EAAAA,CAAAA,CAAqD,CACnE,OAAa,EAAA,CAAA,UAAA,CAAWF,EAAc,CACxC,CC1CA,IAiBMG,EAAAA,CAAuB,EAAA,CAAA,aAAA,CAA0C,IAAI,CAAA,CAEpE,SAASC,EAAAA,CAAAA,CAAyC,CACvD,IAAMZ,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWW,EAAc,CAAA,CAC/C,EAAA,CAAI,CAACX,CAAAA,CACH,MAAM,IAAI,KAAA,CACR,4DACF,CAAA,CAEF,OAAOA,CACT,CAEO,SAASa,EAAAA,CAAAA,CAAqD,CACnE,OAAa,EAAA,CAAA,UAAA,CAAWF,EAAc,CACxC,CC/BA,IA+BMG,EAAAA,CACE,EAAA,CAAA,aAAA,CAA+C,IAAI,CAAA,CAEpD,SAASC,EAAAA,CAAAA,CAA4C,CAC1D,IAAMf,CAAAA,CAAgB,EAAA,CAAA,UAAA,CAAWc,EAAmB,CAAA,CACpD,EAAA,CAAI,CAACd,CAAAA,CACH,MAAM,IAAI,KAAA,CAAM,0DAA0D,CAAA,CAE5E,OAAOA,CACT,CAEO,SAASgB,EAAAA,CAAAA,CAAwD,CACtE,OAAa,EAAA,CAAA,UAAA,CAAWF,EAAmB,CAC7C,CC9CA,6CAA2C,IAerCG,EAAAA,CAAY,CAChB,OAAA,CAASC,mCAAAA,CAAgBC,EAA2BA,CAAAA,CAAM,OAAO,CAAA,CACjE,OAAA,CAASD,mCAAAA,CACNC,CAAAA,CAAwBC,CAAAA,CAAAA,EAAsBD,CAAAA,CAAM,OAAA,GAAYC,CACnE,CACF,CAAA,CAaaC,EAAAA,aAAN,MAAA,QAA8BC,iBAInC,CACA,WAAA,CAAA,CAAc,CACZ,KAAA,CAAM,CAAE,OAAA,CAAS,IAAK,CAAA,CAAG,CAAC,CAAA,CAAGL,EAAS,CACxC,CAMA,UAAA,CAAWM,CAAAA,CAAmB,CAC5B,IAAA,CAAK,GAAA,CAAI,SAAA,CAAWA,CAAE,CACxB,CAMA,UAAA,CAAA,CAAa,CACX,IAAA,CAAK,GAAA,CAAI,SAAA,CAAW,IAAI,CAC1B,CACF,CAAA,CCvDA,SCOgBC,EAAAA,CAAgBC,CAAAA,CAAwC,CACtE,OACE,OAAOA,CAAAA,EAAU,QAAA,EACjBA,CAAAA,GAAU,IAAA,EACV,KAAA,GAASA,CAAAA,EACT,OAAQA,CAAAA,CAAwB,EAAA,EAAO,QAAA,EACvC,OAAQA,CAAAA,CAAwB,aAAA,EAAkB,QAAA,EAClD,KAAA,CAAM,OAAA,CAASA,CAAAA,CAAwB,cAAc,CAAA,EACrD,KAAA,CAAM,OAAA,CAASA,CAAAA,CAAwB,QAAQ,CAAA,EAC/C,OAAQA,CAAAA,CAAwB,KAAA,EAAU,QAAA,EAC1C,QAAA,GAAYA,CAEhB,CAEA,SAASC,EAAAA,CAA0BC,CAAAA,CAAuB,CACxD,IAAIC,CAAAA,CAAU,EAAA,CACd,GAAA,CAAA,IAASC,CAAAA,CAAQ,CAAA,CAAGA,CAAAA,CAAQF,CAAAA,CAAM,MAAA,CAAQE,CAAAA,EAAS,CAAA,CAAG,CACpD,IAAMC,CAAAA,CAAWH,CAAAA,CAAM,UAAA,CAAWE,CAAK,CAAA,CACjCE,CAAAA,CACHD,CAAAA,EAAY,EAAA,EAAQA,CAAAA,EAAY,EAAA,EAChCA,CAAAA,EAAY,EAAA,EAAQA,CAAAA,EAAY,GAAA,EAChCA,CAAAA,EAAY,EAAA,EAAQA,CAAAA,EAAY,EAAA,EACjCA,CAAAA,GAAa,EAAA,EACbA,CAAAA,GAAa,EAAA,EACbA,CAAAA,GAAa,GAAA,EACbA,CAAAA,GAAa,EAAA,CACfF,CAAAA,EAAWG,CAAAA,CACP,MAAA,CAAO,YAAA,CAAaD,CAAQ,CAAA,CAC5B,CAAA,CAAA,EAAIA,CAAAA,CAAS,QAAA,CAAS,EAAE,CAAA,CAAE,QAAA,CAAS,CAAA,CAAG,GAAG,CAAC,CAAA,CAAA","file":"/home/runner/work/ui/ui/packages/react/dist/chunk-BEWVWSAW.cjs","sourcesContent":[null,"'use client'\n\nimport * as React from 'react'\nimport type { FocusOwnerStore } from '../store/FocusOwnerStore.js'\n\n// ============================================================================\n// Focus Owner Context\n// ============================================================================\n\nconst FocusOwnerContext = React.createContext<FocusOwnerStore | null>(null)\n\nexport function useFocusOwner(): FocusOwnerStore {\n const context = React.useContext(FocusOwnerContext)\n if (!context) {\n throw new Error(\n 'FocusOwner components must be used within a FocusOwnerProvider',\n )\n }\n return context\n}\n\nexport function useMaybeFocusOwner(): FocusOwnerStore | null {\n return React.useContext(FocusOwnerContext)\n}\n\nexport { FocusOwnerContext }\n","'use client'\n\nimport * as React from 'react'\nimport type { OpenChainStore } from '../store/OpenChainStore.js'\n\n// ============================================================================\n// Open Chain Context\n// ============================================================================\n\nconst OpenChainContext = React.createContext<OpenChainStore | null>(null)\n\nexport function useOpenChain(): OpenChainStore {\n const context = React.useContext(OpenChainContext)\n if (!context) {\n throw new Error(\n 'OpenChain components must be used within an OpenChainProvider',\n )\n }\n return context\n}\n\nexport function useMaybeOpenChain(): OpenChainStore | null {\n return React.useContext(OpenChainContext)\n}\n\nexport { OpenChainContext }\n","'use client'\n\nimport * as React from 'react'\nimport type {\n ListboxStore,\n VirtualItem,\n} from '../../listbox/store/ListboxStore.js'\nimport type {\n HighlightChangeEventDetails,\n PopupMenuOpenChangeReason,\n} from '../events.js'\n\n// ============================================================================\n// Popup Menu Context\n// ============================================================================\n// Shared root-level context for popup menus (DropdownMenu, ContextMenu).\n// Provides core menu functionality to all child components.\n\n/**\n * Virtual anchor for positioning the menu at a specific point.\n * Used by ContextMenu to position at cursor location.\n */\nexport interface VirtualAnchor {\n getBoundingClientRect(): DOMRect\n}\n\n/**\n * Virtualization configuration passed from Root/Submenu to Surface.\n */\nexport interface VirtualizationConfig {\n /** Whether virtualization mode is enabled */\n virtualized: boolean\n /** Pre-registered items for virtualization */\n items: VirtualItem[]\n /**\n * Callback when highlighted item changes (for scroll sync).\n * The third parameter contains event details including the reason for the change.\n */\n onHighlightChange?: (\n id: string | null,\n index: number,\n eventDetails: HighlightChangeEventDetails,\n ) => void\n}\n\n/**\n * Shared context value for popup menus.\n * Both DropdownMenu.Root and ContextMenu.Root provide this context.\n */\nexport interface PopupMenuContextValue {\n /** The Listbox store instance */\n store: ListboxStore\n /** Whether this menu tree currently ignores user interaction. */\n disabled: boolean\n /** Nesting depth: 0 = root menu, 1+ = submenu */\n depth: number\n /** Close the entire menu tree (deepest submenu to root, sequentially) */\n closeAll: (reason?: PopupMenuOpenChangeReason, event?: Event) => void\n /**\n * Internal: when true, Surface handles Tab explicitly (close the tree, or\n * cycle through focus zones). Enabled only by DropdownMenu.Root and\n * ContextMenu.Root — never Select or Combobox.\n */\n explicitTabBehavior: boolean\n /**\n * Internal: what Tab does under `explicitTabBehavior` when the surface (and\n * its ancestors) have no focus-zone tabbables. `'close'` closes the whole\n * tree (dropdown/context-menu). `'inert'` swallows the event, keeping focus\n * where it is (command palette).\n */\n tabWithoutZones: 'close' | 'inert'\n /** Register a surface (submenu) for closeAll tracking. Returns unregister function. */\n registerSurface: (\n depth: number,\n setOpen: (open: boolean) => void,\n ) => () => void\n /** Virtualization configuration (if enabled) */\n virtualization?: VirtualizationConfig\n /**\n * Virtual anchor for positioning.\n * Used by ContextMenu to position at cursor location.\n * DropdownMenu uses the Popover's anchor (trigger button) instead.\n */\n virtualAnchor?: VirtualAnchor\n /**\n * Type of menu for positioning logic.\n * - 'dropdown': positions relative to trigger button\n * - 'context': positions at cursor with fixed positioning\n */\n menuType: 'dropdown' | 'context'\n /**\n * When to close the menu on outside interactions.\n * - 'pointerdown': Close immediately when pointer is pressed outside (default)\n * - 'click': Close when a full click (pointerdown + pointerup) occurs outside\n * @default 'pointerdown'\n */\n closeOnOutsidePress: 'click' | 'pointerdown'\n}\n\nconst PopupMenuContext = React.createContext<PopupMenuContextValue | null>(null)\n\n/**\n * Hook to access the popup menu context.\n * Throws if used outside a popup menu.\n */\nexport function usePopupMenuContext(): PopupMenuContextValue {\n const context = React.useContext(PopupMenuContext)\n if (!context) {\n throw new Error(\n 'PopupMenu components must be used within a PopupMenu.Root or ContextMenu.Root',\n )\n }\n return context\n}\n\n/**\n * Hook to optionally access the popup menu context.\n * Returns null if used outside a popup menu.\n */\nexport function useMaybePopupMenuContext(): PopupMenuContextValue | null {\n return React.useContext(PopupMenuContext)\n}\n\n// Re-export for convenience\nexport type { VirtualItem }\nexport { PopupMenuContext }\n","'use client'\n\nimport * as React from 'react'\n\n// ============================================================================\n// Popup Surface ID Context\n// ============================================================================\n\n/**\n * Context for passing surfaceId from Popup to Surface.\n * This ensures Popup and Surface share the same ID for data attribute tracking.\n *\n * For root menus, Popup generates the ID and provides it via this context.\n * For submenus, the ID comes from SubmenuContext.childSurfaceId instead.\n */\nconst PopupSurfaceIdContext = React.createContext<string | null>(null)\n\nexport function usePopupSurfaceId(): string | null {\n return React.useContext(PopupSurfaceIdContext)\n}\n\nexport { PopupSurfaceIdContext }\n","'use client'\n\nimport * as React from 'react'\n\nexport interface SubmenuContextValue {\n /** Whether the submenu is open */\n open: boolean\n /** Set the submenu open state */\n setOpen: (open: boolean) => void\n /**\n * Latch set by explicit close actions (keyboard ArrowLeft/Ctrl+H/Escape-in-submenu,\n * or clicking the open trigger). While set and the trigger remains highlighted,\n * pointer/keyboard auto-open is suppressed. Reset when highlight leaves the trigger.\n */\n suppressAutoOpenRef: React.MutableRefObject<boolean>\n /** Reference to the trigger element */\n triggerRef: React.RefObject<HTMLElement | null>\n /** Reference to the submenu content element (for aim guard rect calculations) */\n contentRef: React.RefObject<HTMLElement | null>\n /** Surface ID of the parent menu (for keyboard navigation back) */\n parentSurfaceId: string\n /** Surface ID of this submenu (for keyboard navigation into) */\n childSurfaceId: string\n /**\n * Whether pressing Escape in this submenu closes the entire menu from the root.\n * When true, Escape closes the entire menu tree.\n * When false, Escape only closes this submenu and moves focus to the parent.\n * @default true\n */\n closeRootOnEsc: boolean\n}\n\nconst SubmenuContext = React.createContext<SubmenuContextValue | null>(null)\n\nexport function useSubmenuContext(): SubmenuContextValue {\n const context = React.useContext(SubmenuContext)\n if (!context) {\n throw new Error('SubmenuTrigger must be used within a Submenu')\n }\n return context\n}\n\nexport function useMaybeSubmenuContext(): SubmenuContextValue | null {\n return React.useContext(SubmenuContext)\n}\n\nexport { SubmenuContext }\n","'use client'\n\nimport * as React from 'react'\n\nexport interface SubpageContextValue {\n /** Current page ID. */\n pageId: string\n /** Surface ID for this page. */\n surfaceId: string\n /** Surface ID for the previous page, if available. */\n parentSurfaceId: string | null\n /** Whether this page is currently active. */\n isActive: boolean\n /** Whether Escape should close the entire menu tree from this page. */\n closeRootOnEsc: boolean\n /** Navigate back one page. Returns true when navigation happened. */\n goBack: () => boolean\n}\n\nconst SubpageContext = React.createContext<SubpageContextValue | null>(null)\n\nexport function useSubpageContext(): SubpageContextValue {\n const context = React.useContext(SubpageContext)\n if (!context) {\n throw new Error(\n 'Subpage components must be used within a PopupMenu.Subpage',\n )\n }\n return context\n}\n\nexport function useMaybeSubpageContext(): SubpageContextValue | null {\n return React.useContext(SubpageContext)\n}\n\nexport { SubpageContext }\n","'use client'\n\nimport * as React from 'react'\n\nexport interface SubpageRegistration {\n pageId: string\n surfaceId: string\n closeRootOnEsc: boolean\n}\n\nexport interface SubpageStackContextValue {\n /** Active page ID; `null` when the root surface is active. */\n activePageId: string | null\n /** Surface ID of the root surface. */\n rootSurfaceId: string\n /** Surface ID for the currently active page. */\n activeSurfaceId: string\n /** Whether there is a previous page to navigate back to. */\n canGoBack: boolean\n /** Whether Escape in the active page should close the entire menu tree. */\n shouldCloseRootOnEsc: boolean\n /** Open page IDs, bottom to top; empty at root. */\n stack: readonly string[]\n /** Register a page and return an unregister cleanup. */\n registerPage: (registration: SubpageRegistration) => () => void\n /** Push a page onto the stack. Returns true when navigation happened. */\n openPage: (pageId: string) => boolean\n /** Pop one page from the stack. Returns true when navigation happened. */\n goBack: () => boolean\n /** Resolve a surface ID for a page ID. */\n getSurfaceId: (pageId: string) => string | null\n}\n\nconst SubpageStackContext =\n React.createContext<SubpageStackContextValue | null>(null)\n\nexport function useSubpageStack(): SubpageStackContextValue {\n const context = React.useContext(SubpageStackContext)\n if (!context) {\n throw new Error('Subpage components must be used within a PopupMenu.Popup')\n }\n return context\n}\n\nexport function useMaybeSubpageStack(): SubpageStackContextValue | null {\n return React.useContext(SubpageStackContext)\n}\n\nexport { SubpageStackContext }\n","import { createSelector, ReactStore } from '@base-ui/utils/store'\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface FocusOwnerState {\n /** Which surface currently owns focus (surfaceId or null) */\n ownerId: string | null\n}\n\n// ============================================================================\n// Selectors\n// ============================================================================\n\nconst selectors = {\n ownerId: createSelector((state: FocusOwnerState) => state.ownerId),\n isOwner: createSelector(\n (state: FocusOwnerState, surfaceId: string) => state.ownerId === surfaceId,\n ),\n}\n\n// ============================================================================\n// Store\n// ============================================================================\n\n/**\n * Tracks which menu surface owns DOM focus.\n * Single instance per menu tree (created at root, shared via context).\n *\n * Used by: DropdownMenu, ContextMenu\n * Not used by: Select, CommandMenu (single surface)\n */\nexport class FocusOwnerStore extends ReactStore<\n FocusOwnerState,\n Record<string, never>,\n typeof selectors\n> {\n constructor() {\n super({ ownerId: null }, {}, selectors)\n }\n\n /**\n * Set the owner surface ID.\n * Call this when focus should transfer to a new surface.\n */\n setOwnerId(id: string | null) {\n this.set('ownerId', id)\n }\n\n /**\n * Clear the owner (set to null).\n * Call this when the menu tree closes.\n */\n clearOwner() {\n this.set('ownerId', null)\n }\n}\n\nexport type { FocusOwnerState as State }\n","'use client'\n\nimport * as React from 'react'\nimport type { ChangeEventDetails } from '../../../utils/events/index.js'\nimport {\n createChangeEventDetails,\n REASONS,\n} from '../../../utils/events/index.js'\nimport { ensureInputModalityTracking } from '../../../utils/input-modality.js'\nimport { ListboxStore, type VirtualItem } from '../../listbox/index.js'\nimport type { VirtualizationConfig } from '../contexts/popup-menu-context.js'\nimport type {\n HighlightChangeEventDetails,\n PopupMenuHighlightChangeHandler,\n PopupMenuOpenChangeReason,\n} from '../events.js'\nimport type { MenuTreeResolver } from '../menu-tree/resolver.js'\nimport { createMenuTreeResolver } from '../menu-tree/resolver.js'\nimport type { GetResolvedIdFn, PopupMenuIdScope } from '../menu-tree/types.js'\nimport { FocusOwnerStore } from '../store/FocusOwnerStore.js'\nimport { OpenChainStore } from '../store/OpenChainStore.js'\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface UsePopupMenuRootParams {\n /**\n * Computes canonical Resolved IDs for data-first content from the Unresolved Menu Node (definitional facts only).\n * @default explicit `def.id` verbatim, else the joined definition path\n * Read once when the menu root mounts — later changes have no effect.\n */\n getResolvedId?: GetResolvedIdFn\n /** Definition Key uniqueness scope. Read once when the menu root mounts. */\n idScope?: PopupMenuIdScope\n /**\n * Callback when the open state changes.\n * The second parameter contains event details including the reason for the change.\n */\n onOpenChange?: (\n open: boolean,\n eventDetails: ChangeEventDetails<string>,\n ) => void\n\n /**\n * Whether the menu is initially open.\n * @default false\n */\n defaultOpen?: boolean\n\n /**\n * Whether virtualization mode is enabled.\n * @default false\n */\n virtualized?: boolean\n\n /**\n * Pre-registered items for virtualization.\n */\n items?: VirtualItem[]\n\n /**\n * Callback when the highlighted item changes. `id` is first; `node` is the\n * resolved menu node enrichment and may be null.\n * The fourth parameter contains event details including the reason for the change.\n */\n onHighlightChange?: PopupMenuHighlightChangeHandler<HighlightChangeEventDetails>\n\n /**\n * When to close the menu on outside interactions.\n * - 'pointerdown': Close immediately when pointer is pressed outside (default)\n * - 'click': Close when a full click (pointerdown + pointerup) occurs outside\n * @default 'pointerdown'\n */\n closeOnOutsidePress?: 'click' | 'pointerdown'\n\n /**\n * Whether the menu should ignore user interaction.\n * Can be controlled declaratively via this prop, or imperatively via actionsRef.setDisabled().\n * @default false\n */\n disabled?: boolean\n\n /**\n * Initial disabled state for imperative usage.\n * Ignored when `disabled` prop is true.\n * @default false\n */\n defaultDisabled?: boolean\n}\n\nexport interface PopupMenuRootActions {\n /** Close the menu tree imperatively. */\n close: () => void\n /** Unmount the popup imperatively (when keep-mounted mode is enabled). */\n unmount: () => void\n /** Enable/disable the menu tree imperatively. */\n setDisabled: (disabled: boolean) => void\n}\n\nexport interface UsePopupMenuRootReturn {\n /** The menu-tree resolver for this menu root. */\n menuTreeResolver: MenuTreeResolver\n /** The Listbox store instance */\n store: ListboxStore\n /** The FocusOwner store instance */\n focusOwnerStore: FocusOwnerStore\n /** The OpenChain store instance */\n openChainStore: OpenChainStore\n /** Register a surface (submenu) for closeAll tracking */\n registerSurface: (\n depth: number,\n setOpen: (open: boolean) => void,\n ) => () => void\n /** Close the entire menu tree */\n closeAll: (reason?: PopupMenuOpenChangeReason, event?: Event) => void\n /** Virtualization configuration (if enabled) */\n virtualization: VirtualizationConfig | undefined\n /** Handle open state change (updates store and clears stores on close) */\n handleOpenChange: (\n open: boolean,\n reason?: PopupMenuOpenChangeReason,\n event?: Event,\n ) => void\n /** Whether the menu currently ignores user interaction. */\n disabled: boolean\n /** Update imperative disabled state. */\n setDisabled: (disabled: boolean) => void\n}\n\n// ============================================================================\n// Hook\n// ============================================================================\n\n/**\n * Hook that creates and manages the core stores and utilities for popup menus.\n * Used by both DropdownMenu.Root and ContextMenu.Root.\n *\n * Provides:\n * - ListboxStore for item management\n * - FocusOwnerStore for focus tracking across submenus\n * - OpenChainStore for tracking open submenu chain\n * - Surface registry for closeAll functionality\n */\nexport function usePopupMenuRoot(\n params: UsePopupMenuRootParams = {},\n): UsePopupMenuRootReturn {\n const {\n onOpenChange,\n defaultOpen = false,\n virtualized = false,\n items: itemsProp,\n onHighlightChange,\n closeOnOutsidePress = 'pointerdown',\n disabled: disabledProp = false,\n defaultDisabled = false,\n getResolvedId,\n idScope = 'surface',\n } = params\n\n const menuTreeResolverRef = React.useRef<MenuTreeResolver | null>(null)\n if (menuTreeResolverRef.current === null) {\n menuTreeResolverRef.current = createMenuTreeResolver({\n getResolvedId,\n idScope,\n })\n }\n const menuTreeResolver = menuTreeResolverRef.current\n\n const handleHighlightChange = React.useCallback(\n (\n id: string | null,\n index: number,\n eventDetails: HighlightChangeEventDetails,\n ) => {\n onHighlightChange?.(\n id,\n id === null ? null : (menuTreeResolver.getNodeById(id) ?? null),\n index,\n eventDetails,\n )\n },\n [menuTreeResolver, onHighlightChange],\n )\n\n const [imperativeDisabled, setImperativeDisabled] =\n React.useState(defaultDisabled)\n const disabled = disabledProp || imperativeDisabled\n\n const setDisabled = React.useCallback((nextDisabled: boolean) => {\n setImperativeDisabled(nextDisabled)\n }, [])\n\n // Begin tracking global input modality so the store can attribute opens to\n // mouse/touch/pen/keyboard. Idempotent; installed once for the whole app.\n React.useEffect(() => {\n ensureInputModalityTracking()\n }, [])\n\n // Track outside pointer events to distinguish outside-press from focus-out\n // When a pointerdown happens outside the menu, we store it so that if a\n // focus-out close happens immediately after, we can treat it as outside-press\n const outsidePointerEventRef = React.useRef<PointerEvent | null>(null)\n\n // Create stable callback wrapper for onOpenChange that converts focus-out to outside-press\n // when the close was triggered by a pointer event outside the menu\n const stableOnOpenChange = React.useCallback(\n (open: boolean, eventDetails: ChangeEventDetails<string>) => {\n // If closing due to focus-out but we have a stored outside pointer event,\n // convert the reason to outside-press for better cancel() support\n if (\n !open &&\n eventDetails.reason === REASONS.focusOut &&\n outsidePointerEventRef.current\n ) {\n const pointerEvent = outsidePointerEventRef.current\n outsidePointerEventRef.current = null\n\n // Create new event details with outside-press reason and the pointer event\n const convertedDetails = createChangeEventDetails(\n REASONS.outsidePress,\n pointerEvent,\n )\n\n onOpenChange?.(open, convertedDetails)\n\n // If the converted callback canceled, also cancel the original\n if (convertedDetails.isCanceled) {\n eventDetails.cancel()\n }\n return\n }\n\n // Clear the pointer event ref if we're not using it\n outsidePointerEventRef.current = null\n\n onOpenChange?.(open, eventDetails)\n },\n [onOpenChange],\n )\n\n // Create the store instance\n const store = ListboxStore.useStore(\n undefined,\n { open: defaultOpen },\n {\n onOpenChange: stableOnOpenChange,\n },\n )\n\n // Get current open state for the pointer event listener\n const isOpen = store.useState('open')\n\n // Create focus owner store (single instance for entire menu tree)\n const focusOwnerStoreRef = React.useRef<FocusOwnerStore | null>(null)\n if (!focusOwnerStoreRef.current) {\n focusOwnerStoreRef.current = new FocusOwnerStore()\n }\n const focusOwnerStore = focusOwnerStoreRef.current\n\n // Create open chain store (single instance for entire menu tree)\n const openChainStoreRef = React.useRef<OpenChainStore | null>(null)\n if (!openChainStoreRef.current) {\n openChainStoreRef.current = new OpenChainStore()\n }\n const openChainStore = openChainStoreRef.current\n\n // Registry for tracking open submenus (for closeAll)\n type SurfaceEntry = { depth: number; setOpen: (open: boolean) => void }\n const surfaceRegistryRef = React.useRef<Map<string, SurfaceEntry>>(new Map())\n\n // Register a surface (submenu) for closeAll tracking\n const registerSurface = React.useCallback(\n (depth: number, setOpen: (open: boolean) => void) => {\n const id = Math.random().toString(36).slice(2)\n surfaceRegistryRef.current.set(id, { depth, setOpen })\n return () => {\n surfaceRegistryRef.current.delete(id)\n }\n },\n [],\n )\n\n // Close the entire menu tree from deepest submenu to root\n const closeAll = React.useCallback(\n (reason: PopupMenuOpenChangeReason = REASONS.itemPress, event?: Event) => {\n // Sort surfaces by depth (deepest first)\n const surfaces = [...surfaceRegistryRef.current.values()].sort(\n (a, b) => b.depth - a.depth,\n )\n\n // Close each submenu from deepest to shallowest\n for (const surface of surfaces) {\n surface.setOpen(false)\n }\n\n // Finally close the root\n store.setOpen(false, reason, event)\n\n // Clear focus ownership and open chain\n focusOwnerStore.clearOwner()\n openChainStore.clear()\n },\n [store, focusOwnerStore, openChainStore],\n )\n\n // Ref to hold closeAll for use in the pointerdown effect\n const closeAllRef = React.useRef(closeAll)\n closeAllRef.current = closeAll\n\n // Listen for pointerdown events on document to detect outside clicks\n // This is a single listener at the root level that handles the entire menu tree.\n // Behavior depends on closeOnOutsidePress:\n // - 'pointerdown': Close immediately when pointer is pressed outside\n // - 'click': Store event and convert focus-out to outside-press reason\n React.useEffect(() => {\n if (!isOpen || disabled) {\n outsidePointerEventRef.current = null\n return\n }\n\n const handlePointerDown = (event: PointerEvent) => {\n const target = event.target as Element | null\n if (!target) return\n\n // Check if the pointerdown is inside any part of the menu tree or its triggers\n // base-ui sets data-open on popups and data-popup-open on triggers\n const isInsidePopup = target.closest('[data-open]') !== null\n const isInsideTrigger = target.closest('[data-popup-open]') !== null\n const isInside = isInsidePopup || isInsideTrigger\n\n if (closeOnOutsidePress === 'pointerdown' && !isInside) {\n // Close entire menu tree immediately on pointerdown outside\n closeAllRef.current(REASONS.outsidePress, event)\n } else {\n // Store the event for focus-out-to-outside-press conversion\n outsidePointerEventRef.current = event\n }\n }\n\n // Use capture phase to see the event before any stopPropagation\n document.addEventListener('pointerdown', handlePointerDown, true)\n return () => {\n document.removeEventListener('pointerdown', handlePointerDown, true)\n outsidePointerEventRef.current = null\n }\n }, [isOpen, closeOnOutsidePress, disabled])\n\n // Handle open state change\n const handleOpenChange = React.useCallback(\n (\n newOpen: boolean,\n reason: PopupMenuOpenChangeReason = REASONS.none,\n event?: Event,\n ) => {\n const isImperativeAction = reason === REASONS.imperativeAction\n\n // Ignore user-driven open/close interactions while disabled.\n if (disabled && !isImperativeAction) {\n return\n }\n\n store.setOpen(newOpen, reason, event)\n // Clear focus ownership and open chain when menu closes\n if (!newOpen) {\n focusOwnerStore.clearOwner()\n openChainStore.clear()\n }\n },\n [store, focusOwnerStore, openChainStore, disabled],\n )\n\n // Memoize listbox wiring config\n const virtualization = React.useMemo(() => {\n if (!virtualized && !onHighlightChange) {\n return undefined\n }\n\n return {\n virtualized,\n items: itemsProp ?? [],\n onHighlightChange: handleHighlightChange,\n }\n }, [virtualized, itemsProp, handleHighlightChange, onHighlightChange])\n\n return {\n menuTreeResolver,\n store,\n focusOwnerStore,\n openChainStore,\n registerSurface,\n closeAll,\n virtualization,\n handleOpenChange,\n disabled,\n setDisabled,\n }\n}\n","import { slugify } from '../../listbox/utils/normalize.js'\nimport type { NodeDef } from '../data-first/types.js'\nimport type {\n GetResolvedIdFn,\n PopupMenuIdScope,\n PopupMenuNode,\n UnresolvedMenuNode,\n} from './types.js'\n\nexport function isPopupMenuNode(value: unknown): value is PopupMenuNode {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'def' in value &&\n typeof (value as PopupMenuNode).id === 'string' &&\n typeof (value as PopupMenuNode).definitionKey === 'string' &&\n Array.isArray((value as PopupMenuNode).definitionPath) &&\n Array.isArray((value as PopupMenuNode).children) &&\n typeof (value as PopupMenuNode).depth === 'number' &&\n 'parent' in value\n )\n}\n\nfunction encodeDefinitionPathEntry(entry: string): string {\n let encoded = ''\n for (let index = 0; index < entry.length; index += 1) {\n const codeUnit = entry.charCodeAt(index)\n const isSafe =\n (codeUnit >= 0x41 && codeUnit <= 0x5a) ||\n (codeUnit >= 0x61 && codeUnit <= 0x7a) ||\n (codeUnit >= 0x30 && codeUnit <= 0x39) ||\n codeUnit === 0x2e ||\n codeUnit === 0x5f ||\n codeUnit === 0x7e ||\n codeUnit === 0x2d\n encoded += isSafe\n ? String.fromCharCode(codeUnit)\n : `%${codeUnit.toString(16).padStart(4, '0')}`\n }\n return encoded\n}\n\n/** Default Resolved ID, using surface-scoped encoded paths unless menu scope is selected. */\nexport function defaultGetResolvedId(\n node: UnresolvedMenuNode,\n idScope: PopupMenuIdScope = 'surface',\n): string {\n if (idScope === 'menu') return node.definitionKey\n return node.definitionPath.map(encodeDefinitionPathEntry).join('/')\n}\n\n/** Definition Key for a def: explicit `id` verbatim, else slugified `value`. */\nexport function definitionKeyForDef(def: NodeDef): string {\n switch (def.kind) {\n case 'group':\n case 'radio-group':\n return def.id\n case 'separator':\n return def.id\n default:\n return def.id ?? slugify(def.value)\n }\n}\n\n/** Child defs of a def, in def order; empty for leaf kinds. */\nexport function childDefsOf(def: NodeDef): readonly NodeDef[] {\n switch (def.kind) {\n case 'group':\n case 'radio-group':\n return def.nodes\n case 'submenu':\n case 'subpage':\n case 'tree-item':\n return def.nodes ?? []\n default:\n return []\n }\n}\n\n/** Kinds whose Definition Key is part of their descendants' definition paths. */\nexport function contributesDefinitionPath(def: NodeDef): boolean {\n return def.kind === 'submenu' || def.kind === 'subpage'\n}\n\n/**\n * Resolve a def list into node instances under `parent`.\n * `basePath` is the path segments contributed by ancestors (the parent's\n * `definitionPath` when the parent contributes a segment, otherwise the parent's\n * own base path); pass `[]` for roots.\n */\nexport function resolveNodeDefs(\n defs: readonly NodeDef[],\n parent: PopupMenuNode | null,\n basePath: readonly string[],\n getResolvedId: GetResolvedIdFn,\n): PopupMenuNode[] {\n return defs.map((def, index) => {\n const definitionKey = definitionKeyForDef(def)\n const definitionPath = [...basePath, definitionKey]\n const unresolved: UnresolvedMenuNode = {\n def,\n kind: def.kind,\n definitionKey,\n definitionPath,\n parent,\n children: [],\n depth: parent ? parent.depth + 1 : 0,\n index,\n }\n // Call the seam before spreading so the node reflects any reads the seam\n // performs on the final definitional facts (spread-then-call would copy\n // the fields before the seam runs).\n const id = getResolvedId(unresolved)\n const node: PopupMenuNode = { ...unresolved, id }\n node.children = resolveNodeDefs(\n childDefsOf(def),\n node,\n contributesDefinitionPath(def) ? node.definitionPath : basePath,\n getResolvedId,\n )\n return node\n })\n}\n\n/**\n * The branch's resolved static children: the Menu Nodes whose def is one of\n * the branch def's authored `nodes`, in `children` order. Loader results are\n * grafted as children too but are never in `def.nodes`, so they are excluded\n * whether the graft appended to or replaced the static children.\n */\nexport function staticChildrenOf(branch: PopupMenuNode): PopupMenuNode[] {\n const authored = (branch.def as { nodes?: readonly NodeDef[] }).nodes\n if (!authored || authored.length === 0) return []\n const authoredSet = new Set<NodeDef>(authored)\n return branch.children.filter((child) => authoredSet.has(child.def))\n}\n"]}