opencami 1.9.0 → 2.0.0

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 (66) hide show
  1. package/dist/client/assets/{CSPContext-TfUptlEu.js → CSPContext-CrlIQW7-.js} +1 -1
  2. package/dist/client/assets/{DirectionContext-CQMv7g2N.js → DirectionContext-X-0CRn1O.js} +1 -1
  3. package/dist/client/assets/_sessionKey-yNQ57svB.js +23 -0
  4. package/dist/client/assets/agents-WqWjsymD.js +2 -0
  5. package/dist/client/assets/{agents-screen-fSZJpRi_.js → agents-screen-BhOVp_S6.js} +1 -1
  6. package/dist/client/assets/bots-DNqiFT7w.js +2 -0
  7. package/dist/client/assets/{bots-screen-4yT-e3cM.js → bots-screen-DLFd0ydi.js} +1 -1
  8. package/dist/client/assets/button-D0n2Qsd_.js +1 -0
  9. package/dist/client/assets/{composite-BLgu_EOL.js → composite-GtKwZKbV.js} +1 -1
  10. package/dist/client/assets/{connect-CiqRvR6s.js → connect-vQWL0_11.js} +1 -1
  11. package/dist/client/assets/{dashboard-CyWDWpbj.js → dashboard-Knwc61i1.js} +1 -1
  12. package/dist/client/assets/{event-2_Dxdv7h.js → event-CHpdjYFR.js} +1 -1
  13. package/dist/client/assets/file-explorer-screen-FoYNs9zK.js +1 -0
  14. package/dist/client/assets/files-BtR_gArr.js +2 -0
  15. package/dist/client/assets/follow-up-suggestions-DVXNLqga.js +5 -0
  16. package/dist/client/assets/{index-ygitKeM-.js → index-CNPHef4O.js} +1 -1
  17. package/dist/client/assets/{index-C_gsW9fo.js → index-CTT0Y1ya.js} +1 -1
  18. package/dist/client/assets/{keyboard-shortcuts-dialog-z-amTZVi.js → keyboard-shortcuts-dialog-DP8ptQ7N.js} +1 -1
  19. package/dist/client/assets/{main-ZBMVSJTF.js → main-xPlWrMhO.js} +3 -3
  20. package/dist/client/assets/{markdown-CHUjmWcv.js → markdown-3Js_RbUp.js} +1 -1
  21. package/dist/client/assets/memory-BRGPq5t6.js +2 -0
  22. package/dist/client/assets/{memory-screen-C_ZNDGLd.js → memory-screen-nzRra2Qi.js} +1 -1
  23. package/dist/client/assets/{menu-CB88T7R1.js → menu-BnSEqetd.js} +1 -1
  24. package/dist/client/assets/{opencami-logo-C0Kj1DiT.js → opencami-logo-B_hLbomw.js} +1 -1
  25. package/dist/client/assets/{proxy-D-juuhw6.js → proxy-BnlGpgC1.js} +1 -1
  26. package/dist/client/assets/{react-Akh4y69S.js → react-BgjQyJHw.js} +1 -1
  27. package/dist/client/assets/{search-dialog-BasfzCyM.js → search-dialog-Bib2QY9u.js} +1 -1
  28. package/dist/client/assets/{search-sources-badge-DwFHWd7S.js → search-sources-badge-COHcYFRB.js} +1 -1
  29. package/dist/client/assets/{session-export-dialog-CAl3iJnD.js → session-export-dialog-ooPnfHh_.js} +1 -1
  30. package/dist/client/assets/settings-dialog-B8mz99u-.js +1 -0
  31. package/dist/client/assets/skills-DA9J_tsC.js +2 -0
  32. package/dist/client/assets/{skills-panel-B7BRAofP.js → skills-panel-D2uMdCHp.js} +1 -1
  33. package/dist/client/assets/styles-CWabEzNU.css +1 -0
  34. package/dist/client/assets/{switch-DYEbEgy5.js → switch-BUQ0qH6r.js} +1 -1
  35. package/dist/client/assets/{tabs-eiBvL0H7.js → tabs-BEyU6TjN.js} +1 -1
  36. package/dist/client/assets/{thinking-CariuioI.js → thinking-CA48yhOE.js} +1 -1
  37. package/dist/client/assets/{tooltip-CekkGEYG.js → tooltip-CcIdgcV0.js} +1 -1
  38. package/dist/client/assets/{use-file-explorer-state-Dfyh4GwR.js → use-file-explorer-state-CN_IJGcd.js} +2 -2
  39. package/dist/client/assets/{useBaseUiId-DLhdkHJl.js → useBaseUiId-ClbEYEil.js} +1 -1
  40. package/dist/client/assets/useCompositeItem-B_OxfJee.js +1 -0
  41. package/dist/client/assets/{useControlled-CpliTEve.js → useControlled-CyT-lqbs.js} +1 -1
  42. package/dist/client/assets/{useMutation-CpD2Pn0F.js → useMutation-eQUrsn-X.js} +1 -1
  43. package/dist/client/assets/{useOnFirstRender-DsFYFJoB.js → useOnFirstRender-CR_o2MK_.js} +1 -1
  44. package/dist/client/assets/{useQuery-DMTgpIql.js → useQuery-k6EMRoMD.js} +1 -1
  45. package/dist/server/assets/{_sessionKey-Bhksr7VP.js → _sessionKey-CaFqmyhU.js} +388 -390
  46. package/dist/server/assets/{_tanstack-start-manifest_v-D-5ReiD4.js → _tanstack-start-manifest_v-P3skSR3R.js} +1 -1
  47. package/dist/server/assets/{follow-up-suggestions-B3hol2KT.js → follow-up-suggestions-DHv2_XzB.js} +13 -74
  48. package/dist/server/assets/{index-4G_4vZNY.js → index-C7lmufwX.js} +1 -1
  49. package/dist/server/assets/{router-C9JRmWMm.js → router-X2L0PDPI.js} +133 -294
  50. package/dist/server/assets/{search-dialog-CTJULPB8.js → search-dialog-CXhofdoP.js} +2 -2
  51. package/dist/server/assets/{settings-dialog-B5yR2pBy.js → settings-dialog-CPdftvjz.js} +1 -254
  52. package/dist/server/assets/{thinking-CHx4Oouj.js → thinking-YkRSlXtf.js} +2 -2
  53. package/dist/server/server.js +2 -2
  54. package/package.json +1 -1
  55. package/dist/client/assets/_sessionKey-DYknvaDS.js +0 -23
  56. package/dist/client/assets/agents-DNywJUai.js +0 -2
  57. package/dist/client/assets/bots-Bqjqhws8.js +0 -2
  58. package/dist/client/assets/button-DqP4GZwZ.js +0 -1
  59. package/dist/client/assets/file-explorer-screen-CZ2QKk-0.js +0 -1
  60. package/dist/client/assets/files-Cbhud0J8.js +0 -2
  61. package/dist/client/assets/follow-up-suggestions-Bi3Ci2my.js +0 -5
  62. package/dist/client/assets/memory-BRa-0plj.js +0 -2
  63. package/dist/client/assets/settings-dialog-C8OoRXwX.js +0 -1
  64. package/dist/client/assets/skills-Cx12984a.js +0 -2
  65. package/dist/client/assets/styles-CXa-SiWC.css +0 -1
  66. package/dist/client/assets/useCompositeItem-DTSTTR0Z.js +0 -1
