import{c as pt,r as a,j as g,at as Ue,W as Jt,au as Qt,$ as en,av as tn,aw as qe,z as nn,n as rn,T as on,b as an}from"./index-C3tzC6TG.js";import{r as ht}from"./index-BKD_njTm.js";import{C as sn,a as cn}from"./cloud-download-U4tFtHIE.js";import{R as un}from"./refresh-cw-COF4ZaAx.js";import{S as ln}from"./search-CMGuC7tW.js";import{F as dn}from"./file-text-CgoPL5rz.js";/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fn=pt("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vn=pt("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);var Ze=1,mn=.9,pn=.8,hn=.17,ke=.1,Pe=.999,gn=.9999,bn=.99,yn=/[\\\/_+.#"@\[\(\{&]/,En=/[\\\/_+.#"@\[\(\{&]/g,wn=/[\s-]/,gt=/[\s-]/g;function Fe(e,t,n,r,o,i,c){if(i===t.length)return o===e.length?Ze:bn;var s=`${o},${i}`;if(c[s]!==void 0)return c[s];for(var m=r.charAt(i),u=n.indexOf(m,o),l=0,f,h,p,y;u>=0;)f=Fe(e,t,n,r,u+1,i+1,c),f>l&&(u===o?f*=Ze:yn.test(e.charAt(u-1))?(f*=pn,p=e.slice(o,u-1).match(En),p&&o>0&&(f*=Math.pow(Pe,p.length))):wn.test(e.charAt(u-1))?(f*=mn,y=e.slice(o,u-1).match(gt),y&&o>0&&(f*=Math.pow(Pe,y.length))):(f*=hn,o>0&&(f*=Math.pow(Pe,u-o))),e.charAt(u)!==t.charAt(i)&&(f*=gn)),(ff&&(f=h*ke)),f>l&&(l=f),u=n.indexOf(m,u+1);return c[s]=l,l}function Je(e){return e.toLowerCase().replace(gt," ")}function Sn(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Fe(e,t,Je(e),Je(t),0,0,{})}function z(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Qe(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function re(...e){return t=>{let n=!1;const r=e.map(o=>{const i=Qe(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o{var x;const{scope:h,children:p,...y}=f,d=((x=h==null?void 0:h[e])==null?void 0:x[m])||s,b=a.useMemo(()=>y,Object.values(y));return g.jsx(d.Provider,{value:b,children:p})};u.displayName=i+"Provider";function l(f,h){var d;const p=((d=h==null?void 0:h[e])==null?void 0:d[m])||s,y=a.useContext(p);if(y)return y;if(c!==void 0)return c;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,l]}const o=()=>{const i=n.map(c=>a.createContext(c));return function(s){const m=(s==null?void 0:s[e])||i;return a.useMemo(()=>({[`__scope${e}`]:{...s,[e]:m}}),[s,m])}};return o.scopeName=e,[r,Cn(o,...t)]}function Cn(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const c=r.reduce((s,{useScope:m,scopeName:u})=>{const f=m(i)[`__scope${u}`];return{...s,...f}},{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var se=globalThis!=null&&globalThis.document?a.useLayoutEffect:()=>{},Rn=Ue[" useId ".trim().toString()]||(()=>{}),Nn=0;function V(e){const[t,n]=a.useState(Rn());return se(()=>{n(r=>r??String(Nn++))},[e]),t?`radix-${t}`:""}var kn=Ue[" useInsertionEffect ".trim().toString()]||se;function Pn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,c]=Dn({defaultProp:t,onChange:n}),s=e!==void 0,m=s?e:o;{const l=a.useRef(e!==void 0);a.useEffect(()=>{const f=l.current;f!==s&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=s},[s,r])}const u=a.useCallback(l=>{var f;if(s){const h=On(l)?l(e):l;h!==e&&((f=c.current)==null||f.call(c,h))}else i(l)},[s,e,i,c]);return[m,u]}function Dn({defaultProp:e,onChange:t}){const[n,r]=a.useState(e),o=a.useRef(n),i=a.useRef(t);return kn(()=>{i.current=t},[t]),a.useEffect(()=>{var c;o.current!==n&&((c=i.current)==null||c.call(i,n),o.current=n)},[n,o]),[n,r,i]}function On(e){return typeof e=="function"}function bt(e){const t=a.forwardRef((n,r)=>{let{children:o,...i}=n,c=null,s=!1;const m=[];et(o)&&typeof de=="function"&&(o=de(o._payload)),a.Children.forEach(o,h=>{var p;if(Ln(h)){s=!0;const y=h;let d="child"in y.props?y.props.child:y.props.children;et(d)&&typeof de=="function"&&(d=de(d._payload)),c=An(y,d),m.push((p=c==null?void 0:c.props)==null?void 0:p.children)}else m.push(h)}),c?c=a.cloneElement(c,void 0,m):!s&&a.Children.count(o)===1&&a.isValidElement(o)&&(c=o);const u=c?Tn(c):void 0,l=G(r,u);if(!c){if(o||o===0)throw new Error(s?Wn(e):_n(e));return o}const f=Mn(i,c.props??{});return c.type!==a.Fragment&&(f.ref=r?l:u),a.cloneElement(c,f)});return t.displayName=`${e}.Slot`,t}var In=Symbol.for("radix.slottable"),An=(e,t)=>{if("child"in e.props){const n=e.props.child;return a.isValidElement(n)?a.cloneElement(n,void 0,e.props.children(n.props.children)):null}return a.isValidElement(t)?t:null};function Mn(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...s)=>{const m=i(...s);return o(...s),m}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Tn(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Ln(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===In}var Fn=Symbol.for("react.lazy");function et(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Fn&&"_payload"in e&&jn(e._payload)}function jn(e){return typeof e=="object"&&e!==null&&"then"in e}var _n=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Wn=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,de=Ue[" use ".trim().toString()],Un=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],M=Un.reduce((e,t)=>{const n=bt(`Primitive.${t}`),r=a.forwardRef((o,i)=>{const{asChild:c,...s}=o,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(m,{...s,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function $n(e,t){e&&ht.flushSync(()=>e.dispatchEvent(t))}function ce(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)}),[])}function Bn(e,t=globalThis==null?void 0:globalThis.document){const n=ce(e);a.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Vn="DismissableLayer",je="dismissableLayer.update",Kn="dismissableLayer.pointerDownOutside",zn="dismissableLayer.focusOutside",tt,$e=a.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),yt=a.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:c,onInteractOutside:s,onDismiss:m,...u}=e,l=a.useContext($e),[f,h]=a.useState(null),p=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=a.useState({}),d=G(t,I=>h(I)),b=Array.from(l.layers),[x]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),w=b.indexOf(x),C=f?b.indexOf(f):-1,P=l.layersWithOutsidePointerEventsDisabled.size>0,R=C>=w,N=a.useRef(!1),O=Xn(I=>{const F=I.target;if(!(F instanceof Node))return;const j=[...l.branches].some(W=>W.contains(F));!R||j||(i==null||i(I),s==null||s(I),I.defaultPrevented||m==null||m())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:N,dismissableSurfaces:l.dismissableSurfaces}),B=qn(I=>{if(r&&N.current)return;const F=I.target;[...l.branches].some(W=>W.contains(F))||(c==null||c(I),s==null||s(I),I.defaultPrevented||m==null||m())},p);return Bn(I=>{C===l.layers.size-1&&(o==null||o(I),!I.defaultPrevented&&m&&(I.preventDefault(),m()))},p),a.useEffect(()=>{if(f)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(tt=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),nt(),()=>{n&&(l.layersWithOutsidePointerEventsDisabled.delete(f),l.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=tt))}},[f,p,n,l]),a.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),nt())},[f,l]),a.useEffect(()=>{const I=()=>y({});return document.addEventListener(je,I),()=>document.removeEventListener(je,I)},[]),g.jsx(M.div,{...u,ref:d,style:{pointerEvents:P?R?"auto":"none":void 0,...e.style},onFocusCapture:z(e.onFocusCapture,B.onFocusCapture),onBlurCapture:z(e.onBlurCapture,B.onBlurCapture),onPointerDownCapture:z(e.onPointerDownCapture,O.onPointerDownCapture)})});yt.displayName=Vn;var Hn="DismissableLayerBranch",Yn=a.forwardRef((e,t)=>{const n=a.useContext($e),r=a.useRef(null),o=G(t,r);return a.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),g.jsx(M.div,{...e,ref:o})});Yn.displayName=Hn;function Gn(){const e=a.useContext($e),[t,n]=a.useState(null);return a.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function Xn(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:i}=t,c=ce(e),s=a.useRef(!1),m=a.useRef(!1),u=a.useRef(new Map),l=a.useRef(()=>{});return a.useEffect(()=>{function f(){m.current=!1,o.current=!1,u.current.clear()}function h(){return Array.from(u.current.values()).some(Boolean)}function p(w){if(!m.current)return;const C=w.target;C instanceof Node&&[...i].some(R=>R.contains(C))||u.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{m.current&&l.current()},0)}function y(w){m.current&&u.current.set(w.type,!1)}const d=w=>{if(w.target&&!s.current){let C=function(){n.removeEventListener("click",l.current);const R=h();f(),R||Et(Kn,c,P,{discrete:!0})};const P={originalEvent:w};m.current=!0,o.current=r&&w.button===0,u.current.clear(),!r||w.button!==0?C():(n.removeEventListener("click",l.current),l.current=C,n.addEventListener("click",l.current,{once:!0}))}else n.removeEventListener("click",l.current),f();s.current=!1},b=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of b)n.addEventListener(w,p,!0),n.addEventListener(w,y);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",d)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",d),n.removeEventListener("click",l.current);for(const w of b)n.removeEventListener(w,p,!0),n.removeEventListener(w,y)}},[n,c,r,o,i]),{onPointerDownCapture:()=>s.current=!0}}function qn(e,t=globalThis==null?void 0:globalThis.document){const n=ce(e),r=a.useRef(!1);return a.useEffect(()=>{const o=i=>{i.target&&!r.current&&Et(zn,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function nt(){const e=new CustomEvent(je);document.dispatchEvent(e)}function Et(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?$n(o,i):o.dispatchEvent(i)}var De="focusScope.autoFocusOnMount",Oe="focusScope.autoFocusOnUnmount",rt={bubbles:!1,cancelable:!0},Zn="FocusScope",wt=a.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...c}=e,[s,m]=a.useState(null),u=ce(o),l=ce(i),f=a.useRef(null),h=G(t,d=>m(d)),p=a.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;a.useEffect(()=>{if(r){let d=function(C){if(p.paused||!s)return;const P=C.target;s.contains(P)?f.current=P:K(f.current,{select:!0})},b=function(C){if(p.paused||!s)return;const P=C.relatedTarget;P!==null&&(s.contains(P)||K(f.current,{select:!0}))},x=function(C){if(document.activeElement===document.body)for(const R of C)R.removedNodes.length>0&&K(s)};document.addEventListener("focusin",d),document.addEventListener("focusout",b);const w=new MutationObserver(x);return s&&w.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",d),document.removeEventListener("focusout",b),w.disconnect()}}},[r,s,p.paused]),a.useEffect(()=>{if(s){at.add(p);const d=document.activeElement;if(!s.contains(d)){const x=new CustomEvent(De,rt);s.addEventListener(De,u),s.dispatchEvent(x),x.defaultPrevented||(Jn(rr(St(s)),{select:!0}),document.activeElement===d&&K(s))}return()=>{s.removeEventListener(De,u),setTimeout(()=>{const x=new CustomEvent(Oe,rt);s.addEventListener(Oe,l),s.dispatchEvent(x),x.defaultPrevented||K(d??document.body,{select:!0}),s.removeEventListener(Oe,l),at.remove(p)},0)}}},[s,u,l,p]);const y=a.useCallback(d=>{if(!n&&!r||p.paused)return;const b=d.key==="Tab"&&!d.altKey&&!d.ctrlKey&&!d.metaKey,x=document.activeElement;if(b&&x){const w=d.currentTarget,[C,P]=Qn(w);C&&P?!d.shiftKey&&x===P?(d.preventDefault(),n&&K(C,{select:!0})):d.shiftKey&&x===C&&(d.preventDefault(),n&&K(P,{select:!0})):x===w&&d.preventDefault()}},[n,r,p.paused]);return g.jsx(M.div,{tabIndex:-1,...c,ref:h,onKeyDown:y})});wt.displayName=Zn;function Jn(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(K(r,{select:t}),document.activeElement!==n)return}function Qn(e){const t=St(e),n=ot(t,e),r=ot(t.reverse(),e);return[n,r]}function St(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ot(e,t){for(const n of e)if(!er(n,{upTo:t}))return n}function er(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function tr(e){return e instanceof HTMLInputElement&&"select"in e}function K(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&tr(e)&&t&&e.select()}}var at=nr();function nr(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=it(e,t),e.unshift(t)},remove(t){var n;e=it(e,t),(n=e[0])==null||n.resume()}}}function it(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function rr(e){return e.filter(t=>t.tagName!=="A")}var or="Portal",xt=a.forwardRef((e,t)=>{var s;const{container:n,...r}=e,[o,i]=a.useState(!1);se(()=>i(!0),[]);const c=n||o&&((s=globalThis==null?void 0:globalThis.document)==null?void 0:s.body);return c?ht.createPortal(g.jsx(M.div,{...r,ref:t}),c):null});xt.displayName=or;function ar(e,t){return a.useReducer((n,r)=>t[n][r]??n,e)}var we=e=>{const{present:t,children:n}=e,r=ir(t),o=typeof n=="function"?n({present:r.isPresent}):a.Children.only(n),i=sr(r.ref,cr(o));return typeof n=="function"||r.isPresent?a.cloneElement(o,{ref:i}):null};we.displayName="Presence";function ir(e){const[t,n]=a.useState(),r=a.useRef(null),o=a.useRef(e),i=a.useRef("none"),c=e?"mounted":"unmounted",[s,m]=ar(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const u=fe(r.current);i.current=s==="mounted"?u:"none"},[s]),se(()=>{const u=r.current,l=o.current;if(l!==e){const h=i.current,p=fe(u);e?m("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?m("UNMOUNT"):m(l&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,m]),se(()=>{if(t){let u;const l=t.ownerDocument.defaultView??window,f=p=>{const d=fe(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&d&&(m("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",u=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(i.current=fe(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{l.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:a.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function st(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function sr(...e){const t=a.useRef(e);return t.current=e,a.useCallback(n=>{const r=t.current;let o=!1;const i=r.map(c=>{const s=st(c,n);return!o&&typeof s=="function"&&(o=!0),s});if(o)return()=>{for(let c=0;c{U||(U={start:ct(),end:ct()});const{start:e,end:t}=U;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),ve++,()=>{ve===1&&(U==null||U.start.remove(),U==null||U.end.remove(),U=null),ve=Math.max(0,ve-1)}},[])}function ct(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var $=function(){return $=Object.assign||function(t){for(var n,r=1,o=arguments.length;r"u")return Nr;var t=kr(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Dr=kt(),ne="data-scroll-locked",Or=function(e,t,n,r){var o=e.left,i=e.top,c=e.right,s=e.gap;return n===void 0&&(n="margin"),` .`.concat(dr,` { overflow: hidden `).concat(r,`; padding-right: `).concat(s,"px ").concat(r,`; } body[`).concat(ne,`] { overflow: hidden `).concat(r,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` padding-left: `.concat(o,`px; padding-top: `).concat(i,`px; padding-right: `).concat(c,`px; margin-left:0; margin-top:0; margin-right: `).concat(s,"px ").concat(r,`; `),n==="padding"&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),` } .`).concat(be,` { right: `).concat(s,"px ").concat(r,`; } .`).concat(ye,` { margin-right: `).concat(s,"px ").concat(r,`; } .`).concat(be," .").concat(be,` { right: 0 `).concat(r,`; } .`).concat(ye," .").concat(ye,` { margin-right: 0 `).concat(r,`; } body[`).concat(ne,`] { `).concat(fr,": ").concat(s,`px; } `)},lt=function(){var e=parseInt(document.body.getAttribute(ne)||"0",10);return isFinite(e)?e:0},Ir=function(){a.useEffect(function(){return document.body.setAttribute(ne,(lt()+1).toString()),function(){var e=lt()-1;e<=0?document.body.removeAttribute(ne):document.body.setAttribute(ne,e.toString())}},[])},Ar=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Ir();var i=a.useMemo(function(){return Pr(o)},[o]);return a.createElement(Dr,{styles:Or(i,!t,o,n?"":"!important")})},_e=!1;if(typeof window<"u")try{var me=Object.defineProperty({},"passive",{get:function(){return _e=!0,!0}});window.addEventListener("test",me,me),window.removeEventListener("test",me,me)}catch{_e=!1}var q=_e?{passive:!1}:!1,Mr=function(e){return e.tagName==="TEXTAREA"},Pt=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Mr(e)&&n[t]==="visible")},Tr=function(e){return Pt(e,"overflowY")},Lr=function(e){return Pt(e,"overflowX")},dt=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Dt(e,r);if(o){var i=Ot(e,r),c=i[1],s=i[2];if(c>s)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Fr=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},jr=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Dt=function(e,t){return e==="v"?Tr(t):Lr(t)},Ot=function(e,t){return e==="v"?Fr(t):jr(t)},_r=function(e,t){return e==="h"&&t==="rtl"?-1:1},Wr=function(e,t,n,r,o){var i=_r(e,window.getComputedStyle(t).direction),c=i*r,s=n.target,m=t.contains(s),u=!1,l=c>0,f=0,h=0;do{if(!s)break;var p=Ot(e,s),y=p[0],d=p[1],b=p[2],x=d-b-i*y;(y||x)&&Dt(e,s)&&(f+=x,h+=y);var w=s.parentNode;s=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!m&&s!==document.body||m&&(t.contains(s)||t===s));return(l&&Math.abs(f)<1||!l&&Math.abs(h)<1)&&(u=!0),u},pe=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ft=function(e){return[e.deltaX,e.deltaY]},vt=function(e){return e&&"current"in e?e.current:e},Ur=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$r=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},Br=0,Z=[];function Vr(e){var t=a.useRef([]),n=a.useRef([0,0]),r=a.useRef(),o=a.useState(Br++)[0],i=a.useState(kt)[0],c=a.useRef(e);a.useEffect(function(){c.current=e},[e]),a.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var d=lr([e.lockRef.current],(e.shards||[]).map(vt),!0).filter(Boolean);return d.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),d.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=a.useCallback(function(d,b){if("touches"in d&&d.touches.length===2||d.type==="wheel"&&d.ctrlKey)return!c.current.allowPinchZoom;var x=pe(d),w=n.current,C="deltaX"in d?d.deltaX:w[0]-x[0],P="deltaY"in d?d.deltaY:w[1]-x[1],R,N=d.target,O=Math.abs(C)>Math.abs(P)?"h":"v";if("touches"in d&&O==="h"&&N.type==="range")return!1;var B=window.getSelection(),I=B&&B.anchorNode,F=I?I===N||I.contains(N):!1;if(F)return!1;var j=dt(O,N);if(!j)return!0;if(j?R=O:(R=O==="v"?"h":"v",j=dt(O,N)),!j)return!1;if(!r.current&&"changedTouches"in d&&(C||P)&&(r.current=R),!R)return!0;var W=r.current||R;return Wr(W,b,d,W==="h"?C:P)},[]),m=a.useCallback(function(d){var b=d;if(!(!Z.length||Z[Z.length-1]!==i)){var x="deltaY"in b?ft(b):pe(b),w=t.current.filter(function(R){return R.name===b.type&&(R.target===b.target||b.target===R.shadowParent)&&Ur(R.delta,x)})[0];if(w&&w.should){b.cancelable&&b.preventDefault();return}if(!w){var C=(c.current.shards||[]).map(vt).filter(Boolean).filter(function(R){return R.contains(b.target)}),P=C.length>0?s(b,C[0]):!c.current.noIsolation;P&&b.cancelable&&b.preventDefault()}}},[]),u=a.useCallback(function(d,b,x,w){var C={name:d,delta:b,target:x,should:w,shadowParent:Kr(x)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(P){return P!==C})},1)},[]),l=a.useCallback(function(d){n.current=pe(d),r.current=void 0},[]),f=a.useCallback(function(d){u(d.type,ft(d),d.target,s(d,e.lockRef.current))},[]),h=a.useCallback(function(d){u(d.type,pe(d),d.target,s(d,e.lockRef.current))},[]);a.useEffect(function(){return Z.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",m,q),document.addEventListener("touchmove",m,q),document.addEventListener("touchstart",l,q),function(){Z=Z.filter(function(d){return d!==i}),document.removeEventListener("wheel",m,q),document.removeEventListener("touchmove",m,q),document.removeEventListener("touchstart",l,q)}},[]);var p=e.removeScrollBar,y=e.inert;return a.createElement(a.Fragment,null,y?a.createElement(i,{styles:$r(o)}):null,p?a.createElement(Ar,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Kr(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const zr=yr(Nt,Vr);var It=a.forwardRef(function(e,t){return a.createElement(Se,$({},e,{ref:t,sideCar:zr}))});It.classNames=Se.classNames;var Hr=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},J=new WeakMap,he=new WeakMap,ge={},Te=0,At=function(e){return e&&(e.host||At(e.parentNode))},Yr=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=At(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Gr=function(e,t,n,r){var o=Yr(t,Array.isArray(e)?e:[e]);ge[n]||(ge[n]=new WeakMap);var i=ge[n],c=[],s=new Set,m=new Set(o),u=function(f){!f||s.has(f)||(s.add(f),u(f.parentNode))};o.forEach(u);var l=function(f){!f||m.has(f)||Array.prototype.forEach.call(f.children,function(h){if(s.has(h))l(h);else try{var p=h.getAttribute(r),y=p!==null&&p!=="false",d=(J.get(h)||0)+1,b=(i.get(h)||0)+1;J.set(h,d),i.set(h,b),c.push(h),d===1&&y&&he.set(h,!0),b===1&&h.setAttribute(n,"true"),y||h.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",h,x)}})};return l(t),s.clear(),Te++,function(){c.forEach(function(f){var h=J.get(f)-1,p=i.get(f)-1;J.set(f,h),i.set(f,p),h||(he.has(f)||f.removeAttribute(r),he.delete(f)),p||f.removeAttribute(n)}),Te--,Te||(J=new WeakMap,J=new WeakMap,he=new WeakMap,ge={})}},Xr=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Hr(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Gr(r,o,n,"aria-hidden")):function(){return null}},xe="Dialog",[Mt]=xn(xe),[qr,_]=Mt(xe),Tt=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:c=!0}=e,s=a.useRef(null),m=a.useRef(null),[u,l]=Pn({prop:r,defaultProp:o??!1,onChange:i,caller:xe});return g.jsx(qr,{scope:t,triggerRef:s,contentRef:m,contentId:V(),titleId:V(),descriptionId:V(),open:u,onOpenChange:l,onOpenToggle:a.useCallback(()=>l(f=>!f),[l]),modal:c,children:n})};Tt.displayName=xe;var Lt="DialogTrigger",Zr=a.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=_(Lt,n),i=G(t,o.triggerRef);return g.jsx(M.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":Ve(o.open),...r,ref:i,onClick:z(e.onClick,o.onOpenToggle)})});Zr.displayName=Lt;var Be="DialogPortal",[Jr,Ft]=Mt(Be,{forceMount:void 0}),jt=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=_(Be,t);return g.jsx(Jr,{scope:t,forceMount:n,children:a.Children.map(r,c=>g.jsx(we,{present:n||i.open,children:g.jsx(xt,{asChild:!0,container:o,children:c})}))})};jt.displayName=Be;var Ee="DialogOverlay",_t=a.forwardRef((e,t)=>{const n=Ft(Ee,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=_(Ee,e.__scopeDialog);return i.modal?g.jsx(we,{present:r||i.open,children:g.jsx(eo,{...o,ref:t})}):null});_t.displayName=Ee;var Qr=bt("DialogOverlay.RemoveScroll"),eo=a.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=_(Ee,n),i=Gn(),c=G(t,i);return g.jsx(It,{as:Qr,allowPinchZoom:!0,shards:[o.contentRef],children:g.jsx(M.div,{"data-state":Ve(o.open),...r,ref:c,style:{pointerEvents:"auto",...r.style}})})}),oe="DialogContent",Wt=a.forwardRef((e,t)=>{const n=Ft(oe,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=_(oe,e.__scopeDialog);return g.jsx(we,{present:r||i.open,children:i.modal?g.jsx(to,{...o,ref:t}):g.jsx(no,{...o,ref:t})})});Wt.displayName=oe;var to=a.forwardRef((e,t)=>{const n=_(oe,e.__scopeDialog),r=a.useRef(null),o=G(t,n.contentRef,r);return a.useEffect(()=>{const i=r.current;if(i)return Xr(i)},[]),g.jsx(Ut,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:z(e.onCloseAutoFocus,i=>{var c;i.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:z(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,s=c.button===0&&c.ctrlKey===!0;(c.button===2||s)&&i.preventDefault()}),onFocusOutside:z(e.onFocusOutside,i=>i.preventDefault())})}),no=a.forwardRef((e,t)=>{const n=_(oe,e.__scopeDialog),r=a.useRef(!1),o=a.useRef(!1);return g.jsx(Ut,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var c,s;(c=e.onCloseAutoFocus)==null||c.call(e,i),i.defaultPrevented||(r.current||(s=n.triggerRef.current)==null||s.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var m,u;(m=e.onInteractOutside)==null||m.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(c))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),Ut=a.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...c}=e,s=_(oe,n);return ur(),g.jsx(g.Fragment,{children:g.jsx(wt,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:g.jsx(yt,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Ve(s.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),$t="DialogTitle",ro=a.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=_($t,n);return g.jsx(M.h2,{id:o.titleId,...r,ref:t})});ro.displayName=$t;var Bt="DialogDescription",oo=a.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=_(Bt,n);return g.jsx(M.p,{id:o.descriptionId,...r,ref:t})});oo.displayName=Bt;var Vt="DialogClose",ao=a.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=_(Vt,n);return g.jsx(M.button,{type:"button",...r,ref:t,onClick:z(e.onClick,()=>o.onOpenChange(!1))})});ao.displayName=Vt;function Ve(e){return e?"open":"closed"}var ie='[cmdk-group=""]',Le='[cmdk-group-items=""]',io='[cmdk-group-heading=""]',Kt='[cmdk-item=""]',mt=`${Kt}:not([aria-disabled="true"])`,We="cmdk-item-select",ee="data-value",so=(e,t,n)=>Sn(e,t,n),zt=a.createContext(void 0),ue=()=>a.useContext(zt),Ht=a.createContext(void 0),Ke=()=>a.useContext(Ht),Yt=a.createContext(void 0),Gt=a.forwardRef((e,t)=>{let n=te(()=>{var v,S;return{search:"",value:(S=(v=e.value)!=null?v:e.defaultValue)!=null?S:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=te(()=>new Set),o=te(()=>new Map),i=te(()=>new Map),c=te(()=>new Set),s=Xt(e),{label:m,children:u,value:l,onValueChange:f,filter:h,shouldFilter:p,loop:y,disablePointerSelection:d=!1,vimBindings:b=!0,...x}=e,w=V(),C=V(),P=V(),R=a.useRef(null),N=yo();Y(()=>{if(l!==void 0){let v=l.trim();n.current.value=v,O.emit()}},[l]),Y(()=>{N(6,ze)},[]);let O=a.useMemo(()=>({subscribe:v=>(c.current.add(v),()=>c.current.delete(v)),snapshot:()=>n.current,setState:(v,S,k)=>{var E,D,A,L;if(!Object.is(n.current[v],S)){if(n.current[v]=S,v==="search")W(),F(),N(1,j);else if(v==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let T=document.getElementById(P);T?T.focus():(E=document.getElementById(w))==null||E.focus()}if(N(7,()=>{var T;n.current.selectedItemId=(T=X())==null?void 0:T.id,O.emit()}),k||N(5,ze),((D=s.current)==null?void 0:D.value)!==void 0){let T=S??"";(L=(A=s.current).onValueChange)==null||L.call(A,T);return}}O.emit()}},emit:()=>{c.current.forEach(v=>v())}}),[]),B=a.useMemo(()=>({value:(v,S,k)=>{var E;S!==((E=i.current.get(v))==null?void 0:E.value)&&(i.current.set(v,{value:S,keywords:k}),n.current.filtered.items.set(v,I(S,k)),N(2,()=>{F(),O.emit()}))},item:(v,S)=>(r.current.add(v),S&&(o.current.has(S)?o.current.get(S).add(v):o.current.set(S,new Set([v]))),N(3,()=>{W(),F(),n.current.value||j(),O.emit()}),()=>{i.current.delete(v),r.current.delete(v),n.current.filtered.items.delete(v);let k=X();N(4,()=>{W(),(k==null?void 0:k.getAttribute("id"))===v&&j(),O.emit()})}),group:v=>(o.current.has(v)||o.current.set(v,new Set),()=>{i.current.delete(v),o.current.delete(v)}),filter:()=>s.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:w,inputId:P,labelId:C,listInnerRef:R}),[]);function I(v,S){var k,E;let D=(E=(k=s.current)==null?void 0:k.filter)!=null?E:so;return v?D(v,n.current.search,S):0}function F(){if(!n.current.search||s.current.shouldFilter===!1)return;let v=n.current.filtered.items,S=[];n.current.filtered.groups.forEach(E=>{let D=o.current.get(E),A=0;D.forEach(L=>{let T=v.get(L);A=Math.max(T,A)}),S.push([E,A])});let k=R.current;ae().sort((E,D)=>{var A,L;let T=E.getAttribute("id"),le=D.getAttribute("id");return((A=v.get(le))!=null?A:0)-((L=v.get(T))!=null?L:0)}).forEach(E=>{let D=E.closest(Le);D?D.appendChild(E.parentElement===D?E:E.closest(`${Le} > *`)):k.appendChild(E.parentElement===k?E:E.closest(`${Le} > *`))}),S.sort((E,D)=>D[1]-E[1]).forEach(E=>{var D;let A=(D=R.current)==null?void 0:D.querySelector(`${ie}[${ee}="${encodeURIComponent(E[0])}"]`);A==null||A.parentElement.appendChild(A)})}function j(){let v=ae().find(k=>k.getAttribute("aria-disabled")!=="true"),S=v==null?void 0:v.getAttribute(ee);O.setState("value",S||void 0)}function W(){var v,S,k,E;if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let D=0;for(let A of r.current){let L=(S=(v=i.current.get(A))==null?void 0:v.value)!=null?S:"",T=(E=(k=i.current.get(A))==null?void 0:k.keywords)!=null?E:[],le=I(L,T);n.current.filtered.items.set(A,le),le>0&&D++}for(let[A,L]of o.current)for(let T of L)if(n.current.filtered.items.get(T)>0){n.current.filtered.groups.add(A);break}n.current.filtered.count=D}function ze(){var v,S,k;let E=X();E&&(((v=E.parentElement)==null?void 0:v.firstChild)===E&&((k=(S=E.closest(ie))==null?void 0:S.querySelector(io))==null||k.scrollIntoView({block:"nearest"})),E.scrollIntoView({block:"nearest"}))}function X(){var v;return(v=R.current)==null?void 0:v.querySelector(`${Kt}[aria-selected="true"]`)}function ae(){var v;return Array.from(((v=R.current)==null?void 0:v.querySelectorAll(mt))||[])}function Re(v){let S=ae()[v];S&&O.setState("value",S.getAttribute(ee))}function Ne(v){var S;let k=X(),E=ae(),D=E.findIndex(L=>L===k),A=E[D+v];(S=s.current)!=null&&S.loop&&(A=D+v<0?E[E.length-1]:D+v===E.length?E[0]:E[D+v]),A&&O.setState("value",A.getAttribute(ee))}function He(v){let S=X(),k=S==null?void 0:S.closest(ie),E;for(;k&&!E;)k=v>0?go(k,ie):bo(k,ie),E=k==null?void 0:k.querySelector(mt);E?O.setState("value",E.getAttribute(ee)):Ne(v)}let Ye=()=>Re(ae().length-1),Ge=v=>{v.preventDefault(),v.metaKey?Ye():v.altKey?He(1):Ne(1)},Xe=v=>{v.preventDefault(),v.metaKey?Re(0):v.altKey?He(-1):Ne(-1)};return a.createElement(M.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:v=>{var S;(S=x.onKeyDown)==null||S.call(x,v);let k=v.nativeEvent.isComposing||v.keyCode===229;if(!(v.defaultPrevented||k))switch(v.key){case"n":case"j":{b&&v.ctrlKey&&Ge(v);break}case"ArrowDown":{Ge(v);break}case"p":case"k":{b&&v.ctrlKey&&Xe(v);break}case"ArrowUp":{Xe(v);break}case"Home":{v.preventDefault(),Re(0);break}case"End":{v.preventDefault(),Ye();break}case"Enter":{v.preventDefault();let E=X();if(E){let D=new Event(We);E.dispatchEvent(D)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:B.inputId,id:B.labelId,style:wo},m),Ce(e,v=>a.createElement(Ht.Provider,{value:O},a.createElement(zt.Provider,{value:B},v))))}),co=a.forwardRef((e,t)=>{var n,r;let o=V(),i=a.useRef(null),c=a.useContext(Yt),s=ue(),m=Xt(e),u=(r=(n=m.current)==null?void 0:n.forceMount)!=null?r:c==null?void 0:c.forceMount;Y(()=>{if(!u)return s.item(o,c==null?void 0:c.id)},[u]);let l=qt(o,i,[e.value,e.children,i],e.keywords),f=Ke(),h=H(N=>N.value&&N.value===l.current),p=H(N=>u||s.filter()===!1?!0:N.search?N.filtered.items.get(o)>0:!0);a.useEffect(()=>{let N=i.current;if(!(!N||e.disabled))return N.addEventListener(We,y),()=>N.removeEventListener(We,y)},[p,e.onSelect,e.disabled]);function y(){var N,O;d(),(O=(N=m.current).onSelect)==null||O.call(N,l.current)}function d(){f.setState("value",l.current,!0)}if(!p)return null;let{disabled:b,value:x,onSelect:w,forceMount:C,keywords:P,...R}=e;return a.createElement(M.div,{ref:re(i,t),...R,id:o,"cmdk-item":"",role:"option","aria-disabled":!!b,"aria-selected":!!h,"data-disabled":!!b,"data-selected":!!h,onPointerMove:b||s.getDisablePointerSelection()?void 0:d,onClick:b?void 0:y},e.children)}),uo=a.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...i}=e,c=V(),s=a.useRef(null),m=a.useRef(null),u=V(),l=ue(),f=H(p=>o||l.filter()===!1?!0:p.search?p.filtered.groups.has(c):!0);Y(()=>l.group(c),[]),qt(c,s,[e.value,e.heading,m]);let h=a.useMemo(()=>({id:c,forceMount:o}),[o]);return a.createElement(M.div,{ref:re(s,t),...i,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&a.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),Ce(e,p=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},a.createElement(Yt.Provider,{value:h},p))))}),lo=a.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=a.useRef(null),i=H(c=>!c.search);return!n&&!i?null:a.createElement(M.div,{ref:re(o,t),...r,"cmdk-separator":"",role:"separator"})}),fo=a.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,i=Ke(),c=H(u=>u.search),s=H(u=>u.selectedItemId),m=ue();return a.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),a.createElement(M.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":s,id:m.inputId,type:"text",value:o?e.value:c,onChange:u=>{o||i.setState("search",u.target.value),n==null||n(u.target.value)}})}),vo=a.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,i=a.useRef(null),c=a.useRef(null),s=H(u=>u.selectedItemId),m=ue();return a.useEffect(()=>{if(c.current&&i.current){let u=c.current,l=i.current,f,h=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let p=u.offsetHeight;l.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return h.observe(u),()=>{cancelAnimationFrame(f),h.unobserve(u)}}},[]),a.createElement(M.div,{ref:re(i,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:m.listId},Ce(e,u=>a.createElement("div",{ref:re(c,m.listInnerRef),"cmdk-list-sizer":""},u)))}),mo=a.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:i,container:c,...s}=e;return a.createElement(Tt,{open:n,onOpenChange:r},a.createElement(jt,{container:c},a.createElement(_t,{"cmdk-overlay":"",className:o}),a.createElement(Wt,{"aria-label":e.label,"cmdk-dialog":"",className:i},a.createElement(Gt,{ref:t,...s}))))}),po=a.forwardRef((e,t)=>H(n=>n.filtered.count===0)?a.createElement(M.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),ho=a.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...i}=e;return a.createElement(M.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},Ce(e,c=>a.createElement("div",{"aria-hidden":!0},c)))}),Q=Object.assign(Gt,{List:vo,Item:co,Input:fo,Group:uo,Separator:lo,Dialog:mo,Empty:po,Loading:ho});function go(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function bo(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Xt(e){let t=a.useRef(e);return Y(()=>{t.current=e}),t}var Y=typeof window>"u"?a.useEffect:a.useLayoutEffect;function te(e){let t=a.useRef();return t.current===void 0&&(t.current=e()),t}function H(e){let t=Ke(),n=()=>e(t.snapshot());return a.useSyncExternalStore(t.subscribe,n,n)}function qt(e,t,n,r=[]){let o=a.useRef(),i=ue();return Y(()=>{var c;let s=(()=>{var u;for(let l of n){if(typeof l=="string")return l.trim();if(typeof l=="object"&&"current"in l)return l.current?(u=l.current.textContent)==null?void 0:u.trim():o.current}})(),m=r.map(u=>u.trim());i.value(e,s,m),(c=t.current)==null||c.setAttribute(ee,s),o.current=s}),o}var yo=()=>{let[e,t]=a.useState(),n=te(()=>new Map);return Y(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function Eo(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Ce({asChild:e,children:t},n){return e&&a.isValidElement(t)?a.cloneElement(Eo(t),{ref:t.ref},n(t.props.children)):n(t)}var wo={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Zt={gehe:"Gehe zu",tun:"Tun",finden:"Finden",lucy:"An Lucy"},So=Qt.map(e=>({id:`gehe:${e.id}`,gruppe:"gehe",label:e.label,hinweis:e.hint,icon:e.icon,ausfuehren:({navigate:t})=>t(e.pfad)})),xo=[{id:"tun:wartung",gruppe:"tun",label:"System-Wartung öffnen",hinweis:"Dienste, Updates, Snapshot",icon:Jt,stichworte:"pflege dienste neustart update",ausfuehren:({schublade:e})=>e("wartung")},{id:"tun:logs",gruppe:"tun",label:"System-Logs öffnen",hinweis:"Diagnose je Dienst",icon:vn,stichworte:"fehler journal diagnose",ausfuehren:({schublade:e})=>e("logs")},{id:"tun:updates",gruppe:"tun",label:"Nach Updates suchen",hinweis:"apt + Engine + Agent prüfen",icon:sn,stichworte:"aktualisieren apt engine",ausfuehren:async({api:e,melden:t})=>{await e("/api/maintenance/check-updates",{method:"POST"}),t("info","Update-Suche läuft — das Ergebnis erscheint in der Wartung.")}},{id:"tun:snapshot",gruppe:"tun",label:"Snapshot anlegen",hinweis:"Sicherung vor riskanten Schritten",icon:cn,stichworte:"backup sicherung zeitmaschine",ausfuehren:async({api:e,melden:t})=>{await e("/api/system/backup",{method:"POST"}),t("erfolg","Snapshot angestoßen.")}},{id:"tun:engine-neustart",gruppe:"tun",label:"Motor neu starten",hinweis:"llama-swap — alle Modelle fallen kurz weg",icon:un,stichworte:"engine llama swap modell neu starten",rueckfrage:"Der Motor (llama-swap) wird neu gestartet. Alle geladenen Modelle fallen dabei aus dem Speicher und müssen neu aufwärmen — das dauert je nach Modell über 20 Sekunden. Laufende Antworten brechen ab.",ausfuehren:async({api:e,melden:t})=>{const n=await e("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:"llama-swap"})});t(n.ok?"erfolg":"fehler",n.ok?"Motor neu gestartet.":`Neustart fehlgeschlagen: ${n.err||"Unbekannter Fehler"}`)}}],Co=e=>{const t=e.trim();return t?[{id:"finden:chronik",gruppe:"finden",label:`„${t}“ in der Chronik`,hinweis:"Was die Box getan hat",icon:ln,ausfuehren:({navigate:n})=>n(`/chronik?q=${encodeURIComponent(t)}`)},{id:"finden:wissen",gruppe:"finden",label:`„${t}“ im Wissens-Vault`,hinweis:"Lucys Notizen",icon:dn,ausfuehren:({navigate:n})=>n(`/wissen?suche=${encodeURIComponent(t)}`)}]:[]},Ro=e=>{const t=e.trim();return t.length<8?[]:[{id:"lucy:idee",gruppe:"lucy",label:`Als Idee erfassen: „${t.length>60?t.slice(0,57)+"…":t}“`,hinweis:"Wird nur notiert — gebaut wird erst auf deinen Klick",icon:en,ausfuehren:async({api:n,melden:r,navigate:o})=>{await n("/api/ideen",{method:"POST",body:JSON.stringify({titel:t.length>160?t.slice(0,157)+"…":t,notiz:t.length>160?t:"",welt:"ide",tiefe:"",ziel:"",art:"idee"})}),r("erfolg","Als Idee erfasst."),o("/ideen")}}]};function No(e){return[...So,...xo,...Co(e),...Ro(e)]}const ko=e=>[e.label,e.hinweis,e.stichworte,Zt[e.gruppe]].filter(Boolean).join(" "),Po=["gehe","tun","finden","lucy"];function Lo(){const e=tn(),t=qe(p=>p.palette),n=qe(p=>p.melden),r=nn(),[o,i]=a.useState(""),[c,s]=a.useState(null),[m,u]=a.useState(!1),l=a.useCallback(()=>{t(!1),i(""),s(null)},[t]),f=a.useCallback(async p=>{u(!0);try{await p.ausfuehren({text:o,navigate:y=>r({to:y}),schublade:y=>r({to:".",search:d=>({...d,system:y})}),melden:n,api:rn}),l()}catch(y){n("fehler",y instanceof Error?y.message:String(y)),s(null)}finally{u(!1)}},[o,r,n,l]),h=a.useMemo(()=>No(o),[o]);return g.jsx(Q.Dialog,{open:e,onOpenChange:p=>p?t(!0):l(),label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center overscroll-contain bg-black/50 p-4 pt-[12vh]",onClick:l,shouldFilter:!c,children:g.jsx("div",{className:"w-full max-w-xl overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:p=>p.stopPropagation(),children:c?g.jsxs("div",{className:"space-y-4 p-5",children:[g.jsxs("div",{className:"flex items-center gap-2.5",children:[g.jsx(on,{className:"h-5 w-5 shrink-0 text-amber-400","aria-hidden":"true"}),g.jsx("h2",{className:"font-space text-sm font-bold tracking-tight",children:c.label})]}),g.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:c.rueckfrage}),g.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[g.jsx("button",{onClick:()=>s(null),className:"h-9 cursor-pointer rounded-lg border border-border/60 bg-background/20 px-4 text-xs font-semibold text-muted-foreground transition-colors hover:bg-accent",children:"Abbrechen"}),g.jsx("button",{autoFocus:!0,disabled:m,onClick:()=>f(c),className:"h-9 cursor-pointer rounded-lg bg-amber-500/90 px-4 text-xs font-bold text-black transition-colors hover:bg-amber-500 disabled:opacity-50",children:m?"Läuft …":"Ja, ausführen"})]})]}):g.jsxs(g.Fragment,{children:[g.jsx(Q.Input,{autoFocus:!0,value:o,onValueChange:i,placeholder:"Springen, tun, finden — oder schreib eine Idee …",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),g.jsxs(Q.List,{className:"max-h-[26rem] overflow-y-auto p-2 scrollbar-thin",children:[g.jsx(Q.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),Po.map(p=>{const y=h.filter(d=>d.gruppe===p);return y.length?g.jsx(Q.Group,{heading:Zt[p],className:"px-1 py-1 text-[10px] font-bold uppercase tracking-widest text-muted-foreground/50",children:y.map(d=>g.jsxs(Q.Item,{value:ko(d),onSelect:()=>d.rueckfrage?s(d):f(d),className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[g.jsx(d.icon,{className:an("h-4 w-4 shrink-0",d.rueckfrage?"text-amber-400":"text-primary"),"aria-hidden":"true"}),g.jsx("span",{className:"truncate",children:d.label}),d.rueckfrage&&g.jsx("span",{className:"shrink-0 rounded bg-amber-500/15 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wide text-amber-300",children:"fragt nach"}),d.hinweis&&g.jsx("span",{className:"ml-auto truncate pl-3 text-xs text-muted-foreground",children:d.hinweis})]},d.id))},p):null})]}),g.jsxs("div",{className:"flex items-center gap-3 border-t border-border/50 px-4 py-2 font-mono text-[10px] text-muted-foreground",children:[g.jsx("span",{className:"flex items-center gap-1",children:"↑↓ wählen"}),g.jsxs("span",{className:"flex items-center gap-1",children:[g.jsx(fn,{className:"h-3 w-3","aria-hidden":"true"})," ausführen"]}),g.jsx("span",{className:"ml-auto",children:"esc schließt"})]})]})})})}export{Lo as CommandPalette};