kanna-code 0.33.0 → 0.33.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.
- package/README.md +1 -1
- package/dist/client/assets/{index-ab3JkqZ2.js → index-BLUOUI0z.js} +2 -2
- package/dist/client/assets/{index-BYzAMpzV.css → index-FQ1dOuTJ.css} +1 -1
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/src/server/auth.test.ts +21 -31
- package/src/server/auth.ts +7 -142
- package/src/server/server.ts +3 -3
|
@@ -627,7 +627,7 @@ 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},RG="DialogDescriptionWarning",TG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${xO(RG).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},AG=lO,NG=dO,SO=hO,wO=fO,MG=mO,LG=vO,DG=_O;const cf="data-focus-fallback-ignore",CO="data-allow-focus-retain",tv="kanna:restore-chat-input-focus",Fw="data-chat-input",nv="data-chat-selection-zone";function Il(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function kO(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:Il(e,CO):!1}function IG(e){const t=e;return t!=null&&t.matches?kO(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Il(e,CO):!1}function MA(e){return!!e.querySelector(`[${cf}][data-state='open']`)}function PG(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function OG(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${Fw}]`)).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 LA(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||Il(t,Fw)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,u=s??i;return!o||!u||!o.contains(u)||Il(u,cf)||Il(t,cf)||l&&(Il(i,nv)||Il(u,nv))||kO(t)?"none":t&&t===u?"restore":IG(t)?"none":"restore"}const od=AG,jG=NG,EO=_.forwardRef(({className:e,...t},n)=>m.jsx(SO,{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}));EO.displayName=SO.displayName;const zG={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},uc=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(jG,{children:[m.jsx(EO,{}),m.jsxs(wO,{ref:i,[cf]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(tv)),(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",zG[n],e),...r,children:[t,m.jsxs(DG,{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(tl,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));uc.displayName=wO.displayName;function BG({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 ad({className:e,...t}){return m.jsx(MG,{className:xe("text-lg font-medium leading-none tracking-tight",e),...t})}function c0({className:e,...t}){return m.jsx(LG,{className:xe("text-sm text-muted-foreground",e),...t})}function ld({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 cd({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 FG({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 Wr=_.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}));Wr.displayName="Input";const RO=_.createContext(null);function HG({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(RO.Provider,{value:g,children:[e,m.jsx(od,{open:t!==null,onOpenChange:b=>{b||!t||l()},children:m.jsx(uc,{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(ld,{className:"space-y-4",children:[m.jsx(ad,{children:t.options.title}),t.options.description?m.jsx(c0,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Wr,{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(cd,{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 Hw(){const e=_.useContext(RO);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const $w=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("bg-card text-card-foreground",e),...t}));$w.displayName="Card";const Uw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex flex-col space-y-1.5 p-2",e),...t}));Uw.displayName="CardHeader";const TO=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...t}));TO.displayName="CardTitle";const AO=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));AO.displayName="CardDescription";const Vw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("p-6 pt-0",e),...t}));Vw.displayName="CardContent";const $G=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex items-center p-6 pt-0",e),...t}));$G.displayName="CardFooter";const UG=["top","right","bottom","left"],Ya=Math.min,Ci=Math.max,rv=Math.round,Lm=Math.floor,eo=e=>({x:e,y:e}),VG={left:"right",right:"left",bottom:"top",top:"bottom"};function gS(e,t,n){return Ci(e,Ya(t,n))}function Ho(e,t){return typeof e=="function"?e(t):e}function $o(e){return e.split("-")[0]}function ud(e){return e.split("-")[1]}function Ww(e){return e==="x"?"y":"x"}function Gw(e){return e==="y"?"height":"width"}function Ys(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function qw(e){return Ww(Ys(e))}function WG(e,t,n){n===void 0&&(n=!1);const r=ud(e),i=qw(e),s=Gw(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=iv(o)),[o,iv(o)]}function GG(e){const t=iv(e);return[vS(e),t,vS(t)]}function vS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const DA=["left","right"],IA=["right","left"],qG=["top","bottom"],KG=["bottom","top"];function YG(e,t,n){switch(e){case"top":case"bottom":return n?t?IA:DA:t?DA:IA;case"left":case"right":return t?qG:KG;default:return[]}}function XG(e,t,n,r){const i=ud(e);let s=YG($o(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(vS)))),s}function iv(e){const t=$o(e);return VG[t]+e.slice(t.length)}function QG(e){return{top:0,right:0,bottom:0,left:0,...e}}function NO(e){return typeof e!="number"?QG(e):{top:e,right:e,bottom:e,left:e}}function sv(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 PA(e,t,n){let{reference:r,floating:i}=e;const s=Ys(t),o=qw(t),l=Gw(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(ud(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 ZG(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=NO(b),w=l[g?h==="floating"?"reference":"floating":h],C=sv(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},N=sv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:E,strategy:u}):R);return{top:(C.top-N.top+y.top)/T.y,bottom:(N.bottom-C.bottom+y.bottom)/T.y,left:(C.left-N.left+y.left)/T.x,right:(N.right-C.right+y.right)/T.x}}const JG=50,eq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:ZG},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}=PA(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:N,reset:A}=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],...N},A&&b<JG&&(b++,typeof A=="object"&&(A.placement&&(g=A.placement),A.rects&&(d=A.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:f,y:h}=PA(d,g,u)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},tq=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=NO(f),g={x:n,y:r},b=qw(i),y=Gw(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],N=g[b]-s.reference[b],A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let L=A?A[E]:0;(!L||!await(o.isElement==null?void 0:o.isElement(A)))&&(L=l.floating[E]||s.floating[y]);const O=T/2-N/2,G=L/2-x[y]/2-1,P=Ya(h[C],G),j=Ya(h[R],G),B=P,H=L-x[y]-j,$=L/2-x[y]/2+O,V=gS(B,$,H),z=!u.arrow&&ud(i)!=null&&$!==V&&s.reference[y]/2-($<B?P:j)-x[y]/2<0,q=z?$<B?$-B:$-H:0;return{[b]:g[b]+q,data:{[b]:V,centerOffset:$-V-q,...z&&{alignmentOffset:q}},reset:z}}}),nq=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=Ys(l),E=$o(l)===l,T=await(u.isRTL==null?void 0:u.isRTL(d.floating)),N=g||(E||!x?[iv(l)]:GG(l)),A=y!=="none";!g&&A&&N.push(...XG(l,x,y,T));const L=[l,...N],O=await u.detectOverflow(t,w),G=[];let P=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(O[C]),h){const $=WG(i,o,T);G.push(O[$[0]],O[$[1]])}if(P=[...P,{placement:i,overflows:G}],!G.every($=>$<=0)){var j,B;const $=(((j=s.flip)==null?void 0:j.index)||0)+1,V=L[$];if(V&&(!(h==="alignment"?R!==Ys(V):!1)||P.every(F=>Ys(F.placement)===R?F.overflows[0]>0:!0)))return{data:{index:$,overflows:P},reset:{placement:V}};let z=(B=P.filter(q=>q.overflows[0]<=0).sort((q,F)=>q.overflows[1]-F.overflows[1])[0])==null?void 0:B.placement;if(!z)switch(b){case"bestFit":{var H;const q=(H=P.filter(F=>{if(A){const Y=Ys(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:H[0];q&&(z=q);break}case"initialPlacement":z=l;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function OA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function jA(e){return UG.some(t=>e[t]>=0)}const rq=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=OA(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:jA(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=OA(o,n.floating);return{data:{escapedOffsets:l,escaped:jA(l)}}}default:return{}}}}},MO=new Set(["left","top"]);async function iq(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=ud(n),u=Ys(n)==="y",d=MO.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 sq=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 iq(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}}}}},oq=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=Ys($o(i)),b=Ww(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=gS(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=gS(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}}}}}},aq=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=Ys(i),g=Ww(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,N=s.reference[g]+s.reference[E]-w.mainAxis;b<T?b=T:b>N&&(b=N)}if(d){var C,R;const E=g==="y"?"width":"height",T=MO.has($o(i)),N=s.reference[h]-s.floating[E]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),A=s.reference[h]+s.reference[E]+(T?0:((R=o.offset)==null?void 0:R[h])||0)-(T?w.crossAxis:0);y<N?y=N:y>A&&(y=A)}return{[g]:b,[h]:y}}}},lq=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=ud(i),b=Ys(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=Ya(x-f[w],R),N=Ya(y-f[C],E),A=!t.middlewareData.shift;let L=T,O=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=R),A&&!g){const P=Ci(f.left,0),j=Ci(f.right,0),B=Ci(f.top,0),H=Ci(f.bottom,0);b?O=y-2*(P!==0||j!==0?P+j:Ci(f.left,f.right)):L=x-2*(B!==0||H!==0?B+H:Ci(f.top,f.bottom))}await u({...t,availableWidth:O,availableHeight:L});const G=await o.getDimensions(l.floating);return y!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function u0(){return typeof window<"u"}function dd(e){return LO(e)?(e.nodeName||"").toLowerCase():"#document"}function Ei(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function io(e){var t;return(t=(LO(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function LO(e){return u0()?e instanceof Node||e instanceof Ei(e).Node:!1}function Rs(e){return u0()?e instanceof Element||e instanceof Ei(e).Element:!1}function Ko(e){return u0()?e instanceof HTMLElement||e instanceof Ei(e).HTMLElement:!1}function zA(e){return!u0()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ei(e).ShadowRoot}function Vf(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ts(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function cq(e){return/^(table|td|th)$/.test(dd(e))}function d0(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const uq=/transform|translate|scale|rotate|perspective|filter/,dq=/paint|layout|strict|content/,El=e=>!!e&&e!=="none";let Ny;function Kw(e){const t=Rs(e)?Ts(e):e;return El(t.transform)||El(t.translate)||El(t.scale)||El(t.rotate)||El(t.perspective)||!Yw()&&(El(t.backdropFilter)||El(t.filter))||uq.test(t.willChange||"")||dq.test(t.contain||"")}function hq(e){let t=Xa(e);for(;Ko(t)&&!Hu(t);){if(Kw(t))return t;if(d0(t))return null;t=Xa(t)}return null}function Yw(){return Ny==null&&(Ny=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ny}function Hu(e){return/^(html|body|#document)$/.test(dd(e))}function Ts(e){return Ei(e).getComputedStyle(e)}function h0(e){return Rs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xa(e){if(dd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||zA(e)&&e.host||io(e);return zA(t)?t.host:t}function DO(e){const t=Xa(e);return Hu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ko(t)&&Vf(t)?t:DO(t)}function uf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=DO(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Ei(i);if(s){const l=bS(o);return t.concat(o,o.visualViewport||[],Vf(i)?i:[],l&&n?uf(l):[])}else return t.concat(i,uf(i,[],n))}function bS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function IO(e){const t=Ts(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=rv(n)!==s||rv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function Xw(e){return Rs(e)?e:e.contextElement}function Nu(e){const t=Xw(e);if(!Ko(t))return eo(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=IO(t);let o=(s?rv(n.width):n.width)/r,l=(s?rv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const fq=eo(0);function PO(e){const t=Ei(e);return!Yw()||!t.visualViewport?fq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ei(e)?!1:t}function Ql(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=Xw(e);let o=eo(1);t&&(r?Rs(r)&&(o=Nu(r)):o=Nu(e));const l=pq(s,n,r)?PO(s):eo(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=Ei(s),b=r&&Rs(r)?Ei(r):r;let y=g,x=bS(y);for(;x&&r&&b!==y;){const w=Nu(x),C=x.getBoundingClientRect(),R=Ts(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=Ei(x),x=bS(y)}}return sv({width:f,height:h,x:u,y:d})}function f0(e,t){const n=h0(e).scrollLeft;return t?t.left+n:Ql(io(e)).left+n}function OO(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-f0(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function mq(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=io(r),l=t?d0(t.floating):!1;if(r===o||l&&s)return n;let u={scrollLeft:0,scrollTop:0},d=eo(1);const f=eo(0),h=Ko(r);if((h||!h&&!s)&&((dd(r)!=="body"||Vf(o))&&(u=h0(r)),h)){const b=Ql(r);d=Nu(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!h&&!s?OO(o,u):eo(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 gq(e){return Array.from(e.getClientRects())}function vq(e){const t=io(e),n=h0(e),r=e.ownerDocument.body,i=Ci(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ci(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+f0(e);const l=-n.scrollTop;return Ts(r).direction==="rtl"&&(o+=Ci(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const BA=25;function bq(e,t){const n=Ei(e),r=io(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=Yw();(!f||f&&t==="fixed")&&(l=i.offsetLeft,u=i.offsetTop)}const d=f0(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<=BA&&(s-=y)}else d<=BA&&(s+=d);return{width:s,height:o,x:l,y:u}}function _q(e,t){const n=Ql(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Ko(e)?Nu(e):eo(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 FA(e,t,n){let r;if(t==="viewport")r=bq(e,n);else if(t==="document")r=vq(io(e));else if(Rs(t))r=_q(t,n);else{const i=PO(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return sv(r)}function jO(e,t){const n=Xa(e);return n===t||!Rs(n)||Hu(n)?!1:Ts(n).position==="fixed"||jO(n,t)}function yq(e,t){const n=t.get(e);if(n)return n;let r=uf(e,[],!1).filter(l=>Rs(l)&&dd(l)!=="body"),i=null;const s=Ts(e).position==="fixed";let o=s?Xa(e):e;for(;Rs(o)&&!Hu(o);){const l=Ts(o),u=Kw(o);!u&&l.position==="fixed"&&(i=null),(s?!u&&!i:!u&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Vf(o)&&!u&&jO(e,o))?r=r.filter(f=>f!==o):i=l,o=Xa(o)}return t.set(e,r),r}function xq(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?d0(t)?[]:yq(t,this._c):[].concat(n),r],l=FA(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=FA(t,o[g],i);u=Ci(b.top,u),d=Ya(b.right,d),f=Ya(b.bottom,f),h=Ci(b.left,h)}return{width:d-h,height:f-u,x:h,y:u}}function Sq(e){const{width:t,height:n}=IO(e);return{width:t,height:n}}function wq(e,t,n){const r=Ko(t),i=io(t),s=n==="fixed",o=Ql(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=eo(0);function d(){u.x=f0(i)}if(r||!r&&!s)if((dd(t)!=="body"||Vf(i))&&(l=h0(t)),r){const b=Ql(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?OO(i,l):eo(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 My(e){return Ts(e).position==="static"}function HA(e,t){if(!Ko(e)||Ts(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return io(e)===n&&(n=n.ownerDocument.body),n}function zO(e,t){const n=Ei(e);if(d0(e))return n;if(!Ko(e)){let i=Xa(e);for(;i&&!Hu(i);){if(Rs(i)&&!My(i))return i;i=Xa(i)}return n}let r=HA(e,t);for(;r&&cq(r)&&My(r);)r=HA(r,t);return r&&Hu(r)&&My(r)&&!Kw(r)?n:r||hq(e)||n}const Cq=async function(e){const t=this.getOffsetParent||zO,n=this.getDimensions,r=await n(e.floating);return{reference:wq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function kq(e){return Ts(e).direction==="rtl"}const Eq={convertOffsetParentRelativeRectToViewportRelativeRect:mq,getDocumentElement:io,getClippingRect:xq,getOffsetParent:zO,getElementRects:Cq,getClientRects:gq,getDimensions:Sq,getScale:Nu,isElement:Rs,isRTL:kq};function BO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Rq(e,t){let n=null,r;const i=io(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=Lm(h),x=Lm(i.clientWidth-(f+g)),w=Lm(i.clientHeight-(h+b)),C=Lm(f),E={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:Ci(0,Ya(1,u))||1};let T=!0;function N(A){const L=A[0].intersectionRatio;if(L!==u){if(!T)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!BO(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(N,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(N,E)}n.observe(e)}return o(!0),s}function Tq(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=Xw(e),f=i||s?[...d?uf(d):[],...t?uf(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?Rq(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?Ql(e):null;u&&w();function w(){const C=Ql(e);x&&!BO(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 Aq=sq,Nq=oq,Mq=nq,Lq=lq,Dq=rq,$A=tq,Iq=aq,Pq=(e,t,n)=>{const r=new Map,i={platform:Eq,...n},s={...i.platform,_c:r};return eq(e,t,{...i,platform:s})};var Oq=typeof document<"u",jq=function(){},Rg=Oq?_.useLayoutEffect:jq;function ov(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(!ov(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)&&!ov(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function FO(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function UA(e,t){const n=FO(e);return Math.round(t*n)/n}function Ly(e){const t=_.useRef(e);return Rg(()=>{t.current=e}),t}function zq(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);ov(g,r)||b(r);const[y,x]=_.useState(null),[w,C]=_.useState(null),R=_.useCallback(F=>{F!==A.current&&(A.current=F,x(F))},[]),E=_.useCallback(F=>{F!==L.current&&(L.current=F,C(F))},[]),T=s||y,N=o||w,A=_.useRef(null),L=_.useRef(null),O=_.useRef(f),G=u!=null,P=Ly(u),j=Ly(i),B=Ly(d),H=_.useCallback(()=>{if(!A.current||!L.current)return;const F={placement:t,strategy:n,middleware:g};j.current&&(F.platform=j.current),Pq(A.current,L.current,F).then(Y=>{const I={...Y,isPositioned:B.current!==!1};$.current&&!ov(O.current,I)&&(O.current=I,is.flushSync(()=>{h(I)}))})},[g,t,n,j,B]);Rg(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[d]);const $=_.useRef(!1);Rg(()=>($.current=!0,()=>{$.current=!1}),[]),Rg(()=>{if(T&&(A.current=T),N&&(L.current=N),T&&N){if(P.current)return P.current(T,N,H);H()}},[T,N,H,P,G]);const V=_.useMemo(()=>({reference:A,floating:L,setReference:R,setFloating:E}),[R,E]),z=_.useMemo(()=>({reference:T,floating:N}),[T,N]),q=_.useMemo(()=>{const F={position:n,left:0,top:0};if(!z.floating)return F;const Y=UA(z.floating,f.x),I=UA(z.floating,f.y);return l?{...F,transform:"translate("+Y+"px, "+I+"px)",...FO(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:I}},[n,l,z.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:H,refs:V,elements:z,floatingStyles:q}),[f,H,V,z,q])}const Bq=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?$A({element:r.current,padding:i}).fn(n):{}:r?$A({element:r,padding:i}).fn(n):{}}}},Fq=(e,t)=>{const n=Aq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hq=(e,t)=>{const n=Nq(e);return{name:n.name,fn:n.fn,options:[e,t]}},$q=(e,t)=>({fn:Iq(e).fn,options:[e,t]}),Uq=(e,t)=>{const n=Mq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vq=(e,t)=>{const n=Lq(e);return{name:n.name,fn:n.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=Bq(e);return{name:n.name,fn:n.fn,options:[e,t]}};var qq="Arrow",HO=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Ut.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"})})});HO.displayName=qq;var Kq=HO;function Yq(e){const[t,n]=_.useState(void 0);return Or(()=>{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 Qw="Popper",[$O,rl]=qo(Qw),[Xq,UO]=$O(Qw),VO=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(Xq,{scope:t,anchor:r,onAnchorChange:i,children:n})};VO.displayName=Qw;var WO="PopperAnchor",GO=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=UO(WO,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(Ut.div,{...i,ref:l})});GO.displayName=WO;var Zw="PopperContent",[Qq,Zq]=$O(Zw),qO=_.forwardRef((e,t)=>{var se,pe,re,me,Ee,we;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=UO(Zw,n),[C,R]=_.useState(null),E=an(t,Ae=>R(Ae)),[T,N]=_.useState(null),A=Yq(T),L=(A==null?void 0:A.width)??0,O=(A==null?void 0:A.height)??0,G=r+(s!=="center"?"-"+s:""),P=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},j=Array.isArray(d)?d:[d],B=j.length>0,H={padding:P,boundary:j.filter(eK),altBoundary:B},{refs:$,floatingStyles:V,placement:z,isPositioned:q,middlewareData:F}=zq({strategy:"fixed",placement:G,whileElementsMounted:(...Ae)=>Tq(...Ae,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[Fq({mainAxis:i+O,alignmentAxis:o}),u&&Hq({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?$q():void 0,...H}),u&&Uq({...H}),Vq({...H,apply:({elements:Ae,rects:ze,availableWidth:Ue,availableHeight:tt})=>{const{width:kt,height:Qt}=ze.reference,Pe=Ae.floating.style;Pe.setProperty("--radix-popper-available-width",`${Ue}px`),Pe.setProperty("--radix-popper-available-height",`${tt}px`),Pe.setProperty("--radix-popper-anchor-width",`${kt}px`),Pe.setProperty("--radix-popper-anchor-height",`${Qt}px`)}}),T&&Gq({element:T,padding:l}),tK({arrowWidth:L,arrowHeight:O}),g&&Wq({strategy:"referenceHidden",...H})]}),[Y,I]=XO(z),U=Es(y);Or(()=>{q&&(U==null||U())},[q,U]);const X=(se=F.arrow)==null?void 0:se.x,D=(pe=F.arrow)==null?void 0:pe.y,te=((re=F.arrow)==null?void 0:re.centerOffset)!==0,[Q,ie]=_.useState();return Or(()=>{C&&ie(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":[(me=F.transformOrigin)==null?void 0:me.x,(Ee=F.transformOrigin)==null?void 0:Ee.y].join(" "),...((we=F.hide)==null?void 0:we.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(Qq,{scope:n,placedSide:Y,onArrowChange:N,arrowX:X,arrowY:D,shouldHideArrow:te,children:m.jsx(Ut.div,{"data-side":Y,"data-align":I,...x,ref:E,style:{...x.style,animation:q?void 0:"none"}})})})});qO.displayName=Zw;var KO="PopperArrow",Jq={top:"bottom",right:"left",bottom:"top",left:"right"},YO=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=Zq(KO,r),o=Jq[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(Kq,{...i,ref:n,style:{...i.style,display:"block"}})})});YO.displayName=KO;function eK(e){return e!==null}var tK=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]=XO(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 XO(e){const[t,n="center"]=e.split("-");return[t,n]}var p0=VO,Wf=GO,m0=qO,g0=YO,QO=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"}),nK="VisuallyHidden",ZO=_.forwardRef((e,t)=>m.jsx(Ut.span,{...e,ref:t,style:{...QO,...e.style}}));ZO.displayName=nK;var rK=ZO,[v0]=qo("Tooltip",[rl]),b0=rl(),JO="TooltipProvider",iK=700,_S="tooltip.open",[sK,Jw]=v0(JO),e5=e=>{const{__scopeTooltip:t,delayDuration:n=iK,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(sK,{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})};e5.displayName=JO;var df="Tooltip",[oK,Gf]=v0(df),t5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,u=Jw(df,e.__scopeTooltip),d=b0(t),[f,h]=_.useState(null),g=zo(),b=_.useRef(0),y=o??u.disableHoverableContent,x=l??u.delayDuration,w=_.useRef(!1),[C,R]=Fu({prop:r,defaultProp:i??!1,onChange:L=>{L?(u.onOpen(),document.dispatchEvent(new CustomEvent(_S))):u.onClose(),s==null||s(L)},caller:df}),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]),N=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,R(!1)},[R]),A=_.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(p0,{...d,children:m.jsx(oK,{scope:t,contentId:g,open:C,stateAttribute:E,trigger:f,onTriggerChange:h,onTriggerEnter:_.useCallback(()=>{u.isOpenDelayedRef.current?A():T()},[u.isOpenDelayedRef,A,T]),onTriggerLeave:_.useCallback(()=>{y?N():(window.clearTimeout(b.current),b.current=0)},[N,y]),onOpen:T,onClose:N,disableHoverableContent:y,children:n})})};t5.displayName=df;var yS="TooltipTrigger",n5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Gf(yS,n),s=Jw(yS,n),o=b0(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(Wf,{asChild:!0,...o,children:m.jsx(Ut.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:u,onPointerMove:He(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:He(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:He(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:He(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:He(e.onBlur,i.onClose),onClick:He(e.onClick,i.onClose)})})});n5.displayName=yS;var eC="TooltipPortal",[aK,lK]=v0(eC,{forceMount:void 0}),r5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=Gf(eC,t);return m.jsx(aK,{scope:t,forceMount:n,children:m.jsx(hs,{present:n||s.open,children:m.jsx(sd,{asChild:!0,container:i,children:r})})})};r5.displayName=eC;var $u="TooltipContent",i5=_.forwardRef((e,t)=>{const n=lK($u,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=Gf($u,e.__scopeTooltip);return m.jsx(hs,{present:r||o.open,children:o.disableHoverableContent?m.jsx(s5,{side:i,...s,ref:t}):m.jsx(cK,{side:i,...s,ref:t})})}),cK=_.forwardRef((e,t)=>{const n=Gf($u,e.__scopeTooltip),r=Jw($u,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=pK(C,w.getBoundingClientRect()),E=mK(C,R),T=gK(x.getBoundingClientRect()),N=bK([...E,...T]);l(N),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=!vK(C,o);R?g():E&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[u,f,o,d,g]),m.jsx(s5,{...e,ref:s})}),[uK,dK]=v0(df,{isInside:!1}),hK=uW("TooltipContent"),s5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,u=Gf($u,n),d=b0(n),{onClose:f}=u;return _.useEffect(()=>(document.addEventListener(_S,f),()=>document.removeEventListener(_S,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(id,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(m0,{"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(hK,{children:r}),m.jsx(uK,{scope:n,isInside:!0,children:m.jsx(rK,{id:u.contentId,role:"tooltip",children:i||r})})]})})});i5.displayName=$u;var o5="TooltipArrow",fK=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=b0(n);return dK(o5,n).isInside?null:m.jsx(g0,{...i,...r,ref:t})});fK.displayName=o5;function pK(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 mK(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 gK(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 vK(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 bK(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),_K(t)}function _K(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 yK=e5,a5=t5,l5=n5,c5=r5,tC=i5;function u5({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 xK({className:e,...t}){return m.jsx("span",{className:xe("inline-flex items-center gap-0.5",e),...t})}const SK="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",wK=yK,Qa=a5,Za=l5,Uo=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(c5,{children:m.jsx(tC,{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=tC.displayName;const Ph=a5,Oh=l5;function d5(e){return e.toUpperCase()}function CK(e){const t=e.split("+");return m.jsx(xK,{children:t.map((n,r)=>m.jsx(u5,{children:d5(n)},`${n}-${r}`))})}const Su=_.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(c5,{children:m.jsx(tC,{ref:s,sideOffset:t,className:xe(SK,e),...i,children:o?CK(o):m.jsx("span",{children:typeof n=="string"?d5(n):n})})})});Su.displayName="HotkeyTooltipContent";const kK="0.33.0",EK={version:kK},Un="Kanna",VA="kanna",RK=".kanna",TK=".kanna-dev",AK="KANNA_RUNTIME_PROFILE",nC=`kanna/${EK.version}`,NK="[kanna]",MK=`~/${Un}`;function _0(){var t;return(t=globalThis.process)==null?void 0:t.env}function LK(e=_0()){var t;return((t=e==null?void 0:e[AK])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function DK(e=_0()){return LK(e)==="dev"?TK:RK}function IK(e=_0()){return`~/${DK(e)}`}function PK(e=_0()){return`${IK(e)}/keybindings.json`}function Dm(e){return e?`${VA} ${e}`:VA}const WA=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},OK=(e=>e?WA(e):WA),jK=e=>e;function zK(e,t=jK){const n=gn.useSyncExternalStore(e.subscribe,gn.useCallback(()=>t(e.getState()),[e,t]),gn.useCallback(()=>t(e.getInitialState()),[e,t]));return gn.useDebugValue(n),n}const BK=e=>{const t=OK(e),n=r=>zK(t,r);return Object.assign(n,t),n},dc=(e=>BK);function FK(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 xS=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return xS(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return xS(r)(n)}}}},HK=(e,t)=>(n,r,i)=>{let s={storage:FK(()=>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 N;return T((N=r())!=null?N:b)});const E=((C=s.onRehydrateStorage)==null?void 0:C.call(s,(w=r())!=null?w:b))||void 0;return xS(f.getItem.bind(f))(s.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==s.version){if(s.migrate){const N=s.migrate(T.state,T.version);return N instanceof Promise?N.then(A=>[!0,A]):[!0,N]}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 N;if(R!==l)return;const[A,L]=T;if(y=s.merge(L,(N=r())!=null?N:b),n(y,!0),A)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},hc=HK,h5="always",f5="funk",$K=[{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 GA(e){switch(e){case"never":case"unfocused":case"always":return e;default:return h5}}function qA(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 f5}}const wu=dc()(hc(e=>({chatSoundPreference:h5,chatSoundId:f5,setChatSoundPreference:t=>e({chatSoundPreference:GA(t)}),setChatSoundId:t=>e({chatSoundId:qA(t)})}),{name:"chat-sound-preferences",version:2,migrate:e=>{const t=e;return{chatSoundPreference:GA(t==null?void 0:t.chatSoundPreference),chatSoundId:qA(t==null?void 0:t.chatSoundId)}}})),UK={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 VK(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function WK(e){const t=new Audio(UK[e]);return t.preload="auto",t.play()}async function SS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{WK(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function GK(e,t=document){return e==="never"?!1:e==="always"?!0:VK(t)}function qK(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 KA(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 KK(e,t){if(!e)return 0;const n=KA(e),r=KA(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 hd=({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 wS(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const YK=[/^(?:\/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 XK(e){const t=e.trim();for(const n of YK){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function p5(e){return e.split("/").pop()||e}const QK=1440*6e4;function ZK(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=QK,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 JK(e){return e.lastMessageAt??e._creationTime}const eY=new Set(["starting","running"]);function tY({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onForkChat:o,onDeleteChat:l}){const u=ZK(JK(e),n),d=i&&r?r:u,f=i&&!!r,h=tW(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:[eY.has(e.status)?m.jsx(kn,{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(hd,{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(u5,{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(qU,{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(p$,{className:"size-3.5"})})]})]})]},e._id)}const nY=_.memo(tY);function rY(){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 y0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function fd(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function rC(e){return"nodeType"in e}function ci(e){var t,n;return e?fd(e)?e:rC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function iC(e){const{Document:t}=ci(e);return e instanceof t}function qf(e){return fd(e)?!1:e instanceof ci(e).HTMLElement}function m5(e){return e instanceof ci(e).SVGElement}function pd(e){return e?fd(e)?e.document:rC(e)?iC(e)?e:qf(e)||m5(e)?e.ownerDocument:document:document:document}const no=y0?_.useLayoutEffect:_.useEffect;function sC(e){const t=_.useRef(e);return no(()=>{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 iY(){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 hf(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return no(()=>{n.current!==e&&(n.current=e)},t),n}function Kf(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function av(e){const t=sC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function CS(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let Dy={};function Yf(e,t){return _.useMemo(()=>{if(t)return t;const n=Dy[e]==null?0:Dy[e]+1;return Dy[e]=n,e+"-"+n},[e,t])}function g5(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 Mu=g5(1),lv=g5(-1);function sY(e){return"clientX"in e&&"clientY"in e}function oC(e){if(!e)return!1;const{KeyboardEvent:t}=ci(e.target);return t&&e instanceof t}function oY(e){if(!e)return!1;const{TouchEvent:t}=ci(e.target);return t&&e instanceof t}function kS(e){if(oY(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 sY(e)?{x:e.clientX,y:e.clientY}:null}const ff=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[ff.Translate.toString(e),ff.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),YA="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function aY(e){return e.matches(YA)?e:e.querySelector(YA)}const lY={display:"none"};function cY(e){let{id:t,value:n}=e;return gn.createElement("div",{id:t,style:lY},n)}function uY(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 gn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function dY(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const v5=_.createContext(null);function hY(e){const t=_.useContext(v5);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function fY(){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 pY={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},RG="DialogDescriptionWarning",TG=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${xO(RG).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},AG=lO,NG=dO,SO=hO,wO=fO,MG=mO,LG=vO,DG=_O;const cf="data-focus-fallback-ignore",CO="data-allow-focus-retain",tv="kanna:restore-chat-input-focus",Fw="data-chat-input",nv="data-chat-selection-zone";function Il(e,t){return!!(e!=null&&e.closest(`[${t}]`))}function kO(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:Il(e,CO):!1}function IG(e){const t=e;return t!=null&&t.matches?kO(e)||(t.tabIndex??-1)>=0||t.matches("button, a[href], summary")?!0:Il(e,CO):!1}function MA(e){return!!e.querySelector(`[${cf}][data-state='open']`)}function PG(e){return e?!e.isCollapsed&&e.toString().trim().length>0:!1}function OG(e,t){if(!e)return!1;const n=Array.from(t.querySelectorAll(`textarea[${Fw}]`)).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 LA(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||Il(t,Fw)||e.canCancel?"none":"escape-focus";const{pointerStartTarget:i,pointerEndTarget:s,root:o,hasActiveSelection:l}=e,u=s??i;return!o||!u||!o.contains(u)||Il(u,cf)||Il(t,cf)||l&&(Il(i,nv)||Il(u,nv))||kO(t)?"none":t&&t===u?"restore":IG(t)?"none":"restore"}const od=AG,jG=NG,EO=_.forwardRef(({className:e,...t},n)=>m.jsx(SO,{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}));EO.displayName=SO.displayName;const zG={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"},uc=_.forwardRef(({className:e,children:t,size:n="md",...r},i)=>m.jsxs(jG,{children:[m.jsx(EO,{}),m.jsxs(wO,{ref:i,[cf]:"",onCloseAutoFocus:s=>{var o;s.preventDefault(),window.dispatchEvent(new Event(tv)),(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",zG[n],e),...r,children:[t,m.jsxs(DG,{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(tl,{className:"h-4 w-4"}),m.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));uc.displayName=wO.displayName;function BG({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 ad({className:e,...t}){return m.jsx(MG,{className:xe("text-lg font-medium leading-none tracking-tight",e),...t})}function c0({className:e,...t}){return m.jsx(LG,{className:xe("text-sm text-muted-foreground",e),...t})}function ld({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 cd({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 FG({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 Wr=_.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}));Wr.displayName="Input";const RO=_.createContext(null);function HG({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(RO.Provider,{value:g,children:[e,m.jsx(od,{open:t!==null,onOpenChange:b=>{b||!t||l()},children:m.jsx(uc,{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(ld,{className:"space-y-4",children:[m.jsx(ad,{children:t.options.title}),t.options.description?m.jsx(c0,{children:t.options.description}):null,t.kind==="prompt"?m.jsx(Wr,{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(cd,{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 Hw(){const e=_.useContext(RO);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const $w=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("bg-card text-card-foreground",e),...t}));$w.displayName="Card";const Uw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex flex-col space-y-1.5 p-2",e),...t}));Uw.displayName="CardHeader";const TO=_.forwardRef(({className:e,...t},n)=>m.jsx("h3",{ref:n,className:xe("text-2xl font-semibold leading-none tracking-tight",e),...t}));TO.displayName="CardTitle";const AO=_.forwardRef(({className:e,...t},n)=>m.jsx("p",{ref:n,className:xe("text-sm text-muted-foreground",e),...t}));AO.displayName="CardDescription";const Vw=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("p-6 pt-0",e),...t}));Vw.displayName="CardContent";const $G=_.forwardRef(({className:e,...t},n)=>m.jsx("div",{ref:n,className:xe("flex items-center p-6 pt-0",e),...t}));$G.displayName="CardFooter";const UG=["top","right","bottom","left"],Ya=Math.min,Ci=Math.max,rv=Math.round,Lm=Math.floor,eo=e=>({x:e,y:e}),VG={left:"right",right:"left",bottom:"top",top:"bottom"};function gS(e,t,n){return Ci(e,Ya(t,n))}function Ho(e,t){return typeof e=="function"?e(t):e}function $o(e){return e.split("-")[0]}function ud(e){return e.split("-")[1]}function Ww(e){return e==="x"?"y":"x"}function Gw(e){return e==="y"?"height":"width"}function Ys(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function qw(e){return Ww(Ys(e))}function WG(e,t,n){n===void 0&&(n=!1);const r=ud(e),i=qw(e),s=Gw(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=iv(o)),[o,iv(o)]}function GG(e){const t=iv(e);return[vS(e),t,vS(t)]}function vS(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const DA=["left","right"],IA=["right","left"],qG=["top","bottom"],KG=["bottom","top"];function YG(e,t,n){switch(e){case"top":case"bottom":return n?t?IA:DA:t?DA:IA;case"left":case"right":return t?qG:KG;default:return[]}}function XG(e,t,n,r){const i=ud(e);let s=YG($o(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(vS)))),s}function iv(e){const t=$o(e);return VG[t]+e.slice(t.length)}function QG(e){return{top:0,right:0,bottom:0,left:0,...e}}function NO(e){return typeof e!="number"?QG(e):{top:e,right:e,bottom:e,left:e}}function sv(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 PA(e,t,n){let{reference:r,floating:i}=e;const s=Ys(t),o=qw(t),l=Gw(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(ud(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 ZG(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=NO(b),w=l[g?h==="floating"?"reference":"floating":h],C=sv(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},N=sv(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:E,strategy:u}):R);return{top:(C.top-N.top+y.top)/T.y,bottom:(N.bottom-C.bottom+y.bottom)/T.y,left:(C.left-N.left+y.left)/T.x,right:(N.right-C.right+y.right)/T.x}}const JG=50,eq=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:ZG},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}=PA(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:N,reset:A}=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],...N},A&&b<JG&&(b++,typeof A=="object"&&(A.placement&&(g=A.placement),A.rects&&(d=A.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:f,y:h}=PA(d,g,u)),x=-1)}return{x:f,y:h,placement:g,strategy:i,middlewareData:y}},tq=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=NO(f),g={x:n,y:r},b=qw(i),y=Gw(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],N=g[b]-s.reference[b],A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let L=A?A[E]:0;(!L||!await(o.isElement==null?void 0:o.isElement(A)))&&(L=l.floating[E]||s.floating[y]);const O=T/2-N/2,G=L/2-x[y]/2-1,P=Ya(h[C],G),j=Ya(h[R],G),B=P,H=L-x[y]-j,$=L/2-x[y]/2+O,V=gS(B,$,H),z=!u.arrow&&ud(i)!=null&&$!==V&&s.reference[y]/2-($<B?P:j)-x[y]/2<0,q=z?$<B?$-B:$-H:0;return{[b]:g[b]+q,data:{[b]:V,centerOffset:$-V-q,...z&&{alignmentOffset:q}},reset:z}}}),nq=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=Ys(l),E=$o(l)===l,T=await(u.isRTL==null?void 0:u.isRTL(d.floating)),N=g||(E||!x?[iv(l)]:GG(l)),A=y!=="none";!g&&A&&N.push(...XG(l,x,y,T));const L=[l,...N],O=await u.detectOverflow(t,w),G=[];let P=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(O[C]),h){const $=WG(i,o,T);G.push(O[$[0]],O[$[1]])}if(P=[...P,{placement:i,overflows:G}],!G.every($=>$<=0)){var j,B;const $=(((j=s.flip)==null?void 0:j.index)||0)+1,V=L[$];if(V&&(!(h==="alignment"?R!==Ys(V):!1)||P.every(F=>Ys(F.placement)===R?F.overflows[0]>0:!0)))return{data:{index:$,overflows:P},reset:{placement:V}};let z=(B=P.filter(q=>q.overflows[0]<=0).sort((q,F)=>q.overflows[1]-F.overflows[1])[0])==null?void 0:B.placement;if(!z)switch(b){case"bestFit":{var H;const q=(H=P.filter(F=>{if(A){const Y=Ys(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:H[0];q&&(z=q);break}case"initialPlacement":z=l;break}if(i!==z)return{reset:{placement:z}}}return{}}}};function OA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function jA(e){return UG.some(t=>e[t]>=0)}const rq=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=OA(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:jA(l)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),l=OA(o,n.floating);return{data:{escapedOffsets:l,escaped:jA(l)}}}default:return{}}}}},MO=new Set(["left","top"]);async function iq(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=ud(n),u=Ys(n)==="y",d=MO.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 sq=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 iq(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}}}}},oq=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=Ys($o(i)),b=Ww(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=gS(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=gS(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}}}}}},aq=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=Ys(i),g=Ww(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,N=s.reference[g]+s.reference[E]-w.mainAxis;b<T?b=T:b>N&&(b=N)}if(d){var C,R;const E=g==="y"?"width":"height",T=MO.has($o(i)),N=s.reference[h]-s.floating[E]+(T&&((C=o.offset)==null?void 0:C[h])||0)+(T?0:w.crossAxis),A=s.reference[h]+s.reference[E]+(T?0:((R=o.offset)==null?void 0:R[h])||0)-(T?w.crossAxis:0);y<N?y=N:y>A&&(y=A)}return{[g]:b,[h]:y}}}},lq=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=ud(i),b=Ys(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=Ya(x-f[w],R),N=Ya(y-f[C],E),A=!t.middlewareData.shift;let L=T,O=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=R),A&&!g){const P=Ci(f.left,0),j=Ci(f.right,0),B=Ci(f.top,0),H=Ci(f.bottom,0);b?O=y-2*(P!==0||j!==0?P+j:Ci(f.left,f.right)):L=x-2*(B!==0||H!==0?B+H:Ci(f.top,f.bottom))}await u({...t,availableWidth:O,availableHeight:L});const G=await o.getDimensions(l.floating);return y!==G.width||x!==G.height?{reset:{rects:!0}}:{}}}};function u0(){return typeof window<"u"}function dd(e){return LO(e)?(e.nodeName||"").toLowerCase():"#document"}function Ei(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function io(e){var t;return(t=(LO(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function LO(e){return u0()?e instanceof Node||e instanceof Ei(e).Node:!1}function Rs(e){return u0()?e instanceof Element||e instanceof Ei(e).Element:!1}function Ko(e){return u0()?e instanceof HTMLElement||e instanceof Ei(e).HTMLElement:!1}function zA(e){return!u0()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ei(e).ShadowRoot}function Vf(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ts(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function cq(e){return/^(table|td|th)$/.test(dd(e))}function d0(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const uq=/transform|translate|scale|rotate|perspective|filter/,dq=/paint|layout|strict|content/,El=e=>!!e&&e!=="none";let Ny;function Kw(e){const t=Rs(e)?Ts(e):e;return El(t.transform)||El(t.translate)||El(t.scale)||El(t.rotate)||El(t.perspective)||!Yw()&&(El(t.backdropFilter)||El(t.filter))||uq.test(t.willChange||"")||dq.test(t.contain||"")}function hq(e){let t=Xa(e);for(;Ko(t)&&!Hu(t);){if(Kw(t))return t;if(d0(t))return null;t=Xa(t)}return null}function Yw(){return Ny==null&&(Ny=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ny}function Hu(e){return/^(html|body|#document)$/.test(dd(e))}function Ts(e){return Ei(e).getComputedStyle(e)}function h0(e){return Rs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xa(e){if(dd(e)==="html")return e;const t=e.assignedSlot||e.parentNode||zA(e)&&e.host||io(e);return zA(t)?t.host:t}function DO(e){const t=Xa(e);return Hu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ko(t)&&Vf(t)?t:DO(t)}function uf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=DO(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Ei(i);if(s){const l=bS(o);return t.concat(o,o.visualViewport||[],Vf(i)?i:[],l&&n?uf(l):[])}else return t.concat(i,uf(i,[],n))}function bS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function IO(e){const t=Ts(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=rv(n)!==s||rv(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function Xw(e){return Rs(e)?e:e.contextElement}function Nu(e){const t=Xw(e);if(!Ko(t))return eo(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=IO(t);let o=(s?rv(n.width):n.width)/r,l=(s?rv(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const fq=eo(0);function PO(e){const t=Ei(e);return!Yw()||!t.visualViewport?fq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pq(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ei(e)?!1:t}function Ql(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=Xw(e);let o=eo(1);t&&(r?Rs(r)&&(o=Nu(r)):o=Nu(e));const l=pq(s,n,r)?PO(s):eo(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=Ei(s),b=r&&Rs(r)?Ei(r):r;let y=g,x=bS(y);for(;x&&r&&b!==y;){const w=Nu(x),C=x.getBoundingClientRect(),R=Ts(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=Ei(x),x=bS(y)}}return sv({width:f,height:h,x:u,y:d})}function f0(e,t){const n=h0(e).scrollLeft;return t?t.left+n:Ql(io(e)).left+n}function OO(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-f0(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function mq(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=io(r),l=t?d0(t.floating):!1;if(r===o||l&&s)return n;let u={scrollLeft:0,scrollTop:0},d=eo(1);const f=eo(0),h=Ko(r);if((h||!h&&!s)&&((dd(r)!=="body"||Vf(o))&&(u=h0(r)),h)){const b=Ql(r);d=Nu(r),f.x=b.x+r.clientLeft,f.y=b.y+r.clientTop}const g=o&&!h&&!s?OO(o,u):eo(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 gq(e){return Array.from(e.getClientRects())}function vq(e){const t=io(e),n=h0(e),r=e.ownerDocument.body,i=Ci(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ci(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+f0(e);const l=-n.scrollTop;return Ts(r).direction==="rtl"&&(o+=Ci(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const BA=25;function bq(e,t){const n=Ei(e),r=io(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=Yw();(!f||f&&t==="fixed")&&(l=i.offsetLeft,u=i.offsetTop)}const d=f0(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<=BA&&(s-=y)}else d<=BA&&(s+=d);return{width:s,height:o,x:l,y:u}}function _q(e,t){const n=Ql(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Ko(e)?Nu(e):eo(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 FA(e,t,n){let r;if(t==="viewport")r=bq(e,n);else if(t==="document")r=vq(io(e));else if(Rs(t))r=_q(t,n);else{const i=PO(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return sv(r)}function jO(e,t){const n=Xa(e);return n===t||!Rs(n)||Hu(n)?!1:Ts(n).position==="fixed"||jO(n,t)}function yq(e,t){const n=t.get(e);if(n)return n;let r=uf(e,[],!1).filter(l=>Rs(l)&&dd(l)!=="body"),i=null;const s=Ts(e).position==="fixed";let o=s?Xa(e):e;for(;Rs(o)&&!Hu(o);){const l=Ts(o),u=Kw(o);!u&&l.position==="fixed"&&(i=null),(s?!u&&!i:!u&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Vf(o)&&!u&&jO(e,o))?r=r.filter(f=>f!==o):i=l,o=Xa(o)}return t.set(e,r),r}function xq(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?d0(t)?[]:yq(t,this._c):[].concat(n),r],l=FA(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=FA(t,o[g],i);u=Ci(b.top,u),d=Ya(b.right,d),f=Ya(b.bottom,f),h=Ci(b.left,h)}return{width:d-h,height:f-u,x:h,y:u}}function Sq(e){const{width:t,height:n}=IO(e);return{width:t,height:n}}function wq(e,t,n){const r=Ko(t),i=io(t),s=n==="fixed",o=Ql(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=eo(0);function d(){u.x=f0(i)}if(r||!r&&!s)if((dd(t)!=="body"||Vf(i))&&(l=h0(t)),r){const b=Ql(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?OO(i,l):eo(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 My(e){return Ts(e).position==="static"}function HA(e,t){if(!Ko(e)||Ts(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return io(e)===n&&(n=n.ownerDocument.body),n}function zO(e,t){const n=Ei(e);if(d0(e))return n;if(!Ko(e)){let i=Xa(e);for(;i&&!Hu(i);){if(Rs(i)&&!My(i))return i;i=Xa(i)}return n}let r=HA(e,t);for(;r&&cq(r)&&My(r);)r=HA(r,t);return r&&Hu(r)&&My(r)&&!Kw(r)?n:r||hq(e)||n}const Cq=async function(e){const t=this.getOffsetParent||zO,n=this.getDimensions,r=await n(e.floating);return{reference:wq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function kq(e){return Ts(e).direction==="rtl"}const Eq={convertOffsetParentRelativeRectToViewportRelativeRect:mq,getDocumentElement:io,getClippingRect:xq,getOffsetParent:zO,getElementRects:Cq,getClientRects:gq,getDimensions:Sq,getScale:Nu,isElement:Rs,isRTL:kq};function BO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Rq(e,t){let n=null,r;const i=io(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=Lm(h),x=Lm(i.clientWidth-(f+g)),w=Lm(i.clientHeight-(h+b)),C=Lm(f),E={rootMargin:-y+"px "+-x+"px "+-w+"px "+-C+"px",threshold:Ci(0,Ya(1,u))||1};let T=!0;function N(A){const L=A[0].intersectionRatio;if(L!==u){if(!T)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!BO(d,e.getBoundingClientRect())&&o(),T=!1}try{n=new IntersectionObserver(N,{...E,root:i.ownerDocument})}catch{n=new IntersectionObserver(N,E)}n.observe(e)}return o(!0),s}function Tq(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=Xw(e),f=i||s?[...d?uf(d):[],...t?uf(t):[]]:[];f.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=d&&l?Rq(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?Ql(e):null;u&&w();function w(){const C=Ql(e);x&&!BO(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 Aq=sq,Nq=oq,Mq=nq,Lq=lq,Dq=rq,$A=tq,Iq=aq,Pq=(e,t,n)=>{const r=new Map,i={platform:Eq,...n},s={...i.platform,_c:r};return eq(e,t,{...i,platform:s})};var Oq=typeof document<"u",jq=function(){},Rg=Oq?_.useLayoutEffect:jq;function ov(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(!ov(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)&&!ov(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function FO(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function UA(e,t){const n=FO(e);return Math.round(t*n)/n}function Ly(e){const t=_.useRef(e);return Rg(()=>{t.current=e}),t}function zq(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);ov(g,r)||b(r);const[y,x]=_.useState(null),[w,C]=_.useState(null),R=_.useCallback(F=>{F!==A.current&&(A.current=F,x(F))},[]),E=_.useCallback(F=>{F!==L.current&&(L.current=F,C(F))},[]),T=s||y,N=o||w,A=_.useRef(null),L=_.useRef(null),O=_.useRef(f),G=u!=null,P=Ly(u),j=Ly(i),B=Ly(d),H=_.useCallback(()=>{if(!A.current||!L.current)return;const F={placement:t,strategy:n,middleware:g};j.current&&(F.platform=j.current),Pq(A.current,L.current,F).then(Y=>{const I={...Y,isPositioned:B.current!==!1};$.current&&!ov(O.current,I)&&(O.current=I,is.flushSync(()=>{h(I)}))})},[g,t,n,j,B]);Rg(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,h(F=>({...F,isPositioned:!1})))},[d]);const $=_.useRef(!1);Rg(()=>($.current=!0,()=>{$.current=!1}),[]),Rg(()=>{if(T&&(A.current=T),N&&(L.current=N),T&&N){if(P.current)return P.current(T,N,H);H()}},[T,N,H,P,G]);const V=_.useMemo(()=>({reference:A,floating:L,setReference:R,setFloating:E}),[R,E]),z=_.useMemo(()=>({reference:T,floating:N}),[T,N]),q=_.useMemo(()=>{const F={position:n,left:0,top:0};if(!z.floating)return F;const Y=UA(z.floating,f.x),I=UA(z.floating,f.y);return l?{...F,transform:"translate("+Y+"px, "+I+"px)",...FO(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:I}},[n,l,z.floating,f.x,f.y]);return _.useMemo(()=>({...f,update:H,refs:V,elements:z,floatingStyles:q}),[f,H,V,z,q])}const Bq=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?$A({element:r.current,padding:i}).fn(n):{}:r?$A({element:r,padding:i}).fn(n):{}}}},Fq=(e,t)=>{const n=Aq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hq=(e,t)=>{const n=Nq(e);return{name:n.name,fn:n.fn,options:[e,t]}},$q=(e,t)=>({fn:Iq(e).fn,options:[e,t]}),Uq=(e,t)=>{const n=Mq(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vq=(e,t)=>{const n=Lq(e);return{name:n.name,fn:n.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=Bq(e);return{name:n.name,fn:n.fn,options:[e,t]}};var qq="Arrow",HO=_.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return m.jsx(Ut.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"})})});HO.displayName=qq;var Kq=HO;function Yq(e){const[t,n]=_.useState(void 0);return Or(()=>{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 Qw="Popper",[$O,rl]=qo(Qw),[Xq,UO]=$O(Qw),VO=e=>{const{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return m.jsx(Xq,{scope:t,anchor:r,onAnchorChange:i,children:n})};VO.displayName=Qw;var WO="PopperAnchor",GO=_.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=UO(WO,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(Ut.div,{...i,ref:l})});GO.displayName=WO;var Zw="PopperContent",[Qq,Zq]=$O(Zw),qO=_.forwardRef((e,t)=>{var se,pe,re,me,Ee,we;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=UO(Zw,n),[C,R]=_.useState(null),E=an(t,Ae=>R(Ae)),[T,N]=_.useState(null),A=Yq(T),L=(A==null?void 0:A.width)??0,O=(A==null?void 0:A.height)??0,G=r+(s!=="center"?"-"+s:""),P=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},j=Array.isArray(d)?d:[d],B=j.length>0,H={padding:P,boundary:j.filter(eK),altBoundary:B},{refs:$,floatingStyles:V,placement:z,isPositioned:q,middlewareData:F}=zq({strategy:"fixed",placement:G,whileElementsMounted:(...Ae)=>Tq(...Ae,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[Fq({mainAxis:i+O,alignmentAxis:o}),u&&Hq({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?$q():void 0,...H}),u&&Uq({...H}),Vq({...H,apply:({elements:Ae,rects:ze,availableWidth:Ue,availableHeight:tt})=>{const{width:kt,height:Qt}=ze.reference,Pe=Ae.floating.style;Pe.setProperty("--radix-popper-available-width",`${Ue}px`),Pe.setProperty("--radix-popper-available-height",`${tt}px`),Pe.setProperty("--radix-popper-anchor-width",`${kt}px`),Pe.setProperty("--radix-popper-anchor-height",`${Qt}px`)}}),T&&Gq({element:T,padding:l}),tK({arrowWidth:L,arrowHeight:O}),g&&Wq({strategy:"referenceHidden",...H})]}),[Y,I]=XO(z),U=Es(y);Or(()=>{q&&(U==null||U())},[q,U]);const X=(se=F.arrow)==null?void 0:se.x,D=(pe=F.arrow)==null?void 0:pe.y,te=((re=F.arrow)==null?void 0:re.centerOffset)!==0,[Q,ie]=_.useState();return Or(()=>{C&&ie(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":[(me=F.transformOrigin)==null?void 0:me.x,(Ee=F.transformOrigin)==null?void 0:Ee.y].join(" "),...((we=F.hide)==null?void 0:we.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:m.jsx(Qq,{scope:n,placedSide:Y,onArrowChange:N,arrowX:X,arrowY:D,shouldHideArrow:te,children:m.jsx(Ut.div,{"data-side":Y,"data-align":I,...x,ref:E,style:{...x.style,animation:q?void 0:"none"}})})})});qO.displayName=Zw;var KO="PopperArrow",Jq={top:"bottom",right:"left",bottom:"top",left:"right"},YO=_.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=Zq(KO,r),o=Jq[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(Kq,{...i,ref:n,style:{...i.style,display:"block"}})})});YO.displayName=KO;function eK(e){return e!==null}var tK=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]=XO(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 XO(e){const[t,n="center"]=e.split("-");return[t,n]}var p0=VO,Wf=GO,m0=qO,g0=YO,QO=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"}),nK="VisuallyHidden",ZO=_.forwardRef((e,t)=>m.jsx(Ut.span,{...e,ref:t,style:{...QO,...e.style}}));ZO.displayName=nK;var rK=ZO,[v0]=qo("Tooltip",[rl]),b0=rl(),JO="TooltipProvider",iK=700,_S="tooltip.open",[sK,Jw]=v0(JO),e5=e=>{const{__scopeTooltip:t,delayDuration:n=iK,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(sK,{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})};e5.displayName=JO;var df="Tooltip",[oK,Gf]=v0(df),t5=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:l}=e,u=Jw(df,e.__scopeTooltip),d=b0(t),[f,h]=_.useState(null),g=zo(),b=_.useRef(0),y=o??u.disableHoverableContent,x=l??u.delayDuration,w=_.useRef(!1),[C,R]=Fu({prop:r,defaultProp:i??!1,onChange:L=>{L?(u.onOpen(),document.dispatchEvent(new CustomEvent(_S))):u.onClose(),s==null||s(L)},caller:df}),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]),N=_.useCallback(()=>{window.clearTimeout(b.current),b.current=0,R(!1)},[R]),A=_.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(p0,{...d,children:m.jsx(oK,{scope:t,contentId:g,open:C,stateAttribute:E,trigger:f,onTriggerChange:h,onTriggerEnter:_.useCallback(()=>{u.isOpenDelayedRef.current?A():T()},[u.isOpenDelayedRef,A,T]),onTriggerLeave:_.useCallback(()=>{y?N():(window.clearTimeout(b.current),b.current=0)},[N,y]),onOpen:T,onClose:N,disableHoverableContent:y,children:n})})};t5.displayName=df;var yS="TooltipTrigger",n5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=Gf(yS,n),s=Jw(yS,n),o=b0(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(Wf,{asChild:!0,...o,children:m.jsx(Ut.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:u,onPointerMove:He(e.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:He(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:He(e.onPointerDown,()=>{i.open&&i.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:He(e.onFocus,()=>{d.current||i.onOpen()}),onBlur:He(e.onBlur,i.onClose),onClick:He(e.onClick,i.onClose)})})});n5.displayName=yS;var eC="TooltipPortal",[aK,lK]=v0(eC,{forceMount:void 0}),r5=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=Gf(eC,t);return m.jsx(aK,{scope:t,forceMount:n,children:m.jsx(hs,{present:n||s.open,children:m.jsx(sd,{asChild:!0,container:i,children:r})})})};r5.displayName=eC;var $u="TooltipContent",i5=_.forwardRef((e,t)=>{const n=lK($u,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=Gf($u,e.__scopeTooltip);return m.jsx(hs,{present:r||o.open,children:o.disableHoverableContent?m.jsx(s5,{side:i,...s,ref:t}):m.jsx(cK,{side:i,...s,ref:t})})}),cK=_.forwardRef((e,t)=>{const n=Gf($u,e.__scopeTooltip),r=Jw($u,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=pK(C,w.getBoundingClientRect()),E=mK(C,R),T=gK(x.getBoundingClientRect()),N=bK([...E,...T]);l(N),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=!vK(C,o);R?g():E&&(g(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[u,f,o,d,g]),m.jsx(s5,{...e,ref:s})}),[uK,dK]=v0(df,{isInside:!1}),hK=uW("TooltipContent"),s5=_.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,u=Gf($u,n),d=b0(n),{onClose:f}=u;return _.useEffect(()=>(document.addEventListener(_S,f),()=>document.removeEventListener(_S,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(id,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:m.jsxs(m0,{"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(hK,{children:r}),m.jsx(uK,{scope:n,isInside:!0,children:m.jsx(rK,{id:u.contentId,role:"tooltip",children:i||r})})]})})});i5.displayName=$u;var o5="TooltipArrow",fK=_.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=b0(n);return dK(o5,n).isInside?null:m.jsx(g0,{...i,...r,ref:t})});fK.displayName=o5;function pK(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 mK(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 gK(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 vK(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 bK(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),_K(t)}function _K(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 yK=e5,a5=t5,l5=n5,c5=r5,tC=i5;function u5({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 xK({className:e,...t}){return m.jsx("span",{className:xe("inline-flex items-center gap-0.5",e),...t})}const SK="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",wK=yK,Qa=a5,Za=l5,Uo=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>m.jsx(c5,{children:m.jsx(tC,{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=tC.displayName;const Ph=a5,Oh=l5;function d5(e){return e.toUpperCase()}function CK(e){const t=e.split("+");return m.jsx(xK,{children:t.map((n,r)=>m.jsx(u5,{children:d5(n)},`${n}-${r}`))})}const Su=_.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(c5,{children:m.jsx(tC,{ref:s,sideOffset:t,className:xe(SK,e),...i,children:o?CK(o):m.jsx("span",{children:typeof n=="string"?d5(n):n})})})});Su.displayName="HotkeyTooltipContent";const kK="0.33.1",EK={version:kK},Un="Kanna",VA="kanna",RK=".kanna",TK=".kanna-dev",AK="KANNA_RUNTIME_PROFILE",nC=`kanna/${EK.version}`,NK="[kanna]",MK=`~/${Un}`;function _0(){var t;return(t=globalThis.process)==null?void 0:t.env}function LK(e=_0()){var t;return((t=e==null?void 0:e[AK])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function DK(e=_0()){return LK(e)==="dev"?TK:RK}function IK(e=_0()){return`~/${DK(e)}`}function PK(e=_0()){return`${IK(e)}/keybindings.json`}function Dm(e){return e?`${VA} ${e}`:VA}const WA=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},OK=(e=>e?WA(e):WA),jK=e=>e;function zK(e,t=jK){const n=gn.useSyncExternalStore(e.subscribe,gn.useCallback(()=>t(e.getState()),[e,t]),gn.useCallback(()=>t(e.getInitialState()),[e,t]));return gn.useDebugValue(n),n}const BK=e=>{const t=OK(e),n=r=>zK(t,r);return Object.assign(n,t),n},dc=(e=>BK);function FK(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 xS=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return xS(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return xS(r)(n)}}}},HK=(e,t)=>(n,r,i)=>{let s={storage:FK(()=>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 N;return T((N=r())!=null?N:b)});const E=((C=s.onRehydrateStorage)==null?void 0:C.call(s,(w=r())!=null?w:b))||void 0;return xS(f.getItem.bind(f))(s.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==s.version){if(s.migrate){const N=s.migrate(T.state,T.version);return N instanceof Promise?N.then(A=>[!0,A]):[!0,N]}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 N;if(R!==l)return;const[A,L]=T;if(y=s.merge(L,(N=r())!=null?N:b),n(y,!0),A)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},hc=HK,h5="always",f5="funk",$K=[{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 GA(e){switch(e){case"never":case"unfocused":case"always":return e;default:return h5}}function qA(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 f5}}const wu=dc()(hc(e=>({chatSoundPreference:h5,chatSoundId:f5,setChatSoundPreference:t=>e({chatSoundPreference:GA(t)}),setChatSoundId:t=>e({chatSoundId:qA(t)})}),{name:"chat-sound-preferences",version:2,migrate:e=>{const t=e;return{chatSoundPreference:GA(t==null?void 0:t.chatSoundPreference),chatSoundId:qA(t==null?void 0:t.chatSoundId)}}})),UK={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 VK(e=document){return e.visibilityState!=="visible"||!e.hasFocus()}function WK(e){const t=new Audio(UK[e]);return t.preload="auto",t.play()}async function SS(e,t){if(t<=0)return;const n=Array.from({length:t},(r,i)=>new Promise(s=>{window.setTimeout(()=>{WK(e).catch(()=>{}).finally(()=>s())},i*90)}));await Promise.all(n)}function GK(e,t=document){return e==="never"?!1:e==="always"?!0:VK(t)}function qK(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 KA(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 KK(e,t){if(!e)return 0;const n=KA(e),r=KA(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 hd=({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 wS(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const YK=[/^(?:\/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 XK(e){const t=e.trim();for(const n of YK){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function p5(e){return e.split("/").pop()||e}const QK=1440*6e4;function ZK(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=QK,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 JK(e){return e.lastMessageAt??e._creationTime}const eY=new Set(["starting","running"]);function tY({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onForkChat:o,onDeleteChat:l}){const u=ZK(JK(e),n),d=i&&r?r:u,f=i&&!!r,h=tW(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:[eY.has(e.status)?m.jsx(kn,{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(hd,{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(u5,{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(qU,{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(p$,{className:"size-3.5"})})]})]})]},e._id)}const nY=_.memo(tY);function rY(){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 y0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function fd(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function rC(e){return"nodeType"in e}function ci(e){var t,n;return e?fd(e)?e:rC(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function iC(e){const{Document:t}=ci(e);return e instanceof t}function qf(e){return fd(e)?!1:e instanceof ci(e).HTMLElement}function m5(e){return e instanceof ci(e).SVGElement}function pd(e){return e?fd(e)?e.document:rC(e)?iC(e)?e:qf(e)||m5(e)?e.ownerDocument:document:document:document}const no=y0?_.useLayoutEffect:_.useEffect;function sC(e){const t=_.useRef(e);return no(()=>{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 iY(){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 hf(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return no(()=>{n.current!==e&&(n.current=e)},t),n}function Kf(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function av(e){const t=sC(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function CS(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let Dy={};function Yf(e,t){return _.useMemo(()=>{if(t)return t;const n=Dy[e]==null?0:Dy[e]+1;return Dy[e]=n,e+"-"+n},[e,t])}function g5(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 Mu=g5(1),lv=g5(-1);function sY(e){return"clientX"in e&&"clientY"in e}function oC(e){if(!e)return!1;const{KeyboardEvent:t}=ci(e.target);return t&&e instanceof t}function oY(e){if(!e)return!1;const{TouchEvent:t}=ci(e.target);return t&&e instanceof t}function kS(e){if(oY(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 sY(e)?{x:e.clientX,y:e.clientY}:null}const ff=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[ff.Translate.toString(e),ff.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),YA="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function aY(e){return e.matches(YA)?e:e.querySelector(YA)}const lY={display:"none"};function cY(e){let{id:t,value:n}=e;return gn.createElement("div",{id:t,style:lY},n)}function uY(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 gn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function dY(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const v5=_.createContext(null);function hY(e){const t=_.useContext(v5);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function fY(){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 pY={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.
|
|
@@ -2605,4 +2605,4 @@ ${se.detail}`:""}`,closeLabel:"OK"})}catch(se){await r.alert({title:"Checkout fa
|
|
|
2605
2605
|
|
|
2606
2606
|
${Q.detail}`:""}`,closeLabel:"OK"}),Q}catch(Q){return await r.alert({title:"Merge failed",description:Q instanceof Error?Q.message:String(Q),closeLabel:"OK"}),null}},[r,y,e.socket]),Y=_.useCallback(async()=>{const D=h.current;if(!D)return;const te=await r.prompt({title:"New Branch",description:"Enter a branch name.",placeholder:"feature/my-branch",confirmLabel:"Create"});if(!te)return;const Q=await V(),ie=Q.currentBranchName,se=Q.defaultBranchName;let pe=se;se&&ie&&se!==ie&&(pe=await r.confirm({title:"Branch Base",description:`Create "${te}" from ${ie} instead of ${se}?`,confirmLabel:`From ${ie}`,cancelLabel:`From ${se}`})?ie:se);try{const re=await e.socket.command({type:"chat.createBranch",chatId:D,name:te,baseBranchName:pe});re.snapshotChanged&&y(),re.ok||await r.alert({title:re.title,description:`${re.message}${re.detail?`
|
|
2607
2607
|
|
|
2608
|
-
${re.detail}`:""}`,closeLabel:"OK"})}catch(re){await r.alert({title:"Create branch failed",description:re instanceof Error?re.message:String(re),closeLabel:"OK"})}},[r,V,y,e.socket]);return _.useEffect(()=>{if(!t||!n)return;const D=window.setInterval(()=>{y()},Ebe);return()=>window.clearInterval(D)},[t,y,n]),_.useEffect(()=>{!t||!n||y()},[t,y,n]),_.useEffect(()=>{!t||!e.activeChatId||f.current!==t&&(f.current=t,b())},[t,b,e.activeChatId]),_.useEffect(()=>{if(!t||!n)return;function D(){document.visibilityState==="visible"&&y()}return window.addEventListener("focus",D),document.addEventListener("visibilitychange",D),()=>{window.removeEventListener("focus",D),document.removeEventListener("visibilitychange",D)}},[t,y,n]),_.useEffect(()=>{n&&d.current&&!e.isProcessing&&y(),d.current=e.isProcessing},[y,n,e.isProcessing]),_.useEffect(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]),_.useEffect(()=>{n||u.current!==null&&(window.clearTimeout(u.current),u.current=null)},[t,n]),{diffRenderMode:i,wrapDiffLines:o,setDiffRenderMode:s,setWrapDiffLines:l,scheduleTerminalDiffRefresh:x,handleOpenDiffFile:w,handleCopyDiffFilePath:C,handleCopyDiffRelativePath:R,handleLoadDiffPatch:E,handleDiscardDiffFile:T,handleIgnoreDiffFile:N,handleIgnoreDiffFolder:A,handleOpenDiffInFinder:L,handleCommitDiffs:O,handleSyncBranch:G,handleGenerateCommitMessage:P,handleInitializeGit:j,handleGetGitHubPublishInfo:B,handleCheckGitHubRepoAvailability:H,handleSetupGitHub:$,handleListBranches:V,handleCheckoutBranch:z,handlePreviewMergeBranch:q,handleMergeBranch:F,handleCreateBranch:Y}}function vSe(e,t){const[n,r]=_.useState(""),[i,s]=_.useState(!1);return _.useEffect(()=>{if(!e)return;r(""),s(!1);let o=0;const l=window.setInterval(()=>{o+=1,r($v.slice(0,o)),o>=$v.length&&(window.clearInterval(l),s(!0))},Cbe);return()=>window.clearInterval(l)},[e,t]),{typedEmptyStateText:n,isEmptyStateTypingComplete:i}}function bSe(e){const[t,n]=_.useState(!1),r=_.useRef(0),i=_.useCallback(d=>{var f;return Abe(((f=d.dataTransfer)==null?void 0:f.types)??[])},[]),s=_.useCallback(d=>{!i(d)||!e.hasSelectedProject||(d.preventDefault(),r.current+=1,n(!0))},[e.hasSelectedProject,i]),o=_.useCallback(d=>{!i(d)||!e.hasSelectedProject||(d.preventDefault(),d.dataTransfer.dropEffect="copy",t||n(!0))},[e.hasSelectedProject,i,t]),l=_.useCallback(d=>{!i(d)||!e.hasSelectedProject||(d.preventDefault(),r.current=Math.max(0,r.current-1),r.current===0&&n(!1))},[e.hasSelectedProject,i]),u=_.useCallback(d=>{!i(d)||!e.hasSelectedProject||(d.preventDefault(),r.current=0,n(!1),e.onFilesDropped([...d.dataTransfer.files]))},[e,i]);return{isPageFileDragActive:t,handleTranscriptDragEnter:s,handleTranscriptDragOver:o,handleTranscriptDragLeave:l,handleTranscriptDrop:u}}function _Se(e){const[t,n]=_.useState(0);return _.useLayoutEffect(()=>{const r=e.current;if(!r)return;const i=()=>{const o=r.clientWidth;n(l=>Math.abs(l-o)<1?l:o)},s=new ResizeObserver(i);return s.observe(r),i(),()=>s.disconnect()},[e]),t}function ySe(){const e=_.useRef(null),[t,n]=_.useState(148),r=_.useCallback(()=>{const i=e.current;if(!i)return;const s=i.getBoundingClientRect().height;n(o=>Lme(o,s))},[]);return _.useLayoutEffect(()=>{const i=e.current;if(!i)return;const s=new ResizeObserver(()=>{r()});return s.observe(i),r(),()=>s.disconnect()},[r]),{inputRef:e,syncInputHeight:r,transcriptPaddingBottom:Mme(t)}}const xSe=768;function SSe(e){return e>0&&e<xSe}function wSe(){const[e,t]=_.useState(()=>typeof window>"u"?0:window.innerWidth);return _.useEffect(()=>{if(typeof window>"u")return;const n=()=>t(window.innerWidth);return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),SSe(e)}function CSe(e){const[t,n]=_.useState(0);return _.useEffect(()=>{const r=e.layoutRootRef.current;if(!r)return;const i=()=>{const o=r.getBoundingClientRect().height;if(!e.shouldRenderTerminalLayout||o<=0)return;const l=o*(e.terminalMainSizes[1]/100);l<=0||n(u=>Math.abs(u-l)<1?u:l)},s=new ResizeObserver(i);return s.observe(r),i(),()=>s.disconnect()},[e.layoutRootRef,e.shouldRenderTerminalLayout,e.terminalMainSizes]),t}const zI=_.memo(function(t){return m.jsx(Mfe,{...t,diffs:t.diffs??c6})}),kSe=_.memo(function({showRightSidebar:t,sizePercent:n,sidebarPanelRef:r,sidebarVisualRef:i,content:s}){return m.jsx(Tf,{id:"rightSidebar",defaultSize:`${n}%`,className:"min-h-0 min-w-0",elementRef:r,children:m.jsx("div",{ref:i,className:"h-full min-h-0 overflow-hidden","data-right-sidebar-open":t?"true":"false","data-right-sidebar-animated":"false","data-right-sidebar-visual":!0,style:{"--terminal-toggle-duration":`${op}ms`},children:s})})}),ESe=_.memo(function({projectId:t,showRightSidebar:n,sidebarVisualRef:r,onClose:i,content:s}){return t?m.jsxs("div",{className:xe("absolute inset-0 z-40 transition-opacity duration-300 ease-out",n?"pointer-events-auto opacity-100":"pointer-events-none opacity-0"),"aria-hidden":n?void 0:!0,"data-mobile-right-sidebar-overlay":!0,children:[m.jsx("button",{type:"button",className:"absolute inset-0 bg-black/45 backdrop-blur-[1px]","aria-label":"Close changes sidebar",onClick:i}),m.jsx("div",{ref:r,className:xe("absolute inset-y-0 right-0 flex w-[min(92vw,30rem)] max-w-full min-h-0 flex-col overflow-hidden border-l border-border bg-background shadow-2xl transition-transform duration-300 ease-out","pt-[max(env(safe-area-inset-top),0px)] pb-[max(env(safe-area-inset-bottom),0px)]",n?"translate-x-0":"translate-x-full"),"data-right-sidebar-open":n?"true":"false","data-right-sidebar-animated":"false","data-right-sidebar-visual":!0,children:s})]}):null});function RSe({chatCard:e,projectId:t,shouldRenderTerminalLayout:n,showTerminalPane:r,terminalLayout:i,mainPanelGroupRef:s,terminalPanelRef:o,terminalVisualRef:l,fixedTerminalHeight:u,terminalFocusRequestVersion:d,addTerminal:f,socket:h,connectionStatus:g,scrollback:b,minColumnWidth:y,splitTerminalShortcut:x,onTerminalCommandSent:w,onRemoveTerminal:C,onTerminalLayout:R,onLayoutChanged:E}){return n?m.jsxs(Rk,{groupRef:s,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:E,children:[m.jsx(Tf,{id:"chat",defaultSize:`${i.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:e}),m.jsx(Tk,{withHandle:!0,orientation:"vertical",disabled:!r,className:xe(!r&&"pointer-events-none opacity-0")}),m.jsx(Tf,{id:"terminal",defaultSize:`${i.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:o,children:m.jsx("div",{ref:l,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":r?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${op}ms`},children:m.jsx(mSe,{projectId:t,fixedTerminalHeight:u,terminalLayout:i,addTerminal:f,socket:h,connectionStatus:g,scrollback:b,minColumnWidth:y,splitTerminalShortcut:x,focusRequestVersion:d,onTerminalCommandSent:w,onRemoveTerminal:C,onTerminalLayout:R})})})]},t):m.jsx(m.Fragment,{children:e})}function TSe(){var Wt,Li,di,Di,Ar,hi,rn,Ds;const e=kw(),t=Hw(),n=_.useRef(null),r=_.useRef(null),i=_.useRef(!0),s=_.useRef(null),o=_.useRef(null),l=_.useRef(null),u=_.useRef(null),{inputRef:d,syncInputHeight:f,transcriptPaddingBottom:h}=ySe(),[g,b]=_.useState(!1),y=e.messages.length===0&&((Wt=e.runtime)==null?void 0:Wt.title)==="New Chat",x=e.activeProjectId,C=Oa(Le=>x?Le.projects[x]:void 0)??vpe,E=oi(Le=>x?Le.projects[x]:void 0)??Qse,T=oi(Le=>Le.size),N=Oa(Le=>Le.addTerminal),A=Oa(Le=>Le.removeTerminal),L=Oa(Le=>Le.toggleVisibility),O=Oa(Le=>Le.resetMainSizes),G=Oa(Le=>Le.setMainSizes),P=Oa(Le=>Le.setTerminalSizes),j=oi(Le=>Le.toggleVisibility),B=oi(Le=>Le.setSize),H=Zi(Le=>Le.scrollbackLines),$=Zi(Le=>Le.minColumnWidth),V=_.useMemo(()=>TC(e.keybindings),[e.keybindings]),z=_.useRef(null),q=_.useMemo(()=>{var Lt;const Le=dpe(((Lt=e.chatSnapshot)==null?void 0:Lt.messages)??[]),Je=z.current;return Tbe(Je,Le)?Je:(z.current=Le,Le)},[(Li=e.chatSnapshot)==null?void 0:Li.messages]),F=C.terminals.length>0,Y=!!(x&&C.isVisible&&F),I=!!(x&&F),U=!!(x&&E.isVisible),X=!!x,D=wSe(),te=X&&!D,Q=_Se(n),ie=_.useCallback((Le,Je)=>{if(!Number.isFinite(Le))return T;const Lt=Je??Q,Br=Lt>0?Kse/Lt*100:s1;return Math.max(s1,Br,Le)},[T,Q]),se=ie(T??Ou),pe=CSe({layoutRootRef:n,shouldRenderTerminalLayout:I,terminalMainSizes:C.mainSizes}),{isAnimating:re,mainPanelGroupRef:me,terminalFocusRequestVersion:Ee,terminalPanelRef:we,terminalVisualRef:Ae}=Dpe({showTerminalPane:Y,shouldRenderTerminalLayout:I,projectId:x,terminalLayout:C,chatInputRef:l}),{isAnimating:ze,panelGroupRef:Ue,sidebarPanelRef:tt,sidebarVisualRef:kt}=Ape({projectId:x,shouldRenderRightSidebarLayout:te,showRightSidebar:U,rightSidebarSize:se}),{diffRenderMode:Qt,wrapDiffLines:Pe,setDiffRenderMode:Ve,setWrapDiffLines:Ke,scheduleTerminalDiffRefresh:lt,handleOpenDiffFile:mt,handleCopyDiffFilePath:gt,handleCopyDiffRelativePath:Kt,handleLoadDiffPatch:le,handleDiscardDiffFile:ge,handleIgnoreDiffFile:je,handleIgnoreDiffFolder:We,handleOpenDiffInFinder:dt,handleCommitDiffs:bt,handleSyncBranch:$e,handleGenerateCommitMessage:rt,handleInitializeGit:xt,handleGetGitHubPublishInfo:yt,handleCheckGitHubRepoAvailability:Ze,handleSetupGitHub:Zt,handleListBranches:ue,handleCheckoutBranch:Be,handlePreviewMergeBranch:ct,handleMergeBranch:At,handleCreateBranch:ke}=gSe({state:e,projectId:x,showRightSidebar:U}),{typedEmptyStateText:ot,isEmptyStateTypingComplete:St}=vSe(y,e.activeChatId);Npe({rootRef:o,fallbackRef:l,enabled:e.hasSelectedProject,canCancel:e.canCancel});const vt=_.useCallback(Le=>{var Je;!e.hasSelectedProject||Le.length===0||(Je=u.current)==null||Je.enqueueFiles(Le)},[e.hasSelectedProject]),{isPageFileDragActive:ht,handleTranscriptDragEnter:Et,handleTranscriptDragOver:nn,handleTranscriptDragLeave:Re,handleTranscriptDrop:Ye}=bSe({hasSelectedProject:e.hasSelectedProject,onFilesDropped:vt}),Ge=_.useCallback(()=>{if(x){if(F){L(x);return}N(x)}},[N,F,x,L]),Z=_.useCallback(Le=>{var yr;if(!x||!Y||re.current)return;const Je=Le.chat,Lt=Le.terminal;if(!Number.isFinite(Je)||!Number.isFinite(Lt))return;const Br=((yr=n.current)==null?void 0:yr.getBoundingClientRect().height)??0;if(xpe(Br,Lt)){O(x),L(x);return}G(x,[Je,Lt])},[re,x,O,G,Y,L]),Ie=_.useCallback(()=>{x&&j(x)},[x,j]),_e=_.useCallback(()=>{var Le;if(x){if(U){j(x);return}if(((Le=e.chatDiffSnapshot)==null?void 0:Le.status)==="no_repo"){(async()=>{if(!await t.confirm({title:"Initialize Git?",description:"Initialize a local git repository in this project?",confirmLabel:"Init Git",cancelLabel:"Cancel"}))return;const Lt=await xt();Lt!=null&&Lt.ok&&!U&&j(x)})();return}j(x)}},[t,xt,x,U,(di=e.chatDiffSnapshot)==null?void 0:di.status,j]),qe=_.useCallback(()=>{e.handleCancel()},[e.handleCancel]),Te=_.useCallback(Le=>{e.handleOpenExternal(Le)},[e.handleOpenExternal]),Nt=_.useCallback((Le,Je)=>{e.socket.command({type:"terminal.close",terminalId:Je}).catch(()=>{}),A(Le,Je)},[A,e.socket]),wt=_.useCallback(()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null)},[]),Jt=_.useCallback(Le=>{if(i.current!==Le){if(i.current=Le,Le){wt(),b(!1);return}wt(),s.current=window.setTimeout(()=>{b(!0),s.current=null},150)}},[wt]),Vt=_.useCallback(()=>{var Je,Lt;const Le=(Lt=(Je=r.current)==null?void 0:Je.getState)==null?void 0:Lt.call(Je);Le&&Jt(Le.isAtEnd)},[Jt]),zr=_.useCallback(async(Le=!0)=>{var Je,Lt;i.current=!0,wt(),b(!1),await((Lt=(Je=r.current)==null?void 0:Je.scrollToEnd)==null?void 0:Lt.call(Je,{animated:Le}))},[wt]),Ls=_.useCallback(async(Le,Je)=>{await zr(!1),await e.handleSend(Le,Je)},[zr,e]);_.useEffect(()=>()=>wt(),[wt]),_.useEffect(()=>{i.current=!0,wt(),b(!1)},[wt,e.activeChatId]),_.useEffect(()=>{function Le(Je){if(x){if(_h(V,"toggleEmbeddedTerminal",Je)){Je.preventDefault(),Ge();return}if(_h(V,"toggleRightSidebar",Je)){Je.preventDefault(),_e();return}if(_h(V,"openInFinder",Je)){Je.preventDefault(),e.handleOpenExternal("open_finder");return}if(_h(V,"openInEditor",Je)){Je.preventDefault(),e.handleOpenExternal("open_editor");return}_h(V,"addSplitTerminal",Je)&&(Je.preventDefault(),N(x))}}return window.addEventListener("keydown",Le),()=>window.removeEventListener("keydown",Le)},[N,Ge,_e,x,V,e.handleOpenExternal]),_.useEffect(()=>{const Le=window.requestAnimationFrame(()=>{Vt()}),Je=window.setTimeout(()=>{Vt()},op);return()=>{window.cancelAnimationFrame(Le),window.clearTimeout(Je)}},[I,Y,Vt]),_.useEffect(()=>{function Le(){Vt()}return window.addEventListener("resize",Le),()=>window.removeEventListener("resize",Le)},[Vt]),_.useEffect(()=>{if(!U||!D)return;const Le=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=Le}},[D,U]),_.useEffect(()=>{if(!U||!D)return;function Le(Je){Je.key==="Escape"&&(Je.preventDefault(),Ie())}return window.addEventListener("keydown",Le),()=>window.removeEventListener("keydown",Le)},[Ie,D,U]),_.useEffect(()=>{if(!i.current)return;let Le=null;const Je=window.requestAnimationFrame(()=>{var Lt,Br;(Br=(Lt=r.current)==null?void 0:Lt.scrollToEnd)==null||Br.call(Lt,{animated:!1}),Le=window.requestAnimationFrame(()=>{var yr,oo;(oo=(yr=r.current)==null?void 0:yr.scrollToEnd)==null||oo.call(yr,{animated:!1})})});return()=>{window.cancelAnimationFrame(Je),Le!==null&&window.cancelAnimationFrame(Le)}},[e.commandError,e.isDraining,e.isProcessing,e.messages.length,e.queuedMessages.length,e.runtimeStatus]),_.useLayoutEffect(()=>{var Lt,Br;if(!U||D||Q<=0||ze.current)return;const Le=ie(T,Q),Je=(Lt=Ue.current)==null?void 0:Lt.getLayout();Je&&(Math.abs((Je.rightSidebar??0)-Le)<.1||(Br=Ue.current)==null||Br.setLayout({workspace:100-Le,rightSidebar:Le}))},[ie,T,ze,Q,Ue,U,D]);const Tr=m.jsxs($w,{ref:o,className:"bg-background h-full flex flex-col overflow-hidden border-0 rounded-none relative",onDragEnter:Et,onDragOver:nn,onDragLeave:Re,onDrop:Ye,children:[m.jsxs(Vw,{className:"flex flex-1 min-h-0 flex-col overflow-hidden p-0 relative",children:[m.jsx($Z,{sidebarCollapsed:e.sidebarCollapsed,onOpenSidebar:e.openSidebar,onExpandSidebar:e.expandSidebar,onNewChat:e.handleCompose,localPath:e.navbarLocalPath,embeddedTerminalVisible:Y,onToggleEmbeddedTerminal:x?Ge:void 0,rightSidebarVisible:U,onToggleRightSidebar:x?_e:void 0,onOpenExternal:Te,editorLabel:e.editorLabel,finderShortcut:V.bindings.openInFinder,editorShortcut:V.bindings.openInEditor,terminalShortcut:V.bindings.toggleEmbeddedTerminal,rightSidebarShortcut:V.bindings.toggleRightSidebar,branchName:(Di=e.chatDiffSnapshot)==null?void 0:Di.branchName,hasGitRepo:((Ar=e.chatDiffSnapshot)==null?void 0:Ar.status)!=="no_repo",gitStatus:(hi=e.chatDiffSnapshot)==null?void 0:hi.status}),m.jsx(Lbe,{activeChatId:e.activeChatId,listRef:r,messages:e.messages,queuedMessages:e.queuedMessages,transcriptPaddingBottom:h,localPath:(rn=e.runtime)==null?void 0:rn.localPath,latestToolIds:e.latestToolIds,isHistoryLoading:e.isHistoryLoading,hasOlderHistory:e.hasOlderHistory,isProcessing:e.isProcessing,runtimeStatus:e.runtimeStatus,isDraining:e.isDraining,commandError:e.commandError,loadOlderHistory:e.loadOlderHistory,onStopDraining:e.handleStopDraining,onSteerQueuedMessage:e.handleSteerQueuedMessage,onRemoveQueuedMessage:e.handleRemoveQueuedMessage,onOpenLocalLink:e.handleOpenLocalLink,onAskUserQuestionSubmit:e.handleAskUserQuestion,onExitPlanModeConfirm:e.handleExitPlanMode,showScrollButton:g&&e.messages.length>0,onIsAtEndChange:Jt,scrollToBottom:()=>zr(!0),typedEmptyStateText:ot,isEmptyStateTypingComplete:St,isPageFileDragActive:ht,showEmptyState:y})]}),m.jsx(nge,{inputRef:d,onLayoutChange:f,chatInputRef:u,chatInputElementRef:l,activeChatId:e.activeChatId,previousPrompt:e.previousPrompt,hasSelectedProject:e.hasSelectedProject,runtimeStatus:e.runtimeStatus,canCancel:e.canCancel,projectId:x,activeProvider:((Ds=e.runtime)==null?void 0:Ds.provider)??null,availableProviders:e.availableProviders,contextWindowSnapshot:q,onSubmit:Ls,onCancel:qe})]}),Ni=x?m.jsx(RSe,{chatCard:Tr,projectId:x,shouldRenderTerminalLayout:I,showTerminalPane:Y,terminalLayout:C,mainPanelGroupRef:me,terminalPanelRef:we,terminalVisualRef:Ae,fixedTerminalHeight:pe,terminalFocusRequestVersion:Ee,addTerminal:N,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:H,minColumnWidth:$,splitTerminalShortcut:V.bindings.addSplitTerminal,onTerminalCommandSent:lt,onRemoveTerminal:Nt,onTerminalLayout:P,onLayoutChanged:Z}):Tr,Mi=_.useMemo(()=>x?{projectId:x,diffs:e.chatDiffSnapshot??c6,editorLabel:e.editorLabel,diffRenderMode:Qt,wrapLines:Pe,onOpenFile:mt,onOpenInFinder:dt,onDiscardFile:ge,onIgnoreFile:je,onIgnoreFolder:We,onCopyFilePath:gt,onCopyRelativePath:Kt,onLoadPatch:le,onListBranches:ue,onPreviewMergeBranch:ct,onMergeBranch:At,onCheckoutBranch:Be,onCreateBranch:ke,onGenerateCommitMessage:rt,onInitializeGit:xt,onGetGitHubPublishInfo:yt,onCheckGitHubRepoAvailability:Ze,onSetupGitHub:Zt,onCommit:bt,onSyncWithRemote:$e,onDiffRenderModeChange:Ve,onWrapLinesChange:Ke,onClose:Ie}:null,[Qt,Ze,Be,Ie,bt,gt,Kt,ke,ge,rt,yt,je,We,xt,ue,le,At,mt,dt,ct,Zt,$e,x,Ve,Ke,e.chatDiffSnapshot,e.editorLabel,Pe]);return m.jsxs("div",{ref:n,className:"flex-1 flex flex-col min-w-0 relative",children:[te&&x?m.jsxs(Rk,{groupRef:Ue,orientation:"horizontal",className:"flex-1 min-h-0",onLayoutChange:Le=>{var Lt;if(!U||ze.current)return;const Je=ie(Le.rightSidebar);Math.abs(Je-Le.rightSidebar)<.1||(Lt=Ue.current)==null||Lt.setLayout({workspace:100-Je,rightSidebar:Je})},onLayoutChanged:Le=>{!U||ze.current||B(ie(Le.rightSidebar))},children:[m.jsx(Tf,{id:"workspace",defaultSize:`${100-se}%`,minSize:"20%",className:"min-h-0 min-w-0",children:Ni}),m.jsx(Tk,{withHandle:!1,orientation:"horizontal",disabled:!U,className:xe(!U&&"pointer-events-none opacity-0")}),m.jsx(kSe,{showRightSidebar:U,sizePercent:se,sidebarPanelRef:tt,sidebarVisualRef:kt,content:Mi?m.jsx(zI,{...Mi}):null})]},`${x}-right-sidebar`):Ni,D?m.jsx(ESe,{projectId:x,showRightSidebar:U,sidebarVisualRef:kt,onClose:Ie,content:Mi?m.jsx(zI,{...Mi}):null}):null]})}function BI({narrow:e=!1,title:t,subtitle:n,icon:r=Mw}){return m.jsxs("div",{className:xe("w-full",e?"max-w-2xl px-6 pt-16 mx-auto":"px-6 pt-16 mb-10"),children:[m.jsxs("div",{className:xe("flex items-center gap-1 mb-2",e&&"justify-center"),children:[m.jsx("div",{className:"p-2 pl-0 rounded-lg",children:m.jsx(r,{className:"h-6 w-6 text-muted-foreground"})}),m.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:t})]}),n&&m.jsx("p",{className:xe("text-muted-foreground",e&&"mb-10 text-center"),children:n})]})}function ASe(e){return e.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function NSe({open:e,onOpenChange:t,onConfirm:n}){const[r,i]=_.useState("new"),[s,o]=_.useState(""),[l,u]=_.useState(""),d=_.useRef(null),f=_.useRef(null);_.useEffect(()=>{e&&(i("new"),o(""),u(""),setTimeout(()=>{var w;return(w=d.current)==null?void 0:w.focus()},0))},[e]),_.useEffect(()=>{e&&setTimeout(()=>{var w,C;r==="new"?(w=d.current)==null||w.focus():(C=f.current)==null||C.focus()},0)},[r,e]);const h=ASe(s),g=h?`${MK}/${h}`:"",b=l.trim(),y=r==="new"?!!h:!!b,x=()=>{if(y){if(r==="new")n({mode:"new",localPath:g,title:s.trim()});else{const w=b.split("/").pop()||b;n({mode:"existing",localPath:b,title:w})}t(!1)}};return m.jsx(od,{open:e,onOpenChange:t,children:m.jsxs(uc,{size:"sm",children:[m.jsxs(ld,{className:"space-y-4",children:[m.jsx(ad,{children:"Add Project"}),m.jsx(G0,{value:r,onValueChange:i,options:[{value:"new",label:"New Folder"},{value:"existing",label:"Existing Path"}],className:"w-full mb-2",optionClassName:"flex-1 justify-center"}),r==="new"?m.jsxs("div",{className:"space-y-2",children:[m.jsx(Wr,{ref:d,type:"text",value:s,onChange:w=>o(w.target.value),onKeyDown:w=>{w.key==="Enter"&&x(),w.key==="Escape"&&t(!1)},placeholder:"Project name"}),g&&m.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:g})]}):m.jsxs("div",{className:"space-y-2",children:[m.jsx(Wr,{ref:f,type:"text",value:l,onChange:w=>u(w.target.value),onKeyDown:w=>{w.key==="Enter"&&x(),w.key==="Escape"&&t(!1)},placeholder:"~/Projects/my-app"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"The folder will be created if it doesn't exist."})]})]}),m.jsxs(cd,{children:[m.jsx(st,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),m.jsx(st,{variant:"secondary",size:"sm",onClick:x,disabled:!y,children:"Create"})]})]})})}function MSe({text:e}){const[t,n]=_.useState(!1);async function r(){await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}return m.jsx(st,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>void r(),children:t?m.jsx(ls,{className:"h-4 w-4 text-green-400"}):m.jsx(Kl,{className:"h-4 w-4"})})}function FI({children:e}){return m.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center group bg-background border border-border text-foreground rounded-xl p-1.5 pl-3 font-mono text-sm",children:[m.jsxs("pre",{className:"inline-flex items-center gap-2 overflow-x-auto",children:[m.jsx(Fo,{className:"inline h-4 w-4 opacity-40"}),m.jsx("code",{children:e})]}),m.jsx(MSe,{text:e})]})}function yg({children:e}){return m.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:e})}function oS({children:e}){return m.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider mb-3",children:e})}function aS({icon:e,title:t,subtitle:n,iconClassName:r}){return m.jsxs("div",{className:"flex flex-col items-center gap-0",children:[m.jsx("div",{className:"p-3 mb-2 rounded-xl bg-background border border-border",children:m.jsx(e,{className:r||"h-8 w-8 text-muted-foreground"})}),m.jsx("span",{className:"text-sm font-medium",children:t}),m.jsx("span",{className:"text-xs text-muted-foreground",children:n})]})}function HI(){return m.jsx(y$,{className:"h-4 w-4 text-muted-foreground"})}function $I({number:e,title:t,children:n}){return m.jsx("div",{className:"flex gap-4",children:m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-baseline gap-3",children:[m.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center font-medium text-logo",children:[e,"."]}),m.jsx("h3",{className:"font-medium text-foreground mb-2",children:t})]}),m.jsx("div",{className:"text-muted-foreground text-sm space-y-3",children:n})]})})}function LSe({localPath:e,loading:t,onClick:n}){return m.jsxs(Qa,{children:[m.jsx(Za,{asChild:!0,children:m.jsxs("button",{className:xe("border border-border hover:border-primary/30 group rounded-lg bg-card px-4 py-3 flex items-center gap-3 w-full text-left hover:bg-muted/50 transition-colors",t&&"opacity-50 cursor-not-allowed"),disabled:t,onClick:n,children:[m.jsx(O9,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),m.jsx("span",{className:"font-medium text-foreground truncate flex-1",children:p5(e)}),t?m.jsx(kn,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary animate-spin flex-shrink-0"}):m.jsx(Lw,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]})}),m.jsx(Uo,{children:m.jsx("p",{children:e})})]})}function DSe({connectionStatus:e,ready:t,snapshot:n,startingLocalPath:r,commandError:i,newProjectOpen:s,onNewProjectOpenChange:o,onOpenProject:l,onCreateProject:u}){const d=_.useMemo(()=>(n==null?void 0:n.projects)??[],[n==null?void 0:n.projects]),f=e==="connecting"||!t,h=e==="connected"&&t;return m.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-y-auto",children:[h?m.jsxs(m.Fragment,{children:[m.jsx(BI,{title:(n==null?void 0:n.machine.displayName)??"Local Projects",subtitle:`${Un} is connected, choose a project below to get started.`}),m.jsxs("div",{className:"w-full px-6 mb-10",children:[m.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[m.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider",children:"Projects"}),m.jsxs(st,{variant:"default",size:"sm",onClick:()=>o(!0),children:[m.jsx(Zg,{className:"h-4 w-4 mr-1.5"}),"Add Project"]})]}),d.length>0?m.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-4 3xl:grid-cols-5 gap-2",children:d.map(g=>m.jsx(LSe,{localPath:g.localPath,loading:r===g.localPath,onClick:()=>{l(g.localPath)}},g.localPath))}):m.jsx(yg,{children:m.jsx("p",{className:"text-sm text-muted-foreground",children:"No local projects discovered yet. Open one with Claude or Codex, or create a new project here."})}),i?m.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3 mt-4",children:i}):null]})]}):m.jsxs(m.Fragment,{children:[m.jsx(BI,{narrow:!0,icon:iA,title:f?`Connecting ${Un}`:`Connect ${Un}`,subtitle:f?`${Un} is starting up and loading your local projects.`:`Run ${Un} directly on your machine with full access to your local files and agent project history.`}),m.jsxs("div",{className:"max-w-2xl w-full mx-auto pb-12 px-6",children:[m.jsx(oS,{children:"Status"}),m.jsx("div",{className:"mb-8",children:m.jsx(yg,{children:m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(kn,{className:"h-4 w-4 text-muted-foreground animate-spin"}),m.jsx("span",{className:"text-sm text-muted-foreground",children:f?`Connecting to your local ${Un} server...`:m.jsxs(m.Fragment,{children:["Not connected. Run ",m.jsx("code",{className:"bg-background border border-border rounded-md mx-0.5 p-1 font-mono text-xs text-foreground",children:Dm()})," from any terminal on this machine."]})})]})})}),f?null:m.jsxs("div",{className:"mb-10",children:[m.jsx(oS,{children:"How it works"}),m.jsx(yg,{children:m.jsxs("div",{className:"flex items-center justify-around gap-6 py-4 px-2",children:[m.jsx(aS,{icon:Dw,title:`${Un} CLI`,subtitle:"On Your Machine"}),m.jsx(HI,{}),m.jsx(aS,{icon:Mw,title:`${Un} Server`,subtitle:"Local WebSocket"}),m.jsx(HI,{}),m.jsx(aS,{icon:iA,title:`${Un} UI`,subtitle:"Project Chat"})]})})]}),f?null:m.jsxs("div",{className:"mb-10",children:[m.jsx(oS,{children:"Setup"}),m.jsx(yg,{children:m.jsxs("div",{className:"space-y-4",children:[m.jsxs($I,{number:1,title:`Start ${Un}`,children:[m.jsx("p",{children:"Run this command in your terminal:"}),m.jsx(FI,{children:Dm()})]}),m.jsxs($I,{number:2,title:"Open the local UI",children:[m.jsxs("p",{children:[Un," serves the app locally and opens the Local Projects page in an app-style browser window."]}),m.jsx(FI,{children:"http://localhost:3210/local"})]}),m.jsxs("div",{className:"mt-8",children:[m.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-4",children:"Notes"}),m.jsxs("div",{className:"space-y-3 text-sm",children:[m.jsxs("div",{className:"flex gap-4",children:[m.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:Dm("").trim()}),m.jsx("span",{className:"text-muted-foreground",children:"Start in the current directory"})]}),m.jsxs("div",{className:"flex gap-4",children:[m.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:Dm("--no-open")}),m.jsx("span",{className:"text-muted-foreground",children:"Start the server without opening the browser"})]})]})]})]})})]})]})]}),m.jsx(NSe,{open:s,onOpenChange:o,onConfirm:g=>{u(g)}}),m.jsx("div",{className:"py-4 text-center",children:m.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v",nC.split("/")[1]]})})]})}function ISe(){const e=kw();return m.jsx("div",{className:"flex-1 flex flex-col min-w-0 relative",children:m.jsx(DSe,{connectionStatus:e.connectionStatus,ready:e.localProjectsReady,snapshot:e.localProjects,startingLocalPath:e.startingLocalPath,commandError:e.commandError,newProjectOpen:e.addProjectModalOpen,onNewProjectOpenChange:t=>{if(t){e.openAddProjectModal();return}e.closeAddProjectModal()},onOpenProject:e.handleOpenLocalProject,onCreateProject:e.handleCreateProject})})}function Yv({children:e,className:t,icon:n,type:r="button",variant:i="outline",...s}){return m.jsxs("button",{type:r,className:xe(i0({variant:i,size:"sm"}),"h-auto gap-1.5 px-3 py-1.5",t),...s,children:[n,m.jsx("span",{children:e})]})}const qh=[{id:"general",label:"General",icon:HU,subtitle:"Manage appearance, editor behavior, and embedded terminal defaults."},{id:"providers",label:"Providers",icon:cU,subtitle:"Manage the default chat provider and saved model defaults for Claude Code and Codex."},{id:"keybindings",label:"Keybindings",icon:Z$,subtitle:"Edit global app shortcuts stored in the active keybindings file."},{id:"changelog",label:"Changelog",icon:E$,subtitle:"Release notes pulled from the public GitHub releases feed."}];function UI(e){return e&&qh.some(t=>t.id===e)?e:null}const PSe=[{value:"light",label:"Light",icon:eV},{value:"dark",label:"Dark",icon:mU},{value:"system",label:"System",icon:Mw}],OSe=[{value:"cursor",label:"Cursor"},{value:"vscode",label:"VS Code"},{value:"windsurf",label:"Windsurf"},{value:"custom",label:"Custom"}],jSe=[{value:"never",label:"Never"},{value:"unfocused",label:"When Unfocused"},{value:"always",label:"Always"}],zSe=[{value:"openai",label:"OpenAI"},{value:"openrouter",label:"OpenRouter"},{value:"custom",label:"Custom"}],BSe="https://api.github.com/repos/jakemor/kanna/releases",FSe=300*1e3;let Ru=null;const VI=Object.keys(C3);function HSe(e){return`Edit global app shortcuts stored in ${e}.`}function WI(e,t){return e!==t}async function $Se(e=fetch){const t=await e(BSe,{headers:{Accept:"application/vnd.github+json"}});if(!t.ok)throw new Error(`GitHub releases request failed with status ${t.status}`);return(await t.json()).filter(r=>!r.draft)}function USe(){return Ru?Date.now()>=Ru.expiresAt?(Ru=null,null):Ru.releases:null}function VSe(e){Ru={releases:e,expiresAt:Date.now()+FSe}}async function GI(e){const t=e!=null&&e.force?null:USe();if(t)return t;const n=await $Se(e==null?void 0:e.fetchImpl);return VSe(n),n}function WSe(e){if(!e)return"Unpublished";const t=new Date(e);return Number.isNaN(t.getTime())?"Unknown date":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(t)}function GSe({status:e,releases:t,error:n,onRetry:r,updateSnapshot:i,currentVersion:s,onInstallUpdate:o,onCheckForUpdates:l}){var x;const u=(i==null?void 0:i.latestVersion)??((x=t[0])==null?void 0:x.tag_name)??"Unknown",d=(i==null?void 0:i.currentVersion)??s,f=(i==null?void 0:i.status)==="checking",h=(i==null?void 0:i.status)==="updating"||(i==null?void 0:i.status)==="restart_pending",g=(i==null?void 0:i.updateAvailable)===!0,b=u.replace(/^v/i,""),y=d.replace(/^v/i,"");return m.jsxs("div",{className:"space-y-4",children:[e==="loading"||e==="idle"?m.jsx("div",{className:"flex min-h-[180px] items-center justify-center rounded-2xl border border-border bg-card/40 px-6 py-8 text-sm text-muted-foreground",children:m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(kn,{className:"h-4 w-4 animate-spin"}),m.jsx("span",{children:"Loading release notes…"})]})}):null,e==="error"?m.jsx("div",{className:"rounded-lg border border-destructive/20 bg-destructive/5 px-6 py-5",children:m.jsxs("div",{className:"flex items-start justify-between gap-4",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-sm font-medium text-foreground",children:"Could not load changelog"}),m.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:n??"Unable to load changelog."})]}),m.jsx("button",{type:"button",onClick:r,className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground transition-colors hover:bg-muted",children:"Retry"})]})}):null,e==="success"&&t.length===0?m.jsxs("div",{className:"rounded-lg border border-border bg-card/30 px-6 py-8",children:[m.jsx("div",{className:"text-sm font-medium text-foreground",children:"No releases yet"}),m.jsx("div",{className:"mt-2 text-sm text-muted-foreground",children:"GitHub did not return any published releases for this repository."})]}):null,!g&&e==="success"?m.jsx("div",{className:"flex justify-end",children:m.jsx(Yv,{variant:"outline",onClick:l,disabled:f||h,children:f?"Checking…":"Check for updates"})}):null,e==="success"&&t.length>0?t.map(w=>{var T,N;const C=w.tag_name.replace(/^v/i,""),R=C===b,E=C===y;return m.jsxs("article",{className:xe("rounded-xl border bg-card/30 pl-6 pr-4 py-4",R?"border-border bg-muted":"border-border"),children:[m.jsxs("div",{className:"flex flex-row items-center min-w-0 flex-1 gap-3 ",children:[m.jsxs("div",{className:"flex flex-row items-center min-w-0 flex-1 gap-2 ",children:[m.jsx("div",{className:"text-lg font-semibold tracking-[-0.2px] text-foreground",children:((T=w.name)==null?void 0:T.trim())||w.tag_name}),m.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[m.jsx("span",{children:WSe(w.published_at)}),w.prerelease?m.jsx("span",{className:"rounded-full border border-border px-2.5 py-1 uppercase tracking-wide",children:"Prerelease"}):null]})]}),m.jsxs("div",{className:"flex flex-row items-center justify-end min-w-0 flex-1 gap-2 ",children:[m.jsx("a",{href:w.html_url,target:"_blank",rel:"noopener noreferrer","aria-label":"View release on GitHub",className:xe(i0({variant:"ghost",size:"icon-sm"}),"h-8 w-8 shrink-0 rounded-md hover:!bg-transparent hover:border-border/0"),children:m.jsx(qSe,{className:"h-4 w-4"})}),E?m.jsx("span",{className:xe("bg-transparent border border-border text-secondary-foreground","h-9 rounded-full px-3 text-sm","h-auto gap-1.5 px-3 py-1.5"),children:"Current"}):null,R&&g?m.jsx(Yv,{variant:"default",className:"",onClick:o,disabled:h,children:m.jsxs("div",{className:"flex flex-row items-center justify-center gap-2",children:[m.jsx(G$,{className:"size-4"}),h?"Updating…":"Update"]})}):null]})]}),(N=w.body)!=null&&N.trim()?m.jsx("div",{className:"prose prose-sm mt-5 max-w-none text-foreground dark:prose-invert",children:m.jsx(gc,{remarkPlugins:[vc],components:fk,children:w.body})}):m.jsx("div",{className:"mt-5 text-sm text-muted-foreground",children:"No release notes were provided."})]},w.id)}):null]})}function qSe({className:e}){return m.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:m.jsx("path",{d:"M12 .5C5.649.5.5 5.649.5 12A11.5 11.5 0 0 0 8.36 22.04c.575.106.785-.25.785-.556 0-.274-.01-1-.015-1.962-3.181.691-3.853-1.532-3.853-1.532-.52-1.322-1.27-1.674-1.27-1.674-1.038-.71.08-.695.08-.695 1.148.08 1.752 1.178 1.752 1.178 1.02 1.748 2.676 1.243 3.328.95.103-.738.399-1.243.725-1.53-2.54-.289-5.211-1.27-5.211-5.65 0-1.248.446-2.27 1.177-3.07-.118-.288-.51-1.45.112-3.024 0 0 .96-.307 3.145 1.173A10.91 10.91 0 0 1 12 6.03c.973.004 1.954.132 2.87.387 2.182-1.48 3.14-1.173 3.14-1.173.625 1.573.233 2.736.115 3.024.734.8 1.175 1.822 1.175 3.07 0 4.39-2.676 5.358-5.224 5.642.41.353.776 1.05.776 2.117 0 1.528-.014 2.761-.014 3.136 0 .309.207.668.79.555A11.502 11.502 0 0 0 23.5 12C23.5 5.649 18.351.5 12 .5Z"})})}function Yi({title:e,description:t,children:n,bordered:r=!0,alignStart:i=!1}){return m.jsx("div",{className:r?"border-t border-border":void 0,children:m.jsxs("div",{className:xe("flex flex-col gap-4 py-5 md:flex-row md:justify-between md:gap-8",i?"md:items-start":"md:items-center"),children:[m.jsxs("div",{className:"min-w-0 max-w-xl",children:[m.jsx("div",{className:"text-sm font-medium text-foreground",children:e}),m.jsx("div",{className:"mt-1 text-[13px] text-muted-foreground",children:t})]}),m.jsx("div",{className:"flex items-center justify-start md:shrink-0 md:justify-end",children:n})]})})}function KSe(){var Ye,Ge;const e=rd(),{sectionId:t}=hP(),n=kw(),{theme:r,setTheme:i}=sB(),[s,o]=_.useState("idle"),[l,u]=_.useState(!1),[d,f]=_.useState(!1),[h,g]=_.useState([]),[b,y]=_.useState(null),x=UI(t)??"general",w=n.connectionStatus==="connecting"||!n.localProjectsReady,C=((Ye=n.localProjects)==null?void 0:Ye.machine.displayName)??"Unavailable",R=((Ge=n.localProjects)==null?void 0:Ge.projects.length)??0,E=nC.split("/")[1]??"unknown",T=Zi(Z=>Z.scrollbackLines),N=Zi(Z=>Z.minColumnWidth),A=Zi(Z=>Z.editorPreset),L=Zi(Z=>Z.editorCommandTemplate),O=Zi(Z=>Z.setScrollbackLines),G=Zi(Z=>Z.setMinColumnWidth),P=Zi(Z=>Z.setEditorPreset),j=Zi(Z=>Z.setEditorCommandTemplate),B=wu(Z=>Z.chatSoundPreference),H=wu(Z=>Z.chatSoundId),$=wu(Z=>Z.setChatSoundPreference),V=wu(Z=>Z.setChatSoundId),z=n.keybindings,q=n.llmProvider,F=ki(Z=>Z.defaultProvider),Y=ki(Z=>Z.providerDefaults),I=ki(Z=>Z.setDefaultProvider),U=ki(Z=>Z.setProviderDefaultModel),X=ki(Z=>Z.setProviderDefaultModelOptions),D=ki(Z=>Z.setProviderDefaultPlanMode),te=_.useMemo(()=>TC(z),[z]),Q=te.filePathDisplay||PK(),[ie,se]=_.useState(String(T)),[pe,re]=_.useState(String(N)),[me,Ee]=_.useState(L),[we,Ae]=_.useState({}),[ze,Ue]=_.useState(null),[tt,kt]=_.useState({provider:"openai",apiKey:"",model:"",baseUrl:""}),[Qt,Pe]=_.useState(null),[Ve,Ke]=_.useState("idle"),[lt,mt]=_.useState(null),[gt,Kt]=_.useState(!1),le=n.updateSnapshot,ge=n.handleReadLlmProvider,je=n.handleWriteLlmProvider,We=n.handleValidateLlmProvider,dt=(le==null?void 0:le.status)==="checking"?"Checking for updates…":(le==null?void 0:le.status)==="updating"?"Installing update…":(le==null?void 0:le.status)==="restart_pending"?"Restarting Kanna…":(le==null?void 0:le.status)==="available"?`Update available${le.latestVersion?`: ${le.latestVersion}`:""}`:(le==null?void 0:le.status)==="up_to_date"?"Up to date":(le==null?void 0:le.status)==="error"?"Update check failed":"Not checked yet";_.useEffect(()=>{se(String(T))},[T]),_.useEffect(()=>{re(String(N))},[N]),_.useEffect(()=>{Ee(L)},[L]),_.useEffect(()=>{Ae(Object.fromEntries(VI.map(Z=>[Z,zy(te.bindings[Z])])))},[te]),_.useEffect(()=>{q&&kt({provider:q.provider,apiKey:q.apiKey,model:q.model,baseUrl:q.baseUrl})},[q]),_.useEffect(()=>{Ke("idle"),mt(null)},[tt.provider,tt.apiKey,tt.model,tt.baseUrl]),_.useEffect(()=>{t&&(UI(t)||e("/settings/general",{replace:!0}))},[e,t]),_.useEffect(()=>{let Z=!1;return fetch("/auth/status",{method:"GET",cache:"no-store",headers:{Accept:"application/json"}}).then(async Ie=>Ie.ok?await Ie.json():{enabled:!1}).then(Ie=>{Z||f(Ie.enabled===!0)}).catch(()=>{Z||f(!1)}),()=>{Z=!0}},[]),_.useEffect(()=>{x!=="providers"||w||ge()},[ge,w,x]),_.useEffect(()=>{if(x!=="changelog"||w)return;let Z=!1;return o("loading"),y(null),GI().then(Ie=>{Z||(g(Ie),o("success"))}).catch(Ie=>{Z||(y(Ie instanceof Error?Ie.message:"Unable to load changelog."),o("error"))}),()=>{Z=!0}},[w,x]);function bt(){const Z=Number(ie);if(!Number.isFinite(Z)){se(String(T));return}O(Z)}function $e(){const Z=Number(pe);if(!Number.isFinite(Z)){re(String(N));return}G(Z)}function rt(Z,Ie){Z.key==="Enter"&&(Ie(),Z.currentTarget.blur())}function xt(Z,Ie){Z.key==="Enter"&&(Ie(),Z.currentTarget.blur())}function yt(){j(me)}function Ze(Z){WI(B,Z)&&($(Z),SS(H,1).catch(()=>{}))}function Zt(Z){WI(H,Z)&&(V(Z),SS(Z,1).catch(()=>{}))}async function ue(){try{Ue(null),await n.socket.command({type:"settings.writeKeybindings",bindings:qI(we)})}catch(Z){Ue(Z instanceof Error?Z.message:"Unable to save keybindings.")}}async function Be(Z){const Ie={...we,[Z]:zy(_s[Z])};Ae(Ie);try{Ue(null),await n.socket.command({type:"settings.writeKeybindings",bindings:qI(Ie)})}catch(_e){Ue(_e instanceof Error?_e.message:"Unable to save keybindings.")}}async function ct(Z=tt){try{Pe(null),await je(Z);const Ie=await We(Z);Ke(Ie.ok?"valid":"invalid"),mt(Ie.error)}catch(Ie){const _e=Ie instanceof Error?{name:Ie.name,message:Ie.message}:Ie;Ke("invalid"),mt(_e),Pe(Ie instanceof Error?Ie.message:"Unable to save quick response provider settings.")}}function At(Z){const Ie={...tt,provider:Z,model:Z==="openai"?SZ:Z==="openrouter"?wZ:tt.model,baseUrl:Z==="custom"?tt.baseUrl:""};kt(Ie),ct(Ie)}function ke(){Ru=null,o("loading"),y(null),GI({force:!0}).then(Z=>{g(Z),o("success")}).catch(Z=>{y(Z instanceof Error?Z.message:"Unable to load changelog."),o("error")})}const ot=me.replaceAll("{path}","/Users/jake/Projects/kanna/src/client/app/App.tsx").replaceAll("{line}","12").replaceAll("{column}","1"),St=qh.find(Z=>Z.id===x)??qh[0],vt=x==="keybindings"?HSe(Q):St.subtitle,ht=!w,Et=lt?JSON.stringify(lt,null,2):"",nn=m.jsxs(m.Fragment,{children:[m.jsxs("span",{children:["Use an OpenAI-compatible API for title and commit message generation before Claude and Codex. Stored in ",(q==null?void 0:q.filePathDisplay)??"the active llm-provider.json file","."]}),m.jsx("span",{className:xe("mt-2 block text-sm font-medium",Ve==="valid"?"text-emerald-600 dark:text-emerald-400":Ve==="invalid"?"text-destructive":"hidden"),children:Ve==="valid"?"Credentials valid & saved":Ve==="invalid"?m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"Credentials invalid."}),lt?m.jsxs(m.Fragment,{children:[" ",m.jsx("button",{type:"button",onClick:()=>Kt(!0),className:"underline underline-offset-2",children:"See error"})]}):null]}):null})]});async function Re(){if(!l){u(!0);try{await n.handleSignOut()}finally{u(!1)}}}return m.jsxs("div",{className:"relative flex h-full flex-1 min-w-0 bg-background",children:[m.jsxs("div",{className:"flex min-w-0 flex-1",children:[m.jsx("aside",{className:`hidden w-[200px] shrink-0 md:block ${ht?"pb-[89px]":""}`,children:m.jsxs("div",{className:"flex flex-col gap-1 px-4 py-6",children:[m.jsx("div",{className:"px-3 pb-5 text-[22px] font-extrabold tracking-[-0.5px] text-foreground",children:"Settings"}),qh.map(Z=>m.jsx("button",{type:"button",onClick:()=>e(`/settings/${Z.id}`),className:`cursor-pointer rounded-lg px-3 py-2 text-sm ${Z.id===x?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:m.jsxs("div",{className:"flex items-center gap-2.5",children:[m.jsx(Z.icon,{className:"h-4 w-4 shrink-0"}),m.jsx("span",{children:Z.label})]})},Z.label)),d?m.jsx("button",{type:"button",onClick:()=>{Re()},disabled:l,className:"cursor-pointer rounded-lg px-3 py-2 text-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:m.jsxs("div",{className:"flex items-center gap-2.5",children:[m.jsx(oA,{className:"h-4 w-4 shrink-0"}),m.jsx("span",{children:l?"Signing out...":"Sign out"})]})}):null]})}),m.jsxs("div",{className:"min-w-0 flex-1 overflow-y-auto",children:[m.jsx("div",{className:"border-b border-border py-2 md:hidden",children:m.jsx("div",{className:"overflow-x-auto pr-4 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:m.jsxs("div",{className:"flex min-w-max items-center gap-2",children:[m.jsx("div",{className:" sticky left-0 bg-gradient-to-r from-background via-background/80 to-transparent px-2 py-1",children:m.jsx("button",{type:"button",onClick:n.openSidebar,className:"flex shrink-0 items-center p-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground","aria-label":"Open sidebar",title:"Open sidebar",children:m.jsx(Nw,{className:"h-4 w-4 shrink-0"})})}),qh.map(Z=>m.jsxs("button",{type:"button",onClick:()=>e(`/settings/${Z.id}`),className:xe("flex shrink-0 items-center gap-2 rounded-full border px-3 py-2 text-sm transition-colors",Z.id===x?"border-transparent bg-muted font-medium text-foreground":"border-border bg-background text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[m.jsx(Z.icon,{className:"h-4 w-4 shrink-0"}),m.jsx("span",{className:"whitespace-nowrap",children:Z.label})]},Z.label)),d?m.jsxs("button",{type:"button",onClick:()=>{Re()},disabled:l,className:xe("flex shrink-0 items-center gap-2 rounded-full border px-3 py-2 text-sm transition-colors","border-border bg-background text-muted-foreground hover:bg-muted/50 hover:text-foreground","disabled:cursor-not-allowed disabled:opacity-50"),children:[m.jsx(oA,{className:"h-4 w-4 shrink-0"}),m.jsx("span",{className:"whitespace-nowrap",children:l?"Signing out...":"Sign out"})]}):null]})})}),m.jsxs("div",{className:"w-full px-4 pb-32 pt-8 md:px-6 md:pt-16",children:[w?m.jsx("div",{className:"flex min-h-[240px] items-center justify-center rounded-2xl border border-border bg-card/40 px-4 py-6 text-sm text-muted-foreground",children:m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(kn,{className:"h-4 w-4 animate-spin"}),m.jsx("span",{children:"Loading machine settings…"})]})}):m.jsxs("div",{className:"mx-auto max-w-4xl",children:[m.jsxs("div",{className:"pb-6",children:[m.jsxs("div",{className:"flex items-center justify-between gap-4 min-h-[34px]",children:[m.jsx("div",{className:"text-lg font-semibold tracking-[-0.2px] text-foreground",children:St.label}),x==="general"?m.jsx(Yv,{variant:"outline",onClick:()=>e("/settings/changelog"),children:"Check for updates"}):null,x==="keybindings"?m.jsxs(Yv,{onClick:()=>{n.handleOpenExternalPath("open_editor",Q)},icon:m.jsx(t0,{className:"h-4 w-4"}),children:["Open in ",n.editorLabel]}):null]}),m.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:vt})]}),x==="general"?m.jsx(m.Fragment,{children:m.jsxs("div",{className:"border-b border-border",children:[m.jsx(Yi,{title:"Application Update",description:m.jsxs(m.Fragment,{children:[m.jsxs("span",{children:[dt,"."]}),le!=null&&le.lastCheckedAt?m.jsxs("span",{children:[" Last checked ",new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(le.lastCheckedAt),"."]}):null,le!=null&&le.error?m.jsxs("span",{children:[" ",le.error]}):null]}),bordered:!1,children:m.jsxs("div",{className:"text-right text-sm text-foreground",children:[m.jsxs("div",{children:["Current: ",(le==null?void 0:le.currentVersion)??E]}),m.jsxs("div",{className:"text-xs text-muted-foreground",children:["Latest: ",(le==null?void 0:le.latestVersion)??"Unknown"]})]})}),m.jsx(Yi,{title:"Theme",description:"Choose between light, dark, or system appearance",children:m.jsx(G0,{value:r,onValueChange:i,options:PSe,size:"sm"})}),m.jsx(Yi,{title:"Chat Sounds",description:"Play a pop when a chat starts waiting on you or the unread chat count increases",children:m.jsxs(Ol,{value:B,onValueChange:Z=>Ze(Z),children:[m.jsx(Ba,{className:"min-w-[180px]",children:m.jsx(jl,{})}),m.jsx(Fa,{children:m.jsx(Rh,{children:jSe.map(Z=>m.jsx(qs,{value:Z.value,children:Z.label},Z.value))})})]})}),m.jsx(Yi,{title:"Chat Sound",description:"The bundled sound used for chat notification playback and previews",children:m.jsxs(Ol,{value:H,onValueChange:Z=>Zt(Z),children:[m.jsx(Ba,{className:"min-w-[180px]",children:m.jsx(jl,{})}),m.jsx(Fa,{children:m.jsx(Rh,{children:$K.map(Z=>m.jsx(qs,{value:Z.value,children:Z.label},Z.value))})})]})}),m.jsx(Yi,{title:"Default Editor",description:"Used by the navbar code button and local file links in chat",alignStart:!0,children:m.jsxs(Ol,{value:A,onValueChange:Z=>P(Z),children:[m.jsx(Ba,{className:"min-w-[180px]",children:m.jsx(jl,{})}),m.jsx(Fa,{children:m.jsx(Rh,{children:OSe.map(Z=>m.jsx(qs,{value:Z.value,children:Z.label},Z.value))})})]})}),A==="custom"?m.jsx("div",{className:"border-t border-border",children:m.jsxs("div",{className:"flex justify-between gap-8 py-5 pl-6",children:[m.jsxs("div",{className:"min-w-0 max-w-xl",children:[m.jsx("div",{className:"text-sm font-medium text-foreground",children:"Command Template"}),m.jsxs("div",{className:"mt-1 text-[13px] text-muted-foreground",children:["Include ","{path}"," and optionally ","{line}"," and ","{column}"," in your command."]})]}),m.jsxs("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:[m.jsx(Wr,{type:"text",value:me,onChange:Z=>Ee(Z.target.value),onBlur:yt,onKeyDown:Z=>xt(Z,yt),className:"font-mono"}),m.jsxs("div",{className:"text-xs text-muted-foreground",children:["Preview: ",m.jsx("span",{className:"font-mono",children:ot})]})]})]})}):null,m.jsx(Yi,{title:"Terminal Scrollback",description:"Lines retained for embedded terminal history",children:m.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[m.jsx(Wr,{type:"number",min:C1,max:k1,step:100,value:ie,onChange:Z=>se(Z.target.value),onBlur:bt,onKeyDown:Z=>rt(Z,bt),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),m.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[C1,"-",k1," lines",T===Pv?" (default)":""]})]})}),m.jsx(Yi,{title:"Terminal Min Column Width",description:"Minimum width for each terminal pane",children:m.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[m.jsx(Wr,{type:"number",min:E1,max:R1,step:10,value:pe,onChange:Z=>re(Z.target.value),onBlur:$e,onKeyDown:Z=>rt(Z,$e),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),m.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[E1,"-",R1," px",N===Ov?" (default)":""]})]})})]})}):x==="providers"?m.jsxs("div",{className:"border-b border-border",children:[m.jsx(Yi,{title:"Default Provider",description:"The default harness used for new chats before a provider is locked by an existing session.",bordered:!1,children:m.jsxs(Ol,{value:F,onValueChange:Z=>I(Z),children:[m.jsx(Ba,{className:"min-w-[180px]",children:m.jsx(jl,{})}),m.jsx(Fa,{children:m.jsxs(Rh,{children:[m.jsx(qs,{value:"last_used",children:"Last Used"}),Zh.map(Z=>m.jsx(qs,{value:Z.id,children:Z.label},Z.id))]})})]})}),m.jsx(Yi,{title:"Claude Code Defaults",description:"Saved defaults when using Claude Code.",alignStart:!0,children:m.jsx("div",{className:"max-w-[420px]",children:m.jsx(L1,{availableProviders:Zh,selectedProvider:"claude",showProviderPicker:!1,providerLocked:!0,model:Y.claude.model,modelOptions:Y.claude.modelOptions,onModelChange:(Z,Ie)=>{U("claude",Ie)},onModelOptionChange:Z=>{Z.type==="claudeReasoningEffort"?X("claude",{reasoningEffort:Z.effort}):Z.type==="contextWindow"&&X("claude",{contextWindow:Z.contextWindow})},planMode:Y.claude.planMode,onPlanModeChange:Z=>D("claude",Z),includePlanMode:!0,className:"justify-start flex-wrap"})})}),m.jsx(Yi,{title:"Codex Defaults",description:"Saved defaults when using Codex.",alignStart:!0,children:m.jsx("div",{className:"max-w-[420px]",children:m.jsx(L1,{availableProviders:Zh,selectedProvider:"codex",showProviderPicker:!1,providerLocked:!0,model:Y.codex.model,modelOptions:Y.codex.modelOptions,onModelChange:(Z,Ie)=>{U("codex",Ie)},onModelOptionChange:Z=>{Z.type==="codexReasoningEffort"?X("codex",{reasoningEffort:Z.effort}):Z.type==="fastMode"&&X("codex",{fastMode:Z.fastMode})},planMode:Y.codex.planMode,onPlanModeChange:Z=>D("codex",Z),includePlanMode:!0,className:"justify-start flex-wrap"})})}),m.jsx(Yi,{title:"Quick Response SDK",description:nn,alignStart:!0,children:m.jsxs("div",{className:"flex w-full max-w-[420px] flex-col gap-3",children:[Qt?m.jsx("div",{className:"rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:Qt}):null,q!=null&&q.warning?m.jsx("div",{className:"rounded-lg border border-border bg-card/30 px-4 py-3 text-sm text-muted-foreground",children:q.warning}):null,m.jsxs(Ol,{value:tt.provider,onValueChange:Z=>At(Z),children:[m.jsx(Ba,{className:"w-full",children:m.jsx(jl,{})}),m.jsx(Fa,{children:m.jsx(Rh,{children:zSe.map(Z=>m.jsx(qs,{value:Z.value,children:Z.label},Z.value))})})]}),tt.provider==="custom"?m.jsx(Wr,{value:tt.baseUrl,onChange:Z=>kt(Ie=>({...Ie,baseUrl:Z.target.value})),onBlur:()=>void ct(),onKeyDown:Z=>xt(Z,()=>void ct()),placeholder:"https://your-provider.example/v1"}):null,m.jsx(Wr,{type:"password",value:tt.apiKey,onChange:Z=>kt(Ie=>({...Ie,apiKey:Z.target.value})),onBlur:()=>void ct(),onKeyDown:Z=>xt(Z,()=>void ct()),placeholder:"API key"}),m.jsx(Wr,{value:tt.model,onChange:Z=>kt(Ie=>({...Ie,model:Z.target.value})),onBlur:()=>void ct(),onKeyDown:Z=>xt(Z,()=>void ct()),placeholder:"Model id"})]})})]}):x==="keybindings"?m.jsxs("div",{className:"border-b border-border",children:[ze?m.jsx("div",{className:"mb-4 rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:ze}):null,te.warning?m.jsx("div",{className:"mb-4 rounded-lg border border-border bg-card/30 px-4 py-3 text-sm text-muted-foreground",children:te.warning}):null,VI.map((Z,Ie)=>{const _e=zy(_s[Z]),qe=we[Z]??"",Te=qe!==_e;return m.jsx(Yi,{title:C3[Z],description:m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"Comma-separated shortcuts."}),Te?m.jsxs(m.Fragment,{children:[m.jsx("span",{children:" "}),m.jsxs("button",{type:"button",onClick:()=>{Be(Z)},className:"inline rounded text-foreground hover:text-foreground/80",children:["Restore: ",_e]})]}):null]}),bordered:Ie!==0,children:m.jsx("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:m.jsx(Wr,{type:"text",value:qe,onChange:Nt=>{const wt=Nt.target.value;Ae(Jt=>({...Jt,[Z]:wt}))},onBlur:()=>{ue()},onKeyDown:Nt=>xt(Nt,()=>{ue()}),className:"font-mono"})})},Z)})]}):m.jsx(GSe,{status:s,releases:h,error:b,onRetry:ke,updateSnapshot:le,currentVersion:E,onInstallUpdate:()=>{n.handleInstallUpdate()},onCheckForUpdates:()=>{n.handleCheckForUpdates({force:!0})}})]}),n.commandError?m.jsxs("div",{className:"mx-auto mt-4 flex max-w-4xl items-start gap-3 rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:[m.jsx(K9,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),m.jsx("span",{children:n.commandError})]}):null]})]})]}),ht?m.jsx("div",{className:"absolute bottom-0 left-0 right-0 border-t border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:m.jsx("div",{className:"px-6 py-[14.25px]",children:m.jsxs("div",{className:"grid gap-3 text-xs text-muted-foreground grid-cols-2 lg:grid-cols-4",children:[m.jsxs("div",{children:[m.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"Machine"}),m.jsx("div",{className:"text-foreground/80",children:C})]}),m.jsxs("div",{className:"hidden md:block",children:[m.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"Connection"}),m.jsx("div",{className:"text-foreground/80",children:n.connectionStatus})]}),m.jsxs("div",{className:"hidden md:block",children:[m.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"Projects Indexed"}),m.jsx("div",{className:"text-foreground/80",children:R})]}),m.jsxs("div",{children:[m.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"App Version"}),m.jsx("div",{className:"text-foreground/80",children:E})]})]})})}):null,m.jsx(od,{open:gt,onOpenChange:Kt,children:m.jsxs(uc,{size:"lg",children:[m.jsxs(ld,{className:"space-y-4",children:[m.jsx(ad,{children:"Validation Error"}),m.jsx("pre",{className:"max-h-[60vh] overflow-auto rounded-lg border border-border bg-muted p-3 text-xs font-mono whitespace-pre-wrap break-words",children:Et})]}),m.jsx(cd,{children:m.jsx(st,{variant:"secondary",size:"sm",onClick:()=>Kt(!1),children:"Close"})})]})})]})}function qI(e){return{toggleEmbeddedTerminal:Ra(e.toggleEmbeddedTerminal??""),toggleRightSidebar:Ra(e.toggleRightSidebar??""),openInFinder:Ra(e.openInFinder??""),openInEditor:Ra(e.openInEditor??""),addSplitTerminal:Ra(e.addSplitTerminal??""),jumpToSidebarChat:Ra(e.jumpToSidebarChat??""),createChatInCurrentProject:Ra(e.createChatInCurrentProject??""),openAddProject:Ra(e.openAddProject??"")}}const KI="kanna:last-seen-version";function YSe({error:e,onSubmit:t}){const[n,r]=_.useState(""),[i,s]=_.useState(!1);async function o(l){if(l.preventDefault(),!(!n||i)){s(!0);try{await t(n),r("")}finally{s(!1)}}}return m.jsx("div",{className:"flex min-h-[100dvh] items-center justify-center bg-background px-6 py-10",children:m.jsxs($w,{className:"w-full max-w-md rounded-3xl border border-border bg-card shadow-sm",children:[m.jsxs(Uw,{className:"flex flex-col p-2 space-y-3 px-6 pt-6 pb-5 pl-[28px]",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(Tu,{className:"h-5 w-5 text-logo"}),m.jsx("div",{children:m.jsx(TO,{className:"font-logo text-xl uppercase text-slate-600 dark:text-slate-100",children:Un})})]}),m.jsx(AO,{className:"leading-6",children:"Enter your password to continue. Your session will be authenticated via a secure session cookie until the CLI process restarts."})]}),m.jsx(Vw,{className:"px-6 pb-6",children:m.jsxs("form",{className:"space-y-4",onSubmit:l=>void o(l),children:[e?m.jsx("div",{className:"rounded-2xl border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-foreground",children:e}):null,m.jsx(Wr,{id:"kanna-password",type:"password",autoComplete:"current-password",value:n,onChange:l=>r(l.target.value),placeholder:"Password",disabled:i,className:"h-11 rounded-2xl bg-background"}),m.jsx(st,{type:"submit",disabled:i||n.length===0,className:"h-11 w-full",children:i?"Unlocking...":"Unlock"})]})})]})})}function XSe(){const[e,t]=_.useState({status:"checking"}),n=_.useCallback(async()=>{t(o=>o.status==="ready"?o:{status:"checking"});let i;try{i=await fetch("/auth/status",{method:"GET",cache:"no-store",headers:{Accept:"application/json"}})}catch{t({status:"ready"});return}if(!i.ok){t({status:"ready"});return}const s=await i.json();if(!s.enabled||s.authenticated){t({status:"ready"});return}t({status:"locked",error:null})},[]);_.useEffect(()=>{n()},[n]);const r=_.useCallback(async i=>{if(!(await fetch("/auth/login",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({password:i,next:window.location.pathname+window.location.search})})).ok){t({status:"locked",error:"Incorrect password. Try again."});return}await n()},[n]);return{state:e,submitPassword:r}}function QSe(e,t,n){return e==="/"&&!!t&&n!==t}function ZSe(){const e=Ns(),t=rd(),n=hP(),r=Bme(n.chatId??null),i=wu(E=>E.chatSoundPreference),s=wu(E=>E.chatSoundId),o=e.pathname==="/",l=nC.split("/")[1]??"unknown",u=_.useRef(null),d=_.useCallback(E=>{r.handleCreateChat(E)},[r.handleCreateChat]),f=_.useCallback(E=>{r.handleForkChat(E)},[r.handleForkChat]),h=_.useCallback(()=>{r.openAddProjectModal()},[r]),g=_.useCallback(E=>{r.handleDeleteChat(E)},[r.handleDeleteChat]),b=_.useCallback(E=>{r.handleCopyPath(E)},[r.handleCopyPath]),y=_.useCallback((E,T)=>{r.handleOpenExternalPath(E,T)},[r.handleOpenExternalPath]),x=_.useCallback(E=>{r.handleRemoveProject(E)},[r.handleRemoveProject]),w=_.useCallback(E=>{r.handleReorderProjectGroups(E)},[r.handleReorderProjectGroups]),C=_.useCallback(()=>{t("/settings/changelog")},[t]),R=_.useMemo(()=>m.jsx(HZ,{data:r.sidebarData,activeChatId:r.activeChatId,connectionStatus:r.connectionStatus,ready:r.sidebarReady,open:r.sidebarOpen,collapsed:r.sidebarCollapsed,showMobileOpenButton:o,onOpen:r.openSidebar,onClose:r.closeSidebar,onCollapse:r.collapseSidebar,onExpand:r.expandSidebar,onCreateChat:d,onForkChat:f,currentProjectId:r.activeProjectId,keybindings:r.keybindings,onDeleteChat:g,onOpenAddProjectModal:h,onCopyPath:b,onOpenExternalPath:y,onRemoveProject:x,onReorderProjectGroups:w,editorLabel:r.editorLabel,updateSnapshot:r.updateSnapshot,onOpenChangelog:C}),[C,h,b,d,g,y,w,x,o,r.activeChatId,r.activeProjectId,r.keybindings,r.closeSidebar,r.collapseSidebar,r.connectionStatus,r.editorLabel,r.expandSidebar,r.openSidebar,r.sidebarCollapsed,r.sidebarData,r.sidebarOpen,r.sidebarReady,r.updateSnapshot]);return _.useEffect(()=>{const E=window.localStorage.getItem(KI),T=QSe(e.pathname,l,E);window.localStorage.setItem(KI,l),T&&t("/settings/changelog",{replace:!0})},[l,e.pathname,t]),_.useLayoutEffect(()=>{document.title=Un},[e.key]),_.useEffect(()=>{function E(){document.title=Un}function T(){document.title=Un}return window.addEventListener("pageshow",E),window.addEventListener("pagehide",T),()=>{window.removeEventListener("pageshow",E),window.removeEventListener("pagehide",T)}},[]),_.useEffect(()=>{const E=qK(r.sidebarData);document.title=E>0?`[${E}] ${Un}`:Un},[r.sidebarData]),_.useEffect(()=>{const E=KK(u.current,r.sidebarData);u.current=r.sidebarData,!(E<=0)&&GK(i)&&SS(s,E).catch(()=>{})},[s,i,r.sidebarData]),m.jsxs("div",{className:"flex h-[100dvh] min-h-[100dvh] overflow-hidden",children:[R,m.jsx(kH,{context:r})]})}function JSe(){const e=XSe();return e.state.status==="checking"?m.jsx("div",{className:"flex min-h-[100dvh] items-center justify-center bg-background text-sm text-muted-foreground",children:"Checking session…"}):e.state.status==="locked"?m.jsx(YSe,{error:e.state.error,onSubmit:e.submitPassword}):m.jsx(wK,{children:m.jsx(HG,{children:m.jsx(RH,{children:m.jsxs(bu,{element:m.jsx(ZSe,{}),children:[m.jsx(bu,{path:"/",element:m.jsx(ISe,{})}),m.jsx(bu,{path:"/settings",element:m.jsx(CH,{to:"/settings/general",replace:!0})}),m.jsx(bu,{path:"/settings/:sectionId",element:m.jsx(KSe,{})}),m.jsx(bu,{path:"/chat/:chatId",element:m.jsx(TSe,{})})]})})})})}const uB=document.getElementById("root");if(!uB)throw new Error("Missing #root");R7.createRoot(uB).render(m.jsx(_.StrictMode,{children:m.jsx(QH,{children:m.jsx(iSe,{children:m.jsx(JSe,{})})})}));
|
|
2608
|
+
${re.detail}`:""}`,closeLabel:"OK"})}catch(re){await r.alert({title:"Create branch failed",description:re instanceof Error?re.message:String(re),closeLabel:"OK"})}},[r,V,y,e.socket]);return _.useEffect(()=>{if(!t||!n)return;const D=window.setInterval(()=>{y()},Ebe);return()=>window.clearInterval(D)},[t,y,n]),_.useEffect(()=>{!t||!n||y()},[t,y,n]),_.useEffect(()=>{!t||!e.activeChatId||f.current!==t&&(f.current=t,b())},[t,b,e.activeChatId]),_.useEffect(()=>{if(!t||!n)return;function D(){document.visibilityState==="visible"&&y()}return window.addEventListener("focus",D),document.addEventListener("visibilitychange",D),()=>{window.removeEventListener("focus",D),document.removeEventListener("visibilitychange",D)}},[t,y,n]),_.useEffect(()=>{n&&d.current&&!e.isProcessing&&y(),d.current=e.isProcessing},[y,n,e.isProcessing]),_.useEffect(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]),_.useEffect(()=>{n||u.current!==null&&(window.clearTimeout(u.current),u.current=null)},[t,n]),{diffRenderMode:i,wrapDiffLines:o,setDiffRenderMode:s,setWrapDiffLines:l,scheduleTerminalDiffRefresh:x,handleOpenDiffFile:w,handleCopyDiffFilePath:C,handleCopyDiffRelativePath:R,handleLoadDiffPatch:E,handleDiscardDiffFile:T,handleIgnoreDiffFile:N,handleIgnoreDiffFolder:A,handleOpenDiffInFinder:L,handleCommitDiffs:O,handleSyncBranch:G,handleGenerateCommitMessage:P,handleInitializeGit:j,handleGetGitHubPublishInfo:B,handleCheckGitHubRepoAvailability:H,handleSetupGitHub:$,handleListBranches:V,handleCheckoutBranch:z,handlePreviewMergeBranch:q,handleMergeBranch:F,handleCreateBranch:Y}}function vSe(e,t){const[n,r]=_.useState(""),[i,s]=_.useState(!1);return _.useEffect(()=>{if(!e)return;r(""),s(!1);let o=0;const l=window.setInterval(()=>{o+=1,r($v.slice(0,o)),o>=$v.length&&(window.clearInterval(l),s(!0))},Cbe);return()=>window.clearInterval(l)},[e,t]),{typedEmptyStateText:n,isEmptyStateTypingComplete:i}}function bSe(e){const[t,n]=_.useState(!1),r=_.useRef(0),i=_.useCallback(d=>{var f;return Abe(((f=d.dataTransfer)==null?void 0:f.types)??[])},[]),s=_.useCallback(d=>{!i(d)||!e.hasSelectedProject||(d.preventDefault(),r.current+=1,n(!0))},[e.hasSelectedProject,i]),o=_.useCallback(d=>{!i(d)||!e.hasSelectedProject||(d.preventDefault(),d.dataTransfer.dropEffect="copy",t||n(!0))},[e.hasSelectedProject,i,t]),l=_.useCallback(d=>{!i(d)||!e.hasSelectedProject||(d.preventDefault(),r.current=Math.max(0,r.current-1),r.current===0&&n(!1))},[e.hasSelectedProject,i]),u=_.useCallback(d=>{!i(d)||!e.hasSelectedProject||(d.preventDefault(),r.current=0,n(!1),e.onFilesDropped([...d.dataTransfer.files]))},[e,i]);return{isPageFileDragActive:t,handleTranscriptDragEnter:s,handleTranscriptDragOver:o,handleTranscriptDragLeave:l,handleTranscriptDrop:u}}function _Se(e){const[t,n]=_.useState(0);return _.useLayoutEffect(()=>{const r=e.current;if(!r)return;const i=()=>{const o=r.clientWidth;n(l=>Math.abs(l-o)<1?l:o)},s=new ResizeObserver(i);return s.observe(r),i(),()=>s.disconnect()},[e]),t}function ySe(){const e=_.useRef(null),[t,n]=_.useState(148),r=_.useCallback(()=>{const i=e.current;if(!i)return;const s=i.getBoundingClientRect().height;n(o=>Lme(o,s))},[]);return _.useLayoutEffect(()=>{const i=e.current;if(!i)return;const s=new ResizeObserver(()=>{r()});return s.observe(i),r(),()=>s.disconnect()},[r]),{inputRef:e,syncInputHeight:r,transcriptPaddingBottom:Mme(t)}}const xSe=768;function SSe(e){return e>0&&e<xSe}function wSe(){const[e,t]=_.useState(()=>typeof window>"u"?0:window.innerWidth);return _.useEffect(()=>{if(typeof window>"u")return;const n=()=>t(window.innerWidth);return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),SSe(e)}function CSe(e){const[t,n]=_.useState(0);return _.useEffect(()=>{const r=e.layoutRootRef.current;if(!r)return;const i=()=>{const o=r.getBoundingClientRect().height;if(!e.shouldRenderTerminalLayout||o<=0)return;const l=o*(e.terminalMainSizes[1]/100);l<=0||n(u=>Math.abs(u-l)<1?u:l)},s=new ResizeObserver(i);return s.observe(r),i(),()=>s.disconnect()},[e.layoutRootRef,e.shouldRenderTerminalLayout,e.terminalMainSizes]),t}const zI=_.memo(function(t){return m.jsx(Mfe,{...t,diffs:t.diffs??c6})}),kSe=_.memo(function({showRightSidebar:t,sizePercent:n,sidebarPanelRef:r,sidebarVisualRef:i,content:s}){return m.jsx(Tf,{id:"rightSidebar",defaultSize:`${n}%`,className:"min-h-0 min-w-0",elementRef:r,children:m.jsx("div",{ref:i,className:"h-full min-h-0 overflow-hidden","data-right-sidebar-open":t?"true":"false","data-right-sidebar-animated":"false","data-right-sidebar-visual":!0,style:{"--terminal-toggle-duration":`${op}ms`},children:s})})}),ESe=_.memo(function({projectId:t,showRightSidebar:n,sidebarVisualRef:r,onClose:i,content:s}){return t?m.jsxs("div",{className:xe("absolute inset-0 z-40 transition-opacity duration-300 ease-out",n?"pointer-events-auto opacity-100":"pointer-events-none opacity-0"),"aria-hidden":n?void 0:!0,"data-mobile-right-sidebar-overlay":!0,children:[m.jsx("button",{type:"button",className:"absolute inset-0 bg-black/45 backdrop-blur-[1px]","aria-label":"Close changes sidebar",onClick:i}),m.jsx("div",{ref:r,className:xe("absolute inset-y-0 right-0 flex w-[min(92vw,30rem)] max-w-full min-h-0 flex-col overflow-hidden border-l border-border bg-background shadow-2xl transition-transform duration-300 ease-out","pt-[max(env(safe-area-inset-top),0px)] pb-[max(env(safe-area-inset-bottom),0px)]",n?"translate-x-0":"translate-x-full"),"data-right-sidebar-open":n?"true":"false","data-right-sidebar-animated":"false","data-right-sidebar-visual":!0,children:s})]}):null});function RSe({chatCard:e,projectId:t,shouldRenderTerminalLayout:n,showTerminalPane:r,terminalLayout:i,mainPanelGroupRef:s,terminalPanelRef:o,terminalVisualRef:l,fixedTerminalHeight:u,terminalFocusRequestVersion:d,addTerminal:f,socket:h,connectionStatus:g,scrollback:b,minColumnWidth:y,splitTerminalShortcut:x,onTerminalCommandSent:w,onRemoveTerminal:C,onTerminalLayout:R,onLayoutChanged:E}){return n?m.jsxs(Rk,{groupRef:s,orientation:"vertical",className:"flex-1 min-h-0",onLayoutChanged:E,children:[m.jsx(Tf,{id:"chat",defaultSize:`${i.mainSizes[0]}%`,minSize:"25%",className:"min-h-0",children:e}),m.jsx(Tk,{withHandle:!0,orientation:"vertical",disabled:!r,className:xe(!r&&"pointer-events-none opacity-0")}),m.jsx(Tf,{id:"terminal",defaultSize:`${i.mainSizes[1]}%`,minSize:"0%",className:"min-h-0",elementRef:o,children:m.jsx("div",{ref:l,className:"h-full min-h-0 overflow-hidden relative","data-terminal-open":r?"true":"false","data-terminal-animated":"false","data-terminal-visual":!0,style:{"--terminal-toggle-duration":`${op}ms`},children:m.jsx(mSe,{projectId:t,fixedTerminalHeight:u,terminalLayout:i,addTerminal:f,socket:h,connectionStatus:g,scrollback:b,minColumnWidth:y,splitTerminalShortcut:x,focusRequestVersion:d,onTerminalCommandSent:w,onRemoveTerminal:C,onTerminalLayout:R})})})]},t):m.jsx(m.Fragment,{children:e})}function TSe(){var Wt,Li,di,Di,Ar,hi,rn,Ds;const e=kw(),t=Hw(),n=_.useRef(null),r=_.useRef(null),i=_.useRef(!0),s=_.useRef(null),o=_.useRef(null),l=_.useRef(null),u=_.useRef(null),{inputRef:d,syncInputHeight:f,transcriptPaddingBottom:h}=ySe(),[g,b]=_.useState(!1),y=e.messages.length===0&&((Wt=e.runtime)==null?void 0:Wt.title)==="New Chat",x=e.activeProjectId,C=Oa(Le=>x?Le.projects[x]:void 0)??vpe,E=oi(Le=>x?Le.projects[x]:void 0)??Qse,T=oi(Le=>Le.size),N=Oa(Le=>Le.addTerminal),A=Oa(Le=>Le.removeTerminal),L=Oa(Le=>Le.toggleVisibility),O=Oa(Le=>Le.resetMainSizes),G=Oa(Le=>Le.setMainSizes),P=Oa(Le=>Le.setTerminalSizes),j=oi(Le=>Le.toggleVisibility),B=oi(Le=>Le.setSize),H=Zi(Le=>Le.scrollbackLines),$=Zi(Le=>Le.minColumnWidth),V=_.useMemo(()=>TC(e.keybindings),[e.keybindings]),z=_.useRef(null),q=_.useMemo(()=>{var Lt;const Le=dpe(((Lt=e.chatSnapshot)==null?void 0:Lt.messages)??[]),Je=z.current;return Tbe(Je,Le)?Je:(z.current=Le,Le)},[(Li=e.chatSnapshot)==null?void 0:Li.messages]),F=C.terminals.length>0,Y=!!(x&&C.isVisible&&F),I=!!(x&&F),U=!!(x&&E.isVisible),X=!!x,D=wSe(),te=X&&!D,Q=_Se(n),ie=_.useCallback((Le,Je)=>{if(!Number.isFinite(Le))return T;const Lt=Je??Q,Br=Lt>0?Kse/Lt*100:s1;return Math.max(s1,Br,Le)},[T,Q]),se=ie(T??Ou),pe=CSe({layoutRootRef:n,shouldRenderTerminalLayout:I,terminalMainSizes:C.mainSizes}),{isAnimating:re,mainPanelGroupRef:me,terminalFocusRequestVersion:Ee,terminalPanelRef:we,terminalVisualRef:Ae}=Dpe({showTerminalPane:Y,shouldRenderTerminalLayout:I,projectId:x,terminalLayout:C,chatInputRef:l}),{isAnimating:ze,panelGroupRef:Ue,sidebarPanelRef:tt,sidebarVisualRef:kt}=Ape({projectId:x,shouldRenderRightSidebarLayout:te,showRightSidebar:U,rightSidebarSize:se}),{diffRenderMode:Qt,wrapDiffLines:Pe,setDiffRenderMode:Ve,setWrapDiffLines:Ke,scheduleTerminalDiffRefresh:lt,handleOpenDiffFile:mt,handleCopyDiffFilePath:gt,handleCopyDiffRelativePath:Kt,handleLoadDiffPatch:le,handleDiscardDiffFile:ge,handleIgnoreDiffFile:je,handleIgnoreDiffFolder:We,handleOpenDiffInFinder:dt,handleCommitDiffs:bt,handleSyncBranch:$e,handleGenerateCommitMessage:rt,handleInitializeGit:xt,handleGetGitHubPublishInfo:yt,handleCheckGitHubRepoAvailability:Ze,handleSetupGitHub:Zt,handleListBranches:ue,handleCheckoutBranch:Be,handlePreviewMergeBranch:ct,handleMergeBranch:At,handleCreateBranch:ke}=gSe({state:e,projectId:x,showRightSidebar:U}),{typedEmptyStateText:ot,isEmptyStateTypingComplete:St}=vSe(y,e.activeChatId);Npe({rootRef:o,fallbackRef:l,enabled:e.hasSelectedProject,canCancel:e.canCancel});const vt=_.useCallback(Le=>{var Je;!e.hasSelectedProject||Le.length===0||(Je=u.current)==null||Je.enqueueFiles(Le)},[e.hasSelectedProject]),{isPageFileDragActive:ht,handleTranscriptDragEnter:Et,handleTranscriptDragOver:nn,handleTranscriptDragLeave:Re,handleTranscriptDrop:Ye}=bSe({hasSelectedProject:e.hasSelectedProject,onFilesDropped:vt}),Ge=_.useCallback(()=>{if(x){if(F){L(x);return}N(x)}},[N,F,x,L]),Z=_.useCallback(Le=>{var yr;if(!x||!Y||re.current)return;const Je=Le.chat,Lt=Le.terminal;if(!Number.isFinite(Je)||!Number.isFinite(Lt))return;const Br=((yr=n.current)==null?void 0:yr.getBoundingClientRect().height)??0;if(xpe(Br,Lt)){O(x),L(x);return}G(x,[Je,Lt])},[re,x,O,G,Y,L]),Ie=_.useCallback(()=>{x&&j(x)},[x,j]),_e=_.useCallback(()=>{var Le;if(x){if(U){j(x);return}if(((Le=e.chatDiffSnapshot)==null?void 0:Le.status)==="no_repo"){(async()=>{if(!await t.confirm({title:"Initialize Git?",description:"Initialize a local git repository in this project?",confirmLabel:"Init Git",cancelLabel:"Cancel"}))return;const Lt=await xt();Lt!=null&&Lt.ok&&!U&&j(x)})();return}j(x)}},[t,xt,x,U,(di=e.chatDiffSnapshot)==null?void 0:di.status,j]),qe=_.useCallback(()=>{e.handleCancel()},[e.handleCancel]),Te=_.useCallback(Le=>{e.handleOpenExternal(Le)},[e.handleOpenExternal]),Nt=_.useCallback((Le,Je)=>{e.socket.command({type:"terminal.close",terminalId:Je}).catch(()=>{}),A(Le,Je)},[A,e.socket]),wt=_.useCallback(()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null)},[]),Jt=_.useCallback(Le=>{if(i.current!==Le){if(i.current=Le,Le){wt(),b(!1);return}wt(),s.current=window.setTimeout(()=>{b(!0),s.current=null},150)}},[wt]),Vt=_.useCallback(()=>{var Je,Lt;const Le=(Lt=(Je=r.current)==null?void 0:Je.getState)==null?void 0:Lt.call(Je);Le&&Jt(Le.isAtEnd)},[Jt]),zr=_.useCallback(async(Le=!0)=>{var Je,Lt;i.current=!0,wt(),b(!1),await((Lt=(Je=r.current)==null?void 0:Je.scrollToEnd)==null?void 0:Lt.call(Je,{animated:Le}))},[wt]),Ls=_.useCallback(async(Le,Je)=>{await zr(!1),await e.handleSend(Le,Je)},[zr,e]);_.useEffect(()=>()=>wt(),[wt]),_.useEffect(()=>{i.current=!0,wt(),b(!1)},[wt,e.activeChatId]),_.useEffect(()=>{function Le(Je){if(x){if(_h(V,"toggleEmbeddedTerminal",Je)){Je.preventDefault(),Ge();return}if(_h(V,"toggleRightSidebar",Je)){Je.preventDefault(),_e();return}if(_h(V,"openInFinder",Je)){Je.preventDefault(),e.handleOpenExternal("open_finder");return}if(_h(V,"openInEditor",Je)){Je.preventDefault(),e.handleOpenExternal("open_editor");return}_h(V,"addSplitTerminal",Je)&&(Je.preventDefault(),N(x))}}return window.addEventListener("keydown",Le),()=>window.removeEventListener("keydown",Le)},[N,Ge,_e,x,V,e.handleOpenExternal]),_.useEffect(()=>{const Le=window.requestAnimationFrame(()=>{Vt()}),Je=window.setTimeout(()=>{Vt()},op);return()=>{window.cancelAnimationFrame(Le),window.clearTimeout(Je)}},[I,Y,Vt]),_.useEffect(()=>{function Le(){Vt()}return window.addEventListener("resize",Le),()=>window.removeEventListener("resize",Le)},[Vt]),_.useEffect(()=>{if(!U||!D)return;const Le=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=Le}},[D,U]),_.useEffect(()=>{if(!U||!D)return;function Le(Je){Je.key==="Escape"&&(Je.preventDefault(),Ie())}return window.addEventListener("keydown",Le),()=>window.removeEventListener("keydown",Le)},[Ie,D,U]),_.useEffect(()=>{if(!i.current)return;let Le=null;const Je=window.requestAnimationFrame(()=>{var Lt,Br;(Br=(Lt=r.current)==null?void 0:Lt.scrollToEnd)==null||Br.call(Lt,{animated:!1}),Le=window.requestAnimationFrame(()=>{var yr,oo;(oo=(yr=r.current)==null?void 0:yr.scrollToEnd)==null||oo.call(yr,{animated:!1})})});return()=>{window.cancelAnimationFrame(Je),Le!==null&&window.cancelAnimationFrame(Le)}},[e.commandError,e.isDraining,e.isProcessing,e.messages.length,e.queuedMessages.length,e.runtimeStatus]),_.useLayoutEffect(()=>{var Lt,Br;if(!U||D||Q<=0||ze.current)return;const Le=ie(T,Q),Je=(Lt=Ue.current)==null?void 0:Lt.getLayout();Je&&(Math.abs((Je.rightSidebar??0)-Le)<.1||(Br=Ue.current)==null||Br.setLayout({workspace:100-Le,rightSidebar:Le}))},[ie,T,ze,Q,Ue,U,D]);const Tr=m.jsxs($w,{ref:o,className:"bg-background h-full flex flex-col overflow-hidden border-0 rounded-none relative",onDragEnter:Et,onDragOver:nn,onDragLeave:Re,onDrop:Ye,children:[m.jsxs(Vw,{className:"flex flex-1 min-h-0 flex-col overflow-hidden p-0 relative",children:[m.jsx($Z,{sidebarCollapsed:e.sidebarCollapsed,onOpenSidebar:e.openSidebar,onExpandSidebar:e.expandSidebar,onNewChat:e.handleCompose,localPath:e.navbarLocalPath,embeddedTerminalVisible:Y,onToggleEmbeddedTerminal:x?Ge:void 0,rightSidebarVisible:U,onToggleRightSidebar:x?_e:void 0,onOpenExternal:Te,editorLabel:e.editorLabel,finderShortcut:V.bindings.openInFinder,editorShortcut:V.bindings.openInEditor,terminalShortcut:V.bindings.toggleEmbeddedTerminal,rightSidebarShortcut:V.bindings.toggleRightSidebar,branchName:(Di=e.chatDiffSnapshot)==null?void 0:Di.branchName,hasGitRepo:((Ar=e.chatDiffSnapshot)==null?void 0:Ar.status)!=="no_repo",gitStatus:(hi=e.chatDiffSnapshot)==null?void 0:hi.status}),m.jsx(Lbe,{activeChatId:e.activeChatId,listRef:r,messages:e.messages,queuedMessages:e.queuedMessages,transcriptPaddingBottom:h,localPath:(rn=e.runtime)==null?void 0:rn.localPath,latestToolIds:e.latestToolIds,isHistoryLoading:e.isHistoryLoading,hasOlderHistory:e.hasOlderHistory,isProcessing:e.isProcessing,runtimeStatus:e.runtimeStatus,isDraining:e.isDraining,commandError:e.commandError,loadOlderHistory:e.loadOlderHistory,onStopDraining:e.handleStopDraining,onSteerQueuedMessage:e.handleSteerQueuedMessage,onRemoveQueuedMessage:e.handleRemoveQueuedMessage,onOpenLocalLink:e.handleOpenLocalLink,onAskUserQuestionSubmit:e.handleAskUserQuestion,onExitPlanModeConfirm:e.handleExitPlanMode,showScrollButton:g&&e.messages.length>0,onIsAtEndChange:Jt,scrollToBottom:()=>zr(!0),typedEmptyStateText:ot,isEmptyStateTypingComplete:St,isPageFileDragActive:ht,showEmptyState:y})]}),m.jsx(nge,{inputRef:d,onLayoutChange:f,chatInputRef:u,chatInputElementRef:l,activeChatId:e.activeChatId,previousPrompt:e.previousPrompt,hasSelectedProject:e.hasSelectedProject,runtimeStatus:e.runtimeStatus,canCancel:e.canCancel,projectId:x,activeProvider:((Ds=e.runtime)==null?void 0:Ds.provider)??null,availableProviders:e.availableProviders,contextWindowSnapshot:q,onSubmit:Ls,onCancel:qe})]}),Ni=x?m.jsx(RSe,{chatCard:Tr,projectId:x,shouldRenderTerminalLayout:I,showTerminalPane:Y,terminalLayout:C,mainPanelGroupRef:me,terminalPanelRef:we,terminalVisualRef:Ae,fixedTerminalHeight:pe,terminalFocusRequestVersion:Ee,addTerminal:N,socket:e.socket,connectionStatus:e.connectionStatus,scrollback:H,minColumnWidth:$,splitTerminalShortcut:V.bindings.addSplitTerminal,onTerminalCommandSent:lt,onRemoveTerminal:Nt,onTerminalLayout:P,onLayoutChanged:Z}):Tr,Mi=_.useMemo(()=>x?{projectId:x,diffs:e.chatDiffSnapshot??c6,editorLabel:e.editorLabel,diffRenderMode:Qt,wrapLines:Pe,onOpenFile:mt,onOpenInFinder:dt,onDiscardFile:ge,onIgnoreFile:je,onIgnoreFolder:We,onCopyFilePath:gt,onCopyRelativePath:Kt,onLoadPatch:le,onListBranches:ue,onPreviewMergeBranch:ct,onMergeBranch:At,onCheckoutBranch:Be,onCreateBranch:ke,onGenerateCommitMessage:rt,onInitializeGit:xt,onGetGitHubPublishInfo:yt,onCheckGitHubRepoAvailability:Ze,onSetupGitHub:Zt,onCommit:bt,onSyncWithRemote:$e,onDiffRenderModeChange:Ve,onWrapLinesChange:Ke,onClose:Ie}:null,[Qt,Ze,Be,Ie,bt,gt,Kt,ke,ge,rt,yt,je,We,xt,ue,le,At,mt,dt,ct,Zt,$e,x,Ve,Ke,e.chatDiffSnapshot,e.editorLabel,Pe]);return m.jsxs("div",{ref:n,className:"flex-1 flex flex-col min-w-0 relative",children:[te&&x?m.jsxs(Rk,{groupRef:Ue,orientation:"horizontal",className:"flex-1 min-h-0",onLayoutChange:Le=>{var Lt;if(!U||ze.current)return;const Je=ie(Le.rightSidebar);Math.abs(Je-Le.rightSidebar)<.1||(Lt=Ue.current)==null||Lt.setLayout({workspace:100-Je,rightSidebar:Je})},onLayoutChanged:Le=>{!U||ze.current||B(ie(Le.rightSidebar))},children:[m.jsx(Tf,{id:"workspace",defaultSize:`${100-se}%`,minSize:"20%",className:"min-h-0 min-w-0",children:Ni}),m.jsx(Tk,{withHandle:!1,orientation:"horizontal",disabled:!U,className:xe(!U&&"pointer-events-none opacity-0")}),m.jsx(kSe,{showRightSidebar:U,sizePercent:se,sidebarPanelRef:tt,sidebarVisualRef:kt,content:Mi?m.jsx(zI,{...Mi}):null})]},`${x}-right-sidebar`):Ni,D?m.jsx(ESe,{projectId:x,showRightSidebar:U,sidebarVisualRef:kt,onClose:Ie,content:Mi?m.jsx(zI,{...Mi}):null}):null]})}function BI({narrow:e=!1,title:t,subtitle:n,icon:r=Mw}){return m.jsxs("div",{className:xe("w-full",e?"max-w-2xl px-6 pt-16 mx-auto":"px-6 pt-16 mb-10"),children:[m.jsxs("div",{className:xe("flex items-center gap-1 mb-2",e&&"justify-center"),children:[m.jsx("div",{className:"p-2 pl-0 rounded-lg",children:m.jsx(r,{className:"h-6 w-6 text-muted-foreground"})}),m.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:t})]}),n&&m.jsx("p",{className:xe("text-muted-foreground",e&&"mb-10 text-center"),children:n})]})}function ASe(e){return e.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function NSe({open:e,onOpenChange:t,onConfirm:n}){const[r,i]=_.useState("new"),[s,o]=_.useState(""),[l,u]=_.useState(""),d=_.useRef(null),f=_.useRef(null);_.useEffect(()=>{e&&(i("new"),o(""),u(""),setTimeout(()=>{var w;return(w=d.current)==null?void 0:w.focus()},0))},[e]),_.useEffect(()=>{e&&setTimeout(()=>{var w,C;r==="new"?(w=d.current)==null||w.focus():(C=f.current)==null||C.focus()},0)},[r,e]);const h=ASe(s),g=h?`${MK}/${h}`:"",b=l.trim(),y=r==="new"?!!h:!!b,x=()=>{if(y){if(r==="new")n({mode:"new",localPath:g,title:s.trim()});else{const w=b.split("/").pop()||b;n({mode:"existing",localPath:b,title:w})}t(!1)}};return m.jsx(od,{open:e,onOpenChange:t,children:m.jsxs(uc,{size:"sm",children:[m.jsxs(ld,{className:"space-y-4",children:[m.jsx(ad,{children:"Add Project"}),m.jsx(G0,{value:r,onValueChange:i,options:[{value:"new",label:"New Folder"},{value:"existing",label:"Existing Path"}],className:"w-full mb-2",optionClassName:"flex-1 justify-center"}),r==="new"?m.jsxs("div",{className:"space-y-2",children:[m.jsx(Wr,{ref:d,type:"text",value:s,onChange:w=>o(w.target.value),onKeyDown:w=>{w.key==="Enter"&&x(),w.key==="Escape"&&t(!1)},placeholder:"Project name"}),g&&m.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:g})]}):m.jsxs("div",{className:"space-y-2",children:[m.jsx(Wr,{ref:f,type:"text",value:l,onChange:w=>u(w.target.value),onKeyDown:w=>{w.key==="Enter"&&x(),w.key==="Escape"&&t(!1)},placeholder:"~/Projects/my-app"}),m.jsx("p",{className:"text-xs text-muted-foreground",children:"The folder will be created if it doesn't exist."})]})]}),m.jsxs(cd,{children:[m.jsx(st,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),m.jsx(st,{variant:"secondary",size:"sm",onClick:x,disabled:!y,children:"Create"})]})]})})}function MSe({text:e}){const[t,n]=_.useState(!1);async function r(){await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}return m.jsx(st,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>void r(),children:t?m.jsx(ls,{className:"h-4 w-4 text-green-400"}):m.jsx(Kl,{className:"h-4 w-4"})})}function FI({children:e}){return m.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center group bg-background border border-border text-foreground rounded-xl p-1.5 pl-3 font-mono text-sm",children:[m.jsxs("pre",{className:"inline-flex items-center gap-2 overflow-x-auto",children:[m.jsx(Fo,{className:"inline h-4 w-4 opacity-40"}),m.jsx("code",{children:e})]}),m.jsx(MSe,{text:e})]})}function yg({children:e}){return m.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:e})}function oS({children:e}){return m.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider mb-3",children:e})}function aS({icon:e,title:t,subtitle:n,iconClassName:r}){return m.jsxs("div",{className:"flex flex-col items-center gap-0",children:[m.jsx("div",{className:"p-3 mb-2 rounded-xl bg-background border border-border",children:m.jsx(e,{className:r||"h-8 w-8 text-muted-foreground"})}),m.jsx("span",{className:"text-sm font-medium",children:t}),m.jsx("span",{className:"text-xs text-muted-foreground",children:n})]})}function HI(){return m.jsx(y$,{className:"h-4 w-4 text-muted-foreground"})}function $I({number:e,title:t,children:n}){return m.jsx("div",{className:"flex gap-4",children:m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-baseline gap-3",children:[m.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center font-medium text-logo",children:[e,"."]}),m.jsx("h3",{className:"font-medium text-foreground mb-2",children:t})]}),m.jsx("div",{className:"text-muted-foreground text-sm space-y-3",children:n})]})})}function LSe({localPath:e,loading:t,onClick:n}){return m.jsxs(Qa,{children:[m.jsx(Za,{asChild:!0,children:m.jsxs("button",{className:xe("border border-border hover:border-primary/30 group rounded-lg bg-card px-4 py-3 flex items-center gap-3 w-full text-left hover:bg-muted/50 transition-colors",t&&"opacity-50 cursor-not-allowed"),disabled:t,onClick:n,children:[m.jsx(O9,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),m.jsx("span",{className:"font-medium text-foreground truncate flex-1",children:p5(e)}),t?m.jsx(kn,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary animate-spin flex-shrink-0"}):m.jsx(Lw,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]})}),m.jsx(Uo,{children:m.jsx("p",{children:e})})]})}function DSe({connectionStatus:e,ready:t,snapshot:n,startingLocalPath:r,commandError:i,newProjectOpen:s,onNewProjectOpenChange:o,onOpenProject:l,onCreateProject:u}){const d=_.useMemo(()=>(n==null?void 0:n.projects)??[],[n==null?void 0:n.projects]),f=e==="connecting"||!t,h=e==="connected"&&t;return m.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-y-auto",children:[h?m.jsxs(m.Fragment,{children:[m.jsx(BI,{title:(n==null?void 0:n.machine.displayName)??"Local Projects",subtitle:`${Un} is connected, choose a project below to get started.`}),m.jsxs("div",{className:"w-full px-6 mb-10",children:[m.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[m.jsx("h2",{className:"text-[13px] font-medium text-muted-foreground uppercase tracking-wider",children:"Projects"}),m.jsxs(st,{variant:"default",size:"sm",onClick:()=>o(!0),children:[m.jsx(Zg,{className:"h-4 w-4 mr-1.5"}),"Add Project"]})]}),d.length>0?m.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-4 3xl:grid-cols-5 gap-2",children:d.map(g=>m.jsx(LSe,{localPath:g.localPath,loading:r===g.localPath,onClick:()=>{l(g.localPath)}},g.localPath))}):m.jsx(yg,{children:m.jsx("p",{className:"text-sm text-muted-foreground",children:"No local projects discovered yet. Open one with Claude or Codex, or create a new project here."})}),i?m.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3 mt-4",children:i}):null]})]}):m.jsxs(m.Fragment,{children:[m.jsx(BI,{narrow:!0,icon:iA,title:f?`Connecting ${Un}`:`Connect ${Un}`,subtitle:f?`${Un} is starting up and loading your local projects.`:`Run ${Un} directly on your machine with full access to your local files and agent project history.`}),m.jsxs("div",{className:"max-w-2xl w-full mx-auto pb-12 px-6",children:[m.jsx(oS,{children:"Status"}),m.jsx("div",{className:"mb-8",children:m.jsx(yg,{children:m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(kn,{className:"h-4 w-4 text-muted-foreground animate-spin"}),m.jsx("span",{className:"text-sm text-muted-foreground",children:f?`Connecting to your local ${Un} server...`:m.jsxs(m.Fragment,{children:["Not connected. Run ",m.jsx("code",{className:"bg-background border border-border rounded-md mx-0.5 p-1 font-mono text-xs text-foreground",children:Dm()})," from any terminal on this machine."]})})]})})}),f?null:m.jsxs("div",{className:"mb-10",children:[m.jsx(oS,{children:"How it works"}),m.jsx(yg,{children:m.jsxs("div",{className:"flex items-center justify-around gap-6 py-4 px-2",children:[m.jsx(aS,{icon:Dw,title:`${Un} CLI`,subtitle:"On Your Machine"}),m.jsx(HI,{}),m.jsx(aS,{icon:Mw,title:`${Un} Server`,subtitle:"Local WebSocket"}),m.jsx(HI,{}),m.jsx(aS,{icon:iA,title:`${Un} UI`,subtitle:"Project Chat"})]})})]}),f?null:m.jsxs("div",{className:"mb-10",children:[m.jsx(oS,{children:"Setup"}),m.jsx(yg,{children:m.jsxs("div",{className:"space-y-4",children:[m.jsxs($I,{number:1,title:`Start ${Un}`,children:[m.jsx("p",{children:"Run this command in your terminal:"}),m.jsx(FI,{children:Dm()})]}),m.jsxs($I,{number:2,title:"Open the local UI",children:[m.jsxs("p",{children:[Un," serves the app locally and opens the Local Projects page in an app-style browser window."]}),m.jsx(FI,{children:"http://localhost:3210/local"})]}),m.jsxs("div",{className:"mt-8",children:[m.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-4",children:"Notes"}),m.jsxs("div",{className:"space-y-3 text-sm",children:[m.jsxs("div",{className:"flex gap-4",children:[m.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:Dm("").trim()}),m.jsx("span",{className:"text-muted-foreground",children:"Start in the current directory"})]}),m.jsxs("div",{className:"flex gap-4",children:[m.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:Dm("--no-open")}),m.jsx("span",{className:"text-muted-foreground",children:"Start the server without opening the browser"})]})]})]})]})})]})]})]}),m.jsx(NSe,{open:s,onOpenChange:o,onConfirm:g=>{u(g)}}),m.jsx("div",{className:"py-4 text-center",children:m.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v",nC.split("/")[1]]})})]})}function ISe(){const e=kw();return m.jsx("div",{className:"flex-1 flex flex-col min-w-0 relative",children:m.jsx(DSe,{connectionStatus:e.connectionStatus,ready:e.localProjectsReady,snapshot:e.localProjects,startingLocalPath:e.startingLocalPath,commandError:e.commandError,newProjectOpen:e.addProjectModalOpen,onNewProjectOpenChange:t=>{if(t){e.openAddProjectModal();return}e.closeAddProjectModal()},onOpenProject:e.handleOpenLocalProject,onCreateProject:e.handleCreateProject})})}function Yv({children:e,className:t,icon:n,type:r="button",variant:i="outline",...s}){return m.jsxs("button",{type:r,className:xe(i0({variant:i,size:"sm"}),"h-auto gap-1.5 px-3 py-1.5",t),...s,children:[n,m.jsx("span",{children:e})]})}const qh=[{id:"general",label:"General",icon:HU,subtitle:"Manage appearance, editor behavior, and embedded terminal defaults."},{id:"providers",label:"Providers",icon:cU,subtitle:"Manage the default chat provider and saved model defaults for Claude Code and Codex."},{id:"keybindings",label:"Keybindings",icon:Z$,subtitle:"Edit global app shortcuts stored in the active keybindings file."},{id:"changelog",label:"Changelog",icon:E$,subtitle:"Release notes pulled from the public GitHub releases feed."}];function UI(e){return e&&qh.some(t=>t.id===e)?e:null}const PSe=[{value:"light",label:"Light",icon:eV},{value:"dark",label:"Dark",icon:mU},{value:"system",label:"System",icon:Mw}],OSe=[{value:"cursor",label:"Cursor"},{value:"vscode",label:"VS Code"},{value:"windsurf",label:"Windsurf"},{value:"custom",label:"Custom"}],jSe=[{value:"never",label:"Never"},{value:"unfocused",label:"When Unfocused"},{value:"always",label:"Always"}],zSe=[{value:"openai",label:"OpenAI"},{value:"openrouter",label:"OpenRouter"},{value:"custom",label:"Custom"}],BSe="https://api.github.com/repos/jakemor/kanna/releases",FSe=300*1e3;let Ru=null;const VI=Object.keys(C3);function HSe(e){return`Edit global app shortcuts stored in ${e}.`}function WI(e,t){return e!==t}async function $Se(e=fetch){const t=await e(BSe,{headers:{Accept:"application/vnd.github+json"}});if(!t.ok)throw new Error(`GitHub releases request failed with status ${t.status}`);return(await t.json()).filter(r=>!r.draft)}function USe(){return Ru?Date.now()>=Ru.expiresAt?(Ru=null,null):Ru.releases:null}function VSe(e){Ru={releases:e,expiresAt:Date.now()+FSe}}async function GI(e){const t=e!=null&&e.force?null:USe();if(t)return t;const n=await $Se(e==null?void 0:e.fetchImpl);return VSe(n),n}function WSe(e){if(!e)return"Unpublished";const t=new Date(e);return Number.isNaN(t.getTime())?"Unknown date":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(t)}function GSe({status:e,releases:t,error:n,onRetry:r,updateSnapshot:i,currentVersion:s,onInstallUpdate:o,onCheckForUpdates:l}){var x;const u=(i==null?void 0:i.latestVersion)??((x=t[0])==null?void 0:x.tag_name)??"Unknown",d=(i==null?void 0:i.currentVersion)??s,f=(i==null?void 0:i.status)==="checking",h=(i==null?void 0:i.status)==="updating"||(i==null?void 0:i.status)==="restart_pending",g=(i==null?void 0:i.updateAvailable)===!0,b=u.replace(/^v/i,""),y=d.replace(/^v/i,"");return m.jsxs("div",{className:"space-y-4",children:[e==="loading"||e==="idle"?m.jsx("div",{className:"flex min-h-[180px] items-center justify-center rounded-2xl border border-border bg-card/40 px-6 py-8 text-sm text-muted-foreground",children:m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(kn,{className:"h-4 w-4 animate-spin"}),m.jsx("span",{children:"Loading release notes…"})]})}):null,e==="error"?m.jsx("div",{className:"rounded-lg border border-destructive/20 bg-destructive/5 px-6 py-5",children:m.jsxs("div",{className:"flex items-start justify-between gap-4",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-sm font-medium text-foreground",children:"Could not load changelog"}),m.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:n??"Unable to load changelog."})]}),m.jsx("button",{type:"button",onClick:r,className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground transition-colors hover:bg-muted",children:"Retry"})]})}):null,e==="success"&&t.length===0?m.jsxs("div",{className:"rounded-lg border border-border bg-card/30 px-6 py-8",children:[m.jsx("div",{className:"text-sm font-medium text-foreground",children:"No releases yet"}),m.jsx("div",{className:"mt-2 text-sm text-muted-foreground",children:"GitHub did not return any published releases for this repository."})]}):null,!g&&e==="success"?m.jsx("div",{className:"flex justify-end",children:m.jsx(Yv,{variant:"outline",onClick:l,disabled:f||h,children:f?"Checking…":"Check for updates"})}):null,e==="success"&&t.length>0?t.map(w=>{var T,N;const C=w.tag_name.replace(/^v/i,""),R=C===b,E=C===y;return m.jsxs("article",{className:xe("rounded-xl border bg-card/30 pl-6 pr-4 py-4",R?"border-border bg-muted":"border-border"),children:[m.jsxs("div",{className:"flex flex-row items-center min-w-0 flex-1 gap-3 ",children:[m.jsxs("div",{className:"flex flex-row items-center min-w-0 flex-1 gap-2 ",children:[m.jsx("div",{className:"text-lg font-semibold tracking-[-0.2px] text-foreground",children:((T=w.name)==null?void 0:T.trim())||w.tag_name}),m.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[m.jsx("span",{children:WSe(w.published_at)}),w.prerelease?m.jsx("span",{className:"rounded-full border border-border px-2.5 py-1 uppercase tracking-wide",children:"Prerelease"}):null]})]}),m.jsxs("div",{className:"flex flex-row items-center justify-end min-w-0 flex-1 gap-2 ",children:[m.jsx("a",{href:w.html_url,target:"_blank",rel:"noopener noreferrer","aria-label":"View release on GitHub",className:xe(i0({variant:"ghost",size:"icon-sm"}),"h-8 w-8 shrink-0 rounded-md hover:!bg-transparent hover:border-border/0"),children:m.jsx(qSe,{className:"h-4 w-4"})}),E?m.jsx("span",{className:xe("bg-transparent border border-border text-secondary-foreground","h-9 rounded-full px-3 text-sm","h-auto gap-1.5 px-3 py-1.5"),children:"Current"}):null,R&&g?m.jsx(Yv,{variant:"default",className:"",onClick:o,disabled:h,children:m.jsxs("div",{className:"flex flex-row items-center justify-center gap-2",children:[m.jsx(G$,{className:"size-4"}),h?"Updating…":"Update"]})}):null]})]}),(N=w.body)!=null&&N.trim()?m.jsx("div",{className:"prose prose-sm mt-5 max-w-none text-foreground dark:prose-invert",children:m.jsx(gc,{remarkPlugins:[vc],components:fk,children:w.body})}):m.jsx("div",{className:"mt-5 text-sm text-muted-foreground",children:"No release notes were provided."})]},w.id)}):null]})}function qSe({className:e}){return m.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:m.jsx("path",{d:"M12 .5C5.649.5.5 5.649.5 12A11.5 11.5 0 0 0 8.36 22.04c.575.106.785-.25.785-.556 0-.274-.01-1-.015-1.962-3.181.691-3.853-1.532-3.853-1.532-.52-1.322-1.27-1.674-1.27-1.674-1.038-.71.08-.695.08-.695 1.148.08 1.752 1.178 1.752 1.178 1.02 1.748 2.676 1.243 3.328.95.103-.738.399-1.243.725-1.53-2.54-.289-5.211-1.27-5.211-5.65 0-1.248.446-2.27 1.177-3.07-.118-.288-.51-1.45.112-3.024 0 0 .96-.307 3.145 1.173A10.91 10.91 0 0 1 12 6.03c.973.004 1.954.132 2.87.387 2.182-1.48 3.14-1.173 3.14-1.173.625 1.573.233 2.736.115 3.024.734.8 1.175 1.822 1.175 3.07 0 4.39-2.676 5.358-5.224 5.642.41.353.776 1.05.776 2.117 0 1.528-.014 2.761-.014 3.136 0 .309.207.668.79.555A11.502 11.502 0 0 0 23.5 12C23.5 5.649 18.351.5 12 .5Z"})})}function Yi({title:e,description:t,children:n,bordered:r=!0,alignStart:i=!1}){return m.jsx("div",{className:r?"border-t border-border":void 0,children:m.jsxs("div",{className:xe("flex flex-col gap-4 py-5 md:flex-row md:justify-between md:gap-8",i?"md:items-start":"md:items-center"),children:[m.jsxs("div",{className:"min-w-0 max-w-xl",children:[m.jsx("div",{className:"text-sm font-medium text-foreground",children:e}),m.jsx("div",{className:"mt-1 text-[13px] text-muted-foreground",children:t})]}),m.jsx("div",{className:"flex items-center justify-start md:shrink-0 md:justify-end",children:n})]})})}function KSe(){var Ye,Ge;const e=rd(),{sectionId:t}=hP(),n=kw(),{theme:r,setTheme:i}=sB(),[s,o]=_.useState("idle"),[l,u]=_.useState(!1),[d,f]=_.useState(!1),[h,g]=_.useState([]),[b,y]=_.useState(null),x=UI(t)??"general",w=n.connectionStatus==="connecting"||!n.localProjectsReady,C=((Ye=n.localProjects)==null?void 0:Ye.machine.displayName)??"Unavailable",R=((Ge=n.localProjects)==null?void 0:Ge.projects.length)??0,E=nC.split("/")[1]??"unknown",T=Zi(Z=>Z.scrollbackLines),N=Zi(Z=>Z.minColumnWidth),A=Zi(Z=>Z.editorPreset),L=Zi(Z=>Z.editorCommandTemplate),O=Zi(Z=>Z.setScrollbackLines),G=Zi(Z=>Z.setMinColumnWidth),P=Zi(Z=>Z.setEditorPreset),j=Zi(Z=>Z.setEditorCommandTemplate),B=wu(Z=>Z.chatSoundPreference),H=wu(Z=>Z.chatSoundId),$=wu(Z=>Z.setChatSoundPreference),V=wu(Z=>Z.setChatSoundId),z=n.keybindings,q=n.llmProvider,F=ki(Z=>Z.defaultProvider),Y=ki(Z=>Z.providerDefaults),I=ki(Z=>Z.setDefaultProvider),U=ki(Z=>Z.setProviderDefaultModel),X=ki(Z=>Z.setProviderDefaultModelOptions),D=ki(Z=>Z.setProviderDefaultPlanMode),te=_.useMemo(()=>TC(z),[z]),Q=te.filePathDisplay||PK(),[ie,se]=_.useState(String(T)),[pe,re]=_.useState(String(N)),[me,Ee]=_.useState(L),[we,Ae]=_.useState({}),[ze,Ue]=_.useState(null),[tt,kt]=_.useState({provider:"openai",apiKey:"",model:"",baseUrl:""}),[Qt,Pe]=_.useState(null),[Ve,Ke]=_.useState("idle"),[lt,mt]=_.useState(null),[gt,Kt]=_.useState(!1),le=n.updateSnapshot,ge=n.handleReadLlmProvider,je=n.handleWriteLlmProvider,We=n.handleValidateLlmProvider,dt=(le==null?void 0:le.status)==="checking"?"Checking for updates…":(le==null?void 0:le.status)==="updating"?"Installing update…":(le==null?void 0:le.status)==="restart_pending"?"Restarting Kanna…":(le==null?void 0:le.status)==="available"?`Update available${le.latestVersion?`: ${le.latestVersion}`:""}`:(le==null?void 0:le.status)==="up_to_date"?"Up to date":(le==null?void 0:le.status)==="error"?"Update check failed":"Not checked yet";_.useEffect(()=>{se(String(T))},[T]),_.useEffect(()=>{re(String(N))},[N]),_.useEffect(()=>{Ee(L)},[L]),_.useEffect(()=>{Ae(Object.fromEntries(VI.map(Z=>[Z,zy(te.bindings[Z])])))},[te]),_.useEffect(()=>{q&&kt({provider:q.provider,apiKey:q.apiKey,model:q.model,baseUrl:q.baseUrl})},[q]),_.useEffect(()=>{Ke("idle"),mt(null)},[tt.provider,tt.apiKey,tt.model,tt.baseUrl]),_.useEffect(()=>{t&&(UI(t)||e("/settings/general",{replace:!0}))},[e,t]),_.useEffect(()=>{let Z=!1;return fetch("/auth/status",{method:"GET",cache:"no-store",headers:{Accept:"application/json"}}).then(async Ie=>Ie.ok?await Ie.json():{enabled:!1}).then(Ie=>{Z||f(Ie.enabled===!0)}).catch(()=>{Z||f(!1)}),()=>{Z=!0}},[]),_.useEffect(()=>{x!=="providers"||w||ge()},[ge,w,x]),_.useEffect(()=>{if(x!=="changelog"||w)return;let Z=!1;return o("loading"),y(null),GI().then(Ie=>{Z||(g(Ie),o("success"))}).catch(Ie=>{Z||(y(Ie instanceof Error?Ie.message:"Unable to load changelog."),o("error"))}),()=>{Z=!0}},[w,x]);function bt(){const Z=Number(ie);if(!Number.isFinite(Z)){se(String(T));return}O(Z)}function $e(){const Z=Number(pe);if(!Number.isFinite(Z)){re(String(N));return}G(Z)}function rt(Z,Ie){Z.key==="Enter"&&(Ie(),Z.currentTarget.blur())}function xt(Z,Ie){Z.key==="Enter"&&(Ie(),Z.currentTarget.blur())}function yt(){j(me)}function Ze(Z){WI(B,Z)&&($(Z),SS(H,1).catch(()=>{}))}function Zt(Z){WI(H,Z)&&(V(Z),SS(Z,1).catch(()=>{}))}async function ue(){try{Ue(null),await n.socket.command({type:"settings.writeKeybindings",bindings:qI(we)})}catch(Z){Ue(Z instanceof Error?Z.message:"Unable to save keybindings.")}}async function Be(Z){const Ie={...we,[Z]:zy(_s[Z])};Ae(Ie);try{Ue(null),await n.socket.command({type:"settings.writeKeybindings",bindings:qI(Ie)})}catch(_e){Ue(_e instanceof Error?_e.message:"Unable to save keybindings.")}}async function ct(Z=tt){try{Pe(null),await je(Z);const Ie=await We(Z);Ke(Ie.ok?"valid":"invalid"),mt(Ie.error)}catch(Ie){const _e=Ie instanceof Error?{name:Ie.name,message:Ie.message}:Ie;Ke("invalid"),mt(_e),Pe(Ie instanceof Error?Ie.message:"Unable to save quick response provider settings.")}}function At(Z){const Ie={...tt,provider:Z,model:Z==="openai"?SZ:Z==="openrouter"?wZ:tt.model,baseUrl:Z==="custom"?tt.baseUrl:""};kt(Ie),ct(Ie)}function ke(){Ru=null,o("loading"),y(null),GI({force:!0}).then(Z=>{g(Z),o("success")}).catch(Z=>{y(Z instanceof Error?Z.message:"Unable to load changelog."),o("error")})}const ot=me.replaceAll("{path}","/Users/jake/Projects/kanna/src/client/app/App.tsx").replaceAll("{line}","12").replaceAll("{column}","1"),St=qh.find(Z=>Z.id===x)??qh[0],vt=x==="keybindings"?HSe(Q):St.subtitle,ht=!w,Et=lt?JSON.stringify(lt,null,2):"",nn=m.jsxs(m.Fragment,{children:[m.jsxs("span",{children:["Use an OpenAI-compatible API for title and commit message generation before Claude and Codex. Stored in ",(q==null?void 0:q.filePathDisplay)??"the active llm-provider.json file","."]}),m.jsx("span",{className:xe("mt-2 block text-sm font-medium",Ve==="valid"?"text-emerald-600 dark:text-emerald-400":Ve==="invalid"?"text-destructive":"hidden"),children:Ve==="valid"?"Credentials valid & saved":Ve==="invalid"?m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"Credentials invalid."}),lt?m.jsxs(m.Fragment,{children:[" ",m.jsx("button",{type:"button",onClick:()=>Kt(!0),className:"underline underline-offset-2",children:"See error"})]}):null]}):null})]});async function Re(){if(!l){u(!0);try{await n.handleSignOut()}finally{u(!1)}}}return m.jsxs("div",{className:"relative flex h-full flex-1 min-w-0 bg-background",children:[m.jsxs("div",{className:"flex min-w-0 flex-1",children:[m.jsx("aside",{className:`hidden w-[200px] shrink-0 md:block ${ht?"pb-[89px]":""}`,children:m.jsxs("div",{className:"flex flex-col gap-1 px-4 py-6",children:[m.jsx("div",{className:"px-3 pb-5 text-[22px] font-extrabold tracking-[-0.5px] text-foreground",children:"Settings"}),qh.map(Z=>m.jsx("button",{type:"button",onClick:()=>e(`/settings/${Z.id}`),className:`cursor-pointer rounded-lg px-3 py-2 text-sm ${Z.id===x?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:m.jsxs("div",{className:"flex items-center gap-2.5",children:[m.jsx(Z.icon,{className:"h-4 w-4 shrink-0"}),m.jsx("span",{children:Z.label})]})},Z.label)),d?m.jsx("button",{type:"button",onClick:()=>{Re()},disabled:l,className:"cursor-pointer rounded-lg px-3 py-2 text-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:m.jsxs("div",{className:"flex items-center gap-2.5",children:[m.jsx(oA,{className:"h-4 w-4 shrink-0"}),m.jsx("span",{children:l?"Signing out...":"Sign out"})]})}):null]})}),m.jsxs("div",{className:"min-w-0 flex-1 overflow-y-auto",children:[m.jsx("div",{className:"border-b border-border py-2 md:hidden",children:m.jsx("div",{className:"overflow-x-auto pr-4 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:m.jsxs("div",{className:"flex min-w-max items-center gap-2",children:[m.jsx("div",{className:" sticky left-0 bg-gradient-to-r from-background via-background/80 to-transparent px-2 py-1",children:m.jsx("button",{type:"button",onClick:n.openSidebar,className:"flex shrink-0 items-center p-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground","aria-label":"Open sidebar",title:"Open sidebar",children:m.jsx(Nw,{className:"h-4 w-4 shrink-0"})})}),qh.map(Z=>m.jsxs("button",{type:"button",onClick:()=>e(`/settings/${Z.id}`),className:xe("flex shrink-0 items-center gap-2 rounded-full border px-3 py-2 text-sm transition-colors",Z.id===x?"border-transparent bg-muted font-medium text-foreground":"border-border bg-background text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[m.jsx(Z.icon,{className:"h-4 w-4 shrink-0"}),m.jsx("span",{className:"whitespace-nowrap",children:Z.label})]},Z.label)),d?m.jsxs("button",{type:"button",onClick:()=>{Re()},disabled:l,className:xe("flex shrink-0 items-center gap-2 rounded-full border px-3 py-2 text-sm transition-colors","border-border bg-background text-muted-foreground hover:bg-muted/50 hover:text-foreground","disabled:cursor-not-allowed disabled:opacity-50"),children:[m.jsx(oA,{className:"h-4 w-4 shrink-0"}),m.jsx("span",{className:"whitespace-nowrap",children:l?"Signing out...":"Sign out"})]}):null]})})}),m.jsxs("div",{className:"w-full px-4 pb-32 pt-8 md:px-6 md:pt-16",children:[w?m.jsx("div",{className:"flex min-h-[240px] items-center justify-center rounded-2xl border border-border bg-card/40 px-4 py-6 text-sm text-muted-foreground",children:m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(kn,{className:"h-4 w-4 animate-spin"}),m.jsx("span",{children:"Loading machine settings…"})]})}):m.jsxs("div",{className:"mx-auto max-w-4xl",children:[m.jsxs("div",{className:"pb-6",children:[m.jsxs("div",{className:"flex items-center justify-between gap-4 min-h-[34px]",children:[m.jsx("div",{className:"text-lg font-semibold tracking-[-0.2px] text-foreground",children:St.label}),x==="general"?m.jsx(Yv,{variant:"outline",onClick:()=>e("/settings/changelog"),children:"Check for updates"}):null,x==="keybindings"?m.jsxs(Yv,{onClick:()=>{n.handleOpenExternalPath("open_editor",Q)},icon:m.jsx(t0,{className:"h-4 w-4"}),children:["Open in ",n.editorLabel]}):null]}),m.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:vt})]}),x==="general"?m.jsx(m.Fragment,{children:m.jsxs("div",{className:"border-b border-border",children:[m.jsx(Yi,{title:"Application Update",description:m.jsxs(m.Fragment,{children:[m.jsxs("span",{children:[dt,"."]}),le!=null&&le.lastCheckedAt?m.jsxs("span",{children:[" Last checked ",new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(le.lastCheckedAt),"."]}):null,le!=null&&le.error?m.jsxs("span",{children:[" ",le.error]}):null]}),bordered:!1,children:m.jsxs("div",{className:"text-right text-sm text-foreground",children:[m.jsxs("div",{children:["Current: ",(le==null?void 0:le.currentVersion)??E]}),m.jsxs("div",{className:"text-xs text-muted-foreground",children:["Latest: ",(le==null?void 0:le.latestVersion)??"Unknown"]})]})}),m.jsx(Yi,{title:"Theme",description:"Choose between light, dark, or system appearance",children:m.jsx(G0,{value:r,onValueChange:i,options:PSe,size:"sm"})}),m.jsx(Yi,{title:"Chat Sounds",description:"Play a pop when a chat starts waiting on you or the unread chat count increases",children:m.jsxs(Ol,{value:B,onValueChange:Z=>Ze(Z),children:[m.jsx(Ba,{className:"min-w-[180px]",children:m.jsx(jl,{})}),m.jsx(Fa,{children:m.jsx(Rh,{children:jSe.map(Z=>m.jsx(qs,{value:Z.value,children:Z.label},Z.value))})})]})}),m.jsx(Yi,{title:"Chat Sound",description:"The bundled sound used for chat notification playback and previews",children:m.jsxs(Ol,{value:H,onValueChange:Z=>Zt(Z),children:[m.jsx(Ba,{className:"min-w-[180px]",children:m.jsx(jl,{})}),m.jsx(Fa,{children:m.jsx(Rh,{children:$K.map(Z=>m.jsx(qs,{value:Z.value,children:Z.label},Z.value))})})]})}),m.jsx(Yi,{title:"Default Editor",description:"Used by the navbar code button and local file links in chat",alignStart:!0,children:m.jsxs(Ol,{value:A,onValueChange:Z=>P(Z),children:[m.jsx(Ba,{className:"min-w-[180px]",children:m.jsx(jl,{})}),m.jsx(Fa,{children:m.jsx(Rh,{children:OSe.map(Z=>m.jsx(qs,{value:Z.value,children:Z.label},Z.value))})})]})}),A==="custom"?m.jsx("div",{className:"border-t border-border",children:m.jsxs("div",{className:"flex justify-between gap-8 py-5 pl-6",children:[m.jsxs("div",{className:"min-w-0 max-w-xl",children:[m.jsx("div",{className:"text-sm font-medium text-foreground",children:"Command Template"}),m.jsxs("div",{className:"mt-1 text-[13px] text-muted-foreground",children:["Include ","{path}"," and optionally ","{line}"," and ","{column}"," in your command."]})]}),m.jsxs("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:[m.jsx(Wr,{type:"text",value:me,onChange:Z=>Ee(Z.target.value),onBlur:yt,onKeyDown:Z=>xt(Z,yt),className:"font-mono"}),m.jsxs("div",{className:"text-xs text-muted-foreground",children:["Preview: ",m.jsx("span",{className:"font-mono",children:ot})]})]})]})}):null,m.jsx(Yi,{title:"Terminal Scrollback",description:"Lines retained for embedded terminal history",children:m.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[m.jsx(Wr,{type:"number",min:C1,max:k1,step:100,value:ie,onChange:Z=>se(Z.target.value),onBlur:bt,onKeyDown:Z=>rt(Z,bt),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),m.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[C1,"-",k1," lines",T===Pv?" (default)":""]})]})}),m.jsx(Yi,{title:"Terminal Min Column Width",description:"Minimum width for each terminal pane",children:m.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[m.jsx(Wr,{type:"number",min:E1,max:R1,step:10,value:pe,onChange:Z=>re(Z.target.value),onBlur:$e,onKeyDown:Z=>rt(Z,$e),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),m.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[E1,"-",R1," px",N===Ov?" (default)":""]})]})})]})}):x==="providers"?m.jsxs("div",{className:"border-b border-border",children:[m.jsx(Yi,{title:"Default Provider",description:"The default harness used for new chats before a provider is locked by an existing session.",bordered:!1,children:m.jsxs(Ol,{value:F,onValueChange:Z=>I(Z),children:[m.jsx(Ba,{className:"min-w-[180px]",children:m.jsx(jl,{})}),m.jsx(Fa,{children:m.jsxs(Rh,{children:[m.jsx(qs,{value:"last_used",children:"Last Used"}),Zh.map(Z=>m.jsx(qs,{value:Z.id,children:Z.label},Z.id))]})})]})}),m.jsx(Yi,{title:"Claude Code Defaults",description:"Saved defaults when using Claude Code.",alignStart:!0,children:m.jsx("div",{className:"max-w-[420px]",children:m.jsx(L1,{availableProviders:Zh,selectedProvider:"claude",showProviderPicker:!1,providerLocked:!0,model:Y.claude.model,modelOptions:Y.claude.modelOptions,onModelChange:(Z,Ie)=>{U("claude",Ie)},onModelOptionChange:Z=>{Z.type==="claudeReasoningEffort"?X("claude",{reasoningEffort:Z.effort}):Z.type==="contextWindow"&&X("claude",{contextWindow:Z.contextWindow})},planMode:Y.claude.planMode,onPlanModeChange:Z=>D("claude",Z),includePlanMode:!0,className:"justify-start flex-wrap"})})}),m.jsx(Yi,{title:"Codex Defaults",description:"Saved defaults when using Codex.",alignStart:!0,children:m.jsx("div",{className:"max-w-[420px]",children:m.jsx(L1,{availableProviders:Zh,selectedProvider:"codex",showProviderPicker:!1,providerLocked:!0,model:Y.codex.model,modelOptions:Y.codex.modelOptions,onModelChange:(Z,Ie)=>{U("codex",Ie)},onModelOptionChange:Z=>{Z.type==="codexReasoningEffort"?X("codex",{reasoningEffort:Z.effort}):Z.type==="fastMode"&&X("codex",{fastMode:Z.fastMode})},planMode:Y.codex.planMode,onPlanModeChange:Z=>D("codex",Z),includePlanMode:!0,className:"justify-start flex-wrap"})})}),m.jsx(Yi,{title:"Quick Response SDK",description:nn,alignStart:!0,children:m.jsxs("div",{className:"flex w-full max-w-[420px] flex-col gap-3",children:[Qt?m.jsx("div",{className:"rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:Qt}):null,q!=null&&q.warning?m.jsx("div",{className:"rounded-lg border border-border bg-card/30 px-4 py-3 text-sm text-muted-foreground",children:q.warning}):null,m.jsxs(Ol,{value:tt.provider,onValueChange:Z=>At(Z),children:[m.jsx(Ba,{className:"w-full",children:m.jsx(jl,{})}),m.jsx(Fa,{children:m.jsx(Rh,{children:zSe.map(Z=>m.jsx(qs,{value:Z.value,children:Z.label},Z.value))})})]}),tt.provider==="custom"?m.jsx(Wr,{value:tt.baseUrl,onChange:Z=>kt(Ie=>({...Ie,baseUrl:Z.target.value})),onBlur:()=>void ct(),onKeyDown:Z=>xt(Z,()=>void ct()),placeholder:"https://your-provider.example/v1"}):null,m.jsx(Wr,{type:"password",value:tt.apiKey,onChange:Z=>kt(Ie=>({...Ie,apiKey:Z.target.value})),onBlur:()=>void ct(),onKeyDown:Z=>xt(Z,()=>void ct()),placeholder:"API key"}),m.jsx(Wr,{value:tt.model,onChange:Z=>kt(Ie=>({...Ie,model:Z.target.value})),onBlur:()=>void ct(),onKeyDown:Z=>xt(Z,()=>void ct()),placeholder:"Model id"})]})})]}):x==="keybindings"?m.jsxs("div",{className:"border-b border-border",children:[ze?m.jsx("div",{className:"mb-4 rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:ze}):null,te.warning?m.jsx("div",{className:"mb-4 rounded-lg border border-border bg-card/30 px-4 py-3 text-sm text-muted-foreground",children:te.warning}):null,VI.map((Z,Ie)=>{const _e=zy(_s[Z]),qe=we[Z]??"",Te=qe!==_e;return m.jsx(Yi,{title:C3[Z],description:m.jsxs(m.Fragment,{children:[m.jsx("span",{children:"Comma-separated shortcuts."}),Te?m.jsxs(m.Fragment,{children:[m.jsx("span",{children:" "}),m.jsxs("button",{type:"button",onClick:()=>{Be(Z)},className:"inline rounded text-foreground hover:text-foreground/80",children:["Restore: ",_e]})]}):null]}),bordered:Ie!==0,children:m.jsx("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:m.jsx(Wr,{type:"text",value:qe,onChange:Nt=>{const wt=Nt.target.value;Ae(Jt=>({...Jt,[Z]:wt}))},onBlur:()=>{ue()},onKeyDown:Nt=>xt(Nt,()=>{ue()}),className:"font-mono"})})},Z)})]}):m.jsx(GSe,{status:s,releases:h,error:b,onRetry:ke,updateSnapshot:le,currentVersion:E,onInstallUpdate:()=>{n.handleInstallUpdate()},onCheckForUpdates:()=>{n.handleCheckForUpdates({force:!0})}})]}),n.commandError?m.jsxs("div",{className:"mx-auto mt-4 flex max-w-4xl items-start gap-3 rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:[m.jsx(K9,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),m.jsx("span",{children:n.commandError})]}):null]})]})]}),ht?m.jsx("div",{className:"absolute bottom-0 left-0 right-0 border-t border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:m.jsx("div",{className:"px-6 py-[14.25px]",children:m.jsxs("div",{className:"grid gap-3 text-xs text-muted-foreground grid-cols-2 lg:grid-cols-4",children:[m.jsxs("div",{children:[m.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"Machine"}),m.jsx("div",{className:"text-foreground/80",children:C})]}),m.jsxs("div",{className:"hidden md:block",children:[m.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"Connection"}),m.jsx("div",{className:"text-foreground/80",children:n.connectionStatus})]}),m.jsxs("div",{className:"hidden md:block",children:[m.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"Projects Indexed"}),m.jsx("div",{className:"text-foreground/80",children:R})]}),m.jsxs("div",{children:[m.jsx("div",{className:"mb-1 uppercase tracking-wide text-[11px] text-muted-foreground/80",children:"App Version"}),m.jsx("div",{className:"text-foreground/80",children:E})]})]})})}):null,m.jsx(od,{open:gt,onOpenChange:Kt,children:m.jsxs(uc,{size:"lg",children:[m.jsxs(ld,{className:"space-y-4",children:[m.jsx(ad,{children:"Validation Error"}),m.jsx("pre",{className:"max-h-[60vh] overflow-auto rounded-lg border border-border bg-muted p-3 text-xs font-mono whitespace-pre-wrap break-words",children:Et})]}),m.jsx(cd,{children:m.jsx(st,{variant:"secondary",size:"sm",onClick:()=>Kt(!1),children:"Close"})})]})})]})}function qI(e){return{toggleEmbeddedTerminal:Ra(e.toggleEmbeddedTerminal??""),toggleRightSidebar:Ra(e.toggleRightSidebar??""),openInFinder:Ra(e.openInFinder??""),openInEditor:Ra(e.openInEditor??""),addSplitTerminal:Ra(e.addSplitTerminal??""),jumpToSidebarChat:Ra(e.jumpToSidebarChat??""),createChatInCurrentProject:Ra(e.createChatInCurrentProject??""),openAddProject:Ra(e.openAddProject??"")}}const KI="kanna:last-seen-version";function YSe({error:e,onSubmit:t}){const[n,r]=_.useState(""),[i,s]=_.useState(!1);async function o(l){if(l.preventDefault(),!(!n||i)){s(!0);try{await t(n),r("")}finally{s(!1)}}}return m.jsx("div",{className:"flex min-h-[100dvh] items-center justify-center bg-background px-6 py-10",children:m.jsxs($w,{className:"w-full max-w-md rounded-3xl border border-border bg-card shadow-sm",children:[m.jsxs(Uw,{className:"flex flex-col p-2 space-y-3 px-6 pt-6 pb-5 pl-[28px]",children:[m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx(Tu,{className:"h-5 w-5 text-logo"}),m.jsx("div",{children:m.jsx(TO,{className:"font-logo text-xl uppercase text-slate-600 dark:text-slate-100",children:Un})})]}),m.jsx(AO,{className:"leading-6",children:"Enter your password to continue."})]}),m.jsx(Vw,{className:"px-6 pb-6",children:m.jsxs("form",{className:"space-y-4",onSubmit:l=>void o(l),children:[e?m.jsx("div",{className:"rounded-2xl border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-foreground",children:e}):null,m.jsx(Wr,{id:"kanna-password",type:"password",autoComplete:"current-password",value:n,onChange:l=>r(l.target.value),placeholder:"Password",disabled:i,className:"h-11 rounded-2xl bg-background"}),m.jsx(st,{type:"submit",disabled:i||n.length===0,className:"h-11 w-full",children:i?"Unlocking...":"Unlock"})]})})]})})}function XSe(){const[e,t]=_.useState({status:"checking"}),n=_.useCallback(async()=>{t(o=>o.status==="ready"?o:{status:"checking"});let i;try{i=await fetch("/auth/status",{method:"GET",cache:"no-store",headers:{Accept:"application/json"}})}catch{t({status:"ready"});return}if(!i.ok){t({status:"ready"});return}const s=await i.json();if(!s.enabled||s.authenticated){t({status:"ready"});return}t({status:"locked",error:null})},[]);_.useEffect(()=>{n()},[n]);const r=_.useCallback(async i=>{if(!(await fetch("/auth/login",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({password:i,next:window.location.pathname+window.location.search})})).ok){t({status:"locked",error:"Incorrect password. Try again."});return}await n()},[n]);return{state:e,submitPassword:r}}function QSe(e,t,n){return e==="/"&&!!t&&n!==t}function ZSe(){const e=Ns(),t=rd(),n=hP(),r=Bme(n.chatId??null),i=wu(E=>E.chatSoundPreference),s=wu(E=>E.chatSoundId),o=e.pathname==="/",l=nC.split("/")[1]??"unknown",u=_.useRef(null),d=_.useCallback(E=>{r.handleCreateChat(E)},[r.handleCreateChat]),f=_.useCallback(E=>{r.handleForkChat(E)},[r.handleForkChat]),h=_.useCallback(()=>{r.openAddProjectModal()},[r]),g=_.useCallback(E=>{r.handleDeleteChat(E)},[r.handleDeleteChat]),b=_.useCallback(E=>{r.handleCopyPath(E)},[r.handleCopyPath]),y=_.useCallback((E,T)=>{r.handleOpenExternalPath(E,T)},[r.handleOpenExternalPath]),x=_.useCallback(E=>{r.handleRemoveProject(E)},[r.handleRemoveProject]),w=_.useCallback(E=>{r.handleReorderProjectGroups(E)},[r.handleReorderProjectGroups]),C=_.useCallback(()=>{t("/settings/changelog")},[t]),R=_.useMemo(()=>m.jsx(HZ,{data:r.sidebarData,activeChatId:r.activeChatId,connectionStatus:r.connectionStatus,ready:r.sidebarReady,open:r.sidebarOpen,collapsed:r.sidebarCollapsed,showMobileOpenButton:o,onOpen:r.openSidebar,onClose:r.closeSidebar,onCollapse:r.collapseSidebar,onExpand:r.expandSidebar,onCreateChat:d,onForkChat:f,currentProjectId:r.activeProjectId,keybindings:r.keybindings,onDeleteChat:g,onOpenAddProjectModal:h,onCopyPath:b,onOpenExternalPath:y,onRemoveProject:x,onReorderProjectGroups:w,editorLabel:r.editorLabel,updateSnapshot:r.updateSnapshot,onOpenChangelog:C}),[C,h,b,d,g,y,w,x,o,r.activeChatId,r.activeProjectId,r.keybindings,r.closeSidebar,r.collapseSidebar,r.connectionStatus,r.editorLabel,r.expandSidebar,r.openSidebar,r.sidebarCollapsed,r.sidebarData,r.sidebarOpen,r.sidebarReady,r.updateSnapshot]);return _.useEffect(()=>{const E=window.localStorage.getItem(KI),T=QSe(e.pathname,l,E);window.localStorage.setItem(KI,l),T&&t("/settings/changelog",{replace:!0})},[l,e.pathname,t]),_.useLayoutEffect(()=>{document.title=Un},[e.key]),_.useEffect(()=>{function E(){document.title=Un}function T(){document.title=Un}return window.addEventListener("pageshow",E),window.addEventListener("pagehide",T),()=>{window.removeEventListener("pageshow",E),window.removeEventListener("pagehide",T)}},[]),_.useEffect(()=>{const E=qK(r.sidebarData);document.title=E>0?`[${E}] ${Un}`:Un},[r.sidebarData]),_.useEffect(()=>{const E=KK(u.current,r.sidebarData);u.current=r.sidebarData,!(E<=0)&&GK(i)&&SS(s,E).catch(()=>{})},[s,i,r.sidebarData]),m.jsxs("div",{className:"flex h-[100dvh] min-h-[100dvh] overflow-hidden",children:[R,m.jsx(kH,{context:r})]})}function JSe(){const e=XSe();return e.state.status==="checking"?m.jsx("div",{className:"flex min-h-[100dvh] items-center justify-center bg-background text-sm text-muted-foreground",children:"Checking session…"}):e.state.status==="locked"?m.jsx(YSe,{error:e.state.error,onSubmit:e.submitPassword}):m.jsx(wK,{children:m.jsx(HG,{children:m.jsx(RH,{children:m.jsxs(bu,{element:m.jsx(ZSe,{}),children:[m.jsx(bu,{path:"/",element:m.jsx(ISe,{})}),m.jsx(bu,{path:"/settings",element:m.jsx(CH,{to:"/settings/general",replace:!0})}),m.jsx(bu,{path:"/settings/:sectionId",element:m.jsx(KSe,{})}),m.jsx(bu,{path:"/chat/:chatId",element:m.jsx(TSe,{})})]})})})})}const uB=document.getElementById("root");if(!uB)throw new Error("Missing #root");R7.createRoot(uB).render(m.jsx(_.StrictMode,{children:m.jsx(QH,{children:m.jsx(iSe,{children:m.jsx(JSe,{})})})}));
|