@@ -1 +1 @@
1
- import{r as n,j as W,w as ot}from"./main-ZBMVSJTF.js";import{ab as Ee,ac as Pe,ad as qe,E as At,ag as Oe,C as Dt,ah as $e,c as Je}from"./button-DqP4GZwZ.js";import{u as Lt,a as Te,b as Me,c as Qe,d as dt,e as Ht,p as pt,t as Kt,F as Ut,D as jt,P as Bt,f as _t,R as Gt,g as Vt,h as Wt,i as gt,j as zt,k as $,l as Yt,m as qt,n as mt,o as $t,q as Xt,r as Jt,s as Qt,T as Zt,v as xt,w as en,x as tn,y as nn,z as on,A as rn,B as sn,C as an,E as rt,G as st,H as cn}from"./useOnFirstRender-DsFYFJoB.js";import{t as ht,g as ne,u as fe,a as me,l as De,i as Xe,j as He,k as yt,f as Rt,e as bt,o as un,m as Ke,s as Le,p as ln,q as it,r as fn,v as dn,w as pn,x as gn,b as mn,y as xn}from"./useBaseUiId-DLhdkHJl.js";import{e as at,F as hn,I as yn,i as Rn,f as bn,g as vn,h as Cn}from"./use-file-explorer-state-Dfyh4GwR.js";import{u as In}from"./DirectionContext-CQMv7g2N.js";import{i as ct,f as Tn,g as Mn,h as En,j as Pn,d as ut,o as Ue,e as ve,s as he,a as je,b as Se,c as we,k as On,l as Sn,m as wn,A as vt}from"./event-2_Dxdv7h.js";import{h as lt,g as We,a as ft,c as kn,i as ze,b as Fn,d as Nn,e as An,f as Fe,j as Dn,C as Ln,u as Hn}from"./useCompositeItem-DTSTTR0Z.js";import{u as Kn,e as Ct,f as Un,h as jn,i as Bn,j as _n}from"./tooltip-CekkGEYG.js";import{C as Gn}from"./composite-BLgu_EOL.js";function Vn(e,t={}){const o="rootStore"in e?e.rootStore:e,c=o.context.dataRef,{enabled:d=!0,event:x="click",toggle:T=!0,ignoreMouse:r=!1,stickIfOpen:v=!0,touchOpenDelay:C=0,reason:R=ht}=t,m=n.useRef(void 0),O=Lt(),b=Te(),M=n.useMemo(()=>({onPointerDown(u){m.current=u.pointerType},onMouseDown(u){const p=m.current,h=u.nativeEvent,l=o.select("open");if(u.button!==0||x==="click"||ct(p,!0)&&r)return;const w=c.current.openEvent,I=w?.type,s=o.select("domReferenceElement")!==u.currentTarget,i=l&&s||!(l&&T&&(!(w&&v)||I==="click"||I==="mousedown"));if(Mn(h.target)){const S=ne(R,h,h.target);i&&p==="touch"&&C>0?b.start(C,()=>{o.setOpen(!0,S)}):o.setOpen(i,S);return}const y=u.currentTarget;O.request(()=>{const S=ne(R,h,y);i&&p==="touch"&&C>0?b.start(C,()=>{o.setOpen(!0,S)}):o.setOpen(i,S)})},onClick(u){if(x==="mousedown-only")return;const p=m.current;if(x==="mousedown"&&p){m.current=void 0;return}if(ct(p,!0)&&r)return;const h=o.select("open"),l=c.current.openEvent,w=o.select("domReferenceElement")!==u.currentTarget,I=h&&w||!(h&&T&&(!(l&&v)||Tn(l))),s=ne(R,u.nativeEvent,u.currentTarget);I&&p==="touch"&&C>0?b.start(C,()=>{o.setOpen(!0,s)}):o.setOpen(I,s)},onKeyDown(){m.current=void 0}}),[c,x,r,o,v,T,O,b,C,R]);return n.useMemo(()=>d?{reference:M}:Ee,[d,M])}const Wn="Escape";function Be(e,t,o){switch(e){case"vertical":return t;case"horizontal":return o;default:return t||o}}function Ne(e,t){return Be(t,e===vt||e===je,e===Se||e===we)}function Ye(e,t,o){return Be(t,e===je,o?e===Se:e===we)||e==="Enter"||e===" "||e===""}function zn(e,t,o){return Be(t,o?e===Se:e===we,e===je)}function Yn(e,t,o,c){const d=o?e===we:e===Se,x=e===vt;return t==="both"||t==="horizontal"&&c&&c>1?e===Wn:Be(t,d,x)}function qn(e,t){const o="rootStore"in e?e.rootStore:e,c=o.useState("open"),d=o.useState("floatingElement"),x=o.useState("domReferenceElement"),T=o.context.dataRef,{listRef:r,activeIndex:v,onNavigate:C=()=>{},enabled:R=!0,selectedIndex:m=null,allowEscape:O=!1,loopFocus:b=!1,nested:M=!1,rtl:u=!1,virtual:p=!1,focusItemOnOpen:h="auto",focusItemOnHover:l=!0,openOnArrowKeyDown:w=!0,disabledIndices:I=void 0,orientation:s="vertical",parentOrientation:i,cols:y=1,id:S,resetOnPointerLeave:G=!0,externalTree:H}=t,Y=En(d),B=Me(Y),L=Qe(),N=dt(H);fe(()=>{T.current.orientation=s},[T,s]);const V=Pn(x),q=n.useRef(h),f=n.useRef(m??-1),K=n.useRef(null),X=n.useRef(!0),F=me(a=>{C(f.current===-1?null:f.current,a)}),J=n.useRef(F),Q=n.useRef(!!d),oe=n.useRef(c),P=n.useRef(!1),re=n.useRef(!1),xe=Me(I),ue=Me(c),se=Me(m),le=Me(G),ee=me(()=>{function a(z){p?N?.events.emit("virtualfocus",z):at(z,{sync:P.current,preventScroll:!0})}const k=r.current[f.current],g=re.current;k&&a(k),(P.current?z=>z():requestAnimationFrame)(()=>{const z=r.current[f.current]||k;if(!z)return;k||a(z),A&&(g||!X.current)&&z.scrollIntoView?.({block:"nearest",inline:"nearest"})})});fe(()=>{R&&(c&&d?(f.current=m??-1,q.current&&m!=null&&(re.current=!0,F())):Q.current&&(f.current=-1,J.current()))},[R,c,d,m,F]),fe(()=>{if(R){if(!c){P.current=!1;return}if(d)if(v==null){if(P.current=!1,se.current!=null)return;if(Q.current&&(f.current=-1,ee()),(!oe.current||!Q.current)&&q.current&&(K.current!=null||q.current===!0&&K.current==null)){let a=0;const k=()=>{r.current[0]==null?(a<2&&(a?requestAnimationFrame:queueMicrotask)(k),a+=1):(f.current=K.current==null||Ye(K.current,s,u)||M?We(r):ft(r),K.current=null,F())};k()}}else lt(r,v)||(f.current=v,ee(),re.current=!1)}},[R,c,d,v,se,M,r,s,u,F,ee,xe]),fe(()=>{if(!R||d||!N||p||!Q.current)return;const a=N.nodesRef.current,k=a.find(z=>z.id===L)?.context?.elements.floating,g=ut(Ue(d)),j=a.some(z=>z.context&&ve(z.context.elements.floating,g));k&&!j&&X.current&&k.focus({preventScroll:!0})},[R,d,N,L,p]),fe(()=>{J.current=F,oe.current=c,Q.current=!!d}),fe(()=>{c||(K.current=null,q.current=h)},[c,h]);const _=v!=null,A=n.useMemo(()=>{function a(g){if(!ue.current)return;const j=r.current.indexOf(g.currentTarget);j!==-1&&f.current!==j&&(f.current=j,F(g))}return{onFocus(g){P.current=!0,a(g)},onClick:({currentTarget:g})=>g.focus({preventScroll:!0}),onMouseMove(g){P.current=!0,re.current=!1,l&&a(g)},onPointerLeave(g){if(!ue.current||!X.current||g.pointerType==="touch")return;P.current=!0;const j=g.relatedTarget;!l||r.current.includes(j)||le.current&&(at(null,{sync:!0}),f.current=-1,F(g),p||B.current?.focus({preventScroll:!0}))}}},[ue,B,l,r,F,le,p]),ae=n.useCallback(()=>i??N?.nodesRef.current.find(a=>a.id===L)?.context?.dataRef?.current.orientation,[L,N,i]),de=me(a=>{if(X.current=!1,P.current=!0,a.which===229||!ue.current&&a.currentTarget===B.current)return;if(M&&Yn(a.key,s,u,y)){Ne(a.key,ae())||he(a),o.setOpen(!1,ne(De,a.nativeEvent)),Xe(x)&&(p?N?.events.emit("virtualfocus",x):x.focus());return}const k=f.current,g=We(r,I),j=ft(r,I);if(V||(a.key==="Home"&&(he(a),f.current=g,F(a)),a.key==="End"&&(he(a),f.current=j,F(a))),y>1){const z=Array.from({length:r.current.length},()=>({width:1,height:1})),ie=kn(z,y,!1),ye=ie.findIndex(ge=>ge!=null&&!ze(r,ge,I)),Ie=ie.reduce((ge,be,Ge)=>be!=null&&!ze(r,be,I)?Ge:ge,-1),Re=ie[Fn({current:ie.map(ge=>ge!=null?r.current[ge]:null)},{event:a,orientation:s,loopFocus:b,rtl:u,cols:y,disabledIndices:An([...(typeof I!="function"?I:null)||r.current.map((ge,be)=>ze(r,be,I)?be:void 0),void 0],ie),minIndex:ye,maxIndex:Ie,prevIndex:Nn(f.current>j?g:f.current,z,ie,y,a.key===je?"bl":a.key===(u?Se:we)?"tr":"tl"),stopEvent:!0})];if(Re!=null&&(f.current=Re,F(a)),s==="both")return}if(Ne(a.key,s)){if(he(a),c&&!p&&ut(a.currentTarget.ownerDocument)===a.currentTarget){f.current=Ye(a.key,s,u)?g:j,F(a);return}Ye(a.key,s,u)?b?k>=j?O&&k!==r.current.length?f.current=-1:(P.current=!1,f.current=g):f.current=Fe(r,{startingIndex:k,disabledIndices:I}):f.current=Math.min(j,Fe(r,{startingIndex:k,disabledIndices:I})):b?k<=g?O&&k!==-1?f.current=r.current.length:(P.current=!1,f.current=j):f.current=Fe(r,{startingIndex:k,decrement:!0,disabledIndices:I}):f.current=Math.max(g,Fe(r,{startingIndex:k,decrement:!0,disabledIndices:I})),lt(r,f.current)&&(f.current=-1),F(a)}}),pe=n.useMemo(()=>p&&c&&_&&{"aria-activedescendant":`${S}-${v}`},[p,c,_,S,v]),ce=n.useMemo(()=>({"aria-orientation":s==="both"?void 0:s,...V?{}:pe,onKeyDown(a){if(a.key==="Tab"&&a.shiftKey&&c&&!p){const k=On(a.nativeEvent);if(k&&!ve(B.current,k))return;he(a),o.setOpen(!1,ne(He,a.nativeEvent)),Xe(x)&&x.focus();return}de(a)},onPointerMove(){X.current=!0}}),[pe,de,B,s,V,o,c,p,x]),U=n.useMemo(()=>{function a(g){h==="auto"&&Sn(g.nativeEvent)&&(q.current=!p)}function k(g){q.current=h,h==="auto"&&wn(g.nativeEvent)&&(q.current=!0)}return{onKeyDown(g){const j=o.select("open");X.current=!1;const z=g.key.startsWith("Arrow"),ie=zn(g.key,ae(),u),ye=Ne(g.key,s),Ie=(M?ie:ye)||g.key==="Enter"||g.key.trim()==="";if(p&&j)return de(g);if(!(!j&&!w&&z)){if(Ie){const Re=Ne(g.key,ae());K.current=M&&Re?null:g.key}if(M){ie&&(he(g),j?(f.current=We(r,xe.current),F(g)):o.setOpen(!0,ne(De,g.nativeEvent,g.currentTarget)));return}ye&&(se.current!=null&&(f.current=se.current),he(g),!j&&w?o.setOpen(!0,ne(De,g.nativeEvent,g.currentTarget)):de(g),j&&F(g))}},onFocus(g){o.select("open")&&!p&&(f.current=-1,F(g))},onPointerDown:k,onPointerEnter:k,onMouseDown:a,onClick:a}},[de,xe,h,r,M,F,o,w,s,ae,u,se,p]),Z=n.useMemo(()=>({...pe,...U}),[pe,U]);return n.useMemo(()=>R?{reference:Z,floating:ce,item:A,trigger:U}:{},[R,Z,ce,U,A])}function $n(e,t){const o="rootStore"in e?e.rootStore:e,c=o.context.dataRef,d=o.useState("open"),{listRef:x,activeIndex:T,onMatch:r,onTypingChange:v,enabled:C=!0,resetMs:R=750,selectedIndex:m=null}=t,O=Te(),b=n.useRef(""),M=n.useRef(m??T??-1),u=n.useRef(null);fe(()=>{!d&&m!==null||(O.clear(),u.current=null,b.current!==""&&(b.current=""))},[d,m,O]),fe(()=>{d&&b.current===""&&(M.current=m??T??-1)},[d,m,T]);const p=me(s=>{s?c.current.typing||(c.current.typing=s,v?.(s)):c.current.typing&&(c.current.typing=s,v?.(s))}),h=me(s=>{function i(B,L,N){const V=L.find(q=>q?.toLocaleLowerCase().indexOf(N.toLocaleLowerCase())===0);return V?B.indexOf(V):-1}const y=x.current;if(b.current.length>0&&b.current[0]!==" "&&(i(y,y,b.current)===-1?p(!1):s.key===" "&&he(s)),y==null||s.key.length!==1||s.ctrlKey||s.metaKey||s.altKey)return;d&&s.key!==" "&&(he(s),p(!0));const S=b.current==="";S&&(M.current=m??T??-1),y.every(B=>B?B[0]?.toLocaleLowerCase()!==B[1]?.toLocaleLowerCase():!0)&&b.current===s.key&&(b.current="",M.current=u.current),b.current+=s.key,O.start(R,()=>{b.current="",M.current=u.current,p(!1)});const H=S?m??T??-1:M.current,Y=i(y,[...y.slice((H||0)+1),...y.slice(0,(H||0)+1)],b.current);Y!==-1?(r?.(Y),u.current=Y):s.key!==" "&&(b.current="",p(!1))}),l=me(s=>{const i=s.relatedTarget,y=o.select("domReferenceElement"),S=o.select("floatingElement"),G=ve(y,i),H=ve(S,i);G||H||(O.clear(),b.current="",M.current=u.current,p(!1))}),w=n.useMemo(()=>({onKeyDown:h,onBlur:l}),[h,l]),I=n.useMemo(()=>({onKeyDown:h,onKeyUp(s){s.key===" "&&p(!1)},onBlur:l}),[h,l,p]);return n.useMemo(()=>C?{reference:w,floating:I}:{},[C,w,I])}const It=n.createContext(void 0);function Tt(e){const t=n.useContext(It);if(t===void 0&&!e)throw new Error(Pe(33));return t}const Mt=n.createContext(void 0);function Ce(e){const t=n.useContext(Mt);if(t===void 0&&!e)throw new Error(Pe(36));return t}const Xn=n.createContext(void 0);function _e(e=!0){const t=n.useContext(Xn);if(t===void 0&&!e)throw new Error(Pe(25));return t}function Jn(e){const{closeOnClick:t,highlighted:o,id:c,nodeId:d,store:x,itemRef:T,itemMetadata:r}=e,{events:v}=x.useState("floatingTreeRoot"),C=_e(!0),R=C!==void 0;return n.useMemo(()=>({id:c,role:"menuitem",tabIndex:o?0:-1,onMouseMove(m){d&&v.emit("itemhover",{nodeId:d,target:m.currentTarget})},onClick(m){t&&v.emit("close",{domEvent:m,reason:yt})},onMouseUp(m){if(C){const O=C.initialCursorPointRef.current;if(C.initialCursorPointRef.current=null,R&&O&&Math.abs(m.clientX-O.x)<=1&&Math.abs(m.clientY-O.y)<=1)return}T.current&&x.context.allowMouseUpTriggerRef.current&&(!R||m.button===2)&&(!r||r.type==="regular-item")&&T.current.click()}}),[t,o,c,v,d,x,T,C,R,r])}const Qn={type:"regular-item"};function Zn(e){const{closeOnClick:t,disabled:o=!1,highlighted:c,id:d,store:x,nativeButton:T,itemMetadata:r,nodeId:v}=e,C=n.useRef(null),{getButtonProps:R,buttonRef:m}=Rt({disabled:o,focusableWhenDisabled:!0,native:T}),O=Jn({closeOnClick:t,highlighted:c,id:d,nodeId:v,store:x,itemRef:C,itemMetadata:r}),b=n.useCallback(u=>qe(O,{onMouseEnter(){r.type==="submenu-trigger"&&r.setActive()},onKeyUp(p){p.key===" "&&x.context.typingRef.current&&p.preventBaseUIHandler()}},u,R),[O,R,x,r]),M=At(C,m);return n.useMemo(()=>({getItemProps:b,itemRef:M}),[b,M])}const eo=n.forwardRef(function(t,o){const{render:c,className:d,id:x,label:T,nativeButton:r=!1,disabled:v=!1,closeOnClick:C=!0,...R}=t,m=Dn({label:T}),O=Tt(!0),b=bt(x),{store:M}=Ce(),u=M.useState("isActive",m.index),p=M.useState("itemProps"),{getItemProps:h,itemRef:l}=Zn({closeOnClick:C,disabled:v,highlighted:u,id:b,store:M,nativeButton:r,nodeId:O?.nodeId,itemMetadata:Qn});return Oe("div",t,{state:{disabled:v,highlighted:u},props:[p,R,h],ref:[l,o,m.ref]})}),to=n.createContext(void 0);function no(e){return n.useContext(to)}const oo={...pt,...Kt},ro=n.forwardRef(function(t,o){const{render:c,className:d,finalFocus:x,...T}=t,{store:r}=Ce(),{side:v,align:C}=Tt(),R=no()!=null,m=r.useState("open"),O=r.useState("transitionStatus"),b=r.useState("popupProps"),M=r.useState("mounted"),u=r.useState("instantType"),p=r.useState("activeTriggerElement"),h=r.useState("parent"),l=r.useState("lastOpenChangeReason"),w=r.useState("rootId"),I=r.useState("floatingRootContext"),s=r.useState("floatingTreeRoot"),i=r.useState("closeDelay"),y=r.useState("activeTriggerElement"),S=h.type==="context-menu";Ht({open:m,ref:r.context.popupRef,onComplete(){m&&r.context.onOpenChangeComplete?.(!0)}}),n.useEffect(()=>{function N(V){r.setOpen(!1,ne(V.reason,V.domEvent))}return s.events.on("close",N),()=>{s.events.off("close",N)}},[s.events,r]);const G=r.useState("hoverEnabled"),H=r.useState("disabled");Kn(I,{enabled:G&&!H&&!S&&h.type!=="menubar",closeDelay:i});const Y={transitionStatus:O,side:v,align:C,open:m,nested:h.type==="menu",instant:u},B=Oe("div",t,{state:Y,ref:[o,r.context.popupRef],stateAttributesMapping:oo,props:[b,{onKeyDown(N){R&&Gn.has(N.key)&&N.stopPropagation()}},Ct(O),T,{"data-rootownerid":w}]});let L=h.type===void 0||S;return(p||h.type==="menubar"&&l!==un)&&(L=!0),W.jsx(hn,{context:I,modal:S,disabled:!M,returnFocus:x===void 0?L:x,initialFocus:h.type!=="menu",restoreFocus:!0,externalTree:h.type!=="menubar"?s:void 0,previousFocusableElement:y,nextFocusableElement:h.type===void 0?r.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:h.type===void 0?r.context.beforeContentFocusGuardRef:void 0,children:B})}),Et=n.createContext(void 0);function so(){const e=n.useContext(Et);if(e===void 0)throw new Error(Pe(32));return e}const io=n.forwardRef(function(t,o){const{keepMounted:c=!1,...d}=t,{store:x}=Ce();return x.useState("mounted")||c?W.jsx(Et.Provider,{value:c,children:W.jsx(Ut,{ref:o,...d})}):null}),ao=n.forwardRef(function(t,o){const{anchor:c,positionMethod:d="absolute",className:x,render:T,side:r,align:v,sideOffset:C=0,alignOffset:R=0,collisionBoundary:m="clipping-ancestors",collisionPadding:O=5,arrowPadding:b=5,sticky:M=!1,disableAnchorTracking:u=!1,collisionAvoidance:p=jt,...h}=t,{store:l}=Ce(),w=so(),I=_e(!0),s=l.useState("parent"),i=l.useState("floatingRootContext"),y=l.useState("floatingTreeRoot"),S=l.useState("mounted"),G=l.useState("open"),H=l.useState("modal"),Y=l.useState("activeTriggerElement"),B=l.useState("transitionStatus"),L=l.useState("lastOpenChangeReason"),N=l.useState("floatingNodeId"),V=l.useState("floatingParentNodeId");let q=c,f=C,K=R,X=v,F=p;s.type==="context-menu"&&(q=c??s.context?.anchor,X=X??"start",!r&&X!=="center"&&(K=t.alignOffset??2,f=t.sideOffset??-5));let J=r,Q=X;s.type==="menu"?(J=J??"inline-end",Q=Q??"start",F=t.collisionAvoidance??Bt):s.type==="menubar"&&(J=J??"bottom",Q=Q??"start");const oe=s.type==="context-menu",P=Un({anchor:q,floatingRootContext:i,positionMethod:I?"fixed":d,mounted:S,side:J,sideOffset:f,align:Q,alignOffset:K,arrowPadding:oe?0:b,collisionBoundary:m,collisionPadding:O,sticky:M,nodeId:N,keepMounted:w,disableAnchorTracking:u,collisionAvoidance:F,shiftCrossAxis:oe&&!("side"in F&&F.side==="flip"),externalTree:y}),re=n.useMemo(()=>{const _={};return G||(_.pointerEvents="none"),{role:"presentation",hidden:!S,style:{...P.positionerStyles,..._}}},[G,S,P.positionerStyles]);n.useEffect(()=>{function _(A){A.open&&(A.parentNodeId===N&&l.set("hoverEnabled",!1),A.nodeId!==N&&A.parentNodeId===l.select("floatingParentNodeId")&&l.setOpen(!1,ne(Le)))}return y.events.on("menuopenchange",_),()=>{y.events.off("menuopenchange",_)}},[l,y.events,N]),n.useEffect(()=>{if(l.select("floatingParentNodeId")==null)return;function _(A){if(A.open||A.nodeId!==l.select("floatingParentNodeId"))return;const ae=A.reason??Le;l.setOpen(!1,ne(ae))}return y.events.on("menuopenchange",_),()=>{y.events.off("menuopenchange",_)}},[y.events,l]),n.useEffect(()=>{function _(A){!G||A.nodeId!==l.select("floatingParentNodeId")||A.target&&Y&&Y!==A.target&&l.setOpen(!1,ne(Le))}return y.events.on("itemhover",_),()=>{y.events.off("itemhover",_)}},[y.events,G,Y,l]),n.useEffect(()=>{const _={open:G,nodeId:N,parentNodeId:V,reason:l.select("lastOpenChangeReason")};y.events.emit("menuopenchange",_)},[y.events,G,l,N,V]);const xe={open:G,side:P.side,align:P.align,anchorHidden:P.anchorHidden,nested:s.type==="menu"},ue=n.useMemo(()=>({side:P.side,align:P.align,arrowRef:P.arrowRef,arrowUncentered:P.arrowUncentered,arrowStyles:P.arrowStyles,nodeId:P.context.nodeId}),[P.side,P.align,P.arrowRef,P.arrowUncentered,P.arrowStyles,P.context.nodeId]),se=Oe("div",t,{state:xe,stateAttributesMapping:pt,ref:[o,l.useStateSetter("positionerElement")],props:[re,Ct(B),h]}),le=S&&s.type!=="menu"&&(s.type!=="menubar"&&H&&L!==Ke||s.type==="menubar"&&s.context.modal);let ee=null;return s.type==="menubar"?ee=s.context.contentElement:s.type===void 0&&(ee=Y),W.jsxs(It.Provider,{value:ue,children:[le&&W.jsx(yn,{ref:s.type==="context-menu"||s.type==="nested-context-menu"?s.context.internalBackdropRef:null,inert:Rn(!G),cutout:ee}),W.jsx(_t,{id:N,children:W.jsx(Ln,{elementsRef:l.context.itemDomElements,labelsRef:l.context.itemLabels,children:se})})]})}),co=n.createContext(null);function Pt(e){return n.useContext(co)}const uo={...Wt,disabled:$(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:$(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:$(e=>e.allowMouseEnter),stickIfOpen:$(e=>e.stickIfOpen),parent:$(e=>e.parent),rootId:$(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:$(e=>e.activeIndex),isActive:$((e,t)=>e.activeIndex===t),hoverEnabled:$(e=>e.hoverEnabled),instantType:$(e=>e.instantType),lastOpenChangeReason:$(e=>e.openChangeReason),floatingTreeRoot:$(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:$(e=>e.floatingNodeId),floatingParentNodeId:$(e=>e.floatingParentNodeId),itemProps:$(e=>e.itemProps),closeDelay:$(e=>e.closeDelay),keyboardEventRelay:$(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class Ze extends Gt{constructor(t){super({...lo(),...t},{positionerRef:n.createRef(),popupRef:n.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:n.createRef(),beforeContentFocusGuardRef:n.createRef(),onOpenChangeComplete:void 0,triggerElements:new Vt},uo),this.unsubscribeParentListener=this.observe("parent",o=>{if(this.unsubscribeParentListener?.(),o.type==="menu"){this.unsubscribeParentListener=o.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=o.store.context.allowMouseUpTriggerRef;return}o.type!==void 0&&(this.context.allowMouseUpTriggerRef=o.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,o){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:o})}static useStore(t,o){const c=Dt(()=>new Ze(o)).current;return t??c}unsubscribeParentListener=null}function lo(){return{...zt(),disabled:!1,modal:!0,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new gt,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Ee,keyboardEventRelay:void 0,closeDelay:0}}const fo=n.createContext(void 0);function po(){return n.useContext(fo)}const go=Yt(function(t){const{children:o,open:c,onOpenChange:d,onOpenChangeComplete:x,defaultOpen:T=!1,disabled:r=!1,modal:v,loopFocus:C=!0,orientation:R="vertical",actionsRef:m,closeParentOnEsc:O=!1,handle:b,triggerId:M,defaultTriggerId:u=null,highlightItemOnHover:p=!0}=t,h=_e(!0),l=Ce(!0),w=Pt(!0),I=po(),s=n.useMemo(()=>I&&l?{type:"menu",store:l.store}:w?{type:"menubar",context:w}:h&&!l?{type:"context-menu",context:h}:{type:void 0},[h,l,w,I]),i=Ze.useStore(b?.store,{open:T,openProp:c,activeTriggerId:u,triggerIdProp:M,parent:s});qt(()=>{c===void 0&&i.state.open===!1&&T===!0&&i.update({open:!0,activeTriggerId:u})}),i.useControlledProp("openProp",c),i.useControlledProp("triggerIdProp",M),i.useContextCallback("onOpenChangeComplete",x);const y=i.useState("floatingTreeRoot"),S=mt(y),G=Qe();fe(()=>{h&&!l?i.update({parent:{type:"context-menu",context:h},floatingNodeId:S,floatingParentNodeId:G}):l&&i.update({floatingNodeId:S,floatingParentNodeId:G})},[h,l,S,G,i]);const H=i.useState("open"),Y=i.useState("activeTriggerElement"),B=i.useState("positionerElement"),L=i.useState("hoverEnabled"),N=i.useState("modal"),V=i.useState("disabled"),q=i.useState("lastOpenChangeReason"),f=i.useState("parent"),K=i.useState("activeIndex"),X=i.useState("payload"),F=i.useState("floatingParentNodeId"),J=n.useRef(null),Q=F!=null;let oe;i.useSyncedValues({disabled:r,modal:f.type===void 0?v:void 0,rootId:ln()});const{openMethod:P,triggerProps:re,reset:xe}=bn(H);$t(i);const{forceUnmount:ue}=Xt(H,i,()=>{i.update({allowMouseEnter:!1,stickIfOpen:!0}),xe()}),se=n.useRef(f.type!=="context-menu"),le=Te();n.useEffect(()=>{if(H||(J.current=null),f.type==="context-menu"){if(!H){le.clear(),se.current=!1;return}le.start(500,()=>{se.current=!0})}},[le,H,f.type]),vn(H&&N&&q!==Ke&&P!=="touch",B),fe(()=>{!H&&!L&&i.set("hoverEnabled",!0)},[H,L,i]);const ee=n.useRef(!0),_=Te(),A=me((E,D)=>{const te=D.reason;if(H===E&&D.trigger===Y&&q===te||(D.preventUnmountOnClose=()=>{i.set("preventUnmountingOnClose",!0)},!E&&D.trigger==null&&(D.trigger=Y??void 0),d?.(E,D),D.isCanceled))return;const kt={open:E,nativeEvent:D.event,reason:D.reason,nested:Q};oe?.emit("openchange",kt);const ke=D.event;if(E===!1&&ke?.type==="click"&&ke.pointerType==="touch"&&!ee.current)return;if(!E&&K!==null){const Nt=i.context.itemDomElements.current[K];queueMicrotask(()=>{Nt?.setAttribute("tabindex","-1")})}E&&te===it?(ee.current=!1,_.start(300,()=>{ee.current=!0})):(ee.current=!0,_.clear());const tt=(te===ht||te===yt)&&ke.detail===0&&ke?.isTrusted,Ft=!E&&(te===fn||te==null),Ve={open:E,openChangeReason:te};J.current=D.event??null;const nt=D.trigger?.id??null;(nt||E)&&(Ve.activeTriggerId=nt,Ve.activeTriggerElement=D.trigger??null),i.update(Ve),f.type==="menubar"&&(te===it||te===He||te===Ke||te===De||te===Le)?i.set("instantType","group"):tt||Ft?i.set("instantType",tt?"click":"dismiss"):i.set("instantType",void 0)}),ae=n.useCallback(E=>{const D=ne(E);return D.preventUnmountOnClose=()=>{i.set("preventUnmountingOnClose",!0)},D},[i]),de=n.useCallback(()=>{i.setOpen(!1,ae(dn))},[i,ae]);n.useImperativeHandle(m,()=>({unmount:ue,close:de}),[ue,de]);let pe;f.type==="context-menu"&&(pe=f.context),n.useImperativeHandle(pe?.positionerRef,()=>B,[B]),n.useImperativeHandle(pe?.actionsRef,()=>({setOpen:A}),[A]);const ce=Jt({popupStore:i,onOpenChange:A});oe=ce.context.events,n.useEffect(()=>{const E=({open:D,eventDetails:te})=>A(D,te);return oe.on("setOpen",E),()=>{oe?.off("setOpen",E)}},[oe,A]);const U=Qt(ce,{enabled:!V,bubbles:{escapeKey:O&&f.type==="menu"},outsidePress(){return f.type!=="context-menu"||J.current?.type==="contextmenu"?!0:se.current},externalTree:Q?y:void 0}),Z=Cn(ce,{role:"menu"}),a=In(),k=n.useCallback(E=>{i.select("activeIndex")!==E&&i.set("activeIndex",E)},[i]),g=qn(ce,{enabled:!V,listRef:i.context.itemDomElements,activeIndex:K,nested:f.type!==void 0,loopFocus:C,orientation:R,parentOrientation:f.type==="menubar"?f.context.orientation:void 0,rtl:a==="rtl",disabledIndices:$e,onNavigate:k,openOnArrowKeyDown:f.type!=="context-menu",externalTree:Q?y:void 0,focusItemOnHover:p}),j=n.useCallback(E=>{i.context.typingRef.current=E},[i]),z=$n(ce,{listRef:i.context.itemLabels,activeIndex:K,resetMs:Zt,onMatch:E=>{H&&E!==K&&i.set("activeIndex",E)},onTypingChange:j}),{getReferenceProps:ie,getFloatingProps:ye,getItemProps:Ie,getTriggerProps:Re}=xt([U,Z,g,z]),ge=n.useMemo(()=>{const E=qe(ie(),{onMouseMove(){i.set("allowMouseEnter",!0)}},re);return delete E.role,E},[ie,i,re]),be=n.useMemo(()=>{const E=Re();if(!E)return E;const D=qe(E,re);return delete D.role,delete D["aria-controls"],D},[Re,re]),Ge=n.useMemo(()=>ye({onMouseMove(){i.set("allowMouseEnter",!0),f.type==="menu"&&i.set("hoverEnabled",!1)},onClick(){i.select("hoverEnabled")&&i.set("hoverEnabled",!1)},onKeyDown(E){const D=i.select("keyboardEventRelay");D&&!E.isPropagationStopped()&&D(E)}}),[ye,f.type,i]),St=n.useMemo(()=>Ie(),[Ie]);i.useSyncedValues({floatingRootContext:ce,activeTriggerProps:ge,inactiveTriggerProps:be,popupProps:Ge,itemProps:St});const wt=n.useMemo(()=>({store:i,parent:s}),[i,s]),et=W.jsx(Mt.Provider,{value:wt,children:typeof o=="function"?o({payload:X}):o});return f.type===void 0||f.type==="context-menu"?W.jsx(en,{externalTree:y,children:et}):et});function mo(e){const t=e.getBoundingClientRect(),o=window.getComputedStyle(e,"::before"),c=window.getComputedStyle(e,"::after");if(!(o.content!=="none"||c.content!=="none"))return t;const x=parseFloat(o.width)||0,T=parseFloat(o.height)||0,r=parseFloat(c.width)||0,v=parseFloat(c.height)||0,C=Math.max(t.width,x,r),R=Math.max(t.height,T,v),m=C-t.width,O=R-t.height;return{left:t.left-m/2,right:t.right+m/2,top:t.top-O/2,bottom:t.bottom+O/2}}function xo(e){const{render:t,className:o,state:c=Ee,props:d=$e,refs:x=$e,metadata:T,stateAttributesMapping:r,tag:v="div",...C}=e,{compositeProps:R,compositeRef:m}=Hn({metadata:T});return Oe(v,e,{state:c,ref:[...x,m],props:[R,...d,C],stateAttributesMapping:r})}function Ot(e){if(Xe(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!pn(e))return Ot(gn(e))}function ho(e){const{enabled:t=!0,mouseDownAction:o,open:c}=e,d=n.useRef(!1);return n.useMemo(()=>t?{onMouseDown:x=>{(o==="open"&&!c||o==="close"&&c)&&(d.current=!0,Ue(x.currentTarget).addEventListener("click",()=>{d.current=!1},{once:!0}))},onClick:x=>{d.current&&(d.current=!1,x.preventBaseUIHandler())}}:Ee,[t,o,c])}const Ae=2,yo=tn(function(t,o){const{render:c,className:d,disabled:x=!1,nativeButton:T=!0,id:r,openOnHover:v,delay:C=100,closeDelay:R=0,handle:m,payload:O,...b}=t,M=Ce(!0),u=m?.store??M?.store;if(!u)throw new Error(Pe(85));const p=bt(r),h=u.useState("isTriggerActive",p),l=u.useState("floatingRootContext"),w=u.useState("isOpenedByTrigger",p),I=n.useRef(null),s=bo(),i=mn(!0),y=dt(),S=n.useMemo(()=>y??new gt,[y]),G=mt(S),H=Qe(),{registerTrigger:Y,isMountedByThisTrigger:B}=nn(p,I,u,{payload:O,closeDelay:R,parent:s,floatingTreeRoot:S,floatingNodeId:G,floatingParentNodeId:H,keyboardEventRelay:i?.relayKeyboardEvent}),L=s.type==="menubar",N=u.useState("disabled"),V=x||N||L&&s.context.disabled,{getButtonProps:q,buttonRef:f}=Rt({disabled:V,native:T});n.useEffect(()=>{!w&&s.type===void 0&&(u.context.allowMouseUpTriggerRef.current=!1)},[u,w,s.type]);const K=n.useRef(null),X=Te(),F=me(U=>{if(!K.current)return;X.clear(),u.context.allowMouseUpTriggerRef.current=!1;const Z=U.target;if(ve(K.current,Z)||ve(u.select("positionerElement"),Z)||Z===K.current||Z!=null&&Ot(Z)===u.select("rootId"))return;const a=mo(K.current);U.clientX>=a.left-Ae&&U.clientX<=a.right+Ae&&U.clientY>=a.top-Ae&&U.clientY<=a.bottom+Ae||S.events.emit("close",{domEvent:U,reason:xn})});n.useEffect(()=>{w&&u.select("lastOpenChangeReason")===Ke&&Ue(K.current).addEventListener("mouseup",F,{once:!0})},[w,F,u]);const J=L&&s.context.hasSubmenuOpen,oe=jn(l,{enabled:(v??J)&&!V&&s.type!=="context-menu"&&(!L||J&&!B),handleClose:Bn({blockPointerEvents:!L}),mouseOnly:!0,move:!1,restMs:s.type===void 0?C:void 0,delay:{close:R},triggerElementRef:I,externalTree:S,isActiveTrigger:h}),P=Ro(w,u.select("lastOpenChangeReason")),re=Vn(l,{enabled:!V&&s.type!=="context-menu",event:w&&L?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:s.type===void 0?P:!1}),xe=_n(l,{enabled:!V&&J}),ue=ho({open:w,enabled:L,mouseDownAction:"open"}),se=xt([re,xe]),le={disabled:V,open:w},ee=u.useState("triggerProps",B),_=[K,o,f,Y,I],A=[se.getReferenceProps(),oe??Ee,ee,{"aria-haspopup":"menu",id:p,onMouseDown:U=>{if(u.select("open"))return;X.start(200,()=>{u.context.allowMouseUpTriggerRef.current=!0}),Ue(U.currentTarget).addEventListener("mouseup",F,{once:!0})}},L?{role:"menuitem"}:{},ue,b,q],ae=n.useRef(null),de=me(U=>{ot.flushSync(()=>{u.setOpen(!1,ne(He,U.nativeEvent,U.currentTarget))}),on(ae.current)?.focus()}),pe=me(U=>{const Z=u.select("positionerElement");if(Z&&rn(U,Z))u.context.beforeContentFocusGuardRef.current?.focus();else{ot.flushSync(()=>{u.setOpen(!1,ne(He,U.nativeEvent,U.currentTarget))});let a=sn(u.context.triggerFocusTargetRef.current||I.current);for(;a!==null&&ve(Z,a);){const k=a;if(a=an(a),a===k)break}a?.focus()}}),ce=Oe("button",t,{enabled:!L,stateAttributesMapping:rt,state:le,ref:_,props:A});return L?W.jsx(xo,{tag:"button",render:c,className:d,state:le,refs:_,props:A,stateAttributesMapping:rt}):w?W.jsxs(n.Fragment,{children:[W.jsx(st,{ref:ae,onFocus:de},`${p}-pre-focus-guard`),W.jsx(n.Fragment,{children:ce},p),W.jsx(st,{ref:u.context.triggerFocusTargetRef,onFocus:pe},`${p}-post-focus-guard`)]}):W.jsx(n.Fragment,{children:ce},p)});function Ro(e,t){const o=Te(),[c,d]=n.useState(!1);return fe(()=>{e&&t==="trigger-hover"?(d(!0),o.start(cn,()=>{d(!1)})):e||(o.clear(),d(!1))},[e,t,o]),c}function bo(){const e=_e(!0),t=Ce(!0),o=Pt();return n.useMemo(()=>o?{type:"menubar",context:o}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,o])}function ko({children:e,...t}){return W.jsx(go,{...t,children:e})}function Fo({className:e,...t}){return W.jsx(yo,{className:Je(e),...t})}function No({className:e,side:t="bottom",align:o="end",children:c}){return W.jsx(io,{children:W.jsx(ao,{side:t,align:o,children:W.jsx(ro,{className:Je("min-w-[110px] rounded-lg bg-primary-50 p-1 text-sm text-primary-900 shadow-lg outline outline-primary-900/10",e),children:c})})})}function Ao({className:e,...t}){return W.jsx(eo,{className:Je("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900 hover:bg-primary-100 data-highlighted:bg-primary-100","select-none font-[450]",e),...t})}export{ko as M,Fo as a,No as b,Ao as c};
1
+ import{r as n,j as W,w as ot}from"./main-xPlWrMhO.js";import{a9 as Ee,aa as Pe,ab as qe,t as At,ae as Oe,u as Dt,af as $e,c as Je}from"./button-D0n2Qsd_.js";import{u as Lt,a as Te,b as Me,c as Qe,d as dt,e as Ht,p as pt,t as Kt,F as Ut,D as jt,P as Bt,f as _t,R as Gt,g as Vt,h as Wt,i as gt,j as zt,k as $,l as Yt,m as qt,n as mt,o as $t,q as Xt,r as Jt,s as Qt,T as Zt,v as xt,w as en,x as tn,y as nn,z as on,A as rn,B as sn,C as an,E as rt,G as st,H as cn}from"./useOnFirstRender-CR_o2MK_.js";import{t as ht,g as ne,u as fe,a as me,l as De,i as Xe,j as He,k as yt,f as Rt,e as bt,o as un,m as Ke,s as Le,p as ln,q as it,r as fn,v as dn,w as pn,x as gn,b as mn,y as xn}from"./useBaseUiId-ClbEYEil.js";import{e as at,F as hn,I as yn,i as Rn,f as bn,g as vn,h as Cn}from"./use-file-explorer-state-CN_IJGcd.js";import{u as In}from"./DirectionContext-X-0CRn1O.js";import{i as ct,f as Tn,g as Mn,h as En,j as Pn,d as ut,o as Ue,e as ve,s as he,a as je,b as Se,c as we,k as On,l as Sn,m as wn,A as vt}from"./event-CHpdjYFR.js";import{h as lt,g as We,a as ft,c as kn,i as ze,b as Fn,d as Nn,e as An,f as Fe,j as Dn,C as Ln,u as Hn}from"./useCompositeItem-B_OxfJee.js";import{u as Kn,e as Ct,f as Un,h as jn,i as Bn,j as _n}from"./tooltip-CcIdgcV0.js";import{C as Gn}from"./composite-GtKwZKbV.js";function Vn(e,t={}){const o="rootStore"in e?e.rootStore:e,c=o.context.dataRef,{enabled:d=!0,event:x="click",toggle:T=!0,ignoreMouse:r=!1,stickIfOpen:v=!0,touchOpenDelay:C=0,reason:R=ht}=t,m=n.useRef(void 0),O=Lt(),b=Te(),M=n.useMemo(()=>({onPointerDown(u){m.current=u.pointerType},onMouseDown(u){const p=m.current,h=u.nativeEvent,l=o.select("open");if(u.button!==0||x==="click"||ct(p,!0)&&r)return;const w=c.current.openEvent,I=w?.type,s=o.select("domReferenceElement")!==u.currentTarget,i=l&&s||!(l&&T&&(!(w&&v)||I==="click"||I==="mousedown"));if(Mn(h.target)){const S=ne(R,h,h.target);i&&p==="touch"&&C>0?b.start(C,()=>{o.setOpen(!0,S)}):o.setOpen(i,S);return}const y=u.currentTarget;O.request(()=>{const S=ne(R,h,y);i&&p==="touch"&&C>0?b.start(C,()=>{o.setOpen(!0,S)}):o.setOpen(i,S)})},onClick(u){if(x==="mousedown-only")return;const p=m.current;if(x==="mousedown"&&p){m.current=void 0;return}if(ct(p,!0)&&r)return;const h=o.select("open"),l=c.current.openEvent,w=o.select("domReferenceElement")!==u.currentTarget,I=h&&w||!(h&&T&&(!(l&&v)||Tn(l))),s=ne(R,u.nativeEvent,u.currentTarget);I&&p==="touch"&&C>0?b.start(C,()=>{o.setOpen(!0,s)}):o.setOpen(I,s)},onKeyDown(){m.current=void 0}}),[c,x,r,o,v,T,O,b,C,R]);return n.useMemo(()=>d?{reference:M}:Ee,[d,M])}const Wn="Escape";function Be(e,t,o){switch(e){case"vertical":return t;case"horizontal":return o;default:return t||o}}function Ne(e,t){return Be(t,e===vt||e===je,e===Se||e===we)}function Ye(e,t,o){return Be(t,e===je,o?e===Se:e===we)||e==="Enter"||e===" "||e===""}function zn(e,t,o){return Be(t,o?e===Se:e===we,e===je)}function Yn(e,t,o,c){const d=o?e===we:e===Se,x=e===vt;return t==="both"||t==="horizontal"&&c&&c>1?e===Wn:Be(t,d,x)}function qn(e,t){const o="rootStore"in e?e.rootStore:e,c=o.useState("open"),d=o.useState("floatingElement"),x=o.useState("domReferenceElement"),T=o.context.dataRef,{listRef:r,activeIndex:v,onNavigate:C=()=>{},enabled:R=!0,selectedIndex:m=null,allowEscape:O=!1,loopFocus:b=!1,nested:M=!1,rtl:u=!1,virtual:p=!1,focusItemOnOpen:h="auto",focusItemOnHover:l=!0,openOnArrowKeyDown:w=!0,disabledIndices:I=void 0,orientation:s="vertical",parentOrientation:i,cols:y=1,id:S,resetOnPointerLeave:G=!0,externalTree:H}=t,Y=En(d),B=Me(Y),L=Qe(),N=dt(H);fe(()=>{T.current.orientation=s},[T,s]);const V=Pn(x),q=n.useRef(h),f=n.useRef(m??-1),K=n.useRef(null),X=n.useRef(!0),F=me(a=>{C(f.current===-1?null:f.current,a)}),J=n.useRef(F),Q=n.useRef(!!d),oe=n.useRef(c),P=n.useRef(!1),re=n.useRef(!1),xe=Me(I),ue=Me(c),se=Me(m),le=Me(G),ee=me(()=>{function a(z){p?N?.events.emit("virtualfocus",z):at(z,{sync:P.current,preventScroll:!0})}const k=r.current[f.current],g=re.current;k&&a(k),(P.current?z=>z():requestAnimationFrame)(()=>{const z=r.current[f.current]||k;if(!z)return;k||a(z),A&&(g||!X.current)&&z.scrollIntoView?.({block:"nearest",inline:"nearest"})})});fe(()=>{R&&(c&&d?(f.current=m??-1,q.current&&m!=null&&(re.current=!0,F())):Q.current&&(f.current=-1,J.current()))},[R,c,d,m,F]),fe(()=>{if(R){if(!c){P.current=!1;return}if(d)if(v==null){if(P.current=!1,se.current!=null)return;if(Q.current&&(f.current=-1,ee()),(!oe.current||!Q.current)&&q.current&&(K.current!=null||q.current===!0&&K.current==null)){let a=0;const k=()=>{r.current[0]==null?(a<2&&(a?requestAnimationFrame:queueMicrotask)(k),a+=1):(f.current=K.current==null||Ye(K.current,s,u)||M?We(r):ft(r),K.current=null,F())};k()}}else lt(r,v)||(f.current=v,ee(),re.current=!1)}},[R,c,d,v,se,M,r,s,u,F,ee,xe]),fe(()=>{if(!R||d||!N||p||!Q.current)return;const a=N.nodesRef.current,k=a.find(z=>z.id===L)?.context?.elements.floating,g=ut(Ue(d)),j=a.some(z=>z.context&&ve(z.context.elements.floating,g));k&&!j&&X.current&&k.focus({preventScroll:!0})},[R,d,N,L,p]),fe(()=>{J.current=F,oe.current=c,Q.current=!!d}),fe(()=>{c||(K.current=null,q.current=h)},[c,h]);const _=v!=null,A=n.useMemo(()=>{function a(g){if(!ue.current)return;const j=r.current.indexOf(g.currentTarget);j!==-1&&f.current!==j&&(f.current=j,F(g))}return{onFocus(g){P.current=!0,a(g)},onClick:({currentTarget:g})=>g.focus({preventScroll:!0}),onMouseMove(g){P.current=!0,re.current=!1,l&&a(g)},onPointerLeave(g){if(!ue.current||!X.current||g.pointerType==="touch")return;P.current=!0;const j=g.relatedTarget;!l||r.current.includes(j)||le.current&&(at(null,{sync:!0}),f.current=-1,F(g),p||B.current?.focus({preventScroll:!0}))}}},[ue,B,l,r,F,le,p]),ae=n.useCallback(()=>i??N?.nodesRef.current.find(a=>a.id===L)?.context?.dataRef?.current.orientation,[L,N,i]),de=me(a=>{if(X.current=!1,P.current=!0,a.which===229||!ue.current&&a.currentTarget===B.current)return;if(M&&Yn(a.key,s,u,y)){Ne(a.key,ae())||he(a),o.setOpen(!1,ne(De,a.nativeEvent)),Xe(x)&&(p?N?.events.emit("virtualfocus",x):x.focus());return}const k=f.current,g=We(r,I),j=ft(r,I);if(V||(a.key==="Home"&&(he(a),f.current=g,F(a)),a.key==="End"&&(he(a),f.current=j,F(a))),y>1){const z=Array.from({length:r.current.length},()=>({width:1,height:1})),ie=kn(z,y,!1),ye=ie.findIndex(ge=>ge!=null&&!ze(r,ge,I)),Ie=ie.reduce((ge,be,Ge)=>be!=null&&!ze(r,be,I)?Ge:ge,-1),Re=ie[Fn({current:ie.map(ge=>ge!=null?r.current[ge]:null)},{event:a,orientation:s,loopFocus:b,rtl:u,cols:y,disabledIndices:An([...(typeof I!="function"?I:null)||r.current.map((ge,be)=>ze(r,be,I)?be:void 0),void 0],ie),minIndex:ye,maxIndex:Ie,prevIndex:Nn(f.current>j?g:f.current,z,ie,y,a.key===je?"bl":a.key===(u?Se:we)?"tr":"tl"),stopEvent:!0})];if(Re!=null&&(f.current=Re,F(a)),s==="both")return}if(Ne(a.key,s)){if(he(a),c&&!p&&ut(a.currentTarget.ownerDocument)===a.currentTarget){f.current=Ye(a.key,s,u)?g:j,F(a);return}Ye(a.key,s,u)?b?k>=j?O&&k!==r.current.length?f.current=-1:(P.current=!1,f.current=g):f.current=Fe(r,{startingIndex:k,disabledIndices:I}):f.current=Math.min(j,Fe(r,{startingIndex:k,disabledIndices:I})):b?k<=g?O&&k!==-1?f.current=r.current.length:(P.current=!1,f.current=j):f.current=Fe(r,{startingIndex:k,decrement:!0,disabledIndices:I}):f.current=Math.max(g,Fe(r,{startingIndex:k,decrement:!0,disabledIndices:I})),lt(r,f.current)&&(f.current=-1),F(a)}}),pe=n.useMemo(()=>p&&c&&_&&{"aria-activedescendant":`${S}-${v}`},[p,c,_,S,v]),ce=n.useMemo(()=>({"aria-orientation":s==="both"?void 0:s,...V?{}:pe,onKeyDown(a){if(a.key==="Tab"&&a.shiftKey&&c&&!p){const k=On(a.nativeEvent);if(k&&!ve(B.current,k))return;he(a),o.setOpen(!1,ne(He,a.nativeEvent)),Xe(x)&&x.focus();return}de(a)},onPointerMove(){X.current=!0}}),[pe,de,B,s,V,o,c,p,x]),U=n.useMemo(()=>{function a(g){h==="auto"&&Sn(g.nativeEvent)&&(q.current=!p)}function k(g){q.current=h,h==="auto"&&wn(g.nativeEvent)&&(q.current=!0)}return{onKeyDown(g){const j=o.select("open");X.current=!1;const z=g.key.startsWith("Arrow"),ie=zn(g.key,ae(),u),ye=Ne(g.key,s),Ie=(M?ie:ye)||g.key==="Enter"||g.key.trim()==="";if(p&&j)return de(g);if(!(!j&&!w&&z)){if(Ie){const Re=Ne(g.key,ae());K.current=M&&Re?null:g.key}if(M){ie&&(he(g),j?(f.current=We(r,xe.current),F(g)):o.setOpen(!0,ne(De,g.nativeEvent,g.currentTarget)));return}ye&&(se.current!=null&&(f.current=se.current),he(g),!j&&w?o.setOpen(!0,ne(De,g.nativeEvent,g.currentTarget)):de(g),j&&F(g))}},onFocus(g){o.select("open")&&!p&&(f.current=-1,F(g))},onPointerDown:k,onPointerEnter:k,onMouseDown:a,onClick:a}},[de,xe,h,r,M,F,o,w,s,ae,u,se,p]),Z=n.useMemo(()=>({...pe,...U}),[pe,U]);return n.useMemo(()=>R?{reference:Z,floating:ce,item:A,trigger:U}:{},[R,Z,ce,U,A])}function $n(e,t){const o="rootStore"in e?e.rootStore:e,c=o.context.dataRef,d=o.useState("open"),{listRef:x,activeIndex:T,onMatch:r,onTypingChange:v,enabled:C=!0,resetMs:R=750,selectedIndex:m=null}=t,O=Te(),b=n.useRef(""),M=n.useRef(m??T??-1),u=n.useRef(null);fe(()=>{!d&&m!==null||(O.clear(),u.current=null,b.current!==""&&(b.current=""))},[d,m,O]),fe(()=>{d&&b.current===""&&(M.current=m??T??-1)},[d,m,T]);const p=me(s=>{s?c.current.typing||(c.current.typing=s,v?.(s)):c.current.typing&&(c.current.typing=s,v?.(s))}),h=me(s=>{function i(B,L,N){const V=L.find(q=>q?.toLocaleLowerCase().indexOf(N.toLocaleLowerCase())===0);return V?B.indexOf(V):-1}const y=x.current;if(b.current.length>0&&b.current[0]!==" "&&(i(y,y,b.current)===-1?p(!1):s.key===" "&&he(s)),y==null||s.key.length!==1||s.ctrlKey||s.metaKey||s.altKey)return;d&&s.key!==" "&&(he(s),p(!0));const S=b.current==="";S&&(M.current=m??T??-1),y.every(B=>B?B[0]?.toLocaleLowerCase()!==B[1]?.toLocaleLowerCase():!0)&&b.current===s.key&&(b.current="",M.current=u.current),b.current+=s.key,O.start(R,()=>{b.current="",M.current=u.current,p(!1)});const H=S?m??T??-1:M.current,Y=i(y,[...y.slice((H||0)+1),...y.slice(0,(H||0)+1)],b.current);Y!==-1?(r?.(Y),u.current=Y):s.key!==" "&&(b.current="",p(!1))}),l=me(s=>{const i=s.relatedTarget,y=o.select("domReferenceElement"),S=o.select("floatingElement"),G=ve(y,i),H=ve(S,i);G||H||(O.clear(),b.current="",M.current=u.current,p(!1))}),w=n.useMemo(()=>({onKeyDown:h,onBlur:l}),[h,l]),I=n.useMemo(()=>({onKeyDown:h,onKeyUp(s){s.key===" "&&p(!1)},onBlur:l}),[h,l,p]);return n.useMemo(()=>C?{reference:w,floating:I}:{},[C,w,I])}const It=n.createContext(void 0);function Tt(e){const t=n.useContext(It);if(t===void 0&&!e)throw new Error(Pe(33));return t}const Mt=n.createContext(void 0);function Ce(e){const t=n.useContext(Mt);if(t===void 0&&!e)throw new Error(Pe(36));return t}const Xn=n.createContext(void 0);function _e(e=!0){const t=n.useContext(Xn);if(t===void 0&&!e)throw new Error(Pe(25));return t}function Jn(e){const{closeOnClick:t,highlighted:o,id:c,nodeId:d,store:x,itemRef:T,itemMetadata:r}=e,{events:v}=x.useState("floatingTreeRoot"),C=_e(!0),R=C!==void 0;return n.useMemo(()=>({id:c,role:"menuitem",tabIndex:o?0:-1,onMouseMove(m){d&&v.emit("itemhover",{nodeId:d,target:m.currentTarget})},onClick(m){t&&v.emit("close",{domEvent:m,reason:yt})},onMouseUp(m){if(C){const O=C.initialCursorPointRef.current;if(C.initialCursorPointRef.current=null,R&&O&&Math.abs(m.clientX-O.x)<=1&&Math.abs(m.clientY-O.y)<=1)return}T.current&&x.context.allowMouseUpTriggerRef.current&&(!R||m.button===2)&&(!r||r.type==="regular-item")&&T.current.click()}}),[t,o,c,v,d,x,T,C,R,r])}const Qn={type:"regular-item"};function Zn(e){const{closeOnClick:t,disabled:o=!1,highlighted:c,id:d,store:x,nativeButton:T,itemMetadata:r,nodeId:v}=e,C=n.useRef(null),{getButtonProps:R,buttonRef:m}=Rt({disabled:o,focusableWhenDisabled:!0,native:T}),O=Jn({closeOnClick:t,highlighted:c,id:d,nodeId:v,store:x,itemRef:C,itemMetadata:r}),b=n.useCallback(u=>qe(O,{onMouseEnter(){r.type==="submenu-trigger"&&r.setActive()},onKeyUp(p){p.key===" "&&x.context.typingRef.current&&p.preventBaseUIHandler()}},u,R),[O,R,x,r]),M=At(C,m);return n.useMemo(()=>({getItemProps:b,itemRef:M}),[b,M])}const eo=n.forwardRef(function(t,o){const{render:c,className:d,id:x,label:T,nativeButton:r=!1,disabled:v=!1,closeOnClick:C=!0,...R}=t,m=Dn({label:T}),O=Tt(!0),b=bt(x),{store:M}=Ce(),u=M.useState("isActive",m.index),p=M.useState("itemProps"),{getItemProps:h,itemRef:l}=Zn({closeOnClick:C,disabled:v,highlighted:u,id:b,store:M,nativeButton:r,nodeId:O?.nodeId,itemMetadata:Qn});return Oe("div",t,{state:{disabled:v,highlighted:u},props:[p,R,h],ref:[l,o,m.ref]})}),to=n.createContext(void 0);function no(e){return n.useContext(to)}const oo={...pt,...Kt},ro=n.forwardRef(function(t,o){const{render:c,className:d,finalFocus:x,...T}=t,{store:r}=Ce(),{side:v,align:C}=Tt(),R=no()!=null,m=r.useState("open"),O=r.useState("transitionStatus"),b=r.useState("popupProps"),M=r.useState("mounted"),u=r.useState("instantType"),p=r.useState("activeTriggerElement"),h=r.useState("parent"),l=r.useState("lastOpenChangeReason"),w=r.useState("rootId"),I=r.useState("floatingRootContext"),s=r.useState("floatingTreeRoot"),i=r.useState("closeDelay"),y=r.useState("activeTriggerElement"),S=h.type==="context-menu";Ht({open:m,ref:r.context.popupRef,onComplete(){m&&r.context.onOpenChangeComplete?.(!0)}}),n.useEffect(()=>{function N(V){r.setOpen(!1,ne(V.reason,V.domEvent))}return s.events.on("close",N),()=>{s.events.off("close",N)}},[s.events,r]);const G=r.useState("hoverEnabled"),H=r.useState("disabled");Kn(I,{enabled:G&&!H&&!S&&h.type!=="menubar",closeDelay:i});const Y={transitionStatus:O,side:v,align:C,open:m,nested:h.type==="menu",instant:u},B=Oe("div",t,{state:Y,ref:[o,r.context.popupRef],stateAttributesMapping:oo,props:[b,{onKeyDown(N){R&&Gn.has(N.key)&&N.stopPropagation()}},Ct(O),T,{"data-rootownerid":w}]});let L=h.type===void 0||S;return(p||h.type==="menubar"&&l!==un)&&(L=!0),W.jsx(hn,{context:I,modal:S,disabled:!M,returnFocus:x===void 0?L:x,initialFocus:h.type!=="menu",restoreFocus:!0,externalTree:h.type!=="menubar"?s:void 0,previousFocusableElement:y,nextFocusableElement:h.type===void 0?r.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:h.type===void 0?r.context.beforeContentFocusGuardRef:void 0,children:B})}),Et=n.createContext(void 0);function so(){const e=n.useContext(Et);if(e===void 0)throw new Error(Pe(32));return e}const io=n.forwardRef(function(t,o){const{keepMounted:c=!1,...d}=t,{store:x}=Ce();return x.useState("mounted")||c?W.jsx(Et.Provider,{value:c,children:W.jsx(Ut,{ref:o,...d})}):null}),ao=n.forwardRef(function(t,o){const{anchor:c,positionMethod:d="absolute",className:x,render:T,side:r,align:v,sideOffset:C=0,alignOffset:R=0,collisionBoundary:m="clipping-ancestors",collisionPadding:O=5,arrowPadding:b=5,sticky:M=!1,disableAnchorTracking:u=!1,collisionAvoidance:p=jt,...h}=t,{store:l}=Ce(),w=so(),I=_e(!0),s=l.useState("parent"),i=l.useState("floatingRootContext"),y=l.useState("floatingTreeRoot"),S=l.useState("mounted"),G=l.useState("open"),H=l.useState("modal"),Y=l.useState("activeTriggerElement"),B=l.useState("transitionStatus"),L=l.useState("lastOpenChangeReason"),N=l.useState("floatingNodeId"),V=l.useState("floatingParentNodeId");let q=c,f=C,K=R,X=v,F=p;s.type==="context-menu"&&(q=c??s.context?.anchor,X=X??"start",!r&&X!=="center"&&(K=t.alignOffset??2,f=t.sideOffset??-5));let J=r,Q=X;s.type==="menu"?(J=J??"inline-end",Q=Q??"start",F=t.collisionAvoidance??Bt):s.type==="menubar"&&(J=J??"bottom",Q=Q??"start");const oe=s.type==="context-menu",P=Un({anchor:q,floatingRootContext:i,positionMethod:I?"fixed":d,mounted:S,side:J,sideOffset:f,align:Q,alignOffset:K,arrowPadding:oe?0:b,collisionBoundary:m,collisionPadding:O,sticky:M,nodeId:N,keepMounted:w,disableAnchorTracking:u,collisionAvoidance:F,shiftCrossAxis:oe&&!("side"in F&&F.side==="flip"),externalTree:y}),re=n.useMemo(()=>{const _={};return G||(_.pointerEvents="none"),{role:"presentation",hidden:!S,style:{...P.positionerStyles,..._}}},[G,S,P.positionerStyles]);n.useEffect(()=>{function _(A){A.open&&(A.parentNodeId===N&&l.set("hoverEnabled",!1),A.nodeId!==N&&A.parentNodeId===l.select("floatingParentNodeId")&&l.setOpen(!1,ne(Le)))}return y.events.on("menuopenchange",_),()=>{y.events.off("menuopenchange",_)}},[l,y.events,N]),n.useEffect(()=>{if(l.select("floatingParentNodeId")==null)return;function _(A){if(A.open||A.nodeId!==l.select("floatingParentNodeId"))return;const ae=A.reason??Le;l.setOpen(!1,ne(ae))}return y.events.on("menuopenchange",_),()=>{y.events.off("menuopenchange",_)}},[y.events,l]),n.useEffect(()=>{function _(A){!G||A.nodeId!==l.select("floatingParentNodeId")||A.target&&Y&&Y!==A.target&&l.setOpen(!1,ne(Le))}return y.events.on("itemhover",_),()=>{y.events.off("itemhover",_)}},[y.events,G,Y,l]),n.useEffect(()=>{const _={open:G,nodeId:N,parentNodeId:V,reason:l.select("lastOpenChangeReason")};y.events.emit("menuopenchange",_)},[y.events,G,l,N,V]);const xe={open:G,side:P.side,align:P.align,anchorHidden:P.anchorHidden,nested:s.type==="menu"},ue=n.useMemo(()=>({side:P.side,align:P.align,arrowRef:P.arrowRef,arrowUncentered:P.arrowUncentered,arrowStyles:P.arrowStyles,nodeId:P.context.nodeId}),[P.side,P.align,P.arrowRef,P.arrowUncentered,P.arrowStyles,P.context.nodeId]),se=Oe("div",t,{state:xe,stateAttributesMapping:pt,ref:[o,l.useStateSetter("positionerElement")],props:[re,Ct(B),h]}),le=S&&s.type!=="menu"&&(s.type!=="menubar"&&H&&L!==Ke||s.type==="menubar"&&s.context.modal);let ee=null;return s.type==="menubar"?ee=s.context.contentElement:s.type===void 0&&(ee=Y),W.jsxs(It.Provider,{value:ue,children:[le&&W.jsx(yn,{ref:s.type==="context-menu"||s.type==="nested-context-menu"?s.context.internalBackdropRef:null,inert:Rn(!G),cutout:ee}),W.jsx(_t,{id:N,children:W.jsx(Ln,{elementsRef:l.context.itemDomElements,labelsRef:l.context.itemLabels,children:se})})]})}),co=n.createContext(null);function Pt(e){return n.useContext(co)}const uo={...Wt,disabled:$(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:$(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:$(e=>e.allowMouseEnter),stickIfOpen:$(e=>e.stickIfOpen),parent:$(e=>e.parent),rootId:$(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:$(e=>e.activeIndex),isActive:$((e,t)=>e.activeIndex===t),hoverEnabled:$(e=>e.hoverEnabled),instantType:$(e=>e.instantType),lastOpenChangeReason:$(e=>e.openChangeReason),floatingTreeRoot:$(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:$(e=>e.floatingNodeId),floatingParentNodeId:$(e=>e.floatingParentNodeId),itemProps:$(e=>e.itemProps),closeDelay:$(e=>e.closeDelay),keyboardEventRelay:$(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class Ze extends Gt{constructor(t){super({...lo(),...t},{positionerRef:n.createRef(),popupRef:n.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:n.createRef(),beforeContentFocusGuardRef:n.createRef(),onOpenChangeComplete:void 0,triggerElements:new Vt},uo),this.unsubscribeParentListener=this.observe("parent",o=>{if(this.unsubscribeParentListener?.(),o.type==="menu"){this.unsubscribeParentListener=o.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=o.store.context.allowMouseUpTriggerRef;return}o.type!==void 0&&(this.context.allowMouseUpTriggerRef=o.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,o){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:o})}static useStore(t,o){const c=Dt(()=>new Ze(o)).current;return t??c}unsubscribeParentListener=null}function lo(){return{...zt(),disabled:!1,modal:!0,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new gt,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Ee,keyboardEventRelay:void 0,closeDelay:0}}const fo=n.createContext(void 0);function po(){return n.useContext(fo)}const go=Yt(function(t){const{children:o,open:c,onOpenChange:d,onOpenChangeComplete:x,defaultOpen:T=!1,disabled:r=!1,modal:v,loopFocus:C=!0,orientation:R="vertical",actionsRef:m,closeParentOnEsc:O=!1,handle:b,triggerId:M,defaultTriggerId:u=null,highlightItemOnHover:p=!0}=t,h=_e(!0),l=Ce(!0),w=Pt(!0),I=po(),s=n.useMemo(()=>I&&l?{type:"menu",store:l.store}:w?{type:"menubar",context:w}:h&&!l?{type:"context-menu",context:h}:{type:void 0},[h,l,w,I]),i=Ze.useStore(b?.store,{open:T,openProp:c,activeTriggerId:u,triggerIdProp:M,parent:s});qt(()=>{c===void 0&&i.state.open===!1&&T===!0&&i.update({open:!0,activeTriggerId:u})}),i.useControlledProp("openProp",c),i.useControlledProp("triggerIdProp",M),i.useContextCallback("onOpenChangeComplete",x);const y=i.useState("floatingTreeRoot"),S=mt(y),G=Qe();fe(()=>{h&&!l?i.update({parent:{type:"context-menu",context:h},floatingNodeId:S,floatingParentNodeId:G}):l&&i.update({floatingNodeId:S,floatingParentNodeId:G})},[h,l,S,G,i]);const H=i.useState("open"),Y=i.useState("activeTriggerElement"),B=i.useState("positionerElement"),L=i.useState("hoverEnabled"),N=i.useState("modal"),V=i.useState("disabled"),q=i.useState("lastOpenChangeReason"),f=i.useState("parent"),K=i.useState("activeIndex"),X=i.useState("payload"),F=i.useState("floatingParentNodeId"),J=n.useRef(null),Q=F!=null;let oe;i.useSyncedValues({disabled:r,modal:f.type===void 0?v:void 0,rootId:ln()});const{openMethod:P,triggerProps:re,reset:xe}=bn(H);$t(i);const{forceUnmount:ue}=Xt(H,i,()=>{i.update({allowMouseEnter:!1,stickIfOpen:!0}),xe()}),se=n.useRef(f.type!=="context-menu"),le=Te();n.useEffect(()=>{if(H||(J.current=null),f.type==="context-menu"){if(!H){le.clear(),se.current=!1;return}le.start(500,()=>{se.current=!0})}},[le,H,f.type]),vn(H&&N&&q!==Ke&&P!=="touch",B),fe(()=>{!H&&!L&&i.set("hoverEnabled",!0)},[H,L,i]);const ee=n.useRef(!0),_=Te(),A=me((E,D)=>{const te=D.reason;if(H===E&&D.trigger===Y&&q===te||(D.preventUnmountOnClose=()=>{i.set("preventUnmountingOnClose",!0)},!E&&D.trigger==null&&(D.trigger=Y??void 0),d?.(E,D),D.isCanceled))return;const kt={open:E,nativeEvent:D.event,reason:D.reason,nested:Q};oe?.emit("openchange",kt);const ke=D.event;if(E===!1&&ke?.type==="click"&&ke.pointerType==="touch"&&!ee.current)return;if(!E&&K!==null){const Nt=i.context.itemDomElements.current[K];queueMicrotask(()=>{Nt?.setAttribute("tabindex","-1")})}E&&te===it?(ee.current=!1,_.start(300,()=>{ee.current=!0})):(ee.current=!0,_.clear());const tt=(te===ht||te===yt)&&ke.detail===0&&ke?.isTrusted,Ft=!E&&(te===fn||te==null),Ve={open:E,openChangeReason:te};J.current=D.event??null;const nt=D.trigger?.id??null;(nt||E)&&(Ve.activeTriggerId=nt,Ve.activeTriggerElement=D.trigger??null),i.update(Ve),f.type==="menubar"&&(te===it||te===He||te===Ke||te===De||te===Le)?i.set("instantType","group"):tt||Ft?i.set("instantType",tt?"click":"dismiss"):i.set("instantType",void 0)}),ae=n.useCallback(E=>{const D=ne(E);return D.preventUnmountOnClose=()=>{i.set("preventUnmountingOnClose",!0)},D},[i]),de=n.useCallback(()=>{i.setOpen(!1,ae(dn))},[i,ae]);n.useImperativeHandle(m,()=>({unmount:ue,close:de}),[ue,de]);let pe;f.type==="context-menu"&&(pe=f.context),n.useImperativeHandle(pe?.positionerRef,()=>B,[B]),n.useImperativeHandle(pe?.actionsRef,()=>({setOpen:A}),[A]);const ce=Jt({popupStore:i,onOpenChange:A});oe=ce.context.events,n.useEffect(()=>{const E=({open:D,eventDetails:te})=>A(D,te);return oe.on("setOpen",E),()=>{oe?.off("setOpen",E)}},[oe,A]);const U=Qt(ce,{enabled:!V,bubbles:{escapeKey:O&&f.type==="menu"},outsidePress(){return f.type!=="context-menu"||J.current?.type==="contextmenu"?!0:se.current},externalTree:Q?y:void 0}),Z=Cn(ce,{role:"menu"}),a=In(),k=n.useCallback(E=>{i.select("activeIndex")!==E&&i.set("activeIndex",E)},[i]),g=qn(ce,{enabled:!V,listRef:i.context.itemDomElements,activeIndex:K,nested:f.type!==void 0,loopFocus:C,orientation:R,parentOrientation:f.type==="menubar"?f.context.orientation:void 0,rtl:a==="rtl",disabledIndices:$e,onNavigate:k,openOnArrowKeyDown:f.type!=="context-menu",externalTree:Q?y:void 0,focusItemOnHover:p}),j=n.useCallback(E=>{i.context.typingRef.current=E},[i]),z=$n(ce,{listRef:i.context.itemLabels,activeIndex:K,resetMs:Zt,onMatch:E=>{H&&E!==K&&i.set("activeIndex",E)},onTypingChange:j}),{getReferenceProps:ie,getFloatingProps:ye,getItemProps:Ie,getTriggerProps:Re}=xt([U,Z,g,z]),ge=n.useMemo(()=>{const E=qe(ie(),{onMouseMove(){i.set("allowMouseEnter",!0)}},re);return delete E.role,E},[ie,i,re]),be=n.useMemo(()=>{const E=Re();if(!E)return E;const D=qe(E,re);return delete D.role,delete D["aria-controls"],D},[Re,re]),Ge=n.useMemo(()=>ye({onMouseMove(){i.set("allowMouseEnter",!0),f.type==="menu"&&i.set("hoverEnabled",!1)},onClick(){i.select("hoverEnabled")&&i.set("hoverEnabled",!1)},onKeyDown(E){const D=i.select("keyboardEventRelay");D&&!E.isPropagationStopped()&&D(E)}}),[ye,f.type,i]),St=n.useMemo(()=>Ie(),[Ie]);i.useSyncedValues({floatingRootContext:ce,activeTriggerProps:ge,inactiveTriggerProps:be,popupProps:Ge,itemProps:St});const wt=n.useMemo(()=>({store:i,parent:s}),[i,s]),et=W.jsx(Mt.Provider,{value:wt,children:typeof o=="function"?o({payload:X}):o});return f.type===void 0||f.type==="context-menu"?W.jsx(en,{externalTree:y,children:et}):et});function mo(e){const t=e.getBoundingClientRect(),o=window.getComputedStyle(e,"::before"),c=window.getComputedStyle(e,"::after");if(!(o.content!=="none"||c.content!=="none"))return t;const x=parseFloat(o.width)||0,T=parseFloat(o.height)||0,r=parseFloat(c.width)||0,v=parseFloat(c.height)||0,C=Math.max(t.width,x,r),R=Math.max(t.height,T,v),m=C-t.width,O=R-t.height;return{left:t.left-m/2,right:t.right+m/2,top:t.top-O/2,bottom:t.bottom+O/2}}function xo(e){const{render:t,className:o,state:c=Ee,props:d=$e,refs:x=$e,metadata:T,stateAttributesMapping:r,tag:v="div",...C}=e,{compositeProps:R,compositeRef:m}=Hn({metadata:T});return Oe(v,e,{state:c,ref:[...x,m],props:[R,...d,C],stateAttributesMapping:r})}function Ot(e){if(Xe(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!pn(e))return Ot(gn(e))}function ho(e){const{enabled:t=!0,mouseDownAction:o,open:c}=e,d=n.useRef(!1);return n.useMemo(()=>t?{onMouseDown:x=>{(o==="open"&&!c||o==="close"&&c)&&(d.current=!0,Ue(x.currentTarget).addEventListener("click",()=>{d.current=!1},{once:!0}))},onClick:x=>{d.current&&(d.current=!1,x.preventBaseUIHandler())}}:Ee,[t,o,c])}const Ae=2,yo=tn(function(t,o){const{render:c,className:d,disabled:x=!1,nativeButton:T=!0,id:r,openOnHover:v,delay:C=100,closeDelay:R=0,handle:m,payload:O,...b}=t,M=Ce(!0),u=m?.store??M?.store;if(!u)throw new Error(Pe(85));const p=bt(r),h=u.useState("isTriggerActive",p),l=u.useState("floatingRootContext"),w=u.useState("isOpenedByTrigger",p),I=n.useRef(null),s=bo(),i=mn(!0),y=dt(),S=n.useMemo(()=>y??new gt,[y]),G=mt(S),H=Qe(),{registerTrigger:Y,isMountedByThisTrigger:B}=nn(p,I,u,{payload:O,closeDelay:R,parent:s,floatingTreeRoot:S,floatingNodeId:G,floatingParentNodeId:H,keyboardEventRelay:i?.relayKeyboardEvent}),L=s.type==="menubar",N=u.useState("disabled"),V=x||N||L&&s.context.disabled,{getButtonProps:q,buttonRef:f}=Rt({disabled:V,native:T});n.useEffect(()=>{!w&&s.type===void 0&&(u.context.allowMouseUpTriggerRef.current=!1)},[u,w,s.type]);const K=n.useRef(null),X=Te(),F=me(U=>{if(!K.current)return;X.clear(),u.context.allowMouseUpTriggerRef.current=!1;const Z=U.target;if(ve(K.current,Z)||ve(u.select("positionerElement"),Z)||Z===K.current||Z!=null&&Ot(Z)===u.select("rootId"))return;const a=mo(K.current);U.clientX>=a.left-Ae&&U.clientX<=a.right+Ae&&U.clientY>=a.top-Ae&&U.clientY<=a.bottom+Ae||S.events.emit("close",{domEvent:U,reason:xn})});n.useEffect(()=>{w&&u.select("lastOpenChangeReason")===Ke&&Ue(K.current).addEventListener("mouseup",F,{once:!0})},[w,F,u]);const J=L&&s.context.hasSubmenuOpen,oe=jn(l,{enabled:(v??J)&&!V&&s.type!=="context-menu"&&(!L||J&&!B),handleClose:Bn({blockPointerEvents:!L}),mouseOnly:!0,move:!1,restMs:s.type===void 0?C:void 0,delay:{close:R},triggerElementRef:I,externalTree:S,isActiveTrigger:h}),P=Ro(w,u.select("lastOpenChangeReason")),re=Vn(l,{enabled:!V&&s.type!=="context-menu",event:w&&L?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:s.type===void 0?P:!1}),xe=_n(l,{enabled:!V&&J}),ue=ho({open:w,enabled:L,mouseDownAction:"open"}),se=xt([re,xe]),le={disabled:V,open:w},ee=u.useState("triggerProps",B),_=[K,o,f,Y,I],A=[se.getReferenceProps(),oe??Ee,ee,{"aria-haspopup":"menu",id:p,onMouseDown:U=>{if(u.select("open"))return;X.start(200,()=>{u.context.allowMouseUpTriggerRef.current=!0}),Ue(U.currentTarget).addEventListener("mouseup",F,{once:!0})}},L?{role:"menuitem"}:{},ue,b,q],ae=n.useRef(null),de=me(U=>{ot.flushSync(()=>{u.setOpen(!1,ne(He,U.nativeEvent,U.currentTarget))}),on(ae.current)?.focus()}),pe=me(U=>{const Z=u.select("positionerElement");if(Z&&rn(U,Z))u.context.beforeContentFocusGuardRef.current?.focus();else{ot.flushSync(()=>{u.setOpen(!1,ne(He,U.nativeEvent,U.currentTarget))});let a=sn(u.context.triggerFocusTargetRef.current||I.current);for(;a!==null&&ve(Z,a);){const k=a;if(a=an(a),a===k)break}a?.focus()}}),ce=Oe("button",t,{enabled:!L,stateAttributesMapping:rt,state:le,ref:_,props:A});return L?W.jsx(xo,{tag:"button",render:c,className:d,state:le,refs:_,props:A,stateAttributesMapping:rt}):w?W.jsxs(n.Fragment,{children:[W.jsx(st,{ref:ae,onFocus:de},`${p}-pre-focus-guard`),W.jsx(n.Fragment,{children:ce},p),W.jsx(st,{ref:u.context.triggerFocusTargetRef,onFocus:pe},`${p}-post-focus-guard`)]}):W.jsx(n.Fragment,{children:ce},p)});function Ro(e,t){const o=Te(),[c,d]=n.useState(!1);return fe(()=>{e&&t==="trigger-hover"?(d(!0),o.start(cn,()=>{d(!1)})):e||(o.clear(),d(!1))},[e,t,o]),c}function bo(){const e=_e(!0),t=Ce(!0),o=Pt();return n.useMemo(()=>o?{type:"menubar",context:o}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,o])}function ko({children:e,...t}){return W.jsx(go,{...t,children:e})}function Fo({className:e,...t}){return W.jsx(yo,{className:Je(e),...t})}function No({className:e,side:t="bottom",align:o="end",children:c}){return W.jsx(io,{children:W.jsx(ao,{side:t,align:o,children:W.jsx(ro,{className:Je("min-w-[110px] rounded-lg bg-primary-50 p-1 text-sm text-primary-900 shadow-lg outline outline-primary-900/10",e),children:c})})})}function Ao({className:e,...t}){return W.jsx(eo,{className:Je("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-primary-900 hover:bg-primary-100 data-highlighted:bg-primary-100","select-none font-[450]",e),...t})}export{ko as M,Fo as a,No as b,Ao as c};
@@ -1 +1 @@
1
- import{j as t}from"./main-ZBMVSJTF.js";function a({className:e}){return t.jsx("div",{className:e,children:t.jsx("span",{className:"text-xl",children:"🦎"})})}function i({className:e}){return t.jsx("span",{className:e,style:{background:"linear-gradient(90deg, #10b981, #14b8a6, #06b6d4, #8b5cf6, #ec4899)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",fontWeight:600},children:"OpenCami"})}export{a as O,i as a};
1
+ import{j as t}from"./main-xPlWrMhO.js";function a({className:e}){return t.jsx("div",{className:e,children:t.jsx("span",{className:"text-xl",children:"🦎"})})}function i({className:e}){return t.jsx("span",{className:e,style:{background:"linear-gradient(90deg, #10b981, #14b8a6, #06b6d4, #8b5cf6, #ec4899)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",fontWeight:600},children:"OpenCami"})}export{a as O,i as a};