@hpcc-js/marshaller 3.2.1 → 3.2.2
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.
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +4 -4
package/dist/index.umd.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@hpcc-js/comms"),require("@hpcc-js/common"),require("@hpcc-js/util"),require("@hpcc-js/ddl-shim"),require("@hpcc-js/chart"),require("@hpcc-js/dgrid"),require("@hpcc-js/form"),require("@hpcc-js/graph"),require("@hpcc-js/map"),require("@hpcc-js/layout"),require("@hpcc-js/phosphor"),require("@hpcc-js/codemirror"),require("@hpcc-js/other")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/comms","@hpcc-js/common","@hpcc-js/util","@hpcc-js/ddl-shim","@hpcc-js/chart","@hpcc-js/dgrid","@hpcc-js/form","@hpcc-js/graph","@hpcc-js/map","@hpcc-js/layout","@hpcc-js/phosphor","@hpcc-js/codemirror","@hpcc-js/other"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@hpcc-js/marshaller"]={},e["@hpcc-js/comms"],e["@hpcc-js/common"],e["@hpcc-js/util"],e["@hpcc-js/ddl-shim"],e["@hpcc-js/chart"],e["@hpcc-js/dgrid"],e["@hpcc-js/form"],e["@hpcc-js/graph"],e["@hpcc-js/map"],e["@hpcc-js/layout"],e["@hpcc-js/phosphor"],e["@hpcc-js/codemirror"],e["@hpcc-js/other"])}(this,function(e,t,i,s,r,a,o,n,l,h,u,c,d,p){"use strict";var m,_=Object.defineProperty,f=(e,t)=>_(e,"name",{value:t,configurable:!0}),D=(e,t,i)=>((e,t,i)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i);const v="@hpcc-js/marshaller",g="3.2.1",y="3.24.0";function b(e){if(Array.isArray(e))return"["+e.map(b).join(", ")+"]";if("object"!=typeof e||null==e)return JSON.stringify(e);return`{ ${Object.keys(e).map(t=>`${t}: ${b(e[t])}`).join(", ")} }`}function w(e){switch(e){case"boolean":return"boolean";case"xs:byte":case"xs:double":case"xs:decimal":case"xs:float":case"xs:int":case"xs:short":case"xs:unsignedInt":case"xs:unsignedShort":case"xs:unsignedByte":case"number":return"number";case"xs:integer":case"xs:long":case"xs:negativeInteger":case"xs:nonNegativeInteger":case"xs:nonPositiveInteger":case"xs:positiveInteger":case"xs:unsignedLong":return"number64";case"string":return"string";case"range":return"range"}return"string"}function F(e){return e._children&&e._children.length?{type:"dataset",id:e.name,children:e._children.map(F)}:{id:e.name,type:w(e.type)}}function x(e){return e}f(b,"stringify"),f(w,"schemaType2IFieldType"),f(F,"schemaRow2IField"),f(x,"wsEclSchemaRow2IField");const P=class _Activity extends i.PropertyExt{_sourceActivity;fixInt64(e){if(!e||0===e.length)return[];const t=this.outFields().filter(t=>{switch(t.type){case"number":return"number"!=typeof e[0][t.id];case"number64":return!0}return!1});return t.length?e.map(e=>{for(const i of t)e[i.id]=+e[i.id];return e}):e}sourceActivity(e){return arguments.length?(this._sourceActivity=e,this):this._sourceActivity}hash(e={}){return s.hashSum({...e})}refreshMeta(){return this._sourceActivity?this._sourceActivity.refreshMeta():Promise.resolve()}exists(){return!0}validate(){return[]}label(){return this.id()}updatedBy(){return[]}_emptyFields=[];inFields(){return this._sourceActivity?this._sourceActivity.outFields():this._emptyFields}computeFields(e){return()=>e}outFields(){return this.computeFields(this.inFields())()}localFields(){const e=this.inFields().map(e=>e.id);return this.outFields().filter(t=>e.indexOf(t.id)<0)}fieldOrigin(e){return this.localFields().filter(t=>t.id===e).length?this:this.sourceActivity()?this.sourceActivity().fieldOrigin(e):null}resolveFields(e,t){for(const i of t){const t=this.fieldOrigin(i);t&&(e.outputs[t.id()]||(e.outputs[t.id()]=[]),e.outputs[t.id()].indexOf(i)<0&&e.outputs[t.id()].push(i))}}resolveInFields(e,t){return this._sourceActivity&&this._sourceActivity.resolveFields(e,t)}referencedFields(e){this._sourceActivity?.referencedFields(e)}exec(){return this._sourceActivity?this._sourceActivity.exec():Promise.resolve()}_emptyData=[];inData(){return this._sourceActivity&&this._sourceActivity.outData()||this._emptyData}computeData(){return this.inData()}_prevDataHash="";_prevInData=[];_prevData=[];cachedComputeData(e){const t=this.hash();return this._prevDataHash===t&&this._prevInData===e||(this._prevDataHash=t,this._prevInData=e,this._prevData=s.update(this._prevData,this.computeData())),this._prevData}outData(){return this.cachedComputeData(this.inData())}};f(P,"Activity");let S=P;const L=class _ActivityArray extends S{_activities=[];activities(e){return arguments.length?(this._activities=e,this):this._activities}};f(L,"ActivityArray");let C=L;C.prototype._class+=" ActivityArray";const I=class _ActivityPipeline extends C{activities(e){if(!arguments.length)return super.activities();let t;super.activities(e);for(const i of e)t&&i.sourceActivity(t),t=i;return this}first(){return this.activities()[0]}last(){const e=this.activities();return e[e.length-1]}calcUpdatedGraph(e){return e.updatedBy().map(t=>({from:t,to:e}))}updatedByGraph(){let e=[];for(const t of this.activities())e=e.concat(this.calcUpdatedGraph(t));return e}fetch(e=0,t=Number.MAX_VALUE){return this.exec().then(()=>{const i=this.outData();return 0===e&&i.length<=t?i:i.slice(e,e+t)})}hash(e={}){return s.hashSum({activities:[this.activities().map(e=>e.hash())],...e})}refreshMeta(){return this.last().refreshMeta()}updatedBy(){let e=[];for(const t of this.activities())e=e.concat(t.updatedBy());return e}inFields(){return this.first().inFields()}outFields(){return this.last().outFields()}localFields(){return this.last().localFields()}fieldOrigin(e){return this.last().fieldOrigin(e)}referencedFields(e){this.last().referencedFields(e)}resolveInFields(e,t){this.last().resolveInFields(e,t)}resolveFields(e,t){this.last().resolveFields(e,t)}exec(){return this.last().exec()}outData(){return this.last().outData()}};f(I,"ActivityPipeline");let $=I;$.prototype._class+=" ActivitySequence";const R=class _ActivitySelection extends C{_selection;_monitorHandle;selection(e){return void 0===e?this._selection:(this._monitorHandle&&this._monitorHandle.remove(),this._selection=e,this._monitorHandle=e.monitor((t,i,s)=>{this.broadcast(t,i,s,e)}),this)}hash(e={}){return s.hashSum({selection:this.selection().hash(),...e})}label(){return this.selection().label()}refreshMeta(){return this.selection().refreshMeta()}updatedBy(){return this.selection().updatedBy()}inFields(){return this.selection().inFields()}outFields(){return this.selection().outFields()}localFields(){return this.selection().localFields()}fieldOrigin(e){return this.selection().fieldOrigin(e)}referencedFields(e){this.selection().referencedFields(e)}resolveInFields(e,t){this.selection().resolveInFields(e,t)}resolveFields(e,t){this.selection().resolveFields(e,t)}exec(){return this.selection().exec()}outData(){return this.selection().outData()}};f(R,"ActivitySelection");let E=R;E.prototype._class+=" ActivitySelection";let A=0;const z=class _Datasource extends S{constructor(){super(),this._id="ds_"+ ++A}};f(z,"Datasource");let B=z;const M=class _DatasourceRef extends S{_origDatasource;constructor(){super()}hash(e={}){return super.hash({datasource:this._datasource?this._datasource.hash(e):void 0,...e})}toDDL(){return{id:this.datasource().id()}}};f(M,"DatasourceRef");let j=M;j.prototype._class+=" DatasourceRef",j.prototype.publish("datasource",null,"widget","Datasource Reference",null,{internal:!0}),j.prototype._origDatasource=j.prototype.datasource,j.prototype.datasource=function(e){const t=j.prototype._origDatasource.apply(this,arguments);return void 0!==e&&this.sourceActivity(e),t};const k=class _FormField extends i.PropertyExt{_owner;disableChildField(){return"dataset"!==this.type()}constructor(){super()}toDDL(){return{type:this.type(),id:this.fieldID(),default:this.default(),children:"dataset"===this.type()?this.childFields().map(e=>e.toDDL()):void 0}}fromDDL(e){return this.type(e.type).fieldID(e.id).default(e.default).childFields("dataset"===e.type&&e.children?e.children.map(_FormField.fromDDL):[])}static fromDDL(e){return(new _FormField).fromDDL(e)}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.type()&&!!this.fieldID()}coerceFunc(){switch(this.type()){case"boolean":return e=>!!e;case"number":return e=>+e;case"string":return e=>""+e}return e=>e}calcValue(){return this.value_exists()?this.value():this.default()}};f(k,"FormField");let q=k;const V=class _Form extends B{constructor(){super()}toDDL(){return{type:"form",id:this.id(),fields:this.validFields().map(e=>e.toDDL())}}fromDDL(e,t=!1){return(t?this:this.id(e.id)).formFields(e.fields.map(q.fromDDL)),this}static fromDDL(e,t=!1){return(new _Form).fromDDL(e,t)}validFields(){return this.formFields().filter(e=>e.valid())}hash(e={}){return super.hash({ddl:this.toDDL(),...e})}refreshMeta(){return Promise.resolve()}label(){return"Form"}computeFields(e){const t=this.validFields().map(e=>e.toDDL());return()=>t}exec(){return Promise.resolve()}computeData(){const e={};return this.validFields().forEach(t=>{e[t.fieldID()]=t.calcValue()}),[e]}total(){return 1}};f(V,"Form");let N=V;function T(e){if(s.isArray(e))return"dataset";const t=typeof e;switch(t){case"boolean":case"number":case"string":case"object":return t}return"string"}function O(e,t){const i=[];for(const s in e){const r={type:T(e[s]),id:s};switch(r.type){case"object":for(const e of t){let t=!1;for(const i in e[s]){const i=O(e[s],[e[s]]);r.fields={},i.length&&(i.forEach(e=>r.fields[e.id]=e),t=!0);break}if(t)break}break;case"dataset":for(const e of t)if(e[s]&&e[s].length){r.children=O(e[s][0],e[s]);break}}i.push(r)}return i}N.prototype._class+=" Form",q.prototype.publish("type","string","set","FormField Type",["boolean","number","string","dataset"]),q.prototype.publish("fieldID","","string","FormField Label"),q.prototype.publish("default",null,"any","Default Value",null,{optional:!0}),q.prototype.publish("value",null,"any","Default Value",null,{optional:!0}),q.prototype.publish("childFields",[],"propertyArray","Child Fields",null,{autoExpand:q,disable:f(e=>e.disableChildField(),"disable")}),N.prototype.publish("formFields",[],"propertyArray","Multi Fields",null,{autoExpand:q}),f(T,"fieldType"),f(O,"rowToFields");const W=class _Databomb extends B{_jsonData=[];constructor(){super()}toDDL(e=!1){return{type:"databomb",id:this.id(),format:this.format(),payload:e?void 0:this.payload(),fields:this.validFields().map(e=>e.toDDL())}}fromDDL(e,t=!1){return(t?this:this.id(e.id)).format(e.format).payload(e.payload).databombFields(e.fields.map(q.fromDDL)),this}static fromDDL(e,t=!1){return(new _Databomb).fromDDL(e,t)}validFields(){return this.databombFields().filter(e=>e.valid())}updateJsonData(){try{switch(this.format()){case"csv":this._jsonData=i.csvParse(this.payload());break;case"tsv":this._jsonData=i.tsvParse(this.payload());break;default:this._jsonData=JSON.parse(this.payload())}this.databombFields(this.preCalcFields().map(q.fromDDL))}catch(e){this.databombFields([]),this._jsonData=[]}}hash(e){return super.hash({ddl:this.toDDL(!0),...e})+this.payload()}refreshMeta(){return Promise.resolve()}label(){return"Databomb"}preCalcFields(){return 0===this._jsonData.length?[]:O(this._jsonData[0],this._jsonData)}computeFields(e){return()=>this.validFields().map(e=>e.toDDL())}exec(){return Promise.resolve()}computeData(){const e={};return this.validFields().forEach(t=>{e[t.fieldID()]=t.coerceFunc()}),this._jsonData.map(t=>{const i={};for(const s in e)i[s]=e[s](t[s]);return i})}total(){return this._jsonData.length}};f(W,"Databomb");let H=W;H.prototype._class+=" Databomb",H.prototype.publish("format","json","set","Databomb Format",["json","csv","tsv"]),H.prototype.publish("payload","","string","Databomb array",null,{multiline:!0}),H.prototype.publish("databombFields",[],"propertyArray","Multi Fields",null,{autoExpand:q});const G=H.prototype.format;H.prototype.format=function(e){const t=G.apply(this,arguments);return arguments.length&&this.updateJsonData(),t};const J=H.prototype.payload;H.prototype.payload=function(e){const t=J.apply(this,arguments);return arguments.length&&this.updateJsonData(),t};const U=(new H).id("Empty").payload("[]"),Q=class _DatasourceAdapt{_activity;constructor(e){this._activity=e||U}exec(){return this._activity.refreshMeta().then(()=>this._activity.exec())}id(){return this._activity.id()}hash(e={}){return this._activity.hash(e)}label(){return this._activity.label()}outFields(){return this._activity&&this._activity.outFields?this._activity.outFields():[]}total(){return this._activity?this._activity.outData().length:0}fetch(e,t){return this.exec().then(()=>{const i=this._activity.outData();return 0===e&&i.length<=t?Promise.resolve(i):Promise.resolve(i.slice(e,e+t))})}};f(Q,"DatasourceAdapt");let K=Q;const X=class _ESPResult extends B{constructor(e){super(),this._ec=e,this.samples(this._ec.samples()).sampleSize(this._ec.sampleSize())}_ec;_result;_schema=[];_meta=[];_total;_data=[];hash(e={}){return s.hashSum({samples:this.samples(),sampleSize:this.sampleSize(),...e})}_prevMetaHash;refreshMetaPromise;refreshMeta(){return this._prevMetaHash!==this.hash()&&(this._prevMetaHash=this.hash(),delete this.refreshMetaPromise),this.refreshMetaPromise||(this.refreshMetaPromise=super.refreshMeta().then(()=>{if(this._result=this._createResult(),this._result)return this._result.refresh();throw new Error("No valid result")}).then(e=>{this._total=e.Total,this._schema=e.fields(),this._meta=this._meta&&this._meta.length?this._meta:this._schema.map(F)}).catch(e=>{this._total=0,this._schema=[],this._meta=[]})),this.refreshMetaPromise}responseFields(e){return arguments.length?(this._meta=e,this.refreshMeta(),this):this._meta}computeFields(e){return()=>this.responseFields()}exec(){return this._exec()}_prevExecHash;_exec=s.debounce(()=>this._prevExecHash!==this.hash()?(this._prevExecHash=this.hash(),super.exec().then(()=>this.sample()).then(e=>{this._data=this.fixInt64(e)}).catch(e=>{this._data=[]})):Promise.resolve());inData(){return this._data}computeData(){return this._data}total(){return this._total}async fetch(e,t){return t>this.samples()*this.sampleSize()?this.sample():this._fetch(e,t)}_fetchQ=new s.AsyncOrderedQueue;_fetch(e,t){return this._fetchQ.push(this._result?this._result.fetchRows(e,t).catch(e=>[]):Promise.resolve([]))}sample=s.debounce((e=this.samples(),t=this.sampleSize())=>{const i=[];if(e*t>=this.total())i.push(this._fetch(0,this.total()));else{const s=this.total()-t;for(let r=0;r<e;++r)i.push(this._fetch(Math.floor(r*s/e),t))}return Promise.all(i).then(e=>{let t=[];for(const i of e)t=t.concat(i);return t})})};f(X,"ESPResult");let Y=X;Y.prototype._class+=" ESPResult";const Z=class _WUResult extends Y{_origWu;_origResultName;constructor(e){super(e),this._wu=new ie(this._ec)}url(){return this._wu.url()}wuid(){return this._wu.wuid()}toDDL(){return{type:"wuresult",id:this.id(),url:this._wu.url(),wuid:this.wuid(),outputs:{[this.resultName()]:{fields:this.responseFields()}}}}fromDDL(e,t=!1){return e.outputs[this.resultName()]?this.responseFields(e.outputs[this.resultName()].fields):this}static fromDDL(e,t,i,s,r=!1){return new _WUResult(e).wu(i).resultName(s).fromDDL(t)}_createResult(){if(this._wu.url()&&this.wuid()&&this.resultName())return t.Result.attach({baseUrl:this._wu.url(),hookSend:this._ec.hookSend()},this.wuid(),this.resultName())}sourceHash(){return super.hash({wuid:this.wuid()})}hash(e){return super.hash({ddl:this.toDDL()})}label(){return`${this.wuid()}\n${this.resultName()}`}};f(Z,"WUResult");let ee=Z;ee.prototype._class+=" WUResult";const te=class _WU extends B{constructor(e){super(),this._ec=e}_ec;_origUrl;_origWuid;_workunit;_outputs={};toDDL(){const e={};for(const t in this._outputs)e[t]={fields:this._outputs[t].responseFields()};return{type:"wuresult",id:this.id(),url:this.url(),wuid:this.wuid(),outputs:e}}fromDDL(e,t=!1){(t?this:this.id(e.id)).url(e.url).wuid(e.wuid);const i={};for(const s in e.outputs)i[s]=ee.fromDDL(this._ec,e,this,s);return this._outputs=i,this}static fromDDL(e,t,i=!1){return new _WU(e).fromDDL(t,i)}hash(){return s.hashSum({url:this.url(),wuid:this.wuid()})}label(){return this.wuid()}outputs(){const e=[];for(const t in this._outputs)e.push(this._outputs[t]);return e}outputDDL(){const e={};for(const t in this._outputs)e[t]={fields:this._outputs[t].outFields()};return e}output(e){return this._outputs[e]}_prevSourceHash;refreshMetaPromise;_resultNames=[];refreshMeta(){return this.url()&&this.wuid()?(this._prevSourceHash!==this.hash()&&(this._prevSourceHash=this.hash(),delete this.refreshMetaPromise),this.refreshMetaPromise||(this.refreshMetaPromise=super.refreshMeta().then(()=>(this._workunit=t.Workunit.attach({baseUrl:this.url(),hookSend:this._ec.hookSend()},this.wuid()),this._workunit.fetchResults())).then(e=>{this._resultNames=e.map(e=>e.Name)}).catch(e=>{})),this.refreshMetaPromise):Promise.resolve()}resultNames(){return this._resultNames}};f(te,"WU");let ie=te;ie.prototype._class+=" WU";const se=class _WUResultRef extends j{datasource(e){return super.datasource.apply(this,arguments)}resultName(e){return arguments.length?(this.datasource().resultName(e),this):this.datasource().resultName()}toDDL(){return{id:this.datasource().wu().id(),output:this.resultName()}}};f(se,"WUResultRef");let re=se;re.prototype._class+=" WUResultRef",Y.prototype.publish("samples",10,"number","Number of samples"),Y.prototype.publish("sampleSize",100,"number","Sample size"),ee.prototype.publish("wu",null,"widget","Workunit"),ee.prototype.publish("resultName","","set","Result Name",function(){return void 0!==this._wu?this._wu.resultNames():[]}),ee.prototype._origWu=ee.prototype.wu,ee.prototype.wu=function(e){const t=ee.prototype._origWu.apply(this,arguments);return void 0!==e&&this._wu.refreshMeta(),t},ee.prototype._origResultName=ee.prototype.resultName,ee.prototype.resultName=function(e){const t=this._resultName,i=ee.prototype._origResultName.apply(this,arguments);return void 0!==e&&t!==e&&this.responseFields([]),i},ie.prototype.publish("url","","string","ESP Url (http://x.x.x.x:8010)"),ie.prototype.publish("wuid","","string","Workunit ID"),ie.prototype._origUrl=ie.prototype.url,ie.prototype.url=function(e){const t=ie.prototype._origUrl.apply(this,arguments);return void 0!==e&&this.refreshMeta(),t},ie.prototype._origWuid=ie.prototype.wuid,ie.prototype.wuid=function(e){const t=ie.prototype._origWuid.apply(this,arguments);return void 0!==e&&this.refreshMeta(),t};const ae=class _LogicalFile extends Y{constructor(e){super(e)}toDDL(){return{type:"logicalfile",id:this.id(),url:this.url(),logicalFile:this.logicalFile(),fields:this.responseFields()}}fromDDL(e,t=!1){return(t?this:this.id(e.id)).url(e.url).logicalFile(e.logicalFile),this}static fromDDL(e,t,i=!1){return new _LogicalFile(e).fromDDL(t,i)}_createResult(){return t.Result.attachLogicalFile({baseUrl:this.url(),hookSend:this._ec.hookSend()},this.nodeGroup(),this.logicalFile())}sourceHash(){return super.hash({logicalFile:this.logicalFile()})}hash(e){return super.hash({ddl:this.toDDL()})}label(){return`${this.logicalFile()}`}};f(ae,"LogicalFile");let oe=ae;oe.prototype._class+=" LogicalFile",oe.prototype.publish("url","","string","ESP Url (http://x.x.x.x:8010)"),oe.prototype.publish("nodeGroup","","string","Node Group"),oe.prototype.publish("logicalFile","","string","Logical File Name");const ne=class _RestField extends i.PropertyExt{_owner;constructor(){super()}toDDL(){return{type:"string",id:this.fieldID()}}fromDDL(e){return this.fieldID(e.id)}static fromDDL(e){return(new _RestField).fromDDL(e)}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.fieldID()}};f(ne,"RestField");let le=ne;const he=class _RestService extends B{constructor(e){super(),this._ec=e}_ec;_responseFields={};toDDL(){return{type:"rest",id:this.id(),url:this.url(),action:this.action(),mode:this.mode(),inputs:this.validRequestFields().map(e=>e.toDDL()),outputs:this.outputDDL()}}fromDDL(e,t=!1){(t?this:this.id(e.id)).url(e.url).action(e.action).mode(e.mode||"get").requestFields(e.inputs.map(le.fromDDL));for(const i in e.outputs)this.responseFields(i,e.outputs[i].fields);return this}static fromDDL(e,t,i=!1){return new _RestService(e).fromDDL(t,i)}hash(e={}){return s.hashSum({url:this.url(),action:this.action(),mode:this.mode(),...e})}label(){return this.action()}responseFields(e,t){return 1===arguments.length?this._responseFields[e]||[]:(this._responseFields[e]=t,this)}validRequestFields(){return this.requestFields().filter(e=>e.valid())}_prevRequestHash;_prevPromise;_submitQ=new s.AsyncOrderedQueue;submit(e){const i=s.hashSum(e);if(!this._prevPromise||this._prevRequestHash!==i){this._prevRequestHash=i;const s=t.createConnection({baseUrl:this.url(),type:this.mode()});this._prevPromise=this._submitQ.push(s.send(this.action(),e))}return this._prevPromise}resultNames(){const e=[];for(const t in this._responseFields)e.push(t);return e}outputDDL(){const e={};return this.resultNames().forEach(t=>{e[t]={fields:this._responseFields[t]}}),e}};f(he,"RestService");let ue=he;ue.prototype._class+=" RestService";const ce=class _RestResult extends B{constructor(e){super(),this._ec=e,this._service=new ue(this._ec)}_ec;_origService;validRequestFields(){return this.service().validRequestFields()}toDDL(){return this.service().toDDL()}fromDDL(e){return this.service().fromDDL(e),this}static fromDDL(e,t,i){return new _RestResult(e).id(`${t.id()}_${i}`).service(t).resultName(i)}serviceID(){return`${this.service().url()}/${this.service().action()}}`}sourceHash(){return this.service().hash()}requestFields(){return this.service().requestFields().map(e=>e.toDDL())}responseFields(e){return arguments.length?(this.service().responseFields(this.resultName(),e),this):this.service().responseFields(this.resultName())}hash(e={}){return s.hashSum({source:this.sourceHash(),resultName:this.resultName(),...e})}label(){return`${this.service().label()}\n${this.resultName()}`}_jsonData=[];jsonDataFields(){if(!this._jsonData||!this._jsonData.length)return[];const e=O(this._jsonData[0],this._jsonData);return this.responseFields(e),e}computeFields(e){return()=>this.jsonDataFields()}computeData(){return this._jsonData}submit(e){return this.service().submit(e).then(e=>{const t=this.resultName(),i=t?t.split("."):[];for(const s of i)e=(e||{})[s];return this._jsonData=e,e})}formatRequest(){const e={};return this.service().validRequestFields().forEach(t=>{e[t.fieldID()]=""}),e}exec(){return this.submit(this.formatRequest()).then(e=>{})}};f(ce,"RestResult");let de=ce;de.prototype._class+=" RestResult";const pe=class _Param extends i.PropertyExt{constructor(e){super(),this._ec=e}_ec;validate(e){const t=[];return this.source_valid()||t.push({source:`${e}.source.${this.source()}`,msg:`Invalid source: "${this.source()}"`,hint:`expected: ${JSON.stringify(this.visualizationIDs())}`}),this.remoteField_valid()||t.push({source:`${e}.remoteField`,msg:`Invalid remoteField: "${this.remoteField()}"`,hint:`expected: ${JSON.stringify(this.sourceOutFields())}`}),this.value_valid()||t.push({source:`${e}.value`,msg:`Invalid value: "${this.value()}"`,hint:"expected: any value."}),t}toDDL(){return{source:this.source(),remoteFieldID:this.remoteField(),localFieldID:this.localField(),value:this.value()}}fromDDL(e){return this.source(e.source).remoteField(e.remoteFieldID).localField(e.localFieldID).value(e.value)}static fromDDL(e,t){return new _Param(e).fromDDL(t)}hash(){return s.hashSum({label:this.localField(),source:this.source(),sourceField:this.remoteField()})}visualizationIDs(){return this._ec.elementIDs()}sourceFields(){return this.sourceOutFields().map(e=>e.id)}sourceViz(){return this._ec.element(this.source())}sourceOutFields(){return this.sourceViz().hipiePipeline().selectionFields()}sourceSelection(){return this.sourceViz().selection()}calcValue(){if(this.source_exists()&&this.remoteField_exists()){return this.sourceSelection().map(e=>e[this.remoteField()])}return this.value_exists()?[this.value()]:[""]}exists(){return this.localField_exists()&&(this.source_exists()&&this.remoteField_exists()||this.value_exists())}};f(pe,"Param");let me=pe;me.prototype._class+=" Param";const _e=class _RestResultRef extends j{constructor(e){super(),this._ec=e}_ec;serviceID(){return this.datasource().serviceID()}_data=[];datasource(e){return super.datasource.apply(this,arguments)}url(){return this.datasource().service().url()}action(){return this.datasource().service().action()}resultName(){return this.datasource().resultName()}validate(){let e=[];for(const t of this.validParams())e=e.concat(t.validate("request"));return e}toDDL(){return{id:this.datasource().service().id(),output:this.resultName(),request:this.validParams().map(e=>({source:e.source(),remoteFieldID:e.remoteField(),localFieldID:e.localField(),value:e.value()}))}}sourceHash(){return this.datasource().hash()}requestFieldRefs(e){return arguments.length?(this.request(e.map(e=>me.fromDDL(this._ec,e))),this):this.validParams().map(e=>e.toDDL())}requestFields(){return this.datasource().requestFields()}responseFields(){return this.datasource().responseFields()}hash(){return this.datasource().hash({resultName:this.resultName(),request:this.formatRequest()})}label(){return`${this.datasource().label()}\n${this.datasource().resultName()}`}elementIDs(){return this._ec.elementIDs()}element(e){return this._ec.element(e)}referencedFields(e){super.referencedFields(e);for(const t of this.validParams()){const i=t.sourceViz().hipiePipeline();e.inputs[this.id()]||(e.inputs[this.id()]=[]),e.inputs[this.id()].push(t.localField()),i.resolveFields(e,[t.remoteField()])}super.resolveFields(e,[])}validParams(){return this.request().filter(e=>e.exists())}refreshMeta(){return this.datasource().refreshMeta().then(()=>{const e=this.request(),t=s.compare(e.map(e=>e.localField()),this.datasource().validRequestFields().map(e=>e.fieldID())),i=e.filter(e=>t.update.indexOf(e.localField())>=0);this.request(i.concat(t.enter.map(e=>new me(this._ec).localField(e))))})}updatedBy(){return this.validParams().map(e=>e.source())}computeFields(e){return this.datasource().computeFields(e)}formatRequest(){const e=this.datasource().formatRequest();return this.request().forEach(t=>{void 0!==e[t.localField()]&&(e[t.localField()]=t.calcValue()||e[t.localField()])}),e}_prevRequestHash;_prevRequestPromise;exec(){const e=this.formatRequest(),t=s.hashSum({hash:this.hash(),request:e});return this._prevRequestHash!==t&&(this._prevRequestHash=t,this._prevRequestPromise=this.datasource().submit(e).then(e=>(this._data=this.fixInt64(e),this._data))),this._prevRequestPromise}inData(){return this._data}computeData(){return this._data}};f(_e,"RestResultRef");let fe=_e;function De(e){const t=e.split("/WsEcl/submit/query/");if(t.length<2)throw new Error(`Invalid roxie URL: ${e}`);const i=t[0].split(":");if(i.length<3)throw new Error(`Invalid roxie URL: ${e}`);const s=t[1].split("/");if(s.length<2)throw new Error(`Invalid roxie URL: ${e}`);return{url:`${i[0]}:${i[1]}:${"18002"===i[2]?"18010":"8010"}`,querySet:s[0],queryID:s[1]}}function ve(e){return e.length>=8&&e.indexOf("_changed")===e.length-8}function ge(e){return e.length>=8&&e.indexOf("_changed")===e.length-8||["HIPIE_DDL","HIPIE_DDLGLOBALS","hipieversion"].indexOf(e)>=0}fe.prototype._class+=" RestResultRef",le.prototype.publish("fieldID","","string","RestField Label"),ue.prototype.publish("url","","string","REST Url"),ue.prototype.publish("action","","string","Query Set"),ue.prototype.publish("mode","get","set","Request mode",["get","post"]),ue.prototype.publish("requestFields",[],"propertyArray","Multi Fields",null,{autoExpand:le}),de.prototype.publish("service",null,"widget","Rest service"),de.prototype.publish("resultName","","string","Result Name"),de.prototype._origService=de.prototype.service,de.prototype.service=function(e){const t=de.prototype._origService.apply(this,arguments);return void 0!==e&&this._service.refreshMeta(),t},me.prototype.publish("localField",null,"string","Label"),me.prototype.publish("source",null,"set","Activity",function(){return this.visualizationIDs()},{optional:!0,disable:f(e=>e.value_exists(),"disable"),validate:f(e=>e.source_disabled()||e.visualizationIDs().indexOf(e.source())>=0,"validate")}),me.prototype.publish("remoteField",null,"set","Source Field",function(){return this.sourceFields()},{optional:!0,disable:f(e=>!e.source_exists()||e.value_exists(),"disable"),validate:f(e=>e.remoteField_disabled()||e.sourceFields().indexOf(e.remoteField())>=0,"validate")}),me.prototype.publish("value",null,"string","Static Value",null,{optional:!0,disable:f(e=>e.source_exists(),"disable"),validate:f(e=>e.value_disabled()||e.value_exists(),"validate")}),fe.prototype.publish("request",[],"propertyArray","Request Fields"),f(De,"parseUrl"),f(ve,"isHipieRequest"),f(ge,"isHipieResponse");const ye=class _RoxieService extends B{constructor(e){super(),this._ec=e}_ec;_query;_requestFields;_responseFields={};_type="roxie";toDDL(){return{type:this._type,id:this.id(),url:this.url(),querySet:this.querySet(),queryID:this.queryID(),inputs:this.requestFields(),outputs:this.outputDDL()}}fromDDL(e,t=!1){this._type=e.type,(t?this:this.id(e.id)).url(e.url).querySet(e.querySet).queryID(e.queryID),e.inputs&&e.inputs.length&&this.requestFields(e.inputs);for(const i in e.outputs)this.responseFields(i,e.outputs[i].fields);return this}static fromDDL(e,t,i=!1){return new _RoxieService(e).fromDDL(t,i)}hash(e={}){return s.hashSum({url:this.url(),querySet:this.querySet(),queryId:this.queryID(),ignoreHipieRequest:this.ignoreHipieRequest(),ignoreHipieResponse:this.ignoreHipieResponse(),...e})}label(){return this.queryID()}_prevSourceHash;refreshMetaPromise;refreshMeta(){if(this._prevSourceHash!==this.hash()&&(this._prevSourceHash=this.hash(),delete this.refreshMetaPromise),!this.refreshMetaPromise){const e=!!this._requestFields;this.refreshMetaPromise=new Promise((i,s)=>{const r=t.Query.attach({baseUrl:this.url(),hookSend:this._ec.hookSend()},this.querySet(),this.queryID());(!e||this.ignoreHipieRequest()||this.ignoreHipieResponse())&&i(r.refresh()),i(r)}).then(t=>{this._query=t,e&&!this.ignoreHipieRequest()||(this._requestFields=t.requestFields().filter(e=>"roxie"===this._type||!ve(e.id))),e&&!this.ignoreHipieResponse()||t.resultNames().filter(e=>"roxie"===this._type||!ge(e)).forEach(e=>{this._responseFields[e]=t.resultFields(e)})})}return this.refreshMetaPromise}requestFields(e){return arguments.length?(this._requestFields=e,this):this._requestFields||[]}responseFields(e,t){return 1===arguments.length?this._responseFields[e]||[]:(this._responseFields[e]=t,this)}_prevRequestHash;_prevPromise;_submitQ=new s.AsyncOrderedQueue;submit(e){const t=s.hashSum(e);return this._prevPromise&&this._prevRequestHash===t||(this._prevRequestHash=t,this._prevPromise=this._submitQ.push(this._query.submit(e))),this._prevPromise}resultNames(){const e=[];for(const t in this._responseFields)e.push(t);return e}outputDDL(){const e={};return this.resultNames().forEach(t=>{e[t]={fields:this._responseFields[t]}}),e}};f(ye,"RoxieService");let be=ye;be.prototype._class+=" RoxieService",be.prototype.publish("url","","string","ESP Url (http://x.x.x.x:8002)"),be.prototype.publish("querySet","","string","Query Set"),be.prototype.publish("queryID","","string","Query ID"),be.prototype.publish("ignoreHipieRequest",!1,"boolean","Ignore provided DDL request"),be.prototype.publish("ignoreHipieResponse",!1,"boolean","Ignore provided DDL response");const we=class _RoxieResult extends B{constructor(e){super(),this._ec=e,this._service=new be(this._ec)}_ec;_origService;toDDL(){return this.service().toDDL()}fromDDL(e){return this.service().fromDDL(e),this}static fromDDL(e,t,i){return new _RoxieResult(e).id(`${t.id()}_${i}`).service(t).resultName(i)}serviceID(){return`${this.service().url()}/${this.service().querySet()}/${this.service().queryID()}`}sourceHash(){return this.service().hash()}requestFields(){return this.service().requestFields()}responseFields(e){return arguments.length?(this.service().responseFields(this.resultName(),e),this):this.service().responseFields(this.resultName())}hash(e={}){return s.hashSum({source:this.sourceHash(),resultName:this.resultName(),...e})}label(){return`${this.service().label()}\n${this.resultName()}`}computeFields(e){return()=>this.service().responseFields(this.resultName())}refreshMeta(){return this.service().refreshMeta()}submit(e){return this.service().submit(e)}};f(we,"RoxieResult");let Fe=we;Fe.prototype._class+=" RoxieResult",Fe.prototype.publish("service",null,"widget","Roxie service"),Fe.prototype.publish("resultName","","set","Result Name",function(){return void 0!==this._service?this._service.resultNames():[]}),Fe.prototype._origService=Fe.prototype.service,Fe.prototype.service=function(e){const t=Fe.prototype._origService.apply(this,arguments);return void 0!==e&&this._service.refreshMeta(),t};const xe=class _RoxieResultRef extends j{constructor(e){super(),this._ec=e}_ec;serviceID(){return this.datasource().serviceID()}_data=[];datasource(e){return super.datasource.apply(this,arguments)}url(){return this.datasource().service().url()}querySet(){return this.datasource().service().querySet()}queryID(){return this.datasource().service().queryID()}resultName(){return this.datasource().resultName()}validate(){let e=[];for(const t of this.validParams())e=e.concat(t.validate("request"));return e}toDDL(){return{id:this.datasource().service().id(),output:this.resultName(),request:this.validParams().map(e=>({source:e.source(),remoteFieldID:e.remoteField(),localFieldID:e.localField(),value:e.value()}))}}sourceHash(){return this.datasource().hash()}requestFieldRefs(e){return arguments.length?(this.request(e.map(e=>me.fromDDL(this._ec,e))),this):this.validParams().map(e=>e.toDDL())}requestFields(){return this.datasource().requestFields()}responseFields(){return this.datasource().responseFields()}hash(){return this.datasource().hash({resultName:this.resultName(),params:this.request().map(e=>e.hash()),request:this.formatRequest()})}label(){return`${this.datasource().label()}\n${this.datasource().resultName()}`}elementIDs(){return this._ec.elementIDs()}element(e){return this._ec.element(e)}referencedFields(e){super.referencedFields(e);const t=[];for(const i of this.validParams()){t.push(i.localField());const s=i.sourceViz().hipiePipeline();e.inputs[this.id()]||(e.inputs[this.id()]=[]),e.inputs[this.id()].push(i.localField()),s.resolveFields(e,[i.remoteField()])}super.resolveFields(e,t)}validParams(){return this.request().filter(e=>e.exists())}refreshMeta(){return this.datasource().refreshMeta().then(()=>{const e=this.request(),t=s.compare(e.map(e=>e.localField()),this.datasource().requestFields().map(e=>e.id)),i=e.filter(e=>t.update.indexOf(e.localField())>=0);this.request(i.concat(t.enter.map(e=>new me(this._ec).localField(e))))})}updatedBy(){return this.validParams().map(e=>e.source())}computeFields(e){return()=>this.datasource().responseFields()}formatRequest(){const e={};let t=!1;const i=this.datasource().requestFields();for(const s of this.validParams()){const r=s.calcValue();let a;a="set"===i.filter(e=>e.id===s.localField())[0].type?{Item:r}:r[0],void 0!==a&&(e[s.localField()]=a),t=!0}return t||(e.refresh=!0),e}_prevRequestHash;_prevRequestPromise;exec(){return super.exec().then(()=>{const e=this.formatRequest(),t=s.hashSum({hash:this.hash(),request:e});return this._prevRequestHash!==t&&(this._prevRequestHash=t,this._prevRequestPromise=this.datasource().submit(e).then(e=>{const t=this.datasource().resultName();let i=e[t];return i||(i=e[t.toLowerCase().replace(/ /g,"_")]),this.fixInt64(i)})),this._prevRequestPromise}).then(e=>{this._data=e})}inData(){return this._data}computeData(){return this._data}};f(xe,"RoxieResultRef");let Pe=xe;Pe.prototype._class+=" RoxieResultRef",Pe.prototype.publish("request",[],"propertyArray","Request Fields");const Se=class _HipieResultRef extends Pe{fullUrl(e){const t=De(e);return this.datasource().service().url(t.url),this.datasource().service().querySet(t.querySet),this.datasource().service().queryID(t.queryID),this}formatRequest(){const e=super.formatRequest(),t={};for(const i in e)t[i]=e[i],t[`${i}_changed`]=!0;return t}};f(Se,"HipieResultRef");let Le=Se;Le.prototype._class+=" HipieResultRef";let Ce=0;const Ie=class _DSPicker extends E{constructor(e){super(),this._ec=e,this._id="ds_"+ ++Ce;const t=this._ec.datasources()[0];this.datasourceID(t.id())}_ec;_nullDatasource=U;_origDatasourceID;_origDatasourceRef;datasource(){return this.datasourceRef().datasource()}refreshRef(e){const t=this._ec.datasource(e);t instanceof H||t instanceof N||t instanceof oe||t instanceof be?this.selection((new j).datasource(t)):t instanceof ee?this.selection((new re).datasource(t)):t instanceof Fe?this.selection(new Le(this._ec).datasource(t)):t instanceof de&&this.selection(new fe(this._ec).datasource(t))}selection(e){const t=super.selection.apply(this,arguments);return arguments.length?(this._datasourceID!==e.datasource().id()&&(this._datasourceID=e.datasource().id()),this):t||this._nullDatasource}validate(){return this.selection().validate()}toDDL(){return{...this.datasourceRef().toDDL(),id:this.datasourceID()}}hash(e={}){return super.hash({...e})}datasourceIDs(){return this._ec.datasources().map(e=>({value:e.id(),text:`${e.label()} ${e.id()!==e.label()?` (${e.id()})`:""}`}))}};f(Ie,"DSPicker");let $e=Ie;function Re(e,t,i){const s="string"==typeof i;switch(e){case"==":return e=>s&&"string"==typeof e[t]?e[t].trim()===i:e[t]===i;case"!=":return e=>s&&"string"==typeof e[t]?e[t].trim()!==i:e[t]!==i;case"<":return e=>e[t]<i;case"<=":return e=>e[t]<=i;case">":return e=>e[t]>i;case">=":return e=>e[t]>=i;default:throw new Error(`Unknown filter condition: ${e}`)}}$e.prototype._class+=" DSPicker",$e.prototype.publish("datasourceID","","set","Activity",function(){return this.datasourceIDs()},{optional:!1}),$e.prototype.publish("datasourceRef","","widget","Activity"),$e.prototype._origDatasourceID=$e.prototype.datasourceID,$e.prototype.datasourceID=function(e){const t=this._datasourceID,i=$e.prototype._origDatasourceID.apply(this,arguments);return void 0!==e&&t!==e&&this.refreshRef(e),i},$e.prototype._origDatasourceRef=$e.prototype.datasourceRef,$e.prototype.datasourceRef=function(e){return E.prototype.selection.apply(this,arguments)},f(Re,"createFilter");const Ee=class _ColumnMapping extends i.PropertyExt{_owner;validate(e){const t=[];return this.remoteField_valid()||t.push({source:`${e}.remoteField`,msg:`Invalid remoteField: "${this.remoteField()}"`,hint:`expected: ${JSON.stringify(this.sourceOutFields())}`}),this.localField_valid()||t.push({source:`${e}.localField`,msg:`Invalid localField: "${this.localField()}"`,hint:`expected: ${JSON.stringify(this.localFields())}`}),t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return this.localField_exists()||this.remoteField_exists()}toDDL(){return{remoteFieldID:this.remoteField(),localFieldID:this.localField(),condition:this.condition(),nullable:this.nullable()}}fromDDL(e){return this.remoteField(e.remoteFieldID).localField(e.localFieldID).condition(e.condition).nullable(e.nullable)}static fromDDL(e){return(new _ColumnMapping).fromDDL(e)}hash(){return s.hashSum({remoteField:this.remoteField(),localField:this.localField(),condition:this.condition(),nullable:this.nullable()})}localFields(){return this._owner.inFields().map(e=>e.id)}sourceOutFields(){return this._owner.sourceOutFields().map(e=>e.id)}remoteValues(e){const t=this.remoteField();return e.map(e=>{const i=e[t];return"string"==typeof i?i.trim():i})}createFilterDescription(e){switch(this.condition()){case"in":case"range":return`${this.localField()} ${this.condition()} [${this.remoteValues(e).join(", ")}]`;default:return`${this.localField()} ${this.condition()} ${this.remoteValues(e)[0]}`}}createFilter(e){const t=this.localField(),i=this.remoteValues(e);switch(this.condition()){case"range":return this.nullable()&&(i.length<2||i[0]===i[1])?e=>!0:e=>e[t]>=i[0]&&e[t]<=i[1];case"in":return this.nullable()&&0===i.length?e=>!0:e=>i.some(i=>"string"==typeof e[t]?e[t].trim()===i:e[t]===i);default:const e=i[0];return!this.nullable()||null!=e&&""!==e?Re(this.condition(),t,e):e=>!0}}};f(Ee,"ColumnMapping");let Ae=Ee;Ae.prototype._class+=" ColumnMapping";const ze=class _RemoteFilter extends i.PropertyExt{_owner;validate(e){let t=[];this.source_valid()||t.push({source:`${e}.source.${this.source()}`,msg:`Invalid source: "${this.source()}"`,hint:`expected: ${JSON.stringify(this.visualizationIDs())}`}),this.source_exists()&&0===this.validMappings().length&&t.push({source:`${e}.source.${this.source()}`,msg:`Invalid mappings: "${this.source()}"`,hint:"expected minimum of 1 mapping"});for(const i of this.validMappings())t=t.concat(i.validate(`${e}.${this.source()}.mappings`));return t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.source()&&this.validMappings().length>0}toDDL(){return{viewID:this.source(),mappings:this.ddlMappings()}}fromDDL(e){return this.source(e.viewID).ddlMappings(e.mappings)}static fromDDL(e){return(new _RemoteFilter).fromDDL(e)}ddlMappings(e){return arguments.length?(this.mappings(e.map(e=>Ae.fromDDL(e))),this):this.validMappings().map(e=>e.toDDL())}visualizationIDs(){return this._owner.visualizationIDs()}hash(){return s.hashSum({source:this.source(),mappings:this.validMappings().map(e=>e.hash()),selection:this.sourceSelection()})}validMappings(){return this.mappings().filter(e=>e.valid())}appendMappings(e){for(const t of e)this.mappings().push((new Ae).owner(this).remoteField(t.remoteField).localField(t.localField).condition(t.condition));return this}inFields(){return this._owner.inFields()}sourceViz(){return this._owner.visualization(this.source())}sourceOutFields(){return this.sourceViz().hipiePipeline().selectionFields()}sourceSelection(){return this.sourceViz().selection()}createFilter(){const e=this.sourceSelection(),t=this.validMappings().map(t=>t.createFilter(e));return e=>t.every(t=>t(e))}createFilterDescription(){const e=this.sourceSelection();return this.validMappings().map(t=>t.createFilterDescription(e)).join(", ")}};f(ze,"RemoteFilter");let Be=ze;Be.prototype._class+=" Filter";const Me=class _StaticFilter extends i.PropertyExt{_owner;validate(e){const t=[];return this.localField_valid()||t.push({source:`${e}.localField`,msg:`Invalid localField: "${this.localField()}"`,hint:`expected: ${JSON.stringify(this.localFields())}`}),t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}coerceValue(e){return 0===arguments.length?"number"===this.valueType()?+this.value():""+this.value():(this.value(e),"number"==typeof e?this.valueType("number"):this.valueType("string"),this)}valid(){return this.localField_exists()&&this.value_exists()}toDDL(){return{localFieldID:this.localField(),condition:this.condition(),value:this.coerceValue()}}fromDDL(e){return this.localField(e.localFieldID).condition(e.condition).coerceValue(e.value)}static fromDDL(e){return(new _StaticFilter).fromDDL(e)}hash(){return s.hashSum({localField:this.localField(),condition:this.condition(),value:this.value(),valueType:this.valueType()})}localFields(){return this._owner.inFields().map(e=>e.id)}createFilterDescription(){return`${this.localField()} ${this.condition()} ${this.coerceValue()}`}createFilter(){return Re(this.condition(),this.localField(),this.coerceValue())}};f(Me,"StaticFilter");let je=Me;je.prototype._class+=" StaticFilter";const ke=class _Filters extends S{constructor(e){super(),this._ec=e}_ec;validate(){let e=[];for(const t of this.validFilters())e=e.concat(t.validate("filter"));return e}toDDL(){return{type:"filter",conditions:this.conditions()}}fromDDL(e){return this.conditions(e.conditions)}static fromDDL(e,t){return new _Filters(e).fromDDL(t)}conditions(e){if(!arguments.length)return this.validFilters().map(e=>e.toDDL());const t=[],i=[];return e.forEach(e=>{r.DDL2.isIFilterCondition(e)?t.push(Be.fromDDL(e)):i.push(je.fromDDL(e))}),this.remoteFilter(t),this.staticFilter(i),this}visualizationIDs(){return this._ec.elementIDs()}visualization(e){return this._ec.element(e)}hash(){return s.hashSum(this.validFilters().map(e=>({filter:e.hash()})))}exists(){return this.validFilters().length>0}updatedBy(){return this.validRemoteFilters().map(e=>e.source())}referencedFields(e){super.referencedFields(e);const t=[];for(const i of this.validRemoteFilters()){const s=i.sourceViz().hipiePipeline(),r=[];for(const e of i.validMappings())t.push(e.localField()),r.push(e.remoteField());s.resolveFields(e,r)}super.resolveInFields(e,t)}exec(){return super.exec()}computeData(){const e=super.computeData();if(0===e.length||!this.exists())return e;const t=this.validFilters().map(e=>e.createFilter());return e.filter(e=>t.every(t=>t(e)))}validRemoteFilters(){return this.remoteFilter().filter(e=>e.valid())}validStaticFilters(){return this.staticFilter().filter(e=>e.valid())}validFilters(){return[...this.validRemoteFilters(),...this.validStaticFilters()]}};f(ke,"Filters"),D(ke,"Filter",Be),D(ke,"Mapping",Ae);let qe=ke;qe.prototype._class+=" Filters",Ae.prototype.publish("remoteField",null,"set","Filter Fields",function(){return this.sourceOutFields()},{optional:!0,disable:f(e=>!e._owner.source(),"disable"),validate:f(e=>e.sourceOutFields().indexOf(e.remoteField())>=0,"validate")}),Ae.prototype.publish("localField",null,"set","Local Fields",function(){return this.localFields()},{optional:!0,disable:f(e=>!e._owner.source(),"disable"),validate:f(e=>e.localFields().indexOf(e.localField())>=0,"validate")}),Ae.prototype.publish("condition","==","set","Filter Fields",["==","!=",">",">=","<","<=","range","in"]),Ae.prototype.publish("nullable",!1,"boolean","Ignore null filters"),Be.prototype.publish("source",null,"set","Activity",function(){return this.visualizationIDs()},{optional:!0,validate:f(e=>e.visualizationIDs().indexOf(e.source())>=0,"validate")}),Be.prototype.publish("mappings",[],"propertyArray","Mappings",null,{autoExpand:Ae}),je.prototype.publish("localField",null,"set","Local Fields",function(){return this.localFields()},{optional:!0,validate:f(e=>e.localFields().indexOf(e.localField())>=0,"validate")}),je.prototype.publish("condition","==","set","Filter Fields",["==","!=",">",">=","<","<="]),je.prototype.publish("value","","any","Static Value"),je.prototype.publish("valueType","number","set","Static Value Type",["number","string"]),qe.prototype.publish("remoteFilter",[],"propertyArray","Remote Filter",null,{autoExpand:Be}),qe.prototype.publish("staticFilter",[],"propertyArray","Static Filter",null,{autoExpand:je});const Ve=class _GroupByColumn extends i.PropertyExt{_owner;validate(e){const t=[];return this.label_valid()||t.push({source:`${e}.label`,msg:`Invalid label: "${this.label()}"`,hint:`expected ${JSON.stringify(this.columns())}`}),t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.label()}toDDL(){return this.label()}fromDDL(e){return this.label(e)}static fromDDL(e){return(new _GroupByColumn).fromDDL(e)}hash(){return s.hashSum(this.label())}columns(){return this._owner.inFieldIDs()}};f(Ve,"GroupByColumn");let Ne=Ve;function Te(e,t){return e.length}Ne.prototype._class+=" GroupByColumn",f(Te,"localCount");const Oe={count:Te,min:i.min,max:i.max,mean:i.mean,median:i.median,variance:i.variance,deviation:i.deviation,sum:i.sum},We=class _AggregateField extends i.PropertyExt{_owner;disableAggrColumn(){return!this.fieldID()||!this.aggrType()||"count"===this.aggrType()}disableBaseCountColumn(){return!this.fieldID()||!this.aggrType()||"mean"!==this.aggrType()}validate(e){const t=[];return this.aggrColumn_valid()||t.push({source:`${e}.${this.fieldID()}.aggrColumn`,msg:`Invalid aggrColumn: "${this.aggrColumn()}"`,hint:`expected ${JSON.stringify(this.columns())}`}),this.baseCountColumn_valid()||t.push({source:`${e}.${this.fieldID()}.aggrColumn`,msg:`Invalid baseCountColumn: "${this.baseCountColumn()}"`,hint:`expected ${JSON.stringify(this.columns())}`}),t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.fieldID()}toDDL(){return"count"===this.aggrType()?{fieldID:this.fieldID(),type:"count"}:{fieldID:this.fieldID(),type:this.aggrType(),inFieldID:this.aggrColumn(),baseCountFieldID:this.baseCountColumn()}}fromDDL(e){const t=this.fieldID(e.fieldID).aggrType(e.type);return"count"!==e.type&&(t.aggrColumn(e.inFieldID),t.baseCountColumn(e.baseCountFieldID)),t}static fromDDL(e){return(new _AggregateField).fromDDL(e)}hash(){return s.hashSum({label:this.fieldID(),aggrType:this.aggrType(),aggrColumn:this.aggrColumn()})}columns(){return this._owner.inFieldIDs()}hasColumn(){return this.columns().length}aggregate(e){return Oe[this.aggrType()](e,e=>+e[this.aggrColumn()])}aggrFunc(){const e=Oe[this.aggrType()],t=this.aggrColumn(),i=this.baseCountColumn();return i?s=>e(s,e=>+e[t]/+e[i]):i=>e(i,e=>+e[t])}};f(We,"AggregateField");let He=We;He.prototype._class+=" AggregateField";const Ge=class _GroupBy extends S{validate(){let e=[];for(const t of this.validGroupBy())e=e.concat(t.validate("GroupBy.column"));for(const t of this.validComputedFields())e=e.concat(t.validate("GroupBy.computedFields"));return e}constructor(){super()}toDDL(){return{type:"groupby",groupByIDs:this.fieldIDs(),aggregates:this.aggregates()}}fromDDL(e){return this.fieldIDs(e.groupByIDs).aggregates(e.aggregates)}static fromDDL(e){return(new _GroupBy).fromDDL(e)}fieldIDs(e){return arguments.length?(this.column(e.map(e=>Ne.fromDDL(e))),this):this.validGroupBy().map(e=>e.toDDL())}aggregates(e){return arguments.length?(this.computedFields(e.map(e=>He.fromDDL(e))),this):this.validComputedFields().map(e=>e.toDDL())}hash(){return s.hashSum({groupBy:this.column().map(e=>e.hash()),computedFields:this.computedFields().map(e=>e.hash())})}appendGroupBys(e){for(const t of e)this.column().push((new Ne).owner(this).label(t.field));return this}validGroupBy(){return this.column().filter(e=>e.valid())}exists(){return this.validGroupBy().length>0}inFieldIDs(){return this.inFields().map(e=>e.id)}field(e){for(const t of this.inFields())if(t.id===e)return t;return null}appendComputedFields(e){for(const t of e){const e=(new He).owner(this).fieldID(t.label).aggrType(t.type);void 0!==t.column&&e.aggrColumn(t.column),this.computedFields().push(e)}return this}validComputedFields(){return this.computedFields().filter(e=>e.valid())}hasComputedFields(){return this.validComputedFields().length>0}computeFields(e){if(!this.exists())return super.computeFields(e);const t=[],i=this.validGroupBy();for(const s of i){const e=this.field(s.label()),i={type:e?e.type:"string",id:s.label()};t.push(i)}for(const s of this.computedFields())if(s.fieldID()){const e={id:s.fieldID(),type:"number"};t.push(e)}if(this.details()){let e=t;if(this.exists()){const i={id:"values",type:"dataset",children:[]};t.push(i),e=i.children}const s=i.map(e=>e.label());e.push(...this.inFields().filter(e=>this.fullDetails()||s.indexOf(e.id)<0))}return()=>t}referencedFields(e){super.referencedFields(e);const t=[];for(const i of this.validGroupBy())t.push(i.label());for(const i of this.validComputedFields())i.aggrColumn()&&t.push(i.aggrColumn());super.resolveInFields(e,t)}computeData(){const e=super.computeData();if(0===e.length||!this.exists())return e;const t=this.validGroupBy().map(e=>e.label()),s=this.validComputedFields().map(e=>({label:e.fieldID(),aggrFunc:e.aggrFunc()})),r=i.nest().key(e=>{let i="";for(const s of t)i+=":"+e[s];return i}).entries(e).map(e=>{const i=e;delete i.key;for(const s of t)i[s]=i.values[0][s];for(const t of s)i[t.label]=t.aggrFunc(i.values);return i}),a=this.outFields();return r.map(e=>{const t={};for(const i of a)t[i.id]=e[i.id];return t})}};f(Ge,"GroupBy");let Je=Ge;Je.prototype._class+=" GroupBy",Ne.prototype.publish("label",void 0,"set","Field",function(){return this.columns()},{optional:!0,validate:f(e=>e.columns().indexOf(e.label())>=0,"validate")}),He.prototype.publish("fieldID",null,"string","new Field ID",null,{optional:!0,disable:f(e=>!e.hasColumn(),"disable")}),He.prototype.publish("aggrType","count","set","Aggregation Type",["count","min","max","sum","mean","median","variance","deviation"],{optional:!0,disable:f(e=>!e.fieldID(),"disable")}),He.prototype.publish("aggrColumn",null,"set","Aggregation Field",function(){return this.columns()},{optional:!0,disable:f(e=>e.disableAggrColumn(),"disable"),validate:f(e=>e.columns().indexOf(e.aggrColumn())>=0,"validate")}),He.prototype.publish("baseCountColumn",null,"set","Base Count Field",function(){return this.columns()},{optional:!0,disable:f(e=>e.disableBaseCountColumn(),"disable"),validate:f(e=>e.columns().indexOf(e.baseCountColumn())>=0,"validate")}),Je.prototype.publish("column",[],"propertyArray","Source Columns",null,{autoExpand:Ne}),Je.prototype.publish("computedFields",[],"propertyArray","Computed Fields",null,{autoExpand:He}),Je.prototype.publish("details",!1,"boolean","Show details"),Je.prototype.publish("fullDetails",!1,"boolean","Show groupBy fileds in details");const Ue=class _Limit extends S{constructor(){super()}toDDL(){return{type:"limit",limit:this.rows()}}fromDDL(e){return this.rows(e.limit)}static fromDDL(e){return(new _Limit).fromDDL(e)}hash(){return s.hashSum({limit:this.rows()})}exists(){return this.rows_exists()&&this.rows()>0}computeData(){const e=super.computeData();return 0!==e.length&&this.exists()?e.slice(0,Math.min(this.rows(),e.length)):e}};f(Ue,"Limit");let Qe=Ue;Qe.prototype._class+=" Limit",Qe.prototype.publish("rows",void 0,"number","Limit output");const Ke=class _ComputedMapping extends i.PropertyExt{_owner;validate(e){const t=[];return this.value_valid()||t.push({source:`${e}.value`,msg:`Invalid value: "${this.value()}"`,hint:'expected: "any"'}),this.newValue_valid()||t.push({source:`${e}.newValue`,msg:`Invalid value: "${this.newValue()}"`,hint:'expected: "any"'}),t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.value()&&!!this.newValue()}toDDL(){return{value:this.value(),newValue:this.newValue()}}fromDDL(e){return this.value(e.value).newValue(e.newValue)}static fromDDL(e){return(new _ComputedMapping).fromDDL(e)}};f(Ke,"ComputedMapping");let Xe=Ke;Xe.prototype._class+=" ComputedMapping";const Ye=class _ComputedField extends i.PropertyExt{_owner;disableColumn1(){return!this.label()||["=","*","/","+","-","scale","map"].indexOf(this.type())<0}disableColumn2(){return!this.label()||["*","/","+","-"].indexOf(this.type())<0}disableMapping(){return!this.label()||["map"].indexOf(this.type())<0}disableChildField(){return!this.hasChildren()}validate(e){const t=[];return this.column1_valid()||t.push({source:`${e}.${this.label()}`,msg:`Invalid column1: "${this.column1()}"`,hint:`expected: ${JSON.stringify(this.columns())}`}),this.column2_valid()||t.push({source:`${e}.${this.label()}`,msg:`Invalid column2: "${this.column2()}"`,hint:`expected: ${JSON.stringify(this.columns())}`}),this.disableMapping()||this.validComputedMappings().forEach(t=>t.validate(`${e}.mapping`)),this.disableChildField()||this.validChildFields().forEach(t=>t.validate(`${e}.childField`)),t}hasChildren(){if(!this.label())return!1;if("="!==this.type())return!1;if(!this.column1())return!1;const e=this._owner.field(this.column1());return!(!e||"dataset"!==e.type||!e.children)}children(){const e=this._owner.field(this.column1());return e&&"dataset"===e.type?e.children:[]}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.label()}validComputedMappings(){return this.mapping().filter(e=>e.valid())}validChildFields(){return this.childField().filter(e=>e.valid())}hasChildFields(){return this.validChildFields().length}toDDL(){switch(this.type()){case"scale":return{fieldID:this.label(),type:"scale",sourceFieldID:this.column1(),factor:this.constValue()};case"template":return{fieldID:this.label(),type:"template",template:this.template()};case"=":const e=this.validChildFields().map(e=>e.toDDL());return{fieldID:this.label(),type:"=",sourceFieldID:this.column1(),transformations:e.length?e:void 0};case"map":return{fieldID:this.label(),type:"map",sourceFieldID:this.column1(),default:this.default(),mappings:this.validComputedMappings().map(e=>e.toDDL())};default:return{fieldID:this.label(),type:this.type(),sourceFieldID1:this.column1(),sourceFieldID2:this.column2()}}}fromDDL(e){const t=this.label(e.fieldID).type(e.type);switch(e.type){case"scale":t.column1(e.sourceFieldID).constValue(e.factor);break;case"template":t.template(e.template);break;case"=":t.column1(e.sourceFieldID).childField(e.transformations?e.transformations.map(e=>_ComputedField.fromDDL(e)):[]);break;case"map":t.column1(e.sourceFieldID).default(e.default).mapping(e.mappings?e.mappings.map(e=>Xe.fromDDL(e)):[]);break;default:t.column1(e.sourceFieldID1).column2(e.sourceFieldID2)}return t}static fromDDL(e){return(new _ComputedField).fromDDL(e)}hash(){return s.hashSum(this.toDDL())}columns(){return this._owner.fieldIDs()}computedField(){switch(this.type()){case"=":let e=this.validChildFields();return 0===e.length&&this.hasChildren()&&(e=this.children().map(e=>(new _ComputedField).owner(this).label(e.id).type("=").column1(e.id))),{...this._owner.field(this.column1()),id:this.label(),children:e.length?e.map(e=>e.computedField()):void 0};case"*":case"/":case"+":case"-":case"scale":return{id:this.label(),type:"number"};case"template":return{id:this.label(),type:"string"};case"map":return{id:this.label(),type:"object"}}return{id:this.label(),type:"string"}}projection(e){const t=this.hasChildFields(),i=this.validChildFields().map(t=>({label:t.label(),func:t.computeFunc(e)}));return s=>{const r=e&&t?{}:{...s};for(const e of i)r[e.label]=e.func(s);return e&&t&&(r.__lparam=s),r}}computeFunc(e){const t=this.column1(),r=this.column2();switch(this.type()){case"=":return this.hasChildFields()?i=>(i[t].Row&&s.isArray(i[t].Row)?i[t].Row:i[t]).map(this.projection(e)):e=>e[t];case"*":return e=>+e[t]*+e[r];case"/":return e=>+e[t]/+e[r];case"+":return e=>+e[t]+ +e[r];case"-":return e=>+e[t]-+e[r];case"scale":const a=this.constValue();return e=>+e[t]*a;case"template":const o=this.template();return e=>i.Utility.template(o,e);case"map":const n=this.default(),l={};for(const e of this.mapping())l[e.value()]=e.newValue();return e=>l[e[t]]||n;default:return e=>e[t]}}fieldIDs(){const e=this._owner.field(this.column1());if(e)switch(e.type){case"dataset":return e.children.map(e=>e.id);case"object":return Object.keys(e.fields)}return[]}field(e){const t=this._owner.field(this.column1());if(t)switch(t.type){case"dataset":for(const i of t.children)if(i.id===e)return i;break;case"object":return t.fields[e]}}};f(Ye,"ComputedField");let Ze=Ye;Ze.prototype._class+=" ComputedField";const et=class _MultiField extends i.PropertyExt{_owner;constructor(){super()}hash(){return s.hashSum(this.toDDL())}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.label()&&this.validMultiFields().length>0}validate(e){let t=[];for(const i of this.validMultiFields())t=t.concat(i.validate(`${e}.computedFields`));return t}toDDL(){return{fieldID:this.label(),type:"multi",transformations:this.transformations()}}fromDDL(e){return this.label(e.fieldID).transformations(e.transformations)}static fromDDL(e){return(new _MultiField).fromDDL(e)}validMultiFields(){return this.multiFields().filter(e=>e.valid())}transformations(e){return arguments.length?(this.multiFields(e.map(e=>Ze.fromDDL(e))),this):this.validMultiFields().map(e=>e.toDDL())}fieldIDs(){return this._owner.fieldIDs()}field(e){return this._owner.field(e)}};f(et,"MultiField");let tt=et;tt.prototype._class+=" MultiField";const it=class _ProjectBase extends S{_includeLParam=!1;_trim=!1;validate(){let e=[];for(const t of this.validComputedFields())e=e.concat(t.validate(`${this.classID()}.computedFields`));return e}constructor(){super()}transformations(e){return arguments.length?(this.computedFields(e.map(e=>"multi"===e.type?tt.fromDDL(e):Ze.fromDDL(e))),this):this.validComputedFields().map(e=>e.toDDL())}exists(){return this.validComputedFields().length>0}fieldIDs(){return this.inFields().map(e=>e.id)}field(e){for(const t of this.inFields())if(t.id===e)return t;return null}clearComputedFields(){this.computedFields([])}appendComputedFields(e){for(const t of e){const e=(new Ze).owner(this).label(t.label).type(t.type);void 0!==t.column&&e.column1(t.column),this.computedFields().push(e)}return this}validComputedFields(){return this.computedFields().filter(e=>e.valid())}hasComputedFields(){return this.validComputedFields().length}computeFields(e){if(!this.exists())return super.computeFields(e);let t=[];const i={};for(const s of this.validComputedFields())if(s instanceof tt)for(const e of s.validMultiFields()){const s=e.computedField();t.push(s),i[s.id]=!0}else{const e=s.computedField();t.push(e),i[e.id]=!0}if(this._trim&&this.hasComputedFields()){if(this._includeLParam){const e={id:"__lparam",type:"object"};t.push(e),i[e.id]=!0}}else t=t.concat(e.filter(e=>!i[e.id]));return()=>t}referencedFields(e){super.referencedFields(e);const t=[];for(const s of this.validComputedFields())if(s instanceof tt)for(const e of s.validMultiFields())t.push(e.column1()),e.column2()&&t.push(e.column2());else if("template"===s.type())for(const e of i.Utility.templateFields(s.template()))t.push(e);else t.push(s.column1()),s.column2()&&t.push(s.column2());super.resolveInFields(e,t)}projection(){const e=this._trim,t=this.hasComputedFields(),i=[];for(const s of this.validComputedFields())if(s instanceof tt)for(const t of s.validMultiFields())i.push({label:t.label(),func:t.computeFunc(e)});else i.push({label:s.label(),func:s.computeFunc(e)});return s=>{const r=e&&t?{}:{...s};for(const e of i)r[e.label]=e.func(s);return e&&t&&this._includeLParam&&(r.__lparam=s),r}}computeData(){const e=super.computeData();return 0!==e.length&&this.exists()?e.map(this.projection()):e}};f(it,"ProjectBase"),D(it,"ComputedField",Ze);let st=it;const rt=class _Project extends st{toDDL(){return{type:"project",transformations:this.transformations()}}fromDDL(e){return this.transformations(e.transformations)}static fromDDL(e){return(new _Project).fromDDL(e)}hash(e={}){return super.hash({ddl:this.toDDL(),...e})}};f(rt,"Project");let at=rt;at.prototype._class+=" Project";const ot=class _Mappings extends st{constructor(){super(),this._trim=!0,this._includeLParam=!0}toDDL(){return{type:"mappings",transformations:this.transformations()}}fromDDL(e){const t=e||{transformations:[]};return this.transformations(t.transformations)}static fromDDL(e){return(new _Mappings).fromDDL(e)}hash(e={}){return super.hash({ddl:this.toDDL(),...e})}referencedFields(e){if(this.hasComputedFields())return super.referencedFields(e);this.resolveInFields(e,this.inFields().filter(e=>"__lparam"!==e.id).map(e=>e.id))}};f(ot,"Mappings");let nt=ot;nt.prototype._class+=" Mappings",Xe.prototype.publish("value",null,"any","Compare Value",void 0,{validate:f(e=>!e.value()&&!e.newValue()||!!e.value()&&!!e.newValue(),"validate")}),Xe.prototype.publish("newValue",null,"any","New Value",void 0,{validate:f(e=>!e.value()&&!e.newValue()||!!e.value()&&!!e.newValue(),"validate")}),Ze.prototype.publish("label",null,"string","Label",null,{optional:!0}),Ze.prototype.publish("type","mapping","set","Project type",["=","*","/","+","-","scale","template","map"],{optional:!0,disable:f(e=>!e.label(),"disable")}),Ze.prototype.publish("column1",null,"set","Param 1",function(){return this.columns()},{optional:!0,disable:f(e=>e.disableColumn1(),"disable"),validate:f(e=>e.columns().indexOf(e.column1())>=0,"validate")}),Ze.prototype.publish("column2",null,"set","Param 2",function(){return this.columns()},{optional:!0,disable:f(e=>e.disableColumn2(),"disable"),validate:f(e=>e.columns().indexOf(e.column2())>=0,"validate")}),Ze.prototype.publish("constValue",null,"number","Const value",null,{optional:!0,disable:f(e=>!e.label()||["scale"].indexOf(e.type())<0,"disable")}),Ze.prototype.publish("template",null,"string","template",null,{optional:!0,disable:f(e=>!e.label()||["template"].indexOf(e.type())<0,"disable")}),Ze.prototype.publish("default",null,"any","Default Value",null,{optional:!0,disable:f(e=>!e.label()||["map"].indexOf(e.type())<0,"disable")}),Ze.prototype.publish("mapping",[],"propertyArray","Mapped Values",null,{autoExpand:Xe,disable:f(e=>e.disableMapping(),"disable")}),Ze.prototype.publish("childField",[],"propertyArray","Child Fields",null,{autoExpand:Ze,disable:f(e=>e.disableChildField(),"disable")}),tt.prototype.publish("label","","string","Label"),tt.prototype.publish("multiFields",[],"propertyArray","Multi Fields",null,{autoExpand:Ze}),st.prototype.publish("computedFields",[],"propertyArray","Computed Fields",null,{autoExpand:Ze});const lt=class _SortColumn extends i.PropertyExt{_owner;validate(e){const t=[];return this.fieldID_valid()||t.push({source:`${e}.fieldID`,msg:`Invalid fieldID: ${this.fieldID()}`,hint:`expected ${JSON.stringify(this.fieldIDs())}`}),t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.fieldID()}toDDL(){return{fieldID:this.fieldID(),descending:this.descending()}}fromDDL(e){return this.fieldID(e.fieldID).descending(e.descending)}static fromDDL(e){return(new _SortColumn).fromDDL(e)}hash(){return s.hashSum({sortColumn:this.fieldID(),descending:this.descending()})}fieldIDs(){return this._owner.fieldIDs()}field(e){return this._owner.inFields().filter(t=>t.id===e)[0]}};f(lt,"SortColumn");let ht=lt;ht.prototype._class+=" SortColumn";const ut=class _Sort extends S{validate(){let e=[];for(const t of this.validSortBy())e=e.concat(t.validate("Sort.column"));return e}constructor(){super()}toDDL(){return{type:"sort",conditions:this.conditions()}}fromDDL(e){return this.conditions(e.conditions),this}static fromDDL(e){return(new _Sort).fromDDL(e)}conditions(e){return arguments.length?(this.column(e.map(e=>ht.fromDDL(e))),this):this.validSortBy().map(e=>e.toDDL())}hash(){return s.hashSum({Sort:this.column().map(e=>e.hash())})}referencedFields(e){super.referencedFields(e),super.resolveInFields(e,this.validSortBy().map(e=>e.fieldID()))}validSortBy(){return this.column().filter(e=>e.fieldID())}exists(){return this.validSortBy().length>0}fieldIDs(){return this.inFields().map(e=>e.id)}computeData(){const e=super.computeData(),t=[];for(const s of this.validSortBy())t.push({compare:s.descending()?i.descending:i.ascending,id:s.fieldID()});return t.length?[...e].sort((e,i)=>{for(const s of t){const t=s.compare(e[s.id],i[s.id]);if(0!==t)return t}return 0}):e}};f(ut,"Sort"),D(ut,"Column",ht);let ct=ut;ct.prototype._class+=" Sort",ht.prototype.publish("fieldID",null,"set","Sort Field",function(){return this.fieldIDs()},{optional:!0,validate:f(e=>e.fieldIDs().indexOf(e.fieldID())>=0,"validate")}),ht.prototype.publish("descending",!1,"boolean","Sort Field"),ct.prototype.publish("column",[],"propertyArray","Source Columns",null,{autoExpand:ht});const dt=class _HipiePipeline extends ${constructor(e,t){super(),this._ec=e,this._id=t,this._datasource=new $e(this._ec),this._filters=new qe(this._ec),this._project=new at,this._groupBy=new Je,this._sort=new ct,this._limit=new Qe,this.updateSequence()}_ec;_origDatasource;_origFilters;_origProject;_origGroupBy;_origSort;_origLimit;activities(e){return super.activities.apply(this,arguments)}updateSequence(){this.activities([this.datasource(),this.filters(),this.project(),this.groupBy(),this.sort(),this.limit()])}selectionFields(){return this.last().outFields()}};f(dt,"HipiePipeline");let pt=dt;function mt(e){const t=`_orig${e.charAt(0).toUpperCase()+e.slice(1)}`;pt.prototype[t]=pt.prototype[e],pt.prototype[e]=function(e){const i=pt.prototype[t].apply(this,arguments);return void 0!==e&&this.updateSequence(),i}}pt.prototype.publish("datasource",null,"widget","Data Source 2"),pt.prototype.publish("filters",null,"widget","Client Filters"),pt.prototype.publish("project",null,"widget","Project"),pt.prototype.publish("groupBy",null,"widget","Group By"),pt.prototype.publish("sort",null,"widget","Sort"),pt.prototype.publish("limit",null,"widget","Limit output"),f(mt,"wrapHipiePipelineProperty"),mt("datasource"),mt("filters"),mt("project"),mt("groupBy"),mt("sort"),mt("limit");const _t=class _NullView extends pt{hash(){return super.hash()}_fetch(e,t){return Promise.resolve([])}};f(_t,"NullView");let ft=_t;ft.prototype._class+=" NullView";const Dt=class _VizPopupPanel extends u.Modal{_owner;_ownerLParam;constructor(e,t){super(),this._owner=e,this._ownerLParam=t,this._drawStartPos="origin",this.visible(!1),this.minHeight_default("240px"),this.minWidth_default("320px"),this.overflowY_default("hidden")}_host;host(e){return arguments.length?(this._host&&this._host!==e&&this._host._togglePopup.selected(!1).render(),this._host=e,this._owner.vizActivation(this._ownerLParam),this):this._host}enter(e,t){e.parentElement.style.position="absolute";const i=this.widget().title();i&&(this.title(i),this.widget().titleVisible(!1)),super.enter(e,t)}update(e,t){this.fixedTop(this._pos.y+"px"),this.fixedLeft(this._pos.x+"px"),super.update(e,t)}exit(e,t){super.exit(e,t);this.widget().title()&&this.widget().titleVisible(!0)}closeModal(){super.closeModal(),this._host&&this._host._togglePopup.selected(!1).render()}};f(Dt,"VizPopupPanel");let vt=Dt;vt.prototype._class+=" marshaller_VizPopupPanel";const gt=class _VizChartPanel extends u.ChartPanel{_popup;_togglePopup=(new i.ToggleButton).faChar("fa-filter").tooltip("Filter").on("click",()=>{this._popup.host(this);const e=this.locateClosestAncestor(["marshaller_DashboardDockPanel","marshaller_DashboardGrid"]).getBBox(!0),t=this._popup.widget(),i=this._togglePopup.getBBox();this._popup.pos({x:-e.x+i.x+i.width-t.minWidth(),y:-e.y+i.y+i.height}).resize({width:t.minWidth(),height:t.minHeight()}).visible(this._togglePopup.selected()).render(e=>{const t="#"+e.id()+" .layout_Carousel .common_Widget",i=e.element().node();if(i){const{height:s,width:r}=i.querySelector(t).getBoundingClientRect();e.resizeBodySync(r,s)}})});_origButtons;_filterButtons;constructor(){super(),this._origButtons=this.buttons(),this._filterButtons=[this._togglePopup,new i.Spacer,...this._origButtons]}popup(e){return arguments.length?(this._popup=e,this._popup||this._togglePopup.selected(!1),this.buttons(this._popup?this._filterButtons:this._origButtons),this):this._popup}};f(gt,"VizChartPanel");let yt=gt;yt.prototype._class+=" marshaller_VizChartPanel",yt.prototype.publish("descriptionTemplate","","string"),yt.prototype.publish("minWidth",320,"number","Min Width"),yt.prototype.publish("minHeight",240,"number","Min Height");const bt={Table:o.Table,FieldForm:n.FieldForm,Area:a.Area,Bubble:a.Bubble,Bar:a.Bar,Column:a.Column,Contour:a.Contour,HexBin:a.HexBin,Line:a.Line,Pie:a.Pie,Radar:a.Radar,RadialBar:a.RadialBar,Scatter:a.Scatter,Step:a.Step,WordCloud:a.WordCloud,USCountiesChoropleth:h.ChoroplethCounties,USStatesChoropleth:h.ChoroplethStates,ClusterPins:h.Leaflet.ClusterPins,EntityRectList:i.EntityRectList,AdjacencyGraph:l.AdjacencyGraph,DataGraph:l.DataGraph},wt=[];for(const bi in bt)wt.push(bi);function Ft(e){return bt[e]||o.Table}function xt(e){const t=new(bt[e]||o.Table);return t instanceof n.FieldForm?t.validate(!1).allowEmptyRequest(!0):t instanceof l.AdjacencyGraph&&t.uidColumn("uid").labelColumn("label").iconColumn("icon").linksColumn("links").linkUidColumn("uid").linkLabelColumn("label"),t}function Pt(e){return Ft(e).__inputs||[]}f(Ft,"typeClass"),f(xt,"typeNew"),f(Pt,"typeInputs");const St=class _Visualization extends i.PropertyExt{constructor(e,t){super(),this._ec=e,this._hipiePipeline=t,this.mappings(new nt),this.chartPanel(new yt),this.typeChanged()}_ec;_origVisibility;_origChartType;_origChartPanel;_hipiePipeline;visualizationIDs(){return this._ec.elementIDs().filter(e=>e!==this.id())}_prevChartType;typeChanged(){if(this._prevChartType!==this._chartType){this._prevChartType=this._chartType,this.refreshMappings();const e=xt(this._chartType);this.chartPanel().widget(e)}}properties(e){return arguments.length?(this.chartPanel().deserialize(e),this):this.chartPanel().serialize()}refreshMappings(){const e=this.mappings();e.sourceActivity(this._hipiePipeline);const t=e.validComputedFields(),i=e.inFields(),s={};return e.computedFields(Pt(this._chartType).map((r,a)=>{let o=t[a];if(o)o instanceof tt||o.label(r.id);else if(r.multi){o=(new tt).owner(e).label(r.id);const t=[];for(const e of i)"any"!==r.type&&r.type!==e.type||s[e.id]||(s[e.id]=!0,t.push((new Ze).label(e.id).type("=").column1(e.id)));o.multiFields(t)}else{o=(new Ze).owner(e).label(r.id).type("=");for(const e of i)if(("any"===r.type||r.type===e.type)&&!s[e.id]){s[e.id]=!0,o.column1(e.id);break}}return o})),this}_prevFields=[];_prevLinkFields=[];_prevData=[];refreshData(){const e=this.mappings(),t=e.outFields(),i=this.toDBFields(t);let s,r=[];const a=this._ec.element(this.secondaryDataviewID());a&&(s=a.mappings().outFields(),r=this.toDBFields(s));const o=this._prevFields!==t||this._prevLinkFields!==s;if(o)if(this._prevFields=t,"DataGraph"===this.chartType()){const e=this.chartPanel().widget();e.vertexColumns(i.map(e=>e.label())),e.edgeColumns(r.map(e=>e.label()))}else this.chartPanel().fields(i.filter(e=>"__lparam"!==e.id()));else console.warn(`***${this.id()} Immutable Fields***`);const n=e.outData(),l=this._prevData!==n;if(l){this._prevData=n;const e=this.toDBData(i,n);if("DataGraph"===this.chartType()){const t=this.chartPanel().widget();if(t.vertices(e),a){const e=a.mappings().outData(),i=this.toDBData(r,e);t.edges(i)}}else this.chartPanel().data(e)}else console.warn(`${this.id()} Immutable Data!`);return o||l?this.chartPanel().renderPromise().then(()=>{}):Promise.resolve()}fieldTypeTodbFieldType(e){switch(e){case"dataset":return"nested";case"boolean":return"boolean";case"number":return"number";default:return"string"}}toDBFields(e){const t=[];for(const s of e||[]){const e=(new i.Database.Field).type(this.fieldTypeTodbFieldType(s.type)).id(s.id).label(s.id);if("dataset"===s.type)e.children(this.toDBFields(s.children));t.push(e)}return t}toDBData(e,t){return(s.isArray(t)?t:[t]).map(t=>{const i=[];for(const s of e)"nested"===s.type()?i.push(this.toDBData(s.children(),t[s.id()].Row||t[s.id()])):i.push(t[s.label()]);return i})}exec(){const e=[];if(this.secondaryDataviewID_exists()){const t=this.secondaryDataviewID(),i=this._ec.element(t);i&&e.push(i.visualization().exec())}const t=this.mappings();return t.sourceActivity(this._hipiePipeline),e.push(t.refreshMeta().then(()=>t.exec())),Promise.all(e)}refresh(){return this.chartPanel().startProgress&&this.chartPanel().startProgress(),this.exec().then(()=>(this.chartPanel().finishProgress&&this.chartPanel().finishProgress(),this.refreshData()))}click(e,t,i,s){}vertex_click(e,t,i){}};f(St,"Visualization");let Lt=St;Lt.prototype._class+=" Visualization",Lt.prototype.publishProxy("title","_chartPanel"),Lt.prototype.publishProxy("description","_chartPanel"),Lt.prototype.publish("visibility",r.DDL2.VisibilitySet[0],"set","Type",r.DDL2.VisibilitySet),Lt.prototype.publish("chartType","Table","set","Type",wt),Lt.prototype.publish("secondaryDataviewID",null,"set","Secondary Data View (e.g. graph edges)",function(){return this.visualizationIDs()},{optional:!0}),Lt.prototype.publish("mappings",null,"widget","Mappings",void 0,{render:!1,internal:!0}),Lt.prototype.publish("chartPanel",[],"widget","Widget"),Lt.prototype._origVisibility=Lt.prototype.visibility,Lt.prototype.visibility=function(e){const t=this._visibility,i=Lt.prototype._origVisibility.apply(this,arguments);return void 0!==e&&t!==e&&this.chartPanel().target(null),i},Lt.prototype._origChartType=Lt.prototype.chartType,Lt.prototype.chartType=function(e,t){void 0!==e&&-1===wt.indexOf(e)&&(e="Table");const i=Lt.prototype._origChartType.apply(this,arguments);if(void 0!==e&&(this.typeChanged(),t)){const e=this.chartPanel().widget();for(const i in t)"function"==typeof e[i]&&e[i](t[i])}return i},Lt.prototype._origChartPanel=Lt.prototype.chartPanel,Lt.prototype.chartPanel=function(e){const t=Lt.prototype._origChartPanel.apply(this,arguments);if(void 0!==e){this._chartPanel.on("click",(e,t,i,s)=>this.click(e,t,i,s)).on("vertex_click",(e,t,i)=>this.vertex_click(e,t,i));for(const e in bt)if(this._chartPanel.widget()instanceof bt[e]){this._chartType=e;break}}return t};const Ct=class _State extends i.PropertyExt{constructor(){super(),this.selection([])}set(e){return s.hashSum(this.selection())!==s.hashSum(e)&&(this.selection(e),!0)}removeInvalid(e){const t=this.selection(),i=[];for(const r of t)s.find(e,(e,t)=>{for(const i in r)if(r[i]!==e[i])return!1;return!0})&&i.push(r);return i.length!==t.length&&(this.selection(i),!0)}};f(Ct,"State");let It=Ct;It.prototype._class+=" State",It.prototype.publish("selection",[],"array","State");let $t=0;const Rt=class _Element extends i.PropertyExt{constructor(e){for(super(),this._ec=e;$t++,this._id=`e_${$t}`,this._ec.elementExists(this._id););const t=new pt(this._ec,this._id);this.hipiePipeline(t),this._vizChartPanel=new Lt(this._ec,this.hipiePipeline()).id(`viz_${$t}`).title(`Element ${$t}`),this._vizChartPanel.chartPanel().id(`cp_${$t}`),this.visualization(this._vizChartPanel),this.state(new It)}_ec;_vizChartPanel;_origVisualization;id(e){const t=super.id.apply(this,arguments);return arguments.length&&this._vizChartPanel.id(e),t}chartType(){return this._vizChartPanel.chartType()}chartPanel(e){return arguments.length?(this._vizChartPanel.chartPanel(e),this):this._vizChartPanel.chartPanel()}chart(){return this._vizChartPanel.chartPanel().widget()}mappings(e){return arguments.length?(this._vizChartPanel.mappings(e),this):this._vizChartPanel.mappings()}pipeline(e){return this.hipiePipeline().activities(e),this}updatedBy(){const e=this.hipiePipeline().updatedBy();return this.visualization().secondaryDataviewID_exists()&&e.push(this.visualization().secondaryDataviewID()),e}dataProps(){return this.hipiePipeline()}vizProps(){return this.visualization().chartPanel()}stateProps(){return this.state()}_errors=[];errors(){return this._errors}validate(){if(!this._initialized)return[];this._errors=[];const e=this.hipiePipeline();for(const t of[...e.activities(),this.mappings()])for(const e of t.validate())this._errors.push({elementID:this.id(),...e});return this._errors}_initialized=!1;refresh(){const e=this.hipiePipeline().filters().validFilters().map(e=>e.createFilterDescription());return this.visualization().chartPanel().description(e.join(", ")),this.visualization().refresh().then(()=>{this._initialized=!0;const e=this.hipiePipeline().outData();"FieldForm"===this.visualization().chartType()?this.state().set([...e])&&this.selectionChanged():this.state().removeInvalid(e)&&this.selectionChanged()})}selection(e){return arguments.length?(this.state().selection(e),this.selectionChanged(),this):this.state().selection()}selectionChanged(){const e=[];for(const t of this._ec.filteredBy(this.id()))e.push(t.refresh());Promise.all(e).then(()=>{this._ec.vizStateChanged(this)})}monitor(e){return this.hipiePipeline().monitor(e)}};f(Rt,"Element");let Et=Rt;Et.prototype._class+=" Viz",Et.prototype.publish("hipiePipeline",null,"widget","Data View"),Et.prototype.publish("visualization",null,"widget","Visualization"),Et.prototype.publish("state",null,"widget","State"),Et.prototype._origVisualization=Et.prototype.visualization,Et.prototype.visualization=function(e){const t=Et.prototype._origVisualization.apply(this,arguments);return void 0!==e&&this._visualization.on("click",(e,t,i,r)=>{if(r&&r.selection)this.selection(i?r.selection.map(e=>e.__lparam||e):[]);else{const t=s.isArray(e)?e:[e];this.selection(i?t.map(e=>e.__lparam||e):[])}}).on("vertex_click",(e,t,i)=>{const r=s.isArray(e)?e:[e];this.selection(i?r.map(e=>e.__lparam||e):[])}),t};const At=class _ElementContainer extends i.PropertyExt{_nullElement;_datasources=[U];_elements=[];constructor(){super(),this.clear(),this._nullElement=new Et(this)}clear(e){this._datasources=void 0===e?[U]:this._datasources,this._elements=void 0===e?[]:this._elements.filter(t=>t.id()!==e)}_hookSend;hookSend(e){return arguments.length?(this._hookSend=e,this):this._hookSend}datasources(e){return arguments.length?(this._datasources=e,this):this._datasources}datasource(e){return this._datasources.filter(t=>t.id()===e)[0]}appendDatasource(e){return this._datasources.push(e),this}removeDatasource(e){return this._datasources=this._datasources.filter(t=>t!==e),this}elements(){return[...this._elements]}element(e){let t;return t="string"==typeof e?this._elements.filter(t=>t.id()===e):e instanceof yt?this._elements.filter(t=>t.chartPanel()===e):this._elements.filter(t=>t.vizProps()===e),t.length?t[0]:this._nullElement}elementExists(e){return this.element(e)!==this._nullElement}elementIDs(){return this._elements.map(e=>e.id())}append(e){return this._elements.push(e),this}filteredBy(e){return this._elements.filter(t=>t.updatedBy().indexOf(e)>=0)}views(){return this._elements.map(e=>e.hipiePipeline())}view(e){return this.views().filter(t=>t.id()===e)[0]}normalizePersist(e){const t={};return e.__properties.content.map(e=>{const s=!!e.__properties.widget.__properties.chart,r=e,a=e.__properties.widget,o=s?e.__properties.widget.__properties.chart:e.__properties.widget.__properties.widget,n=e.__properties.widget.__id?e.__properties.widget.__id:e.__properties.widget.__properties.widget.__id;t[n]={id:n,package:o.__class.split("_")[0],object:o.__class.split("_")[1],cell:i(r,["chart","widget","fields"]),panel:i(a,["chart","widget","fields"]),widget:i(o,["fields"])}}),t;function i(e,t){const i={};return Object.keys(e.__properties).filter(e=>-1===t.indexOf(e)).forEach(t=>i[t]=e.__properties[t]),i}}validate(){let e=[];return this._elements.forEach(t=>{e=e.concat(t.validate())}),e}refresh(){return Promise.all(this.elements().map(e=>e.refresh())).then(()=>this)}vizStateChanged(e){}};f(At,"ElementContainer");let zt=At;function Bt(e){if(!e.ok)throw new Error(e.status+" "+e.statusText);return e.text()}function Mt(e,t){return fetch(e,t).then(Bt)}zt.prototype._class+=" dashboard_ElementContainer",zt.prototype.publish("samples",10,"number","Number of samples"),zt.prototype.publish("sampleSize",100,"number","Sample size"),f(Bt,"responseText"),f(Mt,"d3Text");const jt=class _PopupManager extends i.Widget{_ec;_popups=[];_popupIdx={};popupPanels(){return this._popups||(this._popups=[]),this._popupIdx||(this._popupIdx={}),this._popups}popupChartPanels(){return this.popupPanels().map(e=>e.widget())}addPopup(e){const t=this._ec.element(e),i=this.element().node(),s=new vt(this,t).target(i).widget(e).relativeTargetId(this.id()).size({width:e.minWidth(),height:e.minHeight()});this._popups.push(s),this._popupIdx[e.id()]={panel:s,monitorHandle:e.monitor(t=>{switch(t){case"minWidth":case"minHeight":s.resize({width:e.minWidth(),height:e.minHeight()}).render()}})},this._ec.filteredBy(t.id()).forEach(e=>{e.visualization().chartPanel().popup(s)})}removePopup(e){const t=this._ec.element(e);this._ec.filteredBy(t.id()).forEach(e=>{e.visualization().chartPanel().popup(null)}),this._popupIdx[e.id()].panel.target(null),this._popupIdx[e.id()].monitorHandle.remove(),e.target(null),delete this._popupIdx[e.id()],this._popups=this._popups.filter(t=>t.widget()!==e)}syncPopups(){const e=this.popupChartPanels(),t=s.compare(e,this._ec.elements().filter(e=>"flyout"===e.visualization().visibility()).map(e=>e.visualization().chartPanel()));for(const i of t.exit)this.removePopup(i);for(const i of t.enter)this.addPopup(i);return this}vizActivation(){}};f(jt,"PopupManager");let kt=jt;const qt=class _DashboardDockPanel extends c.DockPanel{constructor(e){super(),this._ec=e}_ec;tabTitle(e){return this.hideSingleTabs()?e.visualization().title?e.visualization().title():e.visualization().id():e.id()}titleClassed(e,t,i){let s=e.title.className.split(" ");i&&s.indexOf(t)<0?s.push(t):!i&&s.indexOf(t)>0&&(s=s.filter(e=>e!==t)),e.title.className=s.join(" ")}updateTitle(e){const t=this.getWidgetAdapter(e),i=this._ec.element(e),s=i.validate();t.title.label=this.tabTitle(i),this.titleClassed(t,"error",s.length>0),t.title.caption=s.map(e=>`${e.source}: ${e.msg}`).join("\n")}activate(e){const t=this.getWidgetAdapter(e.visualization().chartPanel());t&&t.activate()}syncMinSize(e){if(e.minWidth_exists()||e.minHeight_exists()){const t=this.getWidgetAdapter(e);return i.select(t.node).style("min-width",`${e.minWidth()}px`).style("min-height",`${e.minHeight()}px`),!0}return!1}syncWidgets(){const e=this.widgets(),t=s.compare(e,this._ec.elements().filter(e=>"normal"===e.visualization().visibility()).map(e=>e.visualization().chartPanel()));let i=!1;for(const s of t.exit)this.removeWidget(s);for(const s of t.enter){const e=this._ec.element(s);this.addWidget(s,this.tabTitle(e),"split-bottom",void 0,this.hideSingleTabs()?void 0:this),i=this.syncMinSize(s)||i}for(const s of t.update)this.updateTitle(s),i=this.syncMinSize(s)||i;return i&&this.refit(),this}childActivation(e,t){super.childActivation(e,t),this.vizActivation(this._ec.element(e));for(const i of this.widgetAdapters())i===t?(i.addClass("active"),this.titleClassed(i,"active",!0),i.title.iconClass="active"):(i.removeClass("active"),this.titleClassed(i,"active",!1),i.title.iconClass="")}vizActivation(e){}canClose(e,t){const i=this._ec.element(e).id(),s=window.confirm(`Remove Widget "${i}"?`);return s&&(this._ec.clear(i),this.syncWidgets(),this.vizActivation(void 0)),s}syncPopups(){}};f(qt,"DashboardDockPanel");let Vt=qt;Vt.prototype._class+=" marshaller_DashboardDockPanel",Vt.prototype.mixin(kt);const Nt=class _DashboardGrid extends u.Grid{constructor(e){super(),this._ec=e,this.designMode(!1),this.surfacePadding("0"),this.surfaceBorderWidth(0)}_ec;_layoutCache=[];updateGrid(e,t=0,i=!1){super.updateGrid(e,t,i),this._layoutCache=this.content().map(e=>({id:e.widget().id(),position:[e.gridCol(),e.gridRow(),e.gridColSpan(),e.gridRowSpan()]}))}layoutObj(e){if(e)if(e.main){const i=t(e,10,10);this._layoutCache=i}else e instanceof Array&&(this._layoutCache=e);return this;function t(e,t,i){const s=[];return r(e.main,0,0,t,i),s;function r(e,t,i,a,o){e.children?"split-area"===e.type?"horizontal"===e.orientation?e.children.forEach((s,n)=>{const l=e.sizes[n]*a,h=o,u=0===n?t:t+e.sizes[0]*a,c=i;r(e.children[n],u,c,l,h)}):"vertical"===e.orientation?e.children.forEach((s,n)=>{const l=a,h=e.sizes[n]*o,u=t,c=0===n?i:i+e.sizes[0]*o;r(e.children[n],u,c,l,h)}):console.error("wtf"):"tab-area"===e.type&&e.children.forEach((s,n)=>{const l=a,h=e.sizes[n]*o,u=t,c=0===n?i:i+e.sizes[0]*o;r(e.children[n],u,c,l,h)}):s.push([t,i,a,o].map(Math.round))}}}layout(){return this._layoutCache}widgets(){return this.content().map(e=>e.widget())}hideSingleTabs(){return!0}getWidgetAdapter(){}tabTitle(e){return this.hideSingleTabs()?e.visualization().title?e.visualization().title():e.visualization().id():e.id()}updateTitle(e){const t=this.getWidgetCell(e.id()),i=this._ec.element(e),s=this.tabTitle(i);t.widget().title(s)}activate(e){}removeWidget(e){const t=this.getWidgetCell(e.id());this.clearContent(t)}syncMinSize(e){if(e.minWidth_exists()||e.minHeight_exists()){return this.getWidgetCell(e.id()).element().style("min-width",`${e.minWidth()}px`).style("min-height",`${e.minHeight()}px`),!0}return!1}syncWidgets(){const e=this.widgets(),t=s.compare(e,this._ec.elements().filter(e=>"normal"===e.visualization().visibility()).map(e=>e.visualization().chartPanel()));for(const s of t.exit)this.removeWidget(s);const i=[];for(const s of t.enter){const e=this._ec.element(s),t=this.content().length;if(this._layoutCache&&this._layoutCache[t]){const t=this._layoutCache.find(e=>e.id===s.id());if(t){const[i,s,r,a]=t.position;this.setContent(s,i,e.visualization().chartPanel(),"",a,r)}else i.push(e.visualization().chartPanel())}else i.push(e.visualization().chartPanel())}let r=this.content().reduce((e,t)=>Math.max(e,t.gridRow()+t.gridRowSpan()),0);i.forEach(e=>{this.setContent(r,0,e,"",3,3),r+=3});for(const s of t.update)this.updateTitle(s);return this}childActivation(e,t){this.vizActivation(this._ec.element(e))}postSelectionChange(){super.postSelectionChange();const e=this._selectionBag.get();e.length>0&&this.childActivation(e[0].widget.widget())}vizActivation(e){}canClose(e,t){const i=this._ec.element(e).id(),s=window.confirm(`Remove Widget "${i}"?`);return s&&(this._ec.clear(i),this.syncWidgets(),this.vizActivation(void 0)),s}syncPopups(){}};f(Nt,"DashboardGrid");let Tt=Nt;Tt.prototype._class+=" marshaller_DashboardGrid",Tt.prototype.mixin(kt);const Ot=s.scopedLogger("marshaller/ddl2/ddl"),Wt=class _DDLDatasourceAdapter{_dsDedup;constructor(){}clear(){this._dsDedup={}}id(e){return e instanceof ie?`${e.url()}/${e.wuid()}`:e instanceof be?`${e.url()}/${e.querySet()}/${e.queryID()}`:e instanceof ue?`${e.url()}/${e.action()}`:e.id()}_resolveID(e){return this._dsDedup[this.id(e)].ds.id()}resolveID(e){return e instanceof re?this._resolveID(e.datasource().wu()):e instanceof Pe||e instanceof Le||e instanceof fe?this._resolveID(e.datasource().service()):void 0}append(e){const t=e instanceof $e?e.datasource():e,i=e instanceof $e?e.datasourceRef():void 0,s=t.id(),r=t instanceof ee?t.wu():t instanceof Fe||t instanceof de?t.service():t,a=this.id(r);this._dsDedup[a]||(this._dsDedup[a]={ds:r,result:{}}),this._dsDedup[a].result[s]||(this._dsDedup[a].result[s]={refType:t,ref:i})}getAll(){const e=[];for(const t in this._dsDedup){const i=this._dsDedup[t].ds.toDDL();if("roxie"===i.type||"hipie"===i.type||"rest"===i.type){const e={};for(const i in this._dsDedup[t].result){const s=this._dsDedup[t].result[i].refType.toDDL(),r={inputs:{},outputs:{}};this._dsDedup[t].result[i].ref.referencedFields(r);for(const t in r.inputs)r.inputs[t].forEach(t=>{e[t]=s.inputs.filter(e=>e.id===t)[0]})}i.inputs=[];for(const t in e)i.inputs.push(e[t])}if("wuresult"===i.type||"roxie"===i.type||"hipie"===i.type||"rest"===i.type){const e={};for(const i in this._dsDedup[t].result){const s=this._dsDedup[t].result[i].refType.toDDL();if("wuresult"===s.type||"roxie"===s.type||"hipie"===s.type||"rest"===s.type)for(const t in s.outputs)e[t]=s.outputs[t]}i.outputs={};for(const t in e)i.outputs[t]=e[t]}e.push(i)}return e}};f(Wt,"DDLDatasourceAdapter");let Ht=Wt;const Gt=class _DDLAdapter{_dashboard;_ec;_dsWriteDedup=new Ht;_dsReadDedup={};constructor(e){this._dashboard=e,this._ec=this._dashboard.elementContainer()}writeDatasources(){for(const e of this._ec.elements())this._dsWriteDedup.append(e.hipiePipeline().datasource());return this._dsWriteDedup.getAll()}writeFilters(e){if(e.exists())return e.toDDL()}readFilters(e,t){return qe.fromDDL(t,e)}writeProject(e){if(e.exists())return e.toDDL()}readProject(e){return at.fromDDL(e)}writeMappings(e){return e.exists()?e.toDDL():{type:"mappings",transformations:[]}}readMappings(e){return nt.fromDDL(e)}writeGroupBy(e){if(e.exists())return e.toDDL()}readGroupBy(e){return Je.fromDDL(e)}writeSort(e){if(e.exists())return e.toDDL()}readSort(e){return ct.fromDDL(e)}writeLimit(e){if(e.exists())return e.toDDL()}readLimit(e){return Qe.fromDDL(e)}readDatasourceRef(e,t,i){if(r.DDL2.isWUResultRef(e)){const i=this._dsReadDedup[e.id];t.datasourceID(i.output(e.output).id())}else if(r.DDL2.isRoxieServiceRef(e)){t.datasourceID(`${e.id}_${e.output}`);t.datasourceRef().request(e.request.map(e=>me.fromDDL(this._ec,e)))}else t.datasourceID(e.id);return this}writeActivities(e){return e.activities().map(e=>e instanceof qe?this.writeFilters(e):e instanceof at?this.writeProject(e):e instanceof Je?this.writeGroupBy(e):e instanceof ct?this.writeSort(e):e instanceof Qe?this.writeLimit(e):e instanceof nt?this.writeMappings(e):void(e instanceof $e||Ot.warning(`Unknown activity type: ${e.classID()}`))).filter(e=>!!e)}writeVisualization(e){return{id:e.chartPanel().id(),title:e.title(),description:e.description(),visibility:e.visibility(),chartType:e.chartType(),__class:e.chartPanel().widget().classID(),mappings:this.writeMappings(e.mappings()),properties:e.properties()}}readVisualization(e,t){const i=this.readMappings(e.mappings);return t.chartPanel().id(e.id),t.title(e.title).description(e.description).visibility(e.visibility).chartType(e.chartType).properties(e.properties).mappings(i),this}writeViewDatasource(e){const t=e.toDDL();return t.id=this._dsWriteDedup.resolveID(e)||t.id,t}writeDDLViews(){const e={inputs:{},outputs:{}};for(const t of this._ec.elements())t.visualization().mappings().referencedFields(e);return this._ec.elements().map(e=>{const t=e.hipiePipeline(),i=t.datasource();if(i instanceof $e){const s=i.datasourceRef();return{id:e.id(),datasource:this.writeViewDatasource(s),activities:this.writeActivities(t),visualization:this.writeVisualization(e.visualization())}}throw new Error("Missing DSPicker?")})}writeProperties(){return{name:v,version:g,buildVersion:y,layout:this._dashboard.layout()}}readDDLViews(e){for(const t of e){const e=new Et(this._ec).id(t.id);this._ec.append(e);const i=e.hipiePipeline();this.readDatasourceRef(t.datasource,i.datasource(),this._ec);for(const s of t.activities){if(r.DDL2.isProjectActivity(s)){const e=this.readProject(s);i.project(e)}if(r.DDL2.isFilterActivity(s)){const e=this.readFilters(s,this._ec);i.filters(e)}if(r.DDL2.isGroupByActivity(s)){const e=this.readGroupBy(s);i.groupBy(e)}if(r.DDL2.isSortActivity(s)){const e=this.readSort(s);i.sort(e)}if(r.DDL2.isLimitActivity(s)){const e=this.readLimit(s);i.limit(e)}}this.readVisualization(t.visualization,e.visualization())}}readProperties(e){e&&e.layout&&this._dashboard.layoutObj(e.layout)}write(){this._dsWriteDedup.clear();return{version:"2.2.1",createdBy:{name:v,version:g},datasources:this.writeDatasources(),dataviews:this.writeDDLViews(),properties:this.writeProperties(),hipieProperties:this._dashboard.hipieProps()}}read(e){this._dsWriteDedup.clear();for(const t of e.datasources)switch(t.type){case"databomb":this._ec.appendDatasource(H.fromDDL(t));break;case"form":this._ec.appendDatasource(N.fromDDL(t));break;case"logicalfile":this._ec.appendDatasource(oe.fromDDL(this._ec,t));break;case"wuresult":const e=ie.fromDDL(this._ec,t);this._dsReadDedup[e.id()]=e;for(const r in t.outputs)this._ec.appendDatasource(e.output(r));break;case"roxie":case"hipie":const i=be.fromDDL(this._ec,t);this._dsReadDedup[i.id()]=i;for(const r in t.outputs)this._ec.appendDatasource(Fe.fromDDL(this._ec,i,r));break;case"rest":const s=ue.fromDDL(this._ec,t);this._dsReadDedup[s.id()]=s;for(const r in t.outputs)this._ec.appendDatasource(de.fromDDL(this._ec,s,r));break;default:Ot.warning(`Unknown ddl datasource type: ${t.type} `)}this.readDDLViews(e.dataviews),this.readProperties(e.properties),this._dashboard.hipieProps(e.hipieProperties)}};f(Gt,"DDLAdapter");let Jt=Gt;const Ut=class _Imports{_moduleMap={};append(e){this._moduleMap[e.module]||(this._moduleMap[e.module]={}),this._moduleMap[e.module][e.class]=!0}write(){const e=[];for(const t in this._moduleMap){const i=[];for(const e in this._moduleMap[t])i.push(e);i.sort(),e.push(`import { ${i.join(", ")} } from "${t}";`)}return e.join("\n")}};f(Ut,"Imports");let Qt=Ut;function Kt(e){const t={};for(const i of e.publishedProperties())if(e[i.id+"_modified"]()&&"fields"!==i.id){const s=e[i.id]();if("propertyArray"===i.type){const e=s.map(Kt);e&&(t[i.id]=e)}else t[i.id]=s}return t}f(Kt,"createProps");const Xt=class _JavaScriptAdapter{_dashboard;_ec;_ddlAdapter;_ddlSchema;constructor(e){this._dashboard=e,this._ec=this._dashboard.elementContainer(),this._ddlAdapter=new Jt(this._dashboard),this._ddlSchema=this._ddlAdapter.write()}createProps(e,t,i=""){let s=[];for(const r of t.publishedProperties())if(t[r.id+"_exists"]())switch(r.type){case"string":case"set":s.push(`${e}.${r.id}("${t[r.id]()}")${i};`);break;case"number":case"boolean":s.push(`${e}.${r.id}(${t[r.id]()})${i};`);break;case"widget":s=s.concat(this.createProps(`${e}.${r.id}()`,t[r.id]()));break;case"propertyArray":r.ext&&s.push(`${e}.${r.id}([${t[r.id]()}])${i};`)}return s}writeMeta(e){return""}safeID(e){return e?e.replace(/ /g,"_").replace(/\./g,"_"):e}datasourceRefID(e){const t=e.datasource;return r.DDL2.isRoxieServiceRef(t)?`${this.safeID(t.id)}_${this.safeID(t.output)}_${this.safeID(e.id)}`:r.DDL2.isWUResultRef(t)?`${this.safeID(t.id)}_${this.safeID(t.output)}`:`${this.safeID(t.id)}`}_dedup={};writeDatasource(e){const t=e.datasource,i=[],s=this._ddlSchema.datasources.filter(e=>e.id===t.id)[0],r=t.output,a=this.datasourceRefID(e);if(!this._dedup[a])switch(this._dedup[a]=!0,s.type){case"wuresult":const o=this.safeID(e.datasource.id);this._dedup[o]||(this._dedup[o]=!0,i.push(` export const ${o} = new marshaller.WU()\n .url("${s.url}")\n .wuid("${s.wuid}")\n ;`)),i.push(` export const ${a} = new marshaller.WUResult()\n .wu(${o})\n .resultName("${r}")\n .responseFields(${b(s.outputs[r].fields)})\n ;`);break;case"logicalfile":i.push(` export const ${a} = new marshaller.LogicalFile()\n .url("${s.url}")\n .logicalFile("${s.logicalFile}")\n .responseFields(${b(s.fields)})\n ;`);break;case"hipie":case"roxie":const n=this.safeID(e.datasource.id);this._dedup[n]||(this._dedup[n]=!0,i.push(` export const ${n} = new marshaller.RoxieService(ec)\n .url("${s.url}")\n .querySet("${s.querySet}")\n .queryID("${s.queryID}")\n .requestFields(${b(s.inputs)})\n ;`));const l=n+"_"+this.safeID(r);this._dedup[l]||(this._dedup[l]=!0,i.push(` export const ${l} = new marshaller.RoxieResult(ec)\n .service(${n})\n .resultName("${r}")\n .responseFields(${b(s.outputs[r].fields)})\n ;`)),i.push(` export const ${a} = new marshaller.HipieResultRef(ec)\n .datasource(${l})\n .requestFieldRefs(${b(t.request)})\n ;`);break;case"databomb":i.push(` export const ${a} = new marshaller.Databomb()\n .format("${s.format}")\n .payload(${JSON.stringify(s.payload)})\n ;`);break;case"form":{const e=[];for(const t of s.fields)e.push(`new marshaller.FormField().fieldID("${t.id}").default("${t.default||""}")`);i.push(` export const ${a} = new marshaller.Form()\n .formFields([\n ${e.join(",\n ")}\n ])\n ;`)}}return i}writeActivity(e){switch(e.type){case"filter":return`new marshaller.Filters(ec).conditions(${b(e.conditions)})`;case"project":return`new marshaller.Project().transformations(${b(e.transformations)})`;case"groupby":return`new marshaller.GroupBy().fieldIDs(${JSON.stringify(e.groupByIDs)}).aggregates(${b(e.aggregates)})`;case"sort":return`new marshaller.Sort().conditions(${b(e.conditions)})`;case"limit":return`new marshaller.Limit().rows(${e.limit})`;case"mappings":return`new marshaller.Mappings().transformations(${b(e.transformations)})`}}writeWidgetProps(e){const t=[];for(const i of e.publishedProperties())e[i.id+"_modified"]()&&"fields"!==i.id&&t.push(`.${i.id}(${JSON.stringify(e[i.id]())})`);return t}joinWithPrefix(e,t,i,r){let a,o="";e.__class&&(a=s.classID2Meta(e.__class),t.append(a),o+=`new ${a.class}()`);for(const n in e)if("__class"===n);else if(s.isArray(e[n])){const s=`${e[n].map(e=>this.joinWithPrefix(e,t,i+" ","")).join(`,${i} `)}`;s&&(o+=`${i} .${n}([${i} ${s}${i} ])${r}`)}else o+=`${i} .${n}(${JSON.stringify(e[n])})${r}`;return o}writeWidget(e,t){return` export const ${e.visualization.id} = new marshaller.VizChartPanel()\n .id("${e.visualization.id}")\n .title("${e.visualization.title}")\n .widget(${this.joinWithPrefix(e.visualization.properties.widget,t,"\n ","")})\n ;`}writeElement(e){const t=[`data.${this.datasourceRefID(e)}`];for(const s of e.activities)t.push(this.writeActivity(s));const i=[];for(const s of this._ec.filteredBy(e.id))i.push(`${s.id()}.refresh();`);return`\nconst ${e.id} = new marshaller.Element(ec)\n .id("${e.id}")\n .pipeline([\n ${t.join(",\n ")}\n ])\n .mappings(new marshaller.Mappings().transformations(${b(e.visualization.mappings.transformations)}))\n .chartPanel(viz.${e.visualization.id})\n .on("selectionChanged", () => {\n ${i.join("\n ")}\n }, true)\n ;\n${e.id}.visualization()\n .visibility("${e.visualization.visibility}")\n .secondaryDataviewID("${e.visualization.secondaryDataviewID||""}")\n ;\nec.append(${e.id});\n`}writeDatasources(){let e=[];for(const t of this._ddlSchema.dataviews)e=e.concat(this.writeDatasource(t));return e}writeWidgets(){const e=[],t=new Qt;for(const i of this._ddlSchema.dataviews)e.push(this.writeWidget(i,t));return{widgetImports:t.write(),widgetDefs:e.join("\n\n")}}writeElements(){let e="";for(const t of this._ddlSchema.dataviews)e+=this.writeElement(t);return e}createJavaScript(){const e=this.writeWidgets();return`${e.widgetImports}\nimport * as marshaller from "@hpcc-js/marshaller";\n\n// Dashboard Element Container (Model) ---\nconst ec = new marshaller.ElementContainer();\n\nnamespace data {\n${this.writeDatasources().join("\n")}\n}\n\nnamespace viz {\n${e.widgetDefs}\n}\n\n// Dashboard Elements (Controller) ---\n${this.writeElements().trim()}\n\nec.refresh();\n\n// Optional ---\nconst errors = ec.validate();\nfor (const error of errors) {\n console.error(error.elementID + " (" + error.source + "): " + error.msg);\n}\n\nexport const dashboard = new marshaller.Dashboard(ec)\n .target("placeholder")\n .titleVisible(false)\n .hideSingleTabs(true)\n .layoutObj(${b(this._dashboard.layout())})\n .render()\n ;\n\n// @ts-ignore\nconst ddl = ${JSON.stringify(this._ddlSchema)};\n`}};f(Xt,"JavaScriptAdapter");let Yt=Xt;const Zt=class _Dashboard extends u.ChartPanel{constructor(e){super(),this._ec=e,this._ec.on("vizStateChanged",e=>{this.vizStateChanged(e)}),this.buttons([this._designModeButton,new i.Spacer,this._addButton,this._removeButton,new i.Spacer,this._reloadButton,new i.Spacer,this._addSamples]),this.ensureDockPanel("dock")}_ec;_dockPanel;_designModeButton=(new i.ToggleButton).faChar("fa-object-group").tooltip("Design Mode...").selected(!0).on("click",()=>{this._dockPanel instanceof Tt&&this._dockPanel.designMode(this._designModeButton.selected()).lazyRender()});_addButton=(new i.Button).faChar("fa-plus").tooltip("Add...").on("click",()=>{const e=new Et(this._ec);this._ec.append(e),this.renderPromise().then(()=>{e.refresh().then(()=>{this.activate(e)})})});_removeButton=(new i.Button).faChar("fa-minus").tooltip("Remove...").enabled(!1).on("click",()=>{const e=this._prevActive;e&&window.confirm(`Remove Widget "${e.id()}"?`)&&(this._ec.clear(e.id()),this.renderPromise().then(()=>{this.vizActivation(void 0)}))});_reloadButton=(new i.Button).faChar("fa-refresh").tooltip("Reload...").on("click",()=>{const e=this.save();this._ec.clear(),this.vizActivation(void 0),this.renderPromise().then(()=>{this.restore(e),this.renderPromise().then(()=>{this._ec.refresh().then(()=>{})})})});_addSamples=(new i.Button).faChar("fa-database").tooltip("Add Samples").on("click",()=>{Promise.all([Mt("https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/airports.csv"),Mt("https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/carriers.csv"),Mt("https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/stats.csv")]).then(([e,t,i])=>{const s=this.addForm("popup",{type:"form",id:"global_filter",fields:[{type:"string",id:"Airport"},{type:"string",id:"Airline"}]});s.visualization().title("Global Filter").visibility("flyout").chartType("FieldForm");const r=this.addDatabomb("airports",e,"csv",[(new q).fieldID("code").type("string"),(new q).fieldID("name").type("string"),(new q).fieldID("count").type("number")],new qe(this._ec).remoteFilter([(new qe.Filter).source(s.id()).mappings([(new qe.Mapping).remoteField("Airport").localField("code").nullable(!0)])]),(new ct).column([(new ct.Column).fieldID("count").descending(!0)]));r.chartPanel().title("Airports");const a=this.addDatabomb("carriers",t,"csv",[(new q).fieldID("code").type("string"),(new q).fieldID("name").type("string"),(new q).fieldID("count").type("number")],new qe(this._ec).remoteFilter([(new qe.Filter).source(s.id()).mappings([(new qe.Mapping).remoteField("Airline").localField("code").nullable(!0)])]),(new ct).column([(new ct.Column).fieldID("count").descending(!0)]));a.chartPanel().title("Airlines");const o=this.addDatabomb("stats",i,"csv",[],new qe(this._ec).remoteFilter([(new qe.Filter).source(r.id()).mappings([(new qe.Mapping).remoteField("code").localField("airport")]),(new qe.Filter).source(a.id()).mappings([(new qe.Mapping).remoteField("code").localField("carrier").nullable(!0)])]));return o.chartPanel().title("Stats"),Promise.all([s.refresh(),r.refresh(),a.refresh(),o.refresh()])}).then(()=>{this.render()})});addDatabomb(e,t,i="csv",s,...r){const a=(new H).id(e).format(i).payload(t);s.length>0&&a.databombFields(s),this._ec.appendDatasource(a);const o=new Et(this._ec),n=o.hipiePipeline().datasource();n instanceof $e&&n.datasourceID(a.id());for(const l of r)l instanceof qe?o.hipiePipeline().filters(l):l instanceof at?o.hipiePipeline().project(l):l instanceof Je?o.hipiePipeline().groupBy(l):l instanceof ct?o.hipiePipeline().sort(l):l instanceof Qe&&o.hipiePipeline().limit(l);return this._ec.append(o),o}addForm(e,t){const i=(new N).id(e).fromDDL(t);this._ec.appendDatasource(i);const s=new Et(this._ec),r=s.hipiePipeline().datasource();return r instanceof $e&&r.datasourceID(i.id()),this._ec.append(s),s}static create(e,t){return new Promise((i,s)=>{const r=new zt,a=new _Dashboard(r).target(e).hideSingleTabs(!0).titleVisible(!1).restore(t).render(e=>{r.refresh().then(()=>{i(a)})})})}ensureDockPanel(e="dock"){("dock"!==e||this._dockPanel instanceof Vt)&&("grid"!==e||this._dockPanel instanceof Tt)||(this._dockPanel=("dock"===e?new Vt(this._ec):new Tt(this._ec).designMode(this.titleVisible())).on("vizActivation",e=>{this.vizActivation(e)}),this.widget(this._dockPanel))}elementContainer(){return this._ec}_hipieProps;hipieProps(e){return arguments.length?(this._hipieProps=e,this):this._hipieProps}ddl(e){const t=new Jt(this);return arguments.length?(this._ec.clear(),t.read(e),this):t.write()}layoutObj(e){return this._dockPanel.layoutObj(e),this}save(){return new Jt(this).write()}serializeDDL(){return JSON.stringify(this.save())}deserializeDDL(e){return this.restore(JSON.parse(e))}restore(e,t=!1){this.ensureDockPanel(e&&e.properties&&e.properties.layout instanceof Array?"grid":"dock"),this._ec.clear();return new Jt(this).read(e),t&&this.renderPromise().then(()=>{this._ec.refresh()}),this}importDDL(e,t,i,s={}){const a=r.isDDL2Schema(e)?e:r.upgrade(e,t,i,!0,s);return this.restore(a,!0)}javascript(){return new Yt(this).createJavaScript()}layout(){return this._dockPanel.layout()}widgets(){return this._dockPanel.widgets()}activate(e){this._dockPanel.activate(e)}hideSingleTabs(e){return arguments.length?(this._dockPanel.hideSingleTabs(e),this):this._dockPanel.hideSingleTabs()}updateButtonState(){this._designModeButton.enabled(this._dockPanel instanceof Tt).render(),this._removeButton.enabled(void 0!==this._prevActive).render()}update(e,t){this._dockPanel.syncWidgets(),super.update(e,t),this.updateButtonState()}_prevActive;vizActivation(e){this._prevActive=e,this._removeButton.enabled(void 0!==e).render()}vizStateChanged(e){}render(e){return this._dockPanel.syncPopups(),super.render(t=>{e&&e(t)})}};f(Zt,"Dashboard");let ei=Zt;ei.prototype._class+=" dashboard_dashboard";const ti=class _DDLEditor extends c.SplitPanel{summary="0 Errors";_ddlEditor=(new d.JSONEditor).on("changes",e=>{this.checkSyntax()});_errorTable=(new o.Table).columns(["dataPath","keyword","message","params"]);ddl(e){return arguments.length?(this._ddlEditor.json(e),this.checkSyntax(),this):this._ddlEditor.json()}checkSyntax(){try{const t=this.ddl();try{const{success:e,errors:i}=r.validate2(t);e?this._errorTable.data([]):this._errorTable.data(i.map(e=>[e.dataPath,e.keyword,e.message,JSON.stringify(e.params)]))}catch(e){this._errorTable.data([["","Validation Failed","",""]])}}catch(e){this._errorTable.data([["ALL","Invalid JSON","",""]])}this._renderCount&&this._errorTable.lazyRender()}enter(e,t){super.enter(e,t),this.addWidget(this._ddlEditor).addWidget(this._errorTable)}update(e,t){super.update(e,t)}};f(ti,"DDLEditor");let ii=ti;ii.prototype._class+=" codemirror_DDLEditor";const si=class _GraphAdapter{constructor(e){this._ec=e}_ec;subgraphMap={};vertexMap={};edgeMap={};hierarchy=[];vertices=[];edges=[];clear(){this.subgraphMap={},this.vertexMap={},this.edgeMap={},this.hierarchy=[],this.vertices=[],this.edges=[]}createSubgraph(e,t,i){let s=this.subgraphMap[e];return s||(s=(new l.Subgraph).columns(["DS"]).data([[i]]),this.subgraphMap[e]=s),this.vertices.push(s),s.title(`${t}`),s.getBBox(!0),s}createVertex(e,t,i,s="",r="#dcf1ff"){let a=this.vertexMap[e];return a||(a=(new l.Vertex).columns(["DS"]).data([[i]]).icon_diameter(0),this.vertexMap[e]=a),this.vertices.push(a),a.textbox_shape_colorFill(r).text(s?`${t}\n${s}`:`${t}`).tooltip(s),a.getBBox(!0),a}createEdge(e,t){const i=`${e}->${t}`;let s=this.edgeMap[i];return s||(s=(new l.Edge).sourceVertex(this.vertexMap[e]).targetVertex(this.vertexMap[t]),this.edgeMap[i]=s),this.edges.push(s),s}createDatasource(e){if(e instanceof $e&&(e=e.selection().datasource()),e instanceof ee){const t=`${e.url()}`,i=this.createSubgraph(t,`${t}`),s=`${e.url()}/${e.wuid()}`,r=this.createSubgraph(s,`${e.wuid()}`);this.hierarchy.push({parent:i,child:r});const a=`${s}/${e.resultName()}`,o=this.createVertex(a,e.resultName(),{activity:e});return this.hierarchy.push({parent:r,child:o}),a}if(e instanceof oe){const t=`${e.url()}`,i=this.createSubgraph(t,`${t}`),s=`${t}/${e.logicalFile()}`,r=this.createVertex(s,e.logicalFile(),{activity:e});return this.hierarchy.push({parent:i,child:r}),s}if(e instanceof Pe){const t=`${e.url()}`,i=this.createSubgraph(t,`${t}`),s=e.serviceID(),r=this.createSubgraph(s,e.querySet());this.hierarchy.push({parent:i,child:r});const a=s;this.hierarchy.push({parent:r,child:this.createVertex(a,e.queryID())});const o=`${s}/${e.resultName()}`;return this.hierarchy.push({parent:r,child:this.createVertex(o,e.resultName(),{activity:e})}),this.createEdge(a,o),o}if(e instanceof Fe){const t=`${e.service().url()}`,i=this.createSubgraph(t,`${t}`),s=e.serviceID(),r=this.createSubgraph(s,e.service().querySet());this.hierarchy.push({parent:i,child:r});const a=`${s}/${e.service().queryID()}`,o=this.createSubgraph(a,e.service().queryID());this.hierarchy.push({parent:r,child:o});const n=`${a}/${e.resultName()}`;return this.hierarchy.push({parent:o,child:this.createVertex(n,e.resultName(),{activity:e})}),this.createEdge(a,n),n}if(e instanceof fe){const t=`${e.url()}`,i=this.createSubgraph(t,`${t}`),s=e.serviceID(),r=this.createSubgraph(s,e.action());this.hierarchy.push({parent:i,child:r});const a=s;this.hierarchy.push({parent:r,child:this.createVertex(a,e.action())});const o=`${s}/${e.resultName()}`;return this.hierarchy.push({parent:r,child:this.createVertex(o,e.resultName(),{activity:e})}),this.createEdge(a,o),o}if(e instanceof de){const t=`${e.service().url()}`,i=this.createSubgraph(t,`${t}`),s=e.serviceID(),r=`${t}/${e.service().action()}`,a=this.createSubgraph(s,e.service().action());this.hierarchy.push({parent:i,child:a});const o=`${r}/${e.resultName()}`;return this.hierarchy.push({parent:a,child:this.createVertex(o,e.resultName(),{activity:e})}),this.createEdge(r,o),o}if(e instanceof N){const t=e.hash();return this.createVertex(t,e.label(),{activity:e}),t}if(e instanceof H){const t=e.id();return this.createVertex(t,e.label(),{activity:e}),t}{const t=e.hash();return this.createVertex(t,e.label(),{activity:e}),t}}createActivity(e,t,i,s){const r=this.createSubgraph(t.id(),`${t.id()}`,{view:t});let a=null,o="";if(i.exists()){const e=i.validate();e.length&&(a="pink",o=e.map(e=>`${e.source}: ${e.msg}`).join("\n"))}else a="lightgrey";const n=this.createVertex(i.id(),s||`${i.classID()}`,{view:t,activity:i},o,a);return e&&this.createEdge(e,i.id()),this.hierarchy.push({parent:r,child:n}),i.id()}createGraph(){this.hierarchy=[],this.vertices=[],this.edges=[],this._ec.elements().forEach(e=>{this.createDatasource(e.hipiePipeline().datasource())});const e={};for(const t of this._ec.elements()){const i=t.hipiePipeline();let s=this.createDatasource(i.datasource());for(const e of i.activities())s=this.createActivity(s,t,e);const r=t.visualization(),a=r.mappings(),o=this.createActivity(s,t,a,"Mappings"),n=`${r.id()}-sg`,l=this.createSubgraph(n,"Visualization",{visualization:r});this.hierarchy.push({parent:this.subgraphMap[t.id()],child:l}),this.hierarchy.push({parent:l,child:this.vertexMap[a.id()]});const h=`${r.id()}-viz`,u=this.createVertex(h,r.chartPanel().widget().classID(),{view:t,chartPanel:r.chartPanel()});this.createEdge(o,h),this.hierarchy.push({parent:l,child:u});const c=`${r.id()}-state`,d=this.createVertex(c,"Selection",{view:t,state:t.state()});this.createEdge(h,c).weight(10).strokeDasharray("1,5").text("updates"),this.createEdge(s,c),this.hierarchy.push({parent:this.subgraphMap[t.id()],child:d}),s=c,e[i.id()]=s}for(const t of this._ec.elements()){const e=t.visualization(),i=this._ec.element(e.secondaryDataviewID());if(i){const t=i.visualization().mappings();this.createEdge(t.id(),`${e.id()}-viz`)}}for(const t of this._ec.elements()){const i=t.hipiePipeline();for(const t of i.updatedByGraph())this.createEdge(e[this._ec.element(t.from).hipiePipeline().id()],t.to.id()).weight(10).strokeDasharray("1,5").text("updates")}return{vertices:this.vertices,edges:this.edges,hierarchy:this.hierarchy}}};f(si,"GraphAdapter");let ri=si;const ai=class _DSTable extends u.ChartPanel{constructor(e){super(),this._ec=e,this.buttons([this._addButton,this._removeButton,new i.Spacer,this._cloneButton,new i.Spacer,this._addSamples]).widget(this._dstable).columns(["ID","Type","References"]).on("click",(e,t,i)=>{this._selectedDS2=e.__lparam,i&&0===e.References&&"Empty"!==e.ID?this._selectedDS=e.__lparam:delete this._selectedDS,this._removeButton.enabled(void 0!==this._selectedDS).render(),this._cloneButton.enabled(void 0!==this._selectedDS2).render()}),this.initMenu()}_ec;_addButton=(new i.Button).faChar("fa-plus").tooltip("Add...").on("click",()=>{const e=this._addButton.element().node(),t=e.getBoundingClientRect();this._contextMenu.open({target:e,currentTarget:e,clientX:t.left,clientY:t.bottom})});_removeButton=(new i.Button).faChar("fa-minus").tooltip("Remove...").enabled(!1).on("click",()=>{this.remove()});_cloneButton=(new i.Button).faChar("fa-clone").tooltip("Clone...").enabled(!1).on("click",()=>{this._selectedDS2&&(this._selectedDS2 instanceof H?this.add(H.fromDDL(this._selectedDS2.toDDL(),!0)):this._selectedDS2 instanceof N?this.add(N.fromDDL(this._selectedDS2.toDDL(),!0)):this._selectedDS2 instanceof oe?this.add(oe.fromDDL(this._ec,this._selectedDS2.toDDL(),!0)):this._selectedDS2 instanceof de?this.add(new de(this._ec).service(ue.fromDDL(this._ec,this._selectedDS2.service().toDDL(),!0)).resultName(this._selectedDS2.resultName())):this._selectedDS2 instanceof ee?this.add(new ee(this._ec).wu(ie.fromDDL(this._ec,this._selectedDS2.wu().toDDL(),!0)).resultName(this._selectedDS2.resultName())):this._selectedDS2 instanceof Fe?this.add(new Fe(this._ec).service(be.fromDDL(this._ec,this._selectedDS2.service().toDDL(),!0)).resultName(this._selectedDS2.resultName())):console.warn("Unknown datasoure type"))});_addSamples=(new i.Button).faChar("fa-database").tooltip("Add Samples").on("click",()=>{Mt("https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/airports.csv").then(e=>{this.add((new H).format("csv").payload(e))}),Mt("https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/carriers.csv").then(e=>{this.add((new H).format("csv").payload(e))}),Mt("https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/stats.csv").then(e=>{this.add((new H).format("csv").payload(e))}),this.add(new de(this._ec).service(new ue(this._ec).url("https://cmsapi.pulselive.com/").action("rugby/rankings/mru").requestFields([(new le).fieldID("xxx"),(new le).fieldID("date")])).resultName("entries")),this.add(new ee(this._ec).wu(new ie(this._ec).url("http://localhost:8010").wuid("W20190802-112509")).resultName("Result 1")),this.add(new oe(this._ec).url("http://localhost:8010").logicalFile("progguide::exampledata::peopleaccts")),this.add(new oe(this._ec).url("http://localhost:8010").logicalFile("progguide::exampledata::people"));const e=new be(this._ec).url("http://localhost:8002").querySet("roxie").queryID("peopleaccounts");this.add(new Fe(this._ec).service(e).resultName("Accounts")),this.add((new N).formFields([(new q).type("number").fieldID("id").value(8),(new q).fieldID("first_name").value("John"),(new q).fieldID("last_name").value("Doe"),(new q).fieldID("gender").default("M"),(new q).type("number").fieldID("age")])),this.render()});_dstable=new o.Table;_selectedDS;_selectedDS2;_contextMenu;initMenu(){const e=new c.CommandRegistry;e.addCommand("add_wu_result",{label:"Workunit Result",execute:f(()=>{this.add(new ee(this._ec))},"execute")}),e.addCommand("add_logicalfile",{label:"Logical File",execute:f(()=>{this.add(new oe(this._ec))},"execute")}),e.addCommand("add_roxie",{label:"Roxie Service",execute:f(()=>{this.add(new Fe(this._ec))},"execute")}),e.addCommand("add_rest",{label:"Rest",execute:f(()=>{this.add(new de(this._ec))},"execute")}),e.addCommand("add_databomb",{label:"Databomb",execute:f(()=>{this.add(new H)},"execute")}),e.addCommand("add_form",{label:"Form",execute:f(()=>{this.add(new N)},"execute")}),this._contextMenu=new c.ContextMenu({commands:e}),this._contextMenu.addItem({command:"add_wu_result",selector:".common_Button"}),this._contextMenu.addItem({command:"add_logicalfile",selector:".common_Button"}),this._contextMenu.addItem({command:"add_roxie",selector:".common_Button"}),this._contextMenu.addItem({command:"add_rest",selector:".common_Button"}),this._contextMenu.addItem({command:"add_databomb",selector:".common_Button"}),this._contextMenu.addItem({command:"add_form",selector:".common_Button"})}add(e){this._ec.appendDatasource(e),this.render()}remove(){this._selectedDS&&(this._ec.removeDatasource(this._selectedDS),this.render())}_prevDataID;render(e){const t={};this._ec.elements().forEach(e=>{let i=e.hipiePipeline().datasource();i instanceof $e&&(i=i.datasource()),void 0===t[i.id()]&&(t[i.id()]=0),t[i.id()]++});const i=this._ec.datasources().filter(e=>"Empty"!==e.id()).map(e=>(void 0===t[e.id()]&&(t[e.id()]=0),[e.id(),e.classID(),t[e.id()]||0,e])),s=JSON.stringify(t);return this._prevDataID!==s&&(this._prevDataID=s,this.data(i)),super.render(e)}};f(ai,"DSTable");let oi=ai;const ni=class _DVTable extends u.ChartPanel{constructor(e){super(),this._ec=e,this.titleVisible(!1).widget(this._dvtable).columns(["ID","Title"])}_ec;_dvtable=new o.Table;_prevDataID;render(e){const t=this._ec.elements().map(e=>[e.id(),e.visualization().title(),e]),i=s.hashSum(t.map(e=>e[0]));return this._prevDataID!==i&&(this._prevDataID=i,this.data(t)),super.render(e)}};f(ni,"DVTable");let li=ni;const hi=class _PipelineSelectionButton extends i.SelectionButton{_label;label(e){return arguments.length?(this._label=e,this.tooltip(e),this):this._label}_elementErrors=[];errors(e){return arguments.length?(this._elementErrors=e,this.classed("error",e.length>0),e.length?this.tooltip(e.map(e=>{const t=e.source.split(".");return t.splice(0,1),`${t.join(".")}: ${e.msg}`}).join("\n")):this.tooltip(this._label),this.render(),this):this._elementErrors}};f(hi,"PipelineSelectionButton");let ui=hi;const ci=class _PipelinePanel extends u.ChartPanel{_owner;datasource=(new ui).faChar("fa-database").label("Datasource").selected(!0);filter=(new ui).faChar("fa-filter").label("Filter");project=(new ui).faChar("fa-random").label("Project");groupBy=(new ui).faChar("fa-object-group").label("Group By");sort=(new ui).faChar("fa-sort-alpha-asc").label("Sort");limit=(new ui).faChar("fa-list-ol").label("Limit");mappings=(new ui).faChar("fa-random").label("Mappings");chartPanel=(new ui).faChar("fa-area-chart").label("Visualization");state=(new ui).faChar("fa-check-square-o").label("State");debug=(new ui).faChar("fa-bug").label("Debug");all=(new ui).faChar("fa-list").label("All");_propEditor=(new p.PropertyEditor).show_header(!1).show_settings(!1).showFields(!1);_buttons=[this.datasource,this.filter,this.project,this.groupBy,this.sort,this.limit,new i.Spacer,this.mappings,this.chartPanel,new i.Spacer,this.state,this.debug,new i.Spacer,this.all];_pipelineButton=this.datasource;_pipelineSelection=(new i.SelectionBar).buttons(this._buttons).on("selected",e=>{this._pipelineButton=e,this.title(e.label()).render()});constructor(e){super(),this._owner=e,this.buttons([this._pipelineSelection]),this.title(this.datasource.label()),super.widget(this._propEditor),this._propEditor.monitor((e,t,i,s)=>{s!==this._propEditor&&(this.propChanged(e,t,i,s),this.updateState())})}selectionButtons(){return this._pipelineSelection.buttons().filter(e=>e instanceof ui)}_propExt;propExt(e){return arguments.length?(this._propExt=e,this):this._propExt}peAsDatasource(){return this._propExt instanceof B||this._propExt instanceof $e?this._propExt:this._propExt instanceof Et?this._propExt.hipiePipeline().datasource():void 0}peAsFilter(){return this._propExt instanceof qe?this._propExt:this._propExt instanceof Et?this._propExt.hipiePipeline().filters():void 0}peAsProject(){return this._propExt instanceof at?this._propExt:this._propExt instanceof Et?this._propExt.hipiePipeline().project():void 0}peAsGroupBy(){return this._propExt instanceof Je?this._propExt:this._propExt instanceof Et?this._propExt.hipiePipeline().groupBy():void 0}peAsSort(){return this._propExt instanceof ct?this._propExt:this._propExt instanceof Et?this._propExt.hipiePipeline().sort():void 0}peAsLimit(){return this._propExt instanceof Qe?this._propExt:this._propExt instanceof Et?this._propExt.hipiePipeline().limit():void 0}peAsMappings(){return this._propExt instanceof nt?this._propExt:this._propExt instanceof Et?this._propExt.visualization().mappings():this._propExt instanceof Lt?this._propExt.mappings():void 0}peAsChartPanel(){return this._propExt instanceof u.ChartPanel||this._propExt instanceof Lt?this._propExt:this._propExt instanceof Et?this._propExt.visualization():void 0}peAsState(){return this._propExt instanceof It?this._propExt:this._propExt instanceof Et?this._propExt.state():void 0}selectionButton(){if(this._pipelineButton&&this._pipelineButton.enabled())return this._pipelineButton;for(const e of this.selectionButtons())if(e.enabled())return e.selected(!0),e}_prevPropExt;_prevPipelineButton;update(e,t){super.update(e,t),this.updateState();const i=this.selectionButton();if(this._prevPropExt!==this._propExt||this._prevPipelineButton!==i){if(this._prevPropExt=this._propExt,this._prevPipelineButton=i,this._propExt&&i)switch(i){case this.datasource:this._propEditor.widget(this.peAsDatasource());break;case this.filter:this._propEditor.widget(this.peAsFilter());break;case this.project:this._propEditor.widget(this.peAsProject());break;case this.groupBy:this._propEditor.widget(this.peAsGroupBy());break;case this.sort:this._propEditor.widget(this.peAsSort());break;case this.limit:this._propEditor.widget(this.peAsLimit());break;case this.mappings:this._propEditor.widget(this.peAsMappings());break;case this.chartPanel:this._propEditor.widget(this.peAsChartPanel());break;case this.state:this._propEditor.widget(this.peAsState());break;case this.all:this._propEditor.widget(this._propExt)}else this._propEditor.widget(void 0);this._owner.loadPreview(this._propEditor.widget())}}updateButtonState(e,t){t.enabled(!!e),t.errors(!!e&&e.validate()||[])}updateState(){this.selectionButtons().forEach(e=>{if(e instanceof ui&&this.disableActivities().indexOf(e.label())>=0)this.updateButtonState(void 0,e);else{switch(e){case this.datasource:this.updateButtonState(this.peAsDatasource(),e);break;case this.filter:this.updateButtonState(this.peAsFilter(),e);break;case this.project:this.updateButtonState(this.peAsProject(),e);break;case this.groupBy:this.updateButtonState(this.peAsGroupBy(),e);break;case this.sort:this.updateButtonState(this.peAsSort(),e);break;case this.limit:this.updateButtonState(this.peAsLimit(),e);break;case this.mappings:this.updateButtonState(this.peAsMappings(),e);break;case this.chartPanel:const t=this.peAsChartPanel();e.enabled(!!t);break;case this.state:const i=this.peAsState();e.enabled(!!i);break;case this.debug:e.enabled(!1);break;case this.all:e.enabled(!!this._propExt)}e.selected()&&this.title(e.enabled()?e.label():"")}})}propChanged(e,t,i,s){}};f(ci,"PipelinePanel");let di=ci;di.prototype._class+=" marshaller_PipelinePanel";let pi=(m=class extends u.ChartPanel{_save=(new i.Button).faChar("fa-save").tooltip("Save").on("click",()=>{const e=this.activity();e&&e.fromDDL&&e.fromDDL(this._jsonEditor.json()),this.updateToolbar()});_reset=(new i.Button).faChar("fa-undo").tooltip("Reset").on("click",()=>{this._jsonEditor.text(this.jsonText()).lazyRender(),this.updateToolbar()});_jsonEditor=(new d.JSONEditor).on("changes",e=>{this.updateToolbar()});constructor(){super(),this._titleBar.buttons([this._save,this._reset]),this.widget(this._jsonEditor)}_activity;activity(e){return void 0===e?this._activity:(this._activity!==e&&(this._activity=e,delete this._prevJson),this)}jsonText(){const e=this.activity();return e&&e.toDDL?JSON.stringify(e.toDDL(),void 0,4):""}_prevJson;update(e,t){super.update(e,t);const i=this.jsonText(),s=this._jsonEditor.text();void 0!==this._prevJson&&this._prevJson!==s||this._prevJson===i||(this._prevJson=i,this._jsonEditor.text(i)),this.updateToolbar()}updateToolbar(){const e=this.activity(),t=this.jsonText(),i=this._jsonEditor.text();this._save.enabled(e&&e.fromDDL&&t!==i).lazyRender(),this._reset.enabled(t!==i).lazyRender()}},f(m,"DDLPreview"),m);const mi=class _PipelineSplitPanel extends c.SplitPanel{_rhsPropsPanel=new di(this).on("propChanged",(e,t,i,s)=>{this.propChanged(e,t,i,s)});_previewPanel=new c.TabPanel;_rhsDDLPreview=new pi;_rhsDataPreview=(new o.DatasourceTable).pagination(!0);constructor(){super(),this._previewPanel.addWidget(this._rhsDataPreview,"Data").addWidget(this._rhsDDLPreview,"DDL"),this.addWidget(this._rhsPropsPanel).addWidget(this._previewPanel)}loadDataProps(e){this._rhsPropsPanel.propExt(e).render()}loadPreview(e){e=e instanceof Lt?e.mappings():e,this._rhsDataPreview.datasource(new K(e instanceof S?e:void 0)).lazyRender(),this._rhsDDLPreview.activity(e).lazyRender()}refreshPreview(){const e=this._rhsDataPreview.datasource();e?e.exec().then(()=>{this._rhsDataPreview.invalidate().lazyRender(),this._rhsDDLPreview.lazyRender()}):this._rhsDDLPreview.lazyRender()}propChanged(e,t,i,s){}};f(mi,"PipelineSplitPanel");let _i=mi;di.prototype.publish("disableActivities",[],"array","Disabled pipeline items"),_i.prototype.publishProxy("disableActivities","_rhsPropsPanel");const fi=s.scopedLogger("marshaller/dashy"),Di=class _DDLPreview extends u.ChartPanel{constructor(e){super(),this._dashy=e,this._titleBar.buttons([this._save,this._reset]),this.widget(this._jsonEditor)}_dashy;_save=(new i.Button).faChar("fa-save").tooltip("Save").on("click",()=>{const e=JSON.parse(this._jsonEditor.text());this._dashy.importDDL(e),this.updateToolbar()});_reset=(new i.Button).faChar("fa-undo").tooltip("Reset").on("click",()=>{this._jsonEditor.text(this._ddl).lazyRender(),this.updateToolbar()});_jsonEditor=(new d.JSONEditor).on("changes",e=>{this.updateToolbar()});_ddl;ddl(e){return this._ddl=JSON.stringify(e,void 0,4),this}_prevJson;update(e,t){super.update(e,t),this._prevJson!==this._ddl&&(this._prevJson=this._ddl,this._jsonEditor.text(this._ddl)),this.updateToolbar()}updateToolbar(){const e=this._jsonEditor.text();this._save.enabled(this._ddl!==e).lazyRender(),this._reset.enabled(this._ddl!==e).lazyRender()}};f(Di,"DDLPreview");let vi=Di;const gi=class _Dashy extends c.SplitPanel{_elementContainer=new zt;_lhsSheet=new c.TabPanel;_lhsDashboard=new ei(this._elementContainer).on("vizActivation",(e,t)=>{this.focus(this._lhsDashboard,e)}).on("vizStateChanged",e=>{for(const t of this._elementContainer.filteredBy(e.id()))this.focus()===t&&this._rhsSplitView.refreshPreview()});_lhsDataviews=new li(this._elementContainer).on("click",(e,t,i,s)=>{this.focus(this._lhsDataviews,e.__lparam),this._rhsSplitView.refreshPreview()});_lhsDatasources=new oi(this._elementContainer).on("click",(e,t,i,s)=>{this.focus(this._lhsDatasources,e.__lparam),this._rhsSplitView.refreshPreview()});_graphAdapter=new ri(this._elementContainer);_lhsPipeline=(new l.Graph).layout("Hierarchy").allowDragging(!1).applyScaleOnLayout(!0).on("vertex_click",(e,t,i,s)=>{const r=e.__lparam[0]||{};this.focus(this._lhsPipeline,r.state||r.chartPanel||r.visualization||r.activity||r.view)}).on("vertex_contextmenu",(e,t,i,s)=>{});_lhsDebugSheet=new c.TabPanel;_lhsDebugDDLEditor=new vi(this);_lhsDebugDDLSchema=(new d.JSONEditor).json(r.ddl2Schema);_lhsDebugJSEditor=new d.JSEditor;_lhsDebugCloneEC=new zt;_lhsDebugClone=new ei(this._lhsDebugCloneEC).hideSingleTabs(!0).titleVisible(!1);_lhsDebugDDLv1=new d.JSONEditor;_lhsDebugDDLv2=new d.JSONEditor;_rhsSplitView=new _i;_fileOpen;static create(e,t,i,s){return new Promise((r,a)=>{const o=(new _Dashy).target(e).render(e=>{t?e.importDDL(t,i,s).then(()=>{r(o)}):r(o)})})}constructor(){super("horizontal")}elementContainer(){return this._elementContainer}clear(){return this._lhsDebugSheet.removeWidget(this._lhsDebugDDLv1),this._lhsDebugSheet.removeWidget(this._lhsDebugDDLv2),this._elementContainer.clear(),this._graphAdapter.clear(),this.focus(this._lhsDashboard,void 0),this.loadDashboard().then(()=>this._elementContainer.refresh()).then(e=>{})}save(){return this._lhsDashboard.save()}serializeDDL(){return JSON.stringify(this.save())}deserializeDDL(e){return this.restore(JSON.parse(e))}restore(e){return this._lhsSheet.active(this._lhsDashboard),this.clear().then(()=>(this._lhsDashboard.restore(e),this._lhsDataviews.render(),this._lhsDatasources.render(),this._lhsDashboard.renderPromise().then(()=>{const e=this._elementContainer.elements();return e.length&&this._lhsDashboard.activate(e[0]),this._elementContainer.refresh()}).then(()=>{let e=!1;for(const t of this._elementContainer.validate())e=!0,fi.warning(t.elementID+" ("+t.source+"): "+t.msg);e&&this._lhsDashboard.renderPromise()})))}importDDL(e,t,i,s={}){const a=r.isDDL2Schema(e)?e:r.upgrade(e,t,i,!0,s),o=this.restore(a);return r.isDDL2Schema(e)?(this._lhsDebugDDLv2.json(a),this._lhsDebugSheet.addWidget(this._lhsDebugDDLv2,"orig v2")):(this._lhsDebugDDLv1.json(e),this._lhsDebugDDLv2.json(a),this._lhsDebugSheet.addWidget(this._lhsDebugDDLv1,"v1").addWidget(this._lhsDebugDDLv2,"v1 -> v2")),o}activeLHS(){let e=this._lhsSheet.active();return e===this._lhsDebugSheet&&(e=this._lhsDebugSheet.active()),e}activeRHS(){return this._rhsSplitView}_currSelection={};focusAsElement(){const e=this.focus();return e instanceof Et?e:void 0}focus(e,t){return arguments.length?(this._currSelection[e.id()]!==t&&(this._currSelection[e.id()]=t,this.loadRHSSplit()),this):this._currSelection[this.activeLHS().id()]}loadRHSSplit(){this._rhsSplitView.loadDataProps(this.focus())}loadDataviews(){return this.activeLHS()===this._lhsDataviews?this._lhsDataviews.renderPromise():Promise.resolve(void 0)}loadDatasources(){return this.activeLHS()===this._lhsDatasources?this._lhsDatasources.renderPromise():Promise.resolve(void 0)}loadDashboard(){return this.activeLHS()===this._lhsDashboard?(this._elementContainer.validate(),this._lhsDashboard.renderPromise()):Promise.resolve(void 0)}loadGraph(){this._lhsPipeline.data({...this._graphAdapter.createGraph()},!0),this.activeLHS()===this._lhsPipeline&&this._lhsPipeline.lazyRender()}loadDDL(){this._lhsDebugDDLEditor.ddl(this._lhsDashboard.ddl()),this.activeLHS()===this._lhsDebugDDLEditor&&this._lhsDebugDDLEditor.lazyRender()}loadJavaScript(){this._lhsDebugJSEditor.javascript(this._lhsDashboard.javascript()),this.activeLHS()===this._lhsDebugJSEditor&&this._lhsDebugJSEditor.lazyRender()}loadClone(){const e=this.save();this._lhsDebugCloneEC.clear(),this._lhsDebugClone.renderPromise().then(()=>{this._lhsDebugClone.restore(e),this._lhsDebugClone.renderPromise().then(()=>this._lhsDebugCloneEC.refresh()).then(()=>{for(const e of this._lhsDebugCloneEC.validate())fi.warning(e.elementID+" ("+e.source+"): "+e.msg)})})}initMenu(){const e=new c.CommandRegistry;e.addCommand("dash_add",{label:"Add View",execute:f(()=>{const e=new Et(this._elementContainer);this._elementContainer.append(e),this.loadDashboard().then(()=>{e.refresh().then(()=>{this._lhsDashboard.activate(e)})})},"execute")}),e.addCommand("dash_clear",{label:"Clear",execute:f(()=>{this.clear()},"execute")}),e.addCommand("dash_save",{label:"Save",execute:f(()=>{const e=JSON.stringify(this.save(),null," ");i.Utility.downloadString("JSON",e,"dashy")},"execute")}),e.addCommand("dash_load",{label:"Open",execute:f(()=>{this._fileOpen.property("accept",".dashy,.json"),this._fileOpen.node().click()},"execute")});const t=new c.CommandPalette({commands:e});t.addItem({command:"addWUResult",category:"Notebook"}),t.addItem({command:"addView",category:"Notebook"}),t.addItem({command:"remove",category:"Notebook"}),t.id="palette";const s=new c.ContextMenu({commands:e});s.addItem({command:"dash_add",selector:`#${this._lhsDashboard.id()}`}),s.addItem({command:"dash_clear",selector:`#${this._lhsDashboard.id()}`}),s.addItem({type:"separator",selector:`#${this._lhsDashboard.id()}`}),s.addItem({command:"dash_load",selector:`#${this.id()}`}),s.addItem({command:"dash_save",selector:`#${this.id()}`}),document.addEventListener("contextmenu",e=>{s.open(e)&&e.preventDefault()})}addDatabomb(e,t,i){const s=(new H).id(e).format(i).payload(t);this._elementContainer.appendDatasource(s);const r=new Et(this._elementContainer),a=r.hipiePipeline().datasource();a instanceof $e&&a.datasourceID(s.id()),this._elementContainer.append(r),this.loadDashboard().then(()=>{r.refresh().then(()=>{this._lhsDashboard.activate(r)})})}enter(e,t){super.enter(e,t),this.addWidget(this._lhsSheet).addWidget(this._rhsSplitView),this._lhsSheet.addWidget(this._lhsDashboard,"Dashboard").addWidget(this._lhsDataviews,"Dataviews").addWidget(this._lhsDatasources,"Datasources").addWidget(this._lhsPipeline,"Pipeline").addWidget(this._lhsDebugSheet,"Debug").on("childActivation",e=>{switch(e){case this._lhsDataviews:case this._lhsDatasources:case this._lhsDashboard:this.loadRHSSplit();break;case this._lhsPipeline:this.loadRHSSplit(),this.loadGraph();break;case this._lhsDebugSheet:this._lhsDebugSheet.childActivation(this._lhsDebugSheet.active())}}),this._lhsDebugSheet.addWidget(this._lhsDebugDDLEditor,"v2").addWidget(this._lhsDebugDDLSchema,"Schema").addWidget(this._lhsDebugJSEditor,"TS").addWidget(this._lhsDebugClone,"Clone").on("childActivation",e=>{switch(e){case this._lhsDebugDDLEditor:this.loadRHSSplit(),this.loadDDL();break;case this._lhsDebugJSEditor:this.loadRHSSplit(),this.loadJavaScript();break;case this._lhsDebugClone:this.loadClone()}}),this.initMenu(),this._rhsSplitView.on("propChanged",(e,t,i,s)=>{const r=this.focusAsElement();switch(r?r.refresh().then(()=>{this._rhsSplitView.refreshPreview()}):this._rhsSplitView.refreshPreview(),this.activeLHS()){case this._lhsDashboard:this.loadDashboard();break;case this._lhsDatasources:this._elementContainer.refresh();break;case this._lhsPipeline:this.loadGraph();break;case this._lhsDebugDDLEditor:this.loadDDL();break;case this._lhsDebugClone:this.loadClone()}});const i=this;this._fileOpen=t.append("input").attr("type","file").property("accept",".dashy,.json").style("display","none").on("change",function(){const e=this.files[0];for(;e;){const t=new FileReader;t.onload=function(){return function(e){try{const t=Array.isArray(e.target.result)?e.target.result[0]:e.target.result,s=JSON.parse(t);i.importDDL(s)}catch(t){alert("ex when trying to parse json = "+t)}}}(),t.readAsText(e);break}})}update(e,t){super.update(e,t)}};f(gi,"Dashy");let yi=gi;yi.prototype._class+=" composite_Dashy",yi.prototype.publishProxy("disableActivities","_rhsSplitView"),Object.defineProperty(e,"hookSend",{enumerable:!0,get:f(()=>t.hookSend,"get")}),e.Activity=S,e.ActivityArray=C,e.ActivityPipeline=$,e.ActivitySelection=E,e.AggregateField=He,e.BUILD_VERSION=y,e.ColumnMapping=Ae,e.ComputedField=Ze,e.ComputedMapping=Xe,e.DDLAdapter=Jt,e.DDLEditor=ii,e.DSPicker=$e,e.Dashboard=ei,e.Dashy=yi,e.Databomb=H,e.Datasource=B,e.DatasourceAdapt=K,e.DatasourceRef=j,e.ESPResult=Y,e.Element=Et,e.ElementContainer=zt,e.Filters=qe,e.Form=N,e.FormField=q,e.GraphAdapter=ri,e.GroupBy=Je,e.GroupByColumn=Ne,e.HipiePipeline=pt,e.HipieResultRef=Le,e.JavaScriptAdapter=Yt,e.Limit=Qe,e.LogicalFile=oe,e.Mappings=nt,e.MultiField=tt,e.NullView=ft,e.PKG_NAME=v,e.PKG_VERSION=g,e.Project=at,e.ProjectBase=st,e.RemoteFilter=Be,e.RoxieResult=Fe,e.RoxieResultRef=Pe,e.RoxieService=be,e.Sort=ct,e.SortColumn=ht,e.State=It,e.StaticFilter=je,e.Visualization=Lt,e.VizChartPanel=yt,e.VizPopupPanel=vt,e.VizTypeSet=wt,e.WU=ie,e.WUResult=ee,e.WUResultRef=re,e.createProps=Kt,e.emptyDatabomb=U,e.rowToFields=O,e.schemaRow2IField=F,e.schemaType2IFieldType=w,e.stringify=b,e.wsEclSchemaRow2IField=x,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@hpcc-js/comms"),require("@hpcc-js/common"),require("@hpcc-js/util"),require("@hpcc-js/ddl-shim"),require("@hpcc-js/chart"),require("@hpcc-js/dgrid"),require("@hpcc-js/form"),require("@hpcc-js/graph"),require("@hpcc-js/map"),require("@hpcc-js/layout"),require("@hpcc-js/phosphor"),require("@hpcc-js/codemirror"),require("@hpcc-js/other")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/comms","@hpcc-js/common","@hpcc-js/util","@hpcc-js/ddl-shim","@hpcc-js/chart","@hpcc-js/dgrid","@hpcc-js/form","@hpcc-js/graph","@hpcc-js/map","@hpcc-js/layout","@hpcc-js/phosphor","@hpcc-js/codemirror","@hpcc-js/other"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@hpcc-js/marshaller"]={},e["@hpcc-js/comms"],e["@hpcc-js/common"],e["@hpcc-js/util"],e["@hpcc-js/ddl-shim"],e["@hpcc-js/chart"],e["@hpcc-js/dgrid"],e["@hpcc-js/form"],e["@hpcc-js/graph"],e["@hpcc-js/map"],e["@hpcc-js/layout"],e["@hpcc-js/phosphor"],e["@hpcc-js/codemirror"],e["@hpcc-js/other"])}(this,function(e,t,i,s,r,a,o,n,l,h,u,c,d,p){"use strict";var m,_=Object.defineProperty,f=(e,t)=>_(e,"name",{value:t,configurable:!0}),D=(e,t,i)=>((e,t,i)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i);const v="@hpcc-js/marshaller",g="3.2.2",y="3.25.0";function b(e){if(Array.isArray(e))return"["+e.map(b).join(", ")+"]";if("object"!=typeof e||null==e)return JSON.stringify(e);return`{ ${Object.keys(e).map(t=>`${t}: ${b(e[t])}`).join(", ")} }`}function w(e){switch(e){case"boolean":return"boolean";case"xs:byte":case"xs:double":case"xs:decimal":case"xs:float":case"xs:int":case"xs:short":case"xs:unsignedInt":case"xs:unsignedShort":case"xs:unsignedByte":case"number":return"number";case"xs:integer":case"xs:long":case"xs:negativeInteger":case"xs:nonNegativeInteger":case"xs:nonPositiveInteger":case"xs:positiveInteger":case"xs:unsignedLong":return"number64";case"string":return"string";case"range":return"range"}return"string"}function F(e){return e._children&&e._children.length?{type:"dataset",id:e.name,children:e._children.map(F)}:{id:e.name,type:w(e.type)}}function x(e){return e}f(b,"stringify"),f(w,"schemaType2IFieldType"),f(F,"schemaRow2IField"),f(x,"wsEclSchemaRow2IField");const P=class _Activity extends i.PropertyExt{_sourceActivity;fixInt64(e){if(!e||0===e.length)return[];const t=this.outFields().filter(t=>{switch(t.type){case"number":return"number"!=typeof e[0][t.id];case"number64":return!0}return!1});return t.length?e.map(e=>{for(const i of t)e[i.id]=+e[i.id];return e}):e}sourceActivity(e){return arguments.length?(this._sourceActivity=e,this):this._sourceActivity}hash(e={}){return s.hashSum({...e})}refreshMeta(){return this._sourceActivity?this._sourceActivity.refreshMeta():Promise.resolve()}exists(){return!0}validate(){return[]}label(){return this.id()}updatedBy(){return[]}_emptyFields=[];inFields(){return this._sourceActivity?this._sourceActivity.outFields():this._emptyFields}computeFields(e){return()=>e}outFields(){return this.computeFields(this.inFields())()}localFields(){const e=this.inFields().map(e=>e.id);return this.outFields().filter(t=>e.indexOf(t.id)<0)}fieldOrigin(e){return this.localFields().filter(t=>t.id===e).length?this:this.sourceActivity()?this.sourceActivity().fieldOrigin(e):null}resolveFields(e,t){for(const i of t){const t=this.fieldOrigin(i);t&&(e.outputs[t.id()]||(e.outputs[t.id()]=[]),e.outputs[t.id()].indexOf(i)<0&&e.outputs[t.id()].push(i))}}resolveInFields(e,t){return this._sourceActivity&&this._sourceActivity.resolveFields(e,t)}referencedFields(e){this._sourceActivity?.referencedFields(e)}exec(){return this._sourceActivity?this._sourceActivity.exec():Promise.resolve()}_emptyData=[];inData(){return this._sourceActivity&&this._sourceActivity.outData()||this._emptyData}computeData(){return this.inData()}_prevDataHash="";_prevInData=[];_prevData=[];cachedComputeData(e){const t=this.hash();return this._prevDataHash===t&&this._prevInData===e||(this._prevDataHash=t,this._prevInData=e,this._prevData=s.update(this._prevData,this.computeData())),this._prevData}outData(){return this.cachedComputeData(this.inData())}};f(P,"Activity");let S=P;const L=class _ActivityArray extends S{_activities=[];activities(e){return arguments.length?(this._activities=e,this):this._activities}};f(L,"ActivityArray");let C=L;C.prototype._class+=" ActivityArray";const I=class _ActivityPipeline extends C{activities(e){if(!arguments.length)return super.activities();let t;super.activities(e);for(const i of e)t&&i.sourceActivity(t),t=i;return this}first(){return this.activities()[0]}last(){const e=this.activities();return e[e.length-1]}calcUpdatedGraph(e){return e.updatedBy().map(t=>({from:t,to:e}))}updatedByGraph(){let e=[];for(const t of this.activities())e=e.concat(this.calcUpdatedGraph(t));return e}fetch(e=0,t=Number.MAX_VALUE){return this.exec().then(()=>{const i=this.outData();return 0===e&&i.length<=t?i:i.slice(e,e+t)})}hash(e={}){return s.hashSum({activities:[this.activities().map(e=>e.hash())],...e})}refreshMeta(){return this.last().refreshMeta()}updatedBy(){let e=[];for(const t of this.activities())e=e.concat(t.updatedBy());return e}inFields(){return this.first().inFields()}outFields(){return this.last().outFields()}localFields(){return this.last().localFields()}fieldOrigin(e){return this.last().fieldOrigin(e)}referencedFields(e){this.last().referencedFields(e)}resolveInFields(e,t){this.last().resolveInFields(e,t)}resolveFields(e,t){this.last().resolveFields(e,t)}exec(){return this.last().exec()}outData(){return this.last().outData()}};f(I,"ActivityPipeline");let $=I;$.prototype._class+=" ActivitySequence";const R=class _ActivitySelection extends C{_selection;_monitorHandle;selection(e){return void 0===e?this._selection:(this._monitorHandle&&this._monitorHandle.remove(),this._selection=e,this._monitorHandle=e.monitor((t,i,s)=>{this.broadcast(t,i,s,e)}),this)}hash(e={}){return s.hashSum({selection:this.selection().hash(),...e})}label(){return this.selection().label()}refreshMeta(){return this.selection().refreshMeta()}updatedBy(){return this.selection().updatedBy()}inFields(){return this.selection().inFields()}outFields(){return this.selection().outFields()}localFields(){return this.selection().localFields()}fieldOrigin(e){return this.selection().fieldOrigin(e)}referencedFields(e){this.selection().referencedFields(e)}resolveInFields(e,t){this.selection().resolveInFields(e,t)}resolveFields(e,t){this.selection().resolveFields(e,t)}exec(){return this.selection().exec()}outData(){return this.selection().outData()}};f(R,"ActivitySelection");let E=R;E.prototype._class+=" ActivitySelection";let A=0;const z=class _Datasource extends S{constructor(){super(),this._id="ds_"+ ++A}};f(z,"Datasource");let B=z;const M=class _DatasourceRef extends S{_origDatasource;constructor(){super()}hash(e={}){return super.hash({datasource:this._datasource?this._datasource.hash(e):void 0,...e})}toDDL(){return{id:this.datasource().id()}}};f(M,"DatasourceRef");let j=M;j.prototype._class+=" DatasourceRef",j.prototype.publish("datasource",null,"widget","Datasource Reference",null,{internal:!0}),j.prototype._origDatasource=j.prototype.datasource,j.prototype.datasource=function(e){const t=j.prototype._origDatasource.apply(this,arguments);return void 0!==e&&this.sourceActivity(e),t};const k=class _FormField extends i.PropertyExt{_owner;disableChildField(){return"dataset"!==this.type()}constructor(){super()}toDDL(){return{type:this.type(),id:this.fieldID(),default:this.default(),children:"dataset"===this.type()?this.childFields().map(e=>e.toDDL()):void 0}}fromDDL(e){return this.type(e.type).fieldID(e.id).default(e.default).childFields("dataset"===e.type&&e.children?e.children.map(_FormField.fromDDL):[])}static fromDDL(e){return(new _FormField).fromDDL(e)}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.type()&&!!this.fieldID()}coerceFunc(){switch(this.type()){case"boolean":return e=>!!e;case"number":return e=>+e;case"string":return e=>""+e}return e=>e}calcValue(){return this.value_exists()?this.value():this.default()}};f(k,"FormField");let q=k;const V=class _Form extends B{constructor(){super()}toDDL(){return{type:"form",id:this.id(),fields:this.validFields().map(e=>e.toDDL())}}fromDDL(e,t=!1){return(t?this:this.id(e.id)).formFields(e.fields.map(q.fromDDL)),this}static fromDDL(e,t=!1){return(new _Form).fromDDL(e,t)}validFields(){return this.formFields().filter(e=>e.valid())}hash(e={}){return super.hash({ddl:this.toDDL(),...e})}refreshMeta(){return Promise.resolve()}label(){return"Form"}computeFields(e){const t=this.validFields().map(e=>e.toDDL());return()=>t}exec(){return Promise.resolve()}computeData(){const e={};return this.validFields().forEach(t=>{e[t.fieldID()]=t.calcValue()}),[e]}total(){return 1}};f(V,"Form");let N=V;function T(e){if(s.isArray(e))return"dataset";const t=typeof e;switch(t){case"boolean":case"number":case"string":case"object":return t}return"string"}function O(e,t){const i=[];for(const s in e){const r={type:T(e[s]),id:s};switch(r.type){case"object":for(const e of t){let t=!1;for(const i in e[s]){const i=O(e[s],[e[s]]);r.fields={},i.length&&(i.forEach(e=>r.fields[e.id]=e),t=!0);break}if(t)break}break;case"dataset":for(const e of t)if(e[s]&&e[s].length){r.children=O(e[s][0],e[s]);break}}i.push(r)}return i}N.prototype._class+=" Form",q.prototype.publish("type","string","set","FormField Type",["boolean","number","string","dataset"]),q.prototype.publish("fieldID","","string","FormField Label"),q.prototype.publish("default",null,"any","Default Value",null,{optional:!0}),q.prototype.publish("value",null,"any","Default Value",null,{optional:!0}),q.prototype.publish("childFields",[],"propertyArray","Child Fields",null,{autoExpand:q,disable:f(e=>e.disableChildField(),"disable")}),N.prototype.publish("formFields",[],"propertyArray","Multi Fields",null,{autoExpand:q}),f(T,"fieldType"),f(O,"rowToFields");const W=class _Databomb extends B{_jsonData=[];constructor(){super()}toDDL(e=!1){return{type:"databomb",id:this.id(),format:this.format(),payload:e?void 0:this.payload(),fields:this.validFields().map(e=>e.toDDL())}}fromDDL(e,t=!1){return(t?this:this.id(e.id)).format(e.format).payload(e.payload).databombFields(e.fields.map(q.fromDDL)),this}static fromDDL(e,t=!1){return(new _Databomb).fromDDL(e,t)}validFields(){return this.databombFields().filter(e=>e.valid())}updateJsonData(){try{switch(this.format()){case"csv":this._jsonData=i.csvParse(this.payload());break;case"tsv":this._jsonData=i.tsvParse(this.payload());break;default:this._jsonData=JSON.parse(this.payload())}this.databombFields(this.preCalcFields().map(q.fromDDL))}catch(e){this.databombFields([]),this._jsonData=[]}}hash(e){return super.hash({ddl:this.toDDL(!0),...e})+this.payload()}refreshMeta(){return Promise.resolve()}label(){return"Databomb"}preCalcFields(){return 0===this._jsonData.length?[]:O(this._jsonData[0],this._jsonData)}computeFields(e){return()=>this.validFields().map(e=>e.toDDL())}exec(){return Promise.resolve()}computeData(){const e={};return this.validFields().forEach(t=>{e[t.fieldID()]=t.coerceFunc()}),this._jsonData.map(t=>{const i={};for(const s in e)i[s]=e[s](t[s]);return i})}total(){return this._jsonData.length}};f(W,"Databomb");let H=W;H.prototype._class+=" Databomb",H.prototype.publish("format","json","set","Databomb Format",["json","csv","tsv"]),H.prototype.publish("payload","","string","Databomb array",null,{multiline:!0}),H.prototype.publish("databombFields",[],"propertyArray","Multi Fields",null,{autoExpand:q});const G=H.prototype.format;H.prototype.format=function(e){const t=G.apply(this,arguments);return arguments.length&&this.updateJsonData(),t};const J=H.prototype.payload;H.prototype.payload=function(e){const t=J.apply(this,arguments);return arguments.length&&this.updateJsonData(),t};const U=(new H).id("Empty").payload("[]"),Q=class _DatasourceAdapt{_activity;constructor(e){this._activity=e||U}exec(){return this._activity.refreshMeta().then(()=>this._activity.exec())}id(){return this._activity.id()}hash(e={}){return this._activity.hash(e)}label(){return this._activity.label()}outFields(){return this._activity&&this._activity.outFields?this._activity.outFields():[]}total(){return this._activity?this._activity.outData().length:0}fetch(e,t){return this.exec().then(()=>{const i=this._activity.outData();return 0===e&&i.length<=t?Promise.resolve(i):Promise.resolve(i.slice(e,e+t))})}};f(Q,"DatasourceAdapt");let K=Q;const X=class _ESPResult extends B{constructor(e){super(),this._ec=e,this.samples(this._ec.samples()).sampleSize(this._ec.sampleSize())}_ec;_result;_schema=[];_meta=[];_total;_data=[];hash(e={}){return s.hashSum({samples:this.samples(),sampleSize:this.sampleSize(),...e})}_prevMetaHash;refreshMetaPromise;refreshMeta(){return this._prevMetaHash!==this.hash()&&(this._prevMetaHash=this.hash(),delete this.refreshMetaPromise),this.refreshMetaPromise||(this.refreshMetaPromise=super.refreshMeta().then(()=>{if(this._result=this._createResult(),this._result)return this._result.refresh();throw new Error("No valid result")}).then(e=>{this._total=e.Total,this._schema=e.fields(),this._meta=this._meta&&this._meta.length?this._meta:this._schema.map(F)}).catch(e=>{this._total=0,this._schema=[],this._meta=[]})),this.refreshMetaPromise}responseFields(e){return arguments.length?(this._meta=e,this.refreshMeta(),this):this._meta}computeFields(e){return()=>this.responseFields()}exec(){return this._exec()}_prevExecHash;_exec=s.debounce(()=>this._prevExecHash!==this.hash()?(this._prevExecHash=this.hash(),super.exec().then(()=>this.sample()).then(e=>{this._data=this.fixInt64(e)}).catch(e=>{this._data=[]})):Promise.resolve());inData(){return this._data}computeData(){return this._data}total(){return this._total}async fetch(e,t){return t>this.samples()*this.sampleSize()?this.sample():this._fetch(e,t)}_fetchQ=new s.AsyncOrderedQueue;_fetch(e,t){return this._fetchQ.push(this._result?this._result.fetchRows(e,t).catch(e=>[]):Promise.resolve([]))}sample=s.debounce((e=this.samples(),t=this.sampleSize())=>{const i=[];if(e*t>=this.total())i.push(this._fetch(0,this.total()));else{const s=this.total()-t;for(let r=0;r<e;++r)i.push(this._fetch(Math.floor(r*s/e),t))}return Promise.all(i).then(e=>{let t=[];for(const i of e)t=t.concat(i);return t})})};f(X,"ESPResult");let Y=X;Y.prototype._class+=" ESPResult";const Z=class _WUResult extends Y{_origWu;_origResultName;constructor(e){super(e),this._wu=new ie(this._ec)}url(){return this._wu.url()}wuid(){return this._wu.wuid()}toDDL(){return{type:"wuresult",id:this.id(),url:this._wu.url(),wuid:this.wuid(),outputs:{[this.resultName()]:{fields:this.responseFields()}}}}fromDDL(e,t=!1){return e.outputs[this.resultName()]?this.responseFields(e.outputs[this.resultName()].fields):this}static fromDDL(e,t,i,s,r=!1){return new _WUResult(e).wu(i).resultName(s).fromDDL(t)}_createResult(){if(this._wu.url()&&this.wuid()&&this.resultName())return t.Result.attach({baseUrl:this._wu.url(),hookSend:this._ec.hookSend()},this.wuid(),this.resultName())}sourceHash(){return super.hash({wuid:this.wuid()})}hash(e){return super.hash({ddl:this.toDDL()})}label(){return`${this.wuid()}\n${this.resultName()}`}};f(Z,"WUResult");let ee=Z;ee.prototype._class+=" WUResult";const te=class _WU extends B{constructor(e){super(),this._ec=e}_ec;_origUrl;_origWuid;_workunit;_outputs={};toDDL(){const e={};for(const t in this._outputs)e[t]={fields:this._outputs[t].responseFields()};return{type:"wuresult",id:this.id(),url:this.url(),wuid:this.wuid(),outputs:e}}fromDDL(e,t=!1){(t?this:this.id(e.id)).url(e.url).wuid(e.wuid);const i={};for(const s in e.outputs)i[s]=ee.fromDDL(this._ec,e,this,s);return this._outputs=i,this}static fromDDL(e,t,i=!1){return new _WU(e).fromDDL(t,i)}hash(){return s.hashSum({url:this.url(),wuid:this.wuid()})}label(){return this.wuid()}outputs(){const e=[];for(const t in this._outputs)e.push(this._outputs[t]);return e}outputDDL(){const e={};for(const t in this._outputs)e[t]={fields:this._outputs[t].outFields()};return e}output(e){return this._outputs[e]}_prevSourceHash;refreshMetaPromise;_resultNames=[];refreshMeta(){return this.url()&&this.wuid()?(this._prevSourceHash!==this.hash()&&(this._prevSourceHash=this.hash(),delete this.refreshMetaPromise),this.refreshMetaPromise||(this.refreshMetaPromise=super.refreshMeta().then(()=>(this._workunit=t.Workunit.attach({baseUrl:this.url(),hookSend:this._ec.hookSend()},this.wuid()),this._workunit.fetchResults())).then(e=>{this._resultNames=e.map(e=>e.Name)}).catch(e=>{})),this.refreshMetaPromise):Promise.resolve()}resultNames(){return this._resultNames}};f(te,"WU");let ie=te;ie.prototype._class+=" WU";const se=class _WUResultRef extends j{datasource(e){return super.datasource.apply(this,arguments)}resultName(e){return arguments.length?(this.datasource().resultName(e),this):this.datasource().resultName()}toDDL(){return{id:this.datasource().wu().id(),output:this.resultName()}}};f(se,"WUResultRef");let re=se;re.prototype._class+=" WUResultRef",Y.prototype.publish("samples",10,"number","Number of samples"),Y.prototype.publish("sampleSize",100,"number","Sample size"),ee.prototype.publish("wu",null,"widget","Workunit"),ee.prototype.publish("resultName","","set","Result Name",function(){return void 0!==this._wu?this._wu.resultNames():[]}),ee.prototype._origWu=ee.prototype.wu,ee.prototype.wu=function(e){const t=ee.prototype._origWu.apply(this,arguments);return void 0!==e&&this._wu.refreshMeta(),t},ee.prototype._origResultName=ee.prototype.resultName,ee.prototype.resultName=function(e){const t=this._resultName,i=ee.prototype._origResultName.apply(this,arguments);return void 0!==e&&t!==e&&this.responseFields([]),i},ie.prototype.publish("url","","string","ESP Url (http://x.x.x.x:8010)"),ie.prototype.publish("wuid","","string","Workunit ID"),ie.prototype._origUrl=ie.prototype.url,ie.prototype.url=function(e){const t=ie.prototype._origUrl.apply(this,arguments);return void 0!==e&&this.refreshMeta(),t},ie.prototype._origWuid=ie.prototype.wuid,ie.prototype.wuid=function(e){const t=ie.prototype._origWuid.apply(this,arguments);return void 0!==e&&this.refreshMeta(),t};const ae=class _LogicalFile extends Y{constructor(e){super(e)}toDDL(){return{type:"logicalfile",id:this.id(),url:this.url(),logicalFile:this.logicalFile(),fields:this.responseFields()}}fromDDL(e,t=!1){return(t?this:this.id(e.id)).url(e.url).logicalFile(e.logicalFile),this}static fromDDL(e,t,i=!1){return new _LogicalFile(e).fromDDL(t,i)}_createResult(){return t.Result.attachLogicalFile({baseUrl:this.url(),hookSend:this._ec.hookSend()},this.nodeGroup(),this.logicalFile())}sourceHash(){return super.hash({logicalFile:this.logicalFile()})}hash(e){return super.hash({ddl:this.toDDL()})}label(){return`${this.logicalFile()}`}};f(ae,"LogicalFile");let oe=ae;oe.prototype._class+=" LogicalFile",oe.prototype.publish("url","","string","ESP Url (http://x.x.x.x:8010)"),oe.prototype.publish("nodeGroup","","string","Node Group"),oe.prototype.publish("logicalFile","","string","Logical File Name");const ne=class _RestField extends i.PropertyExt{_owner;constructor(){super()}toDDL(){return{type:"string",id:this.fieldID()}}fromDDL(e){return this.fieldID(e.id)}static fromDDL(e){return(new _RestField).fromDDL(e)}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.fieldID()}};f(ne,"RestField");let le=ne;const he=class _RestService extends B{constructor(e){super(),this._ec=e}_ec;_responseFields={};toDDL(){return{type:"rest",id:this.id(),url:this.url(),action:this.action(),mode:this.mode(),inputs:this.validRequestFields().map(e=>e.toDDL()),outputs:this.outputDDL()}}fromDDL(e,t=!1){(t?this:this.id(e.id)).url(e.url).action(e.action).mode(e.mode||"get").requestFields(e.inputs.map(le.fromDDL));for(const i in e.outputs)this.responseFields(i,e.outputs[i].fields);return this}static fromDDL(e,t,i=!1){return new _RestService(e).fromDDL(t,i)}hash(e={}){return s.hashSum({url:this.url(),action:this.action(),mode:this.mode(),...e})}label(){return this.action()}responseFields(e,t){return 1===arguments.length?this._responseFields[e]||[]:(this._responseFields[e]=t,this)}validRequestFields(){return this.requestFields().filter(e=>e.valid())}_prevRequestHash;_prevPromise;_submitQ=new s.AsyncOrderedQueue;submit(e){const i=s.hashSum(e);if(!this._prevPromise||this._prevRequestHash!==i){this._prevRequestHash=i;const s=t.createConnection({baseUrl:this.url(),type:this.mode()});this._prevPromise=this._submitQ.push(s.send(this.action(),e))}return this._prevPromise}resultNames(){const e=[];for(const t in this._responseFields)e.push(t);return e}outputDDL(){const e={};return this.resultNames().forEach(t=>{e[t]={fields:this._responseFields[t]}}),e}};f(he,"RestService");let ue=he;ue.prototype._class+=" RestService";const ce=class _RestResult extends B{constructor(e){super(),this._ec=e,this._service=new ue(this._ec)}_ec;_origService;validRequestFields(){return this.service().validRequestFields()}toDDL(){return this.service().toDDL()}fromDDL(e){return this.service().fromDDL(e),this}static fromDDL(e,t,i){return new _RestResult(e).id(`${t.id()}_${i}`).service(t).resultName(i)}serviceID(){return`${this.service().url()}/${this.service().action()}}`}sourceHash(){return this.service().hash()}requestFields(){return this.service().requestFields().map(e=>e.toDDL())}responseFields(e){return arguments.length?(this.service().responseFields(this.resultName(),e),this):this.service().responseFields(this.resultName())}hash(e={}){return s.hashSum({source:this.sourceHash(),resultName:this.resultName(),...e})}label(){return`${this.service().label()}\n${this.resultName()}`}_jsonData=[];jsonDataFields(){if(!this._jsonData||!this._jsonData.length)return[];const e=O(this._jsonData[0],this._jsonData);return this.responseFields(e),e}computeFields(e){return()=>this.jsonDataFields()}computeData(){return this._jsonData}submit(e){return this.service().submit(e).then(e=>{const t=this.resultName(),i=t?t.split("."):[];for(const s of i)e=(e||{})[s];return this._jsonData=e,e})}formatRequest(){const e={};return this.service().validRequestFields().forEach(t=>{e[t.fieldID()]=""}),e}exec(){return this.submit(this.formatRequest()).then(e=>{})}};f(ce,"RestResult");let de=ce;de.prototype._class+=" RestResult";const pe=class _Param extends i.PropertyExt{constructor(e){super(),this._ec=e}_ec;validate(e){const t=[];return this.source_valid()||t.push({source:`${e}.source.${this.source()}`,msg:`Invalid source: "${this.source()}"`,hint:`expected: ${JSON.stringify(this.visualizationIDs())}`}),this.remoteField_valid()||t.push({source:`${e}.remoteField`,msg:`Invalid remoteField: "${this.remoteField()}"`,hint:`expected: ${JSON.stringify(this.sourceOutFields())}`}),this.value_valid()||t.push({source:`${e}.value`,msg:`Invalid value: "${this.value()}"`,hint:"expected: any value."}),t}toDDL(){return{source:this.source(),remoteFieldID:this.remoteField(),localFieldID:this.localField(),value:this.value()}}fromDDL(e){return this.source(e.source).remoteField(e.remoteFieldID).localField(e.localFieldID).value(e.value)}static fromDDL(e,t){return new _Param(e).fromDDL(t)}hash(){return s.hashSum({label:this.localField(),source:this.source(),sourceField:this.remoteField()})}visualizationIDs(){return this._ec.elementIDs()}sourceFields(){return this.sourceOutFields().map(e=>e.id)}sourceViz(){return this._ec.element(this.source())}sourceOutFields(){return this.sourceViz().hipiePipeline().selectionFields()}sourceSelection(){return this.sourceViz().selection()}calcValue(){if(this.source_exists()&&this.remoteField_exists()){return this.sourceSelection().map(e=>e[this.remoteField()])}return this.value_exists()?[this.value()]:[""]}exists(){return this.localField_exists()&&(this.source_exists()&&this.remoteField_exists()||this.value_exists())}};f(pe,"Param");let me=pe;me.prototype._class+=" Param";const _e=class _RestResultRef extends j{constructor(e){super(),this._ec=e}_ec;serviceID(){return this.datasource().serviceID()}_data=[];datasource(e){return super.datasource.apply(this,arguments)}url(){return this.datasource().service().url()}action(){return this.datasource().service().action()}resultName(){return this.datasource().resultName()}validate(){let e=[];for(const t of this.validParams())e=e.concat(t.validate("request"));return e}toDDL(){return{id:this.datasource().service().id(),output:this.resultName(),request:this.validParams().map(e=>({source:e.source(),remoteFieldID:e.remoteField(),localFieldID:e.localField(),value:e.value()}))}}sourceHash(){return this.datasource().hash()}requestFieldRefs(e){return arguments.length?(this.request(e.map(e=>me.fromDDL(this._ec,e))),this):this.validParams().map(e=>e.toDDL())}requestFields(){return this.datasource().requestFields()}responseFields(){return this.datasource().responseFields()}hash(){return this.datasource().hash({resultName:this.resultName(),request:this.formatRequest()})}label(){return`${this.datasource().label()}\n${this.datasource().resultName()}`}elementIDs(){return this._ec.elementIDs()}element(e){return this._ec.element(e)}referencedFields(e){super.referencedFields(e);for(const t of this.validParams()){const i=t.sourceViz().hipiePipeline();e.inputs[this.id()]||(e.inputs[this.id()]=[]),e.inputs[this.id()].push(t.localField()),i.resolveFields(e,[t.remoteField()])}super.resolveFields(e,[])}validParams(){return this.request().filter(e=>e.exists())}refreshMeta(){return this.datasource().refreshMeta().then(()=>{const e=this.request(),t=s.compare(e.map(e=>e.localField()),this.datasource().validRequestFields().map(e=>e.fieldID())),i=e.filter(e=>t.update.indexOf(e.localField())>=0);this.request(i.concat(t.enter.map(e=>new me(this._ec).localField(e))))})}updatedBy(){return this.validParams().map(e=>e.source())}computeFields(e){return this.datasource().computeFields(e)}formatRequest(){const e=this.datasource().formatRequest();return this.request().forEach(t=>{void 0!==e[t.localField()]&&(e[t.localField()]=t.calcValue()||e[t.localField()])}),e}_prevRequestHash;_prevRequestPromise;exec(){const e=this.formatRequest(),t=s.hashSum({hash:this.hash(),request:e});return this._prevRequestHash!==t&&(this._prevRequestHash=t,this._prevRequestPromise=this.datasource().submit(e).then(e=>(this._data=this.fixInt64(e),this._data))),this._prevRequestPromise}inData(){return this._data}computeData(){return this._data}};f(_e,"RestResultRef");let fe=_e;function De(e){const t=e.split("/WsEcl/submit/query/");if(t.length<2)throw new Error(`Invalid roxie URL: ${e}`);const i=t[0].split(":");if(i.length<3)throw new Error(`Invalid roxie URL: ${e}`);const s=t[1].split("/");if(s.length<2)throw new Error(`Invalid roxie URL: ${e}`);return{url:`${i[0]}:${i[1]}:${"18002"===i[2]?"18010":"8010"}`,querySet:s[0],queryID:s[1]}}function ve(e){return e.length>=8&&e.indexOf("_changed")===e.length-8}function ge(e){return e.length>=8&&e.indexOf("_changed")===e.length-8||["HIPIE_DDL","HIPIE_DDLGLOBALS","hipieversion"].indexOf(e)>=0}fe.prototype._class+=" RestResultRef",le.prototype.publish("fieldID","","string","RestField Label"),ue.prototype.publish("url","","string","REST Url"),ue.prototype.publish("action","","string","Query Set"),ue.prototype.publish("mode","get","set","Request mode",["get","post"]),ue.prototype.publish("requestFields",[],"propertyArray","Multi Fields",null,{autoExpand:le}),de.prototype.publish("service",null,"widget","Rest service"),de.prototype.publish("resultName","","string","Result Name"),de.prototype._origService=de.prototype.service,de.prototype.service=function(e){const t=de.prototype._origService.apply(this,arguments);return void 0!==e&&this._service.refreshMeta(),t},me.prototype.publish("localField",null,"string","Label"),me.prototype.publish("source",null,"set","Activity",function(){return this.visualizationIDs()},{optional:!0,disable:f(e=>e.value_exists(),"disable"),validate:f(e=>e.source_disabled()||e.visualizationIDs().indexOf(e.source())>=0,"validate")}),me.prototype.publish("remoteField",null,"set","Source Field",function(){return this.sourceFields()},{optional:!0,disable:f(e=>!e.source_exists()||e.value_exists(),"disable"),validate:f(e=>e.remoteField_disabled()||e.sourceFields().indexOf(e.remoteField())>=0,"validate")}),me.prototype.publish("value",null,"string","Static Value",null,{optional:!0,disable:f(e=>e.source_exists(),"disable"),validate:f(e=>e.value_disabled()||e.value_exists(),"validate")}),fe.prototype.publish("request",[],"propertyArray","Request Fields"),f(De,"parseUrl"),f(ve,"isHipieRequest"),f(ge,"isHipieResponse");const ye=class _RoxieService extends B{constructor(e){super(),this._ec=e}_ec;_query;_requestFields;_responseFields={};_type="roxie";toDDL(){return{type:this._type,id:this.id(),url:this.url(),querySet:this.querySet(),queryID:this.queryID(),inputs:this.requestFields(),outputs:this.outputDDL()}}fromDDL(e,t=!1){this._type=e.type,(t?this:this.id(e.id)).url(e.url).querySet(e.querySet).queryID(e.queryID),e.inputs&&e.inputs.length&&this.requestFields(e.inputs);for(const i in e.outputs)this.responseFields(i,e.outputs[i].fields);return this}static fromDDL(e,t,i=!1){return new _RoxieService(e).fromDDL(t,i)}hash(e={}){return s.hashSum({url:this.url(),querySet:this.querySet(),queryId:this.queryID(),ignoreHipieRequest:this.ignoreHipieRequest(),ignoreHipieResponse:this.ignoreHipieResponse(),...e})}label(){return this.queryID()}_prevSourceHash;refreshMetaPromise;refreshMeta(){if(this._prevSourceHash!==this.hash()&&(this._prevSourceHash=this.hash(),delete this.refreshMetaPromise),!this.refreshMetaPromise){const e=!!this._requestFields;this.refreshMetaPromise=new Promise((i,s)=>{const r=t.Query.attach({baseUrl:this.url(),hookSend:this._ec.hookSend()},this.querySet(),this.queryID());(!e||this.ignoreHipieRequest()||this.ignoreHipieResponse())&&i(r.refresh()),i(r)}).then(t=>{this._query=t,e&&!this.ignoreHipieRequest()||(this._requestFields=t.requestFields().filter(e=>"roxie"===this._type||!ve(e.id))),e&&!this.ignoreHipieResponse()||t.resultNames().filter(e=>"roxie"===this._type||!ge(e)).forEach(e=>{this._responseFields[e]=t.resultFields(e)})})}return this.refreshMetaPromise}requestFields(e){return arguments.length?(this._requestFields=e,this):this._requestFields||[]}responseFields(e,t){return 1===arguments.length?this._responseFields[e]||[]:(this._responseFields[e]=t,this)}_prevRequestHash;_prevPromise;_submitQ=new s.AsyncOrderedQueue;submit(e){const t=s.hashSum(e);return this._prevPromise&&this._prevRequestHash===t||(this._prevRequestHash=t,this._prevPromise=this._submitQ.push(this._query.submit(e))),this._prevPromise}resultNames(){const e=[];for(const t in this._responseFields)e.push(t);return e}outputDDL(){const e={};return this.resultNames().forEach(t=>{e[t]={fields:this._responseFields[t]}}),e}};f(ye,"RoxieService");let be=ye;be.prototype._class+=" RoxieService",be.prototype.publish("url","","string","ESP Url (http://x.x.x.x:8002)"),be.prototype.publish("querySet","","string","Query Set"),be.prototype.publish("queryID","","string","Query ID"),be.prototype.publish("ignoreHipieRequest",!1,"boolean","Ignore provided DDL request"),be.prototype.publish("ignoreHipieResponse",!1,"boolean","Ignore provided DDL response");const we=class _RoxieResult extends B{constructor(e){super(),this._ec=e,this._service=new be(this._ec)}_ec;_origService;toDDL(){return this.service().toDDL()}fromDDL(e){return this.service().fromDDL(e),this}static fromDDL(e,t,i){return new _RoxieResult(e).id(`${t.id()}_${i}`).service(t).resultName(i)}serviceID(){return`${this.service().url()}/${this.service().querySet()}/${this.service().queryID()}`}sourceHash(){return this.service().hash()}requestFields(){return this.service().requestFields()}responseFields(e){return arguments.length?(this.service().responseFields(this.resultName(),e),this):this.service().responseFields(this.resultName())}hash(e={}){return s.hashSum({source:this.sourceHash(),resultName:this.resultName(),...e})}label(){return`${this.service().label()}\n${this.resultName()}`}computeFields(e){return()=>this.service().responseFields(this.resultName())}refreshMeta(){return this.service().refreshMeta()}submit(e){return this.service().submit(e)}};f(we,"RoxieResult");let Fe=we;Fe.prototype._class+=" RoxieResult",Fe.prototype.publish("service",null,"widget","Roxie service"),Fe.prototype.publish("resultName","","set","Result Name",function(){return void 0!==this._service?this._service.resultNames():[]}),Fe.prototype._origService=Fe.prototype.service,Fe.prototype.service=function(e){const t=Fe.prototype._origService.apply(this,arguments);return void 0!==e&&this._service.refreshMeta(),t};const xe=class _RoxieResultRef extends j{constructor(e){super(),this._ec=e}_ec;serviceID(){return this.datasource().serviceID()}_data=[];datasource(e){return super.datasource.apply(this,arguments)}url(){return this.datasource().service().url()}querySet(){return this.datasource().service().querySet()}queryID(){return this.datasource().service().queryID()}resultName(){return this.datasource().resultName()}validate(){let e=[];for(const t of this.validParams())e=e.concat(t.validate("request"));return e}toDDL(){return{id:this.datasource().service().id(),output:this.resultName(),request:this.validParams().map(e=>({source:e.source(),remoteFieldID:e.remoteField(),localFieldID:e.localField(),value:e.value()}))}}sourceHash(){return this.datasource().hash()}requestFieldRefs(e){return arguments.length?(this.request(e.map(e=>me.fromDDL(this._ec,e))),this):this.validParams().map(e=>e.toDDL())}requestFields(){return this.datasource().requestFields()}responseFields(){return this.datasource().responseFields()}hash(){return this.datasource().hash({resultName:this.resultName(),params:this.request().map(e=>e.hash()),request:this.formatRequest()})}label(){return`${this.datasource().label()}\n${this.datasource().resultName()}`}elementIDs(){return this._ec.elementIDs()}element(e){return this._ec.element(e)}referencedFields(e){super.referencedFields(e);const t=[];for(const i of this.validParams()){t.push(i.localField());const s=i.sourceViz().hipiePipeline();e.inputs[this.id()]||(e.inputs[this.id()]=[]),e.inputs[this.id()].push(i.localField()),s.resolveFields(e,[i.remoteField()])}super.resolveFields(e,t)}validParams(){return this.request().filter(e=>e.exists())}refreshMeta(){return this.datasource().refreshMeta().then(()=>{const e=this.request(),t=s.compare(e.map(e=>e.localField()),this.datasource().requestFields().map(e=>e.id)),i=e.filter(e=>t.update.indexOf(e.localField())>=0);this.request(i.concat(t.enter.map(e=>new me(this._ec).localField(e))))})}updatedBy(){return this.validParams().map(e=>e.source())}computeFields(e){return()=>this.datasource().responseFields()}formatRequest(){const e={};let t=!1;const i=this.datasource().requestFields();for(const s of this.validParams()){const r=s.calcValue();let a;a="set"===i.filter(e=>e.id===s.localField())[0].type?{Item:r}:r[0],void 0!==a&&(e[s.localField()]=a),t=!0}return t||(e.refresh=!0),e}_prevRequestHash;_prevRequestPromise;exec(){return super.exec().then(()=>{const e=this.formatRequest(),t=s.hashSum({hash:this.hash(),request:e});return this._prevRequestHash!==t&&(this._prevRequestHash=t,this._prevRequestPromise=this.datasource().submit(e).then(e=>{const t=this.datasource().resultName();let i=e[t];return i||(i=e[t.toLowerCase().replace(/ /g,"_")]),this.fixInt64(i)})),this._prevRequestPromise}).then(e=>{this._data=e})}inData(){return this._data}computeData(){return this._data}};f(xe,"RoxieResultRef");let Pe=xe;Pe.prototype._class+=" RoxieResultRef",Pe.prototype.publish("request",[],"propertyArray","Request Fields");const Se=class _HipieResultRef extends Pe{fullUrl(e){const t=De(e);return this.datasource().service().url(t.url),this.datasource().service().querySet(t.querySet),this.datasource().service().queryID(t.queryID),this}formatRequest(){const e=super.formatRequest(),t={};for(const i in e)t[i]=e[i],t[`${i}_changed`]=!0;return t}};f(Se,"HipieResultRef");let Le=Se;Le.prototype._class+=" HipieResultRef";let Ce=0;const Ie=class _DSPicker extends E{constructor(e){super(),this._ec=e,this._id="ds_"+ ++Ce;const t=this._ec.datasources()[0];this.datasourceID(t.id())}_ec;_nullDatasource=U;_origDatasourceID;_origDatasourceRef;datasource(){return this.datasourceRef().datasource()}refreshRef(e){const t=this._ec.datasource(e);t instanceof H||t instanceof N||t instanceof oe||t instanceof be?this.selection((new j).datasource(t)):t instanceof ee?this.selection((new re).datasource(t)):t instanceof Fe?this.selection(new Le(this._ec).datasource(t)):t instanceof de&&this.selection(new fe(this._ec).datasource(t))}selection(e){const t=super.selection.apply(this,arguments);return arguments.length?(this._datasourceID!==e.datasource().id()&&(this._datasourceID=e.datasource().id()),this):t||this._nullDatasource}validate(){return this.selection().validate()}toDDL(){return{...this.datasourceRef().toDDL(),id:this.datasourceID()}}hash(e={}){return super.hash({...e})}datasourceIDs(){return this._ec.datasources().map(e=>({value:e.id(),text:`${e.label()} ${e.id()!==e.label()?` (${e.id()})`:""}`}))}};f(Ie,"DSPicker");let $e=Ie;function Re(e,t,i){const s="string"==typeof i;switch(e){case"==":return e=>s&&"string"==typeof e[t]?e[t].trim()===i:e[t]===i;case"!=":return e=>s&&"string"==typeof e[t]?e[t].trim()!==i:e[t]!==i;case"<":return e=>e[t]<i;case"<=":return e=>e[t]<=i;case">":return e=>e[t]>i;case">=":return e=>e[t]>=i;default:throw new Error(`Unknown filter condition: ${e}`)}}$e.prototype._class+=" DSPicker",$e.prototype.publish("datasourceID","","set","Activity",function(){return this.datasourceIDs()},{optional:!1}),$e.prototype.publish("datasourceRef","","widget","Activity"),$e.prototype._origDatasourceID=$e.prototype.datasourceID,$e.prototype.datasourceID=function(e){const t=this._datasourceID,i=$e.prototype._origDatasourceID.apply(this,arguments);return void 0!==e&&t!==e&&this.refreshRef(e),i},$e.prototype._origDatasourceRef=$e.prototype.datasourceRef,$e.prototype.datasourceRef=function(e){return E.prototype.selection.apply(this,arguments)},f(Re,"createFilter");const Ee=class _ColumnMapping extends i.PropertyExt{_owner;validate(e){const t=[];return this.remoteField_valid()||t.push({source:`${e}.remoteField`,msg:`Invalid remoteField: "${this.remoteField()}"`,hint:`expected: ${JSON.stringify(this.sourceOutFields())}`}),this.localField_valid()||t.push({source:`${e}.localField`,msg:`Invalid localField: "${this.localField()}"`,hint:`expected: ${JSON.stringify(this.localFields())}`}),t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return this.localField_exists()||this.remoteField_exists()}toDDL(){return{remoteFieldID:this.remoteField(),localFieldID:this.localField(),condition:this.condition(),nullable:this.nullable()}}fromDDL(e){return this.remoteField(e.remoteFieldID).localField(e.localFieldID).condition(e.condition).nullable(e.nullable)}static fromDDL(e){return(new _ColumnMapping).fromDDL(e)}hash(){return s.hashSum({remoteField:this.remoteField(),localField:this.localField(),condition:this.condition(),nullable:this.nullable()})}localFields(){return this._owner.inFields().map(e=>e.id)}sourceOutFields(){return this._owner.sourceOutFields().map(e=>e.id)}remoteValues(e){const t=this.remoteField();return e.map(e=>{const i=e[t];return"string"==typeof i?i.trim():i})}createFilterDescription(e){switch(this.condition()){case"in":case"range":return`${this.localField()} ${this.condition()} [${this.remoteValues(e).join(", ")}]`;default:return`${this.localField()} ${this.condition()} ${this.remoteValues(e)[0]}`}}createFilter(e){const t=this.localField(),i=this.remoteValues(e);switch(this.condition()){case"range":return this.nullable()&&(i.length<2||i[0]===i[1])?e=>!0:e=>e[t]>=i[0]&&e[t]<=i[1];case"in":return this.nullable()&&0===i.length?e=>!0:e=>i.some(i=>"string"==typeof e[t]?e[t].trim()===i:e[t]===i);default:const e=i[0];return!this.nullable()||null!=e&&""!==e?Re(this.condition(),t,e):e=>!0}}};f(Ee,"ColumnMapping");let Ae=Ee;Ae.prototype._class+=" ColumnMapping";const ze=class _RemoteFilter extends i.PropertyExt{_owner;validate(e){let t=[];this.source_valid()||t.push({source:`${e}.source.${this.source()}`,msg:`Invalid source: "${this.source()}"`,hint:`expected: ${JSON.stringify(this.visualizationIDs())}`}),this.source_exists()&&0===this.validMappings().length&&t.push({source:`${e}.source.${this.source()}`,msg:`Invalid mappings: "${this.source()}"`,hint:"expected minimum of 1 mapping"});for(const i of this.validMappings())t=t.concat(i.validate(`${e}.${this.source()}.mappings`));return t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.source()&&this.validMappings().length>0}toDDL(){return{viewID:this.source(),mappings:this.ddlMappings()}}fromDDL(e){return this.source(e.viewID).ddlMappings(e.mappings)}static fromDDL(e){return(new _RemoteFilter).fromDDL(e)}ddlMappings(e){return arguments.length?(this.mappings(e.map(e=>Ae.fromDDL(e))),this):this.validMappings().map(e=>e.toDDL())}visualizationIDs(){return this._owner.visualizationIDs()}hash(){return s.hashSum({source:this.source(),mappings:this.validMappings().map(e=>e.hash()),selection:this.sourceSelection()})}validMappings(){return this.mappings().filter(e=>e.valid())}appendMappings(e){for(const t of e)this.mappings().push((new Ae).owner(this).remoteField(t.remoteField).localField(t.localField).condition(t.condition));return this}inFields(){return this._owner.inFields()}sourceViz(){return this._owner.visualization(this.source())}sourceOutFields(){return this.sourceViz().hipiePipeline().selectionFields()}sourceSelection(){return this.sourceViz().selection()}createFilter(){const e=this.sourceSelection(),t=this.validMappings().map(t=>t.createFilter(e));return e=>t.every(t=>t(e))}createFilterDescription(){const e=this.sourceSelection();return this.validMappings().map(t=>t.createFilterDescription(e)).join(", ")}};f(ze,"RemoteFilter");let Be=ze;Be.prototype._class+=" Filter";const Me=class _StaticFilter extends i.PropertyExt{_owner;validate(e){const t=[];return this.localField_valid()||t.push({source:`${e}.localField`,msg:`Invalid localField: "${this.localField()}"`,hint:`expected: ${JSON.stringify(this.localFields())}`}),t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}coerceValue(e){return 0===arguments.length?"number"===this.valueType()?+this.value():""+this.value():(this.value(e),"number"==typeof e?this.valueType("number"):this.valueType("string"),this)}valid(){return this.localField_exists()&&this.value_exists()}toDDL(){return{localFieldID:this.localField(),condition:this.condition(),value:this.coerceValue()}}fromDDL(e){return this.localField(e.localFieldID).condition(e.condition).coerceValue(e.value)}static fromDDL(e){return(new _StaticFilter).fromDDL(e)}hash(){return s.hashSum({localField:this.localField(),condition:this.condition(),value:this.value(),valueType:this.valueType()})}localFields(){return this._owner.inFields().map(e=>e.id)}createFilterDescription(){return`${this.localField()} ${this.condition()} ${this.coerceValue()}`}createFilter(){return Re(this.condition(),this.localField(),this.coerceValue())}};f(Me,"StaticFilter");let je=Me;je.prototype._class+=" StaticFilter";const ke=class _Filters extends S{constructor(e){super(),this._ec=e}_ec;validate(){let e=[];for(const t of this.validFilters())e=e.concat(t.validate("filter"));return e}toDDL(){return{type:"filter",conditions:this.conditions()}}fromDDL(e){return this.conditions(e.conditions)}static fromDDL(e,t){return new _Filters(e).fromDDL(t)}conditions(e){if(!arguments.length)return this.validFilters().map(e=>e.toDDL());const t=[],i=[];return e.forEach(e=>{r.DDL2.isIFilterCondition(e)?t.push(Be.fromDDL(e)):i.push(je.fromDDL(e))}),this.remoteFilter(t),this.staticFilter(i),this}visualizationIDs(){return this._ec.elementIDs()}visualization(e){return this._ec.element(e)}hash(){return s.hashSum(this.validFilters().map(e=>({filter:e.hash()})))}exists(){return this.validFilters().length>0}updatedBy(){return this.validRemoteFilters().map(e=>e.source())}referencedFields(e){super.referencedFields(e);const t=[];for(const i of this.validRemoteFilters()){const s=i.sourceViz().hipiePipeline(),r=[];for(const e of i.validMappings())t.push(e.localField()),r.push(e.remoteField());s.resolveFields(e,r)}super.resolveInFields(e,t)}exec(){return super.exec()}computeData(){const e=super.computeData();if(0===e.length||!this.exists())return e;const t=this.validFilters().map(e=>e.createFilter());return e.filter(e=>t.every(t=>t(e)))}validRemoteFilters(){return this.remoteFilter().filter(e=>e.valid())}validStaticFilters(){return this.staticFilter().filter(e=>e.valid())}validFilters(){return[...this.validRemoteFilters(),...this.validStaticFilters()]}};f(ke,"Filters"),D(ke,"Filter",Be),D(ke,"Mapping",Ae);let qe=ke;qe.prototype._class+=" Filters",Ae.prototype.publish("remoteField",null,"set","Filter Fields",function(){return this.sourceOutFields()},{optional:!0,disable:f(e=>!e._owner.source(),"disable"),validate:f(e=>e.sourceOutFields().indexOf(e.remoteField())>=0,"validate")}),Ae.prototype.publish("localField",null,"set","Local Fields",function(){return this.localFields()},{optional:!0,disable:f(e=>!e._owner.source(),"disable"),validate:f(e=>e.localFields().indexOf(e.localField())>=0,"validate")}),Ae.prototype.publish("condition","==","set","Filter Fields",["==","!=",">",">=","<","<=","range","in"]),Ae.prototype.publish("nullable",!1,"boolean","Ignore null filters"),Be.prototype.publish("source",null,"set","Activity",function(){return this.visualizationIDs()},{optional:!0,validate:f(e=>e.visualizationIDs().indexOf(e.source())>=0,"validate")}),Be.prototype.publish("mappings",[],"propertyArray","Mappings",null,{autoExpand:Ae}),je.prototype.publish("localField",null,"set","Local Fields",function(){return this.localFields()},{optional:!0,validate:f(e=>e.localFields().indexOf(e.localField())>=0,"validate")}),je.prototype.publish("condition","==","set","Filter Fields",["==","!=",">",">=","<","<="]),je.prototype.publish("value","","any","Static Value"),je.prototype.publish("valueType","number","set","Static Value Type",["number","string"]),qe.prototype.publish("remoteFilter",[],"propertyArray","Remote Filter",null,{autoExpand:Be}),qe.prototype.publish("staticFilter",[],"propertyArray","Static Filter",null,{autoExpand:je});const Ve=class _GroupByColumn extends i.PropertyExt{_owner;validate(e){const t=[];return this.label_valid()||t.push({source:`${e}.label`,msg:`Invalid label: "${this.label()}"`,hint:`expected ${JSON.stringify(this.columns())}`}),t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.label()}toDDL(){return this.label()}fromDDL(e){return this.label(e)}static fromDDL(e){return(new _GroupByColumn).fromDDL(e)}hash(){return s.hashSum(this.label())}columns(){return this._owner.inFieldIDs()}};f(Ve,"GroupByColumn");let Ne=Ve;function Te(e,t){return e.length}Ne.prototype._class+=" GroupByColumn",f(Te,"localCount");const Oe={count:Te,min:i.min,max:i.max,mean:i.mean,median:i.median,variance:i.variance,deviation:i.deviation,sum:i.sum},We=class _AggregateField extends i.PropertyExt{_owner;disableAggrColumn(){return!this.fieldID()||!this.aggrType()||"count"===this.aggrType()}disableBaseCountColumn(){return!this.fieldID()||!this.aggrType()||"mean"!==this.aggrType()}validate(e){const t=[];return this.aggrColumn_valid()||t.push({source:`${e}.${this.fieldID()}.aggrColumn`,msg:`Invalid aggrColumn: "${this.aggrColumn()}"`,hint:`expected ${JSON.stringify(this.columns())}`}),this.baseCountColumn_valid()||t.push({source:`${e}.${this.fieldID()}.aggrColumn`,msg:`Invalid baseCountColumn: "${this.baseCountColumn()}"`,hint:`expected ${JSON.stringify(this.columns())}`}),t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.fieldID()}toDDL(){return"count"===this.aggrType()?{fieldID:this.fieldID(),type:"count"}:{fieldID:this.fieldID(),type:this.aggrType(),inFieldID:this.aggrColumn(),baseCountFieldID:this.baseCountColumn()}}fromDDL(e){const t=this.fieldID(e.fieldID).aggrType(e.type);return"count"!==e.type&&(t.aggrColumn(e.inFieldID),t.baseCountColumn(e.baseCountFieldID)),t}static fromDDL(e){return(new _AggregateField).fromDDL(e)}hash(){return s.hashSum({label:this.fieldID(),aggrType:this.aggrType(),aggrColumn:this.aggrColumn()})}columns(){return this._owner.inFieldIDs()}hasColumn(){return this.columns().length}aggregate(e){return Oe[this.aggrType()](e,e=>+e[this.aggrColumn()])}aggrFunc(){const e=Oe[this.aggrType()],t=this.aggrColumn(),i=this.baseCountColumn();return i?s=>e(s,e=>+e[t]/+e[i]):i=>e(i,e=>+e[t])}};f(We,"AggregateField");let He=We;He.prototype._class+=" AggregateField";const Ge=class _GroupBy extends S{validate(){let e=[];for(const t of this.validGroupBy())e=e.concat(t.validate("GroupBy.column"));for(const t of this.validComputedFields())e=e.concat(t.validate("GroupBy.computedFields"));return e}constructor(){super()}toDDL(){return{type:"groupby",groupByIDs:this.fieldIDs(),aggregates:this.aggregates()}}fromDDL(e){return this.fieldIDs(e.groupByIDs).aggregates(e.aggregates)}static fromDDL(e){return(new _GroupBy).fromDDL(e)}fieldIDs(e){return arguments.length?(this.column(e.map(e=>Ne.fromDDL(e))),this):this.validGroupBy().map(e=>e.toDDL())}aggregates(e){return arguments.length?(this.computedFields(e.map(e=>He.fromDDL(e))),this):this.validComputedFields().map(e=>e.toDDL())}hash(){return s.hashSum({groupBy:this.column().map(e=>e.hash()),computedFields:this.computedFields().map(e=>e.hash())})}appendGroupBys(e){for(const t of e)this.column().push((new Ne).owner(this).label(t.field));return this}validGroupBy(){return this.column().filter(e=>e.valid())}exists(){return this.validGroupBy().length>0}inFieldIDs(){return this.inFields().map(e=>e.id)}field(e){for(const t of this.inFields())if(t.id===e)return t;return null}appendComputedFields(e){for(const t of e){const e=(new He).owner(this).fieldID(t.label).aggrType(t.type);void 0!==t.column&&e.aggrColumn(t.column),this.computedFields().push(e)}return this}validComputedFields(){return this.computedFields().filter(e=>e.valid())}hasComputedFields(){return this.validComputedFields().length>0}computeFields(e){if(!this.exists())return super.computeFields(e);const t=[],i=this.validGroupBy();for(const s of i){const e=this.field(s.label()),i={type:e?e.type:"string",id:s.label()};t.push(i)}for(const s of this.computedFields())if(s.fieldID()){const e={id:s.fieldID(),type:"number"};t.push(e)}if(this.details()){let e=t;if(this.exists()){const i={id:"values",type:"dataset",children:[]};t.push(i),e=i.children}const s=i.map(e=>e.label());e.push(...this.inFields().filter(e=>this.fullDetails()||s.indexOf(e.id)<0))}return()=>t}referencedFields(e){super.referencedFields(e);const t=[];for(const i of this.validGroupBy())t.push(i.label());for(const i of this.validComputedFields())i.aggrColumn()&&t.push(i.aggrColumn());super.resolveInFields(e,t)}computeData(){const e=super.computeData();if(0===e.length||!this.exists())return e;const t=this.validGroupBy().map(e=>e.label()),s=this.validComputedFields().map(e=>({label:e.fieldID(),aggrFunc:e.aggrFunc()})),r=i.nest().key(e=>{let i="";for(const s of t)i+=":"+e[s];return i}).entries(e).map(e=>{const i=e;delete i.key;for(const s of t)i[s]=i.values[0][s];for(const t of s)i[t.label]=t.aggrFunc(i.values);return i}),a=this.outFields();return r.map(e=>{const t={};for(const i of a)t[i.id]=e[i.id];return t})}};f(Ge,"GroupBy");let Je=Ge;Je.prototype._class+=" GroupBy",Ne.prototype.publish("label",void 0,"set","Field",function(){return this.columns()},{optional:!0,validate:f(e=>e.columns().indexOf(e.label())>=0,"validate")}),He.prototype.publish("fieldID",null,"string","new Field ID",null,{optional:!0,disable:f(e=>!e.hasColumn(),"disable")}),He.prototype.publish("aggrType","count","set","Aggregation Type",["count","min","max","sum","mean","median","variance","deviation"],{optional:!0,disable:f(e=>!e.fieldID(),"disable")}),He.prototype.publish("aggrColumn",null,"set","Aggregation Field",function(){return this.columns()},{optional:!0,disable:f(e=>e.disableAggrColumn(),"disable"),validate:f(e=>e.columns().indexOf(e.aggrColumn())>=0,"validate")}),He.prototype.publish("baseCountColumn",null,"set","Base Count Field",function(){return this.columns()},{optional:!0,disable:f(e=>e.disableBaseCountColumn(),"disable"),validate:f(e=>e.columns().indexOf(e.baseCountColumn())>=0,"validate")}),Je.prototype.publish("column",[],"propertyArray","Source Columns",null,{autoExpand:Ne}),Je.prototype.publish("computedFields",[],"propertyArray","Computed Fields",null,{autoExpand:He}),Je.prototype.publish("details",!1,"boolean","Show details"),Je.prototype.publish("fullDetails",!1,"boolean","Show groupBy fileds in details");const Ue=class _Limit extends S{constructor(){super()}toDDL(){return{type:"limit",limit:this.rows()}}fromDDL(e){return this.rows(e.limit)}static fromDDL(e){return(new _Limit).fromDDL(e)}hash(){return s.hashSum({limit:this.rows()})}exists(){return this.rows_exists()&&this.rows()>0}computeData(){const e=super.computeData();return 0!==e.length&&this.exists()?e.slice(0,Math.min(this.rows(),e.length)):e}};f(Ue,"Limit");let Qe=Ue;Qe.prototype._class+=" Limit",Qe.prototype.publish("rows",void 0,"number","Limit output");const Ke=class _ComputedMapping extends i.PropertyExt{_owner;validate(e){const t=[];return this.value_valid()||t.push({source:`${e}.value`,msg:`Invalid value: "${this.value()}"`,hint:'expected: "any"'}),this.newValue_valid()||t.push({source:`${e}.newValue`,msg:`Invalid value: "${this.newValue()}"`,hint:'expected: "any"'}),t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.value()&&!!this.newValue()}toDDL(){return{value:this.value(),newValue:this.newValue()}}fromDDL(e){return this.value(e.value).newValue(e.newValue)}static fromDDL(e){return(new _ComputedMapping).fromDDL(e)}};f(Ke,"ComputedMapping");let Xe=Ke;Xe.prototype._class+=" ComputedMapping";const Ye=class _ComputedField extends i.PropertyExt{_owner;disableColumn1(){return!this.label()||["=","*","/","+","-","scale","map"].indexOf(this.type())<0}disableColumn2(){return!this.label()||["*","/","+","-"].indexOf(this.type())<0}disableMapping(){return!this.label()||["map"].indexOf(this.type())<0}disableChildField(){return!this.hasChildren()}validate(e){const t=[];return this.column1_valid()||t.push({source:`${e}.${this.label()}`,msg:`Invalid column1: "${this.column1()}"`,hint:`expected: ${JSON.stringify(this.columns())}`}),this.column2_valid()||t.push({source:`${e}.${this.label()}`,msg:`Invalid column2: "${this.column2()}"`,hint:`expected: ${JSON.stringify(this.columns())}`}),this.disableMapping()||this.validComputedMappings().forEach(t=>t.validate(`${e}.mapping`)),this.disableChildField()||this.validChildFields().forEach(t=>t.validate(`${e}.childField`)),t}hasChildren(){if(!this.label())return!1;if("="!==this.type())return!1;if(!this.column1())return!1;const e=this._owner.field(this.column1());return!(!e||"dataset"!==e.type||!e.children)}children(){const e=this._owner.field(this.column1());return e&&"dataset"===e.type?e.children:[]}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.label()}validComputedMappings(){return this.mapping().filter(e=>e.valid())}validChildFields(){return this.childField().filter(e=>e.valid())}hasChildFields(){return this.validChildFields().length}toDDL(){switch(this.type()){case"scale":return{fieldID:this.label(),type:"scale",sourceFieldID:this.column1(),factor:this.constValue()};case"template":return{fieldID:this.label(),type:"template",template:this.template()};case"=":const e=this.validChildFields().map(e=>e.toDDL());return{fieldID:this.label(),type:"=",sourceFieldID:this.column1(),transformations:e.length?e:void 0};case"map":return{fieldID:this.label(),type:"map",sourceFieldID:this.column1(),default:this.default(),mappings:this.validComputedMappings().map(e=>e.toDDL())};default:return{fieldID:this.label(),type:this.type(),sourceFieldID1:this.column1(),sourceFieldID2:this.column2()}}}fromDDL(e){const t=this.label(e.fieldID).type(e.type);switch(e.type){case"scale":t.column1(e.sourceFieldID).constValue(e.factor);break;case"template":t.template(e.template);break;case"=":t.column1(e.sourceFieldID).childField(e.transformations?e.transformations.map(e=>_ComputedField.fromDDL(e)):[]);break;case"map":t.column1(e.sourceFieldID).default(e.default).mapping(e.mappings?e.mappings.map(e=>Xe.fromDDL(e)):[]);break;default:t.column1(e.sourceFieldID1).column2(e.sourceFieldID2)}return t}static fromDDL(e){return(new _ComputedField).fromDDL(e)}hash(){return s.hashSum(this.toDDL())}columns(){return this._owner.fieldIDs()}computedField(){switch(this.type()){case"=":let e=this.validChildFields();return 0===e.length&&this.hasChildren()&&(e=this.children().map(e=>(new _ComputedField).owner(this).label(e.id).type("=").column1(e.id))),{...this._owner.field(this.column1()),id:this.label(),children:e.length?e.map(e=>e.computedField()):void 0};case"*":case"/":case"+":case"-":case"scale":return{id:this.label(),type:"number"};case"template":return{id:this.label(),type:"string"};case"map":return{id:this.label(),type:"object"}}return{id:this.label(),type:"string"}}projection(e){const t=this.hasChildFields(),i=this.validChildFields().map(t=>({label:t.label(),func:t.computeFunc(e)}));return s=>{const r=e&&t?{}:{...s};for(const e of i)r[e.label]=e.func(s);return e&&t&&(r.__lparam=s),r}}computeFunc(e){const t=this.column1(),r=this.column2();switch(this.type()){case"=":return this.hasChildFields()?i=>(i[t].Row&&s.isArray(i[t].Row)?i[t].Row:i[t]).map(this.projection(e)):e=>e[t];case"*":return e=>+e[t]*+e[r];case"/":return e=>+e[t]/+e[r];case"+":return e=>+e[t]+ +e[r];case"-":return e=>+e[t]-+e[r];case"scale":const a=this.constValue();return e=>+e[t]*a;case"template":const o=this.template();return e=>i.Utility.template(o,e);case"map":const n=this.default(),l={};for(const e of this.mapping())l[e.value()]=e.newValue();return e=>l[e[t]]||n;default:return e=>e[t]}}fieldIDs(){const e=this._owner.field(this.column1());if(e)switch(e.type){case"dataset":return e.children.map(e=>e.id);case"object":return Object.keys(e.fields)}return[]}field(e){const t=this._owner.field(this.column1());if(t)switch(t.type){case"dataset":for(const i of t.children)if(i.id===e)return i;break;case"object":return t.fields[e]}}};f(Ye,"ComputedField");let Ze=Ye;Ze.prototype._class+=" ComputedField";const et=class _MultiField extends i.PropertyExt{_owner;constructor(){super()}hash(){return s.hashSum(this.toDDL())}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.label()&&this.validMultiFields().length>0}validate(e){let t=[];for(const i of this.validMultiFields())t=t.concat(i.validate(`${e}.computedFields`));return t}toDDL(){return{fieldID:this.label(),type:"multi",transformations:this.transformations()}}fromDDL(e){return this.label(e.fieldID).transformations(e.transformations)}static fromDDL(e){return(new _MultiField).fromDDL(e)}validMultiFields(){return this.multiFields().filter(e=>e.valid())}transformations(e){return arguments.length?(this.multiFields(e.map(e=>Ze.fromDDL(e))),this):this.validMultiFields().map(e=>e.toDDL())}fieldIDs(){return this._owner.fieldIDs()}field(e){return this._owner.field(e)}};f(et,"MultiField");let tt=et;tt.prototype._class+=" MultiField";const it=class _ProjectBase extends S{_includeLParam=!1;_trim=!1;validate(){let e=[];for(const t of this.validComputedFields())e=e.concat(t.validate(`${this.classID()}.computedFields`));return e}constructor(){super()}transformations(e){return arguments.length?(this.computedFields(e.map(e=>"multi"===e.type?tt.fromDDL(e):Ze.fromDDL(e))),this):this.validComputedFields().map(e=>e.toDDL())}exists(){return this.validComputedFields().length>0}fieldIDs(){return this.inFields().map(e=>e.id)}field(e){for(const t of this.inFields())if(t.id===e)return t;return null}clearComputedFields(){this.computedFields([])}appendComputedFields(e){for(const t of e){const e=(new Ze).owner(this).label(t.label).type(t.type);void 0!==t.column&&e.column1(t.column),this.computedFields().push(e)}return this}validComputedFields(){return this.computedFields().filter(e=>e.valid())}hasComputedFields(){return this.validComputedFields().length}computeFields(e){if(!this.exists())return super.computeFields(e);let t=[];const i={};for(const s of this.validComputedFields())if(s instanceof tt)for(const e of s.validMultiFields()){const s=e.computedField();t.push(s),i[s.id]=!0}else{const e=s.computedField();t.push(e),i[e.id]=!0}if(this._trim&&this.hasComputedFields()){if(this._includeLParam){const e={id:"__lparam",type:"object"};t.push(e),i[e.id]=!0}}else t=t.concat(e.filter(e=>!i[e.id]));return()=>t}referencedFields(e){super.referencedFields(e);const t=[];for(const s of this.validComputedFields())if(s instanceof tt)for(const e of s.validMultiFields())t.push(e.column1()),e.column2()&&t.push(e.column2());else if("template"===s.type())for(const e of i.Utility.templateFields(s.template()))t.push(e);else t.push(s.column1()),s.column2()&&t.push(s.column2());super.resolveInFields(e,t)}projection(){const e=this._trim,t=this.hasComputedFields(),i=[];for(const s of this.validComputedFields())if(s instanceof tt)for(const t of s.validMultiFields())i.push({label:t.label(),func:t.computeFunc(e)});else i.push({label:s.label(),func:s.computeFunc(e)});return s=>{const r=e&&t?{}:{...s};for(const e of i)r[e.label]=e.func(s);return e&&t&&this._includeLParam&&(r.__lparam=s),r}}computeData(){const e=super.computeData();return 0!==e.length&&this.exists()?e.map(this.projection()):e}};f(it,"ProjectBase"),D(it,"ComputedField",Ze);let st=it;const rt=class _Project extends st{toDDL(){return{type:"project",transformations:this.transformations()}}fromDDL(e){return this.transformations(e.transformations)}static fromDDL(e){return(new _Project).fromDDL(e)}hash(e={}){return super.hash({ddl:this.toDDL(),...e})}};f(rt,"Project");let at=rt;at.prototype._class+=" Project";const ot=class _Mappings extends st{constructor(){super(),this._trim=!0,this._includeLParam=!0}toDDL(){return{type:"mappings",transformations:this.transformations()}}fromDDL(e){const t=e||{transformations:[]};return this.transformations(t.transformations)}static fromDDL(e){return(new _Mappings).fromDDL(e)}hash(e={}){return super.hash({ddl:this.toDDL(),...e})}referencedFields(e){if(this.hasComputedFields())return super.referencedFields(e);this.resolveInFields(e,this.inFields().filter(e=>"__lparam"!==e.id).map(e=>e.id))}};f(ot,"Mappings");let nt=ot;nt.prototype._class+=" Mappings",Xe.prototype.publish("value",null,"any","Compare Value",void 0,{validate:f(e=>!e.value()&&!e.newValue()||!!e.value()&&!!e.newValue(),"validate")}),Xe.prototype.publish("newValue",null,"any","New Value",void 0,{validate:f(e=>!e.value()&&!e.newValue()||!!e.value()&&!!e.newValue(),"validate")}),Ze.prototype.publish("label",null,"string","Label",null,{optional:!0}),Ze.prototype.publish("type","mapping","set","Project type",["=","*","/","+","-","scale","template","map"],{optional:!0,disable:f(e=>!e.label(),"disable")}),Ze.prototype.publish("column1",null,"set","Param 1",function(){return this.columns()},{optional:!0,disable:f(e=>e.disableColumn1(),"disable"),validate:f(e=>e.columns().indexOf(e.column1())>=0,"validate")}),Ze.prototype.publish("column2",null,"set","Param 2",function(){return this.columns()},{optional:!0,disable:f(e=>e.disableColumn2(),"disable"),validate:f(e=>e.columns().indexOf(e.column2())>=0,"validate")}),Ze.prototype.publish("constValue",null,"number","Const value",null,{optional:!0,disable:f(e=>!e.label()||["scale"].indexOf(e.type())<0,"disable")}),Ze.prototype.publish("template",null,"string","template",null,{optional:!0,disable:f(e=>!e.label()||["template"].indexOf(e.type())<0,"disable")}),Ze.prototype.publish("default",null,"any","Default Value",null,{optional:!0,disable:f(e=>!e.label()||["map"].indexOf(e.type())<0,"disable")}),Ze.prototype.publish("mapping",[],"propertyArray","Mapped Values",null,{autoExpand:Xe,disable:f(e=>e.disableMapping(),"disable")}),Ze.prototype.publish("childField",[],"propertyArray","Child Fields",null,{autoExpand:Ze,disable:f(e=>e.disableChildField(),"disable")}),tt.prototype.publish("label","","string","Label"),tt.prototype.publish("multiFields",[],"propertyArray","Multi Fields",null,{autoExpand:Ze}),st.prototype.publish("computedFields",[],"propertyArray","Computed Fields",null,{autoExpand:Ze});const lt=class _SortColumn extends i.PropertyExt{_owner;validate(e){const t=[];return this.fieldID_valid()||t.push({source:`${e}.fieldID`,msg:`Invalid fieldID: ${this.fieldID()}`,hint:`expected ${JSON.stringify(this.fieldIDs())}`}),t}constructor(){super()}owner(e){return arguments.length?(this._owner=e,this):this._owner}valid(){return!!this.fieldID()}toDDL(){return{fieldID:this.fieldID(),descending:this.descending()}}fromDDL(e){return this.fieldID(e.fieldID).descending(e.descending)}static fromDDL(e){return(new _SortColumn).fromDDL(e)}hash(){return s.hashSum({sortColumn:this.fieldID(),descending:this.descending()})}fieldIDs(){return this._owner.fieldIDs()}field(e){return this._owner.inFields().filter(t=>t.id===e)[0]}};f(lt,"SortColumn");let ht=lt;ht.prototype._class+=" SortColumn";const ut=class _Sort extends S{validate(){let e=[];for(const t of this.validSortBy())e=e.concat(t.validate("Sort.column"));return e}constructor(){super()}toDDL(){return{type:"sort",conditions:this.conditions()}}fromDDL(e){return this.conditions(e.conditions),this}static fromDDL(e){return(new _Sort).fromDDL(e)}conditions(e){return arguments.length?(this.column(e.map(e=>ht.fromDDL(e))),this):this.validSortBy().map(e=>e.toDDL())}hash(){return s.hashSum({Sort:this.column().map(e=>e.hash())})}referencedFields(e){super.referencedFields(e),super.resolveInFields(e,this.validSortBy().map(e=>e.fieldID()))}validSortBy(){return this.column().filter(e=>e.fieldID())}exists(){return this.validSortBy().length>0}fieldIDs(){return this.inFields().map(e=>e.id)}computeData(){const e=super.computeData(),t=[];for(const s of this.validSortBy())t.push({compare:s.descending()?i.descending:i.ascending,id:s.fieldID()});return t.length?[...e].sort((e,i)=>{for(const s of t){const t=s.compare(e[s.id],i[s.id]);if(0!==t)return t}return 0}):e}};f(ut,"Sort"),D(ut,"Column",ht);let ct=ut;ct.prototype._class+=" Sort",ht.prototype.publish("fieldID",null,"set","Sort Field",function(){return this.fieldIDs()},{optional:!0,validate:f(e=>e.fieldIDs().indexOf(e.fieldID())>=0,"validate")}),ht.prototype.publish("descending",!1,"boolean","Sort Field"),ct.prototype.publish("column",[],"propertyArray","Source Columns",null,{autoExpand:ht});const dt=class _HipiePipeline extends ${constructor(e,t){super(),this._ec=e,this._id=t,this._datasource=new $e(this._ec),this._filters=new qe(this._ec),this._project=new at,this._groupBy=new Je,this._sort=new ct,this._limit=new Qe,this.updateSequence()}_ec;_origDatasource;_origFilters;_origProject;_origGroupBy;_origSort;_origLimit;activities(e){return super.activities.apply(this,arguments)}updateSequence(){this.activities([this.datasource(),this.filters(),this.project(),this.groupBy(),this.sort(),this.limit()])}selectionFields(){return this.last().outFields()}};f(dt,"HipiePipeline");let pt=dt;function mt(e){const t=`_orig${e.charAt(0).toUpperCase()+e.slice(1)}`;pt.prototype[t]=pt.prototype[e],pt.prototype[e]=function(e){const i=pt.prototype[t].apply(this,arguments);return void 0!==e&&this.updateSequence(),i}}pt.prototype.publish("datasource",null,"widget","Data Source 2"),pt.prototype.publish("filters",null,"widget","Client Filters"),pt.prototype.publish("project",null,"widget","Project"),pt.prototype.publish("groupBy",null,"widget","Group By"),pt.prototype.publish("sort",null,"widget","Sort"),pt.prototype.publish("limit",null,"widget","Limit output"),f(mt,"wrapHipiePipelineProperty"),mt("datasource"),mt("filters"),mt("project"),mt("groupBy"),mt("sort"),mt("limit");const _t=class _NullView extends pt{hash(){return super.hash()}_fetch(e,t){return Promise.resolve([])}};f(_t,"NullView");let ft=_t;ft.prototype._class+=" NullView";const Dt=class _VizPopupPanel extends u.Modal{_owner;_ownerLParam;constructor(e,t){super(),this._owner=e,this._ownerLParam=t,this._drawStartPos="origin",this.visible(!1),this.minHeight_default("240px"),this.minWidth_default("320px"),this.overflowY_default("hidden")}_host;host(e){return arguments.length?(this._host&&this._host!==e&&this._host._togglePopup.selected(!1).render(),this._host=e,this._owner.vizActivation(this._ownerLParam),this):this._host}enter(e,t){e.parentElement.style.position="absolute";const i=this.widget().title();i&&(this.title(i),this.widget().titleVisible(!1)),super.enter(e,t)}update(e,t){this.fixedTop(this._pos.y+"px"),this.fixedLeft(this._pos.x+"px"),super.update(e,t)}exit(e,t){super.exit(e,t);this.widget().title()&&this.widget().titleVisible(!0)}closeModal(){super.closeModal(),this._host&&this._host._togglePopup.selected(!1).render()}};f(Dt,"VizPopupPanel");let vt=Dt;vt.prototype._class+=" marshaller_VizPopupPanel";const gt=class _VizChartPanel extends u.ChartPanel{_popup;_togglePopup=(new i.ToggleButton).faChar("fa-filter").tooltip("Filter").on("click",()=>{this._popup.host(this);const e=this.locateClosestAncestor(["marshaller_DashboardDockPanel","marshaller_DashboardGrid"]).getBBox(!0),t=this._popup.widget(),i=this._togglePopup.getBBox();this._popup.pos({x:-e.x+i.x+i.width-t.minWidth(),y:-e.y+i.y+i.height}).resize({width:t.minWidth(),height:t.minHeight()}).visible(this._togglePopup.selected()).render(e=>{const t="#"+e.id()+" .layout_Carousel .common_Widget",i=e.element().node();if(i){const{height:s,width:r}=i.querySelector(t).getBoundingClientRect();e.resizeBodySync(r,s)}})});_origButtons;_filterButtons;constructor(){super(),this._origButtons=this.buttons(),this._filterButtons=[this._togglePopup,new i.Spacer,...this._origButtons]}popup(e){return arguments.length?(this._popup=e,this._popup||this._togglePopup.selected(!1),this.buttons(this._popup?this._filterButtons:this._origButtons),this):this._popup}};f(gt,"VizChartPanel");let yt=gt;yt.prototype._class+=" marshaller_VizChartPanel",yt.prototype.publish("descriptionTemplate","","string"),yt.prototype.publish("minWidth",320,"number","Min Width"),yt.prototype.publish("minHeight",240,"number","Min Height");const bt={Table:o.Table,FieldForm:n.FieldForm,Area:a.Area,Bubble:a.Bubble,Bar:a.Bar,Column:a.Column,Contour:a.Contour,HexBin:a.HexBin,Line:a.Line,Pie:a.Pie,Radar:a.Radar,RadialBar:a.RadialBar,Scatter:a.Scatter,Step:a.Step,WordCloud:a.WordCloud,USCountiesChoropleth:h.ChoroplethCounties,USStatesChoropleth:h.ChoroplethStates,ClusterPins:h.Leaflet.ClusterPins,EntityRectList:i.EntityRectList,AdjacencyGraph:l.AdjacencyGraph,DataGraph:l.DataGraph},wt=[];for(const bi in bt)wt.push(bi);function Ft(e){return bt[e]||o.Table}function xt(e){const t=new(bt[e]||o.Table);return t instanceof n.FieldForm?t.validate(!1).allowEmptyRequest(!0):t instanceof l.AdjacencyGraph&&t.uidColumn("uid").labelColumn("label").iconColumn("icon").linksColumn("links").linkUidColumn("uid").linkLabelColumn("label"),t}function Pt(e){return Ft(e).__inputs||[]}f(Ft,"typeClass"),f(xt,"typeNew"),f(Pt,"typeInputs");const St=class _Visualization extends i.PropertyExt{constructor(e,t){super(),this._ec=e,this._hipiePipeline=t,this.mappings(new nt),this.chartPanel(new yt),this.typeChanged()}_ec;_origVisibility;_origChartType;_origChartPanel;_hipiePipeline;visualizationIDs(){return this._ec.elementIDs().filter(e=>e!==this.id())}_prevChartType;typeChanged(){if(this._prevChartType!==this._chartType){this._prevChartType=this._chartType,this.refreshMappings();const e=xt(this._chartType);this.chartPanel().widget(e)}}properties(e){return arguments.length?(this.chartPanel().deserialize(e),this):this.chartPanel().serialize()}refreshMappings(){const e=this.mappings();e.sourceActivity(this._hipiePipeline);const t=e.validComputedFields(),i=e.inFields(),s={};return e.computedFields(Pt(this._chartType).map((r,a)=>{let o=t[a];if(o)o instanceof tt||o.label(r.id);else if(r.multi){o=(new tt).owner(e).label(r.id);const t=[];for(const e of i)"any"!==r.type&&r.type!==e.type||s[e.id]||(s[e.id]=!0,t.push((new Ze).label(e.id).type("=").column1(e.id)));o.multiFields(t)}else{o=(new Ze).owner(e).label(r.id).type("=");for(const e of i)if(("any"===r.type||r.type===e.type)&&!s[e.id]){s[e.id]=!0,o.column1(e.id);break}}return o})),this}_prevFields=[];_prevLinkFields=[];_prevData=[];refreshData(){const e=this.mappings(),t=e.outFields(),i=this.toDBFields(t);let s,r=[];const a=this._ec.element(this.secondaryDataviewID());a&&(s=a.mappings().outFields(),r=this.toDBFields(s));const o=this._prevFields!==t||this._prevLinkFields!==s;if(o)if(this._prevFields=t,"DataGraph"===this.chartType()){const e=this.chartPanel().widget();e.vertexColumns(i.map(e=>e.label())),e.edgeColumns(r.map(e=>e.label()))}else this.chartPanel().fields(i.filter(e=>"__lparam"!==e.id()));else console.warn(`***${this.id()} Immutable Fields***`);const n=e.outData(),l=this._prevData!==n;if(l){this._prevData=n;const e=this.toDBData(i,n);if("DataGraph"===this.chartType()){const t=this.chartPanel().widget();if(t.vertices(e),a){const e=a.mappings().outData(),i=this.toDBData(r,e);t.edges(i)}}else this.chartPanel().data(e)}else console.warn(`${this.id()} Immutable Data!`);return o||l?this.chartPanel().renderPromise().then(()=>{}):Promise.resolve()}fieldTypeTodbFieldType(e){switch(e){case"dataset":return"nested";case"boolean":return"boolean";case"number":return"number";default:return"string"}}toDBFields(e){const t=[];for(const s of e||[]){const e=(new i.Database.Field).type(this.fieldTypeTodbFieldType(s.type)).id(s.id).label(s.id);if("dataset"===s.type)e.children(this.toDBFields(s.children));t.push(e)}return t}toDBData(e,t){return(s.isArray(t)?t:[t]).map(t=>{const i=[];for(const s of e)"nested"===s.type()?i.push(this.toDBData(s.children(),t[s.id()].Row||t[s.id()])):i.push(t[s.label()]);return i})}exec(){const e=[];if(this.secondaryDataviewID_exists()){const t=this.secondaryDataviewID(),i=this._ec.element(t);i&&e.push(i.visualization().exec())}const t=this.mappings();return t.sourceActivity(this._hipiePipeline),e.push(t.refreshMeta().then(()=>t.exec())),Promise.all(e)}refresh(){return this.chartPanel().startProgress&&this.chartPanel().startProgress(),this.exec().then(()=>(this.chartPanel().finishProgress&&this.chartPanel().finishProgress(),this.refreshData()))}click(e,t,i,s){}vertex_click(e,t,i){}};f(St,"Visualization");let Lt=St;Lt.prototype._class+=" Visualization",Lt.prototype.publishProxy("title","_chartPanel"),Lt.prototype.publishProxy("description","_chartPanel"),Lt.prototype.publish("visibility",r.DDL2.VisibilitySet[0],"set","Type",r.DDL2.VisibilitySet),Lt.prototype.publish("chartType","Table","set","Type",wt),Lt.prototype.publish("secondaryDataviewID",null,"set","Secondary Data View (e.g. graph edges)",function(){return this.visualizationIDs()},{optional:!0}),Lt.prototype.publish("mappings",null,"widget","Mappings",void 0,{render:!1,internal:!0}),Lt.prototype.publish("chartPanel",[],"widget","Widget"),Lt.prototype._origVisibility=Lt.prototype.visibility,Lt.prototype.visibility=function(e){const t=this._visibility,i=Lt.prototype._origVisibility.apply(this,arguments);return void 0!==e&&t!==e&&this.chartPanel().target(null),i},Lt.prototype._origChartType=Lt.prototype.chartType,Lt.prototype.chartType=function(e,t){void 0!==e&&-1===wt.indexOf(e)&&(e="Table");const i=Lt.prototype._origChartType.apply(this,arguments);if(void 0!==e&&(this.typeChanged(),t)){const e=this.chartPanel().widget();for(const i in t)"function"==typeof e[i]&&e[i](t[i])}return i},Lt.prototype._origChartPanel=Lt.prototype.chartPanel,Lt.prototype.chartPanel=function(e){const t=Lt.prototype._origChartPanel.apply(this,arguments);if(void 0!==e){this._chartPanel.on("click",(e,t,i,s)=>this.click(e,t,i,s)).on("vertex_click",(e,t,i)=>this.vertex_click(e,t,i));for(const e in bt)if(this._chartPanel.widget()instanceof bt[e]){this._chartType=e;break}}return t};const Ct=class _State extends i.PropertyExt{constructor(){super(),this.selection([])}set(e){return s.hashSum(this.selection())!==s.hashSum(e)&&(this.selection(e),!0)}removeInvalid(e){const t=this.selection(),i=[];for(const r of t)s.find(e,(e,t)=>{for(const i in r)if(r[i]!==e[i])return!1;return!0})&&i.push(r);return i.length!==t.length&&(this.selection(i),!0)}};f(Ct,"State");let It=Ct;It.prototype._class+=" State",It.prototype.publish("selection",[],"array","State");let $t=0;const Rt=class _Element extends i.PropertyExt{constructor(e){for(super(),this._ec=e;$t++,this._id=`e_${$t}`,this._ec.elementExists(this._id););const t=new pt(this._ec,this._id);this.hipiePipeline(t),this._vizChartPanel=new Lt(this._ec,this.hipiePipeline()).id(`viz_${$t}`).title(`Element ${$t}`),this._vizChartPanel.chartPanel().id(`cp_${$t}`),this.visualization(this._vizChartPanel),this.state(new It)}_ec;_vizChartPanel;_origVisualization;id(e){const t=super.id.apply(this,arguments);return arguments.length&&this._vizChartPanel.id(e),t}chartType(){return this._vizChartPanel.chartType()}chartPanel(e){return arguments.length?(this._vizChartPanel.chartPanel(e),this):this._vizChartPanel.chartPanel()}chart(){return this._vizChartPanel.chartPanel().widget()}mappings(e){return arguments.length?(this._vizChartPanel.mappings(e),this):this._vizChartPanel.mappings()}pipeline(e){return this.hipiePipeline().activities(e),this}updatedBy(){const e=this.hipiePipeline().updatedBy();return this.visualization().secondaryDataviewID_exists()&&e.push(this.visualization().secondaryDataviewID()),e}dataProps(){return this.hipiePipeline()}vizProps(){return this.visualization().chartPanel()}stateProps(){return this.state()}_errors=[];errors(){return this._errors}validate(){if(!this._initialized)return[];this._errors=[];const e=this.hipiePipeline();for(const t of[...e.activities(),this.mappings()])for(const e of t.validate())this._errors.push({elementID:this.id(),...e});return this._errors}_initialized=!1;refresh(){const e=this.hipiePipeline().filters().validFilters().map(e=>e.createFilterDescription());return this.visualization().chartPanel().description(e.join(", ")),this.visualization().refresh().then(()=>{this._initialized=!0;const e=this.hipiePipeline().outData();"FieldForm"===this.visualization().chartType()?this.state().set([...e])&&this.selectionChanged():this.state().removeInvalid(e)&&this.selectionChanged()})}selection(e){return arguments.length?(this.state().selection(e),this.selectionChanged(),this):this.state().selection()}selectionChanged(){const e=[];for(const t of this._ec.filteredBy(this.id()))e.push(t.refresh());Promise.all(e).then(()=>{this._ec.vizStateChanged(this)})}monitor(e){return this.hipiePipeline().monitor(e)}};f(Rt,"Element");let Et=Rt;Et.prototype._class+=" Viz",Et.prototype.publish("hipiePipeline",null,"widget","Data View"),Et.prototype.publish("visualization",null,"widget","Visualization"),Et.prototype.publish("state",null,"widget","State"),Et.prototype._origVisualization=Et.prototype.visualization,Et.prototype.visualization=function(e){const t=Et.prototype._origVisualization.apply(this,arguments);return void 0!==e&&this._visualization.on("click",(e,t,i,r)=>{if(r&&r.selection)this.selection(i?r.selection.map(e=>e.__lparam||e):[]);else{const t=s.isArray(e)?e:[e];this.selection(i?t.map(e=>e.__lparam||e):[])}}).on("vertex_click",(e,t,i)=>{const r=s.isArray(e)?e:[e];this.selection(i?r.map(e=>e.__lparam||e):[])}),t};const At=class _ElementContainer extends i.PropertyExt{_nullElement;_datasources=[U];_elements=[];constructor(){super(),this.clear(),this._nullElement=new Et(this)}clear(e){this._datasources=void 0===e?[U]:this._datasources,this._elements=void 0===e?[]:this._elements.filter(t=>t.id()!==e)}_hookSend;hookSend(e){return arguments.length?(this._hookSend=e,this):this._hookSend}datasources(e){return arguments.length?(this._datasources=e,this):this._datasources}datasource(e){return this._datasources.filter(t=>t.id()===e)[0]}appendDatasource(e){return this._datasources.push(e),this}removeDatasource(e){return this._datasources=this._datasources.filter(t=>t!==e),this}elements(){return[...this._elements]}element(e){let t;return t="string"==typeof e?this._elements.filter(t=>t.id()===e):e instanceof yt?this._elements.filter(t=>t.chartPanel()===e):this._elements.filter(t=>t.vizProps()===e),t.length?t[0]:this._nullElement}elementExists(e){return this.element(e)!==this._nullElement}elementIDs(){return this._elements.map(e=>e.id())}append(e){return this._elements.push(e),this}filteredBy(e){return this._elements.filter(t=>t.updatedBy().indexOf(e)>=0)}views(){return this._elements.map(e=>e.hipiePipeline())}view(e){return this.views().filter(t=>t.id()===e)[0]}normalizePersist(e){const t={};return e.__properties.content.map(e=>{const s=!!e.__properties.widget.__properties.chart,r=e,a=e.__properties.widget,o=s?e.__properties.widget.__properties.chart:e.__properties.widget.__properties.widget,n=e.__properties.widget.__id?e.__properties.widget.__id:e.__properties.widget.__properties.widget.__id;t[n]={id:n,package:o.__class.split("_")[0],object:o.__class.split("_")[1],cell:i(r,["chart","widget","fields"]),panel:i(a,["chart","widget","fields"]),widget:i(o,["fields"])}}),t;function i(e,t){const i={};return Object.keys(e.__properties).filter(e=>-1===t.indexOf(e)).forEach(t=>i[t]=e.__properties[t]),i}}validate(){let e=[];return this._elements.forEach(t=>{e=e.concat(t.validate())}),e}refresh(){return Promise.all(this.elements().map(e=>e.refresh())).then(()=>this)}vizStateChanged(e){}};f(At,"ElementContainer");let zt=At;function Bt(e){if(!e.ok)throw new Error(e.status+" "+e.statusText);return e.text()}function Mt(e,t){return fetch(e,t).then(Bt)}zt.prototype._class+=" dashboard_ElementContainer",zt.prototype.publish("samples",10,"number","Number of samples"),zt.prototype.publish("sampleSize",100,"number","Sample size"),f(Bt,"responseText"),f(Mt,"d3Text");const jt=class _PopupManager extends i.Widget{_ec;_popups=[];_popupIdx={};popupPanels(){return this._popups||(this._popups=[]),this._popupIdx||(this._popupIdx={}),this._popups}popupChartPanels(){return this.popupPanels().map(e=>e.widget())}addPopup(e){const t=this._ec.element(e),i=this.element().node(),s=new vt(this,t).target(i).widget(e).relativeTargetId(this.id()).size({width:e.minWidth(),height:e.minHeight()});this._popups.push(s),this._popupIdx[e.id()]={panel:s,monitorHandle:e.monitor(t=>{switch(t){case"minWidth":case"minHeight":s.resize({width:e.minWidth(),height:e.minHeight()}).render()}})},this._ec.filteredBy(t.id()).forEach(e=>{e.visualization().chartPanel().popup(s)})}removePopup(e){const t=this._ec.element(e);this._ec.filteredBy(t.id()).forEach(e=>{e.visualization().chartPanel().popup(null)}),this._popupIdx[e.id()].panel.target(null),this._popupIdx[e.id()].monitorHandle.remove(),e.target(null),delete this._popupIdx[e.id()],this._popups=this._popups.filter(t=>t.widget()!==e)}syncPopups(){const e=this.popupChartPanels(),t=s.compare(e,this._ec.elements().filter(e=>"flyout"===e.visualization().visibility()).map(e=>e.visualization().chartPanel()));for(const i of t.exit)this.removePopup(i);for(const i of t.enter)this.addPopup(i);return this}vizActivation(){}};f(jt,"PopupManager");let kt=jt;const qt=class _DashboardDockPanel extends c.DockPanel{constructor(e){super(),this._ec=e}_ec;tabTitle(e){return this.hideSingleTabs()?e.visualization().title?e.visualization().title():e.visualization().id():e.id()}titleClassed(e,t,i){let s=e.title.className.split(" ");i&&s.indexOf(t)<0?s.push(t):!i&&s.indexOf(t)>0&&(s=s.filter(e=>e!==t)),e.title.className=s.join(" ")}updateTitle(e){const t=this.getWidgetAdapter(e),i=this._ec.element(e),s=i.validate();t.title.label=this.tabTitle(i),this.titleClassed(t,"error",s.length>0),t.title.caption=s.map(e=>`${e.source}: ${e.msg}`).join("\n")}activate(e){const t=this.getWidgetAdapter(e.visualization().chartPanel());t&&t.activate()}syncMinSize(e){if(e.minWidth_exists()||e.minHeight_exists()){const t=this.getWidgetAdapter(e);return i.select(t.node).style("min-width",`${e.minWidth()}px`).style("min-height",`${e.minHeight()}px`),!0}return!1}syncWidgets(){const e=this.widgets(),t=s.compare(e,this._ec.elements().filter(e=>"normal"===e.visualization().visibility()).map(e=>e.visualization().chartPanel()));let i=!1;for(const s of t.exit)this.removeWidget(s);for(const s of t.enter){const e=this._ec.element(s);this.addWidget(s,this.tabTitle(e),"split-bottom",void 0,this.hideSingleTabs()?void 0:this),i=this.syncMinSize(s)||i}for(const s of t.update)this.updateTitle(s),i=this.syncMinSize(s)||i;return i&&this.refit(),this}childActivation(e,t){super.childActivation(e,t),this.vizActivation(this._ec.element(e));for(const i of this.widgetAdapters())i===t?(i.addClass("active"),this.titleClassed(i,"active",!0),i.title.iconClass="active"):(i.removeClass("active"),this.titleClassed(i,"active",!1),i.title.iconClass="")}vizActivation(e){}canClose(e,t){const i=this._ec.element(e).id(),s=window.confirm(`Remove Widget "${i}"?`);return s&&(this._ec.clear(i),this.syncWidgets(),this.vizActivation(void 0)),s}syncPopups(){}};f(qt,"DashboardDockPanel");let Vt=qt;Vt.prototype._class+=" marshaller_DashboardDockPanel",Vt.prototype.mixin(kt);const Nt=class _DashboardGrid extends u.Grid{constructor(e){super(),this._ec=e,this.designMode(!1),this.surfacePadding("0"),this.surfaceBorderWidth(0)}_ec;_layoutCache=[];updateGrid(e,t=0,i=!1){super.updateGrid(e,t,i),this._layoutCache=this.content().map(e=>({id:e.widget().id(),position:[e.gridCol(),e.gridRow(),e.gridColSpan(),e.gridRowSpan()]}))}layoutObj(e){if(e)if(e.main){const i=t(e,10,10);this._layoutCache=i}else e instanceof Array&&(this._layoutCache=e);return this;function t(e,t,i){const s=[];return r(e.main,0,0,t,i),s;function r(e,t,i,a,o){e.children?"split-area"===e.type?"horizontal"===e.orientation?e.children.forEach((s,n)=>{const l=e.sizes[n]*a,h=o,u=0===n?t:t+e.sizes[0]*a,c=i;r(e.children[n],u,c,l,h)}):"vertical"===e.orientation?e.children.forEach((s,n)=>{const l=a,h=e.sizes[n]*o,u=t,c=0===n?i:i+e.sizes[0]*o;r(e.children[n],u,c,l,h)}):console.error("wtf"):"tab-area"===e.type&&e.children.forEach((s,n)=>{const l=a,h=e.sizes[n]*o,u=t,c=0===n?i:i+e.sizes[0]*o;r(e.children[n],u,c,l,h)}):s.push([t,i,a,o].map(Math.round))}}}layout(){return this._layoutCache}widgets(){return this.content().map(e=>e.widget())}hideSingleTabs(){return!0}getWidgetAdapter(){}tabTitle(e){return this.hideSingleTabs()?e.visualization().title?e.visualization().title():e.visualization().id():e.id()}updateTitle(e){const t=this.getWidgetCell(e.id()),i=this._ec.element(e),s=this.tabTitle(i);t.widget().title(s)}activate(e){}removeWidget(e){const t=this.getWidgetCell(e.id());this.clearContent(t)}syncMinSize(e){if(e.minWidth_exists()||e.minHeight_exists()){return this.getWidgetCell(e.id()).element().style("min-width",`${e.minWidth()}px`).style("min-height",`${e.minHeight()}px`),!0}return!1}syncWidgets(){const e=this.widgets(),t=s.compare(e,this._ec.elements().filter(e=>"normal"===e.visualization().visibility()).map(e=>e.visualization().chartPanel()));for(const s of t.exit)this.removeWidget(s);const i=[];for(const s of t.enter){const e=this._ec.element(s),t=this.content().length;if(this._layoutCache&&this._layoutCache[t]){const t=this._layoutCache.find(e=>e.id===s.id());if(t){const[i,s,r,a]=t.position;this.setContent(s,i,e.visualization().chartPanel(),"",a,r)}else i.push(e.visualization().chartPanel())}else i.push(e.visualization().chartPanel())}let r=this.content().reduce((e,t)=>Math.max(e,t.gridRow()+t.gridRowSpan()),0);i.forEach(e=>{this.setContent(r,0,e,"",3,3),r+=3});for(const s of t.update)this.updateTitle(s);return this}childActivation(e,t){this.vizActivation(this._ec.element(e))}postSelectionChange(){super.postSelectionChange();const e=this._selectionBag.get();e.length>0&&this.childActivation(e[0].widget.widget())}vizActivation(e){}canClose(e,t){const i=this._ec.element(e).id(),s=window.confirm(`Remove Widget "${i}"?`);return s&&(this._ec.clear(i),this.syncWidgets(),this.vizActivation(void 0)),s}syncPopups(){}};f(Nt,"DashboardGrid");let Tt=Nt;Tt.prototype._class+=" marshaller_DashboardGrid",Tt.prototype.mixin(kt);const Ot=s.scopedLogger("marshaller/ddl2/ddl"),Wt=class _DDLDatasourceAdapter{_dsDedup;constructor(){}clear(){this._dsDedup={}}id(e){return e instanceof ie?`${e.url()}/${e.wuid()}`:e instanceof be?`${e.url()}/${e.querySet()}/${e.queryID()}`:e instanceof ue?`${e.url()}/${e.action()}`:e.id()}_resolveID(e){return this._dsDedup[this.id(e)].ds.id()}resolveID(e){return e instanceof re?this._resolveID(e.datasource().wu()):e instanceof Pe||e instanceof Le||e instanceof fe?this._resolveID(e.datasource().service()):void 0}append(e){const t=e instanceof $e?e.datasource():e,i=e instanceof $e?e.datasourceRef():void 0,s=t.id(),r=t instanceof ee?t.wu():t instanceof Fe||t instanceof de?t.service():t,a=this.id(r);this._dsDedup[a]||(this._dsDedup[a]={ds:r,result:{}}),this._dsDedup[a].result[s]||(this._dsDedup[a].result[s]={refType:t,ref:i})}getAll(){const e=[];for(const t in this._dsDedup){const i=this._dsDedup[t].ds.toDDL();if("roxie"===i.type||"hipie"===i.type||"rest"===i.type){const e={};for(const i in this._dsDedup[t].result){const s=this._dsDedup[t].result[i].refType.toDDL(),r={inputs:{},outputs:{}};this._dsDedup[t].result[i].ref.referencedFields(r);for(const t in r.inputs)r.inputs[t].forEach(t=>{e[t]=s.inputs.filter(e=>e.id===t)[0]})}i.inputs=[];for(const t in e)i.inputs.push(e[t])}if("wuresult"===i.type||"roxie"===i.type||"hipie"===i.type||"rest"===i.type){const e={};for(const i in this._dsDedup[t].result){const s=this._dsDedup[t].result[i].refType.toDDL();if("wuresult"===s.type||"roxie"===s.type||"hipie"===s.type||"rest"===s.type)for(const t in s.outputs)e[t]=s.outputs[t]}i.outputs={};for(const t in e)i.outputs[t]=e[t]}e.push(i)}return e}};f(Wt,"DDLDatasourceAdapter");let Ht=Wt;const Gt=class _DDLAdapter{_dashboard;_ec;_dsWriteDedup=new Ht;_dsReadDedup={};constructor(e){this._dashboard=e,this._ec=this._dashboard.elementContainer()}writeDatasources(){for(const e of this._ec.elements())this._dsWriteDedup.append(e.hipiePipeline().datasource());return this._dsWriteDedup.getAll()}writeFilters(e){if(e.exists())return e.toDDL()}readFilters(e,t){return qe.fromDDL(t,e)}writeProject(e){if(e.exists())return e.toDDL()}readProject(e){return at.fromDDL(e)}writeMappings(e){return e.exists()?e.toDDL():{type:"mappings",transformations:[]}}readMappings(e){return nt.fromDDL(e)}writeGroupBy(e){if(e.exists())return e.toDDL()}readGroupBy(e){return Je.fromDDL(e)}writeSort(e){if(e.exists())return e.toDDL()}readSort(e){return ct.fromDDL(e)}writeLimit(e){if(e.exists())return e.toDDL()}readLimit(e){return Qe.fromDDL(e)}readDatasourceRef(e,t,i){if(r.DDL2.isWUResultRef(e)){const i=this._dsReadDedup[e.id];t.datasourceID(i.output(e.output).id())}else if(r.DDL2.isRoxieServiceRef(e)){t.datasourceID(`${e.id}_${e.output}`);t.datasourceRef().request(e.request.map(e=>me.fromDDL(this._ec,e)))}else t.datasourceID(e.id);return this}writeActivities(e){return e.activities().map(e=>e instanceof qe?this.writeFilters(e):e instanceof at?this.writeProject(e):e instanceof Je?this.writeGroupBy(e):e instanceof ct?this.writeSort(e):e instanceof Qe?this.writeLimit(e):e instanceof nt?this.writeMappings(e):void(e instanceof $e||Ot.warning(`Unknown activity type: ${e.classID()}`))).filter(e=>!!e)}writeVisualization(e){return{id:e.chartPanel().id(),title:e.title(),description:e.description(),visibility:e.visibility(),chartType:e.chartType(),__class:e.chartPanel().widget().classID(),mappings:this.writeMappings(e.mappings()),properties:e.properties()}}readVisualization(e,t){const i=this.readMappings(e.mappings);return t.chartPanel().id(e.id),t.title(e.title).description(e.description).visibility(e.visibility).chartType(e.chartType).properties(e.properties).mappings(i),this}writeViewDatasource(e){const t=e.toDDL();return t.id=this._dsWriteDedup.resolveID(e)||t.id,t}writeDDLViews(){const e={inputs:{},outputs:{}};for(const t of this._ec.elements())t.visualization().mappings().referencedFields(e);return this._ec.elements().map(e=>{const t=e.hipiePipeline(),i=t.datasource();if(i instanceof $e){const s=i.datasourceRef();return{id:e.id(),datasource:this.writeViewDatasource(s),activities:this.writeActivities(t),visualization:this.writeVisualization(e.visualization())}}throw new Error("Missing DSPicker?")})}writeProperties(){return{name:v,version:g,buildVersion:y,layout:this._dashboard.layout()}}readDDLViews(e){for(const t of e){const e=new Et(this._ec).id(t.id);this._ec.append(e);const i=e.hipiePipeline();this.readDatasourceRef(t.datasource,i.datasource(),this._ec);for(const s of t.activities){if(r.DDL2.isProjectActivity(s)){const e=this.readProject(s);i.project(e)}if(r.DDL2.isFilterActivity(s)){const e=this.readFilters(s,this._ec);i.filters(e)}if(r.DDL2.isGroupByActivity(s)){const e=this.readGroupBy(s);i.groupBy(e)}if(r.DDL2.isSortActivity(s)){const e=this.readSort(s);i.sort(e)}if(r.DDL2.isLimitActivity(s)){const e=this.readLimit(s);i.limit(e)}}this.readVisualization(t.visualization,e.visualization())}}readProperties(e){e&&e.layout&&this._dashboard.layoutObj(e.layout)}write(){this._dsWriteDedup.clear();return{version:"2.2.1",createdBy:{name:v,version:g},datasources:this.writeDatasources(),dataviews:this.writeDDLViews(),properties:this.writeProperties(),hipieProperties:this._dashboard.hipieProps()}}read(e){this._dsWriteDedup.clear();for(const t of e.datasources)switch(t.type){case"databomb":this._ec.appendDatasource(H.fromDDL(t));break;case"form":this._ec.appendDatasource(N.fromDDL(t));break;case"logicalfile":this._ec.appendDatasource(oe.fromDDL(this._ec,t));break;case"wuresult":const e=ie.fromDDL(this._ec,t);this._dsReadDedup[e.id()]=e;for(const r in t.outputs)this._ec.appendDatasource(e.output(r));break;case"roxie":case"hipie":const i=be.fromDDL(this._ec,t);this._dsReadDedup[i.id()]=i;for(const r in t.outputs)this._ec.appendDatasource(Fe.fromDDL(this._ec,i,r));break;case"rest":const s=ue.fromDDL(this._ec,t);this._dsReadDedup[s.id()]=s;for(const r in t.outputs)this._ec.appendDatasource(de.fromDDL(this._ec,s,r));break;default:Ot.warning(`Unknown ddl datasource type: ${t.type} `)}this.readDDLViews(e.dataviews),this.readProperties(e.properties),this._dashboard.hipieProps(e.hipieProperties)}};f(Gt,"DDLAdapter");let Jt=Gt;const Ut=class _Imports{_moduleMap={};append(e){this._moduleMap[e.module]||(this._moduleMap[e.module]={}),this._moduleMap[e.module][e.class]=!0}write(){const e=[];for(const t in this._moduleMap){const i=[];for(const e in this._moduleMap[t])i.push(e);i.sort(),e.push(`import { ${i.join(", ")} } from "${t}";`)}return e.join("\n")}};f(Ut,"Imports");let Qt=Ut;function Kt(e){const t={};for(const i of e.publishedProperties())if(e[i.id+"_modified"]()&&"fields"!==i.id){const s=e[i.id]();if("propertyArray"===i.type){const e=s.map(Kt);e&&(t[i.id]=e)}else t[i.id]=s}return t}f(Kt,"createProps");const Xt=class _JavaScriptAdapter{_dashboard;_ec;_ddlAdapter;_ddlSchema;constructor(e){this._dashboard=e,this._ec=this._dashboard.elementContainer(),this._ddlAdapter=new Jt(this._dashboard),this._ddlSchema=this._ddlAdapter.write()}createProps(e,t,i=""){let s=[];for(const r of t.publishedProperties())if(t[r.id+"_exists"]())switch(r.type){case"string":case"set":s.push(`${e}.${r.id}("${t[r.id]()}")${i};`);break;case"number":case"boolean":s.push(`${e}.${r.id}(${t[r.id]()})${i};`);break;case"widget":s=s.concat(this.createProps(`${e}.${r.id}()`,t[r.id]()));break;case"propertyArray":r.ext&&s.push(`${e}.${r.id}([${t[r.id]()}])${i};`)}return s}writeMeta(e){return""}safeID(e){return e?e.replace(/ /g,"_").replace(/\./g,"_"):e}datasourceRefID(e){const t=e.datasource;return r.DDL2.isRoxieServiceRef(t)?`${this.safeID(t.id)}_${this.safeID(t.output)}_${this.safeID(e.id)}`:r.DDL2.isWUResultRef(t)?`${this.safeID(t.id)}_${this.safeID(t.output)}`:`${this.safeID(t.id)}`}_dedup={};writeDatasource(e){const t=e.datasource,i=[],s=this._ddlSchema.datasources.filter(e=>e.id===t.id)[0],r=t.output,a=this.datasourceRefID(e);if(!this._dedup[a])switch(this._dedup[a]=!0,s.type){case"wuresult":const o=this.safeID(e.datasource.id);this._dedup[o]||(this._dedup[o]=!0,i.push(` export const ${o} = new marshaller.WU()\n .url("${s.url}")\n .wuid("${s.wuid}")\n ;`)),i.push(` export const ${a} = new marshaller.WUResult()\n .wu(${o})\n .resultName("${r}")\n .responseFields(${b(s.outputs[r].fields)})\n ;`);break;case"logicalfile":i.push(` export const ${a} = new marshaller.LogicalFile()\n .url("${s.url}")\n .logicalFile("${s.logicalFile}")\n .responseFields(${b(s.fields)})\n ;`);break;case"hipie":case"roxie":const n=this.safeID(e.datasource.id);this._dedup[n]||(this._dedup[n]=!0,i.push(` export const ${n} = new marshaller.RoxieService(ec)\n .url("${s.url}")\n .querySet("${s.querySet}")\n .queryID("${s.queryID}")\n .requestFields(${b(s.inputs)})\n ;`));const l=n+"_"+this.safeID(r);this._dedup[l]||(this._dedup[l]=!0,i.push(` export const ${l} = new marshaller.RoxieResult(ec)\n .service(${n})\n .resultName("${r}")\n .responseFields(${b(s.outputs[r].fields)})\n ;`)),i.push(` export const ${a} = new marshaller.HipieResultRef(ec)\n .datasource(${l})\n .requestFieldRefs(${b(t.request)})\n ;`);break;case"databomb":i.push(` export const ${a} = new marshaller.Databomb()\n .format("${s.format}")\n .payload(${JSON.stringify(s.payload)})\n ;`);break;case"form":{const e=[];for(const t of s.fields)e.push(`new marshaller.FormField().fieldID("${t.id}").default("${t.default||""}")`);i.push(` export const ${a} = new marshaller.Form()\n .formFields([\n ${e.join(",\n ")}\n ])\n ;`)}}return i}writeActivity(e){switch(e.type){case"filter":return`new marshaller.Filters(ec).conditions(${b(e.conditions)})`;case"project":return`new marshaller.Project().transformations(${b(e.transformations)})`;case"groupby":return`new marshaller.GroupBy().fieldIDs(${JSON.stringify(e.groupByIDs)}).aggregates(${b(e.aggregates)})`;case"sort":return`new marshaller.Sort().conditions(${b(e.conditions)})`;case"limit":return`new marshaller.Limit().rows(${e.limit})`;case"mappings":return`new marshaller.Mappings().transformations(${b(e.transformations)})`}}writeWidgetProps(e){const t=[];for(const i of e.publishedProperties())e[i.id+"_modified"]()&&"fields"!==i.id&&t.push(`.${i.id}(${JSON.stringify(e[i.id]())})`);return t}joinWithPrefix(e,t,i,r){let a,o="";e.__class&&(a=s.classID2Meta(e.__class),t.append(a),o+=`new ${a.class}()`);for(const n in e)if("__class"===n);else if(s.isArray(e[n])){const s=`${e[n].map(e=>this.joinWithPrefix(e,t,i+" ","")).join(`,${i} `)}`;s&&(o+=`${i} .${n}([${i} ${s}${i} ])${r}`)}else o+=`${i} .${n}(${JSON.stringify(e[n])})${r}`;return o}writeWidget(e,t){return` export const ${e.visualization.id} = new marshaller.VizChartPanel()\n .id("${e.visualization.id}")\n .title("${e.visualization.title}")\n .widget(${this.joinWithPrefix(e.visualization.properties.widget,t,"\n ","")})\n ;`}writeElement(e){const t=[`data.${this.datasourceRefID(e)}`];for(const s of e.activities)t.push(this.writeActivity(s));const i=[];for(const s of this._ec.filteredBy(e.id))i.push(`${s.id()}.refresh();`);return`\nconst ${e.id} = new marshaller.Element(ec)\n .id("${e.id}")\n .pipeline([\n ${t.join(",\n ")}\n ])\n .mappings(new marshaller.Mappings().transformations(${b(e.visualization.mappings.transformations)}))\n .chartPanel(viz.${e.visualization.id})\n .on("selectionChanged", () => {\n ${i.join("\n ")}\n }, true)\n ;\n${e.id}.visualization()\n .visibility("${e.visualization.visibility}")\n .secondaryDataviewID("${e.visualization.secondaryDataviewID||""}")\n ;\nec.append(${e.id});\n`}writeDatasources(){let e=[];for(const t of this._ddlSchema.dataviews)e=e.concat(this.writeDatasource(t));return e}writeWidgets(){const e=[],t=new Qt;for(const i of this._ddlSchema.dataviews)e.push(this.writeWidget(i,t));return{widgetImports:t.write(),widgetDefs:e.join("\n\n")}}writeElements(){let e="";for(const t of this._ddlSchema.dataviews)e+=this.writeElement(t);return e}createJavaScript(){const e=this.writeWidgets();return`${e.widgetImports}\nimport * as marshaller from "@hpcc-js/marshaller";\n\n// Dashboard Element Container (Model) ---\nconst ec = new marshaller.ElementContainer();\n\nnamespace data {\n${this.writeDatasources().join("\n")}\n}\n\nnamespace viz {\n${e.widgetDefs}\n}\n\n// Dashboard Elements (Controller) ---\n${this.writeElements().trim()}\n\nec.refresh();\n\n// Optional ---\nconst errors = ec.validate();\nfor (const error of errors) {\n console.error(error.elementID + " (" + error.source + "): " + error.msg);\n}\n\nexport const dashboard = new marshaller.Dashboard(ec)\n .target("placeholder")\n .titleVisible(false)\n .hideSingleTabs(true)\n .layoutObj(${b(this._dashboard.layout())})\n .render()\n ;\n\n// @ts-ignore\nconst ddl = ${JSON.stringify(this._ddlSchema)};\n`}};f(Xt,"JavaScriptAdapter");let Yt=Xt;const Zt=class _Dashboard extends u.ChartPanel{constructor(e){super(),this._ec=e,this._ec.on("vizStateChanged",e=>{this.vizStateChanged(e)}),this.buttons([this._designModeButton,new i.Spacer,this._addButton,this._removeButton,new i.Spacer,this._reloadButton,new i.Spacer,this._addSamples]),this.ensureDockPanel("dock")}_ec;_dockPanel;_designModeButton=(new i.ToggleButton).faChar("fa-object-group").tooltip("Design Mode...").selected(!0).on("click",()=>{this._dockPanel instanceof Tt&&this._dockPanel.designMode(this._designModeButton.selected()).lazyRender()});_addButton=(new i.Button).faChar("fa-plus").tooltip("Add...").on("click",()=>{const e=new Et(this._ec);this._ec.append(e),this.renderPromise().then(()=>{e.refresh().then(()=>{this.activate(e)})})});_removeButton=(new i.Button).faChar("fa-minus").tooltip("Remove...").enabled(!1).on("click",()=>{const e=this._prevActive;e&&window.confirm(`Remove Widget "${e.id()}"?`)&&(this._ec.clear(e.id()),this.renderPromise().then(()=>{this.vizActivation(void 0)}))});_reloadButton=(new i.Button).faChar("fa-refresh").tooltip("Reload...").on("click",()=>{const e=this.save();this._ec.clear(),this.vizActivation(void 0),this.renderPromise().then(()=>{this.restore(e),this.renderPromise().then(()=>{this._ec.refresh().then(()=>{})})})});_addSamples=(new i.Button).faChar("fa-database").tooltip("Add Samples").on("click",()=>{Promise.all([Mt("https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/airports.csv"),Mt("https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/carriers.csv"),Mt("https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/stats.csv")]).then(([e,t,i])=>{const s=this.addForm("popup",{type:"form",id:"global_filter",fields:[{type:"string",id:"Airport"},{type:"string",id:"Airline"}]});s.visualization().title("Global Filter").visibility("flyout").chartType("FieldForm");const r=this.addDatabomb("airports",e,"csv",[(new q).fieldID("code").type("string"),(new q).fieldID("name").type("string"),(new q).fieldID("count").type("number")],new qe(this._ec).remoteFilter([(new qe.Filter).source(s.id()).mappings([(new qe.Mapping).remoteField("Airport").localField("code").nullable(!0)])]),(new ct).column([(new ct.Column).fieldID("count").descending(!0)]));r.chartPanel().title("Airports");const a=this.addDatabomb("carriers",t,"csv",[(new q).fieldID("code").type("string"),(new q).fieldID("name").type("string"),(new q).fieldID("count").type("number")],new qe(this._ec).remoteFilter([(new qe.Filter).source(s.id()).mappings([(new qe.Mapping).remoteField("Airline").localField("code").nullable(!0)])]),(new ct).column([(new ct.Column).fieldID("count").descending(!0)]));a.chartPanel().title("Airlines");const o=this.addDatabomb("stats",i,"csv",[],new qe(this._ec).remoteFilter([(new qe.Filter).source(r.id()).mappings([(new qe.Mapping).remoteField("code").localField("airport")]),(new qe.Filter).source(a.id()).mappings([(new qe.Mapping).remoteField("code").localField("carrier").nullable(!0)])]));return o.chartPanel().title("Stats"),Promise.all([s.refresh(),r.refresh(),a.refresh(),o.refresh()])}).then(()=>{this.render()})});addDatabomb(e,t,i="csv",s,...r){const a=(new H).id(e).format(i).payload(t);s.length>0&&a.databombFields(s),this._ec.appendDatasource(a);const o=new Et(this._ec),n=o.hipiePipeline().datasource();n instanceof $e&&n.datasourceID(a.id());for(const l of r)l instanceof qe?o.hipiePipeline().filters(l):l instanceof at?o.hipiePipeline().project(l):l instanceof Je?o.hipiePipeline().groupBy(l):l instanceof ct?o.hipiePipeline().sort(l):l instanceof Qe&&o.hipiePipeline().limit(l);return this._ec.append(o),o}addForm(e,t){const i=(new N).id(e).fromDDL(t);this._ec.appendDatasource(i);const s=new Et(this._ec),r=s.hipiePipeline().datasource();return r instanceof $e&&r.datasourceID(i.id()),this._ec.append(s),s}static create(e,t){return new Promise((i,s)=>{const r=new zt,a=new _Dashboard(r).target(e).hideSingleTabs(!0).titleVisible(!1).restore(t).render(e=>{r.refresh().then(()=>{i(a)})})})}ensureDockPanel(e="dock"){("dock"!==e||this._dockPanel instanceof Vt)&&("grid"!==e||this._dockPanel instanceof Tt)||(this._dockPanel=("dock"===e?new Vt(this._ec):new Tt(this._ec).designMode(this.titleVisible())).on("vizActivation",e=>{this.vizActivation(e)}),this.widget(this._dockPanel))}elementContainer(){return this._ec}_hipieProps;hipieProps(e){return arguments.length?(this._hipieProps=e,this):this._hipieProps}ddl(e){const t=new Jt(this);return arguments.length?(this._ec.clear(),t.read(e),this):t.write()}layoutObj(e){return this._dockPanel.layoutObj(e),this}save(){return new Jt(this).write()}serializeDDL(){return JSON.stringify(this.save())}deserializeDDL(e){return this.restore(JSON.parse(e))}restore(e,t=!1){this.ensureDockPanel(e&&e.properties&&e.properties.layout instanceof Array?"grid":"dock"),this._ec.clear();return new Jt(this).read(e),t&&this.renderPromise().then(()=>{this._ec.refresh()}),this}importDDL(e,t,i,s={}){const a=r.isDDL2Schema(e)?e:r.upgrade(e,t,i,!0,s);return this.restore(a,!0)}javascript(){return new Yt(this).createJavaScript()}layout(){return this._dockPanel.layout()}widgets(){return this._dockPanel.widgets()}activate(e){this._dockPanel.activate(e)}hideSingleTabs(e){return arguments.length?(this._dockPanel.hideSingleTabs(e),this):this._dockPanel.hideSingleTabs()}updateButtonState(){this._designModeButton.enabled(this._dockPanel instanceof Tt).render(),this._removeButton.enabled(void 0!==this._prevActive).render()}update(e,t){this._dockPanel.syncWidgets(),super.update(e,t),this.updateButtonState()}_prevActive;vizActivation(e){this._prevActive=e,this._removeButton.enabled(void 0!==e).render()}vizStateChanged(e){}render(e){return this._dockPanel.syncPopups(),super.render(t=>{e&&e(t)})}};f(Zt,"Dashboard");let ei=Zt;ei.prototype._class+=" dashboard_dashboard";const ti=class _DDLEditor extends c.SplitPanel{summary="0 Errors";_ddlEditor=(new d.JSONEditor).on("changes",e=>{this.checkSyntax()});_errorTable=(new o.Table).columns(["dataPath","keyword","message","params"]);ddl(e){return arguments.length?(this._ddlEditor.json(e),this.checkSyntax(),this):this._ddlEditor.json()}checkSyntax(){try{const t=this.ddl();try{const{success:e,errors:i}=r.validate2(t);e?this._errorTable.data([]):this._errorTable.data(i.map(e=>[e.dataPath,e.keyword,e.message,JSON.stringify(e.params)]))}catch(e){this._errorTable.data([["","Validation Failed","",""]])}}catch(e){this._errorTable.data([["ALL","Invalid JSON","",""]])}this._renderCount&&this._errorTable.lazyRender()}enter(e,t){super.enter(e,t),this.addWidget(this._ddlEditor).addWidget(this._errorTable)}update(e,t){super.update(e,t)}};f(ti,"DDLEditor");let ii=ti;ii.prototype._class+=" codemirror_DDLEditor";const si=class _GraphAdapter{constructor(e){this._ec=e}_ec;subgraphMap={};vertexMap={};edgeMap={};hierarchy=[];vertices=[];edges=[];clear(){this.subgraphMap={},this.vertexMap={},this.edgeMap={},this.hierarchy=[],this.vertices=[],this.edges=[]}createSubgraph(e,t,i){let s=this.subgraphMap[e];return s||(s=(new l.Subgraph).columns(["DS"]).data([[i]]),this.subgraphMap[e]=s),this.vertices.push(s),s.title(`${t}`),s.getBBox(!0),s}createVertex(e,t,i,s="",r="#dcf1ff"){let a=this.vertexMap[e];return a||(a=(new l.Vertex).columns(["DS"]).data([[i]]).icon_diameter(0),this.vertexMap[e]=a),this.vertices.push(a),a.textbox_shape_colorFill(r).text(s?`${t}\n${s}`:`${t}`).tooltip(s),a.getBBox(!0),a}createEdge(e,t){const i=`${e}->${t}`;let s=this.edgeMap[i];return s||(s=(new l.Edge).sourceVertex(this.vertexMap[e]).targetVertex(this.vertexMap[t]),this.edgeMap[i]=s),this.edges.push(s),s}createDatasource(e){if(e instanceof $e&&(e=e.selection().datasource()),e instanceof ee){const t=`${e.url()}`,i=this.createSubgraph(t,`${t}`),s=`${e.url()}/${e.wuid()}`,r=this.createSubgraph(s,`${e.wuid()}`);this.hierarchy.push({parent:i,child:r});const a=`${s}/${e.resultName()}`,o=this.createVertex(a,e.resultName(),{activity:e});return this.hierarchy.push({parent:r,child:o}),a}if(e instanceof oe){const t=`${e.url()}`,i=this.createSubgraph(t,`${t}`),s=`${t}/${e.logicalFile()}`,r=this.createVertex(s,e.logicalFile(),{activity:e});return this.hierarchy.push({parent:i,child:r}),s}if(e instanceof Pe){const t=`${e.url()}`,i=this.createSubgraph(t,`${t}`),s=e.serviceID(),r=this.createSubgraph(s,e.querySet());this.hierarchy.push({parent:i,child:r});const a=s;this.hierarchy.push({parent:r,child:this.createVertex(a,e.queryID())});const o=`${s}/${e.resultName()}`;return this.hierarchy.push({parent:r,child:this.createVertex(o,e.resultName(),{activity:e})}),this.createEdge(a,o),o}if(e instanceof Fe){const t=`${e.service().url()}`,i=this.createSubgraph(t,`${t}`),s=e.serviceID(),r=this.createSubgraph(s,e.service().querySet());this.hierarchy.push({parent:i,child:r});const a=`${s}/${e.service().queryID()}`,o=this.createSubgraph(a,e.service().queryID());this.hierarchy.push({parent:r,child:o});const n=`${a}/${e.resultName()}`;return this.hierarchy.push({parent:o,child:this.createVertex(n,e.resultName(),{activity:e})}),this.createEdge(a,n),n}if(e instanceof fe){const t=`${e.url()}`,i=this.createSubgraph(t,`${t}`),s=e.serviceID(),r=this.createSubgraph(s,e.action());this.hierarchy.push({parent:i,child:r});const a=s;this.hierarchy.push({parent:r,child:this.createVertex(a,e.action())});const o=`${s}/${e.resultName()}`;return this.hierarchy.push({parent:r,child:this.createVertex(o,e.resultName(),{activity:e})}),this.createEdge(a,o),o}if(e instanceof de){const t=`${e.service().url()}`,i=this.createSubgraph(t,`${t}`),s=e.serviceID(),r=`${t}/${e.service().action()}`,a=this.createSubgraph(s,e.service().action());this.hierarchy.push({parent:i,child:a});const o=`${r}/${e.resultName()}`;return this.hierarchy.push({parent:a,child:this.createVertex(o,e.resultName(),{activity:e})}),this.createEdge(r,o),o}if(e instanceof N){const t=e.hash();return this.createVertex(t,e.label(),{activity:e}),t}if(e instanceof H){const t=e.id();return this.createVertex(t,e.label(),{activity:e}),t}{const t=e.hash();return this.createVertex(t,e.label(),{activity:e}),t}}createActivity(e,t,i,s){const r=this.createSubgraph(t.id(),`${t.id()}`,{view:t});let a=null,o="";if(i.exists()){const e=i.validate();e.length&&(a="pink",o=e.map(e=>`${e.source}: ${e.msg}`).join("\n"))}else a="lightgrey";const n=this.createVertex(i.id(),s||`${i.classID()}`,{view:t,activity:i},o,a);return e&&this.createEdge(e,i.id()),this.hierarchy.push({parent:r,child:n}),i.id()}createGraph(){this.hierarchy=[],this.vertices=[],this.edges=[],this._ec.elements().forEach(e=>{this.createDatasource(e.hipiePipeline().datasource())});const e={};for(const t of this._ec.elements()){const i=t.hipiePipeline();let s=this.createDatasource(i.datasource());for(const e of i.activities())s=this.createActivity(s,t,e);const r=t.visualization(),a=r.mappings(),o=this.createActivity(s,t,a,"Mappings"),n=`${r.id()}-sg`,l=this.createSubgraph(n,"Visualization",{visualization:r});this.hierarchy.push({parent:this.subgraphMap[t.id()],child:l}),this.hierarchy.push({parent:l,child:this.vertexMap[a.id()]});const h=`${r.id()}-viz`,u=this.createVertex(h,r.chartPanel().widget().classID(),{view:t,chartPanel:r.chartPanel()});this.createEdge(o,h),this.hierarchy.push({parent:l,child:u});const c=`${r.id()}-state`,d=this.createVertex(c,"Selection",{view:t,state:t.state()});this.createEdge(h,c).weight(10).strokeDasharray("1,5").text("updates"),this.createEdge(s,c),this.hierarchy.push({parent:this.subgraphMap[t.id()],child:d}),s=c,e[i.id()]=s}for(const t of this._ec.elements()){const e=t.visualization(),i=this._ec.element(e.secondaryDataviewID());if(i){const t=i.visualization().mappings();this.createEdge(t.id(),`${e.id()}-viz`)}}for(const t of this._ec.elements()){const i=t.hipiePipeline();for(const t of i.updatedByGraph())this.createEdge(e[this._ec.element(t.from).hipiePipeline().id()],t.to.id()).weight(10).strokeDasharray("1,5").text("updates")}return{vertices:this.vertices,edges:this.edges,hierarchy:this.hierarchy}}};f(si,"GraphAdapter");let ri=si;const ai=class _DSTable extends u.ChartPanel{constructor(e){super(),this._ec=e,this.buttons([this._addButton,this._removeButton,new i.Spacer,this._cloneButton,new i.Spacer,this._addSamples]).widget(this._dstable).columns(["ID","Type","References"]).on("click",(e,t,i)=>{this._selectedDS2=e.__lparam,i&&0===e.References&&"Empty"!==e.ID?this._selectedDS=e.__lparam:delete this._selectedDS,this._removeButton.enabled(void 0!==this._selectedDS).render(),this._cloneButton.enabled(void 0!==this._selectedDS2).render()}),this.initMenu()}_ec;_addButton=(new i.Button).faChar("fa-plus").tooltip("Add...").on("click",()=>{const e=this._addButton.element().node(),t=e.getBoundingClientRect();this._contextMenu.open({target:e,currentTarget:e,clientX:t.left,clientY:t.bottom})});_removeButton=(new i.Button).faChar("fa-minus").tooltip("Remove...").enabled(!1).on("click",()=>{this.remove()});_cloneButton=(new i.Button).faChar("fa-clone").tooltip("Clone...").enabled(!1).on("click",()=>{this._selectedDS2&&(this._selectedDS2 instanceof H?this.add(H.fromDDL(this._selectedDS2.toDDL(),!0)):this._selectedDS2 instanceof N?this.add(N.fromDDL(this._selectedDS2.toDDL(),!0)):this._selectedDS2 instanceof oe?this.add(oe.fromDDL(this._ec,this._selectedDS2.toDDL(),!0)):this._selectedDS2 instanceof de?this.add(new de(this._ec).service(ue.fromDDL(this._ec,this._selectedDS2.service().toDDL(),!0)).resultName(this._selectedDS2.resultName())):this._selectedDS2 instanceof ee?this.add(new ee(this._ec).wu(ie.fromDDL(this._ec,this._selectedDS2.wu().toDDL(),!0)).resultName(this._selectedDS2.resultName())):this._selectedDS2 instanceof Fe?this.add(new Fe(this._ec).service(be.fromDDL(this._ec,this._selectedDS2.service().toDDL(),!0)).resultName(this._selectedDS2.resultName())):console.warn("Unknown datasoure type"))});_addSamples=(new i.Button).faChar("fa-database").tooltip("Add Samples").on("click",()=>{Mt("https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/airports.csv").then(e=>{this.add((new H).format("csv").payload(e))}),Mt("https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/carriers.csv").then(e=>{this.add((new H).format("csv").payload(e))}),Mt("https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/stats.csv").then(e=>{this.add((new H).format("csv").payload(e))}),this.add(new de(this._ec).service(new ue(this._ec).url("https://cmsapi.pulselive.com/").action("rugby/rankings/mru").requestFields([(new le).fieldID("xxx"),(new le).fieldID("date")])).resultName("entries")),this.add(new ee(this._ec).wu(new ie(this._ec).url("http://localhost:8010").wuid("W20190802-112509")).resultName("Result 1")),this.add(new oe(this._ec).url("http://localhost:8010").logicalFile("progguide::exampledata::peopleaccts")),this.add(new oe(this._ec).url("http://localhost:8010").logicalFile("progguide::exampledata::people"));const e=new be(this._ec).url("http://localhost:8002").querySet("roxie").queryID("peopleaccounts");this.add(new Fe(this._ec).service(e).resultName("Accounts")),this.add((new N).formFields([(new q).type("number").fieldID("id").value(8),(new q).fieldID("first_name").value("John"),(new q).fieldID("last_name").value("Doe"),(new q).fieldID("gender").default("M"),(new q).type("number").fieldID("age")])),this.render()});_dstable=new o.Table;_selectedDS;_selectedDS2;_contextMenu;initMenu(){const e=new c.CommandRegistry;e.addCommand("add_wu_result",{label:"Workunit Result",execute:f(()=>{this.add(new ee(this._ec))},"execute")}),e.addCommand("add_logicalfile",{label:"Logical File",execute:f(()=>{this.add(new oe(this._ec))},"execute")}),e.addCommand("add_roxie",{label:"Roxie Service",execute:f(()=>{this.add(new Fe(this._ec))},"execute")}),e.addCommand("add_rest",{label:"Rest",execute:f(()=>{this.add(new de(this._ec))},"execute")}),e.addCommand("add_databomb",{label:"Databomb",execute:f(()=>{this.add(new H)},"execute")}),e.addCommand("add_form",{label:"Form",execute:f(()=>{this.add(new N)},"execute")}),this._contextMenu=new c.ContextMenu({commands:e}),this._contextMenu.addItem({command:"add_wu_result",selector:".common_Button"}),this._contextMenu.addItem({command:"add_logicalfile",selector:".common_Button"}),this._contextMenu.addItem({command:"add_roxie",selector:".common_Button"}),this._contextMenu.addItem({command:"add_rest",selector:".common_Button"}),this._contextMenu.addItem({command:"add_databomb",selector:".common_Button"}),this._contextMenu.addItem({command:"add_form",selector:".common_Button"})}add(e){this._ec.appendDatasource(e),this.render()}remove(){this._selectedDS&&(this._ec.removeDatasource(this._selectedDS),this.render())}_prevDataID;render(e){const t={};this._ec.elements().forEach(e=>{let i=e.hipiePipeline().datasource();i instanceof $e&&(i=i.datasource()),void 0===t[i.id()]&&(t[i.id()]=0),t[i.id()]++});const i=this._ec.datasources().filter(e=>"Empty"!==e.id()).map(e=>(void 0===t[e.id()]&&(t[e.id()]=0),[e.id(),e.classID(),t[e.id()]||0,e])),s=JSON.stringify(t);return this._prevDataID!==s&&(this._prevDataID=s,this.data(i)),super.render(e)}};f(ai,"DSTable");let oi=ai;const ni=class _DVTable extends u.ChartPanel{constructor(e){super(),this._ec=e,this.titleVisible(!1).widget(this._dvtable).columns(["ID","Title"])}_ec;_dvtable=new o.Table;_prevDataID;render(e){const t=this._ec.elements().map(e=>[e.id(),e.visualization().title(),e]),i=s.hashSum(t.map(e=>e[0]));return this._prevDataID!==i&&(this._prevDataID=i,this.data(t)),super.render(e)}};f(ni,"DVTable");let li=ni;const hi=class _PipelineSelectionButton extends i.SelectionButton{_label;label(e){return arguments.length?(this._label=e,this.tooltip(e),this):this._label}_elementErrors=[];errors(e){return arguments.length?(this._elementErrors=e,this.classed("error",e.length>0),e.length?this.tooltip(e.map(e=>{const t=e.source.split(".");return t.splice(0,1),`${t.join(".")}: ${e.msg}`}).join("\n")):this.tooltip(this._label),this.render(),this):this._elementErrors}};f(hi,"PipelineSelectionButton");let ui=hi;const ci=class _PipelinePanel extends u.ChartPanel{_owner;datasource=(new ui).faChar("fa-database").label("Datasource").selected(!0);filter=(new ui).faChar("fa-filter").label("Filter");project=(new ui).faChar("fa-random").label("Project");groupBy=(new ui).faChar("fa-object-group").label("Group By");sort=(new ui).faChar("fa-sort-alpha-asc").label("Sort");limit=(new ui).faChar("fa-list-ol").label("Limit");mappings=(new ui).faChar("fa-random").label("Mappings");chartPanel=(new ui).faChar("fa-area-chart").label("Visualization");state=(new ui).faChar("fa-check-square-o").label("State");debug=(new ui).faChar("fa-bug").label("Debug");all=(new ui).faChar("fa-list").label("All");_propEditor=(new p.PropertyEditor).show_header(!1).show_settings(!1).showFields(!1);_buttons=[this.datasource,this.filter,this.project,this.groupBy,this.sort,this.limit,new i.Spacer,this.mappings,this.chartPanel,new i.Spacer,this.state,this.debug,new i.Spacer,this.all];_pipelineButton=this.datasource;_pipelineSelection=(new i.SelectionBar).buttons(this._buttons).on("selected",e=>{this._pipelineButton=e,this.title(e.label()).render()});constructor(e){super(),this._owner=e,this.buttons([this._pipelineSelection]),this.title(this.datasource.label()),super.widget(this._propEditor),this._propEditor.monitor((e,t,i,s)=>{s!==this._propEditor&&(this.propChanged(e,t,i,s),this.updateState())})}selectionButtons(){return this._pipelineSelection.buttons().filter(e=>e instanceof ui)}_propExt;propExt(e){return arguments.length?(this._propExt=e,this):this._propExt}peAsDatasource(){return this._propExt instanceof B||this._propExt instanceof $e?this._propExt:this._propExt instanceof Et?this._propExt.hipiePipeline().datasource():void 0}peAsFilter(){return this._propExt instanceof qe?this._propExt:this._propExt instanceof Et?this._propExt.hipiePipeline().filters():void 0}peAsProject(){return this._propExt instanceof at?this._propExt:this._propExt instanceof Et?this._propExt.hipiePipeline().project():void 0}peAsGroupBy(){return this._propExt instanceof Je?this._propExt:this._propExt instanceof Et?this._propExt.hipiePipeline().groupBy():void 0}peAsSort(){return this._propExt instanceof ct?this._propExt:this._propExt instanceof Et?this._propExt.hipiePipeline().sort():void 0}peAsLimit(){return this._propExt instanceof Qe?this._propExt:this._propExt instanceof Et?this._propExt.hipiePipeline().limit():void 0}peAsMappings(){return this._propExt instanceof nt?this._propExt:this._propExt instanceof Et?this._propExt.visualization().mappings():this._propExt instanceof Lt?this._propExt.mappings():void 0}peAsChartPanel(){return this._propExt instanceof u.ChartPanel||this._propExt instanceof Lt?this._propExt:this._propExt instanceof Et?this._propExt.visualization():void 0}peAsState(){return this._propExt instanceof It?this._propExt:this._propExt instanceof Et?this._propExt.state():void 0}selectionButton(){if(this._pipelineButton&&this._pipelineButton.enabled())return this._pipelineButton;for(const e of this.selectionButtons())if(e.enabled())return e.selected(!0),e}_prevPropExt;_prevPipelineButton;update(e,t){super.update(e,t),this.updateState();const i=this.selectionButton();if(this._prevPropExt!==this._propExt||this._prevPipelineButton!==i){if(this._prevPropExt=this._propExt,this._prevPipelineButton=i,this._propExt&&i)switch(i){case this.datasource:this._propEditor.widget(this.peAsDatasource());break;case this.filter:this._propEditor.widget(this.peAsFilter());break;case this.project:this._propEditor.widget(this.peAsProject());break;case this.groupBy:this._propEditor.widget(this.peAsGroupBy());break;case this.sort:this._propEditor.widget(this.peAsSort());break;case this.limit:this._propEditor.widget(this.peAsLimit());break;case this.mappings:this._propEditor.widget(this.peAsMappings());break;case this.chartPanel:this._propEditor.widget(this.peAsChartPanel());break;case this.state:this._propEditor.widget(this.peAsState());break;case this.all:this._propEditor.widget(this._propExt)}else this._propEditor.widget(void 0);this._owner.loadPreview(this._propEditor.widget())}}updateButtonState(e,t){t.enabled(!!e),t.errors(!!e&&e.validate()||[])}updateState(){this.selectionButtons().forEach(e=>{if(e instanceof ui&&this.disableActivities().indexOf(e.label())>=0)this.updateButtonState(void 0,e);else{switch(e){case this.datasource:this.updateButtonState(this.peAsDatasource(),e);break;case this.filter:this.updateButtonState(this.peAsFilter(),e);break;case this.project:this.updateButtonState(this.peAsProject(),e);break;case this.groupBy:this.updateButtonState(this.peAsGroupBy(),e);break;case this.sort:this.updateButtonState(this.peAsSort(),e);break;case this.limit:this.updateButtonState(this.peAsLimit(),e);break;case this.mappings:this.updateButtonState(this.peAsMappings(),e);break;case this.chartPanel:const t=this.peAsChartPanel();e.enabled(!!t);break;case this.state:const i=this.peAsState();e.enabled(!!i);break;case this.debug:e.enabled(!1);break;case this.all:e.enabled(!!this._propExt)}e.selected()&&this.title(e.enabled()?e.label():"")}})}propChanged(e,t,i,s){}};f(ci,"PipelinePanel");let di=ci;di.prototype._class+=" marshaller_PipelinePanel";let pi=(m=class extends u.ChartPanel{_save=(new i.Button).faChar("fa-save").tooltip("Save").on("click",()=>{const e=this.activity();e&&e.fromDDL&&e.fromDDL(this._jsonEditor.json()),this.updateToolbar()});_reset=(new i.Button).faChar("fa-undo").tooltip("Reset").on("click",()=>{this._jsonEditor.text(this.jsonText()).lazyRender(),this.updateToolbar()});_jsonEditor=(new d.JSONEditor).on("changes",e=>{this.updateToolbar()});constructor(){super(),this._titleBar.buttons([this._save,this._reset]),this.widget(this._jsonEditor)}_activity;activity(e){return void 0===e?this._activity:(this._activity!==e&&(this._activity=e,delete this._prevJson),this)}jsonText(){const e=this.activity();return e&&e.toDDL?JSON.stringify(e.toDDL(),void 0,4):""}_prevJson;update(e,t){super.update(e,t);const i=this.jsonText(),s=this._jsonEditor.text();void 0!==this._prevJson&&this._prevJson!==s||this._prevJson===i||(this._prevJson=i,this._jsonEditor.text(i)),this.updateToolbar()}updateToolbar(){const e=this.activity(),t=this.jsonText(),i=this._jsonEditor.text();this._save.enabled(e&&e.fromDDL&&t!==i).lazyRender(),this._reset.enabled(t!==i).lazyRender()}},f(m,"DDLPreview"),m);const mi=class _PipelineSplitPanel extends c.SplitPanel{_rhsPropsPanel=new di(this).on("propChanged",(e,t,i,s)=>{this.propChanged(e,t,i,s)});_previewPanel=new c.TabPanel;_rhsDDLPreview=new pi;_rhsDataPreview=(new o.DatasourceTable).pagination(!0);constructor(){super(),this._previewPanel.addWidget(this._rhsDataPreview,"Data").addWidget(this._rhsDDLPreview,"DDL"),this.addWidget(this._rhsPropsPanel).addWidget(this._previewPanel)}loadDataProps(e){this._rhsPropsPanel.propExt(e).render()}loadPreview(e){e=e instanceof Lt?e.mappings():e,this._rhsDataPreview.datasource(new K(e instanceof S?e:void 0)).lazyRender(),this._rhsDDLPreview.activity(e).lazyRender()}refreshPreview(){const e=this._rhsDataPreview.datasource();e?e.exec().then(()=>{this._rhsDataPreview.invalidate().lazyRender(),this._rhsDDLPreview.lazyRender()}):this._rhsDDLPreview.lazyRender()}propChanged(e,t,i,s){}};f(mi,"PipelineSplitPanel");let _i=mi;di.prototype.publish("disableActivities",[],"array","Disabled pipeline items"),_i.prototype.publishProxy("disableActivities","_rhsPropsPanel");const fi=s.scopedLogger("marshaller/dashy"),Di=class _DDLPreview extends u.ChartPanel{constructor(e){super(),this._dashy=e,this._titleBar.buttons([this._save,this._reset]),this.widget(this._jsonEditor)}_dashy;_save=(new i.Button).faChar("fa-save").tooltip("Save").on("click",()=>{const e=JSON.parse(this._jsonEditor.text());this._dashy.importDDL(e),this.updateToolbar()});_reset=(new i.Button).faChar("fa-undo").tooltip("Reset").on("click",()=>{this._jsonEditor.text(this._ddl).lazyRender(),this.updateToolbar()});_jsonEditor=(new d.JSONEditor).on("changes",e=>{this.updateToolbar()});_ddl;ddl(e){return this._ddl=JSON.stringify(e,void 0,4),this}_prevJson;update(e,t){super.update(e,t),this._prevJson!==this._ddl&&(this._prevJson=this._ddl,this._jsonEditor.text(this._ddl)),this.updateToolbar()}updateToolbar(){const e=this._jsonEditor.text();this._save.enabled(this._ddl!==e).lazyRender(),this._reset.enabled(this._ddl!==e).lazyRender()}};f(Di,"DDLPreview");let vi=Di;const gi=class _Dashy extends c.SplitPanel{_elementContainer=new zt;_lhsSheet=new c.TabPanel;_lhsDashboard=new ei(this._elementContainer).on("vizActivation",(e,t)=>{this.focus(this._lhsDashboard,e)}).on("vizStateChanged",e=>{for(const t of this._elementContainer.filteredBy(e.id()))this.focus()===t&&this._rhsSplitView.refreshPreview()});_lhsDataviews=new li(this._elementContainer).on("click",(e,t,i,s)=>{this.focus(this._lhsDataviews,e.__lparam),this._rhsSplitView.refreshPreview()});_lhsDatasources=new oi(this._elementContainer).on("click",(e,t,i,s)=>{this.focus(this._lhsDatasources,e.__lparam),this._rhsSplitView.refreshPreview()});_graphAdapter=new ri(this._elementContainer);_lhsPipeline=(new l.Graph).layout("Hierarchy").allowDragging(!1).applyScaleOnLayout(!0).on("vertex_click",(e,t,i,s)=>{const r=e.__lparam[0]||{};this.focus(this._lhsPipeline,r.state||r.chartPanel||r.visualization||r.activity||r.view)}).on("vertex_contextmenu",(e,t,i,s)=>{});_lhsDebugSheet=new c.TabPanel;_lhsDebugDDLEditor=new vi(this);_lhsDebugDDLSchema=(new d.JSONEditor).json(r.ddl2Schema);_lhsDebugJSEditor=new d.JSEditor;_lhsDebugCloneEC=new zt;_lhsDebugClone=new ei(this._lhsDebugCloneEC).hideSingleTabs(!0).titleVisible(!1);_lhsDebugDDLv1=new d.JSONEditor;_lhsDebugDDLv2=new d.JSONEditor;_rhsSplitView=new _i;_fileOpen;static create(e,t,i,s){return new Promise((r,a)=>{const o=(new _Dashy).target(e).render(e=>{t?e.importDDL(t,i,s).then(()=>{r(o)}):r(o)})})}constructor(){super("horizontal")}elementContainer(){return this._elementContainer}clear(){return this._lhsDebugSheet.removeWidget(this._lhsDebugDDLv1),this._lhsDebugSheet.removeWidget(this._lhsDebugDDLv2),this._elementContainer.clear(),this._graphAdapter.clear(),this.focus(this._lhsDashboard,void 0),this.loadDashboard().then(()=>this._elementContainer.refresh()).then(e=>{})}save(){return this._lhsDashboard.save()}serializeDDL(){return JSON.stringify(this.save())}deserializeDDL(e){return this.restore(JSON.parse(e))}restore(e){return this._lhsSheet.active(this._lhsDashboard),this.clear().then(()=>(this._lhsDashboard.restore(e),this._lhsDataviews.render(),this._lhsDatasources.render(),this._lhsDashboard.renderPromise().then(()=>{const e=this._elementContainer.elements();return e.length&&this._lhsDashboard.activate(e[0]),this._elementContainer.refresh()}).then(()=>{let e=!1;for(const t of this._elementContainer.validate())e=!0,fi.warning(t.elementID+" ("+t.source+"): "+t.msg);e&&this._lhsDashboard.renderPromise()})))}importDDL(e,t,i,s={}){const a=r.isDDL2Schema(e)?e:r.upgrade(e,t,i,!0,s),o=this.restore(a);return r.isDDL2Schema(e)?(this._lhsDebugDDLv2.json(a),this._lhsDebugSheet.addWidget(this._lhsDebugDDLv2,"orig v2")):(this._lhsDebugDDLv1.json(e),this._lhsDebugDDLv2.json(a),this._lhsDebugSheet.addWidget(this._lhsDebugDDLv1,"v1").addWidget(this._lhsDebugDDLv2,"v1 -> v2")),o}activeLHS(){let e=this._lhsSheet.active();return e===this._lhsDebugSheet&&(e=this._lhsDebugSheet.active()),e}activeRHS(){return this._rhsSplitView}_currSelection={};focusAsElement(){const e=this.focus();return e instanceof Et?e:void 0}focus(e,t){return arguments.length?(this._currSelection[e.id()]!==t&&(this._currSelection[e.id()]=t,this.loadRHSSplit()),this):this._currSelection[this.activeLHS().id()]}loadRHSSplit(){this._rhsSplitView.loadDataProps(this.focus())}loadDataviews(){return this.activeLHS()===this._lhsDataviews?this._lhsDataviews.renderPromise():Promise.resolve(void 0)}loadDatasources(){return this.activeLHS()===this._lhsDatasources?this._lhsDatasources.renderPromise():Promise.resolve(void 0)}loadDashboard(){return this.activeLHS()===this._lhsDashboard?(this._elementContainer.validate(),this._lhsDashboard.renderPromise()):Promise.resolve(void 0)}loadGraph(){this._lhsPipeline.data({...this._graphAdapter.createGraph()},!0),this.activeLHS()===this._lhsPipeline&&this._lhsPipeline.lazyRender()}loadDDL(){this._lhsDebugDDLEditor.ddl(this._lhsDashboard.ddl()),this.activeLHS()===this._lhsDebugDDLEditor&&this._lhsDebugDDLEditor.lazyRender()}loadJavaScript(){this._lhsDebugJSEditor.javascript(this._lhsDashboard.javascript()),this.activeLHS()===this._lhsDebugJSEditor&&this._lhsDebugJSEditor.lazyRender()}loadClone(){const e=this.save();this._lhsDebugCloneEC.clear(),this._lhsDebugClone.renderPromise().then(()=>{this._lhsDebugClone.restore(e),this._lhsDebugClone.renderPromise().then(()=>this._lhsDebugCloneEC.refresh()).then(()=>{for(const e of this._lhsDebugCloneEC.validate())fi.warning(e.elementID+" ("+e.source+"): "+e.msg)})})}initMenu(){const e=new c.CommandRegistry;e.addCommand("dash_add",{label:"Add View",execute:f(()=>{const e=new Et(this._elementContainer);this._elementContainer.append(e),this.loadDashboard().then(()=>{e.refresh().then(()=>{this._lhsDashboard.activate(e)})})},"execute")}),e.addCommand("dash_clear",{label:"Clear",execute:f(()=>{this.clear()},"execute")}),e.addCommand("dash_save",{label:"Save",execute:f(()=>{const e=JSON.stringify(this.save(),null," ");i.Utility.downloadString("JSON",e,"dashy")},"execute")}),e.addCommand("dash_load",{label:"Open",execute:f(()=>{this._fileOpen.property("accept",".dashy,.json"),this._fileOpen.node().click()},"execute")});const t=new c.CommandPalette({commands:e});t.addItem({command:"addWUResult",category:"Notebook"}),t.addItem({command:"addView",category:"Notebook"}),t.addItem({command:"remove",category:"Notebook"}),t.id="palette";const s=new c.ContextMenu({commands:e});s.addItem({command:"dash_add",selector:`#${this._lhsDashboard.id()}`}),s.addItem({command:"dash_clear",selector:`#${this._lhsDashboard.id()}`}),s.addItem({type:"separator",selector:`#${this._lhsDashboard.id()}`}),s.addItem({command:"dash_load",selector:`#${this.id()}`}),s.addItem({command:"dash_save",selector:`#${this.id()}`}),document.addEventListener("contextmenu",e=>{s.open(e)&&e.preventDefault()})}addDatabomb(e,t,i){const s=(new H).id(e).format(i).payload(t);this._elementContainer.appendDatasource(s);const r=new Et(this._elementContainer),a=r.hipiePipeline().datasource();a instanceof $e&&a.datasourceID(s.id()),this._elementContainer.append(r),this.loadDashboard().then(()=>{r.refresh().then(()=>{this._lhsDashboard.activate(r)})})}enter(e,t){super.enter(e,t),this.addWidget(this._lhsSheet).addWidget(this._rhsSplitView),this._lhsSheet.addWidget(this._lhsDashboard,"Dashboard").addWidget(this._lhsDataviews,"Dataviews").addWidget(this._lhsDatasources,"Datasources").addWidget(this._lhsPipeline,"Pipeline").addWidget(this._lhsDebugSheet,"Debug").on("childActivation",e=>{switch(e){case this._lhsDataviews:case this._lhsDatasources:case this._lhsDashboard:this.loadRHSSplit();break;case this._lhsPipeline:this.loadRHSSplit(),this.loadGraph();break;case this._lhsDebugSheet:this._lhsDebugSheet.childActivation(this._lhsDebugSheet.active())}}),this._lhsDebugSheet.addWidget(this._lhsDebugDDLEditor,"v2").addWidget(this._lhsDebugDDLSchema,"Schema").addWidget(this._lhsDebugJSEditor,"TS").addWidget(this._lhsDebugClone,"Clone").on("childActivation",e=>{switch(e){case this._lhsDebugDDLEditor:this.loadRHSSplit(),this.loadDDL();break;case this._lhsDebugJSEditor:this.loadRHSSplit(),this.loadJavaScript();break;case this._lhsDebugClone:this.loadClone()}}),this.initMenu(),this._rhsSplitView.on("propChanged",(e,t,i,s)=>{const r=this.focusAsElement();switch(r?r.refresh().then(()=>{this._rhsSplitView.refreshPreview()}):this._rhsSplitView.refreshPreview(),this.activeLHS()){case this._lhsDashboard:this.loadDashboard();break;case this._lhsDatasources:this._elementContainer.refresh();break;case this._lhsPipeline:this.loadGraph();break;case this._lhsDebugDDLEditor:this.loadDDL();break;case this._lhsDebugClone:this.loadClone()}});const i=this;this._fileOpen=t.append("input").attr("type","file").property("accept",".dashy,.json").style("display","none").on("change",function(){const e=this.files[0];for(;e;){const t=new FileReader;t.onload=function(){return function(e){try{const t=Array.isArray(e.target.result)?e.target.result[0]:e.target.result,s=JSON.parse(t);i.importDDL(s)}catch(t){alert("ex when trying to parse json = "+t)}}}(),t.readAsText(e);break}})}update(e,t){super.update(e,t)}};f(gi,"Dashy");let yi=gi;yi.prototype._class+=" composite_Dashy",yi.prototype.publishProxy("disableActivities","_rhsSplitView"),Object.defineProperty(e,"hookSend",{enumerable:!0,get:f(()=>t.hookSend,"get")}),e.Activity=S,e.ActivityArray=C,e.ActivityPipeline=$,e.ActivitySelection=E,e.AggregateField=He,e.BUILD_VERSION=y,e.ColumnMapping=Ae,e.ComputedField=Ze,e.ComputedMapping=Xe,e.DDLAdapter=Jt,e.DDLEditor=ii,e.DSPicker=$e,e.Dashboard=ei,e.Dashy=yi,e.Databomb=H,e.Datasource=B,e.DatasourceAdapt=K,e.DatasourceRef=j,e.ESPResult=Y,e.Element=Et,e.ElementContainer=zt,e.Filters=qe,e.Form=N,e.FormField=q,e.GraphAdapter=ri,e.GroupBy=Je,e.GroupByColumn=Ne,e.HipiePipeline=pt,e.HipieResultRef=Le,e.JavaScriptAdapter=Yt,e.Limit=Qe,e.LogicalFile=oe,e.Mappings=nt,e.MultiField=tt,e.NullView=ft,e.PKG_NAME=v,e.PKG_VERSION=g,e.Project=at,e.ProjectBase=st,e.RemoteFilter=Be,e.RoxieResult=Fe,e.RoxieResultRef=Pe,e.RoxieService=be,e.Sort=ct,e.SortColumn=ht,e.State=It,e.StaticFilter=je,e.Visualization=Lt,e.VizChartPanel=yt,e.VizPopupPanel=vt,e.VizTypeSet=wt,e.WU=ie,e.WUResult=ee,e.WUResultRef=re,e.createProps=Kt,e.emptyDatabomb=U,e.rowToFields=O,e.schemaRow2IField=F,e.schemaType2IFieldType=w,e.stringify=b,e.wsEclSchemaRow2IField=x,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
2
2
|
//# sourceMappingURL=index.umd.cjs.map
|
|
3
3
|
!function(){"use strict";try{if("undefined"!=typeof document){var e=document.createElement("style");e.appendChild(document.createTextNode('.lm-Widget.phosphor_WidgetAdapter.lm-DockPanel-widget.active{border-color:#5589ff;box-shadow:0 -1px #5589ff,1px 1px 2px #0003}.lm-TabBar-tab.lm-mod-current.active{border-color:#5589ff}.lm-TabBar-tab.lm-mod-current.error{background:red;background:linear-gradient(180deg,#ff000080,#fff)}.common_SelectionButton.error{background:red;background:linear-gradient(180deg,#ff000080,#fff0 80%)}body{padding:0;margin:8px;overflow:hidden}#placeholderXXX{width:100%;height:100vh}.graph_Graph .graphVertex>.subgraph .title rect{fill:#dcf1ff;border-bottom-width:0px}.graph_Graph .graphVertex>.subgraph .title text{fill:#000}.graph_Graph .graphVertex>.subgraph rect{fill:none}.graph_Graph .graphVertex>.subgraph.selected rect{stroke:red!important}.graph_Graph .graphVertex .graph_Vertex.selected .common_Shape{stroke:red!important}.graph_Graph .common_Surface .common_Menu{visibility:hidden}.lm-MenuBar{padding-left:5px;background:#fafafa;color:#000000de;border-bottom:1px solid #DDDDDD;font:13px Helvetica,Arial,sans-serif}.lm-MenuBar-menu{transform:translateY(-1px)}.lm-MenuBar-item{padding:4px 8px;border-left:1px solid transparent;border-right:1px solid transparent}.lm-MenuBar-item.lm-mod-active{background:#e5e5e5}.lm-MenuBar.lm-mod-active .lm-MenuBar-item.lm-mod-active{z-index:10001;background:#fff;border-left:1px solid #C0C0C0;border-right:1px solid #C0C0C0;box-shadow:0 0 6px #0003}.lm-Menu{padding:3px 0;background:#fff;color:#000000de;border:1px solid #C0C0C0;font:12px Helvetica,Arial,sans-serif;box-shadow:0 1px 6px #0003}.lm-Menu-item.lm-mod-active{background:#e5e5e5}.lm-Menu-item.lm-mod-disabled{color:#00000040}.lm-Menu-itemIcon{width:21px;padding:4px 2px}.lm-Menu-itemLabel{padding:4px 35px 4px 2px}.lm-Menu-itemMnemonic{text-decoration:underline}.lm-Menu-itemShortcut{padding:4px 0}.lm-Menu-itemSubmenuIcon{width:16px;padding:4px 0}.lm-Menu-item[data-type=separator]>div{padding:0;height:9px}.lm-Menu-item[data-type=separator]>div:after{content:"";display:block;position:relative;top:4px;border-top:1px solid #DDDDDD}.lm-Menu-itemIcon:before,.lm-Menu-itemSubmenuIcon:before{font-family:FontAwesome}.lm-Menu-item.lm-mod-toggled>.lm-Menu-itemIcon:before{content:""}.lm-Menu-item[data-type=submenu]>.lm-Menu-itemSubmenuIcon:before{content:""}.lm-CommandPalette{font-family:sans-serif;background:#f5f5f5}.lm-CommandPalette-search{padding:8px}.lm-CommandPalette-wrapper{padding:4px 6px;background:#fff;border:1px solid #E0E0E0}.lm-CommandPalette-input{width:100%;border:none;outline:none;font-size:16px}.lm-CommandPalette-header{padding:4px;color:#757575;font-size:12px;font-weight:600;background:#e1e1e1;cursor:pointer}.lm-CommandPalette-header:hover:before{content:"…";float:right;margin-right:4px}.lm-CommandPalette-header>mark{background-color:transparent;font-weight:700}.lm-CommandPalette-item{padding:4px 8px;color:#757575;font-size:13px;font-weight:500}.lm-CommandPalette-emptyMessage{padding:4px;color:#757575;font-size:12px;font-weight:600;text-align:center}.lm-CommandPalette-item.lm-mod-disabled{color:#00000040}.lm-CommandPalette-item.lm-mod-active{background:#7fdbff}.lm-CommandPalette-item:hover:not(.lm-mod-active):not(.lm-mod-disabled){background:#e5e5e5}.lm-CommandPalette-itemLabel>mark{background-color:transparent;font-weight:700}.lm-CommandPalette-item.lm-mod-disabled mark{color:#0006}.lm-CommandPalette-itemCaption{color:#9e9e9e;font-size:11px;font-weight:400}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}}();
|