@whoz-oss/coday-client 0.190.3 → 0.192.0
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/browser/{chunk-NW27XB47.js → chunk-2E6MYDFG.js} +1 -1
- package/browser/{chunk-VTAI3MOF.js → chunk-3TUBTI3K.js} +1 -1
- package/browser/{chunk-QUJXN3NC.js → chunk-4KJQDGDQ.js} +1 -1
- package/browser/{chunk-UT7VOSQ7.js → chunk-6LPLMT5G.js} +1 -1
- package/browser/{chunk-OONW44HQ.js → chunk-7CSO3M7Q.js} +1 -1
- package/browser/chunk-AJAMHOBU.js +1 -0
- package/browser/{chunk-HIA7DOSV.js → chunk-BHZ7DCUX.js} +1 -1
- package/browser/{chunk-UL3MSBXV.js → chunk-BRQRJTLE.js} +1 -1
- package/browser/chunk-BWTU7I6I.js +1 -0
- package/browser/chunk-E3YDDL7X.js +1 -0
- package/browser/chunk-E7DFLZK7.js +1 -0
- package/browser/{chunk-BLT2UGUM.js → chunk-E7XT4AGE.js} +5 -5
- package/browser/{chunk-V7RYUISE.js → chunk-ECEWYTGM.js} +1 -1
- package/browser/chunk-EYS2HGZ4.js +1 -0
- package/browser/chunk-GRJZARL3.js +1 -0
- package/browser/chunk-HEBIR2K3.js +1 -0
- package/browser/{chunk-H76XRLTE.js → chunk-I6YWE5DW.js} +1 -1
- package/browser/{chunk-CPPSTTTC.js → chunk-JRJCV4WT.js} +1 -1
- package/browser/{chunk-OSUSTGJD.js → chunk-KTG6TT73.js} +1 -1
- package/browser/chunk-KW4N7QC3.js +1 -0
- package/browser/{chunk-37Z4RQMS.js → chunk-LJN5BVCL.js} +1 -1
- package/browser/chunk-M4B5E7RD.js +1 -0
- package/browser/{chunk-IO7Y6AGH.js → chunk-NA7C7FYU.js} +1 -1
- package/browser/{chunk-7XZSS2EV.js → chunk-OULUES5R.js} +1 -1
- package/browser/chunk-OZXXB3UF.js +1 -0
- package/browser/chunk-PIZZDP7D.js +1 -0
- package/browser/{chunk-ECF4ASWE.js → chunk-PMFBZ6OG.js} +1 -1
- package/browser/{chunk-YHAKQS2P.js → chunk-PW6HGLWK.js} +1 -1
- package/browser/chunk-QPBFAKWK.js +1 -0
- package/browser/{chunk-RKONB72C.js → chunk-SGCZJMPT.js} +4 -4
- package/browser/{chunk-3UWHDPW7.js → chunk-VEHGBGGY.js} +2 -2
- package/browser/{chunk-OGI7MX2M.js → chunk-WEEYHBKK.js} +1 -1
- package/browser/chunk-WQVPMMUH.js +1 -0
- package/browser/{chunk-VDRETD5H.js → chunk-WV7ML4CJ.js} +3 -3
- package/browser/{chunk-UVOW2VIJ.js → chunk-XBVYORVG.js} +1 -1
- package/browser/chunk-YC254XBK.js +270 -0
- package/browser/{chunk-L75REITS.js → chunk-YKWYW7YJ.js} +3 -3
- package/browser/{chunk-5BDX24G5.js → chunk-YNF2EAXK.js} +1 -1
- package/browser/{chunk-FSOL3ALS.js → chunk-YNYTAOEP.js} +1 -1
- package/browser/index.html +2 -2
- package/browser/main-GZS32O2T.js +1 -0
- package/browser/styles-OTP4QCB4.css +1 -0
- package/package.json +1 -1
- package/browser/chunk-3USYL5BG.js +0 -1
- package/browser/chunk-5DONQZON.js +0 -1
- package/browser/chunk-6ID3TABK.js +0 -1
- package/browser/chunk-ADN4NBOA.js +0 -1
- package/browser/chunk-IYL3P5IQ.js +0 -1
- package/browser/chunk-KOR36WEI.js +0 -1
- package/browser/chunk-OTANLRGJ.js +0 -1
- package/browser/chunk-SEVRZF2U.js +0 -1
- package/browser/chunk-SFLR6TA7.js +0 -1
- package/browser/chunk-T6BQJAEY.js +0 -1
- package/browser/chunk-TDB2ASJ5.js +0 -1
- package/browser/chunk-XUO5X2DR.js +0 -1
- package/browser/chunk-ZZTT5MET.js +0 -270
- package/browser/main-IFKRYXRT.js +0 -1
- package/browser/styles-DXY4Y6E7.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as J}from"./chunk-EBPDINXG.js";import{a as Z,b as ee,c as te}from"./chunk-FPNEFWYN.js";import{b as U}from"./chunk-4GVABYH4.js";import{p as ne}from"./chunk-VDRETD5H.js";import{a as X}from"./chunk-V363EHJE.js";import{Bb as S,Db as f,Fb as l,Ga as $,Jb as B,Jc as Y,Ka as s,Kb as N,Lb as F,Ma as H,Rb as M,Tb as c,Tc as j,Ub as p,Vb as W,Wa as V,Wc as Q,ca as y,dc as G,ec as K,ga as E,ha as T,jb as P,kb as q,kc as k,lb as h,ma as D,mb as g,pa as L,pb as I,qb as R,rb as w,sb as r,ta as v,tb as i,ua as O,ub as A}from"./chunk-B4RKRLIY.js";var ie=["composerInput"],re=["messagesContainer"],se=(a,t)=>t.phaseIndex;function ce(a,t){a&1&&(r(0,"div",4)(1,"p"),c(2,"No messages yet."),i()())}function le(a,t){if(a&1&&(r(0,"div",19)(1,"span",22),c(2,"session context"),i(),r(3,"pre",23),c(4),G(5,"json"),i()()),a&2){let e=l(2).$implicit;s(4),p(K(5,1,e.event.sessionContext))}}function de(a,t){if(a&1&&(r(0,"div",18),h(1,le,6,3,"div",19),r(2,"span",20),c(3),i(),A(4,"div",21),i()),a&2){let e=l().$implicit,n=l(2);M("case-chat__message--user",e.event.actor.role==="USER")("case-chat__message--agent",e.event.actor.role==="AGENT"),s(),g(n.showTechnical()&&e.event.sessionContext?1:-1),s(2),p(e.event.actor.displayName),s(),w("innerHTML",e.html,$)}}function me(a,t){if(a&1&&(r(0,"div",15)(1,"span",20),c(2),i(),r(3,"p",24),c(4),i()()),a&2){let e=l().$implicit,n=l(2);s(2),p(n.agentDisplayName()),s(2),p(e.text)}}function _e(a,t){if(a&1&&(r(0,"div",29),c(1),i()),a&2){let e=l(3).$implicit;s(),p(e.item.detail)}}function pe(a,t){if(a&1){let e=S();r(0,"button",27),f("click",function(){E(e);let o=l(2).$implicit,u=l(2);return T(u.toggleTechnical(o.eventId))}),r(1,"span",26),c(2),i(),r(3,"span",28),c(4),i()(),h(5,_e,2,1,"div",29)}if(a&2){let e=l(2).$implicit,n=l(2);P("aria-expanded",n.isTechnicalExpanded(e.eventId)),s(2),p(e.item.label),s(2),p(n.isTechnicalExpanded(e.eventId)?"\u25BC":"\u25B6"),s(),g(n.isTechnicalExpanded(e.eventId)?5:-1)}}function he(a,t){if(a&1&&(r(0,"span",26),c(1),i()),a&2){let e=l(2).$implicit;s(),p(e.item.label)}}function ge(a,t){if(a&1&&(r(0,"div",25),h(1,pe,6,4)(2,he,2,1,"span",26),i()),a&2){let e=l().$implicit;M("case-chat__technical--warn",e.item.type==="WarnEvent")("case-chat__technical--error",e.item.type==="ErrorEvent"),s(),g(e.item.detail?1:2)}}function ue(a,t){a&1&&c(0," \u23F3 ")}function Ce(a,t){a&1&&c(0," \u2705 ")}function ve(a,t){a&1&&c(0," \u274C ")}function fe(a,t){if(a&1&&(r(0,"div",46)(1,"span",47),c(2,"Enrichment content"),i(),r(3,"pre"),c(4),i()()),a&2){let e=l().$implicit;s(4),p(e.enrichmentContent)}}function xe(a,t){if(a&1&&(r(0,"div",42)(1,"div",43)(2,"span",44),c(3),i(),r(4,"span",45),c(5),i()(),r(6,"div",46)(7,"span",47),c(8,"Prompt"),i(),r(9,"pre"),c(10),i()(),r(11,"div",46)(12,"span",47),c(13,"LLM output"),i(),r(14,"pre"),c(15),i()(),h(16,fe,5,1,"div",46),i()),a&2){let e=t.$implicit;M("case-chat__enrichment-phase--failed",!e.success),s(3),W("Phase ",e.phaseIndex),s(2),p(e.success?"\u2705":"\u274C"),s(5),p(e.prompt),s(5),p(e.llmOutput),s(),g(e.enrichmentContent?16:-1)}}function be(a,t){if(a&1&&(r(0,"div",36)(1,"span",38),c(2,"Enrichment phases"),i(),I(3,xe,17,7,"div",41,se),i()),a&2){let e=l(3).$implicit;s(3),R(e.call.enrichmentPhases)}}function ye(a,t){if(a&1&&(r(0,"div",37)(1,"span",38),c(2,"Payload"),i(),r(3,"pre"),c(4),i()()),a&2){let e=l(3).$implicit;s(4),p(e.call.args)}}function Ee(a,t){a&1&&(r(0,"pre"),c(1),i()),a&2&&(s(),p(t))}function Te(a,t){a&1&&(r(0,"span",39),c(1,"Running\u2026"),i())}function we(a,t){a&1&&(r(0,"span",40),c(1,"No output"),i())}function Se(a,t){if(a&1&&(r(0,"div",35),h(1,be,5,0,"div",36),h(2,ye,5,1,"div",37),r(3,"div",37)(4,"span",38),c(5,"Output"),i(),h(6,Ee,2,1,"pre")(7,Te,2,0,"span",39)(8,we,2,0,"span",40),i()()),a&2){let e,n=l(2).$implicit,o=l(2);s(),g(o.showTechnical()&&(n.call.enrichmentPhases!=null&&n.call.enrichmentPhases.length)?1:-1),s(),g(n.call.args?2:-1),s(4),g((e=o.extractToolOutput(n.call))?6:n.call.response?8:7,e)}}function Me(a,t){if(a&1){let e=S();r(0,"div",30)(1,"button",31),f("click",function(){E(e);let o=l().$implicit,u=l(2);return T(u.toggleToolCall(o.call.requestId))}),r(2,"span",32),h(3,ue,1,0)(4,Ce,1,0)(5,ve,1,0),i(),r(6,"span",33),c(7),i(),r(8,"span",34),c(9),i()(),h(10,Se,9,3,"div",35),i()}if(a&2){let e=l().$implicit,n=l(2);M("case-chat__tool-call--pending",!e.call.response)("case-chat__tool-call--success",(e.call.response==null?null:e.call.response.success)===!0)("case-chat__tool-call--error",(e.call.response==null?null:e.call.response.success)===!1),s(),P("aria-expanded",n.isToolCallExpanded(e.call.requestId)),s(2),g(e.call.response?e.call.response.success?4:5:3),s(4),p(e.call.toolName),s(2),p(n.isToolCallExpanded(e.call.requestId)?"\u25BC":"\u25B6"),s(),g(n.isToolCallExpanded(e.call.requestId)?10:-1)}}function ke(a,t){if(a&1&&h(0,de,5,7,"div",14)(1,me,5,2,"div",15)(2,ge,3,5,"div",16)(3,Me,11,11,"div",17),a&2){let e=t.$implicit;g(e.kind==="message"?0:e.kind==="streaming"?1:e.kind==="technical"?2:3)}}function Oe(a,t){if(a&1&&I(0,ke,4,1,null,null,q().trackTimelineItem,!0),a&2){let e=l();R(e.timeline())}}function Pe(a,t){a&1&&(r(0,"div",5),A(1,"span",48)(2,"span",48)(3,"span",48),i())}function Ie(a,t){if(a&1){let e=S();r(0,"div",6)(1,"ds-icon-button",49),f("action",function(){E(e);let o=l();return T(o.onScrollToBottomClick())}),i()()}}function Re(a,t){if(a&1){let e=S();r(0,"ds-icon-button",50),f("action",function(){E(e);let o=l();return T(o.interrupt())}),i()}}function Ae(a,t){if(a&1){let e=S();r(0,"ds-icon-button",51),f("action",function(){E(e);let o=l();return T(o.submit())}),i()}if(a&2){let e=l();w("disabled",!e.canSend)}}var Ne=64,ae=class a{route=y(U);http=y(j);zone=y(L);destroyRef=y(D);domSanitizer=y(Q);config=y(J);caseId=this.route.snapshot.params.caseId;namespaceId=this.route.snapshot.params.namespaceId;markdownRenderer=this.buildMarkdownRenderer();agentDisplayName=k(()=>{let t=this.events();for(let e=t.length-1;e>=0;e--){let n=t[e];if(n){if(n.type==="AgentRunningEvent"||n.type==="AgentSelectedEvent"||n.type==="AgentFinishedEvent"){let o=n.agentName;if(o&&o.trim().length>0)return o}if(n.type==="MessageEvent"&&n.actor.role==="AGENT"&&n.actor.displayName)return n.actor.displayName}}return"Assistant"});eventSource=null;composerInput;messagesContainer;events=v([]);messageHtmlCache=new Map;inputValue=v("");isRunning=v(!1);isTerminal=v(!1);static SHOW_TECHNICAL_KEY="agentos.case-chat.showTechnical";showTechnical=v(localStorage.getItem(a.SHOW_TECHNICAL_KEY)==="true");streamingText=v("");collapsedTools=v(new Set);expandedTechnicals=v(new Set);isAtBottom=v(!0);scrollListenerCleanup=null;constructor(){O(()=>{this.isRunning()||this.isTerminal()||queueMicrotask(()=>this.composerInput?.nativeElement.focus())}),O(()=>{this.timeline(),this.streamingText(),this.isAtBottom()&&queueMicrotask(()=>this.scrollToBottom())}),H(()=>{this.attachScrollListener()})}baseTimeline=k(()=>{let t=this.events(),e=this.showTechnical(),n=new Map;for(let _ of t)if(_.type==="ToolRequestEvent"){let m=_,d=m.toolRequestId??_.id,b=n.get(d);n.set(d,{requestId:d,toolName:m.toolName??"unknown",args:m.args??null,response:b?.response,enrichmentPhases:m.enrichmentPhases??null})}else if(_.type==="ToolResponseEvent"){let m=_,d=m.toolRequestId??_.id,b=n.get(d);n.set(d,{requestId:d,toolName:b?.toolName??m.toolName??"unknown",args:b?.args??null,response:m,enrichmentPhases:b?.enrichmentPhases??null})}let o=[],u=new Set;for(let _ of t)if(_.type==="MessageEvent"){let m=_;o.push({kind:"message",event:m,html:this.messageHtmlCache.get(_.id)??""})}else if(_.type==="ToolRequestEvent"||_.type==="ToolResponseEvent"){let m=_.toolRequestId??_.id;u.has(m)||(u.add(m),o.push({kind:"tool",call:n.get(m)}))}else if(e){let m=this.toTechnicalItem(_);m&&o.push({kind:"technical",item:m,eventId:_.id})}return o});timeline=k(()=>{let t=this.baseTimeline(),e=this.streamingText();return e.trim().length===0?t:[...t,{kind:"streaming",text:e}]});trackTimelineItem(t,e){switch(e.kind){case"message":return e.event.id;case"tool":return e.call.requestId;case"technical":return e.eventId;case"streaming":return"streaming"}}get canSend(){return!!this.inputValue().trim()&&!this.isRunning()&&!this.isTerminal()}ngOnInit(){this.connectSse(),this.route.params.pipe(X(this.destroyRef)).subscribe(t=>{let e=t.caseId;e&&e!==this.caseId&&(this.caseId=e,this.reinitialise())})}ngOnDestroy(){this.eventSource?.close(),this.scrollListenerCleanup?.()}attachScrollListener(){let t=this.messagesContainer?.nativeElement;if(!t)return;let e=()=>{let n=t.scrollHeight-t.scrollTop-t.clientHeight;this.isAtBottom.set(n<=Ne)};t.addEventListener("scroll",e,{passive:!0}),this.scrollListenerCleanup=()=>t.removeEventListener("scroll",e)}scrollToBottom(){let t=this.messagesContainer?.nativeElement;t&&(t.scrollTop=t.scrollHeight)}onScrollToBottomClick(){this.isAtBottom.set(!0),this.scrollToBottom()}connectSse(){let t=`${this.config.basePath}/api/cases/${this.caseId}/events`;console.log("[AgentOS SSE] connecting",{url:t,basePath:this.config.basePath,caseId:this.caseId,namespaceId:this.namespaceId,now:new Date().toISOString()}),this.eventSource=this.zone.runOutsideAngular(()=>new EventSource(t));let e=o=>{let u=performance.now(),_=o.type,m=o.data;console.log("[AgentOS SSE] frame received",{sseEventName:_,dataLength:m?.length??0,dataPreview:m?.slice(0,120),receivedAtMs:u});try{let d=JSON.parse(m);this.zone.run(()=>{let b=this.events().length;if(d.type==="MessageEvent"){let C=d,x=this.extractText(C);this.messageHtmlCache.has(d.id)||this.messageHtmlCache.set(d.id,this.renderMarkdown(x))}this.events.update(C=>C.some(x=>x.id===d.id)?C:[...C,d]);let oe=this.events().length;if(console.log("[AgentOS SSE] event processed",{sseEventName:_,eventType:d.type,eventId:d.id,beforeLen:b,afterLen:oe,running:this.isRunning(),terminal:this.isTerminal()}),d.type==="TextChunkEvent"){let C=d.chunk;C&&this.streamingText.update(x=>x+C);return}if(d.type==="CaseStatusEvent"){let C=d.status,x=C==="KILLED"||C==="ERROR";if(this.isTerminal.set(x),x)this.isRunning.set(!1),this.eventSource?.close(),this.eventSource=null;else{let z=C==="RUNNING";this.isRunning.set(z),z||this.streamingText.set("")}return}if(d.type==="AgentFinishedEvent"){this.isRunning.set(!1),this.streamingText.set("");return}})}catch(d){console.warn("[AgentOS SSE] failed to parse event data",{sseEventName:_,error:d,dataPreview:m?.slice(0,500)})}},n=["MessageEvent","CaseStatusEvent","AgentSelectedEvent","AgentRunningEvent","AgentFinishedEvent","ThinkingEvent","TextChunkEvent","ToolRequestEvent","ToolResponseEvent","PendingConfirmationEvent","ConfirmationResolvedEvent","ErrorEvent","WarnEvent","IntentionGeneratedEvent"];for(let o of n)console.log("[AgentOS SSE] addEventListener",o),this.eventSource.addEventListener(o,e);this.eventSource.onopen=()=>{console.log("[AgentOS SSE] connection open",{readyState:this.eventSource?.readyState,at:new Date().toISOString()})},this.eventSource.onmessage=o=>{console.log("[AgentOS SSE] onmessage (unnamed event) received",{dataLength:o.data?.length??0,dataPreview:o.data?.slice(0,120)})},this.eventSource.onerror=o=>{console.warn("[AgentOS SSE] connection error",{err:o,readyState:this.eventSource?.readyState,at:new Date().toISOString()}),this.zone.run(()=>{this.isRunning.set(!1)})}}onInput(t){this.inputValue.set(t.target.value)}onKeydown(t){t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),this.submit())}reinitialise(){this.eventSource?.close(),this.eventSource=null,this.events.set([]),this.messageHtmlCache.clear(),this.inputValue.set(""),this.isRunning.set(!1),this.isTerminal.set(!1),this.streamingText.set(""),this.collapsedTools.set(new Set),this.isAtBottom.set(!0),this.connectSse()}submit(){if(!this.canSend)return;let t=this.inputValue().trim();this.inputValue.set(""),this.sendMessage(t)}sendMessage(t){this.isRunning.set(!0),this.streamingText.set(""),this.http.post(`${this.config.basePath}/api/cases/${this.caseId}/messages`,{content:t,userId:"default-user"}).subscribe({error:e=>{console.error("[CaseChat] Failed to send message",e),this.isRunning.set(!1)}})}interrupt(){this.http.post(`${this.config.basePath}/api/cases/${this.caseId}/interrupt`,{}).subscribe({error:t=>console.error("[CaseChat] Failed to interrupt case",t)})}kill(){this.http.post(`${this.config.basePath}/api/cases/${this.caseId}/kill`,{}).subscribe({error:t=>console.error("[CaseChat] Failed to kill case",t)})}extractText(t){return t.content?.filter(e=>"content"in e).map(e=>e.content).join("")??""}extractToolOutput(t){if(!t.response)return null;let e=t.response.output;return e?e.content??null:null}toggleToolCall(t){this.collapsedTools.update(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})}isToolCallExpanded(t){return this.collapsedTools().has(t)}toggleShowTechnical(){this.showTechnical.update(t=>{let e=!t;return localStorage.setItem(a.SHOW_TECHNICAL_KEY,String(e)),e})}toggleTechnical(t){this.expandedTechnicals.update(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})}isTechnicalExpanded(t){return this.expandedTechnicals().has(t)}renderMarkdown(t){if(!t)return"";let e=ee.parse(t,{renderer:this.markdownRenderer,breaks:!0,gfm:!0,async:!1}),n=te.sanitize(e,{ADD_TAGS:["span"],ADD_ATTR:["aria-hidden","aria-label","target","rel"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i});return this.domSanitizer.bypassSecurityTrustHtml(n)}buildMarkdownRenderer(){let t=new Z,e=t.link.bind(t);return t.link=n=>{let o=e(n);return this.isExternalLink(n.href)&&(o=o.replace("<a ",'<a target="_blank" rel="noopener noreferrer" ').replace("</a>",'<span class="external-link-icon" aria-hidden="true">\u2197</span></a>')),o},t}isExternalLink(t){if(!t||t.startsWith("/")||t.startsWith("#")||t.startsWith("?"))return!1;if(t.startsWith("//"))return!0;try{return new URL(t,window.location.href).hostname!==window.location.hostname}catch(e){return!1}}toTechnicalItem(t){switch(t.type){case"WarnEvent":return{type:"WarnEvent",label:"\u26A0\uFE0F Warn",detail:t.message};case"ErrorEvent":return{type:"ErrorEvent",label:"\u274C Error",detail:t.message};case"CaseStatusEvent":return{type:"CaseStatusEvent",label:`\u{1F7E1} Status: ${t.status}`};case"AgentRunningEvent":return{type:"AgentRunningEvent",label:`\u25B6\uFE0F Agent running: ${t.agentName}`};case"AgentFinishedEvent":return{type:"AgentFinishedEvent",label:`\u2705 Agent finished: ${t.agentName}`};case"AgentSelectedEvent":return{type:"AgentSelectedEvent",label:`\u{1F3AF} Agent selected: ${t.agentName}`};case"IntentionGeneratedEvent":{let e=t;return{type:"IntentionGeneratedEvent",label:`\u{1F9E0} Intention \u2192 ${e.toolName}`,detail:e.intention}}default:return null}}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=V({type:a,selectors:[["agentos-case-chat"]],viewQuery:function(e,n){if(e&1&&B(ie,5)(re,5),e&2){let o;N(o=F())&&(n.composerInput=o.first),N(o=F())&&(n.messagesContainer=o.first)}},decls:15,vars:9,consts:[["messagesContainer",""],["composerInput",""],[1,"case-chat"],[1,"case-chat__messages"],[1,"case-chat__empty"],[1,"case-chat__thinking"],[1,"case-chat__scroll-anchor"],[1,"case-chat__composer"],["placeholder","Reply\u2026","rows","3",1,"case-chat__input",3,"input","keydown","value","disabled"],[1,"case-chat__actions"],["variant","default",3,"action","icon","title"],["icon","stop","variant","danger","title","Interrupt"],["icon","send","variant","primary","title","Send (Enter)",3,"disabled"],["icon","cancel","variant","danger","title","Kill",3,"action","disabled"],[1,"case-chat__message",3,"case-chat__message--user","case-chat__message--agent"],[1,"case-chat__message","case-chat__message--agent","case-chat__message--streaming"],[1,"case-chat__technical",3,"case-chat__technical--warn","case-chat__technical--error"],[1,"case-chat__tool-call",3,"case-chat__tool-call--pending","case-chat__tool-call--success","case-chat__tool-call--error"],[1,"case-chat__message"],[1,"case-chat__session-context"],[1,"case-chat__message-author"],[1,"case-chat__message-text","case-chat__message-text--markdown",3,"innerHTML"],[1,"case-chat__session-context-label"],[1,"case-chat__session-context-body"],[1,"case-chat__message-text"],[1,"case-chat__technical"],[1,"case-chat__technical-label"],["type","button",1,"case-chat__technical-header",3,"click"],[1,"case-chat__technical-chevron"],[1,"case-chat__technical-body"],[1,"case-chat__tool-call"],["type","button",1,"case-chat__tool-call-header",3,"click"],[1,"case-chat__tool-call-icon"],[1,"case-chat__tool-call-name"],[1,"case-chat__tool-call-chevron"],[1,"case-chat__tool-call-output"],[1,"case-chat__tool-call-section","case-chat__enrichment-section"],[1,"case-chat__tool-call-section"],[1,"case-chat__tool-call-label"],[1,"case-chat__tool-call-pending"],[1,"case-chat__tool-call-empty"],[1,"case-chat__enrichment-phase",3,"case-chat__enrichment-phase--failed"],[1,"case-chat__enrichment-phase"],[1,"case-chat__enrichment-phase-header"],[1,"case-chat__enrichment-phase-index"],[1,"case-chat__enrichment-phase-status"],[1,"case-chat__enrichment-phase-row"],[1,"case-chat__enrichment-phase-label"],[1,"thinking-dot"],["icon","keyboard_arrow_down","variant","default","title","Scroll to bottom",3,"action"],["icon","stop","variant","danger","title","Interrupt",3,"action"],["icon","send","variant","primary","title","Send (Enter)",3,"action","disabled"]],template:function(e,n){e&1&&(r(0,"div",2)(1,"div",3,0),h(3,ce,3,0,"div",4)(4,Oe,2,0),h(5,Pe,4,0,"div",5),i(),h(6,Ie,2,0,"div",6),r(7,"div",7)(8,"textarea",8,1),f("input",function(u){return n.onInput(u)})("keydown",function(u){return n.onKeydown(u)}),i(),r(10,"div",9)(11,"ds-icon-button",10),f("action",function(){return n.toggleShowTechnical()}),i(),h(12,Re,1,0,"ds-icon-button",11)(13,Ae,1,1,"ds-icon-button",12),r(14,"ds-icon-button",13),f("action",function(){return n.kill()}),i()()()()),e&2&&(s(3),g(n.timeline().length===0?3:4),s(2),g(n.isRunning()?5:-1),s(),g(n.isAtBottom()?-1:6),s(2),w("value",n.inputValue())("disabled",n.isRunning()||n.isTerminal()),s(3),w("icon",n.showTechnical()?"visibility_off":"bug_report")("title",n.showTechnical()?"Hide technical events":"Show technical events"),s(),g(n.isRunning()?12:13),s(2),w("disabled",n.isTerminal()))},dependencies:[ne,Y],styles:['[_nghost-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.case-chat[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;max-width:800px;width:100%;margin:0 auto;padding:1.5rem;gap:1rem;position:relative}.case-chat__messages[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:.75rem;padding-bottom:.5rem;-webkit-overflow-scrolling:touch;scrollbar-width:thin;scrollbar-color:var(--color-border, rgba(0, 0, 0, .15)) transparent}.case-chat__empty[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;flex:1}.case-chat__empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.case-chat__tool-calls[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;margin-top:.25rem}.case-chat__tool-call[_ngcontent-%COMP%]{flex-shrink:0;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:var(--glass-bg, rgba(255, 255, 255, .72));font-size:.8rem;overflow:hidden;transition:border-color .2s ease}.case-chat__tool-call--pending[_ngcontent-%COMP%]{border-color:var(--color-warning, #f5a623);opacity:.8}.case-chat__tool-call--success[_ngcontent-%COMP%]{border-color:var(--color-success, #34c759)}.case-chat__tool-call--error[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.case-chat__tool-call-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.4rem;width:100%;padding:.4rem .6rem;background:transparent;border:none;cursor:pointer;text-align:left;color:var(--color-text, #1d1d1f);font-family:inherit;font-size:.8rem}.case-chat__tool-call-header[_ngcontent-%COMP%]:hover{background:#0000000a}.case-chat__tool-call-icon[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem}.case-chat__tool-call-name[_ngcontent-%COMP%]{font-weight:600;font-family:var(--font-mono, ui-monospace, "SF Mono", monospace);color:var(--color-primary, #0071e3);flex-shrink:0}.case-chat__tool-call-args[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-family:var(--font-mono, ui-monospace, "SF Mono", monospace);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.case-chat__tool-call-chevron[_ngcontent-%COMP%]{flex-shrink:0;font-size:.6rem;color:var(--color-text-secondary, #6e6e73);margin-left:auto}.case-chat__tool-call-output[_ngcontent-%COMP%]{border-top:1px solid var(--color-border, rgba(0, 0, 0, .08));display:flex;flex-direction:column}.case-chat__tool-call-section[_ngcontent-%COMP%]{padding:.4rem .6rem .5rem}.case-chat__tool-call-section[_ngcontent-%COMP%] + .case-chat__tool-call-section[_ngcontent-%COMP%]{border-top:1px solid var(--color-border, rgba(0, 0, 0, .06))}.case-chat__tool-call-section[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{margin:.25rem 0 0;white-space:pre-wrap;word-break:break-all;font-family:var(--font-mono, ui-monospace, "SF Mono", monospace);font-size:.75rem;color:var(--color-text, #1d1d1f);max-height:200px;overflow-y:auto}.case-chat__tool-call-label[_ngcontent-%COMP%]{display:block;font-size:.65rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--color-text-secondary, #6e6e73)}.case-chat__enrichment-section[_ngcontent-%COMP%]{background:var(--color-surface-secondary, rgba(0, 0, 0, .02))}.case-chat__enrichment-phase[_ngcontent-%COMP%]{margin-top:.35rem;border-radius:4px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .6));overflow:hidden}.case-chat__enrichment-phase--failed[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30);background:#ff3b300a}.case-chat__enrichment-phase-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:.2rem .5rem;background:#00000008;border-bottom:1px solid var(--color-border, rgba(0, 0, 0, .06))}.case-chat__enrichment-phase-index[_ngcontent-%COMP%]{font-weight:600;font-size:.7rem;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-secondary, #6e6e73)}.case-chat__enrichment-phase-status[_ngcontent-%COMP%]{font-size:.7rem}.case-chat__enrichment-phase-row[_ngcontent-%COMP%]{padding:.25rem .5rem}.case-chat__enrichment-phase-row[_ngcontent-%COMP%] + .case-chat__enrichment-phase-row[_ngcontent-%COMP%]{border-top:1px solid var(--color-border, rgba(0, 0, 0, .04))}.case-chat__enrichment-phase-row[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{margin:.15rem 0 0;white-space:pre-wrap;word-break:break-all;font-family:var(--font-mono, ui-monospace, "SF Mono", monospace);font-size:.7rem;color:var(--color-text, #1d1d1f);max-height:150px;overflow-y:auto}.case-chat__enrichment-phase-label[_ngcontent-%COMP%]{display:block;font-size:.6rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-secondary, #6e6e73)}.case-chat__tool-call-pending[_ngcontent-%COMP%], .case-chat__tool-call-empty[_ngcontent-%COMP%]{display:block;margin-top:.25rem;color:var(--color-text-secondary, #6e6e73);font-style:italic;font-size:.75rem}.case-chat__technical[_ngcontent-%COMP%]{flex-shrink:0;border-radius:6px;background:var(--color-surface-secondary, rgba(0, 0, 0, .03));border-left:3px solid var(--color-border, rgba(0, 0, 0, .12));font-size:.78rem;color:var(--color-text-secondary, #6e6e73);overflow:hidden}.case-chat__technical--warn[_ngcontent-%COMP%]{border-left-color:var(--color-warning, #f5a623);background:#f5a6230f;color:var(--color-text, #1d1d1f)}.case-chat__technical--error[_ngcontent-%COMP%]{border-left-color:var(--color-error, #ff3b30);background:#ff3b300f;color:var(--color-text, #1d1d1f)}.case-chat__technical-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;width:100%;padding:.2rem .75rem;background:transparent;border:none;cursor:pointer;text-align:left;color:inherit;font-family:inherit;font-size:inherit}.case-chat__technical-header[_ngcontent-%COMP%]:hover{background:#0000000a}.case-chat__technical-label[_ngcontent-%COMP%]{font-weight:500;white-space:nowrap}.case-chat__technical-label[_ngcontent-%COMP%]:only-child{display:block;padding:.2rem .75rem}.case-chat__technical-chevron[_ngcontent-%COMP%]{flex-shrink:0;font-size:.6rem;color:var(--color-text-secondary, #6e6e73);margin-left:auto}.case-chat__technical-body[_ngcontent-%COMP%]{padding:.3rem .75rem .5rem;border-top:1px solid var(--color-border, rgba(0, 0, 0, .08));white-space:pre-wrap;word-break:break-word;font-size:.75rem;line-height:1.5;color:var(--color-text, #1d1d1f)}.case-chat__session-context[_ngcontent-%COMP%]{flex-shrink:0;border-radius:6px;background:var(--color-surface-secondary, rgba(0, 0, 0, .03));border-left:3px solid var(--color-primary, #0071e3);padding:.25rem .75rem .4rem;margin-bottom:.25rem;font-size:.75rem;color:var(--color-text-secondary, #6e6e73);overflow:hidden}.case-chat__session-context-label[_ngcontent-%COMP%]{display:block;font-size:.65rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--color-primary, #0071e3);margin-bottom:.2rem}.case-chat__session-context-body[_ngcontent-%COMP%]{margin:0;white-space:pre-wrap;word-break:break-all;font-family:var(--font-mono, ui-monospace, "SF Mono", monospace);font-size:.75rem;color:var(--color-text, #1d1d1f);max-height:160px;overflow-y:auto}.case-chat__message[_ngcontent-%COMP%]{flex-shrink:0}.case-chat__thinking[_ngcontent-%COMP%]{flex-shrink:0;display:flex;gap:.3rem;padding:.75rem 1rem;align-self:flex-start}.case-chat__message-text--markdown[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0 0 .5em}.case-chat__message-text--markdown[_ngcontent-%COMP%] p[_ngcontent-%COMP%]:last-child{margin-bottom:0}.case-chat__message-text--markdown[_ngcontent-%COMP%] ul[_ngcontent-%COMP%], .case-chat__message-text--markdown[_ngcontent-%COMP%] ol[_ngcontent-%COMP%]{margin:.25em 0 .5em;padding-left:1.4em}.case-chat__message-text--markdown[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin-bottom:.2em}.case-chat__message-text--markdown[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:var(--font-mono, ui-monospace, "SF Mono", monospace);font-size:.85em;background:#0000000f;border-radius:3px;padding:.1em .35em}.case-chat__message-text--markdown[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{background:#0000000f;border-radius:6px;padding:.6em .8em;overflow-x:auto;margin:.4em 0}.case-chat__message-text--markdown[_ngcontent-%COMP%] pre[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:none;padding:0;font-size:.8rem}.case-chat__message-text--markdown[_ngcontent-%COMP%] blockquote[_ngcontent-%COMP%]{margin:.4em 0;padding-left:.8em;border-left:3px solid var(--color-border, rgba(0, 0, 0, .15));color:var(--color-text-secondary, #6e6e73)}.case-chat__message-text--markdown[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #0071e3);text-decoration:underline}.case-chat__message-text--markdown[_ngcontent-%COMP%] h1[_ngcontent-%COMP%], .case-chat__message-text--markdown[_ngcontent-%COMP%] h2[_ngcontent-%COMP%], .case-chat__message-text--markdown[_ngcontent-%COMP%] h3[_ngcontent-%COMP%], .case-chat__message-text--markdown[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:.5em 0 .25em;font-size:1em;font-weight:600}.case-chat__message-text--markdown[_ngcontent-%COMP%] .external-link-icon[_ngcontent-%COMP%]{font-size:.75em;margin-left:.15em;vertical-align:super}.case-chat__message--streaming[_ngcontent-%COMP%]{opacity:.95}.case-chat__scroll-anchor[_ngcontent-%COMP%]{position:absolute;bottom:calc(2rem + 80px);left:50%;transform:translate(-50%);z-index:10;background:var(--glass-bg, rgba(255, 255, 255, .88));border:1px solid var(--glass-border, rgba(255, 255, 255, .3));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border-radius:50%;box-shadow:0 2px 12px #0000001f;animation:_ngcontent-%COMP%_scroll-anchor-in .15s ease}.case-chat__composer[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:flex-end;gap:.5rem;background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));backdrop-filter:var(--glass-backdrop-blur, blur(20px));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));border-radius:16px;padding:.5rem .5rem .5rem 1rem}.case-chat__input[_ngcontent-%COMP%]{flex:1;resize:none;padding:.5rem 0;border:none;background:transparent;color:var(--color-text, #1d1d1f);font-size:.95rem;font-family:inherit;line-height:1.5;outline:none;min-height:40px}.case-chat__input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.case-chat__input[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.case-chat__actions[_ngcontent-%COMP%]{display:flex;align-items:center;flex-shrink:0}.thinking-dot[_ngcontent-%COMP%]{width:8px;height:8px;border-radius:50%;background:var(--color-text-secondary, #6e6e73);animation:_ngcontent-%COMP%_thinking-bounce 1.2s ease-in-out infinite}.thinking-dot[_ngcontent-%COMP%]:nth-child(2){animation-delay:.2s}.thinking-dot[_ngcontent-%COMP%]:nth-child(3){animation-delay:.4s}@keyframes _ngcontent-%COMP%_thinking-bounce{0%,80%,to{transform:translateY(0);opacity:.4}40%{transform:translateY(-6px);opacity:1}}@keyframes _ngcontent-%COMP%_scroll-anchor-in{0%{opacity:0;transform:translate(-50%) translateY(8px)}to{opacity:1;transform:translate(-50%) translateY(0)}}']})};export{ae as a};
|
|
1
|
+
import{a as J}from"./chunk-EBPDINXG.js";import{a as Z,b as ee,c as te}from"./chunk-FPNEFWYN.js";import{b as U}from"./chunk-4GVABYH4.js";import{p as ne}from"./chunk-WV7ML4CJ.js";import{a as X}from"./chunk-V363EHJE.js";import{Bb as S,Db as f,Fb as l,Ga as $,Jb as B,Jc as Y,Ka as s,Kb as N,Lb as F,Ma as H,Rb as M,Tb as c,Tc as j,Ub as p,Vb as W,Wa as V,Wc as Q,ca as y,dc as G,ec as K,ga as E,ha as T,jb as P,kb as q,kc as k,lb as h,ma as D,mb as g,pa as L,pb as I,qb as R,rb as w,sb as r,ta as v,tb as i,ua as O,ub as A}from"./chunk-B4RKRLIY.js";var ie=["composerInput"],re=["messagesContainer"],se=(a,t)=>t.phaseIndex;function ce(a,t){a&1&&(r(0,"div",4)(1,"p"),c(2,"No messages yet."),i()())}function le(a,t){if(a&1&&(r(0,"div",19)(1,"span",22),c(2,"session context"),i(),r(3,"pre",23),c(4),G(5,"json"),i()()),a&2){let e=l(2).$implicit;s(4),p(K(5,1,e.event.sessionContext))}}function de(a,t){if(a&1&&(r(0,"div",18),h(1,le,6,3,"div",19),r(2,"span",20),c(3),i(),A(4,"div",21),i()),a&2){let e=l().$implicit,n=l(2);M("case-chat__message--user",e.event.actor.role==="USER")("case-chat__message--agent",e.event.actor.role==="AGENT"),s(),g(n.showTechnical()&&e.event.sessionContext?1:-1),s(2),p(e.event.actor.displayName),s(),w("innerHTML",e.html,$)}}function me(a,t){if(a&1&&(r(0,"div",15)(1,"span",20),c(2),i(),r(3,"p",24),c(4),i()()),a&2){let e=l().$implicit,n=l(2);s(2),p(n.agentDisplayName()),s(2),p(e.text)}}function _e(a,t){if(a&1&&(r(0,"div",29),c(1),i()),a&2){let e=l(3).$implicit;s(),p(e.item.detail)}}function pe(a,t){if(a&1){let e=S();r(0,"button",27),f("click",function(){E(e);let o=l(2).$implicit,u=l(2);return T(u.toggleTechnical(o.eventId))}),r(1,"span",26),c(2),i(),r(3,"span",28),c(4),i()(),h(5,_e,2,1,"div",29)}if(a&2){let e=l(2).$implicit,n=l(2);P("aria-expanded",n.isTechnicalExpanded(e.eventId)),s(2),p(e.item.label),s(2),p(n.isTechnicalExpanded(e.eventId)?"\u25BC":"\u25B6"),s(),g(n.isTechnicalExpanded(e.eventId)?5:-1)}}function he(a,t){if(a&1&&(r(0,"span",26),c(1),i()),a&2){let e=l(2).$implicit;s(),p(e.item.label)}}function ge(a,t){if(a&1&&(r(0,"div",25),h(1,pe,6,4)(2,he,2,1,"span",26),i()),a&2){let e=l().$implicit;M("case-chat__technical--warn",e.item.type==="WarnEvent")("case-chat__technical--error",e.item.type==="ErrorEvent"),s(),g(e.item.detail?1:2)}}function ue(a,t){a&1&&c(0," \u23F3 ")}function Ce(a,t){a&1&&c(0," \u2705 ")}function ve(a,t){a&1&&c(0," \u274C ")}function fe(a,t){if(a&1&&(r(0,"div",46)(1,"span",47),c(2,"Enrichment content"),i(),r(3,"pre"),c(4),i()()),a&2){let e=l().$implicit;s(4),p(e.enrichmentContent)}}function xe(a,t){if(a&1&&(r(0,"div",42)(1,"div",43)(2,"span",44),c(3),i(),r(4,"span",45),c(5),i()(),r(6,"div",46)(7,"span",47),c(8,"Prompt"),i(),r(9,"pre"),c(10),i()(),r(11,"div",46)(12,"span",47),c(13,"LLM output"),i(),r(14,"pre"),c(15),i()(),h(16,fe,5,1,"div",46),i()),a&2){let e=t.$implicit;M("case-chat__enrichment-phase--failed",!e.success),s(3),W("Phase ",e.phaseIndex),s(2),p(e.success?"\u2705":"\u274C"),s(5),p(e.prompt),s(5),p(e.llmOutput),s(),g(e.enrichmentContent?16:-1)}}function be(a,t){if(a&1&&(r(0,"div",36)(1,"span",38),c(2,"Enrichment phases"),i(),I(3,xe,17,7,"div",41,se),i()),a&2){let e=l(3).$implicit;s(3),R(e.call.enrichmentPhases)}}function ye(a,t){if(a&1&&(r(0,"div",37)(1,"span",38),c(2,"Payload"),i(),r(3,"pre"),c(4),i()()),a&2){let e=l(3).$implicit;s(4),p(e.call.args)}}function Ee(a,t){a&1&&(r(0,"pre"),c(1),i()),a&2&&(s(),p(t))}function Te(a,t){a&1&&(r(0,"span",39),c(1,"Running\u2026"),i())}function we(a,t){a&1&&(r(0,"span",40),c(1,"No output"),i())}function Se(a,t){if(a&1&&(r(0,"div",35),h(1,be,5,0,"div",36),h(2,ye,5,1,"div",37),r(3,"div",37)(4,"span",38),c(5,"Output"),i(),h(6,Ee,2,1,"pre")(7,Te,2,0,"span",39)(8,we,2,0,"span",40),i()()),a&2){let e,n=l(2).$implicit,o=l(2);s(),g(o.showTechnical()&&(n.call.enrichmentPhases!=null&&n.call.enrichmentPhases.length)?1:-1),s(),g(n.call.args?2:-1),s(4),g((e=o.extractToolOutput(n.call))?6:n.call.response?8:7,e)}}function Me(a,t){if(a&1){let e=S();r(0,"div",30)(1,"button",31),f("click",function(){E(e);let o=l().$implicit,u=l(2);return T(u.toggleToolCall(o.call.requestId))}),r(2,"span",32),h(3,ue,1,0)(4,Ce,1,0)(5,ve,1,0),i(),r(6,"span",33),c(7),i(),r(8,"span",34),c(9),i()(),h(10,Se,9,3,"div",35),i()}if(a&2){let e=l().$implicit,n=l(2);M("case-chat__tool-call--pending",!e.call.response)("case-chat__tool-call--success",(e.call.response==null?null:e.call.response.success)===!0)("case-chat__tool-call--error",(e.call.response==null?null:e.call.response.success)===!1),s(),P("aria-expanded",n.isToolCallExpanded(e.call.requestId)),s(2),g(e.call.response?e.call.response.success?4:5:3),s(4),p(e.call.toolName),s(2),p(n.isToolCallExpanded(e.call.requestId)?"\u25BC":"\u25B6"),s(),g(n.isToolCallExpanded(e.call.requestId)?10:-1)}}function ke(a,t){if(a&1&&h(0,de,5,7,"div",14)(1,me,5,2,"div",15)(2,ge,3,5,"div",16)(3,Me,11,11,"div",17),a&2){let e=t.$implicit;g(e.kind==="message"?0:e.kind==="streaming"?1:e.kind==="technical"?2:3)}}function Oe(a,t){if(a&1&&I(0,ke,4,1,null,null,q().trackTimelineItem,!0),a&2){let e=l();R(e.timeline())}}function Pe(a,t){a&1&&(r(0,"div",5),A(1,"span",48)(2,"span",48)(3,"span",48),i())}function Ie(a,t){if(a&1){let e=S();r(0,"div",6)(1,"ds-icon-button",49),f("action",function(){E(e);let o=l();return T(o.onScrollToBottomClick())}),i()()}}function Re(a,t){if(a&1){let e=S();r(0,"ds-icon-button",50),f("action",function(){E(e);let o=l();return T(o.interrupt())}),i()}}function Ae(a,t){if(a&1){let e=S();r(0,"ds-icon-button",51),f("action",function(){E(e);let o=l();return T(o.submit())}),i()}if(a&2){let e=l();w("disabled",!e.canSend)}}var Ne=64,ae=class a{route=y(U);http=y(j);zone=y(L);destroyRef=y(D);domSanitizer=y(Q);config=y(J);caseId=this.route.snapshot.params.caseId;namespaceId=this.route.snapshot.params.namespaceId;markdownRenderer=this.buildMarkdownRenderer();agentDisplayName=k(()=>{let t=this.events();for(let e=t.length-1;e>=0;e--){let n=t[e];if(n){if(n.type==="AgentRunningEvent"||n.type==="AgentSelectedEvent"||n.type==="AgentFinishedEvent"){let o=n.agentName;if(o&&o.trim().length>0)return o}if(n.type==="MessageEvent"&&n.actor.role==="AGENT"&&n.actor.displayName)return n.actor.displayName}}return"Assistant"});eventSource=null;composerInput;messagesContainer;events=v([]);messageHtmlCache=new Map;inputValue=v("");isRunning=v(!1);isTerminal=v(!1);static SHOW_TECHNICAL_KEY="agentos.case-chat.showTechnical";showTechnical=v(localStorage.getItem(a.SHOW_TECHNICAL_KEY)==="true");streamingText=v("");collapsedTools=v(new Set);expandedTechnicals=v(new Set);isAtBottom=v(!0);scrollListenerCleanup=null;constructor(){O(()=>{this.isRunning()||this.isTerminal()||queueMicrotask(()=>this.composerInput?.nativeElement.focus())}),O(()=>{this.timeline(),this.streamingText(),this.isAtBottom()&&queueMicrotask(()=>this.scrollToBottom())}),H(()=>{this.attachScrollListener()})}baseTimeline=k(()=>{let t=this.events(),e=this.showTechnical(),n=new Map;for(let _ of t)if(_.type==="ToolRequestEvent"){let m=_,d=m.toolRequestId??_.id,b=n.get(d);n.set(d,{requestId:d,toolName:m.toolName??"unknown",args:m.args??null,response:b?.response,enrichmentPhases:m.enrichmentPhases??null})}else if(_.type==="ToolResponseEvent"){let m=_,d=m.toolRequestId??_.id,b=n.get(d);n.set(d,{requestId:d,toolName:b?.toolName??m.toolName??"unknown",args:b?.args??null,response:m,enrichmentPhases:b?.enrichmentPhases??null})}let o=[],u=new Set;for(let _ of t)if(_.type==="MessageEvent"){let m=_;o.push({kind:"message",event:m,html:this.messageHtmlCache.get(_.id)??""})}else if(_.type==="ToolRequestEvent"||_.type==="ToolResponseEvent"){let m=_.toolRequestId??_.id;u.has(m)||(u.add(m),o.push({kind:"tool",call:n.get(m)}))}else if(e){let m=this.toTechnicalItem(_);m&&o.push({kind:"technical",item:m,eventId:_.id})}return o});timeline=k(()=>{let t=this.baseTimeline(),e=this.streamingText();return e.trim().length===0?t:[...t,{kind:"streaming",text:e}]});trackTimelineItem(t,e){switch(e.kind){case"message":return e.event.id;case"tool":return e.call.requestId;case"technical":return e.eventId;case"streaming":return"streaming"}}get canSend(){return!!this.inputValue().trim()&&!this.isRunning()&&!this.isTerminal()}ngOnInit(){this.connectSse(),this.route.params.pipe(X(this.destroyRef)).subscribe(t=>{let e=t.caseId;e&&e!==this.caseId&&(this.caseId=e,this.reinitialise())})}ngOnDestroy(){this.eventSource?.close(),this.scrollListenerCleanup?.()}attachScrollListener(){let t=this.messagesContainer?.nativeElement;if(!t)return;let e=()=>{let n=t.scrollHeight-t.scrollTop-t.clientHeight;this.isAtBottom.set(n<=Ne)};t.addEventListener("scroll",e,{passive:!0}),this.scrollListenerCleanup=()=>t.removeEventListener("scroll",e)}scrollToBottom(){let t=this.messagesContainer?.nativeElement;t&&(t.scrollTop=t.scrollHeight)}onScrollToBottomClick(){this.isAtBottom.set(!0),this.scrollToBottom()}connectSse(){let t=`${this.config.basePath}/api/cases/${this.caseId}/events`;console.log("[AgentOS SSE] connecting",{url:t,basePath:this.config.basePath,caseId:this.caseId,namespaceId:this.namespaceId,now:new Date().toISOString()}),this.eventSource=this.zone.runOutsideAngular(()=>new EventSource(t));let e=o=>{let u=performance.now(),_=o.type,m=o.data;console.log("[AgentOS SSE] frame received",{sseEventName:_,dataLength:m?.length??0,dataPreview:m?.slice(0,120),receivedAtMs:u});try{let d=JSON.parse(m);this.zone.run(()=>{let b=this.events().length;if(d.type==="MessageEvent"){let C=d,x=this.extractText(C);this.messageHtmlCache.has(d.id)||this.messageHtmlCache.set(d.id,this.renderMarkdown(x))}this.events.update(C=>C.some(x=>x.id===d.id)?C:[...C,d]);let oe=this.events().length;if(console.log("[AgentOS SSE] event processed",{sseEventName:_,eventType:d.type,eventId:d.id,beforeLen:b,afterLen:oe,running:this.isRunning(),terminal:this.isTerminal()}),d.type==="TextChunkEvent"){let C=d.chunk;C&&this.streamingText.update(x=>x+C);return}if(d.type==="CaseStatusEvent"){let C=d.status,x=C==="KILLED"||C==="ERROR";if(this.isTerminal.set(x),x)this.isRunning.set(!1),this.eventSource?.close(),this.eventSource=null;else{let z=C==="RUNNING";this.isRunning.set(z),z||this.streamingText.set("")}return}if(d.type==="AgentFinishedEvent"){this.isRunning.set(!1),this.streamingText.set("");return}})}catch(d){console.warn("[AgentOS SSE] failed to parse event data",{sseEventName:_,error:d,dataPreview:m?.slice(0,500)})}},n=["MessageEvent","CaseStatusEvent","AgentSelectedEvent","AgentRunningEvent","AgentFinishedEvent","ThinkingEvent","TextChunkEvent","ToolRequestEvent","ToolResponseEvent","PendingConfirmationEvent","ConfirmationResolvedEvent","ErrorEvent","WarnEvent","IntentionGeneratedEvent"];for(let o of n)console.log("[AgentOS SSE] addEventListener",o),this.eventSource.addEventListener(o,e);this.eventSource.onopen=()=>{console.log("[AgentOS SSE] connection open",{readyState:this.eventSource?.readyState,at:new Date().toISOString()})},this.eventSource.onmessage=o=>{console.log("[AgentOS SSE] onmessage (unnamed event) received",{dataLength:o.data?.length??0,dataPreview:o.data?.slice(0,120)})},this.eventSource.onerror=o=>{console.warn("[AgentOS SSE] connection error",{err:o,readyState:this.eventSource?.readyState,at:new Date().toISOString()}),this.zone.run(()=>{this.isRunning.set(!1)})}}onInput(t){this.inputValue.set(t.target.value)}onKeydown(t){t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),this.submit())}reinitialise(){this.eventSource?.close(),this.eventSource=null,this.events.set([]),this.messageHtmlCache.clear(),this.inputValue.set(""),this.isRunning.set(!1),this.isTerminal.set(!1),this.streamingText.set(""),this.collapsedTools.set(new Set),this.isAtBottom.set(!0),this.connectSse()}submit(){if(!this.canSend)return;let t=this.inputValue().trim();this.inputValue.set(""),this.sendMessage(t)}sendMessage(t){this.isRunning.set(!0),this.streamingText.set(""),this.http.post(`${this.config.basePath}/api/cases/${this.caseId}/messages`,{content:t,userId:"default-user"}).subscribe({error:e=>{console.error("[CaseChat] Failed to send message",e),this.isRunning.set(!1)}})}interrupt(){this.http.post(`${this.config.basePath}/api/cases/${this.caseId}/interrupt`,{}).subscribe({error:t=>console.error("[CaseChat] Failed to interrupt case",t)})}kill(){this.http.post(`${this.config.basePath}/api/cases/${this.caseId}/kill`,{}).subscribe({error:t=>console.error("[CaseChat] Failed to kill case",t)})}extractText(t){return t.content?.filter(e=>"content"in e).map(e=>e.content).join("")??""}extractToolOutput(t){if(!t.response)return null;let e=t.response.output;return e?e.content??null:null}toggleToolCall(t){this.collapsedTools.update(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})}isToolCallExpanded(t){return this.collapsedTools().has(t)}toggleShowTechnical(){this.showTechnical.update(t=>{let e=!t;return localStorage.setItem(a.SHOW_TECHNICAL_KEY,String(e)),e})}toggleTechnical(t){this.expandedTechnicals.update(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})}isTechnicalExpanded(t){return this.expandedTechnicals().has(t)}renderMarkdown(t){if(!t)return"";let e=ee.parse(t,{renderer:this.markdownRenderer,breaks:!0,gfm:!0,async:!1}),n=te.sanitize(e,{ADD_TAGS:["span"],ADD_ATTR:["aria-hidden","aria-label","target","rel"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i});return this.domSanitizer.bypassSecurityTrustHtml(n)}buildMarkdownRenderer(){let t=new Z,e=t.link.bind(t);return t.link=n=>{let o=e(n);return this.isExternalLink(n.href)&&(o=o.replace("<a ",'<a target="_blank" rel="noopener noreferrer" ').replace("</a>",'<span class="external-link-icon" aria-hidden="true">\u2197</span></a>')),o},t}isExternalLink(t){if(!t||t.startsWith("/")||t.startsWith("#")||t.startsWith("?"))return!1;if(t.startsWith("//"))return!0;try{return new URL(t,window.location.href).hostname!==window.location.hostname}catch(e){return!1}}toTechnicalItem(t){switch(t.type){case"WarnEvent":return{type:"WarnEvent",label:"\u26A0\uFE0F Warn",detail:t.message};case"ErrorEvent":return{type:"ErrorEvent",label:"\u274C Error",detail:t.message};case"CaseStatusEvent":return{type:"CaseStatusEvent",label:`\u{1F7E1} Status: ${t.status}`};case"AgentRunningEvent":return{type:"AgentRunningEvent",label:`\u25B6\uFE0F Agent running: ${t.agentName}`};case"AgentFinishedEvent":return{type:"AgentFinishedEvent",label:`\u2705 Agent finished: ${t.agentName}`};case"AgentSelectedEvent":return{type:"AgentSelectedEvent",label:`\u{1F3AF} Agent selected: ${t.agentName}`};case"IntentionGeneratedEvent":{let e=t;return{type:"IntentionGeneratedEvent",label:`\u{1F9E0} Intention \u2192 ${e.toolName}`,detail:e.intention}}default:return null}}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=V({type:a,selectors:[["agentos-case-chat"]],viewQuery:function(e,n){if(e&1&&B(ie,5)(re,5),e&2){let o;N(o=F())&&(n.composerInput=o.first),N(o=F())&&(n.messagesContainer=o.first)}},decls:15,vars:9,consts:[["messagesContainer",""],["composerInput",""],[1,"case-chat"],[1,"case-chat__messages"],[1,"case-chat__empty"],[1,"case-chat__thinking"],[1,"case-chat__scroll-anchor"],[1,"case-chat__composer"],["placeholder","Reply\u2026","rows","3",1,"case-chat__input",3,"input","keydown","value","disabled"],[1,"case-chat__actions"],["variant","default",3,"action","icon","title"],["icon","stop","variant","danger","title","Interrupt"],["icon","send","variant","primary","title","Send (Enter)",3,"disabled"],["icon","cancel","variant","danger","title","Kill",3,"action","disabled"],[1,"case-chat__message",3,"case-chat__message--user","case-chat__message--agent"],[1,"case-chat__message","case-chat__message--agent","case-chat__message--streaming"],[1,"case-chat__technical",3,"case-chat__technical--warn","case-chat__technical--error"],[1,"case-chat__tool-call",3,"case-chat__tool-call--pending","case-chat__tool-call--success","case-chat__tool-call--error"],[1,"case-chat__message"],[1,"case-chat__session-context"],[1,"case-chat__message-author"],[1,"case-chat__message-text","case-chat__message-text--markdown",3,"innerHTML"],[1,"case-chat__session-context-label"],[1,"case-chat__session-context-body"],[1,"case-chat__message-text"],[1,"case-chat__technical"],[1,"case-chat__technical-label"],["type","button",1,"case-chat__technical-header",3,"click"],[1,"case-chat__technical-chevron"],[1,"case-chat__technical-body"],[1,"case-chat__tool-call"],["type","button",1,"case-chat__tool-call-header",3,"click"],[1,"case-chat__tool-call-icon"],[1,"case-chat__tool-call-name"],[1,"case-chat__tool-call-chevron"],[1,"case-chat__tool-call-output"],[1,"case-chat__tool-call-section","case-chat__enrichment-section"],[1,"case-chat__tool-call-section"],[1,"case-chat__tool-call-label"],[1,"case-chat__tool-call-pending"],[1,"case-chat__tool-call-empty"],[1,"case-chat__enrichment-phase",3,"case-chat__enrichment-phase--failed"],[1,"case-chat__enrichment-phase"],[1,"case-chat__enrichment-phase-header"],[1,"case-chat__enrichment-phase-index"],[1,"case-chat__enrichment-phase-status"],[1,"case-chat__enrichment-phase-row"],[1,"case-chat__enrichment-phase-label"],[1,"thinking-dot"],["icon","keyboard_arrow_down","variant","default","title","Scroll to bottom",3,"action"],["icon","stop","variant","danger","title","Interrupt",3,"action"],["icon","send","variant","primary","title","Send (Enter)",3,"action","disabled"]],template:function(e,n){e&1&&(r(0,"div",2)(1,"div",3,0),h(3,ce,3,0,"div",4)(4,Oe,2,0),h(5,Pe,4,0,"div",5),i(),h(6,Ie,2,0,"div",6),r(7,"div",7)(8,"textarea",8,1),f("input",function(u){return n.onInput(u)})("keydown",function(u){return n.onKeydown(u)}),i(),r(10,"div",9)(11,"ds-icon-button",10),f("action",function(){return n.toggleShowTechnical()}),i(),h(12,Re,1,0,"ds-icon-button",11)(13,Ae,1,1,"ds-icon-button",12),r(14,"ds-icon-button",13),f("action",function(){return n.kill()}),i()()()()),e&2&&(s(3),g(n.timeline().length===0?3:4),s(2),g(n.isRunning()?5:-1),s(),g(n.isAtBottom()?-1:6),s(2),w("value",n.inputValue())("disabled",n.isRunning()||n.isTerminal()),s(3),w("icon",n.showTechnical()?"visibility_off":"bug_report")("title",n.showTechnical()?"Hide technical events":"Show technical events"),s(),g(n.isRunning()?12:13),s(2),w("disabled",n.isTerminal()))},dependencies:[ne,Y],styles:['[_nghost-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.case-chat[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;max-width:800px;width:100%;margin:0 auto;padding:1.5rem;gap:1rem;position:relative}.case-chat__messages[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:.75rem;padding-bottom:.5rem;-webkit-overflow-scrolling:touch;scrollbar-width:thin;scrollbar-color:var(--color-border, rgba(0, 0, 0, .15)) transparent}.case-chat__empty[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;flex:1}.case-chat__empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.case-chat__tool-calls[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;margin-top:.25rem}.case-chat__tool-call[_ngcontent-%COMP%]{flex-shrink:0;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:var(--glass-bg, rgba(255, 255, 255, .72));font-size:.8rem;overflow:hidden;transition:border-color .2s ease}.case-chat__tool-call--pending[_ngcontent-%COMP%]{border-color:var(--color-warning, #f5a623);opacity:.8}.case-chat__tool-call--success[_ngcontent-%COMP%]{border-color:var(--color-success, #34c759)}.case-chat__tool-call--error[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.case-chat__tool-call-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.4rem;width:100%;padding:.4rem .6rem;background:transparent;border:none;cursor:pointer;text-align:left;color:var(--color-text, #1d1d1f);font-family:inherit;font-size:.8rem}.case-chat__tool-call-header[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04))}.case-chat__tool-call-icon[_ngcontent-%COMP%]{flex-shrink:0;font-size:.75rem}.case-chat__tool-call-name[_ngcontent-%COMP%]{font-weight:600;font-family:var(--font-mono, ui-monospace, "SF Mono", monospace);color:var(--color-primary, #0071e3);flex-shrink:0}.case-chat__tool-call-args[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-family:var(--font-mono, ui-monospace, "SF Mono", monospace);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.case-chat__tool-call-chevron[_ngcontent-%COMP%]{flex-shrink:0;font-size:.6rem;color:var(--color-text-secondary, #6e6e73);margin-left:auto}.case-chat__tool-call-output[_ngcontent-%COMP%]{border-top:1px solid var(--color-border, rgba(0, 0, 0, .08));display:flex;flex-direction:column}.case-chat__tool-call-section[_ngcontent-%COMP%]{padding:.4rem .6rem .5rem}.case-chat__tool-call-section[_ngcontent-%COMP%] + .case-chat__tool-call-section[_ngcontent-%COMP%]{border-top:1px solid var(--color-border, rgba(0, 0, 0, .06))}.case-chat__tool-call-section[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{margin:.25rem 0 0;white-space:pre-wrap;word-break:break-all;font-family:var(--font-mono, ui-monospace, "SF Mono", monospace);font-size:.75rem;color:var(--color-text, #1d1d1f);max-height:200px;overflow-y:auto}.case-chat__tool-call-label[_ngcontent-%COMP%]{display:block;font-size:.65rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--color-text-secondary, #6e6e73)}.case-chat__enrichment-section[_ngcontent-%COMP%]{background:var(--color-surface-secondary, rgba(0, 0, 0, .02))}.case-chat__enrichment-phase[_ngcontent-%COMP%]{margin-top:.35rem;border-radius:4px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .6));overflow:hidden}.case-chat__enrichment-phase--failed[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30);background:#ff3b300a}.case-chat__enrichment-phase-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:.2rem .5rem;background:var(--color-surface-secondary, rgba(0, 0, 0, .03));border-bottom:1px solid var(--color-border, rgba(0, 0, 0, .06))}.case-chat__enrichment-phase-index[_ngcontent-%COMP%]{font-weight:600;font-size:.7rem;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-secondary, #6e6e73)}.case-chat__enrichment-phase-status[_ngcontent-%COMP%]{font-size:.7rem}.case-chat__enrichment-phase-row[_ngcontent-%COMP%]{padding:.25rem .5rem}.case-chat__enrichment-phase-row[_ngcontent-%COMP%] + .case-chat__enrichment-phase-row[_ngcontent-%COMP%]{border-top:1px solid var(--color-border, rgba(0, 0, 0, .04))}.case-chat__enrichment-phase-row[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{margin:.15rem 0 0;white-space:pre-wrap;word-break:break-all;font-family:var(--font-mono, ui-monospace, "SF Mono", monospace);font-size:.7rem;color:var(--color-text, #1d1d1f);max-height:150px;overflow-y:auto}.case-chat__enrichment-phase-label[_ngcontent-%COMP%]{display:block;font-size:.6rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--color-text-secondary, #6e6e73)}.case-chat__tool-call-pending[_ngcontent-%COMP%], .case-chat__tool-call-empty[_ngcontent-%COMP%]{display:block;margin-top:.25rem;color:var(--color-text-secondary, #6e6e73);font-style:italic;font-size:.75rem}.case-chat__technical[_ngcontent-%COMP%]{flex-shrink:0;border-radius:6px;background:var(--color-surface-secondary, rgba(0, 0, 0, .03));border-left:3px solid var(--color-border, rgba(0, 0, 0, .12));font-size:.78rem;color:var(--color-text-secondary, #6e6e73);overflow:hidden}.case-chat__technical--warn[_ngcontent-%COMP%]{border-left-color:var(--color-warning, #f5a623);background:#f5a6230f;color:var(--color-text, #1d1d1f)}.case-chat__technical--error[_ngcontent-%COMP%]{border-left-color:var(--color-error, #ff3b30);background:#ff3b300f;color:var(--color-text, #1d1d1f)}.case-chat__technical-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;width:100%;padding:.2rem .75rem;background:transparent;border:none;cursor:pointer;text-align:left;color:inherit;font-family:inherit;font-size:inherit}.case-chat__technical-header[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04))}.case-chat__technical-label[_ngcontent-%COMP%]{font-weight:500;white-space:nowrap}.case-chat__technical-label[_ngcontent-%COMP%]:only-child{display:block;padding:.2rem .75rem}.case-chat__technical-chevron[_ngcontent-%COMP%]{flex-shrink:0;font-size:.6rem;color:var(--color-text-secondary, #6e6e73);margin-left:auto}.case-chat__technical-body[_ngcontent-%COMP%]{padding:.3rem .75rem .5rem;border-top:1px solid var(--color-border, rgba(0, 0, 0, .08));white-space:pre-wrap;word-break:break-word;font-size:.75rem;line-height:1.5;color:var(--color-text, #1d1d1f)}.case-chat__session-context[_ngcontent-%COMP%]{flex-shrink:0;border-radius:6px;background:var(--color-surface-secondary, rgba(0, 0, 0, .03));border-left:3px solid var(--color-primary, #0071e3);padding:.25rem .75rem .4rem;margin-bottom:.25rem;font-size:.75rem;color:var(--color-text-secondary, #6e6e73);overflow:hidden}.case-chat__session-context-label[_ngcontent-%COMP%]{display:block;font-size:.65rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--color-primary, #0071e3);margin-bottom:.2rem}.case-chat__session-context-body[_ngcontent-%COMP%]{margin:0;white-space:pre-wrap;word-break:break-all;font-family:var(--font-mono, ui-monospace, "SF Mono", monospace);font-size:.75rem;color:var(--color-text, #1d1d1f);max-height:160px;overflow-y:auto}.case-chat__message[_ngcontent-%COMP%]{flex-shrink:0}.case-chat__thinking[_ngcontent-%COMP%]{flex-shrink:0;display:flex;gap:.3rem;padding:.75rem 1rem;align-self:flex-start}.case-chat__message-text--markdown[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0 0 .5em}.case-chat__message-text--markdown[_ngcontent-%COMP%] p[_ngcontent-%COMP%]:last-child{margin-bottom:0}.case-chat__message-text--markdown[_ngcontent-%COMP%] ul[_ngcontent-%COMP%], .case-chat__message-text--markdown[_ngcontent-%COMP%] ol[_ngcontent-%COMP%]{margin:.25em 0 .5em;padding-left:1.4em}.case-chat__message-text--markdown[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{margin-bottom:.2em}.case-chat__message-text--markdown[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:var(--font-mono, ui-monospace, "SF Mono", monospace);font-size:.85em;background:var(--color-code-bg, rgba(0, 0, 0, .06));border-radius:3px;padding:.1em .35em}.case-chat__message-text--markdown[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{background:var(--color-code-bg, rgba(0, 0, 0, .06));border-radius:6px;padding:.6em .8em;overflow-x:auto;margin:.4em 0}.case-chat__message-text--markdown[_ngcontent-%COMP%] pre[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:none;padding:0;font-size:.8rem}.case-chat__message-text--markdown[_ngcontent-%COMP%] blockquote[_ngcontent-%COMP%]{margin:.4em 0;padding-left:.8em;border-left:3px solid var(--color-border, rgba(0, 0, 0, .15));color:var(--color-text-secondary, #6e6e73)}.case-chat__message-text--markdown[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--color-primary, #0071e3);text-decoration:underline}.case-chat__message-text--markdown[_ngcontent-%COMP%] h1[_ngcontent-%COMP%], .case-chat__message-text--markdown[_ngcontent-%COMP%] h2[_ngcontent-%COMP%], .case-chat__message-text--markdown[_ngcontent-%COMP%] h3[_ngcontent-%COMP%], .case-chat__message-text--markdown[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:.5em 0 .25em;font-size:1em;font-weight:600}.case-chat__message-text--markdown[_ngcontent-%COMP%] .external-link-icon[_ngcontent-%COMP%]{font-size:.75em;margin-left:.15em;vertical-align:super}.case-chat__message--streaming[_ngcontent-%COMP%]{opacity:.95}.case-chat__scroll-anchor[_ngcontent-%COMP%]{position:absolute;bottom:calc(2rem + 80px);left:50%;transform:translate(-50%);z-index:10;background:var(--glass-bg, rgba(255, 255, 255, .88));border:1px solid var(--glass-border, rgba(255, 255, 255, .3));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border-radius:50%;box-shadow:0 2px 12px var(--color-shadow, rgba(0, 0, 0, .12));animation:_ngcontent-%COMP%_scroll-anchor-in .15s ease}.case-chat__composer[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:flex-end;gap:.5rem;background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));backdrop-filter:var(--glass-backdrop-blur, blur(20px));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));border-radius:16px;padding:.5rem .5rem .5rem 1rem}.case-chat__input[_ngcontent-%COMP%]{flex:1;resize:none;padding:.5rem 0;border:none;background:transparent;color:var(--color-text, #1d1d1f);font-size:.95rem;font-family:inherit;line-height:1.5;outline:none;min-height:40px}.case-chat__input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.case-chat__input[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.case-chat__actions[_ngcontent-%COMP%]{display:flex;align-items:center;flex-shrink:0}.thinking-dot[_ngcontent-%COMP%]{width:8px;height:8px;border-radius:50%;background:var(--color-text-secondary, #6e6e73);animation:_ngcontent-%COMP%_thinking-bounce 1.2s ease-in-out infinite}.thinking-dot[_ngcontent-%COMP%]:nth-child(2){animation-delay:.2s}.thinking-dot[_ngcontent-%COMP%]:nth-child(3){animation-delay:.4s}@keyframes _ngcontent-%COMP%_thinking-bounce{0%,80%,to{transform:translateY(0);opacity:.4}40%{transform:translateY(-6px);opacity:1}}@keyframes _ngcontent-%COMP%_scroll-anchor-in{0%{opacity:0;transform:translate(-50%) translateY(8px)}to{opacity:1;transform:translate(-50%) translateY(0)}}']})};export{ae as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Z as r,aa as a,ca as m,ta as s}from"./chunk-B4RKRLIY.js";var d=["light","dark","system"],i="agentos.theme",n=class o{_theme=s(this.readStoredTheme());theme=this._theme.asReadonly();media=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;onSystemChange=()=>{this._theme()==="system"&&this.applyTheme("system")};constructor(){this.applyTheme(this._theme()),this.media?.addEventListener("change",this.onSystemChange)}ngOnDestroy(){this.media?.removeEventListener("change",this.onSystemChange)}setTheme(e){this._theme.set(e);try{localStorage.setItem(i,e)}catch(t){}this.applyTheme(e)}applyTheme(e){let t=e==="system"?this.resolveSystem():e;typeof document>"u"||!document.documentElement||(t==="dark"?document.documentElement.setAttribute("data-theme","dark"):document.documentElement.removeAttribute("data-theme"))}resolveSystem(){return this.media?.matches?"dark":"light"}readStoredTheme(){try{let e=localStorage.getItem(i);if(e&&d.includes(e))return e}catch(e){}return"system"}static \u0275fac=function(t){return new(t||o)};static \u0275prov=r({token:o,factory:o.\u0275fac,providedIn:"root"})},T=new a("agentos.theme-port",{providedIn:"root",factory:()=>m(n)});export{d as a,n as b,T as c};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{c as _e,d as
|
|
1
|
+
import{c as _e,d as D,e as Se,f as we,g as Oe,h as Pe,i as xe,j as ke,k as Ve,l as Ie,m as Ne,n as je,o as We,p as Re,q,r as Ae,s as De,u as Be,v as Fe,w as Le,x as $e,y as Ue,z as He}from"./chunk-YC254XBK.js";import{a as ze}from"./chunk-YNZD2HBV.js";import{a as ge,b as me,e as he,f as ue,g as ve}from"./chunk-6CNI4FAD.js";import{a as B}from"./chunk-ZEMOOOQR.js";import{E as z,c as F,g as L,m as $,p as Ce,q as ye,x as Ee,y as Me,z as Te}from"./chunk-HZF57OLY.js";import{E as A,H as K,J as pe,O as fe,Q as be}from"./chunk-EF2BOSEH.js";import{Ab as I,Db as d,Fb as N,Gc as le,Jb as ne,Ka as l,Kb as ie,Lb as oe,Lc as de,Pb as re,Qb as j,Rb as W,Sb as ae,T as p,Tb as s,V as Q,Vb as M,Wa as S,Wb as se,Xa as V,Xb as g,Yb as m,Z as x,Zb as h,_ as k,aa as Z,ab as te,ca as v,d as y,h as E,hc as ce,i as b,ia as H,ja as X,jb as C,lb as T,mb as w,pb as J,qb as Y,rb as u,sb as a,tb as r,ub as f,vc as R,ya as ee}from"./chunk-B4RKRLIY.js";var Ge=["determinateSpinner"];function Qe(c,e){if(c&1&&(H(),a(0,"svg",11),f(1,"circle",12),r()),c&2){let n=N();C("viewBox",n._viewBox()),l(),j("stroke-dasharray",n._strokeCircumference(),"px")("stroke-dashoffset",n._strokeCircumference()/2,"px")("stroke-width",n._circleStrokeWidth(),"%"),C("r",n._circleRadius())}}var Ze=new Z("mat-progress-spinner-default-options",{providedIn:"root",factory:()=>({diameter:Je})}),Je=100,Xe=10,Ct=(()=>{class c{_elementRef=v(ee);_noopAnimations;get color(){return this._color||this._defaultColor}set color(n){this._color=n}_color;_defaultColor="primary";_determinateCircle;constructor(){let n=v(Ze),t=pe(),i=this._elementRef.nativeElement;this._noopAnimations=t==="di-disabled"&&!!n&&!n._forceAnimations,this.mode=i.nodeName.toLowerCase()==="mat-spinner"?"indeterminate":"determinate",!this._noopAnimations&&t==="reduced-motion"&&i.classList.add("mat-progress-spinner-reduced-motion"),n&&(n.color&&(this.color=this._defaultColor=n.color),n.diameter&&(this.diameter=n.diameter),n.strokeWidth&&(this.strokeWidth=n.strokeWidth))}mode;get value(){return this.mode==="determinate"?this._value:0}set value(n){this._value=Math.max(0,Math.min(100,n||0))}_value=0;get diameter(){return this._diameter}set diameter(n){this._diameter=n||0}_diameter=Je;get strokeWidth(){return this._strokeWidth??this.diameter/10}set strokeWidth(n){this._strokeWidth=n||0}_strokeWidth;_circleRadius(){return(this.diameter-Xe)/2}_viewBox(){let n=this._circleRadius()*2+this.strokeWidth;return`0 0 ${n} ${n}`}_strokeCircumference(){return 2*Math.PI*this._circleRadius()}_strokeDashOffset(){return this.mode==="determinate"?this._strokeCircumference()*(100-this._value)/100:null}_circleStrokeWidth(){return this.strokeWidth/this.diameter*100}static \u0275fac=function(t){return new(t||c)};static \u0275cmp=S({type:c,selectors:[["mat-progress-spinner"],["mat-spinner"]],viewQuery:function(t,i){if(t&1&&ne(Ge,5),t&2){let o;ie(o=oe())&&(i._determinateCircle=o.first)}},hostAttrs:["role","progressbar","tabindex","-1",1,"mat-mdc-progress-spinner","mdc-circular-progress"],hostVars:18,hostBindings:function(t,i){t&2&&(C("aria-valuemin",0)("aria-valuemax",100)("aria-valuenow",i.mode==="determinate"?i.value:null)("mode",i.mode),ae("mat-"+i.color),j("width",i.diameter,"px")("height",i.diameter,"px")("--mat-progress-spinner-size",i.diameter+"px")("--mat-progress-spinner-active-indicator-width",i.diameter+"px"),W("_mat-animation-noopable",i._noopAnimations)("mdc-circular-progress--indeterminate",i.mode==="indeterminate"))},inputs:{color:"color",mode:"mode",value:[2,"value","value",R],diameter:[2,"diameter","diameter",R],strokeWidth:[2,"strokeWidth","strokeWidth",R]},exportAs:["matProgressSpinner"],decls:14,vars:11,consts:[["circle",""],["determinateSpinner",""],["aria-hidden","true",1,"mdc-circular-progress__determinate-container"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__determinate-circle-graphic"],["cx","50%","cy","50%",1,"mdc-circular-progress__determinate-circle"],["aria-hidden","true",1,"mdc-circular-progress__indeterminate-container"],[1,"mdc-circular-progress__spinner-layer"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-left"],[3,"ngTemplateOutlet"],[1,"mdc-circular-progress__gap-patch"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-right"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__indeterminate-circle-graphic"],["cx","50%","cy","50%"]],template:function(t,i){if(t&1&&(te(0,Qe,2,8,"ng-template",null,0,ce),a(2,"div",2,1),H(),a(4,"svg",3),f(5,"circle",4),r()(),X(),a(6,"div",5)(7,"div",6)(8,"div",7),I(9,8),r(),a(10,"div",9),I(11,8),r(),a(12,"div",10),I(13,8),r()()()),t&2){let o=re(1);l(4),C("viewBox",i._viewBox()),l(),j("stroke-dasharray",i._strokeCircumference(),"px")("stroke-dashoffset",i._strokeDashOffset(),"px")("stroke-width",i._circleStrokeWidth(),"%"),C("r",i._circleRadius()),l(4),u("ngTemplateOutlet",o),l(2),u("ngTemplateOutlet",o),l(2),u("ngTemplateOutlet",o)}},dependencies:[le],styles:[`.mat-mdc-progress-spinner{--mat-progress-spinner-animation-multiplier: 1;display:block;overflow:hidden;line-height:0;position:relative;direction:ltr;transition:opacity 250ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-progress-spinner circle{stroke-width:var(--mat-progress-spinner-active-indicator-width, 4px)}.mat-mdc-progress-spinner._mat-animation-noopable,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__determinate-circle{transition:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-circle-graphic,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__spinner-layer,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container{animation:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container circle{stroke-dasharray:0 !important}@media(forced-colors: active){.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic,.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle{stroke:currentColor;stroke:CanvasText}}.mat-progress-spinner-reduced-motion{--mat-progress-spinner-animation-multiplier: 1.25}.mdc-circular-progress__determinate-container,.mdc-circular-progress__indeterminate-circle-graphic,.mdc-circular-progress__indeterminate-container,.mdc-circular-progress__spinner-layer{position:absolute;width:100%;height:100%}.mdc-circular-progress__determinate-container{transform:rotate(-90deg)}.mdc-circular-progress--indeterminate .mdc-circular-progress__determinate-container{opacity:0}.mdc-circular-progress__indeterminate-container{font-size:0;letter-spacing:0;white-space:nowrap;opacity:0}.mdc-circular-progress--indeterminate .mdc-circular-progress__indeterminate-container{opacity:1;animation:mdc-circular-progress-container-rotate calc(1568.2352941176ms*var(--mat-progress-spinner-animation-multiplier)) linear infinite}.mdc-circular-progress__determinate-circle-graphic,.mdc-circular-progress__indeterminate-circle-graphic{fill:rgba(0,0,0,0)}.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:var(--mat-progress-spinner-active-indicator-color, var(--mat-sys-primary))}@media(forced-colors: active){.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:CanvasText}}.mdc-circular-progress__determinate-circle{transition:stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1)}.mdc-circular-progress__gap-patch{position:absolute;top:0;left:47.5%;box-sizing:border-box;width:5%;height:100%;overflow:hidden}.mdc-circular-progress__gap-patch .mdc-circular-progress__indeterminate-circle-graphic{left:-900%;width:2000%;transform:rotate(180deg)}.mdc-circular-progress__circle-clipper .mdc-circular-progress__indeterminate-circle-graphic{width:200%}.mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{left:-100%}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-left .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-left-spin calc(1333ms*var(--mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-right-spin calc(1333ms*var(--mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress__circle-clipper{display:inline-flex;position:relative;width:50%;height:100%;overflow:hidden}.mdc-circular-progress--indeterminate .mdc-circular-progress__spinner-layer{animation:mdc-circular-progress-spinner-layer-rotate calc(5332ms*var(--mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both}@keyframes mdc-circular-progress-container-rotate{to{transform:rotate(360deg)}}@keyframes mdc-circular-progress-spinner-layer-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes mdc-circular-progress-left-spin{from{transform:rotate(265deg)}50%{transform:rotate(130deg)}to{transform:rotate(265deg)}}@keyframes mdc-circular-progress-right-spin{from{transform:rotate(-265deg)}50%{transform:rotate(-130deg)}to{transform:rotate(-265deg)}}
|
|
2
2
|
`],encapsulation:2,changeDetection:0})}return c})();var yt=(()=>{class c{static \u0275fac=function(t){return new(t||c)};static \u0275mod=V({type:c});static \u0275inj=k({imports:[A]})}return c})();var wt=(()=>{class c{get vertical(){return this._vertical}set vertical(n){this._vertical=K(n)}_vertical=!1;get inset(){return this._inset}set inset(n){this._inset=K(n)}_inset=!1;static \u0275fac=function(t){return new(t||c)};static \u0275cmp=S({type:c,selectors:[["mat-divider"]],hostAttrs:["role","separator",1,"mat-divider"],hostVars:7,hostBindings:function(t,i){t&2&&(C("aria-orientation",i.vertical?"vertical":"horizontal"),W("mat-divider-vertical",i.vertical)("mat-divider-horizontal",!i.vertical)("mat-divider-inset",i.inset))},inputs:{vertical:"vertical",inset:"inset"},decls:0,vars:0,template:function(t,i){},styles:[`.mat-divider{display:block;margin:0;border-top-style:solid;border-top-color:var(--mat-divider-color, var(--mat-sys-outline-variant));border-top-width:var(--mat-divider-width, 1px)}.mat-divider.mat-divider-vertical{border-top:0;border-right-style:solid;border-right-color:var(--mat-divider-color, var(--mat-sys-outline-variant));border-right-width:var(--mat-divider-width, 1px)}.mat-divider.mat-divider-inset{margin-left:80px}[dir=rtl] .mat-divider.mat-divider-inset{margin-left:auto;margin-right:80px}
|
|
3
|
-
`],encapsulation:2,changeDetection:0})}return c})(),Ot=(()=>{class c{static \u0275fac=function(t){return new(t||c)};static \u0275mod=V({type:c});static \u0275inj=k({imports:[A]})}return c})();var U=class c{destroy$=new E;voices;currentUtterance=null;currentOnEndCallback=null;speakingSubject=new b(!1);speaking$=this.speakingSubject.asObservable();volume=.8;rate=1.2;language="en-US";selectedVoice;preferencesService=v(
|
|
3
|
+
`],encapsulation:2,changeDetection:0})}return c})(),Ot=(()=>{class c{static \u0275fac=function(t){return new(t||c)};static \u0275mod=V({type:c});static \u0275inj=k({imports:[A]})}return c})();var U=class c{destroy$=new E;voices;currentUtterance=null;currentOnEndCallback=null;speakingSubject=new b(!1);speaking$=this.speakingSubject.asObservable();volume=.8;rate=1.2;language="en-US";selectedVoice;preferencesService=v(D);constructor(){this.initializeSpeechSynthesis(),this.subscribeToPreferences()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),this.stopSpeech()}initializeSpeechSynthesis(){if(!("speechSynthesis"in window)){console.warn("[VOICE-SERVICE] Speech synthesis not available"),this.voices=new Promise(e=>e([]));return}this.voices=new Promise((e,n)=>{let t=speechSynthesis.getVoices();if(t.length)e(t);else{let i=setTimeout(()=>{n("no voices found")},2e3);speechSynthesis.addEventListener("voiceschanged",()=>{let o=speechSynthesis.getVoices();o.length&&(clearTimeout(i),e(o))})}}),console.log("[VOICE-SERVICE] Speech synthesis initialized")}subscribeToPreferences(){this.preferencesService.voiceVolume$.pipe(p(this.destroy$)).subscribe(e=>{this.volume=e,console.log("[VOICE-SERVICE] Volume updated to:",e)}),this.preferencesService.voiceRate$.pipe(p(this.destroy$)).subscribe(e=>{this.rate=e,console.log("[VOICE-SERVICE] Rate updated to:",e)}),this.preferencesService.voiceLanguage$.pipe(p(this.destroy$)).subscribe(e=>{this.language=e,console.log("[VOICE-SERVICE] Language updated to:",e),this.updateSelectedVoiceForLanguage()}),this.preferencesService.selectedVoice$.pipe(p(this.destroy$)).subscribe(e=>{this.setSelectedVoice(e)}),this.volume=this.preferencesService.getVoiceVolume(),this.rate=this.preferencesService.getVoiceRate(),this.language=this.preferencesService.getVoiceLanguage(),this.setSelectedVoice(this.preferencesService.getSelectedVoice())}isReady(){return"speechSynthesis"in window&&this.selectedVoice!==void 0}isSpeaking(){return speechSynthesis.speaking}speak(e,n){return y(this,null,function*(){if(!this.selectedVoice)return console.warn("[VOICE-SERVICE] No voice selected"),!1;if(!e.trim())return console.warn("[VOICE-SERVICE] No text to speak"),!1;let t=this.extractPlainText(e);if(!t.trim())return console.warn("[VOICE-SERVICE] No text to speak after markdown cleaning"),!1;this.stopSpeech();try{let i=new SpeechSynthesisUtterance(t);i.voice=this.selectedVoice,i.lang=this.selectedVoice.lang,i.volume=this.volume,i.rate=this.rate,this.currentOnEndCallback=n||null,n&&(i.onend=()=>{this.currentOnEndCallback===n&&(this.currentOnEndCallback=null,n())},i.onerror=()=>{this.currentOnEndCallback===n&&(this.currentOnEndCallback=null,n())}),this.currentUtterance=i,this.speakingSubject.next(!0);let o=i.onend,_=i.onerror;return i.onend=O=>{this.speakingSubject.next(!1),o&&o.call(i,O)},i.onerror=O=>{this.speakingSubject.next(!1),_&&_.call(i,O)},speechSynthesis.speak(i),console.log("[VOICE-SERVICE] Started speaking:",e.substring(0,50)+"..."),!0}catch(i){return console.error("[VOICE-SERVICE] Error speaking:",i),!1}})}stopSpeech(){if(this.currentUtterance||speechSynthesis.speaking){if(speechSynthesis.cancel(),this.currentUtterance=null,this.currentOnEndCallback){let e=this.currentOnEndCallback;this.currentOnEndCallback=null,e()}this.speakingSubject.next(!1),console.log("[VOICE-SERVICE] Speech stopped")}}ding(){try{let e=new(window.AudioContext||window.webkitAudioContext),n=e.createOscillator(),t=e.createGain();n.connect(t),t.connect(e.destination),n.frequency.setValueAtTime(800,e.currentTime),t.gain.setValueAtTime(.1,e.currentTime),t.gain.exponentialRampToValueAtTime(.01,e.currentTime+.1),n.start(e.currentTime),n.stop(e.currentTime+.1),console.log("[VOICE-SERVICE] Notification sound played")}catch(e){console.error("[VOICE-SERVICE] Notification sound failed:",e)}}getVoicesForLanguage(){return y(this,null,function*(){try{let e=this.language.slice(0,2),n=yield this.voices;if(!n||n.length===0)return console.warn("[VOICE-SERVICE] No voices available on system"),[];let t=n.filter(i=>i.lang.toLowerCase().startsWith(e)).sort((i,o)=>i.localService&&!o.localService?-1:!i.localService&&o.localService?1:i.name.localeCompare(o.name));return console.log("[VOICE-SERVICE] Found matching voices:",t.length,"for language:",e),t.map(i=>({name:i.name,lang:i.lang,localService:i.localService,default:i.default,displayName:this.formatVoiceDisplayName(i)}))}catch(e){return console.error("[VOICE-SERVICE] Error getting voices for language:",e),[]}})}formatVoiceDisplayName(e){let n=e.localService?"\u{1F3E0}":"\u2601\uFE0F",t=e.default?" \u2B50":"";return`${n} ${e.name} (${e.lang})${t}`}setSelectedVoice(e){return y(this,null,function*(){if(!e){this.selectedVoice=void 0;return}let[n,t]=e.split("|");if(!n||!t){this.selectedVoice=void 0;return}let i=(yield this.voices)?.find(o=>o.name===n&&o.lang===t);i?(this.selectedVoice=i,console.log("[VOICE-SERVICE] Selected voice:",i.name,i.lang)):(this.selectedVoice=void 0,console.warn("[VOICE-SERVICE] Voice not found:",n,t))})}updateSelectedVoiceForLanguage(){return y(this,null,function*(){let e=yield this.getVoicesForLanguage();if(e.length===0){console.warn("[VOICE-SERVICE] No voices available for language:",this.language),this.selectedVoice=void 0,this.preferencesService.setSelectedVoice(null);return}let n=this.preferencesService.getSelectedVoice();if(n){let[i,o]=n.split("|"),_=o?.slice(0,2),O=this.language.slice(0,2);if(_===O&&e.some(G=>G.name===i&&G.lang===o)){console.log("[VOICE-SERVICE] Keeping current voice for language:",n);return}}let t=e[0];if(t){let i=`${t.name}|${t.lang}`;this.preferencesService.setSelectedVoice(i),console.log("[VOICE-SERVICE] Auto-selected voice for language change:",t.displayName)}})}testSelectedVoice(){setTimeout(()=>{if(!this.selectedVoice){console.log("[VOICE-SERVICE] No voice selected for test");return}this.stopSpeech();let e=this.getTestText();e&&this.speak(e)},100)}getTestText(){let e=this.language.slice(0,2),n={fr:"Bonjour, ceci est un test de la voix s\xE9lectionn\xE9e.",en:"Hello, this is a test of the selected voice.",es:"Hola, esta es una prueba de la voz seleccionada.",de:"Hallo, dies ist ein Test der ausgew\xE4hlten Stimme.",it:"Ciao, questo \xE8 un test della voce selezionata.",pt:"Ol\xE1, este \xE9 um teste da voz selecionada.",ja:"\u3053\u3093\u306B\u3061\u306F\u3001\u3053\u308C\u306F\u9078\u629E\u3055\u308C\u305F\u97F3\u58F0\u306E\u30C6\u30B9\u30C8\u3067\u3059\u3002",ko:"\uC548\uB155\uD558\uC138\uC694, \uC774\uAC83\uC740 \uC120\uD0DD\uB41C \uC74C\uC131\uC758 \uD14C\uC2A4\uD2B8\uC785\uB2C8\uB2E4.",zh:"\u4F60\u597D\uFF0C\u8FD9\u662F\u6240\u9009\u8BED\u97F3\u7684\u6D4B\u8BD5\u3002",ru:"\u041F\u0440\u0438\u0432\u0435\u0442, \u044D\u0442\u043E \u0442\u0435\u0441\u0442 \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0433\u043E\u043B\u043E\u0441\u0430.",ar:"\u0645\u0631\u062D\u0628\u0627\u060C \u0647\u0630\u0627 \u0627\u062E\u062A\u0628\u0627\u0631 \u0644\u0644\u0635\u0648\u062A \u0627\u0644\u0645\u062D\u062F\u062F."};return n[e]||n.en||"Hello, this is a test."}extractPlainText(e){let n=e.replace(/[\u{1F600}-\u{1F64F}]|[\u{1F300}-\u{1F5FF}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|⭐/gu,"").replace(/```[\s\S]*?```/g,"code block").replace(/`([^`]+)`/g,"$1").replace(/\*\*\*(.*?)\*\*\*/g,"$1").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/~~(.*?)~~/g,"$1").replace(/#{1,6}\s*(.*)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/https?:\/\/[^\s]+/g,"link").replace(/ /g," ").replace(/&/g,"and").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"');return n=this.addNaturalPunctuation(n),n.replace(/\s+/g," ").trim()}addNaturalPunctuation(e){return e.replace(/\n+/g,`
|
|
4
4
|
`).split(`
|
|
5
|
-
`).map(n=>this.addPeriodIfNeeded(n.trim())).filter(n=>n.length>0).join(" ")}addPeriodIfNeeded(e){return e?/[.!?;:]$/.test(e)?e:e+".":""}static \u0275fac=function(n){return new(n||c)};static \u0275prov=x({token:c,factory:c.\u0275fac,providedIn:"root"})};var nt=(c,e)=>e.code,it=(c,e)=>e.name+e.lang;function ot(c,e){c&1&&(a(0,"div",17)(1,"mat-icon",39),s(2,"warning"),r(),a(3,"span",40),s(4," Browser notifications have been blocked. To enable them, please reset the site permissions in your browser settings. "),r()())}function rt(c,e){if(c&1&&(a(0,"option",25),s(1),r()),c&2){let n=e.$implicit;u("value",n.code),l(),se("",n.flag," ",n.label)}}function at(c,e){c&1&&(a(0,"option",32),s(1,"Loading voices..."),r())}function st(c,e){c&1&&(a(0,"option",32),s(1,"No voice available"),r())}function ct(c,e){if(c&1&&(a(0,"option",25),s(1),r()),c&2){let n=e.$implicit;u("value",n.name+"|"+n.lang),l(),M(" ",n.displayName," ")}}var Ye=class c{destroy$=new E;selectedTheme="light";selectedVoiceLanguage="en-US";useEnterToSend=!1;printTechnicalMessages=!1;showTechnicalMessages=!0;showWarningMessages=!0;voiceInputMode="browser";voiceAnnounceEnabled=!1;voiceMode="speech";voiceReadFullText=!1;voiceVolume=80;voiceRate=120;agentNotificationEnabled=!1;notificationSoundEnabled=!0;browserNotificationEnabled=!1;browserNotificationDenied=!1;missionPreviewEnabled=!1;availableVoices=[];selectedVoiceId=null;loadingVoices=!1;voiceLanguageOptions=[{code:"fr-FR",label:"Fran\xE7ais",flag:"\u{1F1EB}\u{1F1F7}"},{code:"en-US",label:"English (US)",flag:"\u{1F1FA}\u{1F1F8}"},{code:"en-GB",label:"English (UK)",flag:"\u{1F1EC}\u{1F1E7}"},{code:"es-ES",label:"Espa\xF1ol",flag:"\u{1F1EA}\u{1F1F8}"},{code:"de-DE",label:"Deutsch",flag:"\u{1F1E9}\u{1F1EA}"},{code:"it-IT",label:"Italiano",flag:"\u{1F1EE}\u{1F1F9}"},{code:"pt-BR",label:"Portugu\xEAs",flag:"\u{1F1E7}\u{1F1F7}"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",flag:"\u{1F1EF}\u{1F1F5}"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",flag:"\u{1F1F0}\u{1F1F7}"},{code:"zh-CN",label:"\u4E2D\u6587 (\u7B80\u4F53)",flag:"\u{1F1E8}\u{1F1F3}"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",flag:"\u{1F1F7}\u{1F1FA}"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",flag:"\u{1F1F8}\u{1F1E6}"}];preferencesService=v(z);voiceSynthesisService=v(U);themeService=v(ze);ngOnInit(){this.selectedTheme=this.themeService.getCurrentTheme(),this.selectedVoiceLanguage=this.preferencesService.getVoiceLanguage(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.printTechnicalMessages=this.preferencesService.getPrintTechnicalMessages(),this.showTechnicalMessages=!this.preferencesService.getHideTechnicalMessages(),this.showWarningMessages=!this.preferencesService.getHideWarningMessages(),this.voiceInputMode=this.preferencesService.getVoiceInputMode(),this.voiceAnnounceEnabled=this.preferencesService.getVoiceAnnounceEnabled(),this.voiceMode=this.preferencesService.getVoiceMode(),this.voiceReadFullText=this.preferencesService.getVoiceReadFullText(),this.voiceVolume=Math.round(this.preferencesService.getVoiceVolume()*100),this.voiceRate=Math.round(this.preferencesService.getVoiceRate()*100),this.selectedVoiceId=this.preferencesService.getSelectedVoice(),this.agentNotificationEnabled=this.preferencesService.getAgentNotificationEnabled(),this.notificationSoundEnabled=this.preferencesService.getNotificationSoundEnabled(),this.browserNotificationEnabled=this.preferencesService.getBrowserNotificationEnabled(),this.missionPreviewEnabled=this.preferencesService.getMissionPreviewEnabled(),this.loadAvailableVoices(),this.themeService.currentTheme$.pipe(p(this.destroy$)).subscribe(e=>{this.selectedTheme=e}),this.preferencesService.voiceLanguage$.pipe(p(this.destroy$)).subscribe(e=>{this.selectedVoiceLanguage=e}),this.preferencesService.enterToSend$.pipe(p(this.destroy$)).subscribe(e=>{this.useEnterToSend=e}),this.preferencesService.printTechnicalMessages$.pipe(p(this.destroy$)).subscribe(e=>{this.printTechnicalMessages=e}),this.preferencesService.hideTechnicalMessages$.pipe(p(this.destroy$)).subscribe(e=>{this.showTechnicalMessages=!e}),this.preferencesService.hideWarningMessages$.pipe(p(this.destroy$)).subscribe(e=>{this.showWarningMessages=!e}),this.preferencesService.voiceInputMode$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceInputMode=e}),this.preferencesService.voiceAnnounceEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceAnnounceEnabled=e}),this.preferencesService.voiceMode$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceMode=e}),this.preferencesService.voiceReadFullText$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceReadFullText=e}),this.preferencesService.voiceVolume$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceVolume=Math.round(e*100)}),this.preferencesService.voiceRate$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceRate=Math.round(e*100)}),this.preferencesService.selectedVoice$.pipe(p(this.destroy$)).subscribe(e=>{this.selectedVoiceId=e}),this.preferencesService.voiceLanguage$.pipe(p(this.destroy$)).subscribe(()=>{this.loadAvailableVoices()}),this.preferencesService.agentNotificationEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.agentNotificationEnabled=e}),this.preferencesService.notificationSoundEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.notificationSoundEnabled=e}),this.preferencesService.browserNotificationEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.browserNotificationEnabled=e,this.checkNotificationPermission()}),this.preferencesService.missionPreviewEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.missionPreviewEnabled=e})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}onThemeChange(){console.log("[OPTIONS] Theme changed to:",this.selectedTheme),this.themeService.setTheme(this.selectedTheme)}onVoiceLanguageChange(){console.log("[OPTIONS] Voice language changed to:",this.selectedVoiceLanguage),this.preferencesService.setVoiceLanguage(this.selectedVoiceLanguage)}onEnterToSendChange(){console.log("[OPTIONS] Enter to send changed to:",this.useEnterToSend),this.preferencesService.setEnterToSend(this.useEnterToSend)}onPrintTechnicalMessagesChange(){console.log("[OPTIONS] Print technical messages changed to:",this.printTechnicalMessages),this.preferencesService.setPrintTechnicalMessages(this.printTechnicalMessages)}onShowTechnicalMessagesChange(){let e=!this.showTechnicalMessages;console.log("[OPTIONS] Show technical messages changed to:",this.showTechnicalMessages,"(hide:",e,")"),this.preferencesService.setHideTechnicalMessages(e)}onShowWarningMessagesChange(){let e=!this.showWarningMessages;console.log("[OPTIONS] Show warning messages changed to:",this.showWarningMessages,"(hide:",e,")"),this.preferencesService.setHideWarningMessages(e)}onVoiceInputModeChange(e){let n=e.target.value;console.log("[OPTIONS] Voice input mode changed to:",n),this.preferencesService.setVoiceInputMode(n)}onVoiceAnnounceEnabledChange(){console.log("[OPTIONS] Voice announce enabled changed to:",this.voiceAnnounceEnabled),this.preferencesService.setVoiceAnnounceEnabled(this.voiceAnnounceEnabled)}onVoiceModeChange(){console.log("[OPTIONS] Voice mode changed to:",this.voiceMode),this.preferencesService.setVoiceMode(this.voiceMode)}onVoiceReadFullTextChange(){console.log("[OPTIONS] Voice read full text changed to:",this.voiceReadFullText),this.preferencesService.setVoiceReadFullText(this.voiceReadFullText)}onVoiceVolumeChange(){let e=this.voiceVolume/100;console.log("[OPTIONS] Voice volume changed to:",e),this.preferencesService.setVoiceVolume(e)}onVoiceRateChange(){let e=this.voiceRate/100;console.log("[OPTIONS] Voice rate changed to:",e),this.preferencesService.setVoiceRate(e)}loadAvailableVoices(){return y(this,null,function*(){this.loadingVoices=!0;try{this.availableVoices=yield this.voiceSynthesisService.getVoicesForLanguage(),console.log("[OPTIONS] Loaded",this.availableVoices.length,"voices for current language")}catch(e){console.error("[OPTIONS] Error loading voices:",e),this.availableVoices=[]}finally{this.loadingVoices=!1}})}onSelectedVoiceChange(){console.log("[OPTIONS] Selected voice changed to:",this.selectedVoiceId),this.preferencesService.setSelectedVoice(this.selectedVoiceId)}testVoice(){console.log("[OPTIONS] Testing voice with current settings"),this.voiceSynthesisService.testSelectedVoice()}onAgentNotificationEnabledChange(){console.log("[OPTIONS] Agent notification enabled changed to:",this.agentNotificationEnabled),this.preferencesService.setAgentNotificationEnabled(this.agentNotificationEnabled)}onNotificationSoundEnabledChange(){console.log("[OPTIONS] Notification sound enabled changed to:",this.notificationSoundEnabled),this.preferencesService.setNotificationSoundEnabled(this.notificationSoundEnabled)}onBrowserNotificationEnabledChange(){console.log("[OPTIONS] Browser notification enabled changed to:",this.browserNotificationEnabled),this.preferencesService.setBrowserNotificationEnabled(this.browserNotificationEnabled)}onMissionPreviewEnabledChange(){console.log("[OPTIONS] Mission preview panel enabled changed to:",this.missionPreviewEnabled),this.preferencesService.setMissionPreviewEnabled(this.missionPreviewEnabled)}checkNotificationPermission(){"Notification"in window&&(this.browserNotificationDenied=Notification.permission==="denied",console.log("[OPTIONS] Notification permission status:",Notification.permission))}static \u0275fac=function(n){return new(n||c)};static \u0275cmp=S({type:c,selectors:[["app-options-panel"]],decls:168,vars:37,consts:[[1,"options-content"],[1,"option-section"],[1,"section-title"],[1,"option-group"],[1,"radio-group"],[1,"option-radio"],["type","radio","name","theme","value","light",3,"ngModelChange","change","ngModel"],[1,"radio-mark"],["type","radio","name","theme","value","dark",3,"ngModelChange","change","ngModel"],["type","radio","name","theme","value","system",3,"ngModelChange","change","ngModel"],[1,"option-label"],["type","radio","name","enterBehavior",3,"ngModelChange","change","value","ngModel"],[1,"toggle-option"],["color","primary",3,"ngModelChange","change","ngModel"],[1,"option-label-with-hint"],[1,"option-hint"],["color","primary",3,"ngModelChange","change","ngModel","disabled"],[1,"notification-error"],["for","voice-input-mode-select",1,"option-label"],["id","voice-input-mode-select",1,"option-select",3,"change","value"],["value","browser"],["value","whisper"],["value","voice-message"],["for","voice-language-select",1,"option-label"],["id","voice-language-select",1,"option-select",3,"ngModelChange","change","ngModel"],[3,"value"],["type","radio","name","voiceAnnounce",3,"ngModelChange","change","value","ngModel"],["type","radio","name","voiceMode","value","speech",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceMode","value","notification",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceReadFull",3,"ngModelChange","change","value","ngModel"],["for","voice-select",1,"option-label"],["id","voice-select",1,"option-select",3,"ngModelChange","change","ngModel","disabled"],["value",""],["role","button","tabindex","0","title","Test voice with current settings",1,"test-voice-link",3,"click"],[1,"thread-name"],["for","voice-volume-slider",1,"option-label"],["id","voice-volume-slider","type","range","min","0","max","100","step","5",1,"option-slider",3,"ngModelChange","input","ngModel"],["for","voice-rate-slider",1,"option-label"],["id","voice-rate-slider","type","range","min","50","max","200","step","10",1,"option-slider",3,"ngModelChange","input","ngModel"],[1,"error-icon"],[1,"error-message"]],template:function(n,t){n&1&&(a(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-icon"),s(4,"palette"),r(),a(5,"span"),s(6,"Appearance"),r()(),a(7,"div",3)(8,"div",4)(9,"label",5)(10,"input",6),h("ngModelChange",function(o){return m(t.selectedTheme,o)||(t.selectedTheme=o),o}),d("change",function(){return t.onThemeChange()}),r(),f(11,"span",7),s(12," Light "),r(),a(13,"label",5)(14,"input",8),h("ngModelChange",function(o){return m(t.selectedTheme,o)||(t.selectedTheme=o),o}),d("change",function(){return t.onThemeChange()}),r(),f(15,"span",7),s(16," Dark "),r(),a(17,"label",5)(18,"input",9),h("ngModelChange",function(o){return m(t.selectedTheme,o)||(t.selectedTheme=o),o}),d("change",function(){return t.onThemeChange()}),r(),f(19,"span",7),s(20," System "),r()()()(),a(21,"div",1)(22,"div",2)(23,"mat-icon"),s(24,"chat_bubble_outline"),r(),a(25,"span"),s(26,"Messaging"),r()(),a(27,"div",3)(28,"span",10),s(29,"Send message behavior:"),r(),a(30,"div",4)(31,"label",5)(32,"input",11),h("ngModelChange",function(o){return m(t.useEnterToSend,o)||(t.useEnterToSend=o),o}),d("change",function(){return t.onEnterToSendChange()}),r(),f(33,"span",7),s(34," Enter to send "),r(),a(35,"label",5)(36,"input",11),h("ngModelChange",function(o){return m(t.useEnterToSend,o)||(t.useEnterToSend=o),o}),d("change",function(){return t.onEnterToSendChange()}),r(),f(37,"span",7),s(38," Enter for new line "),r()()(),a(39,"div",3)(40,"div",12)(41,"span",10),s(42,"Show technical messages"),r(),a(43,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.showTechnicalMessages,o)||(t.showTechnicalMessages=o),o}),d("change",function(){return t.onShowTechnicalMessagesChange()}),r()()(),a(44,"div",3)(45,"div",12)(46,"span",10),s(47,"Show warning messages"),r(),a(48,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.showWarningMessages,o)||(t.showWarningMessages=o),o}),d("change",function(){return t.onShowWarningMessagesChange()}),r()()(),a(49,"div",3)(50,"div",12)(51,"span",10),s(52,"Include technical messages in print"),r(),a(53,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.printTechnicalMessages,o)||(t.printTechnicalMessages=o),o}),d("change",function(){return t.onPrintTechnicalMessagesChange()}),r()()()(),a(54,"div",1)(55,"div",2)(56,"mat-icon"),s(57,"rocket_launch"),r(),a(58,"span"),s(59,"Mission Control"),r()(),a(60,"div",3)(61,"div",12)(62,"div",14)(63,"span",10),s(64,"Side-by-side thread preview"),r(),a(65,"span",15),s(66,"Click a mission card to open a preview panel. Recommended for large screens."),r()(),a(67,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.missionPreviewEnabled,o)||(t.missionPreviewEnabled=o),o}),d("change",function(){return t.onMissionPreviewEnabledChange()}),r()()()(),a(68,"div",1)(69,"div",2)(70,"mat-icon"),s(71,"notifications"),r(),a(72,"span"),s(73,"Notifications"),r()(),a(74,"div",3)(75,"div",12)(76,"span",10),s(77,"Notify when the agent answers or requests input"),r(),a(78,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.agentNotificationEnabled,o)||(t.agentNotificationEnabled=o),o}),d("change",function(){return t.onAgentNotificationEnabledChange()}),r()()(),a(79,"div",3)(80,"div",12)(81,"span",10),s(82,"Notification sound"),r(),a(83,"mat-slide-toggle",16),h("ngModelChange",function(o){return m(t.notificationSoundEnabled,o)||(t.notificationSoundEnabled=o),o}),d("change",function(){return t.onNotificationSoundEnabledChange()}),r()()(),a(84,"div",3)(85,"div",12)(86,"span",10),s(87,"Browser notification"),r(),a(88,"mat-slide-toggle",16),h("ngModelChange",function(o){return m(t.browserNotificationEnabled,o)||(t.browserNotificationEnabled=o),o}),d("change",function(){return t.onBrowserNotificationEnabledChange()}),r()(),T(89,ot,5,0,"div",17),r()(),a(90,"div",1)(91,"div",2)(92,"mat-icon"),s(93,"record_voice_over"),r(),a(94,"span"),s(95,"Voice & Speech"),r()(),a(96,"div",3)(97,"label",18),s(98,"Voice input method:"),r(),a(99,"select",19),d("change",function(o){return t.onVoiceInputModeChange(o)}),a(100,"option",20),s(101,"Browser (real-time)"),r(),a(102,"option",21),s(103,"Whisper (higher accuracy)"),r(),a(104,"option",22),s(105,"Voice message (send audio)"),r()()(),a(106,"div",3)(107,"label",23),s(108,"Voice recognition language:"),r(),a(109,"select",24),h("ngModelChange",function(o){return m(t.selectedVoiceLanguage,o)||(t.selectedVoiceLanguage=o),o}),d("change",function(){return t.onVoiceLanguageChange()}),J(110,rt,2,3,"option",25,nt),r()(),a(112,"div",3)(113,"span",10),s(114,"Automatic announcement:"),r(),a(115,"div",4)(116,"label",5)(117,"input",26),h("ngModelChange",function(o){return m(t.voiceAnnounceEnabled,o)||(t.voiceAnnounceEnabled=o),o}),d("change",function(){return t.onVoiceAnnounceEnabledChange()}),r(),f(118,"span",7),s(119," Enabled "),r(),a(120,"label",5)(121,"input",26),h("ngModelChange",function(o){return m(t.voiceAnnounceEnabled,o)||(t.voiceAnnounceEnabled=o),o}),d("change",function(){return t.onVoiceAnnounceEnabledChange()}),r(),f(122,"span",7),s(123," Disabled "),r()()(),a(124,"div",3)(125,"span",10),s(126,"Voice mode:"),r(),a(127,"div",4)(128,"label",5)(129,"input",27),h("ngModelChange",function(o){return m(t.voiceMode,o)||(t.voiceMode=o),o}),d("change",function(){return t.onVoiceModeChange()}),r(),f(130,"span",7),s(131," Voice synthesis "),r(),a(132,"label",5)(133,"input",28),h("ngModelChange",function(o){return m(t.voiceMode,o)||(t.voiceMode=o),o}),d("change",function(){return t.onVoiceModeChange()}),r(),f(134,"span",7),s(135," Sound notification "),r()()(),a(136,"div",3)(137,"span",10),s(138,"Message reading:"),r(),a(139,"div",4)(140,"label",5)(141,"input",29),h("ngModelChange",function(o){return m(t.voiceReadFullText,o)||(t.voiceReadFullText=o),o}),d("change",function(){return t.onVoiceReadFullTextChange()}),r(),f(142,"span",7),s(143," Full message "),r(),a(144,"label",5)(145,"input",29),h("ngModelChange",function(o){return m(t.voiceReadFullText,o)||(t.voiceReadFullText=o),o}),d("change",function(){return t.onVoiceReadFullTextChange()}),r(),f(146,"span",7),s(147," First paragraphs only "),r()()(),a(148,"div",3)(149,"label",30),s(150,"Selected voice:"),r(),a(151,"select",31),h("ngModelChange",function(o){return m(t.selectedVoiceId,o)||(t.selectedVoiceId=o),o}),d("change",function(){return t.onSelectedVoiceChange()}),T(152,at,2,0,"option",32),T(153,st,2,0,"option",32),J(154,ct,2,2,"option",25,it),r(),f(156,"div",10),a(157,"a",33),d("click",function(){return t.testVoice()}),a(158,"span",34),s(159,"Test voice"),r()()(),a(160,"div",3)(161,"label",35),s(162),r(),a(163,"input",36),h("ngModelChange",function(o){return m(t.voiceVolume,o)||(t.voiceVolume=o),o}),d("input",function(){return t.onVoiceVolumeChange()}),r()(),a(164,"div",3)(165,"label",37),s(166),r(),a(167,"input",38),h("ngModelChange",function(o){return m(t.voiceRate,o)||(t.voiceRate=o),o}),d("input",function(){return t.onVoiceRateChange()}),r()()()()),n&2&&(l(10),g("ngModel",t.selectedTheme),l(4),g("ngModel",t.selectedTheme),l(4),g("ngModel",t.selectedTheme),l(14),u("value",!0),g("ngModel",t.useEnterToSend),l(4),u("value",!1),g("ngModel",t.useEnterToSend),l(7),g("ngModel",t.showTechnicalMessages),l(5),g("ngModel",t.showWarningMessages),l(5),g("ngModel",t.printTechnicalMessages),l(14),g("ngModel",t.missionPreviewEnabled),l(11),g("ngModel",t.agentNotificationEnabled),l(5),g("ngModel",t.notificationSoundEnabled),u("disabled",!t.agentNotificationEnabled),l(5),g("ngModel",t.browserNotificationEnabled),u("disabled",!t.agentNotificationEnabled||t.browserNotificationDenied),l(),w(t.browserNotificationDenied?89:-1),l(10),u("value",t.voiceInputMode),l(10),g("ngModel",t.selectedVoiceLanguage),l(),Y(t.voiceLanguageOptions),l(7),u("value",!0),g("ngModel",t.voiceAnnounceEnabled),l(4),u("value",!1),g("ngModel",t.voiceAnnounceEnabled),l(8),g("ngModel",t.voiceMode),l(4),g("ngModel",t.voiceMode),l(8),u("value",!0),g("ngModel",t.voiceReadFullText),l(4),u("value",!1),g("ngModel",t.voiceReadFullText),l(6),g("ngModel",t.selectedVoiceId),u("disabled",t.loadingVoices||t.availableVoices.length===0),l(),w(t.loadingVoices?152:-1),l(),w(!t.loadingVoices&&t.availableVoices.length===0?153:-1),l(),Y(t.availableVoices),l(8),M("Volume: ",t.voiceVolume,"%"),l(),g("ngModel",t.voiceVolume),l(3),M("Speed: ",t.voiceRate,"%"),l(),g("ngModel",t.voiceRate))},dependencies:[$,Ee,Me,B,Ce,ye,Se,F,L,D,$e],styles:['.options-content[_ngcontent-%COMP%]{padding:0;width:100%}.option-group[_ngcontent-%COMP%]{padding:0 1rem 1rem;margin-bottom:1rem;border-bottom:1px solid var(--color-border-light)}.option-group[_ngcontent-%COMP%]:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}.option-label[_ngcontent-%COMP%]{display:block;margin-bottom:.5rem;font-weight:500;color:var(--color-text);font-size:.875rem}.toggle-option[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:1rem}.toggle-option[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0;flex:1}.toggle-option[_ngcontent-%COMP%] mat-slide-toggle[_ngcontent-%COMP%]{flex-shrink:0}.option-label-with-hint[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;flex:1}.option-label-with-hint[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0}.option-label-with-hint[_ngcontent-%COMP%] .option-hint[_ngcontent-%COMP%]{font-size:.775rem;color:var(--color-text-secondary);line-height:1.4}.option-select[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-border);border-radius:4px;background:var(--color-input-bg);color:var(--color-text);font-size:.875rem;cursor:pointer}.option-select[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 3px #7064fb1a}.option-select[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.option-select[_ngcontent-%COMP%] option[_ngcontent-%COMP%]{padding:.5rem}.option-checkbox[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{display:none}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]{width:18px;height:18px;border:2px solid var(--color-border);border-radius:3px;margin-right:.75rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]:after{content:"";width:10px;height:6px;border-left:2px solid transparent;border-bottom:2px solid transparent;transform:rotate(-45deg);transition:all .2s ease;opacity:0}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]{background-color:var(--color-primary);border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]:after{border-left-color:#fff;border-bottom-color:#fff;opacity:1}.option-checkbox[_ngcontent-%COMP%]:hover .checkmark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%]:focus-within .checkmark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-section[_ngcontent-%COMP%]{padding-top:1rem;margin-top:1rem;border-top:2px solid var(--color-border)}.option-section[_ngcontent-%COMP%]:first-child{border-top:none;padding-top:0;margin-top:0}.section-title[_ngcontent-%COMP%]{margin:0 0 1rem;padding:0 1rem;font-size:.9rem;font-weight:600;color:var(--color-text);display:flex;align-items:center;gap:.5rem}.section-title[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.radio-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.option-radio[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{display:none}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]{width:16px;height:16px;border:2px solid var(--color-border);border-radius:50%;margin-right:.5rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0;position:relative}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]:after{content:"";width:8px;height:8px;border-radius:50%;background-color:var(--color-primary);transition:all .2s ease;opacity:0;transform:scale(0)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]:after{opacity:1;transform:scale(1)}.option-radio[_ngcontent-%COMP%]:hover .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%]:focus-within .radio-mark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-slider[_ngcontent-%COMP%]{width:100%;height:6px;border-radius:3px;background:var(--color-bg-solid);outline:none;cursor:pointer;-webkit-appearance:none;appearance:none}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-webkit-slider-track{height:6px;border-radius:3px;background:var(--color-bg-secondary)}.option-slider[_ngcontent-%COMP%]::-moz-range-track{height:6px;border-radius:3px;background:var(--color-bg-secondary);border:none}.option-slider[_ngcontent-%COMP%]:focus{outline:none}.option-slider[_ngcontent-%COMP%]:focus::-webkit-slider-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.option-slider[_ngcontent-%COMP%]:focus::-moz-range-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.test-voice-btn[_ngcontent-%COMP%]{width:100%;padding:.75rem 1rem;background:var(--color-primary);color:#fff;border:none;border-radius:6px;font-size:.875rem;font-weight:500;cursor:pointer;transition:all .2s ease;display:flex;align-items:center;justify-content:center;gap:.5rem}.test-voice-btn[_ngcontent-%COMP%]:hover{background:var(--color-primary-hover);transform:translateY(-1px);box-shadow:0 2px 8px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:active{transform:translateY(0);box-shadow:0 1px 4px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:focus{outline:none;box-shadow:0 0 0 3px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:disabled{background:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;transform:none;box-shadow:none}.test-voice-link[_ngcontent-%COMP%]{text-decoration-thickness:1.5px;text-underline-offset:3px;background:transparent;border:none;padding:0;font-size:.775rem;font-weight:400;cursor:pointer;transition:all .2s ease;display:inline-flex;align-items:center;justify-content:center;gap:.5rem;text-decoration:underline}.test-voice-link[_ngcontent-%COMP%]:hover{color:var(--color-primary-hover, var(--color-primary));text-decoration-thickness:2px}.test-voice-link[_ngcontent-%COMP%]:active{opacity:.8}.test-voice-link[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.test-voice-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.notification-error[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem;padding:.75rem;margin-top:.75rem;background-color:#d32f2f1a;border:1px solid rgba(211,47,47,.3);border-radius:6px;font-size:.8125rem;line-height:1.5}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#d32f2f;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{color:var(--color-text);flex:1}.notification-error[_ngcontent-%COMP%]{margin-top:.75rem;padding:.75rem;background-color:#f443361a;border:1px solid rgba(244,67,54,.3);border-radius:6px;display:flex;align-items:flex-start;gap:.5rem}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#f44336;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text);line-height:1.5;flex:1}']})};var Ke=class c{destroy$=new E;currentProject=null;currentThread=null;messagesSubject=new b([]);isThinkingSubject=new b(!1);currentChoiceSubject=new b(null);projectTitleSubject=new b("Coday");currentInviteEventSubject=new b(null);messageToRestoreSubject=new b("");threadUpdateEventSubject=new b(null);currentChoiceEvent=null;thinkingTimeout=null;accumulatedChunks="";streamingTextSubject=new b("");subThreadEventsSubject=new E;subThreadEvents$=this.subThreadEventsSubject.asObservable();subThreadEventBuffers=new Map;getBufferedSubThreadEvents(e){return this.subThreadEventBuffers.get(e)??[]}messages$=this.messagesSubject.asObservable();streamingText$=this.streamingTextSubject.asObservable();isThinking$=this.isThinkingSubject.asObservable();currentChoice$=this.currentChoiceSubject.asObservable();currentInviteEvent$=this.currentInviteEventSubject.asObservable();messageToRestore$=this.messageToRestoreSubject.asObservable();threadUpdateEvent$=this.threadUpdateEventSubject.asObservable();connectionStatus$;tabTitleService=null;eventStream=v(Ue);messageApi=v(He);userService=v(_e);constructor(){this.connectionStatus$=this.eventStream.connectionStatus$,this.initializeEventHandling()}setTabTitleService(e){this.tabTitleService=e}connectToThread(e,n){this.currentProject=e,this.currentThread=n,this.eventStream.connectToThread(e,n)}loadHistoryFromRest(e){for(let n of e){let t=Le(n);t&&this.handleEvent(t)}}resetMessages(){this.messagesSubject.next([]),this.currentChoiceSubject.next(null),this.currentInviteEventSubject.next(null),this.currentChoiceEvent=null,this.accumulatedChunks="",this.streamingTextSubject.next(""),this.subThreadEventBuffers.clear(),this.stopThinking()}sendMessage(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send message: no project or thread selected");return}let n=this.currentInviteEventSubject.value;if(n){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive(),this.currentInviteEventSubject.next(null);let t=n.buildAnswer(e);this.messageApi.sendMessage(t).subscribe({error:i=>{console.error("[CODAY] Send invite answer error:",i),this.currentInviteEventSubject.next(n),this.stopThinking()}})}else this.messageApi.sendFreeMessage(e).subscribe({error:t=>{console.error("[CODAY] Send error:",t)}})}sendChoice(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send choice: no project or thread selected");return}if(this.currentChoiceEvent){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive();let n=this.currentChoiceEvent.buildAnswer(e);this.currentChoiceSubject.next(null),this.currentChoiceEvent=null,this.messageApi.sendMessage(n).subscribe({next:()=>{},error:t=>{console.error("[CODAY-CHOICE] Choice error:",t),this.stopThinking()}})}else console.error("[CODAY-CHOICE] No choice event available for choice:",e)}deleteMessage(e){let n=this.messagesSubject.value.find(i=>i.id===e),t=this.extractTextContentFromMessage(n);return this.messageApi.deleteMessage(e).pipe(Q(i=>{i.success&&(this.removeMessagesFromIndex(e),t.trim()&&this.messageToRestoreSubject.next(t))}))}getCurrentProjectTitle(){return this.projectTitleSubject.value}getCurrentInviteEvent(){return this.currentInviteEventSubject.value}setThinkingForPendingMessage(){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive()}initializeEventHandling(){this.eventStream.events$.pipe(p(this.destroy$)).subscribe({next:e=>this.handleEvent(e),error:e=>console.error("[CODAY] Event stream error:",e),complete:()=>console.log("[CODAY] Event stream completed")})}handleEvent(e){if(e.threadId&&e.threadId!==this.currentThread){let n=this.subThreadEventBuffers.get(e.threadId);n?n.push(e):this.subThreadEventBuffers.set(e.threadId,[e]),this.subThreadEventsSubject.next(e);return}e instanceof Re?this.handleMessageEvent(e):e instanceof ke?this.handleTextChunkEvent(e):e instanceof xe?this.handleTextEvent(e):e instanceof Pe?this.handleAnswerEvent(e):e instanceof Ie?this.handleErrorEvent(e):e instanceof Ve?this.handleWarnEvent(e):e instanceof q?this.handleThinkingEvent(e):e instanceof je?this.handleToolRequestEvent(e):e instanceof We?this.handleToolResponseEvent(e):e instanceof Ne?this.handleChoiceEvent(e):e instanceof Te?this.handleHeartBeatEvent(e):e instanceof we?this.handleInviteEvent(e):e instanceof Ae?this.handleThreadUpdateEvent(e):e instanceof Be?this.handleDelegationEvent(e):e instanceof De||e instanceof Fe||console.warn("[CODAY] Unhandled event type:",e.type)}handleDelegationEvent(e){if(console.log("[CODAY] DelegationEvent received:",e.subThreadId,e.agentName),this.messagesSubject.value.findIndex(i=>i.subThreadId===e.subThreadId)===-1){let i={id:e.timestamp,role:"system",speaker:e.agentName,content:[{type:"text",content:""}],timestamp:new Date,type:"delegation",subThreadId:e.subThreadId,delegationAgentName:e.agentName};this.addMessage(i)}}handleThreadUpdateEvent(e){this.threadUpdateEventSubject.next(e)}handleMessageEvent(e){e.role==="assistant"&&this.accumulatedChunks&&(this.accumulatedChunks="",this.streamingTextSubject.next(""));let n={id:e.timestamp,role:e.role,speaker:e.name,content:e.content,timestamp:e.date,type:"text"};this.addMessage(n)}handleTextChunkEvent(e){this.accumulatedChunks+=e.chunk,this.streamingTextSubject.next(this.accumulatedChunks)}handleTextEvent(e){let n={id:e.timestamp,role:e.speaker?"assistant":"system",speaker:e.speaker??"System",content:[{type:"text",content:e.text}],timestamp:e.date,type:e.speaker?"text":"technical"};this.addMessage(n)}handleAnswerEvent(e){let n=this.currentInviteEventSubject.value;if(n){let i=!!e.parentKey&&e.parentKey===n.timestamp,o=!e.parentKey&&e.date>=n.date;(i||o)&&this.currentInviteEventSubject.next(null)}if(e.silent)return;let t={id:e.timestamp,role:"user",speaker:e.name??this.userService.getUsername()??"User",content:[{type:"text",content:e.answer}],timestamp:e.date,type:"text",parentKey:e.parentKey,invite:e.invite};this.addMessage(t)}handleErrorEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Error: ${JSON.stringify(e.error)}`}],timestamp:e.date,type:"error"};this.addMessage(n)}handleWarnEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Warning: ${JSON.stringify(e.warning)}`}],timestamp:e.date,type:"warning"};this.addMessage(n)}handleThinkingEvent(e){this.currentInviteEventSubject.value||this.currentChoiceEvent||(this.clearThinkingTimeout(),this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive(),this.thinkingTimeout=setTimeout(()=>{this.isThinkingSubject.next(!1),this.thinkingTimeout=null,this.tabTitleService?.setSystemInactive()},q.debounce+1e3))}handleToolRequestEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp};this.addMessage(n)}handleToolResponseEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp};this.addMessage(n)}handleChoiceEvent(e){this.stopThinking(),this.currentChoiceEvent=e,this.tabTitleService?.setSystemInactive();let n=e.options.map(i=>({value:i,label:i})),t=e.optionalQuestion?`${e.optionalQuestion} ${e.invite}`:e.invite;this.currentChoiceSubject.next({options:n,label:t,allowFreeText:e.allowFreeText})}handleHeartBeatEvent(e){}handleInviteEvent(e){if(this.stopThinking(),e.invite===Oe)this.currentInviteEventSubject.next(e),this.tabTitleService?.setSystemInactive();else{let t={id:e.timestamp,role:"assistant",speaker:"Assistant",content:[{type:"text",content:e.invite}],timestamp:e.date,type:"text"};this.addMessage(t),this.messagesSubject.value.some(_=>_.parentKey===e.timestamp||_.role==="user"&&_.timestamp>e.date||_.role==="assistant"&&_.timestamp>e.date)||(this.currentInviteEventSubject.next(e),this.tabTitleService?.setSystemInactive())}}addMessage(e){let n=this.messagesSubject.value;n.some(t=>t.id===e.id)||this.messagesSubject.next([...n,e])}removeMessagesFromIndex(e){let n=this.messagesSubject.value,t=n.findIndex(o=>o.id===e);if(t===-1||t===0)return;let i=n.slice(0,t);this.messagesSubject.next(i),this.stopThinking()}extractTextContentFromMessage(e){return e?e.content.filter(n=>n.type==="text").map(n=>n.content).join(`
|
|
5
|
+
`).map(n=>this.addPeriodIfNeeded(n.trim())).filter(n=>n.length>0).join(" ")}addPeriodIfNeeded(e){return e?/[.!?;:]$/.test(e)?e:e+".":""}static \u0275fac=function(n){return new(n||c)};static \u0275prov=x({token:c,factory:c.\u0275fac,providedIn:"root"})};var nt=(c,e)=>e.code,it=(c,e)=>e.name+e.lang;function ot(c,e){c&1&&(a(0,"div",17)(1,"mat-icon",39),s(2,"warning"),r(),a(3,"span",40),s(4," Browser notifications have been blocked. To enable them, please reset the site permissions in your browser settings. "),r()())}function rt(c,e){if(c&1&&(a(0,"option",25),s(1),r()),c&2){let n=e.$implicit;u("value",n.code),l(),se("",n.flag," ",n.label)}}function at(c,e){c&1&&(a(0,"option",32),s(1,"Loading voices..."),r())}function st(c,e){c&1&&(a(0,"option",32),s(1,"No voice available"),r())}function ct(c,e){if(c&1&&(a(0,"option",25),s(1),r()),c&2){let n=e.$implicit;u("value",n.name+"|"+n.lang),l(),M(" ",n.displayName," ")}}var Ye=class c{destroy$=new E;selectedTheme="light";selectedVoiceLanguage="en-US";useEnterToSend=!1;printTechnicalMessages=!1;showTechnicalMessages=!0;showWarningMessages=!0;voiceInputMode="browser";voiceAnnounceEnabled=!1;voiceMode="speech";voiceReadFullText=!1;voiceVolume=80;voiceRate=120;agentNotificationEnabled=!1;notificationSoundEnabled=!0;browserNotificationEnabled=!1;browserNotificationDenied=!1;missionPreviewEnabled=!1;availableVoices=[];selectedVoiceId=null;loadingVoices=!1;voiceLanguageOptions=[{code:"fr-FR",label:"Fran\xE7ais",flag:"\u{1F1EB}\u{1F1F7}"},{code:"en-US",label:"English (US)",flag:"\u{1F1FA}\u{1F1F8}"},{code:"en-GB",label:"English (UK)",flag:"\u{1F1EC}\u{1F1E7}"},{code:"es-ES",label:"Espa\xF1ol",flag:"\u{1F1EA}\u{1F1F8}"},{code:"de-DE",label:"Deutsch",flag:"\u{1F1E9}\u{1F1EA}"},{code:"it-IT",label:"Italiano",flag:"\u{1F1EE}\u{1F1F9}"},{code:"pt-BR",label:"Portugu\xEAs",flag:"\u{1F1E7}\u{1F1F7}"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",flag:"\u{1F1EF}\u{1F1F5}"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",flag:"\u{1F1F0}\u{1F1F7}"},{code:"zh-CN",label:"\u4E2D\u6587 (\u7B80\u4F53)",flag:"\u{1F1E8}\u{1F1F3}"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",flag:"\u{1F1F7}\u{1F1FA}"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",flag:"\u{1F1F8}\u{1F1E6}"}];preferencesService=v(D);voiceSynthesisService=v(U);themeService=v(Se);ngOnInit(){this.selectedTheme=this.themeService.getCurrentTheme(),this.selectedVoiceLanguage=this.preferencesService.getVoiceLanguage(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.printTechnicalMessages=this.preferencesService.getPrintTechnicalMessages(),this.showTechnicalMessages=!this.preferencesService.getHideTechnicalMessages(),this.showWarningMessages=!this.preferencesService.getHideWarningMessages(),this.voiceInputMode=this.preferencesService.getVoiceInputMode(),this.voiceAnnounceEnabled=this.preferencesService.getVoiceAnnounceEnabled(),this.voiceMode=this.preferencesService.getVoiceMode(),this.voiceReadFullText=this.preferencesService.getVoiceReadFullText(),this.voiceVolume=Math.round(this.preferencesService.getVoiceVolume()*100),this.voiceRate=Math.round(this.preferencesService.getVoiceRate()*100),this.selectedVoiceId=this.preferencesService.getSelectedVoice(),this.agentNotificationEnabled=this.preferencesService.getAgentNotificationEnabled(),this.notificationSoundEnabled=this.preferencesService.getNotificationSoundEnabled(),this.browserNotificationEnabled=this.preferencesService.getBrowserNotificationEnabled(),this.missionPreviewEnabled=this.preferencesService.getMissionPreviewEnabled(),this.loadAvailableVoices(),this.themeService.currentTheme$.pipe(p(this.destroy$)).subscribe(e=>{this.selectedTheme=e}),this.preferencesService.voiceLanguage$.pipe(p(this.destroy$)).subscribe(e=>{this.selectedVoiceLanguage=e}),this.preferencesService.enterToSend$.pipe(p(this.destroy$)).subscribe(e=>{this.useEnterToSend=e}),this.preferencesService.printTechnicalMessages$.pipe(p(this.destroy$)).subscribe(e=>{this.printTechnicalMessages=e}),this.preferencesService.hideTechnicalMessages$.pipe(p(this.destroy$)).subscribe(e=>{this.showTechnicalMessages=!e}),this.preferencesService.hideWarningMessages$.pipe(p(this.destroy$)).subscribe(e=>{this.showWarningMessages=!e}),this.preferencesService.voiceInputMode$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceInputMode=e}),this.preferencesService.voiceAnnounceEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceAnnounceEnabled=e}),this.preferencesService.voiceMode$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceMode=e}),this.preferencesService.voiceReadFullText$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceReadFullText=e}),this.preferencesService.voiceVolume$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceVolume=Math.round(e*100)}),this.preferencesService.voiceRate$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceRate=Math.round(e*100)}),this.preferencesService.selectedVoice$.pipe(p(this.destroy$)).subscribe(e=>{this.selectedVoiceId=e}),this.preferencesService.voiceLanguage$.pipe(p(this.destroy$)).subscribe(()=>{this.loadAvailableVoices()}),this.preferencesService.agentNotificationEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.agentNotificationEnabled=e}),this.preferencesService.notificationSoundEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.notificationSoundEnabled=e}),this.preferencesService.browserNotificationEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.browserNotificationEnabled=e,this.checkNotificationPermission()}),this.preferencesService.missionPreviewEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.missionPreviewEnabled=e})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}onThemeChange(){console.log("[OPTIONS] Theme changed to:",this.selectedTheme),this.themeService.setTheme(this.selectedTheme)}onVoiceLanguageChange(){console.log("[OPTIONS] Voice language changed to:",this.selectedVoiceLanguage),this.preferencesService.setVoiceLanguage(this.selectedVoiceLanguage)}onEnterToSendChange(){console.log("[OPTIONS] Enter to send changed to:",this.useEnterToSend),this.preferencesService.setEnterToSend(this.useEnterToSend)}onPrintTechnicalMessagesChange(){console.log("[OPTIONS] Print technical messages changed to:",this.printTechnicalMessages),this.preferencesService.setPrintTechnicalMessages(this.printTechnicalMessages)}onShowTechnicalMessagesChange(){let e=!this.showTechnicalMessages;console.log("[OPTIONS] Show technical messages changed to:",this.showTechnicalMessages,"(hide:",e,")"),this.preferencesService.setHideTechnicalMessages(e)}onShowWarningMessagesChange(){let e=!this.showWarningMessages;console.log("[OPTIONS] Show warning messages changed to:",this.showWarningMessages,"(hide:",e,")"),this.preferencesService.setHideWarningMessages(e)}onVoiceInputModeChange(e){let n=e.target.value;console.log("[OPTIONS] Voice input mode changed to:",n),this.preferencesService.setVoiceInputMode(n)}onVoiceAnnounceEnabledChange(){console.log("[OPTIONS] Voice announce enabled changed to:",this.voiceAnnounceEnabled),this.preferencesService.setVoiceAnnounceEnabled(this.voiceAnnounceEnabled)}onVoiceModeChange(){console.log("[OPTIONS] Voice mode changed to:",this.voiceMode),this.preferencesService.setVoiceMode(this.voiceMode)}onVoiceReadFullTextChange(){console.log("[OPTIONS] Voice read full text changed to:",this.voiceReadFullText),this.preferencesService.setVoiceReadFullText(this.voiceReadFullText)}onVoiceVolumeChange(){let e=this.voiceVolume/100;console.log("[OPTIONS] Voice volume changed to:",e),this.preferencesService.setVoiceVolume(e)}onVoiceRateChange(){let e=this.voiceRate/100;console.log("[OPTIONS] Voice rate changed to:",e),this.preferencesService.setVoiceRate(e)}loadAvailableVoices(){return y(this,null,function*(){this.loadingVoices=!0;try{this.availableVoices=yield this.voiceSynthesisService.getVoicesForLanguage(),console.log("[OPTIONS] Loaded",this.availableVoices.length,"voices for current language")}catch(e){console.error("[OPTIONS] Error loading voices:",e),this.availableVoices=[]}finally{this.loadingVoices=!1}})}onSelectedVoiceChange(){console.log("[OPTIONS] Selected voice changed to:",this.selectedVoiceId),this.preferencesService.setSelectedVoice(this.selectedVoiceId)}testVoice(){console.log("[OPTIONS] Testing voice with current settings"),this.voiceSynthesisService.testSelectedVoice()}onAgentNotificationEnabledChange(){console.log("[OPTIONS] Agent notification enabled changed to:",this.agentNotificationEnabled),this.preferencesService.setAgentNotificationEnabled(this.agentNotificationEnabled)}onNotificationSoundEnabledChange(){console.log("[OPTIONS] Notification sound enabled changed to:",this.notificationSoundEnabled),this.preferencesService.setNotificationSoundEnabled(this.notificationSoundEnabled)}onBrowserNotificationEnabledChange(){console.log("[OPTIONS] Browser notification enabled changed to:",this.browserNotificationEnabled),this.preferencesService.setBrowserNotificationEnabled(this.browserNotificationEnabled)}onMissionPreviewEnabledChange(){console.log("[OPTIONS] Mission preview panel enabled changed to:",this.missionPreviewEnabled),this.preferencesService.setMissionPreviewEnabled(this.missionPreviewEnabled)}checkNotificationPermission(){"Notification"in window&&(this.browserNotificationDenied=Notification.permission==="denied",console.log("[OPTIONS] Notification permission status:",Notification.permission))}static \u0275fac=function(n){return new(n||c)};static \u0275cmp=S({type:c,selectors:[["app-options-panel"]],decls:168,vars:37,consts:[[1,"options-content"],[1,"option-section"],[1,"section-title"],[1,"option-group"],[1,"radio-group"],[1,"option-radio"],["type","radio","name","theme","value","light",3,"ngModelChange","change","ngModel"],[1,"radio-mark"],["type","radio","name","theme","value","dark",3,"ngModelChange","change","ngModel"],["type","radio","name","theme","value","system",3,"ngModelChange","change","ngModel"],[1,"option-label"],["type","radio","name","enterBehavior",3,"ngModelChange","change","value","ngModel"],[1,"toggle-option"],["color","primary",3,"ngModelChange","change","ngModel"],[1,"option-label-with-hint"],[1,"option-hint"],["color","primary",3,"ngModelChange","change","ngModel","disabled"],[1,"notification-error"],["for","voice-input-mode-select",1,"option-label"],["id","voice-input-mode-select",1,"option-select",3,"change","value"],["value","browser"],["value","whisper"],["value","voice-message"],["for","voice-language-select",1,"option-label"],["id","voice-language-select",1,"option-select",3,"ngModelChange","change","ngModel"],[3,"value"],["type","radio","name","voiceAnnounce",3,"ngModelChange","change","value","ngModel"],["type","radio","name","voiceMode","value","speech",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceMode","value","notification",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceReadFull",3,"ngModelChange","change","value","ngModel"],["for","voice-select",1,"option-label"],["id","voice-select",1,"option-select",3,"ngModelChange","change","ngModel","disabled"],["value",""],["role","button","tabindex","0","title","Test voice with current settings",1,"test-voice-link",3,"click"],[1,"thread-name"],["for","voice-volume-slider",1,"option-label"],["id","voice-volume-slider","type","range","min","0","max","100","step","5",1,"option-slider",3,"ngModelChange","input","ngModel"],["for","voice-rate-slider",1,"option-label"],["id","voice-rate-slider","type","range","min","50","max","200","step","10",1,"option-slider",3,"ngModelChange","input","ngModel"],[1,"error-icon"],[1,"error-message"]],template:function(n,t){n&1&&(a(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-icon"),s(4,"palette"),r(),a(5,"span"),s(6,"Appearance"),r()(),a(7,"div",3)(8,"div",4)(9,"label",5)(10,"input",6),h("ngModelChange",function(o){return m(t.selectedTheme,o)||(t.selectedTheme=o),o}),d("change",function(){return t.onThemeChange()}),r(),f(11,"span",7),s(12," Light "),r(),a(13,"label",5)(14,"input",8),h("ngModelChange",function(o){return m(t.selectedTheme,o)||(t.selectedTheme=o),o}),d("change",function(){return t.onThemeChange()}),r(),f(15,"span",7),s(16," Dark "),r(),a(17,"label",5)(18,"input",9),h("ngModelChange",function(o){return m(t.selectedTheme,o)||(t.selectedTheme=o),o}),d("change",function(){return t.onThemeChange()}),r(),f(19,"span",7),s(20," System "),r()()()(),a(21,"div",1)(22,"div",2)(23,"mat-icon"),s(24,"chat_bubble_outline"),r(),a(25,"span"),s(26,"Messaging"),r()(),a(27,"div",3)(28,"span",10),s(29,"Send message behavior:"),r(),a(30,"div",4)(31,"label",5)(32,"input",11),h("ngModelChange",function(o){return m(t.useEnterToSend,o)||(t.useEnterToSend=o),o}),d("change",function(){return t.onEnterToSendChange()}),r(),f(33,"span",7),s(34," Enter to send "),r(),a(35,"label",5)(36,"input",11),h("ngModelChange",function(o){return m(t.useEnterToSend,o)||(t.useEnterToSend=o),o}),d("change",function(){return t.onEnterToSendChange()}),r(),f(37,"span",7),s(38," Enter for new line "),r()()(),a(39,"div",3)(40,"div",12)(41,"span",10),s(42,"Show technical messages"),r(),a(43,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.showTechnicalMessages,o)||(t.showTechnicalMessages=o),o}),d("change",function(){return t.onShowTechnicalMessagesChange()}),r()()(),a(44,"div",3)(45,"div",12)(46,"span",10),s(47,"Show warning messages"),r(),a(48,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.showWarningMessages,o)||(t.showWarningMessages=o),o}),d("change",function(){return t.onShowWarningMessagesChange()}),r()()(),a(49,"div",3)(50,"div",12)(51,"span",10),s(52,"Include technical messages in print"),r(),a(53,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.printTechnicalMessages,o)||(t.printTechnicalMessages=o),o}),d("change",function(){return t.onPrintTechnicalMessagesChange()}),r()()()(),a(54,"div",1)(55,"div",2)(56,"mat-icon"),s(57,"rocket_launch"),r(),a(58,"span"),s(59,"Mission Control"),r()(),a(60,"div",3)(61,"div",12)(62,"div",14)(63,"span",10),s(64,"Side-by-side thread preview"),r(),a(65,"span",15),s(66,"Click a mission card to open a preview panel. Recommended for large screens."),r()(),a(67,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.missionPreviewEnabled,o)||(t.missionPreviewEnabled=o),o}),d("change",function(){return t.onMissionPreviewEnabledChange()}),r()()()(),a(68,"div",1)(69,"div",2)(70,"mat-icon"),s(71,"notifications"),r(),a(72,"span"),s(73,"Notifications"),r()(),a(74,"div",3)(75,"div",12)(76,"span",10),s(77,"Notify when the agent answers or requests input"),r(),a(78,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.agentNotificationEnabled,o)||(t.agentNotificationEnabled=o),o}),d("change",function(){return t.onAgentNotificationEnabledChange()}),r()()(),a(79,"div",3)(80,"div",12)(81,"span",10),s(82,"Notification sound"),r(),a(83,"mat-slide-toggle",16),h("ngModelChange",function(o){return m(t.notificationSoundEnabled,o)||(t.notificationSoundEnabled=o),o}),d("change",function(){return t.onNotificationSoundEnabledChange()}),r()()(),a(84,"div",3)(85,"div",12)(86,"span",10),s(87,"Browser notification"),r(),a(88,"mat-slide-toggle",16),h("ngModelChange",function(o){return m(t.browserNotificationEnabled,o)||(t.browserNotificationEnabled=o),o}),d("change",function(){return t.onBrowserNotificationEnabledChange()}),r()(),T(89,ot,5,0,"div",17),r()(),a(90,"div",1)(91,"div",2)(92,"mat-icon"),s(93,"record_voice_over"),r(),a(94,"span"),s(95,"Voice & Speech"),r()(),a(96,"div",3)(97,"label",18),s(98,"Voice input method:"),r(),a(99,"select",19),d("change",function(o){return t.onVoiceInputModeChange(o)}),a(100,"option",20),s(101,"Browser (real-time)"),r(),a(102,"option",21),s(103,"Whisper (higher accuracy)"),r(),a(104,"option",22),s(105,"Voice message (send audio)"),r()()(),a(106,"div",3)(107,"label",23),s(108,"Voice recognition language:"),r(),a(109,"select",24),h("ngModelChange",function(o){return m(t.selectedVoiceLanguage,o)||(t.selectedVoiceLanguage=o),o}),d("change",function(){return t.onVoiceLanguageChange()}),J(110,rt,2,3,"option",25,nt),r()(),a(112,"div",3)(113,"span",10),s(114,"Automatic announcement:"),r(),a(115,"div",4)(116,"label",5)(117,"input",26),h("ngModelChange",function(o){return m(t.voiceAnnounceEnabled,o)||(t.voiceAnnounceEnabled=o),o}),d("change",function(){return t.onVoiceAnnounceEnabledChange()}),r(),f(118,"span",7),s(119," Enabled "),r(),a(120,"label",5)(121,"input",26),h("ngModelChange",function(o){return m(t.voiceAnnounceEnabled,o)||(t.voiceAnnounceEnabled=o),o}),d("change",function(){return t.onVoiceAnnounceEnabledChange()}),r(),f(122,"span",7),s(123," Disabled "),r()()(),a(124,"div",3)(125,"span",10),s(126,"Voice mode:"),r(),a(127,"div",4)(128,"label",5)(129,"input",27),h("ngModelChange",function(o){return m(t.voiceMode,o)||(t.voiceMode=o),o}),d("change",function(){return t.onVoiceModeChange()}),r(),f(130,"span",7),s(131," Voice synthesis "),r(),a(132,"label",5)(133,"input",28),h("ngModelChange",function(o){return m(t.voiceMode,o)||(t.voiceMode=o),o}),d("change",function(){return t.onVoiceModeChange()}),r(),f(134,"span",7),s(135," Sound notification "),r()()(),a(136,"div",3)(137,"span",10),s(138,"Message reading:"),r(),a(139,"div",4)(140,"label",5)(141,"input",29),h("ngModelChange",function(o){return m(t.voiceReadFullText,o)||(t.voiceReadFullText=o),o}),d("change",function(){return t.onVoiceReadFullTextChange()}),r(),f(142,"span",7),s(143," Full message "),r(),a(144,"label",5)(145,"input",29),h("ngModelChange",function(o){return m(t.voiceReadFullText,o)||(t.voiceReadFullText=o),o}),d("change",function(){return t.onVoiceReadFullTextChange()}),r(),f(146,"span",7),s(147," First paragraphs only "),r()()(),a(148,"div",3)(149,"label",30),s(150,"Selected voice:"),r(),a(151,"select",31),h("ngModelChange",function(o){return m(t.selectedVoiceId,o)||(t.selectedVoiceId=o),o}),d("change",function(){return t.onSelectedVoiceChange()}),T(152,at,2,0,"option",32),T(153,st,2,0,"option",32),J(154,ct,2,2,"option",25,it),r(),f(156,"div",10),a(157,"a",33),d("click",function(){return t.testVoice()}),a(158,"span",34),s(159,"Test voice"),r()()(),a(160,"div",3)(161,"label",35),s(162),r(),a(163,"input",36),h("ngModelChange",function(o){return m(t.voiceVolume,o)||(t.voiceVolume=o),o}),d("input",function(){return t.onVoiceVolumeChange()}),r()(),a(164,"div",3)(165,"label",37),s(166),r(),a(167,"input",38),h("ngModelChange",function(o){return m(t.voiceRate,o)||(t.voiceRate=o),o}),d("input",function(){return t.onVoiceRateChange()}),r()()()()),n&2&&(l(10),g("ngModel",t.selectedTheme),l(4),g("ngModel",t.selectedTheme),l(4),g("ngModel",t.selectedTheme),l(14),u("value",!0),g("ngModel",t.useEnterToSend),l(4),u("value",!1),g("ngModel",t.useEnterToSend),l(7),g("ngModel",t.showTechnicalMessages),l(5),g("ngModel",t.showWarningMessages),l(5),g("ngModel",t.printTechnicalMessages),l(14),g("ngModel",t.missionPreviewEnabled),l(11),g("ngModel",t.agentNotificationEnabled),l(5),g("ngModel",t.notificationSoundEnabled),u("disabled",!t.agentNotificationEnabled),l(5),g("ngModel",t.browserNotificationEnabled),u("disabled",!t.agentNotificationEnabled||t.browserNotificationDenied),l(),w(t.browserNotificationDenied?89:-1),l(10),u("value",t.voiceInputMode),l(10),g("ngModel",t.selectedVoiceLanguage),l(),Y(t.voiceLanguageOptions),l(7),u("value",!0),g("ngModel",t.voiceAnnounceEnabled),l(4),u("value",!1),g("ngModel",t.voiceAnnounceEnabled),l(8),g("ngModel",t.voiceMode),l(4),g("ngModel",t.voiceMode),l(8),u("value",!0),g("ngModel",t.voiceReadFullText),l(4),u("value",!1),g("ngModel",t.voiceReadFullText),l(6),g("ngModel",t.selectedVoiceId),u("disabled",t.loadingVoices||t.availableVoices.length===0),l(),w(t.loadingVoices?152:-1),l(),w(!t.loadingVoices&&t.availableVoices.length===0?153:-1),l(),Y(t.availableVoices),l(8),M("Volume: ",t.voiceVolume,"%"),l(),g("ngModel",t.voiceVolume),l(3),M("Speed: ",t.voiceRate,"%"),l(),g("ngModel",t.voiceRate))},dependencies:[z,Me,Te,F,ye,Ee,Ce,L,$,B,ze],styles:['.options-content[_ngcontent-%COMP%]{padding:0;width:100%}.option-group[_ngcontent-%COMP%]{padding:0 1rem 1rem;margin-bottom:1rem;border-bottom:1px solid var(--color-border-light)}.option-group[_ngcontent-%COMP%]:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}.option-label[_ngcontent-%COMP%]{display:block;margin-bottom:.5rem;font-weight:500;color:var(--color-text);font-size:.875rem}.toggle-option[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:1rem}.toggle-option[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0;flex:1}.toggle-option[_ngcontent-%COMP%] mat-slide-toggle[_ngcontent-%COMP%]{flex-shrink:0}.option-label-with-hint[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;flex:1}.option-label-with-hint[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0}.option-label-with-hint[_ngcontent-%COMP%] .option-hint[_ngcontent-%COMP%]{font-size:.775rem;color:var(--color-text-secondary);line-height:1.4}.option-select[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-border);border-radius:4px;background:var(--color-input-bg);color:var(--color-text);font-size:.875rem;cursor:pointer}.option-select[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 3px #7064fb1a}.option-select[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.option-select[_ngcontent-%COMP%] option[_ngcontent-%COMP%]{padding:.5rem}.option-checkbox[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{display:none}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]{width:18px;height:18px;border:2px solid var(--color-border);border-radius:3px;margin-right:.75rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]:after{content:"";width:10px;height:6px;border-left:2px solid transparent;border-bottom:2px solid transparent;transform:rotate(-45deg);transition:all .2s ease;opacity:0}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]{background-color:var(--color-primary);border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]:after{border-left-color:#fff;border-bottom-color:#fff;opacity:1}.option-checkbox[_ngcontent-%COMP%]:hover .checkmark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%]:focus-within .checkmark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-section[_ngcontent-%COMP%]{padding-top:1rem;margin-top:1rem;border-top:2px solid var(--color-border)}.option-section[_ngcontent-%COMP%]:first-child{border-top:none;padding-top:0;margin-top:0}.section-title[_ngcontent-%COMP%]{margin:0 0 1rem;padding:0 1rem;font-size:.9rem;font-weight:600;color:var(--color-text);display:flex;align-items:center;gap:.5rem}.section-title[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.radio-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.option-radio[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{display:none}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]{width:16px;height:16px;border:2px solid var(--color-border);border-radius:50%;margin-right:.5rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0;position:relative}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]:after{content:"";width:8px;height:8px;border-radius:50%;background-color:var(--color-primary);transition:all .2s ease;opacity:0;transform:scale(0)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]:after{opacity:1;transform:scale(1)}.option-radio[_ngcontent-%COMP%]:hover .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%]:focus-within .radio-mark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-slider[_ngcontent-%COMP%]{width:100%;height:6px;border-radius:3px;background:var(--color-bg-solid);outline:none;cursor:pointer;-webkit-appearance:none;appearance:none}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-webkit-slider-track{height:6px;border-radius:3px;background:var(--color-bg-secondary)}.option-slider[_ngcontent-%COMP%]::-moz-range-track{height:6px;border-radius:3px;background:var(--color-bg-secondary);border:none}.option-slider[_ngcontent-%COMP%]:focus{outline:none}.option-slider[_ngcontent-%COMP%]:focus::-webkit-slider-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.option-slider[_ngcontent-%COMP%]:focus::-moz-range-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.test-voice-btn[_ngcontent-%COMP%]{width:100%;padding:.75rem 1rem;background:var(--color-primary);color:#fff;border:none;border-radius:6px;font-size:.875rem;font-weight:500;cursor:pointer;transition:all .2s ease;display:flex;align-items:center;justify-content:center;gap:.5rem}.test-voice-btn[_ngcontent-%COMP%]:hover{background:var(--color-primary-hover);transform:translateY(-1px);box-shadow:0 2px 8px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:active{transform:translateY(0);box-shadow:0 1px 4px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:focus{outline:none;box-shadow:0 0 0 3px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:disabled{background:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;transform:none;box-shadow:none}.test-voice-link[_ngcontent-%COMP%]{text-decoration-thickness:1.5px;text-underline-offset:3px;background:transparent;border:none;padding:0;font-size:.775rem;font-weight:400;cursor:pointer;transition:all .2s ease;display:inline-flex;align-items:center;justify-content:center;gap:.5rem;text-decoration:underline}.test-voice-link[_ngcontent-%COMP%]:hover{color:var(--color-primary-hover, var(--color-primary));text-decoration-thickness:2px}.test-voice-link[_ngcontent-%COMP%]:active{opacity:.8}.test-voice-link[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.test-voice-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.notification-error[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem;padding:.75rem;margin-top:.75rem;background-color:#d32f2f1a;border:1px solid rgba(211,47,47,.3);border-radius:6px;font-size:.8125rem;line-height:1.5}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#d32f2f;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{color:var(--color-text);flex:1}.notification-error[_ngcontent-%COMP%]{margin-top:.75rem;padding:.75rem;background-color:#f443361a;border:1px solid rgba(244,67,54,.3);border-radius:6px;display:flex;align-items:flex-start;gap:.5rem}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#f44336;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text);line-height:1.5;flex:1}']})};var Ke=class c{destroy$=new E;currentProject=null;currentThread=null;messagesSubject=new b([]);isThinkingSubject=new b(!1);currentChoiceSubject=new b(null);projectTitleSubject=new b("Coday");currentInviteEventSubject=new b(null);messageToRestoreSubject=new b("");threadUpdateEventSubject=new b(null);currentChoiceEvent=null;thinkingTimeout=null;accumulatedChunks="";streamingTextSubject=new b("");subThreadEventsSubject=new E;subThreadEvents$=this.subThreadEventsSubject.asObservable();subThreadEventBuffers=new Map;getBufferedSubThreadEvents(e){return this.subThreadEventBuffers.get(e)??[]}messages$=this.messagesSubject.asObservable();streamingText$=this.streamingTextSubject.asObservable();isThinking$=this.isThinkingSubject.asObservable();currentChoice$=this.currentChoiceSubject.asObservable();currentInviteEvent$=this.currentInviteEventSubject.asObservable();messageToRestore$=this.messageToRestoreSubject.asObservable();threadUpdateEvent$=this.threadUpdateEventSubject.asObservable();connectionStatus$;tabTitleService=null;eventStream=v(Ue);messageApi=v(He);userService=v(_e);constructor(){this.connectionStatus$=this.eventStream.connectionStatus$,this.initializeEventHandling()}setTabTitleService(e){this.tabTitleService=e}connectToThread(e,n){this.currentProject=e,this.currentThread=n,this.eventStream.connectToThread(e,n)}loadHistoryFromRest(e){for(let n of e){let t=$e(n);t&&this.handleEvent(t)}}resetMessages(){this.messagesSubject.next([]),this.currentChoiceSubject.next(null),this.currentInviteEventSubject.next(null),this.currentChoiceEvent=null,this.accumulatedChunks="",this.streamingTextSubject.next(""),this.subThreadEventBuffers.clear(),this.stopThinking()}sendMessage(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send message: no project or thread selected");return}let n=this.currentInviteEventSubject.value;if(n){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive(),this.currentInviteEventSubject.next(null);let t=n.buildAnswer(e);this.messageApi.sendMessage(t).subscribe({error:i=>{console.error("[CODAY] Send invite answer error:",i),this.currentInviteEventSubject.next(n),this.stopThinking()}})}else this.messageApi.sendFreeMessage(e).subscribe({error:t=>{console.error("[CODAY] Send error:",t)}})}sendChoice(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send choice: no project or thread selected");return}if(this.currentChoiceEvent){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive();let n=this.currentChoiceEvent.buildAnswer(e);this.currentChoiceSubject.next(null),this.currentChoiceEvent=null,this.messageApi.sendMessage(n).subscribe({next:()=>{},error:t=>{console.error("[CODAY-CHOICE] Choice error:",t),this.stopThinking()}})}else console.error("[CODAY-CHOICE] No choice event available for choice:",e)}deleteMessage(e){let n=this.messagesSubject.value.find(i=>i.id===e),t=this.extractTextContentFromMessage(n);return this.messageApi.deleteMessage(e).pipe(Q(i=>{i.success&&(this.removeMessagesFromIndex(e),t.trim()&&this.messageToRestoreSubject.next(t))}))}getCurrentProjectTitle(){return this.projectTitleSubject.value}getCurrentInviteEvent(){return this.currentInviteEventSubject.value}setThinkingForPendingMessage(){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive()}initializeEventHandling(){this.eventStream.events$.pipe(p(this.destroy$)).subscribe({next:e=>this.handleEvent(e),error:e=>console.error("[CODAY] Event stream error:",e),complete:()=>console.log("[CODAY] Event stream completed")})}handleEvent(e){if(e.threadId&&e.threadId!==this.currentThread){let n=this.subThreadEventBuffers.get(e.threadId);n?n.push(e):this.subThreadEventBuffers.set(e.threadId,[e]),this.subThreadEventsSubject.next(e);return}e instanceof Ae?this.handleMessageEvent(e):e instanceof Ve?this.handleTextChunkEvent(e):e instanceof ke?this.handleTextEvent(e):e instanceof xe?this.handleAnswerEvent(e):e instanceof Ne?this.handleErrorEvent(e):e instanceof Ie?this.handleWarnEvent(e):e instanceof q?this.handleThinkingEvent(e):e instanceof We?this.handleToolRequestEvent(e):e instanceof Re?this.handleToolResponseEvent(e):e instanceof je?this.handleChoiceEvent(e):e instanceof we?this.handleHeartBeatEvent(e):e instanceof Oe?this.handleInviteEvent(e):e instanceof De?this.handleThreadUpdateEvent(e):e instanceof Fe?this.handleDelegationEvent(e):e instanceof Be||e instanceof Le||console.warn("[CODAY] Unhandled event type:",e.type)}handleDelegationEvent(e){if(console.log("[CODAY] DelegationEvent received:",e.subThreadId,e.agentName),this.messagesSubject.value.findIndex(i=>i.subThreadId===e.subThreadId)===-1){let i={id:e.timestamp,role:"system",speaker:e.agentName,content:[{type:"text",content:""}],timestamp:new Date,type:"delegation",subThreadId:e.subThreadId,delegationAgentName:e.agentName};this.addMessage(i)}}handleThreadUpdateEvent(e){this.threadUpdateEventSubject.next(e)}handleMessageEvent(e){e.role==="assistant"&&this.accumulatedChunks&&(this.accumulatedChunks="",this.streamingTextSubject.next(""));let n={id:e.timestamp,role:e.role,speaker:e.name,content:e.content,timestamp:e.date,type:"text"};this.addMessage(n)}handleTextChunkEvent(e){this.accumulatedChunks+=e.chunk,this.streamingTextSubject.next(this.accumulatedChunks)}handleTextEvent(e){let n={id:e.timestamp,role:e.speaker?"assistant":"system",speaker:e.speaker??"System",content:[{type:"text",content:e.text}],timestamp:e.date,type:e.speaker?"text":"technical"};this.addMessage(n)}handleAnswerEvent(e){let n=this.currentInviteEventSubject.value;if(n){let i=!!e.parentKey&&e.parentKey===n.timestamp,o=!e.parentKey&&e.date>=n.date;(i||o)&&this.currentInviteEventSubject.next(null)}if(e.silent)return;let t={id:e.timestamp,role:"user",speaker:e.name??this.userService.getUsername()??"User",content:[{type:"text",content:e.answer}],timestamp:e.date,type:"text",parentKey:e.parentKey,invite:e.invite};this.addMessage(t)}handleErrorEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Error: ${JSON.stringify(e.error)}`}],timestamp:e.date,type:"error"};this.addMessage(n)}handleWarnEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Warning: ${JSON.stringify(e.warning)}`}],timestamp:e.date,type:"warning"};this.addMessage(n)}handleThinkingEvent(e){this.currentInviteEventSubject.value||this.currentChoiceEvent||(this.clearThinkingTimeout(),this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive(),this.thinkingTimeout=setTimeout(()=>{this.isThinkingSubject.next(!1),this.thinkingTimeout=null,this.tabTitleService?.setSystemInactive()},q.debounce+1e3))}handleToolRequestEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp};this.addMessage(n)}handleToolResponseEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp};this.addMessage(n)}handleChoiceEvent(e){this.stopThinking(),this.currentChoiceEvent=e,this.tabTitleService?.setSystemInactive();let n=e.options.map(i=>({value:i,label:i})),t=e.optionalQuestion?`${e.optionalQuestion} ${e.invite}`:e.invite;this.currentChoiceSubject.next({options:n,label:t,allowFreeText:e.allowFreeText})}handleHeartBeatEvent(e){}handleInviteEvent(e){if(this.stopThinking(),e.invite===Pe)this.currentInviteEventSubject.next(e),this.tabTitleService?.setSystemInactive();else{let t={id:e.timestamp,role:"assistant",speaker:"Assistant",content:[{type:"text",content:e.invite}],timestamp:e.date,type:"text"};this.addMessage(t),this.messagesSubject.value.some(_=>_.parentKey===e.timestamp||_.role==="user"&&_.timestamp>e.date||_.role==="assistant"&&_.timestamp>e.date)||(this.currentInviteEventSubject.next(e),this.tabTitleService?.setSystemInactive())}}addMessage(e){let n=this.messagesSubject.value;n.some(t=>t.id===e.id)||this.messagesSubject.next([...n,e])}removeMessagesFromIndex(e){let n=this.messagesSubject.value,t=n.findIndex(o=>o.id===e);if(t===-1||t===0)return;let i=n.slice(0,t);this.messagesSubject.next(i),this.stopThinking()}extractTextContentFromMessage(e){return e?e.content.filter(n=>n.type==="text").map(n=>n.content).join(`
|
|
6
6
|
|
|
7
|
-
`):""}clearThinkingTimeout(){this.thinkingTimeout&&(clearTimeout(this.thinkingTimeout),this.thinkingTimeout=null)}stopThinking(){this.clearThinkingTimeout(),this.isThinkingSubject.next(!1),this.tabTitleService&&this.tabTitleService.setSystemInactive()}ngOnDestroy(){this.clearThinkingTimeout(),this.destroy$.next(),this.destroy$.complete(),this.currentInviteEventSubject.complete(),this.messageToRestoreSubject.complete(),this.threadUpdateEventSubject.complete(),this.streamingTextSubject.complete(),this.eventStream.disconnect()}static \u0275fac=function(n){return new(n||c)};static \u0275prov=x({token:c,factory:c.\u0275fac,providedIn:"root"})};function lt(c,e){if(c&1&&(a(0,"div",3),s(1),r()),c&2){let n=N();l(),M("\u274C ",n.errorMessage)}}var qe=class c{dialogRef=v(ge);data=v(me);jsonContent;errorMessage="";title;constructor(){this.jsonContent=this.data.initialContent,this.title=this.data.title||this.getDefaultTitle(this.data.configType,this.data.projectName)}getDefaultTitle(e,n){return e==="user"?"User Configuration":`Project Configuration: ${n||"Unknown"}`}onSave(){this.errorMessage="";let e;try{e=JSON.parse(this.jsonContent)}catch(n){this.errorMessage=`Invalid JSON syntax: ${n instanceof Error?n.message:"Unknown error"}`;return}this.dialogRef.close(e)}onCancel(){this.dialogRef.close()}static \u0275fac=function(n){return new(n||c)};static \u0275cmp=S({type:c,selectors:[["app-json-editor"]],decls:13,vars:3,consts:[["mat-dialog-title",""],["mat-icon-button","","title","Close",1,"close-button",3,"click"],["spellcheck","false","placeholder","Enter JSON configuration...",1,"json-textarea",3,"ngModelChange","ngModel"],[1,"error-message"],["align","end"],["matButton","",3,"click"],["matButton","filled","color","primary",3,"click"]],template:function(n,t){n&1&&(a(0,"div",0),s(1),a(2,"button",1),d("click",function(){return t.onCancel()}),a(3,"mat-icon"),s(4,"close"),r()()(),a(5,"mat-dialog-content")(6,"textarea",2),h("ngModelChange",function(o){return m(t.jsonContent,o)||(t.jsonContent=o),o}),r(),T(7,lt,2,1,"div",3),r(),a(8,"mat-dialog-actions",4)(9,"button",5),d("click",function(){return t.onCancel()}),s(10,"Cancel"),r(),a(11,"button",6),d("click",function(){return t.onSave()}),s(12,"Save"),r()()),n&2&&(l(),M(" ",t.title," "),l(5),g("ngModel",t.jsonContent),l(),w(t.errorMessage?7:-1))},dependencies:[de
|
|
7
|
+
`):""}clearThinkingTimeout(){this.thinkingTimeout&&(clearTimeout(this.thinkingTimeout),this.thinkingTimeout=null)}stopThinking(){this.clearThinkingTimeout(),this.isThinkingSubject.next(!1),this.tabTitleService&&this.tabTitleService.setSystemInactive()}ngOnDestroy(){this.clearThinkingTimeout(),this.destroy$.next(),this.destroy$.complete(),this.currentInviteEventSubject.complete(),this.messageToRestoreSubject.complete(),this.threadUpdateEventSubject.complete(),this.streamingTextSubject.complete(),this.eventStream.disconnect()}static \u0275fac=function(n){return new(n||c)};static \u0275prov=x({token:c,factory:c.\u0275fac,providedIn:"root"})};function lt(c,e){if(c&1&&(a(0,"div",3),s(1),r()),c&2){let n=N();l(),M("\u274C ",n.errorMessage)}}var qe=class c{dialogRef=v(ge);data=v(me);jsonContent;errorMessage="";title;constructor(){this.jsonContent=this.data.initialContent,this.title=this.data.title||this.getDefaultTitle(this.data.configType,this.data.projectName)}getDefaultTitle(e,n){return e==="user"?"User Configuration":`Project Configuration: ${n||"Unknown"}`}onSave(){this.errorMessage="";let e;try{e=JSON.parse(this.jsonContent)}catch(n){this.errorMessage=`Invalid JSON syntax: ${n instanceof Error?n.message:"Unknown error"}`;return}this.dialogRef.close(e)}onCancel(){this.dialogRef.close()}static \u0275fac=function(n){return new(n||c)};static \u0275cmp=S({type:c,selectors:[["app-json-editor"]],decls:13,vars:3,consts:[["mat-dialog-title",""],["mat-icon-button","","title","Close",1,"close-button",3,"click"],["spellcheck","false","placeholder","Enter JSON configuration...",1,"json-textarea",3,"ngModelChange","ngModel"],[1,"error-message"],["align","end"],["matButton","",3,"click"],["matButton","filled","color","primary",3,"click"]],template:function(n,t){n&1&&(a(0,"div",0),s(1),a(2,"button",1),d("click",function(){return t.onCancel()}),a(3,"mat-icon"),s(4,"close"),r()()(),a(5,"mat-dialog-content")(6,"textarea",2),h("ngModelChange",function(o){return m(t.jsonContent,o)||(t.jsonContent=o),o}),r(),T(7,lt,2,1,"div",3),r(),a(8,"mat-dialog-actions",4)(9,"button",5),d("click",function(){return t.onCancel()}),s(10,"Cancel"),r(),a(11,"button",6),d("click",function(){return t.onSave()}),s(12,"Save"),r()()),n&2&&(l(),M(" ",t.title," "),l(5),g("ngModel",t.jsonContent),l(),w(t.errorMessage?7:-1))},dependencies:[de,z,F,L,$,B,fe,be,he,ue,ve],styles:["[mat-dialog-title][_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}[mat-dialog-title][_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%]{margin-left:auto}mat-dialog-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;min-height:400px}.json-textarea[_ngcontent-%COMP%]{flex:1;min-height:300px;max-height:80vh;padding:1rem;font-family:Monaco,Menlo,Ubuntu Mono,Consolas,monospace;font-size:.875rem;line-height:1.5;background:var(--color-code-bg);color:var(--color-text);border:1px solid var(--color-border);border-radius:4px;resize:vertical;outline:none;transition:border-color .2s}.json-textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.json-textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);opacity:.6}.error-message[_ngcontent-%COMP%]{padding:.75rem 1rem;border-radius:4px;font-size:.875rem;line-height:1.4;background:#dc26261a;color:#dc2626;border:1px solid rgba(220,38,38,.3)}"]})};export{Ct as a,yt as b,wt as c,Ot as d,U as e,Ye as f,Ke as g,qe as h};
|