import {p,l}from'./chunk-CIbFTbhP.js';import {S,R}from'./chunk-DgjB3m1L.js';import {J,a6 as pi,a5 as fh,ex as L,gt as gr,nt as Ht,AM as Hi,AN as Ne,jf as rp,c as tS,eO as Es,AO as y,AP as It,nC as w,bJ as F,ah as ot,ak as Jd,al as Kv,aa as ye,eR as mh,ad as ce,eo as f$1,eq as r,bP as he}from'./main-WUGO6e7n.js';var f,N=J(()=>{f$1();f=class i{toQueryString(){let t=[];if(this.customTypes)for(let e=0;e<this.customTypes.length;e++)this.customTypes[e]!==null&&t.push("customTypes="+encodeURIComponent(this.customTypes[e].toString()));if(this.filter!==null&&this.filter.toString()&&t.push("filter="+encodeURIComponent(this.filter.toString())),this.includeSubScanConfigurations!==null&&this.includeSubScanConfigurations.toString()&&t.push("includeSubScanConfigurations="+encodeURIComponent(this.includeSubScanConfigurations.toString())),this.inventoryScanType)for(let e=0;e<this.inventoryScanType.length;e++)this.inventoryScanType[e]!==null&&t.push("inventoryScanType="+encodeURIComponent(this.inventoryScanType[e].toString()));if(this.parentScanConfigurationID!==null&&this.parentScanConfigurationID.toString()&&t.push("parentScanConfigurationID="+encodeURIComponent(this.parentScanConfigurationID.toString())),this.providers)for(let e=0;e<this.providers.length;e++)this.providers[e]!==null&&t.push("providers="+encodeURIComponent(this.providers[e].toString()));return this.key!==null&&this.key.toString()&&t.push("key="+encodeURIComponent(this.key.toString())),this.pageNumber!==null&&this.pageNumber.toString()&&t.push("pageNumber="+encodeURIComponent(this.pageNumber.toString())),this.pageSize!==null&&this.pageSize.toString()&&t.push("pageSize="+encodeURIComponent(this.pageSize.toString())),this.sortField!==null&&this.sortField.toString()&&t.push("sortField="+encodeURIComponent(this.sortField.toString())),this.sortOrder!==null&&this.sortOrder.toString()&&t.push("sortOrder="+encodeURIComponent(this.sortOrder.toString())),t.join("&")}constructor(t=null){this.clone=()=>new i(this),this.customTypes=r.manageDefaultArrayValue(t,"customTypes",void 0),this.filter=r.manageDefaultValue(t,"filter",""),this.includeSubScanConfigurations=r.manageDefaultValue(t,"includeSubScanConfigurations",!1),this.inventoryScanType=t&&t.inventoryScanType?t.inventoryScanType:[],this.parentScanConfigurationID=r.manageDefaultValue(t,"parentScanConfigurationID",null),this.providers=r.manageDefaultArrayValue(t,"providers",void 0),this.key=r.manageDefaultValue(t,"key",""),this.pageNumber=r.manageDefaultValue(t,"pageNumber",0),this.pageSize=r.manageDefaultValue(t,"pageSize",0),this.sortField=r.manageDefaultValue(t,"sortField",""),this.sortOrder=r.manageDefaultValue(t,"sortOrder",1);}};});var P,b=J(()=>{pi();tS();P=(()=>{class i{constructor(){this.viewRequestSource=new he,this.viewRequest=this.viewRequestSource.asObservable();}view(e){this.viewRequestSource.next(e);}static{this.\u0275fac=function(r){return new(r||i)};}static{this.\u0275prov=ce({token:i,factory:i.\u0275fac,providedIn:"root"});}}return i})();});var k,d,ae,K=J(()=>{pi();fh();p();k=L(gr());Ht();Hi();Ne();N();d=L(rp());tS();Es();S();b();ae=(()=>{class i extends l{constructor(e,r,o){super(),this.pamAssetServices=e,this.errorService=r,this.importResultDialogViewService=o;}create(e){return new y({id:null,label:null,scanType:e?.scanType,active:!0,inProgress:!1,resultCount:0,scanNow:!0,providerTemplate:new It(e?.providerTemplate),frequencyValue:-1})}get(e){return this.handleError(this.pamAssetServices.AccountDiscoveryConfigurations_GetScanConfiguration(e))}getAll(e){let r=e||w.Deep;return this.handleError(this.pamAssetServices.AccountDiscoveryConfigurations_GetScanConfigurations(r))}getAllWithPaging(e,r){let o=new f(F(F({},e),r));return this.handleError(this.pamAssetServices.AccountDiscoveryConfigurations_GetScanConfigurationsList(o))}save(e){return this.handleError(this.saveData(e))}startScanNow(e){return this.handleError(this.pamAssetServices.AccountDiscoveryConfigurations_ScanNow(e))}delete(e){return this.handleError(this.pamAssetServices.AccountDiscoveryConfigurations_DeleteScanConfiguration(e).pipe(ot(()=>!0)))}manageImportedAccountList(e,r,o){if(e.forEach(n=>{n.result&&n.result.hasSucceeded&&this.updateIsManagedStatus(r,n.userId);}),o){let n=d.groupBy(e,"userId"),a=d.map(n,c=>({results:c})),l={results:[]};a.forEach(c=>{let F=r.find(u=>u.id===c.results[0].userId)?.name,S="";c.results.filter(u=>!u.result.hasSucceeded).forEach(u=>S+=`- ${u.result.errorMessage} 
\r`),l.results.push({name:F,isSuccessful:S==="",errorMessage:S});}),this.importResultDialogViewService.view(l);}else this.importResultDialogViewService.view({results:e.map(n=>{let a=r.find(l=>l.id===n.userId);return {name:a?.username??a?.userPrincipalName??a?.name,isSuccessful:n.result.hasSucceeded,errorMessage:n.result.errorMessage}})});}updateIsManagedStatus(e,r){let o=e.find(n=>n.id===r);o&&(o.isManaged=!0);}saveData(e){return e.startDateTime=k.default.utc(e.startDateTime).toISOString(),e.id?this.pamAssetServices.AccountDiscoveryConfigurations_PutScanConfiguration(e.id,e).pipe(ot(()=>e.id)):this.pamAssetServices.AccountDiscoveryConfigurations_PostScanConfiguration(e).pipe(ot(r=>(r||{id:null}).id))}handleError(e,r=null){return e.pipe(Jd(o=>(this.errorService.handleError(o),Kv(r))))}static{this.\u0275fac=function(r){return new(r||i)(ye(mh),ye(R),ye(P))};}static{this.\u0275prov=ce({token:i,factory:i.\u0275fac,providedIn:"root"});}}return i})();});export{K,P,ae as a,b};