@whoz-oss/coday-client 0.152.0 → 0.159.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/browser/{chunk-74QUDUXA.js → chunk-46WAGL6T.js} +1 -1
  2. package/browser/{chunk-R2PDKYWK.js → chunk-4PT56FZA.js} +1 -1
  3. package/browser/chunk-5JACHD45.js +1 -0
  4. package/browser/{chunk-KDWFOH5N.js → chunk-64KUJ72Y.js} +1 -1
  5. package/browser/{chunk-YWWGX3OO.js → chunk-6HXHF2SN.js} +1 -1
  6. package/browser/chunk-AEXWYSY4.js +1 -0
  7. package/browser/chunk-AIC4U2MU.js +1 -0
  8. package/browser/chunk-DFZI6Z7W.js +1 -0
  9. package/browser/chunk-EC2BCDCL.js +1 -0
  10. package/browser/{chunk-WER6464F.js → chunk-F32VEQPY.js} +1 -1
  11. package/browser/chunk-FHERZTSZ.js +1 -0
  12. package/browser/{chunk-BPGILYXN.js → chunk-FIVJTOO5.js} +1 -1
  13. package/browser/chunk-FXW6JMJT.js +1 -0
  14. package/browser/{chunk-QBQFRY6E.js → chunk-GIMSVKQM.js} +1 -1
  15. package/browser/chunk-GKBRHSMN.js +1 -0
  16. package/browser/{chunk-FEMUXIQ5.js → chunk-GZ5XFG52.js} +1 -1
  17. package/browser/chunk-H7MV7NCQ.js +1 -0
  18. package/browser/{chunk-2LW5VXLB.js → chunk-HBPEHALV.js} +1 -1
  19. package/browser/{chunk-POUIHGLE.js → chunk-I5HSEFR4.js} +1 -1
  20. package/browser/{chunk-23T7O4RB.js → chunk-J6KC3ETK.js} +1 -1
  21. package/browser/{chunk-Q643KTCY.js → chunk-JLVW3WZE.js} +1 -1
  22. package/browser/{chunk-X6SZS62E.js → chunk-JWRID2EL.js} +1 -1
  23. package/browser/chunk-KRK3FNKB.js +1 -0
  24. package/browser/chunk-L7OS7MWE.js +1 -0
  25. package/browser/chunk-LMGSBI4E.js +1 -0
  26. package/browser/{chunk-F5UWLT3X.js → chunk-MKE7HI6X.js} +1 -1
  27. package/browser/{chunk-WXOL2LXZ.js → chunk-NGOS7UTY.js} +1 -1
  28. package/browser/{chunk-VBXWUQS7.js → chunk-NUN4WTCP.js} +1 -1
  29. package/browser/chunk-OAN35RIR.js +1 -0
  30. package/browser/{chunk-4BA742MQ.js → chunk-OD5UXNU5.js} +1 -1
  31. package/browser/{chunk-IBOCXMQ4.js → chunk-P7CSUKFY.js} +1 -1
  32. package/browser/chunk-QIURQTGU.js +1 -0
  33. package/browser/{chunk-AQ7HC7RU.js → chunk-SKABLB3F.js} +1 -1
  34. package/browser/chunk-SPSXBYO3.js +1 -0
  35. package/browser/{chunk-WZ5GZFOX.js → chunk-TCYPGB6P.js} +1 -1
  36. package/browser/{chunk-RSQZM7XG.js → chunk-TGT4RBUY.js} +1 -1
  37. package/browser/{chunk-A75US5OS.js → chunk-TWTJJETM.js} +1 -1
  38. package/browser/chunk-UOGHINOM.js +1 -0
  39. package/browser/{chunk-K3JZBQNI.js → chunk-UVTRXG6W.js} +1 -1
  40. package/browser/{chunk-GHZFCBZI.js → chunk-VKFTCAHS.js} +1 -1
  41. package/browser/chunk-VU5WR5CP.js +1 -0
  42. package/browser/{chunk-4RJ7IPTL.js → chunk-WG653S5D.js} +1 -1
  43. package/browser/chunk-WJFUKUVD.js +1 -0
  44. package/browser/chunk-WMRLIQ4E.js +1 -0
  45. package/browser/chunk-XHE2FLNY.js +1 -0
  46. package/browser/{chunk-R4YBTA4J.js → chunk-XV6SOT4A.js} +1 -1
  47. package/browser/chunk-ZTTTDVEL.js +1 -0
  48. package/browser/chunk-ZV2GXJ7Q.js +1 -0
  49. package/browser/index.html +1 -1
  50. package/browser/{main-3P5CH7OO.js → main-3RWS5R5L.js} +1 -1
  51. package/package.json +1 -1
  52. package/browser/chunk-27VMXNKO.js +0 -1
  53. package/browser/chunk-5FQ263AJ.js +0 -1
  54. package/browser/chunk-5SMSD425.js +0 -1
  55. package/browser/chunk-DK7CV3ER.js +0 -1
  56. package/browser/chunk-FH7GLF4A.js +0 -1
  57. package/browser/chunk-FVTEJ3CC.js +0 -1
  58. package/browser/chunk-FXEVP5EI.js +0 -1
  59. package/browser/chunk-GFM6GNN4.js +0 -1
  60. package/browser/chunk-M6PPDBCV.js +0 -1
  61. package/browser/chunk-MFP22ZDH.js +0 -1
  62. package/browser/chunk-MPWUESX7.js +0 -1
  63. package/browser/chunk-MW254KMZ.js +0 -1
  64. package/browser/chunk-NEH5OLEF.js +0 -1
  65. package/browser/chunk-TIUJWVDI.js +0 -1
  66. package/browser/chunk-UCFKZZMU.js +0 -1
  67. package/browser/chunk-XNTXJPF5.js +0 -1
  68. package/browser/chunk-ZFS375I4.js +0 -1
