opencami 2.0.0 → 2.1.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 (69) hide show
  1. package/dist/client/assets/{CSPContext-CrlIQW7-.js → CSPContext-CxrBvJ99.js} +1 -1
  2. package/dist/client/assets/{DirectionContext-X-0CRn1O.js → DirectionContext-BOL0P_1j.js} +1 -1
  3. package/dist/client/assets/_sessionKey-CTtu2ipR.js +25 -0
  4. package/dist/client/assets/agents-D7JS19Lo.js +2 -0
  5. package/dist/client/assets/{agents-screen-BhOVp_S6.js → agents-screen-CqdzZKaR.js} +1 -1
  6. package/dist/client/assets/bots-DAInzfLx.js +2 -0
  7. package/dist/client/assets/{bots-screen-DLFd0ydi.js → bots-screen-RYovD6cu.js} +1 -1
  8. package/dist/client/assets/{button-D0n2Qsd_.js → button-Bv-7bwZZ.js} +1 -1
  9. package/dist/client/assets/{composite-GtKwZKbV.js → composite-DwQIZFe9.js} +1 -1
  10. package/dist/client/assets/{connect-vQWL0_11.js → connect-DZSrhhNT.js} +1 -1
  11. package/dist/client/assets/{dashboard-Knwc61i1.js → dashboard-y8KVUVF-.js} +1 -1
  12. package/dist/client/assets/{event-CHpdjYFR.js → event-Cnr9OETn.js} +1 -1
  13. package/dist/client/assets/{file-explorer-screen-FoYNs9zK.js → file-explorer-screen-C_mYUJsr.js} +1 -1
  14. package/dist/client/assets/files-CG0jFYdO.js +2 -0
  15. package/dist/client/assets/follow-up-suggestions-C6RzpstA.js +2 -0
  16. package/dist/client/assets/{index-CNPHef4O.js → index-3-ASY4Cl.js} +1 -1
  17. package/dist/client/assets/index-BZxJSF4T.js +3 -0
  18. package/dist/client/assets/{keyboard-shortcuts-dialog-DP8ptQ7N.js → keyboard-shortcuts-dialog-jm4-DftO.js} +1 -1
  19. package/dist/client/assets/{main-xPlWrMhO.js → main-CbISK-pm.js} +2 -2
  20. package/dist/client/assets/{markdown-3Js_RbUp.js → markdown-UD7RzskQ.js} +1 -1
  21. package/dist/client/assets/memory-BYRJ1l_4.js +2 -0
  22. package/dist/client/assets/{memory-screen-nzRra2Qi.js → memory-screen-BRsm-Q8A.js} +1 -1
  23. package/dist/client/assets/{menu-BnSEqetd.js → menu-DRjoHFvG.js} +1 -1
  24. package/dist/client/assets/{opencami-logo-B_hLbomw.js → opencami-logo-D2mv84sX.js} +1 -1
  25. package/dist/client/assets/{proxy-BnlGpgC1.js → proxy-DtxqfBHY.js} +1 -1
  26. package/dist/client/assets/{react-BgjQyJHw.js → react-C_7UlEtd.js} +1 -1
  27. package/dist/client/assets/{search-dialog-Bib2QY9u.js → search-dialog-lsT8JUtT.js} +1 -1
  28. package/dist/client/assets/{search-sources-badge-COHcYFRB.js → search-sources-badge-BnqKxoia.js} +1 -1
  29. package/dist/client/assets/{session-export-dialog-ooPnfHh_.js → session-export-dialog-DHHpvwI8.js} +1 -1
  30. package/dist/client/assets/settings-dialog-vrd0eJGw.js +1 -0
  31. package/dist/client/assets/skills-Svd-7oxQ.js +2 -0
  32. package/dist/client/assets/{skills-panel-D2uMdCHp.js → skills-panel-Dkuo0yyD.js} +1 -1
  33. package/dist/client/assets/{switch-BUQ0qH6r.js → switch-BYFBYPmi.js} +1 -1
  34. package/dist/client/assets/{tabs-BEyU6TjN.js → tabs-1jrPkdUE.js} +1 -1
  35. package/dist/client/assets/{thinking-CA48yhOE.js → thinking-D9BBn5kK.js} +1 -1
  36. package/dist/client/assets/{tooltip-CcIdgcV0.js → tooltip-DzFgDY86.js} +1 -1
  37. package/dist/client/assets/{use-file-explorer-state-CN_IJGcd.js → use-file-explorer-state-Dwhw6Mpg.js} +1 -1
  38. package/dist/client/assets/{useBaseUiId-ClbEYEil.js → useBaseUiId-BdQC9KF3.js} +1 -1
  39. package/dist/client/assets/{useCompositeItem-B_OxfJee.js → useCompositeItem-BI09zNFD.js} +1 -1
  40. package/dist/client/assets/{useControlled-CyT-lqbs.js → useControlled-Bc2Emhlx.js} +1 -1
  41. package/dist/client/assets/{useMutation-eQUrsn-X.js → useMutation-CMp81lDO.js} +1 -1
  42. package/dist/client/assets/{useOnFirstRender-CR_o2MK_.js → useOnFirstRender-DpB3w0o4.js} +1 -1
  43. package/dist/client/assets/{useQuery-k6EMRoMD.js → useQuery-_BEWdUe1.js} +1 -1
  44. package/dist/server/assets/{_sessionKey-CaFqmyhU.js → _sessionKey-COz7RLKC.js} +121 -23
  45. package/dist/server/assets/_tanstack-start-manifest_v-D0f-0Utn.js +4 -0
  46. package/dist/server/assets/{connect-CTVBm0Vc.js → connect-sd_NDvQN.js} +1 -1
  47. package/dist/server/assets/follow-up-suggestions-DRQqO8_S.js +183 -0
  48. package/dist/server/assets/{index-B_F4DTUu.js → index-197lqzv2.js} +2 -0
  49. package/dist/server/assets/{index-C7lmufwX.js → index-sXe2QC5V.js} +1 -1
  50. package/dist/server/assets/{markdown-CFdYXCRQ.js → markdown-Dk1YdosA.js} +1 -1
  51. package/dist/server/assets/{memory-screen-vqXczcVo.js → memory-screen-DA_o-N1Z.js} +2 -2
  52. package/dist/server/assets/{memory-rBB015W-.js → memory-woPzJFfs.js} +1 -1
  53. package/dist/server/assets/{router-X2L0PDPI.js → router-CZhxPkYW.js} +305 -150
  54. package/dist/server/assets/{search-dialog-CXhofdoP.js → search-dialog-DlvWfq1e.js} +5 -5
  55. package/dist/server/assets/{settings-dialog-CPdftvjz.js → settings-dialog-BGtrS2RJ.js} +62 -1
  56. package/dist/server/assets/{thinking-YkRSlXtf.js → thinking-fzwT_aVT.js} +5 -5
  57. package/dist/server/server.js +2 -2
  58. package/package.json +1 -1
  59. package/dist/client/assets/_sessionKey-yNQ57svB.js +0 -23
  60. package/dist/client/assets/agents-WqWjsymD.js +0 -2
  61. package/dist/client/assets/bots-DNqiFT7w.js +0 -2
  62. package/dist/client/assets/files-BtR_gArr.js +0 -2
  63. package/dist/client/assets/follow-up-suggestions-DVXNLqga.js +0 -5
  64. package/dist/client/assets/index-CTT0Y1ya.js +0 -3
  65. package/dist/client/assets/memory-BRGPq5t6.js +0 -2
  66. package/dist/client/assets/settings-dialog-B8mz99u-.js +0 -1
  67. package/dist/client/assets/skills-DA9J_tsC.js +0 -2
  68. package/dist/server/assets/_tanstack-start-manifest_v-P3skSR3R.js +0 -4
  69. package/dist/server/assets/follow-up-suggestions-DHv2_XzB.js +0 -275
