UNPKG

@hpcc-js/comms

Version:
1 lines 94.2 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@hpcc-js/util")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/util"],t):t(e["@hpcc-js/comms"]={},e["@hpcc-js/util"])}(this,function(u,l){"use strict";!function(e){if(!e.fetch){var t="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,u="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),r="FormData"in e,o="ArrayBuffer"in e;if(o)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=function(e){return e&&DataView.prototype.isPrototypeOf(e)},s=ArrayBuffer.isView||function(e){return e&&-1<i.indexOf(Object.prototype.toString.call(e))};d.prototype.append=function(e,t){e=f(e),t=l(t);var n=this.map[e];this.map[e]=n?n+","+t:t},d.prototype.delete=function(e){delete this.map[f(e)]},d.prototype.get=function(e){return e=f(e),this.has(e)?this.map[e]:null},d.prototype.has=function(e){return this.map.hasOwnProperty(f(e))},d.prototype.set=function(e,t){this.map[f(e)]=l(t)},d.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},d.prototype.keys=function(){var n=[];return this.forEach(function(e,t){n.push(t)}),h(n)},d.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),h(t)},d.prototype.entries=function(){var n=[];return this.forEach(function(e,t){n.push([t,e])}),h(n)},n&&(d.prototype[Symbol.iterator]=d.prototype.entries);var a=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];S.prototype.clone=function(){return new S(this,{body:this._bodyInit})},v.call(S.prototype),v.call(C.prototype),C.prototype.clone=function(){return new C(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},C.error=function(){var e=new C(null,{status:0,statusText:""});return e.type="error",e};var p=[301,302,303,307,308];C.redirect=function(e,t){if(-1===p.indexOf(t))throw new RangeError("Invalid status code");return new C(null,{status:t,headers:{location:e}})},e.Headers=d,e.Request=S,e.Response=C,e.fetch=function(n,o){return new Promise(function(r,e){var t=new S(n,o),i=new XMLHttpRequest;i.onload=function(){var e,o,t={status:i.status,statusText:i.statusText,headers:(e=i.getAllResponseHeaders()||"",o=new d,e.split(/\r?\n/).forEach(function(e){var t=e.split(":"),n=t.shift().trim();if(n){var r=t.join(":").trim();o.append(n,r)}}),o)};t.url="responseURL"in i?i.responseURL:t.headers.get("X-Request-URL");var n="response"in i?i.response:i.responseText;r(new C(n,t))},i.onerror=function(){e(new TypeError("Network request failed"))},i.ontimeout=function(){e(new TypeError("Network request failed"))},i.open(t.method,t.url,!0),"include"===t.credentials&&(i.withCredentials=!0),"responseType"in i&&u&&(i.responseType="blob"),t.headers.forEach(function(e,t){i.setRequestHeader(t,e)}),i.send(void 0===t._bodyInit?null:t._bodyInit)})},e.fetch.polyfill=!0}function f(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach(function(e,t){this.append(t,e)},this):Array.isArray(t)?t.forEach(function(e){this.append(e[0],e[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function g(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function y(n){return new Promise(function(e,t){n.onload=function(){e(n.result)},n.onerror=function(){t(n.error)}})}function b(e){var t=new FileReader,n=y(t);return t.readAsArrayBuffer(e),n}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e)if("string"==typeof e)this._bodyText=e;else if(u&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(r&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(o&&u&&c(e))this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!o||!ArrayBuffer.prototype.isPrototypeOf(e)&&!s(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=m(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u&&(this.blob=function(){var e=g(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?g(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(b)}),this.text=function(){var e,t,n,r=g(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=y(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r&&(this.formData=function(){return this.text().then(P)}),this.json=function(){return this.text().then(JSON.parse)},this}function S(e,t){var n,r,o=(t=t||{}).body;if(e instanceof S){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new d(e.headers)),this.method=e.method,this.mode=e.mode,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new d(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),-1<a.indexOf(r)?r:n),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function P(e){var o=new FormData;return e.trim().split("&").forEach(function(e){if(e){var t=e.split("="),n=t.shift().replace(/\+/g," "),r=t.join("=").replace(/\+/g," ");o.append(decodeURIComponent(n),decodeURIComponent(r))}}),o}function C(e,t){t||(t={}),this.type="default",this.status="status"in t?t.status:200,this.ok=200<=this.status&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:void 0);var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function c(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var p=function(){return(p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function s(i,u,c,s){return new(c||(c=Promise))(function(e,t){function n(e){try{o(s.next(e))}catch(e){t(e)}}function r(e){try{o(s.throw(e))}catch(e){t(e)}}function o(t){t.done?e(t.value):new c(function(e){e(t.value)}).then(n,r)}o((s=s.apply(i,u||[])).next())})}function a(n,r){var o,i,u,e,c={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;c;)try{if(o=1,i&&(u=2&t[0]?i.return:t[0]?i.throw||((u=i.return)&&u.call(i),0):i.next)&&!(u=u.call(i,t[1])).done)return u;switch(i=0,u&&(t=[2&t[0],u.value]),t[0]){case 0:case 1:u=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,i=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(u=0<(u=c.trys).length&&u[u.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!u||t[1]>u[0]&&t[1]<u[3])){c.label=t[1];break}if(6===t[0]&&c.label<u[1]){c.label=u[1],u=t;break}if(u&&c.label<u[2]){c.label=u[2],c.ops.push(t);break}u[2]&&c.ops.pop(),c.trys.pop();continue}t=r.call(n,c)}catch(e){t=[6,e],i=0}finally{o=u=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}var h=l.scopedLogger("comms/connection.ts"),t={type:"post",baseUrl:"",userID:"",password:"",rejectUnauthorized:!1,timeoutSecs:60};function d(e,o){if(void 0===o&&(o=""),o&&(o+="."),"object"!=typeof e)return encodeURIComponent(e);var i=[],t=function(n){if(e.hasOwnProperty(n))if(e[n]instanceof Array){var r=!1;e[n].forEach(function(e,t){"object"==typeof e?(r=!0,i.push(d(e,o+encodeURIComponent(n+"."+t)))):i.push(o+encodeURIComponent(n+"_i"+t)+"="+d(e))}),r&&i.push(o+encodeURIComponent(n+".itemcount")+"="+e[n].length)}else"object"==typeof e[n]?e[n]&&e[n].Item instanceof Array?(i.push(d(e[n].Item,o+encodeURIComponent(n))),i.push(o+encodeURIComponent(n+".itemcount")+"="+e[n].Item.length)):i.push(d(e[n],o+encodeURIComponent(n))):void 0!==e[n]?i.push(o+encodeURIComponent(n)+"="+encodeURIComponent(e[n])):i.push(o+encodeURIComponent(n))};for(var n in e)t(n);return i.join("&")}function g(e){return JSON.parse(e)}function i(s,a,p,f){return void 0===p&&(p={}),void 0===f&&(f="json"),new Promise(function(t,e){var n=1e3*s.timeoutSecs,r="jsonp_callback_"+Math.round(999999*Math.random());window[r]=function(e){n=0,c(),t("json"===f&&"string"==typeof e?g(e):e)};var o=document.createElement("script"),i=l.join(s.baseUrl,a);i+=0<=i.indexOf("?")?"&":"?",o.src=i+"jsonp="+r+"&"+d(p),document.body.appendChild(o);var u=setInterval(function(){n<=0?clearInterval(u):(n-=5e3)<=0?(clearInterval(u),h.error("Request timeout: "+o.src),c(),e(Error("Request timeout: "+o.src))):h.debug("Request pending ("+n/1e3+" sec): "+o.src)},5e3);function c(){delete window[r],document.body.removeChild(o)}})}var f={};function o(t,n,r,e,o){var i;function u(e){if(e.ok)return"json"===o?e.json():e.text();throw new Error(e.statusText)}return e=p({},(i=t).userID?{Authorization:"Basic "+btoa(i.userID+":"+i.password)}:{},e),r=p({credentials:f[t.baseUrl]?"omit":"include"},r,{headers:e}),l.promiseTimeout(1e3*t.timeoutSecs,fetch(l.join(t.baseUrl,n),r).then(u).catch(function(e){return r.credentials=f[t.baseUrl]?"include":"omit",fetch(l.join(t.baseUrl,n),r).then(u).then(function(e){return f[t.baseUrl]=!f[t.baseUrl],e})}))}function y(e,t,n,r){return void 0===r&&(r="json"),o(e,t,{method:"post",body:d(n)},{"Content-Type":"application/x-www-form-urlencoded"},r)}function b(e,t,n,r){return void 0===r&&(r="json"),o(e,t+"?"+d(n),{method:"get"},{},r)}function e(e,t,n,r){var o;switch(void 0===r&&(r="json"),e.type){case"jsonp":o=i(e,t,n,r);break;case"get":o=b(e,t,n,r);break;case"post":default:o=y(e,t,n,r)}return o}var m=e;var n=function(){function e(e){this.opts(e)}return e.prototype.opts=function(e){return 0===arguments.length?this._opts:(this._opts=p({},t,e),this)},e.prototype.send=function(e,t,n){return void 0===n&&(n="json"),m(this._opts,e,t,n)},e.prototype.clone=function(){return new e(this.opts())},e}();function v(e){return"[object Array]"===Object.prototype.toString.call(e)}u.createConnection=function(e){return new n(e)};var S=function(o){function e(e,t,n){var r=o.call(this,"ESPException: "+n.Source)||this;return r.isESPExceptions=!0,r.action=e,r.request=t,r.Source=n.Source,r.Exception=n.Exception,n.Exception.length&&(r.message=n.Exception[0].Code+": "+n.Exception[0].Message),r}return c(e,o),e}(Error);var P=function(){function e(e,t,n){this._connection=void 0!==e.send?e:u.createConnection(e),this._service=t,this._version=n}return e.prototype.service=function(e){return void 0===e?this._service:(this._service=e,this)},e.prototype.version=function(e){return void 0===e?this._version:(this._version=e,this)},e.prototype.toESPStringArray=function(e,t){if(v(e[t])){for(var n=0;n<e[t].length;++n)e[t+"_i"+n]=e[t][n];delete e[t]}return e},e.prototype.opts=function(e){return void 0===e?this._connection.opts():(this._connection.opts(e),this)},e.prototype.send=function(n,e,r,t){void 0===e&&(e={}),void 0===r&&(r="json"),void 0===t&&(t=!1);var o,i=p({},e,{ver_:this._version});t&&(i.upload_=!0);var u="json";switch(r){case"text":o=l.join(this._service,n),u="text";break;case"xsd":o=l.join(this._service,n+".xsd"),u="text";break;case"json2":o=l.join(this._service,n+"/json"),r="json",n=n.split("/").pop();break;default:o=l.join(this._service,n+".json")}return this._connection.send(o,i,u).then(function(e){if("json"!==r)return e;var t=void 0;if(e&&e.Exceptions)throw new S(n,i,e.Exceptions);if(e&&(t=e[("WUCDebug"===n?"WUDebug":n)+"Response"]),!t)throw new S(n,i,{Source:"ESPConnection.send",Exception:[{Code:0,Message:"Missing Response"}]});return t}).catch(function(e){if(e.isESPExceptions)throw e;throw new S(n,i,{Source:"ESPConnection.send",Exception:[{Code:0,Message:e.message}]})})},e.prototype.clone=function(){return new e(this._connection.clone(),this._service,this._version)},e}(),C=function(){function e(e){this._connection=new P(e,"Ws_Account","1.03")}return e.prototype.connectionOptions=function(){return this._connection.opts()},e.prototype.VerifyUser=function(e){return this._connection.send("VerifyUser",e)},e}(),w=function(){function e(e){this._connection=new P(e,"WsDFU","1.35")}return e.prototype.DFUQuery=function(e){return this._connection.send("DFUQuery",e)},e}();function j(e,t){var 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:O(t[0])};default:throw new Error("Unknown field type")}}function O(e){e.Row&&e.Row instanceof Array&&(e=e.Row[0]);var t=[];for(var n in e)t.push(j(n,e[n]));return t}var T,U,R,W=function(){function e(e){this._connection=new P(e,"WsEcl","0")}return e.prototype.opts=function(){return this._connection.opts()},e.prototype.requestJson=function(e,t){return this._connection.send("example/request/query/"+e+"/"+t+"/json",{},"text").then(function(e){var t=JSON.parse(e);for(var n in t)return t[n];return{}}).then(O)},e.prototype.responseJson=function(e,t){return this._connection.send("example/response/query/"+e+"/"+t+"/json",{},"text").then(function(e){var t=JSON.parse(e);for(var n in t)return t[n].Results;return{}}).then(function(e){var t={};for(var n in e)t[n]=O(e[n]);return t})},e.prototype.submit=function(e,t,n){var r="submit/query/"+e+"/"+t;return this._connection.send(r,n,"json2").then(function(e){if(e.Results&&e.Results.Exception)throw new S(r,n,{Source:"wsEcl.submit",Exception:e.Results.Exception});return e.Results})},e}(),D=function(){function e(e){this._connection=new P(e,"ws_machine","1.13")}return e.prototype.GetTargetClusterInfo=function(e){return void 0===e&&(e={}),this._connection.send("GetTargetClusterInfo",e)},e}(),x=function(){function e(e){this._connection=new P(e,"WsSMC","1.19")}return e.prototype.connectionOptions=function(){return this._connection.opts()},e.prototype.Activity=function(e){return this._connection.send("Activity",e).then(function(e){return p({Running:{ActiveWorkunit:[]}},e)})},e}(),_=function(){function e(e){this._connection=new P(e,"WsTopology","1.25")}return e.prototype.connectionOptions=function(){return this._connection.opts()},e.prototype.protocol=function(){return this._connection.opts().baseUrl.split("//")[0]},e.prototype.ip=function(){return this._connection.opts().baseUrl.split("//")[1].split(":")[0]},e.prototype.TpLogicalClusterQuery=function(e){return void 0===e&&(e={}),this._connection.send("TpLogicalClusterQuery",e)},e.prototype.DefaultTpLogicalClusterQuery=function(e){return void 0===e&&(e={}),this.TpLogicalClusterQuery(e).then(function(e){return e.default?e.default:(e.TpLogicalClusters.TpLogicalCluster.some(function(e,t){return 0===t&&(r=e),"hthor"===e.Type&&(n=e,!0)}),n||r);var n,r})},e.prototype.TpServiceQuery=function(e){return this._connection.send("TpServiceQuery",e)},e.prototype.TpTargetClusterQuery=function(e){return this._connection.send("TpTargetClusterQuery",e)},e}();(T=u.WUStateID||(u.WUStateID={}))[T.Unknown=0]="Unknown",T[T.Compiled=1]="Compiled",T[T.Running=2]="Running",T[T.Completed=3]="Completed",T[T.Failed=4]="Failed",T[T.Archived=5]="Archived",T[T.Aborting=6]="Aborting",T[T.Aborted=7]="Aborted",T[T.Blocked=8]="Blocked",T[T.Submitted=9]="Submitted",T[T.Scheduled=10]="Scheduled",T[T.Compiling=11]="Compiling",T[T.Wait=12]="Wait",T[T.UploadingFiled=13]="UploadingFiled",T[T.DebugPaused=14]="DebugPaused",T[T.DebugRunning=15]="DebugRunning",T[T.Paused=16]="Paused",T[T.LAST=17]="LAST",T[T.NotFound=999]="NotFound",U=u.WUUpdate||(u.WUUpdate={}),(R=U.Action||(U.Action={}))[R.Unknown=0]="Unknown",R[R.Compile=1]="Compile",R[R.Check=2]="Check",R[R.Run=3]="Run",R[R.ExecuteExisting=4]="ExecuteExisting",R[R.Pause=5]="Pause",R[R.PauseNow=6]="PauseNow",R[R.Resume=7]="Resume",R[R.Debug=8]="Debug",R[R.__size=9]="__size";var A=function(){function e(e){this._connection=new P(e,"WsWorkunits","1.68")}return e.prototype.opts=function(){return this._connection.opts()},e.prototype.connection=function(){return this._connection},e.prototype.WUQuery=function(e){return void 0===e&&(e={}),this._connection.send("WUQuery",e).then(function(e){return l.deepMixin({Workunits:{ECLWorkunit:[]}},e)})},e.prototype.WUInfo=function(e){var t=p({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,SuppressResultSchemas:!0},e);return this._connection.send("WUInfo",t)},e.prototype.WUCreate=function(){return this._connection.send("WUCreate")},e.prototype.WUUpdate=function(e){return this._connection.send("WUUpdate",e,"json",!0)},e.prototype.WUSubmit=function(e){return this._connection.send("WUSubmit",e)},e.prototype.WUResubmit=function(e){return this._connection.toESPStringArray(e,"Wuids"),this._connection.send("WUResubmit",e)},e.prototype.WUQueryDetails=function(e){return this._connection.send("WUQueryDetails",e)},e.prototype.WUListQueries=function(e){return this._connection.send("WUListQueries",e)},e.prototype.WUPushEvent=function(e){return this._connection.send("WUPushEvent",e)},e.prototype.WUAction=function(e){return e.ActionType=e.WUActionType,this._connection.send("WUAction",e)},e.prototype.WUGetZAPInfo=function(e){return this._connection.send("WUGetZAPInfo",e)},e.prototype.WUShowScheduled=function(e){return this._connection.send("WUShowScheduled",e)},e.prototype.WUQuerySetAliasAction=function(e){return this._connection.send("WUQuerySetAliasAction",e)},e.prototype.WUQuerySetQueryAction=function(e){return this._connection.send("WUQuerySetQueryAction",e)},e.prototype.WUPublishWorkunit=function(e){return this._connection.send("WUPublishWorkunit",e)},e.prototype.WUGetGraph=function(e){return this._connection.send("WUGetGraph",e)},e.prototype.WUResult=function(e){return this._connection.send("WUResult",e)},e.prototype.WUQueryGetGraph=function(e){return this._connection.send("WUQueryGetGraph",e)},e.prototype.WUFile=function(e){return this._connection.send("WUFile",e,"text")},e.prototype.WUGetStats=function(e){return this._connection.send("WUGetStats",e)},e.prototype.WUDetailsMeta=function(e){return this._WUDetailsMetaPromise||(this._WUDetailsMetaPromise=this._connection.send("WUDetailsMeta",e)),this._WUDetailsMetaPromise},e.prototype.WUDetails=function(e){return this._connection.send("WUDetails",e)},e.prototype.WUCDebug=function(e){return this._connection.send("WUCDebug",e).then(function(e){var t=l.xml2json(e.Result).children();return t.length?t[0]:null})},e}(),I=new Date,M=new Date;function E(o,i,n,r){function u(e){return o(e=new Date(+e)),e}return(u.floor=u).ceil=function(e){return o(e=new Date(e-1)),i(e,1),o(e),e},u.round=function(e){var t=u(e),n=u.ceil(e);return e-t<n-e?t:n},u.offset=function(e,t){return i(e=new Date(+e),null==t?1:Math.floor(t)),e},u.range=function(e,t,n){var r=[];if(e=u.ceil(e),n=null==n?1:Math.floor(n),!(e<t&&0<n))return r;for(;r.push(new Date(+e)),i(e,n),o(e),e<t;);return r},u.filter=function(n){return E(function(e){if(e<=e)for(;o(e),!n(e);)e.setTime(e-1)},function(e,t){if(e<=e)for(;0<=--t;)for(;i(e,1),!n(e););})},n&&(u.count=function(e,t){return I.setTime(+e),M.setTime(+t),o(I),o(M),Math.floor(n(I,M))},u.every=function(t){return t=Math.floor(t),isFinite(t)&&0<t?1<t?u.filter(r?function(e){return r(e)%t==0}:function(e){return u.count(0,e)%t==0}):u:null}),u}var L=E(function(){},function(e,t){e.setTime(+e+t)},function(e,t){return t-e});L.every=function(n){return n=Math.floor(n),isFinite(n)&&0<n?1<n?E(function(e){e.setTime(Math.floor(e/n)*n)},function(e,t){e.setTime(+e+t*n)},function(e,t){return(t-e)/n}):L:null};var N=1e3,F=6e4,k=36e5,G=6048e5,V=(E(function(e){e.setTime(Math.floor(e/N)*N)},function(e,t){e.setTime(+e+t*N)},function(e,t){return(t-e)/N},function(e){return e.getUTCSeconds()}),E(function(e){e.setTime(Math.floor(e/F)*F)},function(e,t){e.setTime(+e+t*F)},function(e,t){return(t-e)/F},function(e){return e.getMinutes()}),E(function(e){var t=e.getTimezoneOffset()*F%k;t<0&&(t+=k),e.setTime(Math.floor((+e-t)/k)*k+t)},function(e,t){e.setTime(+e+t*k)},function(e,t){return(t-e)/k},function(e){return e.getHours()}),E(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*F)/864e5},function(e){return e.getDate()-1}));function B(t){return E(function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*F)/G})}var Q=B(0),H=B(1),X=(B(2),B(3),B(4)),q=(B(5),B(6),Q.range,H.range,X.range,E(function(e){e.setDate(1),e.setHours(0,0,0,0)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())},function(e){return e.getMonth()}),E(function(e){e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()},function(e){return e.getFullYear()}));q.every=function(n){return isFinite(n=Math.floor(n))&&0<n?E(function(e){e.setFullYear(Math.floor(e.getFullYear()/n)*n),e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,t){e.setFullYear(e.getFullYear()+t*n)}):null};E(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+t*F)},function(e,t){return(t-e)/F},function(e){return e.getUTCMinutes()}),E(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+t*k)},function(e,t){return(t-e)/k},function(e){return e.getUTCHours()});var Y=E(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5},function(e){return e.getUTCDate()-1});function J(t){return E(function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/G})}var z=J(0),Z=J(1),$=(J(2),J(3),J(4)),K=(J(5),J(6),z.range,Z.range,$.range,E(function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())},function(e){return e.getUTCMonth()}),E(function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()},function(e){return e.getUTCFullYear()}));function ee(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 te(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 ne(e){return{y:e,m:0,d:1,H:0,M:0,S:0,L:0}}K.every=function(n){return isFinite(n=Math.floor(n))&&0<n?E(function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/n)*n),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t*n)}):null};var re,oe,ie,ue={"-":"",_:" ",0:"0"},ce=/^\s*\d+/,se=/^%/,ae=/[\\^$*+?|[\]().{}]/g;function pe(e,t,n){var r=e<0?"-":"",o=(r?-e:e)+"",i=o.length;return r+(i<n?new Array(n-i+1).join(t)+o:o)}function fe(e){return e.replace(ae,"\\$&")}function le(e){return new RegExp("^(?:"+e.map(fe).join("|")+")","i")}function he(e){for(var t={},n=-1,r=e.length;++n<r;)t[e[n].toLowerCase()]=n;return t}function de(e,t,n){var r=ce.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function ge(e,t,n){var r=ce.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function ye(e,t,n){var r=ce.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function be(e,t,n){var r=ce.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function me(e,t,n){var r=ce.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function ve(e,t,n){var r=ce.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Se(e,t,n){var r=ce.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(68<+r[0]?1900:2e3),n+r[0].length):-1}function Pe(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 Ce(e,t,n){var r=ce.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function we(e,t,n){var r=ce.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function je(e,t,n){var r=ce.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Oe(e,t,n){var r=ce.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Te(e,t,n){var r=ce.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Ue(e,t,n){var r=ce.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Re(e,t,n){var r=ce.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function We(e,t,n){var r=ce.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function De(e,t,n){var r=se.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function xe(e,t,n){var r=ce.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function _e(e,t,n){var r=ce.exec(t.slice(n));return r?(e.Q=1e3*+r[0],n+r[0].length):-1}function Ae(e,t){return pe(e.getDate(),t,2)}function Ie(e,t){return pe(e.getHours(),t,2)}function Me(e,t){return pe(e.getHours()%12||12,t,2)}function Ee(e,t){return pe(1+V.count(q(e),e),t,3)}function Le(e,t){return pe(e.getMilliseconds(),t,3)}function Ne(e,t){return Le(e,t)+"000"}function Fe(e,t){return pe(e.getMonth()+1,t,2)}function ke(e,t){return pe(e.getMinutes(),t,2)}function Ge(e,t){return pe(e.getSeconds(),t,2)}function Ve(e){var t=e.getDay();return 0===t?7:t}function Be(e,t){return pe(Q.count(q(e),e),t,2)}function Qe(e,t){var n=e.getDay();return e=4<=n||0===n?X(e):X.ceil(e),pe(X.count(q(e),e)+(4===q(e).getDay()),t,2)}function He(e){return e.getDay()}function Xe(e,t){return pe(H.count(q(e),e),t,2)}function qe(e,t){return pe(e.getFullYear()%100,t,2)}function Ye(e,t){return pe(e.getFullYear()%1e4,t,4)}function Je(e){var t=e.getTimezoneOffset();return(0<t?"-":(t*=-1,"+"))+pe(t/60|0,"0",2)+pe(t%60,"0",2)}function ze(e,t){return pe(e.getUTCDate(),t,2)}function Ze(e,t){return pe(e.getUTCHours(),t,2)}function $e(e,t){return pe(e.getUTCHours()%12||12,t,2)}function Ke(e,t){return pe(1+Y.count(K(e),e),t,3)}function et(e,t){return pe(e.getUTCMilliseconds(),t,3)}function tt(e,t){return et(e,t)+"000"}function nt(e,t){return pe(e.getUTCMonth()+1,t,2)}function rt(e,t){return pe(e.getUTCMinutes(),t,2)}function ot(e,t){return pe(e.getUTCSeconds(),t,2)}function it(e){var t=e.getUTCDay();return 0===t?7:t}function ut(e,t){return pe(z.count(K(e),e),t,2)}function ct(e,t){var n=e.getUTCDay();return e=4<=n||0===n?$(e):$.ceil(e),pe($.count(K(e),e)+(4===K(e).getUTCDay()),t,2)}function st(e){return e.getUTCDay()}function at(e,t){return pe(Z.count(K(e),e),t,2)}function pt(e,t){return pe(e.getUTCFullYear()%100,t,2)}function ft(e,t){return pe(e.getUTCFullYear()%1e4,t,4)}function lt(){return"+0000"}function ht(){return"%"}function dt(e){return+e}function gt(e){return Math.floor(+e/1e3)}re=function(e){var r=e.dateTime,o=e.date,i=e.time,t=e.periods,n=e.days,u=e.shortDays,c=e.months,s=e.shortMonths,a=le(t),p=he(t),f=le(n),l=he(n),h=le(u),d=he(u),g=le(c),y=he(c),b=le(s),m=he(s),v={a:function(e){return u[e.getDay()]},A:function(e){return n[e.getDay()]},b:function(e){return s[e.getMonth()]},B:function(e){return c[e.getMonth()]},c:null,d:Ae,e:Ae,f:Ne,H:Ie,I:Me,j:Ee,L:Le,m:Fe,M:ke,p:function(e){return t[+(12<=e.getHours())]},Q:dt,s:gt,S:Ge,u:Ve,U:Be,V:Qe,w:He,W:Xe,x:null,X:null,y:qe,Y:Ye,Z:Je,"%":ht},S={a:function(e){return u[e.getUTCDay()]},A:function(e){return n[e.getUTCDay()]},b:function(e){return s[e.getUTCMonth()]},B:function(e){return c[e.getUTCMonth()]},c:null,d:ze,e:ze,f:tt,H:Ze,I:$e,j:Ke,L:et,m:nt,M:rt,p:function(e){return t[+(12<=e.getUTCHours())]},Q:dt,s:gt,S:ot,u:it,U:ut,V:ct,w:st,W:at,x:null,X:null,y:pt,Y:ft,Z:lt,"%":ht},P={a:function(e,t,n){var r=h.exec(t.slice(n));return r?(e.w=d[r[0].toLowerCase()],n+r[0].length):-1},A:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=l[r[0].toLowerCase()],n+r[0].length):-1},b:function(e,t,n){var r=b.exec(t.slice(n));return r?(e.m=m[r[0].toLowerCase()],n+r[0].length):-1},B:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.m=y[r[0].toLowerCase()],n+r[0].length):-1},c:function(e,t,n){return j(e,r,t,n)},d:we,e:we,f:We,H:Oe,I:Oe,j:je,L:Re,m:Ce,M:Te,p:function(e,t,n){var r=a.exec(t.slice(n));return r?(e.p=p[r[0].toLowerCase()],n+r[0].length):-1},Q:xe,s:_e,S:Ue,u:ge,U:ye,V:be,w:de,W:me,x:function(e,t,n){return j(e,o,t,n)},X:function(e,t,n){return j(e,i,t,n)},y:Se,Y:ve,Z:Pe,"%":De};function C(s,a){return function(e){var t,n,r,o=[],i=-1,u=0,c=s.length;for(e instanceof Date||(e=new Date(+e));++i<c;)37===s.charCodeAt(i)&&(o.push(s.slice(u,i)),null!=(n=ue[t=s.charAt(++i)])?t=s.charAt(++i):n="e"===t?" ":"0",(r=a[t])&&(t=r(e,n)),o.push(t),u=i+1);return o.push(s.slice(u,i)),o.join("")}}function w(o,i){return function(e){var t,n,r=ne(1900);if(j(r,o,e+="",0)!=e.length)return null;if("Q"in r)return new Date(r.Q);if("p"in r&&(r.H=r.H%12+12*r.p),"V"in r){if(r.V<1||53<r.V)return null;"w"in r||(r.w=1),r.d="Z"in r?(t=4<(n=(t=te(ne(r.y))).getUTCDay())||0===n?Z.ceil(t):Z(t),t=Y.offset(t,7*(r.V-1)),r.y=t.getUTCFullYear(),r.m=t.getUTCMonth(),t.getUTCDate()+(r.w+6)%7):(t=4<(n=(t=i(ne(r.y))).getDay())||0===n?H.ceil(t):H(t),t=V.offset(t,7*(r.V-1)),r.y=t.getFullYear(),r.m=t.getMonth(),t.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?1:0),n="Z"in r?te(ne(r.y)).getUTCDay():i(ne(r.y)).getDay(),r.m=0,r.d="W"in r?(r.w+6)%7+7*r.W-(n+5)%7:r.w+7*r.U-(n+6)%7);return"Z"in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,te(r)):i(r)}}function j(e,t,n,r){for(var o,i,u=0,c=t.length,s=n.length;u<c;){if(s<=r)return-1;if(37===(o=t.charCodeAt(u++))){if(o=t.charAt(u++),!(i=P[o in ue?t.charAt(u++):o])||(r=i(e,n,r))<0)return-1}else if(o!=n.charCodeAt(r++))return-1}return r}return v.x=C(o,v),v.X=C(i,v),v.c=C(r,v),S.x=C(o,S),S.X=C(i,S),S.c=C(r,S),{format:function(e){var t=C(e+="",v);return t.toString=function(){return e},t},parse:function(e){var t=w(e+="",ee);return t.toString=function(){return e},t},utcFormat:function(e){var t=C(e+="",S);return t.toString=function(){return e},t},utcParse:function(e){var t=w(e,te);return t.toString=function(){return e},t}}}({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"]}),re.format,re.parse,oe=re.utcFormat,ie=re.utcParse;var yt="%Y-%m-%dT%H:%M:%S.%LZ";Date.prototype.toISOString||oe(yt);+new Date("2000-01-01T00:00:00.000Z")||ie(yt);var bt=function(s){function e(e,t,n){var r=s.call(this)||this;r.wu=e;for(var o=0,i=0,u=n;i<u.length;i++){var c=u[i];if(c.GraphName===t.Name&&!c.HasSubGraphId){o=Math.round(1e3*c.Seconds)/1e3;break}}return r.set(p({Time:o},t)),r}return c(e,s),Object.defineProperty(e.prototype,"properties",{get:function(){return this.get()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Name",{get:function(){return this.get("Name")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Label",{get:function(){return this.get("Label")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Type",{get:function(){return this.get("Type")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Complete",{get:function(){return this.get("Complete")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"WhenStarted",{get:function(){return this.get("WhenStarted")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"WhenFinished",{get:function(){return this.get("WhenFinished")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Time",{get:function(){return this.get("Time")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Running",{get:function(){return this.get("Running")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"RunningId",{get:function(){return this.get("RunningId")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Failed",{get:function(){return this.get("Failed")},enumerable:!0,configurable:!0}),e.prototype.fetchScopeGraph=function(e){return e?this.wu.fetchGraphDetails([e],["subgraph"]).then(function(e){return Wt(e)}):this.wu.fetchGraphDetails([this.Name],["graph"]).then(function(e){return Wt(e)})},e}(l.StateObject),mt=function(e){function t(){return e.call(this,function(e){return l.Cache.hash([e.Name])})||this}return c(t,e),t}(l.Cache);function vt(e){var t={};return e.forEach(function(e){"att"===e.name&&(t[e.$.name]=e.$.value)}),t}var St=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t}(l.Graph),Pt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t}(l.Subgraph),Ct=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t}(l.Vertex),wt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t}(l.Edge);function jt(e,t){var s={},a={},p={},n=new St(function(e){return e._.id}),f=[n.root];return function t(e,n,r){(r=r||[]).push(e),n(e.name,e.$,e.children(),r),e.children().forEach(function(e){t(e,n,r)}),r.pop()}(t,function(e,t,n,r){var o=f[f.length-1];switch(e){case"graph":break;case"node":if(n.length&&n[0].children().length&&"graph"===n[0].children()[0].name){var i=o.createSubgraph(vt(n));f.push(i),s[t.id]=i}var u=o.createVertex(vt(n));a[t.id]=u;break;case"edge":var c=o.createEdge(a[t.source],a[t.target],vt(n));p[t.id]=c}}),n}var Ot=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t}(l.Graph),Tt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t}(l.Subgraph),Ut=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t}(l.Vertex),Rt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t}(l.Edge);function Wt(e){for(var t,n={},r={},o=0,i=e;o<i.length;o++){switch((f=i[o]).ScopeType){case"graph":t=new Ot(function(e){return e._.Id},f),n[f.ScopeName]=t.root;break;case"subgraph":t||(t=new Ot(function(e){return e._.Id},f),n[f.ScopeName]=t.root);for(var u=f.parentScope().split(":"),c=n[f.parentScope()];u.length&&!c;)c=n[u.join(":")],u.pop();if(c){var s=c;n[f.ScopeName]=s.createSubgraph(f)}else console.log("Missing SG:Parent ("+f.Id+"): "+f.parentScope());break;case"activity":var a=n[f.parentScope()];a?a.createVertex(f):console.log("Missing A:Parent ("+f.Id+"): "+f.parentScope());break;case"edge":r[f.ScopeName]=f}}for(var p in r){var f,l=n[(f=r[p]).parentScope()];if(l){var h=l;try{var d=t.vertex(f.attr("IdSource").RawValue),g=t.vertex(f.attr("IdTarget").RawValue);h.createEdge(d,g,f)}catch(e){console.log("Invalid Edge: "+p)}}else console.log("Missing E:Parent ("+f.Id+"): "+f.parentScope())}return t}var Dt=function(s){function e(e,t){var n=s.call(this)||this;n.wu=e;var r=t.split("\\").join("/"),o=r.split("/"),i="res/"+n.wu.Wuid+"/",u="",c="";return 0===r.indexOf(i)&&(u=r.substr(i.length),c=o[o.length-1]),n.set({URL:t,DisplayName:c,DisplayPath:u}),n}return c(e,s),Object.defineProperty(e.prototype,"properties",{get:function(){return this.get()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"URL",{get:function(){return this.get("URL")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"DisplayName",{get:function(){return this.get("DisplayName")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"DisplayPath",{get:function(){return this.get("DisplayPath")},enumerable:!0,configurable:!0}),e}(l.StateObject),xt=function(){function e(e){this.e=e}return e.prototype.fix=function(){delete this.e},e}(),_t=function(r){function e(e){var t=r.call(this,e)||this;return t.attrs={},t._children=[],t}return c(e,r),e.prototype.append=function(e){this._children.push(e),this.type||(this.type="hpcc:childDataset")},e.prototype.fix=function(){var e;this.name=this.e.$.name,this.type=this.e.$.type;for(var t=this._children.length-1;0<=t;--t){var n=this._children[t];"Row"===n.name&&void 0===n.type&&((e=this._children).push.apply(e,n._children),this._children.splice(t,1))}r.prototype.fix.call(this)},e.prototype.children=function(){return this._children},e.prototype.charWidth=function(){var e=-1;switch(this.type){case"xs:boolean":e=5;break;case"xs:integer":case"xs:nonNegativeInteger":case"xs:double":e=8;break;case"xs:string":e=32;break;default:for(var t=this.type.lastIndexOf("_"),n=0<t?t:this.type.length,r=n-1;0<=r&&-1!=="0123456789".indexOf(this.type.charAt(r));--r);r+1<n&&(e=parseInt(this.type.substring(r+1,n),10)),0===this.type.indexOf("data")&&(e*=2)}return e<this.name.length&&(e=this.name.length),e},e}(xt),At=function(t){function e(e){return t.call(this,e)||this}return c(e,t),e.prototype.append=function(e){switch(e.name){case"xs:restriction":this._restricition=e;break;case"xs:maxLength":this._maxLength=e}},e.prototype.fix=function(){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,t.prototype.fix.call(this)},e}(xt),It=function(){function e(){this.simpleTypes={}}return e.prototype.fields=function(){return this.root.children()},e}(),Mt=function(r){function e(){var e=null!==r&&r.apply(this,arguments)||this;return e.schema=new It,e.simpleTypes={},e.xsdStack=new l.Stack,e}return c(e,r),e.prototype.startXMLNode=function(e){switch(r.prototype.startXMLNode.call(this,e),e.name){case"xs:element":var t=new _t(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 At(e)}},e.prototype.endXMLNode=function(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":var t=this.xsdStack.top();for(var n in e.$)t.attrs[n]=e.$[n];break;default:this.simpleType&&this.simpleType.append(e)}r.prototype.endXMLNode.call(this,e)},e}(l.SAXStackParser);function Et(e){var t=new Mt;return t.parse(e),t.schema}var Lt=function(n){function e(e){var t=n.call(this)||this;return t.schema=new It,t.simpleTypes={},t.xsdStack=new l.Stack,t._rootName=e,t}return c(e,n),e.prototype.startXMLNode=function(e){switch(n.prototype.startXMLNode.call(this,e),e.name){case"xsd:element":var t=new _t(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 At(e)}},e.prototype.endXMLNode=function(e){switch(e.name){case"xsd:element":this.xsdStack.pop().fix()}n.prototype.endXMLNode.call(this,e)},e}(Mt);var Nt,Ft=function(e){function t(){return e.call(this,function(e){return e.Wuid+"/"+e.ResultName})||this}return c(t,e),t}(l.Cache),kt=new Ft,Gt=function(i){function u(e,t,n,r){void 0===r&&(r=[]);var o=i.call(this)||this;return o.connection=e instanceof A?e:new A(e),void 0===n?o.set({LogicalFileName:t}):"string"==typeof n?o.set({Wuid:t,ResultName:n,ResultViews:r}):"number"==typeof n?o.set({Wuid:t,ResultSequence:n,ResultViews:r}):o.set(p({Wuid:t,ResultName:n.Name,ResultViews:r},n)),o}return c(u,i),Object.defineProperty(u.prototype,"properties",{get:function(){return this.get()},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"Wuid",{get:function(){return this.get("Wuid")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"ResultName",{get:function(){return this.get("ResultName")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"ResultSequence",{get:function(){return this.get("ResultSequence")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"LogicalFileName",{get:function(){return this.get("LogicalFileName")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"Name",{get:function(){return this.get("Name")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"Sequence",{get:function(){return this.get("Sequence")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"Value",{get:function(){return this.get("Value")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"Link",{get:function(){return this.get("Link")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"FileName",{get:function(){return this.get("FileName")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"IsSupplied",{get:function(){return this.get("IsSupplied")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"ShowFileContent",{get:function(){return this.get("ShowFileContent")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"Total",{get:function(){return this.get("Total")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"ECLSchemas",{get:function(){return this.get("ECLSchemas")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"NodeGroup",{get:function(){return this.get("NodeGroup")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"ResultViews",{get:function(){return this.get("ResultViews")},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"XmlSchema",{get:function(){return this.get("XmlSchema")},enumerable:!0,configurable:!0}),u.attach=function(e,t,n,r){var o=kt.get({Wuid:t,ResultName:n},function(){return new u(e,t,n)});return r&&o.set(r),o},u.prototype.isComplete=function(){return-1!==this.Total},u.prototype.fetchXMLSchema=function(){var t=this;return this.xsdSchema?Promise.resolve(this.xsdSchema):this.WUResult().then(function(e){return l.exists("Result.XmlSchema.xml",e)?(t.xsdSchema=Et(e.Result.XmlSchema.xml),t.xsdSchema):null})},u.prototype.refresh=function(){return s(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,this.fetchRows(0,1,!0)];case 1:return e.sent(),[2,this]}})})},u.prototype.fetchRows=function(e,t,n,r){var o=this;return void 0===e&&(e=0),void 0===t&&(t=-1),void 0===n&&(n=!1),void 0===r&&(r={}),this.WUResult(e,t,!n,r).then(function(e){var t=e.Result;return delete e.Result,o.set(p({},e)),l.exists("XmlSchema.xml",t)&&(o.xsdSchema=Et(t.XmlSchema.xml)),l.exists("Row",t)?t.Row:o.ResultName&&l.exists(o.ResultName,t)?t[o.ResultName].Row:[]})},u.prototype.rootField=function(){return this.xsdSchema?this.xsdSchema.root:null},u.prototype.fields=function(){return this.xsdSchema?this.xsdSchema.root.children():[]},u.prototype.WUResult=function(e,t,n,r){void 0===e&&(e=0),void 0===t&&(t=1),void 0===n&&(n=!1),void 0===r&&(r={});var o={NamedValue:{itemcount:0}};for(var i in r)o.NamedValue[o.NamedValue.itemcount++]={Name:i,Value:r[i]};var u={FilterBy:o};return this.Wuid&&void 0!==this.ResultName?(u.Wuid=this.Wuid,u.ResultName=this.ResultName):this.Wuid&&void 0!==this.ResultSequence?(u.Wuid=this.Wuid,u.Sequence=this.ResultSequence):this.LogicalFileName&&this.NodeGroup?(u.LogicalName=this.LogicalFileName,u.Cluster=this.NodeGroup):this.LogicalFileName&&(u.LogicalName=this.LogicalFileName),u.Start=e,u.Count=t,u.SuppressXmlSchema=n,this.connection.WUResult(u).then(function(e){return e})},u}(l.StateObject),Vt=function(e){function t(){return e.call(this,function(e){return l.Cache.hash([e.Sequence,e.Name,e.FileName])})||this}return c(t,e),t}(l.Cache),Bt=function(r){function e(e,t){var n=r.call(this)||this;return n.scope=e,n.set(t),n}return c(e,r),Object.defineProperty(e.prototype,"properties",{get:function(){return this.get()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Name",{get:function(){return this.get("Name")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"RawValue",{get:function(){return this.get("RawValue")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Formatted",{get:function(){return this.get("Formatted")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"FormattedEnd",{get:function(){return this.get("FormattedEnd")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Measure",{get:function(){return this.get("Measure")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Creator",{get:function(){return this.get("Creator")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CreatorType",{get:function(){return this.get("CreatorType")},enumerable:!0,configurable:!0}),e}(l.StateObject),Qt=function(n){function e(e){var t=n.call(this)||this;return t._attributeMap={},t._children=[],t.update(e),t}return c(e,n),Object.defineProperty(e.prototype,"properties",{get:function(){return this.get()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ScopeName",{get:function(){return this.get("ScopeName")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Id",{get:function(){return this.get("Id")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ScopeType",{get:function(){return this.get("ScopeType")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Properties",{get:function(){return this.get("Properties",{Property:[]})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"CAttributes",{get:function(){var t=this,n=[],r={start:null,end:null};return this.Properties.Property.forEach(function(e){"ts"===e.Measure&&0<=e.Name.indexOf("Started")?r.start=e:t.ScopeName&&"ts"===e.Measure&&0<=e.Name.indexOf("Finished")?r.end=e:n.push(new Bt(t,e))}),r.start&&r.end?(r.start.FormattedEnd=r.end.Formatted,n.push(new Bt(this,r.start))):r.start?n.push(new Bt(this,r.start)):r.end&&n.push(new Bt(this,r.end)),n},enumerable:!0,configurable:!0}),e.prototype.update=function(e){var t=this;for(var n in this.set(e),this.CAttributes.forEach(function(e){t._attributeMap[e.Name]=e}),this.Properties.Property=[],this._attributeMap)this._attributeMap.hasOwnProperty(n)&&this.Properties.Property.push(this._attributeMap[n].properties)},e.prototype.parentScope=function(){var e=this.ScopeName.split(":");return e.pop(),e.join(":")},e.prototype.children=function(e){return arguments.length?(this._children=e,this):this._children},e.prototype.walk=function(e){if(e.start(this))return!0;for(var t=0,n=this.children();t<n.length;t++){if(n[t].walk(e))return!0}return e.end(this)},e.prototype.formattedAttrs=function(){var e={};for(var t in this._attributeMap)e[t]=this._attributeMap[t].Formatted||this._attributeMap[t].RawValue;return e},e.prototype.rawAttrs=function(){var e={};for(var t in this._attributeMap)e[t]=this._attributeMap[t].RawValue;return e},e.prototype.hasAttr=function(e){return void 0!==this._attributeMap[e]},e.prototype.attr=function(e){return this._attributeMap[e]||new Bt(this,{Creator:"",CreatorType:"",Formatted:"",Measure:"",Name:"",RawValue:""})},e.prototype.attrMeasure=function(e){return this._attributeMap[e].Measure},e.prototype.calcTooltip=function(e){var t="",n=[];t=this.Id,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>");var r=this.formattedAttrs();for(var o in r)"Label"===o?t=r[o]:n.push('<tr><td class="key">'+o+'</td><td class="value">'+r[o]+"</td></tr>");return'<div class="eclwatch_WUGraph_Tooltip" style="max-width:480px">\n <h4 align="center">'+t+"</h4>\n <table>\n "+n.join("")+"\n </table>\n </div>"},e}(l.StateObject),Ht=function(r){function e(e,t){var n=r.call(this,t)||this;return n.wu=e,n}return c(e,r),e}(Qt),Xt=function(o){function e(e,t,n){var r=o.call(this)||this;return r.connection=e instanceof A?e:new A(e),r.set(p({Wuid:t},n)),r}return c(e,o),Object.definePrope