@tiflis-io/tiflis-code-web 0.1.7 → 0.1.8
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.
|
@@ -397,7 +397,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
397
397
|
`,`!
|
|
398
398
|
`,`?
|
|
399
399
|
`];for(const h of u){const m=n.lastIndexOf(h);if(m>s)return m+h.length}const f=n.lastIndexOf(`
|
|
400
|
-
`);if(f>s)return f+1;const l=Math.floor(r/3),c=n.lastIndexOf(" ");return c>l?c+1:r}function tj(e,r){const n=[];let s=e;for(;s.length>r;){const o=ej(s,r),u=s.slice(0,o).trim();u&&n.push(u),s=s.slice(o).trim()}return s&&n.push(s),n.length===0?[e]:n}function Hm(e){return{id:`${e.id}-seg-0`,messageId:e.id,contentBlocks:e.contentBlocks,segmentIndex:0,totalSegments:1,isFirstSegment:!0,isLastSegment:!0,isStreaming:e.isStreaming,showAvatar:e.role==="assistant",createdAt:e.createdAt,role:e.role,sendStatus:e.sendStatus,fromDeviceId:e.fromDeviceId}}function rj(e,r=X3){if(e.role==="user")return[Hm(e)];if(e.contentBlocks.reduce((l,c)=>l+Fm(c),0)<r.minHeightUnitsToSplit)return[Hm(e)];const s=[];let o=[],u=0;for(const l of e.contentBlocks){const c=Fm(l);if(u+c>r.maxHeightUnitsPerSegment&&u>0){if(l.blockType==="text"&&c>r.maxHeightUnitsPerSegment/2){o.length>0&&(s.push(o),o=[],u=0);const h=r.maxHeightUnitsPerSegment*Dg,m=tj(l.content,h);for(let p=0;p<m.length;p++){const y=m[p];if(!y)continue;const x={id:`${l.id}-part-${p}`,blockType:"text",content:y,metadata:l.metadata};p<m.length-1?s.push([x]):(o.push(x),u=Fm(x))}continue}o.length>0&&(s.push(o),o=[],u=0)}o.push(l),u+=c}if(o.length>0&&s.push(o),s.length===0)return[Hm(e)];const f=s.length;return s.map((l,c)=>({id:`${e.id}-seg-${c}`,messageId:e.id,contentBlocks:l,segmentIndex:c,totalSegments:f,isFirstSegment:c===0,isLastSegment:c===f-1,isStreaming:e.isStreaming&&c===f-1,showAvatar:c===0,createdAt:e.createdAt,role:e.role,sendStatus:e.sendStatus,fromDeviceId:e.fromDeviceId}))}function nj(e){return e.flatMap(r=>rj(r))}function Cb({messages:e,isLoading:r,isSubscribing:n=!1,onSend:s,onSendAudio:o,onCancel:u,currentDeviceId:f,disabled:l=!1,emptyMessage:c="No messages yet. Start the conversation!",showVoice:h=!0,emptyIcon:m,agentType:p,hasMore:y=!1,isLoadingMore:x=!1,onLoadMore:A}){const w=R.useRef(null),v=R.useRef(null),[S,g]=R.useState(!1),[_,T]=R.useState(!0),M=R.useMemo(()=>nj(e),[e]),k=r&&e.length>0,L=R.useCallback(()=>{if(!w.current)return;const{scrollTop:P,scrollHeight:Y,clientHeight:$}=w.current,K=Y-P-$<100;T(K),g(!K&&e.length>0)},[e.length]);R.useEffect(()=>{w.current&&_&&(w.current.scrollTop=w.current.scrollHeight)},[M,_]),R.useEffect(()=>{const P=w.current;if(!P)return;let Y=!1;const $=()=>{Y||(requestAnimationFrame(()=>{L(),Y=!1}),Y=!0)};return P.addEventListener("scroll",$,{passive:!0}),()=>P.removeEventListener("scroll",$)},[L]),R.useEffect(()=>{if(!y||!A||x||n)return;const P=v.current;if(!P)return;const Y=new IntersectionObserver($=>{const W=$[0];W!=null&&W.isIntersecting&&y&&!x&&A()},{root:w.current,rootMargin:"100px 0px 0px 0px",threshold:0});return Y.observe(P),()=>Y.disconnect()},[y,A,x,n]);const D=R.useCallback(()=>{w.current&&w.current.scrollTo({top:w.current.scrollHeight,behavior:"smooth"})},[]);return b.jsxs("div",{className:"flex flex-col h-full",role:"main",children:[b.jsxs("div",{className:"relative flex-1",children:[b.jsx("div",{ref:w,className:"absolute inset-0 overflow-y-auto p-4",role:"log","aria-label":"Chat messages","aria-live":"polite",children:b.jsxs("div",{className:"max-w-3xl mx-auto",children:[!n&&e.length>0&&b.jsx("div",{ref:v,className:"h-1","aria-hidden":"true"}),x&&b.jsx("div",{className:"flex justify-center py-4",children:b.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[b.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),b.jsx("span",{children:"Loading older messages..."})]})}),n?b.jsx(Z3,{count:3}):e.length===0?b.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[200px] text-center",role:"status","aria-label":c,children:[b.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mb-4","aria-hidden":"true",children:m||b.jsx(_n,{className:"w-8 h-8 text-muted-foreground"})}),b.jsx("p",{className:"text-muted-foreground",children:c})]}):b.jsxs(b.Fragment,{children:[M.map(P=>b.jsx(z3,{contentBlocks:P.contentBlocks,isUser:P.role==="user",isStreaming:P.isStreaming,showAvatar:P.showAvatar,isContinuation:!P.isFirstSegment,sendStatus:P.isLastSegment?P.sendStatus:void 0,isCurrentDevice:!P.fromDeviceId||P.fromDeviceId===f,fromDeviceId:P.isLastSegment?P.fromDeviceId:void 0,agentType:p},P.id)),k&&b.jsx(K3,{agentType:p})]})]})}),b.jsx("button",{type:"button",onClick:D,className:Ae("absolute bottom-4 right-4 z-10","w-10 h-10 rounded-full shadow-lg","bg-background border border-border","flex items-center justify-center","transition-all duration-200 ease-out","hover:bg-muted hover:shadow-xl","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",S?"opacity-100 translate-y-0 pointer-events-auto":"opacity-0 translate-y-4 pointer-events-none"),"aria-label":"Scroll to bottom","aria-hidden":!S,children:b.jsx(LM,{className:"w-5 h-5 text-muted-foreground"})})]}),b.jsx($3,{onSend:s,onSendAudio:o,onCancel:u,isLoading:r,disabled:l,placeholder:l?"Not connected...":"Type a message...",showVoice:h})]})}function wb(){const{sessionId:e}=Ub(),r=!e,n=R.useRef(new Set),s=qe(O=>O.credentials),o=qe(O=>O.connectionState),u=qe(O=>O.sessions),f=dt(O=>O.supervisorMessages),l=dt(O=>O.supervisorIsLoading),c=dt(O=>O.historyPaginationState),h=dt(O=>O.agentMessages),m=dt(O=>O.agentIsLoading),{sendSupervisorCommand:p,cancelSupervisor:y,sendAgentCommand:x,cancelAgent:A,subscribeToSession:w,sendSupervisorVoiceCommand:v,sendAgentVoiceCommand:S,requestHistory:g}=co(),_=o==="verified"||o==="authenticated";R.useEffect(()=>{(o==="disconnected"||o==="error")&&n.current.clear()},[o]),R.useEffect(()=>{if(!e||r||!_||n.current.has(e))return;const O=u.find(z=>z.id===e);(O==null?void 0:O.type)!=="terminal"&&(n.current.add(e),w(e))},[e,r,_,u,w]);const T=e?u.find(O=>O.id===e):null,M=R.useCallback(O=>{p(O)},[p]),k=R.useCallback(O=>{e&&x(e,O)},[e,x]),L=R.useCallback(()=>{y()},[y]),D=R.useCallback(()=>{e&&A(e)},[e,A]),P=R.useCallback(async(O,z)=>{if(console.log("🎤 handleSupervisorAudio called:",{audioBlobSize:O.size,format:z,isConnected:_}),!_){console.error("❌ Not connected to WebSocket"),Lr.error("Connection Error","Not connected to Tiflis. Please check your connection.");return}const j=new FileReader;j.onloadend=()=>{const q=j.result,ne=q.split(",")[1];if(console.log("🎤 Converting to base64:",{originalSize:q.length,base64Size:ne==null?void 0:ne.length}),ne)try{v(ne,z),console.log("✅ Voice command sent successfully")}catch(X){console.error("❌ Failed to send voice command:",X),Lr.error("Voice Message Error","Failed to send voice message. Please try again.")}else console.error("❌ Failed to convert audio to base64"),Lr.error("Voice Message Error","Failed to process audio. Please try recording again.")},j.onerror=q=>{console.error("❌ FileReader error:",q),Lr.error("Voice Message Error","Failed to read audio file. Please try again.")},j.readAsDataURL(O)},[v,_]),Y=R.useCallback(async(O,z)=>{if(console.log("🎤 handleAgentAudio called:",{sessionId:e,audioBlobSize:O.size,format:z,isConnected:_}),!e){console.error("❌ No session ID provided"),Lr.error("Voice Message Error","No session active. Please select a session first.");return}if(!_){console.error("❌ Not connected to WebSocket"),Lr.error("Connection Error","Not connected to Tiflis. Please check your connection.");return}const j=new FileReader;j.onloadend=()=>{const q=j.result,ne=q.split(",")[1];if(console.log("🎤 Converting to base64:",{originalSize:q.length,base64Size:ne==null?void 0:ne.length}),ne)try{S(e,ne,z),console.log("✅ Voice command sent successfully")}catch(X){console.error("❌ Failed to send voice command:",X),Lr.error("Voice Message Error","Failed to send voice message. Please try again.")}else console.error("❌ Failed to convert audio to base64"),Lr.error("Voice Message Error","Failed to process audio. Please try recording again.")},j.onerror=q=>{console.error("❌ FileReader error:",q),Lr.error("Voice Message Error","Failed to read audio file. Please try again.")},j.readAsDataURL(O)},[e,S,_]),$=R.useCallback(()=>{const O=c.supervisor;O!=null&&O.hasMore&&!(O!=null&&O.isLoading)&&(O!=null&&O.oldestSequence)&&g(null,O.oldestSequence)},[c,g]),W=R.useCallback(()=>{if(!e)return;const O=c[e];O!=null&&O.hasMore&&!(O!=null&&O.isLoading)&&(O!=null&&O.oldestSequence)&&g(e,O.oldestSequence)},[e,c,g]),K=O=>{if(!O)return b.jsx(_n,{className:"w-8 h-8 text-muted-foreground"});switch(O.type){case"claude":return b.jsx(Aa,{className:"w-8 h-8 text-muted-foreground"});case"cursor":return b.jsx(Ra,{className:"w-8 h-8 text-muted-foreground"});case"opencode":return b.jsx(Ta,{className:"w-8 h-8 text-muted-foreground"});default:return b.jsx(_n,{className:"w-8 h-8 text-muted-foreground"})}};if(r){const O=c.supervisor,z=(O==null?void 0:O.isLoading)??!1,j=(O==null?void 0:O.hasMore)??!1;return b.jsx(Cb,{messages:f,isLoading:l,isSubscribing:z&&f.length===0,onSend:M,onSendAudio:P,onCancel:L,currentDeviceId:s==null?void 0:s.deviceId,disabled:!_,emptyMessage:"Hello! I'm your AI assistant. Ask me to create sessions, manage your workspace, or help with tasks.",emptyIcon:b.jsx(va,{className:"w-8 h-8 text-muted-foreground"}),agentType:"supervisor",hasMore:j,isLoadingMore:z&&f.length>0,onLoadMore:$})}const J=h[e]??[],G=m[e]??!1,F=c[e],re=(F==null?void 0:F.isLoading)??!1,te=(F==null?void 0:F.hasMore)??!1;return b.jsx(Cb,{messages:J,isLoading:G,isSubscribing:re&&J.length===0,onSend:k,onSendAudio:Y,onCancel:D,currentDeviceId:s==null?void 0:s.deviceId,disabled:!_,emptyMessage:`Start a conversation with ${(T==null?void 0:T.agentName)??"the agent"}...`,emptyIcon:K(T??null),agentType:T==null?void 0:T.type,hasMore:te,isLoadingMore:re&&J.length>0,onLoadMore:W})}var Vm={exports:{}},xb;function ij(){return xb||(xb=1,(function(e,r){(function(n,s){e.exports=s()})(globalThis,(()=>(()=>{var n={4567:function(f,l,c){var h=this&&this.__decorate||function(g,_,T,M){var k,L=arguments.length,D=L<3?_:M===null?M=Object.getOwnPropertyDescriptor(_,T):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(g,_,T,M);else for(var P=g.length-1;P>=0;P--)(k=g[P])&&(D=(L<3?k(D):L>3?k(_,T,D):k(_,T))||D);return L>3&&D&&Object.defineProperty(_,T,D),D},m=this&&this.__param||function(g,_){return function(T,M){_(T,M,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const p=c(9042),y=c(9924),x=c(844),A=c(4725),w=c(2585),v=c(3656);let S=l.AccessibilityManager=class extends x.Disposable{constructor(g,_,T,M){super(),this._terminal=g,this._coreBrowserService=T,this._renderService=M,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let k=0;k<this._terminal.rows;k++)this._rowElements[k]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[k]);if(this._topBoundaryFocusListener=k=>this._handleBoundaryFocus(k,0),this._bottomBoundaryFocusListener=k=>this._handleBoundaryFocus(k,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new y.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((k=>this._handleResize(k.rows)))),this.register(this._terminal.onRender((k=>this._refreshRows(k.start,k.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((k=>this._handleChar(k)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
400
|
+
`);if(f>s)return f+1;const l=Math.floor(r/3),c=n.lastIndexOf(" ");return c>l?c+1:r}function tj(e,r){const n=[];let s=e;for(;s.length>r;){const o=ej(s,r),u=s.slice(0,o).trim();u&&n.push(u),s=s.slice(o).trim()}return s&&n.push(s),n.length===0?[e]:n}function Hm(e){return{id:`${e.id}-seg-0`,messageId:e.id,contentBlocks:e.contentBlocks,segmentIndex:0,totalSegments:1,isFirstSegment:!0,isLastSegment:!0,isStreaming:e.isStreaming,showAvatar:e.role==="assistant",createdAt:e.createdAt,role:e.role,sendStatus:e.sendStatus,fromDeviceId:e.fromDeviceId}}function rj(e,r=X3){if(e.role==="user")return[Hm(e)];if(e.contentBlocks.reduce((l,c)=>l+Fm(c),0)<r.minHeightUnitsToSplit)return[Hm(e)];const s=[];let o=[],u=0;for(const l of e.contentBlocks){const c=Fm(l);if(u+c>r.maxHeightUnitsPerSegment&&u>0){if(l.blockType==="text"&&c>r.maxHeightUnitsPerSegment/2){o.length>0&&(s.push(o),o=[],u=0);const h=r.maxHeightUnitsPerSegment*Dg,m=tj(l.content,h);for(let p=0;p<m.length;p++){const y=m[p];if(!y)continue;const x={id:`${l.id}-part-${p}`,blockType:"text",content:y,metadata:l.metadata};p<m.length-1?s.push([x]):(o.push(x),u=Fm(x))}continue}o.length>0&&(s.push(o),o=[],u=0)}o.push(l),u+=c}if(o.length>0&&s.push(o),s.length===0)return[Hm(e)];const f=s.length;return s.map((l,c)=>({id:`${e.id}-seg-${c}`,messageId:e.id,contentBlocks:l,segmentIndex:c,totalSegments:f,isFirstSegment:c===0,isLastSegment:c===f-1,isStreaming:e.isStreaming&&c===f-1,showAvatar:c===0,createdAt:e.createdAt,role:e.role,sendStatus:e.sendStatus,fromDeviceId:e.fromDeviceId}))}function nj(e){return e.flatMap(r=>rj(r))}function Cb({messages:e,isLoading:r,isSubscribing:n=!1,onSend:s,onSendAudio:o,onCancel:u,currentDeviceId:f,disabled:l=!1,emptyMessage:c="No messages yet. Start the conversation!",showVoice:h=!0,emptyIcon:m,agentType:p,hasMore:y=!1,isLoadingMore:x=!1,onLoadMore:A}){const w=R.useRef(null),v=R.useRef(null),[S,g]=R.useState(!1),[_,T]=R.useState(!0),M=R.useMemo(()=>nj(e),[e]),k=r&&e.length>0,L=R.useCallback(()=>{if(!w.current)return;const{scrollTop:P,scrollHeight:Y,clientHeight:$}=w.current,K=Y-P-$<100;T(K),g(!K&&e.length>0)},[e.length]);R.useEffect(()=>{w.current&&_&&(w.current.scrollTop=w.current.scrollHeight)},[M,_]),R.useEffect(()=>{const P=w.current;if(!P)return;let Y=!1;const $=()=>{Y||(requestAnimationFrame(()=>{L(),Y=!1}),Y=!0)};return P.addEventListener("scroll",$,{passive:!0}),()=>P.removeEventListener("scroll",$)},[L]),R.useEffect(()=>{if(!y||!A||x||n)return;const P=v.current;if(!P)return;const Y=new IntersectionObserver($=>{const W=$[0];W!=null&&W.isIntersecting&&y&&!x&&A()},{root:w.current,rootMargin:"100px 0px 0px 0px",threshold:0});return Y.observe(P),()=>Y.disconnect()},[y,A,x,n]);const D=R.useCallback(()=>{w.current&&w.current.scrollTo({top:w.current.scrollHeight,behavior:"smooth"})},[]);return b.jsxs("div",{className:"flex flex-col h-full",role:"main",children:[b.jsxs("div",{className:"relative flex-1",children:[b.jsx("div",{ref:w,className:"absolute inset-0 overflow-y-auto p-4",role:"log","aria-label":"Chat messages","aria-live":"polite",children:b.jsxs("div",{className:"max-w-3xl lg:max-w-4xl xl:max-w-5xl 2xl:max-w-6xl mx-auto",children:[!n&&e.length>0&&b.jsx("div",{ref:v,className:"h-1","aria-hidden":"true"}),x&&b.jsx("div",{className:"flex justify-center py-4",children:b.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-sm",children:[b.jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),b.jsx("span",{children:"Loading older messages..."})]})}),n?b.jsx(Z3,{count:3}):e.length===0?b.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[200px] text-center",role:"status","aria-label":c,children:[b.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mb-4","aria-hidden":"true",children:m||b.jsx(_n,{className:"w-8 h-8 text-muted-foreground"})}),b.jsx("p",{className:"text-muted-foreground",children:c})]}):b.jsxs(b.Fragment,{children:[M.map(P=>b.jsx(z3,{contentBlocks:P.contentBlocks,isUser:P.role==="user",isStreaming:P.isStreaming,showAvatar:P.showAvatar,isContinuation:!P.isFirstSegment,sendStatus:P.isLastSegment?P.sendStatus:void 0,isCurrentDevice:!P.fromDeviceId||P.fromDeviceId===f,fromDeviceId:P.isLastSegment?P.fromDeviceId:void 0,agentType:p},P.id)),k&&b.jsx(K3,{agentType:p})]})]})}),b.jsx("button",{type:"button",onClick:D,className:Ae("absolute bottom-4 right-4 z-10","w-10 h-10 rounded-full shadow-lg","bg-background border border-border","flex items-center justify-center","transition-all duration-200 ease-out","hover:bg-muted hover:shadow-xl","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",S?"opacity-100 translate-y-0 pointer-events-auto":"opacity-0 translate-y-4 pointer-events-none"),"aria-label":"Scroll to bottom","aria-hidden":!S,children:b.jsx(LM,{className:"w-5 h-5 text-muted-foreground"})})]}),b.jsx($3,{onSend:s,onSendAudio:o,onCancel:u,isLoading:r,disabled:l,placeholder:l?"Not connected...":"Type a message...",showVoice:h})]})}function wb(){const{sessionId:e}=Ub(),r=!e,n=R.useRef(new Set),s=qe(O=>O.credentials),o=qe(O=>O.connectionState),u=qe(O=>O.sessions),f=dt(O=>O.supervisorMessages),l=dt(O=>O.supervisorIsLoading),c=dt(O=>O.historyPaginationState),h=dt(O=>O.agentMessages),m=dt(O=>O.agentIsLoading),{sendSupervisorCommand:p,cancelSupervisor:y,sendAgentCommand:x,cancelAgent:A,subscribeToSession:w,sendSupervisorVoiceCommand:v,sendAgentVoiceCommand:S,requestHistory:g}=co(),_=o==="verified"||o==="authenticated";R.useEffect(()=>{(o==="disconnected"||o==="error")&&n.current.clear()},[o]),R.useEffect(()=>{if(!e||r||!_||n.current.has(e))return;const O=u.find(z=>z.id===e);(O==null?void 0:O.type)!=="terminal"&&(n.current.add(e),w(e))},[e,r,_,u,w]);const T=e?u.find(O=>O.id===e):null,M=R.useCallback(O=>{p(O)},[p]),k=R.useCallback(O=>{e&&x(e,O)},[e,x]),L=R.useCallback(()=>{y()},[y]),D=R.useCallback(()=>{e&&A(e)},[e,A]),P=R.useCallback(async(O,z)=>{if(console.log("🎤 handleSupervisorAudio called:",{audioBlobSize:O.size,format:z,isConnected:_}),!_){console.error("❌ Not connected to WebSocket"),Lr.error("Connection Error","Not connected to Tiflis. Please check your connection.");return}const j=new FileReader;j.onloadend=()=>{const q=j.result,ne=q.split(",")[1];if(console.log("🎤 Converting to base64:",{originalSize:q.length,base64Size:ne==null?void 0:ne.length}),ne)try{v(ne,z),console.log("✅ Voice command sent successfully")}catch(X){console.error("❌ Failed to send voice command:",X),Lr.error("Voice Message Error","Failed to send voice message. Please try again.")}else console.error("❌ Failed to convert audio to base64"),Lr.error("Voice Message Error","Failed to process audio. Please try recording again.")},j.onerror=q=>{console.error("❌ FileReader error:",q),Lr.error("Voice Message Error","Failed to read audio file. Please try again.")},j.readAsDataURL(O)},[v,_]),Y=R.useCallback(async(O,z)=>{if(console.log("🎤 handleAgentAudio called:",{sessionId:e,audioBlobSize:O.size,format:z,isConnected:_}),!e){console.error("❌ No session ID provided"),Lr.error("Voice Message Error","No session active. Please select a session first.");return}if(!_){console.error("❌ Not connected to WebSocket"),Lr.error("Connection Error","Not connected to Tiflis. Please check your connection.");return}const j=new FileReader;j.onloadend=()=>{const q=j.result,ne=q.split(",")[1];if(console.log("🎤 Converting to base64:",{originalSize:q.length,base64Size:ne==null?void 0:ne.length}),ne)try{S(e,ne,z),console.log("✅ Voice command sent successfully")}catch(X){console.error("❌ Failed to send voice command:",X),Lr.error("Voice Message Error","Failed to send voice message. Please try again.")}else console.error("❌ Failed to convert audio to base64"),Lr.error("Voice Message Error","Failed to process audio. Please try recording again.")},j.onerror=q=>{console.error("❌ FileReader error:",q),Lr.error("Voice Message Error","Failed to read audio file. Please try again.")},j.readAsDataURL(O)},[e,S,_]),$=R.useCallback(()=>{const O=c.supervisor;O!=null&&O.hasMore&&!(O!=null&&O.isLoading)&&(O!=null&&O.oldestSequence)&&g(null,O.oldestSequence)},[c,g]),W=R.useCallback(()=>{if(!e)return;const O=c[e];O!=null&&O.hasMore&&!(O!=null&&O.isLoading)&&(O!=null&&O.oldestSequence)&&g(e,O.oldestSequence)},[e,c,g]),K=O=>{if(!O)return b.jsx(_n,{className:"w-8 h-8 text-muted-foreground"});switch(O.type){case"claude":return b.jsx(Aa,{className:"w-8 h-8 text-muted-foreground"});case"cursor":return b.jsx(Ra,{className:"w-8 h-8 text-muted-foreground"});case"opencode":return b.jsx(Ta,{className:"w-8 h-8 text-muted-foreground"});default:return b.jsx(_n,{className:"w-8 h-8 text-muted-foreground"})}};if(r){const O=c.supervisor,z=(O==null?void 0:O.isLoading)??!1,j=(O==null?void 0:O.hasMore)??!1;return b.jsx(Cb,{messages:f,isLoading:l,isSubscribing:z&&f.length===0,onSend:M,onSendAudio:P,onCancel:L,currentDeviceId:s==null?void 0:s.deviceId,disabled:!_,emptyMessage:"Hello! I'm your AI assistant. Ask me to create sessions, manage your workspace, or help with tasks.",emptyIcon:b.jsx(va,{className:"w-8 h-8 text-muted-foreground"}),agentType:"supervisor",hasMore:j,isLoadingMore:z&&f.length>0,onLoadMore:$})}const J=h[e]??[],G=m[e]??!1,F=c[e],re=(F==null?void 0:F.isLoading)??!1,te=(F==null?void 0:F.hasMore)??!1;return b.jsx(Cb,{messages:J,isLoading:G,isSubscribing:re&&J.length===0,onSend:k,onSendAudio:Y,onCancel:D,currentDeviceId:s==null?void 0:s.deviceId,disabled:!_,emptyMessage:`Start a conversation with ${(T==null?void 0:T.agentName)??"the agent"}...`,emptyIcon:K(T??null),agentType:T==null?void 0:T.type,hasMore:te,isLoadingMore:re&&J.length>0,onLoadMore:W})}var Vm={exports:{}},xb;function ij(){return xb||(xb=1,(function(e,r){(function(n,s){e.exports=s()})(globalThis,(()=>(()=>{var n={4567:function(f,l,c){var h=this&&this.__decorate||function(g,_,T,M){var k,L=arguments.length,D=L<3?_:M===null?M=Object.getOwnPropertyDescriptor(_,T):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(g,_,T,M);else for(var P=g.length-1;P>=0;P--)(k=g[P])&&(D=(L<3?k(D):L>3?k(_,T,D):k(_,T))||D);return L>3&&D&&Object.defineProperty(_,T,D),D},m=this&&this.__param||function(g,_){return function(T,M){_(T,M,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const p=c(9042),y=c(9924),x=c(844),A=c(4725),w=c(2585),v=c(3656);let S=l.AccessibilityManager=class extends x.Disposable{constructor(g,_,T,M){super(),this._terminal=g,this._coreBrowserService=T,this._renderService=M,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let k=0;k<this._terminal.rows;k++)this._rowElements[k]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[k]);if(this._topBoundaryFocusListener=k=>this._handleBoundaryFocus(k,0),this._bottomBoundaryFocusListener=k=>this._handleBoundaryFocus(k,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new y.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((k=>this._handleResize(k.rows)))),this.register(this._terminal.onRender((k=>this._refreshRows(k.start,k.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((k=>this._handleChar(k)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
401
401
|
`)))),this.register(this._terminal.onA11yTab((k=>this._handleTab(k)))),this.register(this._terminal.onKey((k=>this._handleKey(k.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,v.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,x.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(g){for(let _=0;_<g;_++)this._handleChar(" ")}_handleChar(g){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==g&&(this._charsToAnnounce+=g):this._charsToAnnounce+=g,g===`
|
|
402
402
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=p.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(g){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(g)||this._charsToConsume.push(g)}_refreshRows(g,_){this._liveRegionDebouncer.refresh(g,_,this._terminal.rows)}_renderRows(g,_){const T=this._terminal.buffer,M=T.lines.length.toString();for(let k=g;k<=_;k++){const L=T.lines.get(T.ydisp+k),D=[],P=(L==null?void 0:L.translateToString(!0,void 0,void 0,D))||"",Y=(T.ydisp+k+1).toString(),$=this._rowElements[k];$&&(P.length===0?($.innerText=" ",this._rowColumns.set($,[0,1])):($.textContent=P,this._rowColumns.set($,D)),$.setAttribute("aria-posinset",Y),$.setAttribute("aria-setsize",M))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(g,_){const T=g.target,M=this._rowElements[_===0?1:this._rowElements.length-2];if(T.getAttribute("aria-posinset")===(_===0?"1":`${this._terminal.buffer.lines.length}`)||g.relatedTarget!==M)return;let k,L;if(_===0?(k=T,L=this._rowElements.pop(),this._rowContainer.removeChild(L)):(k=this._rowElements.shift(),L=T,this._rowContainer.removeChild(k)),k.removeEventListener("focus",this._topBoundaryFocusListener),L.removeEventListener("focus",this._bottomBoundaryFocusListener),_===0){const D=this._createAccessibilityTreeNode();this._rowElements.unshift(D),this._rowContainer.insertAdjacentElement("afterbegin",D)}else{const D=this._createAccessibilityTreeNode();this._rowElements.push(D),this._rowContainer.appendChild(D)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(_===0?-1:1),this._rowElements[_===0?1:this._rowElements.length-2].focus(),g.preventDefault(),g.stopImmediatePropagation()}_handleSelectionChange(){var P;if(this._rowElements.length===0)return;const g=document.getSelection();if(!g)return;if(g.isCollapsed)return void(this._rowContainer.contains(g.anchorNode)&&this._terminal.clearSelection());if(!g.anchorNode||!g.focusNode)return void console.error("anchorNode and/or focusNode are null");let _={node:g.anchorNode,offset:g.anchorOffset},T={node:g.focusNode,offset:g.focusOffset};if((_.node.compareDocumentPosition(T.node)&Node.DOCUMENT_POSITION_PRECEDING||_.node===T.node&&_.offset>T.offset)&&([_,T]=[T,_]),_.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(_={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(_.node))return;const M=this._rowElements.slice(-1)[0];if(T.node.compareDocumentPosition(M)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(T={node:M,offset:((P=M.textContent)==null?void 0:P.length)??0}),!this._rowContainer.contains(T.node))return;const k=({node:Y,offset:$})=>{const W=Y instanceof Text?Y.parentNode:Y;let K=parseInt(W==null?void 0:W.getAttribute("aria-posinset"),10)-1;if(isNaN(K))return console.warn("row is invalid. Race condition?"),null;const J=this._rowColumns.get(W);if(!J)return console.warn("columns is null. Race condition?"),null;let G=$<J.length?J[$]:J.slice(-1)[0]+1;return G>=this._terminal.cols&&(++K,G=0),{row:K,column:G}},L=k(_),D=k(T);if(L&&D){if(L.row>D.row||L.row===D.row&&L.column>=D.column)throw new Error("invalid range");this._terminal.select(L.column,L.row,(D.row-L.row)*this._terminal.cols-L.column+D.column)}}_handleResize(g){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let _=this._rowContainer.children.length;_<this._terminal.rows;_++)this._rowElements[_]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[_]);for(;this._rowElements.length>g;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const g=this._coreBrowserService.mainDocument.createElement("div");return g.setAttribute("role","listitem"),g.tabIndex=-1,this._refreshRowDimensions(g),g}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let g=0;g<this._terminal.rows;g++)this._refreshRowDimensions(this._rowElements[g])}}_refreshRowDimensions(g){g.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=S=h([m(1,w.IInstantiationService),m(2,A.ICoreBrowserService),m(3,A.IRenderService)],S)},3614:(f,l)=>{function c(y){return y.replace(/\r?\n/g,"\r")}function h(y,x){return x?"\x1B[200~"+y+"\x1B[201~":y}function m(y,x,A,w){y=h(y=c(y),A.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),A.triggerDataEvent(y,!0),x.value=""}function p(y,x,A){const w=A.getBoundingClientRect(),v=y.clientX-w.left-10,S=y.clientY-w.top-10;x.style.width="20px",x.style.height="20px",x.style.left=`${v}px`,x.style.top=`${S}px`,x.style.zIndex="1000",x.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=c,l.bracketTextForPaste=h,l.copyHandler=function(y,x){y.clipboardData&&y.clipboardData.setData("text/plain",x.selectionText),y.preventDefault()},l.handlePasteEvent=function(y,x,A,w){y.stopPropagation(),y.clipboardData&&m(y.clipboardData.getData("text/plain"),x,A,w)},l.paste=m,l.moveTextAreaUnderMouseCursor=p,l.rightClickHandler=function(y,x,A,w,v){p(y,x,A),v&&w.rightClickSelect(y),x.value=w.selectionText,x.select()}},7239:(f,l,c)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const h=c(1505);l.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(m,p,y){this._css.set(m,p,y)}getCss(m,p){return this._css.get(m,p)}setColor(m,p,y){this._color.set(m,p,y)}getColor(m,p){return this._color.get(m,p)}clear(){this._color.clear(),this._css.clear()}}},3656:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(c,h,m,p){c.addEventListener(h,m,p);let y=!1;return{dispose:()=>{y||(y=!0,c.removeEventListener(h,m,p))}}}},3551:function(f,l,c){var h=this&&this.__decorate||function(S,g,_,T){var M,k=arguments.length,L=k<3?g:T===null?T=Object.getOwnPropertyDescriptor(g,_):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(S,g,_,T);else for(var D=S.length-1;D>=0;D--)(M=S[D])&&(L=(k<3?M(L):k>3?M(g,_,L):M(g,_))||L);return k>3&&L&&Object.defineProperty(g,_,L),L},m=this&&this.__param||function(S,g){return function(_,T){g(_,T,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const p=c(3656),y=c(8460),x=c(844),A=c(2585),w=c(4725);let v=l.Linkifier=class extends x.Disposable{get currentLink(){return this._currentLink}constructor(S,g,_,T,M){super(),this._element=S,this._mouseService=g,this._renderService=_,this._bufferService=T,this._linkProviderService=M,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new y.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new y.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,x.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,x.toDisposable)((()=>{var k;this._lastMouseEvent=void 0,(k=this._activeProviderReplies)==null||k.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,p.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,p.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,p.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,p.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(S){this._lastMouseEvent=S;const g=this._positionFromMouseEvent(S,this._element,this._mouseService);if(!g)return;this._isMouseOut=!1;const _=S.composedPath();for(let T=0;T<_.length;T++){const M=_[T];if(M.classList.contains("xterm"))break;if(M.classList.contains("xterm-hover"))return}this._lastBufferCell&&g.x===this._lastBufferCell.x&&g.y===this._lastBufferCell.y||(this._handleHover(g),this._lastBufferCell=g)}_handleHover(S){if(this._activeLine!==S.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(S,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,S)||(this._clearCurrentLink(),this._askForLink(S,!0))}_askForLink(S,g){var T,M;this._activeProviderReplies&&g||((T=this._activeProviderReplies)==null||T.forEach((k=>{k==null||k.forEach((L=>{L.link.dispose&&L.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=S.y);let _=!1;for(const[k,L]of this._linkProviderService.linkProviders.entries())g?(M=this._activeProviderReplies)!=null&&M.get(k)&&(_=this._checkLinkProviderResult(k,S,_)):L.provideLinks(S.y,(D=>{var Y,$;if(this._isMouseOut)return;const P=D==null?void 0:D.map((W=>({link:W})));(Y=this._activeProviderReplies)==null||Y.set(k,P),_=this._checkLinkProviderResult(k,S,_),(($=this._activeProviderReplies)==null?void 0:$.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(S.y,this._activeProviderReplies)}))}_removeIntersectingLinks(S,g){const _=new Set;for(let T=0;T<g.size;T++){const M=g.get(T);if(M)for(let k=0;k<M.length;k++){const L=M[k],D=L.link.range.start.y<S?0:L.link.range.start.x,P=L.link.range.end.y>S?this._bufferService.cols:L.link.range.end.x;for(let Y=D;Y<=P;Y++){if(_.has(Y)){M.splice(k--,1);break}_.add(Y)}}}}_checkLinkProviderResult(S,g,_){var k;if(!this._activeProviderReplies)return _;const T=this._activeProviderReplies.get(S);let M=!1;for(let L=0;L<S;L++)this._activeProviderReplies.has(L)&&!this._activeProviderReplies.get(L)||(M=!0);if(!M&&T){const L=T.find((D=>this._linkAtPosition(D.link,g)));L&&(_=!0,this._handleNewLink(L))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!_)for(let L=0;L<this._activeProviderReplies.size;L++){const D=(k=this._activeProviderReplies.get(L))==null?void 0:k.find((P=>this._linkAtPosition(P.link,g)));if(D){_=!0,this._handleNewLink(D);break}}return _}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(S){if(!this._currentLink)return;const g=this._positionFromMouseEvent(S,this._element,this._mouseService);g&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,g)&&this._currentLink.link.activate(S,this._currentLink.link.text)}_clearCurrentLink(S,g){this._currentLink&&this._lastMouseEvent&&(!S||!g||this._currentLink.link.range.start.y>=S&&this._currentLink.link.range.end.y<=g)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,x.disposeArray)(this._linkCacheDisposables))}_handleNewLink(S){if(!this._lastMouseEvent)return;const g=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);g&&this._linkAtPosition(S.link,g)&&(this._currentLink=S,this._currentLink.state={decorations:{underline:S.link.decorations===void 0||S.link.decorations.underline,pointerCursor:S.link.decorations===void 0||S.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,S.link,this._lastMouseEvent),S.link.decorations={},Object.defineProperties(S.link.decorations,{pointerCursor:{get:()=>{var _,T;return(T=(_=this._currentLink)==null?void 0:_.state)==null?void 0:T.decorations.pointerCursor},set:_=>{var T;(T=this._currentLink)!=null&&T.state&&this._currentLink.state.decorations.pointerCursor!==_&&(this._currentLink.state.decorations.pointerCursor=_,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",_))}},underline:{get:()=>{var _,T;return(T=(_=this._currentLink)==null?void 0:_.state)==null?void 0:T.decorations.underline},set:_=>{var T,M,k;(T=this._currentLink)!=null&&T.state&&((k=(M=this._currentLink)==null?void 0:M.state)==null?void 0:k.decorations.underline)!==_&&(this._currentLink.state.decorations.underline=_,this._currentLink.state.isHovered&&this._fireUnderlineEvent(S.link,_))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((_=>{if(!this._currentLink)return;const T=_.start===0?0:_.start+1+this._bufferService.buffer.ydisp,M=this._bufferService.buffer.ydisp+1+_.end;if(this._currentLink.link.range.start.y>=T&&this._currentLink.link.range.end.y<=M&&(this._clearCurrentLink(T,M),this._lastMouseEvent)){const k=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);k&&this._askForLink(k,!1)}}))))}_linkHover(S,g,_){var T;(T=this._currentLink)!=null&&T.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(g,!0),this._currentLink.state.decorations.pointerCursor&&S.classList.add("xterm-cursor-pointer")),g.hover&&g.hover(_,g.text)}_fireUnderlineEvent(S,g){const _=S.range,T=this._bufferService.buffer.ydisp,M=this._createLinkUnderlineEvent(_.start.x-1,_.start.y-T-1,_.end.x,_.end.y-T-1,void 0);(g?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(M)}_linkLeave(S,g,_){var T;(T=this._currentLink)!=null&&T.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(g,!1),this._currentLink.state.decorations.pointerCursor&&S.classList.remove("xterm-cursor-pointer")),g.leave&&g.leave(_,g.text)}_linkAtPosition(S,g){const _=S.range.start.y*this._bufferService.cols+S.range.start.x,T=S.range.end.y*this._bufferService.cols+S.range.end.x,M=g.y*this._bufferService.cols+g.x;return _<=M&&M<=T}_positionFromMouseEvent(S,g,_){const T=_.getCoords(S,g,this._bufferService.cols,this._bufferService.rows);if(T)return{x:T[0],y:T[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(S,g,_,T,M){return{x1:S,y1:g,x2:_,y2:T,cols:this._bufferService.cols,fg:M}}};l.Linkifier=v=h([m(1,w.IMouseService),m(2,w.IRenderService),m(3,A.IBufferService),m(4,w.ILinkProviderService)],v)},9042:(f,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(f,l,c){var h=this&&this.__decorate||function(w,v,S,g){var _,T=arguments.length,M=T<3?v:g===null?g=Object.getOwnPropertyDescriptor(v,S):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(w,v,S,g);else for(var k=w.length-1;k>=0;k--)(_=w[k])&&(M=(T<3?_(M):T>3?_(v,S,M):_(v,S))||M);return T>3&&M&&Object.defineProperty(v,S,M),M},m=this&&this.__param||function(w,v){return function(S,g){v(S,g,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const p=c(511),y=c(2585);let x=l.OscLinkProvider=class{constructor(w,v,S){this._bufferService=w,this._optionsService=v,this._oscLinkService=S}provideLinks(w,v){var P;const S=this._bufferService.buffer.lines.get(w-1);if(!S)return void v(void 0);const g=[],_=this._optionsService.rawOptions.linkHandler,T=new p.CellData,M=S.getTrimmedLength();let k=-1,L=-1,D=!1;for(let Y=0;Y<M;Y++)if(L!==-1||S.hasContent(Y)){if(S.loadCell(Y,T),T.hasExtendedAttrs()&&T.extended.urlId){if(L===-1){L=Y,k=T.extended.urlId;continue}D=T.extended.urlId!==k}else L!==-1&&(D=!0);if(D||L!==-1&&Y===M-1){const $=(P=this._oscLinkService.getLinkData(k))==null?void 0:P.uri;if($){const W={start:{x:L+1,y:w},end:{x:Y+(D||Y!==M-1?0:1),y:w}};let K=!1;if(!(_!=null&&_.allowNonHttpProtocols))try{const J=new URL($);["http:","https:"].includes(J.protocol)||(K=!0)}catch{K=!0}K||g.push({text:$,range:W,activate:(J,G)=>_?_.activate(J,G,W):A(0,G),hover:(J,G)=>{var F;return(F=_==null?void 0:_.hover)==null?void 0:F.call(_,J,G,W)},leave:(J,G)=>{var F;return(F=_==null?void 0:_.leave)==null?void 0:F.call(_,J,G,W)}})}D=!1,T.hasExtendedAttrs()&&T.extended.urlId?(L=Y,k=T.extended.urlId):(L=-1,k=-1)}}v(g)}};function A(w,v){if(confirm(`Do you want to navigate to ${v}?
|
|
403
403
|
|
|
@@ -417,4 +417,4 @@ WARNING: This link could potentially be dangerous`)){const S=window.open();if(S)
|
|
|
417
417
|
* http://bellard.org/jslinux/
|
|
418
418
|
* Copyright (c) 2011 Fabrice Bellard
|
|
419
419
|
*/var lj=class{constructor(e,r,n,s={}){this._terminal=e,this._regex=r,this._handler=n,this._options=s}provideLinks(e,r){let n=uj.computeLink(e,this._regex,this._terminal,this._handler);r(this._addCallbacks(n))}_addCallbacks(e){return e.map(r=>(r.leave=this._options.leave,r.hover=(n,s)=>{if(this._options.hover){let{range:o}=r;this._options.hover(n,s,o)}},r))}};function cj(e){try{let r=new URL(e),n=r.password&&r.username?`${r.protocol}//${r.username}:${r.password}@${r.host}`:r.username?`${r.protocol}//${r.username}@${r.host}`:`${r.protocol}//${r.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var uj=class Vd{static computeLink(r,n,s,o){let u=new RegExp(n.source,(n.flags||"")+"g"),[f,l]=Vd._getWindowedLineStrings(r-1,s),c=f.join(""),h,m=[];for(;h=u.exec(c);){let p=h[0];if(!cj(p))continue;let[y,x]=Vd._mapStrIdx(s,l,0,h.index),[A,w]=Vd._mapStrIdx(s,y,x,p.length);if(y===-1||x===-1||A===-1||w===-1)continue;let v={start:{x:x+1,y:y+1},end:{x:w,y:A+1}};m.push({range:v,text:p,activate:o})}return m}static _getWindowedLineStrings(r,n){let s,o=r,u=r,f=0,l="",c=[];if(s=n.buffer.active.getLine(r)){let h=s.translateToString(!0);if(s.isWrapped&&h[0]!==" "){for(f=0;(s=n.buffer.active.getLine(--o))&&f<2048&&(l=s.translateToString(!0),f+=l.length,c.push(l),!(!s.isWrapped||l.indexOf(" ")!==-1)););c.reverse()}for(c.push(h),f=0;(s=n.buffer.active.getLine(++u))&&s.isWrapped&&f<2048&&(l=s.translateToString(!0),f+=l.length,c.push(l),l.indexOf(" ")===-1););}return[c,o]}static _mapStrIdx(r,n,s,o){let u=r.buffer.active,f=u.getNullCell(),l=s;for(;o;){let c=u.getLine(n);if(!c)return[-1,-1];for(let h=l;h<c.length;++h){c.getCell(h,f);let m=f.getChars();if(f.getWidth()&&(o-=m.length||1,h===c.length-1&&m==="")){let p=u.getLine(n+1);p&&p.isWrapped&&(p.getCell(0,f),f.getWidth()===2&&(o+=1))}if(o<0)return[n,h]}n++,l=0}return[n,l]}},dj=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function hj(e,r){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=r}else console.warn("Opening link blocked as opener could not be cleared")}var fj=class{constructor(e=hj,r={}){this._handler=e,this._options=r}activate(e){this._terminal=e;let r=this._options,n=r.urlRegex||dj;this._linkProvider=this._terminal.registerLinkProvider(new lj(this._terminal,n,this._handler,r))}dispose(){var e;(e=this._linkProvider)==null||e.dispose()}};const pj={background:"#1a1a1a",foreground:"#d4d4d4",cursor:"#d4d4d4",cursorAccent:"#1a1a1a",selectionBackground:"#3a3a3a",black:"#1a1a1a",red:"#f44747",green:"#6a9955",yellow:"#dcdcaa",blue:"#569cd6",magenta:"#c586c0",cyan:"#4ec9b0",white:"#d4d4d4",brightBlack:"#808080",brightRed:"#f44747",brightGreen:"#6a9955",brightYellow:"#dcdcaa",brightBlue:"#569cd6",brightMagenta:"#c586c0",brightCyan:"#4ec9b0",brightWhite:"#ffffff"},mj={background:"#ffffff",foreground:"#383a42",cursor:"#383a42",cursorAccent:"#ffffff",selectionBackground:"#d7d7d7",black:"#383a42",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#fafafa",brightBlack:"#4f525e",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"};function gj({sessionId:e}){const r=R.useRef(null),n=R.useRef(null),s=R.useRef(null),[o,u]=R.useState(!1),f=R.useRef(null),l=R.useRef(null),c=R.useRef(null),h=R.useRef(!1),m=R.useRef(0),p=R.useRef(""),y=R.useRef(null),{sendTerminalInput:x,resizeTerminal:A,subscribeToSession:w,requestTerminalReplay:v}=co(),{resolvedTheme:S}=Qg(),g=qe(Y=>Y.connectionState),_=g==="verified"||g==="authenticated",T=R.useRef(!1),M=R.useRef(!1),k=R.useMemo(()=>S==="dark"?pj:mj,[S]);R.useEffect(()=>{if(!r.current||n.current)return;const Y=new sj.Terminal({cursorBlink:!0,cursorStyle:"block",cursorInactiveStyle:"outline",fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',theme:k,scrollback:1e4,scrollOnUserInput:!0,smoothScrollDuration:0,fastScrollModifier:"alt",fastScrollSensitivity:5,convertEol:!0,macOptionIsMeta:!0,macOptionClickForcesSelection:!0,rightClickSelectsWord:!0,altClickMovesCursor:!0}),$=new aj.FitAddon,W=new fj;return Y.loadAddon($),Y.loadAddon(W),Y.open(r.current),$.fit(),n.current=Y,s.current=$,u(!0),Y.onData(K=>{const J=qe.getState().connectionState;(J==="verified"||J==="authenticated")&&x(e,K)}),()=>{Y.dispose(),n.current=null,s.current=null,M.current=!1}},[e,x]),R.useEffect(()=>{if(!o||!_)return;(!M.current||T.current===!1&&_)&&(M.current=!0,w(e),setTimeout(()=>{v(e,0,500)},100)),T.current=_},[o,_,e,w,v]),R.useEffect(()=>{(g==="disconnected"||g==="error")&&(M.current=!1,T.current=!1)},[g]);const L=R.useCallback(Y=>{p.current+=Y,y.current===null&&(y.current=requestAnimationFrame(()=>{n.current&&p.current&&n.current.write(p.current),p.current="",y.current=null}))},[]),D=R.useCallback(()=>{if(!s.current||!n.current||!r.current)return;const Y=Date.now();if(Y-m.current<500)return;const $=r.current.getBoundingClientRect(),W=Math.floor($.width),K=Math.floor($.height),J=c.current;if(!(J&&J.width===W&&J.height===K)){c.current={width:W,height:K},h.current=!0;try{s.current.fit();const{cols:G,rows:F}=n.current,re=l.current;(!re||re.cols!==G||re.rows!==F)&&(l.current={cols:G,rows:F},m.current=Y,A(e,G,F))}finally{setTimeout(()=>{h.current=!1},50)}}},[e,A]);R.useEffect(()=>{if(!r.current||!o)return;const Y=r.current,$=()=>{f.current!==null&&clearTimeout(f.current),f.current=setTimeout(()=>{f.current=null;const G=qe.getState().connectionState;(G==="verified"||G==="authenticated")&&D()},150)},W=new ResizeObserver(G=>{if(h.current)return;const F=G[0];if(!F)return;let re,te;if(F.borderBoxSize&&F.borderBoxSize[0]?(re=Math.floor(F.borderBoxSize[0].inlineSize),te=Math.floor(F.borderBoxSize[0].blockSize)):(re=Math.floor(F.contentRect.width),te=Math.floor(F.contentRect.height)),re===0||te===0)return;const O=c.current;O&&O.width===re&&O.height===te||$()});W.observe(Y,{box:"border-box"});const K=()=>$();window.addEventListener("resize",K);const J=setTimeout($,50);return()=>{W.disconnect(),window.removeEventListener("resize",K),clearTimeout(J),f.current!==null&&clearTimeout(f.current)}},[o,D]),R.useEffect(()=>{n.current&&(n.current.options.theme=k)},[k]),R.useEffect(()=>{if(!n.current)return;const Y=$=>{$.detail.sessionId===e&&L($.detail.data)};return window.addEventListener("terminal-output",Y),()=>{window.removeEventListener("terminal-output",Y),y.current!==null&&(cancelAnimationFrame(y.current),y.current=null),n.current&&p.current&&(n.current.write(p.current),p.current="")}},[e,L]),R.useEffect(()=>{const Y=$=>{$.detail.sessionId===e&&n.current&&n.current.clear()};return window.addEventListener("terminal-clear",Y),()=>{window.removeEventListener("terminal-clear",Y)}},[e]);const P=S==="dark"?"bg-[#1a1a1a]":"bg-white";return b.jsx("div",{className:`flex flex-col h-full ${P}`,children:b.jsx("div",{ref:r,className:"flex-1 p-2"})})}function vj(){const{sessionId:e}=Ub();return e?b.jsx(gj,{sessionId:e}):b.jsx(Ad,{to:"/chat",replace:!0})}var Ph="Switch",[_j]=Gn(Ph),[yj,Sj]=_j(Ph),gA=R.forwardRef((e,r)=>{const{__scopeSwitch:n,name:s,checked:o,defaultChecked:u,required:f,disabled:l,value:c="on",onCheckedChange:h,form:m,...p}=e,[y,x]=R.useState(null),A=at(r,_=>x(_)),w=R.useRef(!1),v=y?m||!!y.closest("form"):!0,[S,g]=ro({prop:o,defaultProp:u??!1,onChange:h,caller:Ph});return b.jsxs(yj,{scope:n,checked:S,disabled:l,children:[b.jsx(Je.button,{type:"button",role:"switch","aria-checked":S,"aria-required":f,"data-state":SA(S),"data-disabled":l?"":void 0,disabled:l,value:c,...p,ref:A,onClick:Le(e.onClick,_=>{g(T=>!T),v&&(w.current=_.isPropagationStopped(),w.current||_.stopPropagation())})}),v&&b.jsx(yA,{control:y,bubbles:!w.current,name:s,value:c,checked:S,required:f,disabled:l,form:m,style:{transform:"translateX(-100%)"}})]})});gA.displayName=Ph;var vA="SwitchThumb",_A=R.forwardRef((e,r)=>{const{__scopeSwitch:n,...s}=e,o=Sj(vA,n);return b.jsx(Je.span,{"data-state":SA(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:r})});_A.displayName=vA;var bj="SwitchBubbleInput",yA=R.forwardRef(({__scopeSwitch:e,control:r,checked:n,bubbles:s=!0,...o},u)=>{const f=R.useRef(null),l=at(f,u),c=Cw(n),h=hw(r);return R.useEffect(()=>{const m=f.current;if(!m)return;const p=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(p,"checked").set;if(c!==n&&x){const A=new Event("click",{bubbles:s});x.call(m,n),m.dispatchEvent(A)}},[c,n,s]),b.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:l,style:{...o.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});yA.displayName=bj;function SA(e){return e?"checked":"unchecked"}var bA=gA,Cj=_A;const CA=R.forwardRef(({className:e,...r},n)=>b.jsx(bA,{className:Ae("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...r,ref:n,children:b.jsx(Cj,{className:Ae("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform","data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));CA.displayName=bA.displayName;function wj(){const e=qe(v=>v.credentials),r=qe(v=>v.workstationInfo),n=qe(v=>v.tunnelInfo),s=qe(v=>v.connectionState),{disconnectAndForget:o}=co(),u=jn(v=>v.reset),f=jn(v=>v.ttsEnabled),l=jn(v=>v.setTtsEnabled),{theme:c,setTheme:h}=Qg(),[m,p]=R.useState(!1),y=async()=>{await o(),u(),p(!1)},x=s==="verified"||s==="authenticated",A=()=>{switch(s){case"verified":return"bg-green-500";case"authenticated":return"bg-yellow-500";case"connecting":return"bg-blue-500 animate-pulse";case"error":return"bg-red-500";default:return"bg-gray-500"}},w=()=>{switch(s){case"verified":return"Connected to Workstation";case"authenticated":return"Connected to Tunnel";case"connecting":return"Connecting...";case"error":return"Connection Error";default:return"Disconnected"}};return b.jsx("div",{className:"h-full overflow-y-auto p-4",children:b.jsxs("div",{className:"max-w-2xl mx-auto space-y-6 pb-8",children:[b.jsx("h1",{className:"text-2xl font-bold",children:"Settings"}),b.jsxs(fs,{children:[b.jsxs(ps,{children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(_S,{className:"w-5 h-5 text-muted-foreground"}),b.jsx(ms,{children:"Appearance"})]}),b.jsx(Xs,{children:"Customize the look and feel of the application"})]}),b.jsx(gs,{children:b.jsxs("div",{className:"space-y-2",children:[b.jsx("p",{className:"text-sm text-muted-foreground",children:"Theme"}),b.jsxs("div",{className:"flex gap-2",children:[b.jsxs(st,{variant:"outline",className:Ae("flex-1 gap-2",c==="light"&&"border-primary bg-primary/10"),onClick:()=>h("light"),children:[b.jsx(_S,{className:"w-4 h-4"}),"Light"]}),b.jsxs(st,{variant:"outline",className:Ae("flex-1 gap-2",c==="dark"&&"border-primary bg-primary/10"),onClick:()=>h("dark"),children:[b.jsx(YM,{className:"w-4 h-4"}),"Dark"]}),b.jsxs(st,{variant:"outline",className:Ae("flex-1 gap-2",c==="system"&&"border-primary bg-primary/10"),onClick:()=>h("system"),children:[b.jsx(VM,{className:"w-4 h-4"}),"System"]})]})]})})]}),b.jsxs(fs,{children:[b.jsxs(ps,{children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(ek,{className:"w-5 h-5 text-muted-foreground"}),b.jsx(ms,{children:"Voice"})]}),b.jsx(Xs,{children:"Configure text-to-speech and voice input settings"})]}),b.jsx(gs,{children:b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"space-y-0.5",children:[b.jsx(aa,{htmlFor:"tts-toggle",className:"text-sm font-medium",children:"Auto-play TTS responses"}),b.jsx("p",{className:"text-sm text-muted-foreground",children:"Automatically play audio when receiving voice responses"})]}),b.jsx(CA,{id:"tts-toggle",checked:f,onCheckedChange:l})]})})]}),b.jsxs(fs,{children:[b.jsxs(ps,{children:[b.jsxs("div",{className:"flex items-center gap-2",children:[x?b.jsx(o1,{className:"w-5 h-5 text-green-500"}):b.jsx(s1,{className:"w-5 h-5 text-muted-foreground"}),b.jsx(ms,{children:"Connection"})]}),b.jsx(Xs,{children:"Current connection status and information"})]}),b.jsxs(gs,{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50",children:[b.jsx("div",{className:`w-3 h-3 rounded-full ${A()}`}),b.jsx("span",{className:"font-medium",children:w()})]}),e&&b.jsxs("div",{className:"space-y-3 text-sm",children:[b.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[b.jsx(t1,{className:"w-4 h-4"}),b.jsx("span",{children:"Connection Details"})]}),b.jsxs("div",{className:"grid gap-2 pl-6",children:[b.jsxs("div",{className:"flex justify-between",children:[b.jsx("span",{className:"text-muted-foreground",children:"Tunnel ID:"}),b.jsx("span",{className:"font-mono text-xs",children:e.tunnelId})]}),b.jsxs("div",{className:"flex justify-between",children:[b.jsx("span",{className:"text-muted-foreground",children:"Tunnel URL:"}),b.jsx("span",{className:"font-mono text-xs truncate max-w-[200px]",children:e.tunnelUrl})]}),b.jsxs("div",{className:"flex justify-between",children:[b.jsx("span",{className:"text-muted-foreground",children:"Device ID:"}),b.jsx("span",{className:"font-mono text-xs",children:e.deviceId})]})]})]}),r&&b.jsxs("div",{className:"space-y-3 text-sm border-t pt-4",children:[b.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[b.jsx(zM,{className:"w-4 h-4"}),b.jsx("span",{children:"Workstation"})]}),b.jsxs("div",{className:"grid gap-2 pl-6",children:[b.jsxs("div",{className:"flex justify-between",children:[b.jsx("span",{className:"text-muted-foreground",children:"Name:"}),b.jsx("span",{children:r.name})]}),b.jsxs("div",{className:"flex justify-between",children:[b.jsx("span",{className:"text-muted-foreground",children:"Version:"}),b.jsx("span",{className:"font-mono text-xs",children:r.version})]}),r.workspacesRoot&&b.jsxs("div",{className:"flex justify-between",children:[b.jsx("span",{className:"text-muted-foreground",children:"Workspaces:"}),b.jsx("span",{className:"font-mono text-xs truncate max-w-[200px]",children:r.workspacesRoot})]})]})]}),n&&b.jsxs("div",{className:"space-y-3 text-sm border-t pt-4",children:[b.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[b.jsx(JM,{className:"w-4 h-4"}),b.jsx("span",{children:"Tunnel Server"})]}),b.jsxs("div",{className:"grid gap-2 pl-6",children:[b.jsxs("div",{className:"flex justify-between",children:[b.jsx("span",{className:"text-muted-foreground",children:"Version:"}),b.jsx("span",{className:"font-mono text-xs",children:n.version})]}),n.protocolVersion&&b.jsxs("div",{className:"flex justify-between",children:[b.jsx("span",{className:"text-muted-foreground",children:"Protocol:"}),b.jsxs("span",{className:"font-mono text-xs",children:["v",n.protocolVersion]})]})]})]})]})]}),b.jsxs(fs,{children:[b.jsxs(ps,{children:[b.jsx(ms,{children:"About"}),b.jsx(Xs,{children:"Tiflis Code Web Client"})]}),b.jsxs(gs,{className:"space-y-2 text-sm",children:[b.jsxs("div",{className:"flex justify-between",children:[b.jsx("span",{className:"text-muted-foreground",children:"Version:"}),b.jsx("span",{className:"font-mono",children:"0.1.0"})]}),b.jsxs("div",{className:"flex justify-between",children:[b.jsx("span",{className:"text-muted-foreground",children:"Author:"}),b.jsx("span",{children:"Roman Barinov"})]}),b.jsxs("div",{className:"flex justify-between",children:[b.jsx("span",{className:"text-muted-foreground",children:"Repository:"}),b.jsx("a",{href:"https://github.com/tiflis-io/tiflis-code",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"tiflis-io/tiflis-code"})]}),b.jsxs("div",{className:"flex justify-between",children:[b.jsx("span",{className:"text-muted-foreground",children:"License:"}),b.jsx("span",{children:"FSL-1.1-NC"})]})]})]}),b.jsxs(fs,{children:[b.jsx(ps,{children:b.jsx(ms,{children:"Legal"})}),b.jsxs(gs,{className:"space-y-2 text-sm",children:[b.jsxs("div",{className:"flex justify-between items-center",children:[b.jsx("span",{className:"text-muted-foreground",children:"Privacy Policy"}),b.jsx("a",{href:"https://github.com/tiflis-io/tiflis-code/blob/main/PRIVACY.md",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View"})]}),b.jsxs("div",{className:"flex justify-between items-center",children:[b.jsx("span",{className:"text-muted-foreground",children:"Terms of Service"}),b.jsx("a",{href:"https://github.com/tiflis-io/tiflis-code/blob/main/TERMS.md",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View"})]})]})]}),b.jsxs(fs,{className:"border-destructive/50",children:[b.jsxs(ps,{children:[b.jsx(ms,{className:"text-destructive",children:"Danger Zone"}),b.jsx(Xs,{children:"Disconnect and clear all stored data"})]}),b.jsx(gs,{children:b.jsxs(Zd,{open:m,onOpenChange:p,children:[b.jsx(EB,{asChild:!0,children:b.jsxs(st,{variant:"destructive",className:"w-full",children:[b.jsx(ua,{className:"w-4 h-4"}),"Disconnect & Forget All Data"]})}),b.jsxs(sc,{children:[b.jsxs(oc,{children:[b.jsx(lc,{children:"Are you sure?"}),b.jsxs(cc,{children:["This will permanently delete all stored connection data including:",b.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[b.jsx("li",{children:"Authentication keys"}),b.jsx("li",{children:"Tunnel connection settings"}),b.jsx("li",{children:"Device ID"}),b.jsx("li",{children:"All stored preferences"})]}),b.jsx("p",{className:"mt-2 font-medium",children:"You will need to scan a QR code or paste a magic link again to reconnect."})]})]}),b.jsxs(ac,{children:[b.jsx(dc,{children:"Cancel"}),b.jsx(uc,{onClick:y,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete All Data"})]})]})]})})]})]})})}function xj(){const e=qe(r=>r.isAuthenticated);return b.jsx(SD,{children:b.jsx($R,{children:e?b.jsxs(b.Fragment,{children:[b.jsxs(On,{element:b.jsx(CI,{}),children:[b.jsx(On,{path:"/",element:b.jsx(Ad,{to:"/chat",replace:!0})}),b.jsx(On,{path:"/chat",element:b.jsx(wb,{})}),b.jsx(On,{path:"/chat/:sessionId",element:b.jsx(wb,{})}),b.jsx(On,{path:"/terminal/:sessionId",element:b.jsx(vj,{})}),b.jsx(On,{path:"/settings",element:b.jsx(wj,{})})]}),b.jsx(On,{path:"*",element:b.jsx(Ad,{to:"/chat",replace:!0})})]}):b.jsxs(b.Fragment,{children:[b.jsx(On,{path:"/",element:b.jsx(Nk,{})}),b.jsx(On,{path:"*",element:b.jsx(Ad,{to:"/",replace:!0})})]})})})}class Ej extends R.Component{constructor(n){super(n);_e(this,"handleReset",()=>{this.setState({hasError:!1,error:null,errorInfo:null})});_e(this,"handleReload",()=>{window.location.reload()});this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,s){this.setState({errorInfo:s})}render(){return this.state.hasError?this.props.fallback?this.props.fallback:b.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",role:"alert","aria-live":"assertive",children:b.jsxs("div",{className:"w-full max-w-md space-y-6 text-center",children:[b.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10",children:b.jsx(Wg,{className:"h-8 w-8 text-destructive","aria-hidden":"true"})}),b.jsxs("div",{className:"space-y-2",children:[b.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Something went wrong"}),b.jsx("p",{className:"text-muted-foreground",children:"An unexpected error occurred. Please try again or reload the page."})]}),!1,b.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:justify-center",children:[b.jsxs(st,{variant:"outline",onClick:this.handleReset,className:"gap-2",children:[b.jsx(Yg,{className:"h-4 w-4","aria-hidden":"true"}),"Try again"]}),b.jsx(st,{onClick:this.handleReload,children:"Reload page"})]})]})}):this.props.children}}function Aj(){const e=LB();return b.jsx(MB,{toasts:e,onDismiss:r=>_i.dismiss(r)})}const wA=document.getElementById("root");if(!wA)throw new Error("Root element not found");$T.createRoot(wA).render(b.jsx(R.StrictMode,{children:b.jsx(Ej,{children:b.jsxs(Ok,{defaultTheme:"system",children:[b.jsx(xj,{}),b.jsx(Aj,{})]})})}));
|
|
420
|
-
//# sourceMappingURL=index-
|
|
420
|
+
//# sourceMappingURL=index-Crr-HzFD.js.map
|