@whoz-oss/coday-client 0.209.0 → 0.210.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{chunk-ZU7FZEK3.js → chunk-3ZE5RVI4.js} +4 -5
- package/browser/{chunk-Y2O3OQ4Z.js → chunk-4R6QW4JM.js} +1 -1
- package/browser/{chunk-KGSSXMZP.js → chunk-62EFBVKZ.js} +1 -1
- package/browser/chunk-67HAMCVY.js +1 -0
- package/browser/chunk-74I5YU6R.js +1 -0
- package/browser/chunk-C3AMWFD7.js +1 -0
- package/browser/chunk-CHA2WYM2.js +1 -0
- package/browser/{chunk-7Q5OUWO2.js → chunk-CHA2ZDSZ.js} +1 -1
- package/browser/{chunk-3RH6T6JN.js → chunk-COV73VGL.js} +1 -1
- package/browser/{chunk-6OIWUJK3.js → chunk-CRXWZUPY.js} +1 -1
- package/browser/chunk-D6MSPWHT.js +1 -0
- package/browser/chunk-ENVCSKNG.js +1 -0
- package/browser/{chunk-7ZWSYRLK.js → chunk-ESL6L24I.js} +1 -1
- package/browser/{chunk-2SG2ODL3.js → chunk-FMSF6MCK.js} +1 -1
- package/browser/chunk-H4PZNDTU.js +1 -0
- package/browser/{chunk-CRMVKTOY.js → chunk-HPGBBOAI.js} +1 -1
- package/browser/{chunk-4NGQR26Q.js → chunk-IQNIJADZ.js} +1 -1
- package/browser/{chunk-2TWHWMQT.js → chunk-JNMBUP4W.js} +1 -1
- package/browser/{chunk-3IOIMTCZ.js → chunk-KKWNUTR6.js} +1 -1
- package/browser/{chunk-R3E4WLN6.js → chunk-L27W6223.js} +6 -6
- package/browser/chunk-L4MEWC6G.js +1 -0
- package/browser/{chunk-HE2ON544.js → chunk-LIFWT4DH.js} +1 -1
- package/browser/{chunk-TWLCSEA7.js → chunk-LW2QPJTT.js} +1 -1
- package/browser/{chunk-FTVXDMJT.js → chunk-NBUZGGH4.js} +1 -1
- package/browser/{chunk-TZLSEVMC.js → chunk-NOTRPH4G.js} +1 -1
- package/browser/chunk-NUBLOJ5E.js +1 -0
- package/browser/{chunk-MQSDRYSF.js → chunk-OOFL4BOO.js} +1 -1
- package/browser/chunk-PQIRH5Z6.js +6 -0
- package/browser/{chunk-S5VVBHYB.js → chunk-Q4Y7AQCA.js} +1 -1
- package/browser/{chunk-GMHXID3M.js → chunk-QN2VKIVS.js} +1 -1
- package/browser/chunk-QVN5DC7H.js +1 -0
- package/browser/{chunk-WCZMJ56K.js → chunk-RECIDGD4.js} +1 -1
- package/browser/{chunk-KZE6HDEN.js → chunk-S2C3L6HO.js} +1 -1
- package/browser/{chunk-3NE2UZIY.js → chunk-TSCT2WKN.js} +1 -1
- package/browser/chunk-UC4AZ2QN.js +1 -0
- package/browser/{chunk-5P4JEG7O.js → chunk-UG4U3HIK.js} +1 -1
- package/browser/{chunk-L4NRVRYU.js → chunk-UUHOSVZY.js} +1 -1
- package/browser/chunk-WOOHWBWX.js +1 -0
- package/browser/{chunk-6WSXKGTT.js → chunk-WSXYJWT4.js} +1 -1
- package/browser/chunk-WX6YI2AB.js +1 -0
- package/browser/chunk-WYJF32O5.js +1 -0
- package/browser/{chunk-V2OOKYV6.js → chunk-XWC7QZZV.js} +1 -1
- package/browser/{chunk-GMRV3L4U.js → chunk-XZKE2ZVV.js} +1 -1
- package/browser/{chunk-K3M7JGDQ.js → chunk-YBAWPWX4.js} +1 -1
- package/browser/chunk-YP44HLIL.js +1 -0
- package/browser/chunk-YWCHIQG6.js +1 -0
- package/browser/{chunk-GXSVWLGT.js → chunk-Z3NYRWYS.js} +1 -1
- package/browser/{chunk-HO4VUFE6.js → chunk-ZDPUAQJJ.js} +1 -1
- package/browser/index.html +2 -2
- package/browser/{main-A44X3MTY.js → main-I3MCZXWP.js} +1 -1
- package/browser/{styles-OTP4QCB4.css → styles-SKYK6QC3.css} +1 -1
- package/package.json +1 -1
- package/browser/chunk-2WIAXZY4.js +0 -1
- package/browser/chunk-4XFTB2QO.js +0 -1
- package/browser/chunk-CNWEIYZP.js +0 -1
- package/browser/chunk-F42BGKID.js +0 -1
- package/browser/chunk-FMAU2O5I.js +0 -1
- package/browser/chunk-GQ2QQWMU.js +0 -1
- package/browser/chunk-KPSNIRON.js +0 -1
- package/browser/chunk-LW6FJ5N7.js +0 -1
- package/browser/chunk-NIWF7LLH.js +0 -1
- package/browser/chunk-NVJKCN2C.js +0 -1
- package/browser/chunk-PEM2H52H.js +0 -1
- package/browser/chunk-PKBNMAQJ.js +0 -5
- package/browser/chunk-UDA26TV3.js +0 -1
- package/browser/chunk-ZRMFXAS7.js +0 -1
- package/browser/chunk-ZTQJWWIW.js +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import{c as
|
|
2
|
-
`],encapsulation:2,changeDetection:0})}return
|
|
3
|
-
`],encapsulation:2,changeDetection:0})}return c})(),Ot=(()=>{class c{static \u0275fac=function(t){return new(t||c)};static \u0275mod=V({type:c});static \u0275inj=k({imports:[A]})}return c})();var U=class c{destroy$=new E;voices;currentUtterance=null;currentOnEndCallback=null;speakingSubject=new b(!1);speaking$=this.speakingSubject.asObservable();volume=.8;rate=1.2;language="en-US";selectedVoice;preferencesService=v(D);constructor(){this.initializeSpeechSynthesis(),this.subscribeToPreferences()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),this.stopSpeech()}initializeSpeechSynthesis(){if(!("speechSynthesis"in window)){console.warn("[VOICE-SERVICE] Speech synthesis not available"),this.voices=new Promise(e=>e([]));return}this.voices=new Promise((e,n)=>{let t=speechSynthesis.getVoices();if(t.length)e(t);else{let i=setTimeout(()=>{n("no voices found")},2e3);speechSynthesis.addEventListener("voiceschanged",()=>{let o=speechSynthesis.getVoices();o.length&&(clearTimeout(i),e(o))})}}),console.log("[VOICE-SERVICE] Speech synthesis initialized")}subscribeToPreferences(){this.preferencesService.voiceVolume$.pipe(p(this.destroy$)).subscribe(e=>{this.volume=e,console.log("[VOICE-SERVICE] Volume updated to:",e)}),this.preferencesService.voiceRate$.pipe(p(this.destroy$)).subscribe(e=>{this.rate=e,console.log("[VOICE-SERVICE] Rate updated to:",e)}),this.preferencesService.voiceLanguage$.pipe(p(this.destroy$)).subscribe(e=>{this.language=e,console.log("[VOICE-SERVICE] Language updated to:",e),this.updateSelectedVoiceForLanguage()}),this.preferencesService.selectedVoice$.pipe(p(this.destroy$)).subscribe(e=>{this.setSelectedVoice(e)}),this.volume=this.preferencesService.getVoiceVolume(),this.rate=this.preferencesService.getVoiceRate(),this.language=this.preferencesService.getVoiceLanguage(),this.setSelectedVoice(this.preferencesService.getSelectedVoice())}isReady(){return"speechSynthesis"in window&&this.selectedVoice!==void 0}isSpeaking(){return speechSynthesis.speaking}speak(e,n){return y(this,null,function*(){if(!this.selectedVoice)return console.warn("[VOICE-SERVICE] No voice selected"),!1;if(!e.trim())return console.warn("[VOICE-SERVICE] No text to speak"),!1;let t=this.extractPlainText(e);if(!t.trim())return console.warn("[VOICE-SERVICE] No text to speak after markdown cleaning"),!1;this.stopSpeech();try{let i=new SpeechSynthesisUtterance(t);i.voice=this.selectedVoice,i.lang=this.selectedVoice.lang,i.volume=this.volume,i.rate=this.rate,this.currentOnEndCallback=n||null,n&&(i.onend=()=>{this.currentOnEndCallback===n&&(this.currentOnEndCallback=null,n())},i.onerror=()=>{this.currentOnEndCallback===n&&(this.currentOnEndCallback=null,n())}),this.currentUtterance=i,this.speakingSubject.next(!0);let o=i.onend,_=i.onerror;return i.onend=O=>{this.speakingSubject.next(!1),o&&o.call(i,O)},i.onerror=O=>{this.speakingSubject.next(!1),_&&_.call(i,O)},speechSynthesis.speak(i),console.log("[VOICE-SERVICE] Started speaking:",e.substring(0,50)+"..."),!0}catch(i){return console.error("[VOICE-SERVICE] Error speaking:",i),!1}})}stopSpeech(){if(this.currentUtterance||speechSynthesis.speaking){if(speechSynthesis.cancel(),this.currentUtterance=null,this.currentOnEndCallback){let e=this.currentOnEndCallback;this.currentOnEndCallback=null,e()}this.speakingSubject.next(!1),console.log("[VOICE-SERVICE] Speech stopped")}}ding(){try{let e=new(window.AudioContext||window.webkitAudioContext),n=e.createOscillator(),t=e.createGain();n.connect(t),t.connect(e.destination),n.frequency.setValueAtTime(800,e.currentTime),t.gain.setValueAtTime(.1,e.currentTime),t.gain.exponentialRampToValueAtTime(.01,e.currentTime+.1),n.start(e.currentTime),n.stop(e.currentTime+.1),console.log("[VOICE-SERVICE] Notification sound played")}catch(e){console.error("[VOICE-SERVICE] Notification sound failed:",e)}}getVoicesForLanguage(){return y(this,null,function*(){try{let e=this.language.slice(0,2),n=yield this.voices;if(!n||n.length===0)return console.warn("[VOICE-SERVICE] No voices available on system"),[];let t=n.filter(i=>i.lang.toLowerCase().startsWith(e)).sort((i,o)=>i.localService&&!o.localService?-1:!i.localService&&o.localService?1:i.name.localeCompare(o.name));return console.log("[VOICE-SERVICE] Found matching voices:",t.length,"for language:",e),t.map(i=>({name:i.name,lang:i.lang,localService:i.localService,default:i.default,displayName:this.formatVoiceDisplayName(i)}))}catch(e){return console.error("[VOICE-SERVICE] Error getting voices for language:",e),[]}})}formatVoiceDisplayName(e){let n=e.localService?"\u{1F3E0}":"\u2601\uFE0F",t=e.default?" \u2B50":"";return`${n} ${e.name} (${e.lang})${t}`}setSelectedVoice(e){return y(this,null,function*(){if(!e){this.selectedVoice=void 0;return}let[n,t]=e.split("|");if(!n||!t){this.selectedVoice=void 0;return}let i=(yield this.voices)?.find(o=>o.name===n&&o.lang===t);i?(this.selectedVoice=i,console.log("[VOICE-SERVICE] Selected voice:",i.name,i.lang)):(this.selectedVoice=void 0,console.warn("[VOICE-SERVICE] Voice not found:",n,t))})}updateSelectedVoiceForLanguage(){return y(this,null,function*(){let e=yield this.getVoicesForLanguage();if(e.length===0){console.warn("[VOICE-SERVICE] No voices available for language:",this.language),this.selectedVoice=void 0,this.preferencesService.setSelectedVoice(null);return}let n=this.preferencesService.getSelectedVoice();if(n){let[i,o]=n.split("|"),_=o?.slice(0,2),O=this.language.slice(0,2);if(_===O&&e.some(G=>G.name===i&&G.lang===o)){console.log("[VOICE-SERVICE] Keeping current voice for language:",n);return}}let t=e[0];if(t){let i=`${t.name}|${t.lang}`;this.preferencesService.setSelectedVoice(i),console.log("[VOICE-SERVICE] Auto-selected voice for language change:",t.displayName)}})}testSelectedVoice(){setTimeout(()=>{if(!this.selectedVoice){console.log("[VOICE-SERVICE] No voice selected for test");return}this.stopSpeech();let e=this.getTestText();e&&this.speak(e)},100)}getTestText(){let e=this.language.slice(0,2),n={fr:"Bonjour, ceci est un test de la voix s\xE9lectionn\xE9e.",en:"Hello, this is a test of the selected voice.",es:"Hola, esta es una prueba de la voz seleccionada.",de:"Hallo, dies ist ein Test der ausgew\xE4hlten Stimme.",it:"Ciao, questo \xE8 un test della voce selezionata.",pt:"Ol\xE1, este \xE9 um teste da voz selecionada.",ja:"\u3053\u3093\u306B\u3061\u306F\u3001\u3053\u308C\u306F\u9078\u629E\u3055\u308C\u305F\u97F3\u58F0\u306E\u30C6\u30B9\u30C8\u3067\u3059\u3002",ko:"\uC548\uB155\uD558\uC138\uC694, \uC774\uAC83\uC740 \uC120\uD0DD\uB41C \uC74C\uC131\uC758 \uD14C\uC2A4\uD2B8\uC785\uB2C8\uB2E4.",zh:"\u4F60\u597D\uFF0C\u8FD9\u662F\u6240\u9009\u8BED\u97F3\u7684\u6D4B\u8BD5\u3002",ru:"\u041F\u0440\u0438\u0432\u0435\u0442, \u044D\u0442\u043E \u0442\u0435\u0441\u0442 \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0433\u043E\u043B\u043E\u0441\u0430.",ar:"\u0645\u0631\u062D\u0628\u0627\u060C \u0647\u0630\u0627 \u0627\u062E\u062A\u0628\u0627\u0631 \u0644\u0644\u0635\u0648\u062A \u0627\u0644\u0645\u062D\u062F\u062F."};return n[e]||n.en||"Hello, this is a test."}extractPlainText(e){let n=e.replace(/[\u{1F600}-\u{1F64F}]|[\u{1F300}-\u{1F5FF}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|⭐/gu,"").replace(/```[\s\S]*?```/g,"code block").replace(/`([^`]+)`/g,"$1").replace(/\*\*\*(.*?)\*\*\*/g,"$1").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/~~(.*?)~~/g,"$1").replace(/#{1,6}\s*(.*)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/https?:\/\/[^\s]+/g,"link").replace(/ /g," ").replace(/&/g,"and").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"');return n=this.addNaturalPunctuation(n),n.replace(/\s+/g," ").trim()}addNaturalPunctuation(e){return e.replace(/\n+/g,`
|
|
1
|
+
import{c as be,d as N,e as _e,f as Te,g as we,h as Oe,i as Pe,j as xe,k as ke,l as Ve,m as Ie,n as Ne,o as je,p as We,q as U,r as Re,s as Ae,u as De,v as Fe,w as Le,x as Be,y as ze,z as Ue}from"./chunk-LRKPIL3B.js";import{a as $e}from"./chunk-HPGBBOAI.js";import{a as pe,b as ge,e as me,f as he,g as ue}from"./chunk-LBMJRBEQ.js";import{a as j}from"./chunk-FAM7HWYV.js";import{E as D,c as W,g as R,m as A,p as Se,q as Ce,x as ye,y as Ee,z as Me}from"./chunk-WLSXA23B.js";import{E as le,J as de,O as ve,Q as fe}from"./chunk-E3XC4CVU.js";import{Ab as x,Db as d,Fb as k,Hc as se,Jb as X,Ka as c,Kb as ee,Lb as te,Mc as ce,Pb as ne,Qb as V,Rb as ie,Sb as oe,T as p,Tb as s,V as J,Vb as y,Wa as E,Wb as re,Xa as Q,Yb as g,Z as P,Zb as m,_ as Y,_b as h,aa as K,ab as Z,ca as v,d as S,h as C,i as b,ia as B,ic as ae,ja as q,jb as M,lb as T,mb as w,pb as $,qb as z,rb as u,sb as a,tb as r,ub as f,wc as I,ya as G}from"./chunk-5J7BTB5J.js";var qe=["determinateSpinner"];function Ge(l,e){if(l&1&&(B(),a(0,"svg",11),f(1,"circle",12),r()),l&2){let n=k();M("viewBox",n._viewBox()),c(),V("stroke-dasharray",n._strokeCircumference(),"px")("stroke-dashoffset",n._strokeCircumference()/2,"px")("stroke-width",n._circleStrokeWidth(),"%"),M("r",n._circleRadius())}}var Qe=new K("mat-progress-spinner-default-options",{providedIn:"root",factory:()=>({diameter:He})}),He=100,Ze=10,St=(()=>{class l{_elementRef=v(G);_noopAnimations;get color(){return this._color||this._defaultColor}set color(n){this._color=n}_color;_defaultColor="primary";_determinateCircle;constructor(){let n=v(Qe),t=de(),i=this._elementRef.nativeElement;this._noopAnimations=t==="di-disabled"&&!!n&&!n._forceAnimations,this.mode=i.nodeName.toLowerCase()==="mat-spinner"?"indeterminate":"determinate",!this._noopAnimations&&t==="reduced-motion"&&i.classList.add("mat-progress-spinner-reduced-motion"),n&&(n.color&&(this.color=this._defaultColor=n.color),n.diameter&&(this.diameter=n.diameter),n.strokeWidth&&(this.strokeWidth=n.strokeWidth))}mode;get value(){return this.mode==="determinate"?this._value:0}set value(n){this._value=Math.max(0,Math.min(100,n||0))}_value=0;get diameter(){return this._diameter}set diameter(n){this._diameter=n||0}_diameter=He;get strokeWidth(){return this._strokeWidth??this.diameter/10}set strokeWidth(n){this._strokeWidth=n||0}_strokeWidth;_circleRadius(){return(this.diameter-Ze)/2}_viewBox(){let n=this._circleRadius()*2+this.strokeWidth;return`0 0 ${n} ${n}`}_strokeCircumference(){return 2*Math.PI*this._circleRadius()}_strokeDashOffset(){return this.mode==="determinate"?this._strokeCircumference()*(100-this._value)/100:null}_circleStrokeWidth(){return this.strokeWidth/this.diameter*100}static \u0275fac=function(t){return new(t||l)};static \u0275cmp=E({type:l,selectors:[["mat-progress-spinner"],["mat-spinner"]],viewQuery:function(t,i){if(t&1&&X(qe,5),t&2){let o;ee(o=te())&&(i._determinateCircle=o.first)}},hostAttrs:["role","progressbar","tabindex","-1",1,"mat-mdc-progress-spinner","mdc-circular-progress"],hostVars:18,hostBindings:function(t,i){t&2&&(M("aria-valuemin",0)("aria-valuemax",100)("aria-valuenow",i.mode==="determinate"?i.value:null)("mode",i.mode),oe("mat-"+i.color),V("width",i.diameter,"px")("height",i.diameter,"px")("--mat-progress-spinner-size",i.diameter+"px")("--mat-progress-spinner-active-indicator-width",i.diameter+"px"),ie("_mat-animation-noopable",i._noopAnimations)("mdc-circular-progress--indeterminate",i.mode==="indeterminate"))},inputs:{color:"color",mode:"mode",value:[2,"value","value",I],diameter:[2,"diameter","diameter",I],strokeWidth:[2,"strokeWidth","strokeWidth",I]},exportAs:["matProgressSpinner"],decls:14,vars:11,consts:[["circle",""],["determinateSpinner",""],["aria-hidden","true",1,"mdc-circular-progress__determinate-container"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__determinate-circle-graphic"],["cx","50%","cy","50%",1,"mdc-circular-progress__determinate-circle"],["aria-hidden","true",1,"mdc-circular-progress__indeterminate-container"],[1,"mdc-circular-progress__spinner-layer"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-left"],[3,"ngTemplateOutlet"],[1,"mdc-circular-progress__gap-patch"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-right"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__indeterminate-circle-graphic"],["cx","50%","cy","50%"]],template:function(t,i){if(t&1&&(Z(0,Ge,2,8,"ng-template",null,0,ae),a(2,"div",2,1),B(),a(4,"svg",3),f(5,"circle",4),r()(),q(),a(6,"div",5)(7,"div",6)(8,"div",7),x(9,8),r(),a(10,"div",9),x(11,8),r(),a(12,"div",10),x(13,8),r()()()),t&2){let o=ne(1);c(4),M("viewBox",i._viewBox()),c(),V("stroke-dasharray",i._strokeCircumference(),"px")("stroke-dashoffset",i._strokeDashOffset(),"px")("stroke-width",i._circleStrokeWidth(),"%"),M("r",i._circleRadius()),c(4),u("ngTemplateOutlet",o),c(2),u("ngTemplateOutlet",o),c(2),u("ngTemplateOutlet",o)}},dependencies:[se],styles:[`.mat-mdc-progress-spinner{--mat-progress-spinner-animation-multiplier: 1;display:block;overflow:hidden;line-height:0;position:relative;direction:ltr;transition:opacity 250ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-progress-spinner circle{stroke-width:var(--mat-progress-spinner-active-indicator-width, 4px)}.mat-mdc-progress-spinner._mat-animation-noopable,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__determinate-circle{transition:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-circle-graphic,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__spinner-layer,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container{animation:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container circle{stroke-dasharray:0 !important}@media(forced-colors: active){.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic,.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle{stroke:currentColor;stroke:CanvasText}}.mat-progress-spinner-reduced-motion{--mat-progress-spinner-animation-multiplier: 1.25}.mdc-circular-progress__determinate-container,.mdc-circular-progress__indeterminate-circle-graphic,.mdc-circular-progress__indeterminate-container,.mdc-circular-progress__spinner-layer{position:absolute;width:100%;height:100%}.mdc-circular-progress__determinate-container{transform:rotate(-90deg)}.mdc-circular-progress--indeterminate .mdc-circular-progress__determinate-container{opacity:0}.mdc-circular-progress__indeterminate-container{font-size:0;letter-spacing:0;white-space:nowrap;opacity:0}.mdc-circular-progress--indeterminate .mdc-circular-progress__indeterminate-container{opacity:1;animation:mdc-circular-progress-container-rotate calc(1568.2352941176ms*var(--mat-progress-spinner-animation-multiplier)) linear infinite}.mdc-circular-progress__determinate-circle-graphic,.mdc-circular-progress__indeterminate-circle-graphic{fill:rgba(0,0,0,0)}.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:var(--mat-progress-spinner-active-indicator-color, var(--mat-sys-primary))}@media(forced-colors: active){.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:CanvasText}}.mdc-circular-progress__determinate-circle{transition:stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1)}.mdc-circular-progress__gap-patch{position:absolute;top:0;left:47.5%;box-sizing:border-box;width:5%;height:100%;overflow:hidden}.mdc-circular-progress__gap-patch .mdc-circular-progress__indeterminate-circle-graphic{left:-900%;width:2000%;transform:rotate(180deg)}.mdc-circular-progress__circle-clipper .mdc-circular-progress__indeterminate-circle-graphic{width:200%}.mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{left:-100%}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-left .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-left-spin calc(1333ms*var(--mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-right-spin calc(1333ms*var(--mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress__circle-clipper{display:inline-flex;position:relative;width:50%;height:100%;overflow:hidden}.mdc-circular-progress--indeterminate .mdc-circular-progress__spinner-layer{animation:mdc-circular-progress-spinner-layer-rotate calc(5332ms*var(--mat-progress-spinner-animation-multiplier)) cubic-bezier(0.4, 0, 0.2, 1) infinite both}@keyframes mdc-circular-progress-container-rotate{to{transform:rotate(360deg)}}@keyframes mdc-circular-progress-spinner-layer-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes mdc-circular-progress-left-spin{from{transform:rotate(265deg)}50%{transform:rotate(130deg)}to{transform:rotate(265deg)}}@keyframes mdc-circular-progress-right-spin{from{transform:rotate(-265deg)}50%{transform:rotate(-130deg)}to{transform:rotate(-265deg)}}
|
|
2
|
+
`],encapsulation:2,changeDetection:0})}return l})();var Ct=(()=>{class l{static \u0275fac=function(t){return new(t||l)};static \u0275mod=Q({type:l});static \u0275inj=Y({imports:[le]})}return l})();var L=class l{destroy$=new C;voices;currentUtterance=null;currentOnEndCallback=null;speakingSubject=new b(!1);speaking$=this.speakingSubject.asObservable();volume=.8;rate=1.2;language="en-US";selectedVoice;preferencesService=v(N);constructor(){this.initializeSpeechSynthesis(),this.subscribeToPreferences()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),this.stopSpeech()}initializeSpeechSynthesis(){if(!("speechSynthesis"in window)){console.warn("[VOICE-SERVICE] Speech synthesis not available"),this.voices=new Promise(e=>e([]));return}this.voices=new Promise((e,n)=>{let t=speechSynthesis.getVoices();if(t.length)e(t);else{let i=setTimeout(()=>{n("no voices found")},2e3);speechSynthesis.addEventListener("voiceschanged",()=>{let o=speechSynthesis.getVoices();o.length&&(clearTimeout(i),e(o))})}}),console.log("[VOICE-SERVICE] Speech synthesis initialized")}subscribeToPreferences(){this.preferencesService.voiceVolume$.pipe(p(this.destroy$)).subscribe(e=>{this.volume=e,console.log("[VOICE-SERVICE] Volume updated to:",e)}),this.preferencesService.voiceRate$.pipe(p(this.destroy$)).subscribe(e=>{this.rate=e,console.log("[VOICE-SERVICE] Rate updated to:",e)}),this.preferencesService.voiceLanguage$.pipe(p(this.destroy$)).subscribe(e=>{this.language=e,console.log("[VOICE-SERVICE] Language updated to:",e),this.updateSelectedVoiceForLanguage()}),this.preferencesService.selectedVoice$.pipe(p(this.destroy$)).subscribe(e=>{this.setSelectedVoice(e)}),this.volume=this.preferencesService.getVoiceVolume(),this.rate=this.preferencesService.getVoiceRate(),this.language=this.preferencesService.getVoiceLanguage(),this.setSelectedVoice(this.preferencesService.getSelectedVoice())}isReady(){return"speechSynthesis"in window&&this.selectedVoice!==void 0}isSpeaking(){return speechSynthesis.speaking}speak(e,n){return S(this,null,function*(){if(!this.selectedVoice)return console.warn("[VOICE-SERVICE] No voice selected"),!1;if(!e.trim())return console.warn("[VOICE-SERVICE] No text to speak"),!1;let t=this.extractPlainText(e);if(!t.trim())return console.warn("[VOICE-SERVICE] No text to speak after markdown cleaning"),!1;this.stopSpeech();try{let i=new SpeechSynthesisUtterance(t);i.voice=this.selectedVoice,i.lang=this.selectedVoice.lang,i.volume=this.volume,i.rate=this.rate,this.currentOnEndCallback=n||null,n&&(i.onend=()=>{this.currentOnEndCallback===n&&(this.currentOnEndCallback=null,n())},i.onerror=()=>{this.currentOnEndCallback===n&&(this.currentOnEndCallback=null,n())}),this.currentUtterance=i,this.speakingSubject.next(!0);let o=i.onend,_=i.onerror;return i.onend=O=>{this.speakingSubject.next(!1),o&&o.call(i,O)},i.onerror=O=>{this.speakingSubject.next(!1),_&&_.call(i,O)},speechSynthesis.speak(i),console.log("[VOICE-SERVICE] Started speaking:",e.substring(0,50)+"..."),!0}catch(i){return console.error("[VOICE-SERVICE] Error speaking:",i),!1}})}stopSpeech(){if(this.currentUtterance||speechSynthesis.speaking){if(speechSynthesis.cancel(),this.currentUtterance=null,this.currentOnEndCallback){let e=this.currentOnEndCallback;this.currentOnEndCallback=null,e()}this.speakingSubject.next(!1),console.log("[VOICE-SERVICE] Speech stopped")}}ding(){try{let e=new(window.AudioContext||window.webkitAudioContext),n=e.createOscillator(),t=e.createGain();n.connect(t),t.connect(e.destination),n.frequency.setValueAtTime(800,e.currentTime),t.gain.setValueAtTime(.1,e.currentTime),t.gain.exponentialRampToValueAtTime(.01,e.currentTime+.1),n.start(e.currentTime),n.stop(e.currentTime+.1),console.log("[VOICE-SERVICE] Notification sound played")}catch(e){console.error("[VOICE-SERVICE] Notification sound failed:",e)}}getVoicesForLanguage(){return S(this,null,function*(){try{let e=this.language.slice(0,2),n=yield this.voices;if(!n||n.length===0)return console.warn("[VOICE-SERVICE] No voices available on system"),[];let t=n.filter(i=>i.lang.toLowerCase().startsWith(e)).sort((i,o)=>i.localService&&!o.localService?-1:!i.localService&&o.localService?1:i.name.localeCompare(o.name));return console.log("[VOICE-SERVICE] Found matching voices:",t.length,"for language:",e),t.map(i=>({name:i.name,lang:i.lang,localService:i.localService,default:i.default,displayName:this.formatVoiceDisplayName(i)}))}catch(e){return console.error("[VOICE-SERVICE] Error getting voices for language:",e),[]}})}formatVoiceDisplayName(e){let n=e.localService?"\u{1F3E0}":"\u2601\uFE0F",t=e.default?" \u2B50":"";return`${n} ${e.name} (${e.lang})${t}`}setSelectedVoice(e){return S(this,null,function*(){if(!e){this.selectedVoice=void 0;return}let[n,t]=e.split("|");if(!n||!t){this.selectedVoice=void 0;return}let i=(yield this.voices)?.find(o=>o.name===n&&o.lang===t);i?(this.selectedVoice=i,console.log("[VOICE-SERVICE] Selected voice:",i.name,i.lang)):(this.selectedVoice=void 0,console.warn("[VOICE-SERVICE] Voice not found:",n,t))})}updateSelectedVoiceForLanguage(){return S(this,null,function*(){let e=yield this.getVoicesForLanguage();if(e.length===0){console.warn("[VOICE-SERVICE] No voices available for language:",this.language),this.selectedVoice=void 0,this.preferencesService.setSelectedVoice(null);return}let n=this.preferencesService.getSelectedVoice();if(n){let[i,o]=n.split("|"),_=o?.slice(0,2),O=this.language.slice(0,2);if(_===O&&e.some(H=>H.name===i&&H.lang===o)){console.log("[VOICE-SERVICE] Keeping current voice for language:",n);return}}let t=e[0];if(t){let i=`${t.name}|${t.lang}`;this.preferencesService.setSelectedVoice(i),console.log("[VOICE-SERVICE] Auto-selected voice for language change:",t.displayName)}})}testSelectedVoice(){setTimeout(()=>{if(!this.selectedVoice){console.log("[VOICE-SERVICE] No voice selected for test");return}this.stopSpeech();let e=this.getTestText();e&&this.speak(e)},100)}getTestText(){let e=this.language.slice(0,2),n={fr:"Bonjour, ceci est un test de la voix s\xE9lectionn\xE9e.",en:"Hello, this is a test of the selected voice.",es:"Hola, esta es una prueba de la voz seleccionada.",de:"Hallo, dies ist ein Test der ausgew\xE4hlten Stimme.",it:"Ciao, questo \xE8 un test della voce selezionata.",pt:"Ol\xE1, este \xE9 um teste da voz selecionada.",ja:"\u3053\u3093\u306B\u3061\u306F\u3001\u3053\u308C\u306F\u9078\u629E\u3055\u308C\u305F\u97F3\u58F0\u306E\u30C6\u30B9\u30C8\u3067\u3059\u3002",ko:"\uC548\uB155\uD558\uC138\uC694, \uC774\uAC83\uC740 \uC120\uD0DD\uB41C \uC74C\uC131\uC758 \uD14C\uC2A4\uD2B8\uC785\uB2C8\uB2E4.",zh:"\u4F60\u597D\uFF0C\u8FD9\u662F\u6240\u9009\u8BED\u97F3\u7684\u6D4B\u8BD5\u3002",ru:"\u041F\u0440\u0438\u0432\u0435\u0442, \u044D\u0442\u043E \u0442\u0435\u0441\u0442 \u0432\u044B\u0431\u0440\u0430\u043D\u043D\u043E\u0433\u043E \u0433\u043E\u043B\u043E\u0441\u0430.",ar:"\u0645\u0631\u062D\u0628\u0627\u060C \u0647\u0630\u0627 \u0627\u062E\u062A\u0628\u0627\u0631 \u0644\u0644\u0635\u0648\u062A \u0627\u0644\u0645\u062D\u062F\u062F."};return n[e]||n.en||"Hello, this is a test."}extractPlainText(e){let n=e.replace(/[\u{1F600}-\u{1F64F}]|[\u{1F300}-\u{1F5FF}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|⭐/gu,"").replace(/```[\s\S]*?```/g,"code block").replace(/`([^`]+)`/g,"$1").replace(/\*\*\*(.*?)\*\*\*/g,"$1").replace(/\*\*(.*?)\*\*/g,"$1").replace(/\*(.*?)\*/g,"$1").replace(/~~(.*?)~~/g,"$1").replace(/#{1,6}\s*(.*)/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/https?:\/\/[^\s]+/g,"link").replace(/ /g," ").replace(/&/g,"and").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"');return n=this.addNaturalPunctuation(n),n.replace(/\s+/g," ").trim()}addNaturalPunctuation(e){return e.replace(/\n+/g,`
|
|
4
3
|
`).split(`
|
|
5
|
-
`).map(n=>this.addPeriodIfNeeded(n.trim())).filter(n=>n.length>0).join(" ")}addPeriodIfNeeded(e){return e?/[.!?;:]$/.test(e)?e:e+".":""}static \u0275fac=function(n){return new(n||c)};static \u0275prov=x({token:c,factory:c.\u0275fac,providedIn:"root"})};var nt=(c,e)=>e.code,it=(c,e)=>e.name+e.lang;function ot(c,e){c&1&&(a(0,"div",17)(1,"mat-icon",39),s(2,"warning"),r(),a(3,"span",40),s(4," Browser notifications have been blocked. To enable them, please reset the site permissions in your browser settings. "),r()())}function rt(c,e){if(c&1&&(a(0,"option",25),s(1),r()),c&2){let n=e.$implicit;u("value",n.code),l(),se("",n.flag," ",n.label)}}function at(c,e){c&1&&(a(0,"option",32),s(1,"Loading voices..."),r())}function st(c,e){c&1&&(a(0,"option",32),s(1,"No voice available"),r())}function ct(c,e){if(c&1&&(a(0,"option",25),s(1),r()),c&2){let n=e.$implicit;u("value",n.name+"|"+n.lang),l(),M(" ",n.displayName," ")}}var Ye=class c{destroy$=new E;selectedTheme="light";selectedVoiceLanguage="en-US";useEnterToSend=!1;printTechnicalMessages=!1;showTechnicalMessages=!0;showWarningMessages=!0;voiceInputMode="browser";voiceAnnounceEnabled=!1;voiceMode="speech";voiceReadFullText=!1;voiceVolume=80;voiceRate=120;agentNotificationEnabled=!1;notificationSoundEnabled=!0;browserNotificationEnabled=!1;browserNotificationDenied=!1;missionPreviewEnabled=!1;availableVoices=[];selectedVoiceId=null;loadingVoices=!1;voiceLanguageOptions=[{code:"fr-FR",label:"Fran\xE7ais",flag:"\u{1F1EB}\u{1F1F7}"},{code:"en-US",label:"English (US)",flag:"\u{1F1FA}\u{1F1F8}"},{code:"en-GB",label:"English (UK)",flag:"\u{1F1EC}\u{1F1E7}"},{code:"es-ES",label:"Espa\xF1ol",flag:"\u{1F1EA}\u{1F1F8}"},{code:"de-DE",label:"Deutsch",flag:"\u{1F1E9}\u{1F1EA}"},{code:"it-IT",label:"Italiano",flag:"\u{1F1EE}\u{1F1F9}"},{code:"pt-BR",label:"Portugu\xEAs",flag:"\u{1F1E7}\u{1F1F7}"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",flag:"\u{1F1EF}\u{1F1F5}"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",flag:"\u{1F1F0}\u{1F1F7}"},{code:"zh-CN",label:"\u4E2D\u6587 (\u7B80\u4F53)",flag:"\u{1F1E8}\u{1F1F3}"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",flag:"\u{1F1F7}\u{1F1FA}"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",flag:"\u{1F1F8}\u{1F1E6}"}];preferencesService=v(D);voiceSynthesisService=v(U);themeService=v(Se);ngOnInit(){this.selectedTheme=this.themeService.getCurrentTheme(),this.selectedVoiceLanguage=this.preferencesService.getVoiceLanguage(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.printTechnicalMessages=this.preferencesService.getPrintTechnicalMessages(),this.showTechnicalMessages=!this.preferencesService.getHideTechnicalMessages(),this.showWarningMessages=!this.preferencesService.getHideWarningMessages(),this.voiceInputMode=this.preferencesService.getVoiceInputMode(),this.voiceAnnounceEnabled=this.preferencesService.getVoiceAnnounceEnabled(),this.voiceMode=this.preferencesService.getVoiceMode(),this.voiceReadFullText=this.preferencesService.getVoiceReadFullText(),this.voiceVolume=Math.round(this.preferencesService.getVoiceVolume()*100),this.voiceRate=Math.round(this.preferencesService.getVoiceRate()*100),this.selectedVoiceId=this.preferencesService.getSelectedVoice(),this.agentNotificationEnabled=this.preferencesService.getAgentNotificationEnabled(),this.notificationSoundEnabled=this.preferencesService.getNotificationSoundEnabled(),this.browserNotificationEnabled=this.preferencesService.getBrowserNotificationEnabled(),this.missionPreviewEnabled=this.preferencesService.getMissionPreviewEnabled(),this.loadAvailableVoices(),this.themeService.currentTheme$.pipe(p(this.destroy$)).subscribe(e=>{this.selectedTheme=e}),this.preferencesService.voiceLanguage$.pipe(p(this.destroy$)).subscribe(e=>{this.selectedVoiceLanguage=e}),this.preferencesService.enterToSend$.pipe(p(this.destroy$)).subscribe(e=>{this.useEnterToSend=e}),this.preferencesService.printTechnicalMessages$.pipe(p(this.destroy$)).subscribe(e=>{this.printTechnicalMessages=e}),this.preferencesService.hideTechnicalMessages$.pipe(p(this.destroy$)).subscribe(e=>{this.showTechnicalMessages=!e}),this.preferencesService.hideWarningMessages$.pipe(p(this.destroy$)).subscribe(e=>{this.showWarningMessages=!e}),this.preferencesService.voiceInputMode$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceInputMode=e}),this.preferencesService.voiceAnnounceEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceAnnounceEnabled=e}),this.preferencesService.voiceMode$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceMode=e}),this.preferencesService.voiceReadFullText$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceReadFullText=e}),this.preferencesService.voiceVolume$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceVolume=Math.round(e*100)}),this.preferencesService.voiceRate$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceRate=Math.round(e*100)}),this.preferencesService.selectedVoice$.pipe(p(this.destroy$)).subscribe(e=>{this.selectedVoiceId=e}),this.preferencesService.voiceLanguage$.pipe(p(this.destroy$)).subscribe(()=>{this.loadAvailableVoices()}),this.preferencesService.agentNotificationEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.agentNotificationEnabled=e}),this.preferencesService.notificationSoundEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.notificationSoundEnabled=e}),this.preferencesService.browserNotificationEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.browserNotificationEnabled=e,this.checkNotificationPermission()}),this.preferencesService.missionPreviewEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.missionPreviewEnabled=e})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}onThemeChange(){console.log("[OPTIONS] Theme changed to:",this.selectedTheme),this.themeService.setTheme(this.selectedTheme)}onVoiceLanguageChange(){console.log("[OPTIONS] Voice language changed to:",this.selectedVoiceLanguage),this.preferencesService.setVoiceLanguage(this.selectedVoiceLanguage)}onEnterToSendChange(){console.log("[OPTIONS] Enter to send changed to:",this.useEnterToSend),this.preferencesService.setEnterToSend(this.useEnterToSend)}onPrintTechnicalMessagesChange(){console.log("[OPTIONS] Print technical messages changed to:",this.printTechnicalMessages),this.preferencesService.setPrintTechnicalMessages(this.printTechnicalMessages)}onShowTechnicalMessagesChange(){let e=!this.showTechnicalMessages;console.log("[OPTIONS] Show technical messages changed to:",this.showTechnicalMessages,"(hide:",e,")"),this.preferencesService.setHideTechnicalMessages(e)}onShowWarningMessagesChange(){let e=!this.showWarningMessages;console.log("[OPTIONS] Show warning messages changed to:",this.showWarningMessages,"(hide:",e,")"),this.preferencesService.setHideWarningMessages(e)}onVoiceInputModeChange(e){let n=e.target.value;console.log("[OPTIONS] Voice input mode changed to:",n),this.preferencesService.setVoiceInputMode(n)}onVoiceAnnounceEnabledChange(){console.log("[OPTIONS] Voice announce enabled changed to:",this.voiceAnnounceEnabled),this.preferencesService.setVoiceAnnounceEnabled(this.voiceAnnounceEnabled)}onVoiceModeChange(){console.log("[OPTIONS] Voice mode changed to:",this.voiceMode),this.preferencesService.setVoiceMode(this.voiceMode)}onVoiceReadFullTextChange(){console.log("[OPTIONS] Voice read full text changed to:",this.voiceReadFullText),this.preferencesService.setVoiceReadFullText(this.voiceReadFullText)}onVoiceVolumeChange(){let e=this.voiceVolume/100;console.log("[OPTIONS] Voice volume changed to:",e),this.preferencesService.setVoiceVolume(e)}onVoiceRateChange(){let e=this.voiceRate/100;console.log("[OPTIONS] Voice rate changed to:",e),this.preferencesService.setVoiceRate(e)}loadAvailableVoices(){return y(this,null,function*(){this.loadingVoices=!0;try{this.availableVoices=yield this.voiceSynthesisService.getVoicesForLanguage(),console.log("[OPTIONS] Loaded",this.availableVoices.length,"voices for current language")}catch(e){console.error("[OPTIONS] Error loading voices:",e),this.availableVoices=[]}finally{this.loadingVoices=!1}})}onSelectedVoiceChange(){console.log("[OPTIONS] Selected voice changed to:",this.selectedVoiceId),this.preferencesService.setSelectedVoice(this.selectedVoiceId)}testVoice(){console.log("[OPTIONS] Testing voice with current settings"),this.voiceSynthesisService.testSelectedVoice()}onAgentNotificationEnabledChange(){console.log("[OPTIONS] Agent notification enabled changed to:",this.agentNotificationEnabled),this.preferencesService.setAgentNotificationEnabled(this.agentNotificationEnabled)}onNotificationSoundEnabledChange(){console.log("[OPTIONS] Notification sound enabled changed to:",this.notificationSoundEnabled),this.preferencesService.setNotificationSoundEnabled(this.notificationSoundEnabled)}onBrowserNotificationEnabledChange(){console.log("[OPTIONS] Browser notification enabled changed to:",this.browserNotificationEnabled),this.preferencesService.setBrowserNotificationEnabled(this.browserNotificationEnabled)}onMissionPreviewEnabledChange(){console.log("[OPTIONS] Mission preview panel enabled changed to:",this.missionPreviewEnabled),this.preferencesService.setMissionPreviewEnabled(this.missionPreviewEnabled)}checkNotificationPermission(){"Notification"in window&&(this.browserNotificationDenied=Notification.permission==="denied",console.log("[OPTIONS] Notification permission status:",Notification.permission))}static \u0275fac=function(n){return new(n||c)};static \u0275cmp=S({type:c,selectors:[["app-options-panel"]],decls:168,vars:37,consts:[[1,"options-content"],[1,"option-section"],[1,"section-title"],[1,"option-group"],[1,"radio-group"],[1,"option-radio"],["type","radio","name","theme","value","light",3,"ngModelChange","change","ngModel"],[1,"radio-mark"],["type","radio","name","theme","value","dark",3,"ngModelChange","change","ngModel"],["type","radio","name","theme","value","system",3,"ngModelChange","change","ngModel"],[1,"option-label"],["type","radio","name","enterBehavior",3,"ngModelChange","change","value","ngModel"],[1,"toggle-option"],["color","primary",3,"ngModelChange","change","ngModel"],[1,"option-label-with-hint"],[1,"option-hint"],["color","primary",3,"ngModelChange","change","ngModel","disabled"],[1,"notification-error"],["for","voice-input-mode-select",1,"option-label"],["id","voice-input-mode-select",1,"option-select",3,"change","value"],["value","browser"],["value","whisper"],["value","voice-message"],["for","voice-language-select",1,"option-label"],["id","voice-language-select",1,"option-select",3,"ngModelChange","change","ngModel"],[3,"value"],["type","radio","name","voiceAnnounce",3,"ngModelChange","change","value","ngModel"],["type","radio","name","voiceMode","value","speech",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceMode","value","notification",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceReadFull",3,"ngModelChange","change","value","ngModel"],["for","voice-select",1,"option-label"],["id","voice-select",1,"option-select",3,"ngModelChange","change","ngModel","disabled"],["value",""],["role","button","tabindex","0","title","Test voice with current settings",1,"test-voice-link",3,"click"],[1,"thread-name"],["for","voice-volume-slider",1,"option-label"],["id","voice-volume-slider","type","range","min","0","max","100","step","5",1,"option-slider",3,"ngModelChange","input","ngModel"],["for","voice-rate-slider",1,"option-label"],["id","voice-rate-slider","type","range","min","50","max","200","step","10",1,"option-slider",3,"ngModelChange","input","ngModel"],[1,"error-icon"],[1,"error-message"]],template:function(n,t){n&1&&(a(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-icon"),s(4,"palette"),r(),a(5,"span"),s(6,"Appearance"),r()(),a(7,"div",3)(8,"div",4)(9,"label",5)(10,"input",6),h("ngModelChange",function(o){return m(t.selectedTheme,o)||(t.selectedTheme=o),o}),d("change",function(){return t.onThemeChange()}),r(),f(11,"span",7),s(12," Light "),r(),a(13,"label",5)(14,"input",8),h("ngModelChange",function(o){return m(t.selectedTheme,o)||(t.selectedTheme=o),o}),d("change",function(){return t.onThemeChange()}),r(),f(15,"span",7),s(16," Dark "),r(),a(17,"label",5)(18,"input",9),h("ngModelChange",function(o){return m(t.selectedTheme,o)||(t.selectedTheme=o),o}),d("change",function(){return t.onThemeChange()}),r(),f(19,"span",7),s(20," System "),r()()()(),a(21,"div",1)(22,"div",2)(23,"mat-icon"),s(24,"chat_bubble_outline"),r(),a(25,"span"),s(26,"Messaging"),r()(),a(27,"div",3)(28,"span",10),s(29,"Send message behavior:"),r(),a(30,"div",4)(31,"label",5)(32,"input",11),h("ngModelChange",function(o){return m(t.useEnterToSend,o)||(t.useEnterToSend=o),o}),d("change",function(){return t.onEnterToSendChange()}),r(),f(33,"span",7),s(34," Enter to send "),r(),a(35,"label",5)(36,"input",11),h("ngModelChange",function(o){return m(t.useEnterToSend,o)||(t.useEnterToSend=o),o}),d("change",function(){return t.onEnterToSendChange()}),r(),f(37,"span",7),s(38," Enter for new line "),r()()(),a(39,"div",3)(40,"div",12)(41,"span",10),s(42,"Show technical messages"),r(),a(43,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.showTechnicalMessages,o)||(t.showTechnicalMessages=o),o}),d("change",function(){return t.onShowTechnicalMessagesChange()}),r()()(),a(44,"div",3)(45,"div",12)(46,"span",10),s(47,"Show warning messages"),r(),a(48,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.showWarningMessages,o)||(t.showWarningMessages=o),o}),d("change",function(){return t.onShowWarningMessagesChange()}),r()()(),a(49,"div",3)(50,"div",12)(51,"span",10),s(52,"Include technical messages in print"),r(),a(53,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.printTechnicalMessages,o)||(t.printTechnicalMessages=o),o}),d("change",function(){return t.onPrintTechnicalMessagesChange()}),r()()()(),a(54,"div",1)(55,"div",2)(56,"mat-icon"),s(57,"rocket_launch"),r(),a(58,"span"),s(59,"Mission Control"),r()(),a(60,"div",3)(61,"div",12)(62,"div",14)(63,"span",10),s(64,"Side-by-side thread preview"),r(),a(65,"span",15),s(66,"Click a mission card to open a preview panel. Recommended for large screens."),r()(),a(67,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.missionPreviewEnabled,o)||(t.missionPreviewEnabled=o),o}),d("change",function(){return t.onMissionPreviewEnabledChange()}),r()()()(),a(68,"div",1)(69,"div",2)(70,"mat-icon"),s(71,"notifications"),r(),a(72,"span"),s(73,"Notifications"),r()(),a(74,"div",3)(75,"div",12)(76,"span",10),s(77,"Notify when the agent answers or requests input"),r(),a(78,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.agentNotificationEnabled,o)||(t.agentNotificationEnabled=o),o}),d("change",function(){return t.onAgentNotificationEnabledChange()}),r()()(),a(79,"div",3)(80,"div",12)(81,"span",10),s(82,"Notification sound"),r(),a(83,"mat-slide-toggle",16),h("ngModelChange",function(o){return m(t.notificationSoundEnabled,o)||(t.notificationSoundEnabled=o),o}),d("change",function(){return t.onNotificationSoundEnabledChange()}),r()()(),a(84,"div",3)(85,"div",12)(86,"span",10),s(87,"Browser notification"),r(),a(88,"mat-slide-toggle",16),h("ngModelChange",function(o){return m(t.browserNotificationEnabled,o)||(t.browserNotificationEnabled=o),o}),d("change",function(){return t.onBrowserNotificationEnabledChange()}),r()(),T(89,ot,5,0,"div",17),r()(),a(90,"div",1)(91,"div",2)(92,"mat-icon"),s(93,"record_voice_over"),r(),a(94,"span"),s(95,"Voice & Speech"),r()(),a(96,"div",3)(97,"label",18),s(98,"Voice input method:"),r(),a(99,"select",19),d("change",function(o){return t.onVoiceInputModeChange(o)}),a(100,"option",20),s(101,"Browser (real-time)"),r(),a(102,"option",21),s(103,"Whisper (higher accuracy)"),r(),a(104,"option",22),s(105,"Voice message (send audio)"),r()()(),a(106,"div",3)(107,"label",23),s(108,"Voice recognition language:"),r(),a(109,"select",24),h("ngModelChange",function(o){return m(t.selectedVoiceLanguage,o)||(t.selectedVoiceLanguage=o),o}),d("change",function(){return t.onVoiceLanguageChange()}),J(110,rt,2,3,"option",25,nt),r()(),a(112,"div",3)(113,"span",10),s(114,"Automatic announcement:"),r(),a(115,"div",4)(116,"label",5)(117,"input",26),h("ngModelChange",function(o){return m(t.voiceAnnounceEnabled,o)||(t.voiceAnnounceEnabled=o),o}),d("change",function(){return t.onVoiceAnnounceEnabledChange()}),r(),f(118,"span",7),s(119," Enabled "),r(),a(120,"label",5)(121,"input",26),h("ngModelChange",function(o){return m(t.voiceAnnounceEnabled,o)||(t.voiceAnnounceEnabled=o),o}),d("change",function(){return t.onVoiceAnnounceEnabledChange()}),r(),f(122,"span",7),s(123," Disabled "),r()()(),a(124,"div",3)(125,"span",10),s(126,"Voice mode:"),r(),a(127,"div",4)(128,"label",5)(129,"input",27),h("ngModelChange",function(o){return m(t.voiceMode,o)||(t.voiceMode=o),o}),d("change",function(){return t.onVoiceModeChange()}),r(),f(130,"span",7),s(131," Voice synthesis "),r(),a(132,"label",5)(133,"input",28),h("ngModelChange",function(o){return m(t.voiceMode,o)||(t.voiceMode=o),o}),d("change",function(){return t.onVoiceModeChange()}),r(),f(134,"span",7),s(135," Sound notification "),r()()(),a(136,"div",3)(137,"span",10),s(138,"Message reading:"),r(),a(139,"div",4)(140,"label",5)(141,"input",29),h("ngModelChange",function(o){return m(t.voiceReadFullText,o)||(t.voiceReadFullText=o),o}),d("change",function(){return t.onVoiceReadFullTextChange()}),r(),f(142,"span",7),s(143," Full message "),r(),a(144,"label",5)(145,"input",29),h("ngModelChange",function(o){return m(t.voiceReadFullText,o)||(t.voiceReadFullText=o),o}),d("change",function(){return t.onVoiceReadFullTextChange()}),r(),f(146,"span",7),s(147," First paragraphs only "),r()()(),a(148,"div",3)(149,"label",30),s(150,"Selected voice:"),r(),a(151,"select",31),h("ngModelChange",function(o){return m(t.selectedVoiceId,o)||(t.selectedVoiceId=o),o}),d("change",function(){return t.onSelectedVoiceChange()}),T(152,at,2,0,"option",32),T(153,st,2,0,"option",32),J(154,ct,2,2,"option",25,it),r(),f(156,"div",10),a(157,"a",33),d("click",function(){return t.testVoice()}),a(158,"span",34),s(159,"Test voice"),r()()(),a(160,"div",3)(161,"label",35),s(162),r(),a(163,"input",36),h("ngModelChange",function(o){return m(t.voiceVolume,o)||(t.voiceVolume=o),o}),d("input",function(){return t.onVoiceVolumeChange()}),r()(),a(164,"div",3)(165,"label",37),s(166),r(),a(167,"input",38),h("ngModelChange",function(o){return m(t.voiceRate,o)||(t.voiceRate=o),o}),d("input",function(){return t.onVoiceRateChange()}),r()()()()),n&2&&(l(10),g("ngModel",t.selectedTheme),l(4),g("ngModel",t.selectedTheme),l(4),g("ngModel",t.selectedTheme),l(14),u("value",!0),g("ngModel",t.useEnterToSend),l(4),u("value",!1),g("ngModel",t.useEnterToSend),l(7),g("ngModel",t.showTechnicalMessages),l(5),g("ngModel",t.showWarningMessages),l(5),g("ngModel",t.printTechnicalMessages),l(14),g("ngModel",t.missionPreviewEnabled),l(11),g("ngModel",t.agentNotificationEnabled),l(5),g("ngModel",t.notificationSoundEnabled),u("disabled",!t.agentNotificationEnabled),l(5),g("ngModel",t.browserNotificationEnabled),u("disabled",!t.agentNotificationEnabled||t.browserNotificationDenied),l(),w(t.browserNotificationDenied?89:-1),l(10),u("value",t.voiceInputMode),l(10),g("ngModel",t.selectedVoiceLanguage),l(),Y(t.voiceLanguageOptions),l(7),u("value",!0),g("ngModel",t.voiceAnnounceEnabled),l(4),u("value",!1),g("ngModel",t.voiceAnnounceEnabled),l(8),g("ngModel",t.voiceMode),l(4),g("ngModel",t.voiceMode),l(8),u("value",!0),g("ngModel",t.voiceReadFullText),l(4),u("value",!1),g("ngModel",t.voiceReadFullText),l(6),g("ngModel",t.selectedVoiceId),u("disabled",t.loadingVoices||t.availableVoices.length===0),l(),w(t.loadingVoices?152:-1),l(),w(!t.loadingVoices&&t.availableVoices.length===0?153:-1),l(),Y(t.availableVoices),l(8),M("Volume: ",t.voiceVolume,"%"),l(),g("ngModel",t.voiceVolume),l(3),M("Speed: ",t.voiceRate,"%"),l(),g("ngModel",t.voiceRate))},dependencies:[z,Me,Te,F,ye,Ee,Ce,L,$,B,ze],styles:['.options-content[_ngcontent-%COMP%]{padding:0;width:100%}.option-group[_ngcontent-%COMP%]{padding:0 1rem 1rem;margin-bottom:1rem;border-bottom:1px solid var(--color-border-light)}.option-group[_ngcontent-%COMP%]:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}.option-label[_ngcontent-%COMP%]{display:block;margin-bottom:.5rem;font-weight:500;color:var(--color-text);font-size:.875rem}.toggle-option[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:1rem}.toggle-option[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0;flex:1}.toggle-option[_ngcontent-%COMP%] mat-slide-toggle[_ngcontent-%COMP%]{flex-shrink:0}.option-label-with-hint[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;flex:1}.option-label-with-hint[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0}.option-label-with-hint[_ngcontent-%COMP%] .option-hint[_ngcontent-%COMP%]{font-size:.775rem;color:var(--color-text-secondary);line-height:1.4}.option-select[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-border);border-radius:4px;background:var(--color-input-bg);color:var(--color-text);font-size:.875rem;cursor:pointer}.option-select[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 3px #7064fb1a}.option-select[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.option-select[_ngcontent-%COMP%] option[_ngcontent-%COMP%]{padding:.5rem}.option-checkbox[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{display:none}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]{width:18px;height:18px;border:2px solid var(--color-border);border-radius:3px;margin-right:.75rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]:after{content:"";width:10px;height:6px;border-left:2px solid transparent;border-bottom:2px solid transparent;transform:rotate(-45deg);transition:all .2s ease;opacity:0}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]{background-color:var(--color-primary);border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]:after{border-left-color:#fff;border-bottom-color:#fff;opacity:1}.option-checkbox[_ngcontent-%COMP%]:hover .checkmark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%]:focus-within .checkmark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-section[_ngcontent-%COMP%]{padding-top:1rem;margin-top:1rem;border-top:2px solid var(--color-border)}.option-section[_ngcontent-%COMP%]:first-child{border-top:none;padding-top:0;margin-top:0}.section-title[_ngcontent-%COMP%]{margin:0 0 1rem;padding:0 1rem;font-size:.9rem;font-weight:600;color:var(--color-text);display:flex;align-items:center;gap:.5rem}.section-title[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.radio-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.option-radio[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{display:none}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]{width:16px;height:16px;border:2px solid var(--color-border);border-radius:50%;margin-right:.5rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0;position:relative}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]:after{content:"";width:8px;height:8px;border-radius:50%;background-color:var(--color-primary);transition:all .2s ease;opacity:0;transform:scale(0)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]:after{opacity:1;transform:scale(1)}.option-radio[_ngcontent-%COMP%]:hover .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%]:focus-within .radio-mark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-slider[_ngcontent-%COMP%]{width:100%;height:6px;border-radius:3px;background:var(--color-bg-solid);outline:none;cursor:pointer;-webkit-appearance:none;appearance:none}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-webkit-slider-track{height:6px;border-radius:3px;background:var(--color-bg-secondary)}.option-slider[_ngcontent-%COMP%]::-moz-range-track{height:6px;border-radius:3px;background:var(--color-bg-secondary);border:none}.option-slider[_ngcontent-%COMP%]:focus{outline:none}.option-slider[_ngcontent-%COMP%]:focus::-webkit-slider-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.option-slider[_ngcontent-%COMP%]:focus::-moz-range-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.test-voice-btn[_ngcontent-%COMP%]{width:100%;padding:.75rem 1rem;background:var(--color-primary);color:#fff;border:none;border-radius:6px;font-size:.875rem;font-weight:500;cursor:pointer;transition:all .2s ease;display:flex;align-items:center;justify-content:center;gap:.5rem}.test-voice-btn[_ngcontent-%COMP%]:hover{background:var(--color-primary-hover);transform:translateY(-1px);box-shadow:0 2px 8px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:active{transform:translateY(0);box-shadow:0 1px 4px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:focus{outline:none;box-shadow:0 0 0 3px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:disabled{background:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;transform:none;box-shadow:none}.test-voice-link[_ngcontent-%COMP%]{text-decoration-thickness:1.5px;text-underline-offset:3px;background:transparent;border:none;padding:0;font-size:.775rem;font-weight:400;cursor:pointer;transition:all .2s ease;display:inline-flex;align-items:center;justify-content:center;gap:.5rem;text-decoration:underline}.test-voice-link[_ngcontent-%COMP%]:hover{color:var(--color-primary-hover, var(--color-primary));text-decoration-thickness:2px}.test-voice-link[_ngcontent-%COMP%]:active{opacity:.8}.test-voice-link[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.test-voice-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.notification-error[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem;padding:.75rem;margin-top:.75rem;background-color:#d32f2f1a;border:1px solid rgba(211,47,47,.3);border-radius:6px;font-size:.8125rem;line-height:1.5}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#d32f2f;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{color:var(--color-text);flex:1}.notification-error[_ngcontent-%COMP%]{margin-top:.75rem;padding:.75rem;background-color:#f443361a;border:1px solid rgba(244,67,54,.3);border-radius:6px;display:flex;align-items:flex-start;gap:.5rem}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#f44336;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text);line-height:1.5;flex:1}']})};var Ke=class c{destroy$=new E;currentProject=null;currentThread=null;messagesSubject=new b([]);isThinkingSubject=new b(!1);currentChoiceSubject=new b(null);projectTitleSubject=new b("Coday");currentInviteEventSubject=new b(null);messageToRestoreSubject=new b("");threadUpdateEventSubject=new b(null);currentChoiceEvent=null;thinkingTimeout=null;accumulatedChunks="";streamingTextSubject=new b("");subThreadEventsSubject=new E;subThreadEvents$=this.subThreadEventsSubject.asObservable();subThreadEventBuffers=new Map;getBufferedSubThreadEvents(e){return this.subThreadEventBuffers.get(e)??[]}messages$=this.messagesSubject.asObservable();streamingText$=this.streamingTextSubject.asObservable();isThinking$=this.isThinkingSubject.asObservable();currentChoice$=this.currentChoiceSubject.asObservable();currentInviteEvent$=this.currentInviteEventSubject.asObservable();messageToRestore$=this.messageToRestoreSubject.asObservable();threadUpdateEvent$=this.threadUpdateEventSubject.asObservable();connectionStatus$;tabTitleService=null;eventStream=v(Ue);messageApi=v(He);userService=v(_e);constructor(){this.connectionStatus$=this.eventStream.connectionStatus$,this.initializeEventHandling()}setTabTitleService(e){this.tabTitleService=e}connectToThread(e,n){this.currentProject=e,this.currentThread=n,this.eventStream.connectToThread(e,n)}loadHistoryFromRest(e){for(let n of e){let t=$e(n);t&&this.handleEvent(t)}}resetMessages(){this.messagesSubject.next([]),this.currentChoiceSubject.next(null),this.currentInviteEventSubject.next(null),this.currentChoiceEvent=null,this.accumulatedChunks="",this.streamingTextSubject.next(""),this.subThreadEventBuffers.clear(),this.stopThinking()}sendMessage(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send message: no project or thread selected");return}let n=this.currentInviteEventSubject.value;if(n){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive(),this.currentInviteEventSubject.next(null);let t=n.buildAnswer(e);this.messageApi.sendMessage(t).subscribe({error:i=>{console.error("[CODAY] Send invite answer error:",i),this.currentInviteEventSubject.next(n),this.stopThinking()}})}else this.messageApi.sendFreeMessage(e).subscribe({error:t=>{console.error("[CODAY] Send error:",t)}})}sendChoice(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send choice: no project or thread selected");return}if(this.currentChoiceEvent){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive();let n=this.currentChoiceEvent.buildAnswer(e);this.currentChoiceSubject.next(null),this.currentChoiceEvent=null,this.messageApi.sendMessage(n).subscribe({next:()=>{},error:t=>{console.error("[CODAY-CHOICE] Choice error:",t),this.stopThinking()}})}else console.error("[CODAY-CHOICE] No choice event available for choice:",e)}deleteMessage(e){let n=this.messagesSubject.value.find(i=>i.id===e),t=this.extractTextContentFromMessage(n);return this.messageApi.deleteMessage(e).pipe(Q(i=>{i.success&&(this.removeMessagesFromIndex(e),t.trim()&&this.messageToRestoreSubject.next(t))}))}getCurrentProjectTitle(){return this.projectTitleSubject.value}getCurrentInviteEvent(){return this.currentInviteEventSubject.value}setThinkingForPendingMessage(){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive()}initializeEventHandling(){this.eventStream.events$.pipe(p(this.destroy$)).subscribe({next:e=>this.handleEvent(e),error:e=>console.error("[CODAY] Event stream error:",e),complete:()=>console.log("[CODAY] Event stream completed")})}handleEvent(e){if(e.threadId&&e.threadId!==this.currentThread){let n=this.subThreadEventBuffers.get(e.threadId);n?n.push(e):this.subThreadEventBuffers.set(e.threadId,[e]),this.subThreadEventsSubject.next(e);return}e instanceof Ae?this.handleMessageEvent(e):e instanceof Ve?this.handleTextChunkEvent(e):e instanceof ke?this.handleTextEvent(e):e instanceof xe?this.handleAnswerEvent(e):e instanceof Ne?this.handleErrorEvent(e):e instanceof Ie?this.handleWarnEvent(e):e instanceof q?this.handleThinkingEvent(e):e instanceof We?this.handleToolRequestEvent(e):e instanceof Re?this.handleToolResponseEvent(e):e instanceof je?this.handleChoiceEvent(e):e instanceof we?this.handleHeartBeatEvent(e):e instanceof Oe?this.handleInviteEvent(e):e instanceof De?this.handleThreadUpdateEvent(e):e instanceof Fe?this.handleDelegationEvent(e):e instanceof Be||e instanceof Le||console.warn("[CODAY] Unhandled event type:",e.type)}handleDelegationEvent(e){if(console.log("[CODAY] DelegationEvent received:",e.subThreadId,e.agentName),this.messagesSubject.value.findIndex(i=>i.subThreadId===e.subThreadId)===-1){let i={id:e.timestamp,role:"system",speaker:e.agentName,content:[{type:"text",content:""}],timestamp:new Date,type:"delegation",subThreadId:e.subThreadId,delegationAgentName:e.agentName};this.addMessage(i)}}handleThreadUpdateEvent(e){this.threadUpdateEventSubject.next(e)}handleMessageEvent(e){e.role==="assistant"&&this.accumulatedChunks&&(this.accumulatedChunks="",this.streamingTextSubject.next(""));let n={id:e.timestamp,role:e.role,speaker:e.name,content:e.content,timestamp:e.date,type:"text"};this.addMessage(n)}handleTextChunkEvent(e){this.accumulatedChunks+=e.chunk,this.streamingTextSubject.next(this.accumulatedChunks)}handleTextEvent(e){let n={id:e.timestamp,role:e.speaker?"assistant":"system",speaker:e.speaker??"System",content:[{type:"text",content:e.text}],timestamp:e.date,type:e.speaker?"text":"technical"};this.addMessage(n)}handleAnswerEvent(e){let n=this.currentInviteEventSubject.value;if(n){let i=!!e.parentKey&&e.parentKey===n.timestamp,o=!e.parentKey&&e.date>=n.date;(i||o)&&this.currentInviteEventSubject.next(null)}if(e.silent)return;let t={id:e.timestamp,role:"user",speaker:e.name??this.userService.getUsername()??"User",content:[{type:"text",content:e.answer}],timestamp:e.date,type:"text",parentKey:e.parentKey,invite:e.invite};this.addMessage(t)}handleErrorEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Error: ${JSON.stringify(e.error)}`}],timestamp:e.date,type:"error"};this.addMessage(n)}handleWarnEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Warning: ${JSON.stringify(e.warning)}`}],timestamp:e.date,type:"warning"};this.addMessage(n)}handleThinkingEvent(e){this.currentInviteEventSubject.value||this.currentChoiceEvent||(this.clearThinkingTimeout(),this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive(),this.thinkingTimeout=setTimeout(()=>{this.isThinkingSubject.next(!1),this.thinkingTimeout=null,this.tabTitleService?.setSystemInactive()},q.debounce+1e3))}handleToolRequestEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp};this.addMessage(n)}handleToolResponseEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp};this.addMessage(n)}handleChoiceEvent(e){this.stopThinking(),this.currentChoiceEvent=e,this.tabTitleService?.setSystemInactive();let n=e.options.map(i=>({value:i,label:i})),t=e.optionalQuestion?`${e.optionalQuestion} ${e.invite}`:e.invite;this.currentChoiceSubject.next({options:n,label:t,allowFreeText:e.allowFreeText})}handleHeartBeatEvent(e){}handleInviteEvent(e){if(this.stopThinking(),e.invite===Pe)this.currentInviteEventSubject.next(e),this.tabTitleService?.setSystemInactive();else{let t={id:e.timestamp,role:"assistant",speaker:"Assistant",content:[{type:"text",content:e.invite}],timestamp:e.date,type:"text"};this.addMessage(t),this.messagesSubject.value.some(_=>_.parentKey===e.timestamp||_.role==="user"&&_.timestamp>e.date||_.role==="assistant"&&_.timestamp>e.date)||(this.currentInviteEventSubject.next(e),this.tabTitleService?.setSystemInactive())}}addMessage(e){let n=this.messagesSubject.value;n.some(t=>t.id===e.id)||this.messagesSubject.next([...n,e])}removeMessagesFromIndex(e){let n=this.messagesSubject.value,t=n.findIndex(o=>o.id===e);if(t===-1||t===0)return;let i=n.slice(0,t);this.messagesSubject.next(i),this.stopThinking()}extractTextContentFromMessage(e){return e?e.content.filter(n=>n.type==="text").map(n=>n.content).join(`
|
|
4
|
+
`).map(n=>this.addPeriodIfNeeded(n.trim())).filter(n=>n.length>0).join(" ")}addPeriodIfNeeded(e){return e?/[.!?;:]$/.test(e)?e:e+".":""}static \u0275fac=function(n){return new(n||l)};static \u0275prov=P({token:l,factory:l.\u0275fac,providedIn:"root"})};var tt=(l,e)=>e.code,nt=(l,e)=>e.name+e.lang;function it(l,e){l&1&&(a(0,"div",17)(1,"mat-icon",39),s(2,"warning"),r(),a(3,"span",40),s(4," Browser notifications have been blocked. To enable them, please reset the site permissions in your browser settings. "),r()())}function ot(l,e){if(l&1&&(a(0,"option",25),s(1),r()),l&2){let n=e.$implicit;u("value",n.code),c(),re("",n.flag," ",n.label)}}function rt(l,e){l&1&&(a(0,"option",32),s(1,"Loading voices..."),r())}function at(l,e){l&1&&(a(0,"option",32),s(1,"No voice available"),r())}function st(l,e){if(l&1&&(a(0,"option",25),s(1),r()),l&2){let n=e.$implicit;u("value",n.name+"|"+n.lang),c(),y(" ",n.displayName," ")}}var Je=class l{destroy$=new C;selectedTheme="light";selectedVoiceLanguage="en-US";useEnterToSend=!1;printTechnicalMessages=!1;showTechnicalMessages=!0;showWarningMessages=!0;voiceInputMode="browser";voiceAnnounceEnabled=!1;voiceMode="speech";voiceReadFullText=!1;voiceVolume=80;voiceRate=120;agentNotificationEnabled=!1;notificationSoundEnabled=!0;browserNotificationEnabled=!1;browserNotificationDenied=!1;missionPreviewEnabled=!1;availableVoices=[];selectedVoiceId=null;loadingVoices=!1;voiceLanguageOptions=[{code:"fr-FR",label:"Fran\xE7ais",flag:"\u{1F1EB}\u{1F1F7}"},{code:"en-US",label:"English (US)",flag:"\u{1F1FA}\u{1F1F8}"},{code:"en-GB",label:"English (UK)",flag:"\u{1F1EC}\u{1F1E7}"},{code:"es-ES",label:"Espa\xF1ol",flag:"\u{1F1EA}\u{1F1F8}"},{code:"de-DE",label:"Deutsch",flag:"\u{1F1E9}\u{1F1EA}"},{code:"it-IT",label:"Italiano",flag:"\u{1F1EE}\u{1F1F9}"},{code:"pt-BR",label:"Portugu\xEAs",flag:"\u{1F1E7}\u{1F1F7}"},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",flag:"\u{1F1EF}\u{1F1F5}"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",flag:"\u{1F1F0}\u{1F1F7}"},{code:"zh-CN",label:"\u4E2D\u6587 (\u7B80\u4F53)",flag:"\u{1F1E8}\u{1F1F3}"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",flag:"\u{1F1F7}\u{1F1FA}"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",flag:"\u{1F1F8}\u{1F1E6}"}];preferencesService=v(N);voiceSynthesisService=v(L);themeService=v(_e);ngOnInit(){this.selectedTheme=this.themeService.getCurrentTheme(),this.selectedVoiceLanguage=this.preferencesService.getVoiceLanguage(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.printTechnicalMessages=this.preferencesService.getPrintTechnicalMessages(),this.showTechnicalMessages=!this.preferencesService.getHideTechnicalMessages(),this.showWarningMessages=!this.preferencesService.getHideWarningMessages(),this.voiceInputMode=this.preferencesService.getVoiceInputMode(),this.voiceAnnounceEnabled=this.preferencesService.getVoiceAnnounceEnabled(),this.voiceMode=this.preferencesService.getVoiceMode(),this.voiceReadFullText=this.preferencesService.getVoiceReadFullText(),this.voiceVolume=Math.round(this.preferencesService.getVoiceVolume()*100),this.voiceRate=Math.round(this.preferencesService.getVoiceRate()*100),this.selectedVoiceId=this.preferencesService.getSelectedVoice(),this.agentNotificationEnabled=this.preferencesService.getAgentNotificationEnabled(),this.notificationSoundEnabled=this.preferencesService.getNotificationSoundEnabled(),this.browserNotificationEnabled=this.preferencesService.getBrowserNotificationEnabled(),this.missionPreviewEnabled=this.preferencesService.getMissionPreviewEnabled(),this.loadAvailableVoices(),this.themeService.currentTheme$.pipe(p(this.destroy$)).subscribe(e=>{this.selectedTheme=e}),this.preferencesService.voiceLanguage$.pipe(p(this.destroy$)).subscribe(e=>{this.selectedVoiceLanguage=e}),this.preferencesService.enterToSend$.pipe(p(this.destroy$)).subscribe(e=>{this.useEnterToSend=e}),this.preferencesService.printTechnicalMessages$.pipe(p(this.destroy$)).subscribe(e=>{this.printTechnicalMessages=e}),this.preferencesService.hideTechnicalMessages$.pipe(p(this.destroy$)).subscribe(e=>{this.showTechnicalMessages=!e}),this.preferencesService.hideWarningMessages$.pipe(p(this.destroy$)).subscribe(e=>{this.showWarningMessages=!e}),this.preferencesService.voiceInputMode$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceInputMode=e}),this.preferencesService.voiceAnnounceEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceAnnounceEnabled=e}),this.preferencesService.voiceMode$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceMode=e}),this.preferencesService.voiceReadFullText$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceReadFullText=e}),this.preferencesService.voiceVolume$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceVolume=Math.round(e*100)}),this.preferencesService.voiceRate$.pipe(p(this.destroy$)).subscribe(e=>{this.voiceRate=Math.round(e*100)}),this.preferencesService.selectedVoice$.pipe(p(this.destroy$)).subscribe(e=>{this.selectedVoiceId=e}),this.preferencesService.voiceLanguage$.pipe(p(this.destroy$)).subscribe(()=>{this.loadAvailableVoices()}),this.preferencesService.agentNotificationEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.agentNotificationEnabled=e}),this.preferencesService.notificationSoundEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.notificationSoundEnabled=e}),this.preferencesService.browserNotificationEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.browserNotificationEnabled=e,this.checkNotificationPermission()}),this.preferencesService.missionPreviewEnabled$.pipe(p(this.destroy$)).subscribe(e=>{this.missionPreviewEnabled=e})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}onThemeChange(){console.log("[OPTIONS] Theme changed to:",this.selectedTheme),this.themeService.setTheme(this.selectedTheme)}onVoiceLanguageChange(){console.log("[OPTIONS] Voice language changed to:",this.selectedVoiceLanguage),this.preferencesService.setVoiceLanguage(this.selectedVoiceLanguage)}onEnterToSendChange(){console.log("[OPTIONS] Enter to send changed to:",this.useEnterToSend),this.preferencesService.setEnterToSend(this.useEnterToSend)}onPrintTechnicalMessagesChange(){console.log("[OPTIONS] Print technical messages changed to:",this.printTechnicalMessages),this.preferencesService.setPrintTechnicalMessages(this.printTechnicalMessages)}onShowTechnicalMessagesChange(){let e=!this.showTechnicalMessages;console.log("[OPTIONS] Show technical messages changed to:",this.showTechnicalMessages,"(hide:",e,")"),this.preferencesService.setHideTechnicalMessages(e)}onShowWarningMessagesChange(){let e=!this.showWarningMessages;console.log("[OPTIONS] Show warning messages changed to:",this.showWarningMessages,"(hide:",e,")"),this.preferencesService.setHideWarningMessages(e)}onVoiceInputModeChange(e){let n=e.target.value;console.log("[OPTIONS] Voice input mode changed to:",n),this.preferencesService.setVoiceInputMode(n)}onVoiceAnnounceEnabledChange(){console.log("[OPTIONS] Voice announce enabled changed to:",this.voiceAnnounceEnabled),this.preferencesService.setVoiceAnnounceEnabled(this.voiceAnnounceEnabled)}onVoiceModeChange(){console.log("[OPTIONS] Voice mode changed to:",this.voiceMode),this.preferencesService.setVoiceMode(this.voiceMode)}onVoiceReadFullTextChange(){console.log("[OPTIONS] Voice read full text changed to:",this.voiceReadFullText),this.preferencesService.setVoiceReadFullText(this.voiceReadFullText)}onVoiceVolumeChange(){let e=this.voiceVolume/100;console.log("[OPTIONS] Voice volume changed to:",e),this.preferencesService.setVoiceVolume(e)}onVoiceRateChange(){let e=this.voiceRate/100;console.log("[OPTIONS] Voice rate changed to:",e),this.preferencesService.setVoiceRate(e)}loadAvailableVoices(){return S(this,null,function*(){this.loadingVoices=!0;try{this.availableVoices=yield this.voiceSynthesisService.getVoicesForLanguage(),console.log("[OPTIONS] Loaded",this.availableVoices.length,"voices for current language")}catch(e){console.error("[OPTIONS] Error loading voices:",e),this.availableVoices=[]}finally{this.loadingVoices=!1}})}onSelectedVoiceChange(){console.log("[OPTIONS] Selected voice changed to:",this.selectedVoiceId),this.preferencesService.setSelectedVoice(this.selectedVoiceId)}testVoice(){console.log("[OPTIONS] Testing voice with current settings"),this.voiceSynthesisService.testSelectedVoice()}onAgentNotificationEnabledChange(){console.log("[OPTIONS] Agent notification enabled changed to:",this.agentNotificationEnabled),this.preferencesService.setAgentNotificationEnabled(this.agentNotificationEnabled)}onNotificationSoundEnabledChange(){console.log("[OPTIONS] Notification sound enabled changed to:",this.notificationSoundEnabled),this.preferencesService.setNotificationSoundEnabled(this.notificationSoundEnabled)}onBrowserNotificationEnabledChange(){console.log("[OPTIONS] Browser notification enabled changed to:",this.browserNotificationEnabled),this.preferencesService.setBrowserNotificationEnabled(this.browserNotificationEnabled)}onMissionPreviewEnabledChange(){console.log("[OPTIONS] Mission preview panel enabled changed to:",this.missionPreviewEnabled),this.preferencesService.setMissionPreviewEnabled(this.missionPreviewEnabled)}checkNotificationPermission(){"Notification"in window&&(this.browserNotificationDenied=Notification.permission==="denied",console.log("[OPTIONS] Notification permission status:",Notification.permission))}static \u0275fac=function(n){return new(n||l)};static \u0275cmp=E({type:l,selectors:[["app-options-panel"]],decls:168,vars:37,consts:[[1,"options-content"],[1,"option-section"],[1,"section-title"],[1,"option-group"],[1,"radio-group"],[1,"option-radio"],["type","radio","name","theme","value","light",3,"ngModelChange","change","ngModel"],[1,"radio-mark"],["type","radio","name","theme","value","dark",3,"ngModelChange","change","ngModel"],["type","radio","name","theme","value","system",3,"ngModelChange","change","ngModel"],[1,"option-label"],["type","radio","name","enterBehavior",3,"ngModelChange","change","value","ngModel"],[1,"toggle-option"],["color","primary",3,"ngModelChange","change","ngModel"],[1,"option-label-with-hint"],[1,"option-hint"],["color","primary",3,"ngModelChange","change","ngModel","disabled"],[1,"notification-error"],["for","voice-input-mode-select",1,"option-label"],["id","voice-input-mode-select",1,"option-select",3,"change","value"],["value","browser"],["value","whisper"],["value","voice-message"],["for","voice-language-select",1,"option-label"],["id","voice-language-select",1,"option-select",3,"ngModelChange","change","ngModel"],[3,"value"],["type","radio","name","voiceAnnounce",3,"ngModelChange","change","value","ngModel"],["type","radio","name","voiceMode","value","speech",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceMode","value","notification",3,"ngModelChange","change","ngModel"],["type","radio","name","voiceReadFull",3,"ngModelChange","change","value","ngModel"],["for","voice-select",1,"option-label"],["id","voice-select",1,"option-select",3,"ngModelChange","change","ngModel","disabled"],["value",""],["role","button","tabindex","0","title","Test voice with current settings",1,"test-voice-link",3,"click"],[1,"thread-name"],["for","voice-volume-slider",1,"option-label"],["id","voice-volume-slider","type","range","min","0","max","100","step","5",1,"option-slider",3,"ngModelChange","input","ngModel"],["for","voice-rate-slider",1,"option-label"],["id","voice-rate-slider","type","range","min","50","max","200","step","10",1,"option-slider",3,"ngModelChange","input","ngModel"],[1,"error-icon"],[1,"error-message"]],template:function(n,t){n&1&&(a(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-icon"),s(4,"palette"),r(),a(5,"span"),s(6,"Appearance"),r()(),a(7,"div",3)(8,"div",4)(9,"label",5)(10,"input",6),h("ngModelChange",function(o){return m(t.selectedTheme,o)||(t.selectedTheme=o),o}),d("change",function(){return t.onThemeChange()}),r(),f(11,"span",7),s(12," Light "),r(),a(13,"label",5)(14,"input",8),h("ngModelChange",function(o){return m(t.selectedTheme,o)||(t.selectedTheme=o),o}),d("change",function(){return t.onThemeChange()}),r(),f(15,"span",7),s(16," Dark "),r(),a(17,"label",5)(18,"input",9),h("ngModelChange",function(o){return m(t.selectedTheme,o)||(t.selectedTheme=o),o}),d("change",function(){return t.onThemeChange()}),r(),f(19,"span",7),s(20," System "),r()()()(),a(21,"div",1)(22,"div",2)(23,"mat-icon"),s(24,"chat_bubble_outline"),r(),a(25,"span"),s(26,"Messaging"),r()(),a(27,"div",3)(28,"span",10),s(29,"Send message behavior:"),r(),a(30,"div",4)(31,"label",5)(32,"input",11),h("ngModelChange",function(o){return m(t.useEnterToSend,o)||(t.useEnterToSend=o),o}),d("change",function(){return t.onEnterToSendChange()}),r(),f(33,"span",7),s(34," Enter to send "),r(),a(35,"label",5)(36,"input",11),h("ngModelChange",function(o){return m(t.useEnterToSend,o)||(t.useEnterToSend=o),o}),d("change",function(){return t.onEnterToSendChange()}),r(),f(37,"span",7),s(38," Enter for new line "),r()()(),a(39,"div",3)(40,"div",12)(41,"span",10),s(42,"Show technical messages"),r(),a(43,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.showTechnicalMessages,o)||(t.showTechnicalMessages=o),o}),d("change",function(){return t.onShowTechnicalMessagesChange()}),r()()(),a(44,"div",3)(45,"div",12)(46,"span",10),s(47,"Show warning messages"),r(),a(48,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.showWarningMessages,o)||(t.showWarningMessages=o),o}),d("change",function(){return t.onShowWarningMessagesChange()}),r()()(),a(49,"div",3)(50,"div",12)(51,"span",10),s(52,"Include technical messages in print"),r(),a(53,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.printTechnicalMessages,o)||(t.printTechnicalMessages=o),o}),d("change",function(){return t.onPrintTechnicalMessagesChange()}),r()()()(),a(54,"div",1)(55,"div",2)(56,"mat-icon"),s(57,"rocket_launch"),r(),a(58,"span"),s(59,"Mission Control"),r()(),a(60,"div",3)(61,"div",12)(62,"div",14)(63,"span",10),s(64,"Side-by-side thread preview"),r(),a(65,"span",15),s(66,"Click a mission card to open a preview panel. Recommended for large screens."),r()(),a(67,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.missionPreviewEnabled,o)||(t.missionPreviewEnabled=o),o}),d("change",function(){return t.onMissionPreviewEnabledChange()}),r()()()(),a(68,"div",1)(69,"div",2)(70,"mat-icon"),s(71,"notifications"),r(),a(72,"span"),s(73,"Notifications"),r()(),a(74,"div",3)(75,"div",12)(76,"span",10),s(77,"Notify when the agent answers or requests input"),r(),a(78,"mat-slide-toggle",13),h("ngModelChange",function(o){return m(t.agentNotificationEnabled,o)||(t.agentNotificationEnabled=o),o}),d("change",function(){return t.onAgentNotificationEnabledChange()}),r()()(),a(79,"div",3)(80,"div",12)(81,"span",10),s(82,"Notification sound"),r(),a(83,"mat-slide-toggle",16),h("ngModelChange",function(o){return m(t.notificationSoundEnabled,o)||(t.notificationSoundEnabled=o),o}),d("change",function(){return t.onNotificationSoundEnabledChange()}),r()()(),a(84,"div",3)(85,"div",12)(86,"span",10),s(87,"Browser notification"),r(),a(88,"mat-slide-toggle",16),h("ngModelChange",function(o){return m(t.browserNotificationEnabled,o)||(t.browserNotificationEnabled=o),o}),d("change",function(){return t.onBrowserNotificationEnabledChange()}),r()(),T(89,it,5,0,"div",17),r()(),a(90,"div",1)(91,"div",2)(92,"mat-icon"),s(93,"record_voice_over"),r(),a(94,"span"),s(95,"Voice & Speech"),r()(),a(96,"div",3)(97,"label",18),s(98,"Voice input method:"),r(),a(99,"select",19),d("change",function(o){return t.onVoiceInputModeChange(o)}),a(100,"option",20),s(101,"Browser (real-time)"),r(),a(102,"option",21),s(103,"Whisper (higher accuracy)"),r(),a(104,"option",22),s(105,"Voice message (send audio)"),r()()(),a(106,"div",3)(107,"label",23),s(108,"Voice recognition language:"),r(),a(109,"select",24),h("ngModelChange",function(o){return m(t.selectedVoiceLanguage,o)||(t.selectedVoiceLanguage=o),o}),d("change",function(){return t.onVoiceLanguageChange()}),$(110,ot,2,3,"option",25,tt),r()(),a(112,"div",3)(113,"span",10),s(114,"Automatic announcement:"),r(),a(115,"div",4)(116,"label",5)(117,"input",26),h("ngModelChange",function(o){return m(t.voiceAnnounceEnabled,o)||(t.voiceAnnounceEnabled=o),o}),d("change",function(){return t.onVoiceAnnounceEnabledChange()}),r(),f(118,"span",7),s(119," Enabled "),r(),a(120,"label",5)(121,"input",26),h("ngModelChange",function(o){return m(t.voiceAnnounceEnabled,o)||(t.voiceAnnounceEnabled=o),o}),d("change",function(){return t.onVoiceAnnounceEnabledChange()}),r(),f(122,"span",7),s(123," Disabled "),r()()(),a(124,"div",3)(125,"span",10),s(126,"Voice mode:"),r(),a(127,"div",4)(128,"label",5)(129,"input",27),h("ngModelChange",function(o){return m(t.voiceMode,o)||(t.voiceMode=o),o}),d("change",function(){return t.onVoiceModeChange()}),r(),f(130,"span",7),s(131," Voice synthesis "),r(),a(132,"label",5)(133,"input",28),h("ngModelChange",function(o){return m(t.voiceMode,o)||(t.voiceMode=o),o}),d("change",function(){return t.onVoiceModeChange()}),r(),f(134,"span",7),s(135," Sound notification "),r()()(),a(136,"div",3)(137,"span",10),s(138,"Message reading:"),r(),a(139,"div",4)(140,"label",5)(141,"input",29),h("ngModelChange",function(o){return m(t.voiceReadFullText,o)||(t.voiceReadFullText=o),o}),d("change",function(){return t.onVoiceReadFullTextChange()}),r(),f(142,"span",7),s(143," Full message "),r(),a(144,"label",5)(145,"input",29),h("ngModelChange",function(o){return m(t.voiceReadFullText,o)||(t.voiceReadFullText=o),o}),d("change",function(){return t.onVoiceReadFullTextChange()}),r(),f(146,"span",7),s(147," First paragraphs only "),r()()(),a(148,"div",3)(149,"label",30),s(150,"Selected voice:"),r(),a(151,"select",31),h("ngModelChange",function(o){return m(t.selectedVoiceId,o)||(t.selectedVoiceId=o),o}),d("change",function(){return t.onSelectedVoiceChange()}),T(152,rt,2,0,"option",32),T(153,at,2,0,"option",32),$(154,st,2,2,"option",25,nt),r(),f(156,"div",10),a(157,"a",33),d("click",function(){return t.testVoice()}),a(158,"span",34),s(159,"Test voice"),r()()(),a(160,"div",3)(161,"label",35),s(162),r(),a(163,"input",36),h("ngModelChange",function(o){return m(t.voiceVolume,o)||(t.voiceVolume=o),o}),d("input",function(){return t.onVoiceVolumeChange()}),r()(),a(164,"div",3)(165,"label",37),s(166),r(),a(167,"input",38),h("ngModelChange",function(o){return m(t.voiceRate,o)||(t.voiceRate=o),o}),d("input",function(){return t.onVoiceRateChange()}),r()()()()),n&2&&(c(10),g("ngModel",t.selectedTheme),c(4),g("ngModel",t.selectedTheme),c(4),g("ngModel",t.selectedTheme),c(14),u("value",!0),g("ngModel",t.useEnterToSend),c(4),u("value",!1),g("ngModel",t.useEnterToSend),c(7),g("ngModel",t.showTechnicalMessages),c(5),g("ngModel",t.showWarningMessages),c(5),g("ngModel",t.printTechnicalMessages),c(14),g("ngModel",t.missionPreviewEnabled),c(11),g("ngModel",t.agentNotificationEnabled),c(5),g("ngModel",t.notificationSoundEnabled),u("disabled",!t.agentNotificationEnabled),c(5),g("ngModel",t.browserNotificationEnabled),u("disabled",!t.agentNotificationEnabled||t.browserNotificationDenied),c(),w(t.browserNotificationDenied?89:-1),c(10),u("value",t.voiceInputMode),c(10),g("ngModel",t.selectedVoiceLanguage),c(),z(t.voiceLanguageOptions),c(7),u("value",!0),g("ngModel",t.voiceAnnounceEnabled),c(4),u("value",!1),g("ngModel",t.voiceAnnounceEnabled),c(8),g("ngModel",t.voiceMode),c(4),g("ngModel",t.voiceMode),c(8),u("value",!0),g("ngModel",t.voiceReadFullText),c(4),u("value",!1),g("ngModel",t.voiceReadFullText),c(6),g("ngModel",t.selectedVoiceId),u("disabled",t.loadingVoices||t.availableVoices.length===0),c(),w(t.loadingVoices?152:-1),c(),w(!t.loadingVoices&&t.availableVoices.length===0?153:-1),c(),z(t.availableVoices),c(8),y("Volume: ",t.voiceVolume,"%"),c(),g("ngModel",t.voiceVolume),c(3),y("Speed: ",t.voiceRate,"%"),c(),g("ngModel",t.voiceRate))},dependencies:[D,Ee,Me,W,Ce,ye,Se,R,A,j,$e],styles:['.options-content[_ngcontent-%COMP%]{padding:0;width:100%}.option-group[_ngcontent-%COMP%]{padding:0 1rem 1rem;margin-bottom:1rem;border-bottom:1px solid var(--color-border-light)}.option-group[_ngcontent-%COMP%]:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}.option-label[_ngcontent-%COMP%]{display:block;margin-bottom:.5rem;font-weight:500;color:var(--color-text);font-size:.875rem}.toggle-option[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;gap:1rem}.toggle-option[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0;flex:1}.toggle-option[_ngcontent-%COMP%] mat-slide-toggle[_ngcontent-%COMP%]{flex-shrink:0}.option-label-with-hint[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;flex:1}.option-label-with-hint[_ngcontent-%COMP%] .option-label[_ngcontent-%COMP%]{margin-bottom:0}.option-label-with-hint[_ngcontent-%COMP%] .option-hint[_ngcontent-%COMP%]{font-size:.775rem;color:var(--color-text-secondary);line-height:1.4}.option-select[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-border);border-radius:4px;background:var(--color-input-bg);color:var(--color-text);font-size:.875rem;cursor:pointer}.option-select[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 3px #7064fb1a}.option-select[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.option-select[_ngcontent-%COMP%] option[_ngcontent-%COMP%]{padding:.5rem}.option-checkbox[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{display:none}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]{width:18px;height:18px;border:2px solid var(--color-border);border-radius:3px;margin-right:.75rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0}.option-checkbox[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]:after{content:"";width:10px;height:6px;border-left:2px solid transparent;border-bottom:2px solid transparent;transform:rotate(-45deg);transition:all .2s ease;opacity:0}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]{background-color:var(--color-primary);border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + .checkmark[_ngcontent-%COMP%]:after{border-left-color:#fff;border-bottom-color:#fff;opacity:1}.option-checkbox[_ngcontent-%COMP%]:hover .checkmark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-checkbox[_ngcontent-%COMP%]:focus-within .checkmark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-section[_ngcontent-%COMP%]{padding-top:1rem;margin-top:1rem;border-top:2px solid var(--color-border)}.option-section[_ngcontent-%COMP%]:first-child{border-top:none;padding-top:0;margin-top:0}.section-title[_ngcontent-%COMP%]{margin:0 0 1rem;padding:0 1rem;font-size:.9rem;font-weight:600;color:var(--color-text);display:flex;align-items:center;gap:.5rem}.section-title[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.radio-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.option-radio[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;font-size:.875rem;color:var(--color-text);-webkit-user-select:none;user-select:none}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{display:none}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]{width:16px;height:16px;border:2px solid var(--color-border);border-radius:50%;margin-right:.5rem;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0;position:relative}.option-radio[_ngcontent-%COMP%] .radio-mark[_ngcontent-%COMP%]:after{content:"";width:8px;height:8px;border-radius:50%;background-color:var(--color-primary);transition:all .2s ease;opacity:0;transform:scale(0)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]:checked + .radio-mark[_ngcontent-%COMP%]:after{opacity:1;transform:scale(1)}.option-radio[_ngcontent-%COMP%]:hover .radio-mark[_ngcontent-%COMP%]{border-color:var(--color-primary)}.option-radio[_ngcontent-%COMP%]:focus-within .radio-mark[_ngcontent-%COMP%]{box-shadow:0 0 0 3px #7064fb1a}.option-slider[_ngcontent-%COMP%]{width:100%;height:6px;border-radius:3px;background:var(--color-bg-solid);outline:none;cursor:pointer;-webkit-appearance:none;appearance:none}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-webkit-slider-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:var(--color-primary);cursor:pointer;border:2px solid white;box-shadow:0 2px 6px #0003;transition:all .2s ease}.option-slider[_ngcontent-%COMP%]::-moz-range-thumb:hover{transform:scale(1.1);box-shadow:0 2px 8px #0000004d}.option-slider[_ngcontent-%COMP%]::-webkit-slider-track{height:6px;border-radius:3px;background:var(--color-bg-secondary)}.option-slider[_ngcontent-%COMP%]::-moz-range-track{height:6px;border-radius:3px;background:var(--color-bg-secondary);border:none}.option-slider[_ngcontent-%COMP%]:focus{outline:none}.option-slider[_ngcontent-%COMP%]:focus::-webkit-slider-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.option-slider[_ngcontent-%COMP%]:focus::-moz-range-thumb{box-shadow:0 0 0 3px #7064fb4d,0 2px 6px #0003}.test-voice-btn[_ngcontent-%COMP%]{width:100%;padding:.75rem 1rem;background:var(--color-primary);color:#fff;border:none;border-radius:6px;font-size:.875rem;font-weight:500;cursor:pointer;transition:all .2s ease;display:flex;align-items:center;justify-content:center;gap:.5rem}.test-voice-btn[_ngcontent-%COMP%]:hover{background:var(--color-primary-hover);transform:translateY(-1px);box-shadow:0 2px 8px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:active{transform:translateY(0);box-shadow:0 1px 4px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:focus{outline:none;box-shadow:0 0 0 3px #7064fb4d}.test-voice-btn[_ngcontent-%COMP%]:disabled{background:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;transform:none;box-shadow:none}.test-voice-link[_ngcontent-%COMP%]{text-decoration-thickness:1.5px;text-underline-offset:3px;background:transparent;border:none;padding:0;font-size:.775rem;font-weight:400;cursor:pointer;transition:all .2s ease;display:inline-flex;align-items:center;justify-content:center;gap:.5rem;text-decoration:underline}.test-voice-link[_ngcontent-%COMP%]:hover{color:var(--color-primary-hover, var(--color-primary));text-decoration-thickness:2px}.test-voice-link[_ngcontent-%COMP%]:active{opacity:.8}.test-voice-link[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.test-voice-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.notification-error[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem;padding:.75rem;margin-top:.75rem;background-color:#d32f2f1a;border:1px solid rgba(211,47,47,.3);border-radius:6px;font-size:.8125rem;line-height:1.5}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#d32f2f;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{color:var(--color-text);flex:1}.notification-error[_ngcontent-%COMP%]{margin-top:.75rem;padding:.75rem;background-color:#f443361a;border:1px solid rgba(244,67,54,.3);border-radius:6px;display:flex;align-items:flex-start;gap:.5rem}.notification-error[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{color:#f44336;font-size:20px;width:20px;height:20px;flex-shrink:0;margin-top:2px}.notification-error[_ngcontent-%COMP%] .error-message[_ngcontent-%COMP%]{font-size:.8125rem;color:var(--color-text);line-height:1.5;flex:1}']})};var Ye=class l{destroy$=new C;currentProject=null;currentThread=null;messagesSubject=new b([]);isThinkingSubject=new b(!1);currentChoiceSubject=new b(null);projectTitleSubject=new b("Coday");currentInviteEventSubject=new b(null);messageToRestoreSubject=new b("");threadUpdateEventSubject=new b(null);currentChoiceEvent=null;thinkingTimeout=null;accumulatedChunks="";streamingTextSubject=new b("");subThreadEventsSubject=new C;subThreadEvents$=this.subThreadEventsSubject.asObservable();subThreadEventBuffers=new Map;getBufferedSubThreadEvents(e){return this.subThreadEventBuffers.get(e)??[]}messages$=this.messagesSubject.asObservable();streamingText$=this.streamingTextSubject.asObservable();isThinking$=this.isThinkingSubject.asObservable();currentChoice$=this.currentChoiceSubject.asObservable();currentInviteEvent$=this.currentInviteEventSubject.asObservable();messageToRestore$=this.messageToRestoreSubject.asObservable();threadUpdateEvent$=this.threadUpdateEventSubject.asObservable();connectionStatus$;tabTitleService=null;eventStream=v(ze);messageApi=v(Ue);userService=v(be);constructor(){this.connectionStatus$=this.eventStream.connectionStatus$,this.initializeEventHandling()}setTabTitleService(e){this.tabTitleService=e}connectToThread(e,n){this.currentProject=e,this.currentThread=n,this.eventStream.connectToThread(e,n)}loadHistoryFromRest(e){for(let n of e){let t=Be(n);t&&this.handleEvent(t)}}resetMessages(){this.messagesSubject.next([]),this.currentChoiceSubject.next(null),this.currentInviteEventSubject.next(null),this.currentChoiceEvent=null,this.accumulatedChunks="",this.streamingTextSubject.next(""),this.subThreadEventBuffers.clear(),this.stopThinking()}sendMessage(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send message: no project or thread selected");return}let n=this.currentInviteEventSubject.value;if(n){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive(),this.currentInviteEventSubject.next(null);let t=n.buildAnswer(e);this.messageApi.sendMessage(t).subscribe({error:i=>{console.error("[CODAY] Send invite answer error:",i),this.currentInviteEventSubject.next(n),this.stopThinking()}})}else this.messageApi.sendFreeMessage(e).subscribe({error:t=>{console.error("[CODAY] Send error:",t)}})}sendChoice(e){if(!this.currentProject||!this.currentThread){console.error("[CODAY] Cannot send choice: no project or thread selected");return}if(this.currentChoiceEvent){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive();let n=this.currentChoiceEvent.buildAnswer(e);this.currentChoiceSubject.next(null),this.currentChoiceEvent=null,this.messageApi.sendMessage(n).subscribe({next:()=>{},error:t=>{console.error("[CODAY-CHOICE] Choice error:",t),this.stopThinking()}})}else console.error("[CODAY-CHOICE] No choice event available for choice:",e)}deleteMessage(e){let n=this.messagesSubject.value.find(i=>i.id===e),t=this.extractTextContentFromMessage(n);return this.messageApi.deleteMessage(e).pipe(J(i=>{i.success&&(this.removeMessagesFromIndex(e),t.trim()&&this.messageToRestoreSubject.next(t))}))}getCurrentProjectTitle(){return this.projectTitleSubject.value}getCurrentInviteEvent(){return this.currentInviteEventSubject.value}setThinkingForPendingMessage(){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive()}initializeEventHandling(){this.eventStream.events$.pipe(p(this.destroy$)).subscribe({next:e=>this.handleEvent(e),error:e=>console.error("[CODAY] Event stream error:",e),complete:()=>console.log("[CODAY] Event stream completed")})}handleEvent(e){if(e.threadId&&e.threadId!==this.currentThread){let n=this.subThreadEventBuffers.get(e.threadId);n?n.push(e):this.subThreadEventBuffers.set(e.threadId,[e]),this.subThreadEventsSubject.next(e);return}e instanceof Re?this.handleMessageEvent(e):e instanceof ke?this.handleTextChunkEvent(e):e instanceof xe?this.handleTextEvent(e):e instanceof Pe?this.handleAnswerEvent(e):e instanceof Ie?this.handleErrorEvent(e):e instanceof Ve?this.handleWarnEvent(e):e instanceof U?this.handleThinkingEvent(e):e instanceof je?this.handleToolRequestEvent(e):e instanceof We?this.handleToolResponseEvent(e):e instanceof Ne?this.handleChoiceEvent(e):e instanceof Te?this.handleHeartBeatEvent(e):e instanceof we?this.handleInviteEvent(e):e instanceof Ae?this.handleThreadUpdateEvent(e):e instanceof Fe?this.handleDelegationEvent(e):e instanceof De||e instanceof Le||console.warn("[CODAY] Unhandled event type:",e.type)}handleDelegationEvent(e){if(console.log("[CODAY] DelegationEvent received:",e.subThreadId,e.agentName),this.messagesSubject.value.findIndex(i=>i.subThreadId===e.subThreadId)===-1){let i={id:e.timestamp,role:"system",speaker:e.agentName,content:[{type:"text",content:""}],timestamp:new Date,type:"delegation",subThreadId:e.subThreadId,delegationAgentName:e.agentName};this.addMessage(i)}}handleThreadUpdateEvent(e){this.threadUpdateEventSubject.next(e)}handleMessageEvent(e){e.role==="assistant"&&this.accumulatedChunks&&(this.accumulatedChunks="",this.streamingTextSubject.next(""));let n={id:e.timestamp,role:e.role,speaker:e.name,content:e.content,timestamp:e.date,type:"text"};this.addMessage(n)}handleTextChunkEvent(e){this.accumulatedChunks+=e.chunk,this.streamingTextSubject.next(this.accumulatedChunks)}handleTextEvent(e){let n={id:e.timestamp,role:e.speaker?"assistant":"system",speaker:e.speaker??"System",content:[{type:"text",content:e.text}],timestamp:e.date,type:e.speaker?"text":"technical"};this.addMessage(n)}handleAnswerEvent(e){let n=this.currentInviteEventSubject.value;if(n){let i=!!e.parentKey&&e.parentKey===n.timestamp,o=!e.parentKey&&e.date>=n.date;(i||o)&&this.currentInviteEventSubject.next(null)}if(e.silent)return;let t={id:e.timestamp,role:"user",speaker:e.name??this.userService.getUsername()??"User",content:[{type:"text",content:e.answer}],timestamp:e.date,type:"text",parentKey:e.parentKey,invite:e.invite};this.addMessage(t)}handleErrorEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Error: ${JSON.stringify(e.error)}`}],timestamp:e.date,type:"error"};this.addMessage(n)}handleWarnEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Warning: ${JSON.stringify(e.warning)}`}],timestamp:e.date,type:"warning"};this.addMessage(n)}handleThinkingEvent(e){this.currentInviteEventSubject.value||this.currentChoiceEvent||(this.clearThinkingTimeout(),this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive(),this.thinkingTimeout=setTimeout(()=>{this.isThinkingSubject.next(!1),this.thinkingTimeout=null,this.tabTitleService?.setSystemInactive()},U.debounce+1e3))}handleToolRequestEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp};this.addMessage(n)}handleToolResponseEvent(e){let n={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp};this.addMessage(n)}handleChoiceEvent(e){this.stopThinking(),this.currentChoiceEvent=e,this.tabTitleService?.setSystemInactive();let n=e.options.map(i=>({value:i,label:i})),t=e.optionalQuestion?`${e.optionalQuestion} ${e.invite}`:e.invite;this.currentChoiceSubject.next({options:n,label:t,allowFreeText:e.allowFreeText})}handleHeartBeatEvent(e){}handleInviteEvent(e){if(this.stopThinking(),e.invite===Oe)this.currentInviteEventSubject.next(e),this.tabTitleService?.setSystemInactive();else{let t={id:e.timestamp,role:"assistant",speaker:"Assistant",content:[{type:"text",content:e.invite}],timestamp:e.date,type:"text"};this.addMessage(t),this.messagesSubject.value.some(_=>_.parentKey===e.timestamp||_.role==="user"&&_.timestamp>e.date||_.role==="assistant"&&_.timestamp>e.date)||(this.currentInviteEventSubject.next(e),this.tabTitleService?.setSystemInactive())}}addMessage(e){let n=this.messagesSubject.value;n.some(t=>t.id===e.id)||this.messagesSubject.next([...n,e])}removeMessagesFromIndex(e){let n=this.messagesSubject.value,t=n.findIndex(o=>o.id===e);if(t===-1||t===0)return;let i=n.slice(0,t);this.messagesSubject.next(i),this.stopThinking()}extractTextContentFromMessage(e){return e?e.content.filter(n=>n.type==="text").map(n=>n.content).join(`
|
|
6
5
|
|
|
7
|
-
`):""}clearThinkingTimeout(){this.thinkingTimeout&&(clearTimeout(this.thinkingTimeout),this.thinkingTimeout=null)}stopThinking(){this.clearThinkingTimeout(),this.isThinkingSubject.next(!1),this.tabTitleService&&this.tabTitleService.setSystemInactive()}ngOnDestroy(){this.clearThinkingTimeout(),this.destroy$.next(),this.destroy$.complete(),this.currentInviteEventSubject.complete(),this.messageToRestoreSubject.complete(),this.threadUpdateEventSubject.complete(),this.streamingTextSubject.complete(),this.eventStream.disconnect()}static \u0275fac=function(n){return new(n||
|
|
6
|
+
`):""}clearThinkingTimeout(){this.thinkingTimeout&&(clearTimeout(this.thinkingTimeout),this.thinkingTimeout=null)}stopThinking(){this.clearThinkingTimeout(),this.isThinkingSubject.next(!1),this.tabTitleService&&this.tabTitleService.setSystemInactive()}ngOnDestroy(){this.clearThinkingTimeout(),this.destroy$.next(),this.destroy$.complete(),this.currentInviteEventSubject.complete(),this.messageToRestoreSubject.complete(),this.threadUpdateEventSubject.complete(),this.streamingTextSubject.complete(),this.eventStream.disconnect()}static \u0275fac=function(n){return new(n||l)};static \u0275prov=P({token:l,factory:l.\u0275fac,providedIn:"root"})};function ct(l,e){if(l&1&&(a(0,"div",3),s(1),r()),l&2){let n=k();c(),y("\u274C ",n.errorMessage)}}var Ke=class l{dialogRef=v(pe);data=v(ge);jsonContent;errorMessage="";title;constructor(){this.jsonContent=this.data.initialContent,this.title=this.data.title||this.getDefaultTitle(this.data.configType,this.data.projectName)}getDefaultTitle(e,n){return e==="user"?"User Configuration":`Project Configuration: ${n||"Unknown"}`}onSave(){this.errorMessage="";let e;try{e=JSON.parse(this.jsonContent)}catch(n){this.errorMessage=`Invalid JSON syntax: ${n instanceof Error?n.message:"Unknown error"}`;return}this.dialogRef.close(e)}onCancel(){this.dialogRef.close()}static \u0275fac=function(n){return new(n||l)};static \u0275cmp=E({type:l,selectors:[["app-json-editor"]],decls:13,vars:3,consts:[["mat-dialog-title",""],["mat-icon-button","","title","Close",1,"close-button",3,"click"],["spellcheck","false","placeholder","Enter JSON configuration...",1,"json-textarea",3,"ngModelChange","ngModel"],[1,"error-message"],["align","end"],["matButton","",3,"click"],["matButton","filled","color","primary",3,"click"]],template:function(n,t){n&1&&(a(0,"div",0),s(1),a(2,"button",1),d("click",function(){return t.onCancel()}),a(3,"mat-icon"),s(4,"close"),r()()(),a(5,"mat-dialog-content")(6,"textarea",2),h("ngModelChange",function(o){return m(t.jsonContent,o)||(t.jsonContent=o),o}),r(),T(7,ct,2,1,"div",3),r(),a(8,"mat-dialog-actions",4)(9,"button",5),d("click",function(){return t.onCancel()}),s(10,"Cancel"),r(),a(11,"button",6),d("click",function(){return t.onSave()}),s(12,"Save"),r()()),n&2&&(c(),y(" ",t.title," "),c(5),g("ngModel",t.jsonContent),c(),w(t.errorMessage?7:-1))},dependencies:[ce,D,W,R,A,j,ve,fe,me,he,ue],styles:["[mat-dialog-title][_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}[mat-dialog-title][_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%]{margin-left:auto}mat-dialog-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;min-height:400px}.json-textarea[_ngcontent-%COMP%]{flex:1;min-height:300px;max-height:80vh;padding:1rem;font-family:Monaco,Menlo,Ubuntu Mono,Consolas,monospace;font-size:.875rem;line-height:1.5;background:var(--color-code-bg);color:var(--color-text);border:1px solid var(--color-border);border-radius:4px;resize:vertical;outline:none;transition:border-color .2s}.json-textarea[_ngcontent-%COMP%]:focus{border-color:var(--color-primary)}.json-textarea[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);opacity:.6}.error-message[_ngcontent-%COMP%]{padding:.75rem 1rem;border-radius:4px;font-size:.875rem;line-height:1.4;background:#dc26261a;color:#dc2626;border:1px solid rgba(220,38,38,.3)}"]})};export{St as a,Ct as b,L as c,Je as d,Ye as e,Ke as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as M,u as D}from"./chunk-
|
|
1
|
+
import{o as M,u as D}from"./chunk-L27W6223.js";import{Bb as v,Db as g,Fb as a,Ka as r,Tb as c,Ub as b,Vb as P,Wa as y,ga as s,ha as m,jb as h,lb as p,lc as C,mb as _,oc as f,pc as u,rb as w,sb as n,ta as x,tb as i}from"./chunk-5J7BTB5J.js";function A(t,d){if(t&1&&(n(0,"span",4),c(1),i()),t&2){let e=a();h("data-variant",e.badge().variant)("aria-label",e.badge().ariaLabel),r(),P(" ",e.badge().label," ")}}function I(t,d){if(t&1&&(n(0,"span",6),c(1),i()),t&2){let e=a();r(),b(e.config().baseUrl)}}function k(t,d){if(t&1){let e=v();n(0,"span",8),c(1,"Delete?"),i(),n(2,"ds-icon-button",9),g("action",function(){s(e);let l=a();return m(l.onDeleteConfirmed())}),i(),n(3,"ds-icon-button",10),g("action",function(){s(e);let l=a();return m(l.onDeleteCancelled())}),i()}}function E(t,d){if(t&1){let e=v();n(0,"ds-kebab-menu",13),g("itemSelected",function(l){s(e);let S=a(2);return m(S.onMenuAction(l))}),i()}if(t&2){let e=a(2);w("items",e.menuItems())}}function R(t,d){if(t&1){let e=v();n(0,"ds-icon-button",11),g("action",function(){s(e);let l=a();return m(l.onDuplicate())}),i(),p(1,E,1,1,"ds-kebab-menu",12)}if(t&2){let e=a();r(),_(e.readOnly()?-1:1)}}var q=Object.freeze({platform:{label:"PLATFORM",ariaLabel:"Configuration de niveau plateforme (lecture seule)",variant:"neutral"},namespace:{label:"NS",ariaLabel:"Configuration partag\xE9e du namespace",variant:"neutral"},userOnNs:{label:"USER \xD7 NS",ariaLabel:"Configuration utilisateur sur ce namespace",variant:"info"},userGlobal:{label:"USER GLOBAL",ariaLabel:"Configuration utilisateur globale",variant:"warning"}}),O=class t{config=u.required();scope=u.required();readOnly=u(!1);showBadge=u(!0);editRequested=f();deleteRequested=f();duplicateRequested=f();pendingDelete=x(!1);badge=C(()=>q[this.scope()]);menuItems=C(()=>[{key:"edit",label:"Edit provider",icon:"edit"},{key:"delete",label:"Delete provider",icon:"delete",variant:"danger"}]);onMenuAction(d){switch(d){case"edit":this.editRequested.emit(this.config());break;case"delete":this.pendingDelete.set(!0);break}}onDuplicate(){this.duplicateRequested.emit(this.config())}onDeleteConfirmed(){this.pendingDelete.set(!1),this.deleteRequested.emit(this.config())}onDeleteCancelled(){this.pendingDelete.set(!1)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=y({type:t,selectors:[["agentos-ai-provider-item"]],inputs:{config:[1,"config"],scope:[1,"scope"],readOnly:[1,"readOnly"],showBadge:[1,"showBadge"]},outputs:{editRequested:"editRequested",deleteRequested:"deleteRequested",duplicateRequested:"duplicateRequested"},decls:12,vars:5,consts:[["role","listitem",1,"ai-provider-item"],[1,"ai-provider-item__body"],[1,"ai-provider-item__heading"],[1,"ai-provider-item__name"],[1,"ai-provider-item__badge"],[1,"ai-provider-item__type"],[1,"ai-provider-item__url"],[1,"ai-provider-item__actions"],[1,"ai-provider-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],["icon","content_copy","title","Duplicate this provider",3,"action"],[3,"items"],[3,"itemSelected","items"]],template:function(e,o){e&1&&(n(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),c(4),i(),p(5,A,2,3,"span",4),i(),n(6,"span",5),c(7),i(),p(8,I,2,1,"span",6),i(),n(9,"div",7),p(10,k,4,0)(11,R,2,1),i()()),e&2&&(r(4),b(o.config().name),r(),_(o.showBadge()?5:-1),r(2),b(o.config().apiType),r(),_(o.config().baseUrl?8:-1),r(2),_(o.pendingDelete()?10:11))},dependencies:[D,M],styles:[".ai-provider-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border);background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);transition:background .15s ease,border-color .15s ease}.ai-provider-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);border-color:var(--color-primary)}.ai-provider-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.ai-provider-item__heading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.ai-provider-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}.ai-provider-item__badge[_ngcontent-%COMP%]{flex-shrink:0;font-size:.65rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase;padding:.1rem .4rem;border-radius:4px;line-height:1.2}.ai-provider-item__badge[data-variant=neutral][_ngcontent-%COMP%]{background:var(--color-bg-secondary);color:var(--color-text-secondary)}.ai-provider-item__badge[data-variant=info][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-info) 15%,transparent);color:var(--color-info)}.ai-provider-item__badge[data-variant=warning][_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-warning) 15%,transparent);color:var(--color-warning)}.ai-provider-item__type[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary);font-family:monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-provider-item__url[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-provider-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.ai-provider-item[_ngcontent-%COMP%]:hover .ai-provider-item__actions[_ngcontent-%COMP%], .ai-provider-item[_ngcontent-%COMP%]:focus-within .ai-provider-item__actions[_ngcontent-%COMP%]{opacity:1}.ai-provider-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error);margin-right:.25rem;white-space:nowrap}"],changeDetection:0})};export{O as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as M}from"./chunk-7MQRVE7E.js";import{o as I,u as w}from"./chunk-
|
|
1
|
+
import{c as M}from"./chunk-7MQRVE7E.js";import{o as I,u as w}from"./chunk-L27W6223.js";import{Bb as b,Db as _,Fb as c,Ka as r,Tb as d,Ub as u,Wa as y,ca as C,ga as g,ha as m,lb as f,mb as p,oc as h,pc as s,rb as x,sb as i,ta as v,tb as t}from"./chunk-5J7BTB5J.js";function O(n,o){if(n&1&&(i(0,"span",3),d(1),t()),n&2){let e=c();r(),u(e.config().modelName)}}function A(n,o){if(n&1&&(i(0,"span",4),d(1),t()),n&2){let e=c();r(),u(e.config().description)}}function P(n,o){if(n&1){let e=b();i(0,"span",7),d(1,"Delete?"),t(),i(2,"ds-icon-button",8),_("action",function(){g(e);let l=c();return m(l.onDeleteConfirmed())}),t(),i(3,"ds-icon-button",9),_("action",function(){g(e);let l=c();return m(l.onDeleteCancelled())}),t()}}function S(n,o){if(n&1){let e=b();i(0,"ds-kebab-menu",10),_("itemSelected",function(l){g(e);let k=c();return m(k.onMenuAction(l))}),t()}if(n&2){let e=c();x("items",e.readOnly()?e.readOnlyMenuItems:e.menuItems)}}var D=class n{router=C(M);config=s.required();namespaceId=s(void 0);platformMode=s(!1);readOnly=s(!1);deleteRequested=h();pendingDelete=v(!1);menuItems=[{key:"edit",label:"Edit agent config",icon:"edit"},{key:"inspect",label:"Inspect definition",icon:"search"},{key:"delete",label:"Delete agent config",icon:"delete",variant:"danger"}];readOnlyMenuItems=[{key:"inspect",label:"Inspect definition",icon:"search"}];onMenuAction(o){switch(o){case"edit":this.platformMode()?this.router.navigate(["/agentos","admin","agent-configs",this.config().id,"edit"]):this.router.navigate(["/agentos",this.namespaceId(),"agent-configs",this.config().id,"edit"]);break;case"inspect":this.platformMode()?this.router.navigate(["/agentos","admin","agent-configs",this.config().id,"inspect"]):this.router.navigate(["/agentos",this.namespaceId(),"agent-configs",this.config().id,"inspect"]);break;case"delete":this.pendingDelete.set(!0);break}}onDeleteConfirmed(){this.pendingDelete.set(!1),this.deleteRequested.emit(this.config())}onDeleteCancelled(){this.pendingDelete.set(!1)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=y({type:n,selectors:[["agentos-agent-config-item"]],inputs:{config:[1,"config"],namespaceId:[1,"namespaceId"],platformMode:[1,"platformMode"],readOnly:[1,"readOnly"]},outputs:{deleteRequested:"deleteRequested"},decls:9,vars:4,consts:[["role","listitem",1,"agent-config-item"],[1,"agent-config-item__body"],[1,"agent-config-item__name"],[1,"agent-config-item__model"],[1,"agent-config-item__description"],[1,"agent-config-item__actions"],[3,"items"],[1,"agent-config-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,a){e&1&&(i(0,"div",0)(1,"div",1)(2,"span",2),d(3),t(),f(4,O,2,1,"span",3),f(5,A,2,1,"span",4),t(),i(6,"div",5),f(7,P,4,0)(8,S,1,1,"ds-kebab-menu",6),t()()),e&2&&(r(3),u(a.config().name),r(),p(a.config().modelName?4:-1),r(),p(a.config().description?5:-1),r(2),p(a.pendingDelete()?7:8))},dependencies:[w,I],styles:[".agent-config-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.agent-config-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.agent-config-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.agent-config-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.agent-config-item__model[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary, #6e6e73);font-family:monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.agent-config-item__description[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary, #6e6e73);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.agent-config-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.agent-config-item[_ngcontent-%COMP%]:hover .agent-config-item__actions[_ngcontent-%COMP%], .agent-config-item[_ngcontent-%COMP%]:focus-within .agent-config-item__actions[_ngcontent-%COMP%]{opacity:1}.agent-config-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"],changeDetection:0})};export{D as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Bb as x,Eb as d,Fb as i,Ka as _,Rb as v,Tb as m,Wa as f,ga as l,ha as a,lb as p,mb as h,oc as g,pc as u,vb as s,wb as c,xb as C}from"./chunk-5J7BTB5J.js";function T(t,o){if(t&1){let e=x();s(0,"button",2),d("click",function(){l(e);let n=i(2);return a(n.onNavigate("/agentos/admin"))}),m(1,"\u2699\uFE0F Admin"),c()}}function y(t,o){t&1&&m(0," \u2600\uFE0F Light mode ")}function M(t,o){t&1&&m(0," \u{1F319} Dark mode ")}function w(t,o){if(t&1){let e=x();s(0,"div",0),d("click",function(n){l(e);let b=i();return a(b.onClose(n))})("keyup.escape",function(n){l(e);let b=i();return a(b.onClose(n))}),c(),s(1,"div",1)(2,"button",2),d("click",function(){l(e);let n=i();return a(n.onNavigate("/agentos/user"))}),m(3,"\u{1F464} User"),c(),p(4,T,2,0,"button",3),C(5,"div",4),s(6,"button",2),d("click",function(){l(e);let n=i();return a(n.onNavigate("/agentos/namespaces"))}),m(7," \u{1F310} Namespaces "),c(),C(8,"div",4),s(9,"button",2),d("click",function(){l(e);let n=i();return a(n.onThemeToggle())}),p(10,y,1,0)(11,M,1,0),c(),s(12,"button",2),d("click",function(){l(e);let n=i();return a(n.onLogsToggle())}),m(13," </> Technical logs "),c()()}if(t&2){let e=i();_(),v("shell-user-menu__overlay--mobile",e.variant()==="mobile"),_(3),h(e.isAdmin()?4:-1),_(6),h(e.isDark()?10:11),_(2),v("shell-user-menu__item--active",e.showTechnical())}}var k=class t{open=u.required();isAdmin=u.required();isDark=u.required();showTechnical=u.required();variant=u("desktop");navigateTo=g();themeToggled=g();logsToggled=g();closed=g();onNavigate(o){this.navigateTo.emit(o)}onThemeToggle(){this.themeToggled.emit()}onLogsToggle(){this.logsToggled.emit()}onClose(o){o.stopPropagation(),this.closed.emit(o)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=f({type:t,selectors:[["agentos-shell-user-menu"]],inputs:{open:[1,"open"],isAdmin:[1,"isAdmin"],isDark:[1,"isDark"],showTechnical:[1,"showTechnical"],variant:[1,"variant"]},outputs:{navigateTo:"navigateTo",themeToggled:"themeToggled",logsToggled:"logsToggled",closed:"closed"},decls:1,vars:1,consts:[["role","presentation","tabindex","-1",1,"shell-user-menu__backdrop",3,"click","keyup.escape"],[1,"shell-user-menu__overlay"],["type","button",1,"shell-user-menu__item",3,"click"],["type","button",1,"shell-user-menu__item"],[1,"shell-user-menu__separator"]],template:function(e,r){e&1&&p(0,w,14,6),e&2&&h(r.open()?0:-1)},styles:[".shell-user-menu__backdrop[_ngcontent-%COMP%]{position:fixed;inset:0;z-index:199}.shell-user-menu__overlay[_ngcontent-%COMP%]{background:var(--color-modal-bg, #ffffff);border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:10px;box-shadow:var(--color-modal-shadow, 0 6px 20px rgba(0, 0, 0, .08));padding:5px;position:absolute;top:calc(100% + 6px);right:0;min-width:180px;z-index:200}.shell-user-menu__overlay--mobile[_ngcontent-%COMP%]{position:absolute;top:calc(100% + 4px);right:16px;left:auto;z-index:300}.shell-user-menu__item[_ngcontent-%COMP%]{appearance:none;background:transparent;border:none;margin:0;font:inherit;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;display:flex;align-items:center;width:100%;padding:8px 10px;border-radius:6px;font-family:Inter,sans-serif;font-size:12.5px;font-weight:500;color:var(--color-text, #1d1d1f);text-align:left;transition:background .1s ease}.shell-user-menu__item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04))}.shell-user-menu__item--danger[_ngcontent-%COMP%]{color:var(--color-error, #a5140a)}.shell-user-menu__item--danger[_ngcontent-%COMP%]:hover{background:rgba(from var(--color-error, #ff453a) r g b/.08)}.shell-user-menu__item--active[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--color-primary, #016b71) 12%,transparent);color:var(--color-primary, #016b71)}.shell-user-menu__separator[_ngcontent-%COMP%]{height:1px;background:var(--color-border, rgba(0, 0, 0, .07));margin:4px;border:none}"],changeDetection:0})};export{k as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as D}from"./chunk-XZKE2ZVV.js";import{f as $}from"./chunk-G2BRVRGR.js";import{c as M}from"./chunk-7MQRVE7E.js";import{o as k,t as E}from"./chunk-L27W6223.js";import"./chunk-PQIRH5Z6.js";import"./chunk-OBV4LQBZ.js";import{a as d}from"./chunk-IRZNRZ5Q.js";import"./chunk-FAM7HWYV.js";import"./chunk-WLSXA23B.js";import"./chunk-E3XC4CVU.js";import{Bb as R,Db as s,Fb as g,Ic as B,Pb as w,S as u,Wa as I,ab as h,bc as P,ca as r,ec as x,fc as T,ga as m,ha as p,i as _,ic as q,lb as v,ma as y,mb as b,rb as l,sb as a,t as C,tb as c}from"./chunk-5J7BTB5J.js";var V=()=>[];function F(i,e){if(i&1){let t=R();a(0,"agentos-integration-config-item",4),s("editRequested",function(n){m(t);let f=g(2);return p(f.onEdit(n))})("deleteRequested",function(n){m(t);let f=g(2);return p(f.deleteConfig(n))}),c()}i&2&&l("config",e)}function L(i,e){if(i&1&&v(0,F,1,1,"agentos-integration-config-item",3),i&2){let t,o=e.$implicit,n=g();b((t=n.resolveConfig(o.id))?0:-1,t)}}var S=class i{router=r(M);destroyRef=r(y);integrationConfigController=r($);refresh$=new _(void 0);configs$=this.refresh$.pipe(u(()=>this.integrationConfigController.listIntegrationConfig()));configItems$=this.configs$.pipe(C(e=>e.map(t=>({id:t.id??"",name:t.name,description:t.integrationType}))));configsById=new Map;constructor(){this.configs$.pipe(d(this.destroyRef)).subscribe(e=>{this.configsById=new Map(e.map(t=>[t.id??"",t]))})}goBack(){this.router.navigate(["/agentos","admin"])}openCreateForm(){this.router.navigate(["/agentos","admin","integration-configs","new"])}deleteConfig(e){this.integrationConfigController.deleteIntegrationConfig(e.id??"").pipe(d(this.destroyRef)).subscribe(()=>this.refresh$.next())}onEdit(e){this.router.navigate(["/agentos","admin","integration-configs",e.id??"","edit"])}resolveConfig(e){return this.configsById.get(e)??null}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["agentos-platform-integration-configs"]],decls:5,vars:6,consts:[["integrationConfigItemTpl",""],["title","Platform Integration Configs","emptyMessage","No platform integration configs defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],["scope","platform",3,"config"],["scope","platform",3,"editRequested","deleteRequested","config"]],template:function(t,o){if(t&1&&(a(0,"ds-entity-list",1),x(1,"async"),s("createRequested",function(){return o.openCreateForm()}),a(2,"ds-icon-button",2),s("action",function(){return o.goBack()}),c()(),h(3,L,1,1,"ng-template",null,0,q)),t&2){let n=w(4);l("items",T(1,3,o.configItems$)??P(5,V))("showCreate",!0)("itemTemplate",n)}},dependencies:[E,D,k,B],styles:[".platform-integration-configs__back[_ngcontent-%COMP%]{background:none;border:none;padding:0;cursor:pointer;font-size:.875rem;color:var(--color-primary, #007aff);font-family:inherit}.platform-integration-configs__back[_ngcontent-%COMP%]:hover{text-decoration:underline}"],changeDetection:0})};export{S as PlatformIntegrationConfigsComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as V}from"./chunk-L27W6223.js";import{Ab as v,Bb as C,Db as f,Fb as a,Gb as A,Ha as M,Hb as I,Hc as N,Ka as o,Mb as S,Ob as T,Pb as k,Rb as E,Tb as _,Ub as g,Wa as w,Ya as O,ab as x,ga as b,ha as u,ic as D,lb as d,mb as s,oc as y,pc as c,rb as p,rc as j,sb as i,tb as r,ub as P}from"./chunk-5J7BTB5J.js";var Q=[[["","agentosCardChips",""]]],q=["[agentosCardChips]"];function F(n,t){n&1&&v(0)}function U(n,t){if(n&1){let e=C();i(0,"button",3),f("click",function(){b(e);let l=a();return u(l.nameClicked.emit())}),x(1,F,1,0,"ng-container",4),r()}if(n&2){a();let e=k(3);o(),p("ngTemplateOutlet",e)}}function Y(n,t){n&1&&v(0)}function R(n,t){if(n&1&&(i(0,"div",2),x(1,Y,1,0,"ng-container",4),r()),n&2){a();let e=k(3);o(),p("ngTemplateOutlet",e)}}function B(n,t){if(n&1&&(i(0,"div",7),P(1,"img",15),r()),n&2){let e=a(2);o(),p("src",e.logo(),M)("alt",e.name())}}function G(n,t){if(n&1&&(i(0,"div",16),_(1),r()),n&2){let e=a(2);E("ac__mark--emoji",e.markIsEmoji()),o(),g(e.resolvedMark)}}function H(n,t){if(n&1&&(i(0,"span",10),_(1),r()),n&2){let e=a(2);o(),g(e.name())}}function J(n,t){if(n&1){let e=C();i(0,"button",17),f("click",function(){b(e);let l=a(2);return u(l.nameClicked.emit())}),_(1),r()}if(n&2){let e=a(2);o(),g(e.name())}}function L(n,t){if(n&1&&(i(0,"p",12),_(1),r()),n&2){let e=a(2);o(),g(e.description())}}function W(n,t){if(n&1){let e=C();i(0,"ds-kebab-menu",18),f("itemSelected",function(l){b(e);let K=a(2);return u(K.menuAction.emit(l))}),r()}if(n&2){let e=a(2);p("items",e.menuItems())}}function X(n,t){n&1&&(i(0,"div",14),I(1),r())}function Z(n,t){if(n&1&&(i(0,"div",5)(1,"div",6),d(2,B,2,2,"div",7)(3,G,2,3,"div",8),i(4,"div",9),d(5,H,2,1,"span",10)(6,J,2,1,"button",11),d(7,L,2,1,"p",12),r()(),d(8,W,1,1,"ds-kebab-menu",13),r(),d(9,X,2,0,"div",14)),n&2){let e=a();o(2),s(e.logo()?2:3),o(3),s(e.clickable()?5:6),o(2),s(e.description()?7:-1),o(),s(e.hasMenu?8:-1),o(),s(e.hasChips?9:-1)}}var h=class n{static \u0275fac=function(e){return new(e||n)};static \u0275dir=O({type:n,selectors:[["","agentosCardChips",""]]})},z=class n{name=c.required();description=c(null);mark=c(null);markIsEmoji=c(!1);logo=c(null);menuItems=c([]);clickable=c(!1);nameClicked=y();menuAction=y();chipsSlot=j(h);get resolvedMark(){return this.mark()??(this.name().charAt(0).toUpperCase()||"?")}get hasChips(){return this.chipsSlot()!==void 0}get hasMenu(){return this.menuItems().length>0}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=w({type:n,selectors:[["agentos-action-card"]],contentQueries:function(e,m,l){e&1&&S(l,m.chipsSlot,h,5),e&2&&T()},inputs:{name:[1,"name"],description:[1,"description"],mark:[1,"mark"],markIsEmoji:[1,"markIsEmoji"],logo:[1,"logo"],menuItems:[1,"menuItems"],clickable:[1,"clickable"]},outputs:{nameClicked:"nameClicked",menuAction:"menuAction"},ngContentSelectors:q,decls:4,vars:1,consts:[["cardContent",""],["type","button",1,"ac","ac--clickable"],[1,"ac"],["type","button",1,"ac","ac--clickable",3,"click"],[4,"ngTemplateOutlet"],[1,"ac__header"],[1,"ac__id"],["aria-hidden","true",1,"ac__mark","ac__mark--logo"],["aria-hidden","true",1,"ac__mark",3,"ac__mark--emoji"],[1,"ac__meta"],[1,"ac__name"],["type","button",1,"ac__name"],[1,"ac__description"],[3,"items"],[1,"ac__chips"],[1,"ac__logo-img",3,"src","alt"],["aria-hidden","true",1,"ac__mark"],["type","button",1,"ac__name",3,"click"],[3,"itemSelected","items"]],template:function(e,m){e&1&&(A(Q),d(0,U,2,1,"button",1)(1,R,2,1,"div",2),x(2,Z,10,5,"ng-template",null,0,D)),e&2&&s(m.clickable()?0:1)},dependencies:[V,N],styles:["[_nghost-%COMP%]{display:block;height:var(--ac-height, auto)}.ac[_ngcontent-%COMP%]{background:var(--color-bg-secondary, rgba(255, 255, 255, .7));border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:12px;box-shadow:0 1px 3px var(--color-shadow, rgba(0, 0, 0, .05));overflow:hidden;transition:background .15s ease,border-color .15s ease,box-shadow .15s ease}.ac[_ngcontent-%COMP%]:hover{box-shadow:0 2px 8px var(--color-shadow, rgba(0, 0, 0, .08));border-color:var(--color-border, rgba(0, 0, 0, .15))}.ac[_ngcontent-%COMP%]{overflow:visible}.ac--clickable[_ngcontent-%COMP%]{appearance:none;background:transparent;border:none;padding:0;margin:0;font:inherit;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;background:var(--color-bg-secondary, rgba(255, 255, 255, .7));border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:12px;box-shadow:0 1px 3px var(--color-shadow, rgba(0, 0, 0, .05));overflow:hidden;transition:background .15s ease,border-color .15s ease,box-shadow .15s ease}.ac--clickable[_ngcontent-%COMP%]{background:var(--color-bg-secondary, rgba(255, 255, 255, .7));border:1px solid var(--color-border, rgba(0, 0, 0, .1));border-radius:12px;box-shadow:0 1px 3px var(--color-shadow, rgba(0, 0, 0, .05));overflow:hidden;transition:background .15s ease,border-color .15s ease,box-shadow .15s ease}.ac--clickable[_ngcontent-%COMP%]:hover{box-shadow:0 2px 8px var(--color-shadow, rgba(0, 0, 0, .08));border-color:var(--color-border, rgba(0, 0, 0, .15))}.ac--clickable[_ngcontent-%COMP%]{cursor:pointer;transition:background .15s ease,border-color .15s ease,box-shadow .15s ease,transform .12s ease}.ac--clickable[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff);box-shadow:0 2px 12px var(--color-shadow, rgba(0, 0, 0, .08));transform:translateY(-1px)}.ac--clickable[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary, #007aff);outline-offset:2px}.ac--clickable[_ngcontent-%COMP%]:active{transform:translateY(0)}.ac--clickable[_ngcontent-%COMP%]{overflow:visible;width:100%;height:100%;text-align:left}.ac--clickable[_ngcontent-%COMP%] .ac__name[_ngcontent-%COMP%]{cursor:inherit}.ac--clickable[_ngcontent-%COMP%] .ac__name[_ngcontent-%COMP%]:hover{text-decoration:none}.ac__header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;padding:16px 18px 14px}.ac__id[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;min-width:0;flex:1}.ac__mark[_ngcontent-%COMP%]{width:32px;height:32px;border-radius:8px;background:#161616;color:#fff;border:none;display:flex;align-items:center;justify-content:center;flex-shrink:0}[data-theme=dark][_ngcontent-%COMP%] .ac__mark[_ngcontent-%COMP%]{background:transparent;border:1.5px solid var(--color-border, rgba(255, 255, 255, .15));color:var(--color-text, #f5f5f7)}.ac__mark[_ngcontent-%COMP%]{font-family:Inter,sans-serif;font-size:13px;font-weight:700;line-height:1;align-self:flex-start}.ac__mark--logo[_ngcontent-%COMP%]{background:var(--color-bg-secondary);border:1px solid var(--color-border);padding:4px}[data-theme=dark][_ngcontent-%COMP%] .ac__mark--logo[_ngcontent-%COMP%]{background:transparent}.ac__mark--emoji[_ngcontent-%COMP%]{font-size:18px;line-height:32px;background:var(--color-bg-secondary);border:1px solid var(--color-border);color:inherit}[data-theme=dark][_ngcontent-%COMP%] .ac__mark--emoji[_ngcontent-%COMP%]{background:transparent}.ac__logo-img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;border-radius:4px;display:block}.ac__meta[_ngcontent-%COMP%]{min-width:0}.ac__description[_ngcontent-%COMP%]{font-family:Inter,sans-serif;font-size:.8125rem;font-weight:400;line-height:1.4;color:var(--color-text-secondary, #6e6e73);margin:2px 0 0}.ac__name[_ngcontent-%COMP%]{appearance:none;background:transparent;border:none;padding:0;margin:0;font:inherit;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;font-family:Inter,sans-serif;font-size:14px;font-weight:600;line-height:1.3;color:var(--color-text, #1d1d1f);display:block;word-break:break-word;text-align:left}.ac__name[_ngcontent-%COMP%]:hover{text-decoration:underline}.ac__name[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary, #007aff);outline-offset:2px;border-radius:2px}.ac__chips[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:6px;padding:0 14px 16px}[_nghost-%COMP%] .ac-chip{display:inline-flex;align-items:center;gap:5px;height:28px;padding:0 12px 0 10px;border-radius:999px;border:1px solid var(--color-border, rgba(0, 0, 0, .1));background:var(--color-surface-secondary, rgba(0, 0, 0, .03));color:var(--color-text, #1d1d1f);font-family:Inter,sans-serif;font-size:11.5px;font-weight:500;line-height:1;cursor:pointer;white-space:nowrap;transition:background .12s ease,border-color .12s ease}[_nghost-%COMP%] .ac-chip:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .06));border-color:var(--color-border, rgba(0, 0, 0, .16))}[_nghost-%COMP%] .ac-chip svg{flex-shrink:0}"],changeDetection:0})};export{h as a,z as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as y}from"./chunk-C3AMWFD7.js";import{c as k}from"./chunk-7MQRVE7E.js";import"./chunk-L27W6223.js";import"./chunk-PQIRH5Z6.js";import"./chunk-OBV4LQBZ.js";import"./chunk-IRZNRZ5Q.js";import"./chunk-FAM7HWYV.js";import"./chunk-WLSXA23B.js";import"./chunk-E3XC4CVU.js";import{Bb as h,Db as _,Fb as u,Ka as d,Tb as o,Wa as l,ca as m,ga as s,ha as c,pb as p,qb as g,rb as f,sb as a,tb as i}from"./chunk-5J7BTB5J.js";var M=(t,n)=>n.key;function P(t,n){if(t&1){let e=h();a(0,"agentos-action-card",6),_("nameClicked",function(){let v=s(e).$implicit,x=u();return c(x.navigateTo(v.path))}),i()}if(t&2){let e=n.$implicit;f("name",e.name)("mark",e.mark)("markIsEmoji",!0)("description",e.description)("clickable",!0)}}var C=class t{router=m(k);sections=[{key:"users",mark:"\u{1F464}",name:"Users",description:"Manage all platform users and their admin rights.",path:"/agentos/admin/users"},{key:"agents",mark:"\u{1F916}",name:"Platform agents",description:"Manage agent configs shared across all namespaces.",path:"/agentos/admin/agent-configs"},{key:"integrations",mark:"\u{1F517}",name:"Platform integrations",description:"Manage integration configs shared across all namespaces.",path:"/agentos/admin/integration-configs"},{key:"ai-providers",mark:"\u{1F9E0}",name:"Platform AI providers",description:"Manage AI provider configs shared across all namespaces.",path:"/agentos/admin/ai-providers"},{key:"ai-models",mark:"\u2728",name:"Platform AI models",description:"Manage AI model configs shared across all namespaces.",path:"/agentos/admin/ai-models"},{key:"prompts",mark:"\u{1F4C4}",name:"Platform prompts",description:"Manage prompts shared across all namespaces.",path:"/agentos/admin/prompts"}];navigateTo(n){this.router.navigate([n])}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=l({type:t,selectors:[["agentos-admin-home"]],decls:9,vars:0,consts:[[1,"admin-home"],[1,"admin-home__header"],[1,"admin-home__title"],[1,"admin-home__subtitle"],[1,"admin-home__sections"],[3,"name","mark","markIsEmoji","description","clickable"],[3,"nameClicked","name","mark","markIsEmoji","description","clickable"]],template:function(e,r){e&1&&(a(0,"div",0)(1,"header",1)(2,"h1",2),o(3,"Administration"),i(),a(4,"p",3),o(5,"Platform-level settings, visible to super-admins only."),i()(),a(6,"nav",4),p(7,P,1,5,"agentos-action-card",5,M),i()()),e&2&&(d(7),g(r.sections))},dependencies:[y],styles:[".admin-home[_ngcontent-%COMP%]{max-width:860px;margin:0 auto;padding:2rem 1rem;display:flex;flex-direction:column;gap:2rem}.admin-home__header[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem}.admin-home__title[_ngcontent-%COMP%]{margin:0;font-size:1.5rem;font-weight:700;letter-spacing:-.02em;color:var(--color-text);font-family:Inter,sans-serif}.admin-home__subtitle[_ngcontent-%COMP%]{margin:0;font-family:Inter,sans-serif;font-size:.8125rem;font-weight:400;line-height:1.4;color:var(--color-text-secondary, #6e6e73)}.admin-home__sections[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,1fr);gap:.75rem}.admin-home__sections[_ngcontent-%COMP%] agentos-action-card[_ngcontent-%COMP%]{--ac-height: 120px}"],changeDetection:0})};export{C as AdminHomeComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a}from"./chunk-
|
|
1
|
+
import{b as a}from"./chunk-NOTRPH4G.js";import"./chunk-5K5EFCNT.js";import"./chunk-G2BRVRGR.js";import"./chunk-7MQRVE7E.js";import"./chunk-L27W6223.js";import"./chunk-PQIRH5Z6.js";import"./chunk-OBV4LQBZ.js";import"./chunk-IRZNRZ5Q.js";import"./chunk-FAM7HWYV.js";import"./chunk-WLSXA23B.js";import"./chunk-E3XC4CVU.js";import"./chunk-5J7BTB5J.js";export{a as UserListComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as G}from"./chunk-AIC4U2MU.js";import{a as V}from"./chunk-5CBZIB6D.js";import{a as B}from"./chunk-
|
|
1
|
+
import{a as G}from"./chunk-AIC4U2MU.js";import{a as V}from"./chunk-5CBZIB6D.js";import{a as B}from"./chunk-XZKE2ZVV.js";import{a as K}from"./chunk-LH4ATU27.js";import"./chunk-PRFGHN7L.js";import"./chunk-VIDPCJ3F.js";import"./chunk-G2BRVRGR.js";import{a as D,c as $}from"./chunk-7MQRVE7E.js";import{o as P,t as L}from"./chunk-L27W6223.js";import"./chunk-PQIRH5Z6.js";import"./chunk-OBV4LQBZ.js";import{a as c}from"./chunk-IRZNRZ5Q.js";import"./chunk-FAM7HWYV.js";import"./chunk-WLSXA23B.js";import"./chunk-E3XC4CVU.js";import{Bb as A,Db as g,Fb as s,Ic as N,Ka as C,Pb as x,S as y,Tb as E,Ub as w,Wa as v,ab as R,bc as O,ca as r,ec as M,fc as T,ga as l,ha as m,ic as q,lb as b,m as _,ma as I,mb as S,rb as f,sb as p,t as u,ta as h,tb as d}from"./chunk-5J7BTB5J.js";var z=()=>[];function W(o,e){if(o&1&&(p(0,"p",3),E(1),d()),o&2){let t=s().$implicit;C(),w(t.name)}}function U(o,e){if(o&1){let t=A();p(0,"agentos-integration-config-item",5),g("editRequested",function(){let i=l(t),a=s(2);return m(a.onEdit(i))})("deleteRequested",function(){let i=l(t),a=s(2);return m(a.onDelete(i))})("duplicateRequested",function(){let i=l(t),a=s(2);return m(a.onDuplicate(i))}),d()}if(o&2){let t=e,n=s(2);f("config",t.config)("scope",t.scope)("readOnly",t.scope==="platform"||t.scope==="namespace"&&!n.isAdmin())}}function X(o,e){if(o&1&&b(0,W,2,1,"p",3)(1,U,1,3,"agentos-integration-config-item",4),o&2){let t,n=e.$implicit,i=s();S(i.isEmptyPlaceholder(n.id)?0:(t=i.resolve(n.id))?1:-1,t)}}var k=Object.freeze({platform:"Configurations plateforme",namespace:"Configurations du namespace",userOnNs:"Mes overrides sur ce namespace",userGlobal:"Mes overrides globaux"}),F="__empty__",j=class o{route=r(D);router=r($);destroyRef=r(I);state=r(V);namespaceRole=r(K);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=h(!1);listItems$=this.state.vm$.pipe(u(e=>this.toListItems(e)));resolved=new Map;ngOnInit(){this.route.paramMap.pipe(c(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t)}),this.route.paramMap.pipe(u(e=>e.get("namespaceId")??""),y(e=>e?this.namespaceRole.isAdminOfNamespace$(e):_(!1)),c(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(c(this.destroyRef)).subscribe(e=>{let t=new Map;e.platform.forEach(n=>{n.id&&t.set(this.itemKey("platform",n.id),{config:n,scope:"platform"})}),e.namespace.forEach(n=>{n.id&&t.set(this.itemKey("namespace",n.id),{config:n,scope:"namespace"})}),e.userOnNs.forEach(n=>{n.id&&t.set(this.itemKey("userOnNs",n.id),{config:n,scope:"userOnNs"})}),e.userGlobal.forEach(n=>{n.id&&t.set(this.itemKey("userGlobal",n.id),{config:n,scope:"userGlobal"})}),this.resolved=t})}isEmptyPlaceholder(e){return e.startsWith(F)}resolve(e){return this.resolved.get(e)??null}itemKey(e,t){return`${e}:${t}`}goBack(){this.router.navigate(["/agentos","namespaces"])}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:G(this.isAdmin())}})}onEdit(e){let t=e.config.id??"";this.router.navigate(["/agentos",this.namespaceId,"integrations",t,"edit"],{queryParams:{scope:e.scope}})}onDelete(e){let t=e.config.id;t&&this.state.delete(t,e.scope).pipe(c(this.destroyRef)).subscribe({error:n=>{console.error(`[IntegrationsAllScopes] Delete failed for ${e.scope}:${t}:`,n)}})}onDuplicate(e){if(!e.config.id)return;let n=(e.scope==="namespace"||e.scope==="platform")&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"integrations","new"],{queryParams:{scope:n,template:e.config.id,templateScope:e.scope}})}toListItems(e){let t=[];return t.push(...this.sectionItems("platform",e.platform)),t.push(...this.sectionItems("namespace",e.namespace)),t.push(...this.sectionItems("userOnNs",e.userOnNs)),t.push(...this.sectionItems("userGlobal",e.userGlobal)),t}sectionItems(e,t){return t.length===0?[{id:`${F}${e}`,name:"Aucune configuration",groupKey:e,groupLabel:k[e]}]:t.filter(n=>!!n.id).map(n=>({id:this.itemKey(e,n.id),name:n.name,description:n.integrationType,groupKey:e,groupLabel:k[e]}))}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=v({type:o,selectors:[["agentos-integrations-all-scopes"]],decls:5,vars:6,consts:[["integrationItemTpl",""],["title","Integrations","emptyMessage","No integrations available.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[1,"integrations-all-scopes__empty"],[3,"config","scope","readOnly"],[3,"editRequested","deleteRequested","duplicateRequested","config","scope","readOnly"]],template:function(t,n){if(t&1&&(p(0,"ds-entity-list",1),M(1,"async"),g("createRequested",function(){return n.openCreateForm()}),p(2,"ds-icon-button",2),g("action",function(){return n.goBack()}),d()(),R(3,X,2,1,"ng-template",null,0,q)),t&2){let i=x(4);f("items",T(1,3,n.listItems$)??O(5,z))("showCreate",!0)("itemTemplate",i)}},dependencies:[L,B,P,N],styles:[".integrations-all-scopes__empty[_ngcontent-%COMP%]{margin:0;padding:.65rem 1rem;font-size:.85rem;font-style:italic;color:var(--color-text-secondary)}"],changeDetection:0})};export{j as IntegrationsAllScopesComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as B}from"./chunk-
|
|
1
|
+
import{a as B}from"./chunk-4R6QW4JM.js";import{a as G}from"./chunk-AIC4U2MU.js";import{a as K}from"./chunk-RRBTVPFV.js";import{a as V}from"./chunk-LH4ATU27.js";import"./chunk-PRFGHN7L.js";import"./chunk-VIDPCJ3F.js";import"./chunk-G2BRVRGR.js";import{a as N,c as D}from"./chunk-7MQRVE7E.js";import{o as $,t as L}from"./chunk-L27W6223.js";import"./chunk-PQIRH5Z6.js";import"./chunk-OBV4LQBZ.js";import{a as d}from"./chunk-IRZNRZ5Q.js";import"./chunk-FAM7HWYV.js";import"./chunk-WLSXA23B.js";import"./chunk-E3XC4CVU.js";import{Bb as b,Db as u,Fb as s,Ic as q,Ka as A,Pb as S,S as g,Tb as x,Ub as E,Wa as I,ab as P,bc as w,ca as n,ec as O,fc as M,ga as l,ha as c,ic as T,lb as C,m as f,ma as y,mb as R,rb as v,sb as p,t as _,ta as h,tb as m}from"./chunk-5J7BTB5J.js";var z=()=>[];function W(r,e){if(r&1&&(p(0,"p",3),x(1),m()),r&2){let t=s().$implicit;A(),E(t.name)}}function U(r,e){if(r&1){let t=b();p(0,"agentos-ai-provider-item",5),u("editRequested",function(){let o=l(t),a=s(2);return c(a.onEdit(o))})("deleteRequested",function(){let o=l(t),a=s(2);return c(a.onDelete(o))})("duplicateRequested",function(){let o=l(t),a=s(2);return c(a.onDuplicate(o))}),m()}if(r&2){let t=e,i=s(2);v("config",t.config)("scope",t.scope)("readOnly",t.scope==="platform"||t.scope==="namespace"&&!i.isAdmin())}}function X(r,e){if(r&1&&C(0,W,2,1,"p",3)(1,U,1,3,"agentos-ai-provider-item",4),r&2){let t,i=e.$implicit,o=s();R(o.isEmptyPlaceholder(i.id)?0:(t=o.resolve(i.id))?1:-1,t)}}var k=Object.freeze({platform:"Platform (read-only)",namespace:"AI Providers du namespace",userOnNs:"Mes overrides sur ce namespace",userGlobal:"Mes overrides globaux"}),F="__empty__",j=class r{route=n(N);router=n(D);destroyRef=n(y);state=n(K);namespaceRole=n(V);namespaceId=this.route.snapshot.params.namespaceId;isAdmin=h(!1);listItems$=this.state.vm$.pipe(_(e=>this.toListItems(e)));resolved=new Map;ngOnInit(){this.route.paramMap.pipe(d(this.destroyRef)).subscribe(e=>{let t=e.get("namespaceId")??"";t&&t!==this.namespaceId&&(this.namespaceId=t),this.state.setNamespace(t)}),this.route.paramMap.pipe(_(e=>e.get("namespaceId")??""),g(e=>e?this.namespaceRole.isAdminOfNamespace$(e):f(!1)),d(this.destroyRef)).subscribe(e=>this.isAdmin.set(e)),this.state.vm$.pipe(d(this.destroyRef)).subscribe(e=>{let t=new Map;e.platform.forEach(i=>{i.id&&t.set(this.itemKey("platform",i.id),{config:i,scope:"platform"})}),e.namespace.forEach(i=>{i.id&&t.set(this.itemKey("namespace",i.id),{config:i,scope:"namespace"})}),e.userOnNs.forEach(i=>{i.id&&t.set(this.itemKey("userOnNs",i.id),{config:i,scope:"userOnNs"})}),e.userGlobal.forEach(i=>{i.id&&t.set(this.itemKey("userGlobal",i.id),{config:i,scope:"userGlobal"})}),this.resolved=t})}isEmptyPlaceholder(e){return e.startsWith(F)}resolve(e){return this.resolved.get(e)??null}itemKey(e,t){return`${e}:${t}`}goBack(){this.router.navigate(["/agentos","namespaces"])}openCreateForm(){this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:G(this.isAdmin())}})}onEdit(e){let t=e.config.id;t&&this.router.navigate(["/agentos",this.namespaceId,"ai-providers",t,"edit"],{queryParams:{scope:e.scope}})}onDelete(e){let t=e.config.id;t&&this.state.delete(t,e.scope).pipe(d(this.destroyRef)).subscribe({error:i=>{console.error(`[AiProvidersAllScopes] Delete failed for ${e.scope}:${t}:`,i)}})}onDuplicate(e){if(!e.config.id)return;let t=e.scope==="namespace"&&!this.isAdmin()?"userOnNs":e.scope;this.router.navigate(["/agentos",this.namespaceId,"ai-providers","new"],{queryParams:{scope:t,template:e.config.id,templateScope:e.scope}})}toListItems(e){let t=[];return t.push(...this.sectionItems("platform",e.platform)),t.push(...this.sectionItems("namespace",e.namespace)),t.push(...this.sectionItems("userOnNs",e.userOnNs)),t.push(...this.sectionItems("userGlobal",e.userGlobal)),t}sectionItems(e,t){return t.length===0?[{id:`${F}${e}`,name:"Aucun AI Provider",groupKey:e,groupLabel:k[e]}]:t.filter(i=>!!i.id).map(i=>({id:this.itemKey(e,i.id),name:i.name,description:i.apiType,groupKey:e,groupLabel:k[e]}))}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=I({type:r,selectors:[["agentos-ai-providers-all-scopes"]],decls:5,vars:6,consts:[["aiProviderItemTpl",""],["title","AI Providers","emptyMessage","No AI providers available.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],[1,"ai-providers-all-scopes__empty"],[3,"config","scope","readOnly"],[3,"editRequested","deleteRequested","duplicateRequested","config","scope","readOnly"]],template:function(t,i){if(t&1&&(p(0,"ds-entity-list",1),O(1,"async"),u("createRequested",function(){return i.openCreateForm()}),p(2,"ds-icon-button",2),u("action",function(){return i.goBack()}),m()(),P(3,X,2,1,"ng-template",null,0,T)),t&2){let o=S(4);v("items",M(1,3,i.listItems$)??w(5,z))("showCreate",!0)("itemTemplate",o)}},dependencies:[L,B,$,q],styles:[".ai-providers-all-scopes__empty[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);padding:.5rem .25rem;margin:0;font-style:italic}"],changeDetection:0})};export{j as AiProvidersAllScopesComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as a}from"./chunk-H4PZNDTU.js";import"./chunk-W6TYWCQH.js";import"./chunk-BMUZTI7K.js";import"./chunk-67HAMCVY.js";import"./chunk-VIDPCJ3F.js";import"./chunk-EQXGFCI5.js";import"./chunk-G2BRVRGR.js";import"./chunk-4F2LQOD7.js";import"./chunk-7MQRVE7E.js";import"./chunk-L27W6223.js";import"./chunk-PQIRH5Z6.js";import"./chunk-OBV4LQBZ.js";import"./chunk-IRZNRZ5Q.js";import"./chunk-FAM7HWYV.js";import"./chunk-WLSXA23B.js";import"./chunk-E3XC4CVU.js";import"./chunk-5J7BTB5J.js";export{a as CaseShellComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as k}from"./chunk-4R6QW4JM.js";import{d as D}from"./chunk-G2BRVRGR.js";import{c as q}from"./chunk-7MQRVE7E.js";import{o as M,t as $}from"./chunk-L27W6223.js";import"./chunk-PQIRH5Z6.js";import"./chunk-OBV4LQBZ.js";import{a as _}from"./chunk-IRZNRZ5Q.js";import"./chunk-FAM7HWYV.js";import"./chunk-WLSXA23B.js";import"./chunk-E3XC4CVU.js";import{Bb as b,Db as s,Fb as d,Ic as T,Pb as w,S as P,Wa as y,ab as C,bc as R,ca as n,ec as I,fc as x,ga as m,ha as l,i as f,ic as B,lb as h,ma as g,mb as A,rb as c,sb as a,t as u,tb as v}from"./chunk-5J7BTB5J.js";var S=()=>[];function V(r,e){if(r&1){let t=b();a(0,"agentos-ai-provider-item",4),s("editRequested",function(i){m(t);let p=d(2);return l(p.onEdit(i))})("deleteRequested",function(i){m(t);let p=d(2);return l(p.onDelete(i))}),v()}r&2&&c("config",e)("showBadge",!1)}function F(r,e){if(r&1&&h(0,V,1,2,"agentos-ai-provider-item",3),r&2){let t,o=e.$implicit,i=d();A((t=i.resolveProvider(o.id))?0:-1,t)}}var E=class r{router=n(q);destroyRef=n(g);aiProviderController=n(D);refresh$=new f(void 0);providers$=this.refresh$.pipe(P(()=>this.aiProviderController.listAiProvider("none")));providerItems$=this.providers$.pipe(u(e=>e.map(t=>({id:t.id??"",name:t.name,description:t.apiType}))));providersById=new Map;constructor(){this.providers$.pipe(_(this.destroyRef)).subscribe(e=>{this.providersById=new Map(e.map(t=>[t.id??"",t]))})}goBack(){this.router.navigate(["/agentos","admin"])}openCreateForm(){this.router.navigate(["/agentos","admin","ai-providers","new"])}onEdit(e){e.id&&this.router.navigate(["/agentos","admin","ai-providers",e.id,"edit"])}onDelete(e){e.id&&this.aiProviderController.deleteAiProvider(e.id).pipe(_(this.destroyRef)).subscribe(()=>this.refresh$.next())}resolveProvider(e){return this.providersById.get(e)??null}static \u0275fac=function(t){return new(t||r)};static \u0275cmp=y({type:r,selectors:[["agentos-platform-ai-providers"]],decls:5,vars:6,consts:[["aiProviderItemTpl",""],["title","Platform AI Providers","emptyMessage","No platform AI providers defined yet. Add one above.","cardMinWidth","400px",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","icon","arrow_back","title","Back",3,"action"],["scope","namespace",3,"config","showBadge"],["scope","namespace",3,"editRequested","deleteRequested","config","showBadge"]],template:function(t,o){if(t&1&&(a(0,"ds-entity-list",1),I(1,"async"),s("createRequested",function(){return o.openCreateForm()}),a(2,"ds-icon-button",2),s("action",function(){return o.goBack()}),v()(),C(3,F,1,1,"ng-template",null,0,B)),t&2){let i=w(4);c("items",x(1,3,o.providerItems$)??R(5,S))("showCreate",!0)("itemTemplate",i)}},dependencies:[$,k,M,T],styles:[".platform-ai-providers__back[_ngcontent-%COMP%]{background:none;border:none;cursor:pointer;font-family:inherit;font-size:.875rem;color:var(--color-text-secondary, #6e6e73);padding:.25rem .5rem;border-radius:4px;transition:color .15s ease}.platform-ai-providers__back[_ngcontent-%COMP%]:hover{color:var(--color-primary, #007aff)}"],changeDetection:0})};export{E as PlatformAiProvidersComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as h,u as w}from"./chunk-
|
|
1
|
+
import{o as h,u as w}from"./chunk-L27W6223.js";import{Bb as u,Db as p,Fb as r,Ka as d,Tb as m,Ub as g,Vb as x,Wa as C,ga as s,ha as c,lb as y,mb as M,oc as b,pc as _,rb as v,sb as t,ta as f,tb as n}from"./chunk-5J7BTB5J.js";function k(o,a){if(o&1){let e=u();t(0,"span",7),m(1,"Delete?"),n(),t(2,"ds-icon-button",8),p("action",function(){s(e);let l=r();return c(l.onDeleteConfirmed())}),n(),t(3,"ds-icon-button",9),p("action",function(){s(e);let l=r();return c(l.onDeleteCancelled())}),n()}}function O(o,a){if(o&1){let e=u();t(0,"ds-kebab-menu",10),p("itemSelected",function(l){s(e);let I=r();return c(I.onMenuAction(l))}),n()}if(o&2){let e=r();v("items",e.menuItems)}}var D=class o{model=_.required();namespaceId=_(void 0);readOnly=_(!1);deleteRequested=b();editRequested=b();pendingDelete=f(!1);menuItems=[{key:"edit",label:"Edit model",icon:"edit"},{key:"delete",label:"Delete model",icon:"delete",variant:"danger"}];get displayTitle(){return this.model().alias??this.model().apiModelName}onMenuAction(a){switch(a){case"edit":this.editRequested.emit(this.model());break;case"delete":this.pendingDelete.set(!0);break}}onDeleteConfirmed(){this.pendingDelete.set(!1),this.deleteRequested.emit(this.model())}onDeleteCancelled(){this.pendingDelete.set(!1)}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=C({type:o,selectors:[["agentos-ai-model-item"]],inputs:{model:[1,"model"],namespaceId:[1,"namespaceId"],readOnly:[1,"readOnly"]},outputs:{deleteRequested:"deleteRequested",editRequested:"editRequested"},decls:12,vars:4,consts:[["role","listitem",1,"ai-model-item"],[1,"ai-model-item__body"],[1,"ai-model-item__name"],[1,"ai-model-item__api-name"],[1,"ai-model-item__params"],[1,"ai-model-item__actions"],[3,"items"],[1,"ai-model-item__confirm-label"],["icon","check","variant","danger","title","Confirm deletion",3,"action"],["icon","close","title","Cancel deletion",3,"action"],[3,"itemSelected","items"]],template:function(e,i){e&1&&(t(0,"div",0)(1,"div",1)(2,"span",2),m(3),n(),t(4,"span",3),m(5),n(),t(6,"span",4)(7,"span"),m(8),n()()(),t(9,"div",5),y(10,k,4,0)(11,O,1,1,"ds-kebab-menu",6),n()()),e&2&&(d(3),g(i.displayTitle),d(2),g(i.model().apiModelName),d(3),x("priority: ",i.model().priority),d(2),M(i.pendingDelete()?10:i.readOnly()?-1:11))},dependencies:[w,h],styles:[".ai-model-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;border-radius:10px;border:1px solid var(--color-border, rgba(0, 0, 0, .08));background:var(--glass-bg, rgba(255, 255, 255, .72));-webkit-backdrop-filter:var(--glass-backdrop-blur, blur(20px));backdrop-filter:var(--glass-backdrop-blur, blur(20px));transition:background .15s ease,border-color .15s ease}.ai-model-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .04));border-color:var(--color-primary, #007aff)}.ai-model-item__body[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;gap:.2rem;min-width:0}.ai-model-item__name[_ngcontent-%COMP%]{font-size:.95rem;font-weight:500;color:var(--color-text, #1d1d1f);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-model-item__api-name[_ngcontent-%COMP%]{font-size:.78rem;color:var(--color-text-secondary, #6e6e73);font-family:monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ai-model-item__params[_ngcontent-%COMP%]{display:flex;gap:.75rem;font-size:.75rem;color:var(--color-text-secondary, #6e6e73)}.ai-model-item__actions[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;gap:.125rem;opacity:0;transition:opacity .15s ease}.ai-model-item[_ngcontent-%COMP%]:hover .ai-model-item__actions[_ngcontent-%COMP%], .ai-model-item[_ngcontent-%COMP%]:focus-within .ai-model-item__actions[_ngcontent-%COMP%]{opacity:1}.ai-model-item__confirm-label[_ngcontent-%COMP%]{font-size:.8rem;font-weight:500;color:var(--color-error, #ff3b30);margin-right:.25rem;white-space:nowrap}"],changeDetection:0})};export{D as a};
|