kanna-code 0.34.0 → 0.34.1
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.
|
@@ -627,11 +627,11 @@ Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}
|
|
|
627
627
|
|
|
628
628
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
629
629
|
|
|
630
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},AG="DialogDescriptionWarning",NG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${CO(AG).contentName}}.`;return _.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},MG=dO,LG=pO,kO=mO,EO=gO,DG=bO,IG=yO,PG=SO;const uf="data-focus-fallback-ignore",RO="data-allow-focus-retain",rv="kanna:restore-chat-input-focus",Hw="data-chat-input",iv="data-chat-selection-zone";function Ol(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function TO(e){var n;const t=e;return t!=null&&t.matches?t.matches("input:not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='reset']), textarea, select")||t.isContentEditable||((n=t.getAttribute)==null?void 0:n.call(t,"role"))==="textbox"?!0:Ol(e,RO):!1}function OG(e){const t=e;return t!=null&&t.matches?TO(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Ol(e,RO):!1}function LA(e){return!!e.querySelector(`[${uf}][data-state='open']`)}function jG(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function zG(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${Hw}]`)).filter(o=>!o.disabled);if(n.length===0)return!1;const r=n.indexOf(e),i=r>=0?(r+1)%n.length:0,s=n[i];return s?(s.focus({preventScroll:!0}),!0):!1}function DA(e){const{activeElement:t,fallback:n,hasActiveOverlay:r}=e;if(!n||n.disabled||r||t===n)return"none";if(e.trigger==="escape")return e.defaultPrevented||Ol(t,Hw)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,u=s??i;return!o||!u||!o.contains(u)||Ol(u,uf)||Ol(t,uf)||l&&(Ol(i,iv)||Ol(u,iv))||TO(t)?"none":t&&t===u?"restore":OG(t)?"none":"restore"}const Jl=MG,BG=LG,AO=_.forwardRef(({className:e,...t},n)=>m.jsx(kO,{ref:n,className:xe("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));AO.displayName=kO.displayName;const FG={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},Ya=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(BG,{children:[m.jsx(AO,{}),m.jsxs(EO,{ref:i,[uf]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(rv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:xe("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","max-h-[85vh] flex flex-col",FG[n],e),...r,children:[t,m.jsxs(PG,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[m.jsx(nl,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ya.displayName=EO.displayName;function HG({className:e,...t}){return m.jsx("div",{className:xe("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function ec({className:e,...t}){return m.jsx(DG,{className:xe("text-lg font-medium leading-none tracking-tight",e),...t})}function d0({className:e,...t}){return m.jsx(IG,{className:xe("text-sm text-muted-foreground",e),...t})}function tc({className:e,...t}){return m.jsx("div",{className:xe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function nc({className:e,...t}){return m.jsx("div",{className:xe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function $G({className:e,...t}){return m.jsx("button",{className:xe("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground","disabled:pointer-events-none disabled:text-muted-foreground/50",e),...t})}const Yr=_.forwardRef(({className:e,type:t,...n},r)=>m.jsx("input",{ref:r,type:t,className:xe("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Yr.displayName="Input";const NO=_.createContext(null);function UG({children:e}){const[t,n]=_.useState(null),[r,i]=_.useState(""),s=_.useRef(null);_.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(i(t.options.initialValue??""),setTimeout(()=>{var b,y;(b=s.current)==null||b.focus(),(y=s.current)==null||y.select()},0))},[t]);const o=_.useCallback(()=>{n(null),i("")},[]),l=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),o())},[o,t]),u=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.kind==="prompt"?t.resolve(r.trim()||null):t.resolve(),o())},[o,t,r]),d=_.useCallback(b=>new Promise(y=>{n({kind:"confirm",options:b,resolve:y})}),[]),f=_.useCallback(b=>new Promise(y=>{n({kind:"prompt",options:b,resolve:y})}),[]),h=_.useCallback(b=>new Promise(y=>{n({kind:"alert",options:b,resolve:y})}),[]),g=_.useMemo(()=>({confirm:d,prompt:f,alert:h}),[h,d,f]);return m.jsxs(NO.Provider,{value:g,children:[e,m.jsx(Jl,{open:t!==null,onOpenChange:b=>{b||!t||l()},children:m.jsx(Ya,{size:"sm",onKeyDown:b=>{b.key!=="Enter"||b.shiftKey||!t||t.kind!=="confirm"||(b.preventDefault(),u())},children:t?m.jsxs(m.Fragment,{children:[m.jsxs(tc,{className:"space-y-4",children:[m.jsx(ec,{children:t.options.title}),t.options.description?m.jsx(d0,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Yr,{ref:s,type:"text",value:r,onChange:b=>i(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),u())},placeholder:t.options.placeholder}):null]}),m.jsxs(nc,{children:[m.jsx(st,{variant:"ghost",size:"sm",onClick:l,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),m.jsx(st,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:u,disabled:t.kind==="prompt"&&!r.trim(),children:t.kind==="alert"?t.options.closeLabel??"OK":"confirmLabel"in t.options?t.options.confirmLabel??"Confirm":"Confirm"})]})]}):null})})]})}function $w(){const e=_.useContext(NO);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const Uw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("bg-card text-card-foreground",e),...t}));Uw.displayName="Card";const Vw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex flex-col space-y-1.5 p-2",e),...t}));Vw.displayName="CardHeader";const MO=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...t}));MO.displayName="CardTitle";const LO=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));LO.displayName="CardDescription";const Ww=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("p-6 pt-0",e),...t}));Ww.displayName="CardContent";const VG=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex items-center p-6 pt-0",e),...t}));VG.displayName="CardFooter";const WG=["top","right","bottom","left"],Xa=Math.min,Mi=Math.max,sv=Math.round,Im=Math.floor,no=e=>({x:e,y:e}),GG={left:"right",right:"left",bottom:"top",top:"bottom"};function vS(e,t,n){return Mi(e,Xa(t,n))}function Ho(e,t){return typeof e=="function"?e(t):e}function $o(e){return e.split("-")[0]}function hd(e){return e.split("-")[1]}function Gw(e){return e==="x"?"y":"x"}function qw(e){return e==="y"?"height":"width"}function Qs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Kw(e){return Gw(Qs(e))}function qG(e,t,n){n===void 0&&(n=!1);const r=hd(e),i=Kw(e),s=qw(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=ov(o)),[o,ov(o)]}function KG(e){const t=ov(e);return[bS(e),t,bS(t)]}function bS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const IA=["left","right"],PA=["right","left"],YG=["top","bottom"],XG=["bottom","top"];function QG(e,t,n){switch(e){case"top":case"bottom":return n?t?PA:IA:t?IA:PA;case"left":case"right":return t?YG:XG;default:return[]}}function ZG(e,t,n,r){const i=hd(e);let s=QG($o(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(bS)))),s}function ov(e){const t=$o(e);return GG[t]+e.slice(t.length)}function JG(e){return{top:0,right:0,bottom:0,left:0,...e}}function DO(e){return typeof e!="number"?JG(e):{top:e,right:e,bottom:e,left:e}}function av(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function OA(e,t,n){let{reference:r,floating:i}=e;const s=Qs(t),o=Kw(t),l=qw(o),u=$o(t),d=s==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,g=r[l]/2-i[l]/2;let b;switch(u){case"top":b={x:f,y:r.y-i.height};break;case"bottom":b={x:f,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:h};break;case"left":b={x:r.x-i.width,y:h};break;default:b={x:r.x,y:r.y}}switch(hd(t)){case"start":b[o]-=g*(n&&d?-1:1);break;case"end":b[o]+=g*(n&&d?-1:1);break}return b}async function eq(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:u}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:g=!1,padding:b=0}=Ho(t,e),y=DO(b),w=l[g?h==="floating"?"reference":"floating":h],C=av(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:u})),R=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),T=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},A=av(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:E,strategy:u}):R);return{top:(C.top-A.top+y.top)/T.y,bottom:(A.bottom-C.bottom+y.bottom)/T.y,left:(C.left-A.left+y.left)/T.x,right:(A.right-C.right+y.right)/T.x}}const tq=50,nq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:eq},u=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:h}=OA(d,r,u),g=r,b=0;const y={};for(let x=0;x<s.length;x++){const w=s[x];if(!w)continue;const{name:C,fn:R}=w,{x:E,y:T,data:A,reset:N}=await R({x:f,y:h,initialPlacement:r,placement:g,strategy:i,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});f=E??f,h=T??h,y[C]={...y[C],...A},N&&b<tq&&(b++,typeof N=="object"&&(N.placement&&(g=N.placement),N.rects&&(d=N.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):N.rects),{x:f,y:h}=OA(d,g,u)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},rq=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:u}=t,{element:d,padding:f=0}=Ho(e,t)||{};if(d==null)return{};const h=DO(f),g={x:n,y:r},b=Kw(i),y=qw(b),x=await o.getDimensions(d),w=b==="y",C=w?"top":"left",R=w?"bottom":"right",E=w?"clientHeight":"clientWidth",T=s.reference[y]+s.reference[b]-g[b]-s.floating[y],A=g[b]-s.reference[b],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let L=N?N[E]:0;(!L||!await(o.isElement==null?void 0:o.isElement(N)))&&(L=l.floating[E]||s.floating[y]);const P=T/2-A/2,G=L/2-x[y]/2-1,O=Xa(h[C],G),B=Xa(h[R],G),H=O,j=L-x[y]-B,$=L/2-x[y]/2+P,V=vS(H,$,j),z=!u.arrow&&hd(i)!=null&&$!==V&&s.reference[y]/2-($<H?O:B)-x[y]/2<0,q=z?$<H?$-H:$-j:0;return{[b]:g[b]+q,data:{[b]:V,centerOffset:$-V-q,...z&&{alignmentOffset:q}},reset:z}}}),iq=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:u,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=Ho(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=$o(i),R=Qs(l),E=$o(l)===l,T=await(u.isRTL==null?void 0:u.isRTL(d.floating)),A=g||(E||!x?[ov(l)]:KG(l)),N=y!=="none";!g&&N&&A.push(...ZG(l,x,y,T));const L=[l,...A],P=await u.detectOverflow(t,w),G=[];let O=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(P[C]),h){const $=qG(i,o,T);G.push(P[$[0]],P[$[1]])}if(O=[...O,{placement:i,overflows:G}],!G.every($=>$<=0)){var B,H;const $=(((B=s.flip)==null?void 0:B.index)||0)+1,V=L[$];if(V&&(!(h==="alignment"?R!==Qs(V):!1)||O.every(F=>Qs(F.placement)===R?F.overflows[0]>0:!0)))return{data:{index:$,overflows:O},reset:{placement:V}};let z=(H=O.filter(q=>q.overflows[0]<=0).sort((q,F)=>q.overflows[1]-F.overflows[1])[0])==null?void 0:H.placement;if(!z)switch(b){case"bestFit":{var j;const q=(j=O.filter(F=>{if(N){const Y=Qs(F.placement);return Y===R||Y==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(Y=>Y>0).reduce((Y,I)=>Y+I,0)]).sort((F,Y)=>F[1]-Y[1])[0])==null?void 0:j[0];q&&(z=q);break}case"initialPlacement":z=l;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function jA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zA(e){return WG.some(t=>e[t]>=0)}const sq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Ho(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=jA(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:zA(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=jA(o,n.floating);return{data:{escapedOffsets:l,escaped:zA(l)}}}default:return{}}}}},IO=new Set(["left","top"]);async function oq(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=$o(n),l=hd(n),u=Qs(n)==="y",d=IO.has(o)?-1:1,f=s&&u?-1:1,h=Ho(t,e);let{mainAxis:g,crossAxis:b,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof y=="number"&&(b=l==="end"?y*-1:y),u?{x:b*f,y:g*d}:{x:g*d,y:b*f}}const aq=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=t,u=await oq(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:o}}}}},lq=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:u={fn:C=>{let{x:R,y:E}=C;return{x:R,y:E}}},...d}=Ho(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=Qs($o(i)),b=Gw(g);let y=f[b],x=f[g];if(o){const C=b==="y"?"top":"left",R=b==="y"?"bottom":"right",E=y+h[C],T=y-h[R];y=vS(E,y,T)}if(l){const C=g==="y"?"top":"left",R=g==="y"?"bottom":"right",E=x+h[C],T=x-h[R];x=vS(E,x,T)}const w=u.fn({...t,[b]:y,[g]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[b]:o,[g]:l}}}}}},cq=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:l=0,mainAxis:u=!0,crossAxis:d=!0}=Ho(e,t),f={x:n,y:r},h=Qs(i),g=Gw(h);let b=f[g],y=f[h];const x=Ho(l,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(u){const E=g==="y"?"height":"width",T=s.reference[g]-s.floating[E]+w.mainAxis,A=s.reference[g]+s.reference[E]-w.mainAxis;b<T?b=T:b>A&&(b=A)}if(d){var C,R;const E=g==="y"?"width":"height",T=IO.has($o(i)),A=s.reference[h]-s.floating[E]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),N=s.reference[h]+s.reference[E]+(T?0:((R=o.offset)==null?void 0:R[h])||0)-(T?w.crossAxis:0);y<A?y=A:y>N&&(y=N)}return{[g]:b,[h]:y}}}},uq=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:l}=t,{apply:u=()=>{},...d}=Ho(e,t),f=await o.detectOverflow(t,d),h=$o(i),g=hd(i),b=Qs(i)==="y",{width:y,height:x}=s.floating;let w,C;h==="top"||h==="bottom"?(w=h,C=g===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,w=g==="end"?"top":"bottom");const R=x-f.top-f.bottom,E=y-f.left-f.right,T=Xa(x-f[w],R),A=Xa(y-f[C],E),N=!t.middlewareData.shift;let L=T,P=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=R),N&&!g){const O=Mi(f.left,0),B=Mi(f.right,0),H=Mi(f.top,0),j=Mi(f.bottom,0);b?P=y-2*(O!==0||B!==0?O+B:Mi(f.left,f.right)):L=x-2*(H!==0||j!==0?H+j:Mi(f.top,f.bottom))}await u({...t,availableWidth:P,availableHeight:L});const G=await o.getDimensions(l.floating);return y!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function h0(){return typeof window<"u"}function fd(e){return PO(e)?(e.nodeName||"").toLowerCase():"#document"}function Di(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function oo(e){var t;return(t=(PO(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function PO(e){return h0()?e instanceof Node||e instanceof Di(e).Node:!1}function As(e){return h0()?e instanceof Element||e instanceof Di(e).Element:!1}function Ko(e){return h0()?e instanceof HTMLElement||e instanceof Di(e).HTMLElement:!1}function BA(e){return!h0()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Di(e).ShadowRoot}function Gf(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ns(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function dq(e){return/^(table|td|th)$/.test(fd(e))}function f0(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const hq=/transform|translate|scale|rotate|perspective|filter/,fq=/paint|layout|strict|content/,Tl=e=>!!e&&e!=="none";let My;function Yw(e){const t=As(e)?Ns(e):e;return Tl(t.transform)||Tl(t.translate)||Tl(t.scale)||Tl(t.rotate)||Tl(t.perspective)||!Xw()&&(Tl(t.backdropFilter)||Tl(t.filter))||hq.test(t.willChange||"")||fq.test(t.contain||"")}function pq(e){let t=Qa(e);for(;Ko(t)&&!qu(t);){if(Yw(t))return t;if(f0(t))return null;t=Qa(t)}return null}function Xw(){return My==null&&(My=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),My}function qu(e){return/^(html|body|#document)$/.test(fd(e))}function Ns(e){return Di(e).getComputedStyle(e)}function p0(e){return As(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qa(e){if(fd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||BA(e)&&e.host||oo(e);return BA(t)?t.host:t}function OO(e){const t=Qa(e);return qu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ko(t)&&Gf(t)?t:OO(t)}function df(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=OO(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Di(i);if(s){const l=_S(o);return t.concat(o,o.visualViewport||[],Gf(i)?i:[],l&&n?df(l):[])}else return t.concat(i,df(i,[],n))}function _S(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function jO(e){const t=Ns(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Ko(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=sv(n)!==s||sv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function Qw(e){return As(e)?e:e.contextElement}function Ou(e){const t=Qw(e);if(!Ko(t))return no(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=jO(t);let o=(s?sv(n.width):n.width)/r,l=(s?sv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const mq=no(0);function zO(e){const t=Di(e);return!Xw()||!t.visualViewport?mq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Di(e)?!1:t}function rc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=Qw(e);let o=no(1);t&&(r?As(r)&&(o=Ou(r)):o=Ou(e));const l=gq(s,n,r)?zO(s):no(0);let u=(i.left+l.x)/o.x,d=(i.top+l.y)/o.y,f=i.width/o.x,h=i.height/o.y;if(s){const g=Di(s),b=r&&As(r)?Di(r):r;let y=g,x=_S(y);for(;x&&r&&b!==y;){const w=Ou(x),C=x.getBoundingClientRect(),R=Ns(x),E=C.left+(x.clientLeft+parseFloat(R.paddingLeft))*w.x,T=C.top+(x.clientTop+parseFloat(R.paddingTop))*w.y;u*=w.x,d*=w.y,f*=w.x,h*=w.y,u+=E,d+=T,y=Di(x),x=_S(y)}}return av({width:f,height:h,x:u,y:d})}function m0(e,t){const n=p0(e).scrollLeft;return t?t.left+n:rc(oo(e)).left+n}function BO(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-m0(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function vq(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=oo(r),l=t?f0(t.floating):!1;if(r===o||l&&s)return n;let u={scrollLeft:0,scrollTop:0},d=no(1);const f=no(0),h=Ko(r);if((h||!h&&!s)&&((fd(r)!=="body"||Gf(o))&&(u=p0(r)),h)){const b=rc(r);d=Ou(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!h&&!s?BO(o,u):no(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+f.x+g.x,y:n.y*d.y-u.scrollTop*d.y+f.y+g.y}}function bq(e){return Array.from(e.getClientRects())}function _q(e){const t=oo(e),n=p0(e),r=e.ownerDocument.body,i=Mi(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Mi(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+m0(e);const l=-n.scrollTop;return Ns(r).direction==="rtl"&&(o+=Mi(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const FA=25;function yq(e,t){const n=Di(e),r=oo(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,u=0;if(i){s=i.width,o=i.height;const f=Xw();(!f||f&&t==="fixed")&&(l=i.offsetLeft,u=i.offsetTop)}const d=m0(r);if(d<=0){const f=r.ownerDocument,h=f.body,g=getComputedStyle(h),b=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-h.clientWidth-b);y<=FA&&(s-=y)}else d<=FA&&(s+=d);return{width:s,height:o,x:l,y:u}}function xq(e,t){const n=rc(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Ko(e)?Ou(e):no(1),o=e.clientWidth*s.x,l=e.clientHeight*s.y,u=i*s.x,d=r*s.y;return{width:o,height:l,x:u,y:d}}function HA(e,t,n){let r;if(t==="viewport")r=yq(e,n);else if(t==="document")r=_q(oo(e));else if(As(t))r=xq(t,n);else{const i=zO(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return av(r)}function FO(e,t){const n=Qa(e);return n===t||!As(n)||qu(n)?!1:Ns(n).position==="fixed"||FO(n,t)}function Sq(e,t){const n=t.get(e);if(n)return n;let r=df(e,[],!1).filter(l=>As(l)&&fd(l)!=="body"),i=null;const s=Ns(e).position==="fixed";let o=s?Qa(e):e;for(;As(o)&&!qu(o);){const l=Ns(o),u=Yw(o);!u&&l.position==="fixed"&&(i=null),(s?!u&&!i:!u&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Gf(o)&&!u&&FO(e,o))?r=r.filter(f=>f!==o):i=l,o=Qa(o)}return t.set(e,r),r}function wq(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?f0(t)?[]:Sq(t,this._c):[].concat(n),r],l=HA(t,o[0],i);let u=l.top,d=l.right,f=l.bottom,h=l.left;for(let g=1;g<o.length;g++){const b=HA(t,o[g],i);u=Mi(b.top,u),d=Xa(b.right,d),f=Xa(b.bottom,f),h=Mi(b.left,h)}return{width:d-h,height:f-u,x:h,y:u}}function Cq(e){const{width:t,height:n}=jO(e);return{width:t,height:n}}function kq(e,t,n){const r=Ko(t),i=oo(t),s=n==="fixed",o=rc(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=no(0);function d(){u.x=m0(i)}if(r||!r&&!s)if((fd(t)!=="body"||Gf(i))&&(l=p0(t)),r){const b=rc(t,!0,s,t);u.x=b.x+t.clientLeft,u.y=b.y+t.clientTop}else i&&d();s&&!r&&i&&d();const f=i&&!r&&!s?BO(i,l):no(0),h=o.left+l.scrollLeft-u.x-f.x,g=o.top+l.scrollTop-u.y-f.y;return{x:h,y:g,width:o.width,height:o.height}}function Ly(e){return Ns(e).position==="static"}function $A(e,t){if(!Ko(e)||Ns(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return oo(e)===n&&(n=n.ownerDocument.body),n}function HO(e,t){const n=Di(e);if(f0(e))return n;if(!Ko(e)){let i=Qa(e);for(;i&&!qu(i);){if(As(i)&&!Ly(i))return i;i=Qa(i)}return n}let r=$A(e,t);for(;r&&dq(r)&&Ly(r);)r=$A(r,t);return r&&qu(r)&&Ly(r)&&!Yw(r)?n:r||pq(e)||n}const Eq=async function(e){const t=this.getOffsetParent||HO,n=this.getDimensions,r=await n(e.floating);return{reference:kq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rq(e){return Ns(e).direction==="rtl"}const Tq={convertOffsetParentRelativeRectToViewportRelativeRect:vq,getDocumentElement:oo,getClippingRect:wq,getOffsetParent:HO,getElementRects:Eq,getClientRects:bq,getDimensions:Cq,getScale:Ou,isElement:As,isRTL:Rq};function $O(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Aq(e,t){let n=null,r;const i=oo(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),s();const d=e.getBoundingClientRect(),{left:f,top:h,width:g,height:b}=d;if(l||t(),!g||!b)return;const y=Im(h),x=Im(i.clientWidth-(f+g)),w=Im(i.clientHeight-(h+b)),C=Im(f),E={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:Mi(0,Xa(1,u))||1};let T=!0;function A(N){const L=N[0].intersectionRatio;if(L!==u){if(!T)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!$O(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(A,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(A,E)}n.observe(e)}return o(!0),s}function Nq(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,d=Qw(e),f=i||s?[...d?df(d):[],...t?df(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?Aq(d,n):null;let g=-1,b=null;o&&(b=new ResizeObserver(C=>{let[R]=C;R&&R.target===d&&b&&t&&(b.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=b)==null||E.observe(t)})),n()}),d&&!u&&b.observe(d),t&&b.observe(t));let y,x=u?rc(e):null;u&&w();function w(){const C=rc(e);x&&!$O(x,C)&&n(),x=C,y=requestAnimationFrame(w)}return n(),()=>{var C;f.forEach(R=>{i&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),h==null||h(),(C=b)==null||C.disconnect(),b=null,u&&cancelAnimationFrame(y)}}const Mq=aq,Lq=lq,Dq=iq,Iq=uq,Pq=sq,UA=rq,Oq=cq,jq=(e,t,n)=>{const r=new Map,i={platform:Tq,...n},s={...i.platform,_c:r};return nq(e,t,{...i,platform:s})};var zq=typeof document<"u",Bq=function(){},Ag=zq?_.useLayoutEffect:Bq;function lv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!lv(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!lv(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function UO(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function VA(e,t){const n=UO(e);return Math.round(t*n)/n}function Dy(e){const t=_.useRef(e);return Ag(()=>{t.current=e}),t}function Fq(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:u,open:d}=e,[f,h]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,b]=_.useState(r);lv(g,r)||b(r);const[y,x]=_.useState(null),[w,C]=_.useState(null),R=_.useCallback(F=>{F!==N.current&&(N.current=F,x(F))},[]),E=_.useCallback(F=>{F!==L.current&&(L.current=F,C(F))},[]),T=s||y,A=o||w,N=_.useRef(null),L=_.useRef(null),P=_.useRef(f),G=u!=null,O=Dy(u),B=Dy(i),H=Dy(d),j=_.useCallback(()=>{if(!N.current||!L.current)return;const F={placement:t,strategy:n,middleware:g};B.current&&(F.platform=B.current),jq(N.current,L.current,F).then(Y=>{const I={...Y,isPositioned:H.current!==!1};$.current&&!lv(P.current,I)&&(P.current=I,os.flushSync(()=>{h(I)}))})},[g,t,n,B,H]);Ag(()=>{d===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[d]);const $=_.useRef(!1);Ag(()=>($.current=!0,()=>{$.current=!1}),[]),Ag(()=>{if(T&&(N.current=T),A&&(L.current=A),T&&A){if(O.current)return O.current(T,A,j);j()}},[T,A,j,O,G]);const V=_.useMemo(()=>({reference:N,floating:L,setReference:R,setFloating:E}),[R,E]),z=_.useMemo(()=>({reference:T,floating:A}),[T,A]),q=_.useMemo(()=>{const F={position:n,left:0,top:0};if(!z.floating)return F;const Y=VA(z.floating,f.x),I=VA(z.floating,f.y);return l?{...F,transform:"translate("+Y+"px, "+I+"px)",...UO(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:I}},[n,l,z.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:j,refs:V,elements:z,floatingStyles:q}),[f,j,V,z,q])}const Hq=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?UA({element:r.current,padding:i}).fn(n):{}:r?UA({element:r,padding:i}).fn(n):{}}}},$q=(e,t)=>{const n=Mq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Uq=(e,t)=>{const n=Lq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vq=(e,t)=>({fn:Oq(e).fn,options:[e,t]}),Wq=(e,t)=>{const n=Dq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gq=(e,t)=>{const n=Iq(e);return{name:n.name,fn:n.fn,options:[e,t]}},qq=(e,t)=>{const n=Pq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kq=(e,t)=>{const n=Hq(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Yq="Arrow",VO=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Kt.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});VO.displayName=Yq;var Xq=VO;function Qq(e){const[t,n]=_.useState(void 0);return zr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,l;if("borderBoxSize"in s){const u=s.borderBoxSize,d=Array.isArray(u)?u[0]:u;o=d.inlineSize,l=d.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Zw="Popper",[WO,il]=qo(Zw),[Zq,GO]=WO(Zw),qO=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(Zq,{scope:t,anchor:r,onAnchorChange:i,children:n})};qO.displayName=Zw;var KO="PopperAnchor",YO=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=GO(KO,n),o=_.useRef(null),l=an(t,o),u=_.useRef(null);return _.useEffect(()=>{const d=u.current;u.current=(r==null?void 0:r.current)||o.current,d!==u.current&&s.onAnchorChange(u.current)}),r?null:m.jsx(Kt.div,{...i,ref:l})});YO.displayName=KO;var Jw="PopperContent",[Jq,eK]=WO(Jw),XO=_.forwardRef((e,t)=>{var re,pe,ce,ge,ue,ke;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:b="optimized",onPlaced:y,...x}=e,w=GO(Jw,n),[C,R]=_.useState(null),E=an(t,Ae=>R(Ae)),[T,A]=_.useState(null),N=Qq(T),L=(N==null?void 0:N.width)??0,P=(N==null?void 0:N.height)??0,G=r+(s!=="center"?"-"+s:""),O=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},B=Array.isArray(d)?d:[d],H=B.length>0,j={padding:O,boundary:B.filter(nK),altBoundary:H},{refs:$,floatingStyles:V,placement:z,isPositioned:q,middlewareData:F}=Fq({strategy:"fixed",placement:G,whileElementsMounted:(...Ae)=>Nq(...Ae,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[$q({mainAxis:i+P,alignmentAxis:o}),u&&Uq({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Vq():void 0,...j}),u&&Wq({...j}),Gq({...j,apply:({elements:Ae,rects:ze,availableWidth:Ge,availableHeight:Et})=>{const{width:zt,height:Ct}=ze.reference,Pe=Ae.floating.style;Pe.setProperty("--radix-popper-available-width",`${Ge}px`),Pe.setProperty("--radix-popper-available-height",`${Et}px`),Pe.setProperty("--radix-popper-anchor-width",`${zt}px`),Pe.setProperty("--radix-popper-anchor-height",`${Ct}px`)}}),T&&Kq({element:T,padding:l}),rK({arrowWidth:L,arrowHeight:P}),g&&qq({strategy:"referenceHidden",...j})]}),[Y,I]=JO(z),U=Ts(y);zr(()=>{q&&(U==null||U())},[q,U]);const X=(re=F.arrow)==null?void 0:re.x,D=(pe=F.arrow)==null?void 0:pe.y,te=((ce=F.arrow)==null?void 0:ce.centerOffset)!==0,[Q,ne]=_.useState();return zr(()=>{C&&ne(window.getComputedStyle(C).zIndex)},[C]),m.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:q?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[(ge=F.transformOrigin)==null?void 0:ge.x,(ue=F.transformOrigin)==null?void 0:ue.y].join(" "),...((ke=F.hide)==null?void 0:ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(Jq,{scope:n,placedSide:Y,onArrowChange:A,arrowX:X,arrowY:D,shouldHideArrow:te,children:m.jsx(Kt.div,{"data-side":Y,"data-align":I,...x,ref:E,style:{...x.style,animation:q?void 0:"none"}})})})});XO.displayName=Jw;var QO="PopperArrow",tK={top:"bottom",right:"left",bottom:"top",left:"right"},ZO=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=eK(QO,r),o=tK[s.placedSide];return m.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:m.jsx(Xq,{...i,ref:n,style:{...i.style,display:"block"}})})});ZO.displayName=QO;function nK(e){return e!==null}var rK=e=>({name:"transformOrigin",options:e,fn(t){var w,C,R;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,u=o?0:e.arrowHeight,[d,f]=JO(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,b=(((R=i.arrow)==null?void 0:R.y)??0)+u/2;let y="",x="";return d==="bottom"?(y=o?h:`${g}px`,x=`${-u}px`):d==="top"?(y=o?h:`${g}px`,x=`${r.floating.height+u}px`):d==="right"?(y=`${-u}px`,x=o?h:`${b}px`):d==="left"&&(y=`${r.floating.width+u}px`,x=o?h:`${b}px`),{data:{x:y,y:x}}}});function JO(e){const[t,n="center"]=e.split("-");return[t,n]}var g0=qO,qf=YO,v0=XO,b0=ZO,e5=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),iK="VisuallyHidden",t5=_.forwardRef((e,t)=>m.jsx(Kt.span,{...e,ref:t,style:{...e5,...e.style}}));t5.displayName=iK;var sK=t5,[_0]=qo("Tooltip",[il]),y0=il(),n5="TooltipProvider",oK=700,yS="tooltip.open",[aK,eC]=_0(n5),r5=e=>{const{__scopeTooltip:t,delayDuration:n=oK,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=_.useRef(!0),l=_.useRef(!1),u=_.useRef(0);return _.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),m.jsx(aK,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(u.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:_.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:s})};r5.displayName=n5;var hf="Tooltip",[lK,Kf]=_0(hf),i5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,u=eC(hf,e.__scopeTooltip),d=y0(t),[f,h]=_.useState(null),g=zo(),b=_.useRef(0),y=o??u.disableHoverableContent,x=l??u.delayDuration,w=_.useRef(!1),[C,R]=Gu({prop:r,defaultProp:i??!1,onChange:L=>{L?(u.onOpen(),document.dispatchEvent(new CustomEvent(yS))):u.onClose(),s==null||s(L)},caller:hf}),E=_.useMemo(()=>C?w.current?"delayed-open":"instant-open":"closed",[C]),T=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,w.current=!1,R(!0)},[R]),A=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,R(!1)},[R]),N=_.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{w.current=!0,R(!0),b.current=0},x)},[x,R]);return _.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),m.jsx(g0,{...d,children:m.jsx(lK,{scope:t,contentId:g,open:C,stateAttribute:E,trigger:f,onTriggerChange:h,onTriggerEnter:_.useCallback(()=>{u.isOpenDelayedRef.current?N():T()},[u.isOpenDelayedRef,N,T]),onTriggerLeave:_.useCallback(()=>{y?A():(window.clearTimeout(b.current),b.current=0)},[A,y]),onOpen:T,onClose:A,disableHoverableContent:y,children:n})})};i5.displayName=hf;var xS="TooltipTrigger",s5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Kf(xS,n),s=eC(xS,n),o=y0(n),l=_.useRef(null),u=an(t,l,i.onTriggerChange),d=_.useRef(!1),f=_.useRef(!1),h=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(qf,{asChild:!0,...o,children:m.jsx(Kt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:u,onPointerMove:Ve(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ve(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Ve(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ve(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Ve(e.onBlur,i.onClose),onClick:Ve(e.onClick,i.onClose)})})});s5.displayName=xS;var tC="TooltipPortal",[cK,uK]=_0(tC,{forceMount:void 0}),o5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=Kf(tC,t);return m.jsx(cK,{scope:t,forceMount:n,children:m.jsx(ps,{present:n||s.open,children:m.jsx(dd,{asChild:!0,container:i,children:r})})})};o5.displayName=tC;var Ku="TooltipContent",a5=_.forwardRef((e,t)=>{const n=uK(Ku,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=Kf(Ku,e.__scopeTooltip);return m.jsx(ps,{present:r||o.open,children:o.disableHoverableContent?m.jsx(l5,{side:i,...s,ref:t}):m.jsx(dK,{side:i,...s,ref:t})})}),dK=_.forwardRef((e,t)=>{const n=Kf(Ku,e.__scopeTooltip),r=eC(Ku,e.__scopeTooltip),i=_.useRef(null),s=an(t,i),[o,l]=_.useState(null),{trigger:u,onClose:d}=n,f=i.current,{onPointerInTransitChange:h}=r,g=_.useCallback(()=>{l(null),h(!1)},[h]),b=_.useCallback((y,x)=>{const w=y.currentTarget,C={x:y.clientX,y:y.clientY},R=gK(C,w.getBoundingClientRect()),E=vK(C,R),T=bK(x.getBoundingClientRect()),A=yK([...E,...T]);l(A),h(!0)},[h]);return _.useEffect(()=>()=>g(),[g]),_.useEffect(()=>{if(u&&f){const y=w=>b(w,f),x=w=>b(w,u);return u.addEventListener("pointerleave",y),f.addEventListener("pointerleave",x),()=>{u.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",x)}}},[u,f,b,g]),_.useEffect(()=>{if(o){const y=x=>{const w=x.target,C={x:x.clientX,y:x.clientY},R=(u==null?void 0:u.contains(w))||(f==null?void 0:f.contains(w)),E=!_K(C,o);R?g():E&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[u,f,o,d,g]),m.jsx(l5,{...e,ref:s})}),[hK,fK]=_0(hf,{isInside:!1}),pK=hW("TooltipContent"),l5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,u=Kf(Ku,n),d=y0(n),{onClose:f}=u;return _.useEffect(()=>(document.addEventListener(yS,f),()=>document.removeEventListener(yS,f)),[f]),_.useEffect(()=>{if(u.trigger){const h=g=>{const b=g.target;b!=null&&b.contains(u.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,f]),m.jsx(ud,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(v0,{"data-state":u.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[m.jsx(pK,{children:r}),m.jsx(hK,{scope:n,isInside:!0,children:m.jsx(sK,{id:u.contentId,role:"tooltip",children:i||r})})]})})});a5.displayName=Ku;var c5="TooltipArrow",mK=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=y0(n);return fK(c5,n).isInside?null:m.jsx(b0,{...i,...r,ref:t})});mK.displayName=c5;function gK(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function vK(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function bK(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function _K(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],u=t[o],d=l.x,f=l.y,h=u.x,g=u.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function yK(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),xK(t)}function xK(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var SK=r5,u5=i5,d5=s5,h5=o5,nC=a5;function f5({className:e,...t}){return m.jsx("kbd",{className:xe("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",e),...t})}function wK({className:e,...t}){return m.jsx("span",{className:xe("inline-flex items-center gap-0.5",e),...t})}const CK="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",kK=SK,Za=u5,Ja=d5,Uo=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(h5,{children:m.jsx(nC,{ref:r,sideOffset:t,className:xe("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Uo.displayName=nC.displayName;const Oh=u5,jh=d5;function p5(e){return e.toUpperCase()}function EK(e){const t=e.split("+");return m.jsx(wK,{children:t.map((n,r)=>m.jsx(f5,{children:p5(n)},`${n}-${r}`))})}const Tu=_.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...i},s)=>{const o=r===void 0?null:Array.isArray(r)?r[0]??null:r;return m.jsx(h5,{children:m.jsx(nC,{ref:s,sideOffset:t,className:xe(CK,e),...i,children:o?EK(o):m.jsx("span",{children:typeof n=="string"?p5(n):n})})})});Tu.displayName="HotkeyTooltipContent";const RK="0.34.0",TK={version:RK},Gn="Kanna",WA="kanna",AK=".kanna",NK=".kanna-dev",MK="KANNA_RUNTIME_PROFILE",rC=`kanna/${TK.version}`,LK="[kanna]",DK=`~/${Gn}`;function x0(){var t;return(t=globalThis.process)==null?void 0:t.env}function IK(e=x0()){var t;return((t=e==null?void 0:e[MK])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function PK(e=x0()){return IK(e)==="dev"?NK:AK}function OK(e=x0()){return`~/${PK(e)}`}function jK(e=x0()){return`${OK(e)}/keybindings.json`}function Pm(e){return e?`${WA} ${e}`:WA}const GA=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const g=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(b=>b(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d))},u=t=e(r,i,l);return l},zK=(e=>e?GA(e):GA),BK=e=>e;function FK(e,t=BK){const n=vn.useSyncExternalStore(e.subscribe,vn.useCallback(()=>t(e.getState()),[e,t]),vn.useCallback(()=>t(e.getInitialState()),[e,t]));return vn.useDebugValue(n),n}const HK=e=>{const t=zK(e),n=r=>FK(t,r);return Object.assign(n,t),n},gc=(e=>HK);function $K(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var s;const o=u=>u===null?null:JSON.parse(u,void 0),l=(s=n.getItem(i))!=null?s:null;return l instanceof Promise?l.then(o):o(l)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const SS=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return SS(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return SS(r)(n)}}}},UK=(e,t)=>(n,r,i)=>{let s={storage:$K(()=>window.localStorage),partialize:w=>w,version:0,merge:(w,C)=>({...C,...w}),...t},o=!1,l=0;const u=new Set,d=new Set;let f=s.storage;if(!f)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...w)},r,i);const h=()=>{const w=s.partialize({...r()});return f.setItem(s.name,{state:w,version:s.version})},g=i.setState;i.setState=(w,C)=>(g(w,C),h());const b=e((...w)=>(n(...w),h()),r,i);i.getInitialState=()=>b;let y;const x=()=>{var w,C;if(!f)return;const R=++l;o=!1,u.forEach(T=>{var A;return T((A=r())!=null?A:b)});const E=((C=s.onRehydrateStorage)==null?void 0:C.call(s,(w=r())!=null?w:b))||void 0;return SS(f.getItem.bind(f))(s.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==s.version){if(s.migrate){const A=s.migrate(T.state,T.version);return A instanceof Promise?A.then(N=>[!0,N]):[!0,A]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var A;if(R!==l)return;const[N,L]=T;if(y=s.merge(L,(A=r())!=null?A:b),n(y,!0),N)return h()}).then(()=>{R===l&&(E==null||E(y,void 0),y=r(),o=!0,d.forEach(T=>T(y)))}).catch(T=>{R===l&&(E==null||E(void 0,T))})};return i.persist={setOptions:w=>{s={...s,...w},w.storage&&(f=w.storage)},clearStorage:()=>{f==null||f.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>x(),hasHydrated:()=>o,onHydrate:w=>(u.add(w),()=>{u.delete(w)}),onFinishHydration:w=>(d.add(w),()=>{d.delete(w)})},s.skipHydration||x(),y||b},vc=UK,m5="always",g5="funk",VK=[{value:"blow",label:"Blow"},{value:"bottle",label:"Bottle"},{value:"frog",label:"Frog"},{value:"funk",label:"Funk"},{value:"glass",label:"Glass"},{value:"ping",label:"Ping"},{value:"pop",label:"Pop"},{value:"purr",label:"Purr"},{value:"tink",label:"Tink"}];function qA(e){switch(e){case"never":case"unfocused":case"always":return e;default:return m5}}function KA(e){switch(e){case"blow":case"bottle":case"frog":case"funk":case"glass":case"ping":case"pop":case"purr":case"tink":return e;default:return g5}}const Au=gc()(vc(e=>({chatSoundPreference:m5,chatSoundId:g5,setChatSoundPreference:t=>e({chatSoundPreference:qA(t)}),setChatSoundId:t=>e({chatSoundId:KA(t)})}),{name:"chat-sound-preferences",version:2,migrate:e=>{const t=e;return{chatSoundPreference:qA(t==null?void 0:t.chatSoundPreference),chatSoundId:KA(t==null?void 0:t.chatSoundId)}}})),WK={blow:"/chat-sounds/Blow.mp3",bottle:"/chat-sounds/Bottle.mp3",frog:"/chat-sounds/Frog.mp3",funk:"/chat-sounds/Funk.mp3",glass:"/chat-sounds/Glass.mp3",ping:"/chat-sounds/Ping.mp3",pop:"/chat-sounds/Pop.mp3",purr:"/chat-sounds/Purr.mp3",tink:"/chat-sounds/Tink.mp3"};function GK(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function qK(e){const t=new Audio(WK[e]);return t.preload="auto",t.play()}async function wS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{qK(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function KK(e,t=document){return e==="never"?!1:e==="always"?!0:GK(t)}function YK(e){return e.projectGroups.reduce((t,n)=>t+n.chats.reduce((r,i)=>r+(i.unread?1:0)+(i.status==="waiting_for_user"?1:0),0),0)}function YA(e){let t=0;const n=new Set;for(const r of e.projectGroups)for(const i of r.chats)i.unread&&(t+=1),i.status==="waiting_for_user"&&n.add(i.chatId);return{unreadCount:t,waitingChatIds:n}}function XK(e,t){if(!e)return 0;const n=YA(e),r=YA(t),i=Math.max(0,r.unreadCount-n.unreadCount);let s=0;for(const o of r.waitingChatIds)n.waitingChatIds.has(o)||(s+=1);return i+s}const pd=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>m.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:xe("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...i,children:e});function CS(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const QK=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function ZK(e){const t=e.trim();for(const n of QK){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function v5(e){return e.split("/").pop()||e}const JK=1440*6e4;function eY(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=JK,o=7*s;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<s?`${Math.floor(n/i)}h`:n<o?`${Math.floor(n/s)}d`:`${Math.floor(n/o)}w`}function tY(e){return e.lastMessageAt??e._creationTime}const nY=new Set(["starting","running"]);function rY({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onForkChat:o,onDeleteChat:l}){const u=eY(tY(e),n),d=i&&r?r:u,f=i&&!!r,h=rW(e.chatId);return m.jsxs("div",{"data-chat-id":h,className:xe("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 active:scale-[0.985] border transition-all",t===h?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>s(e.chatId),children:[nY.has(e.status)?m.jsx(Rn,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):e.unread?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,m.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?m.jsx(pd,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.title}),m.jsxs("div",{className:xe("relative h-7 mr-[2px] shrink-0",e.canFork?"w-12":"w-6"),children:[d?f?m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-0.5 text-[11px] text-foreground transition-opacity group-hover:opacity-0",children:m.jsx(f5,{className:"h-4 min-w-4 rounded-sm border-border/50 bg-transparent px-1 text-[10px]",children:r})}):m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] text-muted-foreground opacity-50 transition-opacity group-hover:opacity-0",children:d}):null,m.jsxs("div",{className:xe("absolute inset-0 flex items-center justify-end gap-0 opacity-100",d?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),children:[e.canFork?m.jsx(st,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:g=>{g.stopPropagation(),o(e.chatId)},title:"Fork chat",children:m.jsx(YU,{className:"size-3.5"})}):null,m.jsx(st,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:g=>{g.stopPropagation(),l(e.chatId)},title:"Delete chat",children:m.jsx(g$,{className:"size-3.5"})})]})]})]},e._id)}const iY=_.memo(rY);function sY(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const S0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function md(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function iC(e){return"nodeType"in e}function mi(e){var t,n;return e?md(e)?e:iC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function sC(e){const{Document:t}=mi(e);return e instanceof t}function Yf(e){return md(e)?!1:e instanceof mi(e).HTMLElement}function b5(e){return e instanceof mi(e).SVGElement}function gd(e){return e?md(e)?e.document:iC(e)?sC(e)?e:Yf(e)||b5(e)?e.ownerDocument:document:document:document}const io=S0?_.useLayoutEffect:_.useEffect;function oC(e){const t=_.useRef(e);return io(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function oY(){const e=_.useRef(null),t=_.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ff(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return io(()=>{n.current!==e&&(n.current=e)},t),n}function Xf(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function cv(e){const t=oC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function kS(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let Iy={};function Qf(e,t){return _.useMemo(()=>{if(t)return t;const n=Iy[e]==null?0:Iy[e]+1;return Iy[e]=n,e+"-"+n},[e,t])}function _5(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const l=Object.entries(o);for(const[u,d]of l){const f=s[u];f!=null&&(s[u]=f+e*d)}return s},{...t})}}const ju=_5(1),uv=_5(-1);function aY(e){return"clientX"in e&&"clientY"in e}function aC(e){if(!e)return!1;const{KeyboardEvent:t}=mi(e.target);return t&&e instanceof t}function lY(e){if(!e)return!1;const{TouchEvent:t}=mi(e.target);return t&&e instanceof t}function ES(e){if(lY(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return aY(e)?{x:e.clientX,y:e.clientY}:null}const pf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[pf.Translate.toString(e),pf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),XA="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function cY(e){return e.matches(XA)?e:e.querySelector(XA)}const uY={display:"none"};function dY(e){let{id:t,value:n}=e;return vn.createElement("div",{id:t,style:uY},n)}function hY(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return vn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function fY(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const y5=_.createContext(null);function pY(e){const t=_.useContext(y5);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function mY(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:i,event:s}=r;e.forEach(o=>{var l;return(l=o[i])==null?void 0:l.call(o,s)})},[e]),t]}const gY={draggable:`
|
|
630
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},AG="DialogDescriptionWarning",NG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${CO(AG).contentName}}.`;return _.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},MG=dO,LG=pO,kO=mO,EO=gO,DG=bO,IG=yO,PG=SO;const uf="data-focus-fallback-ignore",RO="data-allow-focus-retain",rv="kanna:restore-chat-input-focus",Hw="data-chat-input",iv="data-chat-selection-zone";function Ol(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function TO(e){var n;const t=e;return t!=null&&t.matches?t.matches("input:not([type='checkbox']):not([type='radio']):not([type='button']):not([type='submit']):not([type='reset']), textarea, select")||t.isContentEditable||((n=t.getAttribute)==null?void 0:n.call(t,"role"))==="textbox"?!0:Ol(e,RO):!1}function OG(e){const t=e;return t!=null&&t.matches?TO(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Ol(e,RO):!1}function LA(e){return!!e.querySelector(`[${uf}][data-state='open']`)}function jG(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function zG(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${Hw}]`)).filter(o=>!o.disabled);if(n.length===0)return!1;const r=n.indexOf(e),i=r>=0?(r+1)%n.length:0,s=n[i];return s?(s.focus({preventScroll:!0}),!0):!1}function DA(e){const{activeElement:t,fallback:n,hasActiveOverlay:r}=e;if(!n||n.disabled||r||t===n)return"none";if(e.trigger==="escape")return e.defaultPrevented||Ol(t,Hw)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,u=s??i;return!o||!u||!o.contains(u)||Ol(u,uf)||Ol(t,uf)||l&&(Ol(i,iv)||Ol(u,iv))||TO(t)?"none":t&&t===u?"restore":OG(t)?"none":"restore"}const Jl=MG,BG=LG,AO=_.forwardRef(({className:e,...t},n)=>m.jsx(kO,{ref:n,className:xe("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));AO.displayName=kO.displayName;const FG={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},Ya=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(BG,{children:[m.jsx(AO,{}),m.jsxs(EO,{ref:i,[uf]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(rv)),(o=r.onCloseAutoFocus)==null||o.call(r,s)},className:xe("fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-background shadow-xl duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","max-h-[85vh] flex flex-col",FG[n],e),...r,children:[t,m.jsxs(PG,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[m.jsx(nl,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ya.displayName=EO.displayName;function HG({className:e,...t}){return m.jsx("div",{className:xe("shrink-0 flex flex-col space-y-1.5 p-4 border-b border-border",e),...t})}function ec({className:e,...t}){return m.jsx(DG,{className:xe("text-lg font-medium leading-none tracking-tight",e),...t})}function d0({className:e,...t}){return m.jsx(IG,{className:xe("text-sm text-muted-foreground",e),...t})}function tc({className:e,...t}){return m.jsx("div",{className:xe("flex-1 min-h-0 overflow-y-auto px-4 pb-4 pt-3.5",e),...t})}function nc({className:e,...t}){return m.jsx("div",{className:xe("shrink-0 flex justify-end gap-2 border-t border-border bg-background p-2 rounded-b-xl",e),...t})}function $G({className:e,...t}){return m.jsx("button",{className:xe("touch-manipulation inline-flex items-center justify-center whitespace-nowrap cursor-pointer text-sm font-medium transition-colors","rounded-full h-9 px-4","hover:bg-accent dark:hover:bg-card hover:text-accent-foreground text-muted-foreground","disabled:pointer-events-none disabled:text-muted-foreground/50",e),...t})}const Yr=_.forwardRef(({className:e,type:t,...n},r)=>m.jsx("input",{ref:r,type:t,className:xe("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n}));Yr.displayName="Input";const NO=_.createContext(null);function UG({children:e}){const[t,n]=_.useState(null),[r,i]=_.useState(""),s=_.useRef(null);_.useEffect(()=>{(t==null?void 0:t.kind)==="prompt"&&(i(t.options.initialValue??""),setTimeout(()=>{var b,y;(b=s.current)==null||b.focus(),(y=s.current)==null||y.select()},0))},[t]);const o=_.useCallback(()=>{n(null),i("")},[]),l=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!1):t.kind==="prompt"?t.resolve(null):t.resolve(),o())},[o,t]),u=_.useCallback(()=>{t&&(t.kind==="confirm"?t.resolve(!0):t.kind==="prompt"?t.resolve(r.trim()||null):t.resolve(),o())},[o,t,r]),d=_.useCallback(b=>new Promise(y=>{n({kind:"confirm",options:b,resolve:y})}),[]),f=_.useCallback(b=>new Promise(y=>{n({kind:"prompt",options:b,resolve:y})}),[]),h=_.useCallback(b=>new Promise(y=>{n({kind:"alert",options:b,resolve:y})}),[]),g=_.useMemo(()=>({confirm:d,prompt:f,alert:h}),[h,d,f]);return m.jsxs(NO.Provider,{value:g,children:[e,m.jsx(Jl,{open:t!==null,onOpenChange:b=>{b||!t||l()},children:m.jsx(Ya,{size:"sm",onKeyDown:b=>{b.key!=="Enter"||b.shiftKey||!t||t.kind!=="confirm"||(b.preventDefault(),u())},children:t?m.jsxs(m.Fragment,{children:[m.jsxs(tc,{className:"space-y-4",children:[m.jsx(ec,{children:t.options.title}),t.options.description?m.jsx(d0,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Yr,{ref:s,type:"text",value:r,onChange:b=>i(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),u())},placeholder:t.options.placeholder}):null]}),m.jsxs(nc,{children:[m.jsx(st,{variant:"ghost",size:"sm",onClick:l,className:t.kind==="alert"?"hidden":void 0,children:"cancelLabel"in t.options?t.options.cancelLabel??"Cancel":"Cancel"}),m.jsx(st,{variant:t.kind==="confirm"?t.options.confirmVariant??"default":"secondary",size:"sm",onClick:u,disabled:t.kind==="prompt"&&!r.trim(),children:t.kind==="alert"?t.options.closeLabel??"OK":"confirmLabel"in t.options?t.options.confirmLabel??"Confirm":"Confirm"})]})]}):null})})]})}function $w(){const e=_.useContext(NO);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const Uw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("bg-card text-card-foreground",e),...t}));Uw.displayName="Card";const Vw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex flex-col space-y-1.5 p-2",e),...t}));Vw.displayName="CardHeader";const MO=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...t}));MO.displayName="CardTitle";const LO=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));LO.displayName="CardDescription";const Ww=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("p-6 pt-0",e),...t}));Ww.displayName="CardContent";const VG=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex items-center p-6 pt-0",e),...t}));VG.displayName="CardFooter";const WG=["top","right","bottom","left"],Xa=Math.min,Mi=Math.max,sv=Math.round,Im=Math.floor,no=e=>({x:e,y:e}),GG={left:"right",right:"left",bottom:"top",top:"bottom"};function vS(e,t,n){return Mi(e,Xa(t,n))}function Ho(e,t){return typeof e=="function"?e(t):e}function $o(e){return e.split("-")[0]}function hd(e){return e.split("-")[1]}function Gw(e){return e==="x"?"y":"x"}function qw(e){return e==="y"?"height":"width"}function Qs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Kw(e){return Gw(Qs(e))}function qG(e,t,n){n===void 0&&(n=!1);const r=hd(e),i=Kw(e),s=qw(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=ov(o)),[o,ov(o)]}function KG(e){const t=ov(e);return[bS(e),t,bS(t)]}function bS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const IA=["left","right"],PA=["right","left"],YG=["top","bottom"],XG=["bottom","top"];function QG(e,t,n){switch(e){case"top":case"bottom":return n?t?PA:IA:t?IA:PA;case"left":case"right":return t?YG:XG;default:return[]}}function ZG(e,t,n,r){const i=hd(e);let s=QG($o(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(bS)))),s}function ov(e){const t=$o(e);return GG[t]+e.slice(t.length)}function JG(e){return{top:0,right:0,bottom:0,left:0,...e}}function DO(e){return typeof e!="number"?JG(e):{top:e,right:e,bottom:e,left:e}}function av(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function OA(e,t,n){let{reference:r,floating:i}=e;const s=Qs(t),o=Kw(t),l=qw(o),u=$o(t),d=s==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,g=r[l]/2-i[l]/2;let b;switch(u){case"top":b={x:f,y:r.y-i.height};break;case"bottom":b={x:f,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:h};break;case"left":b={x:r.x-i.width,y:h};break;default:b={x:r.x,y:r.y}}switch(hd(t)){case"start":b[o]-=g*(n&&d?-1:1);break;case"end":b[o]+=g*(n&&d?-1:1);break}return b}async function eq(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:u}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:g=!1,padding:b=0}=Ho(t,e),y=DO(b),w=l[g?h==="floating"?"reference":"floating":h],C=av(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:u})),R=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),T=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},A=av(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:E,strategy:u}):R);return{top:(C.top-A.top+y.top)/T.y,bottom:(A.bottom-C.bottom+y.bottom)/T.y,left:(C.left-A.left+y.left)/T.x,right:(A.right-C.right+y.right)/T.x}}const tq=50,nq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:eq},u=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:h}=OA(d,r,u),g=r,b=0;const y={};for(let x=0;x<s.length;x++){const w=s[x];if(!w)continue;const{name:C,fn:R}=w,{x:E,y:T,data:A,reset:N}=await R({x:f,y:h,initialPlacement:r,placement:g,strategy:i,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});f=E??f,h=T??h,y[C]={...y[C],...A},N&&b<tq&&(b++,typeof N=="object"&&(N.placement&&(g=N.placement),N.rects&&(d=N.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):N.rects),{x:f,y:h}=OA(d,g,u)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},rq=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:u}=t,{element:d,padding:f=0}=Ho(e,t)||{};if(d==null)return{};const h=DO(f),g={x:n,y:r},b=Kw(i),y=qw(b),x=await o.getDimensions(d),w=b==="y",C=w?"top":"left",R=w?"bottom":"right",E=w?"clientHeight":"clientWidth",T=s.reference[y]+s.reference[b]-g[b]-s.floating[y],A=g[b]-s.reference[b],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let L=N?N[E]:0;(!L||!await(o.isElement==null?void 0:o.isElement(N)))&&(L=l.floating[E]||s.floating[y]);const P=T/2-A/2,G=L/2-x[y]/2-1,O=Xa(h[C],G),B=Xa(h[R],G),H=O,j=L-x[y]-B,$=L/2-x[y]/2+P,V=vS(H,$,j),z=!u.arrow&&hd(i)!=null&&$!==V&&s.reference[y]/2-($<H?O:B)-x[y]/2<0,q=z?$<H?$-H:$-j:0;return{[b]:g[b]+q,data:{[b]:V,centerOffset:$-V-q,...z&&{alignmentOffset:q}},reset:z}}}),iq=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:u,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:x=!0,...w}=Ho(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const C=$o(i),R=Qs(l),E=$o(l)===l,T=await(u.isRTL==null?void 0:u.isRTL(d.floating)),A=g||(E||!x?[ov(l)]:KG(l)),N=y!=="none";!g&&N&&A.push(...ZG(l,x,y,T));const L=[l,...A],P=await u.detectOverflow(t,w),G=[];let O=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(P[C]),h){const $=qG(i,o,T);G.push(P[$[0]],P[$[1]])}if(O=[...O,{placement:i,overflows:G}],!G.every($=>$<=0)){var B,H;const $=(((B=s.flip)==null?void 0:B.index)||0)+1,V=L[$];if(V&&(!(h==="alignment"?R!==Qs(V):!1)||O.every(F=>Qs(F.placement)===R?F.overflows[0]>0:!0)))return{data:{index:$,overflows:O},reset:{placement:V}};let z=(H=O.filter(q=>q.overflows[0]<=0).sort((q,F)=>q.overflows[1]-F.overflows[1])[0])==null?void 0:H.placement;if(!z)switch(b){case"bestFit":{var j;const q=(j=O.filter(F=>{if(N){const Y=Qs(F.placement);return Y===R||Y==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(Y=>Y>0).reduce((Y,I)=>Y+I,0)]).sort((F,Y)=>F[1]-Y[1])[0])==null?void 0:j[0];q&&(z=q);break}case"initialPlacement":z=l;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function jA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zA(e){return WG.some(t=>e[t]>=0)}const sq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Ho(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=jA(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:zA(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=jA(o,n.floating);return{data:{escapedOffsets:l,escaped:zA(l)}}}default:return{}}}}},IO=new Set(["left","top"]);async function oq(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=$o(n),l=hd(n),u=Qs(n)==="y",d=IO.has(o)?-1:1,f=s&&u?-1:1,h=Ho(t,e);let{mainAxis:g,crossAxis:b,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof y=="number"&&(b=l==="end"?y*-1:y),u?{x:b*f,y:g*d}:{x:g*d,y:b*f}}const aq=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=t,u=await oq(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:o}}}}},lq=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:u={fn:C=>{let{x:R,y:E}=C;return{x:R,y:E}}},...d}=Ho(e,t),f={x:n,y:r},h=await s.detectOverflow(t,d),g=Qs($o(i)),b=Gw(g);let y=f[b],x=f[g];if(o){const C=b==="y"?"top":"left",R=b==="y"?"bottom":"right",E=y+h[C],T=y-h[R];y=vS(E,y,T)}if(l){const C=g==="y"?"top":"left",R=g==="y"?"bottom":"right",E=x+h[C],T=x-h[R];x=vS(E,x,T)}const w=u.fn({...t,[b]:y,[g]:x});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[b]:o,[g]:l}}}}}},cq=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:l=0,mainAxis:u=!0,crossAxis:d=!0}=Ho(e,t),f={x:n,y:r},h=Qs(i),g=Gw(h);let b=f[g],y=f[h];const x=Ho(l,t),w=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(u){const E=g==="y"?"height":"width",T=s.reference[g]-s.floating[E]+w.mainAxis,A=s.reference[g]+s.reference[E]-w.mainAxis;b<T?b=T:b>A&&(b=A)}if(d){var C,R;const E=g==="y"?"width":"height",T=IO.has($o(i)),A=s.reference[h]-s.floating[E]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),N=s.reference[h]+s.reference[E]+(T?0:((R=o.offset)==null?void 0:R[h])||0)-(T?w.crossAxis:0);y<A?y=A:y>N&&(y=N)}return{[g]:b,[h]:y}}}},uq=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:l}=t,{apply:u=()=>{},...d}=Ho(e,t),f=await o.detectOverflow(t,d),h=$o(i),g=hd(i),b=Qs(i)==="y",{width:y,height:x}=s.floating;let w,C;h==="top"||h==="bottom"?(w=h,C=g===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,w=g==="end"?"top":"bottom");const R=x-f.top-f.bottom,E=y-f.left-f.right,T=Xa(x-f[w],R),A=Xa(y-f[C],E),N=!t.middlewareData.shift;let L=T,P=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=R),N&&!g){const O=Mi(f.left,0),B=Mi(f.right,0),H=Mi(f.top,0),j=Mi(f.bottom,0);b?P=y-2*(O!==0||B!==0?O+B:Mi(f.left,f.right)):L=x-2*(H!==0||j!==0?H+j:Mi(f.top,f.bottom))}await u({...t,availableWidth:P,availableHeight:L});const G=await o.getDimensions(l.floating);return y!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function h0(){return typeof window<"u"}function fd(e){return PO(e)?(e.nodeName||"").toLowerCase():"#document"}function Di(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function oo(e){var t;return(t=(PO(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function PO(e){return h0()?e instanceof Node||e instanceof Di(e).Node:!1}function As(e){return h0()?e instanceof Element||e instanceof Di(e).Element:!1}function Ko(e){return h0()?e instanceof HTMLElement||e instanceof Di(e).HTMLElement:!1}function BA(e){return!h0()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Di(e).ShadowRoot}function Gf(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ns(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function dq(e){return/^(table|td|th)$/.test(fd(e))}function f0(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const hq=/transform|translate|scale|rotate|perspective|filter/,fq=/paint|layout|strict|content/,Tl=e=>!!e&&e!=="none";let My;function Yw(e){const t=As(e)?Ns(e):e;return Tl(t.transform)||Tl(t.translate)||Tl(t.scale)||Tl(t.rotate)||Tl(t.perspective)||!Xw()&&(Tl(t.backdropFilter)||Tl(t.filter))||hq.test(t.willChange||"")||fq.test(t.contain||"")}function pq(e){let t=Qa(e);for(;Ko(t)&&!qu(t);){if(Yw(t))return t;if(f0(t))return null;t=Qa(t)}return null}function Xw(){return My==null&&(My=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),My}function qu(e){return/^(html|body|#document)$/.test(fd(e))}function Ns(e){return Di(e).getComputedStyle(e)}function p0(e){return As(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qa(e){if(fd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||BA(e)&&e.host||oo(e);return BA(t)?t.host:t}function OO(e){const t=Qa(e);return qu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ko(t)&&Gf(t)?t:OO(t)}function df(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=OO(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Di(i);if(s){const l=_S(o);return t.concat(o,o.visualViewport||[],Gf(i)?i:[],l&&n?df(l):[])}else return t.concat(i,df(i,[],n))}function _S(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function jO(e){const t=Ns(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Ko(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=sv(n)!==s||sv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function Qw(e){return As(e)?e:e.contextElement}function Ou(e){const t=Qw(e);if(!Ko(t))return no(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=jO(t);let o=(s?sv(n.width):n.width)/r,l=(s?sv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const mq=no(0);function zO(e){const t=Di(e);return!Xw()||!t.visualViewport?mq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Di(e)?!1:t}function rc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=Qw(e);let o=no(1);t&&(r?As(r)&&(o=Ou(r)):o=Ou(e));const l=gq(s,n,r)?zO(s):no(0);let u=(i.left+l.x)/o.x,d=(i.top+l.y)/o.y,f=i.width/o.x,h=i.height/o.y;if(s){const g=Di(s),b=r&&As(r)?Di(r):r;let y=g,x=_S(y);for(;x&&r&&b!==y;){const w=Ou(x),C=x.getBoundingClientRect(),R=Ns(x),E=C.left+(x.clientLeft+parseFloat(R.paddingLeft))*w.x,T=C.top+(x.clientTop+parseFloat(R.paddingTop))*w.y;u*=w.x,d*=w.y,f*=w.x,h*=w.y,u+=E,d+=T,y=Di(x),x=_S(y)}}return av({width:f,height:h,x:u,y:d})}function m0(e,t){const n=p0(e).scrollLeft;return t?t.left+n:rc(oo(e)).left+n}function BO(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-m0(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function vq(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=oo(r),l=t?f0(t.floating):!1;if(r===o||l&&s)return n;let u={scrollLeft:0,scrollTop:0},d=no(1);const f=no(0),h=Ko(r);if((h||!h&&!s)&&((fd(r)!=="body"||Gf(o))&&(u=p0(r)),h)){const b=rc(r);d=Ou(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!h&&!s?BO(o,u):no(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+f.x+g.x,y:n.y*d.y-u.scrollTop*d.y+f.y+g.y}}function bq(e){return Array.from(e.getClientRects())}function _q(e){const t=oo(e),n=p0(e),r=e.ownerDocument.body,i=Mi(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Mi(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+m0(e);const l=-n.scrollTop;return Ns(r).direction==="rtl"&&(o+=Mi(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const FA=25;function yq(e,t){const n=Di(e),r=oo(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,u=0;if(i){s=i.width,o=i.height;const f=Xw();(!f||f&&t==="fixed")&&(l=i.offsetLeft,u=i.offsetTop)}const d=m0(r);if(d<=0){const f=r.ownerDocument,h=f.body,g=getComputedStyle(h),b=f.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(r.clientWidth-h.clientWidth-b);y<=FA&&(s-=y)}else d<=FA&&(s+=d);return{width:s,height:o,x:l,y:u}}function xq(e,t){const n=rc(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Ko(e)?Ou(e):no(1),o=e.clientWidth*s.x,l=e.clientHeight*s.y,u=i*s.x,d=r*s.y;return{width:o,height:l,x:u,y:d}}function HA(e,t,n){let r;if(t==="viewport")r=yq(e,n);else if(t==="document")r=_q(oo(e));else if(As(t))r=xq(t,n);else{const i=zO(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return av(r)}function FO(e,t){const n=Qa(e);return n===t||!As(n)||qu(n)?!1:Ns(n).position==="fixed"||FO(n,t)}function Sq(e,t){const n=t.get(e);if(n)return n;let r=df(e,[],!1).filter(l=>As(l)&&fd(l)!=="body"),i=null;const s=Ns(e).position==="fixed";let o=s?Qa(e):e;for(;As(o)&&!qu(o);){const l=Ns(o),u=Yw(o);!u&&l.position==="fixed"&&(i=null),(s?!u&&!i:!u&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Gf(o)&&!u&&FO(e,o))?r=r.filter(f=>f!==o):i=l,o=Qa(o)}return t.set(e,r),r}function wq(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?f0(t)?[]:Sq(t,this._c):[].concat(n),r],l=HA(t,o[0],i);let u=l.top,d=l.right,f=l.bottom,h=l.left;for(let g=1;g<o.length;g++){const b=HA(t,o[g],i);u=Mi(b.top,u),d=Xa(b.right,d),f=Xa(b.bottom,f),h=Mi(b.left,h)}return{width:d-h,height:f-u,x:h,y:u}}function Cq(e){const{width:t,height:n}=jO(e);return{width:t,height:n}}function kq(e,t,n){const r=Ko(t),i=oo(t),s=n==="fixed",o=rc(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=no(0);function d(){u.x=m0(i)}if(r||!r&&!s)if((fd(t)!=="body"||Gf(i))&&(l=p0(t)),r){const b=rc(t,!0,s,t);u.x=b.x+t.clientLeft,u.y=b.y+t.clientTop}else i&&d();s&&!r&&i&&d();const f=i&&!r&&!s?BO(i,l):no(0),h=o.left+l.scrollLeft-u.x-f.x,g=o.top+l.scrollTop-u.y-f.y;return{x:h,y:g,width:o.width,height:o.height}}function Ly(e){return Ns(e).position==="static"}function $A(e,t){if(!Ko(e)||Ns(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return oo(e)===n&&(n=n.ownerDocument.body),n}function HO(e,t){const n=Di(e);if(f0(e))return n;if(!Ko(e)){let i=Qa(e);for(;i&&!qu(i);){if(As(i)&&!Ly(i))return i;i=Qa(i)}return n}let r=$A(e,t);for(;r&&dq(r)&&Ly(r);)r=$A(r,t);return r&&qu(r)&&Ly(r)&&!Yw(r)?n:r||pq(e)||n}const Eq=async function(e){const t=this.getOffsetParent||HO,n=this.getDimensions,r=await n(e.floating);return{reference:kq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rq(e){return Ns(e).direction==="rtl"}const Tq={convertOffsetParentRelativeRectToViewportRelativeRect:vq,getDocumentElement:oo,getClippingRect:wq,getOffsetParent:HO,getElementRects:Eq,getClientRects:bq,getDimensions:Cq,getScale:Ou,isElement:As,isRTL:Rq};function $O(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Aq(e,t){let n=null,r;const i=oo(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),s();const d=e.getBoundingClientRect(),{left:f,top:h,width:g,height:b}=d;if(l||t(),!g||!b)return;const y=Im(h),x=Im(i.clientWidth-(f+g)),w=Im(i.clientHeight-(h+b)),C=Im(f),E={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:Mi(0,Xa(1,u))||1};let T=!0;function A(N){const L=N[0].intersectionRatio;if(L!==u){if(!T)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!$O(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(A,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(A,E)}n.observe(e)}return o(!0),s}function Nq(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,d=Qw(e),f=i||s?[...d?df(d):[],...t?df(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?Aq(d,n):null;let g=-1,b=null;o&&(b=new ResizeObserver(C=>{let[R]=C;R&&R.target===d&&b&&t&&(b.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var E;(E=b)==null||E.observe(t)})),n()}),d&&!u&&b.observe(d),t&&b.observe(t));let y,x=u?rc(e):null;u&&w();function w(){const C=rc(e);x&&!$O(x,C)&&n(),x=C,y=requestAnimationFrame(w)}return n(),()=>{var C;f.forEach(R=>{i&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),h==null||h(),(C=b)==null||C.disconnect(),b=null,u&&cancelAnimationFrame(y)}}const Mq=aq,Lq=lq,Dq=iq,Iq=uq,Pq=sq,UA=rq,Oq=cq,jq=(e,t,n)=>{const r=new Map,i={platform:Tq,...n},s={...i.platform,_c:r};return nq(e,t,{...i,platform:s})};var zq=typeof document<"u",Bq=function(){},Ag=zq?_.useLayoutEffect:Bq;function lv(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!lv(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!lv(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function UO(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function VA(e,t){const n=UO(e);return Math.round(t*n)/n}function Dy(e){const t=_.useRef(e);return Ag(()=>{t.current=e}),t}function Fq(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:u,open:d}=e,[f,h]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,b]=_.useState(r);lv(g,r)||b(r);const[y,x]=_.useState(null),[w,C]=_.useState(null),R=_.useCallback(F=>{F!==N.current&&(N.current=F,x(F))},[]),E=_.useCallback(F=>{F!==L.current&&(L.current=F,C(F))},[]),T=s||y,A=o||w,N=_.useRef(null),L=_.useRef(null),P=_.useRef(f),G=u!=null,O=Dy(u),B=Dy(i),H=Dy(d),j=_.useCallback(()=>{if(!N.current||!L.current)return;const F={placement:t,strategy:n,middleware:g};B.current&&(F.platform=B.current),jq(N.current,L.current,F).then(Y=>{const I={...Y,isPositioned:H.current!==!1};$.current&&!lv(P.current,I)&&(P.current=I,os.flushSync(()=>{h(I)}))})},[g,t,n,B,H]);Ag(()=>{d===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[d]);const $=_.useRef(!1);Ag(()=>($.current=!0,()=>{$.current=!1}),[]),Ag(()=>{if(T&&(N.current=T),A&&(L.current=A),T&&A){if(O.current)return O.current(T,A,j);j()}},[T,A,j,O,G]);const V=_.useMemo(()=>({reference:N,floating:L,setReference:R,setFloating:E}),[R,E]),z=_.useMemo(()=>({reference:T,floating:A}),[T,A]),q=_.useMemo(()=>{const F={position:n,left:0,top:0};if(!z.floating)return F;const Y=VA(z.floating,f.x),I=VA(z.floating,f.y);return l?{...F,transform:"translate("+Y+"px, "+I+"px)",...UO(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:I}},[n,l,z.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:j,refs:V,elements:z,floatingStyles:q}),[f,j,V,z,q])}const Hq=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?UA({element:r.current,padding:i}).fn(n):{}:r?UA({element:r,padding:i}).fn(n):{}}}},$q=(e,t)=>{const n=Mq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Uq=(e,t)=>{const n=Lq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vq=(e,t)=>({fn:Oq(e).fn,options:[e,t]}),Wq=(e,t)=>{const n=Dq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gq=(e,t)=>{const n=Iq(e);return{name:n.name,fn:n.fn,options:[e,t]}},qq=(e,t)=>{const n=Pq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kq=(e,t)=>{const n=Hq(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Yq="Arrow",VO=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Kt.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:m.jsx("polygon",{points:"0,0 30,0 15,10"})})});VO.displayName=Yq;var Xq=VO;function Qq(e){const[t,n]=_.useState(void 0);return zr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,l;if("borderBoxSize"in s){const u=s.borderBoxSize,d=Array.isArray(u)?u[0]:u;o=d.inlineSize,l=d.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Zw="Popper",[WO,il]=qo(Zw),[Zq,GO]=WO(Zw),qO=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(Zq,{scope:t,anchor:r,onAnchorChange:i,children:n})};qO.displayName=Zw;var KO="PopperAnchor",YO=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=GO(KO,n),o=_.useRef(null),l=an(t,o),u=_.useRef(null);return _.useEffect(()=>{const d=u.current;u.current=(r==null?void 0:r.current)||o.current,d!==u.current&&s.onAnchorChange(u.current)}),r?null:m.jsx(Kt.div,{...i,ref:l})});YO.displayName=KO;var Jw="PopperContent",[Jq,eK]=WO(Jw),XO=_.forwardRef((e,t)=>{var re,pe,ce,ge,ue,ke;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:b="optimized",onPlaced:y,...x}=e,w=GO(Jw,n),[C,R]=_.useState(null),E=an(t,Ae=>R(Ae)),[T,A]=_.useState(null),N=Qq(T),L=(N==null?void 0:N.width)??0,P=(N==null?void 0:N.height)??0,G=r+(s!=="center"?"-"+s:""),O=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},B=Array.isArray(d)?d:[d],H=B.length>0,j={padding:O,boundary:B.filter(nK),altBoundary:H},{refs:$,floatingStyles:V,placement:z,isPositioned:q,middlewareData:F}=Fq({strategy:"fixed",placement:G,whileElementsMounted:(...Ae)=>Nq(...Ae,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[$q({mainAxis:i+P,alignmentAxis:o}),u&&Uq({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Vq():void 0,...j}),u&&Wq({...j}),Gq({...j,apply:({elements:Ae,rects:ze,availableWidth:Ge,availableHeight:Et})=>{const{width:zt,height:Ct}=ze.reference,Pe=Ae.floating.style;Pe.setProperty("--radix-popper-available-width",`${Ge}px`),Pe.setProperty("--radix-popper-available-height",`${Et}px`),Pe.setProperty("--radix-popper-anchor-width",`${zt}px`),Pe.setProperty("--radix-popper-anchor-height",`${Ct}px`)}}),T&&Kq({element:T,padding:l}),rK({arrowWidth:L,arrowHeight:P}),g&&qq({strategy:"referenceHidden",...j})]}),[Y,I]=JO(z),U=Ts(y);zr(()=>{q&&(U==null||U())},[q,U]);const X=(re=F.arrow)==null?void 0:re.x,D=(pe=F.arrow)==null?void 0:pe.y,te=((ce=F.arrow)==null?void 0:ce.centerOffset)!==0,[Q,ne]=_.useState();return zr(()=>{C&&ne(window.getComputedStyle(C).zIndex)},[C]),m.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:q?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[(ge=F.transformOrigin)==null?void 0:ge.x,(ue=F.transformOrigin)==null?void 0:ue.y].join(" "),...((ke=F.hide)==null?void 0:ke.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(Jq,{scope:n,placedSide:Y,onArrowChange:A,arrowX:X,arrowY:D,shouldHideArrow:te,children:m.jsx(Kt.div,{"data-side":Y,"data-align":I,...x,ref:E,style:{...x.style,animation:q?void 0:"none"}})})})});XO.displayName=Jw;var QO="PopperArrow",tK={top:"bottom",right:"left",bottom:"top",left:"right"},ZO=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=eK(QO,r),o=tK[s.placedSide];return m.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:m.jsx(Xq,{...i,ref:n,style:{...i.style,display:"block"}})})});ZO.displayName=QO;function nK(e){return e!==null}var rK=e=>({name:"transformOrigin",options:e,fn(t){var w,C,R;const{placement:n,rects:r,middlewareData:i}=t,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,l=o?0:e.arrowWidth,u=o?0:e.arrowHeight,[d,f]=JO(n),h={start:"0%",center:"50%",end:"100%"}[f],g=(((C=i.arrow)==null?void 0:C.x)??0)+l/2,b=(((R=i.arrow)==null?void 0:R.y)??0)+u/2;let y="",x="";return d==="bottom"?(y=o?h:`${g}px`,x=`${-u}px`):d==="top"?(y=o?h:`${g}px`,x=`${r.floating.height+u}px`):d==="right"?(y=`${-u}px`,x=o?h:`${b}px`):d==="left"&&(y=`${r.floating.width+u}px`,x=o?h:`${b}px`),{data:{x:y,y:x}}}});function JO(e){const[t,n="center"]=e.split("-");return[t,n]}var g0=qO,qf=YO,v0=XO,b0=ZO,e5=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),iK="VisuallyHidden",t5=_.forwardRef((e,t)=>m.jsx(Kt.span,{...e,ref:t,style:{...e5,...e.style}}));t5.displayName=iK;var sK=t5,[_0]=qo("Tooltip",[il]),y0=il(),n5="TooltipProvider",oK=700,yS="tooltip.open",[aK,eC]=_0(n5),r5=e=>{const{__scopeTooltip:t,delayDuration:n=oK,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=_.useRef(!0),l=_.useRef(!1),u=_.useRef(0);return _.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),m.jsx(aK,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(u.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:_.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:s})};r5.displayName=n5;var hf="Tooltip",[lK,Kf]=_0(hf),i5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,u=eC(hf,e.__scopeTooltip),d=y0(t),[f,h]=_.useState(null),g=zo(),b=_.useRef(0),y=o??u.disableHoverableContent,x=l??u.delayDuration,w=_.useRef(!1),[C,R]=Gu({prop:r,defaultProp:i??!1,onChange:L=>{L?(u.onOpen(),document.dispatchEvent(new CustomEvent(yS))):u.onClose(),s==null||s(L)},caller:hf}),E=_.useMemo(()=>C?w.current?"delayed-open":"instant-open":"closed",[C]),T=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,w.current=!1,R(!0)},[R]),A=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,R(!1)},[R]),N=_.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{w.current=!0,R(!0),b.current=0},x)},[x,R]);return _.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),m.jsx(g0,{...d,children:m.jsx(lK,{scope:t,contentId:g,open:C,stateAttribute:E,trigger:f,onTriggerChange:h,onTriggerEnter:_.useCallback(()=>{u.isOpenDelayedRef.current?N():T()},[u.isOpenDelayedRef,N,T]),onTriggerLeave:_.useCallback(()=>{y?A():(window.clearTimeout(b.current),b.current=0)},[A,y]),onOpen:T,onClose:A,disableHoverableContent:y,children:n})})};i5.displayName=hf;var xS="TooltipTrigger",s5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Kf(xS,n),s=eC(xS,n),o=y0(n),l=_.useRef(null),u=an(t,l,i.onTriggerChange),d=_.useRef(!1),f=_.useRef(!1),h=_.useCallback(()=>d.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),m.jsx(qf,{asChild:!0,...o,children:m.jsx(Kt.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:u,onPointerMove:Ve(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ve(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Ve(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Ve(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:Ve(e.onBlur,i.onClose),onClick:Ve(e.onClick,i.onClose)})})});s5.displayName=xS;var tC="TooltipPortal",[cK,uK]=_0(tC,{forceMount:void 0}),o5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=Kf(tC,t);return m.jsx(cK,{scope:t,forceMount:n,children:m.jsx(ps,{present:n||s.open,children:m.jsx(dd,{asChild:!0,container:i,children:r})})})};o5.displayName=tC;var Ku="TooltipContent",a5=_.forwardRef((e,t)=>{const n=uK(Ku,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=Kf(Ku,e.__scopeTooltip);return m.jsx(ps,{present:r||o.open,children:o.disableHoverableContent?m.jsx(l5,{side:i,...s,ref:t}):m.jsx(dK,{side:i,...s,ref:t})})}),dK=_.forwardRef((e,t)=>{const n=Kf(Ku,e.__scopeTooltip),r=eC(Ku,e.__scopeTooltip),i=_.useRef(null),s=an(t,i),[o,l]=_.useState(null),{trigger:u,onClose:d}=n,f=i.current,{onPointerInTransitChange:h}=r,g=_.useCallback(()=>{l(null),h(!1)},[h]),b=_.useCallback((y,x)=>{const w=y.currentTarget,C={x:y.clientX,y:y.clientY},R=gK(C,w.getBoundingClientRect()),E=vK(C,R),T=bK(x.getBoundingClientRect()),A=yK([...E,...T]);l(A),h(!0)},[h]);return _.useEffect(()=>()=>g(),[g]),_.useEffect(()=>{if(u&&f){const y=w=>b(w,f),x=w=>b(w,u);return u.addEventListener("pointerleave",y),f.addEventListener("pointerleave",x),()=>{u.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",x)}}},[u,f,b,g]),_.useEffect(()=>{if(o){const y=x=>{const w=x.target,C={x:x.clientX,y:x.clientY},R=(u==null?void 0:u.contains(w))||(f==null?void 0:f.contains(w)),E=!_K(C,o);R?g():E&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[u,f,o,d,g]),m.jsx(l5,{...e,ref:s})}),[hK,fK]=_0(hf,{isInside:!1}),pK=hW("TooltipContent"),l5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,u=Kf(Ku,n),d=y0(n),{onClose:f}=u;return _.useEffect(()=>(document.addEventListener(yS,f),()=>document.removeEventListener(yS,f)),[f]),_.useEffect(()=>{if(u.trigger){const h=g=>{const b=g.target;b!=null&&b.contains(u.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,f]),m.jsx(ud,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(v0,{"data-state":u.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[m.jsx(pK,{children:r}),m.jsx(hK,{scope:n,isInside:!0,children:m.jsx(sK,{id:u.contentId,role:"tooltip",children:i||r})})]})})});a5.displayName=Ku;var c5="TooltipArrow",mK=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=y0(n);return fK(c5,n).isInside?null:m.jsx(b0,{...i,...r,ref:t})});mK.displayName=c5;function gK(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function vK(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function bK(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function _K(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],u=t[o],d=l.x,f=l.y,h=u.x,g=u.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function yK(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),xK(t)}function xK(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var SK=r5,u5=i5,d5=s5,h5=o5,nC=a5;function f5({className:e,...t}){return m.jsx("kbd",{className:xe("pointer-events-none inline-flex h-5 min-w-5 items-center justify-center rounded border border-border/60 bg-muted/50 px-1.5 font-mono text-[11px] font-medium text-current select-none",e),...t})}function wK({className:e,...t}){return m.jsx("span",{className:xe("inline-flex items-center gap-0.5",e),...t})}const CK="z-50 overflow-hidden rounded-md border border-border backdrop-blur-md p-0.5 text-[11px] font-medium text-card-foreground shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",kK=SK,Za=u5,Ja=d5,Uo=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(h5,{children:m.jsx(nC,{ref:r,sideOffset:t,className:xe("z-50 overflow-hidden rounded-md bg-card text-card-foreground border border-border px-3 py-1.5 text-xs animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Uo.displayName=nC.displayName;const Oh=u5,jh=d5;function p5(e){return e.toUpperCase()}function EK(e){const t=e.split("+");return m.jsx(wK,{children:t.map((n,r)=>m.jsx(f5,{children:p5(n)},`${n}-${r}`))})}const Tu=_.forwardRef(({className:e,sideOffset:t=4,children:n,shortcut:r,...i},s)=>{const o=r===void 0?null:Array.isArray(r)?r[0]??null:r;return m.jsx(h5,{children:m.jsx(nC,{ref:s,sideOffset:t,className:xe(CK,e),...i,children:o?EK(o):m.jsx("span",{children:typeof n=="string"?p5(n):n})})})});Tu.displayName="HotkeyTooltipContent";const RK="0.34.1",TK={version:RK},Gn="Kanna",WA="kanna",AK=".kanna",NK=".kanna-dev",MK="KANNA_RUNTIME_PROFILE",rC=`kanna/${TK.version}`,LK="[kanna]",DK=`~/${Gn}`;function x0(){var t;return(t=globalThis.process)==null?void 0:t.env}function IK(e=x0()){var t;return((t=e==null?void 0:e[MK])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function PK(e=x0()){return IK(e)==="dev"?NK:AK}function OK(e=x0()){return`~/${PK(e)}`}function jK(e=x0()){return`${OK(e)}/keybindings.json`}function Pm(e){return e?`${WA} ${e}`:WA}const GA=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const g=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(b=>b(t,g))}},i=()=>t,l={setState:r,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d))},u=t=e(r,i,l);return l},zK=(e=>e?GA(e):GA),BK=e=>e;function FK(e,t=BK){const n=vn.useSyncExternalStore(e.subscribe,vn.useCallback(()=>t(e.getState()),[e,t]),vn.useCallback(()=>t(e.getInitialState()),[e,t]));return vn.useDebugValue(n),n}const HK=e=>{const t=zK(e),n=r=>FK(t,r);return Object.assign(n,t),n},gc=(e=>HK);function $K(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var s;const o=u=>u===null?null:JSON.parse(u,void 0),l=(s=n.getItem(i))!=null?s:null;return l instanceof Promise?l.then(o):o(l)},setItem:(i,s)=>n.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>n.removeItem(i)}}const SS=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return SS(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return SS(r)(n)}}}},UK=(e,t)=>(n,r,i)=>{let s={storage:$K(()=>window.localStorage),partialize:w=>w,version:0,merge:(w,C)=>({...C,...w}),...t},o=!1,l=0;const u=new Set,d=new Set;let f=s.storage;if(!f)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...w)},r,i);const h=()=>{const w=s.partialize({...r()});return f.setItem(s.name,{state:w,version:s.version})},g=i.setState;i.setState=(w,C)=>(g(w,C),h());const b=e((...w)=>(n(...w),h()),r,i);i.getInitialState=()=>b;let y;const x=()=>{var w,C;if(!f)return;const R=++l;o=!1,u.forEach(T=>{var A;return T((A=r())!=null?A:b)});const E=((C=s.onRehydrateStorage)==null?void 0:C.call(s,(w=r())!=null?w:b))||void 0;return SS(f.getItem.bind(f))(s.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==s.version){if(s.migrate){const A=s.migrate(T.state,T.version);return A instanceof Promise?A.then(N=>[!0,N]):[!0,A]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var A;if(R!==l)return;const[N,L]=T;if(y=s.merge(L,(A=r())!=null?A:b),n(y,!0),N)return h()}).then(()=>{R===l&&(E==null||E(y,void 0),y=r(),o=!0,d.forEach(T=>T(y)))}).catch(T=>{R===l&&(E==null||E(void 0,T))})};return i.persist={setOptions:w=>{s={...s,...w},w.storage&&(f=w.storage)},clearStorage:()=>{f==null||f.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>x(),hasHydrated:()=>o,onHydrate:w=>(u.add(w),()=>{u.delete(w)}),onFinishHydration:w=>(d.add(w),()=>{d.delete(w)})},s.skipHydration||x(),y||b},vc=UK,m5="always",g5="funk",VK=[{value:"blow",label:"Blow"},{value:"bottle",label:"Bottle"},{value:"frog",label:"Frog"},{value:"funk",label:"Funk"},{value:"glass",label:"Glass"},{value:"ping",label:"Ping"},{value:"pop",label:"Pop"},{value:"purr",label:"Purr"},{value:"tink",label:"Tink"}];function qA(e){switch(e){case"never":case"unfocused":case"always":return e;default:return m5}}function KA(e){switch(e){case"blow":case"bottle":case"frog":case"funk":case"glass":case"ping":case"pop":case"purr":case"tink":return e;default:return g5}}const Au=gc()(vc(e=>({chatSoundPreference:m5,chatSoundId:g5,setChatSoundPreference:t=>e({chatSoundPreference:qA(t)}),setChatSoundId:t=>e({chatSoundId:KA(t)})}),{name:"chat-sound-preferences",version:2,migrate:e=>{const t=e;return{chatSoundPreference:qA(t==null?void 0:t.chatSoundPreference),chatSoundId:KA(t==null?void 0:t.chatSoundId)}}})),WK={blow:"/chat-sounds/Blow.mp3",bottle:"/chat-sounds/Bottle.mp3",frog:"/chat-sounds/Frog.mp3",funk:"/chat-sounds/Funk.mp3",glass:"/chat-sounds/Glass.mp3",ping:"/chat-sounds/Ping.mp3",pop:"/chat-sounds/Pop.mp3",purr:"/chat-sounds/Purr.mp3",tink:"/chat-sounds/Tink.mp3"};function GK(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function qK(e){const t=new Audio(WK[e]);return t.preload="auto",t.play()}async function wS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{qK(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function KK(e,t=document){return e==="never"?!1:e==="always"?!0:GK(t)}function YK(e){return e.projectGroups.reduce((t,n)=>t+n.chats.reduce((r,i)=>r+(i.unread?1:0)+(i.status==="waiting_for_user"?1:0),0),0)}function YA(e){let t=0;const n=new Set;for(const r of e.projectGroups)for(const i of r.chats)i.unread&&(t+=1),i.status==="waiting_for_user"&&n.add(i.chatId);return{unreadCount:t,waitingChatIds:n}}function XK(e,t){if(!e)return 0;const n=YA(e),r=YA(t),i=Math.max(0,r.unreadCount-n.unreadCount);let s=0;for(const o of r.waitingChatIds)n.waitingChatIds.has(o)||(s+=1);return i+s}const pd=({children:e,className:t,shimmerWidth:n=100,animate:r=!0,...i})=>m.jsx("span",{style:{"--shiny-width":`${Math.min(n,100)}px`},className:xe("mx-auto max-w-md text-foreground/50",r?["animate-shiny-text [background-size:var(--shiny-width)_100%] bg-clip-text [background-position:0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-gradient-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80"]:["text-neutral"],t),...i,children:e});function CS(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const QK=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function ZK(e){const t=e.trim();for(const n of QK){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function v5(e){return e.split("/").pop()||e}const JK=1440*6e4;function eY(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=JK,o=7*s;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<s?`${Math.floor(n/i)}h`:n<o?`${Math.floor(n/s)}d`:`${Math.floor(n/o)}w`}function tY(e){return e.lastMessageAt??e._creationTime}const nY=new Set(["starting","running"]);function rY({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onForkChat:o,onDeleteChat:l}){const u=eY(tY(e),n),d=i&&r?r:u,f=i&&!!r,h=rW(e.chatId);return m.jsxs("div",{"data-chat-id":h,className:xe("group flex items-center gap-2 pl-2.5 pr-0.5 py-0.5 rounded-lg cursor-pointer border-border/0 hover:border-border hover:bg-muted/20 active:scale-[0.985] border transition-all",t===h?"bg-muted hover:bg-muted border-border":"border-border/0 dark:hover:border-slate-400/10 "),onClick:()=>s(e.chatId),children:[nY.has(e.status)?m.jsx(Rn,{className:"size-3.5 flex-shrink-0 animate-spin text-muted-foreground"}):e.status==="waiting_for_user"?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-blue-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-blue-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):e.unread?m.jsx("div",{className:"relative ",children:m.jsxs("div",{className:" rounded-full z-0 size-3.5 flex items-center justify-center ",children:[m.jsx("div",{className:"absolute rounded-full z-0 size-2.5 bg-emerald-400/80 animate-ping"}),m.jsx("div",{className:" rounded-full z-0 size-2.5 bg-emerald-400 ring-2 ring-muted/20 dark:ring-muted/50"})]})}):null,m.jsx("span",{className:"text-sm truncate flex-1 translate-y-[-0.5px]",children:e.status!=="idle"&&e.status!=="waiting_for_user"?m.jsx(pd,{animate:e.status==="running",shimmerWidth:Math.max(20,e.title.length*3),children:e.title}):e.status!=="idle"||t===h||e.unread?m.jsx("span",{className:"",children:e.title}):m.jsx("span",{className:"text-slate-500 dark:text-slate-400",children:e.title})}),m.jsxs("div",{className:xe("relative h-7 mr-[2px] shrink-0",e.canFork?"w-12":"w-6"),children:[d?f?m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-0.5 text-[11px] text-foreground transition-opacity group-hover:opacity-0",children:m.jsx(f5,{className:"h-4 min-w-4 rounded-sm border-border/50 bg-transparent px-1 text-[10px]",children:r})}):m.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] text-muted-foreground opacity-50 transition-opacity group-hover:opacity-0",children:d}):null,m.jsxs("div",{className:xe("absolute inset-0 flex items-center justify-end gap-0 opacity-100",d?"md:opacity-0 md:group-hover:opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100"),children:[e.canFork?m.jsx(st,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:g=>{g.stopPropagation(),o(e.chatId)},title:"Fork chat",children:m.jsx(YU,{className:"size-3.5"})}):null,m.jsx(st,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:g=>{g.stopPropagation(),l(e.chatId)},title:"Delete chat",children:m.jsx(g$,{className:"size-3.5"})})]})]})]},e._id)}const iY=_.memo(rY);function sY(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const S0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function md(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function iC(e){return"nodeType"in e}function mi(e){var t,n;return e?md(e)?e:iC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function sC(e){const{Document:t}=mi(e);return e instanceof t}function Yf(e){return md(e)?!1:e instanceof mi(e).HTMLElement}function b5(e){return e instanceof mi(e).SVGElement}function gd(e){return e?md(e)?e.document:iC(e)?sC(e)?e:Yf(e)||b5(e)?e.ownerDocument:document:document:document}const io=S0?_.useLayoutEffect:_.useEffect;function oC(e){const t=_.useRef(e);return io(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function oY(){const e=_.useRef(null),t=_.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ff(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return io(()=>{n.current!==e&&(n.current=e)},t),n}function Xf(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function cv(e){const t=oC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function kS(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let Iy={};function Qf(e,t){return _.useMemo(()=>{if(t)return t;const n=Iy[e]==null?0:Iy[e]+1;return Iy[e]=n,e+"-"+n},[e,t])}function _5(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const l=Object.entries(o);for(const[u,d]of l){const f=s[u];f!=null&&(s[u]=f+e*d)}return s},{...t})}}const ju=_5(1),uv=_5(-1);function aY(e){return"clientX"in e&&"clientY"in e}function aC(e){if(!e)return!1;const{KeyboardEvent:t}=mi(e.target);return t&&e instanceof t}function lY(e){if(!e)return!1;const{TouchEvent:t}=mi(e.target);return t&&e instanceof t}function ES(e){if(lY(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return aY(e)?{x:e.clientX,y:e.clientY}:null}const pf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[pf.Translate.toString(e),pf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),XA="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function cY(e){return e.matches(XA)?e:e.querySelector(XA)}const uY={display:"none"};function dY(e){let{id:t,value:n}=e;return vn.createElement("div",{id:t,style:uY},n)}function hY(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return vn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function fY(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const y5=_.createContext(null);function pY(e){const t=_.useContext(y5);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function mY(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:i,event:s}=r;e.forEach(o=>{var l;return(l=o[i])==null?void 0:l.call(o,s)})},[e]),t]}const gY={draggable:`
|
|
631
631
|
To pick up a draggable item, press the space bar.
|
|
632
632
|
While dragging, use the arrow keys to move the item.
|
|
633
633
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
634
|
-
`},vY={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function bY(e){let{announcements:t=vY,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=gY}=e;const{announce:s,announcement:o}=fY(),l=Qf("DndLiveRegion"),[u,d]=_.useState(!1);if(_.useEffect(()=>{d(!0)},[]),pY(_.useMemo(()=>({onDragStart(h){let{active:g}=h;s(t.onDragStart({active:g}))},onDragMove(h){let{active:g,over:b}=h;t.onDragMove&&s(t.onDragMove({active:g,over:b}))},onDragOver(h){let{active:g,over:b}=h;s(t.onDragOver({active:g,over:b}))},onDragEnd(h){let{active:g,over:b}=h;s(t.onDragEnd({active:g,over:b}))},onDragCancel(h){let{active:g,over:b}=h;s(t.onDragCancel({active:g,over:b}))}}),[s,t])),!u)return null;const f=vn.createElement(vn.Fragment,null,vn.createElement(dY,{id:r,value:i.draggable}),vn.createElement(hY,{id:l,announcement:o}));return n?os.createPortal(f,n):f}var lr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(lr||(lr={}));function dv(){}function QA(e,t){return _.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function _Y(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Ms=Object.freeze({x:0,y:0});function yY(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function xY(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function SY(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function wY(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function ZA(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const JA=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=ZA(t,t.left,t.top),s=[];for(const o of r){const{id:l}=o,u=n.get(l);if(u){const d=yY(ZA(u),i);s.push({id:l,data:{droppableContainer:o,value:d}})}}return s.sort(xY)};function CY(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),o=i-r,l=s-n;if(r<i&&n<s){const u=t.width*t.height,d=e.width*e.height,f=o*l,h=f/(u+d-f);return Number(h.toFixed(4))}return 0}const kY=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const s of r){const{id:o}=s,l=n.get(o);if(l){const u=CY(l,t);u>0&&i.push({id:o,data:{droppableContainer:s,value:u}})}}return i.sort(SY)};function EY(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function x5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ms}function RY(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return i.reduce((o,l)=>({...o,top:o.top+e*l.y,bottom:o.bottom+e*l.y,left:o.left+e*l.x,right:o.right+e*l.x}),{...n})}}const TY=RY(1);function AY(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function NY(e,t,n){const r=AY(t);if(!r)return e;const{scaleX:i,scaleY:s,x:o,y:l}=r,u=e.left-o-(1-i)*parseFloat(n),d=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),f=i?e.width/i:e.width,h=s?e.height/s:e.height;return{width:f,height:h,top:d,right:u+f,bottom:d+h,left:u}}const MY={ignoreTransform:!1};function vd(e,t){t===void 0&&(t=MY);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:f}=mi(e).getComputedStyle(e);d&&(n=NY(n,d,f))}const{top:r,left:i,width:s,height:o,bottom:l,right:u}=n;return{top:r,left:i,width:s,height:o,bottom:l,right:u}}function eN(e){return vd(e,{ignoreTransform:!0})}function LY(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function DY(e,t){return t===void 0&&(t=mi(e).getComputedStyle(e)),t.position==="fixed"}function IY(e,t){t===void 0&&(t=mi(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const s=t[i];return typeof s=="string"?n.test(s):!1})}function lC(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(sC(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Yf(i)||b5(i)||n.includes(i))return n;const s=mi(e).getComputedStyle(i);return i!==e&&IY(i,s)&&n.push(i),DY(i,s)?n:r(i.parentNode)}return e?r(e):n}function S5(e){const[t]=lC(e,1);return t??null}function Py(e){return!S0||!e?null:md(e)?e:iC(e)?sC(e)||e===gd(e).scrollingElement?window:Yf(e)?e:null:null}function w5(e){return md(e)?e.scrollX:e.scrollLeft}function C5(e){return md(e)?e.scrollY:e.scrollTop}function RS(e){return{x:w5(e),y:C5(e)}}var pr;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(pr||(pr={}));function k5(e){return!S0||!e?!1:e===document.scrollingElement}function E5(e){const t={x:0,y:0},n=k5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,o=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:i,isLeft:s,isBottom:o,isRight:l,maxScroll:r,minScroll:t}}const PY={x:.2,y:.2};function OY(e,t,n,r,i){let{top:s,left:o,right:l,bottom:u}=n;r===void 0&&(r=10),i===void 0&&(i=PY);const{isTop:d,isBottom:f,isLeft:h,isRight:g}=E5(e),b={x:0,y:0},y={x:0,y:0},x={height:t.height*i.y,width:t.width*i.x};return!d&&s<=t.top+x.height?(b.y=pr.Backward,y.y=r*Math.abs((t.top+x.height-s)/x.height)):!f&&u>=t.bottom-x.height&&(b.y=pr.Forward,y.y=r*Math.abs((t.bottom-x.height-u)/x.height)),!g&&l>=t.right-x.width?(b.x=pr.Forward,y.x=r*Math.abs((t.right-x.width-l)/x.width)):!h&&o<=t.left+x.width&&(b.x=pr.Backward,y.x=r*Math.abs((t.left+x.width-o)/x.width)),{direction:b,speed:y}}function jY(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:o}=window;return{top:0,left:0,right:s,bottom:o,width:s,height:o}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function R5(e){return e.reduce((t,n)=>ju(t,RS(n)),Ms)}function zY(e){return e.reduce((t,n)=>t+w5(n),0)}function BY(e){return e.reduce((t,n)=>t+C5(n),0)}function FY(e,t){if(t===void 0&&(t=vd),!e)return;const{top:n,left:r,bottom:i,right:s}=t(e);S5(e)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const HY=[["x",["left","right"],zY],["y",["top","bottom"],BY]];class cC{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=lC(n),i=R5(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,o,l]of HY)for(const u of o)Object.defineProperty(this,u,{get:()=>{const d=l(r),f=i[s]-d;return this.rect[u]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Xh{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function $Y(e){const{EventTarget:t}=mi(e);return e instanceof t?e:gd(e)}function Oy(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ts;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ts||(ts={}));function tN(e){e.preventDefault()}function UY(e){e.stopPropagation()}var on;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(on||(on={}));const T5={start:[on.Space,on.Enter],cancel:[on.Esc],end:[on.Space,on.Enter,on.Tab]},VY=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case on.Right:return{...n,x:n.x+25};case on.Left:return{...n,x:n.x-25};case on.Down:return{...n,y:n.y+25};case on.Up:return{...n,y:n.y-25}}};class uC{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Xh(gd(n)),this.windowListeners=new Xh(mi(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ts.Resize,this.handleCancel),this.windowListeners.add(ts.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ts.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&FY(r),n(Ms)}handleKeyDown(t){if(aC(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=T5,coordinateGetter:o=VY,scrollBehavior:l="smooth"}=i,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,f=d?{x:d.left,y:d.top}:Ms;this.referenceCoordinates||(this.referenceCoordinates=f);const h=o(t,{active:n,context:r.current,currentCoordinates:f});if(h){const g=uv(h,f),b={x:0,y:0},{scrollableAncestors:y}=r.current;for(const x of y){const w=t.code,{isTop:C,isRight:R,isLeft:E,isBottom:T,maxScroll:A,minScroll:N}=E5(x),L=jY(x),P={x:Math.min(w===on.Right?L.right-L.width/2:L.right,Math.max(w===on.Right?L.left:L.left+L.width/2,h.x)),y:Math.min(w===on.Down?L.bottom-L.height/2:L.bottom,Math.max(w===on.Down?L.top:L.top+L.height/2,h.y))},G=w===on.Right&&!R||w===on.Left&&!E,O=w===on.Down&&!T||w===on.Up&&!C;if(G&&P.x!==h.x){const B=x.scrollLeft+g.x,H=w===on.Right&&B<=A.x||w===on.Left&&B>=N.x;if(H&&!g.y){x.scrollTo({left:B,behavior:l});return}H?b.x=x.scrollLeft-B:b.x=w===on.Right?x.scrollLeft-A.x:x.scrollLeft-N.x,b.x&&x.scrollBy({left:-b.x,behavior:l});break}else if(O&&P.y!==h.y){const B=x.scrollTop+g.y,H=w===on.Down&&B<=A.y||w===on.Up&&B>=N.y;if(H&&!g.x){x.scrollTo({top:B,behavior:l});return}H?b.y=x.scrollTop-B:b.y=w===on.Down?x.scrollTop-A.y:x.scrollTop-N.y,b.y&&x.scrollBy({top:-b.y,behavior:l});break}}this.handleMove(t,ju(uv(h,this.referenceCoordinates),b))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}uC.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=T5,onActivation:i}=t,{active:s}=n;const{code:o}=e.nativeEvent;if(r.start.includes(o)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function nN(e){return!!(e&&"distance"in e)}function rN(e){return!!(e&&"delay"in e)}class dC{constructor(t,n,r){var i;r===void 0&&(r=$Y(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:o}=s;this.props=t,this.events=n,this.document=gd(o),this.documentListeners=new Xh(this.document),this.listeners=new Xh(r),this.windowListeners=new Xh(mi(o)),this.initialCoordinates=(i=ES(s))!=null?i:Ms,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ts.Resize,this.handleCancel),this.windowListeners.add(ts.DragStart,tN),this.windowListeners.add(ts.VisibilityChange,this.handleCancel),this.windowListeners.add(ts.ContextMenu,tN),this.documentListeners.add(ts.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(rN(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(nN(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ts.Click,UY,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ts.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:s}=this,{onMove:o,options:{activationConstraint:l}}=s;if(!i)return;const u=(n=ES(t))!=null?n:Ms,d=uv(i,u);if(!r&&l){if(nN(l)){if(l.tolerance!=null&&Oy(d,l.tolerance))return this.handleCancel();if(Oy(d,l.distance))return this.handleStart()}if(rN(l)&&Oy(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),o(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===on.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const WY={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class hC extends dC{constructor(t){const{event:n}=t,r=gd(n.target);super(t,WY,r)}}hC.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const GY={move:{name:"mousemove"},end:{name:"mouseup"}};var TS;(function(e){e[e.RightClick=2]="RightClick"})(TS||(TS={}));class qY extends dC{constructor(t){super(t,GY,gd(t.event.target))}}qY.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===TS.RightClick?!1:(r==null||r({event:n}),!0)}}];const jy={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class KY extends dC{constructor(t){super(t,jy)}static setup(){return window.addEventListener(jy.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(jy.move.name,t)};function t(){}}}KY.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var Qh;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Qh||(Qh={}));var hv;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(hv||(hv={}));function YY(e){let{acceleration:t,activator:n=Qh.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:o=5,order:l=hv.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:f,delta:h,threshold:g}=e;const b=QY({delta:h,disabled:!s}),[y,x]=oY(),w=_.useRef({x:0,y:0}),C=_.useRef({x:0,y:0}),R=_.useMemo(()=>{switch(n){case Qh.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Qh.DraggableRect:return i}},[n,i,u]),E=_.useRef(null),T=_.useCallback(()=>{const N=E.current;if(!N)return;const L=w.current.x*C.current.x,P=w.current.y*C.current.y;N.scrollBy(L,P)},[]),A=_.useMemo(()=>l===hv.TreeOrder?[...d].reverse():d,[l,d]);_.useEffect(()=>{if(!s||!d.length||!R){x();return}for(const N of A){if((r==null?void 0:r(N))===!1)continue;const L=d.indexOf(N),P=f[L];if(!P)continue;const{direction:G,speed:O}=OY(N,P,R,t,g);for(const B of["x","y"])b[B][G[B]]||(O[B]=0,G[B]=0);if(O.x>0||O.y>0){x(),E.current=N,y(T,o),w.current=O,C.current=G;return}}w.current={x:0,y:0},C.current={x:0,y:0},x()},[t,T,r,x,s,o,JSON.stringify(R),JSON.stringify(b),y,d,A,f,JSON.stringify(g)])}const XY={x:{[pr.Backward]:!1,[pr.Forward]:!1},y:{[pr.Backward]:!1,[pr.Forward]:!1}};function QY(e){let{delta:t,disabled:n}=e;const r=kS(t);return Xf(i=>{if(n||!r||!i)return XY;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[pr.Backward]:i.x[pr.Backward]||s.x===-1,[pr.Forward]:i.x[pr.Forward]||s.x===1},y:{[pr.Backward]:i.y[pr.Backward]||s.y===-1,[pr.Forward]:i.y[pr.Forward]||s.y===1}}},[n,t,r])}function ZY(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Xf(i=>{var s;return t==null?null:(s=r??i)!=null?s:null},[r,t])}function JY(e,t){return _.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,s=i.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,r)}));return[...n,...s]},[]),[e,t])}var mf;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(mf||(mf={}));var AS;(function(e){e.Optimized="optimized"})(AS||(AS={}));const iN=new Map;function eX(e,t){let{dragging:n,dependencies:r,config:i}=t;const[s,o]=_.useState(null),{frequency:l,measure:u,strategy:d}=i,f=_.useRef(e),h=w(),g=ff(h),b=_.useCallback(function(C){C===void 0&&(C=[]),!g.current&&o(R=>R===null?C:R.concat(C.filter(E=>!R.includes(E))))},[g]),y=_.useRef(null),x=Xf(C=>{if(h&&!n)return iN;if(!C||C===iN||f.current!==e||s!=null){const R=new Map;for(let E of e){if(!E)continue;if(s&&s.length>0&&!s.includes(E.id)&&E.rect.current){R.set(E.id,E.rect.current);continue}const T=E.node.current,A=T?new cC(u(T),T):null;E.rect.current=A,A&&R.set(E.id,A)}return R}return C},[e,s,n,h,u]);return _.useEffect(()=>{f.current=e},[e]),_.useEffect(()=>{h||b()},[n,h]),_.useEffect(()=>{s&&s.length>0&&o(null)},[JSON.stringify(s)]),_.useEffect(()=>{h||typeof l!="number"||y.current!==null||(y.current=setTimeout(()=>{b(),y.current=null},l))},[l,h,b,...r]),{droppableRects:x,measureDroppableContainers:b,measuringScheduled:s!=null};function w(){switch(d){case mf.Always:return!1;case mf.BeforeDragging:return n;default:return!n}}}function A5(e,t){return Xf(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function tX(e,t){return A5(e,t)}function nX(e){let{callback:t,disabled:n}=e;const r=oC(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return _.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function w0(e){let{callback:t,disabled:n}=e;const r=oC(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return _.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function rX(e){return new cC(vd(e),e)}function sN(e,t,n){t===void 0&&(t=rX);const[r,i]=_.useState(null);function s(){i(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const f=t(e);return JSON.stringify(u)===JSON.stringify(f)?u:f})}const o=nX({callback(u){if(e)for(const d of u){const{type:f,target:h}=d;if(f==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),l=w0({callback:s});return io(()=>{s(),e?(l==null||l.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),o==null||o.disconnect())},[e]),r}function iX(e){const t=A5(e);return x5(e,t)}const oN=[];function sX(e){const t=_.useRef(e),n=Xf(r=>e?r&&r!==oN&&e&&t.current&&e.parentNode===t.current.parentNode?r:lC(e):oN,[e]);return _.useEffect(()=>{t.current=e},[e]),n}function oX(e){const[t,n]=_.useState(null),r=_.useRef(e),i=_.useCallback(s=>{const o=Py(s.target);o&&n(l=>l?(l.set(o,RS(o)),new Map(l)):null)},[]);return _.useEffect(()=>{const s=r.current;if(e!==s){o(s);const l=e.map(u=>{const d=Py(u);return d?(d.addEventListener("scroll",i,{passive:!0}),[d,RS(d)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{o(e),o(s)};function o(l){l.forEach(u=>{const d=Py(u);d==null||d.removeEventListener("scroll",i)})}},[i,e]),_.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,o)=>ju(s,o),Ms):R5(e):Ms,[e,t])}function aN(e,t){t===void 0&&(t=[]);const n=_.useRef(null);return _.useEffect(()=>{n.current=null},t),_.useEffect(()=>{const r=e!==Ms;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?uv(e,n.current):Ms}function aX(e){_.useEffect(()=>{if(!S0)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function lX(e,t){return _.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=o=>{s(o,t)},n},{}),[e,t])}function N5(e){return _.useMemo(()=>e?LY(e):null,[e])}const lN=[];function cX(e,t){t===void 0&&(t=vd);const[n]=e,r=N5(n?mi(n):null),[i,s]=_.useState(lN);function o(){s(()=>e.length?e.map(u=>k5(u)?r:new cC(t(u),u)):lN)}const l=w0({callback:o});return io(()=>{l==null||l.disconnect(),o(),e.forEach(u=>l==null?void 0:l.observe(u))},[e]),i}function uX(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Yf(t)?t:e}function dX(e){let{measure:t}=e;const[n,r]=_.useState(null),i=_.useCallback(d=>{for(const{target:f}of d)if(Yf(f)){r(h=>{const g=t(f);return h?{...h,width:g.width,height:g.height}:g});break}},[t]),s=w0({callback:i}),o=_.useCallback(d=>{const f=uX(d);s==null||s.disconnect(),f&&(s==null||s.observe(f)),r(f?t(f):null)},[t,s]),[l,u]=cv(o);return _.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const hX=[{sensor:hC,options:{}},{sensor:uC,options:{}}],fX={current:{}},Ng={draggable:{measure:eN},droppable:{measure:eN,strategy:mf.WhileDragging,frequency:AS.Optimized},dragOverlay:{measure:vd}};class Zh extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const pX={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Zh,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:dv},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ng,measureDroppableContainers:dv,windowRect:null,measuringScheduled:!1},mX={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dv,draggableNodes:new Map,over:null,measureDroppableContainers:dv},C0=_.createContext(mX),M5=_.createContext(pX);function gX(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Zh}}}function vX(e,t){switch(t.type){case lr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case lr.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case lr.DragEnd:case lr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case lr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Zh(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case lr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const o=new Zh(e.droppable.containers);return o.set(n,{...s,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case lr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new Zh(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function bX(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=_.useContext(C0),s=kS(r),o=kS(n==null?void 0:n.id);return _.useEffect(()=>{if(!t&&!r&&s&&o!=null){if(!aC(s)||document.activeElement===s.target)return;const l=i.get(o);if(!l)return;const{activatorNode:u,node:d}=l;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[u.current,d.current]){if(!f)continue;const h=cY(f);if(h){h.focus();break}}})}},[r,t,i,o,s]),null}function _X(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,s)=>s({transform:i,...r}),n):n}function yX(e){return _.useMemo(()=>({draggable:{...Ng.draggable,...e==null?void 0:e.draggable},droppable:{...Ng.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Ng.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function xX(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const s=_.useRef(!1),{x:o,y:l}=typeof i=="boolean"?{x:i,y:i}:i;io(()=>{if(!o&&!l||!t){s.current=!1;return}if(s.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const f=n(d),h=x5(f,r);if(o||(h.x=0),l||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=S5(d);g&&g.scrollBy({top:h.y,left:h.x})}},[t,o,l,r,n])}const L5=_.createContext({...Ms,scaleX:1,scaleY:1});var ja;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ja||(ja={}));const SX=_.memo(function(t){var n,r,i,s;let{id:o,accessibility:l,autoScroll:u=!0,children:d,sensors:f=hX,collisionDetection:h=kY,measuring:g,modifiers:b,...y}=t;const x=_.useReducer(vX,void 0,gX),[w,C]=x,[R,E]=mY(),[T,A]=_.useState(ja.Uninitialized),N=T===ja.Initialized,{draggable:{active:L,nodes:P,translate:G},droppable:{containers:O}}=w,B=L!=null?P.get(L):null,H=_.useRef({initial:null,translated:null}),j=_.useMemo(()=>{var at;return L!=null?{id:L,data:(at=B==null?void 0:B.data)!=null?at:fX,rect:H}:null},[L,B]),$=_.useRef(null),[V,z]=_.useState(null),[q,F]=_.useState(null),Y=ff(y,Object.values(y)),I=Qf("DndDescribedBy",o),U=_.useMemo(()=>O.getEnabled(),[O]),X=yX(g),{droppableRects:D,measureDroppableContainers:te,measuringScheduled:Q}=eX(U,{dragging:N,dependencies:[G.x,G.y],config:X.droppable}),ne=ZY(P,L),re=_.useMemo(()=>q?ES(q):null,[q]),pe=Rt(),ce=tX(ne,X.draggable.measure);xX({activeNode:L!=null?P.get(L):null,config:pe.layoutShiftCompensation,initialRect:ce,measure:X.draggable.measure});const ge=sN(ne,X.draggable.measure,ce),ue=sN(ne?ne.parentElement:null),ke=_.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:D,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ae=O.getNodeFor((n=ke.current.over)==null?void 0:n.id),ze=dX({measure:X.dragOverlay.measure}),Ge=(r=ze.nodeRef.current)!=null?r:ne,Et=N?(i=ze.rect)!=null?i:ge:null,zt=!!(ze.nodeRef.current&&ze.rect),Ct=iX(zt?null:ge),Pe=N5(Ge?mi(Ge):null),nt=sX(N?Ae??ne:null),He=cX(nt),Ze=_X(b,{transform:{x:G.x-Ct.x,y:G.y-Ct.y,scaleX:1,scaleY:1},activatorEvent:q,active:j,activeNodeRect:ge,containerNodeRect:ue,draggingNodeRect:Et,over:ke.current.over,overlayNodeRect:ze.rect,scrollableAncestors:nt,scrollableAncestorRects:He,windowRect:Pe}),pt=re?ju(re,G):null,mt=oX(nt),en=aN(mt),me=aN(mt,[ge]),Se=ju(Ze,en),Be=Et?TY(Et,Ze):null,Le=j&&Be?h({active:j,collisionRect:Be,droppableRects:D,droppableContainers:U,pointerCoordinates:pt}):null,ut=wY(Le,"id"),[Oe,Bt]=_.useState(null),_t=zt?Ze:ju(Ze,me),Pt=EY(_t,(s=Oe==null?void 0:Oe.rect)!=null?s:null,ge),Ft=_.useRef(null),je=_.useCallback((at,tt)=>{let{sensor:Tt,options:gt}=tt;if($.current==null)return;const Ee=P.get($.current);if(!Ee)return;const vt=at.nativeEvent,ln=new Tt({active:$.current,activeNode:Ee,event:vt,options:gt,context:ke,onAbort(rt){if(!P.get(rt))return;const{onDragAbort:it}=Y.current,kt={id:rt};it==null||it(kt),R({type:"onDragAbort",event:kt})},onPending(rt,We,it,kt){if(!P.get(rt))return;const{onDragPending:qe}=Y.current,Ne={id:rt,constraint:We,initialCoordinates:it,offset:kt};qe==null||qe(Ne),R({type:"onDragPending",event:Ne})},onStart(rt){const We=$.current;if(We==null)return;const it=P.get(We);if(!it)return;const{onDragStart:kt}=Y.current,_e={activatorEvent:vt,active:{id:We,data:it.data,rect:H}};os.unstable_batchedUpdates(()=>{kt==null||kt(_e),A(ja.Initializing),C({type:lr.DragStart,initialCoordinates:rt,active:We}),R({type:"onDragStart",event:_e}),z(Ft.current),F(vt)})},onMove(rt){C({type:lr.DragMove,coordinates:rt})},onEnd:Re(lr.DragEnd),onCancel:Re(lr.DragCancel)});Ft.current=ln;function Re(rt){return async function(){const{active:it,collisions:kt,over:_e,scrollAdjustedTranslate:qe}=ke.current;let Ne=null;if(it&&qe){const{cancelDrop:Ot}=Y.current;Ne={activatorEvent:vt,active:it,collisions:kt,delta:qe,over:_e},rt===lr.DragEnd&&typeof Ot=="function"&&await Promise.resolve(Ot(Ne))&&(rt=lr.DragCancel)}$.current=null,os.unstable_batchedUpdates(()=>{C({type:rt}),A(ja.Uninitialized),Bt(null),z(null),F(null),Ft.current=null;const Ot=rt===lr.DragEnd?"onDragEnd":"onDragCancel";if(Ne){const xt=Y.current[Ot];xt==null||xt(Ne),R({type:Ot,event:Ne})}})}}},[P]),yt=_.useCallback((at,tt)=>(Tt,gt)=>{const Ee=Tt.nativeEvent,vt=P.get(gt);if($.current!==null||!vt||Ee.dndKit||Ee.defaultPrevented)return;const ln={active:vt};at(Tt,tt.options,ln)===!0&&(Ee.dndKit={capturedBy:tt.sensor},$.current=gt,je(Tt,tt))},[P,je]),le=JY(f,yt);aX(f),io(()=>{ge&&T===ja.Initializing&&A(ja.Initialized)},[ge,T]),_.useEffect(()=>{const{onDragMove:at}=Y.current,{active:tt,activatorEvent:Tt,collisions:gt,over:Ee}=ke.current;if(!tt||!Tt)return;const vt={active:tt,activatorEvent:Tt,collisions:gt,delta:{x:Se.x,y:Se.y},over:Ee};os.unstable_batchedUpdates(()=>{at==null||at(vt),R({type:"onDragMove",event:vt})})},[Se.x,Se.y]),_.useEffect(()=>{const{active:at,activatorEvent:tt,collisions:Tt,droppableContainers:gt,scrollAdjustedTranslate:Ee}=ke.current;if(!at||$.current==null||!tt||!Ee)return;const{onDragOver:vt}=Y.current,ln=gt.get(ut),Re=ln&&ln.rect.current?{id:ln.id,rect:ln.rect.current,data:ln.data,disabled:ln.disabled}:null,rt={active:at,activatorEvent:tt,collisions:Tt,delta:{x:Ee.x,y:Ee.y},over:Re};os.unstable_batchedUpdates(()=>{Bt(Re),vt==null||vt(rt),R({type:"onDragOver",event:rt})})},[ut]),io(()=>{ke.current={activatorEvent:q,active:j,activeNode:ne,collisionRect:Be,collisions:Le,droppableRects:D,draggableNodes:P,draggingNode:Ge,draggingNodeRect:Et,droppableContainers:O,over:Oe,scrollableAncestors:nt,scrollAdjustedTranslate:Se},H.current={initial:Et,translated:Be}},[j,ne,Le,Be,P,Ge,Et,D,O,Oe,nt,Se]),YY({...pe,delta:G,draggingRect:Be,pointerCoordinates:pt,scrollableAncestors:nt,scrollableAncestorRects:He});const $e=_.useMemo(()=>({active:j,activeNode:ne,activeNodeRect:ge,activatorEvent:q,collisions:Le,containerNodeRect:ue,dragOverlay:ze,draggableNodes:P,droppableContainers:O,droppableRects:D,over:Oe,measureDroppableContainers:te,scrollableAncestors:nt,scrollableAncestorRects:He,measuringConfiguration:X,measuringScheduled:Q,windowRect:Pe}),[j,ne,ge,q,Le,ue,ze,P,O,D,Oe,te,nt,He,X,Q,Pe]),et=_.useMemo(()=>({activatorEvent:q,activators:le,active:j,activeNodeRect:ge,ariaDescribedById:{draggable:I},dispatch:C,draggableNodes:P,over:Oe,measureDroppableContainers:te}),[q,le,j,ge,C,I,P,Oe,te]);return vn.createElement(y5.Provider,{value:E},vn.createElement(C0.Provider,{value:et},vn.createElement(M5.Provider,{value:$e},vn.createElement(L5.Provider,{value:Pt},d)),vn.createElement(bX,{disabled:(l==null?void 0:l.restoreFocus)===!1})),vn.createElement(bY,{...l,hiddenTextDescribedById:I}));function Rt(){const at=(V==null?void 0:V.autoScrollEnabled)===!1,tt=typeof u=="object"?u.enabled===!1:u===!1,Tt=N&&!at&&!tt;return typeof u=="object"?{...u,enabled:Tt}:{enabled:Tt}}}),wX=_.createContext(null),cN="button",CX="Draggable";function kX(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const s=Qf(CX),{activators:o,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:f,draggableNodes:h,over:g}=_.useContext(C0),{role:b=cN,roleDescription:y="draggable",tabIndex:x=0}=i??{},w=(u==null?void 0:u.id)===t,C=_.useContext(w?L5:wX),[R,E]=cv(),[T,A]=cv(),N=lX(o,t),L=ff(n);io(()=>(h.set(t,{id:t,key:s,node:R,activatorNode:T,data:L}),()=>{const G=h.get(t);G&&G.key===s&&h.delete(t)}),[h,t]);const P=_.useMemo(()=>({role:b,tabIndex:x,"aria-disabled":r,"aria-pressed":w&&b===cN?!0:void 0,"aria-roledescription":y,"aria-describedby":f.draggable}),[r,b,x,w,y,f.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:P,isDragging:w,listeners:r?void 0:N,node:R,over:g,setNodeRef:E,setActivatorNodeRef:A,transform:C}}function EX(){return _.useContext(M5)}const RX="Droppable",TX={timeout:25};function AX(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const s=Qf(RX),{active:o,dispatch:l,over:u,measureDroppableContainers:d}=_.useContext(C0),f=_.useRef({disabled:n}),h=_.useRef(!1),g=_.useRef(null),b=_.useRef(null),{disabled:y,updateMeasurementsFor:x,timeout:w}={...TX,...i},C=ff(x??r),R=_.useCallback(()=>{if(!h.current){h.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{d(Array.isArray(C.current)?C.current:[C.current]),b.current=null},w)},[w]),E=w0({callback:R,disabled:y||!o}),T=_.useCallback((P,G)=>{E&&(G&&(E.unobserve(G),h.current=!1),P&&E.observe(P))},[E]),[A,N]=cv(T),L=ff(t);return _.useEffect(()=>{!E||!A.current||(E.disconnect(),h.current=!1,E.observe(A.current))},[A,E]),_.useEffect(()=>(l({type:lr.RegisterDroppable,element:{id:r,key:s,disabled:n,node:A,rect:g,data:L}}),()=>l({type:lr.UnregisterDroppable,key:s,id:r})),[r]),_.useEffect(()=>{n!==f.current.disabled&&(l({type:lr.SetDroppableDisabled,id:r,key:s,disabled:n}),f.current.disabled=n)},[r,s,n,l]),{active:o,rect:g,isOver:(u==null?void 0:u.id)===r,node:A,over:u,setNodeRef:N}}function fC(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function NX(e,t){return e.reduce((n,r,i)=>{const s=t.get(r);return s&&(n[i]=s),n},Array(e.length))}function Om(e){return e!==null&&e>=0}function MX(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function LX(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const D5=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const s=fC(t,r,n),o=t[i],l=s[i];return!l||!o?null:{x:l.left-o.left,y:l.top-o.top,scaleX:l.width/o.width,scaleY:l.height/o.height}},jm={scaleX:1,scaleY:1},DX=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:s,overIndex:o}=e;const l=(t=s[n])!=null?t:r;if(!l)return null;if(i===n){const d=s[o];return d?{x:0,y:n<o?d.top+d.height-(l.top+l.height):d.top-l.top,...jm}:null}const u=IX(s,i,n);return i>n&&i<=o?{x:0,y:-l.height-u,...jm}:i<n&&i>=o?{x:0,y:l.height+u,...jm}:{x:0,y:0,...jm}};function IX(e,t,n){const r=e[t],i=e[t-1],s=e[t+1];return r?n<t?i?r.top-(i.top+i.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const I5="Sortable",P5=vn.createContext({activeIndex:-1,containerId:I5,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:D5,disabled:{draggable:!1,droppable:!1}});function PX(e){let{children:t,id:n,items:r,strategy:i=D5,disabled:s=!1}=e;const{active:o,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:f}=EX(),h=Qf(I5,n),g=l.rect!==null,b=_.useMemo(()=>r.map(N=>typeof N=="object"&&"id"in N?N.id:N),[r]),y=o!=null,x=o?b.indexOf(o.id):-1,w=d?b.indexOf(d.id):-1,C=_.useRef(b),R=!MX(b,C.current),E=w!==-1&&x===-1||R,T=LX(s);io(()=>{R&&y&&f(b)},[R,b,y,f]),_.useEffect(()=>{C.current=b},[b]);const A=_.useMemo(()=>({activeIndex:x,containerId:h,disabled:T,disableTransforms:E,items:b,overIndex:w,useDragOverlay:g,sortedRects:NX(b,u),strategy:i}),[x,h,T.draggable,T.droppable,E,b,w,u,g,i]);return vn.createElement(P5.Provider,{value:A},t)}const OX=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return fC(n,r,i).indexOf(t)},jX=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:s,newIndex:o,previousItems:l,previousContainerId:u,transition:d}=e;return!d||!r||l!==s&&i===o?!1:n?!0:o!==i&&t===u},zX={duration:200,easing:"ease"},O5="transform",BX=pf.Transition.toString({property:O5,duration:0,easing:"linear"}),FX={roleDescription:"sortable"};function HX(e){let{disabled:t,index:n,node:r,rect:i}=e;const[s,o]=_.useState(null),l=_.useRef(n);return io(()=>{if(!t&&n!==l.current&&r.current){const u=i.current;if(u){const d=vd(r.current,{ignoreTransform:!0}),f={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(f.x||f.y)&&o(f)}}n!==l.current&&(l.current=n)},[t,n,r,i]),_.useEffect(()=>{s&&o(null)},[s]),s}function $X(e){let{animateLayoutChanges:t=jX,attributes:n,disabled:r,data:i,getNewIndex:s=OX,id:o,strategy:l,resizeObserverConfig:u,transition:d=zX}=e;const{items:f,containerId:h,activeIndex:g,disabled:b,disableTransforms:y,sortedRects:x,overIndex:w,useDragOverlay:C,strategy:R}=_.useContext(P5),E=UX(r,b),T=f.indexOf(o),A=_.useMemo(()=>({sortable:{containerId:h,index:T,items:f},...i}),[h,i,T,f]),N=_.useMemo(()=>f.slice(f.indexOf(o)),[f,o]),{rect:L,node:P,isOver:G,setNodeRef:O}=AX({id:o,data:A,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...u}}),{active:B,activatorEvent:H,activeNodeRect:j,attributes:$,setNodeRef:V,listeners:z,isDragging:q,over:F,setActivatorNodeRef:Y,transform:I}=kX({id:o,data:A,attributes:{...FX,...n},disabled:E.draggable}),U=sY(O,V),X=!!B,D=X&&!y&&Om(g)&&Om(w),te=!C&&q,Q=te&&D?I:null,re=D?Q??(l??R)({rects:x,activeNodeRect:j,activeIndex:g,overIndex:w,index:T}):null,pe=Om(g)&&Om(w)?s({id:o,items:f,activeIndex:g,overIndex:w}):T,ce=B==null?void 0:B.id,ge=_.useRef({activeId:ce,items:f,newIndex:pe,containerId:h}),ue=f!==ge.current.items,ke=t({active:B,containerId:h,isDragging:q,isSorting:X,id:o,index:T,items:f,newIndex:ge.current.newIndex,previousItems:ge.current.items,previousContainerId:ge.current.containerId,transition:d,wasDragging:ge.current.activeId!=null}),Ae=HX({disabled:!ke,index:T,node:P,rect:L});return _.useEffect(()=>{X&&ge.current.newIndex!==pe&&(ge.current.newIndex=pe),h!==ge.current.containerId&&(ge.current.containerId=h),f!==ge.current.items&&(ge.current.items=f)},[X,pe,h,f]),_.useEffect(()=>{if(ce===ge.current.activeId)return;if(ce!=null&&ge.current.activeId==null){ge.current.activeId=ce;return}const Ge=setTimeout(()=>{ge.current.activeId=ce},50);return()=>clearTimeout(Ge)},[ce]),{active:B,activeIndex:g,attributes:$,data:A,rect:L,index:T,newIndex:pe,items:f,isOver:G,isSorting:X,isDragging:q,listeners:z,node:P,overIndex:w,over:F,setNodeRef:U,setActivatorNodeRef:Y,setDroppableNodeRef:O,setDraggableNodeRef:V,transform:Ae??re,transition:ze()};function ze(){if(Ae||ue&&ge.current.newIndex===T)return BX;if(!(te&&!aC(H)||!d)&&(X||ke))return pf.Transition.toString({...d,property:O5})}}function UX(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}on.Down,on.Right,on.Up,on.Left;function pC(e){const t=e+"CollectionProvider",[n,r]=qo(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=x=>{const{scope:w,children:C}=x,R=vn.useRef(null),E=vn.useRef(new Map).current;return m.jsx(i,{scope:w,itemMap:E,collectionRef:R,children:C})};o.displayName=t;const l=e+"CollectionSlot",u=Ql(l),d=vn.forwardRef((x,w)=>{const{scope:C,children:R}=x,E=s(l,C),T=an(w,E.collectionRef);return m.jsx(u,{ref:T,children:R})});d.displayName=l;const f=e+"CollectionItemSlot",h="data-radix-collection-item",g=Ql(f),b=vn.forwardRef((x,w)=>{const{scope:C,children:R,...E}=x,T=vn.useRef(null),A=an(w,T),N=s(f,C);return vn.useEffect(()=>(N.itemMap.set(T,{ref:T,...E}),()=>void N.itemMap.delete(T))),m.jsx(g,{[h]:"",ref:A,children:R})});b.displayName=f;function y(x){const w=s(e+"CollectionConsumer",x);return vn.useCallback(()=>{const R=w.collectionRef.current;if(!R)return[];const E=Array.from(R.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((N,L)=>E.indexOf(N.ref.current)-E.indexOf(L.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:d,ItemSlot:b},y,r]}var VX=_.createContext(void 0);function mC(e){const t=_.useContext(VX);return e||t||"ltr"}var zy="rovingFocusGroup.onEntryFocus",WX={bubbles:!1,cancelable:!0},Zf="RovingFocusGroup",[NS,j5,GX]=pC(Zf),[qX,z5]=qo(Zf,[GX]),[KX,YX]=qX(Zf),B5=_.forwardRef((e,t)=>m.jsx(NS.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(NS.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(XX,{...e,ref:t})})}));B5.displayName=Zf;var XX=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=e,g=_.useRef(null),b=an(t,g),y=mC(s),[x,w]=Gu({prop:o,defaultProp:l??null,onChange:u,caller:Zf}),[C,R]=_.useState(!1),E=Ts(d),T=j5(n),A=_.useRef(!1),[N,L]=_.useState(0);return _.useEffect(()=>{const P=g.current;if(P)return P.addEventListener(zy,E),()=>P.removeEventListener(zy,E)},[E]),m.jsx(KX,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:x,onItemFocus:_.useCallback(P=>w(P),[w]),onItemShiftTab:_.useCallback(()=>R(!0),[]),onFocusableItemAdd:_.useCallback(()=>L(P=>P+1),[]),onFocusableItemRemove:_.useCallback(()=>L(P=>P-1),[]),children:m.jsx(Kt.div,{tabIndex:C||N===0?-1:0,"data-orientation":r,...h,ref:b,style:{outline:"none",...e.style},onMouseDown:Ve(e.onMouseDown,()=>{A.current=!0}),onFocus:Ve(e.onFocus,P=>{const G=!A.current;if(P.target===P.currentTarget&&G&&!C){const O=new CustomEvent(zy,WX);if(P.currentTarget.dispatchEvent(O),!O.defaultPrevented){const B=T().filter(z=>z.focusable),H=B.find(z=>z.active),j=B.find(z=>z.id===x),V=[H,j,...B].filter(Boolean).map(z=>z.ref.current);$5(V,f)}}A.current=!1}),onBlur:Ve(e.onBlur,()=>R(!1))})})}),F5="RovingFocusGroupItem",H5=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...l}=e,u=zo(),d=s||u,f=YX(F5,n),h=f.currentTabStopId===d,g=j5(n),{onFocusableItemAdd:b,onFocusableItemRemove:y,currentTabStopId:x}=f;return _.useEffect(()=>{if(r)return b(),()=>y()},[r,b,y]),m.jsx(NS.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:m.jsx(Kt.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:Ve(e.onMouseDown,w=>{r?f.onItemFocus(d):w.preventDefault()}),onFocus:Ve(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:Ve(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const C=JX(w,f.orientation,f.dir);if(C!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let E=g().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")E.reverse();else if(C==="prev"||C==="next"){C==="prev"&&E.reverse();const T=E.indexOf(w.currentTarget);E=f.loop?eQ(E,T+1):E.slice(T+1)}setTimeout(()=>$5(E))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:x!=null}):o})})});H5.displayName=F5;var QX={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ZX(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function JX(e,t,n){const r=ZX(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return QX[r]}function $5(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function eQ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var tQ=B5,nQ=H5,MS=["Enter"," "],rQ=["ArrowDown","PageUp","Home"],U5=["ArrowUp","PageDown","End"],iQ=[...rQ,...U5],sQ={ltr:[...MS,"ArrowRight"],rtl:[...MS,"ArrowLeft"]},oQ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Jf="Menu",[gf,aQ,lQ]=pC(Jf),[bc,V5]=qo(Jf,[lQ,il,z5]),k0=il(),W5=z5(),[cQ,_c]=bc(Jf),[uQ,ep]=bc(Jf),G5=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,l=k0(t),[u,d]=_.useState(null),f=_.useRef(!1),h=Ts(s),g=mC(i);return _.useEffect(()=>{const b=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),m.jsx(g0,{...l,children:m.jsx(cQ,{scope:t,open:n,onOpenChange:h,content:u,onContentChange:d,children:m.jsx(uQ,{scope:t,onClose:_.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:g,modal:o,children:r})})})};G5.displayName=Jf;var dQ="MenuAnchor",gC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=k0(n);return m.jsx(qf,{...i,...r,ref:t})});gC.displayName=dQ;var vC="MenuPortal",[hQ,q5]=bc(vC,{forceMount:void 0}),K5=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=_c(vC,t);return m.jsx(hQ,{scope:t,forceMount:n,children:m.jsx(ps,{present:n||s.open,children:m.jsx(dd,{asChild:!0,container:i,children:r})})})};K5.displayName=vC;var ls="MenuContent",[fQ,bC]=bc(ls),Y5=_.forwardRef((e,t)=>{const n=q5(ls,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=_c(ls,e.__scopeMenu),o=ep(ls,e.__scopeMenu);return m.jsx(gf.Provider,{scope:e.__scopeMenu,children:m.jsx(ps,{present:r||s.open,children:m.jsx(gf.Slot,{scope:e.__scopeMenu,children:o.modal?m.jsx(pQ,{...i,ref:t}):m.jsx(mQ,{...i,ref:t})})})})}),pQ=_.forwardRef((e,t)=>{const n=_c(ls,e.__scopeMenu),r=_.useRef(null),i=an(t,r);return _.useEffect(()=>{const s=r.current;if(s)return c0(s)},[]),m.jsx(_C,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ve(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),mQ=_.forwardRef((e,t)=>{const n=_c(ls,e.__scopeMenu);return m.jsx(_C,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),gQ=Ql("MenuContent.ScrollLock"),_C=_.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:b,disableOutsideScroll:y,...x}=e,w=_c(ls,n),C=ep(ls,n),R=k0(n),E=W5(n),T=aQ(n),[A,N]=_.useState(null),L=_.useRef(null),P=an(t,L,w.onContentChange),G=_.useRef(0),O=_.useRef(""),B=_.useRef(0),H=_.useRef(null),j=_.useRef("right"),$=_.useRef(0),V=y?Wf:_.Fragment,z=y?{as:gQ,allowPinchZoom:!0}:void 0,q=Y=>{var re,pe;const I=O.current+Y,U=T().filter(ce=>!ce.disabled),X=document.activeElement,D=(re=U.find(ce=>ce.ref.current===X))==null?void 0:re.textValue,te=U.map(ce=>ce.textValue),Q=TQ(te,I,D),ne=(pe=U.find(ce=>ce.textValue===Q))==null?void 0:pe.ref.current;(function ce(ge){O.current=ge,window.clearTimeout(G.current),ge!==""&&(G.current=window.setTimeout(()=>ce(""),1e3))})(I),ne&&setTimeout(()=>ne.focus())};_.useEffect(()=>()=>window.clearTimeout(G.current),[]),a0();const F=_.useCallback(Y=>{var U,X;return j.current===((U=H.current)==null?void 0:U.side)&&NQ(Y,(X=H.current)==null?void 0:X.area)},[]);return m.jsx(fQ,{scope:n,searchRef:O,onItemEnter:_.useCallback(Y=>{F(Y)&&Y.preventDefault()},[F]),onItemLeave:_.useCallback(Y=>{var I;F(Y)||((I=L.current)==null||I.focus(),N(null))},[F]),onTriggerLeave:_.useCallback(Y=>{F(Y)&&Y.preventDefault()},[F]),pointerGraceTimerRef:B,onPointerGraceIntentChange:_.useCallback(Y=>{H.current=Y},[]),children:m.jsx(V,{...z,children:m.jsx(Vf,{asChild:!0,trapped:i,onMountAutoFocus:Ve(s,Y=>{var I;Y.preventDefault(),(I=L.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:m.jsx(ud,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:b,children:m.jsx(tQ,{asChild:!0,...E,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:N,onEntryFocus:Ve(u,Y=>{C.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(v0,{role:"menu","aria-orientation":"vertical","data-state":dj(w.open),"data-radix-menu-content":"",dir:C.dir,...R,...x,ref:P,style:{outline:"none",...x.style},onKeyDown:Ve(x.onKeyDown,Y=>{const U=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,X=Y.ctrlKey||Y.altKey||Y.metaKey,D=Y.key.length===1;U&&(Y.key==="Tab"&&Y.preventDefault(),!X&&D&&q(Y.key));const te=L.current;if(Y.target!==te||!iQ.includes(Y.key))return;Y.preventDefault();const ne=T().filter(re=>!re.disabled).map(re=>re.ref.current);U5.includes(Y.key)&&ne.reverse(),EQ(ne)}),onBlur:Ve(e.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(G.current),O.current="")}),onPointerMove:Ve(e.onPointerMove,vf(Y=>{const I=Y.target,U=$.current!==Y.clientX;if(Y.currentTarget.contains(I)&&U){const X=Y.clientX>$.current?"right":"left";j.current=X,$.current=Y.clientX}}))})})})})})})});Y5.displayName=ls;var vQ="MenuGroup",yC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Kt.div,{role:"group",...r,ref:t})});yC.displayName=vQ;var bQ="MenuLabel",X5=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Kt.div,{...r,ref:t})});X5.displayName=bQ;var fv="MenuItem",uN="menu.itemSelect",E0=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=_.useRef(null),o=ep(fv,e.__scopeMenu),l=bC(fv,e.__scopeMenu),u=an(t,s),d=_.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(uN,{bubbles:!0,cancelable:!0});h.addEventListener(uN,b=>r==null?void 0:r(b),{once:!0}),ZP(h,g),g.defaultPrevented?d.current=!1:o.onClose()}};return m.jsx(Q5,{...i,ref:u,disabled:n,onClick:Ve(e.onClick,f),onPointerDown:h=>{var g;(g=e.onPointerDown)==null||g.call(e,h),d.current=!0},onPointerUp:Ve(e.onPointerUp,h=>{var g;d.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:Ve(e.onKeyDown,h=>{const g=l.searchRef.current!=="";n||g&&h.key===" "||MS.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});E0.displayName=fv;var Q5=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=bC(fv,n),l=W5(n),u=_.useRef(null),d=an(t,u),[f,h]=_.useState(!1),[g,b]=_.useState("");return _.useEffect(()=>{const y=u.current;y&&b((y.textContent??"").trim())},[s.children]),m.jsx(gf.ItemSlot,{scope:n,disabled:r,textValue:i??g,children:m.jsx(nQ,{asChild:!0,...l,focusable:!r,children:m.jsx(Kt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:Ve(e.onPointerMove,vf(y=>{r?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ve(e.onPointerLeave,vf(y=>o.onItemLeave(y))),onFocus:Ve(e.onFocus,()=>h(!0)),onBlur:Ve(e.onBlur,()=>h(!1))})})})}),_Q="MenuCheckboxItem",Z5=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.jsx(rj,{scope:e.__scopeMenu,checked:n,children:m.jsx(E0,{role:"menuitemcheckbox","aria-checked":pv(n)?"mixed":n,...i,ref:t,"data-state":SC(n),onSelect:Ve(i.onSelect,()=>r==null?void 0:r(pv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Z5.displayName=_Q;var J5="MenuRadioGroup",[yQ,xQ]=bc(J5,{value:void 0,onValueChange:()=>{}}),ej=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=Ts(r);return m.jsx(yQ,{scope:e.__scopeMenu,value:n,onValueChange:s,children:m.jsx(yC,{...i,ref:t})})});ej.displayName=J5;var tj="MenuRadioItem",nj=_.forwardRef((e,t)=>{const{value:n,...r}=e,i=xQ(tj,e.__scopeMenu),s=n===i.value;return m.jsx(rj,{scope:e.__scopeMenu,checked:s,children:m.jsx(E0,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":SC(s),onSelect:Ve(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});nj.displayName=tj;var xC="MenuItemIndicator",[rj,SQ]=bc(xC,{checked:!1}),ij=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=SQ(xC,n);return m.jsx(ps,{present:r||pv(s.checked)||s.checked===!0,children:m.jsx(Kt.span,{...i,ref:t,"data-state":SC(s.checked)})})});ij.displayName=xC;var wQ="MenuSeparator",sj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Kt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});sj.displayName=wQ;var CQ="MenuArrow",oj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=k0(n);return m.jsx(b0,{...i,...r,ref:t})});oj.displayName=CQ;var kQ="MenuSub",[u1e,aj]=bc(kQ),zh="MenuSubTrigger",lj=_.forwardRef((e,t)=>{const n=_c(zh,e.__scopeMenu),r=ep(zh,e.__scopeMenu),i=aj(zh,e.__scopeMenu),s=bC(zh,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:u}=s,d={__scopeMenu:e.__scopeMenu},f=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>f,[f]),_.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),u(null)}},[l,u]),m.jsx(gC,{asChild:!0,...d,children:m.jsx(Q5,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":dj(n.open),...e,ref:jw(t,i.onTriggerChange),onClick:h=>{var g;(g=e.onClick)==null||g.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ve(e.onPointerMove,vf(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Ve(e.onPointerLeave,vf(h=>{var b,y;f();const g=(b=n.content)==null?void 0:b.getBoundingClientRect();if(g){const x=(y=n.content)==null?void 0:y.dataset.side,w=x==="right",C=w?-5:5,R=g[w?"left":"right"],E=g[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+C,y:h.clientY},{x:R,y:g.top},{x:E,y:g.top},{x:E,y:g.bottom},{x:R,y:g.bottom}],side:x}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Ve(e.onKeyDown,h=>{var b;const g=s.searchRef.current!=="";e.disabled||g&&h.key===" "||sQ[r.dir].includes(h.key)&&(n.onOpenChange(!0),(b=n.content)==null||b.focus(),h.preventDefault())})})})});lj.displayName=zh;var cj="MenuSubContent",uj=_.forwardRef((e,t)=>{const n=q5(ls,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=_c(ls,e.__scopeMenu),o=ep(ls,e.__scopeMenu),l=aj(cj,e.__scopeMenu),u=_.useRef(null),d=an(t,u);return m.jsx(gf.Provider,{scope:e.__scopeMenu,children:m.jsx(ps,{present:r||s.open,children:m.jsx(gf.Slot,{scope:e.__scopeMenu,children:m.jsx(_C,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:d,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;o.isUsingKeyboardRef.current&&((h=u.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Ve(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ve(e.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:Ve(e.onKeyDown,f=>{var b;const h=f.currentTarget.contains(f.target),g=oQ[o.dir].includes(f.key);h&&g&&(s.onOpenChange(!1),(b=l.trigger)==null||b.focus(),f.preventDefault())})})})})})});uj.displayName=cj;function dj(e){return e?"open":"closed"}function pv(e){return e==="indeterminate"}function SC(e){return pv(e)?"indeterminate":e?"checked":"unchecked"}function EQ(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function RQ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function TQ(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=RQ(e,Math.max(s,0));i.length===1&&(o=o.filter(d=>d!==n));const u=o.find(d=>d.toLowerCase().startsWith(i.toLowerCase()));return u!==n?u:void 0}function AQ(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],u=t[o],d=l.x,f=l.y,h=u.x,g=u.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function NQ(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return AQ(n,t)}function vf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var MQ=G5,LQ=gC,DQ=K5,IQ=Y5,PQ=yC,OQ=X5,jQ=E0,zQ=Z5,BQ=ej,FQ=nj,HQ=ij,$Q=sj,UQ=oj,VQ=lj,WQ=uj,wC="ContextMenu",[GQ]=qo(wC,[V5]),Zr=V5(),[qQ,hj]=GQ(wC),fj=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:s=!0}=e,[o,l]=_.useState(!1),u=Zr(t),d=Ts(r),f=_.useCallback(h=>{l(h),d(h)},[d]);return m.jsx(qQ,{scope:t,open:o,onOpenChange:f,modal:s,children:m.jsx(MQ,{...u,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};fj.displayName=wC;var pj="ContextMenuTrigger",mj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,s=hj(pj,n),o=Zr(n),l=_.useRef({x:0,y:0}),u=_.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=_.useRef(0),f=_.useCallback(()=>window.clearTimeout(d.current),[]),h=g=>{l.current={x:g.clientX,y:g.clientY},s.onOpenChange(!0)};return _.useEffect(()=>f,[f]),_.useEffect(()=>void(r&&f()),[r,f]),m.jsxs(m.Fragment,{children:[m.jsx(LQ,{...o,virtualRef:u}),m.jsx(Kt.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Ve(e.onContextMenu,g=>{f(),h(g),g.preventDefault()}),onPointerDown:r?e.onPointerDown:Ve(e.onPointerDown,zm(g=>{f(),d.current=window.setTimeout(()=>h(g),700)})),onPointerMove:r?e.onPointerMove:Ve(e.onPointerMove,zm(f)),onPointerCancel:r?e.onPointerCancel:Ve(e.onPointerCancel,zm(f)),onPointerUp:r?e.onPointerUp:Ve(e.onPointerUp,zm(f))})]})});mj.displayName=pj;var KQ="ContextMenuPortal",gj=e=>{const{__scopeContextMenu:t,...n}=e,r=Zr(t);return m.jsx(DQ,{...r,...n})};gj.displayName=KQ;var vj="ContextMenuContent",bj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=hj(vj,n),s=Zr(n),o=_.useRef(!1);return m.jsx(IQ,{...s,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var u;(u=e.onCloseAutoFocus)==null||u.call(e,l),!l.defaultPrevented&&o.current&&l.preventDefault(),o.current=!1},onInteractOutside:l=>{var u;(u=e.onInteractOutside)==null||u.call(e,l),!l.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});bj.displayName=vj;var YQ="ContextMenuGroup",XQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(PQ,{...i,...r,ref:t})});XQ.displayName=YQ;var QQ="ContextMenuLabel",ZQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(OQ,{...i,...r,ref:t})});ZQ.displayName=QQ;var JQ="ContextMenuItem",_j=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(jQ,{...i,...r,ref:t})});_j.displayName=JQ;var eZ="ContextMenuCheckboxItem",tZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(zQ,{...i,...r,ref:t})});tZ.displayName=eZ;var nZ="ContextMenuRadioGroup",rZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(BQ,{...i,...r,ref:t})});rZ.displayName=nZ;var iZ="ContextMenuRadioItem",sZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(FQ,{...i,...r,ref:t})});sZ.displayName=iZ;var oZ="ContextMenuItemIndicator",aZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(HQ,{...i,...r,ref:t})});aZ.displayName=oZ;var lZ="ContextMenuSeparator",yj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx($Q,{...i,...r,ref:t})});yj.displayName=lZ;var cZ="ContextMenuArrow",uZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(UQ,{...i,...r,ref:t})});uZ.displayName=cZ;var dZ="ContextMenuSubTrigger",hZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(VQ,{...i,...r,ref:t})});hZ.displayName=dZ;var fZ="ContextMenuSubContent",pZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(WQ,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});pZ.displayName=fZ;function zm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var mZ=fj,gZ=mj,vZ=gj,xj=bj,Sj=_j,wj=yj;const CC=mZ,kC=gZ,R0=_.forwardRef(({className:e,...t},n)=>m.jsx(vZ,{children:m.jsx(xj,{ref:n,className:xe("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...t})}));R0.displayName=xj.displayName;const Ni=_.forwardRef(({className:e,...t},n)=>m.jsx(Sj,{ref:n,className:xe("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-muted focus:bg-muted data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));Ni.displayName=Sj.displayName;const Cj=_.forwardRef(({className:e,...t},n)=>m.jsx(wj,{ref:n,className:xe("-mx-1 my-1 h-px bg-border",e),...t}));Cj.displayName=wj.displayName;function bZ({editorLabel:e,onCopyPath:t,onOpenInFinder:n,onOpenInEditor:r,onRemove:i,children:s}){return m.jsxs(CC,{children:[m.jsx(kC,{asChild:!0,children:s}),m.jsxs(R0,{children:[m.jsxs(Ni,{onSelect:o=>{o.stopPropagation(),t()},children:[m.jsx(Xl,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Copy Path"})]}),m.jsxs(Ni,{onSelect:o=>{o.stopPropagation(),n()},children:[m.jsx(i0,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show in Finder"})]}),m.jsxs(Ni,{onSelect:o=>{o.stopPropagation(),r()},children:[m.jsx(r0,{className:"h-3.5 w-3.5"}),m.jsxs("span",{className:"text-xs font-medium",children:["Open in ",e]})]}),m.jsxs(Ni,{onSelect:o=>{o.stopPropagation(),i()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[m.jsx(IP,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Remove"})]})]})]})}const _Z=20;function dN(e){return e.top+e.height/2}function yZ({activeId:e,groupIds:t,collisionRect:n,droppableRects:r}){const i=t.indexOf(e);if(i===-1)return null;const s=r.get(e);if(!s)return null;const o=n.top+_Z;if(n.top>s.top){for(let l=t.length-1;l>i;l--){const u=r.get(t[l]);if(u&&o>=dN(u))return t[l]}return e}if(n.top<s.top){for(let l=0;l<i;l++){const u=r.get(t[l]);if(u&&o<=dN(u))return t[l]}return e}return e}const xZ=_.memo(function({group:t,editorLabel:n,collapsedSections:r,expandedGroups:i,onToggleSection:s,onToggleExpandedGroup:o,renderChatRow:l,onNewLocalChat:u,onCopyPath:d,onOpenExternalPath:f,onRemoveProject:h,isConnected:g,startingLocalPath:b}){const{groupKey:y,localPath:x}=t,w=i.has(y),C=t.olderChats.length>0,{attributes:R,listeners:E,setNodeRef:T,setActivatorNodeRef:A,transform:N,transition:L,isDragging:P}=$X({id:y}),G={transform:pf.Translate.toString(N?{...N,x:0}:null),transition:P?void 0:L},O=m.jsxs("div",{ref:A,className:xe("sticky top-0 bg-background dark:bg-card z-10 relative p-[10px] flex items-center justify-between","cursor-grab active:cursor-grabbing select-none touch-none",P&&"cursor-grabbing"),onClick:()=>s(y),...E,children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"relative size-3.5 shrink-0 cursor-pointer",children:r.has(y)?m.jsx(Fo,{className:"translate-y-[1px] size-3.5 shrink-0 text-slate-400 transition-all duration-200"}):m.jsxs(m.Fragment,{children:[m.jsx(i0,{className:"absolute inset-0 translate-y-[1px] size-3.5 shrink-0 text-slate-400 dark:text-slate-500 transition-all duration-200 group-hover/section:opacity-0"}),m.jsx(Fo,{className:"absolute inset-0 translate-y-[1px] size-3.5 shrink-0 rotate-90 text-slate-400 opacity-0 transition-all duration-200 group-hover/section:opacity-100"})]})}),m.jsxs(Za,{children:[m.jsx(Ja,{asChild:!0,children:m.jsx("span",{className:"truncate max-w-[150px] whitespace-nowrap text-sm text-slate-500 dark:text-slate-400",children:v5(x)})}),m.jsx(Uo,{side:"right",sideOffset:4,children:x})]})]}),u&&m.jsxs(Za,{children:[m.jsx(Ja,{asChild:!0,children:m.jsx(st,{variant:"ghost",size:"icon",className:xe("h-5.5 w-5.5 absolute right-2 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100",(!g||b===x)&&"opacity-50 cursor-not-allowed"),disabled:!g||b===x,onClick:B=>{B.stopPropagation(),u(x)},children:b===x?m.jsx(Rn,{className:"size-4 text-slate-500 dark:text-slate-400 animate-spin"}):m.jsx(Dw,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),m.jsx(Uo,{side:"right",sideOffset:4,children:g?"New chat":`Start ${Gn} to connect`})]})]});return m.jsxs("div",{ref:T,style:G,className:xe("group/section",P&&"opacity-50 shadow-lg z-50 relative"),...R,children:[h&&d&&f?m.jsx(bZ,{editorLabel:n,onCopyPath:()=>d(x),onOpenInFinder:()=>f("open_finder",x),onOpenInEditor:()=>f("open_editor",x),onRemove:()=>h(y),children:O}):O,!r.has(y)&&(t.previewChats.length>0||C)&&m.jsxs("div",{className:"space-y-[2px] mb-2 ",children:[t.previewChats.map(l),C&&w?m.jsx("button",{onClick:()=>o(y),className:"pl-2.5 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Hide older"}):null,w?t.olderChats.map(l):null,C&&!w?m.jsx("button",{onClick:()=>o(y),className:"pl-2.5 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Show older"}):null]})]})}),SZ=function({projectGroups:t,editorLabel:n,collapsedSections:r,expandedGroups:i,onToggleSection:s,onToggleExpandedGroup:o,renderChatRow:l,onNewLocalChat:u,onCopyPath:d,onOpenExternalPath:f,onRemoveProject:h,onReorderGroups:g,isConnected:b,startingLocalPath:y}){const x=_Y(QA(hC,{activationConstraint:{distance:2}}),QA(uC)),w=_.useMemo(()=>t.map(E=>E.groupKey),[t]),C=_.useMemo(()=>E=>{const T=yZ({activeId:String(E.active.id),groupIds:w,collisionRect:E.collisionRect,droppableRects:E.droppableRects});if(!T)return JA(E);const A=E.droppableContainers.find(N=>N.id===T);return A?[{id:A.id,data:{droppableContainer:A,value:0}}]:JA(E)},[w]);function R(E){const{active:T,over:A}=E;if(A&&T.id!==A.id&&g){const N=w.indexOf(T.id),L=w.indexOf(A.id);if(N!==-1&&L!==-1){const P=fC(w,N,L);g(P)}}}return m.jsx(SX,{sensors:x,collisionDetection:C,onDragEnd:R,children:m.jsx(PX,{items:w,strategy:DX,children:t.map(E=>m.jsx(xZ,{group:E,editorLabel:n,collapsedSections:r,expandedGroups:i,onToggleSection:s,onToggleExpandedGroup:o,renderChatRow:l,onNewLocalChat:u,onCopyPath:d,onOpenExternalPath:f,onRemoveProject:h,isConnected:b,startingLocalPath:y},E.groupKey))})})},wZ=_.memo(SZ),CZ="gpt-5.4-mini",kZ="moonshotai/kimi-k2.5:nitro",mv=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],LS=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"XHigh"}],bf={reasoningEffort:"high",contextWindow:"200k"},DS={reasoningEffort:"high",fastMode:!1};function hN(e){return mv.some(t=>t.id===e)}function fN(e){return LS.some(t=>t.id===e)}const IS=[{id:"200k",label:"200k"},{id:"1m",label:"1M"}],Jh=[{id:"claude",label:"Claude",defaultModel:"claude-sonnet-4-6",defaultEffort:"high",supportsPlanMode:!0,models:[{id:"claude-opus-4-7",label:"Opus 4.7",supportsEffort:!0,aliases:["opus"],contextWindowOptions:[...IS],supportsMaxReasoningEffort:!0},{id:"claude-sonnet-4-6",label:"Sonnet 4.6",supportsEffort:!0,aliases:["sonnet"],contextWindowOptions:[...IS]},{id:"claude-haiku-4-5-20251001",label:"Haiku 4.5",supportsEffort:!0,aliases:["haiku"]}],efforts:[...mv]},{id:"codex",label:"Codex",defaultModel:"gpt-5.4",supportsPlanMode:!0,models:[{id:"gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",supportsEffort:!1,aliases:["gpt-5-codex"]},{id:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark",supportsEffort:!1}],efforts:[]}];function EC(e){const t=Jh.find(n=>n.id===e);if(!t)throw new Error(`Unknown provider: ${e}`);return t}function EZ(e,t){if(t)return EC(e).models.find(n=>{var r;return n.id===t||((r=n.aliases)==null?void 0:r.includes(t))})}function RC(e,t,n){var r;return((r=EZ(e,t))==null?void 0:r.id)??n??EC(e).defaultModel}function RZ(e,t="claude-opus-4-7"){return RC("claude",e,t)}function TZ(e,t="gpt-5.4"){return RC("codex",e,t)}function AZ(e,t){const n=RC(e,t);return EC(e).models.find(r=>r.id===n)}function kj(e){return AZ("claude",e)}function Ej(e){var t;return!!((t=kj(e))!=null&&t.supportsMaxReasoningEffort)}function NZ(e){var t;return((t=kj(e))==null?void 0:t.contextWindowOptions)??[]}function TC(e,t){const n=NZ(e);return n.length===0?bf.contextWindow:n.some(r=>r.id===t)?t:bf.contextWindow}function MZ(e){switch(e){case"1m":return 1e6;case"200k":default:return 2e5}}const xs={toggleEmbeddedTerminal:["cmd+j","ctrl+`"],toggleRightSidebar:["cmd+b","ctrl+b"],openInFinder:["cmd+alt+f","ctrl+alt+f"],openInEditor:["cmd+shift+o","ctrl+shift+o"],addSplitTerminal:["cmd+/","ctrl+/"],jumpToSidebarChat:["cmd+alt"],createChatInCurrentProject:["cmd+alt+n"],openAddProject:["cmd+alt+o"]},Rj={toggleEmbeddedTerminal:"Toggle Embedded Terminal",toggleRightSidebar:"Toggle Right Sidebar",openInFinder:"Open In Finder",openInEditor:"Open In Editor",addSplitTerminal:"Add Split Terminal",jumpToSidebarChat:"Jump To Sidebar Chat",createChatInCurrentProject:"New Chat In Current Project",openAddProject:"Open Add Project"};function By(e){return(e??[]).join(", ")}function Ra(e){return e.split(",").map(t=>t.trim()).map(t=>t.toLowerCase()).filter(Boolean)}const LZ=new Map([["cmd","meta"],["meta","meta"],["ctrl","ctrl"],["control","ctrl"],["alt","alt"],["option","alt"],["shift","shift"]]);function Tj(e,t){const n=IZ(e);return n?PZ(t,n.key)&&t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&t.shiftKey===n.shift:!1}function yh(e,t,n){return T0(e,t).some(i=>Tj(i,n))}function DZ(e,t,n){return T0(e,t).find(r=>Tj(r,n))??null}function T0(e,t){return(e==null?void 0:e.bindings[t])??xs[t]}function AC(e){return{bindings:{toggleEmbeddedTerminal:(e==null?void 0:e.bindings.toggleEmbeddedTerminal)??xs.toggleEmbeddedTerminal,toggleRightSidebar:(e==null?void 0:e.bindings.toggleRightSidebar)??xs.toggleRightSidebar,openInFinder:(e==null?void 0:e.bindings.openInFinder)??xs.openInFinder,openInEditor:(e==null?void 0:e.bindings.openInEditor)??xs.openInEditor,addSplitTerminal:(e==null?void 0:e.bindings.addSplitTerminal)??xs.addSplitTerminal,jumpToSidebarChat:(e==null?void 0:e.bindings.jumpToSidebarChat)??xs.jumpToSidebarChat,createChatInCurrentProject:(e==null?void 0:e.bindings.createChatInCurrentProject)??xs.createChatInCurrentProject,openAddProject:(e==null?void 0:e.bindings.openAddProject)??xs.openAddProject},warning:(e==null?void 0:e.warning)??null,filePathDisplay:(e==null?void 0:e.filePathDisplay)??""}}function IZ(e){const t=e.split("+").map(r=>r.trim()).filter(Boolean);if(t.length===0)return null;const n={key:"",ctrl:!1,meta:!1,alt:!1,shift:!1};for(const r of t){const i=r.toLowerCase(),s=LZ.get(i);if(s==="ctrl"){n.ctrl=!0;continue}if(s==="meta"){n.meta=!0;continue}if(s==="alt"){n.alt=!0;continue}if(s==="shift"){n.shift=!0;continue}if(n.key)return null;n.key=i}return n.key?n:null}function PZ(e,t){if(e.key.toLowerCase()===t)return!0;const n=OZ(t);return n?e.code===n:!1}function OZ(e){if(e.length===1&&e>="a"&&e<="z")return`Key${e.toUpperCase()}`;if(e.length===1&&e>="0"&&e<="9")return`Digit${e}`;switch(e){case"/":return"Slash";case"`":return"Backquote";default:return null}}const Aj=9;function jZ(e,t,n){const r=[];for(const i of e){if(t.has(i.groupKey))continue;const s=n.has(i.groupKey)?[...i.previewChats,...i.olderChats]:i.previewChats;for(const o of s)r.push({chat:o,visibleIndex:r.length+1})}return r}function zZ(e,t){if(!PS(e,t)||!t.code.startsWith("Digit"))return null;const n=Number(t.code.slice(5));return Number.isInteger(n)&&n>=1&&n<=Aj?n:null}function BZ(e,t){return FZ(e,t)?String(t):null}function PS(e,t){return T0(e,"jumpToSidebarChat").some(n=>HZ(n,t))}function pN(e,t,n){return DZ(e,t,n)!==null}function FZ(e,t){return t<1||t>Aj?null:T0(e,"jumpToSidebarChat")[0]??null}function HZ(e,t){const n=e.split("+").map(l=>l.trim().toLowerCase()).filter(Boolean);let r=!1,i=!1,s=!1,o=!1;for(const l of n){if(l==="cmd"||l==="meta"){r=!0;continue}if(l==="alt"||l==="option"){i=!0;continue}if(l==="ctrl"||l==="control"){s=!0;continue}l==="shift"&&(o=!0)}return t.metaKey===r&&t.altKey===i&&t.ctrlKey===s&&t.shiftKey===o}function $Z({data:e,activeChatId:t,connectionStatus:n,ready:r,open:i,collapsed:s,showMobileOpenButton:o,onOpen:l,onClose:u,onCollapse:d,onExpand:f,onCreateChat:h,onForkChat:g,currentProjectId:b,keybindings:y,onDeleteChat:x,onOpenAddProjectModal:w,onCopyPath:C,onOpenExternalPath:R,onRemoveProject:E,onReorderProjectGroups:T,editorLabel:A,updateSnapshot:N,onOpenChangelog:L}){const P=Ls(),G=cd(),O=_.useRef(null),B=_.useRef(new Set),[H,j]=_.useState(new Set),[$,V]=_.useState(new Set),[z,q]=_.useState(()=>Date.now()),[F,Y]=_.useState(!1),I=_.useMemo(()=>AC(y),[y]),U=_.useMemo(()=>jZ(e.projectGroups,H,$),[H,e.projectGroups,$]),X=_.useRef(U),D=_.useMemo(()=>new Map(U.map(Pe=>[Pe.chat.chatId,Pe.visibleIndex])),[U]),te=_.useMemo(()=>new Map(e.projectGroups.map(Pe=>[Pe.localPath,Pe.groupKey])),[e.projectGroups]),Q=U.length;_.useEffect(()=>{X.current=U},[U]),_.useEffect(()=>{j(Pe=>{const nt=new Set,He=new Set(e.projectGroups.map(pt=>pt.groupKey)),Ze=B.current;for(const pt of Pe)He.has(pt)&&nt.add(pt);B.current=new Set([...Ze].filter(pt=>He.has(pt)));for(const pt of e.projectGroups)B.current.has(pt.groupKey)||(B.current.add(pt.groupKey),pt.defaultCollapsed&&nt.add(pt.groupKey));return nt.size===Pe.size&&[...nt].every(pt=>Pe.has(pt))?Pe:nt})},[e.projectGroups]);const ne=_.useCallback(Pe=>{j(nt=>{const He=new Set(nt);return He.has(Pe)?He.delete(Pe):He.add(Pe),He})},[]),re=_.useCallback(Pe=>{V(nt=>{const He=new Set(nt);return He.has(Pe)?He.delete(Pe):He.add(Pe),He})},[]),pe=_.useCallback(Pe=>{const nt=D.get(Pe.chatId);return m.jsx(iY,{chat:Pe,activeChatId:t,nowMs:z,shortcutHint:nt?BZ(I,nt):null,showShortcutHint:F,onSelectChat:He=>{G(`/chat/${He}`),u()},onForkChat:()=>g(Pe),onDeleteChat:()=>x(Pe)},Pe._id)},[t,G,z,u,x,g,I,F,D]);_.useEffect(()=>{const Pe=window.setInterval(()=>{q(Date.now())},3e4);return()=>window.clearInterval(Pe)},[]),_.useEffect(()=>{function Pe(Ze){var en;if(Y(PS(I,Ze)),pN(I,"createChatInCurrentProject",Ze)){if(!b)return;Ze.preventDefault(),h(b);return}if(pN(I,"openAddProject",Ze)){Ze.preventDefault(),G("/"),u(),w();return}const pt=zZ(I,Ze);if(pt===null)return;const mt=(en=X.current[pt-1])==null?void 0:en.chat;mt&&(Ze.preventDefault(),G(`/chat/${mt.chatId}`),u())}function nt(Ze){Y(PS(I,Ze))}function He(){Y(!1)}return window.addEventListener("keydown",Pe),window.addEventListener("keyup",nt),window.addEventListener("blur",He),()=>{window.removeEventListener("keydown",Pe),window.removeEventListener("keyup",nt),window.removeEventListener("blur",He)}},[b,G,u,h,w,I]),_.useEffect(()=>{!t||!O.current||requestAnimationFrame(()=>{const Pe=O.current,nt=Pe==null?void 0:Pe.querySelector(`[data-chat-id="${t}"]`);if(!nt||!Pe)return;const He=nt.getBoundingClientRect(),Ze=Pe.getBoundingClientRect();if(He.top<Ze.top+38){const pt=He.top-Ze.top+Pe.scrollTop;Pe.scrollTo({top:pt-38,behavior:"smooth"})}else if(He.bottom>Ze.bottom){const pt=He.top+He.height/2-Ze.top+Pe.scrollTop,mt=Pe.clientHeight/2;Pe.scrollTo({top:pt-mt,behavior:"smooth"})}})},[t,Q]);const ce=Q>0,ge=P.pathname==="/",ue=P.pathname.startsWith("/settings"),ke=ge||ue,Ae=n==="connecting"||!r,ze=Ae?"Connecting":n==="connected"?"Connected":"Disconnected",Ge=n==="connected"?"bg-emerald-500":"bg-amber-500",Et=(N==null?void 0:N.updateAvailable)===!0,zt=N?N.latestVersion===`${N.currentVersion}-dev`:!1,Ct=(N==null?void 0:N.status)==="updating"||(N==null?void 0:N.status)==="restart_pending";return m.jsxs(m.Fragment,{children:[!i&&o&&m.jsx(st,{variant:"ghost",size:"icon",className:"fixed top-3 left-3 z-50 md:hidden",onClick:l,children:m.jsx(Mw,{className:"h-5 w-5"})}),s&&ke&&m.jsx("div",{className:"hidden md:flex fixed left-0 top-0 h-full z-40 items-start pt-4 pl-5 border-l border-border/0",children:m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Iu,{className:"size-6 text-logo"}),m.jsx(st,{variant:"ghost",size:"icon",onClick:f,title:"Expand sidebar",children:m.jsx(hS,{className:"h-5 w-5"})})]})}),m.jsxs("div",{"data-sidebar":"open",className:xe("fixed inset-0 z-50 bg-background dark:bg-card flex flex-col h-[100dvh] select-none","md:relative md:inset-auto md:w-[275px] md:mr-0 md:h-[calc(100dvh-16px)] md:my-2 md:ml-2 md:border md:border-border md:rounded-2xl",i?"flex":"hidden md:flex",s&&"md:hidden"),children:[m.jsxs("div",{className:"px-[5px] h-[64px] max-h-[64px] md:h-[55px] md:max-h-[55px] border-b grid grid-cols-[40px_minmax(0,1fr)_40px] items-center md:px-[7px] md:pl-3 md:flex md:justify-between",children:[m.jsx("div",{className:"md:hidden",children:m.jsx(st,{variant:"ghost",size:"icon",className:"size-10 rounded-lg hover:!border-border/0",onClick:u,title:"Close sidebar",children:m.jsx(nl,{className:"h-5 w-5"})})}),m.jsxs("div",{className:"flex items-center justify-self-center gap-2 md:justify-self-auto",children:[m.jsxs("button",{type:"button",onClick:d,title:"Collapse sidebar",className:"hidden md:flex group/sidebar-collapse relative items-center justify-center h-5 w-5 sm:h-6 sm:w-6",children:[m.jsx(Iu,{className:"absolute inset-0.5 h-4 w-4 sm:h-5 sm:w-5 text-logo transition-all duration-200 ease-out opacity-100 scale-100 group-hover/sidebar-collapse:opacity-0 group-hover/sidebar-collapse:scale-0"}),m.jsx(hS,{className:"absolute inset-0 h-4 w-4 sm:h-6 sm:w-6 text-slate-500 dark:text-slate-400 transition-all duration-200 ease-out opacity-0 scale-0 group-hover/sidebar-collapse:opacity-100 group-hover/sidebar-collapse:scale-80 hover:opacity-50"})]}),m.jsx(Iu,{className:"h-5 w-5 sm:h-6 sm:w-6 text-logo md:hidden"}),m.jsx("span",{className:"font-logo text-base uppercase sm:text-md text-slate-600 dark:text-slate-100",children:Gn})]}),m.jsxs("div",{className:"flex items-center justify-self-end md:justify-self-auto",children:[m.jsx(st,{variant:"ghost",size:"icon",onClick:()=>{G("/"),u()},className:"size-10 rounded-lg hover:!border-border/0 md:hidden",title:"New project",children:m.jsx(ev,{className:"h-5 w-5"})}),zt?m.jsx("span",{className:"mr-1 hidden md:inline-flex items-center rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] font-bold tracking-wider text-muted-foreground",title:"Development build",children:"DEV"}):Et?m.jsxs(st,{variant:"outline",size:"sm",className:"hidden md:inline-flex rounded-full !h-auto mr-1 py-0.5 px-2 bg-logo/20 hover:bg-logo text-logo border-logo/20 hover:text-foreground hover:border-logo/20 text-[11px] font-bold tracking-wider",onClick:L,disabled:Ct,title:N!=null&&N.latestVersion?`Update to ${N.latestVersion}`:"Update Kanna",children:[Ct?m.jsx(Rn,{className:"mr-1.5 h-3 w-3 animate-spin"}):null,"UPDATE"]}):null,m.jsx(st,{variant:"ghost",size:"icon",onClick:()=>{G("/"),u()},className:"hidden md:inline-flex size-10 rounded-lg hover:!border-border/0",title:"New project",children:m.jsx(ev,{className:"size-4"})})]})]}),m.jsx("div",{ref:O,className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden scrollbar-hide",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:m.jsxs("div",{className:"p-[7px]",children:[!ce&&Ae?m.jsx("div",{className:"space-y-5 px-1 pt-3",children:[0,1,2].map(Pe=>m.jsxs("div",{className:"space-y-2 animate-pulse",children:[m.jsx("div",{className:"h-4 w-28 rounded bg-muted"}),m.jsx("div",{className:"space-y-1",children:[0,1,2].map(nt=>m.jsxs("div",{className:"flex items-center gap-2 rounded-md px-3 py-2",children:[m.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-muted"}),m.jsx("div",{className:xe("h-3.5 rounded bg-muted",nt===0?"w-32":nt===1?"w-40":"w-28")})]},nt))})]},Pe))}):null,!ce&&!Ae&&e.projectGroups.length===0?m.jsx("p",{className:"text-sm text-slate-400 p-2 mt-6 text-center",children:"No conversations yet"}):null,m.jsx(wZ,{projectGroups:e.projectGroups,editorLabel:A,onReorderGroups:T,collapsedSections:H,expandedGroups:$,onToggleSection:ne,onToggleExpandedGroup:re,renderChatRow:pe,onNewLocalChat:Pe=>{const nt=te.get(Pe);nt&&h(nt)},onCopyPath:C,onOpenExternalPath:R,onRemoveProject:E,isConnected:n==="connected"})]})}),m.jsx("div",{className:"border-t border-border p-2",children:m.jsx("button",{type:"button",onClick:()=>{G("/settings/general"),u()},className:xe("w-full rounded-xl rounded-t-md border px-3 py-2 text-left transition-colors",ue?"bg-muted border-border":"border-border/0 hover:bg-muted hover:border-border active:bg-muted/80"),children:m.jsxs("div",{className:"flex items- justify-between gap-2",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(HU,{className:"h-4 w-4 text-muted-foreground"}),m.jsx("span",{className:"text-sm",children:"Settings"})]}),m.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[m.jsx("span",{children:ze}),Ae?m.jsx(Rn,{className:"h-2 w-2 animate-spin"}):m.jsx("span",{className:xe("h-2 w-2 rounded-full",Ge)})]})]})})})]}),i?m.jsx("div",{className:"fixed inset-0 bg-black/40 z-40 md:hidden",onClick:u}):null]})}const UZ=_.memo($Z);function VZ({sidebarCollapsed:e,onOpenSidebar:t,onExpandSidebar:n,onNewChat:r,localPath:i,embeddedTerminalVisible:s=!1,onToggleEmbeddedTerminal:o,rightSidebarVisible:l=!1,onToggleRightSidebar:u,onOpenExternal:d,editorLabel:f="Editor",finderShortcut:h,editorShortcut:g,terminalShortcut:b,rightSidebarShortcut:y,branchName:x,hasGitRepo:w=!0,gitStatus:C="unknown"}){const R=w?C==="unknown"?null:x??"Detached HEAD":"Setup Git";return m.jsx(Vw,{className:xe("absolute top-0 left-0 right-0 z-10 md:pt-3 px-3 border-border/0 md:pb-0 flex items-center justify-center"," bg-gradient-to-b from-background/70"),children:m.jsxs("div",{className:"relative flex items-center gap-2 w-full",children:[m.jsxs("div",{className:`flex items-center gap-1 flex-shrink-0 border border-border rounded-full ${e?"px-1.5":""} p-1 backdrop-blur-lg`,children:[m.jsx(st,{variant:"ghost",size:"icon",className:"md:hidden",onClick:t,children:m.jsx(Mw,{className:"size-4.5"})}),e&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"flex items-center justify-center w-[36px] h-[36px]",children:m.jsx(Iu,{className:"h-4 w-4 sm:h-5 sm:w-5 text-logo ml-1 hidden md:block"})}),m.jsx(st,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:n,title:"Expand sidebar",children:m.jsx(hS,{className:"size-4.5"})})]}),m.jsx(st,{variant:"ghost",size:"icon",className:"hover:!border-border/0 hover:!bg-transparent",onClick:r,title:"Compose",children:m.jsx(Dw,{className:"size-4.5"})})]}),m.jsx("div",{className:"flex-1 min-w-0"}),i&&(d||o||u)?m.jsxs("div",{className:"flex items-center flex-shrink-0 border border-border rounded-full px-2 py-1 backdrop-blur-lg",children:[d||o?m.jsxs(m.Fragment,{children:[d?m.jsxs(Oh,{children:[m.jsx(jh,{asChild:!0,children:m.jsx(st,{variant:"ghost",size:"none",onClick:()=>d("open_finder"),title:"Open in Finder",className:"border border-border/0 hover:!border-border/0 pl-2 pr-1.5 h-9 hover:!bg-transparent",children:m.jsx(i0,{strokeWidth:2,className:"h-4.5"})})}),m.jsx(Tu,{side:"bottom",shortcut:h})]}):null,o?m.jsxs(Oh,{children:[m.jsx(jh,{asChild:!0,children:m.jsx(st,{variant:"ghost",size:"none",onClick:o,className:xe("border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent",s&&"text-foreground"),children:m.jsx(Iw,{strokeWidth:2,className:"h-4.5"})})}),m.jsx(Tu,{side:"bottom",shortcut:b})]}):null,d?m.jsxs(Oh,{children:[m.jsx(jh,{asChild:!0,children:m.jsx(st,{variant:"ghost",size:"none",onClick:()=>d("open_editor"),title:`Open in ${f}`,className:"border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent",children:m.jsx(r0,{strokeWidth:2,className:"h-4.5"})})}),m.jsx(Tu,{side:"bottom",shortcut:g})]}):null]}):null,u?m.jsxs(Oh,{children:[m.jsx(jh,{asChild:!0,children:m.jsxs(st,{variant:"ghost",onClick:u,className:xe("border flex flex-row items-center gap-1.5 h-9 border-border/0 pl-1.5 pr-2 hover:!border-border/0 hover:!bg-transparent",l&&"text-foreground"),children:[l?m.jsx(yU,{strokeWidth:2.25,className:"h-4"}):m.jsx(Fl,{strokeWidth:2.25,className:"h-4"}),R&&!l?m.jsx("div",{className:"font-[13px] max-w-[140px] truncate hidden md:block",children:R}):null]})}),m.jsx(Tu,{side:"bottom",shortcut:y})]}):null]}):null]})})}const WZ={position:"absolute",top:0,bottom:0,textAlign:"center"},GZ={display:"contents"};function mN(){return null}const gv="diffs-container",qZ=/(?=^From [a-f0-9]+ .+$)/m,Mg=/(?=^diff --git)/gm,gN=/(?=^---\s+\S)/gm,KZ=/(?=^@@ )/gm,YZ=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,Fy=new RegExp("(?<=\\n)"),XZ=/^(---|\+\+\+)\s+([^\t\r\n]+)/,QZ=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,ZZ=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,JZ=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,NC="header-prefix",MC="header-metadata",LC="header-custom",Zs={dark:"pierre-dark",light:"pierre-light"},Nj="data-theme-css",Mj="data-unsafe-css",zu=1,eJ={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},tJ=Object.freeze({fromStart:0,fromEnd:0}),vN={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},nJ={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function _f(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function rJ(e,t){return typeof window>"u"&&t!=null?m.jsxs(m.Fragment,{children:[m.jsx("template",{shadowrootmode:"open",dangerouslySetInnerHTML:{__html:t}}),e]}):m.jsx(m.Fragment,{children:e})}const iJ=_.createContext(void 0);function sJ(){return _.useContext(iJ)}const Kl=new Map,Hy=new Map,OS=new Map,jS=new Set;function bN(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let r;if(typeof n=="string"){if(r=Kl.get(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,Kl.has(n)||Kl.set(n,r);jS.has(n)||(jS.add(n),t.loadThemeSync(r))}}const oJ="modulepreload",aJ=function(e){return"/"+e},_N={},K=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(d){return Promise.all(d.map(f=>Promise.resolve(f).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(n.map(d=>{if(d=aJ(d),d in _N)return;_N[d]=!0;const f=d.endsWith(".css"),h=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":oJ,f||(g.as="script"),g.crossOrigin="",g.href=d,u&&g.setAttribute("nonce",u),document.head.appendChild(g),f)return new Promise((b,y)=>{g.addEventListener("load",b),g.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},yf=new Map,$y=new Map,lJ=new Map,zS=new Set;function yN(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(zS.has(n.name))continue;let r=yf.get(n.name);r==null&&(r=n,yf.set(n.name,r)),zS.add(r.name),t.loadLanguageSync(r.data)}}function Lj(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}let Jn=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function cJ(e){return DC(e)}function DC(e){return Array.isArray(e)?uJ(e):e instanceof RegExp?e:typeof e=="object"?dJ(e):e}function uJ(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=DC(e[n]);return t}function dJ(e){let t={};for(let n in e)t[n]=DC(e[n]);return t}function Dj(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function Ij(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?Ij(e.substring(0,e.length-1)):e.substr(~t+1)}var Uy=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Bm=class{static hasCaptures(e){return e===null?!1:(Uy.lastIndex=0,Uy.test(e))}static replaceCaptures(e,t,n){return e.replace(Uy,(r,i,s,o)=>{let l=n[parseInt(i||s,10)];if(l){let u=t.substring(l.start,l.end);for(;u[0]===".";)u=u.substring(1);switch(o){case"downcase":return u.toLowerCase();case"upcase":return u.toUpperCase();default:return u}}else return r})}};function Pj(e,t){return e<t?-1:e>t?1:0}function Oj(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let i=0;i<n;i++){let s=Pj(e[i],t[i]);if(s!==0)return s}return 0}return n-r}function xN(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function jj(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var zj=class{constructor(e){Z(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},vv=class{constructor(e,t,n){Z(this,"_cachedMatchRoot",new zj(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(pJ(e),t)}static createFromParsedTheme(e,t){return gJ(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(i=>hJ(e.parent,i.parentScopes));return r?new Bj(r.fontStyle,r.foreground,r.background):null}},Vy=class Lg{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Lg(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Lg(n,t[r]);return n}push(t){return new Lg(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function hJ(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!fJ(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function fJ(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Bj=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function pJ(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let i=0,s=t.length;i<s;i++){let o=t[i];if(!o.settings)continue;let l;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),l=h.split(",")}else Array.isArray(o.scope)?l=o.scope:l=[""];let u=-1;if(typeof o.settings.fontStyle=="string"){u=0;let h=o.settings.fontStyle.split(" ");for(let g=0,b=h.length;g<b;g++)switch(h[g]){case"italic":u=u|1;break;case"bold":u=u|2;break;case"underline":u=u|4;break;case"strikethrough":u=u|8;break}}let d=null;typeof o.settings.foreground=="string"&&xN(o.settings.foreground)&&(d=o.settings.foreground);let f=null;typeof o.settings.background=="string"&&xN(o.settings.background)&&(f=o.settings.background);for(let h=0,g=l.length;h<g;h++){let y=l[h].trim().split(" "),x=y[y.length-1],w=null;y.length>1&&(w=y.slice(0,y.length-1),w.reverse()),n[r++]=new mJ(x,w,i,u,d,f)}}return n}var mJ=class{constructor(e,t,n,r,i,s){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=s}},Or=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(Or||{});function gJ(e,t){e.sort((u,d)=>{let f=Pj(u.scope,d.scope);return f!==0||(f=Oj(u.parentScopes,d.parentScopes),f!==0)?f:u.index-d.index});let n=0,r="#000000",i="#ffffff";for(;e.length>=1&&e[0].scope==="";){let u=e.shift();u.fontStyle!==-1&&(n=u.fontStyle),u.foreground!==null&&(r=u.foreground),u.background!==null&&(i=u.background)}let s=new vJ(t),o=new Bj(n,s.getId(r),s.getId(i)),l=new _J(new BS(0,null,-1,0,0),[]);for(let u=0,d=e.length;u<d;u++){let f=e[u];l.insert(0,f.scope,f.parentScopes,f.fontStyle,s.getId(f.foreground),s.getId(f.background))}return new vv(s,o,l)}var vJ=class{constructor(e){Z(this,"_isFrozen");Z(this,"_lastColorId");Z(this,"_id2color");Z(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},bJ=Object.freeze([]),BS=class Fj{constructor(t,n,r,i,s){Z(this,"scopeDepth");Z(this,"parentScopes");Z(this,"fontStyle");Z(this,"foreground");Z(this,"background");this.scopeDepth=t,this.parentScopes=n||bJ,this.fontStyle=r,this.foreground=i,this.background=s}clone(){return new Fj(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,i=t.length;r<i;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,i){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),i!==0&&(this.background=i)}},_J=class FS{constructor(t,n=[],r={}){Z(this,"_rulesWithParentScopes");this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,i=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[i]===">"&&i++,!(r>=t.parentScopes.length||i>=n.parentScopes.length);){const s=n.parentScopes[i].length-t.parentScopes[r].length;if(s!==0)return s;r++,i++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),i,s;if(r===-1?(i=t,s=""):(i=t.substring(0,r),s=t.substring(r+1)),this._children.hasOwnProperty(i))return this._children[i].match(s)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(FS._cmpBySpecificity),n}insert(t,n,r,i,s,o){if(n===""){this._doInsertHere(t,r,i,s,o);return}let l=n.indexOf("."),u,d;l===-1?(u=n,d=""):(u=n.substring(0,l),d=n.substring(l+1));let f;this._children.hasOwnProperty(u)?f=this._children[u]:(f=new FS(this._mainRule.clone(),BS.cloneArr(this._rulesWithParentScopes)),this._children[u]=f),f.insert(t+1,d,r,i,s,o)}_doInsertHere(t,n,r,i,s){if(n===null){this._mainRule.acceptOverwrite(t,r,i,s);return}for(let o=0,l=this._rulesWithParentScopes.length;o<l;o++){let u=this._rulesWithParentScopes[o];if(Oj(u.parentScopes,n)===0){u.acceptOverwrite(t,r,i,s);return}}r===-1&&(r=this._mainRule.fontStyle),i===0&&(i=this._mainRule.foreground),s===0&&(s=this._mainRule.background),this._rulesWithParentScopes.push(new BS(t,n,r,i,s))}},Yu=class Zi{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=Zi.getLanguageId(t),r=Zi.getTokenType(t),i=Zi.getFontStyle(t),s=Zi.getForeground(t),o=Zi.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:s,background:o})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,i,s,o,l){let u=Zi.getLanguageId(t),d=Zi.getTokenType(t),f=Zi.containsBalancedBrackets(t)?1:0,h=Zi.getFontStyle(t),g=Zi.getForeground(t),b=Zi.getBackground(t);return n!==0&&(u=n),r!==8&&(d=r),i!==null&&(f=i?1:0),s!==-1&&(h=s),o!==0&&(g=o),l!==0&&(b=l),(u<<0|d<<8|f<<10|h<<11|g<<15|b<<24)>>>0}};function bv(e,t){const n=[],r=yJ(e);let i=r.next();for(;i!==null;){let u=0;if(i.length===2&&i.charAt(1)===":"){switch(i.charAt(0)){case"R":u=1;break;case"L":u=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let d=o();if(n.push({matcher:d,priority:u}),i!==",")break;i=r.next()}return n;function s(){if(i==="-"){i=r.next();const u=s();return d=>!!u&&!u(d)}if(i==="("){i=r.next();const u=l();return i===")"&&(i=r.next()),u}if(SN(i)){const u=[];do u.push(i),i=r.next();while(SN(i));return d=>t(u,d)}return null}function o(){const u=[];let d=s();for(;d;)u.push(d),d=s();return f=>u.every(h=>h(f))}function l(){const u=[];let d=o();for(;d&&(u.push(d),i==="|"||i===",");){do i=r.next();while(i==="|"||i===",");d=o()}return f=>u.some(h=>h(f))}}function SN(e){return!!e&&!!e.match(/[\w\.:]+/)}function yJ(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function Hj(e){typeof e.dispose=="function"&&e.dispose()}var xf=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},xJ=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},SJ=class{constructor(){Z(this,"_references",[]);Z(this,"_seenReferenceKeys",new Set);Z(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},wJ=class{constructor(e,t){Z(this,"seenFullScopeRequests",new Set);Z(this,"seenPartialScopeRequests",new Set);Z(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new xf(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new SJ;for(const n of e)CJ(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof xf){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function CJ(e,t,n,r){const i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const s=n.lookup(t);e instanceof xf?Dg({baseGrammar:s,selfGrammar:i},r):HS(e.ruleName,{baseGrammar:s,selfGrammar:i,repository:i.repository},r);const o=n.injections(e.scopeName);if(o)for(const l of o)r.add(new xf(l))}function HS(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];_v([r],t,n)}}function Dg(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&_v(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&_v(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function _v(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const i=r.repository?Dj({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&_v(r.patterns,{...t,repository:i},n);const s=r.include;if(!s)continue;const o=$j(s);switch(o.kind){case 0:Dg({...t,selfGrammar:t.baseGrammar},n);break;case 1:Dg(t,n);break;case 2:HS(o.ruleName,{...t,repository:i},n);break;case 3:case 4:const l=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(l){const u={baseGrammar:t.baseGrammar,selfGrammar:l,repository:i};o.kind===4?HS(o.ruleName,u,n):Dg(u,n)}else o.kind===4?n.add(new xJ(o.scopeName,o.ruleName)):n.add(new xf(o.scopeName));break}}}var kJ=class{constructor(){Z(this,"kind",0)}},EJ=class{constructor(){Z(this,"kind",1)}},RJ=class{constructor(e){Z(this,"kind",2);this.ruleName=e}},TJ=class{constructor(e){Z(this,"kind",3);this.scopeName=e}},AJ=class{constructor(e,t){Z(this,"kind",4);this.scopeName=e,this.ruleName=t}};function $j(e){if(e==="$base")return new kJ;if(e==="$self")return new EJ;const t=e.indexOf("#");if(t===-1)return new TJ(e);if(t===0)return new RJ(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new AJ(n,r)}}var NJ=/\\(\d+)/,wN=/\\(\d+)/g,MJ=-1,Uj=-2;var tp=class{constructor(e,t,n,r){Z(this,"$location");Z(this,"id");Z(this,"_nameIsCapturing");Z(this,"_name");Z(this,"_contentNameIsCapturing");Z(this,"_contentName");this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Bm.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Bm.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${Ij(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Bm.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Bm.replaceCaptures(this._contentName,e,t)}},LJ=class extends tp{constructor(t,n,r,i,s){super(t,n,r,i);Z(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,r,i){throw new Error("Not supported!")}},DJ=class extends tp{constructor(t,n,r,i,s){super(t,n,r,null);Z(this,"_match");Z(this,"captures");Z(this,"_cachedCompiledPatterns");this._match=new Sf(i,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t).compileAG(t,r,i)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new wf,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},CN=class extends tp{constructor(t,n,r,i,s){super(t,n,r,i);Z(this,"hasMissingPatterns");Z(this,"patterns");Z(this,"_cachedCompiledPatterns");this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,n){for(const r of this.patterns)t.getRule(r).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t).compileAG(t,r,i)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new wf,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},$S=class extends tp{constructor(t,n,r,i,s,o,l,u,d,f){super(t,n,r,i);Z(this,"_begin");Z(this,"beginCaptures");Z(this,"_end");Z(this,"endHasBackReferences");Z(this,"endCaptures");Z(this,"applyEndPatternLast");Z(this,"hasMissingPatterns");Z(this,"patterns");Z(this,"_cachedCompiledPatterns");this._begin=new Sf(s,this.id),this.beginCaptures=o,this._end=new Sf(l||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=u,this.applyEndPatternLast=d||!1,this.patterns=f.patterns,this.hasMissingPatterns=f.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t,n).compileAG(t,r,i)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new wf;for(const r of this.patterns)t.getRule(r).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},yv=class extends tp{constructor(t,n,r,i,s,o,l,u,d){super(t,n,r,i);Z(this,"_begin");Z(this,"beginCaptures");Z(this,"whileCaptures");Z(this,"_while");Z(this,"whileHasBackReferences");Z(this,"hasMissingPatterns");Z(this,"patterns");Z(this,"_cachedCompiledPatterns");Z(this,"_cachedCompiledWhilePatterns");this._begin=new Sf(s,this.id),this.beginCaptures=o,this.whileCaptures=u,this._while=new Sf(l,Uj),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t).compileAG(t,r,i)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new wf;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,r,i){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,r,i)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new wf,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},Vj=class Dr{static createCaptureRule(t,n,r,i,s){return t.registerRule(o=>new LJ(n,o,r,i,s))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new DJ(t.$vscodeTextmateLocation,t.id,t.name,t.match,Dr._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Dj({},r,t.repository));let s=t.patterns;return typeof s>"u"&&t.include&&(s=[{include:t.include}]),new CN(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Dr._compilePatterns(s,n,r))}return t.while?new yv(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Dr._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,Dr._compileCaptures(t.whileCaptures||t.captures,n,r),Dr._compilePatterns(t.patterns,n,r)):new $S(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Dr._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,Dr._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,Dr._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let s=0;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const l=parseInt(o,10);l>s&&(s=l)}for(let o=0;o<=s;o++)i[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const l=parseInt(o,10);let u=0;t[o].patterns&&(u=Dr.getCompiledRuleId(t[o],n,r)),i[l]=Dr.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,u)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let s=0,o=t.length;s<o;s++){const l=t[s];let u=-1;if(l.include){const d=$j(l.include);switch(d.kind){case 0:case 1:u=Dr.getCompiledRuleId(r[l.include],n,r);break;case 2:let f=r[d.ruleName];f&&(u=Dr.getCompiledRuleId(f,n,r));break;case 3:case 4:const h=d.scopeName,g=d.kind===4?d.ruleName:null,b=n.getExternalGrammar(h,r);if(b)if(g){let y=b.repository[g];y&&(u=Dr.getCompiledRuleId(y,n,b.repository))}else u=Dr.getCompiledRuleId(b.repository.$self,n,b.repository);break}}else u=Dr.getCompiledRuleId(l,n,r);if(u!==-1){const d=n.getRule(u);let f=!1;if((d instanceof CN||d instanceof $S||d instanceof yv)&&d.hasMissingPatterns&&d.patterns.length===0&&(f=!0),f)continue;i.push(u)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},Sf=class Wj{constructor(t,n){Z(this,"source");Z(this,"ruleId");Z(this,"hasAnchor");Z(this,"hasBackReferences");Z(this,"_anchorCache");if(t&&typeof t=="string"){const r=t.length;let i=0,s=[],o=!1;for(let l=0;l<r;l++)if(t.charAt(l)==="\\"&&l+1<r){const d=t.charAt(l+1);d==="z"?(s.push(t.substring(i,l)),s.push("$(?!\\n)(?<!\\n)"),i=l+2):(d==="A"||d==="G")&&(o=!0),l++}this.hasAnchor=o,i===0?this.source=t:(s.push(t.substring(i,r)),this.source=s.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=NJ.test(this.source):this.hasBackReferences=!1}clone(){return new Wj(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(i=>t.substring(i.start,i.end));return wN.lastIndex=0,this.source.replace(wN,(i,s)=>jj(r[parseInt(s,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],i=[],s,o,l,u;for(s=0,o=this.source.length;s<o;s++)l=this.source.charAt(s),t[s]=l,n[s]=l,r[s]=l,i[s]=l,l==="\\"&&s+1<o&&(u=this.source.charAt(s+1),u==="A"?(t[s+1]="",n[s+1]="",r[s+1]="A",i[s+1]="A"):u==="G"?(t[s+1]="",n[s+1]="G",r[s+1]="",i[s+1]="G"):(t[s+1]=u,n[s+1]=u,r[s+1]=u,i[s+1]=u),s++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:i.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},wf=class{constructor(){Z(this,"_items");Z(this,"_hasAnchors");Z(this,"_cached");Z(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new kN(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(i=>i.resolveAnchors(t,n));return new kN(e,r,this._items.map(i=>i.ruleId))}},kN=class{constructor(e,t,n){Z(this,"scanner");this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
634
|
+
`},vY={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function bY(e){let{announcements:t=vY,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=gY}=e;const{announce:s,announcement:o}=fY(),l=Qf("DndLiveRegion"),[u,d]=_.useState(!1);if(_.useEffect(()=>{d(!0)},[]),pY(_.useMemo(()=>({onDragStart(h){let{active:g}=h;s(t.onDragStart({active:g}))},onDragMove(h){let{active:g,over:b}=h;t.onDragMove&&s(t.onDragMove({active:g,over:b}))},onDragOver(h){let{active:g,over:b}=h;s(t.onDragOver({active:g,over:b}))},onDragEnd(h){let{active:g,over:b}=h;s(t.onDragEnd({active:g,over:b}))},onDragCancel(h){let{active:g,over:b}=h;s(t.onDragCancel({active:g,over:b}))}}),[s,t])),!u)return null;const f=vn.createElement(vn.Fragment,null,vn.createElement(dY,{id:r,value:i.draggable}),vn.createElement(hY,{id:l,announcement:o}));return n?os.createPortal(f,n):f}var lr;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(lr||(lr={}));function dv(){}function QA(e,t){return _.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function _Y(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const Ms=Object.freeze({x:0,y:0});function yY(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function xY(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function SY(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function wY(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function ZA(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const JA=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=ZA(t,t.left,t.top),s=[];for(const o of r){const{id:l}=o,u=n.get(l);if(u){const d=yY(ZA(u),i);s.push({id:l,data:{droppableContainer:o,value:d}})}}return s.sort(xY)};function CY(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),o=i-r,l=s-n;if(r<i&&n<s){const u=t.width*t.height,d=e.width*e.height,f=o*l,h=f/(u+d-f);return Number(h.toFixed(4))}return 0}const kY=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const s of r){const{id:o}=s,l=n.get(o);if(l){const u=CY(l,t);u>0&&i.push({id:o,data:{droppableContainer:s,value:u}})}}return i.sort(SY)};function EY(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function x5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ms}function RY(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return i.reduce((o,l)=>({...o,top:o.top+e*l.y,bottom:o.bottom+e*l.y,left:o.left+e*l.x,right:o.right+e*l.x}),{...n})}}const TY=RY(1);function AY(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function NY(e,t,n){const r=AY(t);if(!r)return e;const{scaleX:i,scaleY:s,x:o,y:l}=r,u=e.left-o-(1-i)*parseFloat(n),d=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),f=i?e.width/i:e.width,h=s?e.height/s:e.height;return{width:f,height:h,top:d,right:u+f,bottom:d+h,left:u}}const MY={ignoreTransform:!1};function vd(e,t){t===void 0&&(t=MY);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:d,transformOrigin:f}=mi(e).getComputedStyle(e);d&&(n=NY(n,d,f))}const{top:r,left:i,width:s,height:o,bottom:l,right:u}=n;return{top:r,left:i,width:s,height:o,bottom:l,right:u}}function eN(e){return vd(e,{ignoreTransform:!0})}function LY(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function DY(e,t){return t===void 0&&(t=mi(e).getComputedStyle(e)),t.position==="fixed"}function IY(e,t){t===void 0&&(t=mi(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const s=t[i];return typeof s=="string"?n.test(s):!1})}function lC(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(sC(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Yf(i)||b5(i)||n.includes(i))return n;const s=mi(e).getComputedStyle(i);return i!==e&&IY(i,s)&&n.push(i),DY(i,s)?n:r(i.parentNode)}return e?r(e):n}function S5(e){const[t]=lC(e,1);return t??null}function Py(e){return!S0||!e?null:md(e)?e:iC(e)?sC(e)||e===gd(e).scrollingElement?window:Yf(e)?e:null:null}function w5(e){return md(e)?e.scrollX:e.scrollLeft}function C5(e){return md(e)?e.scrollY:e.scrollTop}function RS(e){return{x:w5(e),y:C5(e)}}var pr;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(pr||(pr={}));function k5(e){return!S0||!e?!1:e===document.scrollingElement}function E5(e){const t={x:0,y:0},n=k5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,o=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:i,isLeft:s,isBottom:o,isRight:l,maxScroll:r,minScroll:t}}const PY={x:.2,y:.2};function OY(e,t,n,r,i){let{top:s,left:o,right:l,bottom:u}=n;r===void 0&&(r=10),i===void 0&&(i=PY);const{isTop:d,isBottom:f,isLeft:h,isRight:g}=E5(e),b={x:0,y:0},y={x:0,y:0},x={height:t.height*i.y,width:t.width*i.x};return!d&&s<=t.top+x.height?(b.y=pr.Backward,y.y=r*Math.abs((t.top+x.height-s)/x.height)):!f&&u>=t.bottom-x.height&&(b.y=pr.Forward,y.y=r*Math.abs((t.bottom-x.height-u)/x.height)),!g&&l>=t.right-x.width?(b.x=pr.Forward,y.x=r*Math.abs((t.right-x.width-l)/x.width)):!h&&o<=t.left+x.width&&(b.x=pr.Backward,y.x=r*Math.abs((t.left+x.width-o)/x.width)),{direction:b,speed:y}}function jY(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:o}=window;return{top:0,left:0,right:s,bottom:o,width:s,height:o}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function R5(e){return e.reduce((t,n)=>ju(t,RS(n)),Ms)}function zY(e){return e.reduce((t,n)=>t+w5(n),0)}function BY(e){return e.reduce((t,n)=>t+C5(n),0)}function FY(e,t){if(t===void 0&&(t=vd),!e)return;const{top:n,left:r,bottom:i,right:s}=t(e);S5(e)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const HY=[["x",["left","right"],zY],["y",["top","bottom"],BY]];class cC{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=lC(n),i=R5(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,o,l]of HY)for(const u of o)Object.defineProperty(this,u,{get:()=>{const d=l(r),f=i[s]-d;return this.rect[u]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Xh{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function $Y(e){const{EventTarget:t}=mi(e);return e instanceof t?e:gd(e)}function Oy(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var ts;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(ts||(ts={}));function tN(e){e.preventDefault()}function UY(e){e.stopPropagation()}var on;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(on||(on={}));const T5={start:[on.Space,on.Enter],cancel:[on.Esc],end:[on.Space,on.Enter,on.Tab]},VY=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case on.Right:return{...n,x:n.x+25};case on.Left:return{...n,x:n.x-25};case on.Down:return{...n,y:n.y+25};case on.Up:return{...n,y:n.y-25}}};class uC{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Xh(gd(n)),this.windowListeners=new Xh(mi(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ts.Resize,this.handleCancel),this.windowListeners.add(ts.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ts.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&FY(r),n(Ms)}handleKeyDown(t){if(aC(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=T5,coordinateGetter:o=VY,scrollBehavior:l="smooth"}=i,{code:u}=t;if(s.end.includes(u)){this.handleEnd(t);return}if(s.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:d}=r.current,f=d?{x:d.left,y:d.top}:Ms;this.referenceCoordinates||(this.referenceCoordinates=f);const h=o(t,{active:n,context:r.current,currentCoordinates:f});if(h){const g=uv(h,f),b={x:0,y:0},{scrollableAncestors:y}=r.current;for(const x of y){const w=t.code,{isTop:C,isRight:R,isLeft:E,isBottom:T,maxScroll:A,minScroll:N}=E5(x),L=jY(x),P={x:Math.min(w===on.Right?L.right-L.width/2:L.right,Math.max(w===on.Right?L.left:L.left+L.width/2,h.x)),y:Math.min(w===on.Down?L.bottom-L.height/2:L.bottom,Math.max(w===on.Down?L.top:L.top+L.height/2,h.y))},G=w===on.Right&&!R||w===on.Left&&!E,O=w===on.Down&&!T||w===on.Up&&!C;if(G&&P.x!==h.x){const B=x.scrollLeft+g.x,H=w===on.Right&&B<=A.x||w===on.Left&&B>=N.x;if(H&&!g.y){x.scrollTo({left:B,behavior:l});return}H?b.x=x.scrollLeft-B:b.x=w===on.Right?x.scrollLeft-A.x:x.scrollLeft-N.x,b.x&&x.scrollBy({left:-b.x,behavior:l});break}else if(O&&P.y!==h.y){const B=x.scrollTop+g.y,H=w===on.Down&&B<=A.y||w===on.Up&&B>=N.y;if(H&&!g.x){x.scrollTo({top:B,behavior:l});return}H?b.y=x.scrollTop-B:b.y=w===on.Down?x.scrollTop-A.y:x.scrollTop-N.y,b.y&&x.scrollBy({top:-b.y,behavior:l});break}}this.handleMove(t,ju(uv(h,this.referenceCoordinates),b))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}uC.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=T5,onActivation:i}=t,{active:s}=n;const{code:o}=e.nativeEvent;if(r.start.includes(o)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function nN(e){return!!(e&&"distance"in e)}function rN(e){return!!(e&&"delay"in e)}class dC{constructor(t,n,r){var i;r===void 0&&(r=$Y(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:o}=s;this.props=t,this.events=n,this.document=gd(o),this.documentListeners=new Xh(this.document),this.listeners=new Xh(r),this.windowListeners=new Xh(mi(o)),this.initialCoordinates=(i=ES(s))!=null?i:Ms,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(ts.Resize,this.handleCancel),this.windowListeners.add(ts.DragStart,tN),this.windowListeners.add(ts.VisibilityChange,this.handleCancel),this.windowListeners.add(ts.ContextMenu,tN),this.documentListeners.add(ts.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(rN(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(nN(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(ts.Click,UY,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ts.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:s}=this,{onMove:o,options:{activationConstraint:l}}=s;if(!i)return;const u=(n=ES(t))!=null?n:Ms,d=uv(i,u);if(!r&&l){if(nN(l)){if(l.tolerance!=null&&Oy(d,l.tolerance))return this.handleCancel();if(Oy(d,l.distance))return this.handleStart()}if(rN(l)&&Oy(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}t.cancelable&&t.preventDefault(),o(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===on.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const WY={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class hC extends dC{constructor(t){const{event:n}=t,r=gd(n.target);super(t,WY,r)}}hC.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const GY={move:{name:"mousemove"},end:{name:"mouseup"}};var TS;(function(e){e[e.RightClick=2]="RightClick"})(TS||(TS={}));class qY extends dC{constructor(t){super(t,GY,gd(t.event.target))}}qY.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===TS.RightClick?!1:(r==null||r({event:n}),!0)}}];const jy={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class KY extends dC{constructor(t){super(t,jy)}static setup(){return window.addEventListener(jy.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(jy.move.name,t)};function t(){}}}KY.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var Qh;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Qh||(Qh={}));var hv;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(hv||(hv={}));function YY(e){let{acceleration:t,activator:n=Qh.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:o=5,order:l=hv.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:f,delta:h,threshold:g}=e;const b=QY({delta:h,disabled:!s}),[y,x]=oY(),w=_.useRef({x:0,y:0}),C=_.useRef({x:0,y:0}),R=_.useMemo(()=>{switch(n){case Qh.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Qh.DraggableRect:return i}},[n,i,u]),E=_.useRef(null),T=_.useCallback(()=>{const N=E.current;if(!N)return;const L=w.current.x*C.current.x,P=w.current.y*C.current.y;N.scrollBy(L,P)},[]),A=_.useMemo(()=>l===hv.TreeOrder?[...d].reverse():d,[l,d]);_.useEffect(()=>{if(!s||!d.length||!R){x();return}for(const N of A){if((r==null?void 0:r(N))===!1)continue;const L=d.indexOf(N),P=f[L];if(!P)continue;const{direction:G,speed:O}=OY(N,P,R,t,g);for(const B of["x","y"])b[B][G[B]]||(O[B]=0,G[B]=0);if(O.x>0||O.y>0){x(),E.current=N,y(T,o),w.current=O,C.current=G;return}}w.current={x:0,y:0},C.current={x:0,y:0},x()},[t,T,r,x,s,o,JSON.stringify(R),JSON.stringify(b),y,d,A,f,JSON.stringify(g)])}const XY={x:{[pr.Backward]:!1,[pr.Forward]:!1},y:{[pr.Backward]:!1,[pr.Forward]:!1}};function QY(e){let{delta:t,disabled:n}=e;const r=kS(t);return Xf(i=>{if(n||!r||!i)return XY;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[pr.Backward]:i.x[pr.Backward]||s.x===-1,[pr.Forward]:i.x[pr.Forward]||s.x===1},y:{[pr.Backward]:i.y[pr.Backward]||s.y===-1,[pr.Forward]:i.y[pr.Forward]||s.y===1}}},[n,t,r])}function ZY(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Xf(i=>{var s;return t==null?null:(s=r??i)!=null?s:null},[r,t])}function JY(e,t){return _.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,s=i.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,r)}));return[...n,...s]},[]),[e,t])}var mf;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(mf||(mf={}));var AS;(function(e){e.Optimized="optimized"})(AS||(AS={}));const iN=new Map;function eX(e,t){let{dragging:n,dependencies:r,config:i}=t;const[s,o]=_.useState(null),{frequency:l,measure:u,strategy:d}=i,f=_.useRef(e),h=w(),g=ff(h),b=_.useCallback(function(C){C===void 0&&(C=[]),!g.current&&o(R=>R===null?C:R.concat(C.filter(E=>!R.includes(E))))},[g]),y=_.useRef(null),x=Xf(C=>{if(h&&!n)return iN;if(!C||C===iN||f.current!==e||s!=null){const R=new Map;for(let E of e){if(!E)continue;if(s&&s.length>0&&!s.includes(E.id)&&E.rect.current){R.set(E.id,E.rect.current);continue}const T=E.node.current,A=T?new cC(u(T),T):null;E.rect.current=A,A&&R.set(E.id,A)}return R}return C},[e,s,n,h,u]);return _.useEffect(()=>{f.current=e},[e]),_.useEffect(()=>{h||b()},[n,h]),_.useEffect(()=>{s&&s.length>0&&o(null)},[JSON.stringify(s)]),_.useEffect(()=>{h||typeof l!="number"||y.current!==null||(y.current=setTimeout(()=>{b(),y.current=null},l))},[l,h,b,...r]),{droppableRects:x,measureDroppableContainers:b,measuringScheduled:s!=null};function w(){switch(d){case mf.Always:return!1;case mf.BeforeDragging:return n;default:return!n}}}function A5(e,t){return Xf(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function tX(e,t){return A5(e,t)}function nX(e){let{callback:t,disabled:n}=e;const r=oC(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return _.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function w0(e){let{callback:t,disabled:n}=e;const r=oC(t),i=_.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return _.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function rX(e){return new cC(vd(e),e)}function sN(e,t,n){t===void 0&&(t=rX);const[r,i]=_.useState(null);function s(){i(u=>{if(!e)return null;if(e.isConnected===!1){var d;return(d=u??n)!=null?d:null}const f=t(e);return JSON.stringify(u)===JSON.stringify(f)?u:f})}const o=nX({callback(u){if(e)for(const d of u){const{type:f,target:h}=d;if(f==="childList"&&h instanceof HTMLElement&&h.contains(e)){s();break}}}}),l=w0({callback:s});return io(()=>{s(),e?(l==null||l.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),o==null||o.disconnect())},[e]),r}function iX(e){const t=A5(e);return x5(e,t)}const oN=[];function sX(e){const t=_.useRef(e),n=Xf(r=>e?r&&r!==oN&&e&&t.current&&e.parentNode===t.current.parentNode?r:lC(e):oN,[e]);return _.useEffect(()=>{t.current=e},[e]),n}function oX(e){const[t,n]=_.useState(null),r=_.useRef(e),i=_.useCallback(s=>{const o=Py(s.target);o&&n(l=>l?(l.set(o,RS(o)),new Map(l)):null)},[]);return _.useEffect(()=>{const s=r.current;if(e!==s){o(s);const l=e.map(u=>{const d=Py(u);return d?(d.addEventListener("scroll",i,{passive:!0}),[d,RS(d)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{o(e),o(s)};function o(l){l.forEach(u=>{const d=Py(u);d==null||d.removeEventListener("scroll",i)})}},[i,e]),_.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,o)=>ju(s,o),Ms):R5(e):Ms,[e,t])}function aN(e,t){t===void 0&&(t=[]);const n=_.useRef(null);return _.useEffect(()=>{n.current=null},t),_.useEffect(()=>{const r=e!==Ms;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?uv(e,n.current):Ms}function aX(e){_.useEffect(()=>{if(!S0)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function lX(e,t){return _.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=o=>{s(o,t)},n},{}),[e,t])}function N5(e){return _.useMemo(()=>e?LY(e):null,[e])}const lN=[];function cX(e,t){t===void 0&&(t=vd);const[n]=e,r=N5(n?mi(n):null),[i,s]=_.useState(lN);function o(){s(()=>e.length?e.map(u=>k5(u)?r:new cC(t(u),u)):lN)}const l=w0({callback:o});return io(()=>{l==null||l.disconnect(),o(),e.forEach(u=>l==null?void 0:l.observe(u))},[e]),i}function uX(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Yf(t)?t:e}function dX(e){let{measure:t}=e;const[n,r]=_.useState(null),i=_.useCallback(d=>{for(const{target:f}of d)if(Yf(f)){r(h=>{const g=t(f);return h?{...h,width:g.width,height:g.height}:g});break}},[t]),s=w0({callback:i}),o=_.useCallback(d=>{const f=uX(d);s==null||s.disconnect(),f&&(s==null||s.observe(f)),r(f?t(f):null)},[t,s]),[l,u]=cv(o);return _.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const hX=[{sensor:hC,options:{}},{sensor:uC,options:{}}],fX={current:{}},Ng={draggable:{measure:eN},droppable:{measure:eN,strategy:mf.WhileDragging,frequency:AS.Optimized},dragOverlay:{measure:vd}};class Zh extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const pX={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Zh,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:dv},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ng,measureDroppableContainers:dv,windowRect:null,measuringScheduled:!1},mX={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dv,draggableNodes:new Map,over:null,measureDroppableContainers:dv},C0=_.createContext(mX),M5=_.createContext(pX);function gX(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Zh}}}function vX(e,t){switch(t.type){case lr.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case lr.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case lr.DragEnd:case lr.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case lr.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Zh(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case lr.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const o=new Zh(e.droppable.containers);return o.set(n,{...s,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case lr.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new Zh(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function bX(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=_.useContext(C0),s=kS(r),o=kS(n==null?void 0:n.id);return _.useEffect(()=>{if(!t&&!r&&s&&o!=null){if(!aC(s)||document.activeElement===s.target)return;const l=i.get(o);if(!l)return;const{activatorNode:u,node:d}=l;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const f of[u.current,d.current]){if(!f)continue;const h=cY(f);if(h){h.focus();break}}})}},[r,t,i,o,s]),null}function _X(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,s)=>s({transform:i,...r}),n):n}function yX(e){return _.useMemo(()=>({draggable:{...Ng.draggable,...e==null?void 0:e.draggable},droppable:{...Ng.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Ng.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function xX(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const s=_.useRef(!1),{x:o,y:l}=typeof i=="boolean"?{x:i,y:i}:i;io(()=>{if(!o&&!l||!t){s.current=!1;return}if(s.current||!r)return;const d=t==null?void 0:t.node.current;if(!d||d.isConnected===!1)return;const f=n(d),h=x5(f,r);if(o||(h.x=0),l||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=S5(d);g&&g.scrollBy({top:h.y,left:h.x})}},[t,o,l,r,n])}const L5=_.createContext({...Ms,scaleX:1,scaleY:1});var ja;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ja||(ja={}));const SX=_.memo(function(t){var n,r,i,s;let{id:o,accessibility:l,autoScroll:u=!0,children:d,sensors:f=hX,collisionDetection:h=kY,measuring:g,modifiers:b,...y}=t;const x=_.useReducer(vX,void 0,gX),[w,C]=x,[R,E]=mY(),[T,A]=_.useState(ja.Uninitialized),N=T===ja.Initialized,{draggable:{active:L,nodes:P,translate:G},droppable:{containers:O}}=w,B=L!=null?P.get(L):null,H=_.useRef({initial:null,translated:null}),j=_.useMemo(()=>{var at;return L!=null?{id:L,data:(at=B==null?void 0:B.data)!=null?at:fX,rect:H}:null},[L,B]),$=_.useRef(null),[V,z]=_.useState(null),[q,F]=_.useState(null),Y=ff(y,Object.values(y)),I=Qf("DndDescribedBy",o),U=_.useMemo(()=>O.getEnabled(),[O]),X=yX(g),{droppableRects:D,measureDroppableContainers:te,measuringScheduled:Q}=eX(U,{dragging:N,dependencies:[G.x,G.y],config:X.droppable}),ne=ZY(P,L),re=_.useMemo(()=>q?ES(q):null,[q]),pe=Rt(),ce=tX(ne,X.draggable.measure);xX({activeNode:L!=null?P.get(L):null,config:pe.layoutShiftCompensation,initialRect:ce,measure:X.draggable.measure});const ge=sN(ne,X.draggable.measure,ce),ue=sN(ne?ne.parentElement:null),ke=_.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:D,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ae=O.getNodeFor((n=ke.current.over)==null?void 0:n.id),ze=dX({measure:X.dragOverlay.measure}),Ge=(r=ze.nodeRef.current)!=null?r:ne,Et=N?(i=ze.rect)!=null?i:ge:null,zt=!!(ze.nodeRef.current&&ze.rect),Ct=iX(zt?null:ge),Pe=N5(Ge?mi(Ge):null),nt=sX(N?Ae??ne:null),He=cX(nt),Ze=_X(b,{transform:{x:G.x-Ct.x,y:G.y-Ct.y,scaleX:1,scaleY:1},activatorEvent:q,active:j,activeNodeRect:ge,containerNodeRect:ue,draggingNodeRect:Et,over:ke.current.over,overlayNodeRect:ze.rect,scrollableAncestors:nt,scrollableAncestorRects:He,windowRect:Pe}),pt=re?ju(re,G):null,mt=oX(nt),en=aN(mt),me=aN(mt,[ge]),Se=ju(Ze,en),Be=Et?TY(Et,Ze):null,Le=j&&Be?h({active:j,collisionRect:Be,droppableRects:D,droppableContainers:U,pointerCoordinates:pt}):null,ut=wY(Le,"id"),[Oe,Bt]=_.useState(null),_t=zt?Ze:ju(Ze,me),Pt=EY(_t,(s=Oe==null?void 0:Oe.rect)!=null?s:null,ge),Ft=_.useRef(null),je=_.useCallback((at,tt)=>{let{sensor:Tt,options:gt}=tt;if($.current==null)return;const Ee=P.get($.current);if(!Ee)return;const vt=at.nativeEvent,ln=new Tt({active:$.current,activeNode:Ee,event:vt,options:gt,context:ke,onAbort(rt){if(!P.get(rt))return;const{onDragAbort:it}=Y.current,kt={id:rt};it==null||it(kt),R({type:"onDragAbort",event:kt})},onPending(rt,We,it,kt){if(!P.get(rt))return;const{onDragPending:qe}=Y.current,Ne={id:rt,constraint:We,initialCoordinates:it,offset:kt};qe==null||qe(Ne),R({type:"onDragPending",event:Ne})},onStart(rt){const We=$.current;if(We==null)return;const it=P.get(We);if(!it)return;const{onDragStart:kt}=Y.current,_e={activatorEvent:vt,active:{id:We,data:it.data,rect:H}};os.unstable_batchedUpdates(()=>{kt==null||kt(_e),A(ja.Initializing),C({type:lr.DragStart,initialCoordinates:rt,active:We}),R({type:"onDragStart",event:_e}),z(Ft.current),F(vt)})},onMove(rt){C({type:lr.DragMove,coordinates:rt})},onEnd:Re(lr.DragEnd),onCancel:Re(lr.DragCancel)});Ft.current=ln;function Re(rt){return async function(){const{active:it,collisions:kt,over:_e,scrollAdjustedTranslate:qe}=ke.current;let Ne=null;if(it&&qe){const{cancelDrop:Ot}=Y.current;Ne={activatorEvent:vt,active:it,collisions:kt,delta:qe,over:_e},rt===lr.DragEnd&&typeof Ot=="function"&&await Promise.resolve(Ot(Ne))&&(rt=lr.DragCancel)}$.current=null,os.unstable_batchedUpdates(()=>{C({type:rt}),A(ja.Uninitialized),Bt(null),z(null),F(null),Ft.current=null;const Ot=rt===lr.DragEnd?"onDragEnd":"onDragCancel";if(Ne){const xt=Y.current[Ot];xt==null||xt(Ne),R({type:Ot,event:Ne})}})}}},[P]),yt=_.useCallback((at,tt)=>(Tt,gt)=>{const Ee=Tt.nativeEvent,vt=P.get(gt);if($.current!==null||!vt||Ee.dndKit||Ee.defaultPrevented)return;const ln={active:vt};at(Tt,tt.options,ln)===!0&&(Ee.dndKit={capturedBy:tt.sensor},$.current=gt,je(Tt,tt))},[P,je]),le=JY(f,yt);aX(f),io(()=>{ge&&T===ja.Initializing&&A(ja.Initialized)},[ge,T]),_.useEffect(()=>{const{onDragMove:at}=Y.current,{active:tt,activatorEvent:Tt,collisions:gt,over:Ee}=ke.current;if(!tt||!Tt)return;const vt={active:tt,activatorEvent:Tt,collisions:gt,delta:{x:Se.x,y:Se.y},over:Ee};os.unstable_batchedUpdates(()=>{at==null||at(vt),R({type:"onDragMove",event:vt})})},[Se.x,Se.y]),_.useEffect(()=>{const{active:at,activatorEvent:tt,collisions:Tt,droppableContainers:gt,scrollAdjustedTranslate:Ee}=ke.current;if(!at||$.current==null||!tt||!Ee)return;const{onDragOver:vt}=Y.current,ln=gt.get(ut),Re=ln&&ln.rect.current?{id:ln.id,rect:ln.rect.current,data:ln.data,disabled:ln.disabled}:null,rt={active:at,activatorEvent:tt,collisions:Tt,delta:{x:Ee.x,y:Ee.y},over:Re};os.unstable_batchedUpdates(()=>{Bt(Re),vt==null||vt(rt),R({type:"onDragOver",event:rt})})},[ut]),io(()=>{ke.current={activatorEvent:q,active:j,activeNode:ne,collisionRect:Be,collisions:Le,droppableRects:D,draggableNodes:P,draggingNode:Ge,draggingNodeRect:Et,droppableContainers:O,over:Oe,scrollableAncestors:nt,scrollAdjustedTranslate:Se},H.current={initial:Et,translated:Be}},[j,ne,Le,Be,P,Ge,Et,D,O,Oe,nt,Se]),YY({...pe,delta:G,draggingRect:Be,pointerCoordinates:pt,scrollableAncestors:nt,scrollableAncestorRects:He});const $e=_.useMemo(()=>({active:j,activeNode:ne,activeNodeRect:ge,activatorEvent:q,collisions:Le,containerNodeRect:ue,dragOverlay:ze,draggableNodes:P,droppableContainers:O,droppableRects:D,over:Oe,measureDroppableContainers:te,scrollableAncestors:nt,scrollableAncestorRects:He,measuringConfiguration:X,measuringScheduled:Q,windowRect:Pe}),[j,ne,ge,q,Le,ue,ze,P,O,D,Oe,te,nt,He,X,Q,Pe]),et=_.useMemo(()=>({activatorEvent:q,activators:le,active:j,activeNodeRect:ge,ariaDescribedById:{draggable:I},dispatch:C,draggableNodes:P,over:Oe,measureDroppableContainers:te}),[q,le,j,ge,C,I,P,Oe,te]);return vn.createElement(y5.Provider,{value:E},vn.createElement(C0.Provider,{value:et},vn.createElement(M5.Provider,{value:$e},vn.createElement(L5.Provider,{value:Pt},d)),vn.createElement(bX,{disabled:(l==null?void 0:l.restoreFocus)===!1})),vn.createElement(bY,{...l,hiddenTextDescribedById:I}));function Rt(){const at=(V==null?void 0:V.autoScrollEnabled)===!1,tt=typeof u=="object"?u.enabled===!1:u===!1,Tt=N&&!at&&!tt;return typeof u=="object"?{...u,enabled:Tt}:{enabled:Tt}}}),wX=_.createContext(null),cN="button",CX="Draggable";function kX(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const s=Qf(CX),{activators:o,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:f,draggableNodes:h,over:g}=_.useContext(C0),{role:b=cN,roleDescription:y="draggable",tabIndex:x=0}=i??{},w=(u==null?void 0:u.id)===t,C=_.useContext(w?L5:wX),[R,E]=cv(),[T,A]=cv(),N=lX(o,t),L=ff(n);io(()=>(h.set(t,{id:t,key:s,node:R,activatorNode:T,data:L}),()=>{const G=h.get(t);G&&G.key===s&&h.delete(t)}),[h,t]);const P=_.useMemo(()=>({role:b,tabIndex:x,"aria-disabled":r,"aria-pressed":w&&b===cN?!0:void 0,"aria-roledescription":y,"aria-describedby":f.draggable}),[r,b,x,w,y,f.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:P,isDragging:w,listeners:r?void 0:N,node:R,over:g,setNodeRef:E,setActivatorNodeRef:A,transform:C}}function EX(){return _.useContext(M5)}const RX="Droppable",TX={timeout:25};function AX(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const s=Qf(RX),{active:o,dispatch:l,over:u,measureDroppableContainers:d}=_.useContext(C0),f=_.useRef({disabled:n}),h=_.useRef(!1),g=_.useRef(null),b=_.useRef(null),{disabled:y,updateMeasurementsFor:x,timeout:w}={...TX,...i},C=ff(x??r),R=_.useCallback(()=>{if(!h.current){h.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{d(Array.isArray(C.current)?C.current:[C.current]),b.current=null},w)},[w]),E=w0({callback:R,disabled:y||!o}),T=_.useCallback((P,G)=>{E&&(G&&(E.unobserve(G),h.current=!1),P&&E.observe(P))},[E]),[A,N]=cv(T),L=ff(t);return _.useEffect(()=>{!E||!A.current||(E.disconnect(),h.current=!1,E.observe(A.current))},[A,E]),_.useEffect(()=>(l({type:lr.RegisterDroppable,element:{id:r,key:s,disabled:n,node:A,rect:g,data:L}}),()=>l({type:lr.UnregisterDroppable,key:s,id:r})),[r]),_.useEffect(()=>{n!==f.current.disabled&&(l({type:lr.SetDroppableDisabled,id:r,key:s,disabled:n}),f.current.disabled=n)},[r,s,n,l]),{active:o,rect:g,isOver:(u==null?void 0:u.id)===r,node:A,over:u,setNodeRef:N}}function fC(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function NX(e,t){return e.reduce((n,r,i)=>{const s=t.get(r);return s&&(n[i]=s),n},Array(e.length))}function Om(e){return e!==null&&e>=0}function MX(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function LX(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const D5=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const s=fC(t,r,n),o=t[i],l=s[i];return!l||!o?null:{x:l.left-o.left,y:l.top-o.top,scaleX:l.width/o.width,scaleY:l.height/o.height}},jm={scaleX:1,scaleY:1},DX=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:s,overIndex:o}=e;const l=(t=s[n])!=null?t:r;if(!l)return null;if(i===n){const d=s[o];return d?{x:0,y:n<o?d.top+d.height-(l.top+l.height):d.top-l.top,...jm}:null}const u=IX(s,i,n);return i>n&&i<=o?{x:0,y:-l.height-u,...jm}:i<n&&i>=o?{x:0,y:l.height+u,...jm}:{x:0,y:0,...jm}};function IX(e,t,n){const r=e[t],i=e[t-1],s=e[t+1];return r?n<t?i?r.top-(i.top+i.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const I5="Sortable",P5=vn.createContext({activeIndex:-1,containerId:I5,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:D5,disabled:{draggable:!1,droppable:!1}});function PX(e){let{children:t,id:n,items:r,strategy:i=D5,disabled:s=!1}=e;const{active:o,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:f}=EX(),h=Qf(I5,n),g=l.rect!==null,b=_.useMemo(()=>r.map(N=>typeof N=="object"&&"id"in N?N.id:N),[r]),y=o!=null,x=o?b.indexOf(o.id):-1,w=d?b.indexOf(d.id):-1,C=_.useRef(b),R=!MX(b,C.current),E=w!==-1&&x===-1||R,T=LX(s);io(()=>{R&&y&&f(b)},[R,b,y,f]),_.useEffect(()=>{C.current=b},[b]);const A=_.useMemo(()=>({activeIndex:x,containerId:h,disabled:T,disableTransforms:E,items:b,overIndex:w,useDragOverlay:g,sortedRects:NX(b,u),strategy:i}),[x,h,T.draggable,T.droppable,E,b,w,u,g,i]);return vn.createElement(P5.Provider,{value:A},t)}const OX=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return fC(n,r,i).indexOf(t)},jX=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:s,newIndex:o,previousItems:l,previousContainerId:u,transition:d}=e;return!d||!r||l!==s&&i===o?!1:n?!0:o!==i&&t===u},zX={duration:200,easing:"ease"},O5="transform",BX=pf.Transition.toString({property:O5,duration:0,easing:"linear"}),FX={roleDescription:"sortable"};function HX(e){let{disabled:t,index:n,node:r,rect:i}=e;const[s,o]=_.useState(null),l=_.useRef(n);return io(()=>{if(!t&&n!==l.current&&r.current){const u=i.current;if(u){const d=vd(r.current,{ignoreTransform:!0}),f={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(f.x||f.y)&&o(f)}}n!==l.current&&(l.current=n)},[t,n,r,i]),_.useEffect(()=>{s&&o(null)},[s]),s}function $X(e){let{animateLayoutChanges:t=jX,attributes:n,disabled:r,data:i,getNewIndex:s=OX,id:o,strategy:l,resizeObserverConfig:u,transition:d=zX}=e;const{items:f,containerId:h,activeIndex:g,disabled:b,disableTransforms:y,sortedRects:x,overIndex:w,useDragOverlay:C,strategy:R}=_.useContext(P5),E=UX(r,b),T=f.indexOf(o),A=_.useMemo(()=>({sortable:{containerId:h,index:T,items:f},...i}),[h,i,T,f]),N=_.useMemo(()=>f.slice(f.indexOf(o)),[f,o]),{rect:L,node:P,isOver:G,setNodeRef:O}=AX({id:o,data:A,disabled:E.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...u}}),{active:B,activatorEvent:H,activeNodeRect:j,attributes:$,setNodeRef:V,listeners:z,isDragging:q,over:F,setActivatorNodeRef:Y,transform:I}=kX({id:o,data:A,attributes:{...FX,...n},disabled:E.draggable}),U=sY(O,V),X=!!B,D=X&&!y&&Om(g)&&Om(w),te=!C&&q,Q=te&&D?I:null,re=D?Q??(l??R)({rects:x,activeNodeRect:j,activeIndex:g,overIndex:w,index:T}):null,pe=Om(g)&&Om(w)?s({id:o,items:f,activeIndex:g,overIndex:w}):T,ce=B==null?void 0:B.id,ge=_.useRef({activeId:ce,items:f,newIndex:pe,containerId:h}),ue=f!==ge.current.items,ke=t({active:B,containerId:h,isDragging:q,isSorting:X,id:o,index:T,items:f,newIndex:ge.current.newIndex,previousItems:ge.current.items,previousContainerId:ge.current.containerId,transition:d,wasDragging:ge.current.activeId!=null}),Ae=HX({disabled:!ke,index:T,node:P,rect:L});return _.useEffect(()=>{X&&ge.current.newIndex!==pe&&(ge.current.newIndex=pe),h!==ge.current.containerId&&(ge.current.containerId=h),f!==ge.current.items&&(ge.current.items=f)},[X,pe,h,f]),_.useEffect(()=>{if(ce===ge.current.activeId)return;if(ce!=null&&ge.current.activeId==null){ge.current.activeId=ce;return}const Ge=setTimeout(()=>{ge.current.activeId=ce},50);return()=>clearTimeout(Ge)},[ce]),{active:B,activeIndex:g,attributes:$,data:A,rect:L,index:T,newIndex:pe,items:f,isOver:G,isSorting:X,isDragging:q,listeners:z,node:P,overIndex:w,over:F,setNodeRef:U,setActivatorNodeRef:Y,setDroppableNodeRef:O,setDraggableNodeRef:V,transform:Ae??re,transition:ze()};function ze(){if(Ae||ue&&ge.current.newIndex===T)return BX;if(!(te&&!aC(H)||!d)&&(X||ke))return pf.Transition.toString({...d,property:O5})}}function UX(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}on.Down,on.Right,on.Up,on.Left;function pC(e){const t=e+"CollectionProvider",[n,r]=qo(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=x=>{const{scope:w,children:C}=x,R=vn.useRef(null),E=vn.useRef(new Map).current;return m.jsx(i,{scope:w,itemMap:E,collectionRef:R,children:C})};o.displayName=t;const l=e+"CollectionSlot",u=Ql(l),d=vn.forwardRef((x,w)=>{const{scope:C,children:R}=x,E=s(l,C),T=an(w,E.collectionRef);return m.jsx(u,{ref:T,children:R})});d.displayName=l;const f=e+"CollectionItemSlot",h="data-radix-collection-item",g=Ql(f),b=vn.forwardRef((x,w)=>{const{scope:C,children:R,...E}=x,T=vn.useRef(null),A=an(w,T),N=s(f,C);return vn.useEffect(()=>(N.itemMap.set(T,{ref:T,...E}),()=>void N.itemMap.delete(T))),m.jsx(g,{[h]:"",ref:A,children:R})});b.displayName=f;function y(x){const w=s(e+"CollectionConsumer",x);return vn.useCallback(()=>{const R=w.collectionRef.current;if(!R)return[];const E=Array.from(R.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((N,L)=>E.indexOf(N.ref.current)-E.indexOf(L.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:o,Slot:d,ItemSlot:b},y,r]}var VX=_.createContext(void 0);function mC(e){const t=_.useContext(VX);return e||t||"ltr"}var zy="rovingFocusGroup.onEntryFocus",WX={bubbles:!1,cancelable:!0},Zf="RovingFocusGroup",[NS,j5,GX]=pC(Zf),[qX,z5]=qo(Zf,[GX]),[KX,YX]=qX(Zf),B5=_.forwardRef((e,t)=>m.jsx(NS.Provider,{scope:e.__scopeRovingFocusGroup,children:m.jsx(NS.Slot,{scope:e.__scopeRovingFocusGroup,children:m.jsx(XX,{...e,ref:t})})}));B5.displayName=Zf;var XX=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=e,g=_.useRef(null),b=an(t,g),y=mC(s),[x,w]=Gu({prop:o,defaultProp:l??null,onChange:u,caller:Zf}),[C,R]=_.useState(!1),E=Ts(d),T=j5(n),A=_.useRef(!1),[N,L]=_.useState(0);return _.useEffect(()=>{const P=g.current;if(P)return P.addEventListener(zy,E),()=>P.removeEventListener(zy,E)},[E]),m.jsx(KX,{scope:n,orientation:r,dir:y,loop:i,currentTabStopId:x,onItemFocus:_.useCallback(P=>w(P),[w]),onItemShiftTab:_.useCallback(()=>R(!0),[]),onFocusableItemAdd:_.useCallback(()=>L(P=>P+1),[]),onFocusableItemRemove:_.useCallback(()=>L(P=>P-1),[]),children:m.jsx(Kt.div,{tabIndex:C||N===0?-1:0,"data-orientation":r,...h,ref:b,style:{outline:"none",...e.style},onMouseDown:Ve(e.onMouseDown,()=>{A.current=!0}),onFocus:Ve(e.onFocus,P=>{const G=!A.current;if(P.target===P.currentTarget&&G&&!C){const O=new CustomEvent(zy,WX);if(P.currentTarget.dispatchEvent(O),!O.defaultPrevented){const B=T().filter(z=>z.focusable),H=B.find(z=>z.active),j=B.find(z=>z.id===x),V=[H,j,...B].filter(Boolean).map(z=>z.ref.current);$5(V,f)}}A.current=!1}),onBlur:Ve(e.onBlur,()=>R(!1))})})}),F5="RovingFocusGroupItem",H5=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...l}=e,u=zo(),d=s||u,f=YX(F5,n),h=f.currentTabStopId===d,g=j5(n),{onFocusableItemAdd:b,onFocusableItemRemove:y,currentTabStopId:x}=f;return _.useEffect(()=>{if(r)return b(),()=>y()},[r,b,y]),m.jsx(NS.ItemSlot,{scope:n,id:d,focusable:r,active:i,children:m.jsx(Kt.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:Ve(e.onMouseDown,w=>{r?f.onItemFocus(d):w.preventDefault()}),onFocus:Ve(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:Ve(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){f.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const C=JX(w,f.orientation,f.dir);if(C!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let E=g().filter(T=>T.focusable).map(T=>T.ref.current);if(C==="last")E.reverse();else if(C==="prev"||C==="next"){C==="prev"&&E.reverse();const T=E.indexOf(w.currentTarget);E=f.loop?eQ(E,T+1):E.slice(T+1)}setTimeout(()=>$5(E))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:x!=null}):o})})});H5.displayName=F5;var QX={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ZX(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function JX(e,t,n){const r=ZX(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return QX[r]}function $5(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function eQ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var tQ=B5,nQ=H5,MS=["Enter"," "],rQ=["ArrowDown","PageUp","Home"],U5=["ArrowUp","PageDown","End"],iQ=[...rQ,...U5],sQ={ltr:[...MS,"ArrowRight"],rtl:[...MS,"ArrowLeft"]},oQ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Jf="Menu",[gf,aQ,lQ]=pC(Jf),[bc,V5]=qo(Jf,[lQ,il,z5]),k0=il(),W5=z5(),[cQ,_c]=bc(Jf),[uQ,ep]=bc(Jf),G5=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,l=k0(t),[u,d]=_.useState(null),f=_.useRef(!1),h=Ts(s),g=mC(i);return _.useEffect(()=>{const b=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),m.jsx(g0,{...l,children:m.jsx(cQ,{scope:t,open:n,onOpenChange:h,content:u,onContentChange:d,children:m.jsx(uQ,{scope:t,onClose:_.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:g,modal:o,children:r})})})};G5.displayName=Jf;var dQ="MenuAnchor",gC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=k0(n);return m.jsx(qf,{...i,...r,ref:t})});gC.displayName=dQ;var vC="MenuPortal",[hQ,q5]=bc(vC,{forceMount:void 0}),K5=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=_c(vC,t);return m.jsx(hQ,{scope:t,forceMount:n,children:m.jsx(ps,{present:n||s.open,children:m.jsx(dd,{asChild:!0,container:i,children:r})})})};K5.displayName=vC;var ls="MenuContent",[fQ,bC]=bc(ls),Y5=_.forwardRef((e,t)=>{const n=q5(ls,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=_c(ls,e.__scopeMenu),o=ep(ls,e.__scopeMenu);return m.jsx(gf.Provider,{scope:e.__scopeMenu,children:m.jsx(ps,{present:r||s.open,children:m.jsx(gf.Slot,{scope:e.__scopeMenu,children:o.modal?m.jsx(pQ,{...i,ref:t}):m.jsx(mQ,{...i,ref:t})})})})}),pQ=_.forwardRef((e,t)=>{const n=_c(ls,e.__scopeMenu),r=_.useRef(null),i=an(t,r);return _.useEffect(()=>{const s=r.current;if(s)return c0(s)},[]),m.jsx(_C,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ve(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),mQ=_.forwardRef((e,t)=>{const n=_c(ls,e.__scopeMenu);return m.jsx(_C,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),gQ=Ql("MenuContent.ScrollLock"),_C=_.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:b,disableOutsideScroll:y,...x}=e,w=_c(ls,n),C=ep(ls,n),R=k0(n),E=W5(n),T=aQ(n),[A,N]=_.useState(null),L=_.useRef(null),P=an(t,L,w.onContentChange),G=_.useRef(0),O=_.useRef(""),B=_.useRef(0),H=_.useRef(null),j=_.useRef("right"),$=_.useRef(0),V=y?Wf:_.Fragment,z=y?{as:gQ,allowPinchZoom:!0}:void 0,q=Y=>{var re,pe;const I=O.current+Y,U=T().filter(ce=>!ce.disabled),X=document.activeElement,D=(re=U.find(ce=>ce.ref.current===X))==null?void 0:re.textValue,te=U.map(ce=>ce.textValue),Q=TQ(te,I,D),ne=(pe=U.find(ce=>ce.textValue===Q))==null?void 0:pe.ref.current;(function ce(ge){O.current=ge,window.clearTimeout(G.current),ge!==""&&(G.current=window.setTimeout(()=>ce(""),1e3))})(I),ne&&setTimeout(()=>ne.focus())};_.useEffect(()=>()=>window.clearTimeout(G.current),[]),a0();const F=_.useCallback(Y=>{var U,X;return j.current===((U=H.current)==null?void 0:U.side)&&NQ(Y,(X=H.current)==null?void 0:X.area)},[]);return m.jsx(fQ,{scope:n,searchRef:O,onItemEnter:_.useCallback(Y=>{F(Y)&&Y.preventDefault()},[F]),onItemLeave:_.useCallback(Y=>{var I;F(Y)||((I=L.current)==null||I.focus(),N(null))},[F]),onTriggerLeave:_.useCallback(Y=>{F(Y)&&Y.preventDefault()},[F]),pointerGraceTimerRef:B,onPointerGraceIntentChange:_.useCallback(Y=>{H.current=Y},[]),children:m.jsx(V,{...z,children:m.jsx(Vf,{asChild:!0,trapped:i,onMountAutoFocus:Ve(s,Y=>{var I;Y.preventDefault(),(I=L.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:m.jsx(ud,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:g,onDismiss:b,children:m.jsx(tQ,{asChild:!0,...E,dir:C.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:N,onEntryFocus:Ve(u,Y=>{C.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:m.jsx(v0,{role:"menu","aria-orientation":"vertical","data-state":dj(w.open),"data-radix-menu-content":"",dir:C.dir,...R,...x,ref:P,style:{outline:"none",...x.style},onKeyDown:Ve(x.onKeyDown,Y=>{const U=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,X=Y.ctrlKey||Y.altKey||Y.metaKey,D=Y.key.length===1;U&&(Y.key==="Tab"&&Y.preventDefault(),!X&&D&&q(Y.key));const te=L.current;if(Y.target!==te||!iQ.includes(Y.key))return;Y.preventDefault();const ne=T().filter(re=>!re.disabled).map(re=>re.ref.current);U5.includes(Y.key)&&ne.reverse(),EQ(ne)}),onBlur:Ve(e.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(G.current),O.current="")}),onPointerMove:Ve(e.onPointerMove,vf(Y=>{const I=Y.target,U=$.current!==Y.clientX;if(Y.currentTarget.contains(I)&&U){const X=Y.clientX>$.current?"right":"left";j.current=X,$.current=Y.clientX}}))})})})})})})});Y5.displayName=ls;var vQ="MenuGroup",yC=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Kt.div,{role:"group",...r,ref:t})});yC.displayName=vQ;var bQ="MenuLabel",X5=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Kt.div,{...r,ref:t})});X5.displayName=bQ;var fv="MenuItem",uN="menu.itemSelect",E0=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=_.useRef(null),o=ep(fv,e.__scopeMenu),l=bC(fv,e.__scopeMenu),u=an(t,s),d=_.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(uN,{bubbles:!0,cancelable:!0});h.addEventListener(uN,b=>r==null?void 0:r(b),{once:!0}),ZP(h,g),g.defaultPrevented?d.current=!1:o.onClose()}};return m.jsx(Q5,{...i,ref:u,disabled:n,onClick:Ve(e.onClick,f),onPointerDown:h=>{var g;(g=e.onPointerDown)==null||g.call(e,h),d.current=!0},onPointerUp:Ve(e.onPointerUp,h=>{var g;d.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:Ve(e.onKeyDown,h=>{const g=l.searchRef.current!=="";n||g&&h.key===" "||MS.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});E0.displayName=fv;var Q5=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=bC(fv,n),l=W5(n),u=_.useRef(null),d=an(t,u),[f,h]=_.useState(!1),[g,b]=_.useState("");return _.useEffect(()=>{const y=u.current;y&&b((y.textContent??"").trim())},[s.children]),m.jsx(gf.ItemSlot,{scope:n,disabled:r,textValue:i??g,children:m.jsx(nQ,{asChild:!0,...l,focusable:!r,children:m.jsx(Kt.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:d,onPointerMove:Ve(e.onPointerMove,vf(y=>{r?o.onItemLeave(y):(o.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ve(e.onPointerLeave,vf(y=>o.onItemLeave(y))),onFocus:Ve(e.onFocus,()=>h(!0)),onBlur:Ve(e.onBlur,()=>h(!1))})})})}),_Q="MenuCheckboxItem",Z5=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return m.jsx(rj,{scope:e.__scopeMenu,checked:n,children:m.jsx(E0,{role:"menuitemcheckbox","aria-checked":pv(n)?"mixed":n,...i,ref:t,"data-state":SC(n),onSelect:Ve(i.onSelect,()=>r==null?void 0:r(pv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Z5.displayName=_Q;var J5="MenuRadioGroup",[yQ,xQ]=bc(J5,{value:void 0,onValueChange:()=>{}}),ej=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=Ts(r);return m.jsx(yQ,{scope:e.__scopeMenu,value:n,onValueChange:s,children:m.jsx(yC,{...i,ref:t})})});ej.displayName=J5;var tj="MenuRadioItem",nj=_.forwardRef((e,t)=>{const{value:n,...r}=e,i=xQ(tj,e.__scopeMenu),s=n===i.value;return m.jsx(rj,{scope:e.__scopeMenu,checked:s,children:m.jsx(E0,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":SC(s),onSelect:Ve(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});nj.displayName=tj;var xC="MenuItemIndicator",[rj,SQ]=bc(xC,{checked:!1}),ij=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=SQ(xC,n);return m.jsx(ps,{present:r||pv(s.checked)||s.checked===!0,children:m.jsx(Kt.span,{...i,ref:t,"data-state":SC(s.checked)})})});ij.displayName=xC;var wQ="MenuSeparator",sj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.jsx(Kt.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});sj.displayName=wQ;var CQ="MenuArrow",oj=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=k0(n);return m.jsx(b0,{...i,...r,ref:t})});oj.displayName=CQ;var kQ="MenuSub",[u1e,aj]=bc(kQ),zh="MenuSubTrigger",lj=_.forwardRef((e,t)=>{const n=_c(zh,e.__scopeMenu),r=ep(zh,e.__scopeMenu),i=aj(zh,e.__scopeMenu),s=bC(zh,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:u}=s,d={__scopeMenu:e.__scopeMenu},f=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>f,[f]),_.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),u(null)}},[l,u]),m.jsx(gC,{asChild:!0,...d,children:m.jsx(Q5,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":dj(n.open),...e,ref:jw(t,i.onTriggerChange),onClick:h=>{var g;(g=e.onClick)==null||g.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ve(e.onPointerMove,vf(h=>{s.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Ve(e.onPointerLeave,vf(h=>{var b,y;f();const g=(b=n.content)==null?void 0:b.getBoundingClientRect();if(g){const x=(y=n.content)==null?void 0:y.dataset.side,w=x==="right",C=w?-5:5,R=g[w?"left":"right"],E=g[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+C,y:h.clientY},{x:R,y:g.top},{x:E,y:g.top},{x:E,y:g.bottom},{x:R,y:g.bottom}],side:x}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Ve(e.onKeyDown,h=>{var b;const g=s.searchRef.current!=="";e.disabled||g&&h.key===" "||sQ[r.dir].includes(h.key)&&(n.onOpenChange(!0),(b=n.content)==null||b.focus(),h.preventDefault())})})})});lj.displayName=zh;var cj="MenuSubContent",uj=_.forwardRef((e,t)=>{const n=q5(ls,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=_c(ls,e.__scopeMenu),o=ep(ls,e.__scopeMenu),l=aj(cj,e.__scopeMenu),u=_.useRef(null),d=an(t,u);return m.jsx(gf.Provider,{scope:e.__scopeMenu,children:m.jsx(ps,{present:r||s.open,children:m.jsx(gf.Slot,{scope:e.__scopeMenu,children:m.jsx(_C,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:d,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;o.isUsingKeyboardRef.current&&((h=u.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Ve(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Ve(e.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:Ve(e.onKeyDown,f=>{var b;const h=f.currentTarget.contains(f.target),g=oQ[o.dir].includes(f.key);h&&g&&(s.onOpenChange(!1),(b=l.trigger)==null||b.focus(),f.preventDefault())})})})})})});uj.displayName=cj;function dj(e){return e?"open":"closed"}function pv(e){return e==="indeterminate"}function SC(e){return pv(e)?"indeterminate":e?"checked":"unchecked"}function EQ(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function RQ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function TQ(e,t,n){const i=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=RQ(e,Math.max(s,0));i.length===1&&(o=o.filter(d=>d!==n));const u=o.find(d=>d.toLowerCase().startsWith(i.toLowerCase()));return u!==n?u:void 0}function AQ(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const l=t[s],u=t[o],d=l.x,f=l.y,h=u.x,g=u.y;f>r!=g>r&&n<(h-d)*(r-f)/(g-f)+d&&(i=!i)}return i}function NQ(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return AQ(n,t)}function vf(e){return t=>t.pointerType==="mouse"?e(t):void 0}var MQ=G5,LQ=gC,DQ=K5,IQ=Y5,PQ=yC,OQ=X5,jQ=E0,zQ=Z5,BQ=ej,FQ=nj,HQ=ij,$Q=sj,UQ=oj,VQ=lj,WQ=uj,wC="ContextMenu",[GQ]=qo(wC,[V5]),Zr=V5(),[qQ,hj]=GQ(wC),fj=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:s=!0}=e,[o,l]=_.useState(!1),u=Zr(t),d=Ts(r),f=_.useCallback(h=>{l(h),d(h)},[d]);return m.jsx(qQ,{scope:t,open:o,onOpenChange:f,modal:s,children:m.jsx(MQ,{...u,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};fj.displayName=wC;var pj="ContextMenuTrigger",mj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,s=hj(pj,n),o=Zr(n),l=_.useRef({x:0,y:0}),u=_.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=_.useRef(0),f=_.useCallback(()=>window.clearTimeout(d.current),[]),h=g=>{l.current={x:g.clientX,y:g.clientY},s.onOpenChange(!0)};return _.useEffect(()=>f,[f]),_.useEffect(()=>void(r&&f()),[r,f]),m.jsxs(m.Fragment,{children:[m.jsx(LQ,{...o,virtualRef:u}),m.jsx(Kt.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:Ve(e.onContextMenu,g=>{f(),h(g),g.preventDefault()}),onPointerDown:r?e.onPointerDown:Ve(e.onPointerDown,zm(g=>{f(),d.current=window.setTimeout(()=>h(g),700)})),onPointerMove:r?e.onPointerMove:Ve(e.onPointerMove,zm(f)),onPointerCancel:r?e.onPointerCancel:Ve(e.onPointerCancel,zm(f)),onPointerUp:r?e.onPointerUp:Ve(e.onPointerUp,zm(f))})]})});mj.displayName=pj;var KQ="ContextMenuPortal",gj=e=>{const{__scopeContextMenu:t,...n}=e,r=Zr(t);return m.jsx(DQ,{...r,...n})};gj.displayName=KQ;var vj="ContextMenuContent",bj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=hj(vj,n),s=Zr(n),o=_.useRef(!1);return m.jsx(IQ,{...s,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var u;(u=e.onCloseAutoFocus)==null||u.call(e,l),!l.defaultPrevented&&o.current&&l.preventDefault(),o.current=!1},onInteractOutside:l=>{var u;(u=e.onInteractOutside)==null||u.call(e,l),!l.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});bj.displayName=vj;var YQ="ContextMenuGroup",XQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(PQ,{...i,...r,ref:t})});XQ.displayName=YQ;var QQ="ContextMenuLabel",ZQ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(OQ,{...i,...r,ref:t})});ZQ.displayName=QQ;var JQ="ContextMenuItem",_j=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(jQ,{...i,...r,ref:t})});_j.displayName=JQ;var eZ="ContextMenuCheckboxItem",tZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(zQ,{...i,...r,ref:t})});tZ.displayName=eZ;var nZ="ContextMenuRadioGroup",rZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(BQ,{...i,...r,ref:t})});rZ.displayName=nZ;var iZ="ContextMenuRadioItem",sZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(FQ,{...i,...r,ref:t})});sZ.displayName=iZ;var oZ="ContextMenuItemIndicator",aZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(HQ,{...i,...r,ref:t})});aZ.displayName=oZ;var lZ="ContextMenuSeparator",yj=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx($Q,{...i,...r,ref:t})});yj.displayName=lZ;var cZ="ContextMenuArrow",uZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(UQ,{...i,...r,ref:t})});uZ.displayName=cZ;var dZ="ContextMenuSubTrigger",hZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(VQ,{...i,...r,ref:t})});hZ.displayName=dZ;var fZ="ContextMenuSubContent",pZ=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Zr(n);return m.jsx(WQ,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});pZ.displayName=fZ;function zm(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var mZ=fj,gZ=mj,vZ=gj,xj=bj,Sj=_j,wj=yj;const CC=mZ,kC=gZ,R0=_.forwardRef(({className:e,...t},n)=>m.jsx(vZ,{children:m.jsx(xj,{ref:n,className:xe("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...t})}));R0.displayName=xj.displayName;const Ni=_.forwardRef(({className:e,...t},n)=>m.jsx(Sj,{ref:n,className:xe("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-muted focus:bg-muted data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));Ni.displayName=Sj.displayName;const Cj=_.forwardRef(({className:e,...t},n)=>m.jsx(wj,{ref:n,className:xe("-mx-1 my-1 h-px bg-border",e),...t}));Cj.displayName=wj.displayName;function bZ({editorLabel:e,onCopyPath:t,onOpenInFinder:n,onOpenInEditor:r,onRemove:i,children:s}){return m.jsxs(CC,{children:[m.jsx(kC,{asChild:!0,children:s}),m.jsxs(R0,{children:[m.jsxs(Ni,{onSelect:o=>{o.stopPropagation(),t()},children:[m.jsx(Xl,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Copy Path"})]}),m.jsxs(Ni,{onSelect:o=>{o.stopPropagation(),n()},children:[m.jsx(i0,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Show in Finder"})]}),m.jsxs(Ni,{onSelect:o=>{o.stopPropagation(),r()},children:[m.jsx(r0,{className:"h-3.5 w-3.5"}),m.jsxs("span",{className:"text-xs font-medium",children:["Open in ",e]})]}),m.jsxs(Ni,{onSelect:o=>{o.stopPropagation(),i()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[m.jsx(IP,{className:"h-3.5 w-3.5"}),m.jsx("span",{className:"text-xs font-medium",children:"Remove"})]})]})]})}const _Z=20;function dN(e){return e.top+e.height/2}function yZ({activeId:e,groupIds:t,collisionRect:n,droppableRects:r}){const i=t.indexOf(e);if(i===-1)return null;const s=r.get(e);if(!s)return null;const o=n.top+_Z;if(n.top>s.top){for(let l=t.length-1;l>i;l--){const u=r.get(t[l]);if(u&&o>=dN(u))return t[l]}return e}if(n.top<s.top){for(let l=0;l<i;l++){const u=r.get(t[l]);if(u&&o<=dN(u))return t[l]}return e}return e}const xZ=_.memo(function({group:t,editorLabel:n,collapsedSections:r,expandedGroups:i,onToggleSection:s,onToggleExpandedGroup:o,renderChatRow:l,onNewLocalChat:u,onCopyPath:d,onOpenExternalPath:f,onRemoveProject:h,isConnected:g,startingLocalPath:b}){const{groupKey:y,localPath:x}=t,w=i.has(y),C=t.olderChats.length>0,{attributes:R,listeners:E,setNodeRef:T,setActivatorNodeRef:A,transform:N,transition:L,isDragging:P}=$X({id:y}),G={transform:pf.Translate.toString(N?{...N,x:0}:null),transition:P?void 0:L},O=m.jsxs("div",{ref:A,className:xe("sticky top-0 bg-background dark:bg-card z-10 relative p-[10px] flex items-center justify-between","cursor-grab active:cursor-grabbing select-none touch-none",P&&"cursor-grabbing"),onClick:()=>s(y),...E,children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"relative size-3.5 shrink-0 cursor-pointer",children:r.has(y)?m.jsx(Fo,{className:"translate-y-[1px] size-3.5 shrink-0 text-slate-400 transition-all duration-200"}):m.jsxs(m.Fragment,{children:[m.jsx(i0,{className:"absolute inset-0 translate-y-[1px] size-3.5 shrink-0 text-slate-400 dark:text-slate-500 transition-all duration-200 group-hover/section:opacity-0"}),m.jsx(Fo,{className:"absolute inset-0 translate-y-[1px] size-3.5 shrink-0 rotate-90 text-slate-400 opacity-0 transition-all duration-200 group-hover/section:opacity-100"})]})}),m.jsxs(Za,{children:[m.jsx(Ja,{asChild:!0,children:m.jsx("span",{className:"truncate max-w-[150px] whitespace-nowrap text-sm ",children:v5(x)})}),m.jsx(Uo,{side:"right",sideOffset:4,children:x})]})]}),u&&m.jsxs(Za,{children:[m.jsx(Ja,{asChild:!0,children:m.jsx(st,{variant:"ghost",size:"icon",className:xe("h-5.5 w-5.5 absolute right-2 !rounded opacity-100 md:opacity-0 md:group-hover/section:opacity-100",(!g||b===x)&&"opacity-50 cursor-not-allowed"),disabled:!g||b===x,onClick:B=>{B.stopPropagation(),u(x)},children:b===x?m.jsx(Rn,{className:"size-4 text-slate-500 dark:text-slate-400 animate-spin"}):m.jsx(Dw,{className:"size-3.5 text-slate-500 dark:text-slate-400"})})}),m.jsx(Uo,{side:"right",sideOffset:4,children:g?"New chat":`Start ${Gn} to connect`})]})]});return m.jsxs("div",{ref:T,style:G,className:xe("group/section",P&&"opacity-50 shadow-lg z-50 relative"),...R,children:[h&&d&&f?m.jsx(bZ,{editorLabel:n,onCopyPath:()=>d(x),onOpenInFinder:()=>f("open_finder",x),onOpenInEditor:()=>f("open_editor",x),onRemove:()=>h(y),children:O}):O,!r.has(y)&&(t.previewChats.length>0||C)&&m.jsxs("div",{className:"space-y-[2px] mb-2 ",children:[t.previewChats.map(l),C&&w?m.jsx("button",{onClick:()=>o(y),className:"pl-2.5 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Hide older"}):null,w?t.olderChats.map(l):null,C&&!w?m.jsx("button",{onClick:()=>o(y),className:"pl-2.5 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Show older"}):null]})]})}),SZ=function({projectGroups:t,editorLabel:n,collapsedSections:r,expandedGroups:i,onToggleSection:s,onToggleExpandedGroup:o,renderChatRow:l,onNewLocalChat:u,onCopyPath:d,onOpenExternalPath:f,onRemoveProject:h,onReorderGroups:g,isConnected:b,startingLocalPath:y}){const x=_Y(QA(hC,{activationConstraint:{distance:2}}),QA(uC)),w=_.useMemo(()=>t.map(E=>E.groupKey),[t]),C=_.useMemo(()=>E=>{const T=yZ({activeId:String(E.active.id),groupIds:w,collisionRect:E.collisionRect,droppableRects:E.droppableRects});if(!T)return JA(E);const A=E.droppableContainers.find(N=>N.id===T);return A?[{id:A.id,data:{droppableContainer:A,value:0}}]:JA(E)},[w]);function R(E){const{active:T,over:A}=E;if(A&&T.id!==A.id&&g){const N=w.indexOf(T.id),L=w.indexOf(A.id);if(N!==-1&&L!==-1){const P=fC(w,N,L);g(P)}}}return m.jsx(SX,{sensors:x,collisionDetection:C,onDragEnd:R,children:m.jsx(PX,{items:w,strategy:DX,children:t.map(E=>m.jsx(xZ,{group:E,editorLabel:n,collapsedSections:r,expandedGroups:i,onToggleSection:s,onToggleExpandedGroup:o,renderChatRow:l,onNewLocalChat:u,onCopyPath:d,onOpenExternalPath:f,onRemoveProject:h,isConnected:b,startingLocalPath:y},E.groupKey))})})},wZ=_.memo(SZ),CZ="gpt-5.4-mini",kZ="moonshotai/kimi-k2.5:nitro",mv=[{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"max",label:"Max"}],LS=[{id:"minimal",label:"Minimal"},{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"XHigh"}],bf={reasoningEffort:"high",contextWindow:"200k"},DS={reasoningEffort:"high",fastMode:!1};function hN(e){return mv.some(t=>t.id===e)}function fN(e){return LS.some(t=>t.id===e)}const IS=[{id:"200k",label:"200k"},{id:"1m",label:"1M"}],Jh=[{id:"claude",label:"Claude",defaultModel:"claude-sonnet-4-6",defaultEffort:"high",supportsPlanMode:!0,models:[{id:"claude-opus-4-7",label:"Opus 4.7",supportsEffort:!0,aliases:["opus"],contextWindowOptions:[...IS],supportsMaxReasoningEffort:!0},{id:"claude-sonnet-4-6",label:"Sonnet 4.6",supportsEffort:!0,aliases:["sonnet"],contextWindowOptions:[...IS]},{id:"claude-haiku-4-5-20251001",label:"Haiku 4.5",supportsEffort:!0,aliases:["haiku"]}],efforts:[...mv]},{id:"codex",label:"Codex",defaultModel:"gpt-5.4",supportsPlanMode:!0,models:[{id:"gpt-5.4",label:"GPT-5.4",supportsEffort:!1},{id:"gpt-5.3-codex",label:"GPT-5.3 Codex",supportsEffort:!1,aliases:["gpt-5-codex"]},{id:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark",supportsEffort:!1}],efforts:[]}];function EC(e){const t=Jh.find(n=>n.id===e);if(!t)throw new Error(`Unknown provider: ${e}`);return t}function EZ(e,t){if(t)return EC(e).models.find(n=>{var r;return n.id===t||((r=n.aliases)==null?void 0:r.includes(t))})}function RC(e,t,n){var r;return((r=EZ(e,t))==null?void 0:r.id)??n??EC(e).defaultModel}function RZ(e,t="claude-opus-4-7"){return RC("claude",e,t)}function TZ(e,t="gpt-5.4"){return RC("codex",e,t)}function AZ(e,t){const n=RC(e,t);return EC(e).models.find(r=>r.id===n)}function kj(e){return AZ("claude",e)}function Ej(e){var t;return!!((t=kj(e))!=null&&t.supportsMaxReasoningEffort)}function NZ(e){var t;return((t=kj(e))==null?void 0:t.contextWindowOptions)??[]}function TC(e,t){const n=NZ(e);return n.length===0?bf.contextWindow:n.some(r=>r.id===t)?t:bf.contextWindow}function MZ(e){switch(e){case"1m":return 1e6;case"200k":default:return 2e5}}const xs={toggleEmbeddedTerminal:["cmd+j","ctrl+`"],toggleRightSidebar:["cmd+b","ctrl+b"],openInFinder:["cmd+alt+f","ctrl+alt+f"],openInEditor:["cmd+shift+o","ctrl+shift+o"],addSplitTerminal:["cmd+/","ctrl+/"],jumpToSidebarChat:["cmd+alt"],createChatInCurrentProject:["cmd+alt+n"],openAddProject:["cmd+alt+o"]},Rj={toggleEmbeddedTerminal:"Toggle Embedded Terminal",toggleRightSidebar:"Toggle Right Sidebar",openInFinder:"Open In Finder",openInEditor:"Open In Editor",addSplitTerminal:"Add Split Terminal",jumpToSidebarChat:"Jump To Sidebar Chat",createChatInCurrentProject:"New Chat In Current Project",openAddProject:"Open Add Project"};function By(e){return(e??[]).join(", ")}function Ra(e){return e.split(",").map(t=>t.trim()).map(t=>t.toLowerCase()).filter(Boolean)}const LZ=new Map([["cmd","meta"],["meta","meta"],["ctrl","ctrl"],["control","ctrl"],["alt","alt"],["option","alt"],["shift","shift"]]);function Tj(e,t){const n=IZ(e);return n?PZ(t,n.key)&&t.ctrlKey===n.ctrl&&t.metaKey===n.meta&&t.altKey===n.alt&&t.shiftKey===n.shift:!1}function yh(e,t,n){return T0(e,t).some(i=>Tj(i,n))}function DZ(e,t,n){return T0(e,t).find(r=>Tj(r,n))??null}function T0(e,t){return(e==null?void 0:e.bindings[t])??xs[t]}function AC(e){return{bindings:{toggleEmbeddedTerminal:(e==null?void 0:e.bindings.toggleEmbeddedTerminal)??xs.toggleEmbeddedTerminal,toggleRightSidebar:(e==null?void 0:e.bindings.toggleRightSidebar)??xs.toggleRightSidebar,openInFinder:(e==null?void 0:e.bindings.openInFinder)??xs.openInFinder,openInEditor:(e==null?void 0:e.bindings.openInEditor)??xs.openInEditor,addSplitTerminal:(e==null?void 0:e.bindings.addSplitTerminal)??xs.addSplitTerminal,jumpToSidebarChat:(e==null?void 0:e.bindings.jumpToSidebarChat)??xs.jumpToSidebarChat,createChatInCurrentProject:(e==null?void 0:e.bindings.createChatInCurrentProject)??xs.createChatInCurrentProject,openAddProject:(e==null?void 0:e.bindings.openAddProject)??xs.openAddProject},warning:(e==null?void 0:e.warning)??null,filePathDisplay:(e==null?void 0:e.filePathDisplay)??""}}function IZ(e){const t=e.split("+").map(r=>r.trim()).filter(Boolean);if(t.length===0)return null;const n={key:"",ctrl:!1,meta:!1,alt:!1,shift:!1};for(const r of t){const i=r.toLowerCase(),s=LZ.get(i);if(s==="ctrl"){n.ctrl=!0;continue}if(s==="meta"){n.meta=!0;continue}if(s==="alt"){n.alt=!0;continue}if(s==="shift"){n.shift=!0;continue}if(n.key)return null;n.key=i}return n.key?n:null}function PZ(e,t){if(e.key.toLowerCase()===t)return!0;const n=OZ(t);return n?e.code===n:!1}function OZ(e){if(e.length===1&&e>="a"&&e<="z")return`Key${e.toUpperCase()}`;if(e.length===1&&e>="0"&&e<="9")return`Digit${e}`;switch(e){case"/":return"Slash";case"`":return"Backquote";default:return null}}const Aj=9;function jZ(e,t,n){const r=[];for(const i of e){if(t.has(i.groupKey))continue;const s=n.has(i.groupKey)?[...i.previewChats,...i.olderChats]:i.previewChats;for(const o of s)r.push({chat:o,visibleIndex:r.length+1})}return r}function zZ(e,t){if(!PS(e,t)||!t.code.startsWith("Digit"))return null;const n=Number(t.code.slice(5));return Number.isInteger(n)&&n>=1&&n<=Aj?n:null}function BZ(e,t){return FZ(e,t)?String(t):null}function PS(e,t){return T0(e,"jumpToSidebarChat").some(n=>HZ(n,t))}function pN(e,t,n){return DZ(e,t,n)!==null}function FZ(e,t){return t<1||t>Aj?null:T0(e,"jumpToSidebarChat")[0]??null}function HZ(e,t){const n=e.split("+").map(l=>l.trim().toLowerCase()).filter(Boolean);let r=!1,i=!1,s=!1,o=!1;for(const l of n){if(l==="cmd"||l==="meta"){r=!0;continue}if(l==="alt"||l==="option"){i=!0;continue}if(l==="ctrl"||l==="control"){s=!0;continue}l==="shift"&&(o=!0)}return t.metaKey===r&&t.altKey===i&&t.ctrlKey===s&&t.shiftKey===o}function $Z({data:e,activeChatId:t,connectionStatus:n,ready:r,open:i,collapsed:s,showMobileOpenButton:o,onOpen:l,onClose:u,onCollapse:d,onExpand:f,onCreateChat:h,onForkChat:g,currentProjectId:b,keybindings:y,onDeleteChat:x,onOpenAddProjectModal:w,onCopyPath:C,onOpenExternalPath:R,onRemoveProject:E,onReorderProjectGroups:T,editorLabel:A,updateSnapshot:N,onOpenChangelog:L}){const P=Ls(),G=cd(),O=_.useRef(null),B=_.useRef(new Set),[H,j]=_.useState(new Set),[$,V]=_.useState(new Set),[z,q]=_.useState(()=>Date.now()),[F,Y]=_.useState(!1),I=_.useMemo(()=>AC(y),[y]),U=_.useMemo(()=>jZ(e.projectGroups,H,$),[H,e.projectGroups,$]),X=_.useRef(U),D=_.useMemo(()=>new Map(U.map(Pe=>[Pe.chat.chatId,Pe.visibleIndex])),[U]),te=_.useMemo(()=>new Map(e.projectGroups.map(Pe=>[Pe.localPath,Pe.groupKey])),[e.projectGroups]),Q=U.length;_.useEffect(()=>{X.current=U},[U]),_.useEffect(()=>{j(Pe=>{const nt=new Set,He=new Set(e.projectGroups.map(pt=>pt.groupKey)),Ze=B.current;for(const pt of Pe)He.has(pt)&&nt.add(pt);B.current=new Set([...Ze].filter(pt=>He.has(pt)));for(const pt of e.projectGroups)B.current.has(pt.groupKey)||(B.current.add(pt.groupKey),pt.defaultCollapsed&&nt.add(pt.groupKey));return nt.size===Pe.size&&[...nt].every(pt=>Pe.has(pt))?Pe:nt})},[e.projectGroups]);const ne=_.useCallback(Pe=>{j(nt=>{const He=new Set(nt);return He.has(Pe)?He.delete(Pe):He.add(Pe),He})},[]),re=_.useCallback(Pe=>{V(nt=>{const He=new Set(nt);return He.has(Pe)?He.delete(Pe):He.add(Pe),He})},[]),pe=_.useCallback(Pe=>{const nt=D.get(Pe.chatId);return m.jsx(iY,{chat:Pe,activeChatId:t,nowMs:z,shortcutHint:nt?BZ(I,nt):null,showShortcutHint:F,onSelectChat:He=>{G(`/chat/${He}`),u()},onForkChat:()=>g(Pe),onDeleteChat:()=>x(Pe)},Pe._id)},[t,G,z,u,x,g,I,F,D]);_.useEffect(()=>{const Pe=window.setInterval(()=>{q(Date.now())},3e4);return()=>window.clearInterval(Pe)},[]),_.useEffect(()=>{function Pe(Ze){var en;if(Y(PS(I,Ze)),pN(I,"createChatInCurrentProject",Ze)){if(!b)return;Ze.preventDefault(),h(b);return}if(pN(I,"openAddProject",Ze)){Ze.preventDefault(),G("/"),u(),w();return}const pt=zZ(I,Ze);if(pt===null)return;const mt=(en=X.current[pt-1])==null?void 0:en.chat;mt&&(Ze.preventDefault(),G(`/chat/${mt.chatId}`),u())}function nt(Ze){Y(PS(I,Ze))}function He(){Y(!1)}return window.addEventListener("keydown",Pe),window.addEventListener("keyup",nt),window.addEventListener("blur",He),()=>{window.removeEventListener("keydown",Pe),window.removeEventListener("keyup",nt),window.removeEventListener("blur",He)}},[b,G,u,h,w,I]),_.useEffect(()=>{!t||!O.current||requestAnimationFrame(()=>{const Pe=O.current,nt=Pe==null?void 0:Pe.querySelector(`[data-chat-id="${t}"]`);if(!nt||!Pe)return;const He=nt.getBoundingClientRect(),Ze=Pe.getBoundingClientRect();if(He.top<Ze.top+38){const pt=He.top-Ze.top+Pe.scrollTop;Pe.scrollTo({top:pt-38,behavior:"smooth"})}else if(He.bottom>Ze.bottom){const pt=He.top+He.height/2-Ze.top+Pe.scrollTop,mt=Pe.clientHeight/2;Pe.scrollTo({top:pt-mt,behavior:"smooth"})}})},[t,Q]);const ce=Q>0,ge=P.pathname==="/",ue=P.pathname.startsWith("/settings"),ke=ge||ue,Ae=n==="connecting"||!r,ze=Ae?"Connecting":n==="connected"?"Connected":"Disconnected",Ge=n==="connected"?"bg-emerald-500":"bg-amber-500",Et=(N==null?void 0:N.updateAvailable)===!0,zt=N?N.latestVersion===`${N.currentVersion}-dev`:!1,Ct=(N==null?void 0:N.status)==="updating"||(N==null?void 0:N.status)==="restart_pending";return m.jsxs(m.Fragment,{children:[!i&&o&&m.jsx(st,{variant:"ghost",size:"icon",className:"fixed top-3 left-3 z-50 md:hidden",onClick:l,children:m.jsx(Mw,{className:"h-5 w-5"})}),s&&ke&&m.jsx("div",{className:"hidden md:flex fixed left-0 top-0 h-full z-40 items-start pt-4 pl-5 border-l border-border/0",children:m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx(Iu,{className:"size-6 text-logo"}),m.jsx(st,{variant:"ghost",size:"icon",onClick:f,title:"Expand sidebar",children:m.jsx(hS,{className:"h-5 w-5"})})]})}),m.jsxs("div",{"data-sidebar":"open",className:xe("fixed inset-0 z-50 bg-background dark:bg-card flex flex-col h-[100dvh] select-none","md:relative md:inset-auto md:w-[275px] md:mr-0 md:h-[calc(100dvh-16px)] md:my-2 md:ml-2 md:border md:border-border md:rounded-2xl",i?"flex":"hidden md:flex",s&&"md:hidden"),children:[m.jsxs("div",{className:"px-[5px] h-[64px] max-h-[64px] md:h-[55px] md:max-h-[55px] border-b grid grid-cols-[40px_minmax(0,1fr)_40px] items-center md:px-[7px] md:pl-3 md:flex md:justify-between",children:[m.jsx("div",{className:"md:hidden",children:m.jsx(st,{variant:"ghost",size:"icon",className:"size-10 rounded-lg hover:!border-border/0",onClick:u,title:"Close sidebar",children:m.jsx(nl,{className:"h-5 w-5"})})}),m.jsxs("div",{className:"flex items-center justify-self-center gap-2 md:justify-self-auto",children:[m.jsxs("button",{type:"button",onClick:d,title:"Collapse sidebar",className:"hidden md:flex group/sidebar-collapse relative items-center justify-center h-5 w-5 sm:h-6 sm:w-6",children:[m.jsx(Iu,{className:"absolute inset-0.5 h-4 w-4 sm:h-5 sm:w-5 text-logo transition-all duration-200 ease-out opacity-100 scale-100 group-hover/sidebar-collapse:opacity-0 group-hover/sidebar-collapse:scale-0"}),m.jsx(hS,{className:"absolute inset-0 h-4 w-4 sm:h-6 sm:w-6 text-slate-500 dark:text-slate-400 transition-all duration-200 ease-out opacity-0 scale-0 group-hover/sidebar-collapse:opacity-100 group-hover/sidebar-collapse:scale-80 hover:opacity-50"})]}),m.jsx(Iu,{className:"h-5 w-5 sm:h-6 sm:w-6 text-logo md:hidden"}),m.jsx("span",{className:"font-logo text-base uppercase sm:text-md text-slate-600 dark:text-slate-100",children:Gn})]}),m.jsxs("div",{className:"flex items-center justify-self-end md:justify-self-auto",children:[m.jsx(st,{variant:"ghost",size:"icon",onClick:()=>{G("/"),u()},className:"size-10 rounded-lg hover:!border-border/0 md:hidden",title:"New project",children:m.jsx(ev,{className:"h-5 w-5"})}),zt?m.jsx("span",{className:"mr-1 hidden md:inline-flex items-center rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] font-bold tracking-wider text-muted-foreground",title:"Development build",children:"DEV"}):Et?m.jsxs(st,{variant:"outline",size:"sm",className:"hidden md:inline-flex rounded-full !h-auto mr-1 py-0.5 px-2 bg-logo/20 hover:bg-logo text-logo border-logo/20 hover:text-foreground hover:border-logo/20 text-[11px] font-bold tracking-wider",onClick:L,disabled:Ct,title:N!=null&&N.latestVersion?`Update to ${N.latestVersion}`:"Update Kanna",children:[Ct?m.jsx(Rn,{className:"mr-1.5 h-3 w-3 animate-spin"}):null,"UPDATE"]}):null,m.jsx(st,{variant:"ghost",size:"icon",onClick:()=>{G("/"),u()},className:"hidden md:inline-flex size-10 rounded-lg hover:!border-border/0",title:"New project",children:m.jsx(ev,{className:"size-4"})})]})]}),m.jsx("div",{ref:O,className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden scrollbar-hide",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:m.jsxs("div",{className:"p-[7px]",children:[!ce&&Ae?m.jsx("div",{className:"space-y-5 px-1 pt-3",children:[0,1,2].map(Pe=>m.jsxs("div",{className:"space-y-2 animate-pulse",children:[m.jsx("div",{className:"h-4 w-28 rounded bg-muted"}),m.jsx("div",{className:"space-y-1",children:[0,1,2].map(nt=>m.jsxs("div",{className:"flex items-center gap-2 rounded-md px-3 py-2",children:[m.jsx("div",{className:"h-3.5 w-3.5 rounded-full bg-muted"}),m.jsx("div",{className:xe("h-3.5 rounded bg-muted",nt===0?"w-32":nt===1?"w-40":"w-28")})]},nt))})]},Pe))}):null,!ce&&!Ae&&e.projectGroups.length===0?m.jsx("p",{className:"text-sm text-slate-400 p-2 mt-6 text-center",children:"No conversations yet"}):null,m.jsx(wZ,{projectGroups:e.projectGroups,editorLabel:A,onReorderGroups:T,collapsedSections:H,expandedGroups:$,onToggleSection:ne,onToggleExpandedGroup:re,renderChatRow:pe,onNewLocalChat:Pe=>{const nt=te.get(Pe);nt&&h(nt)},onCopyPath:C,onOpenExternalPath:R,onRemoveProject:E,isConnected:n==="connected"})]})}),m.jsx("div",{className:"border-t border-border p-2",children:m.jsx("button",{type:"button",onClick:()=>{G("/settings/general"),u()},className:xe("w-full rounded-xl rounded-t-md border px-3 py-2 text-left transition-colors",ue?"bg-muted border-border":"border-border/0 hover:bg-muted hover:border-border active:bg-muted/80"),children:m.jsxs("div",{className:"flex items- justify-between gap-2",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(HU,{className:"h-4 w-4 text-muted-foreground"}),m.jsx("span",{className:"text-sm",children:"Settings"})]}),m.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[m.jsx("span",{children:ze}),Ae?m.jsx(Rn,{className:"h-2 w-2 animate-spin"}):m.jsx("span",{className:xe("h-2 w-2 rounded-full",Ge)})]})]})})})]}),i?m.jsx("div",{className:"fixed inset-0 bg-black/40 z-40 md:hidden",onClick:u}):null]})}const UZ=_.memo($Z);function VZ({sidebarCollapsed:e,onOpenSidebar:t,onExpandSidebar:n,onNewChat:r,localPath:i,embeddedTerminalVisible:s=!1,onToggleEmbeddedTerminal:o,rightSidebarVisible:l=!1,onToggleRightSidebar:u,onOpenExternal:d,editorLabel:f="Editor",finderShortcut:h,editorShortcut:g,terminalShortcut:b,rightSidebarShortcut:y,branchName:x,hasGitRepo:w=!0,gitStatus:C="unknown"}){const R=w?C==="unknown"?null:x??"Detached HEAD":"Setup Git";return m.jsx(Vw,{className:xe("absolute top-0 left-0 right-0 z-10 md:pt-3 px-3 border-border/0 md:pb-0 flex items-center justify-center"," bg-gradient-to-b from-background/70"),children:m.jsxs("div",{className:"relative flex items-center gap-2 w-full",children:[m.jsxs("div",{className:`flex items-center gap-1 flex-shrink-0 border border-border rounded-full ${e?"px-1.5":""} p-1 backdrop-blur-lg`,children:[m.jsx(st,{variant:"ghost",size:"icon",className:"md:hidden",onClick:t,children:m.jsx(Mw,{className:"size-4.5"})}),e&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"flex items-center justify-center w-[36px] h-[36px]",children:m.jsx(Iu,{className:"h-4 w-4 sm:h-5 sm:w-5 text-logo ml-1 hidden md:block"})}),m.jsx(st,{variant:"ghost",size:"icon",className:"hidden md:flex",onClick:n,title:"Expand sidebar",children:m.jsx(hS,{className:"size-4.5"})})]}),m.jsx(st,{variant:"ghost",size:"icon",className:"hover:!border-border/0 hover:!bg-transparent",onClick:r,title:"Compose",children:m.jsx(Dw,{className:"size-4.5"})})]}),m.jsx("div",{className:"flex-1 min-w-0"}),i&&(d||o||u)?m.jsxs("div",{className:"flex items-center flex-shrink-0 border border-border rounded-full px-2 py-1 backdrop-blur-lg",children:[d||o?m.jsxs(m.Fragment,{children:[d?m.jsxs(Oh,{children:[m.jsx(jh,{asChild:!0,children:m.jsx(st,{variant:"ghost",size:"none",onClick:()=>d("open_finder"),title:"Open in Finder",className:"border border-border/0 hover:!border-border/0 pl-2 pr-1.5 h-9 hover:!bg-transparent",children:m.jsx(i0,{strokeWidth:2,className:"h-4.5"})})}),m.jsx(Tu,{side:"bottom",shortcut:h})]}):null,o?m.jsxs(Oh,{children:[m.jsx(jh,{asChild:!0,children:m.jsx(st,{variant:"ghost",size:"none",onClick:o,className:xe("border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent",s&&"text-foreground"),children:m.jsx(Iw,{strokeWidth:2,className:"h-4.5"})})}),m.jsx(Tu,{side:"bottom",shortcut:b})]}):null,d?m.jsxs(Oh,{children:[m.jsx(jh,{asChild:!0,children:m.jsx(st,{variant:"ghost",size:"none",onClick:()=>d("open_editor"),title:`Open in ${f}`,className:"border border-border/0 hover:!border-border/0 px-1.5 h-9 hover:!bg-transparent",children:m.jsx(r0,{strokeWidth:2,className:"h-4.5"})})}),m.jsx(Tu,{side:"bottom",shortcut:g})]}):null]}):null,u?m.jsxs(Oh,{children:[m.jsx(jh,{asChild:!0,children:m.jsxs(st,{variant:"ghost",onClick:u,className:xe("border flex flex-row items-center gap-1.5 h-9 border-border/0 pl-1.5 pr-2 hover:!border-border/0 hover:!bg-transparent",l&&"text-foreground"),children:[l?m.jsx(yU,{strokeWidth:2.25,className:"h-4"}):m.jsx(Fl,{strokeWidth:2.25,className:"h-4"}),R&&!l?m.jsx("div",{className:"font-[13px] max-w-[140px] truncate hidden md:block",children:R}):null]})}),m.jsx(Tu,{side:"bottom",shortcut:y})]}):null]}):null]})})}const WZ={position:"absolute",top:0,bottom:0,textAlign:"center"},GZ={display:"contents"};function mN(){return null}const gv="diffs-container",qZ=/(?=^From [a-f0-9]+ .+$)/m,Mg=/(?=^diff --git)/gm,gN=/(?=^---\s+\S)/gm,KZ=/(?=^@@ )/gm,YZ=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,Fy=new RegExp("(?<=\\n)"),XZ=/^(---|\+\+\+)\s+([^\t\r\n]+)/,QZ=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,ZZ=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,JZ=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,NC="header-prefix",MC="header-metadata",LC="header-custom",Zs={dark:"pierre-dark",light:"pierre-light"},Nj="data-theme-css",Mj="data-unsafe-css",zu=1,eJ={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},tJ=Object.freeze({fromStart:0,fromEnd:0}),vN={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},nJ={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function _f(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function rJ(e,t){return typeof window>"u"&&t!=null?m.jsxs(m.Fragment,{children:[m.jsx("template",{shadowrootmode:"open",dangerouslySetInnerHTML:{__html:t}}),e]}):m.jsx(m.Fragment,{children:e})}const iJ=_.createContext(void 0);function sJ(){return _.useContext(iJ)}const Kl=new Map,Hy=new Map,OS=new Map,jS=new Set;function bN(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let r;if(typeof n=="string"){if(r=Kl.get(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,Kl.has(n)||Kl.set(n,r);jS.has(n)||(jS.add(n),t.loadThemeSync(r))}}const oJ="modulepreload",aJ=function(e){return"/"+e},_N={},K=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(d){return Promise.all(d.map(f=>Promise.resolve(f).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=o(n.map(d=>{if(d=aJ(d),d in _N)return;_N[d]=!0;const f=d.endsWith(".css"),h=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${h}`))return;const g=document.createElement("link");if(g.rel=f?"stylesheet":oJ,f||(g.as="script"),g.crossOrigin="",g.href=d,u&&g.setAttribute("nonce",u),document.head.appendChild(g),f)return new Promise((b,y)=>{g.addEventListener("load",b),g.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})},yf=new Map,$y=new Map,lJ=new Map,zS=new Set;function yN(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(zS.has(n.name))continue;let r=yf.get(n.name);r==null&&(r=n,yf.set(n.name,r)),zS.add(r.name),t.loadLanguageSync(r.data)}}function Lj(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}let Jn=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function cJ(e){return DC(e)}function DC(e){return Array.isArray(e)?uJ(e):e instanceof RegExp?e:typeof e=="object"?dJ(e):e}function uJ(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=DC(e[n]);return t}function dJ(e){let t={};for(let n in e)t[n]=DC(e[n]);return t}function Dj(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function Ij(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?Ij(e.substring(0,e.length-1)):e.substr(~t+1)}var Uy=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Bm=class{static hasCaptures(e){return e===null?!1:(Uy.lastIndex=0,Uy.test(e))}static replaceCaptures(e,t,n){return e.replace(Uy,(r,i,s,o)=>{let l=n[parseInt(i||s,10)];if(l){let u=t.substring(l.start,l.end);for(;u[0]===".";)u=u.substring(1);switch(o){case"downcase":return u.toLowerCase();case"upcase":return u.toUpperCase();default:return u}}else return r})}};function Pj(e,t){return e<t?-1:e>t?1:0}function Oj(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let i=0;i<n;i++){let s=Pj(e[i],t[i]);if(s!==0)return s}return 0}return n-r}function xN(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function jj(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var zj=class{constructor(e){Z(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},vv=class{constructor(e,t,n){Z(this,"_cachedMatchRoot",new zj(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(pJ(e),t)}static createFromParsedTheme(e,t){return gJ(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(i=>hJ(e.parent,i.parentScopes));return r?new Bj(r.fontStyle,r.foreground,r.background):null}},Vy=class Lg{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Lg(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Lg(n,t[r]);return n}push(t){return new Lg(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function hJ(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!fJ(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function fJ(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Bj=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function pJ(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let i=0,s=t.length;i<s;i++){let o=t[i];if(!o.settings)continue;let l;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),l=h.split(",")}else Array.isArray(o.scope)?l=o.scope:l=[""];let u=-1;if(typeof o.settings.fontStyle=="string"){u=0;let h=o.settings.fontStyle.split(" ");for(let g=0,b=h.length;g<b;g++)switch(h[g]){case"italic":u=u|1;break;case"bold":u=u|2;break;case"underline":u=u|4;break;case"strikethrough":u=u|8;break}}let d=null;typeof o.settings.foreground=="string"&&xN(o.settings.foreground)&&(d=o.settings.foreground);let f=null;typeof o.settings.background=="string"&&xN(o.settings.background)&&(f=o.settings.background);for(let h=0,g=l.length;h<g;h++){let y=l[h].trim().split(" "),x=y[y.length-1],w=null;y.length>1&&(w=y.slice(0,y.length-1),w.reverse()),n[r++]=new mJ(x,w,i,u,d,f)}}return n}var mJ=class{constructor(e,t,n,r,i,s){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=s}},Or=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(Or||{});function gJ(e,t){e.sort((u,d)=>{let f=Pj(u.scope,d.scope);return f!==0||(f=Oj(u.parentScopes,d.parentScopes),f!==0)?f:u.index-d.index});let n=0,r="#000000",i="#ffffff";for(;e.length>=1&&e[0].scope==="";){let u=e.shift();u.fontStyle!==-1&&(n=u.fontStyle),u.foreground!==null&&(r=u.foreground),u.background!==null&&(i=u.background)}let s=new vJ(t),o=new Bj(n,s.getId(r),s.getId(i)),l=new _J(new BS(0,null,-1,0,0),[]);for(let u=0,d=e.length;u<d;u++){let f=e[u];l.insert(0,f.scope,f.parentScopes,f.fontStyle,s.getId(f.foreground),s.getId(f.background))}return new vv(s,o,l)}var vJ=class{constructor(e){Z(this,"_isFrozen");Z(this,"_lastColorId");Z(this,"_id2color");Z(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},bJ=Object.freeze([]),BS=class Fj{constructor(t,n,r,i,s){Z(this,"scopeDepth");Z(this,"parentScopes");Z(this,"fontStyle");Z(this,"foreground");Z(this,"background");this.scopeDepth=t,this.parentScopes=n||bJ,this.fontStyle=r,this.foreground=i,this.background=s}clone(){return new Fj(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,i=t.length;r<i;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,i){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),i!==0&&(this.background=i)}},_J=class FS{constructor(t,n=[],r={}){Z(this,"_rulesWithParentScopes");this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,i=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[i]===">"&&i++,!(r>=t.parentScopes.length||i>=n.parentScopes.length);){const s=n.parentScopes[i].length-t.parentScopes[r].length;if(s!==0)return s;r++,i++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),i,s;if(r===-1?(i=t,s=""):(i=t.substring(0,r),s=t.substring(r+1)),this._children.hasOwnProperty(i))return this._children[i].match(s)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(FS._cmpBySpecificity),n}insert(t,n,r,i,s,o){if(n===""){this._doInsertHere(t,r,i,s,o);return}let l=n.indexOf("."),u,d;l===-1?(u=n,d=""):(u=n.substring(0,l),d=n.substring(l+1));let f;this._children.hasOwnProperty(u)?f=this._children[u]:(f=new FS(this._mainRule.clone(),BS.cloneArr(this._rulesWithParentScopes)),this._children[u]=f),f.insert(t+1,d,r,i,s,o)}_doInsertHere(t,n,r,i,s){if(n===null){this._mainRule.acceptOverwrite(t,r,i,s);return}for(let o=0,l=this._rulesWithParentScopes.length;o<l;o++){let u=this._rulesWithParentScopes[o];if(Oj(u.parentScopes,n)===0){u.acceptOverwrite(t,r,i,s);return}}r===-1&&(r=this._mainRule.fontStyle),i===0&&(i=this._mainRule.foreground),s===0&&(s=this._mainRule.background),this._rulesWithParentScopes.push(new BS(t,n,r,i,s))}},Yu=class Zi{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=Zi.getLanguageId(t),r=Zi.getTokenType(t),i=Zi.getFontStyle(t),s=Zi.getForeground(t),o=Zi.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:s,background:o})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,i,s,o,l){let u=Zi.getLanguageId(t),d=Zi.getTokenType(t),f=Zi.containsBalancedBrackets(t)?1:0,h=Zi.getFontStyle(t),g=Zi.getForeground(t),b=Zi.getBackground(t);return n!==0&&(u=n),r!==8&&(d=r),i!==null&&(f=i?1:0),s!==-1&&(h=s),o!==0&&(g=o),l!==0&&(b=l),(u<<0|d<<8|f<<10|h<<11|g<<15|b<<24)>>>0}};function bv(e,t){const n=[],r=yJ(e);let i=r.next();for(;i!==null;){let u=0;if(i.length===2&&i.charAt(1)===":"){switch(i.charAt(0)){case"R":u=1;break;case"L":u=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let d=o();if(n.push({matcher:d,priority:u}),i!==",")break;i=r.next()}return n;function s(){if(i==="-"){i=r.next();const u=s();return d=>!!u&&!u(d)}if(i==="("){i=r.next();const u=l();return i===")"&&(i=r.next()),u}if(SN(i)){const u=[];do u.push(i),i=r.next();while(SN(i));return d=>t(u,d)}return null}function o(){const u=[];let d=s();for(;d;)u.push(d),d=s();return f=>u.every(h=>h(f))}function l(){const u=[];let d=o();for(;d&&(u.push(d),i==="|"||i===",");){do i=r.next();while(i==="|"||i===",");d=o()}return f=>u.some(h=>h(f))}}function SN(e){return!!e&&!!e.match(/[\w\.:]+/)}function yJ(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function Hj(e){typeof e.dispose=="function"&&e.dispose()}var xf=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},xJ=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},SJ=class{constructor(){Z(this,"_references",[]);Z(this,"_seenReferenceKeys",new Set);Z(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},wJ=class{constructor(e,t){Z(this,"seenFullScopeRequests",new Set);Z(this,"seenPartialScopeRequests",new Set);Z(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new xf(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new SJ;for(const n of e)CJ(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof xf){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function CJ(e,t,n,r){const i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const s=n.lookup(t);e instanceof xf?Dg({baseGrammar:s,selfGrammar:i},r):HS(e.ruleName,{baseGrammar:s,selfGrammar:i,repository:i.repository},r);const o=n.injections(e.scopeName);if(o)for(const l of o)r.add(new xf(l))}function HS(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];_v([r],t,n)}}function Dg(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&_v(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&_v(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function _v(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const i=r.repository?Dj({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&_v(r.patterns,{...t,repository:i},n);const s=r.include;if(!s)continue;const o=$j(s);switch(o.kind){case 0:Dg({...t,selfGrammar:t.baseGrammar},n);break;case 1:Dg(t,n);break;case 2:HS(o.ruleName,{...t,repository:i},n);break;case 3:case 4:const l=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(l){const u={baseGrammar:t.baseGrammar,selfGrammar:l,repository:i};o.kind===4?HS(o.ruleName,u,n):Dg(u,n)}else o.kind===4?n.add(new xJ(o.scopeName,o.ruleName)):n.add(new xf(o.scopeName));break}}}var kJ=class{constructor(){Z(this,"kind",0)}},EJ=class{constructor(){Z(this,"kind",1)}},RJ=class{constructor(e){Z(this,"kind",2);this.ruleName=e}},TJ=class{constructor(e){Z(this,"kind",3);this.scopeName=e}},AJ=class{constructor(e,t){Z(this,"kind",4);this.scopeName=e,this.ruleName=t}};function $j(e){if(e==="$base")return new kJ;if(e==="$self")return new EJ;const t=e.indexOf("#");if(t===-1)return new TJ(e);if(t===0)return new RJ(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new AJ(n,r)}}var NJ=/\\(\d+)/,wN=/\\(\d+)/g,MJ=-1,Uj=-2;var tp=class{constructor(e,t,n,r){Z(this,"$location");Z(this,"id");Z(this,"_nameIsCapturing");Z(this,"_name");Z(this,"_contentNameIsCapturing");Z(this,"_contentName");this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Bm.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Bm.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${Ij(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Bm.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Bm.replaceCaptures(this._contentName,e,t)}},LJ=class extends tp{constructor(t,n,r,i,s){super(t,n,r,i);Z(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,r,i){throw new Error("Not supported!")}},DJ=class extends tp{constructor(t,n,r,i,s){super(t,n,r,null);Z(this,"_match");Z(this,"captures");Z(this,"_cachedCompiledPatterns");this._match=new Sf(i,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t).compileAG(t,r,i)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new wf,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},CN=class extends tp{constructor(t,n,r,i,s){super(t,n,r,i);Z(this,"hasMissingPatterns");Z(this,"patterns");Z(this,"_cachedCompiledPatterns");this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,n){for(const r of this.patterns)t.getRule(r).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t).compileAG(t,r,i)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new wf,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},$S=class extends tp{constructor(t,n,r,i,s,o,l,u,d,f){super(t,n,r,i);Z(this,"_begin");Z(this,"beginCaptures");Z(this,"_end");Z(this,"endHasBackReferences");Z(this,"endCaptures");Z(this,"applyEndPatternLast");Z(this,"hasMissingPatterns");Z(this,"patterns");Z(this,"_cachedCompiledPatterns");this._begin=new Sf(s,this.id),this.beginCaptures=o,this._end=new Sf(l||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=u,this.applyEndPatternLast=d||!1,this.patterns=f.patterns,this.hasMissingPatterns=f.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t,n).compileAG(t,r,i)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new wf;for(const r of this.patterns)t.getRule(r).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},yv=class extends tp{constructor(t,n,r,i,s,o,l,u,d){super(t,n,r,i);Z(this,"_begin");Z(this,"beginCaptures");Z(this,"whileCaptures");Z(this,"_while");Z(this,"whileHasBackReferences");Z(this,"hasMissingPatterns");Z(this,"patterns");Z(this,"_cachedCompiledPatterns");Z(this,"_cachedCompiledWhilePatterns");this._begin=new Sf(s,this.id),this.beginCaptures=o,this.whileCaptures=u,this._while=new Sf(l,Uj),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,r,i){return this._getCachedCompiledPatterns(t).compileAG(t,r,i)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new wf;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,r,i){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,r,i)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new wf,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},Vj=class Dr{static createCaptureRule(t,n,r,i,s){return t.registerRule(o=>new LJ(n,o,r,i,s))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new DJ(t.$vscodeTextmateLocation,t.id,t.name,t.match,Dr._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Dj({},r,t.repository));let s=t.patterns;return typeof s>"u"&&t.include&&(s=[{include:t.include}]),new CN(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Dr._compilePatterns(s,n,r))}return t.while?new yv(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Dr._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,Dr._compileCaptures(t.whileCaptures||t.captures,n,r),Dr._compilePatterns(t.patterns,n,r)):new $S(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Dr._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,Dr._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,Dr._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let s=0;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const l=parseInt(o,10);l>s&&(s=l)}for(let o=0;o<=s;o++)i[o]=null;for(const o in t){if(o==="$vscodeTextmateLocation")continue;const l=parseInt(o,10);let u=0;t[o].patterns&&(u=Dr.getCompiledRuleId(t[o],n,r)),i[l]=Dr.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,u)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let s=0,o=t.length;s<o;s++){const l=t[s];let u=-1;if(l.include){const d=$j(l.include);switch(d.kind){case 0:case 1:u=Dr.getCompiledRuleId(r[l.include],n,r);break;case 2:let f=r[d.ruleName];f&&(u=Dr.getCompiledRuleId(f,n,r));break;case 3:case 4:const h=d.scopeName,g=d.kind===4?d.ruleName:null,b=n.getExternalGrammar(h,r);if(b)if(g){let y=b.repository[g];y&&(u=Dr.getCompiledRuleId(y,n,b.repository))}else u=Dr.getCompiledRuleId(b.repository.$self,n,b.repository);break}}else u=Dr.getCompiledRuleId(l,n,r);if(u!==-1){const d=n.getRule(u);let f=!1;if((d instanceof CN||d instanceof $S||d instanceof yv)&&d.hasMissingPatterns&&d.patterns.length===0&&(f=!0),f)continue;i.push(u)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},Sf=class Wj{constructor(t,n){Z(this,"source");Z(this,"ruleId");Z(this,"hasAnchor");Z(this,"hasBackReferences");Z(this,"_anchorCache");if(t&&typeof t=="string"){const r=t.length;let i=0,s=[],o=!1;for(let l=0;l<r;l++)if(t.charAt(l)==="\\"&&l+1<r){const d=t.charAt(l+1);d==="z"?(s.push(t.substring(i,l)),s.push("$(?!\\n)(?<!\\n)"),i=l+2):(d==="A"||d==="G")&&(o=!0),l++}this.hasAnchor=o,i===0?this.source=t:(s.push(t.substring(i,r)),this.source=s.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=NJ.test(this.source):this.hasBackReferences=!1}clone(){return new Wj(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(i=>t.substring(i.start,i.end));return wN.lastIndex=0,this.source.replace(wN,(i,s)=>jj(r[parseInt(s,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],i=[],s,o,l,u;for(s=0,o=this.source.length;s<o;s++)l=this.source.charAt(s),t[s]=l,n[s]=l,r[s]=l,i[s]=l,l==="\\"&&s+1<o&&(u=this.source.charAt(s+1),u==="A"?(t[s+1]="",n[s+1]="",r[s+1]="A",i[s+1]="A"):u==="G"?(t[s+1]="",n[s+1]="G",r[s+1]="",i[s+1]="G"):(t[s+1]=u,n[s+1]=u,r[s+1]=u,i[s+1]=u),s++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:i.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},wf=class{constructor(){Z(this,"_items");Z(this,"_hasAnchors");Z(this,"_cached");Z(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new kN(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(i=>i.resolveAnchors(t,n));return new kN(e,r,this._items.map(i=>i.ruleId))}},kN=class{constructor(e,t,n){Z(this,"scanner");this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
635
635
|
`)}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Wy=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Po,IJ=(Po=class{constructor(t,n){Z(this,"_defaultAttributes");Z(this,"_embeddedLanguagesMatcher");Z(this,"_getBasicScopeAttributes",new zj(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new Wy(n,r)}));this._defaultAttributes=new Wy(t,8),this._embeddedLanguagesMatcher=new PJ(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?Po._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(Po.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},Z(Po,"_NULL_SCOPE_METADATA",new Wy(0,0)),Z(Po,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),Po),PJ=class{constructor(e){Z(this,"values");Z(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>jj(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},EN=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Gj(e,t,n,r,i,s,o,l){const u=t.content.length;let d=!1,f=-1;if(o){const b=OJ(e,t,n,r,i,s);i=b.stack,r=b.linePos,n=b.isFirstLine,f=b.anchorPosition}const h=Date.now();for(;!d;){if(l!==0&&Date.now()-h>l)return new EN(i,!0);g()}return new EN(i,!1);function g(){const b=jJ(e,t,n,r,i,f);if(!b){s.produce(i,u),d=!0;return}const y=b.captureIndices,x=b.matchedRuleId,w=y&&y.length>0?y[0].end>r:!1;if(x===MJ){const C=i.getRule(e);s.produce(i,y[0].start),i=i.withContentNameScopesList(i.nameScopesList),Bh(e,t,n,i,s,C.endCaptures,y),s.produce(i,y[0].end);const R=i;if(i=i.parent,f=R.getAnchorPos(),!w&&R.getEnterPos()===r){i=R,s.produce(i,u),d=!0;return}}else{const C=e.getRule(x);s.produce(i,y[0].start);const R=i,E=C.getName(t.content,y),T=i.contentNameScopesList.pushAttributed(E,e);if(i=i.push(x,r,f,y[0].end===u,null,T,T),C instanceof $S){const A=C;Bh(e,t,n,i,s,A.beginCaptures,y),s.produce(i,y[0].end),f=y[0].end;const N=A.getContentName(t.content,y),L=T.pushAttributed(N,e);if(i=i.withContentNameScopesList(L),A.endHasBackReferences&&(i=i.withEndRule(A.getEndWithResolvedBackReferences(t.content,y))),!w&&R.hasSameRuleAs(i)){i=i.pop(),s.produce(i,u),d=!0;return}}else if(C instanceof yv){const A=C;Bh(e,t,n,i,s,A.beginCaptures,y),s.produce(i,y[0].end),f=y[0].end;const N=A.getContentName(t.content,y),L=T.pushAttributed(N,e);if(i=i.withContentNameScopesList(L),A.whileHasBackReferences&&(i=i.withEndRule(A.getWhileWithResolvedBackReferences(t.content,y))),!w&&R.hasSameRuleAs(i)){i=i.pop(),s.produce(i,u),d=!0;return}}else if(Bh(e,t,n,i,s,C.captures,y),s.produce(i,y[0].end),i=i.pop(),!w){i=i.safePop(),s.produce(i,u),d=!0;return}}y[0].end>r&&(r=y[0].end,n=!1)}}function OJ(e,t,n,r,i,s){let o=i.beginRuleCapturedEOL?0:-1;const l=[];for(let u=i;u;u=u.pop()){const d=u.getRule(e);d instanceof yv&&l.push({rule:d,stack:u})}for(let u=l.pop();u;u=l.pop()){const{ruleScanner:d,findOptions:f}=FJ(u.rule,e,u.stack.endRule,n,r===o),h=d.findNextMatchSync(t,r,f);if(h){if(h.ruleId!==Uj){i=u.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(s.produce(u.stack,h.captureIndices[0].start),Bh(e,t,n,u.stack,s,u.rule.whileCaptures,h.captureIndices),s.produce(u.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>r&&(r=h.captureIndices[0].end,n=!1))}else{i=u.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function jJ(e,t,n,r,i,s){const o=zJ(e,t,n,r,i,s),l=e.getInjections();if(l.length===0)return o;const u=BJ(l,e,t,n,r,i,s);if(!u)return o;if(!o)return u;const d=o.captureIndices[0].start,f=u.captureIndices[0].start;return f<d||u.priorityMatch&&f===d?u:o}function zJ(e,t,n,r,i,s){const o=i.getRule(e),{ruleScanner:l,findOptions:u}=qj(o,e,i.endRule,n,r===s),d=l.findNextMatchSync(t,r,u);return d?{captureIndices:d.captureIndices,matchedRuleId:d.ruleId}:null}function BJ(e,t,n,r,i,s,o){let l=Number.MAX_VALUE,u=null,d,f=0;const h=s.contentNameScopesList.getScopeNames();for(let g=0,b=e.length;g<b;g++){const y=e[g];if(!y.matcher(h))continue;const x=t.getRule(y.ruleId),{ruleScanner:w,findOptions:C}=qj(x,t,null,r,i===o),R=w.findNextMatchSync(n,i,C);if(!R)continue;const E=R.captureIndices[0].start;if(!(E>=l)&&(l=E,u=R.captureIndices,d=R.ruleId,f=y.priority,l===i))break}return u?{priorityMatch:f===-1,captureIndices:u,matchedRuleId:d}:null}function qj(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function FJ(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Bh(e,t,n,r,i,s,o){if(s.length===0)return;const l=t.content,u=Math.min(s.length,o.length),d=[],f=o[0].end;for(let h=0;h<u;h++){const g=s[h];if(g===null)continue;const b=o[h];if(b.length===0)continue;if(b.start>f)break;for(;d.length>0&&d[d.length-1].endPos<=b.start;)i.produceFromScopes(d[d.length-1].scopes,d[d.length-1].endPos),d.pop();if(d.length>0?i.produceFromScopes(d[d.length-1].scopes,b.start):i.produce(r,b.start),g.retokenizeCapturedWithRuleId){const x=g.getName(l,o),w=r.contentNameScopesList.pushAttributed(x,e),C=g.getContentName(l,o),R=w.pushAttributed(C,e),E=r.push(g.retokenizeCapturedWithRuleId,b.start,-1,!1,null,w,R),T=e.createOnigString(l.substring(0,b.end));Gj(e,T,n&&b.start===0,b.start,E,i,!1,0),Hj(T);continue}const y=g.getName(l,o);if(y!==null){const w=(d.length>0?d[d.length-1].scopes:r.contentNameScopesList).pushAttributed(y,e);d.push(new HJ(w,b.end))}}for(;d.length>0;)i.produceFromScopes(d[d.length-1].scopes,d[d.length-1].endPos),d.pop()}var HJ=class{constructor(e,t){Z(this,"scopes");Z(this,"endPos");this.scopes=e,this.endPos=t}};function $J(e,t,n,r,i,s,o,l){return new VJ(e,t,n,r,i,s,o,l)}function RN(e,t,n,r,i){const s=bv(t,xv),o=Vj.getCompiledRuleId(n,r,i.repository);for(const l of s)e.push({debugSelector:t,matcher:l.matcher,ruleId:o,grammar:i,priority:l.priority})}function xv(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let i=n;i<t.length;i++)if(UJ(t[i],r))return n=i+1,!0;return!1})}function UJ(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var VJ=class{constructor(e,t,n,r,i,s,o,l){Z(this,"_rootId");Z(this,"_lastRuleId");Z(this,"_ruleId2desc");Z(this,"_includedGrammars");Z(this,"_grammarRepository");Z(this,"_grammar");Z(this,"_injections");Z(this,"_basicScopeAttributesProvider");Z(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=s,this._onigLib=l,this._basicScopeAttributesProvider=new IJ(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=TN(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(const u of Object.keys(i)){const d=bv(u,xv);for(const f of d)this._tokenTypeMatchers.push({matcher:f.matcher,type:i[u]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:i=>i===this._rootScopeName?this._grammar:this.getExternalGrammar(i),injections:i=>this._grammarRepository.injections(i)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const i=r.injections;if(i)for(let o in i)RN(t,o,i[o],this,r);const s=this._grammarRepository.injections(n);s&&s.forEach(o=>{const l=this.getExternalGrammar(o);if(l){const u=l.injectionSelector;u&&RN(t,u,l,this,l)}})}return t.sort((i,s)=>i.priority-s.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=TN(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=Vj.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===US.NULL){i=!0;const d=this._basicScopeAttributesProvider.getDefaultAttributes(),f=this.themeProvider.getDefaults(),h=Yu.set(0,d.languageId,d.tokenType,null,f.fontStyle,f.foregroundId,f.backgroundId),g=this.getRule(this._rootId).getName(null,null);let b;g?b=ef.createRootAndLookUpScopeName(g,h,this):b=ef.createRoot("unknown",h),t=new US(null,this._rootId,-1,-1,!1,null,b,b)}else i=!1,t.reset();e=e+`
|
|
636
636
|
`;const s=this.createOnigString(e),o=s.content.length,l=new GJ(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),u=Gj(this,s,i,0,t,l,!0,r);return Hj(s),{lineLength:o,lineTokens:l,ruleStack:u.stack,stoppedEarly:u.stoppedEarly}}};function TN(e,t){return e=cJ(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var ef=class $s{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,i=(t==null?void 0:t.scopePath)??null;for(const s of n)i=Vy.push(i,s.scopeNames),r=new $s(r,i,s.encodedTokenAttributes);return r}static createRoot(t,n){return new $s(null,new Vy(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const i=r.getMetadataForScope(t),s=new Vy(null,t),o=r.themeProvider.themeMatch(s),l=$s.mergeAttributes(n,i,o);return new $s(null,s,l)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return $s.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let i=-1,s=0,o=0;return r!==null&&(i=r.fontStyle,s=r.foregroundId,o=r.backgroundId),Yu.set(t,n.languageId,n.tokenType,null,i,s,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return $s._pushAttributed(this,t,n);const r=t.split(/ /g);let i=this;for(const s of r)i=$s._pushAttributed(i,s,n);return i}static _pushAttributed(t,n,r){const i=r.getMetadataForScope(n),s=t.scopePath.push(n),o=r.themeProvider.themeMatch(s),l=$s.mergeAttributes(t.tokenAttributes,i,o);return new $s(t,s,l)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var i;const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(((i=r.parent)==null?void 0:i.scopePath)??null)}),r=r.parent;return r===t?n.reverse():void 0}},is,US=(is=class{constructor(t,n,r,i,s,o,l,u){Z(this,"_stackElementBrand");Z(this,"_enterPos");Z(this,"_anchorPos");Z(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=s,this.endRule=o,this.nameScopesList=l,this.contentNameScopesList=u,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=i}equals(t){return t===null?!1:is._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?ef.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){is._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,s,o,l){return new is(this,t,n,r,i,s,o,l)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){var r,i;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(r=this.nameScopesList)==null?void 0:r.toString()}, ${(i=this.contentNameScopesList)==null?void 0:i.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new is(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var t,n,r;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((r=this.contentNameScopesList)==null?void 0:r.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const r=ef.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new is(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,ef.fromExtension(r,n.contentNameScopesList))}},Z(is,"NULL",new is(null,0,0,0,!1,null,null,null)),is),WJ=class{constructor(e,t){Z(this,"balancedBracketScopes");Z(this,"unbalancedBracketScopes");Z(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):bv(n,xv).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>bv(n,xv).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},GJ=class{constructor(e,t,n,r){Z(this,"_emitBinaryTokens");Z(this,"_lineText");Z(this,"_tokens");Z(this,"_binaryTokens");Z(this,"_lastTokenEndIndex");Z(this,"_tokenTypeOverrides");this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var r;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let i=(e==null?void 0:e.tokenAttributes)??0,s=!1;if((r=this.balancedBracketSelectors)!=null&&r.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=(e==null?void 0:e.getScopeNames())??[];for(const l of this._tokenTypeOverrides)l.matcher(o)&&(i=Yu.set(i,0,l.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(o))}if(s&&(i=Yu.set(i,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===i){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(i),this._lastTokenEndIndex=t;return}const n=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,i=this._binaryTokens.length;r<i;r++)n[r]=this._binaryTokens[r];return n}},qJ=class{constructor(e,t){Z(this,"_grammars",new Map);Z(this,"_rawGrammars",new Map);Z(this,"_injectionGrammars",new Map);Z(this,"_theme");this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let s=this._rawGrammars.get(e);if(!s)return null;this._grammars.set(e,$J(e,s,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},KJ=class{constructor(t){Z(this,"_options");Z(this,"_syncRegistry");Z(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new qJ(vv.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(vv.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,r){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(t,n,r){return this._loadGrammar(t,n,r.embeddedLanguages,r.tokenTypes,new WJ(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,i,s){const o=new wJ(this._syncRegistry,t);for(;o.Q.length>0;)o.Q.map(l=>this._loadSingleGrammar(l.scopeName)),o.processQueue();return this._grammarForScopeName(t,n,r,i,s)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,i=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,i)}_grammarForScopeName(t,n=0,r=null,i=null,s=null){return this._syncRegistry.grammarForScopeName(t,n,r,i,s)}},VS=US.NULL;const YJ=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class np{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}np.prototype.normal={};np.prototype.property={};np.prototype.space=void 0;function Kj(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new np(n,r,t)}function WS(e){return e.toLowerCase()}class gi{constructor(t,n){this.attribute=n,this.property=t}}gi.prototype.attribute="";gi.prototype.booleanish=!1;gi.prototype.boolean=!1;gi.prototype.commaOrSpaceSeparated=!1;gi.prototype.commaSeparated=!1;gi.prototype.defined=!1;gi.prototype.mustUseProperty=!1;gi.prototype.number=!1;gi.prototype.overloadedBoolean=!1;gi.prototype.property="";gi.prototype.spaceSeparated=!1;gi.prototype.space=void 0;let XJ=0;const It=yc(),Qn=yc(),GS=yc(),Me=yc(),Sn=yc(),Bu=yc(),Ai=yc();function yc(){return 2**++XJ}const qS=Object.freeze(Object.defineProperty({__proto__:null,boolean:It,booleanish:Qn,commaOrSpaceSeparated:Ai,commaSeparated:Bu,number:Me,overloadedBoolean:GS,spaceSeparated:Sn},Symbol.toStringTag,{value:"Module"})),Gy=Object.keys(qS);class IC extends gi{constructor(t,n,r,i){let s=-1;if(super(t,n),AN(this,"space",i),typeof r=="number")for(;++s<Gy.length;){const o=Gy[s];AN(this,Gy[s],(r&qS[o])===qS[o])}}}IC.prototype.defined=!0;function AN(e,t,n){n&&(e[t]=n)}function bd(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new IC(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[WS(r)]=r,n[WS(s.attribute)]=r}return new np(t,n,e.space)}const Yj=bd({properties:{ariaActiveDescendant:null,ariaAtomic:Qn,ariaAutoComplete:null,ariaBusy:Qn,ariaChecked:Qn,ariaColCount:Me,ariaColIndex:Me,ariaColSpan:Me,ariaControls:Sn,ariaCurrent:null,ariaDescribedBy:Sn,ariaDetails:null,ariaDisabled:Qn,ariaDropEffect:Sn,ariaErrorMessage:null,ariaExpanded:Qn,ariaFlowTo:Sn,ariaGrabbed:Qn,ariaHasPopup:null,ariaHidden:Qn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Sn,ariaLevel:Me,ariaLive:null,ariaModal:Qn,ariaMultiLine:Qn,ariaMultiSelectable:Qn,ariaOrientation:null,ariaOwns:Sn,ariaPlaceholder:null,ariaPosInSet:Me,ariaPressed:Qn,ariaReadOnly:Qn,ariaRelevant:null,ariaRequired:Qn,ariaRoleDescription:Sn,ariaRowCount:Me,ariaRowIndex:Me,ariaRowSpan:Me,ariaSelected:Qn,ariaSetSize:Me,ariaSort:null,ariaValueMax:Me,ariaValueMin:Me,ariaValueNow:Me,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Xj(e,t){return t in e?e[t]:t}function Qj(e,t){return Xj(e,t.toLowerCase())}const QJ=bd({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Bu,acceptCharset:Sn,accessKey:Sn,action:null,allow:null,allowFullScreen:It,allowPaymentRequest:It,allowUserMedia:It,alt:null,as:null,async:It,autoCapitalize:null,autoComplete:Sn,autoFocus:It,autoPlay:It,blocking:Sn,capture:null,charSet:null,checked:It,cite:null,className:Sn,cols:Me,colSpan:null,content:null,contentEditable:Qn,controls:It,controlsList:Sn,coords:Me|Bu,crossOrigin:null,data:null,dateTime:null,decoding:null,default:It,defer:It,dir:null,dirName:null,disabled:It,download:GS,draggable:Qn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:It,formTarget:null,headers:Sn,height:Me,hidden:GS,high:Me,href:null,hrefLang:null,htmlFor:Sn,httpEquiv:Sn,id:null,imageSizes:null,imageSrcSet:null,inert:It,inputMode:null,integrity:null,is:null,isMap:It,itemId:null,itemProp:Sn,itemRef:Sn,itemScope:It,itemType:Sn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:It,low:Me,manifest:null,max:null,maxLength:Me,media:null,method:null,min:null,minLength:Me,multiple:It,muted:It,name:null,nonce:null,noModule:It,noValidate:It,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:It,optimum:Me,pattern:null,ping:Sn,placeholder:null,playsInline:It,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:It,referrerPolicy:null,rel:Sn,required:It,reversed:It,rows:Me,rowSpan:Me,sandbox:Sn,scope:null,scoped:It,seamless:It,selected:It,shadowRootClonable:It,shadowRootDelegatesFocus:It,shadowRootMode:null,shape:null,size:Me,sizes:null,slot:null,span:Me,spellCheck:Qn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Me,step:null,style:null,tabIndex:Me,target:null,title:null,translate:null,type:null,typeMustMatch:It,useMap:null,value:Qn,width:Me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Sn,axis:null,background:null,bgColor:null,border:Me,borderColor:null,bottomMargin:Me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:It,declare:It,event:null,face:null,frame:null,frameBorder:null,hSpace:Me,leftMargin:Me,link:null,longDesc:null,lowSrc:null,marginHeight:Me,marginWidth:Me,noResize:It,noHref:It,noShade:It,noWrap:It,object:null,profile:null,prompt:null,rev:null,rightMargin:Me,rules:null,scheme:null,scrolling:Qn,standby:null,summary:null,text:null,topMargin:Me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Me,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:It,disableRemotePlayback:It,prefix:null,property:null,results:Me,security:null,unselectable:null},space:"html",transform:Qj}),ZJ=bd({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ai,accentHeight:Me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Me,amplitude:Me,arabicForm:null,ascent:Me,attributeName:null,attributeType:null,azimuth:Me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Me,by:null,calcMode:null,capHeight:Me,className:Sn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Me,diffuseConstant:Me,direction:null,display:null,dur:null,divisor:Me,dominantBaseline:null,download:It,dx:null,dy:null,edgeMode:null,editable:null,elevation:Me,enableBackground:null,end:null,event:null,exponent:Me,externalResourcesRequired:null,fill:null,fillOpacity:Me,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Bu,g2:Bu,glyphName:Bu,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Me,horizOriginX:Me,horizOriginY:Me,id:null,ideographic:Me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Me,k:Me,k1:Me,k2:Me,k3:Me,k4:Me,kernelMatrix:Ai,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Me,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Me,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Me,overlineThickness:Me,paintOrder:null,panose1:null,path:null,pathLength:Me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Sn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Me,pointsAtY:Me,pointsAtZ:Me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ai,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ai,rev:Ai,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ai,requiredFeatures:Ai,requiredFonts:Ai,requiredFormats:Ai,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Me,specularExponent:Me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Me,strikethroughThickness:Me,string:null,stroke:null,strokeDashArray:Ai,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Me,strokeOpacity:Me,strokeWidth:null,style:null,surfaceScale:Me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ai,tabIndex:Me,tableValues:null,target:null,targetX:Me,targetY:Me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ai,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Me,underlineThickness:Me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Me,values:null,vAlphabetic:Me,vMathematical:Me,vectorEffect:null,vHanging:Me,vIdeographic:Me,version:null,vertAdvY:Me,vertOriginX:Me,vertOriginY:Me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Xj}),Zj=bd({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Jj=bd({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Qj}),e3=bd({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),JJ={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},eee=/[A-Z]/g,NN=/-[a-z]/g,tee=/^data[-\w.:]+$/i;function t3(e,t){const n=WS(t);let r=t,i=gi;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&tee.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(NN,ree);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!NN.test(s)){let o=s.replace(eee,nee);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=IC}return new i(r,t)}function nee(e){return"-"+e.toLowerCase()}function ree(e){return e.charAt(1).toUpperCase()}const n3=Kj([Yj,QJ,Zj,Jj,e3],"html"),rp=Kj([Yj,ZJ,Zj,Jj,e3],"svg"),MN={}.hasOwnProperty;function iee(e,t){const n=t||{};function r(i,...s){let o=r.invalid;const l=r.handlers;if(i&&MN.call(i,e)){const u=String(i[e]);o=MN.call(l,u)?l[u]:r.unknown}if(o)return o.call(this,i,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const see=/["&'<>`]/g,oee=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,aee=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,lee=/[|\\{}()[\]^$+*?.]/g,LN=new WeakMap;function cee(e,t){if(e=e.replace(t.subset?uee(t.subset):see,r),t.subset||t.escapeOnly)return e;return e.replace(oee,n).replace(aee,r);function n(i,s,o){return t.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),t)}function r(i,s,o){return t.format(i.charCodeAt(0),o.charCodeAt(s+1),t)}}function uee(e){let t=LN.get(e);return t||(t=dee(e),LN.set(e,t)),t}function dee(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(lee,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const hee=/[\dA-Fa-f]/;function fee(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!hee.test(String.fromCharCode(t))?r:r+";"}const pee=/\d/;function mee(e,t,n){const r="&#"+String(e);return n&&t&&!pee.test(String.fromCharCode(t))?r:r+";"}const gee=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],qy={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},vee=["cent","copy","divide","gt","lt","not","para","times"],r3={}.hasOwnProperty,KS={};let Fm;for(Fm in qy)r3.call(qy,Fm)&&(KS[qy[Fm]]=Fm);const bee=/[^\dA-Za-z]/;function _ee(e,t,n,r){const i=String.fromCharCode(e);if(r3.call(KS,i)){const s=KS[i],o="&"+s;return n&&gee.includes(s)&&!vee.includes(s)&&(!r||t&&t!==61&&bee.test(String.fromCharCode(t)))?o:o+";"}return""}function yee(e,t,n){let r=fee(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=_ee(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){const s=mee(e,t,n.omitOptionalSemicolons);s.length<r.length&&(r=s)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function Fu(e,t){return cee(e,Object.assign({format:yee},t))}const xee=/^>|^->|<!--|-->|--!>|<!-$/g,See=[">"],wee=["<",">"];function Cee(e,t,n,r){return r.settings.bogusComments?"<?"+Fu(e.value,Object.assign({},r.settings.characterReferences,{subset:See}))+">":"<!--"+e.value.replace(xee,i)+"-->";function i(s){return Fu(s,Object.assign({},r.settings.characterReferences,{subset:wee}))}}function kee(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function Sv(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function i3(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function s3(e){return e.join(" ").trim()}const Eee=/[ \t\n\f\r]/g;function A0(e){return typeof e=="object"?e.type==="text"?DN(e.value):!1:DN(e)}function DN(e){return e.replace(Eee,"")===""}const ur=a3(1),o3=a3(-1),Ree=[];function a3(e){return t;function t(n,r,i){const s=n?n.children:Ree;let o=(r||0)+e,l=s[o];if(!i)for(;l&&A0(l);)o+=e,l=s[o];return l}}const Tee={}.hasOwnProperty;function l3(e){return t;function t(n,r,i){return Tee.call(e,n.tagName)&&e[n.tagName](n,r,i)}}const PC=l3({body:Nee,caption:Ky,colgroup:Ky,dd:Iee,dt:Dee,head:Ky,html:Aee,li:Lee,optgroup:Pee,option:Oee,p:Mee,rp:IN,rt:IN,tbody:zee,td:PN,tfoot:Bee,th:PN,thead:jee,tr:Fee});function Ky(e,t,n){const r=ur(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&A0(r.value.charAt(0)))}function Aee(e,t,n){const r=ur(n,t);return!r||r.type!=="comment"}function Nee(e,t,n){const r=ur(n,t);return!r||r.type!=="comment"}function Mee(e,t,n){const r=ur(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Lee(e,t,n){const r=ur(n,t);return!r||r.type==="element"&&r.tagName==="li"}function Dee(e,t,n){const r=ur(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Iee(e,t,n){const r=ur(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function IN(e,t,n){const r=ur(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Pee(e,t,n){const r=ur(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function Oee(e,t,n){const r=ur(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function jee(e,t,n){const r=ur(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function zee(e,t,n){const r=ur(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Bee(e,t,n){return!ur(n,t)}function Fee(e,t,n){const r=ur(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function PN(e,t,n){const r=ur(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Hee=l3({body:Vee,colgroup:Wee,head:Uee,html:$ee,tbody:Gee});function $ee(e){const t=ur(e,-1);return!t||t.type!=="comment"}function Uee(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function Vee(e){const t=ur(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&A0(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function Wee(e,t,n){const r=o3(n,t),i=ur(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&PC(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function Gee(e,t,n){const r=o3(n,t),i=ur(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&PC(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const Hm={name:[[`
|
|
637
637
|
\f\r &/=>`.split(""),`
|
package/dist/client/index.html
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
})()
|
|
31
31
|
</script>
|
|
32
32
|
<title>Kanna</title>
|
|
33
|
-
<script type="module" crossorigin src="/assets/index-
|
|
33
|
+
<script type="module" crossorigin src="/assets/index-BiI7fqiX.js"></script>
|
|
34
34
|
<link rel="stylesheet" crossorigin href="/assets/index-ZfBgbTjt.css">
|
|
35
35
|
</head>
|
|
36
36
|
<body>
|