@@ -1 +1 @@
1
- import{a as K}from"./chunk-NEH5OLEF.js";import{b as H}from"./chunk-UARV2YUR.js";import{p as Y}from"./chunk-WER6464F.js";import{a as Q}from"./chunk-UCFKZZMU.js";import{Bb as E,Db as f,Fb as d,Jb as B,Ka as l,Kb as M,Lb as O,Ma as D,Rb as I,Sc as $,Tb as p,Ub as C,Wa as F,ca as y,ga as T,ha as S,jb as q,kc as P,lb as g,ma as N,mb as h,pa as A,pb as L,qb as V,rb as k,sb as i,ta as v,tb as s,ua as w,ub as z}from"./chunk-QPN22TF2.js";var U=["composerInput"],J=["messagesContainer"],Z=(o,e)=>e.kind==="message"?e.event.id:e.kind==="tool"?e.call.requestId:"streaming";function W(o,e){o&1&&(i(0,"div",4)(1,"p"),p(2,"No messages yet."),s()())}function X(o,e){if(o&1&&(i(0,"div",16)(1,"span",17),p(2),s(),i(3,"p",18),p(4),s()()),o&2){let t=d().$implicit,n=d(2);I("case-chat__message--user",t.event.actor.role==="USER")("case-chat__message--agent",t.event.actor.role==="AGENT"),l(2),C(t.event.actor.displayName),l(2),C(n.extractText(t.event))}}function ee(o,e){if(o&1&&(i(0,"div",14)(1,"span",17),p(2),s(),i(3,"p",18),p(4),s()()),o&2){let t=d().$implicit,n=d(2);l(2),C(n.agentDisplayName()),l(2),C(t.text)}}function te(o,e){o&1&&p(0," \u23F3 ")}function ne(o,e){o&1&&p(0," \u2705 ")}function oe(o,e){o&1&&p(0," \u274C ")}function ae(o,e){if(o&1&&(i(0,"div",25)(1,"span",26),p(2,"Payload"),s(),i(3,"pre"),p(4),s()()),o&2){let t=d(3).$implicit;l(4),C(t.call.args)}}function ie(o,e){o&1&&(i(0,"pre"),p(1),s()),o&2&&(l(),C(e))}function se(o,e){o&1&&(i(0,"span",27),p(1,"Running\u2026"),s())}function re(o,e){o&1&&(i(0,"span",28),p(1,"No output"),s())}function le(o,e){if(o&1&&(i(0,"div",24),g(1,ae,5,1,"div",25),i(2,"div",25)(3,"span",26),p(4,"Output"),s(),g(5,ie,2,1,"pre")(6,se,2,0,"span",27)(7,re,2,0,"span",28),s()()),o&2){let t,n=d(2).$implicit,a=d(2);l(),h(n.call.args?1:-1),l(4),h((t=a.extractToolOutput(n.call))?5:n.call.response?7:6,t)}}function ce(o,e){if(o&1){let t=E();i(0,"div",19)(1,"button",20),f("click",function(){T(t);let a=d().$implicit,_=d(2);return S(_.toggleToolCall(a.call.requestId))}),i(2,"span",21),g(3,te,1,0)(4,ne,1,0)(5,oe,1,0),s(),i(6,"span",22),p(7),s(),i(8,"span",23),p(9),s()(),g(10,le,8,2,"div",24),s()}if(o&2){let t=d().$implicit,n=d(2);I("case-chat__tool-call--pending",!t.call.response)("case-chat__tool-call--success",(t.call.response==null?null:t.call.response.success)===!0)("case-chat__tool-call--error",(t.call.response==null?null:t.call.response.success)===!1),l(),q("aria-expanded",n.isToolCallExpanded(t.call.requestId)),l(2),h(t.call.response?t.call.response.success?4:5:3),l(4),C(t.call.toolName),l(2),C(n.isToolCallExpanded(t.call.requestId)?"\u25BC":"\u25B6"),l(),h(n.isToolCallExpanded(t.call.requestId)?10:-1)}}function de(o,e){if(o&1&&g(0,X,5,6,"div",13)(1,ee,5,2,"div",14)(2,ce,11,11,"div",15),o&2){let t=e.$implicit;h(t.kind==="message"?0:t.kind==="streaming"?1:2)}}function pe(o,e){if(o&1&&L(0,de,3,1,null,null,Z),o&2){let t=d();V(t.timeline())}}function me(o,e){o&1&&(i(0,"div",5),z(1,"span",29)(2,"span",29)(3,"span",29),s())}function _e(o,e){if(o&1){let t=E();i(0,"div",6)(1,"ds-icon-button",30),f("action",function(){T(t);let a=d();return S(a.onScrollToBottomClick())}),s()()}}function ue(o,e){if(o&1){let t=E();i(0,"ds-icon-button",31),f("action",function(){T(t);let a=d();return S(a.interrupt())}),s()}}function ge(o,e){if(o&1){let t=E();i(0,"ds-icon-button",32),f("action",function(){T(t);let a=d();return S(a.submit())}),s()}if(o&2){let t=d();k("disabled",!t.canSend)}}var he=64,j=class o{route=y(H);http=y($);zone=y(A);destroyRef=y(N);config=y(K);caseId=this.route.snapshot.params.caseId;namespaceId=this.route.snapshot.params.namespaceId;agentDisplayName=P(()=>{let e=this.events();for(let t=e.length-1;t>=0;t--){let n=e[t];if(n){if(n.type==="AgentRunningEvent"||n.type==="AgentSelectedEvent"||n.type==="AgentFinishedEvent"){let a=n.agentName;if(a&&a.trim().length>0)return a}if(n.type==="MessageEvent"){let a=n;if(a.actor?.role==="AGENT"&&a.actor.displayName)return a.actor.displayName}}}return"Assistant"});eventSource=null;composerInput;messagesContainer;events=v([]);inputValue=v("");isRunning=v(!1);isTerminal=v(!1);streamingText=v("");collapsedTools=v(new Set);isAtBottom=v(!0);scrollListenerCleanup=null;constructor(){w(()=>{this.isRunning()||this.isTerminal()||queueMicrotask(()=>this.composerInput?.nativeElement.focus())}),w(()=>{this.timeline(),this.streamingText(),this.isAtBottom()&&queueMicrotask(()=>this.scrollToBottom())}),D(()=>{this.attachScrollListener()})}timeline=P(()=>{let e=this.events(),t=this.streamingText(),n=new Map;for(let c of e)if(c.type==="ToolRequestEvent"){let m=c,r=m.toolRequestId??c.id,x=n.get(r);n.set(r,{requestId:r,toolName:m.toolName??"unknown",args:m.args??null,response:x?.response})}else if(c.type==="ToolResponseEvent"){let m=c,r=m.toolRequestId??c.id,x=n.get(r);n.set(r,{requestId:r,toolName:x?.toolName??m.toolName??"unknown",args:x?.args??null,response:m})}let a=[],_=new Set;for(let c of e)if(c.type==="MessageEvent")a.push({kind:"message",event:c});else if(c.type==="ToolRequestEvent"||c.type==="ToolResponseEvent"){let r=c.toolRequestId??c.id;_.has(r)||(_.add(r),a.push({kind:"tool",call:n.get(r)}))}return t.trim().length>0&&a.push({kind:"streaming",text:t}),a});get canSend(){return!!this.inputValue().trim()&&!this.isRunning()&&!this.isTerminal()}ngOnInit(){this.connectSse(),this.route.params.pipe(Q(this.destroyRef)).subscribe(e=>{let t=e.caseId;t&&t!==this.caseId&&(this.caseId=t,this.reinitialise())})}ngOnDestroy(){this.eventSource?.close(),this.scrollListenerCleanup?.()}attachScrollListener(){let e=this.messagesContainer?.nativeElement;if(!e)return;let t=()=>{let n=e.scrollHeight-e.scrollTop-e.clientHeight;this.isAtBottom.set(n<=he)};e.addEventListener("scroll",t,{passive:!0}),this.scrollListenerCleanup=()=>e.removeEventListener("scroll",t)}scrollToBottom(){let e=this.messagesContainer?.nativeElement;e&&(e.scrollTop=e.scrollHeight)}onScrollToBottomClick(){this.isAtBottom.set(!0),this.scrollToBottom()}connectSse(){let e=`${this.config.basePath}/api/cases/${this.caseId}/events`;console.log("[AgentOS SSE] connecting",{url:e,basePath:this.config.basePath,caseId:this.caseId,namespaceId:this.namespaceId,now:new Date().toISOString()}),this.eventSource=this.zone.runOutsideAngular(()=>new EventSource(e));let t=a=>{let _=performance.now(),c=a.type,m=a.data;console.log("[AgentOS SSE] frame received",{sseEventName:c,dataLength:m?.length??0,dataPreview:m?.slice(0,120),receivedAtMs:_});try{let r=JSON.parse(m);this.zone.run(()=>{let x=this.events().length;this.events.update(u=>u.some(b=>b.id===r.id)?u:[...u,r]);let G=this.events().length;if(console.log("[AgentOS SSE] event processed",{sseEventName:c,eventType:r.type,eventId:r.id,beforeLen:x,afterLen:G,running:this.isRunning(),terminal:this.isTerminal()}),r.type==="TextChunkEvent"){let u=r.chunk;u&&this.streamingText.update(b=>b+u);return}if(r.type==="CaseStatusEvent"){let u=r.status,b=u==="KILLED"||u==="ERROR";if(this.isTerminal.set(b),b)this.isRunning.set(!1),this.eventSource?.close(),this.eventSource=null;else{let R=u==="RUNNING";this.isRunning.set(R),R||this.streamingText.set("")}return}if(r.type==="AgentFinishedEvent"){this.isRunning.set(!1),this.streamingText.set("");return}})}catch(r){console.warn("[AgentOS SSE] failed to parse event data",{sseEventName:c,error:r,dataPreview:m?.slice(0,500)})}},n=["MessageEvent","CaseStatusEvent","AgentSelectedEvent","AgentRunningEvent","AgentFinishedEvent","ThinkingEvent","TextChunkEvent","ToolRequestEvent","ToolResponseEvent"];for(let a of n)console.log("[AgentOS SSE] addEventListener",a),this.eventSource.addEventListener(a,t);this.eventSource.onopen=()=>{console.log("[AgentOS SSE] connection open",{readyState:this.eventSource?.readyState,at:new Date().toISOString()})},this.eventSource.onmessage=a=>{console.log("[AgentOS SSE] onmessage (unnamed event) received",{dataLength:a.data?.length??0,dataPreview:a.data?.slice(0,120)})},this.eventSource.onerror=a=>{console.warn("[AgentOS SSE] connection error",{err:a,readyState:this.eventSource?.readyState,at:new Date().toISOString()}),this.zone.run(()=>{this.isRunning.set(!1)})}}onInput(e){this.inputValue.set(e.target.value)}onKeydown(e){e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),this.submit())}reinitialise(){this.eventSource?.close(),this.eventSource=null,this.events.set([]),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 e=this.inputValue().trim();this.inputValue.set(""),this.sendMessage(e)}sendMessage(e){this.isRunning.set(!0),this.streamingText.set(""),this.http.post(`${this.config.basePath}/api/cases/${this.caseId}/messages`,{content:e,userId:"default-user"}).subscribe({error:t=>{console.error("[CaseChat] Failed to send message",t),this.isRunning.set(!1)}})}interrupt(){this.http.post(`${this.config.basePath}/api/cases/${this.caseId}/interrupt`,{}).subscribe({error:e=>console.error("[CaseChat] Failed to interrupt case",e)})}kill(){this.http.post(`${this.config.basePath}/api/cases/${this.caseId}/kill`,{}).subscribe({error:e=>console.error("[CaseChat] Failed to kill case",e)})}extractText(e){return e.content?.filter(t=>"content"in t).map(t=>t.content).join("")??""}extractToolOutput(e){if(!e.response)return null;let t=e.response.output;return t?t.content??null:null}toggleToolCall(e){this.collapsedTools.update(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}isToolCallExpanded(e){return this.collapsedTools().has(e)}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=F({type:o,selectors:[["agentos-case-chat"]],viewQuery:function(t,n){if(t&1&&B(U,5)(J,5),t&2){let a;M(a=O())&&(n.composerInput=a.first),M(a=O())&&(n.messagesContainer=a.first)}},decls:14,vars:7,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"],["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__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__message-author"],[1,"case-chat__message-text"],[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"],[1,"case-chat__tool-call-label"],[1,"case-chat__tool-call-pending"],[1,"case-chat__tool-call-empty"],[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(t,n){t&1&&(i(0,"div",2)(1,"div",3,0),g(3,W,3,0,"div",4)(4,pe,2,0),g(5,me,4,0,"div",5),s(),g(6,_e,2,0,"div",6),i(7,"div",7)(8,"textarea",8,1),f("input",function(_){return n.onInput(_)})("keydown",function(_){return n.onKeydown(_)}),s(),i(10,"div",9),g(11,ue,1,0,"ds-icon-button",10)(12,ge,1,1,"ds-icon-button",11),i(13,"ds-icon-button",12),f("action",function(){return n.kill()}),s()()()()),t&2&&(l(3),h(n.timeline().length===0?3:4),l(2),h(n.isRunning()?5:-1),l(),h(n.isAtBottom()?-1:6),l(2),k("value",n.inputValue())("disabled",n.isRunning()||n.isTerminal()),l(3),h(n.isRunning()?11:12),l(2),k("disabled",n.isTerminal()))},dependencies:[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__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__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--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{j as a};
1
+ import{a as K}from"./chunk-ZTTTDVEL.js";import{b as H}from"./chunk-UARV2YUR.js";import{p as Y}from"./chunk-F32VEQPY.js";import{a as Q}from"./chunk-WJFUKUVD.js";import{Bb as E,Db as f,Fb as d,Jb as B,Ka as l,Kb as M,Lb as O,Ma as D,Rb as I,Sc as $,Tb as p,Ub as C,Wa as F,ca as y,ga as T,ha as S,jb as q,kc as P,lb as g,ma as N,mb as h,pa as A,pb as L,qb as V,rb as k,sb as i,ta as v,tb as s,ua as w,ub as z}from"./chunk-QPN22TF2.js";var U=["composerInput"],J=["messagesContainer"],Z=(o,e)=>e.kind==="message"?e.event.id:e.kind==="tool"?e.call.requestId:"streaming";function W(o,e){o&1&&(i(0,"div",4)(1,"p"),p(2,"No messages yet."),s()())}function X(o,e){if(o&1&&(i(0,"div",16)(1,"span",17),p(2),s(),i(3,"p",18),p(4),s()()),o&2){let t=d().$implicit,n=d(2);I("case-chat__message--user",t.event.actor.role==="USER")("case-chat__message--agent",t.event.actor.role==="AGENT"),l(2),C(t.event.actor.displayName),l(2),C(n.extractText(t.event))}}function ee(o,e){if(o&1&&(i(0,"div",14)(1,"span",17),p(2),s(),i(3,"p",18),p(4),s()()),o&2){let t=d().$implicit,n=d(2);l(2),C(n.agentDisplayName()),l(2),C(t.text)}}function te(o,e){o&1&&p(0," \u23F3 ")}function ne(o,e){o&1&&p(0," \u2705 ")}function oe(o,e){o&1&&p(0," \u274C ")}function ae(o,e){if(o&1&&(i(0,"div",25)(1,"span",26),p(2,"Payload"),s(),i(3,"pre"),p(4),s()()),o&2){let t=d(3).$implicit;l(4),C(t.call.args)}}function ie(o,e){o&1&&(i(0,"pre"),p(1),s()),o&2&&(l(),C(e))}function se(o,e){o&1&&(i(0,"span",27),p(1,"Running\u2026"),s())}function re(o,e){o&1&&(i(0,"span",28),p(1,"No output"),s())}function le(o,e){if(o&1&&(i(0,"div",24),g(1,ae,5,1,"div",25),i(2,"div",25)(3,"span",26),p(4,"Output"),s(),g(5,ie,2,1,"pre")(6,se,2,0,"span",27)(7,re,2,0,"span",28),s()()),o&2){let t,n=d(2).$implicit,a=d(2);l(),h(n.call.args?1:-1),l(4),h((t=a.extractToolOutput(n.call))?5:n.call.response?7:6,t)}}function ce(o,e){if(o&1){let t=E();i(0,"div",19)(1,"button",20),f("click",function(){T(t);let a=d().$implicit,_=d(2);return S(_.toggleToolCall(a.call.requestId))}),i(2,"span",21),g(3,te,1,0)(4,ne,1,0)(5,oe,1,0),s(),i(6,"span",22),p(7),s(),i(8,"span",23),p(9),s()(),g(10,le,8,2,"div",24),s()}if(o&2){let t=d().$implicit,n=d(2);I("case-chat__tool-call--pending",!t.call.response)("case-chat__tool-call--success",(t.call.response==null?null:t.call.response.success)===!0)("case-chat__tool-call--error",(t.call.response==null?null:t.call.response.success)===!1),l(),q("aria-expanded",n.isToolCallExpanded(t.call.requestId)),l(2),h(t.call.response?t.call.response.success?4:5:3),l(4),C(t.call.toolName),l(2),C(n.isToolCallExpanded(t.call.requestId)?"\u25BC":"\u25B6"),l(),h(n.isToolCallExpanded(t.call.requestId)?10:-1)}}function de(o,e){if(o&1&&g(0,X,5,6,"div",13)(1,ee,5,2,"div",14)(2,ce,11,11,"div",15),o&2){let t=e.$implicit;h(t.kind==="message"?0:t.kind==="streaming"?1:2)}}function pe(o,e){if(o&1&&L(0,de,3,1,null,null,Z),o&2){let t=d();V(t.timeline())}}function me(o,e){o&1&&(i(0,"div",5),z(1,"span",29)(2,"span",29)(3,"span",29),s())}function _e(o,e){if(o&1){let t=E();i(0,"div",6)(1,"ds-icon-button",30),f("action",function(){T(t);let a=d();return S(a.onScrollToBottomClick())}),s()()}}function ue(o,e){if(o&1){let t=E();i(0,"ds-icon-button",31),f("action",function(){T(t);let a=d();return S(a.interrupt())}),s()}}function ge(o,e){if(o&1){let t=E();i(0,"ds-icon-button",32),f("action",function(){T(t);let a=d();return S(a.submit())}),s()}if(o&2){let t=d();k("disabled",!t.canSend)}}var he=64,j=class o{route=y(H);http=y($);zone=y(A);destroyRef=y(N);config=y(K);caseId=this.route.snapshot.params.caseId;namespaceId=this.route.snapshot.params.namespaceId;agentDisplayName=P(()=>{let e=this.events();for(let t=e.length-1;t>=0;t--){let n=e[t];if(n){if(n.type==="AgentRunningEvent"||n.type==="AgentSelectedEvent"||n.type==="AgentFinishedEvent"){let a=n.agentName;if(a&&a.trim().length>0)return a}if(n.type==="MessageEvent"){let a=n;if(a.actor?.role==="AGENT"&&a.actor.displayName)return a.actor.displayName}}}return"Assistant"});eventSource=null;composerInput;messagesContainer;events=v([]);inputValue=v("");isRunning=v(!1);isTerminal=v(!1);streamingText=v("");collapsedTools=v(new Set);isAtBottom=v(!0);scrollListenerCleanup=null;constructor(){w(()=>{this.isRunning()||this.isTerminal()||queueMicrotask(()=>this.composerInput?.nativeElement.focus())}),w(()=>{this.timeline(),this.streamingText(),this.isAtBottom()&&queueMicrotask(()=>this.scrollToBottom())}),D(()=>{this.attachScrollListener()})}timeline=P(()=>{let e=this.events(),t=this.streamingText(),n=new Map;for(let c of e)if(c.type==="ToolRequestEvent"){let m=c,r=m.toolRequestId??c.id,x=n.get(r);n.set(r,{requestId:r,toolName:m.toolName??"unknown",args:m.args??null,response:x?.response})}else if(c.type==="ToolResponseEvent"){let m=c,r=m.toolRequestId??c.id,x=n.get(r);n.set(r,{requestId:r,toolName:x?.toolName??m.toolName??"unknown",args:x?.args??null,response:m})}let a=[],_=new Set;for(let c of e)if(c.type==="MessageEvent")a.push({kind:"message",event:c});else if(c.type==="ToolRequestEvent"||c.type==="ToolResponseEvent"){let r=c.toolRequestId??c.id;_.has(r)||(_.add(r),a.push({kind:"tool",call:n.get(r)}))}return t.trim().length>0&&a.push({kind:"streaming",text:t}),a});get canSend(){return!!this.inputValue().trim()&&!this.isRunning()&&!this.isTerminal()}ngOnInit(){this.connectSse(),this.route.params.pipe(Q(this.destroyRef)).subscribe(e=>{let t=e.caseId;t&&t!==this.caseId&&(this.caseId=t,this.reinitialise())})}ngOnDestroy(){this.eventSource?.close(),this.scrollListenerCleanup?.()}attachScrollListener(){let e=this.messagesContainer?.nativeElement;if(!e)return;let t=()=>{let n=e.scrollHeight-e.scrollTop-e.clientHeight;this.isAtBottom.set(n<=he)};e.addEventListener("scroll",t,{passive:!0}),this.scrollListenerCleanup=()=>e.removeEventListener("scroll",t)}scrollToBottom(){let e=this.messagesContainer?.nativeElement;e&&(e.scrollTop=e.scrollHeight)}onScrollToBottomClick(){this.isAtBottom.set(!0),this.scrollToBottom()}connectSse(){let e=`${this.config.basePath}/api/cases/${this.caseId}/events`;console.log("[AgentOS SSE] connecting",{url:e,basePath:this.config.basePath,caseId:this.caseId,namespaceId:this.namespaceId,now:new Date().toISOString()}),this.eventSource=this.zone.runOutsideAngular(()=>new EventSource(e));let t=a=>{let _=performance.now(),c=a.type,m=a.data;console.log("[AgentOS SSE] frame received",{sseEventName:c,dataLength:m?.length??0,dataPreview:m?.slice(0,120),receivedAtMs:_});try{let r=JSON.parse(m);this.zone.run(()=>{let x=this.events().length;this.events.update(u=>u.some(b=>b.id===r.id)?u:[...u,r]);let G=this.events().length;if(console.log("[AgentOS SSE] event processed",{sseEventName:c,eventType:r.type,eventId:r.id,beforeLen:x,afterLen:G,running:this.isRunning(),terminal:this.isTerminal()}),r.type==="TextChunkEvent"){let u=r.chunk;u&&this.streamingText.update(b=>b+u);return}if(r.type==="CaseStatusEvent"){let u=r.status,b=u==="KILLED"||u==="ERROR";if(this.isTerminal.set(b),b)this.isRunning.set(!1),this.eventSource?.close(),this.eventSource=null;else{let R=u==="RUNNING";this.isRunning.set(R),R||this.streamingText.set("")}return}if(r.type==="AgentFinishedEvent"){this.isRunning.set(!1),this.streamingText.set("");return}})}catch(r){console.warn("[AgentOS SSE] failed to parse event data",{sseEventName:c,error:r,dataPreview:m?.slice(0,500)})}},n=["MessageEvent","CaseStatusEvent","AgentSelectedEvent","AgentRunningEvent","AgentFinishedEvent","ThinkingEvent","TextChunkEvent","ToolRequestEvent","ToolResponseEvent"];for(let a of n)console.log("[AgentOS SSE] addEventListener",a),this.eventSource.addEventListener(a,t);this.eventSource.onopen=()=>{console.log("[AgentOS SSE] connection open",{readyState:this.eventSource?.readyState,at:new Date().toISOString()})},this.eventSource.onmessage=a=>{console.log("[AgentOS SSE] onmessage (unnamed event) received",{dataLength:a.data?.length??0,dataPreview:a.data?.slice(0,120)})},this.eventSource.onerror=a=>{console.warn("[AgentOS SSE] connection error",{err:a,readyState:this.eventSource?.readyState,at:new Date().toISOString()}),this.zone.run(()=>{this.isRunning.set(!1)})}}onInput(e){this.inputValue.set(e.target.value)}onKeydown(e){e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),this.submit())}reinitialise(){this.eventSource?.close(),this.eventSource=null,this.events.set([]),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 e=this.inputValue().trim();this.inputValue.set(""),this.sendMessage(e)}sendMessage(e){this.isRunning.set(!0),this.streamingText.set(""),this.http.post(`${this.config.basePath}/api/cases/${this.caseId}/messages`,{content:e,userId:"default-user"}).subscribe({error:t=>{console.error("[CaseChat] Failed to send message",t),this.isRunning.set(!1)}})}interrupt(){this.http.post(`${this.config.basePath}/api/cases/${this.caseId}/interrupt`,{}).subscribe({error:e=>console.error("[CaseChat] Failed to interrupt case",e)})}kill(){this.http.post(`${this.config.basePath}/api/cases/${this.caseId}/kill`,{}).subscribe({error:e=>console.error("[CaseChat] Failed to kill case",e)})}extractText(e){return e.content?.filter(t=>"content"in t).map(t=>t.content).join("")??""}extractToolOutput(e){if(!e.response)return null;let t=e.response.output;return t?t.content??null:null}toggleToolCall(e){this.collapsedTools.update(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}isToolCallExpanded(e){return this.collapsedTools().has(e)}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=F({type:o,selectors:[["agentos-case-chat"]],viewQuery:function(t,n){if(t&1&&B(U,5)(J,5),t&2){let a;M(a=O())&&(n.composerInput=a.first),M(a=O())&&(n.messagesContainer=a.first)}},decls:14,vars:7,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"],["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__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__message-author"],[1,"case-chat__message-text"],[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"],[1,"case-chat__tool-call-label"],[1,"case-chat__tool-call-pending"],[1,"case-chat__tool-call-empty"],[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(t,n){t&1&&(i(0,"div",2)(1,"div",3,0),g(3,W,3,0,"div",4)(4,pe,2,0),g(5,me,4,0,"div",5),s(),g(6,_e,2,0,"div",6),i(7,"div",7)(8,"textarea",8,1),f("input",function(_){return n.onInput(_)})("keydown",function(_){return n.onKeydown(_)}),s(),i(10,"div",9),g(11,ue,1,0,"ds-icon-button",10)(12,ge,1,1,"ds-icon-button",11),i(13,"ds-icon-button",12),f("action",function(){return n.kill()}),s()()()()),t&2&&(l(3),h(n.timeline().length===0?3:4),l(2),h(n.isRunning()?5:-1),l(),h(n.isAtBottom()?-1:6),l(2),k("value",n.inputValue())("disabled",n.isRunning()||n.isTerminal()),l(3),h(n.isRunning()?11:12),l(2),k("disabled",n.isTerminal()))},dependencies:[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__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__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--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{j as a};
@@ -1 +1 @@
1
- import{j as l}from"./chunk-NEH5OLEF.js";import{V as o,Z as s,a as n,ca as a,ta as i}from"./chunk-QPN22TF2.js";var u=class t{userController=a(l);currentUser=i(null);loadMe(){return this.userController.getMeUser().pipe(o(r=>this.currentUser.set(r)))}updateMe(r){let e=this.currentUser();if(!e)throw new Error("Cannot update: current user not loaded");if(!e.id)throw new Error("Cannot update: current user has no id");let c=n(n({},e),r);return this.userController.updateUser(e.id,c).pipe(o(d=>this.currentUser.set(d)))}static \u0275fac=function(e){return new(e||t)};static \u0275prov=s({token:t,factory:t.\u0275fac,providedIn:"root"})};export{u as a};
1
+ import{k as l}from"./chunk-ZTTTDVEL.js";import{V as o,Z as s,a as n,ca as a,ta as i}from"./chunk-QPN22TF2.js";var u=class t{userController=a(l);currentUser=i(null);loadMe(){return this.userController.getMeUser().pipe(o(r=>this.currentUser.set(r)))}updateMe(r){let e=this.currentUser();if(!e)throw new Error("Cannot update: current user not loaded");if(!e.id)throw new Error("Cannot update: current user has no id");let c=n(n({},e),r);return this.userController.updateUser(e.id,c).pipe(o(d=>this.currentUser.set(d)))}static \u0275fac=function(e){return new(e||t)};static \u0275prov=s({token:t,factory:t.\u0275fac,providedIn:"root"})};export{u as a};
@@ -0,0 +1 @@
1
+ import{a as X}from"./chunk-UOGHINOM.js";import{a as Y}from"./chunk-QIURQTGU.js";import"./chunk-L7OS7MWE.js";import"./chunk-VKFTCAHS.js";import{g as L}from"./chunk-ZTTTDVEL.js";import{b as R,d as D}from"./chunk-UARV2YUR.js";import{q as W}from"./chunk-F32VEQPY.js";import"./chunk-7YDOHTEK.js";import{a as v,c as x}from"./chunk-WJFUKUVD.js";import"./chunk-2GHS5VUE.js";import"./chunk-DYANOPHQ.js";import{D as Q,c as A,e as y,g as B,h as z,i as G,l as f,n as q,p as j,s as $,u as J,v as U,w as H,x as K}from"./chunk-N5UH5PRX.js";import"./chunk-4YLSQZJK.js";import{Bb as k,Db as u,Fb as p,Ka as a,Tb as l,Ub as b,Vb as F,Wa as N,ca as m,ga as _,ha as h,kb as S,kc as V,lb as I,ma as T,mb as O,pb as M,qb as P,rb as c,sb as i,ta as d,tb as o,ua as w,ub as C}from"./chunk-QPN22TF2.js";function ee(r,e){r&1&&(i(0,"p",5),l(1,"Loading\u2026"),o())}function te(r,e){if(r&1&&(i(0,"label",10),C(1,"input",25),i(2,"span"),l(3),o()()),r&2){let t=e.$implicit,n=p(2);a(),c("value",t.value)("formControl",n.scopeControl)("disabled",t.value==="namespace"&&!n.isAdmin()),a(2),b(t.label)}}function ne(r,e){if(r&1&&(i(0,"option",16),l(1),o()),r&2){let t=e.$implicit;c("value",t.type),a(),b(t.displayName)}}function oe(r,e){if(r&1){let t=k();i(0,"div",21)(1,"ds-json-schema-form",26),u("valueChange",function(s){_(t);let g=p(2);return h(g.onParamsChange(s))}),o()()}if(r&2){let t=p(2);a(),c("schema",e)("value",t.initialParams())}}function ie(r,e){if(r&1){let t=k();i(0,"form",7),u("ngSubmit",function(){_(t);let s=p();return h(s.submit())}),i(1,"fieldset",8)(2,"legend",9),l(3,"Scope"),o(),M(4,te,4,4,"label",10,S().trackByScope,!0),o(),i(6,"div",11)(7,"label",12),l(8,"Type "),i(9,"span",13),l(10,"*"),o()(),i(11,"select",14)(12,"option",15),l(13,"Select type"),o(),M(14,ne,2,2,"option",16,S().trackByType,!0),o()(),i(16,"div",11)(17,"label",17),l(18,"Name "),i(19,"span",13),l(20,"*"),o()(),C(21,"input",18),o(),i(22,"div",11)(23,"label",19),l(24,"Description"),o(),C(25,"textarea",20),o(),I(26,oe,2,2,"div",21),i(27,"div",22)(28,"button",23),l(29),o(),i(30,"button",24),u("click",function(){_(t);let s=p();return h(s.cancel())}),l(31,"Cancel"),o()()()}if(r&2){let t,n=p();c("formGroup",n.form),a(),c("disabled",n.isEditMode()),a(3),P(n.scopeOptions),a(7),c("formControl",n.typeControl),a(3),P(n.integrationTypes()),a(7),c("formControl",n.nameControl),a(4),c("formControl",n.descriptionControl),a(),O((t=n.schema())?26:-1,t),a(2),c("disabled",n.nameControl.invalid||n.typeControl.invalid||n.isSubmitting()),a(),F(" ",n.isEditMode()?"Save changes":"Create"," ")}}var re=new Set(["namespace","userOnNs","userGlobal"]),E=Object.freeze({namespace:"Configuration du namespace",userOnNs:"Pour moi sur ce namespace",userGlobal:"Pour moi globalement"}),Z=class r{route=m(R);router=m(D);destroyRef=m(T);state=m(X);integrationTypeController=m(L);namespaceRole=m(Y);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=x(this.namespaceRole.isAdminOfNamespace$(this.namespaceId),{initialValue:!1});form=new G({name:new f("",{nonNullable:!0,validators:[y.required,y.minLength(1)]}),description:new f(null),type:new f("",{nonNullable:!0,validators:[y.required]}),scope:new f("namespace",{nonNullable:!0})});get nameControl(){return this.form.controls.name}get descriptionControl(){return this.form.controls.description}get typeControl(){return this.form.controls.type}get scopeControl(){return this.form.controls.scope}isEditMode=d(!1);isSubmitting=d(!1);isLoading=d(!1);scopeOptions=[{value:"namespace",label:E.namespace},{value:"userOnNs",label:E.userOnNs},{value:"userGlobal",label:E.userGlobal}];paramsValue=d(null);initialParams=d(null);integrationTypes=x(this.integrationTypeController.listTypesIntegrationType(),{initialValue:[]});selectedType=x(this.form.controls.type.valueChanges,{initialValue:this.form.controls.type.value});schema=V(()=>{let e=this.selectedType();return e?this.integrationTypes().find(n=>n.type===e)?.configSchema??null:null});existingConfig=null;constructor(){w(()=>{this.isAdmin()||this.isEditMode()||this.scopeControl.value==="namespace"&&this.scopeControl.setValue("userOnNs")})}ngOnInit(){this.state.setNamespace(this.namespaceId);let e=this.route.snapshot.paramMap,t=this.route.snapshot.queryParamMap,n=e.get("integrationId"),s=this.parseScope(t.get("scope"));if(n){this.isEditMode.set(!0),this.scopeControl.disable(),this.loadConfig(n);return}this.scopeControl.setValue(s);let g=t.get("template");g&&this.hydrateFromTemplate(g)}parseScope(e){return e&&re.has(e)?e:"namespace"}deriveScopeFromConfig(e){return!e.userId?"namespace":e.namespaceId?"userOnNs":"userGlobal"}loadConfig(e){this.isLoading.set(!0),this.state.getById(e).pipe(v(this.destroyRef)).subscribe({next:t=>{this.existingConfig=t,this.scopeControl.setValue(this.deriveScopeFromConfig(t)),this.applyConfigToForm(t),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1),console.warn(`[IntegrationForm] Could not load config '${e}' \u2014 navigating back`),this.navigateBack()}})}hydrateFromTemplate(e){this.isLoading.set(!0),this.state.getById(e).pipe(v(this.destroyRef)).subscribe({next:t=>{this.applyConfigToForm(t),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})},error:t=>{console.warn(`[IntegrationForm] Could not hydrate from template ${e}:`,t),this.isLoading.set(!1),this.router.navigate([],{relativeTo:this.route,queryParams:{template:null,templateScope:null},queryParamsHandling:"merge",replaceUrl:!0})}})}applyConfigToForm(e){this.nameControl.setValue(e.name),this.descriptionControl.setValue(e.description??null),this.typeControl.setValue(e.integrationType),this.initialParams.set(e.parameters),this.paramsValue.set(e.parameters)}onParamsChange(e){this.paramsValue.set(e)}submit(){if(this.nameControl.invalid||this.typeControl.invalid||this.isSubmitting())return;if(this.isEditMode()&&!this.existingConfig?.id){this.navigateBack();return}this.isSubmitting.set(!0);let e=this.descriptionControl.value?.trim(),t=this.isEditMode()&&this.paramsAreEqual(this.initialParams(),this.paramsValue()),n={name:this.nameControl.value.trim(),description:e||null,integrationType:this.typeControl.value,parameters:t?void 0:this.paramsValue()},s=this.form.getRawValue().scope;(this.isEditMode()&&this.existingConfig?.id?this.state.update(this.existingConfig.id,n,s,this.existingConfig):this.state.create(n,s,this.namespaceId)).pipe(v(this.destroyRef)).subscribe({next:()=>this.navigateBack(),error:()=>this.isSubmitting.set(!1)})}cancel(){this.navigateBack()}navigateBack(){this.router.navigate(["/agentos",this.namespaceId,"integrations"])}trackByType(e,t){return t.type}trackByScope(e,t){return t.value}paramsAreEqual(e,t){return e===t?!0:e===null||t===null?!1:JSON.stringify(e)===JSON.stringify(t)}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=N({type:r,selectors:[["agentos-integration-form"]],decls:10,vars:2,consts:[[1,"integration-form"],[1,"integration-form__header"],["type","button","title","Back to integrations",1,"integration-form__back",3,"click"],[1,"integration-form__back-icon"],[1,"integration-form__title"],[1,"integration-form__loading"],[1,"integration-form__form",3,"formGroup"],[1,"integration-form__form",3,"ngSubmit","formGroup"],[1,"integration-form__field","integration-form__scope",3,"disabled"],[1,"integration-form__label"],[1,"integration-form__scope-option"],[1,"integration-form__field"],["for","integration-type",1,"integration-form__label"],["aria-hidden","true"],["id","integration-type",1,"integration-form__select",3,"formControl"],["value","","disabled",""],[3,"value"],["for","integration-name",1,"integration-form__label"],["id","integration-name","type","text","placeholder","Integration name","autocomplete","off",1,"integration-form__input",3,"formControl"],["for","integration-description",1,"integration-form__label"],["id","integration-description","placeholder","Optional description","rows","3",1,"integration-form__textarea",3,"formControl"],[1,"integration-form__schema-form"],[1,"integration-form__actions"],["type","submit",1,"integration-form__btn","integration-form__btn--primary",3,"disabled"],["type","button",1,"integration-form__btn",3,"click"],["type","radio",3,"value","formControl","disabled"],[3,"valueChange","schema","value"]],template:function(t,n){t&1&&(i(0,"div",0)(1,"header",1)(2,"button",2),u("click",function(){return n.cancel()}),i(3,"span",3),l(4,"\u2190"),o(),l(5," Integrations "),o(),i(6,"h1",4),l(7),o()(),I(8,ee,2,0,"p",5)(9,ie,32,8,"form",6),o()),t&2&&(a(7),b(n.isEditMode()?"Edit integration":"New integration"),a(),O(n.isLoading()?8:9))},dependencies:[Q,q,H,K,A,U,j,B,z,$,J,W],styles:[".integration-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2rem;max-width:560px;margin:0 auto;padding:2rem 1rem}.integration-form__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.integration-form__back[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.integration-form__back[_ngcontent-%COMP%]:hover{text-decoration:underline}.integration-form__back-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.integration-form__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:600;color:var(--color-text, #1d1d1f);letter-spacing:-.02em}.integration-form__loading[_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73);font-size:.9rem;margin:0}.integration-form__form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1.25rem}.integration-form__scope[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;border:1px solid var(--color-border-light, rgba(0, 0, 0, .06));border-radius:10px;padding:.75rem 1rem;background:transparent;margin:0}.integration-form__scope[disabled][_ngcontent-%COMP%]{opacity:.6}.integration-form__scope-option[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;font-size:.875rem;color:var(--color-text, #1d1d1f);cursor:pointer}.integration-form__scope-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin:0}.integration-form__field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.integration-form__label[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text, #1d1d1f)}.integration-form__input[_ngcontent-%COMP%], .integration-form__textarea[_ngcontent-%COMP%], .integration-form__select[_ngcontent-%COMP%]{width:100%;padding:.625rem .875rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;outline:none;box-sizing:border-box;transition:border-color .15s ease}.integration-form__input[_ngcontent-%COMP%]:focus, .integration-form__textarea[_ngcontent-%COMP%]:focus, .integration-form__select[_ngcontent-%COMP%]:focus{border-color:var(--color-primary, #007aff)}.integration-form__input[_ngcontent-%COMP%]::placeholder, .integration-form__textarea[_ngcontent-%COMP%]::placeholder, .integration-form__select[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary, #6e6e73)}.integration-form__textarea[_ngcontent-%COMP%]{resize:vertical;min-height:4.5rem;line-height:1.5}.integration-form__select[_ngcontent-%COMP%]{cursor:pointer}.integration-form__select[_ngcontent-%COMP%] option[disabled][_ngcontent-%COMP%]{color:var(--color-text-secondary, #6e6e73)}.integration-form__schema-form[_ngcontent-%COMP%]{padding:1rem;border-radius:10px;border:1px solid var(--color-border-light, rgba(0, 0, 0, .06));background:var(--glass-bg, rgba(255, 255, 255, .5));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px))}.integration-form__actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding-top:.5rem}.integration-form__btn[_ngcontent-%COMP%]{padding:.6rem 1.25rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:transparent;color:var(--color-text, #1d1d1f);font-size:.9375rem;font-family:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.integration-form__btn[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-surface-hover, rgba(0, 0, 0, .04))}.integration-form__btn[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.integration-form__btn--primary[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff);color:#fff}.integration-form__btn--primary[_ngcontent-%COMP%]:hover:not(:disabled){background:var(--color-primary-hover, #0051d5);border-color:var(--color-primary-hover, #0051d5)}"],changeDetection:0})};export{Z as IntegrationFormComponent};
@@ -1,4 +1,4 @@
1
- import{a as tr}from"./chunk-XDTTR6NK.js";import{a as pn,b as mn,e as nr,g as Ye}from"./chunk-QMQRJWM2.js";import{a as vn}from"./chunk-2NBVMKPO.js";import{a as dn,b as Pe,c as jo,g as Yo,h as Go,i as Xo,m as Qo,n as Zo,p as Ko,r as xn,t as Jo,v as er,w as qe,y as _n}from"./chunk-PK3KWLLW.js";import{a as ir}from"./chunk-4HKHCNH5.js";import{d as Ro}from"./chunk-UARV2YUR.js";import{a as dr}from"./chunk-VIPJVFGJ.js";import{p as lr,r as cr}from"./chunk-WER6464F.js";import{b as Wo,p as or,q as rr,r as ar,v as sr}from"./chunk-7YDOHTEK.js";import{a as qo,b as bn}from"./chunk-UCFKZZMU.js";import{a as J,b as me}from"./chunk-DYANOPHQ.js";import{C as fn,c as un,g as hn,m as gn}from"./chunk-N5UH5PRX.js";import{b as Oe}from"./chunk-NMGDBGR3.js";import{E as Vo,K as Uo,O as je,Q as Bo,R as cn,S as We,i as Fo,j as Lo,p as Ho,s as No,t as zo,z as $o}from"./chunk-4YLSQZJK.js";import{$b as Oo,B as Se,Bb as O,D as en,Db as w,Fb as m,Fc as ln,G as bo,Ga as ue,Ha as Co,Hc as Do,Ic as fi,Ja as yo,Jb as ut,Ka as p,Kb as He,Kc as fe,Lb as Ne,Pa as wo,Rb as he,Sc as Me,T as K,Tb as f,Ub as F,Vb as ht,Vc as Ee,Wa as R,Wb as tn,Xa as To,Xb as nn,Ya as So,Yb as on,Z as Y,Za as ko,Zb as rn,_ as xo,_b as Eo,a as j,ac as Po,b as Te,bc as Io,ca as g,d as N,dc as It,ec as Ao,fc as gi,g as Kt,ga as T,h as xe,ha as S,i as Jt,jb as Be,kc as an,la as _o,lb as x,m as mi,mb as _,n as go,oa as H,pa as vo,pb as de,qb as pe,rb as M,sb as c,t as Ve,ta as Ue,tb as d,u as fo,ub as I,uc as sn,va as ke,vb as ui,wb as hi,xb as Mo,ya as mt}from"./chunk-QPN22TF2.js";var Cn=class i{sanitizer=g(Ee);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=ko({name:"highlight",type:i,pure:!0})};var gt=class i{http=g(Me);projectState=g(Oe);threadState=g(Pe);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,j({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,j({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Y({token:i,factory:i.\u0275fac,providedIn:"root"})};var za=["messageInput"],$a=["fileInput"],Va=(i,e)=>e.name;function Ua(i,e){i&1&&(c(0,"div",3),I(1,"span",8),f(2," Recording... Click mic to stop "),d())}function Ba(i,e){i&1&&(c(0,"div",3),I(1,"span",9),f(2," Transcribing... "),d())}function ja(i,e){if(i&1&&(c(0,"span",14),f(1),d()),i&2){let t=m().$implicit,n=m(2);p(),F(" "+(n.getParameterFormat(t)||""))}}function Wa(i,e){if(i&1){let t=O();c(0,"div",11),w("click",function(){let o=T(t).$index,r=m(2);return S(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=T(t).$index,r=m(2);return S(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=T(t).$index,r=m(2);return S(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=T(t).$index,r=m(2);return S(r.selectedAutocompleteIndex=o)}),c(1,"div",12),I(2,"span",13),It(3,"highlight"),x(4,ja,2,1,"span",14),d(),I(5,"div",15),It(6,"highlight"),d()}if(i&2){let t=e.$implicit,n=e.$index,o=m(2);he("selected",n===o.selectedAutocompleteIndex),Be("aria-selected",n===o.selectedAutocompleteIndex),p(2),M("innerHTML",gi(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),ue),p(2),_(o.hasParameterFormat(t)?4:-1),p(),M("innerHTML",gi(6,9,t.description,o.getAutocompleteQuery()),ue)}}function qa(i,e){if(i&1&&(c(0,"div",4),de(1,Wa,7,12,"div",10,Va),d()),i&2){let t=m();p(),pe(t.autocompleteItems)}}function Ya(i,e){if(i&1){let t=O();c(0,"ds-icon-button",18),w("action",function(){T(t);let o=m(2);return S(o.onStopClick())}),d()}}function Ga(i,e){if(i&1){let t=O();c(0,"ds-icon-button",19),w("action",function(){T(t);let o=m(2);return S(o.sendMessage())}),d()}if(i&2){let t=m(2);he("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),M("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim())}}function Xa(i,e){if(i&1){let t=O();c(0,"ds-icon-button",21),w("action",function(){T(t);let o=m(3);return S(o.triggerFileUpload())}),d(),c(1,"input",22,1),w("change",function(o){T(t);let r=m(3);return S(r.onFileInputChange(o))}),d()}if(i&2){let t=m(3);M("disabled",t.isDisabled)}}function Qa(i,e){if(i&1){let t=O();x(0,Xa,3,1),c(1,"ds-icon-button",20),w("action",function(){T(t);let o=m(2);return S(o.toggleRecording())}),d()}if(i&2){let t=m(2);_(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),p(),he("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),M("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording")}}function Za(i,e){if(i&1&&(c(0,"div",7),x(1,Ya,1,0,"ds-icon-button",16),x(2,Ga,1,6,"ds-icon-button",17),x(3,Qa,2,6),d()),i&2){let t=m();p(),_(t.isThinking?1:-1),p(),_((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),p(),_(t.isThinking?-1:3)}}var yn=class i{isDisabled=!1;showWelcome=!1;isThinking=!1;isStarting=!1;isSessionInitializing=!1;isStopping=!1;filesPasted=new H;messageSubmitted=new H;voiceMessageReady=new H;voiceRecordingToggled=new H;heightChanged=new H;stopRequested=new H;textareaFocused=new H;messageInput;fileInput;message="";isRecording=!1;isTranscribing=!1;isFocused=!1;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=!1;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=!1;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=!1;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=g(qe);codayService=g(Ye);agentApiService=g(tr);promptApiService=g(dr);projectStateService=g(Oe);audioApiService=g(gt);threadStateService=g(Pe);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore()}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200)})}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=!1,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"))}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation()}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case"ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case"ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case"Tab":case"Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case"Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(!0)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(!0)))}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete()}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,a)=>{let l=a.getAsFile();return l?[...r,l]:r},[]);o.length&&this.filesPasted.emit(o)}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click()}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value=""}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete()}sendMessage(e=!1){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0))}onStopClick(){this.isStopping=!0,this.stopRequested.emit()}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording()}startWhisperRecording(){return N(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data)},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio()},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording")}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording")}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=!0;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=!1;return}let a=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=!1,this.voiceMessageReady.emit({base64:o,mimeType:t,language:a});return}this.audioApiService.sendVoiceMessage(o,t,a).subscribe({next:l=>{this.isTranscribing=!1,console.log("[WHISPER] Voice message sent, transcription:",l.transcription?.substring(0,50))},error:l=>{console.error("[WHISPER] Voice message error:",l),this.isTranscribing=!1,this.fallbackToTranscription(o,t,a)}})}else this.audioApiService.transcribeAudio(o,t,a).subscribe({next:l=>{this.isTranscribing=!1,l.text&&this.appendToTextarea(l.text+" ")},error:l=>{console.error("[WHISPER] Transcription error:",l),this.isTranscribing=!1}})},n.readAsDataURL(e)}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=!1,o.text&&this.appendToTextarea(o.text+" ")},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=!1}})}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=!0,this.recognition.interimResults=!0,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0)}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported")}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=!0,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r)}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=!1,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully")},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected")},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended")}}startRecording(){return N(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording")}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(this.isRecording)}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks()}catch(e){console.error("[SPEECH] Failed to stop recording:",e)}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e)}}improveTranscriptPunctuation(e){let t=e;return/[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n)}setTimeout(()=>this.adjustTextareaHeight(),0)}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
1
+ import{a as tr}from"./chunk-XDTTR6NK.js";import{a as pn,b as mn,e as nr,g as Ye}from"./chunk-QMQRJWM2.js";import{a as vn}from"./chunk-2NBVMKPO.js";import{a as dn,b as Pe,c as jo,g as Yo,h as Go,i as Xo,m as Qo,n as Zo,p as Ko,r as xn,t as Jo,v as er,w as qe,y as _n}from"./chunk-PK3KWLLW.js";import{a as ir}from"./chunk-4HKHCNH5.js";import{d as Ro}from"./chunk-UARV2YUR.js";import{a as dr}from"./chunk-VIPJVFGJ.js";import{p as lr,r as cr}from"./chunk-F32VEQPY.js";import{b as Wo,p as or,q as rr,r as ar,v as sr}from"./chunk-7YDOHTEK.js";import{a as qo,c as bn}from"./chunk-WJFUKUVD.js";import{a as J,b as me}from"./chunk-DYANOPHQ.js";import{C as fn,c as un,g as hn,m as gn}from"./chunk-N5UH5PRX.js";import{b as Oe}from"./chunk-NMGDBGR3.js";import{E as Vo,K as Uo,O as je,Q as Bo,R as cn,S as We,i as Fo,j as Lo,p as Ho,s as No,t as zo,z as $o}from"./chunk-4YLSQZJK.js";import{$b as Oo,B as Se,Bb as O,D as en,Db as w,Fb as m,Fc as ln,G as bo,Ga as ue,Ha as Co,Hc as Do,Ic as fi,Ja as yo,Jb as ut,Ka as p,Kb as He,Kc as fe,Lb as Ne,Pa as wo,Rb as he,Sc as Me,T as K,Tb as f,Ub as F,Vb as ht,Vc as Ee,Wa as R,Wb as tn,Xa as To,Xb as nn,Ya as So,Yb as on,Z as Y,Za as ko,Zb as rn,_ as xo,_b as Eo,a as j,ac as Po,b as Te,bc as Io,ca as g,d as N,dc as It,ec as Ao,fc as gi,g as Kt,ga as T,h as xe,ha as S,i as Jt,jb as Be,kc as an,la as _o,lb as x,m as mi,mb as _,n as go,oa as H,pa as vo,pb as de,qb as pe,rb as M,sb as c,t as Ve,ta as Ue,tb as d,u as fo,ub as I,uc as sn,va as ke,vb as ui,wb as hi,xb as Mo,ya as mt}from"./chunk-QPN22TF2.js";var Cn=class i{sanitizer=g(Ee);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=ko({name:"highlight",type:i,pure:!0})};var gt=class i{http=g(Me);projectState=g(Oe);threadState=g(Pe);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,j({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,j({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Y({token:i,factory:i.\u0275fac,providedIn:"root"})};var za=["messageInput"],$a=["fileInput"],Va=(i,e)=>e.name;function Ua(i,e){i&1&&(c(0,"div",3),I(1,"span",8),f(2," Recording... Click mic to stop "),d())}function Ba(i,e){i&1&&(c(0,"div",3),I(1,"span",9),f(2," Transcribing... "),d())}function ja(i,e){if(i&1&&(c(0,"span",14),f(1),d()),i&2){let t=m().$implicit,n=m(2);p(),F(" "+(n.getParameterFormat(t)||""))}}function Wa(i,e){if(i&1){let t=O();c(0,"div",11),w("click",function(){let o=T(t).$index,r=m(2);return S(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=T(t).$index,r=m(2);return S(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=T(t).$index,r=m(2);return S(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=T(t).$index,r=m(2);return S(r.selectedAutocompleteIndex=o)}),c(1,"div",12),I(2,"span",13),It(3,"highlight"),x(4,ja,2,1,"span",14),d(),I(5,"div",15),It(6,"highlight"),d()}if(i&2){let t=e.$implicit,n=e.$index,o=m(2);he("selected",n===o.selectedAutocompleteIndex),Be("aria-selected",n===o.selectedAutocompleteIndex),p(2),M("innerHTML",gi(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),ue),p(2),_(o.hasParameterFormat(t)?4:-1),p(),M("innerHTML",gi(6,9,t.description,o.getAutocompleteQuery()),ue)}}function qa(i,e){if(i&1&&(c(0,"div",4),de(1,Wa,7,12,"div",10,Va),d()),i&2){let t=m();p(),pe(t.autocompleteItems)}}function Ya(i,e){if(i&1){let t=O();c(0,"ds-icon-button",18),w("action",function(){T(t);let o=m(2);return S(o.onStopClick())}),d()}}function Ga(i,e){if(i&1){let t=O();c(0,"ds-icon-button",19),w("action",function(){T(t);let o=m(2);return S(o.sendMessage())}),d()}if(i&2){let t=m(2);he("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),M("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim())}}function Xa(i,e){if(i&1){let t=O();c(0,"ds-icon-button",21),w("action",function(){T(t);let o=m(3);return S(o.triggerFileUpload())}),d(),c(1,"input",22,1),w("change",function(o){T(t);let r=m(3);return S(r.onFileInputChange(o))}),d()}if(i&2){let t=m(3);M("disabled",t.isDisabled)}}function Qa(i,e){if(i&1){let t=O();x(0,Xa,3,1),c(1,"ds-icon-button",20),w("action",function(){T(t);let o=m(2);return S(o.toggleRecording())}),d()}if(i&2){let t=m(2);_(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),p(),he("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),M("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording")}}function Za(i,e){if(i&1&&(c(0,"div",7),x(1,Ya,1,0,"ds-icon-button",16),x(2,Ga,1,6,"ds-icon-button",17),x(3,Qa,2,6),d()),i&2){let t=m();p(),_(t.isThinking?1:-1),p(),_((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),p(),_(t.isThinking?-1:3)}}var yn=class i{isDisabled=!1;showWelcome=!1;isThinking=!1;isStarting=!1;isSessionInitializing=!1;isStopping=!1;filesPasted=new H;messageSubmitted=new H;voiceMessageReady=new H;voiceRecordingToggled=new H;heightChanged=new H;stopRequested=new H;textareaFocused=new H;messageInput;fileInput;message="";isRecording=!1;isTranscribing=!1;isFocused=!1;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=!1;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=!1;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=!1;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=g(qe);codayService=g(Ye);agentApiService=g(tr);promptApiService=g(dr);projectStateService=g(Oe);audioApiService=g(gt);threadStateService=g(Pe);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore()}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200)})}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=!1,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"))}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation()}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case"ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case"ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case"Tab":case"Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case"Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(!0)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(!0)))}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete()}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,a)=>{let l=a.getAsFile();return l?[...r,l]:r},[]);o.length&&this.filesPasted.emit(o)}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click()}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value=""}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete()}sendMessage(e=!1){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0))}onStopClick(){this.isStopping=!0,this.stopRequested.emit()}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording()}startWhisperRecording(){return N(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data)},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio()},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording")}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording")}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=!0;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=!1;return}let a=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=!1,this.voiceMessageReady.emit({base64:o,mimeType:t,language:a});return}this.audioApiService.sendVoiceMessage(o,t,a).subscribe({next:l=>{this.isTranscribing=!1,console.log("[WHISPER] Voice message sent, transcription:",l.transcription?.substring(0,50))},error:l=>{console.error("[WHISPER] Voice message error:",l),this.isTranscribing=!1,this.fallbackToTranscription(o,t,a)}})}else this.audioApiService.transcribeAudio(o,t,a).subscribe({next:l=>{this.isTranscribing=!1,l.text&&this.appendToTextarea(l.text+" ")},error:l=>{console.error("[WHISPER] Transcription error:",l),this.isTranscribing=!1}})},n.readAsDataURL(e)}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=!1,o.text&&this.appendToTextarea(o.text+" ")},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=!1}})}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=!0,this.recognition.interimResults=!0,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0)}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported")}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=!0,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r)}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=!1,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully")},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected")},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended")}}startRecording(){return N(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording")}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(this.isRecording)}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks()}catch(e){console.error("[SPEECH] Failed to stop recording:",e)}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e)}}improveTranscriptPunctuation(e){let t=e;return/[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n)}setTimeout(()=>this.adjustTextareaHeight(),0)}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
2
2
 
3
3
  `),this.sessionHadTranscript=!1),this.pendingLineBreaksTimeout=null},500)}clearPendingLineBreaks(){this.pendingLineBreaksTimeout&&(clearTimeout(this.pendingLineBreaksTimeout),this.pendingLineBreaksTimeout=null)}adjustTextareaHeight(){let e=this.messageInput?.nativeElement;if(!e)return;let t=e.parentElement?.offsetHeight??e.offsetHeight+32;this.heightChanged.emit(t)}getSendButtonShortcut(){return this.useEnterToSend?"Enter":navigator.platform.toLowerCase().includes("mac")?"\u2318+Enter":"Ctrl+Enter"}getSendButtonTooltip(){return this.useEnterToSend?"Send message (Enter) - Shift+Enter for new line":`Send message (${navigator.platform.toLowerCase().includes("mac")?"Cmd+Enter":"Ctrl+Enter"}) - Enter for new line`}getPlaceholder(){return this.isSessionInitializing?"Initializing session...":this.isThinking?this.isStopping?"Stopping...":this.isStarting?"Processing request...":this.currentThinkingPhrase:this.isVoiceMessageMode&&this.isTranscribing?"Uploading...":this.isVoiceMessageMode&&this.isRecording?"Listening...":this.showWelcome?"How can I help you today?":"Type '@' for agents, '/' for commands, or just your message..."}startThinkingAnimation(){this.thinkingPhraseIndex=0,this.currentThinkingPhrase=this.thinkingPhrases[0]??"Thinking...",this.thinkingInterval=window.setInterval(()=>{this.thinkingPhraseIndex<this.thinkingPhrases.length-1&&(this.thinkingPhraseIndex++,this.currentThinkingPhrase=this.thinkingPhrases[this.thinkingPhraseIndex]??"Thinking...")},2e3)}stopThinkingAnimation(){this.thinkingInterval&&(clearInterval(this.thinkingInterval),this.thinkingInterval=null),this.thinkingPhraseIndex=0,this.currentThinkingPhrase="Thinking..."}subscribeToInviteEvents(){this.subscriptions.push(this.codayService.currentInviteEvent$.subscribe(e=>{e?this.handleInviteEvent(e.invite,e.defaultValue):this.currentInvite=""}))}handleInviteEvent(e,t){this.currentInvite=e,t&&(this.message=t,setTimeout(()=>this.adjustTextareaHeight(),0)),setTimeout(()=>{this.messageInput?.nativeElement&&this.messageInput.nativeElement.focus()},50)}subscribeToMessageRestore(){this.subscriptions.push(this.codayService.messageToRestore$.subscribe(e=>{e.trim()&&(console.log("[CHAT-TEXTAREA] Restoring message content:",e.substring(0,50)+"..."),this.restoreMessageContent(e))}))}restoreMessageContent(e){this.message=e,this.messageInput?.nativeElement&&(this.messageInput.nativeElement.focus(),setTimeout(()=>{let t=this.messageInput.nativeElement,n=this.message.length;t.setSelectionRange(n,n)},0)),setTimeout(()=>this.adjustTextareaHeight(),10)}focusTextarea(){let e=this.messageInput?.nativeElement;console.log("[CHAT-TEXTAREA] focusTextarea called",{hasElement:!!e,isDisabled:this.isDisabled,isThinking:this.isThinking,elementDisabled:e?.disabled,isSessionInitializing:this.isSessionInitializing}),e&&!e.disabled?(e.focus(),console.log("[CHAT-TEXTAREA] Textarea focused successfully")):console.log("[CHAT-TEXTAREA] Focus blocked - element disabled or not available")}checkForAutocomplete(){let e=this.message;if(e.startsWith("@")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showAgentAutocomplete(t);return}if(e.startsWith("/")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showPromptAutocomplete(t);return}this.hideAutocomplete()}showAgentAutocomplete(e){this.autocompleteTrigger="@";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.agentApiService.getAgentsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0},error:n=>{console.error("[AUTOCOMPLETE] Error loading agents:",n),this.hideAutocomplete()}})}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load agents"),this.hideAutocomplete()}}showPromptAutocomplete(e){this.autocompleteTrigger="/";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.promptApiService.getPromptsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0},error:n=>{console.error("[AUTOCOMPLETE] Error loading prompts:",n),this.hideAutocomplete()}})}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load prompts"),this.hideAutocomplete()}}hideAutocomplete(){this.autocompleteVisible=!1,this.autocompleteItems=[],this.selectedAutocompleteIndex=0}selectAutocompleteItem(){let e=this.autocompleteItems[this.selectedAutocompleteIndex];if(!e)return;let t=null;if(this.autocompleteTrigger==="/"){let n=e,o=n.parameterFormat;if(console.log(n),o===void 0)this.message=`/${e.name}`;else if(o==="")this.message=`/${e.name} `;else{this.message=`/${e.name} ${o}`;let r=this.message.indexOf('=""');r!==-1&&(t=r+2)}}else this.message=`@${e.name} `;this.hideAutocomplete(),setTimeout(()=>{if(this.messageInput?.nativeElement)if(this.messageInput.nativeElement.focus(),t!==null)this.messageInput.nativeElement.setSelectionRange(t,t);else{let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n)}},0)}selectAutocompleteItemByClick(e){this.selectedAutocompleteIndex=e,this.selectAutocompleteItem()}getAutocompleteQuery(){return this.message.substring(1).split(" ")[0]??""}getParameterFormat(e){return e.parameterFormat}hasParameterFormat(e){return this.autocompleteTrigger==="/"&&e.parameterFormat!==void 0}scrollSelectedItemIntoView(){setTimeout(()=>{let e=document.querySelector(".autocomplete-popup");if(!e)return;let t=e.querySelector(".autocomplete-item.selected");t&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},0)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=R({type:i,selectors:[["app-chat-textarea"]],viewQuery:function(t,n){if(t&1&&ut(za,7)($a,5),t&2){let o;He(o=Ne())&&(n.messageInput=o.first),He(o=Ne())&&(n.fileInput=o.first)}},hostBindings:function(t,n){t&1&&w("paste",function(r){return n.onPaste(r)})("click",function(r){return n.onDocumentClick(r)},yo)},inputs:{isDisabled:"isDisabled",showWelcome:"showWelcome",isThinking:"isThinking",isStarting:"isStarting",isSessionInitializing:"isSessionInitializing"},outputs:{filesPasted:"filesPasted",messageSubmitted:"messageSubmitted",voiceMessageReady:"voiceMessageReady",voiceRecordingToggled:"voiceRecordingToggled",heightChanged:"heightChanged",stopRequested:"stopRequested",textareaFocused:"textareaFocused"},features:[ke],decls:8,vars:15,consts:[["messageInput",""],["fileInput",""],[1,"chat-input-container"],[1,"recording-indicator"],[1,"autocomplete-popup"],[1,"input-row","grouped-input"],[1,"message-input",3,"ngModelChange","keydown","input","focus","blur","ngModel","placeholder","disabled"],[1,"actions"],[1,"recording-dot"],[1,"transcribing-dot"],["role","option","tabindex","0",1,"autocomplete-item",3,"selected"],["role","option","tabindex","0",1,"autocomplete-item",3,"click","keydown.enter","keydown.space","mouseenter"],[1,"item-name"],[3,"innerHTML"],[1,"parameter-format"],[1,"item-description",3,"innerHTML"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn"],["icon","send","variant","primary",1,"send-btn",3,"title","disabled","hidden","active"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn",3,"action"],["icon","send","variant","primary",1,"send-btn",3,"action","title","disabled"],["icon","mic",1,"voice-btn",3,"action","variant","disabled","title"],["icon","attach_file","variant","default","title","Upload files (images or documents)",1,"upload-btn",3,"action","disabled"],["type","file","multiple","","accept","image/*,application/pdf,.pdf,.doc,.docx,.txt,.md,.json,.yaml,.yml,.csv,.xml,.html",2,"display","none",3,"change"]],template:function(t,n){if(t&1){let o=O();c(0,"div",2),x(1,Ua,3,0,"div",3),x(2,Ba,3,0,"div",3),x(3,qa,3,0,"div",4),c(4,"div",5)(5,"textarea",6,0),rn("ngModelChange",function(a){return T(o),on(n.message,a)||(n.message=a),S(a)}),w("keydown",function(a){return n.onKeyDown(a)})("input",function(){return n.onInput()})("focus",function(){return T(o),n.isFocused=!0,S(n.textareaFocused.emit())})("blur",function(){return n.isFocused=!1}),d(),x(7,Za,4,3,"div",7),d()()}t&2&&(p(),_(!n.isVoiceMessageMode&&n.isRecording?1:-1),p(),_(!n.isVoiceMessageMode&&n.isTranscribing?2:-1),p(),_(n.autocompleteVisible?3:-1),p(),he("focused",n.isFocused)("welcome-mode",n.showWelcome)("is-thinking",n.isThinking)("is-listening",n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),p(),nn("ngModel",n.message),M("placeholder",n.getPlaceholder())("disabled",n.isDisabled||n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),p(2),_(n.isSessionInitializing?-1:7))},dependencies:[fn,un,hn,gn,lr,Cn],styles:['@keyframes _ngcontent-%COMP%_gradientBorderShift{0%{background-position:0 0}50%{background-position:100% 0}to{background-position:0 0}}.chat-input-container[_ngcontent-%COMP%]{flex-shrink:0;width:100%;position:relative}.thinking-progress[_ngcontent-%COMP%]{position:absolute;top:0;left:0;right:0;height:3px;z-index:1}.thinking-progress[_ngcontent-%COMP%] .mdc-linear-progress__bar-inner{border-top-width:3px}.input-row.grouped-input[_ngcontent-%COMP%]{display:flex;align-items:stretch;background:var(--glass-bg);border-radius:16px;padding:0 .15rem 0 1.25rem;position:relative;transition:border-color .2s,box-shadow .2s,background .3s}.input-row[_ngcontent-%COMP%]{position:relative;background:var(--glass-bg, #1e1e1e)!important;background-clip:padding-box}.input-row[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:-2px;border-radius:inherit;background-size:200% 100%;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;padding:1px;pointer-events:none;z-index:-1;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-error, #ef4444) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-error, #ef4444) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 2s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-listening[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.is-thinking[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-thinking[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-thinking[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking):before{background:var(--color-primary);animation:none}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking){box-shadow:0 0 0 4px #007aff1a}.message-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent!important;box-shadow:none;font-size:1rem;padding:1rem 0;color:var(--color-text);resize:none;field-sizing:content;min-height:36px;max-height:70vh;overflow-y:auto;font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,system-ui,sans-serif;line-height:1.5}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.message-input[_ngcontent-%COMP%]:focus{outline:none;border:none;box-shadow:none}.message-input[_ngcontent-%COMP%]:disabled{background-color:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;opacity:.6}.message-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);transition:opacity .3s ease-in-out}.message-input[_ngcontent-%COMP%]:disabled::placeholder{animation:_ngcontent-%COMP%_thinkingPulsate 2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_thinkingPulsate{0%,to{opacity:.6}50%{opacity:1}}.voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%]{margin:0}.actions[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:wrap;justify-content:center}.send-btn[_ngcontent-%COMP%]{transition:opacity .4s,margin-left .4s}.send-btn.active[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{opacity:1}.send-btn[_ngcontent-%COMP%]:not(.active) button[_ngcontent-%COMP%]{opacity:0;margin-left:calc(-.5rem - 36px)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){color:#fff;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-primary, #3b82f6) 20%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 80%,var(--color-primary, #3b82f6) 100%);background-size:300% auto;animation:sendButtonGradientShift 6s ease-in-out infinite;box-shadow:0 4px 14px #007aff30;transform:scale(1.2)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:active:not(:disabled){transform:scale(1.3);box-shadow:0 4px 24px #007aff30}.recording-indicator[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-top:.2rem;margin-bottom:.2rem;color:var(--color-error, #ff5555);font-size:.9rem;position:absolute;top:-1.5rem}@keyframes _ngcontent-%COMP%_pulse{0%,to{opacity:1}50%{opacity:.5}}.autocomplete-popup[_ngcontent-%COMP%]{position:absolute;bottom:100%;left:0;right:0;margin-bottom:.5rem;background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);border-radius:12px;box-shadow:0 8px 32px #00000026;border:1px solid var(--color-border);max-height:400px;max-width:500px;overflow-y:auto;z-index:100}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]{padding:.75rem 1rem;cursor:pointer;transition:background .2s;border-left:3px solid transparent}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]:hover, .autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{background:var(--color-bg-hover)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{border-left-color:var(--color-primary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%]{font-weight:600;color:var(--color-text);margin-bottom:.25rem;font-family:SF Mono,Monaco,Menlo,Cascadia Code,Consolas,monospace;font-size:.95rem}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1));padding:0 2px;border-radius:2px}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] .parameter-format[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-weight:400;opacity:.7}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);line-height:1.3}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1))}@media print{.thinking-progress[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%], .recording-indicator[_ngcontent-%COMP%], .autocomplete-popup[_ngcontent-%COMP%]{display:none!important}}']})};var ft=class i{unreadCountSubject=new Jt(0);unreadCount$=this.unreadCountSubject.asObservable();constructor(){console.log("[UNREAD] Service initialized")}addUnread(){let t=this.unreadCountSubject.value+1;this.unreadCountSubject.next(t),console.log("[UNREAD] Added unread message, total:",t)}markAllAsRead(){this.unreadCountSubject.value>0&&(this.unreadCountSubject.next(0),console.log("[UNREAD] Marked all messages as read"))}getCurrentCount(){return this.unreadCountSubject.value}reset(){this.unreadCountSubject.next(0),console.log("[UNREAD] Counter reset")}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Y({token:i,factory:i.\u0275fac,providedIn:"root"})};var wn=class i{ATTENTION_EMOJI="\u{1F534}";isSystemActive=!1;systemActiveTimer=null;SYSTEM_ACTIVE_TIMEOUT=4e3;unreadService=g(ft);project=g(Oe);constructor(){this.initializeTitleUpdates()}initializeTitleUpdates(){fo([this.project.selectedProject$,this.unreadService.unreadCount$]).subscribe(([e,t])=>{this.updateTitle(e?.name??"...",t)})}updateTitle(e,t){let n;this.isSystemActive?n=`\u23F3${t>0?` (${t}) `:" "}${e}`:t>0?n=`${this.ATTENTION_EMOJI} (${t}) ${e}`:n=e,document.title=n,console.log("[TAB-TITLE] Updated to:",n)}setSystemActive(){console.log("[TAB-TITLE] System active - showing hourglass"),this.isSystemActive=!0,this.systemActiveTimer&&clearTimeout(this.systemActiveTimer),this.systemActiveTimer=setTimeout(()=>{console.log("[TAB-TITLE] System active timeout - hiding hourglass"),this.isSystemActive=!1,this.forceUpdateTitle()},this.SYSTEM_ACTIVE_TIMEOUT),this.forceUpdateTitle()}setSystemInactive(){console.log("[TAB-TITLE] System inactive - hiding hourglass"),this.isSystemActive=!1,this.systemActiveTimer&&(clearTimeout(this.systemActiveTimer),this.systemActiveTimer=null),this.forceUpdateTitle()}forceUpdateTitle(){let e=this.project.getSelectedProjectId()??"...",t=this.unreadService.getCurrentCount();this.updateTitle(e,t)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Y({token:i,factory:i.\u0275fac,providedIn:"root"})};var Tn=class i{pendingFirstMessage=null;pendingVoiceMessage=null;setPendingFirstMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=e}consumePendingFirstMessage(){let e=this.pendingFirstMessage;return e?(console.log("[FIRST-MESSAGE-STATE] Consuming pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=null):console.log("[FIRST-MESSAGE-STATE] No pending first message to consume"),e}setPendingVoiceMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending voice message"),this.pendingVoiceMessage=e}consumePendingVoiceMessage(){let e=this.pendingVoiceMessage;return e&&(console.log("[FIRST-MESSAGE-STATE] Consuming pending voice message"),this.pendingVoiceMessage=null),e}hasPendingFirstMessage(){return this.pendingFirstMessage!==null||this.pendingVoiceMessage!==null}clear(){this.pendingFirstMessage&&(console.log("[FIRST-MESSAGE-STATE] Clearing pending first message"),this.pendingFirstMessage=null),this.pendingVoiceMessage=null}static \u0275fac=function(t){return new(t||i)};static \u0275prov=Y({token:i,factory:i.\u0275fac,providedIn:"root"})};var Ka=(i,e)=>e.label;function Ja(i,e){if(i&1){let t=O();c(0,"button",2),w("click",function(o){let r=T(t).$implicit,a=m();return S(a.executeAction(r,o))}),c(1,"mat-icon"),f(2),d()()}if(i&2){let t=e.$implicit;Be("title",t.tooltip||t.label),p(),Be("aria-label",t.label),p(),F(t.icon)}}var Sn=class i{actions=[];executeAction(e,t){t.stopPropagation(),e.action()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=R({type:i,selectors:[["app-message-context-menu"]],inputs:{actions:"actions"},decls:3,vars:0,consts:[[1,"context-menu-wrapper"],["mat-icon-button",""],["mat-icon-button","",3,"click"]],template:function(t,n){t&1&&(c(0,"div",0),de(1,Ja,3,3,"button",1,Ka),d()),t&2&&(p(),pe(n.actions))},dependencies:[fe,je,J],styles:[".context-menu-wrapper[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center}.context-menu-wrapper[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{transform:scale(.75)}"]})};function vi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var nt=vi();function br(i){nt=i}var Ft={exec:()=>null};function A(i,e=""){let t=typeof i=="string"?i:i.source,n={replace:(o,r)=>{let a=typeof r=="string"?r:r.source;return a=a.replace(oe.caret,"$1"),t=t.replace(o,a),n},getRegex:()=>new RegExp(t,e)};return n}var oe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i")},es=/^(?:[ \t]*(?:\n|$))+/,ts=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ns=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Lt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,is=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ci=/(?:[*+-]|\d{1,9}[.)])/,xr=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_r=A(xr).replace(/bull/g,Ci).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),os=A(xr).replace(/bull/g,Ci).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),yi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,rs=/^[^\n]+/,wi=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,as=A(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",wi).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ss=A(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ci).getRegex(),On="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ti=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ls=A("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ti).replace("tag",On).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vr=A(yi).replace("hr",Lt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",On).getRegex(),cs=A(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",vr).getRegex(),Si={blockquote:cs,code:ts,def:as,fences:ns,heading:is,hr:Lt,html:ls,lheading:_r,list:ss,newline:es,paragraph:vr,table:Ft,text:rs},pr=A("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Lt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",On).getRegex(),ds=Te(j({},Si),{lheading:os,table:pr,paragraph:A(yi).replace("hr",Lt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",pr).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",On).getRegex()}),ps=Te(j({},Si),{html:A(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ti).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ft,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:A(yi).replace("hr",Lt).replace("heading",` *#{1,6} *[^
4
4
  ]`).replace("lheading",_r).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),ms=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,us=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Cr=/^( {2,}|\\)\n(?!\s*$)/,hs=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Pn=/[\p{P}\p{S}]/u,ki=/[\s\p{P}\p{S}]/u,yr=/[^\s\p{P}\p{S}]/u,gs=A(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ki).getRegex(),wr=/(?!~)[\p{P}\p{S}]/u,fs=/(?!~)[\s\p{P}\p{S}]/u,bs=/(?:[^\s\p{P}\p{S}]|~)/u,xs=/\[(?:[^\[\]`]|`[^`]*?`)*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,Tr=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,_s=A(Tr,"u").replace(/punct/g,Pn).getRegex(),vs=A(Tr,"u").replace(/punct/g,wr).getRegex(),Sr="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Cs=A(Sr,"gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,ki).replace(/punct/g,Pn).getRegex(),ys=A(Sr,"gu").replace(/notPunctSpace/g,bs).replace(/punctSpace/g,fs).replace(/punct/g,wr).getRegex(),ws=A("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,ki).replace(/punct/g,Pn).getRegex(),Ts=A(/\\(punct)/,"gu").replace(/punct/g,Pn).getRegex(),Ss=A(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ks=A(Ti).replace("(?:-->|$)","-->").getRegex(),Ms=A("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ks).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Mn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Es=A(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Mn).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kr=A(/^!?\[(label)\]\[(ref)\]/).replace("label",Mn).replace("ref",wi).getRegex(),Mr=A(/^!?\[(ref)\](?:\[\])?/).replace("ref",wi).getRegex(),Os=A("reflink|nolink(?!\\()","g").replace("reflink",kr).replace("nolink",Mr).getRegex(),mr=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Mi={_backpedal:Ft,anyPunctuation:Ts,autolink:Ss,blockSkip:xs,br:Cr,code:us,del:Ft,emStrongLDelim:_s,emStrongRDelimAst:Cs,emStrongRDelimUnd:ws,escape:ms,link:Es,nolink:Mr,punctuation:gs,reflink:kr,reflinkSearch:Os,tag:Ms,text:hs,url:Ft},Ps=Te(j({},Mi),{link:A(/^!?\[(label)\]\((.*?)\)/).replace("label",Mn).getRegex(),reflink:A(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Mn).getRegex()}),bi=Te(j({},Mi),{emStrongRDelimAst:ys,emStrongLDelim:vs,url:A(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",mr).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:A(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",mr).getRegex()}),Is=Te(j({},bi),{br:A(Cr).replace("{2,}","*").getRegex(),text:A(bi.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),kn={normal:Si,gfm:ds,pedantic:ps},At={normal:Mi,gfm:bi,breaks:Is,pedantic:Ps},As={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ur=i=>As[i];function Ie(i,e){if(e){if(oe.escapeTest.test(i))return i.replace(oe.escapeReplace,ur)}else if(oe.escapeTestNoEncode.test(i))return i.replace(oe.escapeReplaceNoEncode,ur);return i}function hr(i){try{i=encodeURI(i).replace(oe.percentDecode,"%")}catch(e){return null}return i}function gr(i,e){let t=i.replace(oe.findPipe,(r,a,l)=>{let u=!1,b=a;for(;--b>=0&&l[b]==="\\";)u=!u;return u?"|":" |"}),n=t.split(oe.splitPipe),o=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;o<n.length;o++)n[o]=n[o].trim().replace(oe.slashPipe,"|");return n}function Dt(i,e,t){let n=i.length;if(n===0)return"";let o=0;for(;o<n;){let r=i.charAt(n-o-1);if(r===e&&!t)o++;else if(r!==e&&t)o++;else break}return i.slice(0,n-o)}function Ds(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<i.length;n++)if(i[n]==="\\")n++;else if(i[n]===e[0])t++;else if(i[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function fr(i,e,t,n,o){let r=e.href,a=e.title||null,l=i[1].replace(o.other.outputLinkReplace,"$1");n.state.inLink=!0;let u={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:r,title:a,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,u}function Rs(i,e,t){let n=i.match(t.other.indentCodeCompensation);if(n===null)return e;let o=n[1];return e.split(`
