@whoz-oss/coday-client 0.244.0 → 0.244.1

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.
@@ -1 +1 @@
1
- import{a as Fe}from"./chunk-EAVXJ7QN.js";import{c as le}from"./chunk-2PWIGCN2.js";import{b as Ie}from"./chunk-EZSEUOCV.js";import{a as ue,b as _e,g as fe,h as he,i as De,j as Oe}from"./chunk-GTCP3EYX.js";import{a as de,b as me,c as ce,d as ge,e as pe,x as Te,y as ke,z as We}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import{a as $,b as ee,d as te,e as ne,f as ie,g as oe,h as ae}from"./chunk-BTOJ27OO.js";import"./chunk-SPV5SLNS.js";import"./chunk-VMYKE4ZC.js";import{a as F,b as T}from"./chunk-AS2L77JV.js";import{A as we,B as Se,C as Ee,E as Pe,c as Ce,g as Me,m as ye,o as be,p as xe,y as ve,z as Ae}from"./chunk-7OGOI6WM.js";import{b as se}from"./chunk-TASSC2XX.js";import{O,Q as re,S as I}from"./chunk-G5RWG2GK.js";import{$b as f,Bb as b,Db as c,Fb as m,Hc as X,Ka as d,Pb as L,Rb as A,Tb as l,Ub as x,Vb as B,Wa as E,Wb as G,Xc as Y,Z as j,Zb as u,_b as _,ab as k,ca as h,cc as Z,dc as K,g as V,ga as g,ha as p,jb as N,jc as J,lb as M,mb as y,mc as Q,nb as W,ob as U,pb as P,qb as D,rb as C,sb as i,ta as S,tb as o,ub as z,yb as q,zb as H}from"./chunk-CHEXA6RY.js";var v=class s{http=h(Y);projectState=h(se);getBaseUrl(){return`/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/agents`}listEditableAgents(){return this.http.get(`${this.getBaseUrl()}/editable`)}getAgent(t){return this.http.get(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}createAgent(t,e){return this.http.post(this.getBaseUrl(),{location:e,definition:t})}updateAgent(t,e){return this.http.put(`${this.getBaseUrl()}/${encodeURIComponent(t)}`,{definition:e})}listDocuments(t){return this.http.get(`${this.getBaseUrl()}/documents`,{params:{location:t}})}uploadDocument(t,e){return new V(n=>{let a=new FileReader;a.onload=()=>{let r=a.result.split(",")[1];this.http.post(`${this.getBaseUrl()}/documents`,{filename:e.name,content:r,mimeType:e.type},{params:{location:t}}).subscribe(n)},a.onerror=()=>n.error(a.error),a.readAsDataURL(e)})}deleteAgent(t){return this.http.delete(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}static \u0275fac=function(e){return new(e||s)};static \u0275prov=j({token:s,factory:s.\u0275fac,providedIn:"root"})};function Ne(s,t){s&1&&(i(0,"p",15),l(1,"No integrations defined \u2014 agent will have access to all tools."),o())}function Ue(s,t){if(s&1){let e=b();i(0,"div",16)(1,"mat-form-field",22)(2,"mat-label"),l(3,"Integration"),o(),i(4,"input",23),f("ngModelChange",function(a){let r=g(e).$implicit;return _(r.integration,a)||(r.integration=a),p(a)}),o()(),i(5,"mat-form-field",24)(6,"mat-label"),l(7,"Tools (comma-separated)"),o(),i(8,"input",25),f("ngModelChange",function(a){let r=g(e).$implicit;return _(r.tools,a)||(r.tools=a),p(a)}),o()(),i(9,"button",26),c("click",function(){let a=g(e).$index,r=m();return p(r.removeIntegrationRow(a))}),i(10,"mat-icon"),l(11,"delete"),o()()()}if(s&2){let e=t.$implicit;d(4),u("ngModel",e.integration),d(4),u("ngModel",e.tools)}}function ze(s,t){if(s&1&&(i(0,"p",30),l(1),o()),s&2){let e=m(2);d(),x(e.docUploadError)}}function qe(s,t){s&1&&(i(0,"p",15),l(1,"No mandatory documents defined."),o())}function He(s,t){if(s&1&&z(0,"option",35),s&2){let e=t.$implicit;C("value","documents/"+e)}}function Ge(s,t){if(s&1){let e=b();i(0,"div",31)(1,"mat-form-field",32)(2,"mat-label"),l(3,"Document path"),o(),i(4,"input",33),f("ngModelChange",function(a){let r=g(e).$index,R=m(2);return _(R.mandatoryDocs[r],a)||(R.mandatoryDocs[r]=a),p(a)}),o(),i(5,"datalist",34),P(6,He,1,1,"option",35,U),o()(),i(8,"button",26),c("click",function(){let a=g(e).$index,r=m(2);return p(r.removeDocRow(a))}),i(9,"mat-icon"),l(10,"delete"),o()()()}if(s&2){let e=t.$index,n=m(2);d(4),u("ngModel",n.mandatoryDocs[e]),N("list","docs-list-"+e),d(),C("id","docs-list-"+e),d(),D(n.availableDocuments)}}function Ze(s,t){if(s&1){let e=b();i(0,"div",6)(1,"span"),l(2,"Mandatory Documents"),o(),i(3,"button",27),c("click",function(){g(e);let a=m();return p(a.addDocRow())}),i(4,"mat-icon"),l(5,"add"),o()(),i(6,"label",28)(7,"mat-icon"),l(8,"upload_file"),o(),i(9,"input",29),c("change",function(a){g(e);let r=m();return p(r.onDocFileSelected(a))}),o()()(),M(10,ze,2,1,"p",30),M(11,qe,2,0,"p",15),P(12,Ge,11,3,"div",31,W)}if(s&2){let e=m();d(6),A("uploading",e.isUploadingDoc),d(3),C("disabled",e.isUploadingDoc),d(),y(e.docUploadError?10:-1),d(),y(e.mandatoryDocs.length===0?11:-1),d(),D(e.mandatoryDocs)}}function Ke(s,t){s&1&&(i(0,"p",15),l(1,"\u{1F4A1} Documents can be added after the agent is created."),o())}function Je(s,t){if(s&1){let e=b();i(0,"div",6),l(1,"Save to"),o(),i(2,"div",36)(3,"label",37)(4,"input",38),f("ngModelChange",function(a){g(e);let r=m();return _(r.location,a)||(r.location=a),p(a)}),o(),i(5,"div",39)(6,"div",40)(7,"span",41),l(8,"\u{1F464}"),o(),i(9,"span",42),l(10,"Project config"),o()(),i(11,"p",43),l(12),o()()(),i(13,"label",37)(14,"input",44),f("ngModelChange",function(a){g(e);let r=m();return _(r.location,a)||(r.location=a),p(a)}),o(),i(15,"div",39)(16,"div",40)(17,"span",41),l(18,"\u{1F4E6}"),o(),i(19,"span",42),l(20,"Colocated"),o()(),i(21,"p",43),l(22,"Next to coday.yaml in ./agents/ (committable)"),o()()()(),i(23,"p",15),l(24,"Storage location is permanent and cannot be changed after creation."),o()}if(s&2){let e=m();d(3),A("selected",e.location==="project"),d(),u("ngModel",e.location),d(8),G("~/.coday/projects/","{","name","}","/agents/ (not committed)"),d(),A("selected",e.location==="colocated"),d(),u("ngModel",e.location)}}function Qe(s,t){if(s&1&&(i(0,"div",17)(1,"span",6),l(2,"Storage Location"),o(),i(3,"span",45),l(4),o(),i(5,"p",15),l(6,"Cannot be changed after creation."),o()()),s&2){let e=m();d(3),A("badge-project",e.location==="project")("badge-colocated",e.location==="colocated"),d(),B(" ",e.location==="project"?"\u{1F464} Project config":"\u{1F4E6} Colocated"," ")}}function Xe(s,t){if(s&1&&(i(0,"div",18)(1,"mat-icon"),l(2,"error"),o(),i(3,"span"),l(4),o()()),s&2){let e=m();d(4),x(e.errorMessage)}}var w=class s{agentCrudApi=h(v);agentApi=h(Fe);dialogRef=h($);data=h(ee);name="";description="";instructions="";aiProvider="";modelName="";temperature=null;maxOutputTokens=null;openaiAssistantId="";integrationRows=[];mandatoryDocs=[];availableDocuments=[];isUploadingDoc=!1;docUploadError="";location="project";isSaving=!1;errorMessage="";isEditMode=!1;ngOnInit(){if(this.isEditMode=this.data.mode==="edit",this.isEditMode&&this.data.agent){let t=this.data.agent.definition;this.name=t.name,this.description=t.description,this.instructions=t.instructions??"",this.aiProvider=t.aiProvider??"",this.modelName=t.modelName??"",this.temperature=t.temperature??null,this.maxOutputTokens=t.maxOutputTokens??null,this.openaiAssistantId=t.openaiAssistantId??"",this.location=this.data.agent.source,t.integrations&&(this.integrationRows=Object.entries(t.integrations).map(([e,n])=>({integration:e,tools:n?.join(", ")??""}))),this.mandatoryDocs=[...t.mandatoryDocs??[]],this.loadAvailableDocuments()}}loadAvailableDocuments(){this.agentCrudApi.listDocuments(this.location).subscribe({next:t=>this.availableDocuments=t,error:()=>this.availableDocuments=[]})}addDocRow(){this.mandatoryDocs.push("")}removeDocRow(t){this.mandatoryDocs.splice(t,1)}onDocFileSelected(t){let e=t.target,n=e.files?.[0];n&&(this.isUploadingDoc=!0,this.docUploadError="",this.agentCrudApi.uploadDocument(this.location,n).subscribe({next:a=>{this.isUploadingDoc=!1,this.mandatoryDocs.push(a.relativePath),this.loadAvailableDocuments(),e.value=""},error:a=>{this.isUploadingDoc=!1,this.docUploadError=a?.error?.error??a?.message??"Upload failed",e.value=""}}))}addIntegrationRow(){this.integrationRows.push({integration:"",tools:""})}removeIntegrationRow(t){this.integrationRows.splice(t,1)}trackByIndex(t){return t}validateForm(){if(!this.name.trim())return this.errorMessage="Name is required",!1;if(!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(this.name.trim()))return this.errorMessage="Name must start with alphanumeric and contain only letters, digits, hyphens or underscores",!1;if(!this.description.trim())return this.errorMessage="Description is required",!1;for(let t of this.integrationRows)if(!t.integration.trim())return this.errorMessage="Integration name cannot be empty",!1;return!0}buildDefinition(){let t=this.mandatoryDocs.map(n=>n.trim()).filter(Boolean),e=this.integrationRows.length>0?Object.fromEntries(this.integrationRows.filter(n=>n.integration.trim()).map(n=>[n.integration.trim(),n.tools.split(",").map(a=>a.trim()).filter(Boolean)])):void 0;return{name:this.name.trim(),description:this.description.trim(),instructions:this.instructions.trim()||void 0,aiProvider:this.aiProvider.trim()||void 0,modelName:this.modelName.trim()||void 0,temperature:this.temperature??void 0,maxOutputTokens:this.maxOutputTokens??void 0,openaiAssistantId:this.openaiAssistantId.trim()||void 0,integrations:e,mandatoryDocs:t.length>0?t:void 0}}save(){if(this.errorMessage="",!this.validateForm())return;let t=this.buildDefinition();this.isSaving=!0,(this.isEditMode?this.agentCrudApi.updateAgent(this.name.trim(),t):this.agentCrudApi.createAgent(t,this.location)).subscribe({next:()=>{this.isSaving=!1,this.agentApi.clearAllCache(),this.dialogRef.close(!0)},error:n=>{this.isSaving=!1,this.errorMessage=n?.error?.error||n?.message||"Failed to save agent"}})}cancel(){this.dialogRef.close(!1)}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=E({type:s,selectors:[["app-agent-form"]],decls:69,vars:18,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-agent","required","",3,"ngModelChange","ngModel","readonly"],["matInput","","placeholder","What does this agent do?","rows","2","required","",3,"ngModelChange","ngModel"],["matInput","","placeholder","System instructions for the agent...","rows","6",3,"ngModelChange","ngModel"],[1,"section-title"],[1,"row-2col"],["appearance","outline"],["matInput","","placeholder","e.g. anthropic, openai",3,"ngModelChange","ngModel"],["matInput","","placeholder","e.g. claude-sonnet-4-5",3,"ngModelChange","ngModel"],["matInput","","type","number","min","0","max","2","step","0.1","placeholder","0.0 \u2013 2.0",3,"ngModelChange","ngModel"],["matInput","","type","number","min","1","placeholder","e.g. 4096",3,"ngModelChange","ngModel"],["matInput","","placeholder","asst_...",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Add integration",3,"click"],[1,"hint"],[1,"integration-row"],[1,"source-display"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"integration-name"],["matInput","","placeholder","e.g. GITHUB",3,"ngModelChange","ngModel"],["appearance","outline",1,"integration-tools"],["matInput","","placeholder","Leave empty for all tools",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove",3,"click"],["mat-icon-button","","type","button","title","Add document path",3,"click"],["title","Upload a document to the pool",1,"upload-btn"],["type","file","hidden","",3,"change","disabled"],[1,"doc-upload-error"],[1,"doc-row"],["appearance","outline",1,"doc-field"],["matInput","","placeholder","documents/guide.md",3,"ngModelChange","ngModel"],[3,"id"],[3,"value"],[1,"source-options"],[1,"source-option"],["type","radio","name","location","value","project",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","location","value","colocated",3,"ngModelChange","ngModel"],[1,"source-badge"]],template:function(e,n){e&1&&(i(0,"h2",0),l(1),o(),i(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),l(6,"Name"),o(),i(7,"input",3),f("ngModelChange",function(r){return _(n.name,r)||(n.name=r),r}),o(),i(8,"mat-hint"),l(9,"Alphanumeric, hyphens and underscores only. Cannot be changed after creation."),o()(),i(10,"mat-form-field",2)(11,"mat-label"),l(12,"Description"),o(),i(13,"textarea",4),f("ngModelChange",function(r){return _(n.description,r)||(n.description=r),r}),o()(),i(14,"mat-form-field",2)(15,"mat-label"),l(16,"Instructions"),o(),i(17,"textarea",5),f("ngModelChange",function(r){return _(n.instructions,r)||(n.instructions=r),r}),o(),i(18,"mat-hint"),l(19,"System prompt / instructions sent to the AI model"),o()(),i(20,"div",6),l(21,"AI Configuration"),o(),i(22,"div",7)(23,"mat-form-field",8)(24,"mat-label"),l(25,"AI Provider"),o(),i(26,"input",9),f("ngModelChange",function(r){return _(n.aiProvider,r)||(n.aiProvider=r),r}),o()(),i(27,"mat-form-field",8)(28,"mat-label"),l(29,"Model Name"),o(),i(30,"input",10),f("ngModelChange",function(r){return _(n.modelName,r)||(n.modelName=r),r}),o()()(),i(31,"div",7)(32,"mat-form-field",8)(33,"mat-label"),l(34,"Temperature"),o(),i(35,"input",11),f("ngModelChange",function(r){return _(n.temperature,r)||(n.temperature=r),r}),o(),i(36,"mat-hint"),l(37,"Leave empty for model default"),o()(),i(38,"mat-form-field",8)(39,"mat-label"),l(40,"Max Output Tokens"),o(),i(41,"input",12),f("ngModelChange",function(r){return _(n.maxOutputTokens,r)||(n.maxOutputTokens=r),r}),o(),i(42,"mat-hint"),l(43,"Leave empty for model default"),o()()(),i(44,"mat-form-field",2)(45,"mat-label"),l(46,"OpenAI Assistant ID"),o(),i(47,"input",13),f("ngModelChange",function(r){return _(n.openaiAssistantId,r)||(n.openaiAssistantId=r),r}),o(),i(48,"mat-hint"),l(49,"If set, forces aiProvider to openai"),o()(),i(50,"div",6)(51,"span"),l(52,"Integrations"),o(),i(53,"button",14),c("click",function(){return n.addIntegrationRow()}),i(54,"mat-icon"),l(55,"add"),o()()(),M(56,Ne,2,0,"p",15),P(57,Ue,12,2,"div",16,W),M(59,Ze,14,5)(60,Ke,2,0,"p",15),M(61,Je,25,8),M(62,Qe,7,5,"div",17),M(63,Xe,5,1,"div",18),o()(),i(64,"mat-dialog-actions",19)(65,"button",20),c("click",function(){return n.cancel()}),l(66,"Cancel"),o(),i(67,"button",21),c("click",function(){return n.save()}),l(68),o()()),e&2&&(d(),x(n.isEditMode?"Edit Agent":"Create Agent"),d(6),u("ngModel",n.name),C("readonly",n.isEditMode),d(6),u("ngModel",n.description),d(4),u("ngModel",n.instructions),d(9),u("ngModel",n.aiProvider),d(4),u("ngModel",n.modelName),d(5),u("ngModel",n.temperature),d(6),u("ngModel",n.maxOutputTokens),d(6),u("ngModel",n.openaiAssistantId),d(9),y(n.integrationRows.length===0?56:-1),d(),D(n.integrationRows),d(2),y(n.isEditMode?59:60),d(2),y(n.isEditMode?-1:61),d(),y(n.isEditMode?62:-1),d(),y(n.errorMessage?63:-1),d(2),C("disabled",n.isSaving),d(2),C("disabled",n.isSaving),d(),B(" ",n.isSaving?"Saving...":"Save"," "))},dependencies:[Pe,ve,Ae,Ce,be,xe,Me,Ee,Se,we,ye,ae,ne,oe,ie,I,re,O,Oe,De,fe,ue,_e,he,T,F,Ie,le],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:560px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.section-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:1rem;font-weight:600;margin-top:.5rem;margin-bottom:-.25rem}.row-2col[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}@media(max-width:768px){.row-2col[_ngcontent-%COMP%]{grid-template-columns:1fr}}.integration-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.integration-row[_ngcontent-%COMP%] .integration-name[_ngcontent-%COMP%]{flex:0 0 180px}.integration-row[_ngcontent-%COMP%] .integration-tools[_ngcontent-%COMP%]{flex:1}.hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.5rem}@media(max-width:768px){.source-options[_ngcontent-%COMP%]{flex-direction:column}}.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-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.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-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-family:monospace;line-height:1.4}.source-display[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500}.source-badge.badge-project[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-badge.badge-colocated[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.doc-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.doc-row[_ngcontent-%COMP%] .doc-field[_ngcontent-%COMP%]{flex:1}.upload-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;cursor:pointer;color:var(--color-text-secondary);transition:background .2s}.upload-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);color:var(--color-primary)}.upload-btn.uploading[_ngcontent-%COMP%]{opacity:.5;cursor:wait}.upload-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.doc-upload-error[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-error)}.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}"]})};var Ye=()=>[],$e=s=>({id:s});function et(s,t){if(s&1&&(i(0,"div",5),l(1),o()),s&2){let e=m();d(),x(e.errorMessage())}}function tt(s,t){if(s&1){let e=b();i(0,"ds-entity-card",7),c("selected",function(a){g(e);let r=m();return p(r.onEdit(a))}),q(1,8),i(2,"button",9),c("click",function(a){return a.stopPropagation()}),i(3,"mat-icon"),l(4,"more_vert"),o()(),H(),o()}if(s&2){let e=t.$implicit;m();let n=L(9);C("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??Z(6,Ye)),d(2),C("matMenuTriggerFor",n)("matMenuTriggerData",K(7,$e,e.id))}}function nt(s,t){if(s&1){let e=b();i(0,"button",10),c("click",function(){let a=g(e).id,r=m();return p(r.onEdit(a))}),i(1,"mat-icon"),l(2,"edit"),o(),l(3," Edit "),o(),i(4,"button",11),c("click",function(){let a=g(e).id,r=m();return p(r.onDelete(a))}),i(5,"mat-icon"),l(6,"delete"),o(),l(7," Delete "),o()}}var Be=class s{agentCrudApi=h(v);location=h(X);dialog=h(te);agents=S([]);isLoading=S(!1);errorMessage=S(null);agentItems=Q(()=>this.agents().map(t=>({id:t.name,name:t.name,description:t.description,badges:this.buildBadges(t),groupKey:t.source,groupLabel:t.source==="project"?"Project (~/.coday/)":"Colocated (next to coday.yaml)"})));ngOnInit(){this.loadAgents()}loadAgents(){this.isLoading.set(!0),this.errorMessage.set(null),this.agentCrudApi.listEditableAgents().subscribe({next:t=>{this.agents.set(t),this.isLoading.set(!1)},error:t=>{this.errorMessage.set(t?.error?.error??"Failed to load agents"),this.isLoading.set(!1)}})}onBack(){this.location.back()}onCreate(){this.dialog.open(w,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadAgents()})}onEdit(t){this.agentCrudApi.getAgent(t).subscribe({next:e=>{this.dialog.open(w,{width:"700px",maxHeight:"90vh",data:{mode:"edit",agent:e}}).afterClosed().subscribe(a=>{a&&this.loadAgents()})},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load agent")})}onDelete(t){confirm(`Are you sure you want to delete agent "${t}"?`)&&this.agentCrudApi.deleteAgent(t).subscribe({next:()=>this.loadAgents(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete agent")})}buildBadges(t){return[t.source==="project"?{label:"project",variant:"info"}:{label:"colocated",variant:"success"}]}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=E({type:s,selectors:[["app-agent-list"]],decls:11,vars:4,consts:[["agentCard",""],["cardMenu","matMenu"],[1,"agent-list-page"],["title","Agents","cardMinWidth","260px","contentMaxWidth","1400px","searchPlaceholder","Filter agents\u2026","emptyMessage","No file-based agents found.",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],[1,"agent-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","",1,"agent-list__delete-item",3,"click"]],template:function(e,n){if(e&1&&(i(0,"div",2)(1,"ds-entity-list",3),c("createRequested",function(){return n.onCreate()}),i(2,"button",4),c("click",function(){return n.onBack()}),i(3,"mat-icon"),l(4,"chevron_left"),o()()(),M(5,et,2,1,"div",5),o(),k(6,tt,5,9,"ng-template",null,0,J),i(8,"mat-menu",null,1),k(10,nt,8,0,"ng-template",6),o()),e&2){let a=L(7);d(),C("items",n.agentItems())("showCreate",!0)("itemTemplate",a),d(4),y(n.errorMessage()?5:-1)}},dependencies:[We,ke,Te,I,O,T,F,pe,ce,de,me,ge],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.agent-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.agent-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.agent-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{Be as AgentListComponent};
1
+ import{a as Fe}from"./chunk-SFQE4GQ6.js";import{c as le}from"./chunk-2PWIGCN2.js";import{b as Ie}from"./chunk-EZSEUOCV.js";import{a as ue,b as _e,g as fe,h as he,i as De,j as Oe}from"./chunk-GTCP3EYX.js";import{a as de,b as me,c as ce,d as ge,e as pe,x as Te,y as ke,z as We}from"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import{a as $,b as ee,d as te,e as ne,f as ie,g as oe,h as ae}from"./chunk-BTOJ27OO.js";import"./chunk-SPV5SLNS.js";import"./chunk-VMYKE4ZC.js";import{a as F,b as T}from"./chunk-AS2L77JV.js";import{A as we,B as Se,C as Ee,E as Pe,c as Ce,g as Me,m as ye,o as be,p as xe,y as ve,z as Ae}from"./chunk-7OGOI6WM.js";import{b as se}from"./chunk-TASSC2XX.js";import{O,Q as re,S as I}from"./chunk-G5RWG2GK.js";import{$b as f,Bb as b,Db as c,Fb as m,Hc as X,Ka as d,Pb as L,Rb as A,Tb as l,Ub as x,Vb as B,Wa as E,Wb as G,Xc as Y,Z as j,Zb as u,_b as _,ab as k,ca as h,cc as Z,dc as K,g as V,ga as g,ha as p,jb as N,jc as J,lb as M,mb as y,mc as Q,nb as W,ob as U,pb as P,qb as D,rb as C,sb as i,ta as S,tb as o,ub as z,yb as q,zb as H}from"./chunk-CHEXA6RY.js";var v=class s{http=h(Y);projectState=h(se);getBaseUrl(){return`/api/projects/${this.projectState.getSelectedProjectIdOrThrow()}/agents`}listEditableAgents(){return this.http.get(`${this.getBaseUrl()}/editable`)}getAgent(t){return this.http.get(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}createAgent(t,e){return this.http.post(this.getBaseUrl(),{location:e,definition:t})}updateAgent(t,e){return this.http.put(`${this.getBaseUrl()}/${encodeURIComponent(t)}`,{definition:e})}listDocuments(t){return this.http.get(`${this.getBaseUrl()}/documents`,{params:{location:t}})}uploadDocument(t,e){return new V(n=>{let a=new FileReader;a.onload=()=>{let r=a.result.split(",")[1];this.http.post(`${this.getBaseUrl()}/documents`,{filename:e.name,content:r,mimeType:e.type},{params:{location:t}}).subscribe(n)},a.onerror=()=>n.error(a.error),a.readAsDataURL(e)})}deleteAgent(t){return this.http.delete(`${this.getBaseUrl()}/${encodeURIComponent(t)}`)}static \u0275fac=function(e){return new(e||s)};static \u0275prov=j({token:s,factory:s.\u0275fac,providedIn:"root"})};function Ne(s,t){s&1&&(i(0,"p",15),l(1,"No integrations defined \u2014 agent will have access to all tools."),o())}function Ue(s,t){if(s&1){let e=b();i(0,"div",16)(1,"mat-form-field",22)(2,"mat-label"),l(3,"Integration"),o(),i(4,"input",23),f("ngModelChange",function(a){let r=g(e).$implicit;return _(r.integration,a)||(r.integration=a),p(a)}),o()(),i(5,"mat-form-field",24)(6,"mat-label"),l(7,"Tools (comma-separated)"),o(),i(8,"input",25),f("ngModelChange",function(a){let r=g(e).$implicit;return _(r.tools,a)||(r.tools=a),p(a)}),o()(),i(9,"button",26),c("click",function(){let a=g(e).$index,r=m();return p(r.removeIntegrationRow(a))}),i(10,"mat-icon"),l(11,"delete"),o()()()}if(s&2){let e=t.$implicit;d(4),u("ngModel",e.integration),d(4),u("ngModel",e.tools)}}function ze(s,t){if(s&1&&(i(0,"p",30),l(1),o()),s&2){let e=m(2);d(),x(e.docUploadError)}}function qe(s,t){s&1&&(i(0,"p",15),l(1,"No mandatory documents defined."),o())}function He(s,t){if(s&1&&z(0,"option",35),s&2){let e=t.$implicit;C("value","documents/"+e)}}function Ge(s,t){if(s&1){let e=b();i(0,"div",31)(1,"mat-form-field",32)(2,"mat-label"),l(3,"Document path"),o(),i(4,"input",33),f("ngModelChange",function(a){let r=g(e).$index,R=m(2);return _(R.mandatoryDocs[r],a)||(R.mandatoryDocs[r]=a),p(a)}),o(),i(5,"datalist",34),P(6,He,1,1,"option",35,U),o()(),i(8,"button",26),c("click",function(){let a=g(e).$index,r=m(2);return p(r.removeDocRow(a))}),i(9,"mat-icon"),l(10,"delete"),o()()()}if(s&2){let e=t.$index,n=m(2);d(4),u("ngModel",n.mandatoryDocs[e]),N("list","docs-list-"+e),d(),C("id","docs-list-"+e),d(),D(n.availableDocuments)}}function Ze(s,t){if(s&1){let e=b();i(0,"div",6)(1,"span"),l(2,"Mandatory Documents"),o(),i(3,"button",27),c("click",function(){g(e);let a=m();return p(a.addDocRow())}),i(4,"mat-icon"),l(5,"add"),o()(),i(6,"label",28)(7,"mat-icon"),l(8,"upload_file"),o(),i(9,"input",29),c("change",function(a){g(e);let r=m();return p(r.onDocFileSelected(a))}),o()()(),M(10,ze,2,1,"p",30),M(11,qe,2,0,"p",15),P(12,Ge,11,3,"div",31,W)}if(s&2){let e=m();d(6),A("uploading",e.isUploadingDoc),d(3),C("disabled",e.isUploadingDoc),d(),y(e.docUploadError?10:-1),d(),y(e.mandatoryDocs.length===0?11:-1),d(),D(e.mandatoryDocs)}}function Ke(s,t){s&1&&(i(0,"p",15),l(1,"\u{1F4A1} Documents can be added after the agent is created."),o())}function Je(s,t){if(s&1){let e=b();i(0,"div",6),l(1,"Save to"),o(),i(2,"div",36)(3,"label",37)(4,"input",38),f("ngModelChange",function(a){g(e);let r=m();return _(r.location,a)||(r.location=a),p(a)}),o(),i(5,"div",39)(6,"div",40)(7,"span",41),l(8,"\u{1F464}"),o(),i(9,"span",42),l(10,"Project config"),o()(),i(11,"p",43),l(12),o()()(),i(13,"label",37)(14,"input",44),f("ngModelChange",function(a){g(e);let r=m();return _(r.location,a)||(r.location=a),p(a)}),o(),i(15,"div",39)(16,"div",40)(17,"span",41),l(18,"\u{1F4E6}"),o(),i(19,"span",42),l(20,"Colocated"),o()(),i(21,"p",43),l(22,"Next to coday.yaml in ./agents/ (committable)"),o()()()(),i(23,"p",15),l(24,"Storage location is permanent and cannot be changed after creation."),o()}if(s&2){let e=m();d(3),A("selected",e.location==="project"),d(),u("ngModel",e.location),d(8),G("~/.coday/projects/","{","name","}","/agents/ (not committed)"),d(),A("selected",e.location==="colocated"),d(),u("ngModel",e.location)}}function Qe(s,t){if(s&1&&(i(0,"div",17)(1,"span",6),l(2,"Storage Location"),o(),i(3,"span",45),l(4),o(),i(5,"p",15),l(6,"Cannot be changed after creation."),o()()),s&2){let e=m();d(3),A("badge-project",e.location==="project")("badge-colocated",e.location==="colocated"),d(),B(" ",e.location==="project"?"\u{1F464} Project config":"\u{1F4E6} Colocated"," ")}}function Xe(s,t){if(s&1&&(i(0,"div",18)(1,"mat-icon"),l(2,"error"),o(),i(3,"span"),l(4),o()()),s&2){let e=m();d(4),x(e.errorMessage)}}var w=class s{agentCrudApi=h(v);agentApi=h(Fe);dialogRef=h($);data=h(ee);name="";description="";instructions="";aiProvider="";modelName="";temperature=null;maxOutputTokens=null;openaiAssistantId="";integrationRows=[];mandatoryDocs=[];availableDocuments=[];isUploadingDoc=!1;docUploadError="";location="project";isSaving=!1;errorMessage="";isEditMode=!1;ngOnInit(){if(this.isEditMode=this.data.mode==="edit",this.isEditMode&&this.data.agent){let t=this.data.agent.definition;this.name=t.name,this.description=t.description,this.instructions=t.instructions??"",this.aiProvider=t.aiProvider??"",this.modelName=t.modelName??"",this.temperature=t.temperature??null,this.maxOutputTokens=t.maxOutputTokens??null,this.openaiAssistantId=t.openaiAssistantId??"",this.location=this.data.agent.source,t.integrations&&(this.integrationRows=Object.entries(t.integrations).map(([e,n])=>({integration:e,tools:n?.join(", ")??""}))),this.mandatoryDocs=[...t.mandatoryDocs??[]],this.loadAvailableDocuments()}}loadAvailableDocuments(){this.agentCrudApi.listDocuments(this.location).subscribe({next:t=>this.availableDocuments=t,error:()=>this.availableDocuments=[]})}addDocRow(){this.mandatoryDocs.push("")}removeDocRow(t){this.mandatoryDocs.splice(t,1)}onDocFileSelected(t){let e=t.target,n=e.files?.[0];n&&(this.isUploadingDoc=!0,this.docUploadError="",this.agentCrudApi.uploadDocument(this.location,n).subscribe({next:a=>{this.isUploadingDoc=!1,this.mandatoryDocs.push(a.relativePath),this.loadAvailableDocuments(),e.value=""},error:a=>{this.isUploadingDoc=!1,this.docUploadError=a?.error?.error??a?.message??"Upload failed",e.value=""}}))}addIntegrationRow(){this.integrationRows.push({integration:"",tools:""})}removeIntegrationRow(t){this.integrationRows.splice(t,1)}trackByIndex(t){return t}validateForm(){if(!this.name.trim())return this.errorMessage="Name is required",!1;if(!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(this.name.trim()))return this.errorMessage="Name must start with alphanumeric and contain only letters, digits, hyphens or underscores",!1;if(!this.description.trim())return this.errorMessage="Description is required",!1;for(let t of this.integrationRows)if(!t.integration.trim())return this.errorMessage="Integration name cannot be empty",!1;return!0}buildDefinition(){let t=this.mandatoryDocs.map(n=>n.trim()).filter(Boolean),e=this.integrationRows.length>0?Object.fromEntries(this.integrationRows.filter(n=>n.integration.trim()).map(n=>[n.integration.trim(),n.tools.split(",").map(a=>a.trim()).filter(Boolean)])):void 0;return{name:this.name.trim(),description:this.description.trim(),instructions:this.instructions.trim()||void 0,aiProvider:this.aiProvider.trim()||void 0,modelName:this.modelName.trim()||void 0,temperature:this.temperature??void 0,maxOutputTokens:this.maxOutputTokens??void 0,openaiAssistantId:this.openaiAssistantId.trim()||void 0,integrations:e,mandatoryDocs:t.length>0?t:void 0}}save(){if(this.errorMessage="",!this.validateForm())return;let t=this.buildDefinition();this.isSaving=!0,(this.isEditMode?this.agentCrudApi.updateAgent(this.name.trim(),t):this.agentCrudApi.createAgent(t,this.location)).subscribe({next:()=>{this.isSaving=!1,this.agentApi.clearAllCache(),this.dialogRef.close(!0)},error:n=>{this.isSaving=!1,this.errorMessage=n?.error?.error||n?.message||"Failed to save agent"}})}cancel(){this.dialogRef.close(!1)}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=E({type:s,selectors:[["app-agent-form"]],decls:69,vars:18,consts:[["mat-dialog-title",""],[1,"form-container"],["appearance","outline",1,"full-width"],["matInput","","placeholder","my-agent","required","",3,"ngModelChange","ngModel","readonly"],["matInput","","placeholder","What does this agent do?","rows","2","required","",3,"ngModelChange","ngModel"],["matInput","","placeholder","System instructions for the agent...","rows","6",3,"ngModelChange","ngModel"],[1,"section-title"],[1,"row-2col"],["appearance","outline"],["matInput","","placeholder","e.g. anthropic, openai",3,"ngModelChange","ngModel"],["matInput","","placeholder","e.g. claude-sonnet-4-5",3,"ngModelChange","ngModel"],["matInput","","type","number","min","0","max","2","step","0.1","placeholder","0.0 \u2013 2.0",3,"ngModelChange","ngModel"],["matInput","","type","number","min","1","placeholder","e.g. 4096",3,"ngModelChange","ngModel"],["matInput","","placeholder","asst_...",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Add integration",3,"click"],[1,"hint"],[1,"integration-row"],[1,"source-display"],[1,"error-message"],["align","end"],["mat-button","",3,"click","disabled"],["mat-raised-button","","color","primary",3,"click","disabled"],["appearance","outline",1,"integration-name"],["matInput","","placeholder","e.g. GITHUB",3,"ngModelChange","ngModel"],["appearance","outline",1,"integration-tools"],["matInput","","placeholder","Leave empty for all tools",3,"ngModelChange","ngModel"],["mat-icon-button","","type","button","title","Remove",3,"click"],["mat-icon-button","","type","button","title","Add document path",3,"click"],["title","Upload a document to the pool",1,"upload-btn"],["type","file","hidden","",3,"change","disabled"],[1,"doc-upload-error"],[1,"doc-row"],["appearance","outline",1,"doc-field"],["matInput","","placeholder","documents/guide.md",3,"ngModelChange","ngModel"],[3,"id"],[3,"value"],[1,"source-options"],[1,"source-option"],["type","radio","name","location","value","project",3,"ngModelChange","ngModel"],[1,"source-content"],[1,"source-header"],[1,"source-icon"],[1,"source-label"],[1,"source-description"],["type","radio","name","location","value","colocated",3,"ngModelChange","ngModel"],[1,"source-badge"]],template:function(e,n){e&1&&(i(0,"h2",0),l(1),o(),i(2,"mat-dialog-content")(3,"div",1)(4,"mat-form-field",2)(5,"mat-label"),l(6,"Name"),o(),i(7,"input",3),f("ngModelChange",function(r){return _(n.name,r)||(n.name=r),r}),o(),i(8,"mat-hint"),l(9,"Alphanumeric, hyphens and underscores only. Cannot be changed after creation."),o()(),i(10,"mat-form-field",2)(11,"mat-label"),l(12,"Description"),o(),i(13,"textarea",4),f("ngModelChange",function(r){return _(n.description,r)||(n.description=r),r}),o()(),i(14,"mat-form-field",2)(15,"mat-label"),l(16,"Instructions"),o(),i(17,"textarea",5),f("ngModelChange",function(r){return _(n.instructions,r)||(n.instructions=r),r}),o(),i(18,"mat-hint"),l(19,"System prompt / instructions sent to the AI model"),o()(),i(20,"div",6),l(21,"AI Configuration"),o(),i(22,"div",7)(23,"mat-form-field",8)(24,"mat-label"),l(25,"AI Provider"),o(),i(26,"input",9),f("ngModelChange",function(r){return _(n.aiProvider,r)||(n.aiProvider=r),r}),o()(),i(27,"mat-form-field",8)(28,"mat-label"),l(29,"Model Name"),o(),i(30,"input",10),f("ngModelChange",function(r){return _(n.modelName,r)||(n.modelName=r),r}),o()()(),i(31,"div",7)(32,"mat-form-field",8)(33,"mat-label"),l(34,"Temperature"),o(),i(35,"input",11),f("ngModelChange",function(r){return _(n.temperature,r)||(n.temperature=r),r}),o(),i(36,"mat-hint"),l(37,"Leave empty for model default"),o()(),i(38,"mat-form-field",8)(39,"mat-label"),l(40,"Max Output Tokens"),o(),i(41,"input",12),f("ngModelChange",function(r){return _(n.maxOutputTokens,r)||(n.maxOutputTokens=r),r}),o(),i(42,"mat-hint"),l(43,"Leave empty for model default"),o()()(),i(44,"mat-form-field",2)(45,"mat-label"),l(46,"OpenAI Assistant ID"),o(),i(47,"input",13),f("ngModelChange",function(r){return _(n.openaiAssistantId,r)||(n.openaiAssistantId=r),r}),o(),i(48,"mat-hint"),l(49,"If set, forces aiProvider to openai"),o()(),i(50,"div",6)(51,"span"),l(52,"Integrations"),o(),i(53,"button",14),c("click",function(){return n.addIntegrationRow()}),i(54,"mat-icon"),l(55,"add"),o()()(),M(56,Ne,2,0,"p",15),P(57,Ue,12,2,"div",16,W),M(59,Ze,14,5)(60,Ke,2,0,"p",15),M(61,Je,25,8),M(62,Qe,7,5,"div",17),M(63,Xe,5,1,"div",18),o()(),i(64,"mat-dialog-actions",19)(65,"button",20),c("click",function(){return n.cancel()}),l(66,"Cancel"),o(),i(67,"button",21),c("click",function(){return n.save()}),l(68),o()()),e&2&&(d(),x(n.isEditMode?"Edit Agent":"Create Agent"),d(6),u("ngModel",n.name),C("readonly",n.isEditMode),d(6),u("ngModel",n.description),d(4),u("ngModel",n.instructions),d(9),u("ngModel",n.aiProvider),d(4),u("ngModel",n.modelName),d(5),u("ngModel",n.temperature),d(6),u("ngModel",n.maxOutputTokens),d(6),u("ngModel",n.openaiAssistantId),d(9),y(n.integrationRows.length===0?56:-1),d(),D(n.integrationRows),d(2),y(n.isEditMode?59:60),d(2),y(n.isEditMode?-1:61),d(),y(n.isEditMode?62:-1),d(),y(n.errorMessage?63:-1),d(2),C("disabled",n.isSaving),d(2),C("disabled",n.isSaving),d(),B(" ",n.isSaving?"Saving...":"Save"," "))},dependencies:[Pe,ve,Ae,Ce,be,xe,Me,Ee,Se,we,ye,ae,ne,oe,ie,I,re,O,Oe,De,fe,ue,_e,he,T,F,Ie,le],styles:[".form-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;padding:0;min-width:560px}@media(max-width:768px){.form-container[_ngcontent-%COMP%]{min-width:auto}}.full-width[_ngcontent-%COMP%]{width:100%}.section-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;font-size:1rem;font-weight:600;margin-top:.5rem;margin-bottom:-.25rem}.row-2col[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}@media(max-width:768px){.row-2col[_ngcontent-%COMP%]{grid-template-columns:1fr}}.integration-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.integration-row[_ngcontent-%COMP%] .integration-name[_ngcontent-%COMP%]{flex:0 0 180px}.integration-row[_ngcontent-%COMP%] .integration-tools[_ngcontent-%COMP%]{flex:1}.hint[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-style:italic}.source-options[_ngcontent-%COMP%]{display:flex;gap:1rem;margin-bottom:.5rem}@media(max-width:768px){.source-options[_ngcontent-%COMP%]{flex-direction:column}}.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-option[_ngcontent-%COMP%]:hover{border-color:var(--color-primary);background:var(--color-bg-hover)}.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-option[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{margin-top:2px;cursor:pointer}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%]{flex:1}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:.5rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-icon[_ngcontent-%COMP%]{font-size:1.25rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-header[_ngcontent-%COMP%] .source-label[_ngcontent-%COMP%]{font-weight:600;font-size:.95rem}.source-option[_ngcontent-%COMP%] .source-content[_ngcontent-%COMP%] .source-description[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-text-secondary);font-family:monospace;line-height:1.4}.source-display[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.source-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem 1rem;border-radius:6px;font-size:.9rem;font-weight:500}.source-badge.badge-project[_ngcontent-%COMP%]{background:#2196f31a;color:#2196f3;border:1px solid rgba(33,150,243,.3)}.source-badge.badge-colocated[_ngcontent-%COMP%]{background:#4caf501a;color:#4caf50;border:1px solid rgba(76,175,80,.3)}.doc-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem}.doc-row[_ngcontent-%COMP%] .doc-field[_ngcontent-%COMP%]{flex:1}.upload-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;cursor:pointer;color:var(--color-text-secondary);transition:background .2s}.upload-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover);color:var(--color-primary)}.upload-btn.uploading[_ngcontent-%COMP%]{opacity:.5;cursor:wait}.upload-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem}.doc-upload-error[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--color-error)}.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}"]})};var Ye=()=>[],$e=s=>({id:s});function et(s,t){if(s&1&&(i(0,"div",5),l(1),o()),s&2){let e=m();d(),x(e.errorMessage())}}function tt(s,t){if(s&1){let e=b();i(0,"ds-entity-card",7),c("selected",function(a){g(e);let r=m();return p(r.onEdit(a))}),q(1,8),i(2,"button",9),c("click",function(a){return a.stopPropagation()}),i(3,"mat-icon"),l(4,"more_vert"),o()(),H(),o()}if(s&2){let e=t.$implicit;m();let n=L(9);C("id",e.id)("name",e.name)("description",e.description)("badges",e.badges??Z(6,Ye)),d(2),C("matMenuTriggerFor",n)("matMenuTriggerData",K(7,$e,e.id))}}function nt(s,t){if(s&1){let e=b();i(0,"button",10),c("click",function(){let a=g(e).id,r=m();return p(r.onEdit(a))}),i(1,"mat-icon"),l(2,"edit"),o(),l(3," Edit "),o(),i(4,"button",11),c("click",function(){let a=g(e).id,r=m();return p(r.onDelete(a))}),i(5,"mat-icon"),l(6,"delete"),o(),l(7," Delete "),o()}}var Be=class s{agentCrudApi=h(v);location=h(X);dialog=h(te);agents=S([]);isLoading=S(!1);errorMessage=S(null);agentItems=Q(()=>this.agents().map(t=>({id:t.name,name:t.name,description:t.description,badges:this.buildBadges(t),groupKey:t.source,groupLabel:t.source==="project"?"Project (~/.coday/)":"Colocated (next to coday.yaml)"})));ngOnInit(){this.loadAgents()}loadAgents(){this.isLoading.set(!0),this.errorMessage.set(null),this.agentCrudApi.listEditableAgents().subscribe({next:t=>{this.agents.set(t),this.isLoading.set(!1)},error:t=>{this.errorMessage.set(t?.error?.error??"Failed to load agents"),this.isLoading.set(!1)}})}onBack(){this.location.back()}onCreate(){this.dialog.open(w,{width:"700px",maxHeight:"90vh",data:{mode:"create"}}).afterClosed().subscribe(e=>{e&&this.loadAgents()})}onEdit(t){this.agentCrudApi.getAgent(t).subscribe({next:e=>{this.dialog.open(w,{width:"700px",maxHeight:"90vh",data:{mode:"edit",agent:e}}).afterClosed().subscribe(a=>{a&&this.loadAgents()})},error:e=>this.errorMessage.set(e?.error?.error??"Failed to load agent")})}onDelete(t){confirm(`Are you sure you want to delete agent "${t}"?`)&&this.agentCrudApi.deleteAgent(t).subscribe({next:()=>this.loadAgents(),error:e=>this.errorMessage.set(e?.error?.error??"Failed to delete agent")})}buildBadges(t){return[t.source==="project"?{label:"project",variant:"info"}:{label:"colocated",variant:"success"}]}static \u0275fac=function(e){return new(e||s)};static \u0275cmp=E({type:s,selectors:[["app-agent-list"]],decls:11,vars:4,consts:[["agentCard",""],["cardMenu","matMenu"],[1,"agent-list-page"],["title","Agents","cardMinWidth","260px","contentMaxWidth","1400px","searchPlaceholder","Filter agents\u2026","emptyMessage","No file-based agents found.",3,"createRequested","items","showCreate","itemTemplate"],["toolbar-start","","mat-icon-button","","title","Back",3,"click"],[1,"agent-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","",1,"agent-list__delete-item",3,"click"]],template:function(e,n){if(e&1&&(i(0,"div",2)(1,"ds-entity-list",3),c("createRequested",function(){return n.onCreate()}),i(2,"button",4),c("click",function(){return n.onBack()}),i(3,"mat-icon"),l(4,"chevron_left"),o()()(),M(5,et,2,1,"div",5),o(),k(6,tt,5,9,"ng-template",null,0,J),i(8,"mat-menu",null,1),k(10,nt,8,0,"ng-template",6),o()),e&2){let a=L(7);d(),C("items",n.agentItems())("showCreate",!0)("itemTemplate",a),d(4),y(n.errorMessage()?5:-1)}},dependencies:[We,ke,Te,I,O,T,F,pe,ce,de,me,ge],styles:["[_nghost-%COMP%]{display:block;width:100%;min-height:100vh;background:var(--color-bg);overflow-y:auto}.agent-list__delete-item[_ngcontent-%COMP%]{color:var(--color-error, #ff3b30)}.agent-list__delete-item[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{color:inherit}.agent-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{Be as AgentListComponent};
@@ -1 +1 @@
1
- import{a as E}from"./chunk-NGMAQNX3.js";import{c as S,d as _,f as u,g as C}from"./chunk-QVW2GZXC.js";import{a as q,b as U,c as Y,d as Q}from"./chunk-R2NWLPS6.js";import"./chunk-EAVXJ7QN.js";import{f as I}from"./chunk-UEGZX4MW.js";import"./chunk-TSYL5EEO.js";import"./chunk-DZ2M3NQD.js";import{a as L,d as b}from"./chunk-CRXIMHRG.js";import"./chunk-YJOXSEUO.js";import"./chunk-GIIRKWUO.js";import{a as $,c as H}from"./chunk-6XX7GME4.js";import"./chunk-2PWIGCN2.js";import"./chunk-SKBEA6VH.js";import"./chunk-J4UAEXFM.js";import"./chunk-GTCP3EYX.js";import"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-BTOJ27OO.js";import"./chunk-SPV5SLNS.js";import"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import"./chunk-7OGOI6WM.js";import"./chunk-TASSC2XX.js";import"./chunk-G5RWG2GK.js";import{B as x,Bb as M,Db as y,Fb as s,Jb as W,Ka as m,Kb as O,Lb as P,N as A,T as p,Tb as G,Ub as z,Wa as v,Z as F,ca as a,d as k,ga as c,h as f,ha as d,lb as V,mb as j,rb as w,sb as h,tb as g,ub as R,vb as D,wb as B}from"./chunk-CHEXA6RY.js";var T=class o{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation()}ngOnDestroy(){this.stopWelcomeRotation()}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex]},3e3)}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0)}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=v({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(D(0,"h1",0),G(1),B()),t&2&&(m(),z(i.currentWelcomeMessage))},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"]})};var N=class o{destroy$=new f;isSetup=!1;codayService=a(I);preferencesService=a(b);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(p(this.destroy$),A(),x(([e,t])=>e===!0&&t===!1)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled()}),this.preferencesService.browserNotificationEnabled$.pipe(p(this.destroy$),A(),x(([e,t])=>e===!1&&t===!0)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled()}),this.isSetup=!0}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification())}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played")}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e)}}handleBrowserNotificationEnabled(){return k(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1))}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(!1)}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification")}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:!1});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close()},console.log("[AGENT-NOTIFICATION] Confirmation notification sent")}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:!1});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close()},console.log("[AGENT-NOTIFICATION] Task complete notification sent")}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete()}static \u0275fac=function(t){return new(t||o)};static \u0275prov=F({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=M();h(0,"app-thread",4),y("chatFocused",function(){c(t);let n=s();return d(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){c(t);let r=s();return d(r.onDrawerStateChange(n))}),g()}if(o&2){let t=s();w("projectName",t.projectName)("threadId",t.threadId)}}function te(o,e){if(o&1){let t=M();h(0,"div",5),R(1,"app-welcome-message"),g(),h(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),y("messageSubmitted",function(n){c(t);let r=s();return d(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){c(t);let r=s();return d(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){c(t);let r=s();return d(r.onVoiceToggled(n))})("heightChanged",function(n){c(t);let r=s();return d(r.onInputHeightChanged(n))})("textareaFocused",function(){c(t);let n=s();return d(n.onChatFocusedOnMobile())}),g()()()()}if(o&2){let t=s();m(6),w("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",!0)("isThinking",!1)("isStarting",t.isStartingFirstMessage)}}var K=class o{destroy$=new f;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=!1;isStartingFirstMessage=!1;inputSectionHeight=80;codayService=a(I);titleService=a(U);preferencesService=a(b);route=a($);router=a(H);threadApiService=a(L);agentNotificationService=a(N);firstMessageState=a(Y);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)")}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(p(this.destroy$)).subscribe(e=>{let t=e.projectName,i=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:i,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=i,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView())})}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService)}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint)}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=!0,this.isStartingFirstMessage=!0,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id])},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=!1,this.isStartingFirstMessage=!1,alert("Failed to create conversation: "+(t.message||"Unknown error"))}})}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e)}onVoiceMessageReady(e){console.log("[MAIN-APP] Voice message ready from welcome view"),this.isSessionInitializing=!0,this.isStartingFirstMessage=!0,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created for voice message:",t.thread.id),this.firstMessageState.setPendingVoiceMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id])},error:t=>{console.error("[MAIN-APP] Failed to create thread for voice message:",t),this.isSessionInitializing=!1,this.isStartingFirstMessage=!1,alert("Failed to create conversation: "+(t.message||"Unknown error"))}})}isDrawerOpen=!1;onDrawerStateChange(e){this.isDrawerOpen=e}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close()}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e)}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint)}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical")};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical")};static \u0275fac=function(t){return new(t||o)};static \u0275cmp=v({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&W(Z,5)(E,5),t&2){let n;O(n=P())&&(i.inputSection=n.first),O(n=P())&&(i.sidenav=n.first)}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(h(0,"app-sidenav",1)(1,"div",2),y("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),V(2,ee,1,2,"app-thread",3)(3,te,7,5),g()()),t&2&&(w("drawerOpen",i.isDrawerOpen),m(2),j(i.threadId?2:3))},dependencies:[q,Q,T,E],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[S("slideIn",[C(":enter",[u({transform:"translateY(100%)",opacity:0}),_("300ms ease-out",u({transform:"translateY(0)",opacity:1}))]),C(":leave",[_("200ms ease-in",u({transform:"translateY(100%)",opacity:0}))])])]}})};export{K as MainAppComponent};
1
+ import{a as E}from"./chunk-NGMAQNX3.js";import{c as S,d as _,f as u,g as C}from"./chunk-QVW2GZXC.js";import{a as q,b as U,c as Y,d as Q}from"./chunk-VVFVGWIQ.js";import"./chunk-SFQE4GQ6.js";import{f as I}from"./chunk-UEGZX4MW.js";import"./chunk-TSYL5EEO.js";import"./chunk-DZ2M3NQD.js";import{a as L,d as b}from"./chunk-CRXIMHRG.js";import"./chunk-YJOXSEUO.js";import"./chunk-GIIRKWUO.js";import{a as $,c as H}from"./chunk-6XX7GME4.js";import"./chunk-2PWIGCN2.js";import"./chunk-SKBEA6VH.js";import"./chunk-J4UAEXFM.js";import"./chunk-GTCP3EYX.js";import"./chunk-VNO76B3S.js";import"./chunk-E6T6QLQT.js";import"./chunk-BTOJ27OO.js";import"./chunk-SPV5SLNS.js";import"./chunk-VMYKE4ZC.js";import"./chunk-AS2L77JV.js";import"./chunk-7OGOI6WM.js";import"./chunk-TASSC2XX.js";import"./chunk-G5RWG2GK.js";import{B as x,Bb as M,Db as y,Fb as s,Jb as W,Ka as m,Kb as O,Lb as P,N as A,T as p,Tb as G,Ub as z,Wa as v,Z as F,ca as a,d as k,ga as c,h as f,ha as d,lb as V,mb as j,rb as w,sb as h,tb as g,ub as R,vb as D,wb as B}from"./chunk-CHEXA6RY.js";var T=class o{welcomeMessages=["Welcome to Coday","Bienvenue sur Coday","Bienvenido a Coday","Willkommen bei Coday","Benvenuto su Coday","Bem-vindo ao Coday","Welkom bij Coday","\u0414\u043E\u0431\u0440\u043E \u043F\u043E\u0436\u0430\u043B\u043E\u0432\u0430\u0442\u044C \u0432 Coday","Coday \u3078\u3088\u3046\u3053\u305D","\u6B22\u8FCE\u6765\u5230 Coday","Coday \uC5D0 \uC624\uC2E0 \uAC83\uC744 \uD658\uC601\uD569\uB2C8\uB2E4","\u0645\u0631\u062D\u0628\u064B\u0627 \u0628\u0643 \u0641\u064A Coday"];currentWelcomeIndex=0;currentWelcomeMessage=this.welcomeMessages[0];welcomeRotationInterval;ngOnInit(){this.startWelcomeRotation()}ngOnDestroy(){this.stopWelcomeRotation()}startWelcomeRotation(){this.welcomeRotationInterval=window.setInterval(()=>{this.currentWelcomeIndex=(this.currentWelcomeIndex+1)%this.welcomeMessages.length,this.currentWelcomeMessage=this.welcomeMessages[this.currentWelcomeIndex]},3e3)}stopWelcomeRotation(){this.welcomeRotationInterval&&(clearInterval(this.welcomeRotationInterval),this.welcomeRotationInterval=void 0)}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=v({type:o,selectors:[["app-welcome-message"]],decls:2,vars:1,consts:[[1,"welcome-title"]],template:function(t,i){t&1&&(D(0,"h1",0),G(1),B()),t&2&&(m(),z(i.currentWelcomeMessage))},styles:[".welcome-title[_ngcontent-%COMP%]{font-size:clamp(1.5rem,4vw,4rem);font-weight:700;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% auto;background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;animation:_ngcontent-%COMP%_gradientShift 3s ease-in-out infinite;margin:0;padding:0;line-height:1.2;transition:opacity .5s ease-in-out;display:block;min-height:1.2em;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@keyframes _ngcontent-%COMP%_gradientShift{0%{background-position:0% center}50%{background-position:100% center}to{background-position:0% center}}"]})};var N=class o{destroy$=new f;isSetup=!1;codayService=a(I);preferencesService=a(b);setup(){if(this.isSetup){console.warn("[AGENT-NOTIFICATION] Service already set up");return}console.log("[AGENT-NOTIFICATION] Setting up agent notification service"),this.codayService.isThinking$.pipe(p(this.destroy$),A(),x(([e,t])=>e===!0&&t===!1)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Agent stopped thinking, notifying task finished"),this.notifyTaskFinishedIfEnabled()}),this.preferencesService.browserNotificationEnabled$.pipe(p(this.destroy$),A(),x(([e,t])=>e===!1&&t===!0)).subscribe(()=>{console.log("[AGENT-NOTIFICATION] Browser notifications enabled, checking permission"),this.handleBrowserNotificationEnabled()}),this.isSetup=!0}notifyTaskFinishedIfEnabled(){this.preferencesService.getAgentNotificationEnabled()&&(this.preferencesService.getNotificationSoundEnabled()&&this.playCompletionSound(),this.preferencesService.getBrowserNotificationEnabled()&&this.sendBrowserNotification())}playCompletionSound(){try{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),i=e.createGain();t.connect(i),i.connect(e.destination),t.frequency.setValueAtTime(700,e.currentTime),i.gain.setValueAtTime(.1,e.currentTime),i.gain.exponentialRampToValueAtTime(.01,e.currentTime+.08),t.start(e.currentTime),t.stop(e.currentTime+.08);let n=e.createOscillator(),r=e.createGain();n.connect(r),r.connect(e.destination);let l=e.currentTime+.11;n.frequency.setValueAtTime(950,l),r.gain.setValueAtTime(.1,l),r.gain.exponentialRampToValueAtTime(.01,l+.09),n.start(l),n.stop(l+.09),console.log("[AGENT-NOTIFICATION] Completion sound played")}catch(e){console.error("[AGENT-NOTIFICATION] Failed to play completion sound:",e)}}handleBrowserNotificationEnabled(){return k(this,null,function*(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);return}if(Notification.permission==="denied"){console.warn("[AGENT-NOTIFICATION] Permission denied, disabling browser notifications"),this.preferencesService.setBrowserNotificationEnabled(!1);return}if(Notification.permission==="granted"){console.log("[AGENT-NOTIFICATION] Permission already granted, showing confirmation"),this.createConfirmationNotification();return}try{(yield Notification.requestPermission())==="granted"?(console.log("[AGENT-NOTIFICATION] Permission granted, showing confirmation"),this.createConfirmationNotification()):(console.log("[AGENT-NOTIFICATION] Permission denied or dismissed"),this.preferencesService.setBrowserNotificationEnabled(!1))}catch(e){console.error("[AGENT-NOTIFICATION] Error requesting permission:",e),this.preferencesService.setBrowserNotificationEnabled(!1)}})}sendBrowserNotification(){if(!("Notification"in window)){console.warn("[AGENT-NOTIFICATION] Browser does not support notifications");return}if(document.hasFocus()){console.warn("[AGENT-NOTIFICATION] Document is focused, skipping browser notification");return}Notification.permission==="granted"?this.createTaskCompleteNotification():console.warn("[AGENT-NOTIFICATION] Permission not granted, cannot send notification")}createConfirmationNotification(){let e=new Notification("Coday - Notifications Enabled",{body:"You will be notified when the agent completes tasks",icon:"/favicon.ico",tag:"coday-notifications-enabled",requireInteraction:!1});setTimeout(()=>e.close(),4e3),e.onclick=()=>{window.focus(),e.close()},console.log("[AGENT-NOTIFICATION] Confirmation notification sent")}createTaskCompleteNotification(){let e=new Notification("Coday - Task Complete",{body:"The agent has finished and is waiting for your input",icon:"/favicon.ico",tag:"coday-task-complete",requireInteraction:!1});setTimeout(()=>e.close(),5e3),e.onclick=()=>{window.focus(),e.close()},console.log("[AGENT-NOTIFICATION] Task complete notification sent")}ngOnDestroy(){console.log("[AGENT-NOTIFICATION] Service destroyed"),this.destroy$.next(),this.destroy$.complete()}static \u0275fac=function(t){return new(t||o)};static \u0275prov=F({token:o,factory:o.\u0275fac,providedIn:"root"})};var Z=["inputSection"];function ee(o,e){if(o&1){let t=M();h(0,"app-thread",4),y("chatFocused",function(){c(t);let n=s();return d(n.onChatFocusedOnMobile())})("drawerStateChange",function(n){c(t);let r=s();return d(r.onDrawerStateChange(n))}),g()}if(o&2){let t=s();w("projectName",t.projectName)("threadId",t.threadId)}}function te(o,e){if(o&1){let t=M();h(0,"div",5),R(1,"app-welcome-message"),g(),h(2,"div",6,0)(4,"div",7)(5,"div",8)(6,"app-chat-textarea",9),y("messageSubmitted",function(n){c(t);let r=s();return d(r.onMessageSubmitted(n))})("voiceMessageReady",function(n){c(t);let r=s();return d(r.onVoiceMessageReady(n))})("voiceRecordingToggled",function(n){c(t);let r=s();return d(r.onVoiceToggled(n))})("heightChanged",function(n){c(t);let r=s();return d(r.onInputHeightChanged(n))})("textareaFocused",function(){c(t);let n=s();return d(n.onChatFocusedOnMobile())}),g()()()()}if(o&2){let t=s();m(6),w("isDisabled",t.isSessionInitializing)("isSessionInitializing",t.isSessionInitializing)("showWelcome",!0)("isThinking",!1)("isStarting",t.isStartingFirstMessage)}}var K=class o{destroy$=new f;inputSection;sidenav;projectName="";threadId=null;isSessionInitializing=!1;isStartingFirstMessage=!1;inputSectionHeight=80;codayService=a(I);titleService=a(U);preferencesService=a(b);route=a($);router=a(H);threadApiService=a(L);agentNotificationService=a(N);firstMessageState=a(Y);constructor(){console.log("[MAIN-APP] Using new thread-based architecture (no clientId needed)")}ngOnInit(){this.agentNotificationService.setup(),this.setupPrintHandlers(),this.route.params.pipe(p(this.destroy$)).subscribe(e=>{let t=e.projectName,i=e.threadId||null;console.log("[MAIN-APP] Route params updated:",{project:t,thread:i,previousProject:this.projectName,previousThread:this.threadId}),this.projectName=t,this.threadId=i,this.threadId?console.log("[MAIN-APP] Thread selected - ThreadComponent will display"):(console.log("[MAIN-APP] No thread selected - showing welcome view"),this.initializeWelcomeView())})}initializeWelcomeView(){this.codayService.setTabTitleService(this.titleService)}ngAfterViewInit(){setTimeout(()=>this.updateInputSectionHeight(),100)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete(),window.removeEventListener("beforeprint",this.handleBeforePrint),window.removeEventListener("afterprint",this.handleAfterPrint)}onMessageSubmitted(e){console.log("[MAIN-APP] First message submitted from welcome view:",e),this.isSessionInitializing=!0,this.isStartingFirstMessage=!0,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created:",t.thread.id),this.firstMessageState.setPendingFirstMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id])},error:t=>{console.error("[MAIN-APP] Failed to create thread:",t),this.isSessionInitializing=!1,this.isStartingFirstMessage=!1,alert("Failed to create conversation: "+(t.message||"Unknown error"))}})}onVoiceToggled(e){console.log("[VOICE] Recording in welcome view:",e)}onVoiceMessageReady(e){console.log("[MAIN-APP] Voice message ready from welcome view"),this.isSessionInitializing=!0,this.isStartingFirstMessage=!0,this.threadApiService.createThread().subscribe({next:t=>{console.log("[MAIN-APP] Thread created for voice message:",t.thread.id),this.firstMessageState.setPendingVoiceMessage(e),this.router.navigate(["project",this.projectName,"thread",t.thread.id])},error:t=>{console.error("[MAIN-APP] Failed to create thread for voice message:",t),this.isSessionInitializing=!1,this.isStartingFirstMessage=!1,alert("Failed to create conversation: "+(t.message||"Unknown error"))}})}isDrawerOpen=!1;onDrawerStateChange(e){this.isDrawerOpen=e}onChatFocusedOnMobile(){window.innerWidth<1024&&this.sidenav?.close()}onInputHeightChanged(e){console.log("[MAIN-APP] Input height changed:",e),this.inputSectionHeight=e}updateInputSectionHeight(){if(this.inputSection?.nativeElement){let e=this.inputSection.nativeElement.offsetHeight;e!==this.inputSectionHeight&&(console.log("[MAIN-APP] Input section height updated:",e),this.inputSectionHeight=e)}}setupPrintHandlers(){window.addEventListener("beforeprint",this.handleBeforePrint),window.addEventListener("afterprint",this.handleAfterPrint)}handleBeforePrint=()=>{console.log("[PRINT] Before print event triggered");let e=this.preferencesService.getPrintTechnicalMessages();console.log("[PRINT] Print technical messages:",e),e?document.body.classList.add("print-include-technical"):document.body.classList.remove("print-include-technical")};handleAfterPrint=()=>{console.log("[PRINT] After print event triggered"),document.body.classList.remove("print-include-technical")};static \u0275fac=function(t){return new(t||o)};static \u0275cmp=v({type:o,selectors:[["app-main"]],viewQuery:function(t,i){if(t&1&&W(Z,5)(E,5),t&2){let n;O(n=P())&&(i.inputSection=n.first),O(n=P())&&(i.sidenav=n.first)}},decls:4,vars:2,consts:[["inputSection",""],[3,"drawerOpen"],[1,"app",3,"mousedown","touchstart"],[3,"projectName","threadId"],[3,"chatFocused","drawerStateChange","projectName","threadId"],[1,"welcome-section"],[1,"input-section"],[1,"input-center"],[1,"input-glass"],[3,"messageSubmitted","voiceMessageReady","voiceRecordingToggled","heightChanged","textareaFocused","isDisabled","isSessionInitializing","showWelcome","isThinking","isStarting"]],template:function(t,i){t&1&&(h(0,"app-sidenav",1)(1,"div",2),y("mousedown",function(){return i.onChatFocusedOnMobile()})("touchstart",function(){return i.onChatFocusedOnMobile()}),V(2,ee,1,2,"app-thread",3)(3,te,7,5),g()()),t&2&&(w("drawerOpen",i.isDrawerOpen),m(2),j(i.threadId?2:3))},dependencies:[q,Q,T,E],styles:["[_nghost-%COMP%]{display:flex;height:100vh;width:100%;overflow:hidden;justify-content:center}.app[_ngcontent-%COMP%]{width:100%;max-width:100%;min-width:0;height:100%;display:flex;flex-direction:column;background:var(--color-bg);color:var(--color-text);transition:all .3s ease;position:relative;justify-content:center;overflow:hidden}.chat-wrapper[_ngcontent-%COMP%]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;background:transparent;width:100%;padding:2.5rem 0 1.5rem;display:flex;justify-content:center}.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem}@media(max-width:768px){.chat-wrapper[_ngcontent-%COMP%] .chat-center[_ngcontent-%COMP%]{padding:0 1rem}}.welcome-section[_ngcontent-%COMP%]{flex-shrink:0;text-align:center;padding:2rem 1rem;animation:_ngcontent-%COMP%_fadeInUp .8s ease-out;display:flex;justify-content:center;align-items:center;width:100%;min-width:0;overflow:hidden}@keyframes _ngcontent-%COMP%_fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.input-section[_ngcontent-%COMP%]{flex-shrink:0;position:relative;border-top:none;background:transparent;box-shadow:none;padding:2.5rem 0 2rem;overflow-y:visible;max-height:none;width:100%;z-index:10;pointer-events:none;display:flex;justify-content:center}.input-center[_ngcontent-%COMP%]{max-width:760px;width:100%;margin:0;padding:0 2rem;display:flex;justify-content:center;align-items:end;position:relative;pointer-events:auto}@media(max-width:768px){.input-center[_ngcontent-%COMP%]{padding:0 1rem}}.input-glass[_ngcontent-%COMP%]{background:none;box-shadow:none;width:100%;min-height:64px;display:flex;align-items:stretch;gap:0;pointer-events:auto;position:relative;overflow:visible}.input-glass[_ngcontent-%COMP%] app-chat-textarea[_ngcontent-%COMP%]{width:100%;min-width:0;flex:1 1 auto;align-self:stretch;display:flex}body.dark[_nghost-%COMP%], body.dark [_nghost-%COMP%], [_ngcontent-%COMP%]:root[data-theme=dark] .input-glass[_ngcontent-%COMP%]{background:#24283073;border-color:#b4c8ff17;box-shadow:0 8px 32px #0000002b,0 1.5px 8px #00000012}.choice-overlay[_ngcontent-%COMP%]{z-index:10;width:100%;display:flex;justify-content:center;align-items:center}.upload-status[_ngcontent-%COMP%]{position:fixed;bottom:100px;left:50%;transform:translate(-50%);z-index:1000;display:flex;align-items:center;padding:12px 20px;background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);border-radius:16px;font-size:.9em;color:var(--color-text);box-shadow:var(--glass-shadow);max-width:300px;text-align:center}.upload-status.error[_ngcontent-%COMP%]{background:#ff3b3026;color:var(--color-error);border-color:#ff3b304d}@media(max-width:768px){.welcome-section[_ngcontent-%COMP%]{padding:1.5rem 1rem}.input-section[_ngcontent-%COMP%]{padding:1.5rem .75rem 1rem}.input-center[_ngcontent-%COMP%]{padding:0 .5rem}}@media print{[_nghost-%COMP%]{display:block!important;height:auto!important;overflow:visible!important}.app[_ngcontent-%COMP%]{height:auto!important;overflow:visible!important;display:block!important}.input-section[_ngcontent-%COMP%], .welcome-section[_ngcontent-%COMP%]{display:none!important}}"],data:{animation:[S("slideIn",[C(":enter",[u({transform:"translateY(100%)",opacity:0}),_("300ms ease-out",u({transform:"translateY(0)",opacity:1}))]),C(":leave",[_("200ms ease-in",u({transform:"translateY(100%)",opacity:0}))])])]}})};export{K as MainAppComponent};
@@ -1,3 +1,3 @@
1
- import{a as pt,b as vt,c as ye}from"./chunk-I2ONTIJI.js";import{a as _t}from"./chunk-NMKUE2VW.js";import{d as bt}from"./chunk-R2NWLPS6.js";import{a as he}from"./chunk-EAVXJ7QN.js";import{a as I,b as V,d as ft,g as xt}from"./chunk-UEGZX4MW.js";import"./chunk-TSYL5EEO.js";import"./chunk-DZ2M3NQD.js";import{a as ze,b as We,c as Qe,d as Ue,g as at,n as lt,q as st,s as ct,y as dt}from"./chunk-CRXIMHRG.js";import"./chunk-YJOXSEUO.js";import"./chunk-GIIRKWUO.js";import{c as Re,d as $e}from"./chunk-6XX7GME4.js";import"./chunk-2PWIGCN2.js";import{a as pe,b as me,c as ue,d as _e}from"./chunk-B4UTEYRE.js";import{a as ge,b as ee}from"./chunk-EZSEUOCV.js";import{a as mt,b as ut}from"./chunk-DFU2RM36.js";import"./chunk-SKBEA6VH.js";import{a as gt,b as ht,c as Ct}from"./chunk-J4UAEXFM.js";import{a as ce,c as et,d as H,g as X,h as J,i as Y,j as Z}from"./chunk-GTCP3EYX.js";import{a as He,c as Xe,d as Je,e as Ke,j as de}from"./chunk-VNO76B3S.js";import{a as le,b as se,c as Ye,d as Ze}from"./chunk-E6T6QLQT.js";import{a as $,b as qe,d as L,e as q,f as B,g as z,h as W}from"./chunk-BTOJ27OO.js";import"./chunk-SPV5SLNS.js";import{a as Be,c as Q}from"./chunk-VMYKE4ZC.js";import{a as N,b as A}from"./chunk-AS2L77JV.js";import{B as rt,E as K,c as tt,g as nt,m as it,o as ot}from"./chunk-7OGOI6WM.js";import{a as U,b as ae}from"./chunk-TASSC2XX.js";import{O as re,Q as O,S as E,n as Le}from"./chunk-G5RWG2GK.js";import{Bb as x,D as Ee,Db as m,Fb as d,Ja as xe,Jb as Ae,Ka as c,Kb as Ie,Lb as Ve,Pb as w,Qb as Fe,Rb as S,Tb as s,Ub as b,Vb as P,Wa as D,Xc as Ge,Z as oe,a as F,b as G,ca as f,ga as g,ha as h,jb as ke,lb as v,m as Pe,ma as Ne,mb as C,mc as k,ob as j,pb as y,qb as M,rb as _,s as De,sb as o,t as je,ta as u,tb as r,ub as T,z as Oe}from"./chunk-CHEXA6RY.js";var Dt=(a,t)=>t.name;function jt(a,t){if(a&1&&(o(0,"mat-option",11),s(1),r()),a&2){let e=t.$implicit;_("value",e),c(),b(e)}}function Ot(a,t){a&1&&T(0,"mat-spinner",13)}function Et(a,t){if(a&1&&(o(0,"span",20),s(1),r()),a&2){let e=d().$implicit;c(),b(e.description)}}function Nt(a,t){if(a&1&&(o(0,"mat-option",11)(1,"span",19),s(2),r(),v(3,Et,2,1,"span",20),r()),a&2){let e=t.$implicit;_("value",e.name),c(2),b(e.name),c(),C(e.description?3:-1)}}function At(a,t){if(a&1&&(o(0,"mat-option",11),s(1),r()),a&2){let e=t.$implicit;_("value",e),c(),b(e)}}function It(a,t){if(a&1){let e=x();o(0,"div",25)(1,"mat-form-field",8)(2,"mat-label"),s(3,"Name"),r(),o(4,"input",26),m("input",function(i){g(e);let l=d(2);return h(l.issueNumber.set(i.target.value))}),r()(),o(5,"mat-form-field",27)(6,"mat-label"),s(7,"Type"),r(),o(8,"mat-select",28),m("selectionChange",function(i){g(e);let l=d(2);return h(l.branchType.set(i.value))}),y(9,At,2,2,"mat-option",11,j),r()()()}if(a&2){let e=d(2);c(4),_("value",e.issueNumber()),c(4),_("value",e.branchType()),c(),M(e.branchTypes)}}function Vt(a,t){a&1&&T(0,"mat-spinner",13)}function Ft(a,t){if(a&1&&(o(0,"mat-option",11),s(1),r()),a&2){let e=t.$implicit;_("value",e),c(),b(e)}}function Gt(a,t){if(a&1){let e=x();o(0,"mat-form-field",8)(1,"mat-label"),s(2,"Source branch"),r(),o(3,"input",29,4),m("input",function(i){g(e);let l=d(2);return h(l.onBranchSearchInput(i.target.value))})("focus",function(){g(e);let i=w(4),l=d(2);return h(l.openPanel(i))}),r(),v(5,Vt,1,0,"mat-spinner",13),o(6,"mat-autocomplete",10,5),m("optionSelected",function(i){g(e);let l=d(2);return h(l.selectBranch(i.option.value))}),y(8,Ft,2,2,"mat-option",11,j),r()()}if(a&2){let e=w(7),n=d(2);c(3),_("value",n.branchSearch())("matAutocomplete",e)("disabled",n.isLoadingBranches()),c(2),C(n.isLoadingBranches()?5:-1),c(3),M(n.filteredBranches())}}function Rt(a,t){if(a&1){let e=x();o(0,"div",21)(1,"button",22),m("click",function(){g(e);let i=d();return h(i.onModeChange("local"))}),o(2,"mat-icon"),s(3,"folder_open"),r(),o(4,"span",23),s(5,"Local"),r(),o(6,"span",24),s(7,"Work directly on the current branch"),r()(),o(8,"button",22),m("click",function(){g(e);let i=d();return h(i.onModeChange("worktree"))}),o(9,"mat-icon"),s(10,"account_tree"),r(),o(11,"span",23),s(12,"Worktree"),r(),o(13,"span",24),s(14,"Create an isolated worktree from a branch"),r()()(),v(15,It,11,2,"div",25),v(16,Gt,10,4,"mat-form-field",8)}if(a&2){let e=d();c(),S("active",e.mode()==="local"),c(7),S("active",e.mode()==="worktree"),c(7),C(e.isWorktree()?15:-1),c(),C(e.isWorktree()?16:-1)}}function $t(a,t){a&1&&T(0,"mat-spinner",18)}function Lt(a,t){a&1&&(o(0,"mat-icon"),s(1,"rocket_launch"),r())}function qt(a,t){a&1&&(o(0,"mat-icon"),s(1,"open_in_new"),r())}var fe=class a{projectApi=f(U);agentApi=f(he);dialogRef=f($);projectState=f(ae);forcedProject=Q(this.projectState.forcedProject$,{initialValue:null});selectedProject=u("");projectSearch=u("");selectedAgent=u("");agentSearch=u("");mode=u("local");selectedBranch=u("");branchSearch=u("");issueNumber=u("");branchType=u("feature");task=u("");hasGit=u(!1);branchTypes=["feature","fix","refactor","chore","docs","build"];projects=u([]);agents=u([]);branches=u([]);filteredProjects=k(()=>{let t=this.projectSearch().toLowerCase();return t?this.projects().filter(e=>e.toLowerCase().includes(t)):this.projects()});filteredAgents=k(()=>{let t=this.agentSearch().toLowerCase();return t?this.agents().filter(e=>e.name.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)):this.agents()});filteredBranches=k(()=>{let t=this.branchSearch().toLowerCase();return t?this.branches().filter(e=>e.toLowerCase().includes(t)):this.branches()});isLoadingAgents=u(!1);isLoadingBranches=u(!1);isSubmitting=u(!1);isWorktree=k(()=>this.mode()==="worktree"&&this.hasGit());isValid=k(()=>{let t=this.projects().includes(this.selectedProject()),e=this.agents().some(i=>i.name===this.selectedAgent()),n=t&&e&&!!this.task().trim();return this.isWorktree()?n&&!!this.selectedBranch()&&!!this.issueNumber().trim()&&!!this.branchType():n});canNavigate=k(()=>this.projects().includes(this.selectedProject()));openPanel(t){t.openPanel()}onProjectSearchInput(t){this.projectSearch.set(t),this.selectedProject()&&t!==this.selectedProject()&&(this.selectedProject.set(""),this.selectedAgent.set(""),this.agentSearch.set(""),this.agents.set([]))}selectProject(t){this.selectedProject.set(t),this.projectSearch.set(t),this.selectedAgent.set(""),this.agentSearch.set(""),this.agents.set([]),this.branches.set([]),this.selectedBranch.set(""),this.branchSearch.set(""),this.hasGit.set(!1),this.mode.set("local"),this.isLoadingAgents.set(!0),this.agentApi.getAgents(t).subscribe({next:e=>{this.agents.set(e),this.isLoadingAgents.set(!1)},error:()=>{this.isLoadingAgents.set(!1)}}),this.projectApi.getGitBranches(t).subscribe({next:({branches:e})=>{this.hasGit.set(e.length>0)},error:()=>{this.hasGit.set(!1)}})}onAgentSearchInput(t){this.agentSearch.set(t),this.selectedAgent()&&t!==this.selectedAgent()&&this.selectedAgent.set("")}selectAgent(t){this.selectedAgent.set(t),this.agentSearch.set(t)}onBranchSearchInput(t){this.branchSearch.set(t),this.selectedBranch()&&t!==this.selectedBranch()&&this.selectedBranch.set("")}selectBranch(t){this.selectedBranch.set(t),this.branchSearch.set(t)}ngOnInit(){this.projectApi.listProjects().subscribe({next:({projects:t})=>{let e=t.map(n=>n.name);this.projects.set(e),e.length===1&&e[0]&&this.selectProject(e[0])}})}onProjectChange(t){this.selectProject(t)}onModeChange(t){this.mode.set(t),t==="worktree"&&this.selectedProject()&&this.branches().length===0&&this.loadBranches()}loadBranches(){this.isLoadingBranches.set(!0),this.projectApi.getGitBranches(this.selectedProject()).subscribe({next:({branches:t})=>{this.branches.set(t),this.isLoadingBranches.set(!1)},error:()=>{this.isLoadingBranches.set(!1)}})}submit(){if(!this.isSubmitting()){if(this.isValid()){this.isSubmitting.set(!0);let t=this.isWorktree()&&this.issueNumber().trim()?`${this.issueNumber().trim()} ${this.task().trim()}`:this.task().trim();this.projectApi.createTask(this.selectedProject(),this.selectedAgent(),t,this.isWorktree()?"worktree":"local",this.isWorktree()?this.selectedBranch():void 0,this.isWorktree()?this.issueNumber().trim():void 0,this.isWorktree()?this.branchType():void 0).subscribe({next:({threadId:e,projectId:n})=>{this.dialogRef.close({threadId:e,projectId:n})},error:()=>{this.isSubmitting.set(!1)}});return}if(this.canNavigate()){this.dialogRef.close({projectId:this.selectedProject(),navigate:!0});return}}}cancel(){this.dialogRef.close(null)}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=D({type:a,selectors:[["app-new-task-dialog"]],decls:37,vars:12,consts:[["projectTrigger","matAutocompleteTrigger"],["projectAuto",""],["agentTrigger","matAutocompleteTrigger"],["agentAuto",""],["branchTrigger","matAutocompleteTrigger"],["branchAuto",""],["mat-dialog-title",""],[1,"ntd-content"],["appearance","outline",1,"ntd-field"],["matInput","","placeholder","Search project...",3,"input","focus","value","matAutocomplete"],[3,"optionSelected"],[3,"value"],["matInput","","placeholder","Search agent...",3,"input","focus","value","matAutocomplete","disabled"],["matSuffix","","diameter","16"],["matInput","","placeholder","Describe what the agent should accomplish...","rows","4",3,"input","value"],["align","end"],["mat-button","",3,"click","disabled"],["mat-flat-button","",1,"ntd-launch-btn",3,"click","disabled"],["diameter","16"],[1,"ntd-agent-name"],[1,"ntd-agent-desc"],[1,"ntd-radio-group"],["type","button",1,"ntd-mode-btn",3,"click"],[1,"ntd-radio-label"],[1,"ntd-radio-hint"],[1,"ntd-row"],["matInput","","type","text","placeholder","Name",3,"input","value"],["appearance","outline",1,"ntd-field","ntd-field--small"],[3,"selectionChange","value"],["matInput","","placeholder","Search branch...",3,"input","focus","value","matAutocomplete","disabled"]],template:function(e,n){if(e&1){let i=x();o(0,"h2",6)(1,"mat-icon"),s(2,"rocket_launch"),r(),s(3,` New Task
1
+ import{a as pt,b as vt,c as ye}from"./chunk-I2ONTIJI.js";import{a as _t}from"./chunk-NMKUE2VW.js";import{d as bt}from"./chunk-VVFVGWIQ.js";import{a as he}from"./chunk-SFQE4GQ6.js";import{a as I,b as V,d as ft,g as xt}from"./chunk-UEGZX4MW.js";import"./chunk-TSYL5EEO.js";import"./chunk-DZ2M3NQD.js";import{a as ze,b as We,c as Qe,d as Ue,g as at,n as lt,q as st,s as ct,y as dt}from"./chunk-CRXIMHRG.js";import"./chunk-YJOXSEUO.js";import"./chunk-GIIRKWUO.js";import{c as Re,d as $e}from"./chunk-6XX7GME4.js";import"./chunk-2PWIGCN2.js";import{a as pe,b as me,c as ue,d as _e}from"./chunk-B4UTEYRE.js";import{a as ge,b as ee}from"./chunk-EZSEUOCV.js";import{a as mt,b as ut}from"./chunk-DFU2RM36.js";import"./chunk-SKBEA6VH.js";import{a as gt,b as ht,c as Ct}from"./chunk-J4UAEXFM.js";import{a as ce,c as et,d as H,g as X,h as J,i as Y,j as Z}from"./chunk-GTCP3EYX.js";import{a as He,c as Xe,d as Je,e as Ke,j as de}from"./chunk-VNO76B3S.js";import{a as le,b as se,c as Ye,d as Ze}from"./chunk-E6T6QLQT.js";import{a as $,b as qe,d as L,e as q,f as B,g as z,h as W}from"./chunk-BTOJ27OO.js";import"./chunk-SPV5SLNS.js";import{a as Be,c as Q}from"./chunk-VMYKE4ZC.js";import{a as N,b as A}from"./chunk-AS2L77JV.js";import{B as rt,E as K,c as tt,g as nt,m as it,o as ot}from"./chunk-7OGOI6WM.js";import{a as U,b as ae}from"./chunk-TASSC2XX.js";import{O as re,Q as O,S as E,n as Le}from"./chunk-G5RWG2GK.js";import{Bb as x,D as Ee,Db as m,Fb as d,Ja as xe,Jb as Ae,Ka as c,Kb as Ie,Lb as Ve,Pb as w,Qb as Fe,Rb as S,Tb as s,Ub as b,Vb as P,Wa as D,Xc as Ge,Z as oe,a as F,b as G,ca as f,ga as g,ha as h,jb as ke,lb as v,m as Pe,ma as Ne,mb as C,mc as k,ob as j,pb as y,qb as M,rb as _,s as De,sb as o,t as je,ta as u,tb as r,ub as T,z as Oe}from"./chunk-CHEXA6RY.js";var Dt=(a,t)=>t.name;function jt(a,t){if(a&1&&(o(0,"mat-option",11),s(1),r()),a&2){let e=t.$implicit;_("value",e),c(),b(e)}}function Ot(a,t){a&1&&T(0,"mat-spinner",13)}function Et(a,t){if(a&1&&(o(0,"span",20),s(1),r()),a&2){let e=d().$implicit;c(),b(e.description)}}function Nt(a,t){if(a&1&&(o(0,"mat-option",11)(1,"span",19),s(2),r(),v(3,Et,2,1,"span",20),r()),a&2){let e=t.$implicit;_("value",e.name),c(2),b(e.name),c(),C(e.description?3:-1)}}function At(a,t){if(a&1&&(o(0,"mat-option",11),s(1),r()),a&2){let e=t.$implicit;_("value",e),c(),b(e)}}function It(a,t){if(a&1){let e=x();o(0,"div",25)(1,"mat-form-field",8)(2,"mat-label"),s(3,"Name"),r(),o(4,"input",26),m("input",function(i){g(e);let l=d(2);return h(l.issueNumber.set(i.target.value))}),r()(),o(5,"mat-form-field",27)(6,"mat-label"),s(7,"Type"),r(),o(8,"mat-select",28),m("selectionChange",function(i){g(e);let l=d(2);return h(l.branchType.set(i.value))}),y(9,At,2,2,"mat-option",11,j),r()()()}if(a&2){let e=d(2);c(4),_("value",e.issueNumber()),c(4),_("value",e.branchType()),c(),M(e.branchTypes)}}function Vt(a,t){a&1&&T(0,"mat-spinner",13)}function Ft(a,t){if(a&1&&(o(0,"mat-option",11),s(1),r()),a&2){let e=t.$implicit;_("value",e),c(),b(e)}}function Gt(a,t){if(a&1){let e=x();o(0,"mat-form-field",8)(1,"mat-label"),s(2,"Source branch"),r(),o(3,"input",29,4),m("input",function(i){g(e);let l=d(2);return h(l.onBranchSearchInput(i.target.value))})("focus",function(){g(e);let i=w(4),l=d(2);return h(l.openPanel(i))}),r(),v(5,Vt,1,0,"mat-spinner",13),o(6,"mat-autocomplete",10,5),m("optionSelected",function(i){g(e);let l=d(2);return h(l.selectBranch(i.option.value))}),y(8,Ft,2,2,"mat-option",11,j),r()()}if(a&2){let e=w(7),n=d(2);c(3),_("value",n.branchSearch())("matAutocomplete",e)("disabled",n.isLoadingBranches()),c(2),C(n.isLoadingBranches()?5:-1),c(3),M(n.filteredBranches())}}function Rt(a,t){if(a&1){let e=x();o(0,"div",21)(1,"button",22),m("click",function(){g(e);let i=d();return h(i.onModeChange("local"))}),o(2,"mat-icon"),s(3,"folder_open"),r(),o(4,"span",23),s(5,"Local"),r(),o(6,"span",24),s(7,"Work directly on the current branch"),r()(),o(8,"button",22),m("click",function(){g(e);let i=d();return h(i.onModeChange("worktree"))}),o(9,"mat-icon"),s(10,"account_tree"),r(),o(11,"span",23),s(12,"Worktree"),r(),o(13,"span",24),s(14,"Create an isolated worktree from a branch"),r()()(),v(15,It,11,2,"div",25),v(16,Gt,10,4,"mat-form-field",8)}if(a&2){let e=d();c(),S("active",e.mode()==="local"),c(7),S("active",e.mode()==="worktree"),c(7),C(e.isWorktree()?15:-1),c(),C(e.isWorktree()?16:-1)}}function $t(a,t){a&1&&T(0,"mat-spinner",18)}function Lt(a,t){a&1&&(o(0,"mat-icon"),s(1,"rocket_launch"),r())}function qt(a,t){a&1&&(o(0,"mat-icon"),s(1,"open_in_new"),r())}var fe=class a{projectApi=f(U);agentApi=f(he);dialogRef=f($);projectState=f(ae);forcedProject=Q(this.projectState.forcedProject$,{initialValue:null});selectedProject=u("");projectSearch=u("");selectedAgent=u("");agentSearch=u("");mode=u("local");selectedBranch=u("");branchSearch=u("");issueNumber=u("");branchType=u("feature");task=u("");hasGit=u(!1);branchTypes=["feature","fix","refactor","chore","docs","build"];projects=u([]);agents=u([]);branches=u([]);filteredProjects=k(()=>{let t=this.projectSearch().toLowerCase();return t?this.projects().filter(e=>e.toLowerCase().includes(t)):this.projects()});filteredAgents=k(()=>{let t=this.agentSearch().toLowerCase();return t?this.agents().filter(e=>e.name.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t)):this.agents()});filteredBranches=k(()=>{let t=this.branchSearch().toLowerCase();return t?this.branches().filter(e=>e.toLowerCase().includes(t)):this.branches()});isLoadingAgents=u(!1);isLoadingBranches=u(!1);isSubmitting=u(!1);isWorktree=k(()=>this.mode()==="worktree"&&this.hasGit());isValid=k(()=>{let t=this.projects().includes(this.selectedProject()),e=this.agents().some(i=>i.name===this.selectedAgent()),n=t&&e&&!!this.task().trim();return this.isWorktree()?n&&!!this.selectedBranch()&&!!this.issueNumber().trim()&&!!this.branchType():n});canNavigate=k(()=>this.projects().includes(this.selectedProject()));openPanel(t){t.openPanel()}onProjectSearchInput(t){this.projectSearch.set(t),this.selectedProject()&&t!==this.selectedProject()&&(this.selectedProject.set(""),this.selectedAgent.set(""),this.agentSearch.set(""),this.agents.set([]))}selectProject(t){this.selectedProject.set(t),this.projectSearch.set(t),this.selectedAgent.set(""),this.agentSearch.set(""),this.agents.set([]),this.branches.set([]),this.selectedBranch.set(""),this.branchSearch.set(""),this.hasGit.set(!1),this.mode.set("local"),this.isLoadingAgents.set(!0),this.agentApi.getAgents(t).subscribe({next:e=>{this.agents.set(e),this.isLoadingAgents.set(!1)},error:()=>{this.isLoadingAgents.set(!1)}}),this.projectApi.getGitBranches(t).subscribe({next:({branches:e})=>{this.hasGit.set(e.length>0)},error:()=>{this.hasGit.set(!1)}})}onAgentSearchInput(t){this.agentSearch.set(t),this.selectedAgent()&&t!==this.selectedAgent()&&this.selectedAgent.set("")}selectAgent(t){this.selectedAgent.set(t),this.agentSearch.set(t)}onBranchSearchInput(t){this.branchSearch.set(t),this.selectedBranch()&&t!==this.selectedBranch()&&this.selectedBranch.set("")}selectBranch(t){this.selectedBranch.set(t),this.branchSearch.set(t)}ngOnInit(){this.projectApi.listProjects().subscribe({next:({projects:t})=>{let e=t.map(n=>n.name);this.projects.set(e),e.length===1&&e[0]&&this.selectProject(e[0])}})}onProjectChange(t){this.selectProject(t)}onModeChange(t){this.mode.set(t),t==="worktree"&&this.selectedProject()&&this.branches().length===0&&this.loadBranches()}loadBranches(){this.isLoadingBranches.set(!0),this.projectApi.getGitBranches(this.selectedProject()).subscribe({next:({branches:t})=>{this.branches.set(t),this.isLoadingBranches.set(!1)},error:()=>{this.isLoadingBranches.set(!1)}})}submit(){if(!this.isSubmitting()){if(this.isValid()){this.isSubmitting.set(!0);let t=this.isWorktree()&&this.issueNumber().trim()?`${this.issueNumber().trim()} ${this.task().trim()}`:this.task().trim();this.projectApi.createTask(this.selectedProject(),this.selectedAgent(),t,this.isWorktree()?"worktree":"local",this.isWorktree()?this.selectedBranch():void 0,this.isWorktree()?this.issueNumber().trim():void 0,this.isWorktree()?this.branchType():void 0).subscribe({next:({threadId:e,projectId:n})=>{this.dialogRef.close({threadId:e,projectId:n})},error:()=>{this.isSubmitting.set(!1)}});return}if(this.canNavigate()){this.dialogRef.close({projectId:this.selectedProject(),navigate:!0});return}}}cancel(){this.dialogRef.close(null)}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=D({type:a,selectors:[["app-new-task-dialog"]],decls:37,vars:12,consts:[["projectTrigger","matAutocompleteTrigger"],["projectAuto",""],["agentTrigger","matAutocompleteTrigger"],["agentAuto",""],["branchTrigger","matAutocompleteTrigger"],["branchAuto",""],["mat-dialog-title",""],[1,"ntd-content"],["appearance","outline",1,"ntd-field"],["matInput","","placeholder","Search project...",3,"input","focus","value","matAutocomplete"],[3,"optionSelected"],[3,"value"],["matInput","","placeholder","Search agent...",3,"input","focus","value","matAutocomplete","disabled"],["matSuffix","","diameter","16"],["matInput","","placeholder","Describe what the agent should accomplish...","rows","4",3,"input","value"],["align","end"],["mat-button","",3,"click","disabled"],["mat-flat-button","",1,"ntd-launch-btn",3,"click","disabled"],["diameter","16"],[1,"ntd-agent-name"],[1,"ntd-agent-desc"],[1,"ntd-radio-group"],["type","button",1,"ntd-mode-btn",3,"click"],[1,"ntd-radio-label"],[1,"ntd-radio-hint"],[1,"ntd-row"],["matInput","","type","text","placeholder","Name",3,"input","value"],["appearance","outline",1,"ntd-field","ntd-field--small"],[3,"selectionChange","value"],["matInput","","placeholder","Search branch...",3,"input","focus","value","matAutocomplete","disabled"]],template:function(e,n){if(e&1){let i=x();o(0,"h2",6)(1,"mat-icon"),s(2,"rocket_launch"),r(),s(3,` New Task
2
2
  `),r(),o(4,"mat-dialog-content",7)(5,"mat-form-field",8)(6,"mat-label"),s(7,"Project"),r(),o(8,"input",9,0),m("input",function(p){return n.onProjectSearchInput(p.target.value)})("focus",function(){g(i);let p=w(9);return h(n.openPanel(p))}),r(),o(10,"mat-autocomplete",10,1),m("optionSelected",function(p){return n.selectProject(p.option.value)}),y(12,jt,2,2,"mat-option",11,j),r()(),o(14,"mat-form-field",8)(15,"mat-label"),s(16,"Agent"),r(),o(17,"input",12,2),m("input",function(p){return n.onAgentSearchInput(p.target.value)})("focus",function(){g(i);let p=w(18);return h(n.openPanel(p))}),r(),v(19,Ot,1,0,"mat-spinner",13),o(20,"mat-autocomplete",10,3),m("optionSelected",function(p){return n.selectAgent(p.option.value)}),y(22,Nt,4,3,"mat-option",11,Dt),r()(),v(24,Rt,17,6),o(25,"mat-form-field",8)(26,"mat-label"),s(27,"Task"),r(),o(28,"textarea",14),m("input",function(p){return n.task.set(p.target.value)}),r()()(),o(29,"mat-dialog-actions",15)(30,"button",16),m("click",function(){return n.cancel()}),s(31,"Cancel"),r(),o(32,"button",17),m("click",function(){return n.submit()}),v(33,$t,1,0,"mat-spinner",18)(34,Lt,2,0,"mat-icon")(35,qt,2,0,"mat-icon"),s(36),r()()}if(e&2){let i=w(11),l=w(21);c(8),_("value",n.projectSearch())("matAutocomplete",i),c(4),M(n.filteredProjects()),c(5),_("value",n.agentSearch())("matAutocomplete",l)("disabled",!n.selectedProject()||n.isLoadingAgents()),c(2),C(n.isLoadingAgents()?19:-1),c(3),M(n.filteredAgents()),c(2),C(n.hasGit()&&!n.forcedProject()?24:-1),c(4),_("value",n.task()),c(2),_("disabled",n.isSubmitting()),c(2),_("disabled",!n.canNavigate()||n.isSubmitting()),c(),C(n.isSubmitting()?33:n.isValid()?34:35),c(3),P(" ",n.isValid()?"Launch":"Open"," ")}},dependencies:[K,W,q,z,B,E,O,J,X,ce,H,Z,Y,ue,pe,de,me,ee,ge,V,I,A,N],styles:["h2[mat-dialog-title][_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-bottom:0}.ntd-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem;padding-top:20px!important}.ntd-field[_ngcontent-%COMP%]{width:100%}.ntd-row[_ngcontent-%COMP%]{display:flex;gap:.75rem}.ntd-row[_ngcontent-%COMP%] .ntd-field--small[_ngcontent-%COMP%]{width:130px;flex-shrink:0}.ntd-radio-group[_ngcontent-%COMP%]{display:flex;gap:.75rem;padding:.25rem 0 .75rem}.ntd-mode-btn[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;align-items:flex-start;gap:.15rem;padding:.75rem;border:1px solid var(--color-border);border-radius:8px;background:transparent;color:var(--color-text);cursor:pointer;transition:border-color .15s,background .15s}.ntd-mode-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem;margin-bottom:.1rem}.ntd-mode-btn.active[_ngcontent-%COMP%]{border-color:var(--color-primary);background:color-mix(in srgb,var(--color-primary) 10%,transparent)}.ntd-mode-btn[_ngcontent-%COMP%]:hover:not(.active){border-color:var(--color-text-secondary)}.ntd-radio-label[_ngcontent-%COMP%]{font-weight:600;font-size:.9rem}.ntd-radio-hint[_ngcontent-%COMP%]{font-size:.72rem;color:var(--color-text-secondary);line-height:1.3;text-align:left}.ntd-agent-name[_ngcontent-%COMP%]{font-weight:500;display:block}.ntd-agent-desc[_ngcontent-%COMP%]{font-size:.75rem;color:var(--color-text-secondary);display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:380px}.ntd-launch-btn[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse)}.ntd-launch-btn[_ngcontent-%COMP%]:disabled{background:var(--color-border);color:var(--color-text-secondary);opacity:.6;cursor:not-allowed}"]})};var Bt=(a,t)=>t.name,zt=(a,t)=>t.value;function Wt(a,t){if(a&1&&(o(0,"mat-option",8),s(1),r()),a&2){let e=t.$implicit;_("value",e),c(),b(e)}}function Qt(a,t){a&1&&T(0,"mat-spinner",9)}function Ut(a,t){if(a&1&&(o(0,"mat-option",8),s(1),r()),a&2){let e=t.$implicit;_("value",e.name),c(),b(e.name)}}function Ht(a,t){if(a&1){let e=x();o(0,"button",37),m("click",function(){let i=g(e).$implicit,l=d();return h(l.toggleDay(i.value))}),s(1),r()}if(a&2){let e=t.$implicit,n=d();S("selected",n.isDaySelected(e.value)),c(),P(" ",e.label," ")}}function Xt(a,t){if(a&1){let e=x();o(0,"mat-form-field",4)(1,"mat-label"),s(2,"Number of runs"),r(),o(3,"input",17),m("ngModelChange",function(i){g(e);let l=d();return h(l.endOccurrences.set(i))}),r()()}if(a&2){let e=d();c(3),_("ngModel",e.endOccurrences())}}function Jt(a,t){if(a&1){let e=x();o(0,"mat-form-field",4)(1,"mat-label"),s(2,"End date"),r(),o(3,"input",38),m("ngModelChange",function(i){g(e);let l=d();return h(l.endTimestamp.set(i))}),r()()}if(a&2){let e=d();c(3),_("ngModel",e.endTimestamp())("min",e.startTimestamp())}}function Kt(a,t){if(a&1&&(o(0,"div",32)(1,"mat-icon"),s(2,"error"),r(),o(3,"span"),s(4),r()()),a&2){let e=d();c(4),b(e.errorMessage())}}function Yt(a,t){a&1&&T(0,"mat-spinner",36)}function Zt(a,t){a&1&&(o(0,"mat-icon"),s(1,"schedule"),r())}var R=class a{projectApi=f(U);agentApi=f(he);schedulerApi=f(_e);dialogRef=f($);dialogData=f(qe,{optional:!0});isEditMode=this.dialogData?.mode==="edit";projects=u([]);agents=u([]);name=u("");selectedProject=u("");selectedAgent=u("");instruction=u("");intervalValue=u(1);intervalUnit=u("d");startTimestamp=u("");daysOfWeek=u([]);endConditionType=u("none");endOccurrences=u(10);endTimestamp=u("");enabled=u(!0);isLoadingAgents=u(!1);isSaving=u(!1);errorMessage=u("");daysOfWeekOptions=[{value:1,label:"Mon"},{value:2,label:"Tue"},{value:3,label:"Wed"},{value:4,label:"Thu"},{value:5,label:"Fri"},{value:6,label:"Sat"},{value:0,label:"Sun"}];filteredProjects=k(()=>{let t=this.selectedProject().toLowerCase();return this.projects().filter(e=>e.toLowerCase().includes(t))});filteredAgents=k(()=>{let t=this.selectedAgent().toLowerCase();return this.agents().filter(e=>e.name.toLowerCase().includes(t))});isValid=k(()=>{let t=this.projects().includes(this.selectedProject()),e=this.agents().some(l=>l.name===this.selectedAgent()),n=this.instruction().trim().length>0,i=this.intervalValue()>=1;return t&&e&&n&&i});ngOnInit(){if(this.isEditMode&&this.dialogData?.scheduler){let t=this.dialogData.scheduler;this.name.set(t.name),this.selectedAgent.set(t.agentName??""),this.instruction.set(t.instruction??""),this.enabled.set(t.enabled);let e=t.schedule.interval.match(/^(\d+)(min|h|d|M)$/);e&&e[1]&&e[2]&&(this.intervalValue.set(parseInt(e[1],10)),this.intervalUnit.set(e[2])),t.schedule.startTimestamp&&this.startTimestamp.set(this.toDatetimeLocal(new Date(t.schedule.startTimestamp))),this.daysOfWeek.set(t.schedule.daysOfWeek??[]),t.schedule.endCondition&&(this.endConditionType.set(t.schedule.endCondition.type),t.schedule.endCondition.type==="occurrences"?this.endOccurrences.set(t.schedule.endCondition.value):t.schedule.endCondition.type==="endTimestamp"&&this.endTimestamp.set(this.toDatetimeLocal(new Date(t.schedule.endCondition.value))))}else this.startTimestamp.set(this.toDatetimeLocal(new Date));this.projectApi.listProjects().subscribe({next:({projects:t})=>{let e=t.map(i=>i.name).filter(i=>!i.includes("__"));this.projects.set(e);let n=this.dialogData?.projectName;this.isEditMode&&n?this.onProjectSelected(n):e.length===1&&e[0]&&this.onProjectSelected(e[0])}})}onProjectSelected(t){this.selectedProject.set(t),this.isEditMode||(this.agents.set([]),this.selectedAgent.set("")),this.projects().includes(t)&&(this.isLoadingAgents.set(!0),this.agentApi.getAgents(t).subscribe({next:e=>{this.agents.set(e),this.isLoadingAgents.set(!1),!this.isEditMode&&e.length===1&&e[0]&&this.selectedAgent.set(e[0].name)},error:()=>this.isLoadingAgents.set(!1)}))}toggleDay(t){let e=this.daysOfWeek();e.indexOf(t)>-1?this.daysOfWeek.set(e.filter(i=>i!==t)):this.daysOfWeek.set([...e,t].sort())}isDaySelected(t){return this.daysOfWeek().includes(t)}toDatetimeLocal(t){let e=n=>String(n).padStart(2,"0");return`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())}T${e(t.getHours())}:${e(t.getMinutes())}`}submit(){if(!this.isValid()||this.isSaving())return;this.errorMessage.set(""),this.isSaving.set(!0);let t=this.startTimestamp(),e={startTimestamp:t?new Date(t).toISOString():new Date().toISOString(),interval:`${this.intervalValue()}${this.intervalUnit()}`},n=this.daysOfWeek();n.length>0&&(e.daysOfWeek=n);let i=this.endConditionType();i==="occurrences"?e.endCondition={type:"occurrences",value:this.endOccurrences()}:i==="endTimestamp"&&this.endTimestamp()&&(e.endCondition={type:"endTimestamp",value:new Date(this.endTimestamp()).toISOString()});let l=this.instruction().trim(),p=l.length>40?l.slice(0,40)+"\u2026":l,ie=this.name().trim()||`${this.selectedAgent()} \u2014 ${p}`;this.isEditMode&&this.dialogData?.scheduler&&this.dialogData.projectName?this.schedulerApi.updateSchedulerForProject(this.dialogData.projectName,this.dialogData.scheduler.id,{name:ie,agentName:this.selectedAgent(),instruction:l,schedule:e,enabled:this.enabled()}).subscribe({next:()=>{this.isSaving.set(!1),this.dialogRef.close(!0)},error:te=>{this.errorMessage.set(te?.error?.error||"Failed to update scheduler"),this.isSaving.set(!1)}}):this.schedulerApi.createSchedulerForProject(this.selectedProject(),{name:ie,agentName:this.selectedAgent(),instruction:l,schedule:e,enabled:this.enabled()}).subscribe({next:()=>{this.isSaving.set(!1),this.dialogRef.close(!0)},error:te=>{this.errorMessage.set(te?.error?.error||"Failed to create scheduler"),this.isSaving.set(!1)}})}cancel(){this.dialogRef.close(!1)}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=D({type:a,selectors:[["app-quick-scheduler-dialog"]],decls:84,vars:20,consts:[["projectAuto","matAutocomplete"],["agentAuto","matAutocomplete"],["mat-dialog-title",""],[1,"qsd-form"],["appearance","outline",1,"full-width"],["matInput","","placeholder","Optional \u2014 auto-generated if empty",3,"ngModelChange","ngModel"],["matInput","","placeholder","Select a project",3,"ngModelChange","focus","ngModel","matAutocomplete"],[3,"optionSelected"],[3,"value"],["matSuffix","","diameter","18"],["matInput","","placeholder","Select an agent",3,"ngModelChange","focus","ngModel","matAutocomplete","disabled"],["matInput","","placeholder","e.g. Review open PRs and summarize what needs attention","rows","3",3,"ngModelChange","ngModel"],[1,"qsd-divider"],["matInput","","type","datetime-local",3,"ngModelChange","ngModel"],[1,"qsd-interval"],[1,"qsd-label"],["appearance","outline",1,"interval-value"],["matInput","","type","number","min","1",3,"ngModelChange","ngModel"],["appearance","outline",1,"interval-unit"],[3,"ngModelChange","ngModel"],["value","min"],["value","h"],["value","d"],["value","M"],[1,"qsd-days"],[1,"qsd-day-chips"],["type","button",1,"day-chip",3,"selected"],[1,"qsd-hint"],[1,"qsd-end"],["value","none"],["value","occurrences"],["value","endTimestamp"],[1,"qsd-error"],["align","end"],["mat-button","",3,"click","disabled"],["mat-flat-button","",3,"click","disabled"],["diameter","18"],["type","button",1,"day-chip",3,"click"],["matInput","","type","datetime-local",3,"ngModelChange","ngModel","min"]],template:function(e,n){if(e&1&&(o(0,"h2",2)(1,"mat-icon"),s(2,"schedule"),r(),s(3),r(),o(4,"mat-dialog-content")(5,"div",3)(6,"mat-form-field",4)(7,"mat-label"),s(8,"Name"),r(),o(9,"input",5),m("ngModelChange",function(l){return n.name.set(l)}),r()(),o(10,"mat-form-field",4)(11,"mat-label"),s(12,"Project"),r(),o(13,"input",6),m("ngModelChange",function(l){return n.onProjectSelected(l)})("focus",function(){return n.selectedProject.set(n.selectedProject())}),r(),o(14,"mat-autocomplete",7,0),m("optionSelected",function(l){return n.onProjectSelected(l.option.value)}),y(16,Wt,2,2,"mat-option",8,j),r()(),o(18,"mat-form-field",4)(19,"mat-label"),s(20,"Agent"),r(),v(21,Qt,1,0,"mat-spinner",9),o(22,"input",10),m("ngModelChange",function(l){return n.selectedAgent.set(l)})("focus",function(){return n.selectedAgent.set(n.selectedAgent())}),r(),o(23,"mat-autocomplete",7,1),m("optionSelected",function(l){return n.selectedAgent.set(l.option.value)}),y(25,Ut,2,2,"mat-option",8,Bt),r()(),o(27,"mat-form-field",4)(28,"mat-label"),s(29,"What should the agent do?"),r(),o(30,"textarea",11),m("ngModelChange",function(l){return n.instruction.set(l)}),r()(),o(31,"div",12)(32,"span"),s(33,"Scheduling"),r()(),o(34,"mat-form-field",4)(35,"mat-label"),s(36,"Starts on"),r(),o(37,"input",13),m("ngModelChange",function(l){return n.startTimestamp.set(l)}),r()(),o(38,"div",14)(39,"span",15),s(40,"Every"),r(),o(41,"mat-form-field",16)(42,"input",17),m("ngModelChange",function(l){return n.intervalValue.set(l)}),r()(),o(43,"mat-form-field",18)(44,"mat-select",19),m("ngModelChange",function(l){return n.intervalUnit.set(l)}),o(45,"mat-option",20),s(46,"minutes"),r(),o(47,"mat-option",21),s(48,"hours"),r(),o(49,"mat-option",22),s(50,"days"),r(),o(51,"mat-option",23),s(52,"months"),r()()()(),o(53,"div",24)(54,"span",15),s(55,"Days"),r(),o(56,"div",25),y(57,Ht,2,3,"button",26,zt),r(),o(59,"span",27),s(60,"Leave empty for every day"),r()(),o(61,"div",28)(62,"mat-form-field",4)(63,"mat-label"),s(64,"Ends on"),r(),o(65,"mat-select",19),m("ngModelChange",function(l){return n.endConditionType.set(l)}),o(66,"mat-option",29),s(67,"Never"),r(),o(68,"mat-option",30),s(69,"After N runs"),r(),o(70,"mat-option",31),s(71,"On a date"),r()()(),v(72,Xt,4,1,"mat-form-field",4),v(73,Jt,4,2,"mat-form-field",4),r(),o(74,"mat-checkbox",19),m("ngModelChange",function(l){return n.enabled.set(l)}),s(75,"Enable immediately"),r(),v(76,Kt,5,1,"div",32),r()(),o(77,"mat-dialog-actions",33)(78,"button",34),m("click",function(){return n.cancel()}),s(79,"Cancel"),r(),o(80,"button",35),m("click",function(){return n.submit()}),v(81,Yt,1,0,"mat-spinner",36)(82,Zt,2,0,"mat-icon"),s(83," Schedule "),r()()),e&2){let i=w(15),l=w(24);c(3),P(" ",n.isEditMode?"Edit scheduled task":"New scheduled task",`
3
3
  `),c(6),_("ngModel",n.name()),c(4),_("ngModel",n.selectedProject())("matAutocomplete",i),c(3),M(n.filteredProjects()),c(5),C(n.isLoadingAgents()?21:-1),c(),_("ngModel",n.selectedAgent())("matAutocomplete",l)("disabled",!n.projects().includes(n.selectedProject())),c(3),M(n.filteredAgents()),c(5),_("ngModel",n.instruction()),c(7),_("ngModel",n.startTimestamp()),c(5),_("ngModel",n.intervalValue()),c(2),_("ngModel",n.intervalUnit()),c(13),M(n.daysOfWeekOptions),c(8),_("ngModel",n.endConditionType()),c(7),C(n.endConditionType()==="occurrences"?72:-1),c(),C(n.endConditionType()==="endTimestamp"?73:-1),c(),_("ngModel",n.enabled()),c(2),C(n.errorMessage()?76:-1),c(2),_("disabled",n.isSaving()),c(2),_("disabled",!n.isValid()||n.isSaving()),c(),C(n.isSaving()?81:82)}},dependencies:[K,tt,ot,nt,rt,it,W,q,z,B,E,O,J,X,ce,H,Z,Y,ue,pe,de,me,ee,ge,ut,mt,V,I,A,N],styles:['[_nghost-%COMP%]{display:block}h2[mat-dialog-title][_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.qsd-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;padding-top:4px}.full-width[_ngcontent-%COMP%]{width:100%}.qsd-interval[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.qsd-interval[_ngcontent-%COMP%] .qsd-label[_ngcontent-%COMP%]{font-size:14px;color:var(--mat-sys-on-surface-variant);white-space:nowrap}.qsd-interval[_ngcontent-%COMP%] .interval-value[_ngcontent-%COMP%]{width:80px}.qsd-interval[_ngcontent-%COMP%] .interval-unit[_ngcontent-%COMP%]{flex:1}.qsd-days[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.qsd-days[_ngcontent-%COMP%] .qsd-label[_ngcontent-%COMP%]{font-size:14px;color:var(--mat-sys-on-surface-variant);white-space:nowrap}.qsd-days[_ngcontent-%COMP%] .qsd-hint[_ngcontent-%COMP%]{font-size:12px;color:var(--mat-sys-on-surface-variant);opacity:.7;width:100%;margin-top:-4px;padding-left:36px}.qsd-day-chips[_ngcontent-%COMP%]{display:flex;gap:4px;flex-wrap:wrap}.day-chip[_ngcontent-%COMP%]{padding:4px 10px;border-radius:16px;border:1px solid var(--mat-sys-outline);background:transparent;color:var(--mat-sys-on-surface);font-size:12px;cursor:pointer;transition:background .15s,color .15s}.day-chip.selected[_ngcontent-%COMP%]{background:var(--mat-sys-primary);color:var(--mat-sys-on-primary);border-color:var(--mat-sys-primary)}.day-chip[_ngcontent-%COMP%]:hover:not(.selected){background:var(--mat-sys-surface-variant)}.qsd-divider[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin:4px 0}.qsd-divider[_ngcontent-%COMP%]:before, .qsd-divider[_ngcontent-%COMP%]:after{content:"";flex:1;height:1px;background:var(--mat-sys-outline-variant)}.qsd-divider[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:12px;color:var(--mat-sys-on-surface-variant);text-transform:uppercase;letter-spacing:.5px}.qsd-end[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:8px}.qsd-error[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;color:var(--mat-sys-error);font-size:14px}.qsd-error[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px}mat-dialog-actions[_ngcontent-%COMP%]{gap:8px}mat-dialog-actions[_ngcontent-%COMP%] button[mat-flat-button][_ngcontent-%COMP%]{display:flex;align-items:center;gap:6px}'],changeDetection:0})};var tn=(a,t)=>t.id;function nn(a,t){if(a&1){let e=x();o(0,"button",9),m("click",function(){let i=g(e).$implicit,l=d(2);return h(l.setProject(i))}),s(1),r()}if(a&2){let e=t.$implicit,n=d(2);S("active",n.activeProject()===e),c(),P(" ",e," ")}}function on(a,t){if(a&1){let e=x();o(0,"nav",2)(1,"button",9),m("click",function(){g(e);let i=d();return h(i.setProject(null))}),s(2," All projects "),r(),y(3,nn,2,3,"button",10,j),r()}if(a&2){let e=d();c(),S("active",e.activeProject()===null),c(2),M(e.projects())}}function rn(a,t){a&1&&(o(0,"div",3),T(1,"mat-spinner",11),r())}function an(a,t){if(a&1&&(o(0,"div",4)(1,"mat-icon"),s(2,"error"),r(),s(3),r()),a&2){let e=d();c(3),P(" ",e.errorMessage()," ")}}function ln(a,t){if(a&1){let e=x();o(0,"div",5)(1,"mat-icon"),s(2,"schedule"),r(),o(3,"p"),s(4,"No scheduled tasks yet."),r(),o(5,"button",12),m("click",function(){g(e);let i=d();return h(i.openCreate())}),o(6,"mat-icon"),s(7,"add"),r(),s(8," Create one "),r()()}}function sn(a,t){if(a&1&&(o(0,"span",17),s(1),r()),a&2){let e=d().$implicit;c(),b(e.projectName)}}function cn(a,t){if(a&1){let e=x();o(0,"li",14)(1,"div",15)(2,"span",16),s(3),r(),v(4,sn,2,1,"span",17),o(5,"span",18),s(6),r()(),o(7,"div",19)(8,"span",20),s(9),r(),o(10,"span",21),s(11),r()(),o(12,"div",22)(13,"mat-slide-toggle",23),m("change",function(){let i=g(e).$implicit,l=d(2);return h(l.toggleEnabled(i))}),r(),o(14,"button",24),m("click",function(){let i=g(e).$implicit,l=d(2);return h(l.runNow(i))}),o(15,"mat-icon"),s(16,"play_arrow"),r()(),o(17,"button",25),m("click",function(){let i=g(e).$implicit,l=d(2);return h(l.edit(i))}),o(18,"mat-icon"),s(19,"edit"),r()(),o(20,"button",26),m("click",function(){let i=g(e).$implicit,l=d(2);return h(l.delete(i))}),o(21,"mat-icon"),s(22,"delete"),r()()()()}if(a&2){let e=t.$implicit,n=d(2);S("disabled",!e.enabled),c(3),b(e.name),c(),C(n.projects().length>1?4:-1),c(2),b(n.getSource(e)),c(3),b(n.formatInterval(e.schedule.interval)),c(),S("due",!e.nextRun),c(),b(n.formatNextRun(e.nextRun)),c(2),_("checked",e.enabled)}}function dn(a,t){if(a&1&&(o(0,"ul",6),y(1,cn,23,10,"li",13,tn),r()),a&2){let e=d();c(),M(e.filteredSchedulers())}}var be=class a{projectApi=f(U);schedulerApi=f(_e);dialog=f(L);dialogRef=f($);allSchedulers=u([]);isLoading=u(!0);errorMessage=u("");activeProject=u(null);projects=u([]);filteredSchedulers=k(()=>{let t=this.activeProject(),e=this.allSchedulers();return t?e.filter(n=>n.projectName===t):e});ngOnInit(){this.load()}load(){this.isLoading.set(!0),this.errorMessage.set(""),this.projectApi.listProjects().subscribe({next:({projects:t})=>{let e=t.map(i=>i.name).filter(i=>!i.includes("__"));if(this.projects.set(e),e.length===0){this.isLoading.set(!1);return}let n=e.map(i=>this.schedulerApi.listSchedulersForProject(i).pipe(Ee(()=>Pe([]))));Oe(n).subscribe({next:i=>{let l=[];i.forEach((p,ie)=>{p.forEach(te=>l.push(G(F({},te),{projectName:e[ie]})))}),this.allSchedulers.set(l),this.isLoading.set(!1)},error:()=>{this.errorMessage.set("Failed to load schedulers"),this.isLoading.set(!1)}})},error:()=>{this.errorMessage.set("Failed to load projects"),this.isLoading.set(!1)}})}setProject(t){this.activeProject.set(t)}formatInterval(t){let e=/^(\d+)(min|h|d|M)$/.exec(t);if(!e)return t;let[,n,i]=e;return`Every ${n}${{min:"min",h:"h",d:"d",M:"mo"}[i??""]??i}`}formatNextRun(t){if(!t)return"Expired";let e=new Date(t),n=new Date,i=e.getTime()-n.getTime();if(i<0)return"Due";let l=Math.floor(i/6e4);if(l<60)return`in ${l}m`;let p=Math.floor(l/60);return p<24?`in ${p}h`:`in ${Math.floor(p/24)}d`}getSource(t){if(t.agentName&&t.instruction){let e=t.instruction.length>35?t.instruction.slice(0,35)+"\u2026":t.instruction;return`${t.agentName}: ${e}`}return t.promptId??""}toggleEnabled(t){(t.enabled?this.schedulerApi.disableSchedulerForProject(t.projectName,t.id):this.schedulerApi.enableSchedulerForProject(t.projectName,t.id)).subscribe({next:()=>{this.allSchedulers.update(n=>n.map(i=>i.id===t.id?G(F({},i),{enabled:!i.enabled}):i))},error:()=>this.errorMessage.set("Failed to toggle scheduler")})}runNow(t){this.schedulerApi.runSchedulerNowForProject(t.projectName,t.id).subscribe({error:()=>this.errorMessage.set("Failed to run scheduler")})}edit(t){let e={mode:"edit",projectName:t.projectName,scheduler:{id:t.id,name:t.name,agentName:t.agentName,instruction:t.instruction,enabled:t.enabled,schedule:t.schedule}};this.dialog.open(R,{width:"480px",data:e}).afterClosed().subscribe(i=>{i&&this.load()})}delete(t){this.schedulerApi.deleteSchedulerForProject(t.projectName,t.id).subscribe({next:()=>{this.allSchedulers.update(e=>e.filter(n=>n.id!==t.id))},error:()=>this.errorMessage.set("Failed to delete scheduler")})}openCreate(){this.dialogRef.close(),this.dialog.open(R,{width:"480px"})}close(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=D({type:a,selectors:[["app-global-schedulers-dialog"]],decls:19,vars:3,consts:[["mat-dialog-title",""],[1,"gsd-count"],[1,"gsd-project-filters"],[1,"gsd-loading"],[1,"gsd-error"],[1,"gsd-empty"],[1,"gsd-list"],["align","end"],["mat-button","",3,"click"],[1,"proj-chip",3,"click"],[1,"proj-chip",3,"active"],["diameter","32"],["mat-flat-button","",3,"click"],[1,"gsd-item",3,"disabled"],[1,"gsd-item"],[1,"gsd-item-main"],[1,"gsd-item-name"],[1,"gsd-item-project"],[1,"gsd-item-source"],[1,"gsd-item-meta"],[1,"gsd-interval"],[1,"gsd-next"],[1,"gsd-item-actions"],["matTooltip","Enable / Disable",3,"change","checked"],["mat-icon-button","","matTooltip","Run now",3,"click"],["mat-icon-button","","matTooltip","Edit",3,"click"],["mat-icon-button","","matTooltip","Delete",1,"delete-btn",3,"click"]],template:function(e,n){e&1&&(o(0,"h2",0)(1,"mat-icon"),s(2,"schedule"),r(),s(3," Scheduled tasks "),o(4,"span",1),s(5),r()(),o(6,"mat-dialog-content"),v(7,on,5,2,"nav",2),v(8,rn,2,0,"div",3)(9,an,4,1,"div",4)(10,ln,9,0,"div",5)(11,dn,3,0,"ul",6),r(),o(12,"mat-dialog-actions",7)(13,"button",8),m("click",function(){return n.openCreate()}),o(14,"mat-icon"),s(15,"add"),r(),s(16," New scheduler "),r(),o(17,"button",8),m("click",function(){return n.close()}),s(18,"Close"),r()()),e&2&&(c(5),b(n.filteredSchedulers().length),c(2),C(n.projects().length>1?7:-1),c(),C(n.isLoading()?8:n.errorMessage()?9:n.filteredSchedulers().length===0?10:11))},dependencies:[K,W,q,z,B,E,O,re,A,N,V,I,ee,se,le,ht,gt],styles:["[_nghost-%COMP%]{display:block}h2[mat-dialog-title][_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}h2[mat-dialog-title][_ngcontent-%COMP%] .gsd-count[_ngcontent-%COMP%]{font-size:13px;font-weight:400;color:var(--mat-sys-on-surface-variant);margin-left:2px}.gsd-project-filters[_ngcontent-%COMP%]{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}.proj-chip[_ngcontent-%COMP%]{padding:4px 12px;border-radius:16px;border:1px solid var(--mat-sys-outline);background:transparent;color:var(--mat-sys-on-surface);font-size:13px;cursor:pointer;transition:background .15s,color .15s}.proj-chip.active[_ngcontent-%COMP%]{background:var(--mat-sys-primary);color:var(--mat-sys-on-primary);border-color:var(--mat-sys-primary)}.proj-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--mat-sys-surface-variant)}.gsd-loading[_ngcontent-%COMP%], .gsd-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:32px 0;color:var(--mat-sys-on-surface-variant)}.gsd-loading[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%], .gsd-empty[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:40px;width:40px;height:40px;opacity:.4}.gsd-error[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;color:var(--mat-sys-error);padding:16px 0}.gsd-list[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}.gsd-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:8px;background:var(--mat-sys-surface-container);transition:opacity .2s}.gsd-item.disabled[_ngcontent-%COMP%]{opacity:.5}.gsd-item-main[_ngcontent-%COMP%]{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.gsd-item-name[_ngcontent-%COMP%]{font-weight:500;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gsd-item-project[_ngcontent-%COMP%]{font-size:11px;color:var(--mat-sys-primary);font-weight:500}.gsd-item-source[_ngcontent-%COMP%]{font-size:12px;color:var(--mat-sys-on-surface-variant);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gsd-item-meta[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-end;gap:2px;white-space:nowrap}.gsd-interval[_ngcontent-%COMP%]{font-size:12px;color:var(--mat-sys-on-surface-variant)}.gsd-next[_ngcontent-%COMP%]{font-size:11px;color:var(--mat-sys-on-surface-variant)}.gsd-next.due[_ngcontent-%COMP%]{color:var(--mat-sys-error)}.gsd-item-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:4px}.gsd-item-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]{color:var(--mat-sys-error);opacity:.7;transition:opacity .15s}.gsd-item-actions[_ngcontent-%COMP%] .delete-btn[_ngcontent-%COMP%]:hover{opacity:1}mat-dialog-actions[_ngcontent-%COMP%]{gap:8px}"],changeDetection:0})};var ve=class a{http=f(Ge);threadApi=f(ze);isLoading=u(!1);tasks=u([]);refresh(){this.isLoading.set(!0),this.threadApi.listAllThreads().pipe(De(15e3)).subscribe({next:t=>{let e=t.filter(n=>!n.parentThreadId).map(n=>({id:n.id,name:n.name,summary:n.summary,modifiedDate:n.modifiedDate,starring:n.starring??[],users:n.users??[],isActive:!1,status:this.deriveStatus(n),projectId:n.projectId,worktreeProject:n.worktreeProject}));this.tasks.set(this.sorted(e)),this.isLoading.set(!1)},error:()=>{this.isLoading.set(!1)}})}applyStatusEvent(t,e){let n=e==="invite"?"waiting-you":"in-progress";this.tasks.update(i=>this.sorted(i.map(l=>l.id===t?G(F({},l),{status:n}):l)))}closeTask(t,e){this.tasks.update(n=>n.filter(i=>i.id!==e)),this.http.delete(`/api/projects/${t}/missions/${e}`).subscribe({next:()=>this.refresh(),error:n=>{console.error("[GLOBAL-TC] Failed to close task:",n),this.refresh()}})}stopThread(t,e){this.http.post(`/api/projects/${t}/threads/${e}/stop`,{}).subscribe({error:n=>console.error("[GLOBAL-TC] Failed to stop thread:",n)})}deleteThread(t,e){this.tasks.update(n=>n.filter(i=>i.id!==e)),this.http.delete(`/api/projects/${t}/threads/${e}`).subscribe({next:()=>this.refresh(),error:n=>{console.error("[GLOBAL-TC] Failed to delete thread:",n),this.refresh()}})}toggleStar(t,e,n){let i=`/api/projects/${t}/threads/${e}/star`;(n?this.http.delete(i):this.http.post(i,{})).subscribe({next:()=>this.refresh(),error:p=>console.error("[GLOBAL-TC] Failed to toggle star:",p)})}markTaskDone(t,e){this.http.post(`/api/projects/${t}/threads/${e}/done`,{}).subscribe({next:()=>this.refresh(),error:n=>console.error("[GLOBAL-TC] Failed to mark task as done:",n)})}markTaskActive(t,e){this.http.delete(`/api/projects/${t}/threads/${e}/done`).subscribe({next:()=>this.refresh(),error:n=>console.error("[GLOBAL-TC] Failed to mark task as active:",n)})}deriveStatus(t){return t.closedByUser?"done":t.pendingInvite?"waiting-you":Date.now()-new Date(t.modifiedDate).getTime()<vt?"in-progress":"paused"}sorted(t){return[...t].sort((e,n)=>{let i=ye[e.status]-ye[n.status];return i!==0?i:e.modifiedDate>n.modifiedDate?-1:1})}static \u0275fac=function(e){return new(e||a)};static \u0275prov=oe({token:a,factory:a.\u0275fac,providedIn:"root"})};var Ce=class a{configApi=f(Ct);dialog=f(L);openUserConfigEditor(){this.configApi.getUserConfig().subscribe({next:t=>{this.dialog.open(xt,{data:{configType:"user",initialContent:JSON.stringify(t,null,2)}}).afterClosed().subscribe(n=>{n&&this.configApi.updateUserConfig(n).subscribe({error:i=>console.error("[CONFIG-STATE] Error saving user config:",i)})})},error:t=>console.error("[CONFIG-STATE] Error loading user config:",t)})}static \u0275fac=function(e){return new(e||a)};static \u0275prov=oe({token:a,factory:a.\u0275fac,providedIn:"root"})};var pn=["layoutContainer"],mn=(a,t)=>t.key,un=(a,t)=>t.name,gn=(a,t)=>t.status,Tt=(a,t)=>t.id;function hn(a,t){if(a&1){let e=x();o(0,"button",32),m("click",function(){g(e);let i=d();return h(i.clearSearch())}),o(1,"mat-icon"),s(2,"close"),r()()}}function _n(a,t){if(a&1){let e=x();o(0,"button",33),m("click",function(){let i=g(e).$implicit,l=d(2);return h(l.setProject(i.name))}),s(1),o(2,"span",34),s(3),r()()}if(a&2){let e=t.$implicit,n=d(2);S("active",n.activeProject()===e.name),c(),P(" ",e.name," "),c(2),b(e.count)}}function fn(a,t){if(a&1){let e=x();o(0,"nav",22)(1,"button",33),m("click",function(){g(e);let i=d();return h(i.setProject(null))}),s(2," All projects "),o(3,"span",34),s(4),r()(),y(5,_n,4,4,"button",35,un),r()}if(a&2){let e=d();c(),S("active",e.activeProject()===null),c(3),b(e.allTasks().length),c(),M(e.projectSummaries())}}function bn(a,t){if(a&1&&(o(0,"span",37),s(1),r()),a&2){let e=d().$implicit,n=d();c(),b(n.filterCounts()[e.key])}}function vn(a,t){if(a&1){let e=x();o(0,"button",36),m("click",function(){let i=g(e).$implicit,l=d();return h(l.setFilter(i.key))}),o(1,"mat-icon",26),s(2),r(),o(3,"span"),s(4),r(),v(5,bn,2,1,"span",37),r()}if(a&2){let e=t.$implicit,n=d();S("active",n.activeFilter()===e.key),ke("aria-selected",n.activeFilter()===e.key),c(2),b(e.icon),c(2),b(e.label),c(),C(n.filterCounts()[e.key]>0?5:-1)}}function Cn(a,t){a&1&&(o(0,"div",29),T(1,"mat-spinner",38),o(2,"p"),s(3,"Loading tasks from all projects\u2026"),r()())}function xn(a,t){a&1&&(o(0,"div",30)(1,"mat-icon",39),s(2,"hub"),r(),o(3,"p"),s(4,"No tasks found."),r()())}function kn(a,t){if(a&1){let e=x();o(0,"app-task-card",45),m("stopRequested",function(i){let l=g(e).$implicit,p=d(3);return h(p.onStopRequested(i,l.projectId))})("deleteRequested",function(i){let l=g(e).$implicit,p=d(3);return h(p.onDeleteRequested(i,l.projectId))})("starToggled",function(i){let l=g(e).$implicit,p=d(3);return h(p.onStarToggled(i,l.projectId))})("closeTaskRequested",function(i){let l=g(e).$implicit,p=d(3);return h(p.onCloseTaskRequested(i,l.projectId))})("markDoneRequested",function(i){let l=g(e).$implicit,p=d(3);return h(p.onMarkDoneRequested(i,l.projectId))})("markActiveRequested",function(i){let l=g(e).$implicit,p=d(3);return h(p.onMarkActiveRequested(i,l.projectId))})("previewRequested",function(i){let l=g(e).$implicit,p=d(3);return h(p.onPreviewRequested(i,l.projectId,l.name))}),r()}if(a&2){let e=t.$implicit,n=d(3);S("is-previewed",n.previewThreadId()===e.id),_("task",e)("projectNameOverride",e.projectId)("showProject",!0)("previewMode",n.previewActive())}}function yn(a,t){if(a&1&&(o(0,"section",40)(1,"h3",41)(2,"mat-icon",42),s(3),r(),s(4),o(5,"span",43),s(6),r()(),o(7,"div",31),y(8,kn,1,6,"app-task-card",44,Tt),r()()),a&2){let e=t.$implicit;c(3),b(e.icon),c(),P(" ",e.label," "),c(2),b(e.tasks.length),c(2),M(e.tasks)}}function Mn(a,t){if(a&1&&y(0,yn,10,3,"section",40,gn),a&2){let e=d();M(e.taskGroups())}}function Sn(a,t){if(a&1){let e=x();o(0,"app-task-card",45),m("stopRequested",function(i){let l=g(e).$implicit,p=d(2);return h(p.onStopRequested(i,l.projectId))})("deleteRequested",function(i){let l=g(e).$implicit,p=d(2);return h(p.onDeleteRequested(i,l.projectId))})("starToggled",function(i){let l=g(e).$implicit,p=d(2);return h(p.onStarToggled(i,l.projectId))})("closeTaskRequested",function(i){let l=g(e).$implicit,p=d(2);return h(p.onCloseTaskRequested(i,l.projectId))})("markDoneRequested",function(i){let l=g(e).$implicit,p=d(2);return h(p.onMarkDoneRequested(i,l.projectId))})("markActiveRequested",function(i){let l=g(e).$implicit,p=d(2);return h(p.onMarkActiveRequested(i,l.projectId))})("previewRequested",function(i){let l=g(e).$implicit,p=d(2);return h(p.onPreviewRequested(i,l.projectId,l.name))}),r()}if(a&2){let e=t.$implicit,n=d(2);S("is-previewed",n.previewThreadId()===e.id),_("task",e)("projectNameOverride",e.projectId)("showProject",!0)("previewMode",n.previewActive())}}function Tn(a,t){if(a&1&&(o(0,"div",31),y(1,Sn,1,6,"app-task-card",44,Tt),r()),a&2){let e=d();c(),M(e.displayedTasks())}}function wn(a,t){if(a&1){let e=x();o(0,"div",46),m("mousedown",function(i){g(e);let l=d();return h(l.onResizerMousedown(i))}),r(),o(1,"div",47)(2,"header",48)(3,"span",49),s(4),r(),o(5,"div",50)(6,"button",51),m("click",function(){g(e);let i=d();return h(i.navigateToThread())}),o(7,"mat-icon"),s(8,"open_in_new"),r()(),o(9,"button",52),m("click",function(){g(e);let i=d();return h(i.closePreview())}),o(10,"mat-icon"),s(11,"close"),r()()()(),o(12,"div",53),T(13,"app-thread",54),r()()}if(a&2){let e=d();c(),Fe("width",e.previewPanelWidthPercent(),"%"),c(3),b(e.previewTaskName()||"Task"),c(9),_("projectName",e.previewProjectId())("threadId",e.previewThreadId())}}var Pn=20,Dn=70,jn=[{status:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt"},{status:"in-progress",label:"In progress",icon:"pending"},{status:"paused",label:"Paused",icon:"pause_circle"},{status:"error",label:"Error",icon:"error"},{status:"done",label:"Done",icon:"check_circle"}],On=[{key:"all",label:"All",icon:"grid_view"},{key:"waiting-you",label:"Waiting for you",icon:"mark_unread_chat_alt"},{key:"in-progress",label:"In progress",icon:"pending"},{key:"paused",label:"Paused",icon:"pause_circle"},{key:"done",label:"Done",icon:"check_circle"}],St=class a{globalTaskService=f(ve);destroyRef=f(Ne);dialog=f(L);router=f(Re);configState=f(Ce);userService=f(Qe);preferences=f(Ue);projectState=f(ae);threadState=f(We);breakpointObserver=f(Le);username=Q(this.userService.username$,{initialValue:null});isDesktop=Q(this.breakpointObserver.observe("(min-width: 1280px)").pipe(je(t=>t.matches)),{initialValue:!1});previewEnabled=Q(this.preferences.missionPreviewEnabled$,{initialValue:!1});previewActive=k(()=>this.previewEnabled()&&this.isDesktop());previewThreadId=u(null);previewProjectId=u(null);previewTaskName=u(null);previewPanelWidthPercent=u(this.preferences.getMissionPreviewPanelWidth());isDraggingResizer=!1;dragStartX=0;dragStartWidth=0;containerWidth=0;layoutContainerRef;globalEventSource=null;filters=On;activeFilter=u("all");starredOnly=u(!1);activeProject=u(null);searchQuery=u("");isLoading=this.globalTaskService.isLoading;allTasks=this.globalTaskService.tasks;projectSummaries=k(()=>{let t=this.allTasks(),e=new Map;for(let n of t)e.set(n.projectId,(e.get(n.projectId)??0)+1);return[...e.entries()].map(([n,i])=>({name:n,count:i})).sort((n,i)=>n.name.localeCompare(i.name))});filteredTasks=k(()=>{let t=this.allTasks(),e=this.activeProject();e&&(t=t.filter(l=>l.projectId===e));let n=this.username();this.starredOnly()&&n&&(t=t.filter(l=>l.starring.includes(n)));let i=this.activeFilter();return i!=="all"&&(t=t.filter(l=>l.status===i)),t});filterCounts=k(()=>{let t=this.allTasks(),e=this.activeProject();e&&(t=t.filter(i=>i.projectId===e));let n=this.username();return this.starredOnly()&&n&&(t=t.filter(i=>i.starring.includes(n))),{all:t.length,"waiting-you":t.filter(i=>i.status==="waiting-you").length,"in-progress":t.filter(i=>i.status==="in-progress").length,done:t.filter(i=>i.status==="done").length,paused:t.filter(i=>i.status==="paused").length,error:t.filter(i=>i.status==="error").length}});displayedTasks=k(()=>{let t=this.searchQuery().toLowerCase().trim(),e=this.sortedFilteredTasks();return t?e.filter(n=>(n.name||"").toLowerCase().includes(t)||(n.summary||"").toLowerCase().includes(t)):e});taskGroups=k(()=>{let t=this.displayedTasks();return jn.map(e=>G(F({},e),{tasks:t.filter(n=>n.status===e.status)})).filter(e=>e.tasks.length>0)});sortedFilteredTasks=k(()=>{let t=this.filteredTasks(),e={"waiting-you":0,"in-progress":1,paused:2,error:3,done:4};return[...t].sort((n,i)=>(e[n.status]??99)-(e[i.status]??99))});constructor(){this.destroyRef.onDestroy(()=>this.disconnectGlobalSse())}ngOnInit(){this.globalTaskService.refresh(),this.connectGlobalSse(),this.userService.fetchCurrentUser().pipe(Be(this.destroyRef)).subscribe({error:t=>console.warn("[GTC] Could not fetch user:",t)})}setFilter(t){this.activeFilter.set(t)}toggleStarredFilter(){this.starredOnly.update(t=>!t)}setProject(t){this.activeProject.set(t),this.activeFilter.set("all")}onSearchInput(t){this.searchQuery.set(t.target.value)}clearSearch(){this.searchQuery.set("")}refresh(){this.globalTaskService.refresh()}openPreferences(){this.dialog.open(ft,{width:"400px"})}openTokenUsage(){this.router.navigate(["/token-usage"])}openUserConfig(){this.configState.openUserConfigEditor()}openQuickSchedulerDialog(){this.dialog.open(R,{width:"480px",disableClose:!1})}openGlobalSchedulersDialog(){this.dialog.open(be,{width:"600px",maxHeight:"80vh"})}openNewTaskDialog(){this.dialog.open(fe,{width:"500px",disableClose:!1}).afterClosed().subscribe(e=>{e&&(e.navigate?this.router.navigate(["project",e.projectId]):(setTimeout(()=>this.globalTaskService.refresh(),300),setTimeout(()=>this.globalTaskService.refresh(),1500)))})}onStopRequested(t,e){this.globalTaskService.stopThread(e,t)}onDeleteRequested(t,e){this.globalTaskService.deleteThread(e,t)}onStarToggled(t,e){let n=this.allTasks().find(p=>p.id===t);if(!n)return;let i=this.username(),l=!!i&&n.starring.includes(i);this.globalTaskService.toggleStar(e,t,l)}onCloseTaskRequested(t,e){let i=this.allTasks().find(p=>p.id===t)?.worktreeProject??e;this.dialog.open(_t,{width:"420px",data:{title:"Close task",message:`This will stop the agent, delete the thread and remove the worktree project "${i}" from disk. This cannot be undone.`,confirmLabel:"Close task",cancelLabel:"Cancel"}}).afterClosed().subscribe(p=>{p&&this.globalTaskService.closeTask(e,t)})}onMarkDoneRequested(t,e){this.globalTaskService.markTaskDone(e,t)}onMarkActiveRequested(t,e){this.globalTaskService.markTaskActive(e,t)}onPreviewRequested(t,e,n){this.previewThreadId()===t?(this.previewThreadId.set(null),this.previewProjectId.set(null),this.previewTaskName.set(null)):(this.projectState.selectProject(e),this.threadState.selectThread(t),this.previewProjectId.set(e),this.previewThreadId.set(t),this.previewTaskName.set(n))}closePreview(){this.previewThreadId.set(null),this.previewProjectId.set(null),this.previewTaskName.set(null)}navigateToThread(){let t=this.previewThreadId(),e=this.previewProjectId();!t||!e||this.router.navigate(["project",e,"thread",t])}onResizerMousedown(t){t.preventDefault(),this.isDraggingResizer=!0,this.dragStartX=t.clientX,this.dragStartWidth=this.previewPanelWidthPercent(),this.containerWidth=this.layoutContainerRef?.nativeElement.offsetWidth??window.innerWidth}onDocumentMousemove(t){if(!this.isDraggingResizer)return;let n=(this.dragStartX-t.clientX)/this.containerWidth*100,i=Math.min(Dn,Math.max(Pn,this.dragStartWidth+n));this.previewPanelWidthPercent.set(i)}onDocumentMouseup(){this.isDraggingResizer&&(this.isDraggingResizer=!1,this.preferences.setMissionPreviewPanelWidth(this.previewPanelWidthPercent()))}connectGlobalSse(t=5e3){this.disconnectGlobalSse();let e=new EventSource("/api/event-stream");this.globalEventSource=e,e.onmessage=n=>{try{let i=JSON.parse(n.data),l=dt(i);if(!l)return;let p=l.threadId;if(!p)return;l instanceof at||l instanceof lt?this.globalTaskService.applyStatusEvent(p,"invite"):l instanceof st?this.globalTaskService.applyStatusEvent(p,"thinking"):l instanceof ct&&this.globalTaskService.refresh()}catch(i){}},e.onerror=()=>{e.readyState===EventSource.CLOSED&&(this.globalEventSource=null,setTimeout(()=>{this.globalEventSource||this.connectGlobalSse(Math.min(t*2,6e4))},t))}}disconnectGlobalSse(){this.globalEventSource&&(this.globalEventSource.close(),this.globalEventSource=null)}static \u0275fac=function(e){return new(e||a)};static \u0275cmp=D({type:a,selectors:[["app-global-task-control"]],viewQuery:function(e,n){if(e&1&&Ae(pn,5),e&2){let i;Ie(i=Ve())&&(n.layoutContainerRef=i.first)}},hostBindings:function(e,n){e&1&&m("mousemove",function(l){return n.onDocumentMousemove(l)},xe)("mouseup",function(){return n.onDocumentMouseup()},xe)},decls:85,vars:11,consts:[["layoutContainer",""],["schedulerMenu","matMenu"],["controlCenterMenu","matMenu"],[1,"gtc"],[1,"gtc-toolbar"],[1,"gtc-toolbar-left"],[1,"gtc-logo-icon"],[1,"gtc-title"],["appearance","fill","subscriptSizing","dynamic",1,"gtc-search"],["matPrefix",""],["matInput","","type","search","placeholder","Filter tasks\u2026","autocomplete","off",3,"input","keydown.escape","value"],["matSuffix","","mat-icon-button","","aria-label","Clear"],[1,"gtc-toolbar-actions"],["mat-icon-button","","matTooltip","Schedulers","aria-label","Schedulers",3,"matMenuTriggerFor"],["mat-menu-item","",3,"click"],["mat-icon-button","","matTooltip","Control Center","aria-label","Control Center",3,"matMenuTriggerFor"],["mat-menu-item","","href","https://github.com/whoz-oss/coday","target","_blank","rel","noopener noreferrer"],["mat-icon-button","","matTooltip","Refresh all tasks","aria-label","Refresh tasks",3,"click","disabled"],["mat-stroked-button","","routerLink","/projects","aria-label","Manage projects","matTooltip","Manage projects"],[1,"btn-label"],["mat-flat-button","","aria-label","New task","matTooltip","New Task",1,"gtc-new-btn",3,"click"],[1,"gtc-filter-bar"],["aria-label","Filter by project",1,"gtc-project-filters"],["role","tablist","aria-label","Filter by status",1,"gtc-filters"],["role","tab",1,"filter-chip",3,"active"],["role","switch","aria-label","Show starred tasks only",1,"filter-chip","starred-filter",3,"click"],[1,"filter-icon"],[1,"gtc-body"],[1,"gtc-content"],[1,"gtc-loading"],[1,"gtc-empty"],[1,"gtc-grid"],["matSuffix","","mat-icon-button","","aria-label","Clear",3,"click"],[1,"project-chip",3,"click"],[1,"chip-count"],[1,"project-chip",3,"active"],["role","tab",1,"filter-chip",3,"click"],[1,"filter-badge"],["diameter","36"],[1,"empty-icon"],[1,"gtc-group"],[1,"gtc-group-title"],[1,"group-icon"],[1,"group-count"],[3,"task","projectNameOverride","showProject","previewMode","is-previewed"],[3,"stopRequested","deleteRequested","starToggled","closeTaskRequested","markDoneRequested","markActiveRequested","previewRequested","task","projectNameOverride","showProject","previewMode"],["matTooltip","Drag to resize","aria-hidden","true",1,"gtc-resizer",3,"mousedown"],[1,"gtc-preview-pane"],[1,"gtc-preview-header"],[1,"gtc-preview-title"],[1,"gtc-preview-actions"],["matTooltip","Open full view","aria-label","Open thread in full view","type","button",1,"preview-action-btn",3,"click"],["matTooltip","Close panel","aria-label","Close preview panel","type","button",1,"preview-action-btn",3,"click"],[1,"gtc-preview-body","thread-preview-host"],[3,"projectName","threadId"]],template:function(e,n){if(e&1&&(o(0,"div",3,0)(2,"header",4)(3,"div",5)(4,"mat-icon",6),s(5,"hub"),r(),o(6,"h1",7),s(7,"Global Task Control"),r()(),o(8,"mat-form-field",8)(9,"mat-icon",9),s(10,"search"),r(),o(11,"input",10),m("input",function(l){return n.onSearchInput(l)})("keydown.escape",function(){return n.clearSearch()}),r(),v(12,hn,3,0,"button",11),r(),o(13,"div",12)(14,"button",13)(15,"mat-icon"),s(16,"schedule"),r()(),o(17,"mat-menu",null,1)(19,"button",14),m("click",function(){return n.openGlobalSchedulersDialog()}),o(20,"mat-icon"),s(21,"list"),r(),o(22,"span"),s(23,"View schedulers"),r()(),o(24,"button",14),m("click",function(){return n.openQuickSchedulerDialog()}),o(25,"mat-icon"),s(26,"add"),r(),o(27,"span"),s(28,"New scheduler"),r()()(),o(29,"button",15)(30,"mat-icon"),s(31,"hub"),r()(),o(32,"mat-menu",null,2)(34,"button",14),m("click",function(){return n.openPreferences()}),o(35,"mat-icon"),s(36,"tune"),r(),o(37,"span"),s(38,"Preferences"),r()(),o(39,"button",14),m("click",function(){return n.openTokenUsage()}),o(40,"mat-icon"),s(41,"data_usage"),r(),o(42,"span"),s(43,"Token Usage"),r()(),o(44,"button",14),m("click",function(){return n.openUserConfig()}),o(45,"mat-icon"),s(46,"manage_accounts"),r(),o(47,"span"),s(48,"User Configuration"),r()(),T(49,"mat-divider"),o(50,"a",16)(51,"mat-icon"),s(52,"code"),r(),o(53,"span"),s(54,"Contribute on GitHub"),r()()(),o(55,"button",17),m("click",function(){return n.refresh()}),o(56,"mat-icon"),s(57,"refresh"),r()(),o(58,"button",18)(59,"mat-icon"),s(60,"settings"),r(),o(61,"span",19),s(62,"Manage projects"),r()(),o(63,"button",20),m("click",function(){return n.openNewTaskDialog()}),o(64,"mat-icon"),s(65,"rocket_launch"),r(),o(66,"span",19),s(67,"New Task"),r()()()(),o(68,"div",21),v(69,fn,7,3,"nav",22),o(70,"nav",23),y(71,vn,6,6,"button",24,mn),o(73,"button",25),m("click",function(){return n.toggleStarredFilter()}),o(74,"mat-icon",26),s(75,"star"),r(),o(76,"span"),s(77,"Starred"),r()()()(),o(78,"div",27)(79,"main",28),v(80,Cn,4,0,"div",29)(81,xn,5,0,"div",30)(82,Mn,2,0)(83,Tn,3,0,"div",31),r(),v(84,wn,14,5),r()()),e&2){let i=w(18),l=w(33);c(11),_("value",n.searchQuery()),c(),C(n.searchQuery()?12:-1),c(2),_("matMenuTriggerFor",i),c(15),_("matMenuTriggerFor",l),c(26),_("disabled",n.isLoading()),c(14),C(n.projectSummaries().length>1?69:-1),c(2),M(n.filters),c(2),S("active",n.starredOnly()),ke("aria-checked",n.starredOnly()),c(7),C(n.isLoading()?80:n.displayedTasks().length===0?81:n.activeFilter()==="all"&&!n.searchQuery()?82:83),c(4),C(n.previewActive()&&n.previewThreadId()&&n.previewProjectId()?84:-1)}},dependencies:[pt,bt,A,N,E,O,re,se,le,V,I,Ke,Xe,He,Je,Ze,Ye,J,X,et,H,Z,Y,$e],styles:[".glass-panel[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow)}.glass-interactive[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-interactive[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-interactive[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-card[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);border-radius:20px;padding:1.5rem}.glass-button[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);transition:all .3s cubic-bezier(.4,0,.2,1)}.glass-button[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 12px 40px #00000026}.glass-button[_ngcontent-%COMP%]:active{transform:translateY(0)}.glass-button[_ngcontent-%COMP%]{border-radius:12px;padding:.75rem 1.5rem;font-weight:600;cursor:pointer}.glass-button[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed;transform:none}.glass-button[_ngcontent-%COMP%]:disabled:hover{transform:none}.smooth-theme-transition[_ngcontent-%COMP%]{transition:background .3s ease,color .3s ease,border-color .3s ease,box-shadow .3s ease}[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.gtc[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden}.gtc-toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:0 .75rem;height:56px;flex-shrink:0;border-bottom:1px solid var(--color-border, rgba(0, 0, 0, .1));box-sizing:border-box}.gtc-toolbar-left[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;flex-shrink:0}.gtc-logo-icon[_ngcontent-%COMP%]{font-size:1.25rem;width:1.25rem;height:1.25rem;color:var(--color-primary)}.gtc-title[_ngcontent-%COMP%]{margin:0;font-size:1rem;font-weight:600;color:var(--color-text);white-space:nowrap}.gtc-search[_ngcontent-%COMP%]{margin-left:auto;flex:0 1 240px;min-width:80px;--mat-form-field-container-height: 36px;--mat-form-field-container-vertical-padding: 6px;font-size:.875rem;--mdc-filled-text-field-container-color: transparent;--mdc-filled-text-field-hover-container-color: transparent;--mdc-filled-text-field-focus-container-color: transparent;--mdc-filled-text-field-active-indicator-color: transparent;--mdc-filled-text-field-hover-active-indicator-color: transparent;--mdc-filled-text-field-focus-active-indicator-color: transparent;--mdc-filled-text-field-active-indicator-height: 0}.gtc-toolbar-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.375rem;flex-shrink:0}.gtc-new-btn[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-radius:12px;font-weight:600;height:36px;padding:0 1rem}.gtc-new-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:1.1rem;width:1.1rem;height:1.1rem}@media(max-width:600px){.gtc-toolbar[_ngcontent-%COMP%]{flex-wrap:wrap;height:auto;min-height:48px;padding:.5rem .75rem;gap:.375rem}.gtc-title[_ngcontent-%COMP%]{font-size:.875rem}.gtc-search[_ngcontent-%COMP%]{order:3;flex:1 1 100%;min-width:0;margin-left:0}.gtc-toolbar-actions[_ngcontent-%COMP%]{margin-left:auto}.btn-label[_ngcontent-%COMP%]{display:none}.gtc-toolbar-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:not(mat-icon-button):not([mat-icon-button]){--mdc-text-button-container-height: 36px;--mdc-filled-button-container-height: 36px;--mdc-outlined-button-container-height: 36px;min-width:36px;width:36px;height:36px;padding:0;border-radius:50%!important}.gtc-toolbar-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:not(mat-icon-button):not([mat-icon-button]) .mat-mdc-button-touch-target[_ngcontent-%COMP%]{width:36px;height:36px}.gtc-toolbar-actions[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:not(mat-icon-button):not([mat-icon-button]) mat-icon[_ngcontent-%COMP%]{margin:0!important}}.gtc-filter-bar[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.375rem;padding:.5rem .75rem;flex-shrink:0;border-bottom:1px solid var(--color-border, rgba(0, 0, 0, .08))}.gtc-project-filters[_ngcontent-%COMP%]{display:flex;gap:.375rem;flex-wrap:wrap}.project-chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.375rem;padding:.2rem .65rem;border-radius:100px;font-size:.75rem;font-weight:500;color:var(--color-text-secondary);background:transparent;border:1px solid var(--color-border);cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap}.project-chip[_ngcontent-%COMP%] .chip-count[_ngcontent-%COMP%]{background:var(--color-bg-hover);border-radius:100px;padding:0 .3rem;font-size:.68rem;font-weight:700;min-width:16px;text-align:center;line-height:16px}.project-chip.active[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-color:var(--color-primary)}.project-chip.active[_ngcontent-%COMP%] .chip-count[_ngcontent-%COMP%]{background:#ffffff40;color:var(--color-text-inverse)}.project-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--color-bg-hover);color:var(--color-text)}.gtc-filters[_ngcontent-%COMP%]{display:flex;gap:.375rem;flex-wrap:wrap}.filter-chip[_ngcontent-%COMP%]{background:var(--glass-bg);backdrop-filter:var(--glass-backdrop-blur);-webkit-backdrop-filter:var(--glass-backdrop-blur);border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);display:flex;align-items:center;gap:.375rem;padding:.3rem .75rem;border-radius:100px;font-size:.8rem;font-weight:500;color:var(--color-text-secondary);cursor:pointer;border:1px solid var(--color-border);transition:background .15s ease,color .15s ease,border-color .15s ease;white-space:nowrap}.filter-chip[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{font-size:.9rem;width:.9rem;height:.9rem}.filter-chip[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-radius:100px;padding:0 .375rem;font-size:.7rem;font-weight:700;min-width:18px;text-align:center;line-height:18px}.filter-chip.active[_ngcontent-%COMP%]{background:var(--color-primary);color:var(--color-text-inverse);border-color:var(--color-primary)}.filter-chip.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:var(--color-text-inverse)}.filter-chip.active[_ngcontent-%COMP%] .filter-badge[_ngcontent-%COMP%]{background:#ffffff40;color:var(--color-text-inverse)}.filter-chip[_ngcontent-%COMP%]:hover:not(.active){background:var(--color-bg-hover);color:var(--color-text)}.starred-filter.active[_ngcontent-%COMP%]{background:#f5a62326;border-color:#f5a623;color:#f5a623}.starred-filter.active[_ngcontent-%COMP%] .filter-icon[_ngcontent-%COMP%]{color:#f5a623}.gtc-body[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex:1;overflow:hidden;min-height:0}.gtc-content[_ngcontent-%COMP%]{flex:1;overflow-y:auto;padding:1rem 1rem 2rem;min-width:0}.gtc-resizer[_ngcontent-%COMP%]{width:6px;flex-shrink:0;cursor:col-resize;background:transparent;border-left:1px solid var(--color-border);border-right:1px solid var(--color-border);transition:background .15s ease}.gtc-resizer[_ngcontent-%COMP%]:hover, .gtc-resizer[_ngcontent-%COMP%]:active{background:var(--color-primary);opacity:.4}.gtc-preview-pane[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;overflow:hidden;flex-shrink:0;min-width:280px;border-left:1px solid var(--color-border);background:var(--glass-bg)}.gtc-preview-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.625rem .75rem .625rem 1rem;border-bottom:1px solid var(--color-border);flex-shrink:0}.gtc-preview-title[_ngcontent-%COMP%]{font-size:.875rem;font-weight:600;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1}.gtc-preview-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.125rem;flex-shrink:0}.preview-action-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:none;border-radius:6px;background:transparent;cursor:pointer;transition:background .15s ease}.preview-action-btn[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{font-size:18px;width:18px;height:18px;line-height:18px;vertical-align:middle;color:var(--color-text-secondary)}.preview-action-btn[_ngcontent-%COMP%]:hover{background:var(--color-bg-hover)}.preview-action-btn[_ngcontent-%COMP%]:hover mat-icon[_ngcontent-%COMP%]{color:var(--color-text)}.gtc-preview-body[_ngcontent-%COMP%]{flex:1;overflow:hidden;display:flex;flex-direction:column;min-height:0}.gtc-preview-body[_ngcontent-%COMP%] app-thread[_ngcontent-%COMP%]{flex:1;display:flex;flex-direction:column;overflow:hidden;min-height:0} app-task-card.is-previewed .task-card{border-color:var(--color-primary);box-shadow:0 0 0 2px var(--color-primary)}.gtc-group[_ngcontent-%COMP%]{margin-bottom:1.25rem}.gtc-group[_ngcontent-%COMP%]:last-child{margin-bottom:0}.gtc-group-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:.8rem;font-weight:600;color:var(--color-text-secondary);text-transform:uppercase;letter-spacing:.05em}.gtc-group-title[_ngcontent-%COMP%] .group-icon[_ngcontent-%COMP%]{font-size:.95rem;width:.95rem;height:.95rem}.gtc-group-title[_ngcontent-%COMP%] .group-count[_ngcontent-%COMP%]{background:var(--color-bg-hover);border-radius:100px;padding:0 .375rem;font-size:.7rem;font-weight:700;min-width:16px;text-align:center;line-height:16px}.gtc-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1rem}@media(max-width:600px){.gtc-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.gtc-loading[_ngcontent-%COMP%], .gtc-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1rem;padding:3rem;color:var(--color-text-secondary);text-align:center}.gtc-loading[_ngcontent-%COMP%] p[_ngcontent-%COMP%], .gtc-empty[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:.9rem}.empty-icon[_ngcontent-%COMP%]{font-size:2.5rem;width:2.5rem;height:2.5rem;opacity:.3}"],changeDetection:0})};export{St as GlobalTaskControlComponent};
@@ -0,0 +1 @@
1
+ import{V as l,Xc as u,Z as g,ca as m,m as c,t as p}from"./chunk-CHEXA6RY.js";var f=class s{http=m(u);agentsCache=new Map;getAgents(e){let t=this.agentsCache.get(e);return t?c(t):this.http.get(`/api/projects/${e}/agents`).pipe(l(o=>{this.agentsCache.set(e,o)}))}getAgentsAutocomplete(e,t){return this.getAgents(e).pipe(p(o=>{if(!t)return o;let i=t.toLowerCase(),a=r=>{let n=r.name.toLowerCase();return n.startsWith(i)?0:n.includes(i)?1:2};return o.filter(r=>{let n=r.name.toLowerCase(),h=r.description?.toLowerCase()||"";return n.includes(i)||h.includes(i)}).sort((r,n)=>a(r)-a(n))}))}clearCache(e){this.agentsCache.delete(e)}clearAllCache(){this.agentsCache.clear()}static \u0275fac=function(t){return new(t||s)};static \u0275prov=g({token:s,factory:s.\u0275fac,providedIn:"root"})};export{f as a};
@@ -1,4 +1,4 @@
1
- import{a as _n}from"./chunk-EAVXJ7QN.js";import{a as Ue,b as Be,c as xn,e as Mn,f as ce}from"./chunk-UEGZX4MW.js";import{a as wn,b as Tn,c as Sn}from"./chunk-TSYL5EEO.js";import{a as Ke}from"./chunk-DZ2M3NQD.js";import{a as je,b as K,c as ln,d as se,i as mn,j as pn,k as gn,m as un,o as hn,p as fn,r as bn,t as Qe,v as Cn,y as vn,z as Xe}from"./chunk-CRXIMHRG.js";import{a as yn}from"./chunk-GIIRKWUO.js";import{c as Kt}from"./chunk-6XX7GME4.js";import{a as An}from"./chunk-SKBEA6VH.js";import{s as In,w as Dn}from"./chunk-VNO76B3S.js";import{b as dn,h as En,i as On,j as Pn,n as kn}from"./chunk-E6T6QLQT.js";import{a as cn,c as $e}from"./chunk-VMYKE4ZC.js";import{a as R,b as z}from"./chunk-AS2L77JV.js";import{E as Ge,c as We,g as qe,m as Ye}from"./chunk-7OGOI6WM.js";import{b as X}from"./chunk-TASSC2XX.js";import{E as rn,K as an,O as re,Q as sn,R as Ne,S as ae,i as Jt,j as Zt,p as en,s as tn,t as nn,z as on}from"./chunk-G5RWG2GK.js";import{$b as He,B as q,Bb as _,D as De,Db as h,Fb as l,G as Rt,Ga as H,Ha as yt,Ja as zt,Jb as ue,Jc as ze,Ka as c,Kb as Z,Lb as ee,Lc as Xt,Mc as Mt,Pa as Nt,Pc as j,Rb as N,T as F,Tb as p,Ub as w,Vb as he,Wa as S,Wb as Ae,Xa as $t,Xc as G,Ya as jt,Z as k,Za as Ut,Zb as Fe,_ as Ht,_b as Re,_c as Q,a as de,ac as Wt,b as Pe,bc as qt,ca as m,cc as Yt,d as O,dc as Gt,fc as Ee,g as ke,ga as f,gc as Qt,h as B,ha as b,hc as St,i as Ie,jb as oe,la as Vt,lb as g,m as xt,mb as u,mc as Ve,n as At,oa as M,pa as Lt,pb as V,qb as L,rb as C,sb as a,t as ie,ta as W,tb as s,u as Ft,ub as x,va as Y,vb as wt,wb as Tt,xb as Bt,ya as ge,yc as Le}from"./chunk-CHEXA6RY.js";var Je=class i{sanitizer=m(Q);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=Ut({name:"highlight",type:i,pure:!0})};var fe=class i{http=m(G);projectState=m(X);threadState=m(K);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,de({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,de({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var bi=["messageInput"],Ci=["fileInput"],vi=(i,e)=>e.name;function _i(i,e){i&1&&(a(0,"div",3),x(1,"span",8),p(2," Recording... Click mic to stop "),s())}function xi(i,e){i&1&&(a(0,"div",3),x(1,"span",9),p(2," Transcribing... "),s())}function yi(i,e){if(i&1&&(a(0,"span",14),p(1),s()),i&2){let t=l().$implicit,n=l(2);c(),w(" "+(n.getParameterFormat(t)||""))}}function wi(i,e){if(i&1){let t=_();a(0,"div",11),h("click",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=f(t).$index,r=l(2);return b(r.selectedAutocompleteIndex=o)}),a(1,"div",12),x(2,"span",13),Ee(3,"highlight"),g(4,yi,2,1,"span",14),s(),x(5,"div",15),Ee(6,"highlight"),s()}if(i&2){let t=e.$implicit,n=e.$index,o=l(2);N("selected",n===o.selectedAutocompleteIndex),oe("aria-selected",n===o.selectedAutocompleteIndex),c(2),C("innerHTML",St(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),H),c(2),u(o.hasParameterFormat(t)?4:-1),c(),C("innerHTML",St(6,9,t.description,o.getAutocompleteQuery()),H)}}function Ti(i,e){if(i&1&&(a(0,"div",4),V(1,wi,7,12,"div",10,vi),s()),i&2){let t=l();c(),L(t.autocompleteItems)}}function Si(i,e){if(i&1){let t=_();a(0,"ds-icon-button",18),h("action",function(){f(t);let o=l(2);return b(o.onStopClick())}),s()}}function Mi(i,e){if(i&1){let t=_();a(0,"ds-icon-button",19),h("action",function(){f(t);let o=l(2);return b(o.sendMessage())}),s()}if(i&2){let t=l(2);N("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),C("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim())}}function Ei(i,e){if(i&1){let t=_();a(0,"ds-icon-button",21),h("action",function(){f(t);let o=l(3);return b(o.triggerFileUpload())}),s(),a(1,"input",22,1),h("change",function(o){f(t);let r=l(3);return b(r.onFileInputChange(o))}),s()}if(i&2){let t=l(3);C("disabled",t.isDisabled)}}function Oi(i,e){if(i&1){let t=_();g(0,Ei,3,1),a(1,"ds-icon-button",20),h("action",function(){f(t);let o=l(2);return b(o.toggleRecording())}),s()}if(i&2){let t=l(2);u(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),c(),N("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),C("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording")}}function Pi(i,e){if(i&1&&(a(0,"div",7),g(1,Si,1,0,"ds-icon-button",16),g(2,Mi,1,6,"ds-icon-button",17),g(3,Oi,2,6),s()),i&2){let t=l();c(),u(t.isThinking?1:-1),c(),u((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),c(),u(t.isThinking?-1:3)}}var Ze=class i{isDisabled=!1;showWelcome=!1;isThinking=!1;isStarting=!1;isSessionInitializing=!1;isStopping=!1;filesPasted=new M;messageSubmitted=new M;voiceMessageReady=new M;voiceRecordingToggled=new M;heightChanged=new M;stopRequested=new M;textareaFocused=new M;messageInput;fileInput;message="";isRecording=!1;isTranscribing=!1;isFocused=!1;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=!1;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=!1;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=!1;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=m(se);codayService=m(ce);agentApiService=m(_n);promptApiService=m(An);projectStateService=m(X);audioApiService=m(fe);threadStateService=m(K);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore()}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200)})}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=!1,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"))}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation()}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case"ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case"ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case"Tab":case"Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case"Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(!0)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(!0)))}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete()}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o)}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click()}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value=""}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete()}sendMessage(e=!1){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0))}onStopClick(){this.isStopping=!0,this.stopRequested.emit()}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording()}startWhisperRecording(){return O(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data)},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio()},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording")}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording")}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=!0;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=!1;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=!1,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=!1,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50))},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=!1,this.fallbackToTranscription(o,t,d)}})}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=!1,v.text&&this.appendToTextarea(v.text+" ")},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=!1}})},n.readAsDataURL(e)}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=!1,o.text&&this.appendToTextarea(o.text+" ")},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=!1}})}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=!0,this.recognition.interimResults=!0,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0)}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported")}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=!0,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r)}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=!1,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully")},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected")},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended")}}startRecording(){return O(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording")}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(this.isRecording)}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks()}catch(e){console.error("[SPEECH] Failed to stop recording:",e)}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e)}}improveTranscriptPunctuation(e){let t=e;return/[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n)}setTimeout(()=>this.adjustTextareaHeight(),0)}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
1
+ import{a as _n}from"./chunk-SFQE4GQ6.js";import{a as Ue,b as Be,c as xn,e as Mn,f as ce}from"./chunk-UEGZX4MW.js";import{a as wn,b as Tn,c as Sn}from"./chunk-TSYL5EEO.js";import{a as Ke}from"./chunk-DZ2M3NQD.js";import{a as je,b as K,c as ln,d as se,i as mn,j as pn,k as gn,m as un,o as hn,p as fn,r as bn,t as Qe,v as Cn,y as vn,z as Xe}from"./chunk-CRXIMHRG.js";import{a as yn}from"./chunk-GIIRKWUO.js";import{c as Kt}from"./chunk-6XX7GME4.js";import{a as An}from"./chunk-SKBEA6VH.js";import{s as In,w as Dn}from"./chunk-VNO76B3S.js";import{b as dn,h as En,i as On,j as Pn,n as kn}from"./chunk-E6T6QLQT.js";import{a as cn,c as $e}from"./chunk-VMYKE4ZC.js";import{a as R,b as z}from"./chunk-AS2L77JV.js";import{E as Ge,c as We,g as qe,m as Ye}from"./chunk-7OGOI6WM.js";import{b as X}from"./chunk-TASSC2XX.js";import{E as rn,K as an,O as re,Q as sn,R as Ne,S as ae,i as Jt,j as Zt,p as en,s as tn,t as nn,z as on}from"./chunk-G5RWG2GK.js";import{$b as He,B as q,Bb as _,D as De,Db as h,Fb as l,G as Rt,Ga as H,Ha as yt,Ja as zt,Jb as ue,Jc as ze,Ka as c,Kb as Z,Lb as ee,Lc as Xt,Mc as Mt,Pa as Nt,Pc as j,Rb as N,T as F,Tb as p,Ub as w,Vb as he,Wa as S,Wb as Ae,Xa as $t,Xc as G,Ya as jt,Z as k,Za as Ut,Zb as Fe,_ as Ht,_b as Re,_c as Q,a as de,ac as Wt,b as Pe,bc as qt,ca as m,cc as Yt,d as O,dc as Gt,fc as Ee,g as ke,ga as f,gc as Qt,h as B,ha as b,hc as St,i as Ie,jb as oe,la as Vt,lb as g,m as xt,mb as u,mc as Ve,n as At,oa as M,pa as Lt,pb as V,qb as L,rb as C,sb as a,t as ie,ta as W,tb as s,u as Ft,ub as x,va as Y,vb as wt,wb as Tt,xb as Bt,ya as ge,yc as Le}from"./chunk-CHEXA6RY.js";var Je=class i{sanitizer=m(Q);transform(e,t){if(!t||!e)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`(${n})`,"gi"),r=e.replace(o,"<strong>$1</strong>");return this.sanitizer.bypassSecurityTrustHtml(r)}static \u0275fac=function(t){return new(t||i)};static \u0275pipe=Ut({name:"highlight",type:i,pure:!0})};var fe=class i{http=m(G);projectState=m(X);threadState=m(K);transcribeAudio(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow();return this.http.post(`/api/projects/${o}/transcribe`,de({audio:e,mimeType:t},n?{language:n}:{}))}sendVoiceMessage(e,t,n){let o=this.projectState.getSelectedProjectIdOrThrow(),r=this.threadState.getSelectedThreadIdOrThrow();return this.http.post(`/api/projects/${o}/threads/${r}/voice-message`,de({audio:e,mimeType:t},n?{language:n}:{}))}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var bi=["messageInput"],Ci=["fileInput"],vi=(i,e)=>e.name;function _i(i,e){i&1&&(a(0,"div",3),x(1,"span",8),p(2," Recording... Click mic to stop "),s())}function xi(i,e){i&1&&(a(0,"div",3),x(1,"span",9),p(2," Transcribing... "),s())}function yi(i,e){if(i&1&&(a(0,"span",14),p(1),s()),i&2){let t=l().$implicit,n=l(2);c(),w(" "+(n.getParameterFormat(t)||""))}}function wi(i,e){if(i&1){let t=_();a(0,"div",11),h("click",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("keydown.enter",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("keydown.space",function(){let o=f(t).$index,r=l(2);return b(r.selectAutocompleteItemByClick(o))})("mouseenter",function(){let o=f(t).$index,r=l(2);return b(r.selectedAutocompleteIndex=o)}),a(1,"div",12),x(2,"span",13),Ee(3,"highlight"),g(4,yi,2,1,"span",14),s(),x(5,"div",15),Ee(6,"highlight"),s()}if(i&2){let t=e.$implicit,n=e.$index,o=l(2);N("selected",n===o.selectedAutocompleteIndex),oe("aria-selected",n===o.selectedAutocompleteIndex),c(2),C("innerHTML",St(3,6,o.autocompleteTrigger+t.name,o.getAutocompleteQuery()),H),c(2),u(o.hasParameterFormat(t)?4:-1),c(),C("innerHTML",St(6,9,t.description,o.getAutocompleteQuery()),H)}}function Ti(i,e){if(i&1&&(a(0,"div",4),V(1,wi,7,12,"div",10,vi),s()),i&2){let t=l();c(),L(t.autocompleteItems)}}function Si(i,e){if(i&1){let t=_();a(0,"ds-icon-button",18),h("action",function(){f(t);let o=l(2);return b(o.onStopClick())}),s()}}function Mi(i,e){if(i&1){let t=_();a(0,"ds-icon-button",19),h("action",function(){f(t);let o=l(2);return b(o.sendMessage())}),s()}if(i&2){let t=l(2);N("hidden",t.isDisabled||!t.message.trim())("active",!!t.message.trim()&&!t.isDisabled),C("title",t.getSendButtonTooltip())("disabled",t.isDisabled||!t.message.trim())}}function Ei(i,e){if(i&1){let t=_();a(0,"ds-icon-button",21),h("action",function(){f(t);let o=l(3);return b(o.triggerFileUpload())}),s(),a(1,"input",22,1),h("change",function(o){f(t);let r=l(3);return b(r.onFileInputChange(o))}),s()}if(i&2){let t=l(3);C("disabled",t.isDisabled)}}function Oi(i,e){if(i&1){let t=_();g(0,Ei,3,1),a(1,"ds-icon-button",20),h("action",function(){f(t);let o=l(2);return b(o.toggleRecording())}),s()}if(i&2){let t=l(2);u(!t.showWelcome&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?0:-1),c(),N("hidden",t.message.trim()&&!t.isRecording&&!t.isTranscribing),C("variant",t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing)?"danger":"default")("disabled",t.isVoiceMessageMode&&t.isTranscribing)("title",t.isRecording?"Click to stop recording":t.isTranscribing?"Uploading...":"Click to start recording")}}function Pi(i,e){if(i&1&&(a(0,"div",7),g(1,Si,1,0,"ds-icon-button",16),g(2,Mi,1,6,"ds-icon-button",17),g(3,Oi,2,6),s()),i&2){let t=l();c(),u(t.isThinking?1:-1),c(),u((!t.isThinking||t.message.trim())&&!(t.isVoiceMessageMode&&(t.isRecording||t.isTranscribing))?2:-1),c(),u(t.isThinking?-1:3)}}var Ze=class i{isDisabled=!1;showWelcome=!1;isThinking=!1;isStarting=!1;isSessionInitializing=!1;isStopping=!1;filesPasted=new M;messageSubmitted=new M;voiceMessageReady=new M;voiceRecordingToggled=new M;heightChanged=new M;stopRequested=new M;textareaFocused=new M;messageInput;fileInput;message="";isRecording=!1;isTranscribing=!1;isFocused=!1;recognition=null;mediaRecorder=null;audioChunks=[];voiceInputMode="browser";get isVoiceMessageMode(){return this.voiceInputMode==="voice-message"}sessionHadTranscript=!1;pendingLineBreaksTimeout=null;lastProcessedResultIndex=0;useEnterToSend=!1;currentInvite="";subscriptions=[];thinkingPhrases=["Processing request...","Thinking...","Working on it..."];currentThinkingPhrase="Processing request...";thinkingPhraseIndex=0;thinkingInterval=null;autocompleteVisible=!1;autocompleteTrigger=null;autocompleteItems=[];selectedAutocompleteIndex=0;preferencesService=m(se);codayService=m(ce);agentApiService=m(_n);promptApiService=m(An);projectStateService=m(X);audioApiService=m(fe);threadStateService=m(K);ngOnInit(){this.initializeVoiceInput(),this.useEnterToSend=this.preferencesService.getEnterToSend(),this.subscriptions.push(this.preferencesService.voiceLanguage$.subscribe(()=>this.updateRecognitionLanguage())),this.subscriptions.push(this.preferencesService.voiceInputMode$.subscribe(e=>{this.voiceInputMode=e})),this.subscriptions.push(this.preferencesService.enterToSend$.subscribe(e=>{this.useEnterToSend=e})),this.subscribeToInviteEvents(),this.subscribeToMessageRestore()}ngAfterViewInit(){this.adjustTextareaHeight(),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),200)})}ngOnChanges(e){e.isThinking&&(e.isThinking.currentValue?this.startThinkingAnimation():(this.stopThinkingAnimation(),this.isStopping=!1,e.isThinking.previousValue&&(console.log("[CHAT-TEXTAREA] Thinking ended, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})))),e.isSessionInitializing&&!e.isSessionInitializing.currentValue&&e.isSessionInitializing.previousValue&&(console.log("[CHAT-TEXTAREA] Session initialization completed, scheduling focus"),requestAnimationFrame(()=>{setTimeout(()=>this.focusTextarea(),100)})),e.isStarting&&!e.isStarting.currentValue&&e.isStarting.previousValue&&this.isThinking&&(this.thinkingPhraseIndex===0?(console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index 0 - restarting animation"),this.stopThinkingAnimation(),this.startThinkingAnimation()):console.log("[CHAT-TEXTAREA] Transitioning from Starting to Thinking at index",this.thinkingPhraseIndex,"- continuing without restart"))}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe()),this.subscriptions=[],this.clearPendingLineBreaks(),this.stopThinkingAnimation()}onKeyDown(e){if(this.autocompleteVisible)switch(e.key){case"ArrowDown":e.preventDefault(),this.selectedAutocompleteIndex=Math.min(this.selectedAutocompleteIndex+1,this.autocompleteItems.length-1),this.scrollSelectedItemIntoView();return;case"ArrowUp":e.preventDefault(),this.selectedAutocompleteIndex=Math.max(this.selectedAutocompleteIndex-1,0),this.scrollSelectedItemIntoView();return;case"Tab":case"Enter":if(!this.message.includes(" ")){e.preventDefault(),this.selectAutocompleteItem();return}break;case"Escape":e.preventDefault(),this.hideAutocomplete();return}e.key==="Enter"&&(this.useEnterToSend?!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),this.sendMessage(!0)):(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey)&&!e.shiftKey&&(e.preventDefault(),this.sendMessage(!0)))}onInput(){this.adjustTextareaHeight(),this.checkForAutocomplete()}onPaste(e){let t=e.clipboardData?.items;if(!t)return;let n=Array.from(t).filter(r=>r.kind==="file");if(!n.length)return;e.preventDefault();let o=n.reduce((r,d)=>{let v=d.getAsFile();return v?[...r,v]:r},[]);o.length&&this.filesPasted.emit(o)}triggerFileUpload(){console.log("[CHAT-TEXTAREA] Triggering file upload"),this.fileInput?.nativeElement?.click()}onFileInputChange(e){let t=e.target,n=t.files;if(!n||n.length===0){console.log("[CHAT-TEXTAREA] No files selected");return}console.log("[CHAT-TEXTAREA] Files selected:",n.length);let o=Array.from(n);this.filesPasted.emit(o),t.value=""}onDocumentClick(e){if(!this.autocompleteVisible)return;let t=e.target,n=document.querySelector(".autocomplete-popup"),o=this.messageInput?.nativeElement;n&&!n.contains(t)&&o&&!o.contains(t)&&this.hideAutocomplete()}sendMessage(e=!1){let t=this.message.trim();!this.isDisabled&&(e||t)&&(this.isRecording&&this.recognition&&(this.clearPendingLineBreaks(),this.recognition.stop()),this.messageSubmitted.emit(t),this.message="",setTimeout(()=>this.adjustTextareaHeight(),0))}onStopClick(){this.isStopping=!0,this.stopRequested.emit()}toggleRecording(){this.isRecording?this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.stopWhisperRecording():this.stopRecording():this.voiceInputMode==="whisper"||this.voiceInputMode==="voice-message"?this.startWhisperRecording():this.startRecording()}startWhisperRecording(){return O(this,null,function*(){if(!this.isRecording)try{let e=yield navigator.mediaDevices.getUserMedia({audio:!0});this.audioChunks=[],this.mediaRecorder=new MediaRecorder(e),this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data)},this.mediaRecorder.onstop=()=>{e.getTracks().forEach(t=>t.stop()),this.processWhisperAudio()},this.mediaRecorder.onerror=t=>{console.error("[WHISPER] MediaRecorder error:",t),e.getTracks().forEach(n=>n.stop()),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)},this.mediaRecorder.start(),this.isRecording=!0,this.voiceRecordingToggled.emit(!0),console.log("[WHISPER] Started recording")}catch(e){console.error("[WHISPER] Failed to start recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)}})}stopWhisperRecording(){if(!(!this.mediaRecorder||!this.isRecording))try{this.mediaRecorder.stop(),this.isRecording=!1,this.voiceRecordingToggled.emit(!1),console.log("[WHISPER] Stopped recording")}catch(e){console.error("[WHISPER] Failed to stop recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(!1)}}processWhisperAudio(){if(this.audioChunks.length===0)return;let e=new Blob(this.audioChunks,{type:this.mediaRecorder?.mimeType||"audio/webm"}),t=e.type.split(";")[0]||"audio/webm";this.audioChunks=[],this.isTranscribing=!0;let n=new FileReader;n.onloadend=()=>{let o=n.result.split(",")[1];if(!o){console.error("[WHISPER] Failed to read audio as base64"),this.isTranscribing=!1;return}let d=this.preferencesService.getVoiceLanguage().split("-")[0];if(this.voiceInputMode==="voice-message"){if(!this.threadStateService.getSelectedThreadId()){console.log("[WHISPER] No thread selected \u2014 emitting voiceMessageReady for thread creation"),this.isTranscribing=!1,this.voiceMessageReady.emit({base64:o,mimeType:t,language:d});return}this.audioApiService.sendVoiceMessage(o,t,d).subscribe({next:v=>{this.isTranscribing=!1,console.log("[WHISPER] Voice message sent, transcription:",v.transcription?.substring(0,50))},error:v=>{console.error("[WHISPER] Voice message error:",v),this.isTranscribing=!1,this.fallbackToTranscription(o,t,d)}})}else this.audioApiService.transcribeAudio(o,t,d).subscribe({next:v=>{this.isTranscribing=!1,v.text&&this.appendToTextarea(v.text+" ")},error:v=>{console.error("[WHISPER] Transcription error:",v),this.isTranscribing=!1}})},n.readAsDataURL(e)}fallbackToTranscription(e,t,n){this.audioApiService.transcribeAudio(e,t,n).subscribe({next:o=>{this.isTranscribing=!1,o.text&&this.appendToTextarea(o.text+" ")},error:o=>{console.error("[WHISPER] Fallback transcription also failed:",o),this.isTranscribing=!1}})}initializeVoiceInput(){let e=window.SpeechRecognition??window.webkitSpeechRecognition;if(console.log("[SPEECH] speechRecognition",e),!e){console.warn("[SPEECH] Speech Recognition API not available");return}this.recognition=new e,this.recognition.continuous=!0,this.recognition.interimResults=!0,this.recognition.maxAlternatives=1,this.recognition.lang=this.getSelectedLanguage();try{"grammars"in this.recognition&&(this.recognition.serviceURI=void 0)}catch(t){console.log("[SPEECH] Advanced speech recognition parameters not supported")}this.recognition.onresult=t=>{let n="",o=Math.max(t.resultIndex,this.lastProcessedResultIndex);for(let r=o;r<t.results.length;r++)t.results[r].isFinal&&(n+=t.results[r][0].transcript,this.lastProcessedResultIndex=r+1);if(n){let r=this.improveTranscriptPunctuation(n.trim());this.sessionHadTranscript=!0,console.log("[SPEECH] onresult ending, appending to textarea",this.isRecording),this.appendToTextarea(r)}},this.recognition.onend=()=>{console.log("[SPEECH] Recognition ended. Was recording:",this.isRecording),this.isRecording=!1,this.lastProcessedResultIndex=0,this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onerror=t=>{console.error("[SPEECH] Speech recognition error:",t.error),console.log("[SPEECH] Error details:",{error:t.error,message:t.message,timeStamp:t.timeStamp}),this.isRecording=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording)},this.recognition.onstart=()=>{console.log("[SPEECH] Recognition started successfully")},this.recognition.onspeechstart=()=>{console.log("[SPEECH] Speech detected")},this.recognition.onspeechend=()=>{console.log("[SPEECH] Speech ended")}}startRecording(){return O(this,null,function*(){if(!(!this.recognition||this.isRecording))try{this.isRecording=!0,this.sessionHadTranscript=!1,this.lastProcessedResultIndex=0,this.clearPendingLineBreaks(),this.voiceRecordingToggled.emit(this.isRecording),this.recognition.start(),console.log("[SPEECH] Started recording")}catch(e){console.error("[SPEECH] Failed to start recording:",e),this.isRecording=!1,this.voiceRecordingToggled.emit(this.isRecording)}})}stopRecording(){if(!this.recognition||!this.isRecording){console.log("[SPEECH] stopRecording not recording");return}try{console.log("[SPEECH] stopRecording recognition stop"),this.recognition.stop(),this.schedulePendingLineBreaks()}catch(e){console.error("[SPEECH] Failed to stop recording:",e)}}getSelectedLanguage(){return this.preferencesService.getVoiceLanguage()}updateRecognitionLanguage(){if(this.recognition){let e=this.getSelectedLanguage();this.recognition.lang=e,console.log("[SPEECH] Language changed to:",e)}}improveTranscriptPunctuation(e){let t=e;return/[.!?]$/.test(t.trim())||(t=t.trim()+"."),t=t.charAt(0).toUpperCase()+t.slice(1),t=t.replace(/\s+/g," "),t=t+" ",t}appendToTextarea(e){let t=this.message;if(this.message=t?`${t}${e}`:e,this.messageInput?.nativeElement){this.messageInput.nativeElement.focus();let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n)}setTimeout(()=>this.adjustTextareaHeight(),0)}schedulePendingLineBreaks(){this.clearPendingLineBreaks(),this.pendingLineBreaksTimeout=window.setTimeout(()=>{this.sessionHadTranscript&&(console.log("[SPEECH] Adding line breaks after transcript session"),this.appendToTextarea(`
2
2
 
3
3
  `),this.sessionHadTranscript=!1),this.pendingLineBreaksTimeout=null},500)}clearPendingLineBreaks(){this.pendingLineBreaksTimeout&&(clearTimeout(this.pendingLineBreaksTimeout),this.pendingLineBreaksTimeout=null)}adjustTextareaHeight(){let e=this.messageInput?.nativeElement;if(!e)return;let t=e.parentElement?.offsetHeight??e.offsetHeight+32;this.heightChanged.emit(t)}getSendButtonShortcut(){return this.useEnterToSend?"Enter":navigator.platform.toLowerCase().includes("mac")?"\u2318+Enter":"Ctrl+Enter"}getSendButtonTooltip(){return this.useEnterToSend?"Send message (Enter) - Shift+Enter for new line":`Send message (${navigator.platform.toLowerCase().includes("mac")?"Cmd+Enter":"Ctrl+Enter"}) - Enter for new line`}getPlaceholder(){return this.isSessionInitializing?"Initializing session...":this.isThinking?this.isStopping?"Stopping...":this.isStarting?"Processing request...":this.currentThinkingPhrase:this.isVoiceMessageMode&&this.isTranscribing?"Uploading...":this.isVoiceMessageMode&&this.isRecording?"Listening...":this.showWelcome?"How can I help you today?":"Type '@' for agents, '/' for commands, or just your message..."}startThinkingAnimation(){this.thinkingPhraseIndex=0,this.currentThinkingPhrase=this.thinkingPhrases[0]??"Thinking...",this.thinkingInterval=window.setInterval(()=>{this.thinkingPhraseIndex<this.thinkingPhrases.length-1&&(this.thinkingPhraseIndex++,this.currentThinkingPhrase=this.thinkingPhrases[this.thinkingPhraseIndex]??"Thinking...")},2e3)}stopThinkingAnimation(){this.thinkingInterval&&(clearInterval(this.thinkingInterval),this.thinkingInterval=null),this.thinkingPhraseIndex=0,this.currentThinkingPhrase="Thinking..."}subscribeToInviteEvents(){this.subscriptions.push(this.codayService.currentInviteEvent$.subscribe(e=>{e?this.handleInviteEvent(e.invite,e.defaultValue):this.currentInvite=""}))}handleInviteEvent(e,t){this.currentInvite=e,t&&(this.message=t,setTimeout(()=>this.adjustTextareaHeight(),0)),setTimeout(()=>{this.messageInput?.nativeElement&&this.messageInput.nativeElement.focus()},50)}subscribeToMessageRestore(){this.subscriptions.push(this.codayService.messageToRestore$.subscribe(e=>{e.trim()&&(console.log("[CHAT-TEXTAREA] Restoring message content:",e.substring(0,50)+"..."),this.restoreMessageContent(e))}))}restoreMessageContent(e){this.message=e,this.messageInput?.nativeElement&&(this.messageInput.nativeElement.focus(),setTimeout(()=>{let t=this.messageInput.nativeElement,n=this.message.length;t.setSelectionRange(n,n)},0)),setTimeout(()=>this.adjustTextareaHeight(),10)}focusTextarea(){let e=this.messageInput?.nativeElement;console.log("[CHAT-TEXTAREA] focusTextarea called",{hasElement:!!e,isDisabled:this.isDisabled,isThinking:this.isThinking,elementDisabled:e?.disabled,isSessionInitializing:this.isSessionInitializing}),e&&!e.disabled?(e.focus(),console.log("[CHAT-TEXTAREA] Textarea focused successfully")):console.log("[CHAT-TEXTAREA] Focus blocked - element disabled or not available")}checkForAutocomplete(){let e=this.message;if(e.startsWith("@")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showAgentAutocomplete(t);return}if(e.startsWith("/")){let t=e.substring(1);if(t.includes(" ")){this.hideAutocomplete();return}this.showPromptAutocomplete(t);return}this.hideAutocomplete()}showAgentAutocomplete(e){this.autocompleteTrigger="@";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.agentApiService.getAgentsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0},error:n=>{console.error("[AUTOCOMPLETE] Error loading agents:",n),this.hideAutocomplete()}})}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load agents"),this.hideAutocomplete()}}showPromptAutocomplete(e){this.autocompleteTrigger="/";try{let t=this.projectStateService.getSelectedProjectIdOrThrow();this.promptApiService.getPromptsAutocomplete(t,e).subscribe({next:n=>{this.autocompleteItems=n,this.autocompleteVisible=n.length>0,this.selectedAutocompleteIndex=0},error:n=>{console.error("[AUTOCOMPLETE] Error loading prompts:",n),this.hideAutocomplete()}})}catch(t){console.warn("[AUTOCOMPLETE] No project selected, cannot load prompts"),this.hideAutocomplete()}}hideAutocomplete(){this.autocompleteVisible=!1,this.autocompleteItems=[],this.selectedAutocompleteIndex=0}selectAutocompleteItem(){let e=this.autocompleteItems[this.selectedAutocompleteIndex];if(!e)return;let t=null;if(this.autocompleteTrigger==="/"){let n=e,o=n.parameterFormat;if(console.log(n),o===void 0)this.message=`/${e.name}`;else if(o==="")this.message=`/${e.name} `;else{this.message=`/${e.name} ${o}`;let r=this.message.indexOf('=""');r!==-1&&(t=r+2)}}else this.message=`@${e.name} `;this.hideAutocomplete(),setTimeout(()=>{if(this.messageInput?.nativeElement)if(this.messageInput.nativeElement.focus(),t!==null)this.messageInput.nativeElement.setSelectionRange(t,t);else{let n=this.message.length;this.messageInput.nativeElement.setSelectionRange(n,n)}},0)}selectAutocompleteItemByClick(e){this.selectedAutocompleteIndex=e,this.selectAutocompleteItem()}getAutocompleteQuery(){return this.message.substring(1).split(" ")[0]??""}getParameterFormat(e){return e.parameterFormat}hasParameterFormat(e){return this.autocompleteTrigger==="/"&&e.parameterFormat!==void 0}scrollSelectedItemIntoView(){setTimeout(()=>{let e=document.querySelector(".autocomplete-popup");if(!e)return;let t=e.querySelector(".autocomplete-item.selected");t&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},0)}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=S({type:i,selectors:[["app-chat-textarea"]],viewQuery:function(t,n){if(t&1&&ue(bi,7)(Ci,5),t&2){let o;Z(o=ee())&&(n.messageInput=o.first),Z(o=ee())&&(n.fileInput=o.first)}},hostBindings:function(t,n){t&1&&h("paste",function(r){return n.onPaste(r)})("click",function(r){return n.onDocumentClick(r)},zt)},inputs:{isDisabled:"isDisabled",showWelcome:"showWelcome",isThinking:"isThinking",isStarting:"isStarting",isSessionInitializing:"isSessionInitializing"},outputs:{filesPasted:"filesPasted",messageSubmitted:"messageSubmitted",voiceMessageReady:"voiceMessageReady",voiceRecordingToggled:"voiceRecordingToggled",heightChanged:"heightChanged",stopRequested:"stopRequested",textareaFocused:"textareaFocused"},features:[Y],decls:8,vars:15,consts:[["messageInput",""],["fileInput",""],[1,"chat-input-container"],[1,"recording-indicator"],[1,"autocomplete-popup"],[1,"input-row","grouped-input"],[1,"message-input",3,"ngModelChange","keydown","input","focus","blur","ngModel","placeholder","disabled"],[1,"actions"],[1,"recording-dot"],[1,"transcribing-dot"],["role","option","tabindex","0",1,"autocomplete-item",3,"selected"],["role","option","tabindex","0",1,"autocomplete-item",3,"click","keydown.enter","keydown.space","mouseenter"],[1,"item-name"],[3,"innerHTML"],[1,"parameter-format"],[1,"item-description",3,"innerHTML"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn"],["icon","send","variant","primary",1,"send-btn",3,"title","disabled","hidden","active"],["icon","stop","variant","danger","title","Stop generation",1,"action-btn",3,"action"],["icon","send","variant","primary",1,"send-btn",3,"action","title","disabled"],["icon","mic",1,"voice-btn",3,"action","variant","disabled","title"],["icon","attach_file","variant","default","title","Upload files (images or documents)",1,"upload-btn",3,"action","disabled"],["type","file","multiple","","accept","image/*,application/pdf,.pdf,.doc,.docx,.txt,.md,.json,.yaml,.yml,.csv,.xml,.html",2,"display","none",3,"change"]],template:function(t,n){if(t&1){let o=_();a(0,"div",2),g(1,_i,3,0,"div",3),g(2,xi,3,0,"div",3),g(3,Ti,3,0,"div",4),a(4,"div",5)(5,"textarea",6,0),He("ngModelChange",function(d){return f(o),Re(n.message,d)||(n.message=d),b(d)}),h("keydown",function(d){return n.onKeyDown(d)})("input",function(){return n.onInput()})("focus",function(){return f(o),n.isFocused=!0,b(n.textareaFocused.emit())})("blur",function(){return n.isFocused=!1}),s(),g(7,Pi,4,3,"div",7),s()()}t&2&&(c(),u(!n.isVoiceMessageMode&&n.isRecording?1:-1),c(),u(!n.isVoiceMessageMode&&n.isTranscribing?2:-1),c(),u(n.autocompleteVisible?3:-1),c(),N("focused",n.isFocused)("welcome-mode",n.showWelcome)("is-thinking",n.isThinking)("is-listening",n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),c(),Fe("ngModel",n.message),C("placeholder",n.getPlaceholder())("disabled",n.isDisabled||n.isVoiceMessageMode&&(n.isRecording||n.isTranscribing)),c(2),u(n.isSessionInitializing?-1:7))},dependencies:[Ge,We,qe,Ye,In,Je],styles:['@keyframes _ngcontent-%COMP%_gradientBorderShift{0%{background-position:0 0}50%{background-position:100% 0}to{background-position:0 0}}.chat-input-container[_ngcontent-%COMP%]{flex-shrink:0;width:100%;position:relative}.thinking-progress[_ngcontent-%COMP%]{position:absolute;top:0;left:0;right:0;height:3px;z-index:1}.thinking-progress[_ngcontent-%COMP%] .mdc-linear-progress__bar-inner{border-top-width:3px}.input-row.grouped-input[_ngcontent-%COMP%]{display:flex;align-items:stretch;background:var(--glass-bg);border-radius:16px;padding:0 .15rem 0 1.25rem;position:relative;transition:border-color .2s,box-shadow .2s,background .3s}.input-row[_ngcontent-%COMP%]{position:relative;background:var(--glass-bg, #1e1e1e)!important;background-clip:padding-box}.input-row[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:-2px;border-radius:inherit;background-size:200% 100%;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;padding:1px;pointer-events:none;z-index:-1;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-error, #ef4444) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-error, #ef4444) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 2s ease-in-out infinite}.input-row.is-listening[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-listening[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.is-thinking[_ngcontent-%COMP%]:before{inset:0;-webkit-mask:none;mask:none;padding:0;opacity:.15;z-index:0;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 100%);background-size:200% 100%;animation:_ngcontent-%COMP%_gradientBorderShift 3s ease-in-out infinite}.input-row.is-thinking[_ngcontent-%COMP%] .message-input[_ngcontent-%COMP%], .input-row.is-thinking[_ngcontent-%COMP%] .action-btn[_ngcontent-%COMP%]{position:relative;z-index:1}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking):before{background:var(--color-primary);animation:none}.input-row.grouped-input.focused[_ngcontent-%COMP%]:not(.is-thinking){box-shadow:0 0 0 4px #007aff1a}.message-input[_ngcontent-%COMP%]{flex:1;border:none;outline:none;background:transparent!important;box-shadow:none;font-size:1rem;padding:1rem 0;color:var(--color-text);resize:none;field-sizing:content;min-height:36px;max-height:70vh;overflow-y:auto;font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,system-ui,sans-serif;line-height:1.5}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.message-input[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.message-input[_ngcontent-%COMP%]:focus{outline:none;border:none;box-shadow:none}.message-input[_ngcontent-%COMP%]:disabled{background-color:var(--color-bg-secondary);color:var(--color-text-secondary);cursor:not-allowed;opacity:.6}.message-input[_ngcontent-%COMP%]::placeholder{color:var(--color-text-secondary);transition:opacity .3s ease-in-out}.message-input[_ngcontent-%COMP%]:disabled::placeholder{animation:_ngcontent-%COMP%_thinkingPulsate 2s ease-in-out infinite}@keyframes _ngcontent-%COMP%_thinkingPulsate{0%,to{opacity:.6}50%{opacity:1}}.voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%]{margin:0}.actions[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:wrap;justify-content:center}.send-btn[_ngcontent-%COMP%]{transition:opacity .4s,margin-left .4s}.send-btn.active[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{opacity:1}.send-btn[_ngcontent-%COMP%]:not(.active) button[_ngcontent-%COMP%]{opacity:0;margin-left:calc(-.5rem - 36px)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover:not(:disabled){color:#fff;background:linear-gradient(90deg,var(--color-primary, #3b82f6) 0%,var(--color-primary, #3b82f6) 20%,var(--color-accent, #8b5cf6) 50%,var(--color-primary, #3b82f6) 80%,var(--color-primary, #3b82f6) 100%);background-size:300% auto;animation:sendButtonGradientShift 6s ease-in-out infinite;box-shadow:0 4px 14px #007aff30;transform:scale(1.2)}.send-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:active:not(:disabled){transform:scale(1.3);box-shadow:0 4px 24px #007aff30}.recording-indicator[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;margin-top:.2rem;margin-bottom:.2rem;color:var(--color-error, #ff5555);font-size:.9rem;position:absolute;top:-1.5rem}@keyframes _ngcontent-%COMP%_pulse{0%,to{opacity:1}50%{opacity:.5}}.autocomplete-popup[_ngcontent-%COMP%]{position:absolute;bottom:100%;left:0;right:0;margin-bottom:.5rem;background:var(--glass-bg);-webkit-backdrop-filter:var(--glass-backdrop-blur);backdrop-filter:var(--glass-backdrop-blur);border-radius:12px;box-shadow:0 8px 32px #00000026;border:1px solid var(--color-border);max-height:400px;max-width:500px;overflow-y:auto;z-index:100}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--color-border);border-radius:4px}.autocomplete-popup[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:var(--color-text-secondary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]{padding:.75rem 1rem;cursor:pointer;transition:background .2s;border-left:3px solid transparent}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%]:hover, .autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{background:var(--color-bg-hover)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item.selected[_ngcontent-%COMP%]{border-left-color:var(--color-primary)}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%]{font-weight:600;color:var(--color-text);margin-bottom:.25rem;font-family:SF Mono,Monaco,Menlo,Cascadia Code,Consolas,monospace;font-size:.95rem}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1));padding:0 2px;border-radius:2px}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-name[_ngcontent-%COMP%] .parameter-format[_ngcontent-%COMP%]{color:var(--color-text-secondary);font-weight:400;opacity:.7}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%]{font-size:.85rem;color:var(--color-text-secondary);line-height:1.3}.autocomplete-popup[_ngcontent-%COMP%] .autocomplete-item[_ngcontent-%COMP%] .item-description[_ngcontent-%COMP%] strong{font-weight:700;color:var(--color-primary);background:var(--color-primary-light, rgba(99, 102, 241, .1))}@media print{.thinking-progress[_ngcontent-%COMP%], .action-btn[_ngcontent-%COMP%], .voice-btn[_ngcontent-%COMP%], .send-btn[_ngcontent-%COMP%], .upload-btn[_ngcontent-%COMP%], .recording-indicator[_ngcontent-%COMP%], .autocomplete-popup[_ngcontent-%COMP%]{display:none!important}}']})};var be=class i{unreadCountSubject=new Ie(0);unreadCount$=this.unreadCountSubject.asObservable();constructor(){console.log("[UNREAD] Service initialized")}addUnread(){let t=this.unreadCountSubject.value+1;this.unreadCountSubject.next(t),console.log("[UNREAD] Added unread message, total:",t)}markAllAsRead(){this.unreadCountSubject.value>0&&(this.unreadCountSubject.next(0),console.log("[UNREAD] Marked all messages as read"))}getCurrentCount(){return this.unreadCountSubject.value}reset(){this.unreadCountSubject.next(0),console.log("[UNREAD] Counter reset")}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var et=class i{ATTENTION_EMOJI="\u{1F534}";isSystemActive=!1;systemActiveTimer=null;SYSTEM_ACTIVE_TIMEOUT=4e3;unreadService=m(be);project=m(X);constructor(){this.initializeTitleUpdates()}initializeTitleUpdates(){Ft([this.project.selectedProject$,this.unreadService.unreadCount$]).subscribe(([e,t])=>{this.updateTitle(e?.name??"...",t)})}updateTitle(e,t){let n;this.isSystemActive?n=`\u23F3${t>0?` (${t}) `:" "}${e}`:t>0?n=`${this.ATTENTION_EMOJI} (${t}) ${e}`:n=e,document.title=n,console.log("[TAB-TITLE] Updated to:",n)}setSystemActive(){console.log("[TAB-TITLE] System active - showing hourglass"),this.isSystemActive=!0,this.systemActiveTimer&&clearTimeout(this.systemActiveTimer),this.systemActiveTimer=setTimeout(()=>{console.log("[TAB-TITLE] System active timeout - hiding hourglass"),this.isSystemActive=!1,this.forceUpdateTitle()},this.SYSTEM_ACTIVE_TIMEOUT),this.forceUpdateTitle()}setSystemInactive(){console.log("[TAB-TITLE] System inactive - hiding hourglass"),this.isSystemActive=!1,this.systemActiveTimer&&(clearTimeout(this.systemActiveTimer),this.systemActiveTimer=null),this.forceUpdateTitle()}forceUpdateTitle(){let e=this.project.getSelectedProjectId()??"...",t=this.unreadService.getCurrentCount();this.updateTitle(e,t)}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var tt=class i{pendingFirstMessage=null;pendingVoiceMessage=null;setPendingFirstMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=e}consumePendingFirstMessage(){let e=this.pendingFirstMessage;return e?(console.log("[FIRST-MESSAGE-STATE] Consuming pending first message:",e.substring(0,50)+"..."),this.pendingFirstMessage=null):console.log("[FIRST-MESSAGE-STATE] No pending first message to consume"),e}setPendingVoiceMessage(e){console.log("[FIRST-MESSAGE-STATE] Storing pending voice message"),this.pendingVoiceMessage=e}consumePendingVoiceMessage(){let e=this.pendingVoiceMessage;return e&&(console.log("[FIRST-MESSAGE-STATE] Consuming pending voice message"),this.pendingVoiceMessage=null),e}hasPendingFirstMessage(){return this.pendingFirstMessage!==null||this.pendingVoiceMessage!==null}clear(){this.pendingFirstMessage&&(console.log("[FIRST-MESSAGE-STATE] Clearing pending first message"),this.pendingFirstMessage=null),this.pendingVoiceMessage=null}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var ki=(i,e)=>e.label;function Ii(i,e){if(i&1){let t=_();a(0,"button",2),h("click",function(o){let r=f(t).$implicit,d=l();return b(d.executeAction(r,o))}),a(1,"mat-icon"),p(2),s()()}if(i&2){let t=e.$implicit;oe("title",t.tooltip||t.label),c(),oe("aria-label",t.label),c(),w(t.icon)}}var nt=class i{actions=[];executeAction(e,t){t.stopPropagation(),e.action()}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=S({type:i,selectors:[["app-message-context-menu"]],inputs:{actions:"actions"},decls:3,vars:0,consts:[[1,"context-menu-wrapper"],["mat-icon-button",""],["mat-icon-button","",3,"click"]],template:function(t,n){t&1&&(a(0,"div",0),V(1,Ii,3,3,"button",1,ki),s()),t&2&&(c(),L(n.actions))},dependencies:[j,re,R],styles:[".context-menu-wrapper[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center}.context-menu-wrapper[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{transform:scale(.75)}"]})};var J=class i{renderer;constructor(){this.renderer=new wn,this.configureRenderer()}configureRenderer(){let e=this.renderer.link.bind(this.renderer);this.renderer.link=t=>{let n=this.isExternalLink(t.href),o=e(t);if(n){o=o.replace("<a ",'<a target="_blank" rel="noopener noreferrer" ');let r=t.title?`${t.text} - ${t.title} (opens in new tab)`:`${t.text} (opens in new tab)`;o=o.replace("<a ",`<a aria-label="${this.escapeHtml(r)}" `),o=o.replace("</a>",'<span class="external-link-icon" aria-hidden="true">\u2197</span></a>')}return o}}isExternalLink(e){if(!e||e.startsWith("/")||e.startsWith("#")||e.startsWith("?"))return!1;if(e.startsWith("//"))return!0;try{return new URL(e,window.location.href).hostname!==window.location.hostname}catch(t){return!1}}escapeHtml(e){let t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return e.replace(/[&<>"']/g,n=>t[n]||n)}parse(e){return O(this,null,function*(){let t=yield Tn.parse(e,{renderer:this.renderer,breaks:!0,gfm:!0});return Sn.sanitize(t,{ADD_TAGS:["span"],ADD_ATTR:["aria-hidden","aria-label","target","rel"],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i})})}static \u0275fac=function(t){return new(t||i)};static \u0275prov=k({token:i,factory:i.\u0275fac,providedIn:"root"})};var Di=i=>({"user-message-wrapper":i});function Ai(i,e){if(i&1&&(a(0,"div",4)(1,"div",8),p(2),s()()),i&2){let t=l(2);c(2),he(" ",t.message.speaker," ")}}function Fi(i,e){if(i&1&&(a(0,"time",6),p(1),s()),i&2){let t=l(2);c(),w(t.formattedTimestamp)}}function Ri(i,e){if(i&1&&(a(0,"div",7),x(1,"app-message-context-menu",9),s()),i&2){let t=l(2);c(),C("actions",t.actions)}}function Hi(i,e){if(i&1&&(g(0,Ai,3,1,"div",4),x(1,"div",5),g(2,Fi,2,1,"time",6),g(3,Ri,2,1,"div",7)),i&2){let t=l();u(t.shouldShowSpeaker?0:-1),c(),C("innerHTML",t.renderedContent,H),c(),u(t.formattedTimestamp?2:-1),c(),u(t.isLongMessage&&t.shouldShowActions&&t.message.role==="assistant"?3:-1)}}function Vi(i,e){if(i&1&&x(0,"span",12),i&2){let t=l(3);C("innerHTML",t.renderedContent,H)}}function Li(i,e){if(i&1&&(a(0,"span",13),p(1),s()),i&2){let t=l(3);c(),w(t.collapsedErrorText)}}function zi(i,e){i&1&&p(0," Show less \u25B2 ")}function Ni(i,e){i&1&&p(0," Show more \u25BC ")}function $i(i,e){if(i&1){let t=_();a(0,"div",10),g(1,Vi,1,1,"span",12)(2,Li,2,1,"span",13),a(3,"button",14),h("click",function(){f(t);let o=l(2);return b(o.toggleErrorExpanded())}),g(4,zi,1,0)(5,Ni,1,0),s()()}if(i&2){let t=l(2);c(),u(t.isErrorExpanded()?1:2),c(3),u(t.isErrorExpanded()?4:5)}}function ji(i,e){i&1&&p(0," \u25B2 ")}function Ui(i,e){i&1&&p(0," \u25BC ")}function Bi(i,e){if(i&1&&(a(0,"a",17),p(1,"view"),s()),i&2){let t=l(3);C("href",t.eventLink,yt)}}function Wi(i,e){if(i&1&&(a(0,"pre",18),p(1),s()),i&2){let t=l(3);c(),w(t.message.fullContent)}}function qi(i,e){if(i&1){let t=_();a(0,"div",15),x(1,"span",12),a(2,"button",16),h("click",function(){f(t);let o=l(2);return b(o.toggleTechnicalExpanded())}),g(3,ji,1,0)(4,Ui,1,0),s(),g(5,Bi,2,1,"a",17),s(),g(6,Wi,2,1,"pre",18)}if(i&2){let t=l(2);c(),C("innerHTML",t.renderedContent,H),c(2),u(t.isTechnicalExpanded()?3:4),c(2),u(t.eventLink?5:-1),c(),u(t.isTechnicalExpanded()?6:-1)}}function Yi(i,e){if(i&1&&(a(0,"a",17),p(1,"view"),s()),i&2){let t=l(3);C("href",t.eventLink,yt)}}function Gi(i,e){if(i&1&&(a(0,"div",11),x(1,"span",12),g(2,Yi,2,1,"a",17),s()),i&2){let t=l(2);c(),C("innerHTML",t.renderedContent,H),c(),u(t.eventLink?2:-1)}}function Qi(i,e){if(i&1&&g(0,$i,6,2,"div",10)(1,qi,7,4)(2,Gi,3,2,"div",11),i&2){let t=l();u(t.message.type==="error"&&t.isLongError?0:t.message.type==="technical"&&t.message.fullContent?1:2)}}function Xi(i,e){if(i&1&&(a(0,"div",2),x(1,"app-message-context-menu",9),s()),i&2){let t=l();c(),C("actions",t.actions)}}function Ki(i,e){if(i&1&&(a(0,"div",3),x(1,"app-message-context-menu",9),s()),i&2){let t=l();c(),C("actions",t.actions)}}var Ce=class i{destroy$=new B;message;canDelete=!0;isOtherUser=!1;containingThreadId;copyRequested=new M;deleteRequested=new M;renderedContent="";shouldHideTechnical=!1;shouldHideWarning=!1;isErrorExpanded=W(!1);static ERROR_COLLAPSE_LINE_THRESHOLD=5;isTechnicalExpanded=W(!1);sanitizer=m(Q);notificationService=m(yn);preferencesService=m(se);projectState=m(X);threadState=m(K);markdownService=m(J);get messageClasses(){return{[this.message.role]:!0,[this.message.type]:!0,"hidden-technical":this.shouldHideTechnical&&this.message.type==="technical","hidden-warning":this.shouldHideWarning&&this.message.type==="warning","other-user":this.isOtherUser}}ngOnInit(){return O(this,null,function*(){yield this.renderMarkdown(),this.preferencesService.hideTechnicalMessages$.pipe(F(this.destroy$)).subscribe(e=>{this.shouldHideTechnical=e}),this.preferencesService.hideWarningMessages$.pipe(F(this.destroy$)).subscribe(e=>{this.shouldHideWarning=e}),this.shouldHideTechnical=this.preferencesService.getHideTechnicalMessages(),this.shouldHideWarning=this.preferencesService.getHideWarningMessages()})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}get shouldShowSpeaker(){return this.message.role==="user"?this.isOtherUser||this.message.speaker.startsWith("@"):this.message.role==="assistant"}get shouldShowActions(){return this.message.role==="user"||this.message.role==="assistant"}get isSimplified(){return this.message.role!=="user"&&this.message.role!=="assistant"}datePipe=m(Mt);get formattedTimestamp(){if(this.message.role!=="user"||!this.message.timestamp)return null;let e=new Date().toDateString()===this.message.timestamp.toDateString();return this.datePipe.transform(this.message.timestamp,e?"HH:mm":"dd/MM HH:mm")}get isLongError(){return this.message.type!=="error"?!1:this.extractTextContent().split(/\n|\\n/).length>i.ERROR_COLLAPSE_LINE_THRESHOLD}get collapsedErrorText(){return this.extractTextContent().split(/\n|\\n/).slice(0,i.ERROR_COLLAPSE_LINE_THRESHOLD).join(`
4
4
  `)+"\u2026"}toggleErrorExpanded(){this.isErrorExpanded.update(e=>!e)}toggleTechnicalExpanded(){this.isTechnicalExpanded.update(e=>!e)}get isLongMessage(){let e=this.extractTextContent();return e.length>1e3||e.split(`
@@ -31,5 +31,5 @@
31
31
  <style>:root{--color-bg:#f5f6f8;--color-bg-solid:#f5f6f8;--color-bg-secondary:rgba(255, 255, 255, .7);--color-bg-secondary-rgb:255 255 255;--color-text:#1d1d1f;--color-text-secondary:#6e6e73;--color-text-inverse:#ffffff;--color-text-tertiary:#a1a1a6;--color-primary:#007aff;--color-primary-hover:#0051d5;--color-accent:#8b5cf6;--color-link:#007aff;--color-border:rgba(0, 0, 0, .1);--color-border-light:rgba(40, 40, 40, .08);--color-input-bg:rgba(255, 255, 255, .8);--color-bg-hover:rgba(0, 0, 0, .04);--color-success:#34c759;--color-success-bg:#e3f5e1;--color-error:#ff3b30;--color-warning:#ff9500;--color-info:#5ac8fa;--color-message-user:rgba(0, 122, 255, .1);--color-message-ai:rgba(255, 255, 255, .8);--color-code-bg:rgba(142, 142, 147, .12);--color-code-text:#ff375f;--glass-bg:rgba(255, 255, 255, .72);--glass-border:rgba(255, 255, 255, .18);--glass-shadow:0 8px 32px 0 rgba(31, 38, 135, .15);--glass-backdrop-blur:blur(20px);--color-modal-bg:#ffffff;--color-surface:#ffffff;--color-modal-border:rgba(0, 0, 0, .12);--color-modal-shadow:0 8px 40px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .1);--color-shadow:rgba(0, 0, 0, .08);--color-overlay:rgba(0, 0, 0, .4);--color-surface-hover:var(--color-bg-hover);--color-surface-secondary:rgba(0, 0, 0, .03);--color-surface-muted:rgba(0, 0, 0, .05);--color-divider:rgba(0, 0, 0, .1)}@media print{html,body,app-root{height:auto!important;max-height:none!important;min-height:auto!important;overflow:visible!important;position:static!important}body{background:#fff!important;color:#000!important;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif!important;font-size:11pt;line-height:1.6;padding:1rem!important}*{animation:none!important;transition:none!important;box-shadow:none!important;text-shadow:none!important}}*{box-sizing:border-box}html{color-scheme:light}html{--mat-sys-background:light-dark(#faf9fd, #121316);--mat-sys-error:light-dark(#ba1a1a, #ffb4ab);--mat-sys-error-container:light-dark(#ffdad6, #93000a);--mat-sys-inverse-on-surface:light-dark(#f2f0f4, #2f3033);--mat-sys-inverse-primary:light-dark(#abc7ff, #005cbb);--mat-sys-inverse-surface:light-dark(#2f3033, #e3e2e6);--mat-sys-on-background:light-dark(#1a1b1f, #e3e2e6);--mat-sys-on-error:light-dark(#ffffff, #690005);--mat-sys-on-error-container:light-dark(#93000a, #ffdad6);--mat-sys-on-primary:light-dark(#ffffff, #002f65);--mat-sys-on-primary-container:light-dark(#00458f, #d7e3ff);--mat-sys-on-primary-fixed:light-dark(#001b3f, #001b3f);--mat-sys-on-primary-fixed-variant:light-dark(#00458f, #00458f);--mat-sys-on-secondary:light-dark(#ffffff, #283041);--mat-sys-on-secondary-container:light-dark(#3e4759, #dae2f9);--mat-sys-on-secondary-fixed:light-dark(#131c2b, #131c2b);--mat-sys-on-secondary-fixed-variant:light-dark(#3e4759, #3e4759);--mat-sys-on-surface:light-dark(#1a1b1f, #e3e2e6);--mat-sys-on-surface-variant:light-dark(#44474e, #e0e2ec);--mat-sys-on-tertiary:light-dark(#ffffff, #002f65);--mat-sys-on-tertiary-container:light-dark(#00458f, #d7e3ff);--mat-sys-on-tertiary-fixed:light-dark(#001b3f, #001b3f);--mat-sys-on-tertiary-fixed-variant:light-dark(#00458f, #00458f);--mat-sys-outline:light-dark(#74777f, #8e9099);--mat-sys-outline-variant:light-dark(#c4c6d0, #44474e);--mat-sys-primary:light-dark(#005cbb, #abc7ff);--mat-sys-primary-container:light-dark(#d7e3ff, #00458f);--mat-sys-primary-fixed:light-dark(#d7e3ff, #d7e3ff);--mat-sys-primary-fixed-dim:light-dark(#abc7ff, #abc7ff);--mat-sys-scrim:light-dark(#000000, #000000);--mat-sys-secondary:light-dark(#565e71, #bec6dc);--mat-sys-secondary-container:light-dark(#dae2f9, #3e4759);--mat-sys-secondary-fixed:light-dark(#dae2f9, #dae2f9);--mat-sys-secondary-fixed-dim:light-dark(#bec6dc, #bec6dc);--mat-sys-shadow:light-dark(#000000, #000000);--mat-sys-surface:light-dark(#faf9fd, #121316);--mat-sys-surface-bright:light-dark(#faf9fd, #38393c);--mat-sys-surface-container:light-dark(#efedf0, #1f2022);--mat-sys-surface-container-high:light-dark(#e9e7eb, #292a2c);--mat-sys-surface-container-highest:light-dark(#e3e2e6, #343537);--mat-sys-surface-container-low:light-dark(#f4f3f6, #1a1b1f);--mat-sys-surface-container-lowest:light-dark(#ffffff, #0d0e11);--mat-sys-surface-dim:light-dark(#dbd9dd, #121316);--mat-sys-surface-tint:light-dark(#005cbb, #abc7ff);--mat-sys-surface-variant:light-dark(#e0e2ec, #44474e);--mat-sys-tertiary:light-dark(#005cbb, #abc7ff);--mat-sys-tertiary-container:light-dark(#d7e3ff, #00458f);--mat-sys-tertiary-fixed:light-dark(#d7e3ff, #d7e3ff);--mat-sys-tertiary-fixed-dim:light-dark(#abc7ff, #abc7ff);--mat-sys-neutral-variant20:#2d3038;--mat-sys-neutral10:#1a1b1f;--mat-sys-level0:0px 0px 0px 0px rgba(0, 0, 0, .2), 0px 0px 0px 0px rgba(0, 0, 0, .14), 0px 0px 0px 0px rgba(0, 0, 0, .12);--mat-sys-level1:0px 2px 1px -1px rgba(0, 0, 0, .2), 0px 1px 1px 0px rgba(0, 0, 0, .14), 0px 1px 3px 0px rgba(0, 0, 0, .12);--mat-sys-level2:0px 3px 3px -2px rgba(0, 0, 0, .2), 0px 3px 4px 0px rgba(0, 0, 0, .14), 0px 1px 8px 0px rgba(0, 0, 0, .12);--mat-sys-level3:0px 3px 5px -1px rgba(0, 0, 0, .2), 0px 6px 10px 0px rgba(0, 0, 0, .14), 0px 1px 18px 0px rgba(0, 0, 0, .12);--mat-sys-level4:0px 5px 5px -3px rgba(0, 0, 0, .2), 0px 8px 10px 1px rgba(0, 0, 0, .14), 0px 3px 14px 2px rgba(0, 0, 0, .12);--mat-sys-level5:0px 7px 8px -4px rgba(0, 0, 0, .2), 0px 12px 17px 2px rgba(0, 0, 0, .14), 0px 5px 22px 4px rgba(0, 0, 0, .12);--mat-sys-body-large:400 1rem / 1.5rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-large-line-height:1.5rem;--mat-sys-body-large-size:1rem;--mat-sys-body-large-tracking:.031rem;--mat-sys-body-large-weight:400;--mat-sys-body-medium:400 .875rem / 1.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-medium-line-height:1.25rem;--mat-sys-body-medium-size:.875rem;--mat-sys-body-medium-tracking:.016rem;--mat-sys-body-medium-weight:400;--mat-sys-body-small:400 .75rem / 1rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-body-small-line-height:1rem;--mat-sys-body-small-size:.75rem;--mat-sys-body-small-tracking:.025rem;--mat-sys-body-small-weight:400;--mat-sys-display-large:400 3.562rem / 4rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-large-line-height:4rem;--mat-sys-display-large-size:3.562rem;--mat-sys-display-large-tracking:-.016rem;--mat-sys-display-large-weight:400;--mat-sys-display-medium:400 2.812rem / 3.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-medium-line-height:3.25rem;--mat-sys-display-medium-size:2.812rem;--mat-sys-display-medium-tracking:0;--mat-sys-display-medium-weight:400;--mat-sys-display-small:400 2.25rem / 2.75rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-display-small-line-height:2.75rem;--mat-sys-display-small-size:2.25rem;--mat-sys-display-small-tracking:0;--mat-sys-display-small-weight:400;--mat-sys-headline-large:400 2rem / 2.5rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-large-line-height:2.5rem;--mat-sys-headline-large-size:2rem;--mat-sys-headline-large-tracking:0;--mat-sys-headline-large-weight:400;--mat-sys-headline-medium:400 1.75rem / 2.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-medium-line-height:2.25rem;--mat-sys-headline-medium-size:1.75rem;--mat-sys-headline-medium-tracking:0;--mat-sys-headline-medium-weight:400;--mat-sys-headline-small:400 1.5rem / 2rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-headline-small-line-height:2rem;--mat-sys-headline-small-size:1.5rem;--mat-sys-headline-small-tracking:0;--mat-sys-headline-small-weight:400;--mat-sys-label-large:500 .875rem / 1.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-large-line-height:1.25rem;--mat-sys-label-large-size:.875rem;--mat-sys-label-large-tracking:.006rem;--mat-sys-label-large-weight:500;--mat-sys-label-large-weight-prominent:700;--mat-sys-label-medium:500 .75rem / 1rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-medium-line-height:1rem;--mat-sys-label-medium-size:.75rem;--mat-sys-label-medium-tracking:.031rem;--mat-sys-label-medium-weight:500;--mat-sys-label-medium-weight-prominent:700;--mat-sys-label-small:500 .688rem / 1rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-label-small-line-height:1rem;--mat-sys-label-small-size:.688rem;--mat-sys-label-small-tracking:.031rem;--mat-sys-label-small-weight:500;--mat-sys-title-large:400 1.375rem / 1.75rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-large-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-large-line-height:1.75rem;--mat-sys-title-large-size:1.375rem;--mat-sys-title-large-tracking:0;--mat-sys-title-large-weight:400;--mat-sys-title-medium:500 1rem / 1.5rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-medium-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-medium-line-height:1.5rem;--mat-sys-title-medium-size:1rem;--mat-sys-title-medium-tracking:.009rem;--mat-sys-title-medium-weight:500;--mat-sys-title-small:500 .875rem / 1.25rem -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-small-font:-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;--mat-sys-title-small-line-height:1.25rem;--mat-sys-title-small-size:.875rem;--mat-sys-title-small-tracking:.006rem;--mat-sys-title-small-weight:500;--mat-sys-corner-extra-large:28px;--mat-sys-corner-extra-large-top:28px 28px 0 0;--mat-sys-corner-extra-small:4px;--mat-sys-corner-extra-small-top:4px 4px 0 0;--mat-sys-corner-full:9999px;--mat-sys-corner-large:16px;--mat-sys-corner-large-end:0 16px 16px 0;--mat-sys-corner-large-start:16px 0 0 16px;--mat-sys-corner-large-top:16px 16px 0 0;--mat-sys-corner-medium:12px;--mat-sys-corner-none:0;--mat-sys-corner-small:8px;--mat-sys-dragged-state-layer-opacity:.16;--mat-sys-focus-state-layer-opacity:.12;--mat-sys-hover-state-layer-opacity:.08;--mat-sys-pressed-state-layer-opacity:.12;--mat-snack-bar-container-shape:transparent;--mat-snack-bar-container-color:transparent;--mat-snack-bar-supporting-text-color:var(--color-text)}html,body{margin:0;padding:0;width:100%;height:100%}body{background:var(--color-bg);color:var(--color-text);font-family:-apple-system,BlinkMacSystemFont,SF Pro Display,Segoe UI,Helvetica Neue,Arial,sans-serif;transition:background .3s ease,color .3s ease;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;padding:0!important}</style><link rel="stylesheet" href="styles-HDA2O7OH.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles-HDA2O7OH.css"></noscript></head>
32
32
  <body>
33
33
  <app-root></app-root>
34
- <link rel="modulepreload" href="chunk-UQTA3ACH.js"><link rel="modulepreload" href="chunk-QVW2GZXC.js"><link rel="modulepreload" href="chunk-DZ2M3NQD.js"><link rel="modulepreload" href="chunk-CRXIMHRG.js"><link rel="modulepreload" href="chunk-YJOXSEUO.js"><link rel="modulepreload" href="chunk-6XX7GME4.js"><link rel="modulepreload" href="chunk-2PWIGCN2.js"><link rel="modulepreload" href="chunk-BTOJ27OO.js"><link rel="modulepreload" href="chunk-SPV5SLNS.js"><link rel="modulepreload" href="chunk-VMYKE4ZC.js"><script src="polyfills-2FSRUXKO.js" type="module"></script><script src="main-VWHGBAF5.js" type="module"></script></body>
34
+ <link rel="modulepreload" href="chunk-UQTA3ACH.js"><link rel="modulepreload" href="chunk-QVW2GZXC.js"><link rel="modulepreload" href="chunk-DZ2M3NQD.js"><link rel="modulepreload" href="chunk-CRXIMHRG.js"><link rel="modulepreload" href="chunk-YJOXSEUO.js"><link rel="modulepreload" href="chunk-6XX7GME4.js"><link rel="modulepreload" href="chunk-2PWIGCN2.js"><link rel="modulepreload" href="chunk-BTOJ27OO.js"><link rel="modulepreload" href="chunk-SPV5SLNS.js"><link rel="modulepreload" href="chunk-VMYKE4ZC.js"><script src="polyfills-2FSRUXKO.js" type="module"></script><script src="main-JHPNU2VL.js" type="module"></script></body>
35
35
  </html>
@@ -1 +1 @@
1
- import{u as ri}from"./chunk-UQTA3ACH.js";import{a as S,b as K,e as ii,f as xe,h as x,i as Ae,j as ce}from"./chunk-QVW2GZXC.js";import{a as ci}from"./chunk-DZ2M3NQD.js";import{b as ai,c as li,e as be}from"./chunk-CRXIMHRG.js";import"./chunk-YJOXSEUO.js";import{b as Jt,e as ei,f as ti}from"./chunk-6XX7GME4.js";import{a as si}from"./chunk-2PWIGCN2.js";import{c as ni}from"./chunk-BTOJ27OO.js";import"./chunk-SPV5SLNS.js";import{c as oi}from"./chunk-VMYKE4ZC.js";import{b as we}from"./chunk-TASSC2XX.js";import"./chunk-G5RWG2GK.js";import{B as Ft,Ca as Xe,D as Lt,G as zt,L as Kt,La as Vt,Oa as $t,Sc as Xt,Tc as xt,V as jt,W as v,Wa as Gt,Yc as Zt,Z as Ee,a as _e,ba as ve,c as Rt,ca as z,d as G,fb as Te,ka as Bt,la as qt,m as kt,pa as Qt,q as Ye,r as Se,sa as Ut,t as Ot,u as It,ub as Wt,vc as Ht,wc as Yt}from"./chunk-CHEXA6RY.js";function ui(s){return new v(3e3,!1)}function mn(){return new v(3100,!1)}function fn(){return new v(3101,!1)}function pn(s){return new v(3001,!1)}function gn(s){return new v(3003,!1)}function yn(s){return new v(3004,!1)}function di(s,e){return new v(3005,!1)}function mi(){return new v(3006,!1)}function fi(){return new v(3007,!1)}function pi(s,e){return new v(3008,!1)}function gi(s){return new v(3002,!1)}function yi(s,e,t,i,n){return new v(3010,!1)}function _i(){return new v(3011,!1)}function Si(){return new v(3012,!1)}function Ei(){return new v(3200,!1)}function vi(){return new v(3202,!1)}function Ti(){return new v(3013,!1)}function Ai(s){return new v(3014,!1)}function wi(s){return new v(3015,!1)}function bi(s){return new v(3016,!1)}function Pi(s,e){return new v(3404,!1)}function _n(s){return new v(3502,!1)}function Ni(s){return new v(3503,!1)}function Mi(){return new v(3300,!1)}function Ci(s){return new v(3504,!1)}function Di(s){return new v(3301,!1)}function Ri(s,e){return new v(3302,!1)}function ki(s){return new v(3303,!1)}function Oi(s,e){return new v(3400,!1)}function Ii(s){return new v(3401,!1)}function Fi(s){return new v(3402,!1)}function Li(s,e){return new v(3505,!1)}function V(s){switch(s.length){case 0:return new x;case 1:return s[0];default:return new Ae(s)}}function tt(s,e,t=new Map,i=new Map){let n=[],r=[],o=-1,a=null;if(e.forEach(l=>{let c=l.get("offset"),h=c==o,u=h&&a||new Map;l.forEach((_,y)=>{let m=y,g=_;if(y!=="offset")switch(m=s.normalizePropertyName(m,n),g){case ce:g=t.get(y);break;case K:g=i.get(y);break;default:g=s.normalizeStyleValue(y,m,g,n);break}u.set(m,g)}),h||r.push(u),a=u,o=c}),n.length)throw _n(n);return r}function Pe(s,e,t,i){switch(e){case"start":s.onStart(()=>i(t&&Ze(t,"start",s)));break;case"done":s.onDone(()=>i(t&&Ze(t,"done",s)));break;case"destroy":s.onDestroy(()=>i(t&&Ze(t,"destroy",s)));break}}function Ze(s,e,t){let i=t.totalTime,n=!!t.disabled,r=Ne(s.element,s.triggerName,s.fromState,s.toState,e||s.phaseName,i??s.totalTime,n),o=s._data;return o!=null&&(r._data=o),r}function Ne(s,e,t,i,n="",r=0,o){return{element:s,triggerName:e,fromState:t,toState:i,phaseName:n,totalTime:r,disabled:!!o}}function k(s,e,t){let i=s.get(e);return i||s.set(e,i=t),i}function it(s){let e=s.indexOf(":"),t=s.substring(1,e),i=s.slice(e+1);return[t,i]}var Sn=typeof document>"u"?null:document.documentElement;function Me(s){let e=s.parentNode||s.host||null;return e===Sn?null:e}function En(s){return s.substring(1,6)=="ebkit"}var Z=null,hi=!1;function zi(s){Z||(Z=vn()||{},hi=Z.style?"WebkitAppearance"in Z.style:!1);let e=!0;return Z.style&&!En(s)&&(e=s in Z.style,!e&&hi&&(e="Webkit"+s.charAt(0).toUpperCase()+s.slice(1)in Z.style)),e}function vn(){return typeof document<"u"?document.body:null}function nt(s,e){for(;e;){if(e===s)return!0;e=Me(e)}return!1}function st(s,e,t){if(t)return Array.from(s.querySelectorAll(e));let i=s.querySelector(e);return i?[i]:[]}var Tn=1e3,rt="{{",An="}}",ot="ng-enter",Ce="ng-leave",ue="ng-trigger",he=".ng-trigger",at="ng-animating",De=".ng-animating";function U(s){if(typeof s=="number")return s;let e=s.match(/^(-?[\.\d]+)(m?s)/);return!e||e.length<2?0:Je(parseFloat(e[1]),e[2])}function Je(s,e){return e==="s"?s*Tn:s}function de(s,e,t){return s.hasOwnProperty("duration")?s:bn(s,e,t)}var wn=/^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i;function bn(s,e,t){let i,n=0,r="";if(typeof s=="string"){let o=s.match(wn);if(o===null)return e.push(ui(s)),{duration:0,delay:0,easing:""};i=Je(parseFloat(o[1]),o[2]);let a=o[3];a!=null&&(n=Je(parseFloat(a),o[4]));let l=o[5];l&&(r=l)}else i=s;if(!t){let o=!1,a=e.length;i<0&&(e.push(mn()),o=!0),n<0&&(e.push(fn()),o=!0),o&&e.splice(a,0,ui(s))}return{duration:i,delay:n,easing:r}}function Ki(s){return s.length?s[0]instanceof Map?s:s.map(e=>new Map(Object.entries(e))):[]}function j(s,e,t){e.forEach((i,n)=>{let r=Re(n);t&&!t.has(n)&&t.set(n,s.style[r]),s.style[r]=i})}function W(s,e){e.forEach((t,i)=>{let n=Re(i);s.style[n]=""})}function re(s){return Array.isArray(s)?s.length==1?s[0]:ii(s):s}function ji(s,e,t){let i=e.params||{},n=lt(s);n.length&&n.forEach(r=>{i.hasOwnProperty(r)||t.push(pn(r))})}var et=new RegExp(`${rt}\\s*(.+?)\\s*${An}`,"g");function lt(s){let e=[];if(typeof s=="string"){let t;for(;t=et.exec(s);)e.push(t[1]);et.lastIndex=0}return e}function oe(s,e,t){let i=`${s}`,n=i.replace(et,(r,o)=>{let a=e[o];return a==null&&(t.push(gn(o)),a=""),a.toString()});return n==i?s:n}var Pn=/-+([a-z0-9])/g;function Re(s){return s.replace(Pn,(...e)=>e[1].toUpperCase())}function Bi(s,e){return s===0||e===0}function qi(s,e,t){if(t.size&&e.length){let i=e[0],n=[];if(t.forEach((r,o)=>{i.has(o)||n.push(o),i.set(o,r)}),n.length)for(let r=1;r<e.length;r++){let o=e[r];n.forEach(a=>o.set(a,ke(s,a)))}}return e}function O(s,e,t){switch(e.type){case S.Trigger:return s.visitTrigger(e,t);case S.State:return s.visitState(e,t);case S.Transition:return s.visitTransition(e,t);case S.Sequence:return s.visitSequence(e,t);case S.Group:return s.visitGroup(e,t);case S.Animate:return s.visitAnimate(e,t);case S.Keyframes:return s.visitKeyframes(e,t);case S.Style:return s.visitStyle(e,t);case S.Reference:return s.visitReference(e,t);case S.AnimateChild:return s.visitAnimateChild(e,t);case S.AnimateRef:return s.visitAnimateRef(e,t);case S.Query:return s.visitQuery(e,t);case S.Stagger:return s.visitStagger(e,t);default:throw yn(e.type)}}function ke(s,e){return window.getComputedStyle(s)[e]}var bt=(()=>{class s{validateStyleProperty(t){return zi(t)}containsElement(t,i){return nt(t,i)}getParentElement(t){return Me(t)}query(t,i,n){return st(t,i,n)}computeStyle(t,i,n){return n||""}animate(t,i,n,r,o,a=[],l){return new x(n,r)}static \u0275fac=function(i){return new(i||s)};static \u0275prov=Ee({token:s,factory:s.\u0275fac})}return s})(),ee=class{static NOOP=new bt},te=class{};var Nn=new Set(["width","height","minWidth","minHeight","maxWidth","maxHeight","left","top","bottom","right","fontSize","outlineWidth","outlineOffset","paddingTop","paddingLeft","paddingBottom","paddingRight","marginTop","marginLeft","marginBottom","marginRight","borderRadius","borderWidth","borderTopWidth","borderLeftWidth","borderRightWidth","borderBottomWidth","textIndent","perspective"]),ze=class extends te{normalizePropertyName(e,t){return Re(e)}normalizeStyleValue(e,t,i,n){let r="",o=i.toString().trim();if(Nn.has(t)&&i!==0&&i!=="0")if(typeof i=="number")r="px";else{let a=i.match(/^[+-]?[\d\.]+([a-z]*)$/);a&&a[1].length==0&&n.push(di(e,i))}return o+r}};var Ke="*";function Mn(s,e){let t=[];return typeof s=="string"?s.split(/\s*,\s*/).forEach(i=>Cn(i,t,e)):t.push(s),t}function Cn(s,e,t){if(s[0]==":"){let l=Dn(s,t);if(typeof l=="function"){e.push(l);return}s=l}let i=s.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/);if(i==null||i.length<4)return t.push(wi(s)),e;let n=i[1],r=i[2],o=i[3];e.push(Qi(n,o));let a=n==Ke&&o==Ke;r[0]=="<"&&!a&&e.push(Qi(o,n))}function Dn(s,e){switch(s){case":enter":return"void => *";case":leave":return"* => void";case":increment":return(t,i)=>parseFloat(i)>parseFloat(t);case":decrement":return(t,i)=>parseFloat(i)<parseFloat(t);default:return e.push(bi(s)),"* => *"}}var Oe=new Set(["true","1"]),Ie=new Set(["false","0"]);function Qi(s,e){let t=Oe.has(s)||Ie.has(s),i=Oe.has(e)||Ie.has(e);return(n,r)=>{let o=s==Ke||s==n,a=e==Ke||e==r;return!o&&t&&typeof n=="boolean"&&(o=n?Oe.has(s):Ie.has(s)),!a&&i&&typeof r=="boolean"&&(a=r?Oe.has(e):Ie.has(e)),o&&a}}var Ji=":self",Rn=new RegExp(`s*${Ji}s*,?`,"g");function en(s,e,t,i){return new ft(s).build(e,t,i)}var Ui="",ft=class{_driver;constructor(e){this._driver=e}build(e,t,i){let n=new pt(t);return this._resetContextStyleTimingState(n),O(this,re(e),n)}_resetContextStyleTimingState(e){e.currentQuerySelector=Ui,e.collectedStyles=new Map,e.collectedStyles.set(Ui,new Map),e.currentTime=0}visitTrigger(e,t){let i=t.queryCount=0,n=t.depCount=0,r=[],o=[];return e.name.charAt(0)=="@"&&t.errors.push(mi()),e.definitions.forEach(a=>{if(this._resetContextStyleTimingState(t),a.type==S.State){let l=a,c=l.name;c.toString().split(/\s*,\s*/).forEach(h=>{l.name=h,r.push(this.visitState(l,t))}),l.name=c}else if(a.type==S.Transition){let l=this.visitTransition(a,t);i+=l.queryCount,n+=l.depCount,o.push(l)}else t.errors.push(fi())}),{type:S.Trigger,name:e.name,states:r,transitions:o,queryCount:i,depCount:n,options:null}}visitState(e,t){let i=this.visitStyle(e.styles,t),n=e.options&&e.options.params||null;if(i.containsDynamicStyles){let r=new Set,o=n||{};i.styles.forEach(a=>{a instanceof Map&&a.forEach(l=>{lt(l).forEach(c=>{o.hasOwnProperty(c)||r.add(c)})})}),r.size&&t.errors.push(pi(e.name,[...r.values()]))}return{type:S.State,name:e.name,style:i,options:n?{params:n}:null}}visitTransition(e,t){t.queryCount=0,t.depCount=0;let i=O(this,re(e.animation),t),n=Mn(e.expr,t.errors);return{type:S.Transition,matchers:n,animation:i,queryCount:t.queryCount,depCount:t.depCount,options:J(e.options)}}visitSequence(e,t){return{type:S.Sequence,steps:e.steps.map(i=>O(this,i,t)),options:J(e.options)}}visitGroup(e,t){let i=t.currentTime,n=0,r=e.steps.map(o=>{t.currentTime=i;let a=O(this,o,t);return n=Math.max(n,t.currentTime),a});return t.currentTime=n,{type:S.Group,steps:r,options:J(e.options)}}visitAnimate(e,t){let i=Fn(e.timings,t.errors);t.currentAnimateTimings=i;let n,r=e.styles?e.styles:xe({});if(r.type==S.Keyframes)n=this.visitKeyframes(r,t);else{let o=e.styles,a=!1;if(!o){a=!0;let c={};i.easing&&(c.easing=i.easing),o=xe(c)}t.currentTime+=i.duration+i.delay;let l=this.visitStyle(o,t);l.isEmptyStep=a,n=l}return t.currentAnimateTimings=null,{type:S.Animate,timings:i,style:n,options:null}}visitStyle(e,t){let i=this._makeStyleAst(e,t);return this._validateStyleAst(i,t),i}_makeStyleAst(e,t){let i=[],n=Array.isArray(e.styles)?e.styles:[e.styles];for(let a of n)typeof a=="string"?a===K?i.push(a):t.errors.push(gi(a)):i.push(new Map(Object.entries(a)));let r=!1,o=null;return i.forEach(a=>{if(a instanceof Map&&(a.has("easing")&&(o=a.get("easing"),a.delete("easing")),!r)){for(let l of a.values())if(l.toString().indexOf(rt)>=0){r=!0;break}}}),{type:S.Style,styles:i,easing:o,offset:e.offset,containsDynamicStyles:r,options:null}}_validateStyleAst(e,t){let i=t.currentAnimateTimings,n=t.currentTime,r=t.currentTime;i&&r>0&&(r-=i.duration+i.delay),e.styles.forEach(o=>{typeof o!="string"&&o.forEach((a,l)=>{let c=t.collectedStyles.get(t.currentQuerySelector),h=c.get(l),u=!0;h&&(r!=n&&r>=h.startTime&&n<=h.endTime&&(t.errors.push(yi(l,h.startTime,h.endTime,r,n)),u=!1),r=h.startTime),u&&c.set(l,{startTime:r,endTime:n}),t.options&&ji(a,t.options,t.errors)})})}visitKeyframes(e,t){let i={type:S.Keyframes,styles:[],options:null};if(!t.currentAnimateTimings)return t.errors.push(_i()),i;let n=1,r=0,o=[],a=!1,l=!1,c=0,h=e.steps.map(w=>{let b=this._makeStyleAst(w,t),C=b.offset!=null?b.offset:In(b.styles),N=0;return C!=null&&(r++,N=b.offset=C),l=l||N<0||N>1,a=a||N<c,c=N,o.push(N),b});l&&t.errors.push(Si()),a&&t.errors.push(Ei());let u=e.steps.length,_=0;r>0&&r<u?t.errors.push(vi()):r==0&&(_=n/(u-1));let y=u-1,m=t.currentTime,g=t.currentAnimateTimings,T=g.duration;return h.forEach((w,b)=>{let C=_>0?b==y?1:_*b:o[b],N=C*T;t.currentTime=m+g.delay+N,g.duration=N,this._validateStyleAst(w,t),w.offset=C,i.styles.push(w)}),i}visitReference(e,t){return{type:S.Reference,animation:O(this,re(e.animation),t),options:J(e.options)}}visitAnimateChild(e,t){return t.depCount++,{type:S.AnimateChild,options:J(e.options)}}visitAnimateRef(e,t){return{type:S.AnimateRef,animation:this.visitReference(e.animation,t),options:J(e.options)}}visitQuery(e,t){let i=t.currentQuerySelector,n=e.options||{};t.queryCount++,t.currentQuery=e;let[r,o]=kn(e.selector);t.currentQuerySelector=i.length?i+" "+r:r,k(t.collectedStyles,t.currentQuerySelector,new Map);let a=O(this,re(e.animation),t);return t.currentQuery=null,t.currentQuerySelector=i,{type:S.Query,selector:r,limit:n.limit||0,optional:!!n.optional,includeSelf:o,animation:a,originalSelector:e.selector,options:J(e.options)}}visitStagger(e,t){t.currentQuery||t.errors.push(Ti());let i=e.timings==="full"?{duration:0,delay:0,easing:"full"}:de(e.timings,t.errors,!0);return{type:S.Stagger,animation:O(this,re(e.animation),t),timings:i,options:null}}};function kn(s){let e=!!s.split(/\s*,\s*/).find(t=>t==Ji);return e&&(s=s.replace(Rn,"")),s=s.replace(/@\*/g,he).replace(/@\w+/g,t=>he+"-"+t.slice(1)).replace(/:animating/g,De),[s,e]}function On(s){return s?_e({},s):null}var pt=class{errors;queryCount=0;depCount=0;currentTransition=null;currentQuery=null;currentQuerySelector=null;currentAnimateTimings=null;currentTime=0;collectedStyles=new Map;options=null;unsupportedCSSPropertiesFound=new Set;constructor(e){this.errors=e}};function In(s){if(typeof s=="string")return null;let e=null;if(Array.isArray(s))s.forEach(t=>{if(t instanceof Map&&t.has("offset")){let i=t;e=parseFloat(i.get("offset")),i.delete("offset")}});else if(s instanceof Map&&s.has("offset")){let t=s;e=parseFloat(t.get("offset")),t.delete("offset")}return e}function Fn(s,e){if(s.hasOwnProperty("duration"))return s;if(typeof s=="number"){let r=de(s,e).duration;return ct(r,0,"")}let t=s;if(t.split(/\s+/).some(r=>r.charAt(0)=="{"&&r.charAt(1)=="{")){let r=ct(0,0,"");return r.dynamic=!0,r.strValue=t,r}let n=de(t,e);return ct(n.duration,n.delay,n.easing)}function J(s){return s?(s=_e({},s),s.params&&(s.params=On(s.params))):s={},s}function ct(s,e,t){return{duration:s,delay:e,easing:t}}function Pt(s,e,t,i,n,r,o=null,a=!1){return{type:1,element:s,keyframes:e,preStyleProps:t,postStyleProps:i,duration:n,delay:r,totalTime:n+r,easing:o,subTimeline:a}}var fe=class{_map=new Map;get(e){return this._map.get(e)||[]}append(e,t){let i=this._map.get(e);i||this._map.set(e,i=[]),i.push(...t)}has(e){return this._map.has(e)}clear(){this._map.clear()}},Ln=1,zn=":enter",Kn=new RegExp(zn,"g"),jn=":leave",Bn=new RegExp(jn,"g");function tn(s,e,t,i,n,r=new Map,o=new Map,a,l,c=[]){return new gt().buildKeyframes(s,e,t,i,n,r,o,a,l,c)}var gt=class{buildKeyframes(e,t,i,n,r,o,a,l,c,h=[]){c=c||new fe;let u=new yt(e,t,c,n,r,h,[]);u.options=l;let _=l.delay?U(l.delay):0;u.currentTimeline.delayNextStep(_),u.currentTimeline.setStyles([o],null,u.errors,l),O(this,i,u);let y=u.timelines.filter(m=>m.containsAnimation());if(y.length&&a.size){let m;for(let g=y.length-1;g>=0;g--){let T=y[g];if(T.element===t){m=T;break}}m&&!m.allowOnlyTimelineStyles()&&m.setStyles([a],null,u.errors,l)}return y.length?y.map(m=>m.buildKeyframes()):[Pt(t,[],[],[],0,_,"",!1)]}visitTrigger(e,t){}visitState(e,t){}visitTransition(e,t){}visitAnimateChild(e,t){let i=t.subInstructions.get(t.element);if(i){let n=t.createSubContext(e.options),r=t.currentTimeline.currentTime,o=this._visitSubInstructions(i,n,n.options);r!=o&&t.transformIntoNewTimeline(o)}t.previousNode=e}visitAnimateRef(e,t){let i=t.createSubContext(e.options);i.transformIntoNewTimeline(),this._applyAnimationRefDelays([e.options,e.animation.options],t,i),this.visitReference(e.animation,i),t.transformIntoNewTimeline(i.currentTimeline.currentTime),t.previousNode=e}_applyAnimationRefDelays(e,t,i){for(let n of e){let r=n?.delay;if(r){let o=typeof r=="number"?r:U(oe(r,n?.params??{},t.errors));i.delayNextStep(o)}}}_visitSubInstructions(e,t,i){let r=t.currentTimeline.currentTime,o=i.duration!=null?U(i.duration):null,a=i.delay!=null?U(i.delay):null;return o!==0&&e.forEach(l=>{let c=t.appendInstructionToTimeline(l,o,a);r=Math.max(r,c.duration+c.delay)}),r}visitReference(e,t){t.updateOptions(e.options,!0),O(this,e.animation,t),t.previousNode=e}visitSequence(e,t){let i=t.subContextCount,n=t,r=e.options;if(r&&(r.params||r.delay)&&(n=t.createSubContext(r),n.transformIntoNewTimeline(),r.delay!=null)){n.previousNode.type==S.Style&&(n.currentTimeline.snapshotCurrentStyles(),n.previousNode=je);let o=U(r.delay);n.delayNextStep(o)}e.steps.length&&(e.steps.forEach(o=>O(this,o,n)),n.currentTimeline.applyStylesToKeyframe(),n.subContextCount>i&&n.transformIntoNewTimeline()),t.previousNode=e}visitGroup(e,t){let i=[],n=t.currentTimeline.currentTime,r=e.options&&e.options.delay?U(e.options.delay):0;e.steps.forEach(o=>{let a=t.createSubContext(e.options);r&&a.delayNextStep(r),O(this,o,a),n=Math.max(n,a.currentTimeline.currentTime),i.push(a.currentTimeline)}),i.forEach(o=>t.currentTimeline.mergeTimelineCollectedStyles(o)),t.transformIntoNewTimeline(n),t.previousNode=e}_visitTiming(e,t){if(e.dynamic){let i=e.strValue,n=t.params?oe(i,t.params,t.errors):i;return de(n,t.errors)}else return{duration:e.duration,delay:e.delay,easing:e.easing}}visitAnimate(e,t){let i=t.currentAnimateTimings=this._visitTiming(e.timings,t),n=t.currentTimeline;i.delay&&(t.incrementTime(i.delay),n.snapshotCurrentStyles());let r=e.style;r.type==S.Keyframes?this.visitKeyframes(r,t):(t.incrementTime(i.duration),this.visitStyle(r,t),n.applyStylesToKeyframe()),t.currentAnimateTimings=null,t.previousNode=e}visitStyle(e,t){let i=t.currentTimeline,n=t.currentAnimateTimings;!n&&i.hasCurrentStyleProperties()&&i.forwardFrame();let r=n&&n.easing||e.easing;e.isEmptyStep?i.applyEmptyStep(r):i.setStyles(e.styles,r,t.errors,t.options),t.previousNode=e}visitKeyframes(e,t){let i=t.currentAnimateTimings,n=t.currentTimeline.duration,r=i.duration,a=t.createSubContext().currentTimeline;a.easing=i.easing,e.styles.forEach(l=>{let c=l.offset||0;a.forwardTime(c*r),a.setStyles(l.styles,l.easing,t.errors,t.options),a.applyStylesToKeyframe()}),t.currentTimeline.mergeTimelineCollectedStyles(a),t.transformIntoNewTimeline(n+r),t.previousNode=e}visitQuery(e,t){let i=t.currentTimeline.currentTime,n=e.options||{},r=n.delay?U(n.delay):0;r&&(t.previousNode.type===S.Style||i==0&&t.currentTimeline.hasCurrentStyleProperties())&&(t.currentTimeline.snapshotCurrentStyles(),t.previousNode=je);let o=i,a=t.invokeQuery(e.selector,e.originalSelector,e.limit,e.includeSelf,!!n.optional,t.errors);t.currentQueryTotal=a.length;let l=null;a.forEach((c,h)=>{t.currentQueryIndex=h;let u=t.createSubContext(e.options,c);r&&u.delayNextStep(r),c===t.element&&(l=u.currentTimeline),O(this,e.animation,u),u.currentTimeline.applyStylesToKeyframe();let _=u.currentTimeline.currentTime;o=Math.max(o,_)}),t.currentQueryIndex=0,t.currentQueryTotal=0,t.transformIntoNewTimeline(o),l&&(t.currentTimeline.mergeTimelineCollectedStyles(l),t.currentTimeline.snapshotCurrentStyles()),t.previousNode=e}visitStagger(e,t){let i=t.parentContext,n=t.currentTimeline,r=e.timings,o=Math.abs(r.duration),a=o*(t.currentQueryTotal-1),l=o*t.currentQueryIndex;switch(r.duration<0?"reverse":r.easing){case"reverse":l=a-l;break;case"full":l=i.currentStaggerTime;break}let h=t.currentTimeline;l&&h.delayNextStep(l);let u=h.currentTime;O(this,e.animation,t),t.previousNode=e,i.currentStaggerTime=n.currentTime-u+(n.startTime-i.currentTimeline.startTime)}},je={},yt=class s{_driver;element;subInstructions;_enterClassName;_leaveClassName;errors;timelines;parentContext=null;currentTimeline;currentAnimateTimings=null;previousNode=je;subContextCount=0;options={};currentQueryIndex=0;currentQueryTotal=0;currentStaggerTime=0;constructor(e,t,i,n,r,o,a,l){this._driver=e,this.element=t,this.subInstructions=i,this._enterClassName=n,this._leaveClassName=r,this.errors=o,this.timelines=a,this.currentTimeline=l||new Be(this._driver,t,0),a.push(this.currentTimeline)}get params(){return this.options.params}updateOptions(e,t){if(!e)return;let i=e,n=this.options;i.duration!=null&&(n.duration=U(i.duration)),i.delay!=null&&(n.delay=U(i.delay));let r=i.params;if(r){let o=n.params;o||(o=this.options.params={}),Object.keys(r).forEach(a=>{(!t||!o.hasOwnProperty(a))&&(o[a]=oe(r[a],o,this.errors))})}}_copyOptions(){let e={};if(this.options){let t=this.options.params;if(t){let i=e.params={};Object.keys(t).forEach(n=>{i[n]=t[n]})}}return e}createSubContext(e=null,t,i){let n=t||this.element,r=new s(this._driver,n,this.subInstructions,this._enterClassName,this._leaveClassName,this.errors,this.timelines,this.currentTimeline.fork(n,i||0));return r.previousNode=this.previousNode,r.currentAnimateTimings=this.currentAnimateTimings,r.options=this._copyOptions(),r.updateOptions(e),r.currentQueryIndex=this.currentQueryIndex,r.currentQueryTotal=this.currentQueryTotal,r.parentContext=this,this.subContextCount++,r}transformIntoNewTimeline(e){return this.previousNode=je,this.currentTimeline=this.currentTimeline.fork(this.element,e),this.timelines.push(this.currentTimeline),this.currentTimeline}appendInstructionToTimeline(e,t,i){let n={duration:t??e.duration,delay:this.currentTimeline.currentTime+(i??0)+e.delay,easing:""},r=new _t(this._driver,e.element,e.keyframes,e.preStyleProps,e.postStyleProps,n,e.stretchStartingKeyframe);return this.timelines.push(r),n}incrementTime(e){this.currentTimeline.forwardTime(this.currentTimeline.duration+e)}delayNextStep(e){e>0&&this.currentTimeline.delayNextStep(e)}invokeQuery(e,t,i,n,r,o){let a=[];if(n&&a.push(this.element),e.length>0){e=e.replace(Kn,"."+this._enterClassName),e=e.replace(Bn,"."+this._leaveClassName);let l=i!=1,c=this._driver.query(this.element,e,l);i!==0&&(c=i<0?c.slice(c.length+i,c.length):c.slice(0,i)),a.push(...c)}return!r&&a.length==0&&o.push(Ai(t)),a}},Be=class s{_driver;element;startTime;_elementTimelineStylesLookup;duration=0;easing=null;_previousKeyframe=new Map;_currentKeyframe=new Map;_keyframes=new Map;_styleSummary=new Map;_localTimelineStyles=new Map;_globalTimelineStyles;_pendingStyles=new Map;_backFill=new Map;_currentEmptyStepKeyframe=null;constructor(e,t,i,n){this._driver=e,this.element=t,this.startTime=i,this._elementTimelineStylesLookup=n,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(t),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(t,this._localTimelineStyles)),this._loadKeyframe()}containsAnimation(){switch(this._keyframes.size){case 0:return!1;case 1:return this.hasCurrentStyleProperties();default:return!0}}hasCurrentStyleProperties(){return this._currentKeyframe.size>0}get currentTime(){return this.startTime+this.duration}delayNextStep(e){let t=this._keyframes.size===1&&this._pendingStyles.size;this.duration||t?(this.forwardTime(this.currentTime+e),t&&this.snapshotCurrentStyles()):this.startTime+=e}fork(e,t){return this.applyStylesToKeyframe(),new s(this._driver,e,t||this.currentTime,this._elementTimelineStylesLookup)}_loadKeyframe(){this._currentKeyframe&&(this._previousKeyframe=this._currentKeyframe),this._currentKeyframe=this._keyframes.get(this.duration),this._currentKeyframe||(this._currentKeyframe=new Map,this._keyframes.set(this.duration,this._currentKeyframe))}forwardFrame(){this.duration+=Ln,this._loadKeyframe()}forwardTime(e){this.applyStylesToKeyframe(),this.duration=e,this._loadKeyframe()}_updateStyle(e,t){this._localTimelineStyles.set(e,t),this._globalTimelineStyles.set(e,t),this._styleSummary.set(e,{time:this.currentTime,value:t})}allowOnlyTimelineStyles(){return this._currentEmptyStepKeyframe!==this._currentKeyframe}applyEmptyStep(e){e&&this._previousKeyframe.set("easing",e);for(let[t,i]of this._globalTimelineStyles)this._backFill.set(t,i||K),this._currentKeyframe.set(t,K);this._currentEmptyStepKeyframe=this._currentKeyframe}setStyles(e,t,i,n){t&&this._previousKeyframe.set("easing",t);let r=n&&n.params||{},o=qn(e,this._globalTimelineStyles);for(let[a,l]of o){let c=oe(l,r,i);this._pendingStyles.set(a,c),this._localTimelineStyles.has(a)||this._backFill.set(a,this._globalTimelineStyles.get(a)??K),this._updateStyle(a,c)}}applyStylesToKeyframe(){this._pendingStyles.size!=0&&(this._pendingStyles.forEach((e,t)=>{this._currentKeyframe.set(t,e)}),this._pendingStyles.clear(),this._localTimelineStyles.forEach((e,t)=>{this._currentKeyframe.has(t)||this._currentKeyframe.set(t,e)}))}snapshotCurrentStyles(){for(let[e,t]of this._localTimelineStyles)this._pendingStyles.set(e,t),this._updateStyle(e,t)}getFinalKeyframe(){return this._keyframes.get(this.duration)}get properties(){let e=[];for(let t in this._currentKeyframe)e.push(t);return e}mergeTimelineCollectedStyles(e){e._styleSummary.forEach((t,i)=>{let n=this._styleSummary.get(i);(!n||t.time>n.time)&&this._updateStyle(i,t.value)})}buildKeyframes(){this.applyStylesToKeyframe();let e=new Set,t=new Set,i=this._keyframes.size===1&&this.duration===0,n=[];this._keyframes.forEach((a,l)=>{let c=new Map([...this._backFill,...a]);c.forEach((h,u)=>{h===ce?e.add(u):h===K&&t.add(u)}),i||c.set("offset",l/this.duration),n.push(c)});let r=[...e.values()],o=[...t.values()];if(i){let a=n[0],l=new Map(a);a.set("offset",0),l.set("offset",1),n=[a,l]}return Pt(this.element,n,r,o,this.duration,this.startTime,this.easing,!1)}},_t=class extends Be{keyframes;preStyleProps;postStyleProps;_stretchStartingKeyframe;timings;constructor(e,t,i,n,r,o,a=!1){super(e,t,o.delay),this.keyframes=i,this.preStyleProps=n,this.postStyleProps=r,this._stretchStartingKeyframe=a,this.timings={duration:o.duration,delay:o.delay,easing:o.easing}}containsAnimation(){return this.keyframes.length>1}buildKeyframes(){let e=this.keyframes,{delay:t,duration:i,easing:n}=this.timings;if(this._stretchStartingKeyframe&&t){let r=[],o=i+t,a=t/o,l=new Map(e[0]);l.set("offset",0),r.push(l);let c=new Map(e[0]);c.set("offset",Vi(a)),r.push(c);let h=e.length-1;for(let u=1;u<=h;u++){let _=new Map(e[u]),y=_.get("offset"),m=t+y*i;_.set("offset",Vi(m/o)),r.push(_)}i=o,t=0,n="",e=r}return Pt(this.element,e,this.preStyleProps,this.postStyleProps,i,t,n,!0)}};function Vi(s,e=3){let t=Math.pow(10,e-1);return Math.round(s*t)/t}function qn(s,e){let t=new Map,i;return s.forEach(n=>{if(n==="*"){i??=e.keys();for(let r of i)t.set(r,K)}else for(let[r,o]of n)t.set(r,o)}),t}function $i(s,e,t,i,n,r,o,a,l,c,h,u,_){return{type:0,element:s,triggerName:e,isRemovalTransition:n,fromState:t,fromStyles:r,toState:i,toStyles:o,timelines:a,queriedElements:l,preStyleProps:c,postStyleProps:h,totalTime:u,errors:_}}var ut={},qe=class{_triggerName;ast;_stateStyles;constructor(e,t,i){this._triggerName=e,this.ast=t,this._stateStyles=i}match(e,t,i,n){return Qn(this.ast.matchers,e,t,i,n)}buildStyles(e,t,i){let n=this._stateStyles.get("*");return e!==void 0&&(n=this._stateStyles.get(e?.toString())||n),n?n.buildStyles(t,i):new Map}build(e,t,i,n,r,o,a,l,c,h){let u=[],_=this.ast.options&&this.ast.options.params||ut,y=a&&a.params||ut,m=this.buildStyles(i,y,u),g=l&&l.params||ut,T=this.buildStyles(n,g,u),w=new Set,b=new Map,C=new Map,N=n==="void",ne={params:nn(g,_),delay:this.ast.options?.delay},q=h?[]:tn(e,t,this.ast.animation,r,o,m,T,ne,c,u),D=0;return q.forEach(R=>{D=Math.max(R.duration+R.delay,D)}),u.length?$i(t,this._triggerName,i,n,N,m,T,[],[],b,C,D,u):(q.forEach(R=>{let H=R.element,se=k(b,H,new Set);R.preStyleProps.forEach(Y=>se.add(Y));let Nt=k(C,H,new Set);R.postStyleProps.forEach(Y=>Nt.add(Y)),H!==t&&w.add(H)}),$i(t,this._triggerName,i,n,N,m,T,q,[...w.values()],b,C,D))}};function Qn(s,e,t,i,n){return s.some(r=>r(e,t,i,n))}function nn(s,e){let t=_e({},e);return Object.entries(s).forEach(([i,n])=>{n!=null&&(t[i]=n)}),t}var St=class{styles;defaultParams;normalizer;constructor(e,t,i){this.styles=e,this.defaultParams=t,this.normalizer=i}buildStyles(e,t){let i=new Map,n=nn(e,this.defaultParams);return this.styles.styles.forEach(r=>{typeof r!="string"&&r.forEach((o,a)=>{o&&(o=oe(o,n,t));let l=this.normalizer.normalizePropertyName(a,t);o=this.normalizer.normalizeStyleValue(a,l,o,t),i.set(a,o)})}),i}};function Un(s,e,t){return new Et(s,e,t)}var Et=class{name;ast;_normalizer;transitionFactories=[];fallbackTransition;states=new Map;constructor(e,t,i){this.name=e,this.ast=t,this._normalizer=i,t.states.forEach(n=>{let r=n.options&&n.options.params||{};this.states.set(n.name,new St(n.style,r,i))}),Gi(this.states,"true","1"),Gi(this.states,"false","0"),t.transitions.forEach(n=>{this.transitionFactories.push(new qe(e,n,this.states))}),this.fallbackTransition=Vn(e,this.states)}get containsQueries(){return this.ast.queryCount>0}matchTransition(e,t,i,n){return this.transitionFactories.find(o=>o.match(e,t,i,n))||null}matchStyles(e,t,i){return this.fallbackTransition.buildStyles(e,t,i)}};function Vn(s,e,t){let i=[(o,a)=>!0],n={type:S.Sequence,steps:[],options:null},r={type:S.Transition,animation:n,matchers:i,options:null,queryCount:0,depCount:0};return new qe(s,r,e)}function Gi(s,e,t){s.has(e)?s.has(t)||s.set(t,s.get(e)):s.has(t)&&s.set(e,s.get(t))}var $n=new fe,vt=class{bodyNode;_driver;_normalizer;_animations=new Map;_playersById=new Map;players=[];constructor(e,t,i){this.bodyNode=e,this._driver=t,this._normalizer=i}register(e,t){let i=[],n=[],r=en(this._driver,t,i,n);if(i.length)throw Ni(i);this._animations.set(e,r)}_buildPlayer(e,t,i){let n=e.element,r=tt(this._normalizer,e.keyframes,t,i);return this._driver.animate(n,r,e.duration,e.delay,e.easing,[],!0)}create(e,t,i={}){let n=[],r=this._animations.get(e),o,a=new Map;if(r?(o=tn(this._driver,t,r,ot,Ce,new Map,new Map,i,$n,n),o.forEach(h=>{let u=k(a,h.element,new Map);h.postStyleProps.forEach(_=>u.set(_,null))})):(n.push(Mi()),o=[]),n.length)throw Ci(n);a.forEach((h,u)=>{h.forEach((_,y)=>{h.set(y,this._driver.computeStyle(u,y,K))})});let l=o.map(h=>{let u=a.get(h.element);return this._buildPlayer(h,new Map,u)}),c=V(l);return this._playersById.set(e,c),c.onDestroy(()=>this.destroy(e)),this.players.push(c),c}destroy(e){let t=this._getPlayer(e);t.destroy(),this._playersById.delete(e);let i=this.players.indexOf(t);i>=0&&this.players.splice(i,1)}_getPlayer(e){let t=this._playersById.get(e);if(!t)throw Di(e);return t}listen(e,t,i,n){let r=Ne(t,"","","");return Pe(this._getPlayer(e),i,r,n),()=>{}}command(e,t,i,n){if(i=="register"){this.register(e,n[0]);return}if(i=="create"){let o=n[0]||{};this.create(e,t,o);return}let r=this._getPlayer(e);switch(i){case"play":r.play();break;case"pause":r.pause();break;case"reset":r.reset();break;case"restart":r.restart();break;case"finish":r.finish();break;case"init":r.init();break;case"setPosition":r.setPosition(parseFloat(n[0]));break;case"destroy":this.destroy(e);break}}},Wi="ng-animate-queued",Gn=".ng-animate-queued",ht="ng-animate-disabled",Wn=".ng-animate-disabled",Hn="ng-star-inserted",Yn=".ng-star-inserted",Xn=[],sn={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},xn={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},B="__ng_removed",pe=class{namespaceId;value;options;get params(){return this.options.params}constructor(e,t=""){this.namespaceId=t;let i=e&&e.hasOwnProperty("value"),n=i?e.value:e;if(this.value=Jn(n),i){let r=e,{value:o}=r,a=Rt(r,["value"]);this.options=a}else this.options={};this.options.params||(this.options.params={})}absorbOptions(e){let t=e.params;if(t){let i=this.options.params;Object.keys(t).forEach(n=>{i[n]==null&&(i[n]=t[n])})}}},me="void",dt=new pe(me),Tt=class{id;hostElement;_engine;players=[];_triggers=new Map;_queue=[];_elementListeners=new Map;_hostClassName;constructor(e,t,i){this.id=e,this.hostElement=t,this._engine=i,this._hostClassName="ng-tns-"+e,L(t,this._hostClassName)}listen(e,t,i,n){if(!this._triggers.has(t))throw Ri(i,t);if(i==null||i.length==0)throw ki(t);if(!es(i))throw Oi(i,t);let r=k(this._elementListeners,e,[]),o={name:t,phase:i,callback:n};r.push(o);let a=k(this._engine.statesByElement,e,new Map);return a.has(t)||(L(e,ue),L(e,ue+"-"+t),a.set(t,dt)),()=>{this._engine.afterFlush(()=>{let l=r.indexOf(o);l>=0&&r.splice(l,1),this._triggers.has(t)||a.delete(t)})}}register(e,t){return this._triggers.has(e)?!1:(this._triggers.set(e,t),!0)}_getTrigger(e){let t=this._triggers.get(e);if(!t)throw Ii(e);return t}trigger(e,t,i,n=!0){let r=this._getTrigger(t),o=new ge(this.id,t,e),a=this._engine.statesByElement.get(e);a||(L(e,ue),L(e,ue+"-"+t),this._engine.statesByElement.set(e,a=new Map));let l=a.get(t),c=new pe(i,this.id);if(!(i&&i.hasOwnProperty("value"))&&l&&c.absorbOptions(l.options),a.set(t,c),l||(l=dt),!(c.value===me)&&l.value===c.value){if(!ns(l.params,c.params)){let g=[],T=r.matchStyles(l.value,l.params,g),w=r.matchStyles(c.value,c.params,g);g.length?this._engine.reportError(g):this._engine.afterFlush(()=>{W(e,T),j(e,w)})}return}let _=k(this._engine.playersByElement,e,[]);_.forEach(g=>{g.namespaceId==this.id&&g.triggerName==t&&g.queued&&g.destroy()});let y=r.matchTransition(l.value,c.value,e,c.params),m=!1;if(!y){if(!n)return;y=r.fallbackTransition,m=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:t,transition:y,fromState:l,toState:c,player:o,isFallbackTransition:m}),m||(L(e,Wi),o.onStart(()=>{ae(e,Wi)})),o.onDone(()=>{let g=this.players.indexOf(o);g>=0&&this.players.splice(g,1);let T=this._engine.playersByElement.get(e);if(T){let w=T.indexOf(o);w>=0&&T.splice(w,1)}}),this.players.push(o),_.push(o),o}deregister(e){this._triggers.delete(e),this._engine.statesByElement.forEach(t=>t.delete(e)),this._elementListeners.forEach((t,i)=>{this._elementListeners.set(i,t.filter(n=>n.name!=e))})}clearElementCache(e){this._engine.statesByElement.delete(e),this._elementListeners.delete(e);let t=this._engine.playersByElement.get(e);t&&(t.forEach(i=>i.destroy()),this._engine.playersByElement.delete(e))}_signalRemovalForInnerTriggers(e,t){let i=this._engine.driver.query(e,he,!0);i.forEach(n=>{if(n[B])return;let r=this._engine.fetchNamespacesByElement(n);r.size?r.forEach(o=>o.triggerLeaveAnimation(n,t,!1,!0)):this.clearElementCache(n)}),this._engine.afterFlushAnimationsDone(()=>i.forEach(n=>this.clearElementCache(n)))}triggerLeaveAnimation(e,t,i,n){let r=this._engine.statesByElement.get(e),o=new Map;if(r){let a=[];if(r.forEach((l,c)=>{if(o.set(c,l.value),this._triggers.has(c)){let h=this.trigger(e,c,me,n);h&&a.push(h)}}),a.length)return this._engine.markElementAsRemoved(this.id,e,!0,t,o),i&&V(a).onDone(()=>this._engine.processLeaveNode(e)),!0}return!1}prepareLeaveAnimationListeners(e){let t=this._elementListeners.get(e),i=this._engine.statesByElement.get(e);if(t&&i){let n=new Set;t.forEach(r=>{let o=r.name;if(n.has(o))return;n.add(o);let l=this._triggers.get(o).fallbackTransition,c=i.get(o)||dt,h=new pe(me),u=new ge(this.id,o,e);this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:o,transition:l,fromState:c,toState:h,player:u,isFallbackTransition:!0})})}}removeNode(e,t){let i=this._engine;if(e.childElementCount&&this._signalRemovalForInnerTriggers(e,t),this.triggerLeaveAnimation(e,t,!0))return;let n=!1;if(i.totalAnimations){let r=i.players.length?i.playersByQueriedElement.get(e):[];if(r&&r.length)n=!0;else{let o=e;for(;o=o.parentNode;)if(i.statesByElement.get(o)){n=!0;break}}}if(this.prepareLeaveAnimationListeners(e),n)i.markElementAsRemoved(this.id,e,!1,t);else{let r=e[B];(!r||r===sn)&&(i.afterFlush(()=>this.clearElementCache(e)),i.destroyInnerAnimations(e),i._onRemovalComplete(e,t))}}insertNode(e,t){L(e,this._hostClassName)}drainQueuedTransitions(e){let t=[];return this._queue.forEach(i=>{let n=i.player;if(n.destroyed)return;let r=i.element,o=this._elementListeners.get(r);o&&o.forEach(a=>{if(a.name==i.triggerName){let l=Ne(r,i.triggerName,i.fromState.value,i.toState.value);l._data=e,Pe(i.player,a.phase,l,a.callback)}}),n.markedForDestroy?this._engine.afterFlush(()=>{n.destroy()}):t.push(i)}),this._queue=[],t.sort((i,n)=>{let r=i.transition.ast.depCount,o=n.transition.ast.depCount;return r==0||o==0?r-o:this._engine.driver.containsElement(i.element,n.element)?1:-1})}destroy(e){this.players.forEach(t=>t.destroy()),this._signalRemovalForInnerTriggers(this.hostElement,e)}},At=class{bodyNode;driver;_normalizer;players=[];newHostElements=new Map;playersByElement=new Map;playersByQueriedElement=new Map;statesByElement=new Map;disabledNodes=new Set;totalAnimations=0;totalQueuedPlayers=0;_namespaceLookup={};_namespaceList=[];_flushFns=[];_whenQuietFns=[];namespacesByHostElement=new Map;collectedEnterElements=[];collectedLeaveElements=[];onRemovalComplete=(e,t)=>{};_onRemovalComplete(e,t){this.onRemovalComplete(e,t)}constructor(e,t,i){this.bodyNode=e,this.driver=t,this._normalizer=i}get queuedPlayers(){let e=[];return this._namespaceList.forEach(t=>{t.players.forEach(i=>{i.queued&&e.push(i)})}),e}createNamespace(e,t){let i=new Tt(e,t,this);return this.bodyNode&&this.driver.containsElement(this.bodyNode,t)?this._balanceNamespaceList(i,t):(this.newHostElements.set(t,i),this.collectEnterElement(t)),this._namespaceLookup[e]=i}_balanceNamespaceList(e,t){let i=this._namespaceList,n=this.namespacesByHostElement;if(i.length-1>=0){let o=!1,a=this.driver.getParentElement(t);for(;a;){let l=n.get(a);if(l){let c=i.indexOf(l);i.splice(c+1,0,e),o=!0;break}a=this.driver.getParentElement(a)}o||i.unshift(e)}else i.push(e);return n.set(t,e),e}register(e,t){let i=this._namespaceLookup[e];return i||(i=this.createNamespace(e,t)),i}registerTrigger(e,t,i){let n=this._namespaceLookup[e];n&&n.register(t,i)&&this.totalAnimations++}destroy(e,t){e&&(this.afterFlush(()=>{}),this.afterFlushAnimationsDone(()=>{let i=this._fetchNamespace(e);this.namespacesByHostElement.delete(i.hostElement);let n=this._namespaceList.indexOf(i);n>=0&&this._namespaceList.splice(n,1),i.destroy(t),delete this._namespaceLookup[e]}))}_fetchNamespace(e){return this._namespaceLookup[e]}fetchNamespacesByElement(e){let t=new Set,i=this.statesByElement.get(e);if(i){for(let n of i.values())if(n.namespaceId){let r=this._fetchNamespace(n.namespaceId);r&&t.add(r)}}return t}trigger(e,t,i,n){if(Fe(t)){let r=this._fetchNamespace(e);if(r)return r.trigger(t,i,n),!0}return!1}insertNode(e,t,i,n){if(!Fe(t))return;let r=t[B];if(r&&r.setForRemoval){r.setForRemoval=!1,r.setForMove=!0;let o=this.collectedLeaveElements.indexOf(t);o>=0&&this.collectedLeaveElements.splice(o,1)}if(e){let o=this._fetchNamespace(e);o&&o.insertNode(t,i)}n&&this.collectEnterElement(t)}collectEnterElement(e){this.collectedEnterElements.push(e)}markElementAsDisabled(e,t){t?this.disabledNodes.has(e)||(this.disabledNodes.add(e),L(e,ht)):this.disabledNodes.has(e)&&(this.disabledNodes.delete(e),ae(e,ht))}removeNode(e,t,i){if(Fe(t)){let n=e?this._fetchNamespace(e):null;n?n.removeNode(t,i):this.markElementAsRemoved(e,t,!1,i);let r=this.namespacesByHostElement.get(t);r&&r.id!==e&&r.removeNode(t,i)}else this._onRemovalComplete(t,i)}markElementAsRemoved(e,t,i,n,r){this.collectedLeaveElements.push(t),t[B]={namespaceId:e,setForRemoval:n,hasAnimation:i,removedBeforeQueried:!1,previousTriggersValues:r}}listen(e,t,i,n,r){return Fe(t)?this._fetchNamespace(e).listen(t,i,n,r):()=>{}}_buildInstruction(e,t,i,n,r){return e.transition.build(this.driver,e.element,e.fromState.value,e.toState.value,i,n,e.fromState.options,e.toState.options,t,r)}destroyInnerAnimations(e){let t=this.driver.query(e,he,!0);t.forEach(i=>this.destroyActiveAnimationsForElement(i)),this.playersByQueriedElement.size!=0&&(t=this.driver.query(e,De,!0),t.forEach(i=>this.finishActiveQueriedAnimationOnElement(i)))}destroyActiveAnimationsForElement(e){let t=this.playersByElement.get(e);t&&t.forEach(i=>{i.queued?i.markedForDestroy=!0:i.destroy()})}finishActiveQueriedAnimationOnElement(e){let t=this.playersByQueriedElement.get(e);t&&t.forEach(i=>i.finish())}whenRenderingDone(){return new Promise(e=>{if(this.players.length)return V(this.players).onDone(()=>e());e()})}processLeaveNode(e){let t=e[B];if(t&&t.setForRemoval){if(e[B]=sn,t.namespaceId){this.destroyInnerAnimations(e);let i=this._fetchNamespace(t.namespaceId);i&&i.clearElementCache(e)}this._onRemovalComplete(e,t.setForRemoval)}e.classList?.contains(ht)&&this.markElementAsDisabled(e,!1),this.driver.query(e,Wn,!0).forEach(i=>{this.markElementAsDisabled(i,!1)})}flush(e=-1){let t=[];if(this.newHostElements.size&&(this.newHostElements.forEach((i,n)=>this._balanceNamespaceList(i,n)),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(let i=0;i<this.collectedEnterElements.length;i++){let n=this.collectedEnterElements[i];L(n,Hn)}if(this._namespaceList.length&&(this.totalQueuedPlayers||this.collectedLeaveElements.length)){let i=[];try{t=this._flushAnimations(i,e)}finally{for(let n=0;n<i.length;n++)i[n]()}}else for(let i=0;i<this.collectedLeaveElements.length;i++){let n=this.collectedLeaveElements[i];this.processLeaveNode(n)}if(this.totalQueuedPlayers=0,this.collectedEnterElements.length=0,this.collectedLeaveElements.length=0,this._flushFns.forEach(i=>i()),this._flushFns=[],this._whenQuietFns.length){let i=this._whenQuietFns;this._whenQuietFns=[],t.length?V(t).onDone(()=>{i.forEach(n=>n())}):i.forEach(n=>n())}}reportError(e){throw Fi(e)}_flushAnimations(e,t){let i=new fe,n=[],r=new Map,o=[],a=new Map,l=new Map,c=new Map,h=new Set;this.disabledNodes.forEach(d=>{h.add(d);let f=this.driver.query(d,Gn,!0);for(let p=0;p<f.length;p++)h.add(f[p])});let u=this.bodyNode,_=Array.from(this.statesByElement.keys()),y=Xi(_,this.collectedEnterElements),m=new Map,g=0;y.forEach((d,f)=>{let p=ot+g++;m.set(f,p),d.forEach(E=>L(E,p))});let T=[],w=new Set,b=new Set;for(let d=0;d<this.collectedLeaveElements.length;d++){let f=this.collectedLeaveElements[d],p=f[B];p&&p.setForRemoval&&(T.push(f),w.add(f),p.hasAnimation?this.driver.query(f,Yn,!0).forEach(E=>w.add(E)):b.add(f))}let C=new Map,N=Xi(_,Array.from(w));N.forEach((d,f)=>{let p=Ce+g++;C.set(f,p),d.forEach(E=>L(E,p))}),e.push(()=>{y.forEach((d,f)=>{let p=m.get(f);d.forEach(E=>ae(E,p))}),N.forEach((d,f)=>{let p=C.get(f);d.forEach(E=>ae(E,p))}),T.forEach(d=>{this.processLeaveNode(d)})});let ne=[],q=[];for(let d=this._namespaceList.length-1;d>=0;d--)this._namespaceList[d].drainQueuedTransitions(t).forEach(p=>{let E=p.player,P=p.element;if(ne.push(E),this.collectedEnterElements.length){let M=P[B];if(M&&M.setForMove){if(M.previousTriggersValues&&M.previousTriggersValues.has(p.triggerName)){let X=M.previousTriggersValues.get(p.triggerName),F=this.statesByElement.get(p.element);if(F&&F.has(p.triggerName)){let ye=F.get(p.triggerName);ye.value=X,F.set(p.triggerName,ye)}}E.destroy();return}}let Q=!u||!this.driver.containsElement(u,P),I=C.get(P),$=m.get(P),A=this._buildInstruction(p,i,$,I,Q);if(A.errors&&A.errors.length){q.push(A);return}if(Q){E.onStart(()=>W(P,A.fromStyles)),E.onDestroy(()=>j(P,A.toStyles)),n.push(E);return}if(p.isFallbackTransition){E.onStart(()=>W(P,A.fromStyles)),E.onDestroy(()=>j(P,A.toStyles)),n.push(E);return}let Dt=[];A.timelines.forEach(M=>{M.stretchStartingKeyframe=!0,this.disabledNodes.has(M.element)||Dt.push(M)}),A.timelines=Dt,i.append(P,A.timelines);let dn={instruction:A,player:E,element:P};o.push(dn),A.queriedElements.forEach(M=>k(a,M,[]).push(E)),A.preStyleProps.forEach((M,X)=>{if(M.size){let F=l.get(X);F||l.set(X,F=new Set),M.forEach((ye,He)=>F.add(He))}}),A.postStyleProps.forEach((M,X)=>{let F=c.get(X);F||c.set(X,F=new Set),M.forEach((ye,He)=>F.add(He))})});if(q.length){let d=[];q.forEach(f=>{d.push(Li(f.triggerName,f.errors))}),ne.forEach(f=>f.destroy()),this.reportError(d)}let D=new Map,R=new Map;o.forEach(d=>{let f=d.element;i.has(f)&&(R.set(f,f),this._beforeAnimationBuild(d.player.namespaceId,d.instruction,D))}),n.forEach(d=>{let f=d.element;this._getPreviousPlayers(f,!1,d.namespaceId,d.triggerName,null).forEach(E=>{k(D,f,[]).push(E),E.destroy()})});let H=T.filter(d=>xi(d,l,c)),se=new Map;Yi(se,this.driver,b,c,K).forEach(d=>{xi(d,l,c)&&H.push(d)});let Y=new Map;y.forEach((d,f)=>{Yi(Y,this.driver,new Set(d),l,ce)}),H.forEach(d=>{let f=se.get(d),p=Y.get(d);se.set(d,new Map([...f?.entries()??[],...p?.entries()??[]]))});let We=[],Mt=[],Ct={};o.forEach(d=>{let{element:f,player:p,instruction:E}=d;if(i.has(f)){if(h.has(f)){p.onDestroy(()=>j(f,E.toStyles)),p.disabled=!0,p.overrideTotalTime(E.totalTime),n.push(p);return}let P=Ct;if(R.size>1){let I=f,$=[];for(;I=I.parentNode;){let A=R.get(I);if(A){P=A;break}$.push(I)}$.forEach(A=>R.set(A,P))}let Q=this._buildAnimation(p.namespaceId,E,D,r,Y,se);if(p.setRealPlayer(Q),P===Ct)We.push(p);else{let I=this.playersByElement.get(P);I&&I.length&&(p.parentPlayer=V(I)),n.push(p)}}else W(f,E.fromStyles),p.onDestroy(()=>j(f,E.toStyles)),Mt.push(p),h.has(f)&&n.push(p)}),Mt.forEach(d=>{let f=r.get(d.element);if(f&&f.length){let p=V(f);d.setRealPlayer(p)}}),n.forEach(d=>{d.parentPlayer?d.syncPlayerEvents(d.parentPlayer):d.destroy()});for(let d=0;d<T.length;d++){let f=T[d],p=f[B];if(ae(f,Ce),p&&p.hasAnimation)continue;let E=[];if(a.size){let Q=a.get(f);Q&&Q.length&&E.push(...Q);let I=this.driver.query(f,De,!0);for(let $=0;$<I.length;$++){let A=a.get(I[$]);A&&A.length&&E.push(...A)}}let P=E.filter(Q=>!Q.destroyed);P.length?ts(this,f,P):this.processLeaveNode(f)}return T.length=0,We.forEach(d=>{this.players.push(d),d.onDone(()=>{d.destroy();let f=this.players.indexOf(d);this.players.splice(f,1)}),d.play()}),We}afterFlush(e){this._flushFns.push(e)}afterFlushAnimationsDone(e){this._whenQuietFns.push(e)}_getPreviousPlayers(e,t,i,n,r){let o=[];if(t){let a=this.playersByQueriedElement.get(e);a&&(o=a)}else{let a=this.playersByElement.get(e);if(a){let l=!r||r==me;a.forEach(c=>{c.queued||!l&&c.triggerName!=n||o.push(c)})}}return(i||n)&&(o=o.filter(a=>!(i&&i!=a.namespaceId||n&&n!=a.triggerName))),o}_beforeAnimationBuild(e,t,i){let n=t.triggerName,r=t.element,o=t.isRemovalTransition?void 0:e,a=t.isRemovalTransition?void 0:n;for(let l of t.timelines){let c=l.element,h=c!==r,u=k(i,c,[]);this._getPreviousPlayers(c,h,o,a,t.toState).forEach(y=>{let m=y.getRealPlayer();m.beforeDestroy&&m.beforeDestroy(),y.destroy(),u.push(y)})}W(r,t.fromStyles)}_buildAnimation(e,t,i,n,r,o){let a=t.triggerName,l=t.element,c=[],h=new Set,u=new Set,_=t.timelines.map(m=>{let g=m.element;h.add(g);let T=g[B];if(T&&T.removedBeforeQueried)return new x(m.duration,m.delay);let w=g!==l,b=is((i.get(g)||Xn).map(D=>D.getRealPlayer())).filter(D=>{let R=D;return R.element?R.element===g:!1}),C=r.get(g),N=o.get(g),ne=tt(this._normalizer,m.keyframes,C,N),q=this._buildPlayer(m,ne,b);if(m.subTimeline&&n&&u.add(g),w){let D=new ge(e,a,g);D.setRealPlayer(q),c.push(D)}return q});c.forEach(m=>{k(this.playersByQueriedElement,m.element,[]).push(m),m.onDone(()=>Zn(this.playersByQueriedElement,m.element,m))}),h.forEach(m=>L(m,at));let y=V(_);return y.onDestroy(()=>{h.forEach(m=>ae(m,at)),j(l,t.toStyles)}),u.forEach(m=>{k(n,m,[]).push(y)}),y}_buildPlayer(e,t,i){return t.length>0?this.driver.animate(e.element,t,e.duration,e.delay,e.easing,i):new x(e.duration,e.delay)}},ge=class{namespaceId;triggerName;element;_player=new x;_containsRealPlayer=!1;_queuedCallbacks=new Map;destroyed=!1;parentPlayer=null;markedForDestroy=!1;disabled=!1;queued=!0;totalTime=0;constructor(e,t,i){this.namespaceId=e,this.triggerName=t,this.element=i}setRealPlayer(e){this._containsRealPlayer||(this._player=e,this._queuedCallbacks.forEach((t,i)=>{t.forEach(n=>Pe(e,i,void 0,n))}),this._queuedCallbacks.clear(),this._containsRealPlayer=!0,this.overrideTotalTime(e.totalTime),this.queued=!1)}getRealPlayer(){return this._player}overrideTotalTime(e){this.totalTime=e}syncPlayerEvents(e){let t=this._player;t.triggerCallback&&e.onStart(()=>t.triggerCallback("start")),e.onDone(()=>this.finish()),e.onDestroy(()=>this.destroy())}_queueEvent(e,t){k(this._queuedCallbacks,e,[]).push(t)}onDone(e){this.queued&&this._queueEvent("done",e),this._player.onDone(e)}onStart(e){this.queued&&this._queueEvent("start",e),this._player.onStart(e)}onDestroy(e){this.queued&&this._queueEvent("destroy",e),this._player.onDestroy(e)}init(){this._player.init()}hasStarted(){return this.queued?!1:this._player.hasStarted()}play(){!this.queued&&this._player.play()}pause(){!this.queued&&this._player.pause()}restart(){!this.queued&&this._player.restart()}finish(){this._player.finish()}destroy(){this.destroyed=!0,this._player.destroy()}reset(){!this.queued&&this._player.reset()}setPosition(e){this.queued||this._player.setPosition(e)}getPosition(){return this.queued?0:this._player.getPosition()}triggerCallback(e){let t=this._player;t.triggerCallback&&t.triggerCallback(e)}};function Zn(s,e,t){let i=s.get(e);if(i){if(i.length){let n=i.indexOf(t);i.splice(n,1)}i.length==0&&s.delete(e)}return i}function Jn(s){return s??null}function Fe(s){return s&&s.nodeType===1}function es(s){return s=="start"||s=="done"}function Hi(s,e){let t=s.style.display;return s.style.display=e??"none",t}function Yi(s,e,t,i,n){let r=[];t.forEach(l=>r.push(Hi(l)));let o=[];i.forEach((l,c)=>{let h=new Map;l.forEach(u=>{let _=e.computeStyle(c,u,n);h.set(u,_),(!_||_.length==0)&&(c[B]=xn,o.push(c))}),s.set(c,h)});let a=0;return t.forEach(l=>Hi(l,r[a++])),o}function Xi(s,e){let t=new Map;if(s.forEach(a=>t.set(a,[])),e.length==0)return t;let i=1,n=new Set(e),r=new Map;function o(a){if(!a)return i;let l=r.get(a);if(l)return l;let c=a.parentNode;return t.has(c)?l=c:n.has(c)?l=i:l=o(c),r.set(a,l),l}return e.forEach(a=>{let l=o(a);l!==i&&t.get(l).push(a)}),t}function L(s,e){s.classList?.add(e)}function ae(s,e){s.classList?.remove(e)}function ts(s,e,t){V(t).onDone(()=>s.processLeaveNode(e))}function is(s){let e=[];return rn(s,e),e}function rn(s,e){for(let t=0;t<s.length;t++){let i=s[t];i instanceof Ae?rn(i.players,e):e.push(i)}}function ns(s,e){let t=Object.keys(s),i=Object.keys(e);if(t.length!=i.length)return!1;for(let n=0;n<t.length;n++){let r=t[n];if(!e.hasOwnProperty(r)||s[r]!==e[r])return!1}return!0}function xi(s,e,t){let i=t.get(s);if(!i)return!1;let n=e.get(s);return n?i.forEach(r=>n.add(r)):e.set(s,i),t.delete(s),!0}var le=class{_driver;_normalizer;_transitionEngine;_timelineEngine;_triggerCache={};onRemovalComplete=(e,t)=>{};constructor(e,t,i){this._driver=t,this._normalizer=i,this._transitionEngine=new At(e.body,t,i),this._timelineEngine=new vt(e.body,t,i),this._transitionEngine.onRemovalComplete=(n,r)=>this.onRemovalComplete(n,r)}registerTrigger(e,t,i,n,r){let o=e+"-"+n,a=this._triggerCache[o];if(!a){let l=[],c=[],h=en(this._driver,r,l,c);if(l.length)throw Pi(n,l);a=Un(n,h,this._normalizer),this._triggerCache[o]=a}this._transitionEngine.registerTrigger(t,n,a)}register(e,t){this._transitionEngine.register(e,t)}destroy(e,t){this._transitionEngine.destroy(e,t)}onInsert(e,t,i,n){this._transitionEngine.insertNode(e,t,i,n)}onRemove(e,t,i){this._transitionEngine.removeNode(e,t,i)}disableAnimations(e,t){this._transitionEngine.markElementAsDisabled(e,t)}process(e,t,i,n){if(i.charAt(0)=="@"){let[r,o]=it(i),a=n;this._timelineEngine.command(r,t,o,a)}else this._transitionEngine.trigger(e,t,i,n)}listen(e,t,i,n,r){if(i.charAt(0)=="@"){let[o,a]=it(i);return this._timelineEngine.listen(o,t,a,r)}return this._transitionEngine.listen(e,t,i,n,r)}flush(e=-1){this._transitionEngine.flush(e)}get players(){return[...this._transitionEngine.players,...this._timelineEngine.players]}whenRenderingDone(){return this._transitionEngine.whenRenderingDone()}afterFlushAnimationsDone(e){this._transitionEngine.afterFlushAnimationsDone(e)}};function ss(s,e){let t=null,i=null;return Array.isArray(e)&&e.length?(t=mt(e[0]),e.length>1&&(i=mt(e[e.length-1]))):e instanceof Map&&(t=mt(e)),t||i?new rs(s,t,i):null}var rs=(()=>{class s{_element;_startStyles;_endStyles;static initialStylesByElement=new WeakMap;_state=0;_initialStyles;constructor(t,i,n){this._element=t,this._startStyles=i,this._endStyles=n;let r=s.initialStylesByElement.get(t);r||s.initialStylesByElement.set(t,r=new Map),this._initialStyles=r}start(){this._state<1&&(this._startStyles&&j(this._element,this._startStyles,this._initialStyles),this._state=1)}finish(){this.start(),this._state<2&&(j(this._element,this._initialStyles),this._endStyles&&(j(this._element,this._endStyles),this._endStyles=null),this._state=1)}destroy(){this.finish(),this._state<3&&(s.initialStylesByElement.delete(this._element),this._startStyles&&(W(this._element,this._startStyles),this._endStyles=null),this._endStyles&&(W(this._element,this._endStyles),this._endStyles=null),j(this._element,this._initialStyles),this._state=3)}}return s})();function mt(s){let e=null;return s.forEach((t,i)=>{os(i)&&(e=e||new Map,e.set(i,t))}),e}function os(s){return s==="display"||s==="position"}var Qe=class{element;keyframes;options;_specialStyles;_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_duration;_delay;_initialized=!1;_finished=!1;_started=!1;_destroyed=!1;_finalKeyframe;_originalOnDoneFns=[];_originalOnStartFns=[];domPlayer=null;time=0;parentPlayer=null;currentSnapshot=new Map;constructor(e,t,i,n){this.element=e,this.keyframes=t,this.options=i,this._specialStyles=n,this._duration=i.duration,this._delay=i.delay||0,this.time=this._duration+this._delay}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}init(){this._buildPlayer()&&this._preparePlayerBeforeStart()}_buildPlayer(){if(this._initialized)return this.domPlayer;this._initialized=!0;let e=this.keyframes,t=this._triggerWebAnimation(this.element,e,this.options);if(!t)return this._onFinish(),null;this.domPlayer=t,this._finalKeyframe=e.length?e[e.length-1]:new Map;let i=()=>this._onFinish();return t.addEventListener("finish",i),this.onDestroy(()=>{t.removeEventListener("finish",i)}),t}_preparePlayerBeforeStart(){this._delay?this._resetDomPlayerState():this.domPlayer?.pause()}_convertKeyframesToObject(e){let t=[];return e.forEach(i=>{t.push(Object.fromEntries(i))}),t}_triggerWebAnimation(e,t,i){let n=this._convertKeyframesToObject(t);try{return e.animate(n,i)}catch(r){return null}}onStart(e){this._originalOnStartFns.push(e),this._onStartFns.push(e)}onDone(e){this._originalOnDoneFns.push(e),this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}play(){let e=this._buildPlayer();e&&(this.hasStarted()||(this._onStartFns.forEach(t=>t()),this._onStartFns=[],this._started=!0,this._specialStyles&&this._specialStyles.start()),e.play())}pause(){this.init(),this.domPlayer?.pause()}finish(){this.init(),this.domPlayer&&(this._specialStyles&&this._specialStyles.finish(),this._onFinish(),this.domPlayer.finish())}reset(){this._resetDomPlayerState(),this._destroyed=!1,this._finished=!1,this._started=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}_resetDomPlayerState(){this.domPlayer?.cancel()}restart(){this.reset(),this.play()}hasStarted(){return this._started}destroy(){this._destroyed||(this._destroyed=!0,this._resetDomPlayerState(),this._onFinish(),this._specialStyles&&this._specialStyles.destroy(),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}setPosition(e){this.domPlayer||this.init(),this.domPlayer&&(this.domPlayer.currentTime=e*this.time)}getPosition(){return this.domPlayer?+(this.domPlayer.currentTime??0)/this.time:this._initialized?1:0}get totalTime(){return this._delay+this._duration}beforeDestroy(){let e=new Map;this.hasStarted()&&this._finalKeyframe.forEach((i,n)=>{n!=="offset"&&e.set(n,this._finished?i:ke(this.element,n))}),this.currentSnapshot=e}triggerCallback(e){let t=e==="start"?this._onStartFns:this._onDoneFns;t.forEach(i=>i()),t.length=0}},Ue=class{validateStyleProperty(e){return!0}validateAnimatableStyleProperty(e){return!0}containsElement(e,t){return nt(e,t)}getParentElement(e){return Me(e)}query(e,t,i){return st(e,t,i)}computeStyle(e,t,i){return ke(e,t)}animate(e,t,i,n,r,o=[]){let a=n==0?"both":"forwards",l={duration:i,delay:n,fill:a};r&&(l.easing=r);let c=new Map,h=o.filter(y=>y instanceof Qe);Bi(i,n)&&h.forEach(y=>{y.currentSnapshot.forEach((m,g)=>c.set(g,m))});let u=Ki(t).map(y=>new Map(y));u=qi(e,u,c);let _=ss(e,u);return new Qe(e,u,l,_)}};var Le="@",on="@.disabled",Ve=class{namespaceId;delegate;engine;_onDestroy;\u0275type=0;constructor(e,t,i,n){this.namespaceId=e,this.delegate=t,this.engine=i,this._onDestroy=n}get data(){return this.delegate.data}destroyNode(e){this.delegate.destroyNode?.(e)}destroy(){this.engine.destroy(this.namespaceId,this.delegate),this.engine.afterFlushAnimationsDone(()=>{queueMicrotask(()=>{this.delegate.destroy()})}),this._onDestroy?.()}createElement(e,t){return this.delegate.createElement(e,t)}createComment(e){return this.delegate.createComment(e)}createText(e){return this.delegate.createText(e)}appendChild(e,t){this.delegate.appendChild(e,t),this.engine.onInsert(this.namespaceId,t,e,!1)}insertBefore(e,t,i,n=!0){this.delegate.insertBefore(e,t,i),this.engine.onInsert(this.namespaceId,t,e,n)}removeChild(e,t,i,n){if(n){this.delegate.removeChild(e,t,i,n);return}this.parentNode(t)&&this.engine.onRemove(this.namespaceId,t,this.delegate)}selectRootElement(e,t){return this.delegate.selectRootElement(e,t)}parentNode(e){return this.delegate.parentNode(e)}nextSibling(e){return this.delegate.nextSibling(e)}setAttribute(e,t,i,n){this.delegate.setAttribute(e,t,i,n)}removeAttribute(e,t,i){this.delegate.removeAttribute(e,t,i)}addClass(e,t){this.delegate.addClass(e,t)}removeClass(e,t){this.delegate.removeClass(e,t)}setStyle(e,t,i,n){this.delegate.setStyle(e,t,i,n)}removeStyle(e,t,i){this.delegate.removeStyle(e,t,i)}setProperty(e,t,i){t.charAt(0)==Le&&t==on?this.disableAnimations(e,!!i):this.delegate.setProperty(e,t,i)}setValue(e,t){this.delegate.setValue(e,t)}listen(e,t,i,n){return this.delegate.listen(e,t,i,n)}disableAnimations(e,t){this.engine.disableAnimations(e,t)}},wt=class extends Ve{factory;constructor(e,t,i,n,r){super(t,i,n,r),this.factory=e,this.namespaceId=t}setProperty(e,t,i){t.charAt(0)==Le?t.charAt(1)=="."&&t==on?(i=i===void 0?!0:!!i,this.disableAnimations(e,i)):this.engine.process(this.namespaceId,e,t.slice(1),i):this.delegate.setProperty(e,t,i)}listen(e,t,i,n){if(t.charAt(0)==Le){let r=as(e),o=t.slice(1),a="";return o.charAt(0)!=Le&&([o,a]=ls(o)),this.engine.listen(this.namespaceId,r,o,a,l=>{let c=l._data||-1;this.factory.scheduleListenerCallback(c,i,l)})}return this.delegate.listen(e,t,i,n)}};function as(s){switch(s){case"body":return document.body;case"document":return document;case"window":return window;default:return s}}function ls(s){let e=s.indexOf("."),t=s.substring(0,e),i=s.slice(e+1);return[t,i]}var $e=class{delegate;engine;_zone;_currentId=0;_microtaskId=1;_animationCallbacksBuffer=[];_rendererCache=new Map;_cdRecurDepth=0;constructor(e,t,i){this.delegate=e,this.engine=t,this._zone=i,t.onRemovalComplete=(n,r)=>{r?.removeChild(null,n)}}createRenderer(e,t){let n=this.delegate.createRenderer(e,t);if(!e||!t?.data?.animation){let c=this._rendererCache,h=c.get(n);if(!h){let u=()=>c.delete(n);h=new Ve("",n,this.engine,u),c.set(n,h)}return h}let r=t.id,o=t.id+"-"+this._currentId;this._currentId++,this.engine.register(o,e);let a=c=>{Array.isArray(c)?c.forEach(a):this.engine.registerTrigger(r,o,e,c.name,c)};return t.data.animation.forEach(a),new wt(this,o,n,this.engine)}begin(){this._cdRecurDepth++,this.delegate.begin&&this.delegate.begin()}_scheduleCountTask(){queueMicrotask(()=>{this._microtaskId++})}scheduleListenerCallback(e,t,i){if(e>=0&&e<this._microtaskId){this._zone.run(()=>t(i));return}let n=this._animationCallbacksBuffer;n.length==0&&queueMicrotask(()=>{this._zone.run(()=>{n.forEach(r=>{let[o,a]=r;o(a)}),this._animationCallbacksBuffer=[]})}),n.push([t,i])}end(){this._cdRecurDepth--,this._cdRecurDepth==0&&this._zone.runOutsideAngular(()=>{this._scheduleCountTask(),this.engine.flush(this._microtaskId)}),this.delegate.end&&this.delegate.end()}whenRenderingDone(){return this.engine.whenRenderingDone()}componentReplaced(e){this.engine.flush(),this.delegate.componentReplaced?.(e)}};var us=(()=>{class s extends le{constructor(t,i,n){super(t,i,n)}ngOnDestroy(){this.flush()}static \u0275fac=function(i){return new(i||s)(ve(qt),ve(ee),ve(te))};static \u0275prov=Ee({token:s,factory:s.\u0275fac})}return s})();function hs(){return new ze}function ds(){return new $e(z(Xt),z(le),z(Qt))}var an=[{provide:te,useFactory:hs},{provide:le,useClass:us},{provide:$t,useFactory:ds}],zs=[{provide:ee,useClass:bt},{provide:Xe,useValue:"NoopAnimations"},...an],ms=[{provide:ee,useFactory:()=>new Ue},{provide:Xe,useFactory:()=>"BrowserAnimations"},...an];function ln(){return Vt("NgEagerAnimations"),[...ms]}var ie=s=>G(null,null,function*(){let e=z(we),t=s.params.projectName;return t?e.getSelectedProjectId()===t?!0:(e.selectProject(t),(yield Se(e.selectedProject$.pipe(Kt(n=>n?.name===t))))?.name===t):(console.log("[PROJECT GUARD] no project id in route"),!1)});var cn=s=>G(null,null,function*(){let e=z(ai),t=z(li),i=s.params.threadId;if(!t.getUsername())try{yield Ye(t.fetchCurrentUser())}catch(n){console.error("[THREAD GUARD] Failed to load current user:",n)}if(!i)return console.log("[THREAD GUARD] no threadId in route"),!1;if(console.log("[THREAD GUARD] Checking thread:",i),console.log("[THREAD GUARD] Current selected thread:",e.getSelectedThreadId()),e.getSelectedThreadId()===i)return console.log("[THREAD GUARD] Thread already selected, allowing navigation"),!0;console.log("[THREAD GUARD] Selecting thread:",i),e.selectThread(i);try{let n=yield Ye(It([e.isLoading$,e.selectedThread$]).pipe(jt(([o,a])=>console.log(`\u{1F43C} [${o?"loading":"loaded"}]`,a?.id)),Ft(([o,a])=>!o&&!!a),zt(1),Ot(([o,a])=>a?.id))),r=n===i;return r?console.log("[THREAD GUARD] Thread validated, allowing navigation"):console.error("[THREAD GUARD] Thread ID mismatch - route:",i,"loaded:",n),r}catch(n){return console.error("[THREAD GUARD] Error loading thread:",n),!1}});var un=[{path:"",loadComponent:()=>import("./chunk-YGBFW4ZS.js").then(s=>s.GlobalTaskControlComponent)},{path:"projects",loadComponent:()=>import("./chunk-LVRSSQUD.js").then(s=>s.ProjectListComponent)},{path:"oauth/callback",loadComponent:()=>import("./chunk-MNWA4UGA.js").then(s=>s.OAuthCallbackComponent)},{path:"project/new",loadComponent:()=>import("./chunk-MWXEF4QG.js").then(s=>s.ProjectNewComponent)},{path:"project/:projectName",loadComponent:()=>import("./chunk-6BMCL5TR.js").then(s=>s.MainAppComponent),canActivate:[ie]},{path:"project/:projectName/prompts",loadComponent:()=>import("./chunk-UF3D3UUD.js").then(s=>s.PromptListComponent),canActivate:[ie]},{path:"project/:projectName/schedulers",loadComponent:()=>import("./chunk-OIFNN56R.js").then(s=>s.SchedulerListComponent),canActivate:[ie]},{path:"project/:projectName/agents",loadComponent:()=>import("./chunk-TRFKVZGV.js").then(s=>s.AgentListComponent),canActivate:[ie]},{path:"project/:projectName/tasks",loadComponent:()=>import("./chunk-5WX43L4B.js").then(s=>s.TaskControlComponent),canActivate:[ie]},{path:"project/:projectName/missions",redirectTo:"project/:projectName/tasks"},{path:"project/:projectName/thread/:threadId",loadComponent:()=>import("./chunk-6BMCL5TR.js").then(s=>s.MainAppComponent),canActivate:[ie,cn]},{path:"token-usage",loadComponent:()=>import("./chunk-CXNTZ6XI.js").then(s=>s.TokenUsageComponent)},{path:"agentos",loadChildren:()=>G(null,null,function*(){let{AGENTOS_ROUTES:s,THEME_PORT:e}=yield import("./chunk-ENRRDIUM.js");return[{path:"",providers:[{provide:e,useFactory:t=>({theme:oi(t.currentTheme$,{initialValue:t.getCurrentTheme()}),setTheme:i=>t.setTheme(i)}),deps:[be]}],children:s}]})},{path:"**",redirectTo:""}];function fs(s){return()=>s.initializeDefaultProject()}function ps(s){return()=>{console.log("[APP_INIT] OAuthService initialized")}}function gs(s){return()=>G(null,null,function*(){let{UserStateService:e}=yield import("./chunk-ENRRDIUM.js"),t=s.get(e);yield Se(t.loadMe().pipe(Lt(i=>(console.warn("Failed to load current user",i),kt(null)))))})}var hn={providers:[Ut(),Ht({eventCoalescing:!0}),ei(un),Zt(),ln(),{provide:si,useValue:{duration:3e3}},{provide:Te,useFactory:fs,deps:[we],multi:!0},{provide:Te,useFactory:ps,deps:[ci],multi:!0},{provide:Te,useFactory:gs,deps:[Bt],multi:!0},ri({basePath:"/api/agentos"}),{provide:ni,useValue:{width:"80vw",maxWidth:"80vw",maxHeight:"80vh"}}]};var Ge=class s{title="client";themeService=z(be);ngOnInit(){console.log("[APP] Application initialized with theme:",this.themeService.getCurrentTheme())}static \u0275fac=function(t){return new(t||s)};static \u0275cmp=Gt({type:s,selectors:[["app-root"]],decls:1,vars:0,template:function(t,i){t&1&&Wt(0,"router-outlet")},dependencies:[ti,Jt],encapsulation:2})};xt(Ge,hn).catch(s=>console.error(s));"serviceWorker"in navigator&&!Yt()&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(s=>console.error("[SW] Registration failed:",s))});
1
+ import{u as ri}from"./chunk-UQTA3ACH.js";import{a as S,b as K,e as ii,f as xe,h as x,i as Ae,j as ce}from"./chunk-QVW2GZXC.js";import{a as ci}from"./chunk-DZ2M3NQD.js";import{b as ai,c as li,e as be}from"./chunk-CRXIMHRG.js";import"./chunk-YJOXSEUO.js";import{b as Jt,e as ei,f as ti}from"./chunk-6XX7GME4.js";import{a as si}from"./chunk-2PWIGCN2.js";import{c as ni}from"./chunk-BTOJ27OO.js";import"./chunk-SPV5SLNS.js";import{c as oi}from"./chunk-VMYKE4ZC.js";import{b as we}from"./chunk-TASSC2XX.js";import"./chunk-G5RWG2GK.js";import{B as Ft,Ca as Xe,D as Lt,G as zt,L as Kt,La as Vt,Oa as $t,Sc as Xt,Tc as xt,V as jt,W as v,Wa as Gt,Yc as Zt,Z as Ee,a as _e,ba as ve,c as Rt,ca as z,d as G,fb as Te,ka as Bt,la as qt,m as kt,pa as Qt,q as Ye,r as Se,sa as Ut,t as Ot,u as It,ub as Wt,vc as Ht,wc as Yt}from"./chunk-CHEXA6RY.js";function ui(s){return new v(3e3,!1)}function mn(){return new v(3100,!1)}function fn(){return new v(3101,!1)}function pn(s){return new v(3001,!1)}function gn(s){return new v(3003,!1)}function yn(s){return new v(3004,!1)}function di(s,e){return new v(3005,!1)}function mi(){return new v(3006,!1)}function fi(){return new v(3007,!1)}function pi(s,e){return new v(3008,!1)}function gi(s){return new v(3002,!1)}function yi(s,e,t,i,n){return new v(3010,!1)}function _i(){return new v(3011,!1)}function Si(){return new v(3012,!1)}function Ei(){return new v(3200,!1)}function vi(){return new v(3202,!1)}function Ti(){return new v(3013,!1)}function Ai(s){return new v(3014,!1)}function wi(s){return new v(3015,!1)}function bi(s){return new v(3016,!1)}function Pi(s,e){return new v(3404,!1)}function _n(s){return new v(3502,!1)}function Ni(s){return new v(3503,!1)}function Mi(){return new v(3300,!1)}function Ci(s){return new v(3504,!1)}function Di(s){return new v(3301,!1)}function Ri(s,e){return new v(3302,!1)}function ki(s){return new v(3303,!1)}function Oi(s,e){return new v(3400,!1)}function Ii(s){return new v(3401,!1)}function Fi(s){return new v(3402,!1)}function Li(s,e){return new v(3505,!1)}function V(s){switch(s.length){case 0:return new x;case 1:return s[0];default:return new Ae(s)}}function tt(s,e,t=new Map,i=new Map){let n=[],r=[],o=-1,a=null;if(e.forEach(l=>{let c=l.get("offset"),h=c==o,u=h&&a||new Map;l.forEach((_,y)=>{let m=y,g=_;if(y!=="offset")switch(m=s.normalizePropertyName(m,n),g){case ce:g=t.get(y);break;case K:g=i.get(y);break;default:g=s.normalizeStyleValue(y,m,g,n);break}u.set(m,g)}),h||r.push(u),a=u,o=c}),n.length)throw _n(n);return r}function Pe(s,e,t,i){switch(e){case"start":s.onStart(()=>i(t&&Ze(t,"start",s)));break;case"done":s.onDone(()=>i(t&&Ze(t,"done",s)));break;case"destroy":s.onDestroy(()=>i(t&&Ze(t,"destroy",s)));break}}function Ze(s,e,t){let i=t.totalTime,n=!!t.disabled,r=Ne(s.element,s.triggerName,s.fromState,s.toState,e||s.phaseName,i??s.totalTime,n),o=s._data;return o!=null&&(r._data=o),r}function Ne(s,e,t,i,n="",r=0,o){return{element:s,triggerName:e,fromState:t,toState:i,phaseName:n,totalTime:r,disabled:!!o}}function k(s,e,t){let i=s.get(e);return i||s.set(e,i=t),i}function it(s){let e=s.indexOf(":"),t=s.substring(1,e),i=s.slice(e+1);return[t,i]}var Sn=typeof document>"u"?null:document.documentElement;function Me(s){let e=s.parentNode||s.host||null;return e===Sn?null:e}function En(s){return s.substring(1,6)=="ebkit"}var Z=null,hi=!1;function zi(s){Z||(Z=vn()||{},hi=Z.style?"WebkitAppearance"in Z.style:!1);let e=!0;return Z.style&&!En(s)&&(e=s in Z.style,!e&&hi&&(e="Webkit"+s.charAt(0).toUpperCase()+s.slice(1)in Z.style)),e}function vn(){return typeof document<"u"?document.body:null}function nt(s,e){for(;e;){if(e===s)return!0;e=Me(e)}return!1}function st(s,e,t){if(t)return Array.from(s.querySelectorAll(e));let i=s.querySelector(e);return i?[i]:[]}var Tn=1e3,rt="{{",An="}}",ot="ng-enter",Ce="ng-leave",ue="ng-trigger",he=".ng-trigger",at="ng-animating",De=".ng-animating";function U(s){if(typeof s=="number")return s;let e=s.match(/^(-?[\.\d]+)(m?s)/);return!e||e.length<2?0:Je(parseFloat(e[1]),e[2])}function Je(s,e){return e==="s"?s*Tn:s}function de(s,e,t){return s.hasOwnProperty("duration")?s:bn(s,e,t)}var wn=/^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i;function bn(s,e,t){let i,n=0,r="";if(typeof s=="string"){let o=s.match(wn);if(o===null)return e.push(ui(s)),{duration:0,delay:0,easing:""};i=Je(parseFloat(o[1]),o[2]);let a=o[3];a!=null&&(n=Je(parseFloat(a),o[4]));let l=o[5];l&&(r=l)}else i=s;if(!t){let o=!1,a=e.length;i<0&&(e.push(mn()),o=!0),n<0&&(e.push(fn()),o=!0),o&&e.splice(a,0,ui(s))}return{duration:i,delay:n,easing:r}}function Ki(s){return s.length?s[0]instanceof Map?s:s.map(e=>new Map(Object.entries(e))):[]}function j(s,e,t){e.forEach((i,n)=>{let r=Re(n);t&&!t.has(n)&&t.set(n,s.style[r]),s.style[r]=i})}function W(s,e){e.forEach((t,i)=>{let n=Re(i);s.style[n]=""})}function re(s){return Array.isArray(s)?s.length==1?s[0]:ii(s):s}function ji(s,e,t){let i=e.params||{},n=lt(s);n.length&&n.forEach(r=>{i.hasOwnProperty(r)||t.push(pn(r))})}var et=new RegExp(`${rt}\\s*(.+?)\\s*${An}`,"g");function lt(s){let e=[];if(typeof s=="string"){let t;for(;t=et.exec(s);)e.push(t[1]);et.lastIndex=0}return e}function oe(s,e,t){let i=`${s}`,n=i.replace(et,(r,o)=>{let a=e[o];return a==null&&(t.push(gn(o)),a=""),a.toString()});return n==i?s:n}var Pn=/-+([a-z0-9])/g;function Re(s){return s.replace(Pn,(...e)=>e[1].toUpperCase())}function Bi(s,e){return s===0||e===0}function qi(s,e,t){if(t.size&&e.length){let i=e[0],n=[];if(t.forEach((r,o)=>{i.has(o)||n.push(o),i.set(o,r)}),n.length)for(let r=1;r<e.length;r++){let o=e[r];n.forEach(a=>o.set(a,ke(s,a)))}}return e}function O(s,e,t){switch(e.type){case S.Trigger:return s.visitTrigger(e,t);case S.State:return s.visitState(e,t);case S.Transition:return s.visitTransition(e,t);case S.Sequence:return s.visitSequence(e,t);case S.Group:return s.visitGroup(e,t);case S.Animate:return s.visitAnimate(e,t);case S.Keyframes:return s.visitKeyframes(e,t);case S.Style:return s.visitStyle(e,t);case S.Reference:return s.visitReference(e,t);case S.AnimateChild:return s.visitAnimateChild(e,t);case S.AnimateRef:return s.visitAnimateRef(e,t);case S.Query:return s.visitQuery(e,t);case S.Stagger:return s.visitStagger(e,t);default:throw yn(e.type)}}function ke(s,e){return window.getComputedStyle(s)[e]}var bt=(()=>{class s{validateStyleProperty(t){return zi(t)}containsElement(t,i){return nt(t,i)}getParentElement(t){return Me(t)}query(t,i,n){return st(t,i,n)}computeStyle(t,i,n){return n||""}animate(t,i,n,r,o,a=[],l){return new x(n,r)}static \u0275fac=function(i){return new(i||s)};static \u0275prov=Ee({token:s,factory:s.\u0275fac})}return s})(),ee=class{static NOOP=new bt},te=class{};var Nn=new Set(["width","height","minWidth","minHeight","maxWidth","maxHeight","left","top","bottom","right","fontSize","outlineWidth","outlineOffset","paddingTop","paddingLeft","paddingBottom","paddingRight","marginTop","marginLeft","marginBottom","marginRight","borderRadius","borderWidth","borderTopWidth","borderLeftWidth","borderRightWidth","borderBottomWidth","textIndent","perspective"]),ze=class extends te{normalizePropertyName(e,t){return Re(e)}normalizeStyleValue(e,t,i,n){let r="",o=i.toString().trim();if(Nn.has(t)&&i!==0&&i!=="0")if(typeof i=="number")r="px";else{let a=i.match(/^[+-]?[\d\.]+([a-z]*)$/);a&&a[1].length==0&&n.push(di(e,i))}return o+r}};var Ke="*";function Mn(s,e){let t=[];return typeof s=="string"?s.split(/\s*,\s*/).forEach(i=>Cn(i,t,e)):t.push(s),t}function Cn(s,e,t){if(s[0]==":"){let l=Dn(s,t);if(typeof l=="function"){e.push(l);return}s=l}let i=s.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/);if(i==null||i.length<4)return t.push(wi(s)),e;let n=i[1],r=i[2],o=i[3];e.push(Qi(n,o));let a=n==Ke&&o==Ke;r[0]=="<"&&!a&&e.push(Qi(o,n))}function Dn(s,e){switch(s){case":enter":return"void => *";case":leave":return"* => void";case":increment":return(t,i)=>parseFloat(i)>parseFloat(t);case":decrement":return(t,i)=>parseFloat(i)<parseFloat(t);default:return e.push(bi(s)),"* => *"}}var Oe=new Set(["true","1"]),Ie=new Set(["false","0"]);function Qi(s,e){let t=Oe.has(s)||Ie.has(s),i=Oe.has(e)||Ie.has(e);return(n,r)=>{let o=s==Ke||s==n,a=e==Ke||e==r;return!o&&t&&typeof n=="boolean"&&(o=n?Oe.has(s):Ie.has(s)),!a&&i&&typeof r=="boolean"&&(a=r?Oe.has(e):Ie.has(e)),o&&a}}var Ji=":self",Rn=new RegExp(`s*${Ji}s*,?`,"g");function en(s,e,t,i){return new ft(s).build(e,t,i)}var Ui="",ft=class{_driver;constructor(e){this._driver=e}build(e,t,i){let n=new pt(t);return this._resetContextStyleTimingState(n),O(this,re(e),n)}_resetContextStyleTimingState(e){e.currentQuerySelector=Ui,e.collectedStyles=new Map,e.collectedStyles.set(Ui,new Map),e.currentTime=0}visitTrigger(e,t){let i=t.queryCount=0,n=t.depCount=0,r=[],o=[];return e.name.charAt(0)=="@"&&t.errors.push(mi()),e.definitions.forEach(a=>{if(this._resetContextStyleTimingState(t),a.type==S.State){let l=a,c=l.name;c.toString().split(/\s*,\s*/).forEach(h=>{l.name=h,r.push(this.visitState(l,t))}),l.name=c}else if(a.type==S.Transition){let l=this.visitTransition(a,t);i+=l.queryCount,n+=l.depCount,o.push(l)}else t.errors.push(fi())}),{type:S.Trigger,name:e.name,states:r,transitions:o,queryCount:i,depCount:n,options:null}}visitState(e,t){let i=this.visitStyle(e.styles,t),n=e.options&&e.options.params||null;if(i.containsDynamicStyles){let r=new Set,o=n||{};i.styles.forEach(a=>{a instanceof Map&&a.forEach(l=>{lt(l).forEach(c=>{o.hasOwnProperty(c)||r.add(c)})})}),r.size&&t.errors.push(pi(e.name,[...r.values()]))}return{type:S.State,name:e.name,style:i,options:n?{params:n}:null}}visitTransition(e,t){t.queryCount=0,t.depCount=0;let i=O(this,re(e.animation),t),n=Mn(e.expr,t.errors);return{type:S.Transition,matchers:n,animation:i,queryCount:t.queryCount,depCount:t.depCount,options:J(e.options)}}visitSequence(e,t){return{type:S.Sequence,steps:e.steps.map(i=>O(this,i,t)),options:J(e.options)}}visitGroup(e,t){let i=t.currentTime,n=0,r=e.steps.map(o=>{t.currentTime=i;let a=O(this,o,t);return n=Math.max(n,t.currentTime),a});return t.currentTime=n,{type:S.Group,steps:r,options:J(e.options)}}visitAnimate(e,t){let i=Fn(e.timings,t.errors);t.currentAnimateTimings=i;let n,r=e.styles?e.styles:xe({});if(r.type==S.Keyframes)n=this.visitKeyframes(r,t);else{let o=e.styles,a=!1;if(!o){a=!0;let c={};i.easing&&(c.easing=i.easing),o=xe(c)}t.currentTime+=i.duration+i.delay;let l=this.visitStyle(o,t);l.isEmptyStep=a,n=l}return t.currentAnimateTimings=null,{type:S.Animate,timings:i,style:n,options:null}}visitStyle(e,t){let i=this._makeStyleAst(e,t);return this._validateStyleAst(i,t),i}_makeStyleAst(e,t){let i=[],n=Array.isArray(e.styles)?e.styles:[e.styles];for(let a of n)typeof a=="string"?a===K?i.push(a):t.errors.push(gi(a)):i.push(new Map(Object.entries(a)));let r=!1,o=null;return i.forEach(a=>{if(a instanceof Map&&(a.has("easing")&&(o=a.get("easing"),a.delete("easing")),!r)){for(let l of a.values())if(l.toString().indexOf(rt)>=0){r=!0;break}}}),{type:S.Style,styles:i,easing:o,offset:e.offset,containsDynamicStyles:r,options:null}}_validateStyleAst(e,t){let i=t.currentAnimateTimings,n=t.currentTime,r=t.currentTime;i&&r>0&&(r-=i.duration+i.delay),e.styles.forEach(o=>{typeof o!="string"&&o.forEach((a,l)=>{let c=t.collectedStyles.get(t.currentQuerySelector),h=c.get(l),u=!0;h&&(r!=n&&r>=h.startTime&&n<=h.endTime&&(t.errors.push(yi(l,h.startTime,h.endTime,r,n)),u=!1),r=h.startTime),u&&c.set(l,{startTime:r,endTime:n}),t.options&&ji(a,t.options,t.errors)})})}visitKeyframes(e,t){let i={type:S.Keyframes,styles:[],options:null};if(!t.currentAnimateTimings)return t.errors.push(_i()),i;let n=1,r=0,o=[],a=!1,l=!1,c=0,h=e.steps.map(w=>{let b=this._makeStyleAst(w,t),C=b.offset!=null?b.offset:In(b.styles),N=0;return C!=null&&(r++,N=b.offset=C),l=l||N<0||N>1,a=a||N<c,c=N,o.push(N),b});l&&t.errors.push(Si()),a&&t.errors.push(Ei());let u=e.steps.length,_=0;r>0&&r<u?t.errors.push(vi()):r==0&&(_=n/(u-1));let y=u-1,m=t.currentTime,g=t.currentAnimateTimings,T=g.duration;return h.forEach((w,b)=>{let C=_>0?b==y?1:_*b:o[b],N=C*T;t.currentTime=m+g.delay+N,g.duration=N,this._validateStyleAst(w,t),w.offset=C,i.styles.push(w)}),i}visitReference(e,t){return{type:S.Reference,animation:O(this,re(e.animation),t),options:J(e.options)}}visitAnimateChild(e,t){return t.depCount++,{type:S.AnimateChild,options:J(e.options)}}visitAnimateRef(e,t){return{type:S.AnimateRef,animation:this.visitReference(e.animation,t),options:J(e.options)}}visitQuery(e,t){let i=t.currentQuerySelector,n=e.options||{};t.queryCount++,t.currentQuery=e;let[r,o]=kn(e.selector);t.currentQuerySelector=i.length?i+" "+r:r,k(t.collectedStyles,t.currentQuerySelector,new Map);let a=O(this,re(e.animation),t);return t.currentQuery=null,t.currentQuerySelector=i,{type:S.Query,selector:r,limit:n.limit||0,optional:!!n.optional,includeSelf:o,animation:a,originalSelector:e.selector,options:J(e.options)}}visitStagger(e,t){t.currentQuery||t.errors.push(Ti());let i=e.timings==="full"?{duration:0,delay:0,easing:"full"}:de(e.timings,t.errors,!0);return{type:S.Stagger,animation:O(this,re(e.animation),t),timings:i,options:null}}};function kn(s){let e=!!s.split(/\s*,\s*/).find(t=>t==Ji);return e&&(s=s.replace(Rn,"")),s=s.replace(/@\*/g,he).replace(/@\w+/g,t=>he+"-"+t.slice(1)).replace(/:animating/g,De),[s,e]}function On(s){return s?_e({},s):null}var pt=class{errors;queryCount=0;depCount=0;currentTransition=null;currentQuery=null;currentQuerySelector=null;currentAnimateTimings=null;currentTime=0;collectedStyles=new Map;options=null;unsupportedCSSPropertiesFound=new Set;constructor(e){this.errors=e}};function In(s){if(typeof s=="string")return null;let e=null;if(Array.isArray(s))s.forEach(t=>{if(t instanceof Map&&t.has("offset")){let i=t;e=parseFloat(i.get("offset")),i.delete("offset")}});else if(s instanceof Map&&s.has("offset")){let t=s;e=parseFloat(t.get("offset")),t.delete("offset")}return e}function Fn(s,e){if(s.hasOwnProperty("duration"))return s;if(typeof s=="number"){let r=de(s,e).duration;return ct(r,0,"")}let t=s;if(t.split(/\s+/).some(r=>r.charAt(0)=="{"&&r.charAt(1)=="{")){let r=ct(0,0,"");return r.dynamic=!0,r.strValue=t,r}let n=de(t,e);return ct(n.duration,n.delay,n.easing)}function J(s){return s?(s=_e({},s),s.params&&(s.params=On(s.params))):s={},s}function ct(s,e,t){return{duration:s,delay:e,easing:t}}function Pt(s,e,t,i,n,r,o=null,a=!1){return{type:1,element:s,keyframes:e,preStyleProps:t,postStyleProps:i,duration:n,delay:r,totalTime:n+r,easing:o,subTimeline:a}}var fe=class{_map=new Map;get(e){return this._map.get(e)||[]}append(e,t){let i=this._map.get(e);i||this._map.set(e,i=[]),i.push(...t)}has(e){return this._map.has(e)}clear(){this._map.clear()}},Ln=1,zn=":enter",Kn=new RegExp(zn,"g"),jn=":leave",Bn=new RegExp(jn,"g");function tn(s,e,t,i,n,r=new Map,o=new Map,a,l,c=[]){return new gt().buildKeyframes(s,e,t,i,n,r,o,a,l,c)}var gt=class{buildKeyframes(e,t,i,n,r,o,a,l,c,h=[]){c=c||new fe;let u=new yt(e,t,c,n,r,h,[]);u.options=l;let _=l.delay?U(l.delay):0;u.currentTimeline.delayNextStep(_),u.currentTimeline.setStyles([o],null,u.errors,l),O(this,i,u);let y=u.timelines.filter(m=>m.containsAnimation());if(y.length&&a.size){let m;for(let g=y.length-1;g>=0;g--){let T=y[g];if(T.element===t){m=T;break}}m&&!m.allowOnlyTimelineStyles()&&m.setStyles([a],null,u.errors,l)}return y.length?y.map(m=>m.buildKeyframes()):[Pt(t,[],[],[],0,_,"",!1)]}visitTrigger(e,t){}visitState(e,t){}visitTransition(e,t){}visitAnimateChild(e,t){let i=t.subInstructions.get(t.element);if(i){let n=t.createSubContext(e.options),r=t.currentTimeline.currentTime,o=this._visitSubInstructions(i,n,n.options);r!=o&&t.transformIntoNewTimeline(o)}t.previousNode=e}visitAnimateRef(e,t){let i=t.createSubContext(e.options);i.transformIntoNewTimeline(),this._applyAnimationRefDelays([e.options,e.animation.options],t,i),this.visitReference(e.animation,i),t.transformIntoNewTimeline(i.currentTimeline.currentTime),t.previousNode=e}_applyAnimationRefDelays(e,t,i){for(let n of e){let r=n?.delay;if(r){let o=typeof r=="number"?r:U(oe(r,n?.params??{},t.errors));i.delayNextStep(o)}}}_visitSubInstructions(e,t,i){let r=t.currentTimeline.currentTime,o=i.duration!=null?U(i.duration):null,a=i.delay!=null?U(i.delay):null;return o!==0&&e.forEach(l=>{let c=t.appendInstructionToTimeline(l,o,a);r=Math.max(r,c.duration+c.delay)}),r}visitReference(e,t){t.updateOptions(e.options,!0),O(this,e.animation,t),t.previousNode=e}visitSequence(e,t){let i=t.subContextCount,n=t,r=e.options;if(r&&(r.params||r.delay)&&(n=t.createSubContext(r),n.transformIntoNewTimeline(),r.delay!=null)){n.previousNode.type==S.Style&&(n.currentTimeline.snapshotCurrentStyles(),n.previousNode=je);let o=U(r.delay);n.delayNextStep(o)}e.steps.length&&(e.steps.forEach(o=>O(this,o,n)),n.currentTimeline.applyStylesToKeyframe(),n.subContextCount>i&&n.transformIntoNewTimeline()),t.previousNode=e}visitGroup(e,t){let i=[],n=t.currentTimeline.currentTime,r=e.options&&e.options.delay?U(e.options.delay):0;e.steps.forEach(o=>{let a=t.createSubContext(e.options);r&&a.delayNextStep(r),O(this,o,a),n=Math.max(n,a.currentTimeline.currentTime),i.push(a.currentTimeline)}),i.forEach(o=>t.currentTimeline.mergeTimelineCollectedStyles(o)),t.transformIntoNewTimeline(n),t.previousNode=e}_visitTiming(e,t){if(e.dynamic){let i=e.strValue,n=t.params?oe(i,t.params,t.errors):i;return de(n,t.errors)}else return{duration:e.duration,delay:e.delay,easing:e.easing}}visitAnimate(e,t){let i=t.currentAnimateTimings=this._visitTiming(e.timings,t),n=t.currentTimeline;i.delay&&(t.incrementTime(i.delay),n.snapshotCurrentStyles());let r=e.style;r.type==S.Keyframes?this.visitKeyframes(r,t):(t.incrementTime(i.duration),this.visitStyle(r,t),n.applyStylesToKeyframe()),t.currentAnimateTimings=null,t.previousNode=e}visitStyle(e,t){let i=t.currentTimeline,n=t.currentAnimateTimings;!n&&i.hasCurrentStyleProperties()&&i.forwardFrame();let r=n&&n.easing||e.easing;e.isEmptyStep?i.applyEmptyStep(r):i.setStyles(e.styles,r,t.errors,t.options),t.previousNode=e}visitKeyframes(e,t){let i=t.currentAnimateTimings,n=t.currentTimeline.duration,r=i.duration,a=t.createSubContext().currentTimeline;a.easing=i.easing,e.styles.forEach(l=>{let c=l.offset||0;a.forwardTime(c*r),a.setStyles(l.styles,l.easing,t.errors,t.options),a.applyStylesToKeyframe()}),t.currentTimeline.mergeTimelineCollectedStyles(a),t.transformIntoNewTimeline(n+r),t.previousNode=e}visitQuery(e,t){let i=t.currentTimeline.currentTime,n=e.options||{},r=n.delay?U(n.delay):0;r&&(t.previousNode.type===S.Style||i==0&&t.currentTimeline.hasCurrentStyleProperties())&&(t.currentTimeline.snapshotCurrentStyles(),t.previousNode=je);let o=i,a=t.invokeQuery(e.selector,e.originalSelector,e.limit,e.includeSelf,!!n.optional,t.errors);t.currentQueryTotal=a.length;let l=null;a.forEach((c,h)=>{t.currentQueryIndex=h;let u=t.createSubContext(e.options,c);r&&u.delayNextStep(r),c===t.element&&(l=u.currentTimeline),O(this,e.animation,u),u.currentTimeline.applyStylesToKeyframe();let _=u.currentTimeline.currentTime;o=Math.max(o,_)}),t.currentQueryIndex=0,t.currentQueryTotal=0,t.transformIntoNewTimeline(o),l&&(t.currentTimeline.mergeTimelineCollectedStyles(l),t.currentTimeline.snapshotCurrentStyles()),t.previousNode=e}visitStagger(e,t){let i=t.parentContext,n=t.currentTimeline,r=e.timings,o=Math.abs(r.duration),a=o*(t.currentQueryTotal-1),l=o*t.currentQueryIndex;switch(r.duration<0?"reverse":r.easing){case"reverse":l=a-l;break;case"full":l=i.currentStaggerTime;break}let h=t.currentTimeline;l&&h.delayNextStep(l);let u=h.currentTime;O(this,e.animation,t),t.previousNode=e,i.currentStaggerTime=n.currentTime-u+(n.startTime-i.currentTimeline.startTime)}},je={},yt=class s{_driver;element;subInstructions;_enterClassName;_leaveClassName;errors;timelines;parentContext=null;currentTimeline;currentAnimateTimings=null;previousNode=je;subContextCount=0;options={};currentQueryIndex=0;currentQueryTotal=0;currentStaggerTime=0;constructor(e,t,i,n,r,o,a,l){this._driver=e,this.element=t,this.subInstructions=i,this._enterClassName=n,this._leaveClassName=r,this.errors=o,this.timelines=a,this.currentTimeline=l||new Be(this._driver,t,0),a.push(this.currentTimeline)}get params(){return this.options.params}updateOptions(e,t){if(!e)return;let i=e,n=this.options;i.duration!=null&&(n.duration=U(i.duration)),i.delay!=null&&(n.delay=U(i.delay));let r=i.params;if(r){let o=n.params;o||(o=this.options.params={}),Object.keys(r).forEach(a=>{(!t||!o.hasOwnProperty(a))&&(o[a]=oe(r[a],o,this.errors))})}}_copyOptions(){let e={};if(this.options){let t=this.options.params;if(t){let i=e.params={};Object.keys(t).forEach(n=>{i[n]=t[n]})}}return e}createSubContext(e=null,t,i){let n=t||this.element,r=new s(this._driver,n,this.subInstructions,this._enterClassName,this._leaveClassName,this.errors,this.timelines,this.currentTimeline.fork(n,i||0));return r.previousNode=this.previousNode,r.currentAnimateTimings=this.currentAnimateTimings,r.options=this._copyOptions(),r.updateOptions(e),r.currentQueryIndex=this.currentQueryIndex,r.currentQueryTotal=this.currentQueryTotal,r.parentContext=this,this.subContextCount++,r}transformIntoNewTimeline(e){return this.previousNode=je,this.currentTimeline=this.currentTimeline.fork(this.element,e),this.timelines.push(this.currentTimeline),this.currentTimeline}appendInstructionToTimeline(e,t,i){let n={duration:t??e.duration,delay:this.currentTimeline.currentTime+(i??0)+e.delay,easing:""},r=new _t(this._driver,e.element,e.keyframes,e.preStyleProps,e.postStyleProps,n,e.stretchStartingKeyframe);return this.timelines.push(r),n}incrementTime(e){this.currentTimeline.forwardTime(this.currentTimeline.duration+e)}delayNextStep(e){e>0&&this.currentTimeline.delayNextStep(e)}invokeQuery(e,t,i,n,r,o){let a=[];if(n&&a.push(this.element),e.length>0){e=e.replace(Kn,"."+this._enterClassName),e=e.replace(Bn,"."+this._leaveClassName);let l=i!=1,c=this._driver.query(this.element,e,l);i!==0&&(c=i<0?c.slice(c.length+i,c.length):c.slice(0,i)),a.push(...c)}return!r&&a.length==0&&o.push(Ai(t)),a}},Be=class s{_driver;element;startTime;_elementTimelineStylesLookup;duration=0;easing=null;_previousKeyframe=new Map;_currentKeyframe=new Map;_keyframes=new Map;_styleSummary=new Map;_localTimelineStyles=new Map;_globalTimelineStyles;_pendingStyles=new Map;_backFill=new Map;_currentEmptyStepKeyframe=null;constructor(e,t,i,n){this._driver=e,this.element=t,this.startTime=i,this._elementTimelineStylesLookup=n,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(t),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(t,this._localTimelineStyles)),this._loadKeyframe()}containsAnimation(){switch(this._keyframes.size){case 0:return!1;case 1:return this.hasCurrentStyleProperties();default:return!0}}hasCurrentStyleProperties(){return this._currentKeyframe.size>0}get currentTime(){return this.startTime+this.duration}delayNextStep(e){let t=this._keyframes.size===1&&this._pendingStyles.size;this.duration||t?(this.forwardTime(this.currentTime+e),t&&this.snapshotCurrentStyles()):this.startTime+=e}fork(e,t){return this.applyStylesToKeyframe(),new s(this._driver,e,t||this.currentTime,this._elementTimelineStylesLookup)}_loadKeyframe(){this._currentKeyframe&&(this._previousKeyframe=this._currentKeyframe),this._currentKeyframe=this._keyframes.get(this.duration),this._currentKeyframe||(this._currentKeyframe=new Map,this._keyframes.set(this.duration,this._currentKeyframe))}forwardFrame(){this.duration+=Ln,this._loadKeyframe()}forwardTime(e){this.applyStylesToKeyframe(),this.duration=e,this._loadKeyframe()}_updateStyle(e,t){this._localTimelineStyles.set(e,t),this._globalTimelineStyles.set(e,t),this._styleSummary.set(e,{time:this.currentTime,value:t})}allowOnlyTimelineStyles(){return this._currentEmptyStepKeyframe!==this._currentKeyframe}applyEmptyStep(e){e&&this._previousKeyframe.set("easing",e);for(let[t,i]of this._globalTimelineStyles)this._backFill.set(t,i||K),this._currentKeyframe.set(t,K);this._currentEmptyStepKeyframe=this._currentKeyframe}setStyles(e,t,i,n){t&&this._previousKeyframe.set("easing",t);let r=n&&n.params||{},o=qn(e,this._globalTimelineStyles);for(let[a,l]of o){let c=oe(l,r,i);this._pendingStyles.set(a,c),this._localTimelineStyles.has(a)||this._backFill.set(a,this._globalTimelineStyles.get(a)??K),this._updateStyle(a,c)}}applyStylesToKeyframe(){this._pendingStyles.size!=0&&(this._pendingStyles.forEach((e,t)=>{this._currentKeyframe.set(t,e)}),this._pendingStyles.clear(),this._localTimelineStyles.forEach((e,t)=>{this._currentKeyframe.has(t)||this._currentKeyframe.set(t,e)}))}snapshotCurrentStyles(){for(let[e,t]of this._localTimelineStyles)this._pendingStyles.set(e,t),this._updateStyle(e,t)}getFinalKeyframe(){return this._keyframes.get(this.duration)}get properties(){let e=[];for(let t in this._currentKeyframe)e.push(t);return e}mergeTimelineCollectedStyles(e){e._styleSummary.forEach((t,i)=>{let n=this._styleSummary.get(i);(!n||t.time>n.time)&&this._updateStyle(i,t.value)})}buildKeyframes(){this.applyStylesToKeyframe();let e=new Set,t=new Set,i=this._keyframes.size===1&&this.duration===0,n=[];this._keyframes.forEach((a,l)=>{let c=new Map([...this._backFill,...a]);c.forEach((h,u)=>{h===ce?e.add(u):h===K&&t.add(u)}),i||c.set("offset",l/this.duration),n.push(c)});let r=[...e.values()],o=[...t.values()];if(i){let a=n[0],l=new Map(a);a.set("offset",0),l.set("offset",1),n=[a,l]}return Pt(this.element,n,r,o,this.duration,this.startTime,this.easing,!1)}},_t=class extends Be{keyframes;preStyleProps;postStyleProps;_stretchStartingKeyframe;timings;constructor(e,t,i,n,r,o,a=!1){super(e,t,o.delay),this.keyframes=i,this.preStyleProps=n,this.postStyleProps=r,this._stretchStartingKeyframe=a,this.timings={duration:o.duration,delay:o.delay,easing:o.easing}}containsAnimation(){return this.keyframes.length>1}buildKeyframes(){let e=this.keyframes,{delay:t,duration:i,easing:n}=this.timings;if(this._stretchStartingKeyframe&&t){let r=[],o=i+t,a=t/o,l=new Map(e[0]);l.set("offset",0),r.push(l);let c=new Map(e[0]);c.set("offset",Vi(a)),r.push(c);let h=e.length-1;for(let u=1;u<=h;u++){let _=new Map(e[u]),y=_.get("offset"),m=t+y*i;_.set("offset",Vi(m/o)),r.push(_)}i=o,t=0,n="",e=r}return Pt(this.element,e,this.preStyleProps,this.postStyleProps,i,t,n,!0)}};function Vi(s,e=3){let t=Math.pow(10,e-1);return Math.round(s*t)/t}function qn(s,e){let t=new Map,i;return s.forEach(n=>{if(n==="*"){i??=e.keys();for(let r of i)t.set(r,K)}else for(let[r,o]of n)t.set(r,o)}),t}function $i(s,e,t,i,n,r,o,a,l,c,h,u,_){return{type:0,element:s,triggerName:e,isRemovalTransition:n,fromState:t,fromStyles:r,toState:i,toStyles:o,timelines:a,queriedElements:l,preStyleProps:c,postStyleProps:h,totalTime:u,errors:_}}var ut={},qe=class{_triggerName;ast;_stateStyles;constructor(e,t,i){this._triggerName=e,this.ast=t,this._stateStyles=i}match(e,t,i,n){return Qn(this.ast.matchers,e,t,i,n)}buildStyles(e,t,i){let n=this._stateStyles.get("*");return e!==void 0&&(n=this._stateStyles.get(e?.toString())||n),n?n.buildStyles(t,i):new Map}build(e,t,i,n,r,o,a,l,c,h){let u=[],_=this.ast.options&&this.ast.options.params||ut,y=a&&a.params||ut,m=this.buildStyles(i,y,u),g=l&&l.params||ut,T=this.buildStyles(n,g,u),w=new Set,b=new Map,C=new Map,N=n==="void",ne={params:nn(g,_),delay:this.ast.options?.delay},q=h?[]:tn(e,t,this.ast.animation,r,o,m,T,ne,c,u),D=0;return q.forEach(R=>{D=Math.max(R.duration+R.delay,D)}),u.length?$i(t,this._triggerName,i,n,N,m,T,[],[],b,C,D,u):(q.forEach(R=>{let H=R.element,se=k(b,H,new Set);R.preStyleProps.forEach(Y=>se.add(Y));let Nt=k(C,H,new Set);R.postStyleProps.forEach(Y=>Nt.add(Y)),H!==t&&w.add(H)}),$i(t,this._triggerName,i,n,N,m,T,q,[...w.values()],b,C,D))}};function Qn(s,e,t,i,n){return s.some(r=>r(e,t,i,n))}function nn(s,e){let t=_e({},e);return Object.entries(s).forEach(([i,n])=>{n!=null&&(t[i]=n)}),t}var St=class{styles;defaultParams;normalizer;constructor(e,t,i){this.styles=e,this.defaultParams=t,this.normalizer=i}buildStyles(e,t){let i=new Map,n=nn(e,this.defaultParams);return this.styles.styles.forEach(r=>{typeof r!="string"&&r.forEach((o,a)=>{o&&(o=oe(o,n,t));let l=this.normalizer.normalizePropertyName(a,t);o=this.normalizer.normalizeStyleValue(a,l,o,t),i.set(a,o)})}),i}};function Un(s,e,t){return new Et(s,e,t)}var Et=class{name;ast;_normalizer;transitionFactories=[];fallbackTransition;states=new Map;constructor(e,t,i){this.name=e,this.ast=t,this._normalizer=i,t.states.forEach(n=>{let r=n.options&&n.options.params||{};this.states.set(n.name,new St(n.style,r,i))}),Gi(this.states,"true","1"),Gi(this.states,"false","0"),t.transitions.forEach(n=>{this.transitionFactories.push(new qe(e,n,this.states))}),this.fallbackTransition=Vn(e,this.states)}get containsQueries(){return this.ast.queryCount>0}matchTransition(e,t,i,n){return this.transitionFactories.find(o=>o.match(e,t,i,n))||null}matchStyles(e,t,i){return this.fallbackTransition.buildStyles(e,t,i)}};function Vn(s,e,t){let i=[(o,a)=>!0],n={type:S.Sequence,steps:[],options:null},r={type:S.Transition,animation:n,matchers:i,options:null,queryCount:0,depCount:0};return new qe(s,r,e)}function Gi(s,e,t){s.has(e)?s.has(t)||s.set(t,s.get(e)):s.has(t)&&s.set(e,s.get(t))}var $n=new fe,vt=class{bodyNode;_driver;_normalizer;_animations=new Map;_playersById=new Map;players=[];constructor(e,t,i){this.bodyNode=e,this._driver=t,this._normalizer=i}register(e,t){let i=[],n=[],r=en(this._driver,t,i,n);if(i.length)throw Ni(i);this._animations.set(e,r)}_buildPlayer(e,t,i){let n=e.element,r=tt(this._normalizer,e.keyframes,t,i);return this._driver.animate(n,r,e.duration,e.delay,e.easing,[],!0)}create(e,t,i={}){let n=[],r=this._animations.get(e),o,a=new Map;if(r?(o=tn(this._driver,t,r,ot,Ce,new Map,new Map,i,$n,n),o.forEach(h=>{let u=k(a,h.element,new Map);h.postStyleProps.forEach(_=>u.set(_,null))})):(n.push(Mi()),o=[]),n.length)throw Ci(n);a.forEach((h,u)=>{h.forEach((_,y)=>{h.set(y,this._driver.computeStyle(u,y,K))})});let l=o.map(h=>{let u=a.get(h.element);return this._buildPlayer(h,new Map,u)}),c=V(l);return this._playersById.set(e,c),c.onDestroy(()=>this.destroy(e)),this.players.push(c),c}destroy(e){let t=this._getPlayer(e);t.destroy(),this._playersById.delete(e);let i=this.players.indexOf(t);i>=0&&this.players.splice(i,1)}_getPlayer(e){let t=this._playersById.get(e);if(!t)throw Di(e);return t}listen(e,t,i,n){let r=Ne(t,"","","");return Pe(this._getPlayer(e),i,r,n),()=>{}}command(e,t,i,n){if(i=="register"){this.register(e,n[0]);return}if(i=="create"){let o=n[0]||{};this.create(e,t,o);return}let r=this._getPlayer(e);switch(i){case"play":r.play();break;case"pause":r.pause();break;case"reset":r.reset();break;case"restart":r.restart();break;case"finish":r.finish();break;case"init":r.init();break;case"setPosition":r.setPosition(parseFloat(n[0]));break;case"destroy":this.destroy(e);break}}},Wi="ng-animate-queued",Gn=".ng-animate-queued",ht="ng-animate-disabled",Wn=".ng-animate-disabled",Hn="ng-star-inserted",Yn=".ng-star-inserted",Xn=[],sn={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},xn={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},B="__ng_removed",pe=class{namespaceId;value;options;get params(){return this.options.params}constructor(e,t=""){this.namespaceId=t;let i=e&&e.hasOwnProperty("value"),n=i?e.value:e;if(this.value=Jn(n),i){let r=e,{value:o}=r,a=Rt(r,["value"]);this.options=a}else this.options={};this.options.params||(this.options.params={})}absorbOptions(e){let t=e.params;if(t){let i=this.options.params;Object.keys(t).forEach(n=>{i[n]==null&&(i[n]=t[n])})}}},me="void",dt=new pe(me),Tt=class{id;hostElement;_engine;players=[];_triggers=new Map;_queue=[];_elementListeners=new Map;_hostClassName;constructor(e,t,i){this.id=e,this.hostElement=t,this._engine=i,this._hostClassName="ng-tns-"+e,L(t,this._hostClassName)}listen(e,t,i,n){if(!this._triggers.has(t))throw Ri(i,t);if(i==null||i.length==0)throw ki(t);if(!es(i))throw Oi(i,t);let r=k(this._elementListeners,e,[]),o={name:t,phase:i,callback:n};r.push(o);let a=k(this._engine.statesByElement,e,new Map);return a.has(t)||(L(e,ue),L(e,ue+"-"+t),a.set(t,dt)),()=>{this._engine.afterFlush(()=>{let l=r.indexOf(o);l>=0&&r.splice(l,1),this._triggers.has(t)||a.delete(t)})}}register(e,t){return this._triggers.has(e)?!1:(this._triggers.set(e,t),!0)}_getTrigger(e){let t=this._triggers.get(e);if(!t)throw Ii(e);return t}trigger(e,t,i,n=!0){let r=this._getTrigger(t),o=new ge(this.id,t,e),a=this._engine.statesByElement.get(e);a||(L(e,ue),L(e,ue+"-"+t),this._engine.statesByElement.set(e,a=new Map));let l=a.get(t),c=new pe(i,this.id);if(!(i&&i.hasOwnProperty("value"))&&l&&c.absorbOptions(l.options),a.set(t,c),l||(l=dt),!(c.value===me)&&l.value===c.value){if(!ns(l.params,c.params)){let g=[],T=r.matchStyles(l.value,l.params,g),w=r.matchStyles(c.value,c.params,g);g.length?this._engine.reportError(g):this._engine.afterFlush(()=>{W(e,T),j(e,w)})}return}let _=k(this._engine.playersByElement,e,[]);_.forEach(g=>{g.namespaceId==this.id&&g.triggerName==t&&g.queued&&g.destroy()});let y=r.matchTransition(l.value,c.value,e,c.params),m=!1;if(!y){if(!n)return;y=r.fallbackTransition,m=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:t,transition:y,fromState:l,toState:c,player:o,isFallbackTransition:m}),m||(L(e,Wi),o.onStart(()=>{ae(e,Wi)})),o.onDone(()=>{let g=this.players.indexOf(o);g>=0&&this.players.splice(g,1);let T=this._engine.playersByElement.get(e);if(T){let w=T.indexOf(o);w>=0&&T.splice(w,1)}}),this.players.push(o),_.push(o),o}deregister(e){this._triggers.delete(e),this._engine.statesByElement.forEach(t=>t.delete(e)),this._elementListeners.forEach((t,i)=>{this._elementListeners.set(i,t.filter(n=>n.name!=e))})}clearElementCache(e){this._engine.statesByElement.delete(e),this._elementListeners.delete(e);let t=this._engine.playersByElement.get(e);t&&(t.forEach(i=>i.destroy()),this._engine.playersByElement.delete(e))}_signalRemovalForInnerTriggers(e,t){let i=this._engine.driver.query(e,he,!0);i.forEach(n=>{if(n[B])return;let r=this._engine.fetchNamespacesByElement(n);r.size?r.forEach(o=>o.triggerLeaveAnimation(n,t,!1,!0)):this.clearElementCache(n)}),this._engine.afterFlushAnimationsDone(()=>i.forEach(n=>this.clearElementCache(n)))}triggerLeaveAnimation(e,t,i,n){let r=this._engine.statesByElement.get(e),o=new Map;if(r){let a=[];if(r.forEach((l,c)=>{if(o.set(c,l.value),this._triggers.has(c)){let h=this.trigger(e,c,me,n);h&&a.push(h)}}),a.length)return this._engine.markElementAsRemoved(this.id,e,!0,t,o),i&&V(a).onDone(()=>this._engine.processLeaveNode(e)),!0}return!1}prepareLeaveAnimationListeners(e){let t=this._elementListeners.get(e),i=this._engine.statesByElement.get(e);if(t&&i){let n=new Set;t.forEach(r=>{let o=r.name;if(n.has(o))return;n.add(o);let l=this._triggers.get(o).fallbackTransition,c=i.get(o)||dt,h=new pe(me),u=new ge(this.id,o,e);this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:o,transition:l,fromState:c,toState:h,player:u,isFallbackTransition:!0})})}}removeNode(e,t){let i=this._engine;if(e.childElementCount&&this._signalRemovalForInnerTriggers(e,t),this.triggerLeaveAnimation(e,t,!0))return;let n=!1;if(i.totalAnimations){let r=i.players.length?i.playersByQueriedElement.get(e):[];if(r&&r.length)n=!0;else{let o=e;for(;o=o.parentNode;)if(i.statesByElement.get(o)){n=!0;break}}}if(this.prepareLeaveAnimationListeners(e),n)i.markElementAsRemoved(this.id,e,!1,t);else{let r=e[B];(!r||r===sn)&&(i.afterFlush(()=>this.clearElementCache(e)),i.destroyInnerAnimations(e),i._onRemovalComplete(e,t))}}insertNode(e,t){L(e,this._hostClassName)}drainQueuedTransitions(e){let t=[];return this._queue.forEach(i=>{let n=i.player;if(n.destroyed)return;let r=i.element,o=this._elementListeners.get(r);o&&o.forEach(a=>{if(a.name==i.triggerName){let l=Ne(r,i.triggerName,i.fromState.value,i.toState.value);l._data=e,Pe(i.player,a.phase,l,a.callback)}}),n.markedForDestroy?this._engine.afterFlush(()=>{n.destroy()}):t.push(i)}),this._queue=[],t.sort((i,n)=>{let r=i.transition.ast.depCount,o=n.transition.ast.depCount;return r==0||o==0?r-o:this._engine.driver.containsElement(i.element,n.element)?1:-1})}destroy(e){this.players.forEach(t=>t.destroy()),this._signalRemovalForInnerTriggers(this.hostElement,e)}},At=class{bodyNode;driver;_normalizer;players=[];newHostElements=new Map;playersByElement=new Map;playersByQueriedElement=new Map;statesByElement=new Map;disabledNodes=new Set;totalAnimations=0;totalQueuedPlayers=0;_namespaceLookup={};_namespaceList=[];_flushFns=[];_whenQuietFns=[];namespacesByHostElement=new Map;collectedEnterElements=[];collectedLeaveElements=[];onRemovalComplete=(e,t)=>{};_onRemovalComplete(e,t){this.onRemovalComplete(e,t)}constructor(e,t,i){this.bodyNode=e,this.driver=t,this._normalizer=i}get queuedPlayers(){let e=[];return this._namespaceList.forEach(t=>{t.players.forEach(i=>{i.queued&&e.push(i)})}),e}createNamespace(e,t){let i=new Tt(e,t,this);return this.bodyNode&&this.driver.containsElement(this.bodyNode,t)?this._balanceNamespaceList(i,t):(this.newHostElements.set(t,i),this.collectEnterElement(t)),this._namespaceLookup[e]=i}_balanceNamespaceList(e,t){let i=this._namespaceList,n=this.namespacesByHostElement;if(i.length-1>=0){let o=!1,a=this.driver.getParentElement(t);for(;a;){let l=n.get(a);if(l){let c=i.indexOf(l);i.splice(c+1,0,e),o=!0;break}a=this.driver.getParentElement(a)}o||i.unshift(e)}else i.push(e);return n.set(t,e),e}register(e,t){let i=this._namespaceLookup[e];return i||(i=this.createNamespace(e,t)),i}registerTrigger(e,t,i){let n=this._namespaceLookup[e];n&&n.register(t,i)&&this.totalAnimations++}destroy(e,t){e&&(this.afterFlush(()=>{}),this.afterFlushAnimationsDone(()=>{let i=this._fetchNamespace(e);this.namespacesByHostElement.delete(i.hostElement);let n=this._namespaceList.indexOf(i);n>=0&&this._namespaceList.splice(n,1),i.destroy(t),delete this._namespaceLookup[e]}))}_fetchNamespace(e){return this._namespaceLookup[e]}fetchNamespacesByElement(e){let t=new Set,i=this.statesByElement.get(e);if(i){for(let n of i.values())if(n.namespaceId){let r=this._fetchNamespace(n.namespaceId);r&&t.add(r)}}return t}trigger(e,t,i,n){if(Fe(t)){let r=this._fetchNamespace(e);if(r)return r.trigger(t,i,n),!0}return!1}insertNode(e,t,i,n){if(!Fe(t))return;let r=t[B];if(r&&r.setForRemoval){r.setForRemoval=!1,r.setForMove=!0;let o=this.collectedLeaveElements.indexOf(t);o>=0&&this.collectedLeaveElements.splice(o,1)}if(e){let o=this._fetchNamespace(e);o&&o.insertNode(t,i)}n&&this.collectEnterElement(t)}collectEnterElement(e){this.collectedEnterElements.push(e)}markElementAsDisabled(e,t){t?this.disabledNodes.has(e)||(this.disabledNodes.add(e),L(e,ht)):this.disabledNodes.has(e)&&(this.disabledNodes.delete(e),ae(e,ht))}removeNode(e,t,i){if(Fe(t)){let n=e?this._fetchNamespace(e):null;n?n.removeNode(t,i):this.markElementAsRemoved(e,t,!1,i);let r=this.namespacesByHostElement.get(t);r&&r.id!==e&&r.removeNode(t,i)}else this._onRemovalComplete(t,i)}markElementAsRemoved(e,t,i,n,r){this.collectedLeaveElements.push(t),t[B]={namespaceId:e,setForRemoval:n,hasAnimation:i,removedBeforeQueried:!1,previousTriggersValues:r}}listen(e,t,i,n,r){return Fe(t)?this._fetchNamespace(e).listen(t,i,n,r):()=>{}}_buildInstruction(e,t,i,n,r){return e.transition.build(this.driver,e.element,e.fromState.value,e.toState.value,i,n,e.fromState.options,e.toState.options,t,r)}destroyInnerAnimations(e){let t=this.driver.query(e,he,!0);t.forEach(i=>this.destroyActiveAnimationsForElement(i)),this.playersByQueriedElement.size!=0&&(t=this.driver.query(e,De,!0),t.forEach(i=>this.finishActiveQueriedAnimationOnElement(i)))}destroyActiveAnimationsForElement(e){let t=this.playersByElement.get(e);t&&t.forEach(i=>{i.queued?i.markedForDestroy=!0:i.destroy()})}finishActiveQueriedAnimationOnElement(e){let t=this.playersByQueriedElement.get(e);t&&t.forEach(i=>i.finish())}whenRenderingDone(){return new Promise(e=>{if(this.players.length)return V(this.players).onDone(()=>e());e()})}processLeaveNode(e){let t=e[B];if(t&&t.setForRemoval){if(e[B]=sn,t.namespaceId){this.destroyInnerAnimations(e);let i=this._fetchNamespace(t.namespaceId);i&&i.clearElementCache(e)}this._onRemovalComplete(e,t.setForRemoval)}e.classList?.contains(ht)&&this.markElementAsDisabled(e,!1),this.driver.query(e,Wn,!0).forEach(i=>{this.markElementAsDisabled(i,!1)})}flush(e=-1){let t=[];if(this.newHostElements.size&&(this.newHostElements.forEach((i,n)=>this._balanceNamespaceList(i,n)),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(let i=0;i<this.collectedEnterElements.length;i++){let n=this.collectedEnterElements[i];L(n,Hn)}if(this._namespaceList.length&&(this.totalQueuedPlayers||this.collectedLeaveElements.length)){let i=[];try{t=this._flushAnimations(i,e)}finally{for(let n=0;n<i.length;n++)i[n]()}}else for(let i=0;i<this.collectedLeaveElements.length;i++){let n=this.collectedLeaveElements[i];this.processLeaveNode(n)}if(this.totalQueuedPlayers=0,this.collectedEnterElements.length=0,this.collectedLeaveElements.length=0,this._flushFns.forEach(i=>i()),this._flushFns=[],this._whenQuietFns.length){let i=this._whenQuietFns;this._whenQuietFns=[],t.length?V(t).onDone(()=>{i.forEach(n=>n())}):i.forEach(n=>n())}}reportError(e){throw Fi(e)}_flushAnimations(e,t){let i=new fe,n=[],r=new Map,o=[],a=new Map,l=new Map,c=new Map,h=new Set;this.disabledNodes.forEach(d=>{h.add(d);let f=this.driver.query(d,Gn,!0);for(let p=0;p<f.length;p++)h.add(f[p])});let u=this.bodyNode,_=Array.from(this.statesByElement.keys()),y=Xi(_,this.collectedEnterElements),m=new Map,g=0;y.forEach((d,f)=>{let p=ot+g++;m.set(f,p),d.forEach(E=>L(E,p))});let T=[],w=new Set,b=new Set;for(let d=0;d<this.collectedLeaveElements.length;d++){let f=this.collectedLeaveElements[d],p=f[B];p&&p.setForRemoval&&(T.push(f),w.add(f),p.hasAnimation?this.driver.query(f,Yn,!0).forEach(E=>w.add(E)):b.add(f))}let C=new Map,N=Xi(_,Array.from(w));N.forEach((d,f)=>{let p=Ce+g++;C.set(f,p),d.forEach(E=>L(E,p))}),e.push(()=>{y.forEach((d,f)=>{let p=m.get(f);d.forEach(E=>ae(E,p))}),N.forEach((d,f)=>{let p=C.get(f);d.forEach(E=>ae(E,p))}),T.forEach(d=>{this.processLeaveNode(d)})});let ne=[],q=[];for(let d=this._namespaceList.length-1;d>=0;d--)this._namespaceList[d].drainQueuedTransitions(t).forEach(p=>{let E=p.player,P=p.element;if(ne.push(E),this.collectedEnterElements.length){let M=P[B];if(M&&M.setForMove){if(M.previousTriggersValues&&M.previousTriggersValues.has(p.triggerName)){let X=M.previousTriggersValues.get(p.triggerName),F=this.statesByElement.get(p.element);if(F&&F.has(p.triggerName)){let ye=F.get(p.triggerName);ye.value=X,F.set(p.triggerName,ye)}}E.destroy();return}}let Q=!u||!this.driver.containsElement(u,P),I=C.get(P),$=m.get(P),A=this._buildInstruction(p,i,$,I,Q);if(A.errors&&A.errors.length){q.push(A);return}if(Q){E.onStart(()=>W(P,A.fromStyles)),E.onDestroy(()=>j(P,A.toStyles)),n.push(E);return}if(p.isFallbackTransition){E.onStart(()=>W(P,A.fromStyles)),E.onDestroy(()=>j(P,A.toStyles)),n.push(E);return}let Dt=[];A.timelines.forEach(M=>{M.stretchStartingKeyframe=!0,this.disabledNodes.has(M.element)||Dt.push(M)}),A.timelines=Dt,i.append(P,A.timelines);let dn={instruction:A,player:E,element:P};o.push(dn),A.queriedElements.forEach(M=>k(a,M,[]).push(E)),A.preStyleProps.forEach((M,X)=>{if(M.size){let F=l.get(X);F||l.set(X,F=new Set),M.forEach((ye,He)=>F.add(He))}}),A.postStyleProps.forEach((M,X)=>{let F=c.get(X);F||c.set(X,F=new Set),M.forEach((ye,He)=>F.add(He))})});if(q.length){let d=[];q.forEach(f=>{d.push(Li(f.triggerName,f.errors))}),ne.forEach(f=>f.destroy()),this.reportError(d)}let D=new Map,R=new Map;o.forEach(d=>{let f=d.element;i.has(f)&&(R.set(f,f),this._beforeAnimationBuild(d.player.namespaceId,d.instruction,D))}),n.forEach(d=>{let f=d.element;this._getPreviousPlayers(f,!1,d.namespaceId,d.triggerName,null).forEach(E=>{k(D,f,[]).push(E),E.destroy()})});let H=T.filter(d=>xi(d,l,c)),se=new Map;Yi(se,this.driver,b,c,K).forEach(d=>{xi(d,l,c)&&H.push(d)});let Y=new Map;y.forEach((d,f)=>{Yi(Y,this.driver,new Set(d),l,ce)}),H.forEach(d=>{let f=se.get(d),p=Y.get(d);se.set(d,new Map([...f?.entries()??[],...p?.entries()??[]]))});let We=[],Mt=[],Ct={};o.forEach(d=>{let{element:f,player:p,instruction:E}=d;if(i.has(f)){if(h.has(f)){p.onDestroy(()=>j(f,E.toStyles)),p.disabled=!0,p.overrideTotalTime(E.totalTime),n.push(p);return}let P=Ct;if(R.size>1){let I=f,$=[];for(;I=I.parentNode;){let A=R.get(I);if(A){P=A;break}$.push(I)}$.forEach(A=>R.set(A,P))}let Q=this._buildAnimation(p.namespaceId,E,D,r,Y,se);if(p.setRealPlayer(Q),P===Ct)We.push(p);else{let I=this.playersByElement.get(P);I&&I.length&&(p.parentPlayer=V(I)),n.push(p)}}else W(f,E.fromStyles),p.onDestroy(()=>j(f,E.toStyles)),Mt.push(p),h.has(f)&&n.push(p)}),Mt.forEach(d=>{let f=r.get(d.element);if(f&&f.length){let p=V(f);d.setRealPlayer(p)}}),n.forEach(d=>{d.parentPlayer?d.syncPlayerEvents(d.parentPlayer):d.destroy()});for(let d=0;d<T.length;d++){let f=T[d],p=f[B];if(ae(f,Ce),p&&p.hasAnimation)continue;let E=[];if(a.size){let Q=a.get(f);Q&&Q.length&&E.push(...Q);let I=this.driver.query(f,De,!0);for(let $=0;$<I.length;$++){let A=a.get(I[$]);A&&A.length&&E.push(...A)}}let P=E.filter(Q=>!Q.destroyed);P.length?ts(this,f,P):this.processLeaveNode(f)}return T.length=0,We.forEach(d=>{this.players.push(d),d.onDone(()=>{d.destroy();let f=this.players.indexOf(d);this.players.splice(f,1)}),d.play()}),We}afterFlush(e){this._flushFns.push(e)}afterFlushAnimationsDone(e){this._whenQuietFns.push(e)}_getPreviousPlayers(e,t,i,n,r){let o=[];if(t){let a=this.playersByQueriedElement.get(e);a&&(o=a)}else{let a=this.playersByElement.get(e);if(a){let l=!r||r==me;a.forEach(c=>{c.queued||!l&&c.triggerName!=n||o.push(c)})}}return(i||n)&&(o=o.filter(a=>!(i&&i!=a.namespaceId||n&&n!=a.triggerName))),o}_beforeAnimationBuild(e,t,i){let n=t.triggerName,r=t.element,o=t.isRemovalTransition?void 0:e,a=t.isRemovalTransition?void 0:n;for(let l of t.timelines){let c=l.element,h=c!==r,u=k(i,c,[]);this._getPreviousPlayers(c,h,o,a,t.toState).forEach(y=>{let m=y.getRealPlayer();m.beforeDestroy&&m.beforeDestroy(),y.destroy(),u.push(y)})}W(r,t.fromStyles)}_buildAnimation(e,t,i,n,r,o){let a=t.triggerName,l=t.element,c=[],h=new Set,u=new Set,_=t.timelines.map(m=>{let g=m.element;h.add(g);let T=g[B];if(T&&T.removedBeforeQueried)return new x(m.duration,m.delay);let w=g!==l,b=is((i.get(g)||Xn).map(D=>D.getRealPlayer())).filter(D=>{let R=D;return R.element?R.element===g:!1}),C=r.get(g),N=o.get(g),ne=tt(this._normalizer,m.keyframes,C,N),q=this._buildPlayer(m,ne,b);if(m.subTimeline&&n&&u.add(g),w){let D=new ge(e,a,g);D.setRealPlayer(q),c.push(D)}return q});c.forEach(m=>{k(this.playersByQueriedElement,m.element,[]).push(m),m.onDone(()=>Zn(this.playersByQueriedElement,m.element,m))}),h.forEach(m=>L(m,at));let y=V(_);return y.onDestroy(()=>{h.forEach(m=>ae(m,at)),j(l,t.toStyles)}),u.forEach(m=>{k(n,m,[]).push(y)}),y}_buildPlayer(e,t,i){return t.length>0?this.driver.animate(e.element,t,e.duration,e.delay,e.easing,i):new x(e.duration,e.delay)}},ge=class{namespaceId;triggerName;element;_player=new x;_containsRealPlayer=!1;_queuedCallbacks=new Map;destroyed=!1;parentPlayer=null;markedForDestroy=!1;disabled=!1;queued=!0;totalTime=0;constructor(e,t,i){this.namespaceId=e,this.triggerName=t,this.element=i}setRealPlayer(e){this._containsRealPlayer||(this._player=e,this._queuedCallbacks.forEach((t,i)=>{t.forEach(n=>Pe(e,i,void 0,n))}),this._queuedCallbacks.clear(),this._containsRealPlayer=!0,this.overrideTotalTime(e.totalTime),this.queued=!1)}getRealPlayer(){return this._player}overrideTotalTime(e){this.totalTime=e}syncPlayerEvents(e){let t=this._player;t.triggerCallback&&e.onStart(()=>t.triggerCallback("start")),e.onDone(()=>this.finish()),e.onDestroy(()=>this.destroy())}_queueEvent(e,t){k(this._queuedCallbacks,e,[]).push(t)}onDone(e){this.queued&&this._queueEvent("done",e),this._player.onDone(e)}onStart(e){this.queued&&this._queueEvent("start",e),this._player.onStart(e)}onDestroy(e){this.queued&&this._queueEvent("destroy",e),this._player.onDestroy(e)}init(){this._player.init()}hasStarted(){return this.queued?!1:this._player.hasStarted()}play(){!this.queued&&this._player.play()}pause(){!this.queued&&this._player.pause()}restart(){!this.queued&&this._player.restart()}finish(){this._player.finish()}destroy(){this.destroyed=!0,this._player.destroy()}reset(){!this.queued&&this._player.reset()}setPosition(e){this.queued||this._player.setPosition(e)}getPosition(){return this.queued?0:this._player.getPosition()}triggerCallback(e){let t=this._player;t.triggerCallback&&t.triggerCallback(e)}};function Zn(s,e,t){let i=s.get(e);if(i){if(i.length){let n=i.indexOf(t);i.splice(n,1)}i.length==0&&s.delete(e)}return i}function Jn(s){return s??null}function Fe(s){return s&&s.nodeType===1}function es(s){return s=="start"||s=="done"}function Hi(s,e){let t=s.style.display;return s.style.display=e??"none",t}function Yi(s,e,t,i,n){let r=[];t.forEach(l=>r.push(Hi(l)));let o=[];i.forEach((l,c)=>{let h=new Map;l.forEach(u=>{let _=e.computeStyle(c,u,n);h.set(u,_),(!_||_.length==0)&&(c[B]=xn,o.push(c))}),s.set(c,h)});let a=0;return t.forEach(l=>Hi(l,r[a++])),o}function Xi(s,e){let t=new Map;if(s.forEach(a=>t.set(a,[])),e.length==0)return t;let i=1,n=new Set(e),r=new Map;function o(a){if(!a)return i;let l=r.get(a);if(l)return l;let c=a.parentNode;return t.has(c)?l=c:n.has(c)?l=i:l=o(c),r.set(a,l),l}return e.forEach(a=>{let l=o(a);l!==i&&t.get(l).push(a)}),t}function L(s,e){s.classList?.add(e)}function ae(s,e){s.classList?.remove(e)}function ts(s,e,t){V(t).onDone(()=>s.processLeaveNode(e))}function is(s){let e=[];return rn(s,e),e}function rn(s,e){for(let t=0;t<s.length;t++){let i=s[t];i instanceof Ae?rn(i.players,e):e.push(i)}}function ns(s,e){let t=Object.keys(s),i=Object.keys(e);if(t.length!=i.length)return!1;for(let n=0;n<t.length;n++){let r=t[n];if(!e.hasOwnProperty(r)||s[r]!==e[r])return!1}return!0}function xi(s,e,t){let i=t.get(s);if(!i)return!1;let n=e.get(s);return n?i.forEach(r=>n.add(r)):e.set(s,i),t.delete(s),!0}var le=class{_driver;_normalizer;_transitionEngine;_timelineEngine;_triggerCache={};onRemovalComplete=(e,t)=>{};constructor(e,t,i){this._driver=t,this._normalizer=i,this._transitionEngine=new At(e.body,t,i),this._timelineEngine=new vt(e.body,t,i),this._transitionEngine.onRemovalComplete=(n,r)=>this.onRemovalComplete(n,r)}registerTrigger(e,t,i,n,r){let o=e+"-"+n,a=this._triggerCache[o];if(!a){let l=[],c=[],h=en(this._driver,r,l,c);if(l.length)throw Pi(n,l);a=Un(n,h,this._normalizer),this._triggerCache[o]=a}this._transitionEngine.registerTrigger(t,n,a)}register(e,t){this._transitionEngine.register(e,t)}destroy(e,t){this._transitionEngine.destroy(e,t)}onInsert(e,t,i,n){this._transitionEngine.insertNode(e,t,i,n)}onRemove(e,t,i){this._transitionEngine.removeNode(e,t,i)}disableAnimations(e,t){this._transitionEngine.markElementAsDisabled(e,t)}process(e,t,i,n){if(i.charAt(0)=="@"){let[r,o]=it(i),a=n;this._timelineEngine.command(r,t,o,a)}else this._transitionEngine.trigger(e,t,i,n)}listen(e,t,i,n,r){if(i.charAt(0)=="@"){let[o,a]=it(i);return this._timelineEngine.listen(o,t,a,r)}return this._transitionEngine.listen(e,t,i,n,r)}flush(e=-1){this._transitionEngine.flush(e)}get players(){return[...this._transitionEngine.players,...this._timelineEngine.players]}whenRenderingDone(){return this._transitionEngine.whenRenderingDone()}afterFlushAnimationsDone(e){this._transitionEngine.afterFlushAnimationsDone(e)}};function ss(s,e){let t=null,i=null;return Array.isArray(e)&&e.length?(t=mt(e[0]),e.length>1&&(i=mt(e[e.length-1]))):e instanceof Map&&(t=mt(e)),t||i?new rs(s,t,i):null}var rs=(()=>{class s{_element;_startStyles;_endStyles;static initialStylesByElement=new WeakMap;_state=0;_initialStyles;constructor(t,i,n){this._element=t,this._startStyles=i,this._endStyles=n;let r=s.initialStylesByElement.get(t);r||s.initialStylesByElement.set(t,r=new Map),this._initialStyles=r}start(){this._state<1&&(this._startStyles&&j(this._element,this._startStyles,this._initialStyles),this._state=1)}finish(){this.start(),this._state<2&&(j(this._element,this._initialStyles),this._endStyles&&(j(this._element,this._endStyles),this._endStyles=null),this._state=1)}destroy(){this.finish(),this._state<3&&(s.initialStylesByElement.delete(this._element),this._startStyles&&(W(this._element,this._startStyles),this._endStyles=null),this._endStyles&&(W(this._element,this._endStyles),this._endStyles=null),j(this._element,this._initialStyles),this._state=3)}}return s})();function mt(s){let e=null;return s.forEach((t,i)=>{os(i)&&(e=e||new Map,e.set(i,t))}),e}function os(s){return s==="display"||s==="position"}var Qe=class{element;keyframes;options;_specialStyles;_onDoneFns=[];_onStartFns=[];_onDestroyFns=[];_duration;_delay;_initialized=!1;_finished=!1;_started=!1;_destroyed=!1;_finalKeyframe;_originalOnDoneFns=[];_originalOnStartFns=[];domPlayer=null;time=0;parentPlayer=null;currentSnapshot=new Map;constructor(e,t,i,n){this.element=e,this.keyframes=t,this.options=i,this._specialStyles=n,this._duration=i.duration,this._delay=i.delay||0,this.time=this._duration+this._delay}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}init(){this._buildPlayer()&&this._preparePlayerBeforeStart()}_buildPlayer(){if(this._initialized)return this.domPlayer;this._initialized=!0;let e=this.keyframes,t=this._triggerWebAnimation(this.element,e,this.options);if(!t)return this._onFinish(),null;this.domPlayer=t,this._finalKeyframe=e.length?e[e.length-1]:new Map;let i=()=>this._onFinish();return t.addEventListener("finish",i),this.onDestroy(()=>{t.removeEventListener("finish",i)}),t}_preparePlayerBeforeStart(){this._delay?this._resetDomPlayerState():this.domPlayer?.pause()}_convertKeyframesToObject(e){let t=[];return e.forEach(i=>{t.push(Object.fromEntries(i))}),t}_triggerWebAnimation(e,t,i){let n=this._convertKeyframesToObject(t);try{return e.animate(n,i)}catch(r){return null}}onStart(e){this._originalOnStartFns.push(e),this._onStartFns.push(e)}onDone(e){this._originalOnDoneFns.push(e),this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}play(){let e=this._buildPlayer();e&&(this.hasStarted()||(this._onStartFns.forEach(t=>t()),this._onStartFns=[],this._started=!0,this._specialStyles&&this._specialStyles.start()),e.play())}pause(){this.init(),this.domPlayer?.pause()}finish(){this.init(),this.domPlayer&&(this._specialStyles&&this._specialStyles.finish(),this._onFinish(),this.domPlayer.finish())}reset(){this._resetDomPlayerState(),this._destroyed=!1,this._finished=!1,this._started=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}_resetDomPlayerState(){this.domPlayer?.cancel()}restart(){this.reset(),this.play()}hasStarted(){return this._started}destroy(){this._destroyed||(this._destroyed=!0,this._resetDomPlayerState(),this._onFinish(),this._specialStyles&&this._specialStyles.destroy(),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}setPosition(e){this.domPlayer||this.init(),this.domPlayer&&(this.domPlayer.currentTime=e*this.time)}getPosition(){return this.domPlayer?+(this.domPlayer.currentTime??0)/this.time:this._initialized?1:0}get totalTime(){return this._delay+this._duration}beforeDestroy(){let e=new Map;this.hasStarted()&&this._finalKeyframe.forEach((i,n)=>{n!=="offset"&&e.set(n,this._finished?i:ke(this.element,n))}),this.currentSnapshot=e}triggerCallback(e){let t=e==="start"?this._onStartFns:this._onDoneFns;t.forEach(i=>i()),t.length=0}},Ue=class{validateStyleProperty(e){return!0}validateAnimatableStyleProperty(e){return!0}containsElement(e,t){return nt(e,t)}getParentElement(e){return Me(e)}query(e,t,i){return st(e,t,i)}computeStyle(e,t,i){return ke(e,t)}animate(e,t,i,n,r,o=[]){let a=n==0?"both":"forwards",l={duration:i,delay:n,fill:a};r&&(l.easing=r);let c=new Map,h=o.filter(y=>y instanceof Qe);Bi(i,n)&&h.forEach(y=>{y.currentSnapshot.forEach((m,g)=>c.set(g,m))});let u=Ki(t).map(y=>new Map(y));u=qi(e,u,c);let _=ss(e,u);return new Qe(e,u,l,_)}};var Le="@",on="@.disabled",Ve=class{namespaceId;delegate;engine;_onDestroy;\u0275type=0;constructor(e,t,i,n){this.namespaceId=e,this.delegate=t,this.engine=i,this._onDestroy=n}get data(){return this.delegate.data}destroyNode(e){this.delegate.destroyNode?.(e)}destroy(){this.engine.destroy(this.namespaceId,this.delegate),this.engine.afterFlushAnimationsDone(()=>{queueMicrotask(()=>{this.delegate.destroy()})}),this._onDestroy?.()}createElement(e,t){return this.delegate.createElement(e,t)}createComment(e){return this.delegate.createComment(e)}createText(e){return this.delegate.createText(e)}appendChild(e,t){this.delegate.appendChild(e,t),this.engine.onInsert(this.namespaceId,t,e,!1)}insertBefore(e,t,i,n=!0){this.delegate.insertBefore(e,t,i),this.engine.onInsert(this.namespaceId,t,e,n)}removeChild(e,t,i,n){if(n){this.delegate.removeChild(e,t,i,n);return}this.parentNode(t)&&this.engine.onRemove(this.namespaceId,t,this.delegate)}selectRootElement(e,t){return this.delegate.selectRootElement(e,t)}parentNode(e){return this.delegate.parentNode(e)}nextSibling(e){return this.delegate.nextSibling(e)}setAttribute(e,t,i,n){this.delegate.setAttribute(e,t,i,n)}removeAttribute(e,t,i){this.delegate.removeAttribute(e,t,i)}addClass(e,t){this.delegate.addClass(e,t)}removeClass(e,t){this.delegate.removeClass(e,t)}setStyle(e,t,i,n){this.delegate.setStyle(e,t,i,n)}removeStyle(e,t,i){this.delegate.removeStyle(e,t,i)}setProperty(e,t,i){t.charAt(0)==Le&&t==on?this.disableAnimations(e,!!i):this.delegate.setProperty(e,t,i)}setValue(e,t){this.delegate.setValue(e,t)}listen(e,t,i,n){return this.delegate.listen(e,t,i,n)}disableAnimations(e,t){this.engine.disableAnimations(e,t)}},wt=class extends Ve{factory;constructor(e,t,i,n,r){super(t,i,n,r),this.factory=e,this.namespaceId=t}setProperty(e,t,i){t.charAt(0)==Le?t.charAt(1)=="."&&t==on?(i=i===void 0?!0:!!i,this.disableAnimations(e,i)):this.engine.process(this.namespaceId,e,t.slice(1),i):this.delegate.setProperty(e,t,i)}listen(e,t,i,n){if(t.charAt(0)==Le){let r=as(e),o=t.slice(1),a="";return o.charAt(0)!=Le&&([o,a]=ls(o)),this.engine.listen(this.namespaceId,r,o,a,l=>{let c=l._data||-1;this.factory.scheduleListenerCallback(c,i,l)})}return this.delegate.listen(e,t,i,n)}};function as(s){switch(s){case"body":return document.body;case"document":return document;case"window":return window;default:return s}}function ls(s){let e=s.indexOf("."),t=s.substring(0,e),i=s.slice(e+1);return[t,i]}var $e=class{delegate;engine;_zone;_currentId=0;_microtaskId=1;_animationCallbacksBuffer=[];_rendererCache=new Map;_cdRecurDepth=0;constructor(e,t,i){this.delegate=e,this.engine=t,this._zone=i,t.onRemovalComplete=(n,r)=>{r?.removeChild(null,n)}}createRenderer(e,t){let n=this.delegate.createRenderer(e,t);if(!e||!t?.data?.animation){let c=this._rendererCache,h=c.get(n);if(!h){let u=()=>c.delete(n);h=new Ve("",n,this.engine,u),c.set(n,h)}return h}let r=t.id,o=t.id+"-"+this._currentId;this._currentId++,this.engine.register(o,e);let a=c=>{Array.isArray(c)?c.forEach(a):this.engine.registerTrigger(r,o,e,c.name,c)};return t.data.animation.forEach(a),new wt(this,o,n,this.engine)}begin(){this._cdRecurDepth++,this.delegate.begin&&this.delegate.begin()}_scheduleCountTask(){queueMicrotask(()=>{this._microtaskId++})}scheduleListenerCallback(e,t,i){if(e>=0&&e<this._microtaskId){this._zone.run(()=>t(i));return}let n=this._animationCallbacksBuffer;n.length==0&&queueMicrotask(()=>{this._zone.run(()=>{n.forEach(r=>{let[o,a]=r;o(a)}),this._animationCallbacksBuffer=[]})}),n.push([t,i])}end(){this._cdRecurDepth--,this._cdRecurDepth==0&&this._zone.runOutsideAngular(()=>{this._scheduleCountTask(),this.engine.flush(this._microtaskId)}),this.delegate.end&&this.delegate.end()}whenRenderingDone(){return this.engine.whenRenderingDone()}componentReplaced(e){this.engine.flush(),this.delegate.componentReplaced?.(e)}};var us=(()=>{class s extends le{constructor(t,i,n){super(t,i,n)}ngOnDestroy(){this.flush()}static \u0275fac=function(i){return new(i||s)(ve(qt),ve(ee),ve(te))};static \u0275prov=Ee({token:s,factory:s.\u0275fac})}return s})();function hs(){return new ze}function ds(){return new $e(z(Xt),z(le),z(Qt))}var an=[{provide:te,useFactory:hs},{provide:le,useClass:us},{provide:$t,useFactory:ds}],zs=[{provide:ee,useClass:bt},{provide:Xe,useValue:"NoopAnimations"},...an],ms=[{provide:ee,useFactory:()=>new Ue},{provide:Xe,useFactory:()=>"BrowserAnimations"},...an];function ln(){return Vt("NgEagerAnimations"),[...ms]}var ie=s=>G(null,null,function*(){let e=z(we),t=s.params.projectName;return t?e.getSelectedProjectId()===t?!0:(e.selectProject(t),(yield Se(e.selectedProject$.pipe(Kt(n=>n?.name===t))))?.name===t):(console.log("[PROJECT GUARD] no project id in route"),!1)});var cn=s=>G(null,null,function*(){let e=z(ai),t=z(li),i=s.params.threadId;if(!t.getUsername())try{yield Ye(t.fetchCurrentUser())}catch(n){console.error("[THREAD GUARD] Failed to load current user:",n)}if(!i)return console.log("[THREAD GUARD] no threadId in route"),!1;if(console.log("[THREAD GUARD] Checking thread:",i),console.log("[THREAD GUARD] Current selected thread:",e.getSelectedThreadId()),e.getSelectedThreadId()===i)return console.log("[THREAD GUARD] Thread already selected, allowing navigation"),!0;console.log("[THREAD GUARD] Selecting thread:",i),e.selectThread(i);try{let n=yield Ye(It([e.isLoading$,e.selectedThread$]).pipe(jt(([o,a])=>console.log(`\u{1F43C} [${o?"loading":"loaded"}]`,a?.id)),Ft(([o,a])=>!o&&!!a),zt(1),Ot(([o,a])=>a?.id))),r=n===i;return r?console.log("[THREAD GUARD] Thread validated, allowing navigation"):console.error("[THREAD GUARD] Thread ID mismatch - route:",i,"loaded:",n),r}catch(n){return console.error("[THREAD GUARD] Error loading thread:",n),!1}});var un=[{path:"",loadComponent:()=>import("./chunk-GS2CQHR7.js").then(s=>s.GlobalTaskControlComponent)},{path:"projects",loadComponent:()=>import("./chunk-LVRSSQUD.js").then(s=>s.ProjectListComponent)},{path:"oauth/callback",loadComponent:()=>import("./chunk-MNWA4UGA.js").then(s=>s.OAuthCallbackComponent)},{path:"project/new",loadComponent:()=>import("./chunk-MWXEF4QG.js").then(s=>s.ProjectNewComponent)},{path:"project/:projectName",loadComponent:()=>import("./chunk-5PVR7BPQ.js").then(s=>s.MainAppComponent),canActivate:[ie]},{path:"project/:projectName/prompts",loadComponent:()=>import("./chunk-UF3D3UUD.js").then(s=>s.PromptListComponent),canActivate:[ie]},{path:"project/:projectName/schedulers",loadComponent:()=>import("./chunk-OIFNN56R.js").then(s=>s.SchedulerListComponent),canActivate:[ie]},{path:"project/:projectName/agents",loadComponent:()=>import("./chunk-2QDRHKK5.js").then(s=>s.AgentListComponent),canActivate:[ie]},{path:"project/:projectName/tasks",loadComponent:()=>import("./chunk-5WX43L4B.js").then(s=>s.TaskControlComponent),canActivate:[ie]},{path:"project/:projectName/missions",redirectTo:"project/:projectName/tasks"},{path:"project/:projectName/thread/:threadId",loadComponent:()=>import("./chunk-5PVR7BPQ.js").then(s=>s.MainAppComponent),canActivate:[ie,cn]},{path:"token-usage",loadComponent:()=>import("./chunk-CXNTZ6XI.js").then(s=>s.TokenUsageComponent)},{path:"agentos",loadChildren:()=>G(null,null,function*(){let{AGENTOS_ROUTES:s,THEME_PORT:e}=yield import("./chunk-ENRRDIUM.js");return[{path:"",providers:[{provide:e,useFactory:t=>({theme:oi(t.currentTheme$,{initialValue:t.getCurrentTheme()}),setTheme:i=>t.setTheme(i)}),deps:[be]}],children:s}]})},{path:"**",redirectTo:""}];function fs(s){return()=>s.initializeDefaultProject()}function ps(s){return()=>{console.log("[APP_INIT] OAuthService initialized")}}function gs(s){return()=>G(null,null,function*(){let{UserStateService:e}=yield import("./chunk-ENRRDIUM.js"),t=s.get(e);yield Se(t.loadMe().pipe(Lt(i=>(console.warn("Failed to load current user",i),kt(null)))))})}var hn={providers:[Ut(),Ht({eventCoalescing:!0}),ei(un),Zt(),ln(),{provide:si,useValue:{duration:3e3}},{provide:Te,useFactory:fs,deps:[we],multi:!0},{provide:Te,useFactory:ps,deps:[ci],multi:!0},{provide:Te,useFactory:gs,deps:[Bt],multi:!0},ri({basePath:"/api/agentos"}),{provide:ni,useValue:{width:"80vw",maxWidth:"80vw",maxHeight:"80vh"}}]};var Ge=class s{title="client";themeService=z(be);ngOnInit(){console.log("[APP] Application initialized with theme:",this.themeService.getCurrentTheme())}static \u0275fac=function(t){return new(t||s)};static \u0275cmp=Gt({type:s,selectors:[["app-root"]],decls:1,vars:0,template:function(t,i){t&1&&Wt(0,"router-outlet")},dependencies:[ti,Jt],encapsulation:2})};xt(Ge,hn).catch(s=>console.error(s));"serviceWorker"in navigator&&!Yt()&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(s=>console.error("[SW] Registration failed:",s))});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whoz-oss/coday-client",
3
- "version": "0.244.0",
3
+ "version": "0.244.1",
4
4
  "repository": "https://github.com/whoz-oss/coday",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -1 +0,0 @@
1
- import{V as c,Xc as g,Z as p,ca as l,m as s,t as a}from"./chunk-CHEXA6RY.js";var m=class n{http=l(g);agentsCache=new Map;getAgents(e){let t=this.agentsCache.get(e);return t?s(t):this.http.get(`/api/projects/${e}/agents`).pipe(c(r=>{this.agentsCache.set(e,r)}))}getAgentsAutocomplete(e,t){return this.getAgents(e).pipe(a(r=>{if(!t)return r;let o=t.toLowerCase();return r.filter(i=>{let h=i.name.toLowerCase(),u=i.description?.toLowerCase()||"";return h.includes(o)||u.includes(o)})}))}clearCache(e){this.agentsCache.delete(e)}clearAllCache(){this.agentsCache.clear()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=p({token:n,factory:n.\u0275fac,providedIn:"root"})};export{m as a};