PageSourceSearch

https://combustionpunks.co.uk/464.a6654799a2661f16.js

js combustionpunks.co.uk collected 2026-10-05 07:18:04 UTC 366,912 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkwebclient_webpack=self.webpackChunkwebclient_webpack||[]).push([[464],{50464(De,re,p){p.d(re,{integrationsRoutes:()=>tp});var s=p(85802),v=p(96354),O=p(92996),oe=p(87018),S=p(59882),e=p(35547);let D=(()=>{class n{tokenService=(0,s.WQX)(O.Z);api$=this.tokenService.myToken$.pipe((0,v.T)(t=>t.globalAdmin&&t.local));appsRead$=this.tokenService.myToken$.pipe((0,v.T)(t=>t.roles?.includes("Apps.Read")||t.roles?.includes("Apps.ReadWrite")));integrationsMenuItems=[{routeLabel:"_i18n.CRM",routeLink:"crm"},{routeLabel:"AI",routeLink:"ai"},{routeLabel:"_i18n.CallScript",routeLink:"call-flow",visible$:this.appsRead$},{routeLabel:"_i18n.Google",routeLink:"google"},{routeLabel:"_i18n.Amazon",routeLink:"amazon"},{routeLabel:"_i18n.Microsoft365",routeLink:"microsoft365"},{routeLabel:"_i18n.Teams",routeLink:"teams"},{routeLabel:"_i18n.HotelServices",routeLink:"hotel-services"},{routeLabel:"_i18n.Transcription",routeLink:"transcription"},{routeLabel:"_i18n.API",routeLink:"api",visible$:this.api$},{routeLabel:"_i18n.DataConnectors",routeLink:"data-connectors"},{routeLabel:"_i18n.Syslog",routeLink:"syslog"}];static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-integrations-layout"]],decls:2,vars:1,consts:[[3,"menuItems"]],template:function(o,i){1&o&&(e.j41(0,"app-layout-with-sidebar",0),e.nrm(1,"router-outlet"),e.k0s()),2&o&&e.Y8G("menuItems",i.integrationsMenuItems)},dependencies:[oe.I,S.n3],encapsulation:2})}return n})();var _=p(17705),L=p(92361),ue=p(35844),ae=p(49413),P=p(88141),I=p(25558),M=p(7673),E=p(983),l=p(89417),j=p(22673),K=p(41029),B=p(38601),W=p(91413),ct=p(15707),k=p(22972),G=p(54999),ve=p(82971),y=p(68018),Z=p(95604),te=p(84460),$=p(24708),dt=p(28768),Ae=p(85260),Ne=p(13816),qt=p(12678),li=p(90836),X=p(7881),pt=p(91968),A=p(99437),me=p(40953);const ci=n=>({number:n});function di(n,c){if(1&n&&(e.j41(0,"alert",14),e.nrm(1,"app-server-error",17),e.k0s()),2&n){const t=e.XpG();e.R7$(),e.Y8G("message",t.Message)}}function pi(n,c){1&n&&(e.j41(0,"alert",15),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&n&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"_i18n.CrmTestWarning")," "))}function ui(n,c){if(1&n&&(e.j41(0,"alert",16),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&n){const t=e.XpG();e.R7$(),e.SpI(" ",e.i5U(2,1,"_i18n.CrmAlertSuccess",e.eq3(4,ci,null==t.SearchResult?null:t.SearchResult.length))," ")}}function mi(n,c){if(1&n&&(e.j41(0,"div",7),e.nVh(1,di,2,1,"alert",14)(2,pi,3,3,"alert",15)(3,ui,3,6,"alert",16),e.k0s()),2&n){const t=c;e.R7$(),e.vxM(t.IsError?1:null!=t.SearchResult&&t.SearchResult.length?3:2)}}function fi(n,c){1&n&&e.nrm(0,"app-tab-heading",18)}function gi(n,c){1&n&&e.nrm(0,"app-tab-heading",19)}let hi=(()=>{class n extends k.m{crmIntegrationApiService=(0,s.WQX)(ue.W);buttons=G.P.Cancel;testResult=(0,s.vPA)(void 0);form=new l.gE({Number:new l.MJ("555-1234",{nonNullable:!0,validators:[l.k0.required]})});runCrmTest(){this.form.invalid||this.crmIntegrationApiService.test({crmIntegrationTestRequestBody:{number:this.form.value.Number}}).pipe((0,A.W)(t=>{let o=(0,X.PE)(t);if((0,K.JC)(t)){if(o!==ve.g.XapiNotFound)return(0,K.Xy)(this.form.controls.Number,K.DD,o),E.w;o="_i18n.CrmTemplateTestNotFoundErrorMessage"}return(0,M.of)({IsError:!0,Message:o})})).subscribe(t=>{this.testResult.set(t)})}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275cmp=e.VBU({type:n,selectors:[["app-crm-test-modal"]],hostVars:2,hostBindings:function(o,i){2&o&&e.AVh("modal-lg",!0)},features:[e.Vt3],decls:21,vars:10,consts:[["header","_i18n.TestCrmModalHeader",3,"formGroup","buttons"],["data-qa","crm-number","label","_i18n.TestCrmNumberLabel",1,"m-0"],[1,"d-flex","gap-1"],["formControlName","Number",1,"flex-grow-1","flex-lg-grow-0","w-lg-50",3,"minlength","maxlength"],["controlName","Number"],["data-qa","test","type","button",1,"btn","btn-primary",3,"click"],["app-share-solid-icon","",1,"customSVGIcons","svg-xs"],[1,"alert-box","scrollable"],["id","results"],["tabHeading",""],[1,"tab-content-json"],[3,"json"],["id","crmLog"],[1,"tab-content-log"],["type","danger"],["type","warning"],["type","success"],[3,"message"],["label","_i18n.CrmSearchResults"],["label","_i18n.CrmLog"]],template:function(o,i){if(1&o&&(e.j41(0,"app-modal-dialog",0)(1,"field-wrapper",1)(2,"div",2)(3,"field-input",3),e.nrm(4,"val-errors",4),e.k0s(),e.j41(5,"button",5),e.bIt("click",function(){return i.runCrmTest
1()}),e.nrm(6,"span",6),e.j41(7,"span"),e.EFF(8),e.nI1(9,"translate"),e.k0s()()()(),e.nVh(10,mi,4,1,"div",7),e.j41(11,"tabset")(12,"tab",8),e.DNE(13,fi,1,0,"ng-template",9),e.j41(14,"div",10),e.nrm(15,"app-json-viewer",11),e.k0s()(),e.j41(16,"tab",12),e.DNE(17,gi,1,0,"ng-template",9),e.j41(18,"div",13)(19,"pre"),e.EFF(20),e.k0s()()()()()),2&o){let a,r,d;e.Y8G("formGroup",i.form)("buttons",i.buttons),e.R7$(3),e.Y8G("minlength",3)("maxlength",50),e.R7$(5),e.JRh(e.bMT(9,8,"_i18n.CrmTestButton")),e.R7$(2),e.vxM((a=i.testResult())?10:-1,a),e.R7$(5),e.Y8G("json",null==(r=i.testResult())?null:r.SearchResult),e.R7$(5),e.JRh(null==(d=i.testResult())?null:d.Log)}},dependencies:[l.X1,l.BC,l.cb,l.xh,l.tU,l.j4,l.JD,Z.z,te.m,$.IH,dt.f,Ae.Cy,Ne.fw,Ne.V6,Ne.Bh,qt.b,li.g,me.p,pt.J,y.D9],styles:[".alert-box[_ngcontent-%COMP%]{min-height:46.56px;max-height:93.12px}.alert-box[_ngcontent-%COMP%]     .alert{margin:0}.tab-content-json[_ngcontent-%COMP%]{height:400px;max-height:400px}.tab-content-json[_ngcontent-%COMP%]     .ngx-json-viewer{overflow:auto!important}.tab-content-log[_ngcontent-%COMP%]{height:400px;max-height:400px;overflow:auto}"],changeDetection:0})}return n})();var $e=p(18810),Se=p(1807),Ut=p(12498),Ci=p(50779),R=p(89079),je=p(74743);let bi=(()=>{class n extends k.m{crmIntegrationApiService=(0,s.WQX)(ue.W);destroy$=(0,s.WQX)(s.abz);bsModalRef=(0,s.WQX)(Ci.Y$);buttons=G.P.Cancel;retryTimeout=5e3;oAuthToken;ngOnInit(){this.crmIntegrationApiService.getOAuth({variable:j.Wz}).pipe((0,I.n)(t=>t?(0,M.of)(t):(0,$e.$)(()=>new Error("Token is null"))),(0,Ut.L)({delay:t=>(0,Se.O)(this.retryTimeout)}),(0,R.pQ)(this.destroy$)).subscribe(t=>{this.oAuthToken=t,this.onSubmit(),this.hide()})}hide(){this.bsModalRef.hide()}getPayload(){return this.oAuthToken}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275cmp=e.VBU({type:n,selectors:[["app-crm-template-modal"]],features:[e.Vt3],decls:4,vars:2,consts:[["header","_i18n.CrmOauthModalHeader",3,"buttons"],[3,"translate"],[1,"d-flex","justify-content-center","pt-3","pb-3"],["app-spinner-regular-icon","",1,"customSVGIcons","svg-xl"]],template:function(o,i){1&o&&(e.j41(0,"app-modal-dialog",0),e.nrm(1,"p",1),e.j41(2,"div",2),e.nrm(3,"div",3),e.k0s()()),2&o&&(e.Y8G("buttons",i.buttons),e.R7$(),e.Y8G("translate","_i18n.CrmWaitingOauth"))},dependencies:[me.p,y.Mm,je.a],encapsulation:2})}return n})();var ut=p(56699);let _i=(()=>{class n extends k.m{buttons=G.P.Cancel;svgSource;static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275cmp=e.VBU({type:n,selectors:[["app-crm-template-modal"]],hostVars:2,hostBindings:function(o,i){2&o&&e.AVh("modal-lg",!0)},inputs:{svgSource:"svgSource"},features:[e.Vt3],decls:2,vars:3,consts:[["header","_i18n.CrmXmlTemplateModalHeader",3,"buttons"],[3,"ngModel","readOnly"]],template:function(o,i){1&o&&(e.j41(0,"app-modal-dialog",0),e.nrm(1,"app-ace",1),e.k0s()),2&o&&(e.Y8G("buttons",i.buttons),e.R7$(),e.Y8G("ngModel",i.svgSource)("readOnly",!0))},dependencies:[me.p,ut.x,l.X1,l.BC,l.YN,l.vS],encapsulation:2})}return n})();var Y=p(46222),V=p(59053),$t=p(58571),zt=p(25843),ne=p(45054);let vi=(()=>{class n{static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-chevron-up-regular-icon"],["","app-chevron-up-regular-icon",""]],decls:2,vars:0,consts:[["xmlns","http://www.w3.org/2000/svg","viewBox","0 0 512 512"],["d","M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z"]],template:function(o,i){1&o&&(s.qSk(),e.rj2(0,"svg",0),e.Hgh(1,"path",1),e.eux())},encapsulation:2})}return n})();var Si=p(72009),Kt=p(83204),Zt=p(23294),ie=p(19781),Q=p(72510),Ti=p(49764);const yi=()=>[];function Fi(n,c){if(1&n&&e.nrm(0,"field-checkbox",2),2&n){const t=e.XpG().$implicit;e.Y8G("formControlName",t.Name)("label",t.Title||""),e.BMQ("data-qa","checkbox-"+t.Name)}}function Ri(n,c){if(1&n&&e.nrm(0,"ng-select",3),2&n){const t=e.XpG().$implicit;e.Y8G("formControlName",t.Name)("items",t.ListValues||e.lJ4(4,yi))("clearable",!1),e.BMQ("data-qa","select-"+t.Name)}}function Ii(n,c){if(1&n&&e.nrm(0,"field-input-password",4),2&n){const t=e.XpG().$implicit;e.Y8G("formControlName",t.Name)("maxlength",2048),e.BMQ("data-qa","password-"+t.Name)}}function Ai(n,c){if(1&n&&e.nrm(0,"field-input",4),2&n){const t=e.XpG().$implicit;e.Y8G("formControlName",t.Name)("maxlength",2048),e.BMQ("data-qa","input-"+t.Name)}}function $i(n,c){1&n&&(e.j41(0,"alert",5),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&n&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"_i18n.CRMSaveBeforeContinueWarning")," "))}function Mi(n,c){if(1&n){const t=e.RV6();e.j41(0,"div"),e.nVh(1,$i,3,3,"alert",5),e.j41(2,"button",6),e.bIt("click",function(){s.eBV(t);const i=e.XpG(2);return s.Njj(i.openOAuthWindow.emit())}),e.j41(3,"span"),e.EFF(4),e.nI1(5,"translate"),e.k0s()()()}if(2&n){const t=e.XpG(2);e.R7$(),e.vxM(t.saved?-1:1),e.R7$(),e.Y8G("disabled",!t.saved),e.R7$(2),e.JRh(e.bMT(5,3,"_i18n.CrmOauthAuthorize"))}}function ki(n,c){if(1&n&&(e.j41(0,"field-wrapper",1),e.nVh(1,Fi,1,3,"field-checkbox",2)(2,Ri,1,5,"ng-select",3)(3,Ii,1,3,"field-input-password",4)(4,Ai,1,3,"field-input",4),e.nV
1h(5,Mi,6,5,"div"),e.k0s()),2&n){let t;const o=c.$implicit,i=e.XpG();e.Y8G("label",i.getLabel(o)),e.BMQ("data-qa",o.Name),e.R7$(),e.vxM((t=o.Type)===i.PbxParameterType.Boolean?1:t===i.PbxParameterType.List?2:t===i.PbxParameterType.Password?3:4),e.R7$(4),e.vxM(o.Type===i.PbxParameterType.OAuth?5:-1)}}let xi=(()=>{class n{cd=(0,s.WQX)(_.gRc);form;groupParameters;header;configuration;saved=!1;sub;openOAuthWindow=(0,_.CGW)();ngOnChanges(t){const o=t.form?.currentValue?.get(this.configuration),i=t.form?.previousValue?.get(this.configuration);o!==i&&this.enableParameter&&(this.sub?.unsubscribe(),this.sub=this.enableParameter.valueChanges.pipe((0,Zt.F)()).subscribe({next:a=>{a?this.form.enable():(this.form.disable(),this.enableParameter.enable()),this.cd.markForCheck()}}))}ngOnDestroy(){this.sub?.unsubscribe()}get enableParameter(){return this.form.get(this.configuration)}getLabel(t){return t.Type===Kt.Y.Boolean?"":t.Title||""}PbxParameterType=Kt.Y;static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-crm-form-group"]],inputs:{form:"form",groupParameters:"groupParameters",header:"header",configuration:"configuration",saved:"saved"},outputs:{openOAuthWindow:"openOAuthWindow"},features:[e.OA$],decls:3,vars:1,consts:[[3,"formGroup"],[3,"label"],[3,"formControlName","label"],[3,"formControlName","items","clearable"],[3,"formControlName","maxlength"],["type","warning","data-qa","crm-warning"],["data-qa","oauth-authorize","type","button",1,"btn","btn-primary",3,"click","disabled"]],template:function(o,i){1&o&&(e.j41(0,"form",0),e.Z7z(1,ki,6,4,"field-wrapper",1,e.fX1),e.k0s()),2&o&&(e.Y8G("formGroup",i.form),e.R7$(),e.Dyx(i.groupParameters))},dependencies:[l.X1,l.qT,l.BC,l.cb,l.tU,l.j4,l.JD,Z.z,ie.t,Q.vr,Ti.$,te.m,Ae.Cy,y.D9],encapsulation:2})}return n})();var Te=p(66300),Je=p(94304),Ei=p(56344),x=p(96106),Me=p(70980),Ce=p(90776),wi=p(52478),en=p(83230),tn=p(8516);const Pi=["file"],Gi=n=>({link:n});function Di(n,c){1&n&&(e.nrm(0,"span",13),e.nI1(1,"translate"),e.nI1(2,"translate")),2&n&&e.Y8G("innerHTML",e.i5U(2,3,"_i18n.CrmSelectDescription",e.eq3(6,Gi,e.bMT(1,1,c))),e.npT)}function Ni(n,c){if(1&n){const t=e.RV6();e.j41(0,"app-crm-form-group",21),e.bIt("openOAuthWindow",function(){s.eBV(t);const i=e.XpG(3);return s.Njj(i.openOauthUrl())}),e.k0s()}if(2&n){const t=e.XpG(3);e.Y8G("form",t.generalForm)("groupParameters",t.generalFormGroupParams)("configuration",t.ConfigurationType.General)("saved",t.isSavedValue)}}function ji(n,c){if(1&n&&(e.j41(0,"fieldset"),e.nVh(1,Ni,1,4,"app-crm-form-group",18),e.nrm(2,"field-select",19)(3,"field-checkbox",20),e.k0s()),2&n){const t=e.XpG(2);e.R7$(),e.vxM(t.generalFormGroupParams&&t.generalFormGroupParams.length&&t.generalForm?1:-1),e.R7$(),e.Y8G("options",t.crmQueryOptions)}}function Vi(n,c){if(1&n&&e.nrm(0,"field-checkbox",23),2&n){const t=e.XpG(3);e.Y8G("formControl",t.enableCallJournaling)}}function Bi(n,c){1&n&&e.nrm(0,"span",25)}function Hi(n,c){1&n&&e.nrm(0,"span",26)}function Oi(n,c){if(1&n&&(e.j41(0,"accordion-group",16,1)(2,"div",22),e.nVh(3,Vi,1,1,"field-checkbox",23),e.j41(4,"h6",24),e.EFF(5),e.nI1(6,"translate"),e.k0s(),e.nVh(7,Bi,1,0,"span",25)(8,Hi,1,0,"span",26),e.k0s(),e.nrm(9,"app-crm-form-group",27),e.k0s()),2&n){const t=e.sdS(1),o=e.XpG(2);e.R7$(3),e.vxM(o.enableCallJournaling?3:-1),e.R7$(2),e.JRh(e.bMT(6,6,"_i18n.EnableCallJournaling")),e.R7$(2),e.vxM(t.isOpen?7:8),e.R7$(2),e.Y8G("form",o.callJournalingForm)("groupParameters",o.callJournalingGroupParams)("configuration",o.ConfigurationType.CallJournaling)}}function Xi(n,c){if(1&n&&e.nrm(0,"field-checkbox",29),2&n){const t=e.XpG(3);e.Y8G("formControl",t.enableChatJournaling)}}function Qi(n,c){1&n&&e.nrm(0,"span",25)}function Li(n,c){1&n&&e.nrm(0,"span",26)}function Wi(n,c){if(1&n&&(e.j41(0,"accordion-group",17,2)(2,"div",28),e.nVh(3,Xi,1,1,"field-checkbox",29),e.j41(4,"h6",24),e.EFF(5),e.nI1(6,"translate"),e.k0s(),e.nVh(7,Qi,1,0,"span",25)(8,Li,1,0,"span",26),e.k0s(),e.nrm(9,"app-crm-form-group",30),e.k0s()),2&n){const t=e.sdS(1),o=e.XpG(2);e.R7$(3),e.vxM(o.enableChatJournaling?3:-1),e.R7$(2),e.JRh(e.bMT(6,6,"_i18n.EnableChatJournaling")),e.R7$(2),e.vxM(t.isOpen?7:8),e.R7$(2),e.Y8G("form",o.chatJournalingForm)("groupParameters",o.chatJournalingGroupParams)("configuration",o.ConfigurationType.ChatJournaling)}}function Yi(n,c){if(1&n&&e.nrm(0,"field-checkbox",31),2&n){const t=e.XpG(3);e.Y8G("formControl",t.enableContactCreation)}}function Ji(n,c){1&n&&e.nrm(0,"span",25)}function qi(n,c){1&n&&e.nrm(0,"span",26)}function Ui(n,c){if(1&n&&(e.j41(0,"accordion-group",17,3)(2,"div",28),e.nVh(3,Yi,1,1,"field-checkbox",31),e.j41(4,"h6",24),e.EFF(5),e.nI1(6,"translate"),e.k0s(),e.nVh(7,Ji,1,0,"span",25)(8,qi,1,0,"span",26),e.k0s(),e.nrm(9,"app-crm-form-group",32),e.k0s()),2&n){const t=e.sdS(1),o=e.XpG(2);e.R7$(3),e.vxM(o.enableContactCreation?3:-1),e.R7$(2),e.JRh(e.bMT(6,6,"_i18n.ContactsEnable")),e.R7$(2),e.vxM(t.isOpen?7:8),e.R7$(2),e.Y8G("form",o.contactCreationForm)("groupParameters",o.contactCreationGroupParams)("configuration",o.ConfigurationType.CreateContact)}}function zi(n,c){if(1&n&&(e.j41(0,"div",14),e.nVh(1,ji,4,2,"fieldset"),e.j41(2,"accordion",15),e.nVh(3,Oi,10,8,"accordion-group",16),e.nVh(4,Wi,10,8,"accordion-group",17),e.nVh(5,Ui,10,8,"accordion-group",17),e.k0s()()),2&n){const t=e.XpG();e.R7$(),e.vxM(t.generalForm?1:-1),e.R7$(),e.Y8G("isAnimated",!0),e.R7$(),e.vxM((null==t.callJournalingGroupParams?null:t.callJournalingGroupParams.length)>0&&t.callJournalingForm?3:-1),e.R7$(),e.vxM((null==t.chatJournalingGroupParams?null:t.chatJournalingGroupParams.length)>0&&t.chatJournalingForm?4:-1),e.R7$(),e.vxM((null==t.contactCreationGroupParams?null:t.contactCreationGroupParams.length)>0&&t.contactCreationForm?5:-1)}}let Ki=(()=>{class n{route=(0,s.WQX)(S.nX);fb=(0,s.WQX)(l.ok);crmTemplateApiService=(0,s.WQX)(L.H);crmIntegrationApiService=(0,s.WQX)(ue.W);cd=(0,s.WQX)(_.gRc);xapiErrorService=(0,s.WQX)(K.Ko);modalService=(0,s.WQX)(B.B);crmIntegrationDataSource=(0,s.WQX)(ct.s);http=(0,s.WQX)(W.Qq);crmIntegration;crmTemplate;crmName="";crmLinkByName="";saving=!1;templateChanging=!1;
1resolvedData=this.route.snapshot.data;isPaid=this.resolvedData.isPaid;FQDN=this.resolvedData.systemParameters.PbxExternalHost;configurationForm=(0,j._)(this.fb,{});form=new l.gE({configuration:this.configurationForm});generalForm;callJournalingForm;chatJournalingForm;contactCreationForm;get isPristine(){return this.configurationForm.pristine&&!(this.generalForm?.dirty||this.callJournalingForm?.dirty||this.chatJournalingForm?.dirty||this.contactCreationForm?.dirty)}get isInvalid(){return this.configurationForm.invalid||this.generalForm?.invalid||this.callJournalingForm?.invalid||this.chatJournalingForm?.invalid||this.contactCreationForm?.invalid}generalFormGroupParams;callJournalingGroupParams;chatJournalingGroupParams;contactCreationGroupParams;fileUpload;crmQueryOptions=[{value:ae.i.AlwaysQuery,label:"_i18n.CrmAlwaysQuery"},{value:ae.i.NotQueryIfInPhonebookFound,label:"_i18n.CrmNotQueryIfPhonebookSelected"}];crmTemplateOptions;constructor(){this.setCrmSettings(this.resolvedData.crmSettings),this.configurationForm.controls.Name.valueChanges.pipe((0,P.M)(()=>this.templateChanging=!0),(0,I.n)(t=>t&&t!==j.zH?this.crmTemplateApiService.getCrmTemplate({name:t}).pipe((0,x.Pr)("_i18n.CrmTemplateNotFoundErrorMessage",this.crmName),(0,x.Tg)(this.modalService),(0,Me.j)(()=>{this.templateChanging=!1,this.cd.markForCheck()})):(0,M.of)(void 0)),(0,R.pQ)()).subscribe({next:t=>{this.selectTemplate(t),this.templateChanging=!1,this.cd.markForCheck()}})}selectTemplate(t){this.crmTemplate=t,this.crmName=this.crmTemplate?.Name??"",this.crmLinkByName=(0,j.nw)(this.crmName),this.initCrmTemplateForm(this.crmIntegration,t,this.crmIntegration.Name!==t?.Name),this.cd.markForCheck()}get restrictedModification(){return this.isPaid?Y.v.None:Y.v.Paid}get isSavedValue(){return!!this.templateChanging||this.crmIntegration.Name===this.configurationForm?.value.Name}initCrmTemplateForm(t,o,i=!1){if(o){this.generalFormGroupParams=o.Parameters?.filter(m=>m.Parent===j.HB.General),this.callJournalingGroupParams=o.Parameters?.filter(m=>m.Parent===j.HB.CallJournaling),this.chatJournalingGroupParams=o.Parameters?.filter(m=>m.Parent===j.HB.ChatJournaling),this.contactCreationGroupParams=o.Parameters?.filter(m=>m.Parent===j.HB.CreateContact);const{generalForm:a,callControlsForm:r,chatControlsForm:d,createContactsForm:u}=(0,j.V2)(this.fb,o,t,i);this.generalForm=a,this.callJournalingForm=r,this.chatJournalingForm=d,this.contactCreationForm=u,this.form.addControl("general",a),this.form.addControl("callJournaling",r),this.form.addControl("chatJournaling",d),this.form.addControl("contactCreation",u)}else this.generalForm=void 0,this.callJournalingForm=void 0,this.chatJournalingForm=void 0,this.contactCreationForm=void 0,this.form.removeControl("general"),this.form.removeControl("callJournaling"),this.form.removeControl("chatJournaling"),this.form.removeControl("contactCreation")}showTemplate(){const t=this.crmName;t&&this.crmIntegrationApiService.getCrmTemplateSource({name:t}).pipe((0,x.Pr)("_i18n.CrmTemplateNotFoundErrorMessage",t),(0,I.n)(o=>o.Value?this.modalService.showComponent(_i,{initialState:{svgSource:o.Value}}):E.w)).subscribe({error:o=>this.modalService.error(o)})}get hasTemplateSource(){return!!this.crmTemplate}refreshCrmSettings$(){return this.crmIntegrationDataSource.getData().pipe((0,P.M)(t=>this.setCrmSettings(t)))}setCrmSettings({crmIntegration:t,crmTemplate:o}){this.crmIntegration=t,this.configurationForm.patchValue(this.crmIntegration),this.crmTemplateOptions=[{value:j.zH,label:"_i18n.NoneCrmSelected"},...(this.crmIntegration.PossibleValues??[]).map(i=>({value:i.Name,label:i.Name}))],this.selectTemplate(o)}removeTemplate(){this.crmTemplate&&this.modalService.confirmDeletion("_i18n.ConfirmationRemoveCrmTemplate").pipe((0,I.n)(()=>this.crmTemplateApiService.deleteCrmTemplate({name:this.crmTemplate.Name})),(0,I.n)(()=>this.refreshCrmSettings$())).subscribe({error:t=>{this.xapiErrorService.error(this.cd,t,this.form)}})}openCrmTestWindow(){this.modalService.showComponent(hi)}save$=()=>{const t=this.configurationForm.value;let o;return o=t.Name===j.zH?{Name:t.Name??void 0}:{Name:t.Name??void 0,EnabledForDidCalls:t.EnabledForDidCalls,EnabledForExter
1nalCalls:t.EnabledForExternalCalls,PhonebookPriorityOptions:t.PhonebookPriorityOptions,PhonebookSynchronization:t.PhonebookSynchronization,VariableChoices:(0,j.Tr)(this.generalForm,this.callJournalingForm,this.chatJournalingForm,this.contactCreationForm)},this.crmIntegrationApiService.updateCrmIntegration({pbxCrmIntegration:o}).pipe((0,x.AI)(400,"_i18n.CrmTemplateNotFoundEditErrorMessage",this.crmName),(0,I.n)(()=>this.refreshCrmSettings$()))};onFileSelected(t){t&&t.length>0&&this.uploadFile(t[0])}uploadTemplate(){this.fileUpload.nativeElement.value="",this.fileUpload.nativeElement.click()}uploadFile(t){const o=(0,V.j$)(t,{allowedExtensions:["xml"],maxSizeMb:zt.X6});o?this.modalService.error(o):this.http.post(Ei.H+"/CrmTemplate/UploadTemplate",(0,$t.$)(t,"file")).pipe((0,I.n)(()=>this.refreshCrmSettings$())).subscribe({error:i=>this.modalService.error(i)})}openOauthUrl(){const t="https://"+this.FQDN+"/api/oauth2crm",o=window.open("","_blank"),i=this.crmIntegration.VariableChoices,a=this.oAuthControl,r=this.generalFormGroupParams?.find(d=>d.Name===j.Wz);r&&this.crmIntegrationApiService.setOAuthState({crmIntegrationSetOAuthStateRequestBody:{state:{Variable:r.Name,RedirectUri:t}}}).pipe((0,P.M)(d=>{const u=(0,j.GV)(t,d,r.RequestUrl,i),m=(0,j.GV)(t,d,r.RequestUrlParameters,i,encodeURIComponent);o.location.href=`${u}?${m}`}),(0,I.n)(()=>this.modalService.showComponent(bi))).subscribe({next:d=>{d.decision===G.R.Ok&&d.payload&&a.patchValue(d.payload.Value)},error:d=>{this.xapiErrorService.error(this.cd,d,this.form)}})}get enableCallJournaling(){return this.callJournalingForm?.get(j.HB.CallJournaling)}get enableChatJournaling(){return this.chatJournalingForm?.get(j.HB.ChatJournaling)}get enableContactCreation(){return this.contactCreationForm?.get(j.HB.CreateContact)}get oAuthControl(){return this.generalForm?.get(j.Wz)}ConfigurationType=j.HB;LicenseRequirement=Y.v;FileCode=tn.GDI;static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-crm-integration"]],viewQuery:function(o,i){if(1&o&&e.GBs(Pi,5),2&o){let a;e.mGM(a=e.lsd())&&(i.fileUpload=a.first)}},decls:17,vars:21,consts:[["file",""],["acc2",""],["acc3",""],["acc4",""],["header","_i18n.CrmIntegrationHeader","helpUrl","_i18n.CrmUri","saveDisabledByReasonView","header",3,"formGroup","pristine","invalid","save$","saveDisabledByReason"],["buttons","","type","button","data-qa","test-crm",1,"btn","btn-primary",3,"click","disabled"],[3,"formGroup"],["data-qa","crm-solution","label","_i18n.SelectCRMSolution","description","true","formControlName","Name",3,"searchable","options"],["data-qa","file","type","file","hidden","","accept",".xml",3,"change"],["button","",1,"d-flex","flex-wrap","gap-2"],["data-qa","tmp-upload","text","_i18n.CrmAddTemplate",3,"click","disabled"],["text","_i18n.CrmRemoveTemplate",3,"click","disabled"],["theme","border","data-qa","tmp-show","text","_i18n.CrmShowTemplate",3,"click","icon","disabled"],["description","","data-qa","tmp-guide",3,"innerHTML"],[1,"mt-5"],[3,"isAnimated"],["panelClass","crmGroup",1,"crmGroup"],["panelClass","crmGroup"],["data-qa","general-params",3,"form","groupParameters","configuration","saved"],["data-qa","crm-query","label","_i18n.QueryCrmLabel","formControlName","PhonebookPriorityOptions",3,"options"],["label","_i18n.PhonebookSynchronizationLabel","formControlName","PhonebookSynchronization"],["data-qa","general-params",3,"openOAuthWindow","form","groupParameters","configuration","saved"],["accordion-heading","",1,"d-flex","align-items-center","gap-2"],["data-qa","call-j-checkbox",1,"m-0",3,"formControl"],[1,"m-0"],["app-chevron-up-regular-icon","",1,"customSVGIcons","svg-xs","ms-auto"],["app-chevron-down-solid-icon","",1,"customSVGIcons","svg-xs","ms-auto"],["data-qa","call-journal-params",3,"form","groupParameters","configuration"],["accordion-heading","",1,"d-flex","align-items-center","gap-2","mt-3"],["data-qa","chat-j-checkbox",1,"m-0",3,"formControl"],["data-qa","chat-journal-params",3,"form","groupParameters","configuration"],["data-qa","contact-creation-checkbox",1,"m-0",3,"formControl"],["data-qa","contact-creation-params",3,"form","groupParameters","configuration"]],template:function(o,i){if(1&o){const a=e.RV6();e.j41(0,"edit-panel",4),e.nI1(1,"LicenseRestricted"),e.j41(2,"button",5),e.bIt("click",function(){return i.openCrmTestWindow()}),e.nrm(3,"app-share-solid-icon"),e.j41(4,"span"),e.EFF(5),e.nI1(6,"translate"),e.k0s()(),e.j41(7,"fieldset",6)(8,"field-select",7)(9,"input",8,0),e.bIt("change",function(){s.eBV(a);const d=e.sdS(10);return s.Njj(i.onFileSelected(d.files))}),e.k0s(),e.j41(11,"div",9)(12,"app-button-add",10),e.bIt("click",function(){return i.uploadTemplate()}),e.k0s(),e.j41(13,"app-button-delete",11),e.bIt("click",function(){return i.removeTemplate()}),e.k0s(),e.j41(14,"app-button",12),e.bIt("click",function(){return i.showTemplate()}),e.k0s()(),e.nVh(15,Di,3,8,"span",13),e.k0s(),e.nVh(16,zi,6,5,"div",14),e.k0s()()}if(2&o){let a;e.Y8G("formGroup",i.form)("pristine",i.isPristine)("invalid",i.isInvalid)("save$",i.save$)("saveDisabledByReason",e.i5U(1,16,"",i.restrictedModification)),e.R7$(2),e.Y8G("disabled",!(i.isSavedValue&&i.crmTemplate&&i.isPaid&&i.isPristine)),e.R7$(3),e.JRh(e.bMT(6,19,"_i18n.CrmTestButton")),e.R7$(2),e.Y8G("formGroup",i.configurationForm),e.R7$(),e.Y8G("searchable",!0)("options",i.crmTemplateOptions),e.R7$(4),e.Y8G("disabled",!i.isPaid),e.R7$(),e.Y8G("disabled",!i.crmTemplate||!i.isPaid),e.R7$(),e.Y8G("icon",i.FileCode)("disabled",!i.crmTemplate||!i.hasTemplateSource),e.R7$(),e.vxM((a=i.crmLinkByName)?15:-1,a),e.R7$(),e.vxM(i.crmTemplate?16:-1)}}
1,dependencies:[ne.Q,l.X1,l.BC,l.cb,l.l_,l.j4,l.JD,dt.f,Ce.j,wi.L,en.Q,xi,Te.q,ie.t,Je.Mj,Je.kt,vi,Si.z,y.D9,Y.R],styles:[".crmGroup .panel-collapse .panel-body{border:none!important}"]})}return n})();var Zi=p(84261),h=p(97201),ye=p(4499);let nn=(()=>{class n extends ye.d{getHotelServices(t,o="body"){const i=t?.$select,a=t?.$expand;let r=new h.rx(this.encoder);r=this.addToHttpParams(r,"$select",i,h.l2.Form,!1),r=this.addToHttpParams(r,"$expand",a,h.l2.Form,!1);let d=this.defaultHeaders;d=this.configuration.addCredentialToHeaders("Application","Authorization",d,"Bearer ");const u=this.configuration.selectHeaderAccept(["application/json"]);void 0!==u&&(d=d.set("Accept",u));let m="json";u&&(m=u.startsWith("text")?"text":this.configuration.isJsonMime(u)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("get",`${C}/HotelServices`,{params:r.toHttpParams(),responseType:m,...f?{withCredentials:f}:{},headers:d,observe:o})}getHotelServicesQuery(t,o="body",i=!1,a){const r=t.$select,d=t.$expand;let u=new h.rx(this.encoder);return u=this.addToHttpParams(u,"$select",r,h.l2.Form,!1),u=this.addToHttpParams(u,"$expand",d,h.l2.Form,!1),"/HotelServices?"+u.toString()}updateHotelServices(t,o="body"){const i=t?.pbxHotelServices;let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("patch",`${C}/HotelServices`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}updateHotelServicesQuery(t,o="body",i=!1,a){return"/HotelServices"}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275prov=s.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var mt=p(72788),eo=p(24112),on=p(45501),T=p(56998);function to(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.SpI("",e.bMT(1,1,"_i18n.ForwardDestinationNotFound")," ")}let no=(()=>{class n{route=(0,s.WQX)(S.nX);fb=(0,s.WQX)(l.ok);servicesApiService=(0,s.WQX)(Zi.W);hotelServicesApiService=(0,s.WQX)(nn);destroy$=(0,s.WQX)(s.abz);portMinValue=0;portMaxValue=65535;noAnswerTimeoutMinValue=0;noAnswerTimeoutMaxValue=1e9;hotelServices=this.route.snapshot.data.hotelServices??{};groups=this.route.snapshot.data.groups??[];initialEnabledValue=!!this.hotelServices.Enabled;form=this.createForm();constructor(){this.form.markAllAsTouched(),(0,T.XP)(this.f.Enabled).pipe((0,R.pQ)(this.destroy$)).subscribe(t=>{t?(this.f.IntegrationType.enable(),this.f.IpAddress.enable(),this.f.Port.enable(),this.f.HotelGroups.enable()):(this.f.IntegrationType.disable(),this.f.IpAddress.disable(),this.f.Port.disable(),this.f.HotelGroups.disable())})}get f(){return this.form.controls}integrationTypeOptions=[{value:"tcxpms",label:"Mitel SX2000"},{value:"fidelio",label:"Fidelio"}];createForm(){const t=this.fb.group({Enabled:this.hotelServices.Enabled??!1,IntegrationType:this.fb.control({value:this.hotelServices.IntegrationType??"tcxpms",disabled:!this.hotelServices.Enabled},[l.k0.required]),IpAddress:this.fb.control({value:this.hotelServices.IpAddress??"127.0.0.1",disabled:!this.hotelServices.Enabled},[l.k0.required,V.Ct]),Port:this.fb.control({value:this.hotelServices.Port??15734,disabled:!this.hotelServices.Enabled},[l.k0.required]),NoAnswerTimeout:[this.hotelServices.NoAnswerTimeout??20],NoAnswerDestination:this.hotelServices.NoAnswerDestination??{To:"None"},HotelGroups:this.fb.control(this.hotelServices.HotelGroups??[],{nonNullable:!0})});return this.hotelServices.Enabled||t.controls.HotelGroups.disable(),t}save$=()=>{const t={ServiceNames:["3CXHotelModule01"]},o=this.servicesApiService.enable({servicesEnableRequestBody:{options:t}}).pipe((0,I.n)(()=>this.servicesApiService.start({servicesStartRequestBody:{options:t}}))),i=this.servicesApiService.stop({servicesStopRequestBody:{options:t}}).pipe((0,I.n)(()=>this.servicesApiService.disable({servicesDisableRequestBody:{options:t}}))),a=this.hotelServicesApiService.updateHotelServices({pbxHotelServices:{...this.form.value}});return(this.initialEnabledValue===this.form.value.Enabled?(0,M.of)(!0):this.form.value.Enabled?o:i).pipe((0,I.n)(()=>a),(0,P.M)({complete:()=>{this.initialEnabledValue=!!this.form.value.Enabled}}))};static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["ng-component"]],decls:41,vars:32,consts:[["header","_i18n.HotelServices","helpUrl","_i18n.HotelUri",3,"formGroup","save$"],["formControlName","Enabled","data-qa","enabled","label","_i18n.PMSIntegration"],[1,"mb-3",3,"translate"],[1,"row"],[1,"col-lg-6"],["data-qa","integration-type","label","_i18n.PMSIntegrationType",3,"inlineLabel"],["data-qa","select","bindLabel","label","bindValue","value",2,"width","150px",3,"formControl","clearable","searchable","items"],[1,"d-flex","flex-column"],[1,"d-flex","align-items-baseline"],[1,"me-2"],["data-qa","ip-address","formControlName","IpAddress",1,"me-2","mb-0",2,"max-width","130px",3,"maxlength"],["data-qa","port","formControlName","Port",1,"mb-0",3,"integer","min","max"],[1,"form-control-validation"],["controlName","IpAddress","label","_i18n.PMSIpAddress"],["controlName","Port","label","_i18n.Port"],[1,"d-flex","flex-wrap","mb
1-3","gap-3"],[3,"translate"],[1,"mb-2"],[1,"d-flex","align-items-center","flex-wrap","gap-2"],["data-qa","no-answer-timeout","formControlName","NoAnswerTimeout",1,"mb-0",2,"max-width","50px",3,"integer","min","max"],["controlName","NoAnswerTimeout"],["formControlName","NoAnswerDestination","data-qa","no-answer-destination",3,"voicemailEnabled","externalNumberEnabled"],["controlName","NoAnswerDestination"],["valError","notFound"],["placeholder","_i18n.SelectGroupsPlaceholder","valueField","Name",1,"col-lg-6","d-block",3,"description","formControl","groups"],[3,"control"]],template:function(o,i){1&o&&(e.j41(0,"edit-panel",0)(1,"fieldset")(2,"legend"),e.nrm(3,"field-checkbox",1),e.k0s(),e.nrm(4,"label",2),e.j41(5,"div",3)(6,"div",4)(7,"field-wrapper",5),e.nrm(8,"ng-select",6),e.k0s(),e.j41(9,"div",7)(10,"div",8)(11,"label",9),e.EFF(12),e.nI1(13,"translate"),e.k0s(),e.nrm(14,"field-input",10)(15,"field-input-number",11),e.k0s(),e.j41(16,"div",12),e.nrm(17,"val-errors",13)(18,"val-errors",14),e.k0s()()()(),e.nrm(19,"div",15),e.k0s(),e.j41(20,"fieldset"),e.nrm(21,"legend",16),e.j41(22,"div",3)(23,"div",4)(24,"field-wrapper",17)(25,"div",18)(26,"span"),e.EFF(27),e.nI1(28,"translate"),e.k0s(),e.nrm(29,"field-input-number",19),e.j41(30,"span"),e.EFF(31),e.nI1(32,"translate"),e.k0s()(),e.nrm(33,"val-errors",20),e.k0s(),e.j41(34,"app-call-forwarding",21)(35,"val-errors",22),e.DNE(36,to,2,3,"ng-template",23),e.k0s()()()()(),e.j41(37,"fieldset"),e.nrm(38,"legend",16),e.j41(39,"app-departments-select",24),e.nrm(40,"val-errors",25),e.k0s()()()),2&o&&(e.Y8G("formGroup",i.form)("save$",i.save$),e.R7$(4),e.Y8G("translate","_i18n.HotelServicesDescription"),e.R7$(3),e.Y8G("inlineLabel",!0),e.R7$(),e.Y8G("formControl",i.f.IntegrationType)("clearable",!1)("searchable",!1)("items",i.integrationTypeOptions),e.R7$(4),e.JRh(e.bMT(13,26,"_i18n.PMSIpAddress")),e.R7$(2),e.Y8G("maxlength",50),e.R7$(),e.Y8G("integer",!0)("min",i.portMinValue)("max",i.portMaxValue),e.R7$(6),e.Y8G("translate","_i18n.UnansweredWakeUpCalls"),e.R7$(6),e.JRh(e.bMT(28,28,"_i18n.UnansweredIfNotAnsweredCallWithin")),e.R7$(2),e.Y8G("integer",!0)("min",i.noAnswerTimeoutMinValue)("max",i.noAnswerTimeoutMaxValue),e.R7$(2),e.JRh(e.bMT(32,30,"_i18n.UnansweredForwardCallsTo")),e.R7$(3),e.Y8G("voicemailEnabled",!1)("externalNumberEnabled",!1),e.R7$(4),e.Y8G("translate","_i18n.HotelRoomGroups"),e.R7$(),e.Y8G("description","_i18n.HotelGroupsDescription")("formControl",i.f.HotelGroups)("groups",i.groups),e.R7$(),e.Y8G("control",i.f.HotelGroups))},dependencies:[ne.Q,l.X1,l.BC,l.cb,l.tU,l.l_,l.j4,l.JD,ie.t,y.Mm,Z.z,Q.vr,te.m,mt.B,$.IH,eo.R,$.VI,on.N,y.D9],encapsulation:2})}return n})();var io=p(29158),an=p(93049),qe=p(83188),oo=p(93555),ke=p(4115),kt=p(30646),N=p(49769);const ao=()=>["/office/users/microsoft365"];function ro(n,c){if(1&n&&(e.j41(0,"p",2),e.EFF(1),e.nI1(2,"translate"),e.k0s(),e.j41(3,"app-external-link",3),e.nrm(4,"span",4),e.EFF(5),e.nI1(6,"translate"),e.k0s()),2&n){const t=e.XpG(2);e.R7$(),e.JRh(e.bMT(2,4,"_i18n.MS365StartPointStatus")),e.R7$(2),e.Y8G("href",t.ms365Status.ProvisionUrl)("disabled",t.params.isMcm),e.R7$(2),e.SpI(" ",e.bMT(6,6,"_i18n.Configure")," ")}}function so(n,c){if(1&n&&(e.j41(0,"p",9),e.EFF(1),e.nI1(2,"translate"),e.j41(3,"a",10),e.EFF(4),e.nI1(5,"translate"),e.k0s()(),e.eu8(6,11)),2&n){e.XpG();const t=e.sdS(3);e.R7$(),e.SpI(" ",e.bMT(2,4,"_i18n.MicrosoftConfiguredAndRunning")," "),e.R7$(2),e.Y8G("routerLink",e.lJ4(8,ao)),e.R7$(),e.JRh(e.bMT(5,6,"_i18n.ClickHereToSeeSettings")),e.R7$(2),e.Y8G("ngTemplateOutlet",t)}}function lo(n,c){if(1&n&&(e.j41(0,"alert",5)(1,"p",12),e.EFF(2),e.k0s(),e.j41(3,"p",13),e.EFF(4),e.nI1(5,"translate"),e.k0s(),e.eu8(6,11),e.k0s()),2&n){e.XpG();const t=e.sdS(3),o=e.XpG(2);e.R7$(2),e.JRh(o.ms365Status.ExceptionMessage),e.R7$(2),e.JRh(e.bMT(5,3,"_i18n.TemporaryIssueTryReprovision")),e.R7$(2),e.Y8G("ngTemplateOutlet",t)}}function co(n,c){if(1&n&&(e.j41(0,"p",14),e.EFF(1),e.nI1(2,"translate"),e.k0s(),e.j41(3,"app-external-link",15),e.nrm(4,"span",4),e.EFF(5),e.nI1(6,"translate"),e.k0s()),2&n){const t=e.XpG(3);e.R7$(),e.Lme(" ",e.bMT(2,5,"_i18n.YourAppIDReferenceIs")," ",t.ms365Status.ApplicationId," "),e.R7$(2),e.Y8G("href",t.ms365Status.ProvisionUrl)("disabled",t.params.isMcm),e.R7$(2),e.SpI(" ",e.bMT(6,7,"_i18n.Reconfigure")," ")}}function po(n,c){1&n&&(e.j41(0,"p",6),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&n&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"_i18n.MS365TestingNotifications")," "))}function uo(n,c){if(1&n&&(e.j41(0,"p"),e.EFF(1),e.k0s()),2&n){const t=e.XpG(4);e.R7$(),e.JRh(t.testResult.ExceptionMessage)}}function mo(n,c){if(1&n&&(e.j41(0,"alert",7)(1,"p"),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.nVh(4,uo,2,1,"p"),e.k0s()),2&n){const t=e.XpG(3);e.R7$(2),e.JRh(e.bMT(3,2,"_i18n.MS365NotificationsError")),e.R7$(2),e.vxM(t.testResult.ExceptionMessage?4:-1)}}function fo(n,c){1&n&&(e.j41(0,"p",8),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&n&&(e.R7$(),e.SpI(" ",e.bMT(2,1,"_i18n.MS365NotificationsWorking")," "))}function go(n,c){if(1&n&&(e.nVh(0,so,7,9)(1,lo,7,5,"alert",5),e.DNE(2,co,7,9,"ng-template",null,0,e.C5r),e.nVh(4,po,3,3,"p",6),e.nVh(5,mo,5,4,"alert",7),e.nVh(6,fo,3,3,"p",8)),2&n){const t=e.XpG(2);e.vxM(t.ms365Status.ExceptionMessage?1:0),e.R7$(4),e.vxM(t.testInProgress?4:-1),e.R7$(),e.vxM(t.testResult&&!t.testResult.IsSubscriptionAvailable?5:-1),e.R7$(),e.vxM(t.testResult&&t.testResult.IsSubscriptionAvailable?6:-1)}}
1function ho(n,c){if(1&n&&e.nVh(0,ro,7,8)(1,go,7,4),2&n){const t=e.XpG();e.vxM(t.ms365Status.ApplicationId?1:0)}}let Co=(()=>{class n{msService=(0,s.WQX)(io.Y);cd=(0,s.WQX)(_.gRc);modalService=(0,s.WQX)(B.B);destroyService=(0,s.WQX)(s.abz);ms365Status;testResult;testInProgress=!1;params;constructor(){const t=(0,s.WQX)(S.nX);this.params=t.snapshot.data.params}ngOnInit(){this.msService.getMicrosoft365Directory().pipe((0,R.pQ)(this.destroyService)).subscribe({next:t=>{this.ms365Status=t,t.ApplicationId&&!t.ExceptionMessage&&this.testSubscription(),this.cd.markForCheck()},error:t=>this.modalService.error(t)})}testSubscription(){this.testInProgress=!0,this.cd.markForCheck(),this.msService.testSubscription().pipe((0,R.pQ)(this.destroyService)).subscribe({next:t=>{this.testResult=t,this.testInProgress=!1,this.cd.markForCheck()},error:t=>{this.testInProgress=!1,this.cd.markForCheck(),this.modalService.error(t)}})}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-microsoft365-integration"]],decls:3,vars:2,consts:[["reconfigure",""],["header","_i18n.Microsoft365",3,"helpUrl"],["data-qa","not-configured"],["data-qa","configure",1,"btn","btn-primary","mb-3",3,"href","disabled"],["app-gear-solid-icon","",1,"svg-sm"],["type","danger","data-qa","has-error"],["data-qa","test-in-progress"],["type","warning","data-qa","test-failed"],["data-qa","test-ok"],["data-qa","no-error"],[1,"dashed_link",3,"routerLink"],[3,"ngTemplateOutlet"],["data-qa","error-msg"],["data-qa","try-reprovision"],["data-qa","application-id-reference"],["data-qa","reconfigure",1,"btn","btn-primary","mb-3",3,"href","disabled"]],template:function(o,i){1&o&&(e.j41(0,"app-page",1),e.nrm(1,"app-microsoft365-license"),e.nVh(2,ho,2,1),e.k0s()),2&o&&(e.Y8G("helpUrl","_i18n.Microsoft365Uri"),e.R7$(2),e.vxM(i.ms365Status?2:-1))},dependencies:[qe.H,oo.L,ke.P,kt.n,N.T3,Ae.Cy,an.Wk,y.D9],encapsulation:2,changeDetection:0})}return n})();var fe=p(19037),_o=p(52281),rn=p(21160),xt=p(2275),Ue=p(5595),ft=p(13961);const vo=()=>["/office/users/google"],So=n=>({p1:n});function To(n,c){if(1&n&&(e.j41(0,"p",1),e.EFF(1),e.nI1(2,"translate"),e.k0s(),e.j41(3,"app-external-link",2),e.nrm(4,"span",3),e.
1EFF(5),e.nI1(6,"translate"),e.k0s()),2&n){const t=e.XpG();e.R7$(),e.JRh(e.bMT(2,3,"_i18n.GoogleWorkspaceStartPointStatus")),e.R7$(2),e.Y8G("href",t.provisionUrl),e.R7$(2),e.SpI(" ",e.bMT(6,5,"_i18n.Configure")," ")}}function yo(n,c){if(1&n&&(e.j41(0,"p",4),e.EFF(1),e.nI1(2,"translate"),e.j41(3,"a",5),e.EFF(4),e.nI1(5,"translate"),e.k0s()(),e.j41(6,"p",6),e.EFF(7),e.nI1(8,"translate"),e.k0s(),e.j41(9,"app-external-link",7),e.nrm(10,"span",3),e.EFF(11),e.nI1(12,"translate"),e.k0s(),e.j41(13,"fieldset")(14,"legend"),e.EFF(15,"Google ReCaptcha"),e.k0s(),e.j41(16,"field-checkbox",8),e.nrm(17,"val-errors",9),e.k0s()()),2&n){const t=e.XpG();e.R7$(),e.SpI(" ",e.bMT(2,9,"_i18n.GoogleConfiguredAndRunning")," "),e.R7$(2),e.Y8G("routerLink",e.lJ4(17,vo)),e.R7$(),e.JRh(e.bMT(5,11,"_i18n.ClickHereToSeeSettings")),e.R7$(3),e.Lme(" ",e.bMT(8,13,"_i18n.YourProjectIDReferenceIs")," ",t.projectId," "),e.R7$(2),e.Y8G("href",t.provisionUrl),e.R7$(2),e.SpI(" ",e.bMT(12,15,"_i18n.Reconfigure")," "),e.R7$(5),e.Y8G("description","_i18n.ReCaptchaHint"),e.R7$(),e.Y8G("controlName","ReCaptchaEnabled")}}function Fo(n,c){if(1&n){const t=e.RV6();e.j41(0,"p",10),e.EFF(1),e.nI1(2,"translate"),e.k0s(),e.j41(3,"button",11),e.bIt("click",function(){s.eBV(t);const i=e.XpG();return s.Njj(i.startConfigure())}
1),e.nrm(4,"span",3),e.EFF(5),e.nI1(6,"translate"),e.k0s()}2&n&&(e.R7$(),e.JRh(e.bMT(2,2,"_i18n.GoogleStartPointStatus")),e.R7$(4),e.SpI(" ",e.bMT(6,4,"_i18n.Configure")," "))}function Ro(n,c){1&n&&(e.nrm(0,"p",12),e.nI1(1,"translate")),2&n&&e.Y8G("innerHTML",e.bMT(1,1,"_i18n.ConfigureGoogleSSODescription"),e.npT)}function Io(n,c){if(1&n&&(e.nrm(0,"p",12),e.nI1(1,"translate")),2&n){const t=e.XpG(2);e.Y8G("innerHTML",e.i5U(1,1,"_i18n.ConfigureGoogleSSODescriptionInProject",e.eq3(4,So,t.projectId)),e.npT)}}function Ao(n,c){if(1&n&&(e.nVh(0,Ro,2,3,"p",12)(1,Io,2,6,"p",12),e.j41(2,"p"),e.EFF(3),e.nI1(4,"translate"),e.j41(5,"app-simple-copy",13)(6,"strong",14),e.EFF(7),e.k0s()()(),e.nrm(8,"field-input",15)(9,"field-input-concealed-password",16)),2&n){const t=e.XpG();e.vxM(t.projectId?1:0),e.R7$(3),e.SpI(" ",e.bMT(4,4,"_i18n.ConfigureItem10Sub2")," "),e.R7$(2),e.Y8G("source",t.oauth2googleUrl),e.R7$(2),e.JRh(t.oauth2googleUrl)}}let $o=(()=>{class n{googleSettingsApi=(0,s.WQX)(rn.Y);cd=(0,s.WQX)(_.gRc);projectId;sub=new ft.yU;form=new l.gE({ReCaptchaEnabled:new l.MJ(!1,{nonNullable:!0}),ClientId:new l.MJ("",{nonNullable:!0}),ClientSecret:new l.MJ({Value:""},{nonNullable:!0})});isStartingPoint=!0;oauth2googleUrl;provisionUrl;get f(){return this.form.controls}constructor(){const t=(0,s.WQX)(S.nX),o=(0,s.WQX)(s.abz);t.data.pipe((0,R.pQ)(o)).subscribe(i=>{const a=i.systemParameters,r=i.googleSettings;this.form.setValue({ReCaptchaEnabled:r.ReCaptchaEnabled,ClientId:r.ClientId||"",ClientSecret:r.ClientSecret||{Value:""}}),this.projectId=r.ProjectId,this.oauth2googleUrl=`https://${a.PbxExternalHost}/oauth2google`,this.provisionUrl=r.ProvisionUrl,this.isStartingPoint=!(r.ClientSecret?.Value||r.ClientSecret?.Concealed)||!r.ClientId,this.cd.markForCheck()})}ngOnDestroy(){this.sub.unsubscribe()}save$=()=>this.googleSettingsApi.updateGoogleSettings({pbxGoogleSettings:this.form.value});startConfigure(){this.isStartingPoint=!1,this.cd.markForCheck()}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-google-integration"]],decls:9,vars:7,consts:[["header","_i18n.GoogleWorkspace","helpUrl","_i18n.GoogleUri",3,"formGroup","save$"],["data-qa","sync-not-configured"],["data-qa","sync-configure",1,"btn","btn-primary","mb-3",3,"href"],["app-gear-solid-icon","",1,"svg-sm"],["data-qa","no-error"],[1,"dashed_link",3,"routerLink"],["data-qa","application-id-reference"],["data-qa","reconfigure",1,"btn","btn-primary","mb-3",3,"href"],["label","_i18n.ReCaptchaEnabled","formControlName","ReCaptchaEnabled",3,"description"],[3,"controlName"],["data-qa","not-configured"],["data-qa","configure","type","button",1,"btn","btn-primary","mb-3",3,"click"],["data-qa","configure-description",3,"innerHTML"],["data-qa","oauth2google-url",1,"mt-1",3,"source"],["data-qa","text"],["data-qa","client-id","label","_i18n.ConfigureItem11","formControlName","ClientId"],["data-qa","client-secret","label","_i18n.ConfigureItem12","formControlName","ClientSecret"]],template:function(o,i){1&o&&(e.j41(0,"edit-panel",0),e.nVh(1,To,7,7)(2,yo,18,18),e.j41(3,"fieldset")(4,"legend"),e.EFF(5),e.nI1(6,"translate"),e.k0s(),e.nVh(7,Fo,7,6)(8,Ao,10,6),e.k0s()()),2&o&&(e.Y8G("formGroup",i.form)("save$",i.save$),e.R7$(),e.vxM(i.projectId?2:1),e.R7$(4),e.JRh(e.bMT(6,5,"_i18n.GoogleSSOIntegration")),e.R7$(2),e.vxM(i.isStartingPoint?7:8))},dependencies:[ne.Q,l.X1,l.BC,l.cb,l.j4,l.JD,ke.P,kt.n,xt.T,te.m,Ue.p,ie.t,$.IH,an.Wk,y.D9],encapsulation:2,changeDetection:0})}return n})(),sn=(()=>{class n extends ye.d{generateIamPolicyFile(t="body"){let o=this.defaultHeaders;o=this.configuration.addCredentialToHeaders("Application","Authorization",o,"Bearer ");const i=this.configuration.selectHeaderAccept(["application/json"]);void 0!==i&&(o=o.set("Accept",i));let a="json";i&&(a=i.startsWith("text")?"text":this.configuration.isJsonMime(i)?"json":"blob");const{basePath:d,withCredentials:u}=this.configuration;return this.httpClient.request("get",`${d}/AmazonIntegrationSettings/Pbx.GenerateIamPolicyFile()`,{responseType:a,...u?{withCredentials:u}:{},headers:o,observe:t})}generateIamPolicyFileQuery(t="body",o=!1,i){return"/AmazonIntegrationSettings/Pbx.GenerateIamPolicyFile()"}getAmazonIntegrationSettings(t,o="body"){const i=t?.$select,a=t?.$expand;let r=new h.rx(this.encoder);r=this.addToHttpParams(r,"$select",i,h.l2.Form,!1),r=this.addToHttpParams(r,"$expand",a,h.l2.Form,!1);let d=this.defaultHeaders;d=this.configuration.addCredentialToHeaders("Application","Authorization",d,"Bearer ");const u=this.configuration.selectHeaderAccept(["application/json"]);void 0!==u&&(d=d.set("Accept",u));let m="json";u&&(m=u.startsWith("text")?"text":this.configuration.isJsonMime(u)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("get",`${C}/AmazonIntegrationSettings`,{params:r.toHttpParams(),responseType:m,...f?{withCredentials:f}:{},headers:d,observe:o})}getAmazonIntegrationSettingsQuery(t,o="body",i=!1,a){const r=t.$select,d=t.$expand;let u=new h.rx(this.encoder);return u=this.addToHttpParams(u,"$select",r,h.l2.Form,!1),u=this.addToHttpParams(u,"$expand",d,h.l2.Form,!1),"/AmazonIntegrationSettings?"+u.toString()}updateAmazonIntegrationSettings(t,o="body"){const i=t?.pbxAmazonIntegrationSettings;let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("patch",`${C}/AmazonIntegrationSettings`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}updateAmazonIntegrationSettingsQuery(t,o="body",i=!1,a){return"/AmazonIntegrationSettings"}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275prov=s.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ko=p(36623),xo=p(15792),Et=p(48643),Eo=p(19158);const wo=(n,c)=>({p1:n,p2:c}),Po=n=>({p1:n});let Go=(()=>{class n{route=(0,s.WQX)(S.nX);amazonIntegrationSettingsApiService=(0,s.WQX)(sn);fileDownloadService=(0,s.WQX)(Et.y);cd=(0,s.WQX)(_.gRc);
1amazonIntegrationSettings=this.route.snapshot.data.amazonIntegrationSettings||{};isAwsRemoteStorageInUse=this.amazonIntegrationSettings.S3Config?.ApplyBucket??!1;form=this.createForm();linkToAmazonConsole="https://console.aws.amazon.com/";isSavingInProgress=!1;get f(){return this.form.controls}get serviceAccountCredentialsControls(){return this.f.ServiceAccountCredentials.controls}get s3ConfigControls(){return this.f.S3Config.controls}createForm(){const t=new l.gE({ServiceAccountCredentials:new l.gE({AccessKey:new l.MJ(this.amazonIntegrationSettings.ServiceAccountCredentials?.AccessKey??"",{nonNullable:!0}),SecretKey:new l.MJ({value:this.amazonIntegrationSettings.ServiceAccountCredentials?.SecretKey??{Value:""},disabled:!1},{nonNullable:!0})}),S3Config:new l.gE({Region:new l.MJ(this.amazonIntegrationSettings.S3Config?.Region??"",{nonNullable:!0}),BucketName:new l.MJ(this.amazonIntegrationSettings.S3Config?.BucketName??"",{nonNullable:!0}),ApplyBucket:new l.MJ(this.amazonIntegrationSettings.S3Config?.ApplyBucket??!1,{nonNullable:!0})})});return this.isAwsRemoteStorageInUse&&(t.controls.S3Config.controls.BucketName.setValidators([l.k0.required]),t.controls.S3Config.controls.Region.setValidators([l.k0.required]),t.controls.ServiceAccountCredentials.controls.AccessKey.setValidators([l.k0.required]),t.controls.ServiceAccountCredentials.controls.SecretKey.setValidators([l.k0.required])),t}save$=()=>(this.isSavingInProgress=!0,this.cd.markForCheck(),this.amazonIntegrationSettingsApiService.updateAmazonIntegrationSettings({pbxAmazonIntegrationSettings:this.form.value}).pipe((0,Me.j)(()=>{this.isSavingInProgress=!1,this.cd.markForCheck()})));generateIamPolicies(){this.fileDownloadService.download("/AmazonIntegrationSettings/Pbx.GenerateIamPolicyFile()")}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-amazon-integration"]],decls:53,vars:65,consts:[["header","_i18n.AmazonServices","helpUrl","_i18n.AmazonIntegrationUri",3,"formGroup","save$"],[1,"row"],[1,"col-xl-9"],["data-qa","no-error",3,"innerHTML"],["type","button","data-qa","download",1,"btn","btn-primary",3,"click"],[1,"col-xl-6"],["data-qa","no-error"],["label","_i18n.AmazonUserCredentialsAccessKey","data-qa","access-key",3,"formControl"],[3,"control"],["label","_i18n.AmazonUserCredentialsSecretKey","data-qa","secret-key",3,"formControl"],["label","_i18n.AmazonS3BucketName","hint","_i18n.AmazonS3BucketNameHint","data-qa","bucket-name",3,"formControl"],["label","_i18n.AmazonS3Region","description","_i18n.AmazonS3RegionHint","data-qa","region",3,"formControl"],["label","_i18n.AmazonS3ApplyBucket","hint","_i18n.AmazonS3ApplyBucketHint","data-qa","apply-the-bucket",3,"formControl"]],template:function(o,i){1&o&&(e.j41(0,"edit-panel",0)(1,"fieldset")(2,"div",1)(3,"div",2),e.nrm(4,"p",3),e.nI1(5,"translate"),e.nI1(6,"translate"),e.nI1(7,"appLinkify"),e.nI1(8,"translate"),e.nI1(9,"appLinkify"),e.nI1(10,"translate"),e.nI1(11,"safeHtml"),e.j41(12,"legend"),e.EFF(13),e.nI1(14,"translate"),e.k0s(),e.nrm(15,"p",3),e.nI1(16,"translate"),e.nI1(17,"translate"),e.nI1(18,"appLinkify"),e.nI1(19,"translate"),e.nI1(20,"safeHtml"),e.j41(21,"button",4),e.bIt("click",function(){return i.generateIamPolicies()}),e.nrm(22,"app-download-solid-icon"),e.j41(23,"span"),e.EFF(24),e.nI1(25,"translate"),e.k0s()()()()(),e.j41(26,"fieldset")(27,"div",1)(28,"div",5)(29,"legend"),e.EFF(30),e.nI1(31,"translate"),e.k0s(),e.j41(32,"p",6),e.EFF(33),e.nI1(34,"translate"),e.k0s(),e.j41(35,"field-input",7),e.nrm(36,"val-errors",8),e.k0s(),e.j41(37,"field-input-concealed-password",9),e.nrm(38,"val-errors",8),e.k0s()()()(),e.j41(39,"fieldset")(40,"div",1)(41,"div",5)(42,"legend"),e.EFF(43),e.nI1(44,"translate"),e.k0s(),e.j41(45,"p",6),e.EFF(46),e.nI1(47,"translate"),e.k0s(),e.j41(48,"field-input",10),e.nrm(49,"val-errors",8),e.k0s(),e.j41(50,"field-input",11),e.nrm(51,"val-errors",8),e.k0s(),e.nrm(52,"field-checkbox",12),e.k0s()()()()),2&o&&(e.Y8G("formGroup",i.form)("save$",i.save$),e.R7$(4),e.Y8G("innerHTML",e.bMT(11,34,e.i5U(10,31,"_i18n.AmazonGreetings",e.l_i(60,wo,e.i5U(7,23,e.bMT(5,19,"_i18n.AmazonIntegrationUri"),e.bMT(6,21,"_i18n.AmazonServicesGuide")),e.i5U(9,28,i.linkToAmazonConsole,e.bMT(8,26,"_i18n.AmazonConsole"))))),e.npT),e.R7$(9),e.JRh(e.bMT(14,36,"_i18n.AmazonUserInstructions")),e.R7$(2),e.Y8G("innerHTML",e.bMT(20,48,e.i5U(19,45,"_i18n.AmazonUserInstructionsGeneratePolicy",e.eq3(63,Po,e.i5U(18,42,e.bMT(16,38,"_i18n.AmazonIntegrationUri"),e.bMT(17,40,"_i18n.AmazonServicesGuide"))))),e.npT),e.R7$(9),e.JRh(e.bMT(25,50,"_i18n.AmazonGenerateIamPolicy")),e.R7$(6),e.JRh(e.bMT(31,52,"_i18n.AmazonUserCredentials")),e.R7$(3),e.SpI(" ",e.bMT(34,54,"_i18n.AmazonUserCredentialsInstructions")," "),e.R7$(2),e.Y8G("formControl",i.serviceAccountCredentialsControl
1s.AccessKey),e.R7$(),e.Y8G("control",i.serviceAccountCredentialsControls.AccessKey),e.R7$(),e.Y8G("formControl",i.serviceAccountCredentialsControls.SecretKey),e.R7$(),e.Y8G("control",i.serviceAccountCredentialsControls.SecretKey),e.R7$(5),e.JRh(e.bMT(44,56,"_i18n.AmazonS3Bucket")),e.R7$(3),e.SpI(" ",e.bMT(47,58,"_i18n.AmazonS3BucketInstruction")," "),e.R7$(2),e.Y8G("formControl",i.s3ConfigControls.BucketName),e.R7$(),e.Y8G("control",i.s3ConfigControls.BucketName),e.R7$(),e.Y8G("formControl",i.s3ConfigControls.Region),e.R7$(),e.Y8G("control",i.s3ConfigControls.Region),e.R7$(),e.Y8G("formControl",i.s3ConfigControls.ApplyBucket))},dependencies:[ne.Q,l.X1,l.BC,l.cb,l.l_,l.j4,te.m,Ue.p,ie.t,$.IH,ko.e,y.D9,xo.F,Eo.$],encapsulation:2,changeDetection:0})}return n})();var Ve=p(64277),Do=p(60007),ee=p(36463),No=p(30689),ln=p(12421),Be=p(84572),Vo=p(70152),ze=p(44668),J=p(13372),Bo=p(67374),Ke=p.n(Bo),cn=p(52101),gt=p(43218),Ho=p(97268),Oo=p(74536),dn=p(62382),wt=p(64631);const Xo=n=>({port:n}),Qo=n=>({minimumCalls:n});function Lo(n,c){if(1&n&&(e.j41(0,"alert",2)(1,"span"),e.EFF(2),e.nI1(3,"translate"),e.k0s()()),2&n){const t=e.XpG();e.R7$(2),e.JRh(e.i5U(3,1,"_i18n.RequiresSimultaneousCallsWarning",e.eq3(4,Qo,t.minNumberOfSimCallsRequired)))}}function Wo(n,c){1&n&&(e.j41(0,"alert",3)(1,"p"),e.EFF(2),e.nI1(3,"translate"),e.k0s()()),2&n&&(e.R7$(2),e.JRh(e.bMT(3,1,"_i18n.SecureSipRequiredWarning")))}function Yo(n,c){1&n&&(e.j41(0,"alert",9)(1,"p"),e.EFF(2),e.nI1(3,"translate"),e.k0s()()),2&n&&(e.R7$(2),e.JRh(e.bMT(3,1,"_i18n.TeamsDynamicIpWarning")))}function Jo(n,c){1&n&&(e.j41(0,"alert",10)(1,"p"),e.EFF(2),e.nI1(3,"translate"),e.k0s()()),2&n&&(e.R7$(2),e.JRh(e.bMT(3,1,"_i18n.TeamsFqdnWarning")))}function qo(n,c){if(1&n&&(e.qex(0,24),e.nrm(1,"span",27),e.j41(2,"span"),e.EFF(3),e.nI1(4,"translate"),e.nI1(5,"amLocal"),e.nI1(6,"amDateFormat"),e.k0s(),e.bVm()),2&n){const t=e.XpG(2);e.R7$(),e.AVh("fillIconRed",t.isSbcCertificateExpired),e.R7$(),e.AVh("text-error",t.isSbcCertificateExpired),e.R7$(),e.Lme(" ",e.bMT(4,6,t.isSbcCertificateExpired?"_i18n.ExpiredOn":"_i18n.ValidUntil")," ",e.i5U(6,10,e.bMT(5,8,t.sbcCertificateExpirationDate),"L LTS"))}}function Uo(n,c){if(1&n&&(e.j41(0,"field-input-file",23),e.nVh(1,qo,7,13,"ng-container",24),e.nrm(2,"val-errors",25),e.k0s(),e.j41(3,"field-input-file",26),e.nrm(4,"val-errors",25),e.k0s()),2&n){const t=e.XpG();e.Y8G("formControl",t.f.SbcCertificate)("incorrectExtensionText","_i18n.InvalidCertificateFileFormat")("readContent",!0)("description","true"),e.R7$(),e.vxM(t.f.SbcCertificate.pristine&&t.sbcCertificateExpirationDate?1:-1),e.R7$(),e.Y8G("control",t.f.SbcCertificate),e.R7$(),e.Y8G("formControl",t.f.SbcPrivateKey)("incorrectExtensionText","_i18n.InvalidCertificateFileFormat")("readContent",!0),e.R7$(),e.Y8G("control",t.f.SbcPrivateKey)}}function zo(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.OnlyDigitsAllowed"))}function Ko(n,c){1&n&&e.eu8(0)}function Zo(n,c){1&n&&e.eu8(0)}function ea(n,c){1&n&&(e.j41(0,"div",28),e.nrm(1,"span",27)(2,"span",6),e.k0s()),2&n&&(e.R7$(2),e.Y8G("translate","_i18n.SaveToDownloadScript"))}function ta(n,c){if(1&n&&e.nVh(0,ea,3,1,"div",28),2&n){const t=e.XpG();e.vxM(t.isMicrosoftTeamsEnabled&&!t.form.pristine?0:-1)}}const na=["AU","CY","DE","FR","IT","UK","US","OTHER"];let ia=(()=>{class n{route=(0,s.WQX)(S.nX);cd=(0,s.WQX)(_.gRc);ms365TeamsIntegrationApi=(0,s.WQX)(ln.a);fileDownloadService=(0,s.WQX)(Et.y);modalService=(0,s.WQX)(B.B);destroy$=(0,s.WQX)(s.abz);dialPlanCodeOptions=[{label:"Australia",value:"AU"},{label:"Cyprus",value:"CY"},{label:"France",value:"FR"},{label:"Germany",value:"DE"},{label:"Italy",value:"IT"},{label:"United Kingdom",value:"UK"},{label:"United States",value:"US"},{label:"Other",value:"OTHER"}];minNumberOfSimCallsRequired=16;isMultiCompanyMode=this.route.snapshot.data.isMultiCompanyMode;isEnterprise=this.route.snapshot.data.isEnterprise;maxSimultaneousCalls=this.route.snapshot.data.maxSimCalls??0;isTeamsAllowed=this.isEnterprise&&!this.isMultiCompanyMode;microsoft365TeamsIntegration=this.route.snapshot.data.microsoft365TeamsIntegration??{};form=this.createForm();isFqdnInvalid$=E.w;ngOnInit(){(0,Be.z)([(0,T.XP)(this.f.Enabled),(0,T.XP)(this.f.DialPlanCode),(0,T.XP)(this.f.SbcFQDN)]).pipe((0,R.pQ)(this.destroy$)).subscribe({next:([t,o,i])=>{this.setFieldsEnabled(t,o)}}),this.f.SbcFQDN.valueChanges.pipe((0,R.pQ)(this.destroy$)).subscribe({next:()=>{this.f.SbcCertificate.value&&this.f.SbcCertificate.setErrors(null),this.f.SbcPrivateKey.value&&this.f.SbcPrivateKey.setErrors(null)}}),this.f.DialPlanCode.valueChanges.pipe((0,R.pQ)(this.destroy$)).subscribe({next:t=>{this.isAreaCodeEnabled(t)||this.f.AreaCode.setValue("")}}
1),this.isTeamsAllowed||this.form.disable(),this.isTeamsAllowed&&(this.isFqdnInvalid$=(0,T.XP)(this.f.SbcFQDN).pipe((0,Vo.B)(1e3),(0,I.n)(t=>this.ms365TeamsIntegrationApi.checkFqdnRecord({fqdn:t??""}).pipe((0,A.W)(()=>(0,M.of)({value:!1})))),(0,v.T)(t=>!t.value),(0,ze.t)({refCount:!1,bufferSize:1})))}createForm(){return new l.gE({Enabled:new l.MJ(this.microsoft365TeamsIntegration.Enabled??!1,{nonNullable:!0}),SbcFQDN:new l.MJ(this.microsoft365TeamsIntegration.SbcFQDN??"",{nonNullable:!0,validators:l.k0.required}),SbcCertificate:new l.MJ((0,J.s)(this.microsoft365TeamsIntegration.SbcCertificate),{nonNullable:!0,validators:[l.k0.required,V.PD]}),SbcPrivateKey:new l.MJ((0,J.s)(this.microsoft365TeamsIntegration.SbcPrivateKey),{nonNullable:!0,validators:[l.k0.required,V.PD]}),DialPlanCode:new l.MJ(this.microsoft365TeamsIntegration.DialPlanCode??"",{nonNullable:!0,validators:[l.k0.required,(0,V.J9)(na)]}),AreaCode:new l.MJ(this.microsoft365TeamsIntegration.AreaCode??"",{nonNullable:!0,validators:l.k0.pattern(/^\d+$/)})})}
1restrictedModification=this.isEnterprise?this.isMultiCompanyMode?Y.v.Mcm:Y.v.None:Y.v.Enterprise;get f(){return this.form.controls}get isMicrosoftTeamsEnabled(){return this.isTeamsAllowed&&this.f.Enabled.value}get IsDynamicIp(){return this.f.Enabled&&this.microsoft365TeamsIntegration.IsDynamicIP}get isScriptGenerationEnabled(){return this.isMicrosoftTeamsEnabled&&this.form.pristine}get sbcFqdnMatchesSipDomain(){return this.matchIgnoreCase(this.f.SbcFQDN.value,this.microsoft365TeamsIntegration.SipDomain)}get tlsPort(){return this.sbcFqdnMatchesSipDomain?this.microsoft365TeamsIntegration.TlsPortForNativeFQDN??5061:this.microsoft365TeamsIntegration.TlsPortForNonNativeFQDN??5062}get sbcCertificateExpirationDate(){return this.microsoft365TeamsIntegration.SbcCertificateExpirationDate?new Date(this.microsoft365TeamsIntegration.SbcCertificateExpirationDate):null}get isSbcCertificateExpired(){return this.sbcCertificateExpirationDate&&Ke()(this.sbcCertificateExpirationDate).isBefore(Ke()())}get showSecureSipWarning(){return!1===this.microsoft365TeamsIntegration.SecureSipEnabled}get showRequiresSimCallsWarning(){return this.isTeamsAllowed&&this.maxSimultaneousCalls<this.minNumberOfSimCallsRequired}matchIgnoreCase(t,o){return!!t&&!!o&&t.toUpperCase()===o.toUpperCase()}isAreaCodeEnabled(t){return"AU"===t||"DE"===t}setFieldsEnabled(t,o){(0,T.TZ)(this.f.SbcFQDN,t),(0,T.sS)([this.f.SbcCertificate,this.f.SbcPrivateKey],t&&!this.sbcFqdnMatchesSipDomain),(0,T.TZ)(this.f.DialPlanCode,t),(0,T.TZ)(this.f.AreaCode,t&&this.isAreaCodeEnabled(o))}generateDialPlanScript(){this.isScriptGenerationEnabled&&this.fileDownloadService.download(this.ms365TeamsIntegrationApi.getDialPlanScriptQuery())}generateUsersScript(){this.isScriptGenerationEnabled&&this.ms365TeamsIntegrationApi.checkMapUsersScript().pipe((0,v.T)(t=>!!t.value)).subscribe({next:t=>{t?this.fileDownloadService.download(this.ms365TeamsIntegrationApi.getMapUsersScriptQuery()):this.modalService.error("_i18n.NoUsersInTeams")},error:t=>this.modalService.error(t)})}save$=()=>{const{SbcCertificate:t,SbcPrivateKey:o,...i}=this.form.value;return this.ms365TeamsIntegrationApi.updateMicrosoft365TeamsIntegration({pbxMicrosoft365TeamsIntegration:{SbcCertificate:(0,J.W)(t),SbcPrivateKey:(0,J.W)(o),...i}}).pipe((0,I.n)(()=>this.ms365TeamsIntegrationApi.getMicrosoft365TeamsIntegration({})),(0,P.M)(a=>{(this.microsoft365TeamsIntegration.Enabled!==this.f.Enabled.value||this.f.SbcFQDN.enabled&&!this.matchIgnoreCase(this.f.SbcFQDN.value,this.microsoft365TeamsIntegration.SbcFQDN))&&(0,cn.fb)(this.modalService),this.microsoft365TeamsIntegration=a||{},this.f.SbcCertificate.setValue((0,J.s)(this.microsoft365TeamsIntegration.SbcCertificate)),this.f.SbcPrivateKey.setValue((0,J.s)(this.microsoft365TeamsIntegration.SbcPrivateKey)),this.cd.markForCheck()}))};static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["ng-component"]],decls:54,vars:48,consts:[["scriptGenerationDisabledInfo",""],["header","_i18n.TeamsDirectRouting","helpUrl","_i18n.Microsoft365TeamsUri","saveDisabledByReasonView","tooltip",3,"formGroup","save$","saveDisabledByReason"],["type","info","data-qa","sim-calls-warning"],["type","danger","data-qa","secure-sip-warning"],[1,"border-0"],["label","_i18n.EnableMicrosoftTeams","formControlName","Enabled","data-qa","enabled"],[3,"translate"],["formControlName","SbcFQDN","placeholder","_i18n.MicrosoftFQDN","data-qa","sbc-fqdn"],["controlName","SbcFQDN"],["type","warning","data-qa","dynamic-ip-warning"],["type","warning","data-qa","fqdn-invalid"],[3,"innerHTML"],["type","info"],[1,"mb-3"],["label","_i18n.Country","formControlName","DialPlanCode","data-qa","dial-plan-code",3,"options","hideAsterisk"],["controlName","DialPlanCode"],["label","_i18n.AreaCode","formControlName","AreaCode","data-qa","area-code","allowedInputPattern","\\d",3,"maxlength"],["controlName","AreaCode"],["valError","pattern"],["type","button","data-qa","generate-dial-plan-script",1,"btn","btn-primary",3,"click","disabled"],[1,"svg-sm"],[4,"ngTemplateOutlet"],["type","button","data-qa","generate-users-script",1,"btn","btn-primary",3,"click","disabled"],["label","_i18n.Certificate","data-qa","upload-sbc-certificate","accept",".pem",3,"formControl","incorrectExtensionText","readContent","description"],["ngProjectAs","[description]",5,["","description",""]],[3,"control"],["label","_i18n.PrivateKey","data-qa","upload-sbc-private-key","accept",".pem",3,"formControl","incorrectExtensionText","readContent"],["app-info-circle-solid-icon","",1,"customSVGIcons","svg-xs"],[1,"d-flex","align-items-center","gap-1","form-text"]],template:function(o,i){if(1&o&&(e.j41(0,"edit-panel",1),e.nI1(1,"LicenseRestricted"),e.nVh(2,Lo,4,6,"alert",2),e.nVh(3,Wo,4,3,"alert",3),e.j41(4,"legend",4),e.nrm(5,"field-checkbox",5),e.k0s(),e.j41(6,"fieldset"),e.nrm(7,"legend",6),e.j41(8,"field-input",7),e.nrm(9,"val-errors",8),e.k0s(),e.nVh(10,Yo,4,3,"alert",9),e.nVh(11,Jo,4,3,"alert",10),e.nI1(12,"async"),e.k0s(),e.j41(13,"fieldset"),e.nrm(14,"legend",6),e.j41(15,"p",11),e.nI1(16,"translate"),e.EFF(17,"Microsoft requires a certificate from one of the following providers"),e.k0s(),e.nVh(18,Uo,5,10),e.j41(19,"alert",12),e.
1EFF(20),e.nI1(21,"translate"),e.k0s()(),e.j41(22,"fieldset",13),e.nrm(23,"legend",6),e.j41(24,"p",11),e.nI1(25,"translate"),e.EFF(26,"Select your country to adjust the dial plan script. For more information, check this guide"),e.k0s(),e.j41(27,"field-select",14),e.nrm(28,"val-errors",15),e.k0s(),e.j41(29,"field-input",16)(30,"val-errors",17),e.DNE(31,zo,2,3,"ng-template",18),e.k0s()(),e.j41(32,"button",19),e.bIt("click",function(){return i.generateDialPlanScript()}),e.nrm(33,"app-cog-solid-icon",20),e.j41(34,"span"),e.EFF(35),e.nI1(36,"translate"),e.k0s()(),e.DNE(37,Ko,1,0,"ng-container",21),e.k0s(),e.j41(38,"fieldset"),e.nrm(39,"legend",6),e.j41(40,"p"),e.EFF(41),e.nI1(42,"translate"),e.k0s(),e.j41(43,"p"),e.EFF(44),e.nI1(45,"translate"),e.k0s(),e.j41(46,"button",22),e.bIt("click",function(){return i.generateUsersScript()}),e.nrm(47,"app-cog-solid-icon",20),e.j41(48,"span"),e.EFF(49),e.nI1(50,"translate"),e.k0s()(),e.DNE(51,Zo,1,0,"ng-container",21),e.k0s()(),e.DNE(52,ta,1,1,"ng-template",null,0,e.C5r)),2&o){const a=e.sdS(53);e.Y8G("formGroup",i.form)("save$",i.save$)("saveDisabledByReason",e.i5U(1,26,"",i.restrictedModification)),e.R7$(2),e.vxM(i.showRequiresSimCallsWarning?2:-1),e.R7$(),e.vxM(i.showSecureSipWarning?3:-1),e.R7$(4),e.Y8G("translate","_i18n.MicrosoftTeamsStep1"),e.R7$(3),e.vxM(i.IsDynamicIp?10:-1),e.R7$(),e.vxM(!i.IsDynamicIp&&e.bMT(12,29,i.isFqdnInvalid$)?11:-1),e.R7$(3),e.Y8G("translate","_i18n.MicrosoftTeamsStep2"),e.R7$(),e.Y8G("innerHTML",e.bMT(16,31,"_i18n.MicrosoftTeamsStep2Description"),e.npT),e.R7$(3),e.vxM(i.sbcFqdnMatchesSipDomain?-1:18),e.R7$(2),e.JRh(e.i5U(21,33,"_i18n.TlsPortHint",e.eq3(46,Xo,i.tlsPort))),e.R7$(3),e.Y8G("translate","_i18n.MicrosoftTeamsStep3"),e.R7$(),e.Y8G("innerHTML",e.bMT(25,36,"_i18n.MicrosoftTeamsStep3Description"),e.npT),e.R7$(3),e.Y8G("options",i.dialPlanCodeOptions)("hideAsterisk",!0),e.R7$(2),e.Y8G("maxlength",6),e.R7$(3),e.Y8G("disabled",!i.isScriptGenerationEnabled),e.R7$(3),e.JRh(e.bMT(36,38,"_i18n.GenerateDialPlanScript")),e.R7$(2),e.Y8G("ngTemplateOutlet",a),e.R7$(2),e.Y8G("translate","_i18n.MicrosoftTeamsStep4"),e.R7$(2),e.JRh(e.bMT(42,40,"_i18n.MicrosoftTeamsStep4Description1")),e.R7$(3),e.JRh(e.bMT(45,42,"_i18n.MicrosoftTeamsStep4Description2")),e.R7$(2),e.Y8G("disabled",!i.isScriptGenerationEnabled),e.R7$(3),e.JRh(e.bMT(50,44,"_i18n.GenerateUsersScript")),e.R7$(2),e.Y8G("ngTemplateOutlet",a)}},dependencies:[ne.Q,l.X1,l.BC,l.cb,l.tU,l.l_,l.j4,l.JD,Ae.Cy,ie.t,y.Mm,te.m,$.IH,gt.y,Ho.W,Te.q,$.VI,Oo.Z,N.T3,N.Jj,y.D9,Y.R,dn.a,wt.h],encapsulation:2})}return n})();var oa=p(19451),xe=p(32271),Pt=p(27980),aa=p(99421),w=p(69340),ra=p(13220),He=p(29325),Ze=p(30786);let sa=(()=>{class n extends k.m{installationCommand;static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275cmp=e.VBU({type:n,selectors:[["app-transcribe-engine-installation-modal"]],inputs:{installationCommand:"installationCommand"},features:[e.Vt3],decls:6,vars:6,consts:[["header","_i18n.Engine3CXLocalInstallationGuideHeader",3,"buttons"],[1,"setup-step",3,"innerHTML"],[3,"source"],[1,"text-truncate","m-0","bg-console"]],template:function(o,i){1&o&&(e.j41(0,"app-modal-dialog",0),e.nrm(1,"div",1),e.nI1(2,"translate"),e.j41(3,"app-simple-copy",2)(4,"pre",3),e.EFF(5),e.k0s()()()),2&o&&(e.Y8G("buttons",i.buttons),e.R7$(),e.Y8G("innerHTML",e.bMT(2,4,"_i18n.Engine3CXLocalSetupStep2"),e.npT),e.R7$(2),e.Y8G("source",i.installationCommand),e.R7$(2),e.JRh(i.installationCommand))},dependencies:[me.p,xt.T,y.D9],styles:["[_nghost-%COMP%]     h5{display:none}"]})}return n})();const la=(n,c)=>c.Converter.Host,ca=(n,c)=>c.Id;function da(n,c){if(1&n){const t=e.RV6();e.j41(0,"tr",5),e.nrm(1,"td"),e.j41(2,"td"),e.EFF(3),e.k0s(),e.j41(4,"td"),e.EFF(5),e.k0s(),e.j41(6,"td"),e.EFF(7),e.k0s(),e.j41(8,"td"),e.EFF(9),e.nI1(10,"translate"),e.k0s(),e.j41(11,"td"),e.EFF(12),e.k0s(),e.j41(13,"td",9),e.EFF(14),e.nI1(15,"translate"),e.k0s(),e.j41(16,"td",9),e.EFF(17),e.k0s(),e.j41(18,"td"),e.EFF(19),e.k0s(),e.j41(20,"td"),e.EFF(21),e.k0s(),e.j41(22,"td",9),e.EFF(23),e.k0s(),e.j41(24,"td"),e.EFF(25),e.k0s(),e.j41(26,"td"),e.EFF(27),e.k0s(),e.j41(28,"td",4)(29,"row-action-button")(30,"li",10)(31,"button",11),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG(2);return s.Njj(a.showConfigGuide(i))}),e.EFF(32),e.nI1(33,"translate"),e.k0s()(),e.j41(34,"li",10)(35,"button",12),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG(2);return s.Njj(a.delete(i))}),e.EFF(36),e.nI1(37,"translate"),e.k0s()()()()()}if(2&n){const t=c.$implicit,o=e.XpG(2);e.R7$(),e.HbH(e.VkB("row-indicator ",t.Off?"off":t.Available?"available":"inactive"," p-1")),e.R7$(2),e.JRh(t.Converter.Host),e.R7$(2),e.JRh(t.Converter.Ip),e.R7$(2),e.JRh(t.Converter.Version),e.R7$(2),e.JRh(e.bMT(10,17,t.Available?"_i18n.Up":"_i18n.Down")),e.R7$(3),e.SpI(" ",t.TranscriptionQueue),e.R7$(2),e.JRh(o.formatNumber(t.ClockSkew,e.bMT(15,19,"_i18n.ReportsSeconds").toLowerCase())),e.R7$(3),e.JRh(o.formatNumber(t.Delay,"ms")),e.R7$(2),e.JRh(o.formatPercent(t.Cpu)),e.R7$(2),e.JRh(o.formatPercent(t.MemoryPerc)),e.R7$(2),e.JRh(o.formatPercent(t.DiskSpacePerc,!0)),e.R7$(2),e.JRh((null==t.Sessions?null:t.Sessions.length)??0),e.R7$(2),e.JRh(t.Instances??0),e.R7$(5),e.SpI(" ",e.bMT(33,21,"_i18n.InstallationCommand")," "),e.R7$(4),e.SpI(" ",e.bMT(37,23,"_i18n.Delete")," ")}}function pa(n,c){1&n&&(e.j41(0,"tr")(1,"td",13),e.EFF(2),e.nI1(3,"translate"),e.k0s()()),2&n&&(e.R7$(2),e.SpI(" ",e.bMT(3,1,"_i18n.ReportsNoData")," "))}function ua(n,c){if(1&n&&(e.j41(0,"tr",8)(1,"td"),e.EFF(2),e.k0s(),e.j41(3,"td"),e.EFF(4),e.k0s(),e.j41(5,"td"),e.EFF(6),e.nI1(7,"translate"),e.k0s(),e.j41(8,"td"),e.EFF(9),e.k0s(),e.j41(10,"td"),e.EFF(11),e.k0s()()),2&n){const t=c.$implicit,o=e.XpG(2);e.R7$(2),e.JRh(null==t.Converter.Converter?null:t.Converter.Converter.Host),e.R7$(2),e.JRh(o.formatPercent(t.Progress)),e.R7$(2),e.JRh(o.formatNumber(o.getEstimatedTimeSeconds(t.Eta),e.bMT(7,5,"_i18n.ReportsSeconds").toLowerCase())),e.R7$(3),e.JRh(t.Descr),e.R7$(2),e.JRh(o.formatDateTime(t.Converter.Ts))}}function ma(n,c){1&n&&(e.j41(0,"tr")(1,"td",14),e.EFF(2),e.nI1(3,"translate"),e.k0s()()),2&n&&(e.R7$(2),e.SpI(" ",e.bMT(3,1,"_i18n.ReportsNoData")," "))}function fa(n,c){if(1&n&&(e.j41(0,"table",1)(1,"thead")(2,"tr")(3,"th",2),e.EFF(4),e.nI1(5,"translate"),e.k0s()(),e.j41(6,"tr"),e.nrm(7,"th",3),e.j41(8,"th"),e.EFF(9),e.nI1(10,"translate"),e.k0s(),e.j41(11,"th"),e.EFF(12),e.nI1(13,"translate"),e.k0s(),e.j41(14,"th"),e.EFF(15),e.nI1(16,"translate"),e.k0s(),e.j41(17,"th"),e.EFF(18),e.nI1(19,"translate"),e.k0s(),e.j41(20,"th"),e.EFF(21),e.nI1(22,"translate"),e.k0s(),e.j41(23,"th"),e.EFF(24),e.nI1(25,"translate"),e.k0s(),e.j41(26,"th"),e.EFF(27),e.nI1(28,"translate"),e.k0s(),e.j41(29,"th"),e.EFF(30),e.nI1(31,"translate"),e.k0s(),e.j41(32,"th"),e.EFF(33),e.nI1(34,"translate"),e.k0s(),e.j41(35,"th"),e.EFF(36),e.nI1(37,"translate"),e.k0s(),e.j41(38,"th"),e.EFF(39),e.nI1(40,"translate"),e.k0s(),e.j41(41,"th"),e.EFF(42),e.nI1(43,"translate"),e.k0s(),e.nrm(44,"th",4),e.k0s()(),e.j41(45,"tbody"),e.Z7z(46,da,38,25,"tr",5,la),e.nVh(48,pa,4,3,"tr"),e.k0s()(),e.j41(49,"table",6)(50,"thead")(51,"tr")(52,"th",7),e.EFF(53),e.nI1(54,"translate"),e.k0s()(),e.j41(55,"tr")(56,"th"),e.EFF(57),e.nI1(58,"translate"),e.k0s(),e.j41(59,"th"),e.EFF(60),e.nI1(61,"translate"),e.k0s(),e.j41(62,"th"),e.EFF(63),e.nI1(64,"translate"),e.k0s(),e.j41(65,"th"),e.EFF(66),e.nI1(67,"translate"),e.k0s(),e.j41(68,"th"),e.EFF(69),e.nI1(70,"translate"),e.k0s()()(),e.j41(71,"tbody"),e.Z7z(72,ua,12,7,"tr",8,ca),e.nVh(74,ma,4,3,"tr"),e.k0s()()),2&n){const t=c;e.R7$(4),e.JRh(e.bMT(5,21,"_i18n.TranscriptionEngineStatus")),e.R7$(5),e.JRh(e.bMT(10,23,"_i18n.Host")),e.R7$(3),e.JRh(e.bMT(13,25,"_i18n.IP")),e.R7$(3),e.JRh(e.bMT(16,27,"_i18n.MCUVersion")),e.R7$(3),e.JRh(e.bMT(19,29,"_i18n.Status")),e.R7$(3),e.JRh(e.bMT(22,31,"_i18n.TranscriptionQueue")),e.R7$(3),e.JRh(e.bMT(25,33,"_i18n.MCUClockskew")),e.R7$(3),e.JRh(e.bMT(28,35,"_i18n.MCUDelay")),e.R7$(3),e.JRh(e.bMT(31,37,"_i18n.MCUCpu")),e.R7$(3),e.JRh(e.bMT(34,39,"_i18n.MCUMemory")),e.R7$(3),e.JRh(e.bMT(37,41,"_i18n.MCUFreeDisk")),e.R7$(3),e.JRh(e.bMT(40,43,"_i18n.CurrentConversions")),e.R7$(3),e.JRh(e.bMT(43,45,"_i18n.MaxConversions")),e.R7$(4),e.Dyx(t.engines),e.R7$(2),e.vxM(null!=t.engines&&t.engines.length?-1:48),e.R7$(5),e.JRh(e.bMT(54,47,"_i18n.ActiveTranscriptions")),e.R7$(4),e.JRh(e.bMT(58,49,"_i18n.Host")),e.R7$(3),e.JRh(e.bMT(61,51,"_i18n.Progress")),e.R7$(3),e.JRh(e.bMT(64,53,"_i18n.EstimatedTime")),e.R7$(3),e.JRh(e.bMT(67,55,"_i18n.TaskName")),e.R7$(3),e.JRh(e.bMT(70,57,"_i18n.TranscriptionLastIdle")),e.R7$(3),e.Dyx(t.activeTranscriptions),e.R7$(2),e.vxM(null!=t.activeTranscriptions&&t.activeTranscriptions.length?-1:74)}}function ga(n,c){1&n&&(e.j41(0,"div",0)(1,"div",15),e.nrm(2,"div",16),e.k0s()())}let ha=(()=>{class n{deleteConverter=(0,_.CGW)();voicemailSettingsApi=(0,s.WQX)(Pt.Q);modalService=(0,s.WQX)(B.B);
1transcriptionStatus$=(0,Be.z)([(0,Se.O)(0,1e4).pipe((0,Ze.p)(()=>this.voicemailSettingsApi.getConfiguredConverters()),x.yh),(0,Se.O)(0,2e3).pipe((0,Ze.p)(()=>this.voicemailSettingsApi.getConnectedConvertersData()),x.yh)]).pipe((0,v.T)(([t,o])=>{const i=[...o.map(r=>({...r,Off:!1,InstallationCommand:t.find(d=>d.Guid===r.Converter?.Guid)?.InstallScript})),...t.filter(r=>!o.some(d=>d.Converter?.Guid===r.Guid)).map(r=>({Converter:r,Off:!0,InstallationCommand:r.InstallScript}))],a=i.reduce((r,d)=>r.concat(d.Sessions?.map(u=>({...u,Converter:d}))??[]),[]);return{engines:i,activeTranscriptions:a}}),(0,x.Tg)(this.modalService));delete(t){const o=t.Converter?.Guid;o&&this.modalService.confirmDeletion("_i18n.TranscriptionConverterDeleteConfirmation").subscribe(()=>{this.deleteConverter.emit(o)})}showConfigGuide(t){t.InstallationCommand&&this.modalService.showDialog(sa,{installationCommand:t.InstallationCommand})}formatPercent(t,o=!1){return"number"==typeof t?Math.max(Math.min(o?100-t:t,100),0)+"%":""}formatNumber(t,o){return"number"==typeof t?t+" "+o:""}getEstimatedTimeSeconds(t){return t?Math.max(0,Ke()(t).diff(Ke()(),"seconds")):void 0}formatDateTime(t){return t?Ke().utc(t).format("L LTS"):""}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-transcribe-engine-3cx-local-status"]],outputs:{deleteConverter:"deleteConverter"},decls:3,vars:3,consts:[[1,"row","my-3"],["data-qa","transcribe-converters",1,"scrollable-table","mb-4","w-100"],["colspan","10",1,"mx-2"],[1,"row-indicator"],[1,"actions"],["data-qa","transcribe-converter"],["data-qa","active-transcriptions",1,"scrollable-table","mb-4","w-100"],["colspan","5",1,"mx-2"],["data-qa","active-transcription"],["nowrap",""],["role","menuitem"],["type","button","data-qa","config-guide",1,"dropdown-item",3,"click"],["type","button","data-qa","delete",1,"dropdown-item",3,"click"],["colspan","10",1,"text-center"],["colspan","5",1,"text-center"],[1,"col-lg-6"],["data-qa","loader",1,"loader"]],template:function(o,i){if(1&o&&(e.nVh(0,fa,75,59),e.nI1(1,"async"),e.vZN(2,ga,3,0,"div",0)),2&o){let a;e.vxM((a=e.bMT(1,1,i.transcriptionStatus$))?0:2,a)}},dependencies:[He.I,y.D9,N.Jj],styles:["table[_ngcontent-%COMP%]   .row-indicator[_ngcontent-%COMP%]{padding:0;width:5px}table[_ngcontent-%COMP%]   .row-indicator.inactive[_ngcontent-%COMP%]{background-color:var(--error)}table[_ngcontent-%COMP%]   .row-indicator.available[_ngcontent-%COMP%]{background-color:var(--status-available)}table[_ngcontent-%COMP%]   .row-indicator.off[_ngcontent-%COMP%]{background-color:var(--status-off)}table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{height:30px}"],changeDetection:0})}return n})();var Gt=p(56977),et=p(5964),Dt=p(96697),be=p(18530),Ee=p(27468),ce=function(n){return n.initialization="initialization",n.start="start",n.installation="installation",n.ok="ok",n}(ce||{}),we=function(n){return n.Success="Success",n.Failure="Failure",n.Pending="Pending",n}(we||{}),ht=function(n){return n.Create="Create",n.Delete="Delete",n}(ht||{});let un=(()=>{class n{destroyRef=(0,s.WQX)(s.abz);voicemailSettingsApi=(0,s.WQX)(Pt.Q);engine$=new be.B;engine;step=(0,s.vPA)(ce.initialization);installationCommand=(0,s.vPA)("");loading=(0,s.vPA)(!1);error=(0,s.vPA)("");initialize(t){this.engine=t,this.engine$.next(t),this.error.set(""),this.loading.set(!1),t===w.u.Engine3CxLocal?(this.step.set(ce.initialization),this.wrapRequest(this.getCurrentSetupStatus$()).subscribe(({step:o,installationCommand:i})=>{"creating"===o&&(o=ce.start,this.waitConverterCreated()),this.step.set(o),this.installationCommand.set(i??"")})):this.step.set(ce.ok)}startConfiguration(){this.step()===ce.start&&this.wrapRequest(this.voicemailSettingsApi.createConverterConfiguration()).subscribe(()=>{this.waitConverterCreated()})}completeConfiguration(){"installation"===this.step()&&this.step.set(ce.ok)}deleteConverter(t){t&&this.wrapRequest(this.voicemailSettingsApi.deleteConverterConfiguration({voicemailSettingsDeleteConverterConfigurationRequestBody:{id:t}}).pipe((0,I.n)(()=>this.waitConverterDeletion$()))).subscribe(()=>{this.initialize(this.engine)})}wrapRequest(t){return this.loading.set(!0),this.error.set(""),t.pipe((0,P.M)(()=>this.loading.set(!1)),(0,A.W)(o=>(this.error.set((0,X.PE)(o)),this.loading.set(!1),E.w)),(0,R.pQ)(this.destroyRef),(0,Gt.Q)(this.engine$))}waitConverterCreated(){this.wrapRequest(this.waitConverterCreation$().pipe((0,I.n)(t=>this.voicemailSettingsApi.getConfiguredConverters({$filter:`Guid eq '${t.McuId}'`})),(0,v.T)(({value:t})=>{if(!t||!t.length)throw new Error("Created converter not found in list of configured converters");const o=t[0].InstallScript;if(!o)throw new Error("Created converter has no installation command");return o}
1))).subscribe(t=>{this.step.set(ce.installation),this.installationCommand.set(t)})}getCurrentSetupStatus$(){return(0,Ee.p)([this.voicemailSettingsApi.getConverterRequestStatus({strict:!1}),this.voicemailSettingsApi.getConfiguredConverters().pipe(x.yh)]).pipe((0,v.T)(([t,o])=>{switch(t?.Operation===ht.Create?t.State:null){case we.Pending:return{step:"creating"};case we.Success:{const i=t.McuId,a=o.find(r=>r.Guid===i)?.InstallScript;if(a)return{step:ce.installation,installationCommand:a};break}}return o.length?{step:ce.ok}:{step:ce.start}}))}waitConverterCreation$(){return(0,Se.O)(0,7e3).pipe((0,Ze.p)(()=>this.voicemailSettingsApi.getConverterRequestStatus({strict:!0})),(0,et.p)(t=>{if(t.Operation!==ht.Create)throw new Error("_i18n.TranscriptionConverterRequestNotFound");switch(t.State){case we.Failure:throw new Error(t.ErrorMessage||"Converter Creation failed");case we.Success:if(!t.McuId)throw new Error("Converter Creation complete, but did not retrieve Id");return!0;default:return!1}}),(0,Dt.s)(1))}waitConverterDeletion$(){return(0,Se.O)(0,7e3).pipe((0,Ze.p)(()=>this.voicemailSettingsApi.getConverterRequestStatus({strict:!0})),(0,et.p)(t=>{if(t.Operation!==ht.Delete)throw new Error("_i18n.TranscriptionConverterRequestNotFound");switch(t.State){case we.Failure:throw new Error(t.ErrorMessage||"Converter Deletion failed");case we.Success:return!0;default:return!1}}),(0,Dt.s)(1))}static \u0275fac=function(o){return new(o||n)};static \u0275prov=s.jDH({token:n,factory:n.\u0275fac})}return n})();var se=p(73042),tt=p(534);const Ca=["gpt-4o","gpt-4o-mini"];function mn(n,c,t){return se.Q.isNullOrEmpty(n)?"":t&&!c.some(o=>o.value===n)?"_i18n.DeprecatedModel":null!=n&&Ca.includes(n)?"_i18n.OpenAIDeprecatingSoon":""}function ba(n,c){if(1&n&&(e.j41(0,"app-external-link",4),e.nI1(1,"translate"),e.EFF(2),e.nI1(3,"translate"),e.k0s()),2&n){const t=c;e.Y8G("href",e.bMT(1,2,t.link)),e.R7$(2),e.SpI(" ",e.bMT(3,4,t.description)," ")}}function _a(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.SpI(" ",e.bMT(1,1,"_i18n.FeatureUnavailableOnCurrentEdition")," ")}function va(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.SpI(" ",e.i5U(1,1,"_i18n.RequiresSimultaneousCallsWarningEnterprise",c.error)," ")}function Sa(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.SpI(" ",e.bMT(1,1,"_i18n.GoogleSpeechRequirements")," ")}function Ta(n,c){if(1&n){const t=e.RV6();e.j41(0,"div",2),e.nrm(1,"div",12),e.nI1(2,"translate"),e.j41(3,"button",13),e.bIt("click",function(){s.eBV(t);const i=e.XpG(2);return s.Njj(i.startConfiguration())}),e.EFF(4),e.nI1(5,"translate"),e.k0s()()}if(2&n){const t=e.XpG(2);e.R7$(),e.Y8G("innerHTML",e.bMT(2,3,"_i18n.Engine3CXLocalSetupStep1"),e.npT),e.R7$(2),e.Y8G("disabled",!t.canStartConfiguration),e.R7$(),e.SpI(" ",e.bMT(5,5,"_i18n.Proceed")," ")}}function ya(n,c){if(1&n&&(e.j41(0,"app-simple-copy",15)(1,"pre",17),e.EFF(2),e.k0s()()),2&n){const t=c;e.Y8G("source",t),e.R7$(2),e.JRh(t)}}function Fa(n,c){if(1&n){const t=e.RV6();
1e.j41(0,"div",2),e.nrm(1,"div",14),e.nI1(2,"translate"),e.nVh(3,ya,3,2,"app-simple-copy",15),e.j41(4,"button",16),e.bIt("click",function(){s.eBV(t);const i=e.XpG(2);return s.Njj(i.transcribeEngineSetup.completeConfiguration())}),e.EFF(5),e.nI1(6,"translate"),e.k0s()()}if(2&n){let t;const o=e.XpG(2);e.R7$(),e.Y8G("innerHTML",e.bMT(2,3,"_i18n.Engine3CXLocalSetupStep2"),e.npT),e.R7$(2),e.vxM((t=o.transcribeEngineSetup.installationCommand())?3:-1,t),e.R7$(2),e.SpI(" ",e.bMT(6,5,"_i18n.OK")," ")}}function Ra(n,c){if(1&n&&e.EFF(0),2&n){const t=e.XpG().label;e.SpI(" ",t," ")}}function Ia(n,c){if(1&n&&e.EFF(0),2&n){const t=e.XpG(5);e.SpI(" ",t.f.TranscribeModelOpenAI.value," ")}}function Aa(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n){e.XpG();const t=e.r8f(2);e.SpI(" (",e.bMT(1,1,t),") ")}}function $a(n,c){if(1&n&&(e.nVh(0,Ra,1,1)(1,Ia,1,1),e.SS7(2),e.nVh(3,Aa,2,3)),2&n){const t=c.label,o=e.XpG(4);e.vxM(t?0:1),e.R7$(2);const i=e.bH3(o.aiModelOptionSuffix(o.f.TranscribeModelOpenAI.value,o.transcribeModelOptions,!0));e.R7$(),e.vxM(i?3:-1)}}function Ma(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n){e.XpG();const t=e.r8f(1);e.SpI(" (",e.bMT(1,1,t),") ")}}function ka(n,c){if(1&n&&(e.EFF(0),e.SS7(1),e.nVh(2,Ma,2,3)),2&n){const t=c.item,o=e.XpG(4);e.SpI(" ",t.label," "),e.R7$();const i=e.bH3(o.aiModelOptionSuffix(t.value,o.transcribeModelOptions,!1));e.R7$(),e.vxM(i?2:-1)}}function xa(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n){const t=e.XpG().label;e.SpI(" ",e.bMT(1,1,t)," ")}}function Ea(n,c){if(1&n&&e.EFF(0),2&n){const t=e.XpG(5);e.SpI(" ",t.f.AnalyzeModelOpenAI.value," ")}}function wa(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n){e.XpG();const t=e.r8f(2);e.SpI(" (",e.bMT(1,1,t),") ")}}function Pa(n,c){if(1&n&&(e.nVh(0,xa,2,3)(1,Ea,1,1),e.SS7(2),e.nVh(3,wa,2,3)),2&n){const t=c.label,o=e.XpG(4);e.vxM(t?0:1),e.R7$(2);const i=e.bH3(o.aiModelOptionSuffix(o.f.AnalyzeModelOpenAI.value,o.analysisModelOptions,!0));e.R7$(),e.vxM(i?3:-1)}}function Ga(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n){e.XpG();const t=e.r8f(2);e.SpI(" (",e.bMT(1,1,t),") ")}}function Da(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate"),e.SS7(2),e.nVh(3,Ga,2,3)),2&n){const t=c.item,o=e.XpG(4);e.SpI(" ",e.bMT(1,2,t.label)," "),e.R7$(2);const i=e.bH3(o.aiModelOptionSuffix(t.value,o.analysisModelOptions,!1));e.R7$(),e.vxM(i?3:-1)}}function Na(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.SpI(" ",e.bMT(1,1,"_i18n.TranscribeInvalidSecretKey")," ")}function ja(n,c){if(1&n&&(e.j41(0,"field-wrapper",20)(1,"ng-select",21),e.DNE(2,$a,4,3,"ng-template",22)(3,ka,3,3,"ng-template",23),e.k0s()(),e.j41(4,"field-wrapper",24)(5,"ng-select",25),e.DNE(6,Pa,4,3,"ng-template",22)(7,Da,4,5,"ng-template",23),e.k0s()(),e.j41(8,"field-input-concealed-password",26)(9,"val-errors",5),e.DNE(10,Na,2,3,"ng-template",27),e.k0s()()),2&n){const t=e.XpG(3);e.R7$(),e.Y8G("formControl",t.f.TranscribeModelOpenAI)("items",t.transcribeModelOptions)("clearable",!1)("searchable",!0),e.R7$(4),e.Y8G("formControl",t.f.AnalyzeModelOpenAI)("items",t.analysisModelOptions)("clearable",!1)("searchable",!0),e.R7$(3),e.Y8G("formControl",t.f.TranscribeSecretKey),e.R7$(),e.Y8G("control",t.f.TranscribeSecretKey)}}function Va(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n){const t=e.XpG().label;e.SpI(" ",e.bMT(1,1,t)," ")}}function Ba(n,c){if(1&n&&e.EFF(0),2&n){const t=e.XpG(5);e.SpI(" ",t.f.AnalyzeModelGrok.value," ")}}function Ha(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n){e.XpG();const t=e.r8f(2);e.SpI(" (",e.bMT(1,1,t),") ")}}function Oa(n,c){if(1&n&&(e.nVh(0,Va,2,3)(1,Ba,1,1),e.SS7(2),e.nVh(3,Ha,2,3)),2&n){const t=c.label,o=e.XpG(4);e.vxM(t?0:1),e.R7$(2);const i=e.bH3(o.aiModelOptionSuffix(o.f.AnalyzeModelGrok.value,o.grokModelOptions,!0));e.R7$(),e.vxM(i?3:-1)}}function Xa(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n){e.XpG();const t=e.r8f(2);e.SpI(" (",e.bMT(1,1,t),") ")}}function Qa(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate"),e.SS7(2),e.nVh(3,Xa,2,3)),2&n){const t=c.item,o=e.XpG(4);e.SpI(" ",e.bMT(1,2,t.label)," "),e.R7$(2);const i=e.bH3(o.aiModelOptionSuffix(t.value,o.grokModelOptions,!1));e.R7$(),e.vxM(i?3:-1)}}function La(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.SpI(" ",e.bMT(1,1,"_i18n.TranscribeInvalidSecretKey")," ")}function Wa(n,c){if(1&n&&(e.j41(0,"field-wrapper",24)(1,"ng-select",25),e.DNE(2,Oa,4,3,"ng-template",22)(3,Qa,4,5,"ng-template",23),e.k0s()(),e.j41(4,"field-input-concealed-password",28)(5,"val-errors",5),e.DNE(6,La,2,3,"ng-template",27),e.k0s()()),2&n){const t=e.XpG(3);e.R7$(),e.Y8G("formControl",t.f.AnalyzeModelGrok)("items",t.grokModelOptions)("clearable",!1)("searchable",!0),e.R7$(3),e.Y8G("formControl",t.f.TranscribeKeyGrok),e.R7$(),e.Y8G("control",t.f.TranscribeKeyGrok)}}function Ya(n,c){if(1&n&&e.nrm(0,"field-select",18),2&n){const t=e.XpG(3);e.Y8G("options",t.transcribeLanguageOptions)("formControl",t.f.TranscribeLanguage)}}function Ja(n,c){if(1&n&&(e.j41(0,"p"),e.nrm(1,"field-checkbox",29),e.nI1(2,"translate"),e.k0s()),2&n){const t=e.XpG(3);e.R7$(),e.Y8G("formControl",t.f.CallRecordingStereo)("tooltip",t.f.CallRecordingStereo.disabled?e.bMT(2,2,"_i18n.AvailableEnt"):"")}}function qa(n,c){if(1&n){const t=e.RV6();e.j41(0,"app-transcribe-engine-3cx-local-status",30),e.bIt("deleteConverter",function(i){s.eBV(t);const a=e.XpG(3);return s.Njj(a.transcribeEngineSetup.deleteConverter(i))}),e.k0s()}}function Ua(n,c){if(1&n&&(e.j41(0,"div",2),e.nVh(1,ja,11,10),e.nVh(2,Wa,7,6),e.nVh(3,Ya,1,2,"field-select",18),e.nV
1h(4,Ja,3,4,"p"),e.k0s(),e.nVh(5,qa,1,0,"app-transcribe-engine-3cx-local-status",19)),2&n){const t=e.XpG(2);e.R7$(),e.vxM(t.isOpenAiEngine?1:-1),e.R7$(),e.vxM(t.isGrokEngine?2:-1),e.R7$(),e.vxM(t.isGrokEngine?-1:3),e.R7$(),e.vxM(t.is3CXEngine||t.is3CXLocalEngine||t.isGrokEngine?4:-1),e.R7$(),e.vxM(t.is3CXLocalEngine?5:-1)}}function za(n,c){1&n&&(e.j41(0,"p",10),e.nrm(1,"app-server-error",31),e.k0s()),2&n&&(e.R7$(),e.Y8G("message",c))}function Ka(n,c){1&n&&(e.j41(0,"div",11)(1,"div",2),e.nrm(2,"div",32),e.k0s()())}function Za(n,c){if(1&n&&(e.j41(0,"fieldset",9),e.nVh(1,Ta,6,7,"div",2)(2,Fa,7,7,"div",2)(3,Ua,6,5),e.k0s(),e.nVh(4,za,2,1,"p",10),e.nVh(5,Ka,3,0,"div",11)),2&n){let t,o;const i=e.XpG();e.Y8G("disabled",i.transcribeEngineSetup.loading()),e.R7$(),e.vxM("start"===(t=i.transcribeEngineSetup.step())?1:"installation"===t?2:"ok"===t?3:-1),e.R7$(3),e.vxM((o=i.transcribeEngineSetup.error())?4:-1,o),e.R7$(),e.vxM(i.transcribeEngineSetup.loading()?5:-1)}}const er=["nl-NL","es-ES","it-IT","de-DE","ru-RU","pt-PT","pl-PL","cs-CZ","en-GB","fr-FR","tr-TR","el-GR","da-DK","cmn-Hans-CN","iw-IL"],fn=[{value:"gpt-4o-transcribe",label:"GPT4o Transcribe"},{value:"gpt-4o-mini-transcribe",label:"GPT4o mini Transcribe"},{value:"whisper-1",label:"Whisper"}],gn=[{value:"grok-4.3",label:"grok-4.3"},{value:"grok-4.20",label:"grok-4.20"}],hn=[{value:"gpt-5.4",label:"gpt-5.4"},{value:"gpt-5.4-mini",label:"gpt-5.4-mini"},{value:"gpt-5.4-nano",label:"gpt-5.4-nano"}];let tr=(()=>{class n{voicemailSettingsApi=(0,s.WQX)(Pt.Q);route=(0,s.WQX)(S.nX);destroy$=(0,s.WQX)(s.abz);transcribeEngineSetup=(0,s.WQX)(un);navTitle=(0,_.hFB)();helpUri=(0,_.hFB)();remoteArchivingFileSystemType=(0,_.hFB)();systemParameters=(0,_.hFB)();productCode=(0,xe.EW)(()=>this.systemParameters()?.License?.ProductCode??"");maxSimCalls=(0,xe.EW)(()=>this.systemParameters()?.License?.MaxSimCalls??0);editPanel=(0,_.ebz)(ne.Q);isPaid=(0,xe.EW)(()=>this.productCode().startsWith("3CXPSPROF"));isEnterprise=(0,xe.EW)(()=>this.productCode().startsWith("3CXPSPROFENT"));isFileSystemGoogleStorage=(0,xe.EW)(()=>this.remoteArchivingFileSystemType()===aa.C.GoogleBucket);transcribeSettings=this.route.snapshot.data.transcribeSettings;transcribeEngineValidator=t=>{const o=this.maxSimCalls(),i=this.isEnterprise();switch(t.value){case w.u.Engine3Cx:if(!i)return{unavailableOnCurrentEdition:!0};break;case w.u.Engine3CxLocal:if(!i||o<16)return{minSimCallsRequiredLocal:{minimumCalls:16}};break;case w.u.Google:return this.isFileSystemGoogleStorage()?null:{googleSpeechRequirements:!0}}return null};form=new l.gE({TranscribeEngine:new l.MJ({value:w.u.None,disabled:!1},{nonNullable:!0,validators:this.transcribeEngineValidator}),TranscribeLanguage:new l.MJ({value:null,disabled:!0}),TranscribeSecretKey:new l.MJ({value:{Value:""},disabled:!0},{nonNullable:!0,validators:l.k0.required}),TranscribeKeyGrok:new l.MJ({value:{Value:""},disabled:!0},{nonNullable:!0,validators:l.k0.required}),TranscribeModelOpenAI:new l.MJ(null,{validators:l.k0.required}),AnalyzeModelOpenAI:new l.MJ(null,{validators:l.k0.required}),AnalyzeModelGrok:new l.MJ(null,{validators:l.k0.required}),CallRecordingStereo:new l.MJ({value:!1,disabled:!0},{nonNullable:!0})});transcribeEngineOptions=[{value:w.u.None,label:"_i18n.Off"},{value:w.u.Grok,label:"Grok"},{value:w.u.Google,label:"_i18n.GoogleSpeech"},{value:w.u.OpenAi,label:"_i18n.OpenAI"},{value:w.u.Engine3Cx,label:"_i18n.Engine3CX"},{value:w.u.Engine3CxLocal,label:"_i18n.Engine3CXLocal"}];transcribeModelOptions=fn;analysisModelOptions=hn;grokModelOptions=gn;transcribeLanguageOptionsAll=this.transcribeSettings.languages.map(t=>({value:t.Code,label:t.Name}));transcribeLanguageOptions3CX=[{value:"",label:"_i18n.AutoDetected"},...this.transcribeLanguageOptionsAll.filter(t=>er.includes(t.value)).map(t=>({...t,label:t.label.replace(/\s+\(.*\)$/,"")}))];get transcribeLanguageOptions(){return this.is3CXEngine||this.is3CXLocalEngine?this.transcribeLanguageOptions3CX:this.transcribeLanguageOptionsAll}get restrictedModification(){return this.isPaid()?Y.v.None:Y.v.Paid}engineGuideLinks={OpenAI:{description:"_i18n.LinkHowToSetupOpenAIWhisper",link:"_i18n.OpenAiWhisperGuideLink"},Google:{description:"_i18n.LinkHowToSetupGoogleSpeech",link:"_i18n.TranscriptionUri"},[w.u.Engine3Cx]:{description:"_i18n.MoreInfo",link:"_i18n.SetupTranscription3CXUri"},[w.u.Engine3CxLocal]:{description:"_i18n.SetupTranscription3CXLocalText",link:"_i18n.SetupTranscription3CXLocalUri"},[w.u.Grok]:{description:"_i18n.LinkHowToSetupGrok",link:"_i18n.SetupTranscriptionGrokUri"}};get f(){return this.form.controls}aiModelOptionSuffix=mn;get isOpenAiEngine(){return this.f.TranscribeEngine.value===w.u.OpenAi}get is3CXEngine(){return this.f.TranscribeEngine.value===w.u.Engine3Cx}get is3CXLocalEngine(){return this.f.TranscribeEngine.value===w.u.Engine3CxLocal}get isGrokEngine(){return this.f.TranscribeEngine.value===w.u.Grok}get isEngineSelected(){return this.f.TranscribeEngine.value!==w.u.None}get engineGuideLink(){return this.engineGuideLinks[this.f.TranscribeEngine.value]??{link:"",description:""}}ngOnInit(){this.form.setValue({TranscribeEngine:this.transcribeSettings.TranscribeEngine??w.u.None,TranscribeLanguage:this.transcribeSettings.TranscribeLanguage??null,TranscribeSecretKey:this.transcribeSettings.TranscribeSecretKey??{Value:""},TranscribeKeyGrok:this.transcribeSettings.TranscribeKeyGrok??{Value:""},TranscribeModelOpenAI:se.Q.isNullOrEmpty(this.transcribeSettings.TranscribeModelOpenAI)?fn[0]?.value??null:this.transcribeSettings.TranscribeModelOpenAI,AnalyzeModelOpenAI:se.Q.isNullOrEmpty(this.transcribeSettings.AnalyzeModelOpenAI)?hn[0]?.value??null:this.transcribeSettings.AnalyzeModelOpenAI,AnalyzeModelGrok:se.Q.isNullOrEmpty(this.transcribeSettings.AnalyzeModelGrok)?gn[0]?.value??null:this.transcribeSettings.AnalyzeModelGrok,CallRecordingStereo:this.transcribeSettings.CallRecordingStereo??!1},{emitEvent:!1}),this.isPaid()?((0,T.XP)(this.f.TranscribeEngine).pipe((0,R.pQ)(this.destroy$)).subscribe(()=>{(0,T.sS)([this.f.TranscribeSecretKey,this.f.TranscribeModelOpenAI,this.f.AnalyzeModelOpenAI],this.isOpenAiEngine),(0,T.sS)([this.f.TranscribeKeyGrok,this.f.AnalyzeModelGrok],this.isGrokEngine),(0,T.TZ)(this.f.TranscribeLanguage,this.isEngineSelected),(0,T.TZ)(this.f.CallRecordingStereo,this.isEnterprise()),this.transcribeEngineSetup.initialize(this.f.TranscribeEngine.valid?this.f.TranscribeEngine.value:w.u.None),this.updateCallStereoState()}),this.f.TranscribeEngine.valueChanges.pipe((0,R.pQ)(this.destroy$)).subscribe(()=>{const t=this.f.TranscribeLanguage.value;this.isEngineSelected?this.transcribeLanguageOptions.some(({value:o})=>o===t)||this.f.TranscribeLanguage.setValue(this.is3CXEngine?"":"en-GB"):t&&this.f.TranscribeLanguage.setValue(null)})):this.form.disable()}save$=()=>{const{TranscribeLanguage:t="",TranscribeSecretKey:o={Value:""},TranscribeKeyGrok:i={Value:""},CallRecordingStereo:a=!1,...r}=this.form.value,d={TranscribeLanguage:t,TranscribeSecretKey:o,TranscribeKeyGrok:i,CallRecordingStereo:a,...r};return this.form.value.TranscribeSecretKey||this.f.TranscribeSecretKey.setValue({Value:""}),this.form.value.TranscribeKeyGrok||this.f.TranscribeKeyGrok.setValue({Value:""}),this.voicemailSettingsApi.updateVoicemailSettings({pbxVoicemailSettings:d}).pipe((0,P.M)({next:()=>{Object.assign(this.transcribeSettings,d),this.startConfigurationAfterSave&&this.startConfiguration()},error:()=>{this.startConfigurationAfterSave=!1}}))};onValidation(){this.startConfigurationAfterSave=!1}get canStartConfiguration(){return this.transcribeSettings.TranscribeEngine===w.u.Engine3CxLocal||this.restrictedModification===Y.v.None}startConfiguration(){this.transcribeSettings.TranscribeEngine===w.u.Engine3CxLocal?(this.startConfigurationAfterSave=!1,this.transcribeEngineSetup.startConfiguration()):(this.startConfigurationAfterSave=!0,this.editPanel()?.submitForm(
1))}startConfigurationAfterSave=!1;updateCallStereoState(){const t=this.isEnterprise()&&(this.is3CXEngine||this.is3CXLocalEngine||this.isGrokEngine);(0,T.TZ)(this.f.CallRecordingStereo,t),this.transcribeSettings.TranscribeEngine===w.u.Engine3Cx||this.transcribeSettings.TranscribeEngine===w.u.Engine3CxLocal||this.transcribeSettings.TranscribeEngine===w.u.Grok||this.f.CallRecordingStereo.touched||this.f.CallRecordingStereo.value||!(this.is3CXEngine||this.is3CXLocalEngine||this.isGrokEngine)?!t&&this.f.CallRecordingStereo.value?(this.f.CallRecordingStereo.setValue(!1),this.f.CallRecordingStereo.markAsDirty()):t&&this.transcribeSettings.CallRecordingStereo&&!this.f.CallRecordingStereo.value&&(this.f.CallRecordingStereo.setValue(!0),this.f.CallRecordingStereo.markAsDirty()):this.f.CallRecordingStereo.setValue(!0)}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-transcribe-settings-page"]],viewQuery:function(o,i){1&o&&e.wEZ(i.editPanel,ne.Q,5),2&o&&e.NyB()},inputs:{navTitle:[1,"navTitle"],helpUri:[1,"helpUri"],remoteArchivingFileSystemType:[1,"remoteArchivingFileSystemType"],systemParameters:[1,"systemParameters"]},features:[e.Jv_([un])],decls:11,vars:13,consts:[["saveDisabledByReasonView","header",3,"showValidation","header","helpUrl","formGroup","save$","saveDisabledByReason"],[1,"row"],[1,"col-lg-6"],["data-qa","transcription-engine","label","_i18n.TranscriptionEngine","description","true",3,"options","formControl"],["description","",3,"href"],[3,"control"],["valError","unavailableOnCurrentEdition"],["valError","minSimCallsRequiredLocal"],["valError","googleSpeechRequirements"],[1,"row",3,"disabled"],["data-qa","error",1,"text-error"],[1,"row","my-3"],["data-qa","setup-step-1",1,"setup-step",3,"innerHTML"],["type","button","data-qa","start-configuration",1,"btn","btn-primary","mb-3",3,"click","disabled"],["data-qa","setup-step-2",1,"setup-step",3,"innerHTML"],["data-qa","installation-command",1,"mb-3",3,"source"],["type","button","data-qa","complete-configuration",1,"btn","btn-primary","mb-3",3,"click"],[1,"text-truncate","m-0","bg-console"],["label","_i18n.SpeechLanguage","data-qa","speech-language","description","_i18n.SpeechLanguageDescription",3,"options","formControl"],["data-qa","3cx-local-converter-status"],["label","_i18n.TranscriptionModel","description","_i18n.TranscriptionModelDescription","data-qa","transcription-model"],["data-qa","select","bindValue","value",1,"flex-grow-1",3,"formControl","items","clearable","searchable"],["ng-label-tmp",""],["ng-option-tmp",""],["label","_i18n.AnalysisModel","description","_i18n.AnalysisModelDescription"],["data-qa","analysis-model","bindValue","value",1,"flex-grow-1",3,"formControl","items","clearable","searchable"],["data-qa","transcribe-secret-key","label","_i18n.APIToken","description","_i18n.SecretKeyDescription",3,"formControl"],["valError","invalid"],["data-qa","grok-secret-key","label","_i18n.APIToken","description","_i18n.SecretKeyDescription",3,"formControl"],["data-qa","call-recording-stereo","label","_i18n.CallRecordingStereo","hint","_i18n.CallRecordingStereoHint",3,"formControl","tooltip"],["data-qa","3cx-local-converter-status",3,"deleteConverter"],[3,"message"],["data-qa","loader",1,"loader"]],template:function(o,i){if(1&o&&(e.j41(0,"edit-panel",0),e.nI1(1,"LicenseRestricted"),e.bIt("showValidation",function(){return i.onValidation()}),e.j41(2,"div",1)(3,"div",2)(4,"field-select",3),e.nVh(5,ba,4,6,"app-external-link",4),e.j41(6,"val-errors",5),e.DNE(7,_a,2,3,"ng-template",6)(8,va,2,4,"ng-template",7)(9,Sa,2,3,"ng-template",8),e.k0s()()()(),e.nVh(10,Za,6,4),e.k0s()),2&o){let a;e.Y8G("header",i.navTitle())("helpUrl",i.helpUri())("formGroup",i.form)("save$",i.save$)("saveDisabledByReason",e.i5U(1,10,"",i.restrictedModification)),e.R7$(4),e.Y8G("options",i.transcribeEngineOptions)("formControl",i.f.TranscribeEngine),e.R7$(),e.vxM((a=i.engineGuideLink)?5:-1,a),e.R7$(),e.Y8G("control",i.f.TranscribeEngine),e.R7$(4),e.vxM(i.isEngineSelected?10:-1)}}
1,dependencies:[ne.Q,l.X1,l.BC,l.cb,l.l_,l.j4,Te.q,Z.z,Q.vr,Q.ZZ,Q.Uq,ke.P,$.IH,Ue.p,$.VI,ra.kq,xt.T,ha,ie.t,pt.J,tt.dg,y.D9,Y.R],styles:[".setup-step[_ngcontent-%COMP%]{margin-bottom:16px}.setup-step[_ngcontent-%COMP%]     h5{padding-bottom:4px;border-bottom:1px solid var(--border-color);font-size:var(--font-size);margin:4px 0 16px}.setup-step[_ngcontent-%COMP%]     ul{margin:0 0 16px 16px}[_nghost-%COMP%]   p[_ngcontent-%COMP%]   [app-info-circle-regular-icon][_ngcontent-%COMP%]{margin-top:-2px}"],changeDetection:0})}return n})();var nr=p(52376),or=p(93785),Cn=p(53083);let nt=(()=>{class n extends ye.d{createCallFlowApp(t,o="body"){const i=t?.pbxCallFlowApp;if(null==i)throw new Error("Required parameter pbxCallFlowApp was null or undefined when calling createCallFlowApp.");let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("post",`${C}/CallFlowApps`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}createCallFlowAppQuery(t,o="body",i=!1,a){if(null==t.pbxCallFlowApp)throw new Error("Required parameter pbxCallFlowApp was null or undefined when calling createCallFlowApp.");return"/CallFlowApps"}deleteCallFlowApp(t,o="body"){const i=t?.id;if(null==i)throw new Error("Required parameter id was null or undefined when calling deleteCallFlowApp.");const a=t?.ifMatch;let r=this.defaultHeaders;null!=a&&(r=r.set("If-Match",String(a))),r=this.configuration.addCredentialToHeaders("Application","Authorization",r,"Bearer ");const d=this.configuration.selectHeaderAccept(["application/json"]);void 0!==d&&(r=r.set("Accept",d));let u="json";d&&(u=d.startsWith("text")?"text":this.configuration.isJsonMime(d)?"json":"blob");let m=`/CallFlowApps(${this.configuration.encodeParam({name:"id",value:i,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})`;const{basePath:g,withCredentials:C}=this.configuration;return this.httpClient.request("delete",`${g}${m}`,{responseType:u,...C?{withCredentials:C}:{},headers:r,observe:o})}deleteCallFlowAppQuery(t,o="body",i=!1,a){const r=t.id;if(null==r)throw new Error("Required parameter id was null or undefined when calling deleteCallFlowApp.");return`/CallFlowApps(${this.configuration.encodeParam({name:"id",value:r,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})`}deleteFile(t,o="body"){const i=t?.id;if(null==i)throw new Error("Required parameter id was null or undefined when calling deleteFile.");const a=t?.callFlowAppsCallFlowAppDeleteFileRequestBody;if(null==a)throw new Error("Required parameter callFlowAppsCallFlowAppDeleteFileRequestBody was null or undefined when calling deleteFile.");let r=this.defaultHeaders;r=this.configuration.addCredentialToHeaders("Application","Authorization",r,"Bearer ");const d=this.configuration.selectHeaderAccept(["application/json"]);void 0!==d&&(r=r.set("Accept",d));const m=this.configuration.selectHeaderContentType(["application/json"]);void 0!==m&&(r=r.set("Content-Type",m));let g="json";d&&(g=d.startsWith("text")?"text":this.configuration.isJsonMime(d)?"json":"blob");let C=`/CallFlowApps(${this.configuration.encodeParam({name:"id",value:i,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})/Pbx.DeleteFile`;const{basePath:f,withCredentials:F}=this.configuration;return this.httpClient.request("post",`${f}${C}`,{body:a,responseType:g,...F?{withCredentials:F}:{},headers:r,observe:o})}deleteFileQuery(t,o="body",i=!1,a){const r=t.id;if(null==r)throw new Error("Required parameter id was null or undefined when calling deleteFile.");if(null==t.callFlowAppsCallFlowAppDeleteFileRequestBody)throw new Error("Required parameter callFlowAppsCallFlowAppDeleteFileRequestBody was null or undefined when calling deleteFile.");return`/CallFlowApps(${this.configuration.encodeParam({name:"id",value:r,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})/Pbx.DeleteFile`}getCallFlowApp(t,o="body"){const i=t?.id;if(null==i)throw new Error("Required parameter id was null or undefined when calling getCallFlowApp.");const a=t?.$select,r=t?.$expand;let d=new h.rx(this.encoder);d=this.addToHttpParams(d,"$select",a,h.l2.Form,!1),d=this.addToHttpParams(d,"$expand",r,h.l2.Form,!1);let u=this.defaultHeaders;u=this.configuration.addCredentialToHeaders("Application","Authorization",u,"Bearer ");const m=this.configuration.selectHeaderAccept(["application/json"]);void 0!==m&&(u=u.set("Accept",m));let g="json";m&&(g=m.startsWith("text")?"text":this.configuration.isJsonMime(m)?"json":"blob");let C=`/CallFlowApps(${this.configuration.encodeParam({name:"id",value:i,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})`;const{basePath:f,withCredentials:F}=this.configuration;return this.httpClient.request("get",`${f}${C}`,{params:d.toHttpParams(),responseType:g,...F?{withCredentials:F}:{},headers:u,observe:o})}getCallFlowAppQuery(t,o="body",i=!1,a){const r=t.id;if(null==r)throw new Error("Required parameter id was null or undefined when calling getCallFlowApp.");const d=t.$select,u=t.$expand;let m=new h.rx(this.encoder);return m=this.addToHttpParams(m,"$select",d,h.l2.Form,!1),m=this.addToHttpParams(m,"$expand",u,h.l2.Form,!1),`/CallFlowApps(${this.configuration.encodeParam({name:"id",value:r,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})?`+m.toString()}getFiles(t,o="body"){const i=t?.id;if(null==i)throw new Error("Required parameter id was null or undefined when calling getFiles.");const a=t?.$top,r=t?.$skip,d=t?.$search,u=t?.$filter,m=t?.$count;let g=new h.rx(this.encoder);
1g=this.addToHttpParams(g,"$top",a,h.l2.Form,!1),g=this.addToHttpParams(g,"$skip",r,h.l2.Form,!1),g=this.addToHttpParams(g,"$search",d,h.l2.Form,!1),g=this.addToHttpParams(g,"$filter",u,h.l2.Form,!1),g=this.addToHttpParams(g,"$count",m,h.l2.Form,!1);let C=this.defaultHeaders;C=this.configuration.addCredentialToHeaders("Application","Authorization",C,"Bearer ");const f=this.configuration.selectHeaderAccept(["application/json"]);void 0!==f&&(C=C.set("Accept",f));let F="json";f&&(F=f.startsWith("text")?"text":this.configuration.isJsonMime(f)?"json":"blob");let b=`/CallFlowApps(${this.configuration.encodeParam({name:"id",value:i,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})/Pbx.GetFiles()`;const{basePath:H,withCredentials:pe}=this.configuration;return this.httpClient.request("get",`${H}${b}`,{params:g.toHttpParams(),responseType:F,...pe?{withCredentials:pe}:{},headers:C,observe:o})}getFilesQuery(t,o="body",i=!1,a){const r=t.id;if(null==r)throw new Error("Required parameter id was null or undefined when calling getFiles.");const d=t.$top,u=t.$skip,m=t.$search,g=t.$filter,C=t.$count;let f=new h.rx(this.encoder);return f=this.addToHttpParams(f,"$top",d,h.l2.Form,!1),f=this.addToHttpParams(f,"$skip",u,h.l2.Form,!1),f=this.addToHttpParams(f,"$search",m,h.l2.Form,!1),f=this.addToHttpParams(f,"$filter",g,h.l2.Form,!1),f=this.addToHttpParams(f,"$count",C,h.l2.Form,!1),`/CallFlowApps(${this.configuration.encodeParam({name:"id",value:r,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})/Pbx.GetFiles()?`+f.toString()}listCallFlowApp(t,o="body"){const i=t?.$top,a=t?.$skip,r=t?.$search,d=t?.$filter,u=t?.$count,m=t?.$orderby,g=t?.$select,C=t?.$expand;let f=new h.rx(this.encoder);f=this.addToHttpParams(f,"$top",i,h.l2.Form,!1),f=this.addToHttpParams(f,"$skip",a,h.l2.Form,!1),f=this.addToHttpParams(f,"$search",r,h.l2.Form,!1),f=this.addToHttpParams(f,"$filter",d,h.l2.Form,!1),f=this.addToHttpParams(f,"$count",u,h.l2.Form,!1),f=this.addToHttpParams(f,"$orderby",m,h.l2.Form,!1),f=this.addToHttpParams(f,"$select",g,h.l2.Form,!1),f=this.addToHttpParams(f,"$expand",C,h.l2.Form,!1);let F=this.defaultHeaders;F=this.configuration.addCredentialToHeaders("Application","Authorization",F,"Bearer ");const b=this.configuration.selectHeaderAccept(["application/json"]);void 0!==b&&(F=F.set("Accept",b));let H="json";b&&(H=b.startsWith("text")?"text":this.configuration.isJsonMime(b)?"json":"blob");const{basePath:lt,withCredentials:Ie}=this.configuration;return this.httpClient.request("get",`${lt}/CallFlowApps`,{params:f.toHttpParams(),responseType:H,...Ie?{withCredentials:Ie}:{},headers:F,observe:o})}listCallFlowAppQuery(t,o="body",i=!1,a){const r=t.$top,d=t.$skip,u=t.$search,m=t.$filter,g=t.$count,C=t.$orderby,f=t.$select,F=t.$expand;let b=new h.rx(this.encoder);
1return b=this.addToHttpParams(b,"$top",r,h.l2.Form,!1),b=this.addToHttpParams(b,"$skip",d,h.l2.Form,!1),b=this.addToHttpParams(b,"$search",u,h.l2.Form,!1),b=this.addToHttpParams(b,"$filter",m,h.l2.Form,!1),b=this.addToHttpParams(b,"$count",g,h.l2.Form,!1),b=this.addToHttpParams(b,"$orderby",C,h.l2.Form,!1),b=this.addToHttpParams(b,"$select",f,h.l2.Form,!1),b=this.addToHttpParams(b,"$expand",F,h.l2.Form,!1),"/CallFlowApps?"+b.toString()}updateCallFlowApp(t,o="body"){const i=t?.id;if(null==i)throw new Error("Required parameter id was null or undefined when calling updateCallFlowApp.");const a=t?.pbxCallFlowApp;let r=this.defaultHeaders;r=this.configuration.addCredentialToHeaders("Application","Authorization",r,"Bearer ");const d=this.configuration.selectHeaderAccept(["application/json"]);void 0!==d&&(r=r.set("Accept",d));const m=this.configuration.selectHeaderContentType(["application/json"]);void 0!==m&&(r=r.set("Content-Type",m));let g="json";d&&(g=d.startsWith("text")?"text":this.configuration.isJsonMime(d)?"json":"blob");let C=`/CallFlowApps(${this.configuration.encodeParam({name:"id",value:i,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})`;const{basePath:f,withCredentials:F}=this.configuration;return this.httpClient.request("patch",`${f}${C}`,{body:a,responseType:g,...F?{withCredentials:F}:{},headers:r,observe:o})}updateCallFlowAppQuery(t,o="body",i=!1,a){const r=t.id;if(null==r)throw new Error("Required parameter id was null or undefined when calling updateCallFlowApp.");return`/CallFlowApps(${this.configuration.encodeParam({name:"id",value:r,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})`}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275prov=s.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),bn=(()=>{class n extends ye.d{listCallFlowScript(t,o="body"){const i=t?.$top,a=t?.$skip,r=t?.$search,d=t?.$filter,u=t?.$count,m=t?.$orderby,g=t?.$select,C=t?.$expand;let f=new h.rx(this.encoder);f=this.addToHttpParams(f,"$top",i,h.l2.Form,!1),f=this.addToHttpParams(f,"$skip",a,h.l2.Form,!1),f=this.addToHttpParams(f,"$search",r,h.l2.Form,!1),f=this.addToHttpParams(f,"$filter",d,h.l2.Form,!1),f=this.addToHttpParams(f,"$count",u,h.l2.Form,!1),f=this.addToHttpParams(f,"$orderby",m,h.l2.Form,!1),f=this.addToHttpParams(f,"$select",g,h.l2.Form,!1),f=this.addToHttpParams(f,"$expand",C,h.l2.Form,!1);let F=this.defaultHeaders;F=this.configuration.addCredentialToHeaders("Application","Authorization",F,"Bearer ");const b=this.configuration.selectHeaderAccept(["application/json"]);void 0!==b&&(F=F.set("Accept",b));let H="json";b&&(H=b.startsWith("text")?"text":this.configuration.isJsonMime(b)?"json":"blob");const{basePath:lt,withCredentials:Ie}=this.configuration;return this.httpClient.request("get",`${lt}/CallFlowScripts`,{params:f.toHttpParams(),responseType:H,...Ie?{withCredentials:Ie}:{},headers:F,observe:o})}listCallFlowScriptQuery(t,o="body",i=!1,a){const r=t.$top,d=t.$skip,u=t.$search,m=t.$filter,g=t.$count,C=t.$orderby,f=t.$select,F=t.$expand;let b=new h.rx(this.encoder);
1return b=this.addToHttpParams(b,"$top",r,h.l2.Form,!1),b=this.addToHttpParams(b,"$skip",d,h.l2.Form,!1),b=this.addToHttpParams(b,"$search",u,h.l2.Form,!1),b=this.addToHttpParams(b,"$filter",m,h.l2.Form,!1),b=this.addToHttpParams(b,"$count",g,h.l2.Form,!1),b=this.addToHttpParams(b,"$orderby",C,h.l2.Form,!1),b=this.addToHttpParams(b,"$select",f,h.l2.Form,!1),b=this.addToHttpParams(b,"$expand",F,h.l2.Form,!1),"/CallFlowScripts?"+b.toString()}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275prov=s.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Nt=p(4801),Ct=p(85343),_n=p(28793),bt=p(62049),jt=p(54381);const le={DialCode:"DialCode",Forward:"Forward",Trunk:"Trunk"};var vn=p(20140),Oe=p(63144),_t=p(38357),it=p(97273),Vt=p(81753),z=p(83185);const Sn={Trunk:"_i18n.CallFlowAppRunScriptOnCallFromTrunk",DialCode:"_i18n.CallFlowAppRunScriptOnDialCode",Forward:"_i18n.CallFlowAppRunScriptOnForward"};function Tn(n,c=!0){const t=n.match(/\((\d+),(\d+)\)/),o=t?Number(t[1]):void 0,i=t?Number(t[2]):void 0;if("number"==typeof o&&"number"==typeof i&&!isNaN(o)&&!isNaN(i))return{row:o>0?o-1:o,column:i,text:n,type:c?"error":"warning"}}function Bt(n){return n?.[0]?.GroupId??null}function Ht(n,c){const t=Bt(n)??-1;return c.find(o=>o.Id===t)??null}function yn(n){return(n.RejectedCode||n.ScriptCode||"").trimEnd()}function Ot(n){const c=n.RoutingType??le.DialCode;return c===le.DialCode&&n.Dids?.length?le.Forward:c}function vt(n){return n.Name||n.Number||""}function Fn(n,c){return{Name:vt(n),RoutingType:Ot(n),Number:n.Number??"",Trunk:n.Trunk??null,Dids:n.Dids??[],Group:Ht(n.Groups??n.Trunk?.Groups,c),ScriptCode:yn(n)}}function cr(n){const{RoutingType:c,Number:t,Trunk:o,Dids:i,Group:a,ScriptCode:r,Name:d}=n;return{RoutingType:c,Name:d,Trunk:o??null,Dids:i??[],Number:t??"",ScriptCode:r,Groups:a?[{GroupId:a.Id}]:[]}}function Rn(n){return{ScriptCode:n.ScriptCode,RejectedCode:n.RejectedCode,IsRegistered:n.IsRegistered,CompilationResult:n.CompilationResult,CompilationSucceeded:n.CompilationSucceeded,InvalidScript:n.InvalidScript}}var Pe=p(87019);function pr(n,c){return n.map(t=>({...t,Dids:(0,Oe.O)(c.find(o=>o.Id===t.Id))}))}let ur=(()=>{class n{callFlowAppsApi=(0,s.WQX)(nt);defsService=(0,s.WQX)(jt.G);makeResolver(){return{resolveData:(t=1,o=Pe.z9,i="")=>this.callFlowAppsApi.listCallFlowApp({$expand:[`Groups($select=GroupId,Name;${it.n0}),Trunk($select=Gateway)`],$count:!0,$orderby:["Number"],$search:(0,_t.Bj)(i),$skip:(t-1)*o,$top:o}).pipe((0,I.n)(a=>{const r=a.value?.map(u=>u.Id)??[],d=0===r.length?(0,M.of)([]):this.defsService.getRoutes({defsGetRoutesRequestBody:{ids:r}}).pipe((0,v.T)(u=>u.value));return(0,M.of)(a).pipe((0,vn.v)(d))}),(0,v.T)(([a,r])=>({value:pr(a.value??[],r),totalItems:a["@odata.count"]})))}}getRoutingType(t){return Sn[Ot(t)]}getRoutingInfo(t){switch(Ot(t)){case le.DialCode:return t.Number;case le.Trunk:return t.Trunk?.Gateway?.Name;case le.Forward:return t.Dids?.map(o=>(0,Vt.fE)(o.Number,o.DisplayName)).join(", ");default:return""}}getDepartment(t){return t?.map(o=>o?.Name).filter(z.U)??[]}getDisplayName(t){return t.Name?`${t.Number} ${t.Name}`:t.Number}identify(t,o){return o.Id}static \u0275fac=function(o){return new(o||n)};static \u0275prov=s.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var St=p(98352),mr=p(13798),In=p(317),ot=p(87960),fr=p(31899),_e=p(11242),Xe=p(38969);const gr=[[["val-errors"]]],hr=["val-errors"];function Cr(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.TrunkIsBoundToAnotherCFA"))}function br(n,c){if(1&n&&(e.j41(0,"app-trunk-select",7)(1,"val-errors",4),e.DNE(2,Cr,2,3,"ng-template",11),e.k0s()()),2&n){const t=e.XpG(2);e.Y8G("isClearable",!1)("isNew",!t.editMode)("formControl",t.f.Trunk),e.R7$(),e.Y8G("control",t.f.Trunk)}}function _r(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.CallFlowAppDialAllowedInputs"))}function vr(n,c){if(1&n&&(e.j41(0,"field-input",8)(1,"val-errors",4),e.DNE(2,_r,2,3,"ng-template",12),e.k0s()()),2&n){const t=e.XpG(2);e.Y8G("formControl",t.f.Number)("maxlength",15),e.R7$(),e.Y8G("control",t.f.Number)}}function Sr(n,c){if(1&n&&(e.j41(0,"app-did-number-select",9),e.nrm(1,"val-errors",4),e.k0s()),2&n){const t=e.XpG(2);e.Y8G("formControl",t.f.Dids)("dn",t.f.Number.value??null)("showAsterisk",!0)("clearable",!1),e.R7$(),e.Y8G("control",t.f.Dids)}}function Tr(n,c){if(1&n&&(e.j41(0,"field-input",5),e.nrm(1,"val-errors",4),e.k0s(),e.nrm(2,"field-select",6),e.nVh(3,br,3,4,"app-trunk-select",7),e.nVh(4,vr,3,3,"field-input",8),e.nVh(5,Sr,2,5,"app-did-number-select",9),e.j41(6,"app-group-select",10),e.nrm(7,"val-errors",4),e.k0s()),2&n){const t=e.XpG();e.Y8G("formControl",t.f.Name)("maxlength",t.isRouting("DialCode")?50:15),e.R7$(),e.Y8G("control",t.f.Name),e.R7$(),e.Y8G("formControl",t.f.RoutingType)("options",t.routingTypeOptions),e.R7$(),e.vxM(t.isRouting("Trunk")?3:-1),e.R7$(),e.vxM(t.isRouting("DialCode")?4:-1),e.R7$(),e.vxM(t.isRouting("Forward")?5:-1),e.R7$(),e.Y8G("formControl",t.f.Group)("readonly",t.isRouting("Trunk"))("groups",t.availableGroups)("systemAccess",t.systemAccess),e.R7$(),e.Y8G("control",t.f.Group)}}function yr(n,c){1&n&&e.eu8(0)}function Fr(n,c){if(1&n&&(e.j41(0,"div"),e.DNE(1,yr,1,0,"ng-container",13),e.k0s()),2&n){e.XpG();const t=e.sdS(1);e.R7$(),e.Y8G("ngTemplateOutlet",t)}}function Rr(n,c){1&n&&e.eu8(0)}function Ir(n,c){if(1&n){const t=e.RV6();e.j41(0,"button",27),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG(3);return s.Njj(a.removeFile(i))}),e.j41(1,"span",28),e.EFF(2),e.k0s(),e.nrm(3,"span",29),e.k0s()}if(2&n){const t=c.$implicit,o=e.XpG(3);e.Y8G("disabled",o.disabled||!o.isPaid),e.R7$(2),e.JRh(t)}}function Ar(n,c){if(1&n){const t=e.RV6();e.j41(0,"a",30),e.bIt("click",function(){s.eBV(t);const i=e.XpG(3);return s.Njj(i.toggleFilesDisplay())}),e.EFF(1),e.nI1(2,"translate"),e.k0s()}if(2&n){const t=e.XpG(3);e.R7$(),e.SpI(" ",e.bMT(2,1,t.allFilesVisible?"_i18n.ShowLessFiles":"_i18n.ShowAllFiles")," ")}}function $r(n,c){if(1&n&&(e.j41(0,"div",19),e.Z7z(1,Ir,4,2,"button",25,e.fX1),e.nVh(3,Ar,3,3,"a",26),e.k0s()),2&n){const t=e.XpG(2);e.R7$(),e.Dyx(t.displayedFiles),e.R7$(2),e.vxM(t.files.length>t.filesListSplit?3:-1)}}function Mr(n,c){1&n&&e.nrm(0,"span",32)}function kr(n,c){if(1&n&&(e.j41(0,"alert",23)(1,"div",31),e.nVh(2,Mr,1,0,"span",32),e.j41(3,"span"),e.EFF(4),e.nI1(5,"translate"),e.k0s()()()),2&n){const t=c;e.Y8G("type",t.type),e.R7$(2),e.vxM(t.updating?2:-1),e.R7$(2),e.JRh(e.bMT(5,3,t.message))}}function xr(n,c){1&n&&(e.j41(0,"fieldset")(1,"legend"),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.nrm(4,"pre",33),e.k0s()),2&n&&(e.R7$(2),e.JRh(e.bMT(3,2,"_i18n.CallFlowAppConsoleOutput")),e.R7$(2),e.Y8G("innerHTML",c,e.npT))}function Er(n,c){if(1&n){const t=e.RV6();e.j41(0,"accordion",2)(1,"accordion-group",14)(2,"div",15)(3,"button",16)(4,"span"),e.nI1(5,"async"),e.EFF(6),e.nI1(7,"translate"),e.k0s()()(),e.DNE(8,Rr,1,0,"ng-container",13),e.k0s(),e.j41(9,"accordion-group",14)(10,"div",15)(11,"button",16)(12,"span"),e.EFF(13),e.nI1(14,"translate"),e.k0s()()(),e.j41(15,"app-button-add",17),e.bIt("click",function(){s.eBV(t);const i=e.sdS(17);return s.Njj(i.click())}),e.k0s(),e.j41(16,"input",18,1),e.bIt("change",function(){s.eBV(t);const i=e.sdS(17),a=e.XpG();return s.Njj(a.addFile(i))}),e.k0s(),e.nVh(18,$r,4,1,"div",19),e.k0s(),e.j41(19,"div",20)(20,"span",21),e.EFF(21),e.nI1(22,"translate"),e.k0s()(),e.j41(23,"fieldset",22),e.nVh(24,kr,6,5,"alert",23),e.nrm(25,"app-ace",24),e.k0s(),e.nVh(26,xr,5,4,"fieldset"),e.k0s()}if(2&n){let t,o;const i=e.XpG(),a=e.sdS(1);e.Y8G("isAnimated",!0),e.R7$(),e.Y8G("isOpen",!1),e.R7$(3),e.AVh("red-circle-mark",e.bMT(5,17,i.generalInvalid)),e.R7$(2),e.JRh(e.bMT(7,19,"_i18n.General")),e.R7$(2),e.Y8G("ngTemplateOutlet",a),e.R7$(),e.Y8G("isOpen",!0),e.R7$(4),e.JRh(e.bMT(14,21,"_i18n.CallFlowAppFiles")),e.R7$(2),e.Y8G("disabled",i.disabled||!i.isPaid),e.R7$(3),e.vxM(i.files.length>0?18:-1),e.R7$(3),e.JRh(e.bMT(22,23,"_i18n.CallFLowAppTemplateHeader")),e.R7$(2),e.Y8G("disabled",i.disabled),e.R7$(),e.vxM((t=i.callFlowStatus)?24:-1,t),e.R7$(),e.Y8G("formControl",i.f.ScriptCode)("mode","csharp")("readOnly",!i.isPaid),e.R7$(),e.vxM((o=i.compilationErrorsHtml)?26:-1,o)}}function wr(n,c){1&n&&e.SdG(0)}let Tt=(()=>{class n extends St.z{callFlowStoreApi=(0,s.WQX)(bn);destroy$=(0,s.WQX)(s.abz);modalService=(0,s.WQX)(B.B);editMode;isPaid;availableGroups;systemAccess;compilationState;files=[];fileAdded=(0,_.CGW)();fileRemoved=(0,_.CGW)();appAce;form=function sr(n={},c=[]){const t=Fn(n,c),o=!1,i=new l.MJ({value:t.RoutingType??null,disabled:o},l.k0.required);return new l.gE({RoutingType:i,Name:new l.MJ(t.Name??"",{nonNullable:!0,validators:[l.k0.required,l.k0.maxLength(50),V.Ep]}),Number:new l.MJ(t.Number??"",{nonNullable:!0,validators:[l.k0.required,l.k0.maxLength(15),V.n0]}),Trunk:new l.MJ({value:t.Trunk??null,disabled:o},l.k0.required),Dids:new l.MJ(t.Dids??[],{validators:l.k0.required,nonNullable:!0}),Group:new l.MJ(t.Group??null),ScriptCode:new l.MJ({value:t.ScriptCode??"",disabled:o},{nonNullable:!0})})}();allFilesVisible=!1;filesListSplit=10;
1routingTypeOptions=[le.Trunk,le.DialCode,le.Forward].map(t=>({value:t,label:Sn[t]}));lastCompilation;ngOnInit(){this.f.RoutingType.valueChanges.pipe((0,R.pQ)(this.destroy$)).subscribe(()=>{this.updateEnabledState()}),this.f.Trunk.valueChanges.pipe((0,et.p)(()=>this.f.Trunk.enabled),(0,R.pQ)(this.destroy$)).subscribe(t=>{this.f.Group.setValue(Ht(t?.Groups,this.availableGroups))}),this.form.valueChanges.pipe((0,mr.Z)(0),(0,R.pQ)(this.destroy$)).subscribe(t=>this.valueChanged(t)),this.syncControlState(this.form)}parse(t){return Fn(t,this.availableGroups)}format(t){return{...this.getCompilation(t),...cr(t)}}ngAfterViewInit(){this.setScriptCodeErrorAnnotations()}writeValue(t){super.writeValue(t??{}),this.form.setValue(this.value,{emitEvent:!1}),this.updateEnabledState(),this.lastCompilation=Rn(t??{}),this.setScriptCodeErrorAnnotations()}setDisabledState(t){super.setDisabledState(t),(0,T.TZ)(this.form,!t),this.updateEnabledState()}updateEnabledState(){!function lr(n,c,t){if(n.disabled)return;const{Name:o,RoutingType:i,Dids:a,Number:r,Trunk:d}=n.controls;(0,T.TZ)(o,!c),(0,T.TZ)(r,!c&&i.value===le.DialCode),(0,T.TZ)(d,i.value===le.Trunk),(0,T.TZ)(a,t&&i.value===le.Forward)}(this.form,this.editMode,this.isPaid)}validate=this.createComponentValidator(this.form);isRouting(t){return this.f.RoutingType.value===t}get f(){return this.form.controls}get compilationErrorsHtml(){return function rr(n){if(n.CompilationSucceeded)return"";const c=(n.CompilationResult||"").split("\n").filter(t=>!se.Q.isNullOrEmpty(t)).map(t=>`<li>${t.replace("Warning",'<strong class="text-warning">Warning</strong>').replace("Error",'<strong class="text-error">Error</strong>')}</li>`);return c.length?`<ul>${c.join("\n")}</ul>`:""}(this.getCompilation(this.value))}get displayedFiles(){return this.allFilesVisible?this.files:this.files.slice(0,this.filesListSplit)}get callFlowStatus(){return function dr(n,c){return"Unresponsive"===n?{type:"danger",message:"_i18n.CallFlowAppNotBuildWarning"}:"Updating"===n?{type:"info",message:"_i18n.Loading",updating:!0}:c.ScriptCode?c.IsRegistered?!c.CompilationSucceeded&&c.CompilationResult?c.InvalidScript?{type:"danger",message:"_i18n.CompilationErrors"}:{type:"warning",message:"_i18n.CallFlowCompilationErrorOnUpdate"}:{type:"success",message:"_i18n.CompilationSuccess"}:{type:"warning",message:"_i18n.CallFlowAppNotRegistered"}:{type:"info",message:"_i18n.PutCallFlowAppScriptHere"}}(this.compilationState,this.getCompilation(this.value))}toggleFilesDisplay(){this.allFilesVisible=!this.allFilesVisible,this.cd.markForCheck()}removeFile(t){this.modalService.confirmDeletion("_i18n.ConfirmDeleteFile").subscribe(()=>this.fileRemoved.emit(t))}addFile(t){const o=t.files?.[0];if(t.value="",this.cd.markForCheck(),!o)return;const i=this.files.some(a=>a===o.name)?"_i18n.FilenameDuplicated":(0,V.j$)(o,{maxSizeMb:zt.l2,allowedExtensions:["wav","txt","json","csv"]});i?this.modalService.error(i):this.fileAdded.emit(o)}setScriptCodeErrorAnnotations(){this.appAce?.setAnnotations(function ar(n){return n.CompilationSucceeded?[]:(n.CompilationResult??"").split("\n").map(c=>c.includes("Warning")&&Tn(c,!1)||c.includes("Error")&&Tn(c,!0)||void 0).filter(Boolean)}(this.getCompilation(this.value)))}getCompilation(t){return t.ScriptCode===yn(this.lastCompilation)?this.lastCompilation:{ScriptCode:t.ScriptCode}}get generalInvalid(){return(0,_e.S)([this.f.Dids,this.f.RoutingType,this.f.Name,this.f.Trunk,this.f.Number,this.f.Group])}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275cmp=e.VBU({type:n,selectors:[["app-cfa-editor"]],viewQuery:function(o,i){if(1&o&&e.GBs(ut.x,5),2&o){let a;e.mGM(a=e.lsd())&&(i.appAce=a.first)}},hostVars:1,hostBindings:function(o,i){2&o&&e.BMQ("data-qa","cfa-editor")},inputs:{editMode:"editMode",isPaid:"isPaid",availableGroups:"availableGroups",systemAccess:"systemAccess",compilationState:"compilationState",files:"files"},outputs:{fileAdded:"fileAdded",fileRemoved:"fileRemoved"},features:[e.Jv_([{provide:l.kq,useExisting:n,multi:!0},{provide:l.cz,useExisting:n,multi:!0}]),e.Vt3],ngContentSelectors:hr,decls:7,vars:3,consts:[["configuration",""],["file",""],[1,"accordion-options",3,"isAnimated"],["data-qa","validation",1,"form-control-validation"],[3,"control"],["data-qa","name","label","_i18n.Name","placeholder","_i18n.CallFlowAppName",3,"formControl","maxlength"],["data-qa","run-mode","label","_i18n.CallFlowAppRunScriptLabel",3,"formControl","options"],["data-qa","trunk","label","_i18n.Trunk",3,"isClearable","isNew","formControl"],["data-qa","dial-code","label","_i18n.CreateNewDialCode","placeholder","_i18n.CallFlowAppDialAllowedInputs",3,"formControl","maxlength"],["label","_i18n.DidNumberOrNumbers","data-qa","assigned-did",3,"formControl","dn","showAsterisk","clearable"],["data-qa","department",3,"formControl","readonly","groups","systemAccess"],["valError","unique"],["valError","pattern"],[4,"ngTemplateOutlet"],[3,"isOpen"],["accordion-heading","",1,"accordion-toggle"],["type","button",1,"btn","btn-link"],["data-qa","add-file",3,"click","disabled"],["data-qa","cfd-file","type","file","accept",".wav,.txt,.json,.csv","hidden","",3,"change"],[1,"mt-3","d-flex","flex-wrap","gap-2"],[1,"d-flex","justify-content-between","align-items-center","mb-3"],[2,"font-weight","700"],[3,"disabled"],["data-qa","compilation-status",1,"mb-0",3,"type"],["data-qa","script-code",3,"formControl","mode","readOnly"],["type","button","data-qa","remove-file",1,"btn","btn-border","gap-1","p-1",3,"disabled"],["data-qa","toggle-list",1,"dashed","link","align-self-center"],["type","button","data-qa","remove-file",1,"btn","btn-border","gap-1","p-1",3,"click","disabled"],["data-qa","name"],["app-trash-alt-solid-icon","",1,"svg-xs","fillIconRed"],["data-qa","toggle-list",1,"dashed","link","align-self-center",3,"click"],[1,"d-flex","flex-row","gap-2"],["app-spinner-regular-icon","",1,"svg-md"],["data-qa","compilation-errors",1,"overflow-auto","border","bg-console",2,"max-height","250px",3,"innerHTML"]],template:function(o,i){1&o&&(e.NAR(gr),e.DNE(0,Tr,8,13,"ng-template",null,0,e.C5r),e.nVh(2,Fr,2,1,"div")(3,Er,27,25,"accordion",2),e.j41(4,"div",3),e.nrm(5,"val-errors",4),e.nV
1h(6,wr,1,0),e.k0s()),2&o&&(e.R7$(2),e.vxM(i.editMode?3:2),e.R7$(3),e.Y8G("control",i.form),e.R7$(),e.vxM(i.form.valid?6:-1))},dependencies:[N.T3,l.X1,l.BC,l.tU,l.l_,$.N4,$.IH,$.VI,Ce.j,Xe.d,je.a,Ae.Cy,ut.x,fr.w,Je.h6,Je.Mj,Je.kt,In.x,ot.K,te.m,Te.q,N.Jj,y.D9],encapsulation:2,changeDetection:0})}return n})();var Pr=p(60240);const An=n=>({$implicit:n});function Gr(n,c){if(1&n&&e.eu8(0,3),2&n){const t=c.$implicit;e.XpG(2);const o=e.sdS(4);e.Y8G("ngTemplateOutlet",o)("ngTemplateOutletContext",e.eq3(2,An,t))}}function Dr(n,c){if(1&n&&(e.j41(0,"field-radio-group",2),e.DNE(1,Gr,1,4,"ng-template"),e.k0s()),2&n){const t=e.XpG();e.Y8G("options",t.createModeOptions)("formControl",t.f.CreateMode)}}function Nr(n,c){if(1&n&&e.eu8(0,3),2&n){const t=e.XpG(),o=e.sdS(4);e.Y8G("ngTemplateOutlet",o)("ngTemplateOutletContext",e.eq3(2,An,t.CreateMode.REQUEST))}}function jr(n,c){if(1&n&&(e.j41(0,"field-input-file",4),e.nrm(1,"val-errors",6),e.k0s()),2&n){const t=e.XpG(2);e.Y8G("formControl",t.f.File),e.R7$(),e.Y8G("control",t.f.File)}}function Vr(n,c){}function Br(n,c){if(1&n&&(e.j41(0,"app-cfa-editor",5)(1,"val-errors",6),e.DNE(2,Vr,0,0,"ng-template",7),e.k0s()()),2&n){const t=e.XpG(2);e.Y8G("formControl",t.f.Request)("editMode",!1)("isPaid",!0)("availableGroups",t.availableGroups)("systemAccess",t.systemAccess),e.R7$(),e.Y8G("control",t.f.Request)}}function Hr(n,c){if(1&n&&e.nVh(0,jr,2,2,"field-input-file",4)(1,Br,3,6,"app-cfa-editor",5),2&n){const t=c.$implicit,o=e.XpG();e.vxM(t===o.CreateMode.FILE?0:t===o.CreateMode.REQUEST?1:-1)}}var Fe=function(n){return n[n.FILE=0]="FILE",n[n.REQUEST=1]="REQUEST",n}(Fe||{});let Or=(()=>{class n extends k.m{httpClient=(0,s.WQX)(W.Qq);callFlowAppsApiService=(0,s.WQX)(nt);xapiErrorService=(0,s.WQX)(K.Ko);cd=(0,s.WQX)(_.gRc);didNumberService=(0,s.WQX)(Oe.Q);modalService=(0,s.WQX)(B.B);destroy$=(0,s.WQX)(s.abz);canReadWrite;availableGroups;systemAccess;scriptCode;cfaEditor;buttons=G.P.OkCancel;CreateMode=Fe;createModeOptions=[{value:Fe.REQUEST,label:"_i18n.CreateCallFlowAppModeRequest"},{value:Fe.FILE,label:"_i18n.UploadCallFlowApp"}];form=new l.gE({CreateMode:new l.MJ(Fe.REQUEST),File:new l.MJ(null,[l.k0.required]),Request:new l.MJ(null,[l.k0.required])});validateBeforeSubmit=this.createDialogValidate(this.form,this.cd);createdCallFlowAppId;get f(){return this.form.controls}ngOnInit(){(0,T.XP)(this.f.CreateMode).pipe((0,R.pQ)(this.destroy$)).subscribe(t=>{(0,T.TZ)(this.f.File,t===Fe.FILE),(0,T.TZ)(this.f.Request,t===Fe.REQUEST)})}submit$=()=>(this.f.CreateMode.value===Fe.FILE?this.uploadCFA$():this.createCFA$()).pipe((0,P.M)(t=>{this.createdCallFlowAppId=t.Id}));uploadCFA$(){const{File:t}=this.form.value;return this.httpClient.post("/xapi/v1/CallFlowApps/CreateFromFile",(0,$t.$)(t)).pipe((0,A.W)(o=>400!==o.status?(0,$e.$)(()=>o):((0,K.Xy)(this.f.File,K.DD,(0,X.PE)(o)),this.cd.markForCheck(),E.w)))}createCFA$(){const{Dids:t=[],...o}=this.form.value.Request;return o.Number||(o.Number=o.Name),o.ScriptCode=this.scriptCode,this.callFlowAppsApiService.createCallFlowApp({pbxCallFlowApp:o}).pipe((0,A.W)(i=>400===i.status&&this.cfaEditor&&this.xapiErrorService.error(this.cd,i,this.cfaEditor.form,!1,!1)?E.w:(0,$e.$)(()=>i)),(0,I.n)(i=>this.saveDids$(i.Id,t.map(a=>({...a,DisplayName:a.DisplayName||i.Number}))).pipe((0,v.T)(()=>i))))}saveDids$(t,o){return this.didNumberService.setDids$(t,o).pipe((0,x.Tg)(this.modalService))}getPayload(){return this.createdCallFlowAppId}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275cmp=e.VBU({type:n,selectors:[["app-create-call-flow-app-modal"]],viewQuery:function(o,i){if(1&o&&e.GBs(Tt,5),2&o){let a;e.mGM(a=e.lsd())&&(i.cfaEditor=a.first)}},hostVars:2,hostBindings:function(o,i){2&o&&e.AVh("modal-lg",!0)},inputs:{canReadWrite:"canReadWrite",availableGroups:"availableGroups",systemAccess:"systemAccess",scriptCode:"scriptCode"},features:[e.Vt3],decls:5,vars:6,consts:[["main",""],["header","_i18n.CreateCallFlowApp",3,"submitted","validateBeforeSubmit","buttons","submit$","okDisabled","okDisabledReason"],["data-qa","create-mode",3,"options","formControl"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],["data-qa","cfd-file","label","_i18n.CallFlowAppProjectFile","accept",".zip","incorrectExtensionText","_i18n.InvalidCallFlowFile",3,"formControl"],[3,"formControl","editMode","isPaid","availableGroups","systemAccess"],[3,"control"],["valError","required"]],template:function(o,i){1&o&&(e.j41(0,"app-modal-dialog",1),e.bIt("submitted",function(){return i.onSubmit()}),e.nVh(1,Dr,2,2,"field-radio-group",2)(2,Nr,1,4,"ng-container",3),e.DNE(3,Hr,2,1,"ng-template",null,0,e.C5r),e.k0s()),2&o&&(e.Y8G("validateBeforeSubmit",i.validateBeforeSubmit)("buttons",i.buttons)("submit$",i.submit$)("okDisabled",!i.canReadWrite)("okDisabledReason",i.canReadWrite?"":"_i18n.ReportsLicenseRestrictions"),e.R7$(),e.vxM(i.scriptCode?2:1))},dependencies:[me.p,Pr.u,l.X1,l.BC,l.l_,N.T3,gt.y,$.IH,Tt,$.VI],encapsulation:2,changeDetection:0})}return n})();var Ge=p(79177);const Xr=(n,c)=>c.Id;function Qr(n,c){if(1&n){const t=e.RV6();e.j41(0,"tr",4),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG();return s.Njj(a.selectScript(i.Id))}),e.j41(1,"td"),e.EFF(2),e.k0s(),e.j41(3,"td",5),e.EFF(4),e.k0s(),e.j41(5,"td",6)(6,"app-external-link",7),e.EFF(7),e.k0s()()()}if(2&n){const t=c.$implicit;e.R7$(2),e.SpI(" ",t.Id," "),e.R7$(2),e.SpI(" ",t.Description," "),e.R7$(2),e.Y8G("href",t.Help),e.R7$(),e.JRh(t.Help)}}let Lr=(()=>{class n extends k.m{http=(0,s.WQX)(W.Qq);modalService=(0,s.WQX)(B.B);dialog;buttons=G.P.Cancel;scripts;scriptCode;getPayload(){return this.scriptCode}selectScript(t){this.http.get(`/xapi/v1/CallFlowScripts/${t}`,{responseType:"text"}).subscribe({error:o=>{this.modalService.error(o),this.dialog.cancel()},next:o=>{this.scriptCode=o,this.dialog.submit()}})}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275cmp=e.VBU({type:n,selectors:[["app-call-flow-app-store-modal"]],viewQuery:function(o,i){if(1&o&&e.GBs(me.p,7),2&o){let a;e.mGM(a=e.lsd())&&(i.dialog=a.first)}},hostVars:2,hostBindings:function(o,i){2&o&&e.AVh("modal-xl",!0)},features:[e.Vt3],decls:17,vars:12,consts:[[3,"submitted","buttons","header","scrollable"],["data-qa","table",1,"scrollable-table"],[1,"md-visible"],["data-qa","row",1,"clickable"],["data-qa","row",1,"clickable",3,"click"],["data-qa","description",1,"md-visible"],["data-qa","help",1,"md-visible"],[1,"line-clamp-1",3,"href"]],template:function(o,i){1&o&&(e.j41(0,"app-modal-dialog",0),e.bIt("submitted",function(){return i.onSubmit()}
1),e.j41(1,"div",1)(2,"table")(3,"thead")(4,"tr")(5,"th"),e.EFF(6),e.nI1(7,"translate"),e.k0s(),e.j41(8,"th",2),e.EFF(9),e.nI1(10,"translate"),e.k0s(),e.j41(11,"th",2),e.EFF(12),e.nI1(13,"translate"),e.k0s()()(),e.j41(14,"tbody"),e.Z7z(15,Qr,8,4,"tr",3,Xr),e.k0s()()()()),2&o&&(e.Y8G("buttons",i.buttons)("header","_i18n.AddFromStore")("scrollable",!0),e.R7$(6),e.JRh(e.bMT(7,6,"_i18n.Name")),e.R7$(3),e.JRh(e.bMT(10,8,"_i18n.Description")),e.R7$(3),e.JRh(e.bMT(13,10,"_i18n.HelpPage")),e.R7$(3),e.Dyx(i.scripts))},dependencies:[me.p,ke.P,y.D9],encapsulation:2})}return n})();var $n=p(49371),at=p(68845),yt=p(7707),Mn=p(32817);function Wr(n,c){return this.appsService.identify(n,c)}function Yr(n,c){1&n&&(e.j41(0,"span",1),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&n&&(e.R7$(),e.SpI("(",e.bMT(2,1,"_i18n.ReportsLicenseRestrictions"),")"))}function Jr(n,c){if(1&n){const t=e.RV6();e.j41(0,"tr",18),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG();return s.Njj(a.routeToCallFLowEditor(i))}),e.j41(1,"td",8)(2,"app-checker",19),e.bIt("ngModelChange",function(i){const a=s.eBV(t).$implicit,r=e.XpG();return s.Njj(r.selector.setSelected(a,i))})("checkerClick",function(i){const a=s.eBV(t).$implicit,r=e.XpG();return s.Njj(r.selector.handleCheckerClick(a,i))}),e.k0s()(),e.j41(3,"td",20)(4,"div",21),e.nrm(5,"i",22),e.nI1(6,"translate"),e.EFF(7),e.k0s()(),e.j41(8,"td",23),e.EFF(9),e.nI1(10,"appEclipsedList"),e.k0s(),e.j41(11,"td",24)(12,"span",25),e.EFF(13),e.nI1(14,"translate"),e.k0s()(),e.j41(15,"td",20),e.EFF(16),e.nI1(17,"amLocal"),e.nI1(18,"amDateFormat"),e.k0s(),e.j41(19,"td",26)(20,"row-action-button")(21,"li",27)(22,"button",28),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG();return s.Njj(a.routeToCallFLowEditor(i))}),e.EFF(23),e.nI1(24,"translate"),e.k0s()(),e.j41(25,"li",27)(26,"button",29),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG();return s.Njj(a.deleteAppById(i))}),e.EFF(27),e.nI1(28,"translate"),e.k0s()()()()()}if(2&n){const t=c.$implicit,o=e.XpG();e.R7$(2),e.Y8G("ngModel",o.selector.isRowSelected(t)),e.R7$(3),e.Y8G("ngClass",o.isSuccessful(t)?"available":"off")("title",e.bMT(6,10,o.isSuccessful(t)?"_i18n.ExtensionIsRegistered":"_i18n.ExtensionIsNotRegistered")),e.R7$(2),e.SpI(" ",o.appsService.getDisplayName(t)," "),e.R7$(2),e.SpI(" ",e.i5U(10,12,o.appsService.getDepartment(t.Groups),4)," "),e.R7$(4),e.Lme(" ",e.bMT(14,15,o.appsService.getRoutingType(t))," ",o.appsService.getRoutingInfo(t)," "),e.R7$(3),e.JRh(t.CompilationLastSuccess?e.i5U(18,19,e.bMT(17,17,t.CompilationLastSuccess),"L LT"):""),e.R7$(7),e.SpI(" ",e.bMT(24,22,"_i18n.Edit")," "),e.R7$(4),e.SpI(" ",e.bMT(28,24,"_i18n.Delete")," ")}}let qr=(()=>{class n{modalService=(0,s.WQX)(B.B);callFlowAppsApiService=(0,s.WQX)(nt);callFlowStoreApi=(0,s.WQX)(bn);route=(0,s.WQX)(S.nX);cd=(0,s.WQX)(_.gRc);appsService=(0,s.WQX)(ur);router=(0,s.WQX)(S.Ix);destroy$=(0,s.WQX)(s.abz);pager;data=[];selector;canReadWrite=!1;autoRefresh=!0;systemParameters=this.route.snapshot.data.systemParameters||{};constructor(){const t=this.modalService,o=this.route,i=this.cd,a=this.appsService,r=this.destroy$;this.canReadWrite=o.snapshot.data.myToken?.roles?.includes("Apps.ReadWrite"),this.selector=new bt.a({cd:i,keySelector:d=>d.Id}),this.pager=new Nt.f(r,a.makeResolver()),this.pager.pagedItems$.pipe((0,R.pQ)(this.destroy$)).subscribe({next:d=>{this.updateItems(d)},error:d=>t.error(d)}),(0,Se.O)(5e3,5e3).pipe((0,et.p)(()=>this.autoRefresh),(0,R.pQ)(r)).subscribe(()=>this.pager.refresh$.next())}updateItems(t){this.selector.onDataChanged(t.value||[]),this.data=t.value||[],this.cd.markForCheck()}showAddCustomCFAModal(t){this.autoRefresh=!1,this.modalService.showDialog(Or,{scriptCode:t,availableGroups:Ge.MQ.groups(this.route),systemAccess:Ge.MQ.groupsAccess(this.route),canReadWrite:this.canReadWrite},{ignoreBackdropClick:!0}).subscribe(o=>{this.autoRefresh=!0,o.decision===G.R.Ok&&(o.payload?this.router.navigate(["office","integrations","call-flow","edit",o.payload]).catch(Ct.l):this.pager.refresh$.next())})}showAddCFAFromStoreModal(){this.autoRefresh=!1,this.callFlowStoreApi.listCallFlowScript({}).pipe(x.yh,(0,I.n)(t=>this.modalService.showDialog(Lr,{scripts:t})),(0,x.Sf)(),(0,x.Tg)(this.modalService),(0,Me.j)(()=>this.autoRefresh=!0)).subscribe(t=>{this.showAddCustomCFAModal(t)})}
1isSuccessful(t){return!(!t.IsRegistered||!t.CompilationSucceeded||t.InvalidScript)}routeToCallFLowEditor(t){this.router.navigate(["edit",t.Id],{relativeTo:this.route}).catch(Ct.l)}deleteAppById(t){this.delete(t)}delete(t){this.modalService.confirmDeletion(t?"_i18n.DeleteCallFlowAppConfirmation":"_i18n.DeleteCallFlowApps").pipe((0,I.n)(()=>{const o=t?[t.Id]:this.selector.selectedKeys,i=(0,_n.x)(...o.map(a=>this.callFlowAppsApiService.deleteCallFlowApp({id:a}).pipe((0,A.W)(r=>(0,M.of)({}))))).pipe((0,v.T)((a,r)=>r));return this.modalService.progress("_i18n.DeleteAll",o.length,i)})).subscribe({complete:()=>{t?this.selector.resetSingle(t.Id):this.selector.resetAll(),this.pager.refresh$.next()}})}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-call-flow-apps"]],decls:47,vars:36,consts:[["header","_i18n.CallFlowApps","helpUrl","_i18n.CFDUri"],["header-text","",1,"fw-normal"],["top-bar","",1,"button-group"],["data-qa","add-from-store","type","button",1,"btn","btn-primary",3,"click"],["data-qa","add-custom","type","button",1,"btn","btn-primary",3,"click"],["data-qa","delete-call-flow-app","type","button",1,"btn","btn-primary",3,"click","disabled"],["top-bar","",3,"formControl"],["full-width","",1,"scrollable-table"],[1,"checker"],[3,"ngModelChange","ngModel"],[1,"col-size-100"],[1,"col-size-200","lg-visible"],[1,"w-50"],[1,"col-size-200"],[1,"actions"],[1,"clickable"],["colspan","5"],[3,"pageChanged","currentPage","itemsPerPage","totalItems","showBoundaryLinks"],[1,"clickable",3,"click"],[3,"ngModelChange","checkerClick","ngModel"],[1,"text-md-nowrap"],[1,"d-flex","gap-2","align-items-center"],[1,"status-indicator",3,"ngClass","title"],["data-qa","groups",1,"lg-visible"],["data-qa","routing"],[1,"line-clamp-2"],["data-qa","actions",1,"actions"],["role","menuitem"],["type","button","data-qa","edit",1,"dropdown-item",3,"click"],["type","button","data-qa","delete",1,"dropdown-item",3,"click"]],template:function(o,i){1&o&&(e.j41(0,"app-page",0),e.nVh(1,Yr,3,3,"span",1),e.j41(2,"div",2)(3,"button",3),e.bIt("click",function(){return i.showAddCFAFromStoreModal()}),e.nrm(4,"app-plus-solid-icon"),e.j41(5,"span"),e.EFF(6),e.nI1(7,"translate"),e.k0s()(),e.j41(8,"button",4),e.bIt("click",function(){return i.showAddCustomCFAModal()}),e.nrm(9,"app-plus-solid-icon"),e.j41(10,"span"),e.EFF(11),e.nI1(12,"translate"),e.k0s()(),e.j41(13,"button",5),e.bIt("click",function(){return i.delete()}),e.nrm(14,"app-trash-alt-solid-icon"),e.j41(15,"span"),e.EFF(16),e.nI1(17,"translate"),e.k0s()()(),e.nrm(18,"search-bar",6),e.j41(19,"table",7)(20,"thead")(21,"tr")(22,"th",8)(23,"app-checker",9),e.bIt("ngModelChange",function(r){return i.selector.setSelectAll(r)}),e.k0s()(),e.j41(24,"th",10),e.EFF(25),e.nI1(26,"translate"),e.k0s(),e.j41(27,"th",11),e.EFF(28),e.nI1(29,"translate"),e.k0s(),e.j41(30,"th",12),e.EFF(31),e.nI1(32,"translate"),e.k0s(),e.j41(33,"th",13),e.EFF(34),e.nI1(35,"translate"),e.k0s(),e.nrm(36,"th",14),e.k0s()(),e.j41(37,"tbody"),e.Z7z(38,Jr,29,26,"tr",15,Wr,!0),e.k0s(),e.j41(40,"tfoot")(41,"tr")(42,"td",16)(43,"app-paging",17),e.nI1(44,"async"),e.nI1(45,"async"),e.nI1(46,"async"),e.bIt("pageChanged",function(r){return i.pager.pageChanged(r)}),e.k0s()()()()()()),2&o&&(e.R7$(),e.vxM(i.canReadWrite?-1:1),e.R7$(5),e.JRh(e.bMT(7,16,"_i18n.AddCFAFromStore")),e.R7$(5),e.JRh(e.bMT(12,18,"_i18n.AddCustomCFA")),e.R7$(2),e.Y8G("disabled",!i.selector.isAnySelected),e.R7$(3),e.Lme("",e.bMT(17,20,"_i18n.Delete"),"",i.selector.selectedCountLabel),e.R7$(2),e.Y8G("formControl",i.pager.search),e.R7$(5),e.Y8G("ngModel",i.selector.isAnySelected),e.R7$(2),e.JRh(e.bMT(26,22,"_i18n.Extension")),e.R7$(3),e.JRh(e.bMT(29,24,"_i18n.Department")),e.R7$(3),e.JRh(e.bMT(32,26,"_i18n.CallFlowAppRunScriptLabel")),e.R7$(3),e.JRh(e.bMT(35,28,"_i18n.LastSuccessTime")),e.R7$(4),e.Dyx(i.data),e.R7$(5),e.Y8G("currentPage",e.bMT(44,30,i.pager.currentPage$))("itemsPerPage",e.bMT(45,32,i.pager.pageSize$))("totalItems",e.bMT(46,34,i.pager.totalCount$))("showBoundaryLinks",!0))},dependencies:[qe.H,$n.K,Xe.d,at.L,l.X1,l.BC,l.l_,yt.$,l.YN,l.vS,N.YU,He.I,Pe.u4,y.D9,N.Jj,dn.a,wt.h,Mn.E],encapsulation:2})}return n})();var kn=p(84412),Ur=p(39901);let Xt=(()=>{class n{callFlowAppsApi=(0,s.WQX)(nt);getCallFlowApp$(t){return this.callFlowAppsApi.getCallFlowApp({id:t,$select:["Name","Id","Number","ScriptCode","CompilationSucceeded","InvalidScript","RejectedCode","CompilationResult","CompilationLastSuccess","IsRegistered","Groups","RoutingType","Trunk"],$expand:[`Groups($select=GroupId,Name,Number;${it.n0}),Trunk($select=Id,Gateway,Groups;$expand=Groups)`]})}getCallFlowFiles$(t){return this.callFlowAppsApi.getFiles({id:t}).pipe((0,v.T)(({value:o})=>o??[]),(0,A.W)(()=>(0,M.of)([])))}static \u0275fac=function(o){return new(o||n)};static \u0275prov=s.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),zr=(()=>{class n{destroy$=(0,s.WQX)(s.abz);httpClient=(0,s.WQX)(W.Qq);callFlowApiService=(0,s.WQX)(nt);editCallflowAppService=(0,s.WQX)(Xt);modalService=(0,s.WQX)(B.B);translate=(0,s.WQX)(y.c$);didNumberService=(0,s.WQX)(Oe.Q);xapiError=(0,s.WQX)(K.Ko);cd=(0,s.WQX)(_.gRc);callFlowApp;files=[];filesToAdd=[];filesToRemove=[];availableGroups=[];systemAccess=!1;initialDids=[];canReadWrite=!1;cfaEditor;compilationState$=new kn.t("Ok");form=new l.gE({callFlowApp:new l.MJ(null,l.k0.required)});constructor(){const t=this.destroy$;(0,s.WQX)(S.nX).data.pipe((0,R.pQ)(t)).subscribe(i=>{const{callFlowApp:a,callFlowFiles:r}=i;this.canReadWrite=i.myToken?.roles?.includes("Apps.ReadWrite"),this.availableGroups=i.trunksGroups,this.systemAccess=i.groupAccess,this.files=r,this.filesToRemove=[],this.filesToAdd=[],this.setCallFlowApp(a)}),this.initialDids=this.callFlowApp.Dids?.map(i=>({...i}))||[]}get f(){return this.form.controls}handleFileAdd(t){this.files.push(t.name),this.filesToAdd.push(t),this.cd.markForCheck()}handleFileRemove(t){this.files.splice(this.files.indexOf(t),1);const o=this.filesToAdd.findIndex(i=>i.name===t);o>=0?this.filesToAdd.splice(o,1):this.filesToRemove.push(t),this.cd.markForCheck()}save$=()=>{const t=this.callFlowApp.Id,o=this.form.value.callFlowApp,i={},a=vt(this.callFlowApp),r=this.callFlowApp.ScriptCode!==o.ScriptCode||this.callFlowApp.ScriptCode&&!this.callFlowApp.CompilationSucceeded,d=Bt(o.Groups);return o.RoutingType!==this.callFlowApp.RoutingType&&(i.RoutingType=o.RoutingType),o.Trunk?.Id!==this.callFlowApp.Trunk?.Id&&(i.Trunk=o.Trunk?{Id:o.Trunk.Id}:null),d!==Bt(this.callFlowApp.Groups)&&(i.Groups=d?[{GroupId:d}]:[]),r&&(i.ScriptCode=o.ScriptCode),(Object.keys(i).length?this.callFlowApiService.updateCallFlowApp({id:t,pbxCallFlowApp:i}).pipe((0,x.Pr)("_i18n.CFANotFoundErrorMessage",a),(0,A.W)(m=>400===m.status&&this.cfaEditor&&this.xapiError.error(this.cd,m,this.cfaEditor.form,!1,!1)?E.w:(0,$e.$)(()=>m)),(0,P.M)(()=>Object.assign(this.callFlowApp,i))):(0,M.of)(null)).pipe((0,I.n)(()=>(0,Ee.p)([this.saveFiles$(),this.saveDids$(o.RoutingType===le.Forward?o.Dids:[]),r?this.refreshCompilationState$():(0,M.of)(null)])),(0,P.M)(()=>{this.setCallFlowApp(this.callFlowApp)}),(0,R.pQ)(this.destroy$))};saveFiles$(){const t=this.callFlowApp.Id,o=vt(this.callFlowApp);return(0,Ee.p)([...this.filesToAdd.map(i=>this.httpClient.post(`/xapi/v1/CallFlowApps(${t})/UploadFile`,(0,$t.$)(i)).pipe((0,x.Pr)("_i18n.CFAFileUploadNotFoundErrorMessage",o),(0,v.T)(()=>(this.filesToAdd.splice(this.filesToAdd.indexOf(i),1),null)),(0,A.W)(a=>(0,M.of)(i.name+": "+(0,X.PE)(a))))),...this.filesToRemove.map(i=>this.callFlowApiService.deleteFile({id:t,callFlowAppsCallFlowAppDeleteFileRequestBody:{filename:i}}).pipe((0,x.Pr)("_i18n.CFAFileDeleteNotFoundErrorMessage"),(0,v.T)(()=>(this.filesToRemove.splice(this.filesToRemove.indexOf(i),1),null)),(0,A.W)(a=>(0,M.of)(i+": "+(0,X.PE)(a)))))]).pipe((0,P.M)(i=>
1{const a=i.filter(Boolean);a.length&&this.modalService.error(a.join("<br/>"))}),(0,Ur.U)(null))}saveDids$(t){const o=this.callFlowApp.Id,i=vt(this.callFlowApp);if(this.initialDids.map(r=>r.Number+r.DisplayName).sort().join()===t.map(r=>r.Number+r.DisplayName).sort().join())return(0,M.of)(null);const a=new Set(this.initialDids.map(r=>r.Number));return t.forEach(r=>{!r.DisplayName&&!a.has(r.Number)&&(r.DisplayName=i)}),this.initialDids=t.map(r=>({...r}))||[],this.didNumberService.setDids$(o,t).pipe((0,P.M)(()=>{this.callFlowApp.Dids=t}),(0,A.W)(r=>(this.modalService.error(r),(0,M.of)(null))))}refreshCompilationState$(){const t=this.callFlowApp,o=t.Id;return this.compilationState$.next("Updating"),(0,Se.O)(0,3e3).pipe((0,Ze.p)(i=>this.editCallflowAppService.getCallFlowApp$(o).pipe((0,v.T)(a=>({callFlowApp:a,compiled:Kr(t,a),attempt:i})))),(0,et.p)(({compiled:i,attempt:a})=>i||a>=7),(0,Dt.s)(1),(0,P.M)(({callFlowApp:i,compiled:a})=>{this.compilationState$.next(a?"Ok":"Unresponsive"),Object.assign(this.callFlowApp,Rn(i))}),(0,A.W)(()=>(this.compilationState$.next("Error"),(0,M.of)(null))))}setCallFlowApp(t){this.callFlowApp=t,this.form.setValue({callFlowApp:this.callFlowApp}),this.form.markAsPristine(),this.form.markAsUntouched(),this.cd.markForCheck()}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-edit-cfa-page"]],viewQuery:function(o,i){if(1&o&&e.GBs(Tt,5),2&o){let a;e.mGM(a=e.lsd())&&(i.cfaEditor=a.first)}},decls:5,vars:19,consts:[["backRouterLink","../..",3,"header","saveDisabledByReason","formGroup","pristine","save$"],[3,"fileAdded","fileRemoved","formControl","editMode","isPaid","availableGroups","systemAccess","files","compilationState"],[3,"control"]],template:function(o,i){1&o&&(e.j41(0,"edit-panel",0),e.nI1(1,"translate"),e.j41(2,"app-cfa-editor",1),e.nI1(3,"async"),e.bIt("fileAdded",function(r){return i.handleFileAdd(r)})("fileRemoved",function(r){return i.handleFileRemove(r)}),e.nrm(4,"val-errors",2),e.k0s()()),2&o&&(e.Y8G("header",e.ai1("",e.bMT(1,15,"_i18n.EditCallFlowAppHeader")," ",i.callFlowApp.Number))("saveDisabledByReason",i.canReadWrite?"":"_i18n.ReportsLicenseRestrictions")("formGroup",i.form)("pristine",i.form.pristine&&!i.filesToAdd.length&&!i.filesToRemove.length)("save$",i.save$),e.R7$(2),e.Y8G("formControl",i.f.callFlowApp)("editMode",!0)("isPaid",!0)("availableGroups",i.availableGroups)("systemAccess",i.systemAccess)("files",i.files)("compilationState",e.bMT(3,17,i.compilationState$)),e.R7$(2),e.Y8G("control",i.f.callFlowApp))}
1,dependencies:[ne.Q,l.X1,l.BC,l.cb,l.l_,l.j4,Tt,$.IH,y.D9,N.Jj],encapsulation:2,changeDetection:0})}return n})();function Kr(n,c){return n.CompilationResult!==c.CompilationResult||n.CompilationSucceeded!==c.CompilationSucceeded||n.InvalidScript!==c.InvalidScript||n.RejectedCode!==c.RejectedCode||n.CompilationLastSuccess?.toString()!==c.CompilationLastSuccess?.toString()}const Zr={callFlowApp:n=>{const c=+n.params.id,t=(0,s.WQX)(Xt),o=(0,s.WQX)(Oe.Q),i=(0,s.WQX)(fe.s);return(0,Ee.p)([t.getCallFlowApp$(c),o.getDids$(c)]).pipe((0,v.T)(([a,r])=>({...a,Dids:r})),(0,A.W)(a=>i.handleError(a)))},callFlowFiles:n=>(0,s.WQX)(Xt).getCallFlowFiles$(+n.params.id)},es=[{path:"",component:qr,resolve:{systemParameters:Ve.M,myToken:Cn.C,...Ge.T4}},{path:"edit/:id",component:zr,resolve:{...Ge.T4,...Zr,myToken:Cn.C}}];let Ft=(()=>{class n extends ye.d{createServicePrincipal(t,o="body"){const i=t?.pbxServicePrincipal;if(null==i)throw new Error("Required parameter pbxServicePrincipal was null or undefined when calling createServicePrincipal.");let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("post",`${C}/ServicePrincipals`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}createServicePrincipalQuery(t,o="body",i=!1,a){if(null==t.pbxServicePrincipal)throw new Error("Required parameter pbxServicePrincipal was null or undefined when calling createServicePrincipal.");return"/ServicePrincipals"}deleteServicePrincipal(t,o="body"){const i=t?.id;if(null==i)throw new Error("Required parameter id was null or undefined when calling deleteServicePrincipal.");const a=t?.ifMatch;let r=this.defaultHeaders;null!=a&&(r=r.set("If-Match",String(a))),r=this.configuration.addCredentialToHeaders("Application","Authorization",r,"Bearer ");const d=this.configuration.selectHeaderAccept(["application/json"]);void 0!==d&&(r=r.set("Accept",d));let u="json";d&&(u=d.startsWith("text")?"text":this.configuration.isJsonMime(d)?"json":"blob");let m=`/ServicePrincipals(${this.configuration.encodeParam({name:"id",value:i,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})`;const{basePath:g,withCredentials:C}=this.configuration;return this.httpClient.request("delete",`${g}${m}`,{responseType:u,...C?{withCredentials:C}:{},headers:r,observe:o})}deleteServicePrincipalQuery(t,o="body",i=!1,a){const r=t.id;if(null==r)throw new Error("Required parameter id was null or undefined when calling deleteServicePrincipal.");return`/ServicePrincipals(${this.configuration.encodeParam({name:"id",value:r,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})`}generateAppToken(t,o="body"){const i=t?.id;if(null==i)throw new Error("Required parameter id was null or undefined when calling generateAppToken.");let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));let d="json";r&&(d=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");let u=`/ServicePrincipals(${this.configuration.encodeParam({name:"id",value:i,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})/Pbx.GenerateAppToken`;const{basePath:m,withCredentials:g}=this.configuration;return this.httpClient.request("post",`${m}${u}`,{responseType:d,...g?{withCredentials:g}:{},headers:a,observe:o})}generateAppTokenQuery(t,o="body",i=!1,a){const r=t.id;if(null==r)throw new Error("Required parameter id was null or undefined when calling generateAppToken.");return`/ServicePrincipals(${this.configuration.encodeParam({name:"id",value:r,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})/Pbx.GenerateAppToken`}getServicePrincipal(t,o="body"){const i=t?.id;if(null==i)throw new Error("Required parameter id was null or undefined when calling getServicePrincipal.");const a=t?.$select,r=t?.$expand;let d=new h.rx(this.encoder);d=this.addToHttpParams(d,"$select",a,h.l2.Form,!1),d=this.addToHttpParams(d,"$expand",r,h.l2.Form,!1);let u=this.defaultHeaders;u=this.configuration.addCredentialToHeaders("Application","Authorization",u,"Bearer ");const m=this.configuration.selectHeaderAccept(["application/json"]);void 0!==m&&(u=u.set("Accept",m));let g="json";m&&(g=m.startsWith("text")?"text":this.configuration.isJsonMime(m)?"json":"blob");let C=`/ServicePrincipals(${this.configuration.encodeParam({name:"id",value:i,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})`;const{basePath:f,withCredentials:F}=this.configuration;return this.httpClient.request("get",`${f}${C}`,{params:d.toHttpParams(),responseType:g,...F?{withCredentials:F}:{},headers:u,observe:o})}getServicePrincipalQuery(t,o="body",i=!1,a){const r=t.id;if(null==r)throw new Error("Required parameter id was null or undefined when calling getServicePrincipal.");const d=t.$select,u=t.$expand;let m=new h.rx(this.encoder);return m=this.addToHttpParams(m,"$select",d,h.l2.Form,!1),m=this.addToHttpParams(m,"$expand",u,h.l2.Form,!1),`/ServicePrincipals(${this.configuration.encodeParam({name:"id",value:r,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})?`+m.toString()}listServicePrincipal(t,o="body"){const i=t?.$top,a=t?.$skip,r=t?.$search,d=t?.$filter,u=t?.$count,m=t?.$orderby,g=t?.$select,C=t?.$expand;let f=new h.rx(this.encoder);
1f=this.addToHttpParams(f,"$top",i,h.l2.Form,!1),f=this.addToHttpParams(f,"$skip",a,h.l2.Form,!1),f=this.addToHttpParams(f,"$search",r,h.l2.Form,!1),f=this.addToHttpParams(f,"$filter",d,h.l2.Form,!1),f=this.addToHttpParams(f,"$count",u,h.l2.Form,!1),f=this.addToHttpParams(f,"$orderby",m,h.l2.Form,!1),f=this.addToHttpParams(f,"$select",g,h.l2.Form,!1),f=this.addToHttpParams(f,"$expand",C,h.l2.Form,!1);let F=this.defaultHeaders;F=this.configuration.addCredentialToHeaders("Application","Authorization",F,"Bearer ");const b=this.configuration.selectHeaderAccept(["application/json"]);void 0!==b&&(F=F.set("Accept",b));let H="json";b&&(H=b.startsWith("text")?"text":this.configuration.isJsonMime(b)?"json":"blob");const{basePath:lt,withCredentials:Ie}=this.configuration;return this.httpClient.request("get",`${lt}/ServicePrincipals`,{params:f.toHttpParams(),responseType:H,...Ie?{withCredentials:Ie}:{},headers:F,observe:o})}listServicePrincipalQuery(t,o="body",i=!1,a){const r=t.$top,d=t.$skip,u=t.$search,m=t.$filter,g=t.$count,C=t.$orderby,f=t.$select,F=t.$expand;let b=new h.rx(this.encoder);
1return b=this.addToHttpParams(b,"$top",r,h.l2.Form,!1),b=this.addToHttpParams(b,"$skip",d,h.l2.Form,!1),b=this.addToHttpParams(b,"$search",u,h.l2.Form,!1),b=this.addToHttpParams(b,"$filter",m,h.l2.Form,!1),b=this.addToHttpParams(b,"$count",g,h.l2.Form,!1),b=this.addToHttpParams(b,"$orderby",C,h.l2.Form,!1),b=this.addToHttpParams(b,"$select",f,h.l2.Form,!1),b=this.addToHttpParams(b,"$expand",F,h.l2.Form,!1),"/ServicePrincipals?"+b.toString()}updateServicePrincipal(t,o="body"){const i=t?.id;if(null==i)throw new Error("Required parameter id was null or undefined when calling updateServicePrincipal.");const a=t?.pbxServicePrincipal;let r=this.defaultHeaders;r=this.configuration.addCredentialToHeaders("Application","Authorization",r,"Bearer ");const d=this.configuration.selectHeaderAccept(["application/json"]);void 0!==d&&(r=r.set("Accept",d));const m=this.configuration.selectHeaderContentType(["application/json"]);void 0!==m&&(r=r.set("Content-Type",m));let g="json";d&&(g=d.startsWith("text")?"text":this.configuration.isJsonMime(d)?"json":"blob");let C=`/ServicePrincipals(${this.configuration.encodeParam({name:"id",value:i,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})`;const{basePath:f,withCredentials:F}=this.configuration;return this.httpClient.request("patch",`${f}${C}`,{body:a,responseType:g,...F?{withCredentials:F}:{},headers:r,observe:o})}updateServicePrincipalQuery(t,o="body",i=!1,a){const r=t.id;if(null==r)throw new Error("Required parameter id was null or undefined when calling updateServicePrincipal.");return`/ServicePrincipals(${this.configuration.encodeParam({name:"id",value:r,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})})`}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275prov=s.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ge=p(84360),ts=p(77427);function ns(n,c){1&n&&(e.j41(0,"span",1),e.EFF(1),e.k0s()),2&n&&(e.R7$(),e.SpI("(",c,")"))}function is(n,c){if(1&n&&(e.j41(0,"span"),e.EFF(1),e.nI1(2,"amLocal"),e.nI1(3,"amTodayYesterdayPipe"),e.k0s()),2&n){const t=e.XpG().$implicit;e.R7$(),e.SpI(" ",e.i5U(3,3,e.bMT(2,1,t.LastUsed),"L LT")," ")}}function os(n,c){if(1&n){const t=e.RV6();e.j41(0,"tr",16),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG();return s.Njj(a.routeToServicePrincipalEditor(i))}),e.j41(1,"td",7)(2,"app-checker",17),e.bIt("ngModelChange",function(i){const a=s.eBV(t).$implicit,r=e.XpG();return s.Njj(r.selector.setSelected(a,i))})("checkerClick",function(i){const a=s.eBV(t).$implicit,r=e.XpG();return s.Njj(r.selector.handleCheckerClick(a,i))}),e.k0s()(),e.j41(3,"td",18)(4,"span",19),e.EFF(5),e.k0s(),e.EFF(6,"\xa0 "),e.j41(7,"small",20),e.EFF(8),e.nI1(9,"translate"),e.k0s()(),e.j41(10,"td",21),e.EFF(11),e.nI1(12,"appEclipsedList"),e.k0s(),e.j41(13,"td",22),e.nVh(14,is,4,6,"span"),e.k0s(),e.j41(15,"td",23)(16,"span",24),e.EFF(17),e.k0s()(),e.j41(18,"td",25)(19,"row-action-button")(20,"li",26)(21,"button",27),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG();return s.Njj(a.routeToServicePrincipalEditor(i))}),e.EFF(22),e.nI1(23,"translate"),e.k0s()(),e.j41(24,"li",26)(25,"button",28),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG();return s.Njj(a.deleteAppById(i))}),e.EFF(26),e.nI1(27,"translate"),e.k0s()()()()()}if(2&n){const t=c.$implicit,o=e.XpG();e.R7$(2),e.Y8G("ngModel",o.selector.isRowSelected(t)),e.R7$(3),e.JRh(o.getDisplayName(t)),e.R7$(3),e.SpI("(",e.bMT(9,8,o.getRole(t)),")"),e.R7$(3),e.SpI(" ",e.i5U(12,10,o.getDepartment(t.Groups),4)," "),e.R7$(3),e.vxM(t.LastUsed?14:-1),e.R7$(3),e.SpI(" ",o.getRoutingInfo(t)," "),e.R7$(5),e.SpI(" ",e.bMT(23,13,"_i18n.Edit")," "),e.R7$(4),e.SpI(" ",e.bMT(27,15,"_i18n.Delete")," ")}}function as(n,c){return n.map(t=>({...t,Dids:(0,Oe.O)(c.find(o=>o.Id===t.Id))}))}let rs=(()=>{class n{modalService=(0,s.WQX)(B.B);callFlowAppsApiService=(0,s.WQX)(Ft);route=(0,s.WQX)(S.nX);cd=(0,s.WQX)(_.gRc);callFlowAppsApi=(0,s.WQX)(Ft);defsService=(0,s.WQX)(jt.G);router=(0,s.WQX)(S.Ix);destroy$=(0,s.WQX)(s.abz);pager;data=[];selector;isEnterprise=!1;constructor(){const t=this.modalService,i=this.cd,a=this.destroy$;
1this.isEnterprise=this.route.snapshot.data.isEnterprise,this.selector=new bt.a({cd:i,keySelector:r=>r.Id}),this.pager=new Nt.f(a,this.makeResolver()),this.pager.pagedItems$.pipe((0,R.pQ)(this.destroy$)).subscribe({next:r=>{this.updateItems(r)},error:r=>t.error(r)})}updateItems(t){this.selector.onDataChanged(t.value||[]),this.data=t.value||[],this.cd.markForCheck()}get restrictedModification(){return this.isEnterprise?Y.v.None:Y.v.Enterprise}showAddServicePrincipal(){this.router.navigate(["new"],{relativeTo:this.route}).catch(Ct.l)}routeToServicePrincipalEditor(t){this.router.navigate(["edit",t.Id],{relativeTo:this.route}).catch(Ct.l)}deleteAppById(t){this.delete(t)}delete(t){this.modalService.confirmDeletion(t?"_i18n.DeleteCallFlowAppConfirmation":"_i18n.DeleteCallFlowApps").pipe((0,I.n)(()=>{const o=t?[t.Id]:this.selector.selectedKeys,i=(0,_n.x)(...o.map(a=>this.callFlowAppsApiService.deleteServicePrincipal({id:a}).pipe((0,A.W)(r=>(0,M.of)({}))))).pipe((0,v.T)((a,r)=>r));return this.modalService.progress("_i18n.DeleteAll",o.length,i)})).subscribe({complete:()=>{t?this.selector.resetSingle(t.Id):this.selector.resetAll(),this.pager.refresh$.next()}})}makeResolver(){return{resolveData:(t=1,o=Pe.z9,i="")=>this.callFlowAppsApi.listServicePrincipal({$expand:[`Groups($select=GroupId,Name;${it.n0}$expand=Rights($select=RoleName))`],$filter:"not IsSystem",$count:!0,$orderby:["Number"],$search:(0,_t.Bj)(i),$skip:(t-1)*o,$top:o}).pipe((0,I.n)(a=>{const r=a.value?.map(u=>u.Id)??[],d=0===r.length?(0,M.of)([]):this.defsService.getRoutes({defsGetRoutesRequestBody:{ids:r}}).pipe((0,v.T)(u=>u.value));return(0,M.of)(a).pipe((0,vn.v)(d))}),(0,v.T)(([a,r])=>({value:as(a.value??[],r),totalItems:a["@odata.count"]})))}}getRoutingInfo(t){return t.Dids?.map(o=>(0,Vt.fE)(o.Number,o.DisplayName)).join(", ")}getDepartment(t){return t?.map(o=>o?.Name).filter(z.U)??[]}getDisplayName(t){return t.Number}getRole(t){return(0,ge.aP)(t).Name}identify(t,o){return o.Id}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-service-principals"]],decls:39,vars:33,consts:[["header","_i18n.ServicePrincipals","helpUrl","_i18n.ServicePrincipalGuideUri"],["header-text","",1,"fw-normal"],["top-bar","",1,"button-group"],[3,"click"],["data-qa","delete-service-principal","type","button",1,"btn","btn-primary",3,"click","disabled"],["top-bar","",3,"formControl"],["full-width","",1,"scrollable-table"],[1,"checker"],[3,"ngModelChange","ngModel"],[1,"col-size-300"],[1,"col-size-200","lg-visible"],[1,"w-50"],[1,"actions"],[1,"clickable"],["colspan","6"],[3,"pageChanged","currentPage","itemsPerPage","totalItems","showBoundaryLinks"],[1,"clickable",3,"click"],[3,"ngModelChange","checkerClick","ngModel"],[1,"text-lg-nowrap"],["data-qa","full-name"],["data-qa","max-user-role",1,"d-inline-block"],["data-qa","groups",1,"lg-visible","text-lg-nowrap"],[1,"lg-visible","text-lg-nowrap"],["data-qa","routing"],[1,"line-clamp-1"],["data-qa","actions",1,"actions"],["role","menuitem"],["type","button","data-qa","edit",1,"dropdown-item",3,"click"],["type","button","data-qa","delete",1,"dropdown-item",3,"click"]],template:function(o,i){if(1&o&&(e.j41(0,"app-page",0),e.nVh(1,ns,2,1,"span",1),e.nI1(2,"LicenseRestricted"),e.j41(3,"div",2)(4,"app-button-add",3),e.bIt("click",function(){return i.showAddServicePrincipal()}),e.k0s(),e.j41(5,"button",4),e.bIt("click",function(){return i.delete()}),e.nrm(6,"app-trash-alt-solid-icon"),e.j41(7,"span"),e.EFF(8),e.nI1(9,"translate"),e.k0s()()(),e.nrm(10,"search-bar",5),e.j41(11,"table",6)(12,"thead")(13,"tr")(14,"th",7)(15,"app-checker",8),e.bIt("ngModelChange",function(r){return i.selector.setSelectAll(r)}),e.k0s()(),e.j41(16,"th",9),e.EFF(17),e.nI1(18,"translate"),e.k0s(),e.j41(19,"th",10),e.EFF(20),e.nI1(21,"translate"),e.k0s(),e.j41(22,"th",10),e.EFF(23),e.nI1(24,"translate"),e.k0s(),e.j41(25,"th",11),e.EFF(26),e.nI1(27,"translate"),e.k0s(),e.nrm(28,"th",12),e.k0s()(),e.j41(29,"tbody"),e.Z7z(30,os,28,17,"tr",13,i.identify,!0),e.k0s(),e.j41(32,"tfoot")(33,"tr")(34,"td",14)(35,"app-paging",15),e.nI1(36,"async"),e.nI1(37,"async"),e.nI1(38,"async"),e.bIt("pageChanged",function(r){return i.pager.pageChanged(r)}),e.k0s()()()()()()),2&o){let a;e.R7$(),e.vxM((a=e.i5U(2,14,"",i.restrictedModification))?1:-1,a),e.R7$(4),e.Y8G("disabled",!i.selector.isAnySelected),e.R7$(3),e.Lme("",e.bMT(9,17,"_i18n.Delete"),"",i.selector.selectedCountLabel),e.R7$(2),e.Y8G("formControl",i.pager.search),e.R7$(5),e.Y8G("ngModel",i.selector.isAnySelected),e.R7$(2),e.JRh(e.bMT(18,19,"_i18n.ClientID")),e.R7$(3),e.JRh(e.bMT(21,21,"_i18n.Department")),e.R7$(3),e.JRh(e.bMT(24,23,"_i18n.LastActiveOn")),e.R7$(3),e.JRh(e.bMT(27,25,"_i18n.DIDSTableTitle")),e.R7$(4),e.Dyx(i.data),e.R7$(5),e.Y8G("currentPage",e.bMT(36,27,i.pager.currentPage$))("itemsPerPage",e.bMT(37,29,i.pager.pageSize$))("totalItems",e.bMT(38,31,i.pager.totalCount$))("showBoundaryLinks",!0)}},dependencies:[qe.H,Ce.j,Xe.d,at.L,l.X1,l.BC,l.l_,yt.$,l.YN,l.vS,He.I,Pe.u4,y.D9,N.Jj,wt.h,ts.Y,Y.R,Mn.E],encapsulation:2,changeDetection:0})}return n})();var rt=p(71747),Qe=p(37201),xn=p(65787),ss=p(10567),ls=p(99179);const cs=[[["val-errors"]]],ds=["val-errors"],ps=n=>({minimumCalls:n}
1);function us(n,c){if(1&n&&(e.j41(0,"alert",1)(1,"span"),e.EFF(2),e.nI1(3,"translate"),e.k0s()()),2&n){const t=e.XpG();e.R7$(2),e.JRh(e.i5U(3,1,"_i18n.RequiresSimultaneousCallsWarning",e.eq3(4,ps,t.minNumberOfSimCallsRequired)))}}function ms(n,c){if(1&n){const t=e.RV6();e.j41(0,"button",20),e.bIt("click",function(){s.eBV(t);const i=e.XpG();return s.Njj(i.generateToken())}),e.EFF(1),e.nI1(2,"translate"),e.k0s()}if(2&n){const t=e.XpG();e.Y8G("disabled",!t.isEnterprise),e.R7$(),e.SpI(" ",e.bMT(2,2,"_i18n.GenerateToken")," ")}}function fs(n,c){1&n&&e.SdG(0)}let En=(()=>{class n{fb=(0,s.WQX)(l.Qk);destroy$=(0,s.WQX)(s.abz);route=(0,s.WQX)(S.nX);router=(0,s.WQX)(S.Ix);servicePrinicpalService=(0,s.WQX)(Ft);modalService=(0,s.WQX)(B.B);xapiError=(0,s.WQX)(K.Ko);cd=(0,s.WQX)(_.gRc);minNumberOfSimCallsRequired=8;availableGroups=[];systemAccess=!1;isEnterprise=!1;maxSimultaneousCalls=0;isEditMode=void 0!==this.route.snapshot.params.id;form=this.fb.group({Number:this.fb.control({value:"",disabled:this.isEditMode},{validators:[l.k0.required,l.k0.maxLength(15),V.n0]}),Role:this.fb.control("users"),Dids:this.fb.control([]),Peers:this.fb.control([]),Group:this.fb.control(null),CallControlEnabled:this.fb.control(!1),MyPhoneEnabled:this.fb.control(!1),XAPIEnabled:this.fb.control(!1),Id:this.fb.control(null),Groups:this.fb.control([])});didSelect;allowedRoles;sub=new ft.yU;constructor(){const t=this.destroy$,o=this.route;this.allowedRoles=Qe.YK.filter(i=>i.Id!==Qe.gj&&"system"!==i.Id).map(i=>({value:i.Id,label:i.Name})),this.sub.add((0,T.jA)((0,T.XP)(this.f.CallControlEnabled),[this.f.Dids])),(0,Be.z)([(0,T.XP)(this.f.CallControlEnabled),(0,T.XP)(this.f.MyPhoneEnabled)]).pipe((0,R.pQ)(this.destroy$)).subscribe(([i,a])=>{(0,T.TZ)(this.f.Peers,i||a)}),this.sub.add((0,T.jA)((0,T.XP)(this.f.XAPIEnabled),[this.f.Group])),o.data.pipe((0,R.pQ)(t)).subscribe(i=>{const{callFlowApp:a}=i;this.availableGroups=i.trunksGroups,this.systemAccess=i.groupAccess,this.isEnterprise=i.isEnterprise,this.maxSimultaneousCalls=i.maxSimCalls??0,a&&this.setPrincipal(a)}),this.sub.add((0,Be.z)([(0,T.XP)(this.f.XAPIEnabled),(0,T.XP)(this.f.Group)]).subscribe(([i,a])=>{(0,T.TZ)(this.f.Role,i&&!!a?.Id),i&&!a?.Id&&this.f.Role.patchValue("users")}))}add(){this.modalService.showComponent(ss.N,{initialState:{header:"_i18n.SelectExtensions",initialSelected:this.f.Peers.value??[]}}).pipe((0,x.Sf)()).subscribe({next:t=>{this.f.Peers.setValue(t),this.f.Peers.markAsDirty(),this.cd.markForCheck()},error:t=>this.modalService.error(t)})}ngOnDestroy(){this.sub.unsubscribe()}navigateToList(){return this.router.navigate(["office","integrations","api"])}get f(){return this.form.controls}get showRequiresSimCallsWarning(){return this.isEnterprise&&this.maxSimultaneousCalls<this.minNumberOfSimCallsRequired}save$=()=>{const t=this.form.value,o=t.Group?.Id,i=t.Peers?.map(d=>({Number:d.Number})),a={Number:t.Number,Groups:void 0!==o?[{GroupId:o,Rights:{RoleName:t.Role||"users"}}]:[],Peers:i,XAPIEnabled:t.XAPIEnabled,CallControlEnabled:t.CallControlEnabled,MyPhoneEnabled:t.MyPhoneEnabled};return(this.isEditMode?this.servicePrinicpalService.updateServicePrincipal({id:t.Id,pbxServicePrincipal:a}).pipe((0,x.Pr)("_i18n.ServicePrincipleNotFoundErrorMessage"),(0,v.T)(()=>({id:t.Id,dn:this.f.Number.value}))):this.servicePrinicpalService.createServicePrincipal({pbxServicePrincipal:a}).pipe((0,v.T)(d=>({id:d.Id,dn:t.Number})))).pipe((0,A.W)(d=>400===d.status&&this.xapiError.error(this.cd,d,this.form,!1,!1)?E.w:(0,$e.$)(()=>d))).pipe((0,I.n)(d=>(this.didSelect.save(d.id),this.isEditMode?(0,M.of)(null):this.servicePrinicpalService.generateAppToken({id:d.id}).pipe((0,x.Tg)(this.modalService),(0,P.M)(u=>{this.modalService.showDialog(xn.G,{token:u.value})})))),(0,I.n)(()=>this.navigateToList()))};setPrincipal(t){this.form.setValue({Id:t.Id,Groups:t.Groups??[],Role:(0,ge.aP)(t).Id,Number:t.Number??"",XAPIEnabled:!!t.XAPIEnabled,CallControlEnabled:!!t.CallControlEnabled,MyPhoneEnabled:!!t.MyPhoneEnabled,Group:Ht(t.Groups??[],this.availableGroups),Dids:t.Dids??[],Peers:t.Peers??[]}),this.form.markAsPristine(),this.form.markAsUntouched(),this.cd.markForCheck()}removePeer(t){this.f.Peers.setValue(this.f.Peers.value.filter(o=>o!==t)),this.f.Peers.markAsDirty()}generateToken(){this.servicePrinicpalService.generateAppToken({id:this.form.value.Id}).pipe((0,x.Pr)("_i18n.ServicePrincipleNotFoundTokenErrorMessage"),(0,x.Tg)(this.modalService),(0,R.pQ)(this.destroy$)).subscribe(({value:t})=>{this.modalService.showDialog(xn.G,{token:t})})}PbxPeerType=rt.J;static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["ng-component"]],viewQuery:function(o,i){if(1&o&&e.GBs(ot.K,5),2&o){let a;e.mGM(a=e.lsd())&&(i.didSelect=a.first)}},ngContentSelectors:ds,decls:41,vars:50,consts:[[3,"back","header","isNewEntity","saveDisabledByReason","formGroup","pristine","save$"],["type","info","data-qa","sim-calls-warning"],["data-qa","client-id","label","_i18n.ClientID","placeholder","_i18n.ApplicationName",3,"formControl","maxlength"],[3,"control"],[1,"mb-1",3,"tooltip"],["type","button","data-qa","generate-token",1,"btn","btn-primary",3,"disabled"],["label","_i18n.PrincipalXAPIEnabled","data-qa","enable-access-xapi",3,"formControl"],["label","","data-qa","more-info-link","href","https://www.3cx.com/docs/configuration-rest-api/",1,"dashed_link"],[1,"row"],[1,"col-md-6"],["data-qa","department",3,"formControl","groups","systemAccess"],["label","_i18n.Role","data-qa","role",3,"options","formControl"],["label","_i18n.PrincipalCallControlEnabled","data-qa","enable-access-to-3cx-api",3,"formControl"],["label","","href","https://www.3cx.com/docs/call-control-api/",1,"dashed_link"],["label","_i18n.DidNumberOrNumbers","description","_i18n.DidDescription","data-qa","assigned-did",3,"formControl","dn","showAsterisk","clearable"],["label","_i18n.PrincipalChatEnabled","data-qa","enable-access-to-chat-api",3,"formControl"],["label","_i18n.ApiExtensions","description","_i18n.PrincipalApiExtensionsDescription","data-qa","api-extensions",3,"disabled"],["text","_i18n.SelectExtensions","data-qa","add-member","theme","primary",3,"click","disabled"],[3,"deletePeer","peersControl"],["data-qa","validation",1,"form-control-validation"],["type","button","data-qa","generate-token",1,"btn","btn-primary",3,"click","disabled"]],template:function(o,i){1&o&&(e.NAR(cs),e.j41(0,"edit-panel",0),e.nI1(1,"translate"),e.bIt("back",function(){return i.navigateToList()}),e.nVh(2,us,4,6,"alert",1),e.j41(3,"field-input",2),e.nrm(4,"val-errors",3),e.k0s(),e.j41(5,"span",4),e.nI1(6,"translate"),e.nV
1h(7,ms,3,4,"button",5),e.k0s(),e.j41(8,"fieldset")(9,"legend"),e.EFF(10),e.nI1(11,"translate"),e.k0s(),e.j41(12,"field-checkbox",6)(13,"app-external-link",7),e.EFF(14),e.nI1(15,"translate"),e.k0s()(),e.j41(16,"div",8)(17,"div",9)(18,"app-group-select",10),e.nrm(19,"val-errors",3),e.k0s()(),e.j41(20,"div",9)(21,"field-select",11),e.nrm(22,"val-errors",3),e.k0s()()()(),e.j41(23,"fieldset")(24,"legend"),e.EFF(25),e.nI1(26,"translate"),e.k0s(),e.j41(27,"field-checkbox",12)(28,"app-external-link",13),e.EFF(29),e.nI1(30,"translate"),e.k0s()(),e.j41(31,"app-did-number-select",14),e.nrm(32,"val-errors",3),e.k0s(),e.nrm(33,"field-checkbox",15),e.j41(34,"field-wrapper",16)(35,"app-button-add",17),e.bIt("click",function(){return i.add()}),e.k0s()(),e.nrm(36,"val-errors",3),e.j41(37,"app-peers-table",18),e.bIt("deletePeer",function(r){return i.removePeer(r)}),e.k0s()(),e.j41(38,"div",19),e.nrm(39,"val-errors",3),e.nVh(40,fs,1,0),e.k0s()()),2&o&&(e.Y8G("header",e.mNQ(i.isEditMode?e.bMT(1,38,"_i18n.EditServicePrincipal")+" "+i.f.Number.value:"_i18n.AddServicePrincipal"))("isNewEntity",!i.isEditMode)("saveDisabledByReason",i.isEnterprise?"":"_i18n.AvailableEnt")("formGroup",i.form)("pristine",i.form.pristine)("save$",i.save$),e.R7$(2),e.vxM(i.showRequiresSimCallsWarning?2:-1),e.R7$(),e.Y8G("formControl",i.f.Number)("maxlength",15),e.R7$(),e.Y8G("control",i.f.Number),e.R7$(),e.Y8G("tooltip",e.bMT(6,40,i.isEnterprise?"":"_i18n.AvailableEnt")),e.R7$(2),e.vxM(i.isEditMode?7:-1),e.R7$(3),e.SpI(" ",e.bMT(11,42,"_i18n.ConfigurationAPIAccess")," "),e.R7$(2),e.Y8G("formControl",i.f.XAPIEnabled),e.R7$(2),e.JRh(e.bMT(15,44,"_i18n.MoreInfo")),e.R7$(4),e.Y8G("formControl",i.f.Group)("groups",i.availableGroups)("systemAccess",i.systemAccess),e.R7$(),e.Y8G("control",i.f.Group),e.R7$(2),e.Y8G("options",i.allowedRoles)("formControl",i.f.Role),e.R7$(),e.Y8G("control",i.f.Role),e.R7$(3),e.SpI(" ",e.bMT(26,46,"_i18n.CallControlAndChatAPIAccess")," "),e.R7$(2),e.Y8G("formControl",i.f.CallControlEnabled),e.R7$(2),e.JRh(e.bMT(30,48,"_i18n.MoreInfo")),e.R7$(2),e.Y8G("formControl",i.f.Dids)("dn",i.f.Number.value??null)("showAsterisk",!1)("clearable",!1),e.R7$(),e.Y8G("control",i.f.Dids),e.R7$(),e.Y8G("formControl",i.f.MyPhoneEnabled),e.R7$(),e.Y8G("disabled",i.f.Peers.disabled),e.R7$(),e.Y8G("disabled",i.f.Peers.disabled),e.R7$(),e.Y8G("control",i.f.Peers),e.R7$(),e.Y8G("peersControl",i.f.Peers),e.R7$(2),e.Y8G("control",i.form),e.R7$(),e.vxM(i.form.valid?40:-1))},dependencies:[ne.Q,l.X1,l.BC,l.cb,l.tU,l.l_,l.j4,te.m,$.IH,tt.dg,ie.t,In.x,Z.z,ot.K,Ce.j,ls.j,Ae.Cy,ke.P,Te.q,y.D9],encapsulation:2,changeDetection:0})}return n})();const gs={callFlowApp:n=>{const c=+n.params.id,t=(0,s.WQX)(Ft),o=(0,s.WQX)(Oe.Q),i=(0,s.WQX)(fe.s);return(0,Ee.p)([t.getServicePrincipal({id:c,$expand:[`Groups($select=GroupId,Name,Number;${it.n0}$expand=Rights($select=RoleName))`,"Peers"]}),o.getDids$(c)]).pipe((0,v.T)(([a,r])=>({...a,Dids:r})),(0,A.W)(a=>i.handleError(a)))}};var Qt=p(48072);const hs=[{path:"",component:rs,resolve:{...Ge.T4,isEnterprise:ee.HX}},{path:"new",component:En,resolve:{...Ge.T4,isEnterprise:ee.HX,maxSimCalls:Qt.L}},{path:"edit/:id",component:En,resolve:{...Ge.T4,isEnterprise:ee.HX,...gs,maxSimCalls:Qt.L}}];var Cs=p(22963),bs=p(23375);let wn=(()=>{class n extends ye.d{getDataConnectorSettings(t,o="body"){const i=t?.$select,a=t?.$expand;let r=new h.rx(this.encoder);r=this.addToHttpParams(r,"$select",i,h.l2.Form,!1),r=this.addToHttpParams(r,"$expand",a,h.l2.Form,!1);let d=this.defaultHeaders;d=this.configuration.addCredentialToHeaders("Application","Authorization",d,"Bearer ");const u=this.configuration.selectHeaderAccept(["application/json"]);void 0!==u&&(d=d.set("Accept",u));let m="json";u&&(m=u.startsWith("text")?"text":this.configuration.isJsonMime(u)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("get",`${C}/DataConnectorSettings`,{params:r.toHttpParams(),responseType:m,...f?{withCredentials:f}:{},headers:d,observe:o})}getDataConnectorSettingsQuery(t,o="body",i=!1,a){const r=t.$select,d=t.$expand;let u=new h.rx(this.encoder);return u=this.addToHttpParams(u,"$select",r,h.l2.Form,!1),u=this.addToHttpParams(u,"$expand",d,h.l2.Form,!1),"/DataConnectorSettings?"+u.toString()}synchronize(t="body"){let o=this.defaultHeaders;o=this.configuration.addCredentialToHeaders("Application","Authorization",o,"Bearer ");const i=this.configuration.selectHeaderAccept(["application/json"]);
1void 0!==i&&(o=o.set("Accept",i));let a="json";i&&(a=i.startsWith("text")?"text":this.configuration.isJsonMime(i)?"json":"blob");const{basePath:d,withCredentials:u}=this.configuration;return this.httpClient.request("post",`${d}/DataConnectorSettings/Pbx.Synchronize`,{responseType:a,...u?{withCredentials:u}:{},headers:o,observe:t})}synchronizeQuery(t="body",o=!1,i){return"/DataConnectorSettings/Pbx.Synchronize"}testDataConnector(t="body"){let o=this.defaultHeaders;o=this.configuration.addCredentialToHeaders("Application","Authorization",o,"Bearer ");const i=this.configuration.selectHeaderAccept(["application/json"]);void 0!==i&&(o=o.set("Accept",i));let a="json";i&&(a=i.startsWith("text")?"text":this.configuration.isJsonMime(i)?"json":"blob");const{basePath:d,withCredentials:u}=this.configuration;return this.httpClient.request("post",`${d}/DataConnectorSettings/Pbx.TestDataConnector`,{responseType:a,...u?{withCredentials:u}:{},headers:o,observe:t})}testDataConnectorQuery(t="body",o=!1,i){return"/DataConnectorSettings/Pbx.TestDataConnector"}updateDataConnectorSettings(t,o="body"){const i=t?.pbxDataConnectorSettings;let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("patch",`${C}/DataConnectorSettings`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}updateDataConnectorSettingsQuery(t,o="body",i=!1,a){return"/DataConnectorSettings"}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275prov=s.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();const q={None:"None",Postgre:"Postgre",BigQuery:"BigQuery",MySql:"MySql",SqlServer:"SqlServer"},he={Prefer:"Prefer",Require:"Require",VerifyFull:"VerifyFull"},Le={Password:"Password",CertificateFile:"CertificateFile"};var _s=p(19236),vs=p(72107);const Pn="Google BigQuery",Gn="PostgreSQL",Nn="Microsoft SQL Server",Ss={BigQuery:{description:"_i18n.LearnHowToSetup",link:"_i18n.GoogleBigQueryGuideLink",name:Pn},Postgre:{description:"_i18n.LearnHowToSetup",link:"_i18n.PostgreSqlGuideUri",name:Gn},MySql:{description:"_i18n.LearnHowToSetup",link:"_i18n.MySqlGuideUri",name:"MySQL"},SqlServer:{description:"_i18n.LearnHowToSetup",link:"_i18n.SqlServerGuideUri",name:Nn}},Ts=[{value:q.None,label:"_i18n.None"},{value:q.BigQuery,label:Pn},{value:q.Postgre,label:Gn},{value:q.MySql,label:"MySQL"},{value:q.SqlServer,label:Nn}],ys=[{value:he.Prefer,label:"prefer"},{value:he.Require,label:"require"},{value:he.VerifyFull,label:"verify-full"}],Fs=[{value:Le.Password,label:"_i18n.Password"},{value:Le.CertificateFile,label:"_i18n.Certificate"}];var We=p(23773);const Rs=n=>({name:n}),Is=n=>({minimumCalls:n}),As=(n,c)=>({name:n,link:c});function $s(n,c){1&n&&e.nrm(0,"app-spinner-regular-icon")}function Ms(n,c){1&n&&e.nrm(0,"app-share-solid-icon")}function ks(n,c){if(1&n&&(e.j41(0,"alert",3)(1,"span"),e.EFF(2),e.nI1(3,"translate"),e.k0s()()),2&n){const t=e.XpG();e.R7$(2),e.JRh(e.i5U(3,1,"_i18n.RequiresSimultaneousCallsWarning",e.eq3(4,Is,t.minNumberOfSimCallsRequired)))}}function xs(n,c){if(1&n&&(e.j41(0,"p")(1,"span",24),e.EFF(2),e.nI1(3,"translate"),e.k0s(),e.nrm(4,"span",25),e.nI1(5,"translate"),e.j41(6,"span",24),e.EFF(7),e.nI1(8,"translate"),e.k0s(),e.j41(9,"span",26),e.EFF(10),e.k0s()()),2&n){const t=e.XpG(2);e.R7$(2),e.JRh(e.bMT(3,4,"_i18n.GoogleBigQueryConfiguredAndRunning")),e.R7$(2),e.Y8G("innerHTML",e.i5U(5,6,"_i18n.ClickHereToLoginToAndViewData",e.l_i(11,As,t.engineGuideLink.name??"",t.googleProjectLink)),e.npT),e.R7$(3),e.JRh(e.bMT(8,9,"_i18n.YourProjectIDReferenceIs")),e.R7$(3),e.JRh(t.googleProjectId)}}function Es(n,c){if(1&n&&e.nVh(0,xs,11,14,"p"),2&n){const t=e.XpG();e.vxM(t.isGoogleBigQuerySelectedAndEnabled&&t.googleProjectId?0:-1)}}function ws(n,c){1&n&&(e.j41(0,"alert",36),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&n&&(e.R7$(),e.JRh(e.bMT(2,1,"_i18n.SSLModePreferWarning")))}function Ps(n,c){if(1&n&&(e.j41(0,"field-input-file",37),e.nrm(1,"val-errors",8),e.k0s()),2&n){const t=e.XpG(3);e.Y8G("readContent",!0)("readAsDataUrl",!0)("contentConverter",t.extractBase64Content)("formControl",t.remotePostgreConfigControls.CACertificate),e.R7$(),e.Y8G("control",t.remotePostgreConfigControls.CACertificate)}}function Gs(n,c){if(1&n&&(e.j41(0,"field-select",34),e.nrm(1,"val-errors",8),e.j41(2,"app-external-link",35),e.EFF(3),e.nI1(4,"translate"),e.k0s()(),e.nVh(5,ws,3,3,"alert",36),e.nVh(6,Ps,2,5,"field-input-file",37)),2&n){const t=e.XpG(2);e.Y8G("hideAsterisk",!0)("options",t.serverTrustModeOptions)("description","true")("formControl",t.remotePostgreConfigControls.ServerTrustMode),e.R7$(),e.Y8G("control",t.remotePostgreConfigControls.ServerTrustMode),e.R7$(2),e.SpI(" ",e.bMT(4,8,"_i18n.MoreInfo")," "),e.R7$(2),e.vxM(t.remotePostgreConfigControls.ServerTrustMode.value===t.PbxServerTrustMode.Prefer?5:-1),e.R7$(),e.vxM(t.remotePostgreConfigControls.ServerTrustMode.value===t.PbxServerTrustMode.VerifyFull?6:-1)}}function Ds(n,c){if(1&n&&(e.j41(0,"field-input-file",37),e.nrm(1,"val-errors",8),e.k0s()),2&n){const t=e.XpG(3);e.Y8G("readContent",!0)("readAsDataUrl",!0)("contentConverter",t.extractBase64Content)("formControl",t.remotePostgreConfigControls.CACertificate),e.R7$(),e.Y8G("control",t.remotePostgreConfigControls.CACertificate)}}function Ns(n,c){if(1&n&&(e.nrm(0,"field-checkbox",38),e.nVh(1,Ds,2,5,"field-input-file",37)),2&n){const t=e.XpG(2);e.Y8G("formControl",t.remotePostgreConfigControls.EnableSSLCertificateValidation),e.R7$(),e.vxM(t.remotePostgreConfigControls.EnableSSLCertificateValidation.value?1:-1)}}function js(n,c){if(1&n&&(e.j41(0,"field-input-concealed-password",33),e.nrm(1,"val-errors",8),e.k0s()),2&n){const t=e.XpG(3);e.Y8G("formControl",t.remotePostgreConfigControls.Password),e.R7$(),e.Y8G("control",t.remotePostgreConfigControls.Password)}}function Vs(n,c){if(1&n&&(e.j41(0,"field-input-file",40),e.nrm(1,"val-errors",8),e.k0s(),e.j41(2,"field-input-file",41),e.nrm(3,"val-errors",8),e.k0s()),2&n){const t=e.XpG(3);e.Y8G("readContent",!0)("readAsDataUrl",!0)("contentConverter",t.extractBase64Content)("formControl",t.remotePostgreConfigControls.ClientCertificate),e.R7$(),e.Y8G("control",t.remotePostgreConfigControls.ClientCertificate),e.R7$(),e.Y8G("readContent",!0)("readAsDataUrl",!0)("contentConverter",t.extractBase64Content)("formControl",t.remotePostgreConfigControls.ClientPrivateKey),e.R7$(),e.Y8G("control",t.remotePostgreConfigControls.ClientPrivateKey)}}function Bs(n,c){if(1&n&&(e.j41(0,"field-select",39),e.nrm(1,"val-errors",8),e.k0s(),e.nVh(2,js,2,2,"field-input-concealed-password",33)(3,Vs,4,10)),2&n){let t;const o=e.XpG(2);e.Y8G("hideAsterisk",!0)("options",o.authenticationModeOptions)("formControl",o.remotePostgreConfigControls.AuthenticateMode),e.R7$(),e.Y8G("control",o.remotePostgreConfigControls.AuthenticateMode),e.R7$(),e.vxM((t=o.remotePostgreConfigControls.AuthenticateMode.value)===o.PbxAuthenticateMode.Password?2:t===o.PbxAuthenticateMode.CertificateFile?3:-1)}}function Hs(n,c){if(1&n&&(e.j41(0,"field-input-concealed-password",33),e.nrm(1,"val-errors",8),e.k0s()),2&n){const t=e.XpG(2);e.Y8G("formControl",t.remotePostgreConfigControls.Password),e.R7$(),e.Y8G("control",t.remotePostgreConfigControls.Password)}}function Os(n,c){if(1&n&&(e.qex(0,9),e.nVh(1,Gs,7,10),e.j41(2,"field-input",27),e.nrm(3,"val-errors",28),e.k0s(),e.nVh(4,Ns,2,2),e.j41(5,"field-input-number",29),e.nrm(6,"val-errors",30),e.k0s(),e.j41(7,"field-input",31),e.nrm(8,"val-errors",8),e.k0s(),e.j41(9,"field-input",32),e.nrm(10,"val-errors",8),e.k0s(),e.nVh(11,Bs,4,5)(12,Hs,2,2,"field-input-concealed-password",33),e.nrm(13,"val-errors",8),e.bVm()),2&n){const t=e.XpG();e.Y8G("formGroup",t.f.RemotePostgreConfig),e.R7$(),e.vxM(t.lab()?1:-1),e.R7$(),e.Y8G("formControl",t.remotePostgreConfigControls.Host),e.R7$(),e.Y8G("control",t.remotePostgreConfigControls.Host),e.R7$(),e.vxM(t.lab()?-1:4),e.R7$(),e.Y8G("formControl",t.remotePostgreConfigControls.Port)("min",1024)("max",65535),e.R7$(),e.Y8G("control",t.remotePostgreConfigControls.Port),e.R7$(),e.Y8G("formControl",t.remotePostgreConfigControls.Database),e.R7$(),e.Y8G("control",t.remotePostgreConfigControls.Database),e.R7$(),e.Y8G("formControl",t.remotePostgreConfigControls.Username),e.R7$(),e.Y8G("control",t.remotePostgreConfigControls.Username),e.R7$(),e.vxM(t.lab()?11:12),e.R7$(2),e.Y8G("control",t.f.RemotePostgreConfig)}}function Xs(n,c){if(1&n&&(e.j41(0,"field-input",42),e.nrm(1,"val-errors",28),e.k0s(),e.j41(2,"field-input-number",43),e.nrm(3,"val-errors",30),e.k0s(),e.j41(4,"field-input",44),e.nrm(5,"val-errors",8),e.k0s(),e.j41(6,"field-input",45),e.nrm(7,"val-errors",8),e.k0s(),e.j41(8,"field-input-concealed-password",46),e.nrm(9,"val-errors",8),e.k0s()),2&n){const t=e.XpG();e.Y8G("formControl",t.remoteMySqlConfigControls.Host),e.R7$(),e.Y8G("control",t.remoteMySqlConfigControls.Host),e.R7$(),e.Y8G("formControl",t.remoteMySqlConfigControls.Port)("min",1024)("max",65535),e.R7$(),e.Y8G("control",t.remoteMySqlConfigControls.Port),e.R7$(),e.Y8G("formControl",t.remoteMySqlConfigControls.Database),e.R7$(),e.Y8G("control",t.remoteMySqlConfigControls.Database),e.R7$(),e.Y8G("formControl",t.remoteMySqlConfigControls.UserId),e.R7$(),e.Y8G("control",t.remoteMySqlConfigControls.UserId),e.R7$(),e.Y8G("formControl",t.remoteMySqlConfigControls.Password),e.R7$(),e.Y8G("control",t.remoteMySqlConfigControls.Password)}}function Qs(n,c){if(1&n&&(e.j41(0,"field-input",47),e.nrm(1,"val-errors",28),e.k0s(),e.j41(2,"field-input-number",48),e.nrm(3,"val-errors",30),e.k0s(),e.j41(4,"field-input",49),e.nrm(5,"val-errors",8),e.k0s(),e.j41(6,"field-input",50),e.nrm(7,"val-errors",8),e.k0s(),e.j41(8,"field-input-concealed-password",51),e.nrm(9,"val-errors",8),e.k0s()),2&n){const t=e.XpG();e.Y8G("formControl",t.remoteSqlServerConfigControls.Host),e.R7$(),e.Y8G("control",t.remoteSqlServerConfigControls.Host),e.R7$(),e.Y8G("formControl",t.remoteSqlServerConfigControls.Port)("min",1024)("max",65535),e.R7$(),e.Y8G("control",t.remoteSqlServerConfigControls.Port),e.R7$(),e.Y8G("formControl",t.remoteSqlServerConfigControls.Database),e.R7$(),e.Y8G("control",t.remoteSqlServerConfigControls.Database),e.R7$(),e.Y8G("formControl",t.remoteSqlServerConfigControls.UserId),e.R7$(),e.Y8G("control",t.remoteSqlServerConfigControls.UserId),e.R7$(),e.Y8G("formControl",t.remoteSqlServerConfigControls.Password),e.R7$(),e.Y8G("control",t.remoteSqlServerConfigControls.Password)}}function Ls(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.AtLeastOneDataTypeShouldBeSelectedError"))}function Ws(n,c){1&n&&(e.j41(0,"alert",21)(1,"p"),e.EFF(2),e.nI1(3,"translate"),e.k0s()()),2&n&&(e.R7$(2),e.JRh(e.bMT(3,1,"_i18n.DeleteCDRAfterSuccessfullyTransferredDescription")))}let Ys=(()=>{class n{route=(0,s.WQX)(S.nX);cd=(0,s.WQX)(_.gRc);modalService=(0,s.WQX)(B.B);dataConnectorSettingsApiService=(0,s.WQX)(wn);translate=(0,s.WQX)(y.c$);destroy$=(0,s.WQX)(s.abz);lab=(0,We.D)();isTestingInProgress=!1;isSavingInProgress=!1;minNumberOfSimCallsRequired=16;
1isPaid=this.route.snapshot.data.isPaid??!1;dataConnectorSettings=this.route.snapshot.data.dataConnectorSettings||{};maxSimultaneousCalls=this.dataConnectorSettings?.MaxSimCalls??0;googleProjectId=this.dataConnectorSettings?.ProjectId??"";isGoogleBigQueryEnabled=this.dataConnectorSettings?.IsBigQueryEnabled??!1;dataConnectorOptions=Ts;authenticationModeOptions=Fs;serverTrustModeOptions=ys;dataConnectorGuideLinks=Ss;routeData=this.route.snapshot.data;isGoogleBigQueryAllowedValidator=t=>this.isGoogleBigQueryEnabled||t.value!==q.BigQuery?null:{GoogleBigQueryNotAllowed:!0};atLeastOneDataTypeSelectedValidator=t=>{const o=t,{CallHistory:i,SystemMetrics:a,Recordings:r,AudioMetrics:d}=o.value;return i||a||r||d?null:{atLeastOneDataTypeSelected:!0}};form=this.createForm();get restrictedModification(){return this.isPaid?Y.v.None:Y.v.Paid}get engineGuideLink(){return this.dataConnectorGuideLinks[this.f.OffloadDestination.value]??{link:"",description:""}}get showRequiresSimCallsWarning(){return this.isPaid&&this.maxSimultaneousCalls<this.minNumberOfSimCallsRequired}get showPurgeAfterSyncWarning(){return this.f.PurgeAfterSync.enabled&&this.f.PurgeAfterSync.value}get AreDataConnectorSettingsEnabled(){return this.isPaid&&this.maxSimultaneousCalls>=this.minNumberOfSimCallsRequired}get isGoogleBigQuerySelectedAndEnabled(){return this.f.OffloadDestination.value===q.BigQuery&&this.isGoogleBigQueryEnabled}get isAnyConnectorConfigured(){return this.AreDataConnectorSettingsEnabled&&this.form.pristine&&this.form.valid&&this.f.OffloadDestination.value!==q.None}get isSynchronizationAllowed(){return this.isAnyConnectorConfigured&&!this.isSavingInProgress}get isTestingAllowed(){return this.isAnyConnectorConfigured&&!this.isTestingInProgress&&!this.isSavingInProgress}get googleProjectLink(){return`https://console.cloud.google.com/bigquery?project=${this.googleProjectId}`}ngOnInit(){this.AreDataConnectorSettingsEnabled?((0,Be.z)([(0,T.XP)(this.f.OffloadDestination),(0,T.XP)(this.remotePostgreConfigControls.AuthenticateMode),(0,T.XP)(this.remotePostgreConfigControls.ServerTrustMode)]).pipe((0,R.pQ)(this.destroy$)).subscribe(([t,o,i])=>{this.setBasicFieldsEnabled(t),this.setPostgreFieldsEnabled(t,o,i),this.setMySqlFieldsEnabled(t),this.setSqlServerFieldsEnabled(t)}),(0,T.XP)(this.remotePostgreConfigControls.ServerTrustMode).pipe((0,R.pQ)(this.destroy$)).subscribe(t=>{this.remotePostgreConfigControls.Host.removeValidators([V.w3,V.AG]),this.remotePostgreConfigControls.Host.addValidators(t===he.VerifyFull?V.w3:V.AG),this.remotePostgreConfigControls.Host.markAsTouched(),this.remotePostgreConfigControls.Host.updateValueAndValidity()}),(0,T.XP)(this.remotePostgreConfigControls.EnableSSLCertificateValidation).pipe((0,R.pQ)(this.destroy$)).subscribe(t=>{this.remotePostgreConfigControls.ServerTrustMode.setValue(t?he.VerifyFull:he.Prefer)})):this.form.disable()}setBasicFieldsEnabled(t){const{PurgeAfterSync:o,Schedule:i,DataTypesToOffload:a}=this.f;(0,T.sS)([o,i,a],t&&t!==q.None)}setPostgreFieldsEnabled(t,o,i){const{Host:a,Port:r,Database:d,Username:u,Password:m,EnableSSLCertificateValidation:g,ServerTrustMode:C,AuthenticateMode:f,CACertificate:F,ClientCertificate:b,ClientPrivateKey:H}=this.remotePostgreConfigControls;(0,T.sS)([a,r,d,u,C,f,g],t===q.Postgre),(0,T.sS)([m],t===q.Postgre&&o===Le.Password),(0,T.sS)([b,H],t===q.Postgre&&o===Le.CertificateFile),(0,T.sS)([F],t===q.Postgre&&i===he.VerifyFull)}setMySqlFieldsEnabled(t){const{Host:o,Port:i,Database:a,UserId:r,Password:d}=this.remoteMySqlConfigControls;(0,T.sS)([o,i,a,r,d],t===q.MySql)}setSqlServerFieldsEnabled(t){const{Host:o,Port:i,Database:a,UserId:r,Password:d}=this.remoteSqlServerConfigControls;(0,T.sS)([o,i,a,r,d],t===q.SqlServer)}createForm(){return new l.gE({OffloadDestination:new l.MJ(this.dataConnectorSettings.OffloadDestination??q.None,{nonNullable:!0,validators:[this.isGoogleBigQueryAllowedValidator]}),PurgeAfterSync:new l.MJ(this.dataConnectorSettings.PurgeAfterSync??!1,{nonNullable:!0}),RemotePostgreConfig:new l.gE({EnableSSLCertificateValidation:new l.MJ(this.dataConnectorSettings.RemotePostgreConfig?.ServerTrustMode===he.VerifyFull,{nonNullable:!0}),ServerTrustMode:new l.MJ(this.dataConnectorSettings.RemotePostgreConfig?.ServerTrustMode??he.Prefer,{nonNullable:!0,validators:[l.k0.required]}),Host:new l.MJ(this.dataConnectorSettings.RemotePostgreConfig?.Host??"",{nonNullable:!0,validators:[l.k0.required]}),Port:new l.MJ(this.dataConnectorSettings.RemotePostgreConfig?.Port??5432,{nonNullable:!0,validators:[l.k0.required]}),Database:new l.MJ(this.dataConnectorSettings.RemotePostgreConfig?.Database??"",{nonNullable:!0,validators:[l.k0.required]}),Username:new l.MJ(this.dataConnectorSettings.RemotePostgreConfig?.Username??"",{nonNullable:!0,validators:[l.k0.required]}),AuthenticateMode:new l.MJ(this.dataConnectorSettings.RemotePostgreConfig?.AuthenticateMode??Le.Password,{nonNullable:!0,validators:[l.k0.required]}),Password:new l.MJ({value:this.dataConnectorSettings.RemotePostgreConfig?.Password??{Value:""},disabled:!1},{nonNullable:!0,validators:[l.k0.required]}),CACertificate:new l.MJ((0,J.s)(this.dataConnectorSettings.RemotePostgreConfig?.CACertificate)),ClientCertificate:new l.MJ((0,J.s)(this.dataConnectorSettings.RemotePostgreConfig?.ClientCertificate),l.k0.required),ClientPrivateKey:new l.MJ((0,J.s)(this.dataConnectorSettings.RemotePostgreConfig?.ClientPrivateKey),l.k0.required)}),RemoteMySqlConfig:new l.gE({Host:new l.MJ(this.dataConnectorSettings.RemoteMySqlConfig?.Host??"",{nonNullable:!0,validators:[l.k0.required,V.AG]}),Port:new l.MJ(this.dataConnectorSettings.RemoteMySqlConfig?.Port??3304,{nonNullable:!0,validators:[l.k0.required]}),Database:new l.MJ(this.dataConnectorSettings.RemoteMySqlConfig?.Database??"",{nonNullable:!0,validators:[l.k0.required]}),UserId:new l.MJ(this.dataConnectorSettings.RemoteMySqlConfig?.UserId??"",{nonNullable:!0,validators:[l.k0.required]}),Password:new l.MJ({value:this.dataConnectorSettings.RemoteMySqlConfig?.Password??{Value:""},disabled:!1},{nonNullable:!0,validators:[l.k0.required]})}),RemoteSqlServerConfig:new l.gE({Host:new l.MJ(this.dataConnectorSettings.RemoteSqlServerConfig?.Host??"",{nonNullable:!0,validators:[l.k0.required,V.AG]}),Port:new l.MJ(this.dataConnectorSettings.RemoteSqlServerConfig?.Port??1433,{nonNullable:!0,validators:[l.k0.required]}),Database:new l.MJ(this.dataConnectorSettings.RemoteSqlServerConfig?.Database??"",{nonNullable:!0,validators:[l.k0.required]}),UserId:new l.MJ(this.dataConnectorSettings.RemoteSqlServerConfig?.UserId??"",{nonNullable:!0,validators:[l.k0.required]}),Password:new l.MJ({value:this.dataConnectorSettings.RemoteSqlServerConfig?.Password??{Value:""},disabled:!1},{nonNullable:!0,validators:[l.k0.required]})}),DataTypesToOffload:new l.gE({CallHistory:new l.MJ(this.dataConnectorSettings.DataTypesToOffload?.CallHistory??!1,{nonNullable:!0}),SystemMetrics:new l.MJ(this.dataConnectorSettings.DataTypesToOffload?.SystemMetrics??!1,{nonNullable:!0}),Recordings:new l.MJ(this.dataConnectorSettings.DataTypesToOffload?.Recordings??!1,{nonNullable:!0}),AudioMetrics:new l.MJ(this.dataConnectorSettings.DataTypesToOffload?.AudioMetrics??!1,{nonNullable:!0})},this.atLeastOneDataTypeSelectedValidator),Schedule:new l.MJ(this.dataConnectorSettings.Schedule??{ScheduleType:_s.M.Daily,Day:vs.K.Sunday,Time:"00:00:00"})})}get f(){return this.form.controls}get remotePostgreConfigControls(){return this.f.RemotePostgreConfig.controls}get remoteMySqlConfigControls(){return this.f.RemoteMySqlConfig.controls}get remoteSqlServerConfigControls(){return this.f.RemoteSqlServerConfig.controls}
1get dataTypesToOffloadControls(){return this.f.DataTypesToOffload.controls}save$=()=>{const{RemotePostgreConfig:t,...o}=this.form.value,{ClientCertificate:i,ClientPrivateKey:a,CACertificate:r,EnableSSLCertificateValidation:d,...u}=t??{};return this.isSavingInProgress=!0,this.dataConnectorSettingsApiService.updateDataConnectorSettings({pbxDataConnectorSettings:{...o,RemotePostgreConfig:{...u,CACertificate:null===r?{Name:"",Contents:""}:(0,J.W)(r),ClientCertificate:(0,J.W)(i),ClientPrivateKey:(0,J.W)(a)}}}).pipe((0,Me.j)(()=>{this.isSavingInProgress=!1,this.cd.markForCheck()}))};extractBase64Content=t=>t?t.replace(/^data:(.*,)?/,""):null;onValidation(){this.f.OffloadDestination.value===q.BigQuery&&!this.isGoogleBigQueryEnabled&&this.modalService.warning("_i18n.GoogleBigQueryNotEnabledWarning")}synchronize(){this.isSynchronizationAllowed&&this.modalService.confirmation("_i18n.TransferCDRDataConfirmation","_i18n.TransferCDRDataNow").pipe((0,I.n)(()=>this.dataConnectorSettingsApiService.synchronize()),(0,P.M)(()=>{this.cd.markForCheck()}),(0,x.Tg)(this.modalService)).subscribe()}testDataConnector(){this.isTestingAllowed&&(this.isTestingInProgress=!0,this.dataConnectorSettingsApiService.testDataConnector().pipe((0,Me.j)(()=>{this.isTestingInProgress=!1,this.cd.markForCheck()})).subscribe({next:()=>{this.modalService.information("_i18n.DataConnectorTestSuccessful",{name:this.engineGuideLink.name})},error:t=>{this.modalService.error(t)}}))}PbxDataConnectorType=q;PbxAuthenticateMode=Le;PbxServerTrustMode=he;static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-data-connectors"]],decls:44,vars:48,consts:[["saveDisabledByReasonView","header",3,"showValidation","header","helpUrl","formGroup","save$","saveDisabledByReason"],["buttons","","type","button","data-qa","test-data-connector",1,"btn","btn-primary",3,"click","disabled"],["data-qa","data-connectors"],["type","info","data-qa","data-connector-sim-calls-warning"],[1,"row"],[1,"col-xl-6"],["data-qa","data-connector-type","label","_i18n.SelectDatabase",3,"options","description","formControl"],["description","",3,"href"],[3,"control"],[3,"formGroup"],[3,"disabled"],[3,"translate"],[1,"col-xl-3","col-lg-6"],["data-qa","data-type-call-history","label","_i18n.DataTransferTypeCallHistory","hint","_i18n.DataTransferTypeCallHistoryDescription",3,"formControl"],["data-qa","data-type-system-metrics","label","_i18n.DataTransferTypeSystemMetrics","hint","_i18n.DataTransferTypeSystemMetricsDescription",3,"formControl"],["data-qa","data-type-recordings","label","_i18n.DataTransferTypeRecordingsData","hint","_i18n.DataTransferTypeRecordingsDataDescription",3,"formControl"],["data-qa","data-type-audio-metrics","label","_i18n.DataTransferTypeCallAudioMetrics","hint","_i18n.DataTransferTypeCallAudioMetricsDescription",3,"formControl"],["valError","atLeastOneDataTypeSelected"],["data-qa","scheduled-frequency","label","_i18n.ScheduledFrequency"],["data-qa","scheduler",3,"formControl","enableHourly","enableMinutely","enableMonthly"],["data-qa","delete-cdr-after-success","label","_i18n.DeleteCDRAfterSuccessfullyTransferred",3,"formControl"],["type","warning","data-qa","delete-cdr-after-success-warning"],["data-qa","synchronize","type","button",1,"btn","btn-primary","mb-3",3,"click","disabled"],["app-rotate-regular-icon","",1,"svg-sm"],[1,"me-1"],["data-qa","google-application-link",1,"me-1",3,"innerHTML"],["data-qa","google-application-id-reference",1,"fw-bold"],["label","_i18n.Host","data-qa","postgresql-host",3,"formControl"],["label","_i18n.Host",3,"control"],["data-qa","postgresql-port","label","_i18n.Port",3,"formControl","min","max"],["label","_i18n.Port",3,"control"],["label","_i18n.DatabaseName","data-qa","postgresql-database",3,"formControl"],["label","_i18n.Username","data-qa","postgresql-user",3,"formControl"],["label","_i18n.Password","data-qa","postgresql-password",3,"formControl"],["data-qa","server-ssl-mode","label","_i18n.SSLMode",3,"hideAsterisk","options","description","formControl"],["description","","href","https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-PROTECTION"],["type","info"],["data-qa","root-ca-certificate","label","_i18n.CACertificate","accept",".crt,.pem",3,"readContent","readAsD
1ataUrl","contentConverter","formControl"],["label","_i18n.EnableSSLCertificateValidation","description","_i18n.SSLCertificateValidationDescription",3,"formControl"],["data-qa","authentication-mode","label","_i18n.AuthenticationMode",3,"hideAsterisk","options","formControl"],["data-qa","client-certificate","label","_i18n.ClientCertificate","accept",".crt,.pem",3,"readContent","readAsDataUrl","contentConverter","formControl"],["data-qa","client-certificate","label","_i18n.ClientPrivateKey","accept",".pem",3,"readContent","readAsDataUrl","contentConverter","formControl"],["label","_i18n.Host","data-qa","mysql-host",3,"formControl"],["data-qa","mysql-port","label","_i18n.Port",3,"formControl","min","max"],["label","_i18n.DatabaseName","data-qa","mysql-database",3,"formControl"],["label","_i18n.Username","data-qa","mysql-user",3,"formControl"],["label","_i18n.Password","data-qa","mysql-password",3,"formControl"],["label","_i18n.Host","data-qa","sql-server-host",3,"formControl"],["data-qa","sql-server-port","label","_i18n.Port",3,"formControl","min","max"],["label","_i18n.DatabaseName","data-qa","sql-server-database",3,"formControl"],["label","_i18n.Username","data-qa","sql-server-user",3,"formControl"],["label","_i18n.Password","data-qa","sql-server-password",3,"formControl"]],template:function(o,i){if(1&o&&(e.j41(0,"edit-panel",0),e.nI1(1,"LicenseRestricted"),e.bIt("showValidation",function(){return i.onValidation()}),e.j41(2,"button",1),e.bIt("click",function(){return i.testDataConnector()}),e.nVh(3,$s,1,0,"app-spinner-regular-icon")(4,Ms,1,0,"app-share-solid-icon"),e.j41(5,"span"),e.EFF(6),e.nI1(7,"translate"),e.k0s()(),e.j41(8,"fieldset",2),e.nVh(9,ks,4,6,"alert",3),e.j41(10,"div",4)(11,"div",5)(12,"field-select",6)(13,"app-external-link",7),e.nI1(14,"translate"),e.EFF(15),e.nI1(16,"translate"),e.k0s(),e.nrm(17,"val-errors",8),e.k0s(),e.nVh(18,Es,1,1)(19,Os,14,15,"ng-container",9)(20,Xs,10,12)(21,Qs,10,12),e.k0s()()(),e.j41(22,"fieldset",10),e.nrm(23,"legend",11),e.j41(24,"div",4)(25,"div",12),e.nrm(26,"field-checkbox",13)(27,"field-checkbox",14),e.k0s(),e.j41(28,"div",12),e.nrm(29,"field-checkbox",15)(30,"field-checkbox",16),e.k0s()(),e.j41(31,"val-errors",8),e.DNE(32,Ls,2,3,"ng-template",17),e.k0s()(),e.j41(33,"fieldset",10),e.nrm(34,"legend",11),e.j41(35,"field-wrapper",18),e.nrm(36,"app-schedule",19)(37,"val-errors",8),e.k0s(),e.nrm(38,"field-checkbox",20),e.nVh(39,Ws,4,3,"alert",21),e.j41(40,"button",22),e.bIt("click",function(){return i.synchronize()}),e.nrm(41,"span",23),e.EFF(42),e.nI1(43,"translate"),e.k0s()()()),2&o){let a;e.Y8G("header",i.routeData.navTitle)("helpUrl",i.routeData.helpUri)("formGroup",i.form)("save$",i.save$)("saveDisabledByReason",e.i5U(1,34,"",i.restrictedModification)),e.R7$(2),e.Y8G("disabled",!i.isTestingAllowed),e.R7$(),e.vxM(i.isTestingInProgress?3:4),e.R7$(3),e.JRh(e.bMT(7,37,"_i18n.CrmTestButton")),e.R7$(3),e.vxM(i.showRequiresSimCallsWarning?9:-1),e.R7$(3),e.Y8G("options",i.dataConnectorOptions)("description",i.engineGuideLink.link?"true":"")("formControl",i.f.OffloadDestination),e.R7$(),e.Y8G("href",e.bMT(14,39,i.engineGuideLink.link)),e.R7$(2),e.SpI(" ",e.i5U(16,41,i.engineGuideLink.description,e.eq3(46,Rs,i.engineGuideLink.name??""))," "),e.R7$(2),e.Y8G("control",i.f.OffloadDestination),e.R7$(),e.vxM((a=i.f.OffloadDestination.value)===i.PbxDataConnectorType.BigQuery?18:a===i.PbxDataConnectorType.Postgre?19:a===i.PbxDataConnectorType.MySql?20:a===i.PbxDataConnectorType.SqlServer?21:-1),e.R7$(4),e.Y8G("disabled",!i.AreDataConnectorSettingsEnabled),e.R7$(),e.Y8G("translate","_i18n.SelectDataTypesToBeTransferred"),e.R7$(3),e.Y8G("formControl",i.dataTypesToOffloadControls.CallHistory),e.R7$(),e.Y8G("formControl",i.dataTypesToOffloadControls.SystemMetrics),e.R7$(2),e.Y8G("formControl",i.dataTypesToOffloadControls.Recordings),e.R7$(),e.Y8G("formControl",i.dataTypesToOffloadControls.AudioMetrics),e.R7$(),e.Y8G("control",i.form.controls.DataTypesToOffload),e.R7$(2),e.Y8G("disabled",!i.AreDataConnectorSettingsEnabled),e.R7$(),e.Y8G("translate","_i18n.ScheduleOptions"),e.R7$(2),e.Y8G("formControl",i.f.Schedule)("enableHourly",!0)("enableMinutely",!0)("enableMonthly",!0),e.R7$(),e.Y8G("control",i.f.Schedule),e.R7$(),e.Y8G("formControl",i.f.PurgeAfterSync),e.R7$(),e.vxM(i.showPurgeAfterSyncWarning?39:-1),e.R7$(),e.Y8G("disabled",!i.isSynchronizationAllowed),e.R7$(2),e.SpI(" ",e.bMT(43,44,"_i18n.TransferCDRDataNow")," ")}}
1,dependencies:[ne.Q,l.X1,l.BC,l.cb,l.l_,l.j4,Te.q,ke.P,$.IH,y.Mm,Ae.Cy,bs.b,Cs.I,te.m,mt.B,Z.z,ie.t,Ue.p,dt.f,je.a,gt.y,$.VI,y.D9,Y.R],encapsulation:2,changeDetection:0})}return n})();var Js=p(97469),jn=p(83421),Vn=p(56197);let Us=(()=>{class n{static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-book-regular-icon"],["","app-book-regular-icon",""]],decls:2,vars:0,consts:[["xmlns","http://www.w3.org/2000/svg","viewBox","0 0 448 512"],["fill","currentColor","d","M88 0C39.4 0 0 39.4 0 88L0 432c0 44.2 35.8 80 80 80l344 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-8 0 0-76.1C435.3 375 448 353 448 328l0-256c0-39.8-32.2-72-72-72L88 0zM368 400l0 64-288 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l288 0zM80 352c-11.4 0-22.2 2.4-32 6.7L48 88c0-22.1 17.9-40 40-40l288 0c13.3 0 24 10.7 24 24l0 256c0 13.3-10.7 24-24 24L80 352zm48-200c0 13.3 10.7 24 24 24l176 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-176 0c-13.3 0-24 10.7-24 24zm24 72c-13.3 0-24 10.7-24 24s10.7 24 24 24l176 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-176 0z"]],template:function(o,i){1&o&&(s.qSk(),e.rj2(0,"svg",0),e.Hgh(1,"path",1),e.eux())},encapsulation:2})}return n})();var Ye=p(95847),Bn=p(42610),zs=p(12426);function Ks(n,c){return n.map(t=>{const o=c.find(i=>i.Id===t.Id);return{...t,Dids:o?.Routes?.filter(i=>(0,z.U)(i.DID)).map(i=>(0,Vt.fE)(i.DID,i.DisplayName))}})}let Zs=(()=>{class n{usersApiService=(0,s.WQX)(Ye.u);defsService=(0,s.WQX)(jt.G);localStorageService=(0,s.WQX)(zs.sj);getStoredPageSize(){const t=this.localStorageService.retrieve(Bn.Hh.UsersPageSize);return t?+t:Pe.z9}setStoredPageSize(t){this.localStorageService.store(Bn.Hh.UsersPageSize,t)}filterByGroupId=null;get filter(){return"AIAgent and not startsWith(Number,'HD')"+(this.filterByGroupId?` and Groups/any(group:group/GroupId eq ${this.filterByGroupId})`:"")}resolveData(t,o,i){return this.usersApiService.listUser({$orderby:["Number"],$count:!0,$filter:this.filter,$search:(0,_t.Bj)(i),$select:["IsRegistered","CurrentProfileName","DisplayName","Id","Number","AgentSettings","AIAgent"],$expand:[`Groups($select=GroupId,Name,Rights;${it.n0}$expand=Rights($select=RoleName))`],$skip:(t-1)*o,$top:o}).pipe((0,I.n)(a=>{const r=a.value?.map(u=>u.Id)??[];return(0===r.length?(0,M.of)([]):this.defsService.getRoutes({defsGetRoutesRequestBody:{ids:r}}).pipe((0,v.T)(u=>u.value))).pipe((0,v.T)(u=>({value:Ks(a.value||[],u),totalItems:a["@odata.count"]})))}))}static \u0275fac=function(o){return new(o||n)};static \u0275prov=s.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var el=p(44051),tl=p(42974),nl=p(47735),il=p(51432),ol=p(81789);let de=(()=>{class n extends ye.d{addVectorStoreFiles(t,o="body"){const i=t?.aISettingsAddVectorStoreFilesRequestBody;if(null==i)throw new Error("Required parameter aISettingsAddVectorStoreFilesRequestBody was null or undefined when calling addVectorStoreFiles.");let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("post",`${C}/AISettings/Pbx.AddVectorStoreFiles`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}addVectorStoreFilesQuery(t,o="body",i=!1,a){if(null==t.aISettingsAddVectorStoreFilesRequestBody)throw new Error("Required parameter aISettingsAddVectorStoreFilesRequestBody was null or undefined when calling addVectorStoreFiles.");return"/AISettings/Pbx.AddVectorStoreFiles"}createVectorStore(t,o="body"){const i=t?.aISettingsCreateVectorStoreRequestBody;if(null==i)throw new Error("Required parameter aISettingsCreateVectorStoreRequestBody was null or undefined when calling createVectorStore.");let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;
1return this.httpClient.request("post",`${C}/AISettings/Pbx.CreateVectorStore`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}createVectorStoreQuery(t,o="body",i=!1,a){if(null==t.aISettingsCreateVectorStoreRequestBody)throw new Error("Required parameter aISettingsCreateVectorStoreRequestBody was null or undefined when calling createVectorStore.");return"/AISettings/Pbx.CreateVectorStore"}deleteOpenAiFile(t,o="body"){const i=t?.aISettingsDeleteOpenAiFileRequestBody;let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("post",`${C}/AISettings/Pbx.DeleteOpenAiFile`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}deleteOpenAiFileQuery(t,o="body",i=!1,a){return"/AISettings/Pbx.DeleteOpenAiFile"}deleteVectorStore(t,o="body"){const i=t?.aISettingsDeleteVectorStoreRequestBody;let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("post",`${C}/AISettings/Pbx.DeleteVectorStore`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}deleteVectorStoreQuery(t,o="body",i=!1,a){return"/AISettings/Pbx.DeleteVectorStore"}deleteVectorStoreFile(t,o="body"){const i=t?.aISettingsDeleteVectorStoreFileRequestBody;let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("post",`${C}/AISettings/Pbx.DeleteVectorStoreFile`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}deleteVectorStoreFileQuery(t,o="body",i=!1,a){return"/AISettings/Pbx.DeleteVectorStoreFile"}getAIResources(t="body"){let o=this.defaultHeaders;o=this.configuration.addCredentialToHeaders("Application","Authorization",o,"Bearer ");const i=this.configuration.selectHeaderAccept(["application/json"]);void 0!==i&&(o=o.set("Accept",i));let a="json";i&&(a=i.startsWith("text")?"text":this.configuration.isJsonMime(i)?"json":"blob");const{basePath:d,withCredentials:u}=this.configuration;return this.httpClient.request("get",`${d}/AISettings/Pbx.GetAIResources()`,{responseType:a,...u?{withCredentials:u}:{},headers:o,observe:t})}getAIResourcesQuery(t="body",o=!1,i){return"/AISettings/Pbx.GetAIResources()"}getAISettings(t,o="body"){const i=t?.$select,a=t?.$expand;let r=new h.rx(this.encoder);r=this.addToHttpParams(r,"$select",i,h.l2.Form,!1),r=this.addToHttpParams(r,"$expand",a,h.l2.Form,!1);let d=this.defaultHeaders;d=this.configuration.addCredentialToHeaders("Application","Authorization",d,"Bearer ");const u=this.configuration.selectHeaderAccept(["application/json"]);void 0!==u&&(d=d.set("Accept",u));let m="json";u&&(m=u.startsWith("text")?"text":this.configuration.isJsonMime(u)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("get",`${C}/AISettings`,{params:r.toHttpParams(),responseType:m,...f?{withCredentials:f}:{},headers:d,observe:o})}getAISettingsQuery(t,o="body",i=!1,a){const r=t.$select,d=t.$expand;let u=new h.rx(this.encoder);return u=this.addToHttpParams(u,"$select",r,h.l2.Form,!1),u=this.addToHttpParams(u,"$expand",d,h.l2.Form,!1),"/AISettings?"+u.toString()}getAITemplateContents(t,o="body"){const i=t?.id;if(null==i)throw new Error("Required parameter id was null or undefined when calling getAITemplateContents.");let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));let d="json";r&&(d=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");let u=`/AISettings/Pbx.GetAITemplateContents(id=${this.configuration.encodeParam({name:"id",value:i,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})})`;const{basePath:m,withCredentials:g}=this.configuration;return this.httpClient.request("get",`${m}${u}`,{responseType:d,...g?{withCredentials:g}:{},headers:a,observe:o})}getAITemplateContentsQuery(t,o="body",i=!1,a){const r=t.id;if(null==r)throw new Error("Required parameter id was null or undefined when calling getAITemplateContents.");return`/AISettings/Pbx.GetAITemplateContents(id=${this.configuration.encodeParam({name:"id",value:r,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})})`}getVectorStore(t,o="body"){const i=t?.id;if(null==i)throw new Error("Required parameter id was null or undefined when calling getVectorStore.");let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));let d="json";r&&(d=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");let u=`/AISettings/Pbx.GetVectorStore(id=${this.configuration.encodeParam({name:"id",value:i,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})})`;const{basePath:m,withCredentials:g}=this.configuration;return this.httpClient.request("get",`${m}${u}`,{responseType:d,...g?{withCredentials:g}:{},headers:a,observe:o})}getVectorStoreQuery(t,o="body",i=!1,a){const r=t.id;if(null==r)throw new Error("Required parameter id was null or undefined when calling getVectorStore.");return`/AISettings/Pbx.GetVectorStore(id=${this.configuration.encodeParam({name:"id",value:r,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})})`}getVectorStoreFiles(t,o="body"){const i=t?.id;if(null==i)throw new Error("Required parameter id was null or undefined when calling getVectorStoreFiles.");const a=t?.limit;if(null==a)throw new Error("Required parameter limit was null or undefined when calling getVectorStoreFiles.");const r=t?.after;if(null==r)throw new Error("Required parameter after was null or undefined when calling getVectorStoreFiles.");let d=this.defaultHeaders;d=this.configuration.addCredentialToHeaders("Application","Authorization",d,"Bearer ");const u=this.configuration.selectHeaderAccept(["application/json"]);void 0!==u&&(d=d.set("Accept",u));let m="json";u&&(m=u.startsWith("text")?"text":this.configuration.isJsonMime(u)?"json":"blob");let g=`/AISettings/Pbx.GetVectorStoreFiles(id=${this.configuration.encodeParam({name:"id",value:i,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})},limit=${this.configuration.encodeParam({name:"limit",value:a,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})},after=${this.configuration.encodeParam({name:"after",value:r,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})})`;const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("get",`${C}${g}`,{responseType:m,...f?{withCredentials:f}:{},headers:d,observe:o})}getVectorStoreFilesQuery(t,o="body",i=!1,a){const r=t.id;if(null==r)throw new Error("Required parameter id was null or undefined when calling getVectorStoreFiles.");const d=t.limit;if(null==d)throw new Error("Required parameter limit was null or undefined when calling getVectorStoreFiles.");const u=t.after;if(null==u)throw new Error("Required parameter after was null or undefined when calling getVectorStoreFiles.");return`/AISettings/Pbx.GetVectorStoreFiles(id=${this.configuration.encodeParam({name:"id",value:r,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})},limit=${this.configuration.encodeParam({name:"limit",value:d,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})},after=${this.configuration.encodeParam({name:"after",value:u,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})})`}getVectorStores(t,o="body"){const i=t?.limit;if(null==i)throw new Error("Required parameter limit was null or undefined when calling getVectorStores.");const a=t?.after;if(null==a)throw new Error("Required parameter after was null or undefined when calling getVectorStores.");let r=this.defaultHeaders;r=this.configuration.addCredentialToHeaders("Application","Authorization",r,"Bearer ");const d=this.configuration.selectHeaderAccept(["application/json"]);void 0!==d&&(r=r.set("Accept",d));let u="json";d&&(u=d.startsWith("text")?"text":this.configuration.isJsonMime(d)?"json":"blob");let m=`/AISettings/Pbx.GetVectorStores(limit=${this.configuration.encodeParam({name:"limit",value:i,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})},after=${this.configuration.encodeParam({name:"after",value:a,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})})`;const{basePath:g,withCredentials:C}=this.configuration;return this.httpClient.request("get",`${g}${m}`,{responseType:u,...C?{withCredentials:C}:{},headers:r,observe:o})}getVectorStoresQuery(t,o="body",i=!1,a){const r=t.limit;if(null==r)throw new Error("Required parameter limit was null or undefined when calling getVectorStores.");const d=t.after;if(null==d)throw new Error("Required parameter after was null or undefined when calling getVectorStores.");return`/AISettings/Pbx.GetVectorStores(limit=${this.configuration.encodeParam({name:"limit",value:r,in:"path",style:"simple",explode:!1,dataType:"number",dataFormat:"int32"})},after=${this.configuration.encodeParam({name:"after",value:d,in:"path",style:"simple",explode:!1,dataType:"string",dataFormat:void 0})})`}updateAISettings(t,o="body"){const i=t?.pbxAISettings;let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("patch",`${C}/AISettings`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}updateAISettingsQuery(t,o="body",i=!1,a){return"/AISettings"}updateVectorStore(t,o="body"){const i=t?.aISettingsUpdateVectorStoreRequestBody;if(null==i)throw new Error("Required parameter aISettingsUpdateVectorStoreRequestBody was null or undefined when calling updateVectorStore.");let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;
1return this.httpClient.request("post",`${C}/AISettings/Pbx.UpdateVectorStore`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}updateVectorStoreQuery(t,o="body",i=!1,a){if(null==t.aISettingsUpdateVectorStoreRequestBody)throw new Error("Required parameter aISettingsUpdateVectorStoreRequestBody was null or undefined when calling updateVectorStore.");return"/AISettings/Pbx.UpdateVectorStore"}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275prov=s.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Hn=p(41479),al=p(65310);function Rt(n){return"personalassistant"===n.AgentSettings?.AgentType}function Lt(n,c){const t=new l.gE({instructions:new l.MJ(n?.Instructions),action:new l.MJ(n?.Action)});return c||t.disable(),t}function Wt(n){return n?{Action:n.action,Instructions:n.instructions??void 0}:void 0}function cl(n){const c=Rt(n),t=n.AgentSettings;return new l.gE({knowledgeBase:new l.MJ(t.Knowledgebase,{nonNullable:!0}),phonebookOverride:new l.MJ({value:t.PhonebookOverride,disabled:!c},{validators:l.k0.required}),enablePhonebookOverride:new l.MJ(!!t.PhonebookOverride),allowedExtensions:new l.MJ(t.AllowedExtensions),firstMessage:new l.MJ(t.FirstMessage,{validators:[l.k0.maxLength(300)]}),language:new l.MJ(t.Language),switchLanguage:new l.MJ(t.SwitchLanguage),systemPrompt:new l.MJ(t.SystemPrompt,{validators:[l.k0.maxLength(1e5)]}),voice:new l.MJ(t.Voice),type:new l.MJ(t.AgentType),extensionPrompts:new l.MJ(t.RoutingDirectory,{nonNullable:!0,validators:[V.Xi,(0,V.FX)(50)]}),spamAction:new l.MJ(t.SpamAction),spamInstructions:new l.MJ(t.SpamInstructions,{validators:[l.k0.maxLength(700)]}),enableNameMatching:new l.MJ(t.EnableNameMatching),abusiveCallerAction:new l.MJ(t.AbusiveCallerAction),callerDoesNotRespondAction:new l.MJ(t.CallerDoesNotRespondAction),checkStatusBeforeTransfer:new l.MJ(t.CheckStatusBeforeTransfer),maxCallDuration:new l.MJ(t.MaxCallDuration?Math.round(t.MaxCallDuration/60):null,{validators:[l.k0.required,l.k0.min(1),l.k0.max(60)]}),bossInterruptionSettings:new l.gE({interrupt:Lt(t.BossInterruptionSettings?.Interrupt,c),notify:Lt(t.BossInterruptionSettings?.Notify,c),block:Lt(t.BossInterruptionSettings?.Block,c)})})}function pl(n,c=!1){if(n)return{BossInterruptionSettings:n.bossInterruptionSettings?{Interrupt:Wt(n.bossInterruptionSettings?.interrupt),Notify:Wt(n.bossInterruptionSettings?.notify),Block:Wt(n.bossInterruptionSettings?.block)}:void 0,PhonebookOverride:n.phonebookOverride??{Number:""},AllowedExtensions:n.allowedExtensions,Language:n.language,SystemPrompt:c?n.systemPrompt:"",FirstMessage:n.firstMessage,Voice:n.voice,AgentType:n.type,RoutingDirectory:n.extensionPrompts,SpamAction:n.spamAction,SpamInstructions:n.spamInstructions,EnableNameMatching:n.enableNameMatching,AbusiveCallerAction:n.abusiveCallerAction,CallerDoesNotRespondAction:n.callerDoesNotRespondAction,CheckStatusBeforeTransfer:n.checkStatusBeforeTransfer,MaxCallDuration:n.maxCallDuration?60*n.maxCallDuration:null,SwitchLanguage:n.switchLanguage,Knowledgebase:n.knowledgeBase}}function Xn(n,c){return{MaxCallDuration:420,AgentType:n,FirstMessage:c??"",Voice:"alloy",Language:"English",SwitchLanguage:!1,Knowledgebase:[],SpamAction:{Action:"endcall"},RoutingDirectory:[],AllowedExtensions:"",CheckStatusBeforeTransfer:!0,EnableNameMatching:!0,AbusiveCallerAction:{Action:"endcall"},CallerDoesNotRespondAction:{Action:"endcall"},SpamInstructions:"Telemarketing calls, robocalls, scam callers, suspicious callers asking for payments, login details, or remote access.",BossInterruptionSettings:{Interrupt:{Action:"approval",Instructions:""},Block:{Action:"end",Instructions:""},Notify:{Action:"chat"}}}}function gl(n,c,t){const o=t.voiceSetting?{Voice:c.Voice,MaxCallDuration:c.MaxCallDuration}:void 0,i=t.agentType?{SwitchLanguage:c.SwitchLanguage,Knowledgebase:c.Knowledgebase,Language:c.Language,FirstMessage:c.FirstMessage}:void 0,a=t.agentInstructions?{SystemPrompt:c.SystemPrompt}:void 0,r=t.spamCallsSettings?{SpamAction:c.SpamAction,SpamInstructions:c.SpamInstructions}:void 0,d=t.callScreening?{EnableNameMatching:c.EnableNameMatching,AllowedExtensions:c.AllowedExtensions,RoutingDirectory:c.RoutingDirectory,BossInterruptionSettings:c.BossInterruptionSettings}:void 0,u=t.agentOptions?{CheckStatusBeforeTransfer:c.CheckStatusBeforeTransfer,AbusiveCallerAction:c.AbusiveCallerAction,CallerDoesNotRespondAction:c.CallerDoesNotRespondAction}:void 0;return{...Xn(c.AgentType,n.Templates?.find(m=>m.Id===c.AgentType)?.FirstMessage),PhonebookOverride:c.PhonebookOverride,...o,...i,...a,...r,...d,...u}}function Cl(n,c){1&n&&(e.j41(0,"p",1),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&n&&(e.R7$(),e.JRh(e.bMT(2,1,"_i18n.MaxAmountOfUsersReached")))}function bl(n,c){if(1&n&&(e.j41(0,"div",2)(1,"fieldset",3)(2,"legend"),e.EFF(3),e.nI1(4,"translate"),e.k0s(),e.j41(5,"field-input",4),e.nrm(6,"val-errors",5),e.k0s(),e.j41(7,"div",6)(8,"field-input",7),e.nrm(9,"val-errors",8),e.k0s(),e.j41(10,"field-input",9),e.nrm(11,"val-errors",10),e.k0s()()(),e.j41(12,"fieldset",11)(13,"legend"),e.EFF(14),e.nI1(15,"translate"),e.k0s(),e.nrm(16,"field-checkbox",12),e.nI1(17,"translate"),e.nrm(18,"field-checkbox",13),e.nI1(19,"translate"),e.nrm(20,"field-checkbox",14),e.nI1(21,"translate"),e.nrm(22,"field-checkbox",15)(23,"field-checkbox",16),e.nI1(24,"translate"),e.nrm(25,"field-checkbox",17),e.nI1(26,"translate"),e.nrm(27,"field-checkbox",18),e.nI1(28,"translate"),e.k0s()()),2&n){const t=e.XpG();e.Y8G("formGroup",t.form),e.R7$(3),e.JRh(e.bMT(4,18,"_i18n.EnterAgentDetails")),e.R7$(5),e.Y8G("maxlength",50),e.R7$(2),e.Y8G("maxlength",50),e.R7$(4),e.JRh(e.bMT(15,20,"_i18n.SelectWhatToCopy")),e.R7$(2),e.Y8G("label",e.mNQ(e.bMT(17,22,"_i18n.RecordingSettings"))),e.R7$(2),e.Y8G("label",e.mNQ(e.bMT(19,24,"_i18n.VoiceSetting"))),e.R7$(2),e.Y8G("label",e.mNQ(e.bMT(21,26,"_i18n.AgentTypeSettings"))),e.R7$(2),e.Y8G("label",t.isPersonalAssistant?"_i18n.CallScreeningSettingsLabel":"_i18n.CallRouting"),e.R7$(),e.Y8G("label",e.mNQ(e.bMT(24,28,"_i18n.SpamCallsSett
1ings"))),e.R7$(2),e.Y8G("label",e.mNQ(e.bMT(26,30,"_i18n.Options"))),e.R7$(2),e.Y8G("label",e.mNQ(e.bMT(28,32,"_i18n.AgentInstructionsSettings")))}}let _l=(()=>{class n extends k.m{cd=(0,s.WQX)(_.gRc);usersApi=(0,s.WQX)(Ye.u);aiSettingsApiService=(0,s.WQX)(de);xapiError=(0,s.WQX)(K.Ko);createdAgent;agentToCopy={};nextAvailableNumber;params;isPersonalAssistant=!1;lab=(0,We.D)();form=new l.gE({agent:new l.gE({number:new l.MJ(""),firstName:new l.MJ(""),lastName:new l.MJ("")},Hn.l),copy:new l.gE({recordings:new l.MJ(!1,{nonNullable:!0}),voiceSetting:new l.MJ(!1,{nonNullable:!0}),agentType:new l.MJ(!1,{nonNullable:!0}),agentInstructions:new l.MJ(!1,{nonNullable:!0}),spamCallsSettings:new l.MJ(!1,{nonNullable:!0}),callScreening:new l.MJ(!1,{nonNullable:!0}),agentOptions:new l.MJ(!1,{nonNullable:!0})})});get f(){return this.form.controls}ngOnInit(){this.form.patchValue({agent:{number:this.nextAvailableNumber}})}submit$=()=>{const{copy:t,agent:o}=this.form.value;return(0,Ee.p)([this.usersApi.getUser({$expand:["AgentSettings/PhonebookOverride,Groups($expand=Rights)"],id:this.agentToCopy.Id}),this.aiSettingsApiService.getAIResources()]).pipe((0,v.T)(([a,r])=>function hl(n,c,t){const{overrides:o}=c;return Object.fromEntries(Object.entries({AIAgent:!0,Enable2FA:!1,Require2FA:!1,SendEmailMissedCalls:!1,CallUsEnableChat:!0,AllowOwnRecordings:!1,Internal:!0,VMEnabled:!1,BlockTunnel:!0,GoogleContactsEnabled:!1,GoogleCalendarEnabled:!1,MS365ContactsEnabled:!1,MS365CalendarEnabled:!1,MS365SignInEnabled:!1,MS365TeamsEnabled:!1,GoogleSignInEnabled:!1,PinProtectTimeout:60,PbxDeliversAudio:!0,Hours:{Type:"AllHours"},BreakTime:{Type:"AllHours"},CallUsRequirement:"Both",CallUsEnablePhone:!0,CallUsEnableVideo:!1,AllowLanOnly:!0,ForwardingProfiles:[{Name:"Away",CustomName:"",CustomMessage:"",BlockPushCalls:!1,RingMyMobile:!1,AcceptMultipleCalls:!0,OfficeHoursAutoQueueLogOut:!0,DisableRingGroupCalls:!0,NoAnswerTimeout:20,AvailableRoute:null,AwayRoute:{AllHoursInternal:!0,AllHoursExternal:!0,External:{External:"",To:"None",Number:"",Tags:[]},Internal:{External:"",To:"None",Number:"",Tags:[]}}},{Name:"Out of office",CustomName:"",CustomMessage:"",BlockPushCalls:!1,RingMyMobile:!1,AcceptMultipleCalls:!0,OfficeHoursAutoQueueLogOut:!1,DisableRingGroupCalls:!1,NoAnswerTimeout:20,AvailableRoute:null,AwayRoute:{AllHoursInternal:!0,AllHoursExternal:!0,External:{External:"",To:"None",Number:"",Tags:[]},Internal:{External:"",To:"None",Number:"",Tags:[]}}},{Name:"Custom 1",CustomName:"",CustomMessage:"",BlockPushCalls:!1,RingMyMobile:!1,AcceptMultipleCalls:!0,OfficeHoursAutoQueueLogOut:!1,DisableRingGroupCalls:!1,NoAnswerTimeout:20,AvailableRoute:{NoAnswerAllCalls:!1,BusyAllCalls:!1,NotRegisteredAllCalls:!1,NoAnswerInternal:{External:"",To:"None",Number:"",Tags:[]},NoAnswerExternal:{External:"",To:"None",Number:"",Tags:[]},BusyInternal:{External:"",To:"None",Number:"",Tags:[]},BusyExternal:{External:"",To:"None",Number:"",Tags:[]},NotRegisteredInternal:{External:"",To:"None",Number:"",Tags:[]},NotRegisteredExternal:{External:"",To:"None",Number:"",Tags:[]}},AwayRoute:null},{Name:"Custom 2",CustomName:"",CustomMessage:"",BlockPushCalls:!1,RingMyMobile:!1,AcceptMultipleCalls:!0,OfficeHoursAutoQueueLogOut:!0,DisableRingGroupCalls:!0,NoAnswerTimeout:20,AvailableRoute:null,AwayRoute:{AllHoursInternal:!0,AllHoursExternal:!0,External:{External:"",To:"None",Number:"",Tags:[]},Internal:{External:"",To:"None",Number:"",Tags:[]}}},{Name:"Available",CustomName:"",CustomMessage:"",BlockPushCalls:!0,RingMyMobile:!1,AcceptMultipleCalls:!0,OfficeHoursAutoQueueLogOut:!1,DisableRingGroupCalls:!1,NoAnswerTimeout:280,AvailableRoute:{NoAnswerAllCalls:!1,BusyAllCalls:!1,NotRegisteredAllCalls:!1,NoAnswerInternal:{External:"",To:"None",Number:"",Tags:[]},NoAnswerExternal:{External:"",To:"None",Number:"",Tags:[]},BusyInternal:{External:"",To:"None",Number:"",Tags:[]},BusyExternal:{External:"",To:"None",Number:"",Tags:[]},NotRegisteredInternal:{External:"",To:"None",Number:"",Tags:[]},NotRegisteredExternal:{External:"",To:"None",Number:"",Tags:[]}},AwayRoute:null}],...o,...n.ClickToCallId&&(0,ge.A9)(),...c.copy?.recordings&&{RecordCalls:n.RecordCalls,RecordExternalCallsOnly:n.RecordExternalCallsOnly},Groups:n.Groups,AgentSettings:gl(c.resources,n.AgentSettings,c.copy??{})}).filter(([i,a])=>!(0,ge.LZ)(i,t)))}(a,{resources:r,overrides:{Number:o.number||null,FirstName:o.firstName,LastName:o.lastName},copy:t},this.params)),(0,x.Pr)("_i18n.AgentNotFoundCopyErrorMessage",this.agentToCopy.Number),(0,I.n)(a=>
1this.usersApi.createUser({pbxUser:a})),(0,P.M)(a=>{this.createdAgent=a}),this.handleError(this.xapiError,this.cd,this.form.controls.agent,!0))};validateBeforeSubmit=this.createDialogValidate(this.form,this.cd);getPayload(){return this.createdAgent}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275cmp=e.VBU({type:n,selectors:[["app-agent-copy-dialog"]],hostVars:2,hostBindings:function(o,i){2&o&&e.AVh("modal-lg",!0)},features:[e.Vt3],decls:4,vars:10,consts:[[3,"submitted","header","buttons","scrollable","okDisabled","validateBeforeSubmit","submit$"],["data-qa","can-not-proceed"],[1,"row",3,"formGroup"],["formGroupName","agent",1,"col-md-7"],["label","_i18n.Extension","data-qa","extension","formControlName","number"],["controlName","number"],[1,"row"],["formControlName","firstName","label","_i18n.FirstName","data-qa","first-name",1,"col-md-6",3,"maxlength"],["controlName","firstName"],["formControlName","lastName","label","_i18n.LastName","data-qa","last-name",1,"col-md-6",3,"maxlength"],["controlName","lastName"],["formGroupName","copy",1,"col-md-5"],["formControlName","recordings","data-qa","recordings",3,"label"],["formControlName","voiceSetting","data-qa","voice-setting",3,"label"],["formControlName","agentType","data-qa","agent-type",3,"label"],["formControlName","callScreening","data-qa","call-screening",3,"label"],["formControlName","spamCallsSettings","data-qa","spam-calls-settings",3,"label"],["formControlName","agentOptions","data-qa","agent-options",3,"label"],["formControlName","agentInstructions","data-qa","agent-instructions",3,"label"]],template:function(o,i){1&o&&(e.j41(0,"app-modal-dialog",0),e.nI1(1,"translate"),e.bIt("submitted",function(){return i.onSubmit()}),e.nVh(2,Cl,3,3,"p",1)(3,bl,29,34,"div",2),e.k0s()),2&o&&(e.Y8G("header",e.mNQ(e.bMT(1,8,"_i18n.CopyAgent")))("buttons",i.buttons)("scrollable",!0)("okDisabled",!i.nextAvailableNumber)("validateBeforeSubmit",i.validateBeforeSubmit)("submit$",i.submit$),e.R7$(2),e.vxM(i.nextAvailableNumber?3:2))},dependencies:[me.p,l.X1,l.BC,l.cb,l.tU,l.j4,l.JD,l.$R,te.m,$.IH,ie.t,y.D9],encapsulation:2})}return n})();var Qn=p(47305),vl=p(81497),Sl=p(36897),Tl=p(68580);const yl=n=>({count:n}),Fl=(n,c)=>c.Id;function Rl(n,c){if(1&n){const t=e.RV6();e.j41(0,"div",4)(1,"app-button-with-dropdown",20),e.bIt("selectedChange",function(i){s.eBV(t);const a=e.XpG();return s.Njj(a.createNewAiAgent(i))}),e.nrm(2,"app-plus-solid-icon",21),e.k0s()()}if(2&n){e.XpG();const t=e.r8f(13);e.R7$(),e.Y8G("options",t)}}function Il(n,c){if(1&n){const t=e.RV6();e.j41(0,"app-button-add",22),e.bIt("click",function(){s.eBV(t);const i=e.XpG(),a=e.r8f(13);return s.Njj(i.createNewAiAgent(a[0].value))}),e.k0s()}}function Al(n,c){if(1&n){const t=e.RV6();e.j41(0,"button",23),e.bIt("click",function(){s.eBV(t);const i=e.XpG();return s.Njj(i.exportAiAgents())}),e.nrm(1,"span",24),e.j41(2,"span"),e.EFF(3),e.nI1(4,"translate"),e.k0s()()}if(2&n){const t=c,o=e.XpG();e.Y8G("disabled",!t.count&&!o.selector.isAnySelected),e.R7$(3),e.Lme(" ",e.bMT(4,3,"_i18n.Export")," ",o.selector.selectedCountLabel||(t.count?" ("+t.count+")":"")," ")}}function $l(n,c){if(1&n){const t=e.RV6();e.j41(0,"tr",26),e.bIt("click",function(i){const a=s.eBV(t).$implicit,r=e.XpG(2);return s.Njj(r.onClick(i,a))}),e.j41(1,"td",13)(2,"app-checker",27),e.bIt("ngModelChange",function(i){const a=s.eBV(t).$implicit,r=e.XpG(2);return s.Njj(r.selector.setSelected(a,i))})("checkerClick",function(i){const a=s.eBV(t).$implicit,r=e.XpG(2);return s.Njj(r.selector.handleCheckerClick(a,i))}),e.k0s()(),e.j41(3,"td"),e.nrm(4,"app-indicator-name-type",28),e.nI1(5,"appProfileCssClass"),e.nI1(6,"translate"),e.k0s(),e.j41(7,"td",29),e.EFF(8),e.k0s(),e.j41(9,"td",30),e.EFF(10),e.k0s(),e.j41(11,"td",31)(12,"span",32),e.EFF(13),e.k0s()(),e.j41(14,"td",33)(15,"row-action-button",34)(16,"li",35)(17,"button",36),e.bIt("click",function(i){const a=s.eBV(t).$implicit,r=e.XpG(2);return s.Njj(r.routeToAgentrEditor(i,a))}),e.EFF(18),e.nI1(19,"translate"),e.k0s()(),e.j41(20,"li",35)(21,"button",37),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG(2);return s.Njj(a.deleteAgent(i.Id))}),e.EFF(22),e.nI1(23,"translate"),e.k0s()(),e.j41(24,"li",35)(25,"button",38),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG(2);return s.Njj(a.impersonateService.impersonate(i.Number))}),e.EFF(26),e.nI1(27,"translate"),e.k0s()()()()()}if(2&n){const t=c.$implicit,o=e.XpG(),i=e.XpG(),a=i.nextExtension.canEdit(t,o),r=i.nextE
1xtension.canDelete(t,o);e.AVh("clickable",a),e.R7$(2),e.Y8G("ngModel",i.selector.isRowSelected(t)),e.R7$(2),e.Y8G("indicator",e.bMT(5,19,t.IsRegistered?t.CurrentProfileName:null))("name",t.DisplayName)("type",i.capitalizeFirstLetter(null==t.AgentSettings?null:t.AgentSettings.AgentType,(null==t.AgentSettings?null:t.AgentSettings.SystemPrompt.length)>0))("title",e.bMT(6,21,t.IsRegistered?"_i18n.ExtensionIsRegistered":"_i18n.ExtensionIsNotRegistered")),e.R7$(4),e.SpI(" ",t.Number," "),e.R7$(2),e.SpI(" ",i.getGroupNames(t)," "),e.R7$(3),e.JRh(null==t.Dids?null:t.Dids.join(", ")),e.R7$(3),e.AVh("disabled",!a),e.R7$(),e.Y8G("disabled",!a),e.R7$(),e.SpI(" ",e.bMT(19,23,"_i18n.Edit")," "),e.R7$(2),e.AVh("disabled",!r),e.R7$(),e.Y8G("disabled",!r),e.R7$(),e.SpI(" ",e.bMT(23,25,"_i18n.Delete")," "),e.R7$(4),e.SpI(" ",e.bMT(27,27,"_i18n.ImpersonateUser")," ")}}function Ml(n,c){if(1&n&&e.Z7z(0,$l,28,29,"tr",25,Fl),2&n){const t=e.XpG();e.Dyx(t.agents)}}let kl=(()=>{class n{impersonateService=(0,s.WQX)(Sl.P);tokenService=(0,s.WQX)(O.Z);modalService=(0,s.WQX)(B.B);pager;route=(0,s.WQX)(S.nX);cd=(0,s.WQX)(_.gRc);usersResolver=(0,s.WQX)(Zs);fileDownloadService=(0,s.WQX)(Et.y);router=(0,s.WQX)(S.Ix);usersApiService=(0,s.WQX)(Ye.u);destroy$=(0,s.WQX)(s.abz);params=_.hFB.required();resources=_.hFB.required();nextExtension=(0,s.WQX)(vl.h);lab=(0,We.D)();agentTemplates=(0,xe.EW)(()=>this.resources().Templates?.filter(t=>this.lab()||!t.Preview)?.map(t=>({dataQa:"add-agent-template",value:t,label:t.Name}))??[]);trunksGroups=_.hFB.required();agents=[];selector=new bt.a({cd:this.cd,keySelector:t=>t.Id});constructor(){this.pager=new Nt.f(this.destroy$,this.usersResolver,void 0,this.usersResolver.getStoredPageSize()),this.pager.pagedItems$.pipe((0,R.pQ)(this.destroy$)).subscribe({next:t=>{this.updateItems(t)},error:t=>this.modalService.error(t)})}updateItems(t){this.agents=t.value||[],this.selector.onDataChanged(this.agents),this.cd.markForCheck()}getGroupNames(t){return t.Groups?.filter(ge.ps).map(o=>o.Name).filter(z.U)||[]}copyExtension(t){t.stopPropagation();const o=this.selector.firstSelected;if(o){if((o.Groups??[]).find(i=>this.trunksGroups().findIndex(a=>a.Id===i.GroupId)<0))return void this.modalService.error("_i18n.AgentBelongsToNotAvailableGroup");this.nextExtension.proceedWithAvailableExtNumber$().pipe((0,I.n)(i=>this.modalService.showDialog(_l,{agentToCopy:o,nextAvailableNumber:i,params:this.params(),isPersonalAssistant:Rt(o)},{ignoreBackdropClick:!0})),(0,x.Sf)()).subscribe(i=>{this.router.navigate(["office","integrations","ai","edit",i.Id])})}}batchDelete(){const t=this.selector.selectedKeys;t.length&&(0,cn.zq)(this.modalService).pipe((0,I.n)(()=>this.usersApiService.batchDelete({usersBatchDeleteRequestBody:{ids:t}})),(0,x.AI)(400,"_i18n.AgentNotFoundDeleteErrorMessage"),(0,x.Tg)(this.modalService)).subscribe(o=>{const i=o.value??[],a=i.length===t.length;i.length&&this.modalService.showDialog(nl.i,{allFailed:a,errors:i}),!a&&(this.selector.resetAll(),this.cd.markForCheck(),this.pager.refresh$.next())})}importExtensions(t){const o=t.item(0);o&&this.nextExtension.importExtensions$(o).subscribe(i=>{i.importCount&&this.pager.refresh$.next()})}exportSelectedAgentsThroughFormPost(){const t=new FormData;for(const o of this.selector.selectedKeys)t.append("ids",String(o));return this.fileDownloadService.downloadWithPost("/Users/ExportSelectedExtensions",t)}exportAgentsThroughFilteredGet(){const t=this.usersApiService.exportExtensionsQuery({$search:(0,_t.Bj)(this.pager.search.value),$filter:this.usersResolver.filter});this.fileDownloadService.download(t,{filename:"agents.csv",addXapiPath:!0})}exportAiAgents(){this.selector.isAnySelected?this.exportSelectedAgentsThroughFormPost():this.exportAgentsThroughFilteredGet()}openOpenApiConfigurationModal(){this.router.navigate(["open-ai-config"],{relativeTo:this.route})}navigateToKnowledgeBase(){this.router.navigate(["knowledge-base"],{relativeTo:this.route})}deleteAgent(t){this.modalService.confirmDeletion("_i18n.AreYouSureYouWantToDeleteAgent").pipe((0,I.n)(()=>this.usersApiService.deleteUser({id:t}).pipe((0,x.Y$)()))).subscribe({next:()=>{this.pager.refresh$.next()},error:i=>this.modalService.error(i)})}onClick(t,o){this.routeToAgentrEditor(t,o)}routeToAgentrEditor(t,o){t.stopPropagation(),this.router.navigate(["edit",o.Id],{relativeTo:this.route})}createNewAiAgent(t){this.nextExtension.proceedWithAvailableExtNumber$().subscribe(()=>{this.router.navigate(["office","integrations","ai","new",t.Id])})}
1capitalizeFirstLetter(t,o){if(!t)return"";const i=this.agentTemplates().find(a=>a.value.Id===t)?.label;return`${o?"Custom ":""}${i??t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}`}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-ai-settings"]],inputs:{params:[1,"params"],resources:[1,"resources"],trunksGroups:[1,"trunksGroups"]},decls:58,vars:52,consts:[["helpUrl","_i18n.AIGuideUri",3,"header"],["top-bar","",1,"button-group"],["type","button","data-qa","open-ai-config",1,"btn","btn-primary",3,"click"],["type","button","data-qa","add-vector-store",1,"btn","btn-primary",3,"click"],["container","body","dropdown","",1,"dropdown"],["type","button","text","_i18n.AddAgent","data-qa","add-agent-template"],["data-qa","delete-service-principal","type","button",1,"btn","btn-primary",3,"click","disabled"],["data-qa","import-users","accept",".csv",3,"files"],["app-up-to-line-solid-icon",""],["data-qa","export-agents","type","button",1,"btn","btn-primary",3,"disabled"],["data-qa","copy-agent",3,"click","disabled"],["top-bar","",3,"formControl"],["full-width","",1,"scrollable-table"],[1,"checker"],[3,"ngModelChange","ngModel"],[1,"col-size-300"],[1,"col-size-300","xl-visible"],[1,"actions"],["colspan","6"],[3,"pageChanged","currentPage","itemsPerPage","totalItems","showBoundaryLinks"],["theme","btn-primary","text","_i18n.AddAgent","data-qa","add-agent",3,"selectedChange","options"],["icon",""],["type","button","text","_i18n.AddAgent","data-qa","add-agent-template",3,"click"],["data-qa","export-agents","type","button",1,"btn","btn-primary",3,"click","disabled"],["app-arrow-from-bottom-solid-icon",""],["data-qa","agent-list-item",3,"clickable"],["data-qa","agent-list-item",3,"click"],[3,"ngModelChange","checkerClick","ngModel"],[3,"indicator","name","type","title"],["data-qa","number"],["data-qa","groups",1,"xl-visible"],["data-qa","user-dids",1,"xl-visible"],[1,"line-clamp-1"],["data-qa","actions",1,"actions"],["data-qa","action-menu"],["role","menuitem"],["type","button","data-qa","edit",1,"dropdown-item",3,"click","disabled"],["type","button","data-qa","delete-agent",1,"dropdown-item",3,"click","disabled"],["type","button","data-qa","impersonate-user",1,"dropdown-item",3,"click"]],template:function(o,i){if(1&o&&(e.j41(0,"app-page",0),e.nI1(1,"translate"),e.j41(2,"div",1)(3,"button",2),e.bIt("click",function(){return i.openOpenApiConfigurationModal()}),e.nrm(4,"app-gear-solid-icon"),e.j41(5,"span"),e.EFF(6),e.nI1(7,"translate"),e.k0s()(),e.j41(8,"button",3),e.bIt("click",function(){return i.navigateToKnowledgeBase()}),e.nrm(9,"app-book-regular-icon"),e.j41(10,"span"),e.EFF(11),e.nI1(12,"translate"),e.k0s()(),e.SS7(13),e.nVh(14,Rl,3,1,"div",4)(15,Il,1,0,"app-button-add",5),e.j41(16,"button",6),e.bIt("click",function(){return i.batchDelete()}),e.nrm(17,"app-trash-alt-solid-icon"),e.j41(18,"span"),e.EFF(19),e.nI1(20,"translate"),e.k0s()(),e.j41(21,"app-select-file-button",7),e.bIt("files",function(r){return i.importExtensions(r)}),e.nrm(22,"span",8),e.j41(23,"span"),e.EFF(24),e.nI1(25,"translate"),e.k0s()(),e.nVh(26,Al,5,5,"button",9),e.nI1(27,"async"),e.j41(28,"app-button-copy",10),e.bIt("click",function(r){return i.copyExtension(r)}),e.k0s()(),e.nrm(29,"search-bar",11),e.j41(30,"table",12)(31,"thead")(32,"tr")(33,"th",13)(34,"app-checker",14),e.bIt("ngModelChange",function(r){return i.selector.setSelectAll(r)}),e.k0s()(),e.j41(35,"th",15),e.EFF(36),e.nI1(37,"translate"),e.k0s(),e.j41(38,"th",15),e.EFF(39),e.nI1(40,"translate"),e.k0s(),e.j41(41,"th",16),e.EFF(42),e.nI1(43,"translate"),e.k0s(),e.j41(44,"th",16),e.EFF(45),e.nI1(46,"translate"),e.k0s(),e.nrm(47,"th",17),e.k0s()(),e.j41(48,"tbody"),e.nVh(49,Ml,2,0),e.nI1(50,"async"),e.k0s(),e.j41(51,"tfoot")(52,"tr")(53,"td",18)(54,"app-paging",19),e.nI1(55,"async"),e.nI1(56,"async"),e.nI1(57,"async"),e.bIt("pageChanged",function(r){return i.pager.pageChanged(r)}),e.k0s()()()()()()),2&o){let a,r;e.Y8G("header",e.mNQ(e.bMT(1,21,"_i18n.AIAgents"))),e.R7$(6),e.JRh(e.bMT(7,23,"_i18n.OpenAIAPI")),e.R7$(5),e.JRh(e.bMT(12,25,"_i18n.KnowledgeSources")),e.R7$(2);const d=e.bH3(i.agentTemplates());e.R7$(),e.vxM(d.length>1?14:1===d.length?15:-1),e.R7$(2),e.Y8G("disabled",!i.selector.isAnySelected),e.R7$(3),e.JRh(e.bMT(20,28,"_i18n.Delete")),e.R7$(5),e.JRh(e.bMT(25,30,"_i18n.Import")),e.R7$(2),e.vxM((a=e.eq3(50,yl,e.bMT(27,32,i.pager.totalCount$)))?26:-1,a),e.R7$(2),e.Y8G("disabled",!i.selector.isOneSelected),e.R7$(),e.Y8G("formControl",i.pager.search),e.R7$(5),e.Y8G("ngModel",i.selector.isAnySelected),e.R7$(2),e.JRh(e.bMT(37,34,"_i18n.AIAgent")),e.R7$(3),e.JRh(e.bMT(40,36,"_i18n.Extension")),e.R7$(3),e.JRh(e.bMT(43,38,"_i18n.Department")),e.R7$(3),e.JRh(e.bMT(46,40,"_i18n.DIDSTableTitle")),e.R7$(4),e.vxM((r=e.bMT(50,42,i.tokenService.getMyToken$()))?49:-1,r),e.R7$(5),e.Y8G("currentPage",e.bMT(55,44,i.pager.currentPage$))("itemsPerPage",e.bMT(56,46,i.pager.pageSize$))("totalItems",e.bMT(57,48,i.pager.totalCount$))("showBoundaryLinks",!0)}},dependencies:[qe.H,Ce.j,Tl.Kk,Xe.d,at.L,He.I,Pe.u4,el.i,yt.$,l.X1,l.BC,l.l_,l.YN,l.vS,kt.n,Qn.O,jn.I,Vn.s,$n.K,Us,il.H,ol.b,y.D9,N.Jj,tl.t],encapsulation:2})}return n})();var Ln=p(50942),Wn=p(45984),xl=p(73801),El=p(20286),wl=p(16444);let Pl=(()=>{class n{static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-clipboard-solid-icon"],["","app-clipboard-solid-icon",""]],decls:2,vars:0,consts:[["xmlns","http://www.w3.org/2000/svg","viewBox","0 0 384 512"],["d","M192 0c-41.8 0-77.4 26.7-90.5 64H64C28.7 64 0 92.7 0 128V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V128c0-35.3-28.7-64-64-64H282.5C269.4 26.7 233.8 0 192 0zm0 64a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM112 192H272c8.8 0 16 7.2 16 16s-7.2 16-16 16H112c-8.8 0-16-7.2-16-16s7.2-16 16-16z"]],template:function(o,i){1&o&&(s.qSk(),e.rj2(0,"svg",0),e.Hgh(1,"path",1),e.eux())},encapsulation:2})}return n})();var Gl=p(23671),Yt=p(61851),Dl=p(81173);const Nl=["pop"];function jl(n,c){if(1&n&&(e.j41(0,"field-wrapper",5),e.nrm(1,"app-dn-select",27)(2,"val-errors",7),e.k0s()),2&n){const t=e.XpG();e.Y8G("label","_i18n.AgentBoss")("required",!0)("description","_i18n.AgentBossDescription"),e.R7$(),e.Y8G("formControl",t.ph
1onebookOverride)("clearable",!1)("searchDnTypes",t.searchDnTypes)("placeholder","_i18n.SelectExtensionPlaceholder"),e.R7$(),e.Y8G("control",t.phonebookOverride)}}function Vl(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.SpI(" ",e.bMT(1,1,c.item.label)," ")}function Bl(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.TalkMeedIdCanOnlyContains"))}function Hl(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.LinkAlreadyInUse"))}function Ol(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.LinkAlreadyInUse"))}let Yn=(()=>{class n{destroy$=(0,s.WQX)(s.abz);usersApiService=(0,s.WQX)(Ye.u);route=(0,s.WQX)(S.nX);myPhone=(0,s.WQX)(wl.gx);cd=(0,s.WQX)(_.gRc);navigator=navigator;timerId;talkUrlSuffix=crypto.randomUUID().slice(0,6);isPersonalAssistant;sub=new ft.yU;didSelect;popComponent;allowedRoles=[];dn;id;form;agentSettingsForm;groups;partialEdit=!1;autoRecordCallsEnabled;autoRecordCallsExternalOnly;clickToCallId;initFriendlyName;groupIds;params;extensionNumberLength;talkUrl="";defaultFriendlyName="";didNumbers=new l.MJ([],{nonNullable:!0});recordingOptions=[{label:"_i18n.Off",value:"off"},{label:"_i18n.UserOptionsRadioRecordAll",value:"all"},{label:"_i18n.UserOptionsRadioRecordExternal",value:"external-only"}];voiceOptions;userTransparentImage=xl;get f(){return this.form.controls}get searchDnTypes(){return[rt.J.Extension]}get emptyTalkLink(){return!this.clickToCallId.value}get phonebookOverride(){return this.agentSettingsForm.controls.phonebookOverride}get recordingControl(){return this.form.controls.recordingOption}copy(){navigator.clipboard&&navigator.clipboard.writeText(this.talkUrl??"").then(()=>{this.popComponent.show(),this.timerId&&clearTimeout(this.timerId),this.timerId=setTimeout(()=>{this.popComponent.hide()},1e3)}).catch(t=>{console.warn(t)})}ngOnChanges(t){t.form&&this.sub.add((0,Be.z)([this.myPhone.myPhoneSession.pipe((0,v.T)(o=>o.systemParameters.PbxExternalHost)),(0,T.XP)(this.clickToCallId)]).subscribe(([o,i])=>{this.talkUrl=(0,Dl.Mh)(o,i||""),this.cd.markForCheck()}))}ngOnDestroy(){this.sub.unsubscribe()}ngOnInit(){this.route.data.pipe((0,R.pQ)(this.destroy$)).subscribe(o=>{this.didNumbers.setValue(o.routes??[])});const{primaryGroupId:t}=this.form.controls;this.groups?.length?!t.value&&!this.isEdit&&t.setValue(this.groups[0].Id):t.disable(),this.isEdit||(0,El.o)(this.usersApiService.getFirstAvailableExtensionNumber(),this.f.number,this.destroy$)}get isEdit(){return!(!this.dn||!this.id)}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-agent-info"]],viewQuery:function(o,i){if(1&o&&e.GBs(ot.K,5)(Nl,5),2&o){let a;e.mGM(a=e.lsd())&&(i.didSelect=a.first),e.mGM(a=e.lsd())&&(i.popComponent=a.first)}},inputs:{isPersonalAssistant:"isPersonalAssistant",allowedRoles:"allowedRoles",dn:"dn",id:"id",form:"form",agentSettingsForm:"agentSettingsForm",groups:"groups",partialEdit:"partialEdit",autoRecordCallsEnabled:"autoRecordCallsEnabled",autoRecordCallsExternalOnly:"autoRecordCallsExternalOnly",clickToCallId:"clickToCallId",initFriendlyName:"initFriendlyName",groupIds:"groupIds",params:"params",extensionNumberLength:"extensionNumberLength",voiceOptions:"voiceOptions"},features:[e.OA$],decls:29,vars:40,consts:[["pop","bs-tooltip"],[3,"formGroup"],["data-qa","agent-general-fields",1,"row","mb-3"],["formControlName","number","label","_i18n.Extension","data-qa","extension",1,"col-lg-6",3,"maxlength","description"],["controlName","number"],[1,"col-lg-6",3,"label","required","description"],["data-qa","primary-group","placeholder","_i18n.SelectGroupsPlaceholder",1,"col-lg-6",3,"formControl","label","description","groups","required"],[3,"control"],["label","_i18n.FirstName","formControlName","firstName","data-qa","first-name",1,"col-lg-6",3,"maxlength"],["controlName","firstName"],["label","_i18n.LastName","formControlName","lastName","data-qa","last-name",1,"col-lg-6",3,"maxlength"],["controlName","lastName"],["data-qa","didNumbers",1,"col-lg-12",3,"formControl","dn","description"],["data-qa","voice-and-call-settings",1,"row","mb-3"],[1,"col-lg-6",3,"description","label"],["bindLabel","Id","bindValue","Id","data-qa","selected-voices",3,"items","formControl","clearable"],[1,"col-lg-6",3,"label","description"],["bindValue","value","data-qa","record-calls",3,"items","formControl","clearable"],["ng-label-tmp","","ng-option-tmp",""],["data-qa","max-call-duration",1,"col-lg-6",3,"label","formControl","description"],["data-qa","friendly-name","label","_i18n.AgentTalkLink",1,"col-lg-6",3,"description","formControl","maxlength","initializeValue"],["label","_i18n.AddYourLinkName",3,"control"],["valError","pattern"],["valError","FriendlyName"],["valError","unique"],["type","button","data-qa","copy","triggers","",1,"btn","btn-border",3,"click","disabled","tooltip"],["app-clipboard-solid-icon","",1,"svg-sm"],[3,"formControl","clearable","searchDnTypes","placeholder"]],template:function(o,i){1&o&&(e.qex(0,1),e.j41(1,"fieldset",2)(2,"field-input",3),e.nrm(3,"val-errors",4),e.k0s(),e.nVh(4,jl,3,8,"field-wrapper",5),e.j41(5,"app-departments-select",6),e.nrm(6,"val-errors",7),e.k0s(),e.j41(7,"field-input",8),e.nrm(8,"val-errors",9),e.k0s(),e.j41(9,"field-input",10),e.nrm(10,"val-errors",11),e.k0s(),e.nrm(11,"app-did-number-select",12),e.k0s(),e.j41(12,"fieldset",13)(13,"field-wrapper",14),e.nrm(14,"ng-select",15),e.k0s(),e.j41(15,"field-wrapper",16)(16,"ng-select",17),e.DNE(17,Vl,2,3,"ng-template",18),e.k0s()(),e.j41(18,"field-input-number",19),e.nrm(19,"val-errors",7),e.k0s(),e.j41(20,"field-input",20)(21,"val-errors",21),e.DNE(22,Bl,2,3,"ng-template",22)(23,Hl,2,3,"ng-template",23)(24,Ol,2,3,"ng-template",24),e.k0s(),e.j41(25,"button",25,0),e.nI1(27,"translate"),e.bIt("click",function(){return i.copy()}),e.nrm(28,"span",26),e.k0s()()(),e.bVm()),2&o&&(e.Y8G("formGroup",i.form),e.R7$(2),e.Y8G("maxlength",i.extensionNumberLength??255)("description","_i18n.AgentInternalNumberDescription"),e.R7$(2),e.vxM(i.isPersonalAssistant?4:-1),e.R7$(),e.AVh("col-lg-12",i.isPersonalAssistant),e.Y8G("formControl",i.groupIds)("label","_i18n.DepartmentMembership")("description","_i18n.DepartmentMembershipDescription")("groups",i.groups)("required",!0),e.R7$(),e.Y8G("control",i.groupIds),e.R7$(),e.Y8G("maxlength",50),e.R7$(2),e.Y8G("maxlength",50),e.R7$(2),e.Y8G("formControl",i.didNumbers)("dn",i.dn)("description","_i18n.AddDirectNumbersDescription"),e.R7$(2),e.Y8G("description","_i18n.VoiceStyleDescription")("label","_i18n.VoiceStyle"),e.R7$(),e.Y8G("items",i.voiceOptions)("formControl",i.agentSettingsForm.controls.voice)("clearable",!1),e.R7$(),e.Y8G("label","_i18n.RecordCalls")("description","_i18n.RecordCallsDescription"),e.R7$(),e.Y8G("items",i.recordingOptions)("formControl",i.recordingControl)("clearable",!1),e.R7$(2),e.Y8G("label","_i18n.MaximumCallDuration")("formControl",i.agentSettingsForm.controls.maxCallDuration)("description","_i18n.MaximumCallDurationDescription"),e.R7$(),e.Y8G("control",i.agentSettingsForm.controls.maxCallDuration),e.R7$(),e.Y8G("description","_i18n.AgentTalkLinkDescription")("formControl",i.clickToCallId)("maxlength",20)("initializeValue",i.defaultFriendlyName),e.R7$(),e.Y8G("control",i.clickToCallId),e.R7$(4),e.Y8G("disabled",!i.navigator.clipboard||i.emptyTalkLink)("tooltip",e.bMT(27,38,"_i18n.Copied")))},dependencies:[l.X1,l.BC,l.cb,l.YS,l.tU,l.l_,l.j4,l.JD,l.YN,te.m,Yt.A,$.IH,Z.z,Q.vr,Q.ZZ,Q.Uq,ot.K,on.N,Pl,Gl.N,tt.dg,mt.B,$.VI,y.D9],encapsulation:2})}return n})(),Jt=(()=>{class n{aiApiService=(0,s.WQX)(de);cache=new Map;getTemplateContents(t){if(!this.cache.has(t)){const o=this.aiApiService.getAITemplateContents({id:t}).pipe((0,v.T)(i=>i.value||""),(0,ze.t)(1));this.cache.set(t,o)}return this.cache.get(t)}clearCache(t){t?this.cache.delete(t):this.cache.clear()}static \u0275fac=function(o){return new(o||n)};static \u0275prov=s.jDH({token:n,factory:n.\u0275fac})}return n})();var Xl=p(8876),Ql=p(94979),Wl=p(29912);function Yl(n,c){if(1&n&&e.nrm(0,"app-server-error",3),2&n){const t=e.XpG(3);e.Y8G("message",t.text)}}function Jl(n,c){if(1&n&&(e.nrm(0,"div",4),e.nI1(1,"translate")),2&n){const t=e.XpG(3);e.Y8G("innerHtml",e.bMT(1,1,t.text),e.npT)}}
1function ql(n,c){if(1&n&&e.nVh(0,Yl,1,1,"app-server-error",3)(1,Jl,2,3,"div",4),2&n){const t=e.XpG(2);e.vxM(t.showServerError?0:1)}}function Ul(n,c){if(1&n&&(e.DNE(0,ql,2,1,"ng-template",null,0,e.C5r),e.j41(2,"div",1),e.bIt("click",function(o){return o.preventDefault()}),e.nrm(3,"show-svg-images",2),e.k0s()),2&n){const t=e.sdS(1),o=e.XpG();e.R7$(2),e.Y8G("tooltip",t)("container",o.container)("placement",o.placement),e.R7$(),e.Y8G("svg",o.warningIcon)}}let zl=(()=>{class n{warningIcon='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346 7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"/></svg>';text;container;showServerError;placement="top";static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-field-warning"]],inputs:{text:"text",container:"container",showServerError:"showServerError",placement:"placement"},decls:1,vars:1,consts:[["warningTemplate",""],["role","button","triggers","click:mouseleave",1,"d-flex",3,"click","tooltip","container","placement"],[1,"customSVGIcons","svg-xs","fillIconOrange",2,"margin-bottom","1px",3,"svg"],[3,"message"],[3,"innerHtml"]],template:function(o,i){1&o&&e.nVh(0,Ul,4,4),2&o&&e.vxM(i.text?0:-1)},dependencies:[tt.dg,Wl.d,pt.J,y.D9],encapsulation:2,changeDetection:0})}return n})();var Kl=p(47548);const Zl=[[["val-errors"]]],ec=["val-errors"];function tc(n,c){if(1&n&&e.nrm(0,"app-field-warning",2),2&n){const t=e.XpG();e.Y8G("text",t.errorMessage)("showServerError",!0)}}function nc(n,c){if(1&n&&e.nrm(0,"app-field-warning",3),2&n){const t=e.XpG();e.Y8G("text",t.syncWarningMessage)}}function ic(n,c){if(1&n&&(e.j41(0,"span",8),e.EFF(1),e.nI1(2,"translate"),e.k0s()),2&n){const t=e.XpG();e.R7$(),e.Lme(" ",t.getSelectedCount()," ",e.bMT(2,2,"_i18n.SelectedSources")," ")}}function oc(n,c){if(1&n){const t=e.RV6();e.j41(0,"div",1)(1,"app-checker",9),e.bIt("checkerClick",function(i){s.eBV(t);const a=e.XpG();return s.Njj(a.onCheckerClick(i))}),e.k0s(),e.nrm(2,"span",10),e.nI1(3,"translate"),e.k0s()}if(2&n){const t=c.item,o=e.XpG();e.R7$(),e.Y8G("ngModel",o.selectedValue.includes(t.Id)),e.R7$(),e.Y8G("truncatedText",e.bMT(3,2,t.Name??"_i18n.UntitledStore"))}}let ac=(()=>{class n extends St.z{aiSettingsApi=(0,s.WQX)(de);label="";description="";placeholder="_i18n.SelectVectorStores";valueField="Id";id=(0,T.bn)();opened=(0,_.CGW)();closed=(0,_.CGW)();removed=(0,_.CGW)();vectorStoreChanged=(0,_.CGW)();selectedValue=[];vectorStores$;loading=!1;itemsPerPage=50;errorMessage=null;syncWarningMessage=null;requestMore$=new kn.t(!0);convertToVectorStorageRef(t){return{Id:t.Id??void 0,Name:t.Name??null}}ngOnInit(){this.vectorStores$=this.requestMore$.pipe((0,P.M)(()=>this.loading=!0),(0,Ql.m)((t,o)=>t.Items&&0!==t.Items.length?t.HasMore&&t.LastId?this.getVectorStores(t.LastId).pipe((0,v.T)(i=>this.mapResponseAndSync(i,t.Items??[]))):(0,M.of)(t):this.getVectorStores("").pipe((0,v.T)(i=>this.mapResponseAndSync(i))),{Items:[],HasMore:!0,FirstId:null,LastId:null}),(0,P.M)(()=>{this.loading=!1}),(0,v.T)(t=>t.Items??[]),(0,ze.t)({bufferSize:1,refCount:!0}))}mapResponseAndSync(t,o){const i={...t,Items:o?[...o,...(t.Items??[]).map(a=>
1this.convertToVectorStorageRef(a))]:(t.Items??[]).map(a=>this.convertToVectorStorageRef(a))};return!this.errorMessage&&!i.HasMore&&i.Items&&this.syncSelectedValues(i.Items),i}syncSelectedValues(t){const o=new Set(t.map(a=>a.Id).filter(a=>!!a)),i=this.selectedValue.filter(a=>o.has(a));i.length!==this.selectedValue.length&&(this.syncWarningMessage="_i18n.SomeAssignedStoresRemoved",this.onItemSelected(i),this.cd.markForCheck())}getVectorStores(t){return this.aiSettingsApi.getVectorStores({limit:this.itemsPerPage,after:t}).pipe((0,A.W)(o=>(this.errorMessage=(0,z.G0)((0,X.PE)(o)),this.cd.markForCheck(),(0,M.of)({Items:[],HasMore:!1,FirstId:null,LastId:null}))))}onScrollToEnd(){this.requestMore$.next(!0)}get hasSelectedValue(){return this.selectedValue.length>0}writeValue(t){const o=t&&t.length>0?t:[];super.writeValue(o),this.selectedValue=o,this.cd.markForCheck()}onItemSelected(t){const o=Array.isArray(t)?t:t?[t]:[];this.selectedValue=o,this.valueChanged(o),this.markAsTouched(),this.cd.markForCheck(),null!==t&&this.vectorStoreChanged.emit(t)}onOpen(){this.opened.emit()}onClose(){this.markAsTouched(),this.closed.emit()}onRemove(t){this.removed.emit(t)}getSelectedCount(){return this.value?.length??0}onCheckerClick(t){const i=t.event.target.closest(".d-flex.align-items-center.gap-2");if(i){const a=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window,detail:1});i.dispatchEvent(a)}}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275cmp=e.VBU({type:n,selectors:[["app-vector-store-select"]],inputs:{label:"label",description:"description",placeholder:"placeholder",valueField:"valueField",id:"id"},outputs:{opened:"opened",closed:"closed",removed:"removed",vectorStoreChanged:"vectorStoreChanged"},features:[e.Jv_([{provide:l.kq,multi:!0,useExisting:n}]),e.Vt3],ngContentSelectors:ec,decls:15,vars:22,consts:[[3,"description"],[1,"d-flex","align-items-center","gap-2"],["placement","right",3,"text","showServerError"],["placement","right",3,"text"],["data-qa","vector-store-select",1,"vector-store-select-multiple",3,"open","close","remove","scrollToEnd","ngModelChange","items","id","bindValue","clearable","searchable","multiple","placeholder","closeOnSelect","loading","virtualScroll","ngModel"],["ng-label-tmp",""],["ng-option-tmp",""],["ngProjectAs","val-errors",5,["val-errors"]],[1,"ng-value-label"],[3,"checkerClick","ngModel"],[3,"truncatedText"]],template:function(o,i){1&o&&(e.NAR(Zl),e.j41(0,"field-wrapper",0),e.nI1(1,"translate"),e.j41(2,"div",1)(3,"label"),e.EFF(4),e.nI1(5,"translate"),e.k0s(),e.nVh(6,tc,1,2,"app-field-warning",2)(7,nc,1,1,"app-field-warning",3),e.k0s(),e.j41(8,"ng-select",4),e.nI1(9,"async"),e.nI1(10,"translate"),e.bIt("open",function(){return i.onOpen()})("close",function(){return i.onClose()})("remove",function(r){return i.onRemove(r)})("scrollToEnd",function(){return i.onScrollToEnd()})("ngModelChange",function(r){return i.onItemSelected(r)}),e.DNE(11,ic,3,4,"ng-template",5)(12,oc,4,4,"ng-template",6),e.k0s(),e.qex(13,7),e.SdG(14),e.bVm(),e.k0s()),2&o&&(e.Y8G("description",e.bMT(1,14,"_i18n.SelectKnowledgeSourcesDescription")),e.R7$(4),e.JRh(e.bMT(5,16,"_i18n.KnowledgeSources")),e.R7$(2),e.vxM(i.errorMessage?6:i.syncWarningMessage?7:-1),e.R7$(2),e.Y8G("items",e.bMT(9,18,i.vectorStores$))("id",i.id)("bindValue",i.valueField)("clearable",!0)("searchable",!1)("multiple",!0)("placeholder",(null==i.selectedValue?null:i.selectedValue.length)>0?"":e.bMT(10,20,i.placeholder))("closeOnSelect",!1)("loading",i.loading)("virtualScroll",!0)("ngModel",i.selectedValue))},dependencies:[Q.vr,yt.$,Q.ZZ,Q.Uq,N.MD,l.YN,l.BC,l.vS,Xl.c,Z.z,zl,Kl.N,y.D9,N.Jj],styles:["[_nghost-%COMP%]     .vector-store-select-multiple .ng-value-container .ng-value~.ng-value{display:none!important}"],changeDetection:0})}return n})();const rc=["aceEditor"];function sc(n,c){if(1&n&&e.EFF(0),2&n){const t=c.item,o=e.XpG();e.Lme(" ",null==t?null:t.Name," ",o.customEdited?"(Custom)":""," ")}}const lc=["Albanian","Amharic","Arabic","Armenian","Bengali","Bosnian","Bulgarian","Burmese","Catalan","Chinese","Croatian","Czech","Danish","Dutch","Estonian","English","Finnish","French","Georgian","German","Greek","Gujarati","Hindi","Hungarian","Icelandic","Indonesian","Italian","Japanese","K
1annada","Kazakh","Korean","Latvian","Lithuanian","Macedonian","Malay","Malayalam","Marathi","Mongolian","Norwegian","Persian","Polish","Portuguese","Punjabi","Romanian","Russian","Serbian","Slovak","Slovenian","Somali","Spanish","Swahili","Swedish","Tagalog","Tamil","Telugu","Thai","Turkish","Ukrainian","Urdu","Vietnamese"];let cc=(()=>{class n{cd=(0,s.WQX)(_.gRc);templateCache=(0,s.WQX)(Jt);destroy$=(0,s.WQX)(s.abz);route=(0,s.WQX)(S.nX);availableVariables=[];aceEditor;langs=lc;templates;agentSettings;isSystemPromptHidden=!1;id$=new be.B;selectedTemplate=null;currentDefaultPrompt="";customEdited=!1;constructor(){this.id$.pipe((0,I.n)(t=>this.templateCache.getTemplateContents(t)),(0,A.W)(()=>E.w),(0,R.pQ)()).subscribe(t=>this.setDefaultSystemPrompt(t))}get searchDnTypes(){return[rt.J.Extension]}get primaryLanguage(){return this.agentSettings.controls.language}get systemPrompt(){return this.agentSettings.controls.systemPrompt}get firstMessage(){return this.agentSettings.controls.firstMessage}get agentType(){return this.agentSettings.controls.type}get knowledgeBase(){return this.agentSettings.controls.knowledgeBase}get switchLanguage(){return this.agentSettings.controls.switchLanguage}setDefaultSystemPrompt(t){this.currentDefaultPrompt=t,this.systemPrompt.setValue(this.currentDefaultPrompt,{emitEvent:!1}),this.customEdited=!1,this.setValidators(),this.cd.markForCheck()}setValidators(){this.systemPrompt.setValidators([l.k0.required,l.k0.maxLength(1e5)]),this.systemPrompt.updateValueAndValidity({emitEvent:!1,onlySelf:!0})}ngOnInit(){this.availableVariables=this.route.snapshot.data.resources.Chips,se.Q.isNullOrEmpty(this.systemPrompt.value)?(this.onTemplateChange(this.agentType.value),this.isSystemPromptHidden=!0):(this.customEdited=!0,this.setValidators()),this.systemPrompt.valueChanges.pipe((0,R.pQ)(this.destroy$)).subscribe(()=>{this.customEdited||(this.customEdited=!0,this.cd.markForCheck())})}onTemplateChange(t){let o;o="string"==typeof t?t:t.Id;const i=this.templates.find(a=>a.Id===o);i&&(this.selectedTemplate=i,this.customEdited=!1,this.id$.next(o))}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-agent-type"]],viewQuery:function(o,i){if(1&o&&e.GBs(rc,5),2&o){let a;e.mGM(a=e.lsd())&&(i.aceEditor=a.first)}},inputs:{templates:"templates",agentSettings:"agentSettings"},decls:16,vars:27,consts:[["data-qa","agent-type-fields"],[1,"row"],[1,"col-lg-6",3,"label","description"],["bindValue","Id","bindLabel","Name","data-qa","template-select",3,"change","items","formControl","searchable","readonly","clearable"],["ng-label-tmp",""],[1,"col-lg-6"],[3,"formControl"],["data-qa","primary-language",3,"items","clearable","formControl"],["data-qa","switch-language",1,"col-lg-6","mt-4","ps-3",3,"label","description","formControl"],["data-qa","welcome-message",1,"col-lg-12",3,"label","description"],["rows","2","data-qa","first-message",1,"form-control",3,"formControl","placeholder"],[3,"control"]],template:function(o,i){1&o&&(e.j41(0,"fieldset",0)(1,"div",1)(2,"field-wrapper",2)(3,"ng-select",3),e.bIt("change",function(r){return i.onTemplateChange(r)}),e.DNE(4,sc,1,2,"ng-template",4),e.k0s()(),e.j41(5,"div",5),e.nrm(6,"app-vector-store-select",6),e.k0s(),e.j41(7,"field-wrapper",2),e.nI1(8,"translate"),e.nrm(9,"ng-select",7),e.k0s(),e.nrm(10,"field-checkbox",8),e.nI1(11,"translate"),e.k0s(),e.j41(12,"field-wrapper",9),e.nrm(13,"textarea",10),e.nI1(14,"translate"),e.nrm(15,"val-errors",11),e.k0s()()),2&o&&(e.R7$(2),e.Y8G("label","_i18n.AgentRole")("description","_i18n.AgentRoleDescription"),e.R7$(),e.Y8G("items",i.templates)("formControl",i.agentType)("searchable",!1)("readonly",!0)("clearable",!1),e.R7$(3),e.Y8G("formControl",i.knowledgeBase),e.R7$(),e.Y8G("label","_i18n.IntroductionLanguage")("description",e.bMT(8,21,"_i18n.IntroductionLanguageDescription")),e.R7$(2),e.Y8G("items",i.langs)("clearable",!1)("formControl",i.primaryLanguage),e.R7$(),e.Y8G("label","_i18n.SwitchLanguage")("description",e.bMT(11,23,"_i18n.SwitchLanguageDescription"))("formControl",i.switchLanguage),e.R7$(2),e.Y8G("label","_i18n.WelcomeMessage")("description","_i18n.WelcomeMessageDescription"),e.R7$(),e.Y8G("formControl",i.firstMessage)("placeholder",e.bMT(14,25,"_i18n.WelcomeMessagePlaceholder")),e.R7$(2),e.Y8G("control",i.firstMessage))},dependencies:[l.X1,l.me,l.BC,l.l_,N.MD,ie.t,Q.vr,Q.ZZ,Z.z,ac,$.IH,y.D9],encapsulation:2,changeDetection:0})}return n})(),dc=(()=>
1{class n{disabled=(0,_.hFB)();label=(0,_.hFB)();chipClick=(0,_.CGW)();static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-chip"]],inputs:{disabled:[1,"disabled"],label:[1,"label"]},outputs:{chipClick:"chipClick"},decls:5,vars:5,consts:[["type","button",1,"chip",3,"click","disabled","title"],[1,"chip-icon"],[1,"chip-label"]],template:function(o,i){1&o&&(e.rj2(0,"button",0),e.VwU("click",function(){return i.chipClick.emit()}),e.rj2(1,"span",1),e.EFF(2,"+"),e.eux(),e.rj2(3,"span",2),e.EFF(4),e.eux()()),2&o&&(e.AVh("disabled",i.disabled()),e.Avn("disabled",i.disabled())("title",i.label()),e.R7$(4),e.JRh(i.label()))},styles:[".chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.25rem;padding:.375rem .75rem;background-color:#e9ecef;border:1px solid #dee2e6;border-radius:1rem;font-size:.875rem;color:#495057;cursor:pointer;transition:all .2s ease-in-out;-webkit-user-select:none;user-select:none}.chip[_ngcontent-%COMP%]:hover{background-color:#dee2e6;border-color:#adb5bd;transform:translateY(-1px)}.chip[_ngcontent-%COMP%]:active{transform:translateY(0)}.chip.disabled[_ngcontent-%COMP%], .chip[_ngcontent-%COMP%]:disabled{background-color:#f8f9fa;border-color:#e9ecef;color:#6c757d;cursor:not-allowed;opacity:.6}.chip.disabled[_ngcontent-%COMP%]:hover, .chip[_ngcontent-%COMP%]:disabled:hover{background-color:#f8f9fa;border-color:#e9ecef;transform:none}.chip-icon[_ngcontent-%COMP%]{font-weight:700;color:#6c757d;font-size:.75rem}.chip-label[_ngcontent-%COMP%]{font-weight:500}"],changeDetection:0})}return n})();const pc=(n,c)=>c.Id;function uc(n,c){if(1&n){const t=e.RV6();e.j41(0,"app-chip",4),e.bIt("chipClick",function(){const i=s.eBV(t).$implicit,a=e.XpG();return s.Njj(a.onChipClick(i))}),e.k0s()}if(2&n){const t=c.$implicit,o=e.XpG();e.Y8G("label",t.Name)("disabled",o.disabled)}}let mc=(()=>{class n{chips=[];disabled=!1;chipClicked=(0,_.CGW)();onChipClick(t){this.disabled||this.chipClicked.emit(t)}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-variable-chips"]],inputs:{chips:"chips",disabled:"disabled"},outputs:{chipClicked:"chipClicked"},decls:6,vars:0,consts:[[1,"variable-chips-container"],[1,"chips-wrapper"],[3,"label","disabled"],[1,"form-text"],[3,"chipClick","label","disabled"]],template:function(o,i){1&o&&(e.j41(0,"div",0)(1,"div",1),e.Z7z(2,uc,1,2,"app-chip",2,pc),e.k0s(),e.j41(4,"div",3),e.EFF(5," Click on a variable to insert it into the message at cursor position "),e.k0s()()),2&o&&(e.R7$(2),e.Dyx(i.chips))},dependencies:[dc],styles:[".variable-chips-container[_ngcontent-%COMP%]{margin-bottom:1rem}.chips-wrapper[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem;margin:.5rem 0}.form-text[_ngcontent-%COMP%]{font-size:.75rem;color:#6c757d;margin-top:.25rem}"],changeDetection:0})}return n})();const fc=["aceEditor"];let gc=(()=>{class n{cd=(0,s.WQX)(_.gRc);templateCache=(0,s.WQX)(Jt);destroy$=(0,s.WQX)(s.abz);route=(0,s.WQX)(S.nX);availableVariables=[];aceEditor;agentSettings;isSystemPromptHidden=!1;id$=new be.B;currentDefaultPrompt="";customEdited=!1;constructor(){this.id$.pipe((0,I.n)(t=>this.templateCache.getTemplateContents(t)),(0,A.W)(()=>E.w),(0,R.pQ)()).subscribe(t=>this.setDefaultSystemPrompt(t))}get systemPrompt(){return this.agentSettings.controls.systemPrompt}get agentType(){return this.agentSettings.controls.type}setDefaultSystemPrompt(t){this.currentDefaultPrompt=t,this.systemPrompt.setValue(this.currentDefaultPrompt,{emitEvent:!1}),this.customEdited=!1,this.setValidators(),this.cd.markForCheck()}setValidators(){this.systemPrompt.setValidators([l.k0.required,l.k0.maxLength(1e5)]),this.systemPrompt.updateValueAndValidity({emitEvent:!1,onlySelf:!0})}onResetClick(){se.Q.isNullOrEmpty(this.currentDefaultPrompt)?this.templateCache.getTemplateContents(this.agentType.value).pipe((0,A.W)(()=>E.w),(0,R.pQ)(this.destroy$)).subscribe(t=>{this.setDefaultSystemPrompt(t),this.systemPrompt.markAsDirty()}):(this.systemPrompt.setValue(this.currentDefaultPrompt),this.customEdited=!1,this.cd.markForCheck())}
1ngOnInit(){this.availableVariables=this.route.snapshot.data.resources.Chips,se.Q.isNullOrEmpty(this.systemPrompt.value)?(this.fetchTemplatePrompt(),this.isSystemPromptHidden=!0):(this.customEdited=!0,this.setValidators()),this.systemPrompt.valueChanges.pipe((0,R.pQ)(this.destroy$)).subscribe(()=>{this.customEdited||(this.customEdited=!0,this.cd.markForCheck())}),this.agentType.valueChanges.pipe((0,R.pQ)(this.destroy$)).subscribe(t=>{t&&this.id$.next(t)})}fetchTemplatePrompt(){const t=this.agentType.value;t&&this.id$.next(t)}onVariableChipClick(t){this.aceEditor.insertTextAtCursor(`{{${t.Name}}}`)}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-agent-instructions"]],viewQuery:function(o,i){if(1&o&&e.GBs(fc,5),2&o){let a;e.mGM(a=e.lsd())&&(i.aceEditor=a.first)}},inputs:{agentSettings:"agentSettings"},decls:13,vars:13,consts:[["fsContainer",""],["aceEditor",""],["data-qa","agent-instructions-fields"],[1,"col-lg-12"],[1,"form-label","fw-semibold"],[3,"chipClicked","chips"],[3,"resetClicked","formControl","mode","showReset","isShowCopy","fullscreenTarget"],[3,"control"],[1,"form-text","mt-2"]],template:function(o,i){if(1&o&&(e.j41(0,"fieldset",2)(1,"div",3,0)(3,"label",4),e.EFF(4),e.nI1(5,"translate"),e.k0s(),e.j41(6,"app-variable-chips",5),e.bIt("chipClicked",function(r){return i.onVariableChipClick(r)}),e.k0s(),e.j41(7,"app-ace",6,1),e.bIt("resetClicked",function(){return i.onResetClick()}),e.k0s(),e.nrm(9,"val-errors",7),e.j41(10,"div",8),e.EFF(11),e.nI1(12,"translate"),e.k0s()()()),2&o){const a=e.sdS(2);e.R7$(4),e.JRh(e.bMT(5,9,"_i18n.AgentInstructions")),e.R7$(2),e.Y8G("chips",i.availableVariables),e.R7$(),e.Y8G("formControl",i.systemPrompt)("mode","nunjucks")("showReset",!0)("isShowCopy",!0)("fullscreenTarget",a),e.R7$(2),e.Y8G("control",i.systemPrompt),e.R7$(2),e.JRh(e.bMT(12,11,"_i18n.AgentInstructionsDescription"))}},dependencies:[l.X1,l.BC,l.l_,N.MD,ut.x,mc,$.IH,y.D9],encapsulation:2,changeDetection:0})}return n})();var hc=p(31842);const Cc=[[["val-errors"]]],bc=["val-errors"],_c=(n,c,t,o,i,a)=>[n,c,t,o,i,a],vc=n=>[n];function Sc(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.ActionRequired"))}function Tc(n,c){1&n&&e.nrm(0,"field-checkbox",11),2&n&&e.Y8G("label","_i18n.Voicemail")}function yc(n,c){1&n&&(e.qex(0,12),e.SdG(1),e.bVm())}function Fc(n,c){1&n&&e.nrm(0,"val-errors",13)}function Rc(n,c){if(1&n&&(e.j41(0,"field-wrapper",9),e.nrm(1,"app-dn-select",10),e.nVh(2,Tc,1,1,"field-checkbox",11),e.nVh(3,yc,2,0,"ng-container",12)(4,Fc,1,0,"val-errors",13),e.k0s()),2&n){const t=e.XpG();e.Y8G("label","_i18n.Destination"),e.R7$(),e.Y8G("clearable",!1)("searchDnTypes",t.isTransferTo?e.l4e(5,_c,t.pbxPeerType.Extension,t.pbxPeerType.Queue,t.pbxPeerType.Ivr,t.pbxPeerType.RingGroup,t.pbxPeerType.RoutePoint,t.pbxPeerType.Parking):e.eq3(12,vc,t.pbxPeerType.Extension)),e.R7$(),e.vxM(t.isTransferTo&&t.hasVoicemailType?2:-1),e.R7$(),e.vxM(t.form.valid?3:4)}}const Ic=n=>n.value&&!n.value.Type?{extensionNumberNotFound:!0}:null;let Jn=(()=>{class n extends St.z{destroy$=(0,s.WQX)(s.abz);showValidation=!1;label="";description="";pbxPeerType=rt.J;sub=new ft.yU;form=new l.gE({action:new l.MJ("endcall",{nonNullable:!0}),forwardingDestination:new l.MJ(null,{validators:[l.k0.required,Ic]}),voicemail:new l.MJ(!1,{nonNullable:!0})});isForwardingDestEnabled(t){return"chat"===t||"transfer"===t||"email"===t}constructor(){super(),this.touchOnChange=!0,this.sub.add((0,T.jA)((0,T.XP)(this.f.action).pipe((0,v.T)(t=>this.isForwardingDestEnabled(t))),[this.f.forwardingDestination,this.f.voicemail])),this.f.action.valueChanges.pipe((0,Zt.F)(),(0,R.pQ)(this.destroy$)).subscribe(()=>{this.form.patchValue({forwardingDestination:null,voicemail:!1})}),this.form.valueChanges.pipe((0,R.pQ)(this.destroy$)).subscribe(t=>{this.valueChanged(this.convertToAgentRoutingRule(t))})}ngOnDestroy(){this.sub.unsubscribe()}ngOnInit(){this.syncControlState(this.form)}writeValue(t){super.writeValue(t||{Action:"endcall"});const o="voicemail"===this.value.Action;this.form.setValue({action:o?"transfer":this.value.Action,forwardingDestination:this.value.Number?this.value:null,voicemail:o},{emitEvent:!1}),this.adjustEnabledState()}adjustEnabledState(){this.form.enabled&&(0,T.sS)([this.f.forwardingDestination,this.f.voicemail],this.isForwardingDestEnabled(this.f.action.value))}get hasVoicemailType(){return(0,hc._D)(this.f.forwardingDestination.value)}setDisabledState(t){super.setDisabledState(t),(0,T.TZ)(this.form,!t),this.adjustEnabledState()}get f(){return this.form.controls}get isTransferTo(){return"transfer"===this.f.action.value}get isChat(){return"chat"===this.f.action.value}get isEmail(){return"email"===this.f.action.value}convertToAgentRoutingRule(t){const o={Action:t.action};return"transfer"===t.action&&t.forwardingDestination&&(o.Number=t.forwardingDestination?.Number,t.voicemail&&(o.Action="voicemail")),"chat"===t.action&&t.forwardingDestination&&(o.Number=t.forwardingDestination?.Number),"email"===t.action&&t.forwardingDestination&&(o.Number=t.forwardingDestination?.Number),o}validate=this.createComponentValidator(this.form);static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-agent-routing-rule"]],inputs:{showValidation:"showValidation",label:"label",description:"description"},features:[e.Jv_([{provide:l.kq,multi:!0,useExisting:n},{provide:l.cz,multi:!0,useExisting:n}]),e.Vt3],ngContentSelectors:bc,decls:18,vars:18,consts:[[3,"formGroup"],[3,"label","description"],["formControlName","action","data-qa","action-select",3,"clearable","searchable"],["value","transfer"],["value","endcall"],["value","chat"],["value","email"],["controlName","action"],["valError","required"],[1,"validation-target",3,"label"],["formControlName","forwardingDestination","data-qa","destination-select",3,"clearable","searchDnTypes"],["formControlName","voicemail",1,"m-0","mt-1",3,"label"],["ngProjectAs","val-errors",5,["val-errors"]],["controlName","forwardingDestination"]],template:function(o,i){1&o&&(e.NAR(Cc),e.qex(0,0),e.j41(1,"field-wrapper",1)(2,"ng-select",2)(3,"ng-option",3),e.
1EFF(4),e.nI1(5,"translate"),e.k0s(),e.j41(6,"ng-option",4),e.EFF(7),e.nI1(8,"translate"),e.k0s(),e.j41(9,"ng-option",5),e.EFF(10),e.nI1(11,"translate"),e.k0s(),e.j41(12,"ng-option",6),e.EFF(13),e.nI1(14,"translate"),e.k0s()(),e.j41(15,"val-errors",7),e.DNE(16,Sc,2,3,"ng-template",8),e.k0s()(),e.nVh(17,Rc,5,14,"field-wrapper",9),e.bVm()),2&o&&(e.Y8G("formGroup",i.form),e.R7$(),e.Y8G("label",i.label)("description",i.description),e.R7$(),e.Y8G("clearable",!1)("searchable",!1),e.R7$(2),e.JRh(e.bMT(5,10,"_i18n.TransferTo")),e.R7$(3),e.JRh(e.bMT(8,12,"_i18n.EndCall")),e.R7$(3),e.JRh(e.bMT(11,14,"_i18n.SendScreeningMessageAndDisconnect")),e.R7$(3),e.JRh(e.bMT(14,16,"_i18n.SendEmailMessageAndDisconnect")),e.R7$(4),e.vxM(i.isTransferTo||i.isChat||i.isEmail?17:-1))},dependencies:[l.X1,l.BC,l.cb,l.j4,l.JD,$.N4,$.IH,$.VI,Yt.A,Q.MQ,Q.vr,Q.xt,ie.t,Z.z,y.D9],styles:["@media(max-width:1399.98px){.d-xxl-down-none[_ngcontent-%COMP%], .xxl-visible[_ngcontent-%COMP%]{display:none}}@media(max-width:1199.98px){.d-xl-down-none[_ngcontent-%COMP%], .xl-visible[_ngcontent-%COMP%]{display:none}}@media(max-width:991.98px){.d-lg-down-none[_ngcontent-%COMP%], .lg-visible[_ngcontent-%COMP%]{display:none}}@media(max-width:767.98px){.d-md-down-none[_ngcontent-%COMP%], .md-visible[_ngcontent-%COMP%]{display:none!important}}@media(max-width:575.98px){.d-sm-down-none[_ngcontent-%COMP%], .sm-visible[_ngcontent-%COMP%]{display:none!important}}@media(min-width:992px){[_nghost-%COMP%]{display:flex;gap:var(--bs-gutter-x)}[_nghost-%COMP%] > *[_ngcontent-%COMP%]{width:calc((100% - var(--bs-gutter-x)) / 2)}}"],changeDetection:0})}return n})(),Ac=(()=>{class n{form=_.hFB.required();static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-block-spam-calls"]],inputs:{form:[1,"form"]},decls:11,vars:16,consts:[["data-qa","block-spam-calls-fields",1,"row","mb-3",3,"formGroup"],[1,"col-lg-6",3,"label","description"],["rows","3","formControlName","spamInstructions","data-qa","spam-instructions",1,"form-control",3,"placeholder"],["controlName","spamInstructions"],[1,"col-lg-12","mt-2"],["formControlName","spamAction","data-qa","spam-action",3,"showValidation","label","description"],["controlName","spamAction"]],template:function(o,i){1&o&&(e.j41(0,"fieldset",0)(1,"field-wrapper",1)(2,"textarea",2),e.nI1(3,"translate"),e.EFF(4,"                "),e.k0s(),e.nrm(5,"val-errors",3),e.k0s(),e.j41(6,"div",4)(7,"app-agent-routing-rule",5),e.nI1(8,"translate"),e.nI1(9,"translate"),e.nrm(10,"val-errors",6),e.k0s()()()),2&o&&(e.Y8G("formGroup",i.form()),e.R7$(),e.Y8G("label","_i18n.WhatCountsAsSpam")("description","_i18n.SpamInstructionsDescription"),e.R7$(),e.Y8G("placeholder",e.mNQ(e.bMT(3,10,"_i18n.SpamInstructionsPlaceholder"))),e.R7$(5),e.Y8G("label",e.mNQ(e.bMT(8,12,"_i18n.SpamAction")))("description",e.mNQ(e.bMT(9,14,"_i18n.SpamActionDescription")))("showValidation",!0))},dependencies:[Jn,l.X1,l.me,l.BC,l.cb,l.j4,l.JD,$.IH,Z.z,y.D9],encapsulation:2,changeDetection:0})}return n})(),$c=(()=>{class n{agentNumber=(0,_.hFB)();notifyOptions=[{value:"chat",label:"_i18n.SendScreeningMessageViaChat"},{value:"email",label:"_i18n.SendScreeningMessageViaEmail"},{value:"voicemail",label:"_i18n.SendToBossVoicemail"},{value:"approval",label:"_i18n.TransfertoBoss"}];blockOptions=[{value:"chat",label:"_i18n.SendScreeningMessageViaChat"},{value:"email",label:"_i18n.SendScreeningMessageViaEmail"},{value:"voicemail",label:"_i18n.SendToBossVoicemail"},{value:"end",label:"_i18n.EndCall"}];interruptOptions=[{value:"approval",label:"_i18n.TransfertoBoss"}];form=_.hFB.required();isPersonalAssistant=_.hFB.required();static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-agent-call-screening"]],inputs:{agentNumber:[1,"agentNumber"],form:[1,"form"],isPersonalAssistant:[1,"isPersonalAssistant"]},decls:35,vars:37,consts:[[3,"formGroup"],["data-qa","agent-call-priority-fields","formGroupName","bossInterruptionSettings"],[1,"form-text","mb-3","mt-0"],["formGroupName","notify",1,"row"],[1,"col-lg-6","mb-1","fw-semibold",3,"label"],[1,"form-text","fw-lighter"],["formControlName","action",1,"col-lg-12",3,"options"],["formGroupName","block",1,"row","align-items-center"],[1,"col-lg-6","fw-semibold",3,"label"],["rows","2","formControlName","instructions",1,"form-control",3,"maxlength","placeholder"],["controlName","instructions"],["formControlName","action",1,"col-lg-6",3,"options","label"],["formGroupName","interrupt",1,"row","align-items-center"]],template:function(o,i){1&o&&(e.qex(0,0),e.j41(1,"fieldset",1)(2,"label",2),e.EFF(3),e.nI1(4,"translate"),e.k0s(),e.j41(5,"div",3),e.nrm(6,"field-wrapper",4),e.j41(7,"div",5),e.EFF(8),e.nI1(9,"translate"),e.k0s(),e.nrm(10,"field-select",6),e.k0s(),e.j41(11,"div",7)(12,"field-wrapper",8),e.nI1(13,"translate"),e.j41(14,"div",5),e.EFF(15),e.nI1(16,"translate"),e.k0s(),e.j41(17,"textarea",9),e.nI1(18,"translate"),e.EFF(19,"                "),e.k0s(),e.nrm(20,"val-errors",10),e.k0s(),e.nrm(21,"f
1ield-select",11),e.nI1(22,"translate"),e.k0s(),e.j41(23,"div",12)(24,"field-wrapper",8),e.nI1(25,"translate"),e.j41(26,"div",5),e.EFF(27),e.nI1(28,"translate"),e.k0s(),e.j41(29,"textarea",9),e.nI1(30,"translate"),e.EFF(31,"                "),e.k0s(),e.nrm(32,"val-errors",10),e.k0s(),e.nrm(33,"field-select",11),e.nI1(34,"translate"),e.k0s()(),e.bVm()),2&o&&(e.Y8G("formGroup",i.form()),e.R7$(3),e.JRh(e.bMT(4,17,"_i18n.InterruptDecisionsDescription")),e.R7$(3),e.Y8G("label","_i18n.Notify"),e.R7$(2),e.JRh(e.bMT(9,19,"_i18n.NotifyDescription")),e.R7$(2),e.Y8G("options",i.notifyOptions),e.R7$(2),e.Y8G("label",e.bMT(13,21,"_i18n.BlockCall")),e.R7$(3),e.JRh(e.bMT(16,23,"_i18n.BlockDescription")),e.R7$(2),e.Y8G("maxlength",8e3)("placeholder",e.bMT(18,25,"_i18n.BlockPlaceholder")),e.R7$(4),e.Y8G("options",i.blockOptions)("label",e.bMT(22,27,"_i18n.Action")),e.R7$(3),e.Y8G("label",e.bMT(25,29,"_i18n.InterruptBoss")),e.R7$(3),e.SpI("",e.bMT(28,31,"_i18n.InterruptBossDescription")," "),e.R7$(2),e.Y8G("maxlength",8e3)("placeholder",e.bMT(30,33,"_i18n.InterruptBossPlaceholder")),e.R7$(4),e.Y8G("options",i.interruptOptions)("label",e.bMT(34,35,"_i18n.Action")))},dependencies:[l.X1,l.me,l.BC,l.cb,l.tU,l.j4,l.JD,l.$R,Z.z,$.IH,Te.q,y.D9],encapsulation:2,changeDetection:0})}return n})();const Mc=(n,c,t,o,i,a)=>[n,c,t,o,i,a];function kc(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.DestinationNumberCannotBeLongerThan50"))}function xc(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.DestinationNumberCannotBeSameAsAgent"))}let Ec=(()=>{class n extends k.m{cd=(0,s.WQX)(_.gRc);buttons=G.P.OkCancel;pbxPeerType=rt.J;extensionPrompt;existingExtensions=[];agentNumber;form=new l.gE({Extension:new l.MJ(null,{nonNullable:!0,validators:[l.k0.required,(0,V.Oh)(50)]}),Description:new l.MJ("",{nonNullable:!0,validators:[l.k0.required,l.k0.maxLength(255)]})});get isNew(){return!this.extensionPrompt}get validateBeforeSubmit(){return this.createDialogValidate(this.form,this.cd)}get peerFilter(){return this.agentNumber&&`not(Number eq '${this.agentNumber}')`}createAgentNumberValidator(){return t=>this.agentNumber&&t.value&&t.value.Number===this.agentNumber?{agentNumberConflict:!0}:null}ngOnInit(){const t=(0,V.G1)(this.existingExtensions,this.extensionPrompt),o=this.createAgentNumberValidator();this.form.controls.Extension.addValidators([t,o]),this.extensionPrompt&&this.form.patchValue({Extension:this.extensionPrompt.Number?{Number:this.extensionPrompt.Number,Name:this.extensionPrompt.Name,Type:this.extensionPrompt.Type,Tags:this.extensionPrompt.Tags}:null,Description:this.extensionPrompt.Description??""})}getPayload(){const t=this.form.value,o=t.Extension;return{Number:o?.Number||null,Name:o?.Name||null,Type:o?.Type||null,Tags:o?.Tags||void 0,Description:t.Description||void 0}}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275cmp=e.VBU({type:n,selectors:[["app-extension-prompt-dialog"]],hostVars:2,hostBindings:function(o,i){2&o&&e.AVh("modal-md",!0)},inputs:{extensionPrompt:"extensionPrompt",existingExtensions:"existingExtensions",agentNumber:"agentNumber"},features:[e.Vt3],decls:23,vars:37,consts:[["firstMessageTextarea",""],[3,"submitted","header","buttons","validateBeforeSubmit","formGroup"],[1,"mb-2"],[1,"row"],[1,"col-lg-12","mb-2"],[1,"form-label","mb-0"],["rows","2","formControlName","Description","data-qa","first-message",1,"form-control",3,"placeholder","maxlength"],["controlName","Description"],[1,"col-lg-12"],["label","_i18n.CallerAction","data-qa","extension-field"],["formControlName","Extension",3,"maxlength","clearable","searchDnTypes","placeholder","allowCustom","peerFilter","customTagLabel"],["controlName","Extension"],["valError","peerNumberTooLong"],["valError","agentNumberConflict"]],template:function(o,i){1&o&&(e.j41(0,"app-modal-dialog",1),e.nI1(1,"translate"),e.bIt("submitted",function(){return i.onSubmit()}),e.j41(2,"div",2),e.EFF(3),e.nI1(4,"translate"),e.k0s(),e.qex(5),e.j41(6,"div",3)(7,"div",4)(8,"label",5),e.EFF(9),e.nI1(10,"translate"),e.k0s(),e.nrm(11,"textarea",6,0),e.nI1(13,"translate"),e.nrm(14,"val-errors",7),e.k0s(),e.j41(15,"div",8)(16,"field-wrapper",9),e.nrm(17,"app-dn-select",10),e.nI1(18,"translate"),e.nI1(19,"translate"),e.j41(20,"val-errors",11),e.DNE(21,kc,2,3,"ng-template",12)(22,xc,2,3,"ng-template",13),e.k0s()()()(),e.bVm(),e.k0s()),2&o&&(e.Y8G("header",e.bMT(1,18,i.isNew?"_i18n.AddAction":"_i18n.EditAction"))("buttons",i.buttons)("validateBeforeSubmit",i.validateBeforeSubmit)("formGroup",i.form),e.R7$(3),e.JRh(e.bMT(4,20,"_i18n.AddActionDescription")),e.R7$(6),e.JRh(e.bMT(10,22,"_i18n.CallerIntent")),e.R7$(2),e.Y8G("placeholder",e.mNQ(e.bMT(13,24,"_i18n.CallerIntentPlaceholder")))("maxlength",8e3),e.R7$(6),e.Y8G("placeholder",e.mNQ(e.bMT(18,26,"_i18n.SelectActionPlaceholder")))("customTagLabel",e.mNQ(e.bMT(19,28,"_i18n.UseAsExternalNumber")))("maxlength",50)("clearable",!1)("searchDnTypes",e.l4e(30,Mc,i.pbxPeerType.Extension,i.pbxPeerType.Queue,i.pbxPeerType.Ivr,i.pbxPeerType.RingGroup,i.pbxPeerType.RoutePoint,i.pbxPeerType.Parking))("allowCustom",!0)("peerFilter",i.peerFilter))},dependencies:[me.p,l.X1,l.me,l.BC,l.cb,l.tU,l.j4,l.JD,Yt.A,$.IH,$.VI,Z.z,y.D9],encapsulation:2,changeDetection:0})}return n})();var wc=p(90262),Pc=p.n(wc),It=p(422),qn=p(33971);function Gc(n,c){if(1&n){const t=e.RV6();e.j41(0,"tr")(1,"td",13)(2,"div",14)(3,"span",15),e.EFF(4),e.k0s()()(),e.j41(5,"td",16)(6,"span",17),e.EFF(7),e.k0s()(),e.j41(8,"td",18)(9,"row-action-button")(10,"li",19)(11,"button",20),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG(2);return s.Njj(a.edit(i))}),e.EFF(12),e.nI1(13,"translate"),e.k0s()(),e.j41(14,"li",19)(15,"button",21),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG(2);return s.Njj(a.remove(i))}),e.EFF(16),e.nI1(17,"translate"),e.k0s()()()()()}if(2&n){const t=c.$implicit,o=e.XpG(2);e.R7$(3),e.Y8G("title",t.Description),e.R7$(),e.JRh(t.Description),e.R7$(),e.Y8G("title",t.Number),e.R7$(2),e.JRh(o.getExtensionDisplay(t)),e.R7$(5),e.SpI(" ",e.bMT(13,6,"_i18n.Edit")," "),e.R7$(4),e.SpI(" ",e.bMT(17,8,"_i18n.Delete")," ")}}function Dc(n,c){if(1&n){const t=e.RV6();e.j41(0,"table",7)(1,"thead")(2,"tr",8)(3,"th",9),e.EFF(4),e.nI1(5,"translate"),e.k0s(),e.j41(6,"th",10),e.EFF(7),e.nI1(8,"translate"),e.k0s(),e.nrm(9,"th",11),e.k0s()(),e.j41(10,"tbody"),e.Z7z(11,Gc,18,10,"tr",null,e.fX1),e.nI1(13,"slice"),e.k0s()(),e.j41(14,"app-paging",12),e.bIt("pageChanged",function(i){s.eBV(t);const a=e.XpG();return s.Njj(a.onPageChanged(i))})("itemsPerPageChanged",function(i){s.eBV(t);const a=e.XpG();return s.Njj(a.onItemsPerPageChanged(i))}),e.k0s()}if(2&n){const t=e.XpG();e.R7$(4),e.JRh(e.bMT(5,7,"_i18n.CallerIntent")),e.R7$(3),e.JRh(e.bMT(8,9,"_i18n.CallerAction")),e.R7$(4),e.Dyx(e.brH(13,11,t.displayedItems,(t.currentPage-1)*t.itemsPerPage,t.currentPage*t.itemsPerPage)),e.R7$(3),e.Y8G("currentPage",t.currentPage)("itemsPerPage",t.itemsPerPage)("totalItems",t.displayedItems.length)("showBoundaryLinks",!0)("showPageSizes",!0)}}let jc=(()=>{class n extends St.z{modalService=(0,s.WQX)(B.B);translateService=(0,s.WQX)(y.c$);cd=(0,s.WQX)(_.gRc);destroy$=new be.B;disabled=!1;agentNumber;searchControl=new l.MJ("");currentPage=1;itemsPerPage=10;displayedItems=[];constructor(){super(),this.value||(this.value=[]),this.setDisplayedItems(),this.searchControl.valueChanges.pipe((0,Gt.Q)(this.destroy$)).subscribe(()=>{this.currentPage=1,this.setDisplayedItems()})}writeValue(t){super.writeValue(t||[]),this.setDisplayedItems()}add(){this.disabled||this.edit()}importExtensionPrompts(t){const o=t.item(0);if(o){if(!o.name.endsWith(".csv"))return void this.modalService.error(this.translateService.instant("_i18n.IncorrectFileFormatCSV"));if(o.size>10485760)return void this.modalService.error((0,It.cQ)(10));(0,qn.q2)(t,i=>{const a=i.target?.result??"",r=Pc().parse(a,{delimiter:",",skipEmptyLines:!0});if(0===r.data.length)return void this.modalService.error(this.translateService.instant("_i18n.EmptyCSVFile"));if(!this.validateHeaders(r.data[0]))return void this.modalService.error(this.translateService.instant("_i18n.InvalidCSVFile"));const u=[],m=r.data.slice(1),g=[];if(m.forEach((C,f)=>{const F=C[0]?.trim()??"",b=C[1]?.trim()??"",H=C[2]?.trim()??"",pe=this.validateRowData(F,b,H,f+1);pe.isValid?u.push({number:F,name:b,description:H}):g.push(pe.errorMessage)}),this.addMultipleExtensionPrompts(u),g.length>0){const C=g.map(f=>`\u2022 ${f}`).join("<br>");this.modalService.error(C)}})}}
1validateHeaders(t){return!(!t||t.length<3)&&["Number","Name","Description"].every((i,a)=>t[a]?.trim().toLowerCase()===i.toLowerCase())}validateRowData(t,o,i,a){return t&&0!==t.length?t.length>50?{isValid:!1,errorMessage:this.translateService.instant("_i18n.RowNumberTooLong",{p1:a})}:o.length>50?{isValid:!1,errorMessage:this.translateService.instant("_i18n.RowNameTooLong",{p1:a})}:i.length>255?{isValid:!1,errorMessage:this.translateService.instant("_i18n.RowDescriptionTooLong",{p1:a})}:this.agentNumber?.value&&t===this.agentNumber.value?{isValid:!1,errorMessage:this.translateService.instant("_i18n.RowExtensionSameAsAgent",{p1:a})}:{isValid:!0}:{isValid:!1,errorMessage:this.translateService.instant("_i18n.RowNumberRequired",{p1:a})}}addMultipleExtensionPrompts(t){this.value||(this.value=[]);let o=0,i=0;for(const a of t){const r=a.number,d=this.value.findIndex(m=>m.Number===r),u={Number:r,Name:a.name||void 0,Description:a.description||void 0};d>=0?(this.value[d]=u,i++):(this.value.push(u),o++)}0===o&&0===i||(this.valueChanged(this.value.slice()),this.setDisplayedItems())}exportExtensionPrompts(){if(!this.value||0===this.value.length)return;const o=[["Number","Name","Description"].join(","),...this.value.map(a=>[this.escapeCsvField(a.Number||""),this.escapeCsvField(a.Name||""),this.escapeCsvField(a.Description||"")].join(","))].join("\n"),i=`routing-destinations-${(new Date).toISOString().split("T")[0]}.csv`;(0,qn.mq)(o,i)}escapeCsvField(t){return t.includes(",")||t.includes('"')||t.includes("\n")||t.includes("\r")?`"${t.replace(/"/g,'""')}"`:t}edit(t){this.disabled||this.modalService.showDialog(Ec,{extensionPrompt:t,existingExtensions:this.value||[],agentNumber:this.agentNumber?.value}).pipe((0,x.Sf)(),(0,x.Tg)(this.modalService),(0,Gt.Q)(this.destroy$)).subscribe(o=>{if(o){this.value||(this.value=[]);const i=t?this.value.indexOf(t):-1;i>=0?this.value[i]=o:this.value.push(o),this.valueChanged(this.value.slice()),this.setDisplayedItems()}})}remove(t){this.value&&(this.valueChanged(this.value.filter(o=>o!==t)),this.setDisplayedItems())}getExtensionDisplay(t){return t&&t.Number?`${t.Number}${t.Name?" - "+t.Name:""}`:""}setDisplayedItems(){if(!this.value||0===this.value.length)return this.displayedItems=[],void this.cd.markForCheck();const t=this.searchControl.value?.toLowerCase().trim()||"";if(!t)return this.displayedItems=[...this.value],void this.cd.markForCheck();this.displayedItems=this.value.filter(o=>{const i=o.Number?.toLowerCase()||"",a=o.Name?.toLowerCase()||"",r=o.Description?.toLowerCase()||"";return i.includes(t)||a.includes(t)||r.includes(t)}),this.cd.markForCheck()}onPageChanged(t){this.currentPage=t.page,this.cd.markForCheck()}onItemsPerPageChanged(t){this.itemsPerPage=t,this.currentPage=1,this.cd.markForCheck()}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-extension-prompts"]],inputs:{disabled:"disabled",agentNumber:"agentNumber"},features:[e.Jv_([{provide:l.kq,multi:!0,useExisting:n}]),e.Vt3],decls:14,vars:11,consts:[["top-bar","",1,"button-group","flex-nowrap","ps-0"],["theme","primary","data-qa","btn-add",3,"click","disabled"],["data-qa","import-users","accept",".csv",3,"files"],["app-up-to-line-solid-icon",""],["data-qa","export-users","type","button",1,"btn","btn-primary",3,"click","disabled"],["app-arrow-from-bottom-solid-icon",""],[1,"flex-grow-1",2,"border-bottom","none",3,"formControl"],[1,"scrollable-table","mb-3"],[1,"table-header"],[1,"ps-0","col-size-300"],[1,"col-size-200"],[1,"actions"],[3,"pageChanged","itemsPerPageChanged","currentPage","itemsPerPage","totalItems","showBoundaryLinks","showPageSizes"],[1,"ps-0"],[1,"d-flex","align-items-center","gap-2"],[1,"line-clamp-1",3,"title"],[3,"title"],[1,"line-clamp-1"],[1,"p-0"],["role","menuitem"],["type","button","data-qa","edit",1,"dropdown-item",3,"click"],["type","button","data-qa","delete",1,"dropdown-item",3,"click"]],template:function(o,i){1&o&&(e.j41(0,"div",0)(1,"app-button-add",1),e.bIt("click",function(){return i.add()}),e.k0s(),e.j41(2,"app-select-file-button",2),e.bIt("files",function(r){return i.importExtensionPrompts(r)}),e.nrm(3,"span",3),e.j41(4,"span"),e.EFF(5),e.nI1(6,"translate"),e.k0s()(),e.j41(7,"button",4),e.bIt("click",function(){return i.exportExtensionPrompts()}),e.nrm(8,"span",5),e.j41(9,"span"),e.EFF(10),e.nI1(11,"translate"),e.k0s()(),e.nrm(12,"search-bar",6),e.k0s(),e.nVh(13,Dc,15,15)),2&o&&(e.R7$(),e.Y8G("disabled",i.disabled),e.R7$(4),e.JRh(e.bMT(6,7,"_i18n.Import")),e.R7$(2),e.Y8G("disabled",!i.value.length),e.R7$(3),e.Lme(" ",e.bMT(11,9,"_i18n.Export")," ",i.value.length?" ("+i.value.length+")":""," "),e.R7$(2),e.Y8G("formControl",i.searchControl),e.R7$(),e.vxM(i.value.length?13:-1))},dependencies:[Ce.j,He.I,Pe.u4,at.L,l.X1,l.BC,l.l_,Qn.O,jn.I,Vn.s,y.D9,N.P9],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}return n})();var Vc=p(6130);function Bc(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.ListContainsExtensionNumbersSameAsAgent"))}function Hc(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.ListContainsDuplicateDestinations"))}function Oc(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.DestinationNumberCannotBeLongerThan50"))}
1let Xc=(()=>{class n{agentNumber=(0,_.hFB)();form=_.hFB.required();subscription;constructor(){(0,s.QZP)(()=>{const t=this.form();this.subscription?.unsubscribe(),this.subscription=(0,T.jA)((0,T.XP)(t.controls.enableNameMatching),[t.controls.allowedExtensions])})}ngOnDestroy(){this.subscription?.unsubscribe()}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-agent-call-routing"]],inputs:{agentNumber:[1,"agentNumber"],form:[1,"form"]},decls:20,vars:16,consts:[[3,"formGroup"],["data-qa","extension-routing-fields"],["formControlName","enableNameMatching",3,"label","description"],["data-qa","allowed-extensions","type","text","formControlName","allowedExtensions",1,"col-lg-6",3,"label","placeholder"],[1,"my-3"],["data-qa","agent-call-routing-fields"],[1,"col-12"],[1,"fw-semibold"],[1,"form-text","mb-2","mt-0"],["formControlName","extensionPrompts","data-qa","extension-prompts",3,"agentNumber"],["controlName","extensionPrompts"],["valError","extensionPromptsAgentNumberConflict"],["valError","duplicateExtensionNumbers"],["valError","extensionNumberTooLong"]],template:function(o,i){1&o&&(e.qex(0,0),e.j41(1,"fieldset",1),e.nrm(2,"field-checkbox",2)(3,"field-input",3),e.nI1(4,"enlExample"),e.nI1(5,"async"),e.k0s(),e.nrm(6,"hr",4),e.j41(7,"fieldset",5)(8,"field-wrapper",6)(9,"label",7),e.EFF(10),e.nI1(11,"translate"),e.k0s(),e.j41(12,"div",8),e.EFF(13),e.nI1(14,"translate"),e.k0s(),e.nrm(15,"app-extension-prompts",9),e.j41(16,"val-errors",10),e.DNE(17,Bc,2,3,"ng-template",11)(18,Hc,2,3,"ng-template",12)(19,Oc,2,3,"ng-template",13),e.k0s()()(),e.bVm()),2&o&&(e.Y8G("formGroup",i.form()),e.R7$(2),e.Y8G("label","_i18n.CallByName")("description","_i18n.CallByNameDescription"),e.R7$(),e.Y8G("label","_i18n.ExcludeExtensions")("placeholder",e.bMT(5,10,e.bMT(4,8,"_i18n.ExcludeExtensionsPlaceholder"))),e.R7$(7),e.JRh(e.bMT(11,12,"_i18n.RouteByTopic")),e.R7$(3),e.JRh(e.bMT(14,14,"_i18n.RoutingDestinationsDescription")),e.R7$(2),e.Y8G("agentNumber",i.agentNumber()))},dependencies:[l.X1,l.BC,l.cb,l.j4,l.JD,ie.t,te.m,Z.z,$.IH,jc,$.VI,y.D9,Vc.C,N.Jj],encapsulation:2,changeDetection:0})}return n})(),Qc=(()=>{class n{form=_.hFB.required();isPersonalAssistant=_.hFB.required();lab=(0,We.D)();static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-agent-options"]],inputs:{form:[1,"form"],isPersonalAssistant:[1,"isPersonalAssistant"]},decls:8,vars:7,consts:[[3,"formGroup"],["data-qa","caller-behavior-fields"],[1,"row"],["formControlName","abusiveCallerAction","data-qa","abusive-caller-action",1,"col-lg-12",3,"showValidation","label"],["controlName","abusiveCallerAction"],["formControlName","callerDoesNotRespondAction","data-qa","does-not-respond-action",1,"col-lg-12",3,"showValidation","label"],["controlName","callerDoesNotRespondAction"],["formControlName","checkStatusBeforeTransfer",1,"col-lg-12",3,"label","description"]],template:function(o,i){1&o&&(e.qex(0,0),e.j41(1,"fieldset",1)(2,"div",2)(3,"app-agent-routing-rule",3),e.nrm(4,"val-errors",4),e.k0s(),e.j41(5,"app-agent-routing-rule",5),e.nrm(6,"val-errors",6),e.k0s()(),e.nrm(7,"field-checkbox",7),e.k0s(),e.bVm()),2&o&&(e.Y8G("formGroup",i.form()),e.R7$(3),e.Y8G("showValidation",!0)("label","_i18n.IfCallerIsAbusiveOrFrustrated"),e.R7$(2),e.Y8G("showValidation",!0)("label","_i18n.IfCallerDoesNotRespond"),e.R7$(2),e.Y8G("label","_i18n.EnableBusyCheckBeforeTransfer")("description","_i18n.EnableBusyCheckBeforeTransferDescription"))},dependencies:[l.X1,l.BC,l.cb,l.j4,l.JD,l.YN,ie.t,$.IH,Jn],encapsulation:2,changeDetection:0})}return n})();const Lc=["tabset"];function Wc(n,c){if(1&n&&(e.nrm(0,"app-tab-heading",13),e.nI1(1,"async")),2&n){const t=e.XpG();e.Y8G("label","_i18n.AgentInfo")("invalid",e.bMT(1,2,t.getAgentInfoControls()))}}function Yc(n,c){if(1&n&&(e.nrm(0,"app-tab-heading",13),e.nI1(1,"async")),2&n){const t=e.XpG();e.Y8G("label","_i18n.AgentType")("invalid",e.bMT(1,2,t.getAgentTypeControls()))}}function Jc(n,c){if(1&n&&(e.nrm(0,"app-tab-heading",13),e.nI1(1,"async")),2&n){const t=e.XpG(3);e.Y8G("label","_i18n.CallScreening")("invalid",e.bMT(1,2,t.getCallScreeningControls()))}}function qc(n,c){if(1&n&&(e.j41(0,"tab",14),e.DNE(1,Jc,2,4,"ng-template",3),e.nrm(2,"app-agent-call-screening",16),e.k0s()),2&n){const t=e.XpG(2);e.Y8G("tabOrder",3),e.R7$(2),e.Y8G("form",t.f.agentSettings)("agentNumber",t.f.number)("isPersonalAssistant",t.isPersonalAssistant)}}function Uc(n,c){if(1&n&&(e.nrm(0,"app-tab-heading",13),e.nI1(1,"async")),2&n){const t=e.XpG(3);e.Y8G("label","_i18n.CallRouting")("invalid",e.bMT(1,2,t.getCallRoutingControls()))}}function zc(n,c){if(1&n&&(e.j41(0,"tab",15),e.DNE(1,Uc,2,4,"ng-template",3),e.nrm(2,"app-agent-call-routing",17),e.k0s()),2&n){const t=e.XpG(2);e.Y8G("tabOrder",3),e.R7$(2),e.Y8G("form",t.f.agentSettings)("agentNumber",t.f.number)}}
1function Kc(n,c){if(1&n&&e.nVh(0,qc,3,4,"tab",14)(1,zc,3,3,"tab",15),2&n){const t=e.XpG();e.vxM(t.isPersonalAssistant?0:1)}}function Zc(n,c){if(1&n&&(e.nrm(0,"app-tab-heading",13),e.nI1(1,"async")),2&n){const t=e.XpG();e.Y8G("label","_i18n.BlockSpamCalls")("invalid",e.bMT(1,2,t.getSpamCallsControls()))}}function ed(n,c){if(1&n&&(e.nrm(0,"app-tab-heading",13),e.nI1(1,"async")),2&n){const t=e.XpG();e.Y8G("label","_i18n.Options")("invalid",e.bMT(1,2,t.getAgentOptionsControls()))}}function td(n,c){if(1&n&&(e.nrm(0,"app-tab-heading",13),e.nI1(1,"async")),2&n){const t=e.XpG();e.Y8G("label","_i18n.AgentInstructions")("invalid",e.bMT(1,2,t.getAgentInstructionsControls()))}}let zn=(()=>{class n{xapiErrors=(0,s.WQX)(K.Ko);cd=(0,s.WQX)(_.gRc);usersApiService=(0,s.WQX)(Ye.u);route=(0,s.WQX)(S.nX);location=(0,s.WQX)(Wn.aZ);router=(0,s.WQX)(S.Ix);destroy$=(0,s.WQX)(s.abz);aiApiService=(0,s.WQX)(de);peersApiService=(0,s.WQX)(Ln.L);resources;tabset;pbxAgent;membershipSelectGroups;form;userGeneral;groupIds=new l.MJ([],{nonNullable:!0,validators:[l.k0.required]});isNew;id;isEnterprise;templateName;showValidation=!1;allowedRoles=[];params;systemParameters=this.route.snapshot.data.systemParameters||{};lab=(0,We.D)();navigateBackToTab;autoSubmitted=!1;get f(){return this.form.controls}get agentSettings(){return this.f.agentSettings.controls}get systemPrompt(){return this.agentSettings.systemPrompt}get agentType(){return this.agentSettings.type}get isPersonalAssistant(){return"personalassistant"===this.agentType.value||Rt(this.pbxAgent)}get isSupportAgent(){return"support"===this.agentType.value}get clickToCallId(){return this.f.clickToCallId}get extensionPrompts(){return this.agentSettings.extensionPrompts}get isPristine(){return this.form.pristine&&!this.userGeneral?.didSelect?.touched&&!this.autoSubmitted&&this.groupIds.pristine}get primaryGroupId(){return this.f.primaryGroupId}constructor(){const o=this.destroy$;this.route.data.pipe((0,R.pQ)(o)).subscribe(i=>{this.initUser(i)}),this.groupIds.valueChanges.pipe((0,R.pQ)(o)).subscribe(i=>{const a=i[0];a!==this.primaryGroupId.value&&this.primaryGroupId.setValue(a??null)})}initPaDepartmentSelectionFlow(t,o){this.isPersonalAssistant?(this.membershipSelectGroups=o?o.map(a=>({Id:a.GroupID,Name:a.Name,IsPrimaryBossGroup:a.IsPrimary})):[],this.agentSettings.phonebookOverride.valueChanges.pipe((0,R.pQ)(this.destroy$),(0,I.n)(a=>se.Q.isNullOrEmpty(a?.Number)?(0,M.of)({MemberOf:[]}):this.peersApiService.getPeerByNumber({number:a?.Number??"",$expand:["MemberOf($select=Name,Number,GroupId,IsPrimary)"]})),(0,A.W)(a=>(this.xapiErrors.error(this.cd,a,this.xapiErrorCheckForms,!0,!0),(0,M.of)({MemberOf:[]})))).subscribe(a=>{this.groupIds.setValue([]),this.membershipSelectGroups=a.MemberOf?.map(r=>({Id:r.GroupID,Name:r.Name,IsPrimaryBossGroup:r.IsPrimary}))??[]})):this.membershipSelectGroups=t}initUser(t){this.id=this.route.snapshot.params.id;const o=t.systemParameters;this.params=t.params,this.isNew=!this.id;let i=null;const a=t.resources;if(this.isNew){const g=this.route.snapshot.params.templateId,C=a?.Templates?.find(f=>f.Id===g);this.pbxAgent=function ml(n,c){return{AgentSettings:Xn(n,c),Groups:[]}}(g,C?.FirstMessage),this.templateName=C?.Name}else{const g=t.agent;i=g.BossAvailableGroups,this.pbxAgent=g.Agent,this.templateName=a?.Templates?.find(C=>C.Id===this.pbxAgent.AgentSettings?.AgentType)?.Name}this.isEnterprise=t.isEnterprise;const r=t.trunksGroups;this.groupIds.setValue((this.pbxAgent.Groups?.filter(ge.O).filter(ge.ps).map(g=>({Id:g.GroupId,Name:g.Name}))??[]).map(g=>g.Id));const u=(this.pbxAgent.Number||"")===t.myUser,m=Qe.YK.find(g=>g.Id===t.myRole)??Qe.BV;this.form=function dl(n,c,t,o){const i=function sl(n,c){return n?c?"external-only":"all":"off"}(n.RecordCalls,n.RecordExternalCallsOnly);return new l.gE({...(0,ge.hb)(n,o),clickToCallId:new l.MJ({value:n.ClickToCallId??"",disabled:!1},{nonNullable:!0,validators:[V.WM]}),recordingOption:new l.MJ({value:i,disabled:!1},{nonNullable:!0}),rights:(0,ge.zb)(n,c),agentSettings:cl(n)},{validators:[Hn.l]})}(this.pbxAgent,r,0,o.ENLRange),this.initPaDepartmentSelectionFlow(r,i),this.allowedRoles=u?[m]:Qe.YK.filter(g=>g.Id!==Qe.gj&&m.CanControl.includes(g.Id)),this.isNew||(this.form.markAllAsTouched(),this.groupIds.markAsTouched(),this.showValidation=!0),this.cd.markForCheck()}getAgentInfoControls(){return(0,_e.S)([this.f.number,this.f.firstName,this.f.lastName,this.f.primaryGroupId,this.f.clickToCallId,this.agentSettings.voice,this.agentSettings.maxCallDuration,this.groupIds])}getAgentTypeControls(){return(0,_e.S)([this.agentSettings.type,this.agentSettings.knowledgeBase,this.agentSettings.language,this.agentSettings.switchLanguage,this.agentSettings.firstMessage])}getAgentInstructionsControls(){return(0,_e.S)([this.agentSettings.systemPrompt])}
1getSpamCallsControls(){return(0,_e.S)([this.agentSettings.spamAction,this.agentSettings.spamInstructions])}getAgentOptionsControls(){return(0,_e.S)([this.agentSettings.abusiveCallerAction,this.agentSettings.callerDoesNotRespondAction])}getCallScreeningControls(){return(0,_e.S)([this.agentSettings.checkStatusBeforeTransfer,this.agentSettings.bossInterruptionSettings])}getCallRoutingControls(){return(0,_e.S)([this.agentSettings.extensionPrompts])}activateInvalidTab(){const t=[this.getAgentInfoControls(),this.getAgentTypeControls(),this.isPersonalAssistant?this.getCallScreeningControls():this.getCallRoutingControls(),this.getSpamCallsControls(),this.getAgentOptionsControls(),this.getAgentInstructionsControls()];(0,_e.q)(this.tabset,t)}navigateToUserList(){this.location.back()}createOrUpdateUser$(t){if(this.isNew)return this.usersApiService.createUser({pbxUser:t});const o=+this.id;return(this.form.pristine&&!this.groupIds.touched?(0,M.of)(void 0):this.usersApiService.updateUser({id:o,pbxUser:t})).pipe((0,v.T)(()=>({...t,Id:o})))}makeAgentToSave(t){const o=this.form.value,i=this.isPersonalAssistant?this.membershipSelectGroups.find(a=>a.IsPrimaryBossGroup):null;return function ul(n,c,t,o){const i=n.rights.filter(m=>c.includes(m.groupId)).map(m=>(0,ge.Cq)(m,"users",!0)),a=i.find(m=>m.GroupId===o),r=a?a.GroupId:n.primaryGroupId??i[0]?.GroupId,{enabled:d,externalOnly:u}=function ll(n){return{enabled:"all"===n||"external-only"===n,externalOnly:"external-only"===n}}(n.recordingOption);return{Groups:i,CallUsRequirement:al.n.Both,ClickToCallId:n.clickToCallId??"",WebMeetingFriendlyName:n.clickToCallId??"",FirstName:n.firstName,LastName:n.lastName,Number:n.number,PrimaryGroupId:r,RecordCalls:d,RecordExternalCallsOnly:u,AgentSettings:pl(n.agentSettings,t),AIAgent:!0,Enable2FA:!1,Require2FA:!1,SendEmailMissedCalls:!1,CallUsEnableChat:!0,AllowOwnRecordings:!1,Internal:!0,VMEnabled:!1,BlockTunnel:!0,GoogleContactsEnabled:!1,GoogleCalendarEnabled:!1,MS365ContactsEnabled:!1,MS365CalendarEnabled:!1,MS365SignInEnabled:!1,MS365TeamsEnabled:!1,GoogleSignInEnabled:!1,PinProtectTimeout:60,PbxDeliversAudio:!0,Hours:{Type:"AllHours"},BreakTime:{Type:"AllHours"},CallUsRequirement:"Both",CallUsEnablePhone:!0,CallUsEnableVideo:!1,AllowLanOnly:!0,ForwardingProfiles:[{Name:"Away",CustomName:"",CustomMessage:"",BlockPushCalls:!1,RingMyMobile:!1,AcceptMultipleCalls:!0,OfficeHoursAutoQueueLogOut:!0,DisableRingGroupCalls:!0,NoAnswerTimeout:20,AvailableRoute:null,AwayRoute:{AllHoursInternal:!0,AllHoursExternal:!0,External:{External:"",To:"None",Number:"",Tags:[]},Internal:{External:"",To:"None",Number:"",Tags:[]}}},{Name:"Out of office",CustomName:"",CustomMessage:"",BlockPushCalls:!1,RingMyMobile:!1,AcceptMultipleCalls:!0,OfficeHoursAutoQueueLogOut:!1,DisableRingGroupCalls:!1,NoAnswerTimeout:20,AvailableRoute:null,AwayRoute:{AllHoursInternal:!0,AllHoursExternal:!0,External:{External:"",To:"None",Number:"",Tags:[]},Internal:{External:"",To:"None",Number:"",Tags:[]}}},{Name:"Custom 1",CustomName:"",CustomMessage:"",BlockPushCalls:!1,RingMyMobile:!1,AcceptMultipleCalls:!0,OfficeHoursAutoQueueLogOut:!1,DisableRingGroupCalls:!1,NoAnswerTimeout:20,AvailableRoute:{NoAnswerAllCalls:!1,BusyAllCalls:!1,NotRegisteredAllCalls:!1,NoAnswerInternal:{External:"",To:"None",Number:"",Tags:[]},NoAnswerExternal:{External:"",To:"None",Number:"",Tags:[]},BusyInternal:{External:"",To:"None",Number:"",Tags:[]},BusyExternal:{External:"",To:"None",Number:"",Tags:[]},NotRegisteredInternal:{External:"",To:"None",Number:"",Tags:[]},NotRegisteredExternal:{External:"",To:"None",Number:"",Tags:[]}},AwayRoute:null},{Name:"Custom 2",CustomName:"",CustomMessage:"",BlockPushCalls:!1,RingMyMobile:!1,AcceptMultipleCalls:!0,OfficeHoursAutoQueueLogOut:!0,DisableRingGroupCalls:!0,NoAnswerTimeout:20,AvailableRoute:null,AwayRoute:{AllHoursInternal:!0,AllHoursExternal:!0,External:{External:"",To:"None",Number:"",Tags:[]},Internal:{External:"",To:"None",Number:"",Tags:[]}}},{Name:"Available",CustomName:"",CustomMessage:"",BlockPushCalls:!0,RingMyMobile:!1,AcceptMultipleCalls:!0,OfficeHoursAutoQueueLogOut:!1,DisableRingGroupCalls:!1,NoAnswerTimeout:280,AvailableRoute:{NoAnswerAllCalls:!1,BusyAllCalls:!1,NotRegisteredAllCalls:!1,NoAnswerInternal:{External:"",To:"None",Number:"",Tags:[]},NoAnswerExternal:{External:"",To:"None",Number:"",Tags:[]},BusyInternal:{External:"",To:"None",Number:"",Tags:[]},BusyExternal:{External:"",To:"None",Number:"",Tags:[]},NotRegisteredInternal:{External:"",To:"None",Number:"",Tags:[]},NotRegisteredExternal:{External:"",To:"None",Number:"",Tags:[]}},AwayRoute:null}]}}(o,this.groupIds.value,t,i?.Id)}onError(t){this.xapiErrors.error(this.cd,t,this.xapiErrorCheckForms,!0,!0,this.xapiErrorTargetModifier),this.onValidation()}get xapiErrorCheckForms(){return[this.form]}xapiErrorTargetModifier=t=>t.replace(/^WebMeetingFriendlyName$/i,"clickToCallId");onValidation(){this.showValidation=!0,this.groupIds.markAsTouched(),this.activateInvalidTab(),this.navigateBackToTab=void 0}save$=()=>{const t=this.f.number.value,o=this.agentSettings.extensionPrompts.value;if(t&&o?.some(a=>a.Number===t))return this.agentSettings.extensionPrompts.setErrors({extensionPromptsAgentNumberConflict:!0}),this.onValidation(),E.w;const i=this.systemPrompt.value;return i&&""!==i.trim()?this.aiApiService.getAITemplateContents({id:this.agentType.value??"receptionist"}).pipe((0,v.T)(a=>a?.value??""),(0,v.T)(a=>this.makeAgentToSave(!se.Q.equalsNormalized(this.systemPrompt.value,a))),(0,I.n)(a=>
1this.createOrUpdateUser$(a)),(0,x.Pr)("_i18n.UserNotFoundErrorMessage",this.pbxAgent.DisplayName),(0,v.T)(a=>({Id:a.Id})),(0,I.n)(({Id:a})=>{if(this.userGeneral.didSelect.save(a),this.navigateBackToTab){const r={tab:this.navigateBackToTab.tab,...this.navigateBackToTab.queryParams};return this.navigateBackToTab=void 0,this.autoSubmitted=!0,this.router.navigate(this.isNew?["..","edit",a]:[],{queryParams:r,relativeTo:this.route,replaceUrl:!0})}return this.navigateToUserList(),E.w}),(0,A.W)(a=>(this.onError(a),E.w))):(this.systemPrompt.setErrors({required:!0}),this.onValidation(),E.w)};static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["ng-component"]],viewQuery:function(o,i){if(1&o&&e.GBs(Lc,7)(Yn,5),2&o){let a;e.mGM(a=e.lsd())&&(i.tabset=a.first),e.mGM(a=e.lsd())&&(i.userGeneral=a.first)}},inputs:{resources:"resources"},features:[e.Jv_([Jt])],decls:21,vars:37,consts:[["tabset",""],["helpUrl","_i18n.AIGuideUri",3,"back","showValidation","header","isNewEntity","formGroup","invalid","saveDisabledByReason","waitRecalculationsBeforeSave","save$","pristine"],["id","agent-info",3,"tabOrder"],["tabHeading",""],[3,"form","agentSettingsForm","dn","initFriendlyName","groupIds","clickToCallId","id","groups","voiceOptions","isPersonalAssistant","allowedRoles","extensionNumberLength","params"],["id","agent-type",3,"tabOrder"],[3,"templates","agentSettings"],["id","spam-calls",3,"tabOrder"],[3,"form"],["id","agent-options",3,"tabOrder"],[3,"form","isPersonalAssistant"],["id","agent-instructions",3,"tabOrder"],[3,"agentSettings"],[3,"label","invalid"],["id","agent-call-screening",3,"tabOrder"],["id","agent-call-routing",3,"tabOrder"],[3,"form","agentNumber","isPersonalAssistant"],[3,"form","agentNumber"]],template:function(o,i){1&o&&(e.j41(0,"edit-panel",1),e.nI1(1,"translate"),e.nI1(2,"translate"),e.bIt("back",function(){return i.navigateToUserList()})("showValidation",function(){return i.onValidation()}),e.j41(3,"tabset",null,0)(5,"tab",2),e.DNE(6,Wc,2,4,"ng-template",3),e.nrm(7,"app-agent-info",4),e.k0s(),e.j41(8,"tab",5),e.DNE(9,Yc,2,4,"ng-template",3),e.nrm(10,"app-agent-type",6),e.k0s(),e.nVh(11,Kc,2,1),e.j41(12,"tab",7),e.DNE(13,Zc,2,4,"ng-template",3),e.nrm(14,"app-block-spam-calls",8),e.k0s(),e.j41(15,"tab",9),e.DNE(16,ed,2,4,"ng-template",3),e.nrm(17,"app-agent-options",10),e.k0s(),e.j41(18,"tab",11),e.DNE(19,td,2,4,"ng-template",3),e.nrm(20,"app-agent-instructions",12),e.k0s()()()),2&o&&(e.Y8G("header",i.isNew?e.bMT(1,33,"_i18n.AddAIAgent")+(i.templateName?" "+i.templateName:""):e.bMT(2,35,"_i18n.EditAIAgent")+" "+(i.templateName||"")+" "+i.pbxAgent.Number)("isNewEntity",i.isNew)("formGroup",i.form)("invalid",i.form.invalid||i.groupIds.invalid)("saveDisabledByReason",i.isEnterprise?"":"_i18n.AvailableEnt")("waitRecalculationsBeforeSave",!0)("save$",i.save$)("pristine",i.isPristine),e.R7$(5),e.Y8G("tabOrder",1),e.R7$(2),e.Y8G("form",i.form)("agentSettingsForm",i.f.agentSettings)("dn",i.pbxAgent.Number)("initFriendlyName",i.isNew)("groupIds",i.groupIds)("clickToCallId",i.clickToCallId)("id",i.pbxAgent.Id)("groups",i.membershipSelectGroups)("voiceOptions",i.resources.Voices)("isPersonalAssistant",i.isPersonalAssistant)("allowedRoles",i.allowedRoles)("extensionNumberLength",i.systemParameters.ENLRange)("params",i.systemParameters),e.R7$(),e.Y8G("tabOrder",2),e.R7$(2),e.Y8G("templates",i.resources.Templates)("agentSettings",i.f.agentSettings),e.R7$(),e.vxM(i.isSupportAgent?-1:11),e.R7$(),e.Y8G("tabOrder",4),e.R7$(2),e.Y8G("form",i.f.agentSettings),e.R7$(),e.Y8G("tabOrder",5),e.R7$(2),e.Y8G("form",i.f.agentSettings)("isPersonalAssistant",i.isPersonalAssistant),e.R7$(),e.Y8G("tabOrder",6),e.R7$(2),e.Y8G("agentSettings",i.f.agentSettings))},dependencies:[ne.Q,cc,gc,l.X1,l.cb,l.j4,Ne.fw,Ne.V6,Ne.Bh,qt.b,Yn,Ac,$c,Xc,Qc,y.D9,N.Jj],encapsulation:2,changeDetection:0})}return n})();var Kn=p(39183),Zn=p(31751),ei=p(41658);const At=()=>{const n=(0,s.WQX)(de),c=(0,s.WQX)(fe.s);return n.getAIResources().pipe((0,A.W)(t=>c.handleError(t)))};var id=p(74198),od=p(81783);const ad=()=>[".."];function rd(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n){e.XpG();const t=e.r8f(1);e.SpI(" (",e.bMT(1,1,t),") ")}}function sd(n,c){if(1&n&&(e.EFF(0),e.SS7(1),e.nVh(2,rd,2,3)),2&n){const t=e.XpG();e.SpI(" ",t.f.RealtimeModel.value," "),e.R7$();const o=e.bH3(t.aiModelOptionSuffix(t.f.RealtimeModel.value,t.realTimeModels,!0));e.R7$(),e.vxM(o?2:-1)}}function ld(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n){e.XpG();const t=e.r8f(2);e.SpI(" (",e.bMT(1,1,t),") ")}}function cd(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate"),e.SS7(2),e.nVh(3,ld,2,3)),2&n){const t=c.item,o=e.XpG();e.SpI(" ",e.bMT(1,2,t.label)," "),e.R7$(2);const i=e.bH3(o.aiModelOptionSuffix(t.value,o.realTimeModels,!1));e.R7$(),e.vxM(i?3:-1)}}function dd(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n){e.XpG();const t=e.r8f(1);e.SpI(" (",e.bMT(1,1,t),") ")}}function pd(n,c){if(1&n&&(e.EFF(0),e.SS7(1),e.nVh(2,dd,2,3)),2&n){const t=e.XpG();e.SpI(" ",t.f.CompletionModel.value," "),e.R7$();const o=e.bH3(t.aiModelOptionSuffix(t.f.CompletionModel.value,t.models,!0));e.R7$(),e.vxM(o?2:-1)}}function ud(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n){e.XpG();const t=e.r8f(2);e.SpI(" (",e.bMT(1,1,t),") ")}}function md(n,c){if(1&n&&(e.EFF(0),e.nI1(1,"translate"),e.SS7(2),e.nVh(3,ud,2,3)),2&n){const t=c.item,o=e.XpG();e.SpI(" ",e.bMT(1,2,t.label)," "),e.R7$(2);const i=e.bH3(o.aiModelOptionSuffix(t.value,o.models,!1));e.R7$(),e.vxM(i?3:-1)}}let fd=(()=>{class n{aiSettings=(0,s.WQX)(de);xapiErrorService=(0,s.WQX)(K.Ko);cd=(0,s.WQX)(_.gRc);route=(0,s.WQX)(S.nX);router=(0,s.WQX)(S.Ix);
1routeData=this.route.snapshot.data;lab=(0,We.D)();form;models=[];realTimeModels=[];resources;isEnterprise=!0;saveDisabledReason="";ngOnInit(){const t=this.route.snapshot.data;this.resources=t.resources,this.isEnterprise=t.isEnterprise;const o=t.settings;this.models=this.resources.Models?.filter(i=>this.lab()||!i.Preview).map(i=>({value:i.Id,label:i.Name}))??[],this.realTimeModels=this.resources.RealtimeModels?.filter(i=>this.lab()||!i.Preview).map(i=>({value:i.Id,label:i.Name}))??[],this.form=new l.gE({APIKey:new l.MJ(o?.APIKey??null),CompletionModel:new l.MJ(se.Q.isNullOrEmpty(o?.CompletionModel)?this.models[0]?.value??null:o?.CompletionModel),RealtimeModel:new l.MJ(se.Q.isNullOrEmpty(o?.RealtimeModel)?this.realTimeModels[0]?.value??null:o?.RealtimeModel),CompanyDescription:new l.MJ(o?.CompanyDescription??"",{validators:[l.k0.maxLength(255)]}),CompanyName:new l.MJ(o?.CompanyName??"",{validators:[l.k0.maxLength(50)]})}),this.isEnterprise||(this.saveDisabledReason="_i18n.AvailableEnt"),this.cd.markForCheck()}get f(){return this.form.controls}aiModelOptionSuffix=mn;save$=()=>this.form?this.aiSettings.updateAISettings({pbxAISettings:this.form.value}).pipe((0,P.M)(()=>this.navigateBack()),(0,A.W)(t=>{if(this.xapiErrorService.error(this.cd,t,this.form,!1,!1))return E.w;throw t})):E.w;navigateBack(){this.router.navigate([".."],{relativeTo:this.route})}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-open-ai-config"]],decls:53,vars:54,consts:[[3,"formGroup","isNewEntity","save$","saveDisabledByReason","saveDisabledByReasonView","helpUrl","backRouterLink","header"],[1,"row"],[1,"col-lg-8","mb-4"],["href","https://www.3cx.com/docs/ai-agent-configuration","target","_blank",1,"dashed_link"],["href","https://platform.openai.com/","target","_blank",1,"dashed_link"],[1,"col-lg-8"],["data-qa","api-key","formControlName","APIKey",3,"label","description","maxlength"],["href","https://platform.openai.com/docs/pricing#audio-tokens","target","_blank",1,"dashed_link"],["data-qa","realtime-model",3,"description"],["data-qa","open-ai-real-time-tasks","formControlName","RealtimeModel","bindValue","value",1,"flex-grow-1",3,"items","clearable","searchable"],["ng-label-tmp",""],["ng-option-tmp",""],["href","https://platform.openai.com/docs/pricing#text-tokens","target","_blank",1,"dashed_link"],["data-qa","completion-model",3,"description"],["data-qa","open-ai-for-tasks","formControlName","CompletionModel","bindValue","value",1,"flex-grow-1",3,"items","clearable","searchable"],["data-qa","company-name","formControlName","CompanyName",3,"label","description"],["controlName","CompanyName"],["data-qa","company-description-wrapper","label","_i18n.CompanyDescription","description","_i18n.CompanyDescriptionDescription",1,"col-lg-8"],["rows","3","data-qa","company-description","formControlName","CompanyDescription",1,"form-control"],["controlName","CompanyDescription"]],template:function(o,i){1&o&&(e.j41(0,"edit-panel",0),e.nI1(1,"translate"),e.j41(2,"div",1)(3,"div",2)(4,"span"),e.EFF(5),e.nI1(6,"translate"),e.nrm(7,"br"),e.j41(8,"a",3),e.EFF(9),e.nI1(10,"translate"),e.k0s(),e.EFF(11," | "),e.j41(12,"a",4),e.EFF(13),e.nI1(14,"translate"),e.k0s()()()(),e.j41(15,"div",1)(16,"div",5),e.nrm(17,"field-input-concealed-password",6),e.k0s()(),e.j41(18,"div",1)(19,"div",5)(20,"span"),e.EFF(21),e.nI1(22,"translate"),e.j41(23,"a",7),e.EFF(24),e.nI1(25,"translate"),e.k0s()(),e.j41(26,"field-wrapper",8)(27,"ng-select",9),e.DNE(28,sd,3,3,"ng-template",10)(29,cd,4,5,"ng-template",11),e.k0s()()()(),e.j41(30,"div",1)(31,"div",5)(32,"span"),e.EFF(33),e.nI1(34,"translate"),e.j41(35,"a",12),e.EFF(36),e.nI1(37,"translate"),e.k0s()(),e.j41(38,"field-wrapper",13),e.nI1(39,"translate"),e.j41(40,"ng-select",14),e.DNE(41,pd,3,3,"ng-template",10)(42,md,4,5,"ng-template",11),e.k0s()()()(),e.j41(43,"div",1)(44,"div",5)(45,"field-input",15),e.nI1(46,"translate"),e.nI1(47,"translate"),e.nrm(48,"val-errors",16),e.k0s()()(),e.j41(49,"div",1)(50,"field-wrapper",17),e.nrm(51,"textarea",18)(52,"val-errors",19),e.k0s()()()),2&o&&(e.Y8G("formGroup",i.form)("isNewEntity",!1)("save$",i.save$)("saveDisabledByReason",i.saveDisabledReason)("saveDisabledByReasonView","header")("helpUrl",i.routeData.helpUri)("backRouterLink",e.lJ4(53,ad))("header",e.bMT(1,31,i.routeData.navTitle)),e.R7$(5),e.JRh(e.bMT(6,33,"_i18n.OpenAIIntegrationDescription")),e.R7$(4),e.JRh(e.bMT(10,35,"_i18n.StepByStepGuide")),e.R7$(4),e.JRh(e.bMT(14,37,"_i18n.OpenAIConsole")),e.R7$(4),e.Y8G("label","_i18n.OpenAIAPIKey")("description","_i18n.OpenAIAPIKeyDescription")("maxlength",255),e.R7$(4),e.SpI(" ",e.bMT(22,39,"_i18n.OpenAIModelForRealTimeTasks")," | "),e.R7$(3),e.JRh(e.bMT(25,41,"_i18n.Pricing")),e.R7$(2),e.Y8G("description","_i18n.OpenAIModelForRealTimeTasksDescription"),e.R7$(),e.Y8G("items",i.realTimeModels)("clearable",!1)("searchable",!1),e.R7$(6),e.SpI(" ",e.bMT(34,43,"_i18n.OpenAIModelForTasks")," | "),e.R7$(3),e.JRh(e.bMT(37,45,"_i18n.Pricing")),e.R7$(2),e.Y8G("description",e.mNQ(e.bMT(39,47,"_i18n.OpenAIModelForTasksDescription"))),e.R7$(2),e.Y8G("items",i.models)("clearable",!1)("searchable",!1),e.R7$(5),e.Y8G("label",e.mNQ(e.bMT(46,49,"_i18n.CompanyName")))("description",e.mNQ(e.bMT(47,51,"_i18n.CompanyNameDescription"))))},dependencies:[ne.Q,l.X1,l.me,l.BC,l.cb,l.tU,l.j4,l.JD,Ue.p,te.m,Z.z,Q.vr,Q.ZZ,Q.Uq,$.IH,y.D9],encapsulation:2,changeDetection:0})}return n})();var hd=p(5739),ti=p(81546),ni=p(61594);let ii=(()=>{class n{text="_i18n.Refresh";disabled;theme="primary";loader;RefreshCw=tn.e9t;static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-button-refresh"]],inputs:{text:"text",disabled:"disabled",theme:"theme",loader:"loader"},decls:1,vars:5,consts:[["data-qa","refresh",3,"disabled","theme","icon","text","loader"]],template:function(o,i){1&o&&e.nrm(0,"app-button",0),2&o&&e.Y8G("disabled",i.disabled)("theme",i.theme)("icon",i.RefreshCw)("text",i.text)("loader",i.loader)},dependencies:[en.Q],encapsulation:2,changeDetection:0})}return n})();const Cd=()=>[],bd=(n,c)=>c.Id;function _d(n,c){if(1&n){const t=e.RV6();e.j41(0,"tr",13),e.bIt("click",function(i){const a=s.eBV(t).$implicit,r=e.XpG(2);return s.Njj(r.onClick(i,a))}),e.j41(1,"td",14)(2,"span",15),e.EFF(3),e.nI1(4,"translate"),e.k0s()(),e.j41(5,"td",16)(6,"span",15),e.EFF(7),e.k0s()(),e.j41(8,"td",17),e.EFF(9),e.k0s(),e.j41(10,"td",18),e.EFF(11),e.nI1(12,"date"),e.k0s(),e.j41(13,"td",19)(14,"span",15),e.EFF(15),e.k0s()(),e.j41(16,"td",20),e.EFF(17),e.nI1(18,"translate"),e.k0s(),e.j41(19,"td",21)(20,"row-action-button",22)(21,"li",23)(22,"button",24),e.bIt("click",function(i){const a=s.eBV(t).$implicit,r=e.XpG(2);return s.Njj(r.routeToKnowledgeBaseEditor(i,a))}),e.EFF(23),e.nI1(24,"translate"),e.k0s()(),e.j41(25,"li",23)(26,"button",25),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG(2);return s.Njj(a.deleteItem(i))}),e.EFF(27),e.nI1(28,"translate"),e.k0s()()()()()}if(2&n){const t=c.$implicit,o=e.XpG(2);e.R7$(2),e.Y8G("title",t.Name),e.R7$(),e.JRh(t.Name??e.bMT(4,11,"_i18n.UntitledStore")),e.R7$(3),e.Y8G("title",t.Id),e.R7$(),e.JRh(t.Id),e.R7$(2),e.JRh(o.formatSize(t.Bytes??void 0)),e.R7$(2),e.JRh(e.bMT(12,13,t.CreatedAt)),e.R7$(3),e.Y8G("title",t.Description),e.R7$(),e.JRh(t.Description??"-"),e.R7$(2),e.JRh(o.getExpiration(null==t?null:t.Expiration)??e.bMT(18,15,"_i18n.Never")),e.R7$(6),e.SpI(" ",e.bMT(24,17,"_i18n.Edit")," "),e.R7$(4),e.SpI(" ",e.bMT(28,19,"_i18n.Delete")," ")}}function vd(n,c){if(1&n){const t=e.RV6();e.j41(0,"tr")(1,"td",26)(2,"div",27)(3,"button",28),e.bIt("click",function(){s.eBV(t);const i=e.XpG(),a=e.XpG();return s.Njj(a.loadMore(i))}),e.EFF(4),e.nI1(5,"translate"),e.k0s()()()()}2&n&&(e.R7$(4),e.SpI(" ",e.bMT(5,1,"_i18n.LoadMore")," "))}function Sd(n,c){1&n&&(e.j41(0,"tr")(1,"td",26)(2,"div",27),e.nrm(3,"div",29),e.k0s()()())}function Td(n,c){if(1&n&&(e.Z7z(0,_d,29,21,"tr",12,bd),e.nVh(2,vd,6,3,"tr")(3,Sd,4,0,"tr")),2&n){const t=c,o=e.XpG();e.Dyx(o.getVisibleItems(t.Items??e.lJ4(1,Cd))),e.R7$(2),e.vxM(t.HasMore&&!o.isLoadingMore()?2:o.isLoadingMore()?3:-1)}}function yd(n,c){1&n&&(e.j41(0,"tr")(1,"td",26)(2,"div",30),e.nrm(3,"div",29),e.k0s()()())}function Fd(n,c){if(1&n&&(e.j41(0,"tr")(1,"td",26)(2,"div",30)(3,"div",31)(4,"p",32),e.nrm(5,"app-exclamation-circle-solid-icon",33)(6,"app-server-error",34),e.k0s()()()()()),2&n){const t=e.XpG();e.R7$(6),e.Y8G("message",t.errorMessage())}}let Id=(()=>{class n{cd=(0,s.WQX)(_.gRc);destroy$=(0,s.WQX)(s.abz);aiSettingsApi=(0,s.WQX)(de);modalService=(0,s.WQX)(B.B);router=(0,s.WQX)(S.Ix);translate=(0,s.WQX)(y.c$);selector=new bt.a({cd:this.cd,keySelector:t=>t.Id});search=(0,s.vPA)("");isLoadingMore=(0,s.vPA)(!1);isRefreshing=!1;loadMore$=new be.B;refresh$=new be.B;isInitialLoad=!0;errorMessage=(0,s.vPA)("");route=(0,s.WQX)(S.nX);isAddingKnowledge=!1;vectorStores$;formatSize=It.O1;constructor(){this.vectorStores$=this.requestVectorStores$(),this.vectorStores$.pipe((0,R.pQ)(this.destroy$)).subscribe({next:t=>{this.isInitialLoad&&(this.isInitialLoad=!1),this.isLoadingMore.set(!1),this.isRefreshing=!1,this.cd.markForCheck()},error:t=>{this.isLoadingMore.set(!1),this.isRefreshing=!1,this.cd.markForCheck()}}),this.refresh()}refresh(){this.errorMessage.set(""),this.isInitialLoad=!0,this.isRefreshing=!0,this.refresh$.next(),this.cd.markForCheck()}parseOpenAIErrors(t){return(0,z.G0)((0,X.PE)(t))}onClick(t,o){this.routeToKnowledgeBaseEditor(t,o)}routeToKnowledgeBaseEditor(t,o){t.stopPropagation(),this.router.navigate(["edit",o.Id],{relativeTo:this.route})}requestVectorStores$(){const t=o=>this.aiSettingsApi.getVectorStores({limit:50,after:o});return this.refresh$.pipe((0,I.n)(()=>t("").pipe((0,Ut.L)({count:3,delay:o=>o instanceof W.yz&&404===o.status?(0,Se.O)(4e3):(0,$e.$)(()=>o)}),(0,A.W)(o=>{this.isLoadingMore.set(!1),this.isRefreshing=!1;const i=this.parseOpenAIErrors(o);return i&&this.errorMessage.set(i),this.cd.markForCheck(),(0,M.of)({Items:[],HasMore:!1,FirstId:null,LastId:null})}))),(0,ti.f)(o=>{const i=o.LastId;return i&&o.HasMore?this.loadMore$.pipe((0,ni.$)(),(0,I.n)(()=>t(i).pipe((0,v.T)(a=>({...a,Items:[...o.Items??[],...a.Items??[]]})),(0,A.W)(a=>(this.isLoadingMore.set(!1),this.isRefreshing=!1,this.modalService.error((0,z.G0)((0,X.PE)(a))),(0,M.of)(o)))))):E.w}),(0,ze.t)({refCount:!0,bufferSize:1}))}getVisibleItems(t){const o=this.search().trim();if(!se.Q.isNullOrEmpty(o)){const i=o.toLowerCase(),a=this.translate.instant("_i18n.UntitledStore").toLowerCase();return t.filter(r=>{const d=r.Name?.toLowerCase().includes(i),u=r.Id?.toLowerCase().includes(i),m=r.Description?.toLowerCase().includes(i),g=!r.Name&&a.includes(i);return d||u||m||g})}return t}loadMore(t){t.HasMore&&(this.isLoadingMore.set(!0),this.loadMore$.next())}onChange(t,o){this.selector.setSelected(t,o)}getExpiration(t){return t&&t.ExpiresAt?new Date(t.ExpiresAt).toLocaleDateString():null}addKnowledge(){return this.isAddingKnowledge=!0,this.aiSettingsApi.createVectorStore({aISettingsCreateVectorStoreRequestBody:{model:{Name:"",Description:""}}}).pipe((0,I.n)(t=>this.router.navigate(["office","integrations","ai","knowledge-base","add",t.Id])),(0,A.W)(t=>(this.isAddingKnowledge=!1,this.cd.markForCheck(),this.modalService.error((0,z.G0)((0,X.PE)(t))),E.w))).subscribe({complete:()=>{this.isAddingKnowledge=!1}})}deleteItem(t){this.modalService.confirmDeletion("_i18n.DeleteKnowledgeBaseConfirmation").pipe((0,I.n)(()=>this.aiSettingsApi.deleteVectorStore({aISettingsDeleteVectorStoreRequestBody:{id:t.Id}})),(0,R.pQ)(this.destroy$)).subscribe({error:o=>{this.modalService.error((0,z.G0)((0,X.PE)(o)))}})}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-knowledge-base"]],decls:32,vars:27,consts:[["header","_i18n.KnowledgeSources","helpUrl","_i18n.AIGuideUri","backRouterLink",".."],["top-bar","",1,"button-group"],["data-qa","add-knowledge","text","_i18n.AddKnowledge",3,"click","disabled","loader"],["data-qa","refresh-knowledge",3,"click","disabled","loader"],["top-bar","",3,"ngModelChange","ngModel"],[1,"scrollable-table"],[1,"position-sticky"],[1,"col-size-200"],[1,"col-size-300"],[1,"col-size-200","xxl-visible"],[1,"col-size-400","xxl-visible"],[1,"actions"],["data-qa","knowledge-base-row",1,"clickable"],["data-qa","knowledge-base-row",1,"clickable",3,"click"],["data-qa","source-name"],[1,"line-clamp-1",3,"title"],["data-qa","i
1d"],["data-qa","size",1,"xxl-visible"],["data-qa","created",1,"xxl-visible"],["data-qa","description",1,"xxl-visible","truncate"],["data-qa","expires"],["data-qa","actions",1,"actions"],["data-qa","action-menu"],["role","menuitem"],["type","button","data-qa","edit",1,"dropdown-item",3,"click"],["type","button","data-qa","delete",1,"dropdown-item",3,"click"],["colspan","7"],[1,"d-flex","align-items-center","justify-content-center",2,"height","50px"],["type","button","data-qa","load-more-button",1,"btn","btn-primary",3,"click"],[1,"loader"],[1,"d-flex","align-items-center","justify-content-center",2,"height","200px"],[2,"max-width","650px"],[1,"text-error",2,"white-space","pre-line","line-break","anywhere","word-break","break-all","overflow-wrap","anywhere"],[1,"me-1","inline-text-icon"],[3,"message"]],template:function(o,i){if(1&o&&(e.j41(0,"app-page",0)(1,"div",1)(2,"app-button-add",2),e.bIt("click",function(){return i.addKnowledge()}),e.k0s(),e.j41(3,"app-button-refresh",3),e.bIt("click",function(){return i.refresh()}),e.k0s()(),e.j41(4,"search-bar",4),e.mxI("ngModelChange",function(r){return e.DH7(i.search,r)||(i.search=r),r}),e.k0s(),e.j41(5,"table",5)(6,"thead",6)(7,"tr")(8,"th",7),e.EFF(9),e.nI1(10,"translate"),e.k0s(),e.j41(11,"th",8),e.EFF(12),e.nI1(13,"translate"),e.k0s(),e.j41(14,"th",9),e.EFF(15),e.nI1(16,"translate"),e.k0s(),e.j41(17,"th",9),e.EFF(18),e.nI1(19,"translate"),e.k0s(),e.j41(20,"th",10),e.EFF(21),e.nI1(22,"translate"),e.k0s(),e.j41(23,"th",7),e.EFF(24),e.nI1(25,"translate"),e.k0s(),e.nrm(26,"th",11),e.k0s()(),e.j41(27,"tbody"),e.nVh(28,Td,4,2),e.nI1(29,"async"),e.vZN(30,yd,4,0,"tr"),e.nVh(31,Fd,7,1,"tr"),e.k0s()()()),2&o){let a;e.R7$(2),e.Y8G("disabled",i.isAddingKnowledge)("loader",i.isAddingKnowledge),e.R7$(),e.Y8G("disabled",i.isRefreshing||i.isLoadingMore())("loader",i.isRefreshing),e.R7$(),e.R50("ngModel",i.search),e.R7$(5),e.JRh(e.bMT(10,13,"_i18n.SourceName")),e.R7$(3),e.JRh(e.bMT(13,15,"_i18n.ID")),e.R7$(3),e.JRh(e.bMT(16,17,"_i18n.Size")),e.R7$(3),e.JRh(e.bMT(19,19,"_i18n.Created")),e.R7$(3),e.JRh(e.bMT(22,21,"_i18n.Description")),e.R7$(3),e.JRh(e.bMT(25,23,"_i18n.Expires")),e.R7$(4),e.vxM((a=e.bMT(29,25,i.vectorStores$))?28:30,a),e.R7$(3),e.vxM(i.errorMessage()?31:-1)}},dependencies:[qe.H,pt.J,at.L,l.YN,l.BC,l.vS,He.I,hd.b,Ce.j,ii,y.D9,N.Jj,N.vh],encapsulation:2})}return n})();const Ad=["file"],$d=(n,c)=>c.id;function Md(n,c){1&n&&e.nrm(0,"span",13)}function kd(n,c){if(1&n){const t=e.RV6();e.j41(0,"tr")(1,"td",10)(2,"span",11),e.EFF(3),e.k0s()(),e.j41(4,"td")(5,"span",11),e.EFF(6),e.k0s()(),e.j41(7,"td")(8,"span",12),e.nVh(9,Md,1,0,"span",13),e.EFF(10),e.nI1(11,"translate"),e.k0s()(),e.j41(12,"td",14)(13,"button",15),e.nI1(14,"translate"),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG(2);return s.Njj(a.removeFile(i.id))}),e.k0s()()()}if(2&n){const t=c.$implicit,o=e.XpG(2);e.R7$(),e.Y8G("title",t.name),e.R7$(2),e.JRh(t.name),e.R7$(3),e.JRh(o.formatSize(t.size)),e.R7$(3),e.vxM(o.isFileUploading(t.id)||o.isFileRemoving(t.id)?9:-1),e.R7$(),e.SpI(" ",e.bMT(11,7,o.getFileStatus(t.id))," "),e.R7$(3),e.Y8G("title",e.bMT(14,9,"_i18n.Remove"))("disabled",o.isFileUploading(t.id)||o.isFileRemoving(t.id))}}function xd(n,c){if(1&n&&(e.j41(0,"table",5)(1,"thead")(2,"tr",6)(3,"th",7),e.EFF(4),e.nI1(5,"translate"),e.k0s(),e.j41(6,"th",8),e.EFF(7),e.nI1(8,"translate"),e.k0s(),e.j41(9,"th",8),e.EFF(10),e.nI1(11,"translate"),e.k0s(),e.nrm(12,"th",9),e.k0s()(),e.j41(13,"tbody"),e.Z7z(14,kd,15,11,"tr",null,$d),e.k0s()()),2&n){const t=e.XpG();e.R7$(4),e.JRh(e.bMT(5,3,"_i18n.FileName")),e.R7$(3),e.JRh(e.bMT(8,5,"_i18n.Size")),e.R7$(3),e.JRh(e.bMT(11,7,"_i18n.Status")),e.R7$(4),e.Dyx(t.selectedFiles)}}let Ed=(()=>{class n extends k.m{file;cd=(0,s.WQX)(_.gRc);aiSettings=(0,s.WQX)(de);xapiErrorService=(0,s.WQX)(K.Ko);translate=(0,s.WQX)(y.c$);httpClient=(0,s.WQX)(W.Qq);modalService=(0,s.WQX)(B.B);buttons=G.P.OkCancel;vectorStoreId;selectedFiles=[];uploadingFileIds=new Set;uploadedFileIds=new Set;failedFileIds=new Set;removingFileIds=new Set;MAX_FILES=10;formatSize=It.O1;addFiles(){this.file.nativeElement.click()}get okDisabled(){return 0===this.selectedFiles.length||this.uploadingFileIds.size>0||this.removingFileIds.size>0||this.failedFileIds.size>0}onFileSelected(t){if(!t||0===t.length)return;const o=Array.from(t),i=this.MAX_FILES-this.selectedFiles.length;if(i<=0)return;
1const a=o.slice(0,i),r=[],d=[];for(const u of a){const m=this.validateFileForVectorStore(u);m?r.push(`${u.name}: ${this.translate.instant("string"==typeof m?m:m.message,{p1:"50 MB"})}`):d.push(u)}if(r.length>0&&this.modalService.error(r.join("</br>")),0!==d.length){for(const u of d){const m=`${Date.now()}-${Math.random()}`;this.selectedFiles.push({id:m,file:u,name:u.name,size:u.size})}this.file.nativeElement.value="",this.cd.markForCheck(),this.uploadFiles()}else this.file.nativeElement.value=""}removeFile(t){const o=this.selectedFiles.find(i=>i.id===t);!o||!o.externalFileId||(this.removingFileIds.add(t),this.cd.markForCheck(),this.aiSettings.deleteOpenAiFile({aISettingsDeleteOpenAiFileRequestBody:{fileid:o.externalFileId}}).subscribe({next:i=>{"object"==typeof i&&null!==i&&"value"in i&&!0===i.value&&(this.removingFileIds.delete(t),this.selectedFiles=this.selectedFiles.filter(a=>a.id!==t),this.cd.markForCheck())},error:i=>{this.removingFileIds.delete(t),this.modalService.error((0,z.G0)((0,X.PE)(i))),this.cd.markForCheck()}}))}uploadFiles(){const t=this.selectedFiles.filter(i=>!this.uploadedFileIds.has(i.id)&&!this.uploadingFileIds.has(i.id));if(0===t.length)return;for(const i of t)this.uploadingFileIds.add(i.id);this.cd.markForCheck();const o=new FormData;for(const i of t)o.append("files",i.file,i.name);this.httpClient.post("/xapi/v1/AiSettings/UploadVectorFiles",o).pipe((0,A.W)(i=>{for(const r of t)this.uploadingFileIds.delete(r.id),this.failedFileIds.add(r.id);const a=i instanceof W.yz&&207===i.status?this.handleMultiStatusResponse(i):(0,z.G0)((0,X.PE)(i));return this.modalService.error(a),this.cd.markForCheck(),E.w})).subscribe({next:i=>{console.log(i);for(const a of t){this.uploadingFileIds.delete(a.id);const r=i?.find(d=>d.FileName===a.name);if(r)if("Failed"===r.Status)this.failedFileIds.add(a.id);else{this.uploadedFileIds.add(a.id);const d=this.selectedFiles.find(u=>u.id===a.id);d&&r.ExternalFileId&&(d.externalFileId=r.ExternalFileId)}else this.uploadedFileIds.add(a.id)}this.cd.markForCheck()}})}handleMultiStatusResponse(t){if(t.error&&Array.isArray(t.error)){const o=t.error.filter(i=>"Failed"===i.Status).map(i=>`${i.FileName||"Unknown"}${i.Error?` (${i.Error})`:""}`).join(", ");return o?`_i18n.SomeFilesUploadFailed: ${o}`:"_i18n.SomeFilesUploadFailed"}return"_i18n.SomeFilesUploadFailed"}validateFileForVectorStore(t){return(0,V.j$)(t,{allowedExtensions:["txt","md","pdf","docx","csv","json","html","pptx","xlsx","xz"],maxSizeMb:50,incorrectExtensionText:"_i18n.IncorrectFileFormat"})}submit$=()=>this.aiSettings.addVectorStoreFiles({aISettingsAddVectorStoreFilesRequestBody:{model:{FileIds:this.selectedFiles.filter(t=>t.externalFileId).map(t=>t.externalFileId),VectorId:this.vectorStoreId}}}).pipe((0,A.W)(t=>(this.modalService.error((0,X.PE)(t)),E.w)));isFileUploading(t){return this.uploadingFileIds.has(t)}isFileUploaded(t){return this.uploadedFileIds.has(t)}isFileFailed(t){return this.failedFileIds.has(t)}isFileRemoving(t){return this.removingFileIds.has(t)}getFileStatus(t){return this.isFileRemoving(t)?"_i18n.FileStatusRemoving":this.isFileUploading(t)?"_i18n.FileStatusUploading":this.isFileFailed(t)?"_i18n.FileStatusFailed":this.isFileUploaded(t)?"_i18n.FileStatusUploaded":"_i18n.FileStatusPending"}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275cmp=e.VBU({type:n,selectors:[["app-attach-vs-files-dialog"]],viewQuery:function(o,i){if(1&o&&e.GBs(Ad,5),2&o){let a;e.mGM(a=e.lsd())&&(i.file=a.first)}},inputs:{vectorStoreId:"vectorStoreId"},features:[e.Vt3],decls:11,vars:17,consts:[["file",""],[3,"submitted","header","buttons","submit$","okText","okDisabled"],["type","file","hidden","","multiple","",3,"change"],[1,"form-text","mb-3"],["theme","primary","data-qa","btn-add-files",3,"click","disabled","tooltip"],[1,"scrollable-table","mb-3","mt-3"],[1,"table-header"],[1,"ps-0","col-size-300"],[1,"col-size-200"],[1,"actions"],[1,"ps-0",3,"title"],[1,"line-clamp-1"],[1,"line-clamp-1","d-flex","align-items-center"],["app-spinner-regular-icon","",1,"customSVGIcons","svg-xs","me-1"],[1,"p-0"],["type","button","data-qa","remove","app-trash-alt-solid-icon","",1,"btn","btn-plain",3,"click","title","disabled"]],template:function(o,i){if(1&o){const a=e.RV6();e.j41(0,"app-modal-dialog",1),e.nI1(1,"translate"),e.nI1(2,"translate"),e.bIt("submitted",function(){return i.onSubmit()}),e.j41(3,"input",2,0),e.bIt("change",function(){s.eBV(a);const d=e.sdS(4);return s.Njj(i.onFileSelected(d.files))}),e.k0s(),e.j41(5,"div",3),e.EFF(6),e.nI1(7,"translate"),e.k0s(),e.j41(8,"app-button-add",4),e.nI1(9,"translate"),e.bIt("click",function(){return i.addFiles()}),e.k0s(),e.nVh(10,xd,16,9,"table",5),e.k0s()}2&o&&(e.Y8G("header",e.bMT(1,9,"_i18n.AttachFilesToKnowledgeBase"))("buttons",i.buttons)("submit$",i.submit$)("okText",e.bMT(2,11,"_i18n.Attach"))("okDisabled",i.okDisabled),e.R7$(6),e.JRh(e.bMT(7,13,"_i18n.UploadDocumentsDescription")),e.R7$(2),e.Y8G("disabled",i.selectedFiles.length>=10)("tooltip",i.selectedFiles.length>=10&&e.bMT(9,15,"_i18n.MaxFilesTooltip")),e.R7$(2),e.vxM(i.selectedFiles.length>0?10:-1))},dependencies:[me.p,l.X1,tt.dg,Ce.j,je.a,Xe.d,y.D9],encapsulation:2,changeDetection:0})}return n})();const oi=n=>({name:n}),wd=()=>[],Pd=(n,c)=>c.Id;function Gd(n,c){1&n&&e.nrm(0,"span",21)}function Dd(n,c){if(1&n){const t=e.RV6();e.j41(0,"tr")(1,"td",18)(2,"span",19),e.EFF(3),e.k0s()(),e.j41(4,"td")(5,"span",19),e.EFF(6),e.k0s()(),e.j41(7,"td")(8,"span",20),e.nVh(9,Gd,1,0,"span",21),e.EFF(10),e.nI1(11,"translate"),e.k0s()(),e.j41(12,"td")(13,"span",19),e.EFF(14),e.nI1(15,"date"),e.k0s()(),e.j41(16,"td",22)(17,"button",23),e.nI1(18,"translate"),e.bIt("click",function(){const i=s.eBV(t).$implicit,a=e.XpG(2);return s.Njj(a.deleteFile(i))}),e.k0s()()()}if(2&n){const t=c.$implicit,o=e.XpG(2);e.AVh("opacity-50",o.isFileRemoved(t.Id)),e.R7$(),e.Y8G("title",t.Id),e.R7$(2),e.JRh(t.Name),e.R7$(3),e.JRh(o.formatSize(t.Size??void 0)),e.R7$(3),e.vxM(o.isFileRemoving(t.Id)?9:-1),e.R7$(),e.SpI(" ",e.bMT(11,10,o.getFileStatus(t))," "),e.R7$(4),e.JRh(e.bMT(15,12,t.CreatedAt)),e.R7$(3),e.Y8G("title",e.bMT(18,14,"_i18n.Remove"))("disabled",o.isFileRemoving(t.Id)||o.isFileRemoved(t.Id))}}function Nd(n,c){if(1&n){const t=e.RV6();e.j41(0,"tr")(1,"td",24)(2,"div",25)(3,"button",26),e.bIt("click",function(){s.eBV(t);const i=e.XpG(),a=e.XpG();return s.Njj(a.loadMoreFiles(i))}),e.EFF(4),e.nI1(5,"translate"),e.k0s()()()()}2&n&&(e.R7$(4),e.SpI(" ",e.bMT(5,1,"_i18n.LoadMore")," "))}
1function jd(n,c){1&n&&(e.j41(0,"tr")(1,"td",24)(2,"div",25),e.nrm(3,"div",27),e.k0s()()())}function Vd(n,c){if(1&n&&(e.Z7z(0,Dd,19,16,"tr",17,Pd),e.nVh(2,Nd,6,3,"tr")(3,jd,4,0,"tr")),2&n){const t=c,o=e.XpG();e.Dyx(t.Items??e.lJ4(1,wd)),e.R7$(2),e.vxM(t.HasMore&&!o.isLoadingMoreFiles()?2:o.isLoadingMoreFiles()?3:-1)}}function Bd(n,c){1&n&&(e.j41(0,"tr")(1,"td",24)(2,"div",28),e.nrm(3,"div",27),e.k0s()()())}const Hd={InProgress:"_i18n.FileStatusInProgress",Completed:"_i18n.FileStatusCompleted",Cancelled:"_i18n.FileStatusCancelled",Failed:"_i18n.FileStatusFailed"};let ai=(()=>{class n{route=(0,s.WQX)(S.nX);destroy$=(0,s.WQX)(s.abz);location=(0,s.WQX)(Wn.aZ);aiSettingsApiService=(0,s.WQX)(de);xapiErrorService=(0,s.WQX)(K.Ko);modalService=(0,s.WQX)(B.B);cd=(0,s.WQX)(_.gRc);isEnterprise;id;name;showValidation=!1;isNewEntity=!1;form;isLoadingMoreFiles=(0,s.vPA)(!1);isRefreshing=!1;removingFileIds=new Set;removedFileIds=new Set;loadMoreFiles$=new be.B;refreshFiles$=new be.B;vectorStoreFiles$;hasFilesAttached=!1;LIMIT=10;formatSize=It.O1;navigateBack(){this.location.back()}get isPristine(){return this.form.pristine&&!this.hasFilesAttached}constructor(){this.route.data.pipe((0,R.pQ)(this.destroy$)).subscribe(t=>{this.isEnterprise=t.isEnterprise;const o=t.knowledgeBase;this.id=o.Id,this.name=o.Name,this.vectorStoreFiles$=this.requestVectorStoreFiles$()})}ngOnInit(){const t=this.route.snapshot.url.map(a=>a.path);this.isNewEntity=t.includes("add");const i=this.route.snapshot.data.knowledgeBase;this.form=new l.gE({name:new l.MJ(i.Name??"",{nonNullable:!0,validators:[l.k0.required,l.k0.maxLength(50)]}),description:new l.MJ(i.Description??"",{validators:[l.k0.maxLength(512)]})}),this.vectorStoreFiles$&&(this.vectorStoreFiles$.pipe((0,R.pQ)(this.destroy$)).subscribe({next:()=>{this.isLoadingMoreFiles.set(!1),this.isRefreshing=!1,this.cd.markForCheck()},error:()=>{this.isLoadingMoreFiles.set(!1),this.isRefreshing=!1,this.cd.markForCheck()}}),this.refreshFiles())}save$=()=>this.form.pristine?(this.location.back(),E.w):this.aiSettingsApiService.updateVectorStore({aISettingsUpdateVectorStoreRequestBody:{model:{Id:this.id,Name:this.form.value.name,Description:this.form.value.description}}}).pipe((0,P.M)(()=>{this.location.back()}),(0,A.W)(t=>(this.xapiErrorService.error(this.cd,t,this.form,!1,!1)||this.modalService.error((0,z.G0)((0,X.PE)(t))),E.w)));requestVectorStoreFiles$(){const t=o=>this.aiSettingsApiService.getVectorStoreFiles({id:this.id,limit:this.LIMIT,after:o});return this.refreshFiles$.pipe((0,I.n)(()=>t("")),(0,ti.f)(o=>{const i=o.LastId;return i&&o.HasMore?this.loadMoreFiles$.pipe((0,ni.$)(),(0,I.n)(()=>t(i).pipe((0,v.T)(a=>({...a,Items:[...o.Items??[],...a.Items??[]]})),(0,A.W)(a=>(this.isLoadingMoreFiles.set(!1),this.modalService.error((0,z.G0)((0,X.PE)(a))),(0,M.of)(o)))))):E.w}),(0,A.W)(o=>(this.isLoadingMoreFiles.set(!1),this.isRefreshing=!1,this.modalService.error((0,z.G0)((0,X.PE)(o))),this.cd.markForCheck(),(0,M.of)({Items:[],HasMore:!1,FirstId:null,LastId:null}))),(0,ze.t)({refCount:!0,bufferSize:1}))}refreshFiles(){this.isRefreshing=!0,this.loadMoreFiles$=new be.B,this.refreshFiles$.next(),this.cd.markForCheck()}loadMoreFiles(t){t.HasMore&&(this.isLoadingMoreFiles.set(!0),this.loadMoreFiles$.next())}addFiles(){this.modalService.showDialog(Ed,{vectorStoreId:this.id}).pipe((0,R.pQ)(this.destroy$)).subscribe({next:t=>{this.hasFilesAttached=!0,this.cd.markForCheck()}})}deleteFile(t){const o=t.Id;o&&this.modalService.confirmDeletion("_i18n.DeleteFileConfirmation").pipe((0,P.M)(()=>{this.removingFileIds.add(o),this.cd.markForCheck()}),(0,I.n)(()=>this.aiSettingsApiService.deleteVectorStoreFile({aISettingsDeleteVectorStoreFileRequestBody:{fileid:o,vectorid:this.id}})),(0,R.pQ)(this.destroy$)).subscribe({next:i=>{"object"==typeof i&&null!==i&&"value"in i&&!0===i.value&&(this.removingFileIds.delete(o),this.removedFileIds.add(o),this.cd.markForCheck())},error:i=>{this.removingFileIds.delete(o),this.modalService.error((0,z.G0)((0,X.PE)(i))),this.cd.markForCheck()}})}isFileRemoving(t){return!!t&&this.removingFileIds.has(t)}isFileRemoved(t){return!!t&&this.removedFileIds.has(t)}getFileStatus(t){return this.isFileRemoved(t.Id)?"_i18n.FileStatusRemoved":this.isFileRemoving(t.Id)?"_i18n.FileStatusRemoving":t.Status?Hd[t.Status]||t.Status:"-"}static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["ng-component"]],decls:45,vars:59,consts:[[3,"back","header","formGroup","isNewEntity","invali
1d","saveDisabledByReason","save$","pristine"],["formControlName","name","data-qa","knowledge-base-name",1,"col-lg-6",3,"label","description"],["controlName","name"],[1,"col-lg-6",3,"label","description"],["formControlName","description","data-qa","knowledge-base-description",1,"form-control"],["controlName","description"],[1,"form-label","mb-0"],[1,"form-text","mb-2"],["data-qa","btn-add-files",3,"click","title"],["data-qa","refresh-knowledge",1,"ms-2",3,"click","disabled","loader"],[1,"scrollable","my-3",2,"max-height","415px"],[1,"scrollable-table"],[1,"position-sticky"],[1,"table-header"],[1,"ps-0","col-size-200"],[1,"col-size-200"],[1,"actions"],[3,"opacity-50"],[1,"ps-0",3,"title"],[1,"line-clamp-1"],[1,"line-clamp-1","d-flex","align-items-center","gap-1"],["app-spinner-regular-icon","",1,"customSVGIcons","svg-xs",2,"margin-bottom","1px"],[1,"p-0"],["type","button","data-qa","remove","app-trash-alt-solid-icon","",1,"btn","btn-plain",3,"click","title","disabled"],["colspan","5"],[1,"d-flex","align-items-center","justify-content-center",2,"height","50px"],["type","button","data-qa","load-more-files-button",1,"btn","btn-primary",3,"click"],[1,"loader"],[1,"d-flex","align-items-center","justify-content-center",2,"height","100px"]],template:function(o,i){if(1&o&&(e.j41(0,"edit-panel",0),e.nI1(1,"translate"),e.nI1(2,"translate"),e.nI1(3,"translate"),e.nI1(4,"translate"),e.bIt("back",function(){return i.navigateBack()}),e.j41(5,"field-input",1),e.nI1(6,"translate"),e.nI1(7,"translate"),e.nrm(8,"val-errors",2),e.k0s(),e.j41(9,"field-wrapper",3),e.nI1(10,"translate"),e.nI1(11,"translate"),e.j41(12,"textarea",4),e.EFF(13,"                    "),e.k0s(),e.nrm(14,"val-errors",5),e.k0s(),e.j41(15,"div",6),e.EFF(16),e.nI1(17,"translate"),e.k0s(),e.j41(18,"div",7),e.EFF(19),e.nI1(20,"translate"),e.k0s(),e.j41(21,"app-button-add",8),e.nI1(22,"translate"),e.bIt("click",function(){return i.addFiles()}),e.k0s(),e.j41(23,"app-button-refresh",9),e.bIt("click",function(){return i.refreshFiles()}),e.k0s(),e.j41(24,"div",10)(25,"table",11)(26,"thead",12)(27,"tr",13)(28,"th",14),e.EFF(29),e.nI1(30,"translate"),e.k0s(),e.j41(31,"th",15),e.EFF(32),e.nI1(33,"translate"),e.k0s(),e.j41(34,"th",15),e.EFF(35),e.nI1(36,"translate"),e.k0s(),e.j41(37,"th",15),e.EFF(38),e.nI1(39,"translate"),e.k0s(),e.nrm(40,"th",16),e.k0s()(),e.j41(41,"tbody"),e.nVh(42,Vd,4,2),e.nI1(43,"async"),e.vZN(44,Bd,4,0,"tr"),e.k0s()()()()),2&o){let a;e.Y8G("header",i.isNewEntity?e.bMT(1,21,"_i18n.AddKnowledgeBase"):i.name?e.i5U(2,23,"_i18n.EditKnowledgeBase",e.eq3(55,oi,i.name)):e.i5U(4,28,"_i18n.EditKnowledgeBase",e.eq3(57,oi,e.bMT(3,26,"_i18n.UntitledStore"))))("formGroup",i.form)("isNewEntity",i.isNewEntity)("invalid",i.form.invalid)("saveDisabledByReason",i.isEnterprise?"":"_i18n.AvailableEnt")("save$",i.save$)("pristine",i.isPristine),e.R7$(5),e.Y8G("label",e.bMT(6,31,"_i18n.KnowledgeBaseName"))("description",e.bMT(7,33,"_i18n.KnowledgeBaseNameDescription")),e.R7$(4),e.Y8G("label",e.bMT(10,35,"_i18n.KnowledgeBaseDescription"))("description",e.bMT(11,37,"_i18n.KnowledgeBaseDescriptionDescription")),e.R7$(7),e.JRh(e.bMT(17,39,"_i18n.AttachFiles")),e.R7$(3),e.JRh(e.bMT(20,41,"_i18n.AttachFilesDescription")),e.R7$(2),e.Y8G("title",e.bMT(22,43,"_i18n.AddFiles")),e.R7$(2),e.Y8G("disabled",i.isRefreshing||i.isLoadingMoreFiles())("loader",i.isRefreshing),e.R7$(6),e.JRh(e.bMT(30,45,"_i18n.FileName")),e.R7$(3),e.JRh(e.bMT(33,47,"_i18n.Size")),e.R7$(3),e.JRh(e.bMT(36,49,"_i18n.Status")),e.R7$(3),e.JRh(e.bMT(39,51,"_i18n.Created")),e.R7$(4),e.vxM((a=e.bMT(43,53,i.vectorStoreFiles$))?42:44,a)}},dependencies:[ne.Q,l.X1,l.me,l.BC,l.cb,l.j4,l.JD,te.m,Z.z,$.IH,Ce.j,je.a,Xe.d,ii,y.D9,N.Jj,N.vh],encapsulation:2,changeDetection:0})}return n})();const ri=n=>{const{id:c}=n.params,t=(0,s.WQX)(de),o=(0,s.WQX)(B.B),i=(0,s.WQX)(S.Ix);return t.getVectorStore({id:c}).pipe((0,A.W)(a=>(a instanceof W.yz&&(400===a.status||a.status>=500||0===a.status)?o.error((0,z.G0)((0,X.PE)(a))):i.navigate(["/"]),E.w)))},Od=[{path:"",component:kl,resolve:{params:ee.cT,resources:At,...od.oF},data:{title:"AI",navTitle:"AI",helpUri:"_i18n.AIGuideUri"}},{path:"open-ai-config",component:fd,resolve:{params:ee.cT,isEnterprise:ee.HX,resources:At,settings:()=>{const n=(0,s.WQX)(de),c=(0,s.WQX)(fe.s);return n.getAISettings().pipe((0,A.W)(t=>c.handleError(t)))}},data:{title:"_i18n.OpenAIAPIConfiguration",navTitle:"_i18n.OpenAIAPIConfiguration",helpUri:"_i18n.AIGuideUri"}}
1,{path:"knowledge-base",component:Id,data:{title:"Knowledge Base",navTitle:"Knowledge Base",helpUri:"_i18n.AIGuideUri"}},{path:"knowledge-base/edit/:id",component:ai,resolve:{knowledgeBase:ri,isEnterprise:ee.HX}},{path:"knowledge-base/add/:id",component:ai,resolve:{knowledgeBase:ri,isEnterprise:ee.HX}},{path:"new/:templateId",resolve:{systemParameters:Ve.M,params:ee.cT,myRole:ei.r,myUser:Kn.w,resources:At,isEnterprise:ee.HX,...Zn.z},component:zn},{path:"edit/:id",component:zn,resolve:{params:ee.cT,systemParameters:Ve.M,myRole:ei.r,myUser:Kn.w,routes:id.J,agent:n=>{const{id:c}=n.params,t=(0,s.WQX)(Ye.u),o=(0,s.WQX)(Ln.L),i=(0,s.WQX)(fe.s);return t.getUser({$expand:["AgentSettings/PhonebookOverride, Groups($expand=Rights,GroupRights),ForwardingProfiles,ForwardingExceptions,Phones,Greetings"],id:c}).pipe((0,I.n)(a=>{if(!0===a.AIAgent&&!a.AgentSettings)return(0,$e.$)(()=>new W.yz({status:400,statusText:"Bad Request",error:"_i18n.AIAgentNoAgentSettingsError"}));const r=a.AgentSettings?.PhonebookOverride?.Number;return Rt(a)&&r?o.getPeerByNumber({number:r,$expand:["MemberOf($select=Name,Number,GroupId,IsPrimary)"]}).pipe((0,v.T)(d=>({Agent:a,BossAvailableGroups:d.MemberOf??null})),(0,A.W)(d=>(0,M.of)({Agent:a,BossAvailableGroups:null}))):(0,M.of)({Agent:a,BossAvailableGroups:null})}),(0,A.W)(a=>i.handleError(a)))},isEnterprise:ee.HX,resources:At,...Zn.z}}];var Xd=p(53879);let si=(()=>{class n extends ye.d{getSyslogSettings(t,o="body"){const i=t?.$select,a=t?.$expand;let r=new h.rx(this.encoder);r=this.addToHttpParams(r,"$select",i,h.l2.Form,!1),r=this.addToHttpParams(r,"$expand",a,h.l2.Form,!1);let d=this.defaultHeaders;d=this.configuration.addCredentialToHeaders("Application","Authorization",d,"Bearer ");const u=this.configuration.selectHeaderAccept(["application/json"]);void 0!==u&&(d=d.set("Accept",u));let m="json";u&&(m=u.startsWith("text")?"text":this.configuration.isJsonMime(u)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("get",`${C}/SyslogSettings`,{params:r.toHttpParams(),responseType:m,...f?{withCredentials:f}:{},headers:d,observe:o})}getSyslogSettingsQuery(t,o="body",i=!1,a){const r=t.$select,d=t.$expand;let u=new h.rx(this.encoder);return u=this.addToHttpParams(u,"$select",r,h.l2.Form,!1),u=this.addToHttpParams(u,"$expand",d,h.l2.Form,!1),"/SyslogSettings?"+u.toString()}testConnection(t,o="body"){const i=t?.syslogSettingsTestConnectionRequestBody;if(null==i)throw new Error("Required parameter syslogSettingsTestConnectionRequestBody was null or undefined when calling testConnection.");let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("post",`${C}/SyslogSettings/Pbx.TestConnection`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}testConnectionQuery(t,o="body",i=!1,a){if(null==t.syslogSettingsTestConnectionRequestBody)throw new Error("Required parameter syslogSettingsTestConnectionRequestBody was null or undefined when calling testConnection.");return"/SyslogSettings/Pbx.TestConnection"}updateSyslogSettings(t,o="body"){const i=t?.pbxSyslogSettings;let a=this.defaultHeaders;a=this.configuration.addCredentialToHeaders("Application","Authorization",a,"Bearer ");const r=this.configuration.selectHeaderAccept(["application/json"]);void 0!==r&&(a=a.set("Accept",r));const u=this.configuration.selectHeaderContentType(["application/json"]);void 0!==u&&(a=a.set("Content-Type",u));let m="json";r&&(m=r.startsWith("text")?"text":this.configuration.isJsonMime(r)?"json":"blob");const{basePath:C,withCredentials:f}=this.configuration;return this.httpClient.request("patch",`${C}/SyslogSettings`,{body:i,responseType:m,...f?{withCredentials:f}:{},headers:a,observe:o})}updateSyslogSettingsQuery(t,o="body",i=!1,a){return"/SyslogSettings"}static \u0275fac=(()=>{let t;return function(i){return(t||(t=e.xGo(n)))(i||n)}})();static \u0275prov=s.jDH({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();const Re={None:"None",Custom:"Custom"},st={Udp:"Udp",Tcp:"Tcp",Tls:"Tls"},Qd=[{value:st.Tcp,label:"_i18n.Tcp"},{value:st.Udp,label:"_i18n.Udp"},{value:st.Tls,label:"_i18n.Tls"}],Ld={Custom:{description:"_i18n.LearnHowToSetup",link:"_i18n.CustomRemoteSysLogUri",name:"Custom Syslog Server"}},Wd=n=>({name:n});function Yd(n,c){1&n&&e.nrm(0,"app-spinner-regular-icon")}function Jd(n,c){1&n&&e.nrm(0,"app-share-solid-icon")}function qd(n,c){}function Ud(n,c){if(1&n&&(e.j41(0,"field-input-file",14),e.nrm(1,"val-errors",9),e.k0s(),e.j41(2,"field-input-file",15),e.nrm(3,"val-errors",9),e.k0s()),2&n){const t=e.XpG(2);e.Y8G("readContent",!0)("readAsDataUrl",!0)("contentConverter",t.extractBase64Content)("formControl",t.CustomRelayConfigControls.ClientCertificate),e.R7$(),e.Y8G("control",t.CustomRelayConfigControls.ClientCertificate),e.R7$(),e.Y8G("readContent",!0)("readAsDataUrl",!0)("contentConverter",t.extractBase64Content)("formControl",t.CustomRelayConfigControls.ClientPrivateKey),e.R7$(),e.Y8G("control",t.CustomRelayConfigControls.ClientPrivateKey)}}function zd(n,c){if(1&n&&(e.j41(0,"field-input",11),e.nrm(1,"val-errors",9),e.k0s(),e.j41(2,"field-input-number",12),e.nrm(3,"val-errors",9),e.k0s(),e.j41(4,"field-select",13),e.nrm(5,"val-errors",9),e.k0s(),e.nVh(6,Ud,4,10)),2&n){let t;const o=e.XpG();e.Y8G("formControl",o.CustomRelayConfigControls.Host),e.R7$(),e.Y8G("control",o.CustomRelayConfigControls.Host),e.R7$(),e.Y8G("formControl",o.CustomRelayConfigControls.Port)("min",0)("max",65535),e.R7$(),e.Y8G("control",o.CustomRelayConfigControls.Port),e.R7$(),e.Y8G("options",o.syslogProtocolOptions)("formControl",o.CustomRelayConfigControls.Protocol),e.R7$(),e.Y8G("control",o.CustomRelayConfigControls.Protocol),e.R7$(),e.vxM((t=o.CustomRelayConfigControls.Protocol.value)===o.PbxSyslogProtocol.Tls?6:-1)}}function Kd(n,c){1&n&&(e.EFF(0),e.nI1(1,"translate")),2&n&&e.JRh(e.bMT(1,1,"_i18n.SyslogAtLeastOneShouldBeSelected"))}let Zd=(()=>{class n{route=(0,s.WQX)(S.nX);syslogSettingsApiService=(0,s.WQX)(si);cd=(0,s.WQX)(_.gRc);modalService=(0,s.WQX)(B.B);translate=(0,s.WQX)(y.c$);destroy$=(0,s.WQX)(s.abz);integrationGuideLinks=Ld;
1syslogSettings=this.route.snapshot.data.syslogSettings||{};atLeastOneDataTypeSelectedValidator=t=>{const o=t,{IsSystemAlertsEnabled:i,IsEventLogsEnabled:a,IsAuditLogsEnabled:r}=o.value;return i||a||r?null:{atLeastOneDataTypeSelected:!0}};integrationTypeOptions=(0,xe.EW)(()=>[{value:Re.None,label:"_i18n.LoggingLevelOff"},{value:Re.Custom,label:"_i18n.SyslogCustomRelay"}]);form=this.createForm();isTestingInProgress=!1;isSavingInProgress=!1;get f(){return this.form.controls}get CustomRelayConfigControls(){return this.f.CustomRelayConfig.controls}get CategoryConfigControls(){return this.f.CategoryConfig.controls}createForm(){return new l.gE({CategoryConfig:new l.gE({IsAuditLogsEnabled:new l.MJ(this.syslogSettings.CategoryConfig?.IsAuditLogsEnabled??!1,{nonNullable:!0}),IsSystemAlertsEnabled:new l.MJ(this.syslogSettings.CategoryConfig?.IsSystemAlertsEnabled??!1,{nonNullable:!0}),IsEventLogsEnabled:new l.MJ(this.syslogSettings.CategoryConfig?.IsEventLogsEnabled??!1,{nonNullable:!0})},this.atLeastOneDataTypeSelectedValidator),IntegrationType:new l.MJ(this.syslogSettings.IntegrationType??Re.None,{nonNullable:!0}),CustomRelayConfig:new l.gE({Host:new l.MJ(this.syslogSettings.CustomRelayConfig?.Host??"",{nonNullable:!0,validators:[l.k0.required,V.AG]}),Port:new l.MJ(this.syslogSettings.CustomRelayConfig?.Port??0,{nonNullable:!0,validators:[l.k0.required]}),Protocol:new l.MJ(this.syslogSettings.CustomRelayConfig?.Protocol??st.Tcp,{nonNullable:!0}),ClientCertificate:new l.MJ((0,J.s)(this.syslogSettings.CustomRelayConfig?.ClientCertificate)),ClientPrivateKey:new l.MJ((0,J.s)(this.syslogSettings.CustomRelayConfig?.ClientPrivateKey))})})}ngOnInit(){(0,T.XP)(this.f.IntegrationType).pipe((0,R.pQ)(this.destroy$)).subscribe(t=>{(0,T.TZ)(this.f.CustomRelayConfig,t===Re.Custom),(0,T.TZ)(this.f.CategoryConfig,t!==Re.None)})}save$=()=>{const{CustomRelayConfig:t,...o}=this.form.value,{ClientCertificate:i,ClientPrivateKey:a,...r}=t??{};let d=i,u=a;return this.form.controls.CustomRelayConfig.controls.ClientCertificate.enabled&&(null===i||null===a)&&(d={name:"",content:void 0,concealed:!1},u={name:"",content:void 0,concealed:!1}),this.isSavingInProgress=!0,this.cd.markForCheck(),this.syslogSettingsApiService.updateSyslogSettings({pbxSyslogSettings:{...o,CustomRelayConfig:{...r,ClientCertificate:(0,J.W)(d),ClientPrivateKey:(0,J.W)(u)}}}).pipe((0,Me.j)(()=>{this.isSavingInProgress=!1,this.cd.markForCheck()}))};get engineGuideLink(){return this.integrationGuideLinks[this.f.IntegrationType.value]??{link:"",description:""}}extractBase64Content=t=>t?t.replace(/^data:(.*,)?/,""):null;get isTestingAllowed(){return this.f.IntegrationType.value!==Re.None&&!this.isTestingInProgress&&!this.isSavingInProgress&&this.f.IntegrationType.value===Re.Custom&&""!==this.CustomRelayConfigControls.Host.value}testConnection(){if(!this.isTestingAllowed||this.form.invalid)return;const{CustomRelayConfig:t,...o}=this.form.value,{ClientCertificate:i,ClientPrivateKey:a,...r}=t??{};this.isTestingInProgress=!0,this.cd.markForCheck(),this.syslogSettingsApiService.testConnection({syslogSettingsTestConnectionRequestBody:{config:{...o,CustomRelayConfig:{...r,ClientCertificate:(0,J.W)(i),ClientPrivateKey:(0,J.W)(a)}}}}).pipe((0,Me.j)(()=>{this.isTestingInProgress=!1,this.cd.markForCheck()})).subscribe({next:d=>{this.modalService.information("_i18n.SyslogConnectionTestSuccessful",{msg:d.value})},error:d=>{this.modalService.error(d)}})}syslogProtocolOptions=Qd;PbxSyslogProtocol=st;PbxSyslogIntegrationType=Re;static \u0275fac=function(o){return new(o||n)};static \u0275cmp=e.VBU({type:n,selectors:[["app-syslog"]],decls:28,vars:27,consts:[["header","_i18n.Syslog","helpUrl","_i18n.CustomRemoteSysLogUri",3,"formGroup","save$"],["buttons","","type","button","data-qa","test-data-connector",1,"btn","btn-primary",3,"click","disabled"],[1,"row"],[1,"col-xl-6"],["data-qa","integration-type","label","_i18n.SyslogSelectOptions",3,"options","description","formControl"],["description","",3,"href"],["label","_i18n.SyslogCategorySystemAlerts","hint","_i18n.SyslogSystemAlertsHint","data-qa","category-system-alerts",3,"formControl"],["label","_i18n.SyslogCategoryEventLog","hint","_i18n.SyslogEventLogHint","data-qa","category-event-log",3,"formControl"],["label","_i18n.SyslogCategoryAuditLogs","hint","_i18n.SyslogAuditLogHint","data-qa","category-audit-logs",3,"formControl"],[3,"control"],["valError","atLeastOneDataTypeSelected"],["label","_i18n.SyslogRelayCredentials","data-qa","host",3,"formControl"],["data-qa","port","label","_i18n.Port",3,"formControl","min","max"],["data-qa","protocol","label","_i18n.TransportRestriction",3,"options","formControl"],["data-qa","client-certificate","label","_i18n.ClientCertificate","accept",".crt,.pem",3,"readContent","readAsD
1ataUrl","contentConverter","formControl"],["data-qa","client-certificate","label","_i18n.ClientPrivateKey","accept",".pem",3,"readContent","readAsDataUrl","contentConverter","formControl"]],template:function(o,i){if(1&o&&(e.j41(0,"edit-panel",0)(1,"button",1),e.bIt("click",function(){return i.testConnection()}),e.nVh(2,Yd,1,0,"app-spinner-regular-icon")(3,Jd,1,0,"app-share-solid-icon"),e.j41(4,"span"),e.EFF(5),e.nI1(6,"translate"),e.k0s()(),e.j41(7,"fieldset")(8,"div",2)(9,"div",3)(10,"field-select",4)(11,"app-external-link",5),e.nI1(12,"translate"),e.EFF(13),e.nI1(14,"translate"),e.k0s()(),e.nVh(15,qd,0,0)(16,zd,7,10),e.k0s()()(),e.j41(17,"fieldset")(18,"div",2)(19,"div",3)(20,"legend"),e.EFF(21),e.nI1(22,"translate"),e.k0s(),e.nrm(23,"field-checkbox",6)(24,"field-checkbox",7)(25,"field-checkbox",8),e.k0s()(),e.j41(26,"val-errors",9),e.DNE(27,Kd,2,3,"ng-template",10),e.k0s()()()),2&o){let a;e.Y8G("formGroup",i.form)("save$",i.save$),e.R7$(),e.Y8G("disabled",!i.isTestingAllowed),e.R7$(),e.vxM(i.isTestingInProgress?2:3),e.R7$(3),e.JRh(e.bMT(6,16,"_i18n.SendTestEmail")),e.R7$(5),e.Y8G("options",i.integrationTypeOptions())("description",i.engineGuideLink.link?"true":"")("formControl",i.f.IntegrationType),e.R7$(),e.Y8G("href",e.bMT(12,18,i.engineGuideLink.link)),e.R7$(2),e.SpI(" ",e.i5U(14,20,i.engineGuideLink.description,e.eq3(25,Wd,i.engineGuideLink.name??""))," "),e.R7$(2),e.vxM((a=i.f.IntegrationType.value)===i.PbxSyslogIntegrationType.None?15:a===i.PbxSyslogIntegrationType.Custom?16:-1),e.R7$(6),e.JRh(e.bMT(22,23,"_i18n.SyslogCategory")),e.R7$(2),e.Y8G("formControl",i.CategoryConfigControls.IsSystemAlertsEnabled),e.R7$(),e.Y8G("formControl",i.CategoryConfigControls.IsEventLogsEnabled),e.R7$(),e.Y8G("formControl",i.CategoryConfigControls.IsAuditLogsEnabled),e.R7$(),e.Y8G("control",i.form.controls.CategoryConfig)}}
1,dependencies:[l.X1,l.BC,l.cb,l.l_,l.j4,ne.Q,ie.t,te.m,$.IH,mt.B,Te.q,gt.y,ke.P,je.a,dt.f,$.VI,y.D9],encapsulation:2,changeDetection:0})}return n})();const tp=[{path:"",resolve:{isMachineAdmin:Do.Xy},component:D,children:[{path:"crm",data:{title:"_i18n.CRM",navTitle:"_i18n.CRM",helpUri:"_i18n.AdminManualUri"},resolve:{systemParameters:Ve.M,crmSettings:ct.H,isPaid:ee.M7},component:Ki},{path:"",redirectTo:"crm",pathMatch:"full"},{path:"ai",data:{title:"AI",navTitle:"AI"},children:Od},{path:"call-flow",canActivate:[(n=["Apps.Read","Apps.ReadWrite"],()=>{const c=(0,s.WQX)(O.Z),t=(0,s.WQX)(S.Ix);return c.getMyToken$().pipe((0,v.T)(o=>n.some(i=>o.roles.includes(i))||t.parseUrl("error")))})],data:{title:"_i18n.CallScript",navTitle:"_i18n.CallScript"},children:es},{path:"api",canActivate:[or.UE],data:{title:"_i18n.API",navTitle:"_i18n.API"},children:hs},{path:"google",data:{title:"_i18n.Google",navTitle:"_i18n.Google"},resolve:{googleSettings:_o.u,systemParameters:Ve.M},component:$o},{path:"amazon",data:{title:"_i18n.Amazon",navTitle:"_i18n.Amazon"},resolve:{amazonIntegrationSettings:()=>{const n=(0,s.WQX)(sn),c=(0,s.WQX)(fe.s);return n.getAmazonIntegrationSettings({}).pipe((0,A.W)(t=>c.handleError(t)))}},component:Go},{path:"microsoft365",data:{title:"_i18n.Microsoft365",navTitle:"_i18n.Microsoft365",helpUri:"_i18n.AdminManualUri"},component:Co,resolve:{params:ee.cT}},{path:"teams",data:{title:"_i18n.Teams",navTitle:"_i18n.Teams",helpUri:"_i18n.AdminManualUri"},resolve:{isMultiCompanyMode:No.s,isEnterprise:ee.HX,microsoft365TeamsIntegration:()=>{const n=(0,s.WQX)(ln.a),c=(0,s.WQX)(O.Z),t=(0,s.WQX)(fe.s);return c.getMyToken$().pipe((0,I.n)(o=>o.enterprise&&o.roles.includes("SingleCompany")?n.getMicrosoft365TeamsIntegration({}).pipe((0,A.W)(i=>t.handleError(i))):(0,M.of)({})))},maxSimCalls:Qt.L},component:ia},{path:"hotel-services",data:{title:"_i18n.HotelServices",navTitle:"_i18n.HotelServices",helpUri:"_i18n.AdminManualUri"},resolve:{hotelServices:()=>{const n=(0,s.WQX)(nn),c=(0,s.WQX)(fe.s);return n.getHotelServices({}).pipe((0,A.W)(t=>c.handleError(t)))},groups:Xd.k},component:no},{path:"transcription",data:{title:"_i18n.Transcription",navTitle:"_i18n.Transcription",helpUri:"_i18n.AdminManualUri"},resolve:{systemParameters:Ve.M,transcribeSettings:oa.z,remoteArchivingFileSystemType:nr.b1},component:tr},{path:"data-connectors",data:{title:"_i18n.DataConnectors",navTitle:"_i18n.DataConnectors",helpUri:"_i18n.AdminManualUri"},resolve:{dataConnectorSettings:()=>{const n=(0,s.WQX)(Js.Z),c=(0,s.WQX)(wn),t=(0,s.WQX)(rn.Y),o=(0,s.WQX)(fe.s);return(0,Ee.p)([c.getDataConnectorSettings(),t.getGoogleSettings({$select:["ProjectId"]}),n.getSystemStatus({$select:["MaxSimCalls"]})]).pipe((0,v.T)(([i,a,r])=>({...i,...a,...r})),(0,A.W)(i=>o.handleError(i)))},isPaid:ee.M7},component:Ys},{path:"syslog",data:{title:"_i18n.Syslog",navTitle:"_i18n.Syslog",helpUri:"_i18n.AdminManualUri"},resolve:{syslogSettings:()=>{const n=(0,s.WQX)(si),c=(0,s.WQX)(fe.s);return n.getSyslogSettings({}).pipe((0,A.W)(t=>c.handleError(t)))}},component:Zd}]}];var n},31899(De,re,p){p.d(re,{w:()=>B});var s=p(35547),v=p(85802),O=p(23994),oe=p(89417),S=p(92996),e=p(38601),D=p(72510),_=p(56998),L=p(98352),ue=p(68018),ae=p(51606),P=p(89079),I=p(95604),M=p(8876),E=p(49769);const l=[[["val-errors"]]],j=["val-errors"];function K(W,ct){if(1&W){const k=s.RV6();s.j41(0,"field-wrapper",0)(1,"ng-select",1),s.nI1(2,"translate"),s.bIt("change",function(ve){v.eBV(k);const y=s.XpG();return v.Njj(y.valueChanged(ve))})("open",function(){v.eBV(k);const ve=s.XpG();return v.Njj(ve.loadTrunksOnce())}),s.k0s(),s.qex(3,2),s.SdG(4),s.bVm(),s.k0s()}if(2&W){const k=s.XpG();s.Y8G("label",k.label)("labelFor",k.id),s.R7$(),s.Y8G("id",k.id)("placeholder",s.bMT(2,11,k.placeholder))("disabled",!ct.trunks)("items",k.trunks)("ngModel",k.value)("multiple",!1)("closeOnSelect",!0)("clearable",k.isClearable)("loading",k.loading)}}let B=(()=>{class W extends L.z{tokenInfoService=(0,v.WQX)(S.Z);trunksApiService=(0,v.WQX)(O.T);modalService=(0,v.WQX)(e.B);destroy$=(0,v.WQX)(v.abz);el=(0,v.WQX)(s.aKT);id=(0,_.bn)("trunk-select");label="";isClearable=!0;isNew;access$=this.tokenInfoService.myToken$;trunks=[];loading=!1;routesLoaded=!1;ngOnInit(){!this.isClearable&&this.isNew&&this.loadTrunksOnce(!0)}ngAfterViewInit(){this.el.nativeElement.id=""}constructor(){super(),this.touchOnChange=!0}loadTrunksOnce(k=!1){this.routesLoaded||(this.routesLoaded=!0,this.loading=!0,this.cd.markForCheck(),this.trunksApiService.listTrunk({$select:["Id","Gateway($select=Name)","Groups"],$expand:["Groups($select=GroupId,Name)"],$f
1ilter:ae.O}).pipe((0,P.pQ)(this.destroy$)).subscribe({next:({value:G})=>{this.trunks=G||[],this.loadingFinished(),k&&this.valueChanged(this.trunks[0])},error:G=>{this.modalService.error(G),this.loadingFinished()}}))}writeValue(k){super.writeValue(k&&(this.trunks.find(G=>G.Id===k.Id)??k))}get placeholder(){return this.value?"":"_i18n.OutboundBlockCalls"}loadingFinished(){this.loading=!1,this.cd.markForCheck()}static \u0275fac=function(G){return new(G||W)};static \u0275cmp=s.VBU({type:W,selectors:[["app-trunk-select"]],hostVars:2,hostBindings:function(G,ve){2&G&&s.AVh("form-input",!0)},inputs:{id:"id",label:"label",isClearable:"isClearable",isNew:"isNew"},features:[s.Jv_([{provide:oe.kq,multi:!0,useExisting:W}]),s.Vt3],ngContentSelectors:j,decls:2,vars:3,consts:[["data-qa","trunk-select",1,"mb-0",3,"label","labelFor"],["data-qa","select","bindLabel","Gateway.Name",3,"change","open","id","placeholder","disabled","items","ngModel","multiple","closeOnSelect","clearable","loading"],["ngProjectAs","val-errors",5,["val-errors"]]],template:function(G,ve){if(1&G&&(s.NAR(l),s.nVh(0,K,5,13,"field-wrapper",0),s.nI1(1,"async")),2&G){let y;s.vxM((y=s.bMT(1,1,ve.access$))?0:-1,y)}},dependencies:[oe.YN,oe.BC,oe.vS,D.vr,I.z,M.c,ue.D9,E.Jj],styles:[".ng-touched.ng-invalid[_nghost-%COMP%]   ng-select[_ngcontent-%COMP%]:not(.ng-select-focused){--ng-select-border-color: var(--error)}"],changeDetection:0})}return W})()},51606(De,re,p){p.d(re,{O:()=>e,o:()=>D});var s=p(85802),v=p(96354),O=p(23994),oe=p(19037),S=p(99437);const e="(Gateway/Type eq 'Provider' or Gateway/Type eq 'Analog' or Gateway/Type eq 'BridgeMaster' or Gateway/Type eq 'BridgeSlave' or Gateway/Type eq 'BridgeSlaveOverTunnel') and not (Messaging/Provider eq 'facebook' or Messaging/Provider eq 'whatsapp' or Tags/any(t: t eq 'WM'))",D=()=>{const _=(0,s.WQX)(O.T),L=(0,s.WQX)(oe.s);return _.listTrunk({$top:1,$filter:e,$select:["Id"]}).pipe((0,v.T)(({value:ue})=>!!ue?.length),(0,S.W)(ue=>L.handleError(ue)))}},32817(De,re,p){p.d(re,{E:()=>v});var s=p(35547);let v=(()=>{class O{transform(S,e){return(e&&S&&e>0&&S.length>e?S.slice(0,e).concat("..."):S??[]).join?.(", ")||""}static \u0275fac=function(e){return new(e||O)};static \u0275pipe=s.EJ8({name:"appEclipsedList",type:O,pure:!0})}return O})()},44051(De,re,p){p.d(re,{i:()=>oe});var s=p(35547);function v(S,e){if(1&S&&s.Hgh(0,"i"),2&S){const D=s.XpG();s.HbH(s.VkB("status-indicator ",D.indicator))}}function O(S,e){if(1&S&&(s.rj2(0,"span",4),s.EFF(1),s.eux()),2&S){const D=s.XpG();s.R7$(),s.SpI(" (",D.type,")")}}let oe=(()=>{class S{indicator;name;type;static \u0275fac=function(_){return new(_||S)};static \u0275cmp=s.VBU({type:S,selectors:[["app-indicator-name-type"]],inputs:{indicator:"indicator",name:"name",type:"type"},decls:6,vars:3,consts:[[1,"d-flex","gap-2","align-items-center"],[3,"class"],[1,"line-clamp-1"],["data-qa","name"],["data-qa","type",1,"small"]],template:function(_,L){1&_&&(s.rj2(0,"div",0),s.nVh(1,v,1,3,"i",1),s.rj2(2,"span",2)(3,"span",3),s.EFF(4),s.eux(),s.nVh(5,O,2,1,"span",4),s.eux()()),2&_&&(s.R7$(),s.vxM(L.indicator?1:-1),s.R7$(3),s.JRh(L.name),s.R7$(),s.vxM(L.type?5:-1))},encapsulation:2,changeDetection:0})}return S})()},23671(De,re,p){p.d(re,{N:()=>_});var s=p(85802),v=p(89417),O=p(23294),oe=p(5964),S=p(96697),e=p(89079),D=p(35547);let _=(()=>{class L{controlDirective=(0,s.WQX)(v.vO);destroy$=(0,s.WQX)(s.abz);valueInitialized=!1;ignoreValueChange=!1;initializeValue;ngAfterViewInit(){this.control=this.controlDirective.control,this.control&&(this.control.valueChanges.pipe((0,O.F)(),(0,oe.p)(()=>!this.ignoreValueChange),(0,S.s)(1),(0,e.pQ)(this.destroy$)).subscribe(()=>{this.valueInitialized=!0}),this.tryInitValue())}ngOnChanges(ae){ae.initializeValue&&this.tryInitValue()}tryInitValue(){const ae=this.initializeValue;!ae||!this.control||this.valueInitialized||this.control.value===ae||(this.ignoreValueChange=!0,this.control.setValue(ae),this.control.markAsDirty(),this.ignoreValueChange=!1)}control;static \u0275fac=function(P){return new(P||L)};static \u0275dir=D.FsC({type:L,selectors:[["","initializeValue",""]],inputs:{initializeValue:"initializeValue"},features:[D.OA$]})}return L})()},81173(De,re,p){p.d(re,{Kz:()=>oe,Mh:()=>O,aw:()=>S});var v=p(59053);function O(D,_){return`https://${D}/${_??""}`}function oe(D,_){return`https://${D}/meet/${_}`}function S(D,_){return((D??"")+(_??"")).toLowerCase().replace(/[^a-zA-Z0-9]/g,"").substring(0,v.bl)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.