@jait/gateway 0.1.57 → 0.1.59
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/routes/git.d.ts.map +1 -1
- package/dist/routes/git.js +13 -2
- package/dist/routes/git.js.map +1 -1
- package/package.json +1 -1
- package/web-dist/assets/{index-BB0gb2hP.js → index-CoSLAPwx.js} +4 -4
- package/web-dist/assets/{index-BT-CLHSC.js → index-IfvhKb-G.js} +2 -2
- package/web-dist/assets/{web-CWbJD9Q_.js → web-O2m6Vb7d.js} +1 -1
- package/web-dist/index.html +6 -6
|
@@ -638,7 +638,7 @@ Referenced files:
|
|
|
638
638
|
`,n=e.indexOf(t);if(n===-1)return{text:e,files:[]};const r=e.slice(0,n).trimEnd(),i=e.slice(n+t.length),o=[];for(const a of i.split(`
|
|
639
639
|
`)){const u=a.match(/^- (.+)$/);if(u){const d=u[1].trim();o.push({path:d,name:d.split("/").pop()??d})}}return{text:r,files:o}}function YE(e){return e?"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-code:before:content-none prose-code:after:content-none prose-sm prose-p:leading-normal":"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-code:before:content-none prose-code:after:content-none prose-base prose-p:leading-relaxed"}const LY=({blockMatch:e})=>c.jsx(zE,{remarkPlugins:[$E],children:e.output});function zY({content:e,compact:t}){return c.jsx("div",{className:YE(t),children:c.jsx(zE,{remarkPlugins:[$E],children:e})})}function $Y({content:e,compact:t}){const{blockMatches:n}=Uq({llmOutput:e,blocks:[],fallbackBlock:{component:LY,lookBack:Aq()},isStreamFinished:!1});return c.jsx("div",{className:YE(t),children:n.map((r,i)=>{const o=r.block.component;return c.jsx(o,{blockMatch:r},i)})})}function o6({content:e,compact:t,isStreaming:n,preferLlmUi:r}){return r&&n?c.jsx($Y,{content:e,compact:t}):c.jsx(zY,{content:e,compact:t})}function l6({messageId:e,messageIndex:t,messageFromEnd:n,role:r,content:i,displayContent:o,referencedFiles:a,thinking:u,thinkingDuration:d,toolCalls:h,segments:y,isStreaming:p,compact:v,preferLlmUi:b,onOpenTerminal:w,onEditMessage:S}){const C=r==="user",{userDisplayText:j,userFiles:E}=g.useMemo(()=>{if(!C)return{userDisplayText:i,userFiles:[]};if(o)return{userDisplayText:o,userFiles:a??[]};const te=DY(i);return{userDisplayText:te.text,userFiles:te.files}},[C,i,o,a]),[N,P]=g.useState(!1),[I,R]=g.useState(!1),[$,X]=g.useState(j),[G,D]=g.useState(!1),[q,F]=g.useState(!1),[V,W]=g.useState(null),L=g.useRef(null),O=g.useRef(null);g.useEffect(()=>()=>{L.current!==null&&window.clearTimeout(L.current)},[]),g.useEffect(()=>{I||X(j)},[j,I]);const H=()=>{var re;const te=[];if(h&&h.length>0)for(const J of h){const Y=J.tool.replace(/_/g,"."),ce=Object.entries(J.args).filter(([,Oe])=>Oe!=null&&Oe!=="").map(([Oe,Be])=>`${Oe}: ${typeof Be=="string"?Be:JSON.stringify(Be)}`).join(", "),ke=J.status==="success"?"✓":J.status==="error"?"✗":"…",je=J.completedAt&&J.startedAt?`${((J.completedAt-J.startedAt)/1e3).toFixed(1)}s`:"";if(te.push(`[${ke} ${Y}] ${ce}`),(re=J.result)!=null&&re.message){const Oe=J.result.message.length>500?J.result.message.slice(0,500)+"…":J.result.message;te.push(Oe)}je&&te.push(`Duration: ${je}`),te.push("")}return i&&te.push(i),te.join(`
|
|
640
640
|
`).trim()},B=async()=>{const te=H();if(te){try{await navigator.clipboard.writeText(te)}catch{const re=document.createElement("textarea");re.value=te,re.style.position="fixed",re.style.opacity="0",document.body.appendChild(re),re.focus(),re.select(),document.execCommand("copy"),document.body.removeChild(re)}P(!0),L.current!==null&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>P(!1),1200)}},U=C&&!!e&&!!S,A=U,M=()=>{var re;const te=(re=O.current)==null?void 0:re.getBoundingClientRect().width;te&&Number.isFinite(te)?W(Math.round(te)):W(null),X(i),R(!0)},Q=async te=>{if(!U||!e||!S)return;const re=te.trim();re&&await S(e,re,t,n)},T=async()=>{D(!0);try{await Q($),R(!1)}finally{D(!1)}},ie=async()=>{if(A){F(!0);try{await Q(i)}finally{F(!1)}}},oe=()=>!i||I?null:c.jsxs("div",{className:Ae("absolute bottom-1.5 right-1.5 z-10 flex items-center gap-1 rounded-md border bg-background/90 p-0.5 shadow-sm","opacity-0 transition-opacity group-hover/message:opacity-100 focus-within:opacity-100",N&&"opacity-100"),children:[U&&c.jsx(Ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:M,"aria-label":"Edit message",title:"Edit message",children:c.jsx(w7,{className:"h-3.5 w-3.5"})}),A&&c.jsx(Ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:te=>{te.preventDefault(),te.stopPropagation(),ie()},disabled:q,"aria-label":"Retry from this message",title:"Retry from this message",children:c.jsx(BR,{className:Ae("h-3.5 w-3.5",q&&"animate-spin")})}),c.jsx(Ee,{type:"button",variant:"ghost",size:"icon",onClick:B,className:"h-6 w-6 rounded-sm","aria-label":N?"Copied":"Copy message",title:N?"Copied":"Copy message",children:N?c.jsx(zr,{className:"h-3.5 w-3.5"}):c.jsx(n1,{className:"h-3.5 w-3.5"})})]});return c.jsx("div",{className:Ae("group/message flex gap-3",v?"py-2":"py-4",C&&"justify-end"),children:c.jsxs("div",{className:Ae("max-w-[85%] space-y-2",C&&"order-1"),children:[!C&&u&&c.jsx(gY,{content:u,isStreaming:!!p&&!i,duration:d}),!C&&y&&y.length>0?c.jsxs(c.Fragment,{children:[y.map((te,re)=>{if(te.type==="toolGroup"){const J=(h??[]).filter(Y=>te.callIds.includes(Y.callId));return J.length>0?c.jsx(s6,{calls:J,onOpenTerminal:w},`tg-${re}`):null}return te.content.trim()?c.jsx("div",{children:c.jsx(o6,{content:te.content,compact:v,isStreaming:!!p&&re===y.length-1,preferLlmUi:b})},`ts-${re}`):null}),p&&!i&&!y.some(te=>te.type==="text"&&te.content.trim())&&c.jsxs("div",{className:"flex gap-1 py-2",children:[c.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:0ms]"}),c.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:150ms]"}),c.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:300ms]"})]}),oe()]}):c.jsxs(c.Fragment,{children:[h&&h.length>0&&c.jsx(s6,{calls:h,onOpenTerminal:w}),i?C&&I?c.jsxs("div",{className:"max-w-full rounded-lg border bg-muted/40 p-3",style:V?{width:`${V}px`}:void 0,children:[c.jsx("textarea",{value:$,onChange:te=>X(te.target.value),rows:Math.max(3,Math.min(10,$.split(`
|
|
641
|
-
`).length+1)),className:"w-full resize-y rounded-md border bg-background p-2 text-sm leading-relaxed focus:outline-none focus:ring-1 focus:ring-ring"}),c.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[c.jsx(Ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{R(!1),X(i),W(null)},disabled:G,children:"Cancel"}),c.jsx(Ee,{type:"button",size:"sm",onClick:()=>{T()},disabled:G||!$.trim(),children:G?"Sending…":"Send"})]})]}):C?c.jsxs("div",{ref:O,className:Ae("relative rounded-lg px-4 py-3 bg-muted",v?"text-sm leading-normal":"text-base leading-relaxed"),children:[c.jsx("div",{className:"whitespace-pre-wrap",children:j}),E.length>0&&c.jsx("div",{className:"flex flex-wrap gap-1 mt-2 pt-2 border-t border-foreground/5",children:E.map(te=>c.jsxs("span",{className:"inline-flex items-center gap-1 text-[12px] leading-tight px-1.5 py-0.5 rounded bg-background/60 text-muted-foreground select-none",title:te.path,children:[c.jsx(cl,{filename:te.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"truncate max-w-[180px]",children:te.name})]},te.path))}),oe()]}):c.jsxs("div",{className:"relative",children:[c.jsx(o6,{content:i,compact:v,isStreaming:p,preferLlmUi:b}),oe()]}):p&&!u?c.jsxs("div",{className:"flex gap-1 py-2",children:[c.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:0ms]"}),c.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:150ms]"}),c.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:300ms]"})]}):null]})]})})}const Nv=[{value:"ask",label:"Ask",icon:b7,description:"Read-only — questions, explanations, analysis"},{value:"agent",label:"Agent",icon:f2,description:"Full agentic — reads, writes, runs commands"},{value:"plan",label:"Plan",icon:yR,description:"Propose changes — review before executing"}];function IY({mode:e,onChange:t,disabled:n,className:r}){const i=Nv.find(a=>a.value===e)??Nv[1],o=i.icon;return c.jsxs(bl,{children:[c.jsx(xl,{asChild:!0,disabled:n,children:c.jsxs("button",{type:"button",className:Ae("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",r),title:`Mode: ${i.label}`,children:[c.jsx(o,{className:"h-4 w-4"}),c.jsx("span",{children:i.label}),c.jsx(Ss,{className:"h-3 w-3 opacity-60"})]})}),c.jsx(ao,{align:"start",side:"top",className:"w-64",children:Nv.map(a=>{const u=a.icon,d=e===a.value;return c.jsxs(Yi,{onClick:()=>t(a.value),className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[c.jsx(u,{className:"h-4 w-4 mt-0.5 shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-sm font-medium",children:a.label}),c.jsx("div",{className:"text-xs text-muted-foreground",children:a.description})]}),d&&c.jsx(zr,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"})]},a.value)})})]})}const Tv=[{value:"developer",label:"Developer",icon:W_,description:"Chat with the AI assistant — ask, plan, and execute"},{value:"manager",label:"Manager",icon:K_,description:"Automation — delegate tasks to agent threads on repos"}];function BY({mode:e,onChange:t,disabled:n,className:r,compact:i=!1}){const o=Tv.find(u=>u.value===e)??Tv[0],a=o.icon;return c.jsxs(bl,{children:[c.jsx(xl,{asChild:!0,disabled:n,children:c.jsxs("button",{type:"button",className:Ae("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",r),title:`Mode: ${o.label}`,"aria-label":`Mode: ${o.label}`,children:[c.jsx(a,{className:"h-4 w-4"}),!i&&c.jsx("span",{children:o.label}),c.jsx(Ss,{className:"h-3 w-3 opacity-60"})]})}),c.jsx(ao,{align:"start",side:"top",className:"w-72",children:Tv.map(u=>{const d=u.icon,h=e===u.value;return c.jsxs(Yi,{onClick:()=>{requestAnimationFrame(()=>t(u.value))},className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[c.jsx(d,{className:"h-4 w-4 mt-0.5 shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-sm font-medium",children:u.label}),c.jsx("div",{className:"text-xs text-muted-foreground",children:u.description})]}),h&&c.jsx(zr,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"})]},u.value)})})]})}var HY=function(t){return typeof window<"u"?matchMedia&&matchMedia("(prefers-color-scheme: ".concat(t,")")):{matches:!1}},Pv,FY=g.createContext({appearance:"light",setAppearance:function(){},isDarkMode:!1,themeMode:"light",setThemeMode:function(){},browserPrefers:(Pv=HY("dark"))!==null&&Pv!==void 0&&Pv.matches?"dark":"light"}),UY=function(){return g.useContext(FY)};const XE=(e,t)=>{if(t)return"row";switch(e){case"horizontal":return"row";case"horizontal-reverse":return"row-reverse";case"vertical":default:return"column";case"vertical-reverse":return"column-reverse"}},VY=e=>{if(e)return["space-between","space-around","space-evenly"].includes(e)},WY=(e,t)=>XE(e,t)==="row",_c=e=>typeof e=="number"?`${e}px`:e,qY=({visible:e,flex:t,gap:n,direction:r,horizontal:i,align:o,justify:a,distribution:u,height:d,width:h,allowShrink:y,padding:p,paddingInline:v,paddingBlock:b,prefixCls:w,as:S="div",className:C,style:j,children:E,wrap:N,ref:P,...I})=>{const R=a||u,X=WY(r,i)&&!h&&VY(R)?"100%":_c(h),G={...t!==void 0?{"--lobe-flex":String(t)}:{},...r||i?{"--lobe-flex-direction":XE(r,i)}:{},...N!==void 0?{"--lobe-flex-wrap":N}:{},...R!==void 0?{"--lobe-flex-justify":R}:{},...o!==void 0?{"--lobe-flex-align":o}:{},...X!==void 0?{"--lobe-flex-width":X}:{},...d!==void 0?{"--lobe-flex-height":_c(d)}:{},...p!==void 0?{"--lobe-flex-padding":_c(p)}:{},...v!==void 0?{"--lobe-flex-padding-inline":_c(v)}:{},...b!==void 0?{"--lobe-flex-padding-block":_c(b)}:{},...n!==void 0?{"--lobe-flex-gap":_c(n)}:{},...y?{minWidth:0}:{},...j},D="lobe-flex",q=[D,e===!1?`${D}--hidden`:void 0,w?`${w}-flex`:void 0,C].filter(Boolean).join(" ");return c.jsx(S,{ref:P,...I,className:q,style:G,children:E})};var JE=g.memo(qY);const KY=({children:e,ref:t,...n})=>c.jsx(JE,{...n,align:"center",justify:"center",ref:t,children:e});var GY=KY;const YY=new RegExp("\\p{Lu}?\\p{Ll}+|[0-9]+|\\p{Lu}+(?!\\p{Ll})|\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{L}+","gu");function XY(e){return Array.from(e.match(YY)??[])}function ZE(e){return XY(e).map(n=>n.toLowerCase()).join("-")}const JY="modulepreload",ZY=function(e){return"/"+e},a6={},QY=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let a=function(h){return Promise.all(h.map(y=>Promise.resolve(y).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),d=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));i=a(n.map(h=>{if(h=ZY(h),h in a6)return;a6[h]=!0;const y=h.endsWith(".css"),p=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const v=document.createElement("link");if(v.rel=y?"stylesheet":JY,y||(v.as="script"),v.crossOrigin="",v.href=h,d&&v.setAttribute("nonce",d),document.head.appendChild(v),y)return new Promise((b,w)=>{v.addEventListener("load",b),v.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(a){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=a,window.dispatchEvent(u),!u.defaultPrevented)throw a}return i.then(a=>{for(const u of a||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})};g.createContext(null);var eX=function(t,n){if(n){if(t&&n==="#000")return"0 0 0 1px rgba(255,255,255,0.1) inset";if(!t&&n==="#fff")return"0 0 0 1px rgba(0,0,0,0.05) inset"}};function cd(e){"@babel/helpers - typeof";return cd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cd(e)}var tX=["shape","color","background","size","style","iconMultiple","Icon","iconStyle","iconClassName"];function c6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?c6(Object(n),!0).forEach(function(r){nX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nX(e,t,n){return t=rX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rX(e){var t=iX(e,"string");return cd(t)=="symbol"?t:String(t)}function iX(e,t){if(cd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(cd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sX(e,t){if(e==null)return{};var n=oX(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oX(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Ir=g.memo(function(e){var t=e.shape,n=t===void 0?"circle":t,r=e.color,i=r===void 0?"#fff":r,o=e.background,a=e.size,u=e.style,d=e.iconMultiple,h=d===void 0?.75:d,y=e.Icon,p=e.iconStyle,v=e.iconClassName,b=sX(e,tX),w=UY(),S=w.isDarkMode;return c.jsx(GY,Gm(Gm({flex:"none",style:Gm({background:o,borderRadius:n==="circle"?"50%":Math.floor(a*.1),boxShadow:eX(S,o),color:i,height:a,width:a},u)},b),{},{children:y&&c.jsx(y,{className:v,color:i,size:a,style:Gm({transform:"scale(".concat(h,")")},p)})}))}),qh="OpenAI",lX=.75,aX=.1,QE="#000",eO="#19C37D",tO="#AB68FF",nO="#F86AA4",mx="#F9C322",rO="#0099FF",iO="#0000FE",cX=QE,uX="#fff",fX=.75;function ud(e){"@babel/helpers - typeof";return ud=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ud(e)}var dX=["size","style"];function u6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Av(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?u6(Object(n),!0).forEach(function(r){hX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hX(e,t,n){return t=pX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pX(e){var t=mX(e,"string");return ud(t)=="symbol"?t:String(t)}function mX(e,t){if(ud(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ud(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gX(e,t){if(e==null)return{};var n=yX(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function yX(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var gx=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=gX(e,dX);return c.jsxs("svg",Av(Av({fill:"currentColor",fillRule:"evenodd",height:n,style:Av({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:qh}),c.jsx("path",{d:"M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"})]}))});function fd(e){"@babel/helpers - typeof";return fd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fd(e)}var vX=["type"];function f6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _X(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?f6(Object(n),!0).forEach(function(r){bX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function bX(e,t,n){return t=xX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xX(e){var t=wX(e,"string");return fd(t)=="symbol"?t:String(t)}function wX(e,t){if(fd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(fd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function SX(e,t){if(e==null)return{};var n=CX(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function CX(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var jX=g.memo(function(e){var t=e.type,n=t===void 0?"normal":t,r=SX(e,vX),i=g.useMemo(function(){switch(n){case"gpt3":return eO;case"gpt4":return tO;case"gpt5":return nO;case"o3":case"o1":return mx;case"oss":return rO;case"platform":return iO;default:return cX}},[n]);return c.jsx(Ir,_X({Icon:gx,"aria-label":qh,background:i,color:uX,iconMultiple:fX},r))});function dd(e){"@babel/helpers - typeof";return dd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dd(e)}var kX=["Icon","style","Text","color","size","spaceMultiple","textMultiple","extra","extraStyle","showText","showLogo","extraClassName","iconProps","inverse"];function d6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Qo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?d6(Object(n),!0).forEach(function(r){EX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function EX(e,t,n){return t=OX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function OX(e){var t=NX(e,"string");return dd(t)=="symbol"?t:String(t)}function NX(e,t){if(dd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(dd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function TX(e,t){if(e==null)return{};var n=PX(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function PX(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Br=g.memo(function(e){var t=e.Icon,n=e.style,r=e.Text,i=e.color,o=e.size,a=o===void 0?24:o,u=e.spaceMultiple,d=u===void 0?1:u,h=e.textMultiple,y=h===void 0?1:h,p=e.extra,v=e.extraStyle,b=e.showText,w=b===void 0?!0:b,S=e.showLogo,C=S===void 0?!0:S,j=e.extraClassName,E=e.iconProps,N=e.inverse,P=TX(e,kX),I=t&&C&&c.jsx(t,Qo(Qo({size:a},E),{},{style:Qo(N?{marginLeft:a*d}:{marginRight:a*d},E==null?void 0:E.style)})),R=w&&r&&c.jsx(r,{size:a*y});return c.jsxs(JE,Qo(Qo({align:"center",flex:"none",horizontal:!0,justify:"flex-start",style:Qo({color:i},n)},P),{},{children:[N?c.jsxs(c.Fragment,{children:[R,I]}):c.jsxs(c.Fragment,{children:[I,R]}),p&&c.jsx("span",{className:j,style:Qo({fontSize:a*y*.95,lineHeight:1},v),children:p})]}))});function hd(e){"@babel/helpers - typeof";return hd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hd(e)}var AX=["size","style"];function h6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Rv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?h6(Object(n),!0).forEach(function(r){RX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function RX(e,t,n){return t=MX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function MX(e){var t=DX(e,"string");return hd(t)=="symbol"?t:String(t)}function DX(e,t){if(hd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function LX(e,t){if(e==null)return{};var n=zX(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function zX(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var sO=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=LX(e,AX);return c.jsxs("svg",Rv(Rv({fill:"currentColor",fillRule:"evenodd",height:n,style:Rv({flex:"none",lineHeight:1},r),viewBox:"0 0 86 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:qh}),c.jsx("path",{d:"M10.703 2C5.916 2 2 5.916 2 10.703c0 4.787 3.916 8.704 8.703 8.704 4.787 0 8.704-3.893 8.704-8.704A8.698 8.698 0 0010.703 2zm0 14.288c-2.973 0-5.367-2.442-5.367-5.585S7.73 5.12 10.703 5.12c2.974 0 5.367 2.441 5.367 5.584s-2.393 5.585-5.367 5.585zM28.206 6.835c-1.57 0-3.094.629-3.892 1.693v-1.45h-3.143V24h3.143v-6.116c.798.99 2.273 1.523 3.892 1.523 3.385 0 6.045-2.66 6.045-6.286 0-3.626-2.66-6.286-6.044-6.286zm-.531 9.84c-1.79 0-3.385-1.402-3.385-3.554s1.596-3.554 3.385-3.554c1.789 0 3.384 1.402 3.384 3.554s-1.595 3.554-3.384 3.554zM41.649 6.835c-3.433 0-6.141 2.684-6.141 6.286 0 3.602 2.37 6.286 6.237 6.286 3.167 0 5.198-1.91 5.827-4.062h-3.07c-.388.895-1.475 1.523-2.78 1.523-1.62 0-2.854-1.136-3.144-2.756h9.139V12.88c0-3.288-2.297-6.044-6.068-6.044zm-3.047 5.053c.339-1.523 1.596-2.514 3.12-2.514 1.619 0 2.852 1.064 2.997 2.514h-6.117zM56.081 6.835c-1.402 0-2.877.629-3.553 1.669V7.077h-3.143v12.088h3.143v-6.503c0-1.886 1.015-3.119 2.659-3.119 1.523 0 2.345 1.16 2.345 2.78v6.842h3.143v-7.35c0-2.997-1.838-4.98-4.594-4.98zM68.724 2.242l-6.841 16.923h3.36l1.45-3.699h7.785l1.45 3.7h3.41L72.543 2.241h-3.82zm-.943 10.42l2.805-7.084 2.78 7.084H67.78zM83.81 2.242h-3.191v16.923h3.19V2.242z"})]}))});function pd(e){"@babel/helpers - typeof";return pd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pd(e)}var $X=["extraStyle"];function p6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function m6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?p6(Object(n),!0).forEach(function(r){IX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function IX(e,t,n){return t=BX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BX(e){var t=HX(e,"string");return pd(t)=="symbol"?t:String(t)}function HX(e,t){if(pd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(pd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function FX(e,t){if(e==null)return{};var n=UX(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function UX(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var VX=g.memo(function(e){var t=e.extraStyle,n=FX(e,$X);return c.jsx(Br,m6({Icon:gx,Text:sO,"aria-label":qh,extraStyle:m6({fontWeight:600},t),spaceMultiple:aX,textMultiple:lX},n))}),rn=gx;rn.Text=sO;rn.Combine=VX;rn.Avatar=jX;rn.colorPrimary=QE;rn.colorGpt3=eO;rn.colorGpt4=tO;rn.colorGpt5=nO;rn.colorO1=mx;rn.colorO3=mx;rn.colorOss=rO;rn.colorPlatform=iO;rn.title=qh;var Jc="Claude",WX=.8,qX=.1,oO="#D97757",KX=oO,GX="#fff",YX=.75;function md(e){"@babel/helpers - typeof";return md=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},md(e)}var XX=["size","style"];function g6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Mv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?g6(Object(n),!0).forEach(function(r){JX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function JX(e,t,n){return t=ZX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZX(e){var t=QX(e,"string");return md(t)=="symbol"?t:String(t)}function QX(e,t){if(md(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(md(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eJ(e,t){if(e==null)return{};var n=tJ(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tJ(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var yx=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=eJ(e,XX);return c.jsxs("svg",Mv(Mv({fill:"currentColor",fillRule:"evenodd",height:n,style:Mv({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Jc}),c.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})]}))});function gd(e){"@babel/helpers - typeof";return gd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gd(e)}function y6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function nJ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?y6(Object(n),!0).forEach(function(r){rJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rJ(e,t,n){return t=iJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iJ(e){var t=sJ(e,"string");return gd(t)=="symbol"?t:String(t)}function sJ(e,t){if(gd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(gd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oJ(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var lJ=g.memo(function(e){var t=Object.assign({},(oJ(e),e));return c.jsx(Ir,nJ({Icon:yx,"aria-label":Jc,background:KX,color:GX,iconMultiple:YX},t))});function yd(e){"@babel/helpers - typeof";return yd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yd(e)}var aJ=["size","style"];function v6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Dv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?v6(Object(n),!0).forEach(function(r){cJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function cJ(e,t,n){return t=uJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uJ(e){var t=fJ(e,"string");return yd(t)=="symbol"?t:String(t)}function fJ(e,t){if(yd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(yd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dJ(e,t){if(e==null)return{};var n=hJ(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hJ(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var lO=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=dJ(e,aJ);return c.jsxs("svg",Dv(Dv({height:n,style:Dv({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Jc}),c.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z",fill:"#D97757",fillRule:"nonzero"})]}))});function vd(e){"@babel/helpers - typeof";return vd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vd(e)}var pJ=["size","style"];function _6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Lv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_6(Object(n),!0).forEach(function(r){mJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function mJ(e,t,n){return t=gJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gJ(e){var t=yJ(e,"string");return vd(t)=="symbol"?t:String(t)}function yJ(e,t){if(vd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(vd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vJ(e,t){if(e==null)return{};var n=_J(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _J(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var aO=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=vJ(e,pJ);return c.jsxs("svg",Lv(Lv({fill:"currentColor",fillRule:"nonzero",height:n,style:Lv({flex:"none",lineHeight:1},r),viewBox:"0 0 97 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Jc}),c.jsx("path",{d:"M13.623 20.222c-3.417 0-5.753-1.901-6.855-4.827a12.992 12.992 0 01-.838-4.772c0-4.907 2.206-8.315 7.08-8.315 3.275 0 5.297 1.425 6.448 4.826h1.402l-.19-4.69C18.709 1.18 16.258.543 13.276.543c-4.2 0-7.775 1.874-9.763 5.254a11.357 11.357 0 00-1.511 5.872c0 3.753 1.777 7.08 5.113 8.926a11.95 11.95 0 005.943 1.398c3.254 0 5.835-.617 8.122-1.697l.593-5.172h-1.43c-.858 2.362-1.88 3.78-3.574 4.534-.831.373-1.88.564-3.146.564zm14.74-17.914L28.499 0h-.967L23.23 1.29v.699l1.907.882v16.142c0 1.1-.565 1.344-2.043 1.528v1.18h7.319v-1.18c-1.484-.184-2.042-.428-2.042-1.528V2.315l-.007-.007zm29.104 19.685h.565l4.95-.937v-1.208l-.695-.054c-1.157-.109-1.457-.346-1.457-1.29V9.897l.137-2.763h-.783l-4.678.672v1.181l.457.082c1.266.183 1.64.536 1.64 1.419v7.67c-1.212.937-2.369 1.527-3.744 1.527-1.525 0-2.471-.774-2.471-2.58V9.905l.136-2.763h-.804l-4.684.672v1.181l.484.082c1.266.183 1.64.536 1.64 1.418v7.08c0 3 1.703 4.426 4.412 4.426 2.07 0 3.765-1.1 5.038-2.627L57.474 22l-.007-.007zm-13.602-9.55c0-3.836-2.043-5.309-5.733-5.309-3.254 0-5.616 1.344-5.616 3.57 0 .666.238 1.175.721 1.528l2.478-.326c-.109-.746-.163-1.201-.163-1.391 0-1.263.674-1.901 2.042-1.901 2.022 0 3.044 1.419 3.044 3.7v.746l-5.106 1.527c-1.702.462-2.67.863-3.316 1.8a3.386 3.386 0 00-.476 1.9c0 2.172 1.497 3.706 4.057 3.706 1.852 0 3.493-.835 4.922-2.416.51 1.581 1.294 2.416 2.69 2.416 1.13 0 2.15-.455 3.063-1.344l-.272-.937a4.363 4.363 0 01-1.178.163c-.783 0-1.157-.617-1.157-1.826v-5.607zm-6.536 7.378c-1.396 0-2.26-.808-2.26-2.226 0-.964.456-1.528 1.43-1.854l4.139-1.31v3.965c-1.321.997-2.097 1.425-3.31 1.425zm43.095 1.235v-1.208l-.701-.054c-1.158-.109-1.45-.346-1.45-1.29V2.308L78.409 0h-.974l-4.302 1.29v.699l1.906.882V8.18a6.024 6.024 0 00-3.656-1.046c-4.276 0-7.612 3.245-7.612 8.098 0 3.998 2.397 6.761 6.346 6.761 2.042 0 3.819-.99 4.922-2.525l-.136 2.525h.571l4.95-.937zm-8.96-12.313c2.043 0 3.575 1.181 3.575 3.353v6.11a4.91 4.91 0 01-3.547 1.425c-2.928 0-4.412-2.308-4.412-5.39 0-3.462 1.695-5.498 4.385-5.498zm19.424 3.055c-.381-1.792-1.484-2.81-3.016-2.81-2.288 0-3.874 1.717-3.874 4.18 0 3.646 1.934 6.008 5.059 6.008a5.858 5.858 0 005.03-2.953l.913.245c-.408 3.163-3.281 5.525-6.808 5.525-4.14 0-6.992-3.054-6.992-7.399 0-4.378 3.098-7.46 7.237-7.46 3.09 0 5.27 1.853 5.97 5.07l-10.783 3.3V14.05l7.264-2.247v-.006z"})]}))});function _d(e){"@babel/helpers - typeof";return _d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_d(e)}var bJ=["type"];function b6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function xJ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?b6(Object(n),!0).forEach(function(r){wJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function wJ(e,t,n){return t=SJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SJ(e){var t=CJ(e,"string");return _d(t)=="symbol"?t:String(t)}function CJ(e,t){if(_d(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(_d(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jJ(e,t){if(e==null)return{};var n=kJ(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kJ(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var EJ=g.memo(function(e){var t=e.type,n=t===void 0?"mono":t,r=jJ(e,bJ),i=n==="color"?lO:yx;return c.jsx(Br,xJ({Icon:i,Text:aO,"aria-label":Jc,spaceMultiple:qX,textMultiple:WX},r))}),Lr=yx;Lr.Color=lO;Lr.Text=aO;Lr.Combine=EJ;Lr.Avatar=lJ;Lr.colorPrimary=oO;Lr.title=Jc;const gb="jait-gateway-url";function OJ(){var e;return typeof window<"u"&&((e=window.location)!=null&&e.origin)&&window.location.origin!=="null"?window.location.origin:"http://localhost:8000"}function bd(e){return e.endsWith("/")?e.slice(0,-1):e}function x6(e){return e.replace(/^http/,"ws")}function ha(){try{const e=localStorage.getItem(gb);return e&&e.trim()?e.trim():null}catch{return null}}function mg(e){try{e&&e.trim()?localStorage.setItem(gb,bd(e.trim())):localStorage.removeItem(gb)}catch{}window.dispatchEvent(new Event("jait-gateway-url-changed"))}function cn(){var n;const e=ha();if(e)return bd(e);const t=(n=window.jaitDesktop)==null?void 0:n.gatewayUrl;return t?bd(t):OJ()}function Kh(){const e=ha();if(e)return bd(x6(e));const t=cn();return bd(x6(t))}function w6(){var e;return!!(ha()||(e=window.jaitDesktop)!=null&&e.gatewayUrl)}cn();Kh();const Bn=cn();class NJ{getToken(){return localStorage.getItem("token")}getHeaders(t=!1){const n={};t&&(n["Content-Type"]="application/json");const r=this.getToken();return r&&(n.Authorization=`Bearer ${r}`),n}async listProviders(){const t=await fetch(`${Bn}/api/providers`,{headers:this.getHeaders()});if(!t.ok)throw new Error(`Failed to list providers: ${t.statusText}`);const n=await t.json();return{providers:n.providers,remoteProviders:n.remoteProviders??[]}}async listProviderModels(t){const n=await fetch(`${Bn}/api/providers/${t}/models`,{headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to list models: ${n.statusText}`);return(await n.json()).models}async listThreads(t){const n=t?`?sessionId=${encodeURIComponent(t)}`:"",r=await fetch(`${Bn}/api/threads${n}`,{headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to list threads: ${r.statusText}`);return(await r.json()).threads}async getThread(t){const n=await fetch(`${Bn}/api/threads/${t}`,{headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to get thread: ${n.statusText}`);return n.json()}async createThread(t){const n=await fetch(`${Bn}/api/threads`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(t)});if(!n.ok)throw new Error(`Failed to create thread: ${n.statusText}`);return n.json()}async updateThread(t,n){const r=await fetch(`${Bn}/api/threads/${t}`,{method:"PATCH",headers:this.getHeaders(!0),body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to update thread: ${r.statusText}`);return r.json()}async deleteThread(t){const n=await fetch(`${Bn}/api/threads/${t}`,{method:"DELETE",headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to delete thread: ${n.statusText}`)}async startThread(t,n){const r=typeof n=="string"?{message:n}:n??{},i=await fetch(`${Bn}/api/threads/${t}/start`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(r)});if(!i.ok){const o=await i.json().catch(()=>({})),a=new Error(o.error||`Failed to start thread: ${i.statusText}`);throw o.code&&(a.code=o.code),a}return i.json()}async sendTurn(t,n){const r=await fetch(`${Bn}/api/threads/${t}/send`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({message:n})});if(!r.ok)throw new Error(`Failed to send turn: ${r.statusText}`)}async stopThread(t){const n=await fetch(`${Bn}/api/threads/${t}/stop`,{method:"POST",headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to stop thread: ${n.statusText}`)}async interruptThread(t){const n=await fetch(`${Bn}/api/threads/${t}/interrupt`,{method:"POST",headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to interrupt thread: ${n.statusText}`)}async approveToolCall(t,n,r){const i=await fetch(`${Bn}/api/threads/${t}/approve`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({requestId:n,approved:r})});if(!i.ok)throw new Error(`Failed to approve: ${i.statusText}`)}async createPullRequest(t,n){const r=await fetch(`${Bn}/api/threads/${t}/create-pr`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(n)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error||`Failed to create pull request: ${r.statusText}`)}return r.json()}async getActivities(t,n){const r=typeof n=="number"?`?limit=${n}`:"",i=await fetch(`${Bn}/api/threads/${t}/activities${r}`,{headers:this.getHeaders()});if(!i.ok)throw new Error(`Failed to get activities: ${i.statusText}`);return(await i.json()).activities}async listRepos(){const t=await fetch(`${Bn}/api/repos`,{headers:this.getHeaders()});if(!t.ok)throw new Error(`Failed to list repos: ${t.statusText}`);return(await t.json()).repos}async createRepo(t){const n=await fetch(`${Bn}/api/repos`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(t)});if(!n.ok)throw new Error(`Failed to create repo: ${n.statusText}`);return(await n.json()).repo}async updateRepo(t,n){const r=await fetch(`${Bn}/api/repos/${t}`,{method:"PATCH",headers:this.getHeaders(!0),body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to update repo: ${r.statusText}`);return(await r.json()).repo}async deleteRepo(t){const n=await fetch(`${Bn}/api/repos/${t}`,{method:"DELETE",headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to delete repo: ${n.statusText}`)}}const Hn=new NJ,TJ=({className:e})=>c.jsx(rn,{size:16,className:e}),PJ=({className:e})=>c.jsx(Lr,{size:16,className:e}),zv=[{value:"jait",label:"Jait",icon:f2,description:"Native Jait agent loop with full tool access"},{value:"codex",label:"Codex",icon:TJ,description:"OpenAI Codex CLI — coding agent with MCP tools"},{value:"claude-code",label:"Claude Code",icon:PJ,description:"Anthropic Claude Code CLI — coding agent with MCP tools"}];function AJ(e){const t=e.toLowerCase();return t.includes("not installed")||t.includes("not found")?"not installed":t.includes("not authenticated")||t.includes("login")?"not authenticated":"unavailable"}function RJ({provider:e,onChange:t,disabled:n,className:r,iconOnly:i=!1}){const[o,a]=g.useState({}),[u,d]=g.useState([]);g.useEffect(()=>{Hn.listProviders().then(({providers:p,remoteProviders:v})=>{const b={};for(const w of p)b[w.id]=w;a(b),d(v)}).catch(()=>{})},[]);const h=zv.find(p=>p.value===e)??zv[0],y=h.icon;return c.jsxs(bl,{children:[c.jsx(xl,{asChild:!0,disabled:n,children:c.jsxs("button",{type:"button",className:Ae("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",r),title:`Provider: ${h.label}`,"aria-label":`Provider: ${h.label}`,children:[c.jsx(y,{className:"h-4 w-4"}),!i&&c.jsx("span",{children:h.label}),c.jsx(Ss,{className:"h-3 w-3 opacity-60"})]})}),c.jsx(ao,{align:"start",side:"top",className:"w-72",children:zv.map(p=>{const v=p.icon,b=e===p.value,w=o[p.value],S=(w==null?void 0:w.available)!==!1,C=w==null?void 0:w.unavailableReason,j=S?void 0:u.find(N=>N.providers.includes(p.value)),E=S||!!j;return c.jsxs(Yi,{onClick:()=>t(p.value),disabled:!E,className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[c.jsx(v,{className:"h-4 w-4 mt-0.5 shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"text-sm font-medium flex items-center gap-1.5",children:[p.label,!S&&j&&c.jsxs("span",{className:"text-[10px] text-blue-500 flex items-center gap-0.5",children:["remote · ",j.nodeName]}),!E&&c.jsxs("span",{className:"text-[10px] text-destructive/80 flex items-center gap-0.5",children:[c.jsx(Oc,{className:"h-3 w-3"}),C?AJ(C):"unavailable"]})]}),c.jsx("div",{className:"text-xs text-muted-foreground leading-snug",children:!E&&C?C:p.description})]}),b&&c.jsx(zr,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"})]},p.value)})})]})}function MJ({provider:e,model:t,onChange:n,disabled:r,className:i}){var p;const[o,a]=g.useState([]),[u,d]=g.useState(!1),h=g.useRef(null);g.useEffect(()=>{e!=="jait"&&h.current!==e&&(h.current=e,d(!0),Hn.listProviderModels(e).then(v=>{if(a(v),!t){const b=v.find(w=>w.isDefault);b&&n(b.id)}}).catch(()=>a([])).finally(()=>d(!1)))},[e]);const y=t?((p=o.find(v=>v.id===t))==null?void 0:p.name)??t:"model";return c.jsxs(bl,{children:[c.jsx(xl,{asChild:!0,disabled:r||u,children:c.jsxs("button",{type:"button",className:Ae("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",i),title:`Model: ${t??"none"}`,children:[u?c.jsx(bt,{className:"h-3 w-3 animate-spin"}):c.jsx("span",{className:"font-mono text-[11px]",children:y}),c.jsx(Ss,{className:"h-3 w-3 opacity-60"})]})}),c.jsxs(ao,{align:"start",side:"top",className:"w-64",children:[c.jsx(y1,{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Model"}),c.jsx(Dc,{}),o.map(v=>c.jsxs(Yi,{onClick:()=>n(v.id),className:"flex items-start gap-2 py-1.5 cursor-pointer",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"text-sm font-medium",children:[v.name,v.isDefault&&c.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground font-normal",children:"(default)"})]}),v.description&&c.jsx("div",{className:"text-[11px] text-muted-foreground leading-snug",children:v.description})]}),t===v.id&&c.jsx(zr,{className:"h-3.5 w-3.5 mt-0.5 text-primary shrink-0"})]},v.id)),o.length===0&&!u&&c.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No models available"})]})]})}const DJ=768;function vx(){const e=()=>window.innerWidth<DJ,[t,n]=g.useState(e);return g.useEffect(()=>{const r=()=>n(e());return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),t}const LJ="https://cdn.jsdelivr.net/gh/vscode-icons/vscode-icons@12.9.0/icons/",S6=[];function Ym(e,t){const n=document.createElement("span");n.contentEditable="false",n.setAttribute("data-file-path",e.path),n.setAttribute("data-file-name",e.name),n.className="inline-flex items-center gap-0.5 align-baseline text-[12px] leading-tight pl-0.5 pr-0 py-[1px] mx-[2px] rounded bg-muted text-foreground select-none cursor-default whitespace-nowrap";const r=document.createElement("span");r.className="inline-flex items-center shrink-0",r.innerHTML=`<img src="${LJ}${zJ(e.name)}" alt="" class="h-3.5 w-3.5" draggable="false" />`,n.appendChild(r);const i=document.createElement("span");i.className="truncate max-w-[140px]",i.textContent=e.name,n.appendChild(i);const o=document.createElement("button");return o.type="button",o.className="inline-flex items-center p-0.5 rounded hover:bg-foreground/10 transition-colors",o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',o.addEventListener("mousedown",a=>{a.preventDefault(),a.stopPropagation()}),o.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),n.remove(),t==null||t(e.path)}),n.appendChild(o),n}function zJ(e){return ol.getIconForFile(e)??ol.DEFAULT_FILE}function ds(e){let t="";for(const n of e.childNodes)if(n.nodeType===Node.TEXT_NODE)t+=n.textContent??"";else if(n instanceof HTMLElement){if(n.hasAttribute("data-file-path"))continue;n.tagName==="BR"?t+=`
|
|
641
|
+
`).length+1)),className:"w-full resize-y rounded-md border bg-background p-2 text-sm leading-relaxed focus:outline-none focus:ring-1 focus:ring-ring"}),c.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[c.jsx(Ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{R(!1),X(i),W(null)},disabled:G,children:"Cancel"}),c.jsx(Ee,{type:"button",size:"sm",onClick:()=>{T()},disabled:G||!$.trim(),children:G?"Sending…":"Send"})]})]}):C?c.jsxs("div",{ref:O,className:Ae("relative rounded-lg px-4 py-3 bg-muted",v?"text-sm leading-normal":"text-base leading-relaxed"),children:[c.jsx("div",{className:"whitespace-pre-wrap",children:j}),E.length>0&&c.jsx("div",{className:"flex flex-wrap gap-1 mt-2 pt-2 border-t border-foreground/5",children:E.map(te=>c.jsxs("span",{className:"inline-flex items-center gap-1 text-[12px] leading-tight px-1.5 py-0.5 rounded bg-background/60 text-muted-foreground select-none",title:te.path,children:[c.jsx(cl,{filename:te.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"truncate max-w-[180px]",children:te.name})]},te.path))}),oe()]}):c.jsxs("div",{className:"relative",children:[c.jsx(o6,{content:i,compact:v,isStreaming:p,preferLlmUi:b}),oe()]}):p&&!u?c.jsxs("div",{className:"flex gap-1 py-2",children:[c.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:0ms]"}),c.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:150ms]"}),c.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:300ms]"})]}):null]})]})})}const Nv=[{value:"ask",label:"Ask",icon:b7,description:"Read-only — questions, explanations, analysis"},{value:"agent",label:"Agent",icon:f2,description:"Full agentic — reads, writes, runs commands"},{value:"plan",label:"Plan",icon:yR,description:"Propose changes — review before executing"}];function IY({mode:e,onChange:t,disabled:n,className:r}){const i=Nv.find(a=>a.value===e)??Nv[1],o=i.icon;return c.jsxs(bl,{children:[c.jsx(xl,{asChild:!0,disabled:n,children:c.jsxs("button",{type:"button",className:Ae("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",r),title:`Mode: ${i.label}`,children:[c.jsx(o,{className:"h-4 w-4"}),c.jsx("span",{children:i.label}),c.jsx(Ss,{className:"h-3 w-3 opacity-60"})]})}),c.jsx(ao,{align:"start",side:"top",className:"w-64",children:Nv.map(a=>{const u=a.icon,d=e===a.value;return c.jsxs(Yi,{onClick:()=>t(a.value),className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[c.jsx(u,{className:"h-4 w-4 mt-0.5 shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-sm font-medium",children:a.label}),c.jsx("div",{className:"text-xs text-muted-foreground",children:a.description})]}),d&&c.jsx(zr,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"})]},a.value)})})]})}const Tv=[{value:"developer",label:"Developer",icon:W_,description:"Chat with the AI assistant — ask, plan, and execute"},{value:"manager",label:"Manager",icon:K_,description:"Automation — delegate tasks to agent threads on repos"}];function BY({mode:e,onChange:t,disabled:n,className:r,compact:i=!1}){const o=Tv.find(u=>u.value===e)??Tv[0],a=o.icon;return c.jsxs(bl,{children:[c.jsx(xl,{asChild:!0,disabled:n,children:c.jsxs("button",{type:"button",className:Ae("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",r),title:`Mode: ${o.label}`,"aria-label":`Mode: ${o.label}`,children:[c.jsx(a,{className:"h-4 w-4"}),!i&&c.jsx("span",{children:o.label}),c.jsx(Ss,{className:"h-3 w-3 opacity-60"})]})}),c.jsx(ao,{align:"start",side:"top",className:"w-72",children:Tv.map(u=>{const d=u.icon,h=e===u.value;return c.jsxs(Yi,{onClick:()=>{requestAnimationFrame(()=>t(u.value))},className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[c.jsx(d,{className:"h-4 w-4 mt-0.5 shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"text-sm font-medium",children:u.label}),c.jsx("div",{className:"text-xs text-muted-foreground",children:u.description})]}),h&&c.jsx(zr,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"})]},u.value)})})]})}var HY=function(t){return typeof window<"u"?matchMedia&&matchMedia("(prefers-color-scheme: ".concat(t,")")):{matches:!1}},Pv,FY=g.createContext({appearance:"light",setAppearance:function(){},isDarkMode:!1,themeMode:"light",setThemeMode:function(){},browserPrefers:(Pv=HY("dark"))!==null&&Pv!==void 0&&Pv.matches?"dark":"light"}),UY=function(){return g.useContext(FY)};const XE=(e,t)=>{if(t)return"row";switch(e){case"horizontal":return"row";case"horizontal-reverse":return"row-reverse";case"vertical":default:return"column";case"vertical-reverse":return"column-reverse"}},VY=e=>{if(e)return["space-between","space-around","space-evenly"].includes(e)},WY=(e,t)=>XE(e,t)==="row",_c=e=>typeof e=="number"?`${e}px`:e,qY=({visible:e,flex:t,gap:n,direction:r,horizontal:i,align:o,justify:a,distribution:u,height:d,width:h,allowShrink:y,padding:p,paddingInline:v,paddingBlock:b,prefixCls:w,as:S="div",className:C,style:j,children:E,wrap:N,ref:P,...I})=>{const R=a||u,X=WY(r,i)&&!h&&VY(R)?"100%":_c(h),G={...t!==void 0?{"--lobe-flex":String(t)}:{},...r||i?{"--lobe-flex-direction":XE(r,i)}:{},...N!==void 0?{"--lobe-flex-wrap":N}:{},...R!==void 0?{"--lobe-flex-justify":R}:{},...o!==void 0?{"--lobe-flex-align":o}:{},...X!==void 0?{"--lobe-flex-width":X}:{},...d!==void 0?{"--lobe-flex-height":_c(d)}:{},...p!==void 0?{"--lobe-flex-padding":_c(p)}:{},...v!==void 0?{"--lobe-flex-padding-inline":_c(v)}:{},...b!==void 0?{"--lobe-flex-padding-block":_c(b)}:{},...n!==void 0?{"--lobe-flex-gap":_c(n)}:{},...y?{minWidth:0}:{},...j},D="lobe-flex",q=[D,e===!1?`${D}--hidden`:void 0,w?`${w}-flex`:void 0,C].filter(Boolean).join(" ");return c.jsx(S,{ref:P,...I,className:q,style:G,children:E})};var JE=g.memo(qY);const KY=({children:e,ref:t,...n})=>c.jsx(JE,{...n,align:"center",justify:"center",ref:t,children:e});var GY=KY;const YY=new RegExp("\\p{Lu}?\\p{Ll}+|[0-9]+|\\p{Lu}+(?!\\p{Ll})|\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{L}+","gu");function XY(e){return Array.from(e.match(YY)??[])}function ZE(e){return XY(e).map(n=>n.toLowerCase()).join("-")}const JY="modulepreload",ZY=function(e,t){return new URL(e,t).href},a6={},QY=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let a=function(y){return Promise.all(y.map(p=>Promise.resolve(p).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};const u=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),h=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=a(n.map(y=>{if(y=ZY(y,r),y in a6)return;a6[y]=!0;const p=y.endsWith(".css"),v=p?'[rel="stylesheet"]':"";if(!!r)for(let S=u.length-1;S>=0;S--){const C=u[S];if(C.href===y&&(!p||C.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${v}`))return;const w=document.createElement("link");if(w.rel=p?"stylesheet":JY,p||(w.as="script"),w.crossOrigin="",w.href=y,h&&w.setAttribute("nonce",h),document.head.appendChild(w),p)return new Promise((S,C)=>{w.addEventListener("load",S),w.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${y}`)))})}))}function o(a){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=a,window.dispatchEvent(u),!u.defaultPrevented)throw a}return i.then(a=>{for(const u of a||[])u.status==="rejected"&&o(u.reason);return t().catch(o)})};g.createContext(null);var eX=function(t,n){if(n){if(t&&n==="#000")return"0 0 0 1px rgba(255,255,255,0.1) inset";if(!t&&n==="#fff")return"0 0 0 1px rgba(0,0,0,0.05) inset"}};function cd(e){"@babel/helpers - typeof";return cd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cd(e)}var tX=["shape","color","background","size","style","iconMultiple","Icon","iconStyle","iconClassName"];function c6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?c6(Object(n),!0).forEach(function(r){nX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nX(e,t,n){return t=rX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rX(e){var t=iX(e,"string");return cd(t)=="symbol"?t:String(t)}function iX(e,t){if(cd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(cd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sX(e,t){if(e==null)return{};var n=oX(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oX(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Ir=g.memo(function(e){var t=e.shape,n=t===void 0?"circle":t,r=e.color,i=r===void 0?"#fff":r,o=e.background,a=e.size,u=e.style,d=e.iconMultiple,h=d===void 0?.75:d,y=e.Icon,p=e.iconStyle,v=e.iconClassName,b=sX(e,tX),w=UY(),S=w.isDarkMode;return c.jsx(GY,Gm(Gm({flex:"none",style:Gm({background:o,borderRadius:n==="circle"?"50%":Math.floor(a*.1),boxShadow:eX(S,o),color:i,height:a,width:a},u)},b),{},{children:y&&c.jsx(y,{className:v,color:i,size:a,style:Gm({transform:"scale(".concat(h,")")},p)})}))}),qh="OpenAI",lX=.75,aX=.1,QE="#000",eO="#19C37D",tO="#AB68FF",nO="#F86AA4",mx="#F9C322",rO="#0099FF",iO="#0000FE",cX=QE,uX="#fff",fX=.75;function ud(e){"@babel/helpers - typeof";return ud=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ud(e)}var dX=["size","style"];function u6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Av(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?u6(Object(n),!0).forEach(function(r){hX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hX(e,t,n){return t=pX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pX(e){var t=mX(e,"string");return ud(t)=="symbol"?t:String(t)}function mX(e,t){if(ud(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ud(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gX(e,t){if(e==null)return{};var n=yX(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function yX(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var gx=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=gX(e,dX);return c.jsxs("svg",Av(Av({fill:"currentColor",fillRule:"evenodd",height:n,style:Av({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:qh}),c.jsx("path",{d:"M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"})]}))});function fd(e){"@babel/helpers - typeof";return fd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fd(e)}var vX=["type"];function f6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _X(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?f6(Object(n),!0).forEach(function(r){bX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function bX(e,t,n){return t=xX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xX(e){var t=wX(e,"string");return fd(t)=="symbol"?t:String(t)}function wX(e,t){if(fd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(fd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function SX(e,t){if(e==null)return{};var n=CX(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function CX(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var jX=g.memo(function(e){var t=e.type,n=t===void 0?"normal":t,r=SX(e,vX),i=g.useMemo(function(){switch(n){case"gpt3":return eO;case"gpt4":return tO;case"gpt5":return nO;case"o3":case"o1":return mx;case"oss":return rO;case"platform":return iO;default:return cX}},[n]);return c.jsx(Ir,_X({Icon:gx,"aria-label":qh,background:i,color:uX,iconMultiple:fX},r))});function dd(e){"@babel/helpers - typeof";return dd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dd(e)}var kX=["Icon","style","Text","color","size","spaceMultiple","textMultiple","extra","extraStyle","showText","showLogo","extraClassName","iconProps","inverse"];function d6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Qo(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?d6(Object(n),!0).forEach(function(r){EX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function EX(e,t,n){return t=OX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function OX(e){var t=NX(e,"string");return dd(t)=="symbol"?t:String(t)}function NX(e,t){if(dd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(dd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function TX(e,t){if(e==null)return{};var n=PX(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function PX(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Br=g.memo(function(e){var t=e.Icon,n=e.style,r=e.Text,i=e.color,o=e.size,a=o===void 0?24:o,u=e.spaceMultiple,d=u===void 0?1:u,h=e.textMultiple,y=h===void 0?1:h,p=e.extra,v=e.extraStyle,b=e.showText,w=b===void 0?!0:b,S=e.showLogo,C=S===void 0?!0:S,j=e.extraClassName,E=e.iconProps,N=e.inverse,P=TX(e,kX),I=t&&C&&c.jsx(t,Qo(Qo({size:a},E),{},{style:Qo(N?{marginLeft:a*d}:{marginRight:a*d},E==null?void 0:E.style)})),R=w&&r&&c.jsx(r,{size:a*y});return c.jsxs(JE,Qo(Qo({align:"center",flex:"none",horizontal:!0,justify:"flex-start",style:Qo({color:i},n)},P),{},{children:[N?c.jsxs(c.Fragment,{children:[R,I]}):c.jsxs(c.Fragment,{children:[I,R]}),p&&c.jsx("span",{className:j,style:Qo({fontSize:a*y*.95,lineHeight:1},v),children:p})]}))});function hd(e){"@babel/helpers - typeof";return hd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hd(e)}var AX=["size","style"];function h6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Rv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?h6(Object(n),!0).forEach(function(r){RX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function RX(e,t,n){return t=MX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function MX(e){var t=DX(e,"string");return hd(t)=="symbol"?t:String(t)}function DX(e,t){if(hd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function LX(e,t){if(e==null)return{};var n=zX(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function zX(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var sO=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=LX(e,AX);return c.jsxs("svg",Rv(Rv({fill:"currentColor",fillRule:"evenodd",height:n,style:Rv({flex:"none",lineHeight:1},r),viewBox:"0 0 86 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:qh}),c.jsx("path",{d:"M10.703 2C5.916 2 2 5.916 2 10.703c0 4.787 3.916 8.704 8.703 8.704 4.787 0 8.704-3.893 8.704-8.704A8.698 8.698 0 0010.703 2zm0 14.288c-2.973 0-5.367-2.442-5.367-5.585S7.73 5.12 10.703 5.12c2.974 0 5.367 2.441 5.367 5.584s-2.393 5.585-5.367 5.585zM28.206 6.835c-1.57 0-3.094.629-3.892 1.693v-1.45h-3.143V24h3.143v-6.116c.798.99 2.273 1.523 3.892 1.523 3.385 0 6.045-2.66 6.045-6.286 0-3.626-2.66-6.286-6.044-6.286zm-.531 9.84c-1.79 0-3.385-1.402-3.385-3.554s1.596-3.554 3.385-3.554c1.789 0 3.384 1.402 3.384 3.554s-1.595 3.554-3.384 3.554zM41.649 6.835c-3.433 0-6.141 2.684-6.141 6.286 0 3.602 2.37 6.286 6.237 6.286 3.167 0 5.198-1.91 5.827-4.062h-3.07c-.388.895-1.475 1.523-2.78 1.523-1.62 0-2.854-1.136-3.144-2.756h9.139V12.88c0-3.288-2.297-6.044-6.068-6.044zm-3.047 5.053c.339-1.523 1.596-2.514 3.12-2.514 1.619 0 2.852 1.064 2.997 2.514h-6.117zM56.081 6.835c-1.402 0-2.877.629-3.553 1.669V7.077h-3.143v12.088h3.143v-6.503c0-1.886 1.015-3.119 2.659-3.119 1.523 0 2.345 1.16 2.345 2.78v6.842h3.143v-7.35c0-2.997-1.838-4.98-4.594-4.98zM68.724 2.242l-6.841 16.923h3.36l1.45-3.699h7.785l1.45 3.7h3.41L72.543 2.241h-3.82zm-.943 10.42l2.805-7.084 2.78 7.084H67.78zM83.81 2.242h-3.191v16.923h3.19V2.242z"})]}))});function pd(e){"@babel/helpers - typeof";return pd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pd(e)}var $X=["extraStyle"];function p6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function m6(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?p6(Object(n),!0).forEach(function(r){IX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function IX(e,t,n){return t=BX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BX(e){var t=HX(e,"string");return pd(t)=="symbol"?t:String(t)}function HX(e,t){if(pd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(pd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function FX(e,t){if(e==null)return{};var n=UX(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function UX(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var VX=g.memo(function(e){var t=e.extraStyle,n=FX(e,$X);return c.jsx(Br,m6({Icon:gx,Text:sO,"aria-label":qh,extraStyle:m6({fontWeight:600},t),spaceMultiple:aX,textMultiple:lX},n))}),rn=gx;rn.Text=sO;rn.Combine=VX;rn.Avatar=jX;rn.colorPrimary=QE;rn.colorGpt3=eO;rn.colorGpt4=tO;rn.colorGpt5=nO;rn.colorO1=mx;rn.colorO3=mx;rn.colorOss=rO;rn.colorPlatform=iO;rn.title=qh;var Jc="Claude",WX=.8,qX=.1,oO="#D97757",KX=oO,GX="#fff",YX=.75;function md(e){"@babel/helpers - typeof";return md=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},md(e)}var XX=["size","style"];function g6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Mv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?g6(Object(n),!0).forEach(function(r){JX(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function JX(e,t,n){return t=ZX(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZX(e){var t=QX(e,"string");return md(t)=="symbol"?t:String(t)}function QX(e,t){if(md(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(md(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eJ(e,t){if(e==null)return{};var n=tJ(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tJ(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var yx=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=eJ(e,XX);return c.jsxs("svg",Mv(Mv({fill:"currentColor",fillRule:"evenodd",height:n,style:Mv({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Jc}),c.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})]}))});function gd(e){"@babel/helpers - typeof";return gd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gd(e)}function y6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function nJ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?y6(Object(n),!0).forEach(function(r){rJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rJ(e,t,n){return t=iJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iJ(e){var t=sJ(e,"string");return gd(t)=="symbol"?t:String(t)}function sJ(e,t){if(gd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(gd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oJ(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var lJ=g.memo(function(e){var t=Object.assign({},(oJ(e),e));return c.jsx(Ir,nJ({Icon:yx,"aria-label":Jc,background:KX,color:GX,iconMultiple:YX},t))});function yd(e){"@babel/helpers - typeof";return yd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yd(e)}var aJ=["size","style"];function v6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Dv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?v6(Object(n),!0).forEach(function(r){cJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function cJ(e,t,n){return t=uJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uJ(e){var t=fJ(e,"string");return yd(t)=="symbol"?t:String(t)}function fJ(e,t){if(yd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(yd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dJ(e,t){if(e==null)return{};var n=hJ(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hJ(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var lO=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=dJ(e,aJ);return c.jsxs("svg",Dv(Dv({height:n,style:Dv({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Jc}),c.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z",fill:"#D97757",fillRule:"nonzero"})]}))});function vd(e){"@babel/helpers - typeof";return vd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vd(e)}var pJ=["size","style"];function _6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Lv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_6(Object(n),!0).forEach(function(r){mJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function mJ(e,t,n){return t=gJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gJ(e){var t=yJ(e,"string");return vd(t)=="symbol"?t:String(t)}function yJ(e,t){if(vd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(vd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vJ(e,t){if(e==null)return{};var n=_J(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _J(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var aO=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=vJ(e,pJ);return c.jsxs("svg",Lv(Lv({fill:"currentColor",fillRule:"nonzero",height:n,style:Lv({flex:"none",lineHeight:1},r),viewBox:"0 0 97 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Jc}),c.jsx("path",{d:"M13.623 20.222c-3.417 0-5.753-1.901-6.855-4.827a12.992 12.992 0 01-.838-4.772c0-4.907 2.206-8.315 7.08-8.315 3.275 0 5.297 1.425 6.448 4.826h1.402l-.19-4.69C18.709 1.18 16.258.543 13.276.543c-4.2 0-7.775 1.874-9.763 5.254a11.357 11.357 0 00-1.511 5.872c0 3.753 1.777 7.08 5.113 8.926a11.95 11.95 0 005.943 1.398c3.254 0 5.835-.617 8.122-1.697l.593-5.172h-1.43c-.858 2.362-1.88 3.78-3.574 4.534-.831.373-1.88.564-3.146.564zm14.74-17.914L28.499 0h-.967L23.23 1.29v.699l1.907.882v16.142c0 1.1-.565 1.344-2.043 1.528v1.18h7.319v-1.18c-1.484-.184-2.042-.428-2.042-1.528V2.315l-.007-.007zm29.104 19.685h.565l4.95-.937v-1.208l-.695-.054c-1.157-.109-1.457-.346-1.457-1.29V9.897l.137-2.763h-.783l-4.678.672v1.181l.457.082c1.266.183 1.64.536 1.64 1.419v7.67c-1.212.937-2.369 1.527-3.744 1.527-1.525 0-2.471-.774-2.471-2.58V9.905l.136-2.763h-.804l-4.684.672v1.181l.484.082c1.266.183 1.64.536 1.64 1.418v7.08c0 3 1.703 4.426 4.412 4.426 2.07 0 3.765-1.1 5.038-2.627L57.474 22l-.007-.007zm-13.602-9.55c0-3.836-2.043-5.309-5.733-5.309-3.254 0-5.616 1.344-5.616 3.57 0 .666.238 1.175.721 1.528l2.478-.326c-.109-.746-.163-1.201-.163-1.391 0-1.263.674-1.901 2.042-1.901 2.022 0 3.044 1.419 3.044 3.7v.746l-5.106 1.527c-1.702.462-2.67.863-3.316 1.8a3.386 3.386 0 00-.476 1.9c0 2.172 1.497 3.706 4.057 3.706 1.852 0 3.493-.835 4.922-2.416.51 1.581 1.294 2.416 2.69 2.416 1.13 0 2.15-.455 3.063-1.344l-.272-.937a4.363 4.363 0 01-1.178.163c-.783 0-1.157-.617-1.157-1.826v-5.607zm-6.536 7.378c-1.396 0-2.26-.808-2.26-2.226 0-.964.456-1.528 1.43-1.854l4.139-1.31v3.965c-1.321.997-2.097 1.425-3.31 1.425zm43.095 1.235v-1.208l-.701-.054c-1.158-.109-1.45-.346-1.45-1.29V2.308L78.409 0h-.974l-4.302 1.29v.699l1.906.882V8.18a6.024 6.024 0 00-3.656-1.046c-4.276 0-7.612 3.245-7.612 8.098 0 3.998 2.397 6.761 6.346 6.761 2.042 0 3.819-.99 4.922-2.525l-.136 2.525h.571l4.95-.937zm-8.96-12.313c2.043 0 3.575 1.181 3.575 3.353v6.11a4.91 4.91 0 01-3.547 1.425c-2.928 0-4.412-2.308-4.412-5.39 0-3.462 1.695-5.498 4.385-5.498zm19.424 3.055c-.381-1.792-1.484-2.81-3.016-2.81-2.288 0-3.874 1.717-3.874 4.18 0 3.646 1.934 6.008 5.059 6.008a5.858 5.858 0 005.03-2.953l.913.245c-.408 3.163-3.281 5.525-6.808 5.525-4.14 0-6.992-3.054-6.992-7.399 0-4.378 3.098-7.46 7.237-7.46 3.09 0 5.27 1.853 5.97 5.07l-10.783 3.3V14.05l7.264-2.247v-.006z"})]}))});function _d(e){"@babel/helpers - typeof";return _d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_d(e)}var bJ=["type"];function b6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function xJ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?b6(Object(n),!0).forEach(function(r){wJ(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b6(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function wJ(e,t,n){return t=SJ(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SJ(e){var t=CJ(e,"string");return _d(t)=="symbol"?t:String(t)}function CJ(e,t){if(_d(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(_d(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jJ(e,t){if(e==null)return{};var n=kJ(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kJ(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var EJ=g.memo(function(e){var t=e.type,n=t===void 0?"mono":t,r=jJ(e,bJ),i=n==="color"?lO:yx;return c.jsx(Br,xJ({Icon:i,Text:aO,"aria-label":Jc,spaceMultiple:qX,textMultiple:WX},r))}),Lr=yx;Lr.Color=lO;Lr.Text=aO;Lr.Combine=EJ;Lr.Avatar=lJ;Lr.colorPrimary=oO;Lr.title=Jc;const gb="jait-gateway-url";function OJ(){var e;return typeof window<"u"&&((e=window.location)!=null&&e.origin)&&window.location.origin!=="null"?window.location.origin:"http://localhost:8000"}function bd(e){return e.endsWith("/")?e.slice(0,-1):e}function x6(e){return e.replace(/^http/,"ws")}function ha(){try{const e=localStorage.getItem(gb);return e&&e.trim()?e.trim():null}catch{return null}}function mg(e){try{e&&e.trim()?localStorage.setItem(gb,bd(e.trim())):localStorage.removeItem(gb)}catch{}window.dispatchEvent(new Event("jait-gateway-url-changed"))}function cn(){var n;const e=ha();if(e)return bd(e);const t=(n=window.jaitDesktop)==null?void 0:n.gatewayUrl;return t?bd(t):OJ()}function Kh(){const e=ha();if(e)return bd(x6(e));const t=cn();return bd(x6(t))}function w6(){var e;return!!(ha()||(e=window.jaitDesktop)!=null&&e.gatewayUrl)}cn();Kh();const Bn=cn();class NJ{getToken(){return localStorage.getItem("token")}getHeaders(t=!1){const n={};t&&(n["Content-Type"]="application/json");const r=this.getToken();return r&&(n.Authorization=`Bearer ${r}`),n}async listProviders(){const t=await fetch(`${Bn}/api/providers`,{headers:this.getHeaders()});if(!t.ok)throw new Error(`Failed to list providers: ${t.statusText}`);const n=await t.json();return{providers:n.providers,remoteProviders:n.remoteProviders??[]}}async listProviderModels(t){const n=await fetch(`${Bn}/api/providers/${t}/models`,{headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to list models: ${n.statusText}`);return(await n.json()).models}async listThreads(t){const n=t?`?sessionId=${encodeURIComponent(t)}`:"",r=await fetch(`${Bn}/api/threads${n}`,{headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to list threads: ${r.statusText}`);return(await r.json()).threads}async getThread(t){const n=await fetch(`${Bn}/api/threads/${t}`,{headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to get thread: ${n.statusText}`);return n.json()}async createThread(t){const n=await fetch(`${Bn}/api/threads`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(t)});if(!n.ok)throw new Error(`Failed to create thread: ${n.statusText}`);return n.json()}async updateThread(t,n){const r=await fetch(`${Bn}/api/threads/${t}`,{method:"PATCH",headers:this.getHeaders(!0),body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to update thread: ${r.statusText}`);return r.json()}async deleteThread(t){const n=await fetch(`${Bn}/api/threads/${t}`,{method:"DELETE",headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to delete thread: ${n.statusText}`)}async startThread(t,n){const r=typeof n=="string"?{message:n}:n??{},i=await fetch(`${Bn}/api/threads/${t}/start`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(r)});if(!i.ok){const o=await i.json().catch(()=>({})),a=new Error(o.error||`Failed to start thread: ${i.statusText}`);throw o.code&&(a.code=o.code),a}return i.json()}async sendTurn(t,n){const r=await fetch(`${Bn}/api/threads/${t}/send`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({message:n})});if(!r.ok)throw new Error(`Failed to send turn: ${r.statusText}`)}async stopThread(t){const n=await fetch(`${Bn}/api/threads/${t}/stop`,{method:"POST",headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to stop thread: ${n.statusText}`)}async interruptThread(t){const n=await fetch(`${Bn}/api/threads/${t}/interrupt`,{method:"POST",headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to interrupt thread: ${n.statusText}`)}async approveToolCall(t,n,r){const i=await fetch(`${Bn}/api/threads/${t}/approve`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({requestId:n,approved:r})});if(!i.ok)throw new Error(`Failed to approve: ${i.statusText}`)}async createPullRequest(t,n){const r=await fetch(`${Bn}/api/threads/${t}/create-pr`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(n)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error||`Failed to create pull request: ${r.statusText}`)}return r.json()}async getActivities(t,n){const r=typeof n=="number"?`?limit=${n}`:"",i=await fetch(`${Bn}/api/threads/${t}/activities${r}`,{headers:this.getHeaders()});if(!i.ok)throw new Error(`Failed to get activities: ${i.statusText}`);return(await i.json()).activities}async listRepos(){const t=await fetch(`${Bn}/api/repos`,{headers:this.getHeaders()});if(!t.ok)throw new Error(`Failed to list repos: ${t.statusText}`);return(await t.json()).repos}async createRepo(t){const n=await fetch(`${Bn}/api/repos`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(t)});if(!n.ok)throw new Error(`Failed to create repo: ${n.statusText}`);return(await n.json()).repo}async updateRepo(t,n){const r=await fetch(`${Bn}/api/repos/${t}`,{method:"PATCH",headers:this.getHeaders(!0),body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to update repo: ${r.statusText}`);return(await r.json()).repo}async deleteRepo(t){const n=await fetch(`${Bn}/api/repos/${t}`,{method:"DELETE",headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to delete repo: ${n.statusText}`)}}const Hn=new NJ,TJ=({className:e})=>c.jsx(rn,{size:16,className:e}),PJ=({className:e})=>c.jsx(Lr,{size:16,className:e}),zv=[{value:"jait",label:"Jait",icon:f2,description:"Native Jait agent loop with full tool access"},{value:"codex",label:"Codex",icon:TJ,description:"OpenAI Codex CLI — coding agent with MCP tools"},{value:"claude-code",label:"Claude Code",icon:PJ,description:"Anthropic Claude Code CLI — coding agent with MCP tools"}];function AJ(e){const t=e.toLowerCase();return t.includes("not installed")||t.includes("not found")?"not installed":t.includes("not authenticated")||t.includes("login")?"not authenticated":"unavailable"}function RJ({provider:e,onChange:t,disabled:n,className:r,iconOnly:i=!1}){const[o,a]=g.useState({}),[u,d]=g.useState([]);g.useEffect(()=>{Hn.listProviders().then(({providers:p,remoteProviders:v})=>{const b={};for(const w of p)b[w.id]=w;a(b),d(v)}).catch(()=>{})},[]);const h=zv.find(p=>p.value===e)??zv[0],y=h.icon;return c.jsxs(bl,{children:[c.jsx(xl,{asChild:!0,disabled:n,children:c.jsxs("button",{type:"button",className:Ae("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",r),title:`Provider: ${h.label}`,"aria-label":`Provider: ${h.label}`,children:[c.jsx(y,{className:"h-4 w-4"}),!i&&c.jsx("span",{children:h.label}),c.jsx(Ss,{className:"h-3 w-3 opacity-60"})]})}),c.jsx(ao,{align:"start",side:"top",className:"w-72",children:zv.map(p=>{const v=p.icon,b=e===p.value,w=o[p.value],S=(w==null?void 0:w.available)!==!1,C=w==null?void 0:w.unavailableReason,j=S?void 0:u.find(N=>N.providers.includes(p.value)),E=S||!!j;return c.jsxs(Yi,{onClick:()=>t(p.value),disabled:!E,className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[c.jsx(v,{className:"h-4 w-4 mt-0.5 shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"text-sm font-medium flex items-center gap-1.5",children:[p.label,!S&&j&&c.jsxs("span",{className:"text-[10px] text-blue-500 flex items-center gap-0.5",children:["remote · ",j.nodeName]}),!E&&c.jsxs("span",{className:"text-[10px] text-destructive/80 flex items-center gap-0.5",children:[c.jsx(Oc,{className:"h-3 w-3"}),C?AJ(C):"unavailable"]})]}),c.jsx("div",{className:"text-xs text-muted-foreground leading-snug",children:!E&&C?C:p.description})]}),b&&c.jsx(zr,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"})]},p.value)})})]})}function MJ({provider:e,model:t,onChange:n,disabled:r,className:i}){var p;const[o,a]=g.useState([]),[u,d]=g.useState(!1),h=g.useRef(null);g.useEffect(()=>{e!=="jait"&&h.current!==e&&(h.current=e,d(!0),Hn.listProviderModels(e).then(v=>{if(a(v),!t){const b=v.find(w=>w.isDefault);b&&n(b.id)}}).catch(()=>a([])).finally(()=>d(!1)))},[e]);const y=t?((p=o.find(v=>v.id===t))==null?void 0:p.name)??t:"model";return c.jsxs(bl,{children:[c.jsx(xl,{asChild:!0,disabled:r||u,children:c.jsxs("button",{type:"button",className:Ae("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",i),title:`Model: ${t??"none"}`,children:[u?c.jsx(bt,{className:"h-3 w-3 animate-spin"}):c.jsx("span",{className:"font-mono text-[11px]",children:y}),c.jsx(Ss,{className:"h-3 w-3 opacity-60"})]})}),c.jsxs(ao,{align:"start",side:"top",className:"w-64",children:[c.jsx(y1,{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Model"}),c.jsx(Dc,{}),o.map(v=>c.jsxs(Yi,{onClick:()=>n(v.id),className:"flex items-start gap-2 py-1.5 cursor-pointer",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"text-sm font-medium",children:[v.name,v.isDefault&&c.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground font-normal",children:"(default)"})]}),v.description&&c.jsx("div",{className:"text-[11px] text-muted-foreground leading-snug",children:v.description})]}),t===v.id&&c.jsx(zr,{className:"h-3.5 w-3.5 mt-0.5 text-primary shrink-0"})]},v.id)),o.length===0&&!u&&c.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No models available"})]})]})}const DJ=768;function vx(){const e=()=>window.innerWidth<DJ,[t,n]=g.useState(e);return g.useEffect(()=>{const r=()=>n(e());return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),t}const LJ="https://cdn.jsdelivr.net/gh/vscode-icons/vscode-icons@12.9.0/icons/",S6=[];function Ym(e,t){const n=document.createElement("span");n.contentEditable="false",n.setAttribute("data-file-path",e.path),n.setAttribute("data-file-name",e.name),n.className="inline-flex items-center gap-0.5 align-baseline text-[12px] leading-tight pl-0.5 pr-0 py-[1px] mx-[2px] rounded bg-muted text-foreground select-none cursor-default whitespace-nowrap";const r=document.createElement("span");r.className="inline-flex items-center shrink-0",r.innerHTML=`<img src="${LJ}${zJ(e.name)}" alt="" class="h-3.5 w-3.5" draggable="false" />`,n.appendChild(r);const i=document.createElement("span");i.className="truncate max-w-[140px]",i.textContent=e.name,n.appendChild(i);const o=document.createElement("button");return o.type="button",o.className="inline-flex items-center p-0.5 rounded hover:bg-foreground/10 transition-colors",o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',o.addEventListener("mousedown",a=>{a.preventDefault(),a.stopPropagation()}),o.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),n.remove(),t==null||t(e.path)}),n.appendChild(o),n}function zJ(e){return ol.getIconForFile(e)??ol.DEFAULT_FILE}function ds(e){let t="";for(const n of e.childNodes)if(n.nodeType===Node.TEXT_NODE)t+=n.textContent??"";else if(n instanceof HTMLElement){if(n.hasAttribute("data-file-path"))continue;n.tagName==="BR"?t+=`
|
|
642
642
|
`:t+=ds(n)}return t}function $J(e){const t=[];return e.querySelectorAll("[data-file-path]").forEach(n=>{t.push(n.getAttribute("data-file-path"))}),t}function Sf(e){const t=[];return e.querySelectorAll("[data-file-path]").forEach(n=>{t.push({path:n.getAttribute("data-file-path"),name:n.getAttribute("data-file-name")||n.getAttribute("data-file-path").split("/").pop()})}),t}function $v(e){const t=window.getSelection();if(t){const n=document.createRange();n.selectNodeContents(e),n.collapse(!1),t.removeAllRanges(),t.addRange(n)}}const Xm=g.forwardRef(function({value:t,onChange:n,onSubmit:r,onStop:i,onQueue:o,isLoading:a,disabled:u,controlsDisabled:d,placeholder:h="Ask anything...",className:y,footerLeadingContent:p,onVoiceInput:v,viewMode:b,onViewModeChange:w,mode:S,onModeChange:C,provider:j,onProviderChange:E,cliModel:N,onCliModelChange:P,availableFiles:I=S6,onSearchFiles:R,workspaceOpen:$=!1},X){const G=g.useRef(null),D=g.useRef(null),q=vx(),[F,V]=g.useState(!1),W=g.useRef(0),[L,O]=g.useState(!t),[H,B]=g.useState(!1),[U,A]=g.useState(""),[M,Q]=g.useState(0),T=g.useRef(!1);g.useEffect(()=>{T.current=H},[H]);const ie=g.useRef(I);g.useEffect(()=>{ie.current=I},[I]);const oe=g.useRef(n);g.useEffect(()=>{oe.current=n},[n]);const te=g.useRef(R);g.useEffect(()=>{te.current=R},[R]);const re=g.useRef($);g.useEffect(()=>{re.current=$},[$]);const[J,Y]=g.useState([]),[ce,ke]=g.useState(!1),je=g.useRef(null),Oe=!!u,Be=!!(d??u??!1)||!!a,nt=!!(b&&w),at=!!(j&&E),Ue=!!(j&&j!=="jait"&&P),kt=!!(S&&C&&(!j||j==="jait")&&b!=="manager"),ut=nt||at||Ue||kt||!!p,We=g.useRef(!1),ft=g.useCallback(ae=>{var Ce;const he=G.current;he&&((Ce=he.querySelector(`[data-file-path="${CSS.escape(ae)}"]`))==null||Ce.remove(),We.current=!0,oe.current(ds(he)),We.current=!1,O(!ds(he).trim()&&!he.querySelector("[data-file-path]")))},[]);g.useImperativeHandle(X,()=>({insertChip:ae=>{const he=G.current;if(!he||he.querySelector(`[data-file-path="${CSS.escape(ae.path)}"]`))return;const Ce=Ym(ae,ft);he.appendChild(Ce),he.appendChild(document.createTextNode(" ")),$v(he),We.current=!0,oe.current(ds(he)),We.current=!1,O(!1)}}),[ft]),g.useEffect(()=>{var Je;if(!H){Y(qe=>qe.length===0?qe:S6);return}(Je=je.current)==null||Je.abort();const ae=new Set(G.current?$J(G.current):[]),he=ie.current;if(!U){const qe=he.filter(It=>!ae.has(It.path)).slice(0,15);Y(qe),ke(!1);return}const Ce=he.filter(qe=>{if(ae.has(qe.path))return!1;const It=U.toLowerCase();return qe.name.toLowerCase().includes(It)||qe.path.toLowerCase().includes(It)}).slice(0,10);Y(Ce);const Xe=te.current;if(!Xe){ke(!1);return}ke(!0);const Pe=new AbortController;je.current=Pe;const $e=setTimeout(async()=>{try{const qe=await Xe(U,15,Pe.signal);if(Pe.signal.aborted)return;const It=new Set,ct=[];for(const Ze of qe)ae.has(Ze.path)||It.has(Ze.path)||(It.add(Ze.path),ct.push(Ze));for(const Ze of Ce)It.has(Ze.path)||(It.add(Ze.path),ct.push(Ze));Y(ct.slice(0,15))}catch{}finally{Pe.signal.aborted||ke(!1)}},150);return()=>{clearTimeout($e),Pe.abort()}},[H,U]),g.useEffect(()=>{var Ce;const ae=G.current;if(!ae||We.current)return;ds(ae)!==t&&(We.current=!0,ae.innerHTML="",t&&ae.appendChild(document.createTextNode(t)),O(!t&&!((Ce=G.current)!=null&&Ce.querySelector("[data-file-path]"))),We.current=!1)},[t]),g.useEffect(()=>{if(!H)return;const ae=he=>{D.current&&!D.current.contains(he.target)&&B(!1)};return document.addEventListener("mousedown",ae),()=>document.removeEventListener("mousedown",ae)},[H]),g.useEffect(()=>{Q(0)},[U]);const Ge=g.useCallback(ae=>{const he=G.current;if(!he)return;const Ce=window.getSelection();if(Ce&&Ce.rangeCount>0){const Xe=Ce.getRangeAt(0),Pe=Xe.startContainer;if(Pe.nodeType===Node.TEXT_NODE&&Pe.textContent){const $e=Pe.textContent,Je=Xe.startOffset,qe=$e.lastIndexOf("@",Je-1);if(qe>=0){Pe.textContent=$e.slice(0,qe)+$e.slice(Je);const It=Pe.textContent.slice(0,qe),ct=Pe.textContent.slice(qe);Pe.textContent=It;const Ze=Ym(ae,ft),wt=document.createTextNode(ct||" "),Gt=Pe.parentNode;Pe.nextSibling?(Gt.insertBefore(wt,Pe.nextSibling),Gt.insertBefore(Ze,wt)):(Gt.appendChild(Ze),Gt.appendChild(wt));const Gn=document.createRange();Gn.setStart(wt,ct?0:1),Gn.collapse(!0),Ce.removeAllRanges(),Ce.addRange(Gn)}}}B(!1),A(""),We.current=!0,n(ds(he)),We.current=!1},[n]);g.useEffect(()=>{const ae=G.current;if(!ae)return;const he=()=>{We.current=!0;const Ce=ds(ae);oe.current(Ce),O(!Ce.trim()&&!ae.querySelector("[data-file-path]")),We.current=!1;const Xe=window.getSelection();if(!Xe||Xe.rangeCount===0)return;const Pe=Xe.getRangeAt(0);let $e=Pe.startContainer,Je=Pe.startOffset;if($e.nodeType!==Node.TEXT_NODE){const ct=$e.childNodes[Je-1]??$e.childNodes[Je];if((ct==null?void 0:ct.nodeType)===Node.TEXT_NODE)$e=ct,Je=ct.length;else if(Je>0&&$e.childNodes[Je-1]){let Ze=$e.childNodes[Je-1];for(;Ze&&Ze.nodeType!==Node.TEXT_NODE&&Ze.lastChild;)Ze=Ze.lastChild;if((Ze==null?void 0:Ze.nodeType)===Node.TEXT_NODE)$e=Ze,Je=Ze.length;else return}else return}const qe=$e.textContent??"";if(T.current){const ct=qe.lastIndexOf("@",Je-1);if(ct<0||Je<=ct){B(!1);return}const Ze=qe.slice(ct+1,Je);Ze.includes(" ")||Ze.includes(`
|
|
643
643
|
`)?B(!1):A(Ze)}else if(Je>0&&qe[Je-1]==="@"){const ct=Je>1?qe[Je-2]:" ";(ct===" "||ct===`
|
|
644
644
|
`||ct===" "||Je===1)&&re.current&&(A(""),B(!0))}};return ae.addEventListener("input",he),()=>ae.removeEventListener("input",he)},[]);const _e=g.useCallback(ae=>{if(H){if(ae.key==="ArrowDown"){ae.preventDefault(),Q(he=>Math.min(he+1,J.length-1));return}if(ae.key==="ArrowUp"){ae.preventDefault(),Q(he=>Math.max(he-1,0));return}if(ae.key==="Enter"||ae.key==="Tab"){ae.preventDefault(),J[M]&&Ge(J[M]);return}if(ae.key==="Escape"){ae.preventDefault(),B(!1);return}}if(ae.key==="Enter"&&!ae.shiftKey){ae.preventDefault();const he=G.current,Ce=he?ds(he).trim():t.trim(),Xe=he?Sf(he):[];(Ce||Xe.length>0)&&!a&&r(Xe)}},[H,J,M,Ge,t,a,r]),ye=g.useCallback(ae=>{ae.preventDefault();const he=ae.clipboardData.getData("text/plain");document.execCommand("insertText",!1,he)},[]),xe=g.useCallback(ae=>{ae.preventDefault(),ae.stopPropagation(),W.current++,W.current===1&&V(!0)},[]),Z=g.useCallback(ae=>{ae.preventDefault(),ae.stopPropagation(),W.current--,W.current===0&&V(!1)},[]),le=g.useCallback(ae=>{ae.preventDefault(),ae.stopPropagation(),ae.dataTransfer.dropEffect="copy"},[]),ve=g.useCallback(ae=>{var Xe;ae.preventDefault(),ae.stopPropagation(),W.current=0,V(!1);const he=G.current;if(!he)return;const Ce=ae.dataTransfer.getData("text/jait-file");if(Ce){try{const Pe=JSON.parse(Ce);if(!he.querySelector(`[data-file-path="${CSS.escape(Pe.path)}"]`)){const $e=Ym(Pe,ft);he.appendChild($e),he.appendChild(document.createTextNode(" ")),$v(he),We.current=!0,n(ds(he)),We.current=!1,O(!1)}}catch{}return}if((Xe=ae.dataTransfer.files)!=null&&Xe.length){for(const Pe of Array.from(ae.dataTransfer.files)){const $e=Pe.name,Je=Pe.webkitRelativePath||Pe.name;if(!he.querySelector(`[data-file-path="${CSS.escape(Je)}"]`)){const qe=Ym({path:Je,name:$e},ft);qe.setAttribute("data-external","true"),he.appendChild(qe),he.appendChild(document.createTextNode(" "))}}$v(he),We.current=!0,n(ds(he)),We.current=!1,O(!1)}},[n]);return c.jsxs("div",{className:Ae("relative z-10 flex flex-col rounded-2xl border bg-background dark:bg-card shadow-sm focus-within:border-primary/50 focus-within:ring-2 focus-within:ring-primary/20",F&&"ring-2 ring-primary/30 border-primary/40",y),onDragEnter:xe,onDragLeave:Z,onDragOver:le,onDrop:ve,children:[c.jsxs("div",{className:"relative px-3 pt-3 pb-1.5",children:[L&&c.jsx("div",{className:"absolute top-5 left-5 pointer-events-none text-muted-foreground text-base leading-relaxed select-none",children:h}),c.jsx("div",{ref:G,contentEditable:!Oe,role:"textbox","aria-multiline":!0,suppressContentEditableWarning:!0,onKeyDown:_e,onPaste:ye,className:Ae("min-h-[40px] max-h-[200px] overflow-y-auto text-base leading-relaxed outline-none py-2 px-2 text-foreground","whitespace-pre-wrap break-words",Oe&&"cursor-not-allowed opacity-50"),style:{wordBreak:"break-word"}})]}),H&&(J.length>0||ce)&&c.jsxs("div",{ref:D,className:"absolute left-3 bottom-full mb-1 w-72 max-h-52 overflow-y-auto rounded-lg border bg-popover p-1 shadow-lg z-50",children:[J.map((ae,he)=>c.jsxs("button",{type:"button",className:Ae("flex items-center gap-2 w-full text-left text-xs px-2 py-1.5 rounded-md transition-colors",he===M?"bg-accent text-accent-foreground":"hover:bg-muted"),onMouseDown:Ce=>{Ce.preventDefault(),Ge(ae)},onMouseEnter:()=>Q(he),children:[c.jsx(cl,{filename:ae.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"truncate",children:ae.path})]},ae.path)),ce&&c.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 text-xs text-muted-foreground",children:[c.jsx("span",{className:"h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Searching..."]}),!ce&&J.length===0&&c.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1.5",children:"No matching files"})]}),c.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-3 pb-2.5 pt-0.5",children:[ut&&c.jsx("div",{className:"min-w-0 flex-1 overflow-x-auto scrollbar-none",children:c.jsxs("div",{className:"flex min-w-max items-center gap-1 pr-1",children:[nt&&c.jsx(BY,{mode:b,onChange:w,disabled:Be,compact:q}),p,at&&c.jsx(RJ,{provider:j,onChange:E,disabled:Be,iconOnly:!0}),Ue&&c.jsx(MJ,{provider:j,model:N??null,onChange:P,disabled:Be}),kt&&c.jsx(IY,{mode:S,onChange:C,disabled:Be})]})}),c.jsxs("div",{className:Ae("flex shrink-0 items-center gap-1.5",ut?"pl-1":"ml-auto"),children:[v&&!a&&c.jsx(Ee,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 shrink-0 rounded-lg",onClick:v,title:"Voice input",children:c.jsx(AR,{className:"h-4 w-4"})}),a&&c.jsx(Ee,{type:"button",size:"icon",variant:"outline",className:"h-8 w-8 shrink-0 rounded-lg",onClick:i,title:"Stop generating",children:c.jsx(ed,{className:"h-3.5 w-3.5 fill-current"})}),a&&o?c.jsxs("div",{className:"flex items-center",children:[c.jsx(Ee,{type:"button",size:"icon",className:"h-8 w-8 shrink-0 rounded-lg rounded-r-none border-r-0",disabled:L||Oe,title:"Queue message",onClick:()=>{const ae=G.current,he=ae?Sf(ae):[];o(he)},children:c.jsx(ug,{className:"h-4 w-4"})}),c.jsxs(bl,{children:[c.jsx(xl,{asChild:!0,children:c.jsx(Ee,{type:"button",size:"icon",className:"h-8 w-5 shrink-0 rounded-lg rounded-l-none px-0",disabled:L||Oe,children:c.jsx(Ss,{className:"h-3 w-3"})})}),c.jsxs(ao,{align:"end",side:"top",className:"min-w-[160px]",children:[c.jsxs(Yi,{disabled:L||Oe,onSelect:()=>{const ae=G.current,he=ae?Sf(ae):[];r(he)},children:[c.jsx(ug,{className:"h-3.5 w-3.5 mr-2"}),"Send now"]}),c.jsxs(Yi,{disabled:L||Oe,onSelect:()=>{const ae=G.current,he=ae?Sf(ae):[];o(he)},children:[c.jsx(OR,{className:"h-3.5 w-3.5 mr-2"}),"Add to queue"]})]})]})]}):a?null:c.jsx(Ee,{type:"button",size:"icon",className:"h-8 w-8 shrink-0 rounded-lg",disabled:L||Oe,onClick:()=>{const ae=G.current,he=ae?Sf(ae):[];r(he)},children:c.jsx(ug,{className:"h-4 w-4"})})]})]})]})});function IJ(e){const t=BJ(e),n=g.forwardRef((r,i)=>{const{children:o,...a}=r,u=g.Children.toArray(o),d=u.find(FJ);if(d){const h=d.props.children,y=u.map(p=>p===d?g.Children.count(h)>1?g.Children.only(null):g.isValidElement(h)?h.props.children:null:p);return c.jsx(t,{...a,ref:i,children:g.isValidElement(h)?g.cloneElement(h,void 0,y):null})}return c.jsx(t,{...a,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}function BJ(e){const t=g.forwardRef((n,r)=>{const{children:i,...o}=n;if(g.isValidElement(i)){const a=VJ(i),u=UJ(o,i.props);return i.type!==g.Fragment&&(u.ref=r?vn(r,a):a),g.cloneElement(i,u)}return g.Children.count(i)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var HJ=Symbol("radix.slottable");function FJ(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===HJ}function UJ(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...u)=>{const d=o(...u);return i(...u),d}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function VJ(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var WJ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Gh=WJ.reduce((e,t)=>{const n=IJ(`Primitive.${t}`),r=g.forwardRef((i,o)=>{const{asChild:a,...u}=i,d=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(d,{...u,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function qJ(e,t=[]){let n=[];function r(o,a){const u=g.createContext(a),d=n.length;n=[...n,a];const h=p=>{var j;const{scope:v,children:b,...w}=p,S=((j=v==null?void 0:v[e])==null?void 0:j[d])||u,C=g.useMemo(()=>w,Object.values(w));return c.jsx(S.Provider,{value:C,children:b})};h.displayName=o+"Provider";function y(p,v){var S;const b=((S=v==null?void 0:v[e])==null?void 0:S[d])||u,w=g.useContext(b);if(w)return w;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[h,y]}const i=()=>{const o=n.map(a=>g.createContext(a));return function(u){const d=(u==null?void 0:u[e])||o;return g.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return i.scopeName=e,[r,KJ(i,...t)]}function KJ(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const a=r.reduce((u,{useScope:d,scopeName:h})=>{const p=d(o)[`__scope${h}`];return{...u,...p}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function yb(e,[t,n]){return Math.min(n,Math.max(t,e))}function GJ(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var _x="ScrollArea",[cO]=qJ(_x),[YJ,ki]=cO(_x),uO=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:o=600,...a}=e,[u,d]=g.useState(null),[h,y]=g.useState(null),[p,v]=g.useState(null),[b,w]=g.useState(null),[S,C]=g.useState(null),[j,E]=g.useState(0),[N,P]=g.useState(0),[I,R]=g.useState(!1),[$,X]=g.useState(!1),G=xt(t,q=>d(q)),D=Lh(i);return c.jsx(YJ,{scope:n,type:r,dir:D,scrollHideDelay:o,scrollArea:u,viewport:h,onViewportChange:y,content:p,onContentChange:v,scrollbarX:b,onScrollbarXChange:w,scrollbarXEnabled:I,onScrollbarXEnabledChange:R,scrollbarY:S,onScrollbarYChange:C,scrollbarYEnabled:$,onScrollbarYEnabledChange:X,onCornerWidthChange:E,onCornerHeightChange:P,children:c.jsx(Gh.div,{dir:D,...a,ref:G,style:{position:"relative","--radix-scroll-area-corner-width":j+"px","--radix-scroll-area-corner-height":N+"px",...e.style}})})});uO.displayName=_x;var fO="ScrollAreaViewport",dO=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:i,...o}=e,a=ki(fO,n),u=g.useRef(null),d=xt(t,u,a.onViewportChange);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),c.jsx(Gh.div,{"data-radix-scroll-area-viewport":"",...o,ref:d,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...e.style},children:c.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});dO.displayName=fO;var ks="ScrollAreaScrollbar",bx=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=ki(ks,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:a}=i,u=e.orientation==="horizontal";return g.useEffect(()=>(u?o(!0):a(!0),()=>{u?o(!1):a(!1)}),[u,o,a]),i.type==="hover"?c.jsx(XJ,{...r,ref:t,forceMount:n}):i.type==="scroll"?c.jsx(JJ,{...r,ref:t,forceMount:n}):i.type==="auto"?c.jsx(hO,{...r,ref:t,forceMount:n}):i.type==="always"?c.jsx(xx,{...r,ref:t}):null});bx.displayName=ks;var XJ=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=ki(ks,e.__scopeScrollArea),[o,a]=g.useState(!1);return g.useEffect(()=>{const u=i.scrollArea;let d=0;if(u){const h=()=>{window.clearTimeout(d),a(!0)},y=()=>{d=window.setTimeout(()=>a(!1),i.scrollHideDelay)};return u.addEventListener("pointerenter",h),u.addEventListener("pointerleave",y),()=>{window.clearTimeout(d),u.removeEventListener("pointerenter",h),u.removeEventListener("pointerleave",y)}}},[i.scrollArea,i.scrollHideDelay]),c.jsx(pr,{present:n||o,children:c.jsx(hO,{"data-state":o?"visible":"hidden",...r,ref:t})})}),JJ=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=ki(ks,e.__scopeScrollArea),o=e.orientation==="horizontal",a=P1(()=>d("SCROLL_END"),100),[u,d]=GJ("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(u==="idle"){const h=window.setTimeout(()=>d("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(h)}},[u,i.scrollHideDelay,d]),g.useEffect(()=>{const h=i.viewport,y=o?"scrollLeft":"scrollTop";if(h){let p=h[y];const v=()=>{const b=h[y];p!==b&&(d("SCROLL"),a()),p=b};return h.addEventListener("scroll",v),()=>h.removeEventListener("scroll",v)}},[i.viewport,o,d,a]),c.jsx(pr,{present:n||u!=="hidden",children:c.jsx(xx,{"data-state":u==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Ie(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:Ie(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),hO=g.forwardRef((e,t)=>{const n=ki(ks,e.__scopeScrollArea),{forceMount:r,...i}=e,[o,a]=g.useState(!1),u=e.orientation==="horizontal",d=P1(()=>{if(n.viewport){const h=n.viewport.offsetWidth<n.viewport.scrollWidth,y=n.viewport.offsetHeight<n.viewport.scrollHeight;a(u?h:y)}},10);return Fc(n.viewport,d),Fc(n.content,d),c.jsx(pr,{present:r||o,children:c.jsx(xx,{"data-state":o?"visible":"hidden",...i,ref:t})})}),xx=g.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,i=ki(ks,e.__scopeScrollArea),o=g.useRef(null),a=g.useRef(0),[u,d]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=vO(u.viewport,u.content),y={...r,sizes:u,onSizesChange:d,hasThumb:h>0&&h<1,onThumbChange:v=>o.current=v,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:v=>a.current=v};function p(v,b){return rZ(v,a.current,u,b)}return n==="horizontal"?c.jsx(ZJ,{...y,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const v=i.viewport.scrollLeft,b=C6(v,u,i.dir);o.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:v=>{i.viewport&&(i.viewport.scrollLeft=v)},onDragScroll:v=>{i.viewport&&(i.viewport.scrollLeft=p(v,i.dir))}}):n==="vertical"?c.jsx(QJ,{...y,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const v=i.viewport.scrollTop,b=C6(v,u);o.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:v=>{i.viewport&&(i.viewport.scrollTop=v)},onDragScroll:v=>{i.viewport&&(i.viewport.scrollTop=p(v))}}):null}),ZJ=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,o=ki(ks,e.__scopeScrollArea),[a,u]=g.useState(),d=g.useRef(null),h=xt(t,d,o.onScrollbarXChange);return g.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),c.jsx(mO,{"data-orientation":"horizontal",...i,ref:h,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":T1(n)+"px",...e.style},onThumbPointerDown:y=>e.onThumbPointerDown(y.x),onDragScroll:y=>e.onDragScroll(y.x),onWheelScroll:(y,p)=>{if(o.viewport){const v=o.viewport.scrollLeft+y.deltaX;e.onWheelScroll(v),bO(v,p)&&y.preventDefault()}},onResize:()=>{d.current&&o.viewport&&a&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:Fg(a.paddingLeft),paddingEnd:Fg(a.paddingRight)}})}})}),QJ=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,o=ki(ks,e.__scopeScrollArea),[a,u]=g.useState(),d=g.useRef(null),h=xt(t,d,o.onScrollbarYChange);return g.useEffect(()=>{d.current&&u(getComputedStyle(d.current))},[d]),c.jsx(mO,{"data-orientation":"vertical",...i,ref:h,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":T1(n)+"px",...e.style},onThumbPointerDown:y=>e.onThumbPointerDown(y.y),onDragScroll:y=>e.onDragScroll(y.y),onWheelScroll:(y,p)=>{if(o.viewport){const v=o.viewport.scrollTop+y.deltaY;e.onWheelScroll(v),bO(v,p)&&y.preventDefault()}},onResize:()=>{d.current&&o.viewport&&a&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:Fg(a.paddingTop),paddingEnd:Fg(a.paddingBottom)}})}})}),[eZ,pO]=cO(ks),mO=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:o,onThumbPointerUp:a,onThumbPointerDown:u,onThumbPositionChange:d,onDragScroll:h,onWheelScroll:y,onResize:p,...v}=e,b=ki(ks,n),[w,S]=g.useState(null),C=xt(t,G=>S(G)),j=g.useRef(null),E=g.useRef(""),N=b.viewport,P=r.content-r.viewport,I=qn(y),R=qn(d),$=P1(p,10);function X(G){if(j.current){const D=G.clientX-j.current.left,q=G.clientY-j.current.top;h({x:D,y:q})}}return g.useEffect(()=>{const G=D=>{const q=D.target;(w==null?void 0:w.contains(q))&&I(D,P)};return document.addEventListener("wheel",G,{passive:!1}),()=>document.removeEventListener("wheel",G,{passive:!1})},[N,w,P,I]),g.useEffect(R,[r,R]),Fc(w,$),Fc(b.content,$),c.jsx(eZ,{scope:n,scrollbar:w,hasThumb:i,onThumbChange:qn(o),onThumbPointerUp:qn(a),onThumbPositionChange:R,onThumbPointerDown:qn(u),children:c.jsx(Gh.div,{...v,ref:C,style:{position:"absolute",...v.style},onPointerDown:Ie(e.onPointerDown,G=>{G.button===0&&(G.target.setPointerCapture(G.pointerId),j.current=w.getBoundingClientRect(),E.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",b.viewport&&(b.viewport.style.scrollBehavior="auto"),X(G))}),onPointerMove:Ie(e.onPointerMove,X),onPointerUp:Ie(e.onPointerUp,G=>{const D=G.target;D.hasPointerCapture(G.pointerId)&&D.releasePointerCapture(G.pointerId),document.body.style.webkitUserSelect=E.current,b.viewport&&(b.viewport.style.scrollBehavior=""),j.current=null})})})}),Hg="ScrollAreaThumb",gO=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=pO(Hg,e.__scopeScrollArea);return c.jsx(pr,{present:n||i.hasThumb,children:c.jsx(tZ,{ref:t,...r})})}),tZ=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...i}=e,o=ki(Hg,n),a=pO(Hg,n),{onThumbPositionChange:u}=a,d=xt(t,p=>a.onThumbChange(p)),h=g.useRef(void 0),y=P1(()=>{h.current&&(h.current(),h.current=void 0)},100);return g.useEffect(()=>{const p=o.viewport;if(p){const v=()=>{if(y(),!h.current){const b=iZ(p,u);h.current=b,u()}};return u(),p.addEventListener("scroll",v),()=>p.removeEventListener("scroll",v)}},[o.viewport,y,u]),c.jsx(Gh.div,{"data-state":a.hasThumb?"visible":"hidden",...i,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ie(e.onPointerDownCapture,p=>{const b=p.target.getBoundingClientRect(),w=p.clientX-b.left,S=p.clientY-b.top;a.onThumbPointerDown({x:w,y:S})}),onPointerUp:Ie(e.onPointerUp,a.onThumbPointerUp)})});gO.displayName=Hg;var wx="ScrollAreaCorner",yO=g.forwardRef((e,t)=>{const n=ki(wx,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?c.jsx(nZ,{...e,ref:t}):null});yO.displayName=wx;var nZ=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,i=ki(wx,n),[o,a]=g.useState(0),[u,d]=g.useState(0),h=!!(o&&u);return Fc(i.scrollbarX,()=>{var p;const y=((p=i.scrollbarX)==null?void 0:p.offsetHeight)||0;i.onCornerHeightChange(y),d(y)}),Fc(i.scrollbarY,()=>{var p;const y=((p=i.scrollbarY)==null?void 0:p.offsetWidth)||0;i.onCornerWidthChange(y),a(y)}),h?c.jsx(Gh.div,{...r,ref:t,style:{width:o,height:u,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Fg(e){return e?parseInt(e,10):0}function vO(e,t){const n=e/t;return isNaN(n)?0:n}function T1(e){const t=vO(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function rZ(e,t,n,r="ltr"){const i=T1(n),o=i/2,a=t||o,u=i-a,d=n.scrollbar.paddingStart+a,h=n.scrollbar.size-n.scrollbar.paddingEnd-u,y=n.content-n.viewport,p=r==="ltr"?[0,y]:[y*-1,0];return _O([d,h],p)(e)}function C6(e,t,n="ltr"){const r=T1(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-i,a=t.content-t.viewport,u=o-r,d=n==="ltr"?[0,a]:[a*-1,0],h=yb(e,d);return _O([0,a],[0,u])(h)}function _O(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function bO(e,t){return e>0&&e<t}var iZ=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){const o={left:e.scrollLeft,top:e.scrollTop},a=n.left!==o.left,u=n.top!==o.top;(a||u)&&t(),n=o,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function P1(e,t){const n=qn(e),r=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),g.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Fc(e,t){const n=qn(t);yn(()=>{let r=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(e),()=>{window.cancelAnimationFrame(r),i.unobserve(e)}}},[e,n])}var xO=uO,sZ=dO,oZ=yO;const xd=g.forwardRef(({className:e,children:t,...n},r)=>c.jsxs(xO,{ref:r,className:Ae("relative overflow-hidden",e),...n,children:[c.jsx(sZ,{className:"h-full w-full rounded-[inherit]",children:t}),c.jsx(wO,{}),c.jsx(oZ,{})]}));xd.displayName=xO.displayName;const wO=g.forwardRef(({className:e,orientation:t="vertical",...n},r)=>c.jsx(bx,{ref:r,orientation:t,className:Ae("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:c.jsx(gO,{className:"relative flex-1 rounded-full bg-border"})}));wO.displayName=bx.displayName;function lZ(e){const t=new Date(e),r=new Date().getTime()-t.getTime();return r<6e4?"just now":r<36e5?`${Math.floor(r/6e4)}m ago`:r<864e5?`${Math.floor(r/36e5)}h ago`:t.toLocaleDateString()}function aZ({sessions:e,activeSessionId:t,onSelect:n,onCreate:r,onArchive:i}){return c.jsxs("div",{className:"flex flex-col h-full",children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b",children:[c.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Sessions"}),c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsx(Ee,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:r,children:c.jsx(Qf,{className:"h-3.5 w-3.5"})})}),c.jsx(dr,{side:"right",children:"New session"})]})]}),c.jsx(xd,{className:"flex-1",children:c.jsx("div",{className:"p-1.5 space-y-0.5",children:e.length===0?c.jsxs("p",{className:"text-xs text-muted-foreground text-center py-4",children:["No sessions yet.",c.jsx("br",{}),c.jsx("button",{onClick:r,className:"underline underline-offset-2 hover:text-foreground mt-1 inline-block",children:"Create one"})]}):e.map(o=>c.jsxs("div",{className:`group flex items-center gap-2 rounded-md px-2 py-1.5 cursor-pointer transition-colors text-sm ${o.id===t?"bg-secondary text-secondary-foreground":"hover:bg-muted/50"}`,onClick:()=>n(o.id),children:[o.id===t&&c.jsx(zr,{className:"h-3 w-3 shrink-0 text-primary"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"truncate text-xs font-medium",children:o.name||"Untitled"}),c.jsx("div",{className:"text-[10px] text-muted-foreground",children:lZ(o.lastActiveAt)})]}),c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsx(Ee,{variant:"ghost",size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",onClick:a=>{a.stopPropagation(),i(o.id)},children:c.jsx(hR,{className:"h-3 w-3"})})}),c.jsx(dr,{side:"right",children:"Archive"})]})]},o.id))})})]})}function cZ({suggestions:e,onSelect:t,className:n}){return c.jsx("div",{className:Ae("flex flex-wrap gap-2 justify-center",n),children:e.map(r=>c.jsx("button",{onClick:()=>t(r),className:"px-4 py-2 text-sm rounded-full border bg-background text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:r},r))})}const uZ=g2("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",success:"border-transparent bg-green-500/15 text-green-700 dark:text-green-400",warning:"border-transparent bg-yellow-500/15 text-yellow-700 dark:text-yellow-400"}},defaultVariants:{variant:"default"}});function Rt({className:e,variant:t,...n}){return c.jsx("div",{className:Ae(uZ({variant:t}),e),...n})}const Ui=g.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ae("rounded-xl border bg-card text-card-foreground shadow",e),...t}));Ui.displayName="Card";const SO=g.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ae("flex flex-col space-y-1.5 p-6",e),...t}));SO.displayName="CardHeader";const CO=g.forwardRef(({className:e,...t},n)=>c.jsx("h3",{ref:n,className:Ae("font-semibold leading-none tracking-tight",e),...t}));CO.displayName="CardTitle";const fZ=g.forwardRef(({className:e,...t},n)=>c.jsx("p",{ref:n,className:Ae("text-sm text-muted-foreground",e),...t}));fZ.displayName="CardDescription";const jO=g.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ae("p-6 pt-0",e),...t}));jO.displayName="CardContent";const dZ=g.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:Ae("flex items-center p-6 pt-0",e),...t}));dZ.displayName="CardFooter";const hZ={pending:{icon:Ph,label:"Pending",color:"text-muted-foreground"},approved:{icon:bt,label:"Running",color:"text-blue-500"},rejected:{icon:Sr,label:"Rejected",color:"text-destructive"},executed:{icon:ii,label:"Done",color:"text-green-500"},failed:{icon:no,label:"Failed",color:"text-destructive"}};function pZ({action:e,expanded:t,onToggle:n}){const r=hZ[e.status],i=r.icon;return c.jsxs("div",{className:"border rounded-md",children:[c.jsxs("button",{type:"button",className:"flex items-center gap-3 w-full px-3 py-2.5 text-left hover:bg-muted/50 transition-colors",onClick:n,children:[c.jsx(i,{className:Ae("h-4 w-4 shrink-0",r.color,e.status==="approved"&&"animate-spin")}),c.jsxs("span",{className:"flex-1 min-w-0",children:[c.jsx("span",{className:"font-mono text-sm font-medium",children:e.tool}),c.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["Step ",e.order+1]})]}),c.jsx(Rt,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:r.label}),t?c.jsx(Ss,{className:"h-4 w-4 text-muted-foreground"}):c.jsx(_l,{className:"h-4 w-4 text-muted-foreground"})]}),t&&c.jsxs("div",{className:"px-3 pb-3 pt-1 border-t bg-muted/30",children:[c.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:e.description}),c.jsx("pre",{className:"text-xs bg-background rounded p-2 overflow-x-auto max-h-48",children:JSON.stringify(e.args,null,2)}),e.result&&c.jsx("div",{className:Ae("mt-2 text-xs rounded p-2",e.result.ok?"bg-green-500/10 text-green-700 dark:text-green-400":"bg-destructive/10 text-destructive"),children:e.result.message})]})]})}function mZ({plan:e,onApprove:t,onReject:n,isExecuting:r,className:i}){const[o,a]=g.useState(new Set),u=v=>{a(b=>{const w=new Set(b);return w.has(v)?w.delete(v):w.add(v),w})},d=e.actions.filter(v=>v.status==="pending").length,h=e.actions.filter(v=>v.status==="executed").length,y=e.actions.filter(v=>v.status==="failed").length,p=d===0;return c.jsxs(Ui,{className:Ae("p-4 space-y-3",i),children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{children:[c.jsxs("h3",{className:"text-sm font-medium flex items-center gap-2",children:[c.jsx(gZ,{className:"h-4 w-4"}),"Plan",c.jsxs(Rt,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:[e.actions.length," step",e.actions.length!==1?"s":""]})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.summary})]}),p&&c.jsx(Rt,{variant:y>0?"destructive":"success",className:"shrink-0",children:y>0?`${y} failed`:"Complete"})]}),c.jsx("div",{className:"space-y-1.5",children:e.actions.map(v=>c.jsx(pZ,{action:v,expanded:o.has(v.id),onToggle:()=>u(v.id)},v.id))}),d>0&&c.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[c.jsx(Ee,{size:"sm",onClick:()=>t(),disabled:r,children:r?c.jsxs(c.Fragment,{children:[c.jsx(bt,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Executing..."]}):c.jsxs(c.Fragment,{children:[c.jsx(S7,{className:"h-3.5 w-3.5 mr-1.5"}),"Execute all (",d,")"]})}),c.jsxs(Ee,{size:"sm",variant:"outline",onClick:n,disabled:r,children:[c.jsx(Sr,{className:"h-3.5 w-3.5 mr-1.5"}),"Reject"]})]}),p&&!r&&c.jsxs("p",{className:"text-xs text-muted-foreground",children:[h>0&&`${h} action${h!==1?"s":""} executed.`,y>0&&` ${y} failed.`]})]})}function gZ({className:e}){return c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[c.jsx("rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1"}),c.jsx("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"}),c.jsx("path",{d:"M12 11h4"}),c.jsx("path",{d:"M12 16h4"}),c.jsx("path",{d:"M8 11h.01"}),c.jsx("path",{d:"M8 16h.01"})]})}function yZ({items:e,className:t}){if(e.length===0)return null;const n=e.filter(o=>o.status==="completed").length,r=e.length,i=r>0?Math.round(n/r*100):0;return c.jsxs("div",{className:Ae("rounded-lg border bg-muted/30 p-3 space-y-2",t),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-medium text-foreground",children:"Tasks"}),c.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden",children:c.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-300",style:{width:`${i}%`}})}),c.jsxs("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[n,"/",r]})]}),c.jsx("div",{className:"space-y-1",children:e.map(o=>c.jsxs("div",{className:Ae("flex items-start gap-2 text-xs py-0.5",o.status==="completed"&&"text-muted-foreground"),children:[o.status==="completed"?c.jsx(ii,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-green-500"}):o.status==="in-progress"?c.jsx(bt,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-primary animate-spin"}):c.jsx(gR,{className:"h-3.5 w-3.5 shrink-0 mt-0.5 text-muted-foreground/50"}),c.jsx("span",{className:Ae(o.status==="completed"&&"line-through"),children:o.title})]},o.id))})]})}function vZ({files:e,onAccept:t,onReject:n,onAcceptAll:r,onRejectAll:i,onFileClick:o,className:a}){if(e.length===0)return null;const u=e.filter(d=>d.state==="undecided").length;return c.jsxs("div",{className:Ae("rounded-lg border bg-muted/30 overflow-hidden",a),children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b bg-muted/20",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(_i,{className:"h-3.5 w-3.5 text-muted-foreground"}),c.jsxs("span",{className:"text-xs font-medium",children:["Files changed (",e.length,")"]}),u>0&&c.jsxs("span",{className:"text-[10px] text-amber-500 dark:text-amber-400",children:[u," pending"]})]}),u>0&&c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsxs(Ee,{size:"sm",variant:"ghost",className:"h-6 px-2 text-[11px]",onClick:r,children:[c.jsx(zr,{className:"h-3 w-3 mr-1"}),"Keep all"]}),c.jsxs(Ee,{size:"sm",variant:"ghost",className:"h-6 px-2 text-[11px]",onClick:i,children:[c.jsx(Og,{className:"h-3 w-3 mr-1"}),"Undo all"]})]})]}),c.jsx("div",{className:"divide-y",children:e.map(d=>c.jsxs("div",{className:Ae("flex items-center gap-2 px-3 py-1.5 text-xs",d.state==="accepted"&&"bg-green-500/5",d.state==="rejected"&&"bg-red-500/5 text-muted-foreground"),children:[c.jsx(cl,{filename:d.name,className:"h-3.5 w-3.5 shrink-0"}),c.jsx("button",{type:"button",className:Ae("truncate flex-1 text-left hover:underline cursor-pointer",d.state==="rejected"&&"line-through"),title:`Review diff for ${d.path}`,onClick:()=>o==null?void 0:o(d.path),children:d.path}),d.state==="undecided"&&c.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[c.jsx("button",{type:"button",className:"p-1 rounded hover:bg-primary/10 text-primary transition-colors",onClick:()=>o==null?void 0:o(d.path),title:"Review changes",children:c.jsx(d2,{className:"h-3 w-3"})}),c.jsx("button",{type:"button",className:"p-1 rounded hover:bg-green-500/20 text-green-600 dark:text-green-400 transition-colors",onClick:()=>t==null?void 0:t(d.path),title:"Keep all changes",children:c.jsx(zr,{className:"h-3 w-3"})}),c.jsx("button",{type:"button",className:"p-1 rounded hover:bg-red-500/20 text-red-600 dark:text-red-400 transition-colors",onClick:()=>n==null?void 0:n(d.path),title:"Undo all changes",children:c.jsx(Og,{className:"h-3 w-3"})})]}),d.state==="accepted"&&c.jsx("span",{className:"text-[10px] text-green-600 dark:text-green-400 shrink-0",children:"Kept"}),d.state==="rejected"&&c.jsx("span",{className:"text-[10px] text-red-500 shrink-0",children:"Undone"})]},d.path))})]})}function _Z({item:e,index:t,onRemove:n,onEdit:r}){const[i,o]=g.useState(!1),[a,u]=g.useState(e.content),d=g.useRef(null);g.useEffect(()=>{if(i){const v=d.current;v&&(v.focus(),v.setSelectionRange(v.value.length,v.value.length))}},[i]),g.useEffect(()=>{i||u(e.content)},[e.content,i]);const h=g.useCallback(()=>{const v=a.trim();v&&v!==e.content&&(r==null||r(e.id,v)),o(!1)},[a,e.content,e.id,r]),y=g.useCallback(()=>{u(e.content),o(!1)},[e.content]),p=g.useCallback(v=>{v.key==="Enter"&&!v.shiftKey?(v.preventDefault(),h()):v.key==="Escape"&&y()},[h,y]);return c.jsxs("div",{className:"group flex items-start gap-2 rounded-lg bg-muted/50 border border-border/40 px-3 py-2 text-sm transition-colors hover:bg-muted/70",children:[c.jsx("div",{className:"mt-0.5 shrink-0",children:t===0?c.jsx(bt,{className:"h-3.5 w-3.5 text-primary animate-spin"}):c.jsx(_l,{className:"h-3.5 w-3.5 text-muted-foreground"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[t===0&&!i&&c.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wider text-primary/70 block mb-0.5",children:"Next"}),t>0&&!i&&c.jsxs("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground block mb-0.5",children:["Queued #",t+1]}),i?c.jsx("textarea",{ref:d,value:a,onChange:v=>u(v.target.value),onKeyDown:p,onBlur:h,rows:Math.min(a.split(`
|
|
@@ -669,7 +669,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
669
669
|
`})]})}function TC({status:e}){switch(e){case"A":case"?":return c.jsx(_R,{className:"h-3.5 w-3.5 text-green-500 shrink-0"});case"D":return c.jsx(bR,{className:"h-3.5 w-3.5 text-red-500 shrink-0"});case"R":return c.jsx(vR,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"});default:return c.jsx(_7,{className:"h-3.5 w-3.5 text-yellow-500 shrink-0"})}}function PC(e){switch(e){case"A":return"Added";case"?":return"Untracked";case"D":return"Deleted";case"R":return"Renamed";default:return"Modified"}}function _oe({cwd:e,baseBranch:t,onClose:n}){const[r,i]=g.useState([]),[o,a]=g.useState(!0),[u,d]=g.useState(0);g.useEffect(()=>{let v=!1;return a(!0),ll.fileDiffs(e,t).then(b=>{v||(i(b),d(0))}).catch(()=>{v||i([])}).finally(()=>{v||a(!1)}),()=>{v=!0}},[e]);const h=r[u]??null,y=h?vg(h.path):"plaintext",p=g.useCallback(v=>{v.key==="Escape"?n():v.key==="ArrowDown"||v.key==="j"?(v.preventDefault(),d(b=>Math.min(b+1,r.length-1))):(v.key==="ArrowUp"||v.key==="k")&&(v.preventDefault(),d(b=>Math.max(b-1,0)))},[n,r.length]);return c.jsx("div",{className:"fixed inset-0 z-[100] bg-background/80 backdrop-blur-sm flex items-center justify-center p-4",onKeyDown:p,tabIndex:-1,children:c.jsxs("div",{className:"bg-popover border rounded-lg shadow-xl w-full max-w-6xl h-[85vh] flex flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(_7,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("h3",{className:"text-sm font-medium",children:"Changes"}),!o&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.length," file",r.length!==1?"s":""," changed"]})]}),c.jsx(Ee,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:n,children:c.jsx(Sr,{className:"h-4 w-4"})})]}),o?c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx(bt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):r.length===0?c.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"No changes detected."}):c.jsxs("div",{className:"flex-1 flex min-h-0",children:[c.jsxs("div",{className:"w-56 border-r flex flex-col shrink-0 bg-muted/20",children:[c.jsx("div",{className:"px-3 py-2 border-b",children:c.jsx("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:"Files"})}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:r.map((v,b)=>c.jsxs("button",{className:Ae("flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs hover:bg-accent/50 transition-colors",b===u&&"bg-accent"),onClick:()=>d(b),title:`${v.path} (${PC(v.status)})`,children:[c.jsx(TC,{status:v.status}),c.jsx("span",{className:"truncate font-mono",children:v.path.split(/[/\\]/).pop()})]},v.path))})]}),c.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b bg-muted/10 shrink-0",children:[c.jsx(TC,{status:(h==null?void 0:h.status)??"M"}),c.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate",children:h==null?void 0:h.path}),c.jsx("span",{className:Ae("text-[10px] px-1.5 py-0.5 rounded font-medium",(h==null?void 0:h.status)==="A"||(h==null?void 0:h.status)==="?"?"bg-green-500/10 text-green-500":(h==null?void 0:h.status)==="D"?"bg-red-500/10 text-red-500":"bg-yellow-500/10 text-yellow-500"),children:PC((h==null?void 0:h.status)??"M")})]}),c.jsx("div",{className:"flex-1 min-h-0",children:h&&c.jsx(KN,{original:h.original,modified:h.modified,language:y,theme:"vs-dark",options:{readOnly:!0,renderSideBySide:!0,minimap:{enabled:!1},fontSize:13,automaticLayout:!0,scrollBeyondLastLine:!1,renderOverviewRuler:!0,ignoreTrimWhitespace:!1,enableSplitViewResizing:!0}},h.path)})]})]})]})})}function boe({open:e,onOpenChange:t,cwd:n,onReady:r}){const[i,o]=g.useState("checking"),[a,u]=g.useState(null),[d,h]=g.useState(""),[y,p]=g.useState(null),v=g.useCallback(async()=>{o("checking"),p(null);try{const S=await ll.ghStatus(n);u(S),S.installed?S.authenticated?o("success"):o("not-authenticated"):o("not-installed")}catch(S){p(S instanceof Error?S.message:"Failed to check GitHub CLI status"),o("error")}},[n]);g.useEffect(()=>{e&&(v(),h(""))},[e,v]);const b=g.useCallback(async()=>{if(d.trim()){o("authenticating"),p(null);try{const S=await ll.ghAuth(d.trim(),n);S.ok?(u({installed:!0,authenticated:!0,username:S.username}),o("success"),h("")):(p('Authentication failed — check that your token has the "repo" scope.'),o("not-authenticated"))}catch(S){p(S instanceof Error?S.message:"Authentication failed"),o("not-authenticated")}}},[d,n]),w=g.useCallback(()=>{t(!1),r==null||r()},[t,r]);return c.jsx(Wc,{open:e,onOpenChange:t,children:c.jsxs(ba,{className:"max-w-md",children:[c.jsxs(dl,{children:[c.jsx(hl,{children:"GitHub CLI Setup"}),c.jsxs(ua,{children:["Pull request creation requires the GitHub CLI (","",c.jsx("code",{className:"text-xs",children:"gh"}),")."]})]}),i==="checking"&&c.jsxs("div",{className:"flex items-center gap-3 py-4",children:[c.jsx(bt,{className:"h-5 w-5 animate-spin text-muted-foreground"}),c.jsx("span",{className:"text-sm text-muted-foreground",children:"Checking GitHub CLI status…"})]}),i==="not-installed"&&c.jsxs("div",{className:"space-y-4 py-2",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(to,{className:"h-5 w-5 text-red-500 mt-0.5 shrink-0"}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"text-sm font-medium",children:"GitHub CLI is not installed"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:'Install it from the official site, then click "Re-check" below.'})]})]}),c.jsx(Ee,{variant:"outline",size:"sm",className:"gap-1.5",asChild:!0,children:c.jsxs("a",{href:"https://cli.github.com",target:"_blank",rel:"noopener noreferrer",children:[c.jsx(d2,{className:"h-3.5 w-3.5"}),"Download GitHub CLI"]})})]}),i==="not-authenticated"&&c.jsxs("div",{className:"space-y-4 py-2",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(to,{className:"h-5 w-5 text-amber-500 mt-0.5 shrink-0"}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"text-sm font-medium",children:"GitHub CLI is not authenticated"}),c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Paste a Personal Access Token with ",c.jsx("code",{className:"text-xs",children:"repo"})," scope to sign in."]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(Xt,{htmlFor:"gh-token",className:"text-xs",children:"Personal Access Token"}),c.jsx(xr,{id:"gh-token",type:"password",placeholder:"ghp_... or github_pat_...",value:d,onChange:S=>h(S.target.value),onKeyDown:S=>{S.key==="Enter"&&b()},autoFocus:!0}),c.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[c.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,read:org,workflow&description=Jait+CLI",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:"Create a token"})," ","with ",c.jsx("code",{className:"text-[10px]",children:"repo"}),", ",c.jsx("code",{className:"text-[10px]",children:"read:org"}),", and ",c.jsx("code",{className:"text-[10px]",children:"workflow"})," scopes. For fine-grained tokens, grant Contents + Pull Requests read/write access."]})]}),y&&c.jsx("p",{className:"text-xs text-red-500",children:y})]}),i==="authenticating"&&c.jsxs("div",{className:"flex items-center gap-3 py-4",children:[c.jsx(bt,{className:"h-5 w-5 animate-spin text-muted-foreground"}),c.jsx("span",{className:"text-sm text-muted-foreground",children:"Authenticating…"})]}),i==="success"&&c.jsxs("div",{className:"flex items-start gap-3 py-4",children:[c.jsx(ii,{className:"h-5 w-5 text-green-500 mt-0.5 shrink-0"}),c.jsxs("div",{className:"space-y-1",children:[c.jsxs("p",{className:"text-sm font-medium",children:["Authenticated",a!=null&&a.username?` as ${a.username}`:""]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"GitHub CLI is ready. You can now create pull requests."})]})]}),i==="error"&&c.jsxs("div",{className:"flex items-start gap-3 py-4",children:[c.jsx(to,{className:"h-5 w-5 text-red-500 mt-0.5 shrink-0"}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"text-sm font-medium",children:"Something went wrong"}),y&&c.jsx("p",{className:"text-xs text-muted-foreground",children:y})]})]}),c.jsxs(w2,{children:[(i==="not-installed"||i==="error")&&c.jsx(Ee,{variant:"outline",size:"sm",onClick:v,children:"Re-check"}),i==="not-authenticated"&&c.jsx(Ee,{size:"sm",disabled:!d.trim(),onClick:b,children:"Sign in"}),i==="success"&&c.jsx(Ee,{size:"sm",onClick:w,children:"Continue"})]})]})})}function Dx({threadId:e,cwd:t,branch:n,baseBranch:r,threadTitle:i,prUrl:o,prState:a,ghAvailable:u=!0,threadStatus:d,showStatusBadge:h=!0}){const y=vx(),[p,v]=g.useState(!1),[b,w]=g.useState(!1),[S,C]=g.useState(!1),j=g.useRef(!1),[E,N]=g.useState(o?{url:o,kind:"created"}:null);g.useEffect(()=>{N(D=>o?{url:o,kind:"created"}:(D==null?void 0:D.kind)==="create"?D:null)},[o]);const P=E??(o?{url:o,kind:"created"}:null),I=P?P.kind==="created"?"Open PR":"Open PR Page":"Create Pull Request",R=P?I:"Create pull request",$=P!=null||d==="completed",X=g.useCallback(async()=>{if(P){window.open(P.url,"_blank");return}if(d!=="completed"){ms.error("Thread not completed",{description:"Finish the thread before creating a pull request."});return}v(!0);try{const D=await ll.ghStatus(t);if(!D.installed||!D.authenticated){v(!1),j.current=!0,C(!0);return}}catch{}try{const D=i.replace(/^\[.*?\]\s*/,""),F=(await Hn.createPullRequest(e,{commitMessage:D,baseBranch:r})).result;F.pr.url?N({url:F.pr.url,kind:"created"}):F.push.createPrUrl&&N({url:F.push.createPrUrl,kind:"create"})}catch(D){ms.error("Failed",{description:D instanceof Error?D.message:"Unknown error"})}finally{v(!1)}},[r,t,e,d,i,P]),G=g.useCallback(()=>{j.current&&(j.current=!1,X())},[X]);return c.jsxs(c.Fragment,{children:[c.jsx(boe,{open:S,onOpenChange:C,cwd:t,onReady:G}),c.jsxs("div",{className:"inline-flex items-center gap-1",children:[c.jsxs(Ee,{variant:"ghost",size:"sm",className:`h-5 text-[10px] gap-1 ${y?"px-1.5":""}`,onClick:()=>w(!0),title:"Changes","aria-label":"Changes",children:[c.jsx(Ec,{className:"h-3 w-3"}),!y&&"Changes"]}),c.jsxs(Ee,{variant:"ghost",size:"sm",className:`h-5 text-[10px] gap-1 ${y?"px-1.5":""}`,disabled:p||!$,onClick:X,title:!P&&d!=="completed"?"Finish the thread before creating a pull request.":R,"aria-label":R,children:[p?c.jsx(bt,{className:"h-3 w-3 animate-spin"}):c.jsx(wR,{className:"h-3 w-3"}),!y&&I]}),h&&P&&c.jsx(Rt,{variant:"outline",className:`h-5 px-1.5 text-[10px] font-medium ${a==="merged"?"border-purple-500/40 text-purple-700 bg-purple-500/10 dark:text-purple-300 dark:bg-purple-500/20 dark:border-purple-400/40":a==="closed"?"border-red-500/40 text-red-700 bg-red-500/10 dark:text-red-300 dark:bg-red-500/20 dark:border-red-400/40":P.kind==="created"?"border-green-500/40 text-green-700 dark:text-green-300 dark:border-green-400/40":"border-amber-500/40 text-amber-700 dark:text-amber-300 dark:border-amber-400/40"}`,children:a==="merged"?"PR merged":a==="closed"?"PR closed":P.kind==="created"?"PR open":"PR ready to open"}),!u&&!P&&c.jsx("span",{className:"inline-flex items-center gap-0.5 text-[10px] text-amber-600 dark:text-amber-400 cursor-help",title:"GitHub CLI (gh) is not installed. Install it or configure a GitHub token to enable PR creation and status tracking.",children:c.jsx(Oc,{className:"h-3 w-3"})})]}),b&&c.jsx(_oe,{cwd:t,baseBranch:n?r:void 0,onClose:()=>w(!1)})]})}function xoe(e){const t=[];let n=null,r=[];const i=new Map;let o=[];function a(){o.length>0&&(r.push({type:"toolGroup",callIds:[...o]}),o=[])}function u(){n&&(a(),r.length>0&&(n.segments=[...r]),t.push(n),n=null,r=[])}function d(h){return(!n||n.role!=="assistant")&&(u(),n={id:h,role:"assistant",content:"",toolCalls:[]},r=[]),n}for(const h of e){const y=h.payload??{};switch(h.kind){case"message":{const p=y.role,v=typeof y.content=="string"?y.content:h.summary;if(p==="user")u(),t.push({id:h.id,role:"user",content:v});else{const b=d(h.id);a();const w=v??"";w&&(b.content+=(b.content?`
|
|
670
670
|
`:"")+w,r.push({type:"text",content:w}))}break}case"tool.start":{const p=d(h.id),v=y.callId??h.id;if(i.has(v))break;const b={callId:v,tool:y.tool??"unknown",args:y.args??{},status:"running",startedAt:new Date(h.createdAt).getTime()};p.toolCalls=p.toolCalls??[],p.toolCalls.push(b),i.set(v,b),o.push(v);break}case"tool.output":{const p=y.callId;if(p&&i.has(p)){const v=i.get(p);v.streamingOutput=(v.streamingOutput??"")+(y.content??"")}break}case"tool.result":case"tool.error":{const p=y.callId;if(p&&i.has(p)){const v=i.get(p);v.status=y.ok?"success":"error",v.result={ok:y.ok??!1,message:y.message??h.summary},v.completedAt=new Date(h.createdAt).getTime()}break}case"tool.approval":{const p=d(h.id),v=y.requestId??h.id,b={callId:v,tool:y.tool??"unknown",args:y.args??{},status:"pending",startedAt:new Date(h.createdAt).getTime()};p.toolCalls=p.toolCalls??[],p.toolCalls.push(b),i.set(v,b),o.push(v);break}case"session":{u();break}case"error":{const p=d(h.id);a();const v=`**Error:** ${h.summary}`;p.content+=(p.content?`
|
|
671
671
|
`:"")+v,r.push({type:"text",content:v});break}default:{const p=typeof y.content=="string"?y.content:typeof y.text=="string"?y.text:typeof y.message=="string"?y.message:null;if(y.role==="user"&&p)u(),t.push({id:h.id,role:"user",content:p});else if(p){const b=d(h.id);a(),b.content+=(b.content?`
|
|
672
|
-
`:"")+p,r.push({type:"text",content:p})}break}}}return u(),t}const AC=cn(),RC={core:{variant:"default",label:"core"},standard:{variant:"secondary",label:"standard"},external:{variant:"warning",label:"external"}},MC=["meta","terminal","filesystem","os","agent","browser","web","surfaces","scheduler","memory","voice","screen","gateway","external"];function woe({token:e}){const[t,n]=g.useState([]),[r,i]=g.useState(!0),[o,a]=g.useState(!1),[u,d]=g.useState(null),[h,y]=g.useState("");g.useEffect(()=>{if(!e)return;let C=!1;return(async()=>{try{const j=await fetch(`${AC}/auth/settings/tools`,{headers:{Authorization:`Bearer ${e}`}});if(j.ok&&!C){const E=await j.json();n(E.tools)}}catch{C||d("Failed to load tools")}finally{C||i(!1)}})(),()=>{C=!0}},[e]);const p=g.useCallback(async(C,j)=>{if(e){n(E=>E.map(N=>N.name===C?{...N,enabled:j}:N)),a(!0),d(null);try{const E=t.map(P=>P.name===C?{...P,enabled:j}:P).filter(P=>!P.enabled&&!P.locked).map(P=>P.name);if(!(await fetch(`${AC}/auth/settings/tools`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({disabled_tools:E})})).ok)throw new Error("Failed to save")}catch{n(E=>E.map(N=>N.name===C?{...N,enabled:!j}:N)),d("Failed to update tool setting")}finally{a(!1)}}},[e,t]),v=new Map,b=h.trim().toLowerCase();for(const C of t){if(b&&!`${C.name} ${C.description} ${C.category}`.toLowerCase().includes(b))continue;const j=C.category;v.has(j)||v.set(j,[]),v.get(j).push(C)}const w=[...v.keys()].sort((C,j)=>{const E=MC.indexOf(C),N=MC.indexOf(j);return(E===-1?999:E)-(N===-1?999:N)}),S={total:t.length,enabled:t.filter(C=>C.enabled).length,core:t.filter(C=>C.tier==="core").length,standard:t.filter(C=>C.tier==="standard").length,external:t.filter(C=>C.tier==="external").length};return r?c.jsx(Ui,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading tools..."})}):c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Tools"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage which tools are available to the AI agent. Core tools are always enabled. Standard tools can be toggled. External (MCP) tools are discovered on demand."})]}),c.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(Wf,{className:"h-3.5 w-3.5"}),S.core," core"]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(WR,{className:"h-3.5 w-3.5"}),S.standard," standard"]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(IR,{className:"h-3.5 w-3.5"}),S.external," external"]}),c.jsxs("span",{className:"ml-auto",children:[S.enabled,"/",S.total," enabled"]})]}),c.jsxs("div",{className:"relative",children:[c.jsx(Eg,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),c.jsx(xr,{placeholder:"Filter tools...",value:h,onChange:C=>y(C.target.value),className:"pl-9"})]}),u&&c.jsx("p",{className:"text-sm text-destructive",children:u}),c.jsxs("div",{className:"space-y-5",children:[w.map(C=>{const j=v.get(C);return c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wide mb-2",children:C}),c.jsx("div",{className:"space-y-1",children:j.map(E=>{const N=RC[E.tier]??RC.standard;return c.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-md hover:bg-muted/50 transition-colors",children:[c.jsx(wd,{checked:E.enabled,onCheckedChange:P=>{p(E.name,P)},disabled:E.locked||o,"aria-label":`Toggle ${E.name}`}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-mono text-sm font-medium",children:E.name}),c.jsx(Rt,{variant:N.variant,className:"text-[10px] px-1.5 py-0",children:N.label}),E.source==="mcp"&&c.jsx(Rt,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"MCP"})]}),c.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.description})]})]},E.name)})})]},C)}),w.length===0&&c.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:b?"No tools match your filter.":"No tools available."})]})]})}function Soe({events:e}){return c.jsx(xd,{className:"h-full w-full",children:c.jsx("div",{className:"p-4 space-y-2",children:e.length===0?c.jsx("p",{className:"text-sm text-muted-foreground",children:"No activity yet."}):e.map(t=>c.jsxs("div",{className:"rounded-md border p-3",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("p",{className:"text-sm font-medium",children:t.title}),c.jsx("span",{className:"text-xs text-muted-foreground",children:t.source})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.detail})]},t.id))})})}var nu="Perplexity",Coe=.75,joe=.2,GN="#22B8CD",koe=GN,Eoe="#000",Ooe=.75;function sh(e){"@babel/helpers - typeof";return sh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sh(e)}var Noe=["size","style"];function DC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function p_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?DC(Object(n),!0).forEach(function(r){Toe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Toe(e,t,n){return t=Poe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Poe(e){var t=Aoe(e,"string");return sh(t)=="symbol"?t:String(t)}function Aoe(e,t){if(sh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(sh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Roe(e,t){if(e==null)return{};var n=Moe(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Moe(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Lx=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=Roe(e,Noe);return c.jsxs("svg",p_(p_({fill:"currentColor",fillRule:"evenodd",height:n,style:p_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:nu}),c.jsx("path",{d:"M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z"})]}))});function oh(e){"@babel/helpers - typeof";return oh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oh(e)}function LC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Doe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?LC(Object(n),!0).forEach(function(r){Loe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Loe(e,t,n){return t=zoe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zoe(e){var t=$oe(e,"string");return oh(t)=="symbol"?t:String(t)}function $oe(e,t){if(oh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(oh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ioe(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Boe=g.memo(function(e){var t=Object.assign({},(Ioe(e),e));return c.jsx(Ir,Doe({Icon:Lx,"aria-label":nu,background:koe,color:Eoe,iconMultiple:Ooe},t))});function lh(e){"@babel/helpers - typeof";return lh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lh(e)}var Hoe=["size","style"];function zC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function m_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zC(Object(n),!0).forEach(function(r){Foe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Foe(e,t,n){return t=Uoe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Uoe(e){var t=Voe(e,"string");return lh(t)=="symbol"?t:String(t)}function Voe(e,t){if(lh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(lh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Woe(e,t){if(e==null)return{};var n=qoe(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qoe(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var YN=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=Woe(e,Hoe);return c.jsxs("svg",m_(m_({height:n,style:m_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:nu}),c.jsx("path",{d:"M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z",fill:"#22B8CD",fillRule:"nonzero"})]}))});function ah(e){"@babel/helpers - typeof";return ah=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ah(e)}var Koe=["size","style"];function $C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function g_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$C(Object(n),!0).forEach(function(r){Goe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$C(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Goe(e,t,n){return t=Yoe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yoe(e){var t=Xoe(e,"string");return ah(t)=="symbol"?t:String(t)}function Xoe(e,t){if(ah(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ah(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Joe(e,t){if(e==null)return{};var n=Zoe(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Zoe(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var XN=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=Joe(e,Koe);return c.jsxs("svg",g_(g_({fill:"currentColor",fillRule:"evenodd",height:n,style:g_({flex:"none",lineHeight:1},r),viewBox:"0 0 117 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:nu}),c.jsx("path",{d:"M38.542 5.218h1.151V7.59h-1.49c-1.167 0-2.036.281-2.612.843-.575.563-.863 1.485-.863 2.768v7.773h-2.351V5.271h2.351v2.187c0 .123.062.185.184.185.069 0 .121-.017.157-.053a.58.58 0 00.104-.211c.453-1.44 1.577-2.16 3.371-2.16h-.002zm15.36 2.938c.617 1.098.928 2.42.928 3.966 0 1.545-.309 2.867-.928 3.965-.62 1.098-1.42 1.92-2.404 2.464a6.446 6.446 0 01-3.174.817c-2.23 0-3.797-.896-4.703-2.688-.069-.14-.157-.211-.262-.211-.105 0-.157.052-.157.158v7.352h-2.351V5.271h2.351v2.345c0 .106.052.159.157.159.105 0 .191-.07.262-.211.906-1.793 2.473-2.689 4.703-2.689 1.132 0 2.19.272 3.174.817.984.545 1.785 1.366 2.404 2.464zm-1.424 3.966c0-1.617-.43-2.877-1.292-3.781-.862-.904-1.998-1.357-3.41-1.357-1.413 0-2.548.453-3.41 1.357-.863.905-1.179 2.166-1.179 3.78 0 1.616.316 2.878 1.178 3.782.863.905 2 1.356 3.41 1.356 1.411 0 2.549-.453 3.411-1.356.862-.904 1.292-2.166 1.292-3.781zM15.05 8.177c.618 1.098.928 2.42.928 3.965 0 1.546-.308 2.868-.928 3.966-.619 1.098-1.42 1.919-2.403 2.464a6.448 6.448 0 01-3.175.817c-2.23 0-3.797-.896-4.702-2.688-.07-.14-.158-.212-.262-.212-.105 0-.158.053-.158.159V24H2V5.292h2.351v2.345c0 .106.053.159.158.159.104 0 .19-.07.261-.212.906-1.792 2.473-2.688 4.703-2.688 1.132 0 2.19.272 3.175.817.983.545 1.784 1.366 2.403 2.464h-.002zm-1.423 3.965c0-1.616-.43-2.877-1.293-3.78-.862-.904-1.998-1.357-3.41-1.357-1.412 0-2.548.453-3.41 1.357-.862.905-1.178 2.165-1.178 3.78 0 1.615.316 2.878 1.178 3.781.862.906 1.998 1.357 3.41 1.357 1.412 0 2.548-.453 3.41-1.357.863-.903 1.293-2.166 1.293-3.78zm14.422 2.481h2.482c-.33 1.283-1.006 2.395-2.023 3.334-1.02.94-2.479 1.41-4.378 1.41-1.429 0-2.686-.295-3.775-.884a6.13 6.13 0 01-2.521-2.516c-.593-1.089-.889-2.372-.889-3.847 0-1.476.288-2.758.863-3.847.574-1.089 1.38-1.928 2.417-2.517 1.036-.588 2.25-.883 3.644-.883 1.393 0 2.547.29 3.514.87.968.58 1.69 1.349 2.168 2.305.48.959.719 2.008.719 3.15v1.58H19.427c.086 1.37.544 2.46 1.37 3.268.828.807 1.939 1.213 3.332 1.213 1.132 0 2-.232 2.6-.698.601-.466 1.04-1.111 1.32-1.938zm-8.595-3.82h8.204c0-1.194-.305-2.13-.914-2.807-.61-.676-1.568-1.015-2.874-1.015-1.22 0-2.217.33-2.99.988-.775.659-1.25 1.604-1.424 2.832l-.002.002zm37.238 8.17h2.352V0H56.69v18.974-.002zM89.316 3.774h2.747V.81h-2.747v2.966zm9.688 13.156c-.426.043-.684.066-.77.066a.39.39 0 01-.289-.106.395.395 0 01-.104-.29c0-.087.022-.348.065-.778.043-.43.066-1.094.066-1.988V7.279h3.354l-.66-2.008h-2.692v-3.69h-2.352v3.688h-2.557v2.008h2.557v7.214c0 1.512.367 2.636 1.098 3.374.732.737 1.846 1.107 3.345 1.107h1.83v-2.107h-.915c-.889 0-1.547.022-1.974.066h-.002zm13.759-11.662l-3.893 11.498c-.053.141-.135.326-.402.326-.268 0-.35-.185-.402-.326l-3.893-11.498h-2.398l4.508 13.703h1.594a.81.81 0 01.235.026c.053.017.096.06.131.133.07.105.06.264-.026.473l-.731 2.002c-.105.264-.305.396-.6.396-.106 0-.349-.023-.732-.066a13.71 13.71 0 00-1.49-.066h-1.907v2.107h2.508c1.463 0 2.344-.25 3.102-.75.757-.5 1.345-1.383 1.764-2.65L115 5.795v-.526h-2.237v.001zm-31.127 5.113L77.953 5.27h-2.588v.527l4.415 5.93-5.382 6.72v.526h2.64l4.285-5.507 3.998 5.507h2.535v-.526l-4.677-6.324 5.07-6.298v-.553h-2.64l-3.971 5.113-.002-.002zm7.931 8.59h2.351v-13.7h-2.35v13.702-.002zm-15.062-4.349c-.331 1.283-1.006 2.395-2.024 3.334-1.02.94-2.479 1.41-4.377 1.41-1.43 0-2.686-.295-3.775-.884a6.13 6.13 0 01-2.522-2.516c-.593-1.089-.888-2.372-.888-3.847 0-1.476.288-2.758.862-3.847.574-1.089 1.38-1.928 2.417-2.517 1.036-.588 2.25-.883 3.644-.883 1.394 0 2.547.29 3.515.87.967.58 1.689 1.349 2.168 2.305.479.959.718 2.008.718 3.15v1.58H63.401c.086 1.37.544 2.46 1.371 3.268.827.807 1.938 1.213 3.332 1.213 1.132 0 2-.232 2.6-.698.6-.466 1.04-1.111 1.319-1.938h2.482zm-11.078-3.82h8.205c0-1.194-.305-2.13-.915-2.807-.61-.676-1.568-1.015-2.873-1.015-1.22 0-2.217.33-2.991.988-.775.659-1.25 1.604-1.424 2.832l-.002.002z"})]}))});function ch(e){"@babel/helpers - typeof";return ch=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ch(e)}var Qoe=["type"];function IC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ele(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?IC(Object(n),!0).forEach(function(r){tle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tle(e,t,n){return t=nle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nle(e){var t=rle(e,"string");return ch(t)=="symbol"?t:String(t)}function rle(e,t){if(ch(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ch(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ile(e,t){if(e==null)return{};var n=sle(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sle(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var ole=g.memo(function(e){var t=e.type,n=t===void 0?"mono":t,r=ile(e,Qoe),i=n==="color"?YN:Lx;return c.jsx(Br,ele({Icon:i,Text:XN,"aria-label":nu,spaceMultiple:joe,textMultiple:Coe},r))}),ja=Lx;ja.Color=YN;ja.Text=XN;ja.Combine=ole;ja.Avatar=Boe;ja.colorPrimary=GN;ja.title=nu;var Zh="OpenRouter",lle=1,ale=.4,zx="#6566F1",cle=zx,ule="#fff",fle=.75;function uh(e){"@babel/helpers - typeof";return uh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uh(e)}var dle=["size","style"];function BC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function y_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?BC(Object(n),!0).forEach(function(r){hle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hle(e,t,n){return t=ple(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ple(e){var t=mle(e,"string");return uh(t)=="symbol"?t:String(t)}function mle(e,t){if(uh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(uh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gle(e,t){if(e==null)return{};var n=yle(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function yle(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var $x=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=gle(e,dle);return c.jsxs("svg",y_(y_({fill:"currentColor",fillRule:"evenodd",height:n,style:y_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Zh}),c.jsx("path",{d:"M16.804 1.957l7.22 4.105v.087L16.73 10.21l.017-2.117-.821-.03c-1.059-.028-1.611.002-2.268.11-1.064.175-2.038.577-3.147 1.352L8.345 11.03c-.284.195-.495.336-.68.455l-.515.322-.397.234.385.23.53.338c.476.314 1.17.796 2.701 1.866 1.11.775 2.083 1.177 3.147 1.352l.3.045c.694.091 1.375.094 2.825.033l.022-2.159 7.22 4.105v.087L16.589 22l.014-1.862-.635.022c-1.386.042-2.137.002-3.138-.162-1.694-.28-3.26-.926-4.881-2.059l-2.158-1.5a21.997 21.997 0 00-.755-.498l-.467-.28a55.927 55.927 0 00-.76-.43C2.908 14.73.563 14.116 0 14.116V9.888l.14.004c.564-.007 2.91-.622 3.809-1.124l1.016-.58.438-.274c.428-.28 1.072-.726 2.686-1.853 1.621-1.133 3.186-1.78 4.881-2.059 1.152-.19 1.974-.213 3.814-.138l.02-1.907z"})]}))});function fh(e){"@babel/helpers - typeof";return fh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fh(e)}function HC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function vle(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?HC(Object(n),!0).forEach(function(r){_le(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):HC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _le(e,t,n){return t=ble(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ble(e){var t=xle(e,"string");return fh(t)=="symbol"?t:String(t)}function xle(e,t){if(fh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(fh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function wle(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Sle=g.memo(function(e){var t=Object.assign({},(wle(e),e));return c.jsx(Ir,vle({Icon:$x,"aria-label":Zh,background:cle,color:ule,iconMultiple:fle},t))});function dh(e){"@babel/helpers - typeof";return dh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dh(e)}var Cle=["size","style"];function FC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function v_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?FC(Object(n),!0).forEach(function(r){jle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function jle(e,t,n){return t=kle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kle(e){var t=Ele(e,"string");return dh(t)=="symbol"?t:String(t)}function Ele(e,t){if(dh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(dh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ole(e,t){if(e==null)return{};var n=Nle(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Nle(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var JN=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=Ole(e,Cle);return c.jsxs("svg",v_(v_({fill:"currentColor",fillRule:"evenodd",height:n,style:v_({flex:"none",lineHeight:1},r),viewBox:"0 0 143 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Zh}),c.jsx("path",{d:"M9.623 2c1.46 0 2.763.35 3.91 1.05 1.149.699 2.053 1.7 2.714 3.002.66 1.303.991 2.861.991 4.675 0 1.814-.33 3.372-.991 4.675-.66 1.302-1.565 2.303-2.713 3.003-1.148.7-2.452 1.049-3.91 1.049-1.465 0-2.772-.35-3.92-1.05-1.148-.699-2.052-1.701-2.713-3.007-.66-1.305-.991-2.862-.991-4.67 0-1.814.33-3.372.991-4.675.66-1.302 1.565-2.303 2.713-3.003C6.852 2.35 8.16 2 9.624 2zm0 2.34c-.974 0-1.844.244-2.61.734-.765.489-1.37 1.208-1.813 2.156-.443.949-.664 2.114-.664 3.497s.221 2.548.664 3.497c.444.948 1.048 1.667 1.813 2.156.766.49 1.636.735 2.61.735.97 0 1.838-.245 2.606-.735.768-.489 1.374-1.208 1.817-2.156.443-.949.665-2.114.665-3.497s-.222-2.548-.665-3.497c-.443-.948-1.049-1.667-1.817-2.156-.768-.49-1.637-.735-2.606-.735zm16.32 1.974c1.024 0 1.938.26 2.742.78s1.436 1.269 1.896 2.248c.46.979.69 2.156.69 3.534 0 1.377-.23 2.556-.686 3.538-.457.981-1.085 1.736-1.883 2.264-.799.529-1.71.793-2.734.793-.771 0-1.4-.13-1.887-.39-.488-.26-.869-.564-1.144-.913a6.908 6.908 0 01-.636-.929h-.149V24h-2.47V6.48h2.412v2.065h.207c.143-.265.35-.572.62-.92.27-.349.643-.655 1.123-.917.479-.263 1.112-.394 1.9-.394zm-.528 2.107c-.716 0-1.32.185-1.813.556-.493.37-.866.887-1.12 1.55-.253.665-.38 1.439-.38 2.324 0 .896.13 1.68.389 2.356.259.674.633 1.201 1.123 1.58s1.09.568 1.8.568c.738 0 1.355-.198 1.85-.593.496-.395.872-.933 1.128-1.613.256-.68.384-1.447.384-2.298 0-.84-.125-1.596-.376-2.265-.25-.67-.625-1.197-1.123-1.584-.498-.388-1.12-.581-1.862-.581zm13.387-2.107c.716 0 1.41.119 2.082.356a5.037 5.037 0 011.809 1.12c.534.51.955 1.169 1.263 1.979.309.81.463 1.793.463 2.949v.88l-9.016-.001.002.105c.03.732.178 1.364.445 1.895.3.597.72 1.052 1.26 1.364.539.313 1.17.469 1.89.469.469 0 .895-.068 1.28-.203a2.716 2.716 0 001-.61c.281-.271.496-.606.644-1.004l2.338.423a4.247 4.247 0 01-1.004 1.813c-.482.517-1.084.918-1.808 1.203-.725.284-1.549.427-2.474.427-1.25 0-2.325-.27-3.225-.809-.9-.54-1.594-1.3-2.082-2.281-.487-.982-.73-2.134-.73-3.455 0-1.306.243-2.456.73-3.451.488-.996 1.17-1.773 2.049-2.331.878-.559 1.906-.838 3.084-.838zm.017 2.049c-.694 0-1.298.17-1.813.51-.515.34-.911.782-1.19 1.327a3.778 3.778 0 00-.39 1.303l-.02.236h6.593c0-.653-.132-1.232-.397-1.738a3.022 3.022 0 00-1.11-1.199c-.477-.293-1.034-.44-1.673-.44zm10.29 3.293v7.566H46.64V6.48h2.37v2.074h.158a3.63 3.63 0 011.375-1.626c.625-.41 1.413-.614 2.366-.614.864 0 1.622.18 2.271.543.65.362 1.154.9 1.512 1.614.358.713.537 1.595.537 2.646v8.105h-2.47v-7.806c0-.924-.24-1.647-.718-2.17-.48-.522-1.137-.784-1.974-.784-.573 0-1.081.125-1.524.374a2.65 2.65 0 00-1.05 1.09c-.255.479-.383 1.055-.383 1.73zm17.122-9.424c1.31 0 2.4.227 3.266.68.868.454 1.516 1.08 1.945 1.88.43.799.645 1.72.645 2.766 0 1.04-.216 1.954-.649 2.742-.432.788-1.082 1.4-1.949 1.837a5.1 5.1 0 01-.501.22l3.743 6.865h-2.907l-3.436-6.43h-3.634v6.43h-2.552V2.232h6.029zm-.273 2.199h-3.204v6.155h3.237c.826 0 1.5-.119 2.02-.357s.901-.583 1.144-1.037c.242-.453.363-.998.363-1.634 0-.641-.122-1.197-.367-1.667-.246-.47-.628-.831-1.148-1.083-.52-.252-1.202-.377-2.045-.377zM79.66 6.314c1.19 0 2.227.273 3.114.821.886.548 1.575 1.316 2.065 2.306s.735 2.146.735 3.468c0 1.316-.245 2.466-.735 3.45-.49.985-1.179 1.751-2.065 2.299-.887.547-1.924.82-3.114.82s-2.227-.273-3.113-.82c-.887-.548-1.575-1.314-2.065-2.298-.49-.985-.735-2.135-.735-3.451 0-1.322.245-2.478.735-3.468.49-.99 1.178-1.758 2.065-2.306.886-.548 1.924-.821 3.113-.821zm.008 2.074c-.776 0-1.419.207-1.928.622-.51.415-.887.963-1.132 1.646a6.602 6.602 0 00-.367 2.244c0 .819.122 1.568.367 2.249.245.68.623 1.225 1.132 1.634.51.41 1.152.614 1.928.614.771 0 1.41-.205 1.917-.614.506-.41.882-.954 1.127-1.634.245-.68.367-1.43.367-2.249 0-.813-.122-1.56-.367-2.244-.245-.683-.62-1.231-1.127-1.646-.507-.415-1.146-.622-1.917-.622zm16.164 5.55V6.48h2.477v12.742h-2.428v-2.207h-.132a3.956 3.956 0 01-1.4 1.697c-.641.45-1.438.676-2.391.676-.815 0-1.535-.181-2.16-.544-.625-.362-1.115-.9-1.47-1.613-.355-.714-.533-1.596-.533-2.647V6.48h2.47v7.806c0 .868.24 1.56.718 2.074.48.514 1.102.771 1.867.771.462 0 .924-.116 1.383-.348.46-.232.843-.584 1.148-1.054.306-.47.456-1.067.45-1.792zm8.58-10.511v3.052h2.602v1.992h-2.602v7.01c0 .48.072.841.215 1.082.144.24.33.404.558.49.228.085.478.128.747.128.199 0 .372-.014.52-.041l.348-.067.446 2.05a4.42 4.42 0 01-.612.17c-.264.057-.594.09-.99.095a4.331 4.331 0 01-1.818-.349 3.12 3.12 0 01-1.362-1.128c-.347-.509-.52-1.148-.52-1.916l-.002-7.525h-1.857V6.48h1.857l.001-3.053h2.47zm9.961 2.887c.716 0 1.41.119 2.081.356a5.037 5.037 0 011.81 1.12c.533.51.954 1.169 1.263 1.979.308.81.462 1.793.462 2.949v.88l-9.016-.001.003.105c.03.732.178 1.364.445 1.895.3.597.72 1.052 1.259 1.364.54.313 1.17.469 1.891.469.468 0 .895-.068 1.28-.203a2.716 2.716 0 001-.61c.28-.271.495-.606.644-1.004l2.337.423a4.247 4.247 0 01-1.003 1.813c-.482.517-1.085.918-1.809 1.203-.724.284-1.548.427-2.473.427-1.25 0-2.325-.27-3.226-.809-.9-.54-1.594-1.3-2.08-2.281-.488-.982-.732-2.134-.732-3.455 0-1.306.244-2.456.731-3.451.487-.996 1.17-1.773 2.048-2.331.879-.559 1.907-.838 3.085-.838zm.017 2.049c-.694 0-1.298.17-1.813.51-.515.34-.911.782-1.19 1.327a3.778 3.778 0 00-.39 1.303l-.02.236h6.592c0-.653-.132-1.232-.396-1.738a3.022 3.022 0 00-1.11-1.199c-.477-.293-1.035-.44-1.673-.44zm7.821 10.859V6.48h2.387v2.024h.132a3.092 3.092 0 011.227-1.622 3.485 3.485 0 011.994-.593l.396.01.153.006c.212.011.379.025.5.042v2.372c-.1-.027-.275-.059-.529-.095a5.4 5.4 0 00-.76-.054c-.583 0-1.102.123-1.556.37a2.799 2.799 0 00-1.078 1.02 2.79 2.79 0 00-.397 1.48v7.782h-2.469z"})]}))});function hh(e){"@babel/helpers - typeof";return hh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hh(e)}var Tle=["type","iconProps"];function UC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function VC(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?UC(Object(n),!0).forEach(function(r){Ple(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ple(e,t,n){return t=Ale(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ale(e){var t=Rle(e,"string");return hh(t)=="symbol"?t:String(t)}function Rle(e,t){if(hh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Mle(e,t){if(e==null)return{};var n=Dle(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Dle(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Lle=g.memo(function(e){var t=e.type,n=t===void 0?"mono":t,r=e.iconProps,i=Mle(e,Tle);return c.jsx(Br,VC({Icon:$x,Text:JN,"aria-label":Zh,iconProps:VC({color:n==="color"?zx:void 0},r),spaceMultiple:ale,textMultiple:lle},i))}),ru=$x;ru.Text=JN;ru.Combine=Lle;ru.Avatar=Sle;ru.colorPrimary=zx;ru.title=Zh;var Qh="Grok",zle=.75,$le=.25,ZN="#fff",Ile=ZN,Ble="#000",Hle=.65;function ph(e){"@babel/helpers - typeof";return ph=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ph(e)}var Fle=["size","style"];function WC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function __(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?WC(Object(n),!0).forEach(function(r){Ule(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ule(e,t,n){return t=Vle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vle(e){var t=Wle(e,"string");return ph(t)=="symbol"?t:String(t)}function Wle(e,t){if(ph(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ph(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qle(e,t){if(e==null)return{};var n=Kle(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Kle(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var QN=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=qle(e,Fle);return c.jsxs("svg",__(__({fill:"currentColor",fillRule:"evenodd",height:n,style:__({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Qh}),c.jsx("path",{d:"M6.469 8.776L16.512 23h-4.464L2.005 8.776H6.47zm-.004 7.9l2.233 3.164L6.467 23H2l4.465-6.324zM22 2.582V23h-3.659V7.764L22 2.582zM22 1l-9.952 14.095-2.233-3.163L17.533 1H22z"})]}))});function mh(e){"@babel/helpers - typeof";return mh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mh(e)}function qC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gle(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qC(Object(n),!0).forEach(function(r){Yle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Yle(e,t,n){return t=Xle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xle(e){var t=Jle(e,"string");return mh(t)=="symbol"?t:String(t)}function Jle(e,t){if(mh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(mh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zle(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var eT=g.memo(function(e){var t=Object.assign({},(Zle(e),e));return c.jsx(Ir,Gle({Icon:QN,"aria-label":Qh,background:Ile,color:Ble,iconMultiple:Hle},t))});function gh(e){"@babel/helpers - typeof";return gh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gh(e)}var Qle=["size","style"];function KC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function b_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?KC(Object(n),!0).forEach(function(r){eae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):KC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function eae(e,t,n){return t=tae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tae(e){var t=nae(e,"string");return gh(t)=="symbol"?t:String(t)}function nae(e,t){if(gh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(gh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rae(e,t){if(e==null)return{};var n=iae(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function iae(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var tT=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=rae(e,Qle);return c.jsxs("svg",b_(b_({fill:"currentColor",fillRule:"evenodd",height:n,style:b_({flex:"none",lineHeight:1},r),viewBox:"0 0 41 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Qh}),c.jsx("path",{d:"M36.867 2h2.577v20h-2.577V2zM23.875 2h2.717l7.759 20H31.55l-2.101-5.574h-8.571L18.777 22h-2.69l7.788-20zm4.79 12.185l-3.53-9.272-3.473 9.272h7.003zM7.35 14.381L2.504 7.518h2.857l3.446 5.126 3.585-5.126h2.605l-4.762 6.835L15.501 22h-2.829l-3.977-5.854L4.689 22H2l5.35-7.619z"})]}))});function yh(e){"@babel/helpers - typeof";return yh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yh(e)}function GC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function sae(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?GC(Object(n),!0).forEach(function(r){oae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function oae(e,t,n){return t=lae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lae(e){var t=aae(e,"string");return yh(t)=="symbol"?t:String(t)}function aae(e,t){if(yh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(yh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cae(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var uae=g.memo(function(e){var t=Object.assign({},(cae(e),e));return c.jsx(Br,sae({Icon:eT,Text:tT,"aria-label":Qh,iconProps:{shape:"square"},spaceMultiple:$le,textMultiple:zle},t))}),iu=QN;iu.Text=tT;iu.Combine=uae;iu.Avatar=eT;iu.colorPrimary=ZN;iu.title=Qh;var ep="MoonshotAI",fae=.75,dae=.4,nT="#16191E",hae=nT,pae="#fff",mae=.75;function vh(e){"@babel/helpers - typeof";return vh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vh(e)}var gae=["size","style"];function YC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function x_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?YC(Object(n),!0).forEach(function(r){yae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):YC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yae(e,t,n){return t=vae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vae(e){var t=_ae(e,"string");return vh(t)=="symbol"?t:String(t)}function _ae(e,t){if(vh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(vh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bae(e,t){if(e==null)return{};var n=xae(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xae(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Ix=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=bae(e,gae);return c.jsxs("svg",x_(x_({fill:"currentColor",fillRule:"evenodd",height:n,style:x_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:ep}),c.jsx("path",{d:"M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z"})]}))});function _h(e){"@babel/helpers - typeof";return _h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_h(e)}function XC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function wae(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?XC(Object(n),!0).forEach(function(r){Sae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Sae(e,t,n){return t=Cae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cae(e){var t=jae(e,"string");return _h(t)=="symbol"?t:String(t)}function jae(e,t){if(_h(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(_h(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function kae(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Eae=g.memo(function(e){var t=Object.assign({},(kae(e),e));return c.jsx(Ir,wae({Icon:Ix,"aria-label":ep,background:hae,color:pae,iconMultiple:mae},t))});function bh(e){"@babel/helpers - typeof";return bh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bh(e)}var Oae=["size","style"];function JC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function w_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?JC(Object(n),!0).forEach(function(r){Nae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):JC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nae(e,t,n){return t=Tae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tae(e){var t=Pae(e,"string");return bh(t)=="symbol"?t:String(t)}function Pae(e,t){if(bh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(bh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Aae(e,t){if(e==null)return{};var n=Rae(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Rae(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var rT=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=Aae(e,Oae);return c.jsxs("svg",w_(w_({fill:"currentColor",fillRule:"evenodd",height:n,style:w_({flex:"none",lineHeight:1},r),viewBox:"0 0 171 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:ep}),c.jsx("path",{d:"M165.484 2H169v19.507h-3.516V2zm-35.707 0v5.26h3.186v3.507h-3.186v10.74h-3.516v-10.74h-2.966V7.26h2.966V2h3.516zm-24.598 11.023v8.498h-3.345v-8.804c.008-2.1-2.109-2.895-3.109-2.895l-.064.001c-1.073.026-3.521.694-3.54 3.863v7.835h-3.468V2.014L95.14 2v6.918c1.228-1.986 3.93-2.243 4.755-2.243.926 0 1.768.155 2.525.465.757.31 1.378.783 1.864 1.42.413.54.665 1.096.757 1.667.092.571.138 1.503.138 2.796zM89.29 9.507l-2.362 2.41c-2.911-2.41-6.647-2.136-7.196-.93-.55 1.205 2.444 1.484 4.734 1.98l.634.146c1.731.408 4.603 1.274 4.52 4.12-.11 3.78-4.23 4.767-6.867 4.767-2.637 0-5.933-1.808-7.636-3.342l2.527-2.63c2.582 2.63 7.142 2.958 7.856 1.534.714-1.425-1.263-1.48-4.834-1.973-3.175-.438-4.837-2.85-4.813-4.13.034-1.843 1.543-4.85 6.31-4.886 3.227-.025 5.425.961 7.127 2.934zm-22.617.386l-.033.001c-1.905.083-3.443 1.453-3.458 3.746v7.867h-3.83V7.185h3.702v2.061l.088-.12c.591-.8 2.07-2.555 4.796-2.523 2.675.032 5.696 1.95 5.696 5.17v9.734H69.69v-8.813c-.01-2.197-2.102-2.824-3.016-2.8zm-33.14-3.29c4.247 0 7.69 3.434 7.69 7.671s-3.443 7.671-7.69 7.671c-4.248 0-7.692-3.434-7.692-7.671s3.444-7.671 7.691-7.671zm0 3.726a3.95 3.95 0 00-3.956 3.945 3.95 3.95 0 003.955 3.945 3.95 3.95 0 003.956-3.945 3.95 3.95 0 00-3.956-3.945zm16.7-3.726c4.247 0 7.69 3.434 7.69 7.671s-3.443 7.671-7.69 7.671c-4.248 0-7.692-3.434-7.692-7.671s3.444-7.671 7.691-7.671zm0 3.726a3.95 3.95 0 00-3.956 3.945 3.95 3.95 0 003.955 3.945 3.95 3.95 0 003.956-3.945 3.95 3.95 0 00-3.956-3.945zm64.382-3.726c4.248 0 7.69 3.434 7.69 7.671s-3.442 7.671-7.69 7.671c-4.247 0-7.69-3.434-7.69-7.671s3.443-7.671 7.69-7.671zm0 3.726a3.95 3.95 0 00-3.955 3.945 3.95 3.95 0 003.955 3.945 3.95 3.95 0 003.955-3.945 3.95 3.95 0 00-3.955-3.945zM2 21.616V2l10.987 7.89L23.919 2v19.616h-3.79V9.452l-7.17 5.26-7.169-5.26v12.164H2zM153.344 2l10.492 19.507h-4.138l-1.833-3.288h-5.235l-1.789-3.46-3.632 6.748h-4.358L153.344 2zm0 8.11l-2.478 4.602h5.044l-2.566-4.602z"})]}))});function xh(e){"@babel/helpers - typeof";return xh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xh(e)}function ZC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Mae(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ZC(Object(n),!0).forEach(function(r){Dae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Dae(e,t,n){return t=Lae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lae(e){var t=zae(e,"string");return xh(t)=="symbol"?t:String(t)}function zae(e,t){if(xh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(xh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $ae(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Iae=g.memo(function(e){var t=Object.assign({},($ae(e),e));return c.jsx(Br,Mae({Icon:Ix,Text:rT,"aria-label":ep,spaceMultiple:dae,textMultiple:fae},t))}),su=Ix;su.Text=rT;su.Combine=Iae;su.Avatar=Eae;su.colorPrimary=nT;su.title=ep;var ou="Kimi",Bae=.7,Hae=.25,iT="#000",Fae=iT,Uae="#fff",Vae=.6;function wh(e){"@babel/helpers - typeof";return wh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wh(e)}var Wae=["size","style"];function QC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function S_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?QC(Object(n),!0).forEach(function(r){qae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function qae(e,t,n){return t=Kae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kae(e){var t=Gae(e,"string");return wh(t)=="symbol"?t:String(t)}function Gae(e,t){if(wh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(wh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Yae(e,t){if(e==null)return{};var n=Xae(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Xae(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var sT=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=Yae(e,Wae);return c.jsxs("svg",S_(S_({height:n,style:S_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:ou}),c.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z",fill:"#1783FF"}),c.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z",fill:"#fff"})]}))});function Sh(e){"@babel/helpers - typeof";return Sh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sh(e)}function ej(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Jae(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ej(Object(n),!0).forEach(function(r){Zae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ej(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Zae(e,t,n){return t=Qae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qae(e){var t=ece(e,"string");return Sh(t)=="symbol"?t:String(t)}function ece(e,t){if(Sh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Sh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tce(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var oT=g.memo(function(e){var t=Object.assign({},(tce(e),e));return c.jsx(Ir,Jae({Icon:sT,"aria-label":ou,background:Fae,color:Uae,iconMultiple:Vae},t))});function Ch(e){"@babel/helpers - typeof";return Ch=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ch(e)}var nce=["size","style"];function tj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function C_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tj(Object(n),!0).forEach(function(r){rce(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tj(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rce(e,t,n){return t=ice(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ice(e){var t=sce(e,"string");return Ch(t)=="symbol"?t:String(t)}function sce(e,t){if(Ch(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ch(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oce(e,t){if(e==null)return{};var n=lce(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function lce(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var lT=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=oce(e,nce);return c.jsxs("svg",C_(C_({fill:"currentColor",fillRule:"evenodd",height:n,style:C_({flex:"none",lineHeight:1},r),viewBox:"0 0 64 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:ou}),c.jsx("path",{d:"M24.353 21.58c0 .232.188.42.42.42h2.69a.42.42 0 00.42-.42V2.42a.42.42 0 00-.42-.42h-2.69a.42.42 0 00-.42.42v19.16zM58.47 21.58c0 .232.188.42.42.42h2.691a.42.42 0 00.419-.42V2.42a.42.42 0 00-.419-.42H58.89a.42.42 0 00-.42.42v19.16zM47.786 2a.42.42 0 00-.408.32L43.4 18.633c-.066.267-.38.267-.444 0L38.976 2.32A.417.417 0 0038.57 2H31.83a.418.418 0 00-.418.42v19.16c0 .232.188.42.42.42h2.988c.231 0 .419-.182.419-.414V5.471c0-.322.378-.389.454-.079l3.974 16.288a.42.42 0 00.407.32h6.208a.42.42 0 00.407-.32L50.66 5.394c.076-.31.455-.243.455.079V21.58c0 .231.187.419.419.419h2.987a.42.42 0 00.42-.42V2.42a.42.42 0 00-.42-.42h-6.735zM11.55 11.273l8.115-8.565A.42.42 0 0019.36 2h-3.776a.42.42 0 00-.298.124l-9.303 9.39c-.144.146-.357.016-.357-.218V2.42a.42.42 0 00-.42-.42H2.42a.42.42 0 00-.42.42v19.16c0 .232.188.42.42.42h2.786a.42.42 0 00.42-.42v-3.82c0-.085.03-.166.081-.219l2.87-2.931c.07-.07.166-.081.243-.029l7.678 5.816c1.123.778 2.552 1.288 3.861 1.5a.403.403 0 00.464-.404v-3.461c0-.206-.15-.38-.35-.423-.76-.164-1.604-.474-2.244-.918l-6.647-4.953c-.138-.095-.155-.34-.033-.465z"})]}))});function jh(e){"@babel/helpers - typeof";return jh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jh(e)}var ace=["iconProps"];function nj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nj(Object(n),!0).forEach(function(r){cce(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nj(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function cce(e,t,n){return t=uce(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uce(e){var t=fce(e,"string");return jh(t)=="symbol"?t:String(t)}function fce(e,t){if(jh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(jh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dce(e,t){if(e==null)return{};var n=hce(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hce(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var pce=g.memo(function(e){var t=e.iconProps,n=dce(e,ace);return c.jsx(Br,rj({Icon:oT,Text:lT,"aria-label":ou,iconProps:rj({shape:"square"},t),spaceMultiple:Hae,textMultiple:Bae},n))});function kh(e){"@babel/helpers - typeof";return kh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kh(e)}var mce=["size","style"];function ij(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function j_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ij(Object(n),!0).forEach(function(r){gce(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ij(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function gce(e,t,n){return t=yce(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yce(e){var t=vce(e,"string");return kh(t)=="symbol"?t:String(t)}function vce(e,t){if(kh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(kh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _ce(e,t){if(e==null)return{};var n=bce(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function bce(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var xce=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=_ce(e,mce);return c.jsxs("svg",j_(j_({fill:"currentColor",fillRule:"evenodd",height:n,style:j_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:ou}),c.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),c.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]}))}),ka=xce;ka.Color=sT;ka.Text=lT;ka.Combine=pce;ka.Avatar=oT;ka.colorPrimary=iT;ka.title=ou;const wce=["OPENAI_API_KEY","OPENAI_BASE_URL","OPENAI_MODEL","OPENAI_WEB_SEARCH_MODEL","BRAVE_API_KEY","PERPLEXITY_API_KEY","OPENROUTER_API_KEY","XAI_API_KEY","GEMINI_API_KEY","MOONSHOT_API_KEY","KIMI_BASE_URL","KIMI_MODEL","PERPLEXITY_MODEL","PERPLEXITY_OPENROUTER_MODEL","GROK_MODEL","GEMINI_MODEL"],Sce={OPENAI:rn,PERPLEXITY:ja,OPENROUTER:ru,XAI:iu,GEMINI:oo,MOONSHOT:su,KIMI:ka,GROK:Ca};function Cce(e){const t=e.split("_")[0];return Sce[t]??null}function jce(e){return e.endsWith("_KEY")||e.endsWith("_URL")}const kce=cn();function Ece({username:e,token:t,apiKeys:n,onSaveApiKeys:r,sttProvider:i,onSttProviderChange:o,onClearArchive:a,activityEvents:u,updateInfo:d,updateChecking:h,onCheckUpdate:y,onApplyUpdate:p,updateApplying:v,platform:b}){const[w,S]=g.useState(n),[C,j]=g.useState(!1),[E,N]=g.useState(!1),[P,I]=g.useState(null),[R,$]=g.useState(null),[X,G]=g.useState({}),[D,q]=g.useState({}),[F,V]=g.useState(ha()??""),[W,L]=g.useState("idle"),[O,H]=g.useState(null),B=g.useCallback(async T=>{if(!T.trim()){mg(null),L("ok"),H(null);return}L("testing"),H(null);try{const ie=T.replace(/\/$/,""),oe=await fetch(`${ie}/health`,{signal:AbortSignal.timeout(5e3)});if(!oe.ok)throw new Error(`HTTP ${oe.status}`);mg(ie),L("ok")}catch(ie){L("error"),H(ie instanceof Error?ie.message:"Connection failed")}},[]);g.useEffect(()=>{S(n)},[n]),g.useEffect(()=>{if(!t)return;let T=!1;return(async()=>{try{const ie=await fetch(`${kce}/auth/settings/env-status`,{headers:{Authorization:`Bearer ${t}`}});if(ie.ok&&!T){const oe=await ie.json();G(oe.env_set)}}catch{}})(),()=>{T=!0}},[t]);const U=g.useCallback(T=>{q(ie=>({...ie,[T]:!ie[T]}))},[]),A=async()=>{j(!0),$(null),I(null);try{await r(w),I("API keys saved.")}catch(T){$(T instanceof Error?T.message:"Failed to save API keys")}finally{j(!1)}},M=async()=>{N(!0),$(null),I(null);try{const T=await a();I(`Cleared ${T} archived session(s).`)}catch(T){$(T instanceof Error?T.message:"Failed to clear archive")}finally{N(!1)}};function Q(T){var te;const ie=!!((te=w[T])!=null&&te.trim()),oe=!!X[T];return ie?c.jsx(Rt,{variant:"default",className:"text-[10px] px-1.5 py-0",children:"user"}):oe?c.jsx(Rt,{variant:"success",className:"text-[10px] px-1.5 py-0",children:".env"}):c.jsx(Rt,{variant:"outline",className:"text-[10px] px-1.5 py-0 text-muted-foreground",children:"empty"})}return c.jsxs("div",{className:"mx-auto w-full max-w-5xl p-6 space-y-6",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Settings"}),c.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Signed in as ",c.jsx("span",{className:"font-medium text-foreground",children:e})]})]}),c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"text-base font-medium flex items-center gap-2",children:[c.jsx(v7,{className:"h-4 w-4"}),"Software Update"]}),c.jsx("p",{className:"text-sm text-muted-foreground",children:d?c.jsxs(c.Fragment,{children:["Running ",c.jsxs("span",{className:"font-mono font-medium text-foreground",children:["v",d.currentVersion]})]}):"Check for the latest Jait version."})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsxs(Ee,{variant:"outline",size:"sm",onClick:y,disabled:h||v,children:[h?c.jsx(bt,{className:"h-4 w-4 animate-spin mr-1.5"}):null,h?"Checking...":"Check for updates"]}),(d==null?void 0:d.hasUpdate)&&(b==="web"?c.jsxs(Ee,{size:"sm",onClick:p,disabled:v,children:[v?c.jsx(bt,{className:"h-4 w-4 animate-spin mr-1.5"}):c.jsx(m5,{className:"h-4 w-4 mr-1.5"}),v?"Updating...":`Update to v${d.latestVersion}`]}):c.jsx(Ee,{size:"sm",asChild:!0,children:c.jsxs("a",{href:b==="capacitor"?"https://jait.dev/download#android":"https://jait.dev/download#desktop",target:"_blank",rel:"noopener noreferrer",children:[c.jsx(m5,{className:"h-4 w-4 mr-1.5"}),"Download v",d.latestVersion]})}))]}),d&&!d.hasUpdate&&c.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-1.5",children:[c.jsx(ii,{className:"h-3.5 w-3.5"}),"You're on the latest version."]}),(d==null?void 0:d.hasUpdate)&&c.jsxs("p",{className:"text-sm text-amber-600 dark:text-amber-400 flex items-center gap-1.5",children:[c.jsx(no,{className:"h-3.5 w-3.5"}),"Version ",d.latestVersion," is available",b!=="web"?" — download from jait.dev":"","."]})]}),c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"text-base font-medium flex items-center gap-2",children:[c.jsx(rr,{className:"h-4 w-4"}),"Gateway connection"]}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure the IP address or domain of your Jait gateway. Leave empty to use the default."})]}),c.jsxs("div",{className:"max-w-md space-y-2",children:[c.jsx(Xt,{htmlFor:"gateway-url",className:"mb-1.5 block",children:"Gateway URL"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(xr,{id:"gateway-url",type:"url",value:F,onChange:T=>{V(T.target.value),L("idle")},placeholder:cn(),className:"font-mono text-sm"}),c.jsx(Ee,{variant:"outline",onClick:()=>{B(F)},disabled:W==="testing",className:"shrink-0",children:W==="testing"?c.jsx(bt,{className:"h-4 w-4 animate-spin"}):"Test & save"})]}),W==="ok"&&c.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-1",children:[c.jsx(ii,{className:"h-3.5 w-3.5"}),F.trim()?"Connected — gateway URL saved.":"Reset to default."]}),W==="error"&&O&&c.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[c.jsx(no,{className:"h-3.5 w-3.5"}),O]}),c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Current: ",c.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-[11px]",children:cn()}),ha()&&c.jsx("button",{type:"button",className:"ml-2 text-xs underline text-muted-foreground hover:text-foreground",onClick:()=>{V(""),mg(null),L("idle")},children:"Reset to default"})]})]})]}),c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Session archive"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Permanently remove archived sessions and their messages from your account."})]}),c.jsx("div",{children:c.jsx(Ee,{variant:"destructive",onClick:()=>{M()},disabled:E,children:E?"Clearing...":"Clear archived sessions"})})]}),c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Spracheingabe (Speech-to-Text)"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Wähle aus, wie gesprochene Sprache in Text umgewandelt wird, bevor sie als Nachricht gesendet wird."})]}),c.jsxs("div",{className:"max-w-sm",children:[c.jsx(Xt,{htmlFor:"stt-provider",className:"mb-1.5 block",children:"STT-Anbieter"}),c.jsxs(gg,{value:i,onValueChange:T=>{o(T)},children:[c.jsx(Yf,{id:"stt-provider",children:c.jsx(yg,{placeholder:"STT-Anbieter wählen"})}),c.jsxs(Xf,{children:[c.jsx(zc,{value:"simulated",children:"Simuliert (Eingabe-Prompt)"}),c.jsx(zc,{value:"browser",children:"Browser (Web Speech API)"})]})]})]})]}),c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"API keys and provider settings"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Values stored here are user-specific and override environment defaults for your account."})]}),c.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:wce.map(T=>{const ie=Cce(T),oe=jce(T),te=!!D[T];return c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[ie?c.jsx(ie,{size:14,className:"shrink-0 text-muted-foreground"}):c.jsx(ER,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsx(Xt,{htmlFor:`api-${T}`,className:"font-mono text-xs",children:T}),Q(T)]}),c.jsxs("div",{className:"relative",children:[c.jsx(xr,{id:`api-${T}`,type:oe&&!te?"password":"text",value:w[T]??"",onChange:re=>{const J=re.target.value;S(Y=>({...Y,[T]:J}))},placeholder:X[T]?"(set via .env)":"(empty)",className:oe?"pr-9":""}),oe&&c.jsx("button",{type:"button",className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",onClick:()=>U(T),tabIndex:-1,"aria-label":te?"Hide value":"Show value",children:te?c.jsx(Mf,{className:"h-4 w-4"}):c.jsx(Ec,{className:"h-4 w-4"})})]})]},T)})}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(Ee,{onClick:()=>{A()},disabled:C,children:C?"Saving...":"Save API settings"}),P&&c.jsx("span",{className:"text-sm text-muted-foreground",children:P})]}),R&&c.jsx("p",{className:"text-sm text-destructive",children:R})]}),c.jsx(woe,{token:t}),u&&u.length>0&&c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Recent activity"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Recent chat messages and terminal sessions."})]}),c.jsx(Soe,{events:u})]})]})}const Ql=cn();function Oce(e){const[t,n]=g.useState([]),[r,i]=g.useState(null),[o,a]=g.useState([]),[u,d]=g.useState(!1),[h,y]=g.useState(null),p=g.useRef(null),v=g.useCallback(()=>{const I={"Content-Type":"application/json"};return e&&(I.Authorization=`Bearer ${e}`),I},[e]),b=g.useCallback(async()=>{try{const I=await fetch(`${Ql}/api/network/interfaces`,{headers:v()});if(I.ok){const R=await I.json();n(R.interfaces)}}catch(I){y(I instanceof Error?I.message:"Failed to fetch interfaces")}},[v]),w=g.useCallback(async()=>{try{const I=await fetch(`${Ql}/api/network/scan/latest`,{headers:v()});if(I.ok){const R=await I.json();R.hosts&&i(R)}}catch{}},[v]),S=g.useCallback(async I=>{var R;d(!0),y(null),(R=p.current)==null||R.abort(),p.current=new AbortController;try{const $=await fetch(`${Ql}/api/network/scan`,{method:"POST",headers:v(),body:JSON.stringify({subnet:I}),signal:p.current.signal});if(!$.ok)throw new Error(`Scan failed: ${$.status}`);const X=await $.json();return i(X),X}catch($){return $.name!=="AbortError"&&y($ instanceof Error?$.message:"Scan failed"),null}finally{d(!1)}},[v]),C=g.useCallback(async(I,R=22)=>{try{const $=await fetch(`${Ql}/api/network/ssh/test`,{method:"POST",headers:v(),body:JSON.stringify({ip:I,port:R})});return $.ok?await $.json():null}catch{return null}},[v]),j=g.useCallback(async I=>{try{const R=await fetch(`${Ql}/api/network/ssh/enable`,{method:"POST",headers:v(),body:JSON.stringify({platform:I})});return R.ok?await R.json():null}catch{return null}},[v]),E=g.useCallback(async(I,R,$="password")=>{try{const X=await fetch(`${Ql}/api/network/deploy`,{method:"POST",headers:v(),body:JSON.stringify({ip:I,username:R,authMethod:$})});return X.ok?await X.json():null}catch{return null}},[v]),N=g.useCallback(async()=>{try{const I=await fetch(`${Ql}/api/network/nodes`,{headers:v()});if(I.ok){const R=await I.json();a(R.nodes)}}catch{}},[v]),P=g.useCallback(()=>{var I;(I=p.current)==null||I.abort(),d(!1)},[]);return{interfaces:t,scanResult:r,nodes:o,scanning:u,error:h,fetchInterfaces:b,fetchLatestScan:w,scan:S,testSsh:C,getSshEnableInfo:j,deploy:E,fetchNodes:N,cancelScan:P}}function Nce({iface:e}){return c.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-md bg-muted/50 text-sm",children:[c.jsx(x7,{className:"h-4 w-4 text-muted-foreground shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"font-medium truncate",children:e.name}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.ip," / ",e.netmask]})]}),c.jsx("code",{className:"text-xs text-muted-foreground",children:e.mac})]})}function Tce({host:e,onTestSsh:t,onDeploy:n,onSshEnable:r}){const i=e.agentStatus==="running";return c.jsxs("div",{className:"border rounded-lg p-3 flex flex-col gap-2.5 hover:bg-muted/30 transition-colors",children:[c.jsxs("div",{className:"flex items-start gap-2.5",children:[c.jsx("div",{className:`h-9 w-9 rounded-lg flex items-center justify-center shrink-0 ${i?"bg-green-500/15 text-green-500":"bg-muted text-muted-foreground"}`,children:i?c.jsx(bi,{className:"h-4.5 w-4.5"}):c.jsx(aa,{className:"h-4.5 w-4.5"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"font-medium text-sm truncate",children:e.hostname||e.ip}),e.hostname&&c.jsx("div",{className:"text-xs text-muted-foreground font-mono",children:e.ip})]})]}),c.jsxs("div",{className:"flex flex-wrap gap-1",children:[i&&c.jsx(Rt,{variant:"default",className:"bg-green-600 text-[10px] h-5",children:"Gateway"}),e.agentStatus==="installed"&&c.jsx(Rt,{variant:"secondary",className:"text-[10px] h-5",children:"Installed"}),e.sshReachable?c.jsxs(Rt,{variant:"secondary",className:"text-[10px] h-5 gap-1",children:[c.jsx(Wf,{className:"h-2.5 w-2.5"})," SSH"]}):c.jsxs(Rt,{variant:"outline",className:"text-[10px] h-5 gap-1 text-muted-foreground",children:[c.jsx(Wf,{className:"h-2.5 w-2.5"})," No SSH"]}),e.openPorts.length>0&&c.jsxs(Rt,{variant:"outline",className:"text-[10px] h-5 text-muted-foreground",children:[e.openPorts.length," ",e.openPorts.length===1?"port":"ports"]})]}),c.jsxs("div",{className:"text-[11px] text-muted-foreground space-y-0.5",children:[e.mac&&c.jsxs("div",{children:["MAC: ",c.jsx("span",{className:"font-mono",children:e.mac})]}),e.openPorts.length>0&&c.jsxs("div",{children:["Ports: ",c.jsx("span",{className:"font-mono",children:e.openPorts.join(", ")})]}),c.jsxs("div",{children:["Seen: ",new Date(e.lastSeen).toLocaleTimeString()]})]}),c.jsxs("div",{className:"flex flex-wrap gap-1.5 pt-0.5",children:[c.jsxs(Ee,{size:"sm",variant:"outline",className:"h-6 text-[11px] px-2",onClick:()=>t(e.ip),children:[c.jsx(oa,{className:"h-3 w-3 mr-1"}),"Test SSH"]}),!e.sshReachable&&c.jsxs(Ee,{size:"sm",variant:"outline",className:"h-6 text-[11px] px-2",onClick:()=>r(e.ip),children:[c.jsx(Wf,{className:"h-3 w-3 mr-1"}),"Enable SSH"]}),e.sshReachable&&e.agentStatus!=="running"&&c.jsxs(Ee,{size:"sm",variant:"default",className:"h-6 text-[11px] px-2",onClick:()=>n(e.ip),children:[c.jsx(E7,{className:"h-3 w-3 mr-1"}),"Deploy"]}),i&&c.jsx(Ee,{size:"sm",variant:"secondary",className:"h-6 text-[11px] px-2",asChild:!0,children:c.jsxs("a",{href:`http://${e.ip}:8000`,target:"_blank",rel:"noopener noreferrer",children:[c.jsx(rr,{className:"h-3 w-3 mr-1"}),"Dashboard"]})})]})]})}function Pce({node:e}){const t={online:"bg-green-500",offline:"bg-red-500",degraded:"bg-yellow-500"}[e.status];return c.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-md border text-sm",children:[c.jsx(bi,{className:"h-4 w-4 text-primary shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:e.hostname??e.ip}),c.jsx("span",{className:`h-2 w-2 rounded-full ${t}`})]}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.ip," · v",e.version," · ",e.platform]})]}),c.jsx(Rt,{variant:"outline",className:"text-[10px]",children:e.status})]})}function Ace({open:e,onOpenChange:t,result:n,testing:r}){return c.jsx(Wc,{open:e,onOpenChange:t,children:c.jsxs(ba,{className:"sm:max-w-md",children:[c.jsxs(dl,{children:[c.jsx(hl,{children:"SSH Connection Test"}),c.jsx(ua,{children:(n==null?void 0:n.ip)??"Testing..."})]}),r?c.jsxs("div",{className:"flex items-center gap-3 py-4",children:[c.jsx(bt,{className:"h-5 w-5 animate-spin"}),c.jsx("span",{children:"Testing SSH connection..."})]}):n?c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[n.reachable?c.jsx(ii,{className:"h-5 w-5 text-green-500"}):c.jsx(to,{className:"h-5 w-5 text-red-500"}),c.jsx("span",{className:"font-medium",children:n.reachable?"SSH is reachable":"SSH is not reachable"})]}),n.authMethods.length>0&&c.jsxs("div",{className:"text-sm",children:[c.jsx("div",{className:"text-muted-foreground mb-1",children:"Auth methods:"}),c.jsx("div",{className:"flex gap-1.5",children:n.authMethods.map(i=>c.jsx(Rt,{variant:"secondary",className:"text-xs",children:i},i))})]}),n.platform&&c.jsxs("div",{className:"text-sm",children:[c.jsx("div",{className:"text-muted-foreground mb-1",children:"SSH Banner:"}),c.jsx("code",{className:"text-xs bg-muted px-2 py-1 rounded block",children:n.platform})]}),n.error&&c.jsx("div",{className:"text-sm text-red-500",children:n.error})]}):null]})})}function Rce({open:e,onOpenChange:t,info:n,loading:r}){const i=()=>{n!=null&&n.command&&navigator.clipboard.writeText(n.command)};return c.jsx(Wc,{open:e,onOpenChange:t,children:c.jsxs(ba,{className:"sm:max-w-lg",children:[c.jsxs(dl,{children:[c.jsx(hl,{children:"Enable SSH"}),c.jsx(ua,{children:"Instructions for enabling SSH on the target machine"})]}),r?c.jsxs("div",{className:"flex items-center gap-3 py-4",children:[c.jsx(bt,{className:"h-5 w-5 animate-spin"}),c.jsx("span",{children:"Loading instructions..."})]}):n?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsxs(Xt,{className:"text-xs text-muted-foreground mb-1 block",children:["Platform: ",n.platform]}),c.jsxs("div",{className:"relative",children:[c.jsx("pre",{className:"bg-muted text-xs p-3 rounded-md overflow-x-auto",children:n.command}),c.jsx(Ee,{size:"sm",variant:"ghost",className:"absolute top-1 right-1 h-6 w-6 p-0",onClick:i,children:c.jsx(n1,{className:"h-3 w-3"})})]})]}),c.jsxs("div",{children:[c.jsx(Xt,{className:"text-xs text-muted-foreground mb-2 block",children:"Steps:"}),c.jsx("ol",{className:"space-y-1.5 text-sm list-decimal list-inside",children:n.steps.map((o,a)=>c.jsx("li",{className:"text-muted-foreground",children:c.jsx("span",{className:"text-foreground",children:o})},a))})]})]}):null]})})}function Mce({open:e,onOpenChange:t,targetIp:n,onDeploy:r,result:i,deploying:o}){const[a,u]=g.useState(""),[d,h]=g.useState("key"),y=()=>{i!=null&&i.deployScript&&navigator.clipboard.writeText(i.deployScript)};return c.jsx(Wc,{open:e,onOpenChange:t,children:c.jsxs(ba,{className:"sm:max-w-lg",children:[c.jsxs(dl,{children:[c.jsx(hl,{children:"Deploy Jait Gateway"}),c.jsxs(ua,{children:["Install and configure a Jait Gateway node on ",n]})]}),i?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[c.jsx(ii,{className:"h-4 w-4"}),"Deployment script generated"]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx(Xt,{className:"text-xs text-muted-foreground",children:"Deployment Script"}),c.jsxs(Ee,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:y,children:[c.jsx(n1,{className:"h-3 w-3 mr-1"}),"Copy"]})]}),c.jsx("pre",{className:"bg-muted text-xs p-3 rounded-md overflow-auto max-h-48",children:i.deployScript})]}),c.jsxs("div",{children:[c.jsx(Xt,{className:"text-xs text-muted-foreground mb-2 block",children:"Steps:"}),c.jsx("ol",{className:"space-y-1 text-sm list-decimal list-inside",children:i.instructions.map((p,v)=>c.jsx("li",{children:p},v))})]}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:["Estimated time: ",i.estimatedDuration]})]}):c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(Xt,{htmlFor:"deploy-user",className:"text-sm",children:"SSH Username"}),c.jsx(xr,{id:"deploy-user",value:a,onChange:p=>u(p.target.value),placeholder:"e.g. pi, ubuntu, admin",className:"mt-1"})]}),c.jsxs("div",{children:[c.jsx(Xt,{className:"text-sm mb-2 block",children:"Authentication"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(Ee,{size:"sm",variant:d==="key"?"default":"outline",onClick:()=>h("key"),className:"text-xs",children:"SSH Key"}),c.jsx(Ee,{size:"sm",variant:d==="password"?"default":"outline",onClick:()=>h("password"),className:"text-xs",children:"Password"})]})]}),c.jsx(Ee,{onClick:()=>r(a,d),disabled:!a.trim()||o,className:"w-full",children:o?c.jsxs(c.Fragment,{children:[c.jsx(bt,{className:"h-4 w-4 mr-2 animate-spin"}),"Preparing deployment..."]}):c.jsxs(c.Fragment,{children:[c.jsx(E7,{className:"h-4 w-4 mr-2"}),"Deploy Gateway"]})})]})]})})}function Dce({token:e}){const{interfaces:t,scanResult:n,nodes:r,scanning:i,error:o,fetchInterfaces:a,fetchLatestScan:u,scan:d,testSsh:h,getSshEnableInfo:y,deploy:p,fetchNodes:v,cancelScan:b}=Oce(e),[w,S]=g.useState(!1),[C,j]=g.useState(null),[E,N]=g.useState(!1),[P,I]=g.useState(!1),[R,$]=g.useState(null),[X,G]=g.useState(!1),[D,q]=g.useState(!1),[F,V]=g.useState(""),[W,L]=g.useState(null),[O,H]=g.useState(!1);g.useEffect(()=>{a(),v(),u()},[a,v,u]);const B=g.useCallback(()=>{d()},[d]),U=g.useCallback(async ie=>{j(null),N(!0),S(!0);const oe=await h(ie);j(oe),N(!1)},[h]),A=g.useCallback(async ie=>{$(null),G(!0),I(!0);const oe=await y("windows");$(oe),G(!1)},[y]),M=g.useCallback(ie=>{V(ie),L(null),q(!0)},[]),Q=g.useCallback(async(ie,oe)=>{H(!0);const te=await p(F,ie,oe);L(te),H(!1)},[p,F]),T=(()=>{const ie=new Set;return n==null||n.hosts.forEach(oe=>ie.add(oe.ip)),r.forEach(oe=>ie.add(oe.ip)),ie.size})();return c.jsxs("div",{className:"h-full flex flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(h2,{className:"h-4 w-4 text-primary"}),c.jsx("h2",{className:"text-sm font-semibold",children:"Network"}),T>0&&c.jsxs(Rt,{variant:"secondary",className:"text-[10px]",children:[T," ",T===1?"device":"devices"]})]}),c.jsx("div",{className:"flex items-center gap-1.5",children:i?c.jsxs(Ee,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:b,children:[c.jsx(to,{className:"h-3 w-3 mr-1"}),"Cancel"]}):c.jsx(Ee,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:B,children:n?c.jsxs(c.Fragment,{children:[c.jsx(Ah,{className:"h-3 w-3 mr-1"}),"Rescan"]}):c.jsxs(c.Fragment,{children:[c.jsx(Eg,{className:"h-3 w-3 mr-1"}),"Discover Devices"]})})})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-5",children:[o&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-red-500 bg-red-500/10 rounded-md px-3 py-2",children:[c.jsx(VR,{className:"h-4 w-4 shrink-0"}),o]}),i&&c.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[c.jsx(bt,{className:"h-8 w-8 animate-spin text-primary"}),c.jsx("div",{className:"text-sm text-muted-foreground",children:"Discovering devices — this may take 30-60 seconds..."}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"Probing ARP table, common ports (22, 80, 443, 8000, 8080)"})]}),r.length>0&&c.jsxs("section",{children:[c.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Jait Gateway Nodes"}),c.jsx("div",{className:"space-y-1.5",children:r.map(ie=>c.jsx(Pce,{node:ie},ie.id))})]}),!i&&n&&c.jsxs("section",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-2",children:[c.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Discovered Devices"}),c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[n.hosts.length," ",n.hosts.length===1?"device":"devices"," · ",n.subnet," · ",(n.durationMs/1e3).toFixed(1),"s"]})]}),n.hosts.length===0?c.jsx("div",{className:"text-center py-8 text-sm text-muted-foreground",children:"No devices found. Try rescanning or check your network connection."}):c.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2",children:n.hosts.map(ie=>c.jsx(Tce,{host:ie,onTestSsh:U,onDeploy:M,onSshEnable:A},ie.ip))})]}),!i&&!n&&!o&&r.length===0&&c.jsxs("div",{className:"flex flex-col items-center gap-3 py-12 text-center",children:[c.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:c.jsx(aa,{className:"h-6 w-6 text-muted-foreground"})}),c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-medium",children:"Discover devices"}),c.jsx("div",{className:"text-xs text-muted-foreground mt-1 max-w-xs",children:"Scan your local network to find devices, test SSH connectivity, and deploy Jait Gateway to other machines."})]}),c.jsxs(Ee,{size:"sm",onClick:B,className:"mt-2",children:[c.jsx(Eg,{className:"h-3.5 w-3.5 mr-1.5"}),"Discover Devices"]})]}),t.length>0&&c.jsxs("section",{className:"pt-2 border-t",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground mb-2",children:[c.jsx(x7,{className:"h-3 w-3"}),c.jsx("span",{className:"uppercase tracking-wider font-medium",children:"Network Interfaces"}),c.jsxs("span",{className:"text-[10px] ml-1",children:["(",t.filter(ie=>!ie.internal).length,")"]})]}),c.jsx("div",{className:"space-y-1.5",children:t.filter(ie=>!ie.internal).map(ie=>c.jsx(Nce,{iface:ie},ie.name+ie.ip))})]})]}),c.jsx(Ace,{open:w,onOpenChange:S,result:C,testing:E}),c.jsx(Rce,{open:P,onOpenChange:I,info:R,loading:X}),c.jsx(Mce,{open:D,onOpenChange:q,targetIp:F,onDeploy:Q,result:W,deploying:O})]})}function Lce({platform:e,className:t}){switch(e){case"electron":return c.jsx(aa,{className:t??"h-4 w-4"});case"react-native":return c.jsx(k7,{className:t??"h-4 w-4"});default:return c.jsx(rr,{className:t??"h-4 w-4"})}}function sj({device:e,isLocal:t,isConnected:n,isLoading:r,onConnect:i}){const o=!t&&e.capabilities.includes("screen-share");return c.jsxs("div",{className:`flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm transition-colors
|
|
672
|
+
`:"")+p,r.push({type:"text",content:p})}break}}}return u(),t}const AC=cn(),RC={core:{variant:"default",label:"core"},standard:{variant:"secondary",label:"standard"},external:{variant:"warning",label:"external"}},MC=["meta","terminal","filesystem","os","agent","browser","web","surfaces","scheduler","memory","voice","screen","gateway","external"];function woe({token:e}){const[t,n]=g.useState([]),[r,i]=g.useState(!0),[o,a]=g.useState(!1),[u,d]=g.useState(null),[h,y]=g.useState("");g.useEffect(()=>{if(!e)return;let C=!1;return(async()=>{try{const j=await fetch(`${AC}/auth/settings/tools`,{headers:{Authorization:`Bearer ${e}`}});if(j.ok&&!C){const E=await j.json();n(E.tools)}}catch{C||d("Failed to load tools")}finally{C||i(!1)}})(),()=>{C=!0}},[e]);const p=g.useCallback(async(C,j)=>{if(e){n(E=>E.map(N=>N.name===C?{...N,enabled:j}:N)),a(!0),d(null);try{const E=t.map(P=>P.name===C?{...P,enabled:j}:P).filter(P=>!P.enabled&&!P.locked).map(P=>P.name);if(!(await fetch(`${AC}/auth/settings/tools`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({disabled_tools:E})})).ok)throw new Error("Failed to save")}catch{n(E=>E.map(N=>N.name===C?{...N,enabled:!j}:N)),d("Failed to update tool setting")}finally{a(!1)}}},[e,t]),v=new Map,b=h.trim().toLowerCase();for(const C of t){if(b&&!`${C.name} ${C.description} ${C.category}`.toLowerCase().includes(b))continue;const j=C.category;v.has(j)||v.set(j,[]),v.get(j).push(C)}const w=[...v.keys()].sort((C,j)=>{const E=MC.indexOf(C),N=MC.indexOf(j);return(E===-1?999:E)-(N===-1?999:N)}),S={total:t.length,enabled:t.filter(C=>C.enabled).length,core:t.filter(C=>C.tier==="core").length,standard:t.filter(C=>C.tier==="standard").length,external:t.filter(C=>C.tier==="external").length};return r?c.jsx(Ui,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading tools..."})}):c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Tools"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage which tools are available to the AI agent. Core tools are always enabled. Standard tools can be toggled. External (MCP) tools are discovered on demand."})]}),c.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(Wf,{className:"h-3.5 w-3.5"}),S.core," core"]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(WR,{className:"h-3.5 w-3.5"}),S.standard," standard"]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(IR,{className:"h-3.5 w-3.5"}),S.external," external"]}),c.jsxs("span",{className:"ml-auto",children:[S.enabled,"/",S.total," enabled"]})]}),c.jsxs("div",{className:"relative",children:[c.jsx(Eg,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),c.jsx(xr,{placeholder:"Filter tools...",value:h,onChange:C=>y(C.target.value),className:"pl-9"})]}),u&&c.jsx("p",{className:"text-sm text-destructive",children:u}),c.jsxs("div",{className:"space-y-5",children:[w.map(C=>{const j=v.get(C);return c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wide mb-2",children:C}),c.jsx("div",{className:"space-y-1",children:j.map(E=>{const N=RC[E.tier]??RC.standard;return c.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-md hover:bg-muted/50 transition-colors",children:[c.jsx(wd,{checked:E.enabled,onCheckedChange:P=>{p(E.name,P)},disabled:E.locked||o,"aria-label":`Toggle ${E.name}`}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-mono text-sm font-medium",children:E.name}),c.jsx(Rt,{variant:N.variant,className:"text-[10px] px-1.5 py-0",children:N.label}),E.source==="mcp"&&c.jsx(Rt,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"MCP"})]}),c.jsx("p",{className:"text-xs text-muted-foreground truncate",children:E.description})]})]},E.name)})})]},C)}),w.length===0&&c.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:b?"No tools match your filter.":"No tools available."})]})]})}function Soe({events:e}){return c.jsx(xd,{className:"h-full w-full",children:c.jsx("div",{className:"p-4 space-y-2",children:e.length===0?c.jsx("p",{className:"text-sm text-muted-foreground",children:"No activity yet."}):e.map(t=>c.jsxs("div",{className:"rounded-md border p-3",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("p",{className:"text-sm font-medium",children:t.title}),c.jsx("span",{className:"text-xs text-muted-foreground",children:t.source})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.detail})]},t.id))})})}var nu="Perplexity",Coe=.75,joe=.2,GN="#22B8CD",koe=GN,Eoe="#000",Ooe=.75;function sh(e){"@babel/helpers - typeof";return sh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sh(e)}var Noe=["size","style"];function DC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function p_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?DC(Object(n),!0).forEach(function(r){Toe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Toe(e,t,n){return t=Poe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Poe(e){var t=Aoe(e,"string");return sh(t)=="symbol"?t:String(t)}function Aoe(e,t){if(sh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(sh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Roe(e,t){if(e==null)return{};var n=Moe(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Moe(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Lx=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=Roe(e,Noe);return c.jsxs("svg",p_(p_({fill:"currentColor",fillRule:"evenodd",height:n,style:p_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:nu}),c.jsx("path",{d:"M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z"})]}))});function oh(e){"@babel/helpers - typeof";return oh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oh(e)}function LC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Doe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?LC(Object(n),!0).forEach(function(r){Loe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Loe(e,t,n){return t=zoe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zoe(e){var t=$oe(e,"string");return oh(t)=="symbol"?t:String(t)}function $oe(e,t){if(oh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(oh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ioe(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Boe=g.memo(function(e){var t=Object.assign({},(Ioe(e),e));return c.jsx(Ir,Doe({Icon:Lx,"aria-label":nu,background:koe,color:Eoe,iconMultiple:Ooe},t))});function lh(e){"@babel/helpers - typeof";return lh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lh(e)}var Hoe=["size","style"];function zC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function m_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zC(Object(n),!0).forEach(function(r){Foe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Foe(e,t,n){return t=Uoe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Uoe(e){var t=Voe(e,"string");return lh(t)=="symbol"?t:String(t)}function Voe(e,t){if(lh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(lh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Woe(e,t){if(e==null)return{};var n=qoe(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qoe(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var YN=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=Woe(e,Hoe);return c.jsxs("svg",m_(m_({height:n,style:m_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:nu}),c.jsx("path",{d:"M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z",fill:"#22B8CD",fillRule:"nonzero"})]}))});function ah(e){"@babel/helpers - typeof";return ah=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ah(e)}var Koe=["size","style"];function $C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function g_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$C(Object(n),!0).forEach(function(r){Goe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$C(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Goe(e,t,n){return t=Yoe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yoe(e){var t=Xoe(e,"string");return ah(t)=="symbol"?t:String(t)}function Xoe(e,t){if(ah(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ah(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Joe(e,t){if(e==null)return{};var n=Zoe(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Zoe(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var XN=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=Joe(e,Koe);return c.jsxs("svg",g_(g_({fill:"currentColor",fillRule:"evenodd",height:n,style:g_({flex:"none",lineHeight:1},r),viewBox:"0 0 117 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:nu}),c.jsx("path",{d:"M38.542 5.218h1.151V7.59h-1.49c-1.167 0-2.036.281-2.612.843-.575.563-.863 1.485-.863 2.768v7.773h-2.351V5.271h2.351v2.187c0 .123.062.185.184.185.069 0 .121-.017.157-.053a.58.58 0 00.104-.211c.453-1.44 1.577-2.16 3.371-2.16h-.002zm15.36 2.938c.617 1.098.928 2.42.928 3.966 0 1.545-.309 2.867-.928 3.965-.62 1.098-1.42 1.92-2.404 2.464a6.446 6.446 0 01-3.174.817c-2.23 0-3.797-.896-4.703-2.688-.069-.14-.157-.211-.262-.211-.105 0-.157.052-.157.158v7.352h-2.351V5.271h2.351v2.345c0 .106.052.159.157.159.105 0 .191-.07.262-.211.906-1.793 2.473-2.689 4.703-2.689 1.132 0 2.19.272 3.174.817.984.545 1.785 1.366 2.404 2.464zm-1.424 3.966c0-1.617-.43-2.877-1.292-3.781-.862-.904-1.998-1.357-3.41-1.357-1.413 0-2.548.453-3.41 1.357-.863.905-1.179 2.166-1.179 3.78 0 1.616.316 2.878 1.178 3.782.863.905 2 1.356 3.41 1.356 1.411 0 2.549-.453 3.411-1.356.862-.904 1.292-2.166 1.292-3.781zM15.05 8.177c.618 1.098.928 2.42.928 3.965 0 1.546-.308 2.868-.928 3.966-.619 1.098-1.42 1.919-2.403 2.464a6.448 6.448 0 01-3.175.817c-2.23 0-3.797-.896-4.702-2.688-.07-.14-.158-.212-.262-.212-.105 0-.158.053-.158.159V24H2V5.292h2.351v2.345c0 .106.053.159.158.159.104 0 .19-.07.261-.212.906-1.792 2.473-2.688 4.703-2.688 1.132 0 2.19.272 3.175.817.983.545 1.784 1.366 2.403 2.464h-.002zm-1.423 3.965c0-1.616-.43-2.877-1.293-3.78-.862-.904-1.998-1.357-3.41-1.357-1.412 0-2.548.453-3.41 1.357-.862.905-1.178 2.165-1.178 3.78 0 1.615.316 2.878 1.178 3.781.862.906 1.998 1.357 3.41 1.357 1.412 0 2.548-.453 3.41-1.357.863-.903 1.293-2.166 1.293-3.78zm14.422 2.481h2.482c-.33 1.283-1.006 2.395-2.023 3.334-1.02.94-2.479 1.41-4.378 1.41-1.429 0-2.686-.295-3.775-.884a6.13 6.13 0 01-2.521-2.516c-.593-1.089-.889-2.372-.889-3.847 0-1.476.288-2.758.863-3.847.574-1.089 1.38-1.928 2.417-2.517 1.036-.588 2.25-.883 3.644-.883 1.393 0 2.547.29 3.514.87.968.58 1.69 1.349 2.168 2.305.48.959.719 2.008.719 3.15v1.58H19.427c.086 1.37.544 2.46 1.37 3.268.828.807 1.939 1.213 3.332 1.213 1.132 0 2-.232 2.6-.698.601-.466 1.04-1.111 1.32-1.938zm-8.595-3.82h8.204c0-1.194-.305-2.13-.914-2.807-.61-.676-1.568-1.015-2.874-1.015-1.22 0-2.217.33-2.99.988-.775.659-1.25 1.604-1.424 2.832l-.002.002zm37.238 8.17h2.352V0H56.69v18.974-.002zM89.316 3.774h2.747V.81h-2.747v2.966zm9.688 13.156c-.426.043-.684.066-.77.066a.39.39 0 01-.289-.106.395.395 0 01-.104-.29c0-.087.022-.348.065-.778.043-.43.066-1.094.066-1.988V7.279h3.354l-.66-2.008h-2.692v-3.69h-2.352v3.688h-2.557v2.008h2.557v7.214c0 1.512.367 2.636 1.098 3.374.732.737 1.846 1.107 3.345 1.107h1.83v-2.107h-.915c-.889 0-1.547.022-1.974.066h-.002zm13.759-11.662l-3.893 11.498c-.053.141-.135.326-.402.326-.268 0-.35-.185-.402-.326l-3.893-11.498h-2.398l4.508 13.703h1.594a.81.81 0 01.235.026c.053.017.096.06.131.133.07.105.06.264-.026.473l-.731 2.002c-.105.264-.305.396-.6.396-.106 0-.349-.023-.732-.066a13.71 13.71 0 00-1.49-.066h-1.907v2.107h2.508c1.463 0 2.344-.25 3.102-.75.757-.5 1.345-1.383 1.764-2.65L115 5.795v-.526h-2.237v.001zm-31.127 5.113L77.953 5.27h-2.588v.527l4.415 5.93-5.382 6.72v.526h2.64l4.285-5.507 3.998 5.507h2.535v-.526l-4.677-6.324 5.07-6.298v-.553h-2.64l-3.971 5.113-.002-.002zm7.931 8.59h2.351v-13.7h-2.35v13.702-.002zm-15.062-4.349c-.331 1.283-1.006 2.395-2.024 3.334-1.02.94-2.479 1.41-4.377 1.41-1.43 0-2.686-.295-3.775-.884a6.13 6.13 0 01-2.522-2.516c-.593-1.089-.888-2.372-.888-3.847 0-1.476.288-2.758.862-3.847.574-1.089 1.38-1.928 2.417-2.517 1.036-.588 2.25-.883 3.644-.883 1.394 0 2.547.29 3.515.87.967.58 1.689 1.349 2.168 2.305.479.959.718 2.008.718 3.15v1.58H63.401c.086 1.37.544 2.46 1.371 3.268.827.807 1.938 1.213 3.332 1.213 1.132 0 2-.232 2.6-.698.6-.466 1.04-1.111 1.319-1.938h2.482zm-11.078-3.82h8.205c0-1.194-.305-2.13-.915-2.807-.61-.676-1.568-1.015-2.873-1.015-1.22 0-2.217.33-2.991.988-.775.659-1.25 1.604-1.424 2.832l-.002.002z"})]}))});function ch(e){"@babel/helpers - typeof";return ch=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ch(e)}var Qoe=["type"];function IC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ele(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?IC(Object(n),!0).forEach(function(r){tle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tle(e,t,n){return t=nle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nle(e){var t=rle(e,"string");return ch(t)=="symbol"?t:String(t)}function rle(e,t){if(ch(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ch(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ile(e,t){if(e==null)return{};var n=sle(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sle(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var ole=g.memo(function(e){var t=e.type,n=t===void 0?"mono":t,r=ile(e,Qoe),i=n==="color"?YN:Lx;return c.jsx(Br,ele({Icon:i,Text:XN,"aria-label":nu,spaceMultiple:joe,textMultiple:Coe},r))}),ja=Lx;ja.Color=YN;ja.Text=XN;ja.Combine=ole;ja.Avatar=Boe;ja.colorPrimary=GN;ja.title=nu;var Zh="OpenRouter",lle=1,ale=.4,zx="#6566F1",cle=zx,ule="#fff",fle=.75;function uh(e){"@babel/helpers - typeof";return uh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uh(e)}var dle=["size","style"];function BC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function y_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?BC(Object(n),!0).forEach(function(r){hle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hle(e,t,n){return t=ple(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ple(e){var t=mle(e,"string");return uh(t)=="symbol"?t:String(t)}function mle(e,t){if(uh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(uh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gle(e,t){if(e==null)return{};var n=yle(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function yle(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var $x=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=gle(e,dle);return c.jsxs("svg",y_(y_({fill:"currentColor",fillRule:"evenodd",height:n,style:y_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Zh}),c.jsx("path",{d:"M16.804 1.957l7.22 4.105v.087L16.73 10.21l.017-2.117-.821-.03c-1.059-.028-1.611.002-2.268.11-1.064.175-2.038.577-3.147 1.352L8.345 11.03c-.284.195-.495.336-.68.455l-.515.322-.397.234.385.23.53.338c.476.314 1.17.796 2.701 1.866 1.11.775 2.083 1.177 3.147 1.352l.3.045c.694.091 1.375.094 2.825.033l.022-2.159 7.22 4.105v.087L16.589 22l.014-1.862-.635.022c-1.386.042-2.137.002-3.138-.162-1.694-.28-3.26-.926-4.881-2.059l-2.158-1.5a21.997 21.997 0 00-.755-.498l-.467-.28a55.927 55.927 0 00-.76-.43C2.908 14.73.563 14.116 0 14.116V9.888l.14.004c.564-.007 2.91-.622 3.809-1.124l1.016-.58.438-.274c.428-.28 1.072-.726 2.686-1.853 1.621-1.133 3.186-1.78 4.881-2.059 1.152-.19 1.974-.213 3.814-.138l.02-1.907z"})]}))});function fh(e){"@babel/helpers - typeof";return fh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fh(e)}function HC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function vle(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?HC(Object(n),!0).forEach(function(r){_le(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):HC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _le(e,t,n){return t=ble(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ble(e){var t=xle(e,"string");return fh(t)=="symbol"?t:String(t)}function xle(e,t){if(fh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(fh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function wle(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Sle=g.memo(function(e){var t=Object.assign({},(wle(e),e));return c.jsx(Ir,vle({Icon:$x,"aria-label":Zh,background:cle,color:ule,iconMultiple:fle},t))});function dh(e){"@babel/helpers - typeof";return dh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dh(e)}var Cle=["size","style"];function FC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function v_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?FC(Object(n),!0).forEach(function(r){jle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function jle(e,t,n){return t=kle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kle(e){var t=Ele(e,"string");return dh(t)=="symbol"?t:String(t)}function Ele(e,t){if(dh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(dh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ole(e,t){if(e==null)return{};var n=Nle(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Nle(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var JN=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=Ole(e,Cle);return c.jsxs("svg",v_(v_({fill:"currentColor",fillRule:"evenodd",height:n,style:v_({flex:"none",lineHeight:1},r),viewBox:"0 0 143 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Zh}),c.jsx("path",{d:"M9.623 2c1.46 0 2.763.35 3.91 1.05 1.149.699 2.053 1.7 2.714 3.002.66 1.303.991 2.861.991 4.675 0 1.814-.33 3.372-.991 4.675-.66 1.302-1.565 2.303-2.713 3.003-1.148.7-2.452 1.049-3.91 1.049-1.465 0-2.772-.35-3.92-1.05-1.148-.699-2.052-1.701-2.713-3.007-.66-1.305-.991-2.862-.991-4.67 0-1.814.33-3.372.991-4.675.66-1.302 1.565-2.303 2.713-3.003C6.852 2.35 8.16 2 9.624 2zm0 2.34c-.974 0-1.844.244-2.61.734-.765.489-1.37 1.208-1.813 2.156-.443.949-.664 2.114-.664 3.497s.221 2.548.664 3.497c.444.948 1.048 1.667 1.813 2.156.766.49 1.636.735 2.61.735.97 0 1.838-.245 2.606-.735.768-.489 1.374-1.208 1.817-2.156.443-.949.665-2.114.665-3.497s-.222-2.548-.665-3.497c-.443-.948-1.049-1.667-1.817-2.156-.768-.49-1.637-.735-2.606-.735zm16.32 1.974c1.024 0 1.938.26 2.742.78s1.436 1.269 1.896 2.248c.46.979.69 2.156.69 3.534 0 1.377-.23 2.556-.686 3.538-.457.981-1.085 1.736-1.883 2.264-.799.529-1.71.793-2.734.793-.771 0-1.4-.13-1.887-.39-.488-.26-.869-.564-1.144-.913a6.908 6.908 0 01-.636-.929h-.149V24h-2.47V6.48h2.412v2.065h.207c.143-.265.35-.572.62-.92.27-.349.643-.655 1.123-.917.479-.263 1.112-.394 1.9-.394zm-.528 2.107c-.716 0-1.32.185-1.813.556-.493.37-.866.887-1.12 1.55-.253.665-.38 1.439-.38 2.324 0 .896.13 1.68.389 2.356.259.674.633 1.201 1.123 1.58s1.09.568 1.8.568c.738 0 1.355-.198 1.85-.593.496-.395.872-.933 1.128-1.613.256-.68.384-1.447.384-2.298 0-.84-.125-1.596-.376-2.265-.25-.67-.625-1.197-1.123-1.584-.498-.388-1.12-.581-1.862-.581zm13.387-2.107c.716 0 1.41.119 2.082.356a5.037 5.037 0 011.809 1.12c.534.51.955 1.169 1.263 1.979.309.81.463 1.793.463 2.949v.88l-9.016-.001.002.105c.03.732.178 1.364.445 1.895.3.597.72 1.052 1.26 1.364.539.313 1.17.469 1.89.469.469 0 .895-.068 1.28-.203a2.716 2.716 0 001-.61c.281-.271.496-.606.644-1.004l2.338.423a4.247 4.247 0 01-1.004 1.813c-.482.517-1.084.918-1.808 1.203-.725.284-1.549.427-2.474.427-1.25 0-2.325-.27-3.225-.809-.9-.54-1.594-1.3-2.082-2.281-.487-.982-.73-2.134-.73-3.455 0-1.306.243-2.456.73-3.451.488-.996 1.17-1.773 2.049-2.331.878-.559 1.906-.838 3.084-.838zm.017 2.049c-.694 0-1.298.17-1.813.51-.515.34-.911.782-1.19 1.327a3.778 3.778 0 00-.39 1.303l-.02.236h6.593c0-.653-.132-1.232-.397-1.738a3.022 3.022 0 00-1.11-1.199c-.477-.293-1.034-.44-1.673-.44zm10.29 3.293v7.566H46.64V6.48h2.37v2.074h.158a3.63 3.63 0 011.375-1.626c.625-.41 1.413-.614 2.366-.614.864 0 1.622.18 2.271.543.65.362 1.154.9 1.512 1.614.358.713.537 1.595.537 2.646v8.105h-2.47v-7.806c0-.924-.24-1.647-.718-2.17-.48-.522-1.137-.784-1.974-.784-.573 0-1.081.125-1.524.374a2.65 2.65 0 00-1.05 1.09c-.255.479-.383 1.055-.383 1.73zm17.122-9.424c1.31 0 2.4.227 3.266.68.868.454 1.516 1.08 1.945 1.88.43.799.645 1.72.645 2.766 0 1.04-.216 1.954-.649 2.742-.432.788-1.082 1.4-1.949 1.837a5.1 5.1 0 01-.501.22l3.743 6.865h-2.907l-3.436-6.43h-3.634v6.43h-2.552V2.232h6.029zm-.273 2.199h-3.204v6.155h3.237c.826 0 1.5-.119 2.02-.357s.901-.583 1.144-1.037c.242-.453.363-.998.363-1.634 0-.641-.122-1.197-.367-1.667-.246-.47-.628-.831-1.148-1.083-.52-.252-1.202-.377-2.045-.377zM79.66 6.314c1.19 0 2.227.273 3.114.821.886.548 1.575 1.316 2.065 2.306s.735 2.146.735 3.468c0 1.316-.245 2.466-.735 3.45-.49.985-1.179 1.751-2.065 2.299-.887.547-1.924.82-3.114.82s-2.227-.273-3.113-.82c-.887-.548-1.575-1.314-2.065-2.298-.49-.985-.735-2.135-.735-3.451 0-1.322.245-2.478.735-3.468.49-.99 1.178-1.758 2.065-2.306.886-.548 1.924-.821 3.113-.821zm.008 2.074c-.776 0-1.419.207-1.928.622-.51.415-.887.963-1.132 1.646a6.602 6.602 0 00-.367 2.244c0 .819.122 1.568.367 2.249.245.68.623 1.225 1.132 1.634.51.41 1.152.614 1.928.614.771 0 1.41-.205 1.917-.614.506-.41.882-.954 1.127-1.634.245-.68.367-1.43.367-2.249 0-.813-.122-1.56-.367-2.244-.245-.683-.62-1.231-1.127-1.646-.507-.415-1.146-.622-1.917-.622zm16.164 5.55V6.48h2.477v12.742h-2.428v-2.207h-.132a3.956 3.956 0 01-1.4 1.697c-.641.45-1.438.676-2.391.676-.815 0-1.535-.181-2.16-.544-.625-.362-1.115-.9-1.47-1.613-.355-.714-.533-1.596-.533-2.647V6.48h2.47v7.806c0 .868.24 1.56.718 2.074.48.514 1.102.771 1.867.771.462 0 .924-.116 1.383-.348.46-.232.843-.584 1.148-1.054.306-.47.456-1.067.45-1.792zm8.58-10.511v3.052h2.602v1.992h-2.602v7.01c0 .48.072.841.215 1.082.144.24.33.404.558.49.228.085.478.128.747.128.199 0 .372-.014.52-.041l.348-.067.446 2.05a4.42 4.42 0 01-.612.17c-.264.057-.594.09-.99.095a4.331 4.331 0 01-1.818-.349 3.12 3.12 0 01-1.362-1.128c-.347-.509-.52-1.148-.52-1.916l-.002-7.525h-1.857V6.48h1.857l.001-3.053h2.47zm9.961 2.887c.716 0 1.41.119 2.081.356a5.037 5.037 0 011.81 1.12c.533.51.954 1.169 1.263 1.979.308.81.462 1.793.462 2.949v.88l-9.016-.001.003.105c.03.732.178 1.364.445 1.895.3.597.72 1.052 1.259 1.364.54.313 1.17.469 1.891.469.468 0 .895-.068 1.28-.203a2.716 2.716 0 001-.61c.28-.271.495-.606.644-1.004l2.337.423a4.247 4.247 0 01-1.003 1.813c-.482.517-1.085.918-1.809 1.203-.724.284-1.548.427-2.473.427-1.25 0-2.325-.27-3.226-.809-.9-.54-1.594-1.3-2.08-2.281-.488-.982-.732-2.134-.732-3.455 0-1.306.244-2.456.731-3.451.487-.996 1.17-1.773 2.048-2.331.879-.559 1.907-.838 3.085-.838zm.017 2.049c-.694 0-1.298.17-1.813.51-.515.34-.911.782-1.19 1.327a3.778 3.778 0 00-.39 1.303l-.02.236h6.592c0-.653-.132-1.232-.396-1.738a3.022 3.022 0 00-1.11-1.199c-.477-.293-1.035-.44-1.673-.44zm7.821 10.859V6.48h2.387v2.024h.132a3.092 3.092 0 011.227-1.622 3.485 3.485 0 011.994-.593l.396.01.153.006c.212.011.379.025.5.042v2.372c-.1-.027-.275-.059-.529-.095a5.4 5.4 0 00-.76-.054c-.583 0-1.102.123-1.556.37a2.799 2.799 0 00-1.078 1.02 2.79 2.79 0 00-.397 1.48v7.782h-2.469z"})]}))});function hh(e){"@babel/helpers - typeof";return hh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hh(e)}var Tle=["type","iconProps"];function UC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function VC(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?UC(Object(n),!0).forEach(function(r){Ple(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):UC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ple(e,t,n){return t=Ale(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ale(e){var t=Rle(e,"string");return hh(t)=="symbol"?t:String(t)}function Rle(e,t){if(hh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Mle(e,t){if(e==null)return{};var n=Dle(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Dle(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Lle=g.memo(function(e){var t=e.type,n=t===void 0?"mono":t,r=e.iconProps,i=Mle(e,Tle);return c.jsx(Br,VC({Icon:$x,Text:JN,"aria-label":Zh,iconProps:VC({color:n==="color"?zx:void 0},r),spaceMultiple:ale,textMultiple:lle},i))}),ru=$x;ru.Text=JN;ru.Combine=Lle;ru.Avatar=Sle;ru.colorPrimary=zx;ru.title=Zh;var Qh="Grok",zle=.75,$le=.25,ZN="#fff",Ile=ZN,Ble="#000",Hle=.65;function ph(e){"@babel/helpers - typeof";return ph=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ph(e)}var Fle=["size","style"];function WC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function __(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?WC(Object(n),!0).forEach(function(r){Ule(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ule(e,t,n){return t=Vle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vle(e){var t=Wle(e,"string");return ph(t)=="symbol"?t:String(t)}function Wle(e,t){if(ph(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ph(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qle(e,t){if(e==null)return{};var n=Kle(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Kle(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var QN=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=qle(e,Fle);return c.jsxs("svg",__(__({fill:"currentColor",fillRule:"evenodd",height:n,style:__({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Qh}),c.jsx("path",{d:"M6.469 8.776L16.512 23h-4.464L2.005 8.776H6.47zm-.004 7.9l2.233 3.164L6.467 23H2l4.465-6.324zM22 2.582V23h-3.659V7.764L22 2.582zM22 1l-9.952 14.095-2.233-3.163L17.533 1H22z"})]}))});function mh(e){"@babel/helpers - typeof";return mh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mh(e)}function qC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gle(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qC(Object(n),!0).forEach(function(r){Yle(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Yle(e,t,n){return t=Xle(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xle(e){var t=Jle(e,"string");return mh(t)=="symbol"?t:String(t)}function Jle(e,t){if(mh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(mh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zle(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var eT=g.memo(function(e){var t=Object.assign({},(Zle(e),e));return c.jsx(Ir,Gle({Icon:QN,"aria-label":Qh,background:Ile,color:Ble,iconMultiple:Hle},t))});function gh(e){"@babel/helpers - typeof";return gh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gh(e)}var Qle=["size","style"];function KC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function b_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?KC(Object(n),!0).forEach(function(r){eae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):KC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function eae(e,t,n){return t=tae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tae(e){var t=nae(e,"string");return gh(t)=="symbol"?t:String(t)}function nae(e,t){if(gh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(gh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rae(e,t){if(e==null)return{};var n=iae(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function iae(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var tT=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=rae(e,Qle);return c.jsxs("svg",b_(b_({fill:"currentColor",fillRule:"evenodd",height:n,style:b_({flex:"none",lineHeight:1},r),viewBox:"0 0 41 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:Qh}),c.jsx("path",{d:"M36.867 2h2.577v20h-2.577V2zM23.875 2h2.717l7.759 20H31.55l-2.101-5.574h-8.571L18.777 22h-2.69l7.788-20zm4.79 12.185l-3.53-9.272-3.473 9.272h7.003zM7.35 14.381L2.504 7.518h2.857l3.446 5.126 3.585-5.126h2.605l-4.762 6.835L15.501 22h-2.829l-3.977-5.854L4.689 22H2l5.35-7.619z"})]}))});function yh(e){"@babel/helpers - typeof";return yh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yh(e)}function GC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function sae(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?GC(Object(n),!0).forEach(function(r){oae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function oae(e,t,n){return t=lae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lae(e){var t=aae(e,"string");return yh(t)=="symbol"?t:String(t)}function aae(e,t){if(yh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(yh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cae(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var uae=g.memo(function(e){var t=Object.assign({},(cae(e),e));return c.jsx(Br,sae({Icon:eT,Text:tT,"aria-label":Qh,iconProps:{shape:"square"},spaceMultiple:$le,textMultiple:zle},t))}),iu=QN;iu.Text=tT;iu.Combine=uae;iu.Avatar=eT;iu.colorPrimary=ZN;iu.title=Qh;var ep="MoonshotAI",fae=.75,dae=.4,nT="#16191E",hae=nT,pae="#fff",mae=.75;function vh(e){"@babel/helpers - typeof";return vh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vh(e)}var gae=["size","style"];function YC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function x_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?YC(Object(n),!0).forEach(function(r){yae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):YC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yae(e,t,n){return t=vae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vae(e){var t=_ae(e,"string");return vh(t)=="symbol"?t:String(t)}function _ae(e,t){if(vh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(vh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function bae(e,t){if(e==null)return{};var n=xae(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xae(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Ix=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=bae(e,gae);return c.jsxs("svg",x_(x_({fill:"currentColor",fillRule:"evenodd",height:n,style:x_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:ep}),c.jsx("path",{d:"M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z"})]}))});function _h(e){"@babel/helpers - typeof";return _h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_h(e)}function XC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function wae(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?XC(Object(n),!0).forEach(function(r){Sae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Sae(e,t,n){return t=Cae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cae(e){var t=jae(e,"string");return _h(t)=="symbol"?t:String(t)}function jae(e,t){if(_h(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(_h(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function kae(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Eae=g.memo(function(e){var t=Object.assign({},(kae(e),e));return c.jsx(Ir,wae({Icon:Ix,"aria-label":ep,background:hae,color:pae,iconMultiple:mae},t))});function bh(e){"@babel/helpers - typeof";return bh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bh(e)}var Oae=["size","style"];function JC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function w_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?JC(Object(n),!0).forEach(function(r){Nae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):JC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nae(e,t,n){return t=Tae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tae(e){var t=Pae(e,"string");return bh(t)=="symbol"?t:String(t)}function Pae(e,t){if(bh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(bh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Aae(e,t){if(e==null)return{};var n=Rae(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Rae(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var rT=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=Aae(e,Oae);return c.jsxs("svg",w_(w_({fill:"currentColor",fillRule:"evenodd",height:n,style:w_({flex:"none",lineHeight:1},r),viewBox:"0 0 171 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:ep}),c.jsx("path",{d:"M165.484 2H169v19.507h-3.516V2zm-35.707 0v5.26h3.186v3.507h-3.186v10.74h-3.516v-10.74h-2.966V7.26h2.966V2h3.516zm-24.598 11.023v8.498h-3.345v-8.804c.008-2.1-2.109-2.895-3.109-2.895l-.064.001c-1.073.026-3.521.694-3.54 3.863v7.835h-3.468V2.014L95.14 2v6.918c1.228-1.986 3.93-2.243 4.755-2.243.926 0 1.768.155 2.525.465.757.31 1.378.783 1.864 1.42.413.54.665 1.096.757 1.667.092.571.138 1.503.138 2.796zM89.29 9.507l-2.362 2.41c-2.911-2.41-6.647-2.136-7.196-.93-.55 1.205 2.444 1.484 4.734 1.98l.634.146c1.731.408 4.603 1.274 4.52 4.12-.11 3.78-4.23 4.767-6.867 4.767-2.637 0-5.933-1.808-7.636-3.342l2.527-2.63c2.582 2.63 7.142 2.958 7.856 1.534.714-1.425-1.263-1.48-4.834-1.973-3.175-.438-4.837-2.85-4.813-4.13.034-1.843 1.543-4.85 6.31-4.886 3.227-.025 5.425.961 7.127 2.934zm-22.617.386l-.033.001c-1.905.083-3.443 1.453-3.458 3.746v7.867h-3.83V7.185h3.702v2.061l.088-.12c.591-.8 2.07-2.555 4.796-2.523 2.675.032 5.696 1.95 5.696 5.17v9.734H69.69v-8.813c-.01-2.197-2.102-2.824-3.016-2.8zm-33.14-3.29c4.247 0 7.69 3.434 7.69 7.671s-3.443 7.671-7.69 7.671c-4.248 0-7.692-3.434-7.692-7.671s3.444-7.671 7.691-7.671zm0 3.726a3.95 3.95 0 00-3.956 3.945 3.95 3.95 0 003.955 3.945 3.95 3.95 0 003.956-3.945 3.95 3.95 0 00-3.956-3.945zm16.7-3.726c4.247 0 7.69 3.434 7.69 7.671s-3.443 7.671-7.69 7.671c-4.248 0-7.692-3.434-7.692-7.671s3.444-7.671 7.691-7.671zm0 3.726a3.95 3.95 0 00-3.956 3.945 3.95 3.95 0 003.955 3.945 3.95 3.95 0 003.956-3.945 3.95 3.95 0 00-3.956-3.945zm64.382-3.726c4.248 0 7.69 3.434 7.69 7.671s-3.442 7.671-7.69 7.671c-4.247 0-7.69-3.434-7.69-7.671s3.443-7.671 7.69-7.671zm0 3.726a3.95 3.95 0 00-3.955 3.945 3.95 3.95 0 003.955 3.945 3.95 3.95 0 003.955-3.945 3.95 3.95 0 00-3.955-3.945zM2 21.616V2l10.987 7.89L23.919 2v19.616h-3.79V9.452l-7.17 5.26-7.169-5.26v12.164H2zM153.344 2l10.492 19.507h-4.138l-1.833-3.288h-5.235l-1.789-3.46-3.632 6.748h-4.358L153.344 2zm0 8.11l-2.478 4.602h5.044l-2.566-4.602z"})]}))});function xh(e){"@babel/helpers - typeof";return xh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xh(e)}function ZC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Mae(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ZC(Object(n),!0).forEach(function(r){Dae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ZC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Dae(e,t,n){return t=Lae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lae(e){var t=zae(e,"string");return xh(t)=="symbol"?t:String(t)}function zae(e,t){if(xh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(xh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $ae(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Iae=g.memo(function(e){var t=Object.assign({},($ae(e),e));return c.jsx(Br,Mae({Icon:Ix,Text:rT,"aria-label":ep,spaceMultiple:dae,textMultiple:fae},t))}),su=Ix;su.Text=rT;su.Combine=Iae;su.Avatar=Eae;su.colorPrimary=nT;su.title=ep;var ou="Kimi",Bae=.7,Hae=.25,iT="#000",Fae=iT,Uae="#fff",Vae=.6;function wh(e){"@babel/helpers - typeof";return wh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wh(e)}var Wae=["size","style"];function QC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function S_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?QC(Object(n),!0).forEach(function(r){qae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QC(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function qae(e,t,n){return t=Kae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kae(e){var t=Gae(e,"string");return wh(t)=="symbol"?t:String(t)}function Gae(e,t){if(wh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(wh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Yae(e,t){if(e==null)return{};var n=Xae(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Xae(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var sT=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=Yae(e,Wae);return c.jsxs("svg",S_(S_({height:n,style:S_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:ou}),c.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z",fill:"#1783FF"}),c.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z",fill:"#fff"})]}))});function Sh(e){"@babel/helpers - typeof";return Sh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sh(e)}function ej(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Jae(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ej(Object(n),!0).forEach(function(r){Zae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ej(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Zae(e,t,n){return t=Qae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qae(e){var t=ece(e,"string");return Sh(t)=="symbol"?t:String(t)}function ece(e,t){if(Sh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Sh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tce(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var oT=g.memo(function(e){var t=Object.assign({},(tce(e),e));return c.jsx(Ir,Jae({Icon:sT,"aria-label":ou,background:Fae,color:Uae,iconMultiple:Vae},t))});function Ch(e){"@babel/helpers - typeof";return Ch=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ch(e)}var nce=["size","style"];function tj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function C_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tj(Object(n),!0).forEach(function(r){rce(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tj(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rce(e,t,n){return t=ice(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ice(e){var t=sce(e,"string");return Ch(t)=="symbol"?t:String(t)}function sce(e,t){if(Ch(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ch(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oce(e,t){if(e==null)return{};var n=lce(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function lce(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var lT=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=oce(e,nce);return c.jsxs("svg",C_(C_({fill:"currentColor",fillRule:"evenodd",height:n,style:C_({flex:"none",lineHeight:1},r),viewBox:"0 0 64 24",xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:ou}),c.jsx("path",{d:"M24.353 21.58c0 .232.188.42.42.42h2.69a.42.42 0 00.42-.42V2.42a.42.42 0 00-.42-.42h-2.69a.42.42 0 00-.42.42v19.16zM58.47 21.58c0 .232.188.42.42.42h2.691a.42.42 0 00.419-.42V2.42a.42.42 0 00-.419-.42H58.89a.42.42 0 00-.42.42v19.16zM47.786 2a.42.42 0 00-.408.32L43.4 18.633c-.066.267-.38.267-.444 0L38.976 2.32A.417.417 0 0038.57 2H31.83a.418.418 0 00-.418.42v19.16c0 .232.188.42.42.42h2.988c.231 0 .419-.182.419-.414V5.471c0-.322.378-.389.454-.079l3.974 16.288a.42.42 0 00.407.32h6.208a.42.42 0 00.407-.32L50.66 5.394c.076-.31.455-.243.455.079V21.58c0 .231.187.419.419.419h2.987a.42.42 0 00.42-.42V2.42a.42.42 0 00-.42-.42h-6.735zM11.55 11.273l8.115-8.565A.42.42 0 0019.36 2h-3.776a.42.42 0 00-.298.124l-9.303 9.39c-.144.146-.357.016-.357-.218V2.42a.42.42 0 00-.42-.42H2.42a.42.42 0 00-.42.42v19.16c0 .232.188.42.42.42h2.786a.42.42 0 00.42-.42v-3.82c0-.085.03-.166.081-.219l2.87-2.931c.07-.07.166-.081.243-.029l7.678 5.816c1.123.778 2.552 1.288 3.861 1.5a.403.403 0 00.464-.404v-3.461c0-.206-.15-.38-.35-.423-.76-.164-1.604-.474-2.244-.918l-6.647-4.953c-.138-.095-.155-.34-.033-.465z"})]}))});function jh(e){"@babel/helpers - typeof";return jh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jh(e)}var ace=["iconProps"];function nj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rj(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nj(Object(n),!0).forEach(function(r){cce(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nj(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function cce(e,t,n){return t=uce(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uce(e){var t=fce(e,"string");return jh(t)=="symbol"?t:String(t)}function fce(e,t){if(jh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(jh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dce(e,t){if(e==null)return{};var n=hce(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hce(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var pce=g.memo(function(e){var t=e.iconProps,n=dce(e,ace);return c.jsx(Br,rj({Icon:oT,Text:lT,"aria-label":ou,iconProps:rj({shape:"square"},t),spaceMultiple:Hae,textMultiple:Bae},n))});function kh(e){"@babel/helpers - typeof";return kh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kh(e)}var mce=["size","style"];function ij(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function j_(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ij(Object(n),!0).forEach(function(r){gce(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ij(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function gce(e,t,n){return t=yce(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yce(e){var t=vce(e,"string");return kh(t)=="symbol"?t:String(t)}function vce(e,t){if(kh(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(kh(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _ce(e,t){if(e==null)return{};var n=bce(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function bce(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var xce=g.memo(function(e){var t=e.size,n=t===void 0?"1em":t,r=e.style,i=_ce(e,mce);return c.jsxs("svg",j_(j_({fill:"currentColor",fillRule:"evenodd",height:n,style:j_({flex:"none",lineHeight:1},r),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},i),{},{children:[c.jsx("title",{children:ou}),c.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),c.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]}))}),ka=xce;ka.Color=sT;ka.Text=lT;ka.Combine=pce;ka.Avatar=oT;ka.colorPrimary=iT;ka.title=ou;const wce=["OPENAI_API_KEY","OPENAI_BASE_URL","OPENAI_MODEL","OPENAI_WEB_SEARCH_MODEL","BRAVE_API_KEY","PERPLEXITY_API_KEY","OPENROUTER_API_KEY","XAI_API_KEY","GEMINI_API_KEY","MOONSHOT_API_KEY","KIMI_BASE_URL","KIMI_MODEL","PERPLEXITY_MODEL","PERPLEXITY_OPENROUTER_MODEL","GROK_MODEL","GEMINI_MODEL"],Sce={OPENAI:rn,PERPLEXITY:ja,OPENROUTER:ru,XAI:iu,GEMINI:oo,MOONSHOT:su,KIMI:ka,GROK:Ca};function Cce(e){const t=e.split("_")[0];return Sce[t]??null}function jce(e){return e.endsWith("_KEY")||e.endsWith("_URL")}const kce=cn();function Ece({username:e,token:t,apiKeys:n,onSaveApiKeys:r,sttProvider:i,onSttProviderChange:o,onClearArchive:a,activityEvents:u,updateInfo:d,updateChecking:h,onCheckUpdate:y,onApplyUpdate:p,updateApplying:v,platform:b}){const[w,S]=g.useState(n),[C,j]=g.useState(!1),[E,N]=g.useState(!1),[P,I]=g.useState(null),[R,$]=g.useState(null),[X,G]=g.useState({}),[D,q]=g.useState({}),[F,V]=g.useState(ha()??""),[W,L]=g.useState("idle"),[O,H]=g.useState(null),B=g.useCallback(async T=>{if(!T.trim()){mg(null),L("ok"),H(null);return}L("testing"),H(null);try{const ie=T.replace(/\/$/,""),oe=await fetch(`${ie}/health`,{signal:AbortSignal.timeout(5e3)});if(!oe.ok)throw new Error(`HTTP ${oe.status}`);mg(ie),L("ok")}catch(ie){L("error"),H(ie instanceof Error?ie.message:"Connection failed")}},[]);g.useEffect(()=>{S(n)},[n]),g.useEffect(()=>{if(!t)return;let T=!1;return(async()=>{try{const ie=await fetch(`${kce}/auth/settings/env-status`,{headers:{Authorization:`Bearer ${t}`}});if(ie.ok&&!T){const oe=await ie.json();G(oe.env_set)}}catch{}})(),()=>{T=!0}},[t]);const U=g.useCallback(T=>{q(ie=>({...ie,[T]:!ie[T]}))},[]),A=async()=>{j(!0),$(null),I(null);try{await r(w),I("API keys saved.")}catch(T){$(T instanceof Error?T.message:"Failed to save API keys")}finally{j(!1)}},M=async()=>{N(!0),$(null),I(null);try{const T=await a();I(`Cleared ${T} archived session(s).`)}catch(T){$(T instanceof Error?T.message:"Failed to clear archive")}finally{N(!1)}};function Q(T){var te;const ie=!!((te=w[T])!=null&&te.trim()),oe=!!X[T];return ie?c.jsx(Rt,{variant:"default",className:"text-[10px] px-1.5 py-0",children:"user"}):oe?c.jsx(Rt,{variant:"success",className:"text-[10px] px-1.5 py-0",children:".env"}):c.jsx(Rt,{variant:"outline",className:"text-[10px] px-1.5 py-0 text-muted-foreground",children:"empty"})}return c.jsxs("div",{className:"mx-auto w-full max-w-5xl p-6 space-y-6",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Settings"}),c.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Signed in as ",c.jsx("span",{className:"font-medium text-foreground",children:e})]})]}),c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"text-base font-medium flex items-center gap-2",children:[c.jsx(v7,{className:"h-4 w-4"}),"Software Update"]}),c.jsx("p",{className:"text-sm text-muted-foreground",children:d?c.jsxs(c.Fragment,{children:["Running ",c.jsxs("span",{className:"font-mono font-medium text-foreground",children:["v",d.currentVersion]})]}):"Check for the latest Jait version."})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsxs(Ee,{variant:"outline",size:"sm",onClick:y,disabled:h||v,children:[h?c.jsx(bt,{className:"h-4 w-4 animate-spin mr-1.5"}):null,h?"Checking...":"Check for updates"]}),(d==null?void 0:d.hasUpdate)&&c.jsxs(c.Fragment,{children:[c.jsxs(Ee,{size:"sm",onClick:p,disabled:v,children:[v?c.jsx(bt,{className:"h-4 w-4 animate-spin mr-1.5"}):c.jsx(m5,{className:"h-4 w-4 mr-1.5"}),v?"Updating...":`Update gateway to v${d.latestVersion}`]}),b!=="web"&&c.jsx(Ee,{size:"sm",variant:"outline",asChild:!0,children:c.jsxs("a",{href:"https://github.com/JakobWl/Jait/releases/latest",target:"_blank",rel:"noopener noreferrer",children:[c.jsx(m5,{className:"h-4 w-4 mr-1.5"}),"Download latest ",b==="capacitor"?"APK":"desktop app"]})})]})]}),d&&!d.hasUpdate&&c.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-1.5",children:[c.jsx(ii,{className:"h-3.5 w-3.5"}),"You're on the latest version."]}),(d==null?void 0:d.hasUpdate)&&c.jsxs("p",{className:"text-sm text-amber-600 dark:text-amber-400 flex items-center gap-1.5",children:[c.jsx(no,{className:"h-3.5 w-3.5"}),"Version ",d.latestVersion," is available",b!=="web"?" — download from jait.dev":"","."]})]}),c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"text-base font-medium flex items-center gap-2",children:[c.jsx(rr,{className:"h-4 w-4"}),"Gateway connection"]}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure the IP address or domain of your Jait gateway. Leave empty to use the default."})]}),c.jsxs("div",{className:"max-w-md space-y-2",children:[c.jsx(Xt,{htmlFor:"gateway-url",className:"mb-1.5 block",children:"Gateway URL"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(xr,{id:"gateway-url",type:"url",value:F,onChange:T=>{V(T.target.value),L("idle")},placeholder:cn(),className:"font-mono text-sm"}),c.jsx(Ee,{variant:"outline",onClick:()=>{B(F)},disabled:W==="testing",className:"shrink-0",children:W==="testing"?c.jsx(bt,{className:"h-4 w-4 animate-spin"}):"Test & save"})]}),W==="ok"&&c.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-1",children:[c.jsx(ii,{className:"h-3.5 w-3.5"}),F.trim()?"Connected — gateway URL saved.":"Reset to default."]}),W==="error"&&O&&c.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[c.jsx(no,{className:"h-3.5 w-3.5"}),O]}),c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Current: ",c.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-[11px]",children:cn()}),ha()&&c.jsx("button",{type:"button",className:"ml-2 text-xs underline text-muted-foreground hover:text-foreground",onClick:()=>{V(""),mg(null),L("idle")},children:"Reset to default"})]})]})]}),c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Session archive"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Permanently remove archived sessions and their messages from your account."})]}),c.jsx("div",{children:c.jsx(Ee,{variant:"destructive",onClick:()=>{M()},disabled:E,children:E?"Clearing...":"Clear archived sessions"})})]}),c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Spracheingabe (Speech-to-Text)"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Wähle aus, wie gesprochene Sprache in Text umgewandelt wird, bevor sie als Nachricht gesendet wird."})]}),c.jsxs("div",{className:"max-w-sm",children:[c.jsx(Xt,{htmlFor:"stt-provider",className:"mb-1.5 block",children:"STT-Anbieter"}),c.jsxs(gg,{value:i,onValueChange:T=>{o(T)},children:[c.jsx(Yf,{id:"stt-provider",children:c.jsx(yg,{placeholder:"STT-Anbieter wählen"})}),c.jsxs(Xf,{children:[c.jsx(zc,{value:"simulated",children:"Simuliert (Eingabe-Prompt)"}),c.jsx(zc,{value:"browser",children:"Browser (Web Speech API)"})]})]})]})]}),c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"API keys and provider settings"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Values stored here are user-specific and override environment defaults for your account."})]}),c.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:wce.map(T=>{const ie=Cce(T),oe=jce(T),te=!!D[T];return c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[ie?c.jsx(ie,{size:14,className:"shrink-0 text-muted-foreground"}):c.jsx(ER,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsx(Xt,{htmlFor:`api-${T}`,className:"font-mono text-xs",children:T}),Q(T)]}),c.jsxs("div",{className:"relative",children:[c.jsx(xr,{id:`api-${T}`,type:oe&&!te?"password":"text",value:w[T]??"",onChange:re=>{const J=re.target.value;S(Y=>({...Y,[T]:J}))},placeholder:X[T]?"(set via .env)":"(empty)",className:oe?"pr-9":""}),oe&&c.jsx("button",{type:"button",className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",onClick:()=>U(T),tabIndex:-1,"aria-label":te?"Hide value":"Show value",children:te?c.jsx(Mf,{className:"h-4 w-4"}):c.jsx(Ec,{className:"h-4 w-4"})})]})]},T)})}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(Ee,{onClick:()=>{A()},disabled:C,children:C?"Saving...":"Save API settings"}),P&&c.jsx("span",{className:"text-sm text-muted-foreground",children:P})]}),R&&c.jsx("p",{className:"text-sm text-destructive",children:R})]}),c.jsx(woe,{token:t}),u&&u.length>0&&c.jsxs(Ui,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Recent activity"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Recent chat messages and terminal sessions."})]}),c.jsx(Soe,{events:u})]})]})}const Ql=cn();function Oce(e){const[t,n]=g.useState([]),[r,i]=g.useState(null),[o,a]=g.useState([]),[u,d]=g.useState(!1),[h,y]=g.useState(null),p=g.useRef(null),v=g.useCallback(()=>{const I={"Content-Type":"application/json"};return e&&(I.Authorization=`Bearer ${e}`),I},[e]),b=g.useCallback(async()=>{try{const I=await fetch(`${Ql}/api/network/interfaces`,{headers:v()});if(I.ok){const R=await I.json();n(R.interfaces)}}catch(I){y(I instanceof Error?I.message:"Failed to fetch interfaces")}},[v]),w=g.useCallback(async()=>{try{const I=await fetch(`${Ql}/api/network/scan/latest`,{headers:v()});if(I.ok){const R=await I.json();R.hosts&&i(R)}}catch{}},[v]),S=g.useCallback(async I=>{var R;d(!0),y(null),(R=p.current)==null||R.abort(),p.current=new AbortController;try{const $=await fetch(`${Ql}/api/network/scan`,{method:"POST",headers:v(),body:JSON.stringify({subnet:I}),signal:p.current.signal});if(!$.ok)throw new Error(`Scan failed: ${$.status}`);const X=await $.json();return i(X),X}catch($){return $.name!=="AbortError"&&y($ instanceof Error?$.message:"Scan failed"),null}finally{d(!1)}},[v]),C=g.useCallback(async(I,R=22)=>{try{const $=await fetch(`${Ql}/api/network/ssh/test`,{method:"POST",headers:v(),body:JSON.stringify({ip:I,port:R})});return $.ok?await $.json():null}catch{return null}},[v]),j=g.useCallback(async I=>{try{const R=await fetch(`${Ql}/api/network/ssh/enable`,{method:"POST",headers:v(),body:JSON.stringify({platform:I})});return R.ok?await R.json():null}catch{return null}},[v]),E=g.useCallback(async(I,R,$="password")=>{try{const X=await fetch(`${Ql}/api/network/deploy`,{method:"POST",headers:v(),body:JSON.stringify({ip:I,username:R,authMethod:$})});return X.ok?await X.json():null}catch{return null}},[v]),N=g.useCallback(async()=>{try{const I=await fetch(`${Ql}/api/network/nodes`,{headers:v()});if(I.ok){const R=await I.json();a(R.nodes)}}catch{}},[v]),P=g.useCallback(()=>{var I;(I=p.current)==null||I.abort(),d(!1)},[]);return{interfaces:t,scanResult:r,nodes:o,scanning:u,error:h,fetchInterfaces:b,fetchLatestScan:w,scan:S,testSsh:C,getSshEnableInfo:j,deploy:E,fetchNodes:N,cancelScan:P}}function Nce({iface:e}){return c.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 rounded-md bg-muted/50 text-sm",children:[c.jsx(x7,{className:"h-4 w-4 text-muted-foreground shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("div",{className:"font-medium truncate",children:e.name}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.ip," / ",e.netmask]})]}),c.jsx("code",{className:"text-xs text-muted-foreground",children:e.mac})]})}function Tce({host:e,onTestSsh:t,onDeploy:n,onSshEnable:r}){const i=e.agentStatus==="running";return c.jsxs("div",{className:"border rounded-lg p-3 flex flex-col gap-2.5 hover:bg-muted/30 transition-colors",children:[c.jsxs("div",{className:"flex items-start gap-2.5",children:[c.jsx("div",{className:`h-9 w-9 rounded-lg flex items-center justify-center shrink-0 ${i?"bg-green-500/15 text-green-500":"bg-muted text-muted-foreground"}`,children:i?c.jsx(bi,{className:"h-4.5 w-4.5"}):c.jsx(aa,{className:"h-4.5 w-4.5"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"font-medium text-sm truncate",children:e.hostname||e.ip}),e.hostname&&c.jsx("div",{className:"text-xs text-muted-foreground font-mono",children:e.ip})]})]}),c.jsxs("div",{className:"flex flex-wrap gap-1",children:[i&&c.jsx(Rt,{variant:"default",className:"bg-green-600 text-[10px] h-5",children:"Gateway"}),e.agentStatus==="installed"&&c.jsx(Rt,{variant:"secondary",className:"text-[10px] h-5",children:"Installed"}),e.sshReachable?c.jsxs(Rt,{variant:"secondary",className:"text-[10px] h-5 gap-1",children:[c.jsx(Wf,{className:"h-2.5 w-2.5"})," SSH"]}):c.jsxs(Rt,{variant:"outline",className:"text-[10px] h-5 gap-1 text-muted-foreground",children:[c.jsx(Wf,{className:"h-2.5 w-2.5"})," No SSH"]}),e.openPorts.length>0&&c.jsxs(Rt,{variant:"outline",className:"text-[10px] h-5 text-muted-foreground",children:[e.openPorts.length," ",e.openPorts.length===1?"port":"ports"]})]}),c.jsxs("div",{className:"text-[11px] text-muted-foreground space-y-0.5",children:[e.mac&&c.jsxs("div",{children:["MAC: ",c.jsx("span",{className:"font-mono",children:e.mac})]}),e.openPorts.length>0&&c.jsxs("div",{children:["Ports: ",c.jsx("span",{className:"font-mono",children:e.openPorts.join(", ")})]}),c.jsxs("div",{children:["Seen: ",new Date(e.lastSeen).toLocaleTimeString()]})]}),c.jsxs("div",{className:"flex flex-wrap gap-1.5 pt-0.5",children:[c.jsxs(Ee,{size:"sm",variant:"outline",className:"h-6 text-[11px] px-2",onClick:()=>t(e.ip),children:[c.jsx(oa,{className:"h-3 w-3 mr-1"}),"Test SSH"]}),!e.sshReachable&&c.jsxs(Ee,{size:"sm",variant:"outline",className:"h-6 text-[11px] px-2",onClick:()=>r(e.ip),children:[c.jsx(Wf,{className:"h-3 w-3 mr-1"}),"Enable SSH"]}),e.sshReachable&&e.agentStatus!=="running"&&c.jsxs(Ee,{size:"sm",variant:"default",className:"h-6 text-[11px] px-2",onClick:()=>n(e.ip),children:[c.jsx(E7,{className:"h-3 w-3 mr-1"}),"Deploy"]}),i&&c.jsx(Ee,{size:"sm",variant:"secondary",className:"h-6 text-[11px] px-2",asChild:!0,children:c.jsxs("a",{href:`http://${e.ip}:8000`,target:"_blank",rel:"noopener noreferrer",children:[c.jsx(rr,{className:"h-3 w-3 mr-1"}),"Dashboard"]})})]})]})}function Pce({node:e}){const t={online:"bg-green-500",offline:"bg-red-500",degraded:"bg-yellow-500"}[e.status];return c.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-md border text-sm",children:[c.jsx(bi,{className:"h-4 w-4 text-primary shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:e.hostname??e.ip}),c.jsx("span",{className:`h-2 w-2 rounded-full ${t}`})]}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.ip," · v",e.version," · ",e.platform]})]}),c.jsx(Rt,{variant:"outline",className:"text-[10px]",children:e.status})]})}function Ace({open:e,onOpenChange:t,result:n,testing:r}){return c.jsx(Wc,{open:e,onOpenChange:t,children:c.jsxs(ba,{className:"sm:max-w-md",children:[c.jsxs(dl,{children:[c.jsx(hl,{children:"SSH Connection Test"}),c.jsx(ua,{children:(n==null?void 0:n.ip)??"Testing..."})]}),r?c.jsxs("div",{className:"flex items-center gap-3 py-4",children:[c.jsx(bt,{className:"h-5 w-5 animate-spin"}),c.jsx("span",{children:"Testing SSH connection..."})]}):n?c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[n.reachable?c.jsx(ii,{className:"h-5 w-5 text-green-500"}):c.jsx(to,{className:"h-5 w-5 text-red-500"}),c.jsx("span",{className:"font-medium",children:n.reachable?"SSH is reachable":"SSH is not reachable"})]}),n.authMethods.length>0&&c.jsxs("div",{className:"text-sm",children:[c.jsx("div",{className:"text-muted-foreground mb-1",children:"Auth methods:"}),c.jsx("div",{className:"flex gap-1.5",children:n.authMethods.map(i=>c.jsx(Rt,{variant:"secondary",className:"text-xs",children:i},i))})]}),n.platform&&c.jsxs("div",{className:"text-sm",children:[c.jsx("div",{className:"text-muted-foreground mb-1",children:"SSH Banner:"}),c.jsx("code",{className:"text-xs bg-muted px-2 py-1 rounded block",children:n.platform})]}),n.error&&c.jsx("div",{className:"text-sm text-red-500",children:n.error})]}):null]})})}function Rce({open:e,onOpenChange:t,info:n,loading:r}){const i=()=>{n!=null&&n.command&&navigator.clipboard.writeText(n.command)};return c.jsx(Wc,{open:e,onOpenChange:t,children:c.jsxs(ba,{className:"sm:max-w-lg",children:[c.jsxs(dl,{children:[c.jsx(hl,{children:"Enable SSH"}),c.jsx(ua,{children:"Instructions for enabling SSH on the target machine"})]}),r?c.jsxs("div",{className:"flex items-center gap-3 py-4",children:[c.jsx(bt,{className:"h-5 w-5 animate-spin"}),c.jsx("span",{children:"Loading instructions..."})]}):n?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsxs(Xt,{className:"text-xs text-muted-foreground mb-1 block",children:["Platform: ",n.platform]}),c.jsxs("div",{className:"relative",children:[c.jsx("pre",{className:"bg-muted text-xs p-3 rounded-md overflow-x-auto",children:n.command}),c.jsx(Ee,{size:"sm",variant:"ghost",className:"absolute top-1 right-1 h-6 w-6 p-0",onClick:i,children:c.jsx(n1,{className:"h-3 w-3"})})]})]}),c.jsxs("div",{children:[c.jsx(Xt,{className:"text-xs text-muted-foreground mb-2 block",children:"Steps:"}),c.jsx("ol",{className:"space-y-1.5 text-sm list-decimal list-inside",children:n.steps.map((o,a)=>c.jsx("li",{className:"text-muted-foreground",children:c.jsx("span",{className:"text-foreground",children:o})},a))})]})]}):null]})})}function Mce({open:e,onOpenChange:t,targetIp:n,onDeploy:r,result:i,deploying:o}){const[a,u]=g.useState(""),[d,h]=g.useState("key"),y=()=>{i!=null&&i.deployScript&&navigator.clipboard.writeText(i.deployScript)};return c.jsx(Wc,{open:e,onOpenChange:t,children:c.jsxs(ba,{className:"sm:max-w-lg",children:[c.jsxs(dl,{children:[c.jsx(hl,{children:"Deploy Jait Gateway"}),c.jsxs(ua,{children:["Install and configure a Jait Gateway node on ",n]})]}),i?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[c.jsx(ii,{className:"h-4 w-4"}),"Deployment script generated"]}),c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-1",children:[c.jsx(Xt,{className:"text-xs text-muted-foreground",children:"Deployment Script"}),c.jsxs(Ee,{size:"sm",variant:"ghost",className:"h-6 text-xs",onClick:y,children:[c.jsx(n1,{className:"h-3 w-3 mr-1"}),"Copy"]})]}),c.jsx("pre",{className:"bg-muted text-xs p-3 rounded-md overflow-auto max-h-48",children:i.deployScript})]}),c.jsxs("div",{children:[c.jsx(Xt,{className:"text-xs text-muted-foreground mb-2 block",children:"Steps:"}),c.jsx("ol",{className:"space-y-1 text-sm list-decimal list-inside",children:i.instructions.map((p,v)=>c.jsx("li",{children:p},v))})]}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:["Estimated time: ",i.estimatedDuration]})]}):c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx(Xt,{htmlFor:"deploy-user",className:"text-sm",children:"SSH Username"}),c.jsx(xr,{id:"deploy-user",value:a,onChange:p=>u(p.target.value),placeholder:"e.g. pi, ubuntu, admin",className:"mt-1"})]}),c.jsxs("div",{children:[c.jsx(Xt,{className:"text-sm mb-2 block",children:"Authentication"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(Ee,{size:"sm",variant:d==="key"?"default":"outline",onClick:()=>h("key"),className:"text-xs",children:"SSH Key"}),c.jsx(Ee,{size:"sm",variant:d==="password"?"default":"outline",onClick:()=>h("password"),className:"text-xs",children:"Password"})]})]}),c.jsx(Ee,{onClick:()=>r(a,d),disabled:!a.trim()||o,className:"w-full",children:o?c.jsxs(c.Fragment,{children:[c.jsx(bt,{className:"h-4 w-4 mr-2 animate-spin"}),"Preparing deployment..."]}):c.jsxs(c.Fragment,{children:[c.jsx(E7,{className:"h-4 w-4 mr-2"}),"Deploy Gateway"]})})]})]})})}function Dce({token:e}){const{interfaces:t,scanResult:n,nodes:r,scanning:i,error:o,fetchInterfaces:a,fetchLatestScan:u,scan:d,testSsh:h,getSshEnableInfo:y,deploy:p,fetchNodes:v,cancelScan:b}=Oce(e),[w,S]=g.useState(!1),[C,j]=g.useState(null),[E,N]=g.useState(!1),[P,I]=g.useState(!1),[R,$]=g.useState(null),[X,G]=g.useState(!1),[D,q]=g.useState(!1),[F,V]=g.useState(""),[W,L]=g.useState(null),[O,H]=g.useState(!1);g.useEffect(()=>{a(),v(),u()},[a,v,u]);const B=g.useCallback(()=>{d()},[d]),U=g.useCallback(async ie=>{j(null),N(!0),S(!0);const oe=await h(ie);j(oe),N(!1)},[h]),A=g.useCallback(async ie=>{$(null),G(!0),I(!0);const oe=await y("windows");$(oe),G(!1)},[y]),M=g.useCallback(ie=>{V(ie),L(null),q(!0)},[]),Q=g.useCallback(async(ie,oe)=>{H(!0);const te=await p(F,ie,oe);L(te),H(!1)},[p,F]),T=(()=>{const ie=new Set;return n==null||n.hosts.forEach(oe=>ie.add(oe.ip)),r.forEach(oe=>ie.add(oe.ip)),ie.size})();return c.jsxs("div",{className:"h-full flex flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(h2,{className:"h-4 w-4 text-primary"}),c.jsx("h2",{className:"text-sm font-semibold",children:"Network"}),T>0&&c.jsxs(Rt,{variant:"secondary",className:"text-[10px]",children:[T," ",T===1?"device":"devices"]})]}),c.jsx("div",{className:"flex items-center gap-1.5",children:i?c.jsxs(Ee,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:b,children:[c.jsx(to,{className:"h-3 w-3 mr-1"}),"Cancel"]}):c.jsx(Ee,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:B,children:n?c.jsxs(c.Fragment,{children:[c.jsx(Ah,{className:"h-3 w-3 mr-1"}),"Rescan"]}):c.jsxs(c.Fragment,{children:[c.jsx(Eg,{className:"h-3 w-3 mr-1"}),"Discover Devices"]})})})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-5",children:[o&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-red-500 bg-red-500/10 rounded-md px-3 py-2",children:[c.jsx(VR,{className:"h-4 w-4 shrink-0"}),o]}),i&&c.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[c.jsx(bt,{className:"h-8 w-8 animate-spin text-primary"}),c.jsx("div",{className:"text-sm text-muted-foreground",children:"Discovering devices — this may take 30-60 seconds..."}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"Probing ARP table, common ports (22, 80, 443, 8000, 8080)"})]}),r.length>0&&c.jsxs("section",{children:[c.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Jait Gateway Nodes"}),c.jsx("div",{className:"space-y-1.5",children:r.map(ie=>c.jsx(Pce,{node:ie},ie.id))})]}),!i&&n&&c.jsxs("section",{children:[c.jsxs("div",{className:"flex items-center justify-between mb-2",children:[c.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Discovered Devices"}),c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[n.hosts.length," ",n.hosts.length===1?"device":"devices"," · ",n.subnet," · ",(n.durationMs/1e3).toFixed(1),"s"]})]}),n.hosts.length===0?c.jsx("div",{className:"text-center py-8 text-sm text-muted-foreground",children:"No devices found. Try rescanning or check your network connection."}):c.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-2",children:n.hosts.map(ie=>c.jsx(Tce,{host:ie,onTestSsh:U,onDeploy:M,onSshEnable:A},ie.ip))})]}),!i&&!n&&!o&&r.length===0&&c.jsxs("div",{className:"flex flex-col items-center gap-3 py-12 text-center",children:[c.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:c.jsx(aa,{className:"h-6 w-6 text-muted-foreground"})}),c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-medium",children:"Discover devices"}),c.jsx("div",{className:"text-xs text-muted-foreground mt-1 max-w-xs",children:"Scan your local network to find devices, test SSH connectivity, and deploy Jait Gateway to other machines."})]}),c.jsxs(Ee,{size:"sm",onClick:B,className:"mt-2",children:[c.jsx(Eg,{className:"h-3.5 w-3.5 mr-1.5"}),"Discover Devices"]})]}),t.length>0&&c.jsxs("section",{className:"pt-2 border-t",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground mb-2",children:[c.jsx(x7,{className:"h-3 w-3"}),c.jsx("span",{className:"uppercase tracking-wider font-medium",children:"Network Interfaces"}),c.jsxs("span",{className:"text-[10px] ml-1",children:["(",t.filter(ie=>!ie.internal).length,")"]})]}),c.jsx("div",{className:"space-y-1.5",children:t.filter(ie=>!ie.internal).map(ie=>c.jsx(Nce,{iface:ie},ie.name+ie.ip))})]})]}),c.jsx(Ace,{open:w,onOpenChange:S,result:C,testing:E}),c.jsx(Rce,{open:P,onOpenChange:I,info:R,loading:X}),c.jsx(Mce,{open:D,onOpenChange:q,targetIp:F,onDeploy:Q,result:W,deploying:O})]})}function Lce({platform:e,className:t}){switch(e){case"electron":return c.jsx(aa,{className:t??"h-4 w-4"});case"react-native":return c.jsx(k7,{className:t??"h-4 w-4"});default:return c.jsx(rr,{className:t??"h-4 w-4"})}}function sj({device:e,isLocal:t,isConnected:n,isLoading:r,onConnect:i}){const o=!t&&e.capabilities.includes("screen-share");return c.jsxs("div",{className:`flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm transition-colors
|
|
673
673
|
${n?"bg-green-500/10 border border-green-500/30":"bg-muted/50 hover:bg-muted/80"}`,children:[c.jsx("div",{className:`h-9 w-9 rounded-lg flex items-center justify-center shrink-0
|
|
674
674
|
${n?"bg-green-500/15 text-green-500":t?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:c.jsx(Lce,{platform:e.platform,className:"h-4.5 w-4.5"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"font-medium truncate text-[13px]",children:[e.name,t&&c.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(you)"})]}),c.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5",children:[e.platform,n&&c.jsx("span",{className:"text-green-500 ml-1",children:"· connected"})]})]}),o&&!n&&c.jsx(Ee,{size:"sm",variant:"outline",className:"h-7 text-xs px-2.5 shrink-0",onClick:i,disabled:r,children:r?c.jsx(bt,{className:"h-3 w-3 animate-spin"}):c.jsxs(c.Fragment,{children:[c.jsx($R,{className:"h-3 w-3 mr-1"}),"Connect"]})}),n&&c.jsxs(Rt,{className:"bg-green-500/15 text-green-500 border-green-500/30 shrink-0 text-[10px]",children:[c.jsx(zR,{className:"h-2.5 w-2.5 mr-0.5"})," live"]})]})}function zce({stream:e}){const t=g.useRef(null),n=g.useRef(null),[r,i]=g.useState(!1);g.useEffect(()=>{console.log(`[screen-share] RemoteScreen: stream=${!!e} tracks=${e==null?void 0:e.getTracks().map(a=>`${a.kind}:${a.readyState}`).join(",")} videoRef=${!!t.current}`),t.current&&e&&(t.current.srcObject=e)},[e]);const o=g.useCallback(()=>{const a=n.current;a&&(document.fullscreenElement?(document.exitFullscreen(),i(!1)):(a.requestFullscreen(),i(!0)))},[]);return g.useEffect(()=>{const a=()=>i(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",a),()=>document.removeEventListener("fullscreenchange",a)},[]),e?c.jsxs("div",{ref:n,className:"relative flex-1 group bg-black rounded-lg overflow-hidden",children:[c.jsx("video",{ref:t,autoPlay:!0,playsInline:!0,muted:!0,className:"w-full h-full object-contain bg-black"}),c.jsx("button",{onClick:o,className:"absolute top-2 right-2 p-1.5 rounded bg-black/60 text-white opacity-0 group-hover:opacity-100 transition-opacity",children:r?c.jsx(RR,{className:"h-3.5 w-3.5"}):c.jsx(PR,{className:"h-3.5 w-3.5"})})]}):c.jsx("div",{className:"flex-1 bg-black/20 rounded-lg flex items-center justify-center text-muted-foreground",children:c.jsxs("div",{className:"text-center",children:[c.jsx(DR,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),c.jsx("p",{className:"text-sm font-medium",children:"Waiting for remote screen…"}),c.jsx("p",{className:"text-xs mt-1 opacity-60",children:"The remote device is preparing to share"})]})})}function $ce({screenShare:e}){var o;const t=e.session,n=e.isViewer||e.isHost;console.log(`[screen-share] Panel render: isHost=${e.isHost} isViewer=${e.isViewer} isConnected=${n} remoteStream=${!!e.remoteStream} localStream=${!!e.localStream}`);const r=e.devices.filter(a=>a.id!==e.localDeviceId),i=e.devices.find(a=>a.id===e.localDeviceId);return c.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.pendingShareRequest&&!n&&c.jsx("div",{className:"p-3 border-b bg-amber-500/5",children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"h-9 w-9 rounded-lg bg-amber-500/15 text-amber-500 flex items-center justify-center shrink-0 mt-0.5",children:c.jsx(_5,{className:"h-4.5 w-4.5"})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"text-sm font-medium",children:"Screen share requested"}),c.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"A remote device wants to view your screen."}),c.jsxs("div",{className:"flex gap-2 mt-2",children:[c.jsxs(Ee,{size:"sm",className:"h-7 text-xs px-3",onClick:()=>e.acceptPendingShare(),children:[c.jsx(_5,{className:"h-3 w-3 mr-1"}),"Share Screen"]}),c.jsx(Ee,{size:"sm",variant:"ghost",className:"h-7 text-xs px-2 text-muted-foreground",onClick:()=>e.rejectPendingShare(),children:"Decline"})]})]})]})}),n?c.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b bg-muted/20 shrink-0",children:[c.jsxs(Rt,{className:"bg-green-500/15 text-green-500 border-green-500/30 text-[10px]",children:[c.jsx(h2,{className:"h-2.5 w-2.5 mr-1"})," Live"]}),c.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:e.connectedDeviceId?((o=e.devices.find(a=>a.id===e.connectedDeviceId))==null?void 0:o.name)??e.connectedDeviceId:"Connected"}),t&&c.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[t.transport.routeMode.toUpperCase()," · ",t.transport.avgLatencyMs,"ms"]}),c.jsxs(Ee,{variant:"ghost",size:"sm",className:"h-6 text-xs px-2 text-destructive hover:text-destructive",onClick:()=>e.disconnect(),children:[c.jsx(Sr,{className:"h-3 w-3 mr-1"}),"Disconnect"]})]}),e.error&&c.jsx("div",{className:"mx-2 p-2 rounded-md bg-red-500/10 text-red-500 text-xs border border-red-500/20",children:e.error}),e.isHost?c.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:c.jsxs("div",{className:"text-center",children:[c.jsx(Vf,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),c.jsx("p",{className:"text-sm font-medium",children:"Sharing your screen"}),c.jsx("p",{className:"text-xs mt-1 opacity-60",children:"A remote device is viewing this screen"}),t&&c.jsxs("p",{className:"text-xs mt-2 opacity-50",children:[c.jsx(K_,{className:"h-3 w-3 inline mr-0.5"}),t.viewers.length," viewer",t.viewers.length!==1?"s":""]})]})}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"flex-1 min-h-0 p-2",children:c.jsx(zce,{stream:e.remoteStream})}),t&&c.jsxs("div",{className:"flex items-center gap-3 px-3 py-1.5 border-t text-[10px] text-muted-foreground shrink-0",children:[c.jsxs("span",{children:["Session ",t.id.slice(0,8)]}),c.jsx("span",{children:"·"}),c.jsxs("span",{children:["ICE: ",t.transport.iceConnectionState]}),c.jsx("span",{children:"·"}),c.jsxs("span",{children:[c.jsx(K_,{className:"h-2.5 w-2.5 inline mr-0.5"}),t.viewers.length," viewer",t.viewers.length!==1?"s":""]})]})]})]}):c.jsxs("div",{className:"flex flex-col gap-3 p-3 overflow-y-auto",children:[e.error&&c.jsx("div",{className:"p-2.5 rounded-md bg-red-500/10 text-red-500 text-xs border border-red-500/20",children:e.error}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Remote Devices"}),c.jsx(Ee,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>e.refreshState(),children:c.jsx(Ah,{className:"h-3 w-3"})})]}),r.length===0?c.jsxs("div",{className:"py-6 text-center",children:[c.jsx(Vf,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/40"}),c.jsx("p",{className:"text-xs text-muted-foreground font-medium",children:"No remote devices found"}),c.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1 max-w-[200px] mx-auto",children:"Open Jait on another device (desktop app or mobile) to connect to it"})]}):c.jsx("div",{className:"space-y-1.5",children:r.map(a=>c.jsx(sj,{device:a,isLocal:!1,isConnected:!1,isLoading:e.loading&&e.connectedDeviceId===a.id,onConnect:()=>e.requestRemoteShare(a.id)},a.id))})]}),i&&c.jsxs("div",{className:"space-y-1.5",children:[c.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"This Device"}),c.jsx(sj,{device:i,isLocal:!0,isConnected:!1,isLoading:!1,onConnect:()=>{}})]}),c.jsxs("div",{className:"px-2 py-2 rounded-md bg-muted/30 text-[11px] text-muted-foreground",children:[c.jsx("strong",{children:"Tip:"})," Ask your agent to connect to a device — e.g. “Show me my desktop screen”"]})]})]})}const kf=cn(),Ice=Kh(),aT="jait-screen-share-auto-approve";function cT(){try{const e=localStorage.getItem(aT);return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}function Bce(e){const t=cT();t.add(e),localStorage.setItem(aT,JSON.stringify([...t]))}function Kg(){return typeof window<"u"&&window.jaitDesktop?"electron":typeof window<"u"&&"Capacitor"in window?"react-native":"web"}function Hce(){const e=Kg(),t=`jait-device-id-${e}`,n=localStorage.getItem(t);if(n)return n;const r=`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return localStorage.setItem(t,r),r}function Fce(){const e=Kg(),t=navigator.userAgent;return e==="electron"?`Jait Desktop (${navigator.platform})`:e==="react-native"?"Jait Mobile":t.includes("Chrome")?`Chrome (${navigator.platform})`:t.includes("Firefox")?`Firefox (${navigator.platform})`:t.includes("Safari")?`Safari (${navigator.platform})`:`Browser (${navigator.platform})`}const Uce=[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"}];function Vce(e={}){const{token:t}=e,[n,r]=g.useState({session:null,devices:[],localDeviceId:null,isHost:!1,isViewer:!1,isActive:!1,loading:!1,error:null,connectedDeviceId:null,pendingShareRequest:null}),i=g.useRef(null),o=g.useRef(null),a=g.useRef(null),u=g.useRef(null),d=g.useRef(Hce()),h=g.useRef(null),y=g.useCallback(()=>{const P={"Content-Type":"application/json"};return t&&(P.Authorization=`Bearer ${t}`),P},[t]),p=g.useCallback(async()=>{const P=d.current,I=Kg(),R=Fce(),$=["screen-view"];I==="electron"&&$.push("screen-share","remote-input"),I==="web"&&$.push("screen-share"),I==="react-native"&&$.push("screen-share");try{(await fetch(`${kf}/api/screen-share/devices/register`,{method:"POST",headers:y(),body:JSON.stringify({id:P,name:R,platform:I,capabilities:$})})).ok&&r(G=>({...G,localDeviceId:P}))}catch(X){console.error("Failed to register screen-share device:",X)}},[y]),v=g.useCallback(async()=>{try{const P=await fetch(`${kf}/api/screen-share/state`,{headers:y()});if(!P.ok)return;const I=await P.json();r(R=>{var $;return{...R,session:I.activeSession??R.session,devices:I.devices,isActive:(($=I.activeSession)==null?void 0:$.status)==="sharing"}})}catch(P){console.error("Failed to refresh screen-share state:",P)}},[y]),b=g.useCallback((P,I,R)=>{var X;console.log(`[screen-share] setupPeerConnection: isHost=${I} session=${R.slice(0,8)} prevPC=${!!i.current} stream=${!!P} device=${d.current}`),(X=i.current)==null||X.close();const $=new RTCPeerConnection({iceServers:Uce});if(i.current=$,I&&P){const G=P.getTracks();console.log(`[screen-share] Adding ${G.length} track(s):`,G.map(D=>`${D.kind}:${D.label}:${D.readyState}`)),G.forEach(D=>$.addTrack(D,P))}if($.ontrack=G=>{const[D]=G.streams;console.log(`[screen-share] ontrack: streams=${G.streams.length} tracks=${D==null?void 0:D.getTracks().map(q=>`${q.kind}:${q.readyState}`).join(",")}`),D&&(a.current=D,console.log("[screen-share] remoteStreamRef set, triggering re-render"),r(q=>({...q})))},$.onicecandidate=G=>{var D;G.candidate&&((D=u.current)==null?void 0:D.readyState)===WebSocket.OPEN&&u.current.send(JSON.stringify({type:"screen-share:ice-candidate",payload:{sessionId:R,fromDeviceId:d.current,candidate:G.candidate.candidate,sdpMid:G.candidate.sdpMid,sdpMLineIndex:G.candidate.sdpMLineIndex}}))},$.oniceconnectionstatechange=()=>{console.log("[screen-share] ICE state:",$.iceConnectionState),($.iceConnectionState==="disconnected"||$.iceConnectionState==="failed")&&r(G=>({...G,error:`Connection ${$.iceConnectionState}`}))},I&&$.createOffer().then(G=>{var D;$.setLocalDescription(G),console.log("[screen-share] Sending offer via WS"),(D=u.current)==null||D.send(JSON.stringify({type:"screen-share:offer",payload:{sessionId:R,hostDeviceId:d.current,sdp:G.sdp}}))}),!I&&h.current){const G=h.current;h.current=null,console.log("[screen-share] Processing queued offer"),$.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:G.sdp})).then(()=>$.createAnswer()).then(D=>{var q;$.setLocalDescription(D),(q=u.current)==null||q.send(JSON.stringify({type:"screen-share:answer",payload:{sessionId:G.sessionId,viewerDeviceId:d.current,sdp:D.sdp}}))}).catch(D=>console.error("[screen-share] Failed to process queued offer:",D))}},[]),w=g.useCallback(async P=>{var I,R;r($=>({...$,loading:!0,error:null}));try{let $;if(!((I=navigator.mediaDevices)!=null&&I.getDisplayMedia))throw new Error("Screen sharing is not supported on this device. Use a desktop browser or the Electron app.");if(console.log("[screen-share] Requesting screen capture via getDisplayMedia..."),$=await navigator.mediaDevices.getDisplayMedia({video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:15,max:30}},audio:!1}),console.log("[screen-share] Screen capture obtained:",(R=$.getVideoTracks()[0])==null?void 0:R.label),o.current=$,!P){await p();const X=await fetch(`${kf}/api/screen-share/start`,{method:"POST",headers:y(),body:JSON.stringify({hostDeviceId:d.current})});if(!X.ok){const D=await X.json();throw new Error(D.error)}const G=await X.json();P=G.session.id,r(D=>({...D,session:G.session}))}r(X=>({...X,isHost:!0,isViewer:!1,isActive:!0,loading:!1})),console.log("[screen-share] Host capturing — setting up peer connection for session:",P),b($,!0,P??"")}catch($){console.error("[screen-share] Capture failed:",$),r(X=>({...X,loading:!1,isHost:!1,error:$ instanceof Error?$.message:"Failed to start screen capture"}))}},[p,y,b]),S=g.useCallback(async P=>{r(I=>({...I,loading:!0,error:null,connectedDeviceId:P}));try{await p();const I=await fetch(`${kf}/api/screen-share/start`,{method:"POST",headers:y(),body:JSON.stringify({hostDeviceId:P,viewerDeviceIds:[d.current]})});if(!I.ok){const $=await I.json();throw new Error($.error)}const{session:R}=await I.json();r($=>({...$,session:R,isViewer:!0,isActive:!0,loading:!1})),console.log(`[screen-share] requestRemoteShare: HTTP done, session=${R.id.slice(0,8)} pcRef=${!!i.current}`),i.current?console.log("[screen-share] requestRemoteShare: PC already exists, skipping creation"):(console.log("[screen-share] requestRemoteShare: creating viewer PC (no WS-created PC yet)"),b(null,!1,R.id))}catch(I){r(R=>({...R,loading:!1,connectedDeviceId:null,error:I instanceof Error?I.message:"Failed to connect to remote device"}))}},[p,y,b]),C=g.useCallback(async()=>{var P,I;(P=o.current)==null||P.getTracks().forEach(R=>R.stop()),o.current=null,a.current=null,(I=i.current)==null||I.close(),i.current=null;try{await fetch(`${kf}/api/screen-share/stop`,{method:"POST",headers:y(),body:JSON.stringify({})})}catch{}r(R=>({...R,session:null,isHost:!1,isViewer:!1,isActive:!1,connectedDeviceId:null,pendingShareRequest:null}))},[y]),j=g.useCallback(()=>{const P=n.pendingShareRequest;P&&(r(I=>({...I,pendingShareRequest:null})),w(P.sessionId))},[n.pendingShareRequest,w]),E=g.useCallback(()=>{r(P=>({...P,pendingShareRequest:null}))},[]),N=g.useCallback(async()=>{if(!window.jaitDesktop)return[];try{return await window.jaitDesktop.getDesktopSources()}catch{return[]}},[]);return g.useEffect(()=>{let P=!0,I=null;const R=()=>{if(!P)return;const $=`${Ice}${t?`?token=${t}`:""}`,X=new WebSocket($);u.current=X,X.onopen=()=>{console.log("[screen-share] WS connected"),X.send(JSON.stringify({type:"subscribe",deviceId:d.current}))},X.onmessage=G=>{var D,q,F,V,W,L,O;try{const H=JSON.parse(G.data);switch(H.type.startsWith("screen-share:")&&console.log(`[screen-share] WS recv: ${H.type}`,JSON.stringify(H.payload).slice(0,300)),H.type){case"screen-share:state-update":{const B=H.payload;B.status==="idle"?((D=o.current)==null||D.getTracks().forEach(U=>U.stop()),o.current=null,a.current=null,(q=i.current)==null||q.close(),i.current=null,r(U=>({...U,session:null,isHost:!1,isViewer:!1,isActive:!1,connectedDeviceId:null,pendingShareRequest:null}))):r(U=>({...U,session:B,isActive:B.status==="sharing"}));break}case"screen-share:start-request":{const B=H.payload;if(console.log(`[screen-share] start-request: host=${B.hostDeviceId} local=${d.current} viewers=[${(F=B.viewerDeviceIds)==null?void 0:F.join(",")}] isHostMatch=${B.hostDeviceId===d.current} pcRef=${!!i.current}`),B.hostDeviceId===d.current){const U=((V=B.viewerDeviceIds)==null?void 0:V[0])??"unknown",A=cT();if(A.has(U)||A.has("*")){console.log("[screen-share] Auto-approved share request from",U),w(B.sessionId);break}Kg()==="electron"&&((W=window.jaitDesktop)==null||W.notify({title:"Screen Share Request",body:"A remote device wants to view your screen."}).catch(()=>{}));const Q=ms("Screen share requested",{description:"A remote device wants to view your screen.",duration:1/0,action:{label:"Always Allow",onClick:()=>{console.log("[screen-share] User accepted + enabled always-approve"),Bce("*"),w(B.sessionId),ms.dismiss(Q)}},cancel:{label:"Share Once",onClick:()=>{console.log("[screen-share] User accepted share request (once)"),w(B.sessionId),ms.dismiss(Q)}}})}else if(!B.viewerDeviceIds||B.viewerDeviceIds.length===0||B.viewerDeviceIds.includes(d.current)){if(i.current){console.log("[screen-share] Viewer PC already set up, skipping duplicate start-request");break}o.current&&(o.current.getTracks().forEach(U=>U.stop()),o.current=null),console.log("[screen-share] Setting up as viewer for session:",B.sessionId,"host:",B.hostDeviceId),r(U=>({...U,isViewer:!0,isHost:!1,isActive:!0,connectedDeviceId:B.hostDeviceId})),b(null,!1,B.sessionId)}break}case"screen-share:offer":{const B=H.payload;if(B.hostDeviceId===d.current){console.log("[screen-share] Ignoring own offer (we are the host)");break}console.log(`[screen-share] Received offer from host=${B.hostDeviceId} pcRef=${!!i.current}`);const U=i.current;U?U.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:B.sdp})).then(()=>U.createAnswer()).then(A=>{var M;U.setLocalDescription(A),console.log("[screen-share] Sending answer"),(M=u.current)==null||M.send(JSON.stringify({type:"screen-share:answer",payload:{sessionId:B.sessionId,viewerDeviceId:d.current,sdp:A.sdp}}))}).catch(A=>console.error("[screen-share] Offer handling failed:",A)):(console.log("[screen-share] PC not ready, queuing offer"),h.current=B);break}case"screen-share:answer":{const B=H.payload;if(B.viewerDeviceId===d.current){console.log("[screen-share] Ignoring own answer (we are the viewer)");break}console.log(`[screen-share] Received answer from viewer=${B.viewerDeviceId}`),(L=i.current)==null||L.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:B.sdp}));break}case"screen-share:ice-candidate":{const B=H.payload;if(B.fromDeviceId===d.current)break;console.log(`[screen-share] ICE candidate from=${B.fromDeviceId} pcRef=${!!i.current}`),(O=i.current)==null||O.addIceCandidate(new RTCIceCandidate({candidate:B.candidate,sdpMid:B.sdpMid,sdpMLineIndex:B.sdpMLineIndex}));break}}}catch{}},X.onclose=()=>{u.current=null,P&&(I=setTimeout(R,2e3))},X.onerror=()=>{}};return R(),()=>{var $;P=!1,I&&clearTimeout(I),($=u.current)==null||$.close(),u.current=null}},[t]),g.useEffect(()=>{p(),v()},[p,v]),g.useEffect(()=>{window.jaitDesktop&&(window.jaitDesktop.onScreenShareStart(()=>w()),window.jaitDesktop.onScreenShareStop(()=>C()))},[w,C]),{...n,requestRemoteShare:S,startHosting:w,disconnect:C,acceptPendingShare:j,rejectPendingShare:E,getDesktopSources:N,refreshState:v,localStream:o.current,remoteStream:a.current}}/**
|
|
675
675
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
@@ -724,11 +724,11 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
|
|
|
724
724
|
`);Je=Gt.pop()||"";for(const Gn of Gt)if(Gn.startsWith("data: "))try{const Ke=JSON.parse(Gn.slice(6));if(Iv(String(Ke.type??"unknown"),Gn.slice(6)),Ke.type==="thinking")Ce||(Ce=Date.now()),he+=Ke.content,ct({thinking:he});else if(Ke.type==="token")Ce&&!Xe&&(Xe=Math.round((Date.now()-Ce)/1e3)),ae+=Ke.content,qe(Ke.content),ct({content:ae,thinkingDuration:Xe,segments:[...$e]});else if(Ke.type==="tool_call_delta"){const ze=Ke.call_id,st=Ke.name_delta||"",yt=Ke.args_delta||"",Mt=Pe.findIndex(Yn=>Yn.callId===ze);Mt!==-1?Pe[Mt]={...Pe[Mt],tool:Pe[Mt].tool+st,streamingArgs:(Pe[Mt].streamingArgs??"")+yt}:(Pe.push({callId:ze,tool:st,args:{},status:"pending",streamingArgs:yt,startedAt:Date.now()}),It(ze)),ct({toolCalls:[...Pe],segments:[...$e]})}else if(Ke.type==="tool_start"){const ze=Ke.call_id,st=Pe.findIndex(yt=>yt.callId===ze);st!==-1?Pe[st]={...Pe[st],tool:Ke.tool,args:Ke.args??{},status:"running",streamingArgs:void 0}:(Pe.push({callId:ze,tool:Ke.tool,args:Ke.args??{},status:"running",startedAt:Date.now()}),It(ze)),ct({toolCalls:[...Pe],segments:[...$e]})}else if(Ke.type==="tool_output"){const ze=Pe.findIndex(st=>st.callId===Ke.call_id);ze!==-1&&(Pe[ze]={...Pe[ze],streamingOutput:(Pe[ze].streamingOutput??"")+Ke.content},ct({toolCalls:[...Pe]}))}else if(Ke.type==="tool_result"){const ze=Pe.findIndex(st=>st.callId===Ke.call_id);if(ze!==-1&&(Pe[ze]={...Pe[ze],status:Ke.ok?"success":"error",result:{ok:Ke.ok,message:Ke.message,data:Ke.data},completedAt:Date.now()},ct({toolCalls:[...Pe]}),Ke.ok)){const st=Pe[ze],yt=st.tool.replace("_",".");if(yt==="file.write"||yt==="file.patch"||yt==="edit"){const Mt=String(((_e=st.args)==null?void 0:_e.path)??"");if(Mt){const Yn=Mt.split("/").pop()??Mt;y(Pt=>Pt.some(_n=>_n.path===Mt)?Pt:[...Pt,{path:Mt,name:Yn,state:"undecided"}])}}}}else if(Ke.type==="plan_complete"){const ze={plan_id:Ke.plan_id,summary:Ke.summary,actions:Ke.actions??[]};a(ze)}else if(Ke.type==="mode_notice"){const ze=`
|
|
725
725
|
|
|
726
726
|
*${Ke.message}*`;ae+=ze,qe(ze),ct({content:ae,segments:[...$e]})}else if(Ke.type==="todo_list"){const ze=Ke.items;d(ze)}else if(Ke.type==="context_usage")w(Ke);else if(Ke.type==="file_changed"){const ze=Ke.path,st=Ke.name;y(yt=>yt.find(Yn=>Yn.path===ze)?yt:[...yt,{path:ze,name:st,state:"undecided"}])}else if(Ke.type==="done"){if(Ce&&!Xe&&(Xe=Math.round((Date.now()-Ce)/1e3)),!We()){const ze=ae.length===0&&he.length===0&&Pe.length===0;i(st=>({...st,promptCount:Ke.prompt_count,remainingPrompts:Ke.remaining_prompts,isLoading:!1,hitMaxRounds:!!Ke.hit_max_rounds,messages:ze?st.messages.filter(yt=>yt.id!==at):st.messages.map(yt=>yt.id===at?{...yt,content:ae,thinking:he||void 0,thinkingDuration:Xe,toolCalls:Pe.length>0?Pe:void 0,segments:$e.length>0?$e:void 0}:yt)}))}}else if(Ke.type==="error")throw new Error(Ke.message)}catch(Ke){if(!(Ke instanceof SyntaxError))throw Ke}}}catch(ye){if(ye instanceof Error&&ye.name==="AbortError"){We()||i(xe=>({...xe,isLoading:!1,messages:xe.messages.filter(Z=>!(Z.id===at&&!Z.content&&!Z.thinking&&(!Z.toolCalls||Z.toolCalls.length===0))).map(Z=>{var le;return(le=Z.toolCalls)!=null&&le.some(ve=>ve.status==="running")?{...Z,toolCalls:Z.toolCalls.map(ve=>ve.status==="running"?{...ve,status:"error",result:{ok:!1,message:"Cancelled"},completedAt:Date.now()}:ve)}:Z})}));return}We()||i(xe=>({...xe,isLoading:!1,error:ye instanceof Error?ye.message:"An error occurred",messages:xe.messages.filter(Z=>!(Z.id===at&&!Z.content&&!Z.thinking&&(!Z.toolCalls||Z.toolCalls.length===0)))}))}},[t,n,e]),G=g.useCallback(J=>{const Y={id:`q-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,content:J,queuedAt:Date.now()};v(ce=>[...ce,Y])},[]),D=g.useCallback(J=>{v(Y=>Y.filter(ce=>ce.id!==J))},[]),q=g.useCallback((J,Y)=>{v(ce=>ce.map(ke=>ke.id===J?{...ke,content:Y}:ke))},[]),F=g.useCallback(async(J={})=>{S.current||(S.current=!0,v(Y=>{if(Y.length===0)return S.current=!1,Y;const[ce,...ke]=Y;return X(ce.content,J),ke}),S.current=!1)},[X]),V=g.useRef(!1);g.useEffect(()=>{const J=V.current;if(V.current=r.isLoading,J&&!r.isLoading&&p.length>0){const Y=j.current;F({token:t,sessionId:Y,onLoginRequired:n})}},[r.isLoading,p.length,F,t,n]);const W=g.useRef(null),L=g.useCallback(J=>{W.current=J},[]),O=g.useCallback(J=>{y(Y=>{var ke;const ce=J(Y);return(ke=W.current)==null||ke.call(W,ce),ce})},[]),H=g.useCallback(async J=>{O(Y=>Y.map(ce=>ce.path===J?{...ce,state:"accepted"}:ce));try{const Y={"Content-Type":"application/json"};t&&(Y.Authorization=`Bearer ${t}`),await fetch(`${Ii}/api/workspace/apply-diff`,{method:"POST",headers:Y,body:JSON.stringify({path:J,content:null})})}catch{}},[t,O]),B=g.useCallback(async J=>{try{const Y={"Content-Type":"application/json"};t&&(Y.Authorization=`Bearer ${t}`),await fetch(`${Ii}/api/workspace/undo`,{method:"POST",headers:Y,body:JSON.stringify({path:J})})}catch{}O(Y=>Y.map(ce=>ce.path===J?{...ce,state:"rejected"}:ce))},[t,O]),U=g.useCallback(()=>{O(J=>J.map(Y=>Y.state==="undecided"?{...Y,state:"accepted"}:Y))},[O]),A=g.useCallback(async()=>{const J=h.filter(Y=>Y.state==="undecided").map(Y=>Y.path);if(J.length>0)try{const Y={"Content-Type":"application/json"};t&&(Y.Authorization=`Bearer ${t}`),await fetch(`${Ii}/api/workspace/undo-all`,{method:"POST",headers:Y,body:JSON.stringify({paths:J})})}catch{}O(Y=>Y.map(ce=>ce.state==="undecided"?{...ce,state:"rejected"}:ce))},[t,h,O]);g.useEffect(()=>{if(h.length===0||!h.every(ce=>ce.state!=="undecided"))return;const Y=setTimeout(()=>y([]),1200);return()=>clearTimeout(Y)},[h]);const M=g.useCallback(()=>{var Y,ce;N.current+=1;const J=j.current;J&&fetch(`${Ii}/api/sessions/${J}/cancel`,{method:"POST",headers:F_(t)}).catch(()=>{}),(Y=C.current)==null||Y.abort(),(ce=E.current)==null||ce.abort(),E.current=null,i(ke=>({...ke,isLoading:!1,messages:ke.messages.map(je=>{var Oe;return(Oe=je.toolCalls)!=null&&Oe.some(Be=>Be.status==="running")?{...je,toolCalls:je.toolCalls.map(Be=>Be.status==="running"?{...Be,status:"error",result:{ok:!1,message:"Cancelled"},completedAt:Date.now()}:Be)}:je})}))},[t]),Q=g.useCallback(()=>{i({messages:[],isLoading:!1,isLoadingHistory:!1,promptCount:0,remainingPrompts:null,error:null,hitMaxRounds:!1}),d([]),y([]),v([])},[]),T=g.useCallback((J={})=>(i(Y=>({...Y,hitMaxRounds:!1})),X("Continue from where you left off.",J)),[X]),ie=g.useCallback(async(J,Y,ce,ke,je={})=>{var ut,We;const{token:Oe,sessionId:Be,onLoginRequired:nt}=je,at=Oe??t,Ue=nt??n,kt=Be??e;if(!(!kt||!Y.trim()||P.current)){P.current=!0;try{const ft={"Content-Type":"application/json"};at&&(ft.Authorization=`Bearer ${at}`);const Ge=()=>fetch(`${Ii}/api/sessions/${kt}/restart-from`,{method:"POST",headers:ft,body:JSON.stringify({messageId:J,messageIndex:ce,messageFromEnd:ke})}),_e=le=>new Promise(ve=>window.setTimeout(ve,le)),ye=async()=>{for(let le=0;le<32;le+=1){const ve=await fetch(`${Ii}/api/sessions/${kt}/messages?limit=1`,{headers:ft}).catch(()=>null);if(ve!=null&&ve.ok&&!(await ve.json().catch(()=>({}))).streaming)return!0;await _e(250)}return!1};N.current+=1,(ut=C.current)==null||ut.abort(),(We=E.current)==null||We.abort(),E.current=null,await fetch(`${Ii}/api/sessions/${kt}/cancel`,{method:"POST",headers:F_(at)}).catch(()=>null),await ye();let xe=await Ge();if(xe.status===409&&(await ye(),xe=await Ge()),xe.status===401){(await xe.json().catch(()=>({}))).detail==="login_required"&&(Ue==null||Ue());return}if(!xe.ok){const le=await xe.text().catch(()=>"");throw new Error(le||`HTTP ${xe.status}`)}const Z=await xe.json();i(le=>({...le,messages:Z.messages??[],isLoading:!1,error:null})),await X(Y.trim(),{token:at,sessionId:kt,mode:je.mode,provider:je.provider,onLoginRequired:Ue})}catch(ft){i(Ge=>({...Ge,isLoading:!1,error:ft instanceof Error?ft.message:"Failed to restart from message"}))}finally{P.current=!1}}},[t,n,e,X]),oe=g.useCallback(async J=>{var ke;const Y=j.current;if(!Y||!o)return;const ce={"Content-Type":"application/json"};t&&(ce.Authorization=`Bearer ${t}`);try{const je=await fetch(`${Ii}/api/sessions/${Y}/plan/execute`,{method:"POST",headers:ce,body:JSON.stringify(J?{action_ids:J}:{})});if(!je.ok)throw new Error(`HTTP ${je.status}`);const Oe=(ke=je.body)==null?void 0:ke.getReader();if(!Oe)throw new Error("No response body");const Be=new TextDecoder;let nt="";for(;;){const{done:at,value:Ue}=await Oe.read();if(at)break;nt+=Be.decode(Ue,{stream:!0});const kt=nt.split(`
|
|
727
|
-
`);nt=kt.pop()||"";for(const ut of kt)if(ut.startsWith("data: "))try{const We=JSON.parse(ut.slice(6));We.type==="plan_action_start"?a(ft=>ft?{...ft,actions:ft.actions.map(Ge=>Ge.id===We.action_id?{...Ge,status:"approved"}:Ge)}:null):We.type==="plan_action_result"?a(ft=>ft?{...ft,actions:ft.actions.map(Ge=>Ge.id===We.action_id?{...Ge,status:We.ok?"executed":"failed",result:{ok:We.ok,message:We.message,data:We.data}}:Ge)}:null):We.type==="plan_execution_complete"&&setTimeout(()=>a(null),2e3)}catch{}}}catch(je){i(Oe=>({...Oe,error:je instanceof Error?je.message:"Plan execution failed"}))}},[t,o]),te=g.useCallback(async()=>{const J=j.current;if(!J||!o)return;const Y={"Content-Type":"application/json"};t&&(Y.Authorization=`Bearer ${t}`);try{await fetch(`${Ii}/api/sessions/${J}/plan/reject`,{method:"POST",headers:Y}),a(null)}catch{a(null)}},[t,o]),re=g.useCallback((J,Y)=>{y(ce=>ce.some(ke=>ke.path===J)?ce:[...ce,{path:J,name:Y,state:"undecided"}])},[]);return{messages:r.messages,isLoading:r.isLoading,isLoadingHistory:r.isLoadingHistory,remainingPrompts:r.remainingPrompts,error:r.error,hitMaxRounds:r.hitMaxRounds,pendingPlan:o,todoList:u,changedFiles:h,messageQueue:p,contextUsage:b,sendMessage:X,restartFromMessage:ie,cancelRequest:M,clearMessages:Q,continueChat:T,executePlan:oe,rejectPlan:te,enqueueMessage:G,dequeueMessage:D,updateQueueItem:q,acceptFile:H,rejectFile:B,acceptAllFiles:U,rejectAllFiles:A,setTodoList:d,addChangedFile:re,setChangedFiles:y,setOnChangedFilesSync:L,refreshMessages:$}}function yhe(){const[e,t]=g.useState(null),[n,r]=g.useState(null),[i,o]=g.useState(null),[a,u]=g.useState(!0);return g.useEffect(()=>{let d=!1;return fetch(`${cn()}/health`).then(h=>h.json()).then(h=>{d||(t(h.provider??null),r(h.model??null),o(h.ollamaUrl??null))}).catch(()=>{}).finally(()=>{d||u(!1)}),()=>{d=!0}},[]),{provider:e,model:n,ollamaUrl:i,loading:a}}const lg=cn();function ag(e){return e?{Authorization:`Bearer ${e}`}:{}}function vhe(e,t){const[n,r]=g.useState([]),[i,o]=g.useState(null),[a,u]=g.useState(!0),d=g.useCallback(async()=>{if(!e){r(v=>v.length===0?v:[]),o(null),u(!1);return}u(!0);try{const[v,b]=await Promise.all([fetch(`${lg}/api/sessions?status=active`,{headers:ag(e)}),fetch(`${lg}/api/sessions/last-active`,{headers:ag(e)})]);if((v.status===401||b.status===401)&&(t==null||t()),v.ok){const w=await v.json();r(w.sessions)}if(b.ok){const w=await b.json();w.session&&o(S=>S??w.session.id)}}catch(v){console.error("Failed to fetch sessions:",v)}finally{u(!1)}},[t,e]),h=g.useCallback(async v=>{if(!e)return t==null||t(),null;try{const b=await fetch(`${lg}/api/sessions`,{method:"POST",headers:{...ag(e),"Content-Type":"application/json"},body:JSON.stringify({name:v||`Session ${new Date().toLocaleString()}`})});if(b.status===401)return t==null||t(),null;if(b.ok){const w=await b.json();return r(S=>[w,...S]),o(w.id),w}}catch(b){console.error("Failed to create session:",b)}return null},[t,e]),y=g.useCallback(v=>{o(v)},[]),p=g.useCallback(async v=>{if(!e){t==null||t();return}try{if((await fetch(`${lg}/api/sessions/${v}/archive`,{method:"POST",headers:ag(e)})).status===401){t==null||t();return}r(w=>w.filter(S=>S.id!==v)),i===v&&o(null)}catch(b){console.error("Failed to archive session:",b)}},[i,t,e]);return g.useEffect(()=>{d()},[d]),{sessions:n,activeSessionId:i,loading:a,fetchSessions:d,createSession:h,switchSession:y,archiveSession:p}}const _he=Kh();function Fi(){return typeof window<"u"&&window.jaitDesktop?"electron":typeof window<"u"&&"Capacitor"in window?"capacitor":"web"}function bhe(){const e=Fi(),t=`jait-device-id-${e}`,n=localStorage.getItem(t);if(n)return n;const r=`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return localStorage.setItem(t,r),r}function xhe(){const e=Fi(),t=navigator.userAgent;return e==="electron"?`Desktop (${navigator.platform})`:e==="capacitor"?"Mobile":t.includes("Chrome")?`Chrome (${navigator.platform})`:t.includes("Firefox")?`Firefox (${navigator.platform})`:t.includes("Safari")?`Safari (${navigator.platform})`:`Browser (${navigator.platform})`}function whe(){var t;const e=Fi();if(e==="capacitor")return"android";if(e==="electron"){const n=((t=navigator.platform)==null?void 0:t.toLowerCase())??"";return n.includes("win")?"windows":n.includes("mac")?"macos":"linux"}return"web"}function She(){const e=Fi();return e==="electron"||e==="capacitor"}function Che(e){const{listeners:t,sessionId:n,token:r,onStateSync:i,onFullState:o,onMessageComplete:a,onThreadEvent:u,onFsChanges:d}=e,h=g.useRef(t);h.current=t;const y=g.useRef(i);y.current=i;const p=g.useRef(o);p.current=o;const v=g.useRef(a);v.current=a;const b=g.useRef(u);b.current=u;const w=g.useRef(d);w.current=d;const S=g.useRef(null),C=g.useRef(null),j=g.useRef(!0),E=g.useRef(r);E.current=r;const N=g.useRef(n);N.current=n;const P=g.useRef([]),I=g.useCallback(L=>{for(;P.current.length>0&&L.readyState===WebSocket.OPEN;){const O=P.current.shift();L.send(O)}},[]),R=g.useCallback((L,O)=>{!O||L.readyState!==WebSocket.OPEN||(L.send(JSON.stringify({type:"subscribe",sessionId:O})),C.current=O)},[]),$=g.useCallback(L=>{var O,H,B;try{const U=JSON.parse(L.data);if(U.type==="ui.command"){const A=U.payload,M=h.current[A.command];M&&M(A.data)}else if(U.type==="ui.state-sync"){const A=U.payload;A!=null&&A.key&&y.current&&y.current(A.key,A.value??null)}else if(U.type==="ui.full-state"){const A=U.payload;A&&p.current&&p.current(A)}else if(U.type==="message.complete")(O=v.current)==null||O.call(v);else if(U.type==="fs.changes"){const A=U.payload;(H=w.current)==null||H.call(w,A)}else U.type==="fs.browse-request"?D(U.payload):U.type==="fs.roots-request"?q(U.payload):U.type==="fs.op-request"?F(U.payload):U.type==="provider.op-request"?V(U.payload):(U.type.startsWith("thread.")||U.type.startsWith("repo."))&&((B=b.current)==null||B.call(b,U.type,U.payload))}catch{}},[]),X=g.useCallback(async L=>{const{Filesystem:O,Directory:H}=await QY(async()=>{const{Filesystem:oe,Directory:te}=await import("./index-BT-CLHSC.js").then(re=>re.i);return{Filesystem:oe,Directory:te}},[]);let B,U=L;L==="~"||L==="/storage"||L==="/"?(B=H.ExternalStorage,U=""):L.startsWith("/storage/emulated/0")&&(B=H.ExternalStorage,U=L.replace("/storage/emulated/0","").replace(/^\//,""));const A=await O.readdir({path:U||"",...B?{directory:B}:{}}),M=B===H.ExternalStorage?"/storage/emulated/0"+(U?"/"+U:""):L,Q=[];for(const oe of A.files)oe.name.startsWith(".")||Q.push({name:oe.name,path:M+"/"+oe.name,type:oe.type==="directory"?"dir":"file"});Q.sort((oe,te)=>oe.type!==te.type?oe.type==="dir"?-1:1:oe.name.localeCompare(te.name));const T=M.replace(/\/+$/,"").split("/"),ie=T.length>3?T.slice(0,-1).join("/"):null;return{path:M,parent:ie,entries:Q}},[]),G=g.useCallback(async()=>[{name:"Internal Storage",path:"/storage/emulated/0",type:"dir"},{name:"Documents",path:"/storage/emulated/0/Documents",type:"dir"},{name:"Downloads",path:"/storage/emulated/0/Download",type:"dir"},{name:"Home",path:"/storage/emulated/0",type:"dir"}],[]),D=g.useCallback(async L=>{var U;const O=S.current;if(!O||O.readyState!==WebSocket.OPEN)return;const{requestId:H,path:B}=L;try{let A;const M=Fi();if(M==="electron"&&((U=window.jaitDesktop)!=null&&U.browsePath))A=await window.jaitDesktop.browsePath(B);else if(M==="capacitor")A=await X(B);else throw new Error("Local filesystem browsing not supported on this platform");O.send(JSON.stringify({type:"fs.browse-response",payload:{requestId:H,path:A.path,parent:A.parent,entries:A.entries}}))}catch(A){O.send(JSON.stringify({type:"fs.browse-response",payload:{requestId:H,error:A instanceof Error?A.message:"Browse failed"}}))}},[X]),q=g.useCallback(async L=>{var B;const O=S.current;if(!O||O.readyState!==WebSocket.OPEN)return;const{requestId:H}=L;try{let U;const A=Fi();if(A==="electron"&&((B=window.jaitDesktop)!=null&&B.getRoots))U=(await window.jaitDesktop.getRoots()).roots;else if(A==="capacitor")U=await G();else throw new Error("Local filesystem browsing not supported on this platform");O.send(JSON.stringify({type:"fs.roots-response",payload:{requestId:H,roots:U}}))}catch(U){O.send(JSON.stringify({type:"fs.roots-response",payload:{requestId:H,error:U instanceof Error?U.message:"Roots request failed"}}))}},[G]),F=g.useCallback(async L=>{var A;const O=S.current;if(!O||O.readyState!==WebSocket.OPEN)return;const{requestId:H,op:B,...U}=L;try{const M=Fi();if(M==="electron"&&((A=window.jaitDesktop)!=null&&A.fsOp)){const Q=await window.jaitDesktop.fsOp(B,U);O.send(JSON.stringify({type:"fs.op-response",payload:{requestId:H,result:Q}}))}else throw M==="capacitor"?new Error("Full filesystem operations not yet supported on mobile"):new Error("Filesystem operations not supported on this platform")}catch(M){O.send(JSON.stringify({type:"fs.op-response",payload:{requestId:H,error:M instanceof Error?M.message:"Filesystem operation failed"}}))}},[]),V=g.useCallback(async L=>{var A;const O=S.current;if(!O||O.readyState!==WebSocket.OPEN)return;const{requestId:H,op:B,...U}=L;try{if(Fi()==="electron"&&((A=window.jaitDesktop)!=null&&A.providerOp)){const Q=await window.jaitDesktop.providerOp(B,U);O.send(JSON.stringify({type:"provider.op-response",payload:{requestId:H,result:Q}}))}else throw new Error("Provider operations not supported on this platform")}catch(M){O.send(JSON.stringify({type:"provider.op-response",payload:{requestId:H,error:M instanceof Error?M.message:"Provider operation failed"}}))}},[]);return g.useEffect(()=>{var B;j.current=!0;let L=null;const O=()=>{if(!j.current)return;const U=new WebSocket(`${_he}?token=${E.current??"dev"}`);S.current=U,U.onopen=()=>{const A=N.current;A&&R(U,A),I(U),She()&&(async()=>{var Q;if(Fi()==="electron"&&((Q=window.jaitDesktop)!=null&&Q.detectProviders))try{return await window.jaitDesktop.detectProviders()}catch{return[]}return[]})().then(Q=>{const T=JSON.stringify({type:"fs.register-node",payload:{id:bhe(),name:xhe(),platform:whe(),providers:Q}});U.readyState===WebSocket.OPEN&&U.send(T)})},U.onmessage=$,U.onclose=()=>{S.current=null,C.current=null,j.current&&(L=setTimeout(O,1e3))},U.onerror=()=>{}};O();const H=(U,A)=>{if((A==null?void 0:A.type)==="provider.event-from-child"){const M=S.current;M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"provider.event",payload:{sessionId:A.sessionId,event:A.notification}}))}};return Fi()==="electron"&&((B=window.jaitDesktop)!=null&&B.onGatewayEvent)&&window.jaitDesktop.onGatewayEvent(H),()=>{var A;j.current=!1,L&&clearTimeout(L),Fi()==="electron"&&((A=window.jaitDesktop)!=null&&A.removeGatewayEventListener)&&window.jaitDesktop.removeGatewayEventListener();const U=S.current;U&&(U.onclose=null,U.close(),S.current=null)}},[r]),g.useEffect(()=>{const L=S.current;L&&L.readyState===WebSocket.OPEN&&n!==C.current&&R(L,n??null),N.current=n??null},[n,R]),{sendUIState:g.useCallback((L,O,H)=>{const B=JSON.stringify({type:"ui.state",payload:{sessionId:H??"",key:L,value:O}}),U=S.current;U&&U.readyState===WebSocket.OPEN?U.send(B):P.current.push(B)},[])}}const n7=cn();function r7(e){const t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}function Rf(e,t,n){const[r,i]=g.useState(null),[o,a]=g.useState(!1),u=g.useRef(null),d=g.useRef(null);g.useEffect(()=>{if(!e||!n){i(null);return}let y=!1;return a(!0),fetch(`${n7}/api/sessions/${e}/state?keys=${encodeURIComponent(t)}`,{headers:r7(n)}).then(p=>p.ok?p.json():null).then(p=>{if(y)return;const v=(p==null?void 0:p[t])??null;i(v),d.current=v}).catch(()=>{y||i(null)}).finally(()=>{y||a(!1)}),()=>{y=!0}},[e,t,n]);const h=g.useCallback(y=>{i(y),d.current=y,!(!e||!n)&&(u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{fetch(`${n7}/api/sessions/${e}/state`,{method:"PATCH",headers:r7(n),body:JSON.stringify({[t]:d.current})}).catch(()=>{})},300))},[e,t,n]);return g.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]),[r,h,o]}function e1(e){return e.replace(/\\/g,"/").replace(/\/+$/,"")}function jhe(e){const n=e1(e).split("/").filter(Boolean);return n[n.length-1]??e}function khe(e){var n;const t=e.match(/^\[([^\]]+)\]/);return((n=t==null?void 0:t[1])==null?void 0:n.trim())||null}function nP(e){if(!e)return null;const n=e1(e).split("/").filter(Boolean),r=n.lastIndexOf("worktrees");return r===-1?null:n[r+1]??null}function H1(e){return khe(e.title)??nP(e.workingDirectory)??(e.workingDirectory?jhe(e.workingDirectory):null)}function c2(e,t){var u,d;const n=t.name.trim().toLowerCase(),r=(u=H1(e))==null?void 0:u.toLowerCase(),i=e.workingDirectory?e1(e.workingDirectory):null,o=e1(t.localPath);if(i&&(i===o||i.startsWith(`${o}/`)))return!0;const a=(d=nP(e.workingDirectory))==null?void 0:d.toLowerCase();return a&&a===n?!0:r===n}function Ehe(e,t){const n=[],r=new Set;for(const i of e){if(t.some(u=>c2(i,u)))continue;const o=H1(i),a=o==null?void 0:o.trim().toLowerCase();!o||!a||r.has(a)||(n.push({id:`shared:${a}`,name:o,defaultBranch:"main",localPath:i.workingDirectory??o,source:"shared"}),r.add(a))}return n}function Ohe(e){const n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n[n.length-1]??e}function Nhe(){return`jait/${Math.random().toString(16).slice(2,10)}`}function rP(e){return[...e].sort((t,n)=>new Date(t.createdAt).getTime()-new Date(n.createdAt).getTime())}function The(e,t){if(t.length===0)return e;const n=new Map(e.map(r=>[r.id,r]));for(const r of t)n.set(r.id,r);return rP([...n.values()])}function cg(e,t){return{id:e.id,name:e.name,defaultBranch:e.defaultBranch,localPath:e.localPath,deviceId:e.deviceId,githubUrl:e.githubUrl,source:!e.deviceId||e.deviceId===t?"local":"shared"}}function Phe(e=!0){const t=g.useMemo(()=>tP(),[]),[n,r]=g.useState([]),[i,o]=g.useState(null),[a,u]=g.useState(!1),[d,h]=g.useState([]),[y,p]=g.useState(null),[v,b]=g.useState([]),[w,S]=g.useState({}),[C,j]=g.useState(!0),[E,N]=g.useState([]),[P,I]=g.useState(!1),[R,$]=g.useState(null),X=g.useRef(null),G=g.useRef(new Map),D=g.useMemo(()=>Ehe(d,n),[d,n]),q=g.useMemo(()=>[...n,...D],[n,D]),F=g.useMemo(()=>q.find(te=>te.id===i)??null,[q,i]),V=g.useMemo(()=>d.find(te=>te.id===y)??null,[d,y]),W=g.useCallback(te=>q.find(re=>c2(te,re))??null,[q]),L=g.useMemo(()=>V!=null&&F!=null&&(V.status==="completed"||!!V.prUrl),[V,F]);g.useEffect(()=>{var te;e&&(!i&&q.length>0&&o(q[0].id),i&&q.every(re=>re.id!==i)&&o(((te=q[0])==null?void 0:te.id)??null))},[q,i,e]),g.useEffect(()=>{if(!e||!V)return;const te=W(V);te&&te.id!==i&&o(te.id)},[e,W,i,V]);const O=g.useCallback(async()=>{if(localStorage.getItem("token")){I(!0);try{const[te,re,J]=await Promise.all([Hn.listThreads(),Hn.listProviders(),Hn.listRepos()]);h(te),N(re.providers),r(J.map(Y=>cg(Y,t))),$(null)}catch(te){$(te instanceof Error?te.message:"Failed to fetch data")}finally{I(!1)}}},[]);g.useEffect(()=>{e&&O()},[O,e]);const H=g.useRef(y);H.current=y;const B=g.useCallback((te,re)=>{switch(te){case"thread.created":{const J=re.thread;J&&h(Y=>Y.some(ce=>ce.id===J.id)?Y:[J,...Y]);break}case"thread.updated":{const J=re.thread;J&&h(Y=>Y.map(ce=>ce.id===J.id?J:ce));break}case"thread.deleted":{const J=re.threadId;J&&(G.current.delete(J),h(Y=>Y.filter(ce=>ce.id!==J)),H.current===J&&p(null));break}case"thread.status":{const J=re.threadId,Y=re.status,ce=re.thread;J&&Y&&h(ke=>ce?ke.some(Oe=>Oe.id===J)?ke.map(Oe=>Oe.id===J?ce:Oe):[ce,...ke]:ke.map(je=>je.id===J?{...je,status:Y,error:Y==="running"||Y==="completed"?re.error??null:re.error??je.error}:je));break}case"thread.activity":{const J=re.threadId,Y=re.activity;if(J&&Y){const ce=The(G.current.get(J)??[],[Y]);G.current.set(J,ce),J===H.current&&b(ce)}break}case"repo.created":{const J=re.repo;J&&r(Y=>Y.some(ce=>ce.id===J.id)?Y:[cg(J,t),...Y]);break}case"repo.updated":{const J=re.repo;J&&r(Y=>Y.map(ce=>ce.id===J.id?cg(J,t):ce));break}case"repo.deleted":{const J=re.repoId;J&&(r(Y=>Y.filter(ce=>ce.id!==J)),o(Y=>Y===J?null:Y));break}}},[]);g.useEffect(()=>{if(!e||!y){b([]);return}const te=G.current.get(y);if(te){b(te);return}b([]);let re=!1;return(async()=>{if(localStorage.getItem("token"))try{const Y=await Hn.getActivities(y);if(!re){const ce=rP(Y);G.current.set(y,ce),b(ce)}}catch{}})(),()=>{re=!0}},[y,e]),g.useEffect(()=>{var te;e&&((te=X.current)==null||te.scrollIntoView({behavior:"smooth"}))},[v,e]);const U=g.useMemo(()=>F?d.filter(te=>c2(te,F)):[],[d,F]),A=g.useRef(0);g.useEffect(()=>{if(!e||!F){S({});return}const te=++A.current,re=F.localPath,J=U,Y=Object.fromEntries(J.map(je=>[je.id,null])),ce=J.filter(je=>typeof je.branch=="string"&&je.branch.length>0);(async()=>{if(ce.length===0){te===A.current&&S(Y);return}const je=await Promise.allSettled(ce.map(async nt=>{var ut;const at=nt.workingDirectory??re,Ue=await ll.status(at,nt.branch??void 0),kt=((ut=Ue.pr)==null?void 0:ut.state)??null;if(Ue.pr&&(nt.prUrl!==Ue.pr.url||nt.prState!==Ue.pr.state||nt.prNumber!==Ue.pr.number))try{await Hn.updateThread(nt.id,{prUrl:Ue.pr.url,prNumber:Ue.pr.number,prTitle:Ue.pr.title,prState:Ue.pr.state})}catch{}return{threadId:nt.id,prState:kt,ghAvailable:Ue.ghAvailable}}));if(te!==A.current)return;const Oe={...Y};let Be=!1;for(const nt of je)nt.status==="fulfilled"&&(Oe[nt.value.threadId]=nt.value.prState,nt.value.ghAvailable&&(Be=!0));j(Be),S(Oe)})()},[e,U,F]);const M=g.useCallback(async te=>{const re=n.find(ce=>ce.localPath===te);if(re){o(re.id);return}let J="main",Y;try{const ce=await ll.status(te);ce.branch&&(J=ce.branch),ce.remoteUrl&&(Y=ce.remoteUrl)}catch{}try{const ce=await Hn.createRepo({name:Ohe(te),defaultBranch:J,localPath:te,deviceId:t,githubUrl:Y}),ke=cg(ce,t);r(je=>je.some(Oe=>Oe.id===ke.id)?je:[ke,...je]),o(ke.id),$(null)}catch(ce){$(ce instanceof Error?ce.message:"Failed to create repository")}},[n]),Q=g.useCallback(async te=>{try{await Hn.deleteRepo(te)}catch{}r(re=>re.filter(J=>J.id!==te)),i===te&&o(null)},[i]),T=g.useCallback(async(te,re="jait",J)=>{if(te.trim())if(V&&(V.status==="running"||V.providerSessionId))await Hn.sendTurn(V.id,te),O();else if(V&&(V.status==="completed"||V.status==="error"||V.status==="interrupted"))try{const Y=await Hn.startThread(V.id,te);h(ce=>ce.map(ke=>ke.id===Y.id?Y:ke)),O()}catch(Y){if(Y.code==="NODE_OFFLINE"&&F){const ke=F.githubUrl;if(ke&&confirm("The desktop app is not connected. Clone the repo to the gateway and run the thread there?")){const je=await Hn.startThread(V.id,{message:te,cloneToGateway:!0,repoUrl:ke});h(Oe=>Oe.map(Be=>Be.id===je.id?je:Be)),O()}else ke||$("Desktop app is offline and no GitHub URL is configured for this repo.")}else throw Y}else{if(!F)return;p(null);const Y=F;(async()=>{try{const ce=Nhe();let ke;try{ke=(await ll.createWorktree(Y.localPath,Y.defaultBranch,ce)).path}catch{try{await ll.createBranch(Y.localPath,ce,Y.defaultBranch)}catch{}}const je=await Hn.createThread({title:`[${Y.name}] Generating title…`,providerId:re,...J?{model:J}:{},workingDirectory:ke??Y.localPath,branch:ce});try{await Hn.startThread(je.id,{message:te,titleTask:te,titlePrefix:`[${Y.name}] `})}catch(Oe){if(Oe.code==="NODE_OFFLINE"){const nt=Y.githubUrl;nt&&confirm("The desktop app is not connected. Clone the repo to the gateway and run the thread there?")?await Hn.startThread(je.id,{message:te,titleTask:te,titlePrefix:`[${Y.name}] `,cloneToGateway:!0,repoUrl:nt}):nt||$("Desktop app is offline and no GitHub URL is configured for this repo. Open the desktop app first.");return}throw Oe}}catch(ce){$(ce instanceof Error?ce.message:"Failed to create thread")}})()}},[F,V,O]),ie=g.useCallback(async te=>{try{await Hn.stopThread(te),O()}catch(re){$(re instanceof Error?re.message:"Failed to stop thread")}},[O]),oe=g.useCallback(async te=>{try{await Hn.deleteThread(te),h(re=>re.filter(J=>J.id!==te)),y===te&&p(null)}catch(re){$(re instanceof Error?re.message:"Failed to delete thread")}},[y]);return{repositories:q,selectedRepoId:i,setSelectedRepoId:o,selectedRepo:F,folderPickerOpen:a,setFolderPickerOpen:u,handleFolderSelected:M,removeRepository:Q,threads:d,repoThreads:U,selectedThreadId:y,setSelectedThreadId:p,selectedThread:V,getRepositoryForThread:W,threadPrStates:w,ghAvailable:C,activities:v,activityEndRef:X,providers:E,loading:P,error:R,setError:$,creating:!1,showGitActions:L,refresh:O,handleSend:T,handleStop:ie,handleDelete:oe,handleThreadEvent:B}}const yi=cn(),Ahe=["What can you help me with?","Explain quantum computing","Write a Python script","What time is it?"];function i7(e){const t=window.matchMedia("(prefers-color-scheme: dark)").matches,n=e==="dark"||e==="system"&&t;document.documentElement.classList.toggle("dark",n)}const Rhe="Generating title…";function Xx(e){return e.replace(/^\[.*?\]\s*/,"").trim()===Rhe}function iP({className:e=""}){return c.jsx("span",{className:`inline-block rounded bg-muted animate-pulse ${e}`,children:c.jsx("span",{className:"invisible",children:"Generating title"})})}function Jx({status:e}){const t={running:{icon:bt,color:"text-blue-500 animate-spin"},paused:{icon:v5,color:"text-yellow-500"},interrupted:{icon:v5,color:"text-yellow-500"},done:{icon:ii,color:"text-green-500"},completed:{icon:ii,color:"text-green-500"},error:{icon:to,color:"text-red-500"}},{icon:n,color:r}=t[e]??{icon:no,color:"text-muted-foreground"};return c.jsx(n,{className:`h-3 w-3 shrink-0 ${r}`})}function sP({prState:e}){if(!e)return null;const t=e==="open"?"PR created":e==="merged"?"PR merged":"PR closed",n=e==="open"?"bg-blue-500/10 text-blue-700 border-blue-500/20 dark:text-blue-300 dark:bg-blue-500/20 dark:border-blue-400/30":e==="merged"?"bg-purple-500/10 text-purple-700 border-purple-500/20 dark:text-purple-300 dark:bg-purple-500/20 dark:border-purple-400/30":"bg-red-500/10 text-red-700 border-red-500/20 dark:text-red-300 dark:bg-red-500/20 dark:border-red-400/30";return c.jsx(Rt,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${n}`,children:t})}function Mhe({repositories:e,selectedRepo:t,disabled:n=!1,onSelect:r,onAddRepository:i}){return c.jsxs(bl,{children:[c.jsx(xl,{asChild:!0,children:c.jsxs(Ee,{variant:"outline",size:"sm",className:"h-8 gap-1.5 rounded-lg px-2 text-xs",disabled:n,children:[c.jsx($c,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[140px] truncate",children:t?t.name:"Select repository"}),c.jsx(Ss,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]})}),c.jsxs(ao,{align:"start",side:"top",className:"w-64",children:[c.jsx(y1,{children:"Repository"}),e.map(o=>c.jsx(Yi,{onSelect:()=>r(o.id),children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx($c,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"truncate",children:o.name}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:o.defaultBranch}),o.source==="shared"&&c.jsx(Rt,{variant:"outline",className:"h-4 px-1 py-0 text-[9px]",children:"Shared"})]})},o.id)),e.length===0&&c.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:"No repositories yet."}),c.jsx(Dc,{}),c.jsxs(Yi,{onSelect:i,children:[c.jsx(Qf,{className:"mr-2 h-3.5 w-3.5"}),"Add repository"]})]})]})}function Dhe({repositories:e,selectedRepoId:t,isMobile:n=!1,onSelect:r,onAddRepository:i,onRemoveRepository:o}){return c.jsxs("div",{className:"flex h-full flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[c.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Repositories"}),c.jsxs(Ee,{variant:"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[11px]",onClick:i,children:[c.jsx(Qf,{className:"h-3 w-3"}),"Add"]})]}),c.jsx("div",{className:n?"flex-1 overflow-y-auto p-1.5 space-y-0.5":"flex-1 overflow-y-auto p-2 space-y-1",children:e.length===0?c.jsxs("p",{className:"py-4 text-center text-xs text-muted-foreground",children:["No repositories yet.",c.jsx("br",{}),c.jsx("button",{type:"button",onClick:i,className:"mt-1 inline-block underline underline-offset-2 hover:text-foreground",children:"Add one"})]}):e.map(a=>c.jsxs("div",{role:"button",tabIndex:0,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left transition-colors ${n?"cursor-pointer rounded-md text-sm":"rounded-lg text-xs"} ${t===a.id?n?"bg-secondary text-secondary-foreground":"bg-primary/10 text-primary":n?"hover:bg-muted/50":"hover:bg-muted"}`,onClick:()=>r(a.id),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r(a.id))},children:[c.jsx($c,{className:"h-3.5 w-3.5 shrink-0"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:n?"truncate text-xs font-medium":"truncate font-medium",children:a.name}),c.jsx("div",{className:"text-[10px] text-muted-foreground",children:a.defaultBranch})]}),a.source==="shared"&&c.jsx(Rt,{variant:"outline",className:"h-4 shrink-0 px-1 py-0 text-[9px]",children:"Shared"}),a.source==="local"&&c.jsx("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-destructive",onClick:u=>{u.stopPropagation(),o(a.id)},children:c.jsx(r1,{className:"h-3 w-3"})})]},a.id))})]})}function Lhe({thread:e,repo:t,repoName:n,prState:r,ghAvailable:i,onOpen:o,onStop:a,onDelete:u}){const d=t!=null&&(e.status==="completed"||!!e.prUrl);return c.jsxs("div",{role:"button",tabIndex:0,className:"group relative grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-5 border-b px-3 py-3.5 text-sm transition-colors hover:bg-muted/40",onClick:o,onKeyDown:h=>{h.target===h.currentTarget&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),o())},children:[c.jsxs("div",{className:"flex flex-col gap-0.5",children:[c.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1.5",children:[c.jsx(Jx,{status:e.status}),c.jsx("div",{className:"flex-1 truncate font-medium",children:Xx(e.title)?c.jsx(iP,{className:"h-3.5 w-28"}):c.jsx("span",{children:e.title.replace(/^\[.*?\]\s*/,"")})})]}),c.jsxs("div",{className:"flex gap-1 text-xs text-muted-foreground pl-[calc(0.75rem+6px)]",children:[c.jsx("span",{className:"truncate",children:n}),e.branch&&c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"·"}),c.jsx("span",{className:"truncate font-mono",children:e.branch})]}),r&&c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"·"}),c.jsx(sP,{prState:r})]})]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[d&&t&&c.jsx("div",{className:"shrink-0",onClick:h=>h.stopPropagation(),onMouseDown:h=>h.stopPropagation(),onKeyDown:h=>h.stopPropagation(),children:c.jsx(Dx,{threadId:e.id,cwd:e.workingDirectory??t.localPath,branch:e.branch,baseBranch:t.defaultBranch,threadTitle:e.title,threadStatus:e.status,prUrl:e.prUrl,prState:r,ghAvailable:i,showStatusBadge:!1})}),e.status==="running"&&c.jsx(Ee,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-lg",onClick:h=>{h.stopPropagation(),a()},children:c.jsx(ed,{className:"h-3 w-3"})}),c.jsx(Ee,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-lg opacity-100 transition-opacity",onClick:h=>{h.stopPropagation(),u()},children:c.jsx(r1,{className:"h-3.5 w-3.5"})})]})]})}function zhe({threads:e,getRepositoryForThread:t,ghAvailable:n,onOpenThread:r,onStopThread:i}){const[o,a]=g.useState(!1);return e.length===0?null:c.jsxs(bl,{open:o,onOpenChange:a,children:[c.jsx(xl,{asChild:!0,children:c.jsxs(Ee,{variant:"outline",size:"sm",className:"h-8 gap-1.5 rounded-lg px-2 text-xs",title:`${e.length} active ${e.length===1?"thread":"threads"}`,children:[c.jsx(bt,{className:"h-3.5 w-3.5 animate-spin text-blue-500"}),c.jsx("span",{className:"hidden sm:inline",children:"Active"}),c.jsx(Rt,{variant:"secondary",className:"h-4 rounded-md px-1 text-[10px]",children:e.length})]})}),c.jsxs(ao,{align:"end",className:"w-[min(34rem,calc(100vw-1rem))] p-0",children:[c.jsx("div",{className:"flex items-center justify-between border-b px-3 py-2",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(bt,{className:"h-3.5 w-3.5 animate-spin text-blue-500"}),c.jsxs("span",{className:"text-sm font-medium",children:[e.length," active ",e.length===1?"thread":"threads"]})]})}),c.jsx("div",{className:"max-h-[min(28rem,70vh)] overflow-y-auto",children:e.map(u=>{const d=t(u),h=(d==null?void 0:d.name)??H1(u)??"Unknown repo";return c.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-3 border-b px-3 py-3 last:border-b-0",children:[c.jsxs("button",{type:"button",className:"min-w-0 text-left transition-colors hover:text-foreground",onClick:()=>{a(!1),r(u.id)},children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[c.jsx(Jx,{status:u.status}),c.jsx("span",{className:"truncate text-sm font-medium",children:Xx(u.title)?"Generating title...":u.title.replace(/^\[.*?\]\s*/,"")})]}),c.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1 text-[11px] text-muted-foreground",children:[c.jsx("span",{className:"truncate",children:h}),u.branch&&c.jsx(Rt,{variant:"outline",className:"h-4 px-1 py-0 font-mono text-[9px]",children:u.branch}),c.jsx(sP,{prState:u.prState})]})]}),c.jsxs("div",{className:"flex items-center gap-1 self-start",children:[d&&c.jsx("div",{onClick:y=>y.stopPropagation(),onMouseDown:y=>y.stopPropagation(),children:c.jsx(Dx,{threadId:u.id,cwd:u.workingDirectory??d.localPath,branch:u.branch,baseBranch:d.defaultBranch,threadTitle:u.title,threadStatus:u.status,prUrl:u.prUrl,prState:u.prState,ghAvailable:n,showStatusBadge:!1})}),c.jsx(Ee,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-lg",onClick:y=>{y.stopPropagation(),Promise.resolve(i(u.id))},title:"Stop thread",children:c.jsx(ed,{className:"h-3 w-3"})})]})]},u.id)})})]})]})}function $he(){var Mp,cr,Eo,Cu,ju,ku;const[e,t]=g.useState(""),[n,r]=g.useState(!1),[i,o]=g.useState(null),[a,u]=g.useState("chat"),[d,h]=g.useState("system"),[y,p]=g.useState(()=>localStorage.getItem("showSessionsSidebar")==="true"),[v,b]=g.useState(!1),[w,S]=g.useState(!1),[C,j]=g.useState(!1),[E,N]=g.useState(!1),[P,I]=g.useState(()=>localStorage.getItem("showWorkspaceTree")!=="false"),[R,$]=g.useState(()=>localStorage.getItem("showWorkspaceEditor")!=="false"),[X,G]=g.useState(!1),D=g.useRef(null),[q,F]=g.useState(()=>localStorage.getItem("showDebugPanel")==="true"),[V,W]=g.useState(280),[L,O]=g.useState({x:-1,y:-1}),[H,B]=g.useState({w:420,h:320}),U=g.useRef(null),A=g.useRef(null),[M,Q]=g.useState(!1),[T,ie]=g.useState(()=>localStorage.getItem("chatMode")||"agent"),[oe,te]=g.useState(()=>localStorage.getItem("chatProvider")||"jait"),[re,J]=g.useState(()=>localStorage.getItem("cliModel")||null),[Y,ce]=g.useState(()=>localStorage.getItem("viewMode")||"developer"),[ke,je]=g.useState("idle"),[Oe,Be]=g.useState("idle"),nt=g.useRef(Y),[at,Ue]=g.useState(""),[kt,ut]=g.useState(""),[We,ft]=g.useState(""),[Ge,_e]=g.useState(""),[ye,xe]=g.useState(""),[Z,le]=g.useState("login"),[ve,ae]=g.useState(()=>ha()??""),he=!!window.jaitDesktop||!!window.Capacitor,Ce=!!window.jaitDesktop,Xe=!!window.Capacitor,Pe=Ce?"electron":Xe?"capacitor":"web",[$e,Je]=g.useState(null),[qe,It]=g.useState(!1),[ct,Ze]=g.useState(!1),[wt,Gt]=g.useState(null),[Gn,Ke]=g.useState(!1),[ze,st]=g.useState(()=>he&&!w6()?"url":"auth"),[yt,Mt]=g.useState(!1),[Yn,Pt]=g.useState(null),[_n,Os]=g.useState([]),[Xn,bn]=g.useState(null),[Ns,Er]=g.useState([]),[xn,Oa]=g.useState(null),[Ji,wn]=g.useState(!1),zn=g.useRef(!1),oi=g.useRef(null),Zi=g.useRef(null),or=vx(),[F1,sp]=g.useState(0),Ei=!or&&C,jl=or&&C,Ts=g.useCallback(()=>({x:window.innerWidth-H.w-16,y:window.innerHeight-H.h-16}),[H]),po=g.useCallback(K=>{K.preventDefault();const me=L.x<0?Ts():L;U.current={startX:K.clientX,startY:K.clientY,posX:me.x,posY:me.y};const Ne=ot=>{U.current&&O({x:Math.max(0,Math.min(window.innerWidth-100,U.current.posX+ot.clientX-U.current.startX)),y:Math.max(0,Math.min(window.innerHeight-40,U.current.posY+ot.clientY-U.current.startY))})},He=()=>{U.current=null,document.removeEventListener("mousemove",Ne),document.removeEventListener("mouseup",He),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="move",document.body.style.userSelect="none",document.addEventListener("mousemove",Ne),document.addEventListener("mouseup",He)},[L,Ts]),kl=g.useCallback(K=>{K.preventDefault(),K.stopPropagation(),A.current={startX:K.clientX,startY:K.clientY,w:H.w,h:H.h};const me=He=>{A.current&&B({w:Math.max(280,Math.min(window.innerWidth-40,A.current.w+He.clientX-A.current.startX)),h:Math.max(200,Math.min(window.innerHeight-40,A.current.h+He.clientY-A.current.startY))})},Ne=()=>{A.current=null,document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",Ne),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="nwse-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",me),document.addEventListener("mouseup",Ne)},[H]),{user:lr,token:Qe,settings:Hr,isLoading:El,isAuthenticated:Fr,login:mo,register:U1,logout:op,bindSession:cu,updateSettings:Ol,clearSessionArchive:Na}=phe(),go=g.useCallback(async()=>{if(Qe){It(!0);try{const K=await fetch(`${yi}/api/update/check`,{headers:{Authorization:`Bearer ${Qe}`}});K.ok&&Je(await K.json())}catch{}It(!1)}},[Qe]),Oi=g.useCallback(async()=>{if(!(!Qe||!($e!=null&&$e.hasUpdate))){Ze(!0);try{const K=await fetch(`${yi}/api/update/apply`,{method:"POST",headers:{Authorization:`Bearer ${Qe}`,"Content-Type":"application/json"},body:JSON.stringify({version:$e.latestVersion})});if(K.ok)ms.success(`Updated to v${$e.latestVersion}. Gateway is restarting...`);else{const me=await K.json().catch(()=>({}));ms.error(me.error??"Update failed")}}catch{ms.error("Update request failed")}Ze(!1)}},[Qe,$e]);g.useEffect(()=>{Qe&&go()},[Qe,go]);const gr=g.useCallback(()=>r(!0),[]),{sessions:lp,activeSessionId:tt,createSession:Qi,switchSession:ap,archiveSession:Ta,fetchSessions:V1}=vhe(Qe,gr),{messages:Pn,isLoading:es,remainingPrompts:yo,error:Ni,hitMaxRounds:vo,pendingPlan:uu,todoList:fu,changedFiles:Jn,messageQueue:cp,contextUsage:up,sendMessage:Nl,restartFromMessage:Pa,cancelRequest:fp,clearMessages:dp,continueChat:Aa,executePlan:Ti,rejectPlan:du,enqueueMessage:Ra,dequeueMessage:_o,updateQueueItem:bo,acceptFile:Ma,rejectFile:hu,acceptAllFiles:hp,rejectAllFiles:Tl,setTodoList:ar,addChangedFile:xo,setChangedFiles:Pi,setOnChangedFilesSync:li,refreshMessages:pu}=ghe(tt,Qe,gr),{terminals:ts,activeTerminalId:ns,setActiveTerminalId:Ai,createTerminal:Ps,killTerminal:mu,refresh:Zn}=uhe(),{provider:As,model:Rs}=yhe(),wo=Vce({token:Qe}),Le=Phe(),So=g.useMemo(()=>xoe(Le.activities),[Le.activities]),Ms=g.useMemo(()=>[...Le.threads].sort((K,me)=>new Date(me.updatedAt).getTime()-new Date(K.updatedAt).getTime()),[Le.threads]),Co=g.useMemo(()=>Ms.filter(K=>K.status==="running"),[Ms]),Da=Le.selectedRepo!=null,gu=Le.creating||!Da,W1=Le.selectedRepo?"Describe what you want to do...":"Select a repository to start a thread...",[zt,Ri]=g.useState(null);g.useEffect(()=>{var Ne,He,ot;const K=window.jaitDesktop;if(!K)return;(Ne=K.getInfo)==null||Ne.call(K).then(At=>Gt(At.platform)),(He=K.windowIsMaximized)==null||He.call(K).then(At=>Ke(At));const me=(ot=K.onMaximizedChange)==null?void 0:ot.call(K,(At,Jt)=>Ke(Jt));return()=>{me==null||me()}},[]);const Mi=g.useRef(!1);g.useEffect(()=>{Mi.current=!1},[tt]);const[jo,Di]=Rf(tt,"workspace.panel",Qe),[La,rs]=Rf(tt,"screen-share.panel",Qe),[za,Ds]=Rf(tt,"terminal.panel",Qe),[$a]=Rf(tt,"todo_list",Qe),[Ia]=Rf(tt,"changed_files",Qe);g.useEffect(()=>{Mi.current||jo&&(zt||jo.open&&jo.remotePath&&Ri({surfaceId:jo.surfaceId??"",workspaceRoot:jo.remotePath}))},[jo]),g.useEffect(()=>{Mi.current||La!=null&&La.open&&N(!0)},[La]),g.useEffect(()=>{Mi.current||za!=null&&za.open&&b(!0)},[za]),g.useEffect(()=>{Mi.current||$a&&$a.length>0&&ar($a)},[$a,ar]),g.useEffect(()=>{if(!Mi.current&&Ia&&Ia.length>0)for(const K of Ia)xo(K.path,K.name)},[Ia,xo]);const q1=g.useCallback((K,me)=>{switch(K){case"workspace.panel":{if(!me)j(!1),Ri(null);else{const Ne=me;Ne.open?(j(!0),Ne.remotePath&&Ri({surfaceId:Ne.surfaceId??"",workspaceRoot:Ne.remotePath})):j(!1)}break}case"screen-share.panel":N(me?me.open!==!1:!1);break;case"terminal.panel":b(me?me.open!==!1:!1);break;case"todo_list":Array.isArray(me)&&ar(me);break;case"file_changed":{const Ne=me;Ne!=null&&Ne.path&&xo(Ne.path,Ne.name??Ne.path.split("/").pop()??Ne.path);break}case"changed_files":{Array.isArray(me)?Pi(me):me===null&&Pi([]);break}}},[ar,xo,Pi]),K1=g.useCallback(K=>{Mi.current=!0;const me=K["workspace.panel"];me&&me.open?(j(!0),me.remotePath&&Ri({surfaceId:me.surfaceId??"",workspaceRoot:me.remotePath})):(j(!1),Ri(null));const Ne=K["screen-share.panel"];Ne&&Ne.open!==!1?N(!0):N(!1);const He=K["terminal.panel"];He&&He.open!==!1?b(!0):b(!1);const ot=K.todo_list;Array.isArray(ot)&&ot.length>0&&ar(ot);const At=K.changed_files;Array.isArray(At)&&Pi(At)},[ar,Pi]),{sendUIState:An}=Che({sessionId:tt,token:Qe,onStateSync:q1,onFullState:K1,onMessageComplete:pu,onThreadEvent:Le.handleThreadEvent,onFsChanges:g.useCallback(K=>{sp(me=>me+1)},[]),listeners:{"workspace.open":g.useCallback(K=>{j(!0),Ri({surfaceId:K.surfaceId,workspaceRoot:K.workspaceRoot});const me={open:!0,remotePath:K.workspaceRoot,surfaceId:K.surfaceId};Di(me)},[Di]),"workspace.close":g.useCallback(()=>{j(!1),Ri(null),Di(null)},[Di]),"terminal.focus":g.useCallback(K=>{u("chat"),b(!0),Ds({open:!0}),K.terminalId&&Ai(K.terminalId),K.reason==="interactive-input-required"&&ms(K.message??"Terminal wartet auf deine Eingabe (z. B. sudo Passwort).",{description:"Klicke ins Terminal und gib die erforderliche Eingabe ein.",duration:1e4})},[Ds,Ai]),"screen-share.open":g.useCallback(()=>{N(!0),rs({open:!0})},[rs]),"screen-share.close":g.useCallback(()=>{N(!1),rs(null)},[rs])}});g.useEffect(()=>(li(K=>{An("changed_files",K,tt)}),()=>li(null)),[An,tt,li]),g.useEffect(()=>{localStorage.setItem("showSessionsSidebar",y?"true":"false")},[y]),g.useEffect(()=>{localStorage.setItem("showDebugPanel",q?"true":"false")},[q]),g.useEffect(()=>{localStorage.setItem("chatMode",T)},[T]),g.useEffect(()=>{re?localStorage.setItem("cliModel",re):localStorage.removeItem("cliModel")},[re]);const pp=g.useRef(!1);g.useEffect(()=>{if(localStorage.setItem("chatProvider",oe),!pp.current){pp.current=!0;return}Qe&&Ol({chat_provider:oe})},[oe]),g.useEffect(()=>{localStorage.setItem("viewMode",Y)},[Y]),g.useEffect(()=>{nt.current!=="manager"&&Y==="manager"?(je("center"),requestAnimationFrame(()=>{document.body.offsetHeight,requestAnimationFrame(()=>je("top"))})):(nt.current==="manager"&&Y==="developer"&&Be("animating"),je("idle")),nt.current=Y},[Y]),g.useEffect(()=>{Y==="manager"&&q&&F(!1)},[Y,q]);const G1=g.useCallback(()=>{N(!0),rs({open:!0}),An("screen-share.panel",{open:!0},tt)},[rs,An,tt]),mp=g.useCallback(()=>{N(!1),rs(null),An("screen-share.panel",null,tt)},[rs,An,tt]),Pl=g.useCallback(()=>{b(!0),Ds({open:!0}),An("terminal.panel",{open:!0},tt)},[Ds,An,tt]),Al=g.useCallback(()=>{b(!1),Ds(null),An("terminal.panel",null,tt)},[Ds,An,tt]),yu=g.useCallback(()=>{j(!1),Ri(null),Di(null),An("workspace.panel",null,tt)},[Di,An,tt]),gp=g.useCallback(()=>{I(K=>{const me=!K;return localStorage.setItem("showWorkspaceTree",String(me)),me})},[]),yp=g.useCallback(()=>{$(K=>{const me=!K;return localStorage.setItem("showWorkspaceEditor",String(me)),me})},[]),vp=g.useCallback(()=>{I(!0),localStorage.setItem("showWorkspaceTree","true")},[]),_p=g.useCallback(()=>{$(!0),localStorage.setItem("showWorkspaceEditor","true")},[]),bp=g.useCallback(async(K,me)=>{const Ne=await fetch(`${yi}/api/workspace/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:K,sessionId:tt,nodeId:me||"gateway"})});if(!Ne.ok){const He=await Ne.json().catch(()=>({message:"Unknown error"}));throw new Error(He.message??"Failed to open workspace")}},[tt]),Y1=g.useCallback(async()=>{if(C){if(Jn.length>0){G(!0);return}yu();return}if(zt){j(!0);const K={open:!0,remotePath:zt.workspaceRoot,surfaceId:zt.surfaceId};Di(K),An("workspace.panel",K,tt);return}wn(!0)},[C,zt,yu,Di,An,tt,bp,Jn.length]);g.useEffect(()=>{zt&&(C||j(!0))},[zt]),g.useEffect(()=>{if(!(zt!=null&&zt.surfaceId)||!zt.workspaceRoot||!tt)return;let K=!1;return(async()=>{try{if((await fetch(`${yi}/api/workspace/list?path=${encodeURIComponent(zt.workspaceRoot)}&surfaceId=${encodeURIComponent(zt.surfaceId)}`)).ok||K)return;const Ne=await fetch(`${yi}/api/workspace/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:zt.workspaceRoot,sessionId:tt})});if(!Ne.ok||K)return;const He=await Ne.json();if(K)return;Ri({surfaceId:He.surfaceId,workspaceRoot:He.workspaceRoot});const ot={open:!0,remotePath:He.workspaceRoot,surfaceId:He.surfaceId};Di(ot),An("workspace.panel",ot,tt)}catch{}})(),()=>{K=!0}},[zt==null?void 0:zt.surfaceId,tt]),g.useEffect(()=>{Jn.length!==0&&(C||j(!0))},[Jn.length]);const xp=g.useMemo(()=>Jn.filter(K=>K.state==="undecided").map(K=>K.path),[Jn]);g.useEffect(()=>{h(Hr.theme)},[Hr.theme]),g.useEffect(()=>{El||Hr.chat_provider&&Hr.chat_provider!==oe&&te(Hr.chat_provider)},[Hr.chat_provider,El]),g.useEffect(()=>{var Ne,He;if(i7(d),Ce&&wt==="win32"){const ot=d==="dark"||d==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches;(He=(Ne=window.jaitDesktop)==null?void 0:Ne.setTitleBarOverlay)==null||He.call(Ne,{color:ot?"#202020":"#e8ecf1",symbolColor:ot?"#f2f2f2":"#0a0a0a",height:39})}const K=window.matchMedia("(prefers-color-scheme: dark)"),me=()=>{var ot,At;if(d==="system"&&i7("system"),Ce&&wt==="win32"){const Jt=K.matches;(At=(ot=window.jaitDesktop)==null?void 0:ot.setTitleBarOverlay)==null||At.call(ot,{color:Jt?"#202020":"#e8ecf1",symbolColor:Jt?"#f2f2f2":"#0a0a0a",height:39})}};return K.addEventListener("change",me),()=>K.removeEventListener("change",me)},[d,wt]),g.useEffect(()=>{if(!El&&!Fr){const K=requestAnimationFrame(()=>r(!0));return he&&w6()&&fetch(`${cn()}/health`,{signal:AbortSignal.timeout(4e3)}).then(me=>{if(!me.ok)throw new Error("unhealthy")}).catch(()=>{st("url"),Pt("Gateway is unreachable. Check the URL or try a different one."),ae(ha()??"")}),()=>cancelAnimationFrame(K)}},[El,Fr]),g.useEffect(()=>{Fr&&tt&&cu(tt)},[Fr,tt,cu]),g.useEffect(()=>{if(Ni==="login_required"){const K=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(K)}},[Ni]),g.useEffect(()=>{(async()=>{if(!tt){Q(!1);return}try{const Ne=await(await fetch(`${yi}/api/consent/pending/${tt}/approve-all`)).json();Q(Ne.approveAllEnabled===!0)}catch{Q(!1)}})()},[tt]);const vu=g.useCallback(async K=>{const me=d;h(K);try{await Ol({theme:K})}catch{h(me)}},[d,Ol]),Rl=g.useCallback(K=>{K.preventDefault(),zn.current=!0;const me=K.clientY,Ne=V,He=window.innerHeight*.5,ot=Jt=>{if(!zn.current)return;const on=me-Jt.clientY;W(Math.min(He,Math.max(280,Ne+on)))},At=()=>{zn.current=!1,document.removeEventListener("mousemove",ot),document.removeEventListener("mouseup",At),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",ot),document.addEventListener("mouseup",At)},[V]),Ba=g.useCallback(async(K=null)=>{const me=await Zn();if(K&&me.some(ot=>ot.id===K))return Ai(K),K;if(ns&&me.some(He=>He.id===ns))return ns;if(me.length>0){const He=me[me.length-1].id;return Ai(He),He}return(await Ps(tt??"default")).id},[Zn,Ai,ns,Ps,tt]),wp=g.useCallback(async K=>{u("chat"),Pl(),await Ba(K)},[Ba,Pl]),Sp=g.useCallback(async()=>{if(v){Al();return}u("chat"),Pl(),await Ba()},[v,Ba,Pl,Al]),Cp=g.useCallback(async K=>{var Ne;const me=ts.length===1&&((Ne=ts[0])==null?void 0:Ne.id)===K;await mu(K),me&&Al()},[ts,mu,Al]),ko=g.useCallback(K=>{K.length!==0&&(Os(me=>{const Ne=[...me];for(const He of K){const ot=Ne.findIndex(At=>At.path===He.path);ot>=0?Ne[ot]=He:Ne.push(He)}return Ne}),bn(me=>{var Ne;return me??((Ne=K[0])==null?void 0:Ne.id)??null}))},[]),jp=g.useCallback(async K=>{var me;try{const Ne={};Qe&&(Ne.Authorization=`Bearer ${Qe}`);const He=await fetch(`${yi}/api/workspace/backup?path=${encodeURIComponent(K)}`,{headers:Ne});if(He.ok){const $n=await He.json(),Ur=K.split(/[\/\\]/).pop()??K;Oa({filePath:$n.path,originalContent:$n.originalContent??"",modifiedContent:$n.currentContent,language:vg(Ur)}),C||j(!0);return}const ot=await((me=oi.current)==null?void 0:me.readFileByPath(K));if(ot){ko([ot]),bn(ot.id),C||j(!0);return}const At=await fetch(`${yi}/api/workspace/read?path=${encodeURIComponent(K)}`,{headers:Ne});if(!At.ok)return;const Jt=await At.json(),on=K.split("/").pop()??K,Sn={id:`changed-${K}`,name:on,path:Jt.path,content:Jt.content,language:vg(on)};ko([Sn]),bn(Sn.id),C||j(!0)}catch{}},[Qe,C,ko]),Ls=g.useCallback(()=>{Oa(null)},[]),kp=g.useCallback(async K=>{if(!xn)return;const me=xn.filePath;try{const Ne={"Content-Type":"application/json"};Qe&&(Ne.Authorization=`Bearer ${Qe}`),await fetch(`${yi}/api/workspace/apply-diff`,{method:"POST",headers:Ne,body:JSON.stringify({path:me,content:K})})}catch{}Ma(me),Oa(null)},[xn,Qe,Ma]),Ep=g.useCallback(async K=>{const me=Array.from(K),Ne=await Promise.all(me.filter(He=>He.size<1024*1024).map(async He=>{const ot=await He.text(),At=He.webkitRelativePath||He.name;return{id:`${At}-${He.lastModified}`,name:He.name,path:At,content:ot,language:vg(At)}}));ko(Ne)},[ko]),Op=g.useCallback(async(K,me,Ne)=>{var He;return((He=oi.current)==null?void 0:He.searchFiles(K,me,Ne))??[]},[]),_u=g.useCallback(K=>{e.trim()&&(Ra(e.trim()),t(""))},[e,Ra]),Ml=async K=>{var Jt;if(Y==="manager")return Dl();if(!e.trim()&&(!K||K.length===0))return;if(!Qe){r(!0);return}let me=tt;if(!me){const on=await Qi();me=(on==null?void 0:on.id)??null}if(!me)return;const Ne=[];if(K!=null&&K.length){const on=new Set;for(const Sn of K){if(on.has(Sn.path))continue;on.add(Sn.path);const $n=_n.find(Ur=>Ur.path===Sn.path);if($n)Ne.push({path:$n.path,content:$n.content});else{const Ur=await((Jt=oi.current)==null?void 0:Jt.readFileByPath(Sn.path));Ur&&Ne.push({path:Ur.path,content:Ur.content})}}}const He=Ne.length>0?`${e.trim()}
|
|
727
|
+
`);nt=kt.pop()||"";for(const ut of kt)if(ut.startsWith("data: "))try{const We=JSON.parse(ut.slice(6));We.type==="plan_action_start"?a(ft=>ft?{...ft,actions:ft.actions.map(Ge=>Ge.id===We.action_id?{...Ge,status:"approved"}:Ge)}:null):We.type==="plan_action_result"?a(ft=>ft?{...ft,actions:ft.actions.map(Ge=>Ge.id===We.action_id?{...Ge,status:We.ok?"executed":"failed",result:{ok:We.ok,message:We.message,data:We.data}}:Ge)}:null):We.type==="plan_execution_complete"&&setTimeout(()=>a(null),2e3)}catch{}}}catch(je){i(Oe=>({...Oe,error:je instanceof Error?je.message:"Plan execution failed"}))}},[t,o]),te=g.useCallback(async()=>{const J=j.current;if(!J||!o)return;const Y={"Content-Type":"application/json"};t&&(Y.Authorization=`Bearer ${t}`);try{await fetch(`${Ii}/api/sessions/${J}/plan/reject`,{method:"POST",headers:Y}),a(null)}catch{a(null)}},[t,o]),re=g.useCallback((J,Y)=>{y(ce=>ce.some(ke=>ke.path===J)?ce:[...ce,{path:J,name:Y,state:"undecided"}])},[]);return{messages:r.messages,isLoading:r.isLoading,isLoadingHistory:r.isLoadingHistory,remainingPrompts:r.remainingPrompts,error:r.error,hitMaxRounds:r.hitMaxRounds,pendingPlan:o,todoList:u,changedFiles:h,messageQueue:p,contextUsage:b,sendMessage:X,restartFromMessage:ie,cancelRequest:M,clearMessages:Q,continueChat:T,executePlan:oe,rejectPlan:te,enqueueMessage:G,dequeueMessage:D,updateQueueItem:q,acceptFile:H,rejectFile:B,acceptAllFiles:U,rejectAllFiles:A,setTodoList:d,addChangedFile:re,setChangedFiles:y,setOnChangedFilesSync:L,refreshMessages:$}}function yhe(){const[e,t]=g.useState(null),[n,r]=g.useState(null),[i,o]=g.useState(null),[a,u]=g.useState(!0);return g.useEffect(()=>{let d=!1;return fetch(`${cn()}/health`).then(h=>h.json()).then(h=>{d||(t(h.provider??null),r(h.model??null),o(h.ollamaUrl??null))}).catch(()=>{}).finally(()=>{d||u(!1)}),()=>{d=!0}},[]),{provider:e,model:n,ollamaUrl:i,loading:a}}const lg=cn();function ag(e){return e?{Authorization:`Bearer ${e}`}:{}}function vhe(e,t){const[n,r]=g.useState([]),[i,o]=g.useState(null),[a,u]=g.useState(!0),d=g.useCallback(async()=>{if(!e){r(v=>v.length===0?v:[]),o(null),u(!1);return}u(!0);try{const[v,b]=await Promise.all([fetch(`${lg}/api/sessions?status=active`,{headers:ag(e)}),fetch(`${lg}/api/sessions/last-active`,{headers:ag(e)})]);if((v.status===401||b.status===401)&&(t==null||t()),v.ok){const w=await v.json();r(w.sessions)}if(b.ok){const w=await b.json();w.session&&o(S=>S??w.session.id)}}catch(v){console.error("Failed to fetch sessions:",v)}finally{u(!1)}},[t,e]),h=g.useCallback(async v=>{if(!e)return t==null||t(),null;try{const b=await fetch(`${lg}/api/sessions`,{method:"POST",headers:{...ag(e),"Content-Type":"application/json"},body:JSON.stringify({name:v||`Session ${new Date().toLocaleString()}`})});if(b.status===401)return t==null||t(),null;if(b.ok){const w=await b.json();return r(S=>[w,...S]),o(w.id),w}}catch(b){console.error("Failed to create session:",b)}return null},[t,e]),y=g.useCallback(v=>{o(v)},[]),p=g.useCallback(async v=>{if(!e){t==null||t();return}try{if((await fetch(`${lg}/api/sessions/${v}/archive`,{method:"POST",headers:ag(e)})).status===401){t==null||t();return}r(w=>w.filter(S=>S.id!==v)),i===v&&o(null)}catch(b){console.error("Failed to archive session:",b)}},[i,t,e]);return g.useEffect(()=>{d()},[d]),{sessions:n,activeSessionId:i,loading:a,fetchSessions:d,createSession:h,switchSession:y,archiveSession:p}}const _he=Kh();function Fi(){return typeof window<"u"&&window.jaitDesktop?"electron":typeof window<"u"&&"Capacitor"in window?"capacitor":"web"}function bhe(){const e=Fi(),t=`jait-device-id-${e}`,n=localStorage.getItem(t);if(n)return n;const r=`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return localStorage.setItem(t,r),r}function xhe(){const e=Fi(),t=navigator.userAgent;return e==="electron"?`Desktop (${navigator.platform})`:e==="capacitor"?"Mobile":t.includes("Chrome")?`Chrome (${navigator.platform})`:t.includes("Firefox")?`Firefox (${navigator.platform})`:t.includes("Safari")?`Safari (${navigator.platform})`:`Browser (${navigator.platform})`}function whe(){var t;const e=Fi();if(e==="capacitor")return"android";if(e==="electron"){const n=((t=navigator.platform)==null?void 0:t.toLowerCase())??"";return n.includes("win")?"windows":n.includes("mac")?"macos":"linux"}return"web"}function She(){const e=Fi();return e==="electron"||e==="capacitor"}function Che(e){const{listeners:t,sessionId:n,token:r,onStateSync:i,onFullState:o,onMessageComplete:a,onThreadEvent:u,onFsChanges:d}=e,h=g.useRef(t);h.current=t;const y=g.useRef(i);y.current=i;const p=g.useRef(o);p.current=o;const v=g.useRef(a);v.current=a;const b=g.useRef(u);b.current=u;const w=g.useRef(d);w.current=d;const S=g.useRef(null),C=g.useRef(null),j=g.useRef(!0),E=g.useRef(r);E.current=r;const N=g.useRef(n);N.current=n;const P=g.useRef([]),I=g.useCallback(L=>{for(;P.current.length>0&&L.readyState===WebSocket.OPEN;){const O=P.current.shift();L.send(O)}},[]),R=g.useCallback((L,O)=>{!O||L.readyState!==WebSocket.OPEN||(L.send(JSON.stringify({type:"subscribe",sessionId:O})),C.current=O)},[]),$=g.useCallback(L=>{var O,H,B;try{const U=JSON.parse(L.data);if(U.type==="ui.command"){const A=U.payload,M=h.current[A.command];M&&M(A.data)}else if(U.type==="ui.state-sync"){const A=U.payload;A!=null&&A.key&&y.current&&y.current(A.key,A.value??null)}else if(U.type==="ui.full-state"){const A=U.payload;A&&p.current&&p.current(A)}else if(U.type==="message.complete")(O=v.current)==null||O.call(v);else if(U.type==="fs.changes"){const A=U.payload;(H=w.current)==null||H.call(w,A)}else U.type==="fs.browse-request"?D(U.payload):U.type==="fs.roots-request"?q(U.payload):U.type==="fs.op-request"?F(U.payload):U.type==="provider.op-request"?V(U.payload):(U.type.startsWith("thread.")||U.type.startsWith("repo."))&&((B=b.current)==null||B.call(b,U.type,U.payload))}catch{}},[]),X=g.useCallback(async L=>{const{Filesystem:O,Directory:H}=await QY(async()=>{const{Filesystem:oe,Directory:te}=await import("./index-IfvhKb-G.js").then(re=>re.i);return{Filesystem:oe,Directory:te}},[],import.meta.url);let B,U=L;L==="~"||L==="/storage"||L==="/"?(B=H.ExternalStorage,U=""):L.startsWith("/storage/emulated/0")&&(B=H.ExternalStorage,U=L.replace("/storage/emulated/0","").replace(/^\//,""));const A=await O.readdir({path:U||"",...B?{directory:B}:{}}),M=B===H.ExternalStorage?"/storage/emulated/0"+(U?"/"+U:""):L,Q=[];for(const oe of A.files)oe.name.startsWith(".")||Q.push({name:oe.name,path:M+"/"+oe.name,type:oe.type==="directory"?"dir":"file"});Q.sort((oe,te)=>oe.type!==te.type?oe.type==="dir"?-1:1:oe.name.localeCompare(te.name));const T=M.replace(/\/+$/,"").split("/"),ie=T.length>3?T.slice(0,-1).join("/"):null;return{path:M,parent:ie,entries:Q}},[]),G=g.useCallback(async()=>[{name:"Internal Storage",path:"/storage/emulated/0",type:"dir"},{name:"Documents",path:"/storage/emulated/0/Documents",type:"dir"},{name:"Downloads",path:"/storage/emulated/0/Download",type:"dir"},{name:"Home",path:"/storage/emulated/0",type:"dir"}],[]),D=g.useCallback(async L=>{var U;const O=S.current;if(!O||O.readyState!==WebSocket.OPEN)return;const{requestId:H,path:B}=L;try{let A;const M=Fi();if(M==="electron"&&((U=window.jaitDesktop)!=null&&U.browsePath))A=await window.jaitDesktop.browsePath(B);else if(M==="capacitor")A=await X(B);else throw new Error("Local filesystem browsing not supported on this platform");O.send(JSON.stringify({type:"fs.browse-response",payload:{requestId:H,path:A.path,parent:A.parent,entries:A.entries}}))}catch(A){O.send(JSON.stringify({type:"fs.browse-response",payload:{requestId:H,error:A instanceof Error?A.message:"Browse failed"}}))}},[X]),q=g.useCallback(async L=>{var B;const O=S.current;if(!O||O.readyState!==WebSocket.OPEN)return;const{requestId:H}=L;try{let U;const A=Fi();if(A==="electron"&&((B=window.jaitDesktop)!=null&&B.getRoots))U=(await window.jaitDesktop.getRoots()).roots;else if(A==="capacitor")U=await G();else throw new Error("Local filesystem browsing not supported on this platform");O.send(JSON.stringify({type:"fs.roots-response",payload:{requestId:H,roots:U}}))}catch(U){O.send(JSON.stringify({type:"fs.roots-response",payload:{requestId:H,error:U instanceof Error?U.message:"Roots request failed"}}))}},[G]),F=g.useCallback(async L=>{var A;const O=S.current;if(!O||O.readyState!==WebSocket.OPEN)return;const{requestId:H,op:B,...U}=L;try{const M=Fi();if(M==="electron"&&((A=window.jaitDesktop)!=null&&A.fsOp)){const Q=await window.jaitDesktop.fsOp(B,U);O.send(JSON.stringify({type:"fs.op-response",payload:{requestId:H,result:Q}}))}else throw M==="capacitor"?new Error("Full filesystem operations not yet supported on mobile"):new Error("Filesystem operations not supported on this platform")}catch(M){O.send(JSON.stringify({type:"fs.op-response",payload:{requestId:H,error:M instanceof Error?M.message:"Filesystem operation failed"}}))}},[]),V=g.useCallback(async L=>{var A;const O=S.current;if(!O||O.readyState!==WebSocket.OPEN)return;const{requestId:H,op:B,...U}=L;try{if(Fi()==="electron"&&((A=window.jaitDesktop)!=null&&A.providerOp)){const Q=await window.jaitDesktop.providerOp(B,U);O.send(JSON.stringify({type:"provider.op-response",payload:{requestId:H,result:Q}}))}else throw new Error("Provider operations not supported on this platform")}catch(M){O.send(JSON.stringify({type:"provider.op-response",payload:{requestId:H,error:M instanceof Error?M.message:"Provider operation failed"}}))}},[]);return g.useEffect(()=>{var B;j.current=!0;let L=null;const O=()=>{if(!j.current)return;const U=new WebSocket(`${_he}?token=${E.current??"dev"}`);S.current=U,U.onopen=()=>{const A=N.current;A&&R(U,A),I(U),She()&&(async()=>{var Q;if(Fi()==="electron"&&((Q=window.jaitDesktop)!=null&&Q.detectProviders))try{return await window.jaitDesktop.detectProviders()}catch{return[]}return[]})().then(Q=>{const T=JSON.stringify({type:"fs.register-node",payload:{id:bhe(),name:xhe(),platform:whe(),providers:Q}});U.readyState===WebSocket.OPEN&&U.send(T)})},U.onmessage=$,U.onclose=()=>{S.current=null,C.current=null,j.current&&(L=setTimeout(O,1e3))},U.onerror=()=>{}};O();const H=(U,A)=>{if((A==null?void 0:A.type)==="provider.event-from-child"){const M=S.current;M&&M.readyState===WebSocket.OPEN&&M.send(JSON.stringify({type:"provider.event",payload:{sessionId:A.sessionId,event:A.notification}}))}};return Fi()==="electron"&&((B=window.jaitDesktop)!=null&&B.onGatewayEvent)&&window.jaitDesktop.onGatewayEvent(H),()=>{var A;j.current=!1,L&&clearTimeout(L),Fi()==="electron"&&((A=window.jaitDesktop)!=null&&A.removeGatewayEventListener)&&window.jaitDesktop.removeGatewayEventListener();const U=S.current;U&&(U.onclose=null,U.close(),S.current=null)}},[r]),g.useEffect(()=>{const L=S.current;L&&L.readyState===WebSocket.OPEN&&n!==C.current&&R(L,n??null),N.current=n??null},[n,R]),{sendUIState:g.useCallback((L,O,H)=>{const B=JSON.stringify({type:"ui.state",payload:{sessionId:H??"",key:L,value:O}}),U=S.current;U&&U.readyState===WebSocket.OPEN?U.send(B):P.current.push(B)},[])}}const n7=cn();function r7(e){const t={"Content-Type":"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}function Rf(e,t,n){const[r,i]=g.useState(null),[o,a]=g.useState(!1),u=g.useRef(null),d=g.useRef(null);g.useEffect(()=>{if(!e||!n){i(null);return}let y=!1;return a(!0),fetch(`${n7}/api/sessions/${e}/state?keys=${encodeURIComponent(t)}`,{headers:r7(n)}).then(p=>p.ok?p.json():null).then(p=>{if(y)return;const v=(p==null?void 0:p[t])??null;i(v),d.current=v}).catch(()=>{y||i(null)}).finally(()=>{y||a(!1)}),()=>{y=!0}},[e,t,n]);const h=g.useCallback(y=>{i(y),d.current=y,!(!e||!n)&&(u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{fetch(`${n7}/api/sessions/${e}/state`,{method:"PATCH",headers:r7(n),body:JSON.stringify({[t]:d.current})}).catch(()=>{})},300))},[e,t,n]);return g.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]),[r,h,o]}function e1(e){return e.replace(/\\/g,"/").replace(/\/+$/,"")}function jhe(e){const n=e1(e).split("/").filter(Boolean);return n[n.length-1]??e}function khe(e){var n;const t=e.match(/^\[([^\]]+)\]/);return((n=t==null?void 0:t[1])==null?void 0:n.trim())||null}function nP(e){if(!e)return null;const n=e1(e).split("/").filter(Boolean),r=n.lastIndexOf("worktrees");return r===-1?null:n[r+1]??null}function H1(e){return khe(e.title)??nP(e.workingDirectory)??(e.workingDirectory?jhe(e.workingDirectory):null)}function c2(e,t){var u,d;const n=t.name.trim().toLowerCase(),r=(u=H1(e))==null?void 0:u.toLowerCase(),i=e.workingDirectory?e1(e.workingDirectory):null,o=e1(t.localPath);if(i&&(i===o||i.startsWith(`${o}/`)))return!0;const a=(d=nP(e.workingDirectory))==null?void 0:d.toLowerCase();return a&&a===n?!0:r===n}function Ehe(e,t){const n=[],r=new Set;for(const i of e){if(t.some(u=>c2(i,u)))continue;const o=H1(i),a=o==null?void 0:o.trim().toLowerCase();!o||!a||r.has(a)||(n.push({id:`shared:${a}`,name:o,defaultBranch:"main",localPath:i.workingDirectory??o,source:"shared"}),r.add(a))}return n}function Ohe(e){const n=e.replace(/\\/g,"/").split("/").filter(Boolean);return n[n.length-1]??e}function Nhe(){return`jait/${Math.random().toString(16).slice(2,10)}`}function rP(e){return[...e].sort((t,n)=>new Date(t.createdAt).getTime()-new Date(n.createdAt).getTime())}function The(e,t){if(t.length===0)return e;const n=new Map(e.map(r=>[r.id,r]));for(const r of t)n.set(r.id,r);return rP([...n.values()])}function cg(e,t){return{id:e.id,name:e.name,defaultBranch:e.defaultBranch,localPath:e.localPath,deviceId:e.deviceId,githubUrl:e.githubUrl,source:!e.deviceId||e.deviceId===t?"local":"shared"}}function Phe(e=!0){const t=g.useMemo(()=>tP(),[]),[n,r]=g.useState([]),[i,o]=g.useState(null),[a,u]=g.useState(!1),[d,h]=g.useState([]),[y,p]=g.useState(null),[v,b]=g.useState([]),[w,S]=g.useState({}),[C,j]=g.useState(!0),[E,N]=g.useState([]),[P,I]=g.useState(!1),[R,$]=g.useState(null),X=g.useRef(null),G=g.useRef(new Map),D=g.useMemo(()=>Ehe(d,n),[d,n]),q=g.useMemo(()=>[...n,...D],[n,D]),F=g.useMemo(()=>q.find(te=>te.id===i)??null,[q,i]),V=g.useMemo(()=>d.find(te=>te.id===y)??null,[d,y]),W=g.useCallback(te=>q.find(re=>c2(te,re))??null,[q]),L=g.useMemo(()=>V!=null&&F!=null&&(V.status==="completed"||!!V.prUrl),[V,F]);g.useEffect(()=>{var te;e&&(!i&&q.length>0&&o(q[0].id),i&&q.every(re=>re.id!==i)&&o(((te=q[0])==null?void 0:te.id)??null))},[q,i,e]),g.useEffect(()=>{if(!e||!V)return;const te=W(V);te&&te.id!==i&&o(te.id)},[e,W,i,V]);const O=g.useCallback(async()=>{if(localStorage.getItem("token")){I(!0);try{const[te,re,J]=await Promise.all([Hn.listThreads(),Hn.listProviders(),Hn.listRepos()]);h(te),N(re.providers),r(J.map(Y=>cg(Y,t))),$(null)}catch(te){$(te instanceof Error?te.message:"Failed to fetch data")}finally{I(!1)}}},[]);g.useEffect(()=>{e&&O()},[O,e]);const H=g.useRef(y);H.current=y;const B=g.useCallback((te,re)=>{switch(te){case"thread.created":{const J=re.thread;J&&h(Y=>Y.some(ce=>ce.id===J.id)?Y:[J,...Y]);break}case"thread.updated":{const J=re.thread;J&&h(Y=>Y.map(ce=>ce.id===J.id?J:ce));break}case"thread.deleted":{const J=re.threadId;J&&(G.current.delete(J),h(Y=>Y.filter(ce=>ce.id!==J)),H.current===J&&p(null));break}case"thread.status":{const J=re.threadId,Y=re.status,ce=re.thread;J&&Y&&h(ke=>ce?ke.some(Oe=>Oe.id===J)?ke.map(Oe=>Oe.id===J?ce:Oe):[ce,...ke]:ke.map(je=>je.id===J?{...je,status:Y,error:Y==="running"||Y==="completed"?re.error??null:re.error??je.error}:je));break}case"thread.activity":{const J=re.threadId,Y=re.activity;if(J&&Y){const ce=The(G.current.get(J)??[],[Y]);G.current.set(J,ce),J===H.current&&b(ce)}break}case"repo.created":{const J=re.repo;J&&r(Y=>Y.some(ce=>ce.id===J.id)?Y:[cg(J,t),...Y]);break}case"repo.updated":{const J=re.repo;J&&r(Y=>Y.map(ce=>ce.id===J.id?cg(J,t):ce));break}case"repo.deleted":{const J=re.repoId;J&&(r(Y=>Y.filter(ce=>ce.id!==J)),o(Y=>Y===J?null:Y));break}}},[]);g.useEffect(()=>{if(!e||!y){b([]);return}const te=G.current.get(y);if(te){b(te);return}b([]);let re=!1;return(async()=>{if(localStorage.getItem("token"))try{const Y=await Hn.getActivities(y);if(!re){const ce=rP(Y);G.current.set(y,ce),b(ce)}}catch{}})(),()=>{re=!0}},[y,e]),g.useEffect(()=>{var te;e&&((te=X.current)==null||te.scrollIntoView({behavior:"smooth"}))},[v,e]);const U=g.useMemo(()=>F?d.filter(te=>c2(te,F)):[],[d,F]),A=g.useRef(0);g.useEffect(()=>{if(!e||!F){S({});return}const te=++A.current,re=F.localPath,J=U,Y=Object.fromEntries(J.map(je=>[je.id,null])),ce=J.filter(je=>typeof je.branch=="string"&&je.branch.length>0);(async()=>{if(ce.length===0){te===A.current&&S(Y);return}const je=await Promise.allSettled(ce.map(async nt=>{var ut;const at=nt.workingDirectory??re,Ue=await ll.status(at,nt.branch??void 0),kt=((ut=Ue.pr)==null?void 0:ut.state)??null;if(Ue.pr&&(nt.prUrl!==Ue.pr.url||nt.prState!==Ue.pr.state||nt.prNumber!==Ue.pr.number))try{await Hn.updateThread(nt.id,{prUrl:Ue.pr.url,prNumber:Ue.pr.number,prTitle:Ue.pr.title,prState:Ue.pr.state})}catch{}return{threadId:nt.id,prState:kt,ghAvailable:Ue.ghAvailable}}));if(te!==A.current)return;const Oe={...Y};let Be=!1;for(const nt of je)nt.status==="fulfilled"&&(Oe[nt.value.threadId]=nt.value.prState,nt.value.ghAvailable&&(Be=!0));j(Be),S(Oe)})()},[e,U,F]);const M=g.useCallback(async te=>{const re=n.find(ce=>ce.localPath===te);if(re){o(re.id);return}let J="main",Y;try{const ce=await ll.status(te);ce.branch&&(J=ce.branch),ce.remoteUrl&&(Y=ce.remoteUrl)}catch{}try{const ce=await Hn.createRepo({name:Ohe(te),defaultBranch:J,localPath:te,deviceId:t,githubUrl:Y}),ke=cg(ce,t);r(je=>je.some(Oe=>Oe.id===ke.id)?je:[ke,...je]),o(ke.id),$(null)}catch(ce){$(ce instanceof Error?ce.message:"Failed to create repository")}},[n]),Q=g.useCallback(async te=>{try{await Hn.deleteRepo(te)}catch{}r(re=>re.filter(J=>J.id!==te)),i===te&&o(null)},[i]),T=g.useCallback(async(te,re="jait",J)=>{if(te.trim())if(V&&(V.status==="running"||V.providerSessionId))await Hn.sendTurn(V.id,te),O();else if(V&&(V.status==="completed"||V.status==="error"||V.status==="interrupted"))try{const Y=await Hn.startThread(V.id,te);h(ce=>ce.map(ke=>ke.id===Y.id?Y:ke)),O()}catch(Y){if(Y.code==="NODE_OFFLINE"&&F){const ke=F.githubUrl;if(ke&&confirm("The desktop app is not connected. Clone the repo to the gateway and run the thread there?")){const je=await Hn.startThread(V.id,{message:te,cloneToGateway:!0,repoUrl:ke});h(Oe=>Oe.map(Be=>Be.id===je.id?je:Be)),O()}else ke||$("Desktop app is offline and no GitHub URL is configured for this repo.")}else throw Y}else{if(!F)return;p(null);const Y=F;(async()=>{try{const ce=Nhe();let ke;try{ke=(await ll.createWorktree(Y.localPath,Y.defaultBranch,ce)).path}catch{try{await ll.createBranch(Y.localPath,ce,Y.defaultBranch)}catch{}}const je=await Hn.createThread({title:`[${Y.name}] Generating title…`,providerId:re,...J?{model:J}:{},workingDirectory:ke??Y.localPath,branch:ce});try{await Hn.startThread(je.id,{message:te,titleTask:te,titlePrefix:`[${Y.name}] `})}catch(Oe){if(Oe.code==="NODE_OFFLINE"){const nt=Y.githubUrl;nt&&confirm("The desktop app is not connected. Clone the repo to the gateway and run the thread there?")?await Hn.startThread(je.id,{message:te,titleTask:te,titlePrefix:`[${Y.name}] `,cloneToGateway:!0,repoUrl:nt}):nt||$("Desktop app is offline and no GitHub URL is configured for this repo. Open the desktop app first.");return}throw Oe}}catch(ce){$(ce instanceof Error?ce.message:"Failed to create thread")}})()}},[F,V,O]),ie=g.useCallback(async te=>{try{await Hn.stopThread(te),O()}catch(re){$(re instanceof Error?re.message:"Failed to stop thread")}},[O]),oe=g.useCallback(async te=>{try{await Hn.deleteThread(te),h(re=>re.filter(J=>J.id!==te)),y===te&&p(null)}catch(re){$(re instanceof Error?re.message:"Failed to delete thread")}},[y]);return{repositories:q,selectedRepoId:i,setSelectedRepoId:o,selectedRepo:F,folderPickerOpen:a,setFolderPickerOpen:u,handleFolderSelected:M,removeRepository:Q,threads:d,repoThreads:U,selectedThreadId:y,setSelectedThreadId:p,selectedThread:V,getRepositoryForThread:W,threadPrStates:w,ghAvailable:C,activities:v,activityEndRef:X,providers:E,loading:P,error:R,setError:$,creating:!1,showGitActions:L,refresh:O,handleSend:T,handleStop:ie,handleDelete:oe,handleThreadEvent:B}}const yi=cn(),Ahe=["What can you help me with?","Explain quantum computing","Write a Python script","What time is it?"];function i7(e){const t=window.matchMedia("(prefers-color-scheme: dark)").matches,n=e==="dark"||e==="system"&&t;document.documentElement.classList.toggle("dark",n)}const Rhe="Generating title…";function Xx(e){return e.replace(/^\[.*?\]\s*/,"").trim()===Rhe}function iP({className:e=""}){return c.jsx("span",{className:`inline-block rounded bg-muted animate-pulse ${e}`,children:c.jsx("span",{className:"invisible",children:"Generating title"})})}function Jx({status:e}){const t={running:{icon:bt,color:"text-blue-500 animate-spin"},paused:{icon:v5,color:"text-yellow-500"},interrupted:{icon:v5,color:"text-yellow-500"},done:{icon:ii,color:"text-green-500"},completed:{icon:ii,color:"text-green-500"},error:{icon:to,color:"text-red-500"}},{icon:n,color:r}=t[e]??{icon:no,color:"text-muted-foreground"};return c.jsx(n,{className:`h-3 w-3 shrink-0 ${r}`})}function sP({prState:e}){if(!e)return null;const t=e==="open"?"PR created":e==="merged"?"PR merged":"PR closed",n=e==="open"?"bg-blue-500/10 text-blue-700 border-blue-500/20 dark:text-blue-300 dark:bg-blue-500/20 dark:border-blue-400/30":e==="merged"?"bg-purple-500/10 text-purple-700 border-purple-500/20 dark:text-purple-300 dark:bg-purple-500/20 dark:border-purple-400/30":"bg-red-500/10 text-red-700 border-red-500/20 dark:text-red-300 dark:bg-red-500/20 dark:border-red-400/30";return c.jsx(Rt,{variant:"outline",className:`text-[9px] px-1 py-0 h-4 ${n}`,children:t})}function Mhe({repositories:e,selectedRepo:t,disabled:n=!1,onSelect:r,onAddRepository:i}){return c.jsxs(bl,{children:[c.jsx(xl,{asChild:!0,children:c.jsxs(Ee,{variant:"outline",size:"sm",className:"h-8 gap-1.5 rounded-lg px-2 text-xs",disabled:n,children:[c.jsx($c,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"max-w-[140px] truncate",children:t?t.name:"Select repository"}),c.jsx(Ss,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]})}),c.jsxs(ao,{align:"start",side:"top",className:"w-64",children:[c.jsx(y1,{children:"Repository"}),e.map(o=>c.jsx(Yi,{onSelect:()=>r(o.id),children:c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx($c,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"truncate",children:o.name}),c.jsx("span",{className:"text-[10px] text-muted-foreground",children:o.defaultBranch}),o.source==="shared"&&c.jsx(Rt,{variant:"outline",className:"h-4 px-1 py-0 text-[9px]",children:"Shared"})]})},o.id)),e.length===0&&c.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:"No repositories yet."}),c.jsx(Dc,{}),c.jsxs(Yi,{onSelect:i,children:[c.jsx(Qf,{className:"mr-2 h-3.5 w-3.5"}),"Add repository"]})]})]})}function Dhe({repositories:e,selectedRepoId:t,isMobile:n=!1,onSelect:r,onAddRepository:i,onRemoveRepository:o}){return c.jsxs("div",{className:"flex h-full flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[c.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Repositories"}),c.jsxs(Ee,{variant:"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[11px]",onClick:i,children:[c.jsx(Qf,{className:"h-3 w-3"}),"Add"]})]}),c.jsx("div",{className:n?"flex-1 overflow-y-auto p-1.5 space-y-0.5":"flex-1 overflow-y-auto p-2 space-y-1",children:e.length===0?c.jsxs("p",{className:"py-4 text-center text-xs text-muted-foreground",children:["No repositories yet.",c.jsx("br",{}),c.jsx("button",{type:"button",onClick:i,className:"mt-1 inline-block underline underline-offset-2 hover:text-foreground",children:"Add one"})]}):e.map(a=>c.jsxs("div",{role:"button",tabIndex:0,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left transition-colors ${n?"cursor-pointer rounded-md text-sm":"rounded-lg text-xs"} ${t===a.id?n?"bg-secondary text-secondary-foreground":"bg-primary/10 text-primary":n?"hover:bg-muted/50":"hover:bg-muted"}`,onClick:()=>r(a.id),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r(a.id))},children:[c.jsx($c,{className:"h-3.5 w-3.5 shrink-0"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:n?"truncate text-xs font-medium":"truncate font-medium",children:a.name}),c.jsx("div",{className:"text-[10px] text-muted-foreground",children:a.defaultBranch})]}),a.source==="shared"&&c.jsx(Rt,{variant:"outline",className:"h-4 shrink-0 px-1 py-0 text-[9px]",children:"Shared"}),a.source==="local"&&c.jsx("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-destructive",onClick:u=>{u.stopPropagation(),o(a.id)},children:c.jsx(r1,{className:"h-3 w-3"})})]},a.id))})]})}function Lhe({thread:e,repo:t,repoName:n,prState:r,ghAvailable:i,onOpen:o,onStop:a,onDelete:u}){const d=t!=null&&(e.status==="completed"||!!e.prUrl);return c.jsxs("div",{role:"button",tabIndex:0,className:"group relative grid w-full grid-cols-[minmax(0,1fr)_auto] items-center gap-5 border-b px-3 py-3.5 text-sm transition-colors hover:bg-muted/40",onClick:o,onKeyDown:h=>{h.target===h.currentTarget&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),o())},children:[c.jsxs("div",{className:"flex flex-col gap-0.5",children:[c.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1.5",children:[c.jsx(Jx,{status:e.status}),c.jsx("div",{className:"flex-1 truncate font-medium",children:Xx(e.title)?c.jsx(iP,{className:"h-3.5 w-28"}):c.jsx("span",{children:e.title.replace(/^\[.*?\]\s*/,"")})})]}),c.jsxs("div",{className:"flex gap-1 text-xs text-muted-foreground pl-[calc(0.75rem+6px)]",children:[c.jsx("span",{className:"truncate",children:n}),e.branch&&c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"·"}),c.jsx("span",{className:"truncate font-mono",children:e.branch})]}),r&&c.jsxs(c.Fragment,{children:[c.jsx("span",{children:"·"}),c.jsx(sP,{prState:r})]})]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[d&&t&&c.jsx("div",{className:"shrink-0",onClick:h=>h.stopPropagation(),onMouseDown:h=>h.stopPropagation(),onKeyDown:h=>h.stopPropagation(),children:c.jsx(Dx,{threadId:e.id,cwd:e.workingDirectory??t.localPath,branch:e.branch,baseBranch:t.defaultBranch,threadTitle:e.title,threadStatus:e.status,prUrl:e.prUrl,prState:r,ghAvailable:i,showStatusBadge:!1})}),e.status==="running"&&c.jsx(Ee,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-lg",onClick:h=>{h.stopPropagation(),a()},children:c.jsx(ed,{className:"h-3 w-3"})}),c.jsx(Ee,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-lg opacity-100 transition-opacity",onClick:h=>{h.stopPropagation(),u()},children:c.jsx(r1,{className:"h-3.5 w-3.5"})})]})]})}function zhe({threads:e,getRepositoryForThread:t,ghAvailable:n,onOpenThread:r,onStopThread:i}){const[o,a]=g.useState(!1);return e.length===0?null:c.jsxs(bl,{open:o,onOpenChange:a,children:[c.jsx(xl,{asChild:!0,children:c.jsxs(Ee,{variant:"outline",size:"sm",className:"h-8 gap-1.5 rounded-lg px-2 text-xs",title:`${e.length} active ${e.length===1?"thread":"threads"}`,children:[c.jsx(bt,{className:"h-3.5 w-3.5 animate-spin text-blue-500"}),c.jsx("span",{className:"hidden sm:inline",children:"Active"}),c.jsx(Rt,{variant:"secondary",className:"h-4 rounded-md px-1 text-[10px]",children:e.length})]})}),c.jsxs(ao,{align:"end",className:"w-[min(34rem,calc(100vw-1rem))] p-0",children:[c.jsx("div",{className:"flex items-center justify-between border-b px-3 py-2",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(bt,{className:"h-3.5 w-3.5 animate-spin text-blue-500"}),c.jsxs("span",{className:"text-sm font-medium",children:[e.length," active ",e.length===1?"thread":"threads"]})]})}),c.jsx("div",{className:"max-h-[min(28rem,70vh)] overflow-y-auto",children:e.map(u=>{const d=t(u),h=(d==null?void 0:d.name)??H1(u)??"Unknown repo";return c.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-3 border-b px-3 py-3 last:border-b-0",children:[c.jsxs("button",{type:"button",className:"min-w-0 text-left transition-colors hover:text-foreground",onClick:()=>{a(!1),r(u.id)},children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[c.jsx(Jx,{status:u.status}),c.jsx("span",{className:"truncate text-sm font-medium",children:Xx(u.title)?"Generating title...":u.title.replace(/^\[.*?\]\s*/,"")})]}),c.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1 text-[11px] text-muted-foreground",children:[c.jsx("span",{className:"truncate",children:h}),u.branch&&c.jsx(Rt,{variant:"outline",className:"h-4 px-1 py-0 font-mono text-[9px]",children:u.branch}),c.jsx(sP,{prState:u.prState})]})]}),c.jsxs("div",{className:"flex items-center gap-1 self-start",children:[d&&c.jsx("div",{onClick:y=>y.stopPropagation(),onMouseDown:y=>y.stopPropagation(),children:c.jsx(Dx,{threadId:u.id,cwd:u.workingDirectory??d.localPath,branch:u.branch,baseBranch:d.defaultBranch,threadTitle:u.title,threadStatus:u.status,prUrl:u.prUrl,prState:u.prState,ghAvailable:n,showStatusBadge:!1})}),c.jsx(Ee,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-lg",onClick:y=>{y.stopPropagation(),Promise.resolve(i(u.id))},title:"Stop thread",children:c.jsx(ed,{className:"h-3 w-3"})})]})]},u.id)})})]})]})}function $he(){var Mp,cr,Eo,Cu,ju,ku;const[e,t]=g.useState(""),[n,r]=g.useState(!1),[i,o]=g.useState(null),[a,u]=g.useState("chat"),[d,h]=g.useState("system"),[y,p]=g.useState(()=>localStorage.getItem("showSessionsSidebar")==="true"),[v,b]=g.useState(!1),[w,S]=g.useState(!1),[C,j]=g.useState(!1),[E,N]=g.useState(!1),[P,I]=g.useState(()=>localStorage.getItem("showWorkspaceTree")!=="false"),[R,$]=g.useState(()=>localStorage.getItem("showWorkspaceEditor")!=="false"),[X,G]=g.useState(!1),D=g.useRef(null),[q,F]=g.useState(()=>localStorage.getItem("showDebugPanel")==="true"),[V,W]=g.useState(280),[L,O]=g.useState({x:-1,y:-1}),[H,B]=g.useState({w:420,h:320}),U=g.useRef(null),A=g.useRef(null),[M,Q]=g.useState(!1),[T,ie]=g.useState(()=>localStorage.getItem("chatMode")||"agent"),[oe,te]=g.useState(()=>localStorage.getItem("chatProvider")||"jait"),[re,J]=g.useState(()=>localStorage.getItem("cliModel")||null),[Y,ce]=g.useState(()=>localStorage.getItem("viewMode")||"developer"),[ke,je]=g.useState("idle"),[Oe,Be]=g.useState("idle"),nt=g.useRef(Y),[at,Ue]=g.useState(""),[kt,ut]=g.useState(""),[We,ft]=g.useState(""),[Ge,_e]=g.useState(""),[ye,xe]=g.useState(""),[Z,le]=g.useState("login"),[ve,ae]=g.useState(()=>ha()??""),he=!!window.jaitDesktop||!!window.Capacitor,Ce=!!window.jaitDesktop,Xe=!!window.Capacitor,Pe=Ce?"electron":Xe?"capacitor":"web",[$e,Je]=g.useState(null),[qe,It]=g.useState(!1),[ct,Ze]=g.useState(!1),[wt,Gt]=g.useState(null),[Gn,Ke]=g.useState(!1),[ze,st]=g.useState(()=>he&&!w6()?"url":"auth"),[yt,Mt]=g.useState(!1),[Yn,Pt]=g.useState(null),[_n,Os]=g.useState([]),[Xn,bn]=g.useState(null),[Ns,Er]=g.useState([]),[xn,Oa]=g.useState(null),[Ji,wn]=g.useState(!1),zn=g.useRef(!1),oi=g.useRef(null),Zi=g.useRef(null),or=vx(),[F1,sp]=g.useState(0),Ei=!or&&C,jl=or&&C,Ts=g.useCallback(()=>({x:window.innerWidth-H.w-16,y:window.innerHeight-H.h-16}),[H]),po=g.useCallback(K=>{K.preventDefault();const me=L.x<0?Ts():L;U.current={startX:K.clientX,startY:K.clientY,posX:me.x,posY:me.y};const Ne=ot=>{U.current&&O({x:Math.max(0,Math.min(window.innerWidth-100,U.current.posX+ot.clientX-U.current.startX)),y:Math.max(0,Math.min(window.innerHeight-40,U.current.posY+ot.clientY-U.current.startY))})},He=()=>{U.current=null,document.removeEventListener("mousemove",Ne),document.removeEventListener("mouseup",He),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="move",document.body.style.userSelect="none",document.addEventListener("mousemove",Ne),document.addEventListener("mouseup",He)},[L,Ts]),kl=g.useCallback(K=>{K.preventDefault(),K.stopPropagation(),A.current={startX:K.clientX,startY:K.clientY,w:H.w,h:H.h};const me=He=>{A.current&&B({w:Math.max(280,Math.min(window.innerWidth-40,A.current.w+He.clientX-A.current.startX)),h:Math.max(200,Math.min(window.innerHeight-40,A.current.h+He.clientY-A.current.startY))})},Ne=()=>{A.current=null,document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",Ne),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="nwse-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",me),document.addEventListener("mouseup",Ne)},[H]),{user:lr,token:Qe,settings:Hr,isLoading:El,isAuthenticated:Fr,login:mo,register:U1,logout:op,bindSession:cu,updateSettings:Ol,clearSessionArchive:Na}=phe(),go=g.useCallback(async()=>{if(Qe){It(!0);try{const K=await fetch(`${yi}/api/update/check`,{headers:{Authorization:`Bearer ${Qe}`}});K.ok&&Je(await K.json())}catch{}It(!1)}},[Qe]),Oi=g.useCallback(async()=>{if(!(!Qe||!($e!=null&&$e.hasUpdate))){Ze(!0);try{const K=await fetch(`${yi}/api/update/apply`,{method:"POST",headers:{Authorization:`Bearer ${Qe}`,"Content-Type":"application/json"},body:JSON.stringify({version:$e.latestVersion})});if(K.ok)ms.success(`Updated to v${$e.latestVersion}. Gateway is restarting...`);else{const me=await K.json().catch(()=>({}));ms.error(me.error??"Update failed")}}catch{ms.error("Update request failed")}Ze(!1)}},[Qe,$e]);g.useEffect(()=>{Qe&&go()},[Qe,go]);const gr=g.useCallback(()=>r(!0),[]),{sessions:lp,activeSessionId:tt,createSession:Qi,switchSession:ap,archiveSession:Ta,fetchSessions:V1}=vhe(Qe,gr),{messages:Pn,isLoading:es,remainingPrompts:yo,error:Ni,hitMaxRounds:vo,pendingPlan:uu,todoList:fu,changedFiles:Jn,messageQueue:cp,contextUsage:up,sendMessage:Nl,restartFromMessage:Pa,cancelRequest:fp,clearMessages:dp,continueChat:Aa,executePlan:Ti,rejectPlan:du,enqueueMessage:Ra,dequeueMessage:_o,updateQueueItem:bo,acceptFile:Ma,rejectFile:hu,acceptAllFiles:hp,rejectAllFiles:Tl,setTodoList:ar,addChangedFile:xo,setChangedFiles:Pi,setOnChangedFilesSync:li,refreshMessages:pu}=ghe(tt,Qe,gr),{terminals:ts,activeTerminalId:ns,setActiveTerminalId:Ai,createTerminal:Ps,killTerminal:mu,refresh:Zn}=uhe(),{provider:As,model:Rs}=yhe(),wo=Vce({token:Qe}),Le=Phe(),So=g.useMemo(()=>xoe(Le.activities),[Le.activities]),Ms=g.useMemo(()=>[...Le.threads].sort((K,me)=>new Date(me.updatedAt).getTime()-new Date(K.updatedAt).getTime()),[Le.threads]),Co=g.useMemo(()=>Ms.filter(K=>K.status==="running"),[Ms]),Da=Le.selectedRepo!=null,gu=Le.creating||!Da,W1=Le.selectedRepo?"Describe what you want to do...":"Select a repository to start a thread...",[zt,Ri]=g.useState(null);g.useEffect(()=>{var Ne,He,ot;const K=window.jaitDesktop;if(!K)return;(Ne=K.getInfo)==null||Ne.call(K).then(At=>Gt(At.platform)),(He=K.windowIsMaximized)==null||He.call(K).then(At=>Ke(At));const me=(ot=K.onMaximizedChange)==null?void 0:ot.call(K,(At,Jt)=>Ke(Jt));return()=>{me==null||me()}},[]);const Mi=g.useRef(!1);g.useEffect(()=>{Mi.current=!1},[tt]);const[jo,Di]=Rf(tt,"workspace.panel",Qe),[La,rs]=Rf(tt,"screen-share.panel",Qe),[za,Ds]=Rf(tt,"terminal.panel",Qe),[$a]=Rf(tt,"todo_list",Qe),[Ia]=Rf(tt,"changed_files",Qe);g.useEffect(()=>{Mi.current||jo&&(zt||jo.open&&jo.remotePath&&Ri({surfaceId:jo.surfaceId??"",workspaceRoot:jo.remotePath}))},[jo]),g.useEffect(()=>{Mi.current||La!=null&&La.open&&N(!0)},[La]),g.useEffect(()=>{Mi.current||za!=null&&za.open&&b(!0)},[za]),g.useEffect(()=>{Mi.current||$a&&$a.length>0&&ar($a)},[$a,ar]),g.useEffect(()=>{if(!Mi.current&&Ia&&Ia.length>0)for(const K of Ia)xo(K.path,K.name)},[Ia,xo]);const q1=g.useCallback((K,me)=>{switch(K){case"workspace.panel":{if(!me)j(!1),Ri(null);else{const Ne=me;Ne.open?(j(!0),Ne.remotePath&&Ri({surfaceId:Ne.surfaceId??"",workspaceRoot:Ne.remotePath})):j(!1)}break}case"screen-share.panel":N(me?me.open!==!1:!1);break;case"terminal.panel":b(me?me.open!==!1:!1);break;case"todo_list":Array.isArray(me)&&ar(me);break;case"file_changed":{const Ne=me;Ne!=null&&Ne.path&&xo(Ne.path,Ne.name??Ne.path.split("/").pop()??Ne.path);break}case"changed_files":{Array.isArray(me)?Pi(me):me===null&&Pi([]);break}}},[ar,xo,Pi]),K1=g.useCallback(K=>{Mi.current=!0;const me=K["workspace.panel"];me&&me.open?(j(!0),me.remotePath&&Ri({surfaceId:me.surfaceId??"",workspaceRoot:me.remotePath})):(j(!1),Ri(null));const Ne=K["screen-share.panel"];Ne&&Ne.open!==!1?N(!0):N(!1);const He=K["terminal.panel"];He&&He.open!==!1?b(!0):b(!1);const ot=K.todo_list;Array.isArray(ot)&&ot.length>0&&ar(ot);const At=K.changed_files;Array.isArray(At)&&Pi(At)},[ar,Pi]),{sendUIState:An}=Che({sessionId:tt,token:Qe,onStateSync:q1,onFullState:K1,onMessageComplete:pu,onThreadEvent:Le.handleThreadEvent,onFsChanges:g.useCallback(K=>{sp(me=>me+1)},[]),listeners:{"workspace.open":g.useCallback(K=>{j(!0),Ri({surfaceId:K.surfaceId,workspaceRoot:K.workspaceRoot});const me={open:!0,remotePath:K.workspaceRoot,surfaceId:K.surfaceId};Di(me)},[Di]),"workspace.close":g.useCallback(()=>{j(!1),Ri(null),Di(null)},[Di]),"terminal.focus":g.useCallback(K=>{u("chat"),b(!0),Ds({open:!0}),K.terminalId&&Ai(K.terminalId),K.reason==="interactive-input-required"&&ms(K.message??"Terminal wartet auf deine Eingabe (z. B. sudo Passwort).",{description:"Klicke ins Terminal und gib die erforderliche Eingabe ein.",duration:1e4})},[Ds,Ai]),"screen-share.open":g.useCallback(()=>{N(!0),rs({open:!0})},[rs]),"screen-share.close":g.useCallback(()=>{N(!1),rs(null)},[rs])}});g.useEffect(()=>(li(K=>{An("changed_files",K,tt)}),()=>li(null)),[An,tt,li]),g.useEffect(()=>{localStorage.setItem("showSessionsSidebar",y?"true":"false")},[y]),g.useEffect(()=>{localStorage.setItem("showDebugPanel",q?"true":"false")},[q]),g.useEffect(()=>{localStorage.setItem("chatMode",T)},[T]),g.useEffect(()=>{re?localStorage.setItem("cliModel",re):localStorage.removeItem("cliModel")},[re]);const pp=g.useRef(!1);g.useEffect(()=>{if(localStorage.setItem("chatProvider",oe),!pp.current){pp.current=!0;return}Qe&&Ol({chat_provider:oe})},[oe]),g.useEffect(()=>{localStorage.setItem("viewMode",Y)},[Y]),g.useEffect(()=>{nt.current!=="manager"&&Y==="manager"?(je("center"),requestAnimationFrame(()=>{document.body.offsetHeight,requestAnimationFrame(()=>je("top"))})):(nt.current==="manager"&&Y==="developer"&&Be("animating"),je("idle")),nt.current=Y},[Y]),g.useEffect(()=>{Y==="manager"&&q&&F(!1)},[Y,q]);const G1=g.useCallback(()=>{N(!0),rs({open:!0}),An("screen-share.panel",{open:!0},tt)},[rs,An,tt]),mp=g.useCallback(()=>{N(!1),rs(null),An("screen-share.panel",null,tt)},[rs,An,tt]),Pl=g.useCallback(()=>{b(!0),Ds({open:!0}),An("terminal.panel",{open:!0},tt)},[Ds,An,tt]),Al=g.useCallback(()=>{b(!1),Ds(null),An("terminal.panel",null,tt)},[Ds,An,tt]),yu=g.useCallback(()=>{j(!1),Ri(null),Di(null),An("workspace.panel",null,tt)},[Di,An,tt]),gp=g.useCallback(()=>{I(K=>{const me=!K;return localStorage.setItem("showWorkspaceTree",String(me)),me})},[]),yp=g.useCallback(()=>{$(K=>{const me=!K;return localStorage.setItem("showWorkspaceEditor",String(me)),me})},[]),vp=g.useCallback(()=>{I(!0),localStorage.setItem("showWorkspaceTree","true")},[]),_p=g.useCallback(()=>{$(!0),localStorage.setItem("showWorkspaceEditor","true")},[]),bp=g.useCallback(async(K,me)=>{const Ne=await fetch(`${yi}/api/workspace/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:K,sessionId:tt,nodeId:me||"gateway"})});if(!Ne.ok){const He=await Ne.json().catch(()=>({message:"Unknown error"}));throw new Error(He.message??"Failed to open workspace")}},[tt]),Y1=g.useCallback(async()=>{if(C){if(Jn.length>0){G(!0);return}yu();return}if(zt){j(!0);const K={open:!0,remotePath:zt.workspaceRoot,surfaceId:zt.surfaceId};Di(K),An("workspace.panel",K,tt);return}wn(!0)},[C,zt,yu,Di,An,tt,bp,Jn.length]);g.useEffect(()=>{zt&&(C||j(!0))},[zt]),g.useEffect(()=>{if(!(zt!=null&&zt.surfaceId)||!zt.workspaceRoot||!tt)return;let K=!1;return(async()=>{try{if((await fetch(`${yi}/api/workspace/list?path=${encodeURIComponent(zt.workspaceRoot)}&surfaceId=${encodeURIComponent(zt.surfaceId)}`)).ok||K)return;const Ne=await fetch(`${yi}/api/workspace/open`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:zt.workspaceRoot,sessionId:tt})});if(!Ne.ok||K)return;const He=await Ne.json();if(K)return;Ri({surfaceId:He.surfaceId,workspaceRoot:He.workspaceRoot});const ot={open:!0,remotePath:He.workspaceRoot,surfaceId:He.surfaceId};Di(ot),An("workspace.panel",ot,tt)}catch{}})(),()=>{K=!0}},[zt==null?void 0:zt.surfaceId,tt]),g.useEffect(()=>{Jn.length!==0&&(C||j(!0))},[Jn.length]);const xp=g.useMemo(()=>Jn.filter(K=>K.state==="undecided").map(K=>K.path),[Jn]);g.useEffect(()=>{h(Hr.theme)},[Hr.theme]),g.useEffect(()=>{El||Hr.chat_provider&&Hr.chat_provider!==oe&&te(Hr.chat_provider)},[Hr.chat_provider,El]),g.useEffect(()=>{var Ne,He;if(i7(d),Ce&&wt==="win32"){const ot=d==="dark"||d==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches;(He=(Ne=window.jaitDesktop)==null?void 0:Ne.setTitleBarOverlay)==null||He.call(Ne,{color:ot?"#202020":"#e8ecf1",symbolColor:ot?"#f2f2f2":"#0a0a0a",height:39})}const K=window.matchMedia("(prefers-color-scheme: dark)"),me=()=>{var ot,At;if(d==="system"&&i7("system"),Ce&&wt==="win32"){const Jt=K.matches;(At=(ot=window.jaitDesktop)==null?void 0:ot.setTitleBarOverlay)==null||At.call(ot,{color:Jt?"#202020":"#e8ecf1",symbolColor:Jt?"#f2f2f2":"#0a0a0a",height:39})}};return K.addEventListener("change",me),()=>K.removeEventListener("change",me)},[d,wt]),g.useEffect(()=>{if(!El&&!Fr){const K=requestAnimationFrame(()=>r(!0));return he&&w6()&&fetch(`${cn()}/health`,{signal:AbortSignal.timeout(4e3)}).then(me=>{if(!me.ok)throw new Error("unhealthy")}).catch(()=>{st("url"),Pt("Gateway is unreachable. Check the URL or try a different one."),ae(ha()??"")}),()=>cancelAnimationFrame(K)}},[El,Fr]),g.useEffect(()=>{Fr&&tt&&cu(tt)},[Fr,tt,cu]),g.useEffect(()=>{if(Ni==="login_required"){const K=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(K)}},[Ni]),g.useEffect(()=>{(async()=>{if(!tt){Q(!1);return}try{const Ne=await(await fetch(`${yi}/api/consent/pending/${tt}/approve-all`)).json();Q(Ne.approveAllEnabled===!0)}catch{Q(!1)}})()},[tt]);const vu=g.useCallback(async K=>{const me=d;h(K);try{await Ol({theme:K})}catch{h(me)}},[d,Ol]),Rl=g.useCallback(K=>{K.preventDefault(),zn.current=!0;const me=K.clientY,Ne=V,He=window.innerHeight*.5,ot=Jt=>{if(!zn.current)return;const on=me-Jt.clientY;W(Math.min(He,Math.max(280,Ne+on)))},At=()=>{zn.current=!1,document.removeEventListener("mousemove",ot),document.removeEventListener("mouseup",At),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="row-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",ot),document.addEventListener("mouseup",At)},[V]),Ba=g.useCallback(async(K=null)=>{const me=await Zn();if(K&&me.some(ot=>ot.id===K))return Ai(K),K;if(ns&&me.some(He=>He.id===ns))return ns;if(me.length>0){const He=me[me.length-1].id;return Ai(He),He}return(await Ps(tt??"default")).id},[Zn,Ai,ns,Ps,tt]),wp=g.useCallback(async K=>{u("chat"),Pl(),await Ba(K)},[Ba,Pl]),Sp=g.useCallback(async()=>{if(v){Al();return}u("chat"),Pl(),await Ba()},[v,Ba,Pl,Al]),Cp=g.useCallback(async K=>{var Ne;const me=ts.length===1&&((Ne=ts[0])==null?void 0:Ne.id)===K;await mu(K),me&&Al()},[ts,mu,Al]),ko=g.useCallback(K=>{K.length!==0&&(Os(me=>{const Ne=[...me];for(const He of K){const ot=Ne.findIndex(At=>At.path===He.path);ot>=0?Ne[ot]=He:Ne.push(He)}return Ne}),bn(me=>{var Ne;return me??((Ne=K[0])==null?void 0:Ne.id)??null}))},[]),jp=g.useCallback(async K=>{var me;try{const Ne={};Qe&&(Ne.Authorization=`Bearer ${Qe}`);const He=await fetch(`${yi}/api/workspace/backup?path=${encodeURIComponent(K)}`,{headers:Ne});if(He.ok){const $n=await He.json(),Ur=K.split(/[\/\\]/).pop()??K;Oa({filePath:$n.path,originalContent:$n.originalContent??"",modifiedContent:$n.currentContent,language:vg(Ur)}),C||j(!0);return}const ot=await((me=oi.current)==null?void 0:me.readFileByPath(K));if(ot){ko([ot]),bn(ot.id),C||j(!0);return}const At=await fetch(`${yi}/api/workspace/read?path=${encodeURIComponent(K)}`,{headers:Ne});if(!At.ok)return;const Jt=await At.json(),on=K.split("/").pop()??K,Sn={id:`changed-${K}`,name:on,path:Jt.path,content:Jt.content,language:vg(on)};ko([Sn]),bn(Sn.id),C||j(!0)}catch{}},[Qe,C,ko]),Ls=g.useCallback(()=>{Oa(null)},[]),kp=g.useCallback(async K=>{if(!xn)return;const me=xn.filePath;try{const Ne={"Content-Type":"application/json"};Qe&&(Ne.Authorization=`Bearer ${Qe}`),await fetch(`${yi}/api/workspace/apply-diff`,{method:"POST",headers:Ne,body:JSON.stringify({path:me,content:K})})}catch{}Ma(me),Oa(null)},[xn,Qe,Ma]),Ep=g.useCallback(async K=>{const me=Array.from(K),Ne=await Promise.all(me.filter(He=>He.size<1024*1024).map(async He=>{const ot=await He.text(),At=He.webkitRelativePath||He.name;return{id:`${At}-${He.lastModified}`,name:He.name,path:At,content:ot,language:vg(At)}}));ko(Ne)},[ko]),Op=g.useCallback(async(K,me,Ne)=>{var He;return((He=oi.current)==null?void 0:He.searchFiles(K,me,Ne))??[]},[]),_u=g.useCallback(K=>{e.trim()&&(Ra(e.trim()),t(""))},[e,Ra]),Ml=async K=>{var Jt;if(Y==="manager")return Dl();if(!e.trim()&&(!K||K.length===0))return;if(!Qe){r(!0);return}let me=tt;if(!me){const on=await Qi();me=(on==null?void 0:on.id)??null}if(!me)return;const Ne=[];if(K!=null&&K.length){const on=new Set;for(const Sn of K){if(on.has(Sn.path))continue;on.add(Sn.path);const $n=_n.find(Ur=>Ur.path===Sn.path);if($n)Ne.push({path:$n.path,content:$n.content});else{const Ur=await((Jt=oi.current)==null?void 0:Jt.readFileByPath(Sn.path));Ur&&Ne.push({path:Ur.path,content:Ur.content})}}}const He=Ne.length>0?`${e.trim()}
|
|
728
728
|
|
|
729
729
|
Referenced files:
|
|
730
730
|
${Ne.map(on=>`- ${on.path}
|
|
731
731
|
\`\`\`
|
|
732
732
|
${on.content.slice(0,2e3)}
|
|
733
733
|
\`\`\``).join(`
|
|
734
|
-
`)}`:e.trim(),ot=e.trim(),At=K!=null&&K.length?K.map(on=>({path:on.path,name:on.name})):void 0;Nl(He,{token:Qe,sessionId:me,mode:T,provider:oe,model:oe!=="jait"?re:void 0,onLoginRequired:()=>r(!0),...At?{displayContent:ot,referencedFiles:At}:{}}),t("")},Dl=async()=>{const K=e.trim();!K||gu||(t(""),await Le.handleSend(K,oe,oe!=="jait"?re:void 0))},Ll=async K=>{if(!Qe){r(!0);return}let me=tt;if(!me){const Ne=await Qi();me=(Ne==null?void 0:Ne.id)??null}me&&Nl(K,{token:Qe,sessionId:me,mode:T,provider:oe,model:oe!=="jait"?re:void 0,onLoginRequired:()=>r(!0)})},X1=g.useCallback(async(K,me,Ne,He)=>{!tt||!Qe||await Pa(K,me,Ne,He,{token:Qe,sessionId:tt,mode:T,provider:oe,model:oe!=="jait"?re:void 0,onLoginRequired:()=>r(!0)})},[tt,Pa,Qe,T,oe,re]),Ha=async K=>{K.preventDefault(),o(null);try{await mo(at,kt),r(!1),ut(""),u("chat")}catch(me){o(me instanceof Error?me.message:"Login failed")}},Np=async K=>{if(K.preventDefault(),o(null),!We||!Ge){o("Username and password are required");return}if(Ge!==ye){o("Passwords do not match");return}try{await U1(We,Ge),r(!1),_e(""),xe(""),u("chat")}catch(me){o(me instanceof Error?me.message:"Registration failed")}},Tp=g.useCallback(async K=>{K.preventDefault();const me=ve.trim();if(!me){Pt("Please enter a gateway URL");return}Mt(!0),Pt(null);try{const Ne=me.replace(/\/+$/,""),He=await fetch(`${Ne}/health`,{signal:AbortSignal.timeout(5e3)});if(!He.ok)throw new Error(`Server returned ${He.status}`);const ot=cn();if(mg(Ne),Ne!==ot){window.location.reload();return}st("auth")}catch(Ne){Pt(Ne instanceof Error?Ne.name==="TimeoutError"||Ne.name==="AbortError"?"Connection timed out":Ne.message:"Failed to connect")}finally{Mt(!1)}},[ve]),bu=()=>{op(),dp(),u("chat"),r(!0)},xu=async K=>{const me=Object.fromEntries(Object.entries(K).map(([Ne,He])=>[Ne,He.trim()]).filter(([,Ne])=>Ne.length>0));await Ol({api_keys:me})},Pp=async()=>{const K=await Na();return await V1(),K.removed},Ap=g.useCallback(async()=>{if(tt)try{await fetch(`${yi}/api/consent/pending/${tt}/approve-all`,{method:"DELETE"}),Q(!1)}catch{}},[tt]),wu=g.useCallback(async()=>{var Ne;if(!Qe){r(!0);return}let K=tt;if(!K){const He=await Qi();K=(He==null?void 0:He.id)??null}if(!K)return;let me="";if(Hr.stt_provider==="browser"){const He=window,ot=He.SpeechRecognition??He.webkitSpeechRecognition;if(!ot){window.alert('Speech-to-Text provider "Browser" is not supported in this browser.');return}me=await new Promise(At=>{const Jt=new ot;let on=!1;const Sn=$n=>{on||(on=!0,At($n))};Jt.lang="de-DE",Jt.interimResults=!1,Jt.maxAlternatives=1,Jt.onresult=$n=>{var Eu,is,Ou,Nu;const Ur=((Nu=(Ou=(is=(Eu=$n.results)==null?void 0:Eu[0])==null?void 0:is[0])==null?void 0:Ou.transcript)==null?void 0:Nu.trim())??"";Sn(Ur)},Jt.onerror=()=>Sn(""),Jt.onnomatch=()=>Sn(""),Jt.onend=()=>Sn(""),Jt.start()})}else me=((Ne=window.prompt("Speak now (simulated transcript):"))==null?void 0:Ne.trim())??"";if(me)try{const ot=await(await fetch(`${yi}/api/voice/transcribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:K,transcript:me})})).json();ot.text&&Nl(ot.text,{token:Qe,sessionId:K,onLoginRequired:()=>r(!0)})}catch{}},[Qe,tt,Qi,Nl,Hr.stt_provider]),Rp=Ni==="limit_reached",Su=Pn.length>0,J1=((cr=(Mp=lr==null?void 0:lr.username)==null?void 0:Mp[0])==null?void 0:cr.toUpperCase())??"?",Z1=[...Pn.slice(-10).map(K=>t7({id:`msg-${K.id}`,source:"chat",title:`Message: ${K.role}`,detail:K.content.slice(0,120)||"(empty message)"})),...ts.map(K=>t7({id:`term-${K.id}`,source:"terminal",title:"Terminal session",detail:`${K.id} (${K.state})`}))];return c.jsx(NH,{children:c.jsxs("div",{className:"fixed inset-0 flex flex-col overflow-hidden safe-top safe-bottom safe-left safe-right",children:[c.jsxs("header",{className:`flex items-center px-2 sm:px-5 border-b shrink-0 gap-1 sm:gap-2 ${Ce?"h-10 !pl-[0.8rem]":"h-14"}`,style:Ce?{WebkitAppRegion:"drag",paddingLeft:wt==="darwin"?70:void 0,paddingRight:wt==="win32"?140:void 0}:void 0,children:[c.jsx("div",{className:"flex items-center shrink-0",style:Ce?{WebkitAppRegion:"no-drag"}:void 0,children:c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 1024 1024",className:"shrink-0",children:[c.jsx("path",{d:"M318 372 L430 486 L318 600",fill:"none",stroke:"currentColor",strokeWidth:"88",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M610 258 L610 642 C610 734 549 796 455 796 C393 796 338 766 299 715",fill:"none",stroke:"currentColor",strokeWidth:"88",strokeLinecap:"round",strokeLinejoin:"round"})]})}),c.jsxs("nav",{className:"flex items-center gap-1 min-w-0 overflow-x-auto scrollbar-none",style:Ce?{WebkitAppRegion:"no-drag"}:void 0,children:[c.jsxs(Ee,{variant:a==="chat"?"secondary":"ghost",size:"sm",className:"h-8 text-xs shrink-0 px-2 sm:px-3",onClick:()=>u("chat"),children:[c.jsx(b7,{className:"h-3.5 w-3.5 sm:mr-1.5"}),c.jsx("span",{className:"hidden sm:inline",children:"Chat"})]}),c.jsxs(Ee,{variant:a==="jobs"?"secondary":"ghost",size:"sm",className:"h-8 text-xs shrink-0 px-2 sm:px-3",onClick:()=>u("jobs"),children:[c.jsx(V_,{className:"h-3.5 w-3.5 sm:mr-1.5"}),c.jsx("span",{className:"hidden sm:inline",children:"Jobs"})]}),c.jsxs(Ee,{variant:a==="network"?"secondary":"ghost",size:"sm",className:"h-8 text-xs shrink-0 px-2 sm:px-3",onClick:()=>u("network"),children:[c.jsx(h2,{className:"h-3.5 w-3.5 sm:mr-1.5"}),c.jsx("span",{className:"hidden sm:inline",children:"Network"})]})]}),c.jsx("div",{className:"flex-1 min-w-0"}),c.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5 shrink-0",style:Ce?{WebkitAppRegion:"no-drag"}:void 0,children:[a==="chat"&&Co.length>0&&c.jsx(zhe,{threads:Co,getRepositoryForThread:Le.getRepositoryForThread,ghAvailable:Le.ghAvailable,onOpenThread:K=>{Y!=="manager"&&ce("manager"),u("chat"),Le.setSelectedThreadId(K)},onStopThread:K=>Le.handleStop(K)}),wo.isActive&&c.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground bg-muted/60 rounded px-1.5 py-0.5 shrink-0",children:[c.jsx(Vf,{className:"h-3 w-3 text-green-500 animate-pulse"}),c.jsx("span",{className:"hidden sm:inline",children:"Sharing"})]}),c.jsx(xZ,{usage:up}),(()=>{const K=oe==="codex"?"openai":oe==="claude-code"?"anthropic":As??"ollama",me=oe==="codex"?re??"Codex":oe==="claude-code"?re??"Claude Code":Rs?uie(Rs):null,Ne=oe==="codex"?`OpenAI Codex CLI${re?` · ${re}`:""}`:oe==="claude-code"?`Anthropic Claude Code CLI${re?` · ${re}`:""}`:Rs??"";return me?c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5 sm:mr-2 px-1.5 sm:px-2 py-1 rounded-md bg-muted/50 cursor-default",children:[c.jsx(Vg,{provider:K,model:oe==="codex"?"codex":oe==="claude-code"?"claude-3":Rs??void 0,size:16}),c.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:me})]})}),c.jsx(dr,{side:"bottom",children:Ne})]}):null})(),yo!==null&&yo<=5&&c.jsxs("span",{className:"text-xs text-muted-foreground mr-1 sm:mr-2 hidden sm:inline",children:[yo," remaining"]}),($e==null?void 0:$e.hasUpdate)&&c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs("button",{onClick:()=>{Pe==="web"?u("settings"):window.open(Pe==="capacitor"?"https://jait.dev/download#android":"https://jait.dev/download#desktop","_blank")},className:"flex items-center gap-1 px-2 py-1 rounded-md bg-amber-500/15 text-amber-600 dark:text-amber-400 hover:bg-amber-500/25 transition-colors text-xs",children:[c.jsx(v7,{className:"h-3.5 w-3.5"}),c.jsxs("span",{className:"hidden sm:inline",children:["v",$e.latestVersion]})]})}),c.jsxs(dr,{side:"bottom",children:["Update available — v",$e.latestVersion]})]}),Fr?c.jsxs(bl,{children:[c.jsx(xl,{asChild:!0,children:c.jsx("button",{className:"rounded-full ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:c.jsx(q7,{className:"h-7 w-7",children:c.jsx(K7,{className:"text-[11px]",children:J1})})})}),c.jsxs(ao,{align:"end",children:[c.jsx(y1,{children:lr==null?void 0:lr.username}),c.jsx(Dc,{}),c.jsxs(Yi,{onSelect:()=>u("settings"),children:[c.jsx(HR,{className:"h-4 w-4 mr-2"}),"Settings"]}),c.jsx(Dc,{}),c.jsxs("div",{className:"px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Theme"}),c.jsx("div",{className:"flex items-center h-7 w-fit rounded-full border bg-muted/50 p-0.5 mt-1.5",children:[["light",UR],["system",aa],["dark",LR]].map(([K,me])=>c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsx("button",{onClick:()=>{vu(K)},className:`relative flex items-center justify-center h-6 w-6 rounded-full transition-colors ${d===K?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:c.jsx(me,{className:"h-3.5 w-3.5"})})}),c.jsx(dr,{side:"bottom",children:K.charAt(0).toUpperCase()+K.slice(1)})]},K))})]}),c.jsx(Dc,{}),c.jsxs(Yi,{onSelect:bu,children:[c.jsx(TR,{className:"h-4 w-4 mr-2"}),"Logout"]})]})]}):c.jsx(Ee,{variant:"ghost",size:"sm",className:"h-8 text-xs",onClick:()=>r(!0),children:"Sign in"}),Ce&&wt==="linux"&&c.jsxs("div",{className:"flex items-center ml-2 -mr-2",children:[c.jsx("button",{onClick:()=>window.jaitDesktop.windowMinimize(),className:"flex items-center justify-center h-9 w-11 hover:bg-muted/80 transition-colors",children:c.jsx(MR,{className:"h-4 w-4"})}),c.jsx("button",{onClick:()=>window.jaitDesktop.windowMaximize(),className:"flex items-center justify-center h-9 w-11 hover:bg-muted/80 transition-colors",children:Gn?c.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"fill-current",children:c.jsx("path",{d:"M2 0v2H0v8h8V8h2V0zm5 7H1V3h6zM9 1v6H8V2H3V1z"})}):c.jsx(ed,{className:"h-3 w-3"})}),c.jsx("button",{onClick:()=>window.jaitDesktop.windowClose(),className:"flex items-center justify-center h-9 w-11 hover:bg-red-600 hover:text-white transition-colors",children:c.jsx(Sr,{className:"h-4 w-4"})})]})]})]}),a==="chat"&&c.jsxs("div",{className:"flex items-center gap-1 px-2 sm:px-5 h-9 border-b shrink-0 bg-muted/30 overflow-x-auto scrollbar-none",children:[Y==="developer"&&c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs(Ee,{variant:y?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>p(K=>!K),children:[y?c.jsx(g5,{className:`h-3 w-3 mr-1${or?" rotate-90":""}`}):c.jsx(y5,{className:`h-3 w-3 mr-1${or?" rotate-90":""}`}),"Sessions"]})}),c.jsx(dr,{side:"bottom",children:"Toggle sessions sidebar"})]}),Y==="developer"&&c.jsxs(c.Fragment,{children:[c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs(Ee,{variant:v?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>{Sp()},children:[c.jsx(oa,{className:"h-3 w-3 mr-1"}),"Terminal"]})}),c.jsx(dr,{side:"bottom",children:"Toggle terminal panel"})]}),c.jsxs("div",{className:"relative flex items-center shrink-0",children:[c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs(Ee,{variant:C?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2",onClick:()=>{Y1()},children:[c.jsx(qy,{className:"h-3 w-3 mr-1"}),"Workspace",C&&c.jsx(Sr,{className:"h-3 w-3 ml-1"})]})}),c.jsx(dr,{side:"bottom",children:C?"Close workspace":"Open workspace"})]}),X&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(!1)}),c.jsxs("div",{ref:D,className:"absolute top-full left-0 mt-1 z-50 w-64 rounded-lg border bg-background shadow-lg p-3 space-y-2",children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Oc,{className:"h-4 w-4 text-amber-500 shrink-0 mt-0.5"}),c.jsxs("div",{className:"text-xs",children:[c.jsx("p",{className:"font-medium",children:"Close workspace?"}),c.jsxs("p",{className:"text-muted-foreground mt-0.5",children:["You have ",Jn.length," unsaved file ",Jn.length===1?"change":"changes"," that will be discarded."]})]})]}),c.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[c.jsx(Ee,{variant:"ghost",size:"sm",className:"h-6 text-[11px] px-2",onClick:()=>G(!1),children:"Cancel"}),c.jsx(Ee,{variant:"destructive",size:"sm",className:"h-6 text-[11px] px-2",onClick:()=>{G(!1),yu()},children:"Discard & Close"})]})]})]})]})]}),Y==="developer"&&c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs(Ee,{variant:q?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>F(K=>!K),children:[c.jsx(mR,{className:"h-3 w-3 mr-1"}),"Debug"]})}),c.jsx(dr,{side:"bottom",children:"SSE debug stream"})]}),Y==="developer"&&c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs(Ee,{variant:E?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>E?mp():G1(),children:[c.jsx(Vf,{className:"h-3 w-3 mr-1"}),"Share"]})}),c.jsx(dr,{side:"bottom",children:"Screen sharing"})]}),Y==="manager"&&c.jsxs(c.Fragment,{children:[Le.selectedThread?c.jsxs(Ee,{variant:"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>{Le.setSelectedThreadId(null),t("")},children:[c.jsx(m7,{className:"h-3 w-3 mr-1"}),"Back"]}):c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs(Ee,{variant:w?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>S(K=>!K),children:[w?c.jsx(g5,{className:`h-3 w-3 mr-1${or?" rotate-90":""}`}):c.jsx(y5,{className:`h-3 w-3 mr-1${or?" rotate-90":""}`}),"Repositories"]})}),c.jsx(dr,{side:"bottom",children:"Toggle repositories panel"})]}),c.jsx("div",{className:"flex-1"}),Le.selectedThread?c.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[c.jsx(Jx,{status:Le.selectedThread.status}),Xx(Le.selectedThread.title)?c.jsx(iP,{className:"text-[11px] h-3.5 w-28"}):c.jsx("span",{className:"text-[11px] text-muted-foreground truncate max-w-[200px]",children:Le.selectedThread.title.replace(/^\[.*?\]\s*/,"")}),Le.selectedRepo&&c.jsxs("span",{className:"text-[10px] text-muted-foreground truncate max-w-[160px]",children:[Le.selectedRepo.name," · ",Le.selectedRepo.defaultBranch]}),Le.selectedThread.branch&&c.jsx(Rt,{variant:"outline",className:"text-[9px] px-1 py-0 font-mono",children:Le.selectedThread.branch}),Le.selectedThread.status==="running"&&c.jsx(Ee,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>void Le.handleStop(Le.selectedThread.id),children:c.jsx(ed,{className:"h-2.5 w-2.5"})}),Le.showGitActions&&Le.selectedRepo&&c.jsx("div",{className:"ml-2 shrink-0",children:c.jsx(Dx,{threadId:Le.selectedThread.id,cwd:Le.selectedThread.workingDirectory??Le.selectedRepo.localPath,branch:Le.selectedThread.branch,baseBranch:Le.selectedRepo.defaultBranch,threadTitle:Le.selectedThread.title,threadStatus:Le.selectedThread.status,prUrl:Le.selectedThread.prUrl,prState:Le.selectedThread.prState,ghAvailable:Le.ghAvailable})})]}):null]})]}),a==="jobs"?c.jsx("div",{className:"flex-1 overflow-y-auto",children:c.jsx(sse,{})}):a==="network"?c.jsx("div",{className:"flex-1 overflow-y-auto",children:c.jsx(Dce,{token:Qe})}):a==="settings"?c.jsx("div",{className:"flex-1 overflow-y-auto",children:c.jsx(Ece,{username:(lr==null?void 0:lr.username)??"",token:Qe,apiKeys:Hr.api_keys,onSaveApiKeys:xu,sttProvider:Hr.stt_provider,onSttProviderChange:async K=>{await Ol({stt_provider:K})},onClearArchive:Pp,activityEvents:Z1,updateInfo:$e,updateChecking:qe,onCheckUpdate:()=>{go()},onApplyUpdate:()=>{Oi()},updateApplying:ct,platform:Pe})}):c.jsxs("div",{className:`flex flex-1 min-h-0 overflow-hidden ${or?"flex-col":""}`,children:[Y==="developer"&&y&&c.jsx("aside",{className:`overflow-hidden ${or?"h-52 border-b shrink-0":"w-56 border-r shrink-0"}`,children:c.jsx(aZ,{sessions:lp,activeSessionId:tt,onSelect:ap,onCreate:()=>Qi(),onArchive:Ta})}),Y==="developer"&&Ei&&!xn&&c.jsx(OC,{ref:oi,autoOpenRemotePath:(zt==null?void 0:zt.workspaceRoot)??null,surfaceId:(zt==null?void 0:zt.surfaceId)??null,files:_n,activeFileId:Xn,onActiveFileChange:bn,onFileDrop:K=>{Ep(K)},onReferenceFile:K=>{var me;return(me=Zi.current)==null?void 0:me.insertChip({path:K.path,name:K.name})},onAvailableFilesChange:Er,showTree:P,showEditor:R,onToggleTree:gp,onToggleEditor:yp,changedPaths:xp,fsWatcherVersion:F1}),Y==="developer"&&Ei&&xn&&c.jsx("aside",{className:"flex-[4] min-w-0 border-r bg-background overflow-hidden flex flex-col",children:c.jsx(NC,{filePath:xn.filePath,originalContent:xn.originalContent,modifiedContent:xn.modifiedContent,language:xn.language,onClose:Ls,onApply:K=>{kp(K)}})}),Y==="developer"&&jl&&!xn&&(P||R)&&c.jsx("section",{className:`shrink-0 border-b bg-background overflow-hidden ${Su?"h-[50dvh] min-h-[220px]":"h-[55dvh] min-h-[260px]"}`,children:c.jsx(OC,{ref:oi,autoOpenRemotePath:(zt==null?void 0:zt.workspaceRoot)??null,surfaceId:(zt==null?void 0:zt.surfaceId)??null,files:_n,activeFileId:Xn,onActiveFileChange:bn,onFileDrop:K=>{Ep(K)},onReferenceFile:K=>{var me;return(me=Zi.current)==null?void 0:me.insertChip({path:K.path,name:K.name})},onAvailableFilesChange:Er,showTree:P,showEditor:R,onToggleTree:gp,onToggleEditor:yp,changedPaths:xp,isMobile:!0})}),Y==="developer"&&jl&&!xn&&(!P||!R)&&c.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b bg-muted/20 shrink-0",children:[!P&&c.jsxs("button",{onClick:vp,className:"flex items-center gap-1 rounded px-2 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[c.jsx(Ec,{className:"h-3.5 w-3.5"}),c.jsx(qy,{className:"h-3.5 w-3.5"}),!or&&"Show Files"]}),!R&&c.jsxs("button",{onClick:_p,className:"flex items-center gap-1 rounded px-2 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[c.jsx(Ec,{className:"h-3.5 w-3.5"}),c.jsx(W_,{className:"h-3.5 w-3.5"}),!or&&"Show Editor"]})]}),Y==="developer"&&jl&&xn&&c.jsx("section",{className:`shrink-0 border-b bg-background overflow-hidden ${Su?"h-[50dvh] min-h-[220px]":"h-[55dvh] min-h-[260px]"}`,children:c.jsx(NC,{filePath:xn.filePath,originalContent:xn.originalContent,modifiedContent:xn.modifiedContent,language:xn.language,onClose:Ls,onApply:K=>{kp(K)}})}),Y==="manager"?c.jsx("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:Le.selectedThread?c.jsxs(c.Fragment,{children:[c.jsxs(t4,{className:"min-h-0 flex-1 border-b",compact:!0,children:[So.length===0&&c.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"No activity yet"}),So.map((K,me)=>{var Ne;return c.jsx(l6,{messageId:K.id,messageIndex:me,messageFromEnd:So.length-1-me,role:K.role,content:K.content,toolCalls:K.toolCalls,segments:K.segments,isStreaming:((Ne=Le.selectedThread)==null?void 0:Ne.status)==="running"&&me===So.length-1,compact:!0,preferLlmUi:!1},K.id)})]}),c.jsx("div",{className:"shrink-0 py-3 px-4",children:c.jsxs("div",{className:"mx-auto max-w-3xl",children:[Le.error&&c.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 mb-2",children:[c.jsx(Oc,{className:"h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:Le.error})]}),c.jsx(Xm,{ref:Zi,value:e,onChange:t,onSubmit:Ml,onStop:()=>{Le.selectedThread&&Le.handleStop(Le.selectedThread.id)},isLoading:((Eo=Le.selectedThread)==null?void 0:Eo.status)==="running",disabled:Le.creating,placeholder:(Cu=Le.selectedThread)!=null&&Cu.providerSessionId||((ju=Le.selectedThread)==null?void 0:ju.status)==="running"?"Send a follow-up message...":"Describe what you want to do...",viewMode:Y,onViewModeChange:ce,provider:oe,onProviderChange:te,cliModel:re,onCliModelChange:J}),c.jsx("div",{className:"flex items-center gap-2 px-1 mt-1.5",children:Le.selectedThread&&Le.selectedThread.status!=="running"&&!Le.selectedThread.providerSessionId&&c.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:"Thread finished — start a new one"})})]})})]}):c.jsxs("div",{className:`flex flex-1 min-h-0 ${or?"flex-col":""}`,children:[w&&c.jsx("div",{className:`overflow-hidden ${or?"h-52 shrink-0 border-b":"w-56 shrink-0 border-r"}`,children:c.jsx(Dhe,{repositories:Le.repositories,selectedRepoId:((ku=Le.selectedRepo)==null?void 0:ku.id)??null,isMobile:or,onSelect:Le.setSelectedRepoId,onAddRepository:()=>Le.setFolderPickerOpen(!0),onRemoveRepository:K=>{Le.removeRepository(K)}})}),c.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-y-auto",children:[c.jsx("div",{className:`relative z-10 flex flex-col items-center px-4 pb-2 pt-4${ke!=="idle"?" will-change-transform transition-transform duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]":""}`,style:ke==="center"?{transform:"translateY(calc(50vh - 200px))"}:ke==="top"?{transform:"translateY(0)"}:void 0,onTransitionEnd:()=>{ke==="top"&&je("idle")},children:c.jsxs("div",{className:"w-full max-w-3xl",children:[c.jsx("h1",{className:"mb-4 text-center text-2xl font-semibold tracking-tight",children:"What do you want to build?"}),Le.error&&c.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 mb-3",children:[c.jsx(Oc,{className:"h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:Le.error})]}),c.jsx(Xm,{ref:Zi,value:e,onChange:t,onSubmit:Ml,disabled:gu,controlsDisabled:Le.creating,placeholder:W1,viewMode:Y,onViewModeChange:ce,provider:oe,onProviderChange:te,cliModel:re,onCliModelChange:J,footerLeadingContent:c.jsx(Mhe,{repositories:Le.repositories,selectedRepo:Le.selectedRepo,disabled:Le.creating,onSelect:Le.setSelectedRepoId,onAddRepository:()=>Le.setFolderPickerOpen(!0)})})]})}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:c.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[c.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("span",{className:"text-sm font-medium",children:"Threads"}),c.jsx(Rt,{variant:"secondary",className:"h-5 rounded-md px-1.5 text-[10px]",children:Ms.length})]}),c.jsx(Ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>void Le.refresh(),children:c.jsx(Ah,{className:`h-3.5 w-3.5 ${Le.loading?"animate-spin":""}`})})]}),Ms.length===0?c.jsx("div",{className:"px-4 py-12 text-center text-sm text-muted-foreground",children:"No threads yet"}):c.jsx("div",{className:"flex flex-col",children:Ms.map(K=>{const me=Le.getRepositoryForThread(K),Ne=(me==null?void 0:me.name)??H1(K)??"Unknown repo";return c.jsx(Lhe,{thread:K,repo:me,repoName:Ne,prState:K.prState??Le.threadPrStates[K.id],ghAvailable:Le.ghAvailable,onOpen:()=>Le.setSelectedThreadId(K.id),onStop:()=>{Le.handleStop(K.id)},onDelete:()=>{Le.handleDelete(K.id)}},K.id)})})]})})]})]})}):Su?c.jsxs("div",{className:"flex flex-col flex-1 min-w-0 min-h-0 transition-all duration-300 ease-out",children:[C&&(!P||!R)&&!or&&c.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 border-b bg-muted/20 shrink-0",children:[!P&&c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs("button",{onClick:vp,className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[c.jsx(Ec,{className:"h-3 w-3"}),c.jsx(qy,{className:"h-3 w-3"}),"Show Files"]})}),c.jsx(dr,{side:"bottom",children:"Show file tree"})]}),!R&&c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs("button",{onClick:_p,className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[c.jsx(Ec,{className:"h-3 w-3"}),c.jsx(W_,{className:"h-3 w-3"}),"Show Editor"]})}),c.jsx(dr,{side:"bottom",children:"Show editor"})]})]}),c.jsx(t4,{className:"min-h-0 flex-1 border-b",compact:Ei,children:Pn.map((K,me)=>c.jsx(l6,{messageId:K.id,messageIndex:me,messageFromEnd:Pn.length-1-me,role:K.role,content:K.content,displayContent:K.displayContent,referencedFiles:K.referencedFiles,thinking:K.thinking,thinkingDuration:K.thinkingDuration,toolCalls:K.toolCalls,segments:K.segments,isStreaming:es&&K===Pn[Pn.length-1],compact:C||E,preferLlmUi:!0,onOpenTerminal:wp,onEditMessage:X1},K.id))}),c.jsx("div",{className:`shrink-0 py-3 ${Ei?"px-3":"px-4"}`,children:c.jsxs("div",{className:`mx-auto space-y-1.5 ${Ei?"max-w-none":"max-w-3xl"}`,children:[fu.length>0&&c.jsx(yZ,{items:fu}),Ni&&Ni!=="login_required"&&Ni!=="limit_reached"&&!es&&c.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 dark:text-red-400 dark:border-red-400/40 dark:bg-red-400/10",children:[c.jsx(Oc,{className:"h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:Ni})]}),vo&&!es&&c.jsxs("div",{className:"flex items-center justify-center gap-2 py-1.5",children:[c.jsxs("button",{onClick:()=>Aa({token:Qe,sessionId:tt}),className:"inline-flex items-center gap-1.5 rounded-md border bg-background px-3 py-1.5 text-xs font-medium text-foreground shadow-sm hover:bg-accent transition-colors",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Continue"]}),c.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Agent stopped — hit the tool execution limit"})]}),c.jsx(EZ,{compact:!0,sessionId:tt,onApproveAllEnabled:()=>Q(!0)}),uu&&c.jsx(mZ,{plan:uu,onApprove:Ti,onReject:du,isExecuting:es}),Rp&&c.jsx("p",{className:"text-center text-sm text-destructive",children:"Daily limit reached. Come back tomorrow."}),Jn.length>0&&c.jsx(vZ,{files:Jn,onAccept:Ma,onReject:hu,onAcceptAll:hp,onRejectAll:Tl,onFileClick:jp}),cp.length>0&&c.jsx(bZ,{items:cp,onRemove:_o,onEdit:bo}),c.jsx(Xm,{ref:Zi,value:e,onChange:t,onSubmit:Ml,onStop:fp,onQueue:_u,isLoading:es,disabled:Rp,onVoiceInput:wu,mode:T,onModeChange:ie,provider:oe,onProviderChange:te,cliModel:re,onCliModelChange:J,viewMode:Y,onViewModeChange:ce,availableFiles:Ns,onSearchFiles:Op,workspaceOpen:C}),c.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx("button",{onClick:()=>{dp(),Qi()},className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"New chat"}),Y==="manager"&&c.jsx("button",{onClick:()=>Le.setSelectedThreadId(null),className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"New thread"}),M&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-[11px] text-green-600 dark:text-green-400 truncate",children:"Approved all commands for this session"}),c.jsx("button",{onClick:Ap,className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"Clear approve all"})]})]}),yo!==null&&c.jsxs("span",{className:"text-[11px] text-muted-foreground shrink-0",children:[yo," remaining"]})]})]})})]}):c.jsx("div",{className:`flex-1 min-w-0 flex flex-col items-center justify-center px-4 ${Oe==="animating"?"animate-slide-from-top":""}`,onAnimationEnd:()=>Be("idle"),children:c.jsxs("div",{className:"w-full max-w-3xl space-y-8",children:[c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"text-3xl font-semibold tracking-tight",children:"Jait"}),c.jsx("p",{className:"text-base text-muted-foreground mt-1",children:"Just Another Intelligent Tool"})]}),c.jsx(cZ,{suggestions:Ahe,onSelect:Ll}),c.jsx(Xm,{ref:Zi,value:e,onChange:t,onSubmit:Ml,onStop:fp,onQueue:_u,isLoading:es,onVoiceInput:wu,mode:T,onModeChange:ie,provider:oe,onProviderChange:te,cliModel:re,onCliModelChange:J,viewMode:Y,onViewModeChange:ce,availableFiles:Ns,onSearchFiles:Op,workspaceOpen:C})]})})]}),v&&a==="chat"&&Y==="developer"&&c.jsxs("div",{className:"shrink-0 border-t overflow-hidden",style:{height:V},children:[c.jsx("div",{onMouseDown:Rl,className:"h-1 cursor-row-resize hover:bg-primary/30 transition-colors"}),c.jsxs("div",{className:"relative",children:[c.jsx(dhe,{terminals:ts,activeTerminalId:ns,onSelect:Ai,onCreate:()=>Ps(tt??"default"),onKill:Cp}),c.jsx("button",{onClick:Al,className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close terminal",children:c.jsx(Sr,{className:"h-3.5 w-3.5"})})]}),ns?c.jsx(fhe,{terminalId:ns,className:"h-[calc(100%-2rem)]"}):c.jsx("div",{className:"flex items-center justify-center h-[calc(100%-2rem)] text-sm text-muted-foreground",children:c.jsx("button",{onClick:()=>Ps(tt??"default"),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]}),Y==="developer"&&q&&c.jsx("div",{className:"fixed top-14 right-0 bottom-0 w-[420px] border-l z-50 shadow-xl",children:c.jsx(VZ,{onClose:()=>F(!1)})}),c.jsx(Wc,{open:n,onOpenChange:r,children:c.jsx(ba,{className:"sm:max-w-md",children:ze==="url"?c.jsxs(c.Fragment,{children:[c.jsxs(dl,{children:[c.jsxs(hl,{className:"flex items-center gap-2",children:[c.jsx(bi,{className:"h-5 w-5"}),"Connect to Gateway"]}),c.jsx(ua,{children:"Enter your Jait gateway URL to get started."})]}),c.jsxs("form",{onSubmit:Tp,className:"space-y-4 pt-2",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Xt,{htmlFor:"gateway-url",children:"Gateway URL"}),c.jsx(xr,{id:"gateway-url",placeholder:"https://jait.example.com",value:ve,onChange:K=>{ae(K.target.value),Pt(null)},autoFocus:!0})]}),Yn&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[c.jsx(to,{className:"h-4 w-4 shrink-0"}),Yn]}),c.jsx(Ee,{type:"submit",className:"w-full",disabled:yt,children:yt?c.jsxs(c.Fragment,{children:[c.jsx(bt,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):c.jsxs(c.Fragment,{children:[c.jsxs(dl,{children:[c.jsx(hl,{children:"Account"}),c.jsx(ua,{asChild:!0,children:he?c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx(bi,{className:"h-3 w-3 text-green-500"}),c.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:yi}),c.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>st("url"),children:"Change"})]}):c.jsx("p",{children:"Sign in with a username and password."})})]}),c.jsxs(o9,{value:Z,onValueChange:K=>le(K),children:[c.jsxs(V2,{className:"grid grid-cols-2 w-full",children:[c.jsx(id,{value:"login",children:"Login"}),c.jsx(id,{value:"register",children:"Register"})]}),c.jsx(sd,{value:"login",className:"pt-4",children:c.jsxs("form",{className:"space-y-4",onSubmit:Ha,children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Xt,{htmlFor:"login-username",children:"Username"}),c.jsx(xr,{id:"login-username",value:at,onChange:K=>Ue(K.target.value),autoComplete:"username",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Xt,{htmlFor:"login-password",children:"Password"}),c.jsx(xr,{id:"login-password",type:"password",value:kt,onChange:K=>ut(K.target.value),autoComplete:"current-password",required:!0})]}),c.jsx(Ee,{type:"submit",className:"w-full",children:"Login"})]})}),c.jsx(sd,{value:"register",className:"pt-4",children:c.jsxs("form",{className:"space-y-4",onSubmit:Np,children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Xt,{htmlFor:"register-username",children:"Username"}),c.jsx(xr,{id:"register-username",value:We,onChange:K=>ft(K.target.value),autoComplete:"username",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Xt,{htmlFor:"register-password",children:"Password"}),c.jsx(xr,{id:"register-password",type:"password",value:Ge,onChange:K=>_e(K.target.value),autoComplete:"new-password",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Xt,{htmlFor:"register-password-confirm",children:"Confirm password"}),c.jsx(xr,{id:"register-password-confirm",type:"password",value:ye,onChange:K=>xe(K.target.value),autoComplete:"new-password",required:!0})]}),c.jsx(Ee,{type:"submit",className:"w-full",children:"Create account"})]})})]}),i&&c.jsx("p",{className:"text-sm text-destructive",children:i})]})})}),c.jsx(e7,{open:Ji,onOpenChange:wn,onSelect:(K,me)=>{bp(K,me).catch(Ne=>{console.error("Failed to open workspace:",Ne),ms.error(`Failed to open workspace: ${Ne instanceof Error?Ne.message:"Unknown error"}`)})}}),c.jsx(e7,{open:Le.folderPickerOpen,onOpenChange:Le.setFolderPickerOpen,onSelect:(K,me)=>{Le.handleFolderSelected(K)}}),E&&c.jsxs("div",{className:"fixed z-50 bg-background border rounded-lg shadow-2xl overflow-hidden flex flex-col",style:{left:L.x<0?void 0:L.x,top:L.y<0?void 0:L.y,right:L.x<0?16:void 0,bottom:L.y<0?16:void 0,width:H.w,height:H.h},children:[c.jsxs("div",{className:"flex items-center justify-between h-8 px-3 border-b bg-muted/30 shrink-0 cursor-move select-none",onMouseDown:po,children:[c.jsxs("span",{className:"text-xs font-medium flex items-center gap-1.5",children:[c.jsx(Vf,{className:"h-3 w-3"})," Screen Share"]}),c.jsx(Ee,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:mp,children:c.jsx(Sr,{className:"h-3 w-3"})})]}),c.jsx($ce,{screenShare:wo}),c.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize opacity-50 hover:opacity-100",onMouseDown:kl,children:c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",className:"text-muted-foreground",children:c.jsx("path",{d:"M10 2L2 10M10 6L6 10M10 10L10 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})})}function Ihe(){const[e,t]=Te.useState(()=>document.documentElement.classList.contains("dark")?"dark":"light");return Te.useEffect(()=>{const n=document.documentElement,r=()=>t(n.classList.contains("dark")?"dark":"light");r();const i=new MutationObserver(r);return i.observe(n,{attributes:!0,attributeFilter:["class"]}),()=>i.disconnect()},[]),c.jsx(cR,{position:"top-right",theme:e,closeButton:!1})}LA.createRoot(document.getElementById("root")).render(c.jsxs(Te.StrictMode,{children:[c.jsx($he,{}),c.jsx(Ihe,{})]}));export{QY as _};
|
|
734
|
+
`)}`:e.trim(),ot=e.trim(),At=K!=null&&K.length?K.map(on=>({path:on.path,name:on.name})):void 0;Nl(He,{token:Qe,sessionId:me,mode:T,provider:oe,model:oe!=="jait"?re:void 0,onLoginRequired:()=>r(!0),...At?{displayContent:ot,referencedFiles:At}:{}}),t("")},Dl=async()=>{const K=e.trim();!K||gu||(t(""),await Le.handleSend(K,oe,oe!=="jait"?re:void 0))},Ll=async K=>{if(!Qe){r(!0);return}let me=tt;if(!me){const Ne=await Qi();me=(Ne==null?void 0:Ne.id)??null}me&&Nl(K,{token:Qe,sessionId:me,mode:T,provider:oe,model:oe!=="jait"?re:void 0,onLoginRequired:()=>r(!0)})},X1=g.useCallback(async(K,me,Ne,He)=>{!tt||!Qe||await Pa(K,me,Ne,He,{token:Qe,sessionId:tt,mode:T,provider:oe,model:oe!=="jait"?re:void 0,onLoginRequired:()=>r(!0)})},[tt,Pa,Qe,T,oe,re]),Ha=async K=>{K.preventDefault(),o(null);try{await mo(at,kt),r(!1),ut(""),u("chat")}catch(me){o(me instanceof Error?me.message:"Login failed")}},Np=async K=>{if(K.preventDefault(),o(null),!We||!Ge){o("Username and password are required");return}if(Ge!==ye){o("Passwords do not match");return}try{await U1(We,Ge),r(!1),_e(""),xe(""),u("chat")}catch(me){o(me instanceof Error?me.message:"Registration failed")}},Tp=g.useCallback(async K=>{K.preventDefault();const me=ve.trim();if(!me){Pt("Please enter a gateway URL");return}Mt(!0),Pt(null);try{const Ne=me.replace(/\/+$/,""),He=await fetch(`${Ne}/health`,{signal:AbortSignal.timeout(5e3)});if(!He.ok)throw new Error(`Server returned ${He.status}`);const ot=cn();if(mg(Ne),Ne!==ot){window.location.reload();return}st("auth")}catch(Ne){Pt(Ne instanceof Error?Ne.name==="TimeoutError"||Ne.name==="AbortError"?"Connection timed out":Ne.message:"Failed to connect")}finally{Mt(!1)}},[ve]),bu=()=>{op(),dp(),u("chat"),r(!0)},xu=async K=>{const me=Object.fromEntries(Object.entries(K).map(([Ne,He])=>[Ne,He.trim()]).filter(([,Ne])=>Ne.length>0));await Ol({api_keys:me})},Pp=async()=>{const K=await Na();return await V1(),K.removed},Ap=g.useCallback(async()=>{if(tt)try{await fetch(`${yi}/api/consent/pending/${tt}/approve-all`,{method:"DELETE"}),Q(!1)}catch{}},[tt]),wu=g.useCallback(async()=>{var Ne;if(!Qe){r(!0);return}let K=tt;if(!K){const He=await Qi();K=(He==null?void 0:He.id)??null}if(!K)return;let me="";if(Hr.stt_provider==="browser"){const He=window,ot=He.SpeechRecognition??He.webkitSpeechRecognition;if(!ot){window.alert('Speech-to-Text provider "Browser" is not supported in this browser.');return}me=await new Promise(At=>{const Jt=new ot;let on=!1;const Sn=$n=>{on||(on=!0,At($n))};Jt.lang="de-DE",Jt.interimResults=!1,Jt.maxAlternatives=1,Jt.onresult=$n=>{var Eu,is,Ou,Nu;const Ur=((Nu=(Ou=(is=(Eu=$n.results)==null?void 0:Eu[0])==null?void 0:is[0])==null?void 0:Ou.transcript)==null?void 0:Nu.trim())??"";Sn(Ur)},Jt.onerror=()=>Sn(""),Jt.onnomatch=()=>Sn(""),Jt.onend=()=>Sn(""),Jt.start()})}else me=((Ne=window.prompt("Speak now (simulated transcript):"))==null?void 0:Ne.trim())??"";if(me)try{const ot=await(await fetch(`${yi}/api/voice/transcribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:K,transcript:me})})).json();ot.text&&Nl(ot.text,{token:Qe,sessionId:K,onLoginRequired:()=>r(!0)})}catch{}},[Qe,tt,Qi,Nl,Hr.stt_provider]),Rp=Ni==="limit_reached",Su=Pn.length>0,J1=((cr=(Mp=lr==null?void 0:lr.username)==null?void 0:Mp[0])==null?void 0:cr.toUpperCase())??"?",Z1=[...Pn.slice(-10).map(K=>t7({id:`msg-${K.id}`,source:"chat",title:`Message: ${K.role}`,detail:K.content.slice(0,120)||"(empty message)"})),...ts.map(K=>t7({id:`term-${K.id}`,source:"terminal",title:"Terminal session",detail:`${K.id} (${K.state})`}))];return c.jsx(NH,{children:c.jsxs("div",{className:"fixed inset-0 flex flex-col overflow-hidden safe-top safe-bottom safe-left safe-right",children:[c.jsxs("header",{className:`flex items-center px-2 sm:px-5 border-b shrink-0 gap-1 sm:gap-2 ${Ce?"h-10 !pl-[0.8rem]":"h-14"}`,style:Ce?{WebkitAppRegion:"drag",paddingLeft:wt==="darwin"?70:void 0,paddingRight:wt==="win32"?140:void 0}:void 0,children:[c.jsx("div",{className:"flex items-center shrink-0",style:Ce?{WebkitAppRegion:"no-drag"}:void 0,children:c.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 1024 1024",className:"shrink-0",children:[c.jsx("path",{d:"M318 372 L430 486 L318 600",fill:"none",stroke:"currentColor",strokeWidth:"88",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M610 258 L610 642 C610 734 549 796 455 796 C393 796 338 766 299 715",fill:"none",stroke:"currentColor",strokeWidth:"88",strokeLinecap:"round",strokeLinejoin:"round"})]})}),c.jsxs("nav",{className:"flex items-center gap-1 min-w-0 overflow-x-auto scrollbar-none",style:Ce?{WebkitAppRegion:"no-drag"}:void 0,children:[c.jsxs(Ee,{variant:a==="chat"?"secondary":"ghost",size:"sm",className:"h-8 text-xs shrink-0 px-2 sm:px-3",onClick:()=>u("chat"),children:[c.jsx(b7,{className:"h-3.5 w-3.5 sm:mr-1.5"}),c.jsx("span",{className:"hidden sm:inline",children:"Chat"})]}),c.jsxs(Ee,{variant:a==="jobs"?"secondary":"ghost",size:"sm",className:"h-8 text-xs shrink-0 px-2 sm:px-3",onClick:()=>u("jobs"),children:[c.jsx(V_,{className:"h-3.5 w-3.5 sm:mr-1.5"}),c.jsx("span",{className:"hidden sm:inline",children:"Jobs"})]}),c.jsxs(Ee,{variant:a==="network"?"secondary":"ghost",size:"sm",className:"h-8 text-xs shrink-0 px-2 sm:px-3",onClick:()=>u("network"),children:[c.jsx(h2,{className:"h-3.5 w-3.5 sm:mr-1.5"}),c.jsx("span",{className:"hidden sm:inline",children:"Network"})]})]}),c.jsx("div",{className:"flex-1 min-w-0"}),c.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5 shrink-0",style:Ce?{WebkitAppRegion:"no-drag"}:void 0,children:[a==="chat"&&Co.length>0&&c.jsx(zhe,{threads:Co,getRepositoryForThread:Le.getRepositoryForThread,ghAvailable:Le.ghAvailable,onOpenThread:K=>{Y!=="manager"&&ce("manager"),u("chat"),Le.setSelectedThreadId(K)},onStopThread:K=>Le.handleStop(K)}),wo.isActive&&c.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground bg-muted/60 rounded px-1.5 py-0.5 shrink-0",children:[c.jsx(Vf,{className:"h-3 w-3 text-green-500 animate-pulse"}),c.jsx("span",{className:"hidden sm:inline",children:"Sharing"})]}),c.jsx(xZ,{usage:up}),(()=>{const K=oe==="codex"?"openai":oe==="claude-code"?"anthropic":As??"ollama",me=oe==="codex"?re??"Codex":oe==="claude-code"?re??"Claude Code":Rs?uie(Rs):null,Ne=oe==="codex"?`OpenAI Codex CLI${re?` · ${re}`:""}`:oe==="claude-code"?`Anthropic Claude Code CLI${re?` · ${re}`:""}`:Rs??"";return me?c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5 sm:mr-2 px-1.5 sm:px-2 py-1 rounded-md bg-muted/50 cursor-default",children:[c.jsx(Vg,{provider:K,model:oe==="codex"?"codex":oe==="claude-code"?"claude-3":Rs??void 0,size:16}),c.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:me})]})}),c.jsx(dr,{side:"bottom",children:Ne})]}):null})(),yo!==null&&yo<=5&&c.jsxs("span",{className:"text-xs text-muted-foreground mr-1 sm:mr-2 hidden sm:inline",children:[yo," remaining"]}),($e==null?void 0:$e.hasUpdate)&&c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs("button",{onClick:()=>{Pe==="web"?u("settings"):window.open("https://github.com/JakobWl/Jait/releases/latest","_blank")},className:"flex items-center gap-1 px-2 py-1 rounded-md bg-amber-500/15 text-amber-600 dark:text-amber-400 hover:bg-amber-500/25 transition-colors text-xs",children:[c.jsx(v7,{className:"h-3.5 w-3.5"}),c.jsxs("span",{className:"hidden sm:inline",children:["v",$e.latestVersion]})]})}),c.jsxs(dr,{side:"bottom",children:["Update available — v",$e.latestVersion]})]}),Fr?c.jsxs(bl,{children:[c.jsx(xl,{asChild:!0,children:c.jsx("button",{className:"rounded-full ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:c.jsx(q7,{className:"h-7 w-7",children:c.jsx(K7,{className:"text-[11px]",children:J1})})})}),c.jsxs(ao,{align:"end",children:[c.jsx(y1,{children:lr==null?void 0:lr.username}),c.jsx(Dc,{}),c.jsxs(Yi,{onSelect:()=>u("settings"),children:[c.jsx(HR,{className:"h-4 w-4 mr-2"}),"Settings"]}),c.jsx(Dc,{}),c.jsxs("div",{className:"px-2 py-1.5",children:[c.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Theme"}),c.jsx("div",{className:"flex items-center h-7 w-fit rounded-full border bg-muted/50 p-0.5 mt-1.5",children:[["light",UR],["system",aa],["dark",LR]].map(([K,me])=>c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsx("button",{onClick:()=>{vu(K)},className:`relative flex items-center justify-center h-6 w-6 rounded-full transition-colors ${d===K?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:c.jsx(me,{className:"h-3.5 w-3.5"})})}),c.jsx(dr,{side:"bottom",children:K.charAt(0).toUpperCase()+K.slice(1)})]},K))})]}),c.jsx(Dc,{}),c.jsxs(Yi,{onSelect:bu,children:[c.jsx(TR,{className:"h-4 w-4 mr-2"}),"Logout"]})]})]}):c.jsx(Ee,{variant:"ghost",size:"sm",className:"h-8 text-xs",onClick:()=>r(!0),children:"Sign in"}),Ce&&wt==="linux"&&c.jsxs("div",{className:"flex items-center ml-2 -mr-2",children:[c.jsx("button",{onClick:()=>window.jaitDesktop.windowMinimize(),className:"flex items-center justify-center h-9 w-11 hover:bg-muted/80 transition-colors",children:c.jsx(MR,{className:"h-4 w-4"})}),c.jsx("button",{onClick:()=>window.jaitDesktop.windowMaximize(),className:"flex items-center justify-center h-9 w-11 hover:bg-muted/80 transition-colors",children:Gn?c.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",className:"fill-current",children:c.jsx("path",{d:"M2 0v2H0v8h8V8h2V0zm5 7H1V3h6zM9 1v6H8V2H3V1z"})}):c.jsx(ed,{className:"h-3 w-3"})}),c.jsx("button",{onClick:()=>window.jaitDesktop.windowClose(),className:"flex items-center justify-center h-9 w-11 hover:bg-red-600 hover:text-white transition-colors",children:c.jsx(Sr,{className:"h-4 w-4"})})]})]})]}),a==="chat"&&c.jsxs("div",{className:"flex items-center gap-1 px-2 sm:px-5 h-9 border-b shrink-0 bg-muted/30 overflow-x-auto scrollbar-none",children:[Y==="developer"&&c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs(Ee,{variant:y?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>p(K=>!K),children:[y?c.jsx(g5,{className:`h-3 w-3 mr-1${or?" rotate-90":""}`}):c.jsx(y5,{className:`h-3 w-3 mr-1${or?" rotate-90":""}`}),"Sessions"]})}),c.jsx(dr,{side:"bottom",children:"Toggle sessions sidebar"})]}),Y==="developer"&&c.jsxs(c.Fragment,{children:[c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs(Ee,{variant:v?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>{Sp()},children:[c.jsx(oa,{className:"h-3 w-3 mr-1"}),"Terminal"]})}),c.jsx(dr,{side:"bottom",children:"Toggle terminal panel"})]}),c.jsxs("div",{className:"relative flex items-center shrink-0",children:[c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs(Ee,{variant:C?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2",onClick:()=>{Y1()},children:[c.jsx(qy,{className:"h-3 w-3 mr-1"}),"Workspace",C&&c.jsx(Sr,{className:"h-3 w-3 ml-1"})]})}),c.jsx(dr,{side:"bottom",children:C?"Close workspace":"Open workspace"})]}),X&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(!1)}),c.jsxs("div",{ref:D,className:"absolute top-full left-0 mt-1 z-50 w-64 rounded-lg border bg-background shadow-lg p-3 space-y-2",children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Oc,{className:"h-4 w-4 text-amber-500 shrink-0 mt-0.5"}),c.jsxs("div",{className:"text-xs",children:[c.jsx("p",{className:"font-medium",children:"Close workspace?"}),c.jsxs("p",{className:"text-muted-foreground mt-0.5",children:["You have ",Jn.length," unsaved file ",Jn.length===1?"change":"changes"," that will be discarded."]})]})]}),c.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[c.jsx(Ee,{variant:"ghost",size:"sm",className:"h-6 text-[11px] px-2",onClick:()=>G(!1),children:"Cancel"}),c.jsx(Ee,{variant:"destructive",size:"sm",className:"h-6 text-[11px] px-2",onClick:()=>{G(!1),yu()},children:"Discard & Close"})]})]})]})]})]}),Y==="developer"&&c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs(Ee,{variant:q?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>F(K=>!K),children:[c.jsx(mR,{className:"h-3 w-3 mr-1"}),"Debug"]})}),c.jsx(dr,{side:"bottom",children:"SSE debug stream"})]}),Y==="developer"&&c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs(Ee,{variant:E?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>E?mp():G1(),children:[c.jsx(Vf,{className:"h-3 w-3 mr-1"}),"Share"]})}),c.jsx(dr,{side:"bottom",children:"Screen sharing"})]}),Y==="manager"&&c.jsxs(c.Fragment,{children:[Le.selectedThread?c.jsxs(Ee,{variant:"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>{Le.setSelectedThreadId(null),t("")},children:[c.jsx(m7,{className:"h-3 w-3 mr-1"}),"Back"]}):c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs(Ee,{variant:w?"secondary":"ghost",size:"sm",className:"h-6 text-[11px] px-2 shrink-0",onClick:()=>S(K=>!K),children:[w?c.jsx(g5,{className:`h-3 w-3 mr-1${or?" rotate-90":""}`}):c.jsx(y5,{className:`h-3 w-3 mr-1${or?" rotate-90":""}`}),"Repositories"]})}),c.jsx(dr,{side:"bottom",children:"Toggle repositories panel"})]}),c.jsx("div",{className:"flex-1"}),Le.selectedThread?c.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[c.jsx(Jx,{status:Le.selectedThread.status}),Xx(Le.selectedThread.title)?c.jsx(iP,{className:"text-[11px] h-3.5 w-28"}):c.jsx("span",{className:"text-[11px] text-muted-foreground truncate max-w-[200px]",children:Le.selectedThread.title.replace(/^\[.*?\]\s*/,"")}),Le.selectedRepo&&c.jsxs("span",{className:"text-[10px] text-muted-foreground truncate max-w-[160px]",children:[Le.selectedRepo.name," · ",Le.selectedRepo.defaultBranch]}),Le.selectedThread.branch&&c.jsx(Rt,{variant:"outline",className:"text-[9px] px-1 py-0 font-mono",children:Le.selectedThread.branch}),Le.selectedThread.status==="running"&&c.jsx(Ee,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>void Le.handleStop(Le.selectedThread.id),children:c.jsx(ed,{className:"h-2.5 w-2.5"})}),Le.showGitActions&&Le.selectedRepo&&c.jsx("div",{className:"ml-2 shrink-0",children:c.jsx(Dx,{threadId:Le.selectedThread.id,cwd:Le.selectedThread.workingDirectory??Le.selectedRepo.localPath,branch:Le.selectedThread.branch,baseBranch:Le.selectedRepo.defaultBranch,threadTitle:Le.selectedThread.title,threadStatus:Le.selectedThread.status,prUrl:Le.selectedThread.prUrl,prState:Le.selectedThread.prState,ghAvailable:Le.ghAvailable})})]}):null]})]}),a==="jobs"?c.jsx("div",{className:"flex-1 overflow-y-auto",children:c.jsx(sse,{})}):a==="network"?c.jsx("div",{className:"flex-1 overflow-y-auto",children:c.jsx(Dce,{token:Qe})}):a==="settings"?c.jsx("div",{className:"flex-1 overflow-y-auto",children:c.jsx(Ece,{username:(lr==null?void 0:lr.username)??"",token:Qe,apiKeys:Hr.api_keys,onSaveApiKeys:xu,sttProvider:Hr.stt_provider,onSttProviderChange:async K=>{await Ol({stt_provider:K})},onClearArchive:Pp,activityEvents:Z1,updateInfo:$e,updateChecking:qe,onCheckUpdate:()=>{go()},onApplyUpdate:()=>{Oi()},updateApplying:ct,platform:Pe})}):c.jsxs("div",{className:`flex flex-1 min-h-0 overflow-hidden ${or?"flex-col":""}`,children:[Y==="developer"&&y&&c.jsx("aside",{className:`overflow-hidden ${or?"h-52 border-b shrink-0":"w-56 border-r shrink-0"}`,children:c.jsx(aZ,{sessions:lp,activeSessionId:tt,onSelect:ap,onCreate:()=>Qi(),onArchive:Ta})}),Y==="developer"&&Ei&&!xn&&c.jsx(OC,{ref:oi,autoOpenRemotePath:(zt==null?void 0:zt.workspaceRoot)??null,surfaceId:(zt==null?void 0:zt.surfaceId)??null,files:_n,activeFileId:Xn,onActiveFileChange:bn,onFileDrop:K=>{Ep(K)},onReferenceFile:K=>{var me;return(me=Zi.current)==null?void 0:me.insertChip({path:K.path,name:K.name})},onAvailableFilesChange:Er,showTree:P,showEditor:R,onToggleTree:gp,onToggleEditor:yp,changedPaths:xp,fsWatcherVersion:F1}),Y==="developer"&&Ei&&xn&&c.jsx("aside",{className:"flex-[4] min-w-0 border-r bg-background overflow-hidden flex flex-col",children:c.jsx(NC,{filePath:xn.filePath,originalContent:xn.originalContent,modifiedContent:xn.modifiedContent,language:xn.language,onClose:Ls,onApply:K=>{kp(K)}})}),Y==="developer"&&jl&&!xn&&(P||R)&&c.jsx("section",{className:`shrink-0 border-b bg-background overflow-hidden ${Su?"h-[50dvh] min-h-[220px]":"h-[55dvh] min-h-[260px]"}`,children:c.jsx(OC,{ref:oi,autoOpenRemotePath:(zt==null?void 0:zt.workspaceRoot)??null,surfaceId:(zt==null?void 0:zt.surfaceId)??null,files:_n,activeFileId:Xn,onActiveFileChange:bn,onFileDrop:K=>{Ep(K)},onReferenceFile:K=>{var me;return(me=Zi.current)==null?void 0:me.insertChip({path:K.path,name:K.name})},onAvailableFilesChange:Er,showTree:P,showEditor:R,onToggleTree:gp,onToggleEditor:yp,changedPaths:xp,isMobile:!0})}),Y==="developer"&&jl&&!xn&&(!P||!R)&&c.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b bg-muted/20 shrink-0",children:[!P&&c.jsxs("button",{onClick:vp,className:"flex items-center gap-1 rounded px-2 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[c.jsx(Ec,{className:"h-3.5 w-3.5"}),c.jsx(qy,{className:"h-3.5 w-3.5"}),!or&&"Show Files"]}),!R&&c.jsxs("button",{onClick:_p,className:"flex items-center gap-1 rounded px-2 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[c.jsx(Ec,{className:"h-3.5 w-3.5"}),c.jsx(W_,{className:"h-3.5 w-3.5"}),!or&&"Show Editor"]})]}),Y==="developer"&&jl&&xn&&c.jsx("section",{className:`shrink-0 border-b bg-background overflow-hidden ${Su?"h-[50dvh] min-h-[220px]":"h-[55dvh] min-h-[260px]"}`,children:c.jsx(NC,{filePath:xn.filePath,originalContent:xn.originalContent,modifiedContent:xn.modifiedContent,language:xn.language,onClose:Ls,onApply:K=>{kp(K)}})}),Y==="manager"?c.jsx("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:Le.selectedThread?c.jsxs(c.Fragment,{children:[c.jsxs(t4,{className:"min-h-0 flex-1 border-b",compact:!0,children:[So.length===0&&c.jsx("div",{className:"text-center text-sm text-muted-foreground py-8",children:"No activity yet"}),So.map((K,me)=>{var Ne;return c.jsx(l6,{messageId:K.id,messageIndex:me,messageFromEnd:So.length-1-me,role:K.role,content:K.content,toolCalls:K.toolCalls,segments:K.segments,isStreaming:((Ne=Le.selectedThread)==null?void 0:Ne.status)==="running"&&me===So.length-1,compact:!0,preferLlmUi:!1},K.id)})]}),c.jsx("div",{className:"shrink-0 py-3 px-4",children:c.jsxs("div",{className:"mx-auto max-w-3xl",children:[Le.error&&c.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 mb-2",children:[c.jsx(Oc,{className:"h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:Le.error})]}),c.jsx(Xm,{ref:Zi,value:e,onChange:t,onSubmit:Ml,onStop:()=>{Le.selectedThread&&Le.handleStop(Le.selectedThread.id)},isLoading:((Eo=Le.selectedThread)==null?void 0:Eo.status)==="running",disabled:Le.creating,placeholder:(Cu=Le.selectedThread)!=null&&Cu.providerSessionId||((ju=Le.selectedThread)==null?void 0:ju.status)==="running"?"Send a follow-up message...":"Describe what you want to do...",viewMode:Y,onViewModeChange:ce,provider:oe,onProviderChange:te,cliModel:re,onCliModelChange:J}),c.jsx("div",{className:"flex items-center gap-2 px-1 mt-1.5",children:Le.selectedThread&&Le.selectedThread.status!=="running"&&!Le.selectedThread.providerSessionId&&c.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:"Thread finished — start a new one"})})]})})]}):c.jsxs("div",{className:`flex flex-1 min-h-0 ${or?"flex-col":""}`,children:[w&&c.jsx("div",{className:`overflow-hidden ${or?"h-52 shrink-0 border-b":"w-56 shrink-0 border-r"}`,children:c.jsx(Dhe,{repositories:Le.repositories,selectedRepoId:((ku=Le.selectedRepo)==null?void 0:ku.id)??null,isMobile:or,onSelect:Le.setSelectedRepoId,onAddRepository:()=>Le.setFolderPickerOpen(!0),onRemoveRepository:K=>{Le.removeRepository(K)}})}),c.jsxs("div",{className:"flex-1 flex flex-col min-w-0 overflow-y-auto",children:[c.jsx("div",{className:`relative z-10 flex flex-col items-center px-4 pb-2 pt-4${ke!=="idle"?" will-change-transform transition-transform duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]":""}`,style:ke==="center"?{transform:"translateY(calc(50vh - 200px))"}:ke==="top"?{transform:"translateY(0)"}:void 0,onTransitionEnd:()=>{ke==="top"&&je("idle")},children:c.jsxs("div",{className:"w-full max-w-3xl",children:[c.jsx("h1",{className:"mb-4 text-center text-2xl font-semibold tracking-tight",children:"What do you want to build?"}),Le.error&&c.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 mb-3",children:[c.jsx(Oc,{className:"h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:Le.error})]}),c.jsx(Xm,{ref:Zi,value:e,onChange:t,onSubmit:Ml,disabled:gu,controlsDisabled:Le.creating,placeholder:W1,viewMode:Y,onViewModeChange:ce,provider:oe,onProviderChange:te,cliModel:re,onCliModelChange:J,footerLeadingContent:c.jsx(Mhe,{repositories:Le.repositories,selectedRepo:Le.selectedRepo,disabled:Le.creating,onSelect:Le.setSelectedRepoId,onAddRepository:()=>Le.setFolderPickerOpen(!0)})})]})}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:c.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[c.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("span",{className:"text-sm font-medium",children:"Threads"}),c.jsx(Rt,{variant:"secondary",className:"h-5 rounded-md px-1.5 text-[10px]",children:Ms.length})]}),c.jsx(Ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>void Le.refresh(),children:c.jsx(Ah,{className:`h-3.5 w-3.5 ${Le.loading?"animate-spin":""}`})})]}),Ms.length===0?c.jsx("div",{className:"px-4 py-12 text-center text-sm text-muted-foreground",children:"No threads yet"}):c.jsx("div",{className:"flex flex-col",children:Ms.map(K=>{const me=Le.getRepositoryForThread(K),Ne=(me==null?void 0:me.name)??H1(K)??"Unknown repo";return c.jsx(Lhe,{thread:K,repo:me,repoName:Ne,prState:K.prState??Le.threadPrStates[K.id],ghAvailable:Le.ghAvailable,onOpen:()=>Le.setSelectedThreadId(K.id),onStop:()=>{Le.handleStop(K.id)},onDelete:()=>{Le.handleDelete(K.id)}},K.id)})})]})})]})]})}):Su?c.jsxs("div",{className:"flex flex-col flex-1 min-w-0 min-h-0 transition-all duration-300 ease-out",children:[C&&(!P||!R)&&!or&&c.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 border-b bg-muted/20 shrink-0",children:[!P&&c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs("button",{onClick:vp,className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[c.jsx(Ec,{className:"h-3 w-3"}),c.jsx(qy,{className:"h-3 w-3"}),"Show Files"]})}),c.jsx(dr,{side:"bottom",children:"Show file tree"})]}),!R&&c.jsxs(_r,{children:[c.jsx(br,{asChild:!0,children:c.jsxs("button",{onClick:_p,className:"flex items-center gap-1 rounded px-2 py-0.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[c.jsx(Ec,{className:"h-3 w-3"}),c.jsx(W_,{className:"h-3 w-3"}),"Show Editor"]})}),c.jsx(dr,{side:"bottom",children:"Show editor"})]})]}),c.jsx(t4,{className:"min-h-0 flex-1 border-b",compact:Ei,children:Pn.map((K,me)=>c.jsx(l6,{messageId:K.id,messageIndex:me,messageFromEnd:Pn.length-1-me,role:K.role,content:K.content,displayContent:K.displayContent,referencedFiles:K.referencedFiles,thinking:K.thinking,thinkingDuration:K.thinkingDuration,toolCalls:K.toolCalls,segments:K.segments,isStreaming:es&&K===Pn[Pn.length-1],compact:C||E,preferLlmUi:!0,onOpenTerminal:wp,onEditMessage:X1},K.id))}),c.jsx("div",{className:`shrink-0 py-3 ${Ei?"px-3":"px-4"}`,children:c.jsxs("div",{className:`mx-auto space-y-1.5 ${Ei?"max-w-none":"max-w-3xl"}`,children:[fu.length>0&&c.jsx(yZ,{items:fu}),Ni&&Ni!=="login_required"&&Ni!=="limit_reached"&&!es&&c.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-red-500/40 bg-red-500/10 px-3.5 py-2.5 text-sm text-red-400 dark:text-red-400 dark:border-red-400/40 dark:bg-red-400/10",children:[c.jsx(Oc,{className:"h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 break-words",children:Ni})]}),vo&&!es&&c.jsxs("div",{className:"flex items-center justify-center gap-2 py-1.5",children:[c.jsxs("button",{onClick:()=>Aa({token:Qe,sessionId:tt}),className:"inline-flex items-center gap-1.5 rounded-md border bg-background px-3 py-1.5 text-xs font-medium text-foreground shadow-sm hover:bg-accent transition-colors",children:[c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:c.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),"Continue"]}),c.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Agent stopped — hit the tool execution limit"})]}),c.jsx(EZ,{compact:!0,sessionId:tt,onApproveAllEnabled:()=>Q(!0)}),uu&&c.jsx(mZ,{plan:uu,onApprove:Ti,onReject:du,isExecuting:es}),Rp&&c.jsx("p",{className:"text-center text-sm text-destructive",children:"Daily limit reached. Come back tomorrow."}),Jn.length>0&&c.jsx(vZ,{files:Jn,onAccept:Ma,onReject:hu,onAcceptAll:hp,onRejectAll:Tl,onFileClick:jp}),cp.length>0&&c.jsx(bZ,{items:cp,onRemove:_o,onEdit:bo}),c.jsx(Xm,{ref:Zi,value:e,onChange:t,onSubmit:Ml,onStop:fp,onQueue:_u,isLoading:es,disabled:Rp,onVoiceInput:wu,mode:T,onModeChange:ie,provider:oe,onProviderChange:te,cliModel:re,onCliModelChange:J,viewMode:Y,onViewModeChange:ce,availableFiles:Ns,onSearchFiles:Op,workspaceOpen:C}),c.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx("button",{onClick:()=>{dp(),Qi()},className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"New chat"}),Y==="manager"&&c.jsx("button",{onClick:()=>Le.setSelectedThreadId(null),className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"New thread"}),M&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-[11px] text-green-600 dark:text-green-400 truncate",children:"Approved all commands for this session"}),c.jsx("button",{onClick:Ap,className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors shrink-0",children:"Clear approve all"})]})]}),yo!==null&&c.jsxs("span",{className:"text-[11px] text-muted-foreground shrink-0",children:[yo," remaining"]})]})]})})]}):c.jsx("div",{className:`flex-1 min-w-0 flex flex-col items-center justify-center px-4 ${Oe==="animating"?"animate-slide-from-top":""}`,onAnimationEnd:()=>Be("idle"),children:c.jsxs("div",{className:"w-full max-w-3xl space-y-8",children:[c.jsxs("div",{className:"text-center",children:[c.jsx("h1",{className:"text-3xl font-semibold tracking-tight",children:"Jait"}),c.jsx("p",{className:"text-base text-muted-foreground mt-1",children:"Just Another Intelligent Tool"})]}),c.jsx(cZ,{suggestions:Ahe,onSelect:Ll}),c.jsx(Xm,{ref:Zi,value:e,onChange:t,onSubmit:Ml,onStop:fp,onQueue:_u,isLoading:es,onVoiceInput:wu,mode:T,onModeChange:ie,provider:oe,onProviderChange:te,cliModel:re,onCliModelChange:J,viewMode:Y,onViewModeChange:ce,availableFiles:Ns,onSearchFiles:Op,workspaceOpen:C})]})})]}),v&&a==="chat"&&Y==="developer"&&c.jsxs("div",{className:"shrink-0 border-t overflow-hidden",style:{height:V},children:[c.jsx("div",{onMouseDown:Rl,className:"h-1 cursor-row-resize hover:bg-primary/30 transition-colors"}),c.jsxs("div",{className:"relative",children:[c.jsx(dhe,{terminals:ts,activeTerminalId:ns,onSelect:Ai,onCreate:()=>Ps(tt??"default"),onKill:Cp}),c.jsx("button",{onClick:Al,className:"absolute right-2 top-1/2 -translate-y-1/2 p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close terminal",children:c.jsx(Sr,{className:"h-3.5 w-3.5"})})]}),ns?c.jsx(fhe,{terminalId:ns,className:"h-[calc(100%-2rem)]"}):c.jsx("div",{className:"flex items-center justify-center h-[calc(100%-2rem)] text-sm text-muted-foreground",children:c.jsx("button",{onClick:()=>Ps(tt??"default"),className:"hover:text-foreground transition-colors",children:"+ New Terminal"})})]}),Y==="developer"&&q&&c.jsx("div",{className:"fixed top-14 right-0 bottom-0 w-[420px] border-l z-50 shadow-xl",children:c.jsx(VZ,{onClose:()=>F(!1)})}),c.jsx(Wc,{open:n,onOpenChange:r,children:c.jsx(ba,{className:"sm:max-w-md",children:ze==="url"?c.jsxs(c.Fragment,{children:[c.jsxs(dl,{children:[c.jsxs(hl,{className:"flex items-center gap-2",children:[c.jsx(bi,{className:"h-5 w-5"}),"Connect to Gateway"]}),c.jsx(ua,{children:"Enter your Jait gateway URL to get started."})]}),c.jsxs("form",{onSubmit:Tp,className:"space-y-4 pt-2",children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Xt,{htmlFor:"gateway-url",children:"Gateway URL"}),c.jsx(xr,{id:"gateway-url",placeholder:"https://jait.example.com",value:ve,onChange:K=>{ae(K.target.value),Pt(null)},autoFocus:!0})]}),Yn&&c.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive",children:[c.jsx(to,{className:"h-4 w-4 shrink-0"}),Yn]}),c.jsx(Ee,{type:"submit",className:"w-full",disabled:yt,children:yt?c.jsxs(c.Fragment,{children:[c.jsx(bt,{className:"h-4 w-4 mr-2 animate-spin"}),"Connecting…"]}):"Connect"})]})]}):c.jsxs(c.Fragment,{children:[c.jsxs(dl,{children:[c.jsx(hl,{children:"Account"}),c.jsx(ua,{asChild:!0,children:he?c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c.jsx(bi,{className:"h-3 w-3 text-green-500"}),c.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded",children:yi}),c.jsx("button",{type:"button",className:"text-xs text-primary underline underline-offset-2 hover:opacity-80",onClick:()=>st("url"),children:"Change"})]}):c.jsx("p",{children:"Sign in with a username and password."})})]}),c.jsxs(o9,{value:Z,onValueChange:K=>le(K),children:[c.jsxs(V2,{className:"grid grid-cols-2 w-full",children:[c.jsx(id,{value:"login",children:"Login"}),c.jsx(id,{value:"register",children:"Register"})]}),c.jsx(sd,{value:"login",className:"pt-4",children:c.jsxs("form",{className:"space-y-4",onSubmit:Ha,children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Xt,{htmlFor:"login-username",children:"Username"}),c.jsx(xr,{id:"login-username",value:at,onChange:K=>Ue(K.target.value),autoComplete:"username",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Xt,{htmlFor:"login-password",children:"Password"}),c.jsx(xr,{id:"login-password",type:"password",value:kt,onChange:K=>ut(K.target.value),autoComplete:"current-password",required:!0})]}),c.jsx(Ee,{type:"submit",className:"w-full",children:"Login"})]})}),c.jsx(sd,{value:"register",className:"pt-4",children:c.jsxs("form",{className:"space-y-4",onSubmit:Np,children:[c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Xt,{htmlFor:"register-username",children:"Username"}),c.jsx(xr,{id:"register-username",value:We,onChange:K=>ft(K.target.value),autoComplete:"username",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Xt,{htmlFor:"register-password",children:"Password"}),c.jsx(xr,{id:"register-password",type:"password",value:Ge,onChange:K=>_e(K.target.value),autoComplete:"new-password",required:!0})]}),c.jsxs("div",{className:"space-y-1.5",children:[c.jsx(Xt,{htmlFor:"register-password-confirm",children:"Confirm password"}),c.jsx(xr,{id:"register-password-confirm",type:"password",value:ye,onChange:K=>xe(K.target.value),autoComplete:"new-password",required:!0})]}),c.jsx(Ee,{type:"submit",className:"w-full",children:"Create account"})]})})]}),i&&c.jsx("p",{className:"text-sm text-destructive",children:i})]})})}),c.jsx(e7,{open:Ji,onOpenChange:wn,onSelect:(K,me)=>{bp(K,me).catch(Ne=>{console.error("Failed to open workspace:",Ne),ms.error(`Failed to open workspace: ${Ne instanceof Error?Ne.message:"Unknown error"}`)})}}),c.jsx(e7,{open:Le.folderPickerOpen,onOpenChange:Le.setFolderPickerOpen,onSelect:(K,me)=>{Le.handleFolderSelected(K)}}),E&&c.jsxs("div",{className:"fixed z-50 bg-background border rounded-lg shadow-2xl overflow-hidden flex flex-col",style:{left:L.x<0?void 0:L.x,top:L.y<0?void 0:L.y,right:L.x<0?16:void 0,bottom:L.y<0?16:void 0,width:H.w,height:H.h},children:[c.jsxs("div",{className:"flex items-center justify-between h-8 px-3 border-b bg-muted/30 shrink-0 cursor-move select-none",onMouseDown:po,children:[c.jsxs("span",{className:"text-xs font-medium flex items-center gap-1.5",children:[c.jsx(Vf,{className:"h-3 w-3"})," Screen Share"]}),c.jsx(Ee,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:mp,children:c.jsx(Sr,{className:"h-3 w-3"})})]}),c.jsx($ce,{screenShare:wo}),c.jsx("div",{className:"absolute bottom-0 right-0 w-3 h-3 cursor-nwse-resize opacity-50 hover:opacity-100",onMouseDown:kl,children:c.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",className:"text-muted-foreground",children:c.jsx("path",{d:"M10 2L2 10M10 6L6 10M10 10L10 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})})}function Ihe(){const[e,t]=Te.useState(()=>document.documentElement.classList.contains("dark")?"dark":"light");return Te.useEffect(()=>{const n=document.documentElement,r=()=>t(n.classList.contains("dark")?"dark":"light");r();const i=new MutationObserver(r);return i.observe(n,{attributes:!0,attributeFilter:["class"]}),()=>i.disconnect()},[]),c.jsx(cR,{position:"top-right",theme:e,closeButton:!1})}LA.createRoot(document.getElementById("root")).render(c.jsxs(Te.StrictMode,{children:[c.jsx($he,{}),c.jsx(Ihe,{})]}));export{QY as _};
|