@whoz-oss/coday-client 0.105.2 → 0.106.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 (36) hide show
  1. package/3rdpartylicenses.txt +54 -54
  2. package/browser/{chunk-EXY553SF.js → chunk-3PVFIAUA.js} +1 -1
  3. package/browser/chunk-72E52DQZ.js +1 -0
  4. package/browser/chunk-C3Z2US2O.js +10 -0
  5. package/browser/{chunk-DWPCHLTZ.js → chunk-CU22OKFA.js} +1 -1
  6. package/browser/{chunk-HB5BQ64I.js → chunk-CZNMHINV.js} +1 -1
  7. package/browser/{chunk-Z7D32IIN.js → chunk-DXAC6PBI.js} +1 -1
  8. package/browser/{chunk-6ZVZINLP.js → chunk-EB2MQYHX.js} +1 -1
  9. package/browser/{chunk-YX7RR3OI.js → chunk-HCHRX4T2.js} +1 -1
  10. package/browser/chunk-M6X4JBRR.js +1 -0
  11. package/browser/{chunk-LBCXFVPY.js → chunk-MA7BXHNI.js} +1 -1
  12. package/browser/{chunk-UPXODNKN.js → chunk-PGN4ECZ3.js} +1 -1
  13. package/browser/chunk-QBUG7HYV.js +2 -0
  14. package/browser/chunk-R3H5L5BX.js +8 -0
  15. package/browser/chunk-SMZHBYR4.js +1 -0
  16. package/browser/{chunk-TMYMW2LL.js → chunk-TNIXUUL6.js} +1 -1
  17. package/browser/chunk-UCVH2ZFY.js +1 -0
  18. package/browser/chunk-UXESU5SF.js +8 -0
  19. package/browser/chunk-XC7VSAB4.js +1 -0
  20. package/browser/{chunk-DYTHVKS2.js → chunk-XFS66C5L.js} +4 -4
  21. package/browser/chunk-XNC54NBM.js +1 -0
  22. package/browser/{chunk-GC5WCXGB.js → chunk-YFNWGEM7.js} +1 -1
  23. package/browser/chunk-YTWQL6XR.js +1 -0
  24. package/browser/index.html +2 -2
  25. package/browser/main-KNTWYTSV.js +365 -0
  26. package/browser/styles-QZI2VRZO.css +1 -0
  27. package/package.json +1 -1
  28. package/browser/chunk-3YYVZC5L.js +0 -1
  29. package/browser/chunk-AGNVVQN3.js +0 -1
  30. package/browser/chunk-FXQT2NYX.js +0 -10
  31. package/browser/chunk-HEJTD7WZ.js +0 -1
  32. package/browser/chunk-OHWL3KSR.js +0 -1
  33. package/browser/chunk-SZ6SW4SW.js +0 -1
  34. package/browser/chunk-VH2SHG5S.js +0 -1
  35. package/browser/main-6VRGJA5G.js +0 -377
  36. package/browser/styles-PNPFZS3U.css +0 -1