@@ -0,0 +1 @@
1
+ import{T as p,W as d,ca as a,g as f,j as g,jc as b,ka as m,kc as D,ma as u,ta as l,ua as y}from"./chunk-QPN22TF2.js";function E(n){n||(n=a(u));let e=new f(t=>{if(n.destroyed){t.next();return}return n.onDestroy(t.next.bind(t))});return t=>t.pipe(p(e))}function U(n,e){let t=e?.injector??a(m),o=new g(1),c=y(()=>{let r;try{r=n()}catch(i){b(()=>o.error(i));return}b(()=>o.next(r))},{injector:t,manualCleanup:!0});return t.get(u).onDestroy(()=>{c.destroy(),o.complete()}),o.asObservable()}function T(n,e){let o=!e?.manualCleanup?e?.injector?.get(u)??a(u):null,c=w(e?.equal),r;e?.requireSync?r=l({kind:0},{equal:c}):r=l({kind:1,value:e?.initialValue},{equal:c});let i,v=n.subscribe({next:s=>r.set({kind:1,value:s}),error:s=>{r.set({kind:2,error:s}),i?.()},complete:()=>{i?.()}});if(e?.requireSync&&r().kind===0)throw new d(601,!1);return i=o?.onDestroy(v.unsubscribe.bind(v)),D(()=>{let s=r();switch(s.kind){case 1:return s.value;case 2:throw s.error;case 0:throw new d(601,!1)}},{equal:e?.equal})}function w(n=Object.is){return(e,t)=>e.kind===1&&t.kind===1&&n(e.value,t.value)}export{E as a,U as b,T as c};
@@ -0,0 +1 @@
1
+ import{c as a}from"./chunk-H7MV7NCQ.js";import"./chunk-XV6SOT4A.js";import"./chunk-VKFTCAHS.js";import"./chunk-ZTTTDVEL.js";import"./chunk-UARV2YUR.js";import"./chunk-F32VEQPY.js";import"./chunk-7YDOHTEK.js";import"./chunk-WJFUKUVD.js";import"./chunk-2GHS5VUE.js";import"./chunk-DYANOPHQ.js";import"./chunk-N5UH5PRX.js";import"./chunk-4YLSQZJK.js";import"./chunk-QPN22TF2.js";export{a as CaseShellComponent};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-P7CSUKFY.js";import"./chunk-ZTTTDVEL.js";import"./chunk-UARV2YUR.js";import"./chunk-F32VEQPY.js";import"./chunk-7YDOHTEK.js";import"./chunk-WJFUKUVD.js";import"./chunk-2GHS5VUE.js";import"./chunk-DYANOPHQ.js";import"./chunk-N5UH5PRX.js";import"./chunk-4YLSQZJK.js";import"./chunk-QPN22TF2.js";export{a as CaseHomeComponent};
@@ -1 +1 @@
1
- import{a as w}from"./chunk-GHZFCBZI.js";import{i as M}from"./chunk-NEH5OLEF.js";import{d as O}from"./chunk-UARV2YUR.js";import{a as S}from"./chunk-UCFKZZMU.js";import{Db as u,Fb as k,Ka as a,Rb as x,Tb as l,Ub as P,Wa as d,ca as i,lb as p,ma as f,mb as m,rb as v,sb as r,ta as h,tb as s,ub as b,vb as y,wb as C,xb as g}from"./chunk-QPN22TF2.js";function H(e,t){e&1&&g(0,"span",1)}function D(e,t){e&1&&g(0,"span",2)}function B(e,t){e&1&&g(0,"span",3)}var _=class e{pluginService=i(M);online=h(null);ngOnInit(){this.pluginService.getAllPlugins().subscribe({next:()=>this.online.set(!0),error:()=>this.online.set(!1)})}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=d({type:e,selectors:[["agentos-backend-status"]],decls:4,vars:1,consts:[[1,"backend-status"],["title","AgentOS online",1,"dot","dot--online"],["title","AgentOS offline",1,"dot","dot--offline"],["title","Checking\u2026",1,"dot","dot--checking"]],template:function(n,o){if(n&1&&(y(0,"div",0),p(1,H,1,0,"span",1)(2,D,1,0,"span",2)(3,B,1,0,"span",3),C()),n&2){let c;a(),m((c=o.online())===!0?1:c===!1?2:3)}},styles:[".backend-status[_ngcontent-%COMP%]{display:flex;align-items:center}.dot[_ngcontent-%COMP%]{width:8px;height:8px;border-radius:50%;flex-shrink:0}.dot--online[_ngcontent-%COMP%]{background:var(--color-success, #34c759)}.dot--offline[_ngcontent-%COMP%]{background:var(--color-error, #ff3b30)}.dot--checking[_ngcontent-%COMP%]{background:var(--color-text-secondary, #6e6e73);opacity:.5;animation:_ngcontent-%COMP%_pulse 1.2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_pulse{0%,to{opacity:.5}50%{opacity:1}}"]})};function U(e,t){if(e&1&&(r(0,"span",8),l(1),s()),e&2){let n=k();a(),P(n.userInitials)}}function A(e,t){e&1&&(r(0,"span",9),l(1,"\u25EF"),s())}var E=class e{router=i(O);userState=i(w);destroyRef=i(f);currentUser=this.userState.currentUser;navigateHome(){this.router.navigate(["/agentos"])}navigateToAdmin(){this.router.navigate(["/agentos/admin/users"])}ngOnInit(){this.currentUser()||this.userState.loadMe().pipe(S(this.destroyRef)).subscribe()}get userInitials(){let t=this.currentUser();if(!t)return"";let n=t.firstname?.[0]??"",o=t.lastname?.[0]??"";return(n+o).toUpperCase()||t.email?.[0]?.toUpperCase()||"?"}get isOnProfilePage(){return this.router.url.startsWith("/agentos/me")}toggleProfile(){this.isOnProfilePage?window.history.length>1?window.history.back():this.router.navigate(["/agentos"]):this.router.navigate(["/agentos/me"])}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=d({type:e,selectors:[["agentos-header"]],decls:13,vars:4,consts:[[1,"header"],["type","button","title","Home",1,"header__brand",3,"click"],["src","CODAY-Logo.png","alt","Coday",1,"header__logo-img"],[1,"header__logo-text"],[1,"header__nav"],["type","button","title","Admin",1,"header__admin-btn",3,"click"],[1,"header__admin-icon"],["type","button",1,"header__user-btn",3,"click","title"],[1,"header__user-initials"],[1,"header__user-icon"]],template:function(n,o){n&1&&(r(0,"header",0)(1,"button",1),u("click",function(){return o.navigateHome()}),b(2,"img",2),r(3,"span",3),l(4,"Coday"),s()(),r(5,"nav",4),b(6,"agentos-backend-status"),r(7,"button",5),u("click",function(){return o.navigateToAdmin()}),r(8,"span",6),l(9,"\u2699\uFE0F"),s()(),r(10,"button",7),u("click",function(){return o.toggleProfile()}),p(11,U,2,1,"span",8)(12,A,2,0,"span",9),s()()()),n&2&&(a(10),x("header__user-btn--active",o.isOnProfilePage),v("title",o.isOnProfilePage?"Back":"My profile"),a(),m(o.userInitials?11:12))},dependencies:[_],styles:[".header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:0 1.5rem;height:56px;background:var(--glass-bg, rgba(255, 255, 255, .72));border-bottom: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));position:sticky;top:0;z-index:100}.header__brand[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;background:none;border:none;padding:0;cursor:pointer;border-radius:6px;transition:opacity .15s ease}.header__brand[_ngcontent-%COMP%]:hover{opacity:.7}.header__logo-img[_ngcontent-%COMP%]{width:24px;height:24px;object-fit:contain}.header__logo-text[_ngcontent-%COMP%]{font-size:1rem;font-weight:600;letter-spacing:-.02em;color:var(--color-text, #1d1d1f)}.header__nav[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.header__admin-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;border:1.5px solid var(--color-border, rgba(0, 0, 0, .1));background:var(--color-bg-secondary, rgba(0, 0, 0, .04));cursor:pointer;transition:background .15s ease,border-color .15s ease;padding:0;font-family:inherit;font-size:1rem;line-height:1}.header__admin-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .08));border-color:var(--color-primary, #007aff)}.header__admin-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.header__user-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;border:1.5px solid var(--color-border, rgba(0, 0, 0, .1));background:var(--color-bg-secondary, rgba(0, 0, 0, .04));cursor:pointer;transition:background .15s ease,border-color .15s ease;padding:0;font-family:inherit}.header__user-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .08));border-color:var(--color-primary, #007aff)}.header__user-btn--active[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff)}.header__user-btn--active[_ngcontent-%COMP%] .header__user-initials[_ngcontent-%COMP%], .header__user-btn--active[_ngcontent-%COMP%] .header__user-icon[_ngcontent-%COMP%]{color:#fff}.header__user-initials[_ngcontent-%COMP%]{font-size:.75rem;font-weight:600;color:var(--color-text, #1d1d1f);line-height:1;letter-spacing:.02em}.header__user-icon[_ngcontent-%COMP%]{font-size:1rem;color:var(--color-text-secondary, #6e6e73);line-height:1}"]})};export{_ as a,E as b};
1
+ import{a as w}from"./chunk-VKFTCAHS.js";import{j as M}from"./chunk-ZTTTDVEL.js";import{d as O}from"./chunk-UARV2YUR.js";import{a as S}from"./chunk-WJFUKUVD.js";import{Db as u,Fb as k,Ka as a,Rb as x,Tb as l,Ub as P,Wa as d,ca as i,lb as p,ma as f,mb as m,rb as v,sb as r,ta as h,tb as s,ub as b,vb as y,wb as C,xb as g}from"./chunk-QPN22TF2.js";function H(e,t){e&1&&g(0,"span",1)}function D(e,t){e&1&&g(0,"span",2)}function B(e,t){e&1&&g(0,"span",3)}var _=class e{pluginService=i(M);online=h(null);ngOnInit(){this.pluginService.getAllPlugins().subscribe({next:()=>this.online.set(!0),error:()=>this.online.set(!1)})}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=d({type:e,selectors:[["agentos-backend-status"]],decls:4,vars:1,consts:[[1,"backend-status"],["title","AgentOS online",1,"dot","dot--online"],["title","AgentOS offline",1,"dot","dot--offline"],["title","Checking\u2026",1,"dot","dot--checking"]],template:function(n,o){if(n&1&&(y(0,"div",0),p(1,H,1,0,"span",1)(2,D,1,0,"span",2)(3,B,1,0,"span",3),C()),n&2){let c;a(),m((c=o.online())===!0?1:c===!1?2:3)}},styles:[".backend-status[_ngcontent-%COMP%]{display:flex;align-items:center}.dot[_ngcontent-%COMP%]{width:8px;height:8px;border-radius:50%;flex-shrink:0}.dot--online[_ngcontent-%COMP%]{background:var(--color-success, #34c759)}.dot--offline[_ngcontent-%COMP%]{background:var(--color-error, #ff3b30)}.dot--checking[_ngcontent-%COMP%]{background:var(--color-text-secondary, #6e6e73);opacity:.5;animation:_ngcontent-%COMP%_pulse 1.2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_pulse{0%,to{opacity:.5}50%{opacity:1}}"]})};function U(e,t){if(e&1&&(r(0,"span",8),l(1),s()),e&2){let n=k();a(),P(n.userInitials)}}function A(e,t){e&1&&(r(0,"span",9),l(1,"\u25EF"),s())}var E=class e{router=i(O);userState=i(w);destroyRef=i(f);currentUser=this.userState.currentUser;navigateHome(){this.router.navigate(["/agentos"])}navigateToAdmin(){this.router.navigate(["/agentos/admin/users"])}ngOnInit(){this.currentUser()||this.userState.loadMe().pipe(S(this.destroyRef)).subscribe()}get userInitials(){let t=this.currentUser();if(!t)return"";let n=t.firstname?.[0]??"",o=t.lastname?.[0]??"";return(n+o).toUpperCase()||t.email?.[0]?.toUpperCase()||"?"}get isOnProfilePage(){return this.router.url.startsWith("/agentos/me")}toggleProfile(){this.isOnProfilePage?window.history.length>1?window.history.back():this.router.navigate(["/agentos"]):this.router.navigate(["/agentos/me"])}static \u0275fac=function(n){return new(n||e)};static \u0275cmp=d({type:e,selectors:[["agentos-header"]],decls:13,vars:4,consts:[[1,"header"],["type","button","title","Home",1,"header__brand",3,"click"],["src","CODAY-Logo.png","alt","Coday",1,"header__logo-img"],[1,"header__logo-text"],[1,"header__nav"],["type","button","title","Admin",1,"header__admin-btn",3,"click"],[1,"header__admin-icon"],["type","button",1,"header__user-btn",3,"click","title"],[1,"header__user-initials"],[1,"header__user-icon"]],template:function(n,o){n&1&&(r(0,"header",0)(1,"button",1),u("click",function(){return o.navigateHome()}),b(2,"img",2),r(3,"span",3),l(4,"Coday"),s()(),r(5,"nav",4),b(6,"agentos-backend-status"),r(7,"button",5),u("click",function(){return o.navigateToAdmin()}),r(8,"span",6),l(9,"\u2699\uFE0F"),s()(),r(10,"button",7),u("click",function(){return o.toggleProfile()}),p(11,U,2,1,"span",8)(12,A,2,0,"span",9),s()()()),n&2&&(a(10),x("header__user-btn--active",o.isOnProfilePage),v("title",o.isOnProfilePage?"Back":"My profile"),a(),m(o.userInitials?11:12))},dependencies:[_],styles:[".header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:0 1.5rem;height:56px;background:var(--glass-bg, rgba(255, 255, 255, .72));border-bottom: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));position:sticky;top:0;z-index:100}.header__brand[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;background:none;border:none;padding:0;cursor:pointer;border-radius:6px;transition:opacity .15s ease}.header__brand[_ngcontent-%COMP%]:hover{opacity:.7}.header__logo-img[_ngcontent-%COMP%]{width:24px;height:24px;object-fit:contain}.header__logo-text[_ngcontent-%COMP%]{font-size:1rem;font-weight:600;letter-spacing:-.02em;color:var(--color-text, #1d1d1f)}.header__nav[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.header__admin-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;border:1.5px solid var(--color-border, rgba(0, 0, 0, .1));background:var(--color-bg-secondary, rgba(0, 0, 0, .04));cursor:pointer;transition:background .15s ease,border-color .15s ease;padding:0;font-family:inherit;font-size:1rem;line-height:1}.header__admin-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .08));border-color:var(--color-primary, #007aff)}.header__admin-icon[_ngcontent-%COMP%]{font-size:1rem;line-height:1}.header__user-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;border:1.5px solid var(--color-border, rgba(0, 0, 0, .1));background:var(--color-bg-secondary, rgba(0, 0, 0, .04));cursor:pointer;transition:background .15s ease,border-color .15s ease;padding:0;font-family:inherit}.header__user-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .08));border-color:var(--color-primary, #007aff)}.header__user-btn--active[_ngcontent-%COMP%]{background:var(--color-primary, #007aff);border-color:var(--color-primary, #007aff)}.header__user-btn--active[_ngcontent-%COMP%] .header__user-initials[_ngcontent-%COMP%], .header__user-btn--active[_ngcontent-%COMP%] .header__user-icon[_ngcontent-%COMP%]{color:#fff}.header__user-initials[_ngcontent-%COMP%]{font-size:.75rem;font-weight:600;color:var(--color-text, #1d1d1f);line-height:1;letter-spacing:.02em}.header__user-icon[_ngcontent-%COMP%]{font-size:1rem;color:var(--color-text-secondary, #6e6e73);line-height:1}"]})};export{_ as a,E as b};
@@ -0,0 +1 @@
1
+ import{Pc as Q,Qc as u,Rc as V,Sc as j,Z as m,a as b,aa as L,b as f,ba as x,ca as R,da as K,g as k,pa as z}from"./chunk-QPN22TF2.js";var y=class{apiKeys;username;password;accessToken;basePath;withCredentials;encoder;encodeParam;credentials;constructor({accessToken:C,apiKeys:n,basePath:o,credentials:p,encodeParam:r,encoder:t,password:e,username:i,withCredentials:l}={}){n&&(this.apiKeys=n),i!==void 0&&(this.username=i),e!==void 0&&(this.password=e),C!==void 0&&(this.accessToken=C),o!==void 0&&(this.basePath=o),l!==void 0&&(this.withCredentials=l),t&&(this.encoder=t),this.encodeParam=r??(a=>this.defaultEncodeParam(a)),this.credentials=p??{}}selectHeaderContentType(C){if(C.length===0)return;let n=C.find(o=>this.isJsonMime(o));return n===void 0?C[0]:n}selectHeaderAccept(C){if(C.length===0)return;let n=C.find(o=>this.isJsonMime(o));return n===void 0?C[0]:n}isJsonMime(C){let n=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return C!==null&&(n.test(C)||C.toLowerCase()==="application/json-patch+json")}lookupCredential(C){let n=this.credentials[C];return typeof n=="function"?n():n}addCredentialToHeaders(C,n,o,p){let r=this.lookupCredential(C);return r?o.set(n,(p??"")+r):o}addCredentialToQuery(C,n,o){let p=this.lookupCredential(C);return p?o.set(n,p):o}defaultEncodeParam(C){let n=C.dataFormat==="date-time"&&C.value instanceof Date?C.value.toISOString():C.value;return encodeURIComponent(String(n))}};var v=new L("basePath");var O=class{encodeKey(C){return encodeURIComponent(C)}encodeValue(C){return encodeURIComponent(C)}decodeKey(C){return decodeURIComponent(C)}decodeValue(C){return decodeURIComponent(C)}};var P=class{basePath="http://localhost:8124";defaultHeaders=new Q;configuration;encoder;constructor(C,n){if(this.configuration=n||new y,typeof this.configuration.basePath!="string"){let o=Array.isArray(C)?C[0]:void 0;o!=null&&(C=o),typeof C!="string"&&(C=this.basePath),this.configuration.basePath=C}this.encoder=this.configuration.encoder||new O}canConsumeForm(C){return C.indexOf("multipart/form-data")!==-1}addToHttpParams(C,n,o,p=!1){return typeof n=="object"&&!(n instanceof Date)?this.addToHttpParamsRecursive(C,n,p?o:void 0,p):this.addToHttpParamsRecursive(C,n,o)}addToHttpParamsRecursive(C,n,o,p=!1){if(n==null)return C;if(typeof n=="object"){if(o!=null)return p?Object.keys(n).reduce((r,t)=>r.append(`${o}[${t}]`,n[t]),C):C.append(o,JSON.stringify(n));if(Array.isArray(n))n.forEach(r=>C=this.addToHttpParamsRecursive(C,r,o));else if(n instanceof Date)if(o!=null)C=C.append(o,n.toISOString());else throw Error("key may not be null if value is Date");else Object.keys(n).forEach(r=>{let t=o?`${o}.${r}`:r;C=this.addToHttpParamsRecursive(C,n[r],t)});return C}else if(o!=null)return C.append(o,n);throw Error("key may not be null if value is not object or array")}};var E=class H extends P{constructor(n,o,p){super(o,p);this.httpClient=n}createAgentConfig(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter agentConfig was null or undefined when calling createAgentConfig.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/agent-configs",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}deleteAgentConfig(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling deleteAgentConfig.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/agent-configs/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdAgentConfig(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling getByIdAgentConfig.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/agent-configs/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdsAgentConfig(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIdsAgentConfig.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/agent-configs/by-ids",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}listByParentAgentConfig(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter parentId was null or undefined when calling listByParentAgentConfig.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/agent-configs/by-parentId/${this.configuration.encodeParam({name:"parentId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}searchAgentConfig(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter agentConfigSearchRequest was null or undefined when calling searchAgentConfig.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/agent-configs/search",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}updateAgentConfig(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter id was null or undefined when calling updateAgentConfig.");if(o==null)throw new Error("Required parameter agentConfig was null or undefined when calling updateAgentConfig.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d=["application/json"],s=this.configuration.selectHeaderContentType(d);s!==void 0&&(e=e.set("Content-Type",s));let c="json";i&&(i.startsWith("text")?c="text":this.configuration.isJsonMime(i)?c="json":c="blob");let g=`/api/agent-configs/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:h,withCredentials:A}=this.configuration;return this.httpClient.request("put",`${h}${g}`,f(b({context:l,body:o,responseType:c},A?{withCredentials:A}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}static \u0275fac=function(o){return new(o||H)(x(j),x(v,8),x(y,8))};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};var q=class H extends P{constructor(n,o,p){super(o,p);this.httpClient=n}createAiModel(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter aiModel was null or undefined when calling createAiModel.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/ai-models",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}deleteAiModel(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling deleteAiModel.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/ai-models/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdAiModel(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling getByIdAiModel.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/ai-models/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdsAiModel(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIdsAiModel.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/ai-models/by-ids",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}listByNamespaceIdAiModel(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter namespaceId was null or undefined when calling listByNamespaceIdAiModel.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/ai-models/by-namespaceId/${this.configuration.encodeParam({name:"namespaceId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}listByParentAiModel(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter parentId was null or undefined when calling listByParentAiModel.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/ai-models/by-parentId/${this.configuration.encodeParam({name:"parentId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}updateAiModel(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter id was null or undefined when calling updateAiModel.");if(o==null)throw new Error("Required parameter aiModel was null or undefined when calling updateAiModel.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d=["application/json"],s=this.configuration.selectHeaderContentType(d);s!==void 0&&(e=e.set("Content-Type",s));let c="json";i&&(i.startsWith("text")?c="text":this.configuration.isJsonMime(i)?c="json":c="blob");let g=`/api/ai-models/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:h,withCredentials:A}=this.configuration;return this.httpClient.request("put",`${h}${g}`,f(b({context:l,body:o,responseType:c},A?{withCredentials:A}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}static \u0275fac=function(o){return new(o||H)(x(j),x(v,8),x(y,8))};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};var $=class H extends P{constructor(n,o,p){super(o,p);this.httpClient=n}createAiProvider(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter aiProvider was null or undefined when calling createAiProvider.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/ai-providers",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}deleteAiProvider(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling deleteAiProvider.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/ai-providers/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdAiProvider(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling getByIdAiProvider.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/ai-providers/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdsAiProvider(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIdsAiProvider.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/ai-providers/by-ids",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}listAiProvider(n,o,p="body",r=!1,t){let e=new V({encoder:this.encoder});e=this.addToHttpParams(e,n,"namespaceId"),e=this.addToHttpParams(e,o,"userId");let i=this.defaultHeaders,l=t?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);l!==void 0&&(i=i.set("Accept",l));let a=t?.context??new u,d=t?.transferCache??!0,s="json";l&&(l.startsWith("text")?s="text":this.configuration.isJsonMime(l)?s="json":s="blob");let c="/api/ai-providers",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("get",`${g}${c}`,f(b({context:a,params:e,responseType:s},h?{withCredentials:h}:{}),{headers:i,observe:p,transferCache:d,reportProgress:r}))}updateAiProvider(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter id was null or undefined when calling updateAiProvider.");if(o==null)throw new Error("Required parameter aiProvider was null or undefined when calling updateAiProvider.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d=["application/json"],s=this.configuration.selectHeaderContentType(d);s!==void 0&&(e=e.set("Content-Type",s));let c="json";i&&(i.startsWith("text")?c="text":this.configuration.isJsonMime(i)?c="json":c="blob");let g=`/api/ai-providers/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:h,withCredentials:A}=this.configuration;return this.httpClient.request("put",`${h}${g}`,f(b({context:l,body:o,responseType:c},A?{withCredentials:A}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}static \u0275fac=function(o){return new(o||H)(x(j),x(v,8),x(y,8))};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};var M=class H extends P{constructor(n,o,p){super(o,p);this.httpClient=n}addMessageCase(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter caseId was null or undefined when calling addMessageCase.");if(o==null)throw new Error("Required parameter addMessageRequest was null or undefined when calling addMessageCase.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d=["application/json"],s=this.configuration.selectHeaderContentType(d);s!==void 0&&(e=e.set("Content-Type",s));let c="json";i&&(i.startsWith("text")?c="text":this.configuration.isJsonMime(i)?c="json":c="blob");let g=`/api/cases/${this.configuration.encodeParam({name:"caseId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/messages`,{basePath:h,withCredentials:A}=this.configuration;return this.httpClient.request("post",`${h}${g}`,f(b({context:l,body:o,responseType:c},A?{withCredentials:A}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}createCase(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter _case was null or undefined when calling createCase.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/cases",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}deleteCase(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling deleteCase.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdCase(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling getByIdCase.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdsCase(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIdsCase.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/cases/by-ids",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}interruptCase(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter caseId was null or undefined when calling interruptCase.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"caseId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/interrupt`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}killCase(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter caseId was null or undefined when calling killCase.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"caseId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/kill`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}listByParentCase(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter parentId was null or undefined when calling listByParentCase.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/by-parentId/${this.configuration.encodeParam({name:"parentId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}updateCase(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter id was null or undefined when calling updateCase.");if(o==null)throw new Error("Required parameter _case was null or undefined when calling updateCase.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d=["application/json"],s=this.configuration.selectHeaderContentType(d);s!==void 0&&(e=e.set("Content-Type",s));let c="json";i&&(i.startsWith("text")?c="text":this.configuration.isJsonMime(i)?c="json":c="blob");let g=`/api/cases/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:h,withCredentials:A}=this.configuration;return this.httpClient.request("put",`${h}${g}`,f(b({context:l,body:o,responseType:c},A?{withCredentials:A}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}static \u0275fac=function(o){return new(o||H)(x(j),x(v,8),x(y,8))};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};var S=class H extends P{constructor(n,o,p){super(o,p);this.httpClient=n}createIntegrationConfig(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter integrationConfig was null or undefined when calling createIntegrationConfig.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/integration-configs",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}deleteIntegrationConfig(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling deleteIntegrationConfig.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/integration-configs/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdIntegrationConfig(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling getByIdIntegrationConfig.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/integration-configs/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdsIntegrationConfig(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIdsIntegrationConfig.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/integration-configs/by-ids",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}listIntegrationConfig(n,o,p="body",r=!1,t){let e=new V({encoder:this.encoder});e=this.addToHttpParams(e,n,"namespaceId"),e=this.addToHttpParams(e,o,"userId");let i=this.defaultHeaders,l=t?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);l!==void 0&&(i=i.set("Accept",l));let a=t?.context??new u,d=t?.transferCache??!0,s="json";l&&(l.startsWith("text")?s="text":this.configuration.isJsonMime(l)?s="json":s="blob");let c="/api/integration-configs",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("get",`${g}${c}`,f(b({context:a,params:e,responseType:s},h?{withCredentials:h}:{}),{headers:i,observe:p,transferCache:d,reportProgress:r}))}updateIntegrationConfig(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter id was null or undefined when calling updateIntegrationConfig.");if(o==null)throw new Error("Required parameter integrationConfig was null or undefined when calling updateIntegrationConfig.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d=["application/json"],s=this.configuration.selectHeaderContentType(d);s!==void 0&&(e=e.set("Content-Type",s));let c="json";i&&(i.startsWith("text")?c="text":this.configuration.isJsonMime(i)?c="json":c="blob");let g=`/api/integration-configs/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:h,withCredentials:A}=this.configuration;return this.httpClient.request("put",`${h}${g}`,f(b({context:l,body:o,responseType:c},A?{withCredentials:A}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}static \u0275fac=function(o){return new(o||H)(x(j),x(v,8),x(y,8))};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};var B=class H extends P{constructor(n,o,p){super(o,p);this.httpClient=n}getTypeIntegrationType(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter type was null or undefined when calling getTypeIntegrationType.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/integration-types/${this.configuration.encodeParam({name:"type",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}listTypesIntegrationType(n="body",o=!1,p){let r=this.defaultHeaders,t=p?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);t!==void 0&&(r=r.set("Accept",t));let e=p?.context??new u,i=p?.transferCache??!0,l="json";t&&(t.startsWith("text")?l="text":this.configuration.isJsonMime(t)?l="json":l="blob");let a="/api/integration-types",{basePath:d,withCredentials:s}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(b({context:e,responseType:l},s?{withCredentials:s}:{}),{headers:r,observe:n,transferCache:i,reportProgress:o}))}static \u0275fac=function(o){return new(o||H)(x(j),x(v,8),x(y,8))};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};var U=class H extends P{constructor(n,o,p){super(o,p);this.httpClient=n}createNamespace(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter namespace was null or undefined when calling createNamespace.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/namespaces",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}deleteNamespace(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling deleteNamespace.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/namespaces/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}deployAgentsNamespace(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter namespaceId was null or undefined when calling deployAgentsNamespace.");if(o==null)throw new Error("Required parameter namespaceAgentDeployRequest was null or undefined when calling deployAgentsNamespace.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d=["application/json"],s=this.configuration.selectHeaderContentType(d);s!==void 0&&(e=e.set("Content-Type",s));let c="json";i&&(i.startsWith("text")?c="text":this.configuration.isJsonMime(i)?c="json":c="blob");let g=`/api/namespaces/${this.configuration.encodeParam({name:"namespaceId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/deploy-agents`,{basePath:h,withCredentials:A}=this.configuration;return this.httpClient.request("post",`${h}${g}`,f(b({context:l,body:o,responseType:c},A?{withCredentials:A}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}getByIdNamespace(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling getByIdNamespace.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/namespaces/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdsNamespace(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIdsNamespace.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/namespaces/by-ids",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}listAllNamespace(n="body",o=!1,p){let r=this.defaultHeaders,t=p?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);t!==void 0&&(r=r.set("Accept",t));let e=p?.context??new u,i=p?.transferCache??!0,l="json";t&&(t.startsWith("text")?l="text":this.configuration.isJsonMime(t)?l="json":l="blob");let a="/api/namespaces",{basePath:d,withCredentials:s}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(b({context:e,responseType:l},s?{withCredentials:s}:{}),{headers:r,observe:n,transferCache:i,reportProgress:o}))}listByExternalIdsNamespace(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter requestBody was null or undefined when calling listByExternalIdsNamespace.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/namespaces/by-external-ids",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}listByParentNamespace(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter parentId was null or undefined when calling listByParentNamespace.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/namespaces/by-parentId/${this.configuration.encodeParam({name:"parentId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}undeployAgentsNamespace(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter namespaceId was null or undefined when calling undeployAgentsNamespace.");if(o==null)throw new Error("Required parameter namespaceAgentDeployRequest was null or undefined when calling undeployAgentsNamespace.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d=["application/json"],s=this.configuration.selectHeaderContentType(d);s!==void 0&&(e=e.set("Content-Type",s));let c="json";i&&(i.startsWith("text")?c="text":this.configuration.isJsonMime(i)?c="json":c="blob");let g=`/api/namespaces/${this.configuration.encodeParam({name:"namespaceId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/undeploy-agents`,{basePath:h,withCredentials:A}=this.configuration;return this.httpClient.request("post",`${h}${g}`,f(b({context:l,body:o,responseType:c},A?{withCredentials:A}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}updateNamespace(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter id was null or undefined when calling updateNamespace.");if(o==null)throw new Error("Required parameter namespace was null or undefined when calling updateNamespace.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d=["application/json"],s=this.configuration.selectHeaderContentType(d);s!==void 0&&(e=e.set("Content-Type",s));let c="json";i&&(i.startsWith("text")?c="text":this.configuration.isJsonMime(i)?c="json":c="blob");let g=`/api/namespaces/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:h,withCredentials:A}=this.configuration;return this.httpClient.request("put",`${h}${g}`,f(b({context:l,body:o,responseType:c},A?{withCredentials:A}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}static \u0275fac=function(o){return new(o||H)(x(j),x(v,8),x(y,8))};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};var Y=(p=>(p.OpenAI="OpenAI",p.Anthropic="Anthropic",p.Gemini="Gemini",p.vLLM="vLLM",p))(Y||{});var N=class H extends P{constructor(n,o,p){super(o,p);this.httpClient=n}getByIdCaseEventRest(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling getByIdCaseEventRest.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/case-events/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdsCaseEventRest(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIdsCaseEventRest.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/case-events/by-ids",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}listByCaseCaseEventRest(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter caseId was null or undefined when calling listByCaseCaseEventRest.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/case-events/by-parentId/${this.configuration.encodeParam({name:"caseId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}static \u0275fac=function(o){return new(o||H)(x(j),x(v,8),x(y,8))};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};var G=class H extends P{constructor(n,o,p){super(o,p);this.httpClient=n}grantAdmin(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter namespaceId was null or undefined when calling grantAdmin.");if(o==null)throw new Error("Required parameter targetUserId was null or undefined when calling grantAdmin.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d="json";i&&(i.startsWith("text")?d="text":this.configuration.isJsonMime(i)?d="json":d="blob");let s=`/api/namespaces/${this.configuration.encodeParam({name:"namespaceId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/admins/${this.configuration.encodeParam({name:"targetUserId",value:o,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:c,withCredentials:g}=this.configuration;return this.httpClient.request("put",`${c}${s}`,f(b({context:l,responseType:d},g?{withCredentials:g}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}grantMember(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter namespaceId was null or undefined when calling grantMember.");if(o==null)throw new Error("Required parameter targetUserId was null or undefined when calling grantMember.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d="json";i&&(i.startsWith("text")?d="text":this.configuration.isJsonMime(i)?d="json":d="blob");let s=`/api/namespaces/${this.configuration.encodeParam({name:"namespaceId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/members/${this.configuration.encodeParam({name:"targetUserId",value:o,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:c,withCredentials:g}=this.configuration;return this.httpClient.request("put",`${c}${s}`,f(b({context:l,responseType:d},g?{withCredentials:g}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}listNamespaceUsers(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter namespaceId was null or undefined when calling listNamespaceUsers.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/namespaces/${this.configuration.encodeParam({name:"namespaceId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/users`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}revokeAdmin(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter namespaceId was null or undefined when calling revokeAdmin.");if(o==null)throw new Error("Required parameter targetUserId was null or undefined when calling revokeAdmin.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d="json";i&&(i.startsWith("text")?d="text":this.configuration.isJsonMime(i)?d="json":d="blob");let s=`/api/namespaces/${this.configuration.encodeParam({name:"namespaceId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/admins/${this.configuration.encodeParam({name:"targetUserId",value:o,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:c,withCredentials:g}=this.configuration;return this.httpClient.request("delete",`${c}${s}`,f(b({context:l,responseType:d},g?{withCredentials:g}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}revokeMember(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter namespaceId was null or undefined when calling revokeMember.");if(o==null)throw new Error("Required parameter targetUserId was null or undefined when calling revokeMember.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d="json";i&&(i.startsWith("text")?d="text":this.configuration.isJsonMime(i)?d="json":d="blob");let s=`/api/namespaces/${this.configuration.encodeParam({name:"namespaceId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/members/${this.configuration.encodeParam({name:"targetUserId",value:o,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:c,withCredentials:g}=this.configuration;return this.httpClient.request("delete",`${c}${s}`,f(b({context:l,responseType:d},g?{withCredentials:g}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}static \u0275fac=function(o){return new(o||H)(x(j),x(v,8),x(y,8))};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};var J=class H extends P{constructor(n,o,p){super(o,p);this.httpClient=n}debugAllPlugins(n="body",o=!1,p){let r=this.defaultHeaders,t=p?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);t!==void 0&&(r=r.set("Accept",t));let e=p?.context??new u,i=p?.transferCache??!0,l="json";t&&(t.startsWith("text")?l="text":this.configuration.isJsonMime(t)?l="json":l="blob");let a="/api/plugins/debug",{basePath:d,withCredentials:s}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(b({context:e,responseType:l},s?{withCredentials:s}:{}),{headers:r,observe:n,transferCache:i,reportProgress:o}))}debugPlugin(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter pluginId was null or undefined when calling debugPlugin.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/debug`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getAllPlugins(n="body",o=!1,p){let r=this.defaultHeaders,t=p?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);t!==void 0&&(r=r.set("Accept",t));let e=p?.context??new u,i=p?.transferCache??!0,l="json";t&&(t.startsWith("text")?l="text":this.configuration.isJsonMime(t)?l="json":l="blob");let a="/api/plugins",{basePath:d,withCredentials:s}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(b({context:e,responseType:l},s?{withCredentials:s}:{}),{headers:r,observe:n,transferCache:i,reportProgress:o}))}getPlugin(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter pluginId was null or undefined when calling getPlugin.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}reloadAllAgentsPlugin(n="body",o=!1,p){let r=this.defaultHeaders,t=p?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);t!==void 0&&(r=r.set("Accept",t));let e=p?.context??new u,i=p?.transferCache??!0,l="json";t&&(t.startsWith("text")?l="text":this.configuration.isJsonMime(t)?l="json":l="blob");let a="/api/plugins/reload-agents",{basePath:d,withCredentials:s}=this.configuration;return this.httpClient.request("post",`${d}${a}`,f(b({context:e,responseType:l},s?{withCredentials:s}:{}),{headers:r,observe:n,transferCache:i,reportProgress:o}))}reloadPlugin(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter pluginId was null or undefined when calling reloadPlugin.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/reload`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}startPlugin(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter pluginId was null or undefined when calling startPlugin.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/start`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}stopPlugin(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter pluginId was null or undefined when calling stopPlugin.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/stop`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}unloadPlugin(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter pluginId was null or undefined when calling unloadPlugin.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}uploadPlugin(n="body",o=!1,p){let r=this.defaultHeaders,t=p?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);t!==void 0&&(r=r.set("Accept",t));let e=p?.context??new u,i=p?.transferCache??!0,l="json";t&&(t.startsWith("text")?l="text":this.configuration.isJsonMime(t)?l="json":l="blob");let a="/api/plugins/upload",{basePath:d,withCredentials:s}=this.configuration;return this.httpClient.request("post",`${d}${a}`,f(b({context:e,responseType:l},s?{withCredentials:s}:{}),{headers:r,observe:n,transferCache:i,reportProgress:o}))}static \u0275fac=function(o){return new(o||H)(x(j),x(v,8),x(y,8))};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};var W=class H extends P{constructor(n,o,p){super(o,p);this.httpClient=n}streamEventsCaseEventSse(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter caseId was null or undefined when calling streamEventsCaseEventSse.");let e=new V({encoder:this.encoder});e=this.addToHttpParams(e,o,"live");let i=this.defaultHeaders,l=t?.httpHeaderAccept??this.configuration.selectHeaderAccept(["text/event-stream"]);l!==void 0&&(i=i.set("Accept",l));let a=t?.context??new u,d=t?.transferCache??!0,s="json";l&&(l.startsWith("text")?s="text":this.configuration.isJsonMime(l)?s="json":s="blob");let c=`/api/cases/${this.configuration.encodeParam({name:"caseId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/events`,{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("get",`${g}${c}`,f(b({context:a,params:e,responseType:s},h?{withCredentials:h}:{}),{headers:i,observe:p,transferCache:d,reportProgress:r}))}static \u0275fac=function(o){return new(o||H)(x(j),x(v,8),x(y,8))};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};var F=class H extends P{constructor(n,o,p){super(o,p);this.httpClient=n}createUser(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter user was null or undefined when calling createUser.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/users",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}deleteUser(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling deleteUser.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/users/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdUser(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter id was null or undefined when calling getByIdUser.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/users/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdsUser(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIdsUser.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/users/by-ids",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getGroupsByExternalIdsUser(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter requestBody was null or undefined when calling getGroupsByExternalIdsUser.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/users/groups-by-external-ids",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getMeUser(n="body",o=!1,p){let r=this.defaultHeaders,t=p?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);t!==void 0&&(r=r.set("Accept",t));let e=p?.context??new u,i=p?.transferCache??!0,l="json";t&&(t.startsWith("text")?l="text":this.configuration.isJsonMime(t)?l="json":l="blob");let a="/api/users/me",{basePath:d,withCredentials:s}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(b({context:e,responseType:l},s?{withCredentials:s}:{}),{headers:r,observe:n,transferCache:i,reportProgress:o}))}listAllUser(n="body",o=!1,p){let r=this.defaultHeaders,t=p?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);t!==void 0&&(r=r.set("Accept",t));let e=p?.context??new u,i=p?.transferCache??!0,l="json";t&&(t.startsWith("text")?l="text":this.configuration.isJsonMime(t)?l="json":l="blob");let a="/api/users",{basePath:d,withCredentials:s}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(b({context:e,responseType:l},s?{withCredentials:s}:{}),{headers:r,observe:n,transferCache:i,reportProgress:o}))}listByParentUser(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter parentId was null or undefined when calling listByParentUser.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/users/by-parentId/${this.configuration.encodeParam({name:"parentId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}updateUser(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter id was null or undefined when calling updateUser.");if(o==null)throw new Error("Required parameter user was null or undefined when calling updateUser.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d=["application/json"],s=this.configuration.selectHeaderContentType(d);s!==void 0&&(e=e.set("Content-Type",s));let c="json";i&&(i.startsWith("text")?c="text":this.configuration.isJsonMime(i)?c="json":c="blob");let g=`/api/users/${this.configuration.encodeParam({name:"id",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:h,withCredentials:A}=this.configuration;return this.httpClient.request("put",`${h}${g}`,f(b({context:l,body:o,responseType:c},A?{withCredentials:A}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}static \u0275fac=function(o){return new(o||H)(x(j),x(v,8),x(y,8))};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};var _=class H extends P{constructor(n,o,p){super(o,p);this.httpClient=n}createUserGroup(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter userGroupCreateRequest was null or undefined when calling createUserGroup.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(t=t.set("Content-Type",d));let s="json";e&&(e.startsWith("text")?s="text":this.configuration.isJsonMime(e)?s="json":s="blob");let c="/api/user-groups",{basePath:g,withCredentials:h}=this.configuration;return this.httpClient.request("post",`${g}${c}`,f(b({context:i,body:n,responseType:s},h?{withCredentials:h}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}deleteUserGroup(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter userGroupId was null or undefined when calling deleteUserGroup.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/user-groups/${this.configuration.encodeParam({name:"userGroupId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}getByIdUserGroup(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter userGroupId was null or undefined when calling getByIdUserGroup.");let t=this.defaultHeaders,e=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(t=t.set("Accept",e));let i=r?.context??new u,l=r?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/user-groups/${this.configuration.encodeParam({name:"userGroupId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:s,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${s}${d}`,f(b({context:i,responseType:a},c?{withCredentials:c}:{}),{headers:t,observe:o,transferCache:l,reportProgress:p}))}searchByNamespaceExternalIdUserGroup(n,o="body",p=!1,r){if(n==null)throw new Error("Required parameter namespaceExternalId was null or undefined when calling searchByNamespaceExternalIdUserGroup.");let t=new V({encoder:this.encoder});t=this.addToHttpParams(t,n,"namespaceExternalId");let e=this.defaultHeaders,i=r?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);i!==void 0&&(e=e.set("Accept",i));let l=r?.context??new u,a=r?.transferCache??!0,d="json";i&&(i.startsWith("text")?d="text":this.configuration.isJsonMime(i)?d="json":d="blob");let s="/api/user-groups",{basePath:c,withCredentials:g}=this.configuration;return this.httpClient.request("get",`${c}${s}`,f(b({context:l,params:t,responseType:d},g?{withCredentials:g}:{}),{headers:e,observe:o,transferCache:a,reportProgress:p}))}updateUserGroup(n,o,p="body",r=!1,t){if(n==null)throw new Error("Required parameter userGroupId was null or undefined when calling updateUserGroup.");if(o==null)throw new Error("Required parameter userGroupUpdateRequest was null or undefined when calling updateUserGroup.");let e=this.defaultHeaders,i=t?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);i!==void 0&&(e=e.set("Accept",i));let l=t?.context??new u,a=t?.transferCache??!0,d=["application/json"],s=this.configuration.selectHeaderContentType(d);s!==void 0&&(e=e.set("Content-Type",s));let c="json";i&&(i.startsWith("text")?c="text":this.configuration.isJsonMime(i)?c="json":c="blob");let g=`/api/user-groups/${this.configuration.encodeParam({name:"userGroupId",value:n,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:h,withCredentials:A}=this.configuration;return this.httpClient.request("post",`${h}${g}`,f(b({context:l,body:o,responseType:c},A?{withCredentials:A}:{}),{headers:e,observe:p,transferCache:a,reportProgress:r}))}static \u0275fac=function(o){return new(o||H)(x(j),x(v,8),x(y,8))};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};function Mr(H){return K([typeof H=="string"?{provide:v,useValue:H}:{provide:y,useValue:new y(b({},H))}])}var D=class H{config=R(y);zone=R(z);connect(C){let n=`${this.config.basePath}/api/cases/${C}/events`;return new k(o=>{let p=this.zone.runOutsideAngular(()=>new EventSource(n));return p.onmessage=r=>{try{let t=JSON.parse(r.data);this.zone.run(()=>o.next(t))}catch(t){this.zone.run(()=>o.error(new Error(`Failed to parse SSE event: ${t}`)))}},p.onerror=r=>{p.readyState===EventSource.CLOSED?this.zone.run(()=>o.complete()):this.zone.run(()=>o.error(new Error(`SSE connection error for case ${C}`))),p.close()},()=>p.close()})}static \u0275fac=function(n){return new(n||H)};static \u0275prov=m({token:H,factory:H.\u0275fac,providedIn:"root"})};export{y as a,E as b,q as c,$ as d,M as e,S as f,B as g,U as h,G as i,J as j,F as k,Y as l,Mr as m};