@pixelbyte-software/pixcode 1.33.3 → 1.33.4
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/dist/assets/{index-BrB-LHeY.js → index-D0qriZVb.js} +3 -3
- package/dist/index.html +1 -1
- package/dist-server/server/modules/providers/list/opencode/opencode-sessions.provider.js +14 -1
- package/dist-server/server/modules/providers/list/opencode/opencode-sessions.provider.js.map +1 -1
- package/dist-server/server/modules/providers/provider.routes.js +2 -1
- package/dist-server/server/modules/providers/provider.routes.js.map +1 -1
- package/package.json +178 -178
- package/server/modules/providers/list/opencode/opencode-sessions.provider.ts +10 -1
- package/server/modules/providers/provider.routes.ts +2 -1
- package/server/opencode-cli.js +403 -403
- package/server/opencode-response-handler.js +92 -92
|
@@ -226,7 +226,7 @@ import{j as s,a as CS,R as Km,o as Ym,_ as ZT,b as XT,m as TS,E as fr,T as AS,P
|
|
|
226
226
|
.xterm-screen:focus {
|
|
227
227
|
outline: none !important;
|
|
228
228
|
}
|
|
229
|
-
`;function xR(){if(typeof document>"u"||document.getElementById(xy))return;const e=document.createElement("style");e.id=xy,e.type="text/css",e.innerText=bR,document.head.appendChild(e)}function yR({terminalContainerRef:e,terminalRef:t,fitAddonRef:n,wsRef:r,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:d,copyAuthUrlToClipboard:u,closeSocket:p}){const[h,m]=f.useState(!1),g=f.useRef(null),b=a?.fullPath||a?.path||"",x=!!a;f.useEffect(()=>{xR()},[]);const y=f.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),v=f.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),n.current=null,m(!1)},[n,t]);return f.useEffect(()=>{if(!e.current||!x||o||t.current)return;const w=new hR.Terminal(rR);t.current=w;const S=new dR.FitAddon;n.current=S,w.loadAddon(S),i||w.loadAddon(new pR.WebLinksAddon);try{w.loadAddon(new mR.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}w.open(e.current);const E=async()=>{const C=w.getSelection();return C?gr(C):!1},k=C=>{if(!w.hasSelection())return;const I=w.getSelection();if(I){if(C.preventDefault(),C.clipboardData){C.clipboardData.setData("text/plain",I);return}gr(I)}};e.current.addEventListener("copy",k),w.attachCustomKeyEventHandler(C=>{const I=x5(l.current)?g5:d.current;return C.type==="keydown"&&i&&c.current&&I&&!C.ctrlKey&&!C.metaKey&&!C.altKey&&C.key?.toLowerCase()==="c"?(C.preventDefault(),C.stopPropagation(),u(I),!1):C.type==="keydown"&&(C.ctrlKey||C.metaKey)&&C.key?.toLowerCase()==="c"&&w.hasSelection()?(C.preventDefault(),C.stopPropagation(),E(),!1):C.type==="keydown"&&(C.ctrlKey||C.metaKey)&&C.key?.toLowerCase()==="v"?(C.preventDefault(),C.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(O=>{ci(r.current,{type:"input",data:O})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const C=n.current,I=t.current;!C||!I||(C.fit(),ci(r.current,{type:"resize",cols:I.cols,rows:I.rows}))},b5),m(!0);const T=w.onData(C=>{ci(r.current,{type:"input",data:C})}),_=new ResizeObserver(()=>{g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{const C=n.current,I=t.current;!C||!I||(C.fit(),ci(r.current,{type:"resize",cols:I.cols,rows:I.rows}))},Xj)});return _.observe(e.current),()=>{e.current?.removeEventListener("copy",k),_.disconnect(),g.current!==null&&(window.clearTimeout(g.current),g.current=null),T.dispose(),p(),v()}},[d,p,u,v,n,l,c,o,i,x,b,e,t,r]),{isInitialized:h,clearTerminalScreen:y,disposeTerminal:v}}function vR({selectedProject:e,selectedSession:t,initialCommand:n,isPlainShell:r,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const d=f.useRef(null),u=f.useRef(null),p=f.useRef(null),h=f.useRef(null),[m,g]=f.useState(""),[b,x]=f.useState(0),y=f.useRef(e),v=f.useRef(t),w=f.useRef(n),S=f.useRef(r),E=f.useRef(l),k=f.useRef(""),T=f.useRef(t?.id??null);f.useEffect(()=>{y.current=e,v.current=t,w.current=n,S.current=r,E.current=l},[e,t,n,r,l]);const _=f.useCallback(H=>{k.current=H,g(H),x(L=>L+1)},[]),C=f.useCallback(()=>{const H=h.current;H&&((H.readyState===WebSocket.OPEN||H.readyState===WebSocket.CONNECTING)&&H.close(),h.current=null)},[]),I=f.useCallback((H=k.current)=>{if(!H)return!1;const L=window.open(H,"_blank");if(L){try{L.opener=null}catch{}return!0}return!1},[]),O=f.useCallback(async(H=k.current)=>H?gr(H):!1,[]),{isInitialized:A,clearTerminalScreen:R,disposeTerminal:N}=yR({terminalContainerRef:d,terminalRef:u,fitAddonRef:p,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:w,isPlainShellRef:S,authUrlRef:k,copyAuthUrlToClipboard:O,closeSocket:C}),{isConnected:F,isConnecting:K,connectToShell:B,disconnectFromShell:W}=cR({wsRef:h,terminalRef:u,fitAddonRef:p,selectedProjectRef:y,selectedSessionRef:v,initialCommandRef:w,isPlainShellRef:S,onProcessCompleteRef:E,isInitialized:A,autoConnect:i,closeSocket:C,clearTerminalScreen:R,setAuthUrl:_,onOutputRef:c});return f.useEffect(()=>{o&&(W(),N())},[W,N,o]),f.useEffect(()=>{e||(W(),N())},[W,N,e]),f.useEffect(()=>{const H=t?.id??null;T.current!==H&&A&&W(),T.current=H},[W,A,t?.id]),{terminalContainerRef:d,terminalRef:u,wsRef:h,isConnected:F,isInitialized:A,isConnecting:K,authUrl:m,authUrlVersion:b,connectToShell:B,disconnectFromShell:W,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:O}}function wR({mode:e,description:t,loadingLabel:n,connectLabel:r,connectTitle:a,connectingLabel:i,onConnect:o}){return e==="loading"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:s.jsx("div",{className:"text-white",children:n})}):e==="connect"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("button",{onClick:o,className:"flex w-full items-center justify-center space-x-2 rounded-lg bg-green-600 px-6 py-3 text-base font-medium text-white transition-colors hover:bg-green-700 sm:w-auto",title:a,children:[s.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),s.jsx("span",{children:r})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})}):s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),s.jsx("span",{className:"text-base font-medium",children:i})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})})}function kR({title:e,description:t}){return s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:e}),s.jsx("p",{children:t})]})})}function SR({isConnected:e,isInitialized:t,isRestarting:n,hasSession:r,sessionDisplayNameShort:a,onDisconnect:i,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:d,disconnectLabel:u,disconnectTitle:p,restartLabel:h,restartTitle:m,disableRestart:g}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-500":"bg-red-500"}`}),r&&a&&s.jsxs("span",{className:"text-xs text-blue-300",children:["(",a,"...)"]}),!r&&s.jsx("span",{className:"text-xs text-gray-400",children:l}),!t&&s.jsx("span",{className:"text-xs text-yellow-400",children:c}),n&&s.jsx("span",{className:"text-xs text-blue-400",children:d})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[e&&s.jsxs("button",{onClick:i,className:"flex items-center space-x-1 rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700",title:p,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),s.jsx("span",{children:u})]}),s.jsxs("button",{onClick:o,disabled:g,className:"flex items-center space-x-1 text-xs text-gray-400 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",title:m,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),s.jsx("span",{children:h})]})]})]})})}function ER({terminalContainerRef:e,authUrl:t,authUrlVersion:n,initialCommand:r,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=f.useState("idle"),[d,u]=f.useState(!1),p=f.useMemo(()=>fR(r,t),[t,r]);f.useEffect(()=>{c("idle"),u(!1)},[n,p,a]);const h=!!p,m=h&&!d,g=h&&d;return s.jsxs("div",{className:"relative h-full w-full bg-gray-900",children:[s.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),m&&s.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),s.jsx("button",{type:"button",onClick:()=>u(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),s.jsx("input",{type:"text",value:p,readOnly:!0,onClick:b=>b.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{i(p)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),s.jsx("button",{type:"button",onClick:async()=>{const b=await o(p);c(b?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:l==="copied"?"Copied":"Copy URL"})]})]})}),g&&s.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:s.jsx("button",{type:"button",onClick:()=>u(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}const NR=[{type:"key",id:"esc",label:"Esc",sequence:"\x1B"},{type:"key",id:"tab",label:"Tab",sequence:" "},{type:"key",id:"shift-tab",label:"⇧Tab",sequence:"\x1B[Z"},{type:"modifier",id:"ctrl",label:"CTRL",modifier:"ctrl"},{type:"modifier",id:"alt",label:"ALT",modifier:"alt"},{type:"arrow",id:"arrow-up",sequence:"\x1B[A",icon:"up"},{type:"arrow",id:"arrow-down",sequence:"\x1B[B",icon:"down"},{type:"arrow",id:"arrow-left",sequence:"\x1B[D",icon:"left"},{type:"arrow",id:"arrow-right",sequence:"\x1B[C",icon:"right"}],CR={up:QS,down:t0,left:ZI,right:n0},Ys=e=>e.preventDefault(),yy="shrink-0 rounded-md border border-gray-600 bg-gray-700 px-2.5 py-1.5 text-xs font-medium text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40",TR="shrink-0 rounded-md border border-blue-500 bg-blue-600 px-2.5 py-1.5 text-xs font-medium text-white transition-colors select-none disabled:cursor-not-allowed disabled:opacity-40",Bd="shrink-0 rounded-md border border-gray-600 bg-gray-700 p-1.5 text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40";function vy({wsRef:e,terminalRef:t,isConnected:n,bottomOffset:r="bottom-0"}){const{t:a}=Re("settings"),[i,o]=f.useState(!1),[l,c]=f.useState(!1),d=f.useCallback(m=>{ci(e.current,{type:"input",data:m})},[e]),u=f.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=f.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&d(m)}catch{}},[d]),h=f.useCallback(m=>{let g=m;if(i&&m.length===1){const b=m.toLowerCase().charCodeAt(0);b>=97&&b<=122&&(g=String.fromCharCode(b-96)),o(!1)}l&&m.length===1&&(g="\x1B"+g,c(!1)),d(g)},[i,l,d]);return s.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${r} z-20 px-2 md:hidden`,children:s.jsxs("div",{className:"pointer-events-auto flex items-center gap-1 overflow-x-auto rounded-lg border border-gray-700/80 bg-gray-900/95 px-1.5 py-1.5 shadow-lg backdrop-blur-sm [-webkit-overflow-scrolling:touch] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx("button",{type:"button",onPointerDown:Ys,onClick:()=>{p()},disabled:!n,className:Bd,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:s.jsx(i0,{className:"h-4 w-4"})}),NR.map(m=>{if(m.type==="modifier"){const g=m.modifier==="ctrl"?i:l,b=m.modifier==="ctrl"?()=>o(x=>!x):()=>c(x=>!x);return s.jsx("button",{type:"button",onPointerDown:Ys,onClick:b,disabled:!n,className:g?TR:yy,children:m.label},m.id)}if(m.type==="arrow"){const g=CR[m.icon];return s.jsx("button",{type:"button",onPointerDown:Ys,onClick:()=>d(m.sequence),disabled:!n,className:Bd,children:s.jsx(g,{className:"h-4 w-4"})},m.id)}return s.jsx("button",{type:"button",onPointerDown:Ys,onClick:()=>h(m.sequence),disabled:!n,className:yy,children:m.label},m.id)}),s.jsx("button",{type:"button",onPointerDown:Ys,onClick:u,disabled:!n,className:Bd,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:s.jsx(XI,{className:"h-4 w-4"})})]})})}function y5({selectedProject:e=null,selectedSession:t=null,initialCommand:n=null,isPlainShell:r=!1,onProcessComplete:a=null,minimal:i=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=Re("chat"),[d,u]=f.useState(!1),[p,h]=f.useState(null),m=f.useRef(null),g=f.useRef(null),{terminalContainerRef:b,terminalRef:x,wsRef:y,isConnected:v,isInitialized:w,isConnecting:S,authUrl:E,authUrlVersion:k,connectToShell:T,disconnectFromShell:_,openAuthUrlInBrowser:C,copyAuthUrlToClipboard:I}=vR({selectedProject:e,selectedSession:t,initialCommand:n,isPlainShell:r,minimal:i,autoConnect:o,isRestarting:d,onProcessComplete:a,onOutputRef:g}),O=f.useCallback(()=>{const U=x.current;if(!U)return;const M=U.buffer.active,J=M.baseY+M.cursorY,te=Math.min(M.baseY+M.length-1,J+10),de=Math.max(0,J-Qj),ue=[];for(let De=de;De<=te;De++){const Ue=M.getLine(De);Ue&&ue.push(Ue.translateToString().trimEnd())}let se=-1;for(let De=ue.length-1;De>=0;De--)if(/esc to cancel/i.test(ue[De])||/enter to select/i.test(ue[De])){se=De;break}if(se===-1){h(null);return}const he=new Map,Te=Math.max(0,se-eR);for(let De=se-1;De>=Te;De--){const Ue=ue[De].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Ue){const P=Ue[1],pe=Ue[2].trim();parseInt(P,10)<=tR&&pe.length>0&&!he.has(P)&&he.set(P,pe)}}const Ae=[];for(let De=1;De<=he.size&&he.has(String(De));De++)Ae.push({number:String(De),label:he.get(String(De))});h(Ae.length>=nR?Ae:null)},[x]),A=f.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(O,Jj)},[O]);f.useEffect(()=>{g.current=A},[A]),f.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),f.useEffect(()=>{v||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[v]),f.useEffect(()=>{if(!l||!w||!v)return;const U=()=>{x.current?.focus()},M=window.requestAnimationFrame(U),J=window.setTimeout(U,0);return()=>{window.cancelAnimationFrame(M),window.clearTimeout(J)}},[l,v,w,x]);const R=f.useCallback(U=>{ci(y.current,{type:"input",data:U})},[y]),N=f.useMemo(()=>gR(t),[t]),F=f.useMemo(()=>N?N.slice(0,30):null,[N]),K=f.useMemo(()=>N?N.slice(0,50):null,[N]),B=f.useCallback(()=>{u(!0),window.setTimeout(()=>{u(!1)},Zj)},[]);if(!e)return s.jsx(kR,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsxs(s.Fragment,{children:[s.jsx(ER,{terminalContainerRef:b,authUrl:E,authUrlVersion:k,initialCommand:n,isConnected:v,openAuthUrlInBrowser:C,copyAuthUrlToClipboard:I}),s.jsx(vy,{wsRef:y,terminalRef:x,isConnected:v,bottomOffset:"bottom-0"})]});const W=r?c("shell.runCommand",{command:n||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:K}):c("shell.startSession"),H=r?c("shell.runCommand",{command:n||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),L=w?S?"connecting":v?null:"connect":"loading",G=L==="connecting"?H:W;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(SR,{isConnected:v,isInitialized:w,isRestarting:d,hasSession:!!t,sessionDisplayNameShort:F,onDisconnect:_,onRestart:B,statusNewSessionText:c("shell.status.newSession"),statusInitializingText:c("shell.status.initializing"),statusRestartingText:c("shell.status.restarting"),disconnectLabel:c("shell.actions.disconnect"),disconnectTitle:c("shell.actions.disconnectTitle"),restartLabel:c("shell.actions.restart"),restartTitle:c("shell.actions.restartTitle"),disableRestart:d||v}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:b,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),L&&s.jsx(wR,{mode:L,description:G,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:T}),p&&v&&s.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm",onMouseDown:U=>U.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(U=>s.jsxs("button",{type:"button",onClick:()=>{R(U.number),h(null)},className:"max-w-36 truncate rounded bg-blue-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-blue-700",title:`${U.number}. ${U.label}`,children:[U.number,". ",U.label]},U.number)),s.jsx("button",{type:"button",onClick:()=>{R("\x1B"),h(null)},className:"rounded bg-gray-700 px-3 py-1.5 text-xs font-medium text-gray-200 transition-colors hover:bg-gray-600",children:"Esc"})]})})]}),s.jsx(vy,{wsRef:y,terminalRef:x,isConnected:v})]})}function AR({className:e}){return s.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),s.jsx("p",{children:"A project is required to open a shell"})]})})}function _R({title:e,isCompleted:t,onClose:n=null}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&s.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),n&&s.jsx("button",{onClick:n,className:"text-gray-400 hover:text-white",title:"Close",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function v5({project:e=null,session:t=null,command:n=null,isPlainShell:r=null,isActive:a=!0,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:d="",showHeader:u=!0,compact:p=!1,minimal:h=!1}){const[m,g]=f.useState(!1),b=r!==null?r:n!==null,x=f.useCallback(y=>{g(!0),o?.(y)},[o]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${d}`,children:[!h&&u&&c&&s.jsx(_R,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(y5,{selectedProject:e,selectedSession:t,initialCommand:n,isPlainShell:b,isActive:a,onProcessComplete:x,minimal:h,autoConnect:h?!0:i})})]}):s.jsx(AR,{className:d})}const IR=(e,t)=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":e==="qwen"?"qwen auth":e==="opencode"?"opencode auth login":"gemini"),jR={claude:{keyLabel:"Anthropic API Key",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console"},codex:{keyLabel:"OpenAI API Key",keyExample:"sk-...",supportsBaseUrl:!0,baseUrlExample:"https://api.openai.com/v1",keyConsoleUrl:"https://platform.openai.com/api-keys",keyConsoleLabel:"OpenAI Platform"},gemini:{keyLabel:"Gemini API Key",keyExample:"AI...",supportsBaseUrl:!1,keyConsoleUrl:"https://aistudio.google.com/app/apikey",keyConsoleLabel:"Google AI Studio"},qwen:{keyLabel:"OpenAI-Compatible API Key",keyExample:"sk-... or sk-sp-...",supportsBaseUrl:!0,baseUrlExample:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",keyConsoleUrl:"https://github.com/QwenLM/qwen-code",keyConsoleLabel:"Qwen Code Docs",notes:"Accepts any OpenAI-compatible endpoint — Alibaba Cloud, ModelScope, OpenRouter, self-hosted, etc."},opencode:{keyLabel:"Anthropic API Key (default backend)",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console",notes:"OpenCode is multi-provider — this sets the Anthropic credentials. Switch providers via `opencode auth login` or opencode.json."}};function wy({active:e,children:t,onClick:n}){return s.jsx("button",{onClick:n,className:`flex-1 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors ${e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:t})}function RR({provider:e}){const[t,n]=f.useState(""),[r,a]=f.useState(!1),[i,o]=f.useState("idle"),[l,c]=f.useState(null),d=async()=>{const u=t.trim();if(u){a(!0),c(null),o("idle");try{const p=await we(`/api/providers/${e}/oauth-paste`,{method:"POST",body:JSON.stringify({callbackUrl:u})}),h=await p.json().catch(()=>({}));if(!p.ok||!h?.success)throw new Error(h?.error||`Request failed (${p.status})`);o("ok"),n("")}catch(p){c(p?.message||"Forward failed"),o("error")}finally{a(!1)}}};return s.jsxs("div",{className:"mt-3 rounded-lg border border-border/60 bg-muted/30 p-3 text-sm",children:[s.jsx("div",{className:"mb-2 font-medium text-foreground",children:"Remote login? Paste the callback URL here"}),s.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["When the CLI shows ",s.jsx("code",{className:"rounded bg-background px-1 font-mono text-[11px]",children:"http://127.0.0.1:PORT/…"})," and your browser can't reach it (VPS setups), copy the failing URL from your address bar and paste it below. Pixcode forwards the token exchange to the CLI process on this host."]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"url",value:t,onChange:u=>n(u.target.value),placeholder:"http://127.0.0.1:49312/callback?code=...",className:"flex-1 rounded-md border border-border bg-background px-3 py-2 font-mono text-xs text-foreground focus:border-primary focus:outline-none",onKeyDown:u=>{u.key==="Enter"&&d()}}),s.jsx("button",{onClick:()=>void d(),disabled:r||!t.trim(),className:"flex items-center gap-1.5 rounded-md bg-foreground px-3 py-2 text-xs font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:r?s.jsx(fn,{className:"h-3.5 w-3.5 animate-spin"}):"Forward"})]}),i==="ok"&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-emerald-600 dark:text-emerald-400",children:[s.jsx(Gt,{className:"h-3.5 w-3.5"})," Forwarded — check the terminal above for the completion message."]}),i==="error"&&l&&s.jsx("div",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:l})]})}function DR({provider:e,onSaved:t}){const n=jR[e],[r,a]=f.useState(""),[i,o]=f.useState(""),[l,c]=f.useState(!1),[d,u]=f.useState("idle"),[p,h]=f.useState(null);f.useEffect(()=>{let g=!1;return(async()=>{try{const x=await(await we("/api/providers/credentials")).json().catch(()=>({}));if(g||!x?.success)return;const y=x.data?.[e];y?.baseUrl&&o(y.baseUrl)}catch{}})(),()=>{g=!0}},[e]);const m=async()=>{const g=r.trim();if(g){c(!0),h(null),u("idle");try{const b=await we(`/api/providers/${e}/auth/api-key`,{method:"POST",body:JSON.stringify({apiKey:g,baseUrl:n.supportsBaseUrl&&i.trim()?i.trim():""})}),x=await b.json().catch(()=>({}));if(!b.ok||!x?.success)throw new Error(x?.error||`Request failed (${b.status})`);u("ok"),a(""),t()}catch(b){h(b?.message||"Save failed"),u("error")}finally{c(!1)}}};return n?s.jsx("div",{className:"flex h-full flex-col overflow-y-auto p-6",children:s.jsxs("div",{className:"mx-auto w-full max-w-lg space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:s.jsx(Tj,{className:"h-5 w-5 text-foreground"})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-base font-semibold text-foreground",children:n.keyLabel}),s.jsxs("a",{href:n.keyConsoleUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:["Get a key from ",n.keyConsoleLabel,s.jsx(Mr,{className:"h-3 w-3"})]})]})]}),n.notes&&s.jsx("div",{className:"rounded-md border border-border/60 bg-muted/40 p-3 text-xs text-muted-foreground",children:n.notes}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-foreground",children:"API Key"}),s.jsx("input",{type:"password",value:r,onChange:g=>a(g.target.value),placeholder:n.keyExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Stored locally at ",s.jsx("code",{className:"rounded bg-muted px-1 font-mono text-[10px]",children:"~/.pixcode/provider-credentials.json"})," with 0600 permissions."]})]}),n.supportsBaseUrl&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-foreground",children:["Base URL ",s.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional — use a custom endpoint)"})]}),s.jsx("input",{type:"url",value:i,onChange:g=>o(g.target.value),placeholder:n.baseUrlExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Point at any OpenAI-compatible proxy (OpenRouter, local LLM, self-hosted, budget provider) to cut costs or hit different models."})]}),s.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[s.jsxs("button",{onClick:()=>void m(),disabled:l||!r.trim(),className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:[l?s.jsx(fn,{className:"h-4 w-4 animate-spin"}):s.jsx(Gt,{className:"h-4 w-4"}),"Save API Key"]}),d==="ok"&&s.jsx("span",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:"Saved — reconnect to pick it up."}),d==="error"&&p&&s.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:p})]})]})}):s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"This provider uses OAuth only — use the Browser tab to log in."})}function w5({isOpen:e,onClose:t,provider:n="claude",onComplete:r,customCommand:a,isAuthenticated:i=!1}){const{t:o}=Re("common"),l=n!=="cursor",[c,d]=f.useState(l?"apiKey":"browser");f.useEffect(()=>{e&&d(l?"apiKey":"browser")},[e,n,l]);const u=f.useMemo(()=>`${bc[n]??n} Login`,[n]);if(!e)return null;const p=IR(n,a),h=m=>r?.(m);return s.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black bg-opacity-50 max-md:items-stretch max-md:justify-stretch",children:s.jsxs("div",{className:"flex h-3/4 w-full max-w-4xl flex-col rounded-lg bg-white shadow-xl dark:bg-gray-800 max-md:m-0 max-md:h-full max-md:max-w-none max-md:rounded-none md:m-4 md:h-3/4 md:max-w-4xl md:rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:u}),s.jsx("button",{onClick:t,className:"text-gray-400 transition-colors hover:text-gray-600 dark:hover:text-gray-300","aria-label":"Close login modal",children:s.jsx(bt,{className:"h-6 w-6"})})]}),s.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:[s.jsx(wy,{active:c==="browser",onClick:()=>d("browser"),children:"Browser / OAuth"}),l&&s.jsx(wy,{active:c==="apiKey",onClick:()=>d("apiKey"),children:"API Key"})]}),s.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:c==="browser"?s.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(v5,{project:m6,command:p,onComplete:h,minimal:!0})}),(n==="claude"||n==="cursor"||n==="qwen")&&s.jsx("div",{className:"border-t border-border/40 bg-background/50 px-4 py-3",children:s.jsx(RR,{provider:n})})]}):s.jsx(DR,{provider:n,onSaved:()=>h(0)})})]})})}const OR=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),LR=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=qa();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},MR=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=qa();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},PR=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e}),FR=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=qa(),n=t?"/icons/opencode-logo-dark.svg":"/icons/opencode-logo-light.svg";return s.jsx("img",{src:n,alt:"OpenCode",className:e})},zR=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/qwen-logo.svg",alt:"Qwen Code",className:e});function Rn({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(MR,{className:t}):e==="codex"?s.jsx(LR,{className:t}):e==="gemini"?s.jsx(PR,{className:t}):e==="qwen"?s.jsx(zR,{className:t}):e==="opencode"?s.jsx(FR,{className:t}):s.jsx(OR,{className:t})}function BR({provider:e,title:t,status:n,connectedClassName:r,iconContainerClassName:a,loginButtonClassName:i,onLogin:o}){const l=n.authenticated?r:"border-border bg-card",c=n.loading?"Checking...":n.authenticated?n.email||"Connected":n.error||"Not connected";return s.jsx("div",{className:`rounded-lg border p-4 transition-colors ${l}`,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full ${a}`,children:s.jsx(Rn,{provider:e,className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 font-medium text-foreground",children:[t,n.authenticated&&s.jsx(Gt,{className:"h-4 w-4 text-green-500"})]}),s.jsx("div",{className:"text-xs text-muted-foreground",children:c})]})]}),!n.authenticated&&!n.loading&&s.jsx("button",{onClick:o,className:`${i} rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const $R=[{provider:"claude",title:"Claude Code",connectedClassName:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800",iconContainerClassName:"bg-blue-100 dark:bg-blue-900/30",loginButtonClassName:"bg-blue-600 hover:bg-blue-700"},{provider:"cursor",title:"Cursor",connectedClassName:"bg-purple-50 dark:bg-purple-900/20 border-purple-200 dark:border-purple-800",iconContainerClassName:"bg-purple-100 dark:bg-purple-900/30",loginButtonClassName:"bg-purple-600 hover:bg-purple-700"},{provider:"codex",title:"OpenAI Codex",connectedClassName:"bg-gray-100 dark:bg-gray-800/50 border-gray-300 dark:border-gray-600",iconContainerClassName:"bg-gray-100 dark:bg-gray-800",loginButtonClassName:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"},{provider:"gemini",title:"Gemini",connectedClassName:"bg-teal-50 dark:bg-teal-900/20 border-teal-200 dark:border-teal-800",iconContainerClassName:"bg-teal-100 dark:bg-teal-900/30",loginButtonClassName:"bg-teal-600 hover:bg-teal-700"},{provider:"qwen",title:"Qwen Code",connectedClassName:"bg-orange-50 dark:bg-orange-900/20 border-orange-200 dark:border-orange-800",iconContainerClassName:"bg-orange-100 dark:bg-orange-900/30",loginButtonClassName:"bg-orange-600 hover:bg-orange-700"}];function UR({providerStatuses:e,onOpenProviderLogin:t}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-6 text-center",children:[s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Connect Your AI Agents"}),s.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),s.jsx("div",{className:"space-y-3",children:$R.map(n=>s.jsx(BR,{provider:n.provider,title:n.title,status:e[n.provider],connectedClassName:n.connectedClassName,iconContainerClassName:n.iconContainerClassName,loginButtonClassName:n.loginButtonClassName,onLogin:()=>t(n.provider)},n.provider))}),s.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:s.jsx("p",{children:"You can configure these later in Settings."})})]})}function GR({gitName:e,gitEmail:t,isSubmitting:n,onGitNameChange:r,onGitEmailChange:a}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-8 text-center",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:s.jsx(rr,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Git Configuration"}),s.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(Nj,{className:"h-4 w-4"}),"Git Name ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",id:"gitName",value:e,onChange:i=>r(i.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"John Doe",required:!0,disabled:n}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(Sj,{className:"h-4 w-4"}),"Git Email ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:i=>a(i.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"john@example.com",required:!0,disabled:n}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const ky=[{title:"Git Configuration",icon:rr,required:!0},{title:"Connect Agents",icon:e5,required:!1}];function HR({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:ky.map((t,n)=>{const r=n<e,a=n===e,i=t.icon;return s.jsxs("div",{className:"contents",children:[s.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[s.jsx("div",{className:`flex h-12 w-12 items-center justify-center rounded-full border-2 transition-colors duration-200 ${r?"border-green-500 bg-green-500 text-white":a?"border-blue-600 bg-blue-600 text-white":"border-border bg-background text-muted-foreground"}`,children:r?s.jsx(Gt,{className:"h-6 w-6"}):s.jsx(i,{className:"h-6 w-6"})}),s.jsxs("div",{className:"mt-2 text-center",children:[s.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&s.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),n<ky.length-1&&s.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${r?"bg-green-500":"bg-border"}`})]},t.title)})})})}const Sy=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ey=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function qR({onComplete:e}){const[t,n]=f.useState(0),[r,a]=f.useState(""),[i,o]=f.useState(""),[l,c]=f.useState(!1),[d,u]=f.useState(""),[p,h]=f.useState(null),{providerAuthStatus:m,checkProviderAuthStatus:g,refreshProviderAuthStatuses:b}=p0(),x=f.useRef(void 0),y=f.useCallback(async()=>{try{const _=await we("/api/user/git-config");if(!_.ok)return;const C=await _.json();C.gitName&&a(C.gitName),C.gitEmail&&o(C.gitEmail)}catch(_){console.error("Error loading git config:",_)}},[]);f.useEffect(()=>{y(),b()},[y,b]),f.useEffect(()=>{const _=x.current;x.current=p,_!=null&&p===null&&b()},[p,b]);const v=_=>{h(_)},w=_=>{_===0&&p&&g(p)},S=async()=>{if(u(""),t!==0){n(_=>_+1);return}if(!r.trim()||!i.trim()){u("Both git name and email are required.");return}if(!Sy.test(i)){u("Please enter a valid email address.");return}c(!0);try{const _=await we("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:r,gitEmail:i})});if(!_.ok){const C=await Ey(_,"Failed to save git configuration");throw new Error(C)}n(C=>C+1)}catch(_){u(_ instanceof Error?_.message:"Failed to save git configuration")}finally{c(!1)}},E=()=>{u(""),n(_=>_-1)},k=async()=>{c(!0),u("");try{const _=await we("/api/user/complete-onboarding",{method:"POST"});if(!_.ok){const C=await Ey(_,"Failed to complete onboarding");throw new Error(C)}await e?.()}catch(_){u(_ instanceof Error?_.message:"Failed to complete onboarding")}finally{c(!1)}},T=t===0?!!(r.trim()&&i.trim()&&Sy.test(i)):!0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"w-full max-w-2xl",children:[s.jsx(HR,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(GR,{gitName:r,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(UR,{providerStatuses:m,onOpenProviderLogin:v}),d&&s.jsx("div",{className:"mt-6 rounded-lg border border-red-300 bg-red-100 p-4 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:d})}),s.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[s.jsxs("button",{onClick:E,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground transition-colors duration-200 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx(r0,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:S,disabled:!T||l,className:"flex items-center gap-2 rounded-lg bg-blue-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-blue-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(fn,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(Sr,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:k,disabled:l,className:"flex items-center gap-2 rounded-lg bg-green-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-green-700 disabled:cursor-not-allowed disabled:bg-green-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(fn,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Gt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(w5,{isOpen:!!p,onClose:()=>h(null),provider:p,onComplete:w})]})}const VR=["0s","0.1s","0.2s"];function WR(){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(vi,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"Pixcode"}),s.jsx("div",{className:"flex items-center justify-center space-x-2",children:VR.map(e=>s.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-blue-500",style:{animationDelay:e}},e))}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading..."})]})})}function k5({errorMessage:e}){return e?s.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function So({id:e,label:t,value:n,onChange:r,placeholder:a,isDisabled:i,type:o="text",name:l,autoComplete:c}){return s.jsxs("div",{children:[s.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),s.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:n,onChange:d=>r(d.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:a,required:!0,disabled:i})]})}function S5({title:e,description:t,children:n,footerText:r,logo:a}){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsx("div",{className:"w-full max-w-md",children:s.jsxs("div",{className:"space-y-6 rounded-lg border border-border bg-card p-8 shadow-lg",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:a??s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(vi,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),n,s.jsx("div",{className:"text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:r})}),s.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),s.jsx("a",{href:"https://github.com/alicomert/pixcode",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"Pixcode is open source"})]})]})})})}const KR={username:"",password:""};function YR(){const{t:e}=Re("auth"),{login:t}=Qo(),[n,r]=f.useState(KR),[a,i]=f.useState(""),[o,l]=f.useState(!1),c=f.useCallback((u,p)=>{r(h=>({...h,[u]:p}))},[]),d=f.useCallback(async u=>{if(u.preventDefault(),i(""),!n.username.trim()||!n.password){i(e("login.errors.requiredFields"));return}l(!0);const p=await t(n.username.trim(),n.password);p.success||i(p.error),l(!1)},[n.password,n.username,t,e]);return s.jsx(S5,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access Pixcode",children:s.jsxs("form",{onSubmit:d,className:"space-y-4",children:[s.jsx(So,{id:"username",label:e("login.username"),value:n.username,onChange:u=>c("username",u),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),s.jsx(So,{id:"password",label:e("login.password"),value:n.password,onChange:u=>c("password",u),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),s.jsx(k5,{errorMessage:a}),s.jsx("button",{type:"submit",disabled:o,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:e(o?"login.loading":"login.submit")})]})})}const ZR={username:"",password:"",confirmPassword:""};function XR(e){return!e.username.trim()||!e.password||!e.confirmPassword?"Please fill in all fields.":e.username.trim().length<3?"Username must be at least 3 characters long.":e.password.length<6?"Password must be at least 6 characters long.":e.password!==e.confirmPassword?"Passwords do not match.":null}function JR(){const{register:e}=Qo(),[t,n]=f.useState(ZR),[r,a]=f.useState(""),[i,o]=f.useState(!1),l=f.useCallback((d,u)=>{n(p=>({...p,[d]:u}))},[]),c=f.useCallback(async d=>{d.preventDefault(),a("");const u=XR(t);if(u){a(u);return}o(!0);const p=await e(t.username.trim(),t.password);p.success||a(p.error),o(!1)},[t,e]);return s.jsx(S5,{title:"Welcome to Pixcode",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:s.jsx("img",{src:"/logo.svg",alt:"Pixcode",className:"h-16 w-16"}),children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(So,{id:"username",name:"username",label:"Username",value:t.username,onChange:d=>l("username",d),placeholder:"Enter your username",isDisabled:i,autoComplete:"username"}),s.jsx(So,{id:"password",name:"password",label:"Password",value:t.password,onChange:d=>l("password",d),placeholder:"Enter your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(So,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:d=>l("confirmPassword",d),placeholder:"Confirm your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(k5,{errorMessage:r}),s.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:i?"Setting up...":"Create Account"})]})})}function QR({children:e}){const{user:t,isLoading:n,needsSetup:r,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Qo();return n?s.jsx(WR,{}):r?s.jsx(JR,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(qR,{onComplete:i}):s.jsx(YR,{})}const E5=f.createContext(null),N5=()=>{const e=f.useContext(E5);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},e9=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},t9=()=>{const e=f.useRef(null),t=f.useRef(!1),n=f.useRef(!1),[r,a]=f.useState(null),[i,o]=f.useState(!1),l=f.useRef(null),{token:c}=Qo();f.useEffect(()=>(d(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const d=f.useCallback(()=>{if(!t.current)try{const h=e9(c);if(!h)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(h);m.onopen=()=>{o(!0),e.current=m,n.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),n.current=!0},m.onmessage=g=>{try{const b=JSON.parse(g.data);a(b)}catch(b){console.error("Error parsing WebSocket message:",b)}},m.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||d()},3e3)},m.onerror=g=>{console.error("WebSocket error:",g)}}catch(h){console.error("Error creating WebSocket connection:",h)}},[c]),u=f.useCallback(h=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(h)):console.warn("WebSocket not connected")},[]);return f.useMemo(()=>({ws:e.current,sendMessage:u,latestMessage:r,isConnected:i}),[u,r,i])},n9=({children:e})=>{const t=t9();return s.jsx(E5.Provider,{value:t,children:e})},C5=f.createContext(null);function r9(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function Ny(e){return{...e,taskMasterConfigured:e.taskmaster?.hasTaskmaster??!1,taskMasterStatus:e.taskmaster?.status??"not-configured",taskCount:Number(e.taskmaster?.metadata?.taskCount??0),completedCount:Number(e.taskmaster?.metadata?.completed??0)}}function a9(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function i9(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function As(){const e=f.useContext(C5);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function s9({children:e}){const{latestMessage:t}=N5(),{user:n,token:r,isLoading:a}=Qo(),[i,o]=f.useState([]),[l,c]=f.useState(null),[d,u]=f.useState(null),[p,h]=f.useState(null),[m,g]=f.useState([]),[b,x]=f.useState(null),[y,v]=f.useState(!1),[w,S]=f.useState(!1),[E,k]=f.useState(!1),[T,_]=f.useState(null),C=f.useRef(null);f.useEffect(()=>{C.current=l?.name??null},[l?.name]);const I=f.useCallback(()=>{_(null)},[]),O=f.useCallback((B,W)=>{console.error(`TaskMaster ${B} error:`,W),_(r9(B,W))},[]),A=f.useCallback(B=>{const W=B?Ny(B):null;c(W),u(W?.taskmaster??null),g([]),x(null)},[]),R=f.useCallback(async()=>{if(!n||!r){o([]),c(null),u(null),g([]),x(null);return}try{v(!0),I();const B=await Qe.get("/projects");if(!B.ok)throw new Error(`Failed to fetch projects: ${B.status}`);const W=await B.json(),L=(Array.isArray(W)?W:[]).map(M=>Ny(M));o(L);const G=C.current;if(!G)return;const U=L.find(M=>M.name===G)??null;c(U),u(U?.taskmaster??null)}catch(B){O("load projects",B)}finally{v(!1)}},[I,O,r,n]),N=f.useCallback(async()=>{const B=l?.name;if(!B||!n||!r){g([]),x(null);return}try{S(!0),I();const W=await Qe.get(`/taskmaster/tasks/${encodeURIComponent(B)}`);if(!W.ok){const G=await W.json();throw new Error(G.message??"Failed to load tasks")}const H=await W.json(),L=Array.isArray(H.tasks)?H.tasks:[];g(L),x(a9(L))}catch(W){O("load tasks",W),g([]),x(null)}finally{S(!1)}},[I,l?.name,O,r,n]),F=f.useCallback(async()=>{if(!n||!r){h(null);return}try{k(!0),I();const B=await Qe.get("/mcp-utils/taskmaster-server");if(!B.ok)throw new Error(`Failed to load MCP status: ${B.status}`);const W=await B.json();h(W)}catch(B){O("check MCP server status",B),h(null)}finally{k(!1)}},[I,O,r,n]);f.useEffect(()=>{!a&&n&&r&&(R(),F())},[a,F,R,r,n]),f.useEffect(()=>{l?.name&&n&&r&&N()},[l?.name,N,r,n]),f.useEffect(()=>{const B=t;if(i9(B)){if(B.type==="taskmaster-project-updated"&&B.projectName){R();return}if(B.type==="taskmaster-tasks-updated"&&B.projectName===l?.name){N();return}B.type==="taskmaster-mcp-status-changed"&&F()}},[l?.name,t,F,R,N]);const K=f.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:d,mcpServerStatus:p,tasks:m,nextTask:b,isLoading:y,isLoadingTasks:w,isLoadingMCP:E,error:T,refreshProjects:R,setCurrentProject:A,refreshTasks:N,refreshMCPStatus:F,clearError:I}),[I,l,T,y,E,w,p,b,d,i,F,R,N,A,m]);return s.jsx(C5.Provider,{value:K,children:e})}const T5=f.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),Jc=()=>{const e=f.useContext(T5);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},o9=({children:e})=>{const[t,n]=f.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[r,a]=f.useState(null),[i,o]=f.useState(null),[l,c]=f.useState(null),[d,u]=f.useState(!0);f.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),f.useEffect(()=>{setTimeout(async()=>{try{const g=await Qe.get("/taskmaster/installation-status");if(g.ok){const b=await g.json();c(b),a(b.installation?.isInstalled||!1),o(b.isReady||!1);const x=localStorage.getItem("tasks-enabled");!b.installation?.isInstalled&&!x&&n(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(g){console.error("Error checking TaskMaster installation:",g),a(!1),o(!1)}finally{u(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:n,toggleTasksEnabled:()=>{n(m=>!m)},isTaskMasterInstalled:r,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:d};return s.jsx(T5.Provider,{value:h,children:e})},A5=f.createContext(null);function Qc(){const e=f.useContext(A5);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function l9({children:e}){const[t,n]=f.useState([]),[r,a]=f.useState(!0),[i,o]=f.useState(null),l=f.useCallback(async()=>{try{const h=await we("/api/plugins");if(h.ok){const m=await h.json();n(m.plugins||[]),o(null)}else{let m=`Failed to fetch plugins (${h.status})`;try{const g=await h.json();m=g.details||g.error||m}catch{m=h.statusText||m}o(m)}}catch(h){const m=h instanceof Error?h.message:"Failed to fetch plugins";o(m),console.error("[Plugins] Failed to fetch plugins:",h)}finally{a(!1)}},[]);f.useEffect(()=>{l()},[l]);const c=f.useCallback(async h=>{try{const m=await we("/api/plugins/install",{method:"POST",body:JSON.stringify({url:h})}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Install failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Install failed"}}},[l]),d=f.useCallback(async h=>{try{const m=await we(`/api/plugins/${encodeURIComponent(h)}`,{method:"DELETE"}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Uninstall failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Uninstall failed"}}},[l]),u=f.useCallback(async h=>{try{const m=await we(`/api/plugins/${encodeURIComponent(h)}/update`,{method:"POST"}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Update failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Update failed"}}},[l]),p=f.useCallback(async(h,m)=>{try{const g=await we(`/api/plugins/${encodeURIComponent(h)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!g.ok){let b=`Toggle failed (${g.status})`;try{const x=await g.json();b=x.details||x.error||b}catch{b=g.statusText||b}return{success:!1,error:b}}return await l(),{success:!0,error:null}}catch(g){return{success:!1,error:g instanceof Error?g.message:"Toggle failed"}}},[l]);return s.jsx(A5.Provider,{value:{plugins:t,loading:r,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:d,updatePlugin:u,togglePlugin:p},children:e})}const Cy=e=>typeof window>"u"?!1:window.innerWidth<e,Ty=()=>{if(typeof window>"u")return!1;const e=window.navigator;return window.matchMedia("(display-mode: standalone)").matches||!!e.standalone||document.referrer.includes("android-app://")};function m0(e={}){const{mobileBreakpoint:t=768,trackMobile:n=!0,trackPWA:r=!0}=e,[a,i]=f.useState(()=>n?Cy(t):!1),[o,l]=f.useState(()=>r?Ty():!1);return f.useEffect(()=>{if(!n||typeof window>"u")return;const c=()=>{i(Cy(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,n]),f.useEffect(()=>{if(!r||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),d=()=>{l(Ty())};return d(),typeof c.addEventListener=="function"?(c.addEventListener("change",d),()=>{c.removeEventListener("change",d)}):(c.addListener(d),()=>{c.removeListener(d)})},[r]),{isMobile:a,isPWA:o}}const c9=(e,t)=>{const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let a=0;a<Math.max(n.length,r.length);a++){const i=n[a]||0,o=r[a]||0;if(i!==o)return i-o}return 0},d9="1.33.3",_5=(e,t)=>{const[n,r]=f.useState(!1),[a,i]=f.useState(null),[o,l]=f.useState(null),[c,d]=f.useState("git"),[u,p]=f.useState(d9);return f.useEffect(()=>{let h=!1;const m=async()=>{try{const x=await(await fetch("/health",{cache:"no-store"})).json();if(h)return;(x.installMode==="npm"||x.installMode==="git")&&d(x.installMode),typeof x.version=="string"&&/^\d+\.\d+\.\d+/.test(x.version)&&p(x.version)}catch{}};m();const g=()=>{m()};return window.addEventListener("focus",g),()=>{h=!0,window.removeEventListener("focus",g)}},[]),f.useEffect(()=>{if(!u)return;const h=async()=>{try{const x=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(x.tag_name){const y=x.tag_name.replace(/^v/,"");i(y),r(c9(y,u)>0),l({title:x.name||x.tag_name,body:x.body||"",htmlUrl:x.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:x.published_at})}else r(!1),i(null),l(null)}catch(b){console.error("Version check failed:",b),r(!1),i(null),l(null)}};h();const m=setInterval(h,1800*1e3),g=()=>{h()};return window.addEventListener("focus",g),()=>{clearInterval(m),window.removeEventListener("focus",g)}},[e,t,u]),{updateAvailable:n,latestVersion:a,currentVersion:u,releaseInfo:o,installMode:c}},si={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0,historyView:"flat"},u9=["flat","grouped"],p9=e=>typeof e=="string"&&u9.includes(e),xc=Object.keys(si),m9=new Set(xc),$d="ui-preferences:sync",h9=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},yc=(e,t,n)=>e==="historyView"?p9(t)?t:n:h9(t,n),f9=(e,t)=>{try{const n=localStorage.getItem(e);if(n===null)return t;const r=JSON.parse(n);return yc(e,r,t)}catch{return t}},g9=e=>{if(typeof window>"u")return si;try{const t=localStorage.getItem(e);if(t){const n=JSON.parse(t);if(n&&typeof n=="object"&&!Array.isArray(n)){const r=n;return xc.reduce((a,i)=>(a[i]=yc(i,r[i],si[i]),a),{...si})}}}catch{}return xc.reduce((t,n)=>(t[n]=f9(n,si[n]),t),{...si})};function b9(e,t){switch(t.type){case"set":{const{key:n,value:r}=t;if(!m9.has(n))return e;const a=yc(n,r,e[n]);return e[n]===a?e:{...e,[n]:a}}case"set_many":{const n=t.value||{};let r=!1;const a={...e};for(const i of xc){if(!(i in n))continue;const o=n[i],l=yc(i,o,e[i]);a[i]!==l&&(a[i]=l,r=!0)}return r?a:e}case"reset":return{...si,...t.value||{}};default:return e}}function h0(e="uiPreferences"){const t=f.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[n,r]=f.useReducer(b9,e,g9);return f.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(n)),window.dispatchEvent(new CustomEvent($d,{detail:{storageKey:e,sourceId:t.current,value:n}})))},[n,e]),f.useEffect(()=>{if(typeof window>"u")return;const l=u=>{!u||typeof u!="object"||Array.isArray(u)||r({type:"set_many",value:u})},c=u=>{if(!(u.key!==e||u.newValue===null))try{const p=JSON.parse(u.newValue);l(p)}catch{}},d=u=>{const h=u.detail;!h||h.storageKey!==e||h.sourceId===t.current||l(h.value)};return window.addEventListener("storage",c),window.addEventListener($d,d),()=>{window.removeEventListener("storage",c),window.removeEventListener($d,d)}},[e]),{preferences:n,setPreference:(l,c)=>{r({type:"set",key:l,value:c})},setPreferences:l=>{r({type:"set_many",value:l})},resetPreferences:l=>{r({type:"reset",value:l})},dispatch:r}}const x9=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},y9=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},v9=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},Ay=(e,t)=>`${e}::${t}`,w9=()=>{try{const e=localStorage.getItem("starredSessions");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},k9=e=>{try{localStorage.setItem("starredSessions",JSON.stringify([...e]))}catch{}},S9=/(?:^|[\s/\\(\[`"'])([\w./-]+?\.(?:ts|tsx|js|jsx|mjs|cjs|py|rb|go|rs|java|kt|swift|c|cc|cpp|h|hpp|cs|php|sh|bash|zsh|json|ya?ml|toml|md|mdx|html?|css|scss|less|sql|prisma|graphql|gql|vue|svelte|astro|dart|lua|r|pl|ps1|tf|dockerfile|env))(?:$|[\s:,)\]`"'])/i,E9=e=>{if(!e)return[];const t=new Set,n=new RegExp(S9.source,"gi");let r;for(;(r=n.exec(e))!==null;){const a=r[1],i=a.lastIndexOf(".");if(i>-1){const o=a.slice(i+1).toLowerCase();o&&o.length<=10&&t.add(o)}if(t.size>=3)break}return[...t]},pi=e=>e.__provider==="cursor"?new Date(e.createdAt||0):e.__provider==="codex"?new Date(e.createdAt||e.lastActivity||0):new Date(e.lastActivity||e.createdAt||0),N9=(e,t)=>e.__provider==="cursor"?e.summary||e.name||t("projects.untitledSession"):e.__provider==="codex"?e.summary||e.name||t("projects.codexSession"):e.__provider==="gemini"||e.__provider==="qwen"?e.summary||e.name||t("projects.newSession"):e.summary||t("projects.newSession"),C9=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),T9=(e,t,n)=>{const r=pi(e),a=Math.floor((t.getTime()-r.getTime())/(1e3*60));return{isCursorSession:e.__provider==="cursor",isCodexSession:e.__provider==="codex",isGeminiSession:e.__provider==="gemini",isQwenSession:e.__provider==="qwen",isActive:a<10,sessionName:N9(e,n),sessionTime:C9(e),messageCount:Number(e.messageCount||0)}},I5=(e,t)=>{const n=[...e.sessions||[],...t[e.name]||[]].map(p=>({...p,__provider:"claude"})),r=(e.cursorSessions||[]).map(p=>({...p,__provider:"cursor"})),a=(e.codexSessions||[]).map(p=>({...p,__provider:"codex"})),i=p=>typeof p.id=="string"&&p.id.startsWith("qwen_")||p.provider==="qwen",o=e.geminiSessions||[],l=o.filter(p=>!i(p)).map(p=>({...p,__provider:"gemini"})),c=o.filter(p=>i(p)).map(p=>({...p,__provider:"qwen"})),d=[...(e.qwenSessions||[]).map(p=>({...p,__provider:"qwen"})),...c],u=new Map;for(const p of[...n,...r,...a,...l,...d])u.has(p.id)||u.set(p.id,p);return[...u.values()].sort((p,h)=>pi(h).getTime()-pi(p).getTime())},_y=(e,t)=>{const n=I5(e,t);return n.length===0?new Date(0):n.reduce((r,a)=>{const i=pi(a);return i>r?i:r},new Date(0))},A9=(e,t,n,r)=>{const a=[...e];return a.sort((i,o)=>{const l=n.has(i.name),c=n.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?_y(o,r).getTime()-_y(i,r).getTime():(i.displayName||i.name).localeCompare(o.displayName||o.name)}),a},_9=(e,t)=>{const n=t.trim().toLowerCase();return n?e.filter(r=>{const a=(r.displayName||r.name).toLowerCase(),i=r.name.toLowerCase();return a.includes(n)||i.includes(n)}):e},I9=(e,t)=>{const n=!!e.taskmaster?.hasTaskmaster,r=!!(t?.hasMCPServer&&t?.isConfigured);return n&&r?"fully-configured":n?"taskmaster-only":r?"mcp-only":"not-configured"},j9=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.name,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.name,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function R9({projects:e,selectedProject:t,selectedSession:n,isLoading:r,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:d,onProjectDelete:u,setCurrentProject:p,setSidebarVisible:h,sidebarVisible:m}){const[g,b]=f.useState(new Set),[x,y]=f.useState(null),[v,w]=f.useState(!1),[S,E]=f.useState(""),[k,T]=f.useState({}),[_,C]=f.useState({}),[I,O]=f.useState(new Set),[A,R]=f.useState(new Date),[N,F]=f.useState("name"),[K,B]=f.useState(!1),[W,H]=f.useState({}),[L,G]=f.useState(null),[U,M]=f.useState(""),[J,te]=f.useState(""),[de,ue]=f.useState(new Set),[se,he]=f.useState(null),[Te,Ae]=f.useState(null),[De,Ue]=f.useState(!1),[P,pe]=f.useState(()=>y9()),[le,Y]=f.useState(()=>w9()),[q,re]=f.useState("projects"),[be,fe]=f.useState(null),[ae,ye]=f.useState(!1),[ee,ne]=f.useState(null),Z=f.useRef(null),oe=f.useRef(0),xe=f.useRef(null),Le=!a&&!m;f.useEffect(()=>{const me=setInterval(()=>{R(new Date)},6e4);return()=>clearInterval(me)},[]),f.useEffect(()=>{C({}),O(new Set),H({})},[e]),f.useEffect(()=>{t&&b(me=>{if(me.has(t.name))return me;const ve=new Set(me);return ve.add(t.name),ve})},[n,t]),f.useEffect(()=>{if(e.length>0&&!r){const me=new Set;e.forEach(ve=>{ve.sessions&&ve.sessions.length>=0&&me.add(ve.name)}),O(me)}},[e,r]),f.useEffect(()=>{const me=()=>{F(x9())};me();const ve=_e=>{_e.key==="claude-settings"&&me()},ke=()=>me();return window.addEventListener("storage",ve),window.addEventListener("pixcode:settings-changed",ke),()=>{window.removeEventListener("storage",ve),window.removeEventListener("pixcode:settings-changed",ke)}},[]),f.useEffect(()=>{Z.current&&clearTimeout(Z.current),xe.current&&(xe.current.close(),xe.current=null);const me=J.trim();if(q!=="conversations"||me.length<2){oe.current+=1,fe(null),ne(null),ye(!1);return}ye(!0);const ve=++oe.current;return Z.current=setTimeout(()=>{if(ve!==oe.current)return;const ke=Qe.searchConversationsUrl(me),_e=new EventSource(ke);xe.current=_e;const qe=[];let dt=0;_e.addEventListener("result",Xe=>{if(ve!==oe.current){_e.close();return}try{const Kt=JSON.parse(Xe.data);qe.push(Kt.projectResult),dt=Kt.totalMatches,fe({results:[...qe],totalMatches:dt,query:me}),ne({scannedProjects:Kt.scannedProjects,totalProjects:Kt.totalProjects})}catch{}}),_e.addEventListener("progress",Xe=>{if(ve!==oe.current){_e.close();return}try{const Kt=JSON.parse(Xe.data);dt=Kt.totalMatches,ne({scannedProjects:Kt.scannedProjects,totalProjects:Kt.totalProjects})}catch{}}),_e.addEventListener("done",()=>{if(ve!==oe.current){_e.close();return}_e.close(),xe.current=null,ye(!1),ne(null),qe.length===0&&fe({results:[],totalMatches:0,query:me})}),_e.addEventListener("error",()=>{if(ve!==oe.current){_e.close();return}_e.close(),xe.current=null,ye(!1),ne(null),qe.length===0&&fe({results:[],totalMatches:0,query:me})})},400),()=>{Z.current&&clearTimeout(Z.current),xe.current&&(xe.current.close(),xe.current=null)}},[J,q]),f.useCallback(me=>ve=>{const ke=ve.target;ke.closest(".overflow-y-auto")||ke.closest("[data-scroll-container]")||(ve.preventDefault(),ve.stopPropagation(),me())},[]);const Be=f.useCallback(me=>{b(ve=>{const ke=new Set;return ve.has(me)||ke.add(me),ke})},[]),ot=f.useCallback((me,ve)=>{c({...me,__projectName:ve})},[c]),ht=f.useCallback(me=>{pe(ve=>{const ke=new Set(ve);return ke.has(me)?ke.delete(me):ke.add(me),v9(ke),ke})},[]),Ve=f.useCallback(me=>P.has(me),[P]),ct=f.useCallback((me,ve)=>{Y(ke=>{const _e=Ay(me,ve),qe=new Set(ke);return qe.has(_e)?qe.delete(_e):qe.add(_e),k9(qe),qe})},[]),At=f.useCallback((me,ve)=>le.has(Ay(me,ve)),[le]),Ze=f.useCallback(me=>I5(me,_),[_]),Rt=f.useMemo(()=>e.map(me=>{const ve=W[me.name];return ve===void 0?me:{...me,sessionMeta:{...me.sessionMeta,hasMore:ve}}}),[W,e]),xt=f.useMemo(()=>A9(Rt,N,P,_),[_,N,Rt,P]),$n=f.useMemo(()=>_9(xt,J),[J,xt]),Un=f.useCallback(me=>{y(me.name),E(me.displayName)},[]),Ht=f.useCallback(()=>{y(null),E("")},[]),un=f.useCallback(async me=>{try{(await Qe.renameProject(me,S)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(ve){console.error("Error renaming project:",ve)}finally{y(null),E("")}},[S]),je=f.useCallback((me,ve,ke,_e="claude")=>{Ae({projectName:me,sessionId:ve,sessionTitle:ke,provider:_e})},[]),nt=f.useCallback(async()=>{if(!Te)return;const{projectName:me,sessionId:ve,provider:ke}=Te;Ae(null);try{let _e;if(ke==="codex"?_e=await Qe.deleteCodexSession(ve):ke==="gemini"?_e=await Qe.deleteGeminiSession(ve):ke==="qwen"?_e=await Qe.deleteQwenSession(ve):_e=await Qe.deleteSession(me,ve),_e.ok)d?.(ve);else{const qe=await _e.text();console.error("[Sidebar] Failed to delete session:",{status:_e.status,error:qe}),alert(i("messages.deleteSessionFailed"))}}catch(_e){console.error("[Sidebar] Error deleting session:",_e),alert(i("messages.deleteSessionError"))}},[d,Te,i]),Je=f.useCallback(me=>{he({project:me,sessionCount:Ze(me).length})},[Ze]),pt=f.useCallback(async(me=!1)=>{if(!se)return;const{project:ve,sessionCount:ke}=se,_e=ke===0;he(null),ue(qe=>new Set([...qe,ve.name]));try{const qe=await Qe.deleteProject(ve.name,!_e,me);if(qe.ok)u?.(ve.name);else{const dt=await qe.json();alert(dt.error||i("messages.deleteProjectFailed"))}}catch(qe){console.error("Error deleting project:",qe),alert(i("messages.deleteProjectError"))}finally{ue(qe=>{const dt=new Set(qe);return dt.delete(ve.name),dt})}},[se,u,i]),yt=f.useCallback(async me=>{const ve=W[me.name];if(!(!(ve!==void 0?ve:me.sessionMeta?.hasMore===!0)||k[me.name])){T(_e=>({..._e,[me.name]:!0}));try{const _e=(me.sessions?.length||0)+(_[me.name]?.length||0),qe=await Qe.sessions(me.name,5,_e);if(!qe.ok)return;const dt=await qe.json();C(Xe=>({...Xe,[me.name]:[...Xe[me.name]||[],...dt.sessions||[]]})),dt.hasMore===!1&&H(Xe=>({...Xe,[me.name]:!1}))}catch(_e){console.error("Error loading more sessions:",_e)}finally{T(_e=>({..._e,[me.name]:!1}))}}},[_,k,W]),_t=f.useCallback(me=>{l(me),p(me)},[l,p]),ir=f.useCallback(async()=>{B(!0);try{await o()}finally{B(!1)}},[o]),sr=f.useCallback(async(me,ve,ke,_e)=>{const qe=ke.trim();if(!qe){G(null),M("");return}try{const dt=await Qe.renameSession(ve,qe,_e);dt.ok?await o():(console.error("[Sidebar] Failed to rename session:",dt.status),alert(i("messages.renameSessionFailed")))}catch(dt){console.error("[Sidebar] Error renaming session:",dt),alert(i("messages.renameSessionError"))}finally{G(null),M("")}},[o,i]),or=f.useCallback(()=>{h(!1)},[h]),ft=f.useCallback(()=>{h(!0)},[h]);return{isSidebarCollapsed:Le,expandedProjects:g,editingProject:x,showNewProject:v,editingName:S,loadingSessions:k,additionalSessions:_,initialSessionsLoaded:I,currentTime:A,projectSortOrder:N,isRefreshing:K,editingSession:L,editingSessionName:U,searchFilter:J,deletingProjects:de,deleteConfirmation:se,sessionDeleteConfirmation:Te,showVersionModal:De,starredProjects:P,starredSessions:le,filteredProjects:$n,toggleProject:Be,handleSessionClick:ot,toggleStarProject:ht,isProjectStarred:Ve,toggleStarSession:ct,isSessionStarred:At,getProjectSessions:Ze,startEditing:Un,cancelEditing:Ht,saveProjectName:un,showDeleteSessionConfirmation:je,confirmDeleteSession:nt,requestProjectDelete:Je,confirmDeleteProject:pt,loadMoreSessions:yt,handleProjectSelect:_t,refreshProjects:ir,updateSessionSummary:sr,collapseSidebar:or,expandSidebar:ft,setShowNewProject:w,setEditingName:E,setEditingSession:G,setEditingSessionName:M,searchMode:q,setSearchMode:re,conversationResults:be,isSearching:ae,searchProgress:ee,clearConversationResults:f.useCallback(()=>{oe.current+=1,xe.current&&(xe.current.close(),xe.current=null),ye(!1),ne(null),fe(null)},[]),setSearchFilter:te,setDeleteConfirmation:he,setSessionDeleteConfirmation:Ae,setShowVersionModal:Ue}}const D9="https://discord.gg/buxwujPNRE",O9="https://github.com/alicomert/pixcode/issues/new";function L9({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function M9({onExpand:e,onShowSettings:t,updateAvailable:n,onShowVersionModal:r,t:a}){return s.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[s.jsx("button",{onClick:e,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.showSidebar"),title:a("common:versionUpdate.ariaLabels.showSidebar"),children:s.jsx(tj,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("div",{className:"nav-divider my-1 w-6"}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.settings"),title:a("actions.settings"),children:s.jsx(kt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:O9,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.reportIssue"),title:a("actions.reportIssue"),children:s.jsx(Dp,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:D9,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.joinCommunity"),title:a("actions.joinCommunity"),children:s.jsx(L9,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),n&&s.jsxs("button",{onClick:r,className:"relative flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.updateAvailable"),title:a("common:versionUpdate.ariaLabels.updateAvailable"),children:[s.jsx(sa,{className:"h-4 w-4 text-blue-500"}),s.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function j5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=j5(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function R5(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=j5(e))&&(r&&(r+=" "),r+=t);return r}const Iy=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,jy=R5,f0=(e,t)=>n=>{var r;if(t?.variants==null)return jy(e,n?.class,n?.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(d=>{const u=n?.[d],p=i?.[d];if(u===null)return null;const h=Iy(u)||Iy(p);return a[d][h]}),l=n&&Object.entries(n).reduce((d,u)=>{let[p,h]=u;return h===void 0||(d[p]=h),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,u)=>{let{class:p,className:h,...m}=u;return Object.entries(m).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...i,...l}[b]):{...i,...l}[b]===x})?[...d,p,h]:d},[]);return jy(e,o,c,n?.class,n?.className)},g0="-",P9=e=>{const t=z9(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(g0);return l[0]===""&&l.length!==1&&l.shift(),D5(l,t)||F9(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},D5=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),a=r?D5(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(g0);return t.validators.find(({validator:o})=>o(i))?.classGroupId},Ry=/^\[(.+)\]$/,F9=e=>{if(Ry.test(e)){const t=Ry.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},z9=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const a in n)zp(n[a],r,a,t);return r},zp=(e,t,n,r)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:Dy(t,a);i.classGroupId=n;return}if(typeof a=="function"){if(B9(a)){zp(a(r),t,n,r);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([i,o])=>{zp(o,Dy(t,i),n,r)})})},Dy=(e,t)=>{let n=e;return t.split(g0).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},B9=e=>e.isThemeGetter,$9=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const a=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return a(i,o),o},set(i,o){n.has(i)?n.set(i,o):a(i,o)}}},Bp="!",$p=":",U9=$p.length,G9=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=a=>{const i=[];let o=0,l=0,c=0,d;for(let g=0;g<a.length;g++){let b=a[g];if(o===0&&l===0){if(b===$p){i.push(a.slice(c,g)),c=g+U9;continue}if(b==="/"){d=g;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const u=i.length===0?a:a.substring(c),p=H9(u),h=p!==u,m=d&&d>c?d-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+$p,i=r;r=o=>o.startsWith(a)?i(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},H9=e=>e.endsWith(Bp)?e.substring(0,e.length-1):e.startsWith(Bp)?e.substring(1):e,q9=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const a=[];let i=[];return r.forEach(o=>{o[0]==="["||t[o]?(a.push(...i.sort(),o),i=[]):i.push(o)}),a.push(...i.sort()),a}},V9=e=>({cache:$9(e.cacheSize),parseClassName:G9(e),sortModifiers:q9(e),...P9(e)}),W9=/\s+/,K9=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(W9);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:h,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:b}=n(u);if(p){c=u+(c.length>0?" "+c:c);continue}let x=!!b,y=r(x?g.substring(0,b):g);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=r(g),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const v=i(h).join(":"),w=m?v+Bp:v,S=w+y;if(o.includes(S))continue;o.push(S);const E=a(y,x);for(let k=0;k<E.length;++k){const T=E[k];o.push(w+T)}c=u+(c.length>0?" "+c:c)}return c};function Y9(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=O5(t))&&(r&&(r+=" "),r+=n);return r}const O5=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=O5(e[r]))&&(n&&(n+=" "),n+=t);return n};function Z9(e,...t){let n,r,a,i=o;function o(c){const d=t.reduce((u,p)=>p(u),e());return n=V9(d),r=n.cache.get,a=n.cache.set,i=l,l(c)}function l(c){const d=r(c);if(d)return d;const u=K9(c,n);return a(c,u),u}return function(){return i(Y9.apply(null,arguments))}}const Qt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},L5=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,M5=/^\((?:(\w[\w-]*):)?(.+)\)$/i,X9=/^\d+\/\d+$/,J9=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Q9=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,eD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,nD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$i=e=>X9.test(e),rt=e=>!!e&&!Number.isNaN(Number(e)),va=e=>!!e&&Number.isInteger(Number(e)),Ud=e=>e.endsWith("%")&&rt(e.slice(0,-1)),Yr=e=>J9.test(e),rD=()=>!0,aD=e=>Q9.test(e)&&!eD.test(e),P5=()=>!1,iD=e=>tD.test(e),sD=e=>nD.test(e),oD=e=>!Fe(e)&&!ze(e),lD=e=>_s(e,B5,P5),Fe=e=>L5.test(e),Ja=e=>_s(e,$5,aD),Gd=e=>_s(e,mD,rt),Oy=e=>_s(e,F5,P5),cD=e=>_s(e,z5,sD),xl=e=>_s(e,U5,iD),ze=e=>M5.test(e),Zs=e=>Is(e,$5),dD=e=>Is(e,hD),Ly=e=>Is(e,F5),uD=e=>Is(e,B5),pD=e=>Is(e,z5),yl=e=>Is(e,U5,!0),_s=(e,t,n)=>{const r=L5.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Is=(e,t,n=!1)=>{const r=M5.exec(e);return r?r[1]?t(r[1]):n:!1},F5=e=>e==="position"||e==="percentage",z5=e=>e==="image"||e==="url",B5=e=>e==="length"||e==="size"||e==="bg-size",$5=e=>e==="length",mD=e=>e==="number",hD=e=>e==="family-name",U5=e=>e==="shadow",fD=()=>{const e=Qt("color"),t=Qt("font"),n=Qt("text"),r=Qt("font-weight"),a=Qt("tracking"),i=Qt("leading"),o=Qt("breakpoint"),l=Qt("container"),c=Qt("spacing"),d=Qt("radius"),u=Qt("shadow"),p=Qt("inset-shadow"),h=Qt("text-shadow"),m=Qt("drop-shadow"),g=Qt("blur"),b=Qt("perspective"),x=Qt("aspect"),y=Qt("ease"),v=Qt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...S(),ze,Fe],k=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],_=()=>[ze,Fe,c],C=()=>[$i,"full","auto",..._()],I=()=>[va,"none","subgrid",ze,Fe],O=()=>["auto",{span:["full",va,ze,Fe]},va,ze,Fe],A=()=>[va,"auto",ze,Fe],R=()=>["auto","min","max","fr",ze,Fe],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",..._()],B=()=>[$i,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],W=()=>[e,ze,Fe],H=()=>[...S(),Ly,Oy,{position:[ze,Fe]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",uD,lD,{size:[ze,Fe]}],U=()=>[Ud,Zs,Ja],M=()=>["","none","full",d,ze,Fe],J=()=>["",rt,Zs,Ja],te=()=>["solid","dashed","dotted","double"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[rt,Ud,Ly,Oy],se=()=>["","none",g,ze,Fe],he=()=>["none",rt,ze,Fe],Te=()=>["none",rt,ze,Fe],Ae=()=>[rt,ze,Fe],De=()=>[$i,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Yr],breakpoint:[Yr],color:[rD],container:[Yr],"drop-shadow":[Yr],ease:["in","out","in-out"],font:[oD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Yr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Yr],shadow:[Yr],spacing:["px",rt],text:[Yr],"text-shadow":[Yr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$i,Fe,ze,x]}],container:["container"],columns:[{columns:[rt,Fe,ze,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:C()}],"inset-x":[{"inset-x":C()}],"inset-y":[{"inset-y":C()}],start:[{start:C()}],end:[{end:C()}],top:[{top:C()}],right:[{right:C()}],bottom:[{bottom:C()}],left:[{left:C()}],visibility:["visible","invisible","collapse"],z:[{z:[va,"auto",ze,Fe]}],basis:[{basis:[$i,"full","auto",l,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[rt,$i,"auto","initial","none",Fe]}],grow:[{grow:["",rt,ze,Fe]}],shrink:[{shrink:["",rt,ze,Fe]}],order:[{order:[va,"first","last","none",ze,Fe]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],w:[{w:[l,"screen",...B()]}],"min-w":[{"min-w":[l,"screen","none",...B()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",n,Zs,Ja]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ze,Gd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ud,Fe]}],"font-family":[{font:[dD,Fe,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,ze,Fe]}],"line-clamp":[{"line-clamp":[rt,"none",ze,Gd]}],leading:[{leading:[i,..._()]}],"list-image":[{"list-image":["none",ze,Fe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ze,Fe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[rt,"from-font","auto",ze,Ja]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[rt,"auto",ze,Fe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ze,Fe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ze,Fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},va,ze,Fe],radial:["",ze,Fe],conic:[va,ze,Fe]},pD,cD]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:M()}],"rounded-s":[{"rounded-s":M()}],"rounded-e":[{"rounded-e":M()}],"rounded-t":[{"rounded-t":M()}],"rounded-r":[{"rounded-r":M()}],"rounded-b":[{"rounded-b":M()}],"rounded-l":[{"rounded-l":M()}],"rounded-ss":[{"rounded-ss":M()}],"rounded-se":[{"rounded-se":M()}],"rounded-ee":[{"rounded-ee":M()}],"rounded-es":[{"rounded-es":M()}],"rounded-tl":[{"rounded-tl":M()}],"rounded-tr":[{"rounded-tr":M()}],"rounded-br":[{"rounded-br":M()}],"rounded-bl":[{"rounded-bl":M()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[rt,ze,Fe]}],"outline-w":[{outline:["",rt,Zs,Ja]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",u,yl,xl]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",p,yl,xl]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[rt,Ja]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",h,yl,xl]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[rt,ze,Fe]}],"mix-blend":[{"mix-blend":[...de(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":de()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[rt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[ze,Fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[rt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ze,Fe]}],filter:[{filter:["","none",ze,Fe]}],blur:[{blur:se()}],brightness:[{brightness:[rt,ze,Fe]}],contrast:[{contrast:[rt,ze,Fe]}],"drop-shadow":[{"drop-shadow":["","none",m,yl,xl]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",rt,ze,Fe]}],"hue-rotate":[{"hue-rotate":[rt,ze,Fe]}],invert:[{invert:["",rt,ze,Fe]}],saturate:[{saturate:[rt,ze,Fe]}],sepia:[{sepia:["",rt,ze,Fe]}],"backdrop-filter":[{"backdrop-filter":["","none",ze,Fe]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[rt,ze,Fe]}],"backdrop-contrast":[{"backdrop-contrast":[rt,ze,Fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",rt,ze,Fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[rt,ze,Fe]}],"backdrop-invert":[{"backdrop-invert":["",rt,ze,Fe]}],"backdrop-opacity":[{"backdrop-opacity":[rt,ze,Fe]}],"backdrop-saturate":[{"backdrop-saturate":[rt,ze,Fe]}],"backdrop-sepia":[{"backdrop-sepia":["",rt,ze,Fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ze,Fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[rt,"initial",ze,Fe]}],ease:[{ease:["linear","initial",y,ze,Fe]}],delay:[{delay:[rt,ze,Fe]}],animate:[{animate:["none",v,ze,Fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,ze,Fe]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:Ae()}],"skew-x":[{"skew-x":Ae()}],"skew-y":[{"skew-y":Ae()}],transform:[{transform:[ze,Fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:De()}],"translate-x":[{"translate-x":De()}],"translate-y":[{"translate-y":De()}],"translate-z":[{"translate-z":De()}],"translate-none":["translate-none"],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ze,Fe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ze,Fe]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[rt,Zs,Ja,Gd]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},gD=Z9(fD);function ge(...e){return gD(R5(e))}function bD(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const xD=f0("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}}),G5=f.forwardRef(({className:e,variant:t,...n},r)=>s.jsx("div",{ref:r,role:"alert","data-slot":"alert",className:ge(xD({variant:t}),e),...n}));G5.displayName="Alert";const yD=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"alert-title",className:ge("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t}));yD.displayName="AlertTitle";const vD=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"alert-description",className:ge("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t}));vD.displayName="AlertDescription";const wD=f0("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function os({className:e,variant:t,...n}){return s.jsx("div",{className:ge(wD({variant:t}),e),...n})}const kD=f0("inline-flex touch-manipulation items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 active:bg-primary/80",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground active:bg-accent/80",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 active:bg-secondary/70",ghost:"hover:bg-accent hover:text-accent-foreground active:bg-accent/80",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-sm",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Pe=f.forwardRef(({className:e,variant:t,size:n,...r},a)=>s.jsx("button",{className:ge(kD({variant:t,size:n,className:e})),ref:a,...r}));Pe.displayName="Button";const H5=f.createContext(null),q5=()=>{const e=f.useContext(H5);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},V5=({className:e,approval:t="pending",children:n,...r})=>{const a=f.useMemo(()=>({approval:t}),[t]);return s.jsx(H5.Provider,{value:a,children:s.jsx(G5,{className:ge("flex flex-col gap-2",e),...r,children:n})})};V5.displayName="Confirmation";const W5=({className:e,...t})=>s.jsx("div",{"data-slot":"confirmation-title",className:ge("text-muted-foreground inline text-sm",e),...t});W5.displayName="ConfirmationTitle";const K5=({children:e})=>{const{approval:t}=q5();return t!=="pending"?null:s.jsx(s.Fragment,{children:e})};K5.displayName="ConfirmationRequest";const Y5=({className:e,...t})=>{const{approval:n}=q5();return n!=="pending"?null:s.jsx("div",{"data-slot":"confirmation-actions",className:ge("flex items-center justify-end gap-2 self-end",e),...t})};Y5.displayName="ConfirmationActions";const Xl=({variant:e="default",...t})=>s.jsx(Pe,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});Xl.displayName="ConfirmationAction";const Z5=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ge("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));Z5.displayName="Card";const X5=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ge("flex flex-col space-y-1.5 p-4",e),...t}));X5.displayName="CardHeader";const J5=f.forwardRef(({className:e,...t},n)=>s.jsx("h3",{ref:n,className:ge("font-semibold leading-none tracking-tight",e),...t}));J5.displayName="CardTitle";const SD=f.forwardRef(({className:e,...t},n)=>s.jsx("p",{ref:n,className:ge("text-sm text-muted-foreground",e),...t}));SD.displayName="CardDescription";const Q5=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ge("p-4 pt-0",e),...t}));Q5.displayName="CardContent";const e4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ge("flex items-center p-4 pt-0",e),...t}));e4.displayName="CardFooter";const ED=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ge("ml-auto shrink-0",e),...t}));ED.displayName="CardAction";const t4=f.createContext(null);function n4(){const e=f.useContext(t4);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const ki=f.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:n,className:r,children:a,...i},o)=>{const[l,c]=f.useState(e),d=t!==void 0,u=d?t:l,p=f.useCallback(m=>{d||c(m),n?.(m)},[d,n]),h=f.useMemo(()=>({open:u,onOpenChange:p}),[u,p]);return s.jsx(t4.Provider,{value:h,children:s.jsx("div",{ref:o,"data-state":u?"open":"closed",className:r,...i,children:a})})});ki.displayName="Collapsible";const Pa=f.forwardRef(({onClick:e,children:t,className:n,...r},a)=>{const{open:i,onOpenChange:o}=n4(),l=f.useCallback(c=>{o(!i),e?.(c)},[i,o,e]);return s.jsx("button",{ref:a,type:"button","aria-expanded":i,"data-state":i?"open":"closed",onClick:l,className:n,...r,children:t})});Pa.displayName="CollapsibleTrigger";const Si=f.forwardRef(({className:e,children:t,...n},r)=>{const{open:a}=n4();return s.jsx("div",{ref:r,"data-state":a?"open":"closed",className:ge("grid transition-[grid-template-rows] duration-200 ease-out",a?"grid-rows-[1fr]":"grid-rows-[0fr]",e),...n,children:s.jsx("div",{className:"overflow-hidden",children:t})})});Si.displayName="CollapsibleContent";const r4=f.createContext(null);function b0(){const e=f.useContext(r4);if(!e)throw new Error("Command components must be used within <Command>");return e}const a4=f.forwardRef(({className:e,children:t,...n},r)=>{const[a,i]=f.useState(""),o=f.useRef(new Map),[l,c]=f.useState(0),d=f.useCallback(v=>{o.current.set(v.id,v),c(w=>w+1)},[]),u=f.useCallback(v=>{o.current.delete(v),c(w=>w+1)},[]),p=f.useCallback((v,w)=>{const S=o.current.get(v);S&&Object.assign(S,w)},[]),h=f.useMemo(()=>{const v=a.toLowerCase(),w=new Set;for(const[S,E]of o.current)(!v||E.value.includes(v))&&w.add(S);return w},[a,l]),m=f.useMemo(()=>{const v=[];for(const[,w]of o.current)h.has(w.id)&&v.push(w);return v},[h]),[g,b]=f.useState(null);f.useEffect(()=>{b(m.length>0?m[0].id:null)},[m]);const x=f.useCallback(v=>{if(v.key==="ArrowDown"||v.key==="ArrowUp"||v.key==="Enter")v.preventDefault();else return;const w=m;if(w.length===0)return;if(v.key==="Enter"){w.find(C=>C.id===g)?.onSelect();return}const S=w.findIndex(_=>_.id===g);let E;v.key==="ArrowDown"?E=S<w.length-1?S+1:0:E=S>0?S-1:w.length-1;const k=w[E].id;b(k),w[E].element?.scrollIntoView({block:"nearest"})},[m,g]),y=f.useMemo(()=>({search:a,setSearch:i,visibleIds:h,activeId:g,setActiveId:b,register:d,unregister:u,updateEntry:p}),[a,h,g,d,u,p]);return s.jsx(r4.Provider,{value:y,children:s.jsx("div",{ref:r,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox",className:ge("flex flex-col",e),onKeyDown:x,...n,children:t})})});a4.displayName="Command";const i4=f.forwardRef(({className:e,placeholder:t="Search...",...n},r)=>{const{search:a,setSearch:i}=b0();return s.jsxs("div",{className:"flex items-center border-b px-3",role:"presentation",children:[s.jsx(ia,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsx("input",{ref:r,type:"text",role:"searchbox","aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:!1,value:a,onChange:o=>i(o.target.value),placeholder:t,className:ge("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n})]})});i4.displayName="CommandInput";const s4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,role:"listbox",className:ge("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));s4.displayName="CommandList";const o4=f.forwardRef(({className:e,...t},n)=>{const{search:r,visibleIds:a}=b0();return!r||a.size>0?null:s.jsx("div",{ref:n,className:ge("py-6 text-center text-sm text-muted-foreground",e),...t})});o4.displayName="CommandEmpty";const l4=f.forwardRef(({className:e,heading:t,children:n,...r},a)=>s.jsxs("div",{ref:a,className:ge("overflow-hidden p-1",e),role:"group","aria-label":typeof t=="string"?t:void 0,...r,children:[t&&s.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",role:"presentation",children:t}),n]}));l4.displayName="CommandGroup";const c4=f.forwardRef(({className:e,value:t,onSelect:n,disabled:r,children:a,...i},o)=>{const{visibleIds:l,activeId:c,setActiveId:d,register:u,unregister:p,updateEntry:h}=b0(),m=f.useId(),g=f.useRef(null),b=t||(typeof a=="string"?a:"");f.useEffect(()=>(u({id:m,value:b.toLowerCase(),onSelect:n||(()=>{}),element:g.current}),()=>p(m)),[m,b,u,p]),f.useEffect(()=>{h(m,{onSelect:n||(()=>{})})},[m,n,h]);const x=f.useCallback(v=>{g.current=v,h(m,{element:v}),typeof o=="function"?o(v):o&&(o.current=v)},[m,h,o]);if(!l.has(m))return null;const y=c===m;return s.jsx("div",{ref:x,role:"option","aria-selected":y,"aria-disabled":r||void 0,"data-active":y||void 0,className:ge("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",y&&"bg-accent text-accent-foreground",r&&"pointer-events-none opacity-50",e),onPointerMove:()=>{!r&&c!==m&&d(m)},onClick:()=>!r&&n?.(),...i,children:a})});c4.displayName="CommandItem";const ND=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ge("-mx-1 h-px bg-border",e),...t}));ND.displayName="CommandSeparator";function Up({checked:e,onToggle:t,ariaLabel:n="Toggle dark mode"}){const{isDarkMode:r,toggleDarkMode:a}=qa(),i=typeof e=="boolean"&&typeof t=="function",o=i?e:r,l=()=>{if(i&&t){t(!o);return}a()};return s.jsxs("button",{onClick:l,className:ge("relative inline-flex h-7 w-12 flex-shrink-0 touch-manipulation cursor-pointer items-center rounded-full border-2 transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",o?"border-primary bg-primary":"border-border bg-muted"),role:"switch","aria-checked":o,"aria-label":n,children:[s.jsx("span",{className:"sr-only",children:n}),s.jsx("span",{className:ge("flex h-5 w-5 transform items-center justify-center rounded-full shadow-sm transition-transform duration-200",o?"translate-x-[22px] bg-white":"translate-x-[2px] bg-foreground/60 dark:bg-foreground/80"),children:o?s.jsx(l0,{className:"h-3 w-3 text-primary"}):s.jsx(c0,{className:"h-3 w-3 text-white dark:text-background"})})]})}const d4=f.createContext(null);function u4(){const e=f.useContext(d4);if(!e)throw new Error("Dialog components must be used within <Dialog>");return e}const p4=({open:e,onOpenChange:t,defaultOpen:n=!1,children:r})=>{const[a,i]=f.useState(n),o=f.useRef(null),l=e!==void 0,c=l?e:a,d=f.useCallback(p=>{l||i(p),t?.(p)},[l,t]),u=f.useMemo(()=>({open:c,onOpenChange:d,triggerRef:o}),[c,d]);return s.jsx(d4.Provider,{value:u,children:r})},CD=f.forwardRef(({onClick:e,children:t,asChild:n,...r},a)=>{const{onOpenChange:i,triggerRef:o}=u4(),l=f.useCallback(c=>{i(!0),e?.(c)},[i,e]);if(n&&f.isValidElement(t)){const c=t;return f.cloneElement(c,{onClick:d=>{i(!0),c.props.onClick?.(d)},ref:d=>{o.current=d,typeof a=="function"?a(d):a&&(a.current=d)}})}return s.jsx("button",{ref:c=>{o.current=c,typeof a=="function"?a(c):a&&(a.current=c)},type:"button",onClick:l,...r,children:t})});CD.displayName="DialogTrigger";const My='a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',x0=f.forwardRef(({className:e,children:t,onEscapeKeyDown:n,onPointerDownOutside:r,...a},i)=>{const{open:o,onOpenChange:l,triggerRef:c}=u4(),d=f.useRef(null),u=f.useRef(null);return f.useEffect(()=>{o?u.current=document.activeElement:u.current&&((c.current||u.current)?.focus(),u.current=null)},[o,c]),f.useEffect(()=>{if(!o)return;const p=m=>{if(m.key==="Escape"){m.stopPropagation(),n?.(),l(!1);return}if(m.key==="Tab"&&d.current){const g=Array.from(d.current.querySelectorAll(My));if(g.length===0)return;const b=g[0],x=g[g.length-1];m.shiftKey&&document.activeElement===b?(m.preventDefault(),x.focus()):!m.shiftKey&&document.activeElement===x&&(m.preventDefault(),b.focus())}};document.addEventListener("keydown",p,!0);const h=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",p,!0),document.body.style.overflow=h}},[o,l,n]),f.useEffect(()=>{o&&d.current&&requestAnimationFrame(()=>{d.current?.querySelector(My)?.focus()})},[o]),o?Yc.createPortal(s.jsxs("div",{className:"fixed inset-0 z-50",children:[s.jsx("div",{className:"fixed inset-0 animate-dialog-overlay-show bg-black/50 backdrop-blur-sm",onClick:()=>{r?.(),l(!1)},"aria-hidden":!0}),s.jsx("div",{ref:p=>{d.current=p,typeof i=="function"?i(p):i&&(i.current=p)},role:"dialog","aria-modal":"true",className:ge("fixed left-1/2 top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2","rounded-xl border bg-popover text-popover-foreground shadow-lg","animate-dialog-content-show",e),...a,children:t})]}),document.body):null});x0.displayName="DialogContent";const y0=f.forwardRef(({className:e,...t},n)=>s.jsx("h2",{ref:n,className:ge("sr-only",e),...t}));y0.displayName="DialogTitle";const Nt=f.forwardRef(({className:e,type:t,...n},r)=>s.jsx("input",{type:t,className:ge("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Nt.displayName="Input";const v0=f.forwardRef(({className:e,contentClassName:t,children:n,...r},a)=>s.jsx("div",{className:ge("relative overflow-hidden",e),...r,children:s.jsx("div",{ref:a,className:ge("h-full w-full overflow-auto rounded-[inherit]",t),style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:n})}));v0.displayName="ScrollArea";const vc=f.memo(({children:e,className:t,as:n="span"})=>s.jsx(n,{className:ge("animate-shimmer inline-block bg-[length:250%_100%] bg-clip-text text-transparent","bg-[linear-gradient(90deg,transparent_33%,hsl(var(--foreground))_50%,transparent_67%),linear-gradient(hsl(var(--muted-foreground)),hsl(var(--muted-foreground)))]",t),children:e}));vc.displayName="Shimmer";const m4=f.createContext(null),TD=()=>{const e=f.useContext(m4);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},AD=1e3,_D=1e3,Gp=f.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:r,onOpenChange:a,duration:i,children:o,...l})=>{const c=r??t,d=r===!1,[u,p]=f.useState(c),h=n!==void 0,m=h?n:u,g=f.useCallback(k=>{h||p(k),a?.(k)},[h,a]),[b,x]=f.useState(i),y=f.useRef(t),[v,w]=f.useState(!1),S=f.useRef(null);f.useEffect(()=>{i!==void 0&&x(i)},[i]),f.useEffect(()=>{t?(y.current=!0,S.current===null&&(S.current=Date.now())):S.current!==null&&(x(Math.ceil((Date.now()-S.current)/_D)),S.current=null)},[t]),f.useEffect(()=>{t&&!m&&!d&&g(!0)},[t,m,g,d]),f.useEffect(()=>{if(y.current&&!t&&m&&!v){const k=setTimeout(()=>{g(!1),w(!0)},AD);return()=>clearTimeout(k)}},[t,m,g,v]);const E=f.useMemo(()=>({duration:b,isOpen:m,isStreaming:t,setIsOpen:g}),[b,m,t,g]);return s.jsx(m4.Provider,{value:E,children:s.jsx(ki,{open:m,onOpenChange:g,className:ge("not-prose",e),...l,children:o})})});Gp.displayName="Reasoning";const ID=(e,t)=>e||t===0?s.jsx(vc,{children:"Thinking..."}):t===void 0?s.jsx("p",{children:"Thought for a few seconds"}):s.jsxs("p",{children:["Thought for ",t," seconds"]}),Hp=f.memo(({className:e,children:t,getThinkingMessage:n=ID,...r})=>{const{isStreaming:a,isOpen:i,duration:o}=TD();return s.jsx(Pa,{className:ge("flex w-full items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",e),...r,children:t??s.jsxs(s.Fragment,{children:[s.jsx(Dj,{className:"h-4 w-4"}),n(a,o),s.jsx(qS,{className:ge("h-4 w-4 transition-transform",i?"rotate-180":"rotate-0")})]})})});Hp.displayName="ReasoningTrigger";const qp=f.memo(({className:e,children:t,...n})=>s.jsx(Si,{className:ge("mt-4 text-sm text-muted-foreground",e),...n,children:t}));qp.displayName="ReasoningContent";function jD(e){switch(e){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}}function ta({children:e,content:t,position:n="top",className:r="",delay:a=350}){const[i,o]=f.useState(!1),l=f.useRef(null),c=f.useRef(!1),d=f.useRef(null),u=f.useRef(null),[p,h]=f.useState(null),m=f.useCallback(()=>{const w=d.current;if(!w)return;const S=w.getBoundingClientRect(),E=8,k={position:"fixed",zIndex:9999};switch(n){case"bottom":k.left=S.left+S.width/2,k.top=S.bottom+E,k.transform="translateX(-50%)";break;case"left":k.left=S.left-E,k.top=S.top+S.height/2,k.transform="translate(-100%, -50%)";break;case"right":k.left=S.right+E,k.top=S.top+S.height/2,k.transform="translateY(-50%)";break;case"top":default:k.left=S.left+S.width/2,k.top=S.top-E,k.transform="translate(-50%, -100%)";break}h(k)},[n]),g=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},b=()=>{g(),l.current=window.setTimeout(()=>{o(!0)},a)},x=()=>{g(),o(!1)},y=()=>{g(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},v=()=>{g(),!c.current&&o(!1)};return f.useEffect(()=>()=>{g()},[]),f.useEffect(()=>{if(!i||typeof document>"u")return;const w=S=>{const E=S.target;E instanceof Node&&d.current?.contains(E)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",w,!0),()=>document.removeEventListener("pointerdown",w,!0)},[i]),f.useEffect(()=>{if(!i){h(null);return}const w=window.requestAnimationFrame(m),S=()=>m();return window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{window.cancelAnimationFrame(w),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[i,m]),t?s.jsxs("div",{ref:d,className:"relative inline-block",onMouseEnter:b,onMouseLeave:x,onTouchStart:y,onTouchEnd:v,onTouchCancel:v,children:[e,i&&typeof document<"u"&&Yc.createPortal(s.jsxs("div",{ref:u,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:ge("px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",r),children:[t,s.jsx("div",{className:ge("absolute w-0 h-0 border-4 border-transparent",jD(n))})]}),document.body)]}):s.jsx(s.Fragment,{children:e})}const h4=f.createContext(null),f4=f.forwardRef(({className:e,status:t="ready",children:n,...r},a)=>{const i=f.useMemo(()=>({status:t}),[t]);return s.jsx(h4.Provider,{value:i,children:s.jsx("form",{ref:a,"data-slot":"prompt-input",className:ge("relative overflow-hidden rounded-xl border border-border/50 bg-card/80 shadow-sm backdrop-blur-sm transition-all duration-200 focus-within:border-primary/30 focus-within:shadow-md focus-within:ring-1 focus-within:ring-primary/15",e),...r,children:n})})});f4.displayName="PromptInput";const g4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"prompt-input-header",className:ge("px-3 pt-3",e),...t}));g4.displayName="PromptInputHeader";const b4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"prompt-input-body",className:ge("relative",e),...t}));b4.displayName="PromptInputBody";const x4=f.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{ref:n,"data-slot":"prompt-input-textarea",className:ge("chat-input-placeholder block max-h-[40vh] w-full resize-none overflow-y-auto bg-transparent px-4 py-2 text-sm leading-6 text-foreground placeholder-muted-foreground/50 focus:outline-none sm:max-h-[300px]",e),...t}));x4.displayName="PromptInputTextarea";const y4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"prompt-input-footer",className:ge("flex items-center justify-between border-t border-border/30 px-3 py-2",e),...t}));y4.displayName="PromptInputFooter";const v4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"prompt-input-tools",className:ge("flex items-center gap-1",e),...t}));v4.displayName="PromptInputTools";const Jl=f.forwardRef(({className:e,tooltip:t,children:n,...r},a)=>{const i=s.jsx(Pe,{ref:a,type:"button",variant:"ghost",size:"icon",className:ge("h-8 w-8 [&_svg]:size-4",e),...r,children:n});return t?s.jsx(ta,{content:t.shortcut?s.jsxs("span",{className:"flex items-center gap-1.5",children:[t.content,s.jsx("kbd",{className:"rounded bg-white/20 px-1 text-[10px]",children:t.shortcut})]}):t.content,position:t.side??"top",children:i}):i});Jl.displayName="PromptInputButton";const w4=f.forwardRef(({className:e,status:t,children:n,...r},a)=>{const i=f.useContext(h4),o=t??i?.status??"ready",l=o==="submitted"||o==="streaming";return s.jsx(Pe,{ref:a,type:l?"button":"submit",variant:"default",size:"icon",className:ge("h-8 w-8 rounded-lg",e),...r,children:n??(l?s.jsx(vj,{className:"h-3.5 w-3.5 fill-current"}):s.jsx(nj,{className:"h-4 w-4"}))})});w4.displayName="PromptInputSubmit";function w0({children:e,className:t}){return s.jsx("div",{className:ge("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function k0({isActive:e,onClick:t,children:n,className:r}){return s.jsx("button",{onClick:t,className:ge("flex touch-manipulation items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition-all duration-150",e?"bg-background text-foreground shadow-sm":"text-muted-foreground active:bg-background/50",r),children:n})}const k4=f.createContext(null);function S4(){const e=f.useContext(k4);if(!e)throw new Error("QueueItem sub-components must be used within <QueueItem>");return e}const E4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"queue",role:"list",className:ge("space-y-0.5",e),...t}));E4.displayName="Queue";const N4=f.forwardRef(({status:e="pending",className:t,children:n,...r},a)=>{const i=f.useMemo(()=>({status:e}),[e]);return s.jsx(k4.Provider,{value:i,children:s.jsx("div",{ref:a,"data-slot":"queue-item","data-status":e,role:"listitem",className:ge("flex items-start gap-2 py-0.5",t),...r,children:n})})});N4.displayName="QueueItem";const C4=f.forwardRef(({className:e,...t},n)=>{const{status:r}=S4();return s.jsxs("div",{ref:n,"data-slot":"queue-item-indicator","aria-hidden":"true",className:ge("mt-0.5 flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center",e),...t,children:[r==="completed"&&s.jsx("svg",{className:"h-3.5 w-3.5 text-green-500 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),r==="in_progress"&&s.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500 dark:bg-blue-400"}),r==="pending"&&s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2})})]})});C4.displayName="QueueItemIndicator";const T4=f.forwardRef(({className:e,children:t,...n},r)=>{const{status:a}=S4();return s.jsx("div",{ref:r,"data-slot":"queue-item-content",className:ge("min-w-0 flex-1 text-xs",a==="completed"&&"text-muted-foreground line-through",a==="in_progress"&&"font-medium text-foreground",a==="pending"&&"text-foreground",e),...n,children:t})});T4.displayName="QueueItemContent";const Py="https://github.com/alicomert/pixcode/issues/new",RD="https://github.com/alicomert/pixcode",Fy="https://discord.gg/buxwujPNRE";function zy({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function DD({updateAvailable:e,releaseInfo:t,latestVersion:n,currentVersion:r,onShowVersionModal:a,onShowSettings:i,t:o}){return s.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[e&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.jsxs("button",{className:"group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-blue-50/80 dark:hover:bg-blue-900/15",onClick:a,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(py,{className:"h-4 w-4 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${n}`}),s.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})}),s.jsx("div",{className:"px-3 py-2 md:hidden",children:s.jsxs("button",{className:"flex h-11 w-full items-center gap-3 rounded-xl border border-blue-200/60 bg-blue-50/80 px-3.5 transition-all active:scale-[0.98] dark:border-blue-700/40 dark:bg-blue-900/15",onClick:a,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(py,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${n}`}),s.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})})]}),s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:s.jsxs("a",{href:Py,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[s.jsx(Dp,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"hidden px-2 md:block",children:s.jsxs("a",{href:Fy,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[s.jsx(zy,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.jsxs("button",{className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",onClick:i,children:[s.jsx(kt,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.settings")})]})}),s.jsx("div",{className:"hidden px-3 py-2 text-center md:block",children:s.jsxs("a",{href:RD,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-muted-foreground/40 transition-colors hover:text-muted-foreground",children:["Pixcode v",r," – ",o("branding.openSource")]})}),s.jsx("div",{className:"px-3 pt-3 md:hidden",children:s.jsxs("a",{href:Py,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(Dp,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"px-3 pt-2 md:hidden",children:s.jsxs("a",{href:Fy,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(zy,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"px-3 pb-3 pt-2 md:hidden",children:s.jsxs("button",{className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",onClick:i,children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(kt,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.settings")})]})})]})}const By="PIXCODE_GITHUB_STARS",$y="PIXCODE_HIDE_GITHUB_STAR",OD=3600*1e3,LD=(e,t)=>{const[n,r]=f.useState(null),[a,i]=f.useState(()=>{try{return localStorage.getItem($y)==="true"}catch{return!1}});f.useEffect(()=>{if(a)return;try{const d=localStorage.getItem(By);if(d){const u=JSON.parse(d);if(Date.now()-u.timestamp<OD){r(u.count);return}}}catch{}(async()=>{try{const d=await fetch(`https://api.github.com/repos/${e}/${t}`);if(!d.ok)return;const p=(await d.json()).stargazers_count;if(typeof p=="number"){r(p);try{localStorage.setItem(By,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=f.useCallback(()=>{i(!0);try{localStorage.setItem($y,"true")}catch{}},[]),l=n!==null?n>=1e3?`${(n/1e3).toFixed(1)}k`:`${n}`:null;return{starCount:n,formattedCount:l,isDismissed:a,dismiss:o}},MD="https://github.com/alicomert/pixcode";function PD({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})})}function FD(){const{formattedCount:e,isDismissed:t,dismiss:n}=LD("alicomert","pixcode");return t?null:s.jsxs("div",{className:"group/star relative hidden md:block",children:[s.jsxs("a",{href:MD,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border border-border/50 bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:[s.jsx(PD,{className:"h-3.5 w-3.5"}),s.jsx(is,{className:"h-3 w-3"}),s.jsx("span",{className:"font-medium",children:"Star"}),e&&s.jsx("span",{className:"border-l border-border/50 pl-1.5 tabular-nums",children:e})]}),s.jsx("button",{onClick:r=>{r.preventDefault(),r.stopPropagation(),n()},className:"absolute -right-1.5 -top-1.5 hidden h-4 w-4 items-center justify-center rounded-full border border-border/50 bg-muted text-muted-foreground transition-colors hover:text-foreground group-hover/star:flex","aria-label":"Dismiss",children:s.jsx(bt,{className:"h-2.5 w-2.5"})})]})}function Uy({value:e,onChange:t,t:n}){const r="flex flex-1 items-center justify-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium transition-all";return s.jsxs("div",{role:"tablist","aria-label":n("tooltips.historyView",{defaultValue:"History view"}),className:"flex rounded-lg bg-muted/40 p-0.5",children:[s.jsxs("button",{type:"button",role:"tab","aria-selected":e==="flat",onClick:()=>t("flat"),className:ge(r,e==="flat"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:n("tooltips.historyViewFlat",{defaultValue:"Recent conversations"}),children:[s.jsx(Oo,{className:"h-3 w-3"}),n("historyView.flat",{defaultValue:"Recent"})]}),s.jsxs("button",{type:"button",role:"tab","aria-selected":e==="grouped",onClick:()=>t("grouped"),className:ge(r,e==="grouped"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:n("tooltips.historyViewGrouped",{defaultValue:"Grouped by project"}),children:[s.jsx(lj,{className:"h-3 w-3"}),n("historyView.grouped",{defaultValue:"By project"})]})]})}function zD({isPWA:e,isMobile:t,isLoading:n,projectsCount:r,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:d,isRefreshing:u,onCreateProject:p,onQuickStartSession:h,onCollapseSidebar:m,historyView:g,onHistoryViewChange:b,t:x}){const y=()=>s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx("svg",{className:"h-6 w-6 flex-shrink-0",viewBox:"0 0 500 500","aria-hidden":"true",children:s.jsx("g",{transform:"translate(250 250) scale(1.25) translate(-250 -250)",children:s.jsxs("g",{transform:"translate(0 500) scale(0.1 -0.1)",fill:"#5C3FFC",children:[s.jsx("path",{d:"M2037 3800 c-104 -40 -191 -134 -231 -250 -23 -67 -20 -82 22 -109 31 -20 287 -177 1009 -618 40 -24 82 -56 93 -70 27 -34 27 -102 0 -136 -11 -13 -106 -78 -212 -143 -106 -64 -201 -124 -210 -132 -16 -14 -18 -41 -18 -302 0 -291 2 -310 38 -310 16 0 267 148 610 359 180 111 270 173 310 213 216 217 215 574 -3 793 -37 38 -107 89 -185 136 -69 42 -253 154 -410 249 -434 264 -509 307 -563 326 -57 20 -191 17 -250 -6z"}),s.jsx("path",{d:"M1803 2994 c-10 -5 -13 -156 -13 -709 0 -671 1 -706 20 -767 27 -89 93 -184 167 -240 89 -67 157 -90 281 -96 92 -4 105 -2 117 14 12 16 14 134 15 735 0 669 -1 718 -17 737 -20 23 -514 322 -541 327 -9 2 -23 2 -29 -1z"})]})})}),s.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight text-foreground",children:x("app.title")})]});return s.jsxs("div",{className:"flex-shrink-0",children:[s.jsxs("div",{className:"hidden px-4 pb-3 pt-4 md:block",style:{},children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(y,{}),s.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[s.jsx(Pe,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:d,disabled:u,title:x("tooltips.refresh"),children:s.jsx(Et,{className:`h-4 w-4 ${u?"animate-spin":""}`})}),s.jsx(Pe,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:p,title:x("tooltips.createProject"),children:s.jsx(sn,{className:"h-4 w-4"})}),s.jsx(Pe,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:m,title:x("tooltips.hideSidebar"),children:s.jsx(ej,{className:"h-4 w-4"})})]})]}),s.jsx(FD,{}),h&&s.jsxs("button",{type:"button",onClick:()=>{h()},className:"mt-2.5 flex w-full items-center justify-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-sm font-medium text-primary transition-colors hover:bg-primary/10",children:[s.jsx(sa,{className:"h-4 w-4"}),x("sidebar.newChat",{defaultValue:"New chat"})]}),r>0&&!n&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[s.jsx(Uy,{value:g,onChange:b,t:x}),s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:ge("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(Nr,{className:"h-3 w-3"}),x("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ge("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(vi,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ia,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(Nt,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>i(v.target.value),className:"nav-search-input h-9 rounded-xl border-0 pl-9 pr-8 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:s.jsx(bt,{className:"h-3 w-3 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider hidden md:block"}),s.jsxs("div",{className:"p-3 pb-2 md:hidden",style:e&&t?{paddingTop:"16px"}:{},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(y,{}),s.jsxs("div",{className:"flex flex-shrink-0 gap-1.5",children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/50 transition-all active:scale-95",onClick:d,disabled:u,children:s.jsx(Et,{className:`h-4 w-4 text-muted-foreground ${u?"animate-spin":""}`})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/90 text-primary-foreground transition-all active:scale-95",onClick:p,children:s.jsx(yi,{className:"h-4 w-4"})})]})]}),r>0&&!n&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[l==="projects"&&s.jsx(Uy,{value:g,onChange:b,t:x}),s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:ge("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(Nr,{className:"h-3 w-3"}),x("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ge("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(vi,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ia,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(Nt,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>i(v.target.value),className:"nav-search-input h-10 rounded-xl border-0 pl-10 pr-9 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:s.jsx(bt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const BD=160,Gy=180;function A4({actions:e,className:t,triggerLabel:n}){const[r,a]=f.useState(!1),[i,o]=f.useState(null),l=f.useRef(null),c=f.useRef(null);f.useLayoutEffect(()=>{if(!r||!l.current)return;const u=l.current.getBoundingClientRect();let p=u.right-BD;p<8&&(p=8);let h=u.bottom+4;h+Gy>window.innerHeight&&(h=Math.max(8,u.top-4-Gy)),o({top:h,left:p})},[r]),f.useEffect(()=>{if(!r)return;const u=m=>{const g=m.target;l.current?.contains(g)||c.current?.contains(g)||a(!1)},p=m=>{m.key==="Escape"&&a(!1)},h=()=>a(!1);return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[r]);const d=u=>p=>{p.stopPropagation(),p.preventDefault(),a(!1),u.onClick()};return s.jsxs(s.Fragment,{children:[s.jsx("button",{ref:l,type:"button","aria-haspopup":"menu","aria-expanded":r,"aria-label":n||"Actions",title:n||"Actions",onClick:u=>{u.stopPropagation(),u.preventDefault(),a(p=>!p)},className:ge("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground","opacity-0 transition-all duration-150 hover:bg-accent hover:text-foreground","group-hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary","touch:opacity-100",r&&"bg-accent text-foreground opacity-100",t),children:s.jsx(xj,{className:"h-3.5 w-3.5"})}),r&&i&&Yc.createPortal(s.jsx("div",{ref:c,role:"menu",style:{position:"fixed",top:i.top,left:i.left,zIndex:9999},className:ge("w-40 rounded-xl border border-border/60 bg-popover p-1 shadow-lg","animate-in fade-in-0 zoom-in-95 duration-100"),onClick:u=>u.stopPropagation(),onMouseDown:u=>u.stopPropagation(),children:e.map((u,p)=>{const h=u.icon,m=e[p-1],g=p>0&&u.danger&&!m?.danger;return s.jsxs("div",{children:[g&&s.jsx("div",{className:"my-1 h-px bg-border/60"}),s.jsxs("button",{type:"button",role:"menuitem",onClick:d(u),className:ge("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs",u.danger?"text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20":"text-foreground hover:bg-accent"),children:[s.jsx(h,{className:"h-3 w-3"}),u.label]})]},u.id)})}),document.body)]})}const Hy={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},$D={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},UD=e=>e==="fully-configured"?{icon:fs,colorClassName:"text-green-500 dark:text-green-400",backgroundClassName:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"}:e==="taskmaster-only"?{icon:kt,colorClassName:"text-blue-500 dark:text-blue-400",backgroundClassName:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"}:e==="mcp-only"?{icon:na,colorClassName:"text-amber-500 dark:text-amber-400",backgroundClassName:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"}:{icon:bt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function GD({status:e="not-configured",size:t="sm",className:n="",showLabel:r=!1}){const a=UD(e),i=a.icon;return r?s.jsxs("div",{className:ge("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",a.backgroundClassName,a.colorClassName,n),title:a.title,children:[s.jsx(i,{className:Hy[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:ge("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,$D[t],n),title:a.title,children:s.jsx(i,{className:ge(Hy[t],a.colorClassName)})})}const HD=(e,t,n)=>{const r=new Date(e),a=t;if(isNaN(r.getTime()))return n?n("status.unknown"):"Unknown";const i=a.getTime()-r.getTime(),o=Math.floor(i/1e3),l=Math.floor(i/(1e3*60)),c=Math.floor(i/(1e3*60*60)),d=Math.floor(i/(1e3*60*60*24));return o<60?n?n("time.justNow"):"Just now":l===1?n?n("time.oneMinuteAgo"):"1 min ago":l<60?n?n("time.minutesAgo",{count:l}):`${l} mins ago`:c===1?n?n("time.oneHourAgo"):"1 hour ago":c<24?n?n("time.hoursAgo",{count:c}):`${c} hours ago`:d===1?n?n("time.oneDayAgo"):"1 day ago":d<7?n?n("time.daysAgo",{count:d}):`${d} days ago`:r.toLocaleDateString()};function qy({isStarred:e,canDelete:t,onRename:n,onToggleStar:r,onDelete:a,t:i,className:o}){const l=d=>s.jsx(is,{className:`${d.className??""} ${e?"fill-yellow-400 text-yellow-500":""}`}),c=[{id:"rename",label:i("actions.rename"),icon:uj,onClick:n},{id:"star",label:e?i("actions.unstarSession",{defaultValue:"Remove star"}):i("actions.starSession",{defaultValue:"Star"}),icon:l,onClick:r}];return t&&c.push({id:"delete",label:i("actions.delete"),icon:gn,onClick:a,danger:!0}),s.jsx(A4,{actions:c,className:o,triggerLabel:i("tooltips.sessionActions",{defaultValue:"Session actions"})})}const qD={claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini",qwen:"Qwen Code",opencode:"OpenCode"},Vy={claude:"bg-orange-500/10 text-orange-600 dark:bg-orange-400/10 dark:text-orange-300 ring-1 ring-orange-500/15",cursor:"bg-sky-500/10 text-sky-600 dark:bg-sky-400/10 dark:text-sky-300 ring-1 ring-sky-500/15",codex:"bg-violet-500/10 text-violet-600 dark:bg-violet-400/10 dark:text-violet-300 ring-1 ring-violet-500/15",gemini:"bg-emerald-500/10 text-emerald-600 dark:bg-emerald-400/10 dark:text-emerald-300 ring-1 ring-emerald-500/15",qwen:"bg-amber-500/10 text-amber-600 dark:bg-amber-400/10 dark:text-amber-300 ring-1 ring-amber-500/15",opencode:"bg-teal-500/10 text-teal-600 dark:bg-teal-400/10 dark:text-teal-300 ring-1 ring-teal-500/15"};function _4({project:e,session:t,selectedSession:n,currentTime:r,editingSession:a,editingSessionName:i,isStarred:o,compact:l=!1,onEditingSessionNameChange:c,onStartEditingSession:d,onCancelEditingSession:u,onSaveEditingSession:p,onToggleStarSession:h,onProjectSelect:m,onSessionSelect:g,onDeleteSession:b,t:x}){const y=T9(t,r,x),v=n?.id===t.id,w=a===t.id,S=t.__provider,E=qD[S]??S,k=Vy[S]??Vy.claude,T=E9(y.sessionName),_=()=>{m(e),g(t,e.name)},C=()=>{p(e.name,t.id,i,S)},I=()=>{b(e.name,t.id,y.sessionName,S)},O=()=>d(t.id,y.sessionName),A=()=>h(e.name,t.id),R=s.jsxs("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-1 text-[10px] leading-tight",children:[s.jsxs("span",{className:ge("inline-flex items-center gap-1 rounded-full px-1.5 py-px font-medium",k),children:[s.jsx(Rn,{provider:S,className:"h-2.5 w-2.5"}),E]}),s.jsx("span",{className:"text-muted-foreground/80",children:HD(y.sessionTime,r,x)}),y.isActive&&s.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-green-500"}),x("status.active",{defaultValue:"Active"})]}),T.slice(0,3).map(B=>s.jsxs("span",{className:"rounded-md bg-muted/60 px-1 py-px font-mono text-[9px] uppercase tracking-wide text-muted-foreground ring-1 ring-border/40",children:[".",B]},B))]}),N=s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",value:i,onChange:B=>c(B.target.value),onKeyDown:B=>{B.stopPropagation(),B.key==="Enter"?C():B.key==="Escape"&&u()},onClick:B=>B.stopPropagation(),className:"w-full rounded-md border border-primary/40 bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:B=>{B.stopPropagation(),C()},title:x("tooltips.save"),children:s.jsx(Gt,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:B=>{B.stopPropagation(),u()},title:x("tooltips.cancel"),children:s.jsx(bt,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}),F=s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:ge("relative mx-3 my-0.5 rounded-lg border border-border/30 bg-card p-2 transition-all duration-150 active:scale-[0.98]",v&&"border-primary/30 bg-primary/5 shadow-sm",!v&&y.isActive&&"border-green-500/25 bg-green-50/5 dark:bg-green-900/5",o&&!v&&"ring-1 ring-yellow-300/50 dark:ring-yellow-500/30"),onClick:w?void 0:_,children:w?s.jsx("div",{className:"flex items-center gap-1",children:N}):s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ge("flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/60"),children:s.jsx(Rn,{provider:S,className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[o&&s.jsx("span",{className:"text-yellow-500","aria-hidden":!0,children:"★"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),R]}),s.jsx("div",{className:"flex-shrink-0",onClick:B=>B.stopPropagation(),children:s.jsx(qy,{isStarred:o,canDelete:!y.isCursorSession,onRename:O,onToggleStar:A,onDelete:I,t:x,className:"!opacity-100"})})]})})}),K=s.jsxs("div",{className:ge("group/item relative hidden md:block"),children:[s.jsxs(Pe,{variant:"ghost",className:ge("relative h-auto w-full justify-start overflow-hidden p-0 text-left font-normal transition-colors duration-150","hover:bg-accent/60",v&&"bg-accent text-accent-foreground",o&&!v&&"bg-yellow-50/40 hover:bg-yellow-100/40 dark:bg-yellow-900/10 dark:hover:bg-yellow-900/20",l?"rounded-xl px-3 py-2.5":"rounded-lg px-3 py-2"),onClick:w?void 0:()=>g(t,e.name),children:[v&&s.jsx("span",{"aria-hidden":!0,className:"absolute left-0 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary"}),!v&&!w&&s.jsx("span",{"aria-hidden":!0,className:"session-item-accent"}),s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2 pr-6",children:[s.jsx("div",{className:ge("mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/50 group-hover/item:bg-muted/80"),children:s.jsx(Rn,{provider:S,className:"h-3 w-3"})}),s.jsx("div",{className:"min-w-0 flex-1",children:w?s.jsx("div",{className:"flex items-center gap-1",children:N}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o&&s.jsx("span",{className:"flex-shrink-0 text-yellow-500","aria-hidden":!0,children:"★"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),R]})})]})]}),!w&&s.jsx("div",{className:"absolute right-1.5 top-1/2 -translate-y-1/2",onClick:B=>B.stopPropagation(),children:s.jsx(qy,{isStarred:o,canDelete:!y.isCursorSession,onRename:O,onToggleStar:A,onDelete:I,t:x,className:"opacity-0 group-hover/item:opacity-100 focus-visible:opacity-100"})})]});return s.jsxs("div",{className:"group relative",children:[F,K]})}function VD(){return s.jsx(s.Fragment,{children:Array.from({length:3}).map((e,t)=>s.jsx("div",{className:"rounded-md p-2",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"mt-0.5 h-3 w-3 animate-pulse rounded-full bg-muted"}),s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsx("div",{className:"h-3 animate-pulse rounded bg-muted",style:{width:`${60+t*15}%`}}),s.jsx("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]})]})},t))})}function WD({project:e,isExpanded:t,sessions:n,selectedSession:r,initialSessionsLoaded:a,isLoadingSessions:i,currentTime:o,editingSession:l,editingSessionName:c,isSessionStarred:d,onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:h,onSaveEditingSession:m,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,onLoadMoreSessions:v,onNewSession:w,t:S}){if(!t)return null;const E=n.length>0,k=e.sessionMeta?.hasMore===!0;return s.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[s.jsx("div",{className:"px-3 pb-1 pt-1 md:hidden",children:s.jsxs("button",{className:"flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]",onClick:()=>{b(e),w(e)},children:[s.jsx(sn,{className:"h-3 w-3"}),S("sessions.newSession")]})}),s.jsxs(Pe,{variant:"default",size:"sm",className:"hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex",onClick:()=>w(e),children:[s.jsx(sn,{className:"h-3 w-3"}),S("sessions.newSession")]}),a?!E&&!i?s.jsx("div",{className:"px-3 py-2 text-left",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:S("sessions.noSessions")})}):n.map(T=>s.jsx(_4,{project:e,session:T,selectedSession:r,currentTime:o,editingSession:l,editingSessionName:c,isStarred:d(e.name,T.id),onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:h,onSaveEditingSession:m,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,t:S},T.id)):s.jsx(VD,{}),E&&k&&s.jsx(Pe,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),S("sessions.loading")]}):s.jsxs(s.Fragment,{children:[s.jsx(Pn,{className:"h-3 w-3"}),S("sessions.showMore")]})})]})}const KD=(e,t)=>{const n=e.length;return t&&n>=5?`${n}+`:`${n}`};function YD({project:e,selectedProject:t,selectedSession:n,isExpanded:r,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:g,mcpServerStatus:b,isSessionStarred:x,onEditingNameChange:y,onToggleProject:v,onProjectSelect:w,onToggleStarProject:S,onToggleStarSession:E,onStartEditingProject:k,onCancelEditingProject:T,onSaveProjectName:_,onDeleteProject:C,onSessionSelect:I,onDeleteSession:O,onLoadMoreSessions:A,onNewSession:R,onEditingSessionNameChange:N,onStartEditingSession:F,onCancelEditingSession:K,onSaveEditingSession:B,t:W}){const H=t?.name===e.name,L=o===e.name,G=e.sessionMeta?.hasMore===!0,U=KD(c,G),M=`${U} session${c.length===1?"":"s"}`,J=I9(e,b),te=()=>v(e.name),de=()=>S(e.name),ue=()=>{_(e.name)},se=()=>{t?.name!==e.name&&w(e),te()};return s.jsxs("div",{className:ge("md:space-y-1",a&&"opacity-50 pointer-events-none"),children:[s.jsxs("div",{className:"md:group group",children:[s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:ge("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",H&&"bg-primary/5 border-primary/20",i&&!H&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:te,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[s.jsx("div",{className:ge("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",r?"bg-primary/10":"bg-muted"),children:r?s.jsx(Ma,{className:"h-4 w-4 text-primary"}):s.jsx(Nr,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:L?s.jsx("input",{type:"text",value:l,onChange:he=>y(he.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:W("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:he=>he.stopPropagation(),onKeyDown:he=>{he.key==="Enter"&&ue(),he.key==="Escape"&&T()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-between",children:[s.jsx("h3",{className:"truncate text-sm font-medium text-foreground",children:e.displayName}),g&&s.jsx(GD,{status:J,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:M})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:L?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-green-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-green-600",onClick:he=>{he.stopPropagation(),ue()},children:s.jsx(Gt,{className:"h-4 w-4 text-white"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gray-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-gray-600",onClick:he=>{he.stopPropagation(),T()},children:s.jsx(bt,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:ge("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",i?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:he=>{he.stopPropagation(),de()},title:W(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(is,{className:ge("w-4 h-4 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30",onClick:he=>{he.stopPropagation(),C(e)},children:s.jsx(gn,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 active:scale-90 dark:border-primary/30 dark:bg-primary/20",onClick:he=>{he.stopPropagation(),k(e)},children:s.jsx(Rp,{className:"h-4 w-4 text-primary"})}),s.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:r?s.jsx(Pn,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(Sr,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(Pe,{variant:"ghost",className:ge("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",H&&"bg-accent text-accent-foreground",i&&!H&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:se,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[r?s.jsx(Ma,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(Nr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:L?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:he=>y(he.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:W("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:he=>{he.key==="Enter"&&ue(),he.key==="Escape"&&T()}}),s.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.fullPath,children:e.fullPath})]}):s.jsxs("div",{children:[s.jsx("div",{className:"truncate text-sm font-semibold text-foreground",title:e.displayName,children:e.displayName}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[U,e.fullPath!==e.displayName&&s.jsxs("span",{className:"ml-1 opacity-60",title:e.fullPath,children:[" - ",e.fullPath.length>25?`...${e.fullPath.slice(-22)}`:e.fullPath]})]})]})})]}),s.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",children:L?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-green-600 transition-colors hover:bg-green-50 hover:text-green-700 dark:hover:bg-green-900/20",onClick:he=>{he.stopPropagation(),ue()},children:s.jsx(Gt,{className:"h-3 w-3"})}),s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700 dark:hover:bg-gray-800",onClick:he=>{he.stopPropagation(),T()},children:s.jsx(bt,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[i&&s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded hover:bg-yellow-50 dark:hover:bg-yellow-900/20",onClick:he=>{he.stopPropagation(),de()},title:W("tooltips.removeFromFavorites"),children:s.jsx(is,{className:"h-3 w-3 fill-current text-yellow-600 dark:text-yellow-400"})}),s.jsx(A4,{triggerLabel:W("tooltips.projectActions",{defaultValue:"Project actions"}),actions:[{id:"rename",label:W("actions.rename"),icon:Rp,onClick:()=>k(e)},{id:"star",label:W(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),icon:is,onClick:de},{id:"delete",label:W("actions.delete",{defaultValue:"Delete"}),icon:gn,onClick:()=>C(e),danger:!0}]}),r?s.jsx(Pn,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):s.jsx(Sr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),s.jsx(WD,{project:e,isExpanded:r,sessions:c,selectedSession:n,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:h,editingSessionName:m,isSessionStarred:x,onEditingSessionNameChange:N,onStartEditingSession:F,onCancelEditingSession:K,onSaveEditingSession:B,onToggleStarSession:E,onProjectSelect:w,onSessionSelect:I,onDeleteSession:O,onLoadMoreSessions:A,onNewSession:R,t:W})]})}function I4({isLoading:e,loadingProgress:t,projectsCount:n,filteredProjectsCount:r,t:a}){return e?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.loadingProjects")}),t&&t.total>0?s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${t.current/t.total*100}%`}})}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.current,"/",t.total," ",a("projects.projects")]}),t.currentProject&&s.jsx("p",{className:"mx-auto max-w-[200px] truncate text-xs text-muted-foreground/70",title:t.currentProject,children:t.currentProject.split("-").slice(-2).join("/")})]}):s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.fetchingProjects")})]}):n===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(Nr,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.runClaudeCli")})]}):r===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(ia,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noMatchingProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.tryDifferentSearch")})]}):null}function ZD({projects:e,filteredProjects:t,selectedProject:n,selectedSession:r,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:d,initialSessionsLoaded:u,currentTime:p,editingSession:h,editingSessionName:m,deletingProjects:g,tasksEnabled:b,mcpServerStatus:x,getProjectSessions:y,isProjectStarred:v,isSessionStarred:w,onEditingNameChange:S,onToggleProject:E,onProjectSelect:k,onToggleStarProject:T,onToggleStarSession:_,onStartEditingProject:C,onCancelEditingProject:I,onSaveProjectName:O,onDeleteProject:A,onSessionSelect:R,onDeleteSession:N,onLoadMoreSessions:F,onNewSession:K,onEditingSessionNameChange:B,onStartEditingSession:W,onCancelEditingSession:H,onSaveEditingSession:L,t:G}){const U=s.jsx(I4,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:G});f.useEffect(()=>{let se="Pixcode";const he=n?.displayName?.trim();he&&(se=`${he} - ${se}`),document.title=se},[n]);const M=!a&&e.length>0&&t.length>0,J=se=>se.source==="history"||se.autoDiscovered===!0&&se.isManuallyAdded!==!0,te=t.filter(se=>!J(se)),de=t.filter(se=>J(se)),ue=se=>s.jsx(YD,{project:se,selectedProject:n,selectedSession:r,isExpanded:o.has(se.name),isDeleting:g.has(se.name),isStarred:v(se.name),editingProject:l,editingName:c,sessions:y(se),initialSessionsLoaded:u.has(se.name),isLoadingSessions:!!d[se.name],currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:b,mcpServerStatus:x,isSessionStarred:w,onEditingNameChange:S,onToggleProject:E,onProjectSelect:k,onToggleStarProject:T,onToggleStarSession:_,onStartEditingProject:C,onCancelEditingProject:I,onSaveProjectName:O,onDeleteProject:A,onSessionSelect:R,onDeleteSession:N,onLoadMoreSessions:F,onNewSession:K,onEditingSessionNameChange:B,onStartEditingSession:W,onCancelEditingSession:H,onSaveEditingSession:L,t:G},se.name);return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:M?s.jsxs(s.Fragment,{children:[te.map(se=>ue(se)),de.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-3 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:G("projects.detectedFromHistory")}),de.map(se=>ue(se))]})]}):U})}function Xr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j4(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}/*!
|
|
229
|
+
`;function xR(){if(typeof document>"u"||document.getElementById(xy))return;const e=document.createElement("style");e.id=xy,e.type="text/css",e.innerText=bR,document.head.appendChild(e)}function yR({terminalContainerRef:e,terminalRef:t,fitAddonRef:n,wsRef:r,selectedProject:a,minimal:i,isRestarting:o,initialCommandRef:l,isPlainShellRef:c,authUrlRef:d,copyAuthUrlToClipboard:u,closeSocket:p}){const[h,m]=f.useState(!1),g=f.useRef(null),b=a?.fullPath||a?.path||"",x=!!a;f.useEffect(()=>{xR()},[]);const y=f.useCallback(()=>{t.current&&(t.current.clear(),t.current.write("\x1B[2J\x1B[H"))},[t]),v=f.useCallback(()=>{t.current&&(t.current.dispose(),t.current=null),n.current=null,m(!1)},[n,t]);return f.useEffect(()=>{if(!e.current||!x||o||t.current)return;const w=new hR.Terminal(rR);t.current=w;const S=new dR.FitAddon;n.current=S,w.loadAddon(S),i||w.loadAddon(new pR.WebLinksAddon);try{w.loadAddon(new mR.WebglAddon)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}w.open(e.current);const E=async()=>{const C=w.getSelection();return C?gr(C):!1},k=C=>{if(!w.hasSelection())return;const I=w.getSelection();if(I){if(C.preventDefault(),C.clipboardData){C.clipboardData.setData("text/plain",I);return}gr(I)}};e.current.addEventListener("copy",k),w.attachCustomKeyEventHandler(C=>{const I=x5(l.current)?g5:d.current;return C.type==="keydown"&&i&&c.current&&I&&!C.ctrlKey&&!C.metaKey&&!C.altKey&&C.key?.toLowerCase()==="c"?(C.preventDefault(),C.stopPropagation(),u(I),!1):C.type==="keydown"&&(C.ctrlKey||C.metaKey)&&C.key?.toLowerCase()==="c"&&w.hasSelection()?(C.preventDefault(),C.stopPropagation(),E(),!1):C.type==="keydown"&&(C.ctrlKey||C.metaKey)&&C.key?.toLowerCase()==="v"?(C.preventDefault(),C.stopPropagation(),typeof navigator<"u"&&navigator.clipboard?.readText&&navigator.clipboard.readText().then(O=>{ci(r.current,{type:"input",data:O})}).catch(()=>{}),!1):!0}),window.setTimeout(()=>{const C=n.current,I=t.current;!C||!I||(C.fit(),ci(r.current,{type:"resize",cols:I.cols,rows:I.rows}))},b5),m(!0);const T=w.onData(C=>{ci(r.current,{type:"input",data:C})}),_=new ResizeObserver(()=>{g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{const C=n.current,I=t.current;!C||!I||(C.fit(),ci(r.current,{type:"resize",cols:I.cols,rows:I.rows}))},Xj)});return _.observe(e.current),()=>{e.current?.removeEventListener("copy",k),_.disconnect(),g.current!==null&&(window.clearTimeout(g.current),g.current=null),T.dispose(),p(),v()}},[d,p,u,v,n,l,c,o,i,x,b,e,t,r]),{isInitialized:h,clearTerminalScreen:y,disposeTerminal:v}}function vR({selectedProject:e,selectedSession:t,initialCommand:n,isPlainShell:r,minimal:a,autoConnect:i,isRestarting:o,onProcessComplete:l,onOutputRef:c}){const d=f.useRef(null),u=f.useRef(null),p=f.useRef(null),h=f.useRef(null),[m,g]=f.useState(""),[b,x]=f.useState(0),y=f.useRef(e),v=f.useRef(t),w=f.useRef(n),S=f.useRef(r),E=f.useRef(l),k=f.useRef(""),T=f.useRef(t?.id??null);f.useEffect(()=>{y.current=e,v.current=t,w.current=n,S.current=r,E.current=l},[e,t,n,r,l]);const _=f.useCallback(H=>{k.current=H,g(H),x(L=>L+1)},[]),C=f.useCallback(()=>{const H=h.current;H&&((H.readyState===WebSocket.OPEN||H.readyState===WebSocket.CONNECTING)&&H.close(),h.current=null)},[]),I=f.useCallback((H=k.current)=>{if(!H)return!1;const L=window.open(H,"_blank");if(L){try{L.opener=null}catch{}return!0}return!1},[]),O=f.useCallback(async(H=k.current)=>H?gr(H):!1,[]),{isInitialized:A,clearTerminalScreen:R,disposeTerminal:N}=yR({terminalContainerRef:d,terminalRef:u,fitAddonRef:p,wsRef:h,selectedProject:e,minimal:a,isRestarting:o,initialCommandRef:w,isPlainShellRef:S,authUrlRef:k,copyAuthUrlToClipboard:O,closeSocket:C}),{isConnected:F,isConnecting:K,connectToShell:B,disconnectFromShell:W}=cR({wsRef:h,terminalRef:u,fitAddonRef:p,selectedProjectRef:y,selectedSessionRef:v,initialCommandRef:w,isPlainShellRef:S,onProcessCompleteRef:E,isInitialized:A,autoConnect:i,closeSocket:C,clearTerminalScreen:R,setAuthUrl:_,onOutputRef:c});return f.useEffect(()=>{o&&(W(),N())},[W,N,o]),f.useEffect(()=>{e||(W(),N())},[W,N,e]),f.useEffect(()=>{const H=t?.id??null;T.current!==H&&A&&W(),T.current=H},[W,A,t?.id]),{terminalContainerRef:d,terminalRef:u,wsRef:h,isConnected:F,isInitialized:A,isConnecting:K,authUrl:m,authUrlVersion:b,connectToShell:B,disconnectFromShell:W,openAuthUrlInBrowser:I,copyAuthUrlToClipboard:O}}function wR({mode:e,description:t,loadingLabel:n,connectLabel:r,connectTitle:a,connectingLabel:i,onConnect:o}){return e==="loading"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:s.jsx("div",{className:"text-white",children:n})}):e==="connect"?s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("button",{onClick:o,className:"flex w-full items-center justify-center space-x-2 rounded-lg bg-green-600 px-6 py-3 text-base font-medium text-white transition-colors hover:bg-green-700 sm:w-auto",title:a,children:[s.jsx("svg",{className:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),s.jsx("span",{children:r})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})}):s.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:s.jsxs("div",{className:"w-full max-w-sm text-center",children:[s.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),s.jsx("span",{className:"text-base font-medium",children:i})]}),s.jsx("p",{className:"mt-3 px-2 text-sm text-gray-400",children:t})]})})}function kR({title:e,description:t}){return s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:e}),s.jsx("p",{children:t})]})})}function SR({isConnected:e,isInitialized:t,isRestarting:n,hasSession:r,sessionDisplayNameShort:a,onDisconnect:i,onRestart:o,statusNewSessionText:l,statusInitializingText:c,statusRestartingText:d,disconnectLabel:u,disconnectTitle:p,restartLabel:h,restartTitle:m,disableRestart:g}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-500":"bg-red-500"}`}),r&&a&&s.jsxs("span",{className:"text-xs text-blue-300",children:["(",a,"...)"]}),!r&&s.jsx("span",{className:"text-xs text-gray-400",children:l}),!t&&s.jsx("span",{className:"text-xs text-yellow-400",children:c}),n&&s.jsx("span",{className:"text-xs text-blue-400",children:d})]}),s.jsxs("div",{className:"flex items-center space-x-3",children:[e&&s.jsxs("button",{onClick:i,className:"flex items-center space-x-1 rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700",title:p,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),s.jsx("span",{children:u})]}),s.jsxs("button",{onClick:o,disabled:g,className:"flex items-center space-x-1 text-xs text-gray-400 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",title:m,children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),s.jsx("span",{children:h})]})]})]})})}function ER({terminalContainerRef:e,authUrl:t,authUrlVersion:n,initialCommand:r,isConnected:a,openAuthUrlInBrowser:i,copyAuthUrlToClipboard:o}){const[l,c]=f.useState("idle"),[d,u]=f.useState(!1),p=f.useMemo(()=>fR(r,t),[t,r]);f.useEffect(()=>{c("idle"),u(!1)},[n,p,a]);const h=!!p,m=h&&!d,g=h&&d;return s.jsxs("div",{className:"relative h-full w-full bg-gray-900",children:[s.jsx("div",{ref:e,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),m&&s.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),s.jsx("button",{type:"button",onClick:()=>u(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),s.jsx("input",{type:"text",value:p,readOnly:!0,onClick:b=>b.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{i(p)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),s.jsx("button",{type:"button",onClick:async()=>{const b=await o(p);c(b?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:l==="copied"?"Copied":"Copy URL"})]})]})}),g&&s.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:s.jsx("button",{type:"button",onClick:()=>u(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}const NR=[{type:"key",id:"esc",label:"Esc",sequence:"\x1B"},{type:"key",id:"tab",label:"Tab",sequence:" "},{type:"key",id:"shift-tab",label:"⇧Tab",sequence:"\x1B[Z"},{type:"modifier",id:"ctrl",label:"CTRL",modifier:"ctrl"},{type:"modifier",id:"alt",label:"ALT",modifier:"alt"},{type:"arrow",id:"arrow-up",sequence:"\x1B[A",icon:"up"},{type:"arrow",id:"arrow-down",sequence:"\x1B[B",icon:"down"},{type:"arrow",id:"arrow-left",sequence:"\x1B[D",icon:"left"},{type:"arrow",id:"arrow-right",sequence:"\x1B[C",icon:"right"}],CR={up:QS,down:t0,left:ZI,right:n0},Ys=e=>e.preventDefault(),yy="shrink-0 rounded-md border border-gray-600 bg-gray-700 px-2.5 py-1.5 text-xs font-medium text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40",TR="shrink-0 rounded-md border border-blue-500 bg-blue-600 px-2.5 py-1.5 text-xs font-medium text-white transition-colors select-none disabled:cursor-not-allowed disabled:opacity-40",Bd="shrink-0 rounded-md border border-gray-600 bg-gray-700 p-1.5 text-gray-100 transition-colors select-none active:bg-blue-600 active:text-white active:border-blue-600 disabled:cursor-not-allowed disabled:opacity-40";function vy({wsRef:e,terminalRef:t,isConnected:n,bottomOffset:r="bottom-0"}){const{t:a}=Re("settings"),[i,o]=f.useState(!1),[l,c]=f.useState(!1),d=f.useCallback(m=>{ci(e.current,{type:"input",data:m})},[e]),u=f.useCallback(()=>{t.current?.scrollToBottom()},[t]),p=f.useCallback(async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.readText))try{const m=await navigator.clipboard.readText();m.length>0&&d(m)}catch{}},[d]),h=f.useCallback(m=>{let g=m;if(i&&m.length===1){const b=m.toLowerCase().charCodeAt(0);b>=97&&b<=122&&(g=String.fromCharCode(b-96)),o(!1)}l&&m.length===1&&(g="\x1B"+g,c(!1)),d(g)},[i,l,d]);return s.jsx("div",{className:`pointer-events-none fixed inset-x-0 ${r} z-20 px-2 md:hidden`,children:s.jsxs("div",{className:"pointer-events-auto flex items-center gap-1 overflow-x-auto rounded-lg border border-gray-700/80 bg-gray-900/95 px-1.5 py-1.5 shadow-lg backdrop-blur-sm [-webkit-overflow-scrolling:touch] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx("button",{type:"button",onPointerDown:Ys,onClick:()=>{p()},disabled:!n,className:Bd,title:a("terminalShortcuts.paste",{defaultValue:"Paste"}),"aria-label":a("terminalShortcuts.paste",{defaultValue:"Paste"}),children:s.jsx(i0,{className:"h-4 w-4"})}),NR.map(m=>{if(m.type==="modifier"){const g=m.modifier==="ctrl"?i:l,b=m.modifier==="ctrl"?()=>o(x=>!x):()=>c(x=>!x);return s.jsx("button",{type:"button",onPointerDown:Ys,onClick:b,disabled:!n,className:g?TR:yy,children:m.label},m.id)}if(m.type==="arrow"){const g=CR[m.icon];return s.jsx("button",{type:"button",onPointerDown:Ys,onClick:()=>d(m.sequence),disabled:!n,className:Bd,children:s.jsx(g,{className:"h-4 w-4"})},m.id)}return s.jsx("button",{type:"button",onPointerDown:Ys,onClick:()=>h(m.sequence),disabled:!n,className:yy,children:m.label},m.id)}),s.jsx("button",{type:"button",onPointerDown:Ys,onClick:u,disabled:!n,className:Bd,title:a("terminalShortcuts.scrollDown"),"aria-label":a("terminalShortcuts.scrollDown"),children:s.jsx(XI,{className:"h-4 w-4"})})]})})}function y5({selectedProject:e=null,selectedSession:t=null,initialCommand:n=null,isPlainShell:r=!1,onProcessComplete:a=null,minimal:i=!1,autoConnect:o=!1,isActive:l=!0}){const{t:c}=Re("chat"),[d,u]=f.useState(!1),[p,h]=f.useState(null),m=f.useRef(null),g=f.useRef(null),{terminalContainerRef:b,terminalRef:x,wsRef:y,isConnected:v,isInitialized:w,isConnecting:S,authUrl:E,authUrlVersion:k,connectToShell:T,disconnectFromShell:_,openAuthUrlInBrowser:C,copyAuthUrlToClipboard:I}=vR({selectedProject:e,selectedSession:t,initialCommand:n,isPlainShell:r,minimal:i,autoConnect:o,isRestarting:d,onProcessComplete:a,onOutputRef:g}),O=f.useCallback(()=>{const U=x.current;if(!U)return;const M=U.buffer.active,J=M.baseY+M.cursorY,te=Math.min(M.baseY+M.length-1,J+10),de=Math.max(0,J-Qj),ue=[];for(let De=de;De<=te;De++){const Ue=M.getLine(De);Ue&&ue.push(Ue.translateToString().trimEnd())}let se=-1;for(let De=ue.length-1;De>=0;De--)if(/esc to cancel/i.test(ue[De])||/enter to select/i.test(ue[De])){se=De;break}if(se===-1){h(null);return}const he=new Map,Te=Math.max(0,se-eR);for(let De=se-1;De>=Te;De--){const Ue=ue[De].match(/^\s*[❯›>]?\s*(\d+)\.\s+(.+)/);if(Ue){const P=Ue[1],pe=Ue[2].trim();parseInt(P,10)<=tR&&pe.length>0&&!he.has(P)&&he.set(P,pe)}}const Ae=[];for(let De=1;De<=he.size&&he.has(String(De));De++)Ae.push({number:String(De),label:he.get(String(De))});h(Ae.length>=nR?Ae:null)},[x]),A=f.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(O,Jj)},[O]);f.useEffect(()=>{g.current=A},[A]),f.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),f.useEffect(()=>{v||(m.current&&(clearTimeout(m.current),m.current=null),h(null))},[v]),f.useEffect(()=>{if(!l||!w||!v)return;const U=()=>{x.current?.focus()},M=window.requestAnimationFrame(U),J=window.setTimeout(U,0);return()=>{window.cancelAnimationFrame(M),window.clearTimeout(J)}},[l,v,w,x]);const R=f.useCallback(U=>{ci(y.current,{type:"input",data:U})},[y]),N=f.useMemo(()=>gR(t),[t]),F=f.useMemo(()=>N?N.slice(0,30):null,[N]),K=f.useMemo(()=>N?N.slice(0,50):null,[N]),B=f.useCallback(()=>{u(!0),window.setTimeout(()=>{u(!1)},Zj)},[]);if(!e)return s.jsx(kR,{title:c("shell.selectProject.title"),description:c("shell.selectProject.description")});if(i)return s.jsxs(s.Fragment,{children:[s.jsx(ER,{terminalContainerRef:b,authUrl:E,authUrlVersion:k,initialCommand:n,isConnected:v,openAuthUrlInBrowser:C,copyAuthUrlToClipboard:I}),s.jsx(vy,{wsRef:y,terminalRef:x,isConnected:v,bottomOffset:"bottom-0"})]});const W=r?c("shell.runCommand",{command:n||c("shell.defaultCommand"),projectName:e.displayName}):t?c("shell.resumeSession",{displayName:K}):c("shell.startSession"),H=r?c("shell.runCommand",{command:n||c("shell.defaultCommand"),projectName:e.displayName}):c("shell.startCli",{projectName:e.displayName}),L=w?S?"connecting":v?null:"connect":"loading",G=L==="connecting"?H:W;return s.jsxs("div",{className:"flex h-full w-full flex-col bg-gray-900",children:[s.jsx(SR,{isConnected:v,isInitialized:w,isRestarting:d,hasSession:!!t,sessionDisplayNameShort:F,onDisconnect:_,onRestart:B,statusNewSessionText:c("shell.status.newSession"),statusInitializingText:c("shell.status.initializing"),statusRestartingText:c("shell.status.restarting"),disconnectLabel:c("shell.actions.disconnect"),disconnectTitle:c("shell.actions.disconnectTitle"),restartLabel:c("shell.actions.restart"),restartTitle:c("shell.actions.restartTitle"),disableRestart:d||v}),s.jsxs("div",{className:"relative flex-1 overflow-hidden p-2",children:[s.jsx("div",{ref:b,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),L&&s.jsx(wR,{mode:L,description:G,loadingLabel:c("shell.loading"),connectLabel:c("shell.actions.connect"),connectTitle:c("shell.actions.connectTitle"),connectingLabel:c("shell.connecting"),onConnect:T}),p&&v&&s.jsx("div",{className:"absolute inset-x-0 bottom-0 z-10 border-t border-gray-700/80 bg-gray-800/95 px-3 py-2 backdrop-blur-sm",onMouseDown:U=>U.preventDefault(),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.map(U=>s.jsxs("button",{type:"button",onClick:()=>{R(U.number),h(null)},className:"max-w-36 truncate rounded bg-blue-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-blue-700",title:`${U.number}. ${U.label}`,children:[U.number,". ",U.label]},U.number)),s.jsx("button",{type:"button",onClick:()=>{R("\x1B"),h(null)},className:"rounded bg-gray-700 px-3 py-1.5 text-xs font-medium text-gray-200 transition-colors hover:bg-gray-600",children:"Esc"})]})})]}),s.jsx(vy,{wsRef:y,terminalRef:x,isConnected:v})]})}function AR({className:e}){return s.jsx("div",{className:`flex h-full items-center justify-center ${e}`,children:s.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800",children:s.jsx("svg",{className:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),s.jsx("h3",{className:"mb-2 text-lg font-semibold",children:"No Project Selected"}),s.jsx("p",{children:"A project is required to open a shell"})]})})}function _R({title:e,isCompleted:t,onClose:n=null}){return s.jsx("div",{className:"flex-shrink-0 border-b border-gray-700 bg-gray-800 px-4 py-2",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsx("h3",{className:"text-sm font-medium text-gray-200",children:e}),t&&s.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),n&&s.jsx("button",{onClick:n,className:"text-gray-400 hover:text-white",title:"Close",children:s.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}function v5({project:e=null,session:t=null,command:n=null,isPlainShell:r=null,isActive:a=!0,autoConnect:i=!0,onComplete:o=null,onClose:l=null,title:c=null,className:d="",showHeader:u=!0,compact:p=!1,minimal:h=!1}){const[m,g]=f.useState(!1),b=r!==null?r:n!==null,x=f.useCallback(y=>{g(!0),o?.(y)},[o]);return e?s.jsxs("div",{className:`flex h-full w-full flex-col ${d}`,children:[!h&&u&&c&&s.jsx(_R,{title:c,isCompleted:m,onClose:l}),s.jsx("div",{className:"min-h-0 w-full flex-1",children:s.jsx(y5,{selectedProject:e,selectedSession:t,initialCommand:n,isPlainShell:b,isActive:a,onProcessComplete:x,minimal:h,autoConnect:h?!0:i})})]}):s.jsx(AR,{className:d})}const IR=(e,t)=>t||(e==="claude"?"claude --dangerously-skip-permissions /login":e==="cursor"?"cursor-agent login":e==="codex"?"codex login":e==="qwen"?"qwen auth":e==="opencode"?"opencode auth login":"gemini"),jR={claude:{keyLabel:"Anthropic API Key",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console"},codex:{keyLabel:"OpenAI API Key",keyExample:"sk-...",supportsBaseUrl:!0,baseUrlExample:"https://api.openai.com/v1",keyConsoleUrl:"https://platform.openai.com/api-keys",keyConsoleLabel:"OpenAI Platform"},gemini:{keyLabel:"Gemini API Key",keyExample:"AI...",supportsBaseUrl:!1,keyConsoleUrl:"https://aistudio.google.com/app/apikey",keyConsoleLabel:"Google AI Studio"},qwen:{keyLabel:"OpenAI-Compatible API Key",keyExample:"sk-... or sk-sp-...",supportsBaseUrl:!0,baseUrlExample:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",keyConsoleUrl:"https://github.com/QwenLM/qwen-code",keyConsoleLabel:"Qwen Code Docs",notes:"Accepts any OpenAI-compatible endpoint — Alibaba Cloud, ModelScope, OpenRouter, self-hosted, etc."},opencode:{keyLabel:"Anthropic API Key (default backend)",keyExample:"sk-ant-...",supportsBaseUrl:!0,baseUrlExample:"https://api.anthropic.com",keyConsoleUrl:"https://console.anthropic.com/settings/keys",keyConsoleLabel:"Anthropic Console",notes:"OpenCode is multi-provider — this sets the Anthropic credentials. Switch providers via `opencode auth login` or opencode.json."}};function wy({active:e,children:t,onClick:n}){return s.jsx("button",{onClick:n,className:`flex-1 border-b-2 px-4 py-2.5 text-sm font-medium transition-colors ${e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:t})}function RR({provider:e}){const[t,n]=f.useState(""),[r,a]=f.useState(!1),[i,o]=f.useState("idle"),[l,c]=f.useState(null),d=async()=>{const u=t.trim();if(u){a(!0),c(null),o("idle");try{const p=await we(`/api/providers/${e}/oauth-paste`,{method:"POST",body:JSON.stringify({callbackUrl:u})}),h=await p.json().catch(()=>({}));if(!p.ok||!h?.success)throw new Error(h?.error||`Request failed (${p.status})`);o("ok"),n("")}catch(p){c(p?.message||"Forward failed"),o("error")}finally{a(!1)}}};return s.jsxs("div",{className:"mt-3 rounded-lg border border-border/60 bg-muted/30 p-3 text-sm",children:[s.jsx("div",{className:"mb-2 font-medium text-foreground",children:"Remote login? Paste the callback URL here"}),s.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["When the CLI shows ",s.jsx("code",{className:"rounded bg-background px-1 font-mono text-[11px]",children:"http://127.0.0.1:PORT/…"})," and your browser can't reach it (VPS setups), copy the failing URL from your address bar and paste it below. Pixcode forwards the token exchange to the CLI process on this host."]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"url",value:t,onChange:u=>n(u.target.value),placeholder:"http://127.0.0.1:49312/callback?code=...",className:"flex-1 rounded-md border border-border bg-background px-3 py-2 font-mono text-xs text-foreground focus:border-primary focus:outline-none",onKeyDown:u=>{u.key==="Enter"&&d()}}),s.jsx("button",{onClick:()=>void d(),disabled:r||!t.trim(),className:"flex items-center gap-1.5 rounded-md bg-foreground px-3 py-2 text-xs font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:r?s.jsx(fn,{className:"h-3.5 w-3.5 animate-spin"}):"Forward"})]}),i==="ok"&&s.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-emerald-600 dark:text-emerald-400",children:[s.jsx(Gt,{className:"h-3.5 w-3.5"})," Forwarded — check the terminal above for the completion message."]}),i==="error"&&l&&s.jsx("div",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:l})]})}function DR({provider:e,onSaved:t}){const n=jR[e],[r,a]=f.useState(""),[i,o]=f.useState(""),[l,c]=f.useState(!1),[d,u]=f.useState("idle"),[p,h]=f.useState(null);f.useEffect(()=>{let g=!1;return(async()=>{try{const x=await(await we("/api/providers/credentials")).json().catch(()=>({}));if(g||!x?.success)return;const y=x.data?.[e];y?.baseUrl&&o(y.baseUrl)}catch{}})(),()=>{g=!0}},[e]);const m=async()=>{const g=r.trim();if(g){c(!0),h(null),u("idle");try{const b=await we(`/api/providers/${e}/auth/api-key`,{method:"POST",body:JSON.stringify({apiKey:g,baseUrl:n.supportsBaseUrl&&i.trim()?i.trim():""})}),x=await b.json().catch(()=>({}));if(!b.ok||!x?.success)throw new Error(x?.error||`Request failed (${b.status})`);u("ok"),a(""),t()}catch(b){h(b?.message||"Save failed"),u("error")}finally{c(!1)}}};return n?s.jsx("div",{className:"flex h-full flex-col overflow-y-auto p-6",children:s.jsxs("div",{className:"mx-auto w-full max-w-lg space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-muted",children:s.jsx(Tj,{className:"h-5 w-5 text-foreground"})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-base font-semibold text-foreground",children:n.keyLabel}),s.jsxs("a",{href:n.keyConsoleUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:["Get a key from ",n.keyConsoleLabel,s.jsx(Mr,{className:"h-3 w-3"})]})]})]}),n.notes&&s.jsx("div",{className:"rounded-md border border-border/60 bg-muted/40 p-3 text-xs text-muted-foreground",children:n.notes}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-foreground",children:"API Key"}),s.jsx("input",{type:"password",value:r,onChange:g=>a(g.target.value),placeholder:n.keyExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Stored locally at ",s.jsx("code",{className:"rounded bg-muted px-1 font-mono text-[10px]",children:"~/.pixcode/provider-credentials.json"})," with 0600 permissions."]})]}),n.supportsBaseUrl&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-foreground",children:["Base URL ",s.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional — use a custom endpoint)"})]}),s.jsx("input",{type:"url",value:i,onChange:g=>o(g.target.value),placeholder:n.baseUrlExample,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-foreground focus:border-primary focus:outline-none",autoComplete:"off",spellCheck:!1}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Point at any OpenAI-compatible proxy (OpenRouter, local LLM, self-hosted, budget provider) to cut costs or hit different models."})]}),s.jsxs("div",{className:"flex items-center gap-3 pt-2",children:[s.jsxs("button",{onClick:()=>void m(),disabled:l||!r.trim(),className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-40",children:[l?s.jsx(fn,{className:"h-4 w-4 animate-spin"}):s.jsx(Gt,{className:"h-4 w-4"}),"Save API Key"]}),d==="ok"&&s.jsx("span",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:"Saved — reconnect to pick it up."}),d==="error"&&p&&s.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:p})]})]})}):s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"This provider uses OAuth only — use the Browser tab to log in."})}function w5({isOpen:e,onClose:t,provider:n="claude",onComplete:r,customCommand:a,isAuthenticated:i=!1}){const{t:o}=Re("common"),l=n!=="cursor",[c,d]=f.useState(l?"apiKey":"browser");f.useEffect(()=>{e&&d(l?"apiKey":"browser")},[e,n,l]);const u=f.useMemo(()=>`${bc[n]??n} Login`,[n]);if(!e)return null;const p=IR(n,a),h=m=>r?.(m);return s.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black bg-opacity-50 max-md:items-stretch max-md:justify-stretch",children:s.jsxs("div",{className:"flex h-3/4 w-full max-w-4xl flex-col rounded-lg bg-white shadow-xl dark:bg-gray-800 max-md:m-0 max-md:h-full max-md:max-w-none max-md:rounded-none md:m-4 md:h-3/4 md:max-w-4xl md:rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[s.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:u}),s.jsx("button",{onClick:t,className:"text-gray-400 transition-colors hover:text-gray-600 dark:hover:text-gray-300","aria-label":"Close login modal",children:s.jsx(bt,{className:"h-6 w-6"})})]}),s.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-700",children:[s.jsx(wy,{active:c==="browser",onClick:()=>d("browser"),children:"Browser / OAuth"}),l&&s.jsx(wy,{active:c==="apiKey",onClick:()=>d("apiKey"),children:"API Key"})]}),s.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:c==="browser"?s.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(v5,{project:m6,command:p,onComplete:h,minimal:!0})}),(n==="claude"||n==="cursor"||n==="qwen")&&s.jsx("div",{className:"border-t border-border/40 bg-background/50 px-4 py-3",children:s.jsx(RR,{provider:n})})]}):s.jsx(DR,{provider:n,onSaved:()=>h(0)})})]})})}const OR=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:e}),LR=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=qa();return s.jsx("img",{src:t?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:e})},MR=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=qa();return s.jsx("img",{src:t?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:e})},PR=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/gemini-ai-icon.svg",alt:"Gemini",className:e}),FR=({className:e="w-5 h-5"})=>{const{isDarkMode:t}=qa(),n=t?"/icons/opencode-logo-dark.svg":"/icons/opencode-logo-light.svg";return s.jsx("img",{src:n,alt:"OpenCode",className:e})},zR=({className:e="w-5 h-5"})=>s.jsx("img",{src:"/icons/qwen-logo.svg",alt:"Qwen Code",className:e});function Rn({provider:e="claude",className:t="w-5 h-5"}){return e==="cursor"?s.jsx(MR,{className:t}):e==="codex"?s.jsx(LR,{className:t}):e==="gemini"?s.jsx(PR,{className:t}):e==="qwen"?s.jsx(zR,{className:t}):e==="opencode"?s.jsx(FR,{className:t}):s.jsx(OR,{className:t})}function BR({provider:e,title:t,status:n,connectedClassName:r,iconContainerClassName:a,loginButtonClassName:i,onLogin:o}){const l=n.authenticated?r:"border-border bg-card",c=n.loading?"Checking...":n.authenticated?n.email||"Connected":n.error||"Not connected";return s.jsx("div",{className:`rounded-lg border p-4 transition-colors ${l}`,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-full ${a}`,children:s.jsx(Rn,{provider:e,className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 font-medium text-foreground",children:[t,n.authenticated&&s.jsx(Gt,{className:"h-4 w-4 text-green-500"})]}),s.jsx("div",{className:"text-xs text-muted-foreground",children:c})]})]}),!n.authenticated&&!n.loading&&s.jsx("button",{onClick:o,className:`${i} rounded-lg px-4 py-2 text-sm font-medium text-white transition-colors`,children:"Login"})]})})}const $R=[{provider:"claude",title:"Claude Code",connectedClassName:"bg-blue-50 dark:bg-blue-900/20 border-blue-200 dark:border-blue-800",iconContainerClassName:"bg-blue-100 dark:bg-blue-900/30",loginButtonClassName:"bg-blue-600 hover:bg-blue-700"},{provider:"cursor",title:"Cursor",connectedClassName:"bg-purple-50 dark:bg-purple-900/20 border-purple-200 dark:border-purple-800",iconContainerClassName:"bg-purple-100 dark:bg-purple-900/30",loginButtonClassName:"bg-purple-600 hover:bg-purple-700"},{provider:"codex",title:"OpenAI Codex",connectedClassName:"bg-gray-100 dark:bg-gray-800/50 border-gray-300 dark:border-gray-600",iconContainerClassName:"bg-gray-100 dark:bg-gray-800",loginButtonClassName:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"},{provider:"gemini",title:"Gemini",connectedClassName:"bg-teal-50 dark:bg-teal-900/20 border-teal-200 dark:border-teal-800",iconContainerClassName:"bg-teal-100 dark:bg-teal-900/30",loginButtonClassName:"bg-teal-600 hover:bg-teal-700"},{provider:"qwen",title:"Qwen Code",connectedClassName:"bg-orange-50 dark:bg-orange-900/20 border-orange-200 dark:border-orange-800",iconContainerClassName:"bg-orange-100 dark:bg-orange-900/30",loginButtonClassName:"bg-orange-600 hover:bg-orange-700"}];function UR({providerStatuses:e,onOpenProviderLogin:t}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-6 text-center",children:[s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Connect Your AI Agents"}),s.jsx("p",{className:"text-muted-foreground",children:"Login to one or more AI coding assistants. All are optional."})]}),s.jsx("div",{className:"space-y-3",children:$R.map(n=>s.jsx(BR,{provider:n.provider,title:n.title,status:e[n.provider],connectedClassName:n.connectedClassName,iconContainerClassName:n.iconContainerClassName,loginButtonClassName:n.loginButtonClassName,onLogin:()=>t(n.provider)},n.provider))}),s.jsx("div",{className:"pt-2 text-center text-sm text-muted-foreground",children:s.jsx("p",{children:"You can configure these later in Settings."})})]})}function GR({gitName:e,gitEmail:t,isSubmitting:n,onGitNameChange:r,onGitEmailChange:a}){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"mb-8 text-center",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-blue-100 dark:bg-blue-900/30",children:s.jsx(rr,{className:"h-8 w-8 text-blue-600 dark:text-blue-400"})}),s.jsx("h2",{className:"mb-2 text-2xl font-bold text-foreground",children:"Git Configuration"}),s.jsx("p",{className:"text-muted-foreground",children:"Configure your git identity to ensure proper attribution for commits."})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitName",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(Nj,{className:"h-4 w-4"}),"Git Name ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"text",id:"gitName",value:e,onChange:i=>r(i.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"John Doe",required:!0,disabled:n}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.name`."})]}),s.jsxs("div",{children:[s.jsxs("label",{htmlFor:"gitEmail",className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[s.jsx(Sj,{className:"h-4 w-4"}),"Git Email ",s.jsx("span",{className:"text-red-500",children:"*"})]}),s.jsx("input",{type:"email",id:"gitEmail",value:t,onChange:i=>a(i.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:"john@example.com",required:!0,disabled:n}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Saved as `git config --global user.email`."})]})]})]})}const ky=[{title:"Git Configuration",icon:rr,required:!0},{title:"Connect Agents",icon:e5,required:!1}];function HR({currentStep:e}){return s.jsx("div",{className:"mb-8",children:s.jsx("div",{className:"flex items-center justify-between",children:ky.map((t,n)=>{const r=n<e,a=n===e,i=t.icon;return s.jsxs("div",{className:"contents",children:[s.jsxs("div",{className:"flex flex-1 flex-col items-center",children:[s.jsx("div",{className:`flex h-12 w-12 items-center justify-center rounded-full border-2 transition-colors duration-200 ${r?"border-green-500 bg-green-500 text-white":a?"border-blue-600 bg-blue-600 text-white":"border-border bg-background text-muted-foreground"}`,children:r?s.jsx(Gt,{className:"h-6 w-6"}):s.jsx(i,{className:"h-6 w-6"})}),s.jsxs("div",{className:"mt-2 text-center",children:[s.jsx("p",{className:`text-sm font-medium ${a?"text-foreground":"text-muted-foreground"}`,children:t.title}),t.required&&s.jsx("span",{className:"text-xs text-red-500",children:"Required"})]})]}),n<ky.length-1&&s.jsx("div",{className:`mx-2 h-0.5 flex-1 transition-colors duration-200 ${r?"bg-green-500":"bg-border"}`})]},t.title)})})})}const Sy=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Ey=async(e,t)=>{try{return(await e.json()).error||t}catch{return t}};function qR({onComplete:e}){const[t,n]=f.useState(0),[r,a]=f.useState(""),[i,o]=f.useState(""),[l,c]=f.useState(!1),[d,u]=f.useState(""),[p,h]=f.useState(null),{providerAuthStatus:m,checkProviderAuthStatus:g,refreshProviderAuthStatuses:b}=p0(),x=f.useRef(void 0),y=f.useCallback(async()=>{try{const _=await we("/api/user/git-config");if(!_.ok)return;const C=await _.json();C.gitName&&a(C.gitName),C.gitEmail&&o(C.gitEmail)}catch(_){console.error("Error loading git config:",_)}},[]);f.useEffect(()=>{y(),b()},[y,b]),f.useEffect(()=>{const _=x.current;x.current=p,_!=null&&p===null&&b()},[p,b]);const v=_=>{h(_)},w=_=>{_===0&&p&&g(p)},S=async()=>{if(u(""),t!==0){n(_=>_+1);return}if(!r.trim()||!i.trim()){u("Both git name and email are required.");return}if(!Sy.test(i)){u("Please enter a valid email address.");return}c(!0);try{const _=await we("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:r,gitEmail:i})});if(!_.ok){const C=await Ey(_,"Failed to save git configuration");throw new Error(C)}n(C=>C+1)}catch(_){u(_ instanceof Error?_.message:"Failed to save git configuration")}finally{c(!1)}},E=()=>{u(""),n(_=>_-1)},k=async()=>{c(!0),u("");try{const _=await we("/api/user/complete-onboarding",{method:"POST"});if(!_.ok){const C=await Ey(_,"Failed to complete onboarding");throw new Error(C)}await e?.()}catch(_){u(_ instanceof Error?_.message:"Failed to complete onboarding")}finally{c(!1)}},T=t===0?!!(r.trim()&&i.trim()&&Sy.test(i)):!0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"w-full max-w-2xl",children:[s.jsx(HR,{currentStep:t}),s.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 shadow-lg",children:[t===0?s.jsx(GR,{gitName:r,gitEmail:i,isSubmitting:l,onGitNameChange:a,onGitEmailChange:o}):s.jsx(UR,{providerStatuses:m,onOpenProviderLogin:v}),d&&s.jsx("div",{className:"mt-6 rounded-lg border border-red-300 bg-red-100 p-4 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:d})}),s.jsxs("div",{className:"mt-8 flex items-center justify-between border-t border-border pt-6",children:[s.jsxs("button",{onClick:E,disabled:t===0||l,className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-muted-foreground transition-colors duration-200 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx(r0,{className:"h-4 w-4"}),"Previous"]}),s.jsx("div",{className:"flex items-center gap-3",children:t<1?s.jsx("button",{onClick:S,disabled:!T||l,className:"flex items-center gap-2 rounded-lg bg-blue-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:cursor-not-allowed disabled:bg-blue-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(fn,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):s.jsxs(s.Fragment,{children:["Next",s.jsx(Sr,{className:"h-4 w-4"})]})}):s.jsx("button",{onClick:k,disabled:l,className:"flex items-center gap-2 rounded-lg bg-green-600 px-6 py-3 font-medium text-white transition-colors duration-200 hover:bg-green-700 disabled:cursor-not-allowed disabled:bg-green-400",children:l?s.jsxs(s.Fragment,{children:[s.jsx(fn,{className:"h-4 w-4 animate-spin"}),"Completing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Gt,{className:"h-4 w-4"}),"Complete Setup"]})})})]})]})]})}),p&&s.jsx(w5,{isOpen:!!p,onClose:()=>h(null),provider:p,onComplete:w})]})}const VR=["0s","0.1s","0.2s"];function WR(){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(vi,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"mb-2 text-2xl font-bold text-foreground",children:"Pixcode"}),s.jsx("div",{className:"flex items-center justify-center space-x-2",children:VR.map(e=>s.jsx("div",{className:"h-2 w-2 animate-bounce rounded-full bg-blue-500",style:{animationDelay:e}},e))}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:"Loading..."})]})})}function k5({errorMessage:e}){return e?s.jsx("div",{className:"rounded-md border border-red-300 bg-red-100 p-3 dark:border-red-800 dark:bg-red-900/20",children:s.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:e})}):null}function So({id:e,label:t,value:n,onChange:r,placeholder:a,isDisabled:i,type:o="text",name:l,autoComplete:c}){return s.jsxs("div",{children:[s.jsx("label",{htmlFor:e,className:"mb-1 block text-sm font-medium text-foreground",children:t}),s.jsx("input",{id:e,type:o,name:l??e,autoComplete:c,value:n,onChange:d=>r(d.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-foreground focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:a,required:!0,disabled:i})]})}function S5({title:e,description:t,children:n,footerText:r,logo:a}){return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsx("div",{className:"w-full max-w-md",children:s.jsxs("div",{className:"space-y-6 rounded-lg border border-border bg-card p-8 shadow-lg",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("div",{className:"mb-4 flex justify-center",children:a??s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-lg bg-primary shadow-sm",children:s.jsx(vi,{className:"h-8 w-8 text-primary-foreground"})})}),s.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e}),s.jsx("p",{className:"mt-2 text-muted-foreground",children:t})]}),n,s.jsx("div",{className:"text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:r})}),s.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-2",children:[s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})}),s.jsx("a",{href:"https://github.com/alicomert/pixcode",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground/50 transition-colors hover:text-muted-foreground",children:"Pixcode is open source"})]})]})})})}const KR={username:"",password:""};function YR(){const{t:e}=Re("auth"),{login:t}=Qo(),[n,r]=f.useState(KR),[a,i]=f.useState(""),[o,l]=f.useState(!1),c=f.useCallback((u,p)=>{r(h=>({...h,[u]:p}))},[]),d=f.useCallback(async u=>{if(u.preventDefault(),i(""),!n.username.trim()||!n.password){i(e("login.errors.requiredFields"));return}l(!0);const p=await t(n.username.trim(),n.password);p.success||i(p.error),l(!1)},[n.password,n.username,t,e]);return s.jsx(S5,{title:e("login.title"),description:e("login.description"),footerText:"Enter your credentials to access Pixcode",children:s.jsxs("form",{onSubmit:d,className:"space-y-4",children:[s.jsx(So,{id:"username",label:e("login.username"),value:n.username,onChange:u=>c("username",u),placeholder:e("login.placeholders.username"),isDisabled:o,autoComplete:"username"}),s.jsx(So,{id:"password",label:e("login.password"),value:n.password,onChange:u=>c("password",u),placeholder:e("login.placeholders.password"),isDisabled:o,type:"password",autoComplete:"current-password"}),s.jsx(k5,{errorMessage:a}),s.jsx("button",{type:"submit",disabled:o,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:e(o?"login.loading":"login.submit")})]})})}const ZR={username:"",password:"",confirmPassword:""};function XR(e){return!e.username.trim()||!e.password||!e.confirmPassword?"Please fill in all fields.":e.username.trim().length<3?"Username must be at least 3 characters long.":e.password.length<6?"Password must be at least 6 characters long.":e.password!==e.confirmPassword?"Passwords do not match.":null}function JR(){const{register:e}=Qo(),[t,n]=f.useState(ZR),[r,a]=f.useState(""),[i,o]=f.useState(!1),l=f.useCallback((d,u)=>{n(p=>({...p,[d]:u}))},[]),c=f.useCallback(async d=>{d.preventDefault(),a("");const u=XR(t);if(u){a(u);return}o(!0);const p=await e(t.username.trim(),t.password);p.success||a(p.error),o(!1)},[t,e]);return s.jsx(S5,{title:"Welcome to Pixcode",description:"Set up your account to get started",footerText:"This is a single-user system. Only one account can be created.",logo:s.jsx("img",{src:"/logo.svg",alt:"Pixcode",className:"h-16 w-16"}),children:s.jsxs("form",{onSubmit:c,className:"space-y-4",children:[s.jsx(So,{id:"username",name:"username",label:"Username",value:t.username,onChange:d=>l("username",d),placeholder:"Enter your username",isDisabled:i,autoComplete:"username"}),s.jsx(So,{id:"password",name:"password",label:"Password",value:t.password,onChange:d=>l("password",d),placeholder:"Enter your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(So,{id:"confirmPassword",name:"confirmPassword",label:"Confirm Password",value:t.confirmPassword,onChange:d=>l("confirmPassword",d),placeholder:"Confirm your password",isDisabled:i,type:"password",autoComplete:"new-password"}),s.jsx(k5,{errorMessage:r}),s.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors duration-200 hover:bg-blue-700 disabled:bg-blue-400",children:i?"Setting up...":"Create Account"})]})})}function QR({children:e}){const{user:t,isLoading:n,needsSetup:r,hasCompletedOnboarding:a,refreshOnboardingStatus:i}=Qo();return n?s.jsx(WR,{}):r?s.jsx(JR,{}):t?a?s.jsx(s.Fragment,{children:e}):s.jsx(qR,{onComplete:i}):s.jsx(YR,{})}const E5=f.createContext(null),N5=()=>{const e=f.useContext(E5);if(!e)throw new Error("useWebSocket must be used within a WebSocketProvider");return e},e9=e=>{const t=window.location.protocol==="https:"?"wss:":"ws:";return e?`${t}//${window.location.host}/ws?token=${encodeURIComponent(e)}`:null},t9=()=>{const e=f.useRef(null),t=f.useRef(!1),n=f.useRef(!1),[r,a]=f.useState(null),[i,o]=f.useState(!1),l=f.useRef(null),{token:c}=Qo();f.useEffect(()=>(d(),()=>{t.current=!0,l.current&&clearTimeout(l.current),e.current&&e.current.close()}),[c]);const d=f.useCallback(()=>{if(!t.current)try{const h=e9(c);if(!h)return console.warn("No authentication token found for WebSocket connection");const m=new WebSocket(h);m.onopen=()=>{o(!0),e.current=m,n.current&&a({type:"websocket-reconnected",timestamp:Date.now()}),n.current=!0},m.onmessage=g=>{try{const b=JSON.parse(g.data);a(b)}catch(b){console.error("Error parsing WebSocket message:",b)}},m.onclose=()=>{o(!1),e.current=null,l.current=setTimeout(()=>{t.current||d()},3e3)},m.onerror=g=>{console.error("WebSocket error:",g)}}catch(h){console.error("Error creating WebSocket connection:",h)}},[c]),u=f.useCallback(h=>{const m=e.current;m&&m.readyState===WebSocket.OPEN?m.send(JSON.stringify(h)):console.warn("WebSocket not connected")},[]);return f.useMemo(()=>({ws:e.current,sendMessage:u,latestMessage:r,isConnected:i}),[u,r,i])},n9=({children:e})=>{const t=t9();return s.jsx(E5.Provider,{value:t,children:e})},C5=f.createContext(null);function r9(e,t){return{message:t instanceof Error?t.message:`Failed to ${e}`,context:e,timestamp:new Date().toISOString()}}function Ny(e){return{...e,taskMasterConfigured:e.taskmaster?.hasTaskmaster??!1,taskMasterStatus:e.taskmaster?.status??"not-configured",taskCount:Number(e.taskmaster?.metadata?.taskCount??0),completedCount:Number(e.taskmaster?.metadata?.completed??0)}}function a9(e){return e.find(t=>t.status==="pending"||t.status==="in-progress")??null}function i9(e){return e?.type?e.type.startsWith("taskmaster-"):!1}function As(){const e=f.useContext(C5);if(!e)throw new Error("useTaskMaster must be used within a TaskMasterProvider");return e}function s9({children:e}){const{latestMessage:t}=N5(),{user:n,token:r,isLoading:a}=Qo(),[i,o]=f.useState([]),[l,c]=f.useState(null),[d,u]=f.useState(null),[p,h]=f.useState(null),[m,g]=f.useState([]),[b,x]=f.useState(null),[y,v]=f.useState(!1),[w,S]=f.useState(!1),[E,k]=f.useState(!1),[T,_]=f.useState(null),C=f.useRef(null);f.useEffect(()=>{C.current=l?.name??null},[l?.name]);const I=f.useCallback(()=>{_(null)},[]),O=f.useCallback((B,W)=>{console.error(`TaskMaster ${B} error:`,W),_(r9(B,W))},[]),A=f.useCallback(B=>{const W=B?Ny(B):null;c(W),u(W?.taskmaster??null),g([]),x(null)},[]),R=f.useCallback(async()=>{if(!n||!r){o([]),c(null),u(null),g([]),x(null);return}try{v(!0),I();const B=await Qe.get("/projects");if(!B.ok)throw new Error(`Failed to fetch projects: ${B.status}`);const W=await B.json(),L=(Array.isArray(W)?W:[]).map(M=>Ny(M));o(L);const G=C.current;if(!G)return;const U=L.find(M=>M.name===G)??null;c(U),u(U?.taskmaster??null)}catch(B){O("load projects",B)}finally{v(!1)}},[I,O,r,n]),N=f.useCallback(async()=>{const B=l?.name;if(!B||!n||!r){g([]),x(null);return}try{S(!0),I();const W=await Qe.get(`/taskmaster/tasks/${encodeURIComponent(B)}`);if(!W.ok){const G=await W.json();throw new Error(G.message??"Failed to load tasks")}const H=await W.json(),L=Array.isArray(H.tasks)?H.tasks:[];g(L),x(a9(L))}catch(W){O("load tasks",W),g([]),x(null)}finally{S(!1)}},[I,l?.name,O,r,n]),F=f.useCallback(async()=>{if(!n||!r){h(null);return}try{k(!0),I();const B=await Qe.get("/mcp-utils/taskmaster-server");if(!B.ok)throw new Error(`Failed to load MCP status: ${B.status}`);const W=await B.json();h(W)}catch(B){O("check MCP server status",B),h(null)}finally{k(!1)}},[I,O,r,n]);f.useEffect(()=>{!a&&n&&r&&(R(),F())},[a,F,R,r,n]),f.useEffect(()=>{l?.name&&n&&r&&N()},[l?.name,N,r,n]),f.useEffect(()=>{const B=t;if(i9(B)){if(B.type==="taskmaster-project-updated"&&B.projectName){R();return}if(B.type==="taskmaster-tasks-updated"&&B.projectName===l?.name){N();return}B.type==="taskmaster-mcp-status-changed"&&F()}},[l?.name,t,F,R,N]);const K=f.useMemo(()=>({projects:i,currentProject:l,projectTaskMaster:d,mcpServerStatus:p,tasks:m,nextTask:b,isLoading:y,isLoadingTasks:w,isLoadingMCP:E,error:T,refreshProjects:R,setCurrentProject:A,refreshTasks:N,refreshMCPStatus:F,clearError:I}),[I,l,T,y,E,w,p,b,d,i,F,R,N,A,m]);return s.jsx(C5.Provider,{value:K,children:e})}const T5=f.createContext({tasksEnabled:!0,setTasksEnabled:()=>{},toggleTasksEnabled:()=>{},isTaskMasterInstalled:null,isTaskMasterReady:null,installationStatus:null,isCheckingInstallation:!0}),Jc=()=>{const e=f.useContext(T5);if(!e)throw new Error("useTasksSettings must be used within a TasksSettingsProvider");return e},o9=({children:e})=>{const[t,n]=f.useState(()=>{const m=localStorage.getItem("tasks-enabled");return m!==null?JSON.parse(m):!0}),[r,a]=f.useState(null),[i,o]=f.useState(null),[l,c]=f.useState(null),[d,u]=f.useState(!0);f.useEffect(()=>{localStorage.setItem("tasks-enabled",JSON.stringify(t))},[t]),f.useEffect(()=>{setTimeout(async()=>{try{const g=await Qe.get("/taskmaster/installation-status");if(g.ok){const b=await g.json();c(b),a(b.installation?.isInstalled||!1),o(b.isReady||!1);const x=localStorage.getItem("tasks-enabled");!b.installation?.isInstalled&&!x&&n(!1)}else console.error("Failed to check TaskMaster installation status"),a(!1),o(!1)}catch(g){console.error("Error checking TaskMaster installation:",g),a(!1),o(!1)}finally{u(!1)}},0)},[]);const h={tasksEnabled:t,setTasksEnabled:n,toggleTasksEnabled:()=>{n(m=>!m)},isTaskMasterInstalled:r,isTaskMasterReady:i,installationStatus:l,isCheckingInstallation:d};return s.jsx(T5.Provider,{value:h,children:e})},A5=f.createContext(null);function Qc(){const e=f.useContext(A5);if(!e)throw new Error("usePlugins must be used within a PluginsProvider");return e}function l9({children:e}){const[t,n]=f.useState([]),[r,a]=f.useState(!0),[i,o]=f.useState(null),l=f.useCallback(async()=>{try{const h=await we("/api/plugins");if(h.ok){const m=await h.json();n(m.plugins||[]),o(null)}else{let m=`Failed to fetch plugins (${h.status})`;try{const g=await h.json();m=g.details||g.error||m}catch{m=h.statusText||m}o(m)}}catch(h){const m=h instanceof Error?h.message:"Failed to fetch plugins";o(m),console.error("[Plugins] Failed to fetch plugins:",h)}finally{a(!1)}},[]);f.useEffect(()=>{l()},[l]);const c=f.useCallback(async h=>{try{const m=await we("/api/plugins/install",{method:"POST",body:JSON.stringify({url:h})}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Install failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Install failed"}}},[l]),d=f.useCallback(async h=>{try{const m=await we(`/api/plugins/${encodeURIComponent(h)}`,{method:"DELETE"}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Uninstall failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Uninstall failed"}}},[l]),u=f.useCallback(async h=>{try{const m=await we(`/api/plugins/${encodeURIComponent(h)}/update`,{method:"POST"}),g=await m.json();return m.ok?(await l(),{success:!0}):{success:!1,error:g.details||g.error||"Update failed"}}catch(m){return{success:!1,error:m instanceof Error?m.message:"Update failed"}}},[l]),p=f.useCallback(async(h,m)=>{try{const g=await we(`/api/plugins/${encodeURIComponent(h)}/enable`,{method:"PUT",body:JSON.stringify({enabled:m})});if(!g.ok){let b=`Toggle failed (${g.status})`;try{const x=await g.json();b=x.details||x.error||b}catch{b=g.statusText||b}return{success:!1,error:b}}return await l(),{success:!0,error:null}}catch(g){return{success:!1,error:g instanceof Error?g.message:"Toggle failed"}}},[l]);return s.jsx(A5.Provider,{value:{plugins:t,loading:r,pluginsError:i,refreshPlugins:l,installPlugin:c,uninstallPlugin:d,updatePlugin:u,togglePlugin:p},children:e})}const Cy=e=>typeof window>"u"?!1:window.innerWidth<e,Ty=()=>{if(typeof window>"u")return!1;const e=window.navigator;return window.matchMedia("(display-mode: standalone)").matches||!!e.standalone||document.referrer.includes("android-app://")};function m0(e={}){const{mobileBreakpoint:t=768,trackMobile:n=!0,trackPWA:r=!0}=e,[a,i]=f.useState(()=>n?Cy(t):!1),[o,l]=f.useState(()=>r?Ty():!1);return f.useEffect(()=>{if(!n||typeof window>"u")return;const c=()=>{i(Cy(t))};return c(),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[t,n]),f.useEffect(()=>{if(!r||typeof window>"u")return;const c=window.matchMedia("(display-mode: standalone)"),d=()=>{l(Ty())};return d(),typeof c.addEventListener=="function"?(c.addEventListener("change",d),()=>{c.removeEventListener("change",d)}):(c.addListener(d),()=>{c.removeListener(d)})},[r]),{isMobile:a,isPWA:o}}const c9=(e,t)=>{const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let a=0;a<Math.max(n.length,r.length);a++){const i=n[a]||0,o=r[a]||0;if(i!==o)return i-o}return 0},d9="1.33.4",_5=(e,t)=>{const[n,r]=f.useState(!1),[a,i]=f.useState(null),[o,l]=f.useState(null),[c,d]=f.useState("git"),[u,p]=f.useState(d9);return f.useEffect(()=>{let h=!1;const m=async()=>{try{const x=await(await fetch("/health",{cache:"no-store"})).json();if(h)return;(x.installMode==="npm"||x.installMode==="git")&&d(x.installMode),typeof x.version=="string"&&/^\d+\.\d+\.\d+/.test(x.version)&&p(x.version)}catch{}};m();const g=()=>{m()};return window.addEventListener("focus",g),()=>{h=!0,window.removeEventListener("focus",g)}},[]),f.useEffect(()=>{if(!u)return;const h=async()=>{try{const x=await(await fetch(`https://api.github.com/repos/${e}/${t}/releases/latest`)).json();if(x.tag_name){const y=x.tag_name.replace(/^v/,"");i(y),r(c9(y,u)>0),l({title:x.name||x.tag_name,body:x.body||"",htmlUrl:x.html_url||`https://github.com/${e}/${t}/releases/latest`,publishedAt:x.published_at})}else r(!1),i(null),l(null)}catch(b){console.error("Version check failed:",b),r(!1),i(null),l(null)}};h();const m=setInterval(h,1800*1e3),g=()=>{h()};return window.addEventListener("focus",g),()=>{clearInterval(m),window.removeEventListener("focus",g)}},[e,t,u]),{updateAvailable:n,latestVersion:a,currentVersion:u,releaseInfo:o,installMode:c}},si={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0,historyView:"flat"},u9=["flat","grouped"],p9=e=>typeof e=="string"&&u9.includes(e),xc=Object.keys(si),m9=new Set(xc),$d="ui-preferences:sync",h9=(e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){if(e==="true")return!0;if(e==="false")return!1}return t},yc=(e,t,n)=>e==="historyView"?p9(t)?t:n:h9(t,n),f9=(e,t)=>{try{const n=localStorage.getItem(e);if(n===null)return t;const r=JSON.parse(n);return yc(e,r,t)}catch{return t}},g9=e=>{if(typeof window>"u")return si;try{const t=localStorage.getItem(e);if(t){const n=JSON.parse(t);if(n&&typeof n=="object"&&!Array.isArray(n)){const r=n;return xc.reduce((a,i)=>(a[i]=yc(i,r[i],si[i]),a),{...si})}}}catch{}return xc.reduce((t,n)=>(t[n]=f9(n,si[n]),t),{...si})};function b9(e,t){switch(t.type){case"set":{const{key:n,value:r}=t;if(!m9.has(n))return e;const a=yc(n,r,e[n]);return e[n]===a?e:{...e,[n]:a}}case"set_many":{const n=t.value||{};let r=!1;const a={...e};for(const i of xc){if(!(i in n))continue;const o=n[i],l=yc(i,o,e[i]);a[i]!==l&&(a[i]=l,r=!0)}return r?a:e}case"reset":return{...si,...t.value||{}};default:return e}}function h0(e="uiPreferences"){const t=f.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[n,r]=f.useReducer(b9,e,g9);return f.useEffect(()=>{typeof window>"u"||(localStorage.setItem(e,JSON.stringify(n)),window.dispatchEvent(new CustomEvent($d,{detail:{storageKey:e,sourceId:t.current,value:n}})))},[n,e]),f.useEffect(()=>{if(typeof window>"u")return;const l=u=>{!u||typeof u!="object"||Array.isArray(u)||r({type:"set_many",value:u})},c=u=>{if(!(u.key!==e||u.newValue===null))try{const p=JSON.parse(u.newValue);l(p)}catch{}},d=u=>{const h=u.detail;!h||h.storageKey!==e||h.sourceId===t.current||l(h.value)};return window.addEventListener("storage",c),window.addEventListener($d,d),()=>{window.removeEventListener("storage",c),window.removeEventListener($d,d)}},[e]),{preferences:n,setPreference:(l,c)=>{r({type:"set",key:l,value:c})},setPreferences:l=>{r({type:"set_many",value:l})},resetPreferences:l=>{r({type:"reset",value:l})},dispatch:r}}const x9=()=>{try{const e=localStorage.getItem("claude-settings");return e&&JSON.parse(e).projectSortOrder==="date"?"date":"name"}catch{return"name"}},y9=()=>{try{const e=localStorage.getItem("starredProjects");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},v9=e=>{try{localStorage.setItem("starredProjects",JSON.stringify([...e]))}catch{}},Ay=(e,t)=>`${e}::${t}`,w9=()=>{try{const e=localStorage.getItem("starredSessions");return e?new Set(JSON.parse(e)):new Set}catch{return new Set}},k9=e=>{try{localStorage.setItem("starredSessions",JSON.stringify([...e]))}catch{}},S9=/(?:^|[\s/\\(\[`"'])([\w./-]+?\.(?:ts|tsx|js|jsx|mjs|cjs|py|rb|go|rs|java|kt|swift|c|cc|cpp|h|hpp|cs|php|sh|bash|zsh|json|ya?ml|toml|md|mdx|html?|css|scss|less|sql|prisma|graphql|gql|vue|svelte|astro|dart|lua|r|pl|ps1|tf|dockerfile|env))(?:$|[\s:,)\]`"'])/i,E9=e=>{if(!e)return[];const t=new Set,n=new RegExp(S9.source,"gi");let r;for(;(r=n.exec(e))!==null;){const a=r[1],i=a.lastIndexOf(".");if(i>-1){const o=a.slice(i+1).toLowerCase();o&&o.length<=10&&t.add(o)}if(t.size>=3)break}return[...t]},pi=e=>e.__provider==="cursor"?new Date(e.createdAt||0):e.__provider==="codex"?new Date(e.createdAt||e.lastActivity||0):new Date(e.lastActivity||e.createdAt||0),N9=(e,t)=>e.__provider==="cursor"?e.summary||e.name||t("projects.untitledSession"):e.__provider==="codex"?e.summary||e.name||t("projects.codexSession"):e.__provider==="gemini"||e.__provider==="qwen"?e.summary||e.name||t("projects.newSession"):e.summary||t("projects.newSession"),C9=e=>e.__provider==="cursor"?String(e.createdAt||""):e.__provider==="codex"?String(e.createdAt||e.lastActivity||""):String(e.lastActivity||e.createdAt||""),T9=(e,t,n)=>{const r=pi(e),a=Math.floor((t.getTime()-r.getTime())/(1e3*60));return{isCursorSession:e.__provider==="cursor",isCodexSession:e.__provider==="codex",isGeminiSession:e.__provider==="gemini",isQwenSession:e.__provider==="qwen",isActive:a<10,sessionName:N9(e,n),sessionTime:C9(e),messageCount:Number(e.messageCount||0)}},I5=(e,t)=>{const n=[...e.sessions||[],...t[e.name]||[]].map(p=>({...p,__provider:"claude"})),r=(e.cursorSessions||[]).map(p=>({...p,__provider:"cursor"})),a=(e.codexSessions||[]).map(p=>({...p,__provider:"codex"})),i=p=>typeof p.id=="string"&&p.id.startsWith("qwen_")||p.provider==="qwen",o=e.geminiSessions||[],l=o.filter(p=>!i(p)).map(p=>({...p,__provider:"gemini"})),c=o.filter(p=>i(p)).map(p=>({...p,__provider:"qwen"})),d=[...(e.qwenSessions||[]).map(p=>({...p,__provider:"qwen"})),...c],u=new Map;for(const p of[...n,...r,...a,...l,...d])u.has(p.id)||u.set(p.id,p);return[...u.values()].sort((p,h)=>pi(h).getTime()-pi(p).getTime())},_y=(e,t)=>{const n=I5(e,t);return n.length===0?new Date(0):n.reduce((r,a)=>{const i=pi(a);return i>r?i:r},new Date(0))},A9=(e,t,n,r)=>{const a=[...e];return a.sort((i,o)=>{const l=n.has(i.name),c=n.has(o.name);return l&&!c?-1:!l&&c?1:t==="date"?_y(o,r).getTime()-_y(i,r).getTime():(i.displayName||i.name).localeCompare(o.displayName||o.name)}),a},_9=(e,t)=>{const n=t.trim().toLowerCase();return n?e.filter(r=>{const a=(r.displayName||r.name).toLowerCase(),i=r.name.toLowerCase();return a.includes(n)||i.includes(n)}):e},I9=(e,t)=>{const n=!!e.taskmaster?.hasTaskmaster,r=!!(t?.hasMCPServer&&t?.isConfigured);return n&&r?"fully-configured":n?"taskmaster-only":r?"mcp-only":"not-configured"},j9=e=>{const t=typeof e.fullPath=="string"&&e.fullPath.length>0?e.fullPath:typeof e.path=="string"?e.path:"";return{name:e.name,displayName:typeof e.displayName=="string"&&e.displayName.trim().length>0?e.displayName:e.name,fullPath:t,path:typeof e.path=="string"&&e.path.length>0?e.path:t}};function R9({projects:e,selectedProject:t,selectedSession:n,isLoading:r,isMobile:a,t:i,onRefresh:o,onProjectSelect:l,onSessionSelect:c,onSessionDelete:d,onProjectDelete:u,setCurrentProject:p,setSidebarVisible:h,sidebarVisible:m}){const[g,b]=f.useState(new Set),[x,y]=f.useState(null),[v,w]=f.useState(!1),[S,E]=f.useState(""),[k,T]=f.useState({}),[_,C]=f.useState({}),[I,O]=f.useState(new Set),[A,R]=f.useState(new Date),[N,F]=f.useState("name"),[K,B]=f.useState(!1),[W,H]=f.useState({}),[L,G]=f.useState(null),[U,M]=f.useState(""),[J,te]=f.useState(""),[de,ue]=f.useState(new Set),[se,he]=f.useState(null),[Te,Ae]=f.useState(null),[De,Ue]=f.useState(!1),[P,pe]=f.useState(()=>y9()),[le,Y]=f.useState(()=>w9()),[q,re]=f.useState("projects"),[be,fe]=f.useState(null),[ae,ye]=f.useState(!1),[ee,ne]=f.useState(null),Z=f.useRef(null),oe=f.useRef(0),xe=f.useRef(null),Le=!a&&!m;f.useEffect(()=>{const me=setInterval(()=>{R(new Date)},6e4);return()=>clearInterval(me)},[]),f.useEffect(()=>{C({}),O(new Set),H({})},[e]),f.useEffect(()=>{t&&b(me=>{if(me.has(t.name))return me;const ve=new Set(me);return ve.add(t.name),ve})},[n,t]),f.useEffect(()=>{if(e.length>0&&!r){const me=new Set;e.forEach(ve=>{ve.sessions&&ve.sessions.length>=0&&me.add(ve.name)}),O(me)}},[e,r]),f.useEffect(()=>{const me=()=>{F(x9())};me();const ve=_e=>{_e.key==="claude-settings"&&me()},ke=()=>me();return window.addEventListener("storage",ve),window.addEventListener("pixcode:settings-changed",ke),()=>{window.removeEventListener("storage",ve),window.removeEventListener("pixcode:settings-changed",ke)}},[]),f.useEffect(()=>{Z.current&&clearTimeout(Z.current),xe.current&&(xe.current.close(),xe.current=null);const me=J.trim();if(q!=="conversations"||me.length<2){oe.current+=1,fe(null),ne(null),ye(!1);return}ye(!0);const ve=++oe.current;return Z.current=setTimeout(()=>{if(ve!==oe.current)return;const ke=Qe.searchConversationsUrl(me),_e=new EventSource(ke);xe.current=_e;const qe=[];let dt=0;_e.addEventListener("result",Xe=>{if(ve!==oe.current){_e.close();return}try{const Kt=JSON.parse(Xe.data);qe.push(Kt.projectResult),dt=Kt.totalMatches,fe({results:[...qe],totalMatches:dt,query:me}),ne({scannedProjects:Kt.scannedProjects,totalProjects:Kt.totalProjects})}catch{}}),_e.addEventListener("progress",Xe=>{if(ve!==oe.current){_e.close();return}try{const Kt=JSON.parse(Xe.data);dt=Kt.totalMatches,ne({scannedProjects:Kt.scannedProjects,totalProjects:Kt.totalProjects})}catch{}}),_e.addEventListener("done",()=>{if(ve!==oe.current){_e.close();return}_e.close(),xe.current=null,ye(!1),ne(null),qe.length===0&&fe({results:[],totalMatches:0,query:me})}),_e.addEventListener("error",()=>{if(ve!==oe.current){_e.close();return}_e.close(),xe.current=null,ye(!1),ne(null),qe.length===0&&fe({results:[],totalMatches:0,query:me})})},400),()=>{Z.current&&clearTimeout(Z.current),xe.current&&(xe.current.close(),xe.current=null)}},[J,q]),f.useCallback(me=>ve=>{const ke=ve.target;ke.closest(".overflow-y-auto")||ke.closest("[data-scroll-container]")||(ve.preventDefault(),ve.stopPropagation(),me())},[]);const Be=f.useCallback(me=>{b(ve=>{const ke=new Set;return ve.has(me)||ke.add(me),ke})},[]),ot=f.useCallback((me,ve)=>{c({...me,__projectName:ve})},[c]),ht=f.useCallback(me=>{pe(ve=>{const ke=new Set(ve);return ke.has(me)?ke.delete(me):ke.add(me),v9(ke),ke})},[]),Ve=f.useCallback(me=>P.has(me),[P]),ct=f.useCallback((me,ve)=>{Y(ke=>{const _e=Ay(me,ve),qe=new Set(ke);return qe.has(_e)?qe.delete(_e):qe.add(_e),k9(qe),qe})},[]),At=f.useCallback((me,ve)=>le.has(Ay(me,ve)),[le]),Ze=f.useCallback(me=>I5(me,_),[_]),Rt=f.useMemo(()=>e.map(me=>{const ve=W[me.name];return ve===void 0?me:{...me,sessionMeta:{...me.sessionMeta,hasMore:ve}}}),[W,e]),xt=f.useMemo(()=>A9(Rt,N,P,_),[_,N,Rt,P]),$n=f.useMemo(()=>_9(xt,J),[J,xt]),Un=f.useCallback(me=>{y(me.name),E(me.displayName)},[]),Ht=f.useCallback(()=>{y(null),E("")},[]),un=f.useCallback(async me=>{try{(await Qe.renameProject(me,S)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(ve){console.error("Error renaming project:",ve)}finally{y(null),E("")}},[S]),je=f.useCallback((me,ve,ke,_e="claude")=>{Ae({projectName:me,sessionId:ve,sessionTitle:ke,provider:_e})},[]),nt=f.useCallback(async()=>{if(!Te)return;const{projectName:me,sessionId:ve,provider:ke}=Te;Ae(null);try{let _e;if(ke==="codex"?_e=await Qe.deleteCodexSession(ve):ke==="gemini"?_e=await Qe.deleteGeminiSession(ve):ke==="qwen"?_e=await Qe.deleteQwenSession(ve):_e=await Qe.deleteSession(me,ve),_e.ok)d?.(ve);else{const qe=await _e.text();console.error("[Sidebar] Failed to delete session:",{status:_e.status,error:qe}),alert(i("messages.deleteSessionFailed"))}}catch(_e){console.error("[Sidebar] Error deleting session:",_e),alert(i("messages.deleteSessionError"))}},[d,Te,i]),Je=f.useCallback(me=>{he({project:me,sessionCount:Ze(me).length})},[Ze]),pt=f.useCallback(async(me=!1)=>{if(!se)return;const{project:ve,sessionCount:ke}=se,_e=ke===0;he(null),ue(qe=>new Set([...qe,ve.name]));try{const qe=await Qe.deleteProject(ve.name,!_e,me);if(qe.ok)u?.(ve.name);else{const dt=await qe.json();alert(dt.error||i("messages.deleteProjectFailed"))}}catch(qe){console.error("Error deleting project:",qe),alert(i("messages.deleteProjectError"))}finally{ue(qe=>{const dt=new Set(qe);return dt.delete(ve.name),dt})}},[se,u,i]),yt=f.useCallback(async me=>{const ve=W[me.name];if(!(!(ve!==void 0?ve:me.sessionMeta?.hasMore===!0)||k[me.name])){T(_e=>({..._e,[me.name]:!0}));try{const _e=(me.sessions?.length||0)+(_[me.name]?.length||0),qe=await Qe.sessions(me.name,5,_e);if(!qe.ok)return;const dt=await qe.json();C(Xe=>({...Xe,[me.name]:[...Xe[me.name]||[],...dt.sessions||[]]})),dt.hasMore===!1&&H(Xe=>({...Xe,[me.name]:!1}))}catch(_e){console.error("Error loading more sessions:",_e)}finally{T(_e=>({..._e,[me.name]:!1}))}}},[_,k,W]),_t=f.useCallback(me=>{l(me),p(me)},[l,p]),ir=f.useCallback(async()=>{B(!0);try{await o()}finally{B(!1)}},[o]),sr=f.useCallback(async(me,ve,ke,_e)=>{const qe=ke.trim();if(!qe){G(null),M("");return}try{const dt=await Qe.renameSession(ve,qe,_e);dt.ok?await o():(console.error("[Sidebar] Failed to rename session:",dt.status),alert(i("messages.renameSessionFailed")))}catch(dt){console.error("[Sidebar] Error renaming session:",dt),alert(i("messages.renameSessionError"))}finally{G(null),M("")}},[o,i]),or=f.useCallback(()=>{h(!1)},[h]),ft=f.useCallback(()=>{h(!0)},[h]);return{isSidebarCollapsed:Le,expandedProjects:g,editingProject:x,showNewProject:v,editingName:S,loadingSessions:k,additionalSessions:_,initialSessionsLoaded:I,currentTime:A,projectSortOrder:N,isRefreshing:K,editingSession:L,editingSessionName:U,searchFilter:J,deletingProjects:de,deleteConfirmation:se,sessionDeleteConfirmation:Te,showVersionModal:De,starredProjects:P,starredSessions:le,filteredProjects:$n,toggleProject:Be,handleSessionClick:ot,toggleStarProject:ht,isProjectStarred:Ve,toggleStarSession:ct,isSessionStarred:At,getProjectSessions:Ze,startEditing:Un,cancelEditing:Ht,saveProjectName:un,showDeleteSessionConfirmation:je,confirmDeleteSession:nt,requestProjectDelete:Je,confirmDeleteProject:pt,loadMoreSessions:yt,handleProjectSelect:_t,refreshProjects:ir,updateSessionSummary:sr,collapseSidebar:or,expandSidebar:ft,setShowNewProject:w,setEditingName:E,setEditingSession:G,setEditingSessionName:M,searchMode:q,setSearchMode:re,conversationResults:be,isSearching:ae,searchProgress:ee,clearConversationResults:f.useCallback(()=>{oe.current+=1,xe.current&&(xe.current.close(),xe.current=null),ye(!1),ne(null),fe(null)},[]),setSearchFilter:te,setDeleteConfirmation:he,setSessionDeleteConfirmation:Ae,setShowVersionModal:Ue}}const D9="https://discord.gg/buxwujPNRE",O9="https://github.com/alicomert/pixcode/issues/new";function L9({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function M9({onExpand:e,onShowSettings:t,updateAvailable:n,onShowVersionModal:r,t:a}){return s.jsxs("div",{className:"flex h-full w-12 flex-col items-center gap-1 bg-background/80 py-3 backdrop-blur-sm",children:[s.jsx("button",{onClick:e,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.showSidebar"),title:a("common:versionUpdate.ariaLabels.showSidebar"),children:s.jsx(tj,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("div",{className:"nav-divider my-1 w-6"}),s.jsx("button",{onClick:t,className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.settings"),title:a("actions.settings"),children:s.jsx(kt,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:O9,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.reportIssue"),title:a("actions.reportIssue"),children:s.jsx(Dp,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),s.jsx("a",{href:D9,target:"_blank",rel:"noopener noreferrer",className:"group flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("actions.joinCommunity"),title:a("actions.joinCommunity"),children:s.jsx(L9,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})}),n&&s.jsxs("button",{onClick:r,className:"relative flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:bg-accent/80","aria-label":a("common:versionUpdate.ariaLabels.updateAvailable"),title:a("common:versionUpdate.ariaLabels.updateAvailable"),children:[s.jsx(sa,{className:"h-4 w-4 text-blue-500"}),s.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]})]})}function j5(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=j5(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function R5(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=j5(e))&&(r&&(r+=" "),r+=t);return r}const Iy=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,jy=R5,f0=(e,t)=>n=>{var r;if(t?.variants==null)return jy(e,n?.class,n?.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(d=>{const u=n?.[d],p=i?.[d];if(u===null)return null;const h=Iy(u)||Iy(p);return a[d][h]}),l=n&&Object.entries(n).reduce((d,u)=>{let[p,h]=u;return h===void 0||(d[p]=h),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,u)=>{let{class:p,className:h,...m}=u;return Object.entries(m).every(g=>{let[b,x]=g;return Array.isArray(x)?x.includes({...i,...l}[b]):{...i,...l}[b]===x})?[...d,p,h]:d},[]);return jy(e,o,c,n?.class,n?.className)},g0="-",P9=e=>{const t=z9(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(g0);return l[0]===""&&l.length!==1&&l.shift(),D5(l,t)||F9(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},D5=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),a=r?D5(e.slice(1),r):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(g0);return t.validators.find(({validator:o})=>o(i))?.classGroupId},Ry=/^\[(.+)\]$/,F9=e=>{if(Ry.test(e)){const t=Ry.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},z9=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const a in n)zp(n[a],r,a,t);return r},zp=(e,t,n,r)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:Dy(t,a);i.classGroupId=n;return}if(typeof a=="function"){if(B9(a)){zp(a(r),t,n,r);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([i,o])=>{zp(o,Dy(t,i),n,r)})})},Dy=(e,t)=>{let n=e;return t.split(g0).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},B9=e=>e.isThemeGetter,$9=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const a=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return a(i,o),o},set(i,o){n.has(i)?n.set(i,o):a(i,o)}}},Bp="!",$p=":",U9=$p.length,G9=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=a=>{const i=[];let o=0,l=0,c=0,d;for(let g=0;g<a.length;g++){let b=a[g];if(o===0&&l===0){if(b===$p){i.push(a.slice(c,g)),c=g+U9;continue}if(b==="/"){d=g;continue}}b==="["?o++:b==="]"?o--:b==="("?l++:b===")"&&l--}const u=i.length===0?a:a.substring(c),p=H9(u),h=p!==u,m=d&&d>c?d-c:void 0;return{modifiers:i,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:m}};if(t){const a=t+$p,i=r;r=o=>o.startsWith(a)?i(o.substring(a.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(n){const a=r;r=i=>n({className:i,parseClassName:a})}return r},H9=e=>e.endsWith(Bp)?e.substring(0,e.length-1):e.startsWith(Bp)?e.substring(1):e,q9=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const a=[];let i=[];return r.forEach(o=>{o[0]==="["||t[o]?(a.push(...i.sort(),o),i=[]):i.push(o)}),a.push(...i.sort()),a}},V9=e=>({cache:$9(e.cacheSize),parseClassName:G9(e),sortModifiers:q9(e),...P9(e)}),W9=/\s+/,K9=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a,sortModifiers:i}=t,o=[],l=e.trim().split(W9);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:h,hasImportantModifier:m,baseClassName:g,maybePostfixModifierPosition:b}=n(u);if(p){c=u+(c.length>0?" "+c:c);continue}let x=!!b,y=r(x?g.substring(0,b):g);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=r(g),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const v=i(h).join(":"),w=m?v+Bp:v,S=w+y;if(o.includes(S))continue;o.push(S);const E=a(y,x);for(let k=0;k<E.length;++k){const T=E[k];o.push(w+T)}c=u+(c.length>0?" "+c:c)}return c};function Y9(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=O5(t))&&(r&&(r+=" "),r+=n);return r}const O5=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=O5(e[r]))&&(n&&(n+=" "),n+=t);return n};function Z9(e,...t){let n,r,a,i=o;function o(c){const d=t.reduce((u,p)=>p(u),e());return n=V9(d),r=n.cache.get,a=n.cache.set,i=l,l(c)}function l(c){const d=r(c);if(d)return d;const u=K9(c,n);return a(c,u),u}return function(){return i(Y9.apply(null,arguments))}}const Qt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},L5=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,M5=/^\((?:(\w[\w-]*):)?(.+)\)$/i,X9=/^\d+\/\d+$/,J9=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Q9=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,eD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,nD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$i=e=>X9.test(e),rt=e=>!!e&&!Number.isNaN(Number(e)),va=e=>!!e&&Number.isInteger(Number(e)),Ud=e=>e.endsWith("%")&&rt(e.slice(0,-1)),Yr=e=>J9.test(e),rD=()=>!0,aD=e=>Q9.test(e)&&!eD.test(e),P5=()=>!1,iD=e=>tD.test(e),sD=e=>nD.test(e),oD=e=>!Fe(e)&&!ze(e),lD=e=>_s(e,B5,P5),Fe=e=>L5.test(e),Ja=e=>_s(e,$5,aD),Gd=e=>_s(e,mD,rt),Oy=e=>_s(e,F5,P5),cD=e=>_s(e,z5,sD),xl=e=>_s(e,U5,iD),ze=e=>M5.test(e),Zs=e=>Is(e,$5),dD=e=>Is(e,hD),Ly=e=>Is(e,F5),uD=e=>Is(e,B5),pD=e=>Is(e,z5),yl=e=>Is(e,U5,!0),_s=(e,t,n)=>{const r=L5.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Is=(e,t,n=!1)=>{const r=M5.exec(e);return r?r[1]?t(r[1]):n:!1},F5=e=>e==="position"||e==="percentage",z5=e=>e==="image"||e==="url",B5=e=>e==="length"||e==="size"||e==="bg-size",$5=e=>e==="length",mD=e=>e==="number",hD=e=>e==="family-name",U5=e=>e==="shadow",fD=()=>{const e=Qt("color"),t=Qt("font"),n=Qt("text"),r=Qt("font-weight"),a=Qt("tracking"),i=Qt("leading"),o=Qt("breakpoint"),l=Qt("container"),c=Qt("spacing"),d=Qt("radius"),u=Qt("shadow"),p=Qt("inset-shadow"),h=Qt("text-shadow"),m=Qt("drop-shadow"),g=Qt("blur"),b=Qt("perspective"),x=Qt("aspect"),y=Qt("ease"),v=Qt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...S(),ze,Fe],k=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],_=()=>[ze,Fe,c],C=()=>[$i,"full","auto",..._()],I=()=>[va,"none","subgrid",ze,Fe],O=()=>["auto",{span:["full",va,ze,Fe]},va,ze,Fe],A=()=>[va,"auto",ze,Fe],R=()=>["auto","min","max","fr",ze,Fe],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",..._()],B=()=>[$i,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],W=()=>[e,ze,Fe],H=()=>[...S(),Ly,Oy,{position:[ze,Fe]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],G=()=>["auto","cover","contain",uD,lD,{size:[ze,Fe]}],U=()=>[Ud,Zs,Ja],M=()=>["","none","full",d,ze,Fe],J=()=>["",rt,Zs,Ja],te=()=>["solid","dashed","dotted","double"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>[rt,Ud,Ly,Oy],se=()=>["","none",g,ze,Fe],he=()=>["none",rt,ze,Fe],Te=()=>["none",rt,ze,Fe],Ae=()=>[rt,ze,Fe],De=()=>[$i,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Yr],breakpoint:[Yr],color:[rD],container:[Yr],"drop-shadow":[Yr],ease:["in","out","in-out"],font:[oD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Yr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Yr],shadow:[Yr],spacing:["px",rt],text:[Yr],"text-shadow":[Yr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$i,Fe,ze,x]}],container:["container"],columns:[{columns:[rt,Fe,ze,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:C()}],"inset-x":[{"inset-x":C()}],"inset-y":[{"inset-y":C()}],start:[{start:C()}],end:[{end:C()}],top:[{top:C()}],right:[{right:C()}],bottom:[{bottom:C()}],left:[{left:C()}],visibility:["visible","invisible","collapse"],z:[{z:[va,"auto",ze,Fe]}],basis:[{basis:[$i,"full","auto",l,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[rt,$i,"auto","initial","none",Fe]}],grow:[{grow:["",rt,ze,Fe]}],shrink:[{shrink:["",rt,ze,Fe]}],order:[{order:[va,"first","last","none",ze,Fe]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],w:[{w:[l,"screen",...B()]}],"min-w":[{"min-w":[l,"screen","none",...B()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",n,Zs,Ja]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ze,Gd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ud,Fe]}],"font-family":[{font:[dD,Fe,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,ze,Fe]}],"line-clamp":[{"line-clamp":[rt,"none",ze,Gd]}],leading:[{leading:[i,..._()]}],"list-image":[{"list-image":["none",ze,Fe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ze,Fe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[rt,"from-font","auto",ze,Ja]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[rt,"auto",ze,Fe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ze,Fe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ze,Fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:G()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},va,ze,Fe],radial:["",ze,Fe],conic:[va,ze,Fe]},pD,cD]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:M()}],"rounded-s":[{"rounded-s":M()}],"rounded-e":[{"rounded-e":M()}],"rounded-t":[{"rounded-t":M()}],"rounded-r":[{"rounded-r":M()}],"rounded-b":[{"rounded-b":M()}],"rounded-l":[{"rounded-l":M()}],"rounded-ss":[{"rounded-ss":M()}],"rounded-se":[{"rounded-se":M()}],"rounded-ee":[{"rounded-ee":M()}],"rounded-es":[{"rounded-es":M()}],"rounded-tl":[{"rounded-tl":M()}],"rounded-tr":[{"rounded-tr":M()}],"rounded-br":[{"rounded-br":M()}],"rounded-bl":[{"rounded-bl":M()}],"border-w":[{border:J()}],"border-w-x":[{"border-x":J()}],"border-w-y":[{"border-y":J()}],"border-w-s":[{"border-s":J()}],"border-w-e":[{"border-e":J()}],"border-w-t":[{"border-t":J()}],"border-w-r":[{"border-r":J()}],"border-w-b":[{"border-b":J()}],"border-w-l":[{"border-l":J()}],"divide-x":[{"divide-x":J()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":J()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[rt,ze,Fe]}],"outline-w":[{outline:["",rt,Zs,Ja]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",u,yl,xl]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",p,yl,xl]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:J()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[rt,Ja]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":J()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",h,yl,xl]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[rt,ze,Fe]}],"mix-blend":[{"mix-blend":[...de(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":de()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[rt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[ze,Fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[rt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:G()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ze,Fe]}],filter:[{filter:["","none",ze,Fe]}],blur:[{blur:se()}],brightness:[{brightness:[rt,ze,Fe]}],contrast:[{contrast:[rt,ze,Fe]}],"drop-shadow":[{"drop-shadow":["","none",m,yl,xl]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",rt,ze,Fe]}],"hue-rotate":[{"hue-rotate":[rt,ze,Fe]}],invert:[{invert:["",rt,ze,Fe]}],saturate:[{saturate:[rt,ze,Fe]}],sepia:[{sepia:["",rt,ze,Fe]}],"backdrop-filter":[{"backdrop-filter":["","none",ze,Fe]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[rt,ze,Fe]}],"backdrop-contrast":[{"backdrop-contrast":[rt,ze,Fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",rt,ze,Fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[rt,ze,Fe]}],"backdrop-invert":[{"backdrop-invert":["",rt,ze,Fe]}],"backdrop-opacity":[{"backdrop-opacity":[rt,ze,Fe]}],"backdrop-saturate":[{"backdrop-saturate":[rt,ze,Fe]}],"backdrop-sepia":[{"backdrop-sepia":["",rt,ze,Fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ze,Fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[rt,"initial",ze,Fe]}],ease:[{ease:["linear","initial",y,ze,Fe]}],delay:[{delay:[rt,ze,Fe]}],animate:[{animate:["none",v,ze,Fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,ze,Fe]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:Te()}],"scale-x":[{"scale-x":Te()}],"scale-y":[{"scale-y":Te()}],"scale-z":[{"scale-z":Te()}],"scale-3d":["scale-3d"],skew:[{skew:Ae()}],"skew-x":[{"skew-x":Ae()}],"skew-y":[{"skew-y":Ae()}],transform:[{transform:[ze,Fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:De()}],"translate-x":[{"translate-x":De()}],"translate-y":[{"translate-y":De()}],"translate-z":[{"translate-z":De()}],"translate-none":["translate-none"],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ze,Fe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ze,Fe]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[rt,Zs,Ja,Gd]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},gD=Z9(fD);function ge(...e){return gD(R5(e))}function bD(e){if(!e||typeof e!="string")return null;try{return JSON.parse(e)}catch{return null}}const xD=f0("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}}),G5=f.forwardRef(({className:e,variant:t,...n},r)=>s.jsx("div",{ref:r,role:"alert","data-slot":"alert",className:ge(xD({variant:t}),e),...n}));G5.displayName="Alert";const yD=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"alert-title",className:ge("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t}));yD.displayName="AlertTitle";const vD=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"alert-description",className:ge("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t}));vD.displayName="AlertDescription";const wD=f0("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function os({className:e,variant:t,...n}){return s.jsx("div",{className:ge(wD({variant:t}),e),...n})}const kD=f0("inline-flex touch-manipulation items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 active:bg-primary/80",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground active:bg-accent/80",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 active:bg-secondary/70",ghost:"hover:bg-accent hover:text-accent-foreground active:bg-accent/80",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3 text-sm",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Pe=f.forwardRef(({className:e,variant:t,size:n,...r},a)=>s.jsx("button",{className:ge(kD({variant:t,size:n,className:e})),ref:a,...r}));Pe.displayName="Button";const H5=f.createContext(null),q5=()=>{const e=f.useContext(H5);if(!e)throw new Error("Confirmation components must be used within Confirmation");return e},V5=({className:e,approval:t="pending",children:n,...r})=>{const a=f.useMemo(()=>({approval:t}),[t]);return s.jsx(H5.Provider,{value:a,children:s.jsx(G5,{className:ge("flex flex-col gap-2",e),...r,children:n})})};V5.displayName="Confirmation";const W5=({className:e,...t})=>s.jsx("div",{"data-slot":"confirmation-title",className:ge("text-muted-foreground inline text-sm",e),...t});W5.displayName="ConfirmationTitle";const K5=({children:e})=>{const{approval:t}=q5();return t!=="pending"?null:s.jsx(s.Fragment,{children:e})};K5.displayName="ConfirmationRequest";const Y5=({className:e,...t})=>{const{approval:n}=q5();return n!=="pending"?null:s.jsx("div",{"data-slot":"confirmation-actions",className:ge("flex items-center justify-end gap-2 self-end",e),...t})};Y5.displayName="ConfirmationActions";const Xl=({variant:e="default",...t})=>s.jsx(Pe,{className:"h-8 px-3 text-sm",variant:e,type:"button",...t});Xl.displayName="ConfirmationAction";const Z5=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ge("rounded-xl border bg-card text-card-foreground shadow-sm",e),...t}));Z5.displayName="Card";const X5=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ge("flex flex-col space-y-1.5 p-4",e),...t}));X5.displayName="CardHeader";const J5=f.forwardRef(({className:e,...t},n)=>s.jsx("h3",{ref:n,className:ge("font-semibold leading-none tracking-tight",e),...t}));J5.displayName="CardTitle";const SD=f.forwardRef(({className:e,...t},n)=>s.jsx("p",{ref:n,className:ge("text-sm text-muted-foreground",e),...t}));SD.displayName="CardDescription";const Q5=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ge("p-4 pt-0",e),...t}));Q5.displayName="CardContent";const e4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ge("flex items-center p-4 pt-0",e),...t}));e4.displayName="CardFooter";const ED=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ge("ml-auto shrink-0",e),...t}));ED.displayName="CardAction";const t4=f.createContext(null);function n4(){const e=f.useContext(t4);if(!e)throw new Error("Collapsible components must be used within <Collapsible>");return e}const ki=f.forwardRef(({defaultOpen:e=!1,open:t,onOpenChange:n,className:r,children:a,...i},o)=>{const[l,c]=f.useState(e),d=t!==void 0,u=d?t:l,p=f.useCallback(m=>{d||c(m),n?.(m)},[d,n]),h=f.useMemo(()=>({open:u,onOpenChange:p}),[u,p]);return s.jsx(t4.Provider,{value:h,children:s.jsx("div",{ref:o,"data-state":u?"open":"closed",className:r,...i,children:a})})});ki.displayName="Collapsible";const Pa=f.forwardRef(({onClick:e,children:t,className:n,...r},a)=>{const{open:i,onOpenChange:o}=n4(),l=f.useCallback(c=>{o(!i),e?.(c)},[i,o,e]);return s.jsx("button",{ref:a,type:"button","aria-expanded":i,"data-state":i?"open":"closed",onClick:l,className:n,...r,children:t})});Pa.displayName="CollapsibleTrigger";const Si=f.forwardRef(({className:e,children:t,...n},r)=>{const{open:a}=n4();return s.jsx("div",{ref:r,"data-state":a?"open":"closed",className:ge("grid transition-[grid-template-rows] duration-200 ease-out",a?"grid-rows-[1fr]":"grid-rows-[0fr]",e),...n,children:s.jsx("div",{className:"overflow-hidden",children:t})})});Si.displayName="CollapsibleContent";const r4=f.createContext(null);function b0(){const e=f.useContext(r4);if(!e)throw new Error("Command components must be used within <Command>");return e}const a4=f.forwardRef(({className:e,children:t,...n},r)=>{const[a,i]=f.useState(""),o=f.useRef(new Map),[l,c]=f.useState(0),d=f.useCallback(v=>{o.current.set(v.id,v),c(w=>w+1)},[]),u=f.useCallback(v=>{o.current.delete(v),c(w=>w+1)},[]),p=f.useCallback((v,w)=>{const S=o.current.get(v);S&&Object.assign(S,w)},[]),h=f.useMemo(()=>{const v=a.toLowerCase(),w=new Set;for(const[S,E]of o.current)(!v||E.value.includes(v))&&w.add(S);return w},[a,l]),m=f.useMemo(()=>{const v=[];for(const[,w]of o.current)h.has(w.id)&&v.push(w);return v},[h]),[g,b]=f.useState(null);f.useEffect(()=>{b(m.length>0?m[0].id:null)},[m]);const x=f.useCallback(v=>{if(v.key==="ArrowDown"||v.key==="ArrowUp"||v.key==="Enter")v.preventDefault();else return;const w=m;if(w.length===0)return;if(v.key==="Enter"){w.find(C=>C.id===g)?.onSelect();return}const S=w.findIndex(_=>_.id===g);let E;v.key==="ArrowDown"?E=S<w.length-1?S+1:0:E=S>0?S-1:w.length-1;const k=w[E].id;b(k),w[E].element?.scrollIntoView({block:"nearest"})},[m,g]),y=f.useMemo(()=>({search:a,setSearch:i,visibleIds:h,activeId:g,setActiveId:b,register:d,unregister:u,updateEntry:p}),[a,h,g,d,u,p]);return s.jsx(r4.Provider,{value:y,children:s.jsx("div",{ref:r,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox",className:ge("flex flex-col",e),onKeyDown:x,...n,children:t})})});a4.displayName="Command";const i4=f.forwardRef(({className:e,placeholder:t="Search...",...n},r)=>{const{search:a,setSearch:i}=b0();return s.jsxs("div",{className:"flex items-center border-b px-3",role:"presentation",children:[s.jsx(ia,{className:"mr-2 h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsx("input",{ref:r,type:"text",role:"searchbox","aria-autocomplete":"list",autoComplete:"off",autoCorrect:"off",spellCheck:!1,value:a,onChange:o=>i(o.target.value),placeholder:t,className:ge("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none","placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n})]})});i4.displayName="CommandInput";const s4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,role:"listbox",className:ge("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));s4.displayName="CommandList";const o4=f.forwardRef(({className:e,...t},n)=>{const{search:r,visibleIds:a}=b0();return!r||a.size>0?null:s.jsx("div",{ref:n,className:ge("py-6 text-center text-sm text-muted-foreground",e),...t})});o4.displayName="CommandEmpty";const l4=f.forwardRef(({className:e,heading:t,children:n,...r},a)=>s.jsxs("div",{ref:a,className:ge("overflow-hidden p-1",e),role:"group","aria-label":typeof t=="string"?t:void 0,...r,children:[t&&s.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",role:"presentation",children:t}),n]}));l4.displayName="CommandGroup";const c4=f.forwardRef(({className:e,value:t,onSelect:n,disabled:r,children:a,...i},o)=>{const{visibleIds:l,activeId:c,setActiveId:d,register:u,unregister:p,updateEntry:h}=b0(),m=f.useId(),g=f.useRef(null),b=t||(typeof a=="string"?a:"");f.useEffect(()=>(u({id:m,value:b.toLowerCase(),onSelect:n||(()=>{}),element:g.current}),()=>p(m)),[m,b,u,p]),f.useEffect(()=>{h(m,{onSelect:n||(()=>{})})},[m,n,h]);const x=f.useCallback(v=>{g.current=v,h(m,{element:v}),typeof o=="function"?o(v):o&&(o.current=v)},[m,h,o]);if(!l.has(m))return null;const y=c===m;return s.jsx("div",{ref:x,role:"option","aria-selected":y,"aria-disabled":r||void 0,"data-active":y||void 0,className:ge("relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",y&&"bg-accent text-accent-foreground",r&&"pointer-events-none opacity-50",e),onPointerMove:()=>{!r&&c!==m&&d(m)},onClick:()=>!r&&n?.(),...i,children:a})});c4.displayName="CommandItem";const ND=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:ge("-mx-1 h-px bg-border",e),...t}));ND.displayName="CommandSeparator";function Up({checked:e,onToggle:t,ariaLabel:n="Toggle dark mode"}){const{isDarkMode:r,toggleDarkMode:a}=qa(),i=typeof e=="boolean"&&typeof t=="function",o=i?e:r,l=()=>{if(i&&t){t(!o);return}a()};return s.jsxs("button",{onClick:l,className:ge("relative inline-flex h-7 w-12 flex-shrink-0 touch-manipulation cursor-pointer items-center rounded-full border-2 transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",o?"border-primary bg-primary":"border-border bg-muted"),role:"switch","aria-checked":o,"aria-label":n,children:[s.jsx("span",{className:"sr-only",children:n}),s.jsx("span",{className:ge("flex h-5 w-5 transform items-center justify-center rounded-full shadow-sm transition-transform duration-200",o?"translate-x-[22px] bg-white":"translate-x-[2px] bg-foreground/60 dark:bg-foreground/80"),children:o?s.jsx(l0,{className:"h-3 w-3 text-primary"}):s.jsx(c0,{className:"h-3 w-3 text-white dark:text-background"})})]})}const d4=f.createContext(null);function u4(){const e=f.useContext(d4);if(!e)throw new Error("Dialog components must be used within <Dialog>");return e}const p4=({open:e,onOpenChange:t,defaultOpen:n=!1,children:r})=>{const[a,i]=f.useState(n),o=f.useRef(null),l=e!==void 0,c=l?e:a,d=f.useCallback(p=>{l||i(p),t?.(p)},[l,t]),u=f.useMemo(()=>({open:c,onOpenChange:d,triggerRef:o}),[c,d]);return s.jsx(d4.Provider,{value:u,children:r})},CD=f.forwardRef(({onClick:e,children:t,asChild:n,...r},a)=>{const{onOpenChange:i,triggerRef:o}=u4(),l=f.useCallback(c=>{i(!0),e?.(c)},[i,e]);if(n&&f.isValidElement(t)){const c=t;return f.cloneElement(c,{onClick:d=>{i(!0),c.props.onClick?.(d)},ref:d=>{o.current=d,typeof a=="function"?a(d):a&&(a.current=d)}})}return s.jsx("button",{ref:c=>{o.current=c,typeof a=="function"?a(c):a&&(a.current=c)},type:"button",onClick:l,...r,children:t})});CD.displayName="DialogTrigger";const My='a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',x0=f.forwardRef(({className:e,children:t,onEscapeKeyDown:n,onPointerDownOutside:r,...a},i)=>{const{open:o,onOpenChange:l,triggerRef:c}=u4(),d=f.useRef(null),u=f.useRef(null);return f.useEffect(()=>{o?u.current=document.activeElement:u.current&&((c.current||u.current)?.focus(),u.current=null)},[o,c]),f.useEffect(()=>{if(!o)return;const p=m=>{if(m.key==="Escape"){m.stopPropagation(),n?.(),l(!1);return}if(m.key==="Tab"&&d.current){const g=Array.from(d.current.querySelectorAll(My));if(g.length===0)return;const b=g[0],x=g[g.length-1];m.shiftKey&&document.activeElement===b?(m.preventDefault(),x.focus()):!m.shiftKey&&document.activeElement===x&&(m.preventDefault(),b.focus())}};document.addEventListener("keydown",p,!0);const h=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",p,!0),document.body.style.overflow=h}},[o,l,n]),f.useEffect(()=>{o&&d.current&&requestAnimationFrame(()=>{d.current?.querySelector(My)?.focus()})},[o]),o?Yc.createPortal(s.jsxs("div",{className:"fixed inset-0 z-50",children:[s.jsx("div",{className:"fixed inset-0 animate-dialog-overlay-show bg-black/50 backdrop-blur-sm",onClick:()=>{r?.(),l(!1)},"aria-hidden":!0}),s.jsx("div",{ref:p=>{d.current=p,typeof i=="function"?i(p):i&&(i.current=p)},role:"dialog","aria-modal":"true",className:ge("fixed left-1/2 top-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2","rounded-xl border bg-popover text-popover-foreground shadow-lg","animate-dialog-content-show",e),...a,children:t})]}),document.body):null});x0.displayName="DialogContent";const y0=f.forwardRef(({className:e,...t},n)=>s.jsx("h2",{ref:n,className:ge("sr-only",e),...t}));y0.displayName="DialogTitle";const Nt=f.forwardRef(({className:e,type:t,...n},r)=>s.jsx("input",{type:t,className:ge("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));Nt.displayName="Input";const v0=f.forwardRef(({className:e,contentClassName:t,children:n,...r},a)=>s.jsx("div",{className:ge("relative overflow-hidden",e),...r,children:s.jsx("div",{ref:a,className:ge("h-full w-full overflow-auto rounded-[inherit]",t),style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:n})}));v0.displayName="ScrollArea";const vc=f.memo(({children:e,className:t,as:n="span"})=>s.jsx(n,{className:ge("animate-shimmer inline-block bg-[length:250%_100%] bg-clip-text text-transparent","bg-[linear-gradient(90deg,transparent_33%,hsl(var(--foreground))_50%,transparent_67%),linear-gradient(hsl(var(--muted-foreground)),hsl(var(--muted-foreground)))]",t),children:e}));vc.displayName="Shimmer";const m4=f.createContext(null),TD=()=>{const e=f.useContext(m4);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},AD=1e3,_D=1e3,Gp=f.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:r,onOpenChange:a,duration:i,children:o,...l})=>{const c=r??t,d=r===!1,[u,p]=f.useState(c),h=n!==void 0,m=h?n:u,g=f.useCallback(k=>{h||p(k),a?.(k)},[h,a]),[b,x]=f.useState(i),y=f.useRef(t),[v,w]=f.useState(!1),S=f.useRef(null);f.useEffect(()=>{i!==void 0&&x(i)},[i]),f.useEffect(()=>{t?(y.current=!0,S.current===null&&(S.current=Date.now())):S.current!==null&&(x(Math.ceil((Date.now()-S.current)/_D)),S.current=null)},[t]),f.useEffect(()=>{t&&!m&&!d&&g(!0)},[t,m,g,d]),f.useEffect(()=>{if(y.current&&!t&&m&&!v){const k=setTimeout(()=>{g(!1),w(!0)},AD);return()=>clearTimeout(k)}},[t,m,g,v]);const E=f.useMemo(()=>({duration:b,isOpen:m,isStreaming:t,setIsOpen:g}),[b,m,t,g]);return s.jsx(m4.Provider,{value:E,children:s.jsx(ki,{open:m,onOpenChange:g,className:ge("not-prose",e),...l,children:o})})});Gp.displayName="Reasoning";const ID=(e,t)=>e||t===0?s.jsx(vc,{children:"Thinking..."}):t===void 0?s.jsx("p",{children:"Thought for a few seconds"}):s.jsxs("p",{children:["Thought for ",t," seconds"]}),Hp=f.memo(({className:e,children:t,getThinkingMessage:n=ID,...r})=>{const{isStreaming:a,isOpen:i,duration:o}=TD();return s.jsx(Pa,{className:ge("flex w-full items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",e),...r,children:t??s.jsxs(s.Fragment,{children:[s.jsx(Dj,{className:"h-4 w-4"}),n(a,o),s.jsx(qS,{className:ge("h-4 w-4 transition-transform",i?"rotate-180":"rotate-0")})]})})});Hp.displayName="ReasoningTrigger";const qp=f.memo(({className:e,children:t,...n})=>s.jsx(Si,{className:ge("mt-4 text-sm text-muted-foreground",e),...n,children:t}));qp.displayName="ReasoningContent";function jD(e){switch(e){case"top":return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100";case"bottom":return"bottom-full left-1/2 transform -translate-x-1/2 border-b-gray-900 dark:border-b-gray-100";case"left":return"left-full top-1/2 transform -translate-y-1/2 border-l-gray-900 dark:border-l-gray-100";case"right":return"right-full top-1/2 transform -translate-y-1/2 border-r-gray-900 dark:border-r-gray-100";default:return"top-full left-1/2 transform -translate-x-1/2 border-t-gray-900 dark:border-t-gray-100"}}function ta({children:e,content:t,position:n="top",className:r="",delay:a=350}){const[i,o]=f.useState(!1),l=f.useRef(null),c=f.useRef(!1),d=f.useRef(null),u=f.useRef(null),[p,h]=f.useState(null),m=f.useCallback(()=>{const w=d.current;if(!w)return;const S=w.getBoundingClientRect(),E=8,k={position:"fixed",zIndex:9999};switch(n){case"bottom":k.left=S.left+S.width/2,k.top=S.bottom+E,k.transform="translateX(-50%)";break;case"left":k.left=S.left-E,k.top=S.top+S.height/2,k.transform="translate(-100%, -50%)";break;case"right":k.left=S.right+E,k.top=S.top+S.height/2,k.transform="translateY(-50%)";break;case"top":default:k.left=S.left+S.width/2,k.top=S.top-E,k.transform="translate(-50%, -100%)";break}h(k)},[n]),g=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},b=()=>{g(),l.current=window.setTimeout(()=>{o(!0)},a)},x=()=>{g(),o(!1)},y=()=>{g(),c.current=!1,l.current=window.setTimeout(()=>{c.current=!0,o(!0)},a)},v=()=>{g(),!c.current&&o(!1)};return f.useEffect(()=>()=>{g()},[]),f.useEffect(()=>{if(!i||typeof document>"u")return;const w=S=>{const E=S.target;E instanceof Node&&d.current?.contains(E)||(o(!1),c.current=!1)};return document.addEventListener("pointerdown",w,!0),()=>document.removeEventListener("pointerdown",w,!0)},[i]),f.useEffect(()=>{if(!i){h(null);return}const w=window.requestAnimationFrame(m),S=()=>m();return window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{window.cancelAnimationFrame(w),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[i,m]),t?s.jsxs("div",{ref:d,className:"relative inline-block",onMouseEnter:b,onMouseLeave:x,onTouchStart:y,onTouchEnd:v,onTouchCancel:v,children:[e,i&&typeof document<"u"&&Yc.createPortal(s.jsxs("div",{ref:u,style:p||{position:"fixed",top:"-9999px",left:"-9999px",opacity:0},className:ge("px-2 py-1 text-xs font-medium text-white bg-gray-900 dark:bg-gray-100 dark:text-gray-900 rounded shadow-lg whitespace-nowrap pointer-events-none","animate-in fade-in-0 zoom-in-95 duration-200",r),children:[t,s.jsx("div",{className:ge("absolute w-0 h-0 border-4 border-transparent",jD(n))})]}),document.body)]}):s.jsx(s.Fragment,{children:e})}const h4=f.createContext(null),f4=f.forwardRef(({className:e,status:t="ready",children:n,...r},a)=>{const i=f.useMemo(()=>({status:t}),[t]);return s.jsx(h4.Provider,{value:i,children:s.jsx("form",{ref:a,"data-slot":"prompt-input",className:ge("relative overflow-hidden rounded-xl border border-border/50 bg-card/80 shadow-sm backdrop-blur-sm transition-all duration-200 focus-within:border-primary/30 focus-within:shadow-md focus-within:ring-1 focus-within:ring-primary/15",e),...r,children:n})})});f4.displayName="PromptInput";const g4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"prompt-input-header",className:ge("px-3 pt-3",e),...t}));g4.displayName="PromptInputHeader";const b4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"prompt-input-body",className:ge("relative",e),...t}));b4.displayName="PromptInputBody";const x4=f.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{ref:n,"data-slot":"prompt-input-textarea",className:ge("chat-input-placeholder block max-h-[40vh] w-full resize-none overflow-y-auto bg-transparent px-4 py-2 text-sm leading-6 text-foreground placeholder-muted-foreground/50 focus:outline-none sm:max-h-[300px]",e),...t}));x4.displayName="PromptInputTextarea";const y4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"prompt-input-footer",className:ge("flex items-center justify-between border-t border-border/30 px-3 py-2",e),...t}));y4.displayName="PromptInputFooter";const v4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"prompt-input-tools",className:ge("flex items-center gap-1",e),...t}));v4.displayName="PromptInputTools";const Jl=f.forwardRef(({className:e,tooltip:t,children:n,...r},a)=>{const i=s.jsx(Pe,{ref:a,type:"button",variant:"ghost",size:"icon",className:ge("h-8 w-8 [&_svg]:size-4",e),...r,children:n});return t?s.jsx(ta,{content:t.shortcut?s.jsxs("span",{className:"flex items-center gap-1.5",children:[t.content,s.jsx("kbd",{className:"rounded bg-white/20 px-1 text-[10px]",children:t.shortcut})]}):t.content,position:t.side??"top",children:i}):i});Jl.displayName="PromptInputButton";const w4=f.forwardRef(({className:e,status:t,children:n,...r},a)=>{const i=f.useContext(h4),o=t??i?.status??"ready",l=o==="submitted"||o==="streaming";return s.jsx(Pe,{ref:a,type:l?"button":"submit",variant:"default",size:"icon",className:ge("h-8 w-8 rounded-lg",e),...r,children:n??(l?s.jsx(vj,{className:"h-3.5 w-3.5 fill-current"}):s.jsx(nj,{className:"h-4 w-4"}))})});w4.displayName="PromptInputSubmit";function w0({children:e,className:t}){return s.jsx("div",{className:ge("inline-flex items-center gap-[2px] rounded-lg bg-muted/60 p-[3px]",t),children:e})}function k0({isActive:e,onClick:t,children:n,className:r}){return s.jsx("button",{onClick:t,className:ge("flex touch-manipulation items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition-all duration-150",e?"bg-background text-foreground shadow-sm":"text-muted-foreground active:bg-background/50",r),children:n})}const k4=f.createContext(null);function S4(){const e=f.useContext(k4);if(!e)throw new Error("QueueItem sub-components must be used within <QueueItem>");return e}const E4=f.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,"data-slot":"queue",role:"list",className:ge("space-y-0.5",e),...t}));E4.displayName="Queue";const N4=f.forwardRef(({status:e="pending",className:t,children:n,...r},a)=>{const i=f.useMemo(()=>({status:e}),[e]);return s.jsx(k4.Provider,{value:i,children:s.jsx("div",{ref:a,"data-slot":"queue-item","data-status":e,role:"listitem",className:ge("flex items-start gap-2 py-0.5",t),...r,children:n})})});N4.displayName="QueueItem";const C4=f.forwardRef(({className:e,...t},n)=>{const{status:r}=S4();return s.jsxs("div",{ref:n,"data-slot":"queue-item-indicator","aria-hidden":"true",className:ge("mt-0.5 flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center",e),...t,children:[r==="completed"&&s.jsx("svg",{className:"h-3.5 w-3.5 text-green-500 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),r==="in_progress"&&s.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500 dark:bg-blue-400"}),r==="pending"&&s.jsx("svg",{className:"h-3.5 w-3.5 text-muted-foreground/50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2})})]})});C4.displayName="QueueItemIndicator";const T4=f.forwardRef(({className:e,children:t,...n},r)=>{const{status:a}=S4();return s.jsx("div",{ref:r,"data-slot":"queue-item-content",className:ge("min-w-0 flex-1 text-xs",a==="completed"&&"text-muted-foreground line-through",a==="in_progress"&&"font-medium text-foreground",a==="pending"&&"text-foreground",e),...n,children:t})});T4.displayName="QueueItemContent";const Py="https://github.com/alicomert/pixcode/issues/new",RD="https://github.com/alicomert/pixcode",Fy="https://discord.gg/buxwujPNRE";function zy({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function DD({updateAvailable:e,releaseInfo:t,latestVersion:n,currentVersion:r,onShowVersionModal:a,onShowSettings:i,t:o}){return s.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[e&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.jsxs("button",{className:"group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-blue-50/80 dark:hover:bg-blue-900/15",onClick:a,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(py,{className:"h-4 w-4 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${n}`}),s.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})}),s.jsx("div",{className:"px-3 py-2 md:hidden",children:s.jsxs("button",{className:"flex h-11 w-full items-center gap-3 rounded-xl border border-blue-200/60 bg-blue-50/80 px-3.5 transition-all active:scale-[0.98] dark:border-blue-700/40 dark:bg-blue-900/15",onClick:a,children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx(py,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),s.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-1.5 w-1.5 animate-pulse rounded-full bg-blue-500"})]}),s.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[s.jsx("span",{className:"block truncate text-sm font-medium text-blue-600 dark:text-blue-300",children:t?.title||`v${n}`}),s.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})})]}),s.jsx("div",{className:"nav-divider"}),s.jsx("div",{className:"hidden px-2 pt-1.5 md:block",children:s.jsxs("a",{href:Py,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[s.jsx(Dp,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"hidden px-2 md:block",children:s.jsxs("a",{href:Fy,target:"_blank",rel:"noopener noreferrer",className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[s.jsx(zy,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"hidden px-2 py-1.5 md:block",children:s.jsxs("button",{className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",onClick:i,children:[s.jsx(kt,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-sm",children:o("actions.settings")})]})}),s.jsx("div",{className:"hidden px-3 py-2 text-center md:block",children:s.jsxs("a",{href:RD,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-muted-foreground/40 transition-colors hover:text-muted-foreground",children:["Pixcode v",r," – ",o("branding.openSource")]})}),s.jsx("div",{className:"px-3 pt-3 md:hidden",children:s.jsxs("a",{href:Py,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(Dp,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.reportIssue")})]})}),s.jsx("div",{className:"px-3 pt-2 md:hidden",children:s.jsxs("a",{href:Fy,target:"_blank",rel:"noopener noreferrer",className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(zy,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.joinCommunity")})]})}),s.jsx("div",{className:"px-3 pb-3 pt-2 md:hidden",children:s.jsxs("button",{className:"flex h-12 w-full items-center gap-3.5 rounded-xl bg-muted/40 px-4 transition-all hover:bg-muted/60 active:scale-[0.98]",onClick:i,children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-xl bg-background/80",children:s.jsx(kt,{className:"w-4.5 h-4.5 text-muted-foreground"})}),s.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.settings")})]})})]})}const By="PIXCODE_GITHUB_STARS",$y="PIXCODE_HIDE_GITHUB_STAR",OD=3600*1e3,LD=(e,t)=>{const[n,r]=f.useState(null),[a,i]=f.useState(()=>{try{return localStorage.getItem($y)==="true"}catch{return!1}});f.useEffect(()=>{if(a)return;try{const d=localStorage.getItem(By);if(d){const u=JSON.parse(d);if(Date.now()-u.timestamp<OD){r(u.count);return}}}catch{}(async()=>{try{const d=await fetch(`https://api.github.com/repos/${e}/${t}`);if(!d.ok)return;const p=(await d.json()).stargazers_count;if(typeof p=="number"){r(p);try{localStorage.setItem(By,JSON.stringify({count:p,timestamp:Date.now()}))}catch{}}}catch{}})()},[e,t,a]);const o=f.useCallback(()=>{i(!0);try{localStorage.setItem($y,"true")}catch{}},[]),l=n!==null?n>=1e3?`${(n/1e3).toFixed(1)}k`:`${n}`:null;return{starCount:n,formattedCount:l,isDismissed:a,dismiss:o}},MD="https://github.com/alicomert/pixcode";function PD({className:e}){return s.jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s.jsx("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"})})}function FD(){const{formattedCount:e,isDismissed:t,dismiss:n}=LD("alicomert","pixcode");return t?null:s.jsxs("div",{className:"group/star relative hidden md:block",children:[s.jsxs("a",{href:MD,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 rounded-lg border border-border/50 bg-muted/30 px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:[s.jsx(PD,{className:"h-3.5 w-3.5"}),s.jsx(is,{className:"h-3 w-3"}),s.jsx("span",{className:"font-medium",children:"Star"}),e&&s.jsx("span",{className:"border-l border-border/50 pl-1.5 tabular-nums",children:e})]}),s.jsx("button",{onClick:r=>{r.preventDefault(),r.stopPropagation(),n()},className:"absolute -right-1.5 -top-1.5 hidden h-4 w-4 items-center justify-center rounded-full border border-border/50 bg-muted text-muted-foreground transition-colors hover:text-foreground group-hover/star:flex","aria-label":"Dismiss",children:s.jsx(bt,{className:"h-2.5 w-2.5"})})]})}function Uy({value:e,onChange:t,t:n}){const r="flex flex-1 items-center justify-center gap-1 rounded-md px-2 py-1 text-[11px] font-medium transition-all";return s.jsxs("div",{role:"tablist","aria-label":n("tooltips.historyView",{defaultValue:"History view"}),className:"flex rounded-lg bg-muted/40 p-0.5",children:[s.jsxs("button",{type:"button",role:"tab","aria-selected":e==="flat",onClick:()=>t("flat"),className:ge(r,e==="flat"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:n("tooltips.historyViewFlat",{defaultValue:"Recent conversations"}),children:[s.jsx(Oo,{className:"h-3 w-3"}),n("historyView.flat",{defaultValue:"Recent"})]}),s.jsxs("button",{type:"button",role:"tab","aria-selected":e==="grouped",onClick:()=>t("grouped"),className:ge(r,e==="grouped"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:n("tooltips.historyViewGrouped",{defaultValue:"Grouped by project"}),children:[s.jsx(lj,{className:"h-3 w-3"}),n("historyView.grouped",{defaultValue:"By project"})]})]})}function zD({isPWA:e,isMobile:t,isLoading:n,projectsCount:r,searchFilter:a,onSearchFilterChange:i,onClearSearchFilter:o,searchMode:l,onSearchModeChange:c,onRefresh:d,isRefreshing:u,onCreateProject:p,onQuickStartSession:h,onCollapseSidebar:m,historyView:g,onHistoryViewChange:b,t:x}){const y=()=>s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx("svg",{className:"h-6 w-6 flex-shrink-0",viewBox:"0 0 500 500","aria-hidden":"true",children:s.jsx("g",{transform:"translate(250 250) scale(1.25) translate(-250 -250)",children:s.jsxs("g",{transform:"translate(0 500) scale(0.1 -0.1)",fill:"#5C3FFC",children:[s.jsx("path",{d:"M2037 3800 c-104 -40 -191 -134 -231 -250 -23 -67 -20 -82 22 -109 31 -20 287 -177 1009 -618 40 -24 82 -56 93 -70 27 -34 27 -102 0 -136 -11 -13 -106 -78 -212 -143 -106 -64 -201 -124 -210 -132 -16 -14 -18 -41 -18 -302 0 -291 2 -310 38 -310 16 0 267 148 610 359 180 111 270 173 310 213 216 217 215 574 -3 793 -37 38 -107 89 -185 136 -69 42 -253 154 -410 249 -434 264 -509 307 -563 326 -57 20 -191 17 -250 -6z"}),s.jsx("path",{d:"M1803 2994 c-10 -5 -13 -156 -13 -709 0 -671 1 -706 20 -767 27 -89 93 -184 167 -240 89 -67 157 -90 281 -96 92 -4 105 -2 117 14 12 16 14 134 15 735 0 669 -1 718 -17 737 -20 23 -514 322 -541 327 -9 2 -23 2 -29 -1z"})]})})}),s.jsx("h1",{className:"truncate text-sm font-semibold tracking-tight text-foreground",children:x("app.title")})]});return s.jsxs("div",{className:"flex-shrink-0",children:[s.jsxs("div",{className:"hidden px-4 pb-3 pt-4 md:block",style:{},children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx(y,{}),s.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[s.jsx(Pe,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:d,disabled:u,title:x("tooltips.refresh"),children:s.jsx(Et,{className:`h-4 w-4 ${u?"animate-spin":""}`})}),s.jsx(Pe,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:p,title:x("tooltips.createProject"),children:s.jsx(sn,{className:"h-4 w-4"})}),s.jsx(Pe,{variant:"ghost",size:"sm",className:"h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-accent/80 hover:text-foreground",onClick:m,title:x("tooltips.hideSidebar"),children:s.jsx(ej,{className:"h-4 w-4"})})]})]}),s.jsx(FD,{}),h&&s.jsxs("button",{type:"button",onClick:()=>{h()},className:"mt-2.5 flex w-full items-center justify-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-sm font-medium text-primary transition-colors hover:bg-primary/10",children:[s.jsx(sa,{className:"h-4 w-4"}),x("sidebar.newChat",{defaultValue:"New chat"})]}),r>0&&!n&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[s.jsx(Uy,{value:g,onChange:b,t:x}),s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:ge("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(Nr,{className:"h-3 w-3"}),x("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ge("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(vi,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ia,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(Nt,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>i(v.target.value),className:"nav-search-input h-9 rounded-xl border-0 pl-9 pr-8 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-0.5 hover:bg-accent",children:s.jsx(bt,{className:"h-3 w-3 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider hidden md:block"}),s.jsxs("div",{className:"p-3 pb-2 md:hidden",style:e&&t?{paddingTop:"16px"}:{},children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(y,{}),s.jsxs("div",{className:"flex flex-shrink-0 gap-1.5",children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted/50 transition-all active:scale-95",onClick:d,disabled:u,children:s.jsx(Et,{className:`h-4 w-4 text-muted-foreground ${u?"animate-spin":""}`})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/90 text-primary-foreground transition-all active:scale-95",onClick:p,children:s.jsx(yi,{className:"h-4 w-4"})})]})]}),r>0&&!n&&s.jsxs("div",{className:"mt-2.5 space-y-2",children:[l==="projects"&&s.jsx(Uy,{value:g,onChange:b,t:x}),s.jsxs("div",{className:"flex rounded-lg bg-muted/50 p-0.5",children:[s.jsxs("button",{onClick:()=>c("projects"),"aria-pressed":l==="projects",className:ge("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="projects"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(Nr,{className:"h-3 w-3"}),x("search.modeProjects")]}),s.jsxs("button",{onClick:()=>c("conversations"),"aria-pressed":l==="conversations",className:ge("flex-1 flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium transition-all",l==="conversations"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[s.jsx(vi,{className:"h-3 w-3"}),x("search.modeConversations")]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ia,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/50"}),s.jsx(Nt,{type:"text",placeholder:x(l==="conversations"?"search.conversationsPlaceholder":"projects.searchPlaceholder"),value:a,onChange:v=>i(v.target.value),className:"nav-search-input h-10 rounded-xl border-0 pl-10 pr-9 text-sm transition-all duration-200 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0"}),a&&s.jsx("button",{onClick:o,"aria-label":x("tooltips.clearSearch"),className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded-md p-1 hover:bg-accent",children:s.jsx(bt,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]})]}),s.jsx("div",{className:"nav-divider md:hidden"})]})}const BD=160,Gy=180;function A4({actions:e,className:t,triggerLabel:n}){const[r,a]=f.useState(!1),[i,o]=f.useState(null),l=f.useRef(null),c=f.useRef(null);f.useLayoutEffect(()=>{if(!r||!l.current)return;const u=l.current.getBoundingClientRect();let p=u.right-BD;p<8&&(p=8);let h=u.bottom+4;h+Gy>window.innerHeight&&(h=Math.max(8,u.top-4-Gy)),o({top:h,left:p})},[r]),f.useEffect(()=>{if(!r)return;const u=m=>{const g=m.target;l.current?.contains(g)||c.current?.contains(g)||a(!1)},p=m=>{m.key==="Escape"&&a(!1)},h=()=>a(!1);return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p),window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[r]);const d=u=>p=>{p.stopPropagation(),p.preventDefault(),a(!1),u.onClick()};return s.jsxs(s.Fragment,{children:[s.jsx("button",{ref:l,type:"button","aria-haspopup":"menu","aria-expanded":r,"aria-label":n||"Actions",title:n||"Actions",onClick:u=>{u.stopPropagation(),u.preventDefault(),a(p=>!p)},className:ge("flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground","opacity-0 transition-all duration-150 hover:bg-accent hover:text-foreground","group-hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary","touch:opacity-100",r&&"bg-accent text-foreground opacity-100",t),children:s.jsx(xj,{className:"h-3.5 w-3.5"})}),r&&i&&Yc.createPortal(s.jsx("div",{ref:c,role:"menu",style:{position:"fixed",top:i.top,left:i.left,zIndex:9999},className:ge("w-40 rounded-xl border border-border/60 bg-popover p-1 shadow-lg","animate-in fade-in-0 zoom-in-95 duration-100"),onClick:u=>u.stopPropagation(),onMouseDown:u=>u.stopPropagation(),children:e.map((u,p)=>{const h=u.icon,m=e[p-1],g=p>0&&u.danger&&!m?.danger;return s.jsxs("div",{children:[g&&s.jsx("div",{className:"my-1 h-px bg-border/60"}),s.jsxs("button",{type:"button",role:"menuitem",onClick:d(u),className:ge("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs",u.danger?"text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20":"text-foreground hover:bg-accent"),children:[s.jsx(h,{className:"h-3 w-3"}),u.label]})]},u.id)})}),document.body)]})}const Hy={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},$D={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"},UD=e=>e==="fully-configured"?{icon:fs,colorClassName:"text-green-500 dark:text-green-400",backgroundClassName:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"}:e==="taskmaster-only"?{icon:kt,colorClassName:"text-blue-500 dark:text-blue-400",backgroundClassName:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"}:e==="mcp-only"?{icon:na,colorClassName:"text-amber-500 dark:text-amber-400",backgroundClassName:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"}:{icon:bt,colorClassName:"text-gray-400 dark:text-gray-500",backgroundClassName:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"};function GD({status:e="not-configured",size:t="sm",className:n="",showLabel:r=!1}){const a=UD(e),i=a.icon;return r?s.jsxs("div",{className:ge("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",a.backgroundClassName,a.colorClassName,n),title:a.title,children:[s.jsx(i,{className:Hy[t]}),s.jsx("span",{className:"font-medium",children:a.label})]}):s.jsx("div",{className:ge("inline-flex items-center justify-center rounded-full transition-colors",a.backgroundClassName,$D[t],n),title:a.title,children:s.jsx(i,{className:ge(Hy[t],a.colorClassName)})})}const HD=(e,t,n)=>{const r=new Date(e),a=t;if(isNaN(r.getTime()))return n?n("status.unknown"):"Unknown";const i=a.getTime()-r.getTime(),o=Math.floor(i/1e3),l=Math.floor(i/(1e3*60)),c=Math.floor(i/(1e3*60*60)),d=Math.floor(i/(1e3*60*60*24));return o<60?n?n("time.justNow"):"Just now":l===1?n?n("time.oneMinuteAgo"):"1 min ago":l<60?n?n("time.minutesAgo",{count:l}):`${l} mins ago`:c===1?n?n("time.oneHourAgo"):"1 hour ago":c<24?n?n("time.hoursAgo",{count:c}):`${c} hours ago`:d===1?n?n("time.oneDayAgo"):"1 day ago":d<7?n?n("time.daysAgo",{count:d}):`${d} days ago`:r.toLocaleDateString()};function qy({isStarred:e,canDelete:t,onRename:n,onToggleStar:r,onDelete:a,t:i,className:o}){const l=d=>s.jsx(is,{className:`${d.className??""} ${e?"fill-yellow-400 text-yellow-500":""}`}),c=[{id:"rename",label:i("actions.rename"),icon:uj,onClick:n},{id:"star",label:e?i("actions.unstarSession",{defaultValue:"Remove star"}):i("actions.starSession",{defaultValue:"Star"}),icon:l,onClick:r}];return t&&c.push({id:"delete",label:i("actions.delete"),icon:gn,onClick:a,danger:!0}),s.jsx(A4,{actions:c,className:o,triggerLabel:i("tooltips.sessionActions",{defaultValue:"Session actions"})})}const qD={claude:"Claude",cursor:"Cursor",codex:"Codex",gemini:"Gemini",qwen:"Qwen Code",opencode:"OpenCode"},Vy={claude:"bg-orange-500/10 text-orange-600 dark:bg-orange-400/10 dark:text-orange-300 ring-1 ring-orange-500/15",cursor:"bg-sky-500/10 text-sky-600 dark:bg-sky-400/10 dark:text-sky-300 ring-1 ring-sky-500/15",codex:"bg-violet-500/10 text-violet-600 dark:bg-violet-400/10 dark:text-violet-300 ring-1 ring-violet-500/15",gemini:"bg-emerald-500/10 text-emerald-600 dark:bg-emerald-400/10 dark:text-emerald-300 ring-1 ring-emerald-500/15",qwen:"bg-amber-500/10 text-amber-600 dark:bg-amber-400/10 dark:text-amber-300 ring-1 ring-amber-500/15",opencode:"bg-teal-500/10 text-teal-600 dark:bg-teal-400/10 dark:text-teal-300 ring-1 ring-teal-500/15"};function _4({project:e,session:t,selectedSession:n,currentTime:r,editingSession:a,editingSessionName:i,isStarred:o,compact:l=!1,onEditingSessionNameChange:c,onStartEditingSession:d,onCancelEditingSession:u,onSaveEditingSession:p,onToggleStarSession:h,onProjectSelect:m,onSessionSelect:g,onDeleteSession:b,t:x}){const y=T9(t,r,x),v=n?.id===t.id,w=a===t.id,S=t.__provider,E=qD[S]??S,k=Vy[S]??Vy.claude,T=E9(y.sessionName),_=()=>{m(e),g(t,e.name)},C=()=>{p(e.name,t.id,i,S)},I=()=>{b(e.name,t.id,y.sessionName,S)},O=()=>d(t.id,y.sessionName),A=()=>h(e.name,t.id),R=s.jsxs("div",{className:"mt-0.5 flex min-w-0 flex-wrap items-center gap-1 text-[10px] leading-tight",children:[s.jsxs("span",{className:ge("inline-flex items-center gap-1 rounded-full px-1.5 py-px font-medium",k),children:[s.jsx(Rn,{provider:S,className:"h-2.5 w-2.5"}),E]}),s.jsx("span",{className:"text-muted-foreground/80",children:HD(y.sessionTime,r,x)}),y.isActive&&s.jsxs("span",{className:"inline-flex items-center gap-1 text-green-600 dark:text-green-400",children:[s.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-green-500"}),x("status.active",{defaultValue:"Active"})]}),T.slice(0,3).map(B=>s.jsxs("span",{className:"rounded-md bg-muted/60 px-1 py-px font-mono text-[9px] uppercase tracking-wide text-muted-foreground ring-1 ring-border/40",children:[".",B]},B))]}),N=s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",value:i,onChange:B=>c(B.target.value),onKeyDown:B=>{B.stopPropagation(),B.key==="Enter"?C():B.key==="Escape"&&u()},onClick:B=>B.stopPropagation(),className:"w-full rounded-md border border-primary/40 bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40",onClick:B=>{B.stopPropagation(),C()},title:x("tooltips.save"),children:s.jsx(Gt,{className:"h-3 w-3 text-green-600 dark:text-green-400"})}),s.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40",onClick:B=>{B.stopPropagation(),u()},title:x("tooltips.cancel"),children:s.jsx(bt,{className:"h-3 w-3 text-gray-600 dark:text-gray-400"})})]}),F=s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:ge("relative mx-3 my-0.5 rounded-lg border border-border/30 bg-card p-2 transition-all duration-150 active:scale-[0.98]",v&&"border-primary/30 bg-primary/5 shadow-sm",!v&&y.isActive&&"border-green-500/25 bg-green-50/5 dark:bg-green-900/5",o&&!v&&"ring-1 ring-yellow-300/50 dark:ring-yellow-500/30"),onClick:w?void 0:_,children:w?s.jsx("div",{className:"flex items-center gap-1",children:N}):s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ge("flex h-6 w-6 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/60"),children:s.jsx(Rn,{provider:S,className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[o&&s.jsx("span",{className:"text-yellow-500","aria-hidden":!0,children:"★"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),R]}),s.jsx("div",{className:"flex-shrink-0",onClick:B=>B.stopPropagation(),children:s.jsx(qy,{isStarred:o,canDelete:!y.isCursorSession,onRename:O,onToggleStar:A,onDelete:I,t:x,className:"!opacity-100"})})]})})}),K=s.jsxs("div",{className:ge("group/item relative hidden md:block"),children:[s.jsxs(Pe,{variant:"ghost",className:ge("relative h-auto w-full justify-start overflow-hidden p-0 text-left font-normal transition-colors duration-150","hover:bg-accent/60",v&&"bg-accent text-accent-foreground",o&&!v&&"bg-yellow-50/40 hover:bg-yellow-100/40 dark:bg-yellow-900/10 dark:hover:bg-yellow-900/20",l?"rounded-xl px-3 py-2.5":"rounded-lg px-3 py-2"),onClick:w?void 0:()=>g(t,e.name),children:[v&&s.jsx("span",{"aria-hidden":!0,className:"absolute left-0 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-r bg-primary"}),!v&&!w&&s.jsx("span",{"aria-hidden":!0,className:"session-item-accent"}),s.jsxs("div",{className:"flex w-full min-w-0 items-start gap-2 pr-6",children:[s.jsx("div",{className:ge("mt-0.5 flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-md",v?"bg-primary/10":"bg-muted/50 group-hover/item:bg-muted/80"),children:s.jsx(Rn,{provider:S,className:"h-3 w-3"})}),s.jsx("div",{className:"min-w-0 flex-1",children:w?s.jsx("div",{className:"flex items-center gap-1",children:N}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o&&s.jsx("span",{className:"flex-shrink-0 text-yellow-500","aria-hidden":!0,children:"★"}),s.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:y.sessionName})]}),R]})})]})]}),!w&&s.jsx("div",{className:"absolute right-1.5 top-1/2 -translate-y-1/2",onClick:B=>B.stopPropagation(),children:s.jsx(qy,{isStarred:o,canDelete:!y.isCursorSession,onRename:O,onToggleStar:A,onDelete:I,t:x,className:"opacity-0 group-hover/item:opacity-100 focus-visible:opacity-100"})})]});return s.jsxs("div",{className:"group relative",children:[F,K]})}function VD(){return s.jsx(s.Fragment,{children:Array.from({length:3}).map((e,t)=>s.jsx("div",{className:"rounded-md p-2",children:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"mt-0.5 h-3 w-3 animate-pulse rounded-full bg-muted"}),s.jsxs("div",{className:"flex-1 space-y-1",children:[s.jsx("div",{className:"h-3 animate-pulse rounded bg-muted",style:{width:`${60+t*15}%`}}),s.jsx("div",{className:"h-2 w-1/2 animate-pulse rounded bg-muted"})]})]})},t))})}function WD({project:e,isExpanded:t,sessions:n,selectedSession:r,initialSessionsLoaded:a,isLoadingSessions:i,currentTime:o,editingSession:l,editingSessionName:c,isSessionStarred:d,onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:h,onSaveEditingSession:m,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,onLoadMoreSessions:v,onNewSession:w,t:S}){if(!t)return null;const E=n.length>0,k=e.sessionMeta?.hasMore===!0;return s.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[s.jsx("div",{className:"px-3 pb-1 pt-1 md:hidden",children:s.jsxs("button",{className:"flex h-8 w-full items-center justify-center gap-2 rounded-md bg-primary text-xs font-medium text-primary-foreground transition-all duration-150 hover:bg-primary/90 active:scale-[0.98]",onClick:()=>{b(e),w(e)},children:[s.jsx(sn,{className:"h-3 w-3"}),S("sessions.newSession")]})}),s.jsxs(Pe,{variant:"default",size:"sm",className:"hidden h-8 w-full justify-start gap-2 bg-primary text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 md:flex",onClick:()=>w(e),children:[s.jsx(sn,{className:"h-3 w-3"}),S("sessions.newSession")]}),a?!E&&!i?s.jsx("div",{className:"px-3 py-2 text-left",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:S("sessions.noSessions")})}):n.map(T=>s.jsx(_4,{project:e,session:T,selectedSession:r,currentTime:o,editingSession:l,editingSessionName:c,isStarred:d(e.name,T.id),onEditingSessionNameChange:u,onStartEditingSession:p,onCancelEditingSession:h,onSaveEditingSession:m,onToggleStarSession:g,onProjectSelect:b,onSessionSelect:x,onDeleteSession:y,t:S},T.id)):s.jsx(VD,{}),E&&k&&s.jsx(Pe,{variant:"ghost",size:"sm",className:"mt-2 w-full justify-center gap-2 text-muted-foreground",onClick:()=>v(e),disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-3 w-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),S("sessions.loading")]}):s.jsxs(s.Fragment,{children:[s.jsx(Pn,{className:"h-3 w-3"}),S("sessions.showMore")]})})]})}const KD=(e,t)=>{const n=e.length;return t&&n>=5?`${n}+`:`${n}`};function YD({project:e,selectedProject:t,selectedSession:n,isExpanded:r,isDeleting:a,isStarred:i,editingProject:o,editingName:l,sessions:c,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:g,mcpServerStatus:b,isSessionStarred:x,onEditingNameChange:y,onToggleProject:v,onProjectSelect:w,onToggleStarProject:S,onToggleStarSession:E,onStartEditingProject:k,onCancelEditingProject:T,onSaveProjectName:_,onDeleteProject:C,onSessionSelect:I,onDeleteSession:O,onLoadMoreSessions:A,onNewSession:R,onEditingSessionNameChange:N,onStartEditingSession:F,onCancelEditingSession:K,onSaveEditingSession:B,t:W}){const H=t?.name===e.name,L=o===e.name,G=e.sessionMeta?.hasMore===!0,U=KD(c,G),M=`${U} session${c.length===1?"":"s"}`,J=I9(e,b),te=()=>v(e.name),de=()=>S(e.name),ue=()=>{_(e.name)},se=()=>{t?.name!==e.name&&w(e),te()};return s.jsxs("div",{className:ge("md:space-y-1",a&&"opacity-50 pointer-events-none"),children:[s.jsxs("div",{className:"md:group group",children:[s.jsx("div",{className:"md:hidden",children:s.jsx("div",{className:ge("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",H&&"bg-primary/5 border-primary/20",i&&!H&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:te,children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[s.jsx("div",{className:ge("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",r?"bg-primary/10":"bg-muted"),children:r?s.jsx(Ma,{className:"h-4 w-4 text-primary"}):s.jsx(Nr,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("div",{className:"min-w-0 flex-1",children:L?s.jsx("input",{type:"text",value:l,onChange:he=>y(he.target.value),className:"w-full rounded-lg border-2 border-primary/40 bg-background px-3 py-2 text-sm text-foreground shadow-sm transition-all duration-200 focus:border-primary focus:shadow-md focus:outline-none",placeholder:W("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:he=>he.stopPropagation(),onKeyDown:he=>{he.key==="Enter"&&ue(),he.key==="Escape"&&T()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center justify-between",children:[s.jsx("h3",{className:"truncate text-sm font-medium text-foreground",children:e.displayName}),g&&s.jsx(GD,{status:J,size:"xs",className:"ml-2 hidden flex-shrink-0 md:inline-flex"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:M})]})})]}),s.jsx("div",{className:"flex items-center gap-1",children:L?s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-green-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-green-600",onClick:he=>{he.stopPropagation(),ue()},children:s.jsx(Gt,{className:"h-4 w-4 text-white"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-gray-500 shadow-sm transition-all duration-150 active:scale-90 active:shadow-none dark:bg-gray-600",onClick:he=>{he.stopPropagation(),T()},children:s.jsx(bt,{className:"h-4 w-4 text-white"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{className:ge("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",i?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:he=>{he.stopPropagation(),de()},title:W(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:s.jsx(is,{className:ge("w-4 h-4 transition-colors",i?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30",onClick:he=>{he.stopPropagation(),C(e)},children:s.jsx(gn,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),s.jsx("button",{className:"flex h-8 w-8 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 active:scale-90 dark:border-primary/30 dark:bg-primary/20",onClick:he=>{he.stopPropagation(),k(e)},children:s.jsx(Rp,{className:"h-4 w-4 text-primary"})}),s.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-md bg-muted/30",children:r?s.jsx(Pn,{className:"h-3 w-3 text-muted-foreground"}):s.jsx(Sr,{className:"h-3 w-3 text-muted-foreground"})})]})})]})})}),s.jsxs(Pe,{variant:"ghost",className:ge("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",H&&"bg-accent text-accent-foreground",i&&!H&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:se,children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[r?s.jsx(Ma,{className:"h-4 w-4 flex-shrink-0 text-primary"}):s.jsx(Nr,{className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),s.jsx("div",{className:"min-w-0 flex-1 text-left",children:L?s.jsxs("div",{className:"space-y-1",children:[s.jsx("input",{type:"text",value:l,onChange:he=>y(he.target.value),className:"w-full rounded border border-border bg-background px-2 py-1 text-sm text-foreground focus:ring-2 focus:ring-primary/20",placeholder:W("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:he=>{he.key==="Enter"&&ue(),he.key==="Escape"&&T()}}),s.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.fullPath,children:e.fullPath})]}):s.jsxs("div",{children:[s.jsx("div",{className:"truncate text-sm font-semibold text-foreground",title:e.displayName,children:e.displayName}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:[U,e.fullPath!==e.displayName&&s.jsxs("span",{className:"ml-1 opacity-60",title:e.fullPath,children:[" - ",e.fullPath.length>25?`...${e.fullPath.slice(-22)}`:e.fullPath]})]})]})})]}),s.jsx("div",{className:"flex flex-shrink-0 items-center gap-1",children:L?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-green-600 transition-colors hover:bg-green-50 hover:text-green-700 dark:hover:bg-green-900/20",onClick:he=>{he.stopPropagation(),ue()},children:s.jsx(Gt,{className:"h-3 w-3"})}),s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700 dark:hover:bg-gray-800",onClick:he=>{he.stopPropagation(),T()},children:s.jsx(bt,{className:"h-3 w-3"})})]}):s.jsxs(s.Fragment,{children:[i&&s.jsx("div",{className:"flex h-6 w-6 cursor-pointer items-center justify-center rounded hover:bg-yellow-50 dark:hover:bg-yellow-900/20",onClick:he=>{he.stopPropagation(),de()},title:W("tooltips.removeFromFavorites"),children:s.jsx(is,{className:"h-3 w-3 fill-current text-yellow-600 dark:text-yellow-400"})}),s.jsx(A4,{triggerLabel:W("tooltips.projectActions",{defaultValue:"Project actions"}),actions:[{id:"rename",label:W("actions.rename"),icon:Rp,onClick:()=>k(e)},{id:"star",label:W(i?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),icon:is,onClick:de},{id:"delete",label:W("actions.delete",{defaultValue:"Delete"}),icon:gn,onClick:()=>C(e),danger:!0}]}),r?s.jsx(Pn,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"}):s.jsx(Sr,{className:"h-4 w-4 text-muted-foreground transition-colors group-hover:text-foreground"})]})})]})]}),s.jsx(WD,{project:e,isExpanded:r,sessions:c,selectedSession:n,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:p,editingSession:h,editingSessionName:m,isSessionStarred:x,onEditingSessionNameChange:N,onStartEditingSession:F,onCancelEditingSession:K,onSaveEditingSession:B,onToggleStarSession:E,onProjectSelect:w,onSessionSelect:I,onDeleteSession:O,onLoadMoreSessions:A,onNewSession:R,t:W})]})}function I4({isLoading:e,loadingProgress:t,projectsCount:n,filteredProjectsCount:r,t:a}){return e?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.loadingProjects")}),t&&t.total>0?s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-muted",children:s.jsx("div",{className:"h-full bg-primary transition-all duration-300 ease-out",style:{width:`${t.current/t.total*100}%`}})}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.current,"/",t.total," ",a("projects.projects")]}),t.currentProject&&s.jsx("p",{className:"mx-auto max-w-[200px] truncate text-xs text-muted-foreground/70",title:t.currentProject,children:t.currentProject.split("-").slice(-2).join("/")})]}):s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.fetchingProjects")})]}):n===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(Nr,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.runClaudeCli")})]}):r===0?s.jsxs("div",{className:"px-4 py-12 text-center md:py-8",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-lg bg-muted md:mb-3",children:s.jsx(ia,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx("h3",{className:"mb-2 text-base font-medium text-foreground md:mb-1",children:a("projects.noMatchingProjects")}),s.jsx("p",{className:"text-sm text-muted-foreground",children:a("projects.tryDifferentSearch")})]}):null}function ZD({projects:e,filteredProjects:t,selectedProject:n,selectedSession:r,isLoading:a,loadingProgress:i,expandedProjects:o,editingProject:l,editingName:c,loadingSessions:d,initialSessionsLoaded:u,currentTime:p,editingSession:h,editingSessionName:m,deletingProjects:g,tasksEnabled:b,mcpServerStatus:x,getProjectSessions:y,isProjectStarred:v,isSessionStarred:w,onEditingNameChange:S,onToggleProject:E,onProjectSelect:k,onToggleStarProject:T,onToggleStarSession:_,onStartEditingProject:C,onCancelEditingProject:I,onSaveProjectName:O,onDeleteProject:A,onSessionSelect:R,onDeleteSession:N,onLoadMoreSessions:F,onNewSession:K,onEditingSessionNameChange:B,onStartEditingSession:W,onCancelEditingSession:H,onSaveEditingSession:L,t:G}){const U=s.jsx(I4,{isLoading:a,loadingProgress:i,projectsCount:e.length,filteredProjectsCount:t.length,t:G});f.useEffect(()=>{let se="Pixcode";const he=n?.displayName?.trim();he&&(se=`${he} - ${se}`),document.title=se},[n]);const M=!a&&e.length>0&&t.length>0,J=se=>se.source==="history"||se.autoDiscovered===!0&&se.isManuallyAdded!==!0,te=t.filter(se=>!J(se)),de=t.filter(se=>J(se)),ue=se=>s.jsx(YD,{project:se,selectedProject:n,selectedSession:r,isExpanded:o.has(se.name),isDeleting:g.has(se.name),isStarred:v(se.name),editingProject:l,editingName:c,sessions:y(se),initialSessionsLoaded:u.has(se.name),isLoadingSessions:!!d[se.name],currentTime:p,editingSession:h,editingSessionName:m,tasksEnabled:b,mcpServerStatus:x,isSessionStarred:w,onEditingNameChange:S,onToggleProject:E,onProjectSelect:k,onToggleStarProject:T,onToggleStarSession:_,onStartEditingProject:C,onCancelEditingProject:I,onSaveProjectName:O,onDeleteProject:A,onSessionSelect:R,onDeleteSession:N,onLoadMoreSessions:F,onNewSession:K,onEditingSessionNameChange:B,onStartEditingSession:W,onCancelEditingSession:H,onSaveEditingSession:L,t:G},se.name);return s.jsx("div",{className:"pb-safe-area-inset-bottom md:space-y-1",children:M?s.jsxs(s.Fragment,{children:[te.map(se=>ue(se)),de.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-3 pb-1 pt-3 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:G("projects.detectedFromHistory")}),de.map(se=>ue(se))]})]}):U})}function Xr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j4(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}/*!
|
|
230
230
|
* GSAP 3.15.0
|
|
231
231
|
* https://gsap.com
|
|
232
232
|
*
|
|
@@ -319,7 +319,7 @@ Waiting for the server to restart…
|
|
|
319
319
|
`).trim():"";function wP({message:e}){return s.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-red-200 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20",children:[s.jsx(na,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-red-600 dark:text-red-400"}),s.jsx("p",{className:"text-sm text-red-800 dark:text-red-200",children:e})]})}const kP=["git@","ssh://"],SP=/^[A-Za-z]:\\?$/,PE=e=>{const t=e.trim();return kP.some(n=>t.startsWith(n))},FE=(e,t)=>e==="new"&&t.trim().length>0&&!PE(t),aw=(e,t)=>e==="new"&&t.trim().length>0,EP=e=>{const t=e.trim(),n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n===2&&/^[A-Za-z]:/.test(t)?`${t.slice(0,2)}\\`:n>0?t.slice(0,n):"~"},NP=e=>{if(e==="~"||e==="/"||SP.test(e))return null;const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t<=0?"/":t===2&&/^[A-Za-z]:/.test(e)?`${e.slice(0,2)}\\`:e.slice(0,t)},CP=(e,t)=>{const n=e.trim().replace(/[\\/]+$/,""),r=n.includes("\\")&&!n.includes("/")?"\\":"/";return`${n}${r}${t.trim()}`},_u=(e,t)=>`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${e===t?e==="none"?"bg-green-500 text-white":"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`;function TP({tokenMode:e,selectedGithubToken:t,newGithubToken:n,availableTokens:r,loadingTokens:a,tokenLoadError:i,onTokenModeChange:o,onSelectedGithubTokenChange:l,onNewGithubTokenChange:c}){const{t:d}=Re();return s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsxs("div",{className:"mb-4 flex items-start gap-3",children:[s.jsx(o0,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-gray-600 dark:text-gray-400"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h5",{className:"mb-1 font-medium text-gray-900 dark:text-white",children:d("projectWizard.step2.githubAuth")}),s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:d("projectWizard.step2.githubAuthHelp")})]})]}),a&&s.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[s.jsx(fn,{className:"h-4 w-4 animate-spin"}),d("projectWizard.step2.loadingTokens")]}),!a&&i&&s.jsx("p",{className:"mb-3 text-sm text-red-600 dark:text-red-400",children:i}),!a&&r.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-4 grid grid-cols-3 gap-2",children:[s.jsx("button",{onClick:()=>o("stored"),className:_u(e,"stored"),children:d("projectWizard.step2.storedToken")}),s.jsx("button",{onClick:()=>o("new"),className:_u(e,"new"),children:d("projectWizard.step2.newToken")}),s.jsx("button",{onClick:()=>{o("none"),l(""),c("")},className:_u(e,"none"),children:d("projectWizard.step2.nonePublic")})]}),e==="stored"?s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:d("projectWizard.step2.selectToken")}),s.jsxs("select",{value:t,onChange:u=>l(u.target.value),className:"w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm dark:border-gray-600 dark:bg-gray-800",children:[s.jsx("option",{value:"",children:d("projectWizard.step2.selectTokenPlaceholder")}),r.map(u=>s.jsx("option",{value:String(u.id),children:u.credential_name},u.id))]})]}):e==="new"?s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:d("projectWizard.step2.newToken")}),s.jsx(Nt,{type:"password",value:n,onChange:u=>c(u.target.value),placeholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:"w-full"}),s.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:d("projectWizard.step2.tokenHelp")})]}):null]}),!a&&r.length===0&&s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:s.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:d("projectWizard.step2.publicRepoInfo")})}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:d("projectWizard.step2.optionalTokenPublic")}),s.jsx(Nt,{type:"password",value:n,onChange:u=>{const p=u.target.value;c(p),o(p.trim()?"new":"none")},placeholder:d("projectWizard.step2.tokenPublicPlaceholder"),className:"w-full"}),s.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:d("projectWizard.step2.noTokensHelp")})]})]})]})}const ld=async e=>await e.json(),AP=async()=>{const e=await Qe.get("/settings/credentials?type=github_token"),t=await ld(e);if(!e.ok)throw new Error(t.error||"Failed to load GitHub tokens");return(t.credentials||[]).filter(n=>n.is_active)},zE=async e=>{const t=`/browse-filesystem?path=${encodeURIComponent(e)}`,n=await Qe.get(t),r=await ld(n);if(!n.ok)throw new Error(r.error||"Failed to browse filesystem");return{path:r.path||e,rootPath:r.rootPath||r.path||e,suggestions:r.suggestions||[]}},_P=async e=>{const t=await Qe.createFolder(e),n=await ld(t);if(!t.ok)throw new Error(n.error||"Failed to create folder");return n.path||e},IP=async e=>{const t=await Qe.createWorkspace(e),n=await ld(t);if(!t.ok)throw new Error(n.details||n.error||"Failed to create workspace");return n.project},jP=({workspacePath:e,githubUrl:t,tokenMode:n,selectedGithubToken:r,newGithubToken:a})=>{const i=new URLSearchParams({path:e.trim(),githubUrl:t.trim()});n==="stored"&&r&&i.set("githubTokenId",r),n==="new"&&a.trim()&&i.set("newGithubToken",a.trim());const o=localStorage.getItem("auth-token");return o&&i.set("token",o),i.toString()},RP=(e,t)=>new Promise((n,r)=>{const a=jP(e),i=new EventSource(`/api/projects/clone-progress?${a}`);let o=!1;const l=c=>{o||(o=!0,i.close(),c())};i.onmessage=c=>{try{const d=JSON.parse(c.data);if(d.type==="progress"&&d.message){t.onProgress(d.message);return}if(d.type==="complete"){l(()=>n(d.project));return}d.type==="error"&&l(()=>r(new Error(d.message||"Failed to clone repository")))}catch(d){console.error("Error parsing clone progress event:",d)}},i.onerror=()=>{l(()=>r(new Error("Connection lost during clone")))}});function DP({isOpen:e,autoAdvanceOnSelect:t,onClose:n,onFolderSelected:r}){const[a,i]=f.useState("~"),[o,l]=f.useState("~"),[c,d]=f.useState("~"),[u,p]=f.useState([]),[h,m]=f.useState(!1),[g,b]=f.useState(!1),[x,y]=f.useState(!1),[v,w]=f.useState(""),[S,E]=f.useState(!1),[k,T]=f.useState(null),_=f.useCallback(async N=>{m(!0),T(null);try{const F=await zE(N);i(F.path),d(F.path),l(F.rootPath),p(F.suggestions)}catch(F){T(F instanceof Error?F.message:"Failed to load folders")}finally{m(!1)}},[]);f.useEffect(()=>{e&&_("~")},[e,_]);const C=f.useMemo(()=>u.filter(N=>g||!N.name.startsWith(".")).sort((N,F)=>N.name.toLowerCase().localeCompare(F.name.toLowerCase())),[u,g]),I=()=>{y(!1),w("")},O=()=>{T(null),I(),n()},A=f.useCallback(async()=>{if(v.trim()){E(!0),T(null);try{const N=CP(a,v),F=await _P(N);I(),await _(F)}catch(N){T(N instanceof Error?N.message:"Failed to create folder")}finally{E(!1)}}},[a,_,v]),R=a===o?null:NP(a);return e?s.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/50 p-4 backdrop-blur-sm",children:s.jsxs("div",{className:"flex max-h-[80vh] w-full max-w-2xl flex-col rounded-lg border border-gray-200 bg-white shadow-xl dark:border-gray-700 dark:bg-gray-800",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-blue-100 dark:bg-blue-900/50",children:s.jsx(Ma,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"})}),s.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Select Folder"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>b(N=>!N),className:`rounded-md p-2 transition-colors ${g?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400":"text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300"}`,title:g?"Hide hidden folders":"Show hidden folders",children:g?s.jsx(Ti,{className:"h-5 w-5"}):s.jsx(s0,{className:"h-5 w-5"})}),s.jsx("button",{onClick:()=>y(N=>!N),className:`rounded-md p-2 transition-colors ${x?"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400":"text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300"}`,title:"Create new folder",children:s.jsx(sn,{className:"h-5 w-5"})}),s.jsx("button",{onClick:O,className:"rounded-md p-2 text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300",children:s.jsx(bt,{className:"h-5 w-5"})})]})]}),x&&s.jsx("div",{className:"border-b border-gray-200 bg-blue-50 px-4 py-3 dark:border-gray-700 dark:bg-blue-900/20",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Nt,{type:"text",value:v,onChange:N=>w(N.target.value),placeholder:"New folder name",className:"flex-1",onKeyDown:N=>{N.key==="Enter"&&A(),N.key==="Escape"&&I()},autoFocus:!0}),s.jsx(Pe,{size:"sm",onClick:A,disabled:!v.trim()||S,children:S?s.jsx(fn,{className:"h-4 w-4 animate-spin"}):"Create"}),s.jsx(Pe,{size:"sm",variant:"ghost",onClick:I,children:"Cancel"})]})}),k&&s.jsx("div",{className:"px-4 pt-3",children:s.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:k})}),s.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:h?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(fn,{className:"h-6 w-6 animate-spin text-gray-400"})}):s.jsxs("div",{className:"space-y-1",children:[R&&s.jsxs("button",{onClick:()=>_(R),className:"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700",children:[s.jsx(Ma,{className:"h-5 w-5 text-gray-400"}),s.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:".."})]}),C.length===0?s.jsx("div",{className:"py-8 text-center text-gray-500 dark:text-gray-400",children:"No subfolders found"}):C.map(N=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{onClick:()=>_(N.path),className:"flex flex-1 items-center gap-3 rounded-lg px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700",children:[s.jsx(yi,{className:"h-5 w-5 text-blue-500"}),s.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:N.name})]}),s.jsx(Pe,{variant:"ghost",size:"sm",onClick:()=>r(N.path,t),className:"px-3 text-xs",children:"Select"})]},N.path))]})}),s.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700",children:[s.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 px-4 py-3 dark:bg-gray-900/50",children:[s.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Path:"}),s.jsx(Nt,{type:"text",value:c,onChange:N=>d(N.target.value),onKeyDown:N=>{if(N.key==="Enter"){N.preventDefault();const F=c.trim();F&&_(F)}N.key==="Escape"&&d(a)},placeholder:"Type a path (e.g. D:\\\\Projects) and press Enter",className:"flex-1 font-mono text-sm"})]}),s.jsxs("div",{className:"flex items-center justify-end gap-2 p-4",children:[s.jsx(Pe,{variant:"outline",onClick:O,children:"Cancel"}),s.jsx(Pe,{variant:"outline",onClick:()=>r(a,t),children:"Use this folder"})]})]})]})}):null}function OP({workspaceType:e,value:t,disabled:n=!1,onChange:r,onAdvanceToConfirm:a}){const[i,o]=f.useState([]),[l,c]=f.useState(!1),[d,u]=f.useState(!1);f.useEffect(()=>{if(t.trim().length<=2){o([]),c(!1);return}const m=window.setTimeout(async()=>{try{const g=EP(t),b=await zE(g),x=t.toLowerCase(),y=b.suggestions.filter(v=>{const w=v.path.toLowerCase();return w.startsWith(x)&&w!==x}).slice(0,5);o(y),c(y.length>0)}catch(g){console.error("Failed to load path suggestions:",g)}},200);return()=>{window.clearTimeout(m)}},[t]);const p=f.useCallback(m=>{r(m.path),c(!1)},[r]),h=f.useCallback((m,g)=>{r(m),u(!1),g&&a()},[a,r]);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative flex gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Nt,{type:"text",value:t,onChange:m=>r(m.target.value),placeholder:e==="existing"?"my-existing-project or /absolute/path":"my-new-project or /absolute/path",className:"w-full",disabled:n}),l&&i.length>0&&s.jsx("div",{className:"absolute z-10 mt-1 max-h-60 w-full overflow-y-auto rounded-lg border border-gray-200 bg-white shadow-lg dark:border-gray-700 dark:bg-gray-800",children:i.map(m=>s.jsxs("button",{onClick:()=>p(m),className:"w-full px-4 py-2 text-left text-sm hover:bg-gray-100 dark:hover:bg-gray-700",children:[s.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:m.name}),s.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:m.path})]},m.path))})]}),s.jsx(Pe,{type:"button",variant:"outline",onClick:()=>u(!0),className:"px-3",title:"Browse folders",disabled:n,children:s.jsx(Ma,{className:"h-4 w-4"})})]}),s.jsx(DP,{isOpen:d,autoAdvanceOnSelect:e==="existing",onClose:()=>u(!1),onFolderSelected:h})]})}function LP({workspaceType:e,workspacePath:t,githubUrl:n,tokenMode:r,selectedGithubToken:a,newGithubToken:i,availableTokens:o,loadingTokens:l,tokenLoadError:c,isCreating:d,onWorkspacePathChange:u,onGithubUrlChange:p,onTokenModeChange:h,onSelectedGithubTokenChange:m,onNewGithubTokenChange:g,onAdvanceToConfirm:b}){const{t:x}=Re(),y=FE(e,n);return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:x(e==="existing"?"projectWizard.step2.existingPath":"projectWizard.step2.newPath")}),s.jsx(OP,{workspaceType:e,value:t,disabled:d,onChange:u,onAdvanceToConfirm:b}),s.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:x(e==="existing"?"projectWizard.step2.existingHelp":"projectWizard.step2.newHelp")})]}),e==="new"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300",children:x("projectWizard.step2.githubUrl")}),s.jsx(Nt,{type:"text",value:n,onChange:v=>p(v.target.value),placeholder:"https://github.com/username/repository",className:"w-full",disabled:d}),s.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:x("projectWizard.step2.githubHelp")})]}),y&&s.jsx(TP,{tokenMode:r,selectedGithubToken:a,newGithubToken:i,availableTokens:o,loadingTokens:l,tokenLoadError:c,onTokenModeChange:h,onSelectedGithubTokenChange:m,onNewGithubTokenChange:g})]})]})}function MP({formState:e,selectedTokenName:t,isCreating:n,cloneProgress:r}){const{t:a}=Re(),i=f.useMemo(()=>e.tokenMode==="stored"&&e.selectedGithubToken?`${a("projectWizard.step3.usingStoredToken")} ${t||"Unknown"}`:e.tokenMode==="new"&&e.newGithubToken.trim()?a("projectWizard.step3.usingProvidedToken"):PE(e.githubUrl)?a("projectWizard.step3.sshKey",{defaultValue:"SSH Key"}):a("projectWizard.step3.noAuthentication"),[e,t,a]);return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900/50",children:[s.jsx("h4",{className:"mb-3 text-sm font-semibold text-gray-900 dark:text-white",children:a("projectWizard.step3.reviewConfig")}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a("projectWizard.step3.workspaceType")}),s.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:e.workspaceType==="existing"?a("projectWizard.step3.existingWorkspace"):a("projectWizard.step3.newWorkspace")})]}),s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a("projectWizard.step3.path")}),s.jsx("span",{className:"break-all font-mono text-xs text-gray-900 dark:text-white",children:e.workspacePath})]}),e.workspaceType==="new"&&e.githubUrl&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a("projectWizard.step3.cloneFrom")}),s.jsx("span",{className:"break-all font-mono text-xs text-gray-900 dark:text-white",children:e.githubUrl})]}),s.jsxs("div",{className:"flex justify-between text-sm",children:[s.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:a("projectWizard.step3.authentication")}),s.jsx("span",{className:"text-xs text-gray-900 dark:text-white",children:i})]})]})]})]}),s.jsx("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-800 dark:bg-blue-900/20",children:n&&r?s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-sm font-medium text-blue-800 dark:text-blue-200",children:a("projectWizard.step3.cloningRepository",{defaultValue:"Cloning repository..."})}),s.jsx("code",{className:"block whitespace-pre-wrap break-all font-mono text-xs text-blue-700 dark:text-blue-300",children:r})]}):s.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:e.workspaceType==="existing"?a("projectWizard.step3.existingInfo"):e.githubUrl?a("projectWizard.step3.newWithClone"):a("projectWizard.step3.newEmpty")})})]})}function PP({workspaceType:e,onWorkspaceTypeChange:t}){const{t:n}=Re();return s.jsxs("div",{className:"space-y-4",children:[s.jsx("h4",{className:"mb-3 text-sm font-medium text-gray-700 dark:text-gray-300",children:n("projectWizard.step1.question")}),s.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[s.jsx("button",{onClick:()=>t("existing"),className:`rounded-lg border-2 p-4 text-left transition-all ${e==="existing"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 hover:border-gray-300 dark:border-gray-700 dark:hover:border-gray-600"}`,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg bg-green-100 dark:bg-green-900/50",children:s.jsx(yi,{className:"h-5 w-5 text-green-600 dark:text-green-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h5",{className:"mb-1 font-semibold text-gray-900 dark:text-white",children:n("projectWizard.step1.existing.title")}),s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:n("projectWizard.step1.existing.description")})]})]})}),s.jsx("button",{onClick:()=>t("new"),className:`rounded-lg border-2 p-4 text-left transition-all ${e==="new"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 hover:border-gray-300 dark:border-gray-700 dark:hover:border-gray-600"}`,children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-lg bg-purple-100 dark:bg-purple-900/50",children:s.jsx(rr,{className:"h-5 w-5 text-purple-600 dark:text-purple-400"})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h5",{className:"mb-1 font-semibold text-gray-900 dark:text-white",children:n("projectWizard.step1.new.title")}),s.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:n("projectWizard.step1.new.description")})]})]})})]})]})}function FP({step:e,isCreating:t,isCloneWorkflow:n,onClose:r,onBack:a,onNext:i,onCreate:o}){const{t:l}=Re();return s.jsxs("div",{className:"flex items-center justify-between border-t border-gray-200 p-6 dark:border-gray-700",children:[s.jsx(Pe,{variant:"outline",onClick:e===1?r:a,disabled:t,children:e===1?l("projectWizard.buttons.cancel"):s.jsxs(s.Fragment,{children:[s.jsx(r0,{className:"mr-1 h-4 w-4"}),l("projectWizard.buttons.back")]})}),s.jsx(Pe,{onClick:e===3?o:i,disabled:t,children:t?s.jsxs(s.Fragment,{children:[s.jsx(fn,{className:"mr-2 h-4 w-4 animate-spin"}),n?l("projectWizard.buttons.cloning",{defaultValue:"Cloning..."}):l("projectWizard.buttons.creating")]}):e===3?s.jsxs(s.Fragment,{children:[s.jsx(Gt,{className:"mr-1 h-4 w-4"}),l("projectWizard.buttons.createProject")]}):s.jsxs(s.Fragment,{children:[l("projectWizard.buttons.next"),s.jsx(Sr,{className:"ml-1 h-4 w-4"})]})})]})}function zP({step:e}){const{t}=Re(),n=[1,2,3];return s.jsx("div",{className:"px-6 pb-2 pt-4",children:s.jsx("div",{className:"flex items-center justify-between",children:n.map(r=>s.jsxs(f.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:`flex h-8 w-8 items-center justify-center rounded-full text-sm font-medium ${r<e?"bg-green-500 text-white":r===e?"bg-blue-500 text-white":"bg-gray-200 text-gray-500 dark:bg-gray-700"}`,children:r<e?s.jsx(Gt,{className:"h-4 w-4"}):r}),s.jsx("span",{className:"hidden text-sm font-medium text-gray-700 dark:text-gray-300 sm:inline",children:t(r===1?"projectWizard.steps.type":r===2?"projectWizard.steps.configure":"projectWizard.steps.confirm")})]}),r<3&&s.jsx("div",{className:`mx-2 h-1 flex-1 rounded ${r<e?"bg-green-500":"bg-gray-200 dark:bg-gray-700"}`})]},r))})})}const BP=({shouldLoad:e,selectedTokenId:t,onAutoSelectToken:n})=>{const[r,a]=f.useState([]),[i,o]=f.useState(!1),[l,c]=f.useState(null),d=f.useRef(!1);f.useEffect(()=>{if(!e||d.current)return;let p=!1;return(async()=>{o(!0),c(null);try{const m=await AP();if(p)return;a(m),d.current=!0,m.length>0&&!t&&n(String(m[0].id))}catch(m){p||c(m instanceof Error?m.message:"Failed to load GitHub tokens")}finally{p||o(!1)}})(),()=>{p=!0}},[n,t,e]);const u=f.useMemo(()=>r.find(p=>String(p.id)===t)?.credential_name||null,[t,r]);return{tokens:r,loading:i,loadError:l,selectedTokenName:u}},$P={workspaceType:"existing",workspacePath:"",githubUrl:"",tokenMode:"stored",selectedGithubToken:"",newGithubToken:""};function UP({onClose:e,onProjectCreated:t}){const{t:n}=Re(),[r,a]=f.useState(1),[i,o]=f.useState($P),[l,c]=f.useState(!1),[d,u]=f.useState(null),[p,h]=f.useState(""),m=r===2&&FE(i.workspaceType,i.githubUrl),g=f.useCallback(I=>{o(O=>({...O,selectedGithubToken:I}))},[]),{tokens:b,loading:x,loadError:y,selectedTokenName:v}=BP({shouldLoad:m,selectedTokenId:i.selectedGithubToken,onAutoSelectToken:g}),w=f.useCallback((I,O)=>{o(A=>({...A,[I]:O}))},[]),S=f.useCallback(I=>w("workspaceType",I),[w]),E=f.useCallback(I=>w("tokenMode",I),[w]),k=f.useCallback(()=>{if(u(null),r===1){if(!i.workspaceType){u(n("projectWizard.errors.selectType"));return}a(2);return}if(r===2){if(!i.workspacePath.trim()){u(n("projectWizard.errors.providePath"));return}a(3)}},[i.workspacePath,i.workspaceType,r,n]),T=f.useCallback(()=>{u(null),a(I=>I>1?I-1:I)},[]),_=f.useCallback(async()=>{c(!0),u(null),h("");try{if(aw(i.workspaceType,i.githubUrl)){const A=await RP({workspacePath:i.workspacePath,githubUrl:i.githubUrl,tokenMode:i.tokenMode,selectedGithubToken:i.selectedGithubToken,newGithubToken:i.newGithubToken},{onProgress:h});t?.(A),e();return}const O=await IP({workspaceType:i.workspaceType,path:i.workspacePath.trim()});t?.(O),e()}catch(I){const O=I instanceof Error?I.message:n("projectWizard.errors.failedToCreate");u(O)}finally{c(!1)}},[i,e,t,n]),C=f.useMemo(()=>aw(i.workspaceType,i.githubUrl),[i.githubUrl,i.workspaceType]);return s.jsx("div",{className:"fixed bottom-0 left-0 right-0 top-0 z-[60] flex items-center justify-center bg-black/50 p-0 backdrop-blur-sm sm:p-4",children:s.jsxs("div",{className:"h-full w-full overflow-y-auto rounded-none border-0 border-gray-200 bg-white shadow-xl dark:border-gray-700 dark:bg-gray-800 sm:h-auto sm:max-w-2xl sm:rounded-lg sm:border",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 p-6 dark:border-gray-700",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-blue-100 dark:bg-blue-900/50",children:s.jsx(yi,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"})}),s.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:n("projectWizard.title")})]}),s.jsx("button",{onClick:e,className:"rounded-md p-2 text-gray-400 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-700 dark:hover:text-gray-300",disabled:l,children:s.jsx(bt,{className:"h-5 w-5"})})]}),s.jsx(zP,{step:r}),s.jsxs("div",{className:"min-h-[300px] space-y-6 p-6",children:[d&&s.jsx(wP,{message:d}),r===1&&s.jsx(PP,{workspaceType:i.workspaceType,onWorkspaceTypeChange:S}),r===2&&s.jsx(LP,{workspaceType:i.workspaceType,workspacePath:i.workspacePath,githubUrl:i.githubUrl,tokenMode:i.tokenMode,selectedGithubToken:i.selectedGithubToken,newGithubToken:i.newGithubToken,availableTokens:b,loadingTokens:x,tokenLoadError:y,isCreating:l,onWorkspacePathChange:I=>w("workspacePath",I),onGithubUrlChange:I=>w("githubUrl",I),onTokenModeChange:E,onSelectedGithubTokenChange:I=>w("selectedGithubToken",I),onNewGithubTokenChange:I=>w("newGithubToken",I),onAdvanceToConfirm:()=>a(3)}),r===3&&s.jsx(MP,{formState:i,selectedTokenName:v,isCreating:l,cloneProgress:p})]}),s.jsx(FP,{step:r,isCreating:l,isCloneWorkflow:C,onClose:e,onBack:T,onNext:k,onCreate:_})]})})}const GP=bP;function HP(e){return s.jsx(GP,{...e})}function qP({projects:e,showSettings:t,settingsInitialTab:n,onCloseSettings:r,showNewProject:a,onCloseNewProject:i,onProjectCreated:o,deleteConfirmation:l,onCancelDeleteProject:c,onConfirmDeleteProject:d,sessionDeleteConfirmation:u,onCancelDeleteSession:p,onConfirmDeleteSession:h,showVersionModal:m,onCloseVersionModal:g,releaseInfo:b,currentVersion:x,latestVersion:y,installMode:v,t:w}){const S=f.useMemo(()=>e.map(j9),[e]);return s.jsxs(s.Fragment,{children:[a&&hl.createPortal(s.jsx(UP,{onClose:i,onProjectCreated:o}),document.body),t&&hl.createPortal(s.jsx(HP,{isOpen:t,onClose:r,projects:S,initialTab:n}),document.body),l&&hl.createPortal(s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:s.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-xl border border-border bg-card shadow-2xl",children:[s.jsx("div",{className:"p-6",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-orange-100 dark:bg-orange-900/30",children:s.jsx(Er,{className:"h-6 w-6 text-orange-600 dark:text-orange-400"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"mb-2 text-lg font-semibold text-foreground",children:w("deleteConfirmation.deleteProject")}),s.jsxs("p",{className:"mb-1 text-sm text-muted-foreground",children:[w("deleteConfirmation.confirmDelete")," ",s.jsx("span",{className:"font-medium text-foreground",children:l.project.displayName||l.project.name}),"?"]}),l.sessionCount>0&&s.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:w("deleteConfirmation.sessionCount",{count:l.sessionCount})})]})]})}),s.jsxs("div",{className:"flex flex-col gap-2 border-t border-border bg-muted/30 p-4",children:[s.jsxs(Pe,{variant:"outline",className:"w-full justify-start",onClick:()=>d(!1),children:[s.jsx(s0,{className:"mr-2 h-4 w-4"}),w("deleteConfirmation.removeFromSidebar")]}),s.jsxs(Pe,{variant:"destructive",className:"w-full justify-start bg-red-600 text-white hover:bg-red-700",onClick:()=>d(!0),children:[s.jsx(gn,{className:"mr-2 h-4 w-4"}),w("deleteConfirmation.deleteAllData")]}),s.jsx(Pe,{variant:"ghost",className:"w-full",onClick:c,children:w("actions.cancel")})]})]})}),document.body),u&&hl.createPortal(s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:s.jsxs("div",{className:"w-full max-w-md overflow-hidden rounded-xl border border-border bg-card shadow-2xl",children:[s.jsx("div",{className:"p-6",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30",children:s.jsx(Er,{className:"h-6 w-6 text-red-600 dark:text-red-400"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"mb-2 text-lg font-semibold text-foreground",children:w("deleteConfirmation.deleteSession")}),s.jsxs("p",{className:"mb-1 text-sm text-muted-foreground",children:[w("deleteConfirmation.confirmDelete")," ",s.jsx("span",{className:"font-medium text-foreground",children:u.sessionTitle||w("sessions.unnamed")}),"?"]}),s.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:w("deleteConfirmation.cannotUndo")})]})]})}),s.jsxs("div",{className:"flex gap-3 border-t border-border bg-muted/30 p-4",children:[s.jsx(Pe,{variant:"outline",className:"flex-1",onClick:p,children:w("actions.cancel")}),s.jsxs(Pe,{variant:"destructive",className:"flex-1 bg-red-600 text-white hover:bg-red-700",onClick:h,children:[s.jsx(gn,{className:"mr-2 h-4 w-4"}),w("actions.delete")]})]})]})}),document.body),s.jsx(yP,{isOpen:m,onClose:g,releaseInfo:b,currentVersion:x,latestVersion:y,installMode:v})]})}function iw({projects:e,selectedProject:t,selectedSession:n,onProjectSelect:r,onSessionSelect:a,onNewSession:i,onQuickStartSession:o,onSessionDelete:l,onProjectDelete:c,isLoading:d,loadingProgress:u,onRefresh:p,onShowSettings:h,showSettings:m,settingsInitialTab:g,onCloseSettings:b,isMobile:x}){const{t:y}=Re(["sidebar","common"]),{isPWA:v}=m0({trackMobile:!1}),{updateAvailable:w,latestVersion:S,currentVersion:E,releaseInfo:k,installMode:T}=_5("alicomert","pixcode"),{preferences:_,setPreference:C}=h0(),{sidebarVisible:I,historyView:O}=_,{setCurrentProject:A,mcpServerStatus:R}=As(),{tasksEnabled:N}=Jc(),{isSidebarCollapsed:F,expandedProjects:K,editingProject:B,showNewProject:W,editingName:H,loadingSessions:L,initialSessionsLoaded:G,currentTime:U,isRefreshing:M,editingSession:J,editingSessionName:te,searchFilter:de,searchMode:ue,setSearchMode:se,conversationResults:he,isSearching:Te,searchProgress:Ae,clearConversationResults:De,deletingProjects:Ue,deleteConfirmation:P,sessionDeleteConfirmation:pe,showVersionModal:le,filteredProjects:Y,toggleProject:q,handleSessionClick:re,toggleStarProject:be,isProjectStarred:fe,toggleStarSession:ae,isSessionStarred:ye,getProjectSessions:ee,startEditing:ne,cancelEditing:Z,saveProjectName:oe,showDeleteSessionConfirmation:xe,confirmDeleteSession:Le,requestProjectDelete:Be,confirmDeleteProject:ot,loadMoreSessions:ht,handleProjectSelect:Ve,refreshProjects:ct,updateSessionSummary:At,collapseSidebar:Ze,expandSidebar:Rt,setShowNewProject:xt,setEditingName:$n,setEditingSession:Un,setEditingSessionName:Ht,setSearchFilter:un,setDeleteConfirmation:je,setSessionDeleteConfirmation:nt,setShowVersionModal:Je}=R9({projects:e,selectedProject:t,selectedSession:n,isLoading:d,isMobile:x,t:y,onRefresh:p,onProjectSelect:r,onSessionSelect:a,onSessionDelete:l,onProjectDelete:c,setCurrentProject:A,setSidebarVisible:ft=>C("sidebarVisible",ft),sidebarVisible:I});f.useEffect(()=>{typeof document>"u"||(document.documentElement.classList.toggle("pwa-mode",v),document.body.classList.toggle("pwa-mode",v))},[v]);const pt=()=>{if(window.refreshProjects){window.refreshProjects();return}window.location.reload()},yt=(ft,me)=>{Un(ft),Ht(me)},_t=()=>{Un(null),Ht("")},ir=(ft,me,ve,ke)=>{At(ft,me,ve,ke)},sr={projects:e,filteredProjects:Y,selectedProject:t,selectedSession:n,isLoading:d,loadingProgress:u,expandedProjects:K,editingProject:B,editingName:H,loadingSessions:L,initialSessionsLoaded:G,currentTime:U,editingSession:J,editingSessionName:te,deletingProjects:Ue,tasksEnabled:N,mcpServerStatus:R,getProjectSessions:ee,isProjectStarred:fe,isSessionStarred:ye,onEditingNameChange:$n,onToggleProject:q,onProjectSelect:Ve,onToggleStarProject:be,onToggleStarSession:ae,onStartEditingProject:ne,onCancelEditingProject:Z,onSaveProjectName:ft=>{oe(ft)},onDeleteProject:Be,onSessionSelect:re,onDeleteSession:xe,onLoadMoreSessions:ft=>{ht(ft)},onNewSession:i,onEditingSessionNameChange:Ht,onStartEditingSession:yt,onCancelEditingSession:_t,onSaveEditingSession:ir,t:y},or={projects:e,filteredProjects:Y,selectedSession:n,isLoading:d,loadingProgress:u,currentTime:U,editingSession:J,editingSessionName:te,getProjectSessions:ee,isSessionStarred:ye,onEditingSessionNameChange:Ht,onStartEditingSession:yt,onCancelEditingSession:_t,onSaveEditingSession:ir,onToggleStarSession:ae,onProjectSelect:Ve,onSessionSelect:re,onDeleteSession:xe,t:y};return s.jsxs(s.Fragment,{children:[s.jsx(qP,{projects:e,showSettings:m,settingsInitialTab:g,onCloseSettings:b,showNewProject:W,onCloseNewProject:()=>xt(!1),onProjectCreated:pt,deleteConfirmation:P,onCancelDeleteProject:()=>je(null),onConfirmDeleteProject:ot,sessionDeleteConfirmation:pe,onCancelDeleteSession:()=>nt(null),onConfirmDeleteSession:Le,showVersionModal:le,onCloseVersionModal:()=>Je(!1),releaseInfo:k,currentVersion:E,latestVersion:S,installMode:T,t:y}),F?s.jsx(M9,{onExpand:Rt,onShowSettings:h,updateAvailable:w,onShowVersionModal:()=>Je(!0),t:y}):s.jsx(s.Fragment,{children:s.jsx(EL,{isPWA:v,isMobile:x,isLoading:d,projects:e,searchFilter:de,onSearchFilterChange:un,onClearSearchFilter:()=>un(""),searchMode:ue,onSearchModeChange:ft=>{se(ft),ft==="projects"&&De()},conversationResults:he,isSearching:Te,searchProgress:Ae,onConversationResultClick:(ft,me,ve,ke,_e)=>{const qe=ve||"claude",dt=e.find(Kr=>Kr.name===ft),Xe={__searchTargetTimestamp:ke||null,__searchTargetSnippet:_e||null},Kt={id:me,__provider:qe,__projectName:ft,...Xe};if(dt){Ve(dt);const ba=ee(dt).find(Cr=>Cr.id===me);re(ba?{...ba,...Xe}:Kt,ft)}else re(Kt,ft)},onRefresh:()=>{ct()},isRefreshing:M,onCreateProject:()=>xt(!0),onQuickStartSession:o,onCollapseSidebar:Ze,updateAvailable:w,releaseInfo:k,latestVersion:S,currentVersion:E,onShowVersionModal:()=>Je(!0),onShowSettings:h,projectListProps:sr,flatListProps:or,historyView:O,onHistoryViewChange:ft=>C("historyView",ft),t:y})})]})}const BE=f.createContext(null);function VP(){return f.useContext(BE)}const om="quickSettingsHandlePosition",ho=50,WP=10,KP=90,YP=5,$E="flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",ZP=`${$E} cursor-pointer`,XP="h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600",JP=[{key:"autoExpandTools",labelKey:"quickSettings.autoExpandTools",icon:a0},{key:"showRawParameters",labelKey:"quickSettings.showRawParameters",icon:Ti},{key:"showThinking",labelKey:"quickSettings.showThinking",icon:u0}],QP=[{key:"autoScrollToBottom",labelKey:"quickSettings.autoScrollToBottom",icon:t0}],eF=[{key:"sendByCtrlEnter",labelKey:"quickSettings.sendByCtrlEnter",icon:d5}],UE=e=>Math.max(WP,Math.min(KP,e)),tF=()=>{if(typeof window>"u")return ho;const e=localStorage.getItem(om);if(!e)return ho;try{const t=JSON.parse(e);if(typeof t.y=="number"&&Number.isFinite(t.y))return UE(t.y)}catch{return localStorage.removeItem(om),ho}return ho},sw=e=>e.type.includes("touch"),ow=e=>"touches"in e?e.touches[0]?.clientY??null:"clientY"in e&&typeof e.clientY=="number"?e.clientY:null;function nF({isMobile:e}){const[t,n]=f.useState(tF),[r,a]=f.useState(!1),[i,o]=f.useState(!1),l=f.useRef(null),c=f.useRef(ho),d=f.useRef(!1),u=f.useRef(!1),p=f.useRef(!1),h=f.useCallback(()=>{p.current&&(document.body.style.cursor="",document.body.style.userSelect="",document.body.style.overflow="",document.body.style.position="",document.body.style.width="",p.current=!1)},[]),m=f.useCallback(w=>{p.current||(document.body.style.cursor="grabbing",document.body.style.userSelect="none",w&&(document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%"),p.current=!0)},[]),g=f.useCallback(()=>{!r&&l.current===null||(u.current=d.current,d.current=!1,l.current=null,a(!1),o(!1),h())},[h,r]),b=f.useCallback(w=>{if(!r||l.current===null)return;const S=ow(w);if(S===null)return;const E=S-l.current,k=Math.abs(E)>YP;if(!d.current&&k&&(d.current=!0,o(!0),m(sw(w))),!d.current)return;sw(w)&&w.preventDefault();const T=Math.max(window.innerHeight,1),_=E/T*100,C=e?-_:_;n(UE(c.current+C))},[m,e,r]),x=f.useCallback(w=>{w.stopPropagation();const S=ow(w);S!==null&&(l.current=S,c.current=t,d.current=!1,o(!1),a(!0))},[t]);f.useEffect(()=>{localStorage.setItem(om,JSON.stringify({y:t}))},[t]),f.useEffect(()=>{if(!r)return;const w=T=>{b(T)},S=()=>{g()},E=T=>{b(T)},k=()=>{g()};return document.addEventListener("mousemove",w),document.addEventListener("mouseup",S),document.addEventListener("touchmove",E,{passive:!1}),document.addEventListener("touchend",k),()=>{document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",S),document.removeEventListener("touchmove",E),document.removeEventListener("touchend",k)}},[g,b,r]),f.useEffect(()=>()=>{h()},[h]);const y=f.useCallback(()=>u.current?(u.current=!1,!0):!1,[]),v=f.useMemo(()=>!e||typeof window>"u"?{top:`${t}%`,transform:"translateY(-50%)"}:{bottom:`${window.innerHeight*t/100}px`},[t,e]);return{isDragging:i,handleStyle:v,startDrag:x,endDrag:g,consumeSuppressedClick:y}}function kl({title:e,children:t,className:n=""}){return s.jsxs("div",{className:`space-y-2 ${n}`,children:[s.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400",children:e}),t]})}function rF({label:e,icon:t,checked:n,onCheckedChange:r}){return s.jsxs("label",{className:ZP,children:[s.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[s.jsx(t,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),e]}),s.jsx("input",{type:"checkbox",checked:n,onChange:a=>r(a.target.checked),className:XP})]})}const aF=f.memo(rF);function iF({isDarkMode:e,preferences:t,onPreferenceChange:n}){const{t:r}=Re("settings"),a=i=>i.map(({key:o,labelKey:l,icon:c})=>s.jsx(aF,{label:r(l),icon:c,checked:t[o],onCheckedChange:d=>n(o,d)},o));return s.jsxs("div",{className:"flex-1 space-y-6 overflow-y-auto overflow-x-hidden bg-background p-4",children:[s.jsxs(kl,{title:r("quickSettings.sections.appearance"),children:[s.jsxs("div",{className:$E,children:[s.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[e?s.jsx(l0,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}):s.jsx(c0,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),r("quickSettings.darkMode")]}),s.jsx(Up,{})]}),s.jsx(jE,{compact:!0})]}),s.jsx(kl,{title:r("quickSettings.sections.toolDisplay"),children:a(JP)}),s.jsx(kl,{title:r("quickSettings.sections.viewOptions"),children:a(QP)}),s.jsxs(kl,{title:r("quickSettings.sections.inputSettings"),children:[a(eF),s.jsx("p",{className:"ml-3 text-xs text-gray-500 dark:text-gray-400",children:r("quickSettings.sendByCtrlEnterDescription")})]})]})}function sF({isOpen:e,isDragging:t,style:n,onClick:r,onMouseDown:a,onTouchStart:i}){const{t:o}=Re("settings"),l=e?"right-64":"right-0",c=t?"border-blue-500 dark:border-blue-400":"border-gray-200 dark:border-gray-700",d=t?"":"transition-all duration-150 ease-out",u=t?"cursor-grabbing":"cursor-pointer",p=o(t?"quickSettings.dragHandle.dragging":e?"quickSettings.dragHandle.closePanel":"quickSettings.dragHandle.openPanel"),h=o(t?"quickSettings.dragHandle.draggingStatus":"quickSettings.dragHandle.toggleAndMove");return s.jsx("button",{type:"button",onClick:r,onMouseDown:a,onTouchStart:i,className:`fixed ${l} z-50 ${d} border bg-white dark:bg-gray-800 ${c} rounded-l-md p-2 shadow-lg transition-colors hover:bg-gray-100 dark:hover:bg-gray-700 ${u} touch-none`,style:{...n,touchAction:"none",WebkitTouchCallout:"none",WebkitUserSelect:"none"},"aria-label":p,title:h,children:t?s.jsx($j,{className:"h-5 w-5 text-blue-500 dark:text-blue-400"}):e?s.jsx(Sr,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):s.jsx(r0,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})})}function oF(){const{t:e}=Re("settings");return s.jsx("div",{className:"border-b border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-900",children:s.jsxs("h3",{className:"flex items-center gap-2 text-lg font-semibold text-gray-900 dark:text-white",children:[s.jsx(Ij,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),e("quickSettings.title")]})})}function lF(){const[e,t]=f.useState(!1),{isMobile:n}=m0({trackPWA:!1}),{isDarkMode:r}=qa(),{preferences:a,setPreference:i}=h0(),{isDragging:o,handleStyle:l,startDrag:c,consumeSuppressedClick:d}=nF({isMobile:n}),u=f.useMemo(()=>({autoExpandTools:a.autoExpandTools,showRawParameters:a.showRawParameters,showThinking:a.showThinking,autoScrollToBottom:a.autoScrollToBottom,sendByCtrlEnter:a.sendByCtrlEnter}),[a.autoExpandTools,a.autoScrollToBottom,a.sendByCtrlEnter,a.showRawParameters,a.showThinking]),p=f.useCallback((m,g)=>{i(m,g)},[i]),h=f.useCallback(m=>{if(d()){m.preventDefault();return}t(g=>!g)},[d]);return s.jsxs(s.Fragment,{children:[s.jsx(sF,{isOpen:e,isDragging:o,style:l,onClick:h,onMouseDown:c,onTouchStart:c}),s.jsx("div",{className:`fixed right-0 top-0 z-40 h-full w-64 transform border-l border-border bg-background shadow-xl transition-transform duration-150 ease-out ${e?"translate-x-0":"translate-x-full"} ${n?"h-screen":""}`,children:s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsx(oF,{}),s.jsx(iF,{isDarkMode:r,preferences:u,onPreferenceChange:p})]})}),e&&s.jsx("div",{className:"fixed inset-0 z-30 bg-background/80 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:()=>t(!1)})]})}const GE={OPTIONS:[{value:"sonnet",label:"Sonnet"},{value:"opus",label:"Opus"},{value:"haiku",label:"Haiku"},{value:"claude-opus-4-6",label:"Opus 4.6"},{value:"opusplan",label:"Opus Plan"},{value:"sonnet[1m]",label:"Sonnet [1M]"},{value:"opus[1m]",label:"Opus [1M]"}],DEFAULT:"opus"},HE={OPTIONS:[{value:"opus-4.6-thinking",label:"Claude 4.6 Opus (Thinking)"},{value:"gpt-5.3-codex",label:"GPT-5.3"},{value:"gpt-5.2-high",label:"GPT-5.2 High"},{value:"gemini-3-pro",label:"Gemini 3 Pro"},{value:"opus-4.5-thinking",label:"Claude 4.5 Opus (Thinking)"},{value:"gpt-5.2",label:"GPT-5.2"},{value:"gpt-5.1",label:"GPT-5.1"},{value:"gpt-5.1-high",label:"GPT-5.1 High"},{value:"composer-1",label:"Composer 1"},{value:"auto",label:"Auto"},{value:"sonnet-4.5",label:"Claude 4.5 Sonnet"},{value:"sonnet-4.5-thinking",label:"Claude 4.5 Sonnet (Thinking)"},{value:"opus-4.5",label:"Claude 4.5 Opus"},{value:"gpt-5.1-codex",label:"GPT-5.1 Codex"},{value:"gpt-5.1-codex-high",label:"GPT-5.1 Codex High"},{value:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max"},{value:"gpt-5.1-codex-max-high",label:"GPT-5.1 Codex Max High"},{value:"opus-4.1",label:"Claude 4.1 Opus"},{value:"grok",label:"Grok"}],DEFAULT:"gpt-5-3-codex"},qE={OPTIONS:[{value:"gpt-5.4",label:"GPT-5.4"},{value:"gpt-5.4-mini",label:"GPT-5.4 mini"},{value:"gpt-5.3-codex",label:"GPT-5.3 Codex"},{value:"gpt-5.2-codex",label:"GPT-5.2 Codex"},{value:"gpt-5.2",label:"GPT-5.2"},{value:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max"},{value:"o3",label:"O3"},{value:"o4-mini",label:"O4-mini"}],DEFAULT:"gpt-5.4"},VE={OPTIONS:[{value:"qwen3-coder-plus",label:"Qwen3 Coder Plus"},{value:"qwen3-coder-next",label:"Qwen3 Coder Next"},{value:"qwen3-coder-480B-A35B-instruct",label:"Qwen3 Coder 480B (Instruct)"},{value:"qwen3-coder-30B-A3B",label:"Qwen3 Coder 30B"},{value:"qwen3.5-plus",label:"Qwen3.5 Plus"},{value:"qwen3-max",label:"Qwen3 Max"},{value:"glm-4.7",label:"GLM-4.7 (Alibaba Coding Plan)"},{value:"kimi-k2.5",label:"Kimi K2.5 (Alibaba Coding Plan)"}],DEFAULT:"qwen3-coder-plus"},WE={OPTIONS:[{value:"opencode/zen-best",label:"OpenCode Zen (Best)"},{value:"opencode/zen-fast",label:"OpenCode Zen (Fast)"},{value:"anthropic/claude-sonnet-4-6",label:"Claude Sonnet 4.6 (Anthropic)"},{value:"anthropic/claude-opus-4-6",label:"Claude Opus 4.6 (Anthropic)"},{value:"openai/gpt-5.4",label:"GPT-5.4 (OpenAI)"},{value:"google/gemini-3-pro-preview",label:"Gemini 3 Pro (Google)"}],DEFAULT:"opencode/zen-best"},KE={OPTIONS:[{value:"gemini-3.1-pro-preview",label:"Gemini 3.1 Pro Preview"},{value:"gemini-3-pro-preview",label:"Gemini 3 Pro Preview"},{value:"gemini-3-flash-preview",label:"Gemini 3 Flash Preview"},{value:"gemini-2.5-flash",label:"Gemini 2.5 Flash"},{value:"gemini-2.5-pro",label:"Gemini 2.5 Pro"},{value:"gemini-2.0-flash-lite",label:"Gemini 2.0 Flash Lite"},{value:"gemini-2.0-flash",label:"Gemini 2.0 Flash"},{value:"gemini-2.0-pro-exp",label:"Gemini 2.0 Pro Experimental"},{value:"gemini-2.0-flash-thinking-exp",label:"Gemini 2.0 Flash Thinking"}],DEFAULT:"gemini-3.1-pro-preview"};function cF({selectedSession:e}){const[t,n]=f.useState("default"),[r,a]=f.useState([]),[i,o]=f.useState(()=>localStorage.getItem("selected-provider")||"claude"),[l,c]=f.useState(()=>localStorage.getItem("cursor-model")||HE.DEFAULT),[d,u]=f.useState(()=>localStorage.getItem("claude-model")||GE.DEFAULT),[p,h]=f.useState(()=>localStorage.getItem("codex-model")||qE.DEFAULT),[m,g]=f.useState(()=>localStorage.getItem("gemini-model")||KE.DEFAULT),[b,x]=f.useState(()=>localStorage.getItem("qwen-model")||VE.DEFAULT),[y,v]=f.useState(()=>localStorage.getItem("opencode-model")||WE.DEFAULT),w=f.useRef(i);f.useEffect(()=>{if(!e?.id)return;const E=localStorage.getItem(`permissionMode-${e.id}`);n(E||"default")},[e?.id]),f.useEffect(()=>{!e?.__provider||e.__provider===i||(o(e.__provider),localStorage.setItem("selected-provider",e.__provider))},[i,e]),f.useEffect(()=>{w.current!==i&&(a([]),w.current=i)},[i]),f.useEffect(()=>{a(E=>E.filter(k=>!k.sessionId||k.sessionId===e?.id))},[e?.id]),f.useEffect(()=>{i==="cursor"&&we("/api/cursor/config").then(E=>E.json()).then(E=>{if(!E.success||!E.config?.model?.modelId)return;const k=E.config.model.modelId;localStorage.getItem("cursor-model")||c(k)}).catch(E=>{console.error("Error loading Cursor config:",E)})},[i]);const S=f.useCallback(()=>{const E=i==="codex"?["default","acceptEdits","bypassPermissions"]:["default","acceptEdits","bypassPermissions","plan"],T=(E.indexOf(t)+1)%E.length,_=E[T];n(_),e?.id&&localStorage.setItem(`permissionMode-${e.id}`,_)},[t,i,e?.id]);return{provider:i,setProvider:o,cursorModel:l,setCursorModel:c,claudeModel:d,setClaudeModel:u,codexModel:p,setCodexModel:h,geminiModel:m,setGeminiModel:g,qwenModel:b,setQwenModel:x,opencodeModel:y,setOpencodeModel:v,permissionMode:t,setPermissionMode:n,pendingPermissionRequests:r,setPendingPermissionRequests:a,cyclePermissionMode:S}}const dF=(e,t)=>{const n=e.split(`
|
|
320
320
|
`),r=t.split(`
|
|
321
321
|
`),a=Array.from({length:n.length+1},()=>new Array(r.length+1).fill(0));for(let c=n.length-1;c>=0;c-=1)for(let d=r.length-1;d>=0;d-=1)n[c]===r[d]?a[c][d]=a[c+1][d+1]+1:a[c][d]=Math.max(a[c+1][d],a[c][d+1]);const i=[];let o=0,l=0;for(;o<n.length&&l<r.length;){const c=n[o],d=r[l];if(c===d){o+=1,l+=1;continue}if(a[o+1][l]>=a[o][l+1]){i.push({type:"removed",content:c,lineNum:o+1}),o+=1;continue}i.push({type:"added",content:d,lineNum:l+1}),l+=1}for(;o<n.length;)i.push({type:"removed",content:n[o],lineNum:o+1}),o+=1;for(;l<r.length;)i.push({type:"added",content:r[l],lineNum:l+1}),l+=1;return i},uF=()=>{const e=new Map;return(t,n)=>{const r=JSON.stringify([t,n]),a=e.get(r);if(a)return a;const i=dF(t,n);if(e.set(r,i),e.size>100){const o=e.keys().next().value;o&&e.delete(o)}return i}};function lw(e){return e&&e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function pF(e){if(!e||typeof e!="string")return e;try{return e.replace(/```\s*([^\n\r]+?)\s*```/g,"`$1`")}catch{return e}}function Iu(e){if(!e||typeof e!="string")return e;const t=[],n="__MATH_BLOCK_",r="__";let a=e.replace(/\$\$([\s\S]*?)\$\$|\$([^\$\n]+?)\$/g,i=>{const o=t.length;return t.push(i),`${n}${o}${r}`});return a=a.replace(/\\n/g,`
|
|
322
|
-
`).replace(/\\t/g," ").replace(/\\r/g,"\r"),a=a.replace(new RegExp(`${n}(\\d+)${r}`,"g"),(i,o)=>t[parseInt(o,10)]),a}function YE(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ZE(e){try{return typeof e!="string"?e:e.replace(/Claude AI usage limit reached\|(\d{10,13})/g,(t,n)=>{let r=parseInt(n,10);if(!Number.isFinite(r))return t;r<1e12&&(r*=1e3);const a=new Date(r),i=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(a),o=-a.getTimezoneOffset(),l=o>=0?"+":"-",c=Math.abs(o),d=Math.floor(c/60),u=c%60,p=`GMT${l}${d}${u?":"+String(u).padStart(2,"0"):""}`,g=((Intl.DateTimeFormat().resolvedOptions().timeZone||"").split("/").pop()||"").replace(/_/g," ").toLowerCase().replace(/\b\w/g,v=>v.toUpperCase()),b=g?`${p} (${g})`:p,x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],y=`${a.getDate()} ${x[a.getMonth()]} ${a.getFullYear()}`;return`Claude usage limit reached. Your limit will reset at **${i} ${b}** - ${y}`})}catch{return e}}function mF(e){const t=[],n=new Map;for(const r of e)r.kind==="tool_result"&&r.toolId&&n.set(r.toolId,r);for(const r of e)switch(r.kind){case"text":{const a=r.content||"";if(!a.trim())continue;if(r.role==="user"){const o=/<task-notification>\s*<task-id>[^<]*<\/task-id>\s*<output-file>[^<]*<\/output-file>\s*<status>([^<]*)<\/status>\s*<summary>([^<]*)<\/summary>\s*<\/task-notification>/g.exec(a);o?t.push({type:"assistant",content:o[2]?.trim()||"Background task finished",timestamp:r.timestamp,isTaskNotification:!0,taskStatus:o[1]?.trim()||"completed"}):t.push({type:"user",content:Iu(lw(a)),timestamp:r.timestamp})}else{let i=lw(a);i=Iu(i),i=ZE(i),t.push({type:"assistant",content:i,timestamp:r.timestamp})}break}case"tool_use":{const a=r.toolResult||(r.toolId?n.get(r.toolId):null),i=r.toolName==="Task",o=[];if(i&&r.subagentTools&&Array.isArray(r.subagentTools))for(const c of r.subagentTools)o.push({toolId:c.toolId,toolName:c.toolName,toolInput:c.toolInput,toolResult:c.toolResult||null,timestamp:new Date(c.timestamp||Date.now())});const l=a?{content:typeof a.content=="string"?a.content:JSON.stringify(a.content),isError:!!a.isError,toolUseResult:a.toolUseResult}:null;t.push({type:"assistant",content:"",timestamp:r.timestamp,isToolUse:!0,toolName:r.toolName,toolInput:typeof r.toolInput=="string"?r.toolInput:JSON.stringify(r.toolInput??"",null,2),toolId:r.toolId,toolResult:l,isSubagentContainer:i,subagentState:i?{childTools:o,currentToolIndex:o.length>0?o.length-1:-1,isComplete:!!l}:void 0});break}case"thinking":r.content?.trim()&&t.push({type:"assistant",content:Iu(r.content),timestamp:r.timestamp,isThinking:!0});break;case"error":t.push({type:"error",content:r.content||"Unknown error",timestamp:r.timestamp});break;case"interactive_prompt":t.push({type:"assistant",content:r.content||"",timestamp:r.timestamp,isInteractivePrompt:!0});break;case"task_notification":t.push({type:"assistant",content:r.summary||"Background task update",timestamp:r.timestamp,isTaskNotification:!0,taskStatus:r.status||"completed"});break;case"stream_delta":r.content&&t.push({type:"assistant",content:r.content,timestamp:r.timestamp,isStreaming:!0});break}return t}const ju=20,Sl=100;function cw(e,t,n){const r=`local_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,a=e.timestamp instanceof Date?e.timestamp.toISOString():typeof e.timestamp=="number"?new Date(e.timestamp).toISOString():String(e.timestamp),i={id:r,sessionId:t,timestamp:a,provider:n};return e.isToolUse?{...i,kind:"tool_use",toolName:e.toolName,toolInput:e.toolInput,toolId:e.toolId||r}:e.isThinking?{...i,kind:"thinking",content:e.content||""}:e.isInteractivePrompt?{...i,kind:"interactive_prompt",content:e.content||""}:e.isTaskNotification?{...i,kind:"task_notification",status:e.taskStatus||"completed",summary:e.content||""}:e.type==="error"?{...i,kind:"error",content:e.content||""}:{...i,kind:"text",role:e.type==="user"?"user":"assistant",content:e.content||""}}function hF({selectedProject:e,selectedSession:t,ws:n,sendMessage:r,autoScrollToBottom:a,externalMessageUpdate:i,processingSessions:o,resetStreamingState:l,pendingViewSessionRef:c,sessionStore:d}){const[u,p]=f.useState(!1),[h,m]=f.useState(t?.id||null),[g,b]=f.useState(!1),[x,y]=f.useState(!1),[v,w]=f.useState(!1),[S,E]=f.useState(0),[k,T]=f.useState(!1),[_,C]=f.useState(!1),[I,O]=f.useState(null),[A,R]=f.useState(Sl),[N,F]=f.useState(null),[K,B]=f.useState(!1),[W,H]=f.useState(!1),[L,G]=f.useState(!1),[U,M]=f.useState(!1),[J,te]=f.useState(0),de=f.useRef(null),[ue,se]=f.useState(null),he=f.useRef(!1);f.useRef(!1);const Te=f.useRef(!1),Ae=f.useRef(!1),De=f.useRef(!1),Ue=f.useRef(null),P=f.useRef(!0),pe=f.useRef(0),le=f.useRef({height:0,top:0}),Y=f.useRef(null),q=f.useRef(null),re=f.useRef(null),be=f.useMemo(()=>uF(),[]),fe=t?.id||h||null,[ae,ye]=f.useState(null),ee=f.useRef(e?.name??null),ne=e?.name??null;ne!==ee.current&&(ee.current=ne,!t&&ae&&ye(null),t||m(null));const Z=f.useRef(null);fe!==Z.current&&(Z.current=fe,d.setActiveSession(fe));const oe=f.useRef(null);if(fe&&fe!==oe.current&&ae){const je=localStorage.getItem("selected-provider")||"claude",nt=cw(ae,fe,je);nt&&d.appendRealtime(fe,nt),ye(null)}oe.current=fe;const xe=fe?d.getMessages(fe):[],Le=f.useRef(0);xe.length!==Le.current&&(Le.current=xe.length,J>0&&te(0));const Be=f.useMemo(()=>{const je=mF(xe);return ae&&je.length===0?[ae]:J>0&&J<je.length?je.slice(0,-J):je},[xe,J,ae]),ot=f.useCallback(je=>{if(!fe){ye(je);return}const nt=localStorage.getItem("selected-provider")||"claude",Je=cw(je,fe,nt);Je&&d.appendRealtime(fe,Je)},[fe,d]),ht=f.useCallback(()=>{fe&&d.clearRealtime(fe)},[fe,d]),Ve=f.useCallback(je=>te(je),[]),ct=f.useCallback(()=>{const je=de.current;je&&(je.scrollTop=je.scrollHeight)},[]),At=f.useCallback(()=>{ct(),K&&(R(Sl),B(!1),Ae.current=!1)},[K,ct]),Ze=f.useCallback(()=>{const je=de.current;if(!je)return!1;const{scrollTop:nt,scrollHeight:Je,clientHeight:pt}=je;return Je-nt-pt<50},[]),Rt=f.useCallback(async je=>{if(!je||Te.current||x||Ae.current||!v||!t||!e)return!1;const nt=t.__provider||"claude";if(nt==="cursor")return!1;Te.current=!0;const Je=je.scrollHeight,pt=je.scrollTop;try{const yt=await d.fetchMore(t.id,{provider:nt,projectName:e.name,projectPath:e.fullPath||e.path||"",limit:ju});return!yt||yt.serverMessages.length===0?!1:(Ue.current={height:Je,top:pt},w(yt.hasMore),E(yt.total),R(_t=>_t+ju),!0)}finally{Te.current=!1}},[v,x,e,t,d]),xt=f.useCallback(async()=>{const je=de.current;if(!je)return;const nt=Ze();if(C(!nt),!Ae.current){if(!(je.scrollTop<100)){De.current=!1;return}if(De.current){je.scrollTop>20&&(De.current=!1);return}await Rt(je)&&(De.current=!0)}},[Ze,Rt]);f.useLayoutEffect(()=>{if(!Ue.current||!de.current)return;const{height:je,top:nt}=Ue.current,Je=de.current,pt=Je.scrollHeight;Je.scrollTop=nt+Math.max(pt-je,0),Ue.current=null},[Be.length]),f.useEffect(()=>{he.current||(P.current=!0,R(Sl)),De.current=!1,Ue.current=null,C(!1)},[e?.name,t?.id]),f.useEffect(()=>{if(!(!P.current||!de.current||g)){if(Be.length===0){P.current=!1;return}P.current=!1,he.current||setTimeout(()=>ct(),200)}},[Be.length,g,ct]),f.useEffect(()=>{if(!t||!e){l(),c.current=null,F(null),T(!1),p(!1),m(null),sessionStorage.removeItem("cursorSessionId"),pe.current=0,w(!1),E(0),O(null),re.current=null;return}const je=t.__provider||localStorage.getItem("selected-provider")||"claude",nt=`${t.id}:${e.name}:${je}`;if(re.current===nt&&d.has(t.id)&&!d.isStale(t.id))return;const Je=h!==null&&h!==t.id;Je&&(l(),c.current=null,F(null),T(!1)),pe.current=0,w(!1),E(0),R(Sl),B(!1),Ae.current=!1,H(!1),G(!1),M(!1),te(0),q.current&&clearTimeout(q.current),Y.current&&clearTimeout(Y.current),Je&&(O(null),p(!1)),m(t.id),je==="cursor"&&sessionStorage.setItem("cursorSessionId",t.id),n&&r({type:"check-session-status",sessionId:t.id,provider:je}),re.current=nt,b(!0),d.fetchFromServer(t.id,{provider:t.__provider||je,projectName:e.name,projectPath:e.fullPath||e.path||"",limit:ju,offset:0}).then(pt=>{pt&&(w(pt.hasMore),E(pt.total),pt.tokenUsage&&O(pt.tokenUsage)),b(!1)}).catch(()=>{b(!1)})},[c,l,e,t?.id,r,n,d]),f.useEffect(()=>{if(!i||!t||!e)return;(async()=>{try{const nt=localStorage.getItem("selected-provider")||"claude";u||(await d.refreshFromServer(t.id,{provider:t.__provider||nt,projectName:e.name,projectPath:e.fullPath||e.path||""}),a&&Ze()&&setTimeout(()=>ct(),200))}catch(nt){console.error("Error reloading messages from external update:",nt)}})()},[a,i,Ze,ct,e,t,d,u]),f.useEffect(()=>{const je=t,nt=je?.__searchTargetSnippet,Je=je?.__searchTargetTimestamp;typeof nt=="string"&&nt&&(he.current=!0,se({snippet:nt,timestamp:typeof Je=="string"?Je:void 0}))},[t]),f.useEffect(()=>{t?.id&&(c.current=null)},[c,t?.id]),f.useEffect(()=>{if(!ue||Be.length===0||g)return;const je=ue;se(null),(async()=>{if(!Ae.current&&t&&e){const pt=t.__provider||"claude";if(pt!=="cursor")try{const yt=await d.fetchFromServer(t.id,{provider:pt,projectName:e.name,projectPath:e.fullPath||e.path||"",limit:null,offset:0});yt&&(w(!1),E(yt.total),pe.current=yt.total,R(1/0),B(!0),Ae.current=!0,await new Promise(_t=>setTimeout(_t,300)))}catch{}}R(1/0);const Je=pt=>{const yt=de.current;if(!yt)return;let _t=null;if(je.snippet){const sr=je.snippet.replace(/^\.{3}/,"").replace(/\.{3}$/,"").trim().slice(0,80).toLowerCase().trim();if(sr.length>=10){const or=yt.querySelectorAll(".chat-message");for(const ft of or)if((ft.textContent||"").toLowerCase().includes(sr)){_t=ft;break}}}if(!_t&&je.timestamp){const ir=new Date(je.timestamp).getTime(),sr=yt.querySelectorAll("[data-message-timestamp]");let or=1/0;for(const ft of sr){const me=ft.getAttribute("data-message-timestamp");if(!me)continue;const ve=Math.abs(new Date(me).getTime()-ir);ve<or&&(or=ve,_t=ft)}}_t?(_t.scrollIntoView({block:"center",behavior:"smooth"}),_t.classList.add("search-highlight-flash"),setTimeout(()=>_t?.classList.remove("search-highlight-flash"),4e3),he.current=!1):pt>0?setTimeout(()=>Je(pt-1),200):he.current=!1};setTimeout(()=>Je(15),150)})()},[Be.length,g,ue]),f.useEffect(()=>{if(!e||!t?.id||t.id.startsWith("new-session-")){O(null);return}if((t.__provider||"claude")!=="claude")return;(async()=>{try{const Je=`/api/projects/${e.name}/sessions/${t.id}/token-usage`,pt=await we(Je);pt.ok?O(await pt.json()):O(null)}catch(Je){console.error("Failed to fetch initial token usage:",Je)}})()},[e,t?.id,t?.__provider]);const $n=f.useMemo(()=>Be.length<=A?Be:Be.slice(-A),[Be,A]);f.useEffect(()=>{if(!a&&de.current){const je=de.current;le.current={height:je.scrollHeight,top:je.scrollTop}}}),f.useEffect(()=>{if(!de.current||Be.length===0||Te.current||x||Ue.current||he.current)return;if(a){_||setTimeout(()=>ct(),50);return}const je=de.current,nt=le.current.height,Je=le.current.top,yt=je.scrollHeight-nt;yt>0&&Je>0&&(je.scrollTop=Je+yt)},[a,Be.length,x,_,ct]),f.useEffect(()=>{const je=de.current;if(je)return je.addEventListener("scroll",xt),()=>je.removeEventListener("scroll",xt)},[xt]),f.useEffect(()=>{const je=t?.id||h;if(!je||!o)return;o.has(je)&&!u&&(p(!0),T(!0))},[h,u,o,t?.id]);const Un=f.useRef(!1);f.useEffect(()=>{const je=Un.current;return Un.current=x,je&&!x&&v&&(q.current&&clearTimeout(q.current),M(!0),q.current=setTimeout(()=>M(!1),2e3)),!v&&!x&&(q.current&&clearTimeout(q.current),M(!1)),()=>{q.current&&clearTimeout(q.current)}},[x,v]);const Ht=f.useCallback(async()=>{if(!t||!e||W)return;const je=t.__provider||"claude";if(je==="cursor"){R(1/0),B(!0),Ae.current=!0,G(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{G(!1),M(!1)},1e3);return}const nt=t.id;Ae.current=!0,Te.current=!0,H(!0),M(!0);const Je=de.current,pt=Je?Je.scrollHeight:0,yt=Je?Je.scrollTop:0;try{const _t=await d.fetchFromServer(nt,{provider:je,projectName:e.name,projectPath:e.fullPath||e.path||"",limit:null,offset:0});if(h!==nt)return;_t?(Je&&(Ue.current={height:pt,top:yt}),w(!1),E(_t.total),pe.current=_t.total,R(1/0),B(!0),G(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{G(!1),M(!1)},1e3)):(Ae.current=!1,M(!1))}catch(_t){console.error("Error loading all messages:",_t),Ae.current=!1,M(!1)}finally{Te.current=!1,H(!1)}},[t,e,W,h,d]),un=f.useCallback(()=>{R(je=>je+100)},[]);return{chatMessages:Be,addMessage:ot,clearMessages:ht,rewindMessages:Ve,isLoading:u,setIsLoading:p,currentSessionId:h,setCurrentSessionId:m,isLoadingSessionMessages:g,isLoadingMoreMessages:x,hasMoreMessages:v,totalMessages:S,canAbortSession:k,setCanAbortSession:T,isUserScrolledUp:_,setIsUserScrolledUp:C,tokenBudget:I,setTokenBudget:O,visibleMessageCount:A,visibleMessages:$n,loadEarlierMessages:un,loadAllMessages:Ht,allMessagesLoaded:K,isLoadingAllMessages:W,loadAllJustFinished:L,showLoadAllOverlay:U,claudeStatus:N,setClaudeStatus:F,createDiff:be,scrollContainerRef:de,scrollToBottom:ct,scrollToBottomAndReset:At,isNearBottom:Ze,handleScroll:xt}}function fF({latestMessage:e,provider:t,selectedProject:n,selectedSession:r,currentSessionId:a,setCurrentSessionId:i,setIsLoading:o,setCanAbortSession:l,setClaudeStatus:c,setTokenBudget:d,setPendingPermissionRequests:u,pendingViewSessionRef:p,streamBufferRef:h,streamTimerRef:m,accumulatedStreamRef:g,onSessionInactive:b,onSessionProcessing:x,onSessionNotProcessing:y,onReplaceTemporarySession:v,onNavigateToSession:w,onWebSocketReconnect:S,sessionStore:E}){const k=f.useRef(null);f.useEffect(()=>{if(!e||k.current===e)return;k.current=e;const T=r?.id||a||p.current?.sessionId||null,_=e;if(!_.kind)switch(String(_.type||"")){case"websocket-reconnected":S?.();return;case"pending-permissions-response":{const O=_.sessionId,A=O===a||r&&O===r.id;if(O&&!A)return;u(_.data||[]);return}case"session-status":{const O=_.sessionId;if(!O)return;const A=_.status;if(A){const N={text:A.text||"Working...",tokens:A.tokens||0,can_interrupt:A.can_interrupt!==void 0?A.can_interrupt:!0};c(N),o(!0),l(N.can_interrupt);return}const R=O===a||r&&O===r.id;if(_.isProcessing){x?.(O),R&&(o(!0),l(!0));return}b?.(O),y?.(O),R&&(o(!1),l(!1),c(null));return}default:return}const C=_.sessionId||T;if(_.kind==="stream_delta"){const I=_.content||"";if(!I)return;h.current+=I,g.current+=I,m.current||(m.current=window.setTimeout(()=>{m.current=null,C&&E.updateStreaming(C,g.current,t)},100)),C&&C!==T&&E.appendRealtime(C,_);return}if(_.kind==="stream_end"){m.current&&(clearTimeout(m.current),m.current=null),C&&(g.current&&E.updateStreaming(C,g.current,t),E.finalizeStreaming(C)),g.current="",h.current="";return}switch(C&&E.appendRealtime(C,_),_.kind){case"session_created":{const I=_.newSessionId;if(!I)break;(!a||a.startsWith("new-session-"))&&(sessionStorage.setItem("pendingSessionId",I),p.current&&!p.current.sessionId&&(p.current.sessionId=I),i(I),v?.(I),u(O=>O.map(A=>A.sessionId?A:{...A,sessionId:I}))),w?.(I);break}case"complete":{if(m.current&&(clearTimeout(m.current),m.current=null),C&&g.current&&(E.updateStreaming(C,g.current,t),E.finalizeStreaming(C)),g.current="",h.current="",o(!1),l(!1),c(null),u([]),b?.(C),y?.(C),_.aborted)break;const I=sessionStorage.getItem("pendingSessionId");if(I&&!a&&_.exitCode===0){const O=_.actualSessionId||I;i(O),_.actualSessionId&&w?.(O),sessionStorage.removeItem("pendingSessionId"),window.refreshProjects&&setTimeout(()=>window.refreshProjects?.(),500)}break}case"error":{o(!1),l(!1),c(null),b?.(C),y?.(C);break}case"permission_request":{if(!_.requestId)break;u(I=>I.some(O=>O.requestId===_.requestId)?I:[...I,{requestId:_.requestId,toolName:_.toolName||"UnknownTool",input:_.input,context:_.context,sessionId:C||null,receivedAt:new Date}]),o(!0),l(!0),c({text:"Waiting for permission",tokens:0,can_interrupt:!0});break}case"permission_cancelled":{_.requestId&&u(I=>I.filter(O=>O.requestId!==_.requestId));break}case"status":{_.text==="token_budget"&&_.tokenBudget?d(_.tokenBudget):_.text&&(c({text:_.text,tokens:_.tokens||0,can_interrupt:_.canInterrupt!==void 0?_.canInterrupt:!0}),o(!0),l(_.canInterrupt!==!1));break}}},[e,t,n,r,a,i,o,l,c,d,u,p,h,m,g,b,x,y,v,w,S,E])}var Ru={exports:{}},Du,dw;function gF(){if(dw)return Du;dw=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Du=e,Du}var Ou,uw;function bF(){if(uw)return Ou;uw=1;var e=gF();function t(){}function n(){}return n.resetWarningCache=t,Ou=function(){function r(o,l,c,d,u,p){if(p!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Ou}var pw;function xF(){return pw||(pw=1,Ru.exports=bF()()),Ru.exports}var yF=xF();const vt=Ci(yF);function ji(e,t,n,r){function a(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function l(u){try{d(r.next(u))}catch(p){o(p)}}function c(u){try{d(r.throw(u))}catch(p){o(p)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((r=r.apply(e,t||[])).next())})}const vF=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function ks(e,t,n){const r=wF(e),{webkitRelativePath:a}=e,i=typeof t=="string"?t:typeof a=="string"&&a.length>0?a:`./${e.name}`;return typeof r.path!="string"&&mw(r,"path",i),mw(r,"relativePath",i),r}function wF(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),a=vF.get(r);a&&Object.defineProperty(e,"type",{value:a,writable:!1,configurable:!1,enumerable:!0})}return e}function mw(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const kF=[".DS_Store","Thumbs.db"];function SF(e){return ji(this,void 0,void 0,function*(){return Ic(e)&&EF(e.dataTransfer)?AF(e.dataTransfer,e.type):NF(e)?CF(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?TF(e):[]})}function EF(e){return Ic(e)}function NF(e){return Ic(e)&&Ic(e.target)}function Ic(e){return typeof e=="object"&&e!==null}function CF(e){return lm(e.target.files).map(t=>ks(t))}function TF(e){return ji(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>ks(n))})}function AF(e,t){return ji(this,void 0,void 0,function*(){if(e.items){const n=lm(e.items).filter(a=>a.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(_F));return hw(XE(r))}return hw(lm(e.files).map(n=>ks(n)))})}function hw(e){return e.filter(t=>kF.indexOf(t.name)===-1)}function lm(e){if(e===null)return[];const t=[];for(let n=0;n<e.length;n++){const r=e[n];t.push(r)}return t}function _F(e){if(typeof e.webkitGetAsEntry!="function")return fw(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?JE(t):fw(e,t)}function XE(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?XE(n):[n]],[])}function fw(e,t){return ji(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const i=yield e.getAsFileSystemHandle();if(i===null)throw new Error(`${e} is not a File`);if(i!==void 0){const o=yield i.getFile();return o.handle=i,ks(o)}}const r=e.getAsFile();if(!r)throw new Error(`${e} is not a File`);return ks(r,(n=t?.fullPath)!==null&&n!==void 0?n:void 0)})}function IF(e){return ji(this,void 0,void 0,function*(){return e.isDirectory?JE(e):jF(e)})}function JE(e){const t=e.createReader();return new Promise((n,r)=>{const a=[];function i(){t.readEntries(o=>ji(this,void 0,void 0,function*(){if(o.length){const l=Promise.all(o.map(IF));a.push(l),i()}else try{const l=yield Promise.all(a);n(l)}catch(l){r(l)}}),o=>{r(o)})}i()})}function jF(e){return ji(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(r=>{const a=ks(r,e.fullPath);t(a)},r=>{n(r)})})})}var El={},gw;function RF(){return gw||(gw=1,El.__esModule=!0,El.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(",");if(n.length===0)return!0;var r=e.name||"",a=(e.type||"").toLowerCase(),i=a.replace(/\/.*$/,"");return n.some(function(o){var l=o.trim().toLowerCase();return l.charAt(0)==="."?r.toLowerCase().endsWith(l):l.endsWith("/*")?i===l.replace(/\/.*$/,""):a===l})}return!0}),El}var DF=RF();const Lu=Ci(DF);function bw(e){return MF(e)||LF(e)||e3(e)||OF()}function OF(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
322
|
+
`).replace(/\\t/g," ").replace(/\\r/g,"\r"),a=a.replace(new RegExp(`${n}(\\d+)${r}`,"g"),(i,o)=>t[parseInt(o,10)]),a}function YE(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ZE(e){try{return typeof e!="string"?e:e.replace(/Claude AI usage limit reached\|(\d{10,13})/g,(t,n)=>{let r=parseInt(n,10);if(!Number.isFinite(r))return t;r<1e12&&(r*=1e3);const a=new Date(r),i=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(a),o=-a.getTimezoneOffset(),l=o>=0?"+":"-",c=Math.abs(o),d=Math.floor(c/60),u=c%60,p=`GMT${l}${d}${u?":"+String(u).padStart(2,"0"):""}`,g=((Intl.DateTimeFormat().resolvedOptions().timeZone||"").split("/").pop()||"").replace(/_/g," ").toLowerCase().replace(/\b\w/g,v=>v.toUpperCase()),b=g?`${p} (${g})`:p,x=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],y=`${a.getDate()} ${x[a.getMonth()]} ${a.getFullYear()}`;return`Claude usage limit reached. Your limit will reset at **${i} ${b}** - ${y}`})}catch{return e}}function mF(e){const t=[],n=new Map;for(const r of e)r.kind==="tool_result"&&r.toolId&&n.set(r.toolId,r);for(const r of e)switch(r.kind){case"text":{const a=r.content||"";if(!a.trim())continue;if(r.role==="user"){const o=/<task-notification>\s*<task-id>[^<]*<\/task-id>\s*<output-file>[^<]*<\/output-file>\s*<status>([^<]*)<\/status>\s*<summary>([^<]*)<\/summary>\s*<\/task-notification>/g.exec(a);o?t.push({type:"assistant",content:o[2]?.trim()||"Background task finished",timestamp:r.timestamp,isTaskNotification:!0,taskStatus:o[1]?.trim()||"completed"}):t.push({type:"user",content:Iu(lw(a)),timestamp:r.timestamp})}else{let i=lw(a);i=Iu(i),i=ZE(i),t.push({type:"assistant",content:i,timestamp:r.timestamp})}break}case"tool_use":{const a=r.toolResult||(r.toolId?n.get(r.toolId):null),i=r.toolName==="Task",o=[];if(i&&r.subagentTools&&Array.isArray(r.subagentTools))for(const c of r.subagentTools)o.push({toolId:c.toolId,toolName:c.toolName,toolInput:c.toolInput,toolResult:c.toolResult||null,timestamp:new Date(c.timestamp||Date.now())});const l=a?{content:typeof a.content=="string"?a.content:JSON.stringify(a.content),isError:!!a.isError,toolUseResult:a.toolUseResult}:null;t.push({type:"assistant",content:"",timestamp:r.timestamp,isToolUse:!0,toolName:r.toolName,toolInput:typeof r.toolInput=="string"?r.toolInput:JSON.stringify(r.toolInput??"",null,2),toolId:r.toolId,toolResult:l,isSubagentContainer:i,subagentState:i?{childTools:o,currentToolIndex:o.length>0?o.length-1:-1,isComplete:!!l}:void 0});break}case"thinking":r.content?.trim()&&t.push({type:"assistant",content:Iu(r.content),timestamp:r.timestamp,isThinking:!0});break;case"error":{const a=r.content,i=typeof a=="string"?a:a&&typeof a=="object"?a.message??a.error??JSON.stringify(a):"";t.push({type:"error",content:i||"Unknown error",timestamp:r.timestamp});break}case"interactive_prompt":t.push({type:"assistant",content:r.content||"",timestamp:r.timestamp,isInteractivePrompt:!0});break;case"task_notification":t.push({type:"assistant",content:r.summary||"Background task update",timestamp:r.timestamp,isTaskNotification:!0,taskStatus:r.status||"completed"});break;case"stream_delta":r.content&&t.push({type:"assistant",content:r.content,timestamp:r.timestamp,isStreaming:!0});break}return t}const ju=20,Sl=100;function cw(e,t,n){const r=`local_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,a=e.timestamp instanceof Date?e.timestamp.toISOString():typeof e.timestamp=="number"?new Date(e.timestamp).toISOString():String(e.timestamp),i={id:r,sessionId:t,timestamp:a,provider:n};return e.isToolUse?{...i,kind:"tool_use",toolName:e.toolName,toolInput:e.toolInput,toolId:e.toolId||r}:e.isThinking?{...i,kind:"thinking",content:e.content||""}:e.isInteractivePrompt?{...i,kind:"interactive_prompt",content:e.content||""}:e.isTaskNotification?{...i,kind:"task_notification",status:e.taskStatus||"completed",summary:e.content||""}:e.type==="error"?{...i,kind:"error",content:e.content||""}:{...i,kind:"text",role:e.type==="user"?"user":"assistant",content:e.content||""}}function hF({selectedProject:e,selectedSession:t,ws:n,sendMessage:r,autoScrollToBottom:a,externalMessageUpdate:i,processingSessions:o,resetStreamingState:l,pendingViewSessionRef:c,sessionStore:d}){const[u,p]=f.useState(!1),[h,m]=f.useState(t?.id||null),[g,b]=f.useState(!1),[x,y]=f.useState(!1),[v,w]=f.useState(!1),[S,E]=f.useState(0),[k,T]=f.useState(!1),[_,C]=f.useState(!1),[I,O]=f.useState(null),[A,R]=f.useState(Sl),[N,F]=f.useState(null),[K,B]=f.useState(!1),[W,H]=f.useState(!1),[L,G]=f.useState(!1),[U,M]=f.useState(!1),[J,te]=f.useState(0),de=f.useRef(null),[ue,se]=f.useState(null),he=f.useRef(!1);f.useRef(!1);const Te=f.useRef(!1),Ae=f.useRef(!1),De=f.useRef(!1),Ue=f.useRef(null),P=f.useRef(!0),pe=f.useRef(0),le=f.useRef({height:0,top:0}),Y=f.useRef(null),q=f.useRef(null),re=f.useRef(null),be=f.useMemo(()=>uF(),[]),fe=t?.id||h||null,[ae,ye]=f.useState(null),ee=f.useRef(e?.name??null),ne=e?.name??null;ne!==ee.current&&(ee.current=ne,!t&&ae&&ye(null),t||m(null));const Z=f.useRef(null);fe!==Z.current&&(Z.current=fe,d.setActiveSession(fe));const oe=f.useRef(null);if(fe&&fe!==oe.current&&ae){const je=localStorage.getItem("selected-provider")||"claude",nt=cw(ae,fe,je);nt&&d.appendRealtime(fe,nt),ye(null)}oe.current=fe;const xe=fe?d.getMessages(fe):[],Le=f.useRef(0);xe.length!==Le.current&&(Le.current=xe.length,J>0&&te(0));const Be=f.useMemo(()=>{const je=mF(xe);return ae&&je.length===0?[ae]:J>0&&J<je.length?je.slice(0,-J):je},[xe,J,ae]),ot=f.useCallback(je=>{if(!fe){ye(je);return}const nt=localStorage.getItem("selected-provider")||"claude",Je=cw(je,fe,nt);Je&&d.appendRealtime(fe,Je)},[fe,d]),ht=f.useCallback(()=>{fe&&d.clearRealtime(fe)},[fe,d]),Ve=f.useCallback(je=>te(je),[]),ct=f.useCallback(()=>{const je=de.current;je&&(je.scrollTop=je.scrollHeight)},[]),At=f.useCallback(()=>{ct(),K&&(R(Sl),B(!1),Ae.current=!1)},[K,ct]),Ze=f.useCallback(()=>{const je=de.current;if(!je)return!1;const{scrollTop:nt,scrollHeight:Je,clientHeight:pt}=je;return Je-nt-pt<50},[]),Rt=f.useCallback(async je=>{if(!je||Te.current||x||Ae.current||!v||!t||!e)return!1;const nt=t.__provider||"claude";if(nt==="cursor")return!1;Te.current=!0;const Je=je.scrollHeight,pt=je.scrollTop;try{const yt=await d.fetchMore(t.id,{provider:nt,projectName:e.name,projectPath:e.fullPath||e.path||"",limit:ju});return!yt||yt.serverMessages.length===0?!1:(Ue.current={height:Je,top:pt},w(yt.hasMore),E(yt.total),R(_t=>_t+ju),!0)}finally{Te.current=!1}},[v,x,e,t,d]),xt=f.useCallback(async()=>{const je=de.current;if(!je)return;const nt=Ze();if(C(!nt),!Ae.current){if(!(je.scrollTop<100)){De.current=!1;return}if(De.current){je.scrollTop>20&&(De.current=!1);return}await Rt(je)&&(De.current=!0)}},[Ze,Rt]);f.useLayoutEffect(()=>{if(!Ue.current||!de.current)return;const{height:je,top:nt}=Ue.current,Je=de.current,pt=Je.scrollHeight;Je.scrollTop=nt+Math.max(pt-je,0),Ue.current=null},[Be.length]),f.useEffect(()=>{he.current||(P.current=!0,R(Sl)),De.current=!1,Ue.current=null,C(!1)},[e?.name,t?.id]),f.useEffect(()=>{if(!(!P.current||!de.current||g)){if(Be.length===0){P.current=!1;return}P.current=!1,he.current||setTimeout(()=>ct(),200)}},[Be.length,g,ct]),f.useEffect(()=>{if(!t||!e){l(),c.current=null,F(null),T(!1),p(!1),m(null),sessionStorage.removeItem("cursorSessionId"),pe.current=0,w(!1),E(0),O(null),re.current=null;return}const je=t.__provider||localStorage.getItem("selected-provider")||"claude",nt=`${t.id}:${e.name}:${je}`;if(re.current===nt&&d.has(t.id)&&!d.isStale(t.id))return;const Je=h!==null&&h!==t.id;Je&&(l(),c.current=null,F(null),T(!1)),pe.current=0,w(!1),E(0),R(Sl),B(!1),Ae.current=!1,H(!1),G(!1),M(!1),te(0),q.current&&clearTimeout(q.current),Y.current&&clearTimeout(Y.current),Je&&(O(null),p(!1)),m(t.id),je==="cursor"&&sessionStorage.setItem("cursorSessionId",t.id),n&&r({type:"check-session-status",sessionId:t.id,provider:je}),re.current=nt,b(!0),d.fetchFromServer(t.id,{provider:t.__provider||je,projectName:e.name,projectPath:e.fullPath||e.path||"",limit:ju,offset:0}).then(pt=>{pt&&(w(pt.hasMore),E(pt.total),pt.tokenUsage&&O(pt.tokenUsage)),b(!1)}).catch(()=>{b(!1)})},[c,l,e,t?.id,r,n,d]),f.useEffect(()=>{if(!i||!t||!e)return;(async()=>{try{const nt=localStorage.getItem("selected-provider")||"claude";u||(await d.refreshFromServer(t.id,{provider:t.__provider||nt,projectName:e.name,projectPath:e.fullPath||e.path||""}),a&&Ze()&&setTimeout(()=>ct(),200))}catch(nt){console.error("Error reloading messages from external update:",nt)}})()},[a,i,Ze,ct,e,t,d,u]),f.useEffect(()=>{const je=t,nt=je?.__searchTargetSnippet,Je=je?.__searchTargetTimestamp;typeof nt=="string"&&nt&&(he.current=!0,se({snippet:nt,timestamp:typeof Je=="string"?Je:void 0}))},[t]),f.useEffect(()=>{t?.id&&(c.current=null)},[c,t?.id]),f.useEffect(()=>{if(!ue||Be.length===0||g)return;const je=ue;se(null),(async()=>{if(!Ae.current&&t&&e){const pt=t.__provider||"claude";if(pt!=="cursor")try{const yt=await d.fetchFromServer(t.id,{provider:pt,projectName:e.name,projectPath:e.fullPath||e.path||"",limit:null,offset:0});yt&&(w(!1),E(yt.total),pe.current=yt.total,R(1/0),B(!0),Ae.current=!0,await new Promise(_t=>setTimeout(_t,300)))}catch{}}R(1/0);const Je=pt=>{const yt=de.current;if(!yt)return;let _t=null;if(je.snippet){const sr=je.snippet.replace(/^\.{3}/,"").replace(/\.{3}$/,"").trim().slice(0,80).toLowerCase().trim();if(sr.length>=10){const or=yt.querySelectorAll(".chat-message");for(const ft of or)if((ft.textContent||"").toLowerCase().includes(sr)){_t=ft;break}}}if(!_t&&je.timestamp){const ir=new Date(je.timestamp).getTime(),sr=yt.querySelectorAll("[data-message-timestamp]");let or=1/0;for(const ft of sr){const me=ft.getAttribute("data-message-timestamp");if(!me)continue;const ve=Math.abs(new Date(me).getTime()-ir);ve<or&&(or=ve,_t=ft)}}_t?(_t.scrollIntoView({block:"center",behavior:"smooth"}),_t.classList.add("search-highlight-flash"),setTimeout(()=>_t?.classList.remove("search-highlight-flash"),4e3),he.current=!1):pt>0?setTimeout(()=>Je(pt-1),200):he.current=!1};setTimeout(()=>Je(15),150)})()},[Be.length,g,ue]),f.useEffect(()=>{if(!e||!t?.id||t.id.startsWith("new-session-")){O(null);return}if((t.__provider||"claude")!=="claude")return;(async()=>{try{const Je=`/api/projects/${e.name}/sessions/${t.id}/token-usage`,pt=await we(Je);pt.ok?O(await pt.json()):O(null)}catch(Je){console.error("Failed to fetch initial token usage:",Je)}})()},[e,t?.id,t?.__provider]);const $n=f.useMemo(()=>Be.length<=A?Be:Be.slice(-A),[Be,A]);f.useEffect(()=>{if(!a&&de.current){const je=de.current;le.current={height:je.scrollHeight,top:je.scrollTop}}}),f.useEffect(()=>{if(!de.current||Be.length===0||Te.current||x||Ue.current||he.current)return;if(a){_||setTimeout(()=>ct(),50);return}const je=de.current,nt=le.current.height,Je=le.current.top,yt=je.scrollHeight-nt;yt>0&&Je>0&&(je.scrollTop=Je+yt)},[a,Be.length,x,_,ct]),f.useEffect(()=>{const je=de.current;if(je)return je.addEventListener("scroll",xt),()=>je.removeEventListener("scroll",xt)},[xt]),f.useEffect(()=>{const je=t?.id||h;if(!je||!o)return;o.has(je)&&!u&&(p(!0),T(!0))},[h,u,o,t?.id]);const Un=f.useRef(!1);f.useEffect(()=>{const je=Un.current;return Un.current=x,je&&!x&&v&&(q.current&&clearTimeout(q.current),M(!0),q.current=setTimeout(()=>M(!1),2e3)),!v&&!x&&(q.current&&clearTimeout(q.current),M(!1)),()=>{q.current&&clearTimeout(q.current)}},[x,v]);const Ht=f.useCallback(async()=>{if(!t||!e||W)return;const je=t.__provider||"claude";if(je==="cursor"){R(1/0),B(!0),Ae.current=!0,G(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{G(!1),M(!1)},1e3);return}const nt=t.id;Ae.current=!0,Te.current=!0,H(!0),M(!0);const Je=de.current,pt=Je?Je.scrollHeight:0,yt=Je?Je.scrollTop:0;try{const _t=await d.fetchFromServer(nt,{provider:je,projectName:e.name,projectPath:e.fullPath||e.path||"",limit:null,offset:0});if(h!==nt)return;_t?(Je&&(Ue.current={height:pt,top:yt}),w(!1),E(_t.total),pe.current=_t.total,R(1/0),B(!0),G(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{G(!1),M(!1)},1e3)):(Ae.current=!1,M(!1))}catch(_t){console.error("Error loading all messages:",_t),Ae.current=!1,M(!1)}finally{Te.current=!1,H(!1)}},[t,e,W,h,d]),un=f.useCallback(()=>{R(je=>je+100)},[]);return{chatMessages:Be,addMessage:ot,clearMessages:ht,rewindMessages:Ve,isLoading:u,setIsLoading:p,currentSessionId:h,setCurrentSessionId:m,isLoadingSessionMessages:g,isLoadingMoreMessages:x,hasMoreMessages:v,totalMessages:S,canAbortSession:k,setCanAbortSession:T,isUserScrolledUp:_,setIsUserScrolledUp:C,tokenBudget:I,setTokenBudget:O,visibleMessageCount:A,visibleMessages:$n,loadEarlierMessages:un,loadAllMessages:Ht,allMessagesLoaded:K,isLoadingAllMessages:W,loadAllJustFinished:L,showLoadAllOverlay:U,claudeStatus:N,setClaudeStatus:F,createDiff:be,scrollContainerRef:de,scrollToBottom:ct,scrollToBottomAndReset:At,isNearBottom:Ze,handleScroll:xt}}function fF({latestMessage:e,provider:t,selectedProject:n,selectedSession:r,currentSessionId:a,setCurrentSessionId:i,setIsLoading:o,setCanAbortSession:l,setClaudeStatus:c,setTokenBudget:d,setPendingPermissionRequests:u,pendingViewSessionRef:p,streamBufferRef:h,streamTimerRef:m,accumulatedStreamRef:g,onSessionInactive:b,onSessionProcessing:x,onSessionNotProcessing:y,onReplaceTemporarySession:v,onNavigateToSession:w,onWebSocketReconnect:S,sessionStore:E}){const k=f.useRef(null);f.useEffect(()=>{if(!e||k.current===e)return;k.current=e;const T=r?.id||a||p.current?.sessionId||null,_=e;if(!_.kind)switch(String(_.type||"")){case"websocket-reconnected":S?.();return;case"pending-permissions-response":{const O=_.sessionId,A=O===a||r&&O===r.id;if(O&&!A)return;u(_.data||[]);return}case"session-status":{const O=_.sessionId;if(!O)return;const A=_.status;if(A){const N={text:A.text||"Working...",tokens:A.tokens||0,can_interrupt:A.can_interrupt!==void 0?A.can_interrupt:!0};c(N),o(!0),l(N.can_interrupt);return}const R=O===a||r&&O===r.id;if(_.isProcessing){x?.(O),R&&(o(!0),l(!0));return}b?.(O),y?.(O),R&&(o(!1),l(!1),c(null));return}default:return}const C=_.sessionId||T;if(_.kind==="stream_delta"){const I=_.content||"";if(!I)return;h.current+=I,g.current+=I,m.current||(m.current=window.setTimeout(()=>{m.current=null,C&&E.updateStreaming(C,g.current,t)},100)),C&&C!==T&&E.appendRealtime(C,_);return}if(_.kind==="stream_end"){m.current&&(clearTimeout(m.current),m.current=null),C&&(g.current&&E.updateStreaming(C,g.current,t),E.finalizeStreaming(C)),g.current="",h.current="";return}switch(C&&E.appendRealtime(C,_),_.kind){case"session_created":{const I=_.newSessionId;if(!I)break;(!a||a.startsWith("new-session-"))&&(sessionStorage.setItem("pendingSessionId",I),p.current&&!p.current.sessionId&&(p.current.sessionId=I),i(I),v?.(I),u(O=>O.map(A=>A.sessionId?A:{...A,sessionId:I}))),w?.(I);break}case"complete":{if(m.current&&(clearTimeout(m.current),m.current=null),C&&g.current&&(E.updateStreaming(C,g.current,t),E.finalizeStreaming(C)),g.current="",h.current="",o(!1),l(!1),c(null),u([]),b?.(C),y?.(C),_.aborted)break;const I=sessionStorage.getItem("pendingSessionId");if(I&&!a&&_.exitCode===0){const O=_.actualSessionId||I;i(O),_.actualSessionId&&w?.(O),sessionStorage.removeItem("pendingSessionId"),window.refreshProjects&&setTimeout(()=>window.refreshProjects?.(),500)}break}case"error":{o(!1),l(!1),c(null),b?.(C),y?.(C);break}case"permission_request":{if(!_.requestId)break;u(I=>I.some(O=>O.requestId===_.requestId)?I:[...I,{requestId:_.requestId,toolName:_.toolName||"UnknownTool",input:_.input,context:_.context,sessionId:C||null,receivedAt:new Date}]),o(!0),l(!0),c({text:"Waiting for permission",tokens:0,can_interrupt:!0});break}case"permission_cancelled":{_.requestId&&u(I=>I.filter(O=>O.requestId!==_.requestId));break}case"status":{_.text==="token_budget"&&_.tokenBudget?d(_.tokenBudget):_.text&&(c({text:_.text,tokens:_.tokens||0,can_interrupt:_.canInterrupt!==void 0?_.canInterrupt:!0}),o(!0),l(_.canInterrupt!==!1));break}}},[e,t,n,r,a,i,o,l,c,d,u,p,h,m,g,b,x,y,v,w,S,E])}var Ru={exports:{}},Du,dw;function gF(){if(dw)return Du;dw=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Du=e,Du}var Ou,uw;function bF(){if(uw)return Ou;uw=1;var e=gF();function t(){}function n(){}return n.resetWarningCache=t,Ou=function(){function r(o,l,c,d,u,p){if(p!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Ou}var pw;function xF(){return pw||(pw=1,Ru.exports=bF()()),Ru.exports}var yF=xF();const vt=Ci(yF);function ji(e,t,n,r){function a(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function l(u){try{d(r.next(u))}catch(p){o(p)}}function c(u){try{d(r.throw(u))}catch(p){o(p)}}function d(u){u.done?i(u.value):a(u.value).then(l,c)}d((r=r.apply(e,t||[])).next())})}const vF=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function ks(e,t,n){const r=wF(e),{webkitRelativePath:a}=e,i=typeof t=="string"?t:typeof a=="string"&&a.length>0?a:`./${e.name}`;return typeof r.path!="string"&&mw(r,"path",i),mw(r,"relativePath",i),r}function wF(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),a=vF.get(r);a&&Object.defineProperty(e,"type",{value:a,writable:!1,configurable:!1,enumerable:!0})}return e}function mw(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const kF=[".DS_Store","Thumbs.db"];function SF(e){return ji(this,void 0,void 0,function*(){return Ic(e)&&EF(e.dataTransfer)?AF(e.dataTransfer,e.type):NF(e)?CF(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?TF(e):[]})}function EF(e){return Ic(e)}function NF(e){return Ic(e)&&Ic(e.target)}function Ic(e){return typeof e=="object"&&e!==null}function CF(e){return lm(e.target.files).map(t=>ks(t))}function TF(e){return ji(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>ks(n))})}function AF(e,t){return ji(this,void 0,void 0,function*(){if(e.items){const n=lm(e.items).filter(a=>a.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(_F));return hw(XE(r))}return hw(lm(e.files).map(n=>ks(n)))})}function hw(e){return e.filter(t=>kF.indexOf(t.name)===-1)}function lm(e){if(e===null)return[];const t=[];for(let n=0;n<e.length;n++){const r=e[n];t.push(r)}return t}function _F(e){if(typeof e.webkitGetAsEntry!="function")return fw(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?JE(t):fw(e,t)}function XE(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?XE(n):[n]],[])}function fw(e,t){return ji(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const i=yield e.getAsFileSystemHandle();if(i===null)throw new Error(`${e} is not a File`);if(i!==void 0){const o=yield i.getFile();return o.handle=i,ks(o)}}const r=e.getAsFile();if(!r)throw new Error(`${e} is not a File`);return ks(r,(n=t?.fullPath)!==null&&n!==void 0?n:void 0)})}function IF(e){return ji(this,void 0,void 0,function*(){return e.isDirectory?JE(e):jF(e)})}function JE(e){const t=e.createReader();return new Promise((n,r)=>{const a=[];function i(){t.readEntries(o=>ji(this,void 0,void 0,function*(){if(o.length){const l=Promise.all(o.map(IF));a.push(l),i()}else try{const l=yield Promise.all(a);n(l)}catch(l){r(l)}}),o=>{r(o)})}i()})}function jF(e){return ji(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(r=>{const a=ks(r,e.fullPath);t(a)},r=>{n(r)})})})}var El={},gw;function RF(){return gw||(gw=1,El.__esModule=!0,El.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(",");if(n.length===0)return!0;var r=e.name||"",a=(e.type||"").toLowerCase(),i=a.replace(/\/.*$/,"");return n.some(function(o){var l=o.trim().toLowerCase();return l.charAt(0)==="."?r.toLowerCase().endsWith(l):l.endsWith("/*")?i===l.replace(/\/.*$/,""):a===l})}return!0}),El}var DF=RF();const Lu=Ci(DF);function bw(e){return MF(e)||LF(e)||e3(e)||OF()}function OF(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
323
323
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LF(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function MF(e){if(Array.isArray(e))return cm(e)}function xw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function yw(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xw(Object(n),!0).forEach(function(r){QE(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xw(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function QE(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ho(e,t){return zF(e)||FF(e,t)||e3(e,t)||PF()}function PF(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
324
324
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e3(e,t){if(e){if(typeof e=="string")return cm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return cm(e,t)}}function cm(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function FF(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],a=!0,i=!1,o,l;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));a=!0);}catch(c){i=!0,l=c}finally{try{!a&&n.return!=null&&n.return()}finally{if(i)throw l}}return r}}function zF(e){if(Array.isArray(e))return e}var BF=typeof Lu=="function"?Lu:Lu.default,$F="file-invalid-type",UF="file-too-large",GF="file-too-small",HF="too-many-files",qF=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=t.split(","),r=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:$F,message:"File type must be ".concat(r)}},vw=function(t){return{code:UF,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},ww=function(t){return{code:GF,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},VF={code:HF,message:"Too many files"};function t3(e,t){var n=e.type==="application/x-moz-file"||BF(e,t);return[n,n?null:qF(t)]}function n3(e,t,n){if(oi(e.size))if(oi(t)&&oi(n)){if(e.size>n)return[!1,vw(n)];if(e.size<t)return[!1,ww(t)]}else{if(oi(t)&&e.size<t)return[!1,ww(t)];if(oi(n)&&e.size>n)return[!1,vw(n)]}return[!0,null]}function oi(e){return e!=null}function WF(e){var t=e.files,n=e.accept,r=e.minSize,a=e.maxSize,i=e.multiple,o=e.maxFiles,l=e.validator;return!i&&t.length>1||i&&o>=1&&t.length>o?!1:t.every(function(c){var d=t3(c,n),u=Ho(d,1),p=u[0],h=n3(c,r,a),m=Ho(h,1),g=m[0],b=l?l(c):null;return p&&g&&!b})}function jc(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Nl(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function kw(e){e.preventDefault()}function KF(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function YF(e){return e.indexOf("Edge/")!==-1}function ZF(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return KF(e)||YF(e)}function _r(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var a=arguments.length,i=new Array(a>1?a-1:0),o=1;o<a;o++)i[o-1]=arguments[o];return t.some(function(l){return!jc(r)&&l&&l.apply(void 0,[r].concat(i)),jc(r)})}}function XF(){return"showOpenFilePicker"in window}function JF(e){if(oi(e)){var t=Object.entries(e).filter(function(n){var r=Ho(n,2),a=r[0],i=r[1],o=!0;return r3(a)||(console.warn('Skipped "'.concat(a,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),o=!1),(!Array.isArray(i)||!i.every(a3))&&(console.warn('Skipped "'.concat(a,'" because an invalid file extension was provided.')),o=!1),o}).reduce(function(n,r){var a=Ho(r,2),i=a[0],o=a[1];return yw(yw({},n),{},QE({},i,o))},{});return[{description:"Files",accept:t}]}return e}function QF(e){if(oi(e))return Object.entries(e).reduce(function(t,n){var r=Ho(n,2),a=r[0],i=r[1];return[].concat(bw(t),[a],bw(i))},[]).filter(function(t){return r3(t)||a3(t)}).join(",")}function ez(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function tz(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function r3(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function a3(e){return/^.*\.[\w]+$/.test(e)}var nz=["children"],rz=["open"],az=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],iz=["refKey","onChange","onClick"];function sz(e){return cz(e)||lz(e)||i3(e)||oz()}function oz(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
325
325
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lz(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function cz(e){if(Array.isArray(e))return dm(e)}function Mu(e,t){return pz(e)||uz(e,t)||i3(e,t)||dz()}function dz(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -660,7 +660,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
660
660
|
`);for(const r of n){const a=r.match(/#(\d+)\.?\s*(?:\[(\w+)\]\s*)?(.+?)(?:\s*\((?:owner:\s*\w+)?\))?$/);if(a){const[,i,o,l]=a,c=r.match(/blockedBy:\s*\[([^\]]*)\]/);t.push({id:i,subject:l.trim(),status:o||"pending",blockedBy:c?c[1].split(",").map(d=>d.trim()).filter(Boolean):void 0})}}return t}const k2={completed:{icon:s.jsx("svg",{className:"h-3.5 w-3.5 text-green-500 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),textClass:"line-through text-gray-400 dark:text-gray-500",badgeClass:"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300 border-green-200 dark:border-green-800"},in_progress:{icon:s.jsx("svg",{className:"h-3.5 w-3.5 text-blue-500 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),textClass:"text-gray-900 dark:text-gray-100",badgeClass:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-800"},pending:{icon:s.jsx("svg",{className:"h-3.5 w-3.5 text-gray-400 dark:text-gray-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("circle",{cx:"12",cy:"12",r:"9",strokeWidth:2})}),textClass:"text-gray-700 dark:text-gray-300",badgeClass:"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-700"}},vZ=({content:e})=>{const t=yZ(e);if(t.length===0)return s.jsx("pre",{className:"whitespace-pre-wrap font-mono text-[11px] text-gray-600 dark:text-gray-400",children:e});const n=t.filter(a=>a.status==="completed").length,r=t.length;return s.jsxs("div",{children:[s.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[s.jsxs("span",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:[n,"/",r," completed"]}),s.jsx("div",{className:"h-1 flex-1 overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",children:s.jsx("div",{className:"h-full rounded-full bg-green-500 transition-all dark:bg-green-400",style:{width:`${r>0?n/r*100:0}%`}})})]}),s.jsx("div",{className:"space-y-px",children:t.map(a=>{const i=k2[a.status]||k2.pending;return s.jsxs("div",{className:"group flex items-center gap-1.5 py-0.5",children:[s.jsx("span",{className:"flex-shrink-0",children:i.icon}),s.jsxs("span",{className:"flex-shrink-0 font-mono text-[11px] text-gray-400 dark:text-gray-500",children:["#",a.id]}),s.jsx("span",{className:`flex-1 truncate text-xs ${i.textClass}`,children:a.subject}),s.jsx("span",{className:`flex-shrink-0 rounded border px-1 py-px text-[10px] ${i.badgeClass}`,children:a.status.replace("_"," ")})]},a.id)})})]})},wZ=({content:e,format:t="plain",className:n=""})=>{if(t==="json"){let r=e;try{const a=JSON.parse(e);r=JSON.stringify(a,null,2)}catch(a){console.warn("Failed to parse JSON content:",a)}return s.jsx("pre",{className:`mt-1 overflow-x-auto rounded bg-gray-900 p-2.5 font-mono text-xs text-gray-100 dark:bg-gray-950 ${n}`,children:r})}return t==="code"?s.jsx("pre",{className:`mt-1 overflow-hidden whitespace-pre-wrap break-words rounded border border-gray-200/50 bg-gray-50 p-2 font-mono text-xs text-gray-700 dark:border-gray-700/50 dark:bg-gray-800/50 dark:text-gray-300 ${n}`,children:e}):s.jsx("div",{className:`mt-1 whitespace-pre-wrap text-sm text-gray-700 dark:text-gray-300 ${n}`,children:e})},kZ=({questions:e,answers:t,className:n=""})=>{const[r,a]=f.useState(null);if(!e||e.length===0)return null;const i=Object.keys(t||{}).length>0,o=e.length;return s.jsxs("div",{className:`space-y-2 ${n}`,children:[e.map((l,c)=>{const d=t?.[l.question],u=d?d.split(", "):[],p=!d,h=r===c;return s.jsxs("div",{className:"border-gray-150 overflow-hidden rounded-lg border bg-gray-50/50 dark:border-gray-700/50 dark:bg-gray-800/30",children:[s.jsxs("button",{type:"button",onClick:()=>a(h?null:c),className:"flex w-full items-start gap-2.5 px-3 py-2 text-left transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[s.jsx("div",{className:`mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center rounded-full ${u.length>0?"bg-blue-100 dark:bg-blue-900/40":"bg-gray-100 dark:bg-gray-800"}`,children:u.length>0?s.jsx("svg",{className:"h-2.5 w-2.5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:3,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):s.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-gray-300 dark:bg-gray-600"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.header&&s.jsx("span",{className:"inline-flex items-center rounded border border-blue-100/80 bg-blue-50 px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider text-blue-600 dark:border-blue-800/40 dark:bg-blue-900/30 dark:text-blue-400",children:l.header}),o>1&&s.jsxs("span",{className:"text-[10px] tabular-nums text-gray-400 dark:text-gray-500",children:[c+1,"/",o]})]}),s.jsx("div",{className:"mt-0.5 text-xs leading-snug text-gray-600 dark:text-gray-400",children:l.question}),!h&&u.length>0&&s.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:u.map(m=>{const g=!l.options.some(b=>b.label===m);return s.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-blue-50 px-1.5 py-0.5 text-[11px] font-medium text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",children:[m,g&&s.jsx("span",{className:"text-[9px] font-normal text-blue-400 dark:text-blue-500",children:"(custom)"})]},m)})}),!h&&p&&i&&s.jsx("span",{className:"mt-1 inline-block text-[10px] italic text-gray-400 dark:text-gray-500",children:"Skipped"})]}),s.jsx("svg",{className:`mt-0.5 h-3.5 w-3.5 flex-shrink-0 text-gray-400 transition-transform duration-200 dark:text-gray-500 ${h?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),h&&s.jsx("div",{className:"border-t border-gray-100 px-3 pb-2.5 pt-0.5 dark:border-gray-700/40",children:s.jsxs("div",{className:"ml-6.5 space-y-1",children:[l.options.map(m=>{const g=u.includes(m.label);return s.jsxs("div",{className:`flex items-start gap-2 rounded-lg px-2.5 py-1.5 text-[12px] ${g?"border border-blue-200/60 bg-blue-50/80 dark:border-blue-800/40 dark:bg-blue-900/20":"text-gray-400 dark:text-gray-500"}`,children:[s.jsx("div",{className:`mt-0.5 h-3.5 w-3.5 flex-shrink-0 ${l.multiSelect?"rounded-[3px]":"rounded-full"} flex items-center justify-center border-[1.5px] ${g?"border-blue-500 bg-blue-500 dark:border-blue-400 dark:bg-blue-500":"border-gray-300 dark:border-gray-600"}`,children:g&&s.jsx("svg",{className:"h-2 w-2 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:3,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:g?"font-medium text-gray-900 dark:text-gray-100":"",children:m.label}),m.description&&s.jsx("span",{className:`mt-0.5 block text-[11px] ${g?"text-blue-600/70 dark:text-blue-300/70":"text-gray-400 dark:text-gray-600"}`,children:m.description})]})]},m.label)}),u.filter(m=>!l.options.some(g=>g.label===m)).map(m=>s.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-blue-200/60 bg-blue-50/80 px-2.5 py-1.5 text-[12px] dark:border-blue-800/40 dark:bg-blue-900/20",children:[s.jsx("div",{className:`mt-0.5 h-3.5 w-3.5 flex-shrink-0 ${l.multiSelect?"rounded-[3px]":"rounded-full"} flex items-center justify-center border-[1.5px] border-blue-500 bg-blue-500 dark:border-blue-400 dark:bg-blue-500`,children:s.jsx("svg",{className:"h-2 w-2 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:3,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"font-medium text-gray-900 dark:text-gray-100",children:m}),s.jsx("span",{className:"ml-1 text-[10px] text-blue-500 dark:text-blue-400",children:"(custom)"})]})]},m)),p&&i&&s.jsx("div",{className:"px-2.5 py-1 text-[11px] italic text-gray-400 dark:text-gray-500",children:"No answer provided"})]})})]},c)}),!i&&o===1&&s.jsx("div",{className:"text-[11px] italic text-gray-400 dark:text-gray-500",children:"Skipped"})]})},SZ=({request:e,onDecision:t})=>{const n=e.input,r=n?.questions||[],[a,i]=f.useState(0),[o,l]=f.useState(()=>new Map),[c,d]=f.useState(()=>new Map),[u,p]=f.useState(()=>new Map),[h,m]=f.useState(!1),g=f.useRef(null),b=f.useRef(null);f.useEffect(()=>{requestAnimationFrame(()=>m(!0))},[]),f.useEffect(()=>{u.get(a)||g.current?.focus()},[a,u]),f.useEffect(()=>{u.get(a)&&b.current?.focus()},[u,a]);const x=f.useCallback((K,B,W)=>{l(H=>{const L=new Map(H),G=new Set(L.get(K)||[]);return W?G.has(B)?G.delete(B):G.add(B):(G.clear(),G.add(B),p(U=>{const M=new Map(U);return M.set(K,!1),M})),L.set(K,G),L})},[]),y=f.useCallback((K,B)=>{p(W=>{const H=new Map(W),L=H.get(K)||!1;return H.set(K,!L),!B&&!L&&l(G=>{const U=new Map(G);return U.set(K,new Set),U}),H})},[]),v=f.useCallback((K,B)=>{d(W=>{const H=new Map(W);return H.set(K,B),H})},[]),w=f.useCallback(()=>{const K={};return r.forEach((B,W)=>{const H=Array.from(o.get(W)||[]),L=u.get(W)||!1,G=(c.get(W)||"").trim();L&&G&&H.push(G),H.length>0&&(K[B.question]=H.join(", "))}),K},[r,o,u,c]),S=f.useCallback(()=>{t(e.requestId,{allow:!0,updatedInput:{...n,answers:w()}})},[t,e.requestId,n,w]),E=f.useCallback(()=>{t(e.requestId,{allow:!0,updatedInput:{...n,answers:{}}})},[t,e.requestId,n]),k=f.useCallback(K=>{if(K.target instanceof HTMLInputElement)return;const B=r[a];if(!B)return;const W=B.multiSelect||!1,H=B.options.length,L=parseInt(K.key);if(!isNaN(L)&&L>=1&&L<=H){K.preventDefault(),x(a,B.options[L-1].label,W);return}if(K.key==="0"){K.preventDefault(),y(a,W);return}if(K.key==="Enter"){K.preventDefault(),a===r.length-1?S():i(U=>U+1);return}if(K.key==="Escape"){K.preventDefault(),E();return}},[a,r,x,y,S,E]);if(r.length===0)return null;const T=r.length,_=T===1,C=r[a],I=C.multiSelect||!1,O=o.get(a)||new Set,A=u.get(a)||!1,R=a===T-1,N=a===0,F=O.size>0||A&&(c.get(a)||"").trim().length>0;return s.jsx("div",{ref:g,tabIndex:-1,onKeyDown:k,className:`w-full outline-none transition-all duration-500 ease-out ${h?"translate-y-0 opacity-100":"translate-y-3 opacity-0"}`,children:s.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-gray-200/80 bg-white shadow-lg dark:border-gray-700/50 dark:bg-gray-800/90 dark:shadow-2xl",children:[s.jsx("div",{className:"absolute left-0 right-0 top-0 h-[2px] bg-gradient-to-r from-blue-500 via-cyan-400 to-teal-400"}),s.jsxs("div",{className:"px-4 pb-2 pt-3.5",children:[s.jsxs("div",{className:"mb-1.5 flex items-center gap-2.5",children:[s.jsxs("div",{className:"relative flex-shrink-0",children:[s.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-lg bg-gradient-to-br from-blue-500/10 to-cyan-500/10 dark:from-blue-400/15 dark:to-cyan-400/15",children:s.jsx("svg",{className:"h-3.5 w-3.5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.75,stroke:"currentColor",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827m0 3h.01"})})}),s.jsx("div",{className:"absolute -right-0.5 -top-0.5 h-2 w-2 animate-pulse rounded-full bg-cyan-400 dark:bg-cyan-500"})]}),s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[s.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-gray-400 dark:text-gray-500",children:"Claude needs your input"}),C.header&&s.jsx("span",{className:"inline-flex items-center rounded border border-blue-100 bg-blue-50 px-1.5 py-px text-[9px] font-semibold uppercase tracking-wider text-blue-600 dark:border-blue-800/50 dark:bg-blue-900/30 dark:text-blue-400",children:C.header})]}),!_&&s.jsxs("span",{className:"flex-shrink-0 text-[10px] tabular-nums text-gray-400 dark:text-gray-500",children:[a+1,"/",T]})]}),!_&&s.jsx("div",{className:"mb-2 flex items-center gap-1",children:r.map((K,B)=>s.jsx("button",{type:"button",onClick:()=>i(B),className:`h-[3px] rounded-full transition-all duration-300 ${B===a?"w-5 bg-blue-500 dark:bg-blue-400":B<a?"w-2.5 bg-blue-300 dark:bg-blue-600":"w-2.5 bg-gray-200 dark:bg-gray-700"}`},B))}),s.jsx("p",{className:"text-[14px] font-medium leading-snug text-gray-900 dark:text-gray-100",children:C.question}),I&&s.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:"Select all that apply"})]}),s.jsx("div",{className:"scrollbar-thin max-h-48 overflow-y-auto px-4 pb-2",role:I?"group":"radiogroup","aria-label":C.question,children:s.jsxs("div",{className:"space-y-1",children:[C.options.map((K,B)=>{const W=O.has(K.label);return s.jsxs("button",{type:"button",onClick:()=>x(a,K.label,I),className:`group flex w-full items-center gap-2.5 rounded-lg border px-3 py-2 text-left transition-all duration-150 ${W?"border-blue-300 bg-blue-50/80 ring-1 ring-blue-200/50 dark:border-blue-600 dark:bg-blue-900/25 dark:ring-blue-700/30":"dark:hover:bg-gray-750/50 border-gray-200 hover:border-gray-300 hover:bg-gray-50/60 dark:border-gray-700/60 dark:hover:border-gray-600"}`,children:[s.jsx("kbd",{className:`flex h-5 w-5 flex-shrink-0 items-center justify-center rounded font-mono text-[10px] transition-all duration-150 ${W?"bg-blue-500 font-semibold text-white dark:bg-blue-500":"border border-gray-200 bg-gray-100 text-gray-400 group-hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-500 dark:group-hover:border-gray-600"}`,children:B+1}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:`text-[13px] leading-tight transition-colors duration-150 ${W?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:K.label}),K.description&&s.jsx("div",{className:`text-[11px] leading-snug transition-colors duration-150 ${W?"text-blue-600/70 dark:text-blue-300/70":"text-gray-400 dark:text-gray-500"}`,children:K.description})]}),W&&s.jsx("svg",{className:"h-4 w-4 flex-shrink-0 text-blue-500 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})]},K.label)}),s.jsxs("button",{type:"button",onClick:()=>y(a,I),className:`group flex w-full items-center gap-2.5 rounded-lg border px-3 py-2 text-left transition-all duration-150 ${A?"border-blue-300 bg-blue-50/80 ring-1 ring-blue-200/50 dark:border-blue-600 dark:bg-blue-900/25 dark:ring-blue-700/30":"dark:hover:bg-gray-750/50 border-dashed border-gray-200 hover:border-gray-300 hover:bg-gray-50/60 dark:border-gray-700/60 dark:hover:border-gray-600"}`,children:[s.jsx("kbd",{className:`flex h-5 w-5 flex-shrink-0 items-center justify-center rounded font-mono text-[10px] transition-all duration-150 ${A?"bg-blue-500 font-semibold text-white dark:bg-blue-500":"border border-gray-200 bg-gray-100 text-gray-400 group-hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-500 dark:group-hover:border-gray-600"}`,children:"0"}),s.jsx("span",{className:`text-[13px] leading-tight transition-colors ${A?"font-medium text-gray-900 dark:text-gray-100":"text-gray-500 dark:text-gray-400"}`,children:"Other..."}),A&&s.jsx("svg",{className:"ml-auto h-4 w-4 flex-shrink-0 text-blue-500 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2.5,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})})]}),A&&s.jsx("div",{className:"pl-[30px] pr-0.5",children:s.jsxs("div",{className:"relative",children:[s.jsx("input",{ref:b,type:"text",value:c.get(a)||"",onChange:K=>v(a,K.target.value),onKeyDown:K=>{K.key==="Enter"&&(K.preventDefault(),R?S():i(B=>B+1)),K.stopPropagation()},placeholder:"Type your answer...",className:"w-full rounded-lg border-0 bg-gray-50 px-3 py-1.5 text-[13px] text-gray-900 outline-none ring-1 ring-gray-200 transition-shadow duration-200 placeholder:text-gray-400 focus:ring-2 focus:ring-blue-400 dark:bg-gray-900/60 dark:text-gray-100 dark:ring-gray-700 dark:placeholder:text-gray-600 dark:focus:ring-blue-500"}),s.jsx("kbd",{className:"absolute right-2 top-1/2 -translate-y-1/2 rounded border border-gray-200 bg-gray-100 px-1 py-0.5 font-mono text-[9px] text-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-600",children:"Enter"})]})})]})}),s.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-gray-100 bg-gray-50/50 px-4 py-2 dark:border-gray-700/50 dark:bg-gray-800/50",children:[s.jsxs("button",{type:"button",onClick:E,className:"text-[11px] text-gray-400 transition-colors hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300",children:[_?"Skip":"Skip all",s.jsx("span",{className:"ml-1 text-[9px] text-gray-300 dark:text-gray-600",children:"Esc"})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[!_&&!N&&s.jsxs("button",{type:"button",onClick:()=>i(K=>K-1),className:"inline-flex items-center gap-0.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium text-gray-600 transition-all duration-150 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700/60",children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2,children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),R?s.jsxs("button",{type:"button",onClick:S,disabled:!F&&!Object.keys(w()).length,className:"inline-flex items-center gap-1 rounded-lg bg-gradient-to-r from-blue-600 to-blue-500 px-3.5 py-1.5 text-[11px] font-semibold text-white shadow-sm transition-all duration-200 hover:shadow-md disabled:cursor-not-allowed disabled:opacity-30 disabled:shadow-none dark:from-blue-500 dark:to-blue-600",children:["Submit",s.jsx("span",{className:"ml-0.5 font-mono text-[9px] opacity-70",children:"Enter"})]}):s.jsxs("button",{type:"button",onClick:()=>i(K=>K+1),className:"inline-flex items-center gap-1 rounded-lg bg-gradient-to-r from-blue-600 to-blue-500 px-3.5 py-1.5 text-[11px] font-semibold text-white shadow-sm transition-all duration-200 hover:shadow-md dark:from-blue-500 dark:to-blue-600",children:["Next",s.jsx("span",{className:"ml-0.5 font-mono text-[9px] opacity-70",children:"Enter"})]})]})]})]})})},EZ=({title:e,content:t,defaultOpen:n=!1,isStreaming:r=!1,showRawParameters:a=!1,rawContent:i,toolName:o})=>{const l=VP(),c=l?.pendingPermissionRequests.find(p=>p.toolName==="ExitPlanMode"||p.toolName==="exit_plan_mode"),d=()=>{c&&l&&l.handlePermissionDecision(c.requestId,{allow:!0})},u=()=>{c&&l&&l.handlePermissionDecision(c.requestId,{allow:!1,message:"User asked to revise the plan"})};return s.jsx(ki,{defaultOpen:n,children:s.jsxs(Z5,{className:"my-1 flex flex-col shadow-none",children:[s.jsxs(X5,{className:"flex flex-row items-start justify-between space-y-0 px-4 pb-0 pt-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vt,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),s.jsx(J5,{className:"text-sm font-semibold",children:r?s.jsx(vc,{children:e}):e})]}),s.jsxs(Pa,{className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",children:[s.jsx(QI,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Toggle plan"})]})]}),s.jsx(Si,{children:s.jsxs(Q5,{className:"px-4 pb-4 pt-3",children:[t?s.jsx(YC,{content:t,className:"prose prose-sm max-w-none dark:prose-invert"}):r?s.jsx("div",{className:"py-2",children:s.jsx(vc,{children:"Generating plan..."})}):null,a&&i&&s.jsxs(ki,{className:"mt-3",children:[s.jsxs(Pa,{className:"flex items-center gap-1.5 py-0.5 text-[11px] text-muted-foreground hover:text-foreground",children:[s.jsx("svg",{className:"h-2.5 w-2.5 flex-shrink-0 transition-transform duration-150 data-[state=open]:rotate-90",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),"raw params"]}),s.jsx(Si,{children:s.jsx("pre",{className:"mt-1 overflow-hidden whitespace-pre-wrap break-words rounded border border-border/40 bg-muted p-2 font-mono text-[11px] text-muted-foreground",children:i})})]})]})}),c&&s.jsxs(e4,{className:"justify-end gap-2 border-t border-border/40 px-4 pb-3 pt-3",children:[s.jsx(Pe,{variant:"ghost",size:"sm",onClick:u,className:"text-muted-foreground",children:"Revise"}),s.jsxs(Pe,{size:"sm",onClick:d,children:["Build"," ",s.jsx("kbd",{className:"ml-1 rounded bg-primary-foreground/20 px-1 py-0.5 font-mono text-[10px]",children:"⌘↩"})]})]})]})})};function NZ(e){return["Edit","Write","ApplyPatch"].includes(e)?"edit":["Grep","Glob"].includes(e)?"search":e==="Bash"?"bash":["TodoWrite","TodoRead"].includes(e)?"todo":["TaskCreate","TaskUpdate","TaskList","TaskGet"].includes(e)?"task":e==="Task"?"agent":e==="exit_plan_mode"||e==="ExitPlanMode"?"plan":e==="AskUserQuestion"?"question":"default"}const CZ=["user denied tool use","tool disallowed by settings","permission request timed out","permission request cancelled"];function TZ(e){if(!e)return"running";if(e.isError){const t=String(e.content||"").toLowerCase().trim();return CZ.some(n=>t.includes(n))?"denied":"error"}return"completed"}const Hm=f.memo(({toolName:e,toolInput:t,toolResult:n,toolId:r,mode:a,onFileOpen:i,createDiff:o,selectedProject:l,autoExpandTools:c=!1,showRawParameters:d=!1,rawToolInput:u,isSubagentContainer:p,subagentState:h})=>{const m=w3(e),g=a==="input"?m.input:m.result,b=f.useMemo(()=>{try{const v=a==="input"?t:n;return typeof v=="string"?JSON.parse(v):v}catch{return a==="input"?t:n}},[a,t,n]),x=f.useMemo(()=>a==="input"?TZ(n):void 0,[a,n]),y=f.useCallback(()=>{if(g?.action==="open-file"&&i){const v=g.getValue?.(b)||"";i(v)}},[g,b,i]);if(p&&h)return a==="result"?null:s.jsx(wB,{toolInput:t,toolResult:n,subagentState:h});if(!g)return null;if(g.type==="one-line"){const v=g.getValue?.(b)||"",w=g.getSecondary?.(b);return s.jsx(yB,{toolName:e,toolResult:n,toolId:r,icon:g.icon,label:g.label,value:v,secondary:w,action:g.action,onAction:y,style:g.style,wrapText:g.wrapText,colorScheme:g.colorScheme,resultId:a==="input"?`tool-result-${r}`:void 0,status:x!=="completed"?x:void 0})}if(g.type==="plan"){const v=typeof g.title=="function"?g.title(b):g.title||"Plan",w=g.getContentProps?.(b,{selectedProject:l,createDiff:o,onFileOpen:i})||{},S=a==="input"&&!n;return s.jsx(EZ,{title:v,content:w.content||"",defaultOpen:g.defaultOpen??c,isStreaming:S,showRawParameters:a==="input"&&d,rawContent:u,toolName:e,toolId:r})}if(g.type==="collapsible"){const v=typeof g.title=="function"?g.title(b):g.title||"Details",w=g.defaultOpen!==void 0?g.defaultOpen:c,S=g.getContentProps?.(b,{selectedProject:l,createDiff:o,onFileOpen:i})||{};let E=null;switch(g.contentType){case"diff":o&&(E=s.jsx(bB,{...S,createDiff:o,onFileClick:()=>i?.(S.filePath)}));break;case"markdown":E=s.jsx(YC,{content:S.content||""});break;case"file-list":E=s.jsx(fZ,{files:S.files||[],onFileClick:i,title:S.title});break;case"todo-list":S.todos?.length>0&&(E=s.jsx(xZ,{todos:S.todos,isResult:S.isResult}));break;case"task":E=s.jsx(vZ,{content:S.content||""});break;case"question-answer":E=s.jsx(kZ,{questions:S.questions||[],answers:S.answers||{}});break;case"text":E=s.jsx(wZ,{content:S.content||"",format:S.format||"plain"});break;case"success-message":{const _=g.getMessage?.(b)||"Success";E=s.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 dark:text-green-400",children:[s.jsx("svg",{className:"h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),_]});break}}const k=(e==="Edit"||e==="Write"||e==="ApplyPatch")&&S.filePath&&i?()=>i(S.filePath,{old_string:S.oldContent,new_string:S.newContent}):void 0,T=x&&x!=="completed"?s.jsx(fo,{status:x}):void 0;return s.jsx(vB,{toolName:e,toolId:r,title:v,defaultOpen:w,onTitleClick:k,badge:T,showRawParameters:a==="input"&&d,rawContent:u,toolCategory:NZ(e),children:E})}return null});Hm.displayName="ToolRenderer";const AZ=2e3,_Z=e=>{let t=e.replace(/\r\n/g,`
|
|
661
661
|
`);const n=[];return t=t.replace(/```[\w-]*\n([\s\S]*?)```/g,(r,a)=>{const i=`@@CODEBLOCK${n.length}@@`;return n.push(a.replace(/\n$/,"")),i}),t=t.replace(/`([^`]+)`/g,"$1"),t=t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,"$1"),t=t.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1"),t=t.replace(/^>\s?/gm,""),t=t.replace(/^#{1,6}\s+/gm,""),t=t.replace(/^[-*+]\s+/gm,""),t=t.replace(/^\d+\.\s+/gm,""),t=t.replace(/(\*\*|__)(.*?)\1/g,"$2"),t=t.replace(/(\*|_)(.*?)\1/g,"$2"),t=t.replace(/~~(.*?)~~/g,"$1"),t=t.replace(/<\/?[^>]+(>|$)/g,""),t=t.replace(/\n{3,}/g,`
|
|
662
662
|
|
|
663
|
-
`),t=t.replace(/@@CODEBLOCK(\d+)@@/g,(r,a)=>n[Number(a)]??""),t.trim()},yp=({content:e,messageType:t})=>{const{t:n}=Re("chat"),r=t==="assistant",a=r?"markdown":"text",[i,o]=f.useState(a),[l,c]=f.useState(!1),[d,u]=f.useState(!1),p=f.useRef(null),h=f.useRef(null),m=f.useMemo(()=>[{format:"markdown",label:n("copyMessage.copyAsMarkdown",{defaultValue:"Copy as markdown"})},{format:"text",label:n("copyMessage.copyAsText",{defaultValue:"Copy as text"})}],[n]),g=i==="markdown"?n("copyMessage.markdownShort",{defaultValue:"MD"}):n("copyMessage.textShort",{defaultValue:"TXT"}),b=f.useMemo(()=>i==="markdown"?e:_Z(e),[e,i]);f.useEffect(()=>{o(a),u(!1)},[a]),f.useEffect(()=>{const E=k=>{if(!d)return;const T=k.target;p.current&&!p.current.contains(T)&&u(!1)};return window.addEventListener("mousedown",E),()=>{window.removeEventListener("mousedown",E)}},[d]),f.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const x=async()=>{!b.trim()||!await gr(b)||(c(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{c(!1)},AZ))},y=E=>{o(E),u(!1)},v=t==="user"?"text-blue-100 hover:text-white":"text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300",w=n(l?"copyMessage.copied":"copyMessage.copy"),S=r?"relative flex min-w-0 flex-1 items-center gap-0.5 sm:min-w-max sm:flex-none sm:w-auto":"relative flex items-center gap-0.5";return s.jsxs("div",{ref:p,className:S,children:[s.jsxs("button",{type:"button",onClick:x,title:w,"aria-label":w,className:`inline-flex items-center gap-1 rounded px-1 py-0.5 transition-colors ${v}`,children:[l?s.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):s.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),s.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide",children:g})]}),r&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onClick:()=>u(E=>!E),className:`rounded px-1 py-0.5 transition-colors ${v}`,"aria-label":n("copyMessage.selectFormat",{defaultValue:"Select copy format"}),title:n("copyMessage.selectFormat",{defaultValue:"Select copy format"}),children:s.jsx("svg",{className:`h-3 w-3 transition-transform ${d?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),d&&s.jsx("div",{className:"absolute left-auto top-full z-30 mt-1 min-w-36 rounded-md border border-gray-200 bg-white p-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:m.map(E=>{const k=E.format===i;return s.jsx("button",{type:"button",onClick:()=>y(E.format),className:`block w-full rounded px-2 py-1.5 text-left transition-colors ${k?"bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-700 hover:bg-gray-50 dark:text-gray-300 dark:hover:bg-gray-800/60"}`,children:s.jsx("span",{className:"block text-xs font-medium",children:E.label})},E.format)})})]})]})},IZ=new Set(["Bash","Edit","Write","ApplyPatch"]),jZ=f.memo(({message:e,prevMessage:t,createDiff:n,onFileOpen:r,onShowSettings:a,onGrantToolPermission:i,autoExpandTools:o,showRawParameters:l,showThinking:c,selectedProject:d,provider:u})=>{const{t:p}=Re("chat"),h=t&&t.type===e.type&&(t.type==="assistant"||t.type==="user"||t.type==="tool"||t.type==="error"),m=f.useRef(null),[g,b]=f.useState(!1),x=fz(e,u),[y,v]=f.useState("idle"),w=String(e.content||""),S=f.useMemo(()=>ZE(String(e.content||"")),[e.content]),E=e.isToolUse?String(e.displayText||e.content||""):S,k=!!(e.isToolUse&&IZ.has(String(e.toolName||""))),T=e.type==="user"&&w.trim().length>0,_=e.type==="assistant"&&E.trim().length>0&&!k&&!e.isThinking;f.useEffect(()=>{v("idle")},[x?.entry,e.toolId]),f.useEffect(()=>{const O=m.current;if(!o||!O||!e.isToolUse)return;const A=new IntersectionObserver(R=>{R.forEach(N=>{N.isIntersecting&&!g&&(b(!0),O.querySelectorAll("details").forEach(K=>{K.open=!0}))})},{threshold:.1});return A.observe(O),()=>{A.unobserve(O)}},[o,g,e.isToolUse]);const C=f.useMemo(()=>new Date(e.timestamp).toLocaleTimeString(),[e.timestamp]);return e.isThinking&&!c?null:s.jsx("div",{ref:m,"data-message-timestamp":e.timestamp||void 0,className:`chat-message ${e.type} ${h?"grouped":""} ${e.type==="user"?"flex justify-end px-3 sm:px-0":"px-3 sm:px-0"}`,children:e.type==="user"?s.jsxs("div",{className:"flex w-full items-end space-x-0 sm:w-auto sm:max-w-[85%] sm:space-x-3 md:max-w-md lg:max-w-lg xl:max-w-xl",children:[s.jsxs("div",{className:"group flex-1 rounded-2xl rounded-br-md bg-blue-600 px-3 py-2 text-white shadow-sm sm:flex-initial sm:px-4",children:[s.jsx("div",{className:"whitespace-pre-wrap break-words text-sm",children:e.content}),e.images&&e.images.length>0&&s.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:e.images.map((O,A)=>s.jsx("img",{src:O.data,alt:O.name,className:"h-auto max-w-full cursor-pointer rounded-lg transition-opacity hover:opacity-90",onClick:()=>window.open(O.data,"_blank")},O.name||A))}),s.jsxs("div",{className:"mt-1 flex items-center justify-end gap-1 text-xs text-blue-100",children:[T&&s.jsx(yp,{content:w,messageType:"user"}),s.jsx("span",{children:C})]})]}),!h&&s.jsx("div",{className:"hidden h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-blue-600 text-sm text-white sm:flex",children:"U"})]}):e.isTaskNotification?s.jsx("div",{className:"w-full",children:s.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[s.jsx("span",{className:`inline-block h-1.5 w-1.5 flex-shrink-0 rounded-full ${e.taskStatus==="completed"?"bg-green-400 dark:bg-green-500":"bg-amber-400 dark:bg-amber-500"}`}),s.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e.content})]})}):s.jsxs("div",{className:"w-full",children:[!h&&s.jsxs("div",{className:"mb-2 flex items-center space-x-3",children:[e.type==="error"?s.jsx("div",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-red-600 text-sm text-white",children:"!"}):e.type==="tool"?s.jsx("div",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-gray-600 text-sm text-white dark:bg-gray-700",children:"🔧"}):s.jsx("div",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full p-1 text-sm text-white",children:s.jsx(Rn,{provider:u,className:"h-full w-full"})}),s.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:e.type==="error"?p("messageTypes.error"):e.type==="tool"?p("messageTypes.tool"):u==="cursor"?p("messageTypes.cursor"):u==="codex"?p("messageTypes.codex"):u==="gemini"?p("messageTypes.gemini"):u==="qwen"?p("messageTypes.qwen",{defaultValue:"Qwen Code"}):p("messageTypes.claude")})]}),s.jsxs("div",{className:"w-full",children:[e.isToolUse?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-col",children:s.jsx("div",{className:"flex flex-col",children:s.jsx(bo,{className:"prose prose-sm max-w-none dark:prose-invert",children:String(e.displayText||"")})})}),e.toolInput&&s.jsx(Hm,{toolName:e.toolName||"UnknownTool",toolInput:e.toolInput,toolResult:e.toolResult,toolId:e.toolId,mode:"input",onFileOpen:r,createDiff:n,selectedProject:d,autoExpandTools:o,showRawParameters:l,rawToolInput:typeof e.toolInput=="string"?e.toolInput:void 0,isSubagentContainer:e.isSubagentContainer,subagentState:e.subagentState}),e.toolResult&&!gB(e.toolName||"UnknownTool",e.toolResult)&&(e.toolResult.isError?s.jsxs("div",{id:`tool-result-${e.toolId}`,className:"relative mt-2 scroll-mt-4 rounded border border-red-200/60 bg-red-50/50 p-3 dark:border-red-800/40 dark:bg-red-950/10",children:[s.jsxs("div",{className:"relative mb-2 flex items-center gap-1.5",children:[s.jsx("svg",{className:"h-4 w-4 text-red-500 dark:text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),s.jsx("span",{className:"text-xs font-medium text-red-700 dark:text-red-300",children:p("messageTypes.error")})]}),s.jsxs("div",{className:"relative text-sm text-red-900 dark:text-red-100",children:[s.jsx(bo,{className:"prose prose-sm prose-red max-w-none dark:prose-invert",children:String(e.toolResult.content||"")}),x&&s.jsxs("div",{className:"mt-4 border-t border-red-200/60 pt-3 dark:border-red-800/60",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{if(!i)return;i(x)?.success?v("granted"):v("error")},disabled:x.isAllowed||y==="granted",className:`inline-flex items-center gap-2 rounded-md border px-3 py-1.5 text-xs font-medium transition-colors ${x.isAllowed||y==="granted"?"cursor-default border-green-300/70 bg-green-100 text-green-800 dark:border-green-800/60 dark:bg-green-900/30 dark:text-green-200":"border-red-300/70 bg-white/80 text-red-700 hover:bg-white dark:border-red-800/60 dark:bg-gray-900/40 dark:text-red-200 dark:hover:bg-gray-900/70"}`,children:x.isAllowed||y==="granted"?p("permissions.added"):p("permissions.grant",{tool:x.toolName})}),a&&s.jsx("button",{type:"button",onClick:O=>{O.stopPropagation(),a()},className:"text-xs text-red-700 underline hover:text-red-800 dark:text-red-200 dark:hover:text-red-100",children:p("permissions.openSettings")})]}),s.jsx("div",{className:"mt-2 text-xs text-red-700/90 dark:text-red-200/80",children:p("permissions.addTo",{entry:x.entry})}),y==="error"&&s.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:p("permissions.error")}),(x.isAllowed||y==="granted")&&s.jsx("div",{className:"mt-2 text-xs text-green-700 dark:text-green-200",children:p("permissions.retry")})]})]})]}):s.jsx("div",{id:`tool-result-${e.toolId}`,className:"scroll-mt-4",children:s.jsx(Hm,{toolName:e.toolName||"UnknownTool",toolInput:e.toolInput,toolResult:e.toolResult,toolId:e.toolId,mode:"result",onFileOpen:r,createDiff:n,selectedProject:d,autoExpandTools:o})}))]}):e.isInteractivePrompt?s.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"mt-0.5 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-amber-500",children:s.jsx("svg",{className:"h-5 w-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"mb-3 text-base font-semibold text-amber-900 dark:text-amber-100",children:p("interactive.title")}),(()=>{const O=(e.content||"").split(`
|
|
663
|
+
`),t=t.replace(/@@CODEBLOCK(\d+)@@/g,(r,a)=>n[Number(a)]??""),t.trim()},yp=({content:e,messageType:t})=>{const{t:n}=Re("chat"),r=t==="assistant",a=r?"markdown":"text",[i,o]=f.useState(a),[l,c]=f.useState(!1),[d,u]=f.useState(!1),p=f.useRef(null),h=f.useRef(null),m=f.useMemo(()=>[{format:"markdown",label:n("copyMessage.copyAsMarkdown",{defaultValue:"Copy as markdown"})},{format:"text",label:n("copyMessage.copyAsText",{defaultValue:"Copy as text"})}],[n]),g=i==="markdown"?n("copyMessage.markdownShort",{defaultValue:"MD"}):n("copyMessage.textShort",{defaultValue:"TXT"}),b=f.useMemo(()=>i==="markdown"?e:_Z(e),[e,i]);f.useEffect(()=>{o(a),u(!1)},[a]),f.useEffect(()=>{const E=k=>{if(!d)return;const T=k.target;p.current&&!p.current.contains(T)&&u(!1)};return window.addEventListener("mousedown",E),()=>{window.removeEventListener("mousedown",E)}},[d]),f.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const x=async()=>{!b.trim()||!await gr(b)||(c(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{c(!1)},AZ))},y=E=>{o(E),u(!1)},v=t==="user"?"text-blue-100 hover:text-white":"text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300",w=n(l?"copyMessage.copied":"copyMessage.copy"),S=r?"relative flex min-w-0 flex-1 items-center gap-0.5 sm:min-w-max sm:flex-none sm:w-auto":"relative flex items-center gap-0.5";return s.jsxs("div",{ref:p,className:S,children:[s.jsxs("button",{type:"button",onClick:x,title:w,"aria-label":w,className:`inline-flex items-center gap-1 rounded px-1 py-0.5 transition-colors ${v}`,children:[l?s.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:s.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):s.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),s.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide",children:g})]}),r&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onClick:()=>u(E=>!E),className:`rounded px-1 py-0.5 transition-colors ${v}`,"aria-label":n("copyMessage.selectFormat",{defaultValue:"Select copy format"}),title:n("copyMessage.selectFormat",{defaultValue:"Select copy format"}),children:s.jsx("svg",{className:`h-3 w-3 transition-transform ${d?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),d&&s.jsx("div",{className:"absolute left-auto top-full z-30 mt-1 min-w-36 rounded-md border border-gray-200 bg-white p-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:m.map(E=>{const k=E.format===i;return s.jsx("button",{type:"button",onClick:()=>y(E.format),className:`block w-full rounded px-2 py-1.5 text-left transition-colors ${k?"bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-700 hover:bg-gray-50 dark:text-gray-300 dark:hover:bg-gray-800/60"}`,children:s.jsx("span",{className:"block text-xs font-medium",children:E.label})},E.format)})})]})]})},IZ=new Set(["Bash","Edit","Write","ApplyPatch"]),jZ=f.memo(({message:e,prevMessage:t,createDiff:n,onFileOpen:r,onShowSettings:a,onGrantToolPermission:i,autoExpandTools:o,showRawParameters:l,showThinking:c,selectedProject:d,provider:u})=>{const{t:p}=Re("chat"),h=t&&t.type===e.type&&(t.type==="assistant"||t.type==="user"||t.type==="tool"||t.type==="error"),m=f.useRef(null),[g,b]=f.useState(!1),x=fz(e,u),[y,v]=f.useState("idle"),w=String(e.content||""),S=f.useMemo(()=>ZE(String(e.content||"")),[e.content]),E=e.isToolUse?String(e.displayText||e.content||""):S,k=!!(e.isToolUse&&IZ.has(String(e.toolName||""))),T=e.type==="user"&&w.trim().length>0,_=e.type==="assistant"&&E.trim().length>0&&!k&&!e.isThinking;f.useEffect(()=>{v("idle")},[x?.entry,e.toolId]),f.useEffect(()=>{const O=m.current;if(!o||!O||!e.isToolUse)return;const A=new IntersectionObserver(R=>{R.forEach(N=>{N.isIntersecting&&!g&&(b(!0),O.querySelectorAll("details").forEach(K=>{K.open=!0}))})},{threshold:.1});return A.observe(O),()=>{A.unobserve(O)}},[o,g,e.isToolUse]);const C=f.useMemo(()=>new Date(e.timestamp).toLocaleTimeString(),[e.timestamp]);return e.isThinking&&!c?null:s.jsx("div",{ref:m,"data-message-timestamp":e.timestamp||void 0,className:`chat-message ${e.type} ${h?"grouped":""} ${e.type==="user"?"flex justify-end px-3 sm:px-0":"px-3 sm:px-0"}`,children:e.type==="user"?s.jsxs("div",{className:"flex w-full items-end space-x-0 sm:w-auto sm:max-w-[85%] sm:space-x-3 md:max-w-md lg:max-w-lg xl:max-w-xl",children:[s.jsxs("div",{className:"group flex-1 rounded-2xl rounded-br-md bg-blue-600 px-3 py-2 text-white shadow-sm sm:flex-initial sm:px-4",children:[s.jsx("div",{className:"whitespace-pre-wrap break-words text-sm",children:e.content}),e.images&&e.images.length>0&&s.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:e.images.map((O,A)=>s.jsx("img",{src:O.data,alt:O.name,className:"h-auto max-w-full cursor-pointer rounded-lg transition-opacity hover:opacity-90",onClick:()=>window.open(O.data,"_blank")},O.name||A))}),s.jsxs("div",{className:"mt-1 flex items-center justify-end gap-1 text-xs text-blue-100",children:[T&&s.jsx(yp,{content:w,messageType:"user"}),s.jsx("span",{children:C})]})]}),!h&&s.jsx("div",{className:"hidden h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-blue-600 text-sm text-white sm:flex",children:"U"})]}):e.isTaskNotification?s.jsx("div",{className:"w-full",children:s.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[s.jsx("span",{className:`inline-block h-1.5 w-1.5 flex-shrink-0 rounded-full ${e.taskStatus==="completed"?"bg-green-400 dark:bg-green-500":"bg-amber-400 dark:bg-amber-500"}`}),s.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e.content})]})}):s.jsxs("div",{className:"w-full",children:[!h&&s.jsxs("div",{className:"mb-2 flex items-center space-x-3",children:[e.type==="error"?s.jsx("div",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-red-600 text-sm text-white",children:"!"}):e.type==="tool"?s.jsx("div",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-gray-600 text-sm text-white dark:bg-gray-700",children:"🔧"}):s.jsx("div",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full p-1 text-sm text-white",children:s.jsx(Rn,{provider:u,className:"h-full w-full"})}),s.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:e.type==="error"?p("messageTypes.error"):e.type==="tool"?p("messageTypes.tool"):u==="cursor"?p("messageTypes.cursor"):u==="codex"?p("messageTypes.codex"):u==="gemini"?p("messageTypes.gemini"):u==="qwen"?p("messageTypes.qwen",{defaultValue:"Qwen Code"}):u==="opencode"?p("messageTypes.opencode",{defaultValue:"OpenCode"}):p("messageTypes.claude")})]}),s.jsxs("div",{className:"w-full",children:[e.isToolUse?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-col",children:s.jsx("div",{className:"flex flex-col",children:s.jsx(bo,{className:"prose prose-sm max-w-none dark:prose-invert",children:String(e.displayText||"")})})}),e.toolInput&&s.jsx(Hm,{toolName:e.toolName||"UnknownTool",toolInput:e.toolInput,toolResult:e.toolResult,toolId:e.toolId,mode:"input",onFileOpen:r,createDiff:n,selectedProject:d,autoExpandTools:o,showRawParameters:l,rawToolInput:typeof e.toolInput=="string"?e.toolInput:void 0,isSubagentContainer:e.isSubagentContainer,subagentState:e.subagentState}),e.toolResult&&!gB(e.toolName||"UnknownTool",e.toolResult)&&(e.toolResult.isError?s.jsxs("div",{id:`tool-result-${e.toolId}`,className:"relative mt-2 scroll-mt-4 rounded border border-red-200/60 bg-red-50/50 p-3 dark:border-red-800/40 dark:bg-red-950/10",children:[s.jsxs("div",{className:"relative mb-2 flex items-center gap-1.5",children:[s.jsx("svg",{className:"h-4 w-4 text-red-500 dark:text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),s.jsx("span",{className:"text-xs font-medium text-red-700 dark:text-red-300",children:p("messageTypes.error")})]}),s.jsxs("div",{className:"relative text-sm text-red-900 dark:text-red-100",children:[s.jsx(bo,{className:"prose prose-sm prose-red max-w-none dark:prose-invert",children:String(e.toolResult.content||"")}),x&&s.jsxs("div",{className:"mt-4 border-t border-red-200/60 pt-3 dark:border-red-800/60",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>{if(!i)return;i(x)?.success?v("granted"):v("error")},disabled:x.isAllowed||y==="granted",className:`inline-flex items-center gap-2 rounded-md border px-3 py-1.5 text-xs font-medium transition-colors ${x.isAllowed||y==="granted"?"cursor-default border-green-300/70 bg-green-100 text-green-800 dark:border-green-800/60 dark:bg-green-900/30 dark:text-green-200":"border-red-300/70 bg-white/80 text-red-700 hover:bg-white dark:border-red-800/60 dark:bg-gray-900/40 dark:text-red-200 dark:hover:bg-gray-900/70"}`,children:x.isAllowed||y==="granted"?p("permissions.added"):p("permissions.grant",{tool:x.toolName})}),a&&s.jsx("button",{type:"button",onClick:O=>{O.stopPropagation(),a()},className:"text-xs text-red-700 underline hover:text-red-800 dark:text-red-200 dark:hover:text-red-100",children:p("permissions.openSettings")})]}),s.jsx("div",{className:"mt-2 text-xs text-red-700/90 dark:text-red-200/80",children:p("permissions.addTo",{entry:x.entry})}),y==="error"&&s.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:p("permissions.error")}),(x.isAllowed||y==="granted")&&s.jsx("div",{className:"mt-2 text-xs text-green-700 dark:text-green-200",children:p("permissions.retry")})]})]})]}):s.jsx("div",{id:`tool-result-${e.toolId}`,className:"scroll-mt-4",children:s.jsx(Hm,{toolName:e.toolName||"UnknownTool",toolInput:e.toolInput,toolResult:e.toolResult,toolId:e.toolId,mode:"result",onFileOpen:r,createDiff:n,selectedProject:d,autoExpandTools:o})}))]}):e.isInteractivePrompt?s.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"mt-0.5 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-amber-500",children:s.jsx("svg",{className:"h-5 w-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h4",{className:"mb-3 text-base font-semibold text-amber-900 dark:text-amber-100",children:p("interactive.title")}),(()=>{const O=(e.content||"").split(`
|
|
664
664
|
`).filter(N=>N.trim()),A=O.find(N=>N.includes("?"))||O[0]||"",R=[];return O.forEach(N=>{const F=N.match(/[❯\s]*(\d+)\.\s+(.+)/);if(F){const K=N.includes("❯");R.push({number:F[1],text:F[2].trim(),isSelected:K})}}),s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"mb-4 text-sm text-amber-800 dark:text-amber-200",children:A}),s.jsx("div",{className:"mb-4 space-y-2",children:R.map(N=>s.jsx("button",{className:`w-full rounded-lg border-2 px-4 py-3 text-left transition-all ${N.isSelected?"border-amber-600 bg-amber-600 text-white shadow-md dark:border-amber-700 dark:bg-amber-700":"border-amber-300 bg-white text-amber-900 dark:border-amber-700 dark:bg-gray-800 dark:text-amber-100"} cursor-not-allowed opacity-75`,disabled:!0,children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:`flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full text-sm font-bold ${N.isSelected?"bg-white/20":"bg-amber-100 dark:bg-amber-800/50"}`,children:N.number}),s.jsx("span",{className:"flex-1 text-sm font-medium sm:text-base",children:N.text}),N.isSelected&&s.jsx("span",{className:"text-lg",children:"❯"})]})},N.number))}),s.jsxs("div",{className:"rounded-lg bg-amber-100 p-3 dark:bg-amber-800/30",children:[s.jsx("p",{className:"mb-1 text-sm font-medium text-amber-900 dark:text-amber-100",children:p("interactive.waiting")}),s.jsx("p",{className:"text-xs text-amber-800 dark:text-amber-200",children:p("interactive.instruction")})]})]})})()]})]})}):e.isThinking?s.jsxs(Gp,{defaultOpen:!1,children:[s.jsx(Hp,{}),s.jsxs(qp,{children:[s.jsx(bo,{className:"prose prose-sm prose-gray max-w-none dark:prose-invert",children:e.content}),s.jsx("div",{className:"mt-3 flex items-center text-[11px]",children:s.jsx(yp,{content:String(e.content||""),messageType:"assistant"})})]})]}):s.jsxs("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:[c&&e.reasoning&&s.jsxs(Gp,{className:"mb-3",defaultOpen:!1,children:[s.jsx(Hp,{}),s.jsx(qp,{children:s.jsx("div",{className:"whitespace-pre-wrap",children:e.reasoning})})]}),(()=>{const O=S,A=O.trim();if((A.startsWith("{")||A.startsWith("["))&&(A.endsWith("}")||A.endsWith("]")))try{const R=JSON.parse(A),N=JSON.stringify(R,null,2);return s.jsxs("div",{className:"my-2",children:[s.jsxs("div",{className:"mb-2 flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400",children:[s.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}),s.jsx("span",{className:"font-medium",children:p("json.response")})]}),s.jsx("div",{className:"overflow-hidden rounded-lg border border-gray-600/30 bg-gray-800 dark:border-gray-700 dark:bg-gray-900",children:s.jsx("pre",{className:"overflow-x-auto p-4",children:s.jsx("code",{className:"block whitespace-pre font-mono text-sm text-gray-100 dark:text-gray-200",children:N})})})]})}catch{}return e.type==="assistant"?s.jsx(bo,{className:"prose prose-sm prose-gray max-w-none dark:prose-invert",children:O}):s.jsx("div",{className:"whitespace-pre-wrap",children:O})})()]}),(_||!h)&&s.jsxs("div",{className:"mt-1 flex w-full items-center gap-2 text-[11px] text-gray-400 dark:text-gray-500",children:[_&&s.jsx(yp,{content:E,messageType:"assistant"}),!h&&s.jsx("span",{children:C})]})]})]})})});function RZ(e,t){const[n,r]=f.useState(t),[a,i]=f.useState(!1),[o,l]=f.useState(null),[c,d]=f.useState(null),u=f.useCallback(async(p={})=>{i(!0),l(null);try{const h=p.force?"?refresh=1":"",m=await we(`/api/providers/${e}/models${h}`),g=await m.json().catch(()=>({}));if(!m.ok||!g?.success)throw new Error(g?.error||`HTTP ${m.status}`);const b=g.data;Array.isArray(b.models)&&b.models.length>0&&r(b.models),d(b.fetchedAt??null),b.error&&l(b.error)}catch(h){l(h?.message||"Failed to load models")}finally{i(!1)}},[e]);return f.useEffect(()=>{u()},[e]),{models:n,loading:a,error:o,fetchedAt:c,refresh:()=>u({force:!0})}}const Gl=`# Product Requirements Document
|
|
665
665
|
|
|
666
666
|
## 1. Overview
|