opencami 1.8.9 → 1.9.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 (103) hide show
  1. package/README.md +4 -2
  2. package/dist/client/assets/{CSPContext-DI-5GAnQ.js → CSPContext-TfUptlEu.js} +1 -1
  3. package/dist/client/assets/{DirectionContext-CrIsc5n9.js → DirectionContext-CQMv7g2N.js} +1 -1
  4. package/dist/client/assets/_sessionKey-DYknvaDS.js +23 -0
  5. package/dist/client/assets/agents-DNywJUai.js +2 -0
  6. package/dist/client/assets/agents-screen-fSZJpRi_.js +1 -0
  7. package/dist/client/assets/bots-Bqjqhws8.js +2 -0
  8. package/dist/client/assets/{bots-screen-BTKCOohV.js → bots-screen-4yT-e3cM.js} +1 -1
  9. package/dist/client/assets/{button-8ab4wOwy.js → button-DqP4GZwZ.js} +1 -1
  10. package/dist/client/assets/{composite-B2qsrzf3.js → composite-BLgu_EOL.js} +1 -1
  11. package/dist/client/assets/{connect-B3_p7C4I.js → connect-CiqRvR6s.js} +1 -1
  12. package/dist/client/assets/{dashboard-BtClHYpn.js → dashboard-CyWDWpbj.js} +1 -1
  13. package/dist/client/assets/event-2_Dxdv7h.js +1 -0
  14. package/dist/client/assets/file-explorer-screen-CZ2QKk-0.js +1 -0
  15. package/dist/client/assets/files-Cbhud0J8.js +2 -0
  16. package/dist/client/assets/follow-up-suggestions-Bi3Ci2my.js +5 -0
  17. package/dist/client/assets/{index-BXiha-Vz.js → index-C_gsW9fo.js} +1 -1
  18. package/dist/client/assets/{index-CtlYu8Ug.js → index-ygitKeM-.js} +1 -1
  19. package/dist/client/assets/keyboard-shortcuts-dialog-z-amTZVi.js +1 -0
  20. package/dist/client/assets/main-ZBMVSJTF.js +212 -0
  21. package/dist/client/assets/markdown-CHUjmWcv.js +87 -0
  22. package/dist/client/assets/memory-BRa-0plj.js +2 -0
  23. package/dist/client/assets/memory-screen-C_ZNDGLd.js +1 -0
  24. package/dist/client/assets/menu-CB88T7R1.js +1 -0
  25. package/dist/client/assets/{opencami-logo-BSed2Wez.js → opencami-logo-C0Kj1DiT.js} +1 -1
  26. package/dist/client/assets/proxy-D-juuhw6.js +9 -0
  27. package/dist/client/assets/{react-WkSlhZJd.js → react-Akh4y69S.js} +1 -1
  28. package/dist/client/assets/search-dialog-BasfzCyM.js +1 -0
  29. package/dist/client/assets/{search-sources-badge-Du8KpUEb.js → search-sources-badge-DwFHWd7S.js} +1 -1
  30. package/dist/client/assets/session-export-dialog-CAl3iJnD.js +1 -0
  31. package/dist/client/assets/settings-dialog-C8OoRXwX.js +1 -0
  32. package/dist/client/assets/skills-Cx12984a.js +2 -0
  33. package/dist/client/assets/{skills-panel-CVh1I-7D.js → skills-panel-B7BRAofP.js} +1 -1
  34. package/dist/client/assets/styles-CXa-SiWC.css +1 -0
  35. package/dist/client/assets/switch-DYEbEgy5.js +1 -0
  36. package/dist/client/assets/tabs-eiBvL0H7.js +1 -0
  37. package/dist/client/assets/thinking-CariuioI.js +1 -0
  38. package/dist/client/assets/tooltip-CekkGEYG.js +1 -0
  39. package/dist/client/assets/use-file-explorer-state-Dfyh4GwR.js +12 -0
  40. package/dist/client/assets/{useBaseUiId-DiwX_3so.js → useBaseUiId-DLhdkHJl.js} +1 -1
  41. package/dist/client/assets/{useCompositeItem-UPIPwR9H.js → useCompositeItem-DTSTTR0Z.js} +1 -1
  42. package/dist/client/assets/{useControlled-CT2hRlcU.js → useControlled-CpliTEve.js} +1 -1
  43. package/dist/client/assets/{useMutation-rx8UH99I.js → useMutation-CpD2Pn0F.js} +1 -1
  44. package/dist/client/assets/useOnFirstRender-DsFYFJoB.js +1 -0
  45. package/dist/client/assets/{useQuery-Boaa6oF3.js → useQuery-DMTgpIql.js} +1 -1
  46. package/dist/server/assets/{_sessionKey-B6iYeyCS.js → _sessionKey-Bhksr7VP.js} +267 -156
  47. package/dist/server/assets/{_tanstack-start-manifest_v-C9chPgNH.js → _tanstack-start-manifest_v-D-5ReiD4.js} +1 -1
  48. package/dist/server/assets/{agents-CmQ4vvXm.js → agents-BuE0Yum3.js} +1 -1
  49. package/dist/server/assets/{agents-screen-bmrIyFbk.js → agents-screen-CEQhbEwf.js} +3 -3
  50. package/dist/server/assets/{bots-Byt6jv0a.js → bots-BDHeSvSQ.js} +1 -1
  51. package/dist/server/assets/{bots-screen-C2TGFv42.js → bots-screen-C0NRS526.js} +2 -2
  52. package/dist/server/assets/{button-CwY2OHFj.js → button-kI8fEIZQ.js} +1 -1
  53. package/dist/server/assets/{connect-BNabuqpW.js → connect-CTVBm0Vc.js} +2 -2
  54. package/dist/server/assets/{file-explorer-screen-DH4UFK03.js → file-explorer-screen-FU_NhZmS.js} +4 -4
  55. package/dist/server/assets/{files-DYdXlQDr.js → files-DLxqp-h5.js} +1 -1
  56. package/dist/server/assets/{follow-up-suggestions-mzRQIB0k.js → follow-up-suggestions-B3hol2KT.js} +8 -8
  57. package/dist/server/assets/{index-COElhwGA.js → index-4G_4vZNY.js} +1 -1
  58. package/dist/server/assets/{index-BEWnDAH6.js → index-B_F4DTUu.js} +1 -1
  59. package/dist/server/assets/{keyboard-shortcuts-dialog-Cr6fOqHz.js → keyboard-shortcuts-dialog-Cp3ECNNi.js} +2 -2
  60. package/dist/server/assets/{markdown-DoX5Q7qh.js → markdown-CFdYXCRQ.js} +3 -3
  61. package/dist/server/assets/{memory-Cxu7i8ej.js → memory-rBB015W-.js} +1 -1
  62. package/dist/server/assets/{memory-screen-B5l1NZRY.js → memory-screen-vqXczcVo.js} +4 -4
  63. package/dist/server/assets/{menu-D90CDTi2.js → menu-D8cKTpmN.js} +1 -1
  64. package/dist/server/assets/{router-BqLGFd4L.js → router-C9JRmWMm.js} +142 -103
  65. package/dist/server/assets/{search-dialog-CmI7naPN.js → search-dialog-CTJULPB8.js} +8 -8
  66. package/dist/server/assets/{search-sources-badge-B0rAEDs_.js → search-sources-badge-B0t8Qffy.js} +1 -1
  67. package/dist/server/assets/{session-export-dialog-C53RRAah.js → session-export-dialog-CgtlOnwf.js} +2 -2
  68. package/dist/server/assets/{settings-dialog-BZ67gr9N.js → settings-dialog-B5yR2pBy.js} +35 -18
  69. package/dist/server/assets/{skills-Cy8xclXY.js → skills-BXUivxuo.js} +1 -1
  70. package/dist/server/assets/{skills-panel-BnRNb7u9.js → skills-panel-CDUp4jvw.js} +2 -2
  71. package/dist/server/assets/{switch-BbkUeVDV.js → switch-BZzwkgAQ.js} +1 -1
  72. package/dist/server/assets/{tabs-DDFZob0m.js → tabs-CWbp3mT4.js} +1 -1
  73. package/dist/server/assets/{thinking-CA8PSwKJ.js → thinking-CHx4Oouj.js} +8 -8
  74. package/dist/server/assets/{tooltip-DgsSPocE.js → tooltip-DOvOrSSS.js} +1 -1
  75. package/dist/server/assets/{use-file-explorer-state-s7CS50ho.js → use-file-explorer-state-E6cUvMva.js} +1 -1
  76. package/dist/server/server.js +195 -38
  77. package/package.json +1 -1
  78. package/dist/client/assets/_sessionKey-B4NZmxf3.js +0 -21
  79. package/dist/client/assets/agents-bptidK8z.js +0 -2
  80. package/dist/client/assets/agents-screen-6qdnPmx2.js +0 -1
  81. package/dist/client/assets/bots-BWpbaQ-E.js +0 -2
  82. package/dist/client/assets/event-DG3RKJz8.js +0 -1
  83. package/dist/client/assets/file-explorer-screen-Djl8x-8P.js +0 -1
  84. package/dist/client/assets/files-CjbCJDgC.js +0 -2
  85. package/dist/client/assets/follow-up-suggestions-BSCMXRXh.js +0 -5
  86. package/dist/client/assets/keyboard-shortcuts-dialog-HAufCn9C.js +0 -1
  87. package/dist/client/assets/main-CQKtcNr3.js +0 -210
  88. package/dist/client/assets/markdown-DFJF-FsV.js +0 -87
  89. package/dist/client/assets/memory-DnJOmcwU.js +0 -2
  90. package/dist/client/assets/memory-screen-Bm4NMAnU.js +0 -1
  91. package/dist/client/assets/menu-D26Vmgxl.js +0 -1
  92. package/dist/client/assets/popupStateMapping-DkI2OCkW.js +0 -1
  93. package/dist/client/assets/proxy-CHQ-VCN1.js +0 -9
  94. package/dist/client/assets/search-dialog-CCl4d0Pi.js +0 -1
  95. package/dist/client/assets/session-export-dialog-io9FvLKq.js +0 -1
  96. package/dist/client/assets/settings-dialog-B93qswor.js +0 -1
  97. package/dist/client/assets/skills-BNDGnHwM.js +0 -2
  98. package/dist/client/assets/styles-Ce2xZzc4.css +0 -1
  99. package/dist/client/assets/switch-CSnzINDW.js +0 -1
  100. package/dist/client/assets/tabs-CWfn44FL.js +0 -1
  101. package/dist/client/assets/thinking-BmoLlbFC.js +0 -1
  102. package/dist/client/assets/tooltip-CSGMH2t4.js +0 -1
  103. package/dist/client/assets/use-file-explorer-state-BYVzjwPA.js +0 -12
