@hpcc-js/comms 3.22.0 → 3.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var Ti=Object.create;var jt=Object.defineProperty;var Mi=Object.getOwnPropertyDescriptor;var wi=Object.getOwnPropertyNames;var Bi=Object.getPrototypeOf,Ni=Object.prototype.hasOwnProperty;var Qi=(s,e)=>{for(var t in e)jt(s,t,{get:e[t],enumerable:!0})},en=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of wi(e))!Ni.call(s,n)&&n!==t&&jt(s,n,{get:()=>e[n],enumerable:!(r=Mi(e,n))||r.enumerable});return s};var ue=(s,e,t)=>(t=s!=null?Ti(Bi(s)):{},en(e||!s||!s.__esModule?jt(t,"default",{value:s,enumerable:!0}):t,s)),Li=s=>en(jt({},"__esModule",{value:!0}),s);var fc={};Qi(fc,{AccessService:()=>tr,AccountService:()=>sr,Activity:()=>vr,Attr:()=>Vs,Attribute:()=>fe,BUILD_VERSION:()=>vi,BaseScope:()=>ys,ClientTools:()=>st,CloudService:()=>rr,CodesignService:()=>nr,Connection:()=>Yt,DFUArrayActions:()=>$i,DFUChangeProtection:()=>to,DFUChangeRestriction:()=>so,DFUDefFileFormat:()=>eo,DFUService:()=>ve,DFUWorkunit:()=>Xr,DFUWorkunitCache:()=>vs,DFUXRefService:()=>or,DaliService:()=>ir,Definition:()=>js,ECLGraph:()=>Rt,ECLScope:()=>Be,ESPConnection:()=>Xt,ESPExceptions:()=>pe,EclService:()=>at,EclccErrors:()=>Vt,ElkService:()=>cr,EnvchkErrors:()=>Js,Errors:()=>vt,Field:()=>Hs,File:()=>Os,FileSpray:()=>ke,FileSprayService:()=>ge,FileSprayStates:()=>pn,Folder:()=>Ys,GlobalResultCache:()=>Ws,GraphCache:()=>Ct,Import:()=>Gt,LocalWorkunit:()=>Ks,LogType:()=>fn,LogaccessService:()=>ur,LogicalFile:()=>Vr,LogicalFileCache:()=>Ms,Machine:()=>wt,MachineCache:()=>ws,MachineService:()=>ie,PKG_NAME:()=>Gi,PKG_VERSION:()=>ki,PackageProcessService:()=>lr,PropertyType:()=>ci,Query:()=>Or,QueryGraph:()=>Lt,RelatedProperty:()=>ui,Resource:()=>Wt,ResourcesService:()=>pr,Result:()=>Pt,ResultCache:()=>It,SMCService:()=>Ye,SashaService:()=>dr,Scope:()=>Je,ScopeEdge:()=>Nr,ScopeGraph:()=>xt,ScopeSubgraph:()=>wr,ScopeVertex:()=>Br,Service:()=>x,Source:()=>_s,SourceFile:()=>Tt,Store:()=>Yr,StoreCache:()=>ks,StoreService:()=>Xe,TargetAudience:()=>Sn,TargetCluster:()=>Fe,TargetClusterCache:()=>Ns,Timer:()=>Mt,Topology:()=>Bt,TopologyCache:()=>Ls,TopologyService:()=>G,ValueChangedMessage:()=>Ce,Version:()=>tt,WUStateID:()=>Ss,WUUpdate:()=>he,Workspace:()=>Xs,Workunit:()=>Ee,WorkunitCache:()=>Ps,WorkunitsService:()=>L,WorkunitsServiceEx:()=>ft,WsAccess:()=>er,WsCodesign:()=>$t,WsDfu:()=>We,WsLogaccess:()=>N,WsSMC:()=>xr,WsSasha:()=>gr,WsTopology:()=>Ar,WsWorkunits:()=>V,XGMMLEdge:()=>Mr,XGMMLGraph:()=>Rs,XGMMLSubgraph:()=>Ir,XGMMLVertex:()=>Tr,XSDNode:()=>yt,XSDSchema:()=>Et,XSDSimpleType:()=>Ut,XSDXMLNode:()=>bt,attachWorkspace:()=>xe,clearAllClientToolsCache:()=>hc,createConnection:()=>ot,createGraph:()=>At,createXGMMLGraph:()=>Qr,defaultTargetCluster:()=>$a,deserializeResponse:()=>rn,get:()=>cn,hookSend:()=>Oi,instanceOfIConnection:()=>ji,instanceOfIOptions:()=>Vi,isArray:()=>ln,isECLResult:()=>Wr,isExceptions:()=>Xi,isWUInfoWorkunit:()=>Ba,isWUQueryECLWorkunit:()=>wa,jsonp:()=>nn,locateAllClientTools:()=>xi,locateClientTools:()=>zr,parseXSD:()=>xs,parseXSD2:()=>Qa,post:()=>an,qualifiedIDBoundary:()=>mc,send:()=>un,serializeRequest:()=>le,setTransportFactory:()=>Yi,splitMetric:()=>li,targetClusters:()=>Za,walkXmlJson:()=>zs});module.exports=Li(fc);var it=require("@hpcc-js/util"),Ai=require("@xmldom/xmldom"),X=ue(require("node:https"),1),Zr=require("node:buffer"),Zs=require("undici");var tn=`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,__name=(e,n)=>t(e,`name`,{value:n,configurable:!0}),n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,__copyProps=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},__toESM=(n,r,o)=>(o=n==null?{}:e(i(n)),__copyProps(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));let o=require("@hpcc-js/util"),s=require("@xmldom/xmldom"),c=require("node:https");c=__toESM(c,1);let l=require("node:buffer"),u=require("undici"),d=require("node:child_process");d=__toESM(d,1);let f=require("node:crypto");f=__toESM(f,1);let p=require("node:fs");p=__toESM(p,1);let m=require("node:os");m=__toESM(m,1);let h=require("node:path");h=__toESM(h,1);var g=`
2
2
  Trustwave Secure Global Extended Validation CA, Level 1
3
3
  SecureTrust Corporation
4
4
  00F6F61CE4A3635BB0CA8AACEEFCB2D0F0
@@ -907,20 +907,20 @@ AZKXRRJ+oPM+rRk6ct30UJMDEr5E0k9BpIycnR+j9sKS50gU/k6bpZFXrsY3crsC
907
907
  MGclCrEMXu6pY5Jv5ZAL/mYiykf9ijH3g/56vxC+GCsej/YpHpRZ744hN8tRmKVu
908
908
  Sw==
909
909
  -----END CERTIFICATE-----
910
- `;var Gi="__PACKAGE_NAME__",ki="__PACKAGE_VERSION__",vi="__BUILD_VERSION__";var Ge=require("@hpcc-js/util");var v=require("@hpcc-js/util"),sn=(0,v.scopedLogger)("comms/connection.ts");function Vi(s){return"baseUrl"in s}var Hi={type:"post",baseUrl:"",userID:"",password:"",rejectUnauthorized:!0,timeoutSecs:60};function ji(s){return typeof s.opts=="function"&&typeof s.send=="function"&&typeof s.clone=="function"}function te(s,e){return e===void 0||e===!0?encodeURIComponent(s):""+s}function le(s,e=!0,t=""){if(t&&(t+="."),typeof s!="object")return te(s,e);let r=[];for(let n in s)if(s.hasOwnProperty(n))if(s[n]instanceof Array){let i=!1;s[n].forEach((o,a)=>{typeof o=="object"?(i=!0,r.push(le(o,e,t+te(`${n}.${a}`,e)))):r.push(t+te(`${n}_i${a}`,e)+"="+le(o,e))}),i&&r.push(t+te(`${n}.itemcount`,e)+"="+s[n].length)}else typeof s[n]=="object"?s[n]&&s[n].Item instanceof Array?(r.push(le(s[n].Item,e,t+te(n,e))),r.push(t+te(`${n}.itemcount`,e)+"="+s[n].Item.length)):r.push(le(s[n],e,t+te(n,e))):s[n]!==void 0?r.push(t+te(n,e)+"="+te(s[n],e)):r.push(t+te(n,e));return r.join("&")}function rn(s){return JSON.parse(s)}function nn(s,e,t={},r="json",n){return n&&console.warn("Header attributes ignored for JSONP connections"),new Promise((i,o)=>{let a=s.timeoutSecs*1e3,c=5e3,l="jsonp_callback_"+Math.round(Math.random()*999999);window[l]=function(D){a=0,f(),i(r==="json"&&typeof D=="string"?rn(D):D)};let u=document.createElement("script"),g=(0,v.join)(s.baseUrl,e);g+=g.indexOf("?")>=0?"&":"?",u.src=g+"jsonp="+l+"&"+le(t,s.encodeRequest),document.body.appendChild(u);let p=setInterval(function(){a<=0?clearInterval(p):(a-=c,a<=0?(clearInterval(p),sn.error("Request timeout: "+u.src),f(),o(Error("Request timeout: "+u.src))):sn.debug("Request pending ("+a/1e3+" sec): "+u.src))},c);function f(){delete window[l],document.body.removeChild(u)}})}function _i(s){return s.userID?{Authorization:`Basic ${(0,v.utf8ToBase64)(`${s.userID}:${s.password}`)}`}:{}}var _t={};function on(s,e,t,r,n){r={..._i(s),...r},t={credentials:_t[s.baseUrl]?"omit":"include",...t,headers:r},s.baseUrl.indexOf("https:")===0&&(s.rejectUnauthorized===!1&&v.root.__hpcc_rejectUnauthorizedAgent?t.dispatcher=v.root.__hpcc_rejectUnauthorizedAgent:v.root.__hpcc_trustwaveAgent&&(t.agent=v.root.__hpcc_trustwaveAgent));function i(a){if(a.ok)switch(n){case"json":return a.json();case"arraybuffer":return a.arrayBuffer();default:return a.text()}throw new Error(a.statusText)}let o=v.root.__hpcc_undiciFetch??fetch;return(0,v.promiseTimeout)(s.timeoutSecs*1e3,o((0,v.join)(s.baseUrl,e),t).then(i).catch(a=>(t.credentials=_t[s.baseUrl]?"include":"omit",o((0,v.join)(s.baseUrl,e),t).then(i).then(c=>(_t[s.baseUrl]=!_t[s.baseUrl],c)))))}function an(s,e,t,r="json",n){t.upload_&&(delete t.upload_,e+="?upload_");let i;return t.abortSignal_&&(i=t.abortSignal_,delete t.abortSignal_),on(s,e,{method:"post",body:le(t,s.encodeRequest),signal:i},{"Content-Type":"application/x-www-form-urlencoded",...n},r)}function cn(s,e,t,r="json",n){let i;return t.abortSignal_&&(i=t.abortSignal_,delete t.abortSignal_),on(s,`${e}?${le(t,s.encodeRequest)}`,{method:"get",signal:i},{...n},r)}function un(s,e,t,r="json",n){let i;switch(s.type){case"jsonp":i=nn(s,e,t,r,n);break;case"get":i=cn(s,e,t,r,n);break;default:i=an(s,e,t,r,n);break}return i}var Ot=un;function Oi(s){let e=Ot;return s&&(Ot=s),e}var Yt=class s{_opts;get baseUrl(){return this._opts.baseUrl}constructor(e){this.opts(e)}opts(e){return arguments.length===0?this._opts:(this._opts={...Hi,...e},this)}send(e,t,r="json",n){return this._opts.hookSend?this._opts.hookSend(this._opts,e,t,r,Ot,n):Ot(this._opts,e,t,r,n)}clone(){return new s(this.opts())}},ot=function(s){return new Yt(s)};function Yi(s){let e=ot;return ot=s,e}function ln(s){return Object.prototype.toString.call(s)==="[object Array]"}var pe=class extends Error{isESPExceptions=!0;action;request;Source;Exception;constructor(e,t,r){super("ESPException: "+r.Source),this.action=e,this.request=t,this.Source=r.Source,this.Exception=r.Exception,r.Exception.length?this.message=`${r.Exception[0].Code}: ${r.Exception[0].Message}`:this.message=""}};function Xi(s){return s instanceof pe||s.isESPExceptions&&Array.isArray(s.Exception)}function qi(s){return s.send!==void 0}var Xt=class s{_connection;get baseUrl(){return this._connection.opts().baseUrl}_service;_version;constructor(e,t,r){this._connection=qi(e)?e:ot(e),this._service=t,this._version=r}service(e){return e===void 0?this._service:(this._service=e,this)}version(e){return e===void 0?this._version:(this._version=e,this)}toESPStringArray(e,t){if(ln(e[t])){for(let r=0;r<e[t].length;++r)e[t+"_i"+r]=e[t][r];delete e[t]}return e}opts(e){return e===void 0?this._connection.opts():(this._connection.opts(e),this)}send(e,t={},r="json",n=!1,i,o){let a={...t,ver_:this._version};n&&(a.upload_=!0),i&&(a.abortSignal_=i);let c,l="json";switch(r){case"text":c=(0,Ge.join)(this._service,e),l="text";break;case"arraybuffer":c=(0,Ge.join)(this._service,e+".json"),l="arraybuffer";break;case"xsd":c=(0,Ge.join)(this._service,e+".xsd"),l="text";break;case"json2":c=(0,Ge.join)(this._service,e+"/json"),r="json",e=e.split("/").pop();break;default:c=(0,Ge.join)(this._service,e+".json")}return this._connection.send(c,a,l).then(u=>{if(r==="json"){let g;if(u&&u.Exceptions)throw new pe(e,a,u.Exceptions);if(u&&(g=u[o||e+"Response"]),!g)throw new pe(e,a,{Source:"ESPConnection.send",Exception:[{Code:0,Message:"Missing Response"}]});return g}return u})}clone(){return new s(this._connection.clone(),this._service,this._version)}},x=class{_connection;get baseUrl(){return this._connection.opts().baseUrl}constructor(e,t,r){this._connection=new Xt(e,t,r)}opts(){return this._connection.opts()}connection(){return this._connection.clone()}};var ke;(t=>{let s;(l=>(l.Delete="Delete",l.Protect="Protect",l.Unprotect="Unprotect",l.Restore="Restore",l.SetToFailed="SetToFailed",l.Archive="Archive"))(s=t.DFUWUActions||={});let e;(D=>(D.copy="copy",D.remove="remove",D.move="move",D.rename="rename",D.replicate="replicate",D.import="import",D.export="export",D.monitor="monitor",D.copymerge="copymerge",D.supercopy="supercopy",D.publish="publish"))(e=t.DFUCommand||={})})(ke||={});var qt=class extends x{constructor(e){super(e,"FileSpray","1.29")}AbortDFUWorkunit(e,t){return this._connection.send("AbortDFUWorkunit",e,"json",!1,t,"AbortDFUWorkunitResponse")}Copy(e,t){return this._connection.send("Copy",e,"json",!1,t,"CopyResponse")}CreateDFUPublisherWorkunit(e,t){return this._connection.send("CreateDFUPublisherWorkunit",e,"json",!1,t,"CreateDFUPublisherWorkunitResponse")}CreateDFUWorkunit(e,t){return this._connection.send("CreateDFUWorkunit",e,"json",!1,t,"CreateDFUWorkunitResponse")}DFUWUFile(e,t){return this._connection.send("DFUWUFile",e,"json",!1,t,"DFUWUFileResponse")}DFUWUSearch(e,t){return this._connection.send("DFUWUSearch",e,"json",!1,t,"DFUWUSearchResponse")}DFUWorkunitsAction(e,t){return this._connection.send("DFUWorkunitsAction",e,"json",!1,t,"DFUWorkunitsActionResponse")}DeleteDFUWorkunit(e,t){return this._connection.send("DeleteDFUWorkunit",e,"json",!1,t,"DeleteDFUWorkunitResponse")}DeleteDFUWorkunits(e,t){return this._connection.send("DeleteDFUWorkunits",e,"json",!1,t,"DeleteDFUWorkunitsResponse")}DeleteDropZoneFiles(e,t){return this._connection.send("DeleteDropZoneFiles",e,"json",!1,t,"DFUWorkunitsActionResponse")}Despray(e,t){return this._connection.send("Despray",e,"json",!1,t,"DesprayResponse")}DfuMonitor(e,t){return this._connection.send("DfuMonitor",e,"json",!1,t,"DfuMonitorResponse")}DropZoneFileSearch(e,t){return this._connection.send("DropZoneFileSearch",e,"json",!1,t,"DropZoneFileSearchResponse")}DropZoneFiles(e,t){return this._connection.send("DropZoneFiles",e,"json",!1,t,"DropZoneFilesResponse")}EchoDateTime(e,t){return this._connection.send("EchoDateTime",e,"json",!1,t,"EchoDateTimeResponse")}FileList(e,t){return this._connection.send("FileList",e,"json",!1,t,"FileListResponse")}GetDFUExceptions(e,t){return this._connection.send("GetDFUExceptions",e,"json",!1,t,"GetDFUExceptionsResponse")}GetDFUProgress(e,t){return this._connection.send("GetDFUProgress",e,"json",!1,t,"ProgressResponse")}GetDFUServerQueues(e,t){return this._connection.send("GetDFUServerQueues",e,"json",!1,t,"GetDFUServerQueuesResponse")}GetDFUWorkunit(e,t){return this._connection.send("GetDFUWorkunit",e,"json",!1,t,"GetDFUWorkunitResponse")}GetDFUWorkunits(e,t){return this._connection.send("GetDFUWorkunits",e,"json",!1,t,"GetDFUWorkunitsResponse")}GetRemoteTargets(e,t){return this._connection.send("GetRemoteTargets",e,"json",!1,t,"GetRemoteTargetsResponse")}GetSprayTargets(e,t){return this._connection.send("GetSprayTargets",e,"json",!1,t,"GetSprayTargetsResponse")}OpenSave(e,t){return this._connection.send("OpenSave",e,"json",!1,t,"OpenSaveResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"FileSprayPingResponse")}Rename(e,t){return this._connection.send("Rename",e,"json",!1,t,"RenameResponse")}Replicate(e,t){return this._connection.send("Replicate",e,"json",!1,t,"ReplicateResponse")}ShowResult(e,t){return this._connection.send("ShowResult",e,"json",!1,t,"ShowResultResponse")}SprayFixed(e,t){return this._connection.send("SprayFixed",e,"json",!1,t,"SprayFixedResponse")}SprayVariable(e,t){return this._connection.send("SprayVariable",e,"json",!1,t,"SprayResponse")}SubmitDFUWorkunit(e,t){return this._connection.send("SubmitDFUWorkunit",e,"json",!1,t,"SubmitDFUWorkunitResponse")}UpdateDFUWorkunit(e,t){return this._connection.send("UpdateDFUWorkunit",e,"json",!1,t,"UpdateDFUWorkunitResponse")}};var pn=(u=>(u[u.unknown=0]="unknown",u[u.scheduled=1]="scheduled",u[u.queued=2]="queued",u[u.started=3]="started",u[u.aborted=4]="aborted",u[u.failed=5]="failed",u[u.finished=6]="finished",u[u.monitoring=7]="monitoring",u[u.aborting=8]="aborting",u[u.notfound=999]="notfound",u))(pn||{}),ge=class extends qt{DFUWUFileEx(e){return this._connection.send("DFUWUFile",e,"text")}SprayFixedEx(e){return this._connection.send("SprayFixed",e)}SprayVariableEx(e){return this._connection.send("SprayVariable",e,"json",!1,null,"SprayResponse")}DesprayEx(e){return this._connection.send("Despray",e)}UpdateDFUWorkunitEx(e){return this._connection.send("UpdateDFUWorkunit",e,"json",!1,void 0,"UpdateDFUWorkunitResponse")}};var er;(o=>{let s;(l=>(l.User="User",l.Group="Group"))(s=o.ViewMemberType||={});let e;(p=>(p.username="username",p.fullname="fullname",p.passwordexpiration="passwordexpiration",p.employeeID="employeeID",p.employeeNumber="employeeNumber"))(e=o.UserSortBy||={});let t;(l=>(l.Name="Name",l.ManagedBy="ManagedBy"))(t=o.GroupSortBy||={});let r;(u=>(u.Any="Any",u.User="User",u.Group="Group"))(r=o.AccountTypeReq||={});let n;(l=>(l.Name="Name",l.Type="Type"))(n=o.ResourcePermissionSortBy||={});let i;(c=>c.Name="Name")(i=o.ResourceSortBy||={})})(er||={});var Jt=class extends x{constructor(e){super(e,"ws_access","1.17")}AccountPermissions(e,t){return this._connection.send("AccountPermissions",e,"json",!1,t,"AccountPermissionsResponse")}AccountPermissionsV2(e,t){return this._connection.send("AccountPermissionsV2",e,"json",!1,t,"AccountPermissionsV2Response")}AddUser(e,t){return this._connection.send("AddUser",e,"json",!1,t,"AddUserResponse")}AddView(e,t){return this._connection.send("AddView",e,"json",!1,t,"AddViewResponse")}AddViewColumn(e,t){return this._connection.send("AddViewColumn",e,"json",!1,t,"AddViewColumnResponse")}AddViewMember(e,t){return this._connection.send("AddViewMember",e,"json",!1,t,"AddViewMemberResponse")}ClearPermissionsCache(e,t){return this._connection.send("ClearPermissionsCache",e,"json",!1,t,"ClearPermissionsCacheResponse")}DeleteView(e,t){return this._connection.send("DeleteView",e,"json",!1,t,"DeleteViewResponse")}DeleteViewColumn(e,t){return this._connection.send("DeleteViewColumn",e,"json",!1,t,"DeleteViewColumnResponse")}DeleteViewMember(e,t){return this._connection.send("DeleteViewMember",e,"json",!1,t,"DeleteViewMemberResponse")}DisableScopeScans(e,t){return this._connection.send("DisableScopeScans",e,"json",!1,t,"DisableScopeScansResponse")}EnableScopeScans(e,t){return this._connection.send("EnableScopeScans",e,"json",!1,t,"EnableScopeScansResponse")}FilePermission(e,t){return this._connection.send("FilePermission",e,"json",!1,t,"FilePermissionResponse")}GroupAction(e,t){return this._connection.send("GroupAction",e,"json",!1,t,"GroupActionResponse")}GroupAdd(e,t){return this._connection.send("GroupAdd",e,"json",!1,t,"GroupAddResponse")}GroupEdit(e,t){return this._connection.send("GroupEdit",e,"json",!1,t,"GroupEditResponse")}GroupMemberEdit(e,t){return this._connection.send("GroupMemberEdit",e,"json",!1,t,"GroupMemberEditResponse")}GroupMemberEditInput(e,t){return this._connection.send("GroupMemberEditInput",e,"json",!1,t,"GroupMemberEditInputResponse")}GroupMemberQuery(e,t){return this._connection.send("GroupMemberQuery",e,"json",!1,t,"GroupMemberQueryResponse")}GroupQuery(e,t){return this._connection.send("GroupQuery",e,"json",!1,t,"GroupQueryResponse")}Groups(e,t){return this._connection.send("Groups",e,"json",!1,t,"GroupResponse")}PermissionAction(e,t){return this._connection.send("PermissionAction",e,"json",!1,t,"PermissionActionResponse")}Permissions(e,t){return this._connection.send("Permissions",e,"json",!1,t,"BasednsResponse")}PermissionsReset(e,t){return this._connection.send("PermissionsReset",e,"json",!1,t,"PermissionsResetResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"ws_accessPingResponse")}QueryScopeScansEnabled(e,t){return this._connection.send("QueryScopeScansEnabled",e,"json",!1,t,"QueryScopeScansEnabledResponse")}QueryUserViewColumns(e,t){return this._connection.send("QueryUserViewColumns",e,"json",!1,t,"QueryUserViewColumnsResponse")}QueryViewColumns(e,t){return this._connection.send("QueryViewColumns",e,"json",!1,t,"QueryViewColumnsResponse")}QueryViewMembers(e,t){return this._connection.send("QueryViewMembers",e,"json",!1,t,"QueryViewMembersResponse")}QueryViews(e,t){return this._connection.send("QueryViews",e,"json",!1,t,"QueryViewsResponse")}ResourceAdd(e,t){return this._connection.send("ResourceAdd",e,"json",!1,t,"ResourceAddResponse")}ResourceDelete(e,t){return this._connection.send("ResourceDelete",e,"json",!1,t,"ResourceDeleteResponse")}ResourcePermissionQuery(e,t){return this._connection.send("ResourcePermissionQuery",e,"json",!1,t,"ResourcePermissionQueryResponse")}ResourcePermissions(e,t){return this._connection.send("ResourcePermissions",e,"json",!1,t,"ResourcePermissionsResponse")}ResourceQuery(e,t){return this._connection.send("ResourceQuery",e,"json",!1,t,"ResourceQueryResponse")}Resources(e,t){return this._connection.send("Resources",e,"json",!1,t,"ResourcesResponse")}UserAccountExport(e,t){return this._connection.send("UserAccountExport",e,"json",!1,t,"UserAccountExportResponse")}UserAction(e,t){return this._connection.send("UserAction",e,"json",!1,t,"UserActionResponse")}UserEdit(e,t){return this._connection.send("UserEdit",e,"json",!1,t,"UserEditResponse")}UserGroupEdit(e,t){return this._connection.send("UserGroupEdit",e,"json",!1,t,"UserGroupEditResponse")}UserGroupEditInput(e,t){return this._connection.send("UserGroupEditInput",e,"json",!1,t,"UserGroupEditInputResponse")}UserInfoEdit(e,t){return this._connection.send("UserInfoEdit",e,"json",!1,t,"UserInfoEditResponse")}UserInfoEditInput(e,t){return this._connection.send("UserInfoEditInput",e,"json",!1,t,"UserInfoEditInputResponse")}UserPosix(e,t){return this._connection.send("UserPosix",e,"json",!1,t,"UserPosixResponse")}UserPosixInput(e,t){return this._connection.send("UserPosixInput",e,"json",!1,t,"UserPosixInputResponse")}UserQuery(e,t){return this._connection.send("UserQuery",e,"json",!1,t,"UserQueryResponse")}UserResetPass(e,t){return this._connection.send("UserResetPass",e,"json",!1,t,"UserResetPassResponse")}UserResetPassInput(e,t){return this._connection.send("UserResetPassInput",e,"json",!1,t,"UserResetPassInputResponse")}UserSudoers(e,t){return this._connection.send("UserSudoers",e,"json",!1,t,"UserSudoersResponse")}UserSudoersInput(e,t){return this._connection.send("UserSudoersInput",e,"json",!1,t,"UserSudoersInputResponse")}Users(e,t){return this._connection.send("Users",e,"json",!1,t,"UserResponse")}};var tr=class extends Jt{};var zt=class extends x{constructor(e){super(e,"ws_account","1.07")}MyAccount(e,t){return this._connection.send("MyAccount",e,"json",!1,t,"MyAccountResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"ws_accountPingResponse")}UpdateUser(e,t){return this._connection.send("UpdateUser",e,"json",!1,t,"UpdateUserResponse")}UpdateUserInput(e,t){return this._connection.send("UpdateUserInput",e,"json",!1,t,"UpdateUserInputResponse")}VerifyUser(e,t){return this._connection.send("VerifyUser",e,"json",!1,t,"VerifyUserResponse")}};var sr=class extends zt{VerifyUser(e){return this._connection.send("VerifyUser",e).catch(t=>{if(t.isESPExceptions&&t.Exception.some(r=>r.Code===20043))return{retcode:20043,Exceptions:{Source:"wsAccount",Exception:t.Exception}};throw t})}};var gn=require("@hpcc-js/util");var Kt=class extends x{constructor(e){super(e,"WsCloud","1.02")}GetPODs(e,t){return this._connection.send("GetPODs",e,"json",!1,t,"GetPODsResponse")}GetServices(e,t){return this._connection.send("GetServices",e,"json",!1,t,"GetServicesResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"WsCloudPingResponse")}};var Ji=(0,gn.scopedLogger)("@hpcc-js/comms/services/wsCloud.ts");function zi(s){return s?.Pods!==void 0}function Ki(s){return s.spec?.containers?.reduce((e,t)=>(t.ports?.forEach(r=>{e.push({ContainerPort:r.containerPort,Name:r.name,Protocol:r.protocol})}),e),[])??[]}function Zi(s){return s.filter(e=>{let t=e?.metadata?.labels??{};return t.hasOwnProperty("app.kubernetes.io/part-of")&&t["app.kubernetes.io/part-of"]==="HPCC-Platform"}).map(e=>{let t=new Date(e.metadata?.creationTimestamp);return{Name:e.metadata.name,Status:e.status?.phase,CreationTimestamp:t.toISOString(),ContainerName:e.status?.containerStatuses?.reduce((r,n)=>(n.name&&r.push(n.name),r),[]).join(", ")??"",ContainerCount:e.spec?.containers?.length??0,ContainerReadyCount:e.status?.containerStatuses?.reduce((r,n)=>r+(n.ready?1:0),0),ContainerRestartCount:e.status?.containerStatuses?.reduce((r,n)=>r+n.restartCount,0),Ports:{Port:Ki(e)}}})}var rr=class extends Kt{getPODs(){return super.GetPODs({}).then(e=>{if(zi(e))return e.Pods?.Pod??[];try{let t=typeof e.Result=="string"?JSON.parse(e.Result):e.Result;return Zi(t?.items??[])}catch(t){return Ji.error(`Error parsing V1Pods json '${t instanceof Error?t.message:String(t)}'`),[]}})}};var $t;(e=>{let s;(r=>r.gpg="gpg")(s=e.SigningMethodType||={})})($t||={});var Zt=class extends x{constructor(e){super(e,"ws_codesign","1.1")}ListUserIDs(e,t){return this._connection.send("ListUserIDs",e,"json",!1,t,"ListUserIDsResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"ws_codesignPingResponse")}Sign(e,t){return this._connection.send("Sign",e,"json",!1,t,"SignResponse")}Verify(e,t){return this._connection.send("Verify",e,"json",!1,t,"VerifyResponse")}};var nr=class extends Zt{ListUserIDsEx(e){return super.ListUserIDs(e).then(t=>t.UserIDs.Item).catch(t=>[])}Sign(e){return super.Sign({SigningMethod:$t.SigningMethodType.gpg,...e})}};var es=class extends x{constructor(e){super(e,"WSDali","1.07")}Add(e,t){return this._connection.send("Add",e,"json",!1,t,"ResultResponse")}ClearTraceTransactions(e,t){return this._connection.send("ClearTraceTransactions",e,"json",!1,t,"ResultResponse")}Count(e,t){return this._connection.send("Count",e,"json",!1,t,"CountResponse")}DFSCheck(e,t){return this._connection.send("DFSCheck",e,"json",!1,t,"ResultResponse")}DFSExists(e,t){return this._connection.send("DFSExists",e,"json",!1,t,"BooleanResponse")}DFSLS(e,t){return this._connection.send("DFSLS",e,"json",!1,t,"ResultResponse")}Delete(e,t){return this._connection.send("Delete",e,"json",!1,t,"ResultResponse")}DisconnectClientConnection(e,t){return this._connection.send("DisconnectClientConnection",e,"json",!1,t,"ResultResponse")}GetClients(e,t){return this._connection.send("GetClients",e,"json",!1,t,"ResultResponse")}GetConnections(e,t){return this._connection.send("GetConnections",e,"json",!1,t,"ResultResponse")}GetDFSCSV(e,t){return this._connection.send("GetDFSCSV",e,"json",!1,t,"ResultResponse")}GetDFSMap(e,t){return this._connection.send("GetDFSMap",e,"json",!1,t,"ResultResponse")}GetDFSParents(e,t){return this._connection.send("GetDFSParents",e,"json",!1,t,"ResultResponse")}GetLogicalFile(e,t){return this._connection.send("GetLogicalFile",e,"json",!1,t,"ResultResponse")}GetLogicalFilePart(e,t){return this._connection.send("GetLogicalFilePart",e,"json",!1,t,"ResultResponse")}GetProtectedList(e,t){return this._connection.send("GetProtectedList",e,"json",!1,t,"ResultResponse")}GetSDSStats(e,t){return this._connection.send("GetSDSStats",e,"json",!1,t,"ResultResponse")}GetSDSSubscribers(e,t){return this._connection.send("GetSDSSubscribers",e,"json",!1,t,"ResultResponse")}GetValue(e,t){return this._connection.send("GetValue",e,"json",!1,t,"ResultResponse")}Import(e,t){return this._connection.send("Import",e,"json",!1,t,"ResultResponse")}ListSDSLocks(e,t){return this._connection.send("ListSDSLocks",e,"json",!1,t,"ResultResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"WSDaliPingResponse")}SaveSDSStore(e,t){return this._connection.send("SaveSDSStore",e,"json",!1,t,"ResultResponse")}SetLogicalFilePartAttr(e,t){return this._connection.send("SetLogicalFilePartAttr",e,"json",!1,t,"ResultResponse")}SetProtected(e,t){return this._connection.send("SetProtected",e,"json",!1,t,"ResultResponse")}SetTraceSlowTransactions(e,t){return this._connection.send("SetTraceSlowTransactions",e,"json",!1,t,"ResultResponse")}SetTraceTransactions(e,t){return this._connection.send("SetTraceTransactions",e,"json",!1,t,"ResultResponse")}SetUnprotected(e,t){return this._connection.send("SetUnprotected",e,"json",!1,t,"ResultResponse")}SetValue(e,t){return this._connection.send("SetValue",e,"json",!1,t,"ResultResponse")}UnlockSDSLock(e,t){return this._connection.send("UnlockSDSLock",e,"json",!1,t,"ResultResponse")}};var ir=class extends es{};var We;(a=>{let s;(p=>(p.Delete="Delete",p.AddToSuperfile="Add To Superfile",p.ChangeProtection="Change Protection",p.ChangeRestriction="Change Restriction"))(s=a.DFUArrayActions||={});let e;(p=>(p[p.NoChange=0]="NoChange",p[p.Protect=1]="Protect",p[p.Unprotect=2]="Unprotect",p[p.UnprotectAll=3]="UnprotectAll"))(e=a.DFUChangeProtection||={});let t;(g=>(g[g.NoChange=0]="NoChange",g[g.Restrict=1]="Restrict",g[g.Unrestricted=2]="Unrestricted"))(t=a.DFUChangeRestriction||={});let r;(u=>(u.xml="xml",u.def="def"))(r=a.DFUDefFileFormat||={});let n;(g=>(g.Token="Token",g.Engine="Engine",g.External="External"))(n=a.FileAccessRole||={});let i;(f=>(f.None="None",f.Access="Access",f.Read="Read",f.Write="Write",f.Full="Full"))(i=a.SecAccessType||={});let o;(b=>(b.Flat="Flat",b.Index="Index",b.Xml="Xml",b.Csv="Csv",b.Json="Json",b.IndexLocal="IndexLocal",b.IndexPartitioned="IndexPartitioned",b.Unset="Unset"))(o=a.DFUFileType||={})})(We||={});var ts=class extends x{constructor(e){super(e,"WsDfu","1.68")}Add(e,t){return this._connection.send("Add",e,"json",!1,t,"AddResponse")}AddRemote(e,t){return this._connection.send("AddRemote",e,"json",!1,t,"AddRemoteResponse")}AddtoSuperfile(e,t){return this._connection.send("AddtoSuperfile",e,"json",!1,t,"AddtoSuperfileResponse")}DFUArrayAction(e,t){return this._connection.send("DFUArrayAction",e,"json",!1,t,"DFUArrayActionResponse")}DFUBrowseData(e,t){return this._connection.send("DFUBrowseData",e,"json",!1,t,"DFUBrowseDataResponse")}DFUDefFile(e,t){return this._connection.send("DFUDefFile",e,"json",!1,t,"DFUDefFileResponse")}DFUFileAccess(e,t){return this._connection.send("DFUFileAccess",e,"json",!1,t,"DFUFileAccessResponse")}DFUFileAccessV2(e,t){return this._connection.send("DFUFileAccessV2",e,"json",!1,t,"DFUFileAccessResponse")}DFUFileCreate(e,t){return this._connection.send("DFUFileCreate",e,"json",!1,t,"DFUFileCreateResponse")}DFUFileCreateV2(e,t){return this._connection.send("DFUFileCreateV2",e,"json",!1,t,"DFUFileCreateResponse")}DFUFilePublish(e,t){return this._connection.send("DFUFilePublish",e,"json",!1,t,"DFUFilePublishResponse")}DFUFileRename(e,t){return this._connection.send("DFUFileRename",e,"json",!1,t,"DFUFileRenameResponse")}DFUFileView(e,t){return this._connection.send("DFUFileView",e,"json",!1,t,"DFUFileViewResponse")}DFUGetDataColumns(e,t){return this._connection.send("DFUGetDataColumns",e,"json",!1,t,"DFUGetDataColumnsResponse")}DFUGetFileMetaData(e,t){return this._connection.send("DFUGetFileMetaData",e,"json",!1,t,"DFUGetFileMetaDataResponse")}DFUGetMetaInquiry(e,t){return this._connection.send("DFUGetMetaInquiry",e,"json",!1,t,"DFUMetaInquiryResponse")}DFUInfo(e,t){return this._connection.send("DFUInfo",e,"json",!1,t,"DFUInfoResponse")}DFUQuery(e,t){return this._connection.send("DFUQuery",e,"json",!1,t,"DFUQueryResponse")}DFURecordTypeInfo(e,t){return this._connection.send("DFURecordTypeInfo",e,"json",!1,t,"DFURecordTypeInfoResponse")}DFUSearch(e,t){return this._connection.send("DFUSearch",e,"json",!1,t,"DFUSearchResponse")}DFUSearchData(e,t){return this._connection.send("DFUSearchData",e,"json",!1,t,"DFUSearchDataResponse")}DFUSpace(e,t){return this._connection.send("DFUSpace",e,"json",!1,t,"DFUSpaceResponse")}EclRecordTypeInfo(e,t){return this._connection.send("EclRecordTypeInfo",e,"json",!1,t,"EclRecordTypeInfoResponse")}EraseHistory(e,t){return this._connection.send("EraseHistory",e,"json",!1,t,"EraseHistoryResponse")}ListHistory(e,t){return this._connection.send("ListHistory",e,"json",!1,t,"ListHistoryResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"WsDfuPingResponse")}Savexml(e,t){return this._connection.send("Savexml",e,"json",!1,t,"SavexmlResponse")}SuperfileAction(e,t){return this._connection.send("SuperfileAction",e,"json",!1,t,"SuperfileActionResponse")}SuperfileList(e,t){return this._connection.send("SuperfileList",e,"json",!1,t,"SuperfileListResponse")}};var $i=We.DFUArrayActions,eo=We.DFUDefFileFormat,to=We.DFUChangeProtection,so=We.DFUChangeRestriction,ve=class extends ts{DFUFile(e){return this._connection.send("DFUDefFile",e,"text")}async recursiveFetchLogicalFiles(e){let t=[],r=[];return await Promise.all(e.map(n=>this.DFUInfo({Cluster:n.NodeGroup,Name:n.Name,IncludeJsonTypeInfo:!1,IncludeBinTypeInfo:!1,ForceIndexInfo:!1}).then(i=>{for(let o of i?.FileDetail?.Superfiles?.DFULogicalFile??[])t.push(o);for(let o of i?.FileDetail?.subfiles?.Item??[])r.push(o)}))),r.concat(t.length?await this.recursiveFetchLogicalFiles(t):[])}};var ss=class extends x{constructor(e){super(e,"WsDFUXRef","1.04")}DFUXRefArrayAction(e,t){return this._connection.send("DFUXRefArrayAction",e,"json",!1,t,"DFUXRefArrayActionResponse")}DFUXRefBuild(e,t){return this._connection.send("DFUXRefBuild",e,"json",!1,t,"DFUXRefBuildResponse")}DFUXRefBuildCancel(e,t){return this._connection.send("DFUXRefBuildCancel",e,"json",!1,t,"DFUXRefBuildCancelResponse")}DFUXRefCleanDirectories(e,t){return this._connection.send("DFUXRefCleanDirectories",e,"json",!1,t,"DFUXRefCleanDirectoriesResponse")}DFUXRefDirectories(e,t){return this._connection.send("DFUXRefDirectories",e,"json",!1,t,"DFUXRefDirectoriesQueryResponse")}DFUXRefFoundFiles(e,t){return this._connection.send("DFUXRefFoundFiles",e,"json",!1,t,"DFUXRefFoundFilesQueryResponse")}DFUXRefList(e,t){return this._connection.send("DFUXRefList",e,"json",!1,t,"DFUXRefListResponse")}DFUXRefLostFiles(e,t){return this._connection.send("DFUXRefLostFiles",e,"json",!1,t,"DFUXRefLostFilesQueryResponse")}DFUXRefMessages(e,t){return this._connection.send("DFUXRefMessages",e,"json",!1,t,"DFUXRefMessagesQueryResponse")}DFUXRefOrphanFiles(e,t){return this._connection.send("DFUXRefOrphanFiles",e,"json",!1,t,"DFUXRefOrphanFilesQueryResponse")}DFUXRefUnusedFiles(e,t){return this._connection.send("DFUXRefUnusedFiles",e,"json",!1,t,"DFUXRefUnusedFilesResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"WsDFUXRefPingResponse")}};var or=class extends ss{DFUXRefDirectoriesEx(e){return this._connection.send("DFUXRefDirectories",e,"json",!1,void 0,"DFUXRefDirectoriesQueryResponse")}DFUXRefListEx(e){return this._connection.send("DFUXRefList",e,"json",!1,void 0,"DFUXRefListResponse")}};function dn(s,e){let t=typeof e;switch(t){case"boolean":case"number":case"string":return{id:s,type:t};case"object":if(e.Row instanceof Array&&(e=e.Row),e instanceof Array)return{id:s,type:"dataset",children:ar(e[0])};if(e instanceof Object){if(e.Item&&e.Item instanceof Array&&e.Item.length===1){let r=typeof e.Item[0];if(r==="string"||r==="number")return{id:s,type:"set",fieldType:r};throw new Error("Unknown field type")}return{id:s,type:"object",fields:ro(e)}}default:throw new Error("Unknown field type")}}function ar(s){s.Row&&s.Row instanceof Array&&(s=s.Row[0]);let e=[];for(let t in s)e.push(dn(t,s[t]));return e}function ro(s){let e={};for(let t in s)e[t]=dn(t,s[t]);return e}var at=class extends x{constructor(e){super(e,"WsEcl","0")}opts(){return this._connection.opts()}requestJson(e,t){return this._connection.send(`example/request/query/${e}/${t}/json`,{},"text").then(r=>{let n=JSON.parse(r);for(let i in n)return n[i];return{}}).then(ar)}responseJson(e,t){return this._connection.send(`example/response/query/${e}/${t}/json`,{},"text").then(r=>{let n=JSON.parse(r);for(let i in n)return n[i].Results;return{}}).then(r=>{let n={};for(let i in r)n[i]=ar(r[i]);return n})}submit(e,t,r){let n=`submit/query/${e}/${t}`;return this._connection.send(n,r,"json2").then(i=>{if(i.Results&&i.Results.Exception)throw new pe(n,r,{Source:"wsEcl.submit",Exception:i.Results.Exception});return i.Results})}};var rs=class extends x{constructor(e){super(e,"ws_elk","1")}GetConfigDetails(e,t){return this._connection.send("GetConfigDetails",e,"json",!1,t,"GetConfigDetailsResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"ws_elkPingResponse")}};var cr=class extends rs{};var hn=require("@hpcc-js/util");var N;(c=>{let s;(T=>(T.global="global",T.workunits="workunits",T.components="components",T.audience="audience",T.class="class",T.instance="instance",T.node="node",T.message="message",T.logid="logid",T.processid="processid",T.threadid="threadid",T.timestamp="timestamp",T.pod="pod",T.traceid="traceid",T.spanid="spanid"))(s=c.LogColumnType||={});let e;(D=>(D.string="string",D.numeric="numeric",D.datetime="datetime",D.enum="enum",D.epoch="epoch"))(e=c.LogColumnValueType||={});let t;(m=>(m[m.All=0]="All",m[m.ByJobID=1]="ByJobID",m[m.ByComponent=2]="ByComponent",m[m.ByLogType=3]="ByLogType",m[m.ByTargetAudience=4]="ByTargetAudience",m[m.BySourceInstance=5]="BySourceInstance",m[m.BySourceNode=6]="BySourceNode",m[m.ByFieldName=7]="ByFieldName",m[m.ByPod=8]="ByPod",m[m.ByTraceID=9]="ByTraceID",m[m.BySpanID=10]="BySpanID"))(t=c.LogAccessType||={});let r;(p=>(p[p.Success=0]="Success",p[p.Warning=1]="Warning",p[p.Fail=2]="Fail"))(r=c.LogAccessStatusCode||={});let n;(p=>(p[p.NONE=0]="NONE",p[p.AND=1]="AND",p[p.OR=2]="OR"))(n=c.LogAccessFilterOperator||={});let i;(f=>(f[f.MIN=0]="MIN",f[f.DEFAULT=1]="DEFAULT",f[f.ALL=2]="ALL",f[f.CUSTOM=3]="CUSTOM"))(i=c.LogSelectColumnMode||={});let o;(m=>(m[m.ByDate=0]="ByDate",m[m.ByJobID=1]="ByJobID",m[m.ByComponent=2]="ByComponent",m[m.ByLogType=3]="ByLogType",m[m.ByTargetAudience=4]="ByTargetAudience",m[m.BySourceInstance=5]="BySourceInstance",m[m.BySourceNode=6]="BySourceNode",m[m.ByFieldName=7]="ByFieldName",m[m.ByPod=8]="ByPod",m[m.ByTraceID=9]="ByTraceID",m[m.BySpanID=10]="BySpanID"))(o=c.SortColumType||={});let a;(g=>(g[g.ASC=0]="ASC",g[g.DSC=1]="DSC"))(a=c.SortDirection||={})})(N||={});var ns=class extends x{constructor(e){super(e,"ws_logaccess","1.08")}GetHealthReport(e){return this._connection.send("GetHealthReport",e,"json",!1,void 0,"GetHealthReportResponse")}GetLogAccessInfo(e){return this._connection.send("GetLogAccessInfo",e,"json",!1,void 0,"GetLogAccessInfoResponse")}GetLogs(e){return this._connection.send("GetLogs",e,"json",!1,void 0,"GetLogsResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"ws_logaccessPingResponse")}};var mn=(0,hn.scopedLogger)("@hpcc-js/comms/services/wsLogaccess.ts");var fn=(o=>(o.Disaster="DIS",o.Error="ERR",o.Warning="WRN",o.Information="INF",o.Progress="PRO",o.Metric="MET",o))(fn||{}),Sn=(n=>(n.Operator="OPR",n.User="USR",n.Programmer="PRO",n.Audit="ADT",n))(Sn||{}),no=new Set(["azureloganalyticscurl","elasticstack","grafanacurl"]),io=new Set(Object.values(N.LogColumnType));function oo(s){switch(s){case N.LogColumnType.workunits:case"hpcc.log.jobid":return N.LogAccessType.ByJobID;case N.LogColumnType.audience:case"hpcc.log.audience":return N.LogAccessType.ByTargetAudience;case N.LogColumnType.class:case"hpcc.log.class":return N.LogAccessType.ByLogType;case N.LogColumnType.components:case"kubernetes.container.name":return N.LogAccessType.ByComponent;default:return N.LogAccessType.ByFieldName}}var ao=["audience","class","workunits","message","processid","logid","threadid","timestamp","components","instance"];function co(s,e){let t=[];for(let r of ao){let n=s[r];if(n==null||n===""||Array.isArray(n)&&n.length===0||!(r in e))continue;let o=io.has(r)?r:e[r],a=oo(o);a===N.LogAccessType.ByFieldName&&(o=e[r]);let c=a===N.LogAccessType.ByComponent,l=Array.isArray(n)?n:[n];for(let u of l)t.push({LogCategory:a,SearchField:o,SearchByValue:c?u+"*":u})}return t}function is(s){let e={leftFilter:s[0]},t=e;for(let r=1;r<s.length;r++)t.Operator=N.LogAccessFilterOperator.OR,r===s.length-1?t.rightFilter=s[r]:(t.rightBinaryFilter={BinaryLogFilter:[{leftFilter:s[r]}]},t=t.rightBinaryFilter.BinaryLogFilter[0]);return e}function Dn(s){let[e,...t]=s,r={};if(e.length===1?r.leftFilter=e[0]:r.leftBinaryFilter={BinaryLogFilter:[is(e)]},t.length===0)return r;if(r.Operator=N.LogAccessFilterOperator.AND,t.length===1){let[n]=t;n.length===1?r.rightFilter=n[0]:r.rightBinaryFilter={BinaryLogFilter:[is(n)]}}else r.rightBinaryFilter={BinaryLogFilter:[Dn(t)]};return r}function uo(s){let e=new Map;for(let o of s){let a=e.get(o.SearchField);a?a.push(o):e.set(o.SearchField,[o])}let t=[...e.values()];if(t.length===0)return{leftFilter:{LogCategory:N.LogAccessType.All}};let[r,...n]=t,i={};if(r.length===1?i.leftFilter=r[0]:i.leftBinaryFilter={BinaryLogFilter:[is(r)]},n.length===0)return i;if(i.Operator=N.LogAccessFilterOperator.AND,n.length===1){let[o]=n;o.length===1?i.rightFilter=o[0]:i.rightBinaryFilter={BinaryLogFilter:[is(o)]}}else i.rightBinaryFilter={BinaryLogFilter:[Dn(n)]};return i}var ur=class extends ns{_logAccessInfo;GetLogAccessInfo(e={}){return this._logAccessInfo||(this._logAccessInfo=super.GetLogAccessInfo(e)),this._logAccessInfo}GetLogs(e){return super.GetLogs(e)}convertLogLine(e,t){let r={},n=t?.fields?Object.assign({},...t.fields):null;for(let i in e)r[i]=n?n[e[i]]??"":"";return r}async GetLogsEx(e){let t=await this.GetLogAccessInfo(),r={};t.Columns.Column.forEach(a=>r[a.LogType]=a.Name);let n=co(e,r),i={StartDate:e.StartDate instanceof Date?e.StartDate.toISOString():new Date(0).toISOString()};e.EndDate instanceof Date&&(i.EndDate=e.EndDate.toISOString());let o={Filter:uo(n),Range:i,LogLineStartFrom:e.LogLineStartFrom??0,LogLineLimit:e.LogLineLimit??100,SelectColumnMode:N.LogSelectColumnMode.DEFAULT,Format:"JSON",SortBy:{SortCondition:[{BySortType:N.SortColumType.ByDate,ColumnName:"",Direction:0}]}};return this.GetLogs(o).then(a=>{try{let c=JSON.parse(a.LogLines);return{lines:no.has(t.RemoteLogManagerType)?c.lines?.map(u=>this.convertLogLine(r,u))??[]:(mn.warning(`Unknown RemoteLogManagerType: ${t.RemoteLogManagerType}`),[]),total:a.TotalLogLinesAvailable??1e4}}catch(c){mn.error(c.message??c)}return{lines:[],total:0}})}};var Rn=require("@hpcc-js/util");function Ve(s,e){let t;if(e===void 0)for(let r of s)r!=null&&(t<r||t===void 0&&r>=r)&&(t=r);else{let r=-1;for(let n of s)(n=e(n,++r,s))!=null&&(t<n||t===void 0&&n>=n)&&(t=n)}return t}function He(s,e){let t=0,r=0;if(e===void 0)for(let n of s)n!=null&&(n=+n)>=n&&(++t,r+=n);else{let n=-1;for(let i of s)(i=e(i,++n,s))!=null&&(i=+i)>=i&&(++t,r+=i)}if(t)return r/t}var lo;(t=>{let s;(i=>(i[i.THRESHOLD_PERCENTAGE=0]="THRESHOLD_PERCENTAGE",i[i.THRESHOLD_MB=1]="THRESHOLD_MB"))(s=t.ThresholdType||={});let e;(f=>(f.ALLNODES="ALLNODES",f.THORMACHINES="THORMACHINES",f.HOLEMACHINES="HOLEMACHINES",f.ROXIEMACHINES="ROXIEMACHINES",f.MACHINES="MACHINES",f.AVAILABLEMACHINES="AVAILABLEMACHINES",f.DROPZONE="DROPZONE",f.STANDBYNNODE="STANDBYNNODE",f.THORSPARENODES="THORSPARENODES",f.HOLESTANDBYNODES="HOLESTANDBYNODES"))(e=t.TpMachineType||={})})(lo||={});var os=class extends x{constructor(e){super(e,"ws_machine","1.19")}GetComponentStatus(e,t){return this._connection.send("GetComponentStatus",e,"json",!1,t,"GetComponentStatusResponse")}GetComponentUsage(e,t){return this._connection.send("GetComponentUsage",e,"json",!1,t,"GetComponentUsageResponse")}GetMachineInfo(e,t){return this._connection.send("GetMachineInfo",e,"json",!1,t,"GetMachineInfoResponse")}GetMachineInfoEx(e,t){return this._connection.send("GetMachineInfoEx",e,"json",!1,t,"GetMachineInfoResponseEx")}GetMetrics(e,t){return this._connection.send("GetMetrics",e,"json",!1,t,"MetricsResponse")}GetNodeGroupUsage(e,t){return this._connection.send("GetNodeGroupUsage",e,"json",!1,t,"GetNodeGroupUsageResponse")}GetTargetClusterInfo(e,t){return this._connection.send("GetTargetClusterInfo",e,"json",!1,t,"GetTargetClusterInfoResponse")}GetTargetClusterUsage(e,t){return this._connection.send("GetTargetClusterUsage",e,"json",!1,t,"GetTargetClusterUsageResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"ws_machinePingResponse")}UpdateComponentStatus(e,t){return this._connection.send("UpdateComponentStatus",e,"json",!1,t,"UpdateComponentStatusResponse")}};var ie=class extends os{GetTargetClusterUsageEx(e,t=!1){return this._connection.send("GetTargetClusterUsage",{TargetClusters:e?{Item:e}:{},BypassCachedResult:t}).then(r=>(0,Rn.exists)("TargetClusterUsages.TargetClusterUsage",r)?r.TargetClusterUsages.TargetClusterUsage:[]).then(r=>r.filter(n=>!!n.ComponentUsages).map(n=>{let i=n.ComponentUsages.ComponentUsage.map(o=>{let a=(o.MachineUsages&&o.MachineUsages.MachineUsage?o.MachineUsages.MachineUsage:[]).map(c=>{let l=c.DiskUsages&&c.DiskUsages.DiskUsage?c.DiskUsages.DiskUsage.map(u=>({...u,InUse:u.InUse*1024,Total:(u.InUse+u.Available)*1024,PercentUsed:100-u.PercentAvailable})):[];return{Name:c.Name,NetAddress:c.NetAddress,Description:c.Description,DiskUsages:l,mean:He(l.filter(u=>!isNaN(u.PercentUsed)),u=>u.PercentUsed),max:Ve(l.filter(u=>!isNaN(u.PercentUsed)),u=>u.PercentUsed)}});return{Type:o.Type,Name:o.Name,Description:o.Description,MachineUsages:a,MachineUsagesDescription:a.reduce((c,l)=>c+(l.Description||""),""),mean:He(a.filter(c=>!isNaN(c.mean)),c=>c.mean),max:Ve(a.filter(c=>!isNaN(c.max)),c=>c.max)}});return{Name:n.Name,Description:n.Description,ComponentUsages:i,ComponentUsagesDescription:i.reduce((o,a)=>o+(a.MachineUsagesDescription||""),""),mean:He(i.filter(o=>!isNaN(o.mean)),o=>o.mean),max:Ve(i.filter(o=>!isNaN(o.max)),o=>o.max)}}))}};var as=class extends x{constructor(e){super(e,"WsPackageProcess","1.08")}ActivatePackage(e,t){return this._connection.send("ActivatePackage",e,"json",!1,t,"ActivatePackageResponse")}AddPackage(e,t){return this._connection.send("AddPackage",e,"json",!1,t,"AddPackageResponse")}AddPartToPackageMap(e,t){return this._connection.send("AddPartToPackageMap",e,"json",!1,t,"AddPartToPackageMapResponse")}CopyPackageMap(e,t){return this._connection.send("CopyPackageMap",e,"json",!1,t,"CopyPackageMapResponse")}DeActivatePackage(e,t){return this._connection.send("DeActivatePackage",e,"json",!1,t,"DeActivatePackageResponse")}DeletePackage(e,t){return this._connection.send("DeletePackage",e,"json",!1,t,"DeletePackageResponse")}Echo(e,t){return this._connection.send("Echo",e,"json",!1,t,"EchoResponse")}GetPackage(e,t){return this._connection.send("GetPackage",e,"json",!1,t,"GetPackageResponse")}GetPackageMapById(e,t){return this._connection.send("GetPackageMapById",e,"json",!1,t,"GetPackageMapByIdResponse")}GetPackageMapSelectOptions(e,t){return this._connection.send("GetPackageMapSelectOptions",e,"json",!1,t,"GetPackageMapSelectOptionsResponse")}GetPartFromPackageMap(e,t){return this._connection.send("GetPartFromPackageMap",e,"json",!1,t,"GetPartFromPackageMapResponse")}GetQueryFileMapping(e,t){return this._connection.send("GetQueryFileMapping",e,"json",!1,t,"GetQueryFileMappingResponse")}ListPackage(e,t){return this._connection.send("ListPackage",e,"json",!1,t,"ListPackageResponse")}ListPackages(e,t){return this._connection.send("ListPackages",e,"json",!1,t,"ListPackagesResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"WsPackageProcessPingResponse")}RemovePartFromPackageMap(e,t){return this._connection.send("RemovePartFromPackageMap",e,"json",!1,t,"RemovePartFromPackageMapResponse")}ValidatePackage(e,t){return this._connection.send("ValidatePackage",e,"json",!1,t,"ValidatePackageResponse")}};var lr=class extends as{};var po;(r=>{let s;(c=>(c.Thor="Thor",c.HThor="HThor",c.Roxie="Roxie",c.All="All"))(s=r.HPCCQueueType||={});let e;(a=>(a.Unknown="Unknown",a.None="None",a.Pending="Pending"))(e=r.ExternalIPStatus||={});let t;(c=>(c.UNKNOWN="UNKNOWN",c.TRACES="TRACES",c.LOGS="LOGS",c.METRICS="METRICS"))(t=r.ResourceType||={})})(po||={});var cs=class extends x{constructor(e){super(e,"WsResources","1.04")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"WsResourcesPingResponse")}ServiceQuery(e,t){return this._connection.send("ServiceQuery",e,"json",!1,t,"ServiceQueryResponse")}TargetQuery(e,t){return this._connection.send("TargetQuery",e,"json",!1,t,"TargetQueryResponse")}WebLinksQuery(e,t){return this._connection.send("WebLinksQuery",e,"json",!1,t,"WebLinksQueryResponse")}};var pr=class extends cs{};var gr;(e=>{let s;(n=>(n.ECL="ECL",n.DFU="DFU"))(s=e.WUTypes||={})})(gr||={});var us=class extends x{constructor(e){super(e,"WSSasha","1.01")}ArchiveWU(e,t){return this._connection.send("ArchiveWU",e,"json",!1,t,"ResultResponse")}GetVersion(e,t){return this._connection.send("GetVersion",e,"json",!1,t,"ResultResponse")}ListWU(e,t){return this._connection.send("ListWU",e,"json",!1,t,"ResultResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"WSSashaPingResponse")}RestoreWU(e,t){return this._connection.send("RestoreWU",e,"json",!1,t,"ResultResponse")}};var dr=class extends us{};var mr=new Date,hr=new Date;function z(s,e,t,r){function n(i){return s(i=arguments.length===0?new Date:new Date(+i)),i}return n.floor=i=>(s(i=new Date(+i)),i),n.ceil=i=>(s(i=new Date(i-1)),e(i,1),s(i),i),n.round=i=>{let o=n(i),a=n.ceil(i);return i-o<a-i?o:a},n.offset=(i,o)=>(e(i=new Date(+i),o==null?1:Math.floor(o)),i),n.range=(i,o,a)=>{let c=[];if(i=n.ceil(i),a=a==null?1:Math.floor(a),!(i<o)||!(a>0))return c;let l;do c.push(l=new Date(+i)),e(i,a),s(i);while(l<i&&i<o);return c},n.filter=i=>z(o=>{if(o>=o)for(;s(o),!i(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;e(o,-1),!i(o););else for(;--a>=0;)for(;e(o,1),!i(o););}),t&&(n.count=(i,o)=>(mr.setTime(+i),hr.setTime(+o),s(mr),s(hr),Math.floor(t(mr,hr))),n.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?n.filter(r?o=>r(o)%i===0:o=>n.count(0,o)%i===0):n)),n}var ct=z(s=>s.setHours(0,0,0,0),(s,e)=>s.setDate(s.getDate()+e),(s,e)=>(e-s-(e.getTimezoneOffset()-s.getTimezoneOffset())*6e4)/864e5,s=>s.getDate()-1),mo=ct.range,ut=z(s=>{s.setUTCHours(0,0,0,0)},(s,e)=>{s.setUTCDate(s.getUTCDate()+e)},(s,e)=>(e-s)/864e5,s=>s.getUTCDate()-1),ho=ut.range,Cn=z(s=>{s.setUTCHours(0,0,0,0)},(s,e)=>{s.setUTCDate(s.getUTCDate()+e)},(s,e)=>(e-s)/864e5,s=>Math.floor(s/864e5)),fo=Cn.range;function ye(s){return z(e=>{e.setDate(e.getDate()-(e.getDay()+7-s)%7),e.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}var lt=ye(0),je=ye(1),xn=ye(2),An=ye(3),de=ye(4),Wn=ye(5),yn=ye(6),bn=lt.range,Do=je.range,Ro=xn.range,Co=An.range,xo=de.range,Ao=Wn.range,Wo=yn.range;function be(s){return z(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-s)%7),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/6048e5)}var pt=be(0),_e=be(1),Un=be(2),En=be(3),me=be(4),Fn=be(5),Pn=be(6),In=pt.range,yo=_e.range,bo=Un.range,Uo=En.range,Eo=me.range,Fo=Fn.range,Po=Pn.range;var oe=z(s=>{s.setMonth(0,1),s.setHours(0,0,0,0)},(s,e)=>{s.setFullYear(s.getFullYear()+e)},(s,e)=>e.getFullYear()-s.getFullYear(),s=>s.getFullYear());oe.every=s=>!isFinite(s=Math.floor(s))||!(s>0)?null:z(e=>{e.setFullYear(Math.floor(e.getFullYear()/s)*s),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t*s)});var Io=oe.range,ae=z(s=>{s.setUTCMonth(0,1),s.setUTCHours(0,0,0,0)},(s,e)=>{s.setUTCFullYear(s.getUTCFullYear()+e)},(s,e)=>e.getUTCFullYear()-s.getUTCFullYear(),s=>s.getUTCFullYear());ae.every=s=>!isFinite(s=Math.floor(s))||!(s>0)?null:z(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/s)*s),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t*s)});var To=ae.range;function Sr(s){if(0<=s.y&&s.y<100){var e=new Date(-1,s.m,s.d,s.H,s.M,s.S,s.L);return e.setFullYear(s.y),e}return new Date(s.y,s.m,s.d,s.H,s.M,s.S,s.L)}function Dr(s){if(0<=s.y&&s.y<100){var e=new Date(Date.UTC(-1,s.m,s.d,s.H,s.M,s.S,s.L));return e.setUTCFullYear(s.y),e}return new Date(Date.UTC(s.y,s.m,s.d,s.H,s.M,s.S,s.L))}function gt(s,e,t){return{y:s,m:e,d:t,H:0,M:0,S:0,L:0}}function Rr(s){var e=s.dateTime,t=s.date,r=s.time,n=s.periods,i=s.days,o=s.shortDays,a=s.months,c=s.shortMonths,l=dt(n),u=mt(n),g=dt(i),p=mt(i),f=dt(o),D=mt(o),A=dt(a),b=mt(a),I=dt(c),R=mt(c),S={a:Ne,A:Qe,b:Le,B:ee,c:null,d:Qn,e:Qn,f:ea,g:la,G:ga,H:Ko,I:Zo,j:$o,L:Vn,m:ta,M:sa,p:Wi,q:yi,Q:kn,s:vn,S:ra,u:na,U:ia,V:oa,w:aa,W:ca,x:null,X:null,y:ua,Y:pa,Z:da,"%":Gn},m={a:bi,A:Ui,b:Ei,B:Fi,c:null,d:Ln,e:Ln,f:Sa,g:Ea,G:Pa,H:ma,I:ha,j:fa,L:jn,m:Da,M:Ra,p:Pi,q:Ii,Q:kn,s:vn,S:Ca,u:xa,U:Aa,V:Wa,w:ya,W:ba,x:null,X:null,y:Ua,Y:Fa,Z:Ia,"%":Gn},Z={a:$s,A:B,b:U,B:ne,c:_,d:Bn,e:Bn,f:Xo,g:wn,G:Mn,H:Nn,I:Nn,j:jo,L:Yo,m:Ho,M:_o,p:$,q:Vo,Q:Jo,s:zo,S:Oo,u:Qo,U:Lo,V:Go,w:No,W:ko,x:E,X:Ht,y:wn,Y:Mn,Z:vo,"%":qo};S.x=C(t,S),S.X=C(r,S),S.c=C(e,S),m.x=C(t,m),m.X=C(r,m),m.c=C(e,m);function C(h,y){return function(F){var d=[],O=-1,M=0,q=h.length,J,Ae,$r;for(F instanceof Date||(F=new Date(+F));++O<q;)h.charCodeAt(O)===37&&(d.push(h.slice(M,O)),(Ae=Tn[J=h.charAt(++O)])!=null?J=h.charAt(++O):Ae=J==="e"?" ":"0",($r=y[J])&&(J=$r(F,Ae)),d.push(J),M=O+1);return d.push(h.slice(M,O)),d.join("")}}function W(h,y){return function(F){var d=gt(1900,void 0,1),O=T(d,h,F+="",0),M,q;if(O!=F.length)return null;if("Q"in d)return new Date(d.Q);if("s"in d)return new Date(d.s*1e3+("L"in d?d.L:0));if(y&&!("Z"in d)&&(d.Z=0),"p"in d&&(d.H=d.H%12+d.p*12),d.m===void 0&&(d.m="q"in d?d.q:0),"V"in d){if(d.V<1||d.V>53)return null;"w"in d||(d.w=1),"Z"in d?(M=Dr(gt(d.y,0,1)),q=M.getUTCDay(),M=q>4||q===0?_e.ceil(M):_e(M),M=ut.offset(M,(d.V-1)*7),d.y=M.getUTCFullYear(),d.m=M.getUTCMonth(),d.d=M.getUTCDate()+(d.w+6)%7):(M=Sr(gt(d.y,0,1)),q=M.getDay(),M=q>4||q===0?je.ceil(M):je(M),M=ct.offset(M,(d.V-1)*7),d.y=M.getFullYear(),d.m=M.getMonth(),d.d=M.getDate()+(d.w+6)%7)}else("W"in d||"U"in d)&&("w"in d||(d.w="u"in d?d.u%7:"W"in d?1:0),q="Z"in d?Dr(gt(d.y,0,1)).getUTCDay():Sr(gt(d.y,0,1)).getDay(),d.m=0,d.d="W"in d?(d.w+6)%7+d.W*7-(q+5)%7:d.w+d.U*7-(q+6)%7);return"Z"in d?(d.H+=d.Z/100|0,d.M+=d.Z%100,Dr(d)):Sr(d)}}function T(h,y,F,d){for(var O=0,M=y.length,q=F.length,J,Ae;O<M;){if(d>=q)return-1;if(J=y.charCodeAt(O++),J===37){if(J=y.charAt(O++),Ae=Z[J in Tn?y.charAt(O++):J],!Ae||(d=Ae(h,F,d))<0)return-1}else if(J!=F.charCodeAt(d++))return-1}return d}function $(h,y,F){var d=l.exec(y.slice(F));return d?(h.p=u.get(d[0].toLowerCase()),F+d[0].length):-1}function $s(h,y,F){var d=f.exec(y.slice(F));return d?(h.w=D.get(d[0].toLowerCase()),F+d[0].length):-1}function B(h,y,F){var d=g.exec(y.slice(F));return d?(h.w=p.get(d[0].toLowerCase()),F+d[0].length):-1}function U(h,y,F){var d=I.exec(y.slice(F));return d?(h.m=R.get(d[0].toLowerCase()),F+d[0].length):-1}function ne(h,y,F){var d=A.exec(y.slice(F));return d?(h.m=b.get(d[0].toLowerCase()),F+d[0].length):-1}function _(h,y,F){return T(h,e,y,F)}function E(h,y,F){return T(h,t,y,F)}function Ht(h,y,F){return T(h,r,y,F)}function Ne(h){return o[h.getDay()]}function Qe(h){return i[h.getDay()]}function Le(h){return c[h.getMonth()]}function ee(h){return a[h.getMonth()]}function Wi(h){return n[+(h.getHours()>=12)]}function yi(h){return 1+~~(h.getMonth()/3)}function bi(h){return o[h.getUTCDay()]}function Ui(h){return i[h.getUTCDay()]}function Ei(h){return c[h.getUTCMonth()]}function Fi(h){return a[h.getUTCMonth()]}function Pi(h){return n[+(h.getUTCHours()>=12)]}function Ii(h){return 1+~~(h.getUTCMonth()/3)}return{format:function(h){var y=C(h+="",S);return y.toString=function(){return h},y},parse:function(h){var y=W(h+="",!1);return y.toString=function(){return h},y},utcFormat:function(h){var y=C(h+="",m);return y.toString=function(){return h},y},utcParse:function(h){var y=W(h+="",!0);return y.toString=function(){return h},y}}}var Tn={"-":"",_:" ",0:"0"},Q=/^\s*\d+/,Mo=/^%/,wo=/[\\^$*+?|[\]().{}]/g;function P(s,e,t){var r=s<0?"-":"",n=(r?-s:s)+"",i=n.length;return r+(i<t?new Array(t-i+1).join(e)+n:n)}function Bo(s){return s.replace(wo,"\\$&")}function dt(s){return new RegExp("^(?:"+s.map(Bo).join("|")+")","i")}function mt(s){return new Map(s.map((e,t)=>[e.toLowerCase(),t]))}function No(s,e,t){var r=Q.exec(e.slice(t,t+1));return r?(s.w=+r[0],t+r[0].length):-1}function Qo(s,e,t){var r=Q.exec(e.slice(t,t+1));return r?(s.u=+r[0],t+r[0].length):-1}function Lo(s,e,t){var r=Q.exec(e.slice(t,t+2));return r?(s.U=+r[0],t+r[0].length):-1}function Go(s,e,t){var r=Q.exec(e.slice(t,t+2));return r?(s.V=+r[0],t+r[0].length):-1}function ko(s,e,t){var r=Q.exec(e.slice(t,t+2));return r?(s.W=+r[0],t+r[0].length):-1}function Mn(s,e,t){var r=Q.exec(e.slice(t,t+4));return r?(s.y=+r[0],t+r[0].length):-1}function wn(s,e,t){var r=Q.exec(e.slice(t,t+2));return r?(s.y=+r[0]+(+r[0]>68?1900:2e3),t+r[0].length):-1}function vo(s,e,t){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(t,t+6));return r?(s.Z=r[1]?0:-(r[2]+(r[3]||"00")),t+r[0].length):-1}function Vo(s,e,t){var r=Q.exec(e.slice(t,t+1));return r?(s.q=r[0]*3-3,t+r[0].length):-1}function Ho(s,e,t){var r=Q.exec(e.slice(t,t+2));return r?(s.m=r[0]-1,t+r[0].length):-1}function Bn(s,e,t){var r=Q.exec(e.slice(t,t+2));return r?(s.d=+r[0],t+r[0].length):-1}function jo(s,e,t){var r=Q.exec(e.slice(t,t+3));return r?(s.m=0,s.d=+r[0],t+r[0].length):-1}function Nn(s,e,t){var r=Q.exec(e.slice(t,t+2));return r?(s.H=+r[0],t+r[0].length):-1}function _o(s,e,t){var r=Q.exec(e.slice(t,t+2));return r?(s.M=+r[0],t+r[0].length):-1}function Oo(s,e,t){var r=Q.exec(e.slice(t,t+2));return r?(s.S=+r[0],t+r[0].length):-1}function Yo(s,e,t){var r=Q.exec(e.slice(t,t+3));return r?(s.L=+r[0],t+r[0].length):-1}function Xo(s,e,t){var r=Q.exec(e.slice(t,t+6));return r?(s.L=Math.floor(r[0]/1e3),t+r[0].length):-1}function qo(s,e,t){var r=Mo.exec(e.slice(t,t+1));return r?t+r[0].length:-1}function Jo(s,e,t){var r=Q.exec(e.slice(t));return r?(s.Q=+r[0],t+r[0].length):-1}function zo(s,e,t){var r=Q.exec(e.slice(t));return r?(s.s=+r[0],t+r[0].length):-1}function Qn(s,e){return P(s.getDate(),e,2)}function Ko(s,e){return P(s.getHours(),e,2)}function Zo(s,e){return P(s.getHours()%12||12,e,2)}function $o(s,e){return P(1+ct.count(oe(s),s),e,3)}function Vn(s,e){return P(s.getMilliseconds(),e,3)}function ea(s,e){return Vn(s,e)+"000"}function ta(s,e){return P(s.getMonth()+1,e,2)}function sa(s,e){return P(s.getMinutes(),e,2)}function ra(s,e){return P(s.getSeconds(),e,2)}function na(s){var e=s.getDay();return e===0?7:e}function ia(s,e){return P(lt.count(oe(s)-1,s),e,2)}function Hn(s){var e=s.getDay();return e>=4||e===0?de(s):de.ceil(s)}function oa(s,e){return s=Hn(s),P(de.count(oe(s),s)+(oe(s).getDay()===4),e,2)}function aa(s){return s.getDay()}function ca(s,e){return P(je.count(oe(s)-1,s),e,2)}function ua(s,e){return P(s.getFullYear()%100,e,2)}function la(s,e){return s=Hn(s),P(s.getFullYear()%100,e,2)}function pa(s,e){return P(s.getFullYear()%1e4,e,4)}function ga(s,e){var t=s.getDay();return s=t>=4||t===0?de(s):de.ceil(s),P(s.getFullYear()%1e4,e,4)}function da(s){var e=s.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+P(e/60|0,"0",2)+P(e%60,"0",2)}function Ln(s,e){return P(s.getUTCDate(),e,2)}function ma(s,e){return P(s.getUTCHours(),e,2)}function ha(s,e){return P(s.getUTCHours()%12||12,e,2)}function fa(s,e){return P(1+ut.count(ae(s),s),e,3)}function jn(s,e){return P(s.getUTCMilliseconds(),e,3)}function Sa(s,e){return jn(s,e)+"000"}function Da(s,e){return P(s.getUTCMonth()+1,e,2)}function Ra(s,e){return P(s.getUTCMinutes(),e,2)}function Ca(s,e){return P(s.getUTCSeconds(),e,2)}function xa(s){var e=s.getUTCDay();return e===0?7:e}function Aa(s,e){return P(pt.count(ae(s)-1,s),e,2)}function _n(s){var e=s.getUTCDay();return e>=4||e===0?me(s):me.ceil(s)}function Wa(s,e){return s=_n(s),P(me.count(ae(s),s)+(ae(s).getUTCDay()===4),e,2)}function ya(s){return s.getUTCDay()}function ba(s,e){return P(_e.count(ae(s)-1,s),e,2)}function Ua(s,e){return P(s.getUTCFullYear()%100,e,2)}function Ea(s,e){return s=_n(s),P(s.getUTCFullYear()%100,e,2)}function Fa(s,e){return P(s.getUTCFullYear()%1e4,e,4)}function Pa(s,e){var t=s.getUTCDay();return s=t>=4||t===0?me(s):me.ceil(s),P(s.getUTCFullYear()%1e4,e,4)}function Ia(){return"+0000"}function Gn(){return"%"}function kn(s){return+s}function vn(s){return Math.floor(+s/1e3)}var Oe,On,ls,ps,gs;Cr({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Cr(s){return Oe=Rr(s),On=Oe.format,ls=Oe.parse,ps=Oe.utcFormat,gs=Oe.utcParse,Oe}var xr;(t=>{let s;(c=>(c.ALL="ALL",c.READ="READ",c.WRITE="WRITE",c.HOLD="HOLD",c.SUB="SUB"))(s=t.LockModes||={});let e;(g=>(g.Attach="Attach",g.Detach="Detach",g.State="State",g.Reload="Reload",g.ReloadRetry="ReloadRetry",g.MemLock="MemLock",g.MemUnlock="MemUnlock",g.GetMemLocked="GetMemLocked"))(e=t.RoxieControlCmdType||={})})(xr||={});var ds=class extends x{constructor(e){super(e,"WsSMC","1.29")}Activity(e){return this._connection.send("Activity",e,"json",!1,void 0,"ActivityResponse")}BrowseResources(e){return this._connection.send("BrowseResources",e,"json",!1,void 0,"BrowseResourcesResponse")}ClearQueue(e){return this._connection.send("ClearQueue",e,"json",!1,void 0,"SMCQueueResponse")}GetBuildInfo(e){return this._connection.send("GetBuildInfo",e,"json",!1,void 0,"GetBuildInfoResponse")}GetGlobalMetrics(e){return this._connection.send("GetGlobalMetrics",e,"json",!1,void 0,"GetGlobalMetricsResponse")}GetStatusServerInfo(e){return this._connection.send("GetStatusServerInfo",e,"json",!1,void 0,"GetStatusServerInfoResponse")}GetThorQueueAvailability(e){return this._connection.send("GetThorQueueAvailability",e,"json",!1,void 0,"GetThorQueueAvailabilityResponse")}Index(e){return this._connection.send("Index",e,"json",!1,void 0,"SMCIndexResponse")}LockQuery(e){return this._connection.send("LockQuery",e,"json",!1,void 0,"LockQueryResponse")}MoveJobBack(e){return this._connection.send("MoveJobBack",e,"json",!1,void 0,"SMCJobResponse")}MoveJobDown(e){return this._connection.send("MoveJobDown",e,"json",!1,void 0,"SMCJobResponse")}MoveJobFront(e){return this._connection.send("MoveJobFront",e,"json",!1,void 0,"SMCJobResponse")}MoveJobUp(e){return this._connection.send("MoveJobUp",e,"json",!1,void 0,"SMCJobResponse")}NotInCommunityEdition(e){return this._connection.send("NotInCommunityEdition",e,"json",!1,void 0,"NotInCommunityEditionResponse")}PauseQueue(e){return this._connection.send("PauseQueue",e,"json",!1,void 0,"SMCQueueResponse")}Ping(e){return this._connection.send("Ping",e,"json",!1,void 0,"WsSMCPingResponse")}RecordGlobalMetrics(e){return this._connection.send("RecordGlobalMetrics",e,"json",!1,void 0,"RecordGlobalMetricsResponse")}RemoveJob(e){return this._connection.send("RemoveJob",e,"json",!1,void 0,"SMCJobResponse")}ResumeQueue(e){return this._connection.send("ResumeQueue",e,"json",!1,void 0,"SMCQueueResponse")}RoxieControlCmd(e){return this._connection.send("RoxieControlCmd",e,"json",!1,void 0,"RoxieControlCmdResponse")}RoxieXrefCmd(e){return this._connection.send("RoxieXrefCmd",e,"json",!1,void 0,"RoxieXrefCmdResponse")}SetBanner(e){return this._connection.send("SetBanner",e,"json",!1,void 0,"SetBannerResponse")}SetJobPriority(e){return this._connection.send("SetJobPriority",e,"json",!1,void 0,"SMCPriorityResponse")}StopQueue(e){return this._connection.send("StopQueue",e,"json",!1,void 0,"SMCQueueResponse")}};var Ta=ls("%Y%m%d%H");function Ma(s){return typeof s=="number"||typeof s=="string"&&s.trim()!==""&&!isNaN(+s)}var Ye=class extends ds{connectionOptions(){return this._connection.opts()}Activity(e){return super.Activity(e).then(t=>({Running:{ActiveWorkunit:[]},...t}))}parseGlobalMetric(e,t){return e.startsWith("Cost")?+t/1e6:e.startsWith("Date")?Ta(t):e.startsWith("Num")?+t:e.startsWith("Time")?+t/1e9:e.startsWith("When")?new Date(+t/1e3).toISOString():Ma(t)?+t:t}GetNormalisedGlobalMetrics(e){return super.GetGlobalMetrics(e).then(t=>{let r=[];for(let n of t?.GlobalMetrics?.GlobalMetric||[]){let i={Category:n.Category,Start:this.parseGlobalMetric("Date",n.DateTimeRange?.Start),End:this.parseGlobalMetric("Date",n.DateTimeRange?.End),dimensions:{},stats:{}};for(let o of n.Dimensions?.Dimension||[])i.dimensions[o.Name]=o.Value;for(let o of n.Stats?.Stat||[])i.stats[o.Name]=this.parseGlobalMetric(o.Name,o.Value);r.push(i)}return r})}};var ms=class extends x{constructor(e){super(e,"wsstore","1.02")}CreateStore(e,t){return this._connection.send("CreateStore",e,"json",!1,t,"CreateStoreResponse")}Delete(e,t){return this._connection.send("Delete",e,"json",!1,t,"DeleteResponse")}DeleteNamespace(e,t){return this._connection.send("DeleteNamespace",e,"json",!1,t,"DeleteNamespaceResponse")}Fetch(e,t){return this._connection.send("Fetch",e,"json",!1,t,"FetchResponse")}FetchAll(e,t){return this._connection.send("FetchAll",e,"json",!1,t,"FetchAllResponse")}FetchKeyMetadata(e,t){return this._connection.send("FetchKeyMetadata",e,"json",!1,t,"FetchKeyMDResponse")}ListKeys(e,t){return this._connection.send("ListKeys",e,"json",!1,t,"ListKeysResponse")}ListNamespaces(e,t){return this._connection.send("ListNamespaces",e,"json",!1,t,"ListNamespacesResponse")}ListStores(e,t){return this._connection.send("ListStores",e,"json",!1,t,"ListStoresResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"wsstorePingResponse")}Set(e,t){return this._connection.send("Set",e,"json",!1,t,"SetResponse")}};var Xe=class extends ms{Delete(e){return super.Delete(e).catch(t=>{if(t.isESPExceptions&&t.Exception.some(r=>r.Code===-1))return{Exceptions:void 0,Success:!0};throw t})}Fetch(e){return super.Fetch(e).catch(t=>{if(t.isESPExceptions&&t.Exception.some(r=>r.Code===-1))return{Exceptions:void 0,Value:void 0};throw t})}};var Ar;(r=>{let s;(o=>(o.XML="XML",o.YAML="YAML"))(s=r.TpConfigResponseFormat||={});let e;(a=>(a.All="All",a.QueriesOnly="QueriesOnly",a.WorkunitsOnly="WorkunitsOnly"))(e=r.RoxieQueueFilter||={});let t;(D=>(D.ALLNODES="ALLNODES",D.THORMACHINES="THORMACHINES",D.HOLEMACHINES="HOLEMACHINES",D.ROXIEMACHINES="ROXIEMACHINES",D.MACHINES="MACHINES",D.AVAILABLEMACHINES="AVAILABLEMACHINES",D.DROPZONE="DROPZONE",D.STANDBYNNODE="STANDBYNNODE",D.THORSPARENODES="THORSPARENODES",D.HOLESTANDBYNODES="HOLESTANDBYNODES"))(t=r.TpMachineType||={})})(Ar||={});var hs=class extends x{constructor(e){super(e,"WsTopology","1.33")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"WsTopologyPingResponse")}SystemLog(e,t){return this._connection.send("SystemLog",e,"json",!1,t,"SystemLogResponse")}TpClusterInfo(e,t){return this._connection.send("TpClusterInfo",e,"json",!1,t,"TpClusterInfoResponse")}TpClusterQuery(e,t){return this._connection.send("TpClusterQuery",e,"json",!1,t,"TpClusterQueryResponse")}TpComponentConfiguration(e,t){return this._connection.send("TpComponentConfiguration",e,"json",!1,t,"TpComponentConfigurationResponse")}TpConfiguredComponents(e,t){return this._connection.send("TpConfiguredComponents",e,"json",!1,t,"TpConfiguredComponentsResponse")}TpDropZoneQuery(e,t){return this._connection.send("TpDropZoneQuery",e,"json",!1,t,"TpDropZoneQueryResponse")}TpGetComponentFile(e,t){return this._connection.send("TpGetComponentFile",e,"json",!1,t,"TpGetComponentFileResponse")}TpGetServicePlugins(e,t){return this._connection.send("TpGetServicePlugins",e,"json",!1,t,"TpGetServicePluginsResponse")}TpGroupQuery(e,t){return this._connection.send("TpGroupQuery",e,"json",!1,t,"TpGroupQueryResponse")}TpListLogFiles(e,t){return this._connection.send("TpListLogFiles",e,"json",!1,t,"TpListLogFilesResponse")}TpListTargetClusters(e,t){return this._connection.send("TpListTargetClusters",e,"json",!1,t,"TpListTargetClustersResponse")}TpLogFile(e,t){return this._connection.send("TpLogFile",e,"json",!1,t,"TpLogFileResponse")}TpLogFileDisplay(e,t){return this._connection.send("TpLogFileDisplay",e,"json",!1,t,"TpLogFileResponse")}TpLogicalClusterQuery(e,t){return this._connection.send("TpLogicalClusterQuery",e,"json",!1,t,"TpLogicalClusterQueryResponse")}TpMachineInfo(e,t){return this._connection.send("TpMachineInfo",e,"json",!1,t,"TpMachineInfoResponse")}TpMachineQuery(e,t){return this._connection.send("TpMachineQuery",e,"json",!1,t,"TpMachineQueryResponse")}TpServiceQuery(e,t){return this._connection.send("TpServiceQuery",e,"json",!1,t,"TpServiceQueryResponse")}TpSetMachineStatus(e,t){return this._connection.send("TpSetMachineStatus",e,"json",!1,t,"TpSetMachineStatusResponse")}TpSwapNode(e,t){return this._connection.send("TpSwapNode",e,"json",!1,t,"TpSwapNodeResponse")}TpTargetClusterQuery(e,t){return this._connection.send("TpTargetClusterQuery",e,"json",!1,t,"TpTargetClusterQueryResponse")}TpThorStatus(e,t){return this._connection.send("TpThorStatus",e,"json",!1,t,"TpThorStatusResponse")}TpXMLFile(e,t){return this._connection.send("TpXMLFile",e,"json",!1,t,"TpXMLFileResponse")}};var G=class extends hs{connectionOptions(){return this._connection.opts()}protocol(){return this._connection.opts().baseUrl.split("//")[0]}ip(){return this._connection.opts().baseUrl.split("//")[1].split(":")[0]}DefaultTpLogicalClusterQuery(e={}){return this.TpLogicalClusterQuery(e).then(t=>{if(t.default)return t.default;let r,n;return t.TpLogicalClusters.TpLogicalCluster.some((i,o)=>(o===0&&(n=i),i.Type==="hthor"?(r=i,!0):!1)),r||n})}};var fs=require("@hpcc-js/util");var V;(R=>{let s;(E=>(E.Abort="Abort",E.Delete="Delete",E.Deschedule="Deschedule",E.Reschedule="Reschedule",E.Pause="Pause",E.PauseNow="PauseNow",E.Protect="Protect",E.Unprotect="Unprotect",E.Restore="Restore",E.Resume="Resume",E.SetToFailed="SetToFailed",E.Archive="Archive"))(s=R.ECLWUActions||={});let e;(W=>(W[W.MIN=0]="MIN",W[W.DEFAULT=1]="DEFAULT",W[W.ALL=2]="ALL",W[W.CUSTOM=3]="CUSTOM"))(e=R.LogSelectColumnMode||={});let t;(Z=>(Z[Z.ASC=0]="ASC",Z[Z.DSC=1]="DSC"))(t=R.SortDirection||={});let r;(B=>(B.ALL="ALL",B.DIS="DIS",B.ERR="ERR",B.WRN="WRN",B.INF="INF",B.PRO="PRO",B.MET="MET",B.EVT="EVT"))(r=R.LogEventClass||={});let n;(C=>(C.Single="Single",C.List="List",C.Multi="Multi"))(n=R.WUDetailsAttrValueType||={});let i;(C=>(C.SyntaxCheck="SyntaxCheck",C.Deploy="Deploy",C.Publish="Publish"))(i=R.EclDefinitionActions||={});let o;(C=>(C.xml="xml",C.json="json",C.text="text"))(o=R.ErrorMessageFormat||={});let a;(C=>(C[C.XML=0]="XML",C[C.JSON=1]="JSON",C[C.CSV=2]="CSV"))(a=R.LogAccessLogFormat||={});let c;(W=>(W.info="info",W.warning="warning",W.error="error",W.alert="alert"))(c=R.WUExceptionSeverity||={});let l;(W=>(W[W.OriginalText=0]="OriginalText",W[W.Attachment=1]="Attachment",W[W.ZIP=2]="ZIP",W[W.GZIP=3]="GZIP"))(l=R.WUFileDownloadOption||={});let u;(E=>(E.XML="XML",E.cpp="cpp",E.dll="dll",E.res="res",E.log="log",E.WUECL="WUECL",E.ThorLog="ThorLog",E.ThorSlaveLog="ThorSlaveLog",E.EclAgentLog="EclAgentLog",E.ArchiveQuery="ArchiveQuery",E.ComponentLog="ComponentLog",E.PostMortem="PostMortem"))(u=R.WUFileType||={});let g;($=>($.Allqueries="All queries",$.Notsuspended="Not suspended",$.Suspended="Suspended",$.Suspendedbyuser="Suspended by user",$.Suspendedbyfirstnode="Suspended by first node",$.Suspendedbyanynode="Suspended by any node"))(g=R.WUQueryFilterSuspendedType||={});let p;(T=>(T.All="All",T.Id="Id",T.Name="Name",T.Alias="Alias",T.Status="Status"))(p=R.WUQuerySetFilterType||={});let f;(C=>(C.All="All",C.Protected="Protected",C.NotProtected="NotProtected"))(f=R.WUProtectFilter||={});let D;(m=>m.Deactivate="Deactivate")(D=R.QuerySetAliasActionTypes||={});let A;(Z=>(Z.None="None",Z.ActivateImportedActive="ActivateImportedActive"))(A=R.QuerysetImportActivation||={});let b;(B=>(B.Suspend="Suspend",B.Unsuspend="Unsuspend",B.ToggleSuspend="ToggleSuspend",B.Activate="Activate",B.Delete="Delete",B.DeleteQueriesAndWUs="DeleteQueriesAndWUs",B.RemoveAllAliases="RemoveAllAliases",B.ResetQueryStats="ResetQueryStats"))(b=R.QuerySetQueryActionTypes||={});let I;(W=>(W[W.DoNotActivateQuery=0]="DoNotActivateQuery",W[W.ActivateQuery=1]="ActivateQuery",W[W.ActivateQuerySuspendPrevious=2]="ActivateQuerySuspendPrevious",W[W.ActivateQueryDeletePrevious=3]="ActivateQueryDeletePrevious"))(I=R.WUQueryActivationMode||={})})(V||={});var ht=class extends x{constructor(e){super(e,"WsWorkunits","2.11")}GVCAjaxGraph(e,t){return this._connection.send("GVCAjaxGraph",e,"json",!1,t,"GVCAjaxGraphResponse")}Ping(e,t){return this._connection.send("Ping",e,"json",!1,t,"WsWorkunitsPingResponse")}WUAbort(e,t){return this._connection.send("WUAbort",e,"json",!1,t,"WUAbortResponse")}WUAction(e,t){return this._connection.send("WUAction",e,"json",!1,t,"WUActionResponse")}WUAddLocalFileToWorkunit(e,t){return this._connection.send("WUAddLocalFileToWorkunit",e,"json",!1,t,"WUAddLocalFileToWorkunitResponse")}WUAnalyseHotspot(e,t){return this._connection.send("WUAnalyseHotspot",e,"json",!1,t,"WUAnalyseHotspotResponse")}WUCDebug(e,t){return this._connection.send("WUCDebug",e,"json",!1,t,"WUDebugResponse")}WUCheckFeatures(e,t){return this._connection.send("WUCheckFeatures",e,"json",!1,t,"WUCheckFeaturesResponse")}WUClusterJobQueueLOG(e,t){return this._connection.send("WUClusterJobQueueLOG",e,"json",!1,t,"WUClusterJobQueueLOGResponse")}WUClusterJobQueueXLS(e,t){return this._connection.send("WUClusterJobQueueXLS",e,"json",!1,t,"WUClusterJobQueueXLSResponse")}WUClusterJobSummaryXLS(e,t){return this._connection.send("WUClusterJobSummaryXLS",e,"json",!1,t,"WUClusterJobSummaryXLSResponse")}WUClusterJobXLS(e,t){return this._connection.send("WUClusterJobXLS",e,"json",!1,t,"WUClusterJobXLSResponse")}WUCompileECL(e,t){return this._connection.send("WUCompileECL",e,"json",!1,t,"WUCompileECLResponse")}WUCopyLogicalFiles(e,t){return this._connection.send("WUCopyLogicalFiles",e,"json",!1,t,"WUCopyLogicalFilesResponse")}WUCopyQuerySet(e,t){return this._connection.send("WUCopyQuerySet",e,"json",!1,t,"WUCopyQuerySetResponse")}WUCreate(e,t){return this._connection.send("WUCreate",e,"json",!1,t,"WUCreateResponse")}WUCreateAndUpdate(e,t){return this._connection.send("WUCreateAndUpdate",e,"json",!1,t,"WUUpdateResponse")}WUCreateZAPInfo(e,t){return this._connection.send("WUCreateZAPInfo",e,"json",!1,t,"WUCreateZAPInfoResponse")}WUDelete(e,t){return this._connection.send("WUDelete",e,"json",!1,t,"WUDeleteResponse")}WUDeployWorkunit(e,t){return this._connection.send("WUDeployWorkunit",e,"json",!1,t,"WUDeployWorkunitResponse")}WUDetails(e,t){return this._connection.send("WUDetails",e,"json",!1,t,"WUDetailsResponse")}WUDetailsMeta(e,t){return this._connection.send("WUDetailsMeta",e,"json",!1,t,"WUDetailsMetaResponse")}WUEclDefinitionAction(e,t){return this._connection.send("WUEclDefinitionAction",e,"json",!1,t,"WUEclDefinitionActionResponse")}WUExport(e,t){return this._connection.send("WUExport",e,"json",!1,t,"WUExportResponse")}WUFile(e,t){return this._connection.send("WUFile",e,"json",!1,t,"WULogFileResponse")}WUFullResult(e,t){return this._connection.send("WUFullResult",e,"json",!1,t,"WUFullResultResponse")}WUGVCGraphInfo(e,t){return this._connection.send("WUGVCGraphInfo",e,"json",!1,t,"WUGVCGraphInfoResponse")}WUGetArchiveFile(e,t){return this._connection.send("WUGetArchiveFile",e,"json",!1,t,"WUGetArchiveFileResponse")}WUGetDependancyTrees(e,t){return this._connection.send("WUGetDependancyTrees",e,"json",!1,t,"WUGetDependancyTreesResponse")}WUGetGraph(e,t){return this._connection.send("WUGetGraph",e,"json",!1,t,"WUGetGraphResponse")}WUGetGraphNameAndTypes(e,t){return this._connection.send("WUGetGraphNameAndTypes",e,"json",!1,t,"WUGetGraphNameAndTypesResponse")}WUGetNumFileToCopy(e,t){return this._connection.send("WUGetNumFileToCopy",e,"json",!1,t,"WUGetNumFileToCopyResponse")}WUGetPlugins(e,t){return this._connection.send("WUGetPlugins",e,"json",!1,t,"WUGetPluginsResponse")}WUGetStats(e,t){return this._connection.send("WUGetStats",e,"json",!1,t,"WUGetStatsResponse")}WUGetThorJobList(e,t){return this._connection.send("WUGetThorJobList",e,"json",!1,t,"WUGetThorJobListResponse")}WUGetThorJobQueue(e,t){return this._connection.send("WUGetThorJobQueue",e,"json",!1,t,"WUGetThorJobQueueResponse")}WUGetZAPInfo(e,t){return this._connection.send("WUGetZAPInfo",e,"json",!1,t,"WUGetZAPInfoResponse")}WUGraphInfo(e,t){return this._connection.send("WUGraphInfo",e,"json",!1,t,"WUGraphInfoResponse")}WUGraphTiming(e,t){return this._connection.send("WUGraphTiming",e,"json",!1,t,"WUGraphTimingResponse")}WUHelperFileArchive(e,t){return this._connection.send("WUHelperFileArchive",e,"json",!1,t,"WUHelperFileArchiveResponse")}WUInfo(e,t){return this._connection.send("WUInfo",e,"json",!1,t,"WUInfoResponse")}WUInfoDetails(e,t){return this._connection.send("WUInfoDetails",e,"json",!1,t,"WUInfoResponse")}WUJobList(e,t){return this._connection.send("WUJobList",e,"json",!1,t,"WUJobListResponse")}WULightWeightQuery(e,t){return this._connection.send("WULightWeightQuery",e,"json",!1,t,"WULightWeightQueryResponse")}WUListArchiveFiles(e,t){return this._connection.send("WUListArchiveFiles",e,"json",!1,t,"WUListArchiveFilesResponse")}WUListLocalFileRequired(e,t){return this._connection.send("WUListLocalFileRequired",e,"json",!1,t,"WUListLocalFileRequiredResponse")}WUListQueries(e,t){return this._connection.send("WUListQueries",e,"json",!1,t,"WUListQueriesResponse")}WUListQueriesUsingFile(e,t){return this._connection.send("WUListQueriesUsingFile",e,"json",!1,t,"WUListQueriesUsingFileResponse")}WUMultiQuerysetDetails(e,t){return this._connection.send("WUMultiQuerysetDetails",e,"json",!1,t,"WUMultiQuerySetDetailsResponse")}WUProcessGraph(e,t){return this._connection.send("WUProcessGraph",e,"json",!1,t,"WUProcessGraphResponse")}WUProtect(e,t){return this._connection.send("WUProtect",e,"json",!1,t,"WUProtectResponse")}WUPublishWorkunit(e,t){return this._connection.send("WUPublishWorkunit",e,"json",!1,t,"WUPublishWorkunitResponse")}WUPushEvent(e,t){return this._connection.send("WUPushEvent",e,"json",!1,t,"WUPushEventResponse")}WUQuery(e,t){return this._connection.send("WUQuery",e,"json",!1,t,"WUQueryResponse")}WUQueryConfig(e,t){return this._connection.send("WUQueryConfig",e,"json",!1,t,"WUQueryConfigResponse")}WUQueryDetails(e,t){return this._connection.send("WUQueryDetails",e,"json",!1,t,"WUQueryDetailsResponse")}WUQueryDetailsLightWeight(e,t){return this._connection.send("WUQueryDetailsLightWeight",e,"json",!1,t,"WUQueryDetailsResponse")}WUQueryFiles(e,t){return this._connection.send("WUQueryFiles",e,"json",!1,t,"WUQueryFilesResponse")}WUQueryGetGraph(e,t){return this._connection.send("WUQueryGetGraph",e,"json",!1,t,"WUQueryGetGraphResponse")}WUQueryGetSummaryStats(e,t){return this._connection.send("WUQueryGetSummaryStats",e,"json",!1,t,"WUQueryGetSummaryStatsResponse")}WUQuerysetAliasAction(e,t){return this._connection.send("WUQuerysetAliasAction",e,"json",!1,t,"WUQuerySetAliasActionResponse")}WUQuerysetCopyQuery(e,t){return this._connection.send("WUQuerysetCopyQuery",e,"json",!1,t,"WUQuerySetCopyQueryResponse")}WUQuerysetDetails(e,t){return this._connection.send("WUQuerysetDetails",e,"json",!1,t,"WUQuerySetDetailsResponse")}WUQuerysetExport(e,t){return this._connection.send("WUQuerysetExport",e,"json",!1,t,"WUQuerysetExportResponse")}WUQuerysetImport(e,t){return this._connection.send("WUQuerysetImport",e,"json",!1,t,"WUQuerysetImportResponse")}WUQuerysetQueryAction(e,t){return this._connection.send("WUQuerysetQueryAction",e,"json",!1,t,"WUQuerySetQueryActionResponse")}WUQuerysets(e,t){return this._connection.send("WUQuerysets",e,"json",!1,t,"WUQuerysetsResponse")}WURecreateQuery(e,t){return this._connection.send("WURecreateQuery",e,"json",!1,t,"WURecreateQueryResponse")}WUResubmit(e,t){return this._connection.send("WUResubmit",e,"json",!1,t,"WUResubmitResponse")}WUResult(e,t){return this._connection.send("WUResult",e,"json",!1,t,"WUResultResponse")}WUResultBin(e,t){return this._connection.send("WUResultBin",e,"json",!1,t,"WUResultBinResponse")}WUResultSummary(e,t){return this._connection.send("WUResultSummary",e,"json",!1,t,"WUResultSummaryResponse")}WUResultView(e,t){return this._connection.send("WUResultView",e,"json",!1,t,"WUResultViewResponse")}WURun(e,t){return this._connection.send("WURun",e,"json",!1,t,"WURunResponse")}WUSchedule(e,t){return this._connection.send("WUSchedule",e,"json",!1,t,"WUScheduleResponse")}WUShowScheduled(e,t){return this._connection.send("WUShowScheduled",e,"json",!1,t,"WUShowScheduledResponse")}WUSubmit(e,t){return this._connection.send("WUSubmit",e,"json",!1,t,"WUSubmitResponse")}WUSyntaxCheckECL(e,t){return this._connection.send("WUSyntaxCheckECL",e,"json",!1,t,"WUSyntaxCheckResponse")}WUUpdate(e,t){return this._connection.send("WUUpdate",e,"json",!1,t,"WUUpdateResponse")}WUUpdateQueryEntry(e,t){return this._connection.send("WUUpdateQueryEntry",e,"json",!1,t,"WUUpdateQueryEntryResponse")}WUWaitCompiled(e,t){return this._connection.send("WUWaitCompiled",e,"json",!1,t,"WUWaitResponse")}WUWaitComplete(e,t){return this._connection.send("WUWaitComplete",e,"json",!1,t,"WUWaitResponse")}};var Ss=(S=>(S[S.Unknown=0]="Unknown",S[S.Compiled=1]="Compiled",S[S.Running=2]="Running",S[S.Completed=3]="Completed",S[S.Failed=4]="Failed",S[S.Archived=5]="Archived",S[S.Aborting=6]="Aborting",S[S.Aborted=7]="Aborted",S[S.Blocked=8]="Blocked",S[S.Submitted=9]="Submitted",S[S.Scheduled=10]="Scheduled",S[S.Compiling=11]="Compiling",S[S.Wait=12]="Wait",S[S.UploadingFiled=13]="UploadingFiled",S[S.DebugPaused=14]="DebugPaused",S[S.DebugRunning=15]="DebugRunning",S[S.Paused=16]="Paused",S[S.LAST=17]="LAST",S[S.NotFound=999]="NotFound",S))(Ss||{}),he;(e=>{let s;(p=>(p[p.Unknown=0]="Unknown",p[p.Compile=1]="Compile",p[p.Check=2]="Check",p[p.Run=3]="Run",p[p.ExecuteExisting=4]="ExecuteExisting",p[p.Pause=5]="Pause",p[p.PauseNow=6]="PauseNow",p[p.Resume=7]="Resume",p[p.Debug=8]="Debug",p[p.__size=9]="__size"))(s=e.Action||={})})(he||={});function Wr(s){return typeof s.Name=="string"}function wa(s){return s.TotalClusterTime!==void 0}function Ba(s){return s.StateEx!==void 0}var L=class extends ht{constructor(e){super(e)}Ping(){return this._connection.send("Ping",{},"json",!1,void 0,"WsWorkunitsPingResponse").then(()=>({result:!0}))}WUQuery(e={},t){return this._connection.send("WUQuery",e,"json",!1,t).then(r=>(0,fs.deepMixin)({Workunits:{ECLWorkunit:[]}},r))}WUInfo(e){let t={Wuid:"",TruncateEclTo64k:!0,IncludeExceptions:!1,IncludeGraphs:!1,IncludeSourceFiles:!1,IncludeResults:!1,IncludeResultsViewNames:!1,IncludeVariables:!1,IncludeTimers:!1,IncludeDebugValues:!1,IncludeApplicationValues:!1,IncludeWorkflows:!1,IncludeXmlSchemas:!1,IncludeResourceURLs:!1,IncludeECL:!1,IncludeHelpers:!1,IncludeAllowedClusters:!1,IncludeTotalClusterTime:!1,IncludeServiceNames:!1,SuppressResultSchemas:!0,...e};return super.WUInfo(t)}WUCreate(){return super.WUCreate({})}WUUpdate(e){return this._connection.send("WUUpdate",e,"json",!0)}WUResubmit(e){return this._connection.toESPStringArray(e,"Wuids"),super.WUResubmit(e)}WUAction(e){return e.ActionType=e.WUActionType,super.WUAction(e)}WUResult(e,t){return this._connection.send("WUResult",e,"json",!1,t)}WUFileEx(e){return this._connection.send("WUFile",e,"text")}_WUDetailsMetaPromise;WUDetailsMeta(e){return this._WUDetailsMetaPromise||(this._WUDetailsMetaPromise=super.WUDetailsMeta(e)),this._WUDetailsMetaPromise}WUDetailsEx(e,t,r){return this._connection.send("WUDetails",e,r,!1,t,"WUDetailsResponse")}WUCDebugEx(e){return this._connection.send("WUCDebug",e,void 0,void 0,void 0,"WUDebug").then(t=>{let n=(0,fs.xml2json)(t.Result).children();return n.length?n[0]:null})}},ft=class extends ht{WUPublishWorkunitEx(e){return this._connection.send("WUPublishWorkunit",e)}};var Ts=require("@hpcc-js/util");var K=require("@hpcc-js/util");function Xn(s){return Math.abs(s=Math.round(s))>=1e21?s.toLocaleString("en").replace(/,/g,""):s.toString(10)}function Ue(s,e){if(!isFinite(s)||s===0)return null;var t=(s=e?s.toExponential(e-1):s.toExponential()).indexOf("e"),r=s.slice(0,t);return[r.length>1?r[0]+r.slice(2):r,+s.slice(t+1)]}function qn(s){return s=Ue(Math.abs(s)),s?s[1]:NaN}function Jn(s,e){return function(t,r){for(var n=t.length,i=[],o=0,a=s[0],c=0;n>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),i.push(t.substring(n-=a,n+a)),!((c+=a+1)>r));)a=s[o=(o+1)%s.length];return i.reverse().join(e)}}function zn(s){return function(e){return e.replace(/[0-9]/g,function(t){return s[+t]})}}var Na=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function St(s){if(!(e=Na.exec(s)))throw new Error("invalid format: "+s);var e;return new yr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}St.prototype=yr.prototype;function yr(s){this.fill=s.fill===void 0?" ":s.fill+"",this.align=s.align===void 0?">":s.align+"",this.sign=s.sign===void 0?"-":s.sign+"",this.symbol=s.symbol===void 0?"":s.symbol+"",this.zero=!!s.zero,this.width=s.width===void 0?void 0:+s.width,this.comma=!!s.comma,this.precision=s.precision===void 0?void 0:+s.precision,this.trim=!!s.trim,this.type=s.type===void 0?"":s.type+""}yr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Kn(s){e:for(var e=s.length,t=1,r=-1,n;t<e;++t)switch(s[t]){case".":r=n=t;break;case"0":r===0&&(r=t),n=t;break;default:if(!+s[t])break e;r>0&&(r=0);break}return r>0?s.slice(0,r)+s.slice(n+1):s}var Dt;function Zn(s,e){var t=Ue(s,e);if(!t)return Dt=void 0,s.toPrecision(e);var r=t[0],n=t[1],i=n-(Dt=Math.max(-8,Math.min(8,Math.floor(n/3)))*3)+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Ue(s,Math.max(0,e+i-1))[0]}function br(s,e){var t=Ue(s,e);if(!t)return s+"";var r=t[0],n=t[1];return n<0?"0."+new Array(-n).join("0")+r:r.length>n+1?r.slice(0,n+1)+"."+r.slice(n+1):r+new Array(n-r.length+2).join("0")}var Ur={"%":(s,e)=>(s*100).toFixed(e),b:s=>Math.round(s).toString(2),c:s=>s+"",d:Xn,e:(s,e)=>s.toExponential(e),f:(s,e)=>s.toFixed(e),g:(s,e)=>s.toPrecision(e),o:s=>Math.round(s).toString(8),p:(s,e)=>br(s*100,e),r:br,s:Zn,X:s=>Math.round(s).toString(16).toUpperCase(),x:s=>Math.round(s).toString(16)};function Er(s){return s}var $n=Array.prototype.map,ei=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function ti(s){var e=s.grouping===void 0||s.thousands===void 0?Er:Jn($n.call(s.grouping,Number),s.thousands+""),t=s.currency===void 0?"":s.currency[0]+"",r=s.currency===void 0?"":s.currency[1]+"",n=s.decimal===void 0?".":s.decimal+"",i=s.numerals===void 0?Er:zn($n.call(s.numerals,String)),o=s.percent===void 0?"%":s.percent+"",a=s.minus===void 0?"\u2212":s.minus+"",c=s.nan===void 0?"NaN":s.nan+"";function l(g,p){g=St(g);var f=g.fill,D=g.align,A=g.sign,b=g.symbol,I=g.zero,R=g.width,S=g.comma,m=g.precision,Z=g.trim,C=g.type;C==="n"?(S=!0,C="g"):Ur[C]||(m===void 0&&(m=12),Z=!0,C="g"),(I||f==="0"&&D==="=")&&(I=!0,f="0",D="=");var W=(p&&p.prefix!==void 0?p.prefix:"")+(b==="$"?t:b==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():""),T=(b==="$"?r:/[%p]/.test(C)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),$=Ur[C],$s=/[defgprs%]/.test(C);m=m===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m));function B(U){var ne=W,_=T,E,Ht,Ne;if(C==="c")_=$(U)+_,U="";else{U=+U;var Qe=U<0||1/U<0;if(U=isNaN(U)?c:$(Math.abs(U),m),Z&&(U=Kn(U)),Qe&&+U==0&&A!=="+"&&(Qe=!1),ne=(Qe?A==="("?A:a:A==="-"||A==="("?"":A)+ne,_=(C==="s"&&!isNaN(U)&&Dt!==void 0?ei[8+Dt/3]:"")+_+(Qe&&A==="("?")":""),$s){for(E=-1,Ht=U.length;++E<Ht;)if(Ne=U.charCodeAt(E),48>Ne||Ne>57){_=(Ne===46?n+U.slice(E+1):U.slice(E))+_,U=U.slice(0,E);break}}}S&&!I&&(U=e(U,1/0));var Le=ne.length+U.length+_.length,ee=Le<R?new Array(R-Le+1).join(f):"";switch(S&&I&&(U=e(ee+U,ee.length?R-_.length:1/0),ee=""),D){case"<":U=ne+U+_+ee;break;case"=":U=ne+ee+U+_;break;case"^":U=ee.slice(0,Le=ee.length>>1)+ne+U+_+ee.slice(Le);break;default:U=ee+ne+U+_;break}return i(U)}return B.toString=function(){return g+""},B}function u(g,p){var f=Math.max(-8,Math.min(8,Math.floor(qn(p)/3)))*3,D=Math.pow(10,-f),A=l((g=St(g),g.type="f",g),{suffix:ei[8+f/3]});return function(b){return A(D*b)}}return{format:l,formatPrefix:u}}var Ds,qe,si;Fr({thousands:",",grouping:[3],currency:["$",""]});function Fr(s){return Ds=ti(s),qe=Ds.format,si=Ds.formatPrefix,Ds}var k=require("@hpcc-js/util"),Rt=class extends k.StateObject{wu;get properties(){return this.get()}get Name(){return this.get("Name")}get Label(){return this.get("Label")}get Type(){return this.get("Type")}get Complete(){return this.get("Complete")}get WhenStarted(){return this.get("WhenStarted")}get WhenFinished(){return this.get("WhenFinished")}get Time(){return this.get("Time")}get Running(){return this.get("Running")}get RunningId(){return this.get("RunningId")}get Failed(){return this.get("Failed")}constructor(e,t,r){super(),this.wu=e;let n=0;for(let i of r)if(i.GraphName===t.Name&&!i.HasSubGraphId){n=Math.round(i.Seconds*1e3)/1e3;break}this.set({Time:n,...t})}fetchScopeGraph(e){return e?this.wu.fetchGraphDetails([e],["subgraph"]).then(t=>At(t)):this.wu.fetchGraphDetails([this.Name],["graph"]).then(t=>At(t))}},Ct=class extends k.Cache{constructor(){super(e=>k.Cache.hash([e.Name]))}};function ri(s,e,t){t=t||[],t.push(s),e(s.name,s.$,s.children(),t),s.children().forEach(r=>{ri(r,e,t)}),t.pop()}function Pr(s){let e={};return s.forEach(t=>{t.name==="att"&&(e[t.$.name]=t.$.value)}),e}var Rs=class extends k.Graph{},Ir=class extends k.Subgraph{},Tr=class extends k.Vertex{},Mr=class extends k.Edge{};function Qr(s,e){let t={},r={},n={},i=new Rs(a=>a._.id),o=[i.root];return ri(e,(a,c,l,u)=>{let g=o[o.length-1];switch(a){case"graph":break;case"node":if(l.length&&l[0].children().length&&l[0].children()[0].name==="graph"){let D=g.createSubgraph(Pr(l));o.push(D),t[c.id]=D}let p=g.createVertex(Pr(l));r[c.id]=p;break;case"edge":let f=g.createEdge(r[c.source],r[c.target],Pr(l));n[c.id]=f;break;default:}}),i}var xt=class extends k.Graph{},wr=class extends k.Subgraph{},Br=class extends k.Vertex{},Nr=class extends k.Edge{};function At(s){let e={},t={},r={},n;for(let i of s)switch(i.ScopeType){case"graph":n=new xt(u=>u._.Id,i),e[i.ScopeName]=n.root;break;case"subgraph":n||(n=new xt(u=>u._.Id,i),e[i.ScopeName]=n.root);let o=i.parentScope().split(":"),a=e[i.parentScope()];for(;o.length&&!a;)a=e[o.join(":")],o.pop();if(!a)console.warn(`Missing SG:Parent (${i.Id}): ${i.parentScope()}`);else{let u=a;e[i.ScopeName]=u.createSubgraph(i)}break;case"activity":let c=e[i.parentScope()];c?r[i.ScopeName]=c.createVertex(i):console.warn(`Missing A:Parent (${i.Id}): ${i.parentScope()}`);break;case"edge":t[i.ScopeName]=i;break;case"function":let l=r[i.parentScope()];l?l._.children().push(i):console.warn(`Missing F:Parent (${i.Id}): ${i.parentScope()}`);break}for(let i in t){let o=t[i],a=e[o.parentScope()];if(!a)console.warn(`Missing E:Parent (${o.Id}): ${o.parentScope()}`);else{let c=a;try{let l=n.vertex(o.attr("IdSource").RawValue),u=n.vertex(o.attr("IdTarget").RawValue);c.createEdge(l,u,o)}catch{console.warn(`Invalid Edge: ${i}`)}}}return n}var ni=require("@hpcc-js/util"),Wt=class extends ni.StateObject{wu;get properties(){return this.get()}get URL(){return this.get("URL")}get DisplayName(){return this.get("DisplayName")}get DisplayPath(){return this.get("DisplayPath")}constructor(e,t){super(),this.wu=e;let r=t.split("\\").join("/"),n=r.split("/"),i="res/"+this.wu.Wuid+"/",o="",a="";r.indexOf(i)===0&&(o=r.substr(i.length),a=n[n.length-1]),this.set({URL:t,DisplayName:a,DisplayPath:o})}};var se=require("@hpcc-js/util");var Ft=require("@hpcc-js/util"),yt=class{e;constructor(e){this.e=e}fix(){delete this.e}},bt=class extends yt{name;type;isSet=!1;attrs={};_children=[];constructor(e){super(e)}append(e){this._children.push(e),this.type||(this.type="hpcc:childDataset")}fix(){this.name=this.e.$.name,this.type=this.e.$.type;for(let t=this._children.length-1;t>=0;--t){let r=this._children[t];r.name==="Row"&&r.type===void 0&&(this._children.push(...r._children),this._children.splice(t,1))}let e=this.setOfType();e&&(this.type=e,this.isSet=!0,this._children=[])}children(){return this._children}isAll(e){return e.name==="All"&&e.type===void 0}setOfType(){let e=this.children();if(this.type===void 0&&e.length===2){if(this.isAll(e[0]))return e[1].type;if(this.isAll(e[1]))return e[0].type}}charWidth(){let e=-1;switch(this.type){case"xs:boolean":e=5;break;case"xs:integer":e=8;break;case"xs:nonNegativeInteger":e=8;break;case"xs:double":e=8;break;case"xs:string":e=32;break;default:let t="0123456789",r=this.type.lastIndexOf("_"),n=r>0?r:this.type.length,i=n-1;for(;i>=0&&t.indexOf(this.type.charAt(i))!==-1;--i);i+1<n&&(e=parseInt(this.type.substring(i+1,n),10)),this.type.indexOf("data")===0&&(e*=2);break}return e<this.name.length&&(e=this.name.length),e}},Ut=class extends yt{name;type;maxLength;_restricition;_maxLength;constructor(e){super(e)}append(e){switch(e.name){case"xs:restriction":this._restricition=e;break;case"xs:maxLength":this._maxLength=e;break;default:}}fix(){this.name=this.e.$.name,this.type=this._restricition.$.base,this.maxLength=this._maxLength?+this._maxLength.$.value:void 0,delete this._restricition,delete this._maxLength,super.fix()}},Et=class{root;simpleTypes={};fields(){return this.root.children()}},Cs=class extends Ft.SAXStackParser{schema=new Et;simpleType;simpleTypes={};xsdStack=new Ft.Stack;startXMLNode(e){switch(super.startXMLNode(e),e.name){case"xs:element":let t=new bt(e);this.schema.root?this.xsdStack.depth()&&this.xsdStack.top().append(t):this.schema.root=t,this.xsdStack.push(t);break;case"xs:simpleType":this.simpleType=new Ut(e);break;default:break}}endXMLNode(e){switch(e.name){case"xs:element":this.xsdStack.pop().fix();break;case"xs:simpleType":this.simpleType.fix(),this.simpleTypes[this.simpleType.name]=this.simpleType,delete this.simpleType;break;case"xs:appinfo":let r=this.xsdStack.top();for(let n in e.$)r.attrs[n]=e.$[n];break;default:this.simpleType&&this.simpleType.append(e)}super.endXMLNode(e)}};function xs(s){let e=new Cs;return e.parse(s),e.schema}var Lr=class extends Cs{_rootName;schema=new Et;simpleTypes={};xsdStack=new Ft.Stack;constructor(e){super(),this._rootName=e}startXMLNode(e){switch(super.startXMLNode(e),e.name){case"xsd:element":let t=new bt(e);!this.schema.root&&this._rootName===e.$.name&&(this.schema.root=t),this.xsdStack.depth()&&this.xsdStack.top().append(t),this.xsdStack.push(t);break;case"xsd:simpleType":this.simpleType=new Ut(e);break;default:break}}endXMLNode(e){switch(e.name){case"xsd:element":this.xsdStack.pop().fix();break;case"xsd:simpleType":break;default:break}super.endXMLNode(e)}};function Qa(s,e){let t=new Lr(e);return t.parse(s),t.schema}var Ws=class extends se.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Wuid}-${e.ResultName}`)}},As=new Ws,Pt=class s extends se.StateObject{connection;_bypassCache=!1;get BaseUrl(){return this.connection.baseUrl}xsdSchema;get properties(){return this.get()}get Wuid(){return this.get("Wuid")}get ResultName(){return this.get("ResultName")}get ResultSequence(){return this.get("ResultSequence")}get LogicalFileName(){return this.get("LogicalFileName")}get Name(){return this.get("Name")}get Sequence(){return this.get("Sequence")}get Value(){return this.get("Value")}get Link(){return this.get("Link")}get FileName(){return this.get("FileName")}get IsSupplied(){return this.get("IsSupplied")}get ShowFileContent(){return this.get("ShowFileContent")}get Total(){return this.get("Total")}get ECLSchemas(){return this.get("ECLSchemas")}get NodeGroup(){return this.get("NodeGroup")}get ResultViews(){return this.get("ResultViews")}get XmlSchema(){return this.get("XmlSchema")}static attach(e,t,r,n){let i;return Array.isArray(n)?(i=As.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:r.Name},()=>new s(e,t,r,n)),i.set(r)):typeof n>"u"&&(typeof r=="number"?i=As.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:"Sequence_"+r},()=>new s(e,t,r)):typeof r=="string"&&(i=As.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:r},()=>new s(e,t,r)))),i}static attachLogicalFile(e,t,r){return As.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:r},()=>new s(e,t,r,!0))}constructor(e,t,r,n){super(),e instanceof L?this.connection=e:this.connection=new L(e),typeof n=="boolean"&&n===!0?this.set({NodeGroup:t,LogicalFileName:r}):Wr(r)&&Array.isArray(n)?this.set({...r,Wuid:t,ResultName:r.Name,ResultViews:n}):typeof n>"u"?typeof r=="number"?this.set({Wuid:t,ResultSequence:r}):typeof r=="string"?this.set({Wuid:t,ResultName:r}):console.warn("Unknown Result.attach (1)"):console.warn("Unknown Result.attach (2)")}isComplete(){return this.Total!==-1}bypassCache(e){return e===void 0?this._bypassCache:(this._bypassCache=e,this)}_fetchXMLSchemaPromise;fetchXMLSchema(e=!1){return(!this._fetchXMLSchemaPromise||e)&&(this._fetchXMLSchemaPromise=this.WUResult().then(t=>t.Result?.XmlSchema?.xml?(this.xsdSchema=xs(t.Result.XmlSchema.xml),this.xsdSchema):null)),this._fetchXMLSchemaPromise}async refresh(){return await this.fetchRows(0,1,!0),this}fetchRows(e=0,t=-1,r=!1,n={},i,o){let a=o??this._bypassCache;return this.WUResult(e,t,!r,n,i,a).then(c=>{let l=c.Result;return delete c.Result,this.set({...c}),(0,se.exists)("XmlSchema.xml",l)&&(this.xsdSchema=xs(l.XmlSchema.xml)),(0,se.exists)("Row",l)?l.Row:this.ResultName&&(0,se.exists)(this.ResultName,l)?l[this.ResultName].Row:[]})}rootField(){return this.xsdSchema?this.xsdSchema.root:null}fields(){return this.xsdSchema?this.xsdSchema.root.children():[]}WUResult(e=0,t=1,r=!1,n={},i,o=!1){let a={NamedValue:{itemcount:0}};for(let l in n)a.NamedValue[a.NamedValue.itemcount++]={Name:l,Value:n[l]};let c={FilterBy:a};return this.Wuid&&this.ResultName!==void 0?(c.Wuid=this.Wuid,c.ResultName=this.ResultName):this.Wuid&&this.ResultSequence!==void 0?(c.Wuid=this.Wuid,c.Sequence=this.ResultSequence):this.LogicalFileName&&this.NodeGroup?(c.LogicalName=this.LogicalFileName,c.Cluster=this.NodeGroup):this.LogicalFileName&&(c.LogicalName=this.LogicalFileName),c.Start=e,c.Count=t,c.SuppressXmlSchema=r,c.BypassCachedResult=o,this.connection.WUResult(c,i).then(l=>l)}},It=class extends se.Cache{constructor(){super(e=>se.Cache.hash([e.Sequence,e.Name,e.Value,e.FileName]))}};var Gr=require("@hpcc-js/util"),fe=class extends Gr.StateObject{scope;get properties(){return this.get()}get Name(){return this.get("Name")}get RawValue(){return this.get("RawValue")}get Formatted(){return this.get("Formatted")}get FormattedEnd(){return this.get("FormattedEnd")}get Measure(){return this.get("Measure")}get Creator(){return this.get("Creator")}get CreatorType(){return this.get("CreatorType")}constructor(e,t){super(),this.scope=e,this.set(t)}},ys=class extends Gr.StateObject{_attributeMap={};_children=[];get properties(){return this.get()}get ScopeName(){return this.get("ScopeName")}get Id(){return this.get("Id")}get ScopeType(){return this.get("ScopeType")}get Properties(){return this.get("Properties",{Property:[]})}get Notes(){return this.get("Notes",{Note:[]})}get SinkActivity(){return this.get("SinkActivity")}get CAttributes(){let e=[],t={start:null,end:null};return this.Properties.Property.forEach(r=>{r.Measure==="ts"&&r.Name.indexOf("Started")>=0?t.start=r:this.ScopeName&&r.Measure==="ts"&&r.Name.indexOf("Finished")>=0?t.end=r:e.push(new fe(this,r))}),t.start&&t.end?(t.start.FormattedEnd=t.end.Formatted,e.push(new fe(this,t.start))):t.start?e.push(new fe(this,t.start)):t.end&&e.push(new fe(this,t.end)),e}constructor(e){super(),this.update(e)}update(e){this.set(e),this.CAttributes.forEach(t=>{this._attributeMap[t.Name]=t}),this.Properties.Property=[];for(let t in this._attributeMap)this._attributeMap.hasOwnProperty(t)&&this.Properties.Property.push(this._attributeMap[t].properties)}parentScope(){let e=this.ScopeName.split(":");return e.pop(),e.join(":")}children(e){return arguments.length?(this._children=e,this):this._children}walk(e){if(e.start(this))return!0;for(let t of this.children())if(t.walk(e))return!0;return e.end(this)}formattedAttrs(){let e={};for(let t in this._attributeMap)e[t]=this._attributeMap[t].Formatted||this._attributeMap[t].RawValue;return e}rawAttrs(){let e={};for(let t in this._attributeMap)e[t]=this._attributeMap[t].RawValue;return e}hasAttr(e){return this._attributeMap[e]!==void 0}attr(e){return this._attributeMap[e]||new fe(this,{Creator:"",CreatorType:"",Formatted:"",Measure:"",Name:"",RawValue:""})}attrMeasure(e){return this._attributeMap[e].Measure}calcTooltip(e){let t=this.Id,r=[];r.push(`<tr><td class="key">ID:</td><td class="value">${this.Id}</td></tr>`),e&&r.push(`<tr><td class="key">Parent ID:</td><td class="value">${e.Id}</td></tr>`),r.push(`<tr><td class="key">Scope:</td><td class="value">${this.ScopeName}</td></tr>`);let n=this.formattedAttrs();for(let i in n)i==="Label"?t=n[i]:r.push(`<tr><td class="key">${i}</td><td class="value">${n[i]}</td></tr>`);return`<div class="eclwatch_WUGraph_Tooltip" style="max-width:480px">
910
+ `,_=`@hpcc-js/comms`,v=`3.23.0`,y=`3.38.0`,b=(0,o.scopedLogger)(`comms/connection.ts`);function instanceOfIOptions(e){return`baseUrl`in e}var ee={type:`post`,baseUrl:``,userID:``,password:``,rejectUnauthorized:!0,timeoutSecs:60};function instanceOfIConnection(e){return typeof e.opts==`function`&&typeof e.send==`function`&&typeof e.clone==`function`}function encode(e,t){return t===void 0||t===!0?encodeURIComponent(e):``+e}function serializeRequest(e,t=!0,n=``){if(n&&(n+=`.`),typeof e!=`object`)return encode(e,t);let r=[];for(let i in e)if(e.hasOwnProperty(i)){if(e[i]instanceof Array){let a=!1;e[i].forEach((e,o)=>{typeof e==`object`?(a=!0,r.push(serializeRequest(e,t,n+encode(`${i}.${o}`,t)))):r.push(n+encode(`${i}_i${o}`,t)+`=`+serializeRequest(e,t))}),a&&r.push(n+encode(`${i}.itemcount`,t)+`=`+e[i].length)}else typeof e[i]==`object`?e[i]&&e[i].Item instanceof Array?(r.push(serializeRequest(e[i].Item,t,n+encode(i,t))),r.push(n+encode(`${i}.itemcount`,t)+`=`+e[i].Item.length)):r.push(serializeRequest(e[i],t,n+encode(i,t))):e[i]===void 0?r.push(n+encode(i,t)):r.push(n+encode(i,t)+`=`+encode(e[i],t))}return r.join(`&`)}function deserializeResponse(e){try{return JSON.parse(e)}catch(e){let t=e instanceof Error?e.message:String(e);throw Object.assign(Error(`Error parsing JSON response '${t}'`),{cause:e})}}function jsonp(e,t,n={},r=`json`,i){return i&&console.warn(`Header attributes ignored for JSONP connections`),new Promise((i,a)=>{let s=e.timeoutSecs*1e3,c=5e3,l=`jsonp_callback_`+Math.round(Math.random()*999999);window[l]=function(e){s=0,doCallback();try{i(r===`json`&&typeof e==`string`?deserializeResponse(e):e)}catch(e){a(e)}};let u=document.createElement(`script`),d=(0,o.join)(e.baseUrl,t);d+=d.indexOf(`?`)>=0?`&`:`?`,u.src=d+`jsonp=`+l+`&`+serializeRequest(n,e.encodeRequest),document.body.appendChild(u);let f=setInterval(function(){s<=0?clearInterval(f):(s-=c,s<=0?(clearInterval(f),b.error(`Request timeout: `+u.src),doCallback(),a(Error(`Request timeout: `+u.src))):b.debug(`Request pending (`+s/1e3+` sec): `+u.src))},c);function doCallback(){delete window[l],document.body.removeChild(u)}})}function authHeader(e){return e.userID?{Authorization:`Basic ${(0,o.utf8ToBase64)(`${e.userID}:${e.password}`)}`}:{}}var x={};function doFetch(e,t,n,r,i){r={...authHeader(e),...r},n={credentials:x[e.baseUrl]?`omit`:`include`,...n,headers:r},e.baseUrl.indexOf(`https:`)===0&&(e.rejectUnauthorized===!1&&o.root.__hpcc_rejectUnauthorizedAgent?n.dispatcher=o.root.__hpcc_rejectUnauthorizedAgent:o.root.__hpcc_trustwaveAgent&&(n.agent=o.root.__hpcc_trustwaveAgent));function handleResponse(e){if(e.ok)switch(i){case`json`:return e.json();case`arraybuffer`:return e.arrayBuffer();default:return e.text()}throw Error(e.statusText)}let a=o.root.__hpcc_undiciFetch??fetch;return(0,o.promiseTimeout)(e.timeoutSecs*1e3,a((0,o.join)(e.baseUrl,t),n).then(handleResponse).catch(r=>(n.credentials=x[e.baseUrl]?`include`:`omit`,a((0,o.join)(e.baseUrl,t),n).then(handleResponse).then(t=>(x[e.baseUrl]=!x[e.baseUrl],t)))))}function post(e,t,n,r=`json`,i){n.upload_&&(delete n.upload_,t+=`?upload_`);let a;return n.abortSignal_&&(a=n.abortSignal_,delete n.abortSignal_),doFetch(e,t,{method:`post`,body:serializeRequest(n,e.encodeRequest),signal:a},{"Content-Type":`application/x-www-form-urlencoded`,...i},r)}function get(e,t,n,r=`json`,i){let a;return n.abortSignal_&&(a=n.abortSignal_,delete n.abortSignal_),doFetch(e,`${t}?${serializeRequest(n,e.encodeRequest)}`,{method:`get`,signal:a},{...i},r)}function send(e,t,n,r=`json`,i){let a;switch(e.type){case`jsonp`:a=jsonp(e,t,n,r,i);break;case`get`:a=get(e,t,n,r,i);break;default:a=post(e,t,n,r,i)}return a}var S=send;function hookSend(e){let t=S;return e&&(S=e),t}var C=class Connection{_opts;get baseUrl(){return this._opts.baseUrl}constructor(e){this.opts(e)}opts(e){return arguments.length===0?this._opts:(this._opts={...ee,...e},this)}send(e,t,n=`json`,r){return this._opts.hookSend?this._opts.hookSend(this._opts,e,t,n,S,r):S(this._opts,e,t,n,r)}clone(){return new Connection(this.opts())}},createConnection=function(e){return new C(e)};function setTransportFactory(e){let t=createConnection;return createConnection=e,t}function isArray(e){return Object.prototype.toString.call(e)===`[object Array]`}var ESPExceptions=class extends Error{isESPExceptions=!0;action;request;Source;Exception;constructor(e,t,n){super(`ESPException: `+n.Source),this.action=e,this.request=t,this.Source=n.Source,this.Exception=n.Exception,this.message=n.Exception.length?`${n.Exception[0].Code}: ${n.Exception[0].Message}`:``}};function isExceptions(e){return e instanceof ESPExceptions||e.isESPExceptions&&Array.isArray(e.Exception)}function isConnection(e){return e.send!==void 0}var w=class ESPConnection{_connection;get baseUrl(){return this._connection.opts().baseUrl}_service;_version;constructor(e,t,n){this._connection=isConnection(e)?e:createConnection(e),this._service=t,this._version=n}service(e){return e===void 0?this._service:(this._service=e,this)}version(e){return e===void 0?this._version:(this._version=e,this)}toESPStringArray(e,t){if(isArray(e[t])){for(let n=0;n<e[t].length;++n)e[t+`_i`+n]=e[t][n];delete e[t]}return e}opts(e){return e===void 0?this._connection.opts():(this._connection.opts(e),this)}send(e,t={},n=`json`,r=!1,i,a){let s={...t,ver_:this._version};r&&(s.upload_=!0),i&&(s.abortSignal_=i);let c,l=`json`;switch(n){case`text`:c=(0,o.join)(this._service,e),l=`text`;break;case`arraybuffer`:c=(0,o.join)(this._service,e+`.json`),l=`arraybuffer`;break;case`xsd`:c=(0,o.join)(this._service,e+`.xsd`),l=`text`;break;case`json2`:c=(0,o.join)(this._service,e+`/json`),n=`json`,e=e.split(`/`).pop();break;default:c=(0,o.join)(this._service,e+`.json`)}return this._connection.send(c,s,l).then(t=>{if(n===`json`){let n;if(t&&t.Exceptions)throw new ESPExceptions(e,s,t.Exceptions);if(t&&(n=t[a||e+`Response`]),!n)throw new ESPExceptions(e,s,{Source:`ESPConnection.send`,Exception:[{Code:0,Message:`Missing Response`}]});return n}return t})}clone(){return new ESPConnection(this._connection.clone(),this._service,this._version)}},Service=class{_connection;get baseUrl(){return this._connection.opts().baseUrl}constructor(e,t,n){this._connection=new w(e,t,n)}opts(){return this._connection.opts()}connection(){return this._connection.clone()}},T;(function(e){e.DFUWUActions=function(e){return e.Delete=`Delete`,e.Protect=`Protect`,e.Unprotect=`Unprotect`,e.Restore=`Restore`,e.SetToFailed=`SetToFailed`,e.Archive=`Archive`,e}({}),e.DFUCommand=function(e){return e.copy=`copy`,e.remove=`remove`,e.move=`move`,e.rename=`rename`,e.replicate=`replicate`,e.import=`import`,e.export=`export`,e.monitor=`monitor`,e.copymerge=`copymerge`,e.supercopy=`supercopy`,e.publish=`publish`,e}({})})(T||={});var FileSprayServiceBase=class extends Service{constructor(e){super(e,`FileSpray`,`1.30`)}AbortDFUWorkunit(e,t){return this._connection.send(`AbortDFUWorkunit`,e,`json`,!1,t,`AbortDFUWorkunitResponse`)}Copy(e,t){return this._connection.send(`Copy`,e,`json`,!1,t,`CopyResponse`)}CreateDFUPublisherWorkunit(e,t){return this._connection.send(`CreateDFUPublisherWorkunit`,e,`json`,!1,t,`CreateDFUPublisherWorkunitResponse`)}CreateDFUWorkunit(e,t){return this._connection.send(`CreateDFUWorkunit`,e,`json`,!1,t,`CreateDFUWorkunitResponse`)}DFUWUFile(e,t){return this._connection.send(`DFUWUFile`,e,`json`,!1,t,`DFUWUFileResponse`)}DFUWUSearch(e,t){return this._connection.send(`DFUWUSearch`,e,`json`,!1,t,`DFUWUSearchResponse`)}DFUWorkunitsAction(e,t){return this._connection.send(`DFUWorkunitsAction`,e,`json`,!1,t,`DFUWorkunitsActionResponse`)}DeleteDFUWorkunit(e,t){return this._connection.send(`DeleteDFUWorkunit`,e,`json`,!1,t,`DeleteDFUWorkunitResponse`)}DeleteDFUWorkunits(e,t){return this._connection.send(`DeleteDFUWorkunits`,e,`json`,!1,t,`DeleteDFUWorkunitsResponse`)}DeleteDropZoneFiles(e,t){return this._connection.send(`DeleteDropZoneFiles`,e,`json`,!1,t,`DFUWorkunitsActionResponse`)}Despray(e,t){return this._connection.send(`Despray`,e,`json`,!1,t,`DesprayResponse`)}DfuMonitor(e,t){return this._connection.send(`DfuMonitor`,e,`json`,!1,t,`DfuMonitorResponse`)}DropZoneFileSearch(e,t){return this._connection.send(`DropZoneFileSearch`,e,`json`,!1,t,`DropZoneFileSearchResponse`)}DropZoneFiles(e,t){return this._connection.send(`DropZoneFiles`,e,`json`,!1,t,`DropZoneFilesResponse`)}EchoDateTime(e,t){return this._connection.send(`EchoDateTime`,e,`json`,!1,t,`EchoDateTimeResponse`)}FileList(e,t){return this._connection.send(`FileList`,e,`json`,!1,t,`FileListResponse`)}GetDFUExceptions(e,t){return this._connection.send(`GetDFUExceptions`,e,`json`,!1,t,`GetDFUExceptionsResponse`)}GetDFUProgress(e,t){return this._connection.send(`GetDFUProgress`,e,`json`,!1,t,`ProgressResponse`)}GetDFUServerQueues(e,t){return this._connection.send(`GetDFUServerQueues`,e,`json`,!1,t,`GetDFUServerQueuesResponse`)}GetDFUWorkunit(e,t){return this._connection.send(`GetDFUWorkunit`,e,`json`,!1,t,`GetDFUWorkunitResponse`)}GetDFUWorkunits(e,t){return this._connection.send(`GetDFUWorkunits`,e,`json`,!1,t,`GetDFUWorkunitsResponse`)}GetRemoteTargets(e,t){return this._connection.send(`GetRemoteTargets`,e,`json`,!1,t,`GetRemoteTargetsResponse`)}GetSprayTargets(e,t){return this._connection.send(`GetSprayTargets`,e,`json`,!1,t,`GetSprayTargetsResponse`)}OpenSave(e,t){return this._connection.send(`OpenSave`,e,`json`,!1,t,`OpenSaveResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`FileSprayPingResponse`)}Rename(e,t){return this._connection.send(`Rename`,e,`json`,!1,t,`RenameResponse`)}Replicate(e,t){return this._connection.send(`Replicate`,e,`json`,!1,t,`ReplicateResponse`)}ShowResult(e,t){return this._connection.send(`ShowResult`,e,`json`,!1,t,`ShowResultResponse`)}SprayFixed(e,t){return this._connection.send(`SprayFixed`,e,`json`,!1,t,`SprayFixedResponse`)}SprayVariable(e,t){return this._connection.send(`SprayVariable`,e,`json`,!1,t,`SprayResponse`)}SubmitDFUWorkunit(e,t){return this._connection.send(`SubmitDFUWorkunit`,e,`json`,!1,t,`SubmitDFUWorkunitResponse`)}UpdateDFUWorkunit(e,t){return this._connection.send(`UpdateDFUWorkunit`,e,`json`,!1,t,`UpdateDFUWorkunitResponse`)}},te=function(e){return e[e.unknown=0]=`unknown`,e[e.scheduled=1]=`scheduled`,e[e.queued=2]=`queued`,e[e.started=3]=`started`,e[e.aborted=4]=`aborted`,e[e.failed=5]=`failed`,e[e.finished=6]=`finished`,e[e.monitoring=7]=`monitoring`,e[e.aborting=8]=`aborting`,e[e.notfound=999]=`notfound`,e}({}),FileSprayService=class extends FileSprayServiceBase{DFUWUFileEx(e){return this._connection.send(`DFUWUFile`,e,`text`)}SprayFixedEx(e){return this._connection.send(`SprayFixed`,e)}SprayVariableEx(e){return this._connection.send(`SprayVariable`,e,`json`,!1,null,`SprayResponse`)}DesprayEx(e){return this._connection.send(`Despray`,e)}UpdateDFUWorkunitEx(e){return this._connection.send(`UpdateDFUWorkunit`,e,`json`,!1,void 0,`UpdateDFUWorkunitResponse`)}},ne;(function(e){e.ViewMemberType=function(e){return e.User=`User`,e.Group=`Group`,e}({}),e.UserSortBy=function(e){return e.username=`username`,e.fullname=`fullname`,e.passwordexpiration=`passwordexpiration`,e.employeeID=`employeeID`,e.employeeNumber=`employeeNumber`,e}({}),e.GroupSortBy=function(e){return e.Name=`Name`,e.ManagedBy=`ManagedBy`,e}({}),e.AccountTypeReq=function(e){return e.Any=`Any`,e.User=`User`,e.Group=`Group`,e}({}),e.ResourcePermissionSortBy=function(e){return e.Name=`Name`,e.Type=`Type`,e}({}),e.ResourceSortBy=function(e){return e.Name=`Name`,e}({})})(ne||={});var AccessServiceBase=class extends Service{constructor(e){super(e,`ws_access`,`1.17`)}AccountPermissions(e,t){return this._connection.send(`AccountPermissions`,e,`json`,!1,t,`AccountPermissionsResponse`)}AccountPermissionsV2(e,t){return this._connection.send(`AccountPermissionsV2`,e,`json`,!1,t,`AccountPermissionsV2Response`)}AddUser(e,t){return this._connection.send(`AddUser`,e,`json`,!1,t,`AddUserResponse`)}AddView(e,t){return this._connection.send(`AddView`,e,`json`,!1,t,`AddViewResponse`)}AddViewColumn(e,t){return this._connection.send(`AddViewColumn`,e,`json`,!1,t,`AddViewColumnResponse`)}AddViewMember(e,t){return this._connection.send(`AddViewMember`,e,`json`,!1,t,`AddViewMemberResponse`)}ClearPermissionsCache(e,t){return this._connection.send(`ClearPermissionsCache`,e,`json`,!1,t,`ClearPermissionsCacheResponse`)}DeleteView(e,t){return this._connection.send(`DeleteView`,e,`json`,!1,t,`DeleteViewResponse`)}DeleteViewColumn(e,t){return this._connection.send(`DeleteViewColumn`,e,`json`,!1,t,`DeleteViewColumnResponse`)}DeleteViewMember(e,t){return this._connection.send(`DeleteViewMember`,e,`json`,!1,t,`DeleteViewMemberResponse`)}DisableScopeScans(e,t){return this._connection.send(`DisableScopeScans`,e,`json`,!1,t,`DisableScopeScansResponse`)}EnableScopeScans(e,t){return this._connection.send(`EnableScopeScans`,e,`json`,!1,t,`EnableScopeScansResponse`)}FilePermission(e,t){return this._connection.send(`FilePermission`,e,`json`,!1,t,`FilePermissionResponse`)}GroupAction(e,t){return this._connection.send(`GroupAction`,e,`json`,!1,t,`GroupActionResponse`)}GroupAdd(e,t){return this._connection.send(`GroupAdd`,e,`json`,!1,t,`GroupAddResponse`)}GroupEdit(e,t){return this._connection.send(`GroupEdit`,e,`json`,!1,t,`GroupEditResponse`)}GroupMemberEdit(e,t){return this._connection.send(`GroupMemberEdit`,e,`json`,!1,t,`GroupMemberEditResponse`)}GroupMemberEditInput(e,t){return this._connection.send(`GroupMemberEditInput`,e,`json`,!1,t,`GroupMemberEditInputResponse`)}GroupMemberQuery(e,t){return this._connection.send(`GroupMemberQuery`,e,`json`,!1,t,`GroupMemberQueryResponse`)}GroupQuery(e,t){return this._connection.send(`GroupQuery`,e,`json`,!1,t,`GroupQueryResponse`)}Groups(e,t){return this._connection.send(`Groups`,e,`json`,!1,t,`GroupResponse`)}PermissionAction(e,t){return this._connection.send(`PermissionAction`,e,`json`,!1,t,`PermissionActionResponse`)}Permissions(e,t){return this._connection.send(`Permissions`,e,`json`,!1,t,`BasednsResponse`)}PermissionsReset(e,t){return this._connection.send(`PermissionsReset`,e,`json`,!1,t,`PermissionsResetResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`ws_accessPingResponse`)}QueryScopeScansEnabled(e,t){return this._connection.send(`QueryScopeScansEnabled`,e,`json`,!1,t,`QueryScopeScansEnabledResponse`)}QueryUserViewColumns(e,t){return this._connection.send(`QueryUserViewColumns`,e,`json`,!1,t,`QueryUserViewColumnsResponse`)}QueryViewColumns(e,t){return this._connection.send(`QueryViewColumns`,e,`json`,!1,t,`QueryViewColumnsResponse`)}QueryViewMembers(e,t){return this._connection.send(`QueryViewMembers`,e,`json`,!1,t,`QueryViewMembersResponse`)}QueryViews(e,t){return this._connection.send(`QueryViews`,e,`json`,!1,t,`QueryViewsResponse`)}ResourceAdd(e,t){return this._connection.send(`ResourceAdd`,e,`json`,!1,t,`ResourceAddResponse`)}ResourceDelete(e,t){return this._connection.send(`ResourceDelete`,e,`json`,!1,t,`ResourceDeleteResponse`)}ResourcePermissionQuery(e,t){return this._connection.send(`ResourcePermissionQuery`,e,`json`,!1,t,`ResourcePermissionQueryResponse`)}ResourcePermissions(e,t){return this._connection.send(`ResourcePermissions`,e,`json`,!1,t,`ResourcePermissionsResponse`)}ResourceQuery(e,t){return this._connection.send(`ResourceQuery`,e,`json`,!1,t,`ResourceQueryResponse`)}Resources(e,t){return this._connection.send(`Resources`,e,`json`,!1,t,`ResourcesResponse`)}UserAccountExport(e,t){return this._connection.send(`UserAccountExport`,e,`json`,!1,t,`UserAccountExportResponse`)}UserAction(e,t){return this._connection.send(`UserAction`,e,`json`,!1,t,`UserActionResponse`)}UserEdit(e,t){return this._connection.send(`UserEdit`,e,`json`,!1,t,`UserEditResponse`)}UserGroupEdit(e,t){return this._connection.send(`UserGroupEdit`,e,`json`,!1,t,`UserGroupEditResponse`)}UserGroupEditInput(e,t){return this._connection.send(`UserGroupEditInput`,e,`json`,!1,t,`UserGroupEditInputResponse`)}UserInfoEdit(e,t){return this._connection.send(`UserInfoEdit`,e,`json`,!1,t,`UserInfoEditResponse`)}UserInfoEditInput(e,t){return this._connection.send(`UserInfoEditInput`,e,`json`,!1,t,`UserInfoEditInputResponse`)}UserPosix(e,t){return this._connection.send(`UserPosix`,e,`json`,!1,t,`UserPosixResponse`)}UserPosixInput(e,t){return this._connection.send(`UserPosixInput`,e,`json`,!1,t,`UserPosixInputResponse`)}UserQuery(e,t){return this._connection.send(`UserQuery`,e,`json`,!1,t,`UserQueryResponse`)}UserResetPass(e,t){return this._connection.send(`UserResetPass`,e,`json`,!1,t,`UserResetPassResponse`)}UserResetPassInput(e,t){return this._connection.send(`UserResetPassInput`,e,`json`,!1,t,`UserResetPassInputResponse`)}UserSudoers(e,t){return this._connection.send(`UserSudoers`,e,`json`,!1,t,`UserSudoersResponse`)}UserSudoersInput(e,t){return this._connection.send(`UserSudoersInput`,e,`json`,!1,t,`UserSudoersInputResponse`)}Users(e,t){return this._connection.send(`Users`,e,`json`,!1,t,`UserResponse`)}},AccessService=class extends AccessServiceBase{},AccountServiceBase=class extends Service{constructor(e){super(e,`ws_account`,`1.07`)}MyAccount(e,t){return this._connection.send(`MyAccount`,e,`json`,!1,t,`MyAccountResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`ws_accountPingResponse`)}UpdateUser(e,t){return this._connection.send(`UpdateUser`,e,`json`,!1,t,`UpdateUserResponse`)}UpdateUserInput(e,t){return this._connection.send(`UpdateUserInput`,e,`json`,!1,t,`UpdateUserInputResponse`)}VerifyUser(e,t){return this._connection.send(`VerifyUser`,e,`json`,!1,t,`VerifyUserResponse`)}},AccountService=class extends AccountServiceBase{VerifyUser(e){return this._connection.send(`VerifyUser`,e).catch(e=>{if(e.isESPExceptions&&e.Exception.some(e=>e.Code===20043))return{retcode:20043,Exceptions:{Source:`wsAccount`,Exception:e.Exception}};throw e})}},CloudServiceBase=class extends Service{constructor(e){super(e,`WsCloud`,`1.02`)}GetPODs(e,t){return this._connection.send(`GetPODs`,e,`json`,!1,t,`GetPODsResponse`)}GetServices(e,t){return this._connection.send(`GetServices`,e,`json`,!1,t,`GetServicesResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`WsCloudPingResponse`)}},re=(0,o.scopedLogger)(`@hpcc-js/comms/services/wsCloud.ts`);function isGetPODsResponse_v1_02(e){return e?.Pods!==void 0}function mapPorts(e){return e.spec?.containers?.reduce((e,t)=>(t.ports?.forEach(t=>{e.push({ContainerPort:t.containerPort,Name:t.name,Protocol:t.protocol})}),e),[])??[]}function mapPods(e){return e.filter(e=>{let t=e?.metadata?.labels??{};return t.hasOwnProperty(`app.kubernetes.io/part-of`)&&t[`app.kubernetes.io/part-of`]===`HPCC-Platform`}).map(e=>{let t=new Date(e.metadata?.creationTimestamp);return{Name:e.metadata.name,Status:e.status?.phase,CreationTimestamp:t.toISOString(),ContainerName:e.status?.containerStatuses?.reduce((e,t)=>(t.name&&e.push(t.name),e),[]).join(`, `)??``,ContainerCount:e.spec?.containers?.length??0,ContainerReadyCount:e.status?.containerStatuses?.reduce((e,t)=>e+ +!!t.ready,0),ContainerRestartCount:e.status?.containerStatuses?.reduce((e,t)=>e+t.restartCount,0),Ports:{Port:mapPorts(e)}}})}var CloudService=class extends CloudServiceBase{getPODs(){return super.GetPODs({}).then(e=>{if(isGetPODsResponse_v1_02(e))return e.Pods?.Pod??[];try{return mapPods((typeof e.Result==`string`?JSON.parse(e.Result):e.Result)?.items??[])}catch(e){let t=e instanceof Error?e.message:String(e),n=Object.assign(Error(`Error parsing V1Pods json '${t}'`),{cause:e});throw re.error(n.message),n}})}},ie;(function(e){e.SigningMethodType=function(e){return e.gpg=`gpg`,e}({})})(ie||={});var CodesignServiceBase=class extends Service{constructor(e){super(e,`ws_codesign`,`1.1`)}ListUserIDs(e,t){return this._connection.send(`ListUserIDs`,e,`json`,!1,t,`ListUserIDsResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`ws_codesignPingResponse`)}Sign(e,t){return this._connection.send(`Sign`,e,`json`,!1,t,`SignResponse`)}Verify(e,t){return this._connection.send(`Verify`,e,`json`,!1,t,`VerifyResponse`)}},CodesignService=class extends CodesignServiceBase{ListUserIDsEx(e){return super.ListUserIDs(e).then(e=>e.UserIDs.Item).catch(e=>[])}Sign(e){return super.Sign({SigningMethod:ie.SigningMethodType.gpg,...e})}},DaliServiceBase=class extends Service{constructor(e){super(e,`WSDali`,`1.07`)}Add(e,t){return this._connection.send(`Add`,e,`json`,!1,t,`ResultResponse`)}ClearTraceTransactions(e,t){return this._connection.send(`ClearTraceTransactions`,e,`json`,!1,t,`ResultResponse`)}Count(e,t){return this._connection.send(`Count`,e,`json`,!1,t,`CountResponse`)}DFSCheck(e,t){return this._connection.send(`DFSCheck`,e,`json`,!1,t,`ResultResponse`)}DFSExists(e,t){return this._connection.send(`DFSExists`,e,`json`,!1,t,`BooleanResponse`)}DFSLS(e,t){return this._connection.send(`DFSLS`,e,`json`,!1,t,`ResultResponse`)}Delete(e,t){return this._connection.send(`Delete`,e,`json`,!1,t,`ResultResponse`)}DisconnectClientConnection(e,t){return this._connection.send(`DisconnectClientConnection`,e,`json`,!1,t,`ResultResponse`)}GetClients(e,t){return this._connection.send(`GetClients`,e,`json`,!1,t,`ResultResponse`)}GetConnections(e,t){return this._connection.send(`GetConnections`,e,`json`,!1,t,`ResultResponse`)}GetDFSCSV(e,t){return this._connection.send(`GetDFSCSV`,e,`json`,!1,t,`ResultResponse`)}GetDFSMap(e,t){return this._connection.send(`GetDFSMap`,e,`json`,!1,t,`ResultResponse`)}GetDFSParents(e,t){return this._connection.send(`GetDFSParents`,e,`json`,!1,t,`ResultResponse`)}GetLogicalFile(e,t){return this._connection.send(`GetLogicalFile`,e,`json`,!1,t,`ResultResponse`)}GetLogicalFilePart(e,t){return this._connection.send(`GetLogicalFilePart`,e,`json`,!1,t,`ResultResponse`)}GetProtectedList(e,t){return this._connection.send(`GetProtectedList`,e,`json`,!1,t,`ResultResponse`)}GetSDSStats(e,t){return this._connection.send(`GetSDSStats`,e,`json`,!1,t,`ResultResponse`)}GetSDSSubscribers(e,t){return this._connection.send(`GetSDSSubscribers`,e,`json`,!1,t,`ResultResponse`)}GetValue(e,t){return this._connection.send(`GetValue`,e,`json`,!1,t,`ResultResponse`)}Import(e,t){return this._connection.send(`Import`,e,`json`,!1,t,`ResultResponse`)}ListSDSLocks(e,t){return this._connection.send(`ListSDSLocks`,e,`json`,!1,t,`ResultResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`WSDaliPingResponse`)}SaveSDSStore(e,t){return this._connection.send(`SaveSDSStore`,e,`json`,!1,t,`ResultResponse`)}SetLogicalFilePartAttr(e,t){return this._connection.send(`SetLogicalFilePartAttr`,e,`json`,!1,t,`ResultResponse`)}SetProtected(e,t){return this._connection.send(`SetProtected`,e,`json`,!1,t,`ResultResponse`)}SetTraceSlowTransactions(e,t){return this._connection.send(`SetTraceSlowTransactions`,e,`json`,!1,t,`ResultResponse`)}SetTraceTransactions(e,t){return this._connection.send(`SetTraceTransactions`,e,`json`,!1,t,`ResultResponse`)}SetUnprotected(e,t){return this._connection.send(`SetUnprotected`,e,`json`,!1,t,`ResultResponse`)}SetValue(e,t){return this._connection.send(`SetValue`,e,`json`,!1,t,`ResultResponse`)}UnlockSDSLock(e,t){return this._connection.send(`UnlockSDSLock`,e,`json`,!1,t,`ResultResponse`)}},DaliService=class extends DaliServiceBase{},E;(function(e){e.DFUArrayActions=function(e){return e.Delete=`Delete`,e.AddToSuperfile=`Add To Superfile`,e.ChangeProtection=`Change Protection`,e.ChangeRestriction=`Change Restriction`,e}({}),e.DFUChangeProtection=function(e){return e[e.NoChange=0]=`NoChange`,e[e.Protect=1]=`Protect`,e[e.Unprotect=2]=`Unprotect`,e[e.UnprotectAll=3]=`UnprotectAll`,e}({}),e.DFUChangeRestriction=function(e){return e[e.NoChange=0]=`NoChange`,e[e.Restrict=1]=`Restrict`,e[e.Unrestricted=2]=`Unrestricted`,e}({}),e.DFUDefFileFormat=function(e){return e.xml=`xml`,e.def=`def`,e}({}),e.FileAccessRole=function(e){return e.Token=`Token`,e.Engine=`Engine`,e.External=`External`,e}({}),e.SecAccessType=function(e){return e.None=`None`,e.Access=`Access`,e.Read=`Read`,e.Write=`Write`,e.Full=`Full`,e}({}),e.DFUFileType=function(e){return e.Flat=`Flat`,e.Index=`Index`,e.Xml=`Xml`,e.Csv=`Csv`,e.Json=`Json`,e.IndexLocal=`IndexLocal`,e.IndexPartitioned=`IndexPartitioned`,e.Unset=`Unset`,e}({})})(E||={});var DfuServiceBase=class extends Service{constructor(e){super(e,`WsDfu`,`1.68`)}Add(e,t){return this._connection.send(`Add`,e,`json`,!1,t,`AddResponse`)}AddRemote(e,t){return this._connection.send(`AddRemote`,e,`json`,!1,t,`AddRemoteResponse`)}AddtoSuperfile(e,t){return this._connection.send(`AddtoSuperfile`,e,`json`,!1,t,`AddtoSuperfileResponse`)}DFUArrayAction(e,t){return this._connection.send(`DFUArrayAction`,e,`json`,!1,t,`DFUArrayActionResponse`)}DFUBrowseData(e,t){return this._connection.send(`DFUBrowseData`,e,`json`,!1,t,`DFUBrowseDataResponse`)}DFUDefFile(e,t){return this._connection.send(`DFUDefFile`,e,`json`,!1,t,`DFUDefFileResponse`)}DFUFileAccess(e,t){return this._connection.send(`DFUFileAccess`,e,`json`,!1,t,`DFUFileAccessResponse`)}DFUFileAccessV2(e,t){return this._connection.send(`DFUFileAccessV2`,e,`json`,!1,t,`DFUFileAccessResponse`)}DFUFileCreate(e,t){return this._connection.send(`DFUFileCreate`,e,`json`,!1,t,`DFUFileCreateResponse`)}DFUFileCreateV2(e,t){return this._connection.send(`DFUFileCreateV2`,e,`json`,!1,t,`DFUFileCreateResponse`)}DFUFilePublish(e,t){return this._connection.send(`DFUFilePublish`,e,`json`,!1,t,`DFUFilePublishResponse`)}DFUFileRename(e,t){return this._connection.send(`DFUFileRename`,e,`json`,!1,t,`DFUFileRenameResponse`)}DFUFileView(e,t){return this._connection.send(`DFUFileView`,e,`json`,!1,t,`DFUFileViewResponse`)}DFUGetDataColumns(e,t){return this._connection.send(`DFUGetDataColumns`,e,`json`,!1,t,`DFUGetDataColumnsResponse`)}DFUGetFileMetaData(e,t){return this._connection.send(`DFUGetFileMetaData`,e,`json`,!1,t,`DFUGetFileMetaDataResponse`)}DFUGetMetaInquiry(e,t){return this._connection.send(`DFUGetMetaInquiry`,e,`json`,!1,t,`DFUMetaInquiryResponse`)}DFUInfo(e,t){return this._connection.send(`DFUInfo`,e,`json`,!1,t,`DFUInfoResponse`)}DFUQuery(e,t){return this._connection.send(`DFUQuery`,e,`json`,!1,t,`DFUQueryResponse`)}DFURecordTypeInfo(e,t){return this._connection.send(`DFURecordTypeInfo`,e,`json`,!1,t,`DFURecordTypeInfoResponse`)}DFUSearch(e,t){return this._connection.send(`DFUSearch`,e,`json`,!1,t,`DFUSearchResponse`)}DFUSearchData(e,t){return this._connection.send(`DFUSearchData`,e,`json`,!1,t,`DFUSearchDataResponse`)}DFUSpace(e,t){return this._connection.send(`DFUSpace`,e,`json`,!1,t,`DFUSpaceResponse`)}EclRecordTypeInfo(e,t){return this._connection.send(`EclRecordTypeInfo`,e,`json`,!1,t,`EclRecordTypeInfoResponse`)}EraseHistory(e,t){return this._connection.send(`EraseHistory`,e,`json`,!1,t,`EraseHistoryResponse`)}ListHistory(e,t){return this._connection.send(`ListHistory`,e,`json`,!1,t,`ListHistoryResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`WsDfuPingResponse`)}Savexml(e,t){return this._connection.send(`Savexml`,e,`json`,!1,t,`SavexmlResponse`)}SuperfileAction(e,t){return this._connection.send(`SuperfileAction`,e,`json`,!1,t,`SuperfileActionResponse`)}SuperfileList(e,t){return this._connection.send(`SuperfileList`,e,`json`,!1,t,`SuperfileListResponse`)}},ae=E.DFUArrayActions,oe=E.DFUDefFileFormat,se=E.DFUChangeProtection,ce=E.DFUChangeRestriction,DFUService=class extends DfuServiceBase{DFUFile(e){return this._connection.send(`DFUDefFile`,e,`text`)}async recursiveFetchLogicalFiles(e){let t=[],n=[];return await Promise.all(e.map(e=>this.DFUInfo({Cluster:e.NodeGroup,Name:e.Name,IncludeJsonTypeInfo:!1,IncludeBinTypeInfo:!1,ForceIndexInfo:!1}).then(e=>{for(let n of e?.FileDetail?.Superfiles?.DFULogicalFile??[])t.push(n);for(let t of e?.FileDetail?.subfiles?.Item??[])n.push(t)}))),n.concat(t.length?await this.recursiveFetchLogicalFiles(t):[])}},DFUXRefServiceBase=class extends Service{constructor(e){super(e,`WsDFUXRef`,`1.04`)}DFUXRefArrayAction(e,t){return this._connection.send(`DFUXRefArrayAction`,e,`json`,!1,t,`DFUXRefArrayActionResponse`)}DFUXRefBuild(e,t){return this._connection.send(`DFUXRefBuild`,e,`json`,!1,t,`DFUXRefBuildResponse`)}DFUXRefBuildCancel(e,t){return this._connection.send(`DFUXRefBuildCancel`,e,`json`,!1,t,`DFUXRefBuildCancelResponse`)}DFUXRefCleanDirectories(e,t){return this._connection.send(`DFUXRefCleanDirectories`,e,`json`,!1,t,`DFUXRefCleanDirectoriesResponse`)}DFUXRefDirectories(e,t){return this._connection.send(`DFUXRefDirectories`,e,`json`,!1,t,`DFUXRefDirectoriesQueryResponse`)}DFUXRefFoundFiles(e,t){return this._connection.send(`DFUXRefFoundFiles`,e,`json`,!1,t,`DFUXRefFoundFilesQueryResponse`)}DFUXRefList(e,t){return this._connection.send(`DFUXRefList`,e,`json`,!1,t,`DFUXRefListResponse`)}DFUXRefLostFiles(e,t){return this._connection.send(`DFUXRefLostFiles`,e,`json`,!1,t,`DFUXRefLostFilesQueryResponse`)}DFUXRefMessages(e,t){return this._connection.send(`DFUXRefMessages`,e,`json`,!1,t,`DFUXRefMessagesQueryResponse`)}DFUXRefOrphanFiles(e,t){return this._connection.send(`DFUXRefOrphanFiles`,e,`json`,!1,t,`DFUXRefOrphanFilesQueryResponse`)}DFUXRefUnusedFiles(e,t){return this._connection.send(`DFUXRefUnusedFiles`,e,`json`,!1,t,`DFUXRefUnusedFilesResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`WsDFUXRefPingResponse`)}},DFUXRefService=class extends DFUXRefServiceBase{DFUXRefDirectoriesEx(e){return this._connection.send(`DFUXRefDirectories`,e,`json`,!1,void 0,`DFUXRefDirectoriesQueryResponse`)}DFUXRefListEx(e){return this._connection.send(`DFUXRefList`,e,`json`,!1,void 0,`DFUXRefListResponse`)}};function jsonToIField(e,t){let n=typeof t;switch(n){case`boolean`:case`number`:case`string`:return{id:e,type:n};case`object`:if(t.Row instanceof Array&&(t=t.Row),t instanceof Array)return{id:e,type:`dataset`,children:jsonToIFieldArr(t[0])};if(t instanceof Object){if(t.Item&&t.Item instanceof Array&&t.Item.length===1){let n=typeof t.Item[0];if(n===`string`||n===`number`)return{id:e,type:`set`,fieldType:n};throw Error(`Unknown field type`)}return{id:e,type:`object`,fields:jsonToIFieldObj(t)}}default:throw Error(`Unknown field type`)}}function jsonToIFieldArr(e){e.Row&&e.Row instanceof Array&&(e=e.Row[0]);let t=[];for(let n in e)t.push(jsonToIField(n,e[n]));return t}function jsonToIFieldObj(e){let t={};for(let n in e)t[n]=jsonToIField(n,e[n]);return t}var EclService=class extends Service{constructor(e){super(e,`WsEcl`,`0`)}opts(){return this._connection.opts()}requestJson(e,t){return this._connection.send(`example/request/query/${e}/${t}/json`,{},`text`).then(e=>{let t;try{t=JSON.parse(e)}catch(e){let t=e instanceof Error?e.message:String(e);throw Object.assign(Error(`Error parsing WsEcl request JSON '${t}'`),{cause:e})}for(let e in t)return t[e];return{}}).then(jsonToIFieldArr)}responseJson(e,t){return this._connection.send(`example/response/query/${e}/${t}/json`,{},`text`).then(e=>{let t;try{t=JSON.parse(e)}catch(e){let t=e instanceof Error?e.message:String(e);throw Object.assign(Error(`Error parsing WsEcl response JSON '${t}'`),{cause:e})}for(let e in t)return t[e].Results;return{}}).then(e=>{let t={};for(let n in e)t[n]=jsonToIFieldArr(e[n]);return t})}submit(e,t,n){let r=`submit/query/${e}/${t}`;return this._connection.send(r,n,`json2`).then(e=>{if(e.Results&&e.Results.Exception)throw new ESPExceptions(r,n,{Source:`wsEcl.submit`,Exception:e.Results.Exception});return e.Results})}},ElkServiceBase=class extends Service{constructor(e){super(e,`ws_elk`,`1`)}GetConfigDetails(e,t){return this._connection.send(`GetConfigDetails`,e,`json`,!1,t,`GetConfigDetailsResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`ws_elkPingResponse`)}},ElkService=class extends ElkServiceBase{},D;(function(e){e.LogColumnType=function(e){return e.global=`global`,e.workunits=`workunits`,e.components=`components`,e.audience=`audience`,e.class=`class`,e.instance=`instance`,e.node=`node`,e.message=`message`,e.logid=`logid`,e.processid=`processid`,e.threadid=`threadid`,e.timestamp=`timestamp`,e.pod=`pod`,e.traceid=`traceid`,e.spanid=`spanid`,e}({}),e.LogColumnValueType=function(e){return e.string=`string`,e.numeric=`numeric`,e.datetime=`datetime`,e.enum=`enum`,e.epoch=`epoch`,e}({}),e.LogAccessType=function(e){return e[e.All=0]=`All`,e[e.ByJobID=1]=`ByJobID`,e[e.ByComponent=2]=`ByComponent`,e[e.ByLogType=3]=`ByLogType`,e[e.ByTargetAudience=4]=`ByTargetAudience`,e[e.BySourceInstance=5]=`BySourceInstance`,e[e.BySourceNode=6]=`BySourceNode`,e[e.ByFieldName=7]=`ByFieldName`,e[e.ByPod=8]=`ByPod`,e[e.ByTraceID=9]=`ByTraceID`,e[e.BySpanID=10]=`BySpanID`,e}({}),e.LogAccessStatusCode=function(e){return e[e.Success=0]=`Success`,e[e.Warning=1]=`Warning`,e[e.Fail=2]=`Fail`,e}({}),e.LogAccessFilterOperator=function(e){return e[e.NONE=0]=`NONE`,e[e.AND=1]=`AND`,e[e.OR=2]=`OR`,e}({}),e.LogSelectColumnMode=function(e){return e[e.MIN=0]=`MIN`,e[e.DEFAULT=1]=`DEFAULT`,e[e.ALL=2]=`ALL`,e[e.CUSTOM=3]=`CUSTOM`,e}({}),e.SortColumType=function(e){return e[e.ByDate=0]=`ByDate`,e[e.ByJobID=1]=`ByJobID`,e[e.ByComponent=2]=`ByComponent`,e[e.ByLogType=3]=`ByLogType`,e[e.ByTargetAudience=4]=`ByTargetAudience`,e[e.BySourceInstance=5]=`BySourceInstance`,e[e.BySourceNode=6]=`BySourceNode`,e[e.ByFieldName=7]=`ByFieldName`,e[e.ByPod=8]=`ByPod`,e[e.ByTraceID=9]=`ByTraceID`,e[e.BySpanID=10]=`BySpanID`,e}({}),e.SortDirection=function(e){return e[e.ASC=0]=`ASC`,e[e.DSC=1]=`DSC`,e}({})})(D||={});var LogaccessServiceBase=class extends Service{constructor(e){super(e,`ws_logaccess`,`1.08`)}GetHealthReport(e){return this._connection.send(`GetHealthReport`,e,`json`,!1,void 0,`GetHealthReportResponse`)}GetLogAccessInfo(e){return this._connection.send(`GetLogAccessInfo`,e,`json`,!1,void 0,`GetLogAccessInfoResponse`)}GetLogs(e){return this._connection.send(`GetLogs`,e,`json`,!1,void 0,`GetLogsResponse`)}Ping(e){return this._connection.send(`Ping`,e,`json`,!1,void 0,`ws_logaccessPingResponse`)}},le=(0,o.scopedLogger)(`@hpcc-js/comms/services/wsLogaccess.ts`),ue=function(e){return e.Disaster=`DIS`,e.Error=`ERR`,e.Warning=`WRN`,e.Information=`INF`,e.Progress=`PRO`,e.Metric=`MET`,e}({}),de=function(e){return e.Operator=`OPR`,e.User=`USR`,e.Programmer=`PRO`,e.Audit=`ADT`,e}({}),fe=new Set([`azureloganalyticscurl`,`elasticstack`,`grafanacurl`]),pe=new Set(Object.values(D.LogColumnType));function getLogCategory(e){switch(e){case D.LogColumnType.workunits:case`hpcc.log.jobid`:return D.LogAccessType.ByJobID;case D.LogColumnType.audience:case`hpcc.log.audience`:return D.LogAccessType.ByTargetAudience;case D.LogColumnType.class:case`hpcc.log.class`:return D.LogAccessType.ByLogType;case D.LogColumnType.components:case`kubernetes.container.name`:return D.LogAccessType.ByComponent;default:return D.LogAccessType.ByFieldName}}var me=[`audience`,`class`,`workunits`,`message`,`processid`,`logid`,`threadid`,`timestamp`,`components`,`instance`];function buildFilters(e,t){let n=[];for(let r of me){let i=e[r];if(i==null||i===``||Array.isArray(i)&&i.length===0||!(r in t))continue;let a=pe.has(r)?r:t[r],o=getLogCategory(a);o===D.LogAccessType.ByFieldName&&(a=t[r]);let s=o===D.LogAccessType.ByComponent,c=Array.isArray(i)?i:[i];for(let e of c)n.push({LogCategory:o,SearchField:a,SearchByValue:s?e+`*`:e})}return n}function buildOrGroup(e){let t={leftFilter:e[0]},n=t;for(let t=1;t<e.length;t++)n.Operator=D.LogAccessFilterOperator.OR,t===e.length-1?n.rightFilter=e[t]:(n.rightBinaryFilter={BinaryLogFilter:[{leftFilter:e[t]}]},n=n.rightBinaryFilter.BinaryLogFilter[0]);return t}function buildAndChain(e){let[t,...n]=e,r={};if(t.length===1?r.leftFilter=t[0]:r.leftBinaryFilter={BinaryLogFilter:[buildOrGroup(t)]},n.length===0)return r;if(r.Operator=D.LogAccessFilterOperator.AND,n.length===1){let[e]=n;e.length===1?r.rightFilter=e[0]:r.rightBinaryFilter={BinaryLogFilter:[buildOrGroup(e)]}}else r.rightBinaryFilter={BinaryLogFilter:[buildAndChain(n)]};return r}function buildFilterTree(e){let t=new Map;for(let n of e){let e=t.get(n.SearchField);e?e.push(n):t.set(n.SearchField,[n])}let n=[...t.values()];if(n.length===0)return{leftFilter:{LogCategory:D.LogAccessType.All}};let[r,...i]=n,a={};if(r.length===1?a.leftFilter=r[0]:a.leftBinaryFilter={BinaryLogFilter:[buildOrGroup(r)]},i.length===0)return a;if(a.Operator=D.LogAccessFilterOperator.AND,i.length===1){let[e]=i;e.length===1?a.rightFilter=e[0]:a.rightBinaryFilter={BinaryLogFilter:[buildOrGroup(e)]}}else a.rightBinaryFilter={BinaryLogFilter:[buildAndChain(i)]};return a}var LogaccessService=class extends LogaccessServiceBase{_logAccessInfo;GetLogAccessInfo(e={}){return this._logAccessInfo||=super.GetLogAccessInfo(e),this._logAccessInfo}GetLogs(e){return super.GetLogs(e)}convertLogLine(e,t){let n={},r=t?.fields?Object.assign({},...t.fields):null;for(let t in e)n[t]=r?r[e[t]]??``:``;return n}async GetLogsEx(e){let t=await this.GetLogAccessInfo(),n={};t.Columns.Column.forEach(e=>n[e.LogType]=e.Name);let r=buildFilters(e,n),i={StartDate:e.StartDate instanceof Date?e.StartDate.toISOString():new Date(0).toISOString()};e.EndDate instanceof Date&&(i.EndDate=e.EndDate.toISOString());let a={Filter:buildFilterTree(r),Range:i,LogLineStartFrom:e.LogLineStartFrom??0,LogLineLimit:e.LogLineLimit??100,SelectColumnMode:D.LogSelectColumnMode.DEFAULT,Format:`JSON`,SortBy:{SortCondition:[{BySortType:D.SortColumType.ByDate,ColumnName:``,Direction:0}]}};return this.GetLogs(a).then(e=>{let r;try{r=JSON.parse(e.LogLines)}catch(e){let t=e instanceof Error?e.message:String(e),n=Object.assign(Error(`Error parsing log lines json '${t}'`),{cause:e});throw le.error(n.message),n}return{lines:fe.has(t.RemoteLogManagerType)?r.lines?.map(e=>this.convertLogLine(n,e))??[]:(le.warning(`Unknown RemoteLogManagerType: ${t.RemoteLogManagerType}`),[]),total:e.TotalLogLinesAvailable??1e4}})}};function max(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n<t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function mean(e,t){let n=0,r=0;if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(++n,r+=t);else{let i=-1;for(let a of e)(a=t(a,++i,e))!=null&&(a=+a)>=a&&(++n,r+=a)}if(n)return r/n}var he;(function(e){e.ThresholdType=function(e){return e[e.THRESHOLD_PERCENTAGE=0]=`THRESHOLD_PERCENTAGE`,e[e.THRESHOLD_MB=1]=`THRESHOLD_MB`,e}({}),e.TpMachineType=function(e){return e.ALLNODES=`ALLNODES`,e.THORMACHINES=`THORMACHINES`,e.HOLEMACHINES=`HOLEMACHINES`,e.ROXIEMACHINES=`ROXIEMACHINES`,e.MACHINES=`MACHINES`,e.AVAILABLEMACHINES=`AVAILABLEMACHINES`,e.DROPZONE=`DROPZONE`,e.STANDBYNNODE=`STANDBYNNODE`,e.THORSPARENODES=`THORSPARENODES`,e.HOLESTANDBYNODES=`HOLESTANDBYNODES`,e}({})})(he||={});var MachineServiceBase=class extends Service{constructor(e){super(e,`ws_machine`,`1.19`)}GetComponentStatus(e,t){return this._connection.send(`GetComponentStatus`,e,`json`,!1,t,`GetComponentStatusResponse`)}GetComponentUsage(e,t){return this._connection.send(`GetComponentUsage`,e,`json`,!1,t,`GetComponentUsageResponse`)}GetMachineInfo(e,t){return this._connection.send(`GetMachineInfo`,e,`json`,!1,t,`GetMachineInfoResponse`)}GetMachineInfoEx(e,t){return this._connection.send(`GetMachineInfoEx`,e,`json`,!1,t,`GetMachineInfoResponseEx`)}GetMetrics(e,t){return this._connection.send(`GetMetrics`,e,`json`,!1,t,`MetricsResponse`)}GetNodeGroupUsage(e,t){return this._connection.send(`GetNodeGroupUsage`,e,`json`,!1,t,`GetNodeGroupUsageResponse`)}GetTargetClusterInfo(e,t){return this._connection.send(`GetTargetClusterInfo`,e,`json`,!1,t,`GetTargetClusterInfoResponse`)}GetTargetClusterUsage(e,t){return this._connection.send(`GetTargetClusterUsage`,e,`json`,!1,t,`GetTargetClusterUsageResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`ws_machinePingResponse`)}UpdateComponentStatus(e,t){return this._connection.send(`UpdateComponentStatus`,e,`json`,!1,t,`UpdateComponentStatusResponse`)}},MachineService=class extends MachineServiceBase{GetTargetClusterUsageEx(e,t=!1){return this._connection.send(`GetTargetClusterUsage`,{TargetClusters:e?{Item:e}:{},BypassCachedResult:t}).then(e=>(0,o.exists)(`TargetClusterUsages.TargetClusterUsage`,e)?e.TargetClusterUsages.TargetClusterUsage:[]).then(e=>e.filter(e=>!!e.ComponentUsages).map(e=>{let t=e.ComponentUsages.ComponentUsage.map(e=>{let t=(e.MachineUsages&&e.MachineUsages.MachineUsage?e.MachineUsages.MachineUsage:[]).map(e=>{let t=e.DiskUsages&&e.DiskUsages.DiskUsage?e.DiskUsages.DiskUsage.map(e=>({...e,InUse:e.InUse*1024,Total:(e.InUse+e.Available)*1024,PercentUsed:100-e.PercentAvailable})):[];return{Name:e.Name,NetAddress:e.NetAddress,Description:e.Description,DiskUsages:t,mean:mean(t.filter(e=>!isNaN(e.PercentUsed)),e=>e.PercentUsed),max:max(t.filter(e=>!isNaN(e.PercentUsed)),e=>e.PercentUsed)}});return{Type:e.Type,Name:e.Name,Description:e.Description,MachineUsages:t,MachineUsagesDescription:t.reduce((e,t)=>e+(t.Description||``),``),mean:mean(t.filter(e=>!isNaN(e.mean)),e=>e.mean),max:max(t.filter(e=>!isNaN(e.max)),e=>e.max)}});return{Name:e.Name,Description:e.Description,ComponentUsages:t,ComponentUsagesDescription:t.reduce((e,t)=>e+(t.MachineUsagesDescription||``),``),mean:mean(t.filter(e=>!isNaN(e.mean)),e=>e.mean),max:max(t.filter(e=>!isNaN(e.max)),e=>e.max)}}))}},PackageProcessServiceBase=class extends Service{constructor(e){super(e,`WsPackageProcess`,`1.08`)}ActivatePackage(e,t){return this._connection.send(`ActivatePackage`,e,`json`,!1,t,`ActivatePackageResponse`)}AddPackage(e,t){return this._connection.send(`AddPackage`,e,`json`,!1,t,`AddPackageResponse`)}AddPartToPackageMap(e,t){return this._connection.send(`AddPartToPackageMap`,e,`json`,!1,t,`AddPartToPackageMapResponse`)}CopyPackageMap(e,t){return this._connection.send(`CopyPackageMap`,e,`json`,!1,t,`CopyPackageMapResponse`)}DeActivatePackage(e,t){return this._connection.send(`DeActivatePackage`,e,`json`,!1,t,`DeActivatePackageResponse`)}DeletePackage(e,t){return this._connection.send(`DeletePackage`,e,`json`,!1,t,`DeletePackageResponse`)}Echo(e,t){return this._connection.send(`Echo`,e,`json`,!1,t,`EchoResponse`)}GetPackage(e,t){return this._connection.send(`GetPackage`,e,`json`,!1,t,`GetPackageResponse`)}GetPackageMapById(e,t){return this._connection.send(`GetPackageMapById`,e,`json`,!1,t,`GetPackageMapByIdResponse`)}GetPackageMapSelectOptions(e,t){return this._connection.send(`GetPackageMapSelectOptions`,e,`json`,!1,t,`GetPackageMapSelectOptionsResponse`)}GetPartFromPackageMap(e,t){return this._connection.send(`GetPartFromPackageMap`,e,`json`,!1,t,`GetPartFromPackageMapResponse`)}GetQueryFileMapping(e,t){return this._connection.send(`GetQueryFileMapping`,e,`json`,!1,t,`GetQueryFileMappingResponse`)}ListPackage(e,t){return this._connection.send(`ListPackage`,e,`json`,!1,t,`ListPackageResponse`)}ListPackages(e,t){return this._connection.send(`ListPackages`,e,`json`,!1,t,`ListPackagesResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`WsPackageProcessPingResponse`)}RemovePartFromPackageMap(e,t){return this._connection.send(`RemovePartFromPackageMap`,e,`json`,!1,t,`RemovePartFromPackageMapResponse`)}ValidatePackage(e,t){return this._connection.send(`ValidatePackage`,e,`json`,!1,t,`ValidatePackageResponse`)}},PackageProcessService=class extends PackageProcessServiceBase{},ge;(function(e){e.HPCCQueueType=function(e){return e.Thor=`Thor`,e.HThor=`HThor`,e.Roxie=`Roxie`,e.All=`All`,e}({}),e.ExternalIPStatus=function(e){return e.Unknown=`Unknown`,e.None=`None`,e.Pending=`Pending`,e}({}),e.ResourceType=function(e){return e.UNKNOWN=`UNKNOWN`,e.TRACES=`TRACES`,e.LOGS=`LOGS`,e.METRICS=`METRICS`,e}({})})(ge||={});var ResourcesServiceBase=class extends Service{constructor(e){super(e,`WsResources`,`1.04`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`WsResourcesPingResponse`)}ServiceQuery(e,t){return this._connection.send(`ServiceQuery`,e,`json`,!1,t,`ServiceQueryResponse`)}TargetQuery(e,t){return this._connection.send(`TargetQuery`,e,`json`,!1,t,`TargetQueryResponse`)}WebLinksQuery(e,t){return this._connection.send(`WebLinksQuery`,e,`json`,!1,t,`WebLinksQueryResponse`)}},ResourcesService=class extends ResourcesServiceBase{},_e;(function(e){e.WUTypes=function(e){return e.ECL=`ECL`,e.DFU=`DFU`,e}({})})(_e||={});var SashaServiceBase=class extends Service{constructor(e){super(e,`WSSasha`,`1.01`)}ArchiveWU(e,t){return this._connection.send(`ArchiveWU`,e,`json`,!1,t,`ResultResponse`)}GetVersion(e,t){return this._connection.send(`GetVersion`,e,`json`,!1,t,`ResultResponse`)}ListWU(e,t){return this._connection.send(`ListWU`,e,`json`,!1,t,`ResultResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`WSSashaPingResponse`)}RestoreWU(e,t){return this._connection.send(`RestoreWU`,e,`json`,!1,t,`ResultResponse`)}},SashaService=class extends SashaServiceBase{},ve=new Date,ye=new Date;function timeInterval(e,t,n,r){function interval(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return interval.floor=t=>(e(t=new Date(+t)),t),interval.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),interval.round=e=>{let t=interval(e),n=interval.ceil(e);return e-t<n-e?t:n},interval.offset=(e,n)=>(t(e=new Date(+e),n==null?1:Math.floor(n)),e),interval.range=(n,r,i)=>{let a=[];if(n=interval.ceil(n),i=i==null?1:Math.floor(i),!(n<r)||!(i>0))return a;let o;do a.push(o=new Date(+n)),t(n,i),e(n);while(o<n&&n<r);return a},interval.filter=n=>timeInterval(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e){if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}}),n&&(interval.count=(t,r)=>(ve.setTime(+t),ye.setTime(+r),e(ve),e(ye),Math.floor(n(ve,ye))),interval.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?interval.filter(r?t=>r(t)%e===0:t=>interval.count(0,t)%e===0):interval)),interval}var be=6e4,O=be*60*24,xe=O*7,Se=timeInterval(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*be)/O,e=>e.getDate()-1);Se.range;var Ce=timeInterval(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/O,e=>e.getUTCDate()-1);Ce.range,timeInterval(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/O,e=>Math.floor(e/O)).range;function timeWeekday(e){return timeInterval(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*be)/xe)}var we=timeWeekday(0),k=timeWeekday(1),Te=timeWeekday(2),Ee=timeWeekday(3),A=timeWeekday(4),De=timeWeekday(5),Oe=timeWeekday(6);we.range,k.range,Te.range,Ee.range,A.range,De.range,Oe.range;function utcWeekday(e){return timeInterval(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/xe)}var ke=utcWeekday(0),j=utcWeekday(1),Ae=utcWeekday(2),je=utcWeekday(3),M=utcWeekday(4),Me=utcWeekday(5),Ne=utcWeekday(6);ke.range,j.range,Ae.range,je.range,M.range,Me.range,Ne.range;var N=timeInterval(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());N.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:timeInterval(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),N.range;var P=timeInterval(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());P.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:timeInterval(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),P.range;function localDate(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function utcDate(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function newDate(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function formatLocale(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,o=e.shortDays,s=e.months,c=e.shortMonths,l=formatRe(i),u=formatLookup(i),d=formatRe(a),f=formatLookup(a),p=formatRe(o),m=formatLookup(o),h=formatRe(s),g=formatLookup(s),_=formatRe(c),v=formatLookup(c),y={a:formatShortWeekday,A:formatWeekday,b:formatShortMonth,B:formatMonth,c:null,d:formatDayOfMonth,e:formatDayOfMonth,f:formatMicroseconds,g:formatYearISO,G:formatFullYearISO,H:formatHour24,I:formatHour12,j:formatDayOfYear,L:formatMilliseconds,m:formatMonthNumber,M:formatMinutes,p:formatPeriod,q:formatQuarter,Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatSeconds,u:formatWeekdayNumberMonday,U:formatWeekNumberSunday,V:formatWeekNumberISO,w:formatWeekdayNumberSunday,W:formatWeekNumberMonday,x:null,X:null,y:formatYear,Y:formatFullYear,Z:formatZone,"%":formatLiteralPercent},b={a:formatUTCShortWeekday,A:formatUTCWeekday,b:formatUTCShortMonth,B:formatUTCMonth,c:null,d:formatUTCDayOfMonth,e:formatUTCDayOfMonth,f:formatUTCMicroseconds,g:formatUTCYearISO,G:formatUTCFullYearISO,H:formatUTCHour24,I:formatUTCHour12,j:formatUTCDayOfYear,L:formatUTCMilliseconds,m:formatUTCMonthNumber,M:formatUTCMinutes,p:formatUTCPeriod,q:formatUTCQuarter,Q:formatUnixTimestamp,s:formatUnixTimestampSeconds,S:formatUTCSeconds,u:formatUTCWeekdayNumberMonday,U:formatUTCWeekNumberSunday,V:formatUTCWeekNumberISO,w:formatUTCWeekdayNumberSunday,W:formatUTCWeekNumberMonday,x:null,X:null,y:formatUTCYear,Y:formatUTCFullYear,Z:formatUTCZone,"%":formatLiteralPercent},ee={a:parseShortWeekday,A:parseWeekday,b:parseShortMonth,B:parseMonth,c:parseLocaleDateTime,d:parseDayOfMonth,e:parseDayOfMonth,f:parseMicroseconds,g:parseYear,G:parseFullYear,H:parseHour24,I:parseHour24,j:parseDayOfYear,L:parseMilliseconds,m:parseMonthNumber,M:parseMinutes,p:parsePeriod,q:parseQuarter,Q:parseUnixTimestamp,s:parseUnixTimestampSeconds,S:parseSeconds,u:parseWeekdayNumberMonday,U:parseWeekNumberSunday,V:parseWeekNumberISO,w:parseWeekdayNumberSunday,W:parseWeekNumberMonday,x:parseLocaleDate,X:parseLocaleTime,y:parseYear,Y:parseFullYear,Z:parseZone,"%":parseLiteralPercent};y.x=newFormat(n,y),y.X=newFormat(r,y),y.c=newFormat(t,y),b.x=newFormat(n,b),b.X=newFormat(r,b),b.c=newFormat(t,b);function newFormat(e,t){return function(n){var r=[],i=-1,a=0,o=e.length,s,c,l;for(n instanceof Date||(n=new Date(+n));++i<o;)e.charCodeAt(i)===37&&(r.push(e.slice(a,i)),(c=Pe[s=e.charAt(++i)])==null?c=s===`e`?` `:`0`:s=e.charAt(++i),(l=t[s])&&(s=l(n,c)),r.push(s),a=i+1);return r.push(e.slice(a,i)),r.join(``)}}function newParse(e,t){return function(n){var r=newDate(1900,void 0,1),i=parseSpecifier(r,e,n+=``,0),a,o;if(i!=n.length)return null;if(`Q`in r)return new Date(r.Q);if(`s`in r)return new Date(r.s*1e3+(`L`in r?r.L:0));if(t&&!(`Z`in r)&&(r.Z=0),`p`in r&&(r.H=r.H%12+r.p*12),r.m===void 0&&(r.m=`q`in r?r.q:0),`V`in r){if(r.V<1||r.V>53)return null;`w`in r||(r.w=1),`Z`in r?(a=utcDate(newDate(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?j.ceil(a):j(a),a=Ce.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=localDate(newDate(r.y,0,1)),o=a.getDay(),a=o>4||o===0?k.ceil(a):k(a),a=Se.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else(`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?utcDate(newDate(r.y,0,1)).getUTCDay():localDate(newDate(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,utcDate(r)):localDate(r)}}function parseSpecifier(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i<a;){if(r>=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=ee[s in Pe?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function parsePeriod(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function parseShortWeekday(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function parseWeekday(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function parseShortMonth(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function parseMonth(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function parseLocaleDateTime(e,n,r){return parseSpecifier(e,t,n,r)}function parseLocaleDate(e,t,r){return parseSpecifier(e,n,t,r)}function parseLocaleTime(e,t,n){return parseSpecifier(e,r,t,n)}function formatShortWeekday(e){return o[e.getDay()]}function formatWeekday(e){return a[e.getDay()]}function formatShortMonth(e){return c[e.getMonth()]}function formatMonth(e){return s[e.getMonth()]}function formatPeriod(e){return i[+(e.getHours()>=12)]}function formatQuarter(e){return 1+~~(e.getMonth()/3)}function formatUTCShortWeekday(e){return o[e.getUTCDay()]}function formatUTCWeekday(e){return a[e.getUTCDay()]}function formatUTCShortMonth(e){return c[e.getUTCMonth()]}function formatUTCMonth(e){return s[e.getUTCMonth()]}function formatUTCPeriod(e){return i[+(e.getUTCHours()>=12)]}function formatUTCQuarter(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=newFormat(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=newParse(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=newFormat(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=newParse(e+=``,!0);return t.toString=function(){return e},t}}}var Pe={"-":``,_:` `,0:`0`},F=/^\s*\d+/,Fe=/^%/,Ie=/[\\^$*+?|[\]().{}]/g;function pad(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a<n?Array(n-a+1).join(t)+i:i)}function requote(e){return e.replace(Ie,`\\$&`)}function formatRe(e){return RegExp(`^(?:`+e.map(requote).join(`|`)+`)`,`i`)}function formatLookup(e){return new Map(e.map((e,t)=>[e.toLowerCase(),t]))}function parseWeekdayNumberSunday(e,t,n){var r=F.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function parseWeekdayNumberMonday(e,t,n){var r=F.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function parseWeekNumberSunday(e,t,n){var r=F.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function parseWeekNumberISO(e,t,n){var r=F.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function parseWeekNumberMonday(e,t,n){var r=F.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function parseFullYear(e,t,n){var r=F.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function parseYear(e,t,n){var r=F.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function parseZone(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function parseQuarter(e,t,n){var r=F.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function parseMonthNumber(e,t,n){var r=F.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function parseDayOfMonth(e,t,n){var r=F.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function parseDayOfYear(e,t,n){var r=F.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function parseHour24(e,t,n){var r=F.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function parseMinutes(e,t,n){var r=F.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function parseSeconds(e,t,n){var r=F.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function parseMilliseconds(e,t,n){var r=F.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function parseMicroseconds(e,t,n){var r=F.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function parseLiteralPercent(e,t,n){var r=Fe.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function parseUnixTimestamp(e,t,n){var r=F.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function parseUnixTimestampSeconds(e,t,n){var r=F.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function formatDayOfMonth(e,t){return pad(e.getDate(),t,2)}function formatHour24(e,t){return pad(e.getHours(),t,2)}function formatHour12(e,t){return pad(e.getHours()%12||12,t,2)}function formatDayOfYear(e,t){return pad(1+Se.count(N(e),e),t,3)}function formatMilliseconds(e,t){return pad(e.getMilliseconds(),t,3)}function formatMicroseconds(e,t){return formatMilliseconds(e,t)+`000`}function formatMonthNumber(e,t){return pad(e.getMonth()+1,t,2)}function formatMinutes(e,t){return pad(e.getMinutes(),t,2)}function formatSeconds(e,t){return pad(e.getSeconds(),t,2)}function formatWeekdayNumberMonday(e){var t=e.getDay();return t===0?7:t}function formatWeekNumberSunday(e,t){return pad(we.count(N(e)-1,e),t,2)}function dISO(e){var t=e.getDay();return t>=4||t===0?A(e):A.ceil(e)}function formatWeekNumberISO(e,t){return e=dISO(e),pad(A.count(N(e),e)+(N(e).getDay()===4),t,2)}function formatWeekdayNumberSunday(e){return e.getDay()}function formatWeekNumberMonday(e,t){return pad(k.count(N(e)-1,e),t,2)}function formatYear(e,t){return pad(e.getFullYear()%100,t,2)}function formatYearISO(e,t){return e=dISO(e),pad(e.getFullYear()%100,t,2)}function formatFullYear(e,t){return pad(e.getFullYear()%1e4,t,4)}function formatFullYearISO(e,t){var n=e.getDay();return e=n>=4||n===0?A(e):A.ceil(e),pad(e.getFullYear()%1e4,t,4)}function formatZone(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+pad(t/60|0,`0`,2)+pad(t%60,`0`,2)}function formatUTCDayOfMonth(e,t){return pad(e.getUTCDate(),t,2)}function formatUTCHour24(e,t){return pad(e.getUTCHours(),t,2)}function formatUTCHour12(e,t){return pad(e.getUTCHours()%12||12,t,2)}function formatUTCDayOfYear(e,t){return pad(1+Ce.count(P(e),e),t,3)}function formatUTCMilliseconds(e,t){return pad(e.getUTCMilliseconds(),t,3)}function formatUTCMicroseconds(e,t){return formatUTCMilliseconds(e,t)+`000`}function formatUTCMonthNumber(e,t){return pad(e.getUTCMonth()+1,t,2)}function formatUTCMinutes(e,t){return pad(e.getUTCMinutes(),t,2)}function formatUTCSeconds(e,t){return pad(e.getUTCSeconds(),t,2)}function formatUTCWeekdayNumberMonday(e){var t=e.getUTCDay();return t===0?7:t}function formatUTCWeekNumberSunday(e,t){return pad(ke.count(P(e)-1,e),t,2)}function UTCdISO(e){var t=e.getUTCDay();return t>=4||t===0?M(e):M.ceil(e)}function formatUTCWeekNumberISO(e,t){return e=UTCdISO(e),pad(M.count(P(e),e)+(P(e).getUTCDay()===4),t,2)}function formatUTCWeekdayNumberSunday(e){return e.getUTCDay()}function formatUTCWeekNumberMonday(e,t){return pad(j.count(P(e)-1,e),t,2)}function formatUTCYear(e,t){return pad(e.getUTCFullYear()%100,t,2)}function formatUTCYearISO(e,t){return e=UTCdISO(e),pad(e.getUTCFullYear()%100,t,2)}function formatUTCFullYear(e,t){return pad(e.getUTCFullYear()%1e4,t,4)}function formatUTCFullYearISO(e,t){var n=e.getUTCDay();return e=n>=4||n===0?M(e):M.ceil(e),pad(e.getUTCFullYear()%1e4,t,4)}function formatUTCZone(){return`+0000`}function formatLiteralPercent(){return`%`}function formatUnixTimestamp(e){return+e}function formatUnixTimestampSeconds(e){return Math.floor(e/1e3)}var I,Le,Re,ze;defaultLocale$1({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function defaultLocale$1(e){return I=formatLocale(e),I.format,Le=I.parse,Re=I.utcFormat,ze=I.utcParse,I}__name(defaultLocale$1,`defaultLocale`);var Be;(function(e){e.LockModes=function(e){return e.ALL=`ALL`,e.READ=`READ`,e.WRITE=`WRITE`,e.HOLD=`HOLD`,e.SUB=`SUB`,e}({}),e.RoxieControlCmdType=function(e){return e.Attach=`Attach`,e.Detach=`Detach`,e.State=`State`,e.Reload=`Reload`,e.ReloadRetry=`ReloadRetry`,e.MemLock=`MemLock`,e.MemUnlock=`MemUnlock`,e.GetMemLocked=`GetMemLocked`,e}({})})(Be||={});var SMCServiceBase=class extends Service{constructor(e){super(e,`WsSMC`,`1.29`)}Activity(e){return this._connection.send(`Activity`,e,`json`,!1,void 0,`ActivityResponse`)}BrowseResources(e){return this._connection.send(`BrowseResources`,e,`json`,!1,void 0,`BrowseResourcesResponse`)}ClearQueue(e){return this._connection.send(`ClearQueue`,e,`json`,!1,void 0,`SMCQueueResponse`)}GetBuildInfo(e){return this._connection.send(`GetBuildInfo`,e,`json`,!1,void 0,`GetBuildInfoResponse`)}GetGlobalMetrics(e){return this._connection.send(`GetGlobalMetrics`,e,`json`,!1,void 0,`GetGlobalMetricsResponse`)}GetStatusServerInfo(e){return this._connection.send(`GetStatusServerInfo`,e,`json`,!1,void 0,`GetStatusServerInfoResponse`)}GetThorQueueAvailability(e){return this._connection.send(`GetThorQueueAvailability`,e,`json`,!1,void 0,`GetThorQueueAvailabilityResponse`)}Index(e){return this._connection.send(`Index`,e,`json`,!1,void 0,`SMCIndexResponse`)}LockQuery(e){return this._connection.send(`LockQuery`,e,`json`,!1,void 0,`LockQueryResponse`)}MoveJobBack(e){return this._connection.send(`MoveJobBack`,e,`json`,!1,void 0,`SMCJobResponse`)}MoveJobDown(e){return this._connection.send(`MoveJobDown`,e,`json`,!1,void 0,`SMCJobResponse`)}MoveJobFront(e){return this._connection.send(`MoveJobFront`,e,`json`,!1,void 0,`SMCJobResponse`)}MoveJobUp(e){return this._connection.send(`MoveJobUp`,e,`json`,!1,void 0,`SMCJobResponse`)}NotInCommunityEdition(e){return this._connection.send(`NotInCommunityEdition`,e,`json`,!1,void 0,`NotInCommunityEditionResponse`)}PauseQueue(e){return this._connection.send(`PauseQueue`,e,`json`,!1,void 0,`SMCQueueResponse`)}Ping(e){return this._connection.send(`Ping`,e,`json`,!1,void 0,`WsSMCPingResponse`)}RecordGlobalMetrics(e){return this._connection.send(`RecordGlobalMetrics`,e,`json`,!1,void 0,`RecordGlobalMetricsResponse`)}RemoveJob(e){return this._connection.send(`RemoveJob`,e,`json`,!1,void 0,`SMCJobResponse`)}ResumeQueue(e){return this._connection.send(`ResumeQueue`,e,`json`,!1,void 0,`SMCQueueResponse`)}RoxieControlCmd(e){return this._connection.send(`RoxieControlCmd`,e,`json`,!1,void 0,`RoxieControlCmdResponse`)}RoxieXrefCmd(e){return this._connection.send(`RoxieXrefCmd`,e,`json`,!1,void 0,`RoxieXrefCmdResponse`)}SetBanner(e){return this._connection.send(`SetBanner`,e,`json`,!1,void 0,`SetBannerResponse`)}SetJobPriority(e){return this._connection.send(`SetJobPriority`,e,`json`,!1,void 0,`SMCPriorityResponse`)}StopQueue(e){return this._connection.send(`StopQueue`,e,`json`,!1,void 0,`SMCQueueResponse`)}},Ve=Le(`%Y%m%d%H`);function isNumeric(e){return typeof e==`number`||typeof e==`string`&&e.trim()!==``&&!isNaN(+e)}var SMCService=class extends SMCServiceBase{connectionOptions(){return this._connection.opts()}Activity(e){return super.Activity(e).then(e=>({Running:{ActiveWorkunit:[]},...e}))}parseGlobalMetric(e,t){return e.startsWith(`Cost`)?t/1e6:e.startsWith(`Date`)?Ve(t):e.startsWith(`Num`)?+t:e.startsWith(`Time`)?t/1e9:e.startsWith(`When`)?new Date(t/1e3).toISOString():isNumeric(t)?+t:t}GetNormalisedGlobalMetrics(e){return super.GetGlobalMetrics(e).then(e=>{let t=[];for(let n of e?.GlobalMetrics?.GlobalMetric||[]){let e={Category:n.Category,Start:this.parseGlobalMetric(`Date`,n.DateTimeRange?.Start),End:this.parseGlobalMetric(`Date`,n.DateTimeRange?.End),dimensions:{},stats:{}};for(let t of n.Dimensions?.Dimension||[])e.dimensions[t.Name]=t.Value;for(let t of n.Stats?.Stat||[])e.stats[t.Name]=this.parseGlobalMetric(t.Name,t.Value);t.push(e)}return t})}},SQL2ServiceBase=class extends Service{constructor(e){super(e,`WsSQL2`,`1.00`)}CloseResultSet(e,t){return this._connection.send(`CloseResultSet`,e,`json`,!1,t,`CloseResultSetResponse`)}ExecuteQuery(e,t){return this._connection.send(`ExecuteQuery`,e,`json`,!1,t,`ExecuteQueryResponse`)}ExplainQuery(e,t){return this._connection.send(`ExplainQuery`,e,`json`,!1,t,`ExplainQueryResponse`)}FetchResultSet(e,t){return this._connection.send(`FetchResultSet`,e,`json`,!1,t,`FetchResultSetResponse`)}LogicalFileMeta(e,t){return this._connection.send(`LogicalFileMeta`,e,`json`,!1,t,`LogicalFileMetaResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`WsSQL2PingResponse`)}SplitQuery(e,t){return this._connection.send(`SplitQuery`,e,`json`,!1,t,`SplitQueryResponse`)}},SQL2Service=class extends SQL2ServiceBase{},storeServiceBase=class extends Service{constructor(e){super(e,`wsstore`,`1.02`)}CreateStore(e,t){return this._connection.send(`CreateStore`,e,`json`,!1,t,`CreateStoreResponse`)}Delete(e,t){return this._connection.send(`Delete`,e,`json`,!1,t,`DeleteResponse`)}DeleteNamespace(e,t){return this._connection.send(`DeleteNamespace`,e,`json`,!1,t,`DeleteNamespaceResponse`)}Fetch(e,t){return this._connection.send(`Fetch`,e,`json`,!1,t,`FetchResponse`)}FetchAll(e,t){return this._connection.send(`FetchAll`,e,`json`,!1,t,`FetchAllResponse`)}FetchKeyMetadata(e,t){return this._connection.send(`FetchKeyMetadata`,e,`json`,!1,t,`FetchKeyMDResponse`)}ListKeys(e,t){return this._connection.send(`ListKeys`,e,`json`,!1,t,`ListKeysResponse`)}ListNamespaces(e,t){return this._connection.send(`ListNamespaces`,e,`json`,!1,t,`ListNamespacesResponse`)}ListStores(e,t){return this._connection.send(`ListStores`,e,`json`,!1,t,`ListStoresResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`wsstorePingResponse`)}Set(e,t){return this._connection.send(`Set`,e,`json`,!1,t,`SetResponse`)}},StoreService=class extends storeServiceBase{Delete(e){return super.Delete(e).catch(e=>{if(e.isESPExceptions&&e.Exception.some(e=>e.Code===-1))return{Exceptions:void 0,Success:!0};throw e})}Fetch(e){return super.Fetch(e).catch(e=>{if(e.isESPExceptions&&e.Exception.some(e=>e.Code===-1))return{Exceptions:void 0,Value:void 0};throw e})}},He;(function(e){e.TpConfigResponseFormat=function(e){return e.XML=`XML`,e.YAML=`YAML`,e}({}),e.RoxieQueueFilter=function(e){return e.All=`All`,e.QueriesOnly=`QueriesOnly`,e.WorkunitsOnly=`WorkunitsOnly`,e}({}),e.TpMachineType=function(e){return e.ALLNODES=`ALLNODES`,e.THORMACHINES=`THORMACHINES`,e.HOLEMACHINES=`HOLEMACHINES`,e.ROXIEMACHINES=`ROXIEMACHINES`,e.MACHINES=`MACHINES`,e.AVAILABLEMACHINES=`AVAILABLEMACHINES`,e.DROPZONE=`DROPZONE`,e.STANDBYNNODE=`STANDBYNNODE`,e.THORSPARENODES=`THORSPARENODES`,e.HOLESTANDBYNODES=`HOLESTANDBYNODES`,e}({})})(He||={});var TopologyServiceBase=class extends Service{constructor(e){super(e,`WsTopology`,`1.33`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`WsTopologyPingResponse`)}SystemLog(e,t){return this._connection.send(`SystemLog`,e,`json`,!1,t,`SystemLogResponse`)}TpClusterInfo(e,t){return this._connection.send(`TpClusterInfo`,e,`json`,!1,t,`TpClusterInfoResponse`)}TpClusterQuery(e,t){return this._connection.send(`TpClusterQuery`,e,`json`,!1,t,`TpClusterQueryResponse`)}TpComponentConfiguration(e,t){return this._connection.send(`TpComponentConfiguration`,e,`json`,!1,t,`TpComponentConfigurationResponse`)}TpConfiguredComponents(e,t){return this._connection.send(`TpConfiguredComponents`,e,`json`,!1,t,`TpConfiguredComponentsResponse`)}TpDropZoneQuery(e,t){return this._connection.send(`TpDropZoneQuery`,e,`json`,!1,t,`TpDropZoneQueryResponse`)}TpGetComponentFile(e,t){return this._connection.send(`TpGetComponentFile`,e,`json`,!1,t,`TpGetComponentFileResponse`)}TpGetServicePlugins(e,t){return this._connection.send(`TpGetServicePlugins`,e,`json`,!1,t,`TpGetServicePluginsResponse`)}TpGroupQuery(e,t){return this._connection.send(`TpGroupQuery`,e,`json`,!1,t,`TpGroupQueryResponse`)}TpListLogFiles(e,t){return this._connection.send(`TpListLogFiles`,e,`json`,!1,t,`TpListLogFilesResponse`)}TpListTargetClusters(e,t){return this._connection.send(`TpListTargetClusters`,e,`json`,!1,t,`TpListTargetClustersResponse`)}TpLogFile(e,t){return this._connection.send(`TpLogFile`,e,`json`,!1,t,`TpLogFileResponse`)}TpLogFileDisplay(e,t){return this._connection.send(`TpLogFileDisplay`,e,`json`,!1,t,`TpLogFileResponse`)}TpLogicalClusterQuery(e,t){return this._connection.send(`TpLogicalClusterQuery`,e,`json`,!1,t,`TpLogicalClusterQueryResponse`)}TpMachineInfo(e,t){return this._connection.send(`TpMachineInfo`,e,`json`,!1,t,`TpMachineInfoResponse`)}TpMachineQuery(e,t){return this._connection.send(`TpMachineQuery`,e,`json`,!1,t,`TpMachineQueryResponse`)}TpServiceQuery(e,t){return this._connection.send(`TpServiceQuery`,e,`json`,!1,t,`TpServiceQueryResponse`)}TpSetMachineStatus(e,t){return this._connection.send(`TpSetMachineStatus`,e,`json`,!1,t,`TpSetMachineStatusResponse`)}TpSwapNode(e,t){return this._connection.send(`TpSwapNode`,e,`json`,!1,t,`TpSwapNodeResponse`)}TpTargetClusterQuery(e,t){return this._connection.send(`TpTargetClusterQuery`,e,`json`,!1,t,`TpTargetClusterQueryResponse`)}TpThorStatus(e,t){return this._connection.send(`TpThorStatus`,e,`json`,!1,t,`TpThorStatusResponse`)}TpXMLFile(e,t){return this._connection.send(`TpXMLFile`,e,`json`,!1,t,`TpXMLFileResponse`)}},TopologyService=class extends TopologyServiceBase{connectionOptions(){return this._connection.opts()}protocol(){return this._connection.opts().baseUrl.split(`//`)[0]}ip(){return this._connection.opts().baseUrl.split(`//`)[1].split(`:`)[0]}DefaultTpLogicalClusterQuery(e={}){return this.TpLogicalClusterQuery(e).then(e=>{if(e.default)return e.default;let t,n;return e.TpLogicalClusters.TpLogicalCluster.some((e,r)=>(r===0&&(n=e),e.Type===`hthor`&&(t=e,!0))),t||n})}},L;(function(e){e.ECLWUActions=function(e){return e.Abort=`Abort`,e.Delete=`Delete`,e.Deschedule=`Deschedule`,e.Reschedule=`Reschedule`,e.Pause=`Pause`,e.PauseNow=`PauseNow`,e.Protect=`Protect`,e.Unprotect=`Unprotect`,e.Restore=`Restore`,e.Resume=`Resume`,e.SetToFailed=`SetToFailed`,e.Archive=`Archive`,e}({}),e.LogSelectColumnMode=function(e){return e[e.MIN=0]=`MIN`,e[e.DEFAULT=1]=`DEFAULT`,e[e.ALL=2]=`ALL`,e[e.CUSTOM=3]=`CUSTOM`,e}({}),e.SortDirection=function(e){return e[e.ASC=0]=`ASC`,e[e.DSC=1]=`DSC`,e}({}),e.LogEventClass=function(e){return e.ALL=`ALL`,e.DIS=`DIS`,e.ERR=`ERR`,e.WRN=`WRN`,e.INF=`INF`,e.PRO=`PRO`,e.MET=`MET`,e.EVT=`EVT`,e}({}),e.WUDetailsAttrValueType=function(e){return e.Single=`Single`,e.List=`List`,e.Multi=`Multi`,e}({}),e.EclDefinitionActions=function(e){return e.SyntaxCheck=`SyntaxCheck`,e.Deploy=`Deploy`,e.Publish=`Publish`,e}({}),e.ErrorMessageFormat=function(e){return e.xml=`xml`,e.json=`json`,e.text=`text`,e}({}),e.LogAccessLogFormat=function(e){return e[e.XML=0]=`XML`,e[e.JSON=1]=`JSON`,e[e.CSV=2]=`CSV`,e}({}),e.WUExceptionSeverity=function(e){return e.info=`info`,e.warning=`warning`,e.error=`error`,e.alert=`alert`,e}({}),e.WUFileDownloadOption=function(e){return e[e.OriginalText=0]=`OriginalText`,e[e.Attachment=1]=`Attachment`,e[e.ZIP=2]=`ZIP`,e[e.GZIP=3]=`GZIP`,e}({}),e.WUFileType=function(e){return e.XML=`XML`,e.cpp=`cpp`,e.dll=`dll`,e.res=`res`,e.log=`log`,e.WUECL=`WUECL`,e.ThorLog=`ThorLog`,e.ThorSlaveLog=`ThorSlaveLog`,e.EclAgentLog=`EclAgentLog`,e.ArchiveQuery=`ArchiveQuery`,e.ComponentLog=`ComponentLog`,e.PostMortem=`PostMortem`,e}({}),e.WUQueryFilterSuspendedType=function(e){return e.Allqueries=`All queries`,e.Notsuspended=`Not suspended`,e.Suspended=`Suspended`,e.Suspendedbyuser=`Suspended by user`,e.Suspendedbyfirstnode=`Suspended by first node`,e.Suspendedbyanynode=`Suspended by any node`,e}({}),e.WUQuerySetFilterType=function(e){return e.All=`All`,e.Id=`Id`,e.Name=`Name`,e.Alias=`Alias`,e.Status=`Status`,e}({}),e.WUProtectFilter=function(e){return e.All=`All`,e.Protected=`Protected`,e.NotProtected=`NotProtected`,e}({}),e.QuerySetAliasActionTypes=function(e){return e.Deactivate=`Deactivate`,e}({}),e.QuerysetImportActivation=function(e){return e.None=`None`,e.ActivateImportedActive=`ActivateImportedActive`,e}({}),e.QuerySetQueryActionTypes=function(e){return e.Suspend=`Suspend`,e.Unsuspend=`Unsuspend`,e.ToggleSuspend=`ToggleSuspend`,e.Activate=`Activate`,e.Delete=`Delete`,e.DeleteQueriesAndWUs=`DeleteQueriesAndWUs`,e.RemoveAllAliases=`RemoveAllAliases`,e.ResetQueryStats=`ResetQueryStats`,e}({}),e.WUQueryActivationMode=function(e){return e[e.DoNotActivateQuery=0]=`DoNotActivateQuery`,e[e.ActivateQuery=1]=`ActivateQuery`,e[e.ActivateQuerySuspendPrevious=2]=`ActivateQuerySuspendPrevious`,e[e.ActivateQueryDeletePrevious=3]=`ActivateQueryDeletePrevious`,e}({})})(L||={});var WorkunitsServiceBase=class extends Service{constructor(e){super(e,`WsWorkunits`,`2.11`)}GVCAjaxGraph(e,t){return this._connection.send(`GVCAjaxGraph`,e,`json`,!1,t,`GVCAjaxGraphResponse`)}Ping(e,t){return this._connection.send(`Ping`,e,`json`,!1,t,`WsWorkunitsPingResponse`)}WUAbort(e,t){return this._connection.send(`WUAbort`,e,`json`,!1,t,`WUAbortResponse`)}WUAction(e,t){return this._connection.send(`WUAction`,e,`json`,!1,t,`WUActionResponse`)}WUAddLocalFileToWorkunit(e,t){return this._connection.send(`WUAddLocalFileToWorkunit`,e,`json`,!1,t,`WUAddLocalFileToWorkunitResponse`)}WUAnalyseHotspot(e,t){return this._connection.send(`WUAnalyseHotspot`,e,`json`,!1,t,`WUAnalyseHotspotResponse`)}WUCDebug(e,t){return this._connection.send(`WUCDebug`,e,`json`,!1,t,`WUDebugResponse`)}WUCheckFeatures(e,t){return this._connection.send(`WUCheckFeatures`,e,`json`,!1,t,`WUCheckFeaturesResponse`)}WUClusterJobQueueLOG(e,t){return this._connection.send(`WUClusterJobQueueLOG`,e,`json`,!1,t,`WUClusterJobQueueLOGResponse`)}WUClusterJobQueueXLS(e,t){return this._connection.send(`WUClusterJobQueueXLS`,e,`json`,!1,t,`WUClusterJobQueueXLSResponse`)}WUClusterJobSummaryXLS(e,t){return this._connection.send(`WUClusterJobSummaryXLS`,e,`json`,!1,t,`WUClusterJobSummaryXLSResponse`)}WUClusterJobXLS(e,t){return this._connection.send(`WUClusterJobXLS`,e,`json`,!1,t,`WUClusterJobXLSResponse`)}WUCompileECL(e,t){return this._connection.send(`WUCompileECL`,e,`json`,!1,t,`WUCompileECLResponse`)}WUCopyLogicalFiles(e,t){return this._connection.send(`WUCopyLogicalFiles`,e,`json`,!1,t,`WUCopyLogicalFilesResponse`)}WUCopyQuerySet(e,t){return this._connection.send(`WUCopyQuerySet`,e,`json`,!1,t,`WUCopyQuerySetResponse`)}WUCreate(e,t){return this._connection.send(`WUCreate`,e,`json`,!1,t,`WUCreateResponse`)}WUCreateAndUpdate(e,t){return this._connection.send(`WUCreateAndUpdate`,e,`json`,!1,t,`WUUpdateResponse`)}WUCreateZAPInfo(e,t){return this._connection.send(`WUCreateZAPInfo`,e,`json`,!1,t,`WUCreateZAPInfoResponse`)}WUDelete(e,t){return this._connection.send(`WUDelete`,e,`json`,!1,t,`WUDeleteResponse`)}WUDeployWorkunit(e,t){return this._connection.send(`WUDeployWorkunit`,e,`json`,!1,t,`WUDeployWorkunitResponse`)}WUDetails(e,t){return this._connection.send(`WUDetails`,e,`json`,!1,t,`WUDetailsResponse`)}WUDetailsMeta(e,t){return this._connection.send(`WUDetailsMeta`,e,`json`,!1,t,`WUDetailsMetaResponse`)}WUEclDefinitionAction(e,t){return this._connection.send(`WUEclDefinitionAction`,e,`json`,!1,t,`WUEclDefinitionActionResponse`)}WUExport(e,t){return this._connection.send(`WUExport`,e,`json`,!1,t,`WUExportResponse`)}WUFile(e,t){return this._connection.send(`WUFile`,e,`json`,!1,t,`WULogFileResponse`)}WUFullResult(e,t){return this._connection.send(`WUFullResult`,e,`json`,!1,t,`WUFullResultResponse`)}WUGVCGraphInfo(e,t){return this._connection.send(`WUGVCGraphInfo`,e,`json`,!1,t,`WUGVCGraphInfoResponse`)}WUGetArchiveFile(e,t){return this._connection.send(`WUGetArchiveFile`,e,`json`,!1,t,`WUGetArchiveFileResponse`)}WUGetDependancyTrees(e,t){return this._connection.send(`WUGetDependancyTrees`,e,`json`,!1,t,`WUGetDependancyTreesResponse`)}WUGetGraph(e,t){return this._connection.send(`WUGetGraph`,e,`json`,!1,t,`WUGetGraphResponse`)}WUGetGraphNameAndTypes(e,t){return this._connection.send(`WUGetGraphNameAndTypes`,e,`json`,!1,t,`WUGetGraphNameAndTypesResponse`)}WUGetNumFileToCopy(e,t){return this._connection.send(`WUGetNumFileToCopy`,e,`json`,!1,t,`WUGetNumFileToCopyResponse`)}WUGetPlugins(e,t){return this._connection.send(`WUGetPlugins`,e,`json`,!1,t,`WUGetPluginsResponse`)}WUGetStats(e,t){return this._connection.send(`WUGetStats`,e,`json`,!1,t,`WUGetStatsResponse`)}WUGetThorJobList(e,t){return this._connection.send(`WUGetThorJobList`,e,`json`,!1,t,`WUGetThorJobListResponse`)}WUGetThorJobQueue(e,t){return this._connection.send(`WUGetThorJobQueue`,e,`json`,!1,t,`WUGetThorJobQueueResponse`)}WUGetZAPInfo(e,t){return this._connection.send(`WUGetZAPInfo`,e,`json`,!1,t,`WUGetZAPInfoResponse`)}WUGraphInfo(e,t){return this._connection.send(`WUGraphInfo`,e,`json`,!1,t,`WUGraphInfoResponse`)}WUGraphTiming(e,t){return this._connection.send(`WUGraphTiming`,e,`json`,!1,t,`WUGraphTimingResponse`)}WUHelperFileArchive(e,t){return this._connection.send(`WUHelperFileArchive`,e,`json`,!1,t,`WUHelperFileArchiveResponse`)}WUInfo(e,t){return this._connection.send(`WUInfo`,e,`json`,!1,t,`WUInfoResponse`)}WUInfoDetails(e,t){return this._connection.send(`WUInfoDetails`,e,`json`,!1,t,`WUInfoResponse`)}WUJobList(e,t){return this._connection.send(`WUJobList`,e,`json`,!1,t,`WUJobListResponse`)}WULightWeightQuery(e,t){return this._connection.send(`WULightWeightQuery`,e,`json`,!1,t,`WULightWeightQueryResponse`)}WUListArchiveFiles(e,t){return this._connection.send(`WUListArchiveFiles`,e,`json`,!1,t,`WUListArchiveFilesResponse`)}WUListLocalFileRequired(e,t){return this._connection.send(`WUListLocalFileRequired`,e,`json`,!1,t,`WUListLocalFileRequiredResponse`)}WUListQueries(e,t){return this._connection.send(`WUListQueries`,e,`json`,!1,t,`WUListQueriesResponse`)}WUListQueriesUsingFile(e,t){return this._connection.send(`WUListQueriesUsingFile`,e,`json`,!1,t,`WUListQueriesUsingFileResponse`)}WUMultiQuerysetDetails(e,t){return this._connection.send(`WUMultiQuerysetDetails`,e,`json`,!1,t,`WUMultiQuerySetDetailsResponse`)}WUProcessGraph(e,t){return this._connection.send(`WUProcessGraph`,e,`json`,!1,t,`WUProcessGraphResponse`)}WUProtect(e,t){return this._connection.send(`WUProtect`,e,`json`,!1,t,`WUProtectResponse`)}WUPublishWorkunit(e,t){return this._connection.send(`WUPublishWorkunit`,e,`json`,!1,t,`WUPublishWorkunitResponse`)}WUPushEvent(e,t){return this._connection.send(`WUPushEvent`,e,`json`,!1,t,`WUPushEventResponse`)}WUQuery(e,t){return this._connection.send(`WUQuery`,e,`json`,!1,t,`WUQueryResponse`)}WUQueryConfig(e,t){return this._connection.send(`WUQueryConfig`,e,`json`,!1,t,`WUQueryConfigResponse`)}WUQueryDetails(e,t){return this._connection.send(`WUQueryDetails`,e,`json`,!1,t,`WUQueryDetailsResponse`)}WUQueryDetailsLightWeight(e,t){return this._connection.send(`WUQueryDetailsLightWeight`,e,`json`,!1,t,`WUQueryDetailsResponse`)}WUQueryFiles(e,t){return this._connection.send(`WUQueryFiles`,e,`json`,!1,t,`WUQueryFilesResponse`)}WUQueryGetGraph(e,t){return this._connection.send(`WUQueryGetGraph`,e,`json`,!1,t,`WUQueryGetGraphResponse`)}WUQueryGetSummaryStats(e,t){return this._connection.send(`WUQueryGetSummaryStats`,e,`json`,!1,t,`WUQueryGetSummaryStatsResponse`)}WUQuerysetAliasAction(e,t){return this._connection.send(`WUQuerysetAliasAction`,e,`json`,!1,t,`WUQuerySetAliasActionResponse`)}WUQuerysetCopyQuery(e,t){return this._connection.send(`WUQuerysetCopyQuery`,e,`json`,!1,t,`WUQuerySetCopyQueryResponse`)}WUQuerysetDetails(e,t){return this._connection.send(`WUQuerysetDetails`,e,`json`,!1,t,`WUQuerySetDetailsResponse`)}WUQuerysetExport(e,t){return this._connection.send(`WUQuerysetExport`,e,`json`,!1,t,`WUQuerysetExportResponse`)}WUQuerysetImport(e,t){return this._connection.send(`WUQuerysetImport`,e,`json`,!1,t,`WUQuerysetImportResponse`)}WUQuerysetQueryAction(e,t){return this._connection.send(`WUQuerysetQueryAction`,e,`json`,!1,t,`WUQuerySetQueryActionResponse`)}WUQuerysets(e,t){return this._connection.send(`WUQuerysets`,e,`json`,!1,t,`WUQuerysetsResponse`)}WURecreateQuery(e,t){return this._connection.send(`WURecreateQuery`,e,`json`,!1,t,`WURecreateQueryResponse`)}WUResubmit(e,t){return this._connection.send(`WUResubmit`,e,`json`,!1,t,`WUResubmitResponse`)}WUResult(e,t){return this._connection.send(`WUResult`,e,`json`,!1,t,`WUResultResponse`)}WUResultBin(e,t){return this._connection.send(`WUResultBin`,e,`json`,!1,t,`WUResultBinResponse`)}WUResultSummary(e,t){return this._connection.send(`WUResultSummary`,e,`json`,!1,t,`WUResultSummaryResponse`)}WUResultView(e,t){return this._connection.send(`WUResultView`,e,`json`,!1,t,`WUResultViewResponse`)}WURun(e,t){return this._connection.send(`WURun`,e,`json`,!1,t,`WURunResponse`)}WUSchedule(e,t){return this._connection.send(`WUSchedule`,e,`json`,!1,t,`WUScheduleResponse`)}WUShowScheduled(e,t){return this._connection.send(`WUShowScheduled`,e,`json`,!1,t,`WUShowScheduledResponse`)}WUSubmit(e,t){return this._connection.send(`WUSubmit`,e,`json`,!1,t,`WUSubmitResponse`)}WUSyntaxCheckECL(e,t){return this._connection.send(`WUSyntaxCheckECL`,e,`json`,!1,t,`WUSyntaxCheckResponse`)}WUUpdate(e,t){return this._connection.send(`WUUpdate`,e,`json`,!1,t,`WUUpdateResponse`)}WUUpdateQueryEntry(e,t){return this._connection.send(`WUUpdateQueryEntry`,e,`json`,!1,t,`WUUpdateQueryEntryResponse`)}WUWaitCompiled(e,t){return this._connection.send(`WUWaitCompiled`,e,`json`,!1,t,`WUWaitResponse`)}WUWaitComplete(e,t){return this._connection.send(`WUWaitComplete`,e,`json`,!1,t,`WUWaitResponse`)}},R=function(e){return e[e.Unknown=0]=`Unknown`,e[e.Compiled=1]=`Compiled`,e[e.Running=2]=`Running`,e[e.Completed=3]=`Completed`,e[e.Failed=4]=`Failed`,e[e.Archived=5]=`Archived`,e[e.Aborting=6]=`Aborting`,e[e.Aborted=7]=`Aborted`,e[e.Blocked=8]=`Blocked`,e[e.Submitted=9]=`Submitted`,e[e.Scheduled=10]=`Scheduled`,e[e.Compiling=11]=`Compiling`,e[e.Wait=12]=`Wait`,e[e.UploadingFiled=13]=`UploadingFiled`,e[e.DebugPaused=14]=`DebugPaused`,e[e.DebugRunning=15]=`DebugRunning`,e[e.Paused=16]=`Paused`,e[e.LAST=17]=`LAST`,e[e.NotFound=999]=`NotFound`,e}({}),z;(function(e){e.Action=function(e){return e[e.Unknown=0]=`Unknown`,e[e.Compile=1]=`Compile`,e[e.Check=2]=`Check`,e[e.Run=3]=`Run`,e[e.ExecuteExisting=4]=`ExecuteExisting`,e[e.Pause=5]=`Pause`,e[e.PauseNow=6]=`PauseNow`,e[e.Resume=7]=`Resume`,e[e.Debug=8]=`Debug`,e[e.__size=9]=`__size`,e}({})})(z||={});function isECLResult(e){return typeof e.Name==`string`}function isWUQueryECLWorkunit(e){return e.TotalClusterTime!==void 0}function isWUInfoWorkunit(e){return e.StateEx!==void 0}var WorkunitsService=class extends WorkunitsServiceBase{constructor(e){super(e)}Ping(){return this._connection.send(`Ping`,{},`json`,!1,void 0,`WsWorkunitsPingResponse`).then(()=>({result:!0}))}WUQuery(e={},t){return this._connection.send(`WUQuery`,e,`json`,!1,t).then(e=>(0,o.deepMixin)({Workunits:{ECLWorkunit:[]}},e))}WUInfo(e){let t={Wuid:``,TruncateEclTo64k:!0,IncludeExceptions:!1,IncludeGraphs:!1,IncludeSourceFiles:!1,IncludeResults:!1,IncludeResultsViewNames:!1,IncludeVariables:!1,IncludeTimers:!1,IncludeDebugValues:!1,IncludeApplicationValues:!1,IncludeWorkflows:!1,IncludeXmlSchemas:!1,IncludeResourceURLs:!1,IncludeECL:!1,IncludeHelpers:!1,IncludeAllowedClusters:!1,IncludeTotalClusterTime:!1,IncludeServiceNames:!1,SuppressResultSchemas:!0,...e};return super.WUInfo(t)}WUCreate(){return super.WUCreate({})}WUUpdate(e){return this._connection.send(`WUUpdate`,e,`json`,!0)}WUResubmit(e){return this._connection.toESPStringArray(e,`Wuids`),super.WUResubmit(e)}WUAction(e){return e.ActionType=e.WUActionType,super.WUAction(e)}WUResult(e,t){return this._connection.send(`WUResult`,e,`json`,!1,t)}WUFileEx(e){return this._connection.send(`WUFile`,e,`text`)}_WUDetailsMetaPromise;WUDetailsMeta(e){return this._WUDetailsMetaPromise||=super.WUDetailsMeta(e),this._WUDetailsMetaPromise}WUDetailsEx(e,t,n){return this._connection.send(`WUDetails`,e,n,!1,t,`WUDetailsResponse`)}WUCDebugEx(e){return this._connection.send(`WUCDebug`,e,void 0,void 0,void 0,`WUDebug`).then(e=>{let t=(0,o.xml2json)(e.Result).children();return t.length?t[0]:null})}},WorkunitsServiceEx=class extends WorkunitsServiceBase{WUPublishWorkunitEx(e){return this._connection.send(`WUPublishWorkunit`,e)}};function formatDecimal_default(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}__name(formatDecimal_default,`default`);function formatDecimalParts(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function exponent_default(e){return e=formatDecimalParts(Math.abs(e)),e?e[1]:NaN}__name(exponent_default,`default`);function formatGroup_default(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}__name(formatGroup_default,`default`);function formatNumerals_default(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}__name(formatNumerals_default,`default`);var Ue=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function formatSpecifier(e){if(!(t=Ue.exec(e)))throw Error(`invalid format: `+e);var t;return new FormatSpecifier({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}formatSpecifier.prototype=FormatSpecifier.prototype;function FormatSpecifier(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}FormatSpecifier.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function formatTrim_default(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0)}return r>0?e.slice(0,r)+e.slice(i+1):e}__name(formatTrim_default,`default`);var B;function formatPrefixAuto_default(e,t){var n=formatDecimalParts(e,t);if(!n)return B=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(B=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+formatDecimalParts(e,Math.max(0,t+a-1))[0]}__name(formatPrefixAuto_default,`default`);function formatRounded_default(e,t){var n=formatDecimalParts(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}__name(formatRounded_default,`default`);var We={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:formatDecimal_default,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>formatRounded_default(e*100,t),r:formatRounded_default,s:formatPrefixAuto_default,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function identity_default(e){return e}__name(identity_default,`default`);var Ge=Array.prototype.map,Ke=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function locale_default(e){var t=e.grouping===void 0||e.thousands===void 0?identity_default:formatGroup_default(Ge.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?identity_default:formatNumerals_default(Ge.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function newFormat(e,l){e=formatSpecifier(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):We[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),ee=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),x=We[y],S=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function format(e){var n=b,r=ee,o,l,p;if(y===`c`)r=x(e)+r,e=``;else{e=+e;var C=e<0||1/e<0;if(e=isNaN(e)?c:x(Math.abs(e),_),v&&(e=formatTrim_default(e)),C&&+e==0&&f!==`+`&&(C=!1),n=(C?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&B!==void 0?Ke[8+B/3]:``)+r+(C&&f===`(`?`)`:``),S){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var w=n.length+e.length+r.length,T=w<h?Array(h-w+1).join(u):``;switch(g&&m&&(e=t(T+e,T.length?h-r.length:1/0),T=``),d){case`<`:e=n+e+r+T;break;case`=`:e=n+T+e+r;break;case`^`:e=T.slice(0,w=T.length>>1)+n+e+r+T.slice(w);break;default:e=T+n+e+r}return a(e)}return format.toString=function(){return e+``},format}function formatPrefix(e,t){var n=Math.max(-8,Math.min(8,Math.floor(exponent_default(t)/3)))*3,r=10**-n,i=newFormat((e=formatSpecifier(e),e.type=`f`,e),{suffix:Ke[8+n/3]});return function(e){return i(r*e)}}return{format:newFormat,formatPrefix}}__name(locale_default,`default`);var V,qe;defaultLocale({thousands:`,`,grouping:[3],currency:[`$`,``]});function defaultLocale(e){return V=locale_default(e),qe=V.format,V.formatPrefix,V}var ECLGraph=class extends o.StateObject{wu;get properties(){return this.get()}get Name(){return this.get(`Name`)}get Label(){return this.get(`Label`)}get Type(){return this.get(`Type`)}get Complete(){return this.get(`Complete`)}get WhenStarted(){return this.get(`WhenStarted`)}get WhenFinished(){return this.get(`WhenFinished`)}get Time(){return this.get(`Time`)}get Running(){return this.get(`Running`)}get RunningId(){return this.get(`RunningId`)}get Failed(){return this.get(`Failed`)}constructor(e,t,n){super(),this.wu=e;let r=0;for(let e of n)if(e.GraphName===t.Name&&!e.HasSubGraphId){r=Math.round(e.Seconds*1e3)/1e3;break}this.set({Time:r,...t})}fetchScopeGraph(e){return e?this.wu.fetchGraphDetails([e],[`subgraph`]).then(e=>createGraph(e)):this.wu.fetchGraphDetails([this.Name],[`graph`]).then(e=>createGraph(e))}},GraphCache=class extends o.Cache{constructor(){super(e=>o.Cache.hash([e.Name]))}};function walkXmlJson$1(e,t,n){n||=[],n.push(e),t(e.name,e.$,e.children(),n),e.children().forEach(e=>{walkXmlJson$1(e,t,n)}),n.pop()}__name(walkXmlJson$1,`walkXmlJson`);function flattenAtt(e){let t={};return e.forEach(e=>{e.name===`att`&&(t[e.$.name]=e.$.value)}),t}var XGMMLGraph=class extends o.Graph{},XGMMLSubgraph=class extends o.Subgraph{},XGMMLVertex=class extends o.Vertex{},XGMMLEdge=class extends o.Edge{};function createXGMMLGraph(e,t){let n={},r={},i={},a=new XGMMLGraph(e=>e._.id),o=[a.root];return walkXmlJson$1(t,(e,t,a,s)=>{let c=o[o.length-1];switch(e){case`graph`:break;case`node`:if(a.length&&a[0].children().length&&a[0].children()[0].name===`graph`){let e=c.createSubgraph(flattenAtt(a));o.push(e),n[t.id]=e}let e=c.createVertex(flattenAtt(a));r[t.id]=e;break;case`edge`:let s=c.createEdge(r[t.source],r[t.target],flattenAtt(a));i[t.id]=s}}),a}var ScopeGraph=class extends o.Graph{},ScopeSubgraph=class extends o.Subgraph{},ScopeVertex=class extends o.Vertex{},ScopeEdge=class extends o.Edge{};function createGraph(e){let t={},n={},r={},i;for(let a of e)switch(a.ScopeType){case`graph`:i=new ScopeGraph(e=>e._.Id,a),t[a.ScopeName]=i.root;break;case`subgraph`:i||(i=new ScopeGraph(e=>e._.Id,a),t[a.ScopeName]=i.root);let e=a.parentScope().split(`:`),o=t[a.parentScope()];for(;e.length&&!o;)o=t[e.join(`:`)],e.pop();if(!o)console.warn(`Missing SG:Parent (${a.Id}): ${a.parentScope()}`);else{let e=o;t[a.ScopeName]=e.createSubgraph(a)}break;case`activity`:let s=t[a.parentScope()];s?r[a.ScopeName]=s.createVertex(a):console.warn(`Missing A:Parent (${a.Id}): ${a.parentScope()}`);break;case`edge`:n[a.ScopeName]=a;break;case`function`:let c=r[a.parentScope()];c?c._.children().push(a):console.warn(`Missing F:Parent (${a.Id}): ${a.parentScope()}`)}for(let e in n){let r=n[e],a=t[r.parentScope()];if(!a)console.warn(`Missing E:Parent (${r.Id}): ${r.parentScope()}`);else{let t=a;try{let e=i.vertex(r.attr(`IdSource`).RawValue),n=i.vertex(r.attr(`IdTarget`).RawValue);t.createEdge(e,n,r)}catch{console.warn(`Invalid Edge: ${e}`)}}}return i}var Resource=class extends o.StateObject{wu;get properties(){return this.get()}get URL(){return this.get(`URL`)}get DisplayName(){return this.get(`DisplayName`)}get DisplayPath(){return this.get(`DisplayPath`)}constructor(e,t){super(),this.wu=e;let n=t.split(`\\`).join(`/`),r=n.split(`/`),i=`res/`+this.wu.Wuid+`/`,a=``,o=``;n.indexOf(i)===0&&(a=n.substr(i.length),o=r[r.length-1]),this.set({URL:t,DisplayName:o,DisplayPath:a})}},XSDNode=class{e;constructor(e){this.e=e}fix(){delete this.e}},XSDXMLNode=class extends XSDNode{name;type;isSet=!1;attrs={};_children=[];constructor(e){super(e)}append(e){this._children.push(e),this.type||=`hpcc:childDataset`}fix(){this.name=this.e.$.name,this.type=this.e.$.type;for(let e=this._children.length-1;e>=0;--e){let t=this._children[e];t.name===`Row`&&t.type===void 0&&(this._children.push(...t._children),this._children.splice(e,1))}let e=this.setOfType();e&&(this.type=e,this.isSet=!0,this._children=[])}children(){return this._children}isAll(e){return e.name===`All`&&e.type===void 0}setOfType(){let e=this.children();if(this.type===void 0&&e.length===2){if(this.isAll(e[0]))return e[1].type;if(this.isAll(e[1]))return e[0].type}}charWidth(){let e=-1;switch(this.type){case`xs:boolean`:e=5;break;case`xs:integer`:e=8;break;case`xs:nonNegativeInteger`:e=8;break;case`xs:double`:e=8;break;case`xs:string`:e=32;break;default:let t=this.type.lastIndexOf(`_`),n=t>0?t:this.type.length,r=n-1;for(;r>=0&&`0123456789`.indexOf(this.type.charAt(r))!==-1;--r);r+1<n&&(e=parseInt(this.type.substring(r+1,n),10)),this.type.indexOf(`data`)===0&&(e*=2)}return e<this.name.length&&(e=this.name.length),e}},XSDSimpleType=class extends XSDNode{name;type;maxLength;_restricition;_maxLength;constructor(e){super(e)}append(e){switch(e.name){case`xs:restriction`:this._restricition=e;break;case`xs:maxLength`:this._maxLength=e}}fix(){this.name=this.e.$.name,this.type=this._restricition.$.base,this.maxLength=this._maxLength?+this._maxLength.$.value:void 0,delete this._restricition,delete this._maxLength,super.fix()}},XSDSchema=class{root;simpleTypes={};fields(){return this.root.children()}},XSDParser=class extends o.SAXStackParser{schema=new XSDSchema;simpleType;simpleTypes={};xsdStack=new o.Stack;startXMLNode(e){switch(super.startXMLNode(e),e.name){case`xs:element`:let t=new XSDXMLNode(e);this.schema.root?this.xsdStack.depth()&&this.xsdStack.top().append(t):this.schema.root=t,this.xsdStack.push(t);break;case`xs:simpleType`:this.simpleType=new XSDSimpleType(e)}}endXMLNode(e){switch(e.name){case`xs:element`:this.xsdStack.pop().fix();break;case`xs:simpleType`:this.simpleType.fix(),this.simpleTypes[this.simpleType.name]=this.simpleType,delete this.simpleType;break;case`xs:appinfo`:let t=this.xsdStack.top();for(let n in e.$)t.attrs[n]=e.$[n];break;default:this.simpleType&&this.simpleType.append(e)}super.endXMLNode(e)}};function parseXSD(e){let t=new XSDParser;return t.parse(e),t.schema}var XSDParser2=class extends XSDParser{_rootName;schema=new XSDSchema;simpleTypes={};xsdStack=new o.Stack;constructor(e){super(),this._rootName=e}startXMLNode(e){switch(super.startXMLNode(e),e.name){case`xsd:element`:let t=new XSDXMLNode(e);!this.schema.root&&this._rootName===e.$.name&&(this.schema.root=t),this.xsdStack.depth()&&this.xsdStack.top().append(t),this.xsdStack.push(t);break;case`xsd:simpleType`:this.simpleType=new XSDSimpleType(e)}}endXMLNode(e){e.name===`xsd:element`&&this.xsdStack.pop().fix(),super.endXMLNode(e)}};function parseXSD2(e,t){let n=new XSDParser2(t);return n.parse(e),n.schema}var GlobalResultCache=class extends o.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Wuid}-${e.ResultName}`)}},H=new GlobalResultCache,Je=class Result extends o.StateObject{connection;_bypassCache=!1;get BaseUrl(){return this.connection.baseUrl}xsdSchema;get properties(){return this.get()}get Wuid(){return this.get(`Wuid`)}get ResultName(){return this.get(`ResultName`)}get ResultSequence(){return this.get(`ResultSequence`)}get LogicalFileName(){return this.get(`LogicalFileName`)}get Name(){return this.get(`Name`)}get Sequence(){return this.get(`Sequence`)}get Value(){return this.get(`Value`)}get Link(){return this.get(`Link`)}get FileName(){return this.get(`FileName`)}get IsSupplied(){return this.get(`IsSupplied`)}get ShowFileContent(){return this.get(`ShowFileContent`)}get Total(){return this.get(`Total`)}get ECLSchemas(){return this.get(`ECLSchemas`)}get NodeGroup(){return this.get(`NodeGroup`)}get ResultViews(){return this.get(`ResultViews`)}get XmlSchema(){return this.get(`XmlSchema`)}static attach(e,t,n,r){let i;return Array.isArray(r)?(i=H.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:n.Name},()=>new Result(e,t,n,r)),i.set(n)):r===void 0&&(typeof n==`number`?i=H.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:`Sequence_`+n},()=>new Result(e,t,n)):typeof n==`string`&&(i=H.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:n},()=>new Result(e,t,n)))),i}static attachLogicalFile(e,t,n){return H.get({BaseUrl:e.baseUrl,Wuid:t,ResultName:n},()=>new Result(e,t,n,!0))}constructor(e,t,n,r){super(),this.connection=e instanceof WorkunitsService?e:new WorkunitsService(e),typeof r==`boolean`&&r===!0?this.set({NodeGroup:t,LogicalFileName:n}):isECLResult(n)&&Array.isArray(r)?this.set({...n,Wuid:t,ResultName:n.Name,ResultViews:r}):r===void 0?typeof n==`number`?this.set({Wuid:t,ResultSequence:n}):typeof n==`string`?this.set({Wuid:t,ResultName:n}):console.warn(`Unknown Result.attach (1)`):console.warn(`Unknown Result.attach (2)`)}isComplete(){return this.Total!==-1}bypassCache(e){return e===void 0?this._bypassCache:(this._bypassCache=e,this)}_fetchXMLSchemaPromise;fetchXMLSchema(e=!1){return(!this._fetchXMLSchemaPromise||e)&&(this._fetchXMLSchemaPromise=this.WUResult().then(e=>e.Result?.XmlSchema?.xml?(this.xsdSchema=parseXSD(e.Result.XmlSchema.xml),this.xsdSchema):null)),this._fetchXMLSchemaPromise}async refresh(){return await this.fetchRows(0,1,!0),this}fetchRows(e=0,t=-1,n=!1,r={},i,a){let s=a??this._bypassCache;return this.WUResult(e,t,!n,r,i,s).then(e=>{let t=e.Result;return delete e.Result,this.set({...e}),(0,o.exists)(`XmlSchema.xml`,t)&&(this.xsdSchema=parseXSD(t.XmlSchema.xml)),(0,o.exists)(`Row`,t)?t.Row:this.ResultName&&(0,o.exists)(this.ResultName,t)?t[this.ResultName].Row:[]})}rootField(){return this.xsdSchema?this.xsdSchema.root:null}fields(){return this.xsdSchema?this.xsdSchema.root.children():[]}WUResult(e=0,t=1,n=!1,r={},i,a=!1){let o={NamedValue:{itemcount:0}};for(let e in r)o.NamedValue[o.NamedValue.itemcount++]={Name:e,Value:r[e]};let s={FilterBy:o};return this.Wuid&&this.ResultName!==void 0?(s.Wuid=this.Wuid,s.ResultName=this.ResultName):this.Wuid&&this.ResultSequence!==void 0?(s.Wuid=this.Wuid,s.Sequence=this.ResultSequence):this.LogicalFileName&&this.NodeGroup?(s.LogicalName=this.LogicalFileName,s.Cluster=this.NodeGroup):this.LogicalFileName&&(s.LogicalName=this.LogicalFileName),s.Start=e,s.Count=t,s.SuppressXmlSchema=n,s.BypassCachedResult=a,this.connection.WUResult(s,i).then(e=>e)}},ResultCache=class extends o.Cache{constructor(){super(e=>o.Cache.hash([e.Sequence,e.Name,e.Value,e.FileName]))}},Attribute=class extends o.StateObject{scope;get properties(){return this.get()}get Name(){return this.get(`Name`)}get RawValue(){return this.get(`RawValue`)}get Formatted(){return this.get(`Formatted`)}get FormattedEnd(){return this.get(`FormattedEnd`)}get Measure(){return this.get(`Measure`)}get Creator(){return this.get(`Creator`)}get CreatorType(){return this.get(`CreatorType`)}constructor(e,t){super(),this.scope=e,this.set(t)}},BaseScope=class extends o.StateObject{_attributeMap={};_children=[];get properties(){return this.get()}get ScopeName(){return this.get(`ScopeName`)}get Id(){return this.get(`Id`)}get ScopeType(){return this.get(`ScopeType`)}get Properties(){return this.get(`Properties`,{Property:[]})}get Notes(){return this.get(`Notes`,{Note:[]})}get SinkActivity(){return this.get(`SinkActivity`)}get CAttributes(){let e=[],t={start:null,end:null};return this.Properties.Property.forEach(n=>{n.Measure===`ts`&&n.Name.indexOf(`Started`)>=0?t.start=n:this.ScopeName&&n.Measure===`ts`&&n.Name.indexOf(`Finished`)>=0?t.end=n:e.push(new Attribute(this,n))}),t.start&&t.end?(t.start.FormattedEnd=t.end.Formatted,e.push(new Attribute(this,t.start))):t.start?e.push(new Attribute(this,t.start)):t.end&&e.push(new Attribute(this,t.end)),e}constructor(e){super(),this.update(e)}update(e){this.set(e),this.CAttributes.forEach(e=>{this._attributeMap[e.Name]=e}),this.Properties.Property=[];for(let e in this._attributeMap)this._attributeMap.hasOwnProperty(e)&&this.Properties.Property.push(this._attributeMap[e].properties)}parentScope(){let e=this.ScopeName.split(`:`);return e.pop(),e.join(`:`)}children(e){return arguments.length?(this._children=e,this):this._children}walk(e){if(e.start(this))return!0;for(let t of this.children())if(t.walk(e))return!0;return e.end(this)}formattedAttrs(){let e={};for(let t in this._attributeMap)e[t]=this._attributeMap[t].Formatted||this._attributeMap[t].RawValue;return e}rawAttrs(){let e={};for(let t in this._attributeMap)e[t]=this._attributeMap[t].RawValue;return e}hasAttr(e){return this._attributeMap[e]!==void 0}attr(e){return this._attributeMap[e]||new Attribute(this,{Creator:``,CreatorType:``,Formatted:``,Measure:``,Name:``,RawValue:``})}attrMeasure(e){return this._attributeMap[e].Measure}calcTooltip(e){let t=this.Id,n=[];n.push(`<tr><td class="key">ID:</td><td class="value">${this.Id}</td></tr>`),e&&n.push(`<tr><td class="key">Parent ID:</td><td class="value">${e.Id}</td></tr>`),n.push(`<tr><td class="key">Scope:</td><td class="value">${this.ScopeName}</td></tr>`);let r=this.formattedAttrs();for(let e in r)e===`Label`?t=r[e]:n.push(`<tr><td class="key">${e}</td><td class="value">${r[e]}</td></tr>`);return`<div class="eclwatch_WUGraph_Tooltip" style="max-width:480px">
911
911
  <h4 align="center">${t}</h4>
912
912
  <table>
913
- ${r.join("")}
913
+ ${n.join(``)}
914
914
  </table>
915
- </div>`}},Je=class extends ys{wu;constructor(e,t){super(t),this.wu=e}};var ii=require("@hpcc-js/util");var Tt=class extends ii.StateObject{connection;get properties(){return this.get()}get Wuid(){return this.get("Wuid")}get FileCluster(){return this.get("FileCluster")}get Name(){return this.get("Name")}get IsSuperFile(){return this.get("IsSuperFile")}get Subs(){return this.get("Subs")}get Count(){return this.get("Count")}get ECLSourceFiles(){return this.get("ECLSourceFiles")}constructor(e,t,r){super(),e instanceof L?this.connection=e:this.connection=new L(e),this.set({Wuid:t,...r})}};var bs=require("@hpcc-js/util");var Mt=class extends bs.StateObject{connection;get properties(){return this.get()}get Wuid(){return this.get("Wuid")}get Name(){return this.get("Name")}get Value(){return this.get("Value")}get Seconds(){return this.get("Seconds")}get GraphName(){return this.get("GraphName")}get SubGraphId(){return this.get("SubGraphId")}get HasSubGraphId(){return this.get("HasSubGraphId")}get count(){return this.get("count")}get Timestamp(){return this.get("Timestamp")}get When(){return this.get("When")}constructor(e,t,r){super(),e instanceof L?this.connection=e:this.connection=new L(e);let n=(0,bs.espTime2Seconds)(r.Value);this.set({Wuid:t,Seconds:Math.round(n*1e3)/1e3,HasSubGraphId:r.SubGraphId!==void 0,...r})}};var La=ps("%Y-%m-%dT%H:%M:%S.%LZ"),Ga=gs("%Y-%m-%dT%H:%M:%S.%LZ"),ka=qe(",");function va(s){return s&&!isNaN(+s)?ka(+s):s}var oi="DefinitionList",Va=/([a-zA-Z]:)?(.*[\\\/])(.*)(\((\d+),(\d+)\))/,ci=["Avg","Min","Max","Delta","StdDev"],ui=["SkewMin","SkewMax","NodeMin","NodeMax"],Ha=/[A-Z][a-z]*/g;function ja(s){for(let t of ui){let r=s.indexOf(t);if(r===0){let i=s.slice(r+t.length);return{measure:"",ext:t,label:i}}}let e=s.match(Ha);if(e?.length){let t=e.shift(),r=e.join("");for(let n of ci){let i=r.indexOf(n);if(i===0)return r=r.slice(i+n.length),{measure:t,ext:n,label:r}}return{measure:t,ext:"",label:r}}return{measure:"",ext:"",label:s}}var ai={};function li(s){let e=ai[s];return e||(e=ja(s),ai[s]=e),e}function re(s,e){return s.__formattedProps?.[e]??s[e]}function Us(s){if(s===void 0)return;let e=parseFloat(s);return isNaN(e)?void 0:e}function _a(s,e,t){let r=li(e);if(!t[r.measure]){t[r.label]=!0;let n=Us(s[`${r.measure}Avg${r.label}`]),i=Us(s[`${r.measure}Min${r.label}`]),o=Us(s[`${r.measure}Max${r.label}`]),a=Us(s[`${r.measure}StdDev${r.label}`]),c=Math.max((n-i)/a,(o-n)/a);return{Key:`${r.measure}${r.label}`,Value:re(s,`${r.measure}${r.label}`),Avg:re(s,`${r.measure}Avg${r.label}`),Min:re(s,`${r.measure}Min${r.label}`),Max:re(s,`${r.measure}Max${r.label}`),Delta:re(s,`${r.measure}Delta${r.label}`),StdDev:re(s,`${r.measure}StdDev${r.label}`),StdDevs:isNaN(c)?void 0:c,SkewMin:re(s,`SkewMin${r.label}`),SkewMax:re(s,`SkewMax${r.label}`),NodeMin:re(s,`NodeMin${r.label}`),NodeMax:re(s,`NodeMax${r.label}`)}}return null}var Es=(0,K.scopedLogger)("workunit.ts"),Ps=class extends K.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Wuid}`)}},Fs=new Ps,Ee=class s extends K.StateObject{connection;topologyConnection;get BaseUrl(){return this.connection.baseUrl}_debugMode=!1;_debugAllGraph;_submitAction;get properties(){return this.get()}get Wuid(){return this.get("Wuid")}get Owner(){return this.get("Owner","")}get Cluster(){return this.get("Cluster","")}get Jobname(){return this.get("Jobname","")}get Description(){return this.get("Description","")}get ActionEx(){return this.get("ActionEx","")}get StateID(){return this.get("StateID",0)}get State(){return this.get("State")||Ss[this.StateID]}get Protected(){return this.get("Protected",!1)}get Exceptions(){return this.get("Exceptions",{ECLException:[]})}get ResultViews(){return this.get("ResultViews",{View:[]})}_resultCache=new It;get ResultCount(){return this.get("ResultCount",0)}get Results(){return this.get("Results",{ECLResult:[]})}get CResults(){return this.Results.ECLResult.map(e=>this._resultCache.get(e,()=>Pt.attach(this.connection,this.Wuid,e,this.ResultViews.View)))}get SequenceResults(){let e={};return this.CResults.forEach(t=>{e[t.Sequence]=t}),e}get Timers(){return this.get("Timers",{ECLTimer:[]})}get CTimers(){return this.Timers.ECLTimer.map(e=>new Mt(this.connection,this.Wuid,e))}_graphCache=new Ct;get GraphCount(){return this.get("GraphCount",0)}get Graphs(){return this.get("Graphs",{ECLGraph:[]})}get CGraphs(){return this.Graphs.ECLGraph.map(e=>this._graphCache.get(e,()=>new Rt(this,e,this.CTimers)))}get ThorLogList(){return this.get("ThorLogList")}get ResourceURLCount(){return this.get("ResourceURLCount",0)}get ResourceURLs(){return this.get("ResourceURLs",{URL:[]})}get CResourceURLs(){return this.ResourceURLs.URL.map(e=>new Wt(this,e))}get TotalClusterTime(){return this.get("TotalClusterTime","")}get DateTimeScheduled(){return this.get("DateTimeScheduled")}get IsPausing(){return this.get("IsPausing")}get ThorLCR(){return this.get("ThorLCR")}get ApplicationValues(){return this.get("ApplicationValues",{ApplicationValue:[]})}get HasArchiveQuery(){return this.get("HasArchiveQuery")}get StateEx(){return this.get("StateEx")}get PriorityClass(){return this.get("PriorityClass")}get PriorityLevel(){return this.get("PriorityLevel")}get Snapshot(){return this.get("Snapshot")}get ResultLimit(){return this.get("ResultLimit")}get EventSchedule(){return this.get("EventSchedule")}get Query(){return this.get("Query")}get HelpersCount(){return this.get("HelpersCount",0)}get Helpers(){return this.get("Helpers",{ECLHelpFile:[]})}get DebugValues(){return this.get("DebugValues")}get AllowedClusters(){return this.get("AllowedClusters")}get ErrorCount(){return this.get("ErrorCount",0)}get WarningCount(){return this.get("WarningCount",0)}get InfoCount(){return this.get("InfoCount",0)}get AlertCount(){return this.get("AlertCount",0)}get SourceFileCount(){return this.get("SourceFileCount",0)}get SourceFiles(){return this.get("SourceFiles",{ECLSourceFile:[]})}get CSourceFiles(){return this.SourceFiles.ECLSourceFile.map(e=>new Tt(this.connection,this.Wuid,e))}get VariableCount(){return this.get("VariableCount",0)}get Variables(){return this.get("Variables",{ECLResult:[]})}get TimerCount(){return this.get("TimerCount",0)}get HasDebugValue(){return this.get("HasDebugValue")}get ApplicationValueCount(){return this.get("ApplicationValueCount",0)}get XmlParams(){return this.get("XmlParams")}get AccessFlag(){return this.get("AccessFlag")}get ClusterFlag(){return this.get("ClusterFlag")}get ResultViewCount(){return this.get("ResultViewCount",0)}get DebugValueCount(){return this.get("DebugValueCount",0)}get WorkflowCount(){return this.get("WorkflowCount",0)}get Archived(){return this.get("Archived")}get RoxieCluster(){return this.get("RoxieCluster")}get DebugState(){return this.get("DebugState",{})}get Queue(){return this.get("Queue")}get Active(){return this.get("Active")}get Action(){return this.get("Action")}get Scope(){return this.get("Scope")}get AbortBy(){return this.get("AbortBy")}get AbortTime(){return this.get("AbortTime")}get AbortReason(){return this.get("AbortReason")}get Workflows(){return this.get("Workflows")}get TimingData(){return this.get("TimingData")}get HelpersDesc(){return this.get("HelpersDesc")}get GraphsDesc(){return this.get("GraphsDesc")}get SourceFilesDesc(){return this.get("SourceFilesDesc")}get ResultsDesc(){return this.get("ResultsDesc")}get VariablesDesc(){return this.get("VariablesDesc")}get TimersDesc(){return this.get("TimersDesc")}get DebugValuesDesc(){return this.get("DebugValuesDesc")}get ApplicationValuesDesc(){return this.get("ApplicationValuesDesc")}get WorkflowsDesc(){return this.get("WorkflowsDesc")}get ServiceNames(){return this.get("ServiceNames")}get CompileCost(){return this.get("CompileCost")}get ExecuteCost(){return this.get("ExecuteCost")}get FileAccessCost(){return this.get("FileAccessCost")}get NoAccess(){return this.get("NoAccess")}get ECLWUProcessList(){return this.get("ECLWUProcessList")}get CostSavingPotential(){return this.get("CostSavingPotential")}get FailureDesc(){return this.get("FailureDesc")}get FileSummaries(){return this.get("FileSummaries")}static create(e){let t=new s(e);return t.connection.WUCreate().then(r=>(Fs.set(t),t.set(r.Workunit),t))}static attach(e,t,r){let n=Fs.get({BaseUrl:e.baseUrl,Wuid:t},()=>new s(e,t));return r&&n.set(r),n}static existsLocal(e,t){return Fs.has({BaseUrl:e,Wuid:t})}static submit(e,t,r,n=!1){return s.create(e).then(i=>i.update({QueryText:r})).then(i=>n?i.submit(t,he.Action.Compile):i.submit(t))}static compile(e,t,r){return s.submit(e,t,r,!0)}static query(e,t){return new L(e).WUQuery(t).then(n=>n.Workunits.ECLWorkunit.map(function(i){return s.attach(e,i.Wuid,i)}))}constructor(e,t){super(),this.connection=new L(e),this.topologyConnection=new G(e),this.clearState(t)}clearState(e){this.clear({Wuid:e,StateID:0})}update(e){return this.connection.WUUpdate({...e,Wuid:this.Wuid,StateOrig:this.StateID,JobnameOrig:this.Jobname,DescriptionOrig:this.Description,ProtectedOrig:this.Protected,ClusterOrig:this.Cluster}).then(t=>(this.set(t.Workunit),this))}submit(e,t=he.Action.Run,r){let n;return e!==void 0?n=Promise.resolve(e):n=this.topologyConnection.DefaultTpLogicalClusterQuery().then(i=>i.Name),this._debugMode=!1,t===he.Action.Debug&&(t=he.Action.Run,this._debugMode=!0),n.then(i=>this.connection.WUUpdate({Wuid:this.Wuid,Action:t,ResultLimit:r,DebugValues:{DebugValue:[{Name:"Debug",Value:this._debugMode?"1":""}]}}).then(o=>(this.set(o.Workunit),this._submitAction=t,this.connection.WUSubmit({Wuid:this.Wuid,Cluster:i})))).then(()=>this)}isComplete(){switch(this.StateID){case 1:return this.ActionEx==="compile"||this._submitAction===he.Action.Compile;case 3:case 4:case 7:case 999:return!0;default:}return!1}isFailed(){switch(this.StateID){case 7:case 4:return!0;default:}return!1}isDeleted(){return this.StateID===999}isDebugging(){switch(this.StateID){case 14:case 15:return!0;default:}return this._debugMode}isRunning(){switch(this.StateID){case 1:case 2:case 6:case 8:case 14:case 15:return!0;default:}return!1}setToFailed(){return this.WUAction(V.ECLWUActions.SetToFailed)}pause(){return this.WUAction(V.ECLWUActions.Pause)}pauseNow(){return this.WUAction(V.ECLWUActions.PauseNow)}resume(){return this.WUAction(V.ECLWUActions.Resume)}abort(){return this.WUAction(V.ECLWUActions.Abort)}protect(){return this.WUAction(V.ECLWUActions.Protect)}unprotect(){return this.WUAction(V.ECLWUActions.Unprotect)}delete(){return this.WUAction(V.ECLWUActions.Delete)}restore(){return this.WUAction(V.ECLWUActions.Restore)}deschedule(){return this.WUAction(V.ECLWUActions.Deschedule)}reschedule(){return this.WUAction(V.ECLWUActions.Reschedule)}recover(){return this.WUResubmit({CloneWorkunit:!1,ResetWorkflow:!1}).then(()=>(this.clearState(this.Wuid),this.refresh().then(()=>(this._monitor(),this))))}resubmit(){return this.WUResubmit({CloneWorkunit:!1,ResetWorkflow:!0}).then(()=>(this.clearState(this.Wuid),this.refresh().then(()=>(this._monitor(),this))))}clone(){return this.WUResubmit({CloneWorkunit:!0,ResetWorkflow:!1}).then(e=>s.attach(this.connection.opts(),e.WUs.WU[0].WUID).refresh())}async refreshState(){return await this.WUQuery(),this.StateID===1&&!this.ActionEx&&!this._submitAction&&await this.refreshInfo(),this}async refreshInfo(e){return await this.WUInfo(e),this}async refreshDebug(){return await this.debugStatus(),this}async refresh(e=!1,t){return e?await Promise.all([this.refreshInfo(t),this.refreshDebug()]):await this.refreshState(),this}eclExceptions(){return this.Exceptions.ECLException}fetchArchive(){return this.connection.WUFileEx({Wuid:this.Wuid,Type:"ArchiveQuery"})}fetchECLExceptions(){return this.WUInfo({IncludeExceptions:!0}).then(()=>this.eclExceptions())}fetchResults(){return this.WUInfo({IncludeResults:!0}).then(()=>this.CResults)}fetchGraphs(){return this.WUInfo({IncludeGraphs:!0}).then(()=>this.CGraphs)}fetchQuery(){return this.WUInfo({IncludeECL:!0,TruncateEclTo64k:!1}).then(()=>this.Query)}fetchHelpers(){return this.WUInfo({IncludeHelpers:!0}).then(()=>this.Helpers?.ECLHelpFile||[])}fetchAllowedClusters(){return this.WUInfo({IncludeAllowedClusters:!0}).then(()=>this.AllowedClusters?.AllowedCluster||[])}fetchTotalClusterTime(){return this.WUInfo({IncludeTotalClusterTime:!0}).then(()=>this.TotalClusterTime)}fetchServiceNames(){return this.WUInfo({IncludeServiceNames:!0}).then(()=>this.ServiceNames?.Item)}fetchDetailsMeta(e={}){return this.WUDetailsMeta(e)}fetchDetailsRaw(e={},t,r){return this.WUDetails(e,t,r).then(n=>{switch(r){case"arraybuffer":return n;case"text":case"xsd":return n;default:return n.Scopes.Scope}})}normalizeDetails(e,t){let r={id:{Measure:"label"},name:{Measure:"label"},type:{Measure:"label"}},n=new Map;for(let o of e.Activities?.Activity??[])n.set(o.Kind,o.Name);let i=new Array(t.length);for(let o=0;o<t.length;o++){let a=t[o],c={},l={};if(a.Properties?.Property)for(let A of a.Properties.Property){let b=A.Measure,I=A.Name,R=A.RawValue;if(b==="ns"&&(A.Measure="s"),I==="Kind"){let S=parseInt(R,10);A.Formatted=n.get(S)??R}switch(r[I]={Name:A.Name,Measure:A.Measure,Creator:A.Creator,CreatorType:A.CreatorType},A.Measure){case"bool":c[I]=!!+R;break;case"sz":c[I]=+R;break;case"s":c[I]=+R/1e9;break;case"ns":c[I]=+R;break;case"ts":c[I]=new Date(+R/1e3).toISOString();break;case"cnt":c[I]=+R;break;case"cost":c[I]=+R/1e6;break;case"node":c[I]=+R;break;case"skw":c[I]=+R;break;default:c[I]=R}l[I]=va(A.Formatted??c[I])}let u={id:a.Id,name:a.ScopeName,type:a.ScopeType,Kind:a.Kind,Label:a.Label,__formattedProps:l,__groupedProps:{},__groupedRawProps:{},__StdDevs:0,__StdDevsSource:"",...c},g=u[oi];if(g)try{let A=JSON.parse(g.split("\\").join("\\\\")),b=[];for(let I=0;I<A.length;I++){let R=A[I].match(Va);R&&b.push({filePath:(R[1]??"")+R[2]+R[3],line:parseInt(R[5],10),col:parseInt(R[6],10)})}u[oi]=b}catch{Es.error(`Unexpected "DefinitionList": ${g}`)}let p={},f=0,D="";for(let A in u)if(!A.startsWith("__")){let b=_a(u,A,p);b&&(u.__groupedProps[b.Key]=b,!isNaN(b.StdDevs)&&b.StdDevs>f&&(f=b.StdDevs,D=b.Key))}u.__StdDevs=f,u.__StdDevsSource=D,i[o]=u}return{meta:e,columns:r,data:i}}fetchDetailsNormalized(e={}){return Promise.all([this.fetchDetailsMeta(),this.fetchDetailsRaw(e)]).then(t=>this.normalizeDetails(t[0],t[1]))}fetchInfo(e={}){return this.WUInfo(e)}fetchDetails(e={},t,r){return this.WUDetails(e,t,r).then(n=>{switch(r){case"arraybuffer":return n;case"text":case"xsd":return n;default:return n.Scopes.Scope.map(i=>new Je(this,i))}})}fetchDetailsHierarchy(e={}){return this.WUDetails(e).then(t=>{let r=[],n={};t.Scopes.Scope.forEach(i=>{if(n[i.ScopeName])return n[i.ScopeName].update(i),null;{let o=new Je(this,i);return n[o.ScopeName]=o,o}});for(let i in n)if(n.hasOwnProperty(i)){let o=n[i],a=o.parentScope();a&&n[a]?n[a].children().push(o):r.push(o)}return r})}fetchGraphDetails(e=[],t){return this.fetchDetails({ScopeFilter:{MaxDepth:999999,Ids:e,ScopeTypes:t},NestedFilter:{Depth:999999,ScopeTypes:["graph","subgraph","activity","edge","function"]},PropertiesToReturn:{AllStatistics:!0,AllAttributes:!0,AllHints:!0,AllProperties:!0,AllScopes:!0},ScopeOptions:{IncludeId:!0,IncludeScope:!0,IncludeScopeType:!0},PropertyOptions:{IncludeName:!0,IncludeRawValue:!0,IncludeFormatted:!0,IncludeMeasure:!0,IncludeCreator:!1,IncludeCreatorType:!1}})}fetchScopeGraphs(e=[]){return this.fetchGraphDetails(e,["graph"]).then(t=>At(t))}fetchTimeElapsed(){return this.fetchDetails({ScopeFilter:{PropertyFilters:{PropertyFilter:[{Name:"TimeElapsed"}]}}}).then(e=>{let t={};e.forEach(n=>{t[n.ScopeName]=t[n.ScopeName]||{scope:n.ScopeName,start:null,elapsed:null,finish:null},n.CAttributes.forEach(i=>{i.Name==="TimeElapsed"?t[n.ScopeName].elapsed=+i.RawValue:i.Measure==="ts"&&i.Name.indexOf("Started")>=0&&(t[n.ScopeName].start=i.Formatted)})});let r=[];for(let n in t){let i=t[n];if(i.start&&i.elapsed){let o=Ga(i.start);o.setMilliseconds(o.getMilliseconds()+i.elapsed/1e6),i.finish=La(o),r.push(i)}}return r.sort((n,i)=>n.start<i.start?-1:n.start>i.start?1:0),r})}_monitor(){if(this.isComplete()){this._monitorTickCount=0;return}super._monitor()}_monitorTimeoutDuration(){let e=super._monitorTimeoutDuration();return this._monitorTickCount<=1?1e3:this._monitorTickCount<=3?3e3:this._monitorTickCount<=5?5e3:this._monitorTickCount<=7?1e4:e}on(e,t,r){if(this.isCallback(t))switch(e){case"completed":super.on("propChanged","StateID",n=>{this.isComplete()&&t([n])});break;case"changed":super.on(e,t);break;default:}else e==="changed"&&super.on(e,t,r);return this._monitor(),this}watchUntilComplete(e){return new Promise((t,r)=>{let n=this.watch(i=>{e&&e(i),this.isComplete()&&(n.release(),t(this))})})}watchUntilRunning(e){return new Promise((t,r)=>{let n=this.watch(i=>{e&&e(i),(this.isComplete()||this.isRunning())&&(n.release(),t(this))})})}WUQuery(e={}){return this.connection.WUQuery({...e,Wuid:this.Wuid}).then(t=>(t.Workunits.ECLWorkunit.length===0?(this.clearState(this.Wuid),this.set("StateID",999)):this.set(t.Workunits.ECLWorkunit[0]),t)).catch(t=>{if(!t.Exception.some(n=>n.Code===20081?(this.clearState(this.Wuid),this.set("StateID",999),!0):!1))throw Es.warning(`Unexpected ESP exception: ${t.message}`),t;return{}})}WUCreate(){return this.connection.WUCreate().then(e=>(this.set(e.Workunit),Fs.set(this),e))}WUInfo(e={}){let t=e.IncludeResults||e.IncludeResultsViewNames;return this.connection.WUInfo({...e,Wuid:this.Wuid,IncludeResults:t,IncludeResultsViewNames:t,SuppressResultSchemas:!1}).then(r=>(this.set(r.Workunit),t&&this.set({ResultViews:r.ResultViews}),r)).catch(r=>{if(!r.Exception.some(i=>i.Code===20080?(this.clearState(this.Wuid),this.set("StateID",999),!0):!1))throw Es.warning(`Unexpected ESP exception: ${r.message}`),r;return{}})}WUResubmit(e){return this.connection.WUResubmit((0,K.deepMixinT)({},e,{Wuids:{Item:[this.Wuid]}}))}WUDetailsMeta(e){return this.connection.WUDetailsMeta(e)}WUDetails(e,t,r){return this.connection.WUDetailsEx((0,K.deepMixinT)({ScopeFilter:{MaxDepth:9999},ScopeOptions:{IncludeMatchedScopesInResults:!0,IncludeScope:!0,IncludeId:!1,IncludeScopeType:!1},PropertyOptions:{IncludeName:!0,IncludeRawValue:!1,IncludeFormatted:!0,IncludeMeasure:!0,IncludeCreator:!1,IncludeCreatorType:!1}},e,{WUID:this.Wuid}),t,r).then(n=>{switch(r){case"arraybuffer":case"text":case"xsd":return n;default:return n.Scopes===void 0?n.Scopes={Scope:[]}:n.Scopes.Scope===void 0&&(n.Scopes.Scope=[]),n}})}WUAction(e){return this.connection.WUAction({Wuids:{Item:[this.Wuid]},WUActionType:e}).then(t=>this.refresh().then(()=>(this._monitor(),t)))}publish(e){return this.connection.WUPublishWorkunit({Wuid:this.Wuid,Cluster:this.Cluster,JobName:e||this.Jobname,AllowForeignFiles:!0,Activate:V.WUQueryActivationMode.ActivateQuery,Wait:5e3})}publishEx(e){let t=new ft({baseUrl:""}),r={Wuid:this.Wuid,Cluster:this.Cluster,JobName:this.Jobname,AllowForeignFiles:!0,Activate:1,Wait:5e3,...e};return t.WUPublishWorkunitEx(r)}WUCDebug(e,t={}){let r="";for(let n in t)t.hasOwnProperty(n)&&(r+=` ${n}='${t[n]}'`);return this.connection.WUCDebugEx({Wuid:this.Wuid,Command:`<debug:${e} uid='${this.Wuid}'${r}/>`}).then(n=>n)}debug(e,t){return this.isDebugging()?this.WUCDebug(e,t).then(r=>{let n=r.children(e);return n.length?n[0]:new K.XMLNode(e)}).catch(r=>(Es.error(r),Promise.resolve(new K.XMLNode(e)))):Promise.resolve(new K.XMLNode(e))}debugStatus(){return this.isDebugging()?this.debug("status").then(e=>{let t={...this.DebugState,...e.$};return this.set({DebugState:t}),e}):Promise.resolve({DebugState:{state:"unknown"}})}debugContinue(e=""){return this.debug("continue",{mode:e})}debugStep(e){return this.debug("step",{mode:e})}debugPause(){return this.debug("interrupt")}debugQuit(){return this.debug("quit")}debugDeleteAllBreakpoints(){return this.debug("delete",{idx:0})}debugBreakpointResponseParser(e){return e.children().map(t=>{if(t.name==="break")return t.$})}debugBreakpointAdd(e,t,r){return this.debug("breakpoint",{id:e,mode:t,action:r}).then(n=>this.debugBreakpointResponseParser(n))}debugBreakpointList(){return this.debug("list").then(e=>this.debugBreakpointResponseParser(e))}debugGraph(){return this._debugAllGraph&&this.DebugState._prevGraphSequenceNum===this.DebugState.graphSequenceNum?Promise.resolve(this._debugAllGraph):this.debug("graph",{name:"all"}).then(e=>(this.DebugState._prevGraphSequenceNum=this.DebugState.graphSequenceNum,this._debugAllGraph=Qr(this.Wuid,e),this._debugAllGraph))}debugBreakpointValid(e){return this.debugGraph().then(t=>Xa(t,e))}debugPrint(e,t=0,r=10){return this.debug("print",{edgeID:e,startRow:t,numRows:r}).then(n=>n.children().map(i=>{let o={};return i.children().forEach(a=>{o[a.name]=a.content}),o}))}},kr="definition";function Oa(s){return s._[kr]!==void 0}function Ya(s){let e=/([a-z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(s._[kr]);if(e){let[,t,r,n]=e;return t.replace(/\/\.\//g,"/"),{id:s._.id,file:t,line:+r,column:+n}}throw new Error(`Bad definition: ${s._[kr]}`)}function Xa(s,e){let t=[];for(let r of s.vertices)if(Oa(r)){let n=Ya(r);(n&&!e||e===n.file)&&t.push(n)}return t.sort((r,n)=>r.line-n.line)}var Is,vr=class s extends Ts.StateObject{connection;get properties(){return this.get()}get Exceptions(){return this.get("Exceptions")}get Build(){return this.get("Build")}get ThorClusterList(){return this.get("ThorClusterList")}get RoxieClusterList(){return this.get("RoxieClusterList")}get HThorClusterList(){return this.get("HThorClusterList")}get DFUJobs(){return this.get("DFUJobs")}get Running(){return this.get("Running",{ActiveWorkunit:[]})}get BannerContent(){return this.get("BannerContent")}get BannerColor(){return this.get("BannerColor")}get BannerSize(){return this.get("BannerSize")}get BannerScroll(){return this.get("BannerScroll")}get ChatURL(){return this.get("ChatURL")}get ShowBanner(){return this.get("ShowBanner")}get ShowChatURL(){return this.get("ShowChatURL")}get SortBy(){return this.get("SortBy")}get Descending(){return this.get("Descending")}get SuperUser(){return this.get("SuperUser")}get AccessRight(){return this.get("AccessRight")}get ServerJobQueues(){return this.get("ServerJobQueues")}get ActivityTime(){return this.get("ActivityTime")}get DaliDetached(){return this.get("DaliDetached")}static attach(e,t){return Is||(Is=new s(e)),t&&Is.set(t),Is}constructor(e){super(),e instanceof Ye?this.connection=e:this.connection=new Ye(e),this.clear({})}runningWorkunits(e=""){return this.Running.ActiveWorkunit.filter(t=>e===""||t.ClusterName===e).map(t=>Ee.attach(this.connection.connectionOptions(),t.Wuid,t))}setBanner(e){return this.connection.SetBanner({...e}).then(t=>(this.set(t),this))}lazyRefresh=(0,Ts.debounce)(async()=>{let e=await this.connection.Activity({});return this.set(e),this});async refresh(){return this.lazyRefresh()}};var ze=require("@hpcc-js/util");var qa=(0,ze.scopedLogger)("logicalFile.ts"),Ms=class extends ze.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Cluster}-${e.Name}`)}},Ja=new Ms,Vr=class s extends ze.StateObject{connection;get BaseUrl(){return this.connection.baseUrl}get Cluster(){return this.get("Cluster")}get Name(){return this.get("Name")}get Filename(){return this.get("Filename")}get Prefix(){return this.get("Prefix")}get NodeGroup(){return this.get("NodeGroup")}get NumParts(){return this.get("NumParts")}get Description(){return this.get("Description")}get Dir(){return this.get("Dir")}get PathMask(){return this.get("PathMask")}get Filesize(){return this.get("Filesize")}get FileSizeInt64(){return this.get("FileSizeInt64")}get RecordSize(){return this.get("RecordSize")}get RecordCount(){return this.get("RecordCount")}get RecordSizeInt64(){return this.get("RecordSizeInt64")}get RecordCountInt64(){return this.get("RecordCountInt64")}get Wuid(){return this.get("Wuid")}get Owner(){return this.get("Owner")}get JobName(){return this.get("JobName")}get Persistent(){return this.get("Persistent")}get Format(){return this.get("Format")}get MaxRecordSize(){return this.get("MaxRecordSize")}get CsvSeparate(){return this.get("CsvSeparate")}get CsvQuote(){return this.get("CsvQuote")}get CsvTerminate(){return this.get("CsvTerminate")}get CsvEscape(){return this.get("CsvEscape")}get Modified(){return this.get("Modified")}get Ecl(){return this.get("Ecl")}get Stat(){return this.get("Stat")}get DFUFilePartsOnClusters(){return this.get("DFUFilePartsOnClusters")}get isSuperfile(){return this.get("isSuperfile")}get ShowFileContent(){return this.get("ShowFileContent")}get subfiles(){return this.get("subfiles")}get Superfiles(){return this.get("Superfiles")}get ProtectList(){return this.get("ProtectList")}get FromRoxieCluster(){return this.get("FromRoxieCluster")}get Graphs(){return this.get("Graphs")}get UserPermission(){return this.get("UserPermission")}get ContentType(){return this.get("ContentType")}get CompressedFileSize(){return this.get("CompressedFileSize")}get PercentCompressed(){return this.get("PercentCompressed")}get IsCompressed(){return this.get("IsCompressed")}get BrowseData(){return this.get("BrowseData")}get jsonInfo(){return this.get("jsonInfo")}get binInfo(){return this.get("binInfo")}get PackageID(){return this.get("PackageID")}get Partition(){return this.get("Partition")}get Blooms(){return this.get("Blooms")}get ExpireDays(){return this.get("ExpireDays")}get KeyType(){return this.get("KeyType")}get IsRestricted(){return this.get("IsRestricted")}get AtRestCost(){return this.get("AtRestCost")}get AccessCost(){return this.get("AccessCost")}get StateID(){return this.get("StateID")}get ExpirationDate(){return this.get("ExpirationDate")}get ExtendedIndexInfo(){return this.get("ExtendedIndexInfo")}get CompressionType(){return this.get("CompressionType")}get properties(){return this.get()}static attach(e,t,r,n){let i=Ja.get({BaseUrl:e.baseUrl,Cluster:t,Name:r},()=>new s(e,t,r));return n&&i.set(n),i}constructor(e,t,r){super(),e instanceof ve?this.connection=e:this.connection=new ve(e),this.clear({Cluster:t,Name:r})}filePartsOnCluster(){return[...this.DFUFilePartsOnClusters?.DFUFilePartsOnCluster||[]]}fileParts(){let e=[];for(let t of this.DFUFilePartsOnClusters?.DFUFilePartsOnCluster||[])for(let r of t?.DFUFileParts?.DFUPart||[]){let n={...t,...r};delete n.DFUFileParts,e.push(n)}return e}update(e){return this.connection.DFUInfo({...e,Cluster:this.Cluster,Name:this.Name}).then(t=>(this.set({Cluster:this.Cluster,...t.FileDetail}),t))}fetchInfo(){return this.connection.DFUInfo({Cluster:this.Cluster,Name:this.Name}).then(e=>(this.set({Cluster:this.Cluster,...e.FileDetail,ProtectList:e?.FileDetail?.ProtectList??{DFUFileProtect:[]}}),e.FileDetail)).catch(e=>{if(!e.Exception.some(r=>r.Code===20038?(this.set("Name",this.Name+" (Deleted)"),this.set("StateID",999),!0):!1))throw qa.warning(`Unexpected ESP exception: ${e.message}`),e;return{}})}fetchDefFile(e){return this.connection.DFUFile({Name:this.Name,Format:e})}fetchAllLogicalFiles(){return this.connection.recursiveFetchLogicalFiles([this])}fetchListHistory(){return this.connection.ListHistory({Name:this.Name}).then(e=>e?.History?.Origin||[])}eraseHistory(){return this.connection.EraseHistory({Name:this.Name}).then(e=>e?.History?.Origin||[])}};var Bs=require("@hpcc-js/util");var ws=class extends Bs.Cache{constructor(){super(e=>e.Address)}},za=new ws,wt=class s extends Bs.StateObject{connection;get Address(){return this.get("Address")}get ConfigAddress(){return this.get("ConfigAddress")}get Name(){return this.get("Name")}get ProcessType(){return this.get("ProcessType")}get DisplayType(){return this.get("DisplayType")}get Description(){return this.get("Description")}get AgentVersion(){return this.get("AgentVersion")}get Contact(){return this.get("Contact")}get Location(){return this.get("Location")}get UpTime(){return this.get("UpTime")}get ComponentName(){return this.get("ComponentName")}get ComponentPath(){return this.get("ComponentPath")}get RoxieState(){return this.get("RoxieState")}get RoxieStateDetails(){return this.get("RoxieStateDetails")}get OS(){return this.get("OS")}get ProcessNumber(){return this.get("ProcessNumber")}get Channels(){return this.get("Channels")}get Processors(){return this.get("Processors")}get Storage(){return this.get("Storage")}get Running(){return this.get("Running")}get PhysicalMemory(){return this.get("PhysicalMemory")}get VirtualMemory(){return this.get("VirtualMemory")}get ComponentInfo(){return this.get("ComponentInfo")}get Exception(){return this.get("Exception")}static attach(e,t,r){let n=za.get({Address:t},()=>new s(e));return r&&n.set(r),n}constructor(e){super(),e instanceof ie?this.connection=e:this.connection=new ie(e)}};var Me=require("@hpcc-js/util");var Pe=require("@hpcc-js/util");var Qs=require("@hpcc-js/util");var Ns=class extends Qs.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Name}`)}},Ka=new Ns,Fe=class s extends Qs.StateObject{connection;machineConnection;get BaseUrl(){return this.connection.baseUrl}get Name(){return this.get("Name")}get Prefix(){return this.get("Prefix")}get Type(){return this.get("Type")}get IsDefault(){return this.get("IsDefault")}get TpClusters(){return this.get("TpClusters")}get TpEclCCServers(){return this.get("TpEclCCServers")}get TpEclServers(){return this.get("TpEclServers")}get TpEclAgents(){return this.get("TpEclAgents")}get TpEclSchedulers(){return this.get("TpEclSchedulers")}get MachineInfoEx(){return this.get("MachineInfoEx",[])}get CMachineInfoEx(){return this.MachineInfoEx.map(e=>wt.attach(this.machineConnection,e.Address,e))}static attach(e,t,r){let n=Ka.get({BaseUrl:e.baseUrl,Name:t},()=>new s(e,t));return r&&n.set(r),n}constructor(e,t){super(),e instanceof G?(this.connection=e,this.machineConnection=new ie(e.connectionOptions())):(this.connection=new G(e),this.machineConnection=new ie(e)),this.clear({Name:t})}fetchMachines(e={}){return this.machineConnection.GetTargetClusterInfo({TargetClusters:{Item:[`${this.Type}:${this.Name}`]},...e}).then(t=>{let r=[];for(let n of t.TargetClusterInfoList.TargetClusterInfo)for(let i of n.Processes.MachineInfoEx)r.push(i);return this.set("MachineInfoEx",r),this.CMachineInfoEx})}machineStats(){let e=0,t=0,r=0;for(let n of this.CMachineInfoEx)for(let i of n.Storage.StorageInfo){t+=i.Available,r+=i.Total;let o=1-i.Available/i.Total;o>e&&(e=o)}return{maxDisk:e,meanDisk:1-(r?t/r:1)}}fetchUsage(){return this.machineConnection.GetTargetClusterUsageEx([this.Name])}};function Za(s){let e;return s instanceof G?e=s:e=new G(s),e.TpListTargetClusters({}).then(t=>t.TargetClusters.TpClusterNameType.map(r=>Fe.attach(s,r.Name,r)))}var Hr={};function $a(s){if(!Hr[s.baseUrl]){let e;s instanceof G?e=s:e=new G(s),Hr[s.baseUrl]=e.TpListTargetClusters({}).then(t=>{let r,n,i;t.TargetClusters.TpClusterNameType.forEach(a=>{r||(r=a),!n&&a.IsDefault===!0&&(n=a),!i&&a.Type==="hthor"&&(i=a)});let o=n||i||r;return Fe.attach(s,o.Name,o)})}return Hr[s.baseUrl]}var Ls=class extends Pe.Cache{constructor(){super(e=>e.BaseUrl)}},ec=new Ls,Bt=class s extends Pe.StateObject{connection;get BaseUrl(){return this.connection.baseUrl}get properties(){return this.get()}get TargetClusters(){return this.get("TargetClusters")}get CTargetClusters(){return this.TargetClusters.map(e=>Fe.attach(this.connection,e.Name,e))}get LogicalClusters(){return this.get("LogicalClusters")}get Services(){return this.get("Services")}static attach(e,t){let r=ec.get({BaseUrl:e.baseUrl},()=>new s(e));return t&&r.set(t),r}constructor(e){super(),e instanceof G?this.connection=e:this.connection=new G(e)}GetESPServiceBaseURL(e=""){return this.connection.TpServiceQuery({}).then(t=>{let r=this.connection.protocol(),n=this.connection.ip(),i=r==="https:"?"18002":"8002";if((0,Pe.exists)("ServiceList.TpEspServers.TpEspServer",t)){for(let o of t.ServiceList.TpEspServers.TpEspServer)if((0,Pe.exists)("TpBindings.TpBinding",o))for(let a of o.TpBindings.TpBinding)a.Service===e&&a.Protocol+":"===r&&(i=a.Port)}return`${r}//${n}:${i}/`})}fetchTargetClusters(){return this.connection.TpTargetClusterQuery({Type:"ROOT"}).then(e=>(this.set({TargetClusters:e.TpTargetClusters?.TpTargetCluster??[]}),this.CTargetClusters))}fetchLogicalClusters(e={}){return this.connection.TpLogicalClusterQuery(e).then(t=>(this.set({LogicalClusters:t.TpLogicalClusters.TpLogicalCluster}),this.LogicalClusters))}fetchServices(e={}){return this.connection.TpServiceQuery(e).then(t=>(this.set({Services:t.ServiceList}),this.Services))}_prevRefresh;refresh(e=!1){return(!this._prevRefresh||e)&&(this._prevRefresh=Promise.all([this.fetchTargetClusters(),this.fetchLogicalClusters(),this.fetchServices()]).then(()=>this)),this._prevRefresh}on(e,t,r){return this.isCallback(t)?e==="changed"&&super.on(e,t):e==="changed"&&super.on(e,t,r),this._monitor(),this}};function Se(s,e,t){e==="__proto__"||e==="constructor"||e==="prototype"||(s[e]=t)}function Nt(s){return s=""+s,s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;")}function tc(s){if(s){if(!isNaN(+s))return parseFloat(s)}else return 0;let t=/(?:(?:(\d+).days.)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+\.\d+|\d+)s))|(?:(\d+\.\d+|\d+)ms|(\d+\.\d+|\d+)us|(\d+\.\d+|\d+)ns)/.exec(s);if(!t)return 0;let r=+t[1]||0,n=+t[2]||0,i=+t[3]||0,o=+t[4]||0,a=+t[5]||0,c=+t[6]||0,l=+t[7]||0;return r*24*60*60+n*60*60+i*60+o+a/1e3+c/1e6+l/1e9}function De(s,e){let t=s.indexOf(e);return t!==-1?parseFloat(s.substring(0,t)):-1}function sc(s){if(s){if(!isNaN(+s))return parseFloat(s)}else return 0;let e=De(s,"Kb");return e>=0?e*1024:(e=De(s,"Mb"),e>=0?e*Math.pow(1024,2):(e=De(s,"Gb"),e>=0?e*Math.pow(1024,3):(e=De(s,"Tb"),e>=0?e*Math.pow(1024,4):(e=De(s,"Pb"),e>=0?e*Math.pow(1024,5):(e=De(s,"Eb"),e>=0?e*Math.pow(1024,6):(e=De(s,"Zb"),e>=0?e*Math.pow(1024,7):(e=De(s,"b"),e>=0?e:0)))))))}function rc(s){return s?parseFloat(s):0}var jr=class{graph;m_xgmml;m_visibleSubgraphs;m_visibleVertices;m_semiVisibleVertices;m_visibleEdges;noSpills;constructor(e){this.graph=e,this.m_xgmml="",this.m_visibleSubgraphs={},this.m_visibleVertices={},this.m_semiVisibleVertices={},this.m_visibleEdges={}}calcVisibility(e,t,r,n){this.noSpills=n,e.forEach(i=>{this.graph.isVertex(i)?(this.calcInVertexVisibility(i,r),this.calcOutVertexVisibility(i,r)):this.graph.isEdge(i)?(this.calcInVertexVisibility(i.getSource(),r-1),this.calcOutVertexVisibility(i.getTarget(),r-1)):this.graph.isSubgraph(i)&&(this.m_visibleSubgraphs[i.__hpcc_id]=i,this.calcSubgraphVisibility(i,t-1))}),this.calcVisibility2()}calcInVertexVisibility(e,t){this.noSpills&&e.isSpill()&&t++,this.m_visibleVertices[e.__hpcc_id]=e,t>0&&e.getInEdges().forEach(r=>{this.calcInVertexVisibility(r.getSource(),t-1)})}calcOutVertexVisibility(e,t){this.noSpills&&e.isSpill()&&t++,this.m_visibleVertices[e.__hpcc_id]=e,t>0&&e.getOutEdges().forEach(r=>{this.calcOutVertexVisibility(r.getTarget(),t-1)})}calcSubgraphVisibility(e,t){if(t<0)return;t>0&&e.__hpcc_subgraphs.forEach((n,i)=>{this.calcSubgraphVisibility(n,t-1)}),e.__hpcc_subgraphs.forEach((n,i)=>{this.m_visibleSubgraphs[n.__hpcc_id]=n}),e.__hpcc_vertices.forEach((n,i)=>{this.m_visibleVertices[n.__hpcc_id]=n});let r={};this.graph.edges.forEach((n,i)=>{n.getSource().__hpcc_parent!==n.getTarget().__hpcc_parent&&e===this.getCommonAncestor(n)&&(r[n.getSource().__hpcc_parent.__hpcc_id+"::"+n.getTarget().__hpcc_parent.__hpcc_id]||(r[n.getSource().__hpcc_parent.__hpcc_id+"::"+n.getTarget().__hpcc_parent.__hpcc_id]=!0,this.m_visibleEdges[n.__hpcc_id]=n))})}buildVertexString(e,t){let r="",n="",i=e.getProperties();for(let o in i)t&&o.indexOf("_kind")>=0?n+='<att name="_kind" value="point"/>':o==="id"||o==="label"?r+=" "+o+'="'+Nt(i[o])+'"':n+='<att name="'+o+'" value="'+Nt(i[o])+'"/>';return"<node"+r+">"+n+"</node>"}buildEdgeString(e){let t="",r="",n=e.getProperties();for(let i in n)i.toLowerCase()==="id"||i.toLowerCase()==="label"||i.toLowerCase()==="source"||i.toLowerCase()==="target"?t+=" "+i+'="'+Nt(n[i])+'"':r+='<att name="'+i+'" value="'+Nt(n[i])+'"/>';return"<edge"+t+">"+r+"</edge>"}getAncestors(e,t){let r=e.__hpcc_parent;for(;r;)t.push(r),r=r.__hpcc_parent}getCommonAncestorV(e,t){let r=[],n=[];this.getAncestors(e,r),this.getAncestors(t,n);let i=r.length-1,o=n.length-1,a=null;for(;i>=0&&o>=0&&r[i]===n[o];)a=r[i],--i,--o;return a}getCommonAncestor(e){return this.getCommonAncestorV(e.getSource(),e.getTarget())}calcAncestorVisibility(e){let t=[];this.getAncestors(e,t),t.forEach((r,n)=>{this.m_visibleSubgraphs[r.__hpcc_id]=r})}calcVisibility2(){for(let e in this.m_visibleVertices){let t=this.m_visibleVertices[e];t.getInEdges().forEach((r,n)=>{this.m_visibleEdges[r.__hpcc_id]=r}),t.getOutEdges().forEach((r,n)=>{this.m_visibleEdges[r.__hpcc_id]=r}),this.calcAncestorVisibility(t)}this.calcSemiVisibleVertices()}addSemiVisibleEdge(e){e&&!this.m_visibleEdges[e.__hpcc_id]&&(this.m_visibleEdges[e.__hpcc_id]=e)}addSemiVisibleVertex(e){this.m_visibleVertices[e.__hpcc_id]||(this.m_semiVisibleVertices[e.__hpcc_id]=e,this.calcAncestorVisibility(e))}calcSemiVisibleVertices(){for(let e in this.m_visibleEdges){let t=this.m_visibleEdges[e],r=t.getSource();for(this.addSemiVisibleVertex(r);this.noSpills&&r.isSpill();){let i=r.getInEdges();if(i.length)this.addSemiVisibleEdge(i[0]),r=i[0].getSource(),this.addSemiVisibleVertex(r);else break}let n=t.getTarget();for(this.addSemiVisibleVertex(n);this.noSpills&&n.isSpill();){let i=n.getOutEdges();if(i.length)this.addSemiVisibleEdge(i[0]),n=i[0].getTarget(),this.addSemiVisibleVertex(n);else break}}}writeXgmml(){this.subgraphVisited(this.graph.subgraphs[0],!0),this.graph.edges.forEach((e,t)=>{this.edgeVisited(e)})}subgraphVisited(e,t=!1){if(this.m_visibleSubgraphs[e.__hpcc_id]){let r="";this.m_xgmml+=t?"":'<node id="'+e.__hpcc_id+'"><att><graph>';let n=this.m_xgmml.length;if(e.walkSubgraphs(this),e.walkVertices(this),n===this.m_xgmml.length){let o=e.__hpcc_vertices[0];o&&(this.m_xgmml+=this.buildVertexString(o,!0))}let i=e.getProperties();for(let o in i)r+='<att name="'+o+'" value="'+Nt(i[o])+'"/>';this.m_xgmml+=t?"":"</graph></att>"+r+"</node>"}return!1}vertexVisited(e){this.m_visibleVertices[e.__hpcc_id]?this.m_xgmml+=this.buildVertexString(e,!1):this.m_semiVisibleVertices[e.__hpcc_id]&&(this.m_xgmml+=this.buildVertexString(e,!0))}edgeVisited(e){this.m_visibleEdges[e.__hpcc_id]&&(this.m_xgmml+=this.buildEdgeString(e))}},Qt=class{__hpcc_graph;__hpcc_parent;__widget;__hpcc_id;_globalID;constructor(e,t){this.__hpcc_graph=e,this.__hpcc_id=t,this._globalID=t}getProperties(){let e={};for(let t in this)t.indexOf("__")!==0&&this.hasOwnProperty(t)&&(e[t]=this[t]);return e}},Re=class extends Qt{_globalType;__hpcc_subgraphs;__hpcc_vertices;__hpcc_edges;id;constructor(e,t){super(e,t),this._globalType=t==="0"?"Graph":"Cluster",this.__hpcc_subgraphs=[],this.__hpcc_vertices=[],this.__hpcc_edges=[],this.id=t}addSubgraph(e){e.__hpcc_parent=this,this.__hpcc_subgraphs.some(t=>e===t)||this.__hpcc_subgraphs.push(e)}addVertex(e){e.__hpcc_parent=this,this.__hpcc_vertices.some(t=>e===t)||this.__hpcc_vertices.push(e)}removeVertex(e){this.__hpcc_vertices=this.__hpcc_vertices.filter(t=>e!==t)}addEdge(e){e.__hpcc_parent=this,this.__hpcc_edges.some(t=>e===t)||this.__hpcc_edges.push(e)}removeEdge(e){this.__hpcc_edges=this.__hpcc_edges.filter(t=>e!==t)}remove(){this.__hpcc_subgraphs.forEach(e=>e.__hpcc_parent=this.__hpcc_parent),this.__hpcc_vertices.forEach(e=>e.__hpcc_parent=this.__hpcc_parent),this.__hpcc_edges.forEach(e=>e.__hpcc_parent=this.__hpcc_parent),delete this.__hpcc_parent,this.__hpcc_graph.removeItem(this)}walkSubgraphs(e){this.__hpcc_subgraphs.forEach((t,r)=>{e.subgraphVisited(t)&&t.walkSubgraphs(e)})}walkVertices(e){this.__hpcc_vertices.forEach((t,r)=>{e.vertexVisited(t)})}},Ie=class extends Qt{_globalType="Vertex";_isSpill;constructor(e,t){super(e,t)}isSpill(){return this._isSpill}remove(){let e=this.getInVertices();e.length<=1&&console.warn(this.__hpcc_id+": remove only supports single or zero inputs activities..."),this.getInEdges().forEach(t=>{t.remove()}),this.getOutEdges().forEach(t=>{t.setSource(e[0])}),this.__hpcc_parent?.removeVertex(this),this.__hpcc_graph.removeItem(this)}getInVertices(){return this.getInEdges().map(e=>e.getSource())}getInEdges(){return this.__hpcc_graph.edges.filter(e=>e.getTarget()===this)}getOutVertices(){return this.getOutEdges().map(e=>e.getTarget())}getOutEdges(){return this.__hpcc_graph.edges.filter(e=>e.getSource()===this)}},Te=class extends Qt{_globalType="Edge";_sourceActivity;source;_targetActivity;target;constructor(e,t){super(e,t),this._globalType="Edge"}remove(){this.__hpcc_graph.subgraphs.forEach(e=>{e.removeEdge(this)}),this.__hpcc_graph.removeItem(this)}getSource(){return this.__hpcc_graph.idx[this._sourceActivity||this.source]}setSource(e){this._sourceActivity?this._sourceActivity=e.__hpcc_id:this.source&&(this.source=e.__hpcc_id),this.__widget&&this.__widget.setSource(this.getSource().__widget)}getTarget(){return this.__hpcc_graph.idx[this._targetActivity||this.target]}},Lt=class s{idx={};subgraphs=[];vertices=[];edges=[];xgmml="";constructor(){this.clear()}clear(){this.xgmml="",this.idx={},this.subgraphs=[],this.vertices=[],this.edges=[]}load(e){this.clear(),this.merge(e)}merge(e){this.xgmml=e;let r=new DOMParser().parseFromString(e,"text/xml");this.walkDocument(r.documentElement,"0")}isSubgraph(e){return e instanceof Re}isVertex(e){return e instanceof Ie}isEdge(e){return e instanceof Te}getGlobalType(e){return e instanceof Ie?3:e instanceof Te?4:e instanceof Re?2:e instanceof s?1:0}getGlobalTypeString(e){return e instanceof Ie?"Vertex":e instanceof Te?"Edge":e instanceof Re?"Cluster":e instanceof s?"Graph":"Unknown"}getItem(e,t){if(!this.idx[t])switch(e.tagName){case"graph":let n=new Re(this,t);this.subgraphs.push(n),this.idx[t]=n;break;case"node":let i=new Ie(this,t);this.vertices.push(i),this.idx[t]=i;break;case"edge":let o=new Te(this,t);this.edges.push(o),this.idx[t]=o;break;default:console.warn("Graph.getItem - Unknown Node Type!");break}let r=this.idx[t];return Array.from(e.attributes).forEach(n=>{Se(r,n.name,n.value)}),r}removeItem(e){delete this.idx[e.__hpcc_id],e instanceof Re?this.subgraphs=this.subgraphs.filter(t=>e!==t):e instanceof Ie?this.vertices=this.vertices.filter(t=>e!==t):e instanceof Te&&(this.edges=this.edges.filter(t=>e!==t))}getChildByTagName(e,t){let r=null;return Array.from(e.childNodes).some(n=>{if(n.tagName===t)return r=n,!0}),r}walkDocument(e,t){let r=this.getItem(e,t);return e.childNodes.forEach(n=>{switch(n.nodeType){case 1:switch(n.tagName){case"graph":break;case"node":let i=!1,o=this.getChildByTagName(n,"att");if(o){let g=this.getChildByTagName(o,"graph");if(g){i=!0;let p=this.walkDocument(g,n.getAttribute("id"));r.addSubgraph(p)}}if(!i){let g=this.walkDocument(n,n.getAttribute("id"));r.addVertex(g)}break;case"att":let a=n.getAttribute("name"),c="_"+a,l=n.getAttribute("value");a.indexOf("Time")===0?(Se(r,c,l),Se(r,a,""+tc(l))):a.indexOf("Size")===0?(Se(r,c,l),Se(r,a,""+sc(l))):a.indexOf("Skew")===0?(Se(r,c,l),Se(r,a,""+rc(l))):Se(r,a,l);break;case"edge":let u=this.walkDocument(n,n.getAttribute("id"));if(u.NumRowsProcessed!==void 0?u._eclwatchCount=u.NumRowsProcessed.replace(/\B(?=(\d{3})+(?!\d))/g,","):u.Count!==void 0?u._eclwatchCount=u.Count.replace(/\B(?=(\d{3})+(?!\d))/g,","):u.count!==void 0&&(u._eclwatchCount=u.count.replace(/\B(?=(\d{3})+(?!\d))/g,",")),u.inputProgress&&(u._eclwatchInputProgress="["+u.inputProgress.replace(/\B(?=(\d{3})+(?!\d))/g,",")+"]"),u.SkewMaxRowsProcessed&&u.SkewMinRowsProcessed&&(u._eclwatchSkew="+"+u.SkewMaxRowsProcessed+", "+u.SkewMinRowsProcessed),!u._dependsOn){if(!u._childGraph){if(u._sourceActivity||u._targetActivity){u._isSpill=!0;let g=u.getSource();g&&(g._isSpill=!0);let p=u.getTarget();p&&(p._isSpill=!0)}}}r.addEdge(u);break;default:break}break;case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:break;default:break}}),r}removeSubgraphs(){[...this.subgraphs].forEach(t=>{t.__hpcc_parent instanceof Re&&t.remove()})}removeSpillVertices(){[...this.vertices].forEach(t=>{t.isSpill()&&t.remove()})}getLocalisedXGMML(e,t,r,n){let i=new jr(this);return i.calcVisibility(e,t,r,n),i.writeXgmml(),"<graph>"+i.m_xgmml+"</graph>"}};var Gs=(0,Me.scopedLogger)("@hpcc-js/comms/ecl/query.ts"),nc=qe("~s");function ic(s){return!isNaN(parseFloat(s))&&!isNaN(s-0)}var _r=class extends Me.Cache{constructor(){super(e=>Me.Cache.hash([e.QueryId,e.QuerySet]))}},oc=new _r,Or=class s extends Me.StateObject{wsWorkunitsService;get BaseUrl(){return this.wsWorkunitsService.baseUrl}topology;_requestSchema;_responseSchema;get properties(){return this.get()}get Exceptions(){return this.get("Exceptions")}get QueryId(){return this.get("QueryId")}get QuerySet(){return this.get("QuerySet")}get QueryName(){return this.get("QueryName")}get Wuid(){return this.get("Wuid")}get Dll(){return this.get("Dll")}get Suspended(){return this.get("Suspended")}get Activated(){return this.get("Activated")}get SuspendedBy(){return this.get("SuspendedBy")}get Clusters(){return this.get("Clusters")}get PublishedBy(){return this.get("PublishedBy")}get Comment(){return this.get("Comment")}get LogicalFiles(){return this.get("LogicalFiles")}get SuperFiles(){return this.get("SuperFiles")}get IsLibrary(){return this.get("IsLibrary")}get Priority(){return this.get("Priority")}get WUSnapShot(){return this.get("WUSnapShot")}get CompileTime(){return this.get("CompileTime")}get LibrariesUsed(){return this.get("LibrariesUsed")}get CountGraphs(){return this.get("CountGraphs")}get ResourceURLCount(){return this.get("ResourceURLCount")}get WsEclAddresses(){return this.get("WsEclAddresses")}get WUGraphs(){return this.get("WUGraphs")}get WUTimers(){return this.get("WUTimers")}get PriorityID(){return this.get("PriorityID")}constructor(e,t,r,n){super(),e instanceof L?this.wsWorkunitsService=e:this.wsWorkunitsService=new L(e),this.topology=Bt.attach(this.wsWorkunitsService.opts()),this.set({QuerySet:t,QueryId:r,...n})}static attach(e,t,r,n){let i=oc.get({BaseUrl:e.baseUrl,QuerySet:t,QueryId:r},()=>new s(e,t,r));return n&&i.set(n),i}_eclService;async wsEclService(){return this._eclService||(this._eclService=this.topology.fetchServices({}).then(e=>{for(let t of e?.TpEspServers?.TpEspServer??[])for(let r of t?.TpBindings?.TpBinding??[])if(r?.Service==="ws_ecl"){let n=`${r.Protocol}://${globalThis.location.hostname}:${r.Port}`;return new at({baseUrl:n})}})),this._eclService}async fetchDetails(){let e=await this.wsWorkunitsService.WUQueryDetails({QuerySet:this.QuerySet,QueryId:this.QueryId,IncludeStateOnClusters:!0,IncludeSuperFiles:!0,IncludeWsEclAddresses:!0,CheckAllNodes:!1});this.set({...e})}async fetchRequestSchema(){let e=await this.wsEclService();try{this._requestSchema=await e?.requestJson(this.QuerySet,this.QueryId)??[]}catch(t){Gs.debug(t.message??t),this._requestSchema=[]}}async fetchResponseSchema(){let e=await this.wsEclService();try{this._responseSchema=await e?.responseJson(this.QuerySet,this.QueryId)??{}}catch(t){Gs.debug(t.message??t),this._responseSchema={}}}async fetchSchema(){await Promise.all([this.fetchRequestSchema(),this.fetchResponseSchema()])}fetchSummaryStats(){return this.wsWorkunitsService.WUQueryGetSummaryStats({Target:this.QuerySet,QueryId:this.QueryId})}fetchGraph(e="",t=""){return this.wsWorkunitsService.WUQueryGetGraph({Target:this.QuerySet,QueryId:this.QueryId,GraphName:e,SubGraphId:t}).then(r=>{let n=new Lt,i=!0;for(let o of r?.Graphs?.ECLGraphEx||[])i?(n.load(o.Graph),i=!1):n.merge(o.Graph);return n})}fetchDetailsNormalized(e={}){let t=Ee.attach(this.wsWorkunitsService,this.Wuid);return t?Promise.all([this.fetchGraph(),t.fetchDetailsMeta(),t.fetchDetailsRaw(e)]).then(r=>{let n=r[0],i=r[1],a=r[2].map(c=>{let l=c.Id[0];if(l==="a"||l==="e"){let u=n.idx[c.Id.substring(1)];if(!u)return Gs.debug(`Missing graph data for metric ID: ${c.Id}`),c;let g=new Set(c.Properties.Property.map(f=>f.Name)),p=[];for(let f in u){let D=f.charAt(0);if(D!=="_"&&D===D.toUpperCase()&&!g.has(f)){let A=u[f],b=typeof A;if(b==="string"||b==="number"||b==="boolean"){let R=ic(A)?parseFloat(A):A,S=A;f.indexOf("Time")>=0&&(R=R/1e9,S=nc(R)+"s"),p.push({Name:f,RawValue:R,Formatted:S})}}}p.length>0&&c.Properties.Property.push(...p)}return c});return t.normalizeDetails(i,a)}):Promise.resolve({meta:void 0,columns:void 0,data:void 0})}async submit(e){let t=await this.wsEclService();try{return t?.submit(this.QuerySet,this.QueryId,e).then(r=>{for(let n in r)r[n]=r[n].Row;return r})??[]}catch(r){return Gs.debug(r.message??r),[]}}async refresh(){return await Promise.all([this.fetchDetails(),this.fetchSchema()]),this}requestFields(){return this._requestSchema?this._requestSchema:[]}responseFields(){return this._responseSchema?this._responseSchema:{}}resultNames(){let e=[];for(let t in this.responseFields())e.push(t);return e}resultFields(e){return this._responseSchema[e]?this._responseSchema[e]:[]}};var Ke=require("@hpcc-js/util");var ks=class extends Ke.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Name}:${e.UserSpecific}-${e.Namespace}`)}},ac=new ks,Ce=class extends Ke.Message{constructor(t,r,n){super();this.key=t;this.value=r;this.oldValue=n}key;value;oldValue;get canConflate(){return!0}conflate(t){return this.key===t.key?(this.value=t.value,!0):!1}void(){return this.value===this.oldValue}},Yr=class s{connection;get BaseUrl(){return this.connection.baseUrl}Name;UserSpecific;Namespace;_dispatch=new Ke.Dispatch;static attach(e,t="HPCCApps",r,n=!0){return ac.get({BaseUrl:e.baseUrl,Name:t,UserSpecific:n,Namespace:r},()=>new s(e,t,r,n))}constructor(e,t,r,n){e instanceof Xe?this.connection=e:this.connection=new Xe(e),this.Name=t,this.UserSpecific=n,this.Namespace=r}_knownValues={};create(){this.connection.CreateStore({Name:this.Name,Type:"",Description:""})}set(e,t,r=!0){return this.connection.Set({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e,Value:t}).then(n=>{let i=this._knownValues[e];this._knownValues[e]=t,r&&this._dispatch.post(new Ce(e,t,i))}).catch(n=>{console.error(`Store.set("${e}", "${t}") failed:`,n)})}get(e,t=!0){return this.connection.Fetch({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e}).then(r=>{let n=this._knownValues[e];return this._knownValues[e]=r.Value,t&&this._dispatch.post(new Ce(e,r.Value,n)),r.Value}).catch(r=>{console.error(`Store.get(${e}) failed:`,r)})}getAll(e=!0){return this.connection.FetchAll({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace}).then(t=>{let r={},n=this._knownValues;if(this._knownValues={},t.Pairs.Pair.forEach(i=>{let o=this._knownValues[i.Key];this._knownValues[i.Key]=i.Value,delete n[i.Key],r[i.Key]=i.Value,e&&this._dispatch.post(new Ce(i.Key,i.Value,o))}),e)for(let i in n)this._dispatch.post(new Ce(i,void 0,n[i]));return r}).catch(t=>(console.error("Store.getAll failed:",t),{}))}delete(e,t=!0){return this.connection.Delete({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e}).then(r=>{let n=this._knownValues[e];delete this._knownValues[e],t&&this._dispatch.post(new Ce(e,void 0,n))}).catch(r=>{console.error(`Store.delete(${e}) failed:`,r)})}monitor(e){return this._dispatch.attach(e)}};var Ze=require("@hpcc-js/util");var cc=(0,Ze.scopedLogger)("@hpcc-js/comms/dfuWorkunit.ts");var vs=class extends Ze.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.ID}`)}},pi=new vs,Xr=class s extends Ze.StateObject{connection;topologyConnection;get BaseUrl(){return this.connection.baseUrl}get properties(){return this.get()}get ID(){return this.get("ID")}get DFUServerName(){return this.get("DFUServerName")}get ClusterName(){return this.get("ClusterName")}get JobName(){return this.get("JobName")}get Queue(){return this.get("Queue")}get User(){return this.get("User")}get isProtected(){return this.get("isProtected")}get Command(){return this.get("Command")}get CommandMessage(){return this.get("CommandMessage")}get PercentDone(){return this.get("PercentDone")}get SecsLeft(){return this.get("SecsLeft")}get ProgressMessage(){return this.get("ProgressMessage")}get SummaryMessage(){return this.get("SummaryMessage")}get State(){return this.get("State",0)}get SourceLogicalName(){return this.get("SourceLogicalName")}get SourceIP(){return this.get("SourceIP")}get SourceFilePath(){return this.get("SourceFilePath")}get SourceDali(){return this.get("SourceDali")}get SourceRecordSize(){return this.get("SourceRecordSize")}get SourceFormat(){return this.get("SourceFormat")}get RowTag(){return this.get("RowTag")}get SourceNumParts(){return this.get("SourceNumParts")}get SourceDirectory(){return this.get("SourceDirectory")}get DestLogicalName(){return this.get("DestLogicalName")}get DestGroupName(){return this.get("DestGroupName")}get DestDirectory(){return this.get("DestDirectory")}get DestIP(){return this.get("DestIP")}get DestFilePath(){return this.get("DestFilePath")}get DestFormat(){return this.get("DestFormat")}get DestNumParts(){return this.get("DestNumParts")}get DestRecordSize(){return this.get("DestRecordSize")}get Replicate(){return this.get("Replicate")}get Overwrite(){return this.get("Overwrite")}get Compress(){return this.get("Compress")}get SourceCsvSeparate(){return this.get("SourceCsvSeparate")}get SourceCsvQuote(){return this.get("SourceCsvQuote")}get SourceCsvTerminate(){return this.get("SourceCsvTerminate")}get SourceCsvEscape(){return this.get("SourceCsvEscape")}get TimeStarted(){return this.get("TimeStarted")}get TimeStopped(){return this.get("TimeStopped")}get StateMessage(){return this.get("StateMessage")}get StateReason(){return this.get("StateReason")}get MonitorEventName(){return this.get("MonitorEventName")}get MonitorSub(){return this.get("MonitorSub")}get MonitorShotLimit(){return this.get("MonitorShotLimit")}get SourceDiffKeyName(){return this.get("SourceDiffKeyName")}get DestDiffKeyName(){return this.get("DestDiffKeyName")}get Archived(){return this.get("Archived")}get encrypt(){return this.get("encrypt")}get decrypt(){return this.get("decrypt")}get failIfNoSourceFile(){return this.get("failIfNoSourceFile")}get recordStructurePresent(){return this.get("recordStructurePresent")}get quotedTerminator(){return this.get("quotedTerminator")}get preserveCompression(){return this.get("preserveCompression")}get expireDays(){return this.get("expireDays")}get PreserveFileParts(){return this.get("PreserveFileParts")}get FileAccessCost(){return this.get("FileAccessCost")}get KbPerSecAve(){return this.get("KbPerSecAve")}get KbPerSec(){return this.get("KbPerSec")}static create(e,t){let r=new s(e);return r.connection.CreateDFUWorkunit({DFUServerQueue:t}).then(n=>(pi.set(r),r.set(n.result),r))}static attach(e,t,r){let n=pi.get({BaseUrl:e.baseUrl,ID:t},()=>new s(e,t));return r&&n.set(r),n}static sprayFixed(e,t){let r=new ge(e);return r.SprayFixedEx({...t}).then(n=>{let i=n.wuid;return r.GetDFUWorkunit({wuid:i}).then(o=>s.attach(e,i,o.result))})}static sprayVariable(e,t){let r=new ge(e);return r.SprayVariableEx({...t}).then(n=>{let i=n.wuid;return r.GetDFUWorkunit({wuid:i}).then(o=>s.attach(e,i,o.result))})}static despray(e,t){let r=new ge(e);return r.DesprayEx({...t}).then(n=>{let i=n.wuid;return r.GetDFUWorkunit({wuid:i}).then(o=>s.attach(e,i,o.result))})}update(e){return this.connection.UpdateDFUWorkunitEx({wu:{JobName:e?.wu?.JobName??this.JobName,isProtected:e?.wu?.isProtected??this.isProtected,ID:this.ID,State:this.State},ClusterOrig:this.ClusterName,JobNameOrig:this.JobName,isProtectedOrig:this.isProtected,StateOrig:this.State})}isComplete(){switch(this.State){case 6:case 5:case 4:case 999:return!0;default:}return!1}isFailed(){return!!(this.isComplete()&&this.State!==6)}isDeleted(){return this.State===999}isRunning(){return!this.isComplete()}abort(){return this.connection.AbortDFUWorkunit({wuid:this.ID})}delete(){return this.DFUWUAction(ke.DFUWUActions.Delete).then(e=>this.refresh().then(()=>(this._monitor(),e)))}async refresh(e=!1){return await this.GetDFUWorkunit(),this}fetchXML(e){return this.DFUWUFile()}_monitor(){if(this.isComplete()){this._monitorTickCount=0;return}super._monitor()}_monitorTimeoutDuration(){let e=super._monitorTimeoutDuration();return this._monitorTickCount<=1?3e3:this._monitorTickCount<=5?6e3:this._monitorTickCount<=7?12e3:e}DFUWUFile(e={}){return this.connection.DFUWUFileEx({...e,Wuid:this.ID}).then(t=>t).catch(t=>"")}DFUWUAction(e){return this.connection.DFUWorkunitsAction({wuids:{Item:[this.ID]},Type:e}).then(t=>e===ke.DFUWUActions.Delete?t:this.refresh().then(()=>(this._monitor(),t)))}on(e,t,r){if(this.isCallback(t))switch(e){case"finished":super.on("propChanged","State",n=>{this.isComplete()&&t([n])});break;case"changed":super.on(e,t);break;default:}else e==="changed"&&super.on(e,t,r);return this._monitor(),this}watchUntilComplete(e){return new Promise((t,r)=>{let n=this.watch(i=>{e&&e(i),this.isComplete()&&(n.release(),t(this))})})}watchUntilRunning(e){return new Promise((t,r)=>{let n=this.watch(i=>{e&&e(i),(this.isComplete()||this.isRunning())&&(n.release(),t(this))})})}constructor(e,t){super(),this.connection=new ge(e),this.topologyConnection=new G(e),this.clearState(t)}clearState(e){this.clear({ID:e,State:0})}GetDFUWorkunit(e={}){return this.connection.GetDFUWorkunit({...e,wuid:this.ID}).then(t=>(this.set(t.result),t)).catch(t=>{if(!t.Exception.some(n=>n.Code===20080||n.Code===20081?(this.clearState(this.ID),this.set("State",999),!0):!1))throw cc.warning(`Unexpected ESP exception: ${t.message}`),t;return{}})}};var Ri=ue(require("node:child_process"),1),Ci=ue(require("node:crypto"),1),H=ue(require("node:fs"),1),ce=ue(require("node:os"),1),j=ue(require("node:path"),1),rt=require("@hpcc-js/util");var we=ue(require("node:fs"),1),w=ue(require("node:path"),1),Y=require("@hpcc-js/util");var uc=(0,Y.scopedLogger)("clienttools/eclmeta"),lc=!1;function $e(s,e,t){if(lc){for(let r in s){let n=`${e}.${r}`;r!=="$"&&t[r]===void 0&&t[r.toLowerCase()+"s"]===void 0&&uc.debug(n)}s.$&&$e(s.$,e+".$",t)}}var Vs=class{__attrs;name;constructor(e){this.__attrs=e.$,this.name=e.$.name}},Hs=class{__attrs;definition;get scope(){return this.definition}name;type;constructor(e,t){this.__attrs=t.$,this.definition=e,this.name=t.$.name,this.type=t.$.type}},Be=class{get scope(){return this}name;type;sourcePath;line;start;body;end;definitions;constructor(e,t,r,n,i=1,o=0,a=0,c=Number.MAX_VALUE){this.name=e,this.type=t,this.sourcePath=w.normalize(r),this.line=+i-1,this.start=+o,this.body=+a,this.end=+c,this.definitions=this.parseDefinitions(n)}parseDefinitions(e=[]){return e.map(t=>{let r=new js(this.sourcePath,t);return $e(t,"definition",r),r})}contains(e){return e>=this.start&&e<=this.end}scopeStackAt(e){let t=[];return this.contains(e)&&(t.push(this),this.definitions.forEach(r=>{t=r.scopeStackAt(e).concat(t)})),t}_resolve(e=[],t){let r=t.split("."),n=r.shift(),i=(0,Y.find)(e,o=>typeof o.name=="string"&&typeof n=="string"&&o.name.toLowerCase()===n.toLowerCase());return i&&i.definitions.length&&r.length?this._resolve(i.definitions,r.join(".")):i}resolve(e){return this._resolve(this.definitions,e)}suggestions(){return this.definitions.map(e=>({name:e.name,type:this.type}))}},js=class extends Be{__attrs;exported;shared;fullname;inherittype;attrs;fields;constructor(e,t){super(t.$.name,t.$.type,e,t.children("Definition"),t.$.line,t.$.start,t.$.body,t.$.end),this.__attrs=t.$,this.exported=!!t.$.exported,this.shared=!!t.$.shared,this.fullname=t.$.fullname,this.inherittype=t.$.inherittype,this.attrs=this.parseAttrs(t.children("Attr")),this.fields=this.parseFields(t.children("Field"))}parseAttrs(e=[]){return e.map(t=>{let r=new Vs(t);return $e(t,"attr",r),r})}parseFields(e=[]){return e.map(t=>{let r=new Hs(this,t);return $e(t,"field",r),r})}suggestions(){return super.suggestions().concat(this.fields.map(e=>({name:e.name,type:e.type})))}},Gt=class{__attrs;name;ref;start;end;line;constructor(e){this.__attrs=e.$,this.name=e.$.name,this.ref=e.$.ref,this.start=e.$.start,this.end=e.$.end,this.line=e.$.line}},_s=class extends Be{imports;__attrs;constructor(e){super(e.$.name,"source",e.$.sourcePath,e.children("Definition")),this.__attrs=e.$;let t=e.$.name.split(".");t.pop();let r=new Y.XMLNode("");r.appendAttribute("name","$"),r.appendAttribute("ref",t.join(".")),this.imports=[new Gt(r),...this.parseImports(e.children("Import"))]}parseImports(e=[]){return e.map(t=>{let r=new Gt(t);return $e(t,"import",r),r})}resolve(e,t){let r;return!r&&t!==void 0&&this.scopeStackAt(t).some(i=>(r=i.resolve(e),!!r)),r||(r=super.resolve(e)),r}},pc=s=>w.basename(s).indexOf(".")===0,gi=s=>we.lstatSync(s).isDirectory()&&!pc(s),gc=s=>[".ecl",".ecllib"].indexOf(w.extname(s).toLowerCase())>=0,di=s=>we.readdirSync(s).map(e=>w.join(s,e)).filter(e=>gi(e)||gc(e)),Os=class extends Be{constructor(e,t){super(e,"file",t,[])}suggestions(){return[]}},Ys=class extends Be{constructor(e,t){super(e,"folder",t,[])}suggestions(){return di(this.sourcePath).map(e=>({name:w.basename(e,".ecl"),type:"folder"}))}},Xs=class{_workspacePath;_eclccPath;_clientTools;_sourceByID=new Y.DictionaryNoCase;_sourceByPath=new Y.Dictionary;_test=new Y.DictionaryNoCase;constructor(e,t){this._workspacePath=e,this._eclccPath=t}refresh(){this.primeWorkspace(),this.primeClientTools()}primeClientTools(){return zr(this._eclccPath,"",this._workspacePath).then(e=>(this._clientTools=e,e.paths())).then(e=>{for(let t of["ECLCC_ECLLIBRARY_PATH","ECLCC_PLUGIN_PATH"])e[t]&&we.existsSync(e[t])&&this.walkChildFolders(e[t],e[t]);return this})}primeWorkspace(){we.existsSync(this._workspacePath)&&this.visitFolder(this._workspacePath,this._workspacePath)}walkChildFolders(e,t,r=!1){for(let n of di(e))gi(n)?this.visitFolder(n,t,r):this.visitFile(n,t,r)}visitFile(e,t,r=!1){let n=w.parse(e),i=w.join(n.dir,n.name),o=w.relative(t,i).split(w.sep).join(".");(r||!this._test.has(o))&&this._test.set(o,new Os("",e))}visitFolder(e,t,r=!1){let n=w.relative(t,e).split(w.sep).join(".");(r||!this._test.has(n))&&(this._test.set(n,new Ys(n,e)),this.walkChildFolders(e,t,r))}buildStack(e,t,r){let n=t.split(".");r&&e[e.length-1]===n[0]&&n.shift();let i=[...e,...n],o=i.join(".");return{stack:i,qid:o}}walkECLScope(e,t){let r=this.buildStack(e,t.name,!0);this._test.set(r.qid,t);for(let n of t.definitions)this.walkDefinition(r.stack,n)}walkField(e,t){let r=this.buildStack(e,t.name,!1);this._test.set(r.qid,t)}walkDefinition(e,t){let r=this.buildStack(e,t.name,!0);this.walkECLScope(e,t);for(let n of t.fields)this.walkField(r.stack,n)}walkSource(e){this.walkECLScope([],e)}parseSources(e=[]){for(let t of e)if(t.$.name){let r=new _s(t);if($e(t,"source",r),this._sourceByID.set(r.name,r),this._sourceByPath.set(r.sourcePath,r),r.name){let i=r.name.split(".").length;if(i>1){let o=r.sourcePath;for(;i>1;)o=w.dirname(o),--i;this.visitFolder(o,w.dirname(o))}}this.walkSource(r)}}parseMetaXML(e){let t=new Jr;return t.parse(e),this.parseSources(t.sources),t.sources.map(r=>w.normalize(r.$.sourcePath))}resolveQualifiedID(e,t,r){let n;if(!n&&this._test.has(t)&&(n=this._test.get(t).scope),!n&&this._sourceByPath.has(e)){let i=this._sourceByPath.get(e),o=t.split(".");for(let c of i.imports)if(c.name.toLowerCase()===o[0].toLowerCase()){c.ref?o[0]=c.ref:o.shift();break}let a=o.join(".");!n&&this._test.has(a)&&(n=this._test.get(a).scope),n||(a=[...i.name.split("."),...o].join("."),this._test.has(a)&&(n=this._test.get(a).scope))}return n}resolvePartialID(e,t,r){t=t.toLowerCase();let n=t.split(".");n.pop();let i=n.length===1?n[0]:n.join(".");return this.resolveQualifiedID(e,i,r)}},qr=new Y.Dictionary;function xe(s,e){let t=w.normalize(s);if(!qr.has(t)){let r=new Xs(t,e);qr.set(t,r),r.refresh()}return qr.get(t)}function dc(s,e,t){if(e<0)return!1;let r=s.charAt(e);return(t?/[a-zA-Z\d_\.$]/:/[a-zA-Z\d_]/).test(r)}function mc(s,e,t){for(;dc(s,e,t);)e+=t?-1:1;return e+(t?1:-1)}var Jr=class extends Y.SAXStackParser{sources=[];endXMLNode(e){e.name==="Source"&&this.sources.push(e),super.endXMLNode(e)}};var et=(0,rt.scopedLogger)("clienttools/eclcc"),Kr=ce.type()==="Windows_NT"?".exe":"";function mi(s){return s.split(`\r
915
+ </div>`}},Scope=class extends BaseScope{wu;constructor(e,t){super(t),this.wu=e}},SourceFile=class extends o.StateObject{connection;get properties(){return this.get()}get Wuid(){return this.get(`Wuid`)}get FileCluster(){return this.get(`FileCluster`)}get Name(){return this.get(`Name`)}get IsSuperFile(){return this.get(`IsSuperFile`)}get Subs(){return this.get(`Subs`)}get Count(){return this.get(`Count`)}get ECLSourceFiles(){return this.get(`ECLSourceFiles`)}constructor(e,t,n){super(),this.connection=e instanceof WorkunitsService?e:new WorkunitsService(e),this.set({Wuid:t,...n})}},Timer=class extends o.StateObject{connection;get properties(){return this.get()}get Wuid(){return this.get(`Wuid`)}get Name(){return this.get(`Name`)}get Value(){return this.get(`Value`)}get Seconds(){return this.get(`Seconds`)}get GraphName(){return this.get(`GraphName`)}get SubGraphId(){return this.get(`SubGraphId`)}get HasSubGraphId(){return this.get(`HasSubGraphId`)}get count(){return this.get(`count`)}get Timestamp(){return this.get(`Timestamp`)}get When(){return this.get(`When`)}constructor(e,t,n){super(),this.connection=e instanceof WorkunitsService?e:new WorkunitsService(e);let r=(0,o.espTime2Seconds)(n.Value);this.set({Wuid:t,Seconds:Math.round(r*1e3)/1e3,HasSubGraphId:n.SubGraphId!==void 0,...n})}},Ye=Re(`%Y-%m-%dT%H:%M:%S.%LZ`),Xe=ze(`%Y-%m-%dT%H:%M:%S.%LZ`),Ze=qe(`,`);function formatNum(e){return e&&!isNaN(+e)?Ze(+e):e}var Qe=`DefinitionList`,$e=/([a-zA-Z]:)?(.*[\\\/])(.*)(\((\d+),(\d+)\))/,et=[`Avg`,`Min`,`Max`,`Delta`,`StdDev`],tt=[`SkewMin`,`SkewMax`,`NodeMin`,`NodeMax`],nt=/[A-Z][a-z]*/g;function _splitMetric(e){for(let t of tt){let n=e.indexOf(t);if(n===0)return{measure:``,ext:t,label:e.slice(n+t.length)}}let t=e.match(nt);if(t?.length){let e=t.shift(),n=t.join(``);for(let t of et){let r=n.indexOf(t);if(r===0)return n=n.slice(r+t.length),{measure:e,ext:t,label:n}}return{measure:e,ext:``,label:n}}return{measure:``,ext:``,label:e}}var rt={};function splitMetric(e){let t=rt[e];return t||(t=_splitMetric(e),rt[e]=t),t}function formatValue(e,t){return e.__formattedProps?.[t]??e[t]}function safeParseFloat(e){if(e===void 0)return;let t=parseFloat(e);return isNaN(t)?void 0:t}function formatValues(e,t,n){let r=splitMetric(t);if(!n[r.measure]){n[r.label]=!0;let t=safeParseFloat(e[`${r.measure}Avg${r.label}`]),i=safeParseFloat(e[`${r.measure}Min${r.label}`]),a=safeParseFloat(e[`${r.measure}Max${r.label}`]),o=safeParseFloat(e[`${r.measure}StdDev${r.label}`]),s=Math.max((t-i)/o,(a-t)/o);return{Key:`${r.measure}${r.label}`,Value:formatValue(e,`${r.measure}${r.label}`),Avg:formatValue(e,`${r.measure}Avg${r.label}`),Min:formatValue(e,`${r.measure}Min${r.label}`),Max:formatValue(e,`${r.measure}Max${r.label}`),Delta:formatValue(e,`${r.measure}Delta${r.label}`),StdDev:formatValue(e,`${r.measure}StdDev${r.label}`),StdDevs:isNaN(s)?void 0:s,SkewMin:formatValue(e,`SkewMin${r.label}`),SkewMax:formatValue(e,`SkewMax${r.label}`),NodeMin:formatValue(e,`NodeMin${r.label}`),NodeMax:formatValue(e,`NodeMax${r.label}`)}}return null}var U=(0,o.scopedLogger)(`workunit.ts`),WorkunitCache=class extends o.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Wuid}`)}},W=new WorkunitCache,it=class Workunit extends o.StateObject{connection;topologyConnection;get BaseUrl(){return this.connection.baseUrl}_debugMode=!1;_debugAllGraph;_submitAction;get properties(){return this.get()}get Wuid(){return this.get(`Wuid`)}get Owner(){return this.get(`Owner`,``)}get Cluster(){return this.get(`Cluster`,``)}get Jobname(){return this.get(`Jobname`,``)}get Description(){return this.get(`Description`,``)}get ActionEx(){return this.get(`ActionEx`,``)}get StateID(){return this.get(`StateID`,R.Unknown)}get State(){return this.get(`State`)||R[this.StateID]}get Protected(){return this.get(`Protected`,!1)}get Exceptions(){return this.get(`Exceptions`,{ECLException:[]})}get ResultViews(){return this.get(`ResultViews`,{View:[]})}_resultCache=new ResultCache;get ResultCount(){return this.get(`ResultCount`,0)}get Results(){return this.get(`Results`,{ECLResult:[]})}get CResults(){return this.Results.ECLResult.map(e=>this._resultCache.get(e,()=>Je.attach(this.connection,this.Wuid,e,this.ResultViews.View)))}get SequenceResults(){let e={};return this.CResults.forEach(t=>{e[t.Sequence]=t}),e}get Timers(){return this.get(`Timers`,{ECLTimer:[]})}get CTimers(){return this.Timers.ECLTimer.map(e=>new Timer(this.connection,this.Wuid,e))}_graphCache=new GraphCache;get GraphCount(){return this.get(`GraphCount`,0)}get Graphs(){return this.get(`Graphs`,{ECLGraph:[]})}get CGraphs(){return this.Graphs.ECLGraph.map(e=>this._graphCache.get(e,()=>new ECLGraph(this,e,this.CTimers)))}get ThorLogList(){return this.get(`ThorLogList`)}get ResourceURLCount(){return this.get(`ResourceURLCount`,0)}get ResourceURLs(){return this.get(`ResourceURLs`,{URL:[]})}get CResourceURLs(){return this.ResourceURLs.URL.map(e=>new Resource(this,e))}get TotalClusterTime(){return this.get(`TotalClusterTime`,``)}get DateTimeScheduled(){return this.get(`DateTimeScheduled`)}get IsPausing(){return this.get(`IsPausing`)}get ThorLCR(){return this.get(`ThorLCR`)}get ApplicationValues(){return this.get(`ApplicationValues`,{ApplicationValue:[]})}get HasArchiveQuery(){return this.get(`HasArchiveQuery`)}get StateEx(){return this.get(`StateEx`)}get PriorityClass(){return this.get(`PriorityClass`)}get PriorityLevel(){return this.get(`PriorityLevel`)}get Snapshot(){return this.get(`Snapshot`)}get ResultLimit(){return this.get(`ResultLimit`)}get EventSchedule(){return this.get(`EventSchedule`)}get Query(){return this.get(`Query`)}get HelpersCount(){return this.get(`HelpersCount`,0)}get Helpers(){return this.get(`Helpers`,{ECLHelpFile:[]})}get DebugValues(){return this.get(`DebugValues`)}get AllowedClusters(){return this.get(`AllowedClusters`)}get ErrorCount(){return this.get(`ErrorCount`,0)}get WarningCount(){return this.get(`WarningCount`,0)}get InfoCount(){return this.get(`InfoCount`,0)}get AlertCount(){return this.get(`AlertCount`,0)}get SourceFileCount(){return this.get(`SourceFileCount`,0)}get SourceFiles(){return this.get(`SourceFiles`,{ECLSourceFile:[]})}get CSourceFiles(){return this.SourceFiles.ECLSourceFile.map(e=>new SourceFile(this.connection,this.Wuid,e))}get VariableCount(){return this.get(`VariableCount`,0)}get Variables(){return this.get(`Variables`,{ECLResult:[]})}get TimerCount(){return this.get(`TimerCount`,0)}get HasDebugValue(){return this.get(`HasDebugValue`)}get ApplicationValueCount(){return this.get(`ApplicationValueCount`,0)}get XmlParams(){return this.get(`XmlParams`)}get AccessFlag(){return this.get(`AccessFlag`)}get ClusterFlag(){return this.get(`ClusterFlag`)}get ResultViewCount(){return this.get(`ResultViewCount`,0)}get DebugValueCount(){return this.get(`DebugValueCount`,0)}get WorkflowCount(){return this.get(`WorkflowCount`,0)}get Archived(){return this.get(`Archived`)}get RoxieCluster(){return this.get(`RoxieCluster`)}get DebugState(){return this.get(`DebugState`,{})}get Queue(){return this.get(`Queue`)}get Active(){return this.get(`Active`)}get Action(){return this.get(`Action`)}get Scope(){return this.get(`Scope`)}get AbortBy(){return this.get(`AbortBy`)}get AbortTime(){return this.get(`AbortTime`)}get AbortReason(){return this.get(`AbortReason`)}get Workflows(){return this.get(`Workflows`)}get TimingData(){return this.get(`TimingData`)}get HelpersDesc(){return this.get(`HelpersDesc`)}get GraphsDesc(){return this.get(`GraphsDesc`)}get SourceFilesDesc(){return this.get(`SourceFilesDesc`)}get ResultsDesc(){return this.get(`ResultsDesc`)}get VariablesDesc(){return this.get(`VariablesDesc`)}get TimersDesc(){return this.get(`TimersDesc`)}get DebugValuesDesc(){return this.get(`DebugValuesDesc`)}get ApplicationValuesDesc(){return this.get(`ApplicationValuesDesc`)}get WorkflowsDesc(){return this.get(`WorkflowsDesc`)}get ServiceNames(){return this.get(`ServiceNames`)}get CompileCost(){return this.get(`CompileCost`)}get ExecuteCost(){return this.get(`ExecuteCost`)}get FileAccessCost(){return this.get(`FileAccessCost`)}get NoAccess(){return this.get(`NoAccess`)}get ECLWUProcessList(){return this.get(`ECLWUProcessList`)}get CostSavingPotential(){return this.get(`CostSavingPotential`)}get FailureDesc(){return this.get(`FailureDesc`)}get FileSummaries(){return this.get(`FileSummaries`)}static create(e){let t=new Workunit(e);return t.connection.WUCreate().then(e=>(W.set(t),t.set(e.Workunit),t))}static attach(e,t,n){let r=W.get({BaseUrl:e.baseUrl,Wuid:t},()=>new Workunit(e,t));return n&&r.set(n),r}static existsLocal(e,t){return W.has({BaseUrl:e,Wuid:t})}static submit(e,t,n,r=!1){return Workunit.create(e).then(e=>e.update({QueryText:n})).then(e=>r?e.submit(t,z.Action.Compile):e.submit(t))}static compile(e,t,n){return Workunit.submit(e,t,n,!0)}static query(e,t){return new WorkunitsService(e).WUQuery(t).then(t=>t.Workunits.ECLWorkunit.map(function(t){return Workunit.attach(e,t.Wuid,t)}))}constructor(e,t){super(),this.connection=new WorkunitsService(e),this.topologyConnection=new TopologyService(e),this.clearState(t)}clearState(e){this.clear({Wuid:e,StateID:R.Unknown})}update(e){return this.connection.WUUpdate({...e,Wuid:this.Wuid,StateOrig:this.StateID,JobnameOrig:this.Jobname,DescriptionOrig:this.Description,ProtectedOrig:this.Protected,ClusterOrig:this.Cluster}).then(e=>(this.set(e.Workunit),this))}submit(e,t=z.Action.Run,n){let r;return r=e===void 0?this.topologyConnection.DefaultTpLogicalClusterQuery().then(e=>e.Name):Promise.resolve(e),this._debugMode=!1,t===z.Action.Debug&&(t=z.Action.Run,this._debugMode=!0),r.then(e=>this.connection.WUUpdate({Wuid:this.Wuid,Action:t,ResultLimit:n,DebugValues:{DebugValue:[{Name:`Debug`,Value:this._debugMode?`1`:``}]}}).then(n=>(this.set(n.Workunit),this._submitAction=t,this.connection.WUSubmit({Wuid:this.Wuid,Cluster:e})))).then(()=>this)}isComplete(){switch(this.StateID){case R.Compiled:return this.ActionEx===`compile`||this._submitAction===z.Action.Compile;case R.Completed:case R.Failed:case R.Aborted:case R.NotFound:return!0}return!1}isFailed(){switch(this.StateID){case R.Aborted:case R.Failed:return!0}return!1}isDeleted(){switch(this.StateID){case R.NotFound:return!0}return!1}isDebugging(){switch(this.StateID){case R.DebugPaused:case R.DebugRunning:return!0}return this._debugMode}isRunning(){switch(this.StateID){case R.Compiled:case R.Running:case R.Aborting:case R.Blocked:case R.DebugPaused:case R.DebugRunning:return!0}return!1}setToFailed(){return this.WUAction(L.ECLWUActions.SetToFailed)}pause(){return this.WUAction(L.ECLWUActions.Pause)}pauseNow(){return this.WUAction(L.ECLWUActions.PauseNow)}resume(){return this.WUAction(L.ECLWUActions.Resume)}abort(){return this.WUAction(L.ECLWUActions.Abort)}protect(){return this.WUAction(L.ECLWUActions.Protect)}unprotect(){return this.WUAction(L.ECLWUActions.Unprotect)}delete(){return this.WUAction(L.ECLWUActions.Delete)}restore(){return this.WUAction(L.ECLWUActions.Restore)}deschedule(){return this.WUAction(L.ECLWUActions.Deschedule)}reschedule(){return this.WUAction(L.ECLWUActions.Reschedule)}recover(){return this.WUResubmit({CloneWorkunit:!1,ResetWorkflow:!1}).then(()=>(this.clearState(this.Wuid),this.refresh().then(()=>(this._monitor(),this))))}resubmit(){return this.WUResubmit({CloneWorkunit:!1,ResetWorkflow:!0}).then(()=>(this.clearState(this.Wuid),this.refresh().then(()=>(this._monitor(),this))))}clone(){return this.WUResubmit({CloneWorkunit:!0,ResetWorkflow:!1}).then(e=>Workunit.attach(this.connection.opts(),e.WUs.WU[0].WUID).refresh())}async refreshState(){return await this.WUQuery(),this.StateID===R.Compiled&&!this.ActionEx&&!this._submitAction&&await this.refreshInfo(),this}async refreshInfo(e){return await this.WUInfo(e),this}async refreshDebug(){return await this.debugStatus(),this}async refresh(e=!1,t){return e?await Promise.all([this.refreshInfo(t),this.refreshDebug()]):await this.refreshState(),this}eclExceptions(){return this.Exceptions.ECLException}fetchArchive(){return this.connection.WUFileEx({Wuid:this.Wuid,Type:`ArchiveQuery`})}fetchECLExceptions(){return this.WUInfo({IncludeExceptions:!0}).then(()=>this.eclExceptions())}fetchResults(){return this.WUInfo({IncludeResults:!0}).then(()=>this.CResults)}fetchGraphs(){return this.WUInfo({IncludeGraphs:!0}).then(()=>this.CGraphs)}fetchQuery(){return this.WUInfo({IncludeECL:!0,TruncateEclTo64k:!1}).then(()=>this.Query)}fetchHelpers(){return this.WUInfo({IncludeHelpers:!0}).then(()=>this.Helpers?.ECLHelpFile||[])}fetchAllowedClusters(){return this.WUInfo({IncludeAllowedClusters:!0}).then(()=>this.AllowedClusters?.AllowedCluster||[])}fetchTotalClusterTime(){return this.WUInfo({IncludeTotalClusterTime:!0}).then(()=>this.TotalClusterTime)}fetchServiceNames(){return this.WUInfo({IncludeServiceNames:!0}).then(()=>this.ServiceNames?.Item)}fetchDetailsMeta(e={}){return this.WUDetailsMeta(e)}fetchDetailsRaw(e={},t,n){return this.WUDetails(e,t,n).then(e=>{switch(n){case`arraybuffer`:return e;case`text`:case`xsd`:return e;default:return e.Scopes.Scope}})}normalizeDetails(e,t){let n={id:{Measure:`label`},name:{Measure:`label`},type:{Measure:`label`}},r=new Map;for(let t of e.Activities?.Activity??[])r.set(t.Kind,t.Name);let i=Array(t.length);for(let e=0;e<t.length;e++){let a=t[e],o={},s={};if(a.Properties?.Property)for(let e of a.Properties.Property){let t=e.Measure,i=e.Name,a=e.RawValue;if(t===`ns`&&(e.Measure=`s`),i===`Kind`){let t=parseInt(a,10);e.Formatted=r.get(t)??a}switch(n[i]={Name:e.Name,Measure:e.Measure,Creator:e.Creator,CreatorType:e.CreatorType},e.Measure){case`bool`:o[i]=!!+a;break;case`sz`:o[i]=+a;break;case`s`:o[i]=a/1e9;break;case`ns`:o[i]=+a;break;case`ts`:o[i]=new Date(a/1e3).toISOString();break;case`cnt`:o[i]=+a;break;case`cost`:o[i]=a/1e6;break;case`node`:o[i]=+a;break;case`skw`:o[i]=+a;break;default:o[i]=a}s[i]=formatNum(e.Formatted??o[i])}let c={id:a.Id,name:a.ScopeName,type:a.ScopeType,Kind:a.Kind,Label:a.Label,__formattedProps:s,__groupedProps:{},__groupedRawProps:{},__StdDevs:0,__StdDevsSource:``,...o},l=c[Qe];if(l)try{let e=JSON.parse(l.split(`\\`).join(`\\\\`)),t=[];for(let n=0;n<e.length;n++){let r=e[n].match($e);r&&t.push({filePath:(r[1]??``)+r[2]+r[3],line:parseInt(r[5],10),col:parseInt(r[6],10)})}c[Qe]=t}catch{U.error(`Unexpected "DefinitionList": ${l}`)}let u={},d=0,f=``;for(let e in c)if(!e.startsWith(`__`)){let t=formatValues(c,e,u);t&&(c.__groupedProps[t.Key]=t,!isNaN(t.StdDevs)&&t.StdDevs>d&&(d=t.StdDevs,f=t.Key))}c.__StdDevs=d,c.__StdDevsSource=f,i[e]=c}return{meta:e,columns:n,data:i}}fetchDetailsNormalized(e={}){return Promise.all([this.fetchDetailsMeta(),this.fetchDetailsRaw(e)]).then(e=>this.normalizeDetails(e[0],e[1]))}fetchInfo(e={}){return this.WUInfo(e)}fetchDetails(e={},t,n){return this.WUDetails(e,t,n).then(e=>{switch(n){case`arraybuffer`:return e;case`text`:case`xsd`:return e;default:return e.Scopes.Scope.map(e=>new Scope(this,e))}})}fetchDetailsHierarchy(e={}){return this.WUDetails(e).then(e=>{let t=[],n={};e.Scopes.Scope.forEach(e=>{if(n[e.ScopeName])return n[e.ScopeName].update(e),null;{let t=new Scope(this,e);return n[t.ScopeName]=t,t}});for(let e in n)if(n.hasOwnProperty(e)){let r=n[e],i=r.parentScope();i&&n[i]?n[i].children().push(r):t.push(r)}return t})}fetchGraphDetails(e=[],t){return this.fetchDetails({ScopeFilter:{MaxDepth:999999,Ids:e,ScopeTypes:t},NestedFilter:{Depth:999999,ScopeTypes:[`graph`,`subgraph`,`activity`,`edge`,`function`]},PropertiesToReturn:{AllStatistics:!0,AllAttributes:!0,AllHints:!0,AllProperties:!0,AllScopes:!0},ScopeOptions:{IncludeId:!0,IncludeScope:!0,IncludeScopeType:!0},PropertyOptions:{IncludeName:!0,IncludeRawValue:!0,IncludeFormatted:!0,IncludeMeasure:!0,IncludeCreator:!1,IncludeCreatorType:!1}})}fetchScopeGraphs(e=[]){return this.fetchGraphDetails(e,[`graph`]).then(e=>createGraph(e))}fetchTimeElapsed(){return this.fetchDetails({ScopeFilter:{PropertyFilters:{PropertyFilter:[{Name:`TimeElapsed`}]}}}).then(e=>{let t={};e.forEach(e=>{t[e.ScopeName]=t[e.ScopeName]||{scope:e.ScopeName,start:null,elapsed:null,finish:null},e.CAttributes.forEach(n=>{n.Name===`TimeElapsed`?t[e.ScopeName].elapsed=+n.RawValue:n.Measure===`ts`&&n.Name.indexOf(`Started`)>=0&&(t[e.ScopeName].start=n.Formatted)})});let n=[];for(let e in t){let r=t[e];if(r.start&&r.elapsed){let e=Xe(r.start);e.setMilliseconds(e.getMilliseconds()+r.elapsed/1e6),r.finish=Ye(e),n.push(r)}}return n.sort((e,t)=>e.start<t.start?-1:+(e.start>t.start)),n})}_monitor(){this.isComplete()?this._monitorTickCount=0:super._monitor()}_monitorTimeoutDuration(){let e=super._monitorTimeoutDuration();return this._monitorTickCount<=1?1e3:this._monitorTickCount<=3?3e3:this._monitorTickCount<=5?5e3:this._monitorTickCount<=7?1e4:e}on(e,t,n){if(this.isCallback(t))switch(e){case`completed`:super.on(`propChanged`,`StateID`,e=>{this.isComplete()&&t([e])});break;case`changed`:super.on(e,t)}else switch(e){case`changed`:super.on(e,t,n)}return this._monitor(),this}watchUntilComplete(e){return new Promise((t,n)=>{let r=this.watch(n=>{e&&e(n),this.isComplete()&&(r.release(),t(this))})})}watchUntilRunning(e){return new Promise((t,n)=>{let r=this.watch(n=>{e&&e(n),(this.isComplete()||this.isRunning())&&(r.release(),t(this))})})}WUQuery(e={}){return this.connection.WUQuery({...e,Wuid:this.Wuid}).then(e=>(e.Workunits.ECLWorkunit.length===0?(this.clearState(this.Wuid),this.set(`StateID`,R.NotFound)):this.set(e.Workunits.ECLWorkunit[0]),e)).catch(e=>{if(!e.Exception.some(e=>e.Code===20081&&(this.clearState(this.Wuid),this.set(`StateID`,R.NotFound),!0)))throw U.warning(`Unexpected ESP exception: ${e.message}`),e;return{}})}WUCreate(){return this.connection.WUCreate().then(e=>(this.set(e.Workunit),W.set(this),e))}WUInfo(e={}){let t=e.IncludeResults||e.IncludeResultsViewNames;return this.connection.WUInfo({...e,Wuid:this.Wuid,IncludeResults:t,IncludeResultsViewNames:t,SuppressResultSchemas:!1}).then(e=>(this.set(e.Workunit),t&&this.set({ResultViews:e.ResultViews}),e)).catch(e=>{if(!e.Exception.some(e=>e.Code===20080&&(this.clearState(this.Wuid),this.set(`StateID`,R.NotFound),!0)))throw U.warning(`Unexpected ESP exception: ${e.message}`),e;return{}})}WUResubmit(e){return this.connection.WUResubmit((0,o.deepMixinT)({},e,{Wuids:{Item:[this.Wuid]}}))}WUDetailsMeta(e){return this.connection.WUDetailsMeta(e)}WUDetails(e,t,n){return this.connection.WUDetailsEx((0,o.deepMixinT)({ScopeFilter:{MaxDepth:9999},ScopeOptions:{IncludeMatchedScopesInResults:!0,IncludeScope:!0,IncludeId:!1,IncludeScopeType:!1},PropertyOptions:{IncludeName:!0,IncludeRawValue:!1,IncludeFormatted:!0,IncludeMeasure:!0,IncludeCreator:!1,IncludeCreatorType:!1}},e,{WUID:this.Wuid}),t,n).then(e=>{switch(n){case`arraybuffer`:case`text`:case`xsd`:return e;default:return e.Scopes===void 0?e.Scopes={Scope:[]}:e.Scopes.Scope===void 0&&(e.Scopes.Scope=[]),e}})}WUAction(e){return this.connection.WUAction({Wuids:{Item:[this.Wuid]},WUActionType:e}).then(e=>this.refresh().then(()=>(this._monitor(),e)))}publish(e){return this.connection.WUPublishWorkunit({Wuid:this.Wuid,Cluster:this.Cluster,JobName:e||this.Jobname,AllowForeignFiles:!0,Activate:L.WUQueryActivationMode.ActivateQuery,Wait:5e3})}publishEx(e){let t=new WorkunitsServiceEx({baseUrl:``}),n={Wuid:this.Wuid,Cluster:this.Cluster,JobName:this.Jobname,AllowForeignFiles:!0,Activate:1,Wait:5e3,...e};return t.WUPublishWorkunitEx(n)}WUCDebug(e,t={}){let n=``;for(let e in t)t.hasOwnProperty(e)&&(n+=` ${e}='${t[e]}'`);return this.connection.WUCDebugEx({Wuid:this.Wuid,Command:`<debug:${e} uid='${this.Wuid}'${n}/>`}).then(e=>e)}debug(e,t){return this.isDebugging()?this.WUCDebug(e,t).then(t=>{let n=t.children(e);return n.length?n[0]:new o.XMLNode(e)}).catch(t=>(U.error(t),Promise.resolve(new o.XMLNode(e)))):Promise.resolve(new o.XMLNode(e))}debugStatus(){return this.isDebugging()?this.debug(`status`).then(e=>{let t={...this.DebugState,...e.$};return this.set({DebugState:t}),e}):Promise.resolve({DebugState:{state:`unknown`}})}debugContinue(e=``){return this.debug(`continue`,{mode:e})}debugStep(e){return this.debug(`step`,{mode:e})}debugPause(){return this.debug(`interrupt`)}debugQuit(){return this.debug(`quit`)}debugDeleteAllBreakpoints(){return this.debug(`delete`,{idx:0})}debugBreakpointResponseParser(e){return e.children().map(e=>{if(e.name===`break`)return e.$})}debugBreakpointAdd(e,t,n){return this.debug(`breakpoint`,{id:e,mode:t,action:n}).then(e=>this.debugBreakpointResponseParser(e))}debugBreakpointList(){return this.debug(`list`).then(e=>this.debugBreakpointResponseParser(e))}debugGraph(){return this._debugAllGraph&&this.DebugState._prevGraphSequenceNum===this.DebugState.graphSequenceNum?Promise.resolve(this._debugAllGraph):this.debug(`graph`,{name:`all`}).then(e=>(this.DebugState._prevGraphSequenceNum=this.DebugState.graphSequenceNum,this._debugAllGraph=createXGMMLGraph(this.Wuid,e),this._debugAllGraph))}debugBreakpointValid(e){return this.debugGraph().then(t=>breakpointLocations(t,e))}debugPrint(e,t=0,n=10){return this.debug(`print`,{edgeID:e,startRow:t,numRows:n}).then(e=>e.children().map(e=>{let t={};return e.children().forEach(e=>{t[e.name]=e.content}),t}))}},at=`definition`;function hasECLDefinition(e){return e._[at]!==void 0}function getECLDefinition(e){let t=/([a-z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(e._[at]);if(t){let[,n,r,i]=t;return n.replace(/\/\.\//g,`/`),{id:e._.id,file:n,line:+r,column:+i}}throw Error(`Bad definition: ${e._[at]}`)}function breakpointLocations(e,t){let n=[];for(let r of e.vertices)if(hasECLDefinition(r)){let e=getECLDefinition(r);(e&&!t||t===e.file)&&n.push(e)}return n.sort((e,t)=>e.line-t.line)}var ot,st=class Activity extends o.StateObject{connection;get properties(){return this.get()}get Exceptions(){return this.get(`Exceptions`)}get Build(){return this.get(`Build`)}get ThorClusterList(){return this.get(`ThorClusterList`)}get RoxieClusterList(){return this.get(`RoxieClusterList`)}get HThorClusterList(){return this.get(`HThorClusterList`)}get DFUJobs(){return this.get(`DFUJobs`)}get Running(){return this.get(`Running`,{ActiveWorkunit:[]})}get BannerContent(){return this.get(`BannerContent`)}get BannerColor(){return this.get(`BannerColor`)}get BannerSize(){return this.get(`BannerSize`)}get BannerScroll(){return this.get(`BannerScroll`)}get ChatURL(){return this.get(`ChatURL`)}get ShowBanner(){return this.get(`ShowBanner`)}get ShowChatURL(){return this.get(`ShowChatURL`)}get SortBy(){return this.get(`SortBy`)}get Descending(){return this.get(`Descending`)}get SuperUser(){return this.get(`SuperUser`)}get AccessRight(){return this.get(`AccessRight`)}get ServerJobQueues(){return this.get(`ServerJobQueues`)}get ActivityTime(){return this.get(`ActivityTime`)}get DaliDetached(){return this.get(`DaliDetached`)}static attach(e,t){return ot||=new Activity(e),t&&ot.set(t),ot}constructor(e){super(),this.connection=e instanceof SMCService?e:new SMCService(e),this.clear({})}runningWorkunits(e=``){return this.Running.ActiveWorkunit.filter(t=>e===``||t.ClusterName===e).map(e=>it.attach(this.connection.connectionOptions(),e.Wuid,e))}setBanner(e){return this.connection.SetBanner({...e}).then(e=>(this.set(e),this))}lazyRefresh=(0,o.debounce)(async()=>{let e=await this.connection.Activity({});return this.set(e),this});async refresh(){return this.lazyRefresh()}},ct=(0,o.scopedLogger)(`logicalFile.ts`),LogicalFileCache=class extends o.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Cluster}-${e.Name}`)}},lt=new LogicalFileCache,ut=class LogicalFile extends o.StateObject{connection;get BaseUrl(){return this.connection.baseUrl}get Cluster(){return this.get(`Cluster`)}get Name(){return this.get(`Name`)}get Filename(){return this.get(`Filename`)}get Prefix(){return this.get(`Prefix`)}get NodeGroup(){return this.get(`NodeGroup`)}get NumParts(){return this.get(`NumParts`)}get Description(){return this.get(`Description`)}get Dir(){return this.get(`Dir`)}get PathMask(){return this.get(`PathMask`)}get Filesize(){return this.get(`Filesize`)}get FileSizeInt64(){return this.get(`FileSizeInt64`)}get RecordSize(){return this.get(`RecordSize`)}get RecordCount(){return this.get(`RecordCount`)}get RecordSizeInt64(){return this.get(`RecordSizeInt64`)}get RecordCountInt64(){return this.get(`RecordCountInt64`)}get Wuid(){return this.get(`Wuid`)}get Owner(){return this.get(`Owner`)}get JobName(){return this.get(`JobName`)}get Persistent(){return this.get(`Persistent`)}get Format(){return this.get(`Format`)}get MaxRecordSize(){return this.get(`MaxRecordSize`)}get CsvSeparate(){return this.get(`CsvSeparate`)}get CsvQuote(){return this.get(`CsvQuote`)}get CsvTerminate(){return this.get(`CsvTerminate`)}get CsvEscape(){return this.get(`CsvEscape`)}get Modified(){return this.get(`Modified`)}get Ecl(){return this.get(`Ecl`)}get Stat(){return this.get(`Stat`)}get DFUFilePartsOnClusters(){return this.get(`DFUFilePartsOnClusters`)}get isSuperfile(){return this.get(`isSuperfile`)}get ShowFileContent(){return this.get(`ShowFileContent`)}get subfiles(){return this.get(`subfiles`)}get Superfiles(){return this.get(`Superfiles`)}get ProtectList(){return this.get(`ProtectList`)}get FromRoxieCluster(){return this.get(`FromRoxieCluster`)}get Graphs(){return this.get(`Graphs`)}get UserPermission(){return this.get(`UserPermission`)}get ContentType(){return this.get(`ContentType`)}get CompressedFileSize(){return this.get(`CompressedFileSize`)}get PercentCompressed(){return this.get(`PercentCompressed`)}get IsCompressed(){return this.get(`IsCompressed`)}get BrowseData(){return this.get(`BrowseData`)}get jsonInfo(){return this.get(`jsonInfo`)}get binInfo(){return this.get(`binInfo`)}get PackageID(){return this.get(`PackageID`)}get Partition(){return this.get(`Partition`)}get Blooms(){return this.get(`Blooms`)}get ExpireDays(){return this.get(`ExpireDays`)}get KeyType(){return this.get(`KeyType`)}get IsRestricted(){return this.get(`IsRestricted`)}get AtRestCost(){return this.get(`AtRestCost`)}get AccessCost(){return this.get(`AccessCost`)}get StateID(){return this.get(`StateID`)}get ExpirationDate(){return this.get(`ExpirationDate`)}get ExtendedIndexInfo(){return this.get(`ExtendedIndexInfo`)}get CompressionType(){return this.get(`CompressionType`)}get properties(){return this.get()}static attach(e,t,n,r){let i=lt.get({BaseUrl:e.baseUrl,Cluster:t,Name:n},()=>new LogicalFile(e,t,n));return r&&i.set(r),i}constructor(e,t,n){super(),this.connection=e instanceof DFUService?e:new DFUService(e),this.clear({Cluster:t,Name:n})}filePartsOnCluster(){return[...this.DFUFilePartsOnClusters?.DFUFilePartsOnCluster||[]]}fileParts(){let e=[];for(let t of this.DFUFilePartsOnClusters?.DFUFilePartsOnCluster||[])for(let n of t?.DFUFileParts?.DFUPart||[]){let r={...t,...n};delete r.DFUFileParts,e.push(r)}return e}update(e){return this.connection.DFUInfo({...e,Cluster:this.Cluster,Name:this.Name}).then(e=>(this.set({Cluster:this.Cluster,...e.FileDetail}),e))}fetchInfo(){return this.connection.DFUInfo({Cluster:this.Cluster,Name:this.Name}).then(e=>(this.set({Cluster:this.Cluster,...e.FileDetail,ProtectList:e?.FileDetail?.ProtectList??{DFUFileProtect:[]}}),e.FileDetail)).catch(e=>{if(!e.Exception.some(e=>e.Code===20038&&(this.set(`Name`,this.Name+` (Deleted)`),this.set(`StateID`,999),!0)))throw ct.warning(`Unexpected ESP exception: ${e.message}`),e;return{}})}fetchDefFile(e){return this.connection.DFUFile({Name:this.Name,Format:e})}fetchAllLogicalFiles(){return this.connection.recursiveFetchLogicalFiles([this])}fetchListHistory(){return this.connection.ListHistory({Name:this.Name}).then(e=>e?.History?.Origin||[])}eraseHistory(){return this.connection.EraseHistory({Name:this.Name}).then(e=>e?.History?.Origin||[])}},MachineCache=class extends o.Cache{constructor(){super(e=>e.Address)}},dt=new MachineCache,ft=class Machine extends o.StateObject{connection;get Address(){return this.get(`Address`)}get ConfigAddress(){return this.get(`ConfigAddress`)}get Name(){return this.get(`Name`)}get ProcessType(){return this.get(`ProcessType`)}get DisplayType(){return this.get(`DisplayType`)}get Description(){return this.get(`Description`)}get AgentVersion(){return this.get(`AgentVersion`)}get Contact(){return this.get(`Contact`)}get Location(){return this.get(`Location`)}get UpTime(){return this.get(`UpTime`)}get ComponentName(){return this.get(`ComponentName`)}get ComponentPath(){return this.get(`ComponentPath`)}get RoxieState(){return this.get(`RoxieState`)}get RoxieStateDetails(){return this.get(`RoxieStateDetails`)}get OS(){return this.get(`OS`)}get ProcessNumber(){return this.get(`ProcessNumber`)}get Channels(){return this.get(`Channels`)}get Processors(){return this.get(`Processors`)}get Storage(){return this.get(`Storage`)}get Running(){return this.get(`Running`)}get PhysicalMemory(){return this.get(`PhysicalMemory`)}get VirtualMemory(){return this.get(`VirtualMemory`)}get ComponentInfo(){return this.get(`ComponentInfo`)}get Exception(){return this.get(`Exception`)}static attach(e,t,n){let r=dt.get({Address:t},()=>new Machine(e));return n&&r.set(n),r}constructor(e){super(),this.connection=e instanceof MachineService?e:new MachineService(e)}},TargetClusterCache=class extends o.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Name}`)}},pt=new TargetClusterCache,G=class TargetCluster extends o.StateObject{connection;machineConnection;get BaseUrl(){return this.connection.baseUrl}get Name(){return this.get(`Name`)}get Prefix(){return this.get(`Prefix`)}get Type(){return this.get(`Type`)}get IsDefault(){return this.get(`IsDefault`)}get TpClusters(){return this.get(`TpClusters`)}get TpEclCCServers(){return this.get(`TpEclCCServers`)}get TpEclServers(){return this.get(`TpEclServers`)}get TpEclAgents(){return this.get(`TpEclAgents`)}get TpEclSchedulers(){return this.get(`TpEclSchedulers`)}get MachineInfoEx(){return this.get(`MachineInfoEx`,[])}get CMachineInfoEx(){return this.MachineInfoEx.map(e=>ft.attach(this.machineConnection,e.Address,e))}static attach(e,t,n){let r=pt.get({BaseUrl:e.baseUrl,Name:t},()=>new TargetCluster(e,t));return n&&r.set(n),r}constructor(e,t){super(),e instanceof TopologyService?(this.connection=e,this.machineConnection=new MachineService(e.connectionOptions())):(this.connection=new TopologyService(e),this.machineConnection=new MachineService(e)),this.clear({Name:t})}fetchMachines(e={}){return this.machineConnection.GetTargetClusterInfo({TargetClusters:{Item:[`${this.Type}:${this.Name}`]},...e}).then(e=>{let t=[];for(let n of e.TargetClusterInfoList.TargetClusterInfo)for(let e of n.Processes.MachineInfoEx)t.push(e);return this.set(`MachineInfoEx`,t),this.CMachineInfoEx})}machineStats(){let e=0,t=0,n=0;for(let r of this.CMachineInfoEx)for(let i of r.Storage.StorageInfo){t+=i.Available,n+=i.Total;let r=1-i.Available/i.Total;r>e&&(e=r)}return{maxDisk:e,meanDisk:1-(n?t/n:1)}}fetchUsage(){return this.machineConnection.GetTargetClusterUsageEx([this.Name])}};function targetClusters(e){let t;return t=e instanceof TopologyService?e:new TopologyService(e),t.TpListTargetClusters({}).then(t=>t.TargetClusters.TpClusterNameType.map(t=>G.attach(e,t.Name,t)))}var mt={};function defaultTargetCluster(e){if(!mt[e.baseUrl]){let t;t=e instanceof TopologyService?e:new TopologyService(e),mt[e.baseUrl]=t.TpListTargetClusters({}).then(t=>{let n,r,i;t.TargetClusters.TpClusterNameType.forEach(e=>{n||=e,!r&&e.IsDefault===!0&&(r=e),!i&&e.Type===`hthor`&&(i=e)});let a=r||i||n;return G.attach(e,a.Name,a)})}return mt[e.baseUrl]}var TopologyCache=class extends o.Cache{constructor(){super(e=>e.BaseUrl)}},ht=new TopologyCache,gt=class Topology extends o.StateObject{connection;get BaseUrl(){return this.connection.baseUrl}get properties(){return this.get()}get TargetClusters(){return this.get(`TargetClusters`)}get CTargetClusters(){return this.TargetClusters.map(e=>G.attach(this.connection,e.Name,e))}get LogicalClusters(){return this.get(`LogicalClusters`)}get Services(){return this.get(`Services`)}static attach(e,t){let n=ht.get({BaseUrl:e.baseUrl},()=>new Topology(e));return t&&n.set(t),n}constructor(e){super(),this.connection=e instanceof TopologyService?e:new TopologyService(e)}GetESPServiceBaseURL(e=``){return this.connection.TpServiceQuery({}).then(t=>{let n=this.connection.protocol(),r=this.connection.ip(),i=n===`https:`?`18002`:`8002`;if((0,o.exists)(`ServiceList.TpEspServers.TpEspServer`,t)){for(let r of t.ServiceList.TpEspServers.TpEspServer)if((0,o.exists)(`TpBindings.TpBinding`,r))for(let t of r.TpBindings.TpBinding)t.Service===e&&t.Protocol+`:`===n&&(i=t.Port)}return`${n}//${r}:${i}/`})}fetchTargetClusters(){return this.connection.TpTargetClusterQuery({Type:`ROOT`}).then(e=>(this.set({TargetClusters:e.TpTargetClusters?.TpTargetCluster??[]}),this.CTargetClusters))}fetchLogicalClusters(e={}){return this.connection.TpLogicalClusterQuery(e).then(e=>(this.set({LogicalClusters:e.TpLogicalClusters.TpLogicalCluster}),this.LogicalClusters))}fetchServices(e={}){return this.connection.TpServiceQuery(e).then(e=>(this.set({Services:e.ServiceList}),this.Services))}_prevRefresh;refresh(e=!1){return(!this._prevRefresh||e)&&(this._prevRefresh=Promise.all([this.fetchTargetClusters(),this.fetchLogicalClusters(),this.fetchServices()]).then(()=>this)),this._prevRefresh}on(e,t,n){if(this.isCallback(t))switch(e){case`changed`:super.on(e,t)}else switch(e){case`changed`:super.on(e,t,n)}return this._monitor(),this}};function safeAssign(e,t,n){t!==`__proto__`&&t!==`constructor`&&t!==`prototype`&&(e[t]=n)}function xmlEncode(e){return e=``+e,e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/\n/g,`&#10;`).replace(/\r/g,`&#13;`)}function espTime2Seconds(e){if(!e)return 0;if(!isNaN(+e))return parseFloat(e);let t=/(?:(?:(\d+).days.)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+\.\d+|\d+)s))|(?:(\d+\.\d+|\d+)ms|(\d+\.\d+|\d+)us|(\d+\.\d+|\d+)ns)/.exec(e);if(!t)return 0;let n=+t[1]||0,r=+t[2]||0,i=+t[3]||0,a=+t[4]||0,o=+t[5]||0,s=+t[6]||0,c=+t[7]||0;return n*24*60*60+r*60*60+i*60+a+o/1e3+s/1e6+c/1e9}function unitTest(e,t){let n=e.indexOf(t);return n===-1?-1:parseFloat(e.substring(0,n))}function espSize2Bytes(e){if(!e)return 0;if(!isNaN(+e))return parseFloat(e);let t=unitTest(e,`Kb`);return t>=0?t*1024:(t=unitTest(e,`Mb`),t>=0?t*1024**2:(t=unitTest(e,`Gb`),t>=0?t*1024**3:(t=unitTest(e,`Tb`),t>=0?t*1024**4:(t=unitTest(e,`Pb`),t>=0?t*1024**5:(t=unitTest(e,`Eb`),t>=0?t*1024**6:(t=unitTest(e,`Zb`),t>=0?t*1024**7:(t=unitTest(e,`b`),t>=0?t:0)))))))}function espSkew2Number(e){return e?parseFloat(e):0}var K=function(e){return e[e.UNKNOWN=0]=`UNKNOWN`,e[e.GRAPH=1]=`GRAPH`,e[e.SUBGRAPH=2]=`SUBGRAPH`,e[e.VERTEX=3]=`VERTEX`,e[e.EDGE=4]=`EDGE`,e[e.LAST=5]=`LAST`,e}(K||{}),q=function(e){return e.UNKNOWN=`Unknown`,e.GRAPH=`Graph`,e.SUBGRAPH=`Cluster`,e.VERTEX=`Vertex`,e.EDGE=`Edge`,e.LAST=`Last`,e}(q||{}),LocalisedXGMMLWriter=class{graph;m_xgmml;m_visibleSubgraphs;m_visibleVertices;m_semiVisibleVertices;m_visibleEdges;noSpills;constructor(e){this.graph=e,this.m_xgmml=``,this.m_visibleSubgraphs={},this.m_visibleVertices={},this.m_semiVisibleVertices={},this.m_visibleEdges={}}calcVisibility(e,t,n,r){this.noSpills=r,e.forEach(e=>{this.graph.isVertex(e)?(this.calcInVertexVisibility(e,n),this.calcOutVertexVisibility(e,n)):this.graph.isEdge(e)?(this.calcInVertexVisibility(e.getSource(),n-1),this.calcOutVertexVisibility(e.getTarget(),n-1)):this.graph.isSubgraph(e)&&(this.m_visibleSubgraphs[e.__hpcc_id]=e,this.calcSubgraphVisibility(e,t-1))}),this.calcVisibility2()}calcInVertexVisibility(e,t){this.noSpills&&e.isSpill()&&t++,this.m_visibleVertices[e.__hpcc_id]=e,t>0&&e.getInEdges().forEach(e=>{this.calcInVertexVisibility(e.getSource(),t-1)})}calcOutVertexVisibility(e,t){this.noSpills&&e.isSpill()&&t++,this.m_visibleVertices[e.__hpcc_id]=e,t>0&&e.getOutEdges().forEach(e=>{this.calcOutVertexVisibility(e.getTarget(),t-1)})}calcSubgraphVisibility(e,t){if(t<0)return;t>0&&e.__hpcc_subgraphs.forEach((e,n)=>{this.calcSubgraphVisibility(e,t-1)}),e.__hpcc_subgraphs.forEach((e,t)=>{this.m_visibleSubgraphs[e.__hpcc_id]=e}),e.__hpcc_vertices.forEach((e,t)=>{this.m_visibleVertices[e.__hpcc_id]=e});let n={};this.graph.edges.forEach((t,r)=>{t.getSource().__hpcc_parent!==t.getTarget().__hpcc_parent&&e===this.getCommonAncestor(t)&&(n[t.getSource().__hpcc_parent.__hpcc_id+`::`+t.getTarget().__hpcc_parent.__hpcc_id]||(n[t.getSource().__hpcc_parent.__hpcc_id+`::`+t.getTarget().__hpcc_parent.__hpcc_id]=!0,this.m_visibleEdges[t.__hpcc_id]=t))})}buildVertexString(e,t){let n=``,r=``,i=e.getProperties();for(let e in i)t&&e.indexOf(`_kind`)>=0?r+=`<att name="_kind" value="point"/>`:e===`id`||e===`label`?n+=` `+e+`="`+xmlEncode(i[e])+`"`:r+=`<att name="`+e+`" value="`+xmlEncode(i[e])+`"/>`;return`<node`+n+`>`+r+`</node>`}buildEdgeString(e){let t=``,n=``,r=e.getProperties();for(let e in r)e.toLowerCase()===`id`||e.toLowerCase()===`label`||e.toLowerCase()===`source`||e.toLowerCase()===`target`?t+=` `+e+`="`+xmlEncode(r[e])+`"`:n+=`<att name="`+e+`" value="`+xmlEncode(r[e])+`"/>`;return`<edge`+t+`>`+n+`</edge>`}getAncestors(e,t){let n=e.__hpcc_parent;for(;n;)t.push(n),n=n.__hpcc_parent}getCommonAncestorV(e,t){let n=[],r=[];this.getAncestors(e,n),this.getAncestors(t,r);let i=n.length-1,a=r.length-1,o=null;for(;i>=0&&a>=0&&n[i]===r[a];)o=n[i],--i,--a;return o}getCommonAncestor(e){return this.getCommonAncestorV(e.getSource(),e.getTarget())}calcAncestorVisibility(e){let t=[];this.getAncestors(e,t),t.forEach((e,t)=>{this.m_visibleSubgraphs[e.__hpcc_id]=e})}calcVisibility2(){for(let e in this.m_visibleVertices){let t=this.m_visibleVertices[e];t.getInEdges().forEach((e,t)=>{this.m_visibleEdges[e.__hpcc_id]=e}),t.getOutEdges().forEach((e,t)=>{this.m_visibleEdges[e.__hpcc_id]=e}),this.calcAncestorVisibility(t)}this.calcSemiVisibleVertices()}addSemiVisibleEdge(e){e&&!this.m_visibleEdges[e.__hpcc_id]&&(this.m_visibleEdges[e.__hpcc_id]=e)}addSemiVisibleVertex(e){this.m_visibleVertices[e.__hpcc_id]||(this.m_semiVisibleVertices[e.__hpcc_id]=e,this.calcAncestorVisibility(e))}calcSemiVisibleVertices(){for(let e in this.m_visibleEdges){let t=this.m_visibleEdges[e],n=t.getSource();for(this.addSemiVisibleVertex(n);this.noSpills&&n.isSpill();){let e=n.getInEdges();if(e.length)this.addSemiVisibleEdge(e[0]),n=e[0].getSource(),this.addSemiVisibleVertex(n);else break}let r=t.getTarget();for(this.addSemiVisibleVertex(r);this.noSpills&&r.isSpill();){let e=r.getOutEdges();if(e.length)this.addSemiVisibleEdge(e[0]),r=e[0].getTarget(),this.addSemiVisibleVertex(r);else break}}}writeXgmml(){this.subgraphVisited(this.graph.subgraphs[0],!0),this.graph.edges.forEach((e,t)=>{this.edgeVisited(e)})}subgraphVisited(e,t=!1){if(this.m_visibleSubgraphs[e.__hpcc_id]){let n=``;this.m_xgmml+=t?``:`<node id="`+e.__hpcc_id+`"><att><graph>`;let r=this.m_xgmml.length;if(e.walkSubgraphs(this),e.walkVertices(this),r===this.m_xgmml.length){let t=e.__hpcc_vertices[0];t&&(this.m_xgmml+=this.buildVertexString(t,!0))}let i=e.getProperties();for(let e in i)n+=`<att name="`+e+`" value="`+xmlEncode(i[e])+`"/>`;this.m_xgmml+=t?``:`</graph></att>`+n+`</node>`}return!1}vertexVisited(e){this.m_visibleVertices[e.__hpcc_id]?this.m_xgmml+=this.buildVertexString(e,!1):this.m_semiVisibleVertices[e.__hpcc_id]&&(this.m_xgmml+=this.buildVertexString(e,!0))}edgeVisited(e){this.m_visibleEdges[e.__hpcc_id]&&(this.m_xgmml+=this.buildEdgeString(e))}},GraphItem=class{__hpcc_graph;__hpcc_parent;__widget;__hpcc_id;_globalID;constructor(e,t){this.__hpcc_graph=e,this.__hpcc_id=t,this._globalID=t}getProperties(){let e={};for(let t in this)t.indexOf(`__`)!==0&&this.hasOwnProperty(t)&&(e[t]=this[t]);return e}},Subgraph=class extends GraphItem{_globalType;__hpcc_subgraphs;__hpcc_vertices;__hpcc_edges;id;constructor(e,t){super(e,t),this._globalType=t===`0`?`Graph`:`Cluster`,this.__hpcc_subgraphs=[],this.__hpcc_vertices=[],this.__hpcc_edges=[],this.id=t}addSubgraph(e){e.__hpcc_parent=this,this.__hpcc_subgraphs.some(t=>e===t)||this.__hpcc_subgraphs.push(e)}addVertex(e){e.__hpcc_parent=this,this.__hpcc_vertices.some(t=>e===t)||this.__hpcc_vertices.push(e)}removeVertex(e){this.__hpcc_vertices=this.__hpcc_vertices.filter(t=>e!==t)}addEdge(e){e.__hpcc_parent=this,this.__hpcc_edges.some(t=>e===t)||this.__hpcc_edges.push(e)}removeEdge(e){this.__hpcc_edges=this.__hpcc_edges.filter(t=>e!==t)}remove(){this.__hpcc_subgraphs.forEach(e=>e.__hpcc_parent=this.__hpcc_parent),this.__hpcc_vertices.forEach(e=>e.__hpcc_parent=this.__hpcc_parent),this.__hpcc_edges.forEach(e=>e.__hpcc_parent=this.__hpcc_parent),delete this.__hpcc_parent,this.__hpcc_graph.removeItem(this)}walkSubgraphs(e){this.__hpcc_subgraphs.forEach((t,n)=>{e.subgraphVisited(t)&&t.walkSubgraphs(e)})}walkVertices(e){this.__hpcc_vertices.forEach((t,n)=>{e.vertexVisited(t)})}},Vertex=class extends GraphItem{_globalType=`Vertex`;_isSpill;constructor(e,t){super(e,t)}isSpill(){return this._isSpill}remove(){let e=this.getInVertices();e.length<=1&&console.warn(this.__hpcc_id+`: remove only supports single or zero inputs activities...`),this.getInEdges().forEach(e=>{e.remove()}),this.getOutEdges().forEach(t=>{t.setSource(e[0])}),this.__hpcc_parent?.removeVertex(this),this.__hpcc_graph.removeItem(this)}getInVertices(){return this.getInEdges().map(e=>e.getSource())}getInEdges(){return this.__hpcc_graph.edges.filter(e=>e.getTarget()===this)}getOutVertices(){return this.getOutEdges().map(e=>e.getTarget())}getOutEdges(){return this.__hpcc_graph.edges.filter(e=>e.getSource()===this)}},Edge=class extends GraphItem{_globalType=`Edge`;_sourceActivity;source;_targetActivity;target;constructor(e,t){super(e,t),this._globalType=`Edge`}remove(){this.__hpcc_graph.subgraphs.forEach(e=>{e.removeEdge(this)}),this.__hpcc_graph.removeItem(this)}getSource(){return this.__hpcc_graph.idx[this._sourceActivity||this.source]}setSource(e){this._sourceActivity?this._sourceActivity=e.__hpcc_id:this.source&&=e.__hpcc_id,this.__widget&&this.__widget.setSource(this.getSource().__widget)}getTarget(){return this.__hpcc_graph.idx[this._targetActivity||this.target]}},_t=class QueryGraph{idx={};subgraphs=[];vertices=[];edges=[];xgmml=``;constructor(){this.clear()}clear(){this.xgmml=``,this.idx={},this.subgraphs=[],this.vertices=[],this.edges=[]}load(e){this.clear(),this.merge(e)}merge(e){this.xgmml=e;let t=new DOMParser().parseFromString(e,`text/xml`);this.walkDocument(t.documentElement,`0`)}isSubgraph(e){return e instanceof Subgraph}isVertex(e){return e instanceof Vertex}isEdge(e){return e instanceof Edge}getGlobalType(e){return e instanceof Vertex?K.VERTEX:e instanceof Edge?K.EDGE:e instanceof Subgraph?K.SUBGRAPH:e instanceof QueryGraph?K.GRAPH:K.UNKNOWN}getGlobalTypeString(e){return e instanceof Vertex?q.VERTEX:e instanceof Edge?q.EDGE:e instanceof Subgraph?q.SUBGRAPH:e instanceof QueryGraph?q.GRAPH:q.UNKNOWN}getItem(e,t){if(!this.idx[t])switch(e.tagName){case`graph`:let e=new Subgraph(this,t);this.subgraphs.push(e),this.idx[t]=e;break;case`node`:let n=new Vertex(this,t);this.vertices.push(n),this.idx[t]=n;break;case`edge`:let r=new Edge(this,t);this.edges.push(r),this.idx[t]=r;break;default:console.warn(`Graph.getItem - Unknown Node Type!`)}let n=this.idx[t];return Array.from(e.attributes).forEach(e=>{safeAssign(n,e.name,e.value)}),n}removeItem(e){delete this.idx[e.__hpcc_id],e instanceof Subgraph?this.subgraphs=this.subgraphs.filter(t=>e!==t):e instanceof Vertex?this.vertices=this.vertices.filter(t=>e!==t):e instanceof Edge&&(this.edges=this.edges.filter(t=>e!==t))}getChildByTagName(e,t){let n=null;return Array.from(e.childNodes).some(e=>{if(e.tagName===t)return n=e,!0}),n}walkDocument(e,t){let n=this.getItem(e,t);return e.childNodes.forEach(e=>{if(e.nodeType===1)switch(e.tagName){case`graph`:break;case`node`:let t=!1,r=this.getChildByTagName(e,`att`);if(r){let i=this.getChildByTagName(r,`graph`);if(i){t=!0;let r=this.walkDocument(i,e.getAttribute(`id`));n.addSubgraph(r)}}if(!t){let t=this.walkDocument(e,e.getAttribute(`id`));n.addVertex(t)}break;case`att`:let i=e.getAttribute(`name`),a=`_`+i,o=e.getAttribute(`value`);i.indexOf(`Time`)===0?(safeAssign(n,a,o),safeAssign(n,i,``+espTime2Seconds(o))):i.indexOf(`Size`)===0?(safeAssign(n,a,o),safeAssign(n,i,``+espSize2Bytes(o))):i.indexOf(`Skew`)===0?(safeAssign(n,a,o),safeAssign(n,i,``+espSkew2Number(o))):safeAssign(n,i,o);break;case`edge`:let s=this.walkDocument(e,e.getAttribute(`id`));if(s.NumRowsProcessed===void 0?s.Count===void 0?s.count!==void 0&&(s._eclwatchCount=s.count.replace(/\B(?=(\d{3})+(?!\d))/g,`,`)):s._eclwatchCount=s.Count.replace(/\B(?=(\d{3})+(?!\d))/g,`,`):s._eclwatchCount=s.NumRowsProcessed.replace(/\B(?=(\d{3})+(?!\d))/g,`,`),s.inputProgress&&(s._eclwatchInputProgress=`[`+s.inputProgress.replace(/\B(?=(\d{3})+(?!\d))/g,`,`)+`]`),s.SkewMaxRowsProcessed&&s.SkewMinRowsProcessed&&(s._eclwatchSkew=`+`+s.SkewMaxRowsProcessed+`, `+s.SkewMinRowsProcessed),!s._dependsOn&&!s._childGraph&&(s._sourceActivity||s._targetActivity)){s._isSpill=!0;let e=s.getSource();e&&(e._isSpill=!0);let t=s.getTarget();t&&(t._isSpill=!0)}n.addEdge(s)}}),n}removeSubgraphs(){[...this.subgraphs].forEach(e=>{e.__hpcc_parent instanceof Subgraph&&e.remove()})}removeSpillVertices(){[...this.vertices].forEach(e=>{e.isSpill()&&e.remove()})}getLocalisedXGMML(e,t,n,r){let i=new LocalisedXGMMLWriter(this);return i.calcVisibility(e,t,n,r),i.writeXgmml(),`<graph>`+i.m_xgmml+`</graph>`}},J=(0,o.scopedLogger)(`@hpcc-js/comms/ecl/query.ts`),vt=qe(`~s`);function isNumber(e){return!isNaN(parseFloat(e))&&!isNaN(e-0)}var QueryCache=class extends o.Cache{constructor(){super(e=>o.Cache.hash([e.QueryId,e.QuerySet]))}},yt=new QueryCache,bt=class Query extends o.StateObject{wsWorkunitsService;get BaseUrl(){return this.wsWorkunitsService.baseUrl}topology;_requestSchema;_responseSchema;get properties(){return this.get()}get Exceptions(){return this.get(`Exceptions`)}get QueryId(){return this.get(`QueryId`)}get QuerySet(){return this.get(`QuerySet`)}get QueryName(){return this.get(`QueryName`)}get Wuid(){return this.get(`Wuid`)}get Dll(){return this.get(`Dll`)}get Suspended(){return this.get(`Suspended`)}get Activated(){return this.get(`Activated`)}get SuspendedBy(){return this.get(`SuspendedBy`)}get Clusters(){return this.get(`Clusters`)}get PublishedBy(){return this.get(`PublishedBy`)}get Comment(){return this.get(`Comment`)}get LogicalFiles(){return this.get(`LogicalFiles`)}get SuperFiles(){return this.get(`SuperFiles`)}get IsLibrary(){return this.get(`IsLibrary`)}get Priority(){return this.get(`Priority`)}get WUSnapShot(){return this.get(`WUSnapShot`)}get CompileTime(){return this.get(`CompileTime`)}get LibrariesUsed(){return this.get(`LibrariesUsed`)}get CountGraphs(){return this.get(`CountGraphs`)}get ResourceURLCount(){return this.get(`ResourceURLCount`)}get WsEclAddresses(){return this.get(`WsEclAddresses`)}get WUGraphs(){return this.get(`WUGraphs`)}get WUTimers(){return this.get(`WUTimers`)}get PriorityID(){return this.get(`PriorityID`)}constructor(e,t,n,r){super(),this.wsWorkunitsService=e instanceof WorkunitsService?e:new WorkunitsService(e),this.topology=gt.attach(this.wsWorkunitsService.opts()),this.set({QuerySet:t,QueryId:n,...r})}static attach(e,t,n,r){let i=yt.get({BaseUrl:e.baseUrl,QuerySet:t,QueryId:n},()=>new Query(e,t,n));return r&&i.set(r),i}_eclService;async wsEclService(){return this._eclService||=this.topology.fetchServices({}).then(e=>{for(let t of e?.TpEspServers?.TpEspServer??[])for(let e of t?.TpBindings?.TpBinding??[])if(e?.Service===`ws_ecl`)return new EclService({baseUrl:`${e.Protocol}://${globalThis.location.hostname}:${e.Port}`})}),this._eclService}async fetchDetails(){let e=await this.wsWorkunitsService.WUQueryDetails({QuerySet:this.QuerySet,QueryId:this.QueryId,IncludeStateOnClusters:!0,IncludeSuperFiles:!0,IncludeWsEclAddresses:!0,CheckAllNodes:!1});this.set({...e})}async fetchRequestSchema(){let e=await this.wsEclService();try{this._requestSchema=await e?.requestJson(this.QuerySet,this.QueryId)??[]}catch(e){J.debug(e.message??e),this._requestSchema=[]}}async fetchResponseSchema(){let e=await this.wsEclService();try{this._responseSchema=await e?.responseJson(this.QuerySet,this.QueryId)??{}}catch(e){J.debug(e.message??e),this._responseSchema={}}}async fetchSchema(){await Promise.all([this.fetchRequestSchema(),this.fetchResponseSchema()])}fetchSummaryStats(){return this.wsWorkunitsService.WUQueryGetSummaryStats({Target:this.QuerySet,QueryId:this.QueryId})}fetchGraph(e=``,t=``){return this.wsWorkunitsService.WUQueryGetGraph({Target:this.QuerySet,QueryId:this.QueryId,GraphName:e,SubGraphId:t}).then(e=>{let t=new _t,n=!0;for(let r of e?.Graphs?.ECLGraphEx||[])n?(t.load(r.Graph),n=!1):t.merge(r.Graph);return t})}fetchDetailsNormalized(e={}){let t=it.attach(this.wsWorkunitsService,this.Wuid);return t?Promise.all([this.fetchGraph(),t.fetchDetailsMeta(),t.fetchDetailsRaw(e)]).then(e=>{let n=e[0],r=e[1],i=e[2].map(e=>{let t=e.Id[0];if(t===`a`||t===`e`){let t=n.idx[e.Id.substring(1)];if(!t)return J.debug(`Missing graph data for metric ID: ${e.Id}`),e;let r=new Set(e.Properties.Property.map(e=>e.Name)),i=[];for(let e in t){let n=e.charAt(0);if(n!==`_`&&n===n.toUpperCase()&&!r.has(e)){let n=t[e],r=typeof n;if(r===`string`||r===`number`||r===`boolean`){let t=isNumber(n)?parseFloat(n):n,r=n;e.indexOf(`Time`)>=0&&(t/=1e9,r=vt(t)+`s`),i.push({Name:e,RawValue:t,Formatted:r})}}}i.length>0&&e.Properties.Property.push(...i)}return e});return t.normalizeDetails(r,i)}):Promise.resolve({meta:void 0,columns:void 0,data:void 0})}async submit(e){let t=await this.wsEclService();try{return t?.submit(this.QuerySet,this.QueryId,e).then(e=>{for(let t in e)e[t]=e[t].Row;return e})??[]}catch(e){return J.debug(e.message??e),[]}}async refresh(){return await Promise.all([this.fetchDetails(),this.fetchSchema()]),this}requestFields(){return this._requestSchema?this._requestSchema:[]}responseFields(){return this._responseSchema?this._responseSchema:{}}resultNames(){let e=[];for(let t in this.responseFields())e.push(t);return e}resultFields(e){return this._responseSchema[e]?this._responseSchema[e]:[]}},SQLCleanupError=class extends Error{cause;cleanupErrors;constructor(e,t,n){super(e),this.cause=t,this.cleanupErrors=n}};function checkExceptions(e){if(e.Exceptions)throw Error(e.Exceptions.Exception?.map(e=>e.Message??e.Code).join(`; `)||`WsSQL2 request failed`)}function rowsFrom(e){if(typeof e.Rows!=`string`)throw Error(`WsSQL2 response is missing Rows`);let t;try{t=JSON.parse(e.Rows)}catch(e){let t=e instanceof Error?e.message:String(e);throw Object.assign(Error(`Error parsing WsSQL2 Rows JSON '${t}'`),{cause:e})}if(!Array.isArray(t)||!t.every(e=>Array.isArray(e)))throw Error(`WsSQL2 Rows must be an array of arrays`);return t}var SQLConnection=class{service;statements=new Set;closed=!1;closing;constructor(e){this.service=e instanceof SQL2Service?e:new SQL2Service(e)}createStatement(){this.checkOpen();let e=new SQLStatement(this.service,()=>this.statements.delete(e));return this.statements.add(e),e}async queryRows(e,t){let n=this.createStatement(),r=[];try{t!==void 0&&n.setFetchSize(t);let i=await n.executeQuery(e);for(;await i.next();)r.push(i.getRow())}catch(e){try{await n.close()}catch(t){throw new SQLCleanupError(`Failed to query rows and close statement`,e,[t])}throw e}return await n.close(),r}async explainQuery(e){if(this.checkOpen(),!e.trim())throw Error(`SQL text is required`);let t=await this.service.ExplainQuery({SqlText:e});return checkExceptions(t),t}async logicalFileMeta(e){if(this.checkOpen(),!e.trim())throw Error(`Logical file name is required`);let t=await this.service.LogicalFileMeta({LogicalName:e});return checkExceptions(t),t.LogicalFileMeta}async ping(){return this.checkOpen(),await this.service.Ping({}),!0}async splitQuery(e){if(this.checkOpen(),!e.trim())return[];let t=await this.service.SplitQuery({SqlText:e});checkExceptions(t);let n=t.Statements?.Statement??[];if(!Array.isArray(n)||!n.every(e=>typeof e==`string`))throw Error(`WsSQL2 response has invalid Statements`);return n}close(){return this.closing||(this.closed=!0,this.closing=(async()=>{let e=(await Promise.allSettled([...this.statements].map(e=>e.close()))).filter(e=>e.status===`rejected`).map(e=>e.reason);if(e.length)throw new SQLCleanupError(`Failed to close SQL statements`,e[0],e)})(),this.closing.then(()=>{this.closing=void 0},()=>{this.closing=void 0})),this.closing}[Symbol.asyncDispose](){return this.close()}checkOpen(){if(this.closed)throw Error(`SQL connection is closed`)}},SQLStatement=class{service;onClose;result;closed=!1;fetchSize=0;executing;closing;constructor(e,t){this.service=e,this.onClose=t}setFetchSize(e){if(this.checkOpen(),!Number.isSafeInteger(e)||e<0)throw RangeError(`Fetch size must be a non-negative integer`);this.fetchSize=e}cancel(){return this.checkOpen(),this.executing?this.executing.then(e=>e.cancel()):this.result?.cancel()??Promise.resolve()}executeQuery(e){if(this.checkOpen(),this.executing)throw Error(`SQL statement is already executing`);if(!e.trim())throw Error(`SQL text is required`);return this.execute(e)}async execute(e){let t=this.runQuery(e);this.executing=t;try{return await t}finally{this.executing=void 0}}async runQuery(e){if(await this.result?.close(),this.result=void 0,this.closed)throw Error(`SQL statement is closed`);let t=await this.service.ExecuteQuery({SqlText:e,IncludeResultSetMetadata:!0}),n=t.ResultSetMetadata?.Column,r=t.CursorId?new SQLResultSet(this.service,n??[],t.CursorId,this.fetchSize):void 0;this.result=r;try{if(checkExceptions(t),!t.CursorId)throw Error(`WsSQL2 response is missing CursorId`);if(!n)throw Error(`WsSQL2 response is missing result-set metadata`);if(this.closed)throw Error(`SQL statement is closed`);return r}catch(e){if(r)try{await r.close()}catch(t){throw new SQLCleanupError(`Failed to parse result and close cursor`,e,[t])}throw e}}close(){return this.closing||(this.closed=!0,this.closing=(async()=>{if(this.executing)try{await this.executing}catch{}await this.result?.close(),this.onClose()})(),this.closing.then(()=>{this.closing=void 0},()=>{this.closing=void 0})),this.closing}[Symbol.asyncDispose](){return this.close()}checkOpen(){if(this.closed)throw Error(`SQL statement is closed`)}},SQLResultSet=class{service;columns;cursor;fetchSize;index=-1;row;wasNullValue=!1;closed=!1;advancing;closing;constructor(e,t,n,r){this.service=e,this.columns=t,this.cursor=n,this.fetchSize=r}rows=[];complete=!1;getMetaData(){return this.checkOpen(),this.columns}findColumn(e){this.checkOpen();let t=this.columns.findIndex(t=>t.ColumnLabel?.toLowerCase()===e.toLowerCase());if(t<0)throw Error(`Unknown SQL column: ${e}`);return t+1}next(){if(this.checkOpen(),this.advancing)throw Error(`SQL result set is already fetching`);return this.advance()}async advance(){let e=this.advancePage();this.advancing=e;try{return await e}finally{this.advancing=void 0}}async advancePage(){this.row=void 0;try{for(;++this.index>=this.rows.length;){if(this.checkOpen(),this.complete)return!1;let e=await this.service.FetchResultSet({CursorId:this.cursor,FetchSize:this.fetchSize});if(checkExceptions(e),typeof e.Complete!=`boolean`)throw Error(`WsSQL2 fetch response is missing Complete`);let t=rowsFrom(e);this.checkOpen(),this.complete=e.Complete,this.complete&&(this.cursor=void 0),this.rows=t,this.index=-1}this.checkOpen();let e=this.rows[this.index];if(e.length!==this.columns.length)throw Error(`WsSQL2 row width does not match result metadata`);return this.row=e,!0}catch(e){this.closed=!0;try{await this.close()}catch(t){throw new SQLCleanupError(`Failed to read result and close cursor`,e,[t])}throw e}}getObject(e){if(this.checkOpen(),!this.row)throw Error(`SQL result set is not positioned on a row`);let t=typeof e==`string`?this.findColumn(e):e;if(!Number.isInteger(t)||t<1||t>this.columns.length)throw RangeError(`SQL column index out of range: ${t}`);let n=this.row[t-1];return this.wasNullValue=n===null,n}getString(e){let t=this.getObject(e);return t===null?null:String(t)}getRow(){this.checkOpen();let e=this.row;if(!e)throw Error(`SQL result set is not positioned on a row`);let t=Object.create(null),n=new Set;return this.columns.forEach((r,i)=>{let a=r.ColumnLabel;if(!a)throw Error(`WsSQL2 column is missing a label`);if(n.has(a.toLowerCase()))throw Error(`Duplicate SQL column label: ${a}`);n.add(a.toLowerCase()),t[a]=e[i]}),t}wasNull(){return this.checkOpen(),this.wasNullValue}close(){return this.closing||(this.closed=!0,this.closing=(async()=>{await this.closeCursor()})(),this.closing.then(()=>{this.closing=void 0},()=>{this.closing=void 0})),this.closing}[Symbol.asyncDispose](){return this.close()}cancel(){return this.close()}async closeCursor(){if(this.cursor){let e=this.cursor;checkExceptions(await this.service.CloseResultSet({CursorId:e})),this.cursor=void 0}}checkOpen(){if(this.closed)throw Error(`SQL result set is closed`)}},StoreCache=class extends o.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.Name}:${e.UserSpecific}-${e.Namespace}`)}},xt=new StoreCache,ValueChangedMessage=class extends o.Message{key;value;oldValue;constructor(e,t,n){super(),this.key=e,this.value=t,this.oldValue=n}get canConflate(){return!0}conflate(e){return this.key===e.key&&(this.value=e.value,!0)}void(){return this.value===this.oldValue}},St=class Store{connection;get BaseUrl(){return this.connection.baseUrl}Name;UserSpecific;Namespace;_dispatch=new o.Dispatch;static attach(e,t=`HPCCApps`,n,r=!0){return xt.get({BaseUrl:e.baseUrl,Name:t,UserSpecific:r,Namespace:n},()=>new Store(e,t,n,r))}constructor(e,t,n,r){this.connection=e instanceof StoreService?e:new StoreService(e),this.Name=t,this.UserSpecific=r,this.Namespace=n}_knownValues={};create(){this.connection.CreateStore({Name:this.Name,Type:``,Description:``})}set(e,t,n=!0){return this.connection.Set({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e,Value:t}).then(r=>{let i=this._knownValues[e];this._knownValues[e]=t,n&&this._dispatch.post(new ValueChangedMessage(e,t,i))}).catch(n=>{console.error(`Store.set("${e}", "${t}") failed:`,n)})}get(e,t=!0){return this.connection.Fetch({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e}).then(n=>{let r=this._knownValues[e];return this._knownValues[e]=n.Value,t&&this._dispatch.post(new ValueChangedMessage(e,n.Value,r)),n.Value}).catch(t=>{console.error(`Store.get(${e}) failed:`,t)})}getAll(e=!0){return this.connection.FetchAll({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace}).then(t=>{let n={},r=this._knownValues;if(this._knownValues={},t.Pairs.Pair.forEach(t=>{let i=this._knownValues[t.Key];this._knownValues[t.Key]=t.Value,delete r[t.Key],n[t.Key]=t.Value,e&&this._dispatch.post(new ValueChangedMessage(t.Key,t.Value,i))}),e)for(let e in r)this._dispatch.post(new ValueChangedMessage(e,void 0,r[e]));return n}).catch(e=>(console.error(`Store.getAll failed:`,e),{}))}delete(e,t=!0){return this.connection.Delete({StoreName:this.Name,UserSpecific:this.UserSpecific,Namespace:this.Namespace,Key:e}).then(n=>{let r=this._knownValues[e];delete this._knownValues[e],t&&this._dispatch.post(new ValueChangedMessage(e,void 0,r))}).catch(t=>{console.error(`Store.delete(${e}) failed:`,t)})}monitor(e){return this._dispatch.attach(e)}},Ct=(0,o.scopedLogger)(`@hpcc-js/comms/dfuWorkunit.ts`),Y=function(e){return e[e.Unknown=0]=`Unknown`,e[e.Scheduled=1]=`Scheduled`,e[e.Queued=2]=`Queued`,e[e.Started=3]=`Started`,e[e.Aborted=4]=`Aborted`,e[e.Failed=5]=`Failed`,e[e.Finished=6]=`Finished`,e[e.Monitoring=7]=`Monitoring`,e[e.Aborting=8]=`Aborting`,e[e.NotFound=999]=`NotFound`,e}(Y||{}),DFUWorkunitCache=class extends o.Cache{constructor(){super(e=>`${e.BaseUrl}-${e.ID}`)}},wt=new DFUWorkunitCache,Tt=class DFUWorkunit extends o.StateObject{connection;topologyConnection;get BaseUrl(){return this.connection.baseUrl}get properties(){return this.get()}get ID(){return this.get(`ID`)}get DFUServerName(){return this.get(`DFUServerName`)}get ClusterName(){return this.get(`ClusterName`)}get JobName(){return this.get(`JobName`)}get Queue(){return this.get(`Queue`)}get User(){return this.get(`User`)}get isProtected(){return this.get(`isProtected`)}get Command(){return this.get(`Command`)}get CommandMessage(){return this.get(`CommandMessage`)}get PercentDone(){return this.get(`PercentDone`)}get SecsLeft(){return this.get(`SecsLeft`)}get ProgressMessage(){return this.get(`ProgressMessage`)}get SummaryMessage(){return this.get(`SummaryMessage`)}get State(){return this.get(`State`,Y.Unknown)}get SourceLogicalName(){return this.get(`SourceLogicalName`)}get SourceIP(){return this.get(`SourceIP`)}get SourceFilePath(){return this.get(`SourceFilePath`)}get SourceDali(){return this.get(`SourceDali`)}get SourceRecordSize(){return this.get(`SourceRecordSize`)}get SourceFormat(){return this.get(`SourceFormat`)}get RowTag(){return this.get(`RowTag`)}get SourceNumParts(){return this.get(`SourceNumParts`)}get SourceDirectory(){return this.get(`SourceDirectory`)}get DestLogicalName(){return this.get(`DestLogicalName`)}get DestGroupName(){return this.get(`DestGroupName`)}get DestDirectory(){return this.get(`DestDirectory`)}get DestIP(){return this.get(`DestIP`)}get DestFilePath(){return this.get(`DestFilePath`)}get DestFormat(){return this.get(`DestFormat`)}get DestNumParts(){return this.get(`DestNumParts`)}get DestRecordSize(){return this.get(`DestRecordSize`)}get Replicate(){return this.get(`Replicate`)}get Overwrite(){return this.get(`Overwrite`)}get Compress(){return this.get(`Compress`)}get SourceCsvSeparate(){return this.get(`SourceCsvSeparate`)}get SourceCsvQuote(){return this.get(`SourceCsvQuote`)}get SourceCsvTerminate(){return this.get(`SourceCsvTerminate`)}get SourceCsvEscape(){return this.get(`SourceCsvEscape`)}get TimeStarted(){return this.get(`TimeStarted`)}get TimeStopped(){return this.get(`TimeStopped`)}get StateMessage(){return this.get(`StateMessage`)}get StateReason(){return this.get(`StateReason`)}get MonitorEventName(){return this.get(`MonitorEventName`)}get MonitorSub(){return this.get(`MonitorSub`)}get MonitorShotLimit(){return this.get(`MonitorShotLimit`)}get SourceDiffKeyName(){return this.get(`SourceDiffKeyName`)}get DestDiffKeyName(){return this.get(`DestDiffKeyName`)}get Archived(){return this.get(`Archived`)}get encrypt(){return this.get(`encrypt`)}get decrypt(){return this.get(`decrypt`)}get failIfNoSourceFile(){return this.get(`failIfNoSourceFile`)}get recordStructurePresent(){return this.get(`recordStructurePresent`)}get quotedTerminator(){return this.get(`quotedTerminator`)}get preserveCompression(){return this.get(`preserveCompression`)}get expireDays(){return this.get(`expireDays`)}get PreserveFileParts(){return this.get(`PreserveFileParts`)}get FileAccessCost(){return this.get(`FileAccessCost`)}get KbPerSecAve(){return this.get(`KbPerSecAve`)}get KbPerSec(){return this.get(`KbPerSec`)}get SubTaskCount(){return this.get(`SubTaskCount`)}get SubTasksFinished(){return this.get(`SubTasksFinished`)}get SubTasksFailed(){return this.get(`SubTasksFailed`)}static create(e,t){let n=new DFUWorkunit(e);return n.connection.CreateDFUWorkunit({DFUServerQueue:t}).then(e=>(wt.set(n),n.set(e.result),n))}static attach(e,t,n){let r=wt.get({BaseUrl:e.baseUrl,ID:t},()=>new DFUWorkunit(e,t));return n&&r.set(n),r}static sprayFixed(e,t){let n=new FileSprayService(e);return n.SprayFixedEx({...t}).then(t=>{let r=t.wuid;return n.GetDFUWorkunit({wuid:r}).then(t=>DFUWorkunit.attach(e,r,t.result))})}static sprayVariable(e,t){let n=new FileSprayService(e);return n.SprayVariableEx({...t}).then(t=>{let r=t.wuid;return n.GetDFUWorkunit({wuid:r}).then(t=>DFUWorkunit.attach(e,r,t.result))})}static despray(e,t){let n=new FileSprayService(e);return n.DesprayEx({...t}).then(t=>{let r=t.wuid;return n.GetDFUWorkunit({wuid:r}).then(t=>DFUWorkunit.attach(e,r,t.result))})}update(e){return this.connection.UpdateDFUWorkunitEx({wu:{JobName:e?.wu?.JobName??this.JobName,isProtected:e?.wu?.isProtected??this.isProtected,ID:this.ID,State:this.State},ClusterOrig:this.ClusterName,JobNameOrig:this.JobName,isProtectedOrig:this.isProtected,StateOrig:this.State})}isComplete(){switch(this.State){case Y.Finished:case Y.Failed:case Y.Aborted:case Y.NotFound:return!0}return!1}isFailed(){return!!(this.isComplete()&&this.State!==Y.Finished)}isDeleted(){switch(this.State){case Y.NotFound:return!0}return!1}isRunning(){return!this.isComplete()}abort(){return this.connection.AbortDFUWorkunit({wuid:this.ID})}delete(){return this.DFUWUAction(T.DFUWUActions.Delete).then(e=>this.refresh().then(()=>(this._monitor(),e)))}async refresh(e=!1){return await this.GetDFUWorkunit(),this}fetchXML(e){return this.DFUWUFile()}_monitor(){this.isComplete()?this._monitorTickCount=0:super._monitor()}_monitorTimeoutDuration(){let e=super._monitorTimeoutDuration();return this._monitorTickCount<=1?3e3:this._monitorTickCount<=5?6e3:this._monitorTickCount<=7?12e3:e}DFUWUFile(e={}){return this.connection.DFUWUFileEx({...e,Wuid:this.ID}).then(e=>e).catch(e=>``)}DFUWUAction(e){return this.connection.DFUWorkunitsAction({wuids:{Item:[this.ID]},Type:e}).then(t=>e===T.DFUWUActions.Delete?t:this.refresh().then(()=>(this._monitor(),t)))}on(e,t,n){if(this.isCallback(t))switch(e){case`finished`:super.on(`propChanged`,`State`,e=>{this.isComplete()&&t([e])});break;case`changed`:super.on(e,t)}else switch(e){case`changed`:super.on(e,t,n)}return this._monitor(),this}watchUntilComplete(e){return new Promise((t,n)=>{let r=this.watch(n=>{e&&e(n),this.isComplete()&&(r.release(),t(this))})})}watchUntilRunning(e){return new Promise((t,n)=>{let r=this.watch(n=>{e&&e(n),(this.isComplete()||this.isRunning())&&(r.release(),t(this))})})}constructor(e,t){super(),this.connection=new FileSprayService(e),this.topologyConnection=new TopologyService(e),this.clearState(t)}clearState(e){this.clear({ID:e,State:Y.Unknown})}GetDFUWorkunit(e={}){return this.connection.GetDFUWorkunit({...e,wuid:this.ID}).then(e=>(this.set(e.result),e)).catch(e=>{if(!e.Exception.some(e=>e.Code===20080||e.Code===20081?(this.clearState(this.ID),this.set(`State`,Y.NotFound),!0):!1))throw Ct.warning(`Unexpected ESP exception: ${e.message}`),e;return{}})}};(0,o.scopedLogger)(`clienttools/eclmeta`);var Attr=class{__attrs;name;constructor(e){this.__attrs=e.$,this.name=e.$.name}},Field=class{__attrs;definition;get scope(){return this.definition}name;type;constructor(e,t){this.__attrs=t.$,this.definition=e,this.name=t.$.name,this.type=t.$.type}},ECLScope=class{get scope(){return this}name;type;sourcePath;line;start;body;end;definitions;constructor(e,t,n,r,i=1,a=0,o=0,s=Number.MAX_VALUE){this.name=e,this.type=t,this.sourcePath=h.normalize(n),this.line=i-1,this.start=+a,this.body=+o,this.end=+s,this.definitions=this.parseDefinitions(r)}parseDefinitions(e=[]){return e.map(e=>new Definition(this.sourcePath,e))}contains(e){return e>=this.start&&e<=this.end}scopeStackAt(e){let t=[];return this.contains(e)&&(t.push(this),this.definitions.forEach(n=>{t=n.scopeStackAt(e).concat(t)})),t}_resolve(e=[],t){let n=t.split(`.`),r=n.shift(),i=(0,o.find)(e,e=>typeof e.name==`string`&&typeof r==`string`&&e.name.toLowerCase()===r.toLowerCase());return i&&i.definitions.length&&n.length?this._resolve(i.definitions,n.join(`.`)):i}resolve(e){return this._resolve(this.definitions,e)}suggestions(){return this.definitions.map(e=>({name:e.name,type:this.type}))}},Definition=class extends ECLScope{__attrs;exported;shared;fullname;inherittype;attrs;fields;constructor(e,t){super(t.$.name,t.$.type,e,t.children(`Definition`),t.$.line,t.$.start,t.$.body,t.$.end),this.__attrs=t.$,this.exported=!!t.$.exported,this.shared=!!t.$.shared,this.fullname=t.$.fullname,this.inherittype=t.$.inherittype,this.attrs=this.parseAttrs(t.children(`Attr`)),this.fields=this.parseFields(t.children(`Field`))}parseAttrs(e=[]){return e.map(e=>new Attr(e))}parseFields(e=[]){return e.map(e=>new Field(this,e))}suggestions(){return super.suggestions().concat(this.fields.map(e=>({name:e.name,type:e.type})))}},Import=class{__attrs;name;ref;start;end;line;constructor(e){this.__attrs=e.$,this.name=e.$.name,this.ref=e.$.ref,this.start=e.$.start,this.end=e.$.end,this.line=e.$.line}},Source=class extends ECLScope{imports;__attrs;constructor(e){super(e.$.name,`source`,e.$.sourcePath,e.children(`Definition`)),this.__attrs=e.$;let t=e.$.name.split(`.`);t.pop();let n=new o.XMLNode(``);n.appendAttribute(`name`,`$`),n.appendAttribute(`ref`,t.join(`.`)),this.imports=[new Import(n),...this.parseImports(e.children(`Import`))]}parseImports(e=[]){return e.map(e=>new Import(e))}resolve(e,t){let n;return!n&&t!==void 0&&this.scopeStackAt(t).some(t=>(n=t.resolve(e),!!n)),n||=super.resolve(e),n}},isHiddenDirectory=e=>h.basename(e).indexOf(`.`)===0,isDirectory=e=>p.lstatSync(e).isDirectory()&&!isHiddenDirectory(e),isEcl=e=>[`.ecl`,`.ecllib`].indexOf(h.extname(e).toLowerCase())>=0,modAttrs=e=>p.readdirSync(e).map(t=>h.join(e,t)).filter(e=>isDirectory(e)||isEcl(e)),File=class extends ECLScope{constructor(e,t){super(e,`file`,t,[])}suggestions(){return[]}},Folder=class extends ECLScope{constructor(e,t){super(e,`folder`,t,[])}suggestions(){return modAttrs(this.sourcePath).map(e=>({name:h.basename(e,`.ecl`),type:`folder`}))}},Workspace=class{_workspacePath;_eclccPath;_clientTools;_sourceByID=new o.DictionaryNoCase;_sourceByPath=new o.Dictionary;_test=new o.DictionaryNoCase;constructor(e,t){this._workspacePath=e,this._eclccPath=t}refresh(){this.primeWorkspace(),this.primeClientTools()}primeClientTools(){return locateClientTools(this._eclccPath,``,this._workspacePath).then(e=>(this._clientTools=e,e.paths())).then(e=>{for(let t of[`ECLCC_ECLLIBRARY_PATH`,`ECLCC_PLUGIN_PATH`])e[t]&&p.existsSync(e[t])&&this.walkChildFolders(e[t],e[t]);return this})}primeWorkspace(){p.existsSync(this._workspacePath)&&this.visitFolder(this._workspacePath,this._workspacePath)}walkChildFolders(e,t,n=!1){for(let r of modAttrs(e))isDirectory(r)?this.visitFolder(r,t,n):this.visitFile(r,t,n)}visitFile(e,t,n=!1){let r=h.parse(e),i=h.join(r.dir,r.name),a=h.relative(t,i).split(h.sep).join(`.`);(n||!this._test.has(a))&&this._test.set(a,new File(``,e))}visitFolder(e,t,n=!1){let r=h.relative(t,e).split(h.sep).join(`.`);(n||!this._test.has(r))&&(this._test.set(r,new Folder(r,e)),this.walkChildFolders(e,t,n))}buildStack(e,t,n){let r=t.split(`.`);n&&e[e.length-1]===r[0]&&r.shift();let i=[...e,...r];return{stack:i,qid:i.join(`.`)}}walkECLScope(e,t){let n=this.buildStack(e,t.name,!0);this._test.set(n.qid,t);for(let e of t.definitions)this.walkDefinition(n.stack,e)}walkField(e,t){let n=this.buildStack(e,t.name,!1);this._test.set(n.qid,t)}walkDefinition(e,t){let n=this.buildStack(e,t.name,!0);this.walkECLScope(e,t);for(let e of t.fields)this.walkField(n.stack,e)}walkSource(e){this.walkECLScope([],e)}parseSources(e=[]){for(let t of e)if(t.$.name){let e=new Source(t);if(this._sourceByID.set(e.name,e),this._sourceByPath.set(e.sourcePath,e),e.name){let t=e.name.split(`.`).length;if(t>1){let n=e.sourcePath;for(;t>1;)n=h.dirname(n),--t;this.visitFolder(n,h.dirname(n))}}this.walkSource(e)}}parseMetaXML(e){let t=new MetaParser;return t.parse(e),this.parseSources(t.sources),t.sources.map(e=>h.normalize(e.$.sourcePath))}resolveQualifiedID(e,t,n){let r;if(!r&&this._test.has(t)&&(r=this._test.get(t).scope),!r&&this._sourceByPath.has(e)){let n=this._sourceByPath.get(e),i=t.split(`.`);for(let e of n.imports)if(e.name.toLowerCase()===i[0].toLowerCase()){e.ref?i[0]=e.ref:i.shift();break}let a=i.join(`.`);!r&&this._test.has(a)&&(r=this._test.get(a).scope),r||(a=[...n.name.split(`.`),...i].join(`.`),this._test.has(a)&&(r=this._test.get(a).scope))}return r}resolvePartialID(e,t,n){t=t.toLowerCase();let r=t.split(`.`);r.pop();let i=r.length===1?r[0]:r.join(`.`);return this.resolveQualifiedID(e,i,n)}},Et=new o.Dictionary;function attachWorkspace(e,t){let n=h.normalize(e);if(!Et.has(n)){let e=new Workspace(n,t);Et.set(n,e),e.refresh()}return Et.get(n)}function isQualifiedIDChar(e,t,n){if(t<0)return!1;let r=e.charAt(t);return(n?/[a-zA-Z\d_\.$]/:/[a-zA-Z\d_]/).test(r)}function qualifiedIDBoundary(e,t,n){for(;isQualifiedIDChar(e,t,n);)t+=n?-1:1;return t+(n?1:-1)}var MetaParser=class extends o.SAXStackParser{sources=[];endXMLNode(e){e.name===`Source`&&this.sources.push(e),super.endXMLNode(e)}},X=(0,o.scopedLogger)(`clienttools/eclcc`),Dt=m.type()===`Windows_NT`?`.exe`:``;function tidyCRLF(e){return e.split(`\r
916
916
  `).join(`
917
- `).split("\r").join(`
918
- `)}var tt=class{prefix="";major=0;minor=0;patch=0;postfix="";constructor(e){let t=e.split(" ");if(t.length){let r=/(?:(\w+)_)?(\d+)\.(\d+)\.(\d+)(?:-(.*))?/.exec(t[t.length-1]);r&&(this.prefix=r[1]||"",this.major=+r[2]||0,this.minor=+r[3]||0,this.patch=+r[4]||0,this.postfix=r[5]||"")}}parse(e){}exists(){return this.major!==0||this.minor!==0||this.patch!==0||this.postfix!==""}compare(e){return this.major>e.major?1:this.major<e.major?-1:this.minor>e.minor?1:this.minor<e.minor?-1:this.patch>e.patch?1:this.patch<e.patch?-1:this.postfix===""&&e.postfix!==""?1:this.postfix.localeCompare(e.postfix)}toString(){return`${this.prefix}_${this.major}.${this.minor}.${this.patch}-${this.postfix}`}},hi="error",fi="warning",vt=class{_checked;errWarn=[];errOther=[];constructor(e){this._checked=e}checked(){return this._checked}all(){return this.errWarn}errors(){return this.errWarn.filter(e=>e.severity===hi)}hasError(){return this.errors().length>0}warnings(){return this.errWarn.filter(e=>e.severity===fi)}hasWarning(){return this.warnings().length>0}info(){return this.errWarn.filter(e=>[hi,fi].indexOf(e.severity)<0)}hasOther(){return this.info().length>0}unknown(){return this.errOther}hasUnknown(){return this.unknown().length>0}},Vt=class extends vt{constructor(e,t){if(super(t),e&&e.length)for(let r of e.split(ce.EOL)){let n=/([a-zA-Z]:\\(?:[- \w\.\d]+\\)*(?:[- \w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\) ?: ?(error|warning|info) C(\d*) ?: ?(.*)/.exec(r);if(n){let[,i,o,a,c,l,u]=n,g=+o,p=+a,f=l+": "+u;this.errWarn.push({filePath:i,line:g,col:p,msg:f,severity:c});continue}if(n=/(error|warning|info): (.*)/i.exec(r),n){let[,i,o]=n;this.errWarn.push({filePath:"",line:0,col:0,msg:o,severity:i});continue}n=/\d error(s?), \d warning(s?)/.exec(r),!n&&(et.warning(`parseECLErrors: Unable to parse "${r}"`),this.errOther.push(r))}this._checked=t}},Js=class extends vt{_lines;constructor(e,t,r){super(r);let n=H.readFileSync(e,"utf8");if(n=n.replace(/\r\n/g,`
919
- `),this._lines=n.split(`
920
- `),t&&t.length)for(let i of t.split(ce.EOL)){let o=/(Warning|Error) : Path\=(\S*?)(\[\S*\])? Message\=(.*)/.exec(i);if(o){let[,a,c,l,u]=o,g=`${c} ${l||""}: ${u}`,[p,f]=this.locate(c);this.errWarn.push({filePath:e,line:p,col:f,msg:g,severity:a});continue}o||(et.warning(`parseECLErrors: Unable to parse "${i}"`),this.errOther.push(i))}this._checked=r}locate(e){let t=e.split("/");if(t.length&&t[0]===""&&t.shift(),t.length>0){let r=0;for(let n of this._lines){let i="<"+t[0];if((n.indexOf(i+" ")>=0||n.indexOf(i+">")>=0)&&(t.shift(),t.length===0))return[r+1,n.indexOf(i)+1];++r}}return[0,0]}};function zs(s,e,t){t=t||[],t.push(s);for(let r in s)if(s.hasOwnProperty(r)){let n=s[r];e(r,n,t),n instanceof Array?n.forEach(i=>{zs(i,e,t)}):typeof n=="object"&&zs(n,e,t)}t.pop()}var Ks=class{jsonWU;constructor(e){this.jsonWU=e}bpGetValidLocations(e){let t=[];if((0,rt.exists)("W_LOCAL.Graphs",this.jsonWU)){let r="";zs(this.jsonWU.W_LOCAL.Graphs,(n,i,o)=>{if(n==="$"&&i.id&&(r=i.id),n==="$"&&i.name==="definition"){let a=/([a-z,A-Z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(i.value);if(a){let[,c,l,u]=a,g=+l,p=+u;e===c&&t.push({file:c,line:g,col:p,id:r})}}})}return t}},st=class s{eclccPath;envchkPath;eclBundlePath;binPath;cwd;includeFolders;_legacyMode;_args;_version;constructor(e,t,r=[],n=!1,i=[],o){this.eclccPath=e,this.binPath=j.dirname(this.eclccPath),this.envchkPath=j.join(this.binPath,"envchk"+Kr),this.eclBundlePath=j.join(this.binPath,"ecl-bundle"+Kr),this.cwd=j.normalize(t||this.binPath),this.includeFolders=r,this._legacyMode=n,this._args=i,this._version=o}clone(e,t,r=!1,n=[]){return new s(this.eclccPath,e,t,r,n,this._version)}exists(e){try{return H.accessSync(e),!0}catch{}return!1}args(e=[]){let t=[...this._args];return this._legacyMode&&t.push("-legacy"),t.concat(this.includeFolders.map(r=>"-I"+j.normalize(r))).concat(e)}version(){return this._version?Promise.resolve(this._version):this.execFile(this.eclccPath,this.binPath,this.args(["--version"]),"eclcc",`Cannot find ${this.eclccPath}`).then(e=>(this._version=new tt(e.stdout),this._version))}versionSync(){return this._version}_paths={};paths(){return this.execFile(this.eclccPath,this.cwd,this.args(["-showpaths"]),"eclcc",`Cannot find ${this.eclccPath}`).then(e=>{if(e&&e.stdout&&e.stdout.length){let t=e.stdout.split(/\r?\n/);for(let r of t){let n=r.split("=");n.length===2&&(this._paths[n[0]]=n[1])}}return this._paths})}loadXMLDoc(e,t){return new Promise((r,n)=>{let i=H.readFileSync(e,"ascii"),o=(0,rt.xml2json)(i);t&&H.unlink(e,a=>{}),r(o)})}createWU(e){let t=j.join(ce.tmpdir(),`eclcc-wu-tmp-${Ci.randomBytes(8).toString("hex")}`),r=["-o"+t,"-wu"].concat([e]);return this.execFile(this.eclccPath,this.cwd,this.args(r),"eclcc",`Cannot find ${this.eclccPath}`).then(n=>{let i=j.normalize(t+".xml");return(this.exists(i)?this.loadXMLDoc(i,!0):Promise.resolve({})).then(a=>new Ks(a))})}createArchive(e){let t=["-E"].concat([e]);return this.execFile(this.eclccPath,this.cwd,this.args(t),"eclcc",`Cannot find ${this.eclccPath}`).then(r=>({content:r.stdout,err:new Vt(r.stderr,[])}))}attachWorkspace(){return xe(this.cwd)}fetchMeta(e){return Promise.all([xe(this.cwd),this.execFile(this.eclccPath,this.cwd,this.args(["-M",e]),"eclcc",`Cannot find ${this.eclccPath}`)]).then(([t,r])=>{try{r&&r.stdout&&r.stdout.length&&t.parseMetaXML(r.stdout)}catch(n){et.error(`fetchMeta: Error parsing XML - ${n?.message??"unknown"}`)}return t})}syntaxCheck(e,t=["-syntax"]){return Promise.all([xe(this.cwd),this.execFile(this.eclccPath,this.cwd,this.args([...t,"-M",e]),"eclcc",`Cannot find ${this.eclccPath}`)]).then(([r,n])=>{let i=[];try{n&&n.stdout&&n.stdout.length&&(i=r.parseMetaXML(n.stdout))}catch(o){et.error(`syntaxCheck: Error parsing XML - ${o?.message??"unknown"}`)}return new Vt(n?n.stderr:"",i)})}envCheck(e,t=[]){return Promise.all([xe(this.cwd),this.execFile(this.envchkPath,this.cwd,this.args([...t,e]),"envchk",`Cannot find ${this.envchkPath}`)]).then(([r,n])=>new Js(e,n?n.stderr:"",[]))}bundleList(){let e=/\|(.*)\|(.*)\|(.*)\|/g;return Promise.all([fetch("https://raw.githubusercontent.com/hpcc-systems/ecl-bundles/master/README.rst").then(t=>t.text()).then(t=>{let r=[],n=e.exec(t);for(;n;)r.push({name:n[1].trim(),description:n[2].trim(),url:n[3].trim()}),n=e.exec(t);return r}),this.execFile(this.eclBundlePath,this.cwd,this.args(["list"]),"ecl-bundle",`Cannot find ${this.eclBundlePath}`).then(t=>mi(t.stdout).split(`
921
- `)).then(t=>{let r={};return Promise.all(t.filter(n=>!!n).map(n=>this.execFile(this.eclBundlePath,this.cwd,this.args(["info",n]),"ecl-bundle",`Cannot find ${this.eclBundlePath}`).then(i=>mi(i.stdout).split(`
922
- `)).then(i=>{let o={};i.forEach(a=>{let c=a.split(":");o[c.shift().trim()]=c.join(":").trim()}),r[n]={name:n,props:o}}))).then(()=>r)})]).then(([t,r])=>{t.forEach(n=>{r[n.name]&&(n.props=r[n.name].props,delete r[n.name])});for(let n in r)t.push({name:n,url:"",description:"",props:r[n].props});return t}).catch(t=>[])}bundleInstall(e){return Promise.all([xe(this.cwd),this.execFile(this.eclBundlePath,this.cwd,this.args(["install",e]),"ecl-bundle",`Cannot find ${this.eclBundlePath}`)]).then(([t,r])=>r)}bundleUninstall(e){return Promise.all([xe(this.cwd),this.execFile(this.eclBundlePath,this.cwd,this.args(["uninstall",e]),"ecl-bundle",`Cannot find ${this.eclBundlePath}`)]).then(([t,r])=>r)}execFile(e,t,r,n,i){return new Promise((o,a)=>{et.debug(`${e} ${r.join(" ")}`);let c=Ri.spawn(e,r,{cwd:t}),l="",u="";c.stdout.on("data",g=>{l+=g.toString()}),c.stderr.on("data",g=>{u+=g.toString()}),c.on("close",(g,p)=>{o({code:g,stdout:l.trim(),stderr:u.trim()})})})}};function qs(s,e){if(s){let t=j.join(s,"HPCCSystems");if(H.existsSync(t)&&H.statSync(t).isDirectory()){if(ce.type()!=="Windows_NT"){let r=j.join(t,"bin","eclcc");H.existsSync(r)&&e.push(new st(r))}H.readdirSync(t).forEach(r=>{let n=j.join(t,r,"clienttools","bin","eclcc"+Kr);if(H.existsSync(n)){let i=j.basename(r);new tt(i).exists()&&e.push(new st(n))}})}}}var kt;function hc(){kt=void 0}function xi(){if(kt)return kt;let s=[];switch(ce.type()){case"Windows_NT":let e=process.env["ProgramFiles(x86)"]||"";e&&qs(e,s);let t=process.env.ProgramFiles||"";t&&qs(t,s),!e&&!t&&qs("c:\\Program Files (x86)",s);break;case"Linux":case"Darwin":qs("/opt",s);break;default:break}return kt=Promise.all(s.map(e=>e.version())).then(()=>(s.sort((e,t)=>t.versionSync().compare(e.versionSync())),s)),kt}var Si="";function Di(s){let e=`Using eclccPath setting: ${s}`;Si!==e&&(et.info(e),Si=e)}function zr(s="",e="",t=".",r=[],n=!1,i=[]){return s&&H.existsSync(s)?(Di(s),Promise.resolve(new st(s,t,r,n,i))):xi().then(o=>{if(!o.length)throw new Error("Unable to locate ECL Client Tools.");let a=new tt(e),c,l;for(let g of o){let p=g.versionSync();if(p.exists()&&(c||(c=g),!l&&a.major===p.major&&(l=g),a.major===p.major&&a.minor===p.minor))return g.clone(t,r,n,i)}let u=l||c;return Di(u.eclccPath),u.clone(t,r,n,i)})}it.root.DOMParser=Ai.DOMParser;if(it.root.fetch===void 0)throw new Error("@hpcc-js/comms requires Node.js >= 18.0.0 for native fetch support");it.root.__hpcc_undiciFetch=Zs.fetch;it.root.__hpcc_rejectUnauthorizedAgent=new Zs.Agent({connect:{rejectUnauthorized:!1}});var nt="";X.globalAgent.options.ca!==void 0&&(Array.isArray(X.globalAgent.options.ca)&&X.globalAgent.options.ca.length?typeof X.globalAgent.options.ca[0]=="string"?nt=X.globalAgent.options.ca.join(`
923
- `):X.globalAgent.options.ca[0]instanceof Zr.Buffer&&(nt=X.globalAgent.options.ca.map(s=>s.toString()).join(`
924
- `)):typeof X.globalAgent.options.ca=="string"?nt=X.globalAgent.options.ca:X.globalAgent.options.ca instanceof Zr.Buffer&&(nt=X.globalAgent.options.ca.toString()),nt+=`
925
- `);it.root.__hpcc_trustwaveAgent=new X.Agent({ca:nt+tn});0&&(module.exports={AccessService,AccountService,Activity,Attr,Attribute,BUILD_VERSION,BaseScope,ClientTools,CloudService,CodesignService,Connection,DFUArrayActions,DFUChangeProtection,DFUChangeRestriction,DFUDefFileFormat,DFUService,DFUWorkunit,DFUWorkunitCache,DFUXRefService,DaliService,Definition,ECLGraph,ECLScope,ESPConnection,ESPExceptions,EclService,EclccErrors,ElkService,EnvchkErrors,Errors,Field,File,FileSpray,FileSprayService,FileSprayStates,Folder,GlobalResultCache,GraphCache,Import,LocalWorkunit,LogType,LogaccessService,LogicalFile,LogicalFileCache,Machine,MachineCache,MachineService,PKG_NAME,PKG_VERSION,PackageProcessService,PropertyType,Query,QueryGraph,RelatedProperty,Resource,ResourcesService,Result,ResultCache,SMCService,SashaService,Scope,ScopeEdge,ScopeGraph,ScopeSubgraph,ScopeVertex,Service,Source,SourceFile,Store,StoreCache,StoreService,TargetAudience,TargetCluster,TargetClusterCache,Timer,Topology,TopologyCache,TopologyService,ValueChangedMessage,Version,WUStateID,WUUpdate,Workspace,Workunit,WorkunitCache,WorkunitsService,WorkunitsServiceEx,WsAccess,WsCodesign,WsDfu,WsLogaccess,WsSMC,WsSasha,WsTopology,WsWorkunits,XGMMLEdge,XGMMLGraph,XGMMLSubgraph,XGMMLVertex,XSDNode,XSDSchema,XSDSimpleType,XSDXMLNode,attachWorkspace,clearAllClientToolsCache,createConnection,createGraph,createXGMMLGraph,defaultTargetCluster,deserializeResponse,get,hookSend,instanceOfIConnection,instanceOfIOptions,isArray,isECLResult,isExceptions,isWUInfoWorkunit,isWUQueryECLWorkunit,jsonp,locateAllClientTools,locateClientTools,parseXSD,parseXSD2,post,qualifiedIDBoundary,send,serializeRequest,setTransportFactory,splitMetric,targetClusters,walkXmlJson});
926
- //# sourceMappingURL=index.cjs.map
917
+ `).split(`\r`).join(`
918
+ `)}var Version=class{prefix=``;major=0;minor=0;patch=0;postfix=``;constructor(e){let t=e.split(` `);if(t.length){let e=/(?:(\w+)_)?(\d+)\.(\d+)\.(\d+)(?:-(.*))?/.exec(t[t.length-1]);e&&(this.prefix=e[1]||``,this.major=+e[2]||0,this.minor=+e[3]||0,this.patch=+e[4]||0,this.postfix=e[5]||``)}}parse(e){}exists(){return this.major!==0||this.minor!==0||this.patch!==0||this.postfix!==``}compare(e){return this.major>e.major?1:this.major<e.major?-1:this.minor>e.minor?1:this.minor<e.minor?-1:this.patch>e.patch?1:this.patch<e.patch?-1:this.postfix===``&&e.postfix!==``?1:this.postfix.localeCompare(e.postfix)}toString(){return`${this.prefix}_${this.major}.${this.minor}.${this.patch}-${this.postfix}`}},Ot=`error`,kt=`warning`,Errors=class{_checked;errWarn=[];errOther=[];constructor(e){this._checked=e}checked(){return this._checked}all(){return this.errWarn}errors(){return this.errWarn.filter(e=>e.severity===Ot)}hasError(){return this.errors().length>0}warnings(){return this.errWarn.filter(e=>e.severity===kt)}hasWarning(){return this.warnings().length>0}info(){return this.errWarn.filter(e=>[Ot,kt].indexOf(e.severity)<0)}hasOther(){return this.info().length>0}unknown(){return this.errOther}hasUnknown(){return this.unknown().length>0}},EclccErrors=class extends Errors{constructor(e,t){if(super(t),e&&e.length)for(let t of e.split(m.EOL)){let e=/([a-zA-Z]:\\(?:[- \w\.\d]+\\)*(?:[- \w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\) ?: ?(error|warning|info) C(\d*) ?: ?(.*)/.exec(t);if(e){let[,t,n,r,i,a,o]=e,s=+n,c=+r,l=a+`: `+o;this.errWarn.push({filePath:t,line:s,col:c,msg:l,severity:i})}else if(e=/(error|warning|info): (.*)/i.exec(t),e){let[,t,n]=e;this.errWarn.push({filePath:``,line:0,col:0,msg:n,severity:t})}else e=/\d error(s?), \d warning(s?)/.exec(t),!e&&(X.warning(`parseECLErrors: Unable to parse "${t}"`),this.errOther.push(t))}this._checked=t}},EnvchkErrors=class extends Errors{_lines;constructor(e,t,n){super(n);let r=p.readFileSync(e,`utf8`);if(r=r.replace(/\r\n/g,`
919
+ `),this._lines=r.split(`
920
+ `),t&&t.length)for(let n of t.split(m.EOL)){let t=/(Warning|Error) : Path\=(\S*?)(\[\S*\])? Message\=(.*)/.exec(n);if(t){let[,n,r,i,a]=t,o=`${r} ${i||``}: ${a}`,[s,c]=this.locate(r);this.errWarn.push({filePath:e,line:s,col:c,msg:o,severity:n})}else t||(X.warning(`parseECLErrors: Unable to parse "${n}"`),this.errOther.push(n))}this._checked=n}locate(e){let t=e.split(`/`);if(t.length&&t[0]===``&&t.shift(),t.length>0){let e=0;for(let n of this._lines){let r=`<`+t[0];if((n.indexOf(r+` `)>=0||n.indexOf(r+`>`)>=0)&&(t.shift(),t.length===0))return[e+1,n.indexOf(r)+1];++e}}return[0,0]}};function walkXmlJson(e,t,n){n||=[],n.push(e);for(let r in e)if(e.hasOwnProperty(r)){let i=e[r];t(r,i,n),i instanceof Array?i.forEach(e=>{walkXmlJson(e,t,n)}):typeof i==`object`&&walkXmlJson(i,t,n)}n.pop()}var LocalWorkunit=class{jsonWU;constructor(e){this.jsonWU=e}bpGetValidLocations(e){let t=[];if((0,o.exists)(`W_LOCAL.Graphs`,this.jsonWU)){let n=``;walkXmlJson(this.jsonWU.W_LOCAL.Graphs,(r,i,a)=>{if(r===`$`&&i.id&&(n=i.id),r===`$`&&i.name===`definition`){let r=/([a-z,A-Z]:\\(?:[-\w\.\d]+\\)*(?:[-\w\.\d]+)?|(?:\/[\w\.\-]+)+)\((\d*),(\d*)\)/.exec(i.value);if(r){let[,i,a,o]=r,s=+a,c=+o;e===i&&t.push({file:i,line:s,col:c,id:n})}}})}return t}},Z=class ClientTools{eclccPath;envchkPath;eclBundlePath;binPath;cwd;includeFolders;_legacyMode;_args;_version;constructor(e,t,n=[],r=!1,i=[],a){this.eclccPath=e,this.binPath=h.dirname(this.eclccPath),this.envchkPath=h.join(this.binPath,`envchk`+Dt),this.eclBundlePath=h.join(this.binPath,`ecl-bundle`+Dt),this.cwd=h.normalize(t||this.binPath),this.includeFolders=n,this._legacyMode=r,this._args=i,this._version=a}clone(e,t,n=!1,r=[]){return new ClientTools(this.eclccPath,e,t,n,r,this._version)}exists(e){try{return p.accessSync(e),!0}catch{}return!1}args(e=[]){let t=[...this._args];return this._legacyMode&&t.push(`-legacy`),t.concat(this.includeFolders.map(e=>`-I`+h.normalize(e))).concat(e)}version(){return this._version?Promise.resolve(this._version):this.execFile(this.eclccPath,this.binPath,this.args([`--version`]),`eclcc`,`Cannot find ${this.eclccPath}`).then(e=>(this._version=new Version(e.stdout),this._version))}versionSync(){return this._version}_paths={};paths(){return this.execFile(this.eclccPath,this.cwd,this.args([`-showpaths`]),`eclcc`,`Cannot find ${this.eclccPath}`).then(e=>{if(e&&e.stdout&&e.stdout.length){let t=e.stdout.split(/\r?\n/);for(let e of t){let t=e.split(`=`);t.length===2&&(this._paths[t[0]]=t[1])}}return this._paths})}loadXMLDoc(e,t){return new Promise((n,r)=>{let i=p.readFileSync(e,`ascii`),a=(0,o.xml2json)(i);t&&p.unlink(e,e=>{}),n(a)})}createWU(e){let t=h.join(m.tmpdir(),`eclcc-wu-tmp-${f.randomBytes(8).toString(`hex`)}`),n=[`-o`+t,`-wu`,e];return this.execFile(this.eclccPath,this.cwd,this.args(n),`eclcc`,`Cannot find ${this.eclccPath}`).then(e=>{let n=h.normalize(t+`.xml`);return(this.exists(n)?this.loadXMLDoc(n,!0):Promise.resolve({})).then(e=>new LocalWorkunit(e))})}createArchive(e){let t=[`-E`,e];return this.execFile(this.eclccPath,this.cwd,this.args(t),`eclcc`,`Cannot find ${this.eclccPath}`).then(e=>({content:e.stdout,err:new EclccErrors(e.stderr,[])}))}attachWorkspace(){return attachWorkspace(this.cwd)}fetchMeta(e){return Promise.all([attachWorkspace(this.cwd),this.execFile(this.eclccPath,this.cwd,this.args([`-M`,e]),`eclcc`,`Cannot find ${this.eclccPath}`)]).then(([e,t])=>{try{t&&t.stdout&&t.stdout.length&&e.parseMetaXML(t.stdout)}catch(e){X.error(`fetchMeta: Error parsing XML - ${e?.message??`unknown`}`)}return e})}syntaxCheck(e,t=[`-syntax`]){return Promise.all([attachWorkspace(this.cwd),this.execFile(this.eclccPath,this.cwd,this.args([...t,`-M`,e]),`eclcc`,`Cannot find ${this.eclccPath}`)]).then(([e,t])=>{let n=[];try{t&&t.stdout&&t.stdout.length&&(n=e.parseMetaXML(t.stdout))}catch(e){X.error(`syntaxCheck: Error parsing XML - ${e?.message??`unknown`}`)}return new EclccErrors(t?t.stderr:``,n)})}envCheck(e,t=[]){return Promise.all([attachWorkspace(this.cwd),this.execFile(this.envchkPath,this.cwd,this.args([...t,e]),`envchk`,`Cannot find ${this.envchkPath}`)]).then(([t,n])=>new EnvchkErrors(e,n?n.stderr:``,[]))}bundleList(){let e=/\|(.*)\|(.*)\|(.*)\|/g;return Promise.all([fetch(`https://raw.githubusercontent.com/hpcc-systems/ecl-bundles/master/README.rst`).then(e=>e.text()).then(t=>{let n=[],r=e.exec(t);for(;r;)n.push({name:r[1].trim(),description:r[2].trim(),url:r[3].trim()}),r=e.exec(t);return n}),this.execFile(this.eclBundlePath,this.cwd,this.args([`list`]),`ecl-bundle`,`Cannot find ${this.eclBundlePath}`).then(e=>tidyCRLF(e.stdout).split(`
921
+ `)).then(e=>{let t={};return Promise.all(e.filter(e=>!!e).map(e=>this.execFile(this.eclBundlePath,this.cwd,this.args([`info`,e]),`ecl-bundle`,`Cannot find ${this.eclBundlePath}`).then(e=>tidyCRLF(e.stdout).split(`
922
+ `)).then(n=>{let r={};n.forEach(e=>{let t=e.split(`:`);r[t.shift().trim()]=t.join(`:`).trim()}),t[e]={name:e,props:r}}))).then(()=>t)})]).then(([e,t])=>{e.forEach(e=>{t[e.name]&&(e.props=t[e.name].props,delete t[e.name])});for(let n in t)e.push({name:n,url:``,description:``,props:t[n].props});return e}).catch(e=>[])}bundleInstall(e){return Promise.all([attachWorkspace(this.cwd),this.execFile(this.eclBundlePath,this.cwd,this.args([`install`,e]),`ecl-bundle`,`Cannot find ${this.eclBundlePath}`)]).then(([e,t])=>t)}bundleUninstall(e){return Promise.all([attachWorkspace(this.cwd),this.execFile(this.eclBundlePath,this.cwd,this.args([`uninstall`,e]),`ecl-bundle`,`Cannot find ${this.eclBundlePath}`)]).then(([e,t])=>t)}execFile(e,t,n,r,i){return new Promise((r,i)=>{X.debug(`${e} ${n.join(` `)}`);let a=d.spawn(e,n,{cwd:t}),o=``,s=``;a.stdout.on(`data`,e=>{o+=e.toString()}),a.stderr.on(`data`,e=>{s+=e.toString()}),a.on(`close`,(e,t)=>{r({code:e,stdout:o.trim(),stderr:s.trim()})})})}};function locateClientToolsInFolder(e,t){if(e){let n=h.join(e,`HPCCSystems`);if(p.existsSync(n)&&p.statSync(n).isDirectory()){if(m.type()!==`Windows_NT`){let e=h.join(n,`bin`,`eclcc`);p.existsSync(e)&&t.push(new Z(e))}p.readdirSync(n).forEach(e=>{let r=h.join(n,e,`clienttools`,`bin`,`eclcc`+Dt);p.existsSync(r)&&new Version(h.basename(e)).exists()&&t.push(new Z(r))})}}}var Q;function clearAllClientToolsCache(){Q=void 0}function locateAllClientTools(){if(Q)return Q;let e=[];switch(m.type()){case`Windows_NT`:let t=process.env[`ProgramFiles(x86)`]||``;t&&locateClientToolsInFolder(t,e);let n=process.env.ProgramFiles||``;n&&locateClientToolsInFolder(n,e),!t&&!n&&locateClientToolsInFolder(`c:\\Program Files (x86)`,e);break;case`Linux`:case`Darwin`:locateClientToolsInFolder(`/opt`,e)}return Q=Promise.all(e.map(e=>e.version())).then(()=>(e.sort((e,t)=>t.versionSync().compare(e.versionSync())),e)),Q}var At=``;function logEclccPath(e){let t=`Using eclccPath setting: ${e}`;At!==t&&(X.info(t),At=t)}function locateClientTools(e=``,t=``,n=`.`,r=[],i=!1,a=[]){return e&&p.existsSync(e)?(logEclccPath(e),Promise.resolve(new Z(e,n,r,i,a))):locateAllClientTools().then(e=>{if(!e.length)throw Error(`Unable to locate ECL Client Tools.`);let o=new Version(t),s,c;for(let t of e){let e=t.versionSync();if(e.exists()&&(s||=t,!c&&o.major===e.major&&(c=t),o.major===e.major&&o.minor===e.minor))return t.clone(n,r,i,a)}let l=c||s;return logEclccPath(l.eclccPath),l.clone(n,r,i,a)})}if(o.root.DOMParser=s.DOMParser,o.root.fetch===void 0)throw Error(`@hpcc-js/comms requires Node.js >= 18.0.0 for native fetch support`);o.root.__hpcc_undiciFetch=u.fetch,o.root.__hpcc_rejectUnauthorizedAgent=new u.Agent({connect:{rejectUnauthorized:!1}});var $=``;c.globalAgent.options.ca!==void 0&&(Array.isArray(c.globalAgent.options.ca)&&c.globalAgent.options.ca.length?typeof c.globalAgent.options.ca[0]==`string`?$=c.globalAgent.options.ca.join(`
923
+ `):c.globalAgent.options.ca[0]instanceof l.Buffer&&($=c.globalAgent.options.ca.map(e=>e.toString()).join(`
924
+ `)):typeof c.globalAgent.options.ca==`string`?$=c.globalAgent.options.ca:c.globalAgent.options.ca instanceof l.Buffer&&($=c.globalAgent.options.ca.toString()),$+=`
925
+ `),o.root.__hpcc_trustwaveAgent=new c.Agent({ca:$+g}),exports.AccessService=AccessService,exports.AccountService=AccountService,exports.Activity=st,exports.Attr=Attr,exports.Attribute=Attribute,exports.BUILD_VERSION=y,exports.BaseScope=BaseScope,exports.ClientTools=Z,exports.CloudService=CloudService,exports.CodesignService=CodesignService,exports.Connection=C,exports.DFUArrayActions=ae,exports.DFUChangeProtection=se,exports.DFUChangeRestriction=ce,exports.DFUDefFileFormat=oe,exports.DFUService=DFUService,exports.DFUWorkunit=Tt,exports.DFUWorkunitCache=DFUWorkunitCache,exports.DFUXRefService=DFUXRefService,exports.DaliService=DaliService,exports.Definition=Definition,exports.ECLGraph=ECLGraph,exports.ECLScope=ECLScope,exports.ESPConnection=w,exports.ESPExceptions=ESPExceptions,exports.EclService=EclService,exports.EclccErrors=EclccErrors,exports.ElkService=ElkService,exports.EnvchkErrors=EnvchkErrors,exports.Errors=Errors,exports.Field=Field,exports.File=File,Object.defineProperty(exports,"FileSpray",{enumerable:!0,get:function(){return T}}),exports.FileSprayService=FileSprayService,exports.FileSprayStates=te,exports.Folder=Folder,exports.GlobalResultCache=GlobalResultCache,exports.GraphCache=GraphCache,exports.Import=Import,exports.LocalWorkunit=LocalWorkunit,exports.LogType=ue,exports.LogaccessService=LogaccessService,exports.LogicalFile=ut,exports.LogicalFileCache=LogicalFileCache,exports.Machine=ft,exports.MachineCache=MachineCache,exports.MachineService=MachineService,exports.PKG_NAME=_,exports.PKG_VERSION=v,exports.PackageProcessService=PackageProcessService,exports.PropertyType=et,exports.Query=bt,exports.QueryGraph=_t,exports.RelatedProperty=tt,exports.Resource=Resource,exports.ResourcesService=ResourcesService,exports.Result=Je,exports.ResultCache=ResultCache,exports.SMCService=SMCService,exports.SQL2Service=SQL2Service,exports.SQLCleanupError=SQLCleanupError,exports.SQLConnection=SQLConnection,exports.SQLResultSet=SQLResultSet,exports.SQLStatement=SQLStatement,exports.SashaService=SashaService,exports.Scope=Scope,exports.ScopeEdge=ScopeEdge,exports.ScopeGraph=ScopeGraph,exports.ScopeSubgraph=ScopeSubgraph,exports.ScopeVertex=ScopeVertex,exports.Service=Service,exports.Source=Source,exports.SourceFile=SourceFile,exports.Store=St,exports.StoreCache=StoreCache,exports.StoreService=StoreService,exports.TargetAudience=de,exports.TargetCluster=G,exports.TargetClusterCache=TargetClusterCache,exports.Timer=Timer,exports.Topology=gt,exports.TopologyCache=TopologyCache,exports.TopologyService=TopologyService,exports.ValueChangedMessage=ValueChangedMessage,exports.Version=Version,exports.WUStateID=R,Object.defineProperty(exports,"WUUpdate",{enumerable:!0,get:function(){return z}}),exports.Workspace=Workspace,exports.Workunit=it,exports.WorkunitCache=WorkunitCache,exports.WorkunitsService=WorkunitsService,exports.WorkunitsServiceEx=WorkunitsServiceEx,Object.defineProperty(exports,"WsAccess",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"WsCodesign",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"WsDfu",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"WsLogaccess",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"WsSMC",{enumerable:!0,get:function(){return Be}}),Object.defineProperty(exports,"WsSasha",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"WsTopology",{enumerable:!0,get:function(){return He}}),Object.defineProperty(exports,"WsWorkunits",{enumerable:!0,get:function(){return L}}),exports.XGMMLEdge=XGMMLEdge,exports.XGMMLGraph=XGMMLGraph,exports.XGMMLSubgraph=XGMMLSubgraph,exports.XGMMLVertex=XGMMLVertex,exports.XSDNode=XSDNode,exports.XSDSchema=XSDSchema,exports.XSDSimpleType=XSDSimpleType,exports.XSDXMLNode=XSDXMLNode,exports.attachWorkspace=attachWorkspace,exports.clearAllClientToolsCache=clearAllClientToolsCache,Object.defineProperty(exports,"createConnection",{enumerable:!0,get:function(){return createConnection}}),exports.createGraph=createGraph,exports.createXGMMLGraph=createXGMMLGraph,exports.defaultTargetCluster=defaultTargetCluster,exports.deserializeResponse=deserializeResponse,exports.get=get,exports.hookSend=hookSend,exports.instanceOfIConnection=instanceOfIConnection,exports.instanceOfIOptions=instanceOfIOptions,exports.isArray=isArray,exports.isECLResult=isECLResult,exports.isExceptions=isExceptions,exports.isWUInfoWorkunit=isWUInfoWorkunit,exports.isWUQueryECLWorkunit=isWUQueryECLWorkunit,exports.jsonp=jsonp,exports.locateAllClientTools=locateAllClientTools,exports.locateClientTools=locateClientTools,exports.parseXSD=parseXSD,exports.parseXSD2=parseXSD2,exports.post=post,exports.qualifiedIDBoundary=qualifiedIDBoundary,exports.send=send,exports.serializeRequest=serializeRequest,exports.setTransportFactory=setTransportFactory,exports.splitMetric=splitMetric,exports.targetClusters=targetClusters,exports.walkXmlJson=walkXmlJson;
926
+ //# sourceMappingURL=index.cjs.map