import{a as U,b as H,c as M,d as Q}from"./chunk-2PCDIQD3.js";import{Qa as E,Ra as G,k as A,l as q,oa as R,pa as x,qa as V,ra as _}from"./chunk-RGY5WL55.js";import{a as B}from"./chunk-WBUA76JY.js";import{c as s,d as z}from"./chunk-AIHAZUSZ.js";import{a as O}from"./chunk-IOINCEV4.js";import{Gd as w,O as C,g as D,ma as T,na as F,r as I,sa as p,x as c,xa as h}from"./chunk-JSJB5BKT.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};
