| 4159 | `],encapsulation:2,changeDetection:0})}return i})();var $DA={provide:cs,useExisting:Va(()=>xR),multi:!0};var xR=(()=>{class i{_ngZone=w(We);_elementRef=w(ce);_cdr=w(Mt);_slider=w(_R);_platform=w(Qi);_listenerCleanups;get value(){return yn(this._hostElement.value,0)}set value(A){A===null&&(A=this._getDefaultValue()),A=isNaN(A)?0:A;let t=A+"";if(!this._hasSetInitialValue){this._initialValue=t;return}this._isActive||this._setValue(t)}_setValue(A){this._hostElement.value=A,this._updateThumbUIByValue(),this._slider._onValueChange(this),this._cdr.detectChanges(),this._slider._cdr.markForCheck()}valueChange=new FA;dragStart=new FA;dragEnd=new FA;get translateX(){return this._slider.min>=this._slider.max?(this._translateX=this._tickMarkOffset,this._translateX):(this._translateX===void 0&&(this._translateX=this._calcTranslateXByValue()),this._translateX)}set translateX(A){this._translateX=A}_translateX;thumbPosition=Ti.END;get min(){return yn(this._hostElement.min,0)}set min(A){this._hostElement.min=A+"",this._cdr.detectChanges()}get max(){return yn(this._hostElement.max,0)}set max(A){this._hostElement.max=A+"",this._cdr.detectChanges()}get step(){return yn(this._hostElement.step,0)}set step(A){this._hostElement.step=A+"",this._cdr.detectChanges()}get disabled(){return Qe(this._hostElement.disabled)}set disabled(A){this._hostElement.disabled=A,this._cdr.detectChanges(),this._slider.disabled!==this.disabled&&(this._slider.disabled=this.disabled)}get percentage(){return this._slider.min>=this._slider.max?this._slider._isRtl?1:0:(this.value-this._slider.min)/(this._slider.max-this._slider.min)}get fillPercentage(){return this._slider._cachedWidth?this._translateX===0?0:this.translateX/this._slider._cachedWidth:this._slider._isRtl?1:0}_hostElement=this._elementRef.nativeElement;_valuetext=mA("");_knobRadius=8;_tickMarkOffset=3;_isActive=!1;_isFocused=!1;_setIsFocused(A){this._isFocused=A}_hasSetInitialValue=!1;_initialValue;_formControl;_destroyed=new ne;_skipUIUpdate=!1;_onChangeFn;_onTouchedFn=()=>{};_isControlInitialized=!1;constructor(){let A=w(on);this._ngZone.runOutsideAngular(()=>{this._listenerCleanups=[A.listen(this._hostElement,"pointerdown",this._onPointerDown.bind(this)),A.listen(this._hostElement,"pointermove",this._onPointerMove.bind(this)),A.listen(this._hostElement,"pointerup",this._onPointerUp.bind(this))]})}ngOnDestroy(){this._listenerCleanups.forEach(A=>A()),this._destroyed.next(),this._destroyed.complete(),this.dragStart.complete(),this.dragEnd.complete()}initProps(){this._updateWidthInactive(),this.disabled!==this._slider.disabled&&(this._slider.disabled=!0),this.step=this._slider.step,this.min=this._slider.min,this.max=this._slider.max,this._initValue()}initUI(){this._updateThumbUIByValue()}_initValue(){this._hasSetInitialValue=!0,this._initialValue===void 0?this.value=this._getDefaultValue():(this._hostElement.value=this._initialValue,this._updateThumbUIByValue(),this._slider._onValueChange(this),this._cdr.detectChanges())}_getDefaultValue(){return this.min}_onBlur(){this._setIsFocused(!1),this._onTouchedFn()}_onFocus(){this._slider._setTransition(!1),this._slider._updateTrackUI(this),this._setIsFocused(!0)}_onChange(){this.valueChange.emit(this.value),this._isActive&&this._updateThumbUIByValue({withAnimation:!0})}_onInput(){this._onChangeFn?.(this.value),(this._slider.step||!this._isActive)&&this._updateThumbUIByValue({withAnimation:!0}),this._slider._onValueChange(this)}_onNgControlValueChange(){(!this._isActive||!this._isFocused)&&(this._slider._onValueChange(this),this._updateThumbUIByValue()),this._slider.disabled=this._formControl.disabled}_onPointerDown(A){if(!(this.disabled||A.button!==0)){if(this._platform.IOS){let t=this._slider._isCursorOnSliderThumb(A,this._slider._getThumb(this.thumbPosition)._hostElement.getBoundingClientRect());this._isActive=t,this._updateWidthActive(),this._slider._updateDimensions();return}this._isActive=!0,this._setIsFocused(!0),this._updateWidthActive(),this._slider._updateDimensions(),this._slider.step||this._updateThumbUIByPointerEvent(A,{withAnimation:!0}),this.disabled||(this._handleValueCorrection(A),this.dragStart.emit({source:this,parent:this._slider,value:this.value}))}}_handleValueCorrection(A){this._skipUIUpdate=!0,setTimeout(()=>{this._skipUIUpdate=!1,this._fixValue(A)},0)}_fixValue(A){let t=A.clientX-this._slider._cachedLeft,n=this._slider._cachedWidth,o=this._slider.step===0?1:this._slider.step,a=Math.floor((this._slider.max-this._slider.min)/o),r=this._slider._isRtl?1-t/n:t/n,l=Math.round(r*a)/a*(this._slider.max-this._slider.min)+this._slider.min,g=Math.round(l/o)*o,C=this.value;if(g===C){this._slider._onValueChange(this),this._slider.step>0?this._updateThumbUIByValue():this._updateThumbUIByPointerEvent(A,{withAnimation:this._slider._hasAnimation});return}this.value=g,this.valueChange.emit(this.value),this._onChangeFn?.(this.value),this._slider._onValueChange(this),this._slider.step>0?this._updateThumbUIByValue():this._updateThumbUIByPointerEvent(A,{withAnimation:this._slider._hasAnimation})}_onPointerMove(A){!this._slider.step&&this._isActive&&this._updateThumbUIByPointerEvent(A)}_onPointerUp(){this._isActive&&(this._isActive=!1,this._platform.SAFARI&&this._setIsFocused(!1),this.dragEnd.emit({source:this,parent:this._slider,value:this.value}),setTimeout(()=>this._updateWidthInactive(),this._platform.IOS?10:0))}_clamp(A){let t=this._tickMarkOffset,n=this._slider._cachedWidth-this._tickMarkOffset;return Math.max(Math.min(A,n),t)}_calcTranslateXByValue(){return this._slider._isRtl?(1-this.percentage)*(this._slider._cachedWidth-this._tickMarkOffset*2)+this._tickMarkOffset:this.percentage*(this._slider._cachedWidth-this._tickMarkOffset*2)+this._tickMarkOffset}_calcTranslateXByPointerEvent(A){return A.clientX-this._slider._cachedLeft}_updateWidthActive(){}_updateWidthInactive(){this._hostElement.style.padding=`0 ${this._slider._inputPadding}px`,this._hostElement.style.width=`calc(100% + ${this._slider._inputPadding-this._tickMarkOffset*2}px)`,this._hostElement.style.left=`-${this._slider._rippleRadius-this._tickMarkOffset}px`}_updateThumbUIByValue(A){this.translateX=this._clamp(this._calcTranslateXByValue()),this._updateThumbUI(A)}_updateThumbUIByPointerEvent(A,t){this.translateX=this._clamp(this._calcTranslateXByPointerEvent(A)),this._updateThumbUI(t)}_updateThumbUI(A){this._slider._setTransition(!!A?.withAnimation),this._slider._onTranslateXChange(this)}writeValue(A){(this._isControlInitialized||A!==null)&&(this.value=A)}registerOnChange(A){this._onChangeFn=A,this._isControlInitialized=!0}registerOnTouched(A){this._onTouchedFn=A}setDisabledState(A){this.disabled=A}focus(){this._hostElement.focus()}blur(){this._hostElement.blur()}static \u0275fac=function(t){return new(t||i)};static \u0275dir=VA({type:i,selectors:[["input","matSliderThumb",""]],hostAttrs:["type","range",1,"mdc-slider__input"],hostVars:1,hostBindings:function(t,n){t&1&&U("change",function(){return n._onChange()})("input",function(){return n._onInput()})("blur",function(){return n._onBlur()})("focus",function(){return n._onFocus()}),t&2&&ie("aria-valuetext",n._valuetext())},inputs:{value:[2,"value","value",yn]},outputs:{valueChange:"valueChange",dragStart:"dragStart",dragEnd:"dragEnd"},exportAs:["matSliderThumb"],features:[pt([$DA,{provide:l$,useExisting:i}])]})}return i})();var Q1=class i{transform(e){if(!e)return"";let A=e.replace(/(_avg_score|_score|avg_score)$/,"");return A=A.replace(/_/g," "),A.split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}static \u0275fac=function(A){return new(A||i)};static \u0275pipe=KD({name:"formatMetricName",type:i,pure:!0})};function AvA(i,e){if(i&1&&(I(0,"div",9)(1,"div",10)(2,"mat-checkbox",11)(3,"div",12)(4,"span",13),D(5),mt(6,"formatMetricName"),h(),I(7,"span",14),D(8),h()()(),I(9,"div",15)(10,"div",16)(11,"span",17),D(12,"Threshold"),h(),I(13,"div",18)(14,"mat-slider",19),lA(15,"input",20),h(),I(16,"span",21),D(17),h()()()()()()),i&2){let A,t=e.$implicit,n=p(2);Q(2),H("formControlName",t.metricName+"_selected"),Q(2),H("matTooltip",t.metricName),Q(),nA(Ft(6,10,t.metricName)),Q(3),nA(t.description),Q(),ft("visibility",(A=n.evalForm.get(t.metricName+"_selected"))!=null&&A.value?"visible":"hidden"),Q(5),H("min",t.metricValueInfo.interval.minValue)("max",t.metricValueInfo.interval.maxValue),Q(),H("formControlName",t.metricName+"_threshold"),Q(2),Ee(" ",n.evalForm.controls[t.metricName+"_threshold"].value," ")}}function evA(i,e){if(i&1&&(I(0,"div"),kt(1,AvA,18,12,"div",8),h()),i&2){let A=p();Q(),H("ngForOf",A.metricsInfo)}}function tvA(i,e){if(i&1&&(I(0,"div")(1,"div",9)(2,"div",10)(3,"mat-checkbox",22)(4,"span",13),D(5),mt(6,"formatMetricName"),h()(),I(7,"div",15)(8,"div",16)(9,"span",17),D(10,"Threshold"),h(),I(11,"div",18)(12,"mat-slider",23),lA(13,"input",24),h(),I(14,"span",21),D(15),h()()()()()(),I(16,"div",9)(17,"div",10)(18,"mat-checkbox",25)(19,"span",13),D(20),mt(21,"formatMetricName"),h()(),I(22,"div",15)(23,"div",16)(24,"span",17),D(25,"Threshold"),h(),I(26,"div",18)(27,"mat-slider",23),lA(28,"input",26),h(),I(29,"span",21),D(30),h()()()()()()()),i&2){let A,t,n=p();Q(4),H("matTooltip","tool_trajectory_avg_score"),Q(),nA(Ft(6,10,"tool_trajectory_avg_score")),Q(2),ft("visibility",(A=n.evalForm.get("tool_trajectory_avg_score_selected"))!=null&&A.value?"visible":"hidden"),Q(8),Ee(" ",n.evalForm.controls.tool_trajectory_avg_score_threshold.value," "),Q(4),H("matTooltip","response_match_score"),Q(),nA(Ft(21,12,"response_match_score")),Q(2),ft("visibility",(t=n.evalForm.get("response_match_score_selected"))!=null&&t.value?"visible":"hidden"),Q(8),Ee(" ",n.evalForm.controls.response_match_score_threshold.value," ")}}var by=class i{constructor(e,A,t){this.dialogRef=e;this.fb=A;this.data=t;this.evalMetrics=this.data.evalMetrics||[],this.metricsInfo=this.data.metricsInfo||[],this.evalForm=this.fb.group({}),this.metricsInfo.forEach(n=>{let o=this.evalMetrics.find(l=>l.metricName===n.metricName),a=!!o,r=o?o.threshold:this.getDefaultThreshold(n);this.evalForm.addControl(`${n.metricName}_selected`,this.fb.control(a));let s=n.metricValueInfo.interval;this.evalForm.addControl(`${n.metricName}_threshold`,this.fb.control(r,[js.required,js.min(s.minValue),js.max(s.maxValue)]))}),this.metricsInfo.length===0&&this.addDefaultControls()}evalForm;evalMetrics=[];metricsInfo=[];addDefaultControls(){[{name:"tool_trajectory_avg_score",min:0,max:1,default:1},{name:"response_match_score",min:0,max:1,default:.7}].forEach(A=>{let t=this.evalMetrics.find(a=>a.metricName===A.name),n=!!t,o=t?t.threshold:A.default;this.evalForm.addControl(`${A.name}_selected`,this.fb.control(n)),this.evalForm.addControl(`${A.name}_threshold`,this.fb.control(o,[js.required,js.min(A.min),js.max(A.max)]))})}getDefaultThreshold(e){return e.metricName==="tool_trajectory_avg_score"?1:e.metricName==="response_match_score"?.7:e.metricValueInfo.interval.maxValue}onReset(){this.metricsInfo.forEach(e=>{let A=SE.find(o=>o.metricName===e.metricName),t=!!A,n=A?A.threshold:this.getDefaultThreshold(e);this.evalForm.get(`${e.metricName}_selected`)?.setValue(t),this.evalForm.get(`${e.metricName}_threshold`)?.setValue(n)}),this.metricsInfo.length===0&&SE.forEach(e=>{this.evalForm.get(`${e.metricName}_selected`)?.setValue(!0),this.evalForm.get(`${e.metricName}_threshold`)?.setValue(e.threshold)})}onStart(){if(this.evalForm.valid){let e=[];this.metricsInfo.length>0?this.metricsInfo.forEach(A=>{if(this.evalForm.get(`${A.metricName}_selected`)?.value){let n=this.evalForm.get(`${A.metricName}_threshold`)?.value;e.push({metricName:A.metricName,threshold:n})}}):["tool_trajectory_avg_score","response_match_score"].forEach(t=>{if(this.evalForm.get(`${t}_selected`)?.value){let o=this.evalForm.get(`${t}_threshold`)?.value;e.push({metricName:t,threshold:o})}}),this.dialogRef.close(e)}}onCancel(){this.dialogRef.close(null)}static \u0275fac=function(A){return new(A||i)(st(zn),st(rL),st(Do))};static \u0275cmp=vA({type:i,selectors:[["app-run-eval-config-dialog"]],decls:14,vars:3,consts:[[1,"dialog-container"],["mat-dialog-title","",1,"dialog-title"],[1,"eval-form",3,"formGroup"],[4,"ngIf"],["align","end",1,"dialog-actions"],["mat-button","",1,"reset-button",3,"click"],["mat-button","",1,"cancel-button",3,"click"],["mat-button","",1,"save-button",3,"click"],["class","metric-container",4,"ngFor","ngForOf"],[1,"metric-container"],[1,"metric-header"],[3,"formControlName"],[2,"display","flex","flex-direction","column"],[1,"metric-title",3,"matTooltip"],[1,"metric-description"],[1,"metric-slider-container","inline-slider"],[2,"display","flex","flex-direction","column","align-items","flex-start"],[1,"slider-label",2,"margin-right","0","font-size","11px","color","var(--mat-sys-on-surface-variant)"],[2,"display","flex","align-items","center"],["step","0.1","thumbLabel","",1,"threshold-slider",3,"min","max"],["matSliderThumb","",3,"formControlName"],[1,"threshold-value"],["formControlName","tool_trajectory_avg_score_selected"],["min","0","max","1","step","0.1","thumbLabel","",1,"threshold-slider"],["matSliderThumb","","formControlName","tool_trajectory_avg_score_threshold"],["formControlName","response_match_score_selected"],["matSliderThumb","","formControlName","response_match_score_threshold"]],template:function(A,t){A&1&&(I(0,"div",0)(1,"h2",1),D(2,"EVALUATION METRICS"),h(),I(3,"mat-dialog-content")(4,"form",2),kt(5,evA,2,1,"div",3)(6,tvA,31,14,"div",3),h()(),I(7,"mat-dialog-actions",4)(8,"button",5),U("click",function(){return t.onReset()}),D(9,"Reset to Default"),h(),I(10,"button",6),U("click",function(){return t.onCancel()}),D(11,"Cancel"),h(),I(12,"button",7),U("click",function(){return t.onStart()}),D(13,"Start"),h()()()),A&2&&(Q(4),H("formGroup",t.evalForm),Q(),H("ngIf",t.metricsInfo.length>0),Q(),H("ngIf",t.metricsInfo.length===0))},dependencies:[Xo,Ba,fn,oL,Gn,Kn,XF,WC,qC,Cv,c$,xR,ha,ki,ic,li,DI,ql,rn,Q1],styles:[".dialog-container[_ngcontent-%COMP%]{border-radius:12px;padding:12px;width:680px;box-shadow:0 8px 16px var(--run-eval-config-dialog-container-box-shadow-color)}.metric-container[_ngcontent-%COMP%]{margin-bottom:6px;padding-bottom:4px;border-bottom:1px solid var(--run-eval-config-dialog-border-color, #e0e0e0)}.metric-container[_ngcontent-%COMP%]:last-child{border-bottom:none}.metric-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-bottom:2px}.metric-title[_ngcontent-%COMP%]{font-weight:600;font-size:1em}.metric-description[_ngcontent-%COMP%]{font-size:.85em;color:var(--run-eval-config-dialog-description-color, #666);margin-top:2px;white-space:normal}.metric-slider-container[_ngcontent-%COMP%]{display:flex;align-items:center;margin-left:28px}.inline-slider[_ngcontent-%COMP%]{margin-left:20px;flex:1;display:flex;justify-content:flex-end;align-items:center}.slider-label[_ngcontent-%COMP%]{margin-right:10px;font-size:.9em}.threshold-slider[_ngcontent-%COMP%]{max-width:80px;flex:1}.threshold-value[_ngcontent-%COMP%]{margin-left:10px;min-width:30px;text-align:right}h2[mat-dialog-title][_ngcontent-%COMP%]{color:var(--mdc-dialog-supporting-text-color)!important}mat-dialog-content[_ngcontent-%COMP%]{color:var(--mdc-dialog-supporting-text-color)!important}button[mat-button][_ngcontent-%COMP%]{color:var(--mdc-dialog-supporting-text-color)!important}"]})};var Mc=class i{constructor(e,A){this.dialogRef=e;this.data=A}onConfirm(){this.dialogRef.close(!0)}onCancel(){this.dialogRef.close(!1)}static \u0275fac=function(A){return new(A||i)(st(zn),st(Do))};static \u0275cmp=vA({type:i,selectors:[["app-delete-session-dialog"]],decls:11,vars:4,consts:[[1,"confirm-delete-wrapper"],["mat-dialog-title",""],["align","end"],["mat-button","",3,"click"],["mat-button","","cdkFocusInitial","",3,"click"]],template:function(A,t){A&1&&(I(0,"div",0)(1,"h2",1),D(2),h(),I(3,"mat-dialog-content")(4,"p"),D(5),h()(),I(6,"mat-dialog-actions",2)(7,"button",3),U("click",function(){return t.onCancel()}),D(8),h(),I(9,"button",4),U("click",function(){return t.onConfirm()}),D(10),h()()()),A&2&&(Q(2),nA(t.data.title),Q(3),nA(t.data.message),Q(3),nA(t.data.cancelButtonText),Q(2),nA(t.data.confirmButtonText))},dependencies:[Xo,Ba,ha,ki],encapsulation:2})};var ivA=["app-info-table",""],nvA=["*"];function ovA(i,e){if(i&1&&(Ln(0,"thead")(1,"tr")(2,"th",2),D(3),Xn()()()),i&2){let A=p();Q(3),nA(A.title())}}var u1=class i{title=ve();static \u0275fac=function(A){return new(A||i)};static \u0275cmp=vA({type:i,selectors:[["table","app-info-table",""]],hostAttrs:[1,"info-table"],inputs:{title:[1,"title"]},attrs:ivA,ngContentSelectors:nvA,decls:6,vars:1,consts:[[1,"label-col"],[1,"value-col"],["colspan","2"]],template:function(A,t){A&1&&(Ot(),Ln(0,"colgroup"),$n(1,"col",0)(2,"col",1),Xn(),T(3,ovA,4,1,"thead"),Ln(4,"tbody"),Ze(5),Xn()),A&2&&(Q(3),O(t.title()?3:-1))},styles:["[_nghost-%COMP%]{display:table;width:100%;border-collapse:separate;border-spacing:0;font-family:inherit;font-size:13px;background-color:var(--mat-sys-surface);border:1px solid var(--mat-sys-outline-variant);border-radius:8px;overflow:hidden;table-layout:fixed}[_nghost-%COMP%] thead[_ngcontent-%COMP%]{background-color:var(--mat-sys-surface-container-low)}[_nghost-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{text-align:left;padding:12px 16px;font-weight:500;color:var(--mat-sys-on-surface);border-bottom:1px solid var(--mat-sys-outline-variant)}[_nghost-%COMP%] .label-col[_ngcontent-%COMP%]{width:40%}[_nghost-%COMP%] tbody tr td{padding:10px 16px;color:var(--mat-sys-on-surface-variant);border-bottom:1px solid var(--mat-sys-outline-variant);overflow:hidden;overflow-wrap:anywhere}[_nghost-%COMP%] tbody tr td:first-child{font-weight:500;color:var(--mat-sys-on-surface);background-color:var(--mat-sys-surface-container-lowest);border-right:1px solid var(--mat-sys-outline-variant)}[_nghost-%COMP%] tbody tr:last-child td{border-bottom:none}"]})};var C$=(i,e)=>e.timestamp,avA=(i,e)=>e.evalId;function rvA(i,e){i&1&&(I(0,"span",3),D(1,"Eval Sets"),h())}function svA(i,e){if(i&1){let A=aA();I(0,"span",9),U("click",function(){L(A);let n=p(2);return G(n.goToEvalSet())}),D(1),h()}if(i&2){let A=p(2);Q(),nA(A.selectedEvalSet())}}function lvA(i,e){if(i&1&&(I(0,"span",8),D(1),h()),i&2){let A=p(2);Q(),nA(A.selectedEvalSet())}}function gvA(i,e){if(i&1&&(I(0,"span",6),D(1,">"),h(),T(2,svA,2,1,"span",7)(3,lvA,2,1,"span",8)),i&2){let A=p();Q(2),O(A.selectedEvalTab()==="history"||A.selectedHistoryRun()||A.selectedEvalCase()?2:3)}}function cvA(i,e){i&1&&(I(0,"span",6),D(1,">"),h(),I(2,"span",10),D(3,"Eval Cases"),h())}function CvA(i,e){i&1&&(I(0,"span",6),D(1,">"),h(),I(2,"span",11),D(3,"Runs"),h())}function dvA(i,e){if(i&1&&(I(0,"span",6),D(1,">"),h(),I(2,"span",12),D(3),h()),i&2){let A=p();Q(3),nA(A.formatTimestamp(A.selectedHistoryRun()))}}function IvA(i,e){if(i&1&&(I(0,"span",6),D(1,">"),h(),I(2,"span",13),D(3),h()),i&2){let A,t=p();Q(3),nA((A=t.selectedEvalCase())==null?null:A.evalId)}}function BvA(i,e){if(i&1){let A=aA();I(0,"button",14),U("click",function(){L(A);let n=p();return G(n.openNewEvalSetDialog())}),I(1,"mat-icon"),D(2,"add"),h(),D(3," New "),h(),I(4,"button",15),U("click",function(){L(A);let n=p();return G(n.getEvalSet())}),I(5,"mat-icon"),D(6,"refresh"),h()()}if(i&2){let A=p();H("matTooltip",A.i18n.createNewEvalSetTooltip)}}function hvA(i,e){}function EvA(i,e){if(i&1){let A=aA();I(0,"div")(1,"div",16)(2,"div",17),D(3),h(),I(4,"div",18),D(5),h(),I(6,"div",19),U("click",function(){L(A);let n=p();return G(n.openNewEvalSetDialog())}),D(7),h()()()}if(i&2){let A=p();Q(3),Ee(" ",A.i18n.createNewEvalSetTitle," "),Q(2),Ee(" ",A.i18n.evalSetDescription," "),Q(2),Ee(" ",A.i18n.createEvalSetButton," ")}}function QvA(i,e){if(i&1){let A=aA();I(0,"div",21),U("click",function(){let n=L(A).$implicit,o=p(2);return G(o.selectEvalSet(n))}),I(1,"div",22)(2,"span",23),D(3,"folder"),h(),I(4,"div",24),D(5),h()(),I(6,"div",25)(7,"button",26),U("click",function(n){let o=L(A).$implicit,a=p(2);return G(a.confirmDeleteEvalSet(n,o))}),I(8,"mat-icon"),D(9,"delete"),h()()()()}if(i&2){let A=e.$implicit,t=p(2);Q(5),nA(A),Q(2),H("matTooltip",t.i18n.deleteEvalSetTooltip)}}function uvA(i,e){if(i&1&&(I(0,"div"),ke(1,QvA,10,2,"div",20,ni),h()),i&2){let A=p();Q(),_e(A.evalsets)}}function pvA(i,e){i&1&&(I(0,"div",33),lA(1,"mat-progress-spinner",34),h()),i&2&&(Q(),H("diameter",28)("strokeWidth",3))}function fvA(i,e){if(i&1&&(I(0,"tr")(1,"td"),D(2,"Execution Mode"),h(),I(3,"td")(4,"span",37),D(5),h()()()),i&2){let A,t,n=p(4);Q(4),H("matTooltip",((A=n.currentEvalSet())==null?null:A.model_execution_mode)||"N/A"),Q(),nA(((t=n.currentEvalSet())==null?null:t.model_execution_mode)||"N/A")}}function mvA(i,e){if(i&1&&(I(0,"div",35)(1,"table",36)(2,"tr")(3,"td"),D(4,"Name"),h(),I(5,"td")(6,"span",37),D(7),h()()(),T(8,fvA,6,2,"tr"),I(9,"tr")(10,"td"),D(11,"Total Cases"),h(),I(12,"td")(13,"span",37),D(14),h()()(),I(15,"tr")(16,"td"),D(17,"Total Runs"),h(),I(18,"td")(19,"span",37),D(20),h()()()()()),i&2){let A=p(3);Q(6),H("matTooltip",A.selectedEvalSet()),Q(),nA(A.selectedEvalSet()),Q(),O(A.isEvalV2Enabled()?8:-1),Q(5),H("matTooltip",A.evalCases.length.toString()),Q(),nA(A.evalCases.length),Q(5),H("matTooltip",A.getEvalHistoryOfCurrentSetSorted().length.toString()),Q(),nA(A.getEvalHistoryOfCurrentSetSorted().length)}}function wvA(i,e){i&1&&lA(0,"mat-progress-spinner",42),i&2&&H("diameter",20)}function yvA(i,e){i&1&&(I(0,"mat-icon"),D(1,"play_arrow"),h())}function DvA(i,e){if(i&1){let A=aA();I(0,"div",46),U("click",function(){let n=L(A).$implicit,o=p(6);return G(o.getEvalCase(n))}),I(1,"mat-checkbox",47),U("click",function(n){return n.stopPropagation()})("change",function(n){let o=L(A).$implicit,a=p(6);return G(n?a.selection.toggle(o):null)}),h(),I(2,"div",48),D(3),h(),I(4,"button",49),U("click",function(n){let o=L(A).$implicit,a=p(6);return G(a.requestEditEvalCase(n,o))}),I(5,"mat-icon"),D(6,"edit"),h()(),I(7,"button",26),U("click",function(n){let o=L(A).$implicit,a=p(6);return G(a.confirmDeleteEvalCase(n,o))}),I(8,"mat-icon"),D(9,"delete"),h()()()}if(i&2){let A,t=e.$implicit,n=p(6);_A("selected-row",t===((A=n.selectedEvalCase())==null?null:A.evalId)),Q(),H("checked",n.selection.isSelected(t)),Q(2),Ee(" ",t," "),Q(),H("matTooltip",n.i18n.editEvalCaseTooltip),Q(3),H("matTooltip",n.i18n.deleteEvalCaseTooltip)}}function vvA(i,e){if(i&1&&(I(0,"div",44),ke(1,DvA,10,6,"div",45,ni),h()),i&2){let A=p(5);Q(),_e(A.evalCases)}}function bvA(i,e){if(i&1){let A=aA();I(0,"div",39)(1,"mat-checkbox",40),U("change",function(n){L(A);let o=p(4);return G(n?o.toggleAllRows():null)}),h(),I(2,"button",41),U("click",function(){L(A);let n=p(4);return G(n.openEvalConfigDialog())}),T(3,wvA,1,1,"mat-progress-spinner",42)(4,yvA,2,0,"mat-icon"),D(5),h(),I(6,"button",43),U("click",function(){L(A);let n=p(4);return G(n.openNewEvalCaseDialog())}),I(7,"mat-icon"),D(8,"add"),h(),D(9),h(),lA(10,"span",4),I(11,"button",15),U("click",function(){L(A);let n=p(4);return G(n.listEvalCases())}),I(12,"mat-icon"),D(13,"refresh"),h()()(),T(14,vvA,3,0,"div",44)}if(i&2){let A=p(4);Q(),H("checked",A.selection.hasValue()&&A.isAllSelected())("indeterminate",A.selection.hasValue()&&!A.isAllSelected()),Q(),H("disabled",A.evalCases.length==0||A.loadingMetrics()),Q(),O(A.loadingMetrics()?3:4),Q(2),Ee(" ",A.isAllSelected()||A.selection.isEmpty()?A.i18n.runEvaluationButton:A.i18n.runSelectedEvaluationButton," "),Q(4),Ee(" ",A.i18n.addSessionToSetButtonPrefix," "),Q(5),O(A.evalCases.length>0?14:-1)}}function MvA(i,e){if(i&1){let A=aA();I(0,"div",55),U("click",function(){let n=L(A).$implicit,o=p(5);return G(o.getHistorySession(n.result,n.timestamp))}),I(1,"div",48),D(2),h(),lA(3,"div",4),I(4,"div",56)(5,"span",57),D(6),h()()()}if(i&2){let A=e.$implicit,t=e.$index;p();let n=Ki(7),o=p(4);_A("selected-row",A.timestamp==o.selectedHistoryRun()),Q(2),Ya(" #",n.length-t," ",o.formatTimestamp(A.timestamp)," "),Q(3),H("ngClass",o.isMetricsSucceed(A.result)?"status-card__passed":"status-card__failed"),Q(),Ee(" ",o.getMetricsScore(A.result)," ")}}function SvA(i,e){i&1&&(I(0,"div",54),D(1," No runs found for this case. "),h())}function kvA(i,e){if(i&1&&(I(0,"div",38)(1,"div",50)(2,"h3",51),D(3),h()(),I(4,"h4",52),D(5,"Past Runs"),h(),I(6,"div",44),ro(7),ke(8,MvA,7,6,"div",53,C$),T(10,SvA,2,0,"div",54),h()()),i&2){let A=p(4),t=A.selectedEvalCase();Q(3),Ee("Case: ",t.evalId),Q(4);let n=so(A.caseHistory());Q(),_e(n),Q(2),O(n.length===0?10:-1)}}function _vA(i,e){i&1&&(I(0,"div",16)(1,"div",17),D(2,"No Eval Cases"),h(),I(3,"div",18),D(4,"Add a session to this set to get started."),h()())}function xvA(i,e){if(i&1&&(I(0,"div"),T(1,bvA,15,7)(2,kvA,11,3,"div",38),T(3,_vA,5,0,"div",16),h()),i&2){let A=p(3);Q(),O(A.selectedEvalCase()?2:1),Q(2),O(A.evalCases.length===0?3:-1)}}function RvA(i,e){i&1&&(I(0,"div",16)(1,"div",17),D(2,"No Runs"),h(),I(3,"div",18),D(4,"Run an evaluation to see results here."),h()())}function NvA(i,e){if(i&1){let A=aA();I(0,"div",46),U("click",function(){let n=L(A).$implicit,o=p(6);return G(o.selectedHistoryRun.set(n.timestamp))}),I(1,"div",48),D(2),h(),lA(3,"div",4),I(4,"div",60)(5,"span",61),D(6),h(),I(7,"span",62),D(8,"|"),h(),I(9,"span",63),D(10),h()()()}if(i&2){let A=e.$implicit,t=e.$index;p(3);let n=Ki(0),o=p(3);Q(2),Ya(" #",n.length-t," ",o.formatTimestamp(A.timestamp)," "),Q(4),Ya("",o.getPassCountForCurrentResult(A.evaluationResults.evaluationResults)," ",o.i18n.passStatusCaps),Q(3),ft("color",o.getFailCountForCurrentResult(A.evaluationResults.evaluationResults)===0?"gray":""),Q(),Ya("",o.getFailCountForCurrentResult(A.evaluationResults.evaluationResults)," ",o.i18n.failStatusCaps)}}function FvA(i,e){if(i&1&&(I(0,"div",44),ke(1,NvA,11,8,"div",59,C$),h()),i&2){p(2);let A=Ki(0);Q(),_e(A)}}function LvA(i,e){if(i&1&&(I(0,"span",62),D(1,"|"),h(),I(2,"span",63),D(3),h()),i&2){p(2);let A=Ki(1),t=p(5);Q(3),Ya("",t.getFailCountForCurrentResult(A.evaluationResults)," ",t.i18n.failStatusCaps)}}function GvA(i,e){if(i&1&&(I(0,"span",70)(1,"span",71),D(2),mt(3,"formatMetricName"),h(),D(4,": "),I(5,"span",72),D(6),mt(7,"number"),h()()),i&2){let A=e.$implicit;Q(),H("matTooltip",A.metricName),Q(),nA(Ft(3,3,A.metricName)),Q(4),nA(G0(7,5,A.threshold,"1.2-2"))}}function KvA(i,e){if(i&1&&(I(0,"div",67),ke(1,GvA,8,8,"span",70,ni),h()),i&2){let A=p(7);Q(),_e(A.currentHistoryMetrics())}}function UvA(i,e){if(i&1){let A=aA();I(0,"div",73),U("click",function(){let n=L(A).$implicit;p(2);let o=Ki(0),a=p(5);return G(a.getHistorySession(n,o))}),I(1,"span"),D(2),h(),I(3,"span",74),D(4),h()()}if(i&2){let A=e.$implicit,t=p(7);Q(2),Ee(" ",A.evalId," "),Q(),H("ngClass",t.isMetricsSucceed(A)?"status-card__passed":"status-card__failed"),Q(),Ee(" ",t.getMetricsScore(A)," ")}}function TvA(i,e){if(i&1&&(I(0,"div",64)(1,"div",65)(2,"div",66)(3,"div",60)(4,"span",61),D(5),h(),T(6,LvA,4,2),h(),T(7,KvA,3,0,"div",67),h()()(),I(8,"div",68),ke(9,UvA,5,3,"div",69,avA),h()),i&2){p();let A=Ki(1),t=p(5);Q(5),Ya("",t.getPassCountForCurrentResult(A.evaluationResults)," ",t.i18n.passStatusCaps),Q(),O(t.getFailCountForCurrentResult(A.evaluationResults)>0?6:-1),Q(),O(t.currentHistoryMetrics().length>0?7:-1),Q(2),_e(A.evaluationResults)}}function OvA(i,e){if(i&1&&(ro(0)(1),T(2,TvA,11,4)),i&2){let A=p(5),t=so(A.selectedHistoryRun());Q();let n=so(A.getEvalHistoryOfCurrentSet()[t]);Q(),O(n?2:-1)}}function JvA(i,e){if(i&1&&(I(0,"div",58),T(1,FvA,3,0,"div",44)(2,OvA,3,3),h()),i&2){let A=p(4);Q(),O(A.selectedHistoryRun()?2:1)}}function YvA(i,e){if(i&1&&(ro(0),T(1,RvA,5,0,"div",16)(2,JvA,3,1,"div",58)),i&2){let A=so(p(3).evalHistorySorted());Q(),O(A.length===0?1:2)}}function HvA(i,e){if(i&1&&(T(0,mvA,21,7,"div",35),T(1,xvA,4,2,"div"),T(2,YvA,3,2)),i&2){let A=p(2);O(A.selectedEvalTab()==="info"?0:-1),Q(),O(A.selectedEvalTab()==="cases"?1:-1),Q(),O(A.selectedEvalTab()==="history"?2:-1)}}function zvA(i,e){if(i&1){let A=aA();I(0,"div",5)(1,"div",27)(2,"div",28)(3,"button",29),U("click",function(){L(A);let n=p();return n.selectedEvalTab.set("info"),n.selectedEvalCase.set(null),G(n.selectedHistoryRun.set(null))}),I(4,"mat-icon"),D(5,"info"),h()(),I(6,"button",30),U("click",function(){L(A);let n=p();return n.selectedEvalTab.set("cases"),n.selectedEvalCase.set(null),G(n.selectedHistoryRun.set(null))}),I(7,"mat-icon"),D(8,"list"),h()(),I(9,"button",31),U("click",function(){L(A);let n=p();return n.selectedEvalTab.set("history"),n.selectedEvalCase.set(null),n.selectedHistoryRun.set(null),G(n.getEvaluationResult())}),I(10,"mat-icon"),D(11,"history"),h()()(),I(12,"div",32),T(13,pvA,2,2,"div",33)(14,HvA,3,3),h()()()}if(i&2){let A=p();Q(3),_A("active",A.selectedEvalTab()==="info"),Q(3),_A("active",A.selectedEvalTab()==="cases"),Q(3),_A("active",A.selectedEvalTab()==="history"),Q(4),O(A.evalRunning()?13:14)}}var My=new MA("EVAL_TAB_COMPONENT"),Sc=class i{checkboxes=GN(ic);appName=ve("");userId=ve("");sessionId=ve("");sessionSelected=Si();shouldShowTab=Si();evalNotInstalledMsg=Si();evalCaseSelected=Si();evalSetIdSelected=Si();shouldReturnToSession=Si();editEvalCaseRequested=Si();evalCasesSubject=new gi([]);changeDetectorRef=w(Mt);flagService=w(Nr);i18n=w(s$);displayedColumns=["select","evalId"];evalsets=[];selectedEvalSet=mA("");currentEvalSet=mA(null);evalHistorySorted=ye(()=>{let e=this.appEvaluationResults[this.appName()]?.[this.selectedEvalSet()]||{};return Object.keys(e).sort((t,n)=>n.localeCompare(t)).map(t=>({timestamp:t,evaluationResults:e[t]}))});currentHistoryMetrics=ye(()=>{let e=this.selectedHistoryRun()||this.evalHistorySorted()[0]?.timestamp;if(!e)return this.evalMetrics;let A=this.evalHistorySorted().find(t=>t.timestamp===e);return A?this.getEvalMetrics(A):this.evalMetrics});caseHistory=ye(()=>{let e=this.selectedEvalCase();if(!e)return[];let A=e.evalId,t=this.evalHistorySorted();return console.log("[DEBUG] caseHistory history:",t.map(n=>n.timestamp),"selectedHistoryRun:",this.selectedHistoryRun()),t.map(n=>{let o=n.evaluationResults.evaluationResults.find(a=>a.evalId===A);return{timestamp:n.timestamp,result:o}}).filter(n=>n.result!==void 0)});evalCases=[];selectedEvalCase=mA(null);deletedEvalCaseIndex=-1;dataSource=new dI(this.evalCases);selection=new P0(!0,[]);showEvalHistory=mA(!1);selectedEvalTab=mA("cases");selectedHistoryRun=mA(null);evalRunning=mA(!1);loadingMetrics=mA(!1);evalMetrics=SE;isEvalV2Enabled=mA(!1);currentEvalResultBySet=new Map;dialog=w(Xa);appEvaluationResults={};evalService=w(A0);sessionService=w(tl);constructor(){this.evalCasesSubject.subscribe(e=>{!this.selectedEvalCase()&&this.deletedEvalCaseIndex>=0&&e.length>0?(this.selectNewEvalCase(e),this.deletedEvalCaseIndex=-1):e.length===0&&this.shouldReturnToSession.emit(!0)})}ngOnChanges(e){e.appName&&(this.selectedEvalSet.set(""),this.evalCases=[],this.getEvalSet(),this.getEvaluationResult())}ngOnInit(){this.flagService.isEvalV2Enabled().pipe(oo()).subscribe(A=>this.isEvalV2Enabled.set(A));let e=window.localStorage.getItem("adk_eval_metrics_selection");if(e)try{this.evalMetrics=JSON.parse(e)}catch(A){console.error("Error parsing saved eval metrics",A),this.evalMetrics=SE}}selectNewEvalCase(e){let A=this.deletedEvalCaseIndex;this.deletedEvalCaseIndex===e.length&&(A=0),this.getEvalCase(e[A])}getEvalSet(){this.appName()!==""&&this.evalService.getEvalSets(this.appName()).pipe(aa(e=>e.status===404&&e.statusText==="Not Found"?(this.shouldShowTab.emit(!1),oe(null)):oe([]))).subscribe(e=>{e!==null&&(this.shouldShowTab.emit(!0),this.evalsets=e,this.changeDetectorRef.detectChanges())})}getNextDefaultEvalSetName(){let e=/^eval_set_(\d+)$/,A=0;for(let t of this.evalsets)if(typeof t=="string"){let n=t.match(e);if(n){let o=parseInt(n[1],10);o>A&&(A=o)}}return`eval_set_${A+1}`}openNewEvalSetDialog(){let e=this.getNextDefaultEvalSetName();this.dialog.open(vy,{width:"600px",data:{appName:this.appName(),defaultName:e}}).afterClosed().subscribe(t=>{t&&(this.getEvalSet(),this.changeDetectorRef.detectChanges())})}openNewEvalCaseDialog(){this.sessionId()&&this.sessionService.getSession(this.userId(),this.appName(),this.sessionId()).subscribe(e=>{let t=(e.state?.__session_metadata__?.displayName||this.sessionId()).replace(/ /g,"_").replace(/[^a-zA-Z0-9_-]/g,"");this.dialog.open(Dy,{width:"600px",data:{appName:this.appName(),userId:this.userId(),sessionId:this.sessionId(),evalSetId:this.selectedEvalSet(),defaultName:t,existingCases:this.evalCases}}).afterClosed().subscribe(o=>{o&&(this.listEvalCases(),this.changeDetectorRef.detectChanges())})})}listEvalCases(){this.evalCases=[],this.evalService.listEvalCases(this.appName(),this.selectedEvalSet()).subscribe(e=>{this.evalCases=e,this.dataSource=new dI(this.evalCases),this.evalCasesSubject.next(this.evalCases),this.changeDetectorRef.detectChanges()})}runEval(){this.evalRunning.set(!0),this.evalService.runEval(this.appName(),this.selectedEvalSet(),this.selection.selected.length===0?this.dataSource.data:this.selection.selected,this.evalMetrics).pipe(aa(e=>(e.error?.detail?.includes("not installed")&&this.evalNotInstalledMsg.emit(e.error.detail),oe([])))).subscribe(e=>{this.currentEvalResultBySet.set(this.selectedEvalSet(),e),this.getEvaluationResult(!0),this.changeDetectorRef.detectChanges()})}selectEvalSet(e){this.selectedEvalSet.set(e),this.listEvalCases(),this.isEvalV2Enabled()&&this.evalService.getEvalSet(this.appName(),e).pipe(aa(A=>(console.error("Error fetching eval set details",A),oe(null)))).subscribe(A=>{this.currentEvalSet.set(A),this.changeDetectorRef.detectChanges()})}clearSelectedEvalSet(){if(this.selectedEvalTab()!=="cases"){this.selectedEvalTab.set("cases");return}this.selectedEvalSet.set(""),this.currentEvalSet.set(null)}clearAllNavigation(){this.selectedEvalSet.set(""),this.selectedHistoryRun.set(null),this.selectedEvalCase.set(null),this.currentEvalSet.set(null)}goToEvalSet(){this.selectedHistoryRun.set(null),this.selectedEvalCase.set(null)}isAllSelected(){let e=this.selection.selected.length,A=this.dataSource.data.length;return e===A}toggleAllRows(){if(this.isAllSelected()){this.selection.clear();return}this.selection.select(...this.dataSource.data)}getEvalResultForCase(e){let A=this.currentEvalResultBySet.get(this.selectedEvalSet())?.filter(t=>t.evalId==e);if(!(!A||A.length==0))return A[0].finalEvalStatus}formatToolUses(e){if(!e||!Array.isArray(e))return[];let A=[];for(let t of e)A.push({name:t.name,args:t.args});return A}addEvalCaseResultToEvents(e,A){let t=A.evalMetricResultPerInvocation,n=-1;if(t)for(let o=0;o<e.events.length;o++){let a=e.events[o];if(a.author==="user")n++;else{let r=t[n],s=1,l="",g=1,C=1;if(r&&r.evalMetricResults){for(let d of r.evalMetricResults)if(d.evalStatus===2){s=2,l=d.metricName,g=d.score,C=d.threshold;break}}a.evalStatus=s,r&&(o===e.events.length-1||e.events[o+1].author==="user")&&this.addEvalFieldsToBotEvent(a,r,l,g,C)}}return e}addEvalFieldsToBotEvent(e,A,t,n,o){e.failedMetric=t,e.evalScore=n,e.evalThreshold=o,e.failedMetric==="tool_trajectory_avg_score"?(e.actualInvocationToolUses=this.formatToolUses(A.actualInvocation.intermediateData.toolUses),e.expectedInvocationToolUses=this.formatToolUses(A.expectedInvocation.intermediateData.toolUses)):e.failedMetric==="response_match_score"&&(e.actualFinalResponse=A.actualInvocation.finalResponse.parts[0].text,e.expectedFinalResponse=A.expectedInvocation.finalResponse.parts[0]?.text)}fromApiResultToSession(e){return{id:e?.id??"",appName:e?.appName??"",userId:e?.userId??"",state:e?.state??[],events:e?.events??[],isEvalResult:!0}}getSession(e){let A=this.currentEvalResultBySet.get(this.selectedEvalSet())?.filter(n=>n.evalId==e)[0],t=A.sessionId;this.sessionService.getSession(this.userId(),this.appName(),t).subscribe(n=>{this.addEvalCaseResultToEvents(n,A);let o=this.fromApiResultToSession(n);this.sessionSelected.emit(o)})}toggleEvalHistoryButton(){this.showEvalHistory.set(!this.showEvalHistory())}getEvalHistoryOfCurrentSet(){return this.appEvaluationResults[this.appName()]?this.appEvaluationResults[this.appName()][this.selectedEvalSet()]||{}:{}}getEvalHistoryOfCurrentSetSorted(){let e=this.getEvalHistoryOfCurrentSet();return e?Object.keys(e).sort((n,o)=>o.localeCompare(n)).map(n=>({timestamp:n,evaluationResults:e[n]})):[]}getPassCountForCurrentResult(e){return e.filter(A=>A.finalEvalStatus==1).length}getFailCountForCurrentResult(e){return e.filter(A=>A.finalEvalStatus==2).length}getMetricsCounts(e){if(!e)return{passed:0,total:0};let A=0,t=0;if(e.evalMetricResults&&e.evalMetricResults.length>0)A=e.evalMetricResults.filter(n=>n.evalStatus===1).length,t=e.evalMetricResults.length;else if(e.evalMetricResultPerInvocation)for(let n of e.evalMetricResultPerInvocation)n.evalMetricResults&&(A+=n.evalMetricResults.filter(o=>o.evalStatus===1).length,t+=n.evalMetricResults.length);return{passed:A,total:t}}getMetricsScore(e){let{passed:A,total:t}=this.getMetricsCounts(e);return`${A}/${t}`}isMetricsSucceed(e){let{passed:A,total:t}=this.getMetricsCounts(e);return A===t}formatTimestamp(e){let A=Number(e);if(isNaN(A))return"Invalid timestamp provided";let t=new Date(A*1e3);if(isNaN(t.getTime()))return"Invalid date created from timestamp";let n={month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0};return new Intl.DateTimeFormat("en-US",n).format(t)}getEvaluationStatusCardActionButtonIcon(e){return this.getEvalHistoryOfCurrentSet()[e].isToggled?"keyboard_arrow_up":"keyboard_arrow_down"}toggleHistoryStatusCard(e){this.getEvalHistoryOfCurrentSet()[e].isToggled=!this.getEvalHistoryOfCurrentSet()[e].isToggled}isEvaluationStatusCardToggled(e){return this.getEvalHistoryOfCurrentSet()[e].isToggled}generateHistoryEvaluationDatasource(e){return this.getEvalHistoryOfCurrentSet()[e].evaluationResults}getHistorySession(e,A){let t=e.sessionId,n=e.evalId;this.selectedHistoryRun.set(A),this.evalService.getEvalCase(this.appName(),this.selectedEvalSet(),n).subscribe(o=>{this.sessionService.getSession(this.userId(),this.appName(),t).subscribe(a=>{this.addEvalCaseResultToEvents(a,e);let r=this.fromApiResultToSession(a);r.evalCase=o,r.evalCaseResult=e,r.timestamp=A,this.sessionSelected.emit(r)})})}getEvalCase(e){this.evalService.getEvalCase(this.appName(),this.selectedEvalSet(),e).subscribe(A=>{this.selectedEvalCase.set(A),this.evalCaseSelected.emit(A),this.evalSetIdSelected.emit(this.selectedEvalSet())})}resetEvalCase(){this.selectedEvalCase.set(null)}resetEvalResults(){this.currentEvalResultBySet.clear()}confirmDeleteEvalCase(e,A){e.stopPropagation();let t={title:"Confirm delete",message:`Are you sure you want to delete ${A}?`,confirmButtonText:"Delete",cancelButtonText:"Cancel"};this.dialog.open(Mc,{width:"600px",data:t}).afterClosed().subscribe(o=>{o&&this.deleteEvalCase(A)})}requestEditEvalCase(e,A){e.stopPropagation(),this.evalService.getEvalCase(this.appName(),this.selectedEvalSet(),A).subscribe(t=>{this.selectedEvalCase.set(t),this.evalCaseSelected.emit(t),this.evalSetIdSelected.emit(this.selectedEvalSet()),this.editEvalCaseRequested.emit(t)})}deleteEvalCase(e){this.evalService.deleteEvalCase(this.appName(),this.selectedEvalSet(),e).subscribe(A=>{this.deletedEvalCaseIndex=this.evalCases.indexOf(e),this.selectedEvalCase.set(null),this.listEvalCases(),this.changeDetectorRef.detectChanges()})}confirmDeleteEvalSet(e,A){e.stopPropagation();let t={title:"Confirm delete",message:`Are you sure you want to delete eval set ${A}?`,confirmButtonText:"Delete",cancelButtonText:"Cancel"};this.dialog.open(Mc,{width:"600px",data:t}).afterClosed().subscribe(o=>{o&&this.deleteEvalSet(A)})}deleteEvalSet(e){this.evalService.deleteEvalSet(this.appName(),e).subscribe(A=>{this.getEvalSet(),this.changeDetectorRef.detectChanges()})}getEvaluationResult(e=!1){this.evalService.listEvalResults(this.appName()).pipe(aa(A=>A.status===404&&A.statusText==="Not Found"?(this.shouldShowTab.emit(!1),oe(null)):oe([])),Mi(A=>{if(!A||A.length===0)return oe([]);let t=A.map(n=>this.evalService.getEvalResult(this.appName(),n));return JC(t)})).subscribe(A=>{if(A.length===0)return;let t="";for(let n of A){this.appEvaluationResults[this.appName()]||(this.appEvaluationResults[this.appName()]={}),this.appEvaluationResults[this.appName()][n.evalSetId]||(this.appEvaluationResults[this.appName()][n.evalSetId]={});let o=n.creationTimestamp;(!t||o>t)&&(t=o);let a={isToggled:!1,evaluationResults:n.evalCaseResults.map(r=>({setId:r.id,evalId:r.evalId,finalEvalStatus:r.finalEvalStatus,evalMetricResults:r.evalMetricResults,evalMetricResultPerInvocation:r.evalMetricResultPerInvocation,sessionId:r.sessionId,sessionDetails:r.sessionDetails,overallEvalMetricResults:r.overallEvalMetricResults??[]}))};this.appEvaluationResults[this.appName()][n.evalSetId][o]=a}this.changeDetectorRef.detectChanges(),e&&t&&(this.selectedEvalTab.set("history"),this.selectedHistoryRun.set(t)),this.evalRunning.set(!1)})}openEvalConfigDialog(){this.loadingMetrics.set(!0),this.evalService.getMetricsInfo(this.appName()).pipe(aa(e=>(console.error("Error fetching metrics info",e),oe({metricsInfo:[]})))).subscribe(e=>{this.loadingMetrics.set(!1),this.dialog.open(by,{maxWidth:"90vw",maxHeight:"90vh",data:{evalMetrics:this.evalMetrics,metricsInfo:e.metricsInfo||[]}}).afterClosed().subscribe(t=>{t&&(this.evalMetrics=t,window.localStorage.setItem("adk_eval_metrics_selection",JSON.stringify(t)),this.runEval())})})}getEvalMetrics(e){if(!e||!e.evaluationResults||!e.evaluationResults.evaluationResults)return this.evalMetrics;let A=e.evaluationResults.evaluationResults;return A.length===0?this.evalMetrics:typeof A[0].overallEvalMetricResults>"u"||!A[0].overallEvalMetricResults||A[0].overallEvalMetricResults.length===0?this.evalMetrics:A[0].overallEvalMetricResults.map(n=>({metricName:n.metricName,threshold:n.threshold}))}static \u0275fac=function(A){return new(A||i)};static \u0275cmp=vA({type:i,selectors:[["app-eval-tab"]],viewQuery:function(A,t){A&1&&ls(t.checkboxes,ic,5),A&2&&br()},inputs:{appName:[1,"appName"],userId:[1,"userId"],sessionId:[1,"sessionId"]},outputs:{sessionSelected:"sessionSelected",shouldShowTab:"shouldShowTab",evalNotInstalledMsg:"evalNotInstalledMsg",evalCaseSelected:"evalCaseSelected",evalSetIdSelected:"evalSetIdSelected",shouldReturnToSession:"shouldReturnToSession",editEvalCaseRequested:"editEvalCaseRequested"},features:[ii],decls:17,vars:11,consts:[[1,"eval-container"],[1,"eval-detail-header"],["mat-icon-button","","matTooltip","All Eval Sets",3,"click"],[1,"breadcrumb-item",2,"font-weight","500","color","var(--mat-sys-on-surface)"],[1,"spacer"],[1,"eval-details-container"],[1,"breadcrumb-separator"],["matTooltip","Eval Set",1,"breadcrumb-item","clickable"],["matTooltip","Eval Set",1,"breadcrumb-item"],["matTooltip","Eval Set",1,"breadcrumb-item","clickable",3,"click"],["matTooltip","Eval Cases",1,"breadcrumb-item"],["matTooltip","Runs",1,"breadcrumb-item"],["matTooltip","Run",1,"breadcrumb-item"],["matTooltip","Eval Case",1,"breadcrumb-item"],["mat-button","",3,"click","matTooltip"],["mat-icon-button","","matTooltip","Refresh",3,"click"],[1,"empty-eval-info"],[1,"info-title"],[1,"info-detail"],[1,"info-create",3,"click"],[1,"eval-set-row"],[1,"eval-set-row",3,"click"],[1,"eval-set-left"],[1,"material-symbols-outlined"],[1,"eval-set-name"],[1,"eval-set-right"],["mat-icon-button","",1,"delete-btn",3,"click","matTooltip"],[1,"eval-details-content"],[1,"vertical-tabs-sidebar"],["mat-icon-button","","matTooltip","Info","matTooltipPosition","right",3,"click"],["mat-icon-button","","matTooltip","Eval Cases","matTooltipPosition","right",3,"click"],["mat-icon-button","","matTooltip","Runs","matTooltipPosition","right",3,"click"],[1,"vertical-tabs-content"],[2,"display","flex","justify-content","center","align-items","center","padding","20px"],["mode","indeterminate",3,"diameter","strokeWidth"],[1,"info-tables-container"],["app-info-table",""],[3,"matTooltip"],[1,"eval-case-details",2,"padding","16px"],[1,"toolbar",2,"position","sticky","top","0","z-index","1"],[2,"margin-left","6px",3,"change","checked","indeterminate"],["mat-button","","color","primary",3,"click","disabled"],["mode","indeterminate",2,"display","inline-block","vertical-align","middle","margin-right","8px",3,"diameter"],["mat-button","","color","accent",3,"click"],[1,"eval-cases-list"],[1,"eval-case-row",3,"selected-row"],[1,"eval-case-row",3,"click"],[3,"click","change","checked"],[1,"eval-case-id"],["mat-icon-button","",1,"edit-btn",3,"click","matTooltip"],[2,"margin-bottom","16px"],[2,"margin-top","0"],[2,"margin-bottom","8px"],[1,"eval-case-row","clickable",3,"selected-row"],[2,"padding","16px","text-align","center","color","var(--app-color-text-secondary)"],[1,"eval-case-row","clickable",3,"click"],[1,"status-card__summary",2,"width","50px","text-align","center"],[2,"font-family","monospace",3,"ngClass"],[2,"padding","16px"],[1,"eval-case-row"],[1,"status-card__summary"],[1,"status-card__passed",2,"font-family","monospace"],[1,"status-card__separator"],[1,"status-card__failed",2,"font-family","monospace"],[1,"status-card",2,"margin-top","0"],[1,"status-card__overview"],[1,"status-card__info"],[1,"status-card__metrics"],[1,"status-card__history-cases"],[1,"status-card__history-case",2,"display","flex","justify-content","space-between","align-items","center"],[1,"status-card__metric"],[1,"status-card__metric-name",3,"matTooltip"],[1,"status-card__metric-value"],[1,"status-card__history-case",2,"display","flex","justify-content","space-between","align-items","center",3,"click"],[2,"font-family","monospace","width","50px","text-align","center",3,"ngClass"]],template:function(A,t){A&1&&(I(0,"div",0)(1,"div",1)(2,"button",2),U("click",function(){return t.clearAllNavigation()}),I(3,"mat-icon"),D(4,"home"),h()(),T(5,rvA,2,0,"span",3),T(6,gvA,4,1),T(7,cvA,4,0),T(8,CvA,4,0),T(9,dvA,4,1),T(10,IvA,4,1),lA(11,"span",4),T(12,BvA,7,1),h(),T(13,hvA,0,0),T(14,EvA,8,3,"div"),T(15,uvA,3,0,"div"),T(16,zvA,15,7,"div",5),h()),A&2&&(Q(5),O(t.selectedEvalSet()===""?5:-1),Q(),O(t.selectedEvalSet()!==""?6:-1),Q(),O(t.selectedEvalSet()!==""&&t.selectedEvalTab()==="cases"&&!t.selectedEvalCase()?7:-1),Q(),O(t.selectedEvalSet()!==""&&t.selectedEvalTab()==="history"&&!t.selectedHistoryRun()?8:-1),Q(),O(t.selectedHistoryRun()&&!t.selectedEvalCase()?9:-1),Q(),O(t.selectedEvalCase()?10:-1),Q(2),O(t.selectedEvalSet()===""?12:-1),Q(),O(t.selectedEvalSet()==""?13:-1),Q(),O(t.evalsets.length==0?14:-1),Q(),O(t.evalsets.length>0&&t.selectedEvalSet()==""?15:-1),Q(),O(t.selectedEvalSet()!=""?16:-1))},dependencies:[zt,ki,yi,rn,ic,Vl,Es,u1,W0,Za,bI,Q1],styles:[".eval-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;box-sizing:border-box}.eval-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;height:48px;flex-shrink:0;padding:0 10px;background-color:var(--mat-sys-surface-container, #f5f5f5);border-bottom:1px solid var(--mat-sys-outline-variant, #e0e0e0);gap:8px}.eval-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] .spacer[_ngcontent-%COMP%]{flex:1 1 auto}.eval-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{height:32px!important;line-height:normal!important;border-radius:16px!important;font-size:13px!important;font-weight:500!important;display:inline-flex!important;align-items:center;justify-content:center}.eval-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button.mat-mdc-button[_ngcontent-%COMP%]{padding:0 12px!important}.eval-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button.mat-mdc-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{margin-right:4px!important}.eval-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button.mat-mdc-icon-button[_ngcontent-%COMP%]{width:32px!important;min-width:32px!important;padding:0!important;border-radius:50%!important}.eval-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button.mat-mdc-icon-button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{margin-right:0!important}.eval-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button.mat-mdc-icon-button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple{width:32px!important;height:32px!important;border-radius:50%!important}.eval-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px!important;width:20px!important;height:20px!important;line-height:20px!important;vertical-align:middle}.eval-container[_ngcontent-%COMP%] .toolbar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{vertical-align:middle}.eval-container[_ngcontent-%COMP%] .eval-table[_ngcontent-%COMP%]{width:100%;background:transparent;border-top:1px solid var(--mat-sys-outline-variant, #e0e0e0)}.eval-container[_ngcontent-%COMP%] .eval-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{font-weight:600}.eval-container[_ngcontent-%COMP%] .eval-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{vertical-align:middle;padding:6px 16px;border-bottom:1px solid var(--mat-sys-outline-variant, #e0e0e0)}.eval-container[_ngcontent-%COMP%] .eval-table[_ngcontent-%COMP%] tr.mat-header-row[_ngcontent-%COMP%]{display:none}.eval-container[_ngcontent-%COMP%] .eval-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]{cursor:pointer;background:transparent}.eval-container[_ngcontent-%COMP%] .eval-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-surface-container-low, #f5f5f5)}.eval-container[_ngcontent-%COMP%] .eval-table[_ngcontent-%COMP%] tr.selected-row[_ngcontent-%COMP%]{background-color:var(--mat-sys-surface-container-high, #e0e0e0)}.eval-container[_ngcontent-%COMP%] .eval-detail-header[_ngcontent-%COMP%]{display:flex;align-items:center;border-bottom:1px solid var(--mat-sys-outline-variant);height:48px;flex-shrink:0;padding:0 16px;gap:8px}.eval-container[_ngcontent-%COMP%] .eval-detail-header[_ngcontent-%COMP%] .spacer[_ngcontent-%COMP%]{flex:1 1 auto}.eval-container[_ngcontent-%COMP%] .eval-detail-header[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface)}.eval-container[_ngcontent-%COMP%] .eval-detail-header[_ngcontent-%COMP%] .breadcrumb-separator[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface-variant);margin:0 4px}.eval-container[_ngcontent-%COMP%] .eval-detail-header[_ngcontent-%COMP%] .breadcrumb-item[_ngcontent-%COMP%]{font-size:14px;color:var(--mat-sys-on-surface-variant)}.eval-container[_ngcontent-%COMP%] .eval-detail-header[_ngcontent-%COMP%] .breadcrumb-item.clickable[_ngcontent-%COMP%]{color:var(--mat-sys-primary);cursor:pointer}.eval-container[_ngcontent-%COMP%] .eval-detail-header[_ngcontent-%COMP%] .breadcrumb-item.clickable[_ngcontent-%COMP%]:hover{text-decoration:underline}.eval-container[_ngcontent-%COMP%] .eval-detail-header[_ngcontent-%COMP%] .breadcrumb-item[_ngcontent-%COMP%]:last-child{color:var(--mat-sys-on-surface);font-weight:500}.eval-container[_ngcontent-%COMP%] .eval-set-title[_ngcontent-%COMP%]{font-size:14px;font-weight:500;color:var(--mat-sys-on-surface);margin-right:16px}.eval-case-id[_ngcontent-%COMP%]{cursor:pointer}.eval-set-actions[_ngcontent-%COMP%]{display:flex;justify-content:space-between;color:var(--mat-sys-on-surface);font-style:normal;font-weight:700;font-size:14px}.empty-eval-info[_ngcontent-%COMP%]{margin-top:12px}.info-title[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface);font-size:14px;font-weight:500;padding-top:13px;padding-right:16px;padding-left:16px}.info-detail[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface-variant);font-size:14px;font-weight:400;padding-top:13px;padding-right:16px;padding-left:16px;letter-spacing:.2px}.info-create[_ngcontent-%COMP%]{color:var(--mat-sys-primary);font-size:14px;font-style:normal;font-weight:500;padding-right:16px;padding-left:16px;margin-top:19px;padding-bottom:16px;cursor:pointer}.eval-set-row[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;cursor:pointer;padding:6px 16px;min-height:44px;border-bottom:1px solid var(--mat-sys-outline-variant, #e0e0e0);background:transparent}.eval-set-row[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-surface-container-low, #f5f5f5)}.eval-set-row[_ngcontent-%COMP%]:hover .delete-btn[_ngcontent-%COMP%]{opacity:1}.eval-set-row[_ngcontent-%COMP%] .eval-set-left[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px}.eval-set-row[_ngcontent-%COMP%] .eval-set-left[_ngcontent-%COMP%] span.material-symbols-outlined[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface-variant);font-size:20px}.eval-set-row[_ngcontent-%COMP%] .eval-set-name[_ngcontent-%COMP%]{font-size:14px;color:var(--mat-sys-on-surface)}.eval-set-row[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]{opacity:0;transition:opacity .2s ease-in-out;color:var(--mat-sys-outline)}.eval-set-row[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]:hover{color:var(--mat-sys-error)}.eval-set-row[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px!important;width:20px!important;height:20px!important;line-height:20px!important}.selected-eval-case[_ngcontent-%COMP%]{font-weight:900;color:var(--mat-sys-primary)}.save-session-btn[_ngcontent-%COMP%]{width:100%;border:none;border-radius:4px;margin-top:12px;cursor:pointer}.save-session-btn-detail[_ngcontent-%COMP%]{display:flex;padding:8px 16px 8px 12px;justify-content:center}.save-session-btn-text[_ngcontent-%COMP%]{padding-top:2px;color:var(--mat-sys-on-primary);font-size:14px;font-style:normal;font-weight:500;line-height:20px;letter-spacing:.25px}.run-eval-btn[_ngcontent-%COMP%]{border-radius:4px;border:1px solid var(--mat-sys-outline);padding:8px 24px;margin-top:16px;color:var(--mat-sys-primary);cursor:pointer}.run-eval-btn[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-surface-container-high)}.result-btn[_ngcontent-%COMP%]{display:flex;border-radius:4px;border:1px solid var(--mat-sys-outline-variant);margin-top:4px;cursor:pointer}.result-btn[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-surface-container-high)}.result-btn.pass[_ngcontent-%COMP%]{color:var(--mat-sys-tertiary)}.result-btn.fail[_ngcontent-%COMP%]{color:var(--mat-sys-error)}.evaluation-tab-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;width:100%}.evaluation-history-icon[_ngcontent-%COMP%]{cursor:pointer;margin-top:4px}.status-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;border-radius:8px;padding:12px 16px;margin-top:12px;background-color:var(--mat-sys-surface-container)}.status-card__overview[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;width:100%}.status-card__info[_ngcontent-%COMP%]{display:flex;flex-direction:column}.status-card__timestamp[_ngcontent-%COMP%]{font-size:.9em;color:var(--mat-sys-on-surface-variant);margin-bottom:5px}.status-card__summary[_ngcontent-%COMP%]{display:flex;align-items:center;font-size:.95em;font-weight:500;color:var(--mat-sys-on-surface)}.status-card__metrics[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;font-size:.75em;margin-top:3px}.status-card__metric[_ngcontent-%COMP%]{width:160px;display:flex;align-items:center;color:var(--mat-sys-on-surface);margin-right:12px;margin-bottom:4px}.status-card__metric-name[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.status-card__metric-value[_ngcontent-%COMP%]{margin-left:4px;flex-shrink:0}.status-card__failed[_ngcontent-%COMP%]{color:var(--mat-sys-error)}.status-card__separator[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface-variant);margin:0 8px}.status-card__passed[_ngcontent-%COMP%]{color:#2e7d32}.status-card__action[_ngcontent-%COMP%]{display:flex;align-items:center}.status-card__action[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface-variant);cursor:pointer;transition:transform .2s ease-in-out}.status-card__action[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]:hover{opacity:.8}.status-card__action[_ngcontent-%COMP%] .status-card__icon[_ngcontent-%COMP%]{color:var(--mat-sys-on-surface-variant);font-size:1.2em;cursor:pointer}.status-card__action[_ngcontent-%COMP%] .status-card__icon[_ngcontent-%COMP%]:hover{opacity:.8}.status-card__history-cases[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin-top:3px;justify-content:flex-start;width:100%}.status-card__history-case[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:4px;padding:8px 12px;border-radius:4px;cursor:pointer;box-sizing:border-box}.status-card__history-case[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-surface-container-low, #f5f5f5)}.eval-spinner[_ngcontent-%COMP%]{margin-top:12px}.eval-details-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1;overflow:hidden}.eval-details-content[_ngcontent-%COMP%]{display:flex;flex:1;overflow:hidden}.vertical-tabs-sidebar[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:48px;border-right:1px solid var(--mat-sys-outline-variant);padding-top:8px;align-items:center;gap:8px}.vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{border-radius:6px!important}.vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple, .vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .mat-mdc-button-ripple, .vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .mat-mdc-button-persistent-ripple:before, .vertical-tabs-sidebar[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .mat-mdc-focus-indicator{border-radius:6px!important}.vertical-tabs-sidebar[_ngcontent-%COMP%] button.active[_ngcontent-%COMP%]{background-color:var(--mat-sys-secondary-container)!important;color:var(--mat-sys-on-secondary-container)!important}.vertical-tabs-content[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;overflow:hidden;overflow-y:auto}.eval-cases-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;width:100%}.eval-case-row[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer;padding:8px 16px;gap:12px;border-bottom:1px solid var(--mat-sys-outline-variant);background:transparent}.eval-case-row[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-surface-container-low)}.eval-case-row[_ngcontent-%COMP%]:hover .delete-btn[_ngcontent-%COMP%], .eval-case-row[_ngcontent-%COMP%]:hover .edit-btn[_ngcontent-%COMP%]{opacity:1}.eval-case-row.selected-row[_ngcontent-%COMP%]{background-color:var(--mat-sys-surface-container-high)}.eval-case-row[_ngcontent-%COMP%] .eval-case-id[_ngcontent-%COMP%]{font-size:14px;color:var(--mat-sys-on-surface);font-family:Google Sans Mono,monospace;flex:1}.eval-case-row[_ngcontent-%COMP%] .edit-btn[_ngcontent-%COMP%]{opacity:0;transition:opacity .2s ease-in-out;color:var(--mat-sys-on-surface-variant)}.eval-case-row[_ngcontent-%COMP%] .edit-btn[_ngcontent-%COMP%]:hover{color:var(--mat-sys-primary)}.eval-case-row[_ngcontent-%COMP%] .edit-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px!important;width:20px!important;height:20px!important;line-height:20px!important}.eval-case-row[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]{opacity:0;transition:opacity .2s ease-in-out;color:var(--mat-sys-on-surface-variant)}.eval-case-row[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]:hover{color:var(--mat-sys-error)}.eval-case-row[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:20px!important;width:20px!important;height:20px!important;line-height:20px!important}.eval-case-row.header-row[_ngcontent-%COMP%]{cursor:default;background-color:var(--mat-sys-surface-container-lowest)}.eval-case-row.header-row[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-surface-container-lowest)}.info-tables-container[_ngcontent-%COMP%]{padding:16px;overflow-y:auto;display:flex;flex-direction:column;gap:24px}"]})};var PvA={noSessionsFound:"No sessions found",readonlyChip:"Read-only",filterSessionsLabel:"Search using session ID"},d$=new MA("Session Tab Messages",{factory:()=>PvA});function jvA(i,e){if(i&1&&(I(0,"div",1)(1,"mat-form-field",4)(2,"mat-label"),D(3),h(),I(4,"mat-icon",5),D(5,"filter_list"),h(),lA(6,"input",6),h()()),i&2){let A=p();Q(3),nA(A.i18n.filterSessionsLabel),Q(3),H("formControl",A.filterControl)}}function VvA(i,e){i&1&&(I(0,"div",2),lA(1,"mat-progress-bar",7),h())}function qvA(i,e){if(i&1&&(I(0,"div",3),D(1),h()),i&2){let A=p();Q(),Ya("",A.i18n.noSessionsFound," for user '",A.userId,"'")}}function WvA(i,e){if(i&1&&(I(0,"div",18),D(1),h()),i&2){let A=p().$implicit;H("title",A.id),Q(),nA(A.id)}}function ZvA(i,e){if(i&1&&(I(0,"div",19)(1,"mat-icon"),D(2,"visibility"),h(),D(3),h()),i&2){let A=p(3);Q(3),Ee(" ",A.i18n.readonlyChip," ")}}function XvA(i,e){if(i&1){let A=aA();I(0,"div",10),U("click",function(){let n=L(A).$implicit,o=p(2);return G(o.getSession(n.id))}),I(1,"div",11)(2,"div",12)(3,"div",13),D(4),h(),I(5,"button",14),U("click",function(n){let o=L(A).$implicit,a=p(2);return G(a.promoteToTest(n,o))}),I(6,"mat-icon"),D(7,"fact_check"),h()(),I(8,"button",15),U("click",function(n){let o=L(A).$implicit,a=p(2);return G(a.deleteSession(n,o))}),I(9,"mat-icon"),D(10,"delete"),h()()(),I(11,"div",16)(12,"div",17),D(13),h(),T(14,WvA,2,2,"div",18),h()(),T(15,ZvA,4,1,"div",19),mt(16,"async"),h()}if(i&2){let A=e.$implicit,t=p(2);H("ngClass",A.id===t.sessionId?"session-item current":"session-item"),Q(3),_A("is-monospace",!t.hasDisplayName(A)),H("title",A.id),Q(),nA(t.getSessionDisplayName(A)),Q(9),nA(t.getDate(A)),Q(),O(t.hasDisplayName(A)?14:-1),Q(),O(Ft(16,8,t.sessionService.canEdit(t.userId,A))===!1?15:-1)}}function $vA(i,e){i&1&&(I(0,"div",2),lA(1,"mat-progress-bar",7),h())}function AbA(i,e){if(i&1){let A=aA();T(0,$vA,2,0,"div",2),I(1,"div",20)(2,"button",21),U("click",function(){L(A);let n=p(2);return G(n.loadMoreSessions())}),D(3,"Load more"),h()()}if(i&2){p(2);let A=Ki(3);O(A?0:-1)}}function ebA(i,e){if(i&1&&(I(0,"div",8),ke(1,XvA,17,10,"div",9,ni),h(),T(3,AbA,4,1),mt(4,"async")),i&2){let A=p();Q(),_e(A.sessionList),Q(2),O(Ft(4,1,A.isSessionFilteringEnabled)&&A.canLoadMoreSessions?3:-1)}}var Sy=class i{userId="";appName="";sessionId="";sessionSelected=new FA;sessionReloaded=new FA;SESSIONS_PAGE_LIMIT=100;sessionList=[];canLoadMoreSessions=!1;pageToken="";filterControl=new Ps("");editingSessionId=null;sessionNameControl=new Ps("");refreshSessionsSubject=new ne;route=w($s);changeDetectorRef=w(Mt);sessionService=w(tl);uiStateService=w(ag);i18n=w(d$);featureFlagService=w(Nr);dialog=w(Xa);testsService=w(c2);isSessionFilteringEnabled=this.featureFlagService.isSessionFilteringEnabled();isLoadingMoreInProgress=mA(!1);isInitialized=mA(!1);constructor(){this.filterControl.valueChanges.pipe(Os(300)).subscribe(()=>{this.pageToken="",this.sessionList=[],this.refreshSessionsSubject.next()}),this.refreshSessionsSubject.pipe(mi(()=>{this.uiStateService.setIsSessionListLoading(!0)}),Mi(()=>{let e=this.filterControl.value||void 0;return this.isSessionFilteringEnabled?this.sessionService.listSessions(this.userId,this.appName,{filter:e,pageToken:this.pageToken,pageSize:this.SESSIONS_PAGE_LIMIT}).pipe(aa(()=>oe({items:[],nextPageToken:""}))):this.sessionService.listSessions(this.userId,this.appName).pipe(aa(()=>oe({items:[],nextPageToken:""})))}),mi(({items:e,nextPageToken:A})=>{this.isInitialized.set(!0),this.sessionList=Array.from(new Map([...this.sessionList,...e].map(t=>[t.id,t])).values()).sort((t,n)=>Number(n.lastUpdateTime)-Number(t.lastUpdateTime)),this.pageToken=A??"",this.canLoadMoreSessions=!!A,this.changeDetectorRef.markForCheck()})).subscribe(()=>{this.isLoadingMoreInProgress.set(!1),this.uiStateService.setIsSessionListLoading(!1)},()=>{this.isLoadingMoreInProgress.set(!1),this.uiStateService.setIsSessionListLoading(!1)})}ngOnInit(){this.featureFlagService.isSessionFilteringEnabled().subscribe(e=>{if(e){let A=this.route.snapshot.queryParams.session;A&&this.filterControl.setValue(A)}}),setTimeout(()=>{this.refreshSessionsSubject.next()},500)}getSession(e){e&&this.sessionSelected.emit(e)}loadMoreSessions(){this.isLoadingMoreInProgress.set(!0),this.refreshSessionsSubject.next()}getSessionDisplayName(e){return e.state?.__session_metadata__?.displayName||e.id}hasDisplayName(e){return!!e.state?.__session_metadata__?.displayName}startEditSessionName(e){this.editingSessionId=e.id,this.sessionNameControl.setValue(this.getSessionDisplayName(e))}cancelEditSessionName(){this.editingSessionId=null,this.sessionNameControl.setValue("")}saveSessionName(e){if(!this.editingSessionId||!e.id)return;let A=this.sessionNameControl.value,t=e.state||{},n=$A(P({},t),{__session_metadata__:$A(P({},t.__session_metadata__||{}),{displayName:A})});e.state=n,this.editingSessionId=null,this.sessionService.updateSession(this.userId,this.appName,e.id,{stateDelta:n}).subscribe({error:()=>{}})}deleteSession(e,A){e.stopPropagation();let t=A.id,n=this.getSessionDisplayName(A),o=`Are you sure you want to delete session ${t}?`;n!==t&&(o=`Are you sure you want to delete session "${n}" (${t})?`);let a={title:"Confirm delete",message:o,confirmButtonText:"Delete",cancelButtonText:"Cancel"};this.dialog.open(Mc,{width:"600px",data:a}).afterClosed().subscribe(s=>{s&&this.sessionService.deleteSession(this.userId,this.appName,t).subscribe(()=>{this.refreshSession(t)})})}promoteToTest(e,A){e.stopPropagation();let t=window.prompt("Enter test name (e.g., test1):");t&&this.sessionService.getSession(this.userId,this.appName,A.id).subscribe(n=>{let o={events:n.events};this.testsService.createTest(this.appName,t,o).subscribe({next:()=>{alert(`Test ${t} created successfully.`)},error:a=>{alert(`Error creating test: ${a.message||a}`)}})})}getDate(e){let A=e.lastUpdateTime||0;return new Date(A*1e3).toLocaleString()}fromApiResultToSession(e){return{id:e.id??"",appName:e.appName??"",userId:e.userId??"",state:e.state??{},events:e.events??[]}}reloadSession(e){this.sessionReloaded.emit(e)}refreshSession(e){let A=null;if(this.sessionList.length>0){let t=this.sessionList.findIndex(n=>n.id===e);t===this.sessionList.length-1&&(t=-1),A=this.sessionList[t+1]}return this.isSessionFilteringEnabled?this.filterControl.setValue(""):(this.sessionList=[],this.refreshSessionsSubject.next()),A}static \u0275fac=function(A){return new(A||i)};static \u0275cmp=vA({type:i,selectors:[["app-session-tab"]],inputs:{userId:"userId",appName:"appName",sessionId:"sessionId"},outputs:{sessionSelected:"sessionSelected",sessionReloaded:"sessionReloaded"},decls:8,vars:7,consts:[[1,"session-wrapper"],[1,"session-filter-container"],[1,"loading-spinner-container"],[1,"empty-state"],["appearance","outline",1,"session-filter"],["matPrefix",""],["matInput","",3,"formControl"],["mode","indeterminate"],[1,"session-tab-container",2,"margin-top","16px"],[3,"ngClass"],[3,"click","ngClass"],[1,"session-info"],[1,"session-header"],[1,"session-id",3,"title"],["mat-icon-button","","title","Promote to test",1,"action-btn","promote-btn",3,"click"],["mat-icon-button","","title","Delete session",1,"action-btn","delete-btn",3,"click"],[1,"session-sub-row"],[1,"session-date"],[1,"session-real-id",3,"title"],[1,"readonly-badge"],[1,"load-more"],["mat-button","","color","primary",3,"click"]],template:function(A,t){if(A&1&&(I(0,"div",0),T(1,jvA,7,2,"div",1),mt(2,"async"),ro(3),mt(4,"async"),T(5,VvA,2,0,"div",2)(6,qvA,2,2,"div",3)(7,ebA,5,3),h()),A&2){Q(),O(Ft(2,2,t.isSessionFilteringEnabled)?1:-1),Q(2);let n=so(Ft(4,4,t.uiStateService.isSessionListLoading()));Q(2),O((n||!t.isInitialized())&&!t.isLoadingMoreInProgress()?5:!n&&t.isInitialized()&&t.sessionList.length===0?6:7)}},dependencies:[Vl,uE,zt,Za,Zo,xs,mQ,Ws,ka,fn,Gn,Kn,WC,x1,qi,ki,yi,Un,Ls,gs],styles:[".session-wrapper[_ngcontent-%COMP%]{padding-left:25px;padding-right:25px;font-size:14px;font-weight:700;color:var(--session-tab-session-wrapper-color);display:flex;flex-direction:column;overflow:hidden;height:100%}.session-wrapper[_ngcontent-%COMP%] .empty-state[_ngcontent-%COMP%]{color:initial;padding-top:1em;text-align:center;font-weight:400;font-style:italic}.session-wrapper[_ngcontent-%COMP%] .session-filter-container[_ngcontent-%COMP%]{border-radius:8px;padding:16px;margin-bottom:16px;margin-top:16px}.session-wrapper[_ngcontent-%COMP%] .session-filter[_ngcontent-%COMP%]{width:100%}.session-tab-container[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.session-item[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center;border:none;border-radius:8px;margin-bottom:4px;cursor:pointer}.session-item[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-surface-variant, rgba(0, 0, 0, .04))}.session-item.current[_ngcontent-%COMP%]{background-color:var(--mat-sys-secondary-container, rgba(0, 0, 0, .08))}.session-item[_ngcontent-%COMP%] mat-chip[_ngcontent-%COMP%]{margin-right:11px}.session-id[_ngcontent-%COMP%]{color:var(--session-tab-session-id-color);font-family:Roboto,sans-serif;font-size:14px;font-style:normal;font-weight:500;line-height:20px;letter-spacing:.25px}.session-id.is-monospace[_ngcontent-%COMP%]{font-family:Google Sans Mono,monospace}.session-sub-row[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:8px}.session-date[_ngcontent-%COMP%]{color:var(--session-tab-session-date-color);font-family:Roboto;font-size:12px;font-style:normal;font-weight:400;line-height:16px;letter-spacing:.3px;white-space:nowrap}.session-real-id[_ngcontent-%COMP%]{color:var(--session-tab-session-id-color);font-family:Google Sans Mono,monospace;font-size:12px;font-style:normal;font-weight:400;line-height:16px;letter-spacing:.3px;opacity:.7;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;text-align:right}.session-info[_ngcontent-%COMP%]{padding:11px;flex:1;min-width:0}.session-info[_ngcontent-%COMP%] .session-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;height:24px;margin-bottom:2px}.session-info[_ngcontent-%COMP%] .session-header[_ngcontent-%COMP%] .session-id[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.session-info[_ngcontent-%COMP%] .session-header[_ngcontent-%COMP%] .session-name-input[_ngcontent-%COMP%]{flex:1;height:20px;padding:0 4px;font-family:inherit;font-size:14px;border:1px solid var(--mat-sys-outline, #ccc);border-radius:4px;background:var(--mat-sys-surface, #fff);color:var(--mat-sys-on-surface, #000);outline:none;min-width:0;margin-right:4px}.session-info[_ngcontent-%COMP%] .session-header[_ngcontent-%COMP%] .session-name-input[_ngcontent-%COMP%]:focus{border-color:var(--mat-sys-primary, #1976d2)}.session-info[_ngcontent-%COMP%] .session-header[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{width:24px;height:24px;padding:0;display:none}.session-info[_ngcontent-%COMP%] .session-header[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%] .mat-icon{font-size:16px;width:16px;height:16px;line-height:16px}.session-info[_ngcontent-%COMP%] .session-header[_ngcontent-%COMP%] .save-btn[_ngcontent-%COMP%], .session-info[_ngcontent-%COMP%] .session-header[_ngcontent-%COMP%] .cancel-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;margin-left:2px}.session-item[_ngcontent-%COMP%]:hover .action-btn.edit-btn[_ngcontent-%COMP%], .session-item[_ngcontent-%COMP%]:hover .action-btn.delete-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center}.loading-spinner-container[_ngcontent-%COMP%]{margin-left:auto;margin-right:auto;margin-top:2em;width:100%}.load-more[_ngcontent-%COMP%]{display:flex;justify-content:center;margin-top:1em}.readonly-badge[_ngcontent-%COMP%]{color:var(--chat-readonly-badge-color);border-radius:4px;padding:1px 6px;display:flex;align-items:center;margin-right:8px;font-size:12px;line-height:16px;gap:4px;white-space:nowrap}.readonly-badge[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:14px;width:14px;height:14px;padding-top:1px;flex-shrink:0}"]})};var tbA=["consoleArea"];function ibA(i,e){i&1&&lA(0,"mat-progress-bar",3)}var Rp=class i{constructor(e,A){this.dialogRef=e;this.data=A}consoleOutput=mA("");isLoading=mA(!0);subscription;consoleArea;ngOnInit(){this.subscription=this.data.output$.subscribe({next:e=>{this.consoleOutput.update(A=>A+e),this.scrollToBottom()},complete:()=>{this.isLoading.set(!1)}})}ngOnDestroy(){this.subscription?.unsubscribe()}scrollToBottom(){setTimeout(()=>{if(this.consoleArea){let e=this.consoleArea.nativeElement;e.scrollTop=e.scrollHeight}},0)}close(){this.dialogRef.close()}static \u0275fac=function(A){return new(A||i)(st(zn),st(Do))};static \u0275cmp=vA({type:i,selectors:[["app-console-dialog"]],viewQuery:function(A,t){if(A&1&&Wt(tbA,5),A&2){let n;se(n=le())&&(t.consoleArea=n.first)}},decls:11,vars:3,consts:[["consoleArea",""],["mat-dialog-title",""],[1,"mat-typography"],["mode","indeterminate",2,"margin-bottom","8px"],[1,"console-box"],["align","end"],["mat-button","",3,"click"]],template:function(A,t){A&1&&(I(0,"h2",1),D(1),h(),I(2,"mat-dialog-content",2),T(3,ibA,1,0,"mat-progress-bar",3),I(4,"div",4,0)(6,"pre"),D(7),h()()(),I(8,"mat-dialog-actions",5)(9,"button",6),U("click",function(){return t.close()}),D(10,"Close"),h()()),A&2&&(Q(),nA(t.data.title),Q(2),O(t.isLoading()?3:-1),Q(4),nA(t.consoleOutput()))},dependencies:[li,qi,ki,Ls,Xo,ha,Ba,pE,uE],styles:[".console-box[_ngcontent-%COMP%]{background-color:#1e1e1e;color:#dcdcdc;padding:16px;border-radius:4px;min-height:200px;flex:1;overflow-y:auto;font-family:Roboto Mono,monospace;font-size:12px}.console-box[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{margin:0;white-space:pre-wrap;word-wrap:break-word} .mat-mdc-dialog-content{max-height:70vh!important;overflow:hidden!important;display:flex;flex-direction:column}"]})};function nbA(i,e){i&1&&(I(0,"div",7),lA(1,"mat-spinner",8),h())}var Np=class i{constructor(e,A){this.dialogRef=e;this.data=A;this.inputValue=A.value}inputValue;loading=mA(!1);onCancel(){this.dialogRef.close()}onSubmitClick(){this.inputValue&&(this.loading.set(!0),this.data.onSubmit(this.inputValue).subscribe({next:()=>{this.loading.set(!1),this.dialogRef.close(!0)},error:e=>{this.loading.set(!1),window.alert(`Operation failed: ${e.message||e}`)}}))}static \u0275fac=function(A){return new(A||i)(st(zn),st(Do))};static \u0275cmp=vA({type:i,selectors:[["app-prompt-dialog"]],decls:13,vars:7,consts:[["mat-dialog-title",""],[1,"full-width"],["matInput","",3,"ngModelChange","ngModel","disabled"],["class","spinner-container",4,"ngIf"],["align","end"],["mat-button","",3,"click","disabled"],["mat-button","","color","primary",3,"click","disabled"],[1,"spinner-container"],["diameter","40"]],template:function(A,t){A&1&&(I(0,"h2",0),D(1),h(),I(2,"mat-dialog-content")(3,"mat-form-field",1)(4,"mat-label"),D(5),h(),I(6,"input",2),Ni("ngModelChange",function(o){return wi(t.inputValue,o)||(t.inputValue=o),o}),h()(),kt(7,nbA,2,0,"div",3),h(),I(8,"mat-dialog-actions",4)(9,"button",5),U("click",function(){return t.onCancel()}),D(10,"Cancel"),h(),I(11,"button",6),U("click",function(){return t.onSubmitClick()}),D(12,"Submit"),h()()),A&2&&(Q(),nA(t.data.title),Q(4),nA(t.data.label),Q(),Ri("ngModel",t.inputValue),H("disabled",t.loading()),Q(),H("ngIf",t.loading()),Q(2),H("disabled",t.loading()),Q(2),H("disabled",t.loading()||!t.inputValue))},dependencies:[li,ql,Ls,Xo,ha,Ba,qi,ki,Za,Zo,xs,Ws,ka,l2,Es,fn,Gn,Kn,Ho],styles:[".full-width[_ngcontent-%COMP%]{width:100%}.spinner-container[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;margin-top:16px}"]})};function obA(i,e){i&1&&(I(0,"div",6)(1,"mat-icon"),D(2,"assignment_late"),h(),I(3,"span"),D(4,"No tests found for this agent."),h()())}function abA(i,e){i&1&&(I(0,"th",13),D(1," Test Name "),h())}function rbA(i,e){if(i&1&&(I(0,"td",14),D(1),h()),i&2){let A=e.$implicit;Q(),Ee(" ",A.replace(".json","")," ")}}function sbA(i,e){i&1&&(I(0,"th",13),D(1," Actions "),h())}function lbA(i,e){if(i&1){let A=aA();I(0,"td",14)(1,"button",15),U("click",function(){let n=L(A).$implicit,o=p(2);return G(o.runTest(n))}),I(2,"mat-icon"),D(3,"play_arrow"),h()(),I(4,"button",16),U("click",function(){let n=L(A).$implicit,o=p(2);return G(o.rebuildTest(n))}),I(5,"mat-icon"),D(6,"sync"),h()(),I(7,"button",17),U("click",function(){let n=L(A).$implicit,o=p(2);return G(o.renameTest(n))}),I(8,"mat-icon"),D(9,"edit"),h()(),I(10,"button",18),U("click",function(){let n=L(A).$implicit,o=p(2);return G(o.deleteTest(n))}),I(11,"mat-icon"),D(12,"delete"),h()()()}if(i&2){let A=p(2);Q(),H("disabled",A.isRunning()||A.isRebuilding()),Q(3),H("disabled",A.isRunning()||A.isRebuilding()),Q(3),H("disabled",A.isRunning()||A.isRebuilding()),Q(3),H("disabled",A.isRunning()||A.isRebuilding())}}function gbA(i,e){if(i&1){let A=aA();I(0,"tr",19),U("click",function(){let n=L(A).$implicit,o=p(2);return G(o.selectTest(n))}),h()}if(i&2){let A=e.$implicit,t=p(2);_A("selected-row",A===t.selectedTest())}}function cbA(i,e){if(i&1&&(I(0,"table",7),vl(1,8),kt(2,abA,2,0,"th",9)(3,rbA,2,1,"td",10),bl(),vl(4,11),kt(5,sbA,2,0,"th",9)(6,lbA,13,4,"td",10),bl(),kt(7,gbA,1,2,"tr",12),h()),i&2){let A=p();H("dataSource",A.dataSource),Q(7),H("matRowDefColumns",A.displayedColumns)}}var ky=class i{appName=ve("");sessionId=ve("");userId=ve("");isViewOnlySession=ve(!1);testsService=w(c2);dialog=w(Xa);sessionService=w(tl);dataSource=new dI([]);consoleOutput=mA("");selectedTest=mA(null);testSelected=Si();isRunning=mA(!1);isRebuilding=mA(!1);displayedColumns=["name","actions"];ngOnInit(){this.loadTests()}ngOnChanges(e){e.appName&&!e.appName.isFirstChange()&&this.loadTests()}loadTests(){this.appName()&&this.testsService.listTests(this.appName()).subscribe(e=>{this.dataSource.data=e})}selectTest(e){this.selectedTest.set(e),this.testsService.getTest(this.appName(),e).subscribe(A=>{this.testSelected.emit({testName:e,events:A.events||[]})})}promoteCurrentSessionToTest(){this.sessionId()&&this.sessionService.getSession(this.userId(),this.appName(),this.sessionId()).subscribe(e=>{let t=(e.state?.__session_metadata__?.displayName||this.sessionId()).replace(/ /g,"_").replace(/[^a-zA-Z0-9_-]/g,""),n={events:e.events};this.dialog.open(Np,{data:{title:"Add Current Session as Test",label:"Test Name",value:t,onSubmit:o=>this.testsService.createTest(this.appName(),o,n).pipe(Mi(()=>this.testsService.rebuildTests(this.appName(),o)))}}).afterClosed().subscribe(o=>{o&&this.loadTests()})})}renameTest(e){this.dialog.open(Np,{data:{title:"Rename Test",label:"New Name",value:e.replace(".json",""),onSubmit:A=>{let t=A.replace(/ /g,"_").replace(/[^a-zA-Z0-9_-]/g,"");return this.testsService.getTest(this.appName(),e).pipe(Mi(n=>this.testsService.createTest(this.appName(),t,n)),Mi(()=>this.testsService.deleteTest(this.appName(),e)))}}}).afterClosed().subscribe(A=>{A&&this.loadTests()})}runAllTests(){this.runTest()}runTest(e){this.isRunning.set(!0);let A=new ne;this.dialog.open(Rp,{width:"90vw",maxWidth:"1200px",height:"80vh",data:{title:`Running ${e||"all tests"}`,output$:A.asObservable()}}),this.testsService.runTests(this.appName(),e).subscribe({next:t=>{A.next(t)},error:t=>{A.next(` |