@@ -0,0 +1 @@
1
+ import{j as e,r as h,u as N,L as R}from"./main-ZBMVSJTF.js";import{u as g}from"./useQuery-DMTgpIql.js";import{u as S}from"./useMutation-CpD2Pn0F.js";import{c as M,B as f,b as k}from"./button-DqP4GZwZ.js";import{M as C}from"./markdown-CHUjmWcv.js";import"./index-C_gsW9fo.js";import"./react-Akh4y69S.js";import"./use-file-explorer-state-Dfyh4GwR.js";import"./useOnFirstRender-DsFYFJoB.js";import"./useBaseUiId-DLhdkHJl.js";import"./event-2_Dxdv7h.js";import"./visuallyHidden-COI6QeQH.js";import"./composite-BLgu_EOL.js";import"./index-T4TOjvD0.js";const w=/\/(\d{4}-\d{2}-\d{2})/;function j({path:r,label:n,selected:o,onSelect:m}){return e.jsx("button",{type:"button",onClick:()=>m(r),className:M("w-full text-left px-2.5 py-1.5 rounded-md text-sm transition-colors",o?"text-primary-900":"text-primary-600 hover:text-primary-900 hover:bg-primary-50"),style:o?{backgroundColor:"var(--opencami-accent-light)"}:void 0,children:n})}function b(r){return r==="/MEMORY.md"?"📋 MEMORY.md":r.match(w)?`📅 ${r.replace(/^\/?memory\//,"")}`:`📄 ${r.replace(/^\/?memory\//,"")}`}function F({files:r,selectedPath:n,onSelect:o,loading:m}){const i=r.filter(t=>t==="/MEMORY.md"),s=r.filter(t=>t!=="/MEMORY.md"&&w.test(t)),l=r.filter(t=>t!=="/MEMORY.md"&&!w.test(t));return e.jsxs("aside",{className:"border-r border-primary-200 bg-primary-100 md:w-72 w-full md:h-full h-auto overflow-y-auto",children:[e.jsx("div",{className:"px-4 py-3 border-b border-primary-200",children:e.jsx("h2",{className:"text-sm font-semibold text-primary-800",children:"Memory Files"})}),e.jsx("div",{className:"p-2 space-y-0.5",children:m?e.jsx("div",{className:"px-2 py-2 text-sm text-primary-500",children:"Loading files…"}):r.length===0?e.jsx("div",{className:"px-2 py-2 text-sm text-primary-500",children:"No memory files found."}):e.jsxs(e.Fragment,{children:[i.map(t=>e.jsx(j,{path:t,label:b(t),selected:n===t,onSelect:o},t)),s.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-2.5 pt-3 pb-1 text-xs font-medium text-primary-400 uppercase tracking-wider",children:"Daily"}),s.map(t=>e.jsx(j,{path:t,label:b(t),selected:n===t,onSelect:o},t))]}),l.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-2.5 pt-3 pb-1 text-xs font-medium text-primary-400 uppercase tracking-wider",children:"Notes"}),l.map(t=>e.jsx(j,{path:t,label:b(t),selected:n===t,onSelect:o},t))]})]})})]})}function O({filePath:r,content:n,isLoading:o,onSave:m,onBack:i}){const[s,l]=h.useState(!1),[t,x]=h.useState(n),[u,p]=h.useState(!1);h.useEffect(()=>{x(n),l(!1)},[r,n]);const a=async()=>{p(!0);try{await m(t),l(!1)}finally{p(!1)}};return e.jsxs("section",{className:"flex-1 min-h-0 flex flex-col",children:[e.jsxs("header",{className:"border-b border-primary-100 px-4 py-3 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i?e.jsx(f,{size:"sm",variant:"ghost",onClick:i,children:"Back"}):null,e.jsx("h1",{className:"text-sm font-semibold text-primary-800 truncate",children:r})]}),!o&&e.jsx("div",{className:"flex items-center gap-2",children:s?e.jsxs(e.Fragment,{children:[e.jsx(f,{size:"sm",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(f,{size:"sm",onClick:()=>{a()},disabled:u,children:u?"Saving…":"Save"})]}):e.jsx(f,{size:"sm",variant:"outline",onClick:()=>l(!0),children:"Edit"})})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-4",children:o?e.jsx("div",{className:"text-sm text-primary-500",children:"Loading content…"}):s?e.jsx("textarea",{value:t,onChange:c=>x(c.target.value),className:"w-full min-h-[60vh] rounded-md border border-primary-200 bg-surface px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500"}):e.jsx(C,{className:"prose prose-invert max-w-none",children:n||"_Empty file_"})})]})}const Y=/\/(\d{4}-\d{2}-\d{2})/;function z(r){const n=r.includes("/MEMORY.md")?["/MEMORY.md"]:[],o=r.filter(s=>s!=="/MEMORY.md"&&(s.startsWith("memory/")||s.startsWith("/memory/"))&&s.endsWith(".md")),m=[],i=[];for(const s of o)Y.test(s)?m.push(s):i.push(s);return m.sort((s,l)=>l.localeCompare(s)),i.sort((s,l)=>s.localeCompare(l)),[...n,...m,...i]}function J(){const r=N(),[n,o]=h.useState("/MEMORY.md"),m=g({queryKey:["memory","files"],queryFn:async({signal:a})=>{const[c,d]=await Promise.all([fetch("/api/files/read?path=/MEMORY.md",{signal:a}),fetch("/api/files/list?path=/memory",{signal:a})]),y=[];if(c.ok&&y.push("/MEMORY.md"),d.ok){const E=await d.json();for(const v of E.items)!v.isDir&&v.path.endsWith(".md")&&y.push(v.path)}return z(y)},staleTime:3e4}),i=n??m.data?.[0]??null,s=g({queryKey:["memory","content",i],queryFn:async({signal:a})=>{const c=i.startsWith("/")?i:`/${i}`,d=await fetch(`/api/files/read?path=${encodeURIComponent(c)}`,{signal:a});if(!d.ok)throw new Error("Failed to read memory file");return d.json()},enabled:!!i}),l=S({mutationFn:async a=>{const c=a.path.startsWith("/")?a.path:`/${a.path}`,d=await fetch("/api/files/save",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({...a,path:c})});if(!d.ok)throw new Error("Failed to save memory file");return d.json()},onSuccess:async(a,c)=>{await r.invalidateQueries({queryKey:["memory","content",c.path]}),await r.invalidateQueries({queryKey:["memory","files"]})}}),[t,x]=h.useState(()=>typeof window<"u"?window.innerWidth<768:!1);h.useEffect(()=>{if(typeof window>"u")return;const a=()=>x(window.innerWidth<768);return window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]);const u=t&&!i,p=h.useCallback(a=>{o(a)},[]);return e.jsxs("div",{className:"h-screen bg-surface text-primary-900",children:[e.jsxs("div",{className:"h-12 border-b border-primary-100 px-3 flex items-center justify-between",children:[e.jsx("h1",{className:"text-sm font-semibold",children:"Memory Viewer"}),e.jsx(R,{to:"/chat/$sessionKey",params:{sessionKey:"main"},className:M(k({variant:"ghost",size:"sm"})),children:"Back to Chat"})]}),e.jsxs("div",{className:"h-[calc(100vh-48px)] md:grid md:grid-cols-[18rem_1fr]",children:[(!t||u)&&e.jsx(F,{files:m.data??[],selectedPath:i,onSelect:p,loading:m.isLoading}),i&&(!t||!u)?e.jsx(O,{filePath:i,content:s.data?.content??"",isLoading:s.isLoading,onBack:t?()=>o(null):void 0,onSave:async a=>{await l.mutateAsync({path:i,content:a})}}):e.jsx("div",{className:"p-4 text-sm text-primary-500",children:"Select a file to view."})]}),(m.isError||s.isError||l.isError)&&e.jsxs("div",{className:"fixed bottom-4 right-4 rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:["Something went wrong. ",e.jsx(f,{size:"sm",variant:"ghost",onClick:()=>{m.refetch()},children:"Retry"})]})]})}export{J as MemoryScreen};
@@ -0,0 +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 +1 @@
1
- import{j as t}from"./main-CQKtcNr3.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-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};
@@ -0,0 +1,9 @@
1
+ import{r as T,j as q}from"./main-ZBMVSJTF.js";const _e=T.createContext({});function Xe(t){const e=T.useRef(null);return e.current===null&&(e.current=t()),e.current}const $s=typeof window<"u",Hs=$s?T.useLayoutEffect:T.useEffect,ee=T.createContext(null);function Ye(t,e){t.indexOf(e)===-1&&t.push(e)}function _t(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Y=(t,e,n)=>n>e?e:n<t?t:n;let qe=()=>{};const Z={},zs=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Gs(t){return typeof t=="object"&&t!==null}const _s=t=>/^0[^.\s]+$/u.test(t);function Xs(t){let e;return()=>(e===void 0&&(e=t()),e)}const W=t=>t,Ro=(t,e)=>n=>e(t(n)),Lt=(...t)=>t.reduce(Ro),Ct=(t,e,n)=>{const s=e-t;return s===0?1:(n-t)/s};class Ze{constructor(){this.subscriptions=[]}add(e){return Ye(this.subscriptions,e),()=>_t(this.subscriptions,e)}notify(e,n,s){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,s);else for(let r=0;r<i;r++){const o=this.subscriptions[r];o&&o(e,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const H=t=>t*1e3,U=t=>t/1e3;function Ys(t,e){return e?t*(1e3/e):0}const qs=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,Lo=1e-7,ko=12;function Fo(t,e,n,s,i){let r,o,a=0;do o=e+(n-e)/2,r=qs(o,s,i)-t,r>0?n=o:e=o;while(Math.abs(r)>Lo&&++a<ko);return o}function kt(t,e,n,s){if(t===e&&n===s)return W;const i=r=>Fo(r,0,1,t,n);return r=>r===0||r===1?r:qs(i(r),e,s)}const Zs=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Js=t=>e=>1-t(1-e),Qs=kt(.33,1.53,.69,.99),Je=Js(Qs),ti=Zs(Je),ei=t=>(t*=2)<1?.5*Je(t):.5*(2-Math.pow(2,-10*(t-1))),Qe=t=>1-Math.sin(Math.acos(t)),ni=Js(Qe),si=Zs(Qe),Io=kt(.42,0,1,1),Bo=kt(0,0,.58,1),ii=kt(.42,0,.58,1),jo=t=>Array.isArray(t)&&typeof t[0]!="number",oi=t=>Array.isArray(t)&&typeof t[0]=="number",Oo={linear:W,easeIn:Io,easeInOut:ii,easeOut:Bo,circIn:Qe,circInOut:si,circOut:ni,backIn:Je,backInOut:ti,backOut:Qs,anticipate:ei},No=t=>typeof t=="string",Cn=t=>{if(oi(t)){qe(t.length===4);const[e,n,s,i]=t;return kt(e,n,s,i)}else if(No(t))return Oo[t];return t},Bt=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Uo(t,e){let n=new Set,s=new Set,i=!1,r=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){o.has(u)&&(c.schedule(u),t()),u(a)}const c={schedule:(u,h=!1,f=!1)=>{const p=f&&i?n:s;return h&&o.add(u),p.has(u)||p.add(u),u},cancel:u=>{s.delete(u),o.delete(u)},process:u=>{if(a=u,i){r=!0;return}i=!0,[n,s]=[s,n],n.forEach(l),n.clear(),i=!1,r&&(r=!1,c.process(u))}};return c}const Wo=40;function ri(t,e){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,o=Bt.reduce((v,S)=>(v[S]=Uo(r),v),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:h,preRender:f,render:d,postRender:p}=o,y=()=>{const v=Z.useManualTiming?i.timestamp:performance.now();n=!1,Z.useManualTiming||(i.delta=s?1e3/60:Math.max(Math.min(v-i.timestamp,Wo),1)),i.timestamp=v,i.isProcessing=!0,a.process(i),l.process(i),c.process(i),u.process(i),h.process(i),f.process(i),d.process(i),p.process(i),i.isProcessing=!1,n&&e&&(s=!1,t(y))},g=()=>{n=!0,s=!0,i.isProcessing||t(y)};return{schedule:Bt.reduce((v,S)=>{const P=o[S];return v[S]=(V,E=!1,b=!1)=>(n||g(),P.schedule(V,E,b)),v},{}),cancel:v=>{for(let S=0;S<Bt.length;S++)o[Bt[S]].cancel(v)},state:i,steps:o}}const{schedule:C,cancel:tt,state:I,steps:re}=ri(typeof requestAnimationFrame<"u"?requestAnimationFrame:W,!0);let Ut;function Ko(){Ut=void 0}const j={now:()=>(Ut===void 0&&j.set(I.isProcessing||Z.useManualTiming?I.timestamp:performance.now()),Ut),set:t=>{Ut=t,queueMicrotask(Ko)}},ai=t=>e=>typeof e=="string"&&e.startsWith(t),li=ai("--"),$o=ai("var(--"),tn=t=>$o(t)?Ho.test(t.split("/*")[0].trim()):!1,Ho=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Mn(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const yt={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Mt={...yt,transform:t=>Y(0,1,t)},jt={...yt,default:1},St=t=>Math.round(t*1e5)/1e5,en=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function zo(t){return t==null}const Go=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,nn=(t,e)=>n=>!!(typeof n=="string"&&Go.test(n)&&n.startsWith(t)||e&&!zo(n)&&Object.prototype.hasOwnProperty.call(n,e)),ci=(t,e,n)=>s=>{if(typeof s!="string")return s;const[i,r,o,a]=s.match(en);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},_o=t=>Y(0,255,t),ae={...yt,transform:t=>Math.round(_o(t))},ot={test:nn("rgb","red"),parse:ci("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+ae.transform(t)+", "+ae.transform(e)+", "+ae.transform(n)+", "+St(Mt.transform(s))+")"};function Xo(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}}const Se={test:nn("#"),parse:Xo,transform:ot.transform},Ft=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),J=Ft("deg"),X=Ft("%"),w=Ft("px"),Yo=Ft("vh"),qo=Ft("vw"),Dn={...X,parse:t=>X.parse(t)/100,transform:t=>X.transform(t*100)},ut={test:nn("hsl","hue"),parse:ci("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+X.transform(St(e))+", "+X.transform(St(n))+", "+St(Mt.transform(s))+")"},R={test:t=>ot.test(t)||Se.test(t)||ut.test(t),parse:t=>ot.test(t)?ot.parse(t):ut.test(t)?ut.parse(t):Se.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?ot.transform(t):ut.transform(t),getAnimatableNone:t=>{const e=R.parse(t);return e.alpha=0,R.transform(e)}},Zo=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Jo(t){return isNaN(t)&&typeof t=="string"&&(t.match(en)?.length||0)+(t.match(Zo)?.length||0)>0}const ui="number",hi="color",Qo="var",tr="var(",En="${}",er=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Dt(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const a=e.replace(er,l=>(R.test(l)?(s.color.push(r),i.push(hi),n.push(R.parse(l))):l.startsWith(tr)?(s.var.push(r),i.push(Qo),n.push(l)):(s.number.push(r),i.push(ui),n.push(parseFloat(l))),++r,En)).split(En);return{values:n,split:a,indexes:s,types:i}}function fi(t){return Dt(t).values}function di(t){const{split:e,types:n}=Dt(t),s=e.length;return i=>{let r="";for(let o=0;o<s;o++)if(r+=e[o],i[o]!==void 0){const a=n[o];a===ui?r+=St(i[o]):a===hi?r+=R.transform(i[o]):r+=i[o]}return r}}const nr=t=>typeof t=="number"?0:R.test(t)?R.getAnimatableNone(t):t;function sr(t){const e=fi(t);return di(t)(e.map(nr))}const z={test:Jo,parse:fi,createTransformer:di,getAnimatableNone:sr};function le(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function ir({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,e/=100,n/=100;let i=0,r=0,o=0;if(!e)i=r=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;i=le(l,a,t+1/3),r=le(l,a,t),o=le(l,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:s}}function Xt(t,e){return n=>n>0?e:t}const M=(t,e,n)=>t+(e-t)*n,ce=(t,e,n)=>{const s=t*t,i=n*(e*e-s)+s;return i<0?0:Math.sqrt(i)},or=[Se,ot,ut],rr=t=>or.find(e=>e.test(t));function Rn(t){const e=rr(t);if(!e)return!1;let n=e.parse(t);return e===ut&&(n=ir(n)),n}const Ln=(t,e)=>{const n=Rn(t),s=Rn(e);if(!n||!s)return Xt(t,e);const i={...n};return r=>(i.red=ce(n.red,s.red,r),i.green=ce(n.green,s.green,r),i.blue=ce(n.blue,s.blue,r),i.alpha=M(n.alpha,s.alpha,r),ot.transform(i))},be=new Set(["none","hidden"]);function ar(t,e){return be.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function lr(t,e){return n=>M(t,e,n)}function sn(t){return typeof t=="number"?lr:typeof t=="string"?tn(t)?Xt:R.test(t)?Ln:hr:Array.isArray(t)?pi:typeof t=="object"?R.test(t)?Ln:cr:Xt}function pi(t,e){const n=[...t],s=n.length,i=t.map((r,o)=>sn(r)(r,e[o]));return r=>{for(let o=0;o<s;o++)n[o]=i[o](r);return n}}function cr(t,e){const n={...t,...e},s={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(s[i]=sn(t[i])(t[i],e[i]));return i=>{for(const r in s)n[r]=s[r](i);return n}}function ur(t,e){const n=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const r=e.types[i],o=t.indexes[r][s[r]],a=t.values[o]??0;n[i]=a,s[r]++}return n}const hr=(t,e)=>{const n=z.createTransformer(e),s=Dt(t),i=Dt(e);return s.indexes.var.length===i.indexes.var.length&&s.indexes.color.length===i.indexes.color.length&&s.indexes.number.length>=i.indexes.number.length?be.has(t)&&!i.values.length||be.has(e)&&!s.values.length?ar(t,e):Lt(pi(ur(s,i),i.values),n):Xt(t,e)};function mi(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?M(t,e,n):sn(t)(t,e)}const fr=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>C.update(e,n),stop:()=>tt(e),now:()=>I.isProcessing?I.timestamp:j.now()}},gi=(t,e,n=10)=>{let s="";const i=Math.max(Math.round(e/n),2);for(let r=0;r<i;r++)s+=Math.round(t(r/(i-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},Yt=2e4;function on(t){let e=0;const n=50;let s=t.next(e);for(;!s.done&&e<Yt;)e+=n,s=t.next(e);return e>=Yt?1/0:e}function dr(t,e=100,n){const s=n({...t,keyframes:[0,e]}),i=Math.min(on(s),Yt);return{type:"keyframes",ease:r=>s.next(i*r).value/e,duration:U(i)}}const pr=5;function yi(t,e,n){const s=Math.max(e-pr,0);return Ys(n-t(s),e-s)}const D={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},ue=.001;function mr({duration:t=D.duration,bounce:e=D.bounce,velocity:n=D.velocity,mass:s=D.mass}){let i,r,o=1-e;o=Y(D.minDamping,D.maxDamping,o),t=Y(D.minDuration,D.maxDuration,U(t)),o<1?(i=c=>{const u=c*o,h=u*t,f=u-n,d=Ae(c,o),p=Math.exp(-h);return ue-f/d*p},r=c=>{const h=c*o*t,f=h*n+n,d=Math.pow(o,2)*Math.pow(c,2)*t,p=Math.exp(-h),y=Ae(Math.pow(c,2),o);return(-i(c)+ue>0?-1:1)*((f-d)*p)/y}):(i=c=>{const u=Math.exp(-c*t),h=(c-n)*t+1;return-ue+u*h},r=c=>{const u=Math.exp(-c*t),h=(n-c)*(t*t);return u*h});const a=5/t,l=yr(i,r,a);if(t=H(t),isNaN(l))return{stiffness:D.stiffness,damping:D.damping,duration:t};{const c=Math.pow(l,2)*s;return{stiffness:c,damping:o*2*Math.sqrt(s*c),duration:t}}}const gr=12;function yr(t,e,n){let s=n;for(let i=1;i<gr;i++)s=s-t(s)/e(s);return s}function Ae(t,e){return t*Math.sqrt(1-e*e)}const vr=["duration","bounce"],Tr=["stiffness","damping","mass"];function kn(t,e){return e.some(n=>t[n]!==void 0)}function xr(t){let e={velocity:D.velocity,stiffness:D.stiffness,damping:D.damping,mass:D.mass,isResolvedFromDuration:!1,...t};if(!kn(t,Tr)&&kn(t,vr))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(n*1.2),i=s*s,r=2*Y(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:D.mass,stiffness:i,damping:r}}else{const n=mr({...t,velocity:0});e={...e,...n,mass:D.mass},e.isResolvedFromDuration=!0}return e}function qt(t=D.visualDuration,e=D.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:l,damping:c,mass:u,duration:h,velocity:f,isResolvedFromDuration:d}=xr({...n,velocity:-U(n.velocity||0)}),p=f||0,y=c/(2*Math.sqrt(l*u)),g=o-r,m=U(Math.sqrt(l/u)),x=Math.abs(g)<5;s||(s=x?D.restSpeed.granular:D.restSpeed.default),i||(i=x?D.restDelta.granular:D.restDelta.default);let v;if(y<1){const P=Ae(m,y);v=V=>{const E=Math.exp(-y*m*V);return o-E*((p+y*m*g)/P*Math.sin(P*V)+g*Math.cos(P*V))}}else if(y===1)v=P=>o-Math.exp(-m*P)*(g+(p+m*g)*P);else{const P=m*Math.sqrt(y*y-1);v=V=>{const E=Math.exp(-y*m*V),b=Math.min(P*V,300);return o-E*((p+y*m*g)*Math.sinh(b)+P*g*Math.cosh(b))/P}}const S={calculatedDuration:d&&h||null,next:P=>{const V=v(P);if(d)a.done=P>=h;else{let E=P===0?p:0;y<1&&(E=P===0?H(p):yi(v,P,V));const b=Math.abs(E)<=s,A=Math.abs(o-V)<=i;a.done=b&&A}return a.value=a.done?o:V,a},toString:()=>{const P=Math.min(on(S),Yt),V=gi(E=>S.next(P*E).value,P,30);return P+"ms "+V},toTransition:()=>{}};return S}qt.applyToOptions=t=>{const e=dr(t,100,qt);return t.ease=e.ease,t.duration=H(e.duration),t.type="keyframes",t};function Ve({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const h=t[0],f={done:!1,value:h},d=b=>a!==void 0&&b<a||l!==void 0&&b>l,p=b=>a===void 0?l:l===void 0||Math.abs(a-b)<Math.abs(l-b)?a:l;let y=n*e;const g=h+y,m=o===void 0?g:o(g);m!==g&&(y=m-h);const x=b=>-y*Math.exp(-b/s),v=b=>m+x(b),S=b=>{const A=x(b),L=v(b);f.done=Math.abs(A)<=c,f.value=f.done?m:L};let P,V;const E=b=>{d(f.value)&&(P=b,V=qt({keyframes:[f.value,p(f.value)],velocity:yi(v,b,f.value),damping:i,stiffness:r,restDelta:c,restSpeed:u}))};return E(0),{calculatedDuration:null,next:b=>{let A=!1;return!V&&P===void 0&&(A=!0,S(b),E(b)),P!==void 0&&b>=P?V.next(b-P):(!A&&S(b),f)}}}function wr(t,e,n){const s=[],i=n||Z.mix||mi,r=t.length-1;for(let o=0;o<r;o++){let a=i(t[o],t[o+1]);if(e){const l=Array.isArray(e)?e[o]||W:e;a=Lt(l,a)}s.push(a)}return s}function Pr(t,e,{clamp:n=!0,ease:s,mixer:i}={}){const r=t.length;if(qe(r===e.length),r===1)return()=>e[0];if(r===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[r-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=wr(e,s,i),l=a.length,c=u=>{if(o&&u<t[0])return e[0];let h=0;if(l>1)for(;h<t.length-2&&!(u<t[h+1]);h++);const f=Ct(t[h],t[h+1],u);return a[h](f)};return n?u=>c(Y(t[0],t[r-1],u)):c}function Sr(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=Ct(0,e,s);t.push(M(n,1,i))}}function br(t){const e=[0];return Sr(e,t.length-1),e}function Ar(t,e){return t.map(n=>n*e)}function Vr(t,e){return t.map(()=>e||ii).splice(0,t.length-1)}function bt({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const i=jo(s)?s.map(Cn):Cn(s),r={done:!1,value:e[0]},o=Ar(n&&n.length===e.length?n:br(e),t),a=Pr(o,e,{ease:Array.isArray(i)?i:Vr(e,i)});return{calculatedDuration:t,next:l=>(r.value=a(l),r.done=l>=t,r)}}const Cr=t=>t!==null;function rn(t,{repeat:e,repeatType:n="loop"},s,i=1){const r=t.filter(Cr),a=i<0||e&&n!=="loop"&&e%2===1?0:r.length-1;return!a||s===void 0?r[a]:s}const Mr={decay:Ve,inertia:Ve,tween:bt,keyframes:bt,spring:qt};function vi(t){typeof t.type=="string"&&(t.type=Mr[t.type])}class an{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const Dr=t=>t/100;class ln extends an{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==j.now()&&this.tick(j.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;vi(e);const{type:n=bt,repeat:s=0,repeatDelay:i=0,repeatType:r,velocity:o=0}=e;let{keyframes:a}=e;const l=n||bt;l!==bt&&typeof a[0]!="number"&&(this.mixKeyframes=Lt(Dr,mi(a[0],a[1])),a=[0,100]);const c=l({...e,keyframes:a});r==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...a].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=on(c));const{calculatedDuration:u}=c;this.calculatedDuration=u,this.resolvedDuration=u+i,this.totalDuration=this.resolvedDuration*(s+1)-i,this.generator=c}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:s,totalDuration:i,mixKeyframes:r,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return s.next(0);const{delay:c=0,keyframes:u,repeat:h,repeatType:f,repeatDelay:d,type:p,onUpdate:y,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const m=this.currentTime-c*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?m<0:m>i;this.currentTime=Math.max(m,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let v=this.currentTime,S=s;if(h){const b=Math.min(this.currentTime,i)/a;let A=Math.floor(b),L=b%1;!L&&b>=1&&(L=1),L===1&&A--,A=Math.min(A,h+1),A%2&&(f==="reverse"?(L=1-L,d&&(L-=d/a)):f==="mirror"&&(S=o)),v=Y(0,1,L)*a}const P=x?{done:!1,value:u[0]}:S.next(v);r&&(P.value=r(P.value));let{done:V}=P;!x&&l!==null&&(V=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const E=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&V);return E&&p!==Ve&&(P.value=rn(u,this.options,g,this.speed)),y&&y(P.value),E&&this.finish(),P}then(e,n){return this.finished.then(e,n)}get duration(){return U(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+U(e)}get time(){return U(this.currentTime)}set time(e){e=H(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(j.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=U(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=fr,startTime:n}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),this.options.onPlay?.();const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=n??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(j.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function Er(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const rt=t=>t*180/Math.PI,Ce=t=>{const e=rt(Math.atan2(t[1],t[0]));return Me(e)},Rr={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Ce,rotateZ:Ce,skewX:t=>rt(Math.atan(t[1])),skewY:t=>rt(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Me=t=>(t=t%360,t<0&&(t+=360),t),Fn=Ce,In=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Bn=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Lr={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:In,scaleY:Bn,scale:t=>(In(t)+Bn(t))/2,rotateX:t=>Me(rt(Math.atan2(t[6],t[5]))),rotateY:t=>Me(rt(Math.atan2(-t[2],t[0]))),rotateZ:Fn,rotate:Fn,skewX:t=>rt(Math.atan(t[4])),skewY:t=>rt(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function De(t){return t.includes("scale")?1:0}function Ee(t,e){if(!t||t==="none")return De(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,i;if(n)s=Lr,i=n;else{const a=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=Rr,i=a}if(!i)return De(e);const r=s[e],o=i[1].split(",").map(Fr);return typeof r=="function"?r(o):o[r]}const kr=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Ee(n,e)};function Fr(t){return parseFloat(t.trim())}const vt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Tt=new Set(vt),jn=t=>t===yt||t===w,Ir=new Set(["x","y","z"]),Br=vt.filter(t=>!Ir.has(t));function jr(t){const e=[];return Br.forEach(n=>{const s=t.getValue(n);s!==void 0&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e}const Q={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>Ee(e,"x"),y:(t,{transform:e})=>Ee(e,"y")};Q.translateX=Q.x;Q.translateY=Q.y;const at=new Set;let Re=!1,Le=!1,ke=!1;function Ti(){if(Le){const t=Array.from(at).filter(s=>s.needsMeasurement),e=new Set(t.map(s=>s.element)),n=new Map;e.forEach(s=>{const i=jr(s);i.length&&(n.set(s,i),s.render())}),t.forEach(s=>s.measureInitialState()),e.forEach(s=>{s.render();const i=n.get(s);i&&i.forEach(([r,o])=>{s.getValue(r)?.set(o)})}),t.forEach(s=>s.measureEndState()),t.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}Le=!1,Re=!1,at.forEach(t=>t.complete(ke)),at.clear()}function xi(){at.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Le=!0)})}function Or(){ke=!0,xi(),Ti(),ke=!1}class cn{constructor(e,n,s,i,r,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=s,this.motionValue=i,this.element=r,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(at.add(this),Re||(Re=!0,C.read(xi),C.resolveKeyframes(Ti))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:s,motionValue:i}=this;if(e[0]===null){const r=i?.get(),o=e[e.length-1];if(r!==void 0)e[0]=r;else if(s&&n){const a=s.readValue(n,o);a!=null&&(e[0]=a)}e[0]===void 0&&(e[0]=o),i&&r===void 0&&i.set(e[0])}Er(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),at.delete(this)}cancel(){this.state==="scheduled"&&(at.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Nr=t=>t.startsWith("--");function Ur(t,e,n){Nr(e)?t.style.setProperty(e,n):t.style[e]=n}const Wr={};function wi(t,e){const n=Xs(t);return()=>Wr[e]??n()}const Kr=wi(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Pi=wi(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Pt=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,On={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Pt([0,.65,.55,1]),circOut:Pt([.55,0,1,.45]),backIn:Pt([.31,.01,.66,-.59]),backOut:Pt([.33,1.53,.69,.99])};function Si(t,e){if(t)return typeof t=="function"?Pi()?gi(t,e):"ease-out":oi(t)?Pt(t):Array.isArray(t)?t.map(n=>Si(n,e)||On.easeOut):On[t]}function $r(t,e,n,{delay:s=0,duration:i=300,repeat:r=0,repeatType:o="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[e]:n};l&&(u.offset=l);const h=Si(a,i);Array.isArray(h)&&(u.easing=h);const f={delay:s,duration:i,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:r+1,direction:o==="reverse"?"alternate":"normal"};return c&&(f.pseudoElement=c),t.animate(u,f)}function bi(t){return typeof t=="function"&&"applyToOptions"in t}function Hr({type:t,...e}){return bi(t)&&Pi()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Ai extends an{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:s,keyframes:i,pseudoElement:r,allowFlatten:o=!1,finalKeyframe:a,onComplete:l}=e;this.isPseudoElement=!!r,this.allowFlatten=o,this.options=e,qe(typeof e.type!="string");const c=Hr(e);this.animation=$r(n,s,i,c,r),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const u=rn(i,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(u):Ur(n,s,u),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return U(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+U(e)}get time(){return U(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=H(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Kr()?(this.animation.timeline=e,W):n(this)}}const Vi={anticipate:ei,backInOut:ti,circInOut:si};function zr(t){return t in Vi}function Gr(t){typeof t.ease=="string"&&zr(t.ease)&&(t.ease=Vi[t.ease])}const he=10;class _r extends Ai{constructor(e){Gr(e),vi(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:s,onComplete:i,element:r,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const a=new ln({...o,autoplay:!1}),l=Math.max(he,j.now()-this.startTime),c=Y(0,he,l-he);n.setWithVelocity(a.sample(Math.max(0,l-c)).value,a.sample(l).value,c),a.stop()}}const Nn=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(z.test(t)||t==="0")&&!t.startsWith("url("));function Xr(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function Yr(t,e,n,s){const i=t[0];if(i===null)return!1;if(e==="display"||e==="visibility")return!0;const r=t[t.length-1],o=Nn(i,e),a=Nn(r,e);return!o||!a?!1:Xr(t)||(n==="spring"||bi(n))&&s}function Fe(t){t.duration=0,t.type="keyframes"}const qr=new Set(["opacity","clipPath","filter","transform"]),Zr=Xs(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Jr(t){const{motionValue:e,name:n,repeatDelay:s,repeatType:i,damping:r,type:o}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=e.owner.getProps();return Zr()&&n&&qr.has(n)&&(n!=="transform"||!c)&&!l&&!s&&i!=="mirror"&&r!==0&&o!=="inertia"}const Qr=40;class ta extends an{constructor({autoplay:e=!0,delay:n=0,type:s="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:o="loop",keyframes:a,name:l,motionValue:c,element:u,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=j.now();const f={autoplay:e,delay:n,type:s,repeat:i,repeatDelay:r,repeatType:o,name:l,motionValue:c,element:u,...h},d=u?.KeyframeResolver||cn;this.keyframeResolver=new d(a,(p,y,g)=>this.onKeyframesResolved(p,y,f,!g),l,c,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,s,i){this.keyframeResolver=void 0;const{name:r,type:o,velocity:a,delay:l,isHandoff:c,onUpdate:u}=s;this.resolvedAt=j.now(),Yr(e,r,o,a)||((Z.instantAnimations||!l)&&u?.(rn(e,s,n)),e[0]=e[e.length-1],Fe(s),s.repeat=0);const f={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>Qr?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:e},d=!c&&Jr(f),p=f.motionValue?.owner?.current,y=d?new _r({...f,element:p}):new ln(f);y.finished.then(()=>{this.notifyFinished()}).catch(W),this.pendingTimeline&&(this.stopTimeline=y.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=y}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Or()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function Ci(t,e,n,s=0,i=1){const r=Array.from(t).sort((c,u)=>c.sortNodePosition(u)).indexOf(e),o=t.size,a=(o-1)*s;return typeof n=="function"?n(r,o):i===1?r*s:a-r*s}const ea=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function na(t){const e=ea.exec(t);if(!e)return[,];const[,n,s,i]=e;return[`--${n??s}`,i]}function Mi(t,e,n=1){const[s,i]=na(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);if(r){const o=r.trim();return zs(o)?parseFloat(o):o}return tn(i)?Mi(i,e,n+1):i}const sa={type:"spring",stiffness:500,damping:25,restSpeed:10},ia=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),oa={type:"keyframes",duration:.8},ra={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},aa=(t,{keyframes:e})=>e.length>2?oa:Tt.has(t)?t.startsWith("scale")?ia(e[1]):sa:ra,la=t=>t!==null;function ca(t,{repeat:e,repeatType:n="loop"},s){const i=t.filter(la),r=e&&n!=="loop"&&e%2===1?0:i.length-1;return i[r]}function Di(t,e){if(t?.inherit&&e){const{inherit:n,...s}=t;return{...e,...s}}return t}function un(t,e){const n=t?.[e]??t?.default??t;return n!==t?Di(n,t):n}function ua({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:r,repeatType:o,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length}const hn=(t,e,n,s={},i,r)=>o=>{const a=un(s,t)||{},l=a.delay||s.delay||0;let{elapsed:c=0}=s;c=c-H(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-c,onUpdate:f=>{e.set(f),a.onUpdate&&a.onUpdate(f)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:r?void 0:i};ua(a)||Object.assign(u,aa(t,u)),u.duration&&(u.duration=H(u.duration)),u.repeatDelay&&(u.repeatDelay=H(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Fe(u),u.delay===0&&(h=!0)),(Z.instantAnimations||Z.skipAnimations||i?.shouldSkipAnimations)&&(h=!0,Fe(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,h&&!r&&e.get()!==void 0){const f=ca(u.keyframes,a);if(f!==void 0){C.update(()=>{u.onUpdate(f),u.onComplete()});return}}return a.isSync?new ln(u):new ta(u)};function Un(t){const e=[{},{}];return t?.values.forEach((n,s)=>{e[0][s]=n.get(),e[1][s]=n.getVelocity()}),e}function fn(t,e,n,s){if(typeof e=="function"){const[i,r]=Un(s);e=e(n!==void 0?n:t.custom,i,r)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,r]=Un(s);e=e(n!==void 0?n:t.custom,i,r)}return e}function mt(t,e,n){const s=t.getProps();return fn(s,e,n!==void 0?n:s.custom,t)}const Ei=new Set(["width","height","top","left","right","bottom",...vt]),Wn=30,ha=t=>!isNaN(parseFloat(t));class fa{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{const i=j.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const r of this.dependents)r.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=j.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=ha(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Ze);const s=this.events[e].add(n);return e==="change"?()=>{s(),C.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,s){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=j.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Wn)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Wn);return Ys(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function gt(t,e){return new fa(t,e)}const Ie=t=>Array.isArray(t);function da(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,gt(n))}function pa(t){return Ie(t)?t[t.length-1]||0:t}function ma(t,e){const n=mt(t,e);let{transitionEnd:s={},transition:i={},...r}=n||{};r={...r,...s};for(const o in r){const a=pa(r[o]);da(t,o,a)}}const B=t=>!!(t&&t.getVelocity);function ga(t){return!!(B(t)&&t.add)}function Be(t,e){const n=t.getValue("willChange");if(ga(n))return n.add(e);if(!n&&Z.WillChange){const s=new Z.WillChange("auto");t.addValue("willChange",s),s.add(e)}}function dn(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const ya="framerAppearId",Ri="data-"+dn(ya);function Li(t){return t.props[Ri]}function va({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,s}function ki(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:r,transitionEnd:o,...a}=e;const l=t.getDefaultTransition();r=r?Di(r,l):l;const c=r?.reduceMotion;s&&(r=s);const u=[],h=i&&t.animationState&&t.animationState.getState()[i];for(const f in a){const d=t.getValue(f,t.latestValues[f]??null),p=a[f];if(p===void 0||h&&va(h,f))continue;const y={delay:n,...un(r||{},f)},g=d.get();if(g!==void 0&&!d.isAnimating&&!Array.isArray(p)&&p===g&&!y.velocity)continue;let m=!1;if(window.MotionHandoffAnimation){const S=Li(t);if(S){const P=window.MotionHandoffAnimation(S,f,C);P!==null&&(y.startTime=P,m=!0)}}Be(t,f);const x=c??t.shouldReduceMotion;d.start(hn(f,d,p,x&&Ei.has(f)?{type:!1}:y,t,m));const v=d.animation;v&&u.push(v)}if(o){const f=()=>C.update(()=>{o&&ma(t,o)});u.length?Promise.all(u).then(f):f()}return u}function je(t,e,n={}){const s=mt(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const r=s?()=>Promise.all(ki(t,s,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(l=0)=>{const{delayChildren:c=0,staggerChildren:u,staggerDirection:h}=i;return Ta(t,e,l,c,u,h,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[l,c]=a==="beforeChildren"?[r,o]:[o,r];return l().then(()=>c())}else return Promise.all([r(),o(n.delay)])}function Ta(t,e,n=0,s=0,i=0,r=1,o){const a=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),a.push(je(l,e,{...o,delay:n+(typeof s=="function"?0:s)+Ci(t.variantChildren,l,s,i,r)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(a)}function xa(t,e,n={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const i=e.map(r=>je(t,r,n));s=Promise.all(i)}else if(typeof e=="string")s=je(t,e,n);else{const i=typeof e=="function"?mt(t,e,n.custom):e;s=Promise.all(ki(t,i,n))}return s.then(()=>{t.notify("AnimationComplete",e)})}const wa={test:t=>t==="auto",parse:t=>t},Fi=t=>e=>e.test(t),Ii=[yt,w,X,J,qo,Yo,wa],Kn=t=>Ii.find(Fi(t));function Pa(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||_s(t):!0}const Sa=new Set(["brightness","contrast","saturate","opacity"]);function ba(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[s]=n.match(en)||[];if(!s)return t;const i=n.replace(s,"");let r=Sa.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const Aa=/\b([a-z-]*)\(.*?\)/gu,Oe={...z,getAnimatableNone:t=>{const e=t.match(Aa);return e?e.map(ba).join(" "):t}},Ne={...z,getAnimatableNone:t=>{const e=z.parse(t);return z.createTransformer(t)(e.map(s=>typeof s=="number"?0:typeof s=="object"?{...s,alpha:1}:s))}},$n={...yt,transform:Math.round},Va={rotate:J,rotateX:J,rotateY:J,rotateZ:J,scale:jt,scaleX:jt,scaleY:jt,scaleZ:jt,skew:J,skewX:J,skewY:J,distance:w,translateX:w,translateY:w,translateZ:w,x:w,y:w,z:w,perspective:w,transformPerspective:w,opacity:Mt,originX:Dn,originY:Dn,originZ:w},pn={borderWidth:w,borderTopWidth:w,borderRightWidth:w,borderBottomWidth:w,borderLeftWidth:w,borderRadius:w,borderTopLeftRadius:w,borderTopRightRadius:w,borderBottomRightRadius:w,borderBottomLeftRadius:w,width:w,maxWidth:w,height:w,maxHeight:w,top:w,right:w,bottom:w,left:w,inset:w,insetBlock:w,insetBlockStart:w,insetBlockEnd:w,insetInline:w,insetInlineStart:w,insetInlineEnd:w,padding:w,paddingTop:w,paddingRight:w,paddingBottom:w,paddingLeft:w,paddingBlock:w,paddingBlockStart:w,paddingBlockEnd:w,paddingInline:w,paddingInlineStart:w,paddingInlineEnd:w,margin:w,marginTop:w,marginRight:w,marginBottom:w,marginLeft:w,marginBlock:w,marginBlockStart:w,marginBlockEnd:w,marginInline:w,marginInlineStart:w,marginInlineEnd:w,fontSize:w,backgroundPositionX:w,backgroundPositionY:w,...Va,zIndex:$n,fillOpacity:Mt,strokeOpacity:Mt,numOctaves:$n},Ca={...pn,color:R,backgroundColor:R,outlineColor:R,fill:R,stroke:R,borderColor:R,borderTopColor:R,borderRightColor:R,borderBottomColor:R,borderLeftColor:R,filter:Oe,WebkitFilter:Oe,mask:Ne,WebkitMask:Ne},Bi=t=>Ca[t],Ma=new Set([Oe,Ne]);function ji(t,e){let n=Bi(t);return Ma.has(n)||(n=z),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Da=new Set(["auto","none","0"]);function Ea(t,e,n){let s=0,i;for(;s<t.length&&!i;){const r=t[s];typeof r=="string"&&!Da.has(r)&&Dt(r).values.length&&(i=t[s]),s++}if(i&&n)for(const r of e)t[r]=ji(n,i)}class Ra extends cn{constructor(e,n,s,i,r){super(e,n,s,i,r,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:s}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<e.length;u++){let h=e[u];if(typeof h=="string"&&(h=h.trim(),tn(h))){const f=Mi(h,n.current);f!==void 0&&(e[u]=f),u===e.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!Ei.has(s)||e.length!==2)return;const[i,r]=e,o=Kn(i),a=Kn(r),l=Mn(i),c=Mn(r);if(l!==c&&Q[s]){this.needsMeasurement=!0;return}if(o!==a)if(jn(o)&&jn(a))for(let u=0;u<e.length;u++){const h=e[u];typeof h=="string"&&(e[u]=parseFloat(h))}else Q[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,s=[];for(let i=0;i<e.length;i++)(e[i]===null||Pa(e[i]))&&s.push(i);s.length&&Ea(e,s,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:s}=this;if(!e||!e.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Q[s](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&e.getValue(s,i).jump(i,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const i=e.getValue(n);i&&i.jump(this.measuredOrigin,!1);const r=s.length-1,o=s[r];s[r]=Q[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([a,l])=>{e.getValue(a).set(l)}),this.resolveNoneKeyframes()}}const La=new Set(["opacity","clipPath","filter","transform"]);function Oi(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let s=document;const i=n?.[t]??s.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(s=>s!=null)}const Ni=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Ue(t){return Gs(t)&&"offsetHeight"in t}const{schedule:mn}=ri(queueMicrotask,!1),$={x:!1,y:!1};function Ui(){return $.x||$.y}function ka(t){return t==="x"||t==="y"?$[t]?null:($[t]=!0,()=>{$[t]=!1}):$.x||$.y?null:($.x=$.y=!0,()=>{$.x=$.y=!1})}function Wi(t,e){const n=Oi(t),s=new AbortController,i={passive:!0,...e,signal:s.signal};return[n,i,()=>s.abort()]}function Fa(t){return!(t.pointerType==="touch"||Ui())}function Ia(t,e,n={}){const[s,i,r]=Wi(t,n);return s.forEach(o=>{let a=!1,l=!1,c;const u=()=>{o.removeEventListener("pointerleave",p)},h=g=>{c&&(c(g),c=void 0),u()},f=g=>{a=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),l&&(l=!1,h(g))},d=()=>{a=!0,window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",f,i)},p=g=>{if(g.pointerType!=="touch"){if(a){l=!0;return}h(g)}},y=g=>{if(!Fa(g))return;l=!1;const m=e(o,g);typeof m=="function"&&(c=m,o.addEventListener("pointerleave",p,i))};o.addEventListener("pointerenter",y,i),o.addEventListener("pointerdown",d,i)}),r}const Ki=(t,e)=>e?t===e?!0:Ki(t,e.parentElement):!1,gn=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Ba=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function ja(t){return Ba.has(t.tagName)||t.isContentEditable===!0}const Oa=new Set(["INPUT","SELECT","TEXTAREA"]);function Na(t){return Oa.has(t.tagName)||t.isContentEditable===!0}const Wt=new WeakSet;function Hn(t){return e=>{e.key==="Enter"&&t(e)}}function fe(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Ua=(t,e)=>{const n=t.currentTarget;if(!n)return;const s=Hn(()=>{if(Wt.has(n))return;fe(n,"down");const i=Hn(()=>{fe(n,"up")}),r=()=>fe(n,"cancel");n.addEventListener("keyup",i,e),n.addEventListener("blur",r,e)});n.addEventListener("keydown",s,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),e)};function zn(t){return gn(t)&&!Ui()}const Gn=new WeakSet;function Wa(t,e,n={}){const[s,i,r]=Wi(t,n),o=a=>{const l=a.currentTarget;if(!zn(a)||Gn.has(a))return;Wt.add(l),n.stopPropagation&&Gn.add(a);const c=e(l,a),u=(d,p)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",f),Wt.has(l)&&Wt.delete(l),zn(d)&&typeof c=="function"&&c(d,{success:p})},h=d=>{u(d,l===window||l===document||n.useGlobalTarget||Ki(l,d.target))},f=d=>{u(d,!1)};window.addEventListener("pointerup",h,i),window.addEventListener("pointercancel",f,i)};return s.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,i),Ue(a)&&(a.addEventListener("focus",c=>Ua(c,i)),!ja(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),r}function yn(t){return Gs(t)&&"ownerSVGElement"in t}const Kt=new WeakMap;let $t;const $i=(t,e,n)=>(s,i)=>i&&i[0]?i[0][t+"Size"]:yn(s)&&"getBBox"in s?s.getBBox()[e]:s[n],Ka=$i("inline","width","offsetWidth"),$a=$i("block","height","offsetHeight");function Ha({target:t,borderBoxSize:e}){Kt.get(t)?.forEach(n=>{n(t,{get width(){return Ka(t,e)},get height(){return $a(t,e)}})})}function za(t){t.forEach(Ha)}function Ga(){typeof ResizeObserver>"u"||($t=new ResizeObserver(za))}function _a(t,e){$t||Ga();const n=Oi(t);return n.forEach(s=>{let i=Kt.get(s);i||(i=new Set,Kt.set(s,i)),i.add(e),$t?.observe(s)}),()=>{n.forEach(s=>{const i=Kt.get(s);i?.delete(e),i?.size||$t?.unobserve(s)})}}const Ht=new Set;let ht;function Xa(){ht=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};Ht.forEach(e=>e(t))},window.addEventListener("resize",ht)}function Ya(t){return Ht.add(t),ht||Xa(),()=>{Ht.delete(t),!Ht.size&&typeof ht=="function"&&(window.removeEventListener("resize",ht),ht=void 0)}}function _n(t,e){return typeof t=="function"?Ya(t):_a(t,e)}function qa(t){return yn(t)&&t.tagName==="svg"}const Za=[...Ii,R,z],Ja=t=>Za.find(Fi(t)),Xn=()=>({translate:0,scale:1,origin:0,originPoint:0}),ft=()=>({x:Xn(),y:Xn()}),Yn=()=>({min:0,max:0}),k=()=>({x:Yn(),y:Yn()}),Qa=new WeakMap;function ne(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Et(t){return typeof t=="string"||Array.isArray(t)}const vn=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Tn=["initial",...vn];function se(t){return ne(t.animate)||Tn.some(e=>Et(t[e]))}function Hi(t){return!!(se(t)||t.variants)}function tl(t,e,n){for(const s in e){const i=e[s],r=n[s];if(B(i))t.addValue(s,i);else if(B(r))t.addValue(s,gt(i,{owner:t}));else if(r!==i)if(t.hasValue(s)){const o=t.getValue(s);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=t.getStaticValue(s);t.addValue(s,gt(o!==void 0?o:i,{owner:t}))}}for(const s in n)e[s]===void 0&&t.removeValue(s);return e}const We={current:null},zi={current:!1},el=typeof window<"u";function nl(){if(zi.current=!0,!!el)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>We.current=t.matches;t.addEventListener("change",e),e()}else We.current=!1}const qn=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Zt={};function Gi(t){Zt=t}function sl(){return Zt}class il{scrapeMotionValuesFromProps(e,n,s){return{}}constructor({parent:e,props:n,presenceContext:s,reducedMotionConfig:i,skipAnimations:r,blockInitialAnimation:o,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=cn,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const d=j.now();this.renderScheduledAt<d&&(this.renderScheduledAt=d,C.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=a;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=r,this.options=l,this.blockInitialAnimation=!!o,this.isControllingVariants=se(n),this.isVariantNode=Hi(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:h,...f}=this.scrapeMotionValuesFromProps(n,{},this);for(const d in f){const p=f[d];c[d]!==void 0&&B(p)&&p.set(c[d])}}mount(e){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=e,Qa.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(zi.current||nl(),this.shouldReduceMotion=We.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),tt(this.notifyUpdate),tt(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&La.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:a,times:l,ease:c,duration:u}=n.accelerate,h=new Ai({element:this.current,name:e,keyframes:a,times:l,ease:c,duration:H(u)}),f=o(h);this.valueSubscriptions.set(e,()=>{f(),h.cancel()});return}const s=Tt.has(e);s&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&C.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let r;typeof window<"u"&&window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{i(),r&&r(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Zt){const n=Zt[e];if(!n)continue;const{isEnabled:s,Feature:i}=n;if(!this.features[e]&&i&&s(this.props)&&(this.features[e]=new i(this)),this.features[e]){const r=this.features[e];r.isMounted?r.update():(r.mount(),r.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):k()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let s=0;s<qn.length;s++){const i=qn[s];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const r="on"+i,o=e[r];o&&(this.propEventSubscriptions[i]=this.on(i,o))}this.prevMotionValues=tl(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const s=this.values.get(e);n!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&n!==void 0&&(s=gt(n===null?void 0:n,{owner:this}),this.addValue(e,s)),s}readValue(e,n){let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(zs(s)||_s(s))?s=parseFloat(s):!Ja(s)&&z.test(n)&&(s=ji(e,n)),this.setBaseTarget(e,B(s)?s.get():s)),B(s)?s.get():s}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const r=fn(this.props,n,this.presenceContext?.custom);r&&(s=r[e])}if(n&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!B(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Ze),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){mn.render(this.render)}}class _i extends il{constructor(){super(...arguments),this.KeyframeResolver=Ra}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const s=e.style;return s?s[n]:void 0}removeValueFromRenderState(e,{vars:n,style:s}){delete n[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;B(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class et{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Xi({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function ol({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function rl(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function de(t){return t===void 0||t===1}function Ke({scale:t,scaleX:e,scaleY:n}){return!de(t)||!de(e)||!de(n)}function it(t){return Ke(t)||Yi(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Yi(t){return Zn(t.x)||Zn(t.y)}function Zn(t){return t&&t!=="0%"}function Jt(t,e,n){const s=t-n,i=e*s;return n+i}function Jn(t,e,n,s,i){return i!==void 0&&(t=Jt(t,i,s)),Jt(t,n,s)+e}function $e(t,e=0,n=1,s,i){t.min=Jn(t.min,e,n,s,i),t.max=Jn(t.max,e,n,s,i)}function qi(t,{x:e,y:n}){$e(t.x,e.translate,e.scale,e.originPoint),$e(t.y,n.translate,n.scale,n.originPoint)}const Qn=.999999999999,ts=1.0000000000001;function al(t,e,n,s=!1){const i=n.length;if(!i)return;e.x=e.y=1;let r,o;for(let a=0;a<i;a++){r=n[a],o=r.projectionDelta;const{visualElement:l}=r.options;l&&l.props.style&&l.props.style.display==="contents"||(s&&r.options.layoutScroll&&r.scroll&&r!==r.root&&pt(t,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,qi(t,o)),s&&it(r.latestValues)&&pt(t,r.latestValues))}e.x<ts&&e.x>Qn&&(e.x=1),e.y<ts&&e.y>Qn&&(e.y=1)}function dt(t,e){t.min=t.min+e,t.max=t.max+e}function es(t,e,n,s,i=.5){const r=M(t.min,t.max,i);$e(t,e,n,r,s)}function pt(t,e){es(t.x,e.x,e.scaleX,e.scale,e.originX),es(t.y,e.y,e.scaleY,e.scale,e.originY)}function Zi(t,e){return Xi(rl(t.getBoundingClientRect(),e))}function ll(t,e,n){const s=Zi(t,n),{scroll:i}=e;return i&&(dt(s.x,i.offset.x),dt(s.y,i.offset.y)),s}const cl={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ul=vt.length;function hl(t,e,n){let s="",i=!0;for(let r=0;r<ul;r++){const o=vt[r],a=t[o];if(a===void 0)continue;let l=!0;if(typeof a=="number")l=a===(o.startsWith("scale")?1:0);else{const c=parseFloat(a);l=o.startsWith("scale")?c===1:c===0}if(!l||n){const c=Ni(a,pn[o]);if(!l){i=!1;const u=cl[o]||o;s+=`${u}(${c}) `}n&&(e[o]=c)}}return s=s.trim(),n?s=n(e,i?"":s):i&&(s="none"),s}function xn(t,e,n){const{style:s,vars:i,transformOrigin:r}=t;let o=!1,a=!1;for(const l in e){const c=e[l];if(Tt.has(l)){o=!0;continue}else if(li(l)){i[l]=c;continue}else{const u=Ni(c,pn[l]);l.startsWith("origin")?(a=!0,r[l]=u):s[l]=u}}if(e.transform||(o||n?s.transform=hl(e,t.transform,n):s.transform&&(s.transform="none")),a){const{originX:l="50%",originY:c="50%",originZ:u=0}=r;s.transformOrigin=`${l} ${c} ${u}`}}function Ji(t,{style:e,vars:n},s,i){const r=t.style;let o;for(o in e)r[o]=e[o];i?.applyProjectionStyles(r,s);for(o in n)r.setProperty(o,n[o])}function ns(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const wt={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(w.test(t))t=parseFloat(t);else return t;const n=ns(t,e.target.x),s=ns(t,e.target.y);return`${n}% ${s}%`}},fl={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,i=z.parse(t);if(i.length>5)return s;const r=z.createTransformer(t),o=typeof i[0]!="number"?1:0,a=n.x.scale*e.x,l=n.y.scale*e.y;i[0+o]/=a,i[1+o]/=l;const c=M(a,l,.5);return typeof i[2+o]=="number"&&(i[2+o]/=c),typeof i[3+o]=="number"&&(i[3+o]/=c),r(i)}},He={borderRadius:{...wt,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:wt,borderTopRightRadius:wt,borderBottomLeftRadius:wt,borderBottomRightRadius:wt,boxShadow:fl};function Qi(t,{layout:e,layoutId:n}){return Tt.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!He[t]||t==="opacity")}function wn(t,e,n){const s=t.style,i=e?.style,r={};if(!s)return r;for(const o in s)(B(s[o])||i&&B(i[o])||Qi(o,t)||n?.getValue(o)?.liveStyle!==void 0)&&(r[o]=s[o]);return r}function dl(t){return window.getComputedStyle(t)}class pl extends _i{constructor(){super(...arguments),this.type="html",this.renderInstance=Ji}readValueFromInstance(e,n){if(Tt.has(n))return this.projection?.isProjecting?De(n):kr(e,n);{const s=dl(e),i=(li(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return Zi(e,n)}build(e,n,s){xn(e,n,s.transformTemplate)}scrapeMotionValuesFromProps(e,n,s){return wn(e,n,s)}}const ml={offset:"stroke-dashoffset",array:"stroke-dasharray"},gl={offset:"strokeDashoffset",array:"strokeDasharray"};function yl(t,e,n=1,s=0,i=!0){t.pathLength=1;const r=i?ml:gl;t[r.offset]=`${-s}`,t[r.array]=`${e} ${n}`}const vl=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function to(t,{attrX:e,attrY:n,attrScale:s,pathLength:i,pathSpacing:r=1,pathOffset:o=0,...a},l,c,u){if(xn(t,a,c),l){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:f}=t;h.transform&&(f.transform=h.transform,delete h.transform),(f.transform||h.transformOrigin)&&(f.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??"fill-box",delete h.transformBox);for(const d of vl)h[d]!==void 0&&(f[d]=h[d],delete h[d]);e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),s!==void 0&&(h.scale=s),i!==void 0&&yl(h,i,r,o,!1)}const eo=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),no=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Tl(t,e,n,s){Ji(t,e,void 0,s);for(const i in e.attrs)t.setAttribute(eo.has(i)?i:dn(i),e.attrs[i])}function so(t,e,n){const s=wn(t,e,n);for(const i in t)if(B(t[i])||B(e[i])){const r=vt.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;s[r]=t[i]}return s}class xl extends _i{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=k}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Tt.has(n)){const s=Bi(n);return s&&s.default||0}return n=eo.has(n)?n:dn(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,s){return so(e,n,s)}build(e,n,s){to(e,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,n,s,i){Tl(e,n,s,i)}mount(e){this.isSVGTag=no(e.tagName),super.mount(e)}}const wl=Tn.length;function io(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?io(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<wl;n++){const s=Tn[n],i=t.props[s];(Et(i)||i===!1)&&(e[s]=i)}return e}function oo(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s<n;s++)if(e[s]!==t[s])return!1;return!0}const Pl=[...vn].reverse(),Sl=vn.length;function bl(t){return e=>Promise.all(e.map(({animation:n,options:s})=>xa(t,n,s)))}function Al(t){let e=bl(t),n=ss(),s=!0;const i=l=>(c,u)=>{const h=mt(t,u,l==="exit"?t.presenceContext?.custom:void 0);if(h){const{transition:f,transitionEnd:d,...p}=h;c={...c,...p,...d}}return c};function r(l){e=l(t)}function o(l){const{props:c}=t,u=io(t.parent)||{},h=[],f=new Set;let d={},p=1/0;for(let g=0;g<Sl;g++){const m=Pl[g],x=n[m],v=c[m]!==void 0?c[m]:u[m],S=Et(v),P=m===l?x.isActive:null;P===!1&&(p=g);let V=v===u[m]&&v!==c[m]&&S;if(V&&s&&t.manuallyAnimateOnMount&&(V=!1),x.protectedKeys={...d},!x.isActive&&P===null||!v&&!x.prevProp||ne(v)||typeof v=="boolean")continue;if(m==="exit"&&x.isActive&&P!==!0){x.prevResolvedValues&&(d={...d,...x.prevResolvedValues});continue}const E=Vl(x.prevProp,v);let b=E||m===l&&x.isActive&&!V&&S||g>p&&S,A=!1;const L=Array.isArray(v)?v:[v];let G=L.reduce(i(m),{});P===!1&&(G={});const{prevResolvedValues:xt={}}=x,oe={...xt,...G},An=F=>{b=!0,f.has(F)&&(A=!0,f.delete(F)),x.needsAnimating[F]=!0;const N=t.getValue(F);N&&(N.liveStyle=!1)};for(const F in oe){const N=G[F],nt=xt[F];if(d.hasOwnProperty(F))continue;let lt=!1;Ie(N)&&Ie(nt)?lt=!oo(N,nt):lt=N!==nt,lt?N!=null?An(F):f.add(F):N!==void 0&&f.has(F)?An(F):x.protectedKeys[F]=!0}x.prevProp=v,x.prevResolvedValues=G,x.isActive&&(d={...d,...G}),s&&t.blockInitialAnimation&&(b=!1);const Vn=V&&E;b&&(!Vn||A)&&h.push(...L.map(F=>{const N={type:m};if(typeof F=="string"&&s&&!Vn&&t.manuallyAnimateOnMount&&t.parent){const{parent:nt}=t,lt=mt(nt,F);if(nt.enteringChildren&&lt){const{delayChildren:Eo}=lt.transition||{};N.delay=Ci(nt.enteringChildren,t,Eo)}}return{animation:F,options:N}}))}if(f.size){const g={};if(typeof c.initial!="boolean"){const m=mt(t,Array.isArray(c.initial)?c.initial[0]:c.initial);m&&m.transition&&(g.transition=m.transition)}f.forEach(m=>{const x=t.getBaseTarget(m),v=t.getValue(m);v&&(v.liveStyle=!0),g[m]=x??null}),h.push({animation:g})}let y=!!h.length;return s&&(c.initial===!1||c.initial===c.animate)&&!t.manuallyAnimateOnMount&&(y=!1),s=!1,y?e(h):Promise.resolve()}function a(l,c){if(n[l].isActive===c)return Promise.resolve();t.variantChildren?.forEach(h=>h.animationState?.setActive(l,c)),n[l].isActive=c;const u=o(l);for(const h in n)n[h].protectedKeys={};return u}return{animateChanges:o,setActive:a,setAnimateFunction:r,getState:()=>n,reset:()=>{n=ss()}}}function Vl(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!oo(e,t):!1}function st(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ss(){return{animate:st(!0),whileInView:st(),whileHover:st(),whileTap:st(),whileDrag:st(),whileFocus:st(),exit:st()}}function is(t,e){t.min=e.min,t.max=e.max}function K(t,e){is(t.x,e.x),is(t.y,e.y)}function os(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const ro=1e-4,Cl=1-ro,Ml=1+ro,ao=.01,Dl=0-ao,El=0+ao;function O(t){return t.max-t.min}function Rl(t,e,n){return Math.abs(t-e)<=n}function rs(t,e,n,s=.5){t.origin=s,t.originPoint=M(e.min,e.max,t.origin),t.scale=O(n)/O(e),t.translate=M(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Cl&&t.scale<=Ml||isNaN(t.scale))&&(t.scale=1),(t.translate>=Dl&&t.translate<=El||isNaN(t.translate))&&(t.translate=0)}function At(t,e,n,s){rs(t.x,e.x,n.x,s?s.originX:void 0),rs(t.y,e.y,n.y,s?s.originY:void 0)}function as(t,e,n){t.min=n.min+e.min,t.max=t.min+O(e)}function Ll(t,e,n){as(t.x,e.x,n.x),as(t.y,e.y,n.y)}function ls(t,e,n){t.min=e.min-n.min,t.max=t.min+O(e)}function Qt(t,e,n){ls(t.x,e.x,n.x),ls(t.y,e.y,n.y)}function cs(t,e,n,s,i){return t-=e,t=Jt(t,1/n,s),i!==void 0&&(t=Jt(t,1/i,s)),t}function kl(t,e=0,n=1,s=.5,i,r=t,o=t){if(X.test(e)&&(e=parseFloat(e),e=M(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=M(r.min,r.max,s);t===r&&(a-=e),t.min=cs(t.min,e,n,a,i),t.max=cs(t.max,e,n,a,i)}function us(t,e,[n,s,i],r,o){kl(t,e[n],e[s],e[i],e.scale,r,o)}const Fl=["x","scaleX","originX"],Il=["y","scaleY","originY"];function hs(t,e,n,s){us(t.x,e,Fl,n?n.x:void 0,s?s.x:void 0),us(t.y,e,Il,n?n.y:void 0,s?s.y:void 0)}function fs(t){return t.translate===0&&t.scale===1}function lo(t){return fs(t.x)&&fs(t.y)}function ds(t,e){return t.min===e.min&&t.max===e.max}function Bl(t,e){return ds(t.x,e.x)&&ds(t.y,e.y)}function ps(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function co(t,e){return ps(t.x,e.x)&&ps(t.y,e.y)}function ms(t){return O(t.x)/O(t.y)}function gs(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function _(t){return[t("x"),t("y")]}function jl(t,e,n){let s="";const i=t.x.translate/e.x,r=t.y.translate/e.y,o=n?.z||0;if((i||r||o)&&(s=`translate3d(${i}px, ${r}px, ${o}px) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:c,rotate:u,rotateX:h,rotateY:f,skewX:d,skewY:p}=n;c&&(s=`perspective(${c}px) ${s}`),u&&(s+=`rotate(${u}deg) `),h&&(s+=`rotateX(${h}deg) `),f&&(s+=`rotateY(${f}deg) `),d&&(s+=`skewX(${d}deg) `),p&&(s+=`skewY(${p}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return(a!==1||l!==1)&&(s+=`scale(${a}, ${l})`),s||"none"}const uo=["TopLeft","TopRight","BottomLeft","BottomRight"],Ol=uo.length,ys=t=>typeof t=="string"?parseFloat(t):t,vs=t=>typeof t=="number"||w.test(t);function Nl(t,e,n,s,i,r){i?(t.opacity=M(0,n.opacity??1,Ul(s)),t.opacityExit=M(e.opacity??1,0,Wl(s))):r&&(t.opacity=M(e.opacity??1,n.opacity??1,s));for(let o=0;o<Ol;o++){const a=`border${uo[o]}Radius`;let l=Ts(e,a),c=Ts(n,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||vs(l)===vs(c)?(t[a]=Math.max(M(ys(l),ys(c),s),0),(X.test(c)||X.test(l))&&(t[a]+="%")):t[a]=c}(e.rotate||n.rotate)&&(t.rotate=M(e.rotate||0,n.rotate||0,s))}function Ts(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Ul=ho(0,.5,ni),Wl=ho(.5,.95,W);function ho(t,e,n){return s=>s<t?0:s>e?1:n(Ct(t,e,s))}function Kl(t,e,n){const s=B(t)?t:gt(t);return s.start(hn("",s,e,n)),s.animation}function Rt(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}const $l=(t,e)=>t.depth-e.depth;class Hl{constructor(){this.children=[],this.isDirty=!1}add(e){Ye(this.children,e),this.isDirty=!0}remove(e){_t(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort($l),this.isDirty=!1,this.children.forEach(e)}}function zl(t,e){const n=j.now(),s=({timestamp:i})=>{const r=i-n;r>=e&&(tt(s),t(r-e))};return C.setup(s,!0),()=>tt(s)}function zt(t){return B(t)?t.get():t}class Gl{constructor(){this.members=[]}add(e){Ye(this.members,e);for(let n=this.members.length-1;n>=0;n--){const s=this.members[n];if(s===e||s===this.lead||s===this.prevLead)continue;const i=s.instance;i&&i.isConnected===!1&&s.isPresent!==!1&&!s.snapshot&&_t(this.members,s)}e.scheduleRender()}remove(e){if(_t(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(i=>e===i);if(n===0)return!1;let s;for(let i=n;i>=0;i--){const r=this.members[i],o=r.instance;if(r.isPresent!==!1&&(!o||o.isConnected!==!1)){s=r;break}}return s?(this.promote(s),!0):!1}promote(e,n){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender();const i=s.options.layoutDependency,r=e.options.layoutDependency;if(!(i!==void 0&&r!==void 0&&i===r)){const l=s.instance;l&&l.isConnected===!1&&!s.snapshot||(e.resumeFrom=s,n&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0))}const{crossfade:a}=e.options;a===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:s}=e;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Gt={hasAnimatedSinceResize:!0,hasEverUpdated:!1},pe=["","X","Y","Z"],_l=1e3;let Xl=0;function me(t,e,n,s){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),s&&(s[t]=0))}function fo(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Li(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",C,!(i||r))}const{parent:s}=t;s&&!s.hasCheckedOptimisedAppear&&fo(s)}function po({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(o={},a=e?.()){this.id=Xl++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Zl),this.nodes.forEach(ec),this.nodes.forEach(nc),this.nodes.forEach(Jl)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new Hl)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new Ze),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=yn(o)&&!qa(o),this.instance=o;const{layoutId:a,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||a)&&(this.isLayoutDirty=!0),t){let u,h=0;const f=()=>this.root.updateBlockedByResize=!1;C.read(()=>{h=window.innerWidth}),t(o,()=>{const d=window.innerWidth;d!==h&&(h=d,this.root.updateBlockedByResize=!0,u&&u(),u=zl(f,250),Gt.hasAnimatedSinceResize&&(Gt.hasAnimatedSinceResize=!1,this.nodes.forEach(Ps)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:f,layout:d})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const p=this.options.transition||c.getDefaultTransition()||ac,{onLayoutAnimationStart:y,onLayoutAnimationComplete:g}=c.getProps(),m=!this.targetLayout||!co(this.targetLayout,d),x=!h&&f;if(this.options.layoutRoot||this.resumeFrom||x||h&&(m||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const v={...un(p,"layout"),onPlay:y,onComplete:g};(c.shouldReduceMotion||this.options.layoutRoot)&&(v.delay=0,v.type=!1),this.startAnimation(v),this.setAnimationOrigin(u,x)}else h||Ps(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=d})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),tt(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(sc),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&fo(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const h=this.path[u];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(xs);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(ws);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(tc),this.nodes.forEach(Yl),this.nodes.forEach(ql)):this.nodes.forEach(ws),this.clearAllSnapshots();const a=j.now();I.delta=Y(0,1e3/60,a-I.timestamp),I.timestamp=a,I.isProcessing=!0,re.update.process(I),re.preRender.process(I),re.render.process(I),I.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,mn.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Ql),this.sharedNodes.forEach(ic)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,C.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){C.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!O(this.snapshot.measuredBox.x)&&!O(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=k(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&this.instance){const l=s(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!i)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!lo(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;o&&this.instance&&(a||it(this.latestValues)||u)&&(i(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),lc(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return k();const a=o.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(cc))){const{scroll:c}=this.root;c&&(dt(a.x,c.offset.x),dt(a.y,c.offset.y))}return a}removeElementScroll(o){const a=k();if(K(a,o),this.scroll?.wasRoot)return a;for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:u,options:h}=c;c!==this.root&&u&&h.layoutScroll&&(u.wasRoot&&K(a,o),dt(a.x,u.offset.x),dt(a.y,u.offset.y))}return a}applyTransform(o,a=!1){const l=k();K(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];!a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&pt(l,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),it(u.latestValues)&&pt(l,u.latestValues)}return it(this.latestValues)&&pt(l,this.latestValues),l}removeTransform(o){const a=k();K(a,o);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!c.instance||!it(c.latestValues))continue;Ke(c.latestValues)&&c.updateSnapshot();const u=k(),h=c.measurePageBox();K(u,h),hs(a,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,u)}return it(this.latestValues)&&hs(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==I.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(o||l&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:h}=this.options;if(!this.layout||!(u||h))return;this.resolvedRelativeTargetAt=I.timestamp;const f=this.getClosestProjectingParent();f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=k(),this.targetWithTransforms=k()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Ll(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):K(this.target,this.layout.layoutBox),qi(this.target,this.targetDelta)):K(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&this.animationProgress!==1?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Ke(this.parent.latestValues)||Yi(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,a,l){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=k(),this.relativeTargetOrigin=k(),Qt(this.relativeTargetOrigin,a,l),K(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const o=this.getLead(),a=!!this.resumingFrom||this!==o;let l=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===I.timestamp&&(l=!1),l)return;const{layout:c,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||u))return;K(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,f=this.treeScale.y;al(this.layoutCorrected,this.treeScale,this.path,a),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=k());const{target:d}=o;if(!d){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(os(this.prevProjectionDelta.x,this.projectionDelta.x),os(this.prevProjectionDelta.y,this.projectionDelta.y)),At(this.projectionDelta,this.layoutCorrected,d,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==f||!gs(this.projectionDelta.x,this.prevProjectionDelta.x)||!gs(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",d))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.visualElement?.scheduleRender(),o){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ft(),this.projectionDelta=ft(),this.projectionDeltaWithTransform=ft()}setAnimationOrigin(o,a=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},h=ft();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const f=k(),d=l?l.source:void 0,p=this.layout?this.layout.source:void 0,y=d!==p,g=this.getStack(),m=!g||g.members.length<=1,x=!!(y&&!m&&this.options.crossfade===!0&&!this.path.some(rc));this.animationProgress=0;let v;this.mixTargetDelta=S=>{const P=S/1e3;Ss(h.x,o.x,P),Ss(h.y,o.y,P),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Qt(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),oc(this.relativeTarget,this.relativeTargetOrigin,f,P),v&&Bl(this.relativeTarget,v)&&(this.isProjectionDirty=!1),v||(v=k()),K(v,this.relativeTarget)),y&&(this.animationValues=u,Nl(u,c,this.latestValues,P,x,m)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=P},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(tt(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=C.update(()=>{Gt.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=gt(0)),this.motionValue.jump(0,!1),this.currentAnimation=Kl(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(_l),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&mo(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||k();const h=O(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+h;const f=O(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+f}K(a,l),pt(a,u),At(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Gl),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){const{layoutId:o}=this.options;return o?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:o}=this.options;return o?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&me("z",o,c,this.animationValues);for(let u=0;u<pe.length;u++)me(`rotate${pe[u]}`,o,c,this.animationValues),me(`skew${pe[u]}`,o,c,this.animationValues);o.render();for(const u in c)o.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);o.scheduleRender()}applyProjectionStyles(o,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=zt(a?.pointerEvents)||"",o.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=zt(a?.pointerEvents)||""),this.hasProjected&&!it(this.latestValues)&&(o.transform=l?l({},""):"none",this.hasProjected=!1);return}o.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let h=jl(this.projectionDeltaWithTransform,this.treeScale,u);l&&(h=l(u,h)),o.transform=h;const{x:f,y:d}=this.projectionDelta;o.transformOrigin=`${f.origin*100}% ${d.origin*100}% 0`,c.animationValues?o.opacity=c===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:o.opacity=c===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const p in He){if(u[p]===void 0)continue;const{correct:y,applyTo:g,isCSSVariable:m}=He[p],x=h==="none"?u[p]:y(u[p],c);if(g){const v=g.length;for(let S=0;S<v;S++)o[g[S]]=x}else m?this.options.visualElement.renderState.vars[p]=x:o[p]=x}this.options.layoutId&&(o.pointerEvents=c===this?zt(a?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>o.currentAnimation?.stop()),this.root.nodes.forEach(xs),this.root.sharedNodes.clear()}}}function Yl(t){t.updateLayout()}function ql(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:s}=t.layout,{animationType:i}=t.options,r=e.source!==t.layout.source;i==="size"?_(u=>{const h=r?e.measuredBox[u]:e.layoutBox[u],f=O(h);h.min=n[u].min,h.max=h.min+f}):mo(i,e.layoutBox,n)&&_(u=>{const h=r?e.measuredBox[u]:e.layoutBox[u],f=O(n[u]);h.max=h.min+f,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[u].max=t.relativeTarget[u].min+f)});const o=ft();At(o,n,e.layoutBox);const a=ft();r?At(a,t.applyTransform(s,!0),e.measuredBox):At(a,n,e.layoutBox);const l=!lo(o);let c=!1;if(!t.resumeFrom){const u=t.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:h,layout:f}=u;if(h&&f){const d=k();Qt(d,e.layoutBox,h.layoutBox);const p=k();Qt(p,n,f.layoutBox),co(d,p)||(c=!0),u.options.layoutRoot&&(t.relativeTarget=p,t.relativeTargetOrigin=d,t.relativeParent=u)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:a,layoutDelta:o,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function Zl(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Jl(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Ql(t){t.clearSnapshot()}function xs(t){t.clearMeasurements()}function ws(t){t.isLayoutDirty=!1}function tc(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Ps(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function ec(t){t.resolveTargetDelta()}function nc(t){t.calcProjection()}function sc(t){t.resetSkewAndRotation()}function ic(t){t.removeLeadSnapshot()}function Ss(t,e,n){t.translate=M(e.translate,0,n),t.scale=M(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function bs(t,e,n,s){t.min=M(e.min,n.min,s),t.max=M(e.max,n.max,s)}function oc(t,e,n,s){bs(t.x,e.x,n.x,s),bs(t.y,e.y,n.y,s)}function rc(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const ac={duration:.45,ease:[.4,0,.1,1]},As=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Vs=As("applewebkit/")&&!As("chrome/")?Math.round:W;function Cs(t){t.min=Vs(t.min),t.max=Vs(t.max)}function lc(t){Cs(t.x),Cs(t.y)}function mo(t,e,n){return t==="position"||t==="preserve-aspect"&&!Rl(ms(e),ms(n),.2)}function cc(t){return t!==t.root&&t.scroll?.wasRoot}const uc=po({attachResizeListener:(t,e)=>Rt(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),ge={current:void 0},go=po({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ge.current){const t=new uc({});t.mount(window),t.setOptions({layoutScroll:!0}),ge.current=t}return ge.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Pn=T.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Ms(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function hc(...t){return e=>{let n=!1;const s=t.map(i=>{const r=Ms(i,e);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;i<s.length;i++){const r=s[i];typeof r=="function"?r():Ms(t[i],null)}}}}function fc(...t){return T.useCallback(hc(...t),t)}class dc extends T.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const s=n.offsetParent,i=Ue(s)&&s.offsetWidth||0,r=Ue(s)&&s.offsetHeight||0,o=this.props.sizeRef.current;o.height=n.offsetHeight||0,o.width=n.offsetWidth||0,o.top=n.offsetTop,o.left=n.offsetLeft,o.right=i-o.width-o.left,o.bottom=r-o.height-o.top}return null}componentDidUpdate(){}render(){return this.props.children}}function pc({children:t,isPresent:e,anchorX:n,anchorY:s,root:i,pop:r}){const o=T.useId(),a=T.useRef(null),l=T.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:c}=T.useContext(Pn),u=t.props?.ref??t?.ref,h=fc(a,u);return T.useInsertionEffect(()=>{const{width:f,height:d,top:p,left:y,right:g,bottom:m}=l.current;if(e||r===!1||!a.current||!f||!d)return;const x=n==="left"?`left: ${y}`:`right: ${g}`,v=s==="bottom"?`bottom: ${m}`:`top: ${p}`;a.current.dataset.motionPopId=o;const S=document.createElement("style");c&&(S.nonce=c);const P=i??document.head;return P.appendChild(S),S.sheet&&S.sheet.insertRule(`
2
+ [data-motion-pop-id="${o}"] {
3
+ position: absolute !important;
4
+ width: ${f}px !important;
5
+ height: ${d}px !important;
6
+ ${x}px !important;
7
+ ${v}px !important;
8
+ }
9
+ `),()=>{P.contains(S)&&P.removeChild(S)}},[e]),q.jsx(dc,{isPresent:e,childRef:a,sizeRef:l,pop:r,children:r===!1?t:T.cloneElement(t,{ref:h})})}const mc=({children:t,initial:e,isPresent:n,onExitComplete:s,custom:i,presenceAffectsLayout:r,mode:o,anchorX:a,anchorY:l,root:c})=>{const u=Xe(gc),h=T.useId();let f=!0,d=T.useMemo(()=>(f=!1,{id:h,initial:e,isPresent:n,custom:i,onExitComplete:p=>{u.set(p,!0);for(const y of u.values())if(!y)return;s&&s()},register:p=>(u.set(p,!1),()=>u.delete(p))}),[n,u,s]);return r&&f&&(d={...d}),T.useMemo(()=>{u.forEach((p,y)=>u.set(y,!1))},[n]),T.useEffect(()=>{!n&&!u.size&&s&&s()},[n]),t=q.jsx(pc,{pop:o==="popLayout",isPresent:n,anchorX:a,anchorY:l,root:c,children:t}),q.jsx(ee.Provider,{value:d,children:t})};function gc(){return new Map}function yo(t=!0){const e=T.useContext(ee);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:i}=e,r=T.useId();T.useEffect(()=>{if(t)return i(r)},[t]);const o=T.useCallback(()=>t&&s&&s(r),[r,s,t]);return!n&&s?[!1,o]:[!0]}const Ot=t=>t.key||"";function Ds(t){const e=[];return T.Children.forEach(t,n=>{T.isValidElement(n)&&e.push(n)}),e}const Cu=({children:t,custom:e,initial:n=!0,onExitComplete:s,presenceAffectsLayout:i=!0,mode:r="sync",propagate:o=!1,anchorX:a="left",anchorY:l="top",root:c})=>{const[u,h]=yo(o),f=T.useMemo(()=>Ds(t),[t]),d=o&&!u?[]:f.map(Ot),p=T.useRef(!0),y=T.useRef(f),g=Xe(()=>new Map),m=T.useRef(new Set),[x,v]=T.useState(f),[S,P]=T.useState(f);Hs(()=>{p.current=!1,y.current=f;for(let b=0;b<S.length;b++){const A=Ot(S[b]);d.includes(A)?(g.delete(A),m.current.delete(A)):g.get(A)!==!0&&g.set(A,!1)}},[S,d.length,d.join("-")]);const V=[];if(f!==x){let b=[...f];for(let A=0;A<S.length;A++){const L=S[A],G=Ot(L);d.includes(G)||(b.splice(A,0,L),V.push(L))}return r==="wait"&&V.length&&(b=V),P(Ds(b)),v(f),null}const{forceRender:E}=T.useContext(_e);return q.jsx(q.Fragment,{children:S.map(b=>{const A=Ot(b),L=o&&!u?!1:f===S||d.includes(A),G=()=>{if(m.current.has(A))return;if(m.current.add(A),g.has(A))g.set(A,!0);else return;let xt=!0;g.forEach(oe=>{oe||(xt=!1)}),xt&&(E?.(),P(y.current),o&&h?.(),s&&s())};return q.jsx(mc,{isPresent:L,initial:!p.current||n?void 0:!1,custom:e,presenceAffectsLayout:i,mode:r,root:c,onExitComplete:L?void 0:G,anchorX:a,anchorY:l,children:b},A)})})},vo=T.createContext({strict:!1}),Es={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let Rs=!1;function yc(){if(Rs)return;const t={};for(const e in Es)t[e]={isEnabled:n=>Es[e].some(s=>!!n[s])};Gi(t),Rs=!0}function To(){return yc(),sl()}function vc(t){const e=To();for(const n in t)e[n]={...e[n],...t[n]};Gi(e)}const Tc=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function te(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Tc.has(t)}let xo=t=>!te(t);function xc(t){typeof t=="function"&&(xo=e=>e.startsWith("on")?!te(e):t(e))}try{xc(require("@emotion/is-prop-valid").default)}catch{}function wc(t,e,n){const s={};for(const i in t)i==="values"&&typeof t.values=="object"||(xo(i)||n===!0&&te(i)||!e&&!te(i)||t.draggable&&i.startsWith("onDrag"))&&(s[i]=t[i]);return s}const ie=T.createContext({});function Pc(t,e){if(se(t)){const{initial:n,animate:s}=t;return{initial:n===!1||Et(n)?n:void 0,animate:Et(s)?s:void 0}}return t.inherit!==!1?e:{}}function Sc(t){const{initial:e,animate:n}=Pc(t,T.useContext(ie));return T.useMemo(()=>({initial:e,animate:n}),[Ls(e),Ls(n)])}function Ls(t){return Array.isArray(t)?t.join(" "):t}const Sn=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function wo(t,e,n){for(const s in e)!B(e[s])&&!Qi(s,n)&&(t[s]=e[s])}function bc({transformTemplate:t},e){return T.useMemo(()=>{const n=Sn();return xn(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Ac(t,e){const n=t.style||{},s={};return wo(s,n,t),Object.assign(s,bc(t,e)),s}function Vc(t,e){const n={},s=Ac(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=s,n}const Po=()=>({...Sn(),attrs:{}});function Cc(t,e,n,s){const i=T.useMemo(()=>{const r=Po();return to(r,e,no(s),t.transformTemplate,t.style),{...r.attrs,style:{...r.style}}},[e]);if(t.style){const r={};wo(r,t.style,t),i.style={...r,...i.style}}return i}const Mc=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function bn(t){return typeof t!="string"||t.includes("-")?!1:!!(Mc.indexOf(t)>-1||/[A-Z]/u.test(t))}function Dc(t,e,n,{latestValues:s},i,r=!1,o){const l=(o??bn(t)?Cc:Vc)(e,s,i,t),c=wc(e,typeof t=="string",r),u=t!==T.Fragment?{...c,...l,ref:n}:{},{children:h}=e,f=T.useMemo(()=>B(h)?h.get():h,[h]);return T.createElement(t,{...u,children:f})}function Ec({scrapeMotionValuesFromProps:t,createRenderState:e},n,s,i){return{latestValues:Rc(n,s,i,t),renderState:e()}}function Rc(t,e,n,s){const i={},r=s(t,{});for(const f in r)i[f]=zt(r[f]);let{initial:o,animate:a}=t;const l=se(t),c=Hi(t);e&&c&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const h=u?a:o;if(h&&typeof h!="boolean"&&!ne(h)){const f=Array.isArray(h)?h:[h];for(let d=0;d<f.length;d++){const p=fn(t,f[d]);if(p){const{transitionEnd:y,transition:g,...m}=p;for(const x in m){let v=m[x];if(Array.isArray(v)){const S=u?v.length-1:0;v=v[S]}v!==null&&(i[x]=v)}for(const x in y)i[x]=y[x]}}}return i}const So=t=>(e,n)=>{const s=T.useContext(ie),i=T.useContext(ee),r=()=>Ec(t,e,s,i);return n?r():Xe(r)},Lc=So({scrapeMotionValuesFromProps:wn,createRenderState:Sn}),kc=So({scrapeMotionValuesFromProps:so,createRenderState:Po}),Fc=Symbol.for("motionComponentSymbol");function Ic(t,e,n){const s=T.useRef(n);T.useInsertionEffect(()=>{s.current=n});const i=T.useRef(null);return T.useCallback(r=>{r&&t.onMount?.(r),e&&(r?e.mount(r):e.unmount());const o=s.current;if(typeof o=="function")if(r){const a=o(r);typeof a=="function"&&(i.current=a)}else i.current?(i.current(),i.current=null):o(r);else o&&(o.current=r)},[e])}const bo=T.createContext({});function ct(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function Bc(t,e,n,s,i,r){const{visualElement:o}=T.useContext(ie),a=T.useContext(vo),l=T.useContext(ee),c=T.useContext(Pn),u=c.reducedMotion,h=c.skipAnimations,f=T.useRef(null),d=T.useRef(!1);s=s||a.renderer,!f.current&&s&&(f.current=s(t,{visualState:e,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,skipAnimations:h,isSVG:r}),d.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const p=f.current,y=T.useContext(bo);p&&!p.projection&&i&&(p.type==="html"||p.type==="svg")&&jc(f.current,n,i,y);const g=T.useRef(!1);T.useInsertionEffect(()=>{p&&g.current&&p.update(n,l)});const m=n[Ri],x=T.useRef(!!m&&!window.MotionHandoffIsComplete?.(m)&&window.MotionHasOptimisedAnimation?.(m));return Hs(()=>{d.current=!0,p&&(g.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),x.current&&p.animationState&&p.animationState.animateChanges())}),T.useEffect(()=>{p&&(!x.current&&p.animationState&&p.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(m)}),x.current=!1),p.enteringChildren=void 0)}),p}function jc(t,e,n,s){const{layoutId:i,layout:r,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Ao(t.parent)),t.projection.setOptions({layoutId:i,layout:r,alwaysMeasureLayout:!!o||a&&ct(a),visualElement:t,animationType:typeof r=="string"?r:"both",initialPromotionConfig:s,crossfade:u,layoutScroll:l,layoutRoot:c})}function Ao(t){if(t)return t.options.allowProjection!==!1?t.projection:Ao(t.parent)}function ye(t,{forwardMotionProps:e=!1,type:n}={},s,i){s&&vc(s);const r=n?n==="svg":bn(t),o=r?kc:Lc;function a(c,u){let h;const f={...T.useContext(Pn),...c,layoutId:Oc(c)},{isStatic:d}=f,p=Sc(c),y=o(c,d);if(!d&&$s){Nc();const g=Uc(f);h=g.MeasureLayout,p.visualElement=Bc(t,y,f,i,g.ProjectionNode,r)}return q.jsxs(ie.Provider,{value:p,children:[h&&p.visualElement?q.jsx(h,{visualElement:p.visualElement,...f}):null,Dc(t,c,Ic(y,p.visualElement,u),y,d,e,r)]})}a.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const l=T.forwardRef(a);return l[Fc]=t,l}function Oc({layoutId:t}){const e=T.useContext(_e).id;return e&&t!==void 0?e+"-"+t:t}function Nc(t,e){T.useContext(vo).strict}function Uc(t){const e=To(),{drag:n,layout:s}=e;if(!n&&!s)return{};const i={...n,...s};return{MeasureLayout:n?.isEnabled(t)||s?.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function Wc(t,e){if(typeof Proxy>"u")return ye;const n=new Map,s=(r,o)=>ye(r,o,t,e),i=(r,o)=>s(r,o);return new Proxy(i,{get:(r,o)=>o==="create"?s:(n.has(o)||n.set(o,ye(o,void 0,t,e)),n.get(o))})}const Kc=(t,e)=>e.isSVG??bn(t)?new xl(e):new pl(e,{allowProjection:t!==T.Fragment});class $c extends et{constructor(e){super(e),e.animationState||(e.animationState=Al(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();ne(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Hc=0;class zc extends et{constructor(){super(...arguments),this.id=Hc++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;const i=this.node.animationState.setActive("exit",!e);n&&!e&&i.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Gc={animation:{Feature:$c},exit:{Feature:zc}};function It(t){return{point:{x:t.pageX,y:t.pageY}}}const _c=t=>e=>gn(e)&&t(e,It(e));function Vt(t,e,n,s){return Rt(t,e,_c(n),s)}const Vo=({current:t})=>t?t.ownerDocument.defaultView:null,ks=(t,e)=>Math.abs(t-e);function Xc(t,e){const n=ks(t.x,e.x),s=ks(t.y,e.y);return Math.sqrt(n**2+s**2)}const Fs=new Set(["auto","scroll"]);class Co{constructor(e,n,{transformPagePoint:s,contextWindow:i=window,dragSnapToOrigin:r=!1,distanceThreshold:o=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=d=>{this.handleScroll(d.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const d=Te(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,y=Xc(d.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!y)return;const{point:g}=d,{timestamp:m}=I;this.history.push({...g,timestamp:m});const{onStart:x,onMove:v}=this.handlers;p||(x&&x(this.lastMoveEvent,d),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,d)},this.handlePointerMove=(d,p)=>{this.lastMoveEvent=d,this.lastMoveEventInfo=ve(p,this.transformPagePoint),C.update(this.updatePoint,!0)},this.handlePointerUp=(d,p)=>{this.end();const{onEnd:y,onSessionEnd:g,resumeAnimation:m}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=Te(d.type==="pointercancel"?this.lastMoveEventInfo:ve(p,this.transformPagePoint),this.history);this.startEvent&&y&&y(d,x),g&&g(d,x)},!gn(e))return;this.dragSnapToOrigin=r,this.handlers=n,this.transformPagePoint=s,this.distanceThreshold=o,this.contextWindow=i||window;const l=It(e),c=ve(l,this.transformPagePoint),{point:u}=c,{timestamp:h}=I;this.history=[{...u,timestamp:h}];const{onSessionStart:f}=n;f&&f(e,Te(c,this.history)),this.removeListeners=Lt(Vt(this.contextWindow,"pointermove",this.handlePointerMove),Vt(this.contextWindow,"pointerup",this.handlePointerUp),Vt(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(e){let n=e.parentElement;for(;n;){const s=getComputedStyle(n);(Fs.has(s.overflowX)||Fs.has(s.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const s=e===window,i=s?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},r={x:i.x-n.x,y:i.y-n.y};r.x===0&&r.y===0||(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=r.x,this.lastMoveEventInfo.point.y+=r.y):this.history.length>0&&(this.history[0].x-=r.x,this.history[0].y-=r.y),this.scrollPositions.set(e,i),C.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),tt(this.updatePoint)}}function ve(t,e){return e?{point:e(t.point)}:t}function Is(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Te({point:t},e){return{point:t,delta:Is(t,Mo(e)),offset:Is(t,Yc(e)),velocity:qc(e,.1)}}function Yc(t){return t[0]}function Mo(t){return t[t.length-1]}function qc(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const i=Mo(t);for(;n>=0&&(s=t[n],!(i.timestamp-s.timestamp>H(e)));)n--;if(!s)return{x:0,y:0};s===t[0]&&t.length>2&&i.timestamp-s.timestamp>H(e)*2&&(s=t[1]);const r=U(i.timestamp-s.timestamp);if(r===0)return{x:0,y:0};const o={x:(i.x-s.x)/r,y:(i.y-s.y)/r};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Zc(t,{min:e,max:n},s){return e!==void 0&&t<e?t=s?M(e,t,s.min):Math.max(t,e):n!==void 0&&t>n&&(t=s?M(n,t,s.max):Math.min(t,n)),t}function Bs(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function Jc(t,{top:e,left:n,bottom:s,right:i}){return{x:Bs(t.x,n,i),y:Bs(t.y,e,s)}}function js(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,s]=[s,n]),{min:n,max:s}}function Qc(t,e){return{x:js(t.x,e.x),y:js(t.y,e.y)}}function tu(t,e){let n=.5;const s=O(t),i=O(e);return i>s?n=Ct(e.min,e.max-s,t.min):s>i&&(n=Ct(t.min,t.max-i,e.min)),Y(0,1,n)}function eu(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const ze=.35;function nu(t=ze){return t===!1?t=0:t===!0&&(t=ze),{x:Os(t,"left","right"),y:Os(t,"top","bottom")}}function Os(t,e,n){return{min:Ns(t,e),max:Ns(t,n)}}function Ns(t,e){return typeof t=="number"?t:t[e]||0}const su=new WeakMap;class iu{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=k(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:s}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const r=h=>{n&&this.snapToCursor(It(h).point),this.stopAnimation()},o=(h,f)=>{const{drag:d,dragPropagation:p,onDragStart:y}=this.getProps();if(d&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=ka(d),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=f,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),_(m=>{let x=this.getAxisMotionValue(m).get()||0;if(X.test(x)){const{projection:v}=this.visualElement;if(v&&v.layout){const S=v.layout.layoutBox[m];S&&(x=O(S)*(parseFloat(x)/100))}}this.originPoint[m]=x}),y&&C.update(()=>y(h,f),!1,!0),Be(this.visualElement,"transform");const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},a=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f;const{dragPropagation:d,dragDirectionLock:p,onDirectionLock:y,onDrag:g}=this.getProps();if(!d&&!this.openDragLock)return;const{offset:m}=f;if(p&&this.currentDirection===null){this.currentDirection=ru(m),this.currentDirection!==null&&y&&y(this.currentDirection);return}this.updateAxis("x",f.point,m),this.updateAxis("y",f.point,m),this.visualElement.render(),g&&C.update(()=>g(h,f),!1,!0)},l=(h,f)=>{this.latestPointerEvent=h,this.latestPanInfo=f,this.stop(h,f),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new Co(e,{onSessionStart:r,onStart:o,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:s,contextWindow:Vo(this.visualElement),element:this.visualElement.current})}stop(e,n){const s=e||this.latestPointerEvent,i=n||this.latestPanInfo,r=this.isDragging;if(this.cancel(),!r||!i||!s)return;const{velocity:o}=i;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&C.postRender(()=>a(s,i))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,s){const{drag:i}=this.getProps();if(!s||!Nt(e,i,this.currentDirection))return;const r=this.getAxisMotionValue(e);let o=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(o=Zc(o,this.constraints[e],this.elastic[e])),r.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;e&&ct(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=Jc(s.layoutBox,e):this.constraints=!1,this.elastic=nu(n),i!==this.constraints&&!ct(e)&&s&&this.constraints&&!this.hasMutatedConstraints&&_(r=>{this.constraints!==!1&&this.getAxisMotionValue(r)&&(this.constraints[r]=eu(s.layoutBox[r],this.constraints[r]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!ct(e))return!1;const s=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const r=ll(s,i.root,this.visualElement.getTransformPagePoint());let o=Qc(i.layout.layoutBox,r);if(n){const a=n(ol(o));this.hasMutatedConstraints=!!a,a&&(o=Xi(a))}return o}startAnimation(e){const{drag:n,dragMomentum:s,dragElastic:i,dragTransition:r,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=_(u=>{if(!Nt(u,n,this.currentDirection))return;let h=l&&l[u]||{};o&&(h={min:0,max:0});const f=i?200:1e6,d=i?40:1e7,p={type:"inertia",velocity:s?e[u]:0,bounceStiffness:f,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...r,...h};return this.startAxisValueAnimation(u,p)});return Promise.all(c).then(a)}startAxisValueAnimation(e,n){const s=this.getAxisMotionValue(e);return Be(this.visualElement,e),s.start(hn(e,s,0,n,this.visualElement,!1))}stopAnimation(){_(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps(),i=s[n];return i||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){_(n=>{const{drag:s}=this.getProps();if(!Nt(n,s,this.currentDirection))return;const{projection:i}=this.visualElement,r=this.getAxisMotionValue(n);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[n],l=r.get()||0;r.set(e[n]-M(o,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!ct(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};_(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();i[o]=tu({min:l,max:l},this.constraints[o])}});const{transformTemplate:r}=this.visualElement.getProps();this.visualElement.current.style.transform=r?r({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.constraints=!1,this.resolveConstraints(),_(o=>{if(!Nt(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(M(l,c,i[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;su.set(this.visualElement,this);const e=this.visualElement.current,n=Vt(e,"pointerdown",c=>{const{drag:u,dragListener:h=!0}=this.getProps(),f=c.target,d=f!==e&&Na(f);u&&h&&!d&&this.start(c)});let s;const i=()=>{const{dragConstraints:c}=this.getProps();ct(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),s||(s=ou(e,c.current,()=>this.scalePositionWithinConstraints())))},{projection:r}=this.visualElement,o=r.addEventListener("measure",i);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),C.read(i);const a=Rt(window,"resize",()=>this.scalePositionWithinConstraints()),l=r.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(_(h=>{const f=this.getAxisMotionValue(h);f&&(this.originPoint[h]+=c[h].translate,f.set(f.get()+c[h].translate))}),this.visualElement.render())}));return()=>{a(),n(),o(),l&&l(),s&&s()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:i=!1,dragConstraints:r=!1,dragElastic:o=ze,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:s,dragPropagation:i,dragConstraints:r,dragElastic:o,dragMomentum:a}}}function Us(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function ou(t,e,n){const s=_n(t,Us(n)),i=_n(e,Us(n));return()=>{s(),i()}}function Nt(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function ru(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class au extends et{constructor(e){super(e),this.removeGroupControls=W,this.removeListeners=W,this.controls=new iu(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||W}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const xe=t=>(e,n)=>{t&&C.update(()=>t(e,n),!1,!0)};class lu extends et{constructor(){super(...arguments),this.removePointerDownListener=W}onPointerDown(e){this.session=new Co(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Vo(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:s,onPanEnd:i}=this.node.getProps();return{onSessionStart:xe(e),onStart:xe(n),onMove:xe(s),onEnd:(r,o)=>{delete this.session,i&&C.postRender(()=>i(r,o))}}}mount(){this.removePointerDownListener=Vt(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let we=!1;class cu extends T.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s,layoutId:i}=this.props,{projection:r}=e;r&&(n.group&&n.group.add(r),s&&s.register&&i&&s.register(r),we&&r.root.didUpdate(),r.addEventListener("animationComplete",()=>{this.safeToRemove()}),r.setOptions({...r.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Gt.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:s,drag:i,isPresent:r}=this.props,{projection:o}=s;return o&&(o.isPresent=r,e.layoutDependency!==n&&o.setOptions({...o.options,layoutDependency:n}),we=!0,i||e.layoutDependency!==n||n===void 0||e.isPresent!==r?o.willUpdate():this.safeToRemove(),e.isPresent!==r&&(r?o.promote():o.relegate()||C.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),mn.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:i}=e;we=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),s&&s.deregister&&s.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Do(t){const[e,n]=yo(),s=T.useContext(_e);return q.jsx(cu,{...t,layoutGroup:s,switchLayoutGroup:T.useContext(bo),isPresent:e,safeToRemove:n})}const uu={pan:{Feature:lu},drag:{Feature:au,ProjectionNode:go,MeasureLayout:Do}};function Ws(t,e,n){const{props:s}=t;t.animationState&&s.whileHover&&t.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,r=s[i];r&&C.postRender(()=>r(e,It(e)))}class hu extends et{mount(){const{current:e}=this.node;e&&(this.unmount=Ia(e,(n,s)=>(Ws(this.node,s,"Start"),i=>Ws(this.node,i,"End"))))}unmount(){}}class fu extends et{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Lt(Rt(this.node.current,"focus",()=>this.onFocus()),Rt(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function Ks(t,e,n){const{props:s}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&s.whileTap&&t.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),r=s[i];r&&C.postRender(()=>r(e,It(e)))}class du extends et{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:s}=this.node.props;this.unmount=Wa(e,(i,r)=>(Ks(this.node,r,"Start"),(o,{success:a})=>Ks(this.node,o,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:s?.tap===!1})}unmount(){}}const Ge=new WeakMap,Pe=new WeakMap,pu=t=>{const e=Ge.get(t.target);e&&e(t)},mu=t=>{t.forEach(pu)};function gu({root:t,...e}){const n=t||document;Pe.has(n)||Pe.set(n,{});const s=Pe.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(mu,{root:t,...e})),s[i]}function yu(t,e,n){const s=gu(e);return Ge.set(t,n),s.observe(t),()=>{Ge.delete(t),s.unobserve(t)}}const vu={some:0,all:1};class Tu extends et{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:r}=e,o={root:n?n.current:void 0,rootMargin:s,threshold:typeof i=="number"?i:vu[i]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,r&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:h}=this.node.getProps(),f=c?u:h;f&&f(l)};return yu(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(xu(e,n))&&this.startObserver()}unmount(){}}function xu({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const wu={inView:{Feature:Tu},tap:{Feature:du},focus:{Feature:fu},hover:{Feature:hu}},Pu={layout:{ProjectionNode:go,MeasureLayout:Do}},Su={...Gc,...wu,...uu,...Pu},Mu=Wc(Su,Kc);export{Cu as A,Mu as m};
@@ -1 +1 @@
1
- import{a}from"./main-CQKtcNr3.js";const S=t=>{let e;const n=new Set,o=(s,r)=>{const c=typeof s=="function"?s(e):s;if(!Object.is(c,e)){const g=e;e=r??(typeof c!="object"||c===null)?c:Object.assign({},e,c),n.forEach(f=>f(e,g))}},u=()=>e,i={setState:o,getState:u,getInitialState:()=>l,subscribe:s=>(n.add(s),()=>n.delete(s))},l=e=t(o,u,i);return i},d=(t=>t?S(t):S),I=t=>t;function j(t,e=I){const n=a.useSyncExternalStore(t.subscribe,a.useCallback(()=>e(t.getState()),[t,e]),a.useCallback(()=>e(t.getInitialState()),[t,e]));return a.useDebugValue(n),n}const b=t=>{const e=d(t),n=o=>j(e,o);return Object.assign(n,e),n},O=(t=>t?b(t):b);export{O as c};
1
+ import{a}from"./main-ZBMVSJTF.js";const S=t=>{let e;const n=new Set,o=(s,r)=>{const c=typeof s=="function"?s(e):s;if(!Object.is(c,e)){const g=e;e=r??(typeof c!="object"||c===null)?c:Object.assign({},e,c),n.forEach(f=>f(e,g))}},u=()=>e,i={setState:o,getState:u,getInitialState:()=>l,subscribe:s=>(n.add(s),()=>n.delete(s))},l=e=t(o,u,i);return i},d=(t=>t?S(t):S),I=t=>t;function j(t,e=I){const n=a.useSyncExternalStore(t.subscribe,a.useCallback(()=>e(t.getState()),[t,e]),a.useCallback(()=>e(t.getInitialState()),[t,e]));return a.useDebugValue(n),n}const b=t=>{const e=d(t),n=o=>j(e,o);return Object.assign(n,e),n},O=(t=>t?b(t):b);export{O as c};
@@ -0,0 +1 @@
1
+ import{u as H,r as o,d as O,j as t}from"./main-ZBMVSJTF.js";import{H as A,A as _,V as $,p as B,c as Q}from"./button-DqP4GZwZ.js";import{D as P,a as U}from"./use-file-explorer-state-Dfyh4GwR.js";import{c as M}from"./_sessionKey-DYknvaDS.js";import"./useOnFirstRender-DsFYFJoB.js";import"./useBaseUiId-DLhdkHJl.js";import"./event-2_Dxdv7h.js";import"./visuallyHidden-COI6QeQH.js";import"./composite-BLgu_EOL.js";import"./react-Akh4y69S.js";import"./useQuery-DMTgpIql.js";import"./tooltip-CekkGEYG.js";import"./DirectionContext-CQMv7g2N.js";import"./useMutation-CpD2Pn0F.js";import"./useControlled-CpliTEve.js";import"./CSPContext-TfUptlEu.js";import"./menu-CB88T7R1.js";import"./useCompositeItem-DTSTTR0Z.js";import"./opencami-logo-C0Kj1DiT.js";import"./proxy-D-juuhw6.js";import"./markdown-CHUjmWcv.js";import"./index-C_gsW9fo.js";import"./index-T4TOjvD0.js";function V(e){return Array.isArray(e)?e.map(s=>s?.type==="text"&&typeof s.text=="string"?s.text:"").filter(Boolean).join(" "):""}function K(e){const s=V(e.content);return s||(typeof e.text=="string"?e.text:"")}function G({sessions:e,currentFriendlyId:s,currentSessionKey:y}){const g=H(),[u,i]=o.useState(""),[h,f]=o.useState(!1),[b,l]=o.useState([]),c=o.useRef(null);o.useEffect(()=>()=>{c.current?.abort(),c.current=null},[]);const j=o.useCallback(v=>{if(!v.trim()||!s||!y)return[];const I=M.history(s,y),w=g.getQueryData(I);if(!w?.messages)return[];const k=v.toLowerCase(),p=[],S=e.find(x=>x.friendlyId===s),n=S?.label||S?.title||S?.derivedTitle||s;return w.messages.forEach((x,R)=>{const a=K(x);if(!a)return;const m=a.toLowerCase().indexOf(k);m!==-1&&p.push({sessionKey:y,friendlyId:s,sessionTitle:n,messageIndex:R,messageId:typeof x.id=="string"?x.id:void 0,messageRole:x.role||"unknown",messageText:a,matchStart:m,matchEnd:m+v.length,timestamp:x.timestamp})}),p},[s,y,g,e]),d=o.useCallback(async v=>{const I=v.trim();if(!I)return c.current?.abort(),c.current=null,l([]),[];c.current?.abort();const w=new AbortController;c.current=w,f(!0),l([]);const k=I.toLowerCase(),p=[],S=10;try{for(let n=0;n<e.length;n+=S){if(w.signal.aborted)throw new DOMException("Search aborted","AbortError");const x=e.slice(n,n+S),R=await Promise.allSettled(x.map(async a=>{const r=M.history(a.friendlyId,a.key);let m=g.getQueryData(r);if(!m){const N=new URLSearchParams({sessionKey:a.key,friendlyId:a.friendlyId,limit:"200"}),T=await fetch(`/api/history?${N.toString()}`,{signal:w.signal});T.ok&&(m=await T.json(),g.setQueryData(r,m))}if(!m?.messages)return[];const z=a.label||a.title||a.derivedTitle||a.friendlyId,L=[];return m.messages.forEach((N,T)=>{const C=K(N);if(!C)return;const D=C.toLowerCase().indexOf(k);D!==-1&&L.push({sessionKey:a.key,friendlyId:a.friendlyId,sessionTitle:z,messageIndex:T,messageId:typeof N.id=="string"?N.id:void 0,messageRole:N.role||"unknown",messageText:C,matchStart:D,matchEnd:D+I.length,timestamp:N.timestamp})}),L}));for(const a of R)a.status==="fulfilled"&&p.push(...a.value);p.sort((a,r)=>(r.timestamp||0)-(a.timestamp||0)),l([...p])}return p}catch(n){if(!(n instanceof DOMException&&n.name==="AbortError"))throw n;return[]}finally{c.current===w&&(c.current=null,f(!1))}},[e,g]),E=o.useCallback(()=>{c.current?.abort(),c.current=null,f(!1),i(""),l([])},[]);return{query:u,setQuery:i,isSearching:h,globalResults:b,searchCurrentConversation:j,searchAllSessions:d,clearSearch:E}}function Y(e,s){if(!s.trim())return null;const y=e.toLowerCase(),g=s.toLowerCase(),u=y.indexOf(g);if(u===-1)return null;const i=40,h=80;let f=Math.max(0,u-i),b=Math.min(e.length,u+s.length+h);if(f>0){const d=e.indexOf(" ",f);d!==-1&&d<u&&(f=d+1)}if(b<e.length){const d=e.lastIndexOf(" ",b);d>u+s.length&&(b=d)}const l=(f>0?"...":"")+e.slice(f,u),c=e.slice(u,u+s.length),j=e.slice(u+s.length,b)+(b<e.length?"...":"");return{before:l,match:c,after:j}}const Z="opencami-search-jump-target";function we({open:e,onOpenChange:s,sessions:y,currentFriendlyId:g,currentSessionKey:u,mode:i,onJumpToMessage:h}){const f=O(),b=o.useRef(null),[l,c]=o.useState(""),[j,d]=o.useState(0),E=o.useRef(null),{isSearching:v,globalResults:I,searchCurrentConversation:w,searchAllSessions:k,clearSearch:p}=G({sessions:y,currentFriendlyId:g,currentSessionKey:u}),S=o.useMemo(()=>i!=="current"?[]:w(l),[i,l,w]),n=i==="global"?I:S;o.useEffect(()=>{if(i!=="global")return;if(!l.trim()){p();return}const r=setTimeout(()=>{k(l)},300);return()=>clearTimeout(r)},[l,i,k,p]),o.useEffect(()=>{if(!e){p();return}c(""),d(0),p(),setTimeout(()=>{b.current?.focus()},50)},[e,p]),o.useEffect(()=>{d(0)},[n]),o.useEffect(()=>{if(!E.current)return;const r=E.current.querySelector('[data-selected="true"]');r&&r.scrollIntoView({block:"nearest"})},[j]);const x=o.useCallback(r=>{if(s(!1),i==="current"&&h)h(r);else{if(r.messageId&&typeof window<"u")try{sessionStorage.setItem(Z,JSON.stringify({friendlyId:r.friendlyId,messageId:r.messageId,at:Date.now()}))}catch{}f({to:"/chat/$sessionKey",params:{sessionKey:r.friendlyId}})}},[i,f,h,s]),R=o.useCallback(r=>{switch(r.key){case"ArrowDown":r.preventDefault(),d(m=>Math.min(m+1,n.length-1));break;case"ArrowUp":r.preventDefault(),d(m=>Math.max(m-1,0));break;case"Enter":r.preventDefault(),n[j]&&x(n[j]);break;case"Escape":r.preventDefault(),s(!1);break}},[n,j,x,s]),a=i==="global"?"Search across all conversations...":"Search in this conversation...";return t.jsx(P,{open:e,onOpenChange:s,children:t.jsxs(U,{className:"w-[min(600px,92vw)] max-h-[80vh] flex flex-col overflow-hidden",children:[t.jsxs("div",{className:"flex items-center gap-3 p-4 border-b border-primary-200",children:[t.jsx(A,{icon:_,size:20,className:"text-primary-500 shrink-0"}),t.jsx("input",{ref:b,type:"text",value:l,onChange:r=>c(r.target.value),onKeyDown:R,placeholder:a,className:"flex-1 bg-transparent text-primary-900 placeholder:text-primary-400 outline-none text-base"}),l&&t.jsx("button",{type:"button",onClick:()=>{c(""),p()},className:"p-1 hover:bg-primary-200 rounded transition-colors",children:t.jsx(A,{icon:$,size:16,className:"text-primary-500"})}),v&&t.jsx(A,{icon:B,size:20,className:"text-primary-500 animate-spin"})]}),t.jsx("div",{ref:E,className:"flex-1 overflow-y-auto p-2 min-h-0",children:l.trim()?n.length===0&&!v?t.jsxs("div",{className:"text-center text-primary-500 py-8 text-sm",children:['No results found for "',l,'"']}):t.jsx("div",{className:"flex flex-col gap-1",children:n.map((r,m)=>t.jsx(J,{result:r,query:l,isSelected:m===j,showSessionTitle:i==="global",onClick:()=>x(r),onMouseEnter:()=>d(m)},`${r.friendlyId}-${r.messageIndex}`))}):t.jsx("div",{className:"text-center text-primary-500 py-8 text-sm",children:i==="global"?"Type to search across all your conversations":"Type to search within this conversation"})}),t.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-t border-primary-200 text-xs text-primary-500",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("kbd",{className:"px-1.5 py-0.5 bg-primary-100 rounded text-[10px]",children:"↑"}),t.jsx("kbd",{className:"px-1.5 py-0.5 bg-primary-100 rounded text-[10px]",children:"↓"}),"to navigate"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("kbd",{className:"px-1.5 py-0.5 bg-primary-100 rounded text-[10px]",children:"Enter"}),"to select"]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx("kbd",{className:"px-1.5 py-0.5 bg-primary-100 rounded text-[10px]",children:"Esc"}),"to close"]})]}),n.length>0&&t.jsxs("span",{children:[n.length," result",n.length!==1?"s":""]})]})]})})}function J({result:e,query:s,isSelected:y,showSessionTitle:g,onClick:u,onMouseEnter:i}){const h=Y(e.messageText,s),f=e.messageRole==="assistant"?"Assistant":"You";return t.jsxs("button",{type:"button",onClick:u,onMouseEnter:i,"data-selected":y,className:Q("w-full text-left px-3 py-2 rounded-lg transition-colors",y?"bg-primary-200":"hover:bg-primary-100"),children:[g&&t.jsx("div",{className:"text-xs font-medium text-primary-600 mb-1 truncate",children:e.sessionTitle}),t.jsx("div",{className:"flex items-center gap-2 mb-0.5",children:t.jsx("span",{className:Q("text-[10px] font-medium px-1.5 py-0.5 rounded",e.messageRole==="assistant"?"bg-blue-100 text-blue-700":"bg-green-100 text-green-700"),children:f})}),h&&t.jsxs("div",{className:"text-sm text-primary-700 line-clamp-2",children:[t.jsx("span",{children:h.before}),t.jsx("mark",{className:"bg-yellow-200 text-primary-900 rounded px-0.5",children:h.match}),t.jsx("span",{children:h.after})]})]})}export{we as SearchDialog};
@@ -1 +1 @@
1
- import{r as x,j as e}from"./main-CQKtcNr3.js";import{H as c,A as p,l as h,c as i}from"./button-8ab4wOwy.js";function o(t){try{return new URL(t).hostname.replace("www.","")}catch{return t}}function d({domain:t}){return e.jsx("div",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-white dark:bg-zinc-800 border border-cyan-500/20 overflow-hidden",title:t,children:e.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${t}&sz=32`,alt:"",className:"w-4 h-4 object-contain",loading:"lazy",onError:r=>{const a=r.target;a.style.display="none";const s=a.parentElement;s&&(s.textContent=t.charAt(0).toUpperCase(),s.classList.add("text-[10px]","font-medium","text-cyan-400"))}})})}function g({sources:t}){const[r,a]=x.useState(!1);if(!t.length)return null;const s=[...new Set(t.map(n=>o(n.url)))];return e.jsxs("div",{className:"mt-2 w-full",children:[e.jsxs("button",{onClick:()=>a(!r),className:i("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs","bg-cyan-500/10 hover:bg-cyan-500/20 border border-cyan-500/30","text-cyan-300 transition-colors"),children:[e.jsx(c,{icon:p,size:14}),e.jsx("span",{className:"font-medium",children:"Sources"}),e.jsx("span",{className:"px-1.5 py-0.5 rounded-full bg-cyan-500/20 text-cyan-400 font-semibold",children:t.length}),e.jsxs("div",{className:"flex items-center gap-0.5 ml-1",children:[s.slice(0,3).map(n=>e.jsx(d,{domain:n},n)),s.length>3&&e.jsxs("span",{className:"text-cyan-500/70 text-[10px] ml-0.5",children:["+",s.length-3]})]}),e.jsx(c,{icon:h,size:12,className:i("transition-transform",r&&"rotate-90")})]}),r&&e.jsx("div",{className:"mt-2 rounded-lg border border-cyan-500/20 bg-cyan-500/5 max-h-80 overflow-y-auto",children:t.map((n,m)=>{const l=o(n.url);return e.jsxs("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-start gap-2 p-2.5 border-b border-cyan-500/10 last:border-b-0 hover:bg-cyan-500/5 transition-colors",children:[e.jsx(d,{domain:l}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-primary-900 hover:underline line-clamp-1",children:n.title||l}),e.jsx("div",{className:"text-xs text-muted-foreground",children:l}),n.snippet&&e.jsx("p",{className:"text-xs text-muted-foreground/80 line-clamp-2 mt-0.5",children:n.snippet})]})]},`${n.url}-${m}`)})})]})}export{g as SearchSourcesBadge};
1
+ import{r as x,j as e}from"./main-ZBMVSJTF.js";import{H as c,A as p,l as h,c as i}from"./button-DqP4GZwZ.js";function o(t){try{return new URL(t).hostname.replace("www.","")}catch{return t}}function d({domain:t}){return e.jsx("div",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-white dark:bg-zinc-800 border border-cyan-500/20 overflow-hidden",title:t,children:e.jsx("img",{src:`https://www.google.com/s2/favicons?domain=${t}&sz=32`,alt:"",className:"w-4 h-4 object-contain",loading:"lazy",onError:r=>{const a=r.target;a.style.display="none";const s=a.parentElement;s&&(s.textContent=t.charAt(0).toUpperCase(),s.classList.add("text-[10px]","font-medium","text-cyan-400"))}})})}function g({sources:t}){const[r,a]=x.useState(!1);if(!t.length)return null;const s=[...new Set(t.map(n=>o(n.url)))];return e.jsxs("div",{className:"mt-2 w-full",children:[e.jsxs("button",{onClick:()=>a(!r),className:i("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs","bg-cyan-500/10 hover:bg-cyan-500/20 border border-cyan-500/30","text-cyan-300 transition-colors"),children:[e.jsx(c,{icon:p,size:14}),e.jsx("span",{className:"font-medium",children:"Sources"}),e.jsx("span",{className:"px-1.5 py-0.5 rounded-full bg-cyan-500/20 text-cyan-400 font-semibold",children:t.length}),e.jsxs("div",{className:"flex items-center gap-0.5 ml-1",children:[s.slice(0,3).map(n=>e.jsx(d,{domain:n},n)),s.length>3&&e.jsxs("span",{className:"text-cyan-500/70 text-[10px] ml-0.5",children:["+",s.length-3]})]}),e.jsx(c,{icon:h,size:12,className:i("transition-transform",r&&"rotate-90")})]}),r&&e.jsx("div",{className:"mt-2 rounded-lg border border-cyan-500/20 bg-cyan-500/5 max-h-80 overflow-y-auto",children:t.map((n,m)=>{const l=o(n.url);return e.jsxs("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-start gap-2 p-2.5 border-b border-cyan-500/10 last:border-b-0 hover:bg-cyan-500/5 transition-colors",children:[e.jsx(d,{domain:l}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-primary-900 hover:underline line-clamp-1",children:n.title||l}),e.jsx("div",{className:"text-xs text-muted-foreground",children:l}),n.snippet&&e.jsx("p",{className:"text-xs text-muted-foreground/80 line-clamp-2 mt-0.5",children:n.snippet})]})]},`${n.url}-${m}`)})})]})}export{g as SearchSourcesBadge};
@@ -0,0 +1 @@
1
+ import{r as d,j as e}from"./main-ZBMVSJTF.js";import{D as x,a as p,b as h,c as u,d as j}from"./use-file-explorer-state-Dfyh4GwR.js";import{B as v}from"./button-DqP4GZwZ.js";import"./useOnFirstRender-DsFYFJoB.js";import"./useBaseUiId-DLhdkHJl.js";import"./event-2_Dxdv7h.js";import"./visuallyHidden-COI6QeQH.js";import"./composite-BLgu_EOL.js";import"./react-Akh4y69S.js";const f=[{value:"markdown",label:"Markdown (.md)",description:"Nicely formatted with headers and sections"},{value:"json",label:"JSON (.json)",description:"Full data with metadata"},{value:"txt",label:"Plain Text (.txt)",description:"Simple text format"}];function S({open:t,onOpenChange:s,sessionTitle:i,onExport:l,onCancel:o}){const[r,n]=d.useState("markdown"),m=()=>{l(r)};return e.jsx(x,{open:t,onOpenChange:s,children:e.jsx(p,{children:e.jsxs("div",{className:"p-4",children:[e.jsx(h,{className:"mb-1",children:"Export Conversation"}),e.jsxs(u,{className:"mb-4",children:['Export "',i,'" in your preferred format']}),e.jsx("div",{className:"space-y-2 mb-4",children:f.map(a=>e.jsxs("label",{className:"flex items-start gap-3 p-3 rounded-lg border border-primary-200 cursor-pointer hover:bg-primary-100 transition-colors",children:[e.jsx("input",{type:"radio",name:"export-format",value:a.value,checked:r===a.value,onChange:c=>n(c.target.value),className:"mt-1"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm text-primary-900",children:a.label}),e.jsx("div",{className:"text-xs text-primary-600",children:a.description})]})]},a.value))}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(j,{onClick:o,children:"Cancel"}),e.jsx(v,{onClick:m,children:"Export"})]})]})})})}export{S as SessionExportDialog};
@@ -0,0 +1 @@
1
+ import{r as o,j as t}from"./main-ZBMVSJTF.js";import{c as Fe}from"./react-Akh4y69S.js";import{B as O,H as C,V as Ke,z as ze,f as Be,P as Re,S as Me,g as De,R as _e,s as Ue,j as Ye,c as L,o as Ge,v as He,k as qe,m as Je,n as Xe,h as $e,J as Y,t as Qe}from"./button-DqP4GZwZ.js";import{D as Ze,a as et,b as tt,c as at,d as G}from"./use-file-explorer-state-Dfyh4GwR.js";import{S as m}from"./switch-DYEbEgy5.js";import{T as y,a as v,b as j}from"./tabs-eiBvL0H7.js";import{u as rt}from"./index-C_gsW9fo.js";import{u as st,g as H}from"./_sessionKey-DYknvaDS.js";import"./useOnFirstRender-DsFYFJoB.js";import"./useBaseUiId-DLhdkHJl.js";import"./event-2_Dxdv7h.js";import"./visuallyHidden-COI6QeQH.js";import"./composite-BLgu_EOL.js";import"./useControlled-CpliTEve.js";import"./useCompositeItem-DTSTTR0Z.js";import"./DirectionContext-CQMv7g2N.js";import"./CSPContext-TfUptlEu.js";import"./useQuery-DMTgpIql.js";import"./tooltip-CekkGEYG.js";import"./useMutation-CpD2Pn0F.js";import"./menu-CB88T7R1.js";import"./opencami-logo-C0Kj1DiT.js";import"./proxy-D-juuhw6.js";import"./markdown-CHUjmWcv.js";import"./index-T4TOjvD0.js";function lt(){if(typeof window>"u")return!1;try{return window.localStorage.getItem("feature_artifacts")==="true"}catch{return!1}}const nt=Fe()(n=>({isEnabled:lt(),isPanelOpen:!1,content:"",type:null,setArtifact:function(h,a){n({content:h,type:a,isPanelOpen:!0})},clearArtifact:function(){n({content:"",type:null})},openPanel:function(){n({isPanelOpen:!0})},closePanel:function(){n({isPanelOpen:!1})},setEnabled:function(h){if(typeof window<"u")try{window.localStorage.setItem("feature_artifacts",String(h))}catch{}n({isEnabled:h})}}));function x({title:n,tabId:l,activeTab:h,children:a}){const c=l&&h&&l!==h;return t.jsxs("div",{className:L("border-b border-primary-200 py-2 last:border-0",c&&"md:hidden"),children:[t.jsx("h3",{className:"mb-1.5 text-sm font-semibold text-primary-700",children:n}),t.jsx("div",{className:"space-y-1.5",children:a})]})}function s({label:n,description:l,inline:h,children:a}){return h?t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex-1 select-none",children:[t.jsx("div",{className:"text-[13px] font-medium text-primary-800",children:n}),l&&t.jsx("div",{className:"text-xs text-primary-500",children:l})]}),t.jsx("div",{className:"flex items-center gap-2",children:a})]}):t.jsxs("div",{className:"space-y-1",children:[t.jsxs("div",{className:"select-none",children:[t.jsx("div",{className:"text-[13px] font-medium text-primary-800",children:n}),l&&t.jsx("div",{className:"text-xs text-primary-500",children:l})]}),t.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:a})]})}const te=[{value:"14px",label:"S"},{value:"16px",label:"M"},{value:"18px",label:"L"},{value:"20px",label:"XL"}],W=[{value:"system",label:"System",cssValue:'-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',previewClass:"font-sans"},{value:"inter",label:"Inter",cssValue:'"Inter", sans-serif',previewClass:'font-["Inter",sans-serif]'},{value:"roboto",label:"Roboto",cssValue:'"Roboto", sans-serif',previewClass:'font-["Roboto",sans-serif]'}],ae=[{value:"compact",label:"Compact"},{value:"comfortable",label:"Comfortable"},{value:"spacious",label:"Spacious"}],F=[{value:"green",label:"Green",accent:"#22c55e",hover:"#16a34a",light:"rgba(34, 197, 94, 0.10)",fg:"#ffffff"},{value:"blue",label:"Blue",accent:"#3b82f6",hover:"#2563eb",light:"rgba(59, 130, 246, 0.10)",fg:"#ffffff"},{value:"purple",label:"Purple",accent:"#8b5cf6",hover:"#7c3aed",light:"rgba(139, 92, 246, 0.10)",fg:"#ffffff"},{value:"orange",label:"Orange",accent:"#f97316",hover:"#ea580c",light:"rgba(249, 115, 22, 0.10)",fg:"#ffffff"},{value:"pink",label:"Pink",accent:"#ec4899",hover:"#db2777",light:"rgba(236, 72, 153, 0.10)",fg:"#ffffff"},{value:"red",label:"Red",accent:"#ef4444",hover:"#dc2626",light:"rgba(239, 68, 68, 0.10)",fg:"#ffffff"},{value:"cyan",label:"Cyan",accent:"#06b6d4",hover:"#0891b2",light:"rgba(6, 182, 212, 0.10)",fg:"#ffffff"},{value:"yellow",label:"Yellow",accent:"#eab308",hover:"#ca8a04",light:"rgba(234, 179, 8, 0.10)",fg:"#ffffff"},{value:"white",label:"White",accent:"#ffffff",hover:"#e5e5e5",light:"rgba(255, 255, 255, 0.10)",fg:"#1a1a1a"}],K=[{value:"narrow",label:"Narrow",cssValue:"640px"},{value:"medium",label:"Medium",cssValue:"800px"},{value:"wide",label:"Wide",cssValue:"1000px"},{value:"full",label:"Full",cssValue:"100%"}],z=[{value:"compact",label:"Compact",cssValue:"200px"},{value:"normal",label:"Normal",cssValue:"260px"},{value:"wide",label:"Wide",cssValue:"320px"},{value:"xl",label:"XL",cssValue:"400px"}],re=[{value:"default",label:"Default"},{value:"bubbles",label:"Bubbles"},{value:"minimal",label:"Minimal"}];function q(n){return te.some(l=>l.value===n)}function J(n){return W.some(l=>l.value===n)}function X(n){return ae.some(l=>l.value===n)}function $(n){return F.some(l=>l.value===n)}function Q(n){return K.some(l=>l.value===n)}function Z(n){return z.some(l=>l.value===n)}function ee(n){return re.some(l=>l.value===n)}function Vt({open:n,onOpenChange:l,onClose:h}){const{settings:a,updateSettings:c}=rt(),{settings:u,updateSettings:b,status:w,testApiKey:se}=st(),[p,le]=o.useState("appearance"),[g,R]=o.useState(u.llmApiKey),[M,D]=o.useState(!1),[S,k]=o.useState(null),[ne,ie]=o.useState(()=>{if(typeof window>"u")return"16px";try{const e=localStorage.getItem("opencami-text-size");if(e&&q(e))return e}catch{}return"16px"}),[oe,ce]=o.useState(()=>{if(typeof window>"u")return!0;try{const e=localStorage.getItem("opencami-tts-enabled");return e===null?!0:e==="true"}catch{return!0}}),[_,de]=o.useState(()=>{if(typeof window>"u")return"auto";try{return localStorage.getItem("opencami-tts-provider")||"auto"}catch{return"auto"}}),[ue,me]=o.useState(()=>{if(typeof window>"u")return"nova";try{return localStorage.getItem("opencami-tts-voice")||"nova"}catch{return"nova"}}),[he,pe]=o.useState(()=>{if(typeof window>"u")return"auto";try{return localStorage.getItem("opencami-stt-provider")||"auto"}catch{return"auto"}});o.useEffect(()=>{if(!(typeof window>"u"))try{const e=localStorage.getItem("opencami-font-family");e&&J(e)?(I(e),a.fontFamily!==e&&c({fontFamily:e})):I(a.fontFamily);const r=localStorage.getItem("opencami-density");r&&X(r)?(N(r),a.density!==r&&c({density:r})):N(a.density);const i=localStorage.getItem("opencami-accent-color");i&&$(i)?(P(i),a.accentColor!==i&&c({accentColor:i})):P(a.accentColor);const d=localStorage.getItem("opencami-chat-width");d&&Q(d)?(A(d),a.chatWidth!==d&&c({chatWidth:d})):A(a.chatWidth);const f=localStorage.getItem("opencami-sidebar-width");f&&Z(f)?(E(f),a.sidebarWidth!==f&&c({sidebarWidth:f})):E(a.sidebarWidth);const V=localStorage.getItem("opencami-bubble-style");V&&ee(V)?(T(V),a.bubbleStyle!==V&&c({bubbleStyle:V})):T(a.bubbleStyle)}catch{I(a.fontFamily),N(a.density),P(a.accentColor),A(a.chatWidth),E(a.sidebarWidth),T(a.bubbleStyle)}},[]),o.useEffect(()=>{I(a.fontFamily)},[a.fontFamily]),o.useEffect(()=>{N(a.density)},[a.density]),o.useEffect(()=>{P(a.accentColor)},[a.accentColor]),o.useEffect(()=>{A(a.chatWidth)},[a.chatWidth]),o.useEffect(()=>{E(a.sidebarWidth)},[a.sidebarWidth]),o.useEffect(()=>{T(a.bubbleStyle)},[a.bubbleStyle]);const fe=e=>{de(e);try{localStorage.setItem("opencami-tts-provider",e)}catch{}},xe=e=>{me(e);try{localStorage.setItem("opencami-tts-voice",e)}catch{}},be=e=>{pe(e);try{localStorage.setItem("opencami-stt-provider",e)}catch{}};function ge(e){typeof document>"u"||document.documentElement.style.setProperty("--opencami-text-size",e)}function I(e){if(typeof document>"u")return;const i=W.find(d=>d.value===e)?.cssValue??W[0].cssValue;document.documentElement.style.setProperty("--opencami-font-family",i)}function N(e){if(typeof document>"u")return;const r=document.documentElement;if(r.style.setProperty("--opencami-density",e),e==="compact"){r.style.setProperty("--opencami-msg-padding-y","0.25rem"),r.style.setProperty("--opencami-msg-gap","0.25rem"),r.style.setProperty("--opencami-user-bubble-py","0.4rem");return}if(e==="spacious"){r.style.setProperty("--opencami-msg-padding-y","1.25rem"),r.style.setProperty("--opencami-msg-gap","1rem"),r.style.setProperty("--opencami-user-bubble-py","1rem");return}r.style.setProperty("--opencami-msg-padding-y","0.75rem"),r.style.setProperty("--opencami-msg-gap","0.5rem"),r.style.setProperty("--opencami-user-bubble-py","0.625rem")}function P(e){if(typeof document>"u")return;const r=F.find(d=>d.value===e)??F[0],i=document.documentElement;i.style.setProperty("--opencami-accent",r.accent),i.style.setProperty("--opencami-accent-hover",r.hover),i.style.setProperty("--opencami-accent-light",r.light),i.style.setProperty("--opencami-accent-fg",r.fg)}function A(e){if(typeof document>"u")return;const r=K.find(i=>i.value===e)??K[2];document.documentElement.style.setProperty("--opencami-chat-width",r.cssValue)}function E(e){if(typeof document>"u")return;const r=z.find(i=>i.value===e)??z[1];document.documentElement.style.setProperty("--opencami-sidebar-width",r.cssValue)}function T(e){typeof document>"u"||document.documentElement.setAttribute("data-opencami-bubble-style",e)}const ye=e=>{if(q(e)){ie(e),ge(e);try{localStorage.setItem("opencami-text-size",e)}catch{}}},ve=e=>{if(J(e)){I(e),c({fontFamily:e});try{localStorage.setItem("opencami-font-family",e)}catch{}}},je=e=>{if(X(e)){N(e),c({density:e});try{localStorage.setItem("opencami-density",e)}catch{}}},we=e=>{if($(e)){P(e),c({accentColor:e});try{localStorage.setItem("opencami-accent-color",e)}catch{}}},Se=e=>{if(Q(e)){A(e),c({chatWidth:e});try{localStorage.setItem("opencami-chat-width",e)}catch{}}},Ce=e=>{if(Z(e)){E(e),c({sidebarWidth:e});try{localStorage.setItem("opencami-sidebar-width",e)}catch{}}},ke=e=>{if(ee(e)){T(e),c({bubbleStyle:e});try{localStorage.setItem("opencami-bubble-style",e)}catch{}}},Ie=e=>{ce(e);try{localStorage.setItem("opencami-tts-enabled",String(e))}catch{}window.dispatchEvent(new StorageEvent("storage",{key:"opencami-tts-enabled",newValue:String(e)}))},[U,Ne]=o.useState(!1),B=o.useRef(null),[Pe,Ae]=o.useState(()=>{if(typeof window>"u")return!0;try{const e=localStorage.getItem("opencami-personas-enabled");return e===null?!0:e==="true"}catch{return!0}});o.useEffect(()=>{let e=!0;async function r(){B.current?.abort();const i=new AbortController;B.current=i;try{const d=await fetch("/api/personas",{signal:i.signal});if(!d.ok)return;const f=await d.json();e&&f.ok&&Ne(f.available)}catch(d){if(d instanceof Error&&d.name==="AbortError")return}}return r(),()=>{e=!1,B.current?.abort()}},[]);const Ee=e=>{Ae(e);try{localStorage.setItem("opencami-personas-enabled",String(e))}catch{}window.dispatchEvent(new StorageEvent("storage",{key:"opencami-personas-enabled",newValue:String(e)}))},Te=async()=>{if(g.trim()){D(!0),k(null);try{const e=await se(g.trim());k(e),e.valid&&b({llmApiKey:g.trim()})}finally{D(!1)}}},Ve=()=>{b({llmApiKey:g.trim()}),k(null)},Oe=()=>{R(""),b({llmApiKey:""}),k(null)},Le=[{value:"system",label:"Auto",icon:Ge},{value:"light",label:"Light",icon:He},{value:"dark",label:"Dark",icon:qe},{value:"chameleon",label:"Cham",icon:Je},{value:"frost-light",label:"Ice",icon:Xe}];function We(e){if(typeof document>"u")return;const r=document.documentElement,i=window.matchMedia("(prefers-color-scheme: dark)");r.classList.remove("light","dark","system","chameleon","frost","frost-light","frost-dark"),r.style.colorScheme="",r.classList.add(e);const d=e==="frost-light",f=e==="frost-dark";(d||f)&&r.classList.add("frost"),f&&r.classList.add("dark"),e==="system"&&i.matches&&r.classList.add("dark"),d&&(r.classList.remove("dark"),r.style.colorScheme="light")}return t.jsx(Ze,{open:n,onOpenChange:l,children:t.jsx(et,{className:"w-[min(680px,92vw)] max-h-[85vh] overflow-y-auto",children:t.jsxs("div",{className:"p-3",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsxs("div",{children:[t.jsx(tt,{className:"mb-1",children:"Settings"}),t.jsx(at,{className:"hidden",children:"Configure OpenCami"})]}),t.jsx(G,{render:t.jsx(O,{size:"icon-sm",variant:"ghost",className:"text-primary-500 hover:bg-primary-100 hover:text-primary-700","aria-label":"Close",children:t.jsx(C,{icon:Ke,size:20,strokeWidth:1.5})})})]}),t.jsxs("div",{className:"mt-2 flex md:flex-row flex-col md:gap-3 gap-0 md:min-h-[400px]",children:[t.jsx("nav",{className:"hidden md:flex flex-col gap-0.5 min-w-[160px] border-r border-primary-200 pr-3",children:[{id:"connection",label:"Connection",icon:ze},{id:"appearance",label:"Appearance",icon:Be},{id:"chat",label:"Chat",icon:Re},{id:"workspace",label:"Workspace",icon:Me},{id:"personas",label:"Personas",icon:De},{id:"voice",label:"Voice",icon:_e},{id:"llm",label:"LLM Features",icon:Ue},{id:"about",label:"About",icon:Ye}].map(e=>t.jsxs("button",{onClick:()=>le(e.id),className:L("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-sm text-left transition-colors",p===e.id?"text-primary-900 font-medium":"text-primary-600 hover:text-primary-900 hover:bg-primary-50"),style:p===e.id?{backgroundColor:"var(--opencami-accent-light)"}:void 0,children:[t.jsx(C,{icon:e.icon,size:16,strokeWidth:1.5}),e.label]},e.id))}),t.jsxs("div",{className:"flex-1 overflow-y-auto md:max-h-[calc(85vh-90px)] max-h-none",children:[t.jsx(x,{title:"Connection",tabId:"connection",activeTab:p,children:t.jsx(s,{inline:!0,label:"Status",children:t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-green-600",children:[t.jsx("span",{className:"size-2 rounded-full bg-green-500"}),"Connected"]})})}),t.jsxs(x,{title:"Appearance",tabId:"appearance",activeTab:p,children:[t.jsx(s,{label:"Theme",children:t.jsx(y,{value:a.theme,onValueChange:e=>{const r=e;We(r),c({theme:r})},children:t.jsx(v,{variant:"default",className:"gap-1.5 flex-wrap *:data-[slot=tab-indicator]:duration-0",children:Le.map(e=>t.jsxs(j,{value:e.value,className:"text-[11px] px-1 py-0.5 gap-0.5",children:[e.icon&&t.jsx(C,{icon:e.icon,size:13,strokeWidth:1.5}),t.jsx("span",{children:e.label})]},e.value))})})}),t.jsx(s,{label:"Accent Color",children:t.jsx("div",{className:"flex gap-0.5 flex-wrap",children:F.map(e=>{const r=a.accentColor===e.value;return t.jsx("button",{type:"button",onClick:()=>we(e.value),className:L("flex items-center justify-center rounded-md p-1 transition-all duration-150",r?"scale-110":"hover:bg-primary-50 hover:scale-105"),children:t.jsx("span",{className:L("size-6 rounded-full transition-shadow duration-150",r?"ring-2 ring-offset-2":"border-2 border-primary-200"),style:{backgroundColor:e.accent,...r?{"--tw-ring-color":e.accent}:{}}})},e.value)})})}),t.jsx(s,{label:"Text Size",children:t.jsx(y,{value:ne,onValueChange:ye,children:t.jsx(v,{variant:"default",className:"gap-2 *:data-[slot=tab-indicator]:duration-0",children:te.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"tabular-nums text-xs",children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Font",children:t.jsx(y,{value:a.fontFamily,onValueChange:ve,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:W.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",style:{fontFamily:e.cssValue},children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Density",children:t.jsx(y,{value:a.density,onValueChange:je,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:ae.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Bubbles",children:t.jsx(y,{value:a.bubbleStyle,onValueChange:ke,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:re.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Chat Width",children:t.jsx(y,{value:a.chatWidth,onValueChange:Se,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:K.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})}),t.jsx(s,{inline:!0,label:"Sidebar",children:t.jsx(y,{value:a.sidebarWidth,onValueChange:Ce,children:t.jsx(v,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:z.map(e=>t.jsx(j,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})})]}),t.jsxs(x,{title:"Chat",tabId:"chat",activeTab:p,children:[t.jsx(s,{inline:!0,label:"Show tool messages",children:t.jsx(m,{checked:a.showToolMessages,onCheckedChange:e=>c({showToolMessages:e})})}),t.jsx(s,{inline:!0,label:"Show reasoning blocks",children:t.jsx(m,{checked:a.showReasoningBlocks,onCheckedChange:e=>c({showReasoningBlocks:e})})}),t.jsx(s,{inline:!0,label:"Show search sources",children:t.jsx(m,{checked:a.showSearchSources,onCheckedChange:e=>c({showSearchSources:e})})}),t.jsx(s,{inline:!0,label:"Inline File Preview",description:"Make file paths in messages clickable to preview file contents",children:t.jsx(m,{checked:a.inlineFilePreview,onCheckedChange:e=>c({inlineFilePreview:e})})})]}),t.jsxs(x,{title:"Workspace",tabId:"workspace",activeTab:p,children:[t.jsx(s,{inline:!0,label:"File Explorer",description:"Browse and edit workspace files from the sidebar",children:t.jsx(m,{checked:(()=>{try{const e=localStorage.getItem("opencami-file-explorer");return e===null?!0:e==="true"}catch{return!0}})(),onCheckedChange:e=>{localStorage.setItem("opencami-file-explorer",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Memory Viewer",description:"Browse and edit MEMORY.md and daily memory files",children:t.jsx(m,{checked:(()=>{try{const e=localStorage.getItem("opencami-memory-viewer");return e===null?!0:e==="true"}catch{return!0}})(),onCheckedChange:e=>{localStorage.setItem("opencami-memory-viewer",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Agent Manager (Beta)",description:"Show Agent Manager in sidebar for creating and managing agents",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("opencami-agent-manager")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("opencami-agent-manager",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Skills Browser (Beta)",description:"Browse and install skills from ClawHub",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("opencami-skills-browser")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("opencami-skills-browser",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Cron Jobs Panel (Beta)",description:"Show Cron Jobs in sidebar for managing OpenClaw cron schedules",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("opencami-cron-manager")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("opencami-cron-manager",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Dashboard (Beta)",description:"Show Dashboard in sidebar with system and gateway widgets",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("feature_dashboard")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("feature_dashboard",String(e)),window.location.reload()}})}),t.jsx(s,{inline:!0,label:"Artifacts Preview (Beta)",description:"Show live HTML/SVG preview panel when AI generates code",children:t.jsx(m,{checked:(()=>{try{return localStorage.getItem("feature_artifacts")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("feature_artifacts",String(e)),nt.getState().setEnabled(e)}})})]}),t.jsxs(x,{title:"Personas",tabId:"personas",activeTab:p,children:[U?t.jsx(s,{inline:!0,label:"Persona Picker",description:"Show persona picker in chat (20 personalities)",children:t.jsx(m,{checked:Pe,onCheckedChange:Ee})}):t.jsx(s,{inline:!0,label:"Persona Picker",description:"Install the Personas skill to unlock 20 AI personalities",children:t.jsx(m,{checked:!1,disabled:!0})}),!U&&t.jsx("div",{className:"pt-1",children:t.jsx("a",{href:"https://www.clawhub.ai/robbyczgw-cla/personas",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary-600 hover:text-primary-900 hover:underline",children:"Get it on ClawHub →"})})]}),t.jsxs(x,{title:"Text-to-Speech",tabId:"voice",activeTab:p,children:[t.jsx(s,{inline:!0,label:"Voice Playback",description:"Add a 🔊 button to AI messages for text-to-speech",children:t.jsx(m,{checked:oe,onCheckedChange:Ie})}),t.jsx(s,{inline:!0,label:"TTS Provider",description:"Choose which service generates speech",children:t.jsxs("select",{value:_,onChange:e=>fe(e.target.value),className:"rounded-md border border-primary-200 bg-surface px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500",children:[t.jsx("option",{value:"auto",children:"Auto"}),t.jsx("option",{value:"elevenlabs",children:"ElevenLabs"}),t.jsx("option",{value:"openai",children:"OpenAI"}),t.jsx("option",{value:"edge",children:"Edge TTS (free)"})]})}),_==="openai"&&t.jsx(s,{inline:!0,label:"Voice",description:"OpenAI voice selection",children:t.jsx("select",{value:ue,onChange:e=>xe(e.target.value),className:"rounded-md border border-primary-200 bg-surface px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500",children:["alloy","echo","fable","onyx","nova","shimmer"].map(e=>t.jsx("option",{value:e,children:e.charAt(0).toUpperCase()+e.slice(1)},e))})})]}),t.jsx(x,{title:"Speech-to-Text",tabId:"voice",activeTab:p,children:t.jsx(s,{inline:!0,label:"STT Provider",description:"Choose which service transcribes your voice",children:t.jsxs("select",{value:he,onChange:e=>be(e.target.value),className:"rounded-md border border-primary-200 bg-surface px-2 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500",children:[t.jsx("option",{value:"auto",children:"Auto"}),t.jsx("option",{value:"elevenlabs",children:"ElevenLabs"}),t.jsx("option",{value:"openai",children:"OpenAI"}),t.jsx("option",{value:"browser",children:"Browser (free)"})]})})}),t.jsxs(x,{title:"LLM Features",tabId:"llm",activeTab:p,children:[t.jsxs("div",{className:"text-xs text-primary-500 mb-3",children:["Enhance session titles and follow-up suggestions using an LLM provider.",w.hasEnvKey&&t.jsx("span",{className:"block mt-1 text-green-600",children:"✓ Server has OPENAI_API_KEY configured"}),w.hasOpenRouterKey&&t.jsx("span",{className:"block mt-1 text-green-600",children:"✓ Server has OPENROUTER_API_KEY configured"}),w.hasKilocodeKey&&t.jsx("span",{className:"block mt-1 text-green-600",children:"✓ Server has KILOCODE_API_KEY configured"})]}),t.jsx(s,{inline:!0,label:"Provider",description:"Choose LLM provider for titles & follow-ups",children:t.jsxs("select",{value:u.llmProvider,onChange:e=>{const r=e.target.value;b({llmProvider:r,llmBaseUrl:"",llmModel:""})},className:"px-2 py-1 text-sm rounded-md border border-primary-200 bg-surface focus:outline-none focus:ring-2 focus:ring-primary-500",children:[t.jsx("option",{value:"openai",children:"OpenAI"}),t.jsx("option",{value:"openrouter",children:"OpenRouter"}),t.jsx("option",{value:"kilocode",children:"Kilo Gateway"}),t.jsx("option",{value:"ollama",children:"Ollama (local)"}),t.jsx("option",{value:"custom",children:"Custom"})]})}),t.jsx(s,{inline:!0,label:"Smart session titles",description:"Generate concise titles using AI",children:t.jsx(m,{checked:u.useLlmTitles,onCheckedChange:e=>b({useLlmTitles:e}),disabled:!w.isAvailable})}),t.jsx(s,{inline:!0,label:"Smart follow-up suggestions",description:"AI-generated contextual follow-ups",children:t.jsx(m,{checked:u.useLlmFollowUps,onCheckedChange:e=>b({useLlmFollowUps:e}),disabled:!w.isAvailable})}),t.jsxs("div",{className:"mt-2 space-y-2",children:[t.jsxs("div",{children:[t.jsx("div",{className:"text-xs text-primary-500 mb-1",children:"Model"}),t.jsx("input",{type:"text",value:u.llmModel,onChange:e=>b({llmModel:e.target.value}),placeholder:H(u.llmProvider).model||"model-name",className:"w-full px-3 py-1.5 text-sm rounded-md border border-primary-200 bg-surface focus:outline-none focus:ring-2 focus:ring-primary-500"})]}),(u.llmProvider==="custom"||u.llmProvider==="ollama")&&t.jsxs("div",{children:[t.jsx("div",{className:"text-xs text-primary-500 mb-1",children:"Base URL"}),t.jsx("input",{type:"text",value:u.llmBaseUrl,onChange:e=>b({llmBaseUrl:e.target.value}),placeholder:H(u.llmProvider).baseUrl||"https://...",className:"w-full px-3 py-1.5 text-sm rounded-md border border-primary-200 bg-surface focus:outline-none focus:ring-2 focus:ring-primary-500"})]})]}),t.jsxs("div",{className:"mt-4 pt-3 border-t border-primary-100",children:[t.jsx("div",{className:"text-sm text-primary-800 mb-2",children:u.llmProvider==="ollama"?"API Key (optional)":"API Key"}),t.jsx("div",{className:"text-xs text-primary-500 mb-2",children:u.llmProvider==="ollama"?"Not required for local Ollama":w.hasEnvKey&&u.llmProvider==="openai"?"Optional: Override server key with your own":`Required for ${u.llmProvider==="openrouter"?"OpenRouter":u.llmProvider==="kilocode"?"Kilo Gateway":"LLM features"} (stored locally)`}),t.jsxs("div",{className:"text-xs text-amber-600 bg-amber-50 border border-amber-200 rounded-md px-2 py-1.5 mb-2",children:["⚠️ ",t.jsx("strong",{children:"Security Note:"})," API keys are stored in your browser's localStorage. This is convenient but not secure for shared computers. For production use, configure keys server-side via environment variables (OPENAI_API_KEY, OPENROUTER_API_KEY, KILOCODE_API_KEY)."]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{type:"password",value:g,onChange:e=>{R(e.target.value),k(null)},placeholder:"sk-...",className:"flex-1 px-3 py-1.5 text-sm rounded-md border border-primary-200 bg-surface focus:outline-none focus:ring-2 focus:ring-primary-500"}),t.jsx(O,{size:"sm",variant:"outline",onClick:Te,disabled:!g.trim()||M,className:"min-w-[60px]",children:M?t.jsx(C,{icon:$e,size:16,className:"animate-spin"}):"Test"})]}),S&&t.jsxs("div",{className:`mt-2 flex items-center gap-1.5 text-xs ${S.valid?"text-green-600":"text-red-600"}`,children:[t.jsx(C,{icon:S.valid?Y:Qe,size:14}),S.valid?"API key is valid":S.error||"Invalid API key"]}),u.llmApiKey&&t.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[t.jsxs("span",{className:"text-xs text-green-600 flex items-center gap-1",children:[t.jsx(C,{icon:Y,size:14}),"Key saved"]}),t.jsx(O,{size:"sm",variant:"ghost",onClick:Oe,className:"text-xs text-red-600 hover:text-red-700 hover:bg-red-50",children:"Clear"})]}),g&&g!==u.llmApiKey&&!S?.valid&&t.jsx(O,{size:"sm",variant:"outline",onClick:Ve,className:"mt-2 w-full",children:"Save without testing"})]})]}),t.jsxs(x,{title:"About",tabId:"about",activeTab:p,children:[t.jsx("div",{className:"text-sm text-primary-800",children:"OpenCami"}),t.jsxs("div",{className:"flex gap-4 pt-2",children:[t.jsx("a",{href:"https://github.com/robbyczgw-cla/opencami",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary-600 hover:text-primary-900 hover:underline",children:"GitHub"}),t.jsx("a",{href:"https://docs.openclaw.ai",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary-600 hover:text-primary-900 hover:underline",children:"OpenClaw docs"})]})]})]})]}),t.jsx("div",{className:"mt-2 flex justify-end",children:t.jsx(G,{onClick:h,children:"Close"})})]})})})}export{Vt as SettingsDialog};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/skills-panel-B7BRAofP.js","assets/main-ZBMVSJTF.js","assets/button-DqP4GZwZ.js","assets/tabs-eiBvL0H7.js","assets/useControlled-CpliTEve.js","assets/useBaseUiId-DLhdkHJl.js","assets/useCompositeItem-DTSTTR0Z.js","assets/DirectionContext-CQMv7g2N.js","assets/event-2_Dxdv7h.js","assets/composite-BLgu_EOL.js","assets/CSPContext-TfUptlEu.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as t,_ as r}from"./main-ZBMVSJTF.js";const l=t.lazy(()=>r(()=>import("./skills-panel-B7BRAofP.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(s=>({default:s.SkillsPanel})));function a(){return e.jsx(t.Suspense,{fallback:e.jsx("div",{className:"flex h-screen items-center justify-center text-primary-500 text-sm",children:"Loading…"}),children:e.jsx(l,{})})}export{a as component};