@@ -0,0 +1 @@
1
+ import{r as d,j as t}from"./main-CbISK-pm.js";import{c as Ce}from"./react-C_7UlEtd.js";import{B as ke,H as T,V as Ie,z as Ne,f as Pe,P as Ve,S as Ee,g as Fe,R as Ae,j as Te,c as I,o as We,v as Me,k as Le,s as Be,m as Oe}from"./button-Bv-7bwZZ.js";import{D as ze,a as De,b as Re,c as _e,d as O}from"./use-file-explorer-state-Dwhw6Mpg.js";import{S as u}from"./switch-BYFBYPmi.js";import{T as b,a as g,b as x}from"./tabs-1jrPkdUE.js";import{u as He}from"./index-BZxJSF4T.js";import"./useOnFirstRender-DpB3w0o4.js";import"./useBaseUiId-BdQC9KF3.js";import"./event-Cnr9OETn.js";import"./visuallyHidden-COI6QeQH.js";import"./composite-DwQIZFe9.js";import"./useControlled-Bc2Emhlx.js";import"./useCompositeItem-BI09zNFD.js";import"./DirectionContext-BOL0P_1j.js";import"./CSPContext-CxrBvJ99.js";function Ue(){if(typeof window>"u")return!1;try{return window.localStorage.getItem("feature_artifacts")==="true"}catch{return!1}}const Ge=Ce()(s=>({isEnabled:Ue(),isPanelOpen:!1,content:"",type:null,setArtifact:function(m,a){s({content:m,type:a,isPanelOpen:!0})},clearArtifact:function(){s({content:"",type:null})},openPanel:function(){s({isPanelOpen:!0})},closePanel:function(){s({isPanelOpen:!1})},setEnabled:function(m){if(typeof window<"u")try{window.localStorage.setItem("feature_artifacts",String(m))}catch{}s({isEnabled:m})}}));function p({title:s,tabId:l,activeTab:m,children:a}){const i=l&&m&&l!==m;return t.jsxs("div",{className:I("border-b border-primary-200 py-2 last:border-0",i&&"md:hidden"),children:[t.jsx("h3",{className:"mb-1.5 text-sm font-semibold text-primary-700",children:s}),t.jsx("div",{className:"space-y-1.5",children:a})]})}function r({label:s,description:l,inline:m,children:a}){return m?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:s}),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:s}),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 q=[{value:"14px",label:"S"},{value:"16px",label:"M"},{value:"18px",label:"L"},{value:"20px",label:"XL"}],N=[{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]'}],J=[{value:"compact",label:"Compact"},{value:"comfortable",label:"Comfortable"},{value:"spacious",label:"Spacious"}],P=[{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"}],V=[{value:"narrow",label:"Narrow",cssValue:"640px"},{value:"medium",label:"Medium",cssValue:"800px"},{value:"wide",label:"Wide",cssValue:"1000px"},{value:"full",label:"Full",cssValue:"100%"}],E=[{value:"compact",label:"Compact",cssValue:"200px"},{value:"normal",label:"Normal",cssValue:"260px"},{value:"wide",label:"Wide",cssValue:"320px"},{value:"xl",label:"XL",cssValue:"400px"}],X=[{value:"default",label:"Default"},{value:"bubbles",label:"Bubbles"},{value:"minimal",label:"Minimal"}];function z(s){return q.some(l=>l.value===s)}function D(s){return N.some(l=>l.value===s)}function R(s){return J.some(l=>l.value===s)}function _(s){return P.some(l=>l.value===s)}function H(s){return V.some(l=>l.value===s)}function U(s){return E.some(l=>l.value===s)}function G(s){return X.some(l=>l.value===s)}function it({open:s,onOpenChange:l,onClose:m}){const{settings:a,updateSettings:i}=He(),[f,Y]=d.useState("appearance"),[F,W]=d.useState([]),[Q,M]=d.useState(!1),[K,Z]=d.useState(()=>{if(typeof window>"u")return"16px";try{const e=localStorage.getItem("opencami-text-size");if(e&&z(e))return e}catch{}return"16px"}),[$,ee]=d.useState(()=>{if(typeof window>"u")return!0;try{const e=localStorage.getItem("opencami-tts-enabled");return e===null?!0:e==="true"}catch{return!0}}),[L,te]=d.useState(()=>{if(typeof window>"u")return"auto";try{return localStorage.getItem("opencami-tts-provider")||"auto"}catch{return"auto"}}),[ae,ne]=d.useState(()=>{if(typeof window>"u")return"nova";try{return localStorage.getItem("opencami-tts-voice")||"nova"}catch{return"nova"}}),[le,re]=d.useState(()=>{if(typeof window>"u")return"auto";try{return localStorage.getItem("opencami-stt-provider")||"auto"}catch{return"auto"}});d.useEffect(()=>{let e=!0;async function n(){M(!0);try{const c=await(await fetch("/api/llm-models")).json();if(!e)return;W(c.models??[])}catch{if(!e)return;W([])}finally{e&&M(!1)}}return n(),()=>{e=!1}},[]),d.useEffect(()=>{if(!(typeof window>"u"))try{const e=localStorage.getItem("opencami-font-family");e&&D(e)?(y(e),a.fontFamily!==e&&i({fontFamily:e})):y(a.fontFamily);const n=localStorage.getItem("opencami-density");n&&R(n)?(v(n),a.density!==n&&i({density:n})):v(a.density);const o=localStorage.getItem("opencami-accent-color");o&&_(o)?(j(o),a.accentColor!==o&&i({accentColor:o})):j(a.accentColor);const c=localStorage.getItem("opencami-chat-width");c&&H(c)?(w(c),a.chatWidth!==c&&i({chatWidth:c})):w(a.chatWidth);const h=localStorage.getItem("opencami-sidebar-width");h&&U(h)?(S(h),a.sidebarWidth!==h&&i({sidebarWidth:h})):S(a.sidebarWidth);const k=localStorage.getItem("opencami-bubble-style");k&&G(k)?(C(k),a.bubbleStyle!==k&&i({bubbleStyle:k})):C(a.bubbleStyle)}catch{y(a.fontFamily),v(a.density),j(a.accentColor),w(a.chatWidth),S(a.sidebarWidth),C(a.bubbleStyle)}},[]),d.useEffect(()=>{y(a.fontFamily)},[a.fontFamily]),d.useEffect(()=>{v(a.density)},[a.density]),d.useEffect(()=>{j(a.accentColor)},[a.accentColor]),d.useEffect(()=>{w(a.chatWidth)},[a.chatWidth]),d.useEffect(()=>{S(a.sidebarWidth)},[a.sidebarWidth]),d.useEffect(()=>{C(a.bubbleStyle)},[a.bubbleStyle]);const se=e=>{te(e);try{localStorage.setItem("opencami-tts-provider",e)}catch{}},oe=e=>{ne(e);try{localStorage.setItem("opencami-tts-voice",e)}catch{}},ie=e=>{re(e);try{localStorage.setItem("opencami-stt-provider",e)}catch{}};function ce(e){typeof document>"u"||document.documentElement.style.setProperty("--opencami-text-size",e)}function y(e){if(typeof document>"u")return;const o=N.find(c=>c.value===e)?.cssValue??N[0].cssValue;document.documentElement.style.setProperty("--opencami-font-family",o)}function v(e){if(typeof document>"u")return;const n=document.documentElement;if(n.style.setProperty("--opencami-density",e),e==="compact"){n.style.setProperty("--opencami-msg-padding-y","0.25rem"),n.style.setProperty("--opencami-msg-gap","0.25rem"),n.style.setProperty("--opencami-user-bubble-py","0.4rem");return}if(e==="spacious"){n.style.setProperty("--opencami-msg-padding-y","1.25rem"),n.style.setProperty("--opencami-msg-gap","1rem"),n.style.setProperty("--opencami-user-bubble-py","1rem");return}n.style.setProperty("--opencami-msg-padding-y","0.75rem"),n.style.setProperty("--opencami-msg-gap","0.5rem"),n.style.setProperty("--opencami-user-bubble-py","0.625rem")}function j(e){if(typeof document>"u")return;const n=P.find(c=>c.value===e)??P[0],o=document.documentElement;o.style.setProperty("--opencami-accent",n.accent),o.style.setProperty("--opencami-accent-hover",n.hover),o.style.setProperty("--opencami-accent-light",n.light),o.style.setProperty("--opencami-accent-fg",n.fg)}function w(e){if(typeof document>"u")return;const n=V.find(o=>o.value===e)??V[2];document.documentElement.style.setProperty("--opencami-chat-width",n.cssValue)}function S(e){if(typeof document>"u")return;const n=E.find(o=>o.value===e)??E[1];document.documentElement.style.setProperty("--opencami-sidebar-width",n.cssValue)}function C(e){typeof document>"u"||document.documentElement.setAttribute("data-opencami-bubble-style",e)}const de=e=>{if(z(e)){Z(e),ce(e);try{localStorage.setItem("opencami-text-size",e)}catch{}}},ue=e=>{if(D(e)){y(e),i({fontFamily:e});try{localStorage.setItem("opencami-font-family",e)}catch{}}},me=e=>{if(R(e)){v(e),i({density:e});try{localStorage.setItem("opencami-density",e)}catch{}}},he=e=>{if(_(e)){j(e),i({accentColor:e});try{localStorage.setItem("opencami-accent-color",e)}catch{}}},fe=e=>{if(H(e)){w(e),i({chatWidth:e});try{localStorage.setItem("opencami-chat-width",e)}catch{}}},pe=e=>{if(U(e)){S(e),i({sidebarWidth:e});try{localStorage.setItem("opencami-sidebar-width",e)}catch{}}},be=e=>{if(G(e)){C(e),i({bubbleStyle:e});try{localStorage.setItem("opencami-bubble-style",e)}catch{}}},ge=e=>{ee(e);try{localStorage.setItem("opencami-tts-enabled",String(e))}catch{}window.dispatchEvent(new StorageEvent("storage",{key:"opencami-tts-enabled",newValue:String(e)}))},[B,xe]=d.useState(!1),A=d.useRef(null),[ye,ve]=d.useState(()=>{if(typeof window>"u")return!0;try{const e=localStorage.getItem("opencami-personas-enabled");return e===null?!0:e==="true"}catch{return!0}});d.useEffect(()=>{let e=!0;async function n(){A.current?.abort();const o=new AbortController;A.current=o;try{const c=await fetch("/api/personas",{signal:o.signal});if(!c.ok)return;const h=await c.json();e&&h.ok&&xe(h.available)}catch(c){if(c instanceof Error&&c.name==="AbortError")return}}return n(),()=>{e=!1,A.current?.abort()}},[]);const je=e=>{ve(e);try{localStorage.setItem("opencami-personas-enabled",String(e))}catch{}window.dispatchEvent(new StorageEvent("storage",{key:"opencami-personas-enabled",newValue:String(e)}))},we=[{value:"system",label:"Auto",icon:We},{value:"light",label:"Light",icon:Me},{value:"dark",label:"Dark",icon:Le},{value:"chameleon",label:"Cham",icon:Be},{value:"frost-light",label:"Ice",icon:Oe}];function Se(e){if(typeof document>"u")return;const n=document.documentElement,o=window.matchMedia("(prefers-color-scheme: dark)");n.classList.remove("light","dark","system","chameleon","frost","frost-light","frost-dark"),n.style.colorScheme="",n.classList.add(e);const c=e==="frost-light",h=e==="frost-dark";(c||h)&&n.classList.add("frost"),h&&n.classList.add("dark"),e==="system"&&o.matches&&n.classList.add("dark"),c&&(n.classList.remove("dark"),n.style.colorScheme="light")}return t.jsx(ze,{open:s,onOpenChange:l,children:t.jsx(De,{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(Re,{className:"mb-1",children:"Settings"}),t.jsx(_e,{className:"hidden",children:"Configure OpenCami"})]}),t.jsx(O,{render:t.jsx(ke,{size:"icon-sm",variant:"ghost",className:"text-primary-500 hover:bg-primary-100 hover:text-primary-700","aria-label":"Close",children:t.jsx(T,{icon:Ie,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:Ne},{id:"appearance",label:"Appearance",icon:Pe},{id:"chat",label:"Chat",icon:Ve},{id:"workspace",label:"Workspace",icon:Ee},{id:"personas",label:"Personas",icon:Fe},{id:"voice",label:"Voice",icon:Ae},{id:"about",label:"About",icon:Te}].map(e=>t.jsxs("button",{onClick:()=>Y(e.id),className:I("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-sm text-left transition-colors",f===e.id?"text-primary-900 font-medium":"text-primary-600 hover:text-primary-900 hover:bg-primary-50"),style:f===e.id?{backgroundColor:"var(--opencami-accent-light)"}:void 0,children:[t.jsx(T,{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(p,{title:"Connection",tabId:"connection",activeTab:f,children:t.jsx(r,{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(p,{title:"Appearance",tabId:"appearance",activeTab:f,children:[t.jsx(r,{label:"Theme",children:t.jsx(b,{value:a.theme,onValueChange:e=>{const n=e;Se(n),i({theme:n})},children:t.jsx(g,{variant:"default",className:"gap-1.5 flex-wrap *:data-[slot=tab-indicator]:duration-0",children:we.map(e=>t.jsxs(x,{value:e.value,className:"text-[11px] px-1 py-0.5 gap-0.5",children:[e.icon&&t.jsx(T,{icon:e.icon,size:13,strokeWidth:1.5}),t.jsx("span",{children:e.label})]},e.value))})})}),t.jsx(r,{label:"Accent Color",children:t.jsx("div",{className:"flex gap-0.5 flex-wrap",children:P.map(e=>{const n=a.accentColor===e.value;return t.jsx("button",{type:"button",onClick:()=>he(e.value),className:I("flex items-center justify-center rounded-md p-1 transition-all duration-150",n?"scale-110":"hover:bg-primary-50 hover:scale-105"),children:t.jsx("span",{className:I("size-6 rounded-full transition-shadow duration-150",n?"ring-2 ring-offset-2":"border-2 border-primary-200"),style:{backgroundColor:e.accent,...n?{"--tw-ring-color":e.accent}:{}}})},e.value)})})}),t.jsx(r,{label:"Text Size",children:t.jsx(b,{value:K,onValueChange:de,children:t.jsx(g,{variant:"default",className:"gap-2 *:data-[slot=tab-indicator]:duration-0",children:q.map(e=>t.jsx(x,{value:e.value,children:t.jsx("span",{className:"tabular-nums text-xs",children:e.label})},e.value))})})}),t.jsx(r,{inline:!0,label:"Font",children:t.jsx(b,{value:a.fontFamily,onValueChange:ue,children:t.jsx(g,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:N.map(e=>t.jsx(x,{value:e.value,children:t.jsx("span",{className:"text-xs",style:{fontFamily:e.cssValue},children:e.label})},e.value))})})}),t.jsx(r,{inline:!0,label:"Density",children:t.jsx(b,{value:a.density,onValueChange:me,children:t.jsx(g,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:J.map(e=>t.jsx(x,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})}),t.jsx(r,{inline:!0,label:"Bubbles",children:t.jsx(b,{value:a.bubbleStyle,onValueChange:be,children:t.jsx(g,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:X.map(e=>t.jsx(x,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})}),t.jsx(r,{inline:!0,label:"Chat Width",children:t.jsx(b,{value:a.chatWidth,onValueChange:fe,children:t.jsx(g,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:V.map(e=>t.jsx(x,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})}),t.jsx(r,{inline:!0,label:"Sidebar",children:t.jsx(b,{value:a.sidebarWidth,onValueChange:pe,children:t.jsx(g,{variant:"default",className:"gap-1 *:data-[slot=tab-indicator]:duration-0",children:E.map(e=>t.jsx(x,{value:e.value,children:t.jsx("span",{className:"text-xs",children:e.label})},e.value))})})})]}),t.jsxs(p,{title:"Chat",tabId:"chat",activeTab:f,children:[t.jsx(r,{inline:!0,label:"Show tool messages",children:t.jsx(u,{checked:a.showToolMessages,onCheckedChange:e=>i({showToolMessages:e})})}),t.jsx(r,{inline:!0,label:"Show reasoning blocks",children:t.jsx(u,{checked:a.showReasoningBlocks,onCheckedChange:e=>i({showReasoningBlocks:e})})}),t.jsx(r,{inline:!0,label:"Show search sources",children:t.jsx(u,{checked:a.showSearchSources,onCheckedChange:e=>i({showSearchSources:e})})}),t.jsx(r,{inline:!0,label:"Follow-up suggestions",children:t.jsx(u,{checked:a.showFollowUps,onCheckedChange:e=>i({showFollowUps:e})})}),t.jsx(r,{inline:!0,label:"LLM Features Model",description:"Used for smart titles and follow-up suggestions",children:t.jsxs("select",{value:a.llmFeaturesModel||"gpt54mini",onChange:e=>i({llmFeaturesModel: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:[Q&&F.length===0?t.jsx("option",{value:a.llmFeaturesModel||"gpt54mini",children:a.llmFeaturesModel||"gpt54mini"}):null,F.length>0?F.map(e=>t.jsx("option",{value:e.agentId,children:e.displayName},e.id)):a.llmFeaturesModel?[t.jsx("option",{value:a.llmFeaturesModel,children:a.llmFeaturesModel},a.llmFeaturesModel)]:null]})}),t.jsx(r,{inline:!0,label:"Inline File Preview",description:"Make file paths in messages clickable to preview file contents",children:t.jsx(u,{checked:a.inlineFilePreview,onCheckedChange:e=>i({inlineFilePreview:e})})})]}),t.jsxs(p,{title:"Workspace",tabId:"workspace",activeTab:f,children:[t.jsx(r,{inline:!0,label:"File Explorer",description:"Browse and edit workspace files from the sidebar",children:t.jsx(u,{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(r,{inline:!0,label:"Memory Viewer",description:"Browse and edit MEMORY.md and daily memory files",children:t.jsx(u,{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(r,{inline:!0,label:"Agent Manager (Beta)",description:"Show Agent Manager in sidebar for creating and managing agents",children:t.jsx(u,{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(r,{inline:!0,label:"Skills Browser (Beta)",description:"Browse and install skills from ClawHub",children:t.jsx(u,{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(r,{inline:!0,label:"Cron Jobs Panel (Beta)",description:"Show Cron Jobs in sidebar for managing OpenClaw cron schedules",children:t.jsx(u,{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(r,{inline:!0,label:"Dashboard (Beta)",description:"Show Dashboard in sidebar with system and gateway widgets",children:t.jsx(u,{checked:(()=>{try{return localStorage.getItem("feature_dashboard")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("feature_dashboard",String(e)),window.location.reload()}})}),t.jsx(r,{inline:!0,label:"Artifacts Preview (Beta)",description:"Show live HTML/SVG preview panel when AI generates code",children:t.jsx(u,{checked:(()=>{try{return localStorage.getItem("feature_artifacts")==="true"}catch{return!1}})(),onCheckedChange:e=>{localStorage.setItem("feature_artifacts",String(e)),Ge.getState().setEnabled(e)}})})]}),t.jsxs(p,{title:"Personas",tabId:"personas",activeTab:f,children:[B?t.jsx(r,{inline:!0,label:"Persona Picker",description:"Show persona picker in chat (20 personalities)",children:t.jsx(u,{checked:ye,onCheckedChange:je})}):t.jsx(r,{inline:!0,label:"Persona Picker",description:"Install the Personas skill to unlock 20 AI personalities",children:t.jsx(u,{checked:!1,disabled:!0})}),!B&&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(p,{title:"Text-to-Speech",tabId:"voice",activeTab:f,children:[t.jsx(r,{inline:!0,label:"Voice Playback",description:"Add a 🔊 button to AI messages for text-to-speech",children:t.jsx(u,{checked:$,onCheckedChange:ge})}),t.jsx(r,{inline:!0,label:"TTS Provider",description:"Choose which service generates speech",children:t.jsxs("select",{value:L,onChange:e=>se(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)"})]})}),L==="openai"&&t.jsx(r,{inline:!0,label:"Voice",description:"OpenAI voice selection",children:t.jsx("select",{value:ae,onChange:e=>oe(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(p,{title:"Speech-to-Text",tabId:"voice",activeTab:f,children:t.jsx(r,{inline:!0,label:"STT Provider",description:"Choose which service transcribes your voice",children:t.jsxs("select",{value:le,onChange:e=>ie(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(p,{title:"About",tabId:"about",activeTab:f,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(O,{onClick:m,children:"Close"})})]})})})}export{it as SettingsDialog};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/skills-panel-Dkuo0yyD.js","assets/main-CbISK-pm.js","assets/button-Bv-7bwZZ.js","assets/tabs-1jrPkdUE.js","assets/useControlled-Bc2Emhlx.js","assets/useBaseUiId-BdQC9KF3.js","assets/useCompositeItem-BI09zNFD.js","assets/DirectionContext-BOL0P_1j.js","assets/event-Cnr9OETn.js","assets/composite-DwQIZFe9.js","assets/CSPContext-CxrBvJ99.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as t,_ as r}from"./main-CbISK-pm.js";const l=t.lazy(()=>r(()=>import("./skills-panel-Dkuo0yyD.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};
@@ -1,4 +1,4 @@
1
- import{r as o,j as e,L as H}from"./main-xPlWrMhO.js";import{H as m,r as W,h as f,d as D,D as A,y as E,J as I,e as R,A as _,B as J,i as F}from"./button-D0n2Qsd_.js";import{T as K,a as Q,b as k}from"./tabs-BEyU6TjN.js";import"./useControlled-CyT-lqbs.js";import"./useBaseUiId-ClbEYEil.js";import"./useCompositeItem-B_OxfJee.js";import"./DirectionContext-X-0CRn1O.js";import"./event-CHpdjYFR.js";import"./composite-GtKwZKbV.js";import"./CSPContext-CrlIQW7-.js";async function v(s){const n=await fetch(s);if(!n.ok)throw new Error(`HTTP ${n.status}`);const r=await n.json();if(!r.ok)throw new Error(r.error||"Unknown error");return r.skills}function b(){const[s,n]=o.useState([]),[r,l]=o.useState(!0),[c,a]=o.useState(null),i=o.useCallback(async()=>{l(!0),a(null);try{const t=await v("/api/skills?action=installed");n(t)}catch(t){a(t instanceof Error?t.message:String(t))}finally{l(!1)}},[]);return o.useEffect(()=>{i()},[i]),{skills:s,loading:r,error:c,refresh:i}}function Z(s,n){const[r,l]=o.useState([]),[c,a]=o.useState(!0),[i,t]=o.useState(null);return o.useEffect(()=>{let x=!1;return a(!0),t(null),v(`/api/skills?action=explore&sort=${s}&limit=${n}`).then(d=>{x||l(d)}).catch(d=>{x||t(d instanceof Error?d.message:String(d))}).finally(()=>{x||a(!1)}),()=>{x=!0}},[s,n]),{skills:r,loading:c,error:i}}function q(s){const[n,r]=o.useState([]),[l,c]=o.useState(!1),[a,i]=o.useState(null),t=o.useRef(null);return o.useEffect(()=>{if(t.current&&clearTimeout(t.current),!s.trim()){r([]),c(!1);return}return c(!0),t.current=setTimeout(()=>{v(`/api/skills?action=search&q=${encodeURIComponent(s)}&limit=10`).then(r).catch(x=>i(x instanceof Error?x.message:String(x))).finally(()=>c(!1))},400),()=>{t.current&&clearTimeout(t.current)}},[s]),{skills:n,loading:l,error:a}}function V(){const[s,n]=o.useState([]),[r,l]=o.useState(!0),[c,a]=o.useState(null),i=o.useCallback(async()=>{l(!0),a(null);try{const t=await v("/api/skills?action=my-skills");n(t)}catch(t){a(t instanceof Error?t.message:String(t))}finally{l(!1)}},[]);return o.useEffect(()=>{i()},[i]),{skills:s,loading:r,error:c,refresh:i}}function G(){const[s,n]=o.useState([]),[r,l]=o.useState(!0),[c,a]=o.useState(null),i=o.useCallback(async()=>{l(!0),a(null);try{const t=await v("/api/skills?action=recommended");n(t)}catch(t){a(t instanceof Error?t.message:String(t))}finally{l(!1)}},[]);return o.useEffect(()=>{i()},[i]),{skills:s,loading:r,error:c,refresh:i}}function M(){const[s,n]=o.useState(null),[r,l]=o.useState(null);return{install:o.useCallback(async a=>{n(a),l(null);try{const t=await(await fetch("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"install",slug:a})})).json();if(!t.ok)throw new Error(t.error||"Install failed")}catch(i){throw l(i instanceof Error?i.message:String(i)),i}finally{n(null)}},[]),installing:s,error:r}}function X(){const[s,n]=o.useState(null),[r,l]=o.useState(null);return{update:o.useCallback(async a=>{n(a),l(null);try{const t=await(await fetch("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update",slug:a})})).json();if(!t.ok)throw new Error(t.error||"Update failed")}catch(i){throw l(i instanceof Error?i.message:String(i)),i}finally{n(null)}},[]),updating:s,error:r}}const Y=new Set(["openclaw","clawhub","anthropic","robbyczgw-cla"]),ee=100;function U(s,n){if(n)return{type:"installed",label:"Installed"};const r=s.publisher||s.author||"",l=s.stats?.downloads||0;return Y.has(r.toLowerCase())||l>=ee?{type:"verified",label:"Verified"}:{type:"community",label:"Community"}}function $({type:s,label:n}){const r={verified:"bg-emerald-50 text-emerald-600 border-emerald-100",community:"bg-primary-50 text-primary-500 border-primary-100",installed:"bg-sky-50 text-sky-600 border-sky-100"};return e.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-medium rounded-full border ${r[s]}`,title:`${n} Skill`,children:[e.jsx(m,{icon:s==="installed"?I:F,size:10,strokeWidth:2}),n]})}function B({skill:s,installed:n,installing:r,onInstall:l,onUpdate:c,updating:a,showUpdate:i,onClick:t}){const x=s.slug||"",d=s.displayName||x,p=s.summary,h=s.version||s.latestVersion?.version||"",y=s.stats?.downloads,j=U(s,n);return e.jsxs("div",{className:`
1
+ import{r as o,j as e,L as H}from"./main-CbISK-pm.js";import{H as m,r as W,h as f,d as D,D as A,y as E,J as I,e as R,A as _,B as J,i as F}from"./button-Bv-7bwZZ.js";import{T as K,a as Q,b as k}from"./tabs-1jrPkdUE.js";import"./useControlled-Bc2Emhlx.js";import"./useBaseUiId-BdQC9KF3.js";import"./useCompositeItem-BI09zNFD.js";import"./DirectionContext-BOL0P_1j.js";import"./event-Cnr9OETn.js";import"./composite-DwQIZFe9.js";import"./CSPContext-CxrBvJ99.js";async function v(s){const n=await fetch(s);if(!n.ok)throw new Error(`HTTP ${n.status}`);const r=await n.json();if(!r.ok)throw new Error(r.error||"Unknown error");return r.skills}function b(){const[s,n]=o.useState([]),[r,l]=o.useState(!0),[c,a]=o.useState(null),i=o.useCallback(async()=>{l(!0),a(null);try{const t=await v("/api/skills?action=installed");n(t)}catch(t){a(t instanceof Error?t.message:String(t))}finally{l(!1)}},[]);return o.useEffect(()=>{i()},[i]),{skills:s,loading:r,error:c,refresh:i}}function Z(s,n){const[r,l]=o.useState([]),[c,a]=o.useState(!0),[i,t]=o.useState(null);return o.useEffect(()=>{let x=!1;return a(!0),t(null),v(`/api/skills?action=explore&sort=${s}&limit=${n}`).then(d=>{x||l(d)}).catch(d=>{x||t(d instanceof Error?d.message:String(d))}).finally(()=>{x||a(!1)}),()=>{x=!0}},[s,n]),{skills:r,loading:c,error:i}}function q(s){const[n,r]=o.useState([]),[l,c]=o.useState(!1),[a,i]=o.useState(null),t=o.useRef(null);return o.useEffect(()=>{if(t.current&&clearTimeout(t.current),!s.trim()){r([]),c(!1);return}return c(!0),t.current=setTimeout(()=>{v(`/api/skills?action=search&q=${encodeURIComponent(s)}&limit=10`).then(r).catch(x=>i(x instanceof Error?x.message:String(x))).finally(()=>c(!1))},400),()=>{t.current&&clearTimeout(t.current)}},[s]),{skills:n,loading:l,error:a}}function V(){const[s,n]=o.useState([]),[r,l]=o.useState(!0),[c,a]=o.useState(null),i=o.useCallback(async()=>{l(!0),a(null);try{const t=await v("/api/skills?action=my-skills");n(t)}catch(t){a(t instanceof Error?t.message:String(t))}finally{l(!1)}},[]);return o.useEffect(()=>{i()},[i]),{skills:s,loading:r,error:c,refresh:i}}function G(){const[s,n]=o.useState([]),[r,l]=o.useState(!0),[c,a]=o.useState(null),i=o.useCallback(async()=>{l(!0),a(null);try{const t=await v("/api/skills?action=recommended");n(t)}catch(t){a(t instanceof Error?t.message:String(t))}finally{l(!1)}},[]);return o.useEffect(()=>{i()},[i]),{skills:s,loading:r,error:c,refresh:i}}function M(){const[s,n]=o.useState(null),[r,l]=o.useState(null);return{install:o.useCallback(async a=>{n(a),l(null);try{const t=await(await fetch("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"install",slug:a})})).json();if(!t.ok)throw new Error(t.error||"Install failed")}catch(i){throw l(i instanceof Error?i.message:String(i)),i}finally{n(null)}},[]),installing:s,error:r}}function X(){const[s,n]=o.useState(null),[r,l]=o.useState(null);return{update:o.useCallback(async a=>{n(a),l(null);try{const t=await(await fetch("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update",slug:a})})).json();if(!t.ok)throw new Error(t.error||"Update failed")}catch(i){throw l(i instanceof Error?i.message:String(i)),i}finally{n(null)}},[]),updating:s,error:r}}const Y=new Set(["openclaw","clawhub","anthropic","robbyczgw-cla"]),ee=100;function U(s,n){if(n)return{type:"installed",label:"Installed"};const r=s.publisher||s.author||"",l=s.stats?.downloads||0;return Y.has(r.toLowerCase())||l>=ee?{type:"verified",label:"Verified"}:{type:"community",label:"Community"}}function $({type:s,label:n}){const r={verified:"bg-emerald-50 text-emerald-600 border-emerald-100",community:"bg-primary-50 text-primary-500 border-primary-100",installed:"bg-sky-50 text-sky-600 border-sky-100"};return e.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 text-[10px] font-medium rounded-full border ${r[s]}`,title:`${n} Skill`,children:[e.jsx(m,{icon:s==="installed"?I:F,size:10,strokeWidth:2}),n]})}function B({skill:s,installed:n,installing:r,onInstall:l,onUpdate:c,updating:a,showUpdate:i,onClick:t}){const x=s.slug||"",d=s.displayName||x,p=s.summary,h=s.version||s.latestVersion?.version||"",y=s.stats?.downloads,j=U(s,n);return e.jsxs("div",{className:`
2
2
  group rounded-lg border border-primary-100 bg-surface p-4
3
3
  transition-all duration-150 ease-out
4
4
  ${t?"cursor-pointer hover:border-primary-200 hover:shadow-sm":""}
@@ -1 +1 @@
1
- import{r as a,w as he,j as R}from"./main-xPlWrMhO.js";import{aa as J,ad as f,a9 as M,u as pe,t as ve,ab as be,ae as W,c as U}from"./button-D0n2Qsd_.js";import{u as ge}from"./useControlled-CyT-lqbs.js";import{a as V,u as C,e as G,d as ye,f as xe,g as ke,n as Ce}from"./useBaseUiId-ClbEYEil.js";import{v as Ie,a as Re}from"./visuallyHidden-COI6QeQH.js";const Q=a.createContext(void 0);function Ee(){const e=a.useContext(Q);if(e===void 0)throw new Error(J(63));return e}let H=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Ve={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},we={valid(e){return e===null?null:e?{[H.valid]:""}:{[H.invalid]:""}}};let Y=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const X={...we,checked(e){return e?{[Y.checked]:""}:{[Y.unchecked]:""}}};function Pe(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}const Me=a.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:f,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Z(){return a.useContext(Me)}const Se=a.createContext({invalid:void 0,name:void 0,validityData:{state:Ve,errors:[],error:"",value:"",initialValue:null},setValidityData:f,disabled:void 0,touched:!1,setTouched:f,dirty:!1,setDirty:f,filled:!1,setFilled:f,focused:!1,setFocused:f,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=M)=>e,getInputValidationProps:(e=M)=>e,inputRef:{current:null},commit:async()=>{}}});function S(e=!0){const t=a.useContext(Se);if(t.setValidityData===f&&!e)throw new Error(J(28));return t}function Te(e){const{enabled:t=!0,value:i,id:s,name:y,controlRef:o,commit:c}=e,{formRef:m}=Z(),{invalid:h,markedDirtyRef:p,validityData:v,setValidityData:r}=S(),n=V(e.getValue);C(()=>{if(!t)return;let l=i;l===void 0&&(l=n()),v.initialValue===null&&l!==null&&r(x=>({...x,initialValue:l}))},[t,r,i,v.initialValue,n]),C(()=>{!t||!s||m.current.fields.set(s,{getValue:n,name:y,controlRef:o,validityData:Pe(v,h),validate(l=!0){let x=i;x===void 0&&(x=n()),p.current=!0,l?he.flushSync(()=>c(x)):c(x)}})},[c,o,t,m,n,s,h,p,y,v,i]),C(()=>{const l=m.current.fields;return()=>{s&&l.delete(s)}},[m,s])}const ze=a.createContext({controlId:void 0,registerControlId:f,labelId:void 0,setLabelId:f,messageIds:[],setMessageIds:f,getDescriptionProps:e=>e});function $(){return a.useContext(ze)}function _e(e={}){const{id:t,implicit:i=!1,controlRef:s}=e,{controlId:y,registerControlId:o}=$(),c=G(t),m=i?y:void 0,h=pe(()=>Symbol("labelable-control")),p=a.useRef(!1),v=a.useRef(t!=null),r=V(()=>{!p.current||o===f||(p.current=!1,o(h.current,void 0))});return C(()=>{if(o===f)return;let n;if(i){const l=s?.current;ye(l)&&l.closest("label")!=null?n=t??null:n=m??c}else if(t!=null)v.current=!0,n=t;else if(v.current)n=c;else{r();return}if(n===void 0){r();return}p.current=!0,o(h.current,n)},[t,s,m,o,i,c,h,r]),a.useEffect(()=>r,[r]),y??c}function Be(e,t){const i=a.useRef(e),s=V(t);C(()=>{i.current!==e&&s(i.current)},[e,s]),C(()=>{i.current=e},[e])}const Fe=a.forwardRef(function(t,i){const{checked:s,className:y,defaultChecked:o,id:c,inputRef:m,name:h,nativeButton:p=!1,onCheckedChange:v,readOnly:r=!1,required:n=!1,disabled:l=!1,render:x,uncheckedValue:T,value:w,...A}=t,{clearErrors:ee}=Z(),{state:z,setTouched:te,setDirty:ne,validityData:ae,setFilled:P,setFocused:_,shouldValidateOnChange:ie,validationMode:se,disabled:re,name:le,validation:b}=S(),{labelId:de}=$(),g=re||l,k=le??h,B=V(v),I=a.useRef(null),F=ve(I,m,b.inputRef),E=a.useRef(null),K=G(),L=_e({id:c,implicit:!1,controlRef:E}),j=p?void 0:L,[d,O]=ge({controlled:s,default:!!o,name:"Switch",state:"checked"});Te({id:K,commit:b.commit,value:d,controlRef:E,name:k,getValue:()=>d}),C(()=>{I.current&&P(I.current.checked)},[I,P]),Be(d,()=>{ee(k),ne(d!==ae.initialValue),P(d),ie()?b.commit(d):b.commit(d,!0)});const{getButtonProps:oe,buttonRef:ce}=xe({disabled:g,native:p}),ue={id:p?L:K,role:"switch","aria-checked":d,"aria-readonly":r||void 0,"aria-required":n||void 0,"aria-labelledby":de,onFocus(){g||_(!0)},onBlur(){const u=I.current;!u||g||(te(!0),_(!1),se==="onBlur"&&b.commit(u.checked))},onClick(u){r||g||(u.preventDefault(),I.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:u.shiftKey,ctrlKey:u.ctrlKey,altKey:u.altKey,metaKey:u.metaKey})))}},fe=a.useMemo(()=>be({checked:d,disabled:g,id:j,name:k,required:n,style:k?Ie:Re,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:F,onChange(u){if(u.nativeEvent.defaultPrevented)return;const q=u.target.checked,D=ke(Ce,u.nativeEvent);B?.(q,D),!D.isCanceled&&O(q)},onFocus(){E.current?.focus()}},b.getInputValidationProps,w!==void 0?{value:w}:M),[d,g,F,j,k,B,n,O,b,w]),N=a.useMemo(()=>({...z,checked:d,disabled:g,readOnly:r,required:n}),[z,d,g,r,n]),me=W("span",t,{state:N,ref:[i,E,ce],props:[ue,b.getValidationProps,A,oe],stateAttributesMapping:X});return R.jsxs(Q.Provider,{value:N,children:[me,!d&&k&&T!==void 0&&R.jsx("input",{type:"hidden",name:k,value:T}),R.jsx("input",{...fe})]})}),Ke=a.forwardRef(function(t,i){const{render:s,className:y,...o}=t,{state:c}=S(),m=Ee(),h={...c,...m};return W("span",t,{state:h,ref:i,stateAttributesMapping:X,props:o})});function De({className:e,...t}){return R.jsx(Fe,{className:U("inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(5)] focus-visible:ring-2 focus-visible:ring-primary-950 focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary-900 data-unchecked:bg-primary-200 data-disabled:opacity-64 sm:[--thumb-size:--spacing(4)]",e),"data-slot":"switch",...t,children:R.jsx(Ke,{className:U("pointer-events-none block aspect-square h-full origin-left in-[[role=switch]:active,[data-slot=label]:active]:not-data-disabled:scale-x-110 in-[[role=switch]:active,[data-slot=label]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.1)] rounded-(--thumb-size) bg-primary-50 shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s] data-checked:origin-[var(--thumb-size)_50%] data-checked:translate-x-[calc(var(--thumb-size)-4px)]"),"data-slot":"switch-thumb"})})}export{De as S};
1
+ import{r as a,w as he,j as R}from"./main-CbISK-pm.js";import{aa as J,ad as f,a9 as M,u as pe,t as ve,ab as be,ae as W,c as U}from"./button-Bv-7bwZZ.js";import{u as ge}from"./useControlled-Bc2Emhlx.js";import{a as V,u as C,e as G,d as ye,f as xe,g as ke,n as Ce}from"./useBaseUiId-BdQC9KF3.js";import{v as Ie,a as Re}from"./visuallyHidden-COI6QeQH.js";const Q=a.createContext(void 0);function Ee(){const e=a.useContext(Q);if(e===void 0)throw new Error(J(63));return e}let H=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Ve={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},we={valid(e){return e===null?null:e?{[H.valid]:""}:{[H.invalid]:""}}};let Y=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const X={...we,checked(e){return e?{[Y.checked]:""}:{[Y.unchecked]:""}}};function Pe(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}const Me=a.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:f,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Z(){return a.useContext(Me)}const Se=a.createContext({invalid:void 0,name:void 0,validityData:{state:Ve,errors:[],error:"",value:"",initialValue:null},setValidityData:f,disabled:void 0,touched:!1,setTouched:f,dirty:!1,setDirty:f,filled:!1,setFilled:f,focused:!1,setFocused:f,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=M)=>e,getInputValidationProps:(e=M)=>e,inputRef:{current:null},commit:async()=>{}}});function S(e=!0){const t=a.useContext(Se);if(t.setValidityData===f&&!e)throw new Error(J(28));return t}function Te(e){const{enabled:t=!0,value:i,id:s,name:y,controlRef:o,commit:c}=e,{formRef:m}=Z(),{invalid:h,markedDirtyRef:p,validityData:v,setValidityData:r}=S(),n=V(e.getValue);C(()=>{if(!t)return;let l=i;l===void 0&&(l=n()),v.initialValue===null&&l!==null&&r(x=>({...x,initialValue:l}))},[t,r,i,v.initialValue,n]),C(()=>{!t||!s||m.current.fields.set(s,{getValue:n,name:y,controlRef:o,validityData:Pe(v,h),validate(l=!0){let x=i;x===void 0&&(x=n()),p.current=!0,l?he.flushSync(()=>c(x)):c(x)}})},[c,o,t,m,n,s,h,p,y,v,i]),C(()=>{const l=m.current.fields;return()=>{s&&l.delete(s)}},[m,s])}const ze=a.createContext({controlId:void 0,registerControlId:f,labelId:void 0,setLabelId:f,messageIds:[],setMessageIds:f,getDescriptionProps:e=>e});function $(){return a.useContext(ze)}function _e(e={}){const{id:t,implicit:i=!1,controlRef:s}=e,{controlId:y,registerControlId:o}=$(),c=G(t),m=i?y:void 0,h=pe(()=>Symbol("labelable-control")),p=a.useRef(!1),v=a.useRef(t!=null),r=V(()=>{!p.current||o===f||(p.current=!1,o(h.current,void 0))});return C(()=>{if(o===f)return;let n;if(i){const l=s?.current;ye(l)&&l.closest("label")!=null?n=t??null:n=m??c}else if(t!=null)v.current=!0,n=t;else if(v.current)n=c;else{r();return}if(n===void 0){r();return}p.current=!0,o(h.current,n)},[t,s,m,o,i,c,h,r]),a.useEffect(()=>r,[r]),y??c}function Be(e,t){const i=a.useRef(e),s=V(t);C(()=>{i.current!==e&&s(i.current)},[e,s]),C(()=>{i.current=e},[e])}const Fe=a.forwardRef(function(t,i){const{checked:s,className:y,defaultChecked:o,id:c,inputRef:m,name:h,nativeButton:p=!1,onCheckedChange:v,readOnly:r=!1,required:n=!1,disabled:l=!1,render:x,uncheckedValue:T,value:w,...A}=t,{clearErrors:ee}=Z(),{state:z,setTouched:te,setDirty:ne,validityData:ae,setFilled:P,setFocused:_,shouldValidateOnChange:ie,validationMode:se,disabled:re,name:le,validation:b}=S(),{labelId:de}=$(),g=re||l,k=le??h,B=V(v),I=a.useRef(null),F=ve(I,m,b.inputRef),E=a.useRef(null),K=G(),L=_e({id:c,implicit:!1,controlRef:E}),j=p?void 0:L,[d,O]=ge({controlled:s,default:!!o,name:"Switch",state:"checked"});Te({id:K,commit:b.commit,value:d,controlRef:E,name:k,getValue:()=>d}),C(()=>{I.current&&P(I.current.checked)},[I,P]),Be(d,()=>{ee(k),ne(d!==ae.initialValue),P(d),ie()?b.commit(d):b.commit(d,!0)});const{getButtonProps:oe,buttonRef:ce}=xe({disabled:g,native:p}),ue={id:p?L:K,role:"switch","aria-checked":d,"aria-readonly":r||void 0,"aria-required":n||void 0,"aria-labelledby":de,onFocus(){g||_(!0)},onBlur(){const u=I.current;!u||g||(te(!0),_(!1),se==="onBlur"&&b.commit(u.checked))},onClick(u){r||g||(u.preventDefault(),I.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:u.shiftKey,ctrlKey:u.ctrlKey,altKey:u.altKey,metaKey:u.metaKey})))}},fe=a.useMemo(()=>be({checked:d,disabled:g,id:j,name:k,required:n,style:k?Ie:Re,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:F,onChange(u){if(u.nativeEvent.defaultPrevented)return;const q=u.target.checked,D=ke(Ce,u.nativeEvent);B?.(q,D),!D.isCanceled&&O(q)},onFocus(){E.current?.focus()}},b.getInputValidationProps,w!==void 0?{value:w}:M),[d,g,F,j,k,B,n,O,b,w]),N=a.useMemo(()=>({...z,checked:d,disabled:g,readOnly:r,required:n}),[z,d,g,r,n]),me=W("span",t,{state:N,ref:[i,E,ce],props:[ue,b.getValidationProps,A,oe],stateAttributesMapping:X});return R.jsxs(Q.Provider,{value:N,children:[me,!d&&k&&T!==void 0&&R.jsx("input",{type:"hidden",name:k,value:T}),R.jsx("input",{...fe})]})}),Ke=a.forwardRef(function(t,i){const{render:s,className:y,...o}=t,{state:c}=S(),m=Ee(),h={...c,...m};return W("span",t,{state:h,ref:i,stateAttributesMapping:X,props:o})});function De({className:e,...t}){return R.jsx(Fe,{className:U("inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(5)] focus-visible:ring-2 focus-visible:ring-primary-950 focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary-900 data-unchecked:bg-primary-200 data-disabled:opacity-64 sm:[--thumb-size:--spacing(4)]",e),"data-slot":"switch",...t,children:R.jsx(Ke,{className:U("pointer-events-none block aspect-square h-full origin-left in-[[role=switch]:active,[data-slot=label]:active]:not-data-disabled:scale-x-110 in-[[role=switch]:active,[data-slot=label]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.1)] rounded-(--thumb-size) bg-primary-50 shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s] data-checked:origin-[var(--thumb-size)_50%] data-checked:translate-x-[calc(var(--thumb-size)-4px)]"),"data-slot":"switch-thumb"})})}export{De as S};
@@ -1 +1 @@
1
- import{r as o,j as z}from"./main-xPlWrMhO.js";import{aa as ht,ae as q,t as Rt,af as et,a9 as yt,c as Z}from"./button-D0n2Qsd_.js";import{u as Mt}from"./useControlled-CyT-lqbs.js";import{h as Et,i as Ct,a as Y,u as nt,e as St,f as wt,g as it,n as at,C as Pt}from"./useBaseUiId-ClbEYEil.js";import{C as gt,u as At,g as Ht,a as Lt,c as Dt,i as J,b as Ot,d as kt,e as zt,f as _t,h as Kt}from"./useCompositeItem-B_OxfJee.js";import{r as st,u as bt}from"./DirectionContext-X-0CRn1O.js";import{s as rt,A as Nt,a as Bt,i as lt,b as U,c as Q,H as Wt,E as jt,d as ct,e as tt,V as Ft,f as Yt,g as $t,h as Vt,M as Gt}from"./composite-GtKwZKbV.js";import{d as Ut,o as ut,e as Zt,u as Xt}from"./event-CHpdjYFR.js";import{u as qt}from"./CSPContext-CrlIQW7-.js";function Jt(){const[,t]=o.useState({});return o.useCallback(()=>{t({})},[])}function dt(t){const a=Et(t);let l=parseFloat(a.width)||0,b=parseFloat(a.height)||0;const s=Ct(t),i=s?t.offsetWidth:l,r=s?t.offsetHeight:b;return(st(l)!==i||st(b)!==r)&&(l=i,b=r),{width:l,height:b}}const pt=o.createContext(void 0);function X(){const t=o.useContext(pt);if(t===void 0)throw new Error(ht(64));return t}let Qt=(function(t){return t.activationDirection="data-activation-direction",t.orientation="data-orientation",t})({});const ot={tabActivationDirection:t=>({[Qt.activationDirection]:t})},te=o.forwardRef(function(a,l){const{className:b,defaultValue:s=0,onValueChange:i,orientation:r="horizontal",render:w,value:I,...P}=a,y=bt(),M=Object.hasOwn(a,"defaultValue"),d=o.useRef([]),[k,D]=o.useState(()=>new Map),[x,R]=Mt({controlled:I,default:s,name:"Tabs",state:"value"}),v=I!==void 0,[h,c]=o.useState(()=>new Map),[E,p]=o.useState("none"),g=Y((e,m)=>{i?.(e,m),!m.isCanceled&&(R(e),p(m.activationDirection))}),f=Y((e,m)=>{D(u=>{if(u.get(e)===m)return u;const T=new Map(u);return T.set(e,m),T})}),A=Y((e,m)=>{D(u=>{if(!u.has(e)||u.get(e)!==m)return u;const T=new Map(u);return T.delete(e),T})}),n=o.useCallback(e=>k.get(e),[k]),C=o.useCallback(e=>{for(const m of h.values())if(e===m?.value)return m?.id},[h]),O=o.useCallback(e=>{if(e===void 0)return null;for(const[m,u]of h.entries())if(u!=null&&e===(u.value??u.index))return m;return null},[h]),L=o.useMemo(()=>({direction:y,getTabElementBySelectedValue:O,getTabIdByPanelValue:C,getTabPanelIdByValue:n,onValueChange:g,orientation:r,registerMountedTabPanel:f,setTabMap:c,unregisterMountedTabPanel:A,tabActivationDirection:E,value:x}),[y,O,C,n,g,r,f,c,A,E,x]),S=o.useMemo(()=>{for(const e of h.values())if(e!=null&&e.value===x)return e},[h,x]),H=o.useMemo(()=>{for(const e of h.values())if(e!=null&&!e.disabled)return e.value},[h]);nt(()=>{if(v||h.size===0)return;const e=S?.disabled,m=S==null&&x!==null;if(M&&e&&x===s||!e&&!m)return;const T=H??null;x!==T&&(R(T),p("none"))},[s,H,M,v,S,p,R,h,x]);const K=q("div",a,{state:{orientation:r,tabActivationDirection:E},ref:l,props:P,stateAttributesMapping:ot});return z.jsx(pt.Provider,{value:L,children:z.jsx(gt,{elementsRef:d,children:K})})}),mt="data-composite-item-active",vt=o.createContext(void 0);function xt(){const t=o.useContext(vt);if(t===void 0)throw new Error(ht(65));return t}const ee=o.forwardRef(function(a,l){const{className:b,disabled:s=!1,render:i,value:r,id:w,nativeButton:I=!0,...P}=a,{value:y,getTabPanelIdByValue:M,orientation:d}=X(),{activateOnFocus:k,highlightedTabIndex:D,onTabActivation:x,setHighlightedTabIndex:R,tabsListElement:v}=xt(),h=St(w),c=o.useMemo(()=>({disabled:s,id:h,value:r}),[s,h,r]),{compositeProps:E,compositeRef:p,index:g}=At({metadata:c}),f=r===y,A=o.useRef(!1);nt(()=>{if(A.current){A.current=!1;return}if(!(f&&g>-1&&D!==g))return;const u=v;if(u!=null){const T=Ut(ut(u));if(T&&Zt(u,T))return}s||R(g)},[f,g,D,R,s,v]);const{getButtonProps:n,buttonRef:C}=wt({disabled:s,native:I,focusableWhenDisabled:!0}),O=M(r),L=o.useRef(!1),S=o.useRef(!1);function H(u){f||s||x(r,it(at,u.nativeEvent,void 0,{activationDirection:"none"}))}function _(u){f||(g>-1&&!s&&R(g),!s&&k&&(!L.current||L.current&&S.current)&&x(r,it(at,u.nativeEvent,void 0,{activationDirection:"none"})))}function K(u){if(f||s)return;L.current=!0;function T(){L.current=!1,S.current=!1}(!u.button||u.button===0)&&(S.current=!0,ut(u.currentTarget).addEventListener("pointerup",T,{once:!0}))}return q("button",a,{state:{disabled:s,active:f,orientation:d},ref:[l,C,p],props:[E,{role:"tab","aria-controls":O,"aria-selected":f,id:h,onClick:H,onFocus:_,onPointerDown:K,[mt]:f?"":void 0,onKeyDownCapture(){A.current=!0}},P,n]})}),ne='!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();';let F=(function(t){return t.activeTabLeft="--active-tab-left",t.activeTabRight="--active-tab-right",t.activeTabTop="--active-tab-top",t.activeTabBottom="--active-tab-bottom",t.activeTabWidth="--active-tab-width",t.activeTabHeight="--active-tab-height",t})({});const oe={...ot,activeTabPosition:()=>null,activeTabSize:()=>null},ie=o.forwardRef(function(a,l){const{className:b,render:s,renderBeforeHydration:i=!1,...r}=a,{nonce:w}=qt(),{getTabElementBySelectedValue:I,orientation:P,tabActivationDirection:y,value:M}=X(),{tabsListElement:d}=xt(),[k,D]=o.useState(!1),{value:x}=X();Xt(()=>D(!0));const R=Jt();o.useEffect(()=>{if(M!=null&&d!=null&&typeof ResizeObserver<"u"){const H=new ResizeObserver(R);return H.observe(d),()=>{H.disconnect()}}},[M,d,R]);let v=0,h=0,c=0,E=0,p=0,g=0,f=!1;if(M!=null&&d!=null){const H=I(M);if(f=!0,H!=null){const{width:_,height:K}=dt(H),{width:e,height:m}=dt(d),u=H.getBoundingClientRect(),T=d.getBoundingClientRect(),j=e>0?T.width/e:1,G=m>0?T.height/m:1;if(Math.abs(j)>Number.EPSILON&&Math.abs(G)>Number.EPSILON){const N=u.left-T.left,$=u.top-T.top;v=N/j+d.scrollLeft-d.clientLeft,c=$/G+d.scrollTop-d.clientTop}else v=H.offsetLeft,c=H.offsetTop;p=_,g=K,h=d.scrollWidth-v-p,E=d.scrollHeight-c-g}}const A=o.useMemo(()=>f?{left:v,right:h,top:c,bottom:E}:null,[v,h,c,E,f]),n=o.useMemo(()=>f?{width:p,height:g}:null,[p,g,f]),C=o.useMemo(()=>{if(f)return{[F.activeTabLeft]:`${v}px`,[F.activeTabRight]:`${h}px`,[F.activeTabTop]:`${c}px`,[F.activeTabBottom]:`${E}px`,[F.activeTabWidth]:`${p}px`,[F.activeTabHeight]:`${g}px`}},[v,h,c,E,p,g,f]),O=f&&p>0&&g>0,S=q("span",a,{state:{orientation:P,activeTabPosition:A,activeTabSize:n,tabActivationDirection:y},ref:l,props:[{role:"presentation",style:C,hidden:!O},r,{suppressHydrationWarning:!0}],stateAttributesMapping:oe});return x==null?null:z.jsxs(o.Fragment,{children:[S,!k&&i&&z.jsx("script",{nonce:w,dangerouslySetInnerHTML:{__html:ne},suppressHydrationWarning:!0})]})});function ae(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}const se=[];function re(t){const{itemSizes:a,cols:l=1,loopFocus:b=!0,dense:s=!1,orientation:i="both",direction:r,highlightedIndex:w,onHighlightedIndexChange:I,rootRef:P,enableHomeAndEndKeys:y=!1,stopEventPropagation:M=!1,disabledIndices:d,modifierKeys:k=se}=t,[D,x]=o.useState(0),R=l>1,v=o.useRef(null),h=Rt(v,P),c=o.useRef([]),E=o.useRef(!1),p=w??D,g=Y((n,C=!1)=>{if((I??x)(n),C){const O=c.current[n];rt(v.current,O,r,i)}}),f=Y(n=>{if(n.size===0||E.current)return;E.current=!0;const C=Array.from(n.keys()),O=C.find(S=>S?.hasAttribute(mt))??null,L=O?C.indexOf(O):-1;L!==-1&&g(L),rt(v.current,O,r,i)}),A=o.useMemo(()=>({"aria-orientation":i==="both"?void 0:i,ref:h,onFocus(n){!v.current||!lt(n.target)||n.target.setSelectionRange(0,n.target.value.length??0)},onKeyDown(n){const C=y?Nt:Bt;if(!C.has(n.key)||le(n,k)||!v.current)return;const L=r==="rtl",S=L?ct:Q,H={horizontal:S,vertical:U,both:S}[i],_=L?Q:ct,K={horizontal:_,vertical:tt,both:_}[i];if(lt(n.target)&&!ae(n.target)){const B=n.target.selectionStart,N=n.target.selectionEnd,$=n.target.value??"";if(B==null||n.shiftKey||B!==N||n.key!==K&&B<$.length||n.key!==H&&B>0)return}let e=p;const m=Ht(c,d),u=Lt(c,d);if(R){const B=a||Array.from({length:c.current.length},()=>({width:1,height:1})),N=Dt(B,l,s),$=N.findIndex(W=>W!=null&&!J(c,W,d)),Tt=N.reduce((W,V,It)=>V!=null&&!J(c,V,d)?It:W,-1);e=N[Ot({current:N.map(W=>W?c.current[W]:null)},{event:n,orientation:i,loopFocus:b,cols:l,disabledIndices:zt([...d||c.current.map((W,V)=>J(c,V)?V:void 0),void 0],N),minIndex:$,maxIndex:Tt,prevIndex:kt(p>u?m:p,B,N,l,n.key===U?"bl":n.key===Q?"tr":"tl"),rtl:L})]}const T={horizontal:[S],vertical:[U],both:[S,U]}[i],j={horizontal:[_],vertical:[tt],both:[_,tt]}[i],G=R?C:{horizontal:y?$t:Vt,vertical:y?Ft:Yt,both:C}[i];y&&(n.key===Wt?e=m:n.key===jt&&(e=u)),e===p&&(T.includes(n.key)||j.includes(n.key))&&(b&&e===u&&T.includes(n.key)?e=m:b&&e===m&&j.includes(n.key)?e=u:e=_t(c,{startingIndex:e,decrement:j.includes(n.key),disabledIndices:d})),e!==p&&!Kt(c,e)&&(M&&n.stopPropagation(),G.has(n.key)&&n.preventDefault(),g(e,!0),queueMicrotask(()=>{c.current[e]?.focus()}))}}),[l,s,r,d,c,y,p,R,a,b,h,k,g,i,M]);return o.useMemo(()=>({props:A,highlightedIndex:p,onHighlightedIndexChange:g,elementsRef:c,disabledIndices:d,onMapChange:f,relayKeyboardEvent:A.onKeyDown}),[A,p,g,c,d,f])}function le(t,a){for(const l of Gt.values())if(!a.includes(l)&&t.getModifierState(l))return!0;return!1}function ce(t){const{render:a,className:l,refs:b=et,props:s=et,state:i=yt,stateAttributesMapping:r,highlightedIndex:w,onHighlightedIndexChange:I,orientation:P,dense:y,itemSizes:M,loopFocus:d,cols:k,enableHomeAndEndKeys:D,onMapChange:x,stopEventPropagation:R=!0,rootRef:v,disabledIndices:h,modifierKeys:c,highlightItemOnHover:E=!1,tag:p="div",...g}=t,f=bt(),{props:A,highlightedIndex:n,onHighlightedIndexChange:C,elementsRef:O,onMapChange:L,relayKeyboardEvent:S}=re({itemSizes:M,cols:k,loopFocus:d,dense:y,orientation:P,highlightedIndex:w,onHighlightedIndexChange:I,rootRef:v,stopEventPropagation:R,enableHomeAndEndKeys:D,direction:f,disabledIndices:h,modifierKeys:c}),H=q(p,t,{state:i,ref:b,props:[A,...s,g],stateAttributesMapping:r}),_=o.useMemo(()=>({highlightedIndex:n,onHighlightedIndexChange:C,highlightItemOnHover:E,relayKeyboardEvent:S}),[n,C,E,S]);return z.jsx(Pt.Provider,{value:_,children:z.jsx(gt,{elementsRef:O,onMapChange:K=>{x?.(K),L(K)},children:H})})}const ue=o.forwardRef(function(a,l){const{activateOnFocus:b=!1,className:s,loopFocus:i=!0,render:r,...w}=a,{getTabElementBySelectedValue:I,onValueChange:P,orientation:y,value:M,setTabMap:d,tabActivationDirection:k}=X(),[D,x]=o.useState(0),[R,v]=o.useState(null),h=de(M,y,R,I),c=Y((f,A)=>{if(f!==M){const n=h(f);A.activationDirection=n,P(f,A)}}),E={orientation:y,tabActivationDirection:k},p={"aria-orientation":y==="vertical"?"vertical":void 0,role:"tablist"},g=o.useMemo(()=>({activateOnFocus:b,highlightedTabIndex:D,onTabActivation:c,setHighlightedTabIndex:x,tabsListElement:R,value:M}),[b,D,c,x,R,M]);return z.jsx(vt.Provider,{value:g,children:z.jsx(ce,{render:r,className:s,state:E,refs:[l,v],props:[p,w],stateAttributesMapping:ot,highlightedIndex:D,enableHomeAndEndKeys:!0,loopFocus:i,orientation:y,onHighlightedIndexChange:x,onMapChange:d,disabledIndices:et})})});function ft(t,a){const{left:l,top:b}=t.getBoundingClientRect(),{left:s,top:i}=a.getBoundingClientRect(),r=l-s,w=b-i;return{left:r,top:w}}function de(t,a,l,b){const[s,i]=o.useState(null);return nt(()=>{if(t==null||l==null){i(null);return}const r=b(t);if(r==null){i(null);return}const{left:w,top:I}=ft(r,l);i(a==="horizontal"?w:I)},[a,b,l,t]),o.useCallback(r=>{if(r===t)return"none";if(r==null)return i(null),"none";if(r!=null&&l!=null){const w=b(r);if(w!=null){const{left:I,top:P}=ft(w,l);if(s==null)return i(a==="horizontal"?I:P),"none";if(a==="horizontal"){if(I<s)return i(I),"left";if(I>s)return i(I),"right"}else{if(P<s)return i(P),"up";if(P>s)return i(P),"down"}}}return"none"},[b,a,s,l,t])}function Ie({className:t,...a}){return z.jsx(te,{className:Z("flex flex-col gap-2 data-[orientation=vertical]:flex-row",t),"data-slot":"tabs",...a})}function Re({variant:t="default",className:a,children:l,...b}){return z.jsxs(ue,{className:Z("relative z-0 flex w-fit items-center justify-center gap-x-0.5 text-primary-600","data-[orientation=vertical]:flex-col",t==="default"?"p-0.5 text-primary-600/80":"data-[orientation=vertical]:px-1 data-[orientation=horizontal]:py-1",a),"data-slot":"tabs-list",...b,children:[l,z.jsx(ie,{className:Z("-translate-y-(--active-tab-bottom) absolute bottom-0 left-0 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) transition-[width,translate] duration-200 ease-in-out",t==="underline"?"data-[orientation=vertical]:-translate-x-px z-10 bg-[var(--opencami-accent)] data-[orientation=horizontal]:h-0.5 data-[orientation=vertical]:w-0.5 data-[orientation=horizontal]:translate-y-px":"z-0 rounded-md bg-[var(--opencami-accent-light)]"),"data-slot":"tab-indicator"})]})}function ye({className:t,...a}){return z.jsx(ee,{className:Z('[&_svg]:-mx-0.5 relative z-10 flex h-8 shrink-0 grow cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-3 text-sm font-medium outline-none transition-[color,background-color,box-shadow] hover:text-primary-900 focus-visible:ring-2 focus-visible:ring-[var(--opencami-accent)] data-disabled:pointer-events-none data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start data-active:text-primary-900 data-disabled:opacity-64 [&_svg:not([class*="size-"])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0',t),"data-slot":"tabs-tab",...a})}export{Ie as T,Re as a,ye as b};
1
+ import{r as o,j as z}from"./main-CbISK-pm.js";import{aa as ht,ae as q,t as Rt,af as et,a9 as yt,c as Z}from"./button-Bv-7bwZZ.js";import{u as Mt}from"./useControlled-Bc2Emhlx.js";import{h as Et,i as Ct,a as Y,u as nt,e as St,f as wt,g as it,n as at,C as Pt}from"./useBaseUiId-BdQC9KF3.js";import{C as gt,u as At,g as Ht,a as Lt,c as Dt,i as J,b as Ot,d as kt,e as zt,f as _t,h as Kt}from"./useCompositeItem-BI09zNFD.js";import{r as st,u as bt}from"./DirectionContext-BOL0P_1j.js";import{s as rt,A as Nt,a as Bt,i as lt,b as U,c as Q,H as Wt,E as jt,d as ct,e as tt,V as Ft,f as Yt,g as $t,h as Vt,M as Gt}from"./composite-DwQIZFe9.js";import{d as Ut,o as ut,e as Zt,u as Xt}from"./event-Cnr9OETn.js";import{u as qt}from"./CSPContext-CxrBvJ99.js";function Jt(){const[,t]=o.useState({});return o.useCallback(()=>{t({})},[])}function dt(t){const a=Et(t);let l=parseFloat(a.width)||0,b=parseFloat(a.height)||0;const s=Ct(t),i=s?t.offsetWidth:l,r=s?t.offsetHeight:b;return(st(l)!==i||st(b)!==r)&&(l=i,b=r),{width:l,height:b}}const pt=o.createContext(void 0);function X(){const t=o.useContext(pt);if(t===void 0)throw new Error(ht(64));return t}let Qt=(function(t){return t.activationDirection="data-activation-direction",t.orientation="data-orientation",t})({});const ot={tabActivationDirection:t=>({[Qt.activationDirection]:t})},te=o.forwardRef(function(a,l){const{className:b,defaultValue:s=0,onValueChange:i,orientation:r="horizontal",render:w,value:I,...P}=a,y=bt(),M=Object.hasOwn(a,"defaultValue"),d=o.useRef([]),[k,D]=o.useState(()=>new Map),[x,R]=Mt({controlled:I,default:s,name:"Tabs",state:"value"}),v=I!==void 0,[h,c]=o.useState(()=>new Map),[E,p]=o.useState("none"),g=Y((e,m)=>{i?.(e,m),!m.isCanceled&&(R(e),p(m.activationDirection))}),f=Y((e,m)=>{D(u=>{if(u.get(e)===m)return u;const T=new Map(u);return T.set(e,m),T})}),A=Y((e,m)=>{D(u=>{if(!u.has(e)||u.get(e)!==m)return u;const T=new Map(u);return T.delete(e),T})}),n=o.useCallback(e=>k.get(e),[k]),C=o.useCallback(e=>{for(const m of h.values())if(e===m?.value)return m?.id},[h]),O=o.useCallback(e=>{if(e===void 0)return null;for(const[m,u]of h.entries())if(u!=null&&e===(u.value??u.index))return m;return null},[h]),L=o.useMemo(()=>({direction:y,getTabElementBySelectedValue:O,getTabIdByPanelValue:C,getTabPanelIdByValue:n,onValueChange:g,orientation:r,registerMountedTabPanel:f,setTabMap:c,unregisterMountedTabPanel:A,tabActivationDirection:E,value:x}),[y,O,C,n,g,r,f,c,A,E,x]),S=o.useMemo(()=>{for(const e of h.values())if(e!=null&&e.value===x)return e},[h,x]),H=o.useMemo(()=>{for(const e of h.values())if(e!=null&&!e.disabled)return e.value},[h]);nt(()=>{if(v||h.size===0)return;const e=S?.disabled,m=S==null&&x!==null;if(M&&e&&x===s||!e&&!m)return;const T=H??null;x!==T&&(R(T),p("none"))},[s,H,M,v,S,p,R,h,x]);const K=q("div",a,{state:{orientation:r,tabActivationDirection:E},ref:l,props:P,stateAttributesMapping:ot});return z.jsx(pt.Provider,{value:L,children:z.jsx(gt,{elementsRef:d,children:K})})}),mt="data-composite-item-active",vt=o.createContext(void 0);function xt(){const t=o.useContext(vt);if(t===void 0)throw new Error(ht(65));return t}const ee=o.forwardRef(function(a,l){const{className:b,disabled:s=!1,render:i,value:r,id:w,nativeButton:I=!0,...P}=a,{value:y,getTabPanelIdByValue:M,orientation:d}=X(),{activateOnFocus:k,highlightedTabIndex:D,onTabActivation:x,setHighlightedTabIndex:R,tabsListElement:v}=xt(),h=St(w),c=o.useMemo(()=>({disabled:s,id:h,value:r}),[s,h,r]),{compositeProps:E,compositeRef:p,index:g}=At({metadata:c}),f=r===y,A=o.useRef(!1);nt(()=>{if(A.current){A.current=!1;return}if(!(f&&g>-1&&D!==g))return;const u=v;if(u!=null){const T=Ut(ut(u));if(T&&Zt(u,T))return}s||R(g)},[f,g,D,R,s,v]);const{getButtonProps:n,buttonRef:C}=wt({disabled:s,native:I,focusableWhenDisabled:!0}),O=M(r),L=o.useRef(!1),S=o.useRef(!1);function H(u){f||s||x(r,it(at,u.nativeEvent,void 0,{activationDirection:"none"}))}function _(u){f||(g>-1&&!s&&R(g),!s&&k&&(!L.current||L.current&&S.current)&&x(r,it(at,u.nativeEvent,void 0,{activationDirection:"none"})))}function K(u){if(f||s)return;L.current=!0;function T(){L.current=!1,S.current=!1}(!u.button||u.button===0)&&(S.current=!0,ut(u.currentTarget).addEventListener("pointerup",T,{once:!0}))}return q("button",a,{state:{disabled:s,active:f,orientation:d},ref:[l,C,p],props:[E,{role:"tab","aria-controls":O,"aria-selected":f,id:h,onClick:H,onFocus:_,onPointerDown:K,[mt]:f?"":void 0,onKeyDownCapture(){A.current=!0}},P,n]})}),ne='!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();';let F=(function(t){return t.activeTabLeft="--active-tab-left",t.activeTabRight="--active-tab-right",t.activeTabTop="--active-tab-top",t.activeTabBottom="--active-tab-bottom",t.activeTabWidth="--active-tab-width",t.activeTabHeight="--active-tab-height",t})({});const oe={...ot,activeTabPosition:()=>null,activeTabSize:()=>null},ie=o.forwardRef(function(a,l){const{className:b,render:s,renderBeforeHydration:i=!1,...r}=a,{nonce:w}=qt(),{getTabElementBySelectedValue:I,orientation:P,tabActivationDirection:y,value:M}=X(),{tabsListElement:d}=xt(),[k,D]=o.useState(!1),{value:x}=X();Xt(()=>D(!0));const R=Jt();o.useEffect(()=>{if(M!=null&&d!=null&&typeof ResizeObserver<"u"){const H=new ResizeObserver(R);return H.observe(d),()=>{H.disconnect()}}},[M,d,R]);let v=0,h=0,c=0,E=0,p=0,g=0,f=!1;if(M!=null&&d!=null){const H=I(M);if(f=!0,H!=null){const{width:_,height:K}=dt(H),{width:e,height:m}=dt(d),u=H.getBoundingClientRect(),T=d.getBoundingClientRect(),j=e>0?T.width/e:1,G=m>0?T.height/m:1;if(Math.abs(j)>Number.EPSILON&&Math.abs(G)>Number.EPSILON){const N=u.left-T.left,$=u.top-T.top;v=N/j+d.scrollLeft-d.clientLeft,c=$/G+d.scrollTop-d.clientTop}else v=H.offsetLeft,c=H.offsetTop;p=_,g=K,h=d.scrollWidth-v-p,E=d.scrollHeight-c-g}}const A=o.useMemo(()=>f?{left:v,right:h,top:c,bottom:E}:null,[v,h,c,E,f]),n=o.useMemo(()=>f?{width:p,height:g}:null,[p,g,f]),C=o.useMemo(()=>{if(f)return{[F.activeTabLeft]:`${v}px`,[F.activeTabRight]:`${h}px`,[F.activeTabTop]:`${c}px`,[F.activeTabBottom]:`${E}px`,[F.activeTabWidth]:`${p}px`,[F.activeTabHeight]:`${g}px`}},[v,h,c,E,p,g,f]),O=f&&p>0&&g>0,S=q("span",a,{state:{orientation:P,activeTabPosition:A,activeTabSize:n,tabActivationDirection:y},ref:l,props:[{role:"presentation",style:C,hidden:!O},r,{suppressHydrationWarning:!0}],stateAttributesMapping:oe});return x==null?null:z.jsxs(o.Fragment,{children:[S,!k&&i&&z.jsx("script",{nonce:w,dangerouslySetInnerHTML:{__html:ne},suppressHydrationWarning:!0})]})});function ae(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}const se=[];function re(t){const{itemSizes:a,cols:l=1,loopFocus:b=!0,dense:s=!1,orientation:i="both",direction:r,highlightedIndex:w,onHighlightedIndexChange:I,rootRef:P,enableHomeAndEndKeys:y=!1,stopEventPropagation:M=!1,disabledIndices:d,modifierKeys:k=se}=t,[D,x]=o.useState(0),R=l>1,v=o.useRef(null),h=Rt(v,P),c=o.useRef([]),E=o.useRef(!1),p=w??D,g=Y((n,C=!1)=>{if((I??x)(n),C){const O=c.current[n];rt(v.current,O,r,i)}}),f=Y(n=>{if(n.size===0||E.current)return;E.current=!0;const C=Array.from(n.keys()),O=C.find(S=>S?.hasAttribute(mt))??null,L=O?C.indexOf(O):-1;L!==-1&&g(L),rt(v.current,O,r,i)}),A=o.useMemo(()=>({"aria-orientation":i==="both"?void 0:i,ref:h,onFocus(n){!v.current||!lt(n.target)||n.target.setSelectionRange(0,n.target.value.length??0)},onKeyDown(n){const C=y?Nt:Bt;if(!C.has(n.key)||le(n,k)||!v.current)return;const L=r==="rtl",S=L?ct:Q,H={horizontal:S,vertical:U,both:S}[i],_=L?Q:ct,K={horizontal:_,vertical:tt,both:_}[i];if(lt(n.target)&&!ae(n.target)){const B=n.target.selectionStart,N=n.target.selectionEnd,$=n.target.value??"";if(B==null||n.shiftKey||B!==N||n.key!==K&&B<$.length||n.key!==H&&B>0)return}let e=p;const m=Ht(c,d),u=Lt(c,d);if(R){const B=a||Array.from({length:c.current.length},()=>({width:1,height:1})),N=Dt(B,l,s),$=N.findIndex(W=>W!=null&&!J(c,W,d)),Tt=N.reduce((W,V,It)=>V!=null&&!J(c,V,d)?It:W,-1);e=N[Ot({current:N.map(W=>W?c.current[W]:null)},{event:n,orientation:i,loopFocus:b,cols:l,disabledIndices:zt([...d||c.current.map((W,V)=>J(c,V)?V:void 0),void 0],N),minIndex:$,maxIndex:Tt,prevIndex:kt(p>u?m:p,B,N,l,n.key===U?"bl":n.key===Q?"tr":"tl"),rtl:L})]}const T={horizontal:[S],vertical:[U],both:[S,U]}[i],j={horizontal:[_],vertical:[tt],both:[_,tt]}[i],G=R?C:{horizontal:y?$t:Vt,vertical:y?Ft:Yt,both:C}[i];y&&(n.key===Wt?e=m:n.key===jt&&(e=u)),e===p&&(T.includes(n.key)||j.includes(n.key))&&(b&&e===u&&T.includes(n.key)?e=m:b&&e===m&&j.includes(n.key)?e=u:e=_t(c,{startingIndex:e,decrement:j.includes(n.key),disabledIndices:d})),e!==p&&!Kt(c,e)&&(M&&n.stopPropagation(),G.has(n.key)&&n.preventDefault(),g(e,!0),queueMicrotask(()=>{c.current[e]?.focus()}))}}),[l,s,r,d,c,y,p,R,a,b,h,k,g,i,M]);return o.useMemo(()=>({props:A,highlightedIndex:p,onHighlightedIndexChange:g,elementsRef:c,disabledIndices:d,onMapChange:f,relayKeyboardEvent:A.onKeyDown}),[A,p,g,c,d,f])}function le(t,a){for(const l of Gt.values())if(!a.includes(l)&&t.getModifierState(l))return!0;return!1}function ce(t){const{render:a,className:l,refs:b=et,props:s=et,state:i=yt,stateAttributesMapping:r,highlightedIndex:w,onHighlightedIndexChange:I,orientation:P,dense:y,itemSizes:M,loopFocus:d,cols:k,enableHomeAndEndKeys:D,onMapChange:x,stopEventPropagation:R=!0,rootRef:v,disabledIndices:h,modifierKeys:c,highlightItemOnHover:E=!1,tag:p="div",...g}=t,f=bt(),{props:A,highlightedIndex:n,onHighlightedIndexChange:C,elementsRef:O,onMapChange:L,relayKeyboardEvent:S}=re({itemSizes:M,cols:k,loopFocus:d,dense:y,orientation:P,highlightedIndex:w,onHighlightedIndexChange:I,rootRef:v,stopEventPropagation:R,enableHomeAndEndKeys:D,direction:f,disabledIndices:h,modifierKeys:c}),H=q(p,t,{state:i,ref:b,props:[A,...s,g],stateAttributesMapping:r}),_=o.useMemo(()=>({highlightedIndex:n,onHighlightedIndexChange:C,highlightItemOnHover:E,relayKeyboardEvent:S}),[n,C,E,S]);return z.jsx(Pt.Provider,{value:_,children:z.jsx(gt,{elementsRef:O,onMapChange:K=>{x?.(K),L(K)},children:H})})}const ue=o.forwardRef(function(a,l){const{activateOnFocus:b=!1,className:s,loopFocus:i=!0,render:r,...w}=a,{getTabElementBySelectedValue:I,onValueChange:P,orientation:y,value:M,setTabMap:d,tabActivationDirection:k}=X(),[D,x]=o.useState(0),[R,v]=o.useState(null),h=de(M,y,R,I),c=Y((f,A)=>{if(f!==M){const n=h(f);A.activationDirection=n,P(f,A)}}),E={orientation:y,tabActivationDirection:k},p={"aria-orientation":y==="vertical"?"vertical":void 0,role:"tablist"},g=o.useMemo(()=>({activateOnFocus:b,highlightedTabIndex:D,onTabActivation:c,setHighlightedTabIndex:x,tabsListElement:R,value:M}),[b,D,c,x,R,M]);return z.jsx(vt.Provider,{value:g,children:z.jsx(ce,{render:r,className:s,state:E,refs:[l,v],props:[p,w],stateAttributesMapping:ot,highlightedIndex:D,enableHomeAndEndKeys:!0,loopFocus:i,orientation:y,onHighlightedIndexChange:x,onMapChange:d,disabledIndices:et})})});function ft(t,a){const{left:l,top:b}=t.getBoundingClientRect(),{left:s,top:i}=a.getBoundingClientRect(),r=l-s,w=b-i;return{left:r,top:w}}function de(t,a,l,b){const[s,i]=o.useState(null);return nt(()=>{if(t==null||l==null){i(null);return}const r=b(t);if(r==null){i(null);return}const{left:w,top:I}=ft(r,l);i(a==="horizontal"?w:I)},[a,b,l,t]),o.useCallback(r=>{if(r===t)return"none";if(r==null)return i(null),"none";if(r!=null&&l!=null){const w=b(r);if(w!=null){const{left:I,top:P}=ft(w,l);if(s==null)return i(a==="horizontal"?I:P),"none";if(a==="horizontal"){if(I<s)return i(I),"left";if(I>s)return i(I),"right"}else{if(P<s)return i(P),"up";if(P>s)return i(P),"down"}}}return"none"},[b,a,s,l,t])}function Ie({className:t,...a}){return z.jsx(te,{className:Z("flex flex-col gap-2 data-[orientation=vertical]:flex-row",t),"data-slot":"tabs",...a})}function Re({variant:t="default",className:a,children:l,...b}){return z.jsxs(ue,{className:Z("relative z-0 flex w-fit items-center justify-center gap-x-0.5 text-primary-600","data-[orientation=vertical]:flex-col",t==="default"?"p-0.5 text-primary-600/80":"data-[orientation=vertical]:px-1 data-[orientation=horizontal]:py-1",a),"data-slot":"tabs-list",...b,children:[l,z.jsx(ie,{className:Z("-translate-y-(--active-tab-bottom) absolute bottom-0 left-0 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) transition-[width,translate] duration-200 ease-in-out",t==="underline"?"data-[orientation=vertical]:-translate-x-px z-10 bg-[var(--opencami-accent)] data-[orientation=horizontal]:h-0.5 data-[orientation=vertical]:w-0.5 data-[orientation=horizontal]:translate-y-px":"z-0 rounded-md bg-[var(--opencami-accent-light)]"),"data-slot":"tab-indicator"})]})}function ye({className:t,...a}){return z.jsx(ee,{className:Z('[&_svg]:-mx-0.5 relative z-10 flex h-8 shrink-0 grow cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-3 text-sm font-medium outline-none transition-[color,background-color,box-shadow] hover:text-primary-900 focus-visible:ring-2 focus-visible:ring-[var(--opencami-accent)] data-disabled:pointer-events-none data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start data-active:text-primary-900 data-disabled:opacity-64 [&_svg:not([class*="size-"])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0',t),"data-slot":"tabs-tab",...a})}export{Ie as T,Re as a,ye as b};
@@ -1 +1 @@
1
- import{j as t,r as s}from"./main-xPlWrMhO.js";import{C as a,a as m,b as p}from"./_sessionKey-yNQ57svB.js";import{H as l,T as c,B as d}from"./button-D0n2Qsd_.js";import"./useQuery-k6EMRoMD.js";import"./tooltip-CcIdgcV0.js";import"./useOnFirstRender-CR_o2MK_.js";import"./useBaseUiId-ClbEYEil.js";import"./event-CHpdjYFR.js";import"./visuallyHidden-COI6QeQH.js";import"./DirectionContext-X-0CRn1O.js";import"./useMutation-eQUrsn-X.js";import"./use-file-explorer-state-CN_IJGcd.js";import"./composite-GtKwZKbV.js";import"./react-BgjQyJHw.js";import"./useControlled-CyT-lqbs.js";import"./CSPContext-CrlIQW7-.js";import"./menu-BnSEqetd.js";import"./useCompositeItem-B_OxfJee.js";import"./opencami-logo-B_hLbomw.js";import"./proxy-BnlGpgC1.js";import"./markdown-3Js_RbUp.js";import"./index-CTT0Y1ya.js";import"./index-T4TOjvD0.js";function x(){const[i,e]=s.useState(()=>typeof window<"u"?window.innerWidth<768:!1);return s.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia("(max-width: 767px)"),o=n=>e(n.matches);return r.addEventListener("change",o),e(r.matches),()=>r.removeEventListener("change",o)},[]),i}function P({content:i}){const e=x();return t.jsx("div",{className:"inline-flex flex-col",children:t.jsxs(a,{defaultOpen:!e,children:[t.jsxs(m,{render:t.jsx(d,{variant:"ghost",className:"h-auto gap-1.5 px-1.5 py-0.5 -mx-2"}),children:[t.jsx("span",{className:"text-sm font-medium text-primary-900",children:"Thinking"}),t.jsx(l,{icon:c,size:14,strokeWidth:1.5,className:"text-primary-900 transition-transform duration-150 group-data-panel-open:rotate-180"})]}),t.jsx(p,{children:t.jsx("div",{className:"pt-1 mb-3",children:t.jsx("p",{className:"text-sm text-primary-700 whitespace-pre-wrap",children:i})})})]})})}export{P as Thinking};
1
+ import{j as t,r as s}from"./main-CbISK-pm.js";import{C as a,a as m,b as p}from"./_sessionKey-CTtu2ipR.js";import{H as l,T as c,B as d}from"./button-Bv-7bwZZ.js";import"./useQuery-_BEWdUe1.js";import"./tooltip-DzFgDY86.js";import"./useOnFirstRender-DpB3w0o4.js";import"./useBaseUiId-BdQC9KF3.js";import"./event-Cnr9OETn.js";import"./visuallyHidden-COI6QeQH.js";import"./DirectionContext-BOL0P_1j.js";import"./useMutation-CMp81lDO.js";import"./use-file-explorer-state-Dwhw6Mpg.js";import"./composite-DwQIZFe9.js";import"./react-C_7UlEtd.js";import"./useControlled-Bc2Emhlx.js";import"./CSPContext-CxrBvJ99.js";import"./menu-DRjoHFvG.js";import"./useCompositeItem-BI09zNFD.js";import"./opencami-logo-D2mv84sX.js";import"./proxy-DtxqfBHY.js";import"./index-BZxJSF4T.js";import"./markdown-UD7RzskQ.js";import"./index-T4TOjvD0.js";function x(){const[i,e]=s.useState(()=>typeof window<"u"?window.innerWidth<768:!1);return s.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia("(max-width: 767px)"),o=n=>e(n.matches);return r.addEventListener("change",o),e(r.matches),()=>r.removeEventListener("change",o)},[]),i}function P({content:i}){const e=x();return t.jsx("div",{className:"inline-flex flex-col",children:t.jsxs(a,{defaultOpen:!e,children:[t.jsxs(m,{render:t.jsx(d,{variant:"ghost",className:"h-auto gap-1.5 px-1.5 py-0.5 -mx-2"}),children:[t.jsx("span",{className:"text-sm font-medium text-primary-900",children:"Thinking"}),t.jsx(l,{icon:c,size:14,strokeWidth:1.5,className:"text-primary-900 transition-transform duration-150 group-data-panel-open:rotate-180"})]}),t.jsx(p,{children:t.jsx("div",{className:"pt-1 mb-3",children:t.jsx("p",{className:"text-sm text-primary-700 whitespace-pre-wrap",children:i})})})]})})}export{P as Thinking};
@@ -1 +1 @@
1
- import{r as y,j as U,w as Ue}from"./main-xPlWrMhO.js";import{u as at,a9 as $n,aa as ze,ae as ut,c as Qt}from"./button-D0n2Qsd_.js";import{a as Jt,I as $e,c as Zt,Z as Wn,g as en,d as ft,N as tn,b as ye,S as jn,_ as Nn,R as Yn,h as _n,r as Xn,j as Un,k as pe,l as zn,m as qn,o as Gn,q as Kn,s as Qn,v as Jn,$ as Zn,x as eo,y as to,a0 as no,a1 as oo,P as ro,p as nn,e as so,t as io}from"./useOnFirstRender-CR_o2MK_.js";import{u as z,g as _,n as on,a as X,z as re,E as it,d as j,F as ue,G as Bt,h as ce,i as le,H as rn,I as dt,x as Pe,w as We,J as co,K as sn,L as lo,B as gt,A as pt,M as qe,p as ao,q as Fe,t as cn,r as ln,m as oe,N as uo,v as fo,e as go}from"./useBaseUiId-ClbEYEil.js";import{i as Oe,k as Ge,e as Z,d as Vt,q as je,g as po,r as mo,o as ve,t as ho,v as yo,u as vo,T as xo}from"./event-CHpdjYFR.js";import{e as ae,g as Q,a as ee,b as wo,c as Ro,d as bo,h as Eo,i as Ee,m as Ae,j as K,s as Co,k as an,l as un,n as Ne,o as fn,p as ct,q as dn,t as se,f as ke,r as Ye,u as So}from"./DirectionContext-X-0CRn1O.js";const _e={isSidebarCollapsed:!1},gn=["chat","ui"];function ns(t){const e=t.getQueryData(gn);return e&&typeof e=="object"?{..._e,...e}:_e}function os(t,e){t.setQueryData(gn,function(o){const r=o&&typeof o=="object"?{..._e,...o}:_e;return e(r)})}function He(t,e,n){if(n&&!Oe(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const o=t();return typeof o=="number"?o:o?.[e]}return t?.[e]}const pn=y.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new $e,currentIdRef:{current:null},currentContextRef:{current:null}});function To(t){const{children:e,delay:n,timeoutMs:o=0}=t,r=y.useRef(n),s=y.useRef(n),i=y.useRef(null),c=y.useRef(null),f=Jt();return U.jsx(pn.Provider,{value:y.useMemo(()=>({hasProvider:!0,delayRef:r,initialDelayRef:s,currentIdRef:i,timeoutMs:o,currentContextRef:c,timeout:f}),[o,f]),children:e})}function Po(t,e={open:!1}){const n="rootStore"in t?t.rootStore:t,o=n.useState("floatingId"),{open:r}=e,s=y.useContext(pn),{currentIdRef:i,delayRef:c,timeoutMs:f,initialDelayRef:a,currentContextRef:u,hasProvider:p,timeout:m}=s,[g,l]=y.useState(!1);return z(()=>{function d(){l(!1),u.current?.setIsInstantPhase(!1),i.current=null,u.current=null,c.current=a.current}if(i.current&&!r&&i.current===o){if(l(!1),f){const h=o;return m.start(f,()=>{n.select("open")||i.current&&i.current!==h||d()}),()=>{m.clear()}}d()}},[r,o,i,c,f,a,u,m,n]),z(()=>{if(!r)return;const d=u.current,h=i.current;m.clear(),u.current={onOpenChange:n.setOpen,setIsInstantPhase:l},i.current=o,c.current={open:0,close:He(a.current,"close")},h!==null&&h!==o?(l(!0),d?.setIsInstantPhase(!0),d?.onOpenChange(!1,_(on))):(l(!1),d?.setIsInstantPhase(!1))},[r,o,n,i,c,f,a,u,m]),z(()=>()=>{u.current=null},[u]),y.useMemo(()=>({hasProvider:p,delayRef:c,isInstantPhase:g}),[p,c,g])}function Oo(t,e){let n=null,o=null,r=!1;return{contextElement:t||void 0,getBoundingClientRect(){const s=t?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i=e.axis==="x"||e.axis==="both",c=e.axis==="y"||e.axis==="both",f=["mouseenter","mousemove"].includes(e.dataRef.current.openEvent?.type||"")&&e.pointerType!=="touch";let a=s.width,u=s.height,p=s.x,m=s.y;return n==null&&e.x&&i&&(n=s.x-e.x),o==null&&e.y&&c&&(o=s.y-e.y),p-=n||0,m-=o||0,a=0,u=0,!r||f?(a=e.axis==="y"?s.width:0,u=e.axis==="x"?s.height:0,p=i&&e.x!=null?e.x:p,m=c&&e.y!=null?e.y:m):r&&!f&&(u=e.axis==="x"?s.height:u,a=e.axis==="y"?s.width:a),r=!0,{width:a,height:u,x:p,y:m,top:m,right:p+a,bottom:m+u,left:p}}}}function $t(t){return t!=null&&t.clientX!=null}function Ao(t,e={}){const n="rootStore"in t?t.rootStore:t,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{enabled:c=!0,axis:f="both"}=e,a=y.useRef(!1),u=y.useRef(null),[p,m]=y.useState(),[g,l]=y.useState([]),d=X((x,S,E)=>{a.current||i.current.openEvent&&!$t(i.current.openEvent)||n.set("positionReference",Oo(E??s,{x,y:S,axis:f,dataRef:i,pointerType:p}))}),h=X(x=>{o?u.current||l([]):d(x.clientX,x.clientY,x.currentTarget)}),v=Oe(p)?r:o,R=y.useCallback(()=>{if(!v||!c)return;const x=re(r);function S(E){const T=Ge(E);Z(r,T)?(x.removeEventListener("mousemove",S),u.current=null):d(E.clientX,E.clientY)}if(!i.current.openEvent||$t(i.current.openEvent)){x.addEventListener("mousemove",S);const E=()=>{x.removeEventListener("mousemove",S),u.current=null};return u.current=E,E}n.set("positionReference",s)},[v,c,r,i,s,n,d]);y.useEffect(()=>R(),[R,g]),y.useEffect(()=>{c&&!r&&(a.current=!1)},[c,r]),y.useEffect(()=>{!c&&o&&(a.current=!0)},[c,o]);const w=y.useMemo(()=>{function x(S){m(S.pointerType)}return{onPointerDown:x,onPointerEnter:x,onMouseMove:h,onMouseEnter:h}},[h]);return y.useMemo(()=>c?{reference:w,trigger:w}:{},[c,w])}function Wt(t,e,n){let{reference:o,floating:r}=t;const s=ee(e),i=an(e),c=fn(i),f=Q(e),a=s==="y",u=o.x+o.width/2-r.width/2,p=o.y+o.height/2-r.height/2,m=o[c]/2-r[c]/2;let g;switch(f){case"top":g={x:u,y:o.y-r.height};break;case"bottom":g={x:u,y:o.y+o.height};break;case"right":g={x:o.x+o.width,y:p};break;case"left":g={x:o.x-r.width,y:p};break;default:g={x:o.x,y:o.y}}switch(Ee(e)){case"start":g[i]-=m*(n&&a?-1:1);break;case"end":g[i]+=m*(n&&a?-1:1);break}return g}async function Mo(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:s,rects:i,elements:c,strategy:f}=t,{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:m=!1,padding:g=0}=ae(e,t),l=un(g),h=c[m?p==="floating"?"reference":"floating":p],v=Ne(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(h)))==null||n?h:h.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:a,rootBoundary:u,strategy:f})),R=p==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),x=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},S=Ne(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:R,offsetParent:w,strategy:f}):R);return{top:(v.top-S.top+l.top)/x.y,bottom:(S.bottom-v.bottom+l.bottom)/x.y,left:(v.left-S.left+l.left)/x.x,right:(S.right-v.right+l.right)/x.x}}const Lo=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),f=await(i.isRTL==null?void 0:i.isRTL(e));let a=await i.getElementRects({reference:t,floating:e,strategy:r}),{x:u,y:p}=Wt(a,o,f),m=o,g={},l=0;for(let h=0;h<c.length;h++){var d;const{name:v,fn:R}=c[h],{x:w,y:x,data:S,reset:E}=await R({x:u,y:p,initialPlacement:o,placement:m,strategy:r,middlewareData:g,rects:a,platform:{...i,detectOverflow:(d=i.detectOverflow)!=null?d:Mo},elements:{reference:t,floating:e}});u=w??u,p=x??p,g={...g,[v]:{...g[v],...S}},E&&l<=50&&(l++,typeof E=="object"&&(E.placement&&(m=E.placement),E.rects&&(a=E.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:r}):E.rects),{x:u,y:p}=Wt(a,m,f)),h=-1)}return{x:u,y:p,placement:m,strategy:r,middlewareData:g}},Do=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:c,platform:f,elements:a}=e,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:l="none",flipAlignment:d=!0,...h}=ae(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=Q(r),R=ee(c),w=Q(c)===c,x=await(f.isRTL==null?void 0:f.isRTL(a.floating)),S=m||(w||!d?[wo(c)]:Ro(c)),E=l!=="none";!m&&E&&S.push(...bo(c,d,l,x));const T=[c,...S],M=await f.detectOverflow(e,h),H=[];let O=((o=s.flip)==null?void 0:o.overflows)||[];if(u&&H.push(M[v]),p){const A=Eo(r,i,x);H.push(M[A[0]],M[A[1]])}if(O=[...O,{placement:r,overflows:H}],!H.every(A=>A<=0)){var I,P;const A=(((I=s.flip)==null?void 0:I.index)||0)+1,D=T[A];if(D&&(!(p==="alignment"?R!==ee(D):!1)||O.every(C=>ee(C.placement)===R?C.overflows[0]>0:!0)))return{data:{index:A,overflows:O},reset:{placement:D}};let k=(P=O.filter(F=>F.overflows[0]<=0).sort((F,C)=>F.overflows[1]-C.overflows[1])[0])==null?void 0:P.placement;if(!k)switch(g){case"bestFit":{var b;const F=(b=O.filter(C=>{if(E){const L=ee(C.placement);return L===R||L==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(L=>L>0).reduce((L,V)=>L+V,0)]).sort((C,L)=>C[1]-L[1])[0])==null?void 0:b[0];F&&(k=F);break}case"initialPlacement":k=c;break}if(r!==k)return{reset:{placement:k}}}return{}}}};function jt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Nt(t){return Co.some(e=>t[e]>=0)}const Io=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:o}=e,{strategy:r="referenceHidden",...s}=ae(t,e);switch(r){case"referenceHidden":{const i=await o.detectOverflow(e,{...s,elementContext:"reference"}),c=jt(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Nt(c)}}}case"escaped":{const i=await o.detectOverflow(e,{...s,altBoundary:!0}),c=jt(i,n.floating);return{data:{escapedOffsets:c,escaped:Nt(c)}}}default:return{}}}}},mn=new Set(["left","top"]);async function ko(t,e){const{placement:n,platform:o,elements:r}=t,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=Q(n),c=Ee(n),f=ee(n)==="y",a=mn.has(i)?-1:1,u=s&&f?-1:1,p=ae(e,t);let{mainAxis:m,crossAxis:g,alignmentAxis:l}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof l=="number"&&(g=c==="end"?l*-1:l),f?{x:g*u,y:m*a}:{x:m*a,y:g*u}}const Fo=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:s,placement:i,middlewareData:c}=e,f=await ko(e,t);return i===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+f.x,y:s+f.y,data:{...f,placement:i}}}}},Ho=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r,platform:s}=e,{mainAxis:i=!0,crossAxis:c=!1,limiter:f={fn:v=>{let{x:R,y:w}=v;return{x:R,y:w}}},...a}=ae(t,e),u={x:n,y:o},p=await s.detectOverflow(e,a),m=ee(Q(r)),g=dn(m);let l=u[g],d=u[m];if(i){const v=g==="y"?"top":"left",R=g==="y"?"bottom":"right",w=l+p[v],x=l-p[R];l=ct(w,l,x)}if(c){const v=m==="y"?"top":"left",R=m==="y"?"bottom":"right",w=d+p[v],x=d-p[R];d=ct(w,d,x)}const h=f.fn({...e,[g]:l,[m]:d});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[g]:i,[m]:c}}}}}},Bo=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:r,rects:s,middlewareData:i}=e,{offset:c=0,mainAxis:f=!0,crossAxis:a=!0}=ae(t,e),u={x:n,y:o},p=ee(r),m=dn(p);let g=u[m],l=u[p];const d=ae(c,e),h=typeof d=="number"?{mainAxis:d,crossAxis:0}:{mainAxis:0,crossAxis:0,...d};if(f){const w=m==="y"?"height":"width",x=s.reference[m]-s.floating[w]+h.mainAxis,S=s.reference[m]+s.reference[w]-h.mainAxis;g<x?g=x:g>S&&(g=S)}if(a){var v,R;const w=m==="y"?"width":"height",x=mn.has(Q(r)),S=s.reference[p]-s.floating[w]+(x&&((v=i.offset)==null?void 0:v[p])||0)+(x?0:h.crossAxis),E=s.reference[p]+s.reference[w]+(x?0:((R=i.offset)==null?void 0:R[p])||0)-(x?h.crossAxis:0);l<S?l=S:l>E&&(l=E)}return{[m]:g,[p]:l}}}},Vo=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:s,platform:i,elements:c}=e,{apply:f=()=>{},...a}=ae(t,e),u=await i.detectOverflow(e,a),p=Q(r),m=Ee(r),g=ee(r)==="y",{width:l,height:d}=s.floating;let h,v;p==="top"||p==="bottom"?(h=p,v=m===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(v=p,h=m==="end"?"top":"bottom");const R=d-u.top-u.bottom,w=l-u.left-u.right,x=Ae(d-u[h],R),S=Ae(l-u[v],w),E=!e.middlewareData.shift;let T=x,M=S;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(M=w),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(T=R),E&&!m){const O=K(u.left,0),I=K(u.right,0),P=K(u.top,0),b=K(u.bottom,0);g?M=l-2*(O!==0||I!==0?O+I:K(u.left,u.right)):T=d-2*(P!==0||b!==0?P+b:K(u.top,u.bottom))}await f({...e,availableWidth:M,availableHeight:T});const H=await i.getDimensions(c.floating);return l!==H.width||d!==H.height?{reset:{rects:!0}}:{}}}};function hn(t){const e=ce(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=le(t),s=r?t.offsetWidth:n,i=r?t.offsetHeight:o,c=Ye(n)!==s||Ye(o)!==i;return c&&(n=s,o=i),{width:n,height:o,$:c}}function mt(t){return j(t)?t:t.contextElement}function be(t){const e=mt(t);if(!le(e))return se(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:s}=hn(e);let i=(s?Ye(n.width):n.width)/o,c=(s?Ye(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const $o=se(0);function yn(t){const e=re(t);return!rn()||!e.visualViewport?$o:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Wo(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==re(t)?!1:e}function xe(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),s=mt(t);let i=se(1);e&&(o?j(o)&&(i=be(o)):i=be(t));const c=Wo(s,n,o)?yn(s):se(0);let f=(r.left+c.x)/i.x,a=(r.top+c.y)/i.y,u=r.width/i.x,p=r.height/i.y;if(s){const m=re(s),g=o&&j(o)?re(o):o;let l=m,d=Bt(l);for(;d&&o&&g!==l;){const h=be(d),v=d.getBoundingClientRect(),R=ce(d),w=v.left+(d.clientLeft+parseFloat(R.paddingLeft))*h.x,x=v.top+(d.clientTop+parseFloat(R.paddingTop))*h.y;f*=h.x,a*=h.y,u*=h.x,p*=h.y,f+=w,a+=x,l=re(d),d=Bt(l)}}return Ne({width:u,height:p,x:f,y:a})}function Ke(t,e){const n=qe(t).scrollLeft;return e?e.left+n:xe(ue(t)).left+n}function vn(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-Ke(t,n),r=n.top+e.scrollTop;return{x:o,y:r}}function jo(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const s=r==="fixed",i=ue(o),c=e?dt(e.floating):!1;if(o===i||c&&s)return n;let f={scrollLeft:0,scrollTop:0},a=se(1);const u=se(0),p=le(o);if((p||!p&&!s)&&((gt(o)!=="body"||pt(i))&&(f=qe(o)),le(o))){const g=xe(o);a=be(o),u.x=g.x+o.clientLeft,u.y=g.y+o.clientTop}const m=i&&!p&&!s?vn(i,f):se(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-f.scrollLeft*a.x+u.x+m.x,y:n.y*a.y-f.scrollTop*a.y+u.y+m.y}}function No(t){return Array.from(t.getClientRects())}function Yo(t){const e=ue(t),n=qe(t),o=t.ownerDocument.body,r=K(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),s=K(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+Ke(t);const c=-n.scrollTop;return ce(o).direction==="rtl"&&(i+=K(e.clientWidth,o.clientWidth)-r),{width:r,height:s,x:i,y:c}}const Yt=25;function _o(t,e){const n=re(t),o=ue(t),r=n.visualViewport;let s=o.clientWidth,i=o.clientHeight,c=0,f=0;if(r){s=r.width,i=r.height;const u=rn();(!u||u&&e==="fixed")&&(c=r.offsetLeft,f=r.offsetTop)}const a=Ke(o);if(a<=0){const u=o.ownerDocument,p=u.body,m=getComputedStyle(p),g=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,l=Math.abs(o.clientWidth-p.clientWidth-g);l<=Yt&&(s-=l)}else a<=Yt&&(s+=a);return{width:s,height:i,x:c,y:f}}const Xo=new Set(["absolute","fixed"]);function Uo(t,e){const n=xe(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,s=le(t)?be(t):se(1),i=t.clientWidth*s.x,c=t.clientHeight*s.y,f=r*s.x,a=o*s.y;return{width:i,height:c,x:f,y:a}}function _t(t,e,n){let o;if(e==="viewport")o=_o(t,n);else if(e==="document")o=Yo(ue(t));else if(j(e))o=Uo(e,n);else{const r=yn(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Ne(o)}function xn(t,e){const n=Pe(t);return n===e||!j(n)||We(n)?!1:ce(n).position==="fixed"||xn(n,e)}function zo(t,e){const n=e.get(t);if(n)return n;let o=it(t,[],!1).filter(c=>j(c)&&gt(c)!=="body"),r=null;const s=ce(t).position==="fixed";let i=s?Pe(t):t;for(;j(i)&&!We(i);){const c=ce(i),f=sn(i);!f&&c.position==="fixed"&&(r=null),(s?!f&&!r:!f&&c.position==="static"&&!!r&&Xo.has(r.position)||pt(i)&&!f&&xn(t,i))?o=o.filter(u=>u!==i):r=c,i=Pe(i)}return e.set(t,o),o}function qo(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const i=[...n==="clippingAncestors"?dt(e)?[]:zo(e,this._c):[].concat(n),o],c=i[0],f=i.reduce((a,u)=>{const p=_t(e,u,r);return a.top=K(p.top,a.top),a.right=Ae(p.right,a.right),a.bottom=Ae(p.bottom,a.bottom),a.left=K(p.left,a.left),a},_t(e,c,r));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function Go(t){const{width:e,height:n}=hn(t);return{width:e,height:n}}function Ko(t,e,n){const o=le(e),r=ue(e),s=n==="fixed",i=xe(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const f=se(0);function a(){f.x=Ke(r)}if(o||!o&&!s)if((gt(e)!=="body"||pt(r))&&(c=qe(e)),o){const g=xe(e,!0,s,e);f.x=g.x+e.clientLeft,f.y=g.y+e.clientTop}else r&&a();s&&!o&&r&&a();const u=r&&!o&&!s?vn(r,c):se(0),p=i.left+c.scrollLeft-f.x-u.x,m=i.top+c.scrollTop-f.y-u.y;return{x:p,y:m,width:i.width,height:i.height}}function nt(t){return ce(t).position==="static"}function Xt(t,e){if(!le(t)||ce(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return ue(t)===n&&(n=n.ownerDocument.body),n}function wn(t,e){const n=re(t);if(dt(t))return n;if(!le(t)){let r=Pe(t);for(;r&&!We(r);){if(j(r)&&!nt(r))return r;r=Pe(r)}return n}let o=Xt(t,e);for(;o&&co(o)&&nt(o);)o=Xt(o,e);return o&&We(o)&&nt(o)&&!sn(o)?n:o||lo(t)||n}const Qo=async function(t){const e=this.getOffsetParent||wn,n=this.getDimensions,o=await n(t.floating);return{reference:Ko(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Jo(t){return ce(t).direction==="rtl"}const Zo={convertOffsetParentRelativeRectToViewportRelativeRect:jo,getDocumentElement:ue,getClippingRect:qo,getOffsetParent:wn,getElementRects:Qo,getClientRects:No,getDimensions:Go,getScale:be,isElement:j,isRTL:Jo};function Rn(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function er(t,e){let n=null,o;const r=ue(t);function s(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function i(c,f){c===void 0&&(c=!1),f===void 0&&(f=1),s();const a=t.getBoundingClientRect(),{left:u,top:p,width:m,height:g}=a;if(c||e(),!m||!g)return;const l=ke(p),d=ke(r.clientWidth-(u+m)),h=ke(r.clientHeight-(p+g)),v=ke(u),w={rootMargin:-l+"px "+-d+"px "+-h+"px "+-v+"px",threshold:K(0,Ae(1,f))||1};let x=!0;function S(E){const T=E[0].intersectionRatio;if(T!==f){if(!x)return i();T?i(!1,T):o=setTimeout(()=>{i(!1,1e-7)},1e3)}T===1&&!Rn(a,t.getBoundingClientRect())&&i(),x=!1}try{n=new IntersectionObserver(S,{...w,root:r.ownerDocument})}catch{n=new IntersectionObserver(S,w)}n.observe(t)}return i(!0),s}function Ut(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:f=!1}=o,a=mt(t),u=r||s?[...a?it(a):[],...it(e)]:[];u.forEach(v=>{r&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const p=a&&c?er(a,n):null;let m=-1,g=null;i&&(g=new ResizeObserver(v=>{let[R]=v;R&&R.target===a&&g&&(g.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=g)==null||w.observe(e)})),n()}),a&&!f&&g.observe(a),g.observe(e));let l,d=f?xe(t):null;f&&h();function h(){const v=xe(t);d&&!Rn(d,v)&&n(),d=v,l=requestAnimationFrame(h)}return n(),()=>{var v;u.forEach(R=>{r&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),p?.(),(v=g)==null||v.disconnect(),g=null,f&&cancelAnimationFrame(l)}}const tr=Fo,nr=Ho,or=Do,rr=Vo,sr=Io,ir=Bo,cr=(t,e,n)=>{const o=new Map,r={platform:Zo,...n},s={...r.platform,_c:o};return Lo(t,e,{...r,platform:s})};var lr=typeof document<"u",ar=function(){},Be=lr?y.useLayoutEffect:ar;function Xe(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,r;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!Xe(t[o],e[o]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&t.$$typeof)&&!Xe(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function bn(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function zt(t,e){const n=bn(t);return Math.round(e*n)/n}function ot(t){const e=y.useRef(t);return Be(()=>{e.current=t}),e}function ur(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:f,open:a}=t,[u,p]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,g]=y.useState(o);Xe(m,o)||g(o);const[l,d]=y.useState(null),[h,v]=y.useState(null),R=y.useCallback(C=>{C!==E.current&&(E.current=C,d(C))},[]),w=y.useCallback(C=>{C!==T.current&&(T.current=C,v(C))},[]),x=s||l,S=i||h,E=y.useRef(null),T=y.useRef(null),M=y.useRef(u),H=f!=null,O=ot(f),I=ot(r),P=ot(a),b=y.useCallback(()=>{if(!E.current||!T.current)return;const C={placement:e,strategy:n,middleware:m};I.current&&(C.platform=I.current),cr(E.current,T.current,C).then(L=>{const V={...L,isPositioned:P.current!==!1};A.current&&!Xe(M.current,V)&&(M.current=V,Ue.flushSync(()=>{p(V)}))})},[m,e,n,I,P]);Be(()=>{a===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,p(C=>({...C,isPositioned:!1})))},[a]);const A=y.useRef(!1);Be(()=>(A.current=!0,()=>{A.current=!1}),[]),Be(()=>{if(x&&(E.current=x),S&&(T.current=S),x&&S){if(O.current)return O.current(x,S,b);b()}},[x,S,b,O,H]);const D=y.useMemo(()=>({reference:E,floating:T,setReference:R,setFloating:w}),[R,w]),k=y.useMemo(()=>({reference:x,floating:S}),[x,S]),F=y.useMemo(()=>{const C={position:n,left:0,top:0};if(!k.floating)return C;const L=zt(k.floating,u.x),V=zt(k.floating,u.y);return c?{...C,transform:"translate("+L+"px, "+V+"px)",...bn(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:V}},[n,c,k.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:b,refs:D,elements:k,floatingStyles:F}),[u,b,D,k,F])}const fr=(t,e)=>({...tr(t),options:[t,e]}),dr=(t,e)=>({...nr(t),options:[t,e]}),gr=(t,e)=>({...ir(t),options:[t,e]}),pr=(t,e)=>({...or(t),options:[t,e]}),mr=(t,e)=>({...rr(t),options:[t,e]}),hr=(t,e)=>({...sr(t),options:[t,e]});function yr(t){const{open:e=!1,onOpenChange:n,elements:o={}}=t,r=ao(),s=Zt()!=null,i=at(()=>new Wn({open:e,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new en,floatingId:r,nested:s,noEmit:!1})).current;return z(()=>{const c={open:e,floatingId:r};o.reference!==void 0&&(c.referenceElement=o.reference,c.domReferenceElement=j(o.reference)?o.reference:null),o.floating!==void 0&&(c.floatingElement=o.floating),i.update(c)},[e,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=!1,i}function vr(t={}){const{nodeId:e,externalTree:n}=t,o=yr(t),r=t.rootContext||o,s={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[i,c]=y.useState(null),f=y.useRef(null),a=ft(n);z(()=>{s.domReference&&(f.current=s.domReference)},[s.domReference]);const u=ur({...t,elements:{...s,...i&&{reference:i}}}),p=y.useCallback(T=>{const M=j(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;c(M),u.refs.setReference(M)},[u.refs]),[m,g]=y.useState(null),[l,d]=y.useState(null);r.useSyncedValue("referenceElement",m),r.useSyncedValue("domReferenceElement",j(m)?m:null),r.useSyncedValue("floatingElement",l);const h=y.useCallback(T=>{(j(T)||T===null)&&(f.current=T,g(T)),(j(u.refs.reference.current)||u.refs.reference.current===null||T!==null&&!j(T))&&u.refs.setReference(T)},[u.refs,g]),v=y.useCallback(T=>{d(T),u.refs.setFloating(T)},[u.refs]),R=y.useMemo(()=>({...u.refs,setReference:h,setFloating:v,setPositionReference:p,domReference:f}),[u.refs,h,v,p]),w=y.useMemo(()=>({...u.elements,domReference:s.domReference}),[u.elements,s.domReference]),x=r.useState("open"),S=r.useState("floatingId"),E=y.useMemo(()=>({...u,dataRef:r.context.dataRef,open:x,onOpenChange:r.setOpen,events:r.context.events,floatingId:S,refs:R,elements:w,nodeId:e,rootStore:r}),[u,R,w,e,r,x,S]);return z(()=>{r.context.dataRef.current.floatingContext=E;const T=a?.nodesRef.current.find(M=>M.id===e);T&&(T.context=E)}),y.useMemo(()=>({...u,context:E,refs:R,elements:w,rootStore:r}),[u,R,w,E,r])}const rt=ho&&yo;function xr(t,e={}){const n="rootStore"in t?t.rootStore:t,{events:o,dataRef:r}=n.context,{enabled:s=!0,delay:i}=e,c=y.useRef(!1),f=y.useRef(null),a=Jt(),u=y.useRef(!0);y.useEffect(()=>{const m=n.select("domReferenceElement");if(!s)return;const g=re(m);function l(){const v=n.select("domReferenceElement");!n.select("open")&&le(v)&&v===Vt(ve(v))&&(c.current=!0)}function d(){u.current=!0}function h(){u.current=!1}return g.addEventListener("blur",l),rt&&(g.addEventListener("keydown",d,!0),g.addEventListener("pointerdown",h,!0)),()=>{g.removeEventListener("blur",l),rt&&(g.removeEventListener("keydown",d,!0),g.removeEventListener("pointerdown",h,!0))}},[n,s]),y.useEffect(()=>{if(!s)return;function m(g){if(g.reason===cn||g.reason===ln){const l=n.select("domReferenceElement");j(l)&&(f.current=l,c.current=!0)}}return o.on("openchange",m),()=>{o.off("openchange",m)}},[o,s,n]);const p=y.useMemo(()=>({onMouseLeave(){c.current=!1,f.current=null},onFocus(m){const g=m.currentTarget;if(c.current){if(f.current===g)return;c.current=!1,f.current=null}const l=Ge(m.nativeEvent);if(j(l)){if(rt&&!m.relatedTarget){if(!u.current&&!po(l))return}else if(!mo(l))return}const d=je(m.relatedTarget,n.context.triggerElements),{nativeEvent:h,currentTarget:v}=m,R=typeof i=="function"?i():i;if(n.select("open")&&d||R===0||R===void 0){n.setOpen(!0,_(Fe,h,v));return}a.start(R,()=>{c.current||n.setOpen(!0,_(Fe,h,v))})},onBlur(m){c.current=!1,f.current=null;const g=m.relatedTarget,l=m.nativeEvent,d=j(g)&&g.hasAttribute(tn("focus-guard"))&&g.getAttribute("data-type")==="outside";a.start(0,()=>{const h=n.select("domReferenceElement"),v=Vt(h?h.ownerDocument:document);!g&&v===h||Z(r.current.floatingContext?.refs.floating.current,v)||Z(h,v)||d||je(g??v,n.context.triggerElements)||n.setOpen(!1,_(Fe,l))})}}),[r,n,a,i]);return y.useMemo(()=>s?{reference:p,trigger:p}:{},[s,p])}const lt=tn("safe-polygon"),wr=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${xo}`;function Rr(t){return t?!!t.closest(wr):!1}class ht{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.unbindMouseMove=()=>{},this.restTimeoutPending=!1,this.openChangeTimeout=new $e,this.restTimeout=new $e,this.handleCloseOptions=void 0}static create(){return new ht}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}function En(t){const e=at(ht.create).current,n=t.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=e),vo(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}const br=new Set(["click","mousedown"]);function Er(t,e={}){const n="rootStore"in t?t.rootStore:t,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:c=!0,closeDelay:f=0}=e,a=En(n),u=ft(),p=Zt(),m=X(()=>a.interactedInside?!0:i.current.openEvent?br.has(i.current.openEvent.type):!1),g=X(()=>{const w=i.current.openEvent?.type;return w?.includes("mouse")&&w!=="mousedown"}),l=X(w=>je(w,n.context.triggerElements)),d=y.useCallback((w,x=!0)=>{const S=Cr(f,a.pointerType);S&&!a.handler?a.openChangeTimeout.start(S,()=>n.setOpen(!1,_(oe,w))):x&&(a.openChangeTimeout.clear(),n.setOpen(!1,_(oe,w)))},[f,n,a]),h=X(()=>{a.unbindMouseMove(),a.handler=void 0}),v=X(()=>{if(a.performedPointerEventsMutation){const w=ve(r).body;w.style.pointerEvents="",w.removeAttribute(lt),a.performedPointerEventsMutation=!1}}),R=X(w=>{const x=Ge(w);if(!Rr(x)){a.interactedInside=!1;return}a.interactedInside=!0});z(()=>{o||(a.pointerType=void 0,a.restTimeoutPending=!1,a.interactedInside=!1,h(),v())},[o,a,h,v]),y.useEffect(()=>()=>{h()},[h]),y.useEffect(()=>v,[v]),z(()=>{if(c&&o&&a.handleCloseOptions?.blockPointerEvents&&g()&&j(s)&&r){a.performedPointerEventsMutation=!0;const w=ve(r).body;w.setAttribute(lt,"");const x=s,S=r,E=u?.nodesRef.current.find(T=>T.id===p)?.context?.elements.floating;return E&&(E.style.pointerEvents=""),w.style.pointerEvents="none",x.style.pointerEvents="auto",S.style.pointerEvents="auto",()=>{w.style.pointerEvents="",x.style.pointerEvents="",S.style.pointerEvents=""}}},[c,o,s,r,a,g,u,p]),y.useEffect(()=>{if(!c)return;function w(T){m()||!i.current.floatingContext||!n.select("open")||l(T.relatedTarget)||(v(),h(),m()||d(T))}function x(T){a.openChangeTimeout.clear(),v(),a.handler?.(T),h()}function S(T){m()||d(T,!1)}const E=r;return E&&(E.addEventListener("mouseleave",w),E.addEventListener("mouseenter",x),E.addEventListener("mouseleave",S),E.addEventListener("pointerdown",R,!0)),()=>{E&&(E.removeEventListener("mouseleave",w),E.removeEventListener("mouseenter",x),E.removeEventListener("mouseleave",S),E.removeEventListener("pointerdown",R,!0))}},[c,r,n,i,m,l,d,v,h,R,a])}function Cr(t,e){return e&&!Oe(e)?0:typeof t=="function"?t():t}function st(t){return typeof t=="function"?t():t}const Sr={current:null};function Tr(t,e={}){const n="rootStore"in t?t.rootStore:t,{dataRef:o,events:r}=n.context,{enabled:s=!0,delay:i=0,handleClose:c=null,mouseOnly:f=!1,restMs:a=0,move:u=!0,triggerElementRef:p=Sr,externalTree:m,isActiveTrigger:g=!0}=e,l=ft(m),d=En(n),h=ye(c),v=ye(i),R=ye(a),w=ye(s);g&&(d.handleCloseOptions=h.current?.__options);const x=X(()=>d.interactedInside?!0:o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1),S=X(O=>je(O,n.context.triggerElements)),E=y.useCallback((O,I=!0)=>{const P=He(v.current,"close",d.pointerType);P&&!d.handler?d.openChangeTimeout.start(P,()=>n.setOpen(!1,_(oe,O))):I&&(d.openChangeTimeout.clear(),n.setOpen(!1,_(oe,O)))},[v,n,d]),T=X(()=>{d.unbindMouseMove(),d.handler=void 0}),M=X(()=>{if(d.performedPointerEventsMutation){const O=ve(n.select("domReferenceElement")).body;O.style.pointerEvents="",O.removeAttribute(lt),d.performedPointerEventsMutation=!1}});y.useEffect(()=>{if(!s)return;function O(I){I.open||(d.openChangeTimeout.clear(),d.restTimeout.clear(),d.blockMouseMove=!0,d.restTimeoutPending=!1)}return r.on("openchange",O),()=>{r.off("openchange",O)}},[s,r,d]);const H=X(O=>{if(x()||!o.current.floatingContext||S(O.relatedTarget))return;const I=p.current;h.current?.({...o.current.floatingContext,tree:l,x:O.clientX,y:O.clientY,onClose(){M(),T(),!x()&&I===n.select("domReferenceElement")&&E(O)}})(O)});return y.useEffect(()=>{if(!s)return;const O=p.current??(g?n.select("domReferenceElement"):null);if(!j(O))return;function I(A){if(d.openChangeTimeout.clear(),d.blockMouseMove=!1,f&&!Oe(d.pointerType)||st(R.current)>0&&!He(v.current,"open"))return;const D=He(v.current,"open",d.pointerType),k=n.select("domReferenceElement"),F=n.context.triggerElements,C=(F.hasElement(A.target)||F.hasMatchingElement(q=>Z(q,A.target)))&&(!k||!Z(k,A.target)),L=A.currentTarget??null,V=n.select("open"),N=!V||C;C&&V?n.setOpen(!0,_(oe,A,L)):D?d.openChangeTimeout.start(D,()=>{N&&n.setOpen(!0,_(oe,A,L))}):N&&n.setOpen(!0,_(oe,A,L))}function P(A){if(x()){M();return}d.unbindMouseMove();const D=n.select("domReferenceElement"),k=ve(D);if(d.restTimeout.clear(),d.restTimeoutPending=!1,S(A.relatedTarget))return;if(h.current&&o.current.floatingContext){n.select("open")||d.openChangeTimeout.clear();const C=p.current;d.handler=h.current({...o.current.floatingContext,tree:l,x:A.clientX,y:A.clientY,onClose(){M(),T(),w.current&&!x()&&C===n.select("domReferenceElement")&&E(A,!0)}});const L=d.handler;L(A),k.addEventListener("mousemove",L),d.unbindMouseMove=()=>{k.removeEventListener("mousemove",L)};return}(d.pointerType!=="touch"||!Z(n.select("floatingElement"),A.relatedTarget))&&E(A)}function b(A){H(A)}return n.select("open")&&O.addEventListener("mouseleave",b),u&&O.addEventListener("mousemove",I,{once:!0}),O.addEventListener("mouseenter",I),O.addEventListener("mouseleave",P),()=>{O.removeEventListener("mouseleave",b),u&&O.removeEventListener("mousemove",I),O.removeEventListener("mouseenter",I),O.removeEventListener("mouseleave",P)}},[T,M,o,v,E,n,s,h,H,d,g,x,S,f,u,R,p,l,w]),y.useMemo(()=>{if(!s)return;function O(I){d.pointerType=I.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(I){const{nativeEvent:P}=I,b=I.currentTarget,A=n.select("domReferenceElement"),D=n.context.triggerElements,k=n.select("open"),F=(D.hasElement(I.target)||D.hasMatchingElement(L=>Z(L,I.target)))&&(!A||!Z(A,I.target));if(f&&!Oe(d.pointerType)||k&&!F||st(R.current)===0||!F&&d.restTimeoutPending&&I.movementX**2+I.movementY**2<2)return;d.restTimeout.clear();function C(){if(d.restTimeoutPending=!1,x())return;const L=n.select("open");!d.blockMouseMove&&(!L||F)&&n.setOpen(!0,_(oe,P,b))}d.pointerType==="touch"?Ue.flushSync(()=>{C()}):F&&k?C():(d.restTimeoutPending=!0,d.restTimeout.start(st(R.current),C))}}},[s,d,x,f,n,R])}function qt(t,e){const[n,o]=t;let r=!1;const s=e.length;for(let i=0,c=s-1;i<s;c=i++){const[f,a]=e[i]||[0,0],[u,p]=e[c]||[0,0];a>=o!=p>=o&&n<=(u-f)*(o-a)/(p-a)+f&&(r=!r)}return r}function Pr(t,e){return t[0]>=e.x&&t[0]<=e.x+e.width&&t[1]>=e.y&&t[1]<=e.y+e.height}function Or(t={}){const{buffer:e=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=t,r=new $e;let s=!1,i=null,c=null,f=typeof performance<"u"?performance.now():0;function a(p,m){const g=performance.now(),l=g-f;if(i===null||c===null||l===0)return i=p,c=m,f=g,null;const d=p-i,h=m-c,R=Math.sqrt(d*d+h*h)/l;return i=p,c=m,f=g,R}const u=({x:p,y:m,placement:g,elements:l,onClose:d,nodeId:h,tree:v})=>function(w){function x(){r.clear(),d()}if(r.clear(),!l.domReference||!l.floating||g==null||p==null||m==null)return;const{clientX:S,clientY:E}=w,T=[S,E],M=Ge(w),H=w.type==="mouseleave",O=Z(l.floating,M),I=Z(l.domReference,M),P=l.domReference.getBoundingClientRect(),b=l.floating.getBoundingClientRect(),A=g.split("-")[0],D=p>b.right-b.width/2,k=m>b.bottom-b.height/2,F=Pr(T,P),C=b.width>P.width,L=b.height>P.height,V=(C?P:b).left,N=(C?P:b).right,q=(L?P:b).top,me=(L?P:b).bottom;if(O&&(s=!0,!H))return;if(I&&(s=!1),I&&!H){s=!0;return}if(H&&j(w.relatedTarget)&&Z(l.floating,w.relatedTarget)||v&&jn(v.nodesRef.current,h).some(({context:B})=>B?.open))return;if(A==="top"&&m>=P.bottom-1||A==="bottom"&&m<=P.top+1||A==="left"&&p>=P.right-1||A==="right"&&p<=P.left+1)return x();let te=[];switch(A){case"top":te=[[V,P.top+1],[V,b.bottom-1],[N,b.bottom-1],[N,P.top+1]];break;case"bottom":te=[[V,b.top+1],[V,P.bottom-1],[N,P.bottom-1],[N,b.top+1]];break;case"left":te=[[b.right-1,me],[b.right-1,q],[P.left+1,q],[P.left+1,me]];break;case"right":te=[[P.right-1,me],[P.right-1,q],[b.left+1,q],[b.left+1,me]];break}function fe([B,W]){switch(A){case"top":{const de=[C?B+e/2:D?B+e*4:B-e*4,W+e+1],ge=[C?B-e/2:D?B+e*4:B-e*4,W+e+1],J=[[b.left,D||C?b.bottom-e:b.top],[b.right,D?C?b.bottom-e:b.top:b.bottom-e]];return[de,ge,...J]}case"bottom":{const de=[C?B+e/2:D?B+e*4:B-e*4,W-e],ge=[C?B-e/2:D?B+e*4:B-e*4,W-e],J=[[b.left,D||C?b.top+e:b.bottom],[b.right,D?C?b.top+e:b.bottom:b.top+e]];return[de,ge,...J]}case"left":{const de=[B+e+1,L?W+e/2:k?W+e*4:W-e*4],ge=[B+e+1,L?W-e/2:k?W+e*4:W-e*4];return[...[[k||L?b.right-e:b.left,b.top],[k?L?b.right-e:b.left:b.right-e,b.bottom]],de,ge]}case"right":{const de=[B-e,L?W+e/2:k?W+e*4:W-e*4],ge=[B-e,L?W-e/2:k?W+e*4:W-e*4],J=[[k||L?b.left+e:b.right,b.top],[k?L?b.left+e:b.right:b.left+e,b.bottom]];return[de,ge,...J]}default:return[]}}if(!qt([S,E],te)){if(s&&!F)return x();if(!H&&o){const B=a(w.clientX,w.clientY);if(B!==null&&B<.1)return x()}qt([S,E],fe([p,m]))?!s&&o&&r.start(40,x):x()}};return u.__options={blockPointerEvents:n},u}function Cn(t){return t==="starting"?Nn:$n}const Ar=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:r,rects:s,platform:i,elements:c,middlewareData:f}=e,{element:a,padding:u=0,offsetParent:p="real"}=ae(t,e)||{};if(a==null)return{};const m=un(u),g={x:n,y:o},l=an(r),d=fn(l),h=await i.getDimensions(a),v=l==="y",R=v?"top":"left",w=v?"bottom":"right",x=v?"clientHeight":"clientWidth",S=s.reference[d]+s.reference[l]-g[l]-s.floating[d],E=g[l]-s.reference[l],T=p==="real"?await i.getOffsetParent?.(a):c.floating;let M=c.floating[x]||s.floating[d];(!M||!await i.isElement?.(T))&&(M=c.floating[x]||s.floating[d]);const H=S/2-E/2,O=M/2-h[d]/2-1,I=Math.min(m[R],O),P=Math.min(m[w],O),b=I,A=M-h[d]-P,D=M/2-h[d]/2+H,k=ct(b,D,A),F=!f.arrow&&Ee(r)!=null&&D!==k&&s.reference[d]/2-(D<b?I:P)-h[d]/2<0,C=F?D<b?D-b:D-A:0;return{[l]:g[l]+C,data:{[l]:k,centerOffset:D-k-C,...F&&{alignmentOffset:C}},reset:F}}}),Mr=(t,e)=>({...Ar(t),options:[t,e]}),Lr={name:"hide",async fn(t){const{width:e,height:n,x:o,y:r}=t.rects.reference,s=e===0&&n===0&&o===0&&r===0;return{data:{referenceHidden:(await hr().fn(t)).data?.referenceHidden||s}}}},Ve={sideX:"left",sideY:"top"},Dr={name:"adaptiveOrigin",async fn(t){const{x:e,y:n,rects:{floating:o},elements:{floating:r},platform:s,strategy:i,placement:c}=t,f=re(r),a=f.getComputedStyle(r);if(!(a.transitionDuration!=="0s"&&a.transitionDuration!==""))return{x:e,y:n,data:Ve};const p=await s.getOffsetParent?.(r);let m={width:0,height:0};if(i==="fixed"&&f?.visualViewport)m={width:f.visualViewport.width,height:f.visualViewport.height};else if(p===f){const R=ve(r);m={width:R.documentElement.clientWidth,height:R.documentElement.clientHeight}}else await s.isElement?.(p)&&(m=await s.getDimensions(p));const g=Q(c);let l=e,d=n;g==="left"&&(l=m.width-(e+o.width)),g==="top"&&(d=m.height-(n+o.height));const h=g==="left"?"right":Ve.sideX,v=g==="top"?"bottom":Ve.sideY;return{x:l,y:d,data:{sideX:h,sideY:v}}}};function Sn(t,e,n){const o=t==="inline-start"||t==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[e]}function Gt(t,e,n){const{rects:o,placement:r}=t;return{side:Sn(e,Q(r),n),align:Ee(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function Ir(t){const{anchor:e,positionMethod:n="absolute",side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:f=5,sticky:a=!1,arrowPadding:u=5,disableAnchorTracking:p=!1,keepMounted:m=!1,floatingRootContext:g,mounted:l,collisionAvoidance:d,shiftCrossAxis:h=!1,nodeId:v,adaptiveOrigin:R,lazyFlip:w=!1,externalTree:x}=t,[S,E]=y.useState(null);!l&&S!==null&&E(null);const T=d.side||"flip",M=d.align||"flip",H=d.fallbackAxisSide||"end",O=typeof e=="function"?e:void 0,I=X(O),P=O?I:e,b=ye(e),D=So()==="rtl",k=S||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":D?"left":"right","inline-start":D?"right":"left"}[o],F=s==="center"?k:`${k}-${s}`;let C=f;const L=1,V=o==="bottom"?L:0,N=o==="top"?L:0,q=o==="right"?L:0,me=o==="left"?L:0;typeof C=="number"?C={top:C+V,right:C+me,bottom:C+N,left:C+q}:C&&(C={top:(C.top||0)+V,right:(C.right||0)+me,bottom:(C.bottom||0)+N,left:(C.left||0)+q});const te={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:C},fe=y.useRef(null),B=ye(r),W=ye(i),J=[fr($=>{const Y=Gt($,o,D),ne=typeof B.current=="function"?B.current(Y):B.current,G=typeof W.current=="function"?W.current(Y):W.current;return{mainAxis:ne,crossAxis:G,alignmentAxis:G}},[typeof r!="function"?r:0,typeof i!="function"?i:0,D,o])],vt=M==="none"&&T!=="shift",xt=!vt&&(a||h||T==="shift"),wt=T==="none"?null:pr({...te,padding:{top:C.top+L,right:C.right+L,bottom:C.bottom+L,left:C.left+L},mainAxis:!h&&T==="flip",crossAxis:M==="flip"?"alignment":!1,fallbackAxisSideDirection:H}),Rt=vt?null:dr($=>{const Y=ve($.elements.floating).documentElement;return{...te,rootBoundary:h?{x:0,y:0,width:Y.clientWidth,height:Y.clientHeight}:void 0,mainAxis:M!=="none",crossAxis:xt,limiter:a||h?void 0:gr(ne=>{if(!fe.current)return{};const{width:G,height:ie}=fe.current.getBoundingClientRect(),De=ee(Q(ne.placement)),Ie=De==="y"?G:ie,et=De==="y"?C.left+C.right:C.top+C.bottom;return{offset:Ie/2+et/2}})}},[te,a,h,C,M]);T==="shift"||M==="shift"||s==="center"?J.push(Rt,wt):J.push(wt,Rt),J.push(mr({...te,apply({elements:{floating:$},rects:{reference:Y},availableWidth:ne,availableHeight:G}){const ie=$.style;ie.setProperty("--available-width",`${ne}px`),ie.setProperty("--available-height",`${G}px`),ie.setProperty("--anchor-width",`${Y.width}px`),ie.setProperty("--anchor-height",`${Y.height}px`)}}),Mr(()=>({element:fe.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn($){const{elements:Y,middlewareData:ne,placement:G,rects:ie,y:De}=$,Ie=Q(G),et=ee(Ie),Ft=fe.current,Mn=ne.arrow?.x||0,Ln=ne.arrow?.y||0,Dn=Ft?.clientWidth||0,In=Ft?.clientHeight||0,tt=Mn+Dn/2,Ht=Ln+In/2,kn=Math.abs(ne.shift?.y||0),Fn=ie.reference.height/2,Te=typeof r=="function"?r(Gt($,o,D)):r,Hn=kn>Te,Bn={top:`${tt}px calc(100% + ${Te}px)`,bottom:`${tt}px ${-Te}px`,left:`calc(100% + ${Te}px) ${Ht}px`,right:`${-Te}px ${Ht}px`}[Ie],Vn=`${tt}px ${ie.reference.y+Fn-De}px`;return Y.floating.style.setProperty("--transform-origin",xt&&et==="y"&&Hn?Vn:Bn),{}}},Lr,R),z(()=>{!l&&g&&g.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[l,g]);const Je=y.useMemo(()=>({elementResize:!p&&typeof ResizeObserver<"u",layoutShift:!p&&typeof IntersectionObserver<"u"}),[p]),{refs:we,elements:Ce,x:bt,y:Et,middlewareData:Re,update:Me,placement:Ct,context:St,isPositioned:he,floatingStyles:Tt}=vr({rootContext:g,placement:F,middleware:J,strategy:n,whileElementsMounted:m?void 0:(...$)=>Ut(...$,Je),nodeId:v,externalTree:x}),{sideX:Pt,sideY:Ot}=Re.adaptiveOrigin||Ve,Ze=he?n:"fixed",At=y.useMemo(()=>{const $=R?{position:Ze,[Pt]:bt,[Ot]:Et}:{position:Ze,...Tt};return he||($.opacity=0),$},[R,Ze,Pt,bt,Ot,Et,Tt,he]),Le=y.useRef(null);z(()=>{if(!l)return;const $=b.current,Y=typeof $=="function"?$():$,G=(Kt(Y)?Y.current:Y)||null||null;G!==Le.current&&(we.setPositionReference(G),Le.current=G)},[l,we,P,b]),y.useEffect(()=>{if(!l)return;const $=b.current;typeof $!="function"&&Kt($)&&$.current!==Le.current&&(we.setPositionReference($.current),Le.current=$.current)},[l,we,P,b]),y.useEffect(()=>{if(m&&l&&Ce.domReference&&Ce.floating)return Ut(Ce.domReference,Ce.floating,Me,Je)},[m,l,Ce,Me,Je]);const Se=Q(Ct),Mt=Sn(o,Se,D),Lt=Ee(Ct)||"center",Dt=!!Re.hide?.referenceHidden;z(()=>{w&&l&&he&&E(Se)},[w,l,he,Se]);const It=y.useMemo(()=>({position:"absolute",top:Re.arrow?.y,left:Re.arrow?.x}),[Re.arrow]),kt=Re.arrow?.centerOffset!==0;return y.useMemo(()=>({positionerStyles:At,arrowStyles:It,arrowRef:fe,arrowUncentered:kt,side:Mt,align:Lt,physicalSide:Se,anchorHidden:Dt,refs:we,context:St,isPositioned:he,update:Me}),[At,It,fe,kt,Mt,Lt,Se,Dt,we,St,he,Me])}function Kt(t){return t!=null&&"current"in t}const Tn=y.createContext(void 0);function Qe(t){const e=y.useContext(Tn);if(e===void 0&&!t)throw new Error(ze(72));return e}const kr={..._n,disabled:pe(t=>t.disabled),instantType:pe(t=>t.instantType),isInstantPhase:pe(t=>t.isInstantPhase),trackCursorAxis:pe(t=>t.trackCursorAxis),disableHoverablePopup:pe(t=>t.disableHoverablePopup),lastOpenChangeReason:pe(t=>t.openChangeReason),closeDelay:pe(t=>t.closeDelay),hasViewport:pe(t=>t.hasViewport)};class yt extends Yn{constructor(e){super({...Fr(),...e},{popupRef:y.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new en},kr)}setOpen=(e,n)=>{const o=n.reason,r=o===oe,s=e&&o===Fe,i=!e&&(o===cn||o===ln);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,n),n.isCanceled)return;const c=()=>{const f={open:e,openChangeReason:o};s?f.instantType="focus":i?f.instantType="dismiss":o===oe&&(f.instantType=void 0);const a=n.trigger?.id??null;(a||e)&&(f.activeTriggerId=a,f.activeTriggerElement=n.trigger??null),this.update(f)};r?Ue.flushSync(c):c()};static useStore(e,n){const o=at(()=>new yt(n)).current,r=e??o,s=Xn({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=s,r}}function Fr(){return{...Un(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0,hasViewport:!1}}const Hr=zn(function(e){const{disabled:n=!1,defaultOpen:o=!1,open:r,disableHoverablePopup:s=!1,trackCursorAxis:i="none",actionsRef:c,onOpenChange:f,onOpenChangeComplete:a,handle:u,triggerId:p,defaultTriggerId:m=null,children:g}=e,l=yt.useStore(u?.store,{open:o,openProp:r,activeTriggerId:m,triggerIdProp:p});qn(()=>{r===void 0&&l.state.open===!1&&o===!0&&l.update({open:!0,activeTriggerId:m})}),l.useControlledProp("openProp",r),l.useControlledProp("triggerIdProp",p),l.useContextCallback("onOpenChange",f),l.useContextCallback("onOpenChangeComplete",a);const d=l.useState("open"),h=!n&&d,v=l.useState("activeTriggerId"),R=l.useState("payload");l.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:s}),z(()=>{d&&n&&l.setOpen(!1,_(uo))},[d,n,l]),l.useSyncedValue("disabled",n),Gn(l);const{forceUnmount:w,transitionStatus:x}=Kn(h,l),S=l.useState("isInstantPhase"),E=l.useState("instantType"),T=l.useState("lastOpenChangeReason"),M=y.useRef(null);z(()=>{x==="ending"&&T===on||x!=="ending"&&S?(E!=="delay"&&(M.current=E),l.set("instantType","delay")):M.current!==null&&(l.set("instantType",M.current),M.current=null)},[x,S,T,E,l]),z(()=>{h&&v==null&&l.set("payload",void 0)},[l,v,h]);const H=y.useCallback(()=>{l.setOpen(!1,Br(l,fo))},[l]);y.useImperativeHandle(c,()=>({unmount:w,close:H}),[w,H]);const O=l.useState("floatingRootContext"),I=Qn(O,{enabled:!n,referencePress:!0}),P=Ao(O,{enabled:!n&&i!=="none",axis:i==="none"?void 0:i}),{getReferenceProps:b,getFloatingProps:A,getTriggerProps:D}=Jn([I,P]),k=y.useMemo(()=>b(),[b]),F=y.useMemo(()=>D(),[D]),C=y.useMemo(()=>A(),[A]);return l.useSyncedValues({activeTriggerProps:k,inactiveTriggerProps:F,popupProps:C}),U.jsx(Tn.Provider,{value:l,children:typeof g=="function"?g({payload:R}):g})});function Br(t,e){const n=_(e);return n.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},n}const Pn=y.createContext(void 0);function Vr(){return y.useContext(Pn)}let $r=(function(t){return t[t.popupOpen=Zn.popupOpen]="popupOpen",t.triggerDisabled="data-trigger-disabled",t})({});const Wr=600,jr=eo(function(e,n){const{className:o,render:r,handle:s,payload:i,disabled:c,delay:f,closeDelay:a,id:u,...p}=e,m=Qe(!0),g=s?.store??m;if(!g)throw new Error(ze(82));const l=go(u),d=g.useState("isTriggerActive",l),h=g.useState("isOpenedByTrigger",l),v=g.useState("floatingRootContext"),R=y.useRef(null),w=f??Wr,x=a??0,{registerTrigger:S,isMountedByThisTrigger:E}=to(l,R,g,{payload:i,closeDelay:x}),T=Vr(),{delayRef:M,isInstantPhase:H,hasProvider:O}=Po(v,{open:h});g.useSyncedValue("isInstantPhase",H);const I=g.useState("disabled"),P=c??I,b=g.useState("trackCursorAxis"),A=g.useState("disableHoverablePopup"),D=Tr(v,{enabled:!P,mouseOnly:!0,move:!1,handleClose:!A&&b!=="both"?Or():null,restMs(){const V=T?.delay,N=typeof M.current=="object"?M.current.open:void 0;let q=w;return O&&(N!==0?q=f??V??w:q=0),q},delay(){const V=typeof M.current=="object"?M.current.close:void 0;let N=x;return a==null&&O&&(N=V),{close:N}},triggerElementRef:R,isActiveTrigger:d}),k=xr(v,{enabled:!P}).reference,F={open:h},C=g.useState("triggerProps",E);return ut("button",e,{state:F,ref:[n,S,R],props:[D,k,C,{id:l,[$r.triggerDisabled]:P?"":void 0},p],stateAttributesMapping:no})}),On=y.createContext(void 0);function Nr(){const t=y.useContext(On);if(t===void 0)throw new Error(ze(70));return t}const Yr=y.forwardRef(function(e,n){const{children:o,container:r,className:s,render:i,...c}=e,{portalNode:f,portalSubtree:a}=oo({container:r,ref:n,componentProps:e,elementProps:c});return!a&&!f?null:U.jsxs(y.Fragment,{children:[a,f&&Ue.createPortal(o,f)]})}),_r=y.forwardRef(function(e,n){const{keepMounted:o=!1,...r}=e;return Qe().useState("mounted")||o?U.jsx(On.Provider,{value:o,children:U.jsx(Yr,{ref:n,...r})}):null}),An=y.createContext(void 0);function Xr(){const t=y.useContext(An);if(t===void 0)throw new Error(ze(71));return t}const Ur=y.forwardRef(function(e,n){const{render:o,className:r,anchor:s,positionMethod:i="absolute",side:c="top",align:f="center",sideOffset:a=0,alignOffset:u=0,collisionBoundary:p="clipping-ancestors",collisionPadding:m=5,arrowPadding:g=5,sticky:l=!1,disableAnchorTracking:d=!1,collisionAvoidance:h=ro,...v}=e,R=Qe(),w=Nr(),x=R.useState("open"),S=R.useState("mounted"),E=R.useState("trackCursorAxis"),T=R.useState("disableHoverablePopup"),M=R.useState("floatingRootContext"),H=R.useState("instantType"),O=R.useState("transitionStatus"),I=R.useState("hasViewport"),P=Ir({anchor:s,positionMethod:i,floatingRootContext:M,mounted:S,side:c,sideOffset:a,align:f,alignOffset:u,collisionBoundary:p,collisionPadding:m,sticky:l,arrowPadding:g,disableAnchorTracking:d,keepMounted:w,collisionAvoidance:h,adaptiveOrigin:I?Dr:void 0}),b=y.useMemo(()=>{const F={};return(!x||E==="both"||T)&&(F.pointerEvents="none"),{role:"presentation",hidden:!S,style:{...P.positionerStyles,...F}}},[x,E,T,S,P.positionerStyles]),A=y.useMemo(()=>({open:x,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:E!=="none"?"tracking-cursor":H}),[x,P.side,P.align,P.anchorHidden,E,H]),D=y.useMemo(()=>({...A,arrowRef:P.arrowRef,arrowStyles:P.arrowStyles,arrowUncentered:P.arrowUncentered}),[A,P.arrowRef,P.arrowStyles,P.arrowUncentered]),k=ut("div",e,{state:A,props:[b,Cn(O),v],ref:[n,R.useStateSetter("positionerElement")],stateAttributesMapping:nn});return U.jsx(An.Provider,{value:D,children:k})}),zr={...nn,...io},qr=y.forwardRef(function(e,n){const{className:o,render:r,...s}=e,i=Qe(),{side:c,align:f}=Xr(),a=i.useState("open"),u=i.useState("instantType"),p=i.useState("transitionStatus"),m=i.useState("popupProps"),g=i.useState("floatingRootContext");so({open:a,ref:i.context.popupRef,onComplete(){a&&i.context.onOpenChangeComplete?.(!0)}});const l=i.useState("disabled"),d=i.useState("closeDelay");return Er(g,{enabled:!l,closeDelay:d}),ut("div",e,{state:{open:a,side:c,align:f,instant:u,transitionStatus:p},ref:[n,i.context.popupRef,i.useStateSetter("popupElement")],props:[m,Cn(p),s],stateAttributesMapping:zr})}),Gr=function(e){const{delay:n,closeDelay:o,timeout:r=400}=e,s=y.useMemo(()=>({delay:n,closeDelay:o}),[n,o]),i=y.useMemo(()=>({open:n,close:o}),[n,o]);return U.jsx(Pn.Provider,{value:s,children:U.jsx(To,{delay:i,timeoutMs:r,children:e.children})})};function rs({children:t}){return U.jsx(Gr,{delay:0,closeDelay:0,timeout:0,children:t})}function ss({children:t,...e}){return U.jsx(Hr,{...e,children:t})}function is({className:t,...e}){return U.jsx(jr,{className:Qt(t),...e})}function cs({className:t,side:e="top",children:n}){return U.jsx(_r,{children:U.jsx(Ur,{side:e,children:U.jsx(qr,{className:Qt("rounded-md border border-primary-900 bg-primary-950 px-2 py-1 text-xs text-primary-50 shadow-sm",t),children:n})})})}export{rs as T,ss as a,is as b,cs as c,gn as d,Cn as e,Ir as f,ns as g,Tr as h,Or as i,xr as j,os as s,Er as u};
1
+ import{r as y,j as U,w as Ue}from"./main-CbISK-pm.js";import{u as at,a9 as $n,aa as ze,ae as ut,c as Qt}from"./button-Bv-7bwZZ.js";import{a as Jt,I as $e,c as Zt,Z as Wn,g as en,d as ft,N as tn,b as ye,S as jn,_ as Nn,R as Yn,h as _n,r as Xn,j as Un,k as pe,l as zn,m as qn,o as Gn,q as Kn,s as Qn,v as Jn,$ as Zn,x as eo,y as to,a0 as no,a1 as oo,P as ro,p as nn,e as so,t as io}from"./useOnFirstRender-DpB3w0o4.js";import{u as z,g as _,n as on,a as X,z as re,E as it,d as j,F as ue,G as Bt,h as ce,i as le,H as rn,I as dt,x as Pe,w as We,J as co,K as sn,L as lo,B as gt,A as pt,M as qe,p as ao,q as Fe,t as cn,r as ln,m as oe,N as uo,v as fo,e as go}from"./useBaseUiId-BdQC9KF3.js";import{i as Oe,k as Ge,e as Z,d as Vt,q as je,g as po,r as mo,o as ve,t as ho,v as yo,u as vo,T as xo}from"./event-Cnr9OETn.js";import{e as ae,g as Q,a as ee,b as wo,c as Ro,d as bo,h as Eo,i as Ee,m as Ae,j as K,s as Co,k as an,l as un,n as Ne,o as fn,p as ct,q as dn,t as se,f as ke,r as Ye,u as So}from"./DirectionContext-BOL0P_1j.js";const _e={isSidebarCollapsed:!1},gn=["chat","ui"];function ns(t){const e=t.getQueryData(gn);return e&&typeof e=="object"?{..._e,...e}:_e}function os(t,e){t.setQueryData(gn,function(o){const r=o&&typeof o=="object"?{..._e,...o}:_e;return e(r)})}function He(t,e,n){if(n&&!Oe(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const o=t();return typeof o=="number"?o:o?.[e]}return t?.[e]}const pn=y.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new $e,currentIdRef:{current:null},currentContextRef:{current:null}});function To(t){const{children:e,delay:n,timeoutMs:o=0}=t,r=y.useRef(n),s=y.useRef(n),i=y.useRef(null),c=y.useRef(null),f=Jt();return U.jsx(pn.Provider,{value:y.useMemo(()=>({hasProvider:!0,delayRef:r,initialDelayRef:s,currentIdRef:i,timeoutMs:o,currentContextRef:c,timeout:f}),[o,f]),children:e})}function Po(t,e={open:!1}){const n="rootStore"in t?t.rootStore:t,o=n.useState("floatingId"),{open:r}=e,s=y.useContext(pn),{currentIdRef:i,delayRef:c,timeoutMs:f,initialDelayRef:a,currentContextRef:u,hasProvider:p,timeout:m}=s,[g,l]=y.useState(!1);return z(()=>{function d(){l(!1),u.current?.setIsInstantPhase(!1),i.current=null,u.current=null,c.current=a.current}if(i.current&&!r&&i.current===o){if(l(!1),f){const h=o;return m.start(f,()=>{n.select("open")||i.current&&i.current!==h||d()}),()=>{m.clear()}}d()}},[r,o,i,c,f,a,u,m,n]),z(()=>{if(!r)return;const d=u.current,h=i.current;m.clear(),u.current={onOpenChange:n.setOpen,setIsInstantPhase:l},i.current=o,c.current={open:0,close:He(a.current,"close")},h!==null&&h!==o?(l(!0),d?.setIsInstantPhase(!0),d?.onOpenChange(!1,_(on))):(l(!1),d?.setIsInstantPhase(!1))},[r,o,n,i,c,f,a,u,m]),z(()=>()=>{u.current=null},[u]),y.useMemo(()=>({hasProvider:p,delayRef:c,isInstantPhase:g}),[p,c,g])}function Oo(t,e){let n=null,o=null,r=!1;return{contextElement:t||void 0,getBoundingClientRect(){const s=t?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},i=e.axis==="x"||e.axis==="both",c=e.axis==="y"||e.axis==="both",f=["mouseenter","mousemove"].includes(e.dataRef.current.openEvent?.type||"")&&e.pointerType!=="touch";let a=s.width,u=s.height,p=s.x,m=s.y;return n==null&&e.x&&i&&(n=s.x-e.x),o==null&&e.y&&c&&(o=s.y-e.y),p-=n||0,m-=o||0,a=0,u=0,!r||f?(a=e.axis==="y"?s.width:0,u=e.axis==="x"?s.height:0,p=i&&e.x!=null?e.x:p,m=c&&e.y!=null?e.y:m):r&&!f&&(u=e.axis==="x"?s.height:u,a=e.axis==="y"?s.width:a),r=!0,{width:a,height:u,x:p,y:m,top:m,right:p+a,bottom:m+u,left:p}}}}function $t(t){return t!=null&&t.clientX!=null}function Ao(t,e={}){const n="rootStore"in t?t.rootStore:t,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{enabled:c=!0,axis:f="both"}=e,a=y.useRef(!1),u=y.useRef(null),[p,m]=y.useState(),[g,l]=y.useState([]),d=X((x,S,E)=>{a.current||i.current.openEvent&&!$t(i.current.openEvent)||n.set("positionReference",Oo(E??s,{x,y:S,axis:f,dataRef:i,pointerType:p}))}),h=X(x=>{o?u.current||l([]):d(x.clientX,x.clientY,x.currentTarget)}),v=Oe(p)?r:o,R=y.useCallback(()=>{if(!v||!c)return;const x=re(r);function S(E){const T=Ge(E);Z(r,T)?(x.removeEventListener("mousemove",S),u.current=null):d(E.clientX,E.clientY)}if(!i.current.openEvent||$t(i.current.openEvent)){x.addEventListener("mousemove",S);const E=()=>{x.removeEventListener("mousemove",S),u.current=null};return u.current=E,E}n.set("positionReference",s)},[v,c,r,i,s,n,d]);y.useEffect(()=>R(),[R,g]),y.useEffect(()=>{c&&!r&&(a.current=!1)},[c,r]),y.useEffect(()=>{!c&&o&&(a.current=!0)},[c,o]);const w=y.useMemo(()=>{function x(S){m(S.pointerType)}return{onPointerDown:x,onPointerEnter:x,onMouseMove:h,onMouseEnter:h}},[h]);return y.useMemo(()=>c?{reference:w,trigger:w}:{},[c,w])}function Wt(t,e,n){let{reference:o,floating:r}=t;const s=ee(e),i=an(e),c=fn(i),f=Q(e),a=s==="y",u=o.x+o.width/2-r.width/2,p=o.y+o.height/2-r.height/2,m=o[c]/2-r[c]/2;let g;switch(f){case"top":g={x:u,y:o.y-r.height};break;case"bottom":g={x:u,y:o.y+o.height};break;case"right":g={x:o.x+o.width,y:p};break;case"left":g={x:o.x-r.width,y:p};break;default:g={x:o.x,y:o.y}}switch(Ee(e)){case"start":g[i]-=m*(n&&a?-1:1);break;case"end":g[i]+=m*(n&&a?-1:1);break}return g}async function Mo(t,e){var n;e===void 0&&(e={});const{x:o,y:r,platform:s,rects:i,elements:c,strategy:f}=t,{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:m=!1,padding:g=0}=ae(e,t),l=un(g),h=c[m?p==="floating"?"reference":"floating":p],v=Ne(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(h)))==null||n?h:h.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:a,rootBoundary:u,strategy:f})),R=p==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),x=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},S=Ne(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:R,offsetParent:w,strategy:f}):R);return{top:(v.top-S.top+l.top)/x.y,bottom:(S.bottom-v.bottom+l.bottom)/x.y,left:(v.left-S.left+l.left)/x.x,right:(S.right-v.right+l.right)/x.x}}const Lo=async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,c=s.filter(Boolean),f=await(i.isRTL==null?void 0:i.isRTL(e));let a=await i.getElementRects({reference:t,floating:e,strategy:r}),{x:u,y:p}=Wt(a,o,f),m=o,g={},l=0;for(let h=0;h<c.length;h++){var d;const{name:v,fn:R}=c[h],{x:w,y:x,data:S,reset:E}=await R({x:u,y:p,initialPlacement:o,placement:m,strategy:r,middlewareData:g,rects:a,platform:{...i,detectOverflow:(d=i.detectOverflow)!=null?d:Mo},elements:{reference:t,floating:e}});u=w??u,p=x??p,g={...g,[v]:{...g[v],...S}},E&&l<=50&&(l++,typeof E=="object"&&(E.placement&&(m=E.placement),E.rects&&(a=E.rects===!0?await i.getElementRects({reference:t,floating:e,strategy:r}):E.rects),{x:u,y:p}=Wt(a,m,f)),h=-1)}return{x:u,y:p,placement:m,strategy:r,middlewareData:g}},Do=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:c,platform:f,elements:a}=e,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:l="none",flipAlignment:d=!0,...h}=ae(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=Q(r),R=ee(c),w=Q(c)===c,x=await(f.isRTL==null?void 0:f.isRTL(a.floating)),S=m||(w||!d?[wo(c)]:Ro(c)),E=l!=="none";!m&&E&&S.push(...bo(c,d,l,x));const T=[c,...S],M=await f.detectOverflow(e,h),H=[];let O=((o=s.flip)==null?void 0:o.overflows)||[];if(u&&H.push(M[v]),p){const A=Eo(r,i,x);H.push(M[A[0]],M[A[1]])}if(O=[...O,{placement:r,overflows:H}],!H.every(A=>A<=0)){var I,P;const A=(((I=s.flip)==null?void 0:I.index)||0)+1,D=T[A];if(D&&(!(p==="alignment"?R!==ee(D):!1)||O.every(C=>ee(C.placement)===R?C.overflows[0]>0:!0)))return{data:{index:A,overflows:O},reset:{placement:D}};let k=(P=O.filter(F=>F.overflows[0]<=0).sort((F,C)=>F.overflows[1]-C.overflows[1])[0])==null?void 0:P.placement;if(!k)switch(g){case"bestFit":{var b;const F=(b=O.filter(C=>{if(E){const L=ee(C.placement);return L===R||L==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(L=>L>0).reduce((L,V)=>L+V,0)]).sort((C,L)=>C[1]-L[1])[0])==null?void 0:b[0];F&&(k=F);break}case"initialPlacement":k=c;break}if(r!==k)return{reset:{placement:k}}}return{}}}};function jt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Nt(t){return Co.some(e=>t[e]>=0)}const Io=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:o}=e,{strategy:r="referenceHidden",...s}=ae(t,e);switch(r){case"referenceHidden":{const i=await o.detectOverflow(e,{...s,elementContext:"reference"}),c=jt(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Nt(c)}}}case"escaped":{const i=await o.detectOverflow(e,{...s,altBoundary:!0}),c=jt(i,n.floating);return{data:{escapedOffsets:c,escaped:Nt(c)}}}default:return{}}}}},mn=new Set(["left","top"]);async function ko(t,e){const{placement:n,platform:o,elements:r}=t,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=Q(n),c=Ee(n),f=ee(n)==="y",a=mn.has(i)?-1:1,u=s&&f?-1:1,p=ae(e,t);let{mainAxis:m,crossAxis:g,alignmentAxis:l}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof l=="number"&&(g=c==="end"?l*-1:l),f?{x:g*u,y:m*a}:{x:m*a,y:g*u}}const Fo=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:s,placement:i,middlewareData:c}=e,f=await ko(e,t);return i===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:r+f.x,y:s+f.y,data:{...f,placement:i}}}}},Ho=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r,platform:s}=e,{mainAxis:i=!0,crossAxis:c=!1,limiter:f={fn:v=>{let{x:R,y:w}=v;return{x:R,y:w}}},...a}=ae(t,e),u={x:n,y:o},p=await s.detectOverflow(e,a),m=ee(Q(r)),g=dn(m);let l=u[g],d=u[m];if(i){const v=g==="y"?"top":"left",R=g==="y"?"bottom":"right",w=l+p[v],x=l-p[R];l=ct(w,l,x)}if(c){const v=m==="y"?"top":"left",R=m==="y"?"bottom":"right",w=d+p[v],x=d-p[R];d=ct(w,d,x)}const h=f.fn({...e,[g]:l,[m]:d});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[g]:i,[m]:c}}}}}},Bo=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:r,rects:s,middlewareData:i}=e,{offset:c=0,mainAxis:f=!0,crossAxis:a=!0}=ae(t,e),u={x:n,y:o},p=ee(r),m=dn(p);let g=u[m],l=u[p];const d=ae(c,e),h=typeof d=="number"?{mainAxis:d,crossAxis:0}:{mainAxis:0,crossAxis:0,...d};if(f){const w=m==="y"?"height":"width",x=s.reference[m]-s.floating[w]+h.mainAxis,S=s.reference[m]+s.reference[w]-h.mainAxis;g<x?g=x:g>S&&(g=S)}if(a){var v,R;const w=m==="y"?"width":"height",x=mn.has(Q(r)),S=s.reference[p]-s.floating[w]+(x&&((v=i.offset)==null?void 0:v[p])||0)+(x?0:h.crossAxis),E=s.reference[p]+s.reference[w]+(x?0:((R=i.offset)==null?void 0:R[p])||0)-(x?h.crossAxis:0);l<S?l=S:l>E&&(l=E)}return{[m]:g,[p]:l}}}},Vo=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:s,platform:i,elements:c}=e,{apply:f=()=>{},...a}=ae(t,e),u=await i.detectOverflow(e,a),p=Q(r),m=Ee(r),g=ee(r)==="y",{width:l,height:d}=s.floating;let h,v;p==="top"||p==="bottom"?(h=p,v=m===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(v=p,h=m==="end"?"top":"bottom");const R=d-u.top-u.bottom,w=l-u.left-u.right,x=Ae(d-u[h],R),S=Ae(l-u[v],w),E=!e.middlewareData.shift;let T=x,M=S;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(M=w),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(T=R),E&&!m){const O=K(u.left,0),I=K(u.right,0),P=K(u.top,0),b=K(u.bottom,0);g?M=l-2*(O!==0||I!==0?O+I:K(u.left,u.right)):T=d-2*(P!==0||b!==0?P+b:K(u.top,u.bottom))}await f({...e,availableWidth:M,availableHeight:T});const H=await i.getDimensions(c.floating);return l!==H.width||d!==H.height?{reset:{rects:!0}}:{}}}};function hn(t){const e=ce(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=le(t),s=r?t.offsetWidth:n,i=r?t.offsetHeight:o,c=Ye(n)!==s||Ye(o)!==i;return c&&(n=s,o=i),{width:n,height:o,$:c}}function mt(t){return j(t)?t:t.contextElement}function be(t){const e=mt(t);if(!le(e))return se(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:s}=hn(e);let i=(s?Ye(n.width):n.width)/o,c=(s?Ye(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const $o=se(0);function yn(t){const e=re(t);return!rn()||!e.visualViewport?$o:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Wo(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==re(t)?!1:e}function xe(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),s=mt(t);let i=se(1);e&&(o?j(o)&&(i=be(o)):i=be(t));const c=Wo(s,n,o)?yn(s):se(0);let f=(r.left+c.x)/i.x,a=(r.top+c.y)/i.y,u=r.width/i.x,p=r.height/i.y;if(s){const m=re(s),g=o&&j(o)?re(o):o;let l=m,d=Bt(l);for(;d&&o&&g!==l;){const h=be(d),v=d.getBoundingClientRect(),R=ce(d),w=v.left+(d.clientLeft+parseFloat(R.paddingLeft))*h.x,x=v.top+(d.clientTop+parseFloat(R.paddingTop))*h.y;f*=h.x,a*=h.y,u*=h.x,p*=h.y,f+=w,a+=x,l=re(d),d=Bt(l)}}return Ne({width:u,height:p,x:f,y:a})}function Ke(t,e){const n=qe(t).scrollLeft;return e?e.left+n:xe(ue(t)).left+n}function vn(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-Ke(t,n),r=n.top+e.scrollTop;return{x:o,y:r}}function jo(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const s=r==="fixed",i=ue(o),c=e?dt(e.floating):!1;if(o===i||c&&s)return n;let f={scrollLeft:0,scrollTop:0},a=se(1);const u=se(0),p=le(o);if((p||!p&&!s)&&((gt(o)!=="body"||pt(i))&&(f=qe(o)),le(o))){const g=xe(o);a=be(o),u.x=g.x+o.clientLeft,u.y=g.y+o.clientTop}const m=i&&!p&&!s?vn(i,f):se(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-f.scrollLeft*a.x+u.x+m.x,y:n.y*a.y-f.scrollTop*a.y+u.y+m.y}}function No(t){return Array.from(t.getClientRects())}function Yo(t){const e=ue(t),n=qe(t),o=t.ownerDocument.body,r=K(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),s=K(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+Ke(t);const c=-n.scrollTop;return ce(o).direction==="rtl"&&(i+=K(e.clientWidth,o.clientWidth)-r),{width:r,height:s,x:i,y:c}}const Yt=25;function _o(t,e){const n=re(t),o=ue(t),r=n.visualViewport;let s=o.clientWidth,i=o.clientHeight,c=0,f=0;if(r){s=r.width,i=r.height;const u=rn();(!u||u&&e==="fixed")&&(c=r.offsetLeft,f=r.offsetTop)}const a=Ke(o);if(a<=0){const u=o.ownerDocument,p=u.body,m=getComputedStyle(p),g=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,l=Math.abs(o.clientWidth-p.clientWidth-g);l<=Yt&&(s-=l)}else a<=Yt&&(s+=a);return{width:s,height:i,x:c,y:f}}const Xo=new Set(["absolute","fixed"]);function Uo(t,e){const n=xe(t,!0,e==="fixed"),o=n.top+t.clientTop,r=n.left+t.clientLeft,s=le(t)?be(t):se(1),i=t.clientWidth*s.x,c=t.clientHeight*s.y,f=r*s.x,a=o*s.y;return{width:i,height:c,x:f,y:a}}function _t(t,e,n){let o;if(e==="viewport")o=_o(t,n);else if(e==="document")o=Yo(ue(t));else if(j(e))o=Uo(e,n);else{const r=yn(t);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Ne(o)}function xn(t,e){const n=Pe(t);return n===e||!j(n)||We(n)?!1:ce(n).position==="fixed"||xn(n,e)}function zo(t,e){const n=e.get(t);if(n)return n;let o=it(t,[],!1).filter(c=>j(c)&&gt(c)!=="body"),r=null;const s=ce(t).position==="fixed";let i=s?Pe(t):t;for(;j(i)&&!We(i);){const c=ce(i),f=sn(i);!f&&c.position==="fixed"&&(r=null),(s?!f&&!r:!f&&c.position==="static"&&!!r&&Xo.has(r.position)||pt(i)&&!f&&xn(t,i))?o=o.filter(u=>u!==i):r=c,i=Pe(i)}return e.set(t,o),o}function qo(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const i=[...n==="clippingAncestors"?dt(e)?[]:zo(e,this._c):[].concat(n),o],c=i[0],f=i.reduce((a,u)=>{const p=_t(e,u,r);return a.top=K(p.top,a.top),a.right=Ae(p.right,a.right),a.bottom=Ae(p.bottom,a.bottom),a.left=K(p.left,a.left),a},_t(e,c,r));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function Go(t){const{width:e,height:n}=hn(t);return{width:e,height:n}}function Ko(t,e,n){const o=le(e),r=ue(e),s=n==="fixed",i=xe(t,!0,s,e);let c={scrollLeft:0,scrollTop:0};const f=se(0);function a(){f.x=Ke(r)}if(o||!o&&!s)if((gt(e)!=="body"||pt(r))&&(c=qe(e)),o){const g=xe(e,!0,s,e);f.x=g.x+e.clientLeft,f.y=g.y+e.clientTop}else r&&a();s&&!o&&r&&a();const u=r&&!o&&!s?vn(r,c):se(0),p=i.left+c.scrollLeft-f.x-u.x,m=i.top+c.scrollTop-f.y-u.y;return{x:p,y:m,width:i.width,height:i.height}}function nt(t){return ce(t).position==="static"}function Xt(t,e){if(!le(t)||ce(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return ue(t)===n&&(n=n.ownerDocument.body),n}function wn(t,e){const n=re(t);if(dt(t))return n;if(!le(t)){let r=Pe(t);for(;r&&!We(r);){if(j(r)&&!nt(r))return r;r=Pe(r)}return n}let o=Xt(t,e);for(;o&&co(o)&&nt(o);)o=Xt(o,e);return o&&We(o)&&nt(o)&&!sn(o)?n:o||lo(t)||n}const Qo=async function(t){const e=this.getOffsetParent||wn,n=this.getDimensions,o=await n(t.floating);return{reference:Ko(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Jo(t){return ce(t).direction==="rtl"}const Zo={convertOffsetParentRelativeRectToViewportRelativeRect:jo,getDocumentElement:ue,getClippingRect:qo,getOffsetParent:wn,getElementRects:Qo,getClientRects:No,getDimensions:Go,getScale:be,isElement:j,isRTL:Jo};function Rn(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function er(t,e){let n=null,o;const r=ue(t);function s(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function i(c,f){c===void 0&&(c=!1),f===void 0&&(f=1),s();const a=t.getBoundingClientRect(),{left:u,top:p,width:m,height:g}=a;if(c||e(),!m||!g)return;const l=ke(p),d=ke(r.clientWidth-(u+m)),h=ke(r.clientHeight-(p+g)),v=ke(u),w={rootMargin:-l+"px "+-d+"px "+-h+"px "+-v+"px",threshold:K(0,Ae(1,f))||1};let x=!0;function S(E){const T=E[0].intersectionRatio;if(T!==f){if(!x)return i();T?i(!1,T):o=setTimeout(()=>{i(!1,1e-7)},1e3)}T===1&&!Rn(a,t.getBoundingClientRect())&&i(),x=!1}try{n=new IntersectionObserver(S,{...w,root:r.ownerDocument})}catch{n=new IntersectionObserver(S,w)}n.observe(t)}return i(!0),s}function Ut(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:f=!1}=o,a=mt(t),u=r||s?[...a?it(a):[],...it(e)]:[];u.forEach(v=>{r&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const p=a&&c?er(a,n):null;let m=-1,g=null;i&&(g=new ResizeObserver(v=>{let[R]=v;R&&R.target===a&&g&&(g.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=g)==null||w.observe(e)})),n()}),a&&!f&&g.observe(a),g.observe(e));let l,d=f?xe(t):null;f&&h();function h(){const v=xe(t);d&&!Rn(d,v)&&n(),d=v,l=requestAnimationFrame(h)}return n(),()=>{var v;u.forEach(R=>{r&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),p?.(),(v=g)==null||v.disconnect(),g=null,f&&cancelAnimationFrame(l)}}const tr=Fo,nr=Ho,or=Do,rr=Vo,sr=Io,ir=Bo,cr=(t,e,n)=>{const o=new Map,r={platform:Zo,...n},s={...r.platform,_c:o};return Lo(t,e,{...r,platform:s})};var lr=typeof document<"u",ar=function(){},Be=lr?y.useLayoutEffect:ar;function Xe(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,r;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!Xe(t[o],e[o]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&t.$$typeof)&&!Xe(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function bn(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function zt(t,e){const n=bn(t);return Math.round(e*n)/n}function ot(t){const e=y.useRef(t);return Be(()=>{e.current=t}),e}function ur(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:f,open:a}=t,[u,p]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,g]=y.useState(o);Xe(m,o)||g(o);const[l,d]=y.useState(null),[h,v]=y.useState(null),R=y.useCallback(C=>{C!==E.current&&(E.current=C,d(C))},[]),w=y.useCallback(C=>{C!==T.current&&(T.current=C,v(C))},[]),x=s||l,S=i||h,E=y.useRef(null),T=y.useRef(null),M=y.useRef(u),H=f!=null,O=ot(f),I=ot(r),P=ot(a),b=y.useCallback(()=>{if(!E.current||!T.current)return;const C={placement:e,strategy:n,middleware:m};I.current&&(C.platform=I.current),cr(E.current,T.current,C).then(L=>{const V={...L,isPositioned:P.current!==!1};A.current&&!Xe(M.current,V)&&(M.current=V,Ue.flushSync(()=>{p(V)}))})},[m,e,n,I,P]);Be(()=>{a===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,p(C=>({...C,isPositioned:!1})))},[a]);const A=y.useRef(!1);Be(()=>(A.current=!0,()=>{A.current=!1}),[]),Be(()=>{if(x&&(E.current=x),S&&(T.current=S),x&&S){if(O.current)return O.current(x,S,b);b()}},[x,S,b,O,H]);const D=y.useMemo(()=>({reference:E,floating:T,setReference:R,setFloating:w}),[R,w]),k=y.useMemo(()=>({reference:x,floating:S}),[x,S]),F=y.useMemo(()=>{const C={position:n,left:0,top:0};if(!k.floating)return C;const L=zt(k.floating,u.x),V=zt(k.floating,u.y);return c?{...C,transform:"translate("+L+"px, "+V+"px)",...bn(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:V}},[n,c,k.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:b,refs:D,elements:k,floatingStyles:F}),[u,b,D,k,F])}const fr=(t,e)=>({...tr(t),options:[t,e]}),dr=(t,e)=>({...nr(t),options:[t,e]}),gr=(t,e)=>({...ir(t),options:[t,e]}),pr=(t,e)=>({...or(t),options:[t,e]}),mr=(t,e)=>({...rr(t),options:[t,e]}),hr=(t,e)=>({...sr(t),options:[t,e]});function yr(t){const{open:e=!1,onOpenChange:n,elements:o={}}=t,r=ao(),s=Zt()!=null,i=at(()=>new Wn({open:e,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new en,floatingId:r,nested:s,noEmit:!1})).current;return z(()=>{const c={open:e,floatingId:r};o.reference!==void 0&&(c.referenceElement=o.reference,c.domReferenceElement=j(o.reference)?o.reference:null),o.floating!==void 0&&(c.floatingElement=o.floating),i.update(c)},[e,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=!1,i}function vr(t={}){const{nodeId:e,externalTree:n}=t,o=yr(t),r=t.rootContext||o,s={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[i,c]=y.useState(null),f=y.useRef(null),a=ft(n);z(()=>{s.domReference&&(f.current=s.domReference)},[s.domReference]);const u=ur({...t,elements:{...s,...i&&{reference:i}}}),p=y.useCallback(T=>{const M=j(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;c(M),u.refs.setReference(M)},[u.refs]),[m,g]=y.useState(null),[l,d]=y.useState(null);r.useSyncedValue("referenceElement",m),r.useSyncedValue("domReferenceElement",j(m)?m:null),r.useSyncedValue("floatingElement",l);const h=y.useCallback(T=>{(j(T)||T===null)&&(f.current=T,g(T)),(j(u.refs.reference.current)||u.refs.reference.current===null||T!==null&&!j(T))&&u.refs.setReference(T)},[u.refs,g]),v=y.useCallback(T=>{d(T),u.refs.setFloating(T)},[u.refs]),R=y.useMemo(()=>({...u.refs,setReference:h,setFloating:v,setPositionReference:p,domReference:f}),[u.refs,h,v,p]),w=y.useMemo(()=>({...u.elements,domReference:s.domReference}),[u.elements,s.domReference]),x=r.useState("open"),S=r.useState("floatingId"),E=y.useMemo(()=>({...u,dataRef:r.context.dataRef,open:x,onOpenChange:r.setOpen,events:r.context.events,floatingId:S,refs:R,elements:w,nodeId:e,rootStore:r}),[u,R,w,e,r,x,S]);return z(()=>{r.context.dataRef.current.floatingContext=E;const T=a?.nodesRef.current.find(M=>M.id===e);T&&(T.context=E)}),y.useMemo(()=>({...u,context:E,refs:R,elements:w,rootStore:r}),[u,R,w,E,r])}const rt=ho&&yo;function xr(t,e={}){const n="rootStore"in t?t.rootStore:t,{events:o,dataRef:r}=n.context,{enabled:s=!0,delay:i}=e,c=y.useRef(!1),f=y.useRef(null),a=Jt(),u=y.useRef(!0);y.useEffect(()=>{const m=n.select("domReferenceElement");if(!s)return;const g=re(m);function l(){const v=n.select("domReferenceElement");!n.select("open")&&le(v)&&v===Vt(ve(v))&&(c.current=!0)}function d(){u.current=!0}function h(){u.current=!1}return g.addEventListener("blur",l),rt&&(g.addEventListener("keydown",d,!0),g.addEventListener("pointerdown",h,!0)),()=>{g.removeEventListener("blur",l),rt&&(g.removeEventListener("keydown",d,!0),g.removeEventListener("pointerdown",h,!0))}},[n,s]),y.useEffect(()=>{if(!s)return;function m(g){if(g.reason===cn||g.reason===ln){const l=n.select("domReferenceElement");j(l)&&(f.current=l,c.current=!0)}}return o.on("openchange",m),()=>{o.off("openchange",m)}},[o,s,n]);const p=y.useMemo(()=>({onMouseLeave(){c.current=!1,f.current=null},onFocus(m){const g=m.currentTarget;if(c.current){if(f.current===g)return;c.current=!1,f.current=null}const l=Ge(m.nativeEvent);if(j(l)){if(rt&&!m.relatedTarget){if(!u.current&&!po(l))return}else if(!mo(l))return}const d=je(m.relatedTarget,n.context.triggerElements),{nativeEvent:h,currentTarget:v}=m,R=typeof i=="function"?i():i;if(n.select("open")&&d||R===0||R===void 0){n.setOpen(!0,_(Fe,h,v));return}a.start(R,()=>{c.current||n.setOpen(!0,_(Fe,h,v))})},onBlur(m){c.current=!1,f.current=null;const g=m.relatedTarget,l=m.nativeEvent,d=j(g)&&g.hasAttribute(tn("focus-guard"))&&g.getAttribute("data-type")==="outside";a.start(0,()=>{const h=n.select("domReferenceElement"),v=Vt(h?h.ownerDocument:document);!g&&v===h||Z(r.current.floatingContext?.refs.floating.current,v)||Z(h,v)||d||je(g??v,n.context.triggerElements)||n.setOpen(!1,_(Fe,l))})}}),[r,n,a,i]);return y.useMemo(()=>s?{reference:p,trigger:p}:{},[s,p])}const lt=tn("safe-polygon"),wr=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${xo}`;function Rr(t){return t?!!t.closest(wr):!1}class ht{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.unbindMouseMove=()=>{},this.restTimeoutPending=!1,this.openChangeTimeout=new $e,this.restTimeout=new $e,this.handleCloseOptions=void 0}static create(){return new ht}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}function En(t){const e=at(ht.create).current,n=t.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=e),vo(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}const br=new Set(["click","mousedown"]);function Er(t,e={}){const n="rootStore"in t?t.rootStore:t,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:c=!0,closeDelay:f=0}=e,a=En(n),u=ft(),p=Zt(),m=X(()=>a.interactedInside?!0:i.current.openEvent?br.has(i.current.openEvent.type):!1),g=X(()=>{const w=i.current.openEvent?.type;return w?.includes("mouse")&&w!=="mousedown"}),l=X(w=>je(w,n.context.triggerElements)),d=y.useCallback((w,x=!0)=>{const S=Cr(f,a.pointerType);S&&!a.handler?a.openChangeTimeout.start(S,()=>n.setOpen(!1,_(oe,w))):x&&(a.openChangeTimeout.clear(),n.setOpen(!1,_(oe,w)))},[f,n,a]),h=X(()=>{a.unbindMouseMove(),a.handler=void 0}),v=X(()=>{if(a.performedPointerEventsMutation){const w=ve(r).body;w.style.pointerEvents="",w.removeAttribute(lt),a.performedPointerEventsMutation=!1}}),R=X(w=>{const x=Ge(w);if(!Rr(x)){a.interactedInside=!1;return}a.interactedInside=!0});z(()=>{o||(a.pointerType=void 0,a.restTimeoutPending=!1,a.interactedInside=!1,h(),v())},[o,a,h,v]),y.useEffect(()=>()=>{h()},[h]),y.useEffect(()=>v,[v]),z(()=>{if(c&&o&&a.handleCloseOptions?.blockPointerEvents&&g()&&j(s)&&r){a.performedPointerEventsMutation=!0;const w=ve(r).body;w.setAttribute(lt,"");const x=s,S=r,E=u?.nodesRef.current.find(T=>T.id===p)?.context?.elements.floating;return E&&(E.style.pointerEvents=""),w.style.pointerEvents="none",x.style.pointerEvents="auto",S.style.pointerEvents="auto",()=>{w.style.pointerEvents="",x.style.pointerEvents="",S.style.pointerEvents=""}}},[c,o,s,r,a,g,u,p]),y.useEffect(()=>{if(!c)return;function w(T){m()||!i.current.floatingContext||!n.select("open")||l(T.relatedTarget)||(v(),h(),m()||d(T))}function x(T){a.openChangeTimeout.clear(),v(),a.handler?.(T),h()}function S(T){m()||d(T,!1)}const E=r;return E&&(E.addEventListener("mouseleave",w),E.addEventListener("mouseenter",x),E.addEventListener("mouseleave",S),E.addEventListener("pointerdown",R,!0)),()=>{E&&(E.removeEventListener("mouseleave",w),E.removeEventListener("mouseenter",x),E.removeEventListener("mouseleave",S),E.removeEventListener("pointerdown",R,!0))}},[c,r,n,i,m,l,d,v,h,R,a])}function Cr(t,e){return e&&!Oe(e)?0:typeof t=="function"?t():t}function st(t){return typeof t=="function"?t():t}const Sr={current:null};function Tr(t,e={}){const n="rootStore"in t?t.rootStore:t,{dataRef:o,events:r}=n.context,{enabled:s=!0,delay:i=0,handleClose:c=null,mouseOnly:f=!1,restMs:a=0,move:u=!0,triggerElementRef:p=Sr,externalTree:m,isActiveTrigger:g=!0}=e,l=ft(m),d=En(n),h=ye(c),v=ye(i),R=ye(a),w=ye(s);g&&(d.handleCloseOptions=h.current?.__options);const x=X(()=>d.interactedInside?!0:o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1),S=X(O=>je(O,n.context.triggerElements)),E=y.useCallback((O,I=!0)=>{const P=He(v.current,"close",d.pointerType);P&&!d.handler?d.openChangeTimeout.start(P,()=>n.setOpen(!1,_(oe,O))):I&&(d.openChangeTimeout.clear(),n.setOpen(!1,_(oe,O)))},[v,n,d]),T=X(()=>{d.unbindMouseMove(),d.handler=void 0}),M=X(()=>{if(d.performedPointerEventsMutation){const O=ve(n.select("domReferenceElement")).body;O.style.pointerEvents="",O.removeAttribute(lt),d.performedPointerEventsMutation=!1}});y.useEffect(()=>{if(!s)return;function O(I){I.open||(d.openChangeTimeout.clear(),d.restTimeout.clear(),d.blockMouseMove=!0,d.restTimeoutPending=!1)}return r.on("openchange",O),()=>{r.off("openchange",O)}},[s,r,d]);const H=X(O=>{if(x()||!o.current.floatingContext||S(O.relatedTarget))return;const I=p.current;h.current?.({...o.current.floatingContext,tree:l,x:O.clientX,y:O.clientY,onClose(){M(),T(),!x()&&I===n.select("domReferenceElement")&&E(O)}})(O)});return y.useEffect(()=>{if(!s)return;const O=p.current??(g?n.select("domReferenceElement"):null);if(!j(O))return;function I(A){if(d.openChangeTimeout.clear(),d.blockMouseMove=!1,f&&!Oe(d.pointerType)||st(R.current)>0&&!He(v.current,"open"))return;const D=He(v.current,"open",d.pointerType),k=n.select("domReferenceElement"),F=n.context.triggerElements,C=(F.hasElement(A.target)||F.hasMatchingElement(q=>Z(q,A.target)))&&(!k||!Z(k,A.target)),L=A.currentTarget??null,V=n.select("open"),N=!V||C;C&&V?n.setOpen(!0,_(oe,A,L)):D?d.openChangeTimeout.start(D,()=>{N&&n.setOpen(!0,_(oe,A,L))}):N&&n.setOpen(!0,_(oe,A,L))}function P(A){if(x()){M();return}d.unbindMouseMove();const D=n.select("domReferenceElement"),k=ve(D);if(d.restTimeout.clear(),d.restTimeoutPending=!1,S(A.relatedTarget))return;if(h.current&&o.current.floatingContext){n.select("open")||d.openChangeTimeout.clear();const C=p.current;d.handler=h.current({...o.current.floatingContext,tree:l,x:A.clientX,y:A.clientY,onClose(){M(),T(),w.current&&!x()&&C===n.select("domReferenceElement")&&E(A,!0)}});const L=d.handler;L(A),k.addEventListener("mousemove",L),d.unbindMouseMove=()=>{k.removeEventListener("mousemove",L)};return}(d.pointerType!=="touch"||!Z(n.select("floatingElement"),A.relatedTarget))&&E(A)}function b(A){H(A)}return n.select("open")&&O.addEventListener("mouseleave",b),u&&O.addEventListener("mousemove",I,{once:!0}),O.addEventListener("mouseenter",I),O.addEventListener("mouseleave",P),()=>{O.removeEventListener("mouseleave",b),u&&O.removeEventListener("mousemove",I),O.removeEventListener("mouseenter",I),O.removeEventListener("mouseleave",P)}},[T,M,o,v,E,n,s,h,H,d,g,x,S,f,u,R,p,l,w]),y.useMemo(()=>{if(!s)return;function O(I){d.pointerType=I.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(I){const{nativeEvent:P}=I,b=I.currentTarget,A=n.select("domReferenceElement"),D=n.context.triggerElements,k=n.select("open"),F=(D.hasElement(I.target)||D.hasMatchingElement(L=>Z(L,I.target)))&&(!A||!Z(A,I.target));if(f&&!Oe(d.pointerType)||k&&!F||st(R.current)===0||!F&&d.restTimeoutPending&&I.movementX**2+I.movementY**2<2)return;d.restTimeout.clear();function C(){if(d.restTimeoutPending=!1,x())return;const L=n.select("open");!d.blockMouseMove&&(!L||F)&&n.setOpen(!0,_(oe,P,b))}d.pointerType==="touch"?Ue.flushSync(()=>{C()}):F&&k?C():(d.restTimeoutPending=!0,d.restTimeout.start(st(R.current),C))}}},[s,d,x,f,n,R])}function qt(t,e){const[n,o]=t;let r=!1;const s=e.length;for(let i=0,c=s-1;i<s;c=i++){const[f,a]=e[i]||[0,0],[u,p]=e[c]||[0,0];a>=o!=p>=o&&n<=(u-f)*(o-a)/(p-a)+f&&(r=!r)}return r}function Pr(t,e){return t[0]>=e.x&&t[0]<=e.x+e.width&&t[1]>=e.y&&t[1]<=e.y+e.height}function Or(t={}){const{buffer:e=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=t,r=new $e;let s=!1,i=null,c=null,f=typeof performance<"u"?performance.now():0;function a(p,m){const g=performance.now(),l=g-f;if(i===null||c===null||l===0)return i=p,c=m,f=g,null;const d=p-i,h=m-c,R=Math.sqrt(d*d+h*h)/l;return i=p,c=m,f=g,R}const u=({x:p,y:m,placement:g,elements:l,onClose:d,nodeId:h,tree:v})=>function(w){function x(){r.clear(),d()}if(r.clear(),!l.domReference||!l.floating||g==null||p==null||m==null)return;const{clientX:S,clientY:E}=w,T=[S,E],M=Ge(w),H=w.type==="mouseleave",O=Z(l.floating,M),I=Z(l.domReference,M),P=l.domReference.getBoundingClientRect(),b=l.floating.getBoundingClientRect(),A=g.split("-")[0],D=p>b.right-b.width/2,k=m>b.bottom-b.height/2,F=Pr(T,P),C=b.width>P.width,L=b.height>P.height,V=(C?P:b).left,N=(C?P:b).right,q=(L?P:b).top,me=(L?P:b).bottom;if(O&&(s=!0,!H))return;if(I&&(s=!1),I&&!H){s=!0;return}if(H&&j(w.relatedTarget)&&Z(l.floating,w.relatedTarget)||v&&jn(v.nodesRef.current,h).some(({context:B})=>B?.open))return;if(A==="top"&&m>=P.bottom-1||A==="bottom"&&m<=P.top+1||A==="left"&&p>=P.right-1||A==="right"&&p<=P.left+1)return x();let te=[];switch(A){case"top":te=[[V,P.top+1],[V,b.bottom-1],[N,b.bottom-1],[N,P.top+1]];break;case"bottom":te=[[V,b.top+1],[V,P.bottom-1],[N,P.bottom-1],[N,b.top+1]];break;case"left":te=[[b.right-1,me],[b.right-1,q],[P.left+1,q],[P.left+1,me]];break;case"right":te=[[P.right-1,me],[P.right-1,q],[b.left+1,q],[b.left+1,me]];break}function fe([B,W]){switch(A){case"top":{const de=[C?B+e/2:D?B+e*4:B-e*4,W+e+1],ge=[C?B-e/2:D?B+e*4:B-e*4,W+e+1],J=[[b.left,D||C?b.bottom-e:b.top],[b.right,D?C?b.bottom-e:b.top:b.bottom-e]];return[de,ge,...J]}case"bottom":{const de=[C?B+e/2:D?B+e*4:B-e*4,W-e],ge=[C?B-e/2:D?B+e*4:B-e*4,W-e],J=[[b.left,D||C?b.top+e:b.bottom],[b.right,D?C?b.top+e:b.bottom:b.top+e]];return[de,ge,...J]}case"left":{const de=[B+e+1,L?W+e/2:k?W+e*4:W-e*4],ge=[B+e+1,L?W-e/2:k?W+e*4:W-e*4];return[...[[k||L?b.right-e:b.left,b.top],[k?L?b.right-e:b.left:b.right-e,b.bottom]],de,ge]}case"right":{const de=[B-e,L?W+e/2:k?W+e*4:W-e*4],ge=[B-e,L?W-e/2:k?W+e*4:W-e*4],J=[[k||L?b.left+e:b.right,b.top],[k?L?b.left+e:b.right:b.left+e,b.bottom]];return[de,ge,...J]}default:return[]}}if(!qt([S,E],te)){if(s&&!F)return x();if(!H&&o){const B=a(w.clientX,w.clientY);if(B!==null&&B<.1)return x()}qt([S,E],fe([p,m]))?!s&&o&&r.start(40,x):x()}};return u.__options={blockPointerEvents:n},u}function Cn(t){return t==="starting"?Nn:$n}const Ar=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:r,rects:s,platform:i,elements:c,middlewareData:f}=e,{element:a,padding:u=0,offsetParent:p="real"}=ae(t,e)||{};if(a==null)return{};const m=un(u),g={x:n,y:o},l=an(r),d=fn(l),h=await i.getDimensions(a),v=l==="y",R=v?"top":"left",w=v?"bottom":"right",x=v?"clientHeight":"clientWidth",S=s.reference[d]+s.reference[l]-g[l]-s.floating[d],E=g[l]-s.reference[l],T=p==="real"?await i.getOffsetParent?.(a):c.floating;let M=c.floating[x]||s.floating[d];(!M||!await i.isElement?.(T))&&(M=c.floating[x]||s.floating[d]);const H=S/2-E/2,O=M/2-h[d]/2-1,I=Math.min(m[R],O),P=Math.min(m[w],O),b=I,A=M-h[d]-P,D=M/2-h[d]/2+H,k=ct(b,D,A),F=!f.arrow&&Ee(r)!=null&&D!==k&&s.reference[d]/2-(D<b?I:P)-h[d]/2<0,C=F?D<b?D-b:D-A:0;return{[l]:g[l]+C,data:{[l]:k,centerOffset:D-k-C,...F&&{alignmentOffset:C}},reset:F}}}),Mr=(t,e)=>({...Ar(t),options:[t,e]}),Lr={name:"hide",async fn(t){const{width:e,height:n,x:o,y:r}=t.rects.reference,s=e===0&&n===0&&o===0&&r===0;return{data:{referenceHidden:(await hr().fn(t)).data?.referenceHidden||s}}}},Ve={sideX:"left",sideY:"top"},Dr={name:"adaptiveOrigin",async fn(t){const{x:e,y:n,rects:{floating:o},elements:{floating:r},platform:s,strategy:i,placement:c}=t,f=re(r),a=f.getComputedStyle(r);if(!(a.transitionDuration!=="0s"&&a.transitionDuration!==""))return{x:e,y:n,data:Ve};const p=await s.getOffsetParent?.(r);let m={width:0,height:0};if(i==="fixed"&&f?.visualViewport)m={width:f.visualViewport.width,height:f.visualViewport.height};else if(p===f){const R=ve(r);m={width:R.documentElement.clientWidth,height:R.documentElement.clientHeight}}else await s.isElement?.(p)&&(m=await s.getDimensions(p));const g=Q(c);let l=e,d=n;g==="left"&&(l=m.width-(e+o.width)),g==="top"&&(d=m.height-(n+o.height));const h=g==="left"?"right":Ve.sideX,v=g==="top"?"bottom":Ve.sideY;return{x:l,y:d,data:{sideX:h,sideY:v}}}};function Sn(t,e,n){const o=t==="inline-start"||t==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[e]}function Gt(t,e,n){const{rects:o,placement:r}=t;return{side:Sn(e,Q(r),n),align:Ee(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function Ir(t){const{anchor:e,positionMethod:n="absolute",side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:f=5,sticky:a=!1,arrowPadding:u=5,disableAnchorTracking:p=!1,keepMounted:m=!1,floatingRootContext:g,mounted:l,collisionAvoidance:d,shiftCrossAxis:h=!1,nodeId:v,adaptiveOrigin:R,lazyFlip:w=!1,externalTree:x}=t,[S,E]=y.useState(null);!l&&S!==null&&E(null);const T=d.side||"flip",M=d.align||"flip",H=d.fallbackAxisSide||"end",O=typeof e=="function"?e:void 0,I=X(O),P=O?I:e,b=ye(e),D=So()==="rtl",k=S||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":D?"left":"right","inline-start":D?"right":"left"}[o],F=s==="center"?k:`${k}-${s}`;let C=f;const L=1,V=o==="bottom"?L:0,N=o==="top"?L:0,q=o==="right"?L:0,me=o==="left"?L:0;typeof C=="number"?C={top:C+V,right:C+me,bottom:C+N,left:C+q}:C&&(C={top:(C.top||0)+V,right:(C.right||0)+me,bottom:(C.bottom||0)+N,left:(C.left||0)+q});const te={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:C},fe=y.useRef(null),B=ye(r),W=ye(i),J=[fr($=>{const Y=Gt($,o,D),ne=typeof B.current=="function"?B.current(Y):B.current,G=typeof W.current=="function"?W.current(Y):W.current;return{mainAxis:ne,crossAxis:G,alignmentAxis:G}},[typeof r!="function"?r:0,typeof i!="function"?i:0,D,o])],vt=M==="none"&&T!=="shift",xt=!vt&&(a||h||T==="shift"),wt=T==="none"?null:pr({...te,padding:{top:C.top+L,right:C.right+L,bottom:C.bottom+L,left:C.left+L},mainAxis:!h&&T==="flip",crossAxis:M==="flip"?"alignment":!1,fallbackAxisSideDirection:H}),Rt=vt?null:dr($=>{const Y=ve($.elements.floating).documentElement;return{...te,rootBoundary:h?{x:0,y:0,width:Y.clientWidth,height:Y.clientHeight}:void 0,mainAxis:M!=="none",crossAxis:xt,limiter:a||h?void 0:gr(ne=>{if(!fe.current)return{};const{width:G,height:ie}=fe.current.getBoundingClientRect(),De=ee(Q(ne.placement)),Ie=De==="y"?G:ie,et=De==="y"?C.left+C.right:C.top+C.bottom;return{offset:Ie/2+et/2}})}},[te,a,h,C,M]);T==="shift"||M==="shift"||s==="center"?J.push(Rt,wt):J.push(wt,Rt),J.push(mr({...te,apply({elements:{floating:$},rects:{reference:Y},availableWidth:ne,availableHeight:G}){const ie=$.style;ie.setProperty("--available-width",`${ne}px`),ie.setProperty("--available-height",`${G}px`),ie.setProperty("--anchor-width",`${Y.width}px`),ie.setProperty("--anchor-height",`${Y.height}px`)}}),Mr(()=>({element:fe.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn($){const{elements:Y,middlewareData:ne,placement:G,rects:ie,y:De}=$,Ie=Q(G),et=ee(Ie),Ft=fe.current,Mn=ne.arrow?.x||0,Ln=ne.arrow?.y||0,Dn=Ft?.clientWidth||0,In=Ft?.clientHeight||0,tt=Mn+Dn/2,Ht=Ln+In/2,kn=Math.abs(ne.shift?.y||0),Fn=ie.reference.height/2,Te=typeof r=="function"?r(Gt($,o,D)):r,Hn=kn>Te,Bn={top:`${tt}px calc(100% + ${Te}px)`,bottom:`${tt}px ${-Te}px`,left:`calc(100% + ${Te}px) ${Ht}px`,right:`${-Te}px ${Ht}px`}[Ie],Vn=`${tt}px ${ie.reference.y+Fn-De}px`;return Y.floating.style.setProperty("--transform-origin",xt&&et==="y"&&Hn?Vn:Bn),{}}},Lr,R),z(()=>{!l&&g&&g.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[l,g]);const Je=y.useMemo(()=>({elementResize:!p&&typeof ResizeObserver<"u",layoutShift:!p&&typeof IntersectionObserver<"u"}),[p]),{refs:we,elements:Ce,x:bt,y:Et,middlewareData:Re,update:Me,placement:Ct,context:St,isPositioned:he,floatingStyles:Tt}=vr({rootContext:g,placement:F,middleware:J,strategy:n,whileElementsMounted:m?void 0:(...$)=>Ut(...$,Je),nodeId:v,externalTree:x}),{sideX:Pt,sideY:Ot}=Re.adaptiveOrigin||Ve,Ze=he?n:"fixed",At=y.useMemo(()=>{const $=R?{position:Ze,[Pt]:bt,[Ot]:Et}:{position:Ze,...Tt};return he||($.opacity=0),$},[R,Ze,Pt,bt,Ot,Et,Tt,he]),Le=y.useRef(null);z(()=>{if(!l)return;const $=b.current,Y=typeof $=="function"?$():$,G=(Kt(Y)?Y.current:Y)||null||null;G!==Le.current&&(we.setPositionReference(G),Le.current=G)},[l,we,P,b]),y.useEffect(()=>{if(!l)return;const $=b.current;typeof $!="function"&&Kt($)&&$.current!==Le.current&&(we.setPositionReference($.current),Le.current=$.current)},[l,we,P,b]),y.useEffect(()=>{if(m&&l&&Ce.domReference&&Ce.floating)return Ut(Ce.domReference,Ce.floating,Me,Je)},[m,l,Ce,Me,Je]);const Se=Q(Ct),Mt=Sn(o,Se,D),Lt=Ee(Ct)||"center",Dt=!!Re.hide?.referenceHidden;z(()=>{w&&l&&he&&E(Se)},[w,l,he,Se]);const It=y.useMemo(()=>({position:"absolute",top:Re.arrow?.y,left:Re.arrow?.x}),[Re.arrow]),kt=Re.arrow?.centerOffset!==0;return y.useMemo(()=>({positionerStyles:At,arrowStyles:It,arrowRef:fe,arrowUncentered:kt,side:Mt,align:Lt,physicalSide:Se,anchorHidden:Dt,refs:we,context:St,isPositioned:he,update:Me}),[At,It,fe,kt,Mt,Lt,Se,Dt,we,St,he,Me])}function Kt(t){return t!=null&&"current"in t}const Tn=y.createContext(void 0);function Qe(t){const e=y.useContext(Tn);if(e===void 0&&!t)throw new Error(ze(72));return e}const kr={..._n,disabled:pe(t=>t.disabled),instantType:pe(t=>t.instantType),isInstantPhase:pe(t=>t.isInstantPhase),trackCursorAxis:pe(t=>t.trackCursorAxis),disableHoverablePopup:pe(t=>t.disableHoverablePopup),lastOpenChangeReason:pe(t=>t.openChangeReason),closeDelay:pe(t=>t.closeDelay),hasViewport:pe(t=>t.hasViewport)};class yt extends Yn{constructor(e){super({...Fr(),...e},{popupRef:y.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new en},kr)}setOpen=(e,n)=>{const o=n.reason,r=o===oe,s=e&&o===Fe,i=!e&&(o===cn||o===ln);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,n),n.isCanceled)return;const c=()=>{const f={open:e,openChangeReason:o};s?f.instantType="focus":i?f.instantType="dismiss":o===oe&&(f.instantType=void 0);const a=n.trigger?.id??null;(a||e)&&(f.activeTriggerId=a,f.activeTriggerElement=n.trigger??null),this.update(f)};r?Ue.flushSync(c):c()};static useStore(e,n){const o=at(()=>new yt(n)).current,r=e??o,s=Xn({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=s,r}}function Fr(){return{...Un(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0,hasViewport:!1}}const Hr=zn(function(e){const{disabled:n=!1,defaultOpen:o=!1,open:r,disableHoverablePopup:s=!1,trackCursorAxis:i="none",actionsRef:c,onOpenChange:f,onOpenChangeComplete:a,handle:u,triggerId:p,defaultTriggerId:m=null,children:g}=e,l=yt.useStore(u?.store,{open:o,openProp:r,activeTriggerId:m,triggerIdProp:p});qn(()=>{r===void 0&&l.state.open===!1&&o===!0&&l.update({open:!0,activeTriggerId:m})}),l.useControlledProp("openProp",r),l.useControlledProp("triggerIdProp",p),l.useContextCallback("onOpenChange",f),l.useContextCallback("onOpenChangeComplete",a);const d=l.useState("open"),h=!n&&d,v=l.useState("activeTriggerId"),R=l.useState("payload");l.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:s}),z(()=>{d&&n&&l.setOpen(!1,_(uo))},[d,n,l]),l.useSyncedValue("disabled",n),Gn(l);const{forceUnmount:w,transitionStatus:x}=Kn(h,l),S=l.useState("isInstantPhase"),E=l.useState("instantType"),T=l.useState("lastOpenChangeReason"),M=y.useRef(null);z(()=>{x==="ending"&&T===on||x!=="ending"&&S?(E!=="delay"&&(M.current=E),l.set("instantType","delay")):M.current!==null&&(l.set("instantType",M.current),M.current=null)},[x,S,T,E,l]),z(()=>{h&&v==null&&l.set("payload",void 0)},[l,v,h]);const H=y.useCallback(()=>{l.setOpen(!1,Br(l,fo))},[l]);y.useImperativeHandle(c,()=>({unmount:w,close:H}),[w,H]);const O=l.useState("floatingRootContext"),I=Qn(O,{enabled:!n,referencePress:!0}),P=Ao(O,{enabled:!n&&i!=="none",axis:i==="none"?void 0:i}),{getReferenceProps:b,getFloatingProps:A,getTriggerProps:D}=Jn([I,P]),k=y.useMemo(()=>b(),[b]),F=y.useMemo(()=>D(),[D]),C=y.useMemo(()=>A(),[A]);return l.useSyncedValues({activeTriggerProps:k,inactiveTriggerProps:F,popupProps:C}),U.jsx(Tn.Provider,{value:l,children:typeof g=="function"?g({payload:R}):g})});function Br(t,e){const n=_(e);return n.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},n}const Pn=y.createContext(void 0);function Vr(){return y.useContext(Pn)}let $r=(function(t){return t[t.popupOpen=Zn.popupOpen]="popupOpen",t.triggerDisabled="data-trigger-disabled",t})({});const Wr=600,jr=eo(function(e,n){const{className:o,render:r,handle:s,payload:i,disabled:c,delay:f,closeDelay:a,id:u,...p}=e,m=Qe(!0),g=s?.store??m;if(!g)throw new Error(ze(82));const l=go(u),d=g.useState("isTriggerActive",l),h=g.useState("isOpenedByTrigger",l),v=g.useState("floatingRootContext"),R=y.useRef(null),w=f??Wr,x=a??0,{registerTrigger:S,isMountedByThisTrigger:E}=to(l,R,g,{payload:i,closeDelay:x}),T=Vr(),{delayRef:M,isInstantPhase:H,hasProvider:O}=Po(v,{open:h});g.useSyncedValue("isInstantPhase",H);const I=g.useState("disabled"),P=c??I,b=g.useState("trackCursorAxis"),A=g.useState("disableHoverablePopup"),D=Tr(v,{enabled:!P,mouseOnly:!0,move:!1,handleClose:!A&&b!=="both"?Or():null,restMs(){const V=T?.delay,N=typeof M.current=="object"?M.current.open:void 0;let q=w;return O&&(N!==0?q=f??V??w:q=0),q},delay(){const V=typeof M.current=="object"?M.current.close:void 0;let N=x;return a==null&&O&&(N=V),{close:N}},triggerElementRef:R,isActiveTrigger:d}),k=xr(v,{enabled:!P}).reference,F={open:h},C=g.useState("triggerProps",E);return ut("button",e,{state:F,ref:[n,S,R],props:[D,k,C,{id:l,[$r.triggerDisabled]:P?"":void 0},p],stateAttributesMapping:no})}),On=y.createContext(void 0);function Nr(){const t=y.useContext(On);if(t===void 0)throw new Error(ze(70));return t}const Yr=y.forwardRef(function(e,n){const{children:o,container:r,className:s,render:i,...c}=e,{portalNode:f,portalSubtree:a}=oo({container:r,ref:n,componentProps:e,elementProps:c});return!a&&!f?null:U.jsxs(y.Fragment,{children:[a,f&&Ue.createPortal(o,f)]})}),_r=y.forwardRef(function(e,n){const{keepMounted:o=!1,...r}=e;return Qe().useState("mounted")||o?U.jsx(On.Provider,{value:o,children:U.jsx(Yr,{ref:n,...r})}):null}),An=y.createContext(void 0);function Xr(){const t=y.useContext(An);if(t===void 0)throw new Error(ze(71));return t}const Ur=y.forwardRef(function(e,n){const{render:o,className:r,anchor:s,positionMethod:i="absolute",side:c="top",align:f="center",sideOffset:a=0,alignOffset:u=0,collisionBoundary:p="clipping-ancestors",collisionPadding:m=5,arrowPadding:g=5,sticky:l=!1,disableAnchorTracking:d=!1,collisionAvoidance:h=ro,...v}=e,R=Qe(),w=Nr(),x=R.useState("open"),S=R.useState("mounted"),E=R.useState("trackCursorAxis"),T=R.useState("disableHoverablePopup"),M=R.useState("floatingRootContext"),H=R.useState("instantType"),O=R.useState("transitionStatus"),I=R.useState("hasViewport"),P=Ir({anchor:s,positionMethod:i,floatingRootContext:M,mounted:S,side:c,sideOffset:a,align:f,alignOffset:u,collisionBoundary:p,collisionPadding:m,sticky:l,arrowPadding:g,disableAnchorTracking:d,keepMounted:w,collisionAvoidance:h,adaptiveOrigin:I?Dr:void 0}),b=y.useMemo(()=>{const F={};return(!x||E==="both"||T)&&(F.pointerEvents="none"),{role:"presentation",hidden:!S,style:{...P.positionerStyles,...F}}},[x,E,T,S,P.positionerStyles]),A=y.useMemo(()=>({open:x,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:E!=="none"?"tracking-cursor":H}),[x,P.side,P.align,P.anchorHidden,E,H]),D=y.useMemo(()=>({...A,arrowRef:P.arrowRef,arrowStyles:P.arrowStyles,arrowUncentered:P.arrowUncentered}),[A,P.arrowRef,P.arrowStyles,P.arrowUncentered]),k=ut("div",e,{state:A,props:[b,Cn(O),v],ref:[n,R.useStateSetter("positionerElement")],stateAttributesMapping:nn});return U.jsx(An.Provider,{value:D,children:k})}),zr={...nn,...io},qr=y.forwardRef(function(e,n){const{className:o,render:r,...s}=e,i=Qe(),{side:c,align:f}=Xr(),a=i.useState("open"),u=i.useState("instantType"),p=i.useState("transitionStatus"),m=i.useState("popupProps"),g=i.useState("floatingRootContext");so({open:a,ref:i.context.popupRef,onComplete(){a&&i.context.onOpenChangeComplete?.(!0)}});const l=i.useState("disabled"),d=i.useState("closeDelay");return Er(g,{enabled:!l,closeDelay:d}),ut("div",e,{state:{open:a,side:c,align:f,instant:u,transitionStatus:p},ref:[n,i.context.popupRef,i.useStateSetter("popupElement")],props:[m,Cn(p),s],stateAttributesMapping:zr})}),Gr=function(e){const{delay:n,closeDelay:o,timeout:r=400}=e,s=y.useMemo(()=>({delay:n,closeDelay:o}),[n,o]),i=y.useMemo(()=>({open:n,close:o}),[n,o]);return U.jsx(Pn.Provider,{value:s,children:U.jsx(To,{delay:i,timeoutMs:r,children:e.children})})};function rs({children:t}){return U.jsx(Gr,{delay:0,closeDelay:0,timeout:0,children:t})}function ss({children:t,...e}){return U.jsx(Hr,{...e,children:t})}function is({className:t,...e}){return U.jsx(jr,{className:Qt(t),...e})}function cs({className:t,side:e="top",children:n}){return U.jsx(_r,{children:U.jsx(Ur,{side:e,children:U.jsx(qr,{className:Qt("rounded-md border border-primary-900 bg-primary-950 px-2 py-1 text-xs text-primary-50 shadow-sm",t),children:n})})})}export{rs as T,ss as a,is as b,cs as c,gn as d,Cn as e,Ir as f,ns as g,Tr as h,Or as i,xr as j,os as s,Er as u};