import{a as M,b as Q}from"./chunk-SN34CLEC.js";import{a as U,b as H}from"./chunk-ZENOWJOG.js";import{Wa as E,Xa as G,k as A,l as q,sa as R,ta as x,ua as V,va as _}from"./chunk-7YUL6BIM.js";import{a as B}from"./chunk-QST7UV2H.js";import{c as s,d as z}from"./chunk-V3J5YJ3L.js";import{a as O}from"./chunk-YTY7HHO3.js";import{O as C,Rd as w,g as D,ma as T,na as F,r as I,sa as p,x as c,xa as h}from"./chunk-4HFZZ7HS.js";import{a as S,e as g,h as y}from"./chunk-SZAW6ZBW.js";var m,N=g(()=>{z();m=class i{toQueryString(){let t=[];if(this.filter!==null&&this.filter.toString()&&t.push("filter="+encodeURIComponent(this.filter.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.customTypes)for(let e=0;e<this.customTypes.length;e++)this.customTypes[e]!==null&&t.push("customTypes="+encodeURIComponent(this.customTypes[e].toString()));if(this.includeSubScanConfigurations!==null&&this.includeSubScanConfigurations.toString()&&t.push("includeSubScanConfigurations="+encodeURIComponent(this.includeSubScanConfigurations.toString())),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.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.key!==null&&this.key.toString()&&t.push("key="+encodeURIComponent(this.key.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.filter=s.manageDefaultValue(t,"filter",""),this.inventoryScanType=t&&t.inventoryScanType?t.inventoryScanType:[],this.customTypes=s.manageDefaultArrayValue(t,"customTypes",void 0),this.includeSubScanConfigurations=s.manageDefaultValue(t,"includeSubScanConfigurations",!1),this.parentScanConfigurationID=s.manageDefaultValue(t,"parentScanConfigurationID",null),this.providers=s.manageDefaultArrayValue(t,"providers",void 0),this.pageNumber=s.manageDefaultValue(t,"pageNumber",0),this.pageSize=s.manageDefaultValue(t,"pageSize",0),this.sortField=s.manageDefaultValue(t,"sortField",""),this.key=s.manageDefaultValue(t,"key",""),this.sortOrder=s.manageDefaultValue(t,"sortOrder",1)}}});var P,b=g(()=>{T();w();P=(()=>{class i{constructor(){this.viewRequestSource=new D,this.viewRequest=this.viewRequestSource.asObservable()}view(e){this.viewRequestSource.next(e)}static{this.\u0275fac=function(r){return new(r||i)}}static{this.\u0275prov=p({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})()});var k,f,oe,J=g(()=>{T();F();Q();k=y(O());q();x();_();N();f=y(B());w();G();H();b();oe=(()=>{class i extends M{constructor(e,r,o){super(),this.pamAssetServices=e,this.errorService=r,this.importResultDialogViewService=o}create(e){return new V({id:null,label:null,scanType:e?.scanType,active:!0,inProgress:!1,resultCount:0,scanNow:!0,providerTemplate:new R(e?.providerTemplate),frequencyValue:-1})}get(e){return this.handleError(this.pamAssetServices.AccountDiscoveryConfigurations_GetScanConfiguration(e))}getAll(e){let r=e||A.Deep;return this.handleError(this.pamAssetServices.AccountDiscoveryConfigurations_GetScanConfigurations(r))}getAllWithPaging(e,r){let o=new m(S(S({},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(c(()=>!0)))}manageImportedAccountList(e,r,o){if(e.forEach(n=>{n.result&&n.result.hasSucceeded&&this.updateIsManagedStatus(r,n.userId)}),o){let n=f.groupBy(e,"userId");n=f.map(n,(u,v)=>({results:u}));let a={results:[]};n.forEach(u=>{let v=r.find(l=>l.id===u.results[0].userId)?.name,d="";u.results.filter(l=>!l.result.hasSucceeded).forEach(l=>d+=`- ${l.result.errorMessage} 
\r`),a.results.push({name:v,isSuccessful:d==="",errorMessage:d})}),this.importResultDialogViewService.view(a)}else this.importResultDialogViewService.view({results:e.map(n=>{let a=r.find(u=>u.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(c(()=>e.id)):this.pamAssetServices.AccountDiscoveryConfigurations_PostScanConfiguration(e).pipe(c(r=>(r||{id:null}).id))}handleError(e,r=null){return e.pipe(C(o=>(this.errorService.handleError(o),I(r))))}static{this.\u0275fac=function(r){return new(r||i)(h(E),h(U),h(P))}}static{this.\u0275prov=p({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})()});export{P as a,b,oe as c,J as d};