@@ -1 +1 @@
1
- import{b as ue}from"./chunk-6ZVZINLP.js";import{c as he,g as fe,k as be,r as ve,s as xe,t as ye,y as Ce}from"./chunk-TMYMW2LL.js";import{a as _e}from"./chunk-UPXODNKN.js";import{$a as k,Aa as L,Da as Q,Fb as y,Hb as w,Ib as j,Mb as p,Na as b,Oa as se,P as H,Pa as v,Qa as x,T,Ta as N,Ua as U,Va as S,Wa as s,X as $,Xa as r,Y as V,Ya as Z,Z as O,Za as m,_ as ae,_a as _,a as R,b as A,ba as re,bb as de,cc as D,db as P,eb as ce,fa as h,fb as g,ic as ee,kc as pe,pc as ge,qa as le,qb as me,s as ie,sa as l,tb as i,ub as c,vb as E}from"./chunk-DYTHVKS2.js";var Ie=(o,t)=>t.date,Be=(o,t)=>t.x,Fe=(o,t)=>t.label;function Re(o,t){o&1&&(m(0,"div",0),i(1,"No daily data points for this period."),_())}function Ae(o,t){if(o&1&&(O(),k(0,"rect",18)),o&2){let e=g().$implicit,n=g(2);b("x",e.w+6)("y",n.yBase-e.tokensStubH)("width",e.w)("height",e.tokensStubH)}}function He(o,t){if(o&1&&(O(),k(0,"rect",19)(1,"rect",20)),o&2){let e=g().$implicit,n=g(2);b("x",e.w+6)("y",n.yBase-(e.promptH??0))("width",e.w)("height",e.promptH??0),l(),b("x",e.w+6)("y",n.yBase-((e.promptH??0)+(e.completionH??0)))("width",e.w)("height",e.completionH??0)}}function $e(o,t){if(o&1){let e=de();O(),m(0,"g",15),ce("mouseenter",function(a){let d=$(e).$implicit,u=g(2);return V(u.showTooltip(a,d.point))})("mousemove",function(a){let d=$(e).$implicit,u=g(2);return V(u.showTooltip(a,d.point))})("mouseleave",function(){$(e);let a=g(2);return V(a.hideTooltip())}),k(1,"rect",16)(2,"rect",17),v(3,Ae,1,4,":svg:rect",18)(4,He,2,8),_()}if(o&2){let e=t.$implicit,n=g(2);b("transform","translate("+e.xGroup+",0)"),l(),b("y",n.yTop)("width",e.groupW)("height",n.yBase-n.yTop),l(),b("y",n.yBase-e.costH)("width",e.w)("height",e.costH),l(),x(e.tokensStubH!==null?3:4)}}function Ve(o,t){if(o&1&&(O(),m(0,"text",5),i(1),_()),o&2){let e=t.$implicit,n=g(2);b("x",e.x)("y",n.yAxis),l(),c(e.label)}}function Le(o,t){if(o&1&&(m(0,"div",24),i(1),_(),m(2,"div",25),i(3),_()),o&2){let e=t.$implicit;l(),c(e.label),l(2),c(e.value)}}function je(o,t){if(o&1&&(m(0,"div",21)(1,"div",22),i(2),_(),m(3,"div",23),N(4,Le,4,2,null,null,Fe),_()()),o&2){let e=g(2);me("left",e.tooltip().x+12,"px")("top",e.tooltip().y+12,"px"),l(2),c(e.tooltip().data.date),l(2),U(e.tooltipLines())}}function Ge(o,t){if(o&1&&(m(0,"div",8)(1,"span",10),i(2),_()()),o&2){let e=g(2);l(2),c(e.tokenCoverageLabel())}}function Ye(o,t){if(o&1&&(m(0,"div",1),O(),m(1,"svg",2),k(2,"line",3)(3,"line",3),N(4,$e,5,8,":svg:g",4,Ie),N(6,Ve,2,3,":svg:text",5,Be),_(),v(8,je,6,5,"div",6),ae(),m(9,"div",7)(10,"div",8),k(11,"span",9),m(12,"span",10),i(13,"Cost (per day)"),_(),m(14,"span",11),i(15),_()(),m(16,"div",8),k(17,"span",12),m(18,"span",10),i(19,"Prompt tokens"),_()(),m(20,"div",8),k(21,"span",13),m(22,"span",10),i(23,"Completion tokens"),_()(),m(24,"div",8),k(25,"span",14),m(26,"span",10),i(27,"Tokens missing"),_()(),m(28,"div",8)(29,"span",10),i(30,"Tokens scale"),_(),m(31,"span",11),i(32),_()(),v(33,Ge,3,1,"div",8),_()()),o&2){let e=g();l(),b("viewBox",e.viewBox),l(),b("y1",e.yTop)("x2",720)("y2",e.yTop),l(),b("y1",e.yBase)("x2",720)("y2",e.yBase),l(),U(e.bars()),l(2),U(e.axisLabels()),l(2),x(e.tooltip().visible&&e.tooltip().data?8:-1),l(7),E("max ",e.maxCostLabel()),l(17),E("max ",e.maxTokensLabel()),l(),x(e.tokenCoverageLabel()?33:-1)}}var G=class o{points=[];width=720;height=240;paddingX=12;paddingY=16;bottomAxisH=48;viewBox=`0 0 ${this.width} ${this.height}`;innerW=this.width-this.paddingX*2;innerH=this.height-this.paddingY*2-this.bottomAxisH;barGap=6;groupGap=14;safePoints=p(()=>(this.points??[]).filter(t=>!!t.date));maxCost=p(()=>Math.max(0,...this.safePoints().map(t=>t.cost??0)));maxTokens=p(()=>{let t=this.safePoints().map(e=>{let n=e.promptTokens??null,a=e.completionTokens??null;return n===null&&a===null?null:(n??0)+(a??0)}).filter(e=>e!==null);return Math.max(0,...t)});tokenCoverageLabel=p(()=>{let t=this.safePoints();return t.length===0?"":`Tokens available for ${t.filter(n=>n.promptTokens!==null||n.completionTokens!==null).length}/${t.length} days`});maxCostLabel=p(()=>"$"+(new D("en-US").transform(this.maxCost(),"1.2-2")??"0.00"));maxTokensLabel=p(()=>new D("en-US").transform(this.maxTokens(),"1.0-2")??"0");tooltip=h({visible:!1,x:0,y:0,data:null});toTooltipData(t){let e=t.promptTokens,n=t.completionTokens,a=e===null&&n===null?null:(e??0)+(n??0);return{date:t.date,cost:t.cost??0,promptTokens:e,completionTokens:n,totalTokens:a,callCount:t.callCount??0}}showTooltip(t,e){let a=t.currentTarget?.closest(".chart")?.getBoundingClientRect(),d=a?t.clientX-a.left:t.clientX,u=a?t.clientY-a.top:t.clientY,f=320,M=170,I=12,C=a?Math.max(0,a.width-f-I):d,B=a?Math.max(0,a.height-M-I):u,F=a?Math.min(Math.max(0,d),C):d,te=a?Math.min(Math.max(0,u),B):u;this.tooltip.set({visible:!0,x:F,y:te,data:this.toTooltipData(e)})}hideTooltip(){this.tooltip.update(t=>A(R({},t),{visible:!1}))}formatTokens(t){return t===null?"\u2014":new D("en-US").transform(t,"1.0-2")??"0"}formatCost(t){return"$"+(new D("en-US").transform(t??0,"1.2-2")??"0.00")}tooltipLines=p(()=>{let t=this.tooltip(),e=t.data;return!t.visible||!e?[]:[{label:"Cost",value:this.formatCost(e.cost)},{label:"Prompt tokens",value:this.formatTokens(e.promptTokens)},{label:"Completion tokens",value:this.formatTokens(e.completionTokens)},{label:"Total tokens",value:this.formatTokens(e.totalTokens)},{label:"Calls",value:`${e.callCount}`}]});bars=p(()=>{let t=this.safePoints(),e=t.length;if(e===0)return[];let n=(this.innerW-(e-1)*this.groupGap)/e,a=Math.max(2,n),d=(a-this.barGap)/2,u=Math.max(1,d),f=this.maxCost()||1,M=this.maxTokens()||1,I=45;return t.map((C,B)=>{let F=this.paddingX+B*(a+this.groupGap),we=(C.cost??0)/f*this.innerH,ne=C.promptTokens,oe=C.completionTokens,K=ne!==null||oe!==null,De=ne??0,Ee=oe??0,Oe=K?De/M*this.innerH:null,Ne=K?Ee/M*this.innerH:null;return{date:C.date,point:C,xGroup:F,groupW:a,xCost:F,w:u,costH:we,xTokens:F+u+this.barGap,promptH:Oe,completionH:Ne,tokensStubH:K?null:I}})});axisLabels=p(()=>{let t=this.safePoints(),e=t.length;if(e===0)return[];let a=Math.max(1,Math.ceil(e/8)),d=(this.innerW-(e-1)*this.groupGap)/e,u=Math.max(2,d);return t.map((f,M)=>({p:f,i:M})).filter(({i:f})=>f%a===0||f===e-1).map(({p:f,i:M})=>{let C=this.paddingX+M*(u+this.groupGap)+u/2,B=f.date.slice(5);return{x:C,label:B}})});yTop=this.paddingY;yBase=this.paddingY+this.innerH;yAxis=this.yBase+28;static \u0275fac=function(e){return new(e||o)};static \u0275cmp=L({type:o,selectors:[["app-daily-series-chart"]],inputs:{points:"points"},decls:2,vars:1,consts:[[1,"muted"],[1,"chart"],["preserveAspectRatio","none","role","img","aria-label","Daily token and cost usage",1,"chart__svg"],["x1","0",1,"chart__grid"],[1,"chart__day"],["text-anchor","middle",1,"chart__axis-label"],[1,"chart__tooltip",3,"left","top"],[1,"chart__legend"],[1,"chart__legend-item"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--cost"],[1,"chart__legend-label"],[1,"chart__legend-value"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--prompt"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--completion"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--tokens-missing"],[1,"chart__day",3,"mouseenter","mousemove","mouseleave"],["x","0",1,"chart__hover"],["x","0",1,"chart__bar","chart__bar--cost"],[1,"chart__bar","chart__bar--tokens-missing"],[1,"chart__bar","chart__bar--prompt"],[1,"chart__bar","chart__bar--completion"],[1,"chart__tooltip"],[1,"chart__tooltip-title"],[1,"chart__tooltip-grid"],[1,"chart__tooltip-label"],[1,"chart__tooltip-value"]],template:function(e,n){e&1&&v(0,Re,2,0,"div",0)(1,Ye,34,11,"div",1),e&2&&x(n.safePoints().length===0?0:1)},styles:[".chart[_ngcontent-%COMP%]{display:grid;gap:.5rem;position:relative}.chart__svg[_ngcontent-%COMP%]{width:100%;height:260px;display:block;border-radius:12px;background:var(--color-bg-secondary, rgba(255, 255, 255, .72));border:1px solid var(--color-border-light, rgba(0, 0, 0, .08))}.chart__grid[_ngcontent-%COMP%]{stroke:var(--color-border-light, rgba(0, 0, 0, .08));stroke-width:1}.chart__day[_ngcontent-%COMP%]{cursor:default}.chart__hover[_ngcontent-%COMP%]{fill:transparent}.chart__day[_ngcontent-%COMP%]:hover .chart__hover[_ngcontent-%COMP%]{fill:var(--color-bg-hover, rgba(0, 0, 0, .03))}.chart__tooltip[_ngcontent-%COMP%]{position:absolute;z-index:2;min-width:220px;max-width:320px;padding:10px 12px;border-radius:12px;background:rgb(var(--color-bg-secondary-rgb, 255 255 255)/1);border:1px solid var(--color-border-light, rgba(0, 0, 0, .08));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .12));pointer-events:none}.chart__tooltip-title[_ngcontent-%COMP%]{font-weight:650;margin-bottom:6px}.chart__tooltip-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr auto;column-gap:10px;row-gap:4px}.chart__tooltip-label[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.85rem}.chart__tooltip-value[_ngcontent-%COMP%]{font-variant-numeric:tabular-nums;text-align:right}.chart__bar[_ngcontent-%COMP%]{shape-rendering:geometricPrecision;rx:2;ry:2}.chart__bar--cost[_ngcontent-%COMP%]{fill:var(--color-primary, #007aff);opacity:.85}.chart__bar--prompt[_ngcontent-%COMP%]{fill:var(--color-success, #34c759);opacity:.85}.chart__bar--completion[_ngcontent-%COMP%]{fill:var(--color-warning, #ff9500);opacity:.85}.chart__bar--tokens-missing[_ngcontent-%COMP%]{fill:transparent;stroke:var(--color-text-secondary, rgba(29, 29, 31, .55));stroke-width:1.5;stroke-dasharray:4 3}.chart__axis-label[_ngcontent-%COMP%]{fill:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:12px;font-variant-numeric:tabular-nums}.chart__legend[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:.75rem;flex-wrap:wrap}.chart__legend-item[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:baseline}.chart__legend-swatch[_ngcontent-%COMP%]{width:10px;height:10px;border-radius:3px;align-self:center}.chart__legend-swatch--cost[_ngcontent-%COMP%]{background:var(--color-primary, #007aff)}.chart__legend-swatch--prompt[_ngcontent-%COMP%]{background:var(--color-success, #34c759)}.chart__legend-swatch--completion[_ngcontent-%COMP%]{background:var(--color-warning, #ff9500)}.chart__legend-swatch--tokens-missing[_ngcontent-%COMP%]{background:transparent;border:1px dashed var(--color-text-secondary, rgba(29, 29, 31, .55))}.chart__legend-label[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.85rem}.chart__legend-value[_ngcontent-%COMP%]{font-variant-numeric:tabular-nums}.muted[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7))}"],changeDetection:0})};var z=class o{http=T(pe);getTokenUsage(t){let e=new ee;return t.from&&(e=e.set("from",t.from)),t.to&&(e=e.set("to",t.to)),this.http.get("/api/token-usage",{params:e})}getTokenUsageSeries(t){let e=new ee;return t.from&&(e=e.set("from",t.from)),t.to&&(e=e.set("to",t.to)),this.http.get("/api/token-usage/series",{params:e})}static \u0275fac=function(e){return new(e||o)};static \u0275prov=H({token:o,factory:o.\u0275fac,providedIn:"root"})};function Te(o){return`${o}`.padStart(2,"0")}function ke(o){return`${o.getUTCFullYear()}-${Te(o.getUTCMonth()+1)}-${Te(o.getUTCDate())}`}function ze(o=new Date){return new Date(Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),1))}function We(o=new Date){return new Date(Date.UTC(o.getUTCFullYear(),o.getUTCMonth()+1,1))}var W=class o{api=T(z);destroyRef=T(re);defaultFrom=ke(ze());defaultTo=ke(We());draftFilters=h({from:this.defaultFrom,to:this.defaultTo});appliedFilters=h({from:this.defaultFrom,to:this.defaultTo});loading=h(!1);error=h(null);aggregation=h(null);seriesResponse=h(null);series=h(null);tokenDataPartial=h(!1);aggregationByModelId=h(null);seriesByModelId=h(null);init(){this.reload()}setDraftFrom(t){this.draftFilters.update(e=>A(R({},e),{from:t}))}setDraftTo(t){this.draftFilters.update(e=>A(R({},e),{to:t}))}clearDraftFrom(){this.setDraftFrom(null)}clearDraftTo(){this.setDraftTo(null)}apply(){this.appliedFilters.set(this.draftFilters()),this.reload()}addNullableTokens(t,e){return t===null&&e===null?null:(t??0)+(e??0)}aggregateByModelId(t){let e=new Map;for(let n of t){let a=n.modelId,d=e.get(a);d?(d.promptTokens=this.addNullableTokens(d.promptTokens,n.promptTokens),d.completionTokens=this.addNullableTokens(d.completionTokens,n.completionTokens),d.totalTokens=this.addNullableTokens(d.totalTokens,n.totalTokens),d.callCount+=n.callCount??0,d.cost=(d.cost??0)+(n.cost??0)):e.set(a,{agentName:"All agents",providerName:"all",modelId:n.modelId,promptTokens:n.promptTokens,completionTokens:n.completionTokens,totalTokens:n.totalTokens,callCount:n.callCount??0,cost:n.cost??0})}return[...e.values()].sort((n,a)=>(a.totalTokens??0)-(n.totalTokens??0))}aggregateSeriesByModelId(t){let e=new Map;for(let n of t){let a=`${n.date}|${n.modelId}`,d=e.get(a);d?(d.promptTokens=this.addNullableTokens(d.promptTokens,n.promptTokens),d.completionTokens=this.addNullableTokens(d.completionTokens,n.completionTokens),d.totalTokens=this.addNullableTokens(d.totalTokens,n.totalTokens),d.callCount+=n.callCount??0,d.cost=(d.cost??0)+(n.cost??0)):e.set(a,{date:n.date,agentName:"All agents",providerName:"all",modelId:n.modelId,promptTokens:n.promptTokens,completionTokens:n.completionTokens,totalTokens:n.totalTokens,callCount:n.callCount??0,cost:n.cost??0})}return[...e.values()].sort((n,a)=>n.date<a.date?-1:1)}reload(){let{from:t,to:e}=this.appliedFilters();this.loading.set(!0),this.error.set(null),ie({aggregation:this.api.getTokenUsage({from:t,to:e}),series:this.api.getTokenUsageSeries({from:t,to:e})}).pipe(_e(this.destroyRef)).subscribe({next:({aggregation:n,series:a})=>{this.aggregation.set(n),this.seriesResponse.set(a);let d=a.points??[];this.series.set(d),this.tokenDataPartial.set(n.tokenDataPartial||a.tokenDataPartial);let u=this.aggregateByModelId(n.models??[]);this.aggregationByModelId.set(u),this.seriesByModelId.set(this.aggregateSeriesByModelId(d)),this.loading.set(!1)},error:n=>{this.loading.set(!1),this.aggregation.set(null),this.seriesResponse.set(null),this.series.set(null),this.tokenDataPartial.set(!1),this.aggregationByModelId.set(null),this.seriesByModelId.set(null),this.error.set(n instanceof Error?n.message:"Failed to load token usage")}})}static \u0275fac=function(e){return new(e||o)};static \u0275prov=H({token:o,factory:o.\u0275fac,providedIn:"root"})};var X=function(){throw new Error("DON'T USE this INSIDE A FUNCTION CALLED BY | call OR | apply IT MUST BE A PURE FUNCTION!")},Me=typeof Proxy!="function"?Object.seal({}):new Proxy({},{get:X,set:X,deleteProperty:X,has:X}),J=class o{transform(t,e){if(typeof e!="function")throw new TypeError("You must pass a PURE function to | call");return e?.call(Me,t)}static \u0275fac=function(e){return new(e||o)};static \u0275pipe=Q({name:"call",type:o,pure:!0})},q=class o{transform(t,...e){if(typeof t!="function")throw new TypeError("You must use | apply on a PURE function");return t.apply(Me,e)}static \u0275fac=function(e){return new(e||o)};static \u0275pipe=Q({name:"apply",type:o,pure:!0})};function Xe(o,t){o&1&&(s(0,"div",24),i(1," Partial data \u2014 token counts may not cover the full period "),r())}function Je(o,t){o&1&&(s(0,"div",25),i(1," No token data collected for this period "),r())}function qe(o,t){if(o&1&&(s(0,"div",20)(1,"div",21)(2,"div",22),i(3,"Total tokens"),r(),s(4,"div",23),i(5),y(6,"call"),r()(),s(7,"div",21)(8,"div",22),i(9,"Total calls"),r(),s(10,"div",23),i(11),r()(),s(12,"div",21)(13,"div",22),i(14,"Total cost"),r(),s(15,"div",23),i(16),y(17,"apply"),r()()(),v(18,Xe,2,0,"div",24),v(19,Je,2,0,"div",25)),o&2){let e=g();l(5),c(w(6,5,e.totalRow().totalTokens,e.formatTokenValue)),l(6),c(e.totalRow().callCount),l(5),c(j(17,8,e.formatCostValue,e.isMissingPeriod(),e.totalRow().cost)),l(2),x(e.isPartialPeriod()?18:-1),l(),x(e.isMissingPeriod()?19:-1)}}function Ke(o,t){o&1&&(s(0,"div",17)(1,"div",26),i(2,"Loading token usage\u2026"),r()())}function Qe(o,t){if(o&1&&(s(0,"div",18)(1,"div",27),i(2,"Failed to load"),r(),s(3,"div",26),i(4),r()()),o&2){let e=g();l(4),c(e.state.error())}}function Ze(o,t){o&1&&(s(0,"div",17)(1,"div",27),i(2,"No data"),r(),s(3,"div",26),i(4,"No token usage recorded yet for this period."),r()())}function et(o,t){if(o&1&&(s(0,"div",33)(1,"div",30),i(2),r(),s(3,"div",30),i(4),r(),s(5,"div",30),i(6),r(),s(7,"div",31),i(8),y(9,"call"),r(),s(10,"div",31),i(11),y(12,"call"),r(),s(13,"div",31),i(14),y(15,"call"),r(),s(16,"div",31),i(17),r(),s(18,"div",31),i(19),y(20,"apply"),r()()),o&2){let e=t.$implicit,n=g(2);l(2),c(e.agentName),l(2),c(e.providerName),l(2),c(e.modelId),l(2),c(w(9,8,e.promptTokens,n.formatTokenValue)),l(3),c(w(12,11,e.completionTokens,n.formatTokenValue)),l(3),c(w(15,14,e.totalTokens,n.formatTokenValue)),l(3),c(e.callCount),l(2),E(" ",j(20,17,n.formatCostValue,n.isMissingPeriod(),e.cost)," ")}}function tt(o,t){if(o&1&&(s(0,"div",34)(1,"div",30),i(2),r(),s(3,"div",30),i(4),r(),s(5,"div",30),i(6),r(),s(7,"div",31),i(8),y(9,"call"),r(),s(10,"div",31),i(11),y(12,"call"),r(),s(13,"div",31),i(14),y(15,"call"),r(),s(16,"div",31),i(17),r(),s(18,"div",31),i(19),y(20,"apply"),r()()),o&2){let e=g(2);l(2),c(e.totalRow().agentName),l(2),c(e.totalRow().providerName),l(2),c(e.totalRow().modelId),l(2),c(w(9,8,e.totalRow().promptTokens,e.formatTokenValue)),l(3),E(" ",w(12,11,e.totalRow().completionTokens,e.formatTokenValue)," "),l(3),c(w(15,14,e.totalRow().totalTokens,e.formatTokenValue)),l(3),c(e.totalRow().callCount),l(2),E(" ",j(20,17,e.formatCostValue,e.isMissingPeriod(),e.totalRow().cost)," ")}}function nt(o,t){if(o&1&&(s(0,"div",19)(1,"section",17)(2,"div",27),i(3,"Summary"),r(),s(4,"div",28)(5,"div",29)(6,"div",30),i(7,"agentName"),r(),s(8,"div",30),i(9,"providerName"),r(),s(10,"div",30),i(11,"modelId"),r(),s(12,"div",31),i(13,"promptTokens"),r(),s(14,"div",31),i(15,"completionTokens"),r(),s(16,"div",31),i(17,"totalTokens"),r(),s(18,"div",31),i(19,"callCount"),r(),s(20,"div",31),i(21,"cost"),r()(),s(22,"div",32),N(23,et,21,21,"div",33,se().trackRow,!0),v(25,tt,21,21,"div",34),r()()(),s(26,"section",17)(27,"div",27),i(28,"Daily series"),r(),Z(29,"app-daily-series-chart",35),r()()),o&2){let e=g();l(23),U(e.rows()),l(2),x(e.totalRow()?25:-1),l(4),S("points",e.chartPoints())}}var Se="\u2014",Pe=class o{router=T(ge);projectState=T(ue);state=T(W);view=h("byModel");rowsByAgent=p(()=>this.state.aggregation()?.models??[]);totalRow=p(()=>this.state.aggregation()?.total??null);rowsByModel=p(()=>this.state.aggregationByModelId()??[]);chartPointsByAgent=p(()=>{let t=this.state.series()??[];return this.aggregateDailyPoints(t)});chartPointsByModel=p(()=>{let t=this.state.seriesByModelId()??[];return this.aggregateDailyPoints(t)});chartPoints=p(()=>this.view()==="byAgent"?this.chartPointsByAgent():this.chartPointsByModel());rows=p(()=>this.view()==="byAgent"?this.rowsByAgent():this.rowsByModel());isEmpty=p(()=>{let t=this.state.aggregation();return t?(t.models?.length??0)===0&&(t.total?.callCount??0)===0:!1});ngOnInit(){this.state.init()}onFromChange(t){this.state.setDraftFrom(t||null)}onToChange(t){this.state.setDraftTo(t||null)}clearFrom(){this.state.clearDraftFrom()}clearTo(){this.state.clearDraftTo()}apply(){this.state.apply()}aggregateDailyPoints(t){let e=new Map;for(let n of t){let a=e.get(n.date);if(!a)e.set(n.date,{date:n.date,promptTokens:n.promptTokens,completionTokens:n.completionTokens,cost:n.cost??0,callCount:n.callCount??0});else{let d=(u,f)=>u===null&&f===null?null:(u??0)+(f??0);a.promptTokens=d(a.promptTokens,n.promptTokens),a.completionTokens=d(a.completionTokens,n.completionTokens),a.cost=(a.cost??0)+(n.cost??0),a.callCount=(a.callCount??0)+(n.callCount??0)}}return[...e.values()].sort((n,a)=>n.date<a.date?-1:1)}trackRow(t,e){return`${e.agentName}|${e.providerName}|${e.modelId}`}isMissingPeriod=p(()=>{if(this.state.loading())return!1;let t=this.state.aggregation()?.total;return t?t.totalTokens===null&&(t.cost===null||t.cost===void 0):!1});isPartialPeriod=p(()=>!this.isMissingPeriod()&&this.state.tokenDataPartial());navigateBackToProject(){let t=this.projectState.getSelectedProjectId();this.router.navigate(t?["project",t]:["/"])}formatTokenValue(t){return t===null?Se:new D("en-US").transform(t,"1.0-2")??"0"}formatCostValue(t,e){return t?Se:"$"+(new D("en-US").transform(e??0,"1.2-2")??"0.00")}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=L({type:o,selectors:[["app-token-usage"]],decls:40,vars:9,consts:[[1,"page"],[1,"page__header"],[1,"page__title-block"],["type","button","title","Back to project",1,"page__logo-btn",3,"click"],["alt","Coday",1,"page__logo"],[1,"page__title"],[1,"page__subtitle"],[1,"filters"],[1,"filters__field"],[1,"filters__label"],[1,"filters__control"],["type","date",1,"filters__input",3,"ngModelChange","ngModel"],["type","button",1,"filters__clear",3,"click","disabled"],[1,"filters__select",3,"ngModelChange","ngModel"],["value","byModel"],["value","byAgent"],["type","button",1,"filters__apply",3,"click","disabled"],[1,"card"],[1,"card","card--error"],[1,"grid"],[1,"kpis"],[1,"kpi"],[1,"kpi__label"],[1,"kpi__value"],["title","Some calls in this period were recorded before token tracking was enabled. Token counts reflect only the portion where data was collected.",1,"hint"],["title","No token usage data was collected for this period.",1,"hint"],[1,"muted"],[1,"card__title"],[1,"table"],[1,"table__head"],[1,"table__cell"],[1,"table__cell","table__cell--num"],[1,"table__body"],[1,"table__row"],[1,"table__row","table__row--total"],[3,"points"]],template:function(e,n){e&1&&(s(0,"section",0)(1,"header",1)(2,"div",2)(3,"button",3),P("click",function(){return n.navigateBackToProject()}),Z(4,"img",4),r(),s(5,"div")(6,"h1",5),i(7,"Token Usage"),r(),s(8,"p",6),i(9,"Track prompt and completion token usage by agent and model."),r()()(),s(10,"div",7)(11,"label",8)(12,"span",9),i(13,"From"),r(),s(14,"div",10)(15,"input",11),P("ngModelChange",function(d){return n.onFromChange(d)}),r(),s(16,"button",12),P("click",function(){return n.clearFrom()}),i(17," Clear "),r()()(),s(18,"label",8)(19,"span",9),i(20,"To"),r(),s(21,"div",10)(22,"input",11),P("ngModelChange",function(d){return n.onToChange(d)}),r(),s(23,"button",12),P("click",function(){return n.clearTo()}),i(24," Clear "),r()()(),s(25,"label",8)(26,"span",9),i(27,"View"),r(),s(28,"select",13),P("ngModelChange",function(d){return n.view.set(d)}),s(29,"option",14),i(30,"By model"),r(),s(31,"option",15),i(32,"By agent"),r()()(),s(33,"button",16),P("click",function(){return n.apply()}),i(34,"Apply"),r()()(),v(35,qe,20,12),v(36,Ke,3,0,"div",17)(37,Qe,5,1,"div",18)(38,Ze,5,0,"div",17)(39,nt,30,2,"div",19),r()),e&2&&(l(4),b("src","CODAY-Logo.png",le),l(11),S("ngModel",n.state.draftFilters().from),l(),S("disabled",!n.state.draftFilters().from),l(6),S("ngModel",n.state.draftFilters().to),l(),S("disabled",!n.state.draftFilters().to),l(5),S("ngModel",n.view()),l(5),S("disabled",n.state.loading()),l(2),x(n.totalRow()?35:-1),l(),x(n.state.loading()?36:n.state.error()?37:n.isEmpty()?38:39))},dependencies:[Ce,xe,ye,he,ve,fe,be,G,J,q],styles:[".page[_ngcontent-%COMP%]{padding:1.5rem;color:var(--color-text, #1d1d1f)}.page__header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:1.5rem;margin-bottom:1rem}.page__title-block[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.75rem}.page__logo-btn[_ngcontent-%COMP%]{flex:0 0 auto;width:40px;height:40px;padding:0;border-radius:12px;border:1px solid var(--glass-border, rgba(255, 255, 255, .18));background:var(--glass-bg, rgba(255, 255, 255, .72));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .08));cursor:pointer}.page__logo-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .03))}.page__logo[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;padding:6px}.page__title[_ngcontent-%COMP%]{margin:0;font-size:1.25rem;font-weight:650}.page__subtitle[_ngcontent-%COMP%]{margin:.25rem 0 0;color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.95rem}.filters[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:flex-end;gap:.75rem}.filters__field[_ngcontent-%COMP%]{display:grid;gap:.25rem}.filters__label[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7))}.filters__control[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.filters__input[_ngcontent-%COMP%], .filters__select[_ngcontent-%COMP%]{height:34px;padding:0 .5rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-bg-secondary, rgba(255, 255, 255, .72));color:var(--color-text, #1d1d1f)}.filters__apply[_ngcontent-%COMP%], .filters__clear[_ngcontent-%COMP%]{height:34px;padding:0 .75rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-bg-secondary, rgba(255, 255, 255, .72));color:var(--color-text, #1d1d1f);cursor:pointer}.kpis[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.75rem;margin:.75rem 0 1rem}@media (max-width: 900px){.kpis[_ngcontent-%COMP%]{grid-template-columns:1fr}}.kpi[_ngcontent-%COMP%]{border-radius:14px;padding:.75rem 1rem;background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .08))}.kpi__label[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7))}.kpi__value[_ngcontent-%COMP%]{margin-top:.25rem;font-size:1.2rem;font-weight:650;font-variant-numeric:tabular-nums}.filters__apply[_ngcontent-%COMP%]{border-color:var(--color-primary, #007aff);background:var(--color-primary, #007aff);color:var(--color-text-inverse, #ffffff)}.filters__apply[_ngcontent-%COMP%]:disabled, .filters__clear[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed}.grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1.5fr 1fr;gap:1rem;align-items:start}@media (max-width: 1100px){.grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.card[_ngcontent-%COMP%]{border-radius:14px;padding:1rem;background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .08))}.card--error[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.card__title[_ngcontent-%COMP%]{font-weight:650;margin-bottom:.75rem}.muted[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7))}.table[_ngcontent-%COMP%]{overflow-x:auto}.table__head[_ngcontent-%COMP%], .table__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr 2fr 1fr 1fr 1fr .7fr 1fr;gap:.5rem;align-items:center}.table__head[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7));padding:.25rem 0;border-bottom:1px solid var(--color-border-light, rgba(0, 0, 0, .08))}.table__row[_ngcontent-%COMP%]{padding:.5rem 0;border-bottom:1px solid var(--color-border-light, rgba(0, 0, 0, .08))}.table__row--total[_ngcontent-%COMP%]{font-weight:650;background:var(--color-bg-hover, rgba(0, 0, 0, .03));border-radius:10px;padding:.6rem .5rem;border-bottom:none;margin-top:.5rem}.table__cell[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.table__cell--num[_ngcontent-%COMP%]{text-align:right;font-variant-numeric:tabular-nums}.hint[_ngcontent-%COMP%]{margin:.25rem 0 1rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.85rem}"]})};export{Pe as TokenUsageComponent};
1
+ import{b as ue}from"./chunk-EB2MQYHX.js";import{a as _e}from"./chunk-PGN4ECZ3.js";import{c as he,g as fe,k as be,r as ve,s as xe,t as ye,y as Ce}from"./chunk-TNIXUUL6.js";import{$a as m,Ba as L,Ea as Q,Jb as y,Lb as w,Mb as j,P as H,Pa as b,Qa as se,Qb as p,Ra as v,Sa as x,T,Va as N,Wa as U,X as $,Xa as S,Y as V,Ya as s,Z as O,Za as r,_ as ae,_a as Z,a as R,ab as _,b as A,ba as re,bb as k,fa as h,fb as de,gc as D,hb as P,ib as ce,jb as g,mc as ee,oc as pe,qa as le,s as ie,sa as l,tc as ge,ub as me,xb as i,yb as c,zb as E}from"./chunk-XFS66C5L.js";var Ie=(o,t)=>t.date,Be=(o,t)=>t.x,Fe=(o,t)=>t.label;function Re(o,t){o&1&&(m(0,"div",0),i(1,"No daily data points for this period."),_())}function Ae(o,t){if(o&1&&(O(),k(0,"rect",18)),o&2){let e=g().$implicit,n=g(2);b("x",e.w+6)("y",n.yBase-e.tokensStubH)("width",e.w)("height",e.tokensStubH)}}function He(o,t){if(o&1&&(O(),k(0,"rect",19)(1,"rect",20)),o&2){let e=g().$implicit,n=g(2);b("x",e.w+6)("y",n.yBase-(e.promptH??0))("width",e.w)("height",e.promptH??0),l(),b("x",e.w+6)("y",n.yBase-((e.promptH??0)+(e.completionH??0)))("width",e.w)("height",e.completionH??0)}}function $e(o,t){if(o&1){let e=de();O(),m(0,"g",15),ce("mouseenter",function(a){let d=$(e).$implicit,u=g(2);return V(u.showTooltip(a,d.point))})("mousemove",function(a){let d=$(e).$implicit,u=g(2);return V(u.showTooltip(a,d.point))})("mouseleave",function(){$(e);let a=g(2);return V(a.hideTooltip())}),k(1,"rect",16)(2,"rect",17),v(3,Ae,1,4,":svg:rect",18)(4,He,2,8),_()}if(o&2){let e=t.$implicit,n=g(2);b("transform","translate("+e.xGroup+",0)"),l(),b("y",n.yTop)("width",e.groupW)("height",n.yBase-n.yTop),l(),b("y",n.yBase-e.costH)("width",e.w)("height",e.costH),l(),x(e.tokensStubH!==null?3:4)}}function Ve(o,t){if(o&1&&(O(),m(0,"text",5),i(1),_()),o&2){let e=t.$implicit,n=g(2);b("x",e.x)("y",n.yAxis),l(),c(e.label)}}function Le(o,t){if(o&1&&(m(0,"div",24),i(1),_(),m(2,"div",25),i(3),_()),o&2){let e=t.$implicit;l(),c(e.label),l(2),c(e.value)}}function je(o,t){if(o&1&&(m(0,"div",21)(1,"div",22),i(2),_(),m(3,"div",23),N(4,Le,4,2,null,null,Fe),_()()),o&2){let e=g(2);me("left",e.tooltip().x+12,"px")("top",e.tooltip().y+12,"px"),l(2),c(e.tooltip().data.date),l(2),U(e.tooltipLines())}}function Ge(o,t){if(o&1&&(m(0,"div",8)(1,"span",10),i(2),_()()),o&2){let e=g(2);l(2),c(e.tokenCoverageLabel())}}function Ye(o,t){if(o&1&&(m(0,"div",1),O(),m(1,"svg",2),k(2,"line",3)(3,"line",3),N(4,$e,5,8,":svg:g",4,Ie),N(6,Ve,2,3,":svg:text",5,Be),_(),v(8,je,6,5,"div",6),ae(),m(9,"div",7)(10,"div",8),k(11,"span",9),m(12,"span",10),i(13,"Cost (per day)"),_(),m(14,"span",11),i(15),_()(),m(16,"div",8),k(17,"span",12),m(18,"span",10),i(19,"Prompt tokens"),_()(),m(20,"div",8),k(21,"span",13),m(22,"span",10),i(23,"Completion tokens"),_()(),m(24,"div",8),k(25,"span",14),m(26,"span",10),i(27,"Tokens missing"),_()(),m(28,"div",8)(29,"span",10),i(30,"Tokens scale"),_(),m(31,"span",11),i(32),_()(),v(33,Ge,3,1,"div",8),_()()),o&2){let e=g();l(),b("viewBox",e.viewBox),l(),b("y1",e.yTop)("x2",720)("y2",e.yTop),l(),b("y1",e.yBase)("x2",720)("y2",e.yBase),l(),U(e.bars()),l(2),U(e.axisLabels()),l(2),x(e.tooltip().visible&&e.tooltip().data?8:-1),l(7),E("max ",e.maxCostLabel()),l(17),E("max ",e.maxTokensLabel()),l(),x(e.tokenCoverageLabel()?33:-1)}}var G=class o{points=[];width=720;height=240;paddingX=12;paddingY=16;bottomAxisH=48;viewBox=`0 0 ${this.width} ${this.height}`;innerW=this.width-this.paddingX*2;innerH=this.height-this.paddingY*2-this.bottomAxisH;barGap=6;groupGap=14;safePoints=p(()=>(this.points??[]).filter(t=>!!t.date));maxCost=p(()=>Math.max(0,...this.safePoints().map(t=>t.cost??0)));maxTokens=p(()=>{let t=this.safePoints().map(e=>{let n=e.promptTokens??null,a=e.completionTokens??null;return n===null&&a===null?null:(n??0)+(a??0)}).filter(e=>e!==null);return Math.max(0,...t)});tokenCoverageLabel=p(()=>{let t=this.safePoints();return t.length===0?"":`Tokens available for ${t.filter(n=>n.promptTokens!==null||n.completionTokens!==null).length}/${t.length} days`});maxCostLabel=p(()=>"$"+(new D("en-US").transform(this.maxCost(),"1.2-2")??"0.00"));maxTokensLabel=p(()=>new D("en-US").transform(this.maxTokens(),"1.0-2")??"0");tooltip=h({visible:!1,x:0,y:0,data:null});toTooltipData(t){let e=t.promptTokens,n=t.completionTokens,a=e===null&&n===null?null:(e??0)+(n??0);return{date:t.date,cost:t.cost??0,promptTokens:e,completionTokens:n,totalTokens:a,callCount:t.callCount??0}}showTooltip(t,e){let a=t.currentTarget?.closest(".chart")?.getBoundingClientRect(),d=a?t.clientX-a.left:t.clientX,u=a?t.clientY-a.top:t.clientY,f=320,M=170,I=12,C=a?Math.max(0,a.width-f-I):d,B=a?Math.max(0,a.height-M-I):u,F=a?Math.min(Math.max(0,d),C):d,te=a?Math.min(Math.max(0,u),B):u;this.tooltip.set({visible:!0,x:F,y:te,data:this.toTooltipData(e)})}hideTooltip(){this.tooltip.update(t=>A(R({},t),{visible:!1}))}formatTokens(t){return t===null?"\u2014":new D("en-US").transform(t,"1.0-2")??"0"}formatCost(t){return"$"+(new D("en-US").transform(t??0,"1.2-2")??"0.00")}tooltipLines=p(()=>{let t=this.tooltip(),e=t.data;return!t.visible||!e?[]:[{label:"Cost",value:this.formatCost(e.cost)},{label:"Prompt tokens",value:this.formatTokens(e.promptTokens)},{label:"Completion tokens",value:this.formatTokens(e.completionTokens)},{label:"Total tokens",value:this.formatTokens(e.totalTokens)},{label:"Calls",value:`${e.callCount}`}]});bars=p(()=>{let t=this.safePoints(),e=t.length;if(e===0)return[];let n=(this.innerW-(e-1)*this.groupGap)/e,a=Math.max(2,n),d=(a-this.barGap)/2,u=Math.max(1,d),f=this.maxCost()||1,M=this.maxTokens()||1,I=45;return t.map((C,B)=>{let F=this.paddingX+B*(a+this.groupGap),we=(C.cost??0)/f*this.innerH,ne=C.promptTokens,oe=C.completionTokens,K=ne!==null||oe!==null,De=ne??0,Ee=oe??0,Oe=K?De/M*this.innerH:null,Ne=K?Ee/M*this.innerH:null;return{date:C.date,point:C,xGroup:F,groupW:a,xCost:F,w:u,costH:we,xTokens:F+u+this.barGap,promptH:Oe,completionH:Ne,tokensStubH:K?null:I}})});axisLabels=p(()=>{let t=this.safePoints(),e=t.length;if(e===0)return[];let a=Math.max(1,Math.ceil(e/8)),d=(this.innerW-(e-1)*this.groupGap)/e,u=Math.max(2,d);return t.map((f,M)=>({p:f,i:M})).filter(({i:f})=>f%a===0||f===e-1).map(({p:f,i:M})=>{let C=this.paddingX+M*(u+this.groupGap)+u/2,B=f.date.slice(5);return{x:C,label:B}})});yTop=this.paddingY;yBase=this.paddingY+this.innerH;yAxis=this.yBase+28;static \u0275fac=function(e){return new(e||o)};static \u0275cmp=L({type:o,selectors:[["app-daily-series-chart"]],inputs:{points:"points"},decls:2,vars:1,consts:[[1,"muted"],[1,"chart"],["preserveAspectRatio","none","role","img","aria-label","Daily token and cost usage",1,"chart__svg"],["x1","0",1,"chart__grid"],[1,"chart__day"],["text-anchor","middle",1,"chart__axis-label"],[1,"chart__tooltip",3,"left","top"],[1,"chart__legend"],[1,"chart__legend-item"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--cost"],[1,"chart__legend-label"],[1,"chart__legend-value"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--prompt"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--completion"],["aria-hidden","true",1,"chart__legend-swatch","chart__legend-swatch--tokens-missing"],[1,"chart__day",3,"mouseenter","mousemove","mouseleave"],["x","0",1,"chart__hover"],["x","0",1,"chart__bar","chart__bar--cost"],[1,"chart__bar","chart__bar--tokens-missing"],[1,"chart__bar","chart__bar--prompt"],[1,"chart__bar","chart__bar--completion"],[1,"chart__tooltip"],[1,"chart__tooltip-title"],[1,"chart__tooltip-grid"],[1,"chart__tooltip-label"],[1,"chart__tooltip-value"]],template:function(e,n){e&1&&v(0,Re,2,0,"div",0)(1,Ye,34,11,"div",1),e&2&&x(n.safePoints().length===0?0:1)},styles:[".chart[_ngcontent-%COMP%]{display:grid;gap:.5rem;position:relative}.chart__svg[_ngcontent-%COMP%]{width:100%;height:260px;display:block;border-radius:12px;background:var(--color-bg-secondary, rgba(255, 255, 255, .72));border:1px solid var(--color-border-light, rgba(0, 0, 0, .08))}.chart__grid[_ngcontent-%COMP%]{stroke:var(--color-border-light, rgba(0, 0, 0, .08));stroke-width:1}.chart__day[_ngcontent-%COMP%]{cursor:default}.chart__hover[_ngcontent-%COMP%]{fill:transparent}.chart__day[_ngcontent-%COMP%]:hover .chart__hover[_ngcontent-%COMP%]{fill:var(--color-bg-hover, rgba(0, 0, 0, .03))}.chart__tooltip[_ngcontent-%COMP%]{position:absolute;z-index:2;min-width:220px;max-width:320px;padding:10px 12px;border-radius:12px;background:rgb(var(--color-bg-secondary-rgb, 255 255 255)/1);border:1px solid var(--color-border-light, rgba(0, 0, 0, .08));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .12));pointer-events:none}.chart__tooltip-title[_ngcontent-%COMP%]{font-weight:650;margin-bottom:6px}.chart__tooltip-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr auto;column-gap:10px;row-gap:4px}.chart__tooltip-label[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.85rem}.chart__tooltip-value[_ngcontent-%COMP%]{font-variant-numeric:tabular-nums;text-align:right}.chart__bar[_ngcontent-%COMP%]{shape-rendering:geometricPrecision;rx:2;ry:2}.chart__bar--cost[_ngcontent-%COMP%]{fill:var(--color-primary, #007aff);opacity:.85}.chart__bar--prompt[_ngcontent-%COMP%]{fill:var(--color-success, #34c759);opacity:.85}.chart__bar--completion[_ngcontent-%COMP%]{fill:var(--color-warning, #ff9500);opacity:.85}.chart__bar--tokens-missing[_ngcontent-%COMP%]{fill:transparent;stroke:var(--color-text-secondary, rgba(29, 29, 31, .55));stroke-width:1.5;stroke-dasharray:4 3}.chart__axis-label[_ngcontent-%COMP%]{fill:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:12px;font-variant-numeric:tabular-nums}.chart__legend[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:.75rem;flex-wrap:wrap}.chart__legend-item[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:baseline}.chart__legend-swatch[_ngcontent-%COMP%]{width:10px;height:10px;border-radius:3px;align-self:center}.chart__legend-swatch--cost[_ngcontent-%COMP%]{background:var(--color-primary, #007aff)}.chart__legend-swatch--prompt[_ngcontent-%COMP%]{background:var(--color-success, #34c759)}.chart__legend-swatch--completion[_ngcontent-%COMP%]{background:var(--color-warning, #ff9500)}.chart__legend-swatch--tokens-missing[_ngcontent-%COMP%]{background:transparent;border:1px dashed var(--color-text-secondary, rgba(29, 29, 31, .55))}.chart__legend-label[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.85rem}.chart__legend-value[_ngcontent-%COMP%]{font-variant-numeric:tabular-nums}.muted[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7))}"],changeDetection:0})};var z=class o{http=T(pe);getTokenUsage(t){let e=new ee;return t.from&&(e=e.set("from",t.from)),t.to&&(e=e.set("to",t.to)),this.http.get("/api/token-usage",{params:e})}getTokenUsageSeries(t){let e=new ee;return t.from&&(e=e.set("from",t.from)),t.to&&(e=e.set("to",t.to)),this.http.get("/api/token-usage/series",{params:e})}static \u0275fac=function(e){return new(e||o)};static \u0275prov=H({token:o,factory:o.\u0275fac,providedIn:"root"})};function Te(o){return`${o}`.padStart(2,"0")}function ke(o){return`${o.getUTCFullYear()}-${Te(o.getUTCMonth()+1)}-${Te(o.getUTCDate())}`}function ze(o=new Date){return new Date(Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),1))}function We(o=new Date){return new Date(Date.UTC(o.getUTCFullYear(),o.getUTCMonth()+1,1))}var W=class o{api=T(z);destroyRef=T(re);defaultFrom=ke(ze());defaultTo=ke(We());draftFilters=h({from:this.defaultFrom,to:this.defaultTo});appliedFilters=h({from:this.defaultFrom,to:this.defaultTo});loading=h(!1);error=h(null);aggregation=h(null);seriesResponse=h(null);series=h(null);tokenDataPartial=h(!1);aggregationByModelId=h(null);seriesByModelId=h(null);init(){this.reload()}setDraftFrom(t){this.draftFilters.update(e=>A(R({},e),{from:t}))}setDraftTo(t){this.draftFilters.update(e=>A(R({},e),{to:t}))}clearDraftFrom(){this.setDraftFrom(null)}clearDraftTo(){this.setDraftTo(null)}apply(){this.appliedFilters.set(this.draftFilters()),this.reload()}addNullableTokens(t,e){return t===null&&e===null?null:(t??0)+(e??0)}aggregateByModelId(t){let e=new Map;for(let n of t){let a=n.modelId,d=e.get(a);d?(d.promptTokens=this.addNullableTokens(d.promptTokens,n.promptTokens),d.completionTokens=this.addNullableTokens(d.completionTokens,n.completionTokens),d.totalTokens=this.addNullableTokens(d.totalTokens,n.totalTokens),d.callCount+=n.callCount??0,d.cost=(d.cost??0)+(n.cost??0)):e.set(a,{agentName:"All agents",providerName:"all",modelId:n.modelId,promptTokens:n.promptTokens,completionTokens:n.completionTokens,totalTokens:n.totalTokens,callCount:n.callCount??0,cost:n.cost??0})}return[...e.values()].sort((n,a)=>(a.totalTokens??0)-(n.totalTokens??0))}aggregateSeriesByModelId(t){let e=new Map;for(let n of t){let a=`${n.date}|${n.modelId}`,d=e.get(a);d?(d.promptTokens=this.addNullableTokens(d.promptTokens,n.promptTokens),d.completionTokens=this.addNullableTokens(d.completionTokens,n.completionTokens),d.totalTokens=this.addNullableTokens(d.totalTokens,n.totalTokens),d.callCount+=n.callCount??0,d.cost=(d.cost??0)+(n.cost??0)):e.set(a,{date:n.date,agentName:"All agents",providerName:"all",modelId:n.modelId,promptTokens:n.promptTokens,completionTokens:n.completionTokens,totalTokens:n.totalTokens,callCount:n.callCount??0,cost:n.cost??0})}return[...e.values()].sort((n,a)=>n.date<a.date?-1:1)}reload(){let{from:t,to:e}=this.appliedFilters();this.loading.set(!0),this.error.set(null),ie({aggregation:this.api.getTokenUsage({from:t,to:e}),series:this.api.getTokenUsageSeries({from:t,to:e})}).pipe(_e(this.destroyRef)).subscribe({next:({aggregation:n,series:a})=>{this.aggregation.set(n),this.seriesResponse.set(a);let d=a.points??[];this.series.set(d),this.tokenDataPartial.set(n.tokenDataPartial||a.tokenDataPartial);let u=this.aggregateByModelId(n.models??[]);this.aggregationByModelId.set(u),this.seriesByModelId.set(this.aggregateSeriesByModelId(d)),this.loading.set(!1)},error:n=>{this.loading.set(!1),this.aggregation.set(null),this.seriesResponse.set(null),this.series.set(null),this.tokenDataPartial.set(!1),this.aggregationByModelId.set(null),this.seriesByModelId.set(null),this.error.set(n instanceof Error?n.message:"Failed to load token usage")}})}static \u0275fac=function(e){return new(e||o)};static \u0275prov=H({token:o,factory:o.\u0275fac,providedIn:"root"})};var X=function(){throw new Error("DON'T USE this INSIDE A FUNCTION CALLED BY | call OR | apply IT MUST BE A PURE FUNCTION!")},Me=typeof Proxy!="function"?Object.seal({}):new Proxy({},{get:X,set:X,deleteProperty:X,has:X}),J=class o{transform(t,e){if(typeof e!="function")throw new TypeError("You must pass a PURE function to | call");return e?.call(Me,t)}static \u0275fac=function(e){return new(e||o)};static \u0275pipe=Q({name:"call",type:o,pure:!0})},q=class o{transform(t,...e){if(typeof t!="function")throw new TypeError("You must use | apply on a PURE function");return t.apply(Me,e)}static \u0275fac=function(e){return new(e||o)};static \u0275pipe=Q({name:"apply",type:o,pure:!0})};function Xe(o,t){o&1&&(s(0,"div",24),i(1," Partial data \u2014 token counts may not cover the full period "),r())}function Je(o,t){o&1&&(s(0,"div",25),i(1," No token data collected for this period "),r())}function qe(o,t){if(o&1&&(s(0,"div",20)(1,"div",21)(2,"div",22),i(3,"Total tokens"),r(),s(4,"div",23),i(5),y(6,"call"),r()(),s(7,"div",21)(8,"div",22),i(9,"Total calls"),r(),s(10,"div",23),i(11),r()(),s(12,"div",21)(13,"div",22),i(14,"Total cost"),r(),s(15,"div",23),i(16),y(17,"apply"),r()()(),v(18,Xe,2,0,"div",24),v(19,Je,2,0,"div",25)),o&2){let e=g();l(5),c(w(6,5,e.totalRow().totalTokens,e.formatTokenValue)),l(6),c(e.totalRow().callCount),l(5),c(j(17,8,e.formatCostValue,e.isMissingPeriod(),e.totalRow().cost)),l(2),x(e.isPartialPeriod()?18:-1),l(),x(e.isMissingPeriod()?19:-1)}}function Ke(o,t){o&1&&(s(0,"div",17)(1,"div",26),i(2,"Loading token usage\u2026"),r()())}function Qe(o,t){if(o&1&&(s(0,"div",18)(1,"div",27),i(2,"Failed to load"),r(),s(3,"div",26),i(4),r()()),o&2){let e=g();l(4),c(e.state.error())}}function Ze(o,t){o&1&&(s(0,"div",17)(1,"div",27),i(2,"No data"),r(),s(3,"div",26),i(4,"No token usage recorded yet for this period."),r()())}function et(o,t){if(o&1&&(s(0,"div",33)(1,"div",30),i(2),r(),s(3,"div",30),i(4),r(),s(5,"div",30),i(6),r(),s(7,"div",31),i(8),y(9,"call"),r(),s(10,"div",31),i(11),y(12,"call"),r(),s(13,"div",31),i(14),y(15,"call"),r(),s(16,"div",31),i(17),r(),s(18,"div",31),i(19),y(20,"apply"),r()()),o&2){let e=t.$implicit,n=g(2);l(2),c(e.agentName),l(2),c(e.providerName),l(2),c(e.modelId),l(2),c(w(9,8,e.promptTokens,n.formatTokenValue)),l(3),c(w(12,11,e.completionTokens,n.formatTokenValue)),l(3),c(w(15,14,e.totalTokens,n.formatTokenValue)),l(3),c(e.callCount),l(2),E(" ",j(20,17,n.formatCostValue,n.isMissingPeriod(),e.cost)," ")}}function tt(o,t){if(o&1&&(s(0,"div",34)(1,"div",30),i(2),r(),s(3,"div",30),i(4),r(),s(5,"div",30),i(6),r(),s(7,"div",31),i(8),y(9,"call"),r(),s(10,"div",31),i(11),y(12,"call"),r(),s(13,"div",31),i(14),y(15,"call"),r(),s(16,"div",31),i(17),r(),s(18,"div",31),i(19),y(20,"apply"),r()()),o&2){let e=g(2);l(2),c(e.totalRow().agentName),l(2),c(e.totalRow().providerName),l(2),c(e.totalRow().modelId),l(2),c(w(9,8,e.totalRow().promptTokens,e.formatTokenValue)),l(3),E(" ",w(12,11,e.totalRow().completionTokens,e.formatTokenValue)," "),l(3),c(w(15,14,e.totalRow().totalTokens,e.formatTokenValue)),l(3),c(e.totalRow().callCount),l(2),E(" ",j(20,17,e.formatCostValue,e.isMissingPeriod(),e.totalRow().cost)," ")}}function nt(o,t){if(o&1&&(s(0,"div",19)(1,"section",17)(2,"div",27),i(3,"Summary"),r(),s(4,"div",28)(5,"div",29)(6,"div",30),i(7,"agentName"),r(),s(8,"div",30),i(9,"providerName"),r(),s(10,"div",30),i(11,"modelId"),r(),s(12,"div",31),i(13,"promptTokens"),r(),s(14,"div",31),i(15,"completionTokens"),r(),s(16,"div",31),i(17,"totalTokens"),r(),s(18,"div",31),i(19,"callCount"),r(),s(20,"div",31),i(21,"cost"),r()(),s(22,"div",32),N(23,et,21,21,"div",33,se().trackRow,!0),v(25,tt,21,21,"div",34),r()()(),s(26,"section",17)(27,"div",27),i(28,"Daily series"),r(),Z(29,"app-daily-series-chart",35),r()()),o&2){let e=g();l(23),U(e.rows()),l(2),x(e.totalRow()?25:-1),l(4),S("points",e.chartPoints())}}var Se="\u2014",Pe=class o{router=T(ge);projectState=T(ue);state=T(W);view=h("byModel");rowsByAgent=p(()=>this.state.aggregation()?.models??[]);totalRow=p(()=>this.state.aggregation()?.total??null);rowsByModel=p(()=>this.state.aggregationByModelId()??[]);chartPointsByAgent=p(()=>{let t=this.state.series()??[];return this.aggregateDailyPoints(t)});chartPointsByModel=p(()=>{let t=this.state.seriesByModelId()??[];return this.aggregateDailyPoints(t)});chartPoints=p(()=>this.view()==="byAgent"?this.chartPointsByAgent():this.chartPointsByModel());rows=p(()=>this.view()==="byAgent"?this.rowsByAgent():this.rowsByModel());isEmpty=p(()=>{let t=this.state.aggregation();return t?(t.models?.length??0)===0&&(t.total?.callCount??0)===0:!1});ngOnInit(){this.state.init()}onFromChange(t){this.state.setDraftFrom(t||null)}onToChange(t){this.state.setDraftTo(t||null)}clearFrom(){this.state.clearDraftFrom()}clearTo(){this.state.clearDraftTo()}apply(){this.state.apply()}aggregateDailyPoints(t){let e=new Map;for(let n of t){let a=e.get(n.date);if(!a)e.set(n.date,{date:n.date,promptTokens:n.promptTokens,completionTokens:n.completionTokens,cost:n.cost??0,callCount:n.callCount??0});else{let d=(u,f)=>u===null&&f===null?null:(u??0)+(f??0);a.promptTokens=d(a.promptTokens,n.promptTokens),a.completionTokens=d(a.completionTokens,n.completionTokens),a.cost=(a.cost??0)+(n.cost??0),a.callCount=(a.callCount??0)+(n.callCount??0)}}return[...e.values()].sort((n,a)=>n.date<a.date?-1:1)}trackRow(t,e){return`${e.agentName}|${e.providerName}|${e.modelId}`}isMissingPeriod=p(()=>{if(this.state.loading())return!1;let t=this.state.aggregation()?.total;return t?t.totalTokens===null&&(t.cost===null||t.cost===void 0):!1});isPartialPeriod=p(()=>!this.isMissingPeriod()&&this.state.tokenDataPartial());navigateBackToProject(){let t=this.projectState.getSelectedProjectId();this.router.navigate(t?["project",t]:["/"])}formatTokenValue(t){return t===null?Se:new D("en-US").transform(t,"1.0-2")??"0"}formatCostValue(t,e){return t?Se:"$"+(new D("en-US").transform(e??0,"1.2-2")??"0.00")}static \u0275fac=function(e){return new(e||o)};static \u0275cmp=L({type:o,selectors:[["app-token-usage"]],decls:40,vars:9,consts:[[1,"page"],[1,"page__header"],[1,"page__title-block"],["type","button","title","Back to project",1,"page__logo-btn",3,"click"],["alt","Coday",1,"page__logo"],[1,"page__title"],[1,"page__subtitle"],[1,"filters"],[1,"filters__field"],[1,"filters__label"],[1,"filters__control"],["type","date",1,"filters__input",3,"ngModelChange","ngModel"],["type","button",1,"filters__clear",3,"click","disabled"],[1,"filters__select",3,"ngModelChange","ngModel"],["value","byModel"],["value","byAgent"],["type","button",1,"filters__apply",3,"click","disabled"],[1,"card"],[1,"card","card--error"],[1,"grid"],[1,"kpis"],[1,"kpi"],[1,"kpi__label"],[1,"kpi__value"],["title","Some calls in this period were recorded before token tracking was enabled. Token counts reflect only the portion where data was collected.",1,"hint"],["title","No token usage data was collected for this period.",1,"hint"],[1,"muted"],[1,"card__title"],[1,"table"],[1,"table__head"],[1,"table__cell"],[1,"table__cell","table__cell--num"],[1,"table__body"],[1,"table__row"],[1,"table__row","table__row--total"],[3,"points"]],template:function(e,n){e&1&&(s(0,"section",0)(1,"header",1)(2,"div",2)(3,"button",3),P("click",function(){return n.navigateBackToProject()}),Z(4,"img",4),r(),s(5,"div")(6,"h1",5),i(7,"Token Usage"),r(),s(8,"p",6),i(9,"Track prompt and completion token usage by agent and model."),r()()(),s(10,"div",7)(11,"label",8)(12,"span",9),i(13,"From"),r(),s(14,"div",10)(15,"input",11),P("ngModelChange",function(d){return n.onFromChange(d)}),r(),s(16,"button",12),P("click",function(){return n.clearFrom()}),i(17," Clear "),r()()(),s(18,"label",8)(19,"span",9),i(20,"To"),r(),s(21,"div",10)(22,"input",11),P("ngModelChange",function(d){return n.onToChange(d)}),r(),s(23,"button",12),P("click",function(){return n.clearTo()}),i(24," Clear "),r()()(),s(25,"label",8)(26,"span",9),i(27,"View"),r(),s(28,"select",13),P("ngModelChange",function(d){return n.view.set(d)}),s(29,"option",14),i(30,"By model"),r(),s(31,"option",15),i(32,"By agent"),r()()(),s(33,"button",16),P("click",function(){return n.apply()}),i(34,"Apply"),r()()(),v(35,qe,20,12),v(36,Ke,3,0,"div",17)(37,Qe,5,1,"div",18)(38,Ze,5,0,"div",17)(39,nt,30,2,"div",19),r()),e&2&&(l(4),b("src","CODAY-Logo.png",le),l(11),S("ngModel",n.state.draftFilters().from),l(),S("disabled",!n.state.draftFilters().from),l(6),S("ngModel",n.state.draftFilters().to),l(),S("disabled",!n.state.draftFilters().to),l(5),S("ngModel",n.view()),l(5),S("disabled",n.state.loading()),l(2),x(n.totalRow()?35:-1),l(),x(n.state.loading()?36:n.state.error()?37:n.isEmpty()?38:39))},dependencies:[Ce,xe,ye,he,ve,fe,be,G,J,q],styles:[".page[_ngcontent-%COMP%]{padding:1.5rem;color:var(--color-text, #1d1d1f)}.page__header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:1.5rem;margin-bottom:1rem}.page__title-block[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.75rem}.page__logo-btn[_ngcontent-%COMP%]{flex:0 0 auto;width:40px;height:40px;padding:0;border-radius:12px;border:1px solid var(--glass-border, rgba(255, 255, 255, .18));background:var(--glass-bg, rgba(255, 255, 255, .72));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .08));cursor:pointer}.page__logo-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover, rgba(0, 0, 0, .03))}.page__logo[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:contain;padding:6px}.page__title[_ngcontent-%COMP%]{margin:0;font-size:1.25rem;font-weight:650}.page__subtitle[_ngcontent-%COMP%]{margin:.25rem 0 0;color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.95rem}.filters[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:flex-end;gap:.75rem}.filters__field[_ngcontent-%COMP%]{display:grid;gap:.25rem}.filters__label[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7))}.filters__control[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem}.filters__input[_ngcontent-%COMP%], .filters__select[_ngcontent-%COMP%]{height:34px;padding:0 .5rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-bg-secondary, rgba(255, 255, 255, .72));color:var(--color-text, #1d1d1f)}.filters__apply[_ngcontent-%COMP%], .filters__clear[_ngcontent-%COMP%]{height:34px;padding:0 .75rem;border-radius:8px;border:1px solid var(--color-border, rgba(0, 0, 0, .12));background:var(--color-bg-secondary, rgba(255, 255, 255, .72));color:var(--color-text, #1d1d1f);cursor:pointer}.kpis[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.75rem;margin:.75rem 0 1rem}@media (max-width: 900px){.kpis[_ngcontent-%COMP%]{grid-template-columns:1fr}}.kpi[_ngcontent-%COMP%]{border-radius:14px;padding:.75rem 1rem;background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .08))}.kpi__label[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7))}.kpi__value[_ngcontent-%COMP%]{margin-top:.25rem;font-size:1.2rem;font-weight:650;font-variant-numeric:tabular-nums}.filters__apply[_ngcontent-%COMP%]{border-color:var(--color-primary, #007aff);background:var(--color-primary, #007aff);color:var(--color-text-inverse, #ffffff)}.filters__apply[_ngcontent-%COMP%]:disabled, .filters__clear[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed}.grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1.5fr 1fr;gap:1rem;align-items:start}@media (max-width: 1100px){.grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.card[_ngcontent-%COMP%]{border-radius:14px;padding:1rem;background:var(--glass-bg, rgba(255, 255, 255, .72));border:1px solid var(--glass-border, rgba(255, 255, 255, .18));box-shadow:var(--glass-shadow, 0 8px 24px rgba(0, 0, 0, .08))}.card--error[_ngcontent-%COMP%]{border-color:var(--color-error, #ff3b30)}.card__title[_ngcontent-%COMP%]{font-weight:650;margin-bottom:.75rem}.muted[_ngcontent-%COMP%]{color:var(--color-text-secondary, rgba(29, 29, 31, .7))}.table[_ngcontent-%COMP%]{overflow-x:auto}.table__head[_ngcontent-%COMP%], .table__row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr 2fr 1fr 1fr 1fr .7fr 1fr;gap:.5rem;align-items:center}.table__head[_ngcontent-%COMP%]{font-size:.8rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7));padding:.25rem 0;border-bottom:1px solid var(--color-border-light, rgba(0, 0, 0, .08))}.table__row[_ngcontent-%COMP%]{padding:.5rem 0;border-bottom:1px solid var(--color-border-light, rgba(0, 0, 0, .08))}.table__row--total[_ngcontent-%COMP%]{font-weight:650;background:var(--color-bg-hover, rgba(0, 0, 0, .03));border-radius:10px;padding:.6rem .5rem;border-bottom:none;margin-top:.5rem}.table__cell[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.table__cell--num[_ngcontent-%COMP%]{text-align:right;font-variant-numeric:tabular-nums}.hint[_ngcontent-%COMP%]{margin:.25rem 0 1rem;color:var(--color-text-secondary, rgba(29, 29, 31, .7));font-size:.85rem}"]})};export{Pe as TokenUsageComponent};
@@ -1 +1 @@
1
- import{G as p,J as g,M as u,P as o,T as n,d as j,h as i,k as d,kc as h,o as a,p as P,z as l}from"./chunk-DYTHVKS2.js";var c=class r{baseUrl="/api/projects";http=n(h);listProjects(){return this.http.get(this.baseUrl)}getProject(e){return this.http.get(`${this.baseUrl}/${e}`)}getProjectConfig(e){return this.http.get(`${this.baseUrl}/${e}/config`)}updateProjectConfig(e,t){return this.http.put(`${this.baseUrl}/${e}/config`,t)}createProject(e,t){return this.http.post(this.baseUrl,{name:e,path:t})}startPreview(e){return this.http.post(`${this.baseUrl}/${e}/preview/start`,{})}stopPreview(e){return this.http.post(`${this.baseUrl}/${e}/preview/stop`,{})}getPreviewStatus(e){return this.http.get(`${this.baseUrl}/${e}/preview/status`)}getPreviewLogs(e){return this.http.get(`${this.baseUrl}/${e}/preview/logs`)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=o({token:r,factory:r.\u0275fac,providedIn:"root"})};var b=class r{selectedProjectIdSubject=new i(null);isLoadingSubject=new i(!1);refreshTriggerSubject=new i(void 0);hasInitialized=!1;isLoading$=this.isLoadingSubject.asObservable();projectApi=n(c);projectListCall=this.refreshTriggerSubject.pipe(g(()=>this.projectApi.listProjects()),p({bufferSize:1,refCount:!0}));projectList$=this.projectListCall.pipe(a(e=>e.projects));forcedProject$=this.projectListCall.pipe(a(e=>e.forcedProject));selectedProject$=P([this.selectedProjectIdSubject,this.forcedProject$]).pipe(g(([e,t])=>{let s=t??e;return s?this.projectApi.getProject(s):d(null)}),u(e=>{e&&e.name!==this.selectedProjectIdSubject.value&&(console.log("[PROJECT-STATE] Backend returned different project name:",e.name),this.selectedProjectIdSubject.next(e.name))}),p({bufferSize:1,refCount:!0}));selectProject(e){console.log("[PROJECT-STATE] Explicit project selection:",e),this.forcedProject$.pipe(l(1)).subscribe(t=>this.selectedProjectIdSubject.next(t??e))}getSelectedProjectId(){return this.selectedProjectIdSubject.value}getSelectedProjectIdOrThrow(){let e=this.selectedProjectIdSubject.value;if(!e)throw new Error("[PROJECT_STATE] No project selected");return e}clearSelection(){console.log("[PROJECT-STATE] Clearing project selection"),this.selectedProjectIdSubject.next(null)}initializeDefaultProject(){return j(this,null,function*(){if(this.hasInitialized){console.log("[PROJECT-STATE] Already initialized, skipping");return}this.hasInitialized=!0;let e=yield this.projectApi.listProjects().pipe(l(1)).toPromise();if(!e){console.log("[PROJECT-STATE] No response from project API");return}let{defaultProject:t,forcedProject:s}=e;t&&!s?(console.log("[PROJECT-STATE] Initializing with default project:",t),this.selectedProjectIdSubject.next(t)):s?(console.log("[PROJECT-STATE] Initializing with forced project:",s),this.selectedProjectIdSubject.next(s)):console.log("[PROJECT-STATE] No default project, staying on selection page")})}createProject(e,t){return this.isLoadingSubject.next(!0),this.projectApi.createProject(e,t).pipe(u(()=>{this.isLoadingSubject.next(!1),this.refreshTriggerSubject.next()}))}startPreview(){let e=this.getSelectedProjectIdOrThrow();return this.projectApi.startPreview(e)}stopPreview(){let e=this.getSelectedProjectIdOrThrow();return this.projectApi.stopPreview(e)}getPreviewStatus(){let e=this.getSelectedProjectIdOrThrow();return this.projectApi.getPreviewStatus(e)}getPreviewLogs(){let e=this.getSelectedProjectIdOrThrow();return this.projectApi.getPreviewLogs(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=o({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c as a,b};
1
+ import{G as p,J as g,M as u,P as o,T as n,d as j,h as i,k as d,o as a,oc as h,p as P,z as l}from"./chunk-XFS66C5L.js";var c=class r{baseUrl="/api/projects";http=n(h);listProjects(){return this.http.get(this.baseUrl)}getProject(e){return this.http.get(`${this.baseUrl}/${e}`)}getProjectConfig(e){return this.http.get(`${this.baseUrl}/${e}/config`)}updateProjectConfig(e,t){return this.http.put(`${this.baseUrl}/${e}/config`,t)}createProject(e,t){return this.http.post(this.baseUrl,{name:e,path:t})}startPreview(e){return this.http.post(`${this.baseUrl}/${e}/preview/start`,{})}stopPreview(e){return this.http.post(`${this.baseUrl}/${e}/preview/stop`,{})}getPreviewStatus(e){return this.http.get(`${this.baseUrl}/${e}/preview/status`)}getPreviewLogs(e){return this.http.get(`${this.baseUrl}/${e}/preview/logs`)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=o({token:r,factory:r.\u0275fac,providedIn:"root"})};var b=class r{selectedProjectIdSubject=new i(null);isLoadingSubject=new i(!1);refreshTriggerSubject=new i(void 0);hasInitialized=!1;isLoading$=this.isLoadingSubject.asObservable();projectApi=n(c);projectListCall=this.refreshTriggerSubject.pipe(g(()=>this.projectApi.listProjects()),p({bufferSize:1,refCount:!0}));projectList$=this.projectListCall.pipe(a(e=>e.projects));forcedProject$=this.projectListCall.pipe(a(e=>e.forcedProject));selectedProject$=P([this.selectedProjectIdSubject,this.forcedProject$]).pipe(g(([e,t])=>{let s=t??e;return s?this.projectApi.getProject(s):d(null)}),u(e=>{e&&e.name!==this.selectedProjectIdSubject.value&&(console.log("[PROJECT-STATE] Backend returned different project name:",e.name),this.selectedProjectIdSubject.next(e.name))}),p({bufferSize:1,refCount:!0}));selectProject(e){console.log("[PROJECT-STATE] Explicit project selection:",e),this.forcedProject$.pipe(l(1)).subscribe(t=>this.selectedProjectIdSubject.next(t??e))}getSelectedProjectId(){return this.selectedProjectIdSubject.value}getSelectedProjectIdOrThrow(){let e=this.selectedProjectIdSubject.value;if(!e)throw new Error("[PROJECT_STATE] No project selected");return e}clearSelection(){console.log("[PROJECT-STATE] Clearing project selection"),this.selectedProjectIdSubject.next(null)}initializeDefaultProject(){return j(this,null,function*(){if(this.hasInitialized){console.log("[PROJECT-STATE] Already initialized, skipping");return}this.hasInitialized=!0;let e=yield this.projectApi.listProjects().pipe(l(1)).toPromise();if(!e){console.log("[PROJECT-STATE] No response from project API");return}let{defaultProject:t,forcedProject:s}=e;t&&!s?(console.log("[PROJECT-STATE] Initializing with default project:",t),this.selectedProjectIdSubject.next(t)):s?(console.log("[PROJECT-STATE] Initializing with forced project:",s),this.selectedProjectIdSubject.next(s)):console.log("[PROJECT-STATE] No default project, staying on selection page")})}createProject(e,t){return this.isLoadingSubject.next(!0),this.projectApi.createProject(e,t).pipe(u(()=>{this.isLoadingSubject.next(!1),this.refreshTriggerSubject.next()}))}startPreview(){let e=this.getSelectedProjectIdOrThrow();return this.projectApi.startPreview(e)}stopPreview(){let e=this.getSelectedProjectIdOrThrow();return this.projectApi.stopPreview(e)}getPreviewStatus(){let e=this.getSelectedProjectIdOrThrow();return this.projectApi.getPreviewStatus(e)}getPreviewLogs(){let e=this.getSelectedProjectIdOrThrow();return this.projectApi.getPreviewLogs(e)}static \u0275fac=function(t){return new(t||r)};static \u0275prov=o({token:r,factory:r.\u0275fac,providedIn:"root"})};export{c as a,b};
@@ -1 +1 @@
1
- import{Aa as t,Ya as o,oc as r}from"./chunk-DYTHVKS2.js";var s=class n{static \u0275fac=function(e){return new(e||n)};static \u0275cmp=t({type:n,selectors:[["agentos-shell"]],decls:1,vars:0,template:function(e,i){e&1&&o(0,"router-outlet")},dependencies:[r],styles:[".shell-loader[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100vh;gap:1rem;color:var(--color-text-secondary, #6e6e73);font-size:.9rem}.shell-loader[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.spinner[_ngcontent-%COMP%]{width:32px;height:32px;border:3px solid var(--color-border, rgba(0, 0, 0, .1));border-top-color:var(--color-primary, #007aff);border-radius:50%;animation:_ngcontent-%COMP%_spin .8s linear infinite}@keyframes _ngcontent-%COMP%_spin{to{transform:rotate(360deg)}}"]})};export{s as a};
1
+ import{Ba as t,_a as o,sc as r}from"./chunk-XFS66C5L.js";var s=class n{static \u0275fac=function(e){return new(e||n)};static \u0275cmp=t({type:n,selectors:[["agentos-shell"]],decls:1,vars:0,template:function(e,i){e&1&&o(0,"router-outlet")},dependencies:[r],styles:[".shell-loader[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100vh;gap:1rem;color:var(--color-text-secondary, #6e6e73);font-size:.9rem}.shell-loader[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.spinner[_ngcontent-%COMP%]{width:32px;height:32px;border:3px solid var(--color-border, rgba(0, 0, 0, .1));border-top-color:var(--color-primary, #007aff);border-radius:50%;animation:_ngcontent-%COMP%_spin .8s linear infinite}@keyframes _ngcontent-%COMP%_spin{to{transform:rotate(360deg)}}"]})};export{s as a};
@@ -0,0 +1 @@
1
+ import{c as a}from"./chunk-CZNMHINV.js";import"./chunk-MA7BXHNI.js";import"./chunk-XFS66C5L.js";export{a as LayoutComponent};
@@ -1 +1 @@
1
- import{Ia as G,P as m,R as F,S as C,T as O,U as W,a as u,b as f,f as N,hc as k,jc as h,kc as E}from"./chunk-DYTHVKS2.js";var x=class{apiKeys;username;password;accessToken;basePath;withCredentials;encoder;encodeParam;credentials;constructor({accessToken:b,apiKeys:t,basePath:r,credentials:s,encodeParam:o,encoder:n,password:e,username:l,withCredentials:p}={}){t&&(this.apiKeys=t),l!==void 0&&(this.username=l),e!==void 0&&(this.password=e),b!==void 0&&(this.accessToken=b),r!==void 0&&(this.basePath=r),p!==void 0&&(this.withCredentials=p),n&&(this.encoder=n),this.encodeParam=o??(a=>this.defaultEncodeParam(a)),this.credentials=s??{}}selectHeaderContentType(b){if(b.length===0)return;let t=b.find(r=>this.isJsonMime(r));return t===void 0?b[0]:t}selectHeaderAccept(b){if(b.length===0)return;let t=b.find(r=>this.isJsonMime(r));return t===void 0?b[0]:t}isJsonMime(b){let t=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return b!==null&&(t.test(b)||b.toLowerCase()==="application/json-patch+json")}lookupCredential(b){let t=this.credentials[b];return typeof t=="function"?t():t}addCredentialToHeaders(b,t,r,s){let o=this.lookupCredential(b);return o?r.set(t,(s??"")+o):r}addCredentialToQuery(b,t,r){let s=this.lookupCredential(b);return s?r.set(t,s):r}defaultEncodeParam(b){let t=b.dataFormat==="date-time"&&b.value instanceof Date?b.value.toISOString():b.value;return encodeURIComponent(String(t))}};var A=new F("basePath");var R=class{encodeKey(b){return encodeURIComponent(b)}encodeValue(b){return encodeURIComponent(b)}decodeKey(b){return decodeURIComponent(b)}decodeValue(b){return decodeURIComponent(b)}};var P=class{basePath="http://localhost:8123";defaultHeaders=new k;configuration;encoder;constructor(b,t){if(this.configuration=t||new x,typeof this.configuration.basePath!="string"){let r=Array.isArray(b)?b[0]:void 0;r!=null&&(b=r),typeof b!="string"&&(b=this.basePath),this.configuration.basePath=b}this.encoder=this.configuration.encoder||new R}canConsumeForm(b){return b.indexOf("multipart/form-data")!==-1}addToHttpParams(b,t,r,s=!1){return typeof t=="object"&&!(t instanceof Date)?this.addToHttpParamsRecursive(b,t,s?r:void 0,s):this.addToHttpParamsRecursive(b,t,r)}addToHttpParamsRecursive(b,t,r,s=!1){if(t==null)return b;if(typeof t=="object"){if(r!=null)return s?Object.keys(t).reduce((o,n)=>o.append(`${r}[${n}]`,t[n]),b):b.append(r,JSON.stringify(t));if(Array.isArray(t))t.forEach(o=>b=this.addToHttpParamsRecursive(b,o,r));else if(t instanceof Date)if(r!=null)b=b.append(r,t.toISOString());else throw Error("key may not be null if value is Date");else Object.keys(t).forEach(o=>{let n=r?`${r}.${o}`:o;b=this.addToHttpParamsRecursive(b,t[o],n)});return b}else if(r!=null)return b.append(r,t);throw Error("key may not be null if value is not object or array")}};var V=class g extends P{constructor(t,r,s){super(r,s);this.httpClient=t}addMessage(t,r,s="body",o=!1,n){if(t==null)throw new Error("Required parameter caseId was null or undefined when calling addMessage.");if(r==null)throw new Error("Required parameter addMessageRequest was null or undefined when calling addMessage.");let e=this.defaultHeaders,l=n?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);l!==void 0&&(e=e.set("Accept",l));let p=n?.context??new h,a=n?.transferCache??!0,d=["application/json"],i=this.configuration.selectHeaderContentType(d);i!==void 0&&(e=e.set("Content-Type",i));let c="json";l&&(l.startsWith("text")?c="text":this.configuration.isJsonMime(l)?c="json":c="blob");let v=`/api/cases/${this.configuration.encodeParam({name:"caseId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/messages`,{basePath:H,withCredentials:y}=this.configuration;return this.httpClient.request("post",`${H}${v}`,f(u({context:p,body:r,responseType:c},y?{withCredentials:y}:{}),{headers:e,observe:s,transferCache:a,reportProgress:o}))}create1(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter _case was null or undefined when calling create1.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(n=n.set("Content-Type",d));let i="json";e&&(e.startsWith("text")?i="text":this.configuration.isJsonMime(e)?i="json":i="blob");let c="/api/cases",{basePath:v,withCredentials:H}=this.configuration;return this.httpClient.request("post",`${v}${c}`,f(u({context:l,body:t,responseType:i},H?{withCredentials:H}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}delete1(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter id was null or undefined when calling delete1.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getById1(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter id was null or undefined when calling getById1.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getByIds1(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIds1.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(n=n.set("Content-Type",d));let i="json";e&&(e.startsWith("text")?i="text":this.configuration.isJsonMime(e)?i="json":i="blob");let c="/api/cases/by-ids",{basePath:v,withCredentials:H}=this.configuration;return this.httpClient.request("post",`${v}${c}`,f(u({context:l,body:t,responseType:i},H?{withCredentials:H}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}killCase(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter caseId was null or undefined when calling killCase.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"caseId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/kill`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}listByParent1(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter parentId was null or undefined when calling listByParent1.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/by-parentId/${this.configuration.encodeParam({name:"parentId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}stopCase(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter caseId was null or undefined when calling stopCase.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"caseId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/stop`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}update1(t,r,s="body",o=!1,n){if(t==null)throw new Error("Required parameter id was null or undefined when calling update1.");if(r==null)throw new Error("Required parameter _case was null or undefined when calling update1.");let e=this.defaultHeaders,l=n?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);l!==void 0&&(e=e.set("Accept",l));let p=n?.context??new h,a=n?.transferCache??!0,d=["application/json"],i=this.configuration.selectHeaderContentType(d);i!==void 0&&(e=e.set("Content-Type",i));let c="json";l&&(l.startsWith("text")?c="text":this.configuration.isJsonMime(l)?c="json":c="blob");let v=`/api/cases/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:H,withCredentials:y}=this.configuration;return this.httpClient.request("put",`${H}${v}`,f(u({context:p,body:r,responseType:c},y?{withCredentials:y}:{}),{headers:e,observe:s,transferCache:a,reportProgress:o}))}static \u0275fac=function(r){return new(r||g)(C(E),C(A,8),C(x,8))};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};var I=class g extends P{constructor(t,r,s){super(r,s);this.httpClient=t}_delete(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter id was null or undefined when calling _delete.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/namespaces/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}create(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter namespace was null or undefined when calling create.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(n=n.set("Content-Type",d));let i="json";e&&(e.startsWith("text")?i="text":this.configuration.isJsonMime(e)?i="json":i="blob");let c="/api/namespaces",{basePath:v,withCredentials:H}=this.configuration;return this.httpClient.request("post",`${v}${c}`,f(u({context:l,body:t,responseType:i},H?{withCredentials:H}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getById(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter id was null or undefined when calling getById.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/namespaces/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getByIds(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIds.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(n=n.set("Content-Type",d));let i="json";e&&(e.startsWith("text")?i="text":this.configuration.isJsonMime(e)?i="json":i="blob");let c="/api/namespaces/by-ids",{basePath:v,withCredentials:H}=this.configuration;return this.httpClient.request("post",`${v}${c}`,f(u({context:l,body:t,responseType:i},H?{withCredentials:H}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}listAll(t="body",r=!1,s){let o=this.defaultHeaders,n=s?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);n!==void 0&&(o=o.set("Accept",n));let e=s?.context??new h,l=s?.transferCache??!0,p="json";n&&(n.startsWith("text")?p="text":this.configuration.isJsonMime(n)?p="json":p="blob");let a="/api/namespaces",{basePath:d,withCredentials:i}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(u({context:e,responseType:p},i?{withCredentials:i}:{}),{headers:o,observe:t,transferCache:l,reportProgress:r}))}listByParent(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter parentId was null or undefined when calling listByParent.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/namespaces/by-parentId/${this.configuration.encodeParam({name:"parentId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}update(t,r,s="body",o=!1,n){if(t==null)throw new Error("Required parameter id was null or undefined when calling update.");if(r==null)throw new Error("Required parameter namespace was null or undefined when calling update.");let e=this.defaultHeaders,l=n?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);l!==void 0&&(e=e.set("Accept",l));let p=n?.context??new h,a=n?.transferCache??!0,d=["application/json"],i=this.configuration.selectHeaderContentType(d);i!==void 0&&(e=e.set("Content-Type",i));let c="json";l&&(l.startsWith("text")?c="text":this.configuration.isJsonMime(l)?c="json":c="blob");let v=`/api/namespaces/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:H,withCredentials:y}=this.configuration;return this.httpClient.request("put",`${H}${v}`,f(u({context:p,body:r,responseType:c},y?{withCredentials:y}:{}),{headers:e,observe:s,transferCache:a,reportProgress:o}))}static \u0275fac=function(r){return new(r||g)(C(E),C(A,8),C(x,8))};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};var S=class g extends P{constructor(t,r,s){super(r,s);this.httpClient=t}create2(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter agentFinishedEventAgentRunningEventAgentSelectedEventAnswerEventCaseStatusEventIntentionGeneratedEventMessageEventQuestionEventTextChunkEventThinkingEventToolRequestEventToolResponseEventToolSelectedEventWarnEvent was null or undefined when calling create2.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(n=n.set("Content-Type",d));let i="json";e&&(e.startsWith("text")?i="text":this.configuration.isJsonMime(e)?i="json":i="blob");let c="/api/case-events",{basePath:v,withCredentials:H}=this.configuration;return this.httpClient.request("post",`${v}${c}`,f(u({context:l,body:t,responseType:i},H?{withCredentials:H}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}delete2(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter id was null or undefined when calling delete2.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/case-events/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getById2(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter id was null or undefined when calling getById2.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/case-events/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getByIds2(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIds2.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(n=n.set("Content-Type",d));let i="json";e&&(e.startsWith("text")?i="text":this.configuration.isJsonMime(e)?i="json":i="blob");let c="/api/case-events/by-ids",{basePath:v,withCredentials:H}=this.configuration;return this.httpClient.request("post",`${v}${c}`,f(u({context:l,body:t,responseType:i},H?{withCredentials:H}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}listByParent2(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter parentId was null or undefined when calling listByParent2.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/case-events/by-parentId/${this.configuration.encodeParam({name:"parentId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}update2(t,r,s="body",o=!1,n){if(t==null)throw new Error("Required parameter id was null or undefined when calling update2.");if(r==null)throw new Error("Required parameter agentFinishedEventAgentRunningEventAgentSelectedEventAnswerEventCaseStatusEventIntentionGeneratedEventMessageEventQuestionEventTextChunkEventThinkingEventToolRequestEventToolResponseEventToolSelectedEventWarnEvent was null or undefined when calling update2.");let e=this.defaultHeaders,l=n?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);l!==void 0&&(e=e.set("Accept",l));let p=n?.context??new h,a=n?.transferCache??!0,d=["application/json"],i=this.configuration.selectHeaderContentType(d);i!==void 0&&(e=e.set("Content-Type",i));let c="json";l&&(l.startsWith("text")?c="text":this.configuration.isJsonMime(l)?c="json":c="blob");let v=`/api/case-events/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:H,withCredentials:y}=this.configuration;return this.httpClient.request("put",`${H}${v}`,f(u({context:p,body:r,responseType:c},y?{withCredentials:y}:{}),{headers:e,observe:s,transferCache:a,reportProgress:o}))}static \u0275fac=function(r){return new(r||g)(C(E),C(A,8),C(x,8))};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};var $=class g extends P{constructor(t,r,s){super(r,s);this.httpClient=t}debugAllPlugins(t="body",r=!1,s){let o=this.defaultHeaders,n=s?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);n!==void 0&&(o=o.set("Accept",n));let e=s?.context??new h,l=s?.transferCache??!0,p="json";n&&(n.startsWith("text")?p="text":this.configuration.isJsonMime(n)?p="json":p="blob");let a="/api/plugins/debug",{basePath:d,withCredentials:i}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(u({context:e,responseType:p},i?{withCredentials:i}:{}),{headers:o,observe:t,transferCache:l,reportProgress:r}))}debugPlugin(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter pluginId was null or undefined when calling debugPlugin.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/debug`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getAllPlugins(t="body",r=!1,s){let o=this.defaultHeaders,n=s?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);n!==void 0&&(o=o.set("Accept",n));let e=s?.context??new h,l=s?.transferCache??!0,p="json";n&&(n.startsWith("text")?p="text":this.configuration.isJsonMime(n)?p="json":p="blob");let a="/api/plugins",{basePath:d,withCredentials:i}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(u({context:e,responseType:p},i?{withCredentials:i}:{}),{headers:o,observe:t,transferCache:l,reportProgress:r}))}getPlugin(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter pluginId was null or undefined when calling getPlugin.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}reloadAllAgents(t="body",r=!1,s){let o=this.defaultHeaders,n=s?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);n!==void 0&&(o=o.set("Accept",n));let e=s?.context??new h,l=s?.transferCache??!0,p="json";n&&(n.startsWith("text")?p="text":this.configuration.isJsonMime(n)?p="json":p="blob");let a="/api/plugins/reload-agents",{basePath:d,withCredentials:i}=this.configuration;return this.httpClient.request("post",`${d}${a}`,f(u({context:e,responseType:p},i?{withCredentials:i}:{}),{headers:o,observe:t,transferCache:l,reportProgress:r}))}reloadPlugin(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter pluginId was null or undefined when calling reloadPlugin.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/reload`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}startPlugin(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter pluginId was null or undefined when calling startPlugin.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/start`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}stopPlugin(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter pluginId was null or undefined when calling stopPlugin.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/stop`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}unloadPlugin(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter pluginId was null or undefined when calling unloadPlugin.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}uploadPlugin(t="body",r=!1,s){let o=this.defaultHeaders,n=s?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);n!==void 0&&(o=o.set("Accept",n));let e=s?.context??new h,l=s?.transferCache??!0,p="json";n&&(n.startsWith("text")?p="text":this.configuration.isJsonMime(n)?p="json":p="blob");let a="/api/plugins/upload",{basePath:d,withCredentials:i}=this.configuration;return this.httpClient.request("post",`${d}${a}`,f(u({context:e,responseType:p},i?{withCredentials:i}:{}),{headers:o,observe:t,transferCache:l,reportProgress:r}))}static \u0275fac=function(r){return new(r||g)(C(E),C(A,8),C(x,8))};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};var q=class g extends P{constructor(t,r,s){super(r,s);this.httpClient=t}streamEvents(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter caseId was null or undefined when calling streamEvents.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["text/event-stream"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"caseId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/events`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}static \u0275fac=function(r){return new(r||g)(C(E),C(A,8),C(x,8))};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};var B=class g extends P{constructor(t,r,s){super(r,s);this.httpClient=t}executeTool(t,r,s="body",o=!1,n){if(t==null)throw new Error("Required parameter toolName was null or undefined when calling executeTool.");if(r==null)throw new Error("Required parameter requestBody was null or undefined when calling executeTool.");let e=this.defaultHeaders,l=n?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);l!==void 0&&(e=e.set("Accept",l));let p=n?.context??new h,a=n?.transferCache??!0,d=["application/json"],i=this.configuration.selectHeaderContentType(d);i!==void 0&&(e=e.set("Content-Type",i));let c="json";l&&(l.startsWith("text")?c="text":this.configuration.isJsonMime(l)?c="json":c="blob");let v=`/api/tools/${this.configuration.encodeParam({name:"toolName",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/execute`,{basePath:H,withCredentials:y}=this.configuration;return this.httpClient.request("post",`${H}${v}`,f(u({context:p,body:r,responseType:c},y?{withCredentials:y}:{}),{headers:e,observe:s,transferCache:a,reportProgress:o}))}getTool(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter toolName was null or undefined when calling getTool.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/tools/${this.configuration.encodeParam({name:"toolName",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}listTools(t="body",r=!1,s){let o=this.defaultHeaders,n=s?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);n!==void 0&&(o=o.set("Accept",n));let e=s?.context??new h,l=s?.transferCache??!0,p="json";n&&(n.startsWith("text")?p="text":this.configuration.isJsonMime(n)?p="json":p="blob");let a="/api/tools",{basePath:d,withCredentials:i}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(u({context:e,responseType:p},i?{withCredentials:i}:{}),{headers:o,observe:t,transferCache:l,reportProgress:r}))}static \u0275fac=function(r){return new(r||g)(C(E),C(A,8),C(x,8))};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};function Lt(g){return W([typeof g=="string"?{provide:A,useValue:g}:{provide:x,useValue:new x(u({},g))}])}var M=class g{config=O(x);zone=O(G);connect(b){let t=`${this.config.basePath}/api/cases/${b}/events`;return new N(r=>{let s=this.zone.runOutsideAngular(()=>new EventSource(t));return s.onmessage=o=>{try{let n=JSON.parse(o.data);this.zone.run(()=>r.next(n))}catch(n){this.zone.run(()=>r.error(new Error(`Failed to parse SSE event: ${n}`)))}},s.onerror=o=>{s.readyState===EventSource.CLOSED?this.zone.run(()=>r.complete()):this.zone.run(()=>r.error(new Error(`SSE connection error for case ${b}`))),s.close()},()=>s.close()})}static \u0275fac=function(t){return new(t||g)};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};export{x as a,V as b,I as c,$ as d,Lt as e};
1
+ import{Ka as G,P as m,R as F,S as C,T as O,U as W,a as u,b as f,f as N,lc as k,nc as h,oc as E}from"./chunk-XFS66C5L.js";var x=class{apiKeys;username;password;accessToken;basePath;withCredentials;encoder;encodeParam;credentials;constructor({accessToken:b,apiKeys:t,basePath:r,credentials:s,encodeParam:o,encoder:n,password:e,username:l,withCredentials:p}={}){t&&(this.apiKeys=t),l!==void 0&&(this.username=l),e!==void 0&&(this.password=e),b!==void 0&&(this.accessToken=b),r!==void 0&&(this.basePath=r),p!==void 0&&(this.withCredentials=p),n&&(this.encoder=n),this.encodeParam=o??(a=>this.defaultEncodeParam(a)),this.credentials=s??{}}selectHeaderContentType(b){if(b.length===0)return;let t=b.find(r=>this.isJsonMime(r));return t===void 0?b[0]:t}selectHeaderAccept(b){if(b.length===0)return;let t=b.find(r=>this.isJsonMime(r));return t===void 0?b[0]:t}isJsonMime(b){let t=new RegExp("^(application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(;.*)?$","i");return b!==null&&(t.test(b)||b.toLowerCase()==="application/json-patch+json")}lookupCredential(b){let t=this.credentials[b];return typeof t=="function"?t():t}addCredentialToHeaders(b,t,r,s){let o=this.lookupCredential(b);return o?r.set(t,(s??"")+o):r}addCredentialToQuery(b,t,r){let s=this.lookupCredential(b);return s?r.set(t,s):r}defaultEncodeParam(b){let t=b.dataFormat==="date-time"&&b.value instanceof Date?b.value.toISOString():b.value;return encodeURIComponent(String(t))}};var A=new F("basePath");var R=class{encodeKey(b){return encodeURIComponent(b)}encodeValue(b){return encodeURIComponent(b)}decodeKey(b){return decodeURIComponent(b)}decodeValue(b){return decodeURIComponent(b)}};var P=class{basePath="http://localhost:8123";defaultHeaders=new k;configuration;encoder;constructor(b,t){if(this.configuration=t||new x,typeof this.configuration.basePath!="string"){let r=Array.isArray(b)?b[0]:void 0;r!=null&&(b=r),typeof b!="string"&&(b=this.basePath),this.configuration.basePath=b}this.encoder=this.configuration.encoder||new R}canConsumeForm(b){return b.indexOf("multipart/form-data")!==-1}addToHttpParams(b,t,r,s=!1){return typeof t=="object"&&!(t instanceof Date)?this.addToHttpParamsRecursive(b,t,s?r:void 0,s):this.addToHttpParamsRecursive(b,t,r)}addToHttpParamsRecursive(b,t,r,s=!1){if(t==null)return b;if(typeof t=="object"){if(r!=null)return s?Object.keys(t).reduce((o,n)=>o.append(`${r}[${n}]`,t[n]),b):b.append(r,JSON.stringify(t));if(Array.isArray(t))t.forEach(o=>b=this.addToHttpParamsRecursive(b,o,r));else if(t instanceof Date)if(r!=null)b=b.append(r,t.toISOString());else throw Error("key may not be null if value is Date");else Object.keys(t).forEach(o=>{let n=r?`${r}.${o}`:o;b=this.addToHttpParamsRecursive(b,t[o],n)});return b}else if(r!=null)return b.append(r,t);throw Error("key may not be null if value is not object or array")}};var V=class g extends P{constructor(t,r,s){super(r,s);this.httpClient=t}addMessage(t,r,s="body",o=!1,n){if(t==null)throw new Error("Required parameter caseId was null or undefined when calling addMessage.");if(r==null)throw new Error("Required parameter addMessageRequest was null or undefined when calling addMessage.");let e=this.defaultHeaders,l=n?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);l!==void 0&&(e=e.set("Accept",l));let p=n?.context??new h,a=n?.transferCache??!0,d=["application/json"],i=this.configuration.selectHeaderContentType(d);i!==void 0&&(e=e.set("Content-Type",i));let c="json";l&&(l.startsWith("text")?c="text":this.configuration.isJsonMime(l)?c="json":c="blob");let v=`/api/cases/${this.configuration.encodeParam({name:"caseId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/messages`,{basePath:H,withCredentials:y}=this.configuration;return this.httpClient.request("post",`${H}${v}`,f(u({context:p,body:r,responseType:c},y?{withCredentials:y}:{}),{headers:e,observe:s,transferCache:a,reportProgress:o}))}create1(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter _case was null or undefined when calling create1.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(n=n.set("Content-Type",d));let i="json";e&&(e.startsWith("text")?i="text":this.configuration.isJsonMime(e)?i="json":i="blob");let c="/api/cases",{basePath:v,withCredentials:H}=this.configuration;return this.httpClient.request("post",`${v}${c}`,f(u({context:l,body:t,responseType:i},H?{withCredentials:H}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}delete1(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter id was null or undefined when calling delete1.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getById1(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter id was null or undefined when calling getById1.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getByIds1(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIds1.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(n=n.set("Content-Type",d));let i="json";e&&(e.startsWith("text")?i="text":this.configuration.isJsonMime(e)?i="json":i="blob");let c="/api/cases/by-ids",{basePath:v,withCredentials:H}=this.configuration;return this.httpClient.request("post",`${v}${c}`,f(u({context:l,body:t,responseType:i},H?{withCredentials:H}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}killCase(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter caseId was null or undefined when calling killCase.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"caseId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/kill`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}listByParent1(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter parentId was null or undefined when calling listByParent1.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/by-parentId/${this.configuration.encodeParam({name:"parentId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}stopCase(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter caseId was null or undefined when calling stopCase.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"caseId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/stop`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}update1(t,r,s="body",o=!1,n){if(t==null)throw new Error("Required parameter id was null or undefined when calling update1.");if(r==null)throw new Error("Required parameter _case was null or undefined when calling update1.");let e=this.defaultHeaders,l=n?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);l!==void 0&&(e=e.set("Accept",l));let p=n?.context??new h,a=n?.transferCache??!0,d=["application/json"],i=this.configuration.selectHeaderContentType(d);i!==void 0&&(e=e.set("Content-Type",i));let c="json";l&&(l.startsWith("text")?c="text":this.configuration.isJsonMime(l)?c="json":c="blob");let v=`/api/cases/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:H,withCredentials:y}=this.configuration;return this.httpClient.request("put",`${H}${v}`,f(u({context:p,body:r,responseType:c},y?{withCredentials:y}:{}),{headers:e,observe:s,transferCache:a,reportProgress:o}))}static \u0275fac=function(r){return new(r||g)(C(E),C(A,8),C(x,8))};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};var I=class g extends P{constructor(t,r,s){super(r,s);this.httpClient=t}_delete(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter id was null or undefined when calling _delete.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/namespaces/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}create(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter namespace was null or undefined when calling create.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(n=n.set("Content-Type",d));let i="json";e&&(e.startsWith("text")?i="text":this.configuration.isJsonMime(e)?i="json":i="blob");let c="/api/namespaces",{basePath:v,withCredentials:H}=this.configuration;return this.httpClient.request("post",`${v}${c}`,f(u({context:l,body:t,responseType:i},H?{withCredentials:H}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getById(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter id was null or undefined when calling getById.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/namespaces/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getByIds(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIds.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(n=n.set("Content-Type",d));let i="json";e&&(e.startsWith("text")?i="text":this.configuration.isJsonMime(e)?i="json":i="blob");let c="/api/namespaces/by-ids",{basePath:v,withCredentials:H}=this.configuration;return this.httpClient.request("post",`${v}${c}`,f(u({context:l,body:t,responseType:i},H?{withCredentials:H}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}listAll(t="body",r=!1,s){let o=this.defaultHeaders,n=s?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);n!==void 0&&(o=o.set("Accept",n));let e=s?.context??new h,l=s?.transferCache??!0,p="json";n&&(n.startsWith("text")?p="text":this.configuration.isJsonMime(n)?p="json":p="blob");let a="/api/namespaces",{basePath:d,withCredentials:i}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(u({context:e,responseType:p},i?{withCredentials:i}:{}),{headers:o,observe:t,transferCache:l,reportProgress:r}))}listByParent(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter parentId was null or undefined when calling listByParent.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/namespaces/by-parentId/${this.configuration.encodeParam({name:"parentId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}update(t,r,s="body",o=!1,n){if(t==null)throw new Error("Required parameter id was null or undefined when calling update.");if(r==null)throw new Error("Required parameter namespace was null or undefined when calling update.");let e=this.defaultHeaders,l=n?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);l!==void 0&&(e=e.set("Accept",l));let p=n?.context??new h,a=n?.transferCache??!0,d=["application/json"],i=this.configuration.selectHeaderContentType(d);i!==void 0&&(e=e.set("Content-Type",i));let c="json";l&&(l.startsWith("text")?c="text":this.configuration.isJsonMime(l)?c="json":c="blob");let v=`/api/namespaces/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:H,withCredentials:y}=this.configuration;return this.httpClient.request("put",`${H}${v}`,f(u({context:p,body:r,responseType:c},y?{withCredentials:y}:{}),{headers:e,observe:s,transferCache:a,reportProgress:o}))}static \u0275fac=function(r){return new(r||g)(C(E),C(A,8),C(x,8))};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};var S=class g extends P{constructor(t,r,s){super(r,s);this.httpClient=t}create2(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter agentFinishedEventAgentRunningEventAgentSelectedEventAnswerEventCaseStatusEventIntentionGeneratedEventMessageEventQuestionEventTextChunkEventThinkingEventToolRequestEventToolResponseEventToolSelectedEventWarnEvent was null or undefined when calling create2.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(n=n.set("Content-Type",d));let i="json";e&&(e.startsWith("text")?i="text":this.configuration.isJsonMime(e)?i="json":i="blob");let c="/api/case-events",{basePath:v,withCredentials:H}=this.configuration;return this.httpClient.request("post",`${v}${c}`,f(u({context:l,body:t,responseType:i},H?{withCredentials:H}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}delete2(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter id was null or undefined when calling delete2.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept([]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/case-events/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getById2(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter id was null or undefined when calling getById2.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/case-events/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getByIds2(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter requestBody was null or undefined when calling getByIds2.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a=["application/json"],d=this.configuration.selectHeaderContentType(a);d!==void 0&&(n=n.set("Content-Type",d));let i="json";e&&(e.startsWith("text")?i="text":this.configuration.isJsonMime(e)?i="json":i="blob");let c="/api/case-events/by-ids",{basePath:v,withCredentials:H}=this.configuration;return this.httpClient.request("post",`${v}${c}`,f(u({context:l,body:t,responseType:i},H?{withCredentials:H}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}listByParent2(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter parentId was null or undefined when calling listByParent2.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/case-events/by-parentId/${this.configuration.encodeParam({name:"parentId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}update2(t,r,s="body",o=!1,n){if(t==null)throw new Error("Required parameter id was null or undefined when calling update2.");if(r==null)throw new Error("Required parameter agentFinishedEventAgentRunningEventAgentSelectedEventAnswerEventCaseStatusEventIntentionGeneratedEventMessageEventQuestionEventTextChunkEventThinkingEventToolRequestEventToolResponseEventToolSelectedEventWarnEvent was null or undefined when calling update2.");let e=this.defaultHeaders,l=n?.httpHeaderAccept??this.configuration.selectHeaderAccept(["application/json"]);l!==void 0&&(e=e.set("Accept",l));let p=n?.context??new h,a=n?.transferCache??!0,d=["application/json"],i=this.configuration.selectHeaderContentType(d);i!==void 0&&(e=e.set("Content-Type",i));let c="json";l&&(l.startsWith("text")?c="text":this.configuration.isJsonMime(l)?c="json":c="blob");let v=`/api/case-events/${this.configuration.encodeParam({name:"id",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}`,{basePath:H,withCredentials:y}=this.configuration;return this.httpClient.request("put",`${H}${v}`,f(u({context:p,body:r,responseType:c},y?{withCredentials:y}:{}),{headers:e,observe:s,transferCache:a,reportProgress:o}))}static \u0275fac=function(r){return new(r||g)(C(E),C(A,8),C(x,8))};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};var $=class g extends P{constructor(t,r,s){super(r,s);this.httpClient=t}debugAllPlugins(t="body",r=!1,s){let o=this.defaultHeaders,n=s?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);n!==void 0&&(o=o.set("Accept",n));let e=s?.context??new h,l=s?.transferCache??!0,p="json";n&&(n.startsWith("text")?p="text":this.configuration.isJsonMime(n)?p="json":p="blob");let a="/api/plugins/debug",{basePath:d,withCredentials:i}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(u({context:e,responseType:p},i?{withCredentials:i}:{}),{headers:o,observe:t,transferCache:l,reportProgress:r}))}debugPlugin(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter pluginId was null or undefined when calling debugPlugin.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/debug`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}getAllPlugins(t="body",r=!1,s){let o=this.defaultHeaders,n=s?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);n!==void 0&&(o=o.set("Accept",n));let e=s?.context??new h,l=s?.transferCache??!0,p="json";n&&(n.startsWith("text")?p="text":this.configuration.isJsonMime(n)?p="json":p="blob");let a="/api/plugins",{basePath:d,withCredentials:i}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(u({context:e,responseType:p},i?{withCredentials:i}:{}),{headers:o,observe:t,transferCache:l,reportProgress:r}))}getPlugin(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter pluginId was null or undefined when calling getPlugin.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}reloadAllAgents(t="body",r=!1,s){let o=this.defaultHeaders,n=s?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);n!==void 0&&(o=o.set("Accept",n));let e=s?.context??new h,l=s?.transferCache??!0,p="json";n&&(n.startsWith("text")?p="text":this.configuration.isJsonMime(n)?p="json":p="blob");let a="/api/plugins/reload-agents",{basePath:d,withCredentials:i}=this.configuration;return this.httpClient.request("post",`${d}${a}`,f(u({context:e,responseType:p},i?{withCredentials:i}:{}),{headers:o,observe:t,transferCache:l,reportProgress:r}))}reloadPlugin(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter pluginId was null or undefined when calling reloadPlugin.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/reload`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}startPlugin(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter pluginId was null or undefined when calling startPlugin.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/start`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}stopPlugin(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter pluginId was null or undefined when calling stopPlugin.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/stop`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("post",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}unloadPlugin(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter pluginId was null or undefined when calling unloadPlugin.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/plugins/${this.configuration.encodeParam({name:"pluginId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("delete",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}uploadPlugin(t="body",r=!1,s){let o=this.defaultHeaders,n=s?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);n!==void 0&&(o=o.set("Accept",n));let e=s?.context??new h,l=s?.transferCache??!0,p="json";n&&(n.startsWith("text")?p="text":this.configuration.isJsonMime(n)?p="json":p="blob");let a="/api/plugins/upload",{basePath:d,withCredentials:i}=this.configuration;return this.httpClient.request("post",`${d}${a}`,f(u({context:e,responseType:p},i?{withCredentials:i}:{}),{headers:o,observe:t,transferCache:l,reportProgress:r}))}static \u0275fac=function(r){return new(r||g)(C(E),C(A,8),C(x,8))};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};var q=class g extends P{constructor(t,r,s){super(r,s);this.httpClient=t}streamEvents(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter caseId was null or undefined when calling streamEvents.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["text/event-stream"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/cases/${this.configuration.encodeParam({name:"caseId",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:"uuid"})}/events`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}static \u0275fac=function(r){return new(r||g)(C(E),C(A,8),C(x,8))};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};var B=class g extends P{constructor(t,r,s){super(r,s);this.httpClient=t}executeTool(t,r,s="body",o=!1,n){if(t==null)throw new Error("Required parameter toolName was null or undefined when calling executeTool.");if(r==null)throw new Error("Required parameter requestBody was null or undefined when calling executeTool.");let e=this.defaultHeaders,l=n?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);l!==void 0&&(e=e.set("Accept",l));let p=n?.context??new h,a=n?.transferCache??!0,d=["application/json"],i=this.configuration.selectHeaderContentType(d);i!==void 0&&(e=e.set("Content-Type",i));let c="json";l&&(l.startsWith("text")?c="text":this.configuration.isJsonMime(l)?c="json":c="blob");let v=`/api/tools/${this.configuration.encodeParam({name:"toolName",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}/execute`,{basePath:H,withCredentials:y}=this.configuration;return this.httpClient.request("post",`${H}${v}`,f(u({context:p,body:r,responseType:c},y?{withCredentials:y}:{}),{headers:e,observe:s,transferCache:a,reportProgress:o}))}getTool(t,r="body",s=!1,o){if(t==null)throw new Error("Required parameter toolName was null or undefined when calling getTool.");let n=this.defaultHeaders,e=o?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);e!==void 0&&(n=n.set("Accept",e));let l=o?.context??new h,p=o?.transferCache??!0,a="json";e&&(e.startsWith("text")?a="text":this.configuration.isJsonMime(e)?a="json":a="blob");let d=`/api/tools/${this.configuration.encodeParam({name:"toolName",value:t,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})}`,{basePath:i,withCredentials:c}=this.configuration;return this.httpClient.request("get",`${i}${d}`,f(u({context:l,responseType:a},c?{withCredentials:c}:{}),{headers:n,observe:r,transferCache:p,reportProgress:s}))}listTools(t="body",r=!1,s){let o=this.defaultHeaders,n=s?.httpHeaderAccept??this.configuration.selectHeaderAccept(["*/*"]);n!==void 0&&(o=o.set("Accept",n));let e=s?.context??new h,l=s?.transferCache??!0,p="json";n&&(n.startsWith("text")?p="text":this.configuration.isJsonMime(n)?p="json":p="blob");let a="/api/tools",{basePath:d,withCredentials:i}=this.configuration;return this.httpClient.request("get",`${d}${a}`,f(u({context:e,responseType:p},i?{withCredentials:i}:{}),{headers:o,observe:t,transferCache:l,reportProgress:r}))}static \u0275fac=function(r){return new(r||g)(C(E),C(A,8),C(x,8))};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};function Lt(g){return W([typeof g=="string"?{provide:A,useValue:g}:{provide:x,useValue:new x(u({},g))}])}var M=class g{config=O(x);zone=O(G);connect(b){let t=`${this.config.basePath}/api/cases/${b}/events`;return new N(r=>{let s=this.zone.runOutsideAngular(()=>new EventSource(t));return s.onmessage=o=>{try{let n=JSON.parse(o.data);this.zone.run(()=>r.next(n))}catch(n){this.zone.run(()=>r.error(new Error(`Failed to parse SSE event: ${n}`)))}},s.onerror=o=>{s.readyState===EventSource.CLOSED?this.zone.run(()=>r.complete()):this.zone.run(()=>r.error(new Error(`SSE connection error for case ${b}`))),s.close()},()=>s.close()})}static \u0275fac=function(t){return new(t||g)};static \u0275prov=m({token:g,factory:g.\u0275fac,providedIn:"root"})};export{x as a,V as b,I as c,$ as d,Lt as e};
@@ -1 +1 @@
1
- import{K as f,Mb as p,N as u,T as c,ba as s,f as v,fa as a}from"./chunk-DYTHVKS2.js";function U(n){n||(n=c(s));let e=new v(t=>{if(n.destroyed){t.next();return}return n.onDestroy(t.next.bind(t))});return t=>t.pipe(f(e))}function T(n,e){let d=!e?.manualCleanup?e?.injector?.get(s)??c(s):null,l=g(e?.equal),o;e?.requireSync?o=a({kind:0},{equal:l}):o=a({kind:1,value:e?.initialValue},{equal:l});let i,b=n.subscribe({next:r=>o.set({kind:1,value:r}),error:r=>{o.set({kind:2,error:r}),i?.()},complete:()=>{i?.()}});if(e?.requireSync&&o().kind===0)throw new u(601,!1);return i=d?.onDestroy(b.unsubscribe.bind(b)),p(()=>{let r=o();switch(r.kind){case 1:return r.value;case 2:throw r.error;case 0:throw new u(601,!1)}},{equal:e?.equal})}function g(n=Object.is){return(e,t)=>e.kind===1&&t.kind===1&&n(e.value,t.value)}export{U as a,T as b};
1
+ import{K as f,N as u,Qb as p,T as c,ba as s,f as v,fa as a}from"./chunk-XFS66C5L.js";function U(n){n||(n=c(s));let e=new v(t=>{if(n.destroyed){t.next();return}return n.onDestroy(t.next.bind(t))});return t=>t.pipe(f(e))}function T(n,e){let d=!e?.manualCleanup?e?.injector?.get(s)??c(s):null,l=g(e?.equal),o;e?.requireSync?o=a({kind:0},{equal:l}):o=a({kind:1,value:e?.initialValue},{equal:l});let i,b=n.subscribe({next:r=>o.set({kind:1,value:r}),error:r=>{o.set({kind:2,error:r}),i?.()},complete:()=>{i?.()}});if(e?.requireSync&&o().kind===0)throw new u(601,!1);return i=d?.onDestroy(b.unsubscribe.bind(b)),p(()=>{let r=o();switch(r.kind){case 1:return r.value;case 2:throw r.error;case 0:throw new u(601,!1)}},{equal:e?.equal})}function g(n=Object.is){return(e,t)=>e.kind===1&&t.kind===1&&n(e.value,t.value)}export{U as a,T as b};
@@ -0,0 +1,2 @@
1
+ import{d as Mt,e as ke,f as Ct,g as yt,h as vt,k as xt,l as Pt,m as wt,n as kt,o as Ot,q as St,r as Et,s as Dt,t as Tt,u as It,v as se,w as le,x as qt,y as Qt}from"./chunk-R3H5L5BX.js";import{b as Rt}from"./chunk-EB2MQYHX.js";import{A as jt,B as Ut,C as Ht,D as Yt,E as Xt,b as we,d as bt,i as Ft,t as At,v as Wt,w as zt}from"./chunk-UXESU5SF.js";import{G as xe,J as ut,K as gt,L as ee,M as _t,O as Pe,P as ht,Q as ft,S as te,T as ne,U as ie,a as st,b as lt,i as ve,j as mt,s as ct,t as dt,v as pt}from"./chunk-C3Z2US2O.js";import"./chunk-PGN4ECZ3.js";import{b as Lt,c as Bt,g as oe,k as re,n as Nt,w as Vt,y as ae}from"./chunk-TNIXUUL6.js";import{$ as T,$a as be,Ba as k,Bb as S,Ca as Ve,Cb as E,Da as K,Db as D,Fa as We,Fb as ye,Gb as tt,Ha as he,Hb as nt,I as Q,Ia as ze,J as pe,Ja as Z,K as Re,Ka as je,La as Ue,Nb as it,Oa as He,Pa as N,Q as Fe,Qb as ot,R as B,Ra as M,Sa as C,T as m,Ta as Ye,Va as Xe,Vb as j,Wa as qe,Wb as U,X as u,Xa as y,Y as g,Ya as r,Z as Ae,Za as s,_a as fe,a as ce,aa as ue,ab as Qe,b as De,cb as Ge,db as Ke,e as X,fa as x,fb as f,g as L,gb as Ze,hb as _,hc as rt,ia as G,ib as Je,ja as Le,jb as p,k as de,kb as Me,lb as J,mb as $,nb as $e,ob as V,pb as W,sa as c,ta as ge,tb as Ce,tc as at,u as q,v as Te,va as Be,vb as O,wb as et,xa as Ne,xb as l,ya as _e,yb as P,z as Ie,zb as z}from"./chunk-XFS66C5L.js";var pn=["mat-menu-item",""],un=[[["mat-icon"],["","matMenuItemIcon",""]],"*"],gn=["mat-icon, [matMenuItemIcon]","*"];function _n(i,a){i&1&&(Ae(),r(0,"svg",2),fe(1,"polygon",3),s())}var hn=["*"];function fn(i,a){if(i&1){let e=f();be(0,"div",0),Je("click",function(){u(e);let n=p();return g(n.closed.emit("click"))})("animationstart",function(n){u(e);let o=p();return g(o._onAnimationStart(n.animationName))})("animationend",function(n){u(e);let o=p();return g(o._onAnimationDone(n.animationName))})("animationcancel",function(n){u(e);let o=p();return g(o._onAnimationDone(n.animationName))}),be(1,"div",1),J(2),Qe()()}if(i&2){let e=p();et(e._classList),O("mat-menu-panel-animations-disabled",e._animationsDisabled)("mat-menu-panel-exit-animation",e._panelAnimationState==="void")("mat-menu-panel-animating",e._isAnimating()),Ze("id",e.panelId),N("aria-label",e.ariaLabel||null)("aria-labelledby",e.ariaLabelledby||null)("aria-describedby",e.ariaDescribedby||null)}}var Se=new B("MAT_MENU_PANEL"),H=(()=>{class i{_elementRef=m(G);_document=m(ue);_focusMonitor=m(ve);_parentMenu=m(Se,{optional:!0});_changeDetectorRef=m(j);role="menuitem";disabled=!1;disableRipple=!1;_hovered=new L;_focused=new L;_highlighted=!1;_triggersSubmenu=!1;constructor(){m(mt).load(gt),this._parentMenu?.addItem?.(this)}focus(e,t){this._focusMonitor&&e?this._focusMonitor.focusVia(this._getHostElement(),e,t):this._getHostElement().focus(t),this._focused.next(this)}ngAfterViewInit(){this._focusMonitor&&this._focusMonitor.monitor(this._elementRef,!1)}ngOnDestroy(){this._focusMonitor&&this._focusMonitor.stopMonitoring(this._elementRef),this._parentMenu&&this._parentMenu.removeItem&&this._parentMenu.removeItem(this),this._hovered.complete(),this._focused.complete()}_getTabIndex(){return this.disabled?"-1":"0"}_getHostElement(){return this._elementRef.nativeElement}_checkDisabled(e){this.disabled&&(e.preventDefault(),e.stopPropagation())}_handleMouseEnter(){this._hovered.next(this)}getLabel(){let e=this._elementRef.nativeElement.cloneNode(!0),t=e.querySelectorAll("mat-icon, .material-icons");for(let n=0;n<t.length;n++)t[n].remove();return e.textContent?.trim()||""}_setHighlighted(e){this._highlighted=e,this._changeDetectorRef.markForCheck()}_setTriggersSubmenu(e){this._triggersSubmenu=e,this._changeDetectorRef.markForCheck()}_hasFocus(){return this._document&&this._document.activeElement===this._getHostElement()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=k({type:i,selectors:[["","mat-menu-item",""]],hostAttrs:[1,"mat-mdc-menu-item","mat-focus-indicator"],hostVars:8,hostBindings:function(t,n){t&1&&_("click",function(d){return n._checkDisabled(d)})("mouseenter",function(){return n._handleMouseEnter()}),t&2&&(N("role",n.role)("tabindex",n._getTabIndex())("aria-disabled",n.disabled)("disabled",n.disabled||null),O("mat-mdc-menu-item-highlighted",n._highlighted)("mat-mdc-menu-item-submenu-trigger",n._triggersSubmenu))},inputs:{role:"role",disabled:[2,"disabled","disabled",U],disableRipple:[2,"disableRipple","disableRipple",U]},exportAs:["matMenuItem"],attrs:pn,ngContentSelectors:gn,decls:5,vars:3,consts:[[1,"mat-mdc-menu-item-text"],["matRipple","",1,"mat-mdc-menu-ripple",3,"matRippleDisabled","matRippleTrigger"],["viewBox","0 0 5 10","focusable","false","aria-hidden","true",1,"mat-mdc-menu-submenu-icon"],["points","0,0 5,5 0,10"]],template:function(t,n){t&1&&(Me(un),J(0),r(1,"span",0),J(2,1),s(),fe(3,"div",1),M(4,_n,2,0,":svg:svg",2)),t&2&&(c(3),y("matRippleDisabled",n.disableRipple||n.disabled)("matRippleTrigger",n._getHostElement()),c(),C(n._triggersSubmenu?4:-1))},dependencies:[ut],encapsulation:2,changeDetection:0})}return i})();var Jt=new B("MatMenuContent"),$t=(()=>{class i{_template=m(ge);_appRef=m(He);_injector=m(T);_viewContainerRef=m(_e);_document=m(ue);_changeDetectorRef=m(j);_portal;_outlet;_attached=new L;constructor(){}attach(e={}){this._portal||(this._portal=new we(this._template,this._viewContainerRef)),this.detach(),this._outlet||(this._outlet=new bt(this._document.createElement("div"),this._appRef,this._injector));let t=this._template.elementRef.nativeElement;t.parentNode.insertBefore(this._outlet.outletElement,t),this._changeDetectorRef.markForCheck(),this._portal.attach(this._outlet,e),this._attached.next()}detach(){this._portal?.isAttached&&this._portal.detach()}ngOnDestroy(){this.detach(),this._outlet?.dispose()}static \u0275fac=function(t){return new(t||i)};static \u0275dir=K({type:i,selectors:[["ng-template","matMenuContent",""]],features:[ye([{provide:Jt,useExisting:i}])]})}return i})(),bn=new B("mat-menu-default-options",{providedIn:"root",factory:Mn});function Mn(){return{overlapTrigger:!1,xPosition:"after",yPosition:"below",backdropClass:"cdk-overlay-transparent-backdrop"}}var Oe="_mat-menu-enter",me="_mat-menu-exit",R=(()=>{class i{_elementRef=m(G);_changeDetectorRef=m(j);_injector=m(T);_keyManager;_xPosition;_yPosition;_firstItemFocusRef;_exitFallbackTimeout;_animationsDisabled=xe();_allItems;_directDescendantItems=new Le;_classList={};_panelAnimationState="void";_animationDone=new L;_isAnimating=x(!1);parentMenu;direction;overlayPanelClass;backdropClass;ariaLabel;ariaLabelledby;ariaDescribedby;get xPosition(){return this._xPosition}set xPosition(e){this._xPosition=e,this.setPositionClasses()}get yPosition(){return this._yPosition}set yPosition(e){this._yPosition=e,this.setPositionClasses()}templateRef;items;lazyContent;overlapTrigger;hasBackdrop;set panelClass(e){let t=this._previousPanelClass,n=ce({},this._classList);t&&t.length&&t.split(" ").forEach(o=>{n[o]=!1}),this._previousPanelClass=e,e&&e.length&&(e.split(" ").forEach(o=>{n[o]=!0}),this._elementRef.nativeElement.className=""),this._classList=n}_previousPanelClass;get classList(){return this.panelClass}set classList(e){this.panelClass=e}closed=new Z;close=this.closed;panelId=m(ct).getId("mat-menu-panel-");constructor(){let e=m(bn);this.overlayPanelClass=e.overlayPanelClass||"",this._xPosition=e.xPosition,this._yPosition=e.yPosition,this.backdropClass=e.backdropClass,this.overlapTrigger=e.overlapTrigger,this.hasBackdrop=e.hasBackdrop}ngOnInit(){this.setPositionClasses()}ngAfterContentInit(){this._updateDirectDescendants(),this._keyManager=new pt(this._directDescendantItems).withWrap().withTypeAhead().withHomeAndEnd(),this._keyManager.tabOut.subscribe(()=>this.closed.emit("tab")),this._directDescendantItems.changes.pipe(Q(this._directDescendantItems),pe(e=>q(...e.map(t=>t._focused)))).subscribe(e=>this._keyManager.updateActiveItem(e)),this._directDescendantItems.changes.subscribe(e=>{let t=this._keyManager;if(this._panelAnimationState==="enter"&&t.activeItem?._hasFocus()){let n=e.toArray(),o=Math.max(0,Math.min(n.length-1,t.activeItemIndex||0));n[o]&&!n[o].disabled?t.setActiveItem(o):t.setNextItemActive()}})}ngOnDestroy(){this._keyManager?.destroy(),this._directDescendantItems.destroy(),this.closed.complete(),this._firstItemFocusRef?.destroy(),clearTimeout(this._exitFallbackTimeout)}_hovered(){return this._directDescendantItems.changes.pipe(Q(this._directDescendantItems),pe(t=>q(...t.map(n=>n._hovered))))}addItem(e){}removeItem(e){}_handleKeydown(e){let t=e.keyCode,n=this._keyManager;switch(t){case 27:dt(e)||(e.preventDefault(),this.closed.emit("keydown"));break;case 37:this.parentMenu&&this.direction==="ltr"&&this.closed.emit("keydown");break;case 39:this.parentMenu&&this.direction==="rtl"&&this.closed.emit("keydown");break;default:(t===38||t===40)&&n.setFocusOrigin("keyboard"),n.onKeydown(e);return}}focusFirstItem(e="program"){this._firstItemFocusRef?.destroy(),this._firstItemFocusRef=Ue(()=>{let t=this._resolvePanel();if(!t||!t.contains(document.activeElement)){let n=this._keyManager;n.setFocusOrigin(e).setFirstItemActive(),!n.activeItem&&t&&t.focus()}},{injector:this._injector})}resetActiveItem(){this._keyManager.setActiveItem(-1)}setElevation(e){}setPositionClasses(e=this.xPosition,t=this.yPosition){this._classList=De(ce({},this._classList),{"mat-menu-before":e==="before","mat-menu-after":e==="after","mat-menu-above":t==="above","mat-menu-below":t==="below"}),this._changeDetectorRef.markForCheck()}_onAnimationDone(e){let t=e===me;(t||e===Oe)&&(t&&(clearTimeout(this._exitFallbackTimeout),this._exitFallbackTimeout=void 0),this._animationDone.next(t?"void":"enter"),this._isAnimating.set(!1))}_onAnimationStart(e){(e===Oe||e===me)&&this._isAnimating.set(!0)}_setIsOpen(e){if(this._panelAnimationState=e?"enter":"void",e){if(this._keyManager.activeItemIndex===0){let t=this._resolvePanel();t&&(t.scrollTop=0)}}else this._animationsDisabled||(this._exitFallbackTimeout=setTimeout(()=>this._onAnimationDone(me),200));this._animationsDisabled&&setTimeout(()=>{this._onAnimationDone(e?Oe:me)}),this._changeDetectorRef.markForCheck()}_updateDirectDescendants(){this._allItems.changes.pipe(Q(this._allItems)).subscribe(e=>{this._directDescendantItems.reset(e.filter(t=>t._parentMenu===this)),this._directDescendantItems.notifyOnChanges()})}_resolvePanel(){let e=null;return this._directDescendantItems.length&&(e=this._directDescendantItems.first._getHostElement().closest('[role="menu"]')),e}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=k({type:i,selectors:[["mat-menu"]],contentQueries:function(t,n,o){if(t&1&&($(o,Jt,5),$(o,H,5),$(o,H,4)),t&2){let d;V(d=W())&&(n.lazyContent=d.first),V(d=W())&&(n._allItems=d),V(d=W())&&(n.items=d)}},viewQuery:function(t,n){if(t&1&&$e(ge,5),t&2){let o;V(o=W())&&(n.templateRef=o.first)}},hostVars:3,hostBindings:function(t,n){t&2&&N("aria-label",null)("aria-labelledby",null)("aria-describedby",null)},inputs:{backdropClass:"backdropClass",ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],ariaDescribedby:[0,"aria-describedby","ariaDescribedby"],xPosition:"xPosition",yPosition:"yPosition",overlapTrigger:[2,"overlapTrigger","overlapTrigger",U],hasBackdrop:[2,"hasBackdrop","hasBackdrop",e=>e==null?null:U(e)],panelClass:[0,"class","panelClass"],classList:"classList"},outputs:{closed:"closed",close:"close"},exportAs:["matMenu"],features:[ye([{provide:Se,useExisting:i}])],ngContentSelectors:hn,decls:1,vars:0,consts:[["tabindex","-1","role","menu",1,"mat-mdc-menu-panel",3,"click","animationstart","animationend","animationcancel","id"],[1,"mat-mdc-menu-content"]],template:function(t,n){t&1&&(Me(),ze(0,fn,3,12,"ng-template"))},styles:[`mat-menu{display:none}.mat-mdc-menu-content{margin:0;padding:8px 0;outline:0}.mat-mdc-menu-content,.mat-mdc-menu-content .mat-mdc-menu-item .mat-mdc-menu-item-text{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;flex:1;white-space:normal;font-family:var(--mat-menu-item-label-text-font, var(--mat-sys-label-large-font));line-height:var(--mat-menu-item-label-text-line-height, var(--mat-sys-label-large-line-height));font-size:var(--mat-menu-item-label-text-size, var(--mat-sys-label-large-size));letter-spacing:var(--mat-menu-item-label-text-tracking, var(--mat-sys-label-large-tracking));font-weight:var(--mat-menu-item-label-text-weight, var(--mat-sys-label-large-weight))}@keyframes _mat-menu-enter{from{opacity:0;transform:scale(0.8)}to{opacity:1;transform:none}}@keyframes _mat-menu-exit{from{opacity:1}to{opacity:0}}.mat-mdc-menu-panel{min-width:112px;max-width:280px;overflow:auto;box-sizing:border-box;outline:0;animation:_mat-menu-enter 120ms cubic-bezier(0, 0, 0.2, 1);border-radius:var(--mat-menu-container-shape, var(--mat-sys-corner-extra-small));background-color:var(--mat-menu-container-color, var(--mat-sys-surface-container));box-shadow:var(--mat-menu-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));will-change:transform,opacity}.mat-mdc-menu-panel.mat-menu-panel-exit-animation{animation:_mat-menu-exit 100ms 25ms linear forwards}.mat-mdc-menu-panel.mat-menu-panel-animations-disabled{animation:none}.mat-mdc-menu-panel.mat-menu-panel-animating{pointer-events:none}.mat-mdc-menu-panel.mat-menu-panel-animating:has(.mat-mdc-menu-content:empty){display:none}@media(forced-colors: active){.mat-mdc-menu-panel{outline:solid 1px}}.mat-mdc-menu-panel .mat-divider{color:var(--mat-menu-divider-color, var(--mat-sys-surface-variant));margin-bottom:var(--mat-menu-divider-bottom-spacing, 8px);margin-top:var(--mat-menu-divider-top-spacing, 8px)}.mat-mdc-menu-item{display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;padding:0;cursor:pointer;width:100%;text-align:left;box-sizing:border-box;color:inherit;font-size:inherit;background:none;text-decoration:none;margin:0;min-height:48px;padding-left:var(--mat-menu-item-leading-spacing, 12px);padding-right:var(--mat-menu-item-trailing-spacing, 12px);-webkit-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.mat-mdc-menu-item::-moz-focus-inner{border:0}[dir=rtl] .mat-mdc-menu-item{padding-left:var(--mat-menu-item-trailing-spacing, 12px);padding-right:var(--mat-menu-item-leading-spacing, 12px)}.mat-mdc-menu-item:has(.material-icons,mat-icon,[matButtonIcon]){padding-left:var(--mat-menu-item-with-icon-leading-spacing, 12px);padding-right:var(--mat-menu-item-with-icon-trailing-spacing, 12px)}[dir=rtl] .mat-mdc-menu-item:has(.material-icons,mat-icon,[matButtonIcon]){padding-left:var(--mat-menu-item-with-icon-trailing-spacing, 12px);padding-right:var(--mat-menu-item-with-icon-leading-spacing, 12px)}.mat-mdc-menu-item,.mat-mdc-menu-item:visited,.mat-mdc-menu-item:link{color:var(--mat-menu-item-label-text-color, var(--mat-sys-on-surface))}.mat-mdc-menu-item .mat-icon-no-color,.mat-mdc-menu-item .mat-mdc-menu-submenu-icon{color:var(--mat-menu-item-icon-color, var(--mat-sys-on-surface-variant))}.mat-mdc-menu-item[disabled]{cursor:default;opacity:.38}.mat-mdc-menu-item[disabled]::after{display:block;position:absolute;content:"";top:0;left:0;bottom:0;right:0}.mat-mdc-menu-item:focus{outline:0}.mat-mdc-menu-item .mat-icon{flex-shrink:0;margin-right:var(--mat-menu-item-spacing, 12px);height:var(--mat-menu-item-icon-size, 24px);width:var(--mat-menu-item-icon-size, 24px)}[dir=rtl] .mat-mdc-menu-item{text-align:right}[dir=rtl] .mat-mdc-menu-item .mat-icon{margin-right:0;margin-left:var(--mat-menu-item-spacing, 12px)}.mat-mdc-menu-item:not([disabled]):hover{background-color:var(--mat-menu-item-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mat-mdc-menu-item:not([disabled]).cdk-program-focused,.mat-mdc-menu-item:not([disabled]).cdk-keyboard-focused,.mat-mdc-menu-item:not([disabled]).mat-mdc-menu-item-highlighted{background-color:var(--mat-menu-item-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent))}@media(forced-colors: active){.mat-mdc-menu-item{margin-top:1px}}.mat-mdc-menu-submenu-icon{width:var(--mat-menu-item-icon-size, 24px);height:10px;fill:currentColor;padding-left:var(--mat-menu-item-spacing, 12px)}[dir=rtl] .mat-mdc-menu-submenu-icon{padding-right:var(--mat-menu-item-spacing, 12px);padding-left:0}[dir=rtl] .mat-mdc-menu-submenu-icon polygon{transform:scaleX(-1);transform-origin:center}@media(forced-colors: active){.mat-mdc-menu-submenu-icon{fill:CanvasText}}.mat-mdc-menu-item .mat-mdc-menu-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}
2
+ `],encapsulation:2,changeDetection:0})}return i})(),en=new B("mat-menu-scroll-strategy",{providedIn:"root",factory:()=>{let i=m(T);return()=>ke(i)}});function Cn(i){let a=m(T);return()=>ke(a)}var yn={provide:en,deps:[],useFactory:Cn};var I=new WeakMap,vn=(()=>{class i{_canHaveBackdrop;_element=m(G);_viewContainerRef=m(_e);_menuItemInstance=m(H,{optional:!0,self:!0});_dir=m(_t,{optional:!0});_focusMonitor=m(ve);_ngZone=m(je);_injector=m(T);_scrollStrategy=m(en);_changeDetectorRef=m(j);_animationsDisabled=xe();_portal;_overlayRef=null;_menuOpen=!1;_closingActionsSubscription=X.EMPTY;_menuCloseSubscription=X.EMPTY;_pendingRemoval;_parentMaterialMenu;_parentInnerPadding;_openedBy=void 0;get _menu(){return this._menuInternal}set _menu(e){e!==this._menuInternal&&(this._menuInternal=e,this._menuCloseSubscription.unsubscribe(),e&&(this._parentMaterialMenu,this._menuCloseSubscription=e.close.subscribe(t=>{this._destroyMenu(t),(t==="click"||t==="tab")&&this._parentMaterialMenu&&this._parentMaterialMenu.closed.emit(t)})),this._menuItemInstance?._setTriggersSubmenu(this._triggersSubmenu()))}_menuInternal;constructor(e){this._canHaveBackdrop=e;let t=m(Se,{optional:!0});this._parentMaterialMenu=t instanceof R?t:void 0}ngOnDestroy(){this._menu&&this._ownsMenu(this._menu)&&I.delete(this._menu),this._pendingRemoval?.unsubscribe(),this._menuCloseSubscription.unsubscribe(),this._closingActionsSubscription.unsubscribe(),this._overlayRef&&(this._overlayRef.dispose(),this._overlayRef=null)}get menuOpen(){return this._menuOpen}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}_triggersSubmenu(){return!!(this._menuItemInstance&&this._parentMaterialMenu&&this._menu)}_closeMenu(){this._menu?.close.emit()}_openMenu(e){let t=this._menu;if(this._menuOpen||!t)return;this._pendingRemoval?.unsubscribe();let n=I.get(t);I.set(t,this),n&&n!==this&&n._closeMenu();let o=this._createOverlay(t),d=o.getConfig(),b=d.positionStrategy;this._setPosition(t,b),this._canHaveBackdrop?d.hasBackdrop=t.hasBackdrop==null?!this._triggersSubmenu():t.hasBackdrop:d.hasBackdrop=!1,o.hasAttached()||(o.attach(this._getPortal(t)),t.lazyContent?.attach(this.menuData)),this._closingActionsSubscription=this._menuClosingActions().subscribe(()=>this._closeMenu()),t.parentMenu=this._triggersSubmenu()?this._parentMaterialMenu:void 0,t.direction=this.dir,e&&t.focusFirstItem(this._openedBy||"program"),this._setIsMenuOpen(!0),t instanceof R&&(t._setIsOpen(!0),t._directDescendantItems.changes.pipe(Re(t.close)).subscribe(()=>{b.withLockedPosition(!1).reapplyLastPosition(),b.withLockedPosition(!0)}))}focus(e,t){this._focusMonitor&&e?this._focusMonitor.focusVia(this._element,e,t):this._element.nativeElement.focus(t)}_destroyMenu(e){let t=this._overlayRef,n=this._menu;!t||!this.menuOpen||(this._closingActionsSubscription.unsubscribe(),this._pendingRemoval?.unsubscribe(),n instanceof R&&this._ownsMenu(n)?(this._pendingRemoval=n._animationDone.pipe(Ie(1)).subscribe(()=>{t.detach(),I.has(n)||n.lazyContent?.detach()}),n._setIsOpen(!1)):(t.detach(),n?.lazyContent?.detach()),n&&this._ownsMenu(n)&&I.delete(n),this.restoreFocus&&(e==="keydown"||!this._openedBy||!this._triggersSubmenu())&&this.focus(this._openedBy),this._openedBy=void 0,this._setIsMenuOpen(!1))}_setIsMenuOpen(e){e!==this._menuOpen&&(this._menuOpen=e,this._menuOpen?this.menuOpened.emit():this.menuClosed.emit(),this._triggersSubmenu()&&this._menuItemInstance._setHighlighted(e),this._changeDetectorRef.markForCheck())}_createOverlay(e){if(!this._overlayRef){let t=this._getOverlayConfig(e);this._subscribeToPositions(e,t.positionStrategy),this._overlayRef=vt(this._injector,t),this._overlayRef.keydownEvents().subscribe(n=>{this._menu instanceof R&&this._menu._handleKeydown(n)})}return this._overlayRef}_getOverlayConfig(e){return new Ct({positionStrategy:yt(this._injector,this._getOverlayOrigin()).withLockedPosition().withGrowAfterOpen().withTransformOriginOn(".mat-menu-panel, .mat-mdc-menu-panel"),backdropClass:e.backdropClass||"cdk-overlay-transparent-backdrop",panelClass:e.overlayPanelClass,scrollStrategy:this._scrollStrategy(),direction:this._dir||"ltr",disableAnimations:this._animationsDisabled})}_subscribeToPositions(e,t){e.setPositionClasses&&t.positionChanges.subscribe(n=>{this._ngZone.run(()=>{let o=n.connectionPair.overlayX==="start"?"after":"before",d=n.connectionPair.overlayY==="top"?"below":"above";e.setPositionClasses(o,d)})})}_setPosition(e,t){let[n,o]=e.xPosition==="before"?["end","start"]:["start","end"],[d,b]=e.yPosition==="above"?["bottom","top"]:["top","bottom"],[h,v]=[d,b],[w,F]=[n,o],A=0;if(this._triggersSubmenu()){if(F=n=e.xPosition==="before"?"start":"end",o=w=n==="end"?"start":"end",this._parentMaterialMenu){if(this._parentInnerPadding==null){let Ee=this._parentMaterialMenu.items.first;this._parentInnerPadding=Ee?Ee._getHostElement().offsetTop:0}A=d==="bottom"?this._parentInnerPadding:-this._parentInnerPadding}}else e.overlapTrigger||(h=d==="top"?"bottom":"top",v=b==="top"?"bottom":"top");t.withPositions([{originX:n,originY:h,overlayX:w,overlayY:d,offsetY:A},{originX:o,originY:h,overlayX:F,overlayY:d,offsetY:A},{originX:n,originY:v,overlayX:w,overlayY:b,offsetY:-A},{originX:o,originY:v,overlayX:F,overlayY:b,offsetY:-A}])}_menuClosingActions(){let e=this._getOutsideClickStream(this._overlayRef),t=this._overlayRef.detachments(),n=this._parentMaterialMenu?this._parentMaterialMenu.closed:de(),o=this._parentMaterialMenu?this._parentMaterialMenu._hovered().pipe(Te(d=>this._menuOpen&&d!==this._menuItemInstance)):de();return q(e,n,o,t)}_getPortal(e){return(!this._portal||this._portal.templateRef!==e.templateRef)&&(this._portal=new we(e.templateRef,this._viewContainerRef)),this._portal}_ownsMenu(e){return I.get(e)===this}static \u0275fac=function(t){Ne()};static \u0275dir=K({type:i})}return i})(),tn=(()=>{class i extends vn{_cleanupTouchstart;_hoverSubscription=X.EMPTY;get _deprecatedMatMenuTriggerFor(){return this.menu}set _deprecatedMatMenuTriggerFor(e){this.menu=e}get menu(){return this._menu}set menu(e){this._menu=e}menuData;restoreFocus=!0;menuOpened=new Z;onMenuOpen=this.menuOpened;menuClosed=new Z;onMenuClose=this.menuClosed;constructor(){super(!0);let e=m(Be);this._cleanupTouchstart=e.listen(this._element.nativeElement,"touchstart",t=>{lt(t)||(this._openedBy="touch")},{passive:!0})}triggersSubmenu(){return super._triggersSubmenu()}toggleMenu(){return this.menuOpen?this.closeMenu():this.openMenu()}openMenu(){this._openMenu(!0)}closeMenu(){this._closeMenu()}updatePosition(){this._overlayRef?.updatePosition()}ngAfterContentInit(){this._handleHover()}ngOnDestroy(){super.ngOnDestroy(),this._cleanupTouchstart(),this._hoverSubscription.unsubscribe()}_getOverlayOrigin(){return this._element}_getOutsideClickStream(e){return e.backdropClick()}_handleMousedown(e){st(e)||(this._openedBy=e.button===0?"mouse":void 0,this.triggersSubmenu()&&e.preventDefault())}_handleKeydown(e){let t=e.keyCode;(t===13||t===32)&&(this._openedBy="keyboard"),this.triggersSubmenu()&&(t===39&&this.dir==="ltr"||t===37&&this.dir==="rtl")&&(this._openedBy="keyboard",this.openMenu())}_handleClick(e){this.triggersSubmenu()?(e.stopPropagation(),this.openMenu()):this.toggleMenu()}_handleHover(){this.triggersSubmenu()&&this._parentMaterialMenu&&(this._hoverSubscription=this._parentMaterialMenu._hovered().subscribe(e=>{e===this._menuItemInstance&&!e.disabled&&this._parentMaterialMenu?._panelAnimationState!=="void"&&(this._openedBy="mouse",this._openMenu(!1))}))}static \u0275fac=function(t){return new(t||i)};static \u0275dir=K({type:i,selectors:[["","mat-menu-trigger-for",""],["","matMenuTriggerFor",""]],hostAttrs:[1,"mat-mdc-menu-trigger"],hostVars:3,hostBindings:function(t,n){t&1&&_("click",function(d){return n._handleClick(d)})("mousedown",function(d){return n._handleMousedown(d)})("keydown",function(d){return n._handleKeydown(d)}),t&2&&N("aria-haspopup",n.menu?"menu":null)("aria-expanded",n.menuOpen)("aria-controls",n.menuOpen?n.menu==null?null:n.menu.panelId:null)},inputs:{_deprecatedMatMenuTriggerFor:[0,"mat-menu-trigger-for","_deprecatedMatMenuTriggerFor"],menu:[0,"matMenuTriggerFor","menu"],menuData:[0,"matMenuTriggerData","menuData"],restoreFocus:[0,"matMenuTriggerRestoreFocus","restoreFocus"]},outputs:{menuOpened:"menuOpened",onMenuOpen:"onMenuOpen",menuClosed:"menuClosed",onMenuClose:"onMenuClose"},exportAs:["matMenuTrigger"],features:[We]})}return i})();var nn=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=Ve({type:i});static \u0275inj=Fe({providers:[yn],imports:[ht,Pe,xt,Mt,Pe]})}return i})(),on={transformMenu:{type:7,name:"transformMenu",definitions:[{type:0,name:"void",styles:{type:6,styles:{opacity:0,transform:"scale(0.8)"},offset:null}},{type:1,expr:"void => enter",animation:{type:4,styles:{type:6,styles:{opacity:1,transform:"scale(1)"},offset:null},timings:"120ms cubic-bezier(0, 0, 0.2, 1)"},options:null},{type:1,expr:"* => void",animation:{type:4,styles:{type:6,styles:{opacity:0},offset:null},timings:"100ms 25ms linear"},options:null}],options:{}},fadeInItems:{type:7,name:"fadeInItems",definitions:[{type:0,name:"showing",styles:{type:6,styles:{opacity:1},offset:null}},{type:1,expr:"void => *",animation:[{type:6,styles:{opacity:0},offset:null},{type:4,styles:null,timings:"400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)"}],options:null}],options:{}}},gi=on.fadeInItems,_i=on.transformMenu;function Sn(i,a){if(i&1){let e=f();r(0,"div",9)(1,"mat-form-field",18)(2,"mat-label"),l(3),s(),r(4,"textarea",19),D("ngModelChange",function(n){let o=u(e).$index,d=p();return E(d.commands[o],n)||(d.commands[o]=n),g(n)}),s(),r(5,"mat-hint"),l(6,"Use placeholder for dynamic values"),s()(),r(7,"button",20),_("click",function(){let n=u(e).$index,o=p();return g(o.removeCommand(n))}),r(8,"mat-icon"),l(9,"delete"),s()()()}if(i&2){let e=a.$index,t=p();c(3),z("Prompt ",e+1),c(),S("ngModel",t.commands[e]),c(3),y("disabled",t.commands.length===1)}}function En(i,a){if(i&1){let e=f();r(0,"div",10)(1,"h3"),l(2,"Save to"),s(),r(3,"div",21)(4,"label",22)(5,"input",23),D("ngModelChange",function(n){u(e);let o=p();return E(o.source,n)||(o.source=n),g(n)}),s(),r(6,"div",24)(7,"div",25)(8,"span",26),l(9,"\u{1F464}"),s(),r(10,"span",27),l(11,"Local"),s()(),r(12,"p",28),l(13,"Personal prompt in ~/.coday/... (not committed)"),s()()(),r(14,"label",22)(15,"input",29),D("ngModelChange",function(n){u(e);let o=p();return E(o.source,n)||(o.source=n),g(n)}),s(),r(16,"div",24)(17,"div",25)(18,"span",26),l(19,"\u{1F4E6}"),s(),r(20,"span",27),l(21,"Project"),s()(),r(22,"p",28),l(23,"Shared prompt in ./prompts/ (committable)"),s()()()(),r(24,"p",30),l(25,"Storage location is permanent and cannot be changed after creation"),s()()}if(i&2){let e=p();c(4),O("selected",e.source==="local"),c(),S("ngModel",e.source),c(9),O("selected",e.source==="project"),c(),S("ngModel",e.source)}}function Dn(i,a){if(i&1&&(r(0,"div",11)(1,"h3"),l(2,"Storage Location"),s(),r(3,"div",31)(4,"span",26),l(5),s(),r(6,"span",27),l(7),s()(),r(8,"p",30),l(9,"Cannot be changed after creation"),s()()),i&2){let e=p();c(3),O("badge-local",e.source==="local")("badge-project",e.source==="project"),c(2),P(e.source==="local"?"\u{1F464}":"\u{1F4E6}"),c(2),P(e.source==="local"?"Local":"Project")}}function Tn(i,a){if(i&1){let e=f();r(0,"div",12)(1,"label",32)(2,"input",33),D("ngModelChange",function(n){u(e);let o=p();return E(o.webhookEnabled,n)||(o.webhookEnabled=n),g(n)}),s(),r(3,"span"),l(4,"Enable webhook"),s()(),r(5,"p",30),l(6,"Enable webhook to trigger this prompt via HTTP POST"),s()()}if(i&2){let e=p();c(2),S("ngModel",e.webhookEnabled)}}function In(i,a){if(i&1){let e=f();r(0,"div",13)(1,"div",34)(2,"mat-icon",35),l(3,"link"),s(),r(4,"h4"),l(5,"Webhook URL"),s()(),r(6,"div",36)(7,"p",37),l(8),s(),r(9,"button",38),_("click",function(){u(e);let n=p();return g(n.copyWebhookUrl())}),r(10,"mat-icon"),l(11,"content_copy"),s(),r(12,"span"),l(13,"Copy URL"),s()()(),r(14,"p",30),l(15,"Use this URL to trigger the prompt via HTTP POST"),s()()}if(i&2){let e=p();c(8),P(e.getWebhookUrl())}}function Rn(i,a){if(i&1&&(r(0,"div",14)(1,"mat-icon"),l(2,"error"),s(),r(3,"span"),l(4),s()()),i&2){let e=p();c(4),P(e.errorMessage)}}var Y=class i{promptApi=m(se);dialogRef=m(kt);configApi=m(le);snackBar=m(Pt);name="";description="";commands=[""];webhookEnabled=!1;threadLifetime="";source="local";isSaving=!1;errorMessage="";isAdmin=!1;isEditMode=!1;promptId="";data=m(Ot);constructor(){this.isEditMode=this.data.mode==="edit"}ngOnInit(){this.configApi.getUserConfig().subscribe({next:a=>{this.isAdmin=a.groups?.includes("CODAY_ADMIN")??!1},error:a=>{console.error("[PROMPT_FORM] Error loading user config:",a),this.isAdmin=!1}}),this.isEditMode&&this.data.prompt&&(this.promptId=this.data.prompt.id,this.name=this.data.prompt.name,this.description=this.data.prompt.description,this.commands=[...this.data.prompt.commands],this.webhookEnabled=this.data.prompt.webhookEnabled,this.source=this.data.prompt.source)}addCommand(){this.commands.push("")}removeCommand(a){this.commands.length>1&&this.commands.splice(a,1)}trackByIndex(a){return a}normalizeName(){this.name=this.name.replace(/[\s_.,;:!?()[\]{}]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase()}validateForm(){return this.name.trim()?this.description.trim()?this.commands.filter(e=>e.trim()).length===0?(this.errorMessage="At least one command is required",!1):!0:(this.errorMessage="Description is required",!1):(this.errorMessage="Name is required",!1)}save(){if(this.errorMessage="",!this.validateForm())return;let a=this.commands.filter(e=>e.trim());if(this.isSaving=!0,this.isEditMode&&this.data.prompt){let e={name:this.name.trim(),description:this.description.trim(),commands:a,webhookEnabled:this.webhookEnabled};this.promptApi.updatePrompt(this.data.prompt.id,e).subscribe({next:()=>{this.isSaving=!1,this.dialogRef.close(!0)},error:t=>{console.error("Error updating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to update prompt",this.isSaving=!1}})}else{let e={name:this.name.trim(),description:this.description.trim(),commands:a,webhookEnabled:this.webhookEnabled,source:this.source};this.promptApi.createPrompt(e).subscribe({next:()=>{this.isSaving=!1,this.dialogRef.close(!0)},error:t=>{console.error("Error creating prompt:",t),this.errorMessage=t?.error?.error||t?.message||"Failed to create prompt",this.isSaving=!1}})}}cancel(){this.dialogRef.close(!1)}getWebhookUrl(){return`${window.location.origin}/api/webhooks/${this.promptId}/execute`}copyWebhookUrl(){if(!this.webhookEnabled){this.snackBar.open("Webhook is not enabled","Close",{duration:3e3});return}if(!this.promptId){this.snackBar.open("Prompt must be saved before getting webhook URL","Close",{duration:3e3});return}let a=this.getWebhookUrl();navigator.clipboard.writeText(a).then(()=>{this.snackBar.open("Webhook URL copied to clipboard!","Close",{duration:3e3})}).catch(e=>{console.error("Failed to copy webhook URL:",e),this.snackBar.open("Failed to copy URL","Close",{duration:3e3})})}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=k({type:i,selectors:[["app-prompt-form"]],decls:36,vars:11,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-prompt","required","",3,"ngModelChange","blur","ngModel"],["matInput","","placeholder","What does this prompt do?","rows","3","required","",3,"ngModelChange","ngModel"],[1,"commands-section"],[1,"section-header"],["mat-icon-button","","type","button","title","Add command",3,"click"],[1,"commands-list"],[1,"command-item"],[1,"source-section"],[1,"source-display"],[1,"webhook-section"],[1,"webhook-url-section"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"command-field"],["matInput","","placeholder","Enter command with placeholders like \\{\\{key\\}\\}","rows","2",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove command",1,"remove-btn",3,"click","disabled"],[1,"source-options"],[1,"source-option"],["type","radio","name","source","value","local",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","source","value","project",3,"ngModelChange","ngModel"],[1,"hint"],[1,"source-badge"],[1,"checkbox-label"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"webhook-url-header"],[1,"webhook-icon"],[1,"webhook-url-content"],[1,"url-text"],["mat-raised-button","","color","accent","type","button",3,"click"]],template:function(e,t){e&1&&(r(0,"h2",0),l(1),s(),r(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),l(6,"Name"),s(),r(7,"input",3),D("ngModelChange",function(o){return E(t.name,o)||(t.name=o),o}),_("blur",function(){return t.normalizeName()}),s(),r(8,"mat-hint"),l(9,"A descriptive name (spaces and punctuation will be replaced with hyphens), will be used as command name"),s()(),r(10,"mat-form-field",2)(11,"mat-label"),l(12,"Description"),s(),r(13,"textarea",4),D("ngModelChange",function(o){return E(t.description,o)||(t.description=o),o}),s(),r(14,"mat-hint"),l(15,"Explain the purpose of this prompt, helps for searchability"),s()(),r(16,"div",5)(17,"div",6)(18,"h3"),l(19,"Prompts"),s(),r(20,"button",7),_("click",function(){return t.addCommand()}),r(21,"mat-icon"),l(22,"add"),s()()(),r(23,"div",8),Xe(24,Sn,10,3,"div",9,Ye),s()(),M(26,En,26,6,"div",10),M(27,Dn,10,6,"div",11),M(28,Tn,7,1,"div",12),M(29,In,16,1,"div",13),M(30,Rn,5,1,"div",14),s()(),r(31,"mat-dialog-actions",15)(32,"button",16),_("click",function(){return t.cancel()}),l(33,"Cancel"),s(),r(34,"button",17),_("click",function(){return t.save()}),l(35),s()()),e&2&&(c(),P(t.isEditMode?"Edit Prompt":"Create Prompt"),c(6),S("ngModel",t.name),c(6),S("ngModel",t.description),c(11),qe(t.commands),c(2),C(t.isEditMode?-1:26),c(),C(t.isEditMode?27:-1),c(),C(t.isAdmin?28:-1),c(),C(t.isEditMode&&t.webhookEnabled&&t.isAdmin?29:-1),c(),C(t.errorMessage?30:-1),c(2),y("disabled",t.isSaving),c(2),y("disabled",t.isSaving),c(),z(" ",t.isSaving?"Saving...":"Save"," "))},dependencies:[rt,ae,Bt,Lt,Nt,oe,Vt,re,It,Et,Tt,Dt,te,ft,ee,Yt,Ht,jt,Wt,zt,Ut,ie,ne,wt],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:500px}@media (max-width: 768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.commands-section[_ngcontent-%COMP%] .section-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.commands-section[_ngcontent-%COMP%] .commands-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .command-field[_ngcontent-%COMP%]{flex:1}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]{margin-top:8px}.commands-section[_ngcontent-%COMP%] .command-item[_ngcontent-%COMP%] .remove-btn[_ngcontent-%COMP%]:disabled{opacity:.3;cursor:not-allowed}.webhook-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{width:18px;height:18px;cursor:pointer}.webhook-section[_ngcontent-%COMP%] .checkbox-label[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.95rem}.webhook-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:.5rem 0 0;font-size:.85rem;color:var(--color-text-secondary)}.webhook-url-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.75rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] .webhook-icon[_ngcontent-%COMP%]{color:var(--color-primary)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-header[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%]{display:flex;align-items:center;gap:1rem;margin-bottom:.5rem}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] .url-text[_ngcontent-%COMP%]{flex:1;margin:0;padding:.75rem;background:var(--color-bg);border:1px solid var(--color-border);border-radius:4px;font-family:monospace;font-size:.85rem;word-break:break-all;color:var(--color-text)}.webhook-url-section[_ngcontent-%COMP%] .webhook-url-content[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{white-space:nowrap;display:flex;align-items:center;gap:.5rem}.webhook-url-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary)}.error-message[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.75rem;background:#f443361a;border:1px solid var(--color-error);border-radius:4px;color:var(--color-error)}.error-message[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.error-message[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-section[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 1rem;font-size:1rem;font-weight:600}.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.75rem}@media (max-width: 768px){.source-section[_ngcontent-%COMP%] .source-options[_ngcontent-%COMP%]{flex-direction:column}}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]{flex:1;display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:var(--color-bg);border:2px solid var(--color-border);border-radius:8px;cursor:pointer;transition:all .2s ease}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.source-section[_ngcontent-%COMP%] .source-option.selected[_ngcontent-%COMP%]{border-color:var(--color-primary);background:var(--color-bg-hover);box-shadow:0 0 0 1px var(--color-primary)}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-section[_ngcontent-%COMP%] .source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.thread-lifetime-disabled[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.75rem;padding:1rem;background:#2196f30d;border:1px solid rgba(33,150,243,.2);border-radius:8px;margin-bottom:1rem}.thread-lifetime-disabled[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:#2196f3cc;font-size:1.25rem;width:1.25rem;height:1.25rem;margin-top:2px}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;flex:1}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{font-size:.95rem;color:var(--color-text)}.thread-lifetime-disabled[_ngcontent-%COMP%] p[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{display:block;margin-top:.25rem;font-size:.85rem;color:var(--color-text-secondary);line-height:1.4}.source-display[_ngcontent-%COMP%]{padding:1rem;background:var(--color-surface);border-radius:8px;border:1px solid var(--color-border)}.source-display[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:1rem;font-weight:600}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500;margin-bottom:.5rem}.source-display[_ngcontent-%COMP%] .source-badge[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.1rem}.source-display[_ngcontent-%COMP%] .source-badge.badge-local[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-display[_ngcontent-%COMP%] .source-badge.badge-project[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.source-display[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}"]})};var Fn=()=>[],An=i=>({id:i});function Ln(i,a){if(i&1&&(r(0,"div",6),l(1),s()),i&2){let e=p();c(),P(e.errorMessage())}}function Bn(i,a){if(i&1){let e=f();r(0,"ds-entity-card",8),_("selected",function(n){u(e);let o=p();return g(o.onEdit(n))}),Ge(1,9),r(2,"button",10),_("click",function(n){return u(e),g(n.stopPropagation())}),r(3,"mat-icon"),l(4,"more_vert"),s()(),Ke(),s()}if(i&2){let e=a.$implicit;p();let t=Ce(11);y("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??tt(6,Fn)),c(2),y("matMenuTriggerFor",t)("matMenuTriggerData",nt(7,An,e.id))}}function Nn(i,a){if(i&1){let e=f();r(0,"button",11),_("click",function(){u(e);let n=p().id,o=p();return g(o.onToggleWebhook(n))}),r(1,"mat-icon"),l(2),s(),l(3),s()}if(i&2){let e=p().id,t=p();c(2),P(t.isWebhookEnabled(e)?"link_off":"link"),c(),z(" ",t.isWebhookEnabled(e)?"Disable webhook":"Enable webhook"," ")}}function Vn(i,a){if(i&1){let e=f();r(0,"button",11),_("click",function(){let n=u(e).id,o=p();return g(o.onEdit(n))}),r(1,"mat-icon"),l(2,"edit"),s(),l(3," Edit "),s(),M(4,Nn,4,2,"button",12),r(5,"button",13),_("click",function(){let n=u(e).id,o=p();return g(o.onDelete(n))}),r(6,"mat-icon"),l(7,"delete"),s(),l(8," Delete "),s()}if(i&2){let e=p();c(4),C(e.isAdmin()?4:-1)}}var rn="system",an=class i{promptApi=m(se);configApi=m(le);projectState=m(Rt);dialog=m(St);router=m(at);prompts=x([]);isLoading=x(!1);errorMessage=x(null);showOnlyMine=x(!0);isAdmin=x(!1);currentUsername=x("");promptItems=ot(()=>{let a=this.prompts(),e=this.currentUsername(),n=this.showOnlyMine()&&e?a.filter(h=>this.isMyPrompt(h)):a,d=[...new Set(n.map(h=>h.createdBy))].sort((h,v)=>h===e&&v!==e?-1:v===e&&h!==e||h===rn?1:v===rn?-1:h.localeCompare(v)),b=[];for(let h of d){let v=h===e?`${h} (you)`:h;for(let w of n.filter(F=>F.createdBy===h))b.push({id:w.id,name:w.name,description:w.description,badges:this.buildBadges(w),groupKey:h,groupLabel:v})}return b});ngOnInit(){this.configApi.getUserConfig().subscribe({next:a=>{this.isAdmin.set(a.groups?.includes("CODAY_ADMIN")??!1),this.currentUsername.set(a.username??"")},error:()=>this.isAdmin.set(!1)}),this.loadPrompts()}loadPrompts(){this.isLoading.set(!0),this.promptApi.listPrompts().subscribe({next:a=>{this.prompts.set(a.filter(e=>!e.id.startsWith("builtin"))),this.isLoading.set(!1)},error:a=>{this.errorMessage.set(a?.error?.error??"Failed to load prompts"),this.isLoading.set(!1)}})}onBack(){let a=this.projectState.getSelectedProjectId();this.router.navigate(a?["project",a]:["/"])}onCreate(){this.dialog.open(Y,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadPrompts()})}onEdit(a){this.promptApi.getPrompt(a).subscribe({next:e=>{this.dialog.open(Y,{width:"700px",maxHeight:"90vh",data:{mode:"edit",prompt:e}}).afterClosed().subscribe(n=>{n&&this.loadPrompts()})},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load prompt")})}onDelete(a){confirm("Are you sure you want to delete this prompt?")&&this.promptApi.deletePrompt(a).subscribe({next:()=>this.loadPrompts(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete prompt")})}onToggleWebhook(a){let e=this.prompts().find(n=>n.id===a);if(!e)return;(e.webhookEnabled?this.promptApi.disableWebhook(a):this.promptApi.enableWebhook(a)).subscribe({next:()=>this.loadPrompts(),error:n=>this.errorMessage.set(n?.error?.error??"Failed to toggle webhook")})}isWebhookEnabled(a){return this.prompts().find(e=>e.id===a)?.webhookEnabled??!1}isMyPrompt(a){let e=t=>t.replace(/[.\s]+/g,"_").toLowerCase();return e(a.createdBy)===e(this.currentUsername())}buildBadges(a){let e=[];return a.source==="local"?e.push({label:"local",variant:"info"}):e.push({label:"project",variant:"success"}),a.webhookEnabled&&e.push({label:"webhook",variant:"warning"}),e}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=k({type:i,selectors:[["app-prompt-list"]],decls:13,vars:5,consts:[["promptCard",""],["cardMenu","matMenu"],[1,"prompt-list-page"],["title","Prompts","cardMinWidth","320px","contentMaxWidth","1400px","searchPlaceholder","Filter prompts\u2026","emptyMessage","No prompts found.",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],["toolbar-extras","","color","primary",1,"prompt-list__mine-toggle",3,"ngModelChange","ngModel"],[1,"prompt-list__error"],["matMenuContent",""],[3,"selected","id","name","description","badges"],["dsCardActions",""],["mat-icon-button","",3,"click","matMenuTriggerFor","matMenuTriggerData"],["mat-menu-item","",3,"click"],["mat-menu-item",""],["mat-menu-item","",1,"prompt-list__delete-item",3,"click"]],template:function(e,t){if(e&1){let n=f();r(0,"div",2)(1,"ds-entity-list",3),_("createRequested",function(){return u(n),g(t.onCreate())}),r(2,"button",4),_("click",function(){return u(n),g(t.onBack())}),r(3,"mat-icon"),l(4,"chevron_left"),s()(),r(5,"mat-slide-toggle",5),_("ngModelChange",function(d){return u(n),g(t.showOnlyMine.set(d))}),l(6," Mine "),s()(),M(7,Ln,2,1,"div",6),s(),he(8,Bn,5,9,"ng-template",null,0,it),r(10,"mat-menu",null,1),he(12,Vn,9,1,"ng-template",7),s()}if(e&2){let n=Ce(9);c(),y("items",t.promptItems())("showCreate",!0)("itemTemplate",n),c(4),y("ngModel",t.showOnlyMine()),c(2),C(t.errorMessage()?7:-1)}},dependencies:[Xt,At,Ft,te,ee,ie,ne,Qt,qt,nn,R,H,$t,tn,ae,oe,re],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.prompt-list__mine-toggle[_ngcontent-%COMP%]{flex-shrink:0;font-size:.875rem}.prompt-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.prompt-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.prompt-list__error[_ngcontent-%COMP%]{margin:1rem auto;max-width:900px;padding:.75rem 1rem;background:#dc262614;border:1px solid rgba(220,38,38,.25);border-radius:8px;color:var(--color-error, #ff3b30);font-size:.875rem}"]})};export{an as PromptListComponent};