@whoz-oss/coday-client 0.122.0 → 0.124.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.
Files changed (105) hide show
  1. package/3rdpartylicenses.txt +19 -19
  2. package/browser/chunk-2WJFXA53.js +1 -0
  3. package/browser/chunk-3D3KN52V.js +1 -0
  4. package/browser/chunk-3JGMGRXW.js +5 -0
  5. package/browser/chunk-3U3QVZEU.js +2 -0
  6. package/browser/chunk-4VZIFCB6.js +83 -0
  7. package/browser/chunk-53STPEYQ.js +3 -0
  8. package/browser/chunk-6LO3ANKL.js +1 -0
  9. package/browser/chunk-7MXZXY4I.js +1 -0
  10. package/browser/{chunk-VNGIXNER.js → chunk-AJOXSD6I.js} +1 -1
  11. package/browser/chunk-AK6F2DC7.js +5 -0
  12. package/browser/chunk-AQ3SEH2N.js +1 -0
  13. package/browser/{chunk-CBU7DNMV.js → chunk-B2FFL2F7.js} +1 -1
  14. package/browser/chunk-B2QA6UZX.js +9 -0
  15. package/browser/chunk-BRHVMM4O.js +1 -0
  16. package/browser/{chunk-OK747ZMT.js → chunk-CRBPOP52.js} +1 -1
  17. package/browser/{chunk-P5TSPSCB.js → chunk-DE5MXWYR.js} +1 -1
  18. package/browser/{chunk-NO2ODJHX.js → chunk-DRBOHCTP.js} +3 -3
  19. package/browser/{chunk-UGVRFJHC.js → chunk-EPA5P2I6.js} +1 -1
  20. package/browser/chunk-ESGUJDS6.js +1 -0
  21. package/browser/chunk-EWEA7F46.js +270 -0
  22. package/browser/chunk-FOWPCPU3.js +2 -0
  23. package/browser/chunk-GAZJZBKP.js +1 -0
  24. package/browser/chunk-H5JE6Y2U.js +1 -0
  25. package/browser/chunk-H6OBD3IB.js +1 -0
  26. package/browser/chunk-HCG45H7O.js +2 -0
  27. package/browser/chunk-HSNVFCBN.js +1 -0
  28. package/browser/chunk-HTG2SANG.js +1 -0
  29. package/browser/chunk-HTRRBKXE.js +2 -0
  30. package/browser/chunk-I5EEQETN.js +1 -0
  31. package/browser/chunk-I5OT3IGD.js +1 -0
  32. package/browser/{chunk-MQ3QG7VF.js → chunk-IFXDK4GQ.js} +1 -1
  33. package/browser/chunk-IXD43YQI.js +2 -0
  34. package/browser/chunk-IZFHJAEI.js +1 -0
  35. package/browser/chunk-J44N4WCW.js +1 -0
  36. package/browser/chunk-JFRMX4TL.js +1 -0
  37. package/browser/chunk-JUPV65PP.js +1 -0
  38. package/browser/chunk-KKEITF3S.js +1 -0
  39. package/browser/chunk-KTPX26DH.js +2 -0
  40. package/browser/chunk-KYPWHL43.js +1 -0
  41. package/browser/chunk-MWWLTJ77.js +1 -0
  42. package/browser/{chunk-7RF7FEOC.js → chunk-NAQEVUOV.js} +1 -1
  43. package/browser/chunk-O2IJMHBE.js +2 -0
  44. package/browser/chunk-O3U2KGCT.js +1 -0
  45. package/browser/chunk-OPGZ37VP.js +1 -0
  46. package/browser/chunk-PWDBCAQS.js +2 -0
  47. package/browser/{chunk-4UEZ3CNG.js → chunk-Q3YY3NFM.js} +1 -1
  48. package/browser/{chunk-UXXLDXN3.js → chunk-QSQYSFNQ.js} +1 -1
  49. package/browser/chunk-QWMDAFBN.js +1 -0
  50. package/browser/chunk-QXZ6AR76.js +1 -0
  51. package/browser/chunk-SHHNG775.js +1 -0
  52. package/browser/chunk-SPIWOGE3.js +1 -0
  53. package/browser/chunk-SZNIOJIK.js +1 -0
  54. package/browser/chunk-TLXAJ2J2.js +1 -0
  55. package/browser/chunk-TNUQQNZR.js +1 -0
  56. package/browser/{chunk-OMLFSDJ5.js → chunk-U4662WTU.js} +1 -1
  57. package/browser/chunk-UDGUWWGZ.js +1 -0
  58. package/browser/chunk-UKAN3Y3I.js +2 -0
  59. package/browser/{chunk-FCCT54AP.js → chunk-UORJVNGU.js} +1 -1
  60. package/browser/chunk-VNCIHM33.js +1 -0
  61. package/browser/chunk-VOCIDXAB.js +1 -0
  62. package/browser/{chunk-5UOZGBZ2.js → chunk-WNNKQ2DH.js} +4 -4
  63. package/browser/chunk-WPC6XC7P.js +2 -0
  64. package/browser/chunk-XIQ3L6H6.js +1 -0
  65. package/browser/chunk-XJUBZLY2.js +1 -0
  66. package/browser/chunk-XQ4PJULE.js +1 -0
  67. package/browser/chunk-YZSDQIEK.js +7 -0
  68. package/browser/chunk-ZAM3WGZM.js +3 -0
  69. package/browser/chunk-ZL64I3EB.js +4 -0
  70. package/browser/index.html +2 -2
  71. package/browser/main-PMTICERL.js +1 -0
  72. package/browser/{styles-HC545BYS.css → styles-THLRUXCP.css} +1 -1
  73. package/package.json +1 -1
  74. package/browser/chunk-2DE3OXG3.js +0 -1
  75. package/browser/chunk-3TOJSAQM.js +0 -1
  76. package/browser/chunk-4LFZBXC3.js +0 -1
  77. package/browser/chunk-4OMSGXSL.js +0 -1
  78. package/browser/chunk-5CTKRMM2.js +0 -2
  79. package/browser/chunk-6NFS2ZCV.js +0 -1
  80. package/browser/chunk-DJBCK5D7.js +0 -5
  81. package/browser/chunk-FPUSD6J7.js +0 -1
  82. package/browser/chunk-G5XS2TEE.js +0 -1
  83. package/browser/chunk-GT5UFSUE.js +0 -2
  84. package/browser/chunk-H2Q3V5BR.js +0 -1
  85. package/browser/chunk-IHHVFGPF.js +0 -1
  86. package/browser/chunk-JPWWZVYZ.js +0 -1
  87. package/browser/chunk-JW6LSUP2.js +0 -1
  88. package/browser/chunk-KYPMYRHP.js +0 -1
  89. package/browser/chunk-LVEC3TBP.js +0 -1
  90. package/browser/chunk-MJEQQZDO.js +0 -1
  91. package/browser/chunk-N5LTGEF5.js +0 -1
  92. package/browser/chunk-PKKHLHXJ.js +0 -10
  93. package/browser/chunk-PWN5O4WY.js +0 -1
  94. package/browser/chunk-S3ZG6FUN.js +0 -1
  95. package/browser/chunk-S5LR3GBS.js +0 -2
  96. package/browser/chunk-SNTJSECZ.js +0 -1
  97. package/browser/chunk-T357ITNZ.js +0 -1
  98. package/browser/chunk-TE3JOGRA.js +0 -2
  99. package/browser/chunk-UMDZZGIC.js +0 -1
  100. package/browser/chunk-VWD2QH4N.js +0 -1
  101. package/browser/chunk-W4VYO3E2.js +0 -1
  102. package/browser/chunk-XPK5V34V.js +0 -1
  103. package/browser/chunk-YDXVLOQW.js +0 -11
  104. package/browser/chunk-Z7DC3UIO.js +0 -1
  105. package/browser/main-3X4E54YE.js +0 -361
@@ -1,361 +0,0 @@
1
- import{a as sc,b as lc}from"./chunk-S5LR3GBS.js";import{a as dc,b as pc,c as mc}from"./chunk-5CTKRMM2.js";import{a as cc}from"./chunk-FCCT54AP.js";import{a as Hl,b as Ul}from"./chunk-5UOZGBZ2.js";import{a as Hr,b as Ur,c as Wl,d as Wr,e as qr,f as ql,g as Gr}from"./chunk-NO2ODJHX.js";import{I as nc,J as Qr,K as ic,R as rc,T as oc,U as ac,f as $l,g as li,h as Bl,i as Aa,u as Yl,w as tc}from"./chunk-YDXVLOQW.js";import{a as Yr,b as ye}from"./chunk-3TOJSAQM.js";import{F as Vl,G as $r,I as Dn,L as ze,M as zl,N as $t,P as si,Q as Br,R as Ge,S as se,T as ke,e as Vr,f as Oa,h as Ol,i as Al,j as Il,m as Dl,o as zr,p as Rl,r as Nl,s as Fl,t as Ll,y as jl}from"./chunk-PKKHLHXJ.js";import{B as ec,C as lt,c as _t,g as at,m as st,p as Ql,q as Kl,v as Xl,w as Jl,x as Zl}from"./chunk-2DE3OXG3.js";import{k as Gl}from"./chunk-KYPMYRHP.js";import{a as ot,b as Ie}from"./chunk-VNGIXNER.js";import{a as jr,b as Ml,c as zt,d as kl,e as Pl}from"./chunk-PWN5O4WY.js";import{$ as Mr,$b as yl,A as ve,Aa as Sa,Ab as v,Ac as Fr,Bc as Lr,C as mn,Cb as h,Cc as xl,Db as rn,Dc as Pa,E as sl,Ea as ut,Eb as ht,F as ti,Fa as On,Fb as Ea,Fc as it,G as fa,Ga as hl,Gb as Be,H as _a,Ha as p,Hb as ge,Ia as gl,Ib as fe,Ic as wl,J as ll,Ja as xa,Jc as Tl,L as ba,La as fl,Ma as Pr,Mb as In,N as cl,Nb as Ke,Nc as rt,Ob as Y,Oc as El,P as ni,Pb as Ma,Q as va,Qb as u,Qc as Vt,R as D,Rb as L,Sb as Ne,T as gt,Ta as I,Tb as oi,U as re,Ua as wt,Ub as te,Va as _l,Vb as ne,Wa as bl,Wb as ie,X as H,Xb as vl,Y as xt,Ya as Ui,Yb as fn,Za as un,Zb as Or,_ as Bi,_b as Ar,a as G,aa as f,ac as Wi,b as he,bc as Cl,c as il,ca as dl,cb as wa,cc as ka,d as B,ec as ai,fa as x,g as Er,ga as w,gb as Me,h as J,ha as ya,hc as Tt,i as W,ia as pl,ib as C,ja as Ca,jb as S,ka as ii,kc as Ir,la as ri,m as kn,mb as we,n as ei,na as Z,nb as Te,nc as Sl,oa as Lt,ob as T,oc as Dr,pb as l,pc as Rr,q as ga,qb as c,qc as Nr,r as rl,ra as ml,rb as F,s as Ae,sa as qe,sb as hn,t as Pn,ta as Hi,tb as gn,ua as jt,ub as Ta,va as kr,wa as ft,xa as ul,xb as An,y as ol,yb as O,z as al}from"./chunk-DJBCK5D7.js";var q=(function(i){return i[i.State=0]="State",i[i.Transition=1]="Transition",i[i.Sequence=2]="Sequence",i[i.Group=3]="Group",i[i.Animate=4]="Animate",i[i.Keyframes=5]="Keyframes",i[i.Style=6]="Style",i[i.Trigger=7]="Trigger",i[i.Reference=8]="Reference",i[i.AnimateChild=9]="AnimateChild",i[i.AnimateRef=10]="AnimateRef",i[i.Query=11]="Query",i[i.Stagger=12]="Stagger",i})(q||{}),bt="*";function Ia(i,e){return{type:q.Trigger,name:i,definitions:e,options:{}}}function Kr(i,e=null){return{type:q.Animate,styles:e,timings:i}}function uc(i,e=null){return{type:q.Sequence,steps:i,options:e}}function _n(i){return{type:q.Style,styles:i,offset:null}}function Xr(i,e,t=null){return{type:q.Transition,expr:i,animation:e,options:t}}var Bt=class{_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_originalOnDoneFns=[];_originalOnStartFns=[];_started=!1;_destroyed=!1;_finished=!1;_position=0;parentPlayer=null;totalTime;constructor(e=0,t=0){this.totalTime=e+t}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}onStart(e){this._originalOnStartFns.push(e),this._onStartFns.push(e)}onDone(e){this._originalOnDoneFns.push(e),this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}hasStarted(){return this._started}init(){}play(){this.hasStarted()||(this._onStart(),this.triggerMicrotask()),this._started=!0}triggerMicrotask(){queueMicrotask(()=>this._onFinish())}_onStart(){this._onStartFns.forEach(e=>e()),this._onStartFns=[]}pause(){}restart(){}finish(){this._onFinish()}destroy(){this._destroyed||(this._destroyed=!0,this.hasStarted()||this._onStart(),this.finish(),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}reset(){this._started=!1,this._finished=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}setPosition(e){this._position=this.totalTime?e*this.totalTime:1}getPosition(){return this.totalTime?this._position/this.totalTime:1}triggerCallback(e){let t=e=="start"?this._onStartFns:this._onDoneFns;t.forEach(n=>n()),t.length=0}},Rn=class{_onDoneFns=[];_onStartFns=[];_finished=!1;_started=!1;_destroyed=!1;_onDestroyFns=[];parentPlayer=null;totalTime=0;players;constructor(e){this.players=e;let t=0,n=0,r=0,o=this.players.length;o==0?queueMicrotask(()=>this._onFinish()):this.players.forEach(a=>{a.onDone(()=>{++t==o&&this._onFinish()}),a.onDestroy(()=>{++n==o&&this._onDestroy()}),a.onStart(()=>{++r==o&&this._onStart()})}),this.totalTime=this.players.reduce((a,s)=>Math.max(a,s.totalTime),0)}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}init(){this.players.forEach(e=>e.init())}onStart(e){this._onStartFns.push(e)}_onStart(){this.hasStarted()||(this._started=!0,this._onStartFns.forEach(e=>e()),this._onStartFns=[])}onDone(e){this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}hasStarted(){return this._started}play(){this.parentPlayer||this.init(),this._onStart(),this.players.forEach(e=>e.play())}pause(){this.players.forEach(e=>e.pause())}restart(){this.players.forEach(e=>e.restart())}finish(){this._onFinish(),this.players.forEach(e=>e.finish())}destroy(){this._onDestroy()}_onDestroy(){this._destroyed||(this._destroyed=!0,this._onFinish(),this.players.forEach(e=>e.destroy()),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}reset(){this.players.forEach(e=>e.reset()),this._destroyed=!1,this._finished=!1,this._started=!1}setPosition(e){let t=e*this.totalTime;this.players.forEach(n=>{let r=n.totalTime?Math.min(1,t/n.totalTime):1;n.setPosition(r)})}getPosition(){let e=this.players.reduce((t,n)=>t===null||n.totalTime>t.totalTime?n:t,null);return e!=null?e.getPosition():0}beforeDestroy(){this.players.forEach(e=>{e.beforeDestroy&&e.beforeDestroy()})}triggerCallback(e){let t=e=="start"?this._onStartFns:this._onDoneFns;t.forEach(n=>n()),t.length=0}},ci="!";function hc(i){return new re(3e3,!1)}function zp(){return new re(3100,!1)}function $p(){return new re(3101,!1)}function Bp(i){return new re(3001,!1)}function Hp(i){return new re(3003,!1)}function Up(i){return new re(3004,!1)}function fc(i,e){return new re(3005,!1)}function _c(){return new re(3006,!1)}function bc(){return new re(3007,!1)}function vc(i,e){return new re(3008,!1)}function yc(i){return new re(3002,!1)}function Cc(i,e,t,n,r){return new re(3010,!1)}function Sc(){return new re(3011,!1)}function xc(){return new re(3012,!1)}function wc(){return new re(3200,!1)}function Tc(){return new re(3202,!1)}function Ec(){return new re(3013,!1)}function Mc(i){return new re(3014,!1)}function kc(i){return new re(3015,!1)}function Pc(i){return new re(3016,!1)}function Oc(i,e){return new re(3404,!1)}function Wp(i){return new re(3502,!1)}function Ac(i){return new re(3503,!1)}function Ic(){return new re(3300,!1)}function Dc(i){return new re(3504,!1)}function Rc(i){return new re(3301,!1)}function Nc(i,e){return new re(3302,!1)}function Fc(i){return new re(3303,!1)}function Lc(i,e){return new re(3400,!1)}function jc(i){return new re(3401,!1)}function Vc(i){return new re(3402,!1)}function zc(i,e){return new re(3505,!1)}function on(i){switch(i.length){case 0:return new Bt;case 1:return i[0];default:return new Rn(i)}}function Fa(i,e,t=new Map,n=new Map){let r=[],o=[],a=-1,s=null;if(e.forEach(d=>{let m=d.get("offset"),_=m==a,b=_&&s||new Map;d.forEach((y,k)=>{let E=k,P=y;if(k!=="offset")switch(E=i.normalizePropertyName(E,r),P){case ci:P=t.get(k);break;case bt:P=n.get(k);break;default:P=i.normalizeStyleValue(k,E,P,r);break}b.set(E,P)}),_||o.push(b),s=b,a=m}),r.length)throw Wp(r);return o}function Jr(i,e,t,n){switch(e){case"start":i.onStart(()=>n(t&&Da(t,"start",i)));break;case"done":i.onDone(()=>n(t&&Da(t,"done",i)));break;case"destroy":i.onDestroy(()=>n(t&&Da(t,"destroy",i)));break}}function Da(i,e,t){let n=t.totalTime,r=!!t.disabled,o=Zr(i.element,i.triggerName,i.fromState,i.toState,e||i.phaseName,n??i.totalTime,r),a=i._data;return a!=null&&(o._data=a),o}function Zr(i,e,t,n,r="",o=0,a){return{element:i,triggerName:e,fromState:t,toState:n,phaseName:r,totalTime:o,disabled:!!a}}function ct(i,e,t){let n=i.get(e);return n||i.set(e,n=t),n}function La(i){let e=i.indexOf(":"),t=i.substring(1,e),n=i.slice(e+1);return[t,n]}var qp=typeof document>"u"?null:document.documentElement;function eo(i){let e=i.parentNode||i.host||null;return e===qp?null:e}function Gp(i){return i.substring(1,6)=="ebkit"}var Nn=null,gc=!1;function $c(i){Nn||(Nn=Yp()||{},gc=Nn.style?"WebkitAppearance"in Nn.style:!1);let e=!0;return Nn.style&&!Gp(i)&&(e=i in Nn.style,!e&&gc&&(e="Webkit"+i.charAt(0).toUpperCase()+i.slice(1)in Nn.style)),e}function Yp(){return typeof document<"u"?document.body:null}function ja(i,e){for(;e;){if(e===i)return!0;e=eo(e)}return!1}function Va(i,e,t){if(t)return Array.from(i.querySelectorAll(e));let n=i.querySelector(e);return n?[n]:[]}var Qp=1e3,za="{{",Kp="}}",$a="ng-enter",to="ng-leave",qi="ng-trigger",Gi=".ng-trigger",Ba="ng-animating",no=".ng-animating";function Ht(i){if(typeof i=="number")return i;let e=i.match(/^(-?[\.\d]+)(m?s)/);return!e||e.length<2?0:Ra(parseFloat(e[1]),e[2])}function Ra(i,e){return e==="s"?i*Qp:i}function Yi(i,e,t){return i.hasOwnProperty("duration")?i:Jp(i,e,t)}var Xp=/^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i;function Jp(i,e,t){let n,r=0,o="";if(typeof i=="string"){let a=i.match(Xp);if(a===null)return e.push(hc(i)),{duration:0,delay:0,easing:""};n=Ra(parseFloat(a[1]),a[2]);let s=a[3];s!=null&&(r=Ra(parseFloat(s),a[4]));let d=a[5];d&&(o=d)}else n=i;if(!t){let a=!1,s=e.length;n<0&&(e.push(zp()),a=!0),r<0&&(e.push($p()),a=!0),a&&e.splice(s,0,hc(i))}return{duration:n,delay:r,easing:o}}function Bc(i){return i.length?i[0]instanceof Map?i:i.map(e=>new Map(Object.entries(e))):[]}function Et(i,e,t){e.forEach((n,r)=>{let o=io(r);t&&!t.has(r)&&t.set(r,i.style[o]),i.style[o]=n})}function bn(i,e){e.forEach((t,n)=>{let r=io(n);i.style[r]=""})}function di(i){return Array.isArray(i)?i.length==1?i[0]:uc(i):i}function Hc(i,e,t){let n=e.params||{},r=Ha(i);r.length&&r.forEach(o=>{n.hasOwnProperty(o)||t.push(Bp(o))})}var Na=new RegExp(`${za}\\s*(.+?)\\s*${Kp}`,"g");function Ha(i){let e=[];if(typeof i=="string"){let t;for(;t=Na.exec(i);)e.push(t[1]);Na.lastIndex=0}return e}function pi(i,e,t){let n=`${i}`,r=n.replace(Na,(o,a)=>{let s=e[a];return s==null&&(t.push(Hp(a)),s=""),s.toString()});return r==n?i:r}var Zp=/-+([a-z0-9])/g;function io(i){return i.replace(Zp,(...e)=>e[1].toUpperCase())}function Uc(i,e){return i===0||e===0}function Wc(i,e,t){if(t.size&&e.length){let n=e[0],r=[];if(t.forEach((o,a)=>{n.has(a)||r.push(a),n.set(a,o)}),r.length)for(let o=1;o<e.length;o++){let a=e[o];r.forEach(s=>a.set(s,ro(i,s)))}}return e}function dt(i,e,t){switch(e.type){case q.Trigger:return i.visitTrigger(e,t);case q.State:return i.visitState(e,t);case q.Transition:return i.visitTransition(e,t);case q.Sequence:return i.visitSequence(e,t);case q.Group:return i.visitGroup(e,t);case q.Animate:return i.visitAnimate(e,t);case q.Keyframes:return i.visitKeyframes(e,t);case q.Style:return i.visitStyle(e,t);case q.Reference:return i.visitReference(e,t);case q.AnimateChild:return i.visitAnimateChild(e,t);case q.AnimateRef:return i.visitAnimateRef(e,t);case q.Query:return i.visitQuery(e,t);case q.Stagger:return i.visitStagger(e,t);default:throw Up(e.type)}}function ro(i,e){return window.getComputedStyle(i)[e]}var as=(()=>{class i{validateStyleProperty(t){return $c(t)}containsElement(t,n){return ja(t,n)}getParentElement(t){return eo(t)}query(t,n,r){return Va(t,n,r)}computeStyle(t,n,r){return r||""}animate(t,n,r,o,a,s=[],d){return new Bt(r,o)}static \u0275fac=function(n){return new(n||i)};static \u0275prov=H({token:i,factory:i.\u0275fac})}return i})(),Ln=class{static NOOP=new as},jn=class{};var em=new Set(["width","height","minWidth","minHeight","maxWidth","maxHeight","left","top","bottom","right","fontSize","outlineWidth","outlineOffset","paddingTop","paddingLeft","paddingBottom","paddingRight","marginTop","marginLeft","marginBottom","marginRight","borderRadius","borderWidth","borderTopWidth","borderLeftWidth","borderRightWidth","borderBottomWidth","textIndent","perspective"]),co=class extends jn{normalizePropertyName(e,t){return io(e)}normalizeStyleValue(e,t,n,r){let o="",a=n.toString().trim();if(em.has(t)&&n!==0&&n!=="0")if(typeof n=="number")o="px";else{let s=n.match(/^[+-]?[\d\.]+([a-z]*)$/);s&&s[1].length==0&&r.push(fc(e,n))}return a+o}};var po="*";function tm(i,e){let t=[];return typeof i=="string"?i.split(/\s*,\s*/).forEach(n=>nm(n,t,e)):t.push(i),t}function nm(i,e,t){if(i[0]==":"){let d=im(i,t);if(typeof d=="function"){e.push(d);return}i=d}let n=i.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/);if(n==null||n.length<4)return t.push(kc(i)),e;let r=n[1],o=n[2],a=n[3];e.push(qc(r,a));let s=r==po&&a==po;o[0]=="<"&&!s&&e.push(qc(a,r))}function im(i,e){switch(i){case":enter":return"void => *";case":leave":return"* => void";case":increment":return(t,n)=>parseFloat(n)>parseFloat(t);case":decrement":return(t,n)=>parseFloat(n)<parseFloat(t);default:return e.push(Pc(i)),"* => *"}}var oo=new Set(["true","1"]),ao=new Set(["false","0"]);function qc(i,e){let t=oo.has(i)||ao.has(i),n=oo.has(e)||ao.has(e);return(r,o)=>{let a=i==po||i==r,s=e==po||e==o;return!a&&t&&typeof r=="boolean"&&(a=r?oo.has(i):ao.has(i)),!s&&n&&typeof o=="boolean"&&(s=o?oo.has(e):ao.has(e)),a&&s}}var nd=":self",rm=new RegExp(`s*${nd}s*,?`,"g");function id(i,e,t,n){return new Qa(i).build(e,t,n)}var Gc="",Qa=class{_driver;constructor(e){this._driver=e}build(e,t,n){let r=new Ka(t);return this._resetContextStyleTimingState(r),dt(this,di(e),r)}_resetContextStyleTimingState(e){e.currentQuerySelector=Gc,e.collectedStyles=new Map,e.collectedStyles.set(Gc,new Map),e.currentTime=0}visitTrigger(e,t){let n=t.queryCount=0,r=t.depCount=0,o=[],a=[];return e.name.charAt(0)=="@"&&t.errors.push(_c()),e.definitions.forEach(s=>{if(this._resetContextStyleTimingState(t),s.type==q.State){let d=s,m=d.name;m.toString().split(/\s*,\s*/).forEach(_=>{d.name=_,o.push(this.visitState(d,t))}),d.name=m}else if(s.type==q.Transition){let d=this.visitTransition(s,t);n+=d.queryCount,r+=d.depCount,a.push(d)}else t.errors.push(bc())}),{type:q.Trigger,name:e.name,states:o,transitions:a,queryCount:n,depCount:r,options:null}}visitState(e,t){let n=this.visitStyle(e.styles,t),r=e.options&&e.options.params||null;if(n.containsDynamicStyles){let o=new Set,a=r||{};n.styles.forEach(s=>{s instanceof Map&&s.forEach(d=>{Ha(d).forEach(m=>{a.hasOwnProperty(m)||o.add(m)})})}),o.size&&t.errors.push(vc(e.name,[...o.values()]))}return{type:q.State,name:e.name,style:n,options:r?{params:r}:null}}visitTransition(e,t){t.queryCount=0,t.depCount=0;let n=dt(this,di(e.animation),t),r=tm(e.expr,t.errors);return{type:q.Transition,matchers:r,animation:n,queryCount:t.queryCount,depCount:t.depCount,options:Fn(e.options)}}visitSequence(e,t){return{type:q.Sequence,steps:e.steps.map(n=>dt(this,n,t)),options:Fn(e.options)}}visitGroup(e,t){let n=t.currentTime,r=0,o=e.steps.map(a=>{t.currentTime=n;let s=dt(this,a,t);return r=Math.max(r,t.currentTime),s});return t.currentTime=r,{type:q.Group,steps:o,options:Fn(e.options)}}visitAnimate(e,t){let n=lm(e.timings,t.errors);t.currentAnimateTimings=n;let r,o=e.styles?e.styles:_n({});if(o.type==q.Keyframes)r=this.visitKeyframes(o,t);else{let a=e.styles,s=!1;if(!a){s=!0;let m={};n.easing&&(m.easing=n.easing),a=_n(m)}t.currentTime+=n.duration+n.delay;let d=this.visitStyle(a,t);d.isEmptyStep=s,r=d}return t.currentAnimateTimings=null,{type:q.Animate,timings:n,style:r,options:null}}visitStyle(e,t){let n=this._makeStyleAst(e,t);return this._validateStyleAst(n,t),n}_makeStyleAst(e,t){let n=[],r=Array.isArray(e.styles)?e.styles:[e.styles];for(let s of r)typeof s=="string"?s===bt?n.push(s):t.errors.push(yc(s)):n.push(new Map(Object.entries(s)));let o=!1,a=null;return n.forEach(s=>{if(s instanceof Map&&(s.has("easing")&&(a=s.get("easing"),s.delete("easing")),!o)){for(let d of s.values())if(d.toString().indexOf(za)>=0){o=!0;break}}}),{type:q.Style,styles:n,easing:a,offset:e.offset,containsDynamicStyles:o,options:null}}_validateStyleAst(e,t){let n=t.currentAnimateTimings,r=t.currentTime,o=t.currentTime;n&&o>0&&(o-=n.duration+n.delay),e.styles.forEach(a=>{typeof a!="string"&&a.forEach((s,d)=>{let m=t.collectedStyles.get(t.currentQuerySelector),_=m.get(d),b=!0;_&&(o!=r&&o>=_.startTime&&r<=_.endTime&&(t.errors.push(Cc(d,_.startTime,_.endTime,o,r)),b=!1),o=_.startTime),b&&m.set(d,{startTime:o,endTime:r}),t.options&&Hc(s,t.options,t.errors)})})}visitKeyframes(e,t){let n={type:q.Keyframes,styles:[],options:null};if(!t.currentAnimateTimings)return t.errors.push(Sc()),n;let r=1,o=0,a=[],s=!1,d=!1,m=0,_=e.steps.map(pe=>{let N=this._makeStyleAst(pe,t),X=N.offset!=null?N.offset:sm(N.styles),U=0;return X!=null&&(o++,U=N.offset=X),d=d||U<0||U>1,s=s||U<m,m=U,a.push(U),N});d&&t.errors.push(xc()),s&&t.errors.push(wc());let b=e.steps.length,y=0;o>0&&o<b?t.errors.push(Tc()):o==0&&(y=r/(b-1));let k=b-1,E=t.currentTime,P=t.currentAnimateTimings,K=P.duration;return _.forEach((pe,N)=>{let X=y>0?N==k?1:y*N:a[N],U=X*K;t.currentTime=E+P.delay+U,P.duration=U,this._validateStyleAst(pe,t),pe.offset=X,n.styles.push(pe)}),n}visitReference(e,t){return{type:q.Reference,animation:dt(this,di(e.animation),t),options:Fn(e.options)}}visitAnimateChild(e,t){return t.depCount++,{type:q.AnimateChild,options:Fn(e.options)}}visitAnimateRef(e,t){return{type:q.AnimateRef,animation:this.visitReference(e.animation,t),options:Fn(e.options)}}visitQuery(e,t){let n=t.currentQuerySelector,r=e.options||{};t.queryCount++,t.currentQuery=e;let[o,a]=om(e.selector);t.currentQuerySelector=n.length?n+" "+o:o,ct(t.collectedStyles,t.currentQuerySelector,new Map);let s=dt(this,di(e.animation),t);return t.currentQuery=null,t.currentQuerySelector=n,{type:q.Query,selector:o,limit:r.limit||0,optional:!!r.optional,includeSelf:a,animation:s,originalSelector:e.selector,options:Fn(e.options)}}visitStagger(e,t){t.currentQuery||t.errors.push(Ec());let n=e.timings==="full"?{duration:0,delay:0,easing:"full"}:Yi(e.timings,t.errors,!0);return{type:q.Stagger,animation:dt(this,di(e.animation),t),timings:n,options:null}}};function om(i){let e=!!i.split(/\s*,\s*/).find(t=>t==nd);return e&&(i=i.replace(rm,"")),i=i.replace(/@\*/g,Gi).replace(/@\w+/g,t=>Gi+"-"+t.slice(1)).replace(/:animating/g,no),[i,e]}function am(i){return i?G({},i):null}var Ka=class{errors;queryCount=0;depCount=0;currentTransition=null;currentQuery=null;currentQuerySelector=null;currentAnimateTimings=null;currentTime=0;collectedStyles=new Map;options=null;unsupportedCSSPropertiesFound=new Set;constructor(e){this.errors=e}};function sm(i){if(typeof i=="string")return null;let e=null;if(Array.isArray(i))i.forEach(t=>{if(t instanceof Map&&t.has("offset")){let n=t;e=parseFloat(n.get("offset")),n.delete("offset")}});else if(i instanceof Map&&i.has("offset")){let t=i;e=parseFloat(t.get("offset")),t.delete("offset")}return e}function lm(i,e){if(i.hasOwnProperty("duration"))return i;if(typeof i=="number"){let o=Yi(i,e).duration;return Ua(o,0,"")}let t=i;if(t.split(/\s+/).some(o=>o.charAt(0)=="{"&&o.charAt(1)=="{")){let o=Ua(0,0,"");return o.dynamic=!0,o.strValue=t,o}let r=Yi(t,e);return Ua(r.duration,r.delay,r.easing)}function Fn(i){return i?(i=G({},i),i.params&&(i.params=am(i.params))):i={},i}function Ua(i,e,t){return{duration:i,delay:e,easing:t}}function ss(i,e,t,n,r,o,a=null,s=!1){return{type:1,element:i,keyframes:e,preStyleProps:t,postStyleProps:n,duration:r,delay:o,totalTime:r+o,easing:a,subTimeline:s}}var Ki=class{_map=new Map;get(e){return this._map.get(e)||[]}append(e,t){let n=this._map.get(e);n||this._map.set(e,n=[]),n.push(...t)}has(e){return this._map.has(e)}clear(){this._map.clear()}},cm=1,dm=":enter",pm=new RegExp(dm,"g"),mm=":leave",um=new RegExp(mm,"g");function rd(i,e,t,n,r,o=new Map,a=new Map,s,d,m=[]){return new Xa().buildKeyframes(i,e,t,n,r,o,a,s,d,m)}var Xa=class{buildKeyframes(e,t,n,r,o,a,s,d,m,_=[]){m=m||new Ki;let b=new Ja(e,t,m,r,o,_,[]);b.options=d;let y=d.delay?Ht(d.delay):0;b.currentTimeline.delayNextStep(y),b.currentTimeline.setStyles([a],null,b.errors,d),dt(this,n,b);let k=b.timelines.filter(E=>E.containsAnimation());if(k.length&&s.size){let E;for(let P=k.length-1;P>=0;P--){let K=k[P];if(K.element===t){E=K;break}}E&&!E.allowOnlyTimelineStyles()&&E.setStyles([s],null,b.errors,d)}return k.length?k.map(E=>E.buildKeyframes()):[ss(t,[],[],[],0,y,"",!1)]}visitTrigger(e,t){}visitState(e,t){}visitTransition(e,t){}visitAnimateChild(e,t){let n=t.subInstructions.get(t.element);if(n){let r=t.createSubContext(e.options),o=t.currentTimeline.currentTime,a=this._visitSubInstructions(n,r,r.options);o!=a&&t.transformIntoNewTimeline(a)}t.previousNode=e}visitAnimateRef(e,t){let n=t.createSubContext(e.options);n.transformIntoNewTimeline(),this._applyAnimationRefDelays([e.options,e.animation.options],t,n),this.visitReference(e.animation,n),t.transformIntoNewTimeline(n.currentTimeline.currentTime),t.previousNode=e}_applyAnimationRefDelays(e,t,n){for(let r of e){let o=r?.delay;if(o){let a=typeof o=="number"?o:Ht(pi(o,r?.params??{},t.errors));n.delayNextStep(a)}}}_visitSubInstructions(e,t,n){let o=t.currentTimeline.currentTime,a=n.duration!=null?Ht(n.duration):null,s=n.delay!=null?Ht(n.delay):null;return a!==0&&e.forEach(d=>{let m=t.appendInstructionToTimeline(d,a,s);o=Math.max(o,m.duration+m.delay)}),o}visitReference(e,t){t.updateOptions(e.options,!0),dt(this,e.animation,t),t.previousNode=e}visitSequence(e,t){let n=t.subContextCount,r=t,o=e.options;if(o&&(o.params||o.delay)&&(r=t.createSubContext(o),r.transformIntoNewTimeline(),o.delay!=null)){r.previousNode.type==q.Style&&(r.currentTimeline.snapshotCurrentStyles(),r.previousNode=mo);let a=Ht(o.delay);r.delayNextStep(a)}e.steps.length&&(e.steps.forEach(a=>dt(this,a,r)),r.currentTimeline.applyStylesToKeyframe(),r.subContextCount>n&&r.transformIntoNewTimeline()),t.previousNode=e}visitGroup(e,t){let n=[],r=t.currentTimeline.currentTime,o=e.options&&e.options.delay?Ht(e.options.delay):0;e.steps.forEach(a=>{let s=t.createSubContext(e.options);o&&s.delayNextStep(o),dt(this,a,s),r=Math.max(r,s.currentTimeline.currentTime),n.push(s.currentTimeline)}),n.forEach(a=>t.currentTimeline.mergeTimelineCollectedStyles(a)),t.transformIntoNewTimeline(r),t.previousNode=e}_visitTiming(e,t){if(e.dynamic){let n=e.strValue,r=t.params?pi(n,t.params,t.errors):n;return Yi(r,t.errors)}else return{duration:e.duration,delay:e.delay,easing:e.easing}}visitAnimate(e,t){let n=t.currentAnimateTimings=this._visitTiming(e.timings,t),r=t.currentTimeline;n.delay&&(t.incrementTime(n.delay),r.snapshotCurrentStyles());let o=e.style;o.type==q.Keyframes?this.visitKeyframes(o,t):(t.incrementTime(n.duration),this.visitStyle(o,t),r.applyStylesToKeyframe()),t.currentAnimateTimings=null,t.previousNode=e}visitStyle(e,t){let n=t.currentTimeline,r=t.currentAnimateTimings;!r&&n.hasCurrentStyleProperties()&&n.forwardFrame();let o=r&&r.easing||e.easing;e.isEmptyStep?n.applyEmptyStep(o):n.setStyles(e.styles,o,t.errors,t.options),t.previousNode=e}visitKeyframes(e,t){let n=t.currentAnimateTimings,r=t.currentTimeline.duration,o=n.duration,s=t.createSubContext().currentTimeline;s.easing=n.easing,e.styles.forEach(d=>{let m=d.offset||0;s.forwardTime(m*o),s.setStyles(d.styles,d.easing,t.errors,t.options),s.applyStylesToKeyframe()}),t.currentTimeline.mergeTimelineCollectedStyles(s),t.transformIntoNewTimeline(r+o),t.previousNode=e}visitQuery(e,t){let n=t.currentTimeline.currentTime,r=e.options||{},o=r.delay?Ht(r.delay):0;o&&(t.previousNode.type===q.Style||n==0&&t.currentTimeline.hasCurrentStyleProperties())&&(t.currentTimeline.snapshotCurrentStyles(),t.previousNode=mo);let a=n,s=t.invokeQuery(e.selector,e.originalSelector,e.limit,e.includeSelf,!!r.optional,t.errors);t.currentQueryTotal=s.length;let d=null;s.forEach((m,_)=>{t.currentQueryIndex=_;let b=t.createSubContext(e.options,m);o&&b.delayNextStep(o),m===t.element&&(d=b.currentTimeline),dt(this,e.animation,b),b.currentTimeline.applyStylesToKeyframe();let y=b.currentTimeline.currentTime;a=Math.max(a,y)}),t.currentQueryIndex=0,t.currentQueryTotal=0,t.transformIntoNewTimeline(a),d&&(t.currentTimeline.mergeTimelineCollectedStyles(d),t.currentTimeline.snapshotCurrentStyles()),t.previousNode=e}visitStagger(e,t){let n=t.parentContext,r=t.currentTimeline,o=e.timings,a=Math.abs(o.duration),s=a*(t.currentQueryTotal-1),d=a*t.currentQueryIndex;switch(o.duration<0?"reverse":o.easing){case"reverse":d=s-d;break;case"full":d=n.currentStaggerTime;break}let _=t.currentTimeline;d&&_.delayNextStep(d);let b=_.currentTime;dt(this,e.animation,t),t.previousNode=e,n.currentStaggerTime=r.currentTime-b+(r.startTime-n.currentTimeline.startTime)}},mo={},Ja=class i{_driver;element;subInstructions;_enterClassName;_leaveClassName;errors;timelines;parentContext=null;currentTimeline;currentAnimateTimings=null;previousNode=mo;subContextCount=0;options={};currentQueryIndex=0;currentQueryTotal=0;currentStaggerTime=0;constructor(e,t,n,r,o,a,s,d){this._driver=e,this.element=t,this.subInstructions=n,this._enterClassName=r,this._leaveClassName=o,this.errors=a,this.timelines=s,this.currentTimeline=d||new uo(this._driver,t,0),s.push(this.currentTimeline)}get params(){return this.options.params}updateOptions(e,t){if(!e)return;let n=e,r=this.options;n.duration!=null&&(r.duration=Ht(n.duration)),n.delay!=null&&(r.delay=Ht(n.delay));let o=n.params;if(o){let a=r.params;a||(a=this.options.params={}),Object.keys(o).forEach(s=>{(!t||!a.hasOwnProperty(s))&&(a[s]=pi(o[s],a,this.errors))})}}_copyOptions(){let e={};if(this.options){let t=this.options.params;if(t){let n=e.params={};Object.keys(t).forEach(r=>{n[r]=t[r]})}}return e}createSubContext(e=null,t,n){let r=t||this.element,o=new i(this._driver,r,this.subInstructions,this._enterClassName,this._leaveClassName,this.errors,this.timelines,this.currentTimeline.fork(r,n||0));return o.previousNode=this.previousNode,o.currentAnimateTimings=this.currentAnimateTimings,o.options=this._copyOptions(),o.updateOptions(e),o.currentQueryIndex=this.currentQueryIndex,o.currentQueryTotal=this.currentQueryTotal,o.parentContext=this,this.subContextCount++,o}transformIntoNewTimeline(e){return this.previousNode=mo,this.currentTimeline=this.currentTimeline.fork(this.element,e),this.timelines.push(this.currentTimeline),this.currentTimeline}appendInstructionToTimeline(e,t,n){let r={duration:t??e.duration,delay:this.currentTimeline.currentTime+(n??0)+e.delay,easing:""},o=new Za(this._driver,e.element,e.keyframes,e.preStyleProps,e.postStyleProps,r,e.stretchStartingKeyframe);return this.timelines.push(o),r}incrementTime(e){this.currentTimeline.forwardTime(this.currentTimeline.duration+e)}delayNextStep(e){e>0&&this.currentTimeline.delayNextStep(e)}invokeQuery(e,t,n,r,o,a){let s=[];if(r&&s.push(this.element),e.length>0){e=e.replace(pm,"."+this._enterClassName),e=e.replace(um,"."+this._leaveClassName);let d=n!=1,m=this._driver.query(this.element,e,d);n!==0&&(m=n<0?m.slice(m.length+n,m.length):m.slice(0,n)),s.push(...m)}return!o&&s.length==0&&a.push(Mc(t)),s}},uo=class i{_driver;element;startTime;_elementTimelineStylesLookup;duration=0;easing=null;_previousKeyframe=new Map;_currentKeyframe=new Map;_keyframes=new Map;_styleSummary=new Map;_localTimelineStyles=new Map;_globalTimelineStyles;_pendingStyles=new Map;_backFill=new Map;_currentEmptyStepKeyframe=null;constructor(e,t,n,r){this._driver=e,this.element=t,this.startTime=n,this._elementTimelineStylesLookup=r,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(t),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(t,this._localTimelineStyles)),this._loadKeyframe()}containsAnimation(){switch(this._keyframes.size){case 0:return!1;case 1:return this.hasCurrentStyleProperties();default:return!0}}hasCurrentStyleProperties(){return this._currentKeyframe.size>0}get currentTime(){return this.startTime+this.duration}delayNextStep(e){let t=this._keyframes.size===1&&this._pendingStyles.size;this.duration||t?(this.forwardTime(this.currentTime+e),t&&this.snapshotCurrentStyles()):this.startTime+=e}fork(e,t){return this.applyStylesToKeyframe(),new i(this._driver,e,t||this.currentTime,this._elementTimelineStylesLookup)}_loadKeyframe(){this._currentKeyframe&&(this._previousKeyframe=this._currentKeyframe),this._currentKeyframe=this._keyframes.get(this.duration),this._currentKeyframe||(this._currentKeyframe=new Map,this._keyframes.set(this.duration,this._currentKeyframe))}forwardFrame(){this.duration+=cm,this._loadKeyframe()}forwardTime(e){this.applyStylesToKeyframe(),this.duration=e,this._loadKeyframe()}_updateStyle(e,t){this._localTimelineStyles.set(e,t),this._globalTimelineStyles.set(e,t),this._styleSummary.set(e,{time:this.currentTime,value:t})}allowOnlyTimelineStyles(){return this._currentEmptyStepKeyframe!==this._currentKeyframe}applyEmptyStep(e){e&&this._previousKeyframe.set("easing",e);for(let[t,n]of this._globalTimelineStyles)this._backFill.set(t,n||bt),this._currentKeyframe.set(t,bt);this._currentEmptyStepKeyframe=this._currentKeyframe}setStyles(e,t,n,r){t&&this._previousKeyframe.set("easing",t);let o=r&&r.params||{},a=hm(e,this._globalTimelineStyles);for(let[s,d]of a){let m=pi(d,o,n);this._pendingStyles.set(s,m),this._localTimelineStyles.has(s)||this._backFill.set(s,this._globalTimelineStyles.get(s)??bt),this._updateStyle(s,m)}}applyStylesToKeyframe(){this._pendingStyles.size!=0&&(this._pendingStyles.forEach((e,t)=>{this._currentKeyframe.set(t,e)}),this._pendingStyles.clear(),this._localTimelineStyles.forEach((e,t)=>{this._currentKeyframe.has(t)||this._currentKeyframe.set(t,e)}))}snapshotCurrentStyles(){for(let[e,t]of this._localTimelineStyles)this._pendingStyles.set(e,t),this._updateStyle(e,t)}getFinalKeyframe(){return this._keyframes.get(this.duration)}get properties(){let e=[];for(let t in this._currentKeyframe)e.push(t);return e}mergeTimelineCollectedStyles(e){e._styleSummary.forEach((t,n)=>{let r=this._styleSummary.get(n);(!r||t.time>r.time)&&this._updateStyle(n,t.value)})}buildKeyframes(){this.applyStylesToKeyframe();let e=new Set,t=new Set,n=this._keyframes.size===1&&this.duration===0,r=[];this._keyframes.forEach((s,d)=>{let m=new Map([...this._backFill,...s]);m.forEach((_,b)=>{_===ci?e.add(b):_===bt&&t.add(b)}),n||m.set("offset",d/this.duration),r.push(m)});let o=[...e.values()],a=[...t.values()];if(n){let s=r[0],d=new Map(s);s.set("offset",0),d.set("offset",1),r=[s,d]}return ss(this.element,r,o,a,this.duration,this.startTime,this.easing,!1)}},Za=class extends uo{keyframes;preStyleProps;postStyleProps;_stretchStartingKeyframe;timings;constructor(e,t,n,r,o,a,s=!1){super(e,t,a.delay),this.keyframes=n,this.preStyleProps=r,this.postStyleProps=o,this._stretchStartingKeyframe=s,this.timings={duration:a.duration,delay:a.delay,easing:a.easing}}containsAnimation(){return this.keyframes.length>1}buildKeyframes(){let e=this.keyframes,{delay:t,duration:n,easing:r}=this.timings;if(this._stretchStartingKeyframe&&t){let o=[],a=n+t,s=t/a,d=new Map(e[0]);d.set("offset",0),o.push(d);let m=new Map(e[0]);m.set("offset",Yc(s)),o.push(m);let _=e.length-1;for(let b=1;b<=_;b++){let y=new Map(e[b]),k=y.get("offset"),E=t+k*n;y.set("offset",Yc(E/a)),o.push(y)}n=a,t=0,r="",e=o}return ss(this.element,e,this.preStyleProps,this.postStyleProps,n,t,r,!0)}};function Yc(i,e=3){let t=Math.pow(10,e-1);return Math.round(i*t)/t}function hm(i,e){let t=new Map,n;return i.forEach(r=>{if(r==="*"){n??=e.keys();for(let o of n)t.set(o,bt)}else for(let[o,a]of r)t.set(o,a)}),t}function Qc(i,e,t,n,r,o,a,s,d,m,_,b,y){return{type:0,element:i,triggerName:e,isRemovalTransition:r,fromState:t,fromStyles:o,toState:n,toStyles:a,timelines:s,queriedElements:d,preStyleProps:m,postStyleProps:_,totalTime:b,errors:y}}var Wa={},ho=class{_triggerName;ast;_stateStyles;constructor(e,t,n){this._triggerName=e,this.ast=t,this._stateStyles=n}match(e,t,n,r){return gm(this.ast.matchers,e,t,n,r)}buildStyles(e,t,n){let r=this._stateStyles.get("*");return e!==void 0&&(r=this._stateStyles.get(e?.toString())||r),r?r.buildStyles(t,n):new Map}build(e,t,n,r,o,a,s,d,m,_){let b=[],y=this.ast.options&&this.ast.options.params||Wa,k=s&&s.params||Wa,E=this.buildStyles(n,k,b),P=d&&d.params||Wa,K=this.buildStyles(r,P,b),pe=new Set,N=new Map,X=new Map,U=r==="void",Ee={params:od(P,y),delay:this.ast.options?.delay},de=_?[]:rd(e,t,this.ast.animation,o,a,E,K,Ee,m,b),xe=0;return de.forEach(He=>{xe=Math.max(He.duration+He.delay,xe)}),b.length?Qc(t,this._triggerName,n,r,U,E,K,[],[],N,X,xe,b):(de.forEach(He=>{let Zt=He.element,dn=ct(N,Zt,new Set);He.preStyleProps.forEach(St=>dn.add(St));let Ve=ct(X,Zt,new Set);He.postStyleProps.forEach(St=>Ve.add(St)),Zt!==t&&pe.add(Zt)}),Qc(t,this._triggerName,n,r,U,E,K,de,[...pe.values()],N,X,xe))}};function gm(i,e,t,n,r){return i.some(o=>o(e,t,n,r))}function od(i,e){let t=G({},e);return Object.entries(i).forEach(([n,r])=>{r!=null&&(t[n]=r)}),t}var es=class{styles;defaultParams;normalizer;constructor(e,t,n){this.styles=e,this.defaultParams=t,this.normalizer=n}buildStyles(e,t){let n=new Map,r=od(e,this.defaultParams);return this.styles.styles.forEach(o=>{typeof o!="string"&&o.forEach((a,s)=>{a&&(a=pi(a,r,t));let d=this.normalizer.normalizePropertyName(s,t);a=this.normalizer.normalizeStyleValue(s,d,a,t),n.set(s,a)})}),n}};function fm(i,e,t){return new ts(i,e,t)}var ts=class{name;ast;_normalizer;transitionFactories=[];fallbackTransition;states=new Map;constructor(e,t,n){this.name=e,this.ast=t,this._normalizer=n,t.states.forEach(r=>{let o=r.options&&r.options.params||{};this.states.set(r.name,new es(r.style,o,n))}),Kc(this.states,"true","1"),Kc(this.states,"false","0"),t.transitions.forEach(r=>{this.transitionFactories.push(new ho(e,r,this.states))}),this.fallbackTransition=_m(e,this.states)}get containsQueries(){return this.ast.queryCount>0}matchTransition(e,t,n,r){return this.transitionFactories.find(a=>a.match(e,t,n,r))||null}matchStyles(e,t,n){return this.fallbackTransition.buildStyles(e,t,n)}};function _m(i,e,t){let n=[(a,s)=>!0],r={type:q.Sequence,steps:[],options:null},o={type:q.Transition,animation:r,matchers:n,options:null,queryCount:0,depCount:0};return new ho(i,o,e)}function Kc(i,e,t){i.has(e)?i.has(t)||i.set(t,i.get(e)):i.has(t)&&i.set(e,i.get(t))}var bm=new Ki,ns=class{bodyNode;_driver;_normalizer;_animations=new Map;_playersById=new Map;players=[];constructor(e,t,n){this.bodyNode=e,this._driver=t,this._normalizer=n}register(e,t){let n=[],r=[],o=id(this._driver,t,n,r);if(n.length)throw Ac(n);this._animations.set(e,o)}_buildPlayer(e,t,n){let r=e.element,o=Fa(this._normalizer,e.keyframes,t,n);return this._driver.animate(r,o,e.duration,e.delay,e.easing,[],!0)}create(e,t,n={}){let r=[],o=this._animations.get(e),a,s=new Map;if(o?(a=rd(this._driver,t,o,$a,to,new Map,new Map,n,bm,r),a.forEach(_=>{let b=ct(s,_.element,new Map);_.postStyleProps.forEach(y=>b.set(y,null))})):(r.push(Ic()),a=[]),r.length)throw Dc(r);s.forEach((_,b)=>{_.forEach((y,k)=>{_.set(k,this._driver.computeStyle(b,k,bt))})});let d=a.map(_=>{let b=s.get(_.element);return this._buildPlayer(_,new Map,b)}),m=on(d);return this._playersById.set(e,m),m.onDestroy(()=>this.destroy(e)),this.players.push(m),m}destroy(e){let t=this._getPlayer(e);t.destroy(),this._playersById.delete(e);let n=this.players.indexOf(t);n>=0&&this.players.splice(n,1)}_getPlayer(e){let t=this._playersById.get(e);if(!t)throw Rc(e);return t}listen(e,t,n,r){let o=Zr(t,"","","");return Jr(this._getPlayer(e),n,o,r),()=>{}}command(e,t,n,r){if(n=="register"){this.register(e,r[0]);return}if(n=="create"){let a=r[0]||{};this.create(e,t,a);return}let o=this._getPlayer(e);switch(n){case"play":o.play();break;case"pause":o.pause();break;case"reset":o.reset();break;case"restart":o.restart();break;case"finish":o.finish();break;case"init":o.init();break;case"setPosition":o.setPosition(parseFloat(r[0]));break;case"destroy":this.destroy(e);break}}},Xc="ng-animate-queued",vm=".ng-animate-queued",qa="ng-animate-disabled",ym=".ng-animate-disabled",Cm="ng-star-inserted",Sm=".ng-star-inserted",xm=[],ad={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},wm={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},Mt="__ng_removed",Xi=class{namespaceId;value;options;get params(){return this.options.params}constructor(e,t=""){this.namespaceId=t;let n=e&&e.hasOwnProperty("value"),r=n?e.value:e;if(this.value=Em(r),n){let o=e,{value:a}=o,s=il(o,["value"]);this.options=s}else this.options={};this.options.params||(this.options.params={})}absorbOptions(e){let t=e.params;if(t){let n=this.options.params;Object.keys(t).forEach(r=>{n[r]==null&&(n[r]=t[r])})}}},Qi="void",Ga=new Xi(Qi),is=class{id;hostElement;_engine;players=[];_triggers=new Map;_queue=[];_elementListeners=new Map;_hostClassName;constructor(e,t,n){this.id=e,this.hostElement=t,this._engine=n,this._hostClassName="ng-tns-"+e,vt(t,this._hostClassName)}listen(e,t,n,r){if(!this._triggers.has(t))throw Nc(n,t);if(n==null||n.length==0)throw Fc(t);if(!Mm(n))throw Lc(n,t);let o=ct(this._elementListeners,e,[]),a={name:t,phase:n,callback:r};o.push(a);let s=ct(this._engine.statesByElement,e,new Map);return s.has(t)||(vt(e,qi),vt(e,qi+"-"+t),s.set(t,Ga)),()=>{this._engine.afterFlush(()=>{let d=o.indexOf(a);d>=0&&o.splice(d,1),this._triggers.has(t)||s.delete(t)})}}register(e,t){return this._triggers.has(e)?!1:(this._triggers.set(e,t),!0)}_getTrigger(e){let t=this._triggers.get(e);if(!t)throw jc(e);return t}trigger(e,t,n,r=!0){let o=this._getTrigger(t),a=new Ji(this.id,t,e),s=this._engine.statesByElement.get(e);s||(vt(e,qi),vt(e,qi+"-"+t),this._engine.statesByElement.set(e,s=new Map));let d=s.get(t),m=new Xi(n,this.id);if(!(n&&n.hasOwnProperty("value"))&&d&&m.absorbOptions(d.options),s.set(t,m),d||(d=Ga),!(m.value===Qi)&&d.value===m.value){if(!Om(d.params,m.params)){let P=[],K=o.matchStyles(d.value,d.params,P),pe=o.matchStyles(m.value,m.params,P);P.length?this._engine.reportError(P):this._engine.afterFlush(()=>{bn(e,K),Et(e,pe)})}return}let y=ct(this._engine.playersByElement,e,[]);y.forEach(P=>{P.namespaceId==this.id&&P.triggerName==t&&P.queued&&P.destroy()});let k=o.matchTransition(d.value,m.value,e,m.params),E=!1;if(!k){if(!r)return;k=o.fallbackTransition,E=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:t,transition:k,fromState:d,toState:m,player:a,isFallbackTransition:E}),E||(vt(e,Xc),a.onStart(()=>{mi(e,Xc)})),a.onDone(()=>{let P=this.players.indexOf(a);P>=0&&this.players.splice(P,1);let K=this._engine.playersByElement.get(e);if(K){let pe=K.indexOf(a);pe>=0&&K.splice(pe,1)}}),this.players.push(a),y.push(a),a}deregister(e){this._triggers.delete(e),this._engine.statesByElement.forEach(t=>t.delete(e)),this._elementListeners.forEach((t,n)=>{this._elementListeners.set(n,t.filter(r=>r.name!=e))})}clearElementCache(e){this._engine.statesByElement.delete(e),this._elementListeners.delete(e);let t=this._engine.playersByElement.get(e);t&&(t.forEach(n=>n.destroy()),this._engine.playersByElement.delete(e))}_signalRemovalForInnerTriggers(e,t){let n=this._engine.driver.query(e,Gi,!0);n.forEach(r=>{if(r[Mt])return;let o=this._engine.fetchNamespacesByElement(r);o.size?o.forEach(a=>a.triggerLeaveAnimation(r,t,!1,!0)):this.clearElementCache(r)}),this._engine.afterFlushAnimationsDone(()=>n.forEach(r=>this.clearElementCache(r)))}triggerLeaveAnimation(e,t,n,r){let o=this._engine.statesByElement.get(e),a=new Map;if(o){let s=[];if(o.forEach((d,m)=>{if(a.set(m,d.value),this._triggers.has(m)){let _=this.trigger(e,m,Qi,r);_&&s.push(_)}}),s.length)return this._engine.markElementAsRemoved(this.id,e,!0,t,a),n&&on(s).onDone(()=>this._engine.processLeaveNode(e)),!0}return!1}prepareLeaveAnimationListeners(e){let t=this._elementListeners.get(e),n=this._engine.statesByElement.get(e);if(t&&n){let r=new Set;t.forEach(o=>{let a=o.name;if(r.has(a))return;r.add(a);let d=this._triggers.get(a).fallbackTransition,m=n.get(a)||Ga,_=new Xi(Qi),b=new Ji(this.id,a,e);this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:a,transition:d,fromState:m,toState:_,player:b,isFallbackTransition:!0})})}}removeNode(e,t){let n=this._engine;if(e.childElementCount&&this._signalRemovalForInnerTriggers(e,t),this.triggerLeaveAnimation(e,t,!0))return;let r=!1;if(n.totalAnimations){let o=n.players.length?n.playersByQueriedElement.get(e):[];if(o&&o.length)r=!0;else{let a=e;for(;a=a.parentNode;)if(n.statesByElement.get(a)){r=!0;break}}}if(this.prepareLeaveAnimationListeners(e),r)n.markElementAsRemoved(this.id,e,!1,t);else{let o=e[Mt];(!o||o===ad)&&(n.afterFlush(()=>this.clearElementCache(e)),n.destroyInnerAnimations(e),n._onRemovalComplete(e,t))}}insertNode(e,t){vt(e,this._hostClassName)}drainQueuedTransitions(e){let t=[];return this._queue.forEach(n=>{let r=n.player;if(r.destroyed)return;let o=n.element,a=this._elementListeners.get(o);a&&a.forEach(s=>{if(s.name==n.triggerName){let d=Zr(o,n.triggerName,n.fromState.value,n.toState.value);d._data=e,Jr(n.player,s.phase,d,s.callback)}}),r.markedForDestroy?this._engine.afterFlush(()=>{r.destroy()}):t.push(n)}),this._queue=[],t.sort((n,r)=>{let o=n.transition.ast.depCount,a=r.transition.ast.depCount;return o==0||a==0?o-a:this._engine.driver.containsElement(n.element,r.element)?1:-1})}destroy(e){this.players.forEach(t=>t.destroy()),this._signalRemovalForInnerTriggers(this.hostElement,e)}},rs=class{bodyNode;driver;_normalizer;players=[];newHostElements=new Map;playersByElement=new Map;playersByQueriedElement=new Map;statesByElement=new Map;disabledNodes=new Set;totalAnimations=0;totalQueuedPlayers=0;_namespaceLookup={};_namespaceList=[];_flushFns=[];_whenQuietFns=[];namespacesByHostElement=new Map;collectedEnterElements=[];collectedLeaveElements=[];onRemovalComplete=(e,t)=>{};_onRemovalComplete(e,t){this.onRemovalComplete(e,t)}constructor(e,t,n){this.bodyNode=e,this.driver=t,this._normalizer=n}get queuedPlayers(){let e=[];return this._namespaceList.forEach(t=>{t.players.forEach(n=>{n.queued&&e.push(n)})}),e}createNamespace(e,t){let n=new is(e,t,this);return this.bodyNode&&this.driver.containsElement(this.bodyNode,t)?this._balanceNamespaceList(n,t):(this.newHostElements.set(t,n),this.collectEnterElement(t)),this._namespaceLookup[e]=n}_balanceNamespaceList(e,t){let n=this._namespaceList,r=this.namespacesByHostElement;if(n.length-1>=0){let a=!1,s=this.driver.getParentElement(t);for(;s;){let d=r.get(s);if(d){let m=n.indexOf(d);n.splice(m+1,0,e),a=!0;break}s=this.driver.getParentElement(s)}a||n.unshift(e)}else n.push(e);return r.set(t,e),e}register(e,t){let n=this._namespaceLookup[e];return n||(n=this.createNamespace(e,t)),n}registerTrigger(e,t,n){let r=this._namespaceLookup[e];r&&r.register(t,n)&&this.totalAnimations++}destroy(e,t){e&&(this.afterFlush(()=>{}),this.afterFlushAnimationsDone(()=>{let n=this._fetchNamespace(e);this.namespacesByHostElement.delete(n.hostElement);let r=this._namespaceList.indexOf(n);r>=0&&this._namespaceList.splice(r,1),n.destroy(t),delete this._namespaceLookup[e]}))}_fetchNamespace(e){return this._namespaceLookup[e]}fetchNamespacesByElement(e){let t=new Set,n=this.statesByElement.get(e);if(n){for(let r of n.values())if(r.namespaceId){let o=this._fetchNamespace(r.namespaceId);o&&t.add(o)}}return t}trigger(e,t,n,r){if(so(t)){let o=this._fetchNamespace(e);if(o)return o.trigger(t,n,r),!0}return!1}insertNode(e,t,n,r){if(!so(t))return;let o=t[Mt];if(o&&o.setForRemoval){o.setForRemoval=!1,o.setForMove=!0;let a=this.collectedLeaveElements.indexOf(t);a>=0&&this.collectedLeaveElements.splice(a,1)}if(e){let a=this._fetchNamespace(e);a&&a.insertNode(t,n)}r&&this.collectEnterElement(t)}collectEnterElement(e){this.collectedEnterElements.push(e)}markElementAsDisabled(e,t){t?this.disabledNodes.has(e)||(this.disabledNodes.add(e),vt(e,qa)):this.disabledNodes.has(e)&&(this.disabledNodes.delete(e),mi(e,qa))}removeNode(e,t,n){if(so(t)){let r=e?this._fetchNamespace(e):null;r?r.removeNode(t,n):this.markElementAsRemoved(e,t,!1,n);let o=this.namespacesByHostElement.get(t);o&&o.id!==e&&o.removeNode(t,n)}else this._onRemovalComplete(t,n)}markElementAsRemoved(e,t,n,r,o){this.collectedLeaveElements.push(t),t[Mt]={namespaceId:e,setForRemoval:r,hasAnimation:n,removedBeforeQueried:!1,previousTriggersValues:o}}listen(e,t,n,r,o){return so(t)?this._fetchNamespace(e).listen(t,n,r,o):()=>{}}_buildInstruction(e,t,n,r,o){return e.transition.build(this.driver,e.element,e.fromState.value,e.toState.value,n,r,e.fromState.options,e.toState.options,t,o)}destroyInnerAnimations(e){let t=this.driver.query(e,Gi,!0);t.forEach(n=>this.destroyActiveAnimationsForElement(n)),this.playersByQueriedElement.size!=0&&(t=this.driver.query(e,no,!0),t.forEach(n=>this.finishActiveQueriedAnimationOnElement(n)))}destroyActiveAnimationsForElement(e){let t=this.playersByElement.get(e);t&&t.forEach(n=>{n.queued?n.markedForDestroy=!0:n.destroy()})}finishActiveQueriedAnimationOnElement(e){let t=this.playersByQueriedElement.get(e);t&&t.forEach(n=>n.finish())}whenRenderingDone(){return new Promise(e=>{if(this.players.length)return on(this.players).onDone(()=>e());e()})}processLeaveNode(e){let t=e[Mt];if(t&&t.setForRemoval){if(e[Mt]=ad,t.namespaceId){this.destroyInnerAnimations(e);let n=this._fetchNamespace(t.namespaceId);n&&n.clearElementCache(e)}this._onRemovalComplete(e,t.setForRemoval)}e.classList?.contains(qa)&&this.markElementAsDisabled(e,!1),this.driver.query(e,ym,!0).forEach(n=>{this.markElementAsDisabled(n,!1)})}flush(e=-1){let t=[];if(this.newHostElements.size&&(this.newHostElements.forEach((n,r)=>this._balanceNamespaceList(n,r)),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(let n=0;n<this.collectedEnterElements.length;n++){let r=this.collectedEnterElements[n];vt(r,Cm)}if(this._namespaceList.length&&(this.totalQueuedPlayers||this.collectedLeaveElements.length)){let n=[];try{t=this._flushAnimations(n,e)}finally{for(let r=0;r<n.length;r++)n[r]()}}else for(let n=0;n<this.collectedLeaveElements.length;n++){let r=this.collectedLeaveElements[n];this.processLeaveNode(r)}if(this.totalQueuedPlayers=0,this.collectedEnterElements.length=0,this.collectedLeaveElements.length=0,this._flushFns.forEach(n=>n()),this._flushFns=[],this._whenQuietFns.length){let n=this._whenQuietFns;this._whenQuietFns=[],t.length?on(t).onDone(()=>{n.forEach(r=>r())}):n.forEach(r=>r())}}reportError(e){throw Vc(e)}_flushAnimations(e,t){let n=new Ki,r=[],o=new Map,a=[],s=new Map,d=new Map,m=new Map,_=new Set;this.disabledNodes.forEach(A=>{_.add(A);let j=this.driver.query(A,vm,!0);for(let $=0;$<j.length;$++)_.add(j[$])});let b=this.bodyNode,y=Array.from(this.statesByElement.keys()),k=ed(y,this.collectedEnterElements),E=new Map,P=0;k.forEach((A,j)=>{let $=$a+P++;E.set(j,$),A.forEach(ee=>vt(ee,$))});let K=[],pe=new Set,N=new Set;for(let A=0;A<this.collectedLeaveElements.length;A++){let j=this.collectedLeaveElements[A],$=j[Mt];$&&$.setForRemoval&&(K.push(j),pe.add(j),$.hasAnimation?this.driver.query(j,Sm,!0).forEach(ee=>pe.add(ee)):N.add(j))}let X=new Map,U=ed(y,Array.from(pe));U.forEach((A,j)=>{let $=to+P++;X.set(j,$),A.forEach(ee=>vt(ee,$))}),e.push(()=>{k.forEach((A,j)=>{let $=E.get(j);A.forEach(ee=>mi(ee,$))}),U.forEach((A,j)=>{let $=X.get(j);A.forEach(ee=>mi(ee,$))}),K.forEach(A=>{this.processLeaveNode(A)})});let Ee=[],de=[];for(let A=this._namespaceList.length-1;A>=0;A--)this._namespaceList[A].drainQueuedTransitions(t).forEach($=>{let ee=$.player,Oe=$.element;if(Ee.push(ee),this.collectedEnterElements.length){let De=Oe[Mt];if(De&&De.setForMove){if(De.previousTriggersValues&&De.previousTriggersValues.has($.triggerName)){let tt=De.previousTriggersValues.get($.triggerName),Qe=this.statesByElement.get($.element);if(Qe&&Qe.has($.triggerName)){let pn=Qe.get($.triggerName);pn.value=tt,Qe.set($.triggerName,pn)}}ee.destroy();return}}let ce=!b||!this.driver.containsElement(b,Oe),Ue=X.get(Oe),me=E.get(Oe),ue=this._buildInstruction($,n,me,Ue,ce);if(ue.errors&&ue.errors.length){de.push(ue);return}if(ce){ee.onStart(()=>bn(Oe,ue.fromStyles)),ee.onDestroy(()=>Et(Oe,ue.toStyles)),r.push(ee);return}if($.isFallbackTransition){ee.onStart(()=>bn(Oe,ue.fromStyles)),ee.onDestroy(()=>Et(Oe,ue.toStyles)),r.push(ee);return}let _e=[];ue.timelines.forEach(De=>{De.stretchStartingKeyframe=!0,this.disabledNodes.has(De.element)||_e.push(De)}),ue.timelines=_e,n.append(Oe,ue.timelines);let Tn={instruction:ue,player:ee,element:Oe};a.push(Tn),ue.queriedElements.forEach(De=>ct(s,De,[]).push(ee)),ue.preStyleProps.forEach((De,tt)=>{if(De.size){let Qe=d.get(tt);Qe||d.set(tt,Qe=new Set),De.forEach((pn,Gn)=>Qe.add(Gn))}}),ue.postStyleProps.forEach((De,tt)=>{let Qe=m.get(tt);Qe||m.set(tt,Qe=new Set),De.forEach((pn,Gn)=>Qe.add(Gn))})});if(de.length){let A=[];de.forEach(j=>{A.push(zc(j.triggerName,j.errors))}),Ee.forEach(j=>j.destroy()),this.reportError(A)}let xe=new Map,He=new Map;a.forEach(A=>{let j=A.element;n.has(j)&&(He.set(j,j),this._beforeAnimationBuild(A.player.namespaceId,A.instruction,xe))}),r.forEach(A=>{let j=A.element;this._getPreviousPlayers(j,!1,A.namespaceId,A.triggerName,null).forEach(ee=>{ct(xe,j,[]).push(ee),ee.destroy()})});let Zt=K.filter(A=>td(A,d,m)),dn=new Map;Zc(dn,this.driver,N,m,bt).forEach(A=>{td(A,d,m)&&Zt.push(A)});let St=new Map;k.forEach((A,j)=>{Zc(St,this.driver,new Set(A),d,ci)}),Zt.forEach(A=>{let j=dn.get(A),$=St.get(A);dn.set(A,new Map([...j?.entries()??[],...$?.entries()??[]]))});let wn=[],qn=[],br={};a.forEach(A=>{let{element:j,player:$,instruction:ee}=A;if(n.has(j)){if(_.has(j)){$.onDestroy(()=>Et(j,ee.toStyles)),$.disabled=!0,$.overrideTotalTime(ee.totalTime),r.push($);return}let Oe=br;if(He.size>1){let Ue=j,me=[];for(;Ue=Ue.parentNode;){let ue=He.get(Ue);if(ue){Oe=ue;break}me.push(Ue)}me.forEach(ue=>He.set(ue,Oe))}let ce=this._buildAnimation($.namespaceId,ee,xe,o,St,dn);if($.setRealPlayer(ce),Oe===br)wn.push($);else{let Ue=this.playersByElement.get(Oe);Ue&&Ue.length&&($.parentPlayer=on(Ue)),r.push($)}}else bn(j,ee.fromStyles),$.onDestroy(()=>Et(j,ee.toStyles)),qn.push($),_.has(j)&&r.push($)}),qn.forEach(A=>{let j=o.get(A.element);if(j&&j.length){let $=on(j);A.setRealPlayer($)}}),r.forEach(A=>{A.parentPlayer?A.syncPlayerEvents(A.parentPlayer):A.destroy()});for(let A=0;A<K.length;A++){let j=K[A],$=j[Mt];if(mi(j,to),$&&$.hasAnimation)continue;let ee=[];if(s.size){let ce=s.get(j);ce&&ce.length&&ee.push(...ce);let Ue=this.driver.query(j,no,!0);for(let me=0;me<Ue.length;me++){let ue=s.get(Ue[me]);ue&&ue.length&&ee.push(...ue)}}let Oe=ee.filter(ce=>!ce.destroyed);Oe.length?km(this,j,Oe):this.processLeaveNode(j)}return K.length=0,wn.forEach(A=>{this.players.push(A),A.onDone(()=>{A.destroy();let j=this.players.indexOf(A);this.players.splice(j,1)}),A.play()}),wn}afterFlush(e){this._flushFns.push(e)}afterFlushAnimationsDone(e){this._whenQuietFns.push(e)}_getPreviousPlayers(e,t,n,r,o){let a=[];if(t){let s=this.playersByQueriedElement.get(e);s&&(a=s)}else{let s=this.playersByElement.get(e);if(s){let d=!o||o==Qi;s.forEach(m=>{m.queued||!d&&m.triggerName!=r||a.push(m)})}}return(n||r)&&(a=a.filter(s=>!(n&&n!=s.namespaceId||r&&r!=s.triggerName))),a}_beforeAnimationBuild(e,t,n){let r=t.triggerName,o=t.element,a=t.isRemovalTransition?void 0:e,s=t.isRemovalTransition?void 0:r;for(let d of t.timelines){let m=d.element,_=m!==o,b=ct(n,m,[]);this._getPreviousPlayers(m,_,a,s,t.toState).forEach(k=>{let E=k.getRealPlayer();E.beforeDestroy&&E.beforeDestroy(),k.destroy(),b.push(k)})}bn(o,t.fromStyles)}_buildAnimation(e,t,n,r,o,a){let s=t.triggerName,d=t.element,m=[],_=new Set,b=new Set,y=t.timelines.map(E=>{let P=E.element;_.add(P);let K=P[Mt];if(K&&K.removedBeforeQueried)return new Bt(E.duration,E.delay);let pe=P!==d,N=Pm((n.get(P)||xm).map(xe=>xe.getRealPlayer())).filter(xe=>{let He=xe;return He.element?He.element===P:!1}),X=o.get(P),U=a.get(P),Ee=Fa(this._normalizer,E.keyframes,X,U),de=this._buildPlayer(E,Ee,N);if(E.subTimeline&&r&&b.add(P),pe){let xe=new Ji(e,s,P);xe.setRealPlayer(de),m.push(xe)}return de});m.forEach(E=>{ct(this.playersByQueriedElement,E.element,[]).push(E),E.onDone(()=>Tm(this.playersByQueriedElement,E.element,E))}),_.forEach(E=>vt(E,Ba));let k=on(y);return k.onDestroy(()=>{_.forEach(E=>mi(E,Ba)),Et(d,t.toStyles)}),b.forEach(E=>{ct(r,E,[]).push(k)}),k}_buildPlayer(e,t,n){return t.length>0?this.driver.animate(e.element,t,e.duration,e.delay,e.easing,n):new Bt(e.duration,e.delay)}},Ji=class{namespaceId;triggerName;element;_player=new Bt;_containsRealPlayer=!1;_queuedCallbacks=new Map;destroyed=!1;parentPlayer=null;markedForDestroy=!1;disabled=!1;queued=!0;totalTime=0;constructor(e,t,n){this.namespaceId=e,this.triggerName=t,this.element=n}setRealPlayer(e){this._containsRealPlayer||(this._player=e,this._queuedCallbacks.forEach((t,n)=>{t.forEach(r=>Jr(e,n,void 0,r))}),this._queuedCallbacks.clear(),this._containsRealPlayer=!0,this.overrideTotalTime(e.totalTime),this.queued=!1)}getRealPlayer(){return this._player}overrideTotalTime(e){this.totalTime=e}syncPlayerEvents(e){let t=this._player;t.triggerCallback&&e.onStart(()=>t.triggerCallback("start")),e.onDone(()=>this.finish()),e.onDestroy(()=>this.destroy())}_queueEvent(e,t){ct(this._queuedCallbacks,e,[]).push(t)}onDone(e){this.queued&&this._queueEvent("done",e),this._player.onDone(e)}onStart(e){this.queued&&this._queueEvent("start",e),this._player.onStart(e)}onDestroy(e){this.queued&&this._queueEvent("destroy",e),this._player.onDestroy(e)}init(){this._player.init()}hasStarted(){return this.queued?!1:this._player.hasStarted()}play(){!this.queued&&this._player.play()}pause(){!this.queued&&this._player.pause()}restart(){!this.queued&&this._player.restart()}finish(){this._player.finish()}destroy(){this.destroyed=!0,this._player.destroy()}reset(){!this.queued&&this._player.reset()}setPosition(e){this.queued||this._player.setPosition(e)}getPosition(){return this.queued?0:this._player.getPosition()}triggerCallback(e){let t=this._player;t.triggerCallback&&t.triggerCallback(e)}};function Tm(i,e,t){let n=i.get(e);if(n){if(n.length){let r=n.indexOf(t);n.splice(r,1)}n.length==0&&i.delete(e)}return n}function Em(i){return i??null}function so(i){return i&&i.nodeType===1}function Mm(i){return i=="start"||i=="done"}function Jc(i,e){let t=i.style.display;return i.style.display=e??"none",t}function Zc(i,e,t,n,r){let o=[];t.forEach(d=>o.push(Jc(d)));let a=[];n.forEach((d,m)=>{let _=new Map;d.forEach(b=>{let y=e.computeStyle(m,b,r);_.set(b,y),(!y||y.length==0)&&(m[Mt]=wm,a.push(m))}),i.set(m,_)});let s=0;return t.forEach(d=>Jc(d,o[s++])),a}function ed(i,e){let t=new Map;if(i.forEach(s=>t.set(s,[])),e.length==0)return t;let n=1,r=new Set(e),o=new Map;function a(s){if(!s)return n;let d=o.get(s);if(d)return d;let m=s.parentNode;return t.has(m)?d=m:r.has(m)?d=n:d=a(m),o.set(s,d),d}return e.forEach(s=>{let d=a(s);d!==n&&t.get(d).push(s)}),t}function vt(i,e){i.classList?.add(e)}function mi(i,e){i.classList?.remove(e)}function km(i,e,t){on(t).onDone(()=>i.processLeaveNode(e))}function Pm(i){let e=[];return sd(i,e),e}function sd(i,e){for(let t=0;t<i.length;t++){let n=i[t];n instanceof Rn?sd(n.players,e):e.push(n)}}function Om(i,e){let t=Object.keys(i),n=Object.keys(e);if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++){let o=t[r];if(!e.hasOwnProperty(o)||i[o]!==e[o])return!1}return!0}function td(i,e,t){let n=t.get(i);if(!n)return!1;let r=e.get(i);return r?n.forEach(o=>r.add(o)):e.set(i,n),t.delete(i),!0}var ui=class{_driver;_normalizer;_transitionEngine;_timelineEngine;_triggerCache={};onRemovalComplete=(e,t)=>{};constructor(e,t,n){this._driver=t,this._normalizer=n,this._transitionEngine=new rs(e.body,t,n),this._timelineEngine=new ns(e.body,t,n),this._transitionEngine.onRemovalComplete=(r,o)=>this.onRemovalComplete(r,o)}registerTrigger(e,t,n,r,o){let a=e+"-"+r,s=this._triggerCache[a];if(!s){let d=[],m=[],_=id(this._driver,o,d,m);if(d.length)throw Oc(r,d);s=fm(r,_,this._normalizer),this._triggerCache[a]=s}this._transitionEngine.registerTrigger(t,r,s)}register(e,t){this._transitionEngine.register(e,t)}destroy(e,t){this._transitionEngine.destroy(e,t)}onInsert(e,t,n,r){this._transitionEngine.insertNode(e,t,n,r)}onRemove(e,t,n){this._transitionEngine.removeNode(e,t,n)}disableAnimations(e,t){this._transitionEngine.markElementAsDisabled(e,t)}process(e,t,n,r){if(n.charAt(0)=="@"){let[o,a]=La(n),s=r;this._timelineEngine.command(o,t,a,s)}else this._transitionEngine.trigger(e,t,n,r)}listen(e,t,n,r,o){if(n.charAt(0)=="@"){let[a,s]=La(n);return this._timelineEngine.listen(a,t,s,o)}return this._transitionEngine.listen(e,t,n,r,o)}flush(e=-1){this._transitionEngine.flush(e)}get players(){return[...this._transitionEngine.players,...this._timelineEngine.players]}whenRenderingDone(){return this._transitionEngine.whenRenderingDone()}afterFlushAnimationsDone(e){this._transitionEngine.afterFlushAnimationsDone(e)}};function Am(i,e){let t=null,n=null;return Array.isArray(e)&&e.length?(t=Ya(e[0]),e.length>1&&(n=Ya(e[e.length-1]))):e instanceof Map&&(t=Ya(e)),t||n?new Im(i,t,n):null}var Im=(()=>{class i{_element;_startStyles;_endStyles;static initialStylesByElement=new WeakMap;_state=0;_initialStyles;constructor(t,n,r){this._element=t,this._startStyles=n,this._endStyles=r;let o=i.initialStylesByElement.get(t);o||i.initialStylesByElement.set(t,o=new Map),this._initialStyles=o}start(){this._state<1&&(this._startStyles&&Et(this._element,this._startStyles,this._initialStyles),this._state=1)}finish(){this.start(),this._state<2&&(Et(this._element,this._initialStyles),this._endStyles&&(Et(this._element,this._endStyles),this._endStyles=null),this._state=1)}destroy(){this.finish(),this._state<3&&(i.initialStylesByElement.delete(this._element),this._startStyles&&(bn(this._element,this._startStyles),this._endStyles=null),this._endStyles&&(bn(this._element,this._endStyles),this._endStyles=null),Et(this._element,this._initialStyles),this._state=3)}}return i})();function Ya(i){let e=null;return i.forEach((t,n)=>{Dm(n)&&(e=e||new Map,e.set(n,t))}),e}function Dm(i){return i==="display"||i==="position"}var go=class{element;keyframes;options;_specialStyles;_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_duration;_delay;_initialized=!1;_finished=!1;_started=!1;_destroyed=!1;_finalKeyframe;_originalOnDoneFns=[];_originalOnStartFns=[];domPlayer=null;time=0;parentPlayer=null;currentSnapshot=new Map;constructor(e,t,n,r){this.element=e,this.keyframes=t,this.options=n,this._specialStyles=r,this._duration=n.duration,this._delay=n.delay||0,this.time=this._duration+this._delay}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}init(){this._buildPlayer()&&this._preparePlayerBeforeStart()}_buildPlayer(){if(this._initialized)return this.domPlayer;this._initialized=!0;let e=this.keyframes,t=this._triggerWebAnimation(this.element,e,this.options);if(!t)return this._onFinish(),null;this.domPlayer=t,this._finalKeyframe=e.length?e[e.length-1]:new Map;let n=()=>this._onFinish();return t.addEventListener("finish",n),this.onDestroy(()=>{t.removeEventListener("finish",n)}),t}_preparePlayerBeforeStart(){this._delay?this._resetDomPlayerState():this.domPlayer?.pause()}_convertKeyframesToObject(e){let t=[];return e.forEach(n=>{t.push(Object.fromEntries(n))}),t}_triggerWebAnimation(e,t,n){let r=this._convertKeyframesToObject(t);try{return e.animate(r,n)}catch(o){return null}}onStart(e){this._originalOnStartFns.push(e),this._onStartFns.push(e)}onDone(e){this._originalOnDoneFns.push(e),this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}play(){let e=this._buildPlayer();e&&(this.hasStarted()||(this._onStartFns.forEach(t=>t()),this._onStartFns=[],this._started=!0,this._specialStyles&&this._specialStyles.start()),e.play())}pause(){this.init(),this.domPlayer?.pause()}finish(){this.init(),this.domPlayer&&(this._specialStyles&&this._specialStyles.finish(),this._onFinish(),this.domPlayer.finish())}reset(){this._resetDomPlayerState(),this._destroyed=!1,this._finished=!1,this._started=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}_resetDomPlayerState(){this.domPlayer?.cancel()}restart(){this.reset(),this.play()}hasStarted(){return this._started}destroy(){this._destroyed||(this._destroyed=!0,this._resetDomPlayerState(),this._onFinish(),this._specialStyles&&this._specialStyles.destroy(),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}setPosition(e){this.domPlayer||this.init(),this.domPlayer&&(this.domPlayer.currentTime=e*this.time)}getPosition(){return this.domPlayer?+(this.domPlayer.currentTime??0)/this.time:this._initialized?1:0}get totalTime(){return this._delay+this._duration}beforeDestroy(){let e=new Map;this.hasStarted()&&this._finalKeyframe.forEach((n,r)=>{r!=="offset"&&e.set(r,this._finished?n:ro(this.element,r))}),this.currentSnapshot=e}triggerCallback(e){let t=e==="start"?this._onStartFns:this._onDoneFns;t.forEach(n=>n()),t.length=0}},fo=class{validateStyleProperty(e){return!0}validateAnimatableStyleProperty(e){return!0}containsElement(e,t){return ja(e,t)}getParentElement(e){return eo(e)}query(e,t,n){return Va(e,t,n)}computeStyle(e,t,n){return ro(e,t)}animate(e,t,n,r,o,a=[]){let s=r==0?"both":"forwards",d={duration:n,delay:r,fill:s};o&&(d.easing=o);let m=new Map,_=a.filter(k=>k instanceof go);Uc(n,r)&&_.forEach(k=>{k.currentSnapshot.forEach((E,P)=>m.set(P,E))});let b=Bc(t).map(k=>new Map(k));b=Wc(e,b,m);let y=Am(e,b);return new go(e,b,d,y)}};var lo="@",ld="@.disabled",_o=class{namespaceId;delegate;engine;_onDestroy;\u0275type=0;constructor(e,t,n,r){this.namespaceId=e,this.delegate=t,this.engine=n,this._onDestroy=r}get data(){return this.delegate.data}destroyNode(e){this.delegate.destroyNode?.(e)}destroy(){this.engine.destroy(this.namespaceId,this.delegate),this.engine.afterFlushAnimationsDone(()=>{queueMicrotask(()=>{this.delegate.destroy()})}),this._onDestroy?.()}createElement(e,t){return this.delegate.createElement(e,t)}createComment(e){return this.delegate.createComment(e)}createText(e){return this.delegate.createText(e)}appendChild(e,t){this.delegate.appendChild(e,t),this.engine.onInsert(this.namespaceId,t,e,!1)}insertBefore(e,t,n,r=!0){this.delegate.insertBefore(e,t,n),this.engine.onInsert(this.namespaceId,t,e,r)}removeChild(e,t,n,r){if(r){this.delegate.removeChild(e,t,n,r);return}this.parentNode(t)&&this.engine.onRemove(this.namespaceId,t,this.delegate)}selectRootElement(e,t){return this.delegate.selectRootElement(e,t)}parentNode(e){return this.delegate.parentNode(e)}nextSibling(e){return this.delegate.nextSibling(e)}setAttribute(e,t,n,r){this.delegate.setAttribute(e,t,n,r)}removeAttribute(e,t,n){this.delegate.removeAttribute(e,t,n)}addClass(e,t){this.delegate.addClass(e,t)}removeClass(e,t){this.delegate.removeClass(e,t)}setStyle(e,t,n,r){this.delegate.setStyle(e,t,n,r)}removeStyle(e,t,n){this.delegate.removeStyle(e,t,n)}setProperty(e,t,n){t.charAt(0)==lo&&t==ld?this.disableAnimations(e,!!n):this.delegate.setProperty(e,t,n)}setValue(e,t){this.delegate.setValue(e,t)}listen(e,t,n,r){return this.delegate.listen(e,t,n,r)}disableAnimations(e,t){this.engine.disableAnimations(e,t)}},os=class extends _o{factory;constructor(e,t,n,r,o){super(t,n,r,o),this.factory=e,this.namespaceId=t}setProperty(e,t,n){t.charAt(0)==lo?t.charAt(1)=="."&&t==ld?(n=n===void 0?!0:!!n,this.disableAnimations(e,n)):this.engine.process(this.namespaceId,e,t.slice(1),n):this.delegate.setProperty(e,t,n)}listen(e,t,n,r){if(t.charAt(0)==lo){let o=Rm(e),a=t.slice(1),s="";return a.charAt(0)!=lo&&([a,s]=Nm(a)),this.engine.listen(this.namespaceId,o,a,s,d=>{let m=d._data||-1;this.factory.scheduleListenerCallback(m,n,d)})}return this.delegate.listen(e,t,n,r)}};function Rm(i){switch(i){case"body":return document.body;case"document":return document;case"window":return window;default:return i}}function Nm(i){let e=i.indexOf("."),t=i.substring(0,e),n=i.slice(e+1);return[t,n]}var bo=class{delegate;engine;_zone;_currentId=0;_microtaskId=1;_animationCallbacksBuffer=[];_rendererCache=new Map;_cdRecurDepth=0;constructor(e,t,n){this.delegate=e,this.engine=t,this._zone=n,t.onRemovalComplete=(r,o)=>{o?.removeChild(null,r)}}createRenderer(e,t){let r=this.delegate.createRenderer(e,t);if(!e||!t?.data?.animation){let m=this._rendererCache,_=m.get(r);if(!_){let b=()=>m.delete(r);_=new _o("",r,this.engine,b),m.set(r,_)}return _}let o=t.id,a=t.id+"-"+this._currentId;this._currentId++,this.engine.register(a,e);let s=m=>{Array.isArray(m)?m.forEach(s):this.engine.registerTrigger(o,a,e,m.name,m)};return t.data.animation.forEach(s),new os(this,a,r,this.engine)}begin(){this._cdRecurDepth++,this.delegate.begin&&this.delegate.begin()}_scheduleCountTask(){queueMicrotask(()=>{this._microtaskId++})}scheduleListenerCallback(e,t,n){if(e>=0&&e<this._microtaskId){this._zone.run(()=>t(n));return}let r=this._animationCallbacksBuffer;r.length==0&&queueMicrotask(()=>{this._zone.run(()=>{r.forEach(o=>{let[a,s]=o;a(s)}),this._animationCallbacksBuffer=[]})}),r.push([t,n])}end(){this._cdRecurDepth--,this._cdRecurDepth==0&&this._zone.runOutsideAngular(()=>{this._scheduleCountTask(),this.engine.flush(this._microtaskId)}),this.delegate.end&&this.delegate.end()}whenRenderingDone(){return this.engine.whenRenderingDone()}componentReplaced(e){this.engine.flush(),this.delegate.componentReplaced?.(e)}};var Lm=(()=>{class i extends ui{constructor(t,n,r){super(t,n,r)}ngOnDestroy(){this.flush()}static \u0275fac=function(n){return new(n||i)(Mr(ii),Mr(Ln),Mr(jn))};static \u0275prov=H({token:i,factory:i.\u0275fac})}return i})();function jm(){return new co}function Vm(){return new bo(f(wl),f(ui),f(Lt))}var cd=[{provide:jn,useFactory:jm},{provide:ui,useClass:Lm},{provide:fl,useFactory:Vm}],h_=[{provide:Ln,useClass:as},{provide:Sa,useValue:"NoopAnimations"},...cd],zm=[{provide:Ln,useFactory:()=>new fo},{provide:Sa,useFactory:()=>"BrowserAnimations"},...cd];function dd(){return gl("NgEagerAnimations"),[...zm]}function $m(i,e){if(i&1){let t=O();l(0,"mat-checkbox",6),ie("ngModelChange",function(r){x(t);let o=h();return ne(o.checkboxChecked,r)||(o.checkboxChecked=r),w(r)}),u(1),c()}if(i&2){let t=h();te("ngModel",t.checkboxChecked),p(),L(t.data.checkboxLabel)}}var vo=class i{dialogRef=f(Hr);data=f(Ur);checkboxChecked=!1;cancel(){this.dialogRef.close({confirmed:!1})}confirm(){this.dialogRef.close({confirmed:!0,checkboxChecked:this.checkboxChecked})}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-confirm-dialog"]],decls:10,vars:6,consts:[["mat-dialog-title",""],[1,"confirm-dialog__message"],[1,"confirm-dialog__checkbox",3,"ngModel"],["align","end"],["mat-button","",3,"click"],["mat-flat-button","",3,"click","color"],[1,"confirm-dialog__checkbox",3,"ngModelChange","ngModel"]],template:function(t,n){t&1&&(l(0,"h2",0),u(1),c(),l(2,"p",1),u(3),c(),C(4,$m,2,2,"mat-checkbox",2),l(5,"mat-dialog-actions",3)(6,"button",4),v("click",function(){return n.cancel()}),u(7),c(),l(8,"button",5),v("click",function(){return n.confirm()}),u(9),c()()),t&2&&(p(),L(n.data.title),p(2),L(n.data.message),p(),S(n.data.checkboxLabel?4:-1),p(3),L(n.data.cancelLabel??"Cancel"),p(),T("color",n.data.isDestructive?"warn":"primary"),p(),Ne(" ",n.data.confirmLabel??"Confirm"," "))},dependencies:[qr,Gr,Ge,si,lc,sc,lt,at,st],styles:[".confirm-dialog__message[_ngcontent-%COMP%]{margin:0 24px 8px;color:var(--color-text-secondary, #6e6e73);font-size:.875rem;line-height:1.5}.confirm-dialog__checkbox[_ngcontent-%COMP%]{display:block;margin:0 24px 8px;font-size:.875rem}"]})};var gi=class i{snackBar=f(Hl);success(e,t=2e3){this.snackBar.open(e,"",{duration:t,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-success"]})}error(e,t=3e3){this.snackBar.open(e,"",{duration:t,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-error"]})}info(e,t=2e3){this.snackBar.open(e,"",{duration:t,horizontalPosition:"center",verticalPosition:"bottom",panelClass:["snackbar-info"]})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var Bm=()=>[];function Hm(i,e){if(i&1){let t=O();l(0,"div",3)(1,"ds-entity-card",4),v("selected",function(r){x(t);let o=h();return w(o.onItemSelected(r))}),c(),l(2,"button",5),v("click",function(r){let o=x(t).$implicit,a=h();return r.stopPropagation(),w(a.onDeleteRequested(o.id))}),l(3,"mat-icon"),u(4,"close"),c()()()}if(i&2){let t=e.$implicit;p(),T("id",t.id)("name",t.name)("description",t.description)("badges",t.badges??Or(4,Bm))}}var Zi="__",yo=class i{router=f(zt);projectStateService=f(ye);dialog=f(Wr);destroyRef=f(ri);notification=f(gi);projects=Ie(this.projectStateService.projectList$);forcedProject=Ie(this.projectStateService.forcedProject$,{initialValue:null});projectItems=Tt(()=>{let e=this.projects();if(!e)return[];let t=e.filter(y=>!y.name.includes(Zi)),n=e.filter(y=>y.name.includes(Zi)),r=new Set(t.map(y=>y.name)),o=y=>y.split(Zi)[0]??null,a=new Set(n.map(y=>o(y.name)).filter(y=>y!==null&&r.has(y))),s=[],d=[...a].sort((y,k)=>y.localeCompare(k));for(let y of d){let k=t.find(P=>P.name===y);s.push(he(G({},this.toEntityListItem(k)),{groupKey:y,groupLabel:y}));let E=n.filter(P=>o(P.name)===y).sort((P,K)=>P.name.localeCompare(K.name));for(let P of E){let K=P.name.slice(y.length+Zi.length);s.push(he(G({},this.toEntityListItem(P)),{name:K,description:P.name,groupKey:y,groupLabel:y}))}}let m=[...t].filter(y=>!a.has(y.name)&&!y.volatile).sort((y,k)=>y.name.localeCompare(k.name));for(let y of m)s.push(he(G({},this.toEntityListItem(y)),{groupKey:"__standalone__",groupLabel:"Projects"}));let _=[...t].filter(y=>!a.has(y.name)&&y.volatile).sort((y,k)=>y.name.localeCompare(k.name));for(let y of _)s.push(he(G({},this.toEntityListItem(y)),{groupKey:"__volatile__",groupLabel:"Temporary"}));let b=n.filter(y=>{let k=o(y.name);return k!==null&&!r.has(k)}).sort((y,k)=>y.name.localeCompare(k.name));for(let y of b)s.push(he(G({},this.toEntityListItem(y)),{groupKey:"__orphaned__",groupLabel:"Orphaned worktrees"}));return s});showCreateButton=Tt(()=>!this.forcedProject());constructor(){this.projectStateService.selectedProject$.pipe(ot(),ve(e=>!!e),ve(()=>this.router.url.split("?")[0]==="/"),ti(1)).subscribe(e=>{this.router.navigate(["project",e.name])})}onItemSelected(e){this.projectStateService.selectProject(e),this.router.navigate(["project",e])}onCreateRequested(){this.router.navigate(["project","new"])}onDeleteRequested(e){let t=e.includes(Zi);this.dialog.open(vo,{width:"400px",panelClass:"confirm-dialog-panel",data:G({title:"Delete project",message:`This will remove the project "${e}" from Coday and archive its configuration. The project source code on disk is not affected.`,confirmLabel:"Delete",cancelLabel:"Cancel",isDestructive:!0},t?{checkboxLabel:"Also remove git worktree from disk"}:{})}).afterClosed().pipe(ve(r=>r?.confirmed===!0),ot(this.destroyRef)).subscribe(r=>{this.notification.info("Deleting project\u2026"),this.projectStateService.deleteProject(e,r.checkboxChecked).pipe(ot(this.destroyRef)).subscribe({next:()=>{this.notification.success(`Project "${e}" deleted`),this.router.url.includes(`/project/${encodeURIComponent(e)}`)&&this.router.navigate(["/"])},error:o=>{console.error("[PROJECT-LIST] Failed to delete project:",o),this.notification.error(o?.error?.error??"Failed to delete project")}})})}toEntityListItem(e){return{id:e.name,name:e.name,badges:e.volatile?[{label:"temp",variant:"warning"}]:[]}}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-project-selection"]],decls:4,vars:4,consts:[["projectCard",""],["title","Projects","contentMaxWidth","1400px","searchPlaceholder","Filter projects\u2026","emptyMessage","No projects found.",3,"itemSelected","createRequested","items","itemTemplate","showCreate","autoFocusSearch"],["toolbar-start","","src","CODAY-Logo.png","alt","Coday",1,"project-list__logo"],[1,"project-card-wrapper"],[3,"selected","id","name","description","badges"],["mat-icon-button","","title","Delete project",1,"project-card-wrapper__delete",3,"click"]],template:function(t,n){if(t&1&&(l(0,"ds-entity-list",1),v("itemSelected",function(o){return n.onItemSelected(o)})("createRequested",function(){return n.onCreateRequested()}),F(1,"img",2),c(),un(2,Hm,5,5,"ng-template",null,0,ai)),t&2){let r=In(3);T("items",n.projectItems())("itemTemplate",r)("showCreate",n.showCreateButton())("autoFocusSearch",!0)}},dependencies:[ac,ic,ke,se,ze],styles:[".project-list__logo[_ngcontent-%COMP%]{height:28px;width:auto}.project-card-wrapper[_ngcontent-%COMP%]{position:relative}.project-card-wrapper__delete[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;width:28px;height:28px;line-height:28px;padding:0;opacity:0;transition:opacity .15s ease;color:var(--color-text-secondary, #6e6e73)}.project-card-wrapper__delete[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px}.project-card-wrapper__delete[_ngcontent-%COMP%]:hover{color:var(--color-error, #ff3b30)}.project-card-wrapper[_ngcontent-%COMP%]:hover .project-card-wrapper__delete[_ngcontent-%COMP%]{opacity:1}"]})};var Pe=class i{STORAGE_KEY="coday-preferences";isDesktopApp=!1;electronStorage=null;voiceLanguageSubject=new W("en-US");voiceLanguage$=this.voiceLanguageSubject.asObservable();enterToSendSubject=new W(!0);enterToSend$=this.enterToSendSubject.asObservable();voiceAnnounceEnabledSubject=new W(!1);voiceAnnounceEnabled$=this.voiceAnnounceEnabledSubject.asObservable();voiceModeSubject=new W("speech");voiceMode$=this.voiceModeSubject.asObservable();voiceReadFullTextSubject=new W(!1);voiceReadFullText$=this.voiceReadFullTextSubject.asObservable();voiceVolumeSubject=new W(.8);voiceVolume$=this.voiceVolumeSubject.asObservable();voiceRateSubject=new W(1.2);voiceRate$=this.voiceRateSubject.asObservable();selectedVoiceSubject=new W(null);selectedVoice$=this.selectedVoiceSubject.asObservable();printTechnicalMessagesSubject=new W(!1);printTechnicalMessages$=this.printTechnicalMessagesSubject.asObservable();hideTechnicalMessagesSubject=new W(!0);hideTechnicalMessages$=this.hideTechnicalMessagesSubject.asObservable();hideWarningMessagesSubject=new W(!1);hideWarningMessages$=this.hideWarningMessagesSubject.asObservable();agentNotificationEnabledSubject=new W(!1);agentNotificationEnabled$=this.agentNotificationEnabledSubject.asObservable();notificationSoundEnabledSubject=new W(!1);notificationSoundEnabled$=this.notificationSoundEnabledSubject.asObservable();browserNotificationEnabledSubject=new W(!1);browserNotificationEnabled$=this.browserNotificationEnabledSubject.asObservable();themeSubject=new W("light");theme$=this.themeSubject.asObservable();constructor(){console.log("[PREFERENCES] Initializing preferences service"),typeof window<"u"&&window.codayDesktop?.storage&&(this.isDesktopApp=!0,this.electronStorage=window.codayDesktop.storage,console.log("[PREFERENCES] Running in desktop app mode with persistent storage")),this.initializePreferences()}initializePreferences(){this.isDesktopApp?this.loadPreferencesAsync():this.loadPreferencesSync()}loadPreferencesSync(){let e=this.getPreferenceSync("voiceLanguage","en-US")??"en-US";this.voiceLanguageSubject.next(e),console.log("[PREFERENCES] Voice language initialized to:",e);let t=this.getPreferenceSync("useEnterToSend",!0)??!0;this.enterToSendSubject.next(t),console.log("[PREFERENCES] Enter to send initialized to:",t);let n=this.getPreferenceSync("voiceAnnounceEnabled",!1)??!1;this.voiceAnnounceEnabledSubject.next(n);let r=this.getPreferenceSync("voiceMode","speech")??"speech";this.voiceModeSubject.next(r);let o=this.getPreferenceSync("voiceReadFullText",!1)??!1;this.voiceReadFullTextSubject.next(o);let a=this.getPreferenceSync("voiceVolume",.8)??.8;this.voiceVolumeSubject.next(a);let s=this.getPreferenceSync("voiceRate",1.2)??1.2;this.voiceRateSubject.next(s);let d=this.getPreferenceSync("selectedVoice",null)??null;this.selectedVoiceSubject.next(d);let m=this.getPreferenceSync("printTechnicalMessages",!1)??!1;this.printTechnicalMessagesSubject.next(m);let _=this.getPreferenceSync("hideTechnicalMessages",!0)??!0;this.hideTechnicalMessagesSubject.next(_);let b=this.getPreferenceSync("hideWarningMessages",!1)??!1;this.hideWarningMessagesSubject.next(b);let y=this.getPreferenceSync("agentNotificationEnabled",!1)??!1;this.agentNotificationEnabledSubject.next(y);let k=this.getPreferenceSync("notificationSoundEnabled",!0)??!0;this.notificationSoundEnabledSubject.next(k);let E=this.getPreferenceSync("browserNotificationEnabled",!1)??!1;this.browserNotificationEnabledSubject.next(E);let P=this.getPreferenceSync("theme","light")??"light";this.themeSubject.next(P),console.log("[PREFERENCES] All preferences initialized successfully")}loadPreferencesAsync(){return B(this,null,function*(){let e=(yield this.getPreferenceAsync("voiceLanguage","en-US"))??"en-US";this.voiceLanguageSubject.next(e),console.log("[PREFERENCES] Voice language initialized to:",e);let t=(yield this.getPreferenceAsync("useEnterToSend",!0))??!0;this.enterToSendSubject.next(t),console.log("[PREFERENCES] Enter to send initialized to:",t);let n=(yield this.getPreferenceAsync("voiceAnnounceEnabled",!1))??!1;this.voiceAnnounceEnabledSubject.next(n);let r=(yield this.getPreferenceAsync("voiceMode","speech"))??"speech";this.voiceModeSubject.next(r);let o=(yield this.getPreferenceAsync("voiceReadFullText",!1))??!1;this.voiceReadFullTextSubject.next(o);let a=(yield this.getPreferenceAsync("voiceVolume",.8))??.8;this.voiceVolumeSubject.next(a);let s=(yield this.getPreferenceAsync("voiceRate",1.2))??1.2;this.voiceRateSubject.next(s);let d=(yield this.getPreferenceAsync("selectedVoice",null))??null;this.selectedVoiceSubject.next(d);let m=(yield this.getPreferenceAsync("printTechnicalMessages",!1))??!1;this.printTechnicalMessagesSubject.next(m);let _=(yield this.getPreferenceAsync("hideTechnicalMessages",!0))??!0;this.hideTechnicalMessagesSubject.next(_);let b=(yield this.getPreferenceAsync("hideWarningMessages",!1))??!1;this.hideWarningMessagesSubject.next(b);let y=(yield this.getPreferenceAsync("agentNotificationEnabled",!1))??!1;this.agentNotificationEnabledSubject.next(y);let k=(yield this.getPreferenceAsync("notificationSoundEnabled",!0))??!0;this.notificationSoundEnabledSubject.next(k);let E=(yield this.getPreferenceAsync("browserNotificationEnabled",!1))??!1;this.browserNotificationEnabledSubject.next(E);let P=(yield this.getPreferenceAsync("theme","light"))??"light";this.themeSubject.next(P),console.log("[PREFERENCES] All preferences initialized successfully (async)")})}getPreference(e,t){return this.getPreferenceSync(e,t)}getPreferenceSync(e,t){try{let n=localStorage.getItem(this.STORAGE_KEY);if(!n)return t;let r=JSON.parse(n);return r[e]!==void 0?r[e]:t}catch(n){return t}}getPreferenceAsync(e,t){return B(this,null,function*(){if(!this.electronStorage)return this.getPreferenceSync(e,t);try{let n=yield this.electronStorage.get(this.STORAGE_KEY);if(!n)return t;let r=JSON.parse(n);return r[e]!==void 0?r[e]:t}catch(n){return t}})}setPreference(e,t){this.isDesktopApp?this.setPreferenceAsync(e,t):this.setPreferenceSync(e,t)}setPreferenceSync(e,t){try{let n=localStorage.getItem(this.STORAGE_KEY),r=n?JSON.parse(n):{};r[e]=t,localStorage.setItem(this.STORAGE_KEY,JSON.stringify(r)),this.updateSubject(e,t)}catch(n){console.error("Failed to set preference:",n)}}setPreferenceAsync(e,t){return B(this,null,function*(){if(!this.electronStorage){this.setPreferenceSync(e,t);return}try{let n=yield this.electronStorage.get(this.STORAGE_KEY),r=n?JSON.parse(n):{};r[e]=t,yield this.electronStorage.set(this.STORAGE_KEY,JSON.stringify(r)),this.updateSubject(e,t)}catch(n){console.error("Failed to set preference:",n)}})}updateSubject(e,t){e==="voiceLanguage"&&this.voiceLanguageSubject.next(t),e==="useEnterToSend"&&this.enterToSendSubject.next(t),e==="voiceAnnounceEnabled"&&this.voiceAnnounceEnabledSubject.next(t),e==="voiceMode"&&this.voiceModeSubject.next(t),e==="voiceReadFullText"&&this.voiceReadFullTextSubject.next(t),e==="voiceVolume"&&this.voiceVolumeSubject.next(t),e==="voiceRate"&&this.voiceRateSubject.next(t),e==="selectedVoice"&&this.selectedVoiceSubject.next(t),e==="printTechnicalMessages"&&this.printTechnicalMessagesSubject.next(t),e==="hideTechnicalMessages"&&this.hideTechnicalMessagesSubject.next(t),e==="hideWarningMessages"&&this.hideWarningMessagesSubject.next(t),e==="agentNotificationEnabled"&&this.agentNotificationEnabledSubject.next(t),e==="notificationSoundEnabled"&&this.notificationSoundEnabledSubject.next(t),e==="browserNotificationEnabled"&&this.browserNotificationEnabledSubject.next(t),e==="theme"&&this.themeSubject.next(t)}setVoiceLanguage(e){console.log("[PREFERENCES] Setting voice language to:",e),this.setPreference("voiceLanguage",e)}getVoiceLanguage(){return this.getPreference("voiceLanguage","en-US")??"en-US"}setEnterToSend(e){console.log("[PREFERENCES] Setting Enter to send to:",e),this.setPreference("useEnterToSend",e)}getEnterToSend(){return this.getPreference("useEnterToSend",!1)??!1}setVoiceAnnounceEnabled(e){console.log("[PREFERENCES] Setting voice announce enabled to:",e),this.setPreference("voiceAnnounceEnabled",e)}getVoiceAnnounceEnabled(){return this.getPreference("voiceAnnounceEnabled",!1)??!1}setVoiceMode(e){console.log("[PREFERENCES] Setting voice mode to:",e),this.setPreference("voiceMode",e)}getVoiceMode(){return this.getPreference("voiceMode","speech")??"speech"}setVoiceReadFullText(e){console.log("[PREFERENCES] Setting voice read full text to:",e),this.setPreference("voiceReadFullText",e)}getVoiceReadFullText(){return this.getPreference("voiceReadFullText",!1)??!1}setVoiceVolume(e){let t=Math.max(0,Math.min(1,e));console.log("[PREFERENCES] Setting voice volume to:",t),this.setPreference("voiceVolume",t)}getVoiceVolume(){return this.getPreference("voiceVolume",.8)??.8}setVoiceRate(e){let t=Math.max(.5,Math.min(2,e));console.log("[PREFERENCES] Setting voice rate to:",t),this.setPreference("voiceRate",t)}getVoiceRate(){return this.getPreference("voiceRate",1.2)??1.2}setSelectedVoice(e){console.log("[PREFERENCES] Setting selected voice to:",e),this.setPreference("selectedVoice",e)}getSelectedVoice(){return this.getPreference("selectedVoice",null)??null}setPrintTechnicalMessages(e){console.log("[PREFERENCES] Setting print technical messages to:",e),this.setPreference("printTechnicalMessages",e)}getPrintTechnicalMessages(){return this.getPreference("printTechnicalMessages",!1)??!1}setHideTechnicalMessages(e){console.log("[PREFERENCES] Setting hide technical messages to:",e),this.setPreference("hideTechnicalMessages",e)}getHideTechnicalMessages(){return this.getPreference("hideTechnicalMessages",!0)??!0}setHideWarningMessages(e){console.log("[PREFERENCES] Setting hide warning messages to:",e),this.setPreference("hideWarningMessages",e)}getHideWarningMessages(){return this.getPreference("hideWarningMessages",!1)??!1}setAgentNotificationEnabled(e){console.log("[PREFERENCES] Setting agent notification enabled to:",e),this.setPreference("agentNotificationEnabled",e)}getAgentNotificationEnabled(){return this.getPreference("agentNotificationEnabled",!1)??!1}setNotificationSoundEnabled(e){console.log("[PREFERENCES] Setting notification sound enabled to:",e),this.setPreference("notificationSoundEnabled",e)}getNotificationSoundEnabled(){return this.getPreference("notificationSoundEnabled",!0)??!0}setBrowserNotificationEnabled(e){console.log("[PREFERENCES] Setting browser notification enabled to:",e),this.setPreference("browserNotificationEnabled",e)}getBrowserNotificationEnabled(){return this.getPreference("browserNotificationEnabled",!1)??!1}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};function ls(i,e=80){if(i.length<=e)return i;try{if(i.trim().startsWith("{")||i.trim().startsWith("[")){let t=JSON.parse(i),n=JSON.stringify(t);return n.length<=e?n:n.substring(0,e)+`...(${n.length} chars)`}}catch(t){}return i.substring(0,e)+"..."}var je=class{constructor(e,t){this.type=t;if(e.timestamp)this.timestamp=e.timestamp;else{let n=Math.random().toString(36).substring(2,7);this.timestamp=`${new Date().toISOString()}-${n}`}this.parentKey=e.parentKey,this.threadId=e.threadId,this.length=0}timestamp;parentKey;static type;length;threadId;get date(){let e=this.timestamp.lastIndexOf("-");if(e>0){let t=this.timestamp.substring(e+1);if(t.length===5&&/^[a-z0-9]+$/.test(t))return new Date(this.timestamp.substring(0,e))}return new Date(this.timestamp)}},Co=class extends je{invite;constructor(e,t){super(e,t),this.invite=e.invite}buildAnswer(e){return new pt({answer:e,parentKey:this.timestamp,invite:this.invite})}},fi=class i extends je{static type="heartbeat";constructor(e){super(e,i.type)}},an=class i extends Co{defaultValue;static type="invite";constructor(e){super(e,i.type),this.defaultValue=e.defaultValue}},cs="InviteEventDefault",pt=class i extends je{answer;invite;name;static type="answer";constructor(e){super(e,i.type),this.answer=e.answer??"No answer",this.invite=e.invite,this.name=e.name}},Wt=class i extends je{speaker;text;static type="text";constructor(e){super(e,i.type),this.speaker=e.speaker,this.text=e.text}},vn=class i extends je{chunk;static type="text_chunk";constructor(e){super(e,i.type),this.chunk=e.chunk,this.length=this.chunk.length}},zn=class i extends je{warning;static type="warn";constructor(e){super(e,i.type),this.warning=e.warning}},kt=class i extends je{error;static type="error";constructor(e){super(e,i.type),this.error=e.error}},sn=class i extends Co{options;optionalQuestion;allowFreeText;static type="choice";constructor(e){super(e,i.type),this.options=e.options,this.optionalQuestion=e.optionalQuestion,this.allowFreeText=e.allowFreeText??!1}},Pt=class i extends je{toolRequestId;name;args;static type="tool_request";constructor(e){super(e,i.type),this.toolRequestId=e.toolRequestId??this.timestamp,this.name=e.name,this.args=e.args,this.length=this.args.length+this.name.length+this.toolRequestId.length+20}buildResponse(e){return new yt({output:e,toolRequestId:this.toolRequestId,parentKey:this.timestamp})}toSingleLineString(e=50){let t=ls(this.args,e);return`\u{1F527} ${this.name}(${t})`}},yt=class i extends je{toolRequestId;output;static type="tool_response";constructor(e){if(super(e,i.type),this.toolRequestId=e.toolRequestId||this.timestamp||new Date().toISOString(),this.output=e.output,typeof this.output=="string")this.length=this.output.length+this.toolRequestId.length+20;else if(this.output.type==="text")this.length=this.output.content.length+this.toolRequestId.length+20;else if(this.output.type==="image"){let t=(this.output.width??0)*(this.output.height??0)/750;this.length=(t?t*3.5:this.output.content.length)+this.toolRequestId.length+20}else this.length=this.toolRequestId.length+20}getTextOutput(){return typeof this.output=="string"?this.output:this.output.type==="text"?this.output.content:this.output.type==="image"?`[Image: ${this.output.mimeType}]`:""}toSingleLineString(e=50){let t=this.getTextOutput(),n=ls(t,e),r=typeof this.output!="string"&&this.output.type==="image"?" [image]":"";return`\u2B91 ${n}${r}`}},yn=class i extends je{static type="thinking";static debounce=5e3;constructor(e){super(e,i.type)}},$n=class i extends je{summary;static type="summary";constructor(e){super(e,i.type),this.summary=e.summary,this.length=this.summary.length}toSingleLineString(e=80){return`\u{1F4CB} Summary: ${ls(this.summary,e)}`}},Ot=class i extends je{role;name;content;static type="message";constructor(e){super(e,i.type),this.role=e.role,this.name=e.name,this.content=e.content,this.length=this.content.map(t=>{if(t.type==="text")return t.content.length;if(t.type==="image"){let n=(t.width||0)*(t.height||0)/750;return n?n*3.5:t.content.length}return 0}).reduce((t,n)=>t+n,0)}getTextContent(){return this.content.filter(e=>e.type==="text").map(e=>e.content).join(`
2
- `)}},_i=class i extends je{threadId;name;summary;users;static type="thread_update";constructor(e){super(e,i.type),this.threadId=e.threadId,this.name=e.name,this.summary=e.summary,this.users=e.users}},Cn=class i extends je{filename;operation;size;mimeType;static type="file";constructor(e){super(e,i.type),this.filename=e.filename,this.operation=e.operation,this.size=e.size,this.mimeType=e.mimeType}toSingleLineString(){let e=this.operation==="created"?"\u{1F4C4}":this.operation==="updated"?"\u{1F4DD}":"\u{1F5D1}\uFE0F",t=this.size?` (${(this.size/1024).toFixed(1)} KB)`:"";return`${e} ${this.operation}: ${this.filename}${t}`}},bi=class i extends je{authUrl;state;integrationName;static type="oauth_request";constructor(e){super(e,i.type),this.authUrl=e.authUrl,this.state=e.state,this.integrationName=e.integrationName}},qt=class i extends je{subThreadId;agentName;static type="delegation";constructor(e){super(e,i.type),this.subThreadId=e.subThreadId,this.agentName=e.agentName}},At=class i extends je{code;state;integrationName;error;errorDescription;static type="oauth_callback";constructor(e){super(e,i.type),this.code=e.code,this.state=e.state,this.integrationName=e.integrationName,this.error=e.error,this.errorDescription=e.errorDescription}},Um={[Ot.type]:Ot,[pt.type]:pt,[sn.type]:sn,[qt.type]:qt,[kt.type]:kt,[fi.type]:fi,[an.type]:an,[Pt.type]:Pt,[yt.type]:yt,[Wt.type]:Wt,[vn.type]:vn,[yn.type]:yn,[zn.type]:zn,[_i.type]:_i,[$n.type]:$n,[Cn.type]:Cn,[bi.type]:bi,[At.type]:At};function er(i){let e=Um[i.type];return e?new e(i):void 0}var db=[{id:"builtin-plan",name:"plan",description:"Build a plan to complete the given task",source:"builtin",commands:[`@ We start a 3 phase process to build a comprehensive execution plan for the following task:
3
-
4
- <task>
5
- {{PARAMETERS}}
6
- </task>
7
-
8
- There will be 3 phases:
9
- 1. Research and understanding
10
- 2. Clarifying questions
11
- 3. Plan creation
12
-
13
- Do not try to do all at once, wait for my request at each time.
14
-
15
- Now we start with phase 1:
16
-
17
- 1. **Analyze the request** to identify:
18
- - Core requirements and objectives
19
- - Implicit assumptions or expectations
20
- - Technical scope and constraints
21
-
22
- 2. **Research relevant context** using available tools:
23
- - Use whatever tools you have available (file reading, API calls, search, etc.)
24
- - Gather information about existing patterns, structures, and conventions
25
- - Identify relevant files, modules, or resources
26
- - Document key findings briefly
27
-
28
- 3. **Assess feasibility**:
29
- - Identify potential challenges or blockers
30
- - Note any dependencies or prerequisites
31
- - Consider alternative approaches if applicable
32
-
33
- Do not assume you have specific tools - use what's available to you.
34
-
35
- Do not produce any document at this stage as you will have access to the accumulated research results later.
36
- `,`@ let's continue with Phase 2: Clarifying Questions regarding the initial task.
37
-
38
- <task>
39
- {{PARAMETERS}}
40
- </task>
41
-
42
- Based on your research and understanding:
43
-
44
- 1. **Identify ambiguities** or missing information that could impact the completion of the task
45
- - no boundaries
46
- - insufficient definition of done
47
- - lack of pre-requisites
48
-
49
- 2. **Ask focused questions** if clarification is needed:
50
- - Use the 'invite' or 'choice' tools for user input
51
- - Keep questions concise and specific
52
- - Prioritize questions that significantly impact the approach
53
-
54
- 3. **Skip this phase** if the requirements are clear enough to proceed
55
-
56
- Remember: Only ask questions that are truly necessary to create a solid plan.`,`@ finish with Phase 3: Plan Creation
57
-
58
- Break down the task into 3-10 clear, actionable steps. Each step should be substantial enough to represent meaningful progress, but focused enough to be completed in one session.
59
-
60
- Create a detailed execution plan:
61
- - if you have access to the exchange area, save the plan there as 'plan.md'.
62
- - otherwise, output the plan in the conversation.
63
- - do not write any other document
64
-
65
- The plan must follow this Markdown structure:
66
-
67
- # Execution Plan: [Task Title]
68
-
69
- ## Overview
70
- 1-2 sentence summary of what will be accomplished.
71
-
72
- ## Context
73
- Key information and constraints identified during research:
74
- - Relevant patterns/conventions found
75
- - Constraints or limitations
76
- - Dependencies or prerequisites
77
- - Key resources or materials involved
78
-
79
- ## Steps
80
-
81
- ### Step 1: [Step Title]
82
- - **What to do**: Clear description of the action to take
83
- - **Resources needed**: List files, tools, information, or materials required
84
- - **Expected outcome**: What should be produced or achieved
85
- - **Validation**: How to verify this step is complete
86
- - **Dependencies**: Which previous steps must complete first (or "None")
87
-
88
- ### Step 2: [Step Title]
89
- [Same structure as Step 1]
90
-
91
- [Continue for all steps...]
92
-
93
- ## Success Criteria
94
- How to verify the task is fully complete:
95
- 1. Objective measures of completion
96
- 2. Quality checks or review points
97
- 3. Final validation steps
98
-
99
- ## Risks & Considerations
100
- - Potential challenges or obstacles
101
- - Alternative approaches considered
102
- - Areas requiring special attention
103
- - Future improvements or follow-up items
104
-
105
- ---
106
-
107
- After outputting the plan in the right place (in exchange or in conversation or according to user directives):
108
- - do not produce other outputs nor documents
109
- - do not start executing the plan`],createdBy:"system",createdAt:new Date("2024-01-01").toISOString(),webhookEnabled:!1,parameterFormat:""},{id:"builtin-execute-plan",name:"execute-plan",description:"Execute a previously created plan step by step, with validation and progress tracking.",source:"builtin",commands:[`@ Execute the plan from the exchange area or outlined previously in the conversation:
110
-
111
- ## Preparation
112
- 1. **Load the plan**: Read from exchange area (plan.md) or use previously discussed plan
113
- 2. **Review**: Understand the overall objective, context, and step sequence
114
- 3. **Pre-check**: Verify prerequisites are met; report any obvious issues
115
-
116
- ## Step-by-Step Execution
117
-
118
- For each step in order:
119
-
120
- 1. **Announce**: State which step you're starting and what you'll do
121
- 2. **Check dependencies**: Verify required previous steps are complete
122
- 3. **Execute**: Perform the actions specified in the step
123
- 4. **Validate**: Apply the validation criteria from the plan
124
- 5. **Report**: Confirm completion and note any deviations
125
-
126
- **For significant or risky steps**: Ask user confirmation before proceeding (use 'choice' tool)
127
-
128
- ## Issue Handling
129
-
130
- If a step fails:
131
- - Report the issue clearly
132
- - Suggest solutions (retry, skip if non-critical, or stop)
133
- - Use 'choice' tool to ask how to proceed if needed
134
-
135
- ## Completion
136
-
137
- 1. **Final verification**: Apply success criteria from the plan
138
- 2. **Summary**: Report what was accomplished, any deviations, validation results, and next steps
139
-
140
- ## Guidelines
141
- - Follow the plan's order unless circumstances require adaptation
142
- - Communicate progress clearly at each step, without excessive details
143
- - Ask for guidance when the plan is unclear or issues arise`],createdBy:"system",createdAt:new Date("2024-01-01").toISOString(),webhookEnabled:!1,parameterFormat:""},{id:"builtin-re-prompt",name:"re-prompt",description:"Transform a vague request into a detailed, actionable prompt",source:"builtin",commands:[`@ I need you to analyze and reformulate the following request to make it more precise and actionable.
144
-
145
- ## User's initial request
146
-
147
- {{PARAMETERS}}
148
-
149
- ## Your task
150
-
151
- 1. **Analyze the request** to identify:
152
- - What is explicitly stated
153
- - What is implicit or assumed
154
- - What information is missing or ambiguous
155
- - The likely intent behind the request
156
-
157
- 2. **Ask clarifying questions** if needed:
158
- - If the request is too vague or has multiple interpretations
159
- - If critical information is missing
160
- - Use the 'invite' or 'choice' tools to gather necessary details
161
-
162
- 3. **Reformulate the request** into a clear, detailed, and actionable prompt:
163
- - Make implicit requirements explicit
164
- - Add relevant context from the current project
165
- - Specify expected outcomes or deliverables
166
- - Break down complex requests into clear steps if needed
167
- - Use precise technical terminology when appropriate
168
-
169
- 4. **Present the reformulated request** and ask for confirmation:
170
- - Show the enhanced version clearly
171
- - Explain key changes or additions you made
172
- - Ask if this matches the user's intent
173
-
174
- The goal is to transform a rough idea into a well-defined request that will produce better AI responses.`],createdBy:"system",createdAt:new Date("2024-01-01").toISOString(),webhookEnabled:!1,parameterFormat:""},{id:"builtin-memory-learn",name:"memory-learn",description:"Extract and memorize new knowledge gained from recent context",source:"builtin",commands:[`@ Learn about the following topic and memorize relevant insights if defined:
175
-
176
- <topic>
177
- {{PARAMETERS}}
178
- </topic>
179
-
180
- If no specific topic is provided, extract learnings from the entire recent conversation context.
181
-
182
- ## Process
183
-
184
- 1. **Identify new knowledge**: From the recent conversation context, identify what you learned that:
185
- - Was not in the initially given context
186
- - Is specific to this user or project (not generic knowledge)
187
- - Is useful and worth remembering
188
- - Represents understanding, not just file copies
189
-
190
- 2. **Organize insights**: Split the knowledge into cohesive subjects, each with:
191
- - **Title**: Short and descriptive (one sentence maximum)
192
- - **Content**: Detailed explanation of what was learned
193
- - Length: at most 3 paragraphs or short extracts and notes
194
- - Format: Well-structured markdown
195
- - Focus: Specific patterns, decisions, constraints, or insights
196
-
197
- 3. **Check for redundancy**: Before memorizing:
198
- - Review the list of existing memories to avoid duplication
199
- - If a similar memory exists, consider updating it instead of creating a new one
200
- - delete memories if needed
201
-
202
- 4. **Memorize**: Use the memorization tools to save each subject:
203
- - Choose appropriate level if available (PROJECT or USER)
204
- - Ensure clear structure and completeness
205
- - Memorize one subject at a time
206
-
207
- ## Guidelines
208
- - Focus on actionable insights, not generic facts
209
- - Ensure memories are self-contained and clear
210
- - Avoid redundancy with existing memories
211
- - Prioritize quality over quantity`],createdBy:"system",createdAt:new Date("2024-01-01").toISOString(),webhookEnabled:!1,parameterFormat:""},{id:"builtin-memory-curate",name:"memory-curate",description:"Analyze and clean up the memory system by consolidating redundancies and removing outdated information",source:"builtin",commands:[`@ we start a 4 phase memory curation process. Complete only the requested phase at each time.
212
-
213
- Phase 1: Analyze redundancies
214
-
215
- Review all current memories to identify:
216
-
217
- 1. **Redundant memories** that:
218
- - Cover similar or overlapping topics
219
- - Contain duplicate information
220
- - Could be consolidated for better clarity
221
-
222
- 2. **For each group of redundant memories**:
223
- - List the memory titles involved
224
- - Explain the redundancy briefly
225
- - Propose a consolidation approach
226
-
227
- Do not make changes yet - just analyze and report findings.`,`@ Phase 2: Consolidate redundancies
228
-
229
- Based on the analysis from Phase 1:
230
-
231
- 1. **For each identified redundancy**:
232
- - Delete the individual redundant memories using deleteMemory
233
- - Create a new consolidated memory that:
234
- - Maintains all critical details from the originals
235
- - Provides clear, well-structured content
236
- - Uses appropriate level (PROJECT or USER)
237
- - Explain your consolidation reasoning
238
-
239
- 2. **Be proactive but careful**: Preserve important details while eliminating duplication.`,`@ Phase 3: Check for outdated information
240
-
241
- Review remaining memories for accuracy and relevance:
242
-
243
- 1. **Compare each memory against**:
244
- - Other memories for inconsistencies
245
- - Current project context for outdated information
246
- - Core documentation for misalignments
247
-
248
- 2. **For each problematic memory**:
249
- - List the memory title with brief explanation of the issue
250
- - Take appropriate action:
251
- - Delete if outdated or incorrect
252
- - Update if incomplete or partially incorrect
253
- - Consolidate if it fits better elsewhere
254
- - Explain your reasoning clearly
255
-
256
- Be thorough in your analysis.`,`@ Phase 4: Final verification
257
-
258
- Verify the memory system's overall health:
259
-
260
- 1. **Review the current state**:
261
- - Check overall structure and organization
262
- - Verify each memory for completeness and validity
263
- - Confirm proper categorization (PROJECT vs USER)
264
-
265
- 2. **Document the results**:
266
- - Summarize what was consolidated or removed
267
- - List any remaining issues or concerns
268
- - Provide recommendations for maintaining memory quality
269
-
270
- This ensures the memory system stays efficient and valuable.`],createdBy:"system",createdAt:new Date("2024-01-01").toISOString(),webhookEnabled:!1,parameterFormat:""}];var wb=[Ot.type,Pt.type,yt.type,$n.type,an.type,sn.type,pt.type,qt.type];var pd={CONFLUENCE:[],GIT:[],GIT_WORKTREE:[],GITLAB:[],JIRA:[],SLACK:[],ZENDESK:[],BASECAMP:[]},Bb=Object.keys(pd).filter(i=>pd[i]?.length===0);var Gt=class i{eventSource=null;eventsSubject=new J;connectionStatusSubject=new W({connected:!1,reconnectAttempts:0,maxAttempts:3});reconnectAttempts=0;MAX_RECONNECT_ATTEMPTS=3;RECONNECT_DELAY=2e3;events$=this.eventsSubject.asObservable();connectionStatus$=this.connectionStatusSubject.asObservable();ngZone=f(Lt);connectToThread(e,t){console.log("[SSE] Connecting to thread event stream:",e,t),this.eventSource&&(console.log("[SSE] Closing existing EventSource"),this.eventSource.close());let n=`/api/projects/${e}/threads/${t}/event-stream`;console.log("[SSE] EventSource URL:",n),this.eventSource=new EventSource(n),this.setupEventHandlers()}setupEventHandlers(){this.eventSource&&(this.eventSource.onmessage=e=>{this.ngZone.run(()=>{console.log("[SSE] Message received:",e.data.substring(0,100)),this.reconnectAttempts=0,this.updateConnectionStatus(!0,0);try{let t=JSON.parse(e.data),n=er(t);n?(console.log("[SSE] Event:",n.type),this.eventsSubject.next(n)):console.warn("[SSE] Failed to build event:",t.type)}catch(t){console.error("[SSE] Parse error:",t.message)}})},this.eventSource.onopen=()=>{this.ngZone.run(()=>{console.log("[SSE] Connection established"),this.reconnectAttempts=0,this.updateConnectionStatus(!0,0)})},this.eventSource.onerror=e=>{this.ngZone.run(()=>{console.log("[SSE] EventSource error:",e),this.eventSource?.readyState===EventSource.CLOSED&&(console.log("[SSE] Connection closed"),this.updateConnectionStatus(!1,this.reconnectAttempts),this.reconnectAttempts<this.MAX_RECONNECT_ATTEMPTS?(console.log(`[SSE] Attempting reconnect ${this.reconnectAttempts+1}/${this.MAX_RECONNECT_ATTEMPTS}`),this.eventsSubject.next(new kt({error:new Error(`Connection lost. Attempting to reconnect (${this.reconnectAttempts+1}/${this.MAX_RECONNECT_ATTEMPTS})...`)})),setTimeout(()=>{this.reconnectAttempts++,console.warn("[SSE] Reconnection may not work properly with thread-based connections")},this.RECONNECT_DELAY)):(console.log("[SSE] Max reconnection attempts reached"),this.eventsSubject.next(new kt({error:new Error("Connection lost permanently. Please refresh the page.")}))))})})}disconnect(){this.eventSource&&(console.log("[SSE] Disconnecting EventSource"),this.eventSource.close(),this.eventSource=null,this.updateConnectionStatus(!1,0))}updateConnectionStatus(e,t){this.connectionStatusSubject.next({connected:e,reconnectAttempts:t,maxAttempts:this.MAX_RECONNECT_ATTEMPTS})}ngOnDestroy(){this.disconnect(),this.eventsSubject.complete(),this.connectionStatusSubject.complete()}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var Yt=class i{http=f(rt);projectState=f(ye);getBaseUrl(){return`/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/threads`}listThreads(){return this.http.get(this.getBaseUrl())}getThread(e){return this.http.get(`${this.getBaseUrl()}/${e}`)}createThread(e){let t=e?{name:e}:{};return this.http.post(this.getBaseUrl(),t)}updateThread(e,t){return this.http.put(`${this.getBaseUrl()}/${e}`,{name:t})}updateThreadUsers(e,t){return this.http.put(`${this.getBaseUrl()}/${e}`,{users:t})}starThread(e){return this.http.post(`${this.getBaseUrl()}/${e}/star`,{})}unstarThread(e){return this.http.delete(`${this.getBaseUrl()}/${e}/star`)}deleteThread(e){return this.http.delete(`${this.getBaseUrl()}/${e}`)}stopThread(e){return this.http.post(`${this.getBaseUrl()}/${e}/stop`,{})}getThreadMessages(e){return this.http.get(`${this.getBaseUrl()}/${e}/messages`)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var Ye=class i{selectedThreadIdSubject=new W(null);isLoadingSubject=new W(!1);isLoadingThreadListSubject=new W(!1);refreshThreadListSubject=new J;threadListSubject=new W([]);hasLoadedOncePerProject=new Map;currentProjectName=null;isLoading$=this.isLoadingSubject.asObservable();isLoadingThreadList$=this.isLoadingThreadListSubject.asObservable();threadApi=f(Yt);projectStateService=f(ye);projectName$=this.projectStateService.selectedProject$.pipe(Ae(e=>e?.name),_a());constructor(){Pn([this.projectName$,this.refreshThreadListSubject.asObservable().pipe(ni(void 0))]).pipe(gt(([e])=>{e!==this.currentProjectName&&(console.log("[THREAD_STATE] Project changed, clearing thread list"),this.threadListSubject.next([]),this.currentProjectName=e),e?this.hasLoadedOncePerProject.get(e)?console.log("[THREAD_STATE] Refreshing thread list for project",e,"(no spinner)"):(console.log("[THREAD_STATE] Initial load for project",e,"- showing spinner"),this.isLoadingThreadListSubject.next(!0)):(console.log("[THREAD_STATE] No project selected, hiding spinner"),this.isLoadingThreadListSubject.next(!1))}),va(([e])=>e?(console.log("[THREAD_STATE] Fetching threads for project:",e),this.threadApi.listThreads().pipe(Ae(t=>({threads:t,projectName:e})),mn(t=>(console.error("[THREAD_STATE] Error loading thread list:",t),kn({threads:[],projectName:e}))))):(console.log("[THREAD_STATE] No project selected, returning empty list"),kn({threads:[],projectName:null}))),gt(({threads:e,projectName:t})=>{console.log("[THREAD_STATE] Thread list loaded:",e.length,"threads for project",t),t&&this.hasLoadedOncePerProject.set(t,!0),this.isLoadingThreadListSubject.next(!1),this.threadListSubject.next(e)})).subscribe()}threadList$=this.threadListSubject.asObservable();refreshSelectedThreadSubject=new J;selectedThread$=Pn([this.projectName$,this.selectedThreadIdSubject.pipe(_a()),this.refreshSelectedThreadSubject.pipe(ni(void 0))]).pipe(va(([e,t])=>!e||!t?kn(null):(this.isLoadingSubject.next(!0),this.threadApi.getThread(t).pipe(cl({bufferSize:1,refCount:!0})))),gt(()=>{this.isLoadingSubject.next(!1)}));selectThread(e){this.selectedThreadIdSubject.next(e)}getSelectedThreadId(){return this.selectedThreadIdSubject.value}getSelectedThreadIdOrThrow(){let e=this.selectedThreadIdSubject.value;if(!e)throw new Error("[THREAD_STATE] No thread selected");return e}clearSelection(){this.selectedThreadIdSubject.next(null)}stop(){let e=this.selectedThreadIdSubject.value;if(!e){console.error("[THREAD_STATE] Cannot stop: no thread selected");return}console.log("[THREAD_STATE] Stopping thread:",e),this.threadApi.stopThread(e).subscribe({next:t=>console.log("[THREAD_STATE] Stop signal sent:",t.message),error:t=>console.error("[THREAD_STATE] Error stopping thread:",t)})}refreshThreadList(){console.log("[THREAD_STATE] Manually refreshing thread list"),this.refreshThreadListSubject.next()}updateStarLocal(e,t,n){let o=this.threadListSubject.value.map(a=>{if(a.id!==e)return a;let s=a.starring||[];return t&&!s.includes(n)?he(G({},a),{starring:[...s,n]}):!t&&s.includes(n)?he(G({},a),{starring:s.filter(d=>d!==n)}):a});this.threadListSubject.next(o)}refreshSelectedThread(){this.refreshSelectedThreadSubject.next()}updateThreadUsers(e,t){return this.threadApi.updateThreadUsers(e,t).pipe(gt(()=>{this.refreshThreadList()}),mn(n=>(console.error("[THREAD_STATE] Error updating thread users:",n),ei(()=>n))))}renameThread(e,t){let n=t.trim();return!n||n.length===0?(console.error("[THREAD_STATE] Cannot rename thread: name is empty after trimming"),ei(()=>new Error("Thread name cannot be empty"))):(console.log("[THREAD_STATE] Renaming thread:",e,"to:",n),this.threadApi.updateThread(e,n).pipe(gt(r=>{console.log("[THREAD_STATE] Thread renamed successfully:",r),this.refreshThreadList()}),mn(r=>(console.error("[THREAD_STATE] Error renaming thread:",r),ei(()=>r)))))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var vi=class i{http=f(rt);projectState=f(ye);threadState=f(Ye);getBaseUrl(){return`/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/threads/${this.threadState.getSelectedThreadIdOrThrow()}/messages`}getMessages(){return this.http.get(this.getBaseUrl())}sendMessage(e){return this.http.post(this.getBaseUrl(),e,{responseType:"text"})}sendFreeMessage(e){return this.http.post(this.getBaseUrl(),{message:e})}getMessage(e){return this.http.get(`${this.getBaseUrl()}/${encodeURIComponent(e)}`)}deleteMessage(e){return this.http.delete(`${this.getBaseUrl()}/${encodeURIComponent(e)}`)}getFormattedMessage(e){return this.http.get(`${this.getBaseUrl()}/${encodeURIComponent(e)}/formatted`,{responseType:"text"})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var Qt=class i{http=f(rt);usernameSubject=new W(null);authEnabledSubject=new W(!1);username$=this.usernameSubject.asObservable();authEnabled$=this.authEnabledSubject.asObservable();fetchCurrentUser(){return this.http.get("/api/user/me").pipe(gt(e=>{this.usernameSubject.next(e.username),this.authEnabledSubject.next(e.authEnabled)}))}getUsername(){return this.usernameSubject.value}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var mt=class i{destroy$=new J;currentProject=null;currentThread=null;messagesSubject=new W([]);isThinkingSubject=new W(!1);currentChoiceSubject=new W(null);projectTitleSubject=new W("Coday");currentInviteEventSubject=new W(null);messageToRestoreSubject=new W("");threadUpdateEventSubject=new W(null);currentChoiceEvent=null;thinkingTimeout=null;accumulatedChunks="";streamingTextSubject=new W("");subThreadEventsSubject=new J;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=f(Gt);messageApi=f(vi);userService=f(Qt);constructor(){this.connectionStatus$=this.eventStream.connectionStatus$,this.initializeEventHandling()}setTabTitleService(e){this.tabTitleService=e}connectToThread(e,t){this.currentProject=e,this.currentThread=t,this.eventStream.connectToThread(e,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 t=this.currentInviteEventSubject.value;if(t){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive(),this.currentInviteEventSubject.next(null);let n=t.buildAnswer(e);this.handleAnswerEvent(n),this.messageApi.sendMessage(n).subscribe({error:r=>{console.error("[CODAY] Send invite answer error:",r),this.currentInviteEventSubject.next(t),this.stopThinking()}})}else this.messageApi.sendFreeMessage(e).subscribe({error:n=>{console.error("[CODAY] Send error:",n)}})}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 t=this.currentChoiceEvent.buildAnswer(e);this.currentChoiceSubject.next(null),this.currentChoiceEvent=null,this.messageApi.sendMessage(t).subscribe({next:()=>{},error:n=>{console.error("[CODAY-CHOICE] Choice error:",n),this.stopThinking()}})}else console.error("[CODAY-CHOICE] No choice event available for choice:",e)}deleteMessage(e){let t=this.messagesSubject.value.find(r=>r.id===e),n=this.extractTextContentFromMessage(t);return this.messageApi.deleteMessage(e).pipe(gt(r=>{r.success&&(this.removeMessagesFromIndex(e),n.trim()&&this.messageToRestoreSubject.next(n))}))}getCurrentProjectTitle(){return this.projectTitleSubject.value}getCurrentInviteEvent(){return this.currentInviteEventSubject.value}setThinkingForPendingMessage(){this.isThinkingSubject.next(!0),this.tabTitleService?.setSystemActive()}initializeEventHandling(){this.eventStream.events$.pipe(D(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 t=this.subThreadEventBuffers.get(e.threadId);t?t.push(e):this.subThreadEventBuffers.set(e.threadId,[e]),this.subThreadEventsSubject.next(e);return}e instanceof Ot?this.handleMessageEvent(e):e instanceof vn?this.handleTextChunkEvent(e):e instanceof Wt?this.handleTextEvent(e):e instanceof pt?this.handleAnswerEvent(e):e instanceof kt?this.handleErrorEvent(e):e instanceof zn?this.handleWarnEvent(e):e instanceof yn?this.handleThinkingEvent(e):e instanceof Pt?this.handleToolRequestEvent(e):e instanceof yt?this.handleToolResponseEvent(e):e instanceof sn?this.handleChoiceEvent(e):e instanceof fi?this.handleHeartBeatEvent(e):e instanceof an?this.handleInviteEvent(e):e instanceof _i?this.handleThreadUpdateEvent(e):e instanceof qt?this.handleDelegationEvent(e):e instanceof bi||e instanceof At||console.warn("[CODAY] Unhandled event type:",e.type)}handleDelegationEvent(e){if(console.log("[CODAY] DelegationEvent received:",e.subThreadId,e.agentName),this.messagesSubject.value.findIndex(r=>r.subThreadId===e.subThreadId)===-1){let r={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(r)}}handleThreadUpdateEvent(e){this.threadUpdateEventSubject.next(e)}handleMessageEvent(e){e.role==="assistant"&&this.accumulatedChunks&&(this.accumulatedChunks="",this.streamingTextSubject.next(""));let t={id:e.timestamp,role:e.role,speaker:e.name,content:e.content,timestamp:e.date,type:"text"};this.addMessage(t)}handleTextChunkEvent(e){this.accumulatedChunks+=e.chunk,this.streamingTextSubject.next(this.accumulatedChunks)}handleTextEvent(e){let t={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(t)}handleAnswerEvent(e){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 t={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Error: ${JSON.stringify(e.error)}`}],timestamp:e.date,type:"error"};this.addMessage(t)}handleWarnEvent(e){let t={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:`Warning: ${JSON.stringify(e.warning)}`}],timestamp:e.date,type:"warning"};this.addMessage(t)}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()},yn.debounce+1e3))}handleToolRequestEvent(e){let t={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp};this.addMessage(t)}handleToolResponseEvent(e){let t={id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:e.date,type:"technical",eventId:e.timestamp};this.addMessage(t)}handleChoiceEvent(e){this.stopThinking(),this.currentChoiceEvent=e,this.tabTitleService?.setSystemInactive();let t=e.options.map(r=>({value:r,label:r})),n=e.optionalQuestion?`${e.optionalQuestion} ${e.invite}`:e.invite;this.currentChoiceSubject.next({options:t,label:n,allowFreeText:e.allowFreeText})}handleHeartBeatEvent(e){}handleInviteEvent(e){this.stopThinking();let t=this.messagesSubject.value,n=t[t.length-1];if(!(!(e.invite===cs)&&n&&n.role==="assistant"&&n.content.some(a=>a.type==="text"&&a.content.includes(e.invite)))&&e.invite!==cs){let a={id:e.timestamp,role:"assistant",speaker:"Assistant",content:[{type:"text",content:e.invite}],timestamp:e.date,type:"text"};this.addMessage(a)}this.currentInviteEventSubject.next(e),this.tabTitleService?.setSystemInactive()}addMessage(e){let t=this.messagesSubject.value;t.some(n=>n.id===e.id)||this.messagesSubject.next([...t,e])}removeMessagesFromIndex(e){let t=this.messagesSubject.value,n=t.findIndex(o=>o.id===e);if(n===-1||n===0)return;let r=t.slice(0,n);this.messagesSubject.next(r),this.stopThinking()}extractTextContentFromMessage(e){return e?e.content.filter(t=>t.type==="text").map(t=>t.content).join(`
271
-
272
- `):""}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(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var So=class i{sanitizer=f(Vt);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(`(${n})`,"gi"),o=e.replace(r,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(o)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=bl({name:"highlight",type:i,pure:!0})};var qm=["messageInput"],Gm=["fileInput"],Ym=(i,e)=>e.name;function Qm(i,e){i&1&&(l(0,"div",3),F(1,"span",8),u(2," Recording... Click mic to stop "),c())}function Km(i,e){if(i&1&&(l(0,"span",13),u(1),c()),i&2){let t=h().$implicit,n=h(2);p(),L(" "+(n.getParameterFormat(t)||""))}}function Xm(i,e){if(i&1){let t=O();l(0,"div",10),v("click",function(){let r=x(t).$index,o=h(2);return w(o.selectAutocompleteItemByClick(r))})("keydown.enter",function(){let r=x(t).$index,o=h(2);return w(o.selectAutocompleteItemByClick(r))})("keydown.space",function(){let r=x(t).$index,o=h(2);return w(o.selectAutocompleteItemByClick(r))})("mouseenter",function(){let r=x(t).$index,o=h(2);return w(o.selectedAutocompleteIndex=r)}),l(1,"div",11),F(2,"span",12),Wi(3,"highlight"),C(4,Km,2,1,"span",13),c(),F(5,"div",14),Wi(6,"highlight"),c()}if(i&2){let t=e.$implicit,n=e.$index,r=h(2);Y("selected",n===r.selectedAutocompleteIndex),Me("aria-selected",n===r.selectedAutocompleteIndex),p(2),T("innerHTML",ka(3,6,r.autocompleteTrigger+t.name,r.getAutocompleteQuery()),ut),p(2),S(r.hasParameterFormat(t)?4:-1),p(),T("innerHTML",ka(6,9,t.description,r.getAutocompleteQuery()),ut)}}function Jm(i,e){if(i&1&&(l(0,"div",4),we(1,Xm,7,12,"div",9,Ym),c()),i&2){let t=h();p(),Te(t.autocompleteItems)}}function Zm(i,e){if(i&1){let t=O();l(0,"ds-icon-button",17),v("action",function(){x(t);let r=h(2);return w(r.onStopClick())}),c()}}function eu(i,e){if(i&1){let t=O();l(0,"ds-icon-button",18),v("action",function(){x(t);let r=h(2);return w(r.sendMessage())}),c()}if(i&2){let t=h(2);Y("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),T("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim())}}function tu(i,e){if(i&1){let t=O();l(0,"ds-icon-button",20),v("action",function(){x(t);let r=h(3);return w(r.triggerFileUpload())}),c(),l(1,"input",21,1),v("change",function(r){x(t);let o=h(3);return w(o.onFileInputChange(r))}),c()}if(i&2){let t=h(3);T("disabled",t.isDisabled)}}function nu(i,e){if(i&1){let t=O();C(0,tu,3,1),l(1,"ds-icon-button",19),v("action",function(){x(t);let r=h(2);return w(r.toggleRecording())}),c()}if(i&2){let t=h(2);S(t.showWelcome?-1:0),p(),Y("recording",t.isRecording)("hidden",t.message.trim()),T("icon",t.isRecording?"fiber_manual_record":"mic")("title",t.isRecording?"Click to stop recording":"Click to start recording")}}function iu(i,e){if(i&1&&(l(0,"div",7),C(1,Zm,1,0,"ds-icon-button",15),C(2,eu,1,6,"ds-icon-button",16),C(3,nu,2,7),c()),i&2){let t=h();p(),S(t.isThinking?1:-1),p(),S(!t.isThinking||t.message.trim()?2:-1),p(),S(t.isThinking?-1:3)}}var yi=class i{isDisabled=!1;showWelcome=!1;isThinking=!1;isStarting=!1;isSessionInitializing=!1;isStopping=!1;filesPasted=new Z;messageSubmitted=new Z;voiceRecordingToggled=new Z;heightChanged=new Z;stopRequested=new Z;textareaFocused=new Z;messageInput;fileInput;message="";isRecording=!1;isFocused=!1;recognition=null;sessionHadTranscript=!1;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=!1;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=!1;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=f(Pe);codayService=f(mt);agentApiService=f(cc);promptApiService=f(dc);projectStateService=f(ye);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore()}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200)})}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=!1,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"))}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation()}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case"ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case"ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case"Tab":case"Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case"Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(!0)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(!0)))}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete()}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(o=>o.kind==="file");if(!n.length)return;e.preventDefault();let r=n.reduce((o,a)=>{let s=a.getAsFile();return s?[...o,s]:o},[]);r.length&&this.filesPasted.emit(r)}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click()}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let r=Array.from(n);this.filesPasted.emit(r),t.value=""}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),r=this.messageInput?.nativeElement;n&&!n.contains(t)&&r&&!r.contains(t)&&this.hideAutocomplete()}sendMessage(e=!1){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0))}onStopClick(){this.isStopping=!0,this.stopRequested.emit()}toggleRecording(){this.isRecording?this.stopRecording():this.startRecording()}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=!0,this.recognition.interimResults=!0,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0)}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported")}this.recognition.onresult=t=>{let n="",r=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let o=r;o<t.results.length;o++)t.results[o].isFinal&&(n+=t.results[o][0].transcript,this.lastProcessedResultIndex=o+1);if(n){let o=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=!0,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(o)}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=!1,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully")},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected")},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended")}}startRecording(){return B(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording")}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(this.isRecording)}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks()}catch(e){console.error("[SPEECH] Failed to stop recording:",e)}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e)}}improveTranscriptPunctuation(e){let t=e;return/[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n)}setTimeout(()=>this.adjustTextareaHeight(),0)}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
273
-
274
- `),this.sessionHadTranscript=!1),this.pendingLineBreaksTimeout=null},500)}clearPendingLineBreaks(){this.pendingLineBreaksTimeout&&(clearTimeout(this.pendingLineBreaksTimeout),this.pendingLineBreaksTimeout=null)}adjustTextareaHeight(){let e=this.messageInput?.nativeElement;if(!e)return;let t=e.parentElement?.offsetHeight??e.offsetHeight+32;this.heightChanged.emit(t)}getSendButtonShortcut(){return this.useEnterToSend?"Enter":navigator.platform.toLowerCase().includes("mac")?"\u2318+Enter":"Ctrl+Enter"}getSendButtonTooltip(){return this.useEnterToSend?"Send message (Enter) - Shift+Enter for new line":`Send message (${navigator.platform.toLowerCase().includes("mac")?"Cmd+Enter":"Ctrl+Enter"}) - Enter for new line`}getPlaceholder(){return this.isSessionInitializing?"Initializing session...":this.isThinking?this.isStopping?"Stopping...":this.isStarting?"Processing request...":this.currentThinkingPhrase:this.showWelcome?"How can I help you today?":"Type '@' for agents, '/' for commands, or just your message..."}startThinkingAnimation(){this.thinkingPhraseIndex=0,this.currentThinkingPhrase=this.thinkingPhrases[0]??"Thinking...",this.thinkingInterval=window.setInterval(()=>{this.thinkingPhraseIndex<this.thinkingPhrases.length-1&&(this.thinkingPhraseIndex++,this.currentThinkingPhrase=this.thinkingPhrases[this.thinkingPhraseIndex]??"Thinking...")},2e3)}stopThinkingAnimation(){this.thinkingInterval&&(clearInterval(this.thinkingInterval),this.thinkingInterval=null),this.thinkingPhraseIndex=0,this.currentThinkingPhrase="Thinking..."}subscribeToInviteEvents(){this.subscriptions.push(this.codayService.currentInviteEvent$.subscribe(e=>{e?this.handleInviteEvent(e.invite,e.defaultValue):this.currentInvite=""}))}handleInviteEvent(e,t){this.currentInvite=e,t&&(this.message=t,setTimeout(()=>this.adjustTextareaHeight(),0)),setTimeout(()=>{this.messageInput?.nativeElement&&this.messageInput.nativeElement.focus()},50)}subscribeToMessageRestore(){this.subscriptions.push(this.codayService.messageToRestore$.subscribe(e=>{e.trim()&&(console.log("[CHAT-TEXTAREA] Restoring message content:",e.substring(0,50)+"..."),this.restoreMessageContent(e))}))}restoreMessageContent(e){this.message=e,this.messageInput?.nativeElement&&(this.messageInput.nativeElement.focus(),setTimeout(()=>{let t=this.messageInput.nativeElement,n=this.message.length;t.setSelectionRange(n,n)},0)),setTimeout(()=>this.adjustTextareaHeight(),10)}focusTextarea(){let e=this.messageInput?.nativeElement;console.log("[CHAT-TEXTAREA] focusTextarea called",{hasElement:!!e,isDisabled:this.isDisabled,isThinking:this.isThinking,elementDisabled:e?.disabled,isSessionInitializing:this.isSessionInitializing}),e&&!e.disabled?(e.focus(),console.log("[CHAT-TEXTAREA] Textarea focused successfully")):console.log("[CHAT-TEXTAREA] Focus blocked - element disabled or not available")}checkForAutocomplete(){let e=this.message;if(e.startsWith("@")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showAgentAutocomplete(t);return}if(e.startsWith("/")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showPromptAutocomplete(t);return}this.hideAutocomplete()}showAgentAutocomplete(e){this.autocompleteTrigger="@";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.agentApiService.getAgentsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0},error:n=>{console.error("[AUTOCOMPLETE] Error loading agents:",n),this.hideAutocomplete()}})}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load agents"),this.hideAutocomplete()}}showPromptAutocomplete(e){this.autocompleteTrigger="/";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.promptApiService.getPromptsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0},error:n=>{console.error("[AUTOCOMPLETE] Error loading prompts:",n),this.hideAutocomplete()}})}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load prompts"),this.hideAutocomplete()}}hideAutocomplete(){this.autocompleteVisible=!1,this.autocompleteItems=[],this.selectedAutocompleteIndex=0}selectAutocompleteItem(){let e=this.autocompleteItems[this.selectedAutocompleteIndex];if(!e)return;let t=null;if(this.autocompleteTrigger==="/"){let n=e,r=n.parameterFormat;if(console.log(n),r===void 0)this.message=`/${e.name}`;else if(r==="")this.message=`/${e.name} `;else{this.message=`/${e.name} ${r}`;let o=this.message.indexOf('=""');o!==-1&&(t=o+2)}}else this.message=`@${e.name} `;this.hideAutocomplete(),setTimeout(()=>{if(this.messageInput?.nativeElement)if(this.messageInput.nativeElement.focus(),t!==null)this.messageInput.nativeElement.setSelectionRange(t,t);else{let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n)}},0)}selectAutocompleteItemByClick(e){this.selectedAutocompleteIndex=e,this.selectAutocompleteItem()}getAutocompleteQuery(){return this.message.substring(1).split(" ")[0]??""}getParameterFormat(e){return e.parameterFormat}hasParameterFormat(e){return this.autocompleteTrigger==="/"&&e.parameterFormat!==void 0}scrollSelectedItemIntoView(){setTimeout(()=>{let e=document.querySelector(".autocomplete-popup");if(!e)return;let t=e.querySelector(".autocomplete-item.selected");t&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},0)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-chat-textarea"]],viewQuery:function(t,n){if(t&1&&Be(qm,7)(Gm,5),t&2){let r;ge(r=fe())&&(n.messageInput=r.first),ge(r=fe())&&(n.fileInput=r.first)}},hostBindings:function(t,n){t&1&&v("paste",function(o){return n.onPaste(o)})("click",function(o){return n.onDocumentClick(o)},hl)},inputs:{isDisabled:"isDisabled",showWelcome:"showWelcome",isThinking:"isThinking",isStarting:"isStarting",isSessionInitializing:"isSessionInitializing"},outputs:{filesPasted:"filesPasted",messageSubmitted:"messageSubmitted",voiceRecordingToggled:"voiceRecordingToggled",heightChanged:"heightChanged",stopRequested:"stopRequested",textareaFocused:"textareaFocused"},features:[jt],decls:7,vars:12,consts:[["messageInput",""],["fileInput",""],[1,"chat-input-container"],[1,"recording-indicator"],[1,"autocomplete-popup"],[1,"input-row","grouped-input"],[1,"message-input",3,"ngModelChange","keydown","input","focus","blur","ngModel","placeholder","disabled"],[1,"actions"],[1,"recording-dot"],["role","option","tabindex","0",1,"autocomplete-item",3,"selected"],["role","option","tabindex","0",1,"autocomplete-item",3,"click","keydown.enter","keydown.space","mouseenter"],[1,"item-name"],[3,"innerHTML"],[1,"parameter-format"],[1,"item-description",3,"innerHTML"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn"],["icon","send","variant","primary",1,"send-btn",3,"title","disabled","hidden","active"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn",3,"action"],["icon","send","variant","primary",1,"send-btn",3,"action","title","disabled"],["variant","default",1,"voice-btn",3,"action","icon","title"],["icon","attach_file","variant","default","title","Upload files (images or documents)",1,"upload-btn",3,"action","disabled"],["type","file","multiple","","accept","image/*,application/pdf,.pdf,.doc,.docx,.txt,.md,.json,.yaml,.yml,.csv,.xml,.html",2,"display","none",3,"change"]],template:function(t,n){if(t&1){let r=O();l(0,"div",2),C(1,Qm,3,0,"div",3),C(2,Jm,3,0,"div",4),l(3,"div",5)(4,"textarea",6,0),ie("ngModelChange",function(a){return x(r),ne(n.message,a)||(n.message=a),w(a)}),v("keydown",function(a){return n.onKeyDown(a)})("input",function(){return n.onInput()})("focus",function(){return x(r),n.isFocused=!0,w(n.textareaFocused.emit())})("blur",function(){return n.isFocused=!1}),c(),C(6,iu,4,3,"div",7),c()()}t&2&&(p(),S(n.isRecording?1:-1),p(),S(n.autocompleteVisible?2:-1),p(),Y("focused",n.isFocused)("welcome-mode",n.showWelcome)("is-thinking",n.isThinking),p(),te("ngModel",n.message),T("placeholder",n.getPlaceholder())("disabled",n.isDisabled),p(2),S(n.isSessionInitializing?-1:6))},dependencies:[lt,_t,at,st,Yl,So],styles:['@keyframes _ngcontent-%COMP%_gradientBorderShift{0%{background-position:0 0}50%{background-position:100% 0}to{background-position:0 0}}.chat-input-container[_ngcontent-%COMP%]{flex-shrink:0;width:100%;position:relative}.thinking-progress[_ngcontent-%COMP%]{position:absolute;top:0;left:0;right:0;height:3px;z-index:1}.thinking-progress[_ngcontent-%COMP%] .mdc-linear-progress__bar-inner{border-top-width:3px}.input-row.grouped-input[_ngcontent-%COMP%]{display:flex;align-items:stretch;background:var(--glass-bg);border-radius:16px;padding:0 .15rem 0 1.25rem;position:relative;transition:border-color .2s,box-shadow .2s,background .3s}.input-row[_ngcontent-%COMP%]{position:relative;background:var(--glass-bg, #1e1e1e)!important;background-clip:padding-box}.input-row[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:-2px;border-radius:inherit;background-size:200% 100%;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;padding:1px;pointer-events:none;z-index:-1;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-thinking[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-thinking[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-thinking[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking):before{background:var(--color-primary);animation:none}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking){box-shadow:0 0 0 4px #007aff1a}.message-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent!important;box-shadow:none;font-size:1rem;padding:1rem 0;color:var(--color-text);resize:none;field-sizing:content;min-height:36px;max-height:70vh;overflow-y:auto;font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,system-ui,sans-serif;line-height:1.5}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.message-input[_ngcontent-%COMP%]:focus{outline:none;border:none;box-shadow:none}.message-input[_ngcontent-%COMP%]:disabled{background-color:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;opacity:.6}.message-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);transition:opacity .3s ease-in-out}.message-input[_ngcontent-%COMP%]:disabled::placeholder{animation:_ngcontent-%COMP%_thinkingPulsate 2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_thinkingPulsate{0%,to{opacity:.6}50%{opacity:1}}.voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%]{margin:0}.actions[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:wrap;justify-content:center}.voice-btn.recording[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{color:var(--color-error);animation:_ngcontent-%COMP%_pulse 1.5s infinite}.send-btn[_ngcontent-%COMP%]{transition:opacity .4s,margin-left .4s}.send-btn.active[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{opacity:1}.send-btn[_ngcontent-%COMP%]:not(.active) button[_ngcontent-%COMP%]{opacity:0;margin-left:calc(-.5rem - 36px)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){color:#fff;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-primary, #3b82f6) 20%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 80%,var(--color-primary, #3b82f6) 100%);background-size:300% auto;animation:sendButtonGradientShift 6s ease-in-out infinite;box-shadow:0 4px 14px #007aff30;transform:scale(1.2)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:active:not(:disabled){transform:scale(1.3);box-shadow:0 4px 24px #007aff30}.recording-indicator[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-top:.2rem;margin-bottom:.2rem;color:var(--color-error, #ff5555);font-size:.9rem;position:absolute;top:-1.5rem}@keyframes _ngcontent-%COMP%_pulse{0%,to{opacity:1}50%{opacity:.5}}.autocomplete-popup[_ngcontent-%COMP%]{position:absolute;bottom:100%;left:0;right:0;margin-bottom:.5rem;background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);border-radius:12px;box-shadow:0 8px 32px #00000026;border:1px solid var(--color-border);max-height:400px;max-width:500px;overflow-y:auto;z-index:100}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]{padding:.75rem 1rem;cursor:pointer;transition:background .2s;border-left:3px solid transparent}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]:hover, .autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{background:var(--color-bg-hover)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{border-left-color:var(--color-primary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%]{font-weight:600;color:var(--color-text);margin-bottom:.25rem;font-family:SF Mono,Monaco,Menlo,Cascadia Code,Consolas,monospace;font-size:.95rem}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1));padding:0 2px;border-radius:2px}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] .parameter-format[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-weight:400;opacity:.7}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);line-height:1.3}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1))}@media print{.thinking-progress[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%], .recording-indicator[_ngcontent-%COMP%], .autocomplete-popup[_ngcontent-%COMP%]{display:none!important}}']})};var ru=(i,e)=>e.label;function ou(i,e){if(i&1){let t=O();l(0,"button",2),v("click",function(r){let o=x(t).$implicit,a=h();return w(a.executeAction(o,r))}),l(1,"mat-icon"),u(2),c()()}if(i&2){let t=e.$implicit;Me("title",t.tooltip||t.label),p(),Me("aria-label",t.label),p(),L(t.icon)}}var xo=class i{actions=[];executeAction(e,t){t.stopPropagation(),e.action()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-message-context-menu"]],inputs:{actions:"actions"},decls:3,vars:0,consts:[[1,"context-menu-wrapper"],["mat-icon-button",""],["mat-icon-button","",3,"click"]],template:function(t,n){t&1&&(l(0,"div",0),we(1,ou,3,3,"button",1,ru),c()),t&2&&(p(),Te(n.actions))},dependencies:[it,ze,se],styles:[".context-menu-wrapper[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center}.context-menu-wrapper[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{transform:scale(.75)}"]})};function us(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Hn=us();function bd(i){Hn=i}var rr={exec:()=>null};function oe(i,e=""){let t=typeof i=="string"?i:i.source,n={replace:(r,o)=>{let a=typeof o=="string"?o:o.source;return a=a.replace(Xe.caret,"$1"),t=t.replace(r,a),n},getRegex:()=>new RegExp(t,e)};return n}var Xe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i")},au=/^(?:[ \t]*(?:\n|$))+/,su=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,lu=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,or=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,cu=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hs=/(?:[*+-]|\d{1,9}[.)])/,vd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,yd=oe(vd).replace(/bull/g,hs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),du=oe(vd).replace(/bull/g,hs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),gs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,pu=/^[^\n]+/,fs=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,mu=oe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",fs).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),uu=oe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,hs).getRegex(),Mo="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",_s=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,hu=oe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",_s).replace("tag",Mo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Cd=oe(gs).replace("hr",or).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mo).getRegex(),gu=oe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Cd).getRegex(),bs={blockquote:gu,code:su,def:mu,fences:lu,heading:cu,hr:or,html:hu,lheading:yd,list:uu,newline:au,paragraph:Cd,table:rr,text:pu},md=oe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",or).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mo).getRegex(),fu=he(G({},bs),{lheading:du,table:md,paragraph:oe(gs).replace("hr",or).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",md).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mo).getRegex()}),_u=he(G({},bs),{html:oe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",_s).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:rr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:oe(gs).replace("hr",or).replace("heading",` *#{1,6} *[^
275
- ]`).replace("lheading",yd).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),bu=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vu=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Sd=/^( {2,}|\\)\n(?!\s*$)/,yu=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ko=/[\p{P}\p{S}]/u,vs=/[\s\p{P}\p{S}]/u,xd=/[^\s\p{P}\p{S}]/u,Cu=oe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,vs).getRegex(),wd=/(?!~)[\p{P}\p{S}]/u,Su=/(?!~)[\s\p{P}\p{S}]/u,xu=/(?:[^\s\p{P}\p{S}]|~)/u,wu=/\[(?:[^\[\]`]|`[^`]*?`)*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)|`[^`]*?`|<(?! )[^<>]*?>/g,Td=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Tu=oe(Td,"u").replace(/punct/g,ko).getRegex(),Eu=oe(Td,"u").replace(/punct/g,wd).getRegex(),Ed="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Mu=oe(Ed,"gu").replace(/notPunctSpace/g,xd).replace(/punctSpace/g,vs).replace(/punct/g,ko).getRegex(),ku=oe(Ed,"gu").replace(/notPunctSpace/g,xu).replace(/punctSpace/g,Su).replace(/punct/g,wd).getRegex(),Pu=oe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,xd).replace(/punctSpace/g,vs).replace(/punct/g,ko).getRegex(),Ou=oe(/\\(punct)/,"gu").replace(/punct/g,ko).getRegex(),Au=oe(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Iu=oe(_s).replace("(?:-->|$)","-->").getRegex(),Du=oe("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Iu).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),To=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Ru=oe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",To).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Md=oe(/^!?\[(label)\]\[(ref)\]/).replace("label",To).replace("ref",fs).getRegex(),kd=oe(/^!?\[(ref)\](?:\[\])?/).replace("ref",fs).getRegex(),Nu=oe("reflink|nolink(?!\\()","g").replace("reflink",Md).replace("nolink",kd).getRegex(),ud=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ys={_backpedal:rr,anyPunctuation:Ou,autolink:Au,blockSkip:wu,br:Sd,code:vu,del:rr,emStrongLDelim:Tu,emStrongRDelimAst:Mu,emStrongRDelimUnd:Pu,escape:bu,link:Ru,nolink:kd,punctuation:Cu,reflink:Md,reflinkSearch:Nu,tag:Du,text:yu,url:rr},Fu=he(G({},ys),{link:oe(/^!?\[(label)\]\((.*?)\)/).replace("label",To).getRegex(),reflink:oe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",To).getRegex()}),ds=he(G({},ys),{emStrongRDelimAst:ku,emStrongLDelim:Eu,url:oe(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ud).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:oe(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ud).getRegex()}),Lu=he(G({},ds),{br:oe(Sd).replace("{2,}","*").getRegex(),text:oe(ds.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),wo={normal:bs,gfm:fu,pedantic:_u},tr={normal:ys,gfm:ds,breaks:Lu,pedantic:Fu},ju={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},hd=i=>ju[i];function Kt(i,e){if(e){if(Xe.escapeTest.test(i))return i.replace(Xe.escapeReplace,hd)}else if(Xe.escapeTestNoEncode.test(i))return i.replace(Xe.escapeReplaceNoEncode,hd);return i}function gd(i){try{i=encodeURI(i).replace(Xe.percentDecode,"%")}catch(e){return null}return i}function fd(i,e){let t=i.replace(Xe.findPipe,(o,a,s)=>{let d=!1,m=a;for(;--m>=0&&s[m]==="\\";)d=!d;return d?"|":" |"}),n=t.split(Xe.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(Xe.slashPipe,"|");return n}function nr(i,e,t){let n=i.length;if(n===0)return"";let r=0;for(;r<n;){let o=i.charAt(n-r-1);if(o===e&&!t)r++;else if(o!==e&&t)r++;else break}return i.slice(0,n-r)}function Vu(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<i.length;n++)if(i[n]==="\\")n++;else if(i[n]===e[0])t++;else if(i[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function _d(i,e,t,n,r){let o=e.href,a=e.title||null,s=i[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=!0;let d={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:o,title:a,text:s,tokens:n.inlineTokens(s)};return n.state.inLink=!1,d}function zu(i,e,t){let n=i.match(t.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
276
- `).map(o=>{let a=o.match(t.other.beginningSpace);if(a===null)return o;let[s]=a;return s.length>=r.length?o.slice(r.length):o}).join(`
277
- `)}var Eo=class{options;rules;lexer;constructor(i){this.options=i||Hn}space(i){let e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){let e=this.rules.block.code.exec(i);if(e){let t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:nr(t,`
278
- `)}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],n=zu(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(i){let e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let n=nr(t,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(t=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(i){let e=this.rules.block.hr.exec(i);if(e)return{type:"hr",raw:nr(e[0],`
279
- `)}}blockquote(i){let e=this.rules.block.blockquote.exec(i);if(e){let t=nr(e[0],`
280
- `).split(`
281
- `),n="",r="",o=[];for(;t.length>0;){let a=!1,s=[],d;for(d=0;d<t.length;d++)if(this.rules.other.blockquoteStart.test(t[d]))s.push(t[d]),a=!0;else if(!a)s.push(t[d]);else break;t=t.slice(d);let m=s.join(`
282
- `),_=m.replace(this.rules.other.blockquoteSetextReplace,`
283
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
284
- ${m}`:m,r=r?`${r}
285
- ${_}`:_;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(_,o,!0),this.lexer.state.top=b,t.length===0)break;let y=o.at(-1);if(y?.type==="code")break;if(y?.type==="blockquote"){let k=y,E=k.raw+`
286
- `+t.join(`
287
- `),P=this.blockquote(E);o[o.length-1]=P,n=n.substring(0,n.length-k.raw.length)+P.raw,r=r.substring(0,r.length-k.text.length)+P.text;break}else if(y?.type==="list"){let k=y,E=k.raw+`
288
- `+t.join(`
289
- `),P=this.list(E);o[o.length-1]=P,n=n.substring(0,n.length-y.raw.length)+P.raw,r=r.substring(0,r.length-k.raw.length)+P.raw,t=E.substring(o.at(-1).raw.length).split(`
290
- `);continue}}return{type:"blockquote",raw:n,tokens:o,text:r}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim(),n=t.length>1,r={type:"list",raw:"",ordered:n,start:n?+t.slice(0,-1):"",loose:!1,items:[]};t=n?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=n?t:"[*+-]");let o=this.rules.other.listItemRegex(t),a=!1;for(;i;){let d=!1,m="",_="";if(!(e=o.exec(i))||this.rules.block.hr.test(i))break;m=e[0],i=i.substring(m.length);let b=e[2].split(`
291
- `,1)[0].replace(this.rules.other.listReplaceTabs,pe=>" ".repeat(3*pe.length)),y=i.split(`
292
- `,1)[0],k=!b.trim(),E=0;if(this.options.pedantic?(E=2,_=b.trimStart()):k?E=e[1].length+1:(E=e[2].search(this.rules.other.nonSpaceChar),E=E>4?1:E,_=b.slice(E),E+=e[1].length),k&&this.rules.other.blankLine.test(y)&&(m+=y+`
293
- `,i=i.substring(y.length+1),d=!0),!d){let pe=this.rules.other.nextBulletRegex(E),N=this.rules.other.hrRegex(E),X=this.rules.other.fencesBeginRegex(E),U=this.rules.other.headingBeginRegex(E),Ee=this.rules.other.htmlBeginRegex(E);for(;i;){let de=i.split(`
294
- `,1)[0],xe;if(y=de,this.options.pedantic?(y=y.replace(this.rules.other.listReplaceNesting," "),xe=y):xe=y.replace(this.rules.other.tabCharGlobal," "),X.test(y)||U.test(y)||Ee.test(y)||pe.test(y)||N.test(y))break;if(xe.search(this.rules.other.nonSpaceChar)>=E||!y.trim())_+=`
295
- `+xe.slice(E);else{if(k||b.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||X.test(b)||U.test(b)||N.test(b))break;_+=`
296
- `+y}!k&&!y.trim()&&(k=!0),m+=de+`
297
- `,i=i.substring(de.length+1),b=xe.slice(E)}}r.loose||(a?r.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(a=!0));let P=null,K;this.options.gfm&&(P=this.rules.other.listIsTask.exec(_),P&&(K=P[0]!=="[ ] ",_=_.replace(this.rules.other.listReplaceTask,""))),r.items.push({type:"list_item",raw:m,task:!!P,checked:K,loose:!1,text:_,tokens:[]}),r.raw+=m}let s=r.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let d=0;d<r.items.length;d++)if(this.lexer.state.top=!1,r.items[d].tokens=this.lexer.blockTokens(r.items[d].text,[]),!r.loose){let m=r.items[d].tokens.filter(b=>b.type==="space"),_=m.length>0&&m.some(b=>this.rules.other.anyLine.test(b.raw));r.loose=_}if(r.loose)for(let d=0;d<r.items.length;d++)r.items[d].loose=!0;return r}}html(i){let e=this.rules.block.html.exec(i);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(i){let e=this.rules.block.def.exec(i);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:n,title:r}}}table(i){let e=this.rules.block.table.exec(i);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=fd(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
298
- `):[],o={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===n.length){for(let a of n)this.rules.other.tableAlignRight.test(a)?o.align.push("right"):this.rules.other.tableAlignCenter.test(a)?o.align.push("center"):this.rules.other.tableAlignLeft.test(a)?o.align.push("left"):o.align.push(null);for(let a=0;a<t.length;a++)o.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:o.align[a]});for(let a of r)o.rows.push(fd(a,o.header.length).map((s,d)=>({text:s,tokens:this.lexer.inline(s),header:!1,align:o.align[d]})));return o}}lheading(i){let e=this.rules.block.lheading.exec(i);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(i){let e=this.rules.block.paragraph.exec(i);if(e){let t=e[1].charAt(e[1].length-1)===`
299
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(i){let e=this.rules.inline.tag.exec(i);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(i){let e=this.rules.inline.link.exec(i);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let o=nr(t.slice(0,-1),"\\");if((t.length-o.length)%2===0)return}else{let o=Vu(e[2],"()");if(o===-2)return;if(o>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let n=e[2],r="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(n);o&&(n=o[1],r=o[3])}else r=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?n=n.slice(1):n=n.slice(1,-1)),_d(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[n.toLowerCase()];if(!r){let o=t[0].charAt(0);return{type:"text",raw:o,text:o}}return _d(t,r,t[0],this.lexer,this.rules)}}emStrong(i,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(i);if(!(!n||n[3]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[2])||!t||this.rules.inline.punctuation.exec(t))){let r=[...n[0]].length-1,o,a,s=r,d=0,m=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,e=e.slice(-1*i.length+r);(n=m.exec(e))!=null;){if(o=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!o)continue;if(a=[...o].length,n[3]||n[4]){s+=a;continue}else if((n[5]||n[6])&&r%3&&!((r+a)%3)){d+=a;continue}if(s-=a,s>0)continue;a=Math.min(a,a+s+d);let _=[...n[0]][0].length,b=i.slice(0,r+n.index+_+a);if(Math.min(r,a)%2){let k=b.slice(1,-1);return{type:"em",raw:b,text:k,tokens:this.lexer.inlineTokens(k)}}let y=b.slice(2,-2);return{type:"strong",raw:b,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(i){let e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(t),r=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return n&&r&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(i){let e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i){let e=this.rules.inline.del.exec(i);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(i){let e=this.rules.inline.autolink.exec(i);if(e){let t,n;return e[2]==="@"?(t=e[1],n="mailto:"+t):(t=e[1],n=t),{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}url(i){let e;if(e=this.rules.inline.url.exec(i)){let t,n;if(e[2]==="@")t=e[0],n="mailto:"+t;else{let r;do r=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(r!==e[0]);t=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(i){let e=this.rules.inline.text.exec(i);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},It=class ps{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Hn,this.options.tokenizer=this.options.tokenizer||new Eo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Xe,block:wo.normal,inline:tr.normal};this.options.pedantic?(t.block=wo.pedantic,t.inline=tr.pedantic):this.options.gfm&&(t.block=wo.gfm,this.options.breaks?t.inline=tr.breaks:t.inline=tr.gfm),this.tokenizer.rules=t}static get rules(){return{block:wo,inline:tr}}static lex(e,t){return new ps(t).lex(e)}static lexInline(e,t){return new ps(t).inlineTokens(e)}lex(e){e=e.replace(Xe.carriageReturn,`
300
- `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(Xe.tabCharGlobal," ").replace(Xe.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(a=>(r=a.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let a=t.at(-1);r.raw.length===1&&a!==void 0?a.raw+=`
301
- `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
302
- `)?"":`
303
- `)+r.raw,a.text+=`
304
- `+r.text,this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(`
305
- `)?"":`
306
- `)+r.raw,a.text+=`
307
- `+r.raw,this.inlineQueue.at(-1).src=a.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,s=e.slice(1),d;this.options.extensions.startBlock.forEach(m=>{d=m.call({lexer:this},s),typeof d=="number"&&d>=0&&(a=Math.min(a,d))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(r=this.tokenizer.paragraph(o))){let a=t.at(-1);n&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(`
308
- `)?"":`
309
- `)+r.raw,a.text+=`
310
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=o.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let a=t.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(`
311
- `)?"":`
312
- `)+r.raw,a.text+=`
313
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r);continue}if(e){let a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let s=Object.keys(this.tokens.links);if(s.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)s.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let o=!1,a="";for(;e;){o||(a=""),o=!1;let s;if(this.options.extensions?.inline?.some(m=>(s=m.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.escape(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.tag(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.link(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(s.raw.length);let m=t.at(-1);s.type==="text"&&m?.type==="text"?(m.raw+=s.raw,m.text+=s.text):t.push(s);continue}if(s=this.tokenizer.emStrong(e,n,a)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.codespan(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.br(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.del(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.autolink(e)){e=e.substring(s.raw.length),t.push(s);continue}if(!this.state.inLink&&(s=this.tokenizer.url(e))){e=e.substring(s.raw.length),t.push(s);continue}let d=e;if(this.options.extensions?.startInline){let m=1/0,_=e.slice(1),b;this.options.extensions.startInline.forEach(y=>{b=y.call({lexer:this},_),typeof b=="number"&&b>=0&&(m=Math.min(m,b))}),m<1/0&&m>=0&&(d=e.substring(0,m+1))}if(s=this.tokenizer.inlineText(d)){e=e.substring(s.raw.length),s.raw.slice(-1)!=="_"&&(a=s.raw.slice(-1)),o=!0;let m=t.at(-1);m?.type==="text"?(m.raw+=s.raw,m.text+=s.text):t.push(s);continue}if(e){let m="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return t}},Ci=class{options;parser;constructor(i){this.options=i||Hn}space(i){return""}code({text:i,lang:e,escaped:t}){let n=(e||"").match(Xe.notSpaceStart)?.[0],r=i.replace(Xe.endingNewline,"")+`
314
- `;return n?'<pre><code class="language-'+Kt(n)+'">'+(t?r:Kt(r,!0))+`</code></pre>
315
- `:"<pre><code>"+(t?r:Kt(r,!0))+`</code></pre>
316
- `}blockquote({tokens:i}){return`<blockquote>
317
- ${this.parser.parse(i)}</blockquote>
318
- `}html({text:i}){return i}def(i){return""}heading({tokens:i,depth:e}){return`<h${e}>${this.parser.parseInline(i)}</h${e}>
319
- `}hr(i){return`<hr>
320
- `}list(i){let e=i.ordered,t=i.start,n="";for(let a=0;a<i.items.length;a++){let s=i.items[a];n+=this.listitem(s)}let r=e?"ol":"ul",o=e&&t!==1?' start="'+t+'"':"";return"<"+r+o+`>
321
- `+n+"</"+r+`>
322
- `}listitem(i){let e="";if(i.task){let t=this.checkbox({checked:!!i.checked});i.loose?i.tokens[0]?.type==="paragraph"?(i.tokens[0].text=t+" "+i.tokens[0].text,i.tokens[0].tokens&&i.tokens[0].tokens.length>0&&i.tokens[0].tokens[0].type==="text"&&(i.tokens[0].tokens[0].text=t+" "+Kt(i.tokens[0].tokens[0].text),i.tokens[0].tokens[0].escaped=!0)):i.tokens.unshift({type:"text",raw:t+" ",text:t+" ",escaped:!0}):e+=t+" "}return e+=this.parser.parse(i.tokens,!!i.loose),`<li>${e}</li>
323
- `}checkbox({checked:i}){return"<input "+(i?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:i}){return`<p>${this.parser.parseInline(i)}</p>
324
- `}table(i){let e="",t="";for(let r=0;r<i.header.length;r++)t+=this.tablecell(i.header[r]);e+=this.tablerow({text:t});let n="";for(let r=0;r<i.rows.length;r++){let o=i.rows[r];t="";for(let a=0;a<o.length;a++)t+=this.tablecell(o[a]);n+=this.tablerow({text:t})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
325
- <thead>
326
- `+e+`</thead>
327
- `+n+`</table>
328
- `}tablerow({text:i}){return`<tr>
329
- ${i}</tr>
330
- `}tablecell(i){let e=this.parser.parseInline(i.tokens),t=i.header?"th":"td";return(i.align?`<${t} align="${i.align}">`:`<${t}>`)+e+`</${t}>
331
- `}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${Kt(i,!0)}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let n=this.parser.parseInline(t),r=gd(i);if(r===null)return n;i=r;let o='<a href="'+i+'"';return e&&(o+=' title="'+Kt(e)+'"'),o+=">"+n+"</a>",o}image({href:i,title:e,text:t,tokens:n}){n&&(t=this.parser.parseInline(n,this.parser.textRenderer));let r=gd(i);if(r===null)return Kt(t);i=r;let o=`<img src="${i}" alt="${t}"`;return e&&(o+=` title="${Kt(e)}"`),o+=">",o}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):"escaped"in i&&i.escaped?i.text:Kt(i.text)}},Cs=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}},Dt=class ms{options;renderer;textRenderer;constructor(e){this.options=e||Hn,this.options.renderer=this.options.renderer||new Ci,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Cs}static parse(e,t){return new ms(t).parse(e)}static parseInline(e,t){return new ms(t).parseInline(e)}parse(e,t=!0){let n="";for(let r=0;r<e.length;r++){let o=e[r];if(this.options.extensions?.renderers?.[o.type]){let s=o,d=this.options.extensions.renderers[s.type].call({parser:this},s);if(d!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(s.type)){n+=d||"";continue}}let a=o;switch(a.type){case"space":{n+=this.renderer.space(a);continue}case"hr":{n+=this.renderer.hr(a);continue}case"heading":{n+=this.renderer.heading(a);continue}case"code":{n+=this.renderer.code(a);continue}case"table":{n+=this.renderer.table(a);continue}case"blockquote":{n+=this.renderer.blockquote(a);continue}case"list":{n+=this.renderer.list(a);continue}case"html":{n+=this.renderer.html(a);continue}case"def":{n+=this.renderer.def(a);continue}case"paragraph":{n+=this.renderer.paragraph(a);continue}case"text":{let s=a,d=this.renderer.text(s);for(;r+1<e.length&&e[r+1].type==="text";)s=e[++r],d+=`
332
- `+this.renderer.text(s);t?n+=this.renderer.paragraph({type:"paragraph",raw:d,text:d,tokens:[{type:"text",raw:d,text:d,escaped:!0}]}):n+=d;continue}default:{let s='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let o=e[r];if(this.options.extensions?.renderers?.[o.type]){let s=this.options.extensions.renderers[o.type].call({parser:this},o);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){n+=s||"";continue}}let a=o;switch(a.type){case"escape":{n+=t.text(a);break}case"html":{n+=t.html(a);break}case"link":{n+=t.link(a);break}case"image":{n+=t.image(a);break}case"strong":{n+=t.strong(a);break}case"em":{n+=t.em(a);break}case"codespan":{n+=t.codespan(a);break}case"br":{n+=t.br(a);break}case"del":{n+=t.del(a);break}case"text":{n+=t.text(a);break}default:{let s='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return n}},ir=class{options;block;constructor(i){this.options=i||Hn}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}emStrongMask(i){return i}provideLexer(){return this.block?It.lex:It.lexInline}provideParser(){return this.block?Dt.parse:Dt.parseInline}},$u=class{defaults=us();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Dt;Renderer=Ci;TextRenderer=Cs;Lexer=It;Tokenizer=Eo;Hooks=ir;constructor(...i){this.use(...i)}walkTokens(i,e){let t=[];for(let n of i)switch(t=t.concat(e.call(this,n)),n.type){case"table":{let r=n;for(let o of r.header)t=t.concat(this.walkTokens(o.tokens,e));for(let o of r.rows)for(let a of o)t=t.concat(this.walkTokens(a.tokens,e));break}case"list":{let r=n;t=t.concat(this.walkTokens(r.items,e));break}default:{let r=n;this.defaults.extensions?.childTokens?.[r.type]?this.defaults.extensions.childTokens[r.type].forEach(o=>{let a=r[o].flat(1/0);t=t.concat(this.walkTokens(a,e))}):r.tokens&&(t=t.concat(this.walkTokens(r.tokens,e)))}}return t}use(...i){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{let n=G({},t);if(n.async=this.defaults.async||n.async||!1,t.extensions&&(t.extensions.forEach(r=>{if(!r.name)throw new Error("extension name required");if("renderer"in r){let o=e.renderers[r.name];o?e.renderers[r.name]=function(...a){let s=r.renderer.apply(this,a);return s===!1&&(s=o.apply(this,a)),s}:e.renderers[r.name]=r.renderer}if("tokenizer"in r){if(!r.level||r.level!=="block"&&r.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=e[r.level];o?o.unshift(r.tokenizer):e[r.level]=[r.tokenizer],r.start&&(r.level==="block"?e.startBlock?e.startBlock.push(r.start):e.startBlock=[r.start]:r.level==="inline"&&(e.startInline?e.startInline.push(r.start):e.startInline=[r.start]))}"childTokens"in r&&r.childTokens&&(e.childTokens[r.name]=r.childTokens)}),n.extensions=e),t.renderer){let r=this.defaults.renderer||new Ci(this.defaults);for(let o in t.renderer){if(!(o in r))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,s=t.renderer[a],d=r[a];r[a]=(...m)=>{let _=s.apply(r,m);return _===!1&&(_=d.apply(r,m)),_||""}}n.renderer=r}if(t.tokenizer){let r=this.defaults.tokenizer||new Eo(this.defaults);for(let o in t.tokenizer){if(!(o in r))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,s=t.tokenizer[a],d=r[a];r[a]=(...m)=>{let _=s.apply(r,m);return _===!1&&(_=d.apply(r,m)),_}}n.tokenizer=r}if(t.hooks){let r=this.defaults.hooks||new ir;for(let o in t.hooks){if(!(o in r))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,s=t.hooks[a],d=r[a];ir.passThroughHooks.has(o)?r[a]=m=>{if(this.defaults.async&&ir.passThroughHooksRespectAsync.has(o))return B(this,null,function*(){let b=yield s.call(r,m);return d.call(r,b)});let _=s.call(r,m);return d.call(r,_)}:r[a]=(...m)=>{if(this.defaults.async)return B(this,null,function*(){let b=yield s.apply(r,m);return b===!1&&(b=yield d.apply(r,m)),b});let _=s.apply(r,m);return _===!1&&(_=d.apply(r,m)),_}}n.hooks=r}if(t.walkTokens){let r=this.defaults.walkTokens,o=t.walkTokens;n.walkTokens=function(a){let s=[];return s.push(o.call(this,a)),r&&(s=s.concat(r.call(this,a))),s}}this.defaults=G(G({},this.defaults),n)}),this}setOptions(i){return this.defaults=G(G({},this.defaults),i),this}lexer(i,e){return It.lex(i,e??this.defaults)}parser(i,e){return Dt.parse(i,e??this.defaults)}parseMarkdown(i){return(e,t)=>{let n=G({},t),r=G(G({},this.defaults),n),o=this.onError(!!r.silent,!!r.async);if(this.defaults.async===!0&&n.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(r.hooks&&(r.hooks.options=r,r.hooks.block=i),r.async)return B(this,null,function*(){let a=r.hooks?yield r.hooks.preprocess(e):e,s=yield(r.hooks?yield r.hooks.provideLexer():i?It.lex:It.lexInline)(a,r),d=r.hooks?yield r.hooks.processAllTokens(s):s;r.walkTokens&&(yield Promise.all(this.walkTokens(d,r.walkTokens)));let m=yield(r.hooks?yield r.hooks.provideParser():i?Dt.parse:Dt.parseInline)(d,r);return r.hooks?yield r.hooks.postprocess(m):m}).catch(o);try{r.hooks&&(e=r.hooks.preprocess(e));let a=(r.hooks?r.hooks.provideLexer():i?It.lex:It.lexInline)(e,r);r.hooks&&(a=r.hooks.processAllTokens(a)),r.walkTokens&&this.walkTokens(a,r.walkTokens);let s=(r.hooks?r.hooks.provideParser():i?Dt.parse:Dt.parseInline)(a,r);return r.hooks&&(s=r.hooks.postprocess(s)),s}catch(a){return o(a)}}}onError(i,e){return t=>{if(t.message+=`
333
- Please report this to https://github.com/markedjs/marked.`,i){let n="<p>An error occurred:</p><pre>"+Kt(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},Bn=new $u;function le(i,e){return Bn.parse(i,e)}le.options=le.setOptions=function(i){return Bn.setOptions(i),le.defaults=Bn.defaults,bd(le.defaults),le};le.getDefaults=us;le.defaults=Hn;le.use=function(...i){return Bn.use(...i),le.defaults=Bn.defaults,bd(le.defaults),le};le.walkTokens=function(i,e){return Bn.walkTokens(i,e)};le.parseInline=Bn.parseInline;le.Parser=Dt;le.parser=Dt.parse;le.Renderer=Ci;le.TextRenderer=Cs;le.Lexer=It;le.lexer=It.lex;le.Tokenizer=Eo;le.Hooks=ir;le.parse=le;var bC=le.options,vC=le.setOptions,yC=le.use,CC=le.walkTokens,SC=le.parseInline;var xC=Dt.parse,wC=It.lex;var{entries:Ld,setPrototypeOf:Pd,isFrozen:Bu,getPrototypeOf:Hu,getOwnPropertyDescriptor:Uu}=Object,{freeze:Ze,seal:Ct,create:ks}=Object,{apply:Ps,construct:Os}=typeof Reflect<"u"&&Reflect;Ze||(Ze=function(e){return e});Ct||(Ct=function(e){return e});Ps||(Ps=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return e.apply(t,r)});Os||(Os=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});var Po=et(Array.prototype.forEach),Wu=et(Array.prototype.lastIndexOf),Od=et(Array.prototype.pop),ar=et(Array.prototype.push),qu=et(Array.prototype.splice),Ao=et(String.prototype.toLowerCase),Ss=et(String.prototype.toString),xs=et(String.prototype.match),sr=et(String.prototype.replace),Gu=et(String.prototype.indexOf),Yu=et(String.prototype.trim),Rt=et(Object.prototype.hasOwnProperty),Je=et(RegExp.prototype.test),lr=Qu(TypeError);function et(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ps(i,e,n)}}function Qu(i){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Os(i,t)}}function Q(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ao;Pd&&Pd(i,null);let n=e.length;for(;n--;){let r=e[n];if(typeof r=="string"){let o=t(r);o!==r&&(Bu(e)||(e[n]=o),r=o)}i[r]=!0}return i}function Ku(i){for(let e=0;e<i.length;e++)Rt(i,e)||(i[e]=null);return i}function Xt(i){let e=ks(null);for(let[t,n]of Ld(i))Rt(i,t)&&(Array.isArray(n)?e[t]=Ku(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=Xt(n):e[t]=n);return e}function cr(i,e){for(;i!==null;){let n=Uu(i,e);if(n){if(n.get)return et(n.get);if(typeof n.value=="function")return et(n.value)}i=Hu(i)}function t(){return null}return t}var Ad=Ze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),ws=Ze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ts=Ze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Xu=Ze(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Es=Ze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Ju=Ze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Id=Ze(["#text"]),Dd=Ze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ms=Ze(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Rd=Ze(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Oo=Ze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Zu=Ct(/\{\{[\w\W]*|[\w\W]*\}\}/gm),eh=Ct(/<%[\w\W]*|[\w\W]*%>/gm),th=Ct(/\$\{[\w\W]*/gm),nh=Ct(/^data-[\-\w.\u00B7-\uFFFF]+$/),ih=Ct(/^aria-[\-\w]+$/),jd=Ct(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),rh=Ct(/^(?:\w+script|data):/i),oh=Ct(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Vd=Ct(/^html$/i),ah=Ct(/^[a-z][.\w]*(-[.\w]+)+$/i),Nd=Object.freeze({__proto__:null,ARIA_ATTR:ih,ATTR_WHITESPACE:oh,CUSTOM_ELEMENT:ah,DATA_ATTR:nh,DOCTYPE_NAME:Vd,ERB_EXPR:eh,IS_ALLOWED_URI:jd,IS_SCRIPT_OR_DATA:rh,MUSTACHE_EXPR:Zu,TMPLIT_EXPR:th}),dr={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},sh=function(){return typeof window>"u"?null:window},lh=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null,r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML(a){return a},createScriptURL(a){return a}})}catch(a){return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Fd=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function zd(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:sh(),e=V=>zd(V);if(e.version="3.3.1",e.removed=[],!i||!i.document||i.document.nodeType!==dr.document||!i.Element)return e.isSupported=!1,e;let{document:t}=i,n=t,r=n.currentScript,{DocumentFragment:o,HTMLTemplateElement:a,Node:s,Element:d,NodeFilter:m,NamedNodeMap:_=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:b,DOMParser:y,trustedTypes:k}=i,E=d.prototype,P=cr(E,"cloneNode"),K=cr(E,"remove"),pe=cr(E,"nextSibling"),N=cr(E,"childNodes"),X=cr(E,"parentNode");if(typeof a=="function"){let V=t.createElement("template");V.content&&V.content.ownerDocument&&(t=V.content.ownerDocument)}let U,Ee="",{implementation:de,createNodeIterator:xe,createDocumentFragment:He,getElementsByTagName:Zt}=t,{importNode:dn}=n,Ve=Fd();e.isSupported=typeof Ld=="function"&&typeof X=="function"&&de&&de.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:St,ERB_EXPR:wn,TMPLIT_EXPR:qn,DATA_ATTR:br,ARIA_ATTR:A,IS_SCRIPT_OR_DATA:j,ATTR_WHITESPACE:$,CUSTOM_ELEMENT:ee}=Nd,{IS_ALLOWED_URI:Oe}=Nd,ce=null,Ue=Q({},[...Ad,...ws,...Ts,...Es,...Id]),me=null,ue=Q({},[...Dd,...Ms,...Rd,...Oo]),_e=Object.seal(ks(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Tn=null,De=null,tt=Object.seal(ks(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Qe=!0,pn=!0,Gn=!1,Vs=!0,Yn=!1,vr=!0,En=!1,oa=!1,aa=!1,Qn=!1,yr=!1,Cr=!1,zs=!0,$s=!1,Ip="user-content-",sa=!0,zi=!1,Kn={},Nt=null,la=Q({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Bs=null,Hs=Q({},["audio","video","img","source","image","track"]),ca=null,Us=Q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Sr="http://www.w3.org/1998/Math/MathML",xr="http://www.w3.org/2000/svg",en="http://www.w3.org/1999/xhtml",Xn=en,da=!1,pa=null,Dp=Q({},[Sr,xr,en],Ss),wr=Q({},["mi","mo","mn","ms","mtext"]),Tr=Q({},["annotation-xml"]),Rp=Q({},["title","style","font","a","script"]),$i=null,Np=["application/xhtml+xml","text/html"],Fp="text/html",Le=null,Jn=null,Lp=t.createElement("form"),Ws=function(g){return g instanceof RegExp||g instanceof Function},ma=function(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Jn&&Jn===g)){if((!g||typeof g!="object")&&(g={}),g=Xt(g),$i=Np.indexOf(g.PARSER_MEDIA_TYPE)===-1?Fp:g.PARSER_MEDIA_TYPE,Le=$i==="application/xhtml+xml"?Ss:Ao,ce=Rt(g,"ALLOWED_TAGS")?Q({},g.ALLOWED_TAGS,Le):Ue,me=Rt(g,"ALLOWED_ATTR")?Q({},g.ALLOWED_ATTR,Le):ue,pa=Rt(g,"ALLOWED_NAMESPACES")?Q({},g.ALLOWED_NAMESPACES,Ss):Dp,ca=Rt(g,"ADD_URI_SAFE_ATTR")?Q(Xt(Us),g.ADD_URI_SAFE_ATTR,Le):Us,Bs=Rt(g,"ADD_DATA_URI_TAGS")?Q(Xt(Hs),g.ADD_DATA_URI_TAGS,Le):Hs,Nt=Rt(g,"FORBID_CONTENTS")?Q({},g.FORBID_CONTENTS,Le):la,Tn=Rt(g,"FORBID_TAGS")?Q({},g.FORBID_TAGS,Le):Xt({}),De=Rt(g,"FORBID_ATTR")?Q({},g.FORBID_ATTR,Le):Xt({}),Kn=Rt(g,"USE_PROFILES")?g.USE_PROFILES:!1,Qe=g.ALLOW_ARIA_ATTR!==!1,pn=g.ALLOW_DATA_ATTR!==!1,Gn=g.ALLOW_UNKNOWN_PROTOCOLS||!1,Vs=g.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Yn=g.SAFE_FOR_TEMPLATES||!1,vr=g.SAFE_FOR_XML!==!1,En=g.WHOLE_DOCUMENT||!1,Qn=g.RETURN_DOM||!1,yr=g.RETURN_DOM_FRAGMENT||!1,Cr=g.RETURN_TRUSTED_TYPE||!1,aa=g.FORCE_BODY||!1,zs=g.SANITIZE_DOM!==!1,$s=g.SANITIZE_NAMED_PROPS||!1,sa=g.KEEP_CONTENT!==!1,zi=g.IN_PLACE||!1,Oe=g.ALLOWED_URI_REGEXP||jd,Xn=g.NAMESPACE||en,wr=g.MATHML_TEXT_INTEGRATION_POINTS||wr,Tr=g.HTML_INTEGRATION_POINTS||Tr,_e=g.CUSTOM_ELEMENT_HANDLING||{},g.CUSTOM_ELEMENT_HANDLING&&Ws(g.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(_e.tagNameCheck=g.CUSTOM_ELEMENT_HANDLING.tagNameCheck),g.CUSTOM_ELEMENT_HANDLING&&Ws(g.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(_e.attributeNameCheck=g.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),g.CUSTOM_ELEMENT_HANDLING&&typeof g.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(_e.allowCustomizedBuiltInElements=g.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Yn&&(pn=!1),yr&&(Qn=!0),Kn&&(ce=Q({},Id),me=[],Kn.html===!0&&(Q(ce,Ad),Q(me,Dd)),Kn.svg===!0&&(Q(ce,ws),Q(me,Ms),Q(me,Oo)),Kn.svgFilters===!0&&(Q(ce,Ts),Q(me,Ms),Q(me,Oo)),Kn.mathMl===!0&&(Q(ce,Es),Q(me,Rd),Q(me,Oo))),g.ADD_TAGS&&(typeof g.ADD_TAGS=="function"?tt.tagCheck=g.ADD_TAGS:(ce===Ue&&(ce=Xt(ce)),Q(ce,g.ADD_TAGS,Le))),g.ADD_ATTR&&(typeof g.ADD_ATTR=="function"?tt.attributeCheck=g.ADD_ATTR:(me===ue&&(me=Xt(me)),Q(me,g.ADD_ATTR,Le))),g.ADD_URI_SAFE_ATTR&&Q(ca,g.ADD_URI_SAFE_ATTR,Le),g.FORBID_CONTENTS&&(Nt===la&&(Nt=Xt(Nt)),Q(Nt,g.FORBID_CONTENTS,Le)),g.ADD_FORBID_CONTENTS&&(Nt===la&&(Nt=Xt(Nt)),Q(Nt,g.ADD_FORBID_CONTENTS,Le)),sa&&(ce["#text"]=!0),En&&Q(ce,["html","head","body"]),ce.table&&(Q(ce,["tbody"]),delete Tn.tbody),g.TRUSTED_TYPES_POLICY){if(typeof g.TRUSTED_TYPES_POLICY.createHTML!="function")throw lr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof g.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw lr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');U=g.TRUSTED_TYPES_POLICY,Ee=U.createHTML("")}else U===void 0&&(U=lh(k,r)),U!==null&&typeof Ee=="string"&&(Ee=U.createHTML(""));Ze&&Ze(g),Jn=g}},qs=Q({},[...ws,...Ts,...Xu]),Gs=Q({},[...Es,...Ju]),jp=function(g){let M=X(g);(!M||!M.tagName)&&(M={namespaceURI:Xn,tagName:"template"});let R=Ao(g.tagName),be=Ao(M.tagName);return pa[g.namespaceURI]?g.namespaceURI===xr?M.namespaceURI===en?R==="svg":M.namespaceURI===Sr?R==="svg"&&(be==="annotation-xml"||wr[be]):!!qs[R]:g.namespaceURI===Sr?M.namespaceURI===en?R==="math":M.namespaceURI===xr?R==="math"&&Tr[be]:!!Gs[R]:g.namespaceURI===en?M.namespaceURI===xr&&!Tr[be]||M.namespaceURI===Sr&&!wr[be]?!1:!Gs[R]&&(Rp[R]||!qs[R]):!!($i==="application/xhtml+xml"&&pa[g.namespaceURI]):!1},Ft=function(g){ar(e.removed,{element:g});try{X(g).removeChild(g)}catch(M){K(g)}},Mn=function(g,M){try{ar(e.removed,{attribute:M.getAttributeNode(g),from:M})}catch(R){ar(e.removed,{attribute:null,from:M})}if(M.removeAttribute(g),g==="is")if(Qn||yr)try{Ft(M)}catch(R){}else try{M.setAttribute(g,"")}catch(R){}},Ys=function(g){let M=null,R=null;if(aa)g="<remove></remove>"+g;else{let Re=xs(g,/^[\r\n\t ]+/);R=Re&&Re[0]}$i==="application/xhtml+xml"&&Xn===en&&(g='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+g+"</body></html>");let be=U?U.createHTML(g):g;if(Xn===en)try{M=new y().parseFromString(be,$i)}catch(Re){}if(!M||!M.documentElement){M=de.createDocument(Xn,"template",null);try{M.documentElement.innerHTML=da?Ee:be}catch(Re){}}let We=M.body||M.documentElement;return g&&R&&We.insertBefore(t.createTextNode(R),We.childNodes[0]||null),Xn===en?Zt.call(M,En?"html":"body")[0]:En?M.documentElement:We},Qs=function(g){return xe.call(g.ownerDocument||g,g,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT|m.SHOW_PROCESSING_INSTRUCTION|m.SHOW_CDATA_SECTION,null)},ua=function(g){return g instanceof b&&(typeof g.nodeName!="string"||typeof g.textContent!="string"||typeof g.removeChild!="function"||!(g.attributes instanceof _)||typeof g.removeAttribute!="function"||typeof g.setAttribute!="function"||typeof g.namespaceURI!="string"||typeof g.insertBefore!="function"||typeof g.hasChildNodes!="function")},Ks=function(g){return typeof s=="function"&&g instanceof s};function tn(V,g,M){Po(V,R=>{R.call(e,g,M,Jn)})}let Xs=function(g){let M=null;if(tn(Ve.beforeSanitizeElements,g,null),ua(g))return Ft(g),!0;let R=Le(g.nodeName);if(tn(Ve.uponSanitizeElement,g,{tagName:R,allowedTags:ce}),vr&&g.hasChildNodes()&&!Ks(g.firstElementChild)&&Je(/<[/\w!]/g,g.innerHTML)&&Je(/<[/\w!]/g,g.textContent)||g.nodeType===dr.progressingInstruction||vr&&g.nodeType===dr.comment&&Je(/<[/\w]/g,g.data))return Ft(g),!0;if(!(tt.tagCheck instanceof Function&&tt.tagCheck(R))&&(!ce[R]||Tn[R])){if(!Tn[R]&&Zs(R)&&(_e.tagNameCheck instanceof RegExp&&Je(_e.tagNameCheck,R)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(R)))return!1;if(sa&&!Nt[R]){let be=X(g)||g.parentNode,We=N(g)||g.childNodes;if(We&&be){let Re=We.length;for(let nt=Re-1;nt>=0;--nt){let nn=P(We[nt],!0);nn.__removalCount=(g.__removalCount||0)+1,be.insertBefore(nn,pe(g))}}}return Ft(g),!0}return g instanceof d&&!jp(g)||(R==="noscript"||R==="noembed"||R==="noframes")&&Je(/<\/no(script|embed|frames)/i,g.innerHTML)?(Ft(g),!0):(Yn&&g.nodeType===dr.text&&(M=g.textContent,Po([St,wn,qn],be=>{M=sr(M,be," ")}),g.textContent!==M&&(ar(e.removed,{element:g.cloneNode()}),g.textContent=M)),tn(Ve.afterSanitizeElements,g,null),!1)},Js=function(g,M,R){if(zs&&(M==="id"||M==="name")&&(R in t||R in Lp))return!1;if(!(pn&&!De[M]&&Je(br,M))){if(!(Qe&&Je(A,M))){if(!(tt.attributeCheck instanceof Function&&tt.attributeCheck(M,g))){if(!me[M]||De[M]){if(!(Zs(g)&&(_e.tagNameCheck instanceof RegExp&&Je(_e.tagNameCheck,g)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(g))&&(_e.attributeNameCheck instanceof RegExp&&Je(_e.attributeNameCheck,M)||_e.attributeNameCheck instanceof Function&&_e.attributeNameCheck(M,g))||M==="is"&&_e.allowCustomizedBuiltInElements&&(_e.tagNameCheck instanceof RegExp&&Je(_e.tagNameCheck,R)||_e.tagNameCheck instanceof Function&&_e.tagNameCheck(R))))return!1}else if(!ca[M]){if(!Je(Oe,sr(R,$,""))){if(!((M==="src"||M==="xlink:href"||M==="href")&&g!=="script"&&Gu(R,"data:")===0&&Bs[g])){if(!(Gn&&!Je(j,sr(R,$,"")))){if(R)return!1}}}}}}}return!0},Zs=function(g){return g!=="annotation-xml"&&xs(g,ee)},el=function(g){tn(Ve.beforeSanitizeAttributes,g,null);let{attributes:M}=g;if(!M||ua(g))return;let R={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:me,forceKeepAttr:void 0},be=M.length;for(;be--;){let We=M[be],{name:Re,namespaceURI:nt,value:nn}=We,Zn=Le(Re),ha=nn,$e=Re==="value"?ha:Yu(ha);if(R.attrName=Zn,R.attrValue=$e,R.keepAttr=!0,R.forceKeepAttr=void 0,tn(Ve.uponSanitizeAttribute,g,R),$e=R.attrValue,$s&&(Zn==="id"||Zn==="name")&&(Mn(Re,g),$e=Ip+$e),vr&&Je(/((--!?|])>)|<\/(style|title|textarea)/i,$e)){Mn(Re,g);continue}if(Zn==="attributename"&&xs($e,"href")){Mn(Re,g);continue}if(R.forceKeepAttr)continue;if(!R.keepAttr){Mn(Re,g);continue}if(!Vs&&Je(/\/>/i,$e)){Mn(Re,g);continue}Yn&&Po([St,wn,qn],nl=>{$e=sr($e,nl," ")});let tl=Le(g.nodeName);if(!Js(tl,Zn,$e)){Mn(Re,g);continue}if(U&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!nt)switch(k.getAttributeType(tl,Zn)){case"TrustedHTML":{$e=U.createHTML($e);break}case"TrustedScriptURL":{$e=U.createScriptURL($e);break}}if($e!==ha)try{nt?g.setAttributeNS(nt,Re,$e):g.setAttribute(Re,$e),ua(g)?Ft(g):Od(e.removed)}catch(nl){Mn(Re,g)}}tn(Ve.afterSanitizeAttributes,g,null)},Vp=function V(g){let M=null,R=Qs(g);for(tn(Ve.beforeSanitizeShadowDOM,g,null);M=R.nextNode();)tn(Ve.uponSanitizeShadowNode,M,null),Xs(M),el(M),M.content instanceof o&&V(M.content);tn(Ve.afterSanitizeShadowDOM,g,null)};return e.sanitize=function(V){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},M=null,R=null,be=null,We=null;if(da=!V,da&&(V="<!-->"),typeof V!="string"&&!Ks(V))if(typeof V.toString=="function"){if(V=V.toString(),typeof V!="string")throw lr("dirty is not a string, aborting")}else throw lr("toString is not a function");if(!e.isSupported)return V;if(oa||ma(g),e.removed=[],typeof V=="string"&&(zi=!1),zi){if(V.nodeName){let nn=Le(V.nodeName);if(!ce[nn]||Tn[nn])throw lr("root node is forbidden and cannot be sanitized in-place")}}else if(V instanceof s)M=Ys("<!---->"),R=M.ownerDocument.importNode(V,!0),R.nodeType===dr.element&&R.nodeName==="BODY"||R.nodeName==="HTML"?M=R:M.appendChild(R);else{if(!Qn&&!Yn&&!En&&V.indexOf("<")===-1)return U&&Cr?U.createHTML(V):V;if(M=Ys(V),!M)return Qn?null:Cr?Ee:""}M&&aa&&Ft(M.firstChild);let Re=Qs(zi?V:M);for(;be=Re.nextNode();)Xs(be),el(be),be.content instanceof o&&Vp(be.content);if(zi)return V;if(Qn){if(yr)for(We=He.call(M.ownerDocument);M.firstChild;)We.appendChild(M.firstChild);else We=M;return(me.shadowroot||me.shadowrootmode)&&(We=dn.call(n,We,!0)),We}let nt=En?M.outerHTML:M.innerHTML;return En&&ce["!doctype"]&&M.ownerDocument&&M.ownerDocument.doctype&&M.ownerDocument.doctype.name&&Je(Vd,M.ownerDocument.doctype.name)&&(nt="<!DOCTYPE "+M.ownerDocument.doctype.name+`>
334
- `+nt),Yn&&Po([St,wn,qn],nn=>{nt=sr(nt,nn," ")}),U&&Cr?U.createHTML(nt):nt},e.setConfig=function(){let V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ma(V),oa=!0},e.clearConfig=function(){Jn=null,oa=!1},e.isValidAttribute=function(V,g,M){Jn||ma({});let R=Le(V),be=Le(g);return Js(R,be,M)},e.addHook=function(V,g){typeof g=="function"&&ar(Ve[V],g)},e.removeHook=function(V,g){if(g!==void 0){let M=Wu(Ve[V],g);return M===-1?void 0:qu(Ve[V],M,1)[0]}return Od(Ve[V])},e.removeHooks=function(V){Ve[V]=[]},e.removeAllHooks=function(){Ve=Fd()},e}var $d=zd();var Jt=class i{renderer;constructor(){this.renderer=new Ci,this.configureRenderer()}configureRenderer(){let e=this.renderer.link.bind(this.renderer);this.renderer.link=t=>{let n=this.isExternalLink(t.href),r=e(t);if(n){r=r.replace("<a ",'<a target="_blank" rel="noopener noreferrer" ');let o=t.title?`${t.text} - ${t.title} (opens in new tab)`:`${t.text} (opens in new tab)`;r=r.replace("<a ",`<a aria-label="${this.escapeHtml(o)}" `),r=r.replace("</a>",'<span class="external-link-icon" aria-hidden="true">\u2197</span></a>')}return r}}isExternalLink(e){if(!e||e.startsWith("/")||e.startsWith("#")||e.startsWith("?"))return!1;if(e.startsWith("//"))return!0;try{return new URL(e,window.location.href).hostname!==window.location.hostname}catch(t){return!1}}escapeHtml(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return e.replace(/[&<>"']/g,n=>t[n]||n)}parse(e){return B(this,null,function*(){let t=yield le.parse(e,{renderer:this.renderer,breaks:!0,gfm:!0});return $d.sanitize(t,{ADD_TAGS:["span"],ADD_ATTR:["aria-hidden","aria-label","target","rel"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i})})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var ch=i=>({"user-message-wrapper":i});function dh(i,e){if(i&1&&(l(0,"div",5)(1,"div",9),u(2),c()()),i&2){let t=h(2);p(2),Ne(" ",t.message.speaker," ")}}function ph(i,e){if(i&1&&(l(0,"time",7),u(1),c()),i&2){let t=h(2);p(),L(t.formattedTimestamp)}}function mh(i,e){if(i&1&&(l(0,"div",8),F(1,"app-message-context-menu",10),c()),i&2){let t=h(2);p(),T("actions",t.actions)}}function uh(i,e){if(i&1&&(C(0,dh,3,1,"div",5),F(1,"div",6),C(2,ph,2,1,"time",7),C(3,mh,2,1,"div",8)),i&2){let t=h();S(t.shouldShowSpeaker?0:-1),p(),T("innerHTML",t.renderedContent,ut),p(),S(t.formattedTimestamp?2:-1),p(),S(t.isLongMessage&&t.shouldShowActions&&t.message.role==="assistant"?3:-1)}}function hh(i,e){if(i&1&&(l(0,"a",12),u(1,"view"),c()),i&2){let t=h(2);T("href",t.eventLink,On)}}function gh(i,e){if(i&1&&(l(0,"div",2),F(1,"span",11),C(2,hh,2,1,"a",12),c()),i&2){let t=h();p(),T("innerHTML",t.renderedContent,ut),p(),S(t.eventLink?2:-1)}}function fh(i,e){if(i&1&&(l(0,"div",3),F(1,"app-message-context-menu",10),c()),i&2){let t=h();p(),T("actions",t.actions)}}function _h(i,e){if(i&1&&(l(0,"div",4),F(1,"app-message-context-menu",10),c()),i&2){let t=h();p(),T("actions",t.actions)}}var Si=class i{destroy$=new J;message;canDelete=!0;isOtherUser=!1;copyRequested=new Z;deleteRequested=new Z;renderedContent="";shouldHideTechnical=!1;shouldHideWarning=!1;sanitizer=f(Vt);notificationService=f(gi);preferencesService=f(Pe);projectState=f(ye);threadState=f(Ye);markdownService=f(Jt);get messageClasses(){return{[this.message.role]:!0,[this.message.type]:!0,"hidden-technical":this.shouldHideTechnical&&this.message.type==="technical","hidden-warning":this.shouldHideWarning&&this.message.type==="warning","other-user":this.isOtherUser}}ngOnInit(){return B(this,null,function*(){yield this.renderMarkdown(),this.preferencesService.hideTechnicalMessages$.pipe(D(this.destroy$)).subscribe(e=>{this.shouldHideTechnical=e}),this.preferencesService.hideWarningMessages$.pipe(D(this.destroy$)).subscribe(e=>{this.shouldHideWarning=e}),this.shouldHideTechnical=this.preferencesService.getHideTechnicalMessages(),this.shouldHideWarning=this.preferencesService.getHideWarningMessages()})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}get shouldShowSpeaker(){return this.message.role==="user"?this.isOtherUser||this.message.speaker.startsWith("@"):this.message.role==="assistant"}get shouldShowActions(){return this.message.role==="user"||this.message.role==="assistant"}get isSimplified(){return this.message.role!=="user"&&this.message.role!=="assistant"}datePipe=f(Pa);get formattedTimestamp(){if(this.message.role!=="user"||!this.message.timestamp)return null;let e=new Date().toDateString()===this.message.timestamp.toDateString();return this.datePipe.transform(this.message.timestamp,e?"HH:mm":"dd/MM HH:mm")}get isLongMessage(){let e=this.extractTextContent();return e.length>1e3||e.split(`
335
- `).length>20}get actions(){let e=[];return this.message.role==="user"&&this.canDelete&&e.push({icon:"delete",label:"Delete from here",tooltip:"Delete this message and all following messages",action:()=>this.onDelete(),destructive:!0}),e.push({icon:"content_copy",label:"Copy message",tooltip:"Copy message content to clipboard",action:()=>this.onCopy()}),e}get eventLink(){if(!this.message.eventId)return null;let e=this.projectState.getSelectedProjectId(),t=this.threadState.getSelectedThreadId();return!e||!t?null:`/api/projects/${e}/threads/${t}/messages/${encodeURIComponent(this.message.eventId)}/formatted`}renderMarkdown(){return B(this,null,function*(){try{let e=yield this.renderRichContent(this.message.content);this.renderedContent=this.sanitizer.bypassSecurityTrustHtml(e)}catch(e){console.error("Error parsing rich content:",e);let t=this.extractTextContent();this.renderedContent=this.sanitizer.bypassSecurityTrustHtml(t)}})}renderRichContent(e){return B(this,null,function*(){let t=[];for(let n of e)if(n.type==="text"){let r=yield this.markdownService.parse(n.content);t.push(`<div class="text-part">${r}</div>`)}else if(n.type==="image"){let r=`data:${n.mimeType};base64,${n.content}`,o=n.source||"Image",a=`
336
- <div class="image-content">
337
- <img src="${r}"
338
- alt="${o}"
339
- class="message-image"
340
- style="max-width: 100%; height: auto; margin: 8px 0; border-radius: 8px; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); transition: transform 0.2s ease, box-shadow 0.2s ease;"
341
- onclick="window.open(this.src, '_blank')" />
342
- </div>
343
- `;t.push(a)}return t.join("")})}onCopy(){let e=this.extractTextContent();e.trim()&&navigator.clipboard.writeText(e).then(()=>{console.log("[CHAT-MESSAGE] Message copied to clipboard"),this.notificationService.success("Message copied to clipboard")}).catch(t=>{console.error("[CHAT-MESSAGE] Failed to copy message:",t),this.notificationService.error("Failed to copy message")}),this.copyRequested.emit(this.message)}onDelete(){console.log("[CHAT-MESSAGE] Delete requested for message:",this.message.id),this.deleteRequested.emit(this.message)}extractTextContent(){return this.message.content.filter(e=>e.type==="text").map(e=>e.content).join(`
344
-
345
- `)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-chat-message"]],inputs:{message:"message",canDelete:"canDelete",isOtherUser:"isOtherUser"},outputs:{copyRequested:"copyRequested",deleteRequested:"deleteRequested"},features:[fn([Pa])],decls:6,vars:8,consts:[[1,"message-wrapper",3,"ngClass"],[1,"message",3,"ngClass"],[1,"simple-content","markdown-content"],[1,"actions","assistant-top-actions"],[1,"actions","user-top-actions"],[1,"message-header"],[1,"content","markdown-content",3,"innerHTML"],[1,"message-timestamp"],[1,"actions","bottom-actions"],[1,"speaker"],[3,"actions"],[3,"innerHTML"],["target","_blank",1,"event-link",3,"href"]],template:function(t,n){t&1&&(l(0,"div",0)(1,"div",1),C(2,uh,4,4),C(3,gh,3,2,"div",2),c(),C(4,fh,2,1,"div",3),C(5,_h,2,1,"div",4),c()),t&2&&(T("ngClass",Ar(6,ch,n.message.role==="user")),p(),T("ngClass",n.messageClasses),p(),S(n.isSimplified?-1:2),p(),S(n.isSimplified?3:-1),p(),S(!n.isLongMessage&&n.shouldShowActions&&n.message.role==="assistant"?4:-1),p(),S(n.shouldShowActions&&n.message.role==="user"?5:-1))},dependencies:[xo,Fr],styles:[".message-wrapper[_ngcontent-%COMP%]{margin:0;display:flex;align-items:flex-start;gap:.5rem}.message-wrapper.user-message-wrapper[_ngcontent-%COMP%]{margin:.75rem 0;flex-direction:row-reverse;align-items:flex-start}.message-wrapper.user-message-wrapper[_ngcontent-%COMP%]:has(.other-user){flex-direction:row}.message[_ngcontent-%COMP%]{position:relative}.message.user[_ngcontent-%COMP%]{padding:1rem 1.25rem .5rem}.message.user[_ngcontent-%COMP%] .message-timestamp[_ngcontent-%COMP%]{display:block;text-align:right;font-size:.7rem;color:var(--color-text-secondary, #6272a4);white-space:nowrap;margin-top:.4rem;opacity:.7}.message.user[_ngcontent-%COMP%]{background:var(--color-message-user);border-radius:18px 18px 6px;border:1px solid var(--glass-border);box-shadow:none;backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);width:fit-content;max-width:75%;min-width:120px;word-wrap:break-word;transition:transform .2s ease,box-shadow .2s ease}.message.user[_ngcontent-%COMP%]:hover{transform:translateY(-1px);box-shadow:0 12px 40px #1f268733}.message.user.other-user[_ngcontent-%COMP%]{border-bottom-right-radius:18px;border-bottom-left-radius:6px}.message.assistant[_ngcontent-%COMP%]{background:transparent;border:none;box-shadow:none;border-radius:0;margin-left:0;margin-right:auto;padding:.5rem 0;width:100%;max-width:none;min-width:0}.message.system[_ngcontent-%COMP%], .message.technical[_ngcontent-%COMP%]{padding:.5rem .75rem;background:transparent;border:none;box-shadow:none;backdrop-filter:none;-webkit-backdrop-filter:none;margin:0;font-family:SF Mono,Monaco,Menlo,monospace;font-size:.85rem;color:var(--color-text-secondary);max-width:none;width:auto;min-width:auto}.message.system[_ngcontent-%COMP%]:hover, .message.technical[_ngcontent-%COMP%]:hover{transform:none;box-shadow:none}.message.hidden-technical[_ngcontent-%COMP%], .message.hidden-warning[_ngcontent-%COMP%]{display:none!important}.message.error[_ngcontent-%COMP%]{padding:1rem 1.25rem;background:#ff3b301f;border-left:3px solid var(--color-error);color:var(--color-error)}.message.warning[_ngcontent-%COMP%]{padding:1rem 1.25rem;background:#ff95001f;border-left:3px solid var(--color-warning);color:var(--color-warning)}.message-header[_ngcontent-%COMP%]{margin-bottom:.5rem}.speaker[_ngcontent-%COMP%]{font-weight:600;font-size:.85rem;color:var(--color-text-secondary, #6272a4)}.content[_ngcontent-%COMP%]{line-height:1.5}.context-menu-top[_ngcontent-%COMP%]{top:.5rem;right:.5rem;z-index:10}.context-menu-bottom[_ngcontent-%COMP%]{bottom:.5rem;right:.5rem;z-index:10}.user-top-actions[_ngcontent-%COMP%]{display:flex;align-items:flex-start;padding-top:.5rem;opacity:0;transition:opacity .2s ease}.user-message-wrapper[_ngcontent-%COMP%]:hover .user-top-actions[_ngcontent-%COMP%]{opacity:1}.assistant-top-actions[_ngcontent-%COMP%]{display:flex;align-items:flex-start;padding-top:.5rem;opacity:0;transition:opacity .2s ease}.message-wrapper[_ngcontent-%COMP%]:hover .assistant-top-actions[_ngcontent-%COMP%]{opacity:1}.simple-content[_ngcontent-%COMP%]{display:flex}.simple-content[_ngcontent-%COMP%] .event-link[_ngcontent-%COMP%]{margin-left:5px;font-size:.9em;color:var(--color-link, #3498db);text-decoration:none}.simple-content[_ngcontent-%COMP%] .event-link[_ngcontent-%COMP%]:hover{text-decoration:underline}.text-part[_ngcontent-%COMP%]{margin:4px 0}.image-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;margin:1em 0}.message-image[_ngcontent-%COMP%]{display:block;max-width:100%;height:auto;margin:8px 0;border-radius:12px;cursor:pointer;box-shadow:var(--glass-shadow);transition:transform .3s ease,box-shadow .3s ease;border:1px solid var(--glass-border)}.message-image[_ngcontent-%COMP%]:hover{transform:scale(1.02) translateY(-2px);box-shadow:0 16px 48px #00000026}@media(max-width:768px){.message-image[_ngcontent-%COMP%]{border-radius:4px;margin:6px 0}}@media(max-width:480px){.message-image[_ngcontent-%COMP%]{margin:4px 0}}"]})};var bh=["determinateSpinner"];function vh(i,e){if(i&1&&(ya(),l(0,"svg",11),F(1,"circle",12),c()),i&2){let t=h();Me("viewBox",t._viewBox()),p(),Ke("stroke-dasharray",t._strokeCircumference(),"px")("stroke-dashoffset",t._strokeCircumference()/2,"px")("stroke-width",t._circleStrokeWidth(),"%"),Me("r",t._circleRadius())}}var yh=new Bi("mat-progress-spinner-default-options",{providedIn:"root",factory:()=>({diameter:Bd})}),Bd=100,Ch=10,xi=(()=>{class i{_elementRef=f(ft);_noopAnimations;get color(){return this._color||this._defaultColor}set color(t){this._color=t}_color;_defaultColor="primary";_determinateCircle;constructor(){let t=f(yh),n=Vl(),r=this._elementRef.nativeElement;this._noopAnimations=n==="di-disabled"&&!!t&&!t._forceAnimations,this.mode=r.nodeName.toLowerCase()==="mat-spinner"?"indeterminate":"determinate",!this._noopAnimations&&n==="reduced-motion"&&r.classList.add("mat-progress-spinner-reduced-motion"),t&&(t.color&&(this.color=this._defaultColor=t.color),t.diameter&&(this.diameter=t.diameter),t.strokeWidth&&(this.strokeWidth=t.strokeWidth))}mode;get value(){return this.mode==="determinate"?this._value:0}set value(t){this._value=Math.max(0,Math.min(100,t||0))}_value=0;get diameter(){return this._diameter}set diameter(t){this._diameter=t||0}_diameter=Bd;get strokeWidth(){return this._strokeWidth??this.diameter/10}set strokeWidth(t){this._strokeWidth=t||0}_strokeWidth;_circleRadius(){return(this.diameter-Ch)/2}_viewBox(){let t=this._circleRadius()*2+this.strokeWidth;return`0 0 ${t} ${t}`}_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(n){return new(n||i)};static \u0275cmp=I({type:i,selectors:[["mat-progress-spinner"],["mat-spinner"]],viewQuery:function(n,r){if(n&1&&Be(bh,5),n&2){let o;ge(o=fe())&&(r._determinateCircle=o.first)}},hostAttrs:["role","progressbar","tabindex","-1",1,"mat-mdc-progress-spinner","mdc-circular-progress"],hostVars:18,hostBindings:function(n,r){n&2&&(Me("aria-valuemin",0)("aria-valuemax",100)("aria-valuenow",r.mode==="determinate"?r.value:null)("mode",r.mode),Ma("mat-"+r.color),Ke("width",r.diameter,"px")("height",r.diameter,"px")("--mat-progress-spinner-size",r.diameter+"px")("--mat-progress-spinner-active-indicator-width",r.diameter+"px"),Y("_mat-animation-noopable",r._noopAnimations)("mdc-circular-progress--indeterminate",r.mode==="indeterminate"))},inputs:{color:"color",mode:"mode",value:[2,"value","value",Nr],diameter:[2,"diameter","diameter",Nr],strokeWidth:[2,"strokeWidth","strokeWidth",Nr]},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(n,r){if(n&1&&(un(0,vh,2,8,"ng-template",null,0,ai),l(2,"div",2,1),ya(),l(4,"svg",3),F(5,"circle",4),c()(),pl(),l(6,"div",5)(7,"div",6)(8,"div",7),An(9,8),c(),l(10,"div",9),An(11,8),c(),l(12,"div",10),An(13,8),c()()()),n&2){let o=In(1);p(4),Me("viewBox",r._viewBox()),p(),Ke("stroke-dasharray",r._strokeCircumference(),"px")("stroke-dashoffset",r._strokeDashOffset(),"px")("stroke-width",r._circleStrokeWidth(),"%"),Me("r",r._circleRadius()),p(4),T("ngTemplateOutlet",o),p(2),T("ngTemplateOutlet",o),p(2),T("ngTemplateOutlet",o)}},dependencies:[Lr],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)}}
346
- `],encapsulation:2,changeDetection:0})}return i})();var wi=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275mod=wt({type:i});static \u0275inj=xt({imports:[$t]})}return i})();var Sh=(i,e)=>e.id;function xh(i,e){if(i&1&&(l(0,"span",4),u(1),c()),i&2){let t=h();p(),L(t.taskSummary)}}function wh(i,e){i&1&&(l(0,"div",6),F(1,"mat-spinner",8),l(2,"span"),u(3,"Loading..."),c()()),i&2&&(p(),T("diameter",16))}function Th(i,e){if(i&1&&F(0,"app-delegation-inline",9),i&2){let t=h().$implicit;T("subThreadId",t.subThreadId)("agentName",t.delegationAgentName)}}function Eh(i,e){if(i&1&&F(0,"app-chat-message",10),i&2){let t=h().$implicit;T("message",t)("canDelete",!1)}}function Mh(i,e){if(i&1&&C(0,Th,1,2,"app-delegation-inline",9)(1,Eh,1,2,"app-chat-message",10),i&2){let t=e.$implicit;S(t.type==="delegation"?0:1)}}function kh(i,e){if(i&1&&(l(0,"div",7)(1,"div",11),u(2),c()()),i&2){let t=h(2);p(2),L(t.streamingText)}}function Ph(i,e){if(i&1&&(l(0,"div",5),C(1,wh,4,1,"div",6),we(2,Mh,2,1,null,null,Sh),C(4,kh,3,1,"div",7),c()),i&2){let t=h();p(),S(t.isLoading&&t.subMessages.length===0?1:-1),p(),Te(t.subMessages),p(2),S(t.streamingText?4:-1)}}var Io=class i{subThreadId;agentName;isExpanded=!1;isLoading=!1;subMessages=[];streamingText="";restLoaded=!1;messageIds=new Set;eventSubscription;codayService=f(mt);threadApi=f(Yt);get taskSummary(){let e=this.subMessages.find(t=>t.role==="user");if(e){let t=e.content.filter(n=>n.type==="text").map(n=>n.content).join(" ");return t.length>120?t.substring(0,120)+"...":t}return""}ngOnInit(){for(let e of this.codayService.getBufferedSubThreadEvents(this.subThreadId))this.handleSubThreadEvent(e);this.eventSubscription=this.codayService.subThreadEvents$.pipe(ve(e=>e.threadId===this.subThreadId)).subscribe(e=>this.handleSubThreadEvent(e))}ngOnDestroy(){this.eventSubscription?.unsubscribe()}toggle(){this.isExpanded=!this.isExpanded,this.isExpanded&&!this.restLoaded&&this.loadSubThreadMessages()}loadSubThreadMessages(){this.isLoading=!0,this.threadApi.getThreadMessages(this.subThreadId).subscribe({next:e=>{if(e.messages){for(let t of e.messages){let n=er(t);n&&this.handleSubThreadEvent(n)}this.subMessages=[...this.subMessages].sort((t,n)=>t.id.localeCompare(n.id))}this.restLoaded=!0,this.isLoading=!1},error:e=>{console.error("[DELEGATION-INLINE] Failed to load sub-thread messages:",e),this.restLoaded=!0,this.isLoading=!1}})}handleSubThreadEvent(e){e instanceof pt?this.addMessage({id:e.timestamp,role:"user",speaker:"User",content:[{type:"text",content:e.answer}],timestamp:new Date,type:"text"}):e instanceof vn?this.streamingText+=e.chunk:e instanceof Ot?(e.role==="assistant"&&(this.streamingText=""),this.addMessage({id:e.timestamp,role:e.role,speaker:e.name,content:e.content,timestamp:new Date,type:"text"})):e instanceof Pt?this.addMessage({id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:new Date,type:"technical",eventId:e.timestamp}):e instanceof yt?this.addMessage({id:e.timestamp,role:"system",speaker:"System",content:[{type:"text",content:e.toSingleLineString()}],timestamp:new Date,type:"technical",eventId:e.timestamp}):e instanceof qt?this.addMessage({id:e.timestamp,role:"system",speaker:e.agentName,content:[{type:"text",content:""}],timestamp:new Date,type:"delegation",subThreadId:e.subThreadId,delegationAgentName:e.agentName}):e instanceof Wt&&this.addMessage({id:e.timestamp,role:"system",speaker:e.speaker??"System",content:[{type:"text",content:e.text}],timestamp:new Date,type:"technical"})}addMessage(e){this.messageIds.has(e.id)||(this.messageIds.add(e.id),this.subMessages=[...this.subMessages,e])}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-delegation-inline"]],inputs:{subThreadId:"subThreadId",agentName:"agentName"},decls:8,vars:4,consts:[[1,"delegation-inline"],["role","button","tabindex","0",1,"delegation-header",3,"click","keydown.enter","keydown.space"],[1,"expand-icon"],[1,"agent-name"],[1,"task-summary"],[1,"delegation-body"],[1,"loading"],[1,"streaming-message"],[3,"diameter"],[3,"subThreadId","agentName"],[3,"message","canDelete"],[1,"content"]],template:function(t,n){t&1&&(l(0,"div",0)(1,"div",1),v("click",function(){return n.toggle()})("keydown.enter",function(){return n.toggle()})("keydown.space",function(){return n.toggle()}),l(2,"mat-icon",2),u(3),c(),l(4,"span",3),u(5),c(),C(6,xh,2,1,"span",4),c(),C(7,Ph,5,2,"div",5),c()),t&2&&(p(3),L(n.isExpanded?"expand_more":"chevron_right"),p(2),L(n.agentName),p(),S(n.taskSummary?6:-1),p(),S(n.isExpanded?7:-1))},dependencies:[i,it,ke,se,wi,xi,Si],styles:[".delegation-inline[_ngcontent-%COMP%]{margin:.5rem 0;border-left:3px solid var(--color-primary, #6366f1);border-radius:4px;background:var(--color-bg-secondary);overflow:hidden}.delegation-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;cursor:pointer;-webkit-user-select:none;user-select:none}.delegation-header[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.delegation-header[_ngcontent-%COMP%] .expand-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;color:var(--color-text-secondary, #94a3b8)}.delegation-header[_ngcontent-%COMP%] .agent-name[_ngcontent-%COMP%]{font-weight:600;color:var(--color-primary, #6366f1);white-space:nowrap}.delegation-header[_ngcontent-%COMP%] .task-summary[_ngcontent-%COMP%]{flex:1;color:var(--color-text-secondary, #94a3b8);font-size:.85rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.delegation-body[_ngcontent-%COMP%]{padding:0 .75rem .75rem 1.5rem;border-top:1px solid var(--color-border-light)}.delegation-body[_ngcontent-%COMP%] .loading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem 0;color:var(--color-text-secondary, #94a3b8);font-size:.85rem}.delegation-body[_ngcontent-%COMP%] .sub-messages[_ngcontent-%COMP%]{padding:.5rem 0}"]})};var Ti=class i{unreadCountSubject=new W(0);unreadCount$=this.unreadCountSubject.asObservable();constructor(){console.log("[UNREAD] Service initialized")}addUnread(){let t=this.unreadCountSubject.value+1;this.unreadCountSubject.next(t),console.log("[UNREAD] Added unread message, total:",t)}markAllAsRead(){this.unreadCountSubject.value>0&&(this.unreadCountSubject.next(0),console.log("[UNREAD] Marked all messages as read"))}getCurrentCount(){return this.unreadCountSubject.value}reset(){this.unreadCountSubject.next(0),console.log("[UNREAD] Counter reset")}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var Ei=class i{destroy$=new J;voices;currentUtterance=null;currentOnEndCallback=null;speakingSubject=new W(!1);speaking$=this.speakingSubject.asObservable();volume=.8;rate=1.2;language="en-US";selectedVoice;preferencesService=f(Pe);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,t)=>{let n=speechSynthesis.getVoices();if(n.length)e(n);else{let r=setTimeout(()=>{t("no voices found")},2e3);speechSynthesis.addEventListener("voiceschanged",()=>{let o=speechSynthesis.getVoices();o.length&&(clearTimeout(r),e(o))})}}),console.log("[VOICE-SERVICE] Speech synthesis initialized")}subscribeToPreferences(){this.preferencesService.voiceVolume$.pipe(D(this.destroy$)).subscribe(e=>{this.volume=e,console.log("[VOICE-SERVICE] Volume updated to:",e)}),this.preferencesService.voiceRate$.pipe(D(this.destroy$)).subscribe(e=>{this.rate=e,console.log("[VOICE-SERVICE] Rate updated to:",e)}),this.preferencesService.voiceLanguage$.pipe(D(this.destroy$)).subscribe(e=>{this.language=e,console.log("[VOICE-SERVICE] Language updated to:",e),this.updateSelectedVoiceForLanguage()}),this.preferencesService.selectedVoice$.pipe(D(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,t){return B(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 n=this.extractPlainText(e);if(!n.trim())return console.warn("[VOICE-SERVICE] No text to speak after markdown cleaning"),!1;this.stopSpeech();try{let r=new SpeechSynthesisUtterance(n);r.voice=this.selectedVoice,r.lang=this.selectedVoice.lang,r.volume=this.volume,r.rate=this.rate,this.currentOnEndCallback=t||null,t&&(r.onend=()=>{this.currentOnEndCallback===t&&(this.currentOnEndCallback=null,t())},r.onerror=()=>{this.currentOnEndCallback===t&&(this.currentOnEndCallback=null,t())}),this.currentUtterance=r,this.speakingSubject.next(!0);let o=r.onend,a=r.onerror;return r.onend=s=>{this.speakingSubject.next(!1),o&&o.call(r,s)},r.onerror=s=>{this.speakingSubject.next(!1),a&&a.call(r,s)},speechSynthesis.speak(r),console.log("[VOICE-SERVICE] Started speaking:",e.substring(0,50)+"..."),!0}catch(r){return console.error("[VOICE-SERVICE] Error speaking:",r),!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),t=e.createOscillator(),n=e.createGain();t.connect(n),n.connect(e.destination),t.frequency.setValueAtTime(800,e.currentTime),n.gain.setValueAtTime(.1,e.currentTime),n.gain.exponentialRampToValueAtTime(.01,e.currentTime+.1),t.start(e.currentTime),t.stop(e.currentTime+.1),console.log("[VOICE-SERVICE] Notification sound played")}catch(e){console.error("[VOICE-SERVICE] Notification sound failed:",e)}}getVoicesForLanguage(){return B(this,null,function*(){try{let e=this.language.slice(0,2),t=yield this.voices;if(!t||t.length===0)return console.warn("[VOICE-SERVICE] No voices available on system"),[];let n=t.filter(r=>r.lang.toLowerCase().startsWith(e)).sort((r,o)=>r.localService&&!o.localService?-1:!r.localService&&o.localService?1:r.name.localeCompare(o.name));return console.log("[VOICE-SERVICE] Found matching voices:",n.length,"for language:",e),n.map(r=>({name:r.name,lang:r.lang,localService:r.localService,default:r.default,displayName:this.formatVoiceDisplayName(r)}))}catch(e){return console.error("[VOICE-SERVICE] Error getting voices for language:",e),[]}})}formatVoiceDisplayName(e){let t=e.localService?"\u{1F3E0}":"\u2601\uFE0F",n=e.default?" \u2B50":"";return`${t} ${e.name} (${e.lang})${n}`}setSelectedVoice(e){return B(this,null,function*(){if(!e){this.selectedVoice=void 0;return}let[t,n]=e.split("|");if(!t||!n){this.selectedVoice=void 0;return}let r=(yield this.voices)?.find(o=>o.name===t&&o.lang===n);r?(this.selectedVoice=r,console.log("[VOICE-SERVICE] Selected voice:",r.name,r.lang)):(this.selectedVoice=void 0,console.warn("[VOICE-SERVICE] Voice not found:",t,n))})}updateSelectedVoiceForLanguage(){return B(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 t=this.preferencesService.getSelectedVoice();if(t){let[r,o]=t.split("|"),a=o?.slice(0,2),s=this.language.slice(0,2);if(a===s&&e.some(m=>m.name===r&&m.lang===o)){console.log("[VOICE-SERVICE] Keeping current voice for language:",t);return}}let n=e[0];if(n){let r=`${n.name}|${n.lang}`;this.preferencesService.setSelectedVoice(r),console.log("[VOICE-SERVICE] Auto-selected voice for language change:",n.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),t={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 t[e]||t.en||"Hello, this is a test."}extractPlainText(e){let t=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(/&nbsp;/g," ").replace(/&amp;/g,"and").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"');return t=this.addNaturalPunctuation(t),t.replace(/\s+/g," ").trim()}addNaturalPunctuation(e){return e.replace(/\n+/g,`
347
- `).split(`
348
- `).map(t=>this.addPeriodIfNeeded(t.trim())).filter(t=>t.length>0).join(" ")}addPeriodIfNeeded(e){return e?/[.!?;:]$/.test(e)?e:e+".":""}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var Do=class i{thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;ngOnInit(){this.startThinkingAnimation()}ngOnDestroy(){this.stopThinkingAnimation()}startThinkingAnimation(){this.thinkingPhraseIndex=0,this.currentThinkingPhrase=this.thinkingPhrases[0]||"Thinking...",this.thinkingInterval=window.setInterval(()=>{this.thinkingPhraseIndex<this.thinkingPhrases.length-1&&(this.thinkingPhraseIndex++,this.currentThinkingPhrase=this.thinkingPhrases[this.thinkingPhraseIndex]||"Thinking...")},2e3)}stopThinkingAnimation(){this.thinkingInterval&&(clearInterval(this.thinkingInterval),this.thinkingInterval=null),this.thinkingPhraseIndex=0,this.currentThinkingPhrase="Thinking..."}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-thinking-loader"]],decls:8,vars:1,consts:[[1,"message-wrapper"],[1,"message","assistant","thinking-message"],[1,"content"],[1,"thinking-loader"],[1,"logo-container"],["src","CODAY-Logo.png","alt","Coday Logo",1,"coday-logo"],[1,"thinking-text"]],template:function(t,n){t&1&&(hn(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"div",4),Ta(5,"img",5),gn(),hn(6,"p",6),u(7),gn()()()()()),t&2&&(p(7),L(n.currentThinkingPhrase))},dependencies:[it],styles:[".message-wrapper[_ngcontent-%COMP%]{margin:0;display:flex;align-items:flex-start;gap:.5rem}.message.assistant[_ngcontent-%COMP%]{background:transparent;border:none;box-shadow:none;border-radius:0;margin-left:0;margin-right:auto;padding:.5rem 0;width:100%;max-width:none;min-width:0}.message.thinking-message[_ngcontent-%COMP%] .content[_ngcontent-%COMP%]{line-height:1.5}.thinking-loader[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;padding:.75rem 0}.logo-container[_ngcontent-%COMP%]{position:relative;width:32px;height:32px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.coday-logo[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;animation:_ngcontent-%COMP%_pulse 2s ease-in-out infinite;filter:drop-shadow(0 1px 4px rgba(0,0,0,.1))}.thinking-text[_ngcontent-%COMP%]{font-size:.95rem;font-weight:400;color:var(--color-text-secondary);margin:0;animation:_ngcontent-%COMP%_fadeInOut 2s ease-in-out infinite;letter-spacing:.01em;font-style:italic}@keyframes _ngcontent-%COMP%_pulse{0%,to{transform:scale(1);opacity:1}50%{transform:scale(1.1);opacity:.7}}@keyframes _ngcontent-%COMP%_fadeInOut{0%,to{opacity:.6}50%{opacity:1}}@media(max-width:768px){.logo-container[_ngcontent-%COMP%]{width:28px;height:28px}.thinking-text[_ngcontent-%COMP%]{font-size:.875rem}.thinking-loader[_ngcontent-%COMP%]{gap:.75rem}}@media print{.thinking-loader[_ngcontent-%COMP%]{display:none!important}}"]})};var Oh=(i,e)=>e.id;function Ah(i,e){if(i&1&&F(0,"app-delegation-inline",3),i&2){let t=h().$implicit;T("subThreadId",t.subThreadId)("agentName",t.delegationAgentName)}}function Ih(i,e){if(i&1){let t=O();l(0,"app-chat-message",5),v("copyRequested",function(r){x(t);let o=h(2);return w(o.onCopyMessage(r))})("deleteRequested",function(r){x(t);let o=h(2);return w(o.onDeleteMessage(r))}),c()}if(i&2){let t=h(),n=t.$implicit,r=t.$index,o=h();T("message",n)("canDelete",o.canDeleteMessage(r))("isOtherUser",n.role==="user"&&!!o.currentUsername&&n.speaker!==o.currentUsername)}}function Dh(i,e){if(i&1&&C(0,Ah,1,2,"app-delegation-inline",3)(1,Ih,1,3,"app-chat-message",4),i&2){let t=e.$implicit;S(t.type==="delegation"?0:1)}}function Rh(i,e){if(i&1&&(l(0,"div",1),F(1,"div",6),c()),i&2){let t=h();p(),T("innerHTML",t.renderedStreamingText,ut)}}function Nh(i,e){i&1&&F(0,"app-thinking-loader")}function Fh(i,e){if(i&1){let t=O();l(0,"button",7),v("click",function(){x(t);let r=h();return w(r.goToBottom())}),l(1,"mat-icon",8),u(2,"arrow_downward"),c()()}}var Ro=class i{messages=[];streamingText="";isThinking=!1;currentUsername="";copyRequested=new Z;stopRequested=new Z;lastMessageCount=0;destroy$=new J;renderedStreamingText="";isTracking=!0;showGoToBottom=!1;scrollContainer=null;lastScrollTop=0;NEAR_BOTTOM_THRESHOLD=100;scrollCheckTimeout;isProgrammaticScroll=!1;MESSAGE_FRESHNESS_THRESHOLD=300*1e3;elementRef=f(ft);unreadService=f(Ti);voiceSynthesisService=f(Ei);preferencesService=f(Pe);codayService=f(mt);markdownService=f(Jt);sanitizer=f(Vt);ngOnInit(){this.findScrollContainer(),this.setupFocusListeners()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),this.scrollCheckTimeout&&clearTimeout(this.scrollCheckTimeout),window.removeEventListener("focus",this.handleWindowFocus),window.removeEventListener("blur",this.handleWindowBlur)}ngOnChanges(e){e.streamingText&&(this.renderStreamingText(),this.streamingText&&this.isTracking&&setTimeout(()=>this.scrollToBottom(),0))}ngAfterViewChecked(){if(this.messages.length!==this.lastMessageCount){console.log("[CHAT-HISTORY] Message count changed:",this.lastMessageCount,"->",this.messages.length);let e=this.messages.length-this.lastMessageCount;e>0&&(this.handleNewMessages(e),this.handleVoiceAnnouncement(e)),this.lastMessageCount=this.messages.length,this.isTracking&&this.scrollToBottom()}this.scrollContainer||this.findScrollContainer()}scrollToBottom(){try{this.scrollContainer||this.findScrollContainer(),this.scrollContainer&&(this.isProgrammaticScroll=!0,setTimeout(()=>{this.scrollContainer&&this.scrollContainer.scrollTo({top:this.scrollContainer.scrollHeight,behavior:"smooth"}),setTimeout(()=>{this.isProgrammaticScroll=!1},600)},50))}catch(e){console.error("Error scrolling to bottom:",e)}}trackByMessageId(e,t){return t.id}onCopyMessage(e){let t=e.content.filter(n=>n.type==="text").map(n=>n.content).join(`
349
-
350
- `);navigator.clipboard.writeText(t).then(()=>console.log("Message copied")).catch(n=>console.error("Failed to copy:",n)),this.copyRequested.emit(e)}onStop(){this.stopRequested.emit()}canDeleteMessage(e){return e===0?!1:!this.isThinking}onDeleteMessage(e){if(console.log("[CHAT-HISTORY] Delete requested for message:",e.id),this.messages.findIndex(r=>r.id===e.id)===0){console.warn("[CHAT-HISTORY] Cannot delete first message");return}if(this.isThinking){console.warn("[CHAT-HISTORY] Cannot delete message while agent is thinking");return}if(e.role!=="user"){console.warn("[CHAT-HISTORY] Can only delete user messages");return}confirm(`Delete this message and all following messages?
351
-
352
- This action cannot be undone once you post another message.`)&&(console.log("[CHAT-HISTORY] Proceeding with message deletion"),this.codayService.deleteMessage(e.id).subscribe({next:r=>{r.success?console.log("[CHAT-HISTORY] Message deleted successfully"):(console.error("[CHAT-HISTORY] Failed to delete message:",r.error),alert(`Failed to delete message: ${r.error}`))},error:r=>{console.error("[CHAT-HISTORY] Error deleting message:",r),alert(`Error deleting message: ${r.message||"Unknown error"}`)}}))}onScroll(){}findScrollContainer(){let e=this.elementRef.nativeElement;this.scrollContainer=e.closest(".chat-wrapper"),this.scrollContainer?(console.log("[CHAT-HISTORY] Scroll container found"),this.scrollContainer.addEventListener("scroll",this.handleScroll.bind(this)),this.lastScrollTop=this.scrollContainer.scrollTop,this.checkScrollPosition()):(console.warn("[CHAT-HISTORY] Scroll container not found"),setTimeout(()=>this.findScrollContainer(),100))}handleScroll=()=>{if(!this.scrollContainer)return;let e=this.scrollContainer.scrollTop;if(Math.abs(e-this.lastScrollTop)<1){this.lastScrollTop=e;return}if(this.isProgrammaticScroll){this.lastScrollTop=e;return}console.log("[CHAT-HISTORY] User scroll detected - disabling auto-scroll"),this.isTracking&&(this.isTracking=!1,this.showGoToBottom=!0),clearTimeout(this.scrollCheckTimeout),this.scrollCheckTimeout=setTimeout(()=>{this.checkScrollPosition()},500),this.lastScrollTop=e};checkScrollPosition(){if(!this.scrollContainer)return;let{scrollTop:e,scrollHeight:t,clientHeight:n}=this.scrollContainer,o=t-e-n<=this.NEAR_BOTTOM_THRESHOLD;o&&!this.isTracking&&(console.log("[CHAT-HISTORY] Near bottom - re-enabling auto-scroll"),this.isTracking=!0,this.showGoToBottom=!1,this.unreadService.markAllAsRead()),!this.isTracking&&!o&&(this.showGoToBottom=!0)}goToBottom(){console.log("[CHAT-HISTORY] Go to bottom clicked - re-enabling auto-scroll"),this.scrollToBottom(),this.isTracking=!0,this.showGoToBottom=!1,this.unreadService.markAllAsRead()}handleNewMessages(e){let n=this.messages.slice(-e).filter(o=>o.role==="assistant");if(n.length===0){console.log("[CHAT-HISTORY] No new assistant messages to count");return}if(this.shouldMarkNewMessagesAsUnread()){console.log("[CHAT-HISTORY] Marking",n.length,"new assistant messages as unread");for(let o=0;o<n.length;o++)this.unreadService.addUnread()}else console.log("[CHAT-HISTORY] New assistant messages are considered read (user is focused and tracking)")}shouldMarkNewMessagesAsUnread(){return document.hasFocus()?this.isTracking?!1:(console.log("[CHAT-HISTORY] User is not tracking (scrolled up) -> unread"),!0):(console.log("[CHAT-HISTORY] Tab does not have focus -> unread"),!0)}setupFocusListeners(){window.addEventListener("focus",this.handleWindowFocus),window.addEventListener("blur",this.handleWindowBlur)}handleWindowFocus=()=>{console.log("[CHAT-HISTORY] Window gained focus"),this.isTracking&&(console.log("[CHAT-HISTORY] User is tracking and focused -> marking messages as read"),this.unreadService.markAllAsRead())};handleWindowBlur=()=>{console.log("[CHAT-HISTORY] Window lost focus")};handleVoiceAnnouncement(e){if(!this.preferencesService.getVoiceAnnounceEnabled())return;let r=this.messages.slice(-e).filter(s=>s.role==="assistant");if(r.length===0){console.log("[CHAT-HISTORY] No new assistant messages to announce");return}let o=r[r.length-1];if(!o){console.warn("[CHAT-HISTORY] No last assistant message found");return}if(!this.isMessageRecentEnoughForAnnouncement(o)){console.log("[CHAT-HISTORY] Message too old for voice announcement");return}if(this.preferencesService.getVoiceMode()==="notification")console.log("[CHAT-HISTORY] Playing notification sound for new assistant message"),this.voiceSynthesisService.ding();else{let s=this.extractTextContentFromMessage(o);if(s.trim()){console.log("[CHAT-HISTORY] Announcing new assistant message via speech");let m=this.preferencesService.getVoiceReadFullText()?s:this.extractPartialText(s);this.voiceSynthesisService.speak(m).then(_=>{_||console.warn("[CHAT-HISTORY] Failed to announce message via speech")}).catch(_=>{console.error("[CHAT-HISTORY] Error during voice announcement:",_)})}}}isMessageRecentEnoughForAnnouncement(e){try{let t=e.timestamp.getTime();return Date.now()-t<=this.MESSAGE_FRESHNESS_THRESHOLD}catch(t){return console.warn("[CHAT-HISTORY] Error checking message freshness:",t),!0}}extractTextContentFromMessage(e){return e.content.filter(t=>t.type==="text").map(t=>t.content).join(`
353
-
354
- `)}extractPartialText(e){return e.split(`
355
- `).filter(a=>a.trim().length>0).reduce((a,s)=>{if(a.paragraphs>=3)return a;let d=s.length>80?1:0;return{paragraphs:a.paragraphs+d,text:a.text+(a.text?`
356
- `:"")+s}},{paragraphs:0,text:""}).text||e}renderStreamingText(){return B(this,null,function*(){if(!this.streamingText){this.renderedStreamingText="";return}try{let e=yield this.markdownService.parse(this.streamingText);this.renderedStreamingText=this.sanitizer.bypassSecurityTrustHtml(e)}catch(e){console.error("[CHAT-HISTORY] Error rendering streaming text markdown:",e),this.renderedStreamingText=this.sanitizer.bypassSecurityTrustHtml(this.streamingText)}})}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-chat-history"]],hostBindings:function(t,n){t&1&&v("scroll",function(){return n.onScroll()})},inputs:{messages:"messages",streamingText:"streamingText",isThinking:"isThinking",currentUsername:"currentUsername"},outputs:{copyRequested:"copyRequested",stopRequested:"stopRequested"},features:[jt],decls:6,vars:3,consts:[[1,"chat-history"],[1,"streaming-message","message","assistant"],["mat-fab","","color","primary","title","Go to bottom",1,"go-to-bottom-btn"],[3,"subThreadId","agentName"],[3,"message","canDelete","isOtherUser"],[3,"copyRequested","deleteRequested","message","canDelete","isOtherUser"],[1,"content","markdown-content",3,"innerHTML"],["mat-fab","","color","primary","title","Go to bottom",1,"go-to-bottom-btn",3,"click"],["fontSet","material-icons-outlined"]],template:function(t,n){t&1&&(l(0,"div",0),we(1,Dh,2,1,null,null,Oh),C(3,Rh,2,1,"div",1),C(4,Nh,1,0,"app-thinking-loader"),C(5,Fh,3,0,"button",2),c()),t&2&&(p(),Te(n.messages),p(2),S(n.streamingText?3:-1),p(),S(n.isThinking?4:-1),p(),S(n.showGoToBottom?5:-1))},dependencies:[Si,se,Do,Br,Io],styles:[".streaming-message.assistant[_ngcontent-%COMP%]{background:transparent;border:none;box-shadow:none;border-radius:0;margin-left:0;margin-right:auto;padding:.5rem 0;width:100%;max-width:none;min-width:0}.streaming-message[_ngcontent-%COMP%] .content[_ngcontent-%COMP%]{color:var(--color-text);line-height:1.5}.go-to-bottom-btn[_ngcontent-%COMP%]{position:fixed!important;bottom:30%!important;right:1rem!important;z-index:1000!important}@media(max-width:768px){.go-to-bottom-btn[_ngcontent-%COMP%]{width:40px!important;height:40px!important;right:.75rem!important}.go-to-bottom-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;max-height:none!important;overflow:visible!important;position:static!important}.chat-history[_ngcontent-%COMP%]{display:block!important;height:auto!important;max-height:none!important;overflow:visible!important;position:static!important}.go-to-bottom-btn[_ngcontent-%COMP%]{display:none!important}}"]})};var Lh=["buttonContainer"],jh=["freeTextInput"],Vh=(i,e)=>e.value;function zh(i,e){i&1&&(l(0,"mat-icon",10),u(1,"keyboard_return"),c())}function $h(i,e){if(i&1){let t=O();l(0,"button",8),v("click",function(){let r=x(t).$implicit,o=h(2);return w(o.onOptionClick(r.value))}),l(1,"span",9),u(2),c(),C(3,zh,2,0,"mat-icon",10),c()}if(i&2){let t=e.$implicit,n=e.$index,r=h(2);Y("highlighted",n===r.highlightedIndex),T("disabled",t.disabled)("id","choice-option-"+n),Me("aria-selected",n===r.highlightedIndex),p(2),L(t.label),p(),S(n===r.highlightedIndex?3:-1)}}function Bh(i,e){if(i&1){let t=O();l(0,"div",6)(1,"span",11),u(2,"Or type your own answer:"),c(),l(3,"div",12)(4,"input",13,1),ie("ngModelChange",function(r){x(t);let o=h(2);return ne(o.freeTextValue,r)||(o.freeTextValue=r),w(r)}),v("keydown",function(r){x(t);let o=h(2);return w(o.onFreeTextKeyDown(r))}),c(),l(6,"button",14),v("click",function(){x(t);let r=h(2);return w(r.onFreeTextSubmit())}),l(7,"mat-icon"),u(8,"send"),c()()()()}if(i&2){let t=h(2);p(4),te("ngModel",t.freeTextValue),p(2),T("disabled",!t.freeTextValue.trim())}}function Hh(i,e){if(i&1&&(l(0,"div",7)(1,"mat-icon"),u(2,"search"),c(),l(3,"span"),u(4),c()()),i&2){let t=h(2);p(4),L(t.searchText)}}function Uh(i,e){if(i&1){let t=O();l(0,"div",2),F(1,"div",3),Wi(2,"async"),l(3,"div",4,0),v("keydown",function(r){x(t);let o=h();return w(o.onKeyDown(r))}),we(5,$h,4,7,"button",5,Vh),c(),C(7,Bh,9,2,"div",6),C(8,Hh,5,1,"div",7),c()}if(i&2){let t=h();p(),T("innerHTML",Cl(2,4,t.renderedLabel$),ut),p(2),Me("aria-activedescendant","choice-option-"+t.highlightedIndex),p(2),Te(t.options),p(2),S(t.allowFreeText?7:-1),p(),S(t.searchText?8:-1)}}var No=class i{options=[];allowFreeText=!1;set labelHtml(e){typeof e=="object"?this.renderedLabelSubject.next(e):this.renderLabelMarkdown(e)}isVisible=!1;choiceSelected=new Z;buttonContainer;freeTextInput;highlightedIndex=0;searchText="";freeTextValue="";searchTimeout;destroy$=new J;renderedLabelSubject=new W("");renderedLabel$=this.renderedLabelSubject.asObservable();sanitizer=f(Vt);markdownService=f(Jt);ngOnDestroy(){this.renderedLabelSubject.complete(),this.destroy$.next(),this.destroy$.complete(),this.searchTimeout&&clearTimeout(this.searchTimeout)}ngAfterViewInit(){this.isVisible&&this.buttonContainer&&setTimeout(()=>this.focusContainer(),100)}ngOnChanges(e){e.isVisible&&e.isVisible.currentValue&&!e.isVisible.previousValue&&(this.highlightedIndex=0,setTimeout(()=>this.focusContainer(),150)),e.options&&!e.options.firstChange&&(this.highlightedIndex=0,this.searchText="",this.freeTextValue="")}focusContainer(){this.buttonContainer?.nativeElement&&this.buttonContainer.nativeElement.focus()}onKeyDown(e){if(this.options.filter(n=>!n.disabled).length!==0)switch(e.key){case"ArrowDown":e.preventDefault(),this.moveHighlight(1);break;case"ArrowUp":e.preventDefault(),this.moveHighlight(-1);break;case"Enter":case" ":e.preventDefault(),this.selectHighlighted();break;case"Home":e.preventDefault(),this.highlightFirst();break;case"End":e.preventDefault(),this.highlightLast();break;case"Escape":e.preventDefault();break;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&this.handleTypeAhead(e.key);break}}moveHighlight(e){let t=this.options.map((o,a)=>({opt:o,idx:a})).filter(({opt:o})=>!o.disabled).map(({idx:o})=>o);if(t.length===0)return;let r=t.findIndex(o=>o===this.highlightedIndex)+e;if(r>=0&&r<t.length){let o=t[r];o!==void 0&&(this.highlightedIndex=o,this.scrollToHighlighted())}else if(e===1&&r>=t.length){let o=t[0];o!==void 0&&(this.highlightedIndex=o,this.scrollToHighlighted())}else if(e===-1&&r<0){let o=t[t.length-1];o!==void 0&&(this.highlightedIndex=o,this.scrollToHighlighted())}}highlightFirst(){let e=this.options.findIndex(t=>!t.disabled);e>=0&&(this.highlightedIndex=e,this.scrollToHighlighted())}highlightLast(){let e=this.options.map((t,n)=>({opt:t,idx:n})).filter(({opt:t})=>!t.disabled).map(({idx:t})=>t);if(e.length>0){let t=e[e.length-1];t!==void 0&&(this.highlightedIndex=t,this.scrollToHighlighted())}}scrollToHighlighted(){setTimeout(()=>{let e=document.getElementById("choice-option-"+this.highlightedIndex);e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})},0)}selectHighlighted(){let e=this.options[this.highlightedIndex];e&&!e.disabled&&this.onOptionClick(e.value)}handleTypeAhead(e){this.searchText+=e.toLowerCase();let t=this.options.findIndex(n=>!n.disabled&&n.label.toLowerCase().startsWith(this.searchText));t>=0&&(this.highlightedIndex=t,this.scrollToHighlighted()),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout(()=>{this.searchText=""},1e3)}onOptionClick(e){this.choiceSelected.emit(e)}onFreeTextSubmit(){let e=this.freeTextValue.trim();e&&(this.freeTextValue="",this.choiceSelected.emit(e))}onFreeTextKeyDown(e){e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),this.onFreeTextSubmit())}renderLabelMarkdown(e){return B(this,null,function*(){if(!e){this.renderedLabelSubject.next(this.sanitizer.bypassSecurityTrustHtml(""));return}try{let t=yield this.markdownService.parse(e);this.renderedLabelSubject.next(this.sanitizer.bypassSecurityTrustHtml(t))}catch(t){console.error("[CHOICE-SELECT] Error parsing label markdown:",t),this.renderedLabelSubject.next(this.sanitizer.bypassSecurityTrustHtml(e))}})}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-choice-select"]],viewQuery:function(t,n){if(t&1&&Be(Lh,5)(jh,5),t&2){let r;ge(r=fe())&&(n.buttonContainer=r.first),ge(r=fe())&&(n.freeTextInput=r.first)}},inputs:{options:"options",allowFreeText:"allowFreeText",labelHtml:"labelHtml",isVisible:"isVisible"},outputs:{choiceSelected:"choiceSelected"},features:[jt],decls:1,vars:1,consts:[["buttonContainer",""],["freeTextInput",""],[1,"choice-container"],[1,"choice-label",3,"innerHTML"],["role","listbox","tabindex","0",1,"choice-buttons",3,"keydown"],["type","button","role","option",1,"choice-button",3,"highlighted","disabled","id"],[1,"free-text-section"],[1,"search-indicator"],["type","button","role","option",1,"choice-button",3,"click","disabled","id"],[1,"choice-button-label"],[1,"choice-button-icon"],[1,"free-text-hint"],[1,"free-text-input-row"],["type","text","placeholder","Type a custom answer\u2026","aria-label","Custom answer",1,"free-text-input",3,"ngModelChange","keydown","ngModel"],["type","button","aria-label","Send custom answer",1,"free-text-send-btn",3,"click","disabled"]],template:function(t,n){t&1&&C(0,Uh,9,6,"div",2),t&2&&S(n.isVisible?0:-1)},dependencies:[ke,se,lt,_t,at,st,xl],styles:[".choice-container[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;gap:1rem}.choice-label[_ngcontent-%COMP%]{display:block;font-weight:500;color:var(--color-text);font-size:1rem;line-height:1.5}.choice-label[_ngcontent-%COMP%] p{margin:0 0 .5rem}.choice-label[_ngcontent-%COMP%] p:last-child{margin-bottom:0}.choice-label[_ngcontent-%COMP%] code{background:var(--color-code-bg);padding:.2em .4em;border-radius:4px;font-family:monospace;font-size:.9em}.choice-label[_ngcontent-%COMP%] strong{font-weight:600}.choice-buttons[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem;max-height:400px;overflow-y:auto;padding:.5rem;background:var(--color-background);border:2px solid var(--color-border);border-radius:12px;outline:none}.choice-buttons[_ngcontent-%COMP%]:focus-within{border-color:var(--color-primary);box-shadow:0 0 0 3px #007aff1a}.choice-buttons[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.choice-buttons[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:var(--color-background);border-radius:4px}.choice-buttons[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.choice-buttons[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.choice-button[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;width:100%;padding:.75rem 1rem;border:1px solid var(--color-border);border-radius:8px;background:var(--color-background);color:var(--color-text);font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,system-ui,sans-serif;font-size:1rem;text-align:left;cursor:pointer;transition:all .2s ease}.choice-button[_ngcontent-%COMP%]:hover:not(:disabled):not(.highlighted){background:var(--color-bg-hover);border-color:var(--color-primary);transform:translate(2px)}.choice-button.highlighted[_ngcontent-%COMP%]{background:var(--color-primary);color:#fff;border-color:var(--color-primary);box-shadow:0 2px 8px #007aff4d}.choice-button.highlighted[_ngcontent-%COMP%] .choice-button-icon[_ngcontent-%COMP%]{color:#fff}.choice-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}.choice-button[_ngcontent-%COMP%]:focus{outline:none}.choice-button-label[_ngcontent-%COMP%]{flex:1;line-height:1.5}.choice-button-icon[_ngcontent-%COMP%]{flex-shrink:0;margin-left:.5rem;font-size:1.2rem;width:1.2rem;height:1.2rem}.free-text-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.free-text-hint[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.free-text-input-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:center}.free-text-input[_ngcontent-%COMP%]{flex:1;padding:.625rem .875rem;border:1px solid var(--color-border);border-radius:8px;background:var(--color-background);color:var(--color-text);font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,system-ui,sans-serif;font-size:1rem;outline:none;transition:border-color .2s ease,box-shadow .2s ease}.free-text-input[_ngcontent-%COMP%]:focus{border-color:var(--color-primary);box-shadow:0 0 0 3px #007aff1a}.free-text-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);opacity:.7}.free-text-send-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;flex-shrink:0;border:none;border-radius:8px;background:var(--color-primary);color:#fff;cursor:pointer;transition:background .2s ease,opacity .2s ease}.free-text-send-btn[_ngcontent-%COMP%]:hover:not(:disabled){opacity:.9}.free-text-send-btn[_ngcontent-%COMP%]:disabled{opacity:.4;cursor:not-allowed}.free-text-send-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.2rem;width:1.2rem;height:1.2rem}.search-indicator[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.5rem 1rem;background:var(--color-primary);color:#fff;border-radius:8px;font-size:.9rem;font-weight:500;animation:_ngcontent-%COMP%_fadeIn .2s ease}.search-indicator[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem;color:#fff}@keyframes _ngcontent-%COMP%_fadeIn{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@media(max-width:480px){.choice-container[_ngcontent-%COMP%]{gap:.75rem}.choice-label[_ngcontent-%COMP%]{font-size:.95rem}.choice-buttons[_ngcontent-%COMP%]{max-height:300px;gap:.375rem}.choice-button[_ngcontent-%COMP%]{font-size:.95rem;padding:.625rem .875rem}}@media print{.choice-buttons[_ngcontent-%COMP%]{max-height:none;overflow:visible}.search-indicator[_ngcontent-%COMP%]{display:none!important}}"]})};var Mi="coday_oauth_callback",Fo=class i{route=f(jr);message="Authentication in progress...";ngOnInit(){console.log("[OAuth Callback] Component initialized");let e=this.route.snapshot.queryParamMap.get("code"),t=this.route.snapshot.queryParamMap.get("state"),n=this.route.snapshot.queryParamMap.get("error"),r=this.route.snapshot.queryParamMap.get("error_description");if(console.log("[OAuth Callback] Code:",e,"State:",t,"Error:",n,"Opener:",!!window.opener),n){if(console.log("[OAuth Callback] OAuth error received:",n,r),!window.opener){console.warn("[OAuth Callback] No window.opener \u2014 using localStorage fallback for error"),localStorage.setItem(Mi,JSON.stringify({error:n,state:t,errorDescription:r})),this.message="Authentication failed. You can close this window.",setTimeout(()=>window.close(),1e3);return}try{window.opener.postMessage({error:n,state:t,errorDescription:r},window.location.origin),console.log("[OAuth Callback] Error postMessage sent successfully"),setTimeout(()=>{console.log("[OAuth Callback] Closing popup after error"),window.close()},1e3)}catch(o){console.error("[OAuth Callback] Error sending error postMessage:",o),alert("OAuth error: Failed to communicate with parent window")}return}if(!e){console.error("[OAuth Callback] Missing authorization code"),this.message="OAuth callback error: Missing authorization code.";return}if(!window.opener){console.warn("[OAuth Callback] No window.opener \u2014 using localStorage fallback"),localStorage.setItem(Mi,JSON.stringify({code:e,state:t})),this.message="Authentication complete. You can close this window.",setTimeout(()=>window.close(),1e3);return}try{console.log("[OAuth Callback] Sending postMessage to parent"),window.opener.postMessage({code:e,state:t},window.location.origin),console.log("[OAuth Callback] postMessage sent successfully"),setTimeout(()=>{console.log("[OAuth Callback] Closing popup"),window.close()},1e3)}catch(o){console.error("[OAuth Callback] Error sending postMessage:",o),alert("OAuth callback error: Failed to communicate with parent window")}}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-oauth-callback"]],decls:2,vars:1,template:function(t,n){t&1&&(hn(0,"p"),u(1),gn()),t&2&&(p(),L(n.message))},encapsulation:2})};var Sn=class i{eventStream=f(Gt);messageApi=f(vi);pendingStates=new Map;popupCheckInterval=null;popupClosedAt=null;static POPUP_CLOSE_GRACE_MS=2e3;pendingRequest$=new W(null);messageHandler=e=>this.handlePopupMessage(e);storageHandler=e=>this.handleStorageEvent(e);constructor(){this.eventStream.events$.pipe(ve(e=>e.type==="oauth_request")).subscribe(e=>this.handleOAuthRequest(e)),window.addEventListener("message",this.messageHandler),window.addEventListener("storage",this.storageHandler),this.drainLocalStorage()}ngOnDestroy(){window.removeEventListener("message",this.messageHandler),window.removeEventListener("storage",this.storageHandler),this.pendingRequest$.complete(),this.popupCheckInterval&&clearInterval(this.popupCheckInterval)}startPopupMonitoring(e,t){this.popupCheckInterval&&clearInterval(this.popupCheckInterval),this.popupCheckInterval=setInterval(()=>{if(e.closed){if(this.popupClosedAt===null){this.popupClosedAt=Date.now(),console.log("[OAuth Service] Popup closed, waiting for postMessage grace period...");return}if(Date.now()-this.popupClosedAt<i.POPUP_CLOSE_GRACE_MS)return;if(console.log("[OAuth Service] Grace period elapsed, popup closed by user"),clearInterval(this.popupCheckInterval),this.popupCheckInterval=null,this.popupClosedAt=null,this.pendingStates.has(t)){console.warn("[OAuth Service] OAuth cancelled - popup closed without completing authentication");let r=this.pendingStates.get(t);if(this.pendingStates.delete(t),r){let o=new At({state:t,integrationName:r,error:"user_cancelled",errorDescription:"User closed the popup without completing authentication"});this.messageApi.sendMessage(o).subscribe({next:()=>console.log("[OAuth Service] Cancellation sent to backend"),error:a=>console.error("[OAuth Service] Failed to send cancellation:",a)})}}}else this.popupClosedAt!==null&&(console.log("[OAuth Service] Popup reopened/navigating, resetting grace period"),this.popupClosedAt=null)},500)}openPopup(e){console.log("[OAuth Service] Opening popup from user gesture:",e.integrationName);let t=600,n=900,r=window.screenX+(window.outerWidth-t)/2,o=window.screenY+(window.outerHeight-n)/2,a=`width=${t},height=${n},left=${r},top=${o},popup=yes,resizable=yes,scrollbars=yes`,s=window.open(e.authUrl,"oauth_popup",a);console.log("[OAuth Service] Popup opened:",!!s),s?(s.focus(),this.startPopupMonitoring(s,e.state),this.pendingRequest$.next(null)):console.warn("[OAuth Service] Popup was blocked by the browser")}cancelRequest(e){console.log("[OAuth Service] OAuth cancelled by user via inline panel"),this.pendingStates.delete(e.state),this.pendingRequest$.next(null);let t=new At({state:e.state,integrationName:e.integrationName,error:"user_cancelled",errorDescription:"User dismissed the authorization panel"});this.messageApi.sendMessage(t).subscribe({next:()=>console.log("[OAuth Service] Cancellation sent to backend"),error:n=>console.error("[OAuth Service] Failed to send cancellation:",n)})}handleOAuthRequest(e){console.log("[OAuth Service] Received OAuthRequestEvent:",e.integrationName,e.state),this.pendingStates.set(e.state,e.integrationName),console.log("[OAuth Service] Pending states:",Array.from(this.pendingStates.keys())),this.pendingRequest$.next(e)}handlePopupMessage(e){if(console.log("[OAuth Service] Received postMessage:",e.origin,e.data),e.origin!==window.location.origin){console.warn("[OAuth Service] Rejected message from different origin:",e.origin);return}this.processCallbackData(e.data)}handleStorageEvent(e){e.key!==Mi||!e.newValue||(console.log("[OAuth Service] Received localStorage callback fallback"),this.drainLocalStorage())}drainLocalStorage(){let e=localStorage.getItem(Mi);if(e){localStorage.removeItem(Mi),console.log("[OAuth Service] Processing localStorage OAuth callback fallback");try{let t=JSON.parse(e);this.processCallbackData(t)}catch(t){console.error("[OAuth Service] Failed to parse localStorage OAuth callback:",t)}}}processCallbackData(e){let{code:t,state:n,error:r,errorDescription:o}=e??{};if(r){console.log("[OAuth Service] OAuth error received:",r,o);let m=this.pendingStates.get(n);if(m){this.pendingStates.delete(n),this.popupCheckInterval&&(clearInterval(this.popupCheckInterval),this.popupCheckInterval=null,this.popupClosedAt=null);let _=new At({state:n,integrationName:m,error:r,errorDescription:o});this.messageApi.sendMessage(_).subscribe({next:()=>console.log("[OAuth Service] Error callback sent to backend"),error:b=>console.error("[OAuth Service] Failed to send error callback:",b)})}return}if(!t){console.warn("[OAuth Service] Message missing code:",e);return}console.log("[OAuth Service] Processing callback - code:",t,"state:",n);let a=n?this.pendingStates.get(n):void 0,s=n;if(!a&&this.pendingStates.size===1){let m=this.pendingStates.entries().next().value;if(m){let[_,b]=m;console.warn("[OAuth Service] State missing from callback, using sole pending flow:",b),a=b,s=_}}if(!a){console.warn("[OAuth Service] Unknown or ambiguous state:",n,"Pending states:",Array.from(this.pendingStates.keys()));return}console.log("[OAuth Service] Found integration:",a),this.pendingStates.delete(s),this.popupCheckInterval&&(clearInterval(this.popupCheckInterval),this.popupCheckInterval=null,this.popupClosedAt=null);let d=new At({code:t,state:s,integrationName:a});console.log("[OAuth Service] Sending callback to backend..."),this.messageApi.sendMessage(d).subscribe({next:()=>console.log("[OAuth Service] Callback sent to backend successfully"),error:m=>console.error("[OAuth Service] Failed to send callback:",m)})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};function Wh(i,e){if(i&1){let t=O();l(0,"div",0)(1,"div",1)(2,"mat-icon"),u(3,"lock_open"),c()(),l(4,"div",2)(5,"p",3),u(6,"Authorization required"),c(),l(7,"p",4)(8,"strong"),u(9),c(),u(10," needs your permission to continue. "),c()(),l(11,"div",5)(12,"button",6),v("click",function(){let r=x(t),o=h();return w(o.onCancel(r))}),u(13,"Cancel"),c(),l(14,"button",7),v("click",function(){let r=x(t),o=h();return w(o.onAuthorize(r))}),l(15,"mat-icon"),u(16,"open_in_new"),c(),u(17," Authorize "),c()()()}i&2&&(p(9),L(e.integrationName))}var Lo=class i{oauthService=f(Sn);pendingRequest=Ie(this.oauthService.pendingRequest$,{initialValue:null});onAuthorize(e){this.oauthService.openPopup(e)}onCancel(e){this.oauthService.cancelRequest(e)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-oauth-request-panel"]],decls:1,vars:1,consts:[[1,"oauth-panel"],[1,"oauth-icon"],[1,"oauth-content"],[1,"oauth-title"],[1,"oauth-description"],[1,"oauth-actions"],["type","button",1,"oauth-btn","oauth-btn--cancel",3,"click"],["type","button",1,"oauth-btn","oauth-btn--authorize",3,"click"]],template:function(t,n){if(t&1&&C(0,Wh,18,1,"div",0),t&2){let r;S((r=n.pendingRequest())?0:-1,r)}},dependencies:[ke,se],styles:[".oauth-panel[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;padding:1rem;border:1px solid var(--color-border);border-radius:12px;background:var(--color-background);width:100%}@media(max-width:480px){.oauth-panel[_ngcontent-%COMP%]{flex-direction:column;align-items:flex-start}}.oauth-icon[_ngcontent-%COMP%]{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;border-radius:50%;background:var(--color-primary);color:#fff}.oauth-icon[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.oauth-content[_ngcontent-%COMP%]{flex:1;min-width:0}.oauth-title[_ngcontent-%COMP%]{margin:0 0 .25rem;font-weight:600;font-size:.95rem;color:var(--color-text)}.oauth-description[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary)}.oauth-actions[_ngcontent-%COMP%]{display:flex;gap:.5rem;flex-shrink:0}.oauth-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;padding:.5rem 1rem;border-radius:8px;border:1px solid var(--color-border);font-size:.9rem;font-family:inherit;cursor:pointer;transition:all .2s ease}.oauth-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1rem;width:1rem;height:1rem}.oauth-btn--cancel[_ngcontent-%COMP%]{background:var(--color-background);color:var(--color-text-secondary)}.oauth-btn--cancel[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);color:var(--color-text)}.oauth-btn--authorize[_ngcontent-%COMP%]{background:var(--color-primary);color:#fff;border-color:var(--color-primary)}.oauth-btn--authorize[_ngcontent-%COMP%]:hover{opacity:.9}"],changeDetection:0})};var jo=class i{http=f(rt);projectState=f(ye);threadState=f(Ye);getBaseUrl(){return`/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/threads/${this.threadState.getSelectedThreadIdOrThrow()}/files`}uploadFile(e){let t=this.projectState.getSelectedProjectIdOrThrow(),n=this.threadState.getSelectedThreadIdOrThrow();return new Er(r=>{let o=new FileReader;o.onload=()=>{let s=o.result.split(",")[1];this.http.post(`/api/projects/${t}/threads/${n}/upload`,{content:s,mimeType:e.type||"application/octet-stream",filename:e.name}).subscribe({next:d=>{r.next({success:d.success,filename:d.filename}),r.complete()},error:d=>r.error(d)})},o.onerror=()=>r.error(new Error("Failed to read file")),o.readAsDataURL(e)})}listFiles(){return this.http.get(this.getBaseUrl()).pipe(Ae(e=>e.files))}downloadFile(e){let t=encodeURIComponent(e);return this.http.get(`${this.getBaseUrl()}/${t}`,{responseType:"blob"})}deleteFile(e){let t=encodeURIComponent(e);return this.http.delete(`${this.getBaseUrl()}/${t}`)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var ki=class i{fileApi=f(jo);eventStream=f(Gt);filesSignal=qe([]);isLoadingSignal=qe(!1);currentProjectSignal=qe(null);currentThreadSignal=qe(null);files=Tt(()=>this.filesSignal());isLoading=Tt(()=>this.isLoadingSignal());fileCount=Tt(()=>this.filesSignal().length);constructor(){this.subscribeToFileEvents()}initializeForThread(e,t){this.currentProjectSignal.set(e),this.currentThreadSignal.set(t),this.refreshFileList()}clear(){this.filesSignal.set([]),this.currentProjectSignal.set(null),this.currentThreadSignal.set(null)}refreshFileList(){this.isLoadingSignal.set(!0),this.fileApi.listFiles().subscribe({next:e=>{let t=e.map(n=>he(G({},n),{lastModified:new Date(n.lastModified)})).sort((n,r)=>r.lastModified.getTime()-n.lastModified.getTime());this.filesSignal.set(t),this.isLoadingSignal.set(!1)},error:e=>{console.error("[FILE_EXCHANGE_STATE] Error loading files:",e),this.isLoadingSignal.set(!1)}})}uploadFile(e){return B(this,null,function*(){return new Promise(t=>{this.fileApi.uploadFile(e).subscribe({next:()=>{this.refreshFileList(),t({success:!0})},error:n=>{console.error("[FILE_EXCHANGE_STATE] Upload error:",n),t({success:!1,error:n.message||"Upload failed"})}})})})}downloadAllFiles(){let e=this.filesSignal();if(e.length===0){console.warn("[FILE_EXCHANGE_STATE] No files to download");return}e.forEach((t,n)=>{setTimeout(()=>{this.downloadFile(t.filename)},n*300)})}downloadFile(e){this.fileApi.downloadFile(e).subscribe({next:t=>{let n=window.URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=e,r.click(),window.URL.revokeObjectURL(n)},error:t=>{console.error("[FILE_EXCHANGE_STATE] Download error:",t)}})}deleteFile(e){return B(this,null,function*(){return new Promise(t=>{this.fileApi.deleteFile(e).subscribe({next:()=>{this.refreshFileList(),t({success:!0})},error:n=>{console.error("[FILE_EXCHANGE_STATE] Delete error:",n),t({success:!1,error:n.message||"Delete failed"})}})})})}subscribeToFileEvents(){this.eventStream.events$.pipe(ve(e=>e instanceof Cn),ot()).subscribe(e=>{this.handleFileEvent(e)})}handleFileEvent(e){let t=this.filesSignal();switch(e.operation){case"created":{let n=e.timestamp,r=e.timestamp.lastIndexOf("-");if(r>0){let a=e.timestamp.substring(r+1);a.length===5&&/^[a-z0-9]+$/.test(a)&&(n=e.timestamp.substring(0,r))}let o={filename:e.filename,size:e.size||0,lastModified:new Date(n)};this.filesSignal.set([o,...t]);break}case"updated":{let n=t.filter(d=>d.filename!==e.filename),r=t.find(d=>d.filename===e.filename),o=e.timestamp,a=e.timestamp.lastIndexOf("-");if(a>0){let d=e.timestamp.substring(a+1);d.length===5&&/^[a-z0-9]+$/.test(d)&&(o=e.timestamp.substring(0,a))}let s={filename:e.filename,size:e.size||r?.size||0,lastModified:new Date(o)};this.filesSignal.set([s,...n]);break}case"deleted":{let n=t.filter(r=>r.filename!==e.filename);this.filesSignal.set(n);break}}}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};function qh(i,e){if(i&1&&F(0,"div",1),i&2){let t=h();T("innerHTML",t.renderedContent,ut)}}function Gh(i,e){if(i&1&&F(0,"iframe",2),i&2){let t=h();T("srcdoc",t.content,ut)}}function Yh(i,e){if(i&1&&(l(0,"pre",3),u(1),c()),i&2){let t=h();p(),L(t.content)}}var Vo=class i{content="";format="text";renderedContent="";sanitizer=f(Vt);markdownService=f(Jt);ngOnChanges(e){(e.content||e.format)&&this.renderContent()}renderContent(){this.format==="markdown"?this.renderMarkdown():this.format==="json"&&this.formatJson()}renderMarkdown(){return B(this,null,function*(){try{let e=yield this.markdownService.parse(this.content);this.renderedContent=this.sanitizer.bypassSecurityTrustHtml(e)}catch(e){console.error("[CONTENT_RENDERER] Error rendering markdown:",e),this.content=this.content}})}formatJson(){try{let e=JSON.parse(this.content);this.content=JSON.stringify(e,null,2)}catch(e){console.error("[CONTENT_RENDERER] Error formatting JSON:",e)}}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-content-renderer"]],inputs:{content:"content",format:"format"},features:[jt],decls:4,vars:2,consts:[[1,"content-renderer",3,"ngClass"],[1,"markdown-content",3,"innerHTML"],["sandbox","allow-same-origin",1,"html-viewer",3,"srcdoc"],[1,"code-content"]],template:function(t,n){t&1&&(l(0,"div",0),C(1,qh,1,1,"div",1)(2,Gh,1,1,"iframe",2)(3,Yh,2,1,"pre",3),c()),t&2&&(T("ngClass","format-"+n.format),p(),S(n.format==="markdown"?1:n.format==="html"?2:3))},dependencies:[it,Fr],styles:[".content-renderer[_ngcontent-%COMP%]{width:100%;height:100%;overflow:auto;padding:1rem}.markdown-content[_ngcontent-%COMP%]{line-height:1.6;color:var(--color-text)}.code-content[_ngcontent-%COMP%]{font-family:Monaco,Menlo,Ubuntu Mono,monospace;font-size:.9rem;line-height:1.5;margin:0;white-space:pre-wrap;word-wrap:break-word;color:var(--color-text)}.format-json[_ngcontent-%COMP%] .code-content[_ngcontent-%COMP%]{color:var(--color-code-text, #d63384)}.format-yaml[_ngcontent-%COMP%] .code-content[_ngcontent-%COMP%], .format-text[_ngcontent-%COMP%] .code-content[_ngcontent-%COMP%]{color:var(--color-text)}.html-viewer[_ngcontent-%COMP%]{width:100%;height:100%;min-height:400px;border:1px solid var(--color-border);border-radius:8px;background:#fff}"]})};var Pi=class i{http=f(rt);MAX_FILE_SIZE=20*1024*1024;isViewable(e){return e<=this.MAX_FILE_SIZE}isFormatViewable(e){let t=e.split(".").pop()?.toLowerCase();return!(t&&["pdf","png","jpg","jpeg","gif","webp","zip","tar","gz","exe","bin","doc","docx","xls","xlsx","ppt","pptx"].includes(t))}detectFormat(e){switch(e.split(".").pop()?.toLowerCase()){case"md":return"markdown";case"json":return"json";case"yaml":case"yml":return"yaml";case"html":case"htm":return"html";default:return"text"}}loadFileContent(e,t,n){let r=`/api/projects/${e}/threads/${t}/files/${encodeURIComponent(n)}`,o=this.detectFormat(n);return this.http.get(r,{responseType:"text",observe:"response"}).pipe(Ae(a=>{let s=a.body||"",d=new Blob([s]).size;return{content:s,format:o,filename:n,size:d}}),mn(a=>(console.error("[CONTENT_VIEWER] Error loading file:",n,a),ei(()=>new Error(`Failed to load file: ${a.message||"Unknown error"}`)))))}formatSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};function Qh(i,e){if(i&1){let t=O();l(0,"button",12),v("click",function(){x(t);let r=h();return w(r.download())}),l(1,"mat-icon"),u(2,"download"),c()()}}function Kh(i,e){i&1&&(l(0,"div",9),F(1,"mat-spinner",13),l(2,"p"),u(3,"Loading file content..."),c()())}function Xh(i,e){if(i&1){let t=O();l(0,"div",10)(1,"mat-icon",14),u(2,"error_outline"),c(),l(3,"p",15),u(4),c(),l(5,"button",16),v("click",function(){x(t);let r=h();return w(r.download())}),l(6,"mat-icon"),u(7,"download"),c(),u(8," Download instead "),c()()}if(i&2){let t=h();p(4),L(t.error)}}function Jh(i,e){if(i&1&&F(0,"app-content-renderer",11),i&2){let t=h();T("content",t.fileContent.content)("format",t.fileContent.format)}}var zo=class i{destroy$=new J;file;projectName;threadId;closeViewer=new Z;contentService=f(Pi);eventStream=f(Gt);fileContent=null;isLoading=!1;error="";ngOnInit(){this.loadContent(),this.subscribeToFileEvents()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}loadContent(){if(!this.contentService.isViewable(this.file.size)){this.error=`File too large to view (${this.contentService.formatSize(this.file.size)}). Maximum size: 20 MB.`;return}this.isLoading=!0,this.error="",this.contentService.loadFileContent(this.projectName,this.threadId,this.file.filename).subscribe({next:e=>{console.log("[CONTENT_VIEWER] Content loaded:",e.filename),this.fileContent=e,this.isLoading=!1},error:e=>{console.error("[CONTENT_VIEWER] Error loading content:",e),this.error=e.message||"Failed to load file content",this.isLoading=!1}})}onClose(){this.closeViewer.emit()}download(){let e=new Blob([this.fileContent?.content||""],{type:"text/plain"}),t=window.URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=this.file.filename,n.click(),window.URL.revokeObjectURL(t)}formatSize(e){return this.contentService.formatSize(e)}subscribeToFileEvents(){this.eventStream.events$.pipe(ve(e=>e instanceof Cn),ve(e=>e.filename===this.file.filename),ve(e=>e.operation==="updated"),D(this.destroy$)).subscribe(e=>{console.log("[CONTENT_VIEWER] File updated event received, reloading:",e.filename),e.size&&(this.file.size=e.size),this.loadContent()})}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-content-viewer"]],inputs:{file:"file",projectName:"projectName",threadId:"threadId"},outputs:{closeViewer:"closeViewer"},decls:16,vars:6,consts:[[1,"viewer-container"],[1,"viewer-header"],[1,"header-info"],[1,"filename"],[1,"file-size"],[1,"header-actions"],["mat-icon-button","","title","Download","type","button"],["mat-icon-button","","title","Close","type","button",3,"click"],[1,"viewer-content"],[1,"loading-state"],[1,"error-state"],[3,"content","format"],["mat-icon-button","","title","Download","type","button",3,"click"],["diameter","48"],[1,"error-icon"],[1,"error-message"],["mat-raised-button","","color","primary","type","button",3,"click"]],template:function(t,n){t&1&&(l(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),u(4),c(),l(5,"span",4),u(6),c()(),l(7,"div",5),C(8,Qh,3,0,"button",6),l(9,"button",7),v("click",function(){return n.onClose()}),l(10,"mat-icon"),u(11,"chevron_right"),c()()()(),l(12,"div",8),C(13,Kh,4,0,"div",9),C(14,Xh,9,1,"div",10),C(15,Jh,1,2,"app-content-renderer",11),c()()),t&2&&(p(4),L(n.file.filename),p(2),L(n.formatSize(n.file.size)),p(2),S(n.fileContent&&!n.isLoading&&!n.error?8:-1),p(5),S(n.isLoading?13:-1),p(),S(n.error?14:-1),p(),S(n.fileContent&&!n.isLoading&&!n.error?15:-1))},dependencies:[it,ke,se,Ge,si,ze,wi,xi,Vo],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;height:100%}.viewer-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;height:100%;background:var(--color-bg)}.viewer-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:1rem;border-bottom:1px solid var(--color-border);background:var(--color-bg);flex-shrink:0}.header-info[_ngcontent-%COMP%]{flex:1;min-width:0;display:flex;flex-direction:column;gap:.25rem}.filename[_ngcontent-%COMP%]{font-weight:500;color:var(--color-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-size[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary)}.header-actions[_ngcontent-%COMP%]{display:flex;gap:.25rem;flex-shrink:0}.viewer-content[_ngcontent-%COMP%]{flex:1;overflow:auto;background:var(--color-bg)}.loading-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:1rem;color:var(--color-text-secondary)}.error-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:1rem;padding:2rem;text-align:center}.error-icon[_ngcontent-%COMP%]{font-size:3rem;width:3rem;height:3rem;color:var(--color-error)}.error-message[_ngcontent-%COMP%]{color:var(--color-text);margin:0;max-width:400px}"]})};var Zh=Math.pow(10,8)*24*60*60*1e3,nT=-Zh,$o=6048e5,Hd=864e5;var eg=3600;var Ud=eg*24,iT=Ud*7,tg=Ud*365.2425,ng=tg/12,rT=ng*3,Is=Symbol.for("constructDateFrom");function Fe(i,e){return typeof i=="function"?i(e):i&&typeof i=="object"&&Is in i?i[Is](e):i instanceof Date?new i.constructor(e):new Date(e)}function Se(i,e){return Fe(e||i,i)}function Wd(i,e,t){let n=Se(i,t?.in);return isNaN(e)?Fe(t?.in||i,NaN):(e&&n.setDate(n.getDate()+e),n)}var ig={};function xn(){return ig}function ln(i,e){let t=xn(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,r=Se(i,e?.in),o=r.getDay(),a=(o<n?7:0)+o-n;return r.setDate(r.getDate()-a),r.setHours(0,0,0,0),r}function Un(i,e){return ln(i,he(G({},e),{weekStartsOn:1}))}function Bo(i,e){let t=Se(i,e?.in),n=t.getFullYear(),r=Fe(t,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);let o=Un(r),a=Fe(t,0);a.setFullYear(n,0,4),a.setHours(0,0,0,0);let s=Un(a);return t.getTime()>=o.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function Ds(i){let e=Se(i),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+i-+t}function Oi(i,...e){let t=Fe.bind(null,i||e.find(n=>typeof n=="object"));return e.map(t)}function Ai(i,e){let t=Se(i,e?.in);return t.setHours(0,0,0,0),t}function Ho(i,e,t){let[n,r]=Oi(t?.in,i,e),o=Ai(n),a=Ai(r),s=+o-Ds(o),d=+a-Ds(a);return Math.round((s-d)/Hd)}function qd(i,e){let t=Bo(i,e),n=Fe(e?.in||i,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Un(n)}function Gd(i){return Fe(i,Date.now())}function Yd(i,e,t){let[n,r]=Oi(t?.in,i,e);return+Ai(n)==+Ai(r)}function Qd(i){return i instanceof Date||typeof i=="object"&&Object.prototype.toString.call(i)==="[object Date]"}function Kd(i){return!(!Qd(i)&&typeof i!="number"||isNaN(+Se(i)))}function Jd(i,e,t){let[n,r]=Oi(t?.in,i,e),o=Xd(n,r),a=Math.abs(Ho(n,r));n.setDate(n.getDate()-o*a);let s=+(Xd(n,r)===-o),d=o*(a-s);return d===0?0:d}function Xd(i,e){let t=i.getFullYear()-e.getFullYear()||i.getMonth()-e.getMonth()||i.getDate()-e.getDate()||i.getHours()-e.getHours()||i.getMinutes()-e.getMinutes()||i.getSeconds()-e.getSeconds()||i.getMilliseconds()-e.getMilliseconds();return t<0?-1:t>0?1:t}function Zd(i,e){let t=Se(i,e?.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}var rg={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ep=(i,e,t)=>{let n,r=rg[i];return typeof r=="string"?n=r:e===1?n=r.one:n=r.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function Uo(i){return(e={})=>{let t=e.width?String(e.width):i.defaultWidth;return i.formats[t]||i.formats[i.defaultWidth]}}var og={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ag={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},sg={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},tp={date:Uo({formats:og,defaultWidth:"full"}),time:Uo({formats:ag,defaultWidth:"full"}),dateTime:Uo({formats:sg,defaultWidth:"full"})};var lg={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},np=(i,e,t,n)=>lg[i];function Ii(i){return(e,t)=>{let n=t?.context?String(t.context):"standalone",r;if(n==="formatting"&&i.formattingValues){let a=i.defaultFormattingWidth||i.defaultWidth,s=t?.width?String(t.width):a;r=i.formattingValues[s]||i.formattingValues[a]}else{let a=i.defaultWidth,s=t?.width?String(t.width):i.defaultWidth;r=i.values[s]||i.values[a]}let o=i.argumentCallback?i.argumentCallback(e):e;return r[o]}}var cg={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},dg={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},pg={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},mg={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},ug={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},hg={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},gg=(i,e)=>{let t=Number(i),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},ip={ordinalNumber:gg,era:Ii({values:cg,defaultWidth:"wide"}),quarter:Ii({values:dg,defaultWidth:"wide",argumentCallback:i=>i-1}),month:Ii({values:pg,defaultWidth:"wide"}),day:Ii({values:mg,defaultWidth:"wide"}),dayPeriod:Ii({values:ug,defaultWidth:"wide",formattingValues:hg,defaultFormattingWidth:"wide"})};function Di(i){return(e,t={})=>{let n=t.width,r=n&&i.matchPatterns[n]||i.matchPatterns[i.defaultMatchWidth],o=e.match(r);if(!o)return null;let a=o[0],s=n&&i.parsePatterns[n]||i.parsePatterns[i.defaultParseWidth],d=Array.isArray(s)?_g(s,b=>b.test(a)):fg(s,b=>b.test(a)),m;m=i.valueCallback?i.valueCallback(d):d,m=t.valueCallback?t.valueCallback(m):m;let _=e.slice(a.length);return{value:m,rest:_}}}function fg(i,e){for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&e(i[t]))return t}function _g(i,e){for(let t=0;t<i.length;t++)if(e(i[t]))return t}function rp(i){return(e,t={})=>{let n=e.match(i.matchPattern);if(!n)return null;let r=n[0],o=e.match(i.parsePattern);if(!o)return null;let a=i.valueCallback?i.valueCallback(o[0]):o[0];a=t.valueCallback?t.valueCallback(a):a;let s=e.slice(r.length);return{value:a,rest:s}}}var bg=/^(\d+)(th|st|nd|rd)?/i,vg=/\d+/i,yg={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Cg={any:[/^b/i,/^(a|c)/i]},Sg={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},xg={any:[/1/i,/2/i,/3/i,/4/i]},wg={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Tg={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Eg={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Mg={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},kg={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Pg={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},op={ordinalNumber:rp({matchPattern:bg,parsePattern:vg,valueCallback:i=>parseInt(i,10)}),era:Di({matchPatterns:yg,defaultMatchWidth:"wide",parsePatterns:Cg,defaultParseWidth:"any"}),quarter:Di({matchPatterns:Sg,defaultMatchWidth:"wide",parsePatterns:xg,defaultParseWidth:"any",valueCallback:i=>i+1}),month:Di({matchPatterns:wg,defaultMatchWidth:"wide",parsePatterns:Tg,defaultParseWidth:"any"}),day:Di({matchPatterns:Eg,defaultMatchWidth:"wide",parsePatterns:Mg,defaultParseWidth:"any"}),dayPeriod:Di({matchPatterns:kg,defaultMatchWidth:"any",parsePatterns:Pg,defaultParseWidth:"any"})};var Rs={code:"en-US",formatDistance:ep,formatLong:tp,formatRelative:np,localize:ip,match:op,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ap(i,e){let t=Se(i,e?.in);return Ho(t,Zd(t))+1}function sp(i,e){let t=Se(i,e?.in),n=+Un(t)-+qd(t);return Math.round(n/$o)+1}function Wo(i,e){let t=Se(i,e?.in),n=t.getFullYear(),r=xn(),o=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=Fe(e?.in||i,0);a.setFullYear(n+1,0,o),a.setHours(0,0,0,0);let s=ln(a,e),d=Fe(e?.in||i,0);d.setFullYear(n,0,o),d.setHours(0,0,0,0);let m=ln(d,e);return+t>=+s?n+1:+t>=+m?n:n-1}function lp(i,e){let t=xn(),n=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,r=Wo(i,e),o=Fe(e?.in||i,0);return o.setFullYear(r,0,n),o.setHours(0,0,0,0),ln(o,e)}function cp(i,e){let t=Se(i,e?.in),n=+ln(t,e)-+lp(t,e);return Math.round(n/$o)+1}function ae(i,e){let t=i<0?"-":"",n=Math.abs(i).toString().padStart(e,"0");return t+n}var cn={y(i,e){let t=i.getFullYear(),n=t>0?t:1-t;return ae(e==="yy"?n%100:n,e.length)},M(i,e){let t=i.getMonth();return e==="M"?String(t+1):ae(t+1,2)},d(i,e){return ae(i.getDate(),e.length)},a(i,e){let t=i.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];default:return t==="am"?"a.m.":"p.m."}},h(i,e){return ae(i.getHours()%12||12,e.length)},H(i,e){return ae(i.getHours(),e.length)},m(i,e){return ae(i.getMinutes(),e.length)},s(i,e){return ae(i.getSeconds(),e.length)},S(i,e){let t=e.length,n=i.getMilliseconds(),r=Math.trunc(n*Math.pow(10,t-3));return ae(r,e.length)}};var Ri={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ns={G:function(i,e,t){let n=i.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});default:return t.era(n,{width:"wide"})}},y:function(i,e,t){if(e==="yo"){let n=i.getFullYear(),r=n>0?n:1-n;return t.ordinalNumber(r,{unit:"year"})}return cn.y(i,e)},Y:function(i,e,t,n){let r=Wo(i,n),o=r>0?r:1-r;if(e==="YY"){let a=o%100;return ae(a,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):ae(o,e.length)},R:function(i,e){let t=Bo(i);return ae(t,e.length)},u:function(i,e){let t=i.getFullYear();return ae(t,e.length)},Q:function(i,e,t){let n=Math.ceil((i.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return ae(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(i,e,t){let n=Math.ceil((i.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return ae(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(i,e,t){let n=i.getMonth();switch(e){case"M":case"MM":return cn.M(i,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(i,e,t){let n=i.getMonth();switch(e){case"L":return String(n+1);case"LL":return ae(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(i,e,t,n){let r=cp(i,n);return e==="wo"?t.ordinalNumber(r,{unit:"week"}):ae(r,e.length)},I:function(i,e,t){let n=sp(i);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):ae(n,e.length)},d:function(i,e,t){return e==="do"?t.ordinalNumber(i.getDate(),{unit:"date"}):cn.d(i,e)},D:function(i,e,t){let n=ap(i);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):ae(n,e.length)},E:function(i,e,t){let n=i.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(i,e,t,n){let r=i.getDay(),o=(r-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return ae(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(r,{width:"short",context:"formatting"});default:return t.day(r,{width:"wide",context:"formatting"})}},c:function(i,e,t,n){let r=i.getDay(),o=(r-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return ae(o,e.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(r,{width:"narrow",context:"standalone"});case"cccccc":return t.day(r,{width:"short",context:"standalone"});default:return t.day(r,{width:"wide",context:"standalone"})}},i:function(i,e,t){let n=i.getDay(),r=n===0?7:n;switch(e){case"i":return String(r);case"ii":return ae(r,e.length);case"io":return t.ordinalNumber(r,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(i,e,t){let r=i.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(r,{width:"narrow",context:"formatting"});default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(i,e,t){let n=i.getHours(),r;switch(n===12?r=Ri.noon:n===0?r=Ri.midnight:r=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(r,{width:"narrow",context:"formatting"});default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(i,e,t){let n=i.getHours(),r;switch(n>=17?r=Ri.evening:n>=12?r=Ri.afternoon:n>=4?r=Ri.morning:r=Ri.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(r,{width:"narrow",context:"formatting"});default:return t.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(i,e,t){if(e==="ho"){let n=i.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return cn.h(i,e)},H:function(i,e,t){return e==="Ho"?t.ordinalNumber(i.getHours(),{unit:"hour"}):cn.H(i,e)},K:function(i,e,t){let n=i.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):ae(n,e.length)},k:function(i,e,t){let n=i.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):ae(n,e.length)},m:function(i,e,t){return e==="mo"?t.ordinalNumber(i.getMinutes(),{unit:"minute"}):cn.m(i,e)},s:function(i,e,t){return e==="so"?t.ordinalNumber(i.getSeconds(),{unit:"second"}):cn.s(i,e)},S:function(i,e){return cn.S(i,e)},X:function(i,e,t){let n=i.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return pp(n);case"XXXX":case"XX":return Wn(n);default:return Wn(n,":")}},x:function(i,e,t){let n=i.getTimezoneOffset();switch(e){case"x":return pp(n);case"xxxx":case"xx":return Wn(n);default:return Wn(n,":")}},O:function(i,e,t){let n=i.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+dp(n,":");default:return"GMT"+Wn(n,":")}},z:function(i,e,t){let n=i.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+dp(n,":");default:return"GMT"+Wn(n,":")}},t:function(i,e,t){let n=Math.trunc(+i/1e3);return ae(n,e.length)},T:function(i,e,t){return ae(+i,e.length)}};function dp(i,e=""){let t=i>0?"-":"+",n=Math.abs(i),r=Math.trunc(n/60),o=n%60;return o===0?t+String(r):t+String(r)+e+ae(o,2)}function pp(i,e){return i%60===0?(i>0?"-":"+")+ae(Math.abs(i)/60,2):Wn(i,e)}function Wn(i,e=""){let t=i>0?"-":"+",n=Math.abs(i),r=ae(Math.trunc(n/60),2),o=ae(n%60,2);return t+r+e+o}var mp=(i,e)=>{switch(i){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},up=(i,e)=>{switch(i){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},Og=(i,e)=>{let t=i.match(/(P+)(p+)?/)||[],n=t[1],r=t[2];if(!r)return mp(i,e);let o;switch(n){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",mp(n,e)).replace("{{time}}",up(r,e))},hp={p:up,P:Og};var Ag=/^D+$/,Ig=/^Y+$/,Dg=["D","DD","YY","YYYY"];function gp(i){return Ag.test(i)}function fp(i){return Ig.test(i)}function _p(i,e,t){let n=Rg(i,e,t);if(console.warn(n),Dg.includes(i))throw new RangeError(n)}function Rg(i,e,t){let n=i[0]==="Y"?"years":"days of the month";return`Use \`${i.toLowerCase()}\` instead of \`${i}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var Ng=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Fg=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Lg=/^'([^]*?)'?$/,jg=/''/g,Vg=/[a-zA-Z]/;function Fs(i,e,t){let n=xn(),r=t?.locale??n.locale??Rs,o=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Se(i,t?.in);if(!Kd(s))throw new RangeError("Invalid time value");let d=e.match(Fg).map(_=>{let b=_[0];if(b==="p"||b==="P"){let y=hp[b];return y(_,r.formatLong)}return _}).join("").match(Ng).map(_=>{if(_==="''")return{isToken:!1,value:"'"};let b=_[0];if(b==="'")return{isToken:!1,value:zg(_)};if(Ns[b])return{isToken:!0,value:_};if(b.match(Vg))throw new RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:_}});r.localize.preprocessor&&(d=r.localize.preprocessor(s,d));let m={firstWeekContainsDate:o,weekStartsOn:a,locale:r};return d.map(_=>{if(!_.isToken)return _.value;let b=_.value;(!t?.useAdditionalWeekYearTokens&&fp(b)||!t?.useAdditionalDayOfYearTokens&&gp(b))&&_p(b,e,String(i));let y=Ns[b[0]];return y(s,b,r.localize,m)}).join("")}function zg(i){let e=i.match(Lg);return e?e[1].replace(jg,"'"):i}function bp(i,e,t){return Wd(i,-e,t)}function vp(i,e){return Yd(Fe(e?.in||i,i),bp(Gd(e?.in||i),1))}function yp(i){if(!i||isNaN(i.getTime()))return"unknown";let e=new Date,t=Fs(i,"HH:mm:ss"),n=e.getTime()-i.getTime(),r=Math.floor(n/(1e3*60));if(r<1)return`just now (${t})`;if(r<60)return`${r} min ago (${t})`;let o=Math.floor(n/(1e3*60*60));if(o<24)return`${o}h ago (${t})`;if(vp(i))return`yesterday ${t}`;let a=Jd(e,i);return a<7?`${a}d ago ${t}`:`${Fs(i,"dd/MM/yyyy")} ${t}`}var $g=(i,e)=>e.filename;function Bg(i,e){if(i&1){let t=O();l(0,"button",11),v("click",function(){x(t);let r=h(2);return w(r.downloadAll())}),l(1,"mat-icon"),u(2,"download_for_offline"),c()()}}function Hg(i,e){i&1&&(l(0,"div",10),F(1,"span",12),l(2,"span",13),u(3,"Loading files..."),c()())}function Ug(i,e){i&1&&(l(0,"div",14)(1,"mat-icon",15),u(2,"folder_open"),c(),l(3,"p",16),u(4,"No files in exchange space"),c(),l(5,"p",17),u(6,"Upload files to share with the agent"),c()())}function Wg(i,e){if(i&1){let t=O();l(0,"button",28),v("click",function(){x(t);let r=h().$implicit,o=h(4);return w(o.viewFile(r))}),l(1,"mat-icon"),u(2,"visibility"),c()()}}function qg(i,e){if(i&1){let t=O();l(0,"div",18)(1,"div",19)(2,"mat-icon",20),u(3),c(),l(4,"div",21)(5,"span",22),u(6),c(),l(7,"span",23),u(8),c()()(),l(9,"div",24),C(10,Wg,3,0,"button",25),l(11,"button",26),v("click",function(){let r=x(t).$implicit,o=h(4);return w(o.download(r))}),l(12,"mat-icon"),u(13,"download"),c()(),l(14,"button",27),v("click",function(){let r=x(t).$implicit,o=h(4);return w(o.delete(r))}),l(15,"mat-icon"),u(16,"delete"),c()()()()}if(i&2){let t=e.$implicit,n=h(4);p(3),L(n.getFileIcon(t.filename)),p(2),T("title",t.filename),p(),L(t.filename),p(2),oi("",n.formatSize(t.size)," \u2022 ",n.formatDate(t.lastModified)),p(2),S(n.canViewFile(t)?10:-1)}}function Gg(i,e){if(i&1&&we(0,qg,17,6,"div",18,$g),i&2){let t=h(3);Te(t.files())}}function Yg(i,e){if(i&1&&C(0,Ug,7,0,"div",14)(1,Gg,2,0),i&2){let t=h(2);S(t.files().length===0?0:1)}}function Qg(i,e){if(i&1){let t=O();l(0,"div",0)(1,"div",2)(2,"div",3)(3,"h3",4),u(4,"Exchange"),c(),l(5,"span",5),u(6),c()(),l(7,"div",6),C(8,Bg,3,0,"button",7),l(9,"button",8),v("click",function(){x(t);let r=h();return w(r.close())}),l(10,"mat-icon"),u(11,"chevron_right"),c()()()(),l(12,"div",9),C(13,Hg,4,0,"div",10)(14,Yg,2,1),c()()}if(i&2){let t=h();p(6),Ne("(",t.files().length,")"),p(2),S(t.files().length>0?8:-1),p(5),S(t.isLoading()?13:14)}}function Kg(i,e){if(i&1){let t=O();l(0,"app-content-viewer",29),v("closeViewer",function(){x(t);let r=h();return w(r.backToList())}),c()}if(i&2){let t=h();T("file",t.currentFile)("projectName",t.projectName)("threadId",t.threadId)}}var qo=class i{projectName;threadId;closeDrawer=new Z;fileExchangeState=f(ki);contentViewerService=f(Pi);files=this.fileExchangeState.files;isLoading=this.fileExchangeState.isLoading;viewerState="list";currentFile=null;close(){this.viewerState==="content"?this.backToList():this.closeDrawer.emit()}viewFile(e){this.currentFile=e,this.viewerState="content"}backToList(){this.viewerState="list",this.currentFile=null}downloadAll(){this.fileExchangeState.downloadAllFiles()}download(e){this.fileExchangeState.downloadFile(e.filename)}delete(e){return B(this,null,function*(){if(!confirm(`Delete file "${e.filename}"?`))return;let n=yield this.fileExchangeState.deleteFile(e.filename);n.success||alert(`Failed to delete file: ${n.error}`)})}getFileIcon(e){switch(e.split(".").pop()?.toLowerCase()){case"pdf":return"picture_as_pdf";case"csv":case"xlsx":case"xls":return"table_chart";case"txt":case"md":return"description";case"jpg":case"jpeg":case"png":case"gif":case"webp":return"image";case"zip":case"tar":case"gz":return"folder_zip";default:return"insert_drive_file"}}formatSize(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}formatDate(e){return yp(e)}canViewFile(e){return this.contentViewerService.isFormatViewable(e.filename)&&this.contentViewerService.isViewable(e.size)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-file-exchange-drawer"]],inputs:{projectName:"projectName",threadId:"threadId"},outputs:{closeDrawer:"closeDrawer"},decls:2,vars:2,consts:[[1,"file-drawer-container"],[3,"file","projectName","threadId"],[1,"drawer-header"],[1,"header-left"],[1,"drawer-title"],[1,"file-count"],[1,"header-actions"],["mat-icon-button","","title","Download all files","type","button",1,"download-all-btn"],["mat-icon-button","","title","Close","type","button",1,"close-btn",3,"click"],[1,"file-list"],[1,"file-loading"],["mat-icon-button","","title","Download all files","type","button",1,"download-all-btn",3,"click"],[1,"loading-spinner"],[1,"loading-text"],[1,"file-empty"],[1,"empty-icon"],[1,"empty-text"],[1,"empty-hint"],[1,"file-item"],[1,"file-info"],[1,"file-icon"],[1,"file-details"],[1,"file-name",3,"title"],[1,"file-meta"],[1,"file-actions"],["mat-icon-button","","title","View","type","button",1,"action-btn","view-btn"],["mat-icon-button","","title","Download","type","button",1,"action-btn","download-btn",3,"click"],["mat-icon-button","","title","Delete","type","button",1,"action-btn","delete-btn",3,"click"],["mat-icon-button","","title","View","type","button",1,"action-btn","view-btn",3,"click"],[3,"closeViewer","file","projectName","threadId"]],template:function(t,n){t&1&&(C(0,Qg,15,3,"div",0),C(1,Kg,1,3,"app-content-viewer",1)),t&2&&(S(n.viewerState==="list"?0:-1),p(),S(n.viewerState==="content"&&n.currentFile?1:-1))},dependencies:[it,ke,se,Ge,ze,zo],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;height:100%}.file-drawer-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;height:100%;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);color:var(--color-text)}.drawer-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--color-border);flex-shrink:0}.header-left[_ngcontent-%COMP%]{display:flex;align-items:baseline;gap:.5rem}.header-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.25rem}.drawer-title[_ngcontent-%COMP%]{margin:0;font-size:1.25rem;font-weight:600;color:var(--color-text)}.file-count[_ngcontent-%COMP%]{font-size:.9rem;color:var(--color-text-secondary)}.download-all-btn[_ngcontent-%COMP%]{color:var(--color-primary)}.download-all-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.close-btn[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.close-btn[_ngcontent-%COMP%]:hover{color:var(--color-text);background:var(--color-bg-hover)}.file-list[_ngcontent-%COMP%]{flex:1;overflow-y:auto;padding:.5rem}.file-loading[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:3rem 1rem;gap:1rem;color:var(--color-text-secondary)}.loading-spinner[_ngcontent-%COMP%]{display:inline-block;width:32px;height:32px;border:3px solid var(--color-border);border-top-color:var(--color-primary);border-radius:50%;animation:_ngcontent-%COMP%_spin .8s linear infinite}@keyframes _ngcontent-%COMP%_spin{to{transform:rotate(360deg)}}.loading-text[_ngcontent-%COMP%]{font-size:.9rem}.file-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:3rem 1rem;text-align:center;color:var(--color-text-secondary)}.empty-icon[_ngcontent-%COMP%]{font-size:64px;width:64px;height:64px;margin-bottom:1rem;opacity:.5}.empty-text[_ngcontent-%COMP%]{margin:0 0 .5rem;font-size:1rem;font-weight:500}.empty-hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;opacity:.7}.file-item[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:.75rem;border-radius:8px;transition:background .2s;gap:1rem}.file-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.file-item[_ngcontent-%COMP%]:hover .file-actions[_ngcontent-%COMP%]{opacity:1}.file-info[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;flex:1;min-width:0}.file-icon[_ngcontent-%COMP%]{flex-shrink:0;color:var(--color-primary);font-size:28px;width:28px;height:28px}.file-details[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;min-width:0}.file-name[_ngcontent-%COMP%]{font-weight:500;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.file-meta[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary)}.file-actions[_ngcontent-%COMP%]{display:flex;gap:.25rem;flex-shrink:0;opacity:0;transition:opacity .2s}.action-btn[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.action-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.action-btn.view-btn[_ngcontent-%COMP%]:hover, .action-btn.download-btn[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.action-btn.delete-btn[_ngcontent-%COMP%]:hover{color:var(--color-error)}@media(max-width:768px){.file-actions[_ngcontent-%COMP%]{opacity:1}.file-item[_ngcontent-%COMP%]{padding:1rem .75rem}.drawer-header[_ngcontent-%COMP%]{padding:.75rem;padding-top:calc(.75rem + env(safe-area-inset-top,0px))}}"]})};var Go=class i{http=f(rt);listUsers(){return this.http.get("/api/users")}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var Yo=class i{excludedUserIds=[];placeholder="Search username";disabled=!1;userSelected=new Z;userApi=f(Go);search(e){let t=e.toLowerCase();return this.userApi.listUsers().pipe(Ae(n=>n.filter(r=>!this.excludedUserIds.includes(r.username)).filter(r=>r.username.toLowerCase().includes(t)).map(r=>({id:r.username,name:r.username}))))}onItemSelected(e){this.userSelected.emit(e.id)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-user-autocomplete"]],inputs:{excludedUserIds:"excludedUserIds",placeholder:"placeholder",disabled:"disabled"},outputs:{userSelected:"userSelected"},decls:1,vars:3,consts:[[3,"itemSelected","dataSource","placeholder","disabled"]],template:function(t,n){t&1&&(l(0,"ds-autocomplete-input",0),v("itemSelected",function(o){return n.onItemSelected(o)}),c()),t&2&&T("dataSource",n)("placeholder",n.placeholder)("disabled",n.disabled)},dependencies:[tc],styles:["[_nghost-%COMP%]{display:block}"]})};var Xg=(i,e)=>e.userId;function Jg(i,e){if(i&1&&(l(0,"div",7),u(1),c()),i&2){let t=h();p(),L(t.errorMessage())}}function Zg(i,e){if(i&1){let t=O();l(0,"button",13),v("click",function(){x(t);let r=h().$implicit,o=h();return w(o.removeUser(r.userId))}),l(1,"mat-icon"),u(2,"close"),c()()}}function ef(i,e){if(i&1&&(l(0,"div",9)(1,"mat-icon",10),u(2,"person"),c(),l(3,"span",11),u(4),c(),C(5,Zg,3,0,"button",12),c()),i&2){let t=e.$implicit,n=h();p(4),L(t.userId),p(),S(n.users.length>1?5:-1)}}var pr=class i{threadId;users=[];currentUsername;userAdded=new Z;userRemoved=new Z;closed=new Z;isAdding=qe(!1);errorMessage=qe("");get excludedUserIds(){return[this.currentUsername,...this.users.map(e=>e.userId)]}setAdding(e){this.isAdding.set(e)}setError(e){this.errorMessage.set(e),this.isAdding.set(!1)}onUserSelected(e){this.errorMessage.set(""),this.userAdded.emit(e)}removeUser(e){this.userRemoved.emit(e)}close(){this.closed.emit()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-thread-share"]],inputs:{threadId:"threadId",users:"users",currentUsername:"currentUsername"},outputs:{userAdded:"userAdded",userRemoved:"userRemoved",closed:"closed"},decls:19,vars:3,consts:[[1,"thread-share"],[1,"share-header"],[1,"header-left"],["mat-icon-button","","title","Close","type","button",1,"close-btn",3,"click"],[1,"share-subheader"],[1,"add-user-section"],[3,"userSelected","excludedUserIds","disabled"],[1,"error-message"],[1,"users-list"],[1,"user-item"],[1,"user-icon"],[1,"user-name"],["mat-icon-button","","title","Remove user",1,"remove-button"],["mat-icon-button","","title","Remove user",1,"remove-button",3,"click"]],template:function(t,n){t&1&&(l(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-icon"),u(4,"group"),c(),l(5,"span"),u(6,"Share"),c()(),l(7,"button",3),v("click",function(){return n.close()}),l(8,"mat-icon"),u(9,"chevron_right"),c()()(),l(10,"div",4)(11,"span"),u(12,"Participants"),c()(),l(13,"div",5)(14,"app-user-autocomplete",6),v("userSelected",function(o){return n.onUserSelected(o)}),c()(),C(15,Jg,2,1,"div",7),l(16,"div",8),we(17,ef,6,2,"div",9,Xg),c()()),t&2&&(p(14),T("excludedUserIds",n.excludedUserIds)("disabled",n.isAdding()),p(),S(n.errorMessage()?15:-1),p(2),Te(n.users))},dependencies:[ke,se,Ge,ze,Qr,Yo],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;height:100%}.thread-share[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);color:var(--color-text)}.share-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:1rem;padding-top:calc(1rem + env(safe-area-inset-top,0px));border-bottom:1px solid var(--color-border);flex-shrink:0}.share-header[_ngcontent-%COMP%] .header-left[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-weight:600;font-size:1.1rem;color:var(--color-text)}.share-header[_ngcontent-%COMP%] .header-left[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary)}.share-header[_ngcontent-%COMP%] .close-btn[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.share-header[_ngcontent-%COMP%] .close-btn[_ngcontent-%COMP%]:hover{color:var(--color-text);background:var(--color-bg-hover)}.share-subheader[_ngcontent-%COMP%]{padding:.75rem 1rem .25rem;font-size:.75rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--color-text-secondary)}.add-user-section[_ngcontent-%COMP%]{display:flex;align-items:center;padding:0 1rem .75rem;width:50%}.error-message[_ngcontent-%COMP%]{color:var(--color-error);font-size:.75rem;margin-top:-.5rem;padding:0 1rem}.users-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;padding:.25rem}.user-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-radius:6px;transition:background .15s ease}.user-item[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.user-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;color:var(--color-text-secondary);flex-shrink:0}.user-name[_ngcontent-%COMP%]{flex:1;font-size:.875rem;color:var(--color-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.remove-button[_ngcontent-%COMP%]{flex-shrink:0;width:28px!important;height:28px!important;padding:0!important}.remove-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;color:var(--color-text-secondary)}.remove-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:var(--color-error, #ef4444)}"]})};var Ko=["*"],nf=["content"],rf=[[["mat-drawer"]],[["mat-drawer-content"]],"*"],of=["mat-drawer","mat-drawer-content","*"];function af(i,e){if(i&1){let t=O();l(0,"div",1),v("click",function(){x(t);let r=h();return w(r._onBackdropClicked())}),c()}if(i&2){let t=h();Y("mat-drawer-shown",t._isShowingBackdrop())}}function sf(i,e){i&1&&(l(0,"mat-drawer-content"),ht(1,2),c())}var lf=[[["mat-sidenav"]],[["mat-sidenav-content"]],"*"],cf=["mat-sidenav","mat-sidenav-content","*"];function df(i,e){if(i&1){let t=O();l(0,"div",1),v("click",function(){x(t);let r=h();return w(r._onBackdropClicked())}),c()}if(i&2){let t=h();Y("mat-drawer-shown",t._isShowingBackdrop())}}function pf(i,e){i&1&&(l(0,"mat-sidenav-content"),ht(1,2),c())}var mf=`.mat-drawer-container{position:relative;z-index:1;color:var(--mat-sidenav-content-text-color, var(--mat-sys-on-background));background-color:var(--mat-sidenav-content-background-color, var(--mat-sys-background));box-sizing:border-box;display:block;overflow:hidden}.mat-drawer-container[fullscreen]{top:0;left:0;right:0;bottom:0;position:absolute}.mat-drawer-container[fullscreen].mat-drawer-container-has-open{overflow:hidden}.mat-drawer-container.mat-drawer-container-explicit-backdrop .mat-drawer-side{z-index:3}.mat-drawer-container.ng-animate-disabled .mat-drawer-backdrop,.mat-drawer-container.ng-animate-disabled .mat-drawer-content,.ng-animate-disabled .mat-drawer-container .mat-drawer-backdrop,.ng-animate-disabled .mat-drawer-container .mat-drawer-content{transition:none}.mat-drawer-backdrop{top:0;left:0;right:0;bottom:0;position:absolute;display:block;z-index:3;visibility:hidden}.mat-drawer-backdrop.mat-drawer-shown{visibility:visible;background-color:var(--mat-sidenav-scrim-color, color-mix(in srgb, var(--mat-sys-neutral-variant20) 40%, transparent))}.mat-drawer-transition .mat-drawer-backdrop{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:background-color,visibility}@media(forced-colors: active){.mat-drawer-backdrop{opacity:.5}}.mat-drawer-content{position:relative;z-index:1;display:block;height:100%;overflow:auto}.mat-drawer-content.mat-drawer-content-hidden{opacity:0}.mat-drawer-transition .mat-drawer-content{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:transform,margin-left,margin-right}.mat-drawer{position:relative;z-index:4;color:var(--mat-sidenav-container-text-color, var(--mat-sys-on-surface-variant));box-shadow:var(--mat-sidenav-container-elevation-shadow, none);background-color:var(--mat-sidenav-container-background-color, var(--mat-sys-surface));border-top-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));width:var(--mat-sidenav-container-width, 360px);display:block;position:absolute;top:0;bottom:0;z-index:3;outline:0;box-sizing:border-box;overflow-y:auto;transform:translate3d(-100%, 0, 0)}@media(forced-colors: active){.mat-drawer,[dir=rtl] .mat-drawer.mat-drawer-end{border-right:solid 1px currentColor}}@media(forced-colors: active){[dir=rtl] .mat-drawer,.mat-drawer.mat-drawer-end{border-left:solid 1px currentColor;border-right:none}}.mat-drawer.mat-drawer-side{z-index:2}.mat-drawer.mat-drawer-end{right:0;transform:translate3d(100%, 0, 0);border-top-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-top-right-radius:0;border-bottom-right-radius:0}[dir=rtl] .mat-drawer{border-top-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-top-right-radius:0;border-bottom-right-radius:0;transform:translate3d(100%, 0, 0)}[dir=rtl] .mat-drawer.mat-drawer-end{border-top-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-top-left-radius:0;border-bottom-left-radius:0;left:0;right:auto;transform:translate3d(-100%, 0, 0)}.mat-drawer-transition .mat-drawer{transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-drawer:not(.mat-drawer-opened):not(.mat-drawer-animating){visibility:hidden;box-shadow:none}.mat-drawer:not(.mat-drawer-opened):not(.mat-drawer-animating) .mat-drawer-inner-container{display:none}.mat-drawer.mat-drawer-opened.mat-drawer-opened{transform:none}.mat-drawer-side{box-shadow:none;border-right-color:var(--mat-sidenav-container-divider-color, transparent);border-right-width:1px;border-right-style:solid}.mat-drawer-side.mat-drawer-end{border-left-color:var(--mat-sidenav-container-divider-color, transparent);border-left-width:1px;border-left-style:solid;border-right:none}[dir=rtl] .mat-drawer-side{border-left-color:var(--mat-sidenav-container-divider-color, transparent);border-left-width:1px;border-left-style:solid;border-right:none}[dir=rtl] .mat-drawer-side.mat-drawer-end{border-right-color:var(--mat-sidenav-container-divider-color, transparent);border-right-width:1px;border-right-style:solid;border-left:none}.mat-drawer-inner-container{width:100%;height:100%;overflow:auto}.mat-sidenav-fixed{position:fixed}
357
- `;var uf=new Bi("MAT_DRAWER_DEFAULT_AUTOSIZE",{providedIn:"root",factory:()=>!1}),Ls=new Bi("MAT_DRAWER_CONTAINER"),Ni=(()=>{class i extends li{_platform=f(Vr);_changeDetectorRef=f(Dr);_container=f(ur);constructor(){let t=f(ft),n=f($l),r=f(Lt);super(t,n,r)}ngAfterContentInit(){this._container._contentMarginChanges.subscribe(()=>{this._changeDetectorRef.markForCheck()})}_shouldBeHidden(){if(this._platform.isBrowser)return!1;let{start:t,end:n}=this._container;return t!=null&&t.mode!=="over"&&t.opened||n!=null&&n.mode!=="over"&&n.opened}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=I({type:i,selectors:[["mat-drawer-content"]],hostAttrs:[1,"mat-drawer-content"],hostVars:6,hostBindings:function(n,r){n&2&&(Ke("margin-left",r._container._contentMargins.left,"px")("margin-right",r._container._contentMargins.right,"px"),Y("mat-drawer-content-hidden",r._shouldBeHidden()))},features:[fn([{provide:li,useExisting:i}]),Ui],ngContentSelectors:Ko,decls:1,vars:0,template:function(n,r){n&1&&(rn(),ht(0))},encapsulation:2,changeDetection:0})}return i})(),mr=(()=>{class i{_elementRef=f(ft);_focusTrapFactory=f(Rl);_focusMonitor=f(Ol);_platform=f(Vr);_ngZone=f(Lt);_renderer=f(Pr);_interactivityChecker=f(zr);_doc=f(ii);_container=f(Ls,{optional:!0});_focusTrap=null;_elementFocusedBeforeDrawerWasOpened=null;_eventCleanups;_isAttached=!1;_anchor=null;get position(){return this._position}set position(t){t=t==="end"?"end":"start",t!==this._position&&(this._isAttached&&this._updatePositionInParent(t),this._position=t,this.onPositionChanged.emit())}_position="start";get mode(){return this._mode}set mode(t){this._mode=t,this._updateFocusTrapState(),this._modeChanged.next()}_mode="over";get disableClose(){return this._disableClose}set disableClose(t){this._disableClose=Dn(t)}_disableClose=!1;get autoFocus(){let t=this._autoFocus;return t??(this.mode==="side"?"dialog":"first-tabbable")}set autoFocus(t){(t==="true"||t==="false"||t==null)&&(t=Dn(t)),this._autoFocus=t}_autoFocus;get opened(){return this._opened()}set opened(t){this.toggle(Dn(t))}_opened=qe(!1);_openedVia=null;_animationStarted=new J;_animationEnd=new J;openedChange=new Z(!0);_openedStream=this.openedChange.pipe(ve(t=>t),Ae(()=>{}));openedStart=this._animationStarted.pipe(ve(()=>this.opened),fa(void 0));_closedStream=this.openedChange.pipe(ve(t=>!t),Ae(()=>{}));closedStart=this._animationStarted.pipe(ve(()=>!this.opened),fa(void 0));_destroyed=new J;onPositionChanged=new Z;_content;_modeChanged=new J;_injector=f(Ca);_changeDetectorRef=f(Dr);constructor(){this.openedChange.pipe(D(this._destroyed)).subscribe(t=>{t?(this._elementFocusedBeforeDrawerWasOpened=this._doc.activeElement,this._takeFocus()):this._isFocusWithinDrawer()&&this._restoreFocus(this._openedVia||"program")}),this._eventCleanups=this._ngZone.runOutsideAngular(()=>{let t=this._renderer,n=this._elementRef.nativeElement;return[t.listen(n,"keydown",r=>{r.keyCode===27&&!this.disableClose&&!Ll(r)&&this._ngZone.run(()=>{this.close(),r.stopPropagation(),r.preventDefault()})}),t.listen(n,"transitionrun",this._handleTransitionEvent),t.listen(n,"transitionend",this._handleTransitionEvent),t.listen(n,"transitioncancel",this._handleTransitionEvent)]}),this._animationEnd.subscribe(()=>{this.openedChange.emit(this.opened)})}_forceFocus(t,n){this._interactivityChecker.isFocusable(t)||(t.tabIndex=-1,this._ngZone.runOutsideAngular(()=>{let r=()=>{o(),a(),t.removeAttribute("tabindex")},o=this._renderer.listen(t,"blur",r),a=this._renderer.listen(t,"mousedown",r)})),t.focus(n)}_focusByCssSelector(t,n){let r=this._elementRef.nativeElement.querySelector(t);r&&this._forceFocus(r,n)}_takeFocus(){if(!this._focusTrap)return;let t=this._elementRef.nativeElement;switch(this.autoFocus){case!1:case"dialog":return;case!0:case"first-tabbable":xa(()=>{!this._focusTrap.focusInitialElement()&&typeof t.focus=="function"&&t.focus()},{injector:this._injector});break;case"first-heading":this._focusByCssSelector('h1, h2, h3, h4, h5, h6, [role="heading"]');break;default:this._focusByCssSelector(this.autoFocus);break}}_restoreFocus(t){this.autoFocus!=="dialog"&&(this._elementFocusedBeforeDrawerWasOpened?this._focusMonitor.focusVia(this._elementFocusedBeforeDrawerWasOpened,t):this._elementRef.nativeElement.blur(),this._elementFocusedBeforeDrawerWasOpened=null)}_isFocusWithinDrawer(){let t=this._doc.activeElement;return!!t&&this._elementRef.nativeElement.contains(t)}ngAfterViewInit(){this._isAttached=!0,this._position==="end"&&this._updatePositionInParent("end"),this._platform.isBrowser&&(this._focusTrap=this._focusTrapFactory.create(this._elementRef.nativeElement),this._updateFocusTrapState())}ngOnDestroy(){this._eventCleanups.forEach(t=>t()),this._focusTrap?.destroy(),this._anchor?.remove(),this._anchor=null,this._animationStarted.complete(),this._animationEnd.complete(),this._modeChanged.complete(),this._destroyed.next(),this._destroyed.complete()}open(t){return this.toggle(!0,t)}close(){return this.toggle(!1)}_closeViaBackdropClick(){return this._setOpen(!1,!0,"mouse")}toggle(t=!this.opened,n){t&&n&&(this._openedVia=n);let r=this._setOpen(t,!t&&this._isFocusWithinDrawer(),this._openedVia||"program");return t||(this._openedVia=null),r}_setOpen(t,n,r){return t===this.opened?Promise.resolve(t?"open":"close"):(this._opened.set(t),this._container?._transitionsEnabled?this._setIsAnimating(!0):setTimeout(()=>{this._animationStarted.next(),this._animationEnd.next()}),this._elementRef.nativeElement.classList.toggle("mat-drawer-opened",t),!t&&n&&this._restoreFocus(r),this._changeDetectorRef.markForCheck(),this._updateFocusTrapState(),new Promise(o=>{this.openedChange.pipe(ti(1)).subscribe(a=>o(a?"open":"close"))}))}_setIsAnimating(t){this._elementRef.nativeElement.classList.toggle("mat-drawer-animating",t)}_getWidth(){return this._elementRef.nativeElement.offsetWidth||0}_updateFocusTrapState(){this._focusTrap&&(this._focusTrap.enabled=this.opened&&!!this._container?._isShowingBackdrop())}_updatePositionInParent(t){if(!this._platform.isBrowser)return;let n=this._elementRef.nativeElement,r=n.parentNode;t==="end"?(this._anchor||(this._anchor=this._doc.createComment("mat-drawer-anchor"),r.insertBefore(this._anchor,n)),r.appendChild(n)):this._anchor&&this._anchor.parentNode.insertBefore(n,this._anchor)}_handleTransitionEvent=t=>{let n=this._elementRef.nativeElement;t.target===n&&this._ngZone.run(()=>{t.type==="transitionrun"?this._animationStarted.next(t):(t.type==="transitionend"&&this._setIsAnimating(!1),this._animationEnd.next(t))})};static \u0275fac=function(n){return new(n||i)};static \u0275cmp=I({type:i,selectors:[["mat-drawer"]],viewQuery:function(n,r){if(n&1&&Be(nf,5),n&2){let o;ge(o=fe())&&(r._content=o.first)}},hostAttrs:[1,"mat-drawer"],hostVars:12,hostBindings:function(n,r){n&2&&(Me("align",null)("tabIndex",r.mode!=="side"?"-1":null),Ke("visibility",!r._container&&!r.opened?"hidden":null),Y("mat-drawer-end",r.position==="end")("mat-drawer-over",r.mode==="over")("mat-drawer-push",r.mode==="push")("mat-drawer-side",r.mode==="side"))},inputs:{position:"position",mode:"mode",disableClose:"disableClose",autoFocus:"autoFocus",opened:"opened"},outputs:{openedChange:"openedChange",_openedStream:"opened",openedStart:"openedStart",_closedStream:"closed",closedStart:"closedStart",onPositionChanged:"positionChanged"},exportAs:["matDrawer"],ngContentSelectors:Ko,decls:3,vars:0,consts:[["content",""],["cdkScrollable","",1,"mat-drawer-inner-container"]],template:function(n,r){n&1&&(rn(),l(0,"div",1,0),ht(2),c())},dependencies:[li],encapsulation:2,changeDetection:0})}return i})(),ur=(()=>{class i{_dir=f(zl,{optional:!0});_element=f(ft);_ngZone=f(Lt);_changeDetectorRef=f(Dr);_animationDisabled=$r();_transitionsEnabled=!1;_allDrawers;_drawers=new ul;_content;_userContent;get start(){return this._start}get end(){return this._end}get autosize(){return this._autosize}set autosize(t){this._autosize=Dn(t)}_autosize=f(uf);get hasBackdrop(){return this._drawerHasBackdrop(this._start)||this._drawerHasBackdrop(this._end)}set hasBackdrop(t){this._backdropOverride=t==null?null:Dn(t)}_backdropOverride=null;backdropClick=new Z;_start=null;_end=null;_left=null;_right=null;_destroyed=new J;_doCheckSubject=new J;_contentMargins={left:null,right:null};_contentMarginChanges=new J;get scrollable(){return this._userContent||this._content}_injector=f(Ca);constructor(){let t=f(Vr),n=f(Bl);this._dir?.change.pipe(D(this._destroyed)).subscribe(()=>{this._validateDrawers(),this.updateContentMargins()}),n.change().pipe(D(this._destroyed)).subscribe(()=>this.updateContentMargins()),!this._animationDisabled&&t.isBrowser&&this._ngZone.runOutsideAngular(()=>{setTimeout(()=>{this._element.nativeElement.classList.add("mat-drawer-transition"),this._transitionsEnabled=!0},200)})}ngAfterContentInit(){this._allDrawers.changes.pipe(ni(this._allDrawers),D(this._destroyed)).subscribe(t=>{this._drawers.reset(t.filter(n=>!n._container||n._container===this)),this._drawers.notifyOnChanges()}),this._drawers.changes.pipe(ni(null)).subscribe(()=>{this._validateDrawers(),this._drawers.forEach(t=>{this._watchDrawerToggle(t),this._watchDrawerPosition(t),this._watchDrawerMode(t)}),(!this._drawers.length||this._isDrawerOpen(this._start)||this._isDrawerOpen(this._end))&&this.updateContentMargins(),this._changeDetectorRef.markForCheck()}),this._ngZone.runOutsideAngular(()=>{this._doCheckSubject.pipe(sl(10),D(this._destroyed)).subscribe(()=>this.updateContentMargins())})}ngOnDestroy(){this._contentMarginChanges.complete(),this._doCheckSubject.complete(),this._drawers.destroy(),this._destroyed.next(),this._destroyed.complete()}open(){this._drawers.forEach(t=>t.open())}close(){this._drawers.forEach(t=>t.close())}updateContentMargins(){let t=0,n=0;if(this._left&&this._left.opened){if(this._left.mode=="side")t+=this._left._getWidth();else if(this._left.mode=="push"){let r=this._left._getWidth();t+=r,n-=r}}if(this._right&&this._right.opened){if(this._right.mode=="side")n+=this._right._getWidth();else if(this._right.mode=="push"){let r=this._right._getWidth();n+=r,t-=r}}t=t||null,n=n||null,(t!==this._contentMargins.left||n!==this._contentMargins.right)&&(this._contentMargins={left:t,right:n},this._ngZone.run(()=>this._contentMarginChanges.next(this._contentMargins)))}ngDoCheck(){this._autosize&&this._isPushed()&&this._ngZone.runOutsideAngular(()=>this._doCheckSubject.next())}_watchDrawerToggle(t){t._animationStarted.pipe(D(this._drawers.changes)).subscribe(()=>{this.updateContentMargins(),this._changeDetectorRef.markForCheck()}),t.mode!=="side"&&t.openedChange.pipe(D(this._drawers.changes)).subscribe(()=>this._setContainerClass(t.opened))}_watchDrawerPosition(t){t.onPositionChanged.pipe(D(this._drawers.changes)).subscribe(()=>{xa({read:()=>this._validateDrawers()},{injector:this._injector})})}_watchDrawerMode(t){t._modeChanged.pipe(D(al(this._drawers.changes,this._destroyed))).subscribe(()=>{this.updateContentMargins(),this._changeDetectorRef.markForCheck()})}_setContainerClass(t){let n=this._element.nativeElement.classList,r="mat-drawer-container-has-open";t?n.add(r):n.remove(r)}_validateDrawers(){this._start=this._end=null,this._drawers.forEach(t=>{t.position=="end"?(this._end!=null,this._end=t):(this._start!=null,this._start=t)}),this._right=this._left=null,this._dir&&this._dir.value==="rtl"?(this._left=this._end,this._right=this._start):(this._left=this._start,this._right=this._end)}_isPushed(){return this._isDrawerOpen(this._start)&&this._start.mode!="over"||this._isDrawerOpen(this._end)&&this._end.mode!="over"}_onBackdropClicked(){this.backdropClick.emit(),this._closeModalDrawersViaBackdrop()}_closeModalDrawersViaBackdrop(){[this._start,this._end].filter(t=>t&&!t.disableClose&&this._drawerHasBackdrop(t)).forEach(t=>t._closeViaBackdropClick())}_isShowingBackdrop(){return this._isDrawerOpen(this._start)&&this._drawerHasBackdrop(this._start)||this._isDrawerOpen(this._end)&&this._drawerHasBackdrop(this._end)}_isDrawerOpen(t){return t!=null&&t.opened}_drawerHasBackdrop(t){return this._backdropOverride==null?!!t&&t.mode!=="side":this._backdropOverride}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=I({type:i,selectors:[["mat-drawer-container"]],contentQueries:function(n,r,o){if(n&1&&Ea(o,Ni,5)(o,mr,5),n&2){let a;ge(a=fe())&&(r._content=a.first),ge(a=fe())&&(r._allDrawers=a)}},viewQuery:function(n,r){if(n&1&&Be(Ni,5),n&2){let o;ge(o=fe())&&(r._userContent=o.first)}},hostAttrs:[1,"mat-drawer-container"],hostVars:2,hostBindings:function(n,r){n&2&&Y("mat-drawer-container-explicit-backdrop",r._backdropOverride)},inputs:{autosize:"autosize",hasBackdrop:"hasBackdrop"},outputs:{backdropClick:"backdropClick"},exportAs:["matDrawerContainer"],features:[fn([{provide:Ls,useExisting:i}])],ngContentSelectors:of,decls:4,vars:2,consts:[[1,"mat-drawer-backdrop",3,"mat-drawer-shown"],[1,"mat-drawer-backdrop",3,"click"]],template:function(n,r){n&1&&(rn(rf),C(0,af,1,2,"div",0),ht(1),ht(2,1),C(3,sf,2,0,"mat-drawer-content")),n&2&&(S(r.hasBackdrop?0:-1),p(3),S(r._content?-1:3))},dependencies:[Ni],styles:[`.mat-drawer-container{position:relative;z-index:1;color:var(--mat-sidenav-content-text-color, var(--mat-sys-on-background));background-color:var(--mat-sidenav-content-background-color, var(--mat-sys-background));box-sizing:border-box;display:block;overflow:hidden}.mat-drawer-container[fullscreen]{top:0;left:0;right:0;bottom:0;position:absolute}.mat-drawer-container[fullscreen].mat-drawer-container-has-open{overflow:hidden}.mat-drawer-container.mat-drawer-container-explicit-backdrop .mat-drawer-side{z-index:3}.mat-drawer-container.ng-animate-disabled .mat-drawer-backdrop,.mat-drawer-container.ng-animate-disabled .mat-drawer-content,.ng-animate-disabled .mat-drawer-container .mat-drawer-backdrop,.ng-animate-disabled .mat-drawer-container .mat-drawer-content{transition:none}.mat-drawer-backdrop{top:0;left:0;right:0;bottom:0;position:absolute;display:block;z-index:3;visibility:hidden}.mat-drawer-backdrop.mat-drawer-shown{visibility:visible;background-color:var(--mat-sidenav-scrim-color, color-mix(in srgb, var(--mat-sys-neutral-variant20) 40%, transparent))}.mat-drawer-transition .mat-drawer-backdrop{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:background-color,visibility}@media(forced-colors: active){.mat-drawer-backdrop{opacity:.5}}.mat-drawer-content{position:relative;z-index:1;display:block;height:100%;overflow:auto}.mat-drawer-content.mat-drawer-content-hidden{opacity:0}.mat-drawer-transition .mat-drawer-content{transition-duration:400ms;transition-timing-function:cubic-bezier(0.25, 0.8, 0.25, 1);transition-property:transform,margin-left,margin-right}.mat-drawer{position:relative;z-index:4;color:var(--mat-sidenav-container-text-color, var(--mat-sys-on-surface-variant));box-shadow:var(--mat-sidenav-container-elevation-shadow, none);background-color:var(--mat-sidenav-container-background-color, var(--mat-sys-surface));border-top-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));width:var(--mat-sidenav-container-width, 360px);display:block;position:absolute;top:0;bottom:0;z-index:3;outline:0;box-sizing:border-box;overflow-y:auto;transform:translate3d(-100%, 0, 0)}@media(forced-colors: active){.mat-drawer,[dir=rtl] .mat-drawer.mat-drawer-end{border-right:solid 1px currentColor}}@media(forced-colors: active){[dir=rtl] .mat-drawer,.mat-drawer.mat-drawer-end{border-left:solid 1px currentColor;border-right:none}}.mat-drawer.mat-drawer-side{z-index:2}.mat-drawer.mat-drawer-end{right:0;transform:translate3d(100%, 0, 0);border-top-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-top-right-radius:0;border-bottom-right-radius:0}[dir=rtl] .mat-drawer{border-top-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-left-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-top-right-radius:0;border-bottom-right-radius:0;transform:translate3d(100%, 0, 0)}[dir=rtl] .mat-drawer.mat-drawer-end{border-top-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-bottom-right-radius:var(--mat-sidenav-container-shape, var(--mat-sys-corner-large));border-top-left-radius:0;border-bottom-left-radius:0;left:0;right:auto;transform:translate3d(-100%, 0, 0)}.mat-drawer-transition .mat-drawer{transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-drawer:not(.mat-drawer-opened):not(.mat-drawer-animating){visibility:hidden;box-shadow:none}.mat-drawer:not(.mat-drawer-opened):not(.mat-drawer-animating) .mat-drawer-inner-container{display:none}.mat-drawer.mat-drawer-opened.mat-drawer-opened{transform:none}.mat-drawer-side{box-shadow:none;border-right-color:var(--mat-sidenav-container-divider-color, transparent);border-right-width:1px;border-right-style:solid}.mat-drawer-side.mat-drawer-end{border-left-color:var(--mat-sidenav-container-divider-color, transparent);border-left-width:1px;border-left-style:solid;border-right:none}[dir=rtl] .mat-drawer-side{border-left-color:var(--mat-sidenav-container-divider-color, transparent);border-left-width:1px;border-left-style:solid;border-right:none}[dir=rtl] .mat-drawer-side.mat-drawer-end{border-right-color:var(--mat-sidenav-container-divider-color, transparent);border-right-width:1px;border-right-style:solid;border-left:none}.mat-drawer-inner-container{width:100%;height:100%;overflow:auto}.mat-sidenav-fixed{position:fixed}
358
- `],encapsulation:2,changeDetection:0})}return i})(),Qo=(()=>{class i extends Ni{static \u0275fac=(()=>{let t;return function(r){return(t||(t=kr(i)))(r||i)}})();static \u0275cmp=I({type:i,selectors:[["mat-sidenav-content"]],hostAttrs:[1,"mat-drawer-content","mat-sidenav-content"],features:[fn([{provide:li,useExisting:i}]),Ui],ngContentSelectors:Ko,decls:1,vars:0,template:function(n,r){n&1&&(rn(),ht(0))},encapsulation:2,changeDetection:0})}return i})(),js=(()=>{class i extends mr{get fixedInViewport(){return this._fixedInViewport}set fixedInViewport(t){this._fixedInViewport=Dn(t)}_fixedInViewport=!1;get fixedTopGap(){return this._fixedTopGap}set fixedTopGap(t){this._fixedTopGap=Oa(t)}_fixedTopGap=0;get fixedBottomGap(){return this._fixedBottomGap}set fixedBottomGap(t){this._fixedBottomGap=Oa(t)}_fixedBottomGap=0;static \u0275fac=(()=>{let t;return function(r){return(t||(t=kr(i)))(r||i)}})();static \u0275cmp=I({type:i,selectors:[["mat-sidenav"]],hostAttrs:[1,"mat-drawer","mat-sidenav"],hostVars:16,hostBindings:function(n,r){n&2&&(Me("tabIndex",r.mode!=="side"?"-1":null)("align",null),Ke("top",r.fixedInViewport?r.fixedTopGap:null,"px")("bottom",r.fixedInViewport?r.fixedBottomGap:null,"px"),Y("mat-drawer-end",r.position==="end")("mat-drawer-over",r.mode==="over")("mat-drawer-push",r.mode==="push")("mat-drawer-side",r.mode==="side")("mat-sidenav-fixed",r.fixedInViewport))},inputs:{fixedInViewport:"fixedInViewport",fixedTopGap:"fixedTopGap",fixedBottomGap:"fixedBottomGap"},exportAs:["matSidenav"],features:[fn([{provide:mr,useExisting:i}]),Ui],ngContentSelectors:Ko,decls:3,vars:0,consts:[["content",""],["cdkScrollable","",1,"mat-drawer-inner-container"]],template:function(n,r){n&1&&(rn(),l(0,"div",1,0),ht(2),c())},dependencies:[li],encapsulation:2,changeDetection:0})}return i})(),Cp=(()=>{class i extends ur{_allDrawers=void 0;_content=void 0;static \u0275fac=(()=>{let t;return function(r){return(t||(t=kr(i)))(r||i)}})();static \u0275cmp=I({type:i,selectors:[["mat-sidenav-container"]],contentQueries:function(n,r,o){if(n&1&&Ea(o,Qo,5)(o,js,5),n&2){let a;ge(a=fe())&&(r._content=a.first),ge(a=fe())&&(r._allDrawers=a)}},hostAttrs:[1,"mat-drawer-container","mat-sidenav-container"],hostVars:2,hostBindings:function(n,r){n&2&&Y("mat-drawer-container-explicit-backdrop",r._backdropOverride)},exportAs:["matSidenavContainer"],features:[fn([{provide:Ls,useExisting:i},{provide:ur,useExisting:i}]),Ui],ngContentSelectors:cf,decls:4,vars:2,consts:[[1,"mat-drawer-backdrop",3,"mat-drawer-shown"],[1,"mat-drawer-backdrop",3,"click"]],template:function(n,r){n&1&&(rn(lf),C(0,df,1,2,"div",0),ht(1),ht(2,1),C(3,pf,2,0,"mat-sidenav-content")),n&2&&(S(r.hasBackdrop?0:-1),p(3),S(r._content?-1:3))},dependencies:[Qo],styles:[mf],encapsulation:2,changeDetection:0})}return i})(),Xo=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275mod=wt({type:i});static \u0275inj=xt({imports:[Aa,$t,Aa]})}return i})();var xp="mat-badge-content",hf=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275cmp=I({type:i,selectors:[["ng-component"]],decls:0,vars:0,template:function(n,r){},styles:[`.mat-badge{position:relative}.mat-badge.mat-badge{overflow:visible}.mat-badge-content{position:absolute;text-align:center;display:inline-block;transition:transform 200ms ease-in-out;transform:scale(0.6);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;box-sizing:border-box;pointer-events:none;background-color:var(--mat-badge-background-color, var(--mat-sys-error));color:var(--mat-badge-text-color, var(--mat-sys-on-error));font-family:var(--mat-badge-text-font, var(--mat-sys-label-small-font));font-weight:var(--mat-badge-text-weight, var(--mat-sys-label-small-weight));border-radius:var(--mat-badge-container-shape, var(--mat-sys-corner-full))}.mat-badge-above .mat-badge-content{bottom:100%}.mat-badge-below .mat-badge-content{top:100%}.mat-badge-before .mat-badge-content{right:100%}[dir=rtl] .mat-badge-before .mat-badge-content{right:auto;left:100%}.mat-badge-after .mat-badge-content{left:100%}[dir=rtl] .mat-badge-after .mat-badge-content{left:auto;right:100%}@media(forced-colors: active){.mat-badge-content{outline:solid 1px;border-radius:0}}.mat-badge-disabled .mat-badge-content{background-color:var(--mat-badge-disabled-state-background-color, color-mix(in srgb, var(--mat-sys-error) 38%, transparent));color:var(--mat-badge-disabled-state-text-color, var(--mat-sys-on-error))}.mat-badge-hidden .mat-badge-content{display:none}.ng-animate-disabled .mat-badge-content,.mat-badge-content._mat-animation-noopable{transition:none}.mat-badge-content.mat-badge-active{transform:none}.mat-badge-small .mat-badge-content{width:var(--mat-badge-legacy-small-size-container-size, unset);height:var(--mat-badge-legacy-small-size-container-size, unset);min-width:var(--mat-badge-small-size-container-size, 6px);min-height:var(--mat-badge-small-size-container-size, 6px);line-height:var(--mat-badge-small-size-line-height, 6px);padding:var(--mat-badge-small-size-container-padding, 0);font-size:var(--mat-badge-small-size-text-size, 0);margin:var(--mat-badge-small-size-container-offset, -6px 0)}.mat-badge-small.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-small-size-container-overlap-offset, -6px)}.mat-badge-medium .mat-badge-content{width:var(--mat-badge-legacy-container-size, unset);height:var(--mat-badge-legacy-container-size, unset);min-width:var(--mat-badge-container-size, 16px);min-height:var(--mat-badge-container-size, 16px);line-height:var(--mat-badge-line-height, 16px);padding:var(--mat-badge-container-padding, 0 4px);font-size:var(--mat-badge-text-size, var(--mat-sys-label-small-size));margin:var(--mat-badge-container-offset, -12px 0)}.mat-badge-medium.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-container-overlap-offset, -12px)}.mat-badge-large .mat-badge-content{width:var(--mat-badge-legacy-large-size-container-size, unset);height:var(--mat-badge-legacy-large-size-container-size, unset);min-width:var(--mat-badge-large-size-container-size, 16px);min-height:var(--mat-badge-large-size-container-size, 16px);line-height:var(--mat-badge-large-size-line-height, 16px);padding:var(--mat-badge-large-size-container-padding, 0 4px);font-size:var(--mat-badge-large-size-text-size, var(--mat-sys-label-small-size));margin:var(--mat-badge-large-size-container-offset, -12px 0)}.mat-badge-large.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-large-size-container-overlap-offset, -12px)}
359
- `],encapsulation:2,changeDetection:0})}return i})(),wp=(()=>{class i{_ngZone=f(Lt);_elementRef=f(ft);_ariaDescriber=f(jl);_renderer=f(Pr);_animationsDisabled=$r();_idGenerator=f(Fl);get color(){return this._color}set color(t){this._setColor(t),this._color=t}_color="primary";overlap=!0;disabled=!1;position="above after";get content(){return this._content}set content(t){this._updateRenderedContent(t)}_content;get description(){return this._description}set description(t){this._updateDescription(t)}_description;size="medium";hidden=!1;_badgeElement;_inlineBadgeDescription;_isInitialized=!1;_interactivityChecker=f(zr);_document=f(ii);constructor(){let t=f(Al);t.load(hf),t.load(Il)}isAbove(){return this.position.indexOf("below")===-1}isAfter(){return this.position.indexOf("before")===-1}getBadgeElement(){return this._badgeElement}ngOnInit(){this._clearExistingBadges(),this.content&&!this._badgeElement&&(this._badgeElement=this._createBadgeElement(),this._updateRenderedContent(this.content)),this._isInitialized=!0}ngAfterViewInit(){}ngOnDestroy(){this._renderer.destroyNode&&(this._renderer.destroyNode(this._badgeElement),this._inlineBadgeDescription?.remove()),this._ariaDescriber.removeDescription(this._elementRef.nativeElement,this.description)}_isHostInteractive(){return this._interactivityChecker.isFocusable(this._elementRef.nativeElement,{ignoreVisibility:!0})}_createBadgeElement(){let t=this._renderer.createElement("span"),n="mat-badge-active";return t.setAttribute("id",this._idGenerator.getId("mat-badge-content-")),t.setAttribute("aria-hidden","true"),t.classList.add(xp),this._animationsDisabled&&t.classList.add("_mat-animation-noopable"),this._elementRef.nativeElement.appendChild(t),typeof requestAnimationFrame=="function"&&!this._animationsDisabled?this._ngZone.runOutsideAngular(()=>{requestAnimationFrame(()=>{t.classList.add(n)})}):t.classList.add(n),t}_updateRenderedContent(t){let n=`${t??""}`.trim();this._isInitialized&&n&&!this._badgeElement&&(this._badgeElement=this._createBadgeElement()),this._badgeElement&&(this._badgeElement.textContent=n),this._content=n}_updateDescription(t){this._ariaDescriber.removeDescription(this._elementRef.nativeElement,this.description),(!t||this._isHostInteractive())&&this._removeInlineDescription(),this._description=t,this._isHostInteractive()?this._ariaDescriber.describe(this._elementRef.nativeElement,t):this._updateInlineDescription()}_updateInlineDescription(){this._inlineBadgeDescription||(this._inlineBadgeDescription=this._document.createElement("span"),this._inlineBadgeDescription.classList.add("cdk-visually-hidden")),this._inlineBadgeDescription.textContent=this.description,this._badgeElement?.appendChild(this._inlineBadgeDescription)}_removeInlineDescription(){this._inlineBadgeDescription?.remove(),this._inlineBadgeDescription=void 0}_setColor(t){let n=this._elementRef.nativeElement.classList;n.remove(`mat-badge-${this._color}`),t&&n.add(`mat-badge-${t}`)}_clearExistingBadges(){let t=this._elementRef.nativeElement.querySelectorAll(`:scope > .${xp}`);for(let n of Array.from(t))n!==this._badgeElement&&n.remove()}static \u0275fac=function(n){return new(n||i)};static \u0275dir=_l({type:i,selectors:[["","matBadge",""]],hostAttrs:[1,"mat-badge"],hostVars:20,hostBindings:function(n,r){n&2&&Y("mat-badge-overlap",r.overlap)("mat-badge-above",r.isAbove())("mat-badge-below",!r.isAbove())("mat-badge-before",!r.isAfter())("mat-badge-after",r.isAfter())("mat-badge-small",r.size==="small")("mat-badge-medium",r.size==="medium")("mat-badge-large",r.size==="large")("mat-badge-hidden",r.hidden||!r.content)("mat-badge-disabled",r.disabled)},inputs:{color:[0,"matBadgeColor","color"],overlap:[2,"matBadgeOverlap","overlap",Rr],disabled:[2,"matBadgeDisabled","disabled",Rr],position:[0,"matBadgePosition","position"],content:[0,"matBadge","content"],description:[0,"matBadgeDescription","description"],size:[0,"matBadgeSize","size"],hidden:[2,"matBadgeHidden","hidden",Rr]}})}return i})(),Tp=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275mod=wt({type:i});static \u0275inj=xt({imports:[Nl,$t]})}return i})();var Fi=class i{ATTENTION_EMOJI="\u{1F534}";isSystemActive=!1;systemActiveTimer=null;SYSTEM_ACTIVE_TIMEOUT=4e3;unreadService=f(Ti);project=f(ye);constructor(){this.initializeTitleUpdates()}initializeTitleUpdates(){Pn([this.project.selectedProject$,this.unreadService.unreadCount$]).subscribe(([e,t])=>{this.updateTitle(e?.name??"...",t)})}updateTitle(e,t){let n;this.isSystemActive?n=`\u23F3${t>0?` (${t}) `:" "}${e}`:t>0?n=`${this.ATTENTION_EMOJI} (${t}) ${e}`:n=e,document.title=n,console.log("[TAB-TITLE] Updated to:",n)}setSystemActive(){console.log("[TAB-TITLE] System active - showing hourglass"),this.isSystemActive=!0,this.systemActiveTimer&&clearTimeout(this.systemActiveTimer),this.systemActiveTimer=setTimeout(()=>{console.log("[TAB-TITLE] System active timeout - hiding hourglass"),this.isSystemActive=!1,this.forceUpdateTitle()},this.SYSTEM_ACTIVE_TIMEOUT),this.forceUpdateTitle()}setSystemInactive(){console.log("[TAB-TITLE] System inactive - hiding hourglass"),this.isSystemActive=!1,this.systemActiveTimer&&(clearTimeout(this.systemActiveTimer),this.systemActiveTimer=null),this.forceUpdateTitle()}forceUpdateTitle(){let e=this.project.getSelectedProjectId()??"...",t=this.unreadService.getCurrentCount();this.updateTitle(e,t)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var Jo=class i{http=f(rt);maxFileSize=5*1024*1024;supportedTypes=["image/png","image/jpeg","image/gif","image/webp"];validateFile(e){if(!this.supportedTypes.includes(e.type))throw new Error(`Unsupported file type: ${e.type}`);if(e.size>this.maxFileSize)throw new Error(`File too large: ${(e.size/1024/1024).toFixed(1)}MB exceeds 5MB limit`)}fileToBase64(e){return B(this,null,function*(){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let o=r.result;if(!o){n(new Error("Failed to read file"));return}let a=o.split(",")[1];if(!a){n(new Error("Invalid file format"));return}t(a)},r.onerror=n,r.readAsDataURL(e)})})}getUploadUrl(e,t){return`/api/projects/${e}/threads/${t}/upload`}uploadImage(e,t,n){console.log("[IMAGE-UPLOAD] uploadImage - file:",e.name,e.type,e.size),console.log("[IMAGE-UPLOAD] uploadImage - project:",t,"thread:",n);try{console.log("[IMAGE-UPLOAD] Validating file..."),this.validateFile(e)}catch(r){return console.log("[IMAGE-UPLOAD] Validation failed:",r),kn({success:!1,error:r instanceof Error?r.message:"Validation failed"})}return new Er(r=>{console.log("[IMAGE-UPLOAD] Converting to base64..."),this.fileToBase64(e).then(o=>{console.log("[IMAGE-UPLOAD] Base64 length:",o.length),console.log("[IMAGE-UPLOAD] Sending upload request..."),this.http.post(this.getUploadUrl(t,n),{content:o,mimeType:e.type,filename:e.name}).pipe(Ae(a=>(console.log("[IMAGE-UPLOAD] Upload success result:",a),{success:!0,processedSize:a.processedSize,dimensions:a.dimensions})),mn(a=>{console.log("[IMAGE-UPLOAD] Upload failed:",a);let s=a.error?.error||a.message||"Upload failed";return kn({success:!1,error:s})})).subscribe({next:a=>{r.next(a),r.complete()},error:a=>r.error(a)})}).catch(o=>{console.log("[IMAGE-UPLOAD] Base64 conversion failed:",o),r.next({success:!1,error:o instanceof Error?o.message:"Failed to read file"}),r.complete()})})}hasImageFiles(e){if(console.log("[IMAGE-UPLOAD] hasImageFiles - dataTransfer:",e),!e)return console.log("[IMAGE-UPLOAD] hasImageFiles - no dataTransfer"),!1;if(console.log("[IMAGE-UPLOAD] hasImageFiles - types:",Array.from(e.types)),!Array.from(e.types).includes("Files"))return console.log("[IMAGE-UPLOAD] hasImageFiles - no Files type"),!1;let t=Array.from(e.files||[]);console.log("[IMAGE-UPLOAD] hasImageFiles - files:",t.map(r=>({name:r.name,type:r.type})));let n=t.some(r=>this.supportedTypes.includes(r.type));return console.log("[IMAGE-UPLOAD] hasImageFiles - result:",n),n}filterImageFiles(e){return Array.from(e).filter(n=>this.supportedTypes.includes(n.type))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var Li=class i{pendingFirstMessage=null;setPendingFirstMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=e}consumePendingFirstMessage(){let e=this.pendingFirstMessage;return e?(console.log("[FIRST-MESSAGE-STATE] Consuming pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=null):console.log("[FIRST-MESSAGE-STATE] No pending first message to consume"),e}hasPendingFirstMessage(){return this.pendingFirstMessage!==null}clear(){this.pendingFirstMessage&&(console.log("[FIRST-MESSAGE-STATE] Clearing pending first message"),this.pendingFirstMessage=null)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var ff=["inputSection"],_f=()=>[];function bf(i,e){if(i&1){let t=O();l(0,"button",20),v("click",function(){x(t);let r=h();return w(r.toggleFileDrawer())}),l(1,"mat-icon"),u(2,"folder_open"),c()()}if(i&2){let t=h();Y("has-files",t.fileCount>0),T("title",vl("Files Exchange",t.fileCount>0?" ("+t.fileCount+" file"+(t.fileCount>1?"s":"")+")":""))("matBadge",t.fileCount>0?t.fileCount:null)}}function vf(i,e){if(i&1){let t=O();l(0,"button",21),v("click",function(){x(t);let r=h();return w(r.toggleSharePanel())}),l(1,"mat-icon"),u(2,"group"),c()()}if(i&2){let t=h();Y("has-shared-users",((t.threadDetails==null||t.threadDetails.users==null?null:t.threadDetails.users.length)??0)>1)}}function yf(i,e){if(i&1&&(l(0,"div",6),u(1),c()),i&2){let t=h();p(),oi(" \u26A0\uFE0F Connection lost. Reconnecting... (",t.connectionStatus.reconnectAttempts,"/",t.connectionStatus.maxAttempts,") ")}}function Cf(i,e){if(i&1&&(l(0,"div",22),u(1),c()),i&2){let t=h();Y("error",t.uploadStatus.isError),p(),Ne(" ",t.uploadStatus.message," ")}}function Sf(i,e){if(i&1){let t=O();l(0,"app-chat-textarea",23),v("messageSubmitted",function(r){x(t);let o=h();return w(o.onMessageSubmitted(r))})("voiceRecordingToggled",function(r){x(t);let o=h();return w(o.onVoiceToggled(r))})("heightChanged",function(r){x(t);let o=h();return w(o.onInputHeightChanged(r))})("stopRequested",function(){x(t);let r=h();return w(r.onStopRequested())})("filesPasted",function(r){x(t);let o=h();return w(o.onFilesPasted(r))}),c()}if(i&2){let t=h();T("isDisabled",!t.isConnected)("isSessionInitializing",!1)("showWelcome",!1)("isThinking",t.isThinking)("isStarting",!1)}}function xf(i,e){if(i&1){let t=O();l(0,"app-choice-select",24),v("choiceSelected",function(r){x(t);let o=h();return w(o.onChoiceSelected(r))}),c()}if(i&2){let t=h();T("options",t.currentChoice.options)("labelHtml",t.currentChoice.label)("isVisible",!!t.currentChoice)("allowFreeText",t.currentChoice.allowFreeText)}}function wf(i,e){i&1&&F(0,"app-oauth-request-panel")}function Tf(i,e){if(i&1){let t=O();l(0,"app-file-exchange-drawer",25),v("closeDrawer",function(){x(t);let r=h();return w(r.closeDrawer())}),c()}if(i&2){let t=h();T("projectName",t.projectName)("threadId",t.threadId)}}function Ef(i,e){if(i&1){let t=O();l(0,"app-thread-share",26),v("userAdded",function(r){x(t);let o=h();return w(o.onUserAdded(r))})("userRemoved",function(r){x(t);let o=h();return w(o.onUserRemoved(r))})("closed",function(){x(t);let r=h();return w(r.closeDrawer())}),c()}if(i&2){let t=h();T("threadId",t.threadId)("users",t.threadDetails.users||Or(3,_f))("currentUsername",t.currentUsername)}}function Mf(i,e){i&1&&(l(0,"div",19)(1,"div",27)(2,"div",28),u(3,"\u{1F4CE}"),c(),l(4,"div",29),u(5,"Drop files here to upload"),c(),l(6,"div",30),u(7,"Images will be added to conversation, other files to exchange space"),c()()())}var Zo=class i{projectName;threadId;chatFocused=new Z;drawerStateChange=new Z;destroy$=new J;connectionDestroy$=new J;inputSection;messages=[];streamingText="";isThinking=!1;currentChoice=null;connectionStatus=null;isConnected=!1;showConnectionStatus=!1;hasEverConnected=!1;inputSectionHeight=80;uploadStatus={message:"",isError:!1};isDragOver=!1;drawerMode="none";get isDrawerOpen(){return this.drawerMode!=="none"}threadDetails=null;threadShareRef;get fileCount(){return this.fileExchangeState.fileCount()}currentUsername="";authEnabled=!1;pendingFirstMessage=null;subscriptions=[];codayService=f(mt);oauthService=f(Sn);pendingOAuthRequest=Ie(this.oauthService.pendingRequest$,{initialValue:null});preferencesService=f(Pe);titleService=f(Fi);elementRef=f(ft);threadState=f(Ye);userService=f(Qt);router=f(zt);imageUploadService=f(Jo);fileExchangeState=f(ki);firstMessageState=f(Li);ngOnInit(){if(console.log("[THREAD] Initializing with project:",this.projectName,"thread:",this.threadId),!this.projectName||!this.threadId){console.error("[THREAD] Missing required inputs: projectName or threadId");return}this.setupPrintHandlers(),this.userService.authEnabled$.pipe(D(this.destroy$)).subscribe(e=>{this.authEnabled=e}),this.userService.username$.pipe(D(this.destroy$)).subscribe(e=>{this.currentUsername=e??"",this.messages.length>0&&(this.messages=[...this.messages])}),this.initializeThreadConnection()}ngOnChanges(e){console.log("[THREAD] ngOnChanges called",e),e.threadId&&(console.log("[THREAD] threadId changed:",{firstChange:e.threadId.firstChange,previousValue:e.threadId.previousValue,currentValue:e.threadId.currentValue}),e.threadId.firstChange||(console.log("[THREAD] Reconnecting to new thread"),this.initializeThreadConnection()))}initializeThreadConnection(){console.log("[THREAD] Initializing connection for thread:",this.threadId),this.fileExchangeState.initializeForThread(this.projectName,this.threadId),this.connectionDestroy$.next(),this.codayService.messages$.pipe(D(this.connectionDestroy$)).subscribe(t=>{console.log("[THREAD] Messages updated:",t.length),this.messages=t}),this.codayService.streamingText$.pipe(D(this.connectionDestroy$)).subscribe(t=>{this.streamingText=t}),this.codayService.isThinking$.pipe(D(this.connectionDestroy$)).subscribe(t=>{this.isThinking=t}),this.codayService.currentChoice$.pipe(D(this.connectionDestroy$)).subscribe(t=>{this.currentChoice=t}),this.codayService.connectionStatus$.pipe(D(this.connectionDestroy$)).subscribe(t=>{this.connectionStatus=t,this.isConnected=t.connected,t.connected&&!this.hasEverConnected&&(this.hasEverConnected=!0,this.showConnectionStatus=!0),!t.connected&&!this.hasEverConnected?setTimeout(()=>{!this.isConnected&&!this.hasEverConnected&&(this.showConnectionStatus=!0)},2e3):!t.connected&&this.hasEverConnected?this.showConnectionStatus=!0:t.connected&&(this.showConnectionStatus=!0)}),this.codayService.threadUpdateEvent$.pipe(D(this.connectionDestroy$)).subscribe(t=>{t&&(console.log("[THREAD] Thread update event received:",t),this.threadState.refreshThreadList())}),this.threadState.selectedThread$.pipe(D(this.connectionDestroy$)).subscribe(t=>{this.threadDetails=t}),this.codayService.resetMessages(),this.codayService.setTabTitleService(this.titleService),console.log("[THREAD] Connecting to thread event stream"),this.codayService.connectToThread(this.projectName,this.threadId);let e=this.firstMessageState.consumePendingFirstMessage();e?(console.log("[THREAD] First message pending:",e.substring(0,50)+"..."),this.pendingFirstMessage=e,this.codayService.setThinkingForPendingMessage(),this.subscribeToFirstInvite()):console.log("[THREAD] No first message found in state service")}ngAfterViewChecked(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&e>0&&(this.inputSectionHeight=e)}}ngOnDestroy(){console.log("[THREAD] Destroying component"),this.connectionDestroy$.next(),this.connectionDestroy$.complete(),this.destroy$.next(),this.destroy$.complete(),this.fileExchangeState.clear(),this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint)}onMessageSubmitted(e){console.log("[THREAD] Sending message:",e),this.codayService.sendMessage(e)}onVoiceToggled(e){console.log("[VOICE] Recording:",e)}onChoiceSelected(e){console.log("[THREAD] Choice selected:",e),this.codayService.sendChoice(e)}onCopyMessage(e){console.log("[COPY] Message copied:",e.id)}onStopRequested(){this.threadState.stop()}onInputHeightChanged(e){console.log("[THREAD] Input height changed:",e),this.inputSectionHeight=e}onFilesPasted(e){console.log("[THREAD] File(s) pasted:",e.length);let t=this.imageUploadService.filterImageFiles(e),n=e.filter(r=>!r.type.startsWith("image/"));t.length&&this.uploadFilesSequentially(t,0),n.length&&this.uploadFilesToExchangeSpace(n),!t.length&&!n.length&&this.showUploadError("No supported files found")}emitDrawerState(){this.drawerStateChange.emit(this.isDrawerOpen)}toggleFileDrawer(){this.drawerMode=this.drawerMode==="files"?"none":"files",this.emitDrawerState()}toggleSharePanel(){this.drawerMode=this.drawerMode==="share"?"none":"share",this.emitDrawerState()}closeDrawer(){this.drawerMode="none",this.emitDrawerState()}onUserAdded(e){if(console.log("[THREAD] Adding user to thread:",e),!this.threadDetails)return;let t=this.threadDetails.users||[];if(t.some(r=>r.userId===e)){this.threadShareRef?.setError("User already has access to this thread");return}this.threadShareRef?.setAdding(!0);let n=[...t,{userId:e}];this.threadState.updateThreadUsers(this.threadId,n).pipe(D(this.destroy$)).subscribe({next:()=>{console.log("[THREAD] User added successfully"),this.threadShareRef?.setAdding(!1),this.threadState.refreshSelectedThread()},error:r=>{console.error("[THREAD] Error adding user:",r),this.threadShareRef?.setError(r?.error?.error||"Failed to add user")}})}onUserRemoved(e){if(console.log("[THREAD] Removing user from thread:",e),!this.threadDetails)return;let t=e===this.currentUsername,n=(this.threadDetails.users||[]).filter(r=>r.userId!==e);this.threadState.updateThreadUsers(this.threadId,n).pipe(D(this.destroy$)).subscribe({next:()=>{console.log("[THREAD] User removed successfully"),t?(this.threadState.clearSelection(),this.threadState.refreshThreadList(),this.router.navigate(["project",this.projectName])):this.threadState.refreshSelectedThread()},error:r=>{console.error("[THREAD] Error removing user:",r)}})}onDragEnter(e){e.preventDefault(),e.dataTransfer?.types.includes("Files")&&(console.log("[THREAD] Image files detected - showing drag overlay"),this.isDragOver=!0)}onDragOver(e){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")}onDragLeave(e){this.elementRef.nativeElement.contains(e.relatedTarget)||(console.log("[THREAD] Leaving component area - hiding drag overlay"),this.isDragOver=!1)}onDrop(e){e.preventDefault(),this.isDragOver=!1,console.log("[THREAD] Files dropped:",e.dataTransfer?.files?.length||0);let t=e.dataTransfer?.files;if(!t||t.length===0){console.log("[THREAD] No files in drop event");return}let n=this.imageUploadService.filterImageFiles(t),r=Array.from(t).filter(o=>!o.type.startsWith("image/"));console.log("[THREAD] Image files:",n.length,"Other files:",r.length),n.length>0&&this.uploadFilesSequentially(n,0),r.length>0&&this.uploadFilesToExchangeSpace(r),n.length===0&&r.length===0&&this.showUploadError("No supported files found")}uploadFilesSequentially(e,t){if(t>=e.length)return;let n=e[t];if(!n){console.error("[THREAD] File at index",t,"is undefined");return}console.log("[THREAD] Uploading file:",n.name),this.uploadStatus={message:`Uploading ${n.name}...`,isError:!1},this.imageUploadService.uploadImage(n,this.projectName,this.threadId).subscribe({next:r=>{r.success?(console.log("[THREAD] Upload successful:",n.name),this.uploadStatus={message:`\u2713 ${n.name} uploaded (${(r.processedSize/1024).toFixed(1)} KB)`,isError:!1},setTimeout(()=>{this.uploadStatus.isError||(this.uploadStatus={message:"",isError:!1})},3e3),this.uploadFilesSequentially(e,t+1)):(console.error("[THREAD] Upload failed:",n.name,r.error),this.showUploadError(`Failed to upload ${n.name}: ${r.error}`))},error:r=>{console.error("[THREAD] Upload error:",n.name,r),this.showUploadError(`Failed to upload ${n.name}: ${r.message||"Unknown error"}`)}})}showUploadError(e){this.uploadStatus={message:e,isError:!0},setTimeout(()=>{this.uploadStatus={message:"",isError:!1}},5e3)}uploadFilesToExchangeSpace(e){return B(this,null,function*(){for(let t of e){console.log("[THREAD] Uploading to exchange space:",t.name),this.uploadStatus={message:`Uploading ${t.name}...`,isError:!1};let n=yield this.fileExchangeState.uploadFile(t);if(n.success)console.log("[THREAD] Upload to exchange space successful:",t.name),this.uploadStatus={message:`\u2713 ${t.name} uploaded to exchange space`,isError:!1},setTimeout(()=>{this.uploadStatus.isError||(this.uploadStatus={message:"",isError:!1})},3e3);else{console.error("[THREAD] Upload to exchange space failed:",t.name,n.error),this.showUploadError(`Failed to upload ${t.name}: ${n.error}`);break}}})}subscribeToFirstInvite(){console.log("[THREAD] Subscribing to wait for InviteEvent"),this.subscriptions.push(this.codayService.currentInviteEvent$.subscribe(e=>{if(e&&this.pendingFirstMessage){console.log("[THREAD] Received InviteEvent, sending pending message");let t=this.pendingFirstMessage;this.pendingFirstMessage=null,this.codayService.sendMessage(t)}}))}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint)}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical")};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical")};static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-thread"]],viewQuery:function(t,n){if(t&1&&Be(ff,5)(pr,5),t&2){let r;ge(r=fe())&&(n.inputSection=r.first),ge(r=fe())&&(n.threadShareRef=r.first)}},inputs:{projectName:"projectName",threadId:"threadId"},outputs:{chatFocused:"chatFocused",drawerStateChange:"drawerStateChange"},features:[jt],decls:22,vars:16,consts:[["inputSection",""],[1,"drag-drop-wrapper",3,"dragenter","dragover","dragleave","drop"],[1,"file-drawer-container",3,"hasBackdrop"],[1,"thread-container"],["matFab","","type","button",1,"file-drawer-toggle-btn",3,"has-files","matBadge","title"],["matFab","","title","Share thread","type","button",1,"share-toggle-btn",3,"has-shared-users"],[1,"connection-status"],[1,"chat-wrapper",3,"mousedown","touchstart"],[1,"chat-center"],[3,"copyRequested","stopRequested","messages","streamingText","isThinking","currentUsername"],[1,"upload-status",3,"error"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"],[1,"choice-overlay",3,"options","labelHtml","isVisible","allowFreeText"],["mode","side","position","end",3,"closed","opened"],[3,"projectName","threadId"],[3,"threadId","users","currentUsername"],[1,"drag-overlay"],["matFab","","type","button",1,"file-drawer-toggle-btn",3,"click","matBadge","title"],["matFab","","title","Share thread","type","button",1,"share-toggle-btn",3,"click"],[1,"upload-status"],[3,"messageSubmitted","voiceRecordingToggled","heightChanged","stopRequested","filesPasted","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"],[1,"choice-overlay",3,"choiceSelected","options","labelHtml","isVisible","allowFreeText"],[3,"closeDrawer","projectName","threadId"],[3,"userAdded","userRemoved","closed","threadId","users","currentUsername"],[1,"drag-overlay-content"],[1,"drag-icon"],[1,"drag-text"],[1,"drag-hint"]],template:function(t,n){t&1&&(l(0,"div",1),v("dragenter",function(o){return n.onDragEnter(o)})("dragover",function(o){return n.onDragOver(o)})("dragleave",function(o){return n.onDragLeave(o)})("drop",function(o){return n.onDrop(o)}),l(1,"mat-drawer-container",2)(2,"mat-drawer-content")(3,"div",3),C(4,bf,3,5,"button",4),C(5,vf,3,2,"button",5),C(6,yf,2,2,"div",6),l(7,"div",7),v("mousedown",function(){return n.chatFocused.emit()})("touchstart",function(){return n.chatFocused.emit()}),l(8,"div",8)(9,"app-chat-history",9),v("copyRequested",function(o){return n.onCopyMessage(o)})("stopRequested",function(){return n.onStopRequested()}),c(),C(10,Cf,2,3,"div",10),c()(),l(11,"div",11,0)(13,"div",12)(14,"div",13),C(15,Sf,1,5,"app-chat-textarea",14),C(16,xf,1,4,"app-choice-select",15),C(17,wf,1,0,"app-oauth-request-panel"),c()()()()(),l(18,"mat-drawer",16),v("closed",function(){return n.closeDrawer()}),C(19,Tf,1,2,"app-file-exchange-drawer",17),C(20,Ef,1,4,"app-thread-share",18),c()(),C(21,Mf,8,0,"div",19),c()),t&2&&(p(),T("hasBackdrop",!1),p(3),S(n.drawerMode!=="files"?4:-1),p(),S(n.authEnabled&&n.drawerMode!=="share"?5:-1),p(),S(n.showConnectionStatus&&n.connectionStatus&&!n.connectionStatus.connected?6:-1),p(3),T("messages",n.messages)("streamingText",n.streamingText)("isThinking",n.isThinking)("currentUsername",n.currentUsername),p(),S(n.uploadStatus.message?10:-1),p(5),S(!n.currentChoice&&!n.pendingOAuthRequest()?15:-1),p(),S(n.currentChoice?16:-1),p(),S(n.pendingOAuthRequest()?17:-1),p(),T("opened",n.isDrawerOpen),p(),S(n.drawerMode==="files"?19:-1),p(),S(n.drawerMode==="share"&&n.threadDetails?20:-1),p(),S(n.isDragOver?21:-1))},dependencies:[Ro,yi,No,Lo,qo,pr,Xo,mr,ur,Ni,ke,se,Ge,Br,Tp,wp],styles:[".drag-drop-wrapper[_ngcontent-%COMP%]{height:100vh;height:100dvh;width:100%;position:relative}.thread-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;width:100%;position:relative;background:transparent}.file-drawer-toggle-btn[_ngcontent-%COMP%]{position:fixed!important;top:1rem!important;right:1rem!important;z-index:100!important}.file-drawer-toggle-btn.has-files[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_pulse-subtle 3s infinite}@media(max-width:768px){.file-drawer-toggle-btn[_ngcontent-%COMP%]{width:40px!important;height:40px!important;top:.75rem!important;right:.75rem!important}.file-drawer-toggle-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}}.share-toggle-btn[_ngcontent-%COMP%]{position:fixed!important;top:5rem!important;right:1rem!important;z-index:100!important}.share-toggle-btn.has-shared-users[_ngcontent-%COMP%]{color:var(--color-primary)!important}@media(max-width:768px){.share-toggle-btn[_ngcontent-%COMP%]{width:40px!important;height:40px!important;top:calc(1.25rem + 40px)!important;right:.75rem!important}.share-toggle-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}}@keyframes _ngcontent-%COMP%_pulse-subtle{0%,to{box-shadow:0 2px 8px #00000026}50%{box-shadow:0 4px 16px rgba(var(--color-primary-rgb, 25, 118, 210),.3)}}.file-drawer-container[_ngcontent-%COMP%]{height:100dvh;width:100%;background:var(--color-bg)}.file-drawer-container[_ngcontent-%COMP%] .mat-drawer-content{display:flex;flex-direction:column;height:100%;overflow:hidden;background:transparent}.file-drawer-container[_ngcontent-%COMP%] .mat-drawer{width:35%;min-width:280px;max-width:480px;box-shadow:-2px 0 8px #0000001a}@media(max-width:768px){.file-drawer-container[_ngcontent-%COMP%] .mat-drawer{width:100%;max-width:100%;padding-bottom:env(safe-area-inset-bottom,0px)}}.file-drawer-container[_ngcontent-%COMP%] .mat-drawer-backdrop{display:none}.connection-status[_ngcontent-%COMP%]{position:fixed;top:0;left:0;right:0;z-index:1000;background:var(--color-warning);color:var(--color-text);padding:.5rem 1rem;text-align:center;font-size:.9rem;box-shadow:0 2px 4px #0000001a}.chat-wrapper[_ngcontent-%COMP%]{flex:1;overflow-y:auto;overflow-x:hidden;display:flex;flex-direction:column;width:100%;padding:1rem 0}.chat-center[_ngcontent-%COMP%]{max-width:800px;width:100%;margin:0 auto;padding:0 2rem;display:flex;flex-direction:column;gap:1rem}@media(max-width:768px){.chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-section[_ngcontent-%COMP%]{width:100%;padding:1rem 0;padding-bottom:calc(1rem + env(safe-area-inset-bottom,0px));background:transparent;position:relative}.input-center[_ngcontent-%COMP%]{max-width:800px;width:100%;margin:0 auto;padding:0 2rem}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.choice-overlay[_ngcontent-%COMP%]{display:block;width:100%}.upload-status[_ngcontent-%COMP%]{padding:.75rem 1rem;border-radius:8px;background:var(--color-success-light);color:var(--color-text);font-size:.9rem;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:var(--color-error-light)}@media print{.file-drawer-toggle-btn[_ngcontent-%COMP%], .share-toggle-btn[_ngcontent-%COMP%], .connection-status[_ngcontent-%COMP%]{display:none}.thread-container[_ngcontent-%COMP%]{background:#fff}.input-section[_ngcontent-%COMP%]{display:none}}"]})};var ea=class i{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation()}ngOnDestroy(){this.stopWelcomeRotation()}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex]},3e3)}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,n){t&1&&(hn(0,"h1",0),u(1),gn()),t&2&&(p(),L(n.currentWelcomeMessage))},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"]})};var Ep=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275mod=wt({type:i});static \u0275inj=xt({imports:[$t]})}return i})();var Mp=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275mod=wt({type:i});static \u0275inj=xt({imports:[$t]})}return i})();var ji=class i{currentThemeSubject=new W("light");currentTheme$=this.currentThemeSubject.asObservable();preferences=f(Pe);subscription=null;constructor(){console.log("[THEME] Initializing theme service"),this.initializeTheme(),this.setupSystemThemeListener()}ngOnDestroy(){this.subscription?.unsubscribe()}initializeTheme(){this.subscription=this.preferences.theme$.subscribe(e=>{console.log("[THEME] Theme preference changed to:",e),this.applyTheme(e)})}setTheme(e){this.preferences.setPreference("theme",e),this.applyTheme(e)}getCurrentTheme(){return this.currentThemeSubject.value}applyTheme(e){if(console.log("[THEME] Applying theme:",e),this.currentThemeSubject.next(e),e==="system")if(typeof window<"u"&&window.matchMedia){let n=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";console.log("[THEME] System theme resolved to:",n),this.setDocumentTheme(n)}else console.log("[THEME] matchMedia not available, defaulting to light theme"),this.setDocumentTheme("light");else this.setDocumentTheme(e)}setDocumentTheme(e){console.log("[THEME] Setting document theme to:",e),typeof document<"u"&&document.documentElement&&(e==="dark"?document.documentElement.setAttribute("data-theme","dark"):document.documentElement.removeAttribute("data-theme"))}setupSystemThemeListener(){typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{this.getCurrentTheme()==="system"&&this.setDocumentTheme(e.matches?"dark":"light")})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var kf=(i,e)=>e.code,Pf=(i,e)=>e.name+e.lang;function Of(i,e){i&1&&(l(0,"div",15)(1,"mat-icon",32),u(2,"warning"),c(),l(3,"span",33),u(4," Browser notifications have been blocked. To enable them, please reset the site permissions in your browser settings. "),c()())}function Af(i,e){if(i&1&&(l(0,"option",18),u(1),c()),i&2){let t=e.$implicit;T("value",t.code),p(),oi("",t.flag," ",t.label)}}function If(i,e){i&1&&(l(0,"option",25),u(1,"Loading voices..."),c())}function Df(i,e){i&1&&(l(0,"option",25),u(1,"No voice available"),c())}function Rf(i,e){if(i&1&&(l(0,"option",18),u(1),c()),i&2){let t=e.$implicit;T("value",t.name+"|"+t.lang),p(),Ne(" ",t.displayName," ")}}var hr=class i{destroy$=new J;selectedTheme="light";selectedVoiceLanguage="en-US";useEnterToSend=!1;printTechnicalMessages=!1;showTechnicalMessages=!0;showWarningMessages=!0;voiceAnnounceEnabled=!1;voiceMode="speech";voiceReadFullText=!1;voiceVolume=80;voiceRate=120;agentNotificationEnabled=!1;notificationSoundEnabled=!0;browserNotificationEnabled=!1;browserNotificationDenied=!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=f(Pe);voiceSynthesisService=f(Ei);themeService=f(ji);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.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.loadAvailableVoices(),this.themeService.currentTheme$.pipe(D(this.destroy$)).subscribe(e=>{this.selectedTheme=e}),this.preferencesService.voiceLanguage$.pipe(D(this.destroy$)).subscribe(e=>{this.selectedVoiceLanguage=e}),this.preferencesService.enterToSend$.pipe(D(this.destroy$)).subscribe(e=>{this.useEnterToSend=e}),this.preferencesService.printTechnicalMessages$.pipe(D(this.destroy$)).subscribe(e=>{this.printTechnicalMessages=e}),this.preferencesService.hideTechnicalMessages$.pipe(D(this.destroy$)).subscribe(e=>{this.showTechnicalMessages=!e}),this.preferencesService.hideWarningMessages$.pipe(D(this.destroy$)).subscribe(e=>{this.showWarningMessages=!e}),this.preferencesService.voiceAnnounceEnabled$.pipe(D(this.destroy$)).subscribe(e=>{this.voiceAnnounceEnabled=e}),this.preferencesService.voiceMode$.pipe(D(this.destroy$)).subscribe(e=>{this.voiceMode=e}),this.preferencesService.voiceReadFullText$.pipe(D(this.destroy$)).subscribe(e=>{this.voiceReadFullText=e}),this.preferencesService.voiceVolume$.pipe(D(this.destroy$)).subscribe(e=>{this.voiceVolume=Math.round(e*100)}),this.preferencesService.voiceRate$.pipe(D(this.destroy$)).subscribe(e=>{this.voiceRate=Math.round(e*100)}),this.preferencesService.selectedVoice$.pipe(D(this.destroy$)).subscribe(e=>{this.selectedVoiceId=e}),this.preferencesService.voiceLanguage$.pipe(D(this.destroy$)).subscribe(()=>{this.loadAvailableVoices()}),this.preferencesService.agentNotificationEnabled$.pipe(D(this.destroy$)).subscribe(e=>{this.agentNotificationEnabled=e}),this.preferencesService.notificationSoundEnabled$.pipe(D(this.destroy$)).subscribe(e=>{this.notificationSoundEnabled=e}),this.preferencesService.browserNotificationEnabled$.pipe(D(this.destroy$)).subscribe(e=>{this.browserNotificationEnabled=e,this.checkNotificationPermission()})}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)}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 B(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)}checkNotificationPermission(){"Notification"in window&&(this.browserNotificationDenied=Notification.permission==="denied",console.log("[OPTIONS] Notification permission status:",Notification.permission))}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-options-panel"]],decls:144,vars:35,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"],["color","primary",3,"ngModelChange","change","ngModel","disabled"],[1,"notification-error"],["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(t,n){t&1&&(l(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-icon"),u(4,"palette"),c(),l(5,"span"),u(6,"Appearance"),c()(),l(7,"div",3)(8,"div",4)(9,"label",5)(10,"input",6),ie("ngModelChange",function(o){return ne(n.selectedTheme,o)||(n.selectedTheme=o),o}),v("change",function(){return n.onThemeChange()}),c(),F(11,"span",7),u(12," Light "),c(),l(13,"label",5)(14,"input",8),ie("ngModelChange",function(o){return ne(n.selectedTheme,o)||(n.selectedTheme=o),o}),v("change",function(){return n.onThemeChange()}),c(),F(15,"span",7),u(16," Dark "),c(),l(17,"label",5)(18,"input",9),ie("ngModelChange",function(o){return ne(n.selectedTheme,o)||(n.selectedTheme=o),o}),v("change",function(){return n.onThemeChange()}),c(),F(19,"span",7),u(20," System "),c()()()(),l(21,"div",1)(22,"div",2)(23,"mat-icon"),u(24,"chat_bubble_outline"),c(),l(25,"span"),u(26,"Messaging"),c()(),l(27,"div",3)(28,"span",10),u(29,"Send message behavior:"),c(),l(30,"div",4)(31,"label",5)(32,"input",11),ie("ngModelChange",function(o){return ne(n.useEnterToSend,o)||(n.useEnterToSend=o),o}),v("change",function(){return n.onEnterToSendChange()}),c(),F(33,"span",7),u(34," Enter to send "),c(),l(35,"label",5)(36,"input",11),ie("ngModelChange",function(o){return ne(n.useEnterToSend,o)||(n.useEnterToSend=o),o}),v("change",function(){return n.onEnterToSendChange()}),c(),F(37,"span",7),u(38," Enter for new line "),c()()(),l(39,"div",3)(40,"div",12)(41,"span",10),u(42,"Show technical messages"),c(),l(43,"mat-slide-toggle",13),ie("ngModelChange",function(o){return ne(n.showTechnicalMessages,o)||(n.showTechnicalMessages=o),o}),v("change",function(){return n.onShowTechnicalMessagesChange()}),c()()(),l(44,"div",3)(45,"div",12)(46,"span",10),u(47,"Show warning messages"),c(),l(48,"mat-slide-toggle",13),ie("ngModelChange",function(o){return ne(n.showWarningMessages,o)||(n.showWarningMessages=o),o}),v("change",function(){return n.onShowWarningMessagesChange()}),c()()(),l(49,"div",3)(50,"div",12)(51,"span",10),u(52,"Include technical messages in print"),c(),l(53,"mat-slide-toggle",13),ie("ngModelChange",function(o){return ne(n.printTechnicalMessages,o)||(n.printTechnicalMessages=o),o}),v("change",function(){return n.onPrintTechnicalMessagesChange()}),c()()()(),l(54,"div",1)(55,"div",2)(56,"mat-icon"),u(57,"notifications"),c(),l(58,"span"),u(59,"Notifications"),c()(),l(60,"div",3)(61,"div",12)(62,"span",10),u(63,"Notify when the agent answers or requests input"),c(),l(64,"mat-slide-toggle",13),ie("ngModelChange",function(o){return ne(n.agentNotificationEnabled,o)||(n.agentNotificationEnabled=o),o}),v("change",function(){return n.onAgentNotificationEnabledChange()}),c()()(),l(65,"div",3)(66,"div",12)(67,"span",10),u(68,"Notification sound"),c(),l(69,"mat-slide-toggle",14),ie("ngModelChange",function(o){return ne(n.notificationSoundEnabled,o)||(n.notificationSoundEnabled=o),o}),v("change",function(){return n.onNotificationSoundEnabledChange()}),c()()(),l(70,"div",3)(71,"div",12)(72,"span",10),u(73,"Browser notification"),c(),l(74,"mat-slide-toggle",14),ie("ngModelChange",function(o){return ne(n.browserNotificationEnabled,o)||(n.browserNotificationEnabled=o),o}),v("change",function(){return n.onBrowserNotificationEnabledChange()}),c()(),C(75,Of,5,0,"div",15),c()(),l(76,"div",1)(77,"div",2)(78,"mat-icon"),u(79,"record_voice_over"),c(),l(80,"span"),u(81,"Voice & Speech"),c()(),l(82,"div",3)(83,"label",16),u(84,"Voice recognition language:"),c(),l(85,"select",17),ie("ngModelChange",function(o){return ne(n.selectedVoiceLanguage,o)||(n.selectedVoiceLanguage=o),o}),v("change",function(){return n.onVoiceLanguageChange()}),we(86,Af,2,3,"option",18,kf),c()(),l(88,"div",3)(89,"span",10),u(90,"Automatic announcement:"),c(),l(91,"div",4)(92,"label",5)(93,"input",19),ie("ngModelChange",function(o){return ne(n.voiceAnnounceEnabled,o)||(n.voiceAnnounceEnabled=o),o}),v("change",function(){return n.onVoiceAnnounceEnabledChange()}),c(),F(94,"span",7),u(95," Enabled "),c(),l(96,"label",5)(97,"input",19),ie("ngModelChange",function(o){return ne(n.voiceAnnounceEnabled,o)||(n.voiceAnnounceEnabled=o),o}),v("change",function(){return n.onVoiceAnnounceEnabledChange()}),c(),F(98,"span",7),u(99," Disabled "),c()()(),l(100,"div",3)(101,"span",10),u(102,"Voice mode:"),c(),l(103,"div",4)(104,"label",5)(105,"input",20),ie("ngModelChange",function(o){return ne(n.voiceMode,o)||(n.voiceMode=o),o}),v("change",function(){return n.onVoiceModeChange()}),c(),F(106,"span",7),u(107," Voice synthesis "),c(),l(108,"label",5)(109,"input",21),ie("ngModelChange",function(o){return ne(n.voiceMode,o)||(n.voiceMode=o),o}),v("change",function(){return n.onVoiceModeChange()}),c(),F(110,"span",7),u(111," Sound notification "),c()()(),l(112,"div",3)(113,"span",10),u(114,"Message reading:"),c(),l(115,"div",4)(116,"label",5)(117,"input",22),ie("ngModelChange",function(o){return ne(n.voiceReadFullText,o)||(n.voiceReadFullText=o),o}),v("change",function(){return n.onVoiceReadFullTextChange()}),c(),F(118,"span",7),u(119," Full message "),c(),l(120,"label",5)(121,"input",22),ie("ngModelChange",function(o){return ne(n.voiceReadFullText,o)||(n.voiceReadFullText=o),o}),v("change",function(){return n.onVoiceReadFullTextChange()}),c(),F(122,"span",7),u(123," First paragraphs only "),c()()(),l(124,"div",3)(125,"label",23),u(126,"Selected voice:"),c(),l(127,"select",24),ie("ngModelChange",function(o){return ne(n.selectedVoiceId,o)||(n.selectedVoiceId=o),o}),v("change",function(){return n.onSelectedVoiceChange()}),C(128,If,2,0,"option",25),C(129,Df,2,0,"option",25),we(130,Rf,2,2,"option",18,Pf),c(),F(132,"div",10),l(133,"a",26),v("click",function(){return n.testVoice()}),l(134,"span",27),u(135,"Test voice"),c()()(),l(136,"div",3)(137,"label",28),u(138),c(),l(139,"input",29),ie("ngModelChange",function(o){return ne(n.voiceVolume,o)||(n.voiceVolume=o),o}),v("input",function(){return n.onVoiceVolumeChange()}),c()(),l(140,"div",3)(141,"label",30),u(142),c(),l(143,"input",31),ie("ngModelChange",function(o){return ne(n.voiceRate,o)||(n.voiceRate=o),o}),v("input",function(){return n.onVoiceRateChange()}),c()()()()),t&2&&(p(10),te("ngModel",n.selectedTheme),p(4),te("ngModel",n.selectedTheme),p(4),te("ngModel",n.selectedTheme),p(14),T("value",!0),te("ngModel",n.useEnterToSend),p(4),T("value",!1),te("ngModel",n.useEnterToSend),p(7),te("ngModel",n.showTechnicalMessages),p(5),te("ngModel",n.showWarningMessages),p(5),te("ngModel",n.printTechnicalMessages),p(11),te("ngModel",n.agentNotificationEnabled),p(5),te("ngModel",n.notificationSoundEnabled),T("disabled",!n.agentNotificationEnabled),p(5),te("ngModel",n.browserNotificationEnabled),T("disabled",!n.agentNotificationEnabled||n.browserNotificationDenied),p(),S(n.browserNotificationDenied?75:-1),p(10),te("ngModel",n.selectedVoiceLanguage),p(),Te(n.voiceLanguageOptions),p(7),T("value",!0),te("ngModel",n.voiceAnnounceEnabled),p(4),T("value",!1),te("ngModel",n.voiceAnnounceEnabled),p(8),te("ngModel",n.voiceMode),p(4),te("ngModel",n.voiceMode),p(8),T("value",!0),te("ngModel",n.voiceReadFullText),p(4),T("value",!1),te("ngModel",n.voiceReadFullText),p(6),te("ngModel",n.selectedVoiceId),T("disabled",n.loadingVoices||n.availableVoices.length===0),p(),S(n.loadingVoices?128:-1),p(),S(!n.loadingVoices&&n.availableVoices.length===0?129:-1),p(),Te(n.availableVoices),p(8),Ne("Volume: ",n.voiceVolume,"%"),p(),te("ngModel",n.voiceVolume),p(3),Ne("Speed: ",n.voiceRate,"%"),p(),te("ngModel",n.voiceRate))},dependencies:[lt,Jl,Zl,_t,Kl,Xl,Ql,at,st,se,mc],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-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 Nf=(i,e)=>({subThreads:i,depth:e}),Ff=i=>({subThreads:i,depth:1}),kp=(i,e)=>e.id,Lf=(i,e)=>e.label;function jf(i,e){if(i&1){let t=O();l(0,"mat-icon",10),v("click",function(r){x(t);let o=h().$implicit,a=h(3);return w(a.toggleSubThreads(r,o.id))}),u(1),c()}if(i&2){let t=h().$implicit,n=h(3);p(),L(n.isParentExpanded(t.id)?"expand_more":"chevron_right")}}function Vf(i,e){i&1&&An(0)}function zf(i,e){if(i&1&&un(0,Vf,1,0,"ng-container",11),i&2){let t=h().$implicit,n=h().depth;h();let r=In(1);T("ngTemplateOutlet",r)("ngTemplateOutletContext",yl(2,Nf,t.subThreads,n+1))}}function $f(i,e){if(i&1){let t=O();l(0,"div",5)(1,"a",6),v("click",function(r){let o=x(t).$implicit;return h(3).selectThread(o.id),w(r.preventDefault())})("keydown.enter",function(r){let o=x(t).$implicit;return h(3).selectThread(o.id),w(r.preventDefault())})("keydown.space",function(r){let o=x(t).$implicit;return h(3).selectThread(o.id),w(r.preventDefault())}),C(2,jf,2,1,"mat-icon",7),l(3,"span",8),u(4),c(),l(5,"span",9),u(6),c()()(),C(7,zf,1,5,"ng-container")}if(i&2){let t,n=e.$implicit,r=h().depth,o=h(2);Ke("--sub-depth",r),Y("current",n.id===((t=o.currentThread())==null?null:t.id)),p(2),S(n.subThreads!=null&&n.subThreads.length?2:-1),p(2),L(n.delegatedAgentName||"Agent"),p(2),L(n.delegatedTask||n.name),p(),S(o.isParentExpanded(n.id)&&(n.subThreads!=null&&n.subThreads.length)?7:-1)}}function Bf(i,e){if(i&1&&we(0,$f,8,8,null,null,kp),i&2){let t=e.subThreads;Te(t)}}function Hf(i,e){i&1&&(l(0,"div",4),F(1,"span",12),l(2,"span",13),u(3,"Loading threads..."),c()())}function Uf(i,e){if(i&1&&(l(0,"div",25),u(1),c()),i&2){let t=h(6);p(),L(t.renameErrorMessage)}}function Wf(i,e){if(i&1){let t=O();l(0,"div",18)(1,"input",24),ie("ngModelChange",function(r){x(t);let o=h(5);return ne(o.editingThreadName,r)||(o.editingThreadName=r),w(r)}),v("keydown",function(r){x(t);let o=h(5);return w(o.onEditKeydown(r))})("blur",function(){x(t);let r=h(5);return w(r.onEditBlur())})("click",function(r){return r.stopPropagation()}),c(),C(2,Uf,2,1,"div",25),c()}if(i&2){let t=h(5);p(),te("ngModel",t.editingThreadName),T("disabled",t.isRenamingThread),p(),S(t.renameErrorMessage?2:-1)}}function qf(i,e){if(i&1){let t=O();l(0,"mat-icon",10),v("click",function(r){x(t);let o=h(2).$implicit,a=h(4);return w(a.toggleSubThreads(r,o.id))}),u(1),c()}if(i&2){let t=h(2).$implicit,n=h(4);p(),L(n.isParentExpanded(t.id)?"expand_more":"chevron_right")}}function Gf(i,e){if(i&1&&(l(0,"span",27),u(1),c()),i&2){let t=h(2).$implicit;p(),L(t.name)}}function Yf(i,e){i&1&&(F(0,"mat-spinner",29),l(1,"span",30),u(2,"Generating name..."),c()),i&2&&T("diameter",16)}function Qf(i,e){i&1&&(l(0,"mat-icon",28),u(1,"group"),c())}function Kf(i,e){if(i&1){let t=O();l(0,"a",26),v("click",function(r){x(t);let o=h().$implicit;return h(4).selectThread(o.id),w(r.preventDefault())})("keydown.enter",function(r){x(t);let o=h().$implicit;return h(4).selectThread(o.id),w(r.preventDefault())})("keydown.space",function(r){x(t);let o=h().$implicit;return h(4).selectThread(o.id),w(r.preventDefault())}),C(1,qf,2,1,"mat-icon",7),C(2,Gf,2,1,"span",27)(3,Yf,3,1),C(4,Qf,2,0,"mat-icon",28),c()}if(i&2){let t=h().$implicit,n=h(4);T("matTooltip",t.name?t.name+`
360
-
361
- `+(t.summary||""):t.summary||"")("matTooltipDisabled",!t.summary),p(),S(t.subThreads!=null&&t.subThreads.length?1:-1),p(),S(t.name?2:3),p(2),S(n.isSharedThread(t)?4:-1)}}function Xf(i,e){if(i&1){let t=O();l(0,"button",31),v("click",function(r){x(t);let o=h().$implicit,a=h(4);return w(a.startEditingThreadName(r,o))}),l(1,"mat-icon"),u(2,"edit"),c()()}}function Jf(i,e){i&1&&An(0)}function Zf(i,e){if(i&1&&un(0,Jf,1,0,"ng-container",11),i&2){let t=h().$implicit;h(3);let n=In(1);T("ngTemplateOutlet",n)("ngTemplateOutletContext",Ar(2,Ff,t.subThreads))}}function e0(i,e){if(i&1){let t=O();l(0,"div",17),C(1,Wf,3,3,"div",18)(2,Kf,5,5,"a",19),l(3,"div",20),C(4,Xf,3,0,"button",21),l(5,"button",22),v("click",function(r){let o=x(t).$implicit,a=h(4);return w(a.toggleStar(r,o))}),l(6,"mat-icon"),u(7),c()(),l(8,"button",23),v("click",function(r){let o=x(t).$implicit,a=h(4);return w(a.deleteThread(r,o))}),l(9,"mat-icon"),u(10,"delete"),c()()()(),C(11,Zf,1,4,"ng-container")}if(i&2){let t,n=e.$implicit,r=h(4);Y("current",n.id===((t=r.currentThread())==null?null:t.id)),p(),S(r.editingThreadId===n.id?1:2),p(3),S(r.editingThreadId!==n.id&&n.name?4:-1),p(),Y("starred",r.isStarred(n)),T("title",r.isStarred(n)?"Unstar thread":"Star thread"),p(2),L(r.isStarred(n)?"star":"star_outline"),p(4),S(r.isParentExpanded(n.id)&&(n.subThreads!=null&&n.subThreads.length)?11:-1)}}function t0(i,e){if(i&1&&(l(0,"div",14)(1,"div",16),u(2),c(),we(3,e0,12,9,null,null,kp),c()),i&2){let t=e.$implicit;p(2),L(t.label),p(),Te(t.threads)}}function n0(i,e){i&1&&(l(0,"div",15),u(1,"No existing threads"),c())}function i0(i,e){if(i&1&&(l(0,"div",15),u(1),c()),i&2){let t=h(3);p(),Ne('No threads matching "',t.searchQuery(),'"')}}function r0(i,e){if(i&1&&(we(0,t0,5,1,"div",14,Lf),C(2,n0,2,0,"div",15)(3,i0,2,1,"div",15)),i&2){let t,n=h(2);Te(n.getGroupedThreads()),p(2),S(!((t=n.threads())!=null&&t.length)&&!n.searchQuery()?2:n.searchQuery()&&n.getGroupedThreads().length===0?3:-1)}}function o0(i,e){if(i&1&&(un(0,Bf,2,0,"ng-template",null,0,ai),l(2,"div",3),C(3,Hf,4,0,"div",4)(4,r0,4,1),c()),i&2){let t=h();p(3),S(t.isLoadingThreadList()?3:4)}}function a0(i,e){i&1&&(l(0,"span",32),u(1,"No project selected"),c())}function s0(i,e){i&1&&(l(0,"span",32),u(1,"Loading..."),c())}function l0(i,e){if(i&1&&(l(0,"div",2),C(1,a0,2,0,"span",32)(2,s0,2,0,"span",32),c()),i&2){let t,n=h();p(),S((t=n.currentProject())!=null&&t.name?2:1)}}var ta=class i{projects=null;searchMode=!1;searchQuery=Ir("");searchModeChange=new Z;threadSelected=new Z;projectStateService=f(ye);threadStateService=f(Ye);threadApiService=f(Yt);userService=f(Qt);router=f(zt);destroyRef=f(ri);currentThread=Ie(this.threadStateService.selectedThread$);currentProject=Ie(this.projectStateService.selectedProject$);threads=Ie(this.threadStateService.threadList$);isLoadingThreadList=Ie(this.threadStateService.isLoadingThreadList$);username=Ie(this.userService.username$);isTouchDevice="ontouchstart"in window||navigator.maxTouchPoints>0;editingThreadId=null;editingThreadName="";isRenamingThread=!1;renameErrorMessage="";expandedParents=new Set;constructor(){Hi(()=>{let e=this.currentThread()?.id,t=this.threads();if(!e||!t?.length)return;let n=new Map;for(let o of t)o.parentThreadId&&n.set(o.id,o.parentThreadId);let r=e;for(;r;){let o=n.get(r);o&&this.expandedParents.add(o),r=o}})}ngOnInit(){this.userService.fetchCurrentUser().subscribe({error:e=>{console.error("[THREAD-SELECTOR] Failed to load current user:",e)}})}selectThread(e){this.threadStateService.selectThread(e),this.threadSelected.emit(),this.router.navigate(["project",this.currentProject()?.name,"thread",e])}getGroupedThreads(){let e=this.threads();if(!e?.length)return[];let t=new Set(e.map(N=>N.id)),n=e.filter(N=>!N.parentThreadId),r=e.filter(N=>!!N.parentThreadId),o=r.filter(N=>!t.has(N.parentThreadId)),a=r.filter(N=>t.has(N.parentThreadId)),s=new Map;for(let N of a){let X=N.parentThreadId;s.has(X)||s.set(X,[]),s.get(X).push(N)}let d=N=>(s.get(N)||[]).sort((U,Ee)=>U.modifiedDate>Ee.modifiedDate?-1:1).map(U=>he(G({},U),{subThreads:d(U.id)})),m=[...n,...o];if(this.searchQuery()&&this.searchQuery().trim()){let N=this.searchQuery().toLowerCase().trim();m=m.filter(X=>X.name.toLowerCase().includes(N)||X.summary&&X.summary.toLowerCase().includes(N))}if(!m.length)return[];let _=this.username();if(!_)return[];let b=m.map(N=>he(G({},N),{subThreads:d(N.id)})),y=b.filter(N=>N.starring&&N.starring.includes(_)),k=b.filter(N=>!N.starring||!N.starring.includes(_)),E=new Map,P=new Date;P.setHours(0,0,0,0);for(let N of k){let X=new Date(N.modifiedDate);X.setHours(0,0,0,0);let U=P.getTime()-X.getTime(),Ee=Math.floor(U/(1e3*60*60*24)),de;Ee===0?de="Today":Ee===1?de="Yesterday":Ee<7?de="This Week":Ee<30?de="This Month":Ee<90?de="Last 3 Months":de="Older",E.has(de)||E.set(de,[]),E.get(de).push(N)}let K=[];if(y.length>0){let N=[...y].sort((X,U)=>X.modifiedDate>U.modifiedDate?-1:1);K.push({label:"Starred",threads:N})}return["Today","Yesterday","This Week","This Month","Last 3 Months","Older"].filter(N=>E.has(N)).forEach(N=>{K.push({label:N,threads:E.get(N)})}),K}isParentExpanded(e){return this.expandedParents.has(e)}toggleSubThreads(e,t){e.stopPropagation(),this.expandedParents.has(t)?this.expandedParents.delete(t):this.expandedParents.add(t)}isSubThread(e){return!!e.parentThreadId}isSharedThread(e){return e.users&&e.users.length>1}isStarred(e){let t=this.username();return!!t&&e.starring&&e.starring.includes(t)}toggleStar(e,t){e.stopPropagation();let n=this.username();if(!n)return;let r=t.starring&&t.starring.includes(n),o=r?this.threadApiService.unstarThread(t.id):this.threadApiService.starThread(t.id);this.threadStateService.updateStarLocal(t.id,!r,n),o.pipe(ot(this.destroyRef)).subscribe({next:()=>{},error:a=>{console.error("Error toggling star:",a),this.threadStateService.refreshThreadList()}})}deleteThread(e,t){e.stopPropagation();let n=this.currentProject()?.name;!n||!confirm(`Are you sure you want to delete the thread "${t.name}"?`)||this.threadApiService.deleteThread(t.id).subscribe({next:()=>{this.currentThread()?.id===t.id&&(this.threadStateService.clearSelection(),this.router.navigate(["project",n])),this.threadStateService.refreshThreadList()},error:o=>{console.error("Error deleting thread:",o),alert("Failed to delete thread. Please try again.")}})}formatDate(e){try{let t=new Date(e),r=new Date().getTime()-t.getTime(),o=Math.floor(r/(1e3*60*60*24));return o===0?"Today":o===1?"Yesterday":o<7?`${o} days ago`:t.toLocaleDateString("en-EN",{day:"numeric",month:"short"})}catch(t){return"No date"}}startEditingThreadName(e,t){e.stopPropagation(),this.editingThreadId=t.id,this.editingThreadName=t.name||"",this.renameErrorMessage="",setTimeout(()=>{let n=document.querySelector(".thread-name-input");n&&(n.focus(),n.select())},0)}cancelEditingThreadName(){this.editingThreadId=null,this.editingThreadName="",this.renameErrorMessage=""}saveThreadName(e){if(e&&e.stopPropagation(),!this.editingThreadId)return;let t=this.editingThreadName.trim();if(!t){this.renameErrorMessage="Thread name cannot be empty";return}if(t.length>200){this.renameErrorMessage="Thread name is too long (max 200 characters)";return}let n=this.editingThreadId;this.isRenamingThread=!0,this.renameErrorMessage="",this.threadStateService.renameThread(n,t).subscribe({next:()=>{console.log("[THREAD-SELECTOR] Thread renamed successfully"),this.cancelEditingThreadName(),this.isRenamingThread=!1},error:r=>{console.error("[THREAD-SELECTOR] Error renaming thread:",r),this.renameErrorMessage=r.message||"Failed to rename thread",this.isRenamingThread=!1}})}onEditKeydown(e){e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.saveThreadName()):e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),this.cancelEditingThreadName())}onEditBlur(){setTimeout(()=>{this.editingThreadId&&!this.isRenamingThread&&this.saveThreadName()},200)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-thread-selector"]],inputs:{searchMode:"searchMode",searchQuery:[1,"searchQuery"]},outputs:{searchModeChange:"searchModeChange",threadSelected:"threadSelected"},decls:3,vars:1,consts:[["subThreadTemplate",""],["tabindex","0","role","application","aria-label","Thread selector",1,"thread-selector",3,"click","keydown"],[1,"thread-disabled"],["role","menu","aria-label","Thread selection",1,"thread-list"],[1,"thread-loading"],[1,"thread-item-wrapper","sub-thread"],["role","menuitem","tabindex","0",1,"thread-item","sub-thread-item",3,"click","keydown.enter","keydown.space"],[1,"sub-thread-toggle"],[1,"sub-thread-agent"],[1,"sub-thread-task"],[1,"sub-thread-toggle",3,"click"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[1,"loading-spinner"],[1,"loading-text"],[1,"thread-group"],[1,"thread-empty"],[1,"thread-group-header"],[1,"thread-item-wrapper"],[1,"thread-name-edit-wrapper"],["matTooltipShowDelay","1000","role","menuitem","tabindex","0",1,"thread-item",3,"matTooltip","matTooltipDisabled"],[1,"action-buttons"],["mat-icon-button","","title","Rename thread","type","button",1,"action-button","edit-button"],["mat-icon-button","","type","button",1,"action-button","star-button",3,"click","title"],["mat-icon-button","","title","Delete thread","type","button",1,"action-button","delete-button",3,"click"],["type","text","maxlength","200",1,"thread-name-input",3,"ngModelChange","keydown","blur","click","ngModel","disabled"],[1,"rename-error"],["matTooltipShowDelay","1000","role","menuitem","tabindex","0",1,"thread-item",3,"click","keydown.enter","keydown.space","matTooltip","matTooltipDisabled"],[1,"thread-name"],["matTooltip","Shared thread",1,"shared-indicator"],[1,"thread-name-spinner",3,"diameter"],[1,"thread-name","thread-name-generating"],["mat-icon-button","","title","Rename thread","type","button",1,"action-button","edit-button",3,"click"],[1,"disabled-text"]],template:function(t,n){if(t&1&&(l(0,"div",1),v("click",function(o){return o.stopPropagation()})("keydown",function(o){return o.stopPropagation()}),C(1,o0,5,1)(2,l0,3,1,"div",2),c()),t&2){let r;p(),S((r=n.currentProject())!=null&&r.name?1:2)}},dependencies:[Lr,lt,_t,at,ec,st,ke,se,Ge,ze,oc,rc,wi,xi,Qr,nc],styles:[".thread-selector[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%;flex:1;min-height:0;overflow-x:hidden;overflow-y:auto}.thread-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:0;max-height:none;overflow:visible}.thread-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin-bottom:.5rem}.thread-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.thread-group-header[_ngcontent-%COMP%]{padding:.5rem 1rem .25rem;font-size:.75rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.5px;position:sticky;top:0;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);z-index:1}.thread-item-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;position:relative;width:100%;border-radius:0;min-width:0;gap:.25rem}.thread-item-wrapper[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.thread-item-wrapper[_ngcontent-%COMP%]:hover .action-buttons[_ngcontent-%COMP%]{display:flex}.thread-item-wrapper.current[_ngcontent-%COMP%]{background:var(--color-primary-light)}.thread-item-wrapper.current[_ngcontent-%COMP%] .thread-item[_ngcontent-%COMP%]{color:var(--color-primary-text);font-weight:600}.thread-item[_ngcontent-%COMP%]{display:flex;align-items:center;flex:1;min-width:0;padding:.75rem 1rem;text-decoration:none;cursor:pointer;transition:all .2s ease;background:transparent;border:none;border-radius:0;color:var(--color-text);text-align:left;justify-content:flex-start}.thread-item.new-thread-item[_ngcontent-%COMP%]{margin-bottom:.25rem}.thread-item[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.thread-item[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:-2px}.action-buttons[_ngcontent-%COMP%]{display:none;align-items:center;gap:.25rem;flex-shrink:0;margin-right:.5rem}.thread-item-wrapper[_ngcontent-%COMP%]:hover .action-buttons[_ngcontent-%COMP%], .thread-item-wrapper.current[_ngcontent-%COMP%] .action-buttons[_ngcontent-%COMP%]{display:flex}.action-button[_ngcontent-%COMP%]{flex-shrink:0;border-radius:4px!important;width:28px!important;height:28px!important;padding:0!important}.action-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple{border-radius:4px!important}.action-button[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)!important}.action-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.action-button.edit-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.action-button.edit-button[_ngcontent-%COMP%]:hover{background-color:var(--color-primary-hover)!important}.action-button.edit-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.action-button.star-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{transition:color .2s ease}.action-button.star-button.starred[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#fbbf24}.action-button.star-button[_ngcontent-%COMP%]:not(.starred):hover mat-icon[_ngcontent-%COMP%]{color:#fbbf24}.action-button.delete-button[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:#ef4444}.thread-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;background:transparent;border:none;text-decoration:none;cursor:pointer;transition:all .2s ease;gap:.5rem;font-size:.875rem;font-weight:400;padding:0 1rem;min-width:0}.thread-link[_ngcontent-%COMP%]:hover:not(.new-thread-link){color:var(--color-primary-hover, var(--color-primary));text-decoration:underline;text-decoration-thickness:1.5px;text-underline-offset:3px}.thread-link[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.thread-link.new-thread-link[_ngcontent-%COMP%]{margin-bottom:.5rem;font-weight:600;font-size:.95rem}.thread-link.new-thread-link[_ngcontent-%COMP%] .thread-name[_ngcontent-%COMP%]{background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite}.thread-link.new-thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary);animation:_ngcontent-%COMP%_iconPulse 3s ease-in-out infinite}.thread-link.new-thread-link[_ngcontent-%COMP%]:hover{transform:translate(4px)}.thread-link.new-thread-link[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_iconPulse 1.5s ease-in-out infinite}.thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0 center}50%{background-position:100% center}to{background-position:0 center}}@keyframes _ngcontent-%COMP%_iconPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.8;transform:scale(1.05)}}.thread-name[_ngcontent-%COMP%]{flex:1;font-size:.875rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left}.thread-name.thread-name-generating[_ngcontent-%COMP%]{color:var(--color-text-muted);font-style:italic}.thread-name-edit-wrapper[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;padding:0 .5rem}.thread-name-input[_ngcontent-%COMP%]{width:100%;padding:.5rem;border:1px solid var(--color-border);border-radius:4px;background:var(--color-bg-secondary);color:var(--color-text-primary);font-size:.9rem;font-family:inherit}.thread-name-input[_ngcontent-%COMP%]:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 2px #3b82f61a}.thread-name-input[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed}.rename-error[_ngcontent-%COMP%]{color:var(--color-error);font-size:.75rem;margin-top:.25rem;padding-left:.5rem}.thread-name-spinner[_ngcontent-%COMP%]{flex-shrink:0;margin-right:.5rem}.thread-name-spinner[_ngcontent-%COMP%] .mat-mdc-progress-spinner circle{stroke:var(--color-primary)!important}.current-indicator[_ngcontent-%COMP%]{color:var(--color-success);font-weight:700;flex-shrink:0;font-size:1rem}.thread-separator[_ngcontent-%COMP%]{height:1px;background:var(--color-border);margin:.25rem 0}.thread-empty[_ngcontent-%COMP%]{padding:1.5rem 1rem;text-align:center;color:var(--color-text-muted);font-size:.8rem;font-style:italic}.thread-loading[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:2rem 1rem;gap:.75rem}.thread-loading[_ngcontent-%COMP%] .loading-spinner[_ngcontent-%COMP%]{width:24px;height:24px;border:3px solid var(--color-border);border-top-color:var(--color-primary);border-radius:50%;animation:_ngcontent-%COMP%_spin .8s linear infinite}.thread-loading[_ngcontent-%COMP%] .loading-text[_ngcontent-%COMP%]{color:var(--color-text-muted);font-size:.8rem}@keyframes _ngcontent-%COMP%_spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.thread-disabled[_ngcontent-%COMP%]{padding:1.5rem 1rem}.thread-disabled[_ngcontent-%COMP%] .disabled-text[_ngcontent-%COMP%]{display:block;color:var(--color-text-muted);font-size:.85rem;font-style:italic;text-align:center}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%]{padding-left:calc(.2rem + var(--sub-depth, 1) * 1.5rem);border-left:2px solid var(--color-primary, #3b82f6);margin-left:.75rem}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-item[_ngcontent-%COMP%]{padding:.35rem .5rem .35rem 0;gap:.2rem;font-size:.8rem;color:var(--color-text-secondary)}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-item[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-agent[_ngcontent-%COMP%]{font-weight:600;color:var(--color-primary);white-space:nowrap;flex-shrink:0;font-size:.8rem}.thread-item-wrapper.sub-thread[_ngcontent-%COMP%] .sub-thread-task[_ngcontent-%COMP%]{color:var(--color-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:.75rem}.sub-thread-toggle[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;flex-shrink:0;cursor:pointer;color:var(--color-text-secondary);margin-right:.25rem}.sub-thread-toggle[_ngcontent-%COMP%]:hover{color:var(--color-primary)}.shared-indicator[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px;color:var(--color-text-secondary);flex-shrink:0;margin-left:.25rem}@media(max-width:768px){.thread-item[_ngcontent-%COMP%]{padding:.6rem .8rem}.thread-name[_ngcontent-%COMP%]{font-size:.8rem}}"]})};var c0=["logsContent"],d0=(i,e)=>e.name;function p0(i,e){if(i&1){let t=O();l(0,"button",12),v("click",function(){x(t);let r=h().$implicit,o=h();return w(o.start(r.name))}),l(1,"mat-icon"),u(2,"play_arrow"),c()()}if(i&2){let t=h().$implicit;T("disabled",t.isLoading)}}function m0(i,e){if(i&1){let t=O();l(0,"button",13),v("click",function(){x(t);let r=h().$implicit,o=h();return w(o.stop(r.name))}),l(1,"mat-icon"),u(2,"stop"),c()()}if(i&2){let t=h().$implicit;T("disabled",t.isLoading)}}function u0(i,e){if(i&1&&(l(0,"a",8)(1,"mat-icon",14),u(2,"open_in_new"),c()()),i&2){let t=h().$implicit;T("href",t.url,On)("title",t.url)}}function h0(i,e){if(i&1&&(l(0,"div",15),u(1),c()),i&2){let t=h(),n=t.$implicit,r=t.$index;Ke("order",r*2),p(),L(n.errorMessage)}}function g0(i,e){if(i&1){let t=O();l(0,"button",21),v("click",function(){x(t);let r=h(3);return w(r.onManualRefresh())}),l(1,"mat-icon"),u(2,"refresh"),c()()}}function f0(i,e){if(i&1&&(l(0,"div",16)(1,"div",17)(2,"span",18),u(3),c(),C(4,g0,3,0,"button",19),c(),l(5,"pre",20,0),u(7),c()()),i&2){let t=h(),n=t.$implicit,r=t.$index,o=h();Ke("order",r*2+1),p(3),Ne("",n.name," logs"),p(),S(n.status==="running"?4:-1),p(3),L(o.logs()||"(empty)")}}function _0(i,e){if(i&1){let t=O();l(0,"div",2)(1,"span",3),u(2),c(),l(3,"div",4),C(4,p0,3,1,"button",5)(5,m0,3,1,"button",6),l(6,"span",7),u(7),c(),C(8,u0,3,2,"a",8),l(9,"button",9),v("click",function(){let r=x(t).$implicit,o=h();return w(o.toggleLogs(r.name))}),l(10,"mat-icon"),u(11),c()()()(),C(12,h0,2,3,"div",10),C(13,f0,8,5,"div",11)}if(i&2){let t=e.$implicit,n=e.$index,r=h();Ke("order",n*2),p(2),L(t.name),p(2),S(t.status==="stopped"?4:5),p(2),Y("running",t.status==="running"),p(),Ne(" ",t.status==="running"?"Running":"Stopped"," "),p(),S(t.url?8:-1),p(),T("title",r.logsOpenFor()===t.name?"Hide logs":"Show logs"),p(2),L(r.logsOpenFor()===t.name?"expand_less":"terminal"),p(),S(t.errorMessage?12:-1),p(),S(r.logsOpenFor()===t.name?13:-1)}}var na=class i{destroyRef=f(ri);projectApi=f(Yr);projectName=Ir.required();entryStates=qe([]);hasPreview=Tt(()=>this.entryStates().length>0);logsOpenFor=qe(null);logs=qe("");logsContent;logsPollTimer=null;logsTimeoutTimer=null;static LOGS_POLL_MS=5e3;static LOGS_TIMEOUT_MS=1200*1e3;constructor(){Hi(()=>{let e=this.projectName();e&&this.onProjectChanged(e)},{allowSignalWrites:!0}),Hi(()=>{console.log("entry states",this.entryStates())})}ngOnDestroy(){this.stopLogPolling()}onProjectChanged(e){this.stopLogPolling(),this.entryStates.set([]),this.logsOpenFor.set(null),this.logs.set(""),this.projectApi.getPreviewEntries(e).pipe(ot(this.destroyRef)).subscribe({next:t=>{let n=t.entries;if(n.length===0)return;let r=n.map(a=>({name:a.name,command:a.command,url:a.url,status:"stopped",isLoading:!1,errorMessage:""}));this.entryStates.set(r);let o=n.map(a=>this.projectApi.getPreviewStatus(e,a.name));ol(o).pipe(ot(this.destroyRef)).subscribe({next:a=>{this.entryStates.update(s=>s.map((d,m)=>{let _=a[m];return _?he(G({},d),{status:_.status}):d}))},error:()=>{}})},error:()=>{}})}start(e){this.updateEntry(e,{isLoading:!0,errorMessage:""}),this.projectApi.startPreview(this.projectName(),e).pipe(ot(this.destroyRef)).subscribe({next:t=>{this.updateEntry(e,{status:t.status,isLoading:!1})},error:t=>{this.updateEntry(e,{errorMessage:t?.error?.error??"Failed to start preview",isLoading:!1})}})}stop(e){this.updateEntry(e,{isLoading:!0,errorMessage:""}),this.projectApi.stopPreview(this.projectName(),e).pipe(ot(this.destroyRef)).subscribe({next:()=>{this.updateEntry(e,{status:"stopped",isLoading:!1}),this.logsOpenFor()===e&&this.stopLogPolling()},error:t=>{this.updateEntry(e,{errorMessage:t?.error?.error??"Failed to stop preview",isLoading:!1})}})}toggleLogs(e){this.logsOpenFor()===e?(this.logsOpenFor.set(null),this.logs.set(""),this.stopLogPolling()):(this.logsOpenFor.set(e),this.refreshLogs(),this.startLogPolling())}onManualRefresh(){this.refreshLogs(),this.logsPollTimer&&this.resetLogsTimeout()}refreshLogs(){let e=this.logsOpenFor();e&&this.projectApi.getPreviewLogs(this.projectName(),e).pipe(ot(this.destroyRef)).subscribe({next:t=>{this.logs.set(t.logs),this.scrollLogsToBottom()},error:()=>this.logs.set("(failed to load logs)")})}updateEntry(e,t){this.entryStates.update(n=>n.map(r=>r.name===e?G(G({},r),t):r))}startLogPolling(){this.stopLogPolling(),this.logsPollTimer=setInterval(()=>{this.logsOpenFor()?this.refreshLogs():this.stopLogPolling()},i.LOGS_POLL_MS),this.resetLogsTimeout()}stopLogPolling(){this.logsPollTimer&&(clearInterval(this.logsPollTimer),this.logsPollTimer=null),this.logsTimeoutTimer&&(clearTimeout(this.logsTimeoutTimer),this.logsTimeoutTimer=null)}resetLogsTimeout(){this.logsTimeoutTimer&&clearTimeout(this.logsTimeoutTimer),this.logsTimeoutTimer=setTimeout(()=>{this.stopLogPolling()},i.LOGS_TIMEOUT_MS)}scrollLogsToBottom(){setTimeout(()=>{let e=this.logsContent?.nativeElement;e&&(e.scrollTop=e.scrollHeight)})}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-preview-panel"]],viewQuery:function(t,n){if(t&1&&Be(c0,5),t&2){let r;ge(r=fe())&&(n.logsContent=r.first)}},inputs:{projectName:[1,"projectName"]},decls:3,vars:0,consts:[["logsContent",""],[1,"preview-panel"],[1,"entry-row"],[1,"entry-name"],[1,"entry-actions"],["mat-icon-button","","title","Start","type","button",1,"entry-btn","start",3,"disabled"],["mat-icon-button","","title","Stop","type","button",1,"entry-btn","stop",3,"disabled"],[1,"status-pill"],["target","_blank","rel","noopener noreferrer",1,"preview-url",3,"href","title"],["mat-icon-button","","type","button",1,"entry-btn","logs",3,"click","title"],[1,"preview-error",3,"order"],[1,"logs-container",3,"order"],["mat-icon-button","","title","Start","type","button",1,"entry-btn","start",3,"click","disabled"],["mat-icon-button","","title","Stop","type","button",1,"entry-btn","stop",3,"click","disabled"],[1,"link-icon"],[1,"preview-error"],[1,"logs-container"],[1,"logs-header"],[1,"logs-title"],["mat-icon-button","","title","Refresh logs","type","button",1,"entry-btn"],[1,"logs-content"],["mat-icon-button","","title","Refresh logs","type","button",1,"entry-btn",3,"click"]],template:function(t,n){t&1&&(l(0,"div",1),we(1,_0,14,12,null,null,d0),c()),t&2&&(p(),Te(n.entryStates()))},dependencies:[Ge,ze,ke,se],styles:["[_nghost-%COMP%]{display:block}.preview-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding:.25rem 0}.entry-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;padding:.125rem .5rem;min-height:36px}.entry-name[_ngcontent-%COMP%]{font-size:.82rem;font-weight:500;color:var(--on-surface, #e0e0e0);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1 1 auto;min-width:0}.entry-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.25rem;flex-shrink:0}.entry-btn[_ngcontent-%COMP%]{width:28px!important;height:28px!important;padding:0!important;display:inline-flex!important;align-items:center;justify-content:center;flex-shrink:0}.entry-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;line-height:18px}.entry-btn.start[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.entry-btn.stop[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#e53935}.entry-btn.logs[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:16px;width:16px;height:16px;line-height:16px;color:var(--color-text-secondary)}.entry-btn[disabled][_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.status-pill[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;padding:1px 6px;border-radius:12px;font-size:.68rem;font-weight:600;letter-spacing:.02em;flex-shrink:0;min-width:52px;text-align:center;background:var(--color-bg-hover);color:var(--color-text-secondary);border:1px solid var(--color-border)}.status-pill.running[_ngcontent-%COMP%]{background:#22c55e26;color:#16a34a;border-color:#22c55e66}.preview-url[_ngcontent-%COMP%]{display:inline-flex;align-items:center;text-decoration:none;color:var(--color-primary);flex-shrink:0}.preview-url[_ngcontent-%COMP%]:hover{text-decoration:underline}.preview-url[_ngcontent-%COMP%] .link-icon[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px}.preview-error[_ngcontent-%COMP%]{font-size:.75rem;color:#c00;padding:0 .75rem}.logs-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:.125rem .5rem .25rem;background:var(--color-bg-hover);border-radius:8px;overflow:hidden;border:1px solid var(--color-border)}.logs-header[_ngcontent-%COMP%]{display:flex;align-items:center;padding:.25rem .75rem;border-bottom:1px solid var(--color-border)}.logs-header[_ngcontent-%COMP%] .logs-title[_ngcontent-%COMP%]{flex:1;font-size:.72rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.logs-content[_ngcontent-%COMP%]{margin:0;padding:.5rem .75rem;font-family:Courier New,Courier,monospace;font-size:.72rem;line-height:1.5;color:var(--color-text);white-space:pre-wrap;word-break:break-all;max-height:200px;overflow-y:auto}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar{width:6px}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.logs-content[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-text-secondary);border-radius:3px}"]})};function b0(i,e){if(i&1&&(l(0,"div",3),u(1),c()),i&2){let t=h();p(),Ne("\u274C ",t.errorMessage)}}var gr=class i{dialogRef=f(Hr);data=f(Ur);jsonContent;errorMessage="";title;constructor(){this.jsonContent=this.data.initialContent,this.title=this.data.title||this.getDefaultTitle(this.data.configType,this.data.projectName)}getDefaultTitle(e,t){return e==="user"?"User Configuration":`Project Configuration: ${t||"Unknown"}`}onSave(){this.errorMessage="";let e;try{e=JSON.parse(this.jsonContent)}catch(t){this.errorMessage=`Invalid JSON syntax: ${t instanceof Error?t.message:"Unknown error"}`;return}this.dialogRef.close(e)}onCancel(){this.dialogRef.close()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,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(t,n){t&1&&(l(0,"div",0),u(1),l(2,"button",1),v("click",function(){return n.onCancel()}),l(3,"mat-icon"),u(4,"close"),c()()(),l(5,"mat-dialog-content")(6,"textarea",2),ie("ngModelChange",function(o){return ne(n.jsonContent,o)||(n.jsonContent=o),o}),c(),C(7,b0,2,1,"div",3),c(),l(8,"mat-dialog-actions",4)(9,"button",5),v("click",function(){return n.onCancel()}),u(10,"Cancel"),c(),l(11,"button",6),v("click",function(){return n.onSave()}),u(12,"Save"),c()()),t&2&&(p(),Ne(" ",n.title," "),p(5),te("ngModel",n.jsonContent),p(),S(n.errorMessage?7:-1))},dependencies:[it,lt,_t,at,st,se,ze,si,qr,ql,Gr],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)}"]})};var v0=["threadSearchInput"],y0=["*"];function C0(i,e){if(i&1){let t=O();l(0,"button",26),v("click",function(){x(t);let r=h();return w(r.toggle())}),l(1,"mat-icon"),u(2,"menu"),c()(),l(3,"button",27),v("click",function(){x(t);let r=h();return w(r.createNewThread())}),l(4,"mat-icon",10),u(5,"play_circle"),c()()}if(i&2){let t=h();p(3),T("disabled",!t.selectedProjectName())}}function S0(i,e){if(i&1){let t=O();l(0,"div",14)(1,"mat-icon",28),u(2,"search"),c(),l(3,"input",29,0),ie("ngModelChange",function(r){x(t);let o=h();return ne(o.threadSearchQuery,r)||(o.threadSearchQuery=r),w(r)}),v("input",function(){x(t);let r=h();return w(r.onThreadSearchInput())}),c(),l(5,"button",30),v("click",function(){x(t);let r=h();return w(r.closeThreadSearch())}),l(6,"mat-icon"),u(7,"close"),c()()()}if(i&2){let t=h();p(3),te("ngModel",t.threadSearchQuery)}}function x0(i,e){if(i&1){let t=O();l(0,"div",15)(1,"mat-icon",22),u(2,"forum"),c(),l(3,"span",23),u(4,"Threads"),c(),l(5,"button",31),v("click",function(r){x(t);let o=h();return w(o.toggleThreadSearch(r))}),l(6,"mat-icon"),u(7,"search"),c()()()}}function w0(i,e){i&1&&(l(0,"mat-icon",21),u(1,"keyboard_arrow_up"),c())}function T0(i,e){i&1&&(l(0,"mat-icon",22),u(1,"hub"),c())}function E0(i,e){i&1&&(l(0,"mat-icon",21),u(1,"keyboard_arrow_up"),c())}function M0(i,e){i&1&&(l(0,"mat-icon",22),u(1,"tune"),c())}function k0(i,e){i&1&&(l(0,"div",33)(1,"div",37),F(2,"app-options-panel",38),c()())}function P0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(3).openProjectConfig(),r.preventDefault(),w(r.stopPropagation())}),l(2,"mat-icon",22),u(3,"settings_applications"),c(),l(4,"span",23),u(5,"Project Configuration"),c()()()}}function O0(i,e){i&1&&(l(0,"div",32)(1,"a",39)(2,"mat-icon",22),u(3,"settings_applications"),c(),l(4,"span",23),u(5,"Project config (No project)"),c()()())}function A0(i,e){if(i&1&&C(0,P0,6,0,"div",32)(1,O0,6,0,"div",32),i&2){let t=h(2);S(t.selectedProjectName()?0:1)}}function I0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(2).openAgents(),r.preventDefault(),w(r.stopPropagation())}),l(2,"mat-icon",22),u(3,"smart_toy"),c(),l(4,"span",23),u(5,"Agents"),c()()()}}function D0(i,e){i&1&&(l(0,"div",32)(1,"a",39)(2,"mat-icon",22),u(3,"smart_toy"),c(),l(4,"span",23),u(5,"Agents (No project)"),c()()())}function R0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(2).openPrompts(),r.preventDefault(),w(r.stopPropagation())}),l(2,"mat-icon",22),u(3,"description"),c(),l(4,"span",23),u(5,"Prompts"),c()()()}}function N0(i,e){i&1&&(l(0,"div",32)(1,"a",39)(2,"mat-icon",22),u(3,"description"),c(),l(4,"span",23),u(5,"Prompts (No project)"),c()()())}function F0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(2).openSchedulers(),r.preventDefault(),w(r.stopPropagation())}),l(2,"mat-icon",22),u(3,"schedule"),c(),l(4,"span",23),u(5,"Schedulers"),c()()()}}function L0(i,e){i&1&&(l(0,"div",32)(1,"a",39)(2,"mat-icon",22),u(3,"schedule"),c(),l(4,"span",23),u(5,"Schedulers (No project)"),c()()())}function j0(i,e){i&1&&(l(0,"mat-icon",21),u(1,"keyboard_arrow_up"),c())}function V0(i,e){i&1&&(l(0,"mat-icon",22),u(1,"rocket_launch"),c())}function z0(i,e){if(i&1&&(l(0,"div",33),F(1,"app-preview-panel",40),c()),i&2){let t=h(3);p(),T("projectName",t.selectedProjectName())}}function $0(i,e){if(i&1){let t=O();l(0,"div",32)(1,"a",20),v("click",function(r){return x(t),h(2).toggleSection("preview"),r.preventDefault(),w(r.stopPropagation())}),C(2,j0,2,0,"mat-icon",21)(3,V0,2,0,"mat-icon",22),l(4,"span",23),u(5,"Preview Server"),c()(),C(6,z0,2,1,"div",33),c()}if(i&2){let t=h(2);Y("expanded",t.expandedSections.preview),p(),Y("active",t.expandedSections.preview),p(),S(t.expandedSections.preview?2:3),p(4),S(t.expandedSections.preview?6:-1)}}function B0(i,e){if(i&1){let t=O();l(0,"div",24)(1,"div",32)(2,"a",20),v("click",function(r){return x(t),h().toggleSection("config"),w(r.preventDefault())}),C(3,E0,2,0,"mat-icon",21)(4,M0,2,0,"mat-icon",22),l(5,"span",23),u(6,"Preferences"),c()(),C(7,k0,3,0,"div",33),c(),l(8,"div",32)(9,"a",20),v("click",function(r){return x(t),h().openTokenUsage(),r.preventDefault(),w(r.stopPropagation())}),l(10,"mat-icon",22),u(11,"data_usage"),c(),l(12,"span",23),u(13,"Token Usage"),c()()(),l(14,"div",32)(15,"a",20),v("click",function(r){return x(t),h().openUserConfig(),r.preventDefault(),w(r.stopPropagation())}),l(16,"mat-icon",22),u(17,"manage_accounts"),c(),l(18,"span",23),u(19,"User Configuration"),c()()(),C(20,A0,2,1),C(21,I0,6,0,"div",32)(22,D0,6,0,"div",32),C(23,R0,6,0,"div",32)(24,N0,6,0,"div",32),C(25,F0,6,0,"div",32)(26,L0,6,0,"div",32),C(27,$0,7,6,"div",34),l(28,"div",32)(29,"a",35),F(30,"img",36),l(31,"span",23),u(32,"Contribute on GitHub"),c()()()()}if(i&2){let t=h();p(),Y("expanded",t.expandedSections.config),p(),Y("active",t.expandedSections.config),p(),S(t.expandedSections.config?3:4),p(4),S(t.expandedSections.config?7:-1),p(13),S(t.isAdmin?20:-1),p(),S(t.selectedProjectName()?21:22),p(2),S(t.selectedProjectName()?23:24),p(2),S(t.selectedProjectName()?25:26),p(2),S(t.hasPreviewConfig()?27:-1),p(3),Me("src","CODAY-Logo.png",On)}}function H0(i,e){if(i&1){let t=O();l(0,"div",25)(1,"mat-icon",41),u(2,"warning"),c(),l(3,"span",42),u(4),c(),l(5,"button",43),v("click",function(){x(t);let r=h();return w(r.configErrorMessage="")}),l(6,"mat-icon"),u(7,"close"),c()()()}if(i&2){let t=h();p(4),L(t.configErrorMessage)}}var fr=class i{destroy$=new J;sidenavStateChange=new Z;drawerOpen=!1;breakpointObserver=f(Dl);isDesktop=Ie(this.breakpointObserver.observe("(min-width: 1400px)").pipe(Ae(e=>e.matches)),{initialValue:!1});userOpenPreference=qe(!0);isOpen=Tt(()=>this.userOpenPreference());isAdmin=!1;configErrorMessage="";expandedSections={config:!1,preview:!1,settings:!1};isThreadSearchActive=!1;threadSearchQuery="";threadSearchInput;dialog=f(Wr);configApi=f(pc);projectStateService=f(ye);projectApi=f(Yr);router=f(zt);preferences=f(Pe);threadStateService=f(Ye);projects=Ie(this.projectStateService.projectList$);selectedProject=Ie(this.projectStateService.selectedProject$);selectedProjectName=Ie(this.projectStateService.selectedProject$.pipe(Ae(e=>e?.name)));isProjectVolatile=Ie(this.projectStateService.selectedProject$.pipe(Ae(e=>e?.config?.volatile||!1)));forcedProject=Ie(this.projectStateService.forcedProject$);hasPreviewConfig=Ie(this.projectStateService.selectedProject$.pipe(Ae(e=>{let t=e?.config?.preview;return Array.isArray(t)&&!!t.length})),{initialValue:!1});ngOnInit(){let e=window.innerWidth>=1024,t=this.preferences.getPreference("sidenavOpen",e);this.userOpenPreference.set(t??e),this.configApi.getUserConfig().pipe(D(this.destroy$)).subscribe({next:n=>{this.isAdmin=n.groups?.includes("CODAY_ADMIN")??!1,console.log("[SIDENAV] User admin status:",this.isAdmin)},error:n=>{console.error("[SIDENAV] Error loading user config for roles:",n),this.isAdmin=!1}})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}toggle(){let e=!this.userOpenPreference();this.userOpenPreference.set(e),this.saveSidenavState(e),this.sidenavStateChange.emit(e)}close(){this.userOpenPreference()&&(this.userOpenPreference.set(!1),this.saveSidenavState(!1),this.sidenavStateChange.emit(!1))}saveSidenavState(e){this.preferences.setPreference("sidenavOpen",e)}openTokenUsage(){this.configErrorMessage="",this.router.navigate(["/token-usage"])}openUserConfig(){console.log("[SIDENAV] openUserConfig called"),this.configErrorMessage="",this.configApi.getUserConfig().pipe(D(this.destroy$)).subscribe({next:e=>{console.log("[SIDENAV] User config loaded, opening dialog"),this.dialog.open(gr,{data:{configType:"user",initialContent:JSON.stringify(e,null,2)}}).afterClosed().subscribe(n=>{n&&this.saveUserConfig(n)})},error:e=>{console.error("[SIDENAV] Error loading user config:",e),this.configErrorMessage=e?.error?.error||"Failed to load user configuration"}})}saveUserConfig(e){this.configApi.updateUserConfig(e).pipe(D(this.destroy$)).subscribe({next:t=>{console.log("[SIDENAV] User config saved successfully")},error:t=>{console.error("[SIDENAV] Error saving user config:",t),this.configErrorMessage=t?.error?.error||"Failed to save user configuration"}})}openProjectConfig(){let e=this.selectedProjectName();if(!e){console.error("[SIDENAV] No project selected"),this.configErrorMessage="No project selected. Please select a project first.";return}this.configErrorMessage="",this.projectApi.getProjectConfig(e).pipe(D(this.destroy$)).subscribe({next:t=>{console.log("[SIDENAV] Project config loaded, opening dialog"),this.dialog.open(gr,{data:{configType:"project",projectName:e,initialContent:JSON.stringify(t,null,2)}}).afterClosed().subscribe(r=>{r&&this.saveProjectConfig(e,r)})},error:t=>{console.error("[SIDENAV] Error loading project config:",t),this.configErrorMessage=t?.error?.error||"Failed to load project configuration"}})}saveProjectConfig(e,t){this.projectApi.updateProjectConfig(e,t).pipe(D(this.destroy$)).subscribe({next:n=>{console.log("[SIDENAV] Project config saved successfully")},error:n=>{console.error("[SIDENAV] Error saving project config:",n),this.configErrorMessage=n?.error?.error||"Failed to save project configuration"}})}requireProjectSelection(e){return this.selectedProjectName()?!0:(console.error(`[SIDENAV] No project selected, cannot ${e}`),this.configErrorMessage="Please select a project first",!1)}openAgents(){if(!this.requireProjectSelection("open agents"))return;let e=this.selectedProjectName();this.router.navigate(["project",e,"agents"])}openPrompts(){if(!this.requireProjectSelection("open prompts"))return;let e=this.selectedProjectName();this.router.navigate(["project",e,"prompts"])}openSchedulers(){if(!this.requireProjectSelection("open schedulers"))return;let e=this.selectedProjectName();this.router.navigate(["project",e,"schedulers"])}toggleSection(e){let t=this.expandedSections[e];e==="settings"?this.expandedSections[e]=!t:(["config","preview"].forEach(r=>{this.expandedSections[r]=!1}),this.expandedSections[e]=!t)}navigateToHome(){if(this.forcedProject()){console.log("[SIDENAV] Cannot navigate to home - forced project active");return}console.log("[SIDENAV] Navigating to home (project selection)"),this.projectStateService.clearSelection(),this.router.navigate(["/"])}createNewThread(){let e=this.selectedProjectName();if(!e){console.error("[SIDENAV] No project selected, cannot create new thread"),this.configErrorMessage="Please select a project first";return}console.log("[SIDENAV] Navigating to welcome view for new thread"),this.threadStateService.clearSelection(),this.router.navigate(["project",e])}onThreadSelectedOnMobile(){this.isDesktop()||this.close()}toggleThreadSearch(e){e.stopPropagation(),this.isThreadSearchActive=!0,this.threadSearchQuery="",setTimeout(()=>{this.threadSearchInput?.nativeElement.focus()},0)}closeThreadSearch(){this.isThreadSearchActive=!1,this.threadSearchQuery=""}onThreadSearchInput(){}onThreadSearchModeChange(e){e||this.closeThreadSearch()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-sidenav"]],viewQuery:function(t,n){if(t&1&&Be(v0,5),t&2){let r;ge(r=fe())&&(n.threadSearchInput=r.first)}},inputs:{drawerOpen:"drawerOpen"},outputs:{sidenavStateChange:"sidenavStateChange"},ngContentSelectors:y0,decls:34,vars:31,consts:[["threadSearchInput",""],[1,"sidenav-container",3,"hasBackdrop"],["mode","push","position","start",1,"app-sidenav",3,"closed","opened","disableClose"],[1,"sidenav-header"],["mat-icon-button","","title","Close menu",3,"click"],["alt","coday",3,"click","keydown.enter","keydown.space","title"],[1,"header-title-section"],[1,"sidenav-title"],[1,"new-thread-section"],["role","button","tabindex","0",1,"new-thread-link",3,"click"],["fontSet","material-icons-outlined"],[1,"new-thread-text"],[1,"sidenav-sections"],[1,"section-container","expanded"],[1,"search-header"],[1,"section-toggle","active","threads-header"],[1,"section-content","threads"],[1,"sidenav-thread-selector",3,"searchModeChange","threadSelected","searchMode","searchQuery"],[1,"sidenav-nav"],[1,"section-container","settings-group"],["role","button","tabindex","0",1,"section-toggle",3,"click"],[1,"arrow-icon","expanded"],[1,"section-icon"],[1,"section-label"],[1,"section-content","settings-content"],["role","alert",1,"error-notification"],["mat-icon-button","","title","Menu","type","button",1,"sidenav-toggle-btn",3,"click"],["mat-icon-button","","title","Start a new thread","type","button",1,"sidenav-new-thread-btn",3,"click","disabled"],[1,"search-icon"],["type","text","placeholder","Search threads...",1,"search-input",3,"ngModelChange","input","ngModel"],["mat-icon-button","","title","Close search","type","button",1,"close-search-btn",3,"click"],["mat-icon-button","","title","Search threads","type","button",1,"search-button",3,"click"],[1,"section-container"],[1,"section-content"],[1,"section-container",3,"expanded"],["href","https://github.com/whoz-oss/coday","target","_blank","rel","noopener noreferrer","title","Contribute on GitHub",1,"section-toggle","contribute-btn"],["alt","Coday",1,"contribute-logo"],[1,"preference-item"],[1,"inline-panel"],["role","button","tabindex","-1","aria-disabled","true",1,"section-toggle","disabled"],[3,"projectName"],[1,"error-icon"],[1,"error-text"],["mat-icon-button","","aria-label","Close error message",1,"error-close",3,"click"]],template:function(t,n){t&1&&(rn(),C(0,C0,6,1),l(1,"mat-sidenav-container",1)(2,"mat-sidenav",2),v("closed",function(){return n.close()}),l(3,"div",3)(4,"button",4),v("click",function(){return n.close()}),l(5,"mat-icon"),u(6,"chevron_left"),c()(),l(7,"img",5),v("click",function(o){return n.navigateToHome(),o.stopPropagation()})("keydown.enter",function(o){return n.navigateToHome(),o.preventDefault(),o.stopPropagation()})("keydown.space",function(o){return n.navigateToHome(),o.preventDefault(),o.stopPropagation()}),c(),l(8,"div",6)(9,"h2",7),u(10),c()()(),l(11,"div",8)(12,"a",9),v("click",function(o){return n.createNewThread(),o.preventDefault()}),l(13,"mat-icon",10),u(14,"play_circle"),c(),l(15,"span",11),u(16,"Start a new thread"),c()()(),l(17,"div",12)(18,"div",13),C(19,S0,8,1,"div",14)(20,x0,8,0,"div",15),l(21,"div",16)(22,"app-thread-selector",17),v("searchModeChange",function(o){return n.onThreadSearchModeChange(o)})("threadSelected",function(){return n.onThreadSelectedOnMobile()}),c()()()(),l(23,"div",18)(24,"div",19)(25,"a",20),v("click",function(o){return n.toggleSection("settings"),o.preventDefault()}),C(26,w0,2,0,"mat-icon",21)(27,T0,2,0,"mat-icon",22),l(28,"span",23),u(29,"Control Center"),c()(),C(30,B0,33,12,"div",24),c()()(),l(31,"mat-sidenav-content"),ht(32),c()(),C(33,H0,8,1,"div",25)),t&2&&(S(!n.isOpen()&&!n.drawerOpen?0:-1),p(),Y("sidenav-open",n.isOpen()),T("hasBackdrop",!1),p(),T("opened",n.isOpen())("disableClose",!0),p(5),Y("sidenav-logo",!0)("clickable",!n.forcedProject())("disabled",n.forcedProject()),T("title",n.forcedProject()?"Project selection disabled":"Go to project selection"),Me("src","CODAY-Logo.png",On)("role",n.forcedProject()?null:"button")("tabindex",n.forcedProject()?null:"0"),p(3),L(n.selectedProjectName()),p(9),S(n.isThreadSearchActive?19:20),p(3),T("searchMode",n.isThreadSearchActive)("searchQuery",n.threadSearchQuery),p(),Y("is-admin",n.isAdmin),p(),Y("expanded",n.expandedSections.settings),p(),Y("active",n.expandedSections.settings),p(),S(n.expandedSections.settings?26:27),p(4),S(n.expandedSections.settings?30:-1),p(),Y("sidenav-closed-offset",!n.isOpen()),p(2),S(n.configErrorMessage?33:-1))},dependencies:[lt,_t,at,st,Xo,js,Cp,Qo,ke,se,Ge,ze,Ep,Mp,hr,ta,na],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;position:relative}.sidenav-container[_ngcontent-%COMP%]{position:fixed;top:0;left:0;right:0;height:100dvh;z-index:1400;transition:width;display:flex}.sidenav-container[_ngcontent-%COMP%] mat-sidenav[_ngcontent-%COMP%]{position:relative!important;transition:width;width:25%;min-width:320px;height:100dvh!important;flex-shrink:0}.sidenav-container[_ngcontent-%COMP%] mat-sidenav[_ngcontent-%COMP%]:not(.mat-drawer-opened){width:0!important;min-width:0;overflow:hidden!important;visibility:hidden!important}.sidenav-container[_ngcontent-%COMP%] mat-sidenav-content[_ngcontent-%COMP%]{width:100%;margin:0!important}@media(min-width:1024px){.sidenav-container[_ngcontent-%COMP%] mat-sidenav-content[_ngcontent-%COMP%]{min-width:0}}[_nghost-%COMP%] .mat-drawer-backdrop{pointer-events:auto}[_nghost-%COMP%] .mat-drawer-content{pointer-events:auto!important;background:transparent!important;overflow:visible!important}[_nghost-%COMP%] .mat-drawer-inner-container{overflow:hidden!important;height:100dvh!important;display:flex!important;flex-direction:column!important}.sidenav-new-thread-btn[_ngcontent-%COMP%], .sidenav-toggle-btn[_ngcontent-%COMP%]{position:fixed!important;z-index:1500!important;width:40px!important;height:40px!important;border-radius:50%!important;background:var(--glass-bg)!important;backdrop-filter:var(--glass-backdrop-blur)!important;-webkit-backdrop-filter:var(--glass-backdrop-blur)!important;border:1px solid var(--glass-border)!important;box-shadow:var(--glass-shadow)!important}.sidenav-toggle-btn[_ngcontent-%COMP%]{top:1rem!important;left:1rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]{top:calc(1.5rem + 40px)!important;left:1rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--color-primary)!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]:disabled{opacity:.5!important}.sidenav-logo-btn[_ngcontent-%COMP%]{position:fixed!important;bottom:1rem!important;left:1rem!important;z-index:1500!important;width:56px!important;height:56px!important;border-radius:50%!important;border:1px solid var(--glass-border)!important;padding:4px!important;background:var(--glass-bg)!important;backdrop-filter:var(--glass-backdrop-blur)!important;-webkit-backdrop-filter:var(--glass-backdrop-blur)!important;box-shadow:var(--glass-shadow)!important;transition:all .3s cubic-bezier(.4,0,.2,1)!important;cursor:pointer!important;pointer-events:auto!important;display:flex!important;align-items:center!important;justify-content:center!important;overflow:hidden!important;text-decoration:none!important}.sidenav-logo-btn[_ngcontent-%COMP%]:hover{transform:scale(1.08) translateY(-2px)!important;box-shadow:0 16px 48px #0003!important;border-color:var(--color-primary)!important}.sidenav-logo-btn[_ngcontent-%COMP%]:active{transform:scale(.96)!important}.sidenav-logo-btn[_ngcontent-%COMP%] .logo[_ngcontent-%COMP%]{width:48px;height:48px;border-radius:2px}.app-sidenav[_ngcontent-%COMP%]{width:480px;height:100dvh!important;min-height:0!important;position:relative;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border-radius:0;overflow:hidden;overflow-x:hidden!important;display:flex;flex-direction:column}.sidenav-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;padding:1.5rem 1rem .5rem;flex-shrink:0}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo[_ngcontent-%COMP%]{width:40px;height:40px;border-radius:4px;flex-shrink:0;transition:all .2s ease}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]{cursor:pointer}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:hover{transform:scale(1.1);filter:drop-shadow(0 4px 12px rgba(0,0,0,.15))}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:active{transform:scale(.95)}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.clickable[_ngcontent-%COMP%]:focus{outline:2px solid var(--color-primary);outline-offset:2px}.sidenav-header[_ngcontent-%COMP%] .sidenav-logo.disabled[_ngcontent-%COMP%]{opacity:.5;cursor:not-allowed;pointer-events:none}.sidenav-header[_ngcontent-%COMP%] .header-title-section[_ngcontent-%COMP%]{flex:1;display:flex;align-items:center;min-width:0}.sidenav-header[_ngcontent-%COMP%] .header-title-section[_ngcontent-%COMP%] .sidenav-title[_ngcontent-%COMP%]{margin:0;font-size:1.25rem;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.loading-section[_ngcontent-%COMP%]{padding:2rem 1rem;display:flex;align-items:center;justify-content:center}.loading-content[_ngcontent-%COMP%]{width:100%;display:flex;flex-direction:column;gap:1rem;align-items:center}.loading-content[_ngcontent-%COMP%] mat-progress-bar[_ngcontent-%COMP%]{width:100%;height:4px;border-radius:2px}.loading-content[_ngcontent-%COMP%] .loading-text[_ngcontent-%COMP%]{margin:0;font-size:.875rem;color:var(--color-text-secondary);text-align:center}.new-thread-section[_ngcontent-%COMP%]{padding:1rem 1rem .5rem;flex-shrink:0}.new-thread-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;background:transparent;border:none;text-decoration:none;cursor:pointer;transition:all .2s ease;gap:.5rem;font-size:.95rem;font-weight:600;padding:0}.new-thread-link[_ngcontent-%COMP%] .new-thread-text[_ngcontent-%COMP%]{background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-primary);animation:_ngcontent-%COMP%_iconPulse 3s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%]:hover{transform:translate(4px)}.new-thread-link[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_iconPulse 1.5s ease-in-out infinite}.new-thread-link[_ngcontent-%COMP%]:focus{transform:scale(1.1)}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}@keyframes _ngcontent-%COMP%_iconPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.8;transform:scale(1.05)}}.sidenav-sections[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:100px;overflow:hidden}.sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container.expanded[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%] > .section-content.threads[_ngcontent-%COMP%], .sidenav-sections[_ngcontent-%COMP%] > .section-container[_ngcontent-%COMP%] > .section-content.threads[_ngcontent-%COMP%] > app-thread-selector[_ngcontent-%COMP%]{display:flex!important;flex-direction:column!important;flex:1!important;min-height:0!important;overflow:hidden!important}.sidenav-nav[_ngcontent-%COMP%]{flex-shrink:0;display:flex;flex-direction:column;overflow:hidden;max-height:70%;border-top:1px solid var(--color-border)}.sidenav-nav[_ngcontent-%COMP%] > .settings-group[_ngcontent-%COMP%] > .section-toggle.active[_ngcontent-%COMP%]{border-top:none}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%] > .section-toggle[_ngcontent-%COMP%]{flex-shrink:0}.sidenav-nav[_ngcontent-%COMP%] .settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden}.settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%]{padding:0;border-bottom:1px solid var(--color-border);overflow:visible}.settings-group[_ngcontent-%COMP%] > .section-content.settings-content[_ngcontent-%COMP%] .section-container.expanded[_ngcontent-%COMP%] .section-content[_ngcontent-%COMP%]{max-height:40vh;overflow-y:auto;overflow-x:hidden}.contribute-btn[_ngcontent-%COMP%] .contribute-logo[_ngcontent-%COMP%]{width:20px;height:20px;border-radius:2px;flex-shrink:0}.section-container[_ngcontent-%COMP%]{flex-shrink:0;display:flex;flex-direction:column}.section-container.expanded[_ngcontent-%COMP%]{display:flex;flex-direction:column}.section-container.expanded[_ngcontent-%COMP%] .section-content[_ngcontent-%COMP%]{border-bottom:none}.section-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;width:100%;padding:.5rem 1rem;height:50px;text-decoration:none;cursor:pointer;transition:all .2s ease;background:transparent;border:none;border-radius:0;color:var(--color-text);flex-shrink:0}.section-toggle.active[_ngcontent-%COMP%]{border-top:1px solid var(--color-border)}.section-toggle.disabled[_ngcontent-%COMP%]{opacity:.5;cursor:not-allowed;pointer-events:none}.section-toggle[_ngcontent-%COMP%] .arrow-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);transition:transform .2s ease;transform:rotate(0);flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .section-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .section-label[_ngcontent-%COMP%]{flex:1;font-size:.9rem;color:var(--color-text);text-align:left}.section-toggle[_ngcontent-%COMP%] .search-button[_ngcontent-%COMP%]{margin-left:auto;flex-shrink:0}.section-toggle[_ngcontent-%COMP%] .search-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.section-toggle[_ngcontent-%COMP%]:hover:not(.disabled){background:var(--color-bg-hover)}.section-toggle[_ngcontent-%COMP%]:active:not(.disabled){transform:scale(.98)}.section-toggle[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--color-primary);outline-offset:-2px}.search-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.5rem 1rem;height:50px;background:var(--color-bg-hover);border-top:1px solid var(--color-border);transition:all .2s ease}.search-header[_ngcontent-%COMP%] .search-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary);flex-shrink:0}.search-header[_ngcontent-%COMP%] .search-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent;color:var(--color-text);font-size:.9rem;padding:0;min-width:0}.search-header[_ngcontent-%COMP%] .search-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-muted)}.search-header[_ngcontent-%COMP%] .close-search-btn[_ngcontent-%COMP%]{flex-shrink:0}.search-header[_ngcontent-%COMP%] .close-search-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}.section-content[_ngcontent-%COMP%]{padding:.5rem 0 0;animation:_ngcontent-%COMP%_slideDown .2s ease;border-bottom:1px solid var(--color-border);display:flex;flex-direction:column}.section-content.threads[_ngcontent-%COMP%]{padding:0;border-bottom:none;flex:1!important;min-height:0!important;overflow:hidden!important}.section-content.threads[_ngcontent-%COMP%] app-thread-selector[_ngcontent-%COMP%]{flex:1!important;min-height:0!important;overflow:hidden!important;display:flex!important;flex-direction:column!important}@keyframes _ngcontent-%COMP%_slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.config-links[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem;padding:.5rem 1rem;margin-bottom:1rem}.sidenav-item[_ngcontent-%COMP%]{width:100%}.sidenav-item[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px;color:var(--color-text-secondary)}.sidenav-item[_ngcontent-%COMP%] .item-text[_ngcontent-%COMP%]{flex:1;font-size:.9rem}.sidenav-item[_ngcontent-%COMP%] .disabled-hint[_ngcontent-%COMP%]{font-size:.7rem;color:var(--color-text-secondary);font-style:italic}.sidenav-link.disabled[_ngcontent-%COMP%]{opacity:.5;cursor:not-allowed;color:var(--color-text-secondary)}.sidenav-link.disabled[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%]{color:var(--color-text-secondary)}.sidenav-link[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%], .sidenav-link[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;color:var(--color-primary)}.sidenav-link[_ngcontent-%COMP%] .item-text[_ngcontent-%COMP%]{font-size:.875rem}.preference-item[_ngcontent-%COMP%]{padding-bottom:1rem;margin-bottom:1rem;border-bottom:1px solid var(--color-border)}.preference-item[_ngcontent-%COMP%]:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.75rem;margin-bottom:.75rem;padding:0 1rem}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%] .item-icon[_ngcontent-%COMP%]{font-size:20px;width:20px;height:20px}.preference-item[_ngcontent-%COMP%] .preference-header[_ngcontent-%COMP%] .item-text[_ngcontent-%COMP%]{font-size:.875rem;font-weight:500;color:var(--color-text)}.preference-item[_ngcontent-%COMP%] .preference-content[_ngcontent-%COMP%]{padding:0 1rem}.error-notification[_ngcontent-%COMP%]{position:fixed;top:5rem;left:50%;transform:translate(-50%);z-index:2000;display:flex;align-items:center;gap:.75rem;background:#ff3b3026;backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid rgba(255,59,48,.3);border-radius:16px;padding:1rem 1.5rem;box-shadow:var(--glass-shadow);animation:_ngcontent-%COMP%_errorSlideDown .3s cubic-bezier(.4,0,.2,1)}.error-notification[_ngcontent-%COMP%] .error-icon[_ngcontent-%COMP%]{font-size:1.2rem;flex-shrink:0;color:#c00}.error-notification[_ngcontent-%COMP%] .error-text[_ngcontent-%COMP%]{flex:1;color:#c00;font-size:.9rem;font-weight:500}@keyframes _ngcontent-%COMP%_errorSlideDown{0%{opacity:0;transform:translate(-50%,-10px)}to{opacity:1;transform:translate(-50%)}}@media(max-width:480px){.app-sidenav[_ngcontent-%COMP%]{width:320px}.sidenav-toggle-btn[_ngcontent-%COMP%]{top:.75rem!important;left:.75rem!important}.sidenav-new-thread-btn[_ngcontent-%COMP%]{top:calc(1.25rem + 40px)!important;left:.75rem!important}.error-notification[_ngcontent-%COMP%]{left:1rem;right:1rem;transform:none;max-width:calc(100vw - 2rem)}}body.dark[_nghost-%COMP%] .app-sidenav[_ngcontent-%COMP%], body.dark [_nghost-%COMP%] .app-sidenav[_ngcontent-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .app-sidenav[_ngcontent-%COMP%]{background:#242830f2;border-right-color:#b4c8ff17}body.dark[_nghost-%COMP%] .sidenav-header[_ngcontent-%COMP%], body.dark [_nghost-%COMP%] .sidenav-header[_ngcontent-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .sidenav-header[_ngcontent-%COMP%]{background:#242830b3}"]})};var ia=class i{destroy$=new J;isSetup=!1;codayService=f(mt);preferencesService=f(Pe);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(D(this.destroy$),ba(),ve(([e,t])=>e===!0&&t===!1)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled()}),this.preferencesService.browserNotificationEnabled$.pipe(D(this.destroy$),ba(),ve(([e,t])=>e===!1&&t===!0)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled()}),this.isSetup=!0}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification())}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),n=e.createGain();t.connect(n),n.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),n.gain.setValueAtTime(.1,e.currentTime),n.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let r=e.createOscillator(),o=e.createGain();r.connect(o),o.connect(e.destination);let a=e.currentTime+.11;r.frequency.setValueAtTime(950,a),o.gain.setValueAtTime(.1,a),o.gain.exponentialRampToValueAtTime(.01,a+.09),r.start(a),r.stop(a+.09),console.log("[AGENT-NOTIFICATION] Completion sound played")}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e)}}handleBrowserNotificationEnabled(){return B(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1))}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(!1)}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification")}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:!1});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close()},console.log("[AGENT-NOTIFICATION] Confirmation notification sent")}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:!1});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close()},console.log("[AGENT-NOTIFICATION] Task complete notification sent")}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete()}static \u0275fac=function(t){return new(t||i)};static \u0275prov=H({token:i,factory:i.\u0275fac,providedIn:"root"})};var U0=["inputSection"];function W0(i,e){if(i&1){let t=O();l(0,"app-thread",4),v("chatFocused",function(){x(t);let r=h();return w(r.onChatFocusedOnMobile())})("drawerStateChange",function(r){x(t);let o=h();return w(o.onDrawerStateChange(r))}),c()}if(i&2){let t=h();T("projectName",t.projectName)("threadId",t.threadId)}}function q0(i,e){if(i&1){let t=O();l(0,"div",5),F(1,"app-welcome-message"),c(),l(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),v("messageSubmitted",function(r){x(t);let o=h();return w(o.onMessageSubmitted(r))})("voiceRecordingToggled",function(r){x(t);let o=h();return w(o.onVoiceToggled(r))})("heightChanged",function(r){x(t);let o=h();return w(o.onInputHeightChanged(r))})("textareaFocused",function(){x(t);let r=h();return w(r.onChatFocusedOnMobile())}),c()()()()}if(i&2){let t=h();p(6),T("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",!0)("isThinking",!1)("isStarting",t.isStartingFirstMessage)}}var _r=class i{destroy$=new J;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=!1;isStartingFirstMessage=!1;inputSectionHeight=80;codayService=f(mt);titleService=f(Fi);preferencesService=f(Pe);route=f(jr);router=f(zt);threadApiService=f(Yt);agentNotificationService=f(ia);firstMessageState=f(Li);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)")}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(D(this.destroy$)).subscribe(e=>{let t=e.projectName,n=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:n,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=n,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView())})}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService)}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint)}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=!0,this.isStartingFirstMessage=!0,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id])},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=!1,this.isStartingFirstMessage=!1,alert("Failed to create conversation: "+(t.message||"Unknown error"))}})}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e)}isDrawerOpen=!1;onDrawerStateChange(e){this.isDrawerOpen=e}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close()}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e)}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint)}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical")};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical")};static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-main"]],viewQuery:function(t,n){if(t&1&&Be(U0,5)(fr,5),t&2){let r;ge(r=fe())&&(n.inputSection=r.first),ge(r=fe())&&(n.sidenav=r.first)}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,n){t&1&&(l(0,"app-sidenav",1)(1,"div",2),v("mousedown",function(){return n.onChatFocusedOnMobile()})("touchstart",function(){return n.onChatFocusedOnMobile()}),C(2,W0,1,2,"app-thread",3)(3,q0,7,5),c()()),t&2&&(T("drawerOpen",n.isDrawerOpen),p(2),S(n.threadId?2:3))},dependencies:[yi,Zo,ea,fr],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[Ia("slideIn",[Xr(":enter",[_n({transform:"translateY(100%)",opacity:0}),Kr("300ms ease-out",_n({transform:"translateY(0)",opacity:1}))]),Xr(":leave",[Kr("200ms ease-in",_n({transform:"translateY(100%)",opacity:0}))])])]}})};var Vi=i=>B(null,null,function*(){let e=f(ye),t=i.params.projectName;return t?e.getSelectedProjectId()===t?!0:(e.selectProject(t),(yield rl(e.selectedProject$.pipe(ll(r=>r?.name===t))))?.name===t):(console.log("[PROJECT GUARD] no project id in route"),!1)});var Pp=i=>B(null,null,function*(){let e=f(Ye),t=f(Qt),n=i.params.threadId;if(!t.getUsername())try{yield ga(t.fetchCurrentUser())}catch(r){console.error("[THREAD GUARD] Failed to load current user:",r)}if(!n)return console.log("[THREAD GUARD] no threadId in route"),!1;if(console.log("[THREAD GUARD] Checking thread:",n),console.log("[THREAD GUARD] Current selected thread:",e.getSelectedThreadId()),e.getSelectedThreadId()===n)return console.log("[THREAD GUARD] Thread already selected, allowing navigation"),!0;console.log("[THREAD GUARD] Selecting thread:",n),e.selectThread(n);try{let r=yield ga(Pn([e.isLoading$,e.selectedThread$]).pipe(gt(([a,s])=>console.log(`\u{1F43C} [${a?"loading":"loaded"}]`,s?.id)),ve(([a,s])=>!a&&!!s),ti(1),Ae(([a,s])=>s?.id))),o=r===n;return o?console.log("[THREAD GUARD] Thread validated, allowing navigation"):console.error("[THREAD GUARD] Thread ID mismatch - route:",n,"loaded:",r),o}catch(r){return console.error("[THREAD GUARD] Error loading thread:",r),!1}});var Op=[{path:"",component:yo},{path:"oauth/callback",component:Fo},{path:"project/new",loadComponent:()=>import("./chunk-4LFZBXC3.js").then(i=>i.ProjectNewComponent)},{path:"project/:projectName",component:_r,canActivate:[Vi]},{path:"project/:projectName/prompts",loadComponent:()=>import("./chunk-4OMSGXSL.js").then(i=>i.PromptListComponent),canActivate:[Vi]},{path:"project/:projectName/schedulers",loadComponent:()=>import("./chunk-GT5UFSUE.js").then(i=>i.SchedulerListComponent),canActivate:[Vi]},{path:"project/:projectName/agents",loadComponent:()=>import("./chunk-LVEC3TBP.js").then(i=>i.AgentListComponent),canActivate:[Vi]},{path:"project/:projectName/thread/:threadId",component:_r,canActivate:[Vi,Pp]},{path:"token-usage",loadComponent:()=>import("./chunk-JPWWZVYZ.js").then(i=>i.TokenUsageComponent)},{path:"agentos",loadChildren:()=>import("./chunk-IHHVFGPF.js").then(i=>i.AGENTOS_ROUTES)},{path:"**",redirectTo:""}];function G0(i){return()=>i.initializeDefaultProject()}function Y0(i){return()=>{console.log("[APP_INIT] OAuthService initialized")}}var Ap={providers:[ml(),Sl({eventCoalescing:!0}),kl(Op),El(),dd(),dl(Ul),{provide:wa,useFactory:G0,deps:[ye],multi:!0},{provide:wa,useFactory:Y0,deps:[Sn],multi:!0},Gl({basePath:"/api/agentos"}),{provide:Wl,useValue:{width:"80vw",maxWidth:"80vw",maxHeight:"80vh"}}]};var ra=class i{title="client";themeService=f(ji);ngOnInit(){console.log("[APP] Application initialized with theme:",this.themeService.getCurrentTheme())}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=I({type:i,selectors:[["app-root"]],decls:1,vars:0,template:function(t,n){t&1&&F(0,"router-outlet")},dependencies:[Pl,Ml],encapsulation:2})};Tl(ra,Ap).catch(i=>console.error(i));