@hpcc-js/marshaller 3.3.1 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?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")):typeof define==`function`&&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):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`@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,n,r,i,a,o,s,c,l,u,d,f,ee){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var te=Object.defineProperty,__name=(e,t)=>te(e,`name`,{value:t,configurable:!0}),p=`@hpcc-js/marshaller`,m=`3.3.1`,h=`3.26.1`;function stringify(e){return Array.isArray(e)?`[`+e.map(stringify).join(`, `)+`]`:typeof e!=`object`||!e||e===void 0?JSON.stringify(e):`{ ${Object.keys(e).map(t=>`${t}: ${stringify(e[t])}`).join(`, `)} }`}function schemaType2IFieldType(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 schemaRow2IField(e){return e._children&&e._children.length?{type:`dataset`,id:e.name,children:e._children.map(schemaRow2IField)}:{id:e.name,type:schemaType2IFieldType(e.type)}}function wsEclSchemaRow2IField(e){return e}var Activity=class extends n.PropertyExt{_sourceActivity;fixInt64(e){if(!e||e.length===0)return[];let t=this.outFields().filter(t=>{switch(t.type){case`number`:return typeof e[0][t.id]!=`number`;case`number64`:return!0}return!1});return t.length?e.map(e=>{for(let n of t)e[n.id]=+e[n.id];return e}):e}sourceActivity(e){return arguments.length?(this._sourceActivity=e,this):this._sourceActivity}hash(e={}){return(0,r.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(){let 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(let n of t){let t=this.fieldOrigin(n);t&&(e.outputs[t.id()]||(e.outputs[t.id()]=[]),e.outputs[t.id()].indexOf(n)<0&&e.outputs[t.id()].push(n))}}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){let t=this.hash();return(this._prevDataHash!==t||this._prevInData!==e)&&(this._prevDataHash=t,this._prevInData=e,this._prevData=(0,r.update)(this._prevData,this.computeData())),this._prevData}outData(){return this.cachedComputeData(this.inData())}},ActivityArray=class extends Activity{_activities=[];activities(e){return arguments.length?(this._activities=e,this):this._activities}};ActivityArray.prototype._class+=` ActivityArray`;var ActivityPipeline=class extends ActivityArray{activities(e){if(!arguments.length)return super.activities();super.activities(e);let t;for(let n of e)t&&n.sourceActivity(t),t=n;return this}first(){return this.activities()[0]}last(){let e=this.activities();return e[e.length-1]}calcUpdatedGraph(e){return e.updatedBy().map(t=>({from:t,to:e}))}updatedByGraph(){let e=[];for(let t of this.activities())e=e.concat(this.calcUpdatedGraph(t));return e}fetch(e=0,t=Number.MAX_VALUE){return this.exec().then(()=>{let n=this.outData();return e===0&&n.length<=t?n:n.slice(e,e+t)})}hash(e={}){return(0,r.hashSum)({activities:[this.activities().map(e=>e.hash())],...e})}refreshMeta(){return this.last().refreshMeta()}updatedBy(){let e=[];for(let 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()}};ActivityPipeline.prototype._class+=` ActivitySequence`;var ActivitySelection=class extends ActivityArray{_selection;_monitorHandle;selection(e){return e===void 0?this._selection:(this._monitorHandle&&this._monitorHandle.remove(),this._selection=e,this._monitorHandle=e.monitor((t,n,r)=>{this.broadcast(t,n,r,e)}),this)}hash(e={}){return(0,r.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()}};ActivitySelection.prototype._class+=` ActivitySelection`;var g=0,Datasource=class extends Activity{constructor(){super(),this._id=`ds_${++g}`}},DatasourceRef=class extends Activity{_origDatasource;constructor(){super()}hash(e={}){return super.hash({datasource:this._datasource?this._datasource.hash(e):void 0,...e})}toDDL(){return{id:this.datasource().id()}}};DatasourceRef.prototype._class+=` DatasourceRef`,DatasourceRef.prototype.publish(`datasource`,null,`widget`,`Datasource Reference`,null,{internal:!0}),DatasourceRef.prototype._origDatasource=DatasourceRef.prototype.datasource,DatasourceRef.prototype.datasource=function(e){let t=DatasourceRef.prototype._origDatasource.apply(this,arguments);return e!==void 0&&this.sourceActivity(e),t};var _=class FormField extends n.PropertyExt{_owner;disableChildField(){return this.type()!==`dataset`}constructor(){super()}toDDL(){return{type:this.type(),id:this.fieldID(),default:this.default(),children:this.type()===`dataset`?this.childFields().map(e=>e.toDDL()):void 0}}fromDDL(e){return this.type(e.type).fieldID(e.id).default(e.default).childFields(e.type===`dataset`&&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()}},v=class Form extends Datasource{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(_.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){let t=this.validFields().map(e=>e.toDDL());return()=>t}exec(){return Promise.resolve()}computeData(){let e={};return this.validFields().forEach(t=>{e[t.fieldID()]=t.calcValue()}),[e]}total(){return 1}};v.prototype._class+=` Form`,_.prototype.publish(`type`,`string`,`set`,`FormField Type`,[`boolean`,`number`,`string`,`dataset`]),_.prototype.publish(`fieldID`,``,`string`,`FormField Label`),_.prototype.publish(`default`,null,`any`,`Default Value`,null,{optional:!0}),_.prototype.publish(`value`,null,`any`,`Default Value`,null,{optional:!0}),_.prototype.publish(`childFields`,[],`propertyArray`,`Child Fields`,null,{autoExpand:_,disable:e=>e.disableChildField()}),v.prototype.publish(`formFields`,[],`propertyArray`,`Multi Fields`,null,{autoExpand:_});function fieldType(e){if((0,r.isArray)(e))return`dataset`;let t=typeof e;switch(t){case`boolean`:case`number`:case`string`:case`object`:return t}return`string`}function rowToFields(e,t){let n=[];for(let r in e){let i={type:fieldType(e[r]),id:r};switch(i.type){case`object`:for(let e of t){let t=!1;for(let n in e[r]){let n=rowToFields(e[r],[e[r]]);i.fields={},n.length&&(n.forEach(e=>i.fields[e.id]=e),t=!0);break}if(t)break}break;case`dataset`:for(let e of t)if(e[r]&&e[r].length){i.children=rowToFields(e[r][0],e[r]);break}break}n.push(i)}return n}var y=class Databomb extends Datasource{_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(_.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=(0,n.csvParse)(this.payload());break;case`tsv`:this._jsonData=(0,n.tsvParse)(this.payload());break;default:this._jsonData=JSON.parse(this.payload());break}this.databombFields(this.preCalcFields().map(_.fromDDL))}catch{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 this._jsonData.length===0?[]:rowToFields(this._jsonData[0],this._jsonData)}computeFields(e){return()=>this.validFields().map(e=>e.toDDL())}exec(){return Promise.resolve()}computeData(){let e={};return this.validFields().forEach(t=>{e[t.fieldID()]=t.coerceFunc()}),this._jsonData.map(t=>{let n={};for(let r in e)n[r]=e[r](t[r]);return n})}total(){return this._jsonData.length}};y.prototype._class+=` Databomb`,y.prototype.publish(`format`,`json`,`set`,`Databomb Format`,[`json`,`csv`,`tsv`]),y.prototype.publish(`payload`,``,`string`,`Databomb array`,null,{multiline:!0}),y.prototype.publish(`databombFields`,[],`propertyArray`,`Multi Fields`,null,{autoExpand:_});var ne=y.prototype.format;y.prototype.format=function(e){let t=ne.apply(this,arguments);return arguments.length&&this.updateJsonData(),t};var re=y.prototype.payload;y.prototype.payload=function(e){let t=re.apply(this,arguments);return arguments.length&&this.updateJsonData(),t};var b=new y().id(`Empty`).payload(`[]`),DatasourceAdapt=class{_activity;constructor(e){this._activity=e||b}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(()=>{let n=this._activity.outData();return e===0&&n.length<=t?Promise.resolve(n):Promise.resolve(n.slice(e,e+t))})}},ESPResult=class extends Datasource{_ec;_result;_schema=[];_meta=[];_total;_data=[];constructor(e){super(),this._ec=e,this.samples(this._ec.samples()).sampleSize(this._ec.sampleSize())}hash(e={}){return(0,r.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||=super.refreshMeta().then(()=>{if(this._result=this._createResult(),this._result)return this._result.refresh();throw 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(schemaRow2IField)}).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=(0,r.debounce)(()=>this._prevExecHash===this.hash()?Promise.resolve():(this._prevExecHash=this.hash(),super.exec().then(()=>this.sample()).then(e=>{this._data=this.fixInt64(e)}).catch(e=>{this._data=[]})));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 r.AsyncOrderedQueue;_fetch(e,t){return this._fetchQ.push(this._result?this._result.fetchRows(e,t).catch(e=>[]):Promise.resolve([]))}sample=(0,r.debounce)((e=this.samples(),t=this.sampleSize())=>{let n=[];if(e*t>=this.total())n.push(this._fetch(0,this.total()));else{let r=this.total()-t;for(let i=0;i<e;++i)n.push(this._fetch(Math.floor(i*r/e),t))}return Promise.all(n).then(e=>{let t=[];for(let n of e)t=t.concat(n);return t})})};ESPResult.prototype._class+=` ESPResult`;var x=class WUResult extends ESPResult{_origWu;_origResultName;constructor(e){super(e),this._wu=new S(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,n,r,i=!1){return new WUResult(e).wu(n).resultName(r).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()}`}};x.prototype._class+=` WUResult`;var S=class WU extends Datasource{_ec;_origUrl;_origWuid;_workunit;_outputs={};constructor(e){super(),this._ec=e}toDDL(){let e={};for(let 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);let n={};for(let t in e.outputs)n[t]=x.fromDDL(this._ec,e,this,t);return this._outputs=n,this}static fromDDL(e,t,n=!1){return new WU(e).fromDDL(t,n)}hash(){return(0,r.hashSum)({url:this.url(),wuid:this.wuid()})}label(){return this.wuid()}outputs(){let e=[];for(let t in this._outputs)e.push(this._outputs[t]);return e}outputDDL(){let e={};for(let 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()?Promise.resolve():(this._prevSourceHash!==this.hash()&&(this._prevSourceHash=this.hash(),delete 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)}resultNames(){return this._resultNames}};S.prototype._class+=` WU`;var WUResultRef=class extends DatasourceRef{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()}}};WUResultRef.prototype._class+=` WUResultRef`,ESPResult.prototype.publish(`samples`,10,`number`,`Number of samples`),ESPResult.prototype.publish(`sampleSize`,100,`number`,`Sample size`),x.prototype.publish(`wu`,null,`widget`,`Workunit`),x.prototype.publish(`resultName`,``,`set`,`Result Name`,function(){return this._wu===void 0?[]:this._wu.resultNames()}),x.prototype._origWu=x.prototype.wu,x.prototype.wu=function(e){let t=x.prototype._origWu.apply(this,arguments);return e!==void 0&&this._wu.refreshMeta(),t},x.prototype._origResultName=x.prototype.resultName,x.prototype.resultName=function(e){let t=this._resultName,n=x.prototype._origResultName.apply(this,arguments);return e!==void 0&&t!==e&&this.responseFields([]),n},S.prototype.publish(`url`,``,`string`,`ESP Url (http://x.x.x.x:8010)`),S.prototype.publish(`wuid`,``,`string`,`Workunit ID`),S.prototype._origUrl=S.prototype.url,S.prototype.url=function(e){let t=S.prototype._origUrl.apply(this,arguments);return e!==void 0&&this.refreshMeta(),t},S.prototype._origWuid=S.prototype.wuid,S.prototype.wuid=function(e){let t=S.prototype._origWuid.apply(this,arguments);return e!==void 0&&this.refreshMeta(),t};var C=class LogicalFile extends ESPResult{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,n=!1){return new LogicalFile(e).fromDDL(t,n)}_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()}`}};C.prototype._class+=` LogicalFile`,C.prototype.publish(`url`,``,`string`,`ESP Url (http://x.x.x.x:8010)`),C.prototype.publish(`nodeGroup`,``,`string`,`Node Group`),C.prototype.publish(`logicalFile`,``,`string`,`Logical File Name`);var w=class RestField extends n.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()}},T=class RestService extends Datasource{_ec;_responseFields={};constructor(e){super(),this._ec=e}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(w.fromDDL));for(let t in e.outputs)this.responseFields(t,e.outputs[t].fields);return this}static fromDDL(e,t,n=!1){return new RestService(e).fromDDL(t,n)}hash(e={}){return(0,r.hashSum)({url:this.url(),action:this.action(),mode:this.mode(),...e})}label(){return this.action()}responseFields(e,t){return arguments.length===1?this._responseFields[e]||[]:(this._responseFields[e]=t,this)}validRequestFields(){return this.requestFields().filter(e=>e.valid())}_prevRequestHash;_prevPromise;_submitQ=new r.AsyncOrderedQueue;submit(e){let n=(0,r.hashSum)(e);if(!this._prevPromise||this._prevRequestHash!==n){this._prevRequestHash=n;let r=(0,t.createConnection)({baseUrl:this.url(),type:this.mode()});this._prevPromise=this._submitQ.push(r.send(this.action(),e))}return this._prevPromise}resultNames(){let e=[];for(let t in this._responseFields)e.push(t);return e}outputDDL(){let e={};return this.resultNames().forEach(t=>{e[t]={fields:this._responseFields[t]}}),e}};T.prototype._class+=` RestService`;var E=class RestResult extends Datasource{_ec;_origService;constructor(e){super(),this._ec=e,this._service=new T(this._ec)}validRequestFields(){return this.service().validRequestFields()}toDDL(){return this.service().toDDL()}fromDDL(e){return this.service().fromDDL(e),this}static fromDDL(e,t,n){return new RestResult(e).id(`${t.id()}_${n}`).service(t).resultName(n)}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(0,r.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[];let e=rowToFields(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=>{let t=this.resultName(),n=t?t.split(`.`):[];for(let t of n)e=(e||{})[t];return this._jsonData=e,e})}formatRequest(){let e={};return this.service().validRequestFields().forEach(t=>{e[t.fieldID()]=``}),e}exec(){return this.submit(this.formatRequest()).then(e=>{})}};E.prototype._class+=` RestResult`;var D=class Param extends n.PropertyExt{_ec;validate(e){let 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}constructor(e){super(),this._ec=e}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(0,r.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(){return this.source_exists()&&this.remoteField_exists()?this.sourceSelection().map(e=>e[this.remoteField()]):this.value_exists()?[this.value()]:[``]}exists(){return this.localField_exists()&&(this.source_exists()&&this.remoteField_exists()||this.value_exists())}};D.prototype._class+=` Param`;var RestResultRef=class extends DatasourceRef{_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(let t of this.validParams())e=e.concat(t.validate(`request`));return e}constructor(e){super(),this._ec=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=>D.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);let t=[];for(let t of this.validParams()){let n=t.sourceViz().hipiePipeline();e.inputs[this.id()]||(e.inputs[this.id()]=[]),e.inputs[this.id()].push(t.localField()),n.resolveFields(e,[t.remoteField()])}super.resolveFields(e,t)}validParams(){return this.request().filter(e=>e.exists())}refreshMeta(){return this.datasource().refreshMeta().then(()=>{let e=this.request(),t=(0,r.compare)(e.map(e=>e.localField()),this.datasource().validRequestFields().map(e=>e.fieldID())),n=e.filter(e=>t.update.indexOf(e.localField())>=0);this.request(n.concat(t.enter.map(e=>new D(this._ec).localField(e))))})}updatedBy(){return this.validParams().map(e=>e.source())}computeFields(e){return this.datasource().computeFields(e)}formatRequest(){let e=this.datasource().formatRequest();return this.request().forEach(t=>{e[t.localField()]!==void 0&&(e[t.localField()]=t.calcValue()||e[t.localField()])}),e}_prevRequestHash;_prevRequestPromise;exec(){let e=this.formatRequest(),t=(0,r.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}};RestResultRef.prototype._class+=` RestResultRef`,w.prototype.publish(`fieldID`,``,`string`,`RestField Label`),T.prototype.publish(`url`,``,`string`,`REST Url`),T.prototype.publish(`action`,``,`string`,`Query Set`),T.prototype.publish(`mode`,`get`,`set`,`Request mode`,[`get`,`post`]),T.prototype.publish(`requestFields`,[],`propertyArray`,`Multi Fields`,null,{autoExpand:w}),E.prototype.publish(`service`,null,`widget`,`Rest service`),E.prototype.publish(`resultName`,``,`string`,`Result Name`),E.prototype._origService=E.prototype.service,E.prototype.service=function(e){let t=E.prototype._origService.apply(this,arguments);return e!==void 0&&this._service.refreshMeta(),t},D.prototype.publish(`localField`,null,`string`,`Label`),D.prototype.publish(`source`,null,`set`,`Activity`,function(){return this.visualizationIDs()},{optional:!0,disable:e=>e.value_exists(),validate:e=>e.source_disabled()||e.visualizationIDs().indexOf(e.source())>=0}),D.prototype.publish(`remoteField`,null,`set`,`Source Field`,function(){return this.sourceFields()},{optional:!0,disable:e=>!e.source_exists()||e.value_exists(),validate:e=>e.remoteField_disabled()||e.sourceFields().indexOf(e.remoteField())>=0}),D.prototype.publish(`value`,null,`string`,`Static Value`,null,{optional:!0,disable:e=>e.source_exists(),validate:e=>e.value_disabled()||e.value_exists()}),RestResultRef.prototype.publish(`request`,[],`propertyArray`,`Request Fields`);function parseUrl(e){let t=e.split(`/WsEcl/submit/query/`);if(t.length<2)throw Error(`Invalid roxie URL: ${e}`);let n=t[0].split(`:`);if(n.length<3)throw Error(`Invalid roxie URL: ${e}`);let r=t[1].split(`/`);if(r.length<2)throw Error(`Invalid roxie URL: ${e}`);return{url:`${n[0]}:${n[1]}:${n[2]===`18002`?`18010`:`8010`}`,querySet:r[0],queryID:r[1]}}function isHipieRequest(e){return e.length>=8&&e.indexOf(`_changed`)===e.length-8}function isHipieResponse(e){return e.length>=8&&e.indexOf(`_changed`)===e.length-8||[`HIPIE_DDL`,`HIPIE_DDLGLOBALS`,`hipieversion`].indexOf(e)>=0}var O=class RoxieService extends Datasource{_ec;_query;_requestFields;_responseFields={};_type=`roxie`;constructor(e){super(),this._ec=e}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(let t in e.outputs)this.responseFields(t,e.outputs[t].fields);return this}static fromDDL(e,t,n=!1){return new RoxieService(e).fromDDL(t,n)}hash(e={}){return(0,r.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){let e=!!this._requestFields;this.refreshMetaPromise=new Promise((n,r)=>{let i=t.Query.attach({baseUrl:this.url(),hookSend:this._ec.hookSend()},this.querySet(),this.queryID());(!e||this.ignoreHipieRequest()||this.ignoreHipieResponse())&&n(i.refresh()),n(i)}).then(t=>{this._query=t,(!e||this.ignoreHipieRequest())&&(this._requestFields=t.requestFields().filter(e=>this._type===`roxie`||!isHipieRequest(e.id))),(!e||this.ignoreHipieResponse())&&t.resultNames().filter(e=>this._type===`roxie`||!isHipieResponse(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 arguments.length===1?this._responseFields[e]||[]:(this._responseFields[e]=t,this)}_prevRequestHash;_prevPromise;_submitQ=new r.AsyncOrderedQueue;submit(e){let t=(0,r.hashSum)(e);return(!this._prevPromise||this._prevRequestHash!==t)&&(this._prevRequestHash=t,this._prevPromise=this._submitQ.push(this._query.submit(e))),this._prevPromise}resultNames(){let e=[];for(let t in this._responseFields)e.push(t);return e}outputDDL(){let e={};return this.resultNames().forEach(t=>{e[t]={fields:this._responseFields[t]}}),e}};O.prototype._class+=` RoxieService`,O.prototype.publish(`url`,``,`string`,`ESP Url (http://x.x.x.x:8002)`),O.prototype.publish(`querySet`,``,`string`,`Query Set`),O.prototype.publish(`queryID`,``,`string`,`Query ID`),O.prototype.publish(`ignoreHipieRequest`,!1,`boolean`,`Ignore provided DDL request`),O.prototype.publish(`ignoreHipieResponse`,!1,`boolean`,`Ignore provided DDL response`);var k=class RoxieResult extends Datasource{_ec;_origService;constructor(e){super(),this._ec=e,this._service=new O(this._ec)}toDDL(){return this.service().toDDL()}fromDDL(e){return this.service().fromDDL(e),this}static fromDDL(e,t,n){return new RoxieResult(e).id(`${t.id()}_${n}`).service(t).resultName(n)}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(0,r.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)}};k.prototype._class+=` RoxieResult`,k.prototype.publish(`service`,null,`widget`,`Roxie service`),k.prototype.publish(`resultName`,``,`set`,`Result Name`,function(){return this._service===void 0?[]:this._service.resultNames()}),k.prototype._origService=k.prototype.service,k.prototype.service=function(e){let t=k.prototype._origService.apply(this,arguments);return e!==void 0&&this._service.refreshMeta(),t};var RoxieResultRef=class extends DatasourceRef{_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(let t of this.validParams())e=e.concat(t.validate(`request`));return e}constructor(e){super(),this._ec=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=>D.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);let t=[];for(let n of this.validParams()){t.push(n.localField());let r=n.sourceViz().hipiePipeline();e.inputs[this.id()]||(e.inputs[this.id()]=[]),e.inputs[this.id()].push(n.localField()),r.resolveFields(e,[n.remoteField()])}super.resolveFields(e,t)}validParams(){return this.request().filter(e=>e.exists())}refreshMeta(){return this.datasource().refreshMeta().then(()=>{let e=this.request(),t=(0,r.compare)(e.map(e=>e.localField()),this.datasource().requestFields().map(e=>e.id)),n=e.filter(e=>t.update.indexOf(e.localField())>=0);this.request(n.concat(t.enter.map(e=>new D(this._ec).localField(e))))})}updatedBy(){return this.validParams().map(e=>e.source())}computeFields(e){return()=>this.datasource().responseFields()}formatRequest(){let e={},t=!1,n=this.datasource().requestFields();for(let r of this.validParams()){let i=r.calcValue(),a=n.filter(e=>e.id===r.localField())[0],o;o=a.type===`set`?{Item:i}:i[0],o!==void 0&&(e[r.localField()]=o),t=!0}return t||(e.refresh=!0),e}_prevRequestHash;_prevRequestPromise;exec(){return super.exec().then(()=>{let e=this.formatRequest(),t=(0,r.hashSum)({hash:this.hash(),request:e});return this._prevRequestHash!==t&&(this._prevRequestHash=t,this._prevRequestPromise=this.datasource().submit(e).then(e=>{let t=this.datasource().resultName(),n=e[t];return n||=e[t.toLowerCase().replace(/ /g,`_`)],this.fixInt64(n)})),this._prevRequestPromise}).then(e=>{this._data=e})}inData(){return this._data}computeData(){return this._data}};RoxieResultRef.prototype._class+=` RoxieResultRef`,RoxieResultRef.prototype.publish(`request`,[],`propertyArray`,`Request Fields`);var HipieResultRef=class extends RoxieResultRef{fullUrl(e){let t=parseUrl(e);return this.datasource().service().url(t.url),this.datasource().service().querySet(t.querySet),this.datasource().service().queryID(t.queryID),this}formatRequest(){let e=super.formatRequest(),t={};for(let n in e)t[n]=e[n],t[`${n}_changed`]=!0;return t}};HipieResultRef.prototype._class+=` HipieResultRef`;var A=0,DSPicker=class extends ActivitySelection{_ec;_nullDatasource=b;_origDatasourceID;_origDatasourceRef;datasource(){return this.datasourceRef().datasource()}refreshRef(e){let t=this._ec.datasource(e);t instanceof y||t instanceof v||t instanceof C||t instanceof O?this.selection(new DatasourceRef().datasource(t)):t instanceof x?this.selection(new WUResultRef().datasource(t)):t instanceof k?this.selection(new HipieResultRef(this._ec).datasource(t)):t instanceof E&&this.selection(new RestResultRef(this._ec).datasource(t))}selection(e){let 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()}constructor(e){super(),this._ec=e,this._id=`ds_${++A}`;let t=this._ec.datasources()[0];this.datasourceID(t.id())}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()})`}`}))}};DSPicker.prototype._class+=` DSPicker`,DSPicker.prototype.publish(`datasourceID`,``,`set`,`Activity`,function(){return this.datasourceIDs()},{optional:!1}),DSPicker.prototype.publish(`datasourceRef`,``,`widget`,`Activity`),DSPicker.prototype._origDatasourceID=DSPicker.prototype.datasourceID,DSPicker.prototype.datasourceID=function(e){let t=this._datasourceID,n=DSPicker.prototype._origDatasourceID.apply(this,arguments);return e!==void 0&&t!==e&&this.refreshRef(e),n},DSPicker.prototype._origDatasourceRef=DSPicker.prototype.datasourceRef,DSPicker.prototype.datasourceRef=function(e){return ActivitySelection.prototype.selection.apply(this,arguments)};function createFilter(e,t,n){let r=typeof n==`string`;switch(e){case`==`:return e=>r&&typeof e[t]==`string`?e[t].trim()===n:e[t]===n;case`!=`:return e=>r&&typeof e[t]==`string`?e[t].trim()!==n:e[t]!==n;case`<`:return e=>e[t]<n;case`<=`:return e=>e[t]<=n;case`>`:return e=>e[t]>n;case`>=`:return e=>e[t]>=n;default:throw Error(`Unknown filter condition: ${e}`)}}var j=class ColumnMapping extends n.PropertyExt{_owner;validate(e){let 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(0,r.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){let t=this.remoteField();return e.map(e=>{let n=e[t];return typeof n==`string`?n.trim():n})}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){let t=this.localField(),n=this.remoteValues(e);switch(this.condition()){case`range`:return this.nullable()&&(n.length<2||n[0]===n[1])?e=>!0:e=>e[t]>=n[0]&&e[t]<=n[1];case`in`:return this.nullable()&&n.length===0?e=>!0:e=>n.some(n=>typeof e[t]==`string`?e[t].trim()===n:e[t]===n);default:let e=n[0];return this.nullable()&&(e==null||e===``)?e=>!0:createFilter(this.condition(),t,e)}}};j.prototype._class+=` ColumnMapping`;var M=class RemoteFilter extends n.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()&&this.validMappings().length===0&&t.push({source:`${e}.source.${this.source()}`,msg:`Invalid mappings: "${this.source()}"`,hint:`expected minimum of 1 mapping`});for(let n of this.validMappings())t=t.concat(n.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=>j.fromDDL(e))),this):this.validMappings().map(e=>e.toDDL())}visualizationIDs(){return this._owner.visualizationIDs()}hash(){return(0,r.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(let t of e)this.mappings().push(new j().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(){let e=this.sourceSelection(),t=this.validMappings().map(t=>t.createFilter(e));return e=>t.every(t=>t(e))}createFilterDescription(){let e=this.sourceSelection();return this.validMappings().map(t=>t.createFilterDescription(e)).join(`, `)}};M.prototype._class+=` Filter`;var N=class StaticFilter extends n.PropertyExt{_owner;validate(e){let 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){if(arguments.length===0)switch(this.valueType()){case`number`:return+this.value();default:return``+this.value()}return this.value(e),typeof e==`number`?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(0,r.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 createFilter(this.condition(),this.localField(),this.coerceValue())}};N.prototype._class+=` StaticFilter`;var P=class Filters extends Activity{_ec;static Filter=M;static Mapping=j;validate(){let e=[];for(let t of this.validFilters())e=e.concat(t.validate(`filter`));return e}constructor(e){super(),this._ec=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());let t=[],n=[];return e.forEach(e=>{i.DDL2.isIFilterCondition(e)?t.push(M.fromDDL(e)):n.push(N.fromDDL(e))}),this.remoteFilter(t),this.staticFilter(n),this}visualizationIDs(){return this._ec.elementIDs()}visualization(e){return this._ec.element(e)}hash(){return(0,r.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);let t=[];for(let n of this.validRemoteFilters()){let r=n.sourceViz().hipiePipeline(),i=[];for(let e of n.validMappings())t.push(e.localField()),i.push(e.remoteField());r.resolveFields(e,i)}super.resolveInFields(e,t)}exec(){return super.exec()}computeData(){let e=super.computeData();if(e.length===0||!this.exists())return e;let 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()]}};P.prototype._class+=` Filters`,j.prototype.publish(`remoteField`,null,`set`,`Filter Fields`,function(){return this.sourceOutFields()},{optional:!0,disable:e=>!e._owner.source(),validate:e=>e.sourceOutFields().indexOf(e.remoteField())>=0}),j.prototype.publish(`localField`,null,`set`,`Local Fields`,function(){return this.localFields()},{optional:!0,disable:e=>!e._owner.source(),validate:e=>e.localFields().indexOf(e.localField())>=0}),j.prototype.publish(`condition`,`==`,`set`,`Filter Fields`,[`==`,`!=`,`>`,`>=`,`<`,`<=`,`range`,`in`]),j.prototype.publish(`nullable`,!1,`boolean`,`Ignore null filters`),M.prototype.publish(`source`,null,`set`,`Activity`,function(){return this.visualizationIDs()},{optional:!0,validate:e=>e.visualizationIDs().indexOf(e.source())>=0}),M.prototype.publish(`mappings`,[],`propertyArray`,`Mappings`,null,{autoExpand:j}),N.prototype.publish(`localField`,null,`set`,`Local Fields`,function(){return this.localFields()},{optional:!0,validate:e=>e.localFields().indexOf(e.localField())>=0}),N.prototype.publish(`condition`,`==`,`set`,`Filter Fields`,[`==`,`!=`,`>`,`>=`,`<`,`<=`]),N.prototype.publish(`value`,``,`any`,`Static Value`),N.prototype.publish(`valueType`,`number`,`set`,`Static Value Type`,[`number`,`string`]),P.prototype.publish(`remoteFilter`,[],`propertyArray`,`Remote Filter`,null,{autoExpand:M}),P.prototype.publish(`staticFilter`,[],`propertyArray`,`Static Filter`,null,{autoExpand:N});var F=class GroupByColumn extends n.PropertyExt{_owner;validate(e){let 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(0,r.hashSum)(this.label())}columns(){return this._owner.inFieldIDs()}};F.prototype._class+=` GroupByColumn`;function localCount(e,t){return e.length}var I={count:localCount,min:n.min,max:n.max,mean:n.mean,median:n.median,variance:n.variance,deviation:n.deviation,sum:n.sum},L=class AggregateField extends n.PropertyExt{_owner;disableAggrColumn(){return!this.fieldID()||!this.aggrType()||this.aggrType()===`count`}disableBaseCountColumn(){return!this.fieldID()||!this.aggrType()||this.aggrType()!==`mean`}validate(e){let 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 this.aggrType()===`count`?{fieldID:this.fieldID(),type:`count`}:{fieldID:this.fieldID(),type:this.aggrType(),inFieldID:this.aggrColumn(),baseCountFieldID:this.baseCountColumn()}}fromDDL(e){let t=this.fieldID(e.fieldID).aggrType(e.type);return e.type!==`count`&&(t.aggrColumn(e.inFieldID),t.baseCountColumn(e.baseCountFieldID)),t}static fromDDL(e){return new AggregateField().fromDDL(e)}hash(){return(0,r.hashSum)({label:this.fieldID(),aggrType:this.aggrType(),aggrColumn:this.aggrColumn()})}columns(){return this._owner.inFieldIDs()}hasColumn(){return this.columns().length}aggregate(e){return I[this.aggrType()](e,e=>+e[this.aggrColumn()])}aggrFunc(){let e=I[this.aggrType()],t=this.aggrColumn(),n=this.baseCountColumn();return n?r=>e(r,e=>e[t]/+e[n]):n=>e(n,e=>+e[t])}};L.prototype._class+=` AggregateField`;var R=class GroupBy extends Activity{validate(){let e=[];for(let t of this.validGroupBy())e=e.concat(t.validate(`GroupBy.column`));for(let 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=>F.fromDDL(e))),this):this.validGroupBy().map(e=>e.toDDL())}aggregates(e){return arguments.length?(this.computedFields(e.map(e=>L.fromDDL(e))),this):this.validComputedFields().map(e=>e.toDDL())}hash(){return(0,r.hashSum)({groupBy:this.column().map(e=>e.hash()),computedFields:this.computedFields().map(e=>e.hash())})}appendGroupBys(e){for(let t of e)this.column().push(new F().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(let t of this.inFields())if(t.id===e)return t;return null}appendComputedFields(e){for(let t of e){let e=new L().owner(this).fieldID(t.label).aggrType(t.type);t.column!==void 0&&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);let t=[],n=this.validGroupBy();for(let e of n){let n=this.field(e.label()),r={type:n?n.type:`string`,id:e.label()};t.push(r)}for(let e of this.computedFields())if(e.fieldID()){let n={id:e.fieldID(),type:`number`};t.push(n)}if(this.details()){let e=t;if(this.exists()){let n={id:`values`,type:`dataset`,children:[]};t.push(n),e=n.children}let r=n.map(e=>e.label());e.push(...this.inFields().filter(e=>this.fullDetails()||r.indexOf(e.id)<0))}return()=>t}referencedFields(e){super.referencedFields(e);let t=[];for(let e of this.validGroupBy())t.push(e.label());for(let e of this.validComputedFields())e.aggrColumn()&&t.push(e.aggrColumn());super.resolveInFields(e,t)}computeData(){let e=super.computeData();if(e.length===0||!this.exists())return e;let t=this.validGroupBy().map(e=>e.label()),r=this.validComputedFields().map(e=>({label:e.fieldID(),aggrFunc:e.aggrFunc()})),i=(0,n.nest)().key(e=>{let n=``;for(let r of t)n+=`:`+e[r];return n}).entries(e).map(e=>{let n=e;delete n.key;for(let e of t)n[e]=n.values[0][e];for(let e of r)n[e.label]=e.aggrFunc(n.values);return n}),a=this.outFields();return i.map(e=>{let t={};for(let n of a)t[n.id]=e[n.id];return t})}};R.prototype._class+=` GroupBy`,F.prototype.publish(`label`,void 0,`set`,`Field`,function(){return this.columns()},{optional:!0,validate:e=>e.columns().indexOf(e.label())>=0}),L.prototype.publish(`fieldID`,null,`string`,`new Field ID`,null,{optional:!0,disable:e=>!e.hasColumn()}),L.prototype.publish(`aggrType`,`count`,`set`,`Aggregation Type`,[`count`,`min`,`max`,`sum`,`mean`,`median`,`variance`,`deviation`],{optional:!0,disable:e=>!e.fieldID()}),L.prototype.publish(`aggrColumn`,null,`set`,`Aggregation Field`,function(){return this.columns()},{optional:!0,disable:e=>e.disableAggrColumn(),validate:e=>e.columns().indexOf(e.aggrColumn())>=0}),L.prototype.publish(`baseCountColumn`,null,`set`,`Base Count Field`,function(){return this.columns()},{optional:!0,disable:e=>e.disableBaseCountColumn(),validate:e=>e.columns().indexOf(e.baseCountColumn())>=0}),R.prototype.publish(`column`,[],`propertyArray`,`Source Columns`,null,{autoExpand:F}),R.prototype.publish(`computedFields`,[],`propertyArray`,`Computed Fields`,null,{autoExpand:L}),R.prototype.publish(`details`,!1,`boolean`,`Show details`),R.prototype.publish(`fullDetails`,!1,`boolean`,`Show groupBy fileds in details`);var z=class Limit extends Activity{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(0,r.hashSum)({limit:this.rows()})}exists(){return this.rows_exists()&&this.rows()>0}computeData(){let e=super.computeData();return e.length===0||!this.exists()?e:e.slice(0,Math.min(this.rows(),e.length))}};z.prototype._class+=` Limit`,z.prototype.publish(`rows`,void 0,`number`,`Limit output`);var B=class ComputedMapping extends n.PropertyExt{_owner;validate(e){let 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)}};B.prototype._class+=` ComputedMapping`;var V=class ComputedField extends n.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){let 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()||this.type()!==`=`||!this.column1())return!1;let e=this._owner.field(this.column1());return!!(e&&e.type===`dataset`&&e.children)}children(){let e=this._owner.field(this.column1());return e&&e.type===`dataset`?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`=`:let 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){let 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=>B.fromDDL(e)):[]);break;default:t.column1(e.sourceFieldID1).column2(e.sourceFieldID2)}return t}static fromDDL(e){return new ComputedField().fromDDL(e)}hash(){return(0,r.hashSum)(this.toDDL())}columns(){return this._owner.fieldIDs()}computedField(){switch(this.type()){case`=`:let e=this.validChildFields();return e.length===0&&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){let t=this.hasChildFields(),n=this.validChildFields().map(t=>({label:t.label(),func:t.computeFunc(e)}));return r=>{let i=e&&t?{}:{...r};for(let e of n)i[e.label]=e.func(r);return e&&t&&(i.__lparam=r),i}}computeFunc(e){let t=this.column1(),i=this.column2();switch(this.type()){case`=`:return this.hasChildFields()?n=>(n[t].Row&&(0,r.isArray)(n[t].Row)?n[t].Row:n[t]).map(this.projection(e)):e=>e[t];case`*`:return e=>e[t]*+e[i];case`/`:return e=>e[t]/+e[i];case`+`:return e=>+e[t]+ +e[i];case`-`:return e=>e[t]-+e[i];case`scale`:let a=this.constValue();return e=>+e[t]*a;case`template`:let o=this.template();return e=>n.Utility.template(o,e);case`map`:let s=this.default(),c={};for(let e of this.mapping())c[e.value()]=e.newValue();return e=>c[e[t]]||s;default:return e=>e[t]}}fieldIDs(){let 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){let t=this._owner.field(this.column1());if(t)switch(t.type){case`dataset`:for(let n of t.children)if(n.id===e)return n;break;case`object`:return t.fields[e]}}};V.prototype._class+=` ComputedField`;var H=class MultiField extends n.PropertyExt{_owner;constructor(){super()}hash(){return(0,r.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(let n of this.validMultiFields())t=t.concat(n.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=>V.fromDDL(e))),this):this.validMultiFields().map(e=>e.toDDL())}fieldIDs(){return this._owner.fieldIDs()}field(e){return this._owner.field(e)}};H.prototype._class+=` MultiField`;var ProjectBase=class extends Activity{static ComputedField=V;_includeLParam=!1;_trim=!1;validate(){let e=[];for(let 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=>{switch(e.type){case`multi`:return H.fromDDL(e);default:return V.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(let t of this.inFields())if(t.id===e)return t;return null}clearComputedFields(){this.computedFields([])}appendComputedFields(e){for(let t of e){let e=new V().owner(this).label(t.label).type(t.type);t.column!==void 0&&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=[],n={};for(let e of this.validComputedFields())if(e instanceof H)for(let r of e.validMultiFields()){let e=r.computedField();t.push(e),n[e.id]=!0}else{let r=e.computedField();t.push(r),n[r.id]=!0}if(this._trim&&this.hasComputedFields()){if(this._includeLParam){let e={id:`__lparam`,type:`object`};t.push(e),n[e.id]=!0}}else t=t.concat(e.filter(e=>!n[e.id]));return()=>t}referencedFields(e){super.referencedFields(e);let t=[];for(let e of this.validComputedFields())if(e instanceof H)for(let n of e.validMultiFields())t.push(n.column1()),n.column2()&&t.push(n.column2());else if(e.type()===`template`)for(let r of n.Utility.templateFields(e.template()))t.push(r);else t.push(e.column1()),e.column2()&&t.push(e.column2());super.resolveInFields(e,t)}projection(){let e=this._trim,t=this.hasComputedFields(),n=[];for(let t of this.validComputedFields())if(t instanceof H)for(let r of t.validMultiFields())n.push({label:r.label(),func:r.computeFunc(e)});else n.push({label:t.label(),func:t.computeFunc(e)});return r=>{let i=e&&t?{}:{...r};for(let e of n)i[e.label]=e.func(r);return e&&t&&this._includeLParam&&(i.__lparam=r),i}}computeData(){let e=super.computeData();return e.length===0||!this.exists()?e:e.map(this.projection())}},U=class Project extends ProjectBase{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})}};U.prototype._class+=` Project`;var W=class Mappings extends ProjectBase{constructor(){super(),this._trim=!0,this._includeLParam=!0}toDDL(){return{type:`mappings`,transformations:this.transformations()}}fromDDL(e){let 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=>e.id!==`__lparam`).map(e=>e.id))}};W.prototype._class+=` Mappings`,B.prototype.publish(`value`,null,`any`,`Compare Value`,void 0,{validate:e=>!e.value()&&!e.newValue()||!!e.value()&&!!e.newValue()}),B.prototype.publish(`newValue`,null,`any`,`New Value`,void 0,{validate:e=>!e.value()&&!e.newValue()||!!e.value()&&!!e.newValue()}),V.prototype.publish(`label`,null,`string`,`Label`,null,{optional:!0}),V.prototype.publish(`type`,`mapping`,`set`,`Project type`,[`=`,`*`,`/`,`+`,`-`,`scale`,`template`,`map`],{optional:!0,disable:e=>!e.label()}),V.prototype.publish(`column1`,null,`set`,`Param 1`,function(){return this.columns()},{optional:!0,disable:e=>e.disableColumn1(),validate:e=>e.columns().indexOf(e.column1())>=0}),V.prototype.publish(`column2`,null,`set`,`Param 2`,function(){return this.columns()},{optional:!0,disable:e=>e.disableColumn2(),validate:e=>e.columns().indexOf(e.column2())>=0}),V.prototype.publish(`constValue`,null,`number`,`Const value`,null,{optional:!0,disable:e=>!e.label()||[`scale`].indexOf(e.type())<0}),V.prototype.publish(`template`,null,`string`,`template`,null,{optional:!0,disable:e=>!e.label()||[`template`].indexOf(e.type())<0}),V.prototype.publish(`default`,null,`any`,`Default Value`,null,{optional:!0,disable:e=>!e.label()||[`map`].indexOf(e.type())<0}),V.prototype.publish(`mapping`,[],`propertyArray`,`Mapped Values`,null,{autoExpand:B,disable:e=>e.disableMapping()}),V.prototype.publish(`childField`,[],`propertyArray`,`Child Fields`,null,{autoExpand:V,disable:e=>e.disableChildField()}),H.prototype.publish(`label`,``,`string`,`Label`),H.prototype.publish(`multiFields`,[],`propertyArray`,`Multi Fields`,null,{autoExpand:V}),ProjectBase.prototype.publish(`computedFields`,[],`propertyArray`,`Computed Fields`,null,{autoExpand:V});var G=class SortColumn extends n.PropertyExt{_owner;validate(e){let 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(0,r.hashSum)({sortColumn:this.fieldID(),descending:this.descending()})}fieldIDs(){return this._owner.fieldIDs()}field(e){return this._owner.inFields().filter(t=>t.id===e)[0]}};G.prototype._class+=` SortColumn`;var K=class Sort extends Activity{static Column=G;validate(){let e=[];for(let 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=>G.fromDDL(e))),this):this.validSortBy().map(e=>e.toDDL())}hash(){return(0,r.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(){let e=super.computeData(),t=[];for(let e of this.validSortBy())t.push({compare:e.descending()?n.descending:n.ascending,id:e.fieldID()});return t.length?[...e].sort((e,n)=>{for(let r of t){let t=r.compare(e[r.id],n[r.id]);if(t!==0)return t}return 0}):e}};K.prototype._class+=` Sort`,G.prototype.publish(`fieldID`,null,`set`,`Sort Field`,function(){return this.fieldIDs()},{optional:!0,validate:e=>e.fieldIDs().indexOf(e.fieldID())>=0}),G.prototype.publish(`descending`,!1,`boolean`,`Sort Field`),K.prototype.publish(`column`,[],`propertyArray`,`Source Columns`,null,{autoExpand:G});var HipiePipeline=class extends ActivityPipeline{_ec;_origDatasource;_origFilters;_origProject;_origGroupBy;_origSort;_origLimit;constructor(e,t){super(),this._ec=e,this._id=t,this._datasource=new DSPicker(this._ec),this._filters=new P(this._ec),this._project=new U,this._groupBy=new R,this._sort=new K,this._limit=new z,this.updateSequence()}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()}};HipiePipeline.prototype.publish(`datasource`,null,`widget`,`Data Source 2`),HipiePipeline.prototype.publish(`filters`,null,`widget`,`Client Filters`),HipiePipeline.prototype.publish(`project`,null,`widget`,`Project`),HipiePipeline.prototype.publish(`groupBy`,null,`widget`,`Group By`),HipiePipeline.prototype.publish(`sort`,null,`widget`,`Sort`),HipiePipeline.prototype.publish(`limit`,null,`widget`,`Limit output`);function wrapHipiePipelineProperty(e){let t=`_orig${e.charAt(0).toUpperCase()+e.slice(1)}`;HipiePipeline.prototype[t]=HipiePipeline.prototype[e],HipiePipeline.prototype[e]=function(e){let n=HipiePipeline.prototype[t].apply(this,arguments);return e!==void 0&&this.updateSequence(),n}}wrapHipiePipelineProperty(`datasource`),wrapHipiePipelineProperty(`filters`),wrapHipiePipelineProperty(`project`),wrapHipiePipelineProperty(`groupBy`),wrapHipiePipelineProperty(`sort`),wrapHipiePipelineProperty(`limit`);var NullView=class extends HipiePipeline{hash(){return super.hash()}_fetch(e,t){return Promise.resolve([])}};NullView.prototype._class+=` NullView`;var VizPopupPanel=class 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`;let n=this.widget().title();n&&(this.title(n),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()}};VizPopupPanel.prototype._class+=` marshaller_VizPopupPanel`;var VizChartPanel=class extends u.ChartPanel{_popup;_togglePopup=new n.ToggleButton().faChar(`fa-filter`).tooltip(`Filter`).on(`click`,()=>{this._popup.host(this);let e=this.locateClosestAncestor([`marshaller_DashboardDockPanel`,`marshaller_DashboardGrid`]).getBBox(!0),t=this._popup.widget(),n=this._togglePopup.getBBox();this._popup.pos({x:-e.x+n.x+n.width-t.minWidth(),y:-e.y+n.y+n.height}).resize({width:t.minWidth(),height:t.minHeight()}).visible(this._togglePopup.selected()).render(e=>{let t=`#`+e.id()+` .layout_Carousel .common_Widget`,n=e.element().node();if(n){let{height:r,width:i}=n.querySelector(t).getBoundingClientRect();e.resizeBodySync(i,r)}})});_origButtons;_filterButtons;constructor(){super(),this._origButtons=this.buttons(),this._filterButtons=[this._togglePopup,new n.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}};VizChartPanel.prototype._class+=` marshaller_VizChartPanel`,VizChartPanel.prototype.publish(`descriptionTemplate`,``,`string`),VizChartPanel.prototype.publish(`minWidth`,320,`number`,`Min Width`),VizChartPanel.prototype.publish(`minHeight`,240,`number`,`Min Height`);var q={Table:o.Table,FieldForm:s.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:l.ChoroplethCounties,USStatesChoropleth:l.ChoroplethStates,ClusterPins:l.Leaflet.ClusterPins,EntityRectList:n.EntityRectList,AdjacencyGraph:c.AdjacencyGraph,DataGraph:c.DataGraph},J=[];for(let e in q)J.push(e);function typeClass(e){return q[e]||o.Table}function typeNew(e){let t=new(q[e]||o.Table);return t instanceof s.FieldForm?t.validate(!1).allowEmptyRequest(!0):t instanceof c.AdjacencyGraph&&t.uidColumn(`uid`).labelColumn(`label`).iconColumn(`icon`).linksColumn(`links`).linkUidColumn(`uid`).linkLabelColumn(`label`),t}function typeInputs(e){return typeClass(e).__inputs||[]}var Visualization=class extends n.PropertyExt{_ec;_origVisibility;_origChartType;_origChartPanel;_hipiePipeline;constructor(e,t){super(),this._ec=e,this._hipiePipeline=t,this.mappings(new W),this.chartPanel(new VizChartPanel),this.typeChanged()}visualizationIDs(){return this._ec.elementIDs().filter(e=>e!==this.id())}_prevChartType;typeChanged(){if(this._prevChartType!==this._chartType){this._prevChartType=this._chartType,this.refreshMappings();let e=typeNew(this._chartType);this.chartPanel().widget(e)}}properties(e){return arguments.length?(this.chartPanel().deserialize(e),this):this.chartPanel().serialize()}refreshMappings(){let e=this.mappings();e.sourceActivity(this._hipiePipeline);let t=e.validComputedFields(),n=e.inFields(),r={};return e.computedFields(typeInputs(this._chartType).map((i,a)=>{let o=t[a];if(o)o instanceof H||o.label(i.id);else if(i.multi){o=new H().owner(e).label(i.id);let t=[];for(let e of n)(i.type===`any`||i.type===e.type)&&!r[e.id]&&(r[e.id]=!0,t.push(new V().label(e.id).type(`=`).column1(e.id)));o.multiFields(t)}else{o=new V().owner(e).label(i.id).type(`=`);for(let e of n)if((i.type===`any`||i.type===e.type)&&!r[e.id]){r[e.id]=!0,o.column1(e.id);break}}return o})),this}_prevFields=[];_prevLinkFields=[];_prevData=[];refreshData(){let e=this.mappings(),t=e.outFields(),n=this.toDBFields(t),r,i=[],a=this._ec.element(this.secondaryDataviewID());a&&(r=a.mappings().outFields(),i=this.toDBFields(r));let o=this._prevFields!==t||this._prevLinkFields!==r;if(o)if(this._prevFields=t,this.chartType()===`DataGraph`){let e=this.chartPanel().widget();e.vertexColumns(n.map(e=>e.label())),e.edgeColumns(i.map(e=>e.label()))}else this.chartPanel().fields(n.filter(e=>e.id()!==`__lparam`));else console.warn(`***${this.id()} Immutable Fields***`);let s=e.outData(),c=this._prevData!==s;if(c){this._prevData=s;let e=this.toDBData(n,s);if(this.chartType()===`DataGraph`){let t=this.chartPanel().widget();if(t.vertices(e),a){let e=a.mappings().outData(),n=this.toDBData(i,e);t.edges(n)}}else this.chartPanel().data(e)}else console.warn(`${this.id()} Immutable Data!`);return o||c?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){let t=[];for(let r of e||[]){let e=new n.Database.Field().type(this.fieldTypeTodbFieldType(r.type)).id(r.id).label(r.id);switch(r.type){case`dataset`:e.children(this.toDBFields(r.children));break;case`object`:break}t.push(e)}return t}toDBData(e,t){return((0,r.isArray)(t)?t:[t]).map(t=>{let n=[];for(let r of e)r.type()===`nested`?n.push(this.toDBData(r.children(),t[r.id()].Row||t[r.id()])):n.push(t[r.label()]);return n})}exec(){let e=[];if(this.secondaryDataviewID_exists()){let t=this.secondaryDataviewID(),n=this._ec.element(t);n&&e.push(n.visualization().exec())}let 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,n,r){}vertex_click(e,t,n){}};Visualization.prototype._class+=` Visualization`,Visualization.prototype.publishProxy(`title`,`_chartPanel`),Visualization.prototype.publishProxy(`description`,`_chartPanel`),Visualization.prototype.publish(`visibility`,i.DDL2.VisibilitySet[0],`set`,`Type`,i.DDL2.VisibilitySet),Visualization.prototype.publish(`chartType`,`Table`,`set`,`Type`,J),Visualization.prototype.publish(`secondaryDataviewID`,null,`set`,`Secondary Data View (e.g. graph edges)`,function(){return this.visualizationIDs()},{optional:!0}),Visualization.prototype.publish(`mappings`,null,`widget`,`Mappings`,void 0,{render:!1,internal:!0}),Visualization.prototype.publish(`chartPanel`,[],`widget`,`Widget`),Visualization.prototype._origVisibility=Visualization.prototype.visibility,Visualization.prototype.visibility=function(e){let t=this._visibility,n=Visualization.prototype._origVisibility.apply(this,arguments);return e!==void 0&&t!==e&&this.chartPanel().target(null),n},Visualization.prototype._origChartType=Visualization.prototype.chartType,Visualization.prototype.chartType=function(e,t){e!==void 0&&J.indexOf(e)===-1&&(e=`Table`);let n=Visualization.prototype._origChartType.apply(this,arguments);if(e!==void 0&&(this.typeChanged(),t)){let e=this.chartPanel().widget();for(let n in t)typeof e[n]==`function`&&e[n](t[n])}return n},Visualization.prototype._origChartPanel=Visualization.prototype.chartPanel,Visualization.prototype.chartPanel=function(e){let t=Visualization.prototype._origChartPanel.apply(this,arguments);if(e!==void 0){this._chartPanel.on(`click`,(e,t,n,r)=>this.click(e,t,n,r)).on(`vertex_click`,(e,t,n)=>this.vertex_click(e,t,n));for(let e in q)if(this._chartPanel.widget()instanceof q[e]){this._chartType=e;break}}return t};var State=class extends n.PropertyExt{constructor(){super(),this.selection([])}set(e){return(0,r.hashSum)(this.selection())===(0,r.hashSum)(e)?!1:(this.selection(e),!0)}removeInvalid(e){let t=this.selection(),n=[];for(let i of t)(0,r.find)(e,(e,t)=>{for(let t in i)if(i[t]!==e[t])return!1;return!0})&&n.push(i);return n.length===t.length?!1:(this.selection(n),!0)}};State.prototype._class+=` State`,State.prototype.publish(`selection`,[],`array`,`State`);var Y=0,Element=class extends n.PropertyExt{_ec;_vizChartPanel;_origVisualization;constructor(e){for(super(),this._ec=e;Y++,this._id=`e_${Y}`,this._ec.elementExists(this._id););let t=new HipiePipeline(this._ec,this._id);this.hipiePipeline(t),this._vizChartPanel=new Visualization(this._ec,this.hipiePipeline()).id(`viz_${Y}`).title(`Element ${Y}`),this._vizChartPanel.chartPanel().id(`cp_${Y}`),this.visualization(this._vizChartPanel),this.state(new State)}id(e){let 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(){let 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=[];let e=this.hipiePipeline();for(let t of[...e.activities(),this.mappings()])for(let e of t.validate())this._errors.push({elementID:this.id(),...e});return this._errors}_initialized=!1;refresh(){let e=this.hipiePipeline().filters().validFilters().map(e=>e.createFilterDescription());return this.visualization().chartPanel().description(e.join(`, `)),this.visualization().refresh().then(()=>{this._initialized=!0;let e=this.hipiePipeline().outData();this.visualization().chartType()===`FieldForm`?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(){let e=[];for(let 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)}};Element.prototype._class+=` Viz`,Element.prototype.publish(`hipiePipeline`,null,`widget`,`Data View`),Element.prototype.publish(`visualization`,null,`widget`,`Visualization`),Element.prototype.publish(`state`,null,`widget`,`State`),Element.prototype._origVisualization=Element.prototype.visualization,Element.prototype.visualization=function(e){let t=Element.prototype._origVisualization.apply(this,arguments);return e!==void 0&&this._visualization.on(`click`,(e,t,n,i)=>{if(i&&i.selection)this.selection(n?i.selection.map(e=>e.__lparam||e):[]);else{let t=(0,r.isArray)(e)?e:[e];this.selection(n?t.map(e=>e.__lparam||e):[])}}).on(`vertex_click`,(e,t,n)=>{let i=(0,r.isArray)(e)?e:[e];this.selection(n?i.map(e=>e.__lparam||e):[])}),t};var ElementContainer=class extends n.PropertyExt{_nullElement;_datasources=[b];_elements=[];constructor(){super(),this.clear(),this._nullElement=new Element(this)}clear(e){this._datasources=e===void 0?[b]:this._datasources,this._elements=e===void 0?[]: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=typeof e==`string`?this._elements.filter(t=>t.id()===e):e instanceof VizChartPanel?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){let t={};return e.__properties.content.map(e=>{let n=!!e.__properties.widget.__properties.chart,r=e,i=e.__properties.widget,a=n?e.__properties.widget.__properties.chart:e.__properties.widget.__properties.widget,o=e.__properties.widget.__id?e.__properties.widget.__id:e.__properties.widget.__properties.widget.__id;t[o]={id:o,package:a.__class.split(`_`)[0],object:a.__class.split(`_`)[1],cell:_get_params(r,[`chart`,`widget`,`fields`]),panel:_get_params(i,[`chart`,`widget`,`fields`]),widget:_get_params(a,[`fields`])}}),t;function _get_params(e,t){let n={};return Object.keys(e.__properties).filter(e=>t.indexOf(e)===-1).forEach(t=>n[t]=e.__properties[t]),n}}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){}};ElementContainer.prototype._class+=` dashboard_ElementContainer`,ElementContainer.prototype.publish(`samples`,10,`number`,`Number of samples`),ElementContainer.prototype.publish(`sampleSize`,100,`number`,`Sample size`);function responseText(e){if(!e.ok)throw Error(e.status+` `+e.statusText);return e.text()}function text_default(e,t){return fetch(e,t).then(responseText)}__name(text_default,`default`);var PopupManager=class extends n.Widget{_ec;_popups=[];_popupIdx={};popupPanels(){return this._popups||=[],this._popupIdx||={},this._popups}popupChartPanels(){return this.popupPanels().map(e=>e.widget())}addPopup(e){let t=this._ec.element(e),n=this.element().node(),r=new VizPopupPanel(this,t).target(n).widget(e).relativeTargetId(this.id()).size({width:e.minWidth(),height:e.minHeight()});this._popups.push(r),this._popupIdx[e.id()]={panel:r,monitorHandle:e.monitor(t=>{switch(t){case`minWidth`:case`minHeight`:r.resize({width:e.minWidth(),height:e.minHeight()}).render();break}})},this._ec.filteredBy(t.id()).forEach(e=>{e.visualization().chartPanel().popup(r)})}removePopup(e){let 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(){let e=(0,r.compare)(this.popupChartPanels(),this._ec.elements().filter(e=>e.visualization().visibility()===`flyout`).map(e=>e.visualization().chartPanel()));for(let t of e.exit)this.removePopup(t);for(let t of e.enter)this.addPopup(t);return this}vizActivation(){}},DashboardDockPanel=class extends d.DockPanel{_ec;constructor(e){super(),this._ec=e}tabTitle(e){return this.hideSingleTabs()?e.visualization().title?e.visualization().title():e.visualization().id():e.id()}titleClassed(e,t,n){let r=e.title.className.split(` `);n&&r.indexOf(t)<0?r.push(t):!n&&r.indexOf(t)>0&&(r=r.filter(e=>e!==t)),e.title.className=r.join(` `)}updateTitle(e){let t=this.getWidgetAdapter(e),n=this._ec.element(e),r=n.validate();t.title.label=this.tabTitle(n),this.titleClassed(t,`error`,r.length>0),t.title.caption=r.map(e=>`${e.source}: ${e.msg}`).join(`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?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")):typeof define==`function`&&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):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`@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,n,r,i,a,o,s,c,l,u,d,f,ee){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var te=Object.defineProperty,__name=(e,t)=>te(e,`name`,{value:t,configurable:!0}),p=`@hpcc-js/marshaller`,m=`3.4.0`,h=`3.27.0`;function stringify(e){return Array.isArray(e)?`[`+e.map(stringify).join(`, `)+`]`:typeof e!=`object`||!e||e===void 0?JSON.stringify(e):`{ ${Object.keys(e).map(t=>`${t}: ${stringify(e[t])}`).join(`, `)} }`}function schemaType2IFieldType(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 schemaRow2IField(e){return e._children&&e._children.length?{type:`dataset`,id:e.name,children:e._children.map(schemaRow2IField)}:{id:e.name,type:schemaType2IFieldType(e.type)}}function wsEclSchemaRow2IField(e){return e}var Activity=class extends n.PropertyExt{_sourceActivity;fixInt64(e){if(!e||e.length===0)return[];let t=this.outFields().filter(t=>{switch(t.type){case`number`:return typeof e[0][t.id]!=`number`;case`number64`:return!0}return!1});return t.length?e.map(e=>{for(let n of t)e[n.id]=+e[n.id];return e}):e}sourceActivity(e){return arguments.length?(this._sourceActivity=e,this):this._sourceActivity}hash(e={}){return(0,r.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(){let 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(let n of t){let t=this.fieldOrigin(n);t&&(e.outputs[t.id()]||(e.outputs[t.id()]=[]),e.outputs[t.id()].indexOf(n)<0&&e.outputs[t.id()].push(n))}}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){let t=this.hash();return(this._prevDataHash!==t||this._prevInData!==e)&&(this._prevDataHash=t,this._prevInData=e,this._prevData=(0,r.update)(this._prevData,this.computeData())),this._prevData}outData(){return this.cachedComputeData(this.inData())}},ActivityArray=class extends Activity{_activities=[];activities(e){return arguments.length?(this._activities=e,this):this._activities}};ActivityArray.prototype._class+=` ActivityArray`;var ActivityPipeline=class extends ActivityArray{activities(e){if(!arguments.length)return super.activities();super.activities(e);let t;for(let n of e)t&&n.sourceActivity(t),t=n;return this}first(){return this.activities()[0]}last(){let e=this.activities();return e[e.length-1]}calcUpdatedGraph(e){return e.updatedBy().map(t=>({from:t,to:e}))}updatedByGraph(){let e=[];for(let t of this.activities())e=e.concat(this.calcUpdatedGraph(t));return e}fetch(e=0,t=Number.MAX_VALUE){return this.exec().then(()=>{let n=this.outData();return e===0&&n.length<=t?n:n.slice(e,e+t)})}hash(e={}){return(0,r.hashSum)({activities:[this.activities().map(e=>e.hash())],...e})}refreshMeta(){return this.last().refreshMeta()}updatedBy(){let e=[];for(let 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()}};ActivityPipeline.prototype._class+=` ActivitySequence`;var ActivitySelection=class extends ActivityArray{_selection;_monitorHandle;selection(e){return e===void 0?this._selection:(this._monitorHandle&&this._monitorHandle.remove(),this._selection=e,this._monitorHandle=e.monitor((t,n,r)=>{this.broadcast(t,n,r,e)}),this)}hash(e={}){return(0,r.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()}};ActivitySelection.prototype._class+=` ActivitySelection`;var g=0,Datasource=class extends Activity{constructor(){super(),this._id=`ds_${++g}`}},DatasourceRef=class extends Activity{_origDatasource;constructor(){super()}hash(e={}){return super.hash({datasource:this._datasource?this._datasource.hash(e):void 0,...e})}toDDL(){return{id:this.datasource().id()}}};DatasourceRef.prototype._class+=` DatasourceRef`,DatasourceRef.prototype.publish(`datasource`,null,`widget`,`Datasource Reference`,null,{internal:!0}),DatasourceRef.prototype._origDatasource=DatasourceRef.prototype.datasource,DatasourceRef.prototype.datasource=function(e){let t=DatasourceRef.prototype._origDatasource.apply(this,arguments);return e!==void 0&&this.sourceActivity(e),t};var _=class FormField extends n.PropertyExt{_owner;disableChildField(){return this.type()!==`dataset`}constructor(){super()}toDDL(){return{type:this.type(),id:this.fieldID(),default:this.default(),children:this.type()===`dataset`?this.childFields().map(e=>e.toDDL()):void 0}}fromDDL(e){return this.type(e.type).fieldID(e.id).default(e.default).childFields(e.type===`dataset`&&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()}},v=class Form extends Datasource{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(_.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){let t=this.validFields().map(e=>e.toDDL());return()=>t}exec(){return Promise.resolve()}computeData(){let e={};return this.validFields().forEach(t=>{e[t.fieldID()]=t.calcValue()}),[e]}total(){return 1}};v.prototype._class+=` Form`,_.prototype.publish(`type`,`string`,`set`,`FormField Type`,[`boolean`,`number`,`string`,`dataset`]),_.prototype.publish(`fieldID`,``,`string`,`FormField Label`),_.prototype.publish(`default`,null,`any`,`Default Value`,null,{optional:!0}),_.prototype.publish(`value`,null,`any`,`Default Value`,null,{optional:!0}),_.prototype.publish(`childFields`,[],`propertyArray`,`Child Fields`,null,{autoExpand:_,disable:e=>e.disableChildField()}),v.prototype.publish(`formFields`,[],`propertyArray`,`Multi Fields`,null,{autoExpand:_});function fieldType(e){if((0,r.isArray)(e))return`dataset`;let t=typeof e;switch(t){case`boolean`:case`number`:case`string`:case`object`:return t}return`string`}function rowToFields(e,t){let n=[];for(let r in e){let i={type:fieldType(e[r]),id:r};switch(i.type){case`object`:for(let e of t){let t=!1;for(let n in e[r]){let n=rowToFields(e[r],[e[r]]);i.fields={},n.length&&(n.forEach(e=>i.fields[e.id]=e),t=!0);break}if(t)break}break;case`dataset`:for(let e of t)if(e[r]&&e[r].length){i.children=rowToFields(e[r][0],e[r]);break}break}n.push(i)}return n}var y=class Databomb extends Datasource{_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(_.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=(0,n.csvParse)(this.payload());break;case`tsv`:this._jsonData=(0,n.tsvParse)(this.payload());break;default:this._jsonData=JSON.parse(this.payload());break}this.databombFields(this.preCalcFields().map(_.fromDDL))}catch{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 this._jsonData.length===0?[]:rowToFields(this._jsonData[0],this._jsonData)}computeFields(e){return()=>this.validFields().map(e=>e.toDDL())}exec(){return Promise.resolve()}computeData(){let e={};return this.validFields().forEach(t=>{e[t.fieldID()]=t.coerceFunc()}),this._jsonData.map(t=>{let n={};for(let r in e)n[r]=e[r](t[r]);return n})}total(){return this._jsonData.length}};y.prototype._class+=` Databomb`,y.prototype.publish(`format`,`json`,`set`,`Databomb Format`,[`json`,`csv`,`tsv`]),y.prototype.publish(`payload`,``,`string`,`Databomb array`,null,{multiline:!0}),y.prototype.publish(`databombFields`,[],`propertyArray`,`Multi Fields`,null,{autoExpand:_});var ne=y.prototype.format;y.prototype.format=function(e){let t=ne.apply(this,arguments);return arguments.length&&this.updateJsonData(),t};var re=y.prototype.payload;y.prototype.payload=function(e){let t=re.apply(this,arguments);return arguments.length&&this.updateJsonData(),t};var b=new y().id(`Empty`).payload(`[]`),DatasourceAdapt=class{_activity;constructor(e){this._activity=e||b}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(()=>{let n=this._activity.outData();return e===0&&n.length<=t?Promise.resolve(n):Promise.resolve(n.slice(e,e+t))})}},ESPResult=class extends Datasource{_ec;_result;_schema=[];_meta=[];_total;_data=[];constructor(e){super(),this._ec=e,this.samples(this._ec.samples()).sampleSize(this._ec.sampleSize())}hash(e={}){return(0,r.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||=super.refreshMeta().then(()=>{if(this._result=this._createResult(),this._result)return this._result.refresh();throw 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(schemaRow2IField)}).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=(0,r.debounce)(()=>this._prevExecHash===this.hash()?Promise.resolve():(this._prevExecHash=this.hash(),super.exec().then(()=>this.sample()).then(e=>{this._data=this.fixInt64(e)}).catch(e=>{this._data=[]})));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 r.AsyncOrderedQueue;_fetch(e,t){return this._fetchQ.push(this._result?this._result.fetchRows(e,t).catch(e=>[]):Promise.resolve([]))}sample=(0,r.debounce)((e=this.samples(),t=this.sampleSize())=>{let n=[];if(e*t>=this.total())n.push(this._fetch(0,this.total()));else{let r=this.total()-t;for(let i=0;i<e;++i)n.push(this._fetch(Math.floor(i*r/e),t))}return Promise.all(n).then(e=>{let t=[];for(let n of e)t=t.concat(n);return t})})};ESPResult.prototype._class+=` ESPResult`;var x=class WUResult extends ESPResult{_origWu;_origResultName;constructor(e){super(e),this._wu=new S(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,n,r,i=!1){return new WUResult(e).wu(n).resultName(r).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()}`}};x.prototype._class+=` WUResult`;var S=class WU extends Datasource{_ec;_origUrl;_origWuid;_workunit;_outputs={};constructor(e){super(),this._ec=e}toDDL(){let e={};for(let 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);let n={};for(let t in e.outputs)n[t]=x.fromDDL(this._ec,e,this,t);return this._outputs=n,this}static fromDDL(e,t,n=!1){return new WU(e).fromDDL(t,n)}hash(){return(0,r.hashSum)({url:this.url(),wuid:this.wuid()})}label(){return this.wuid()}outputs(){let e=[];for(let t in this._outputs)e.push(this._outputs[t]);return e}outputDDL(){let e={};for(let 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()?Promise.resolve():(this._prevSourceHash!==this.hash()&&(this._prevSourceHash=this.hash(),delete 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)}resultNames(){return this._resultNames}};S.prototype._class+=` WU`;var WUResultRef=class extends DatasourceRef{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()}}};WUResultRef.prototype._class+=` WUResultRef`,ESPResult.prototype.publish(`samples`,10,`number`,`Number of samples`),ESPResult.prototype.publish(`sampleSize`,100,`number`,`Sample size`),x.prototype.publish(`wu`,null,`widget`,`Workunit`),x.prototype.publish(`resultName`,``,`set`,`Result Name`,function(){return this._wu===void 0?[]:this._wu.resultNames()}),x.prototype._origWu=x.prototype.wu,x.prototype.wu=function(e){let t=x.prototype._origWu.apply(this,arguments);return e!==void 0&&this._wu.refreshMeta(),t},x.prototype._origResultName=x.prototype.resultName,x.prototype.resultName=function(e){let t=this._resultName,n=x.prototype._origResultName.apply(this,arguments);return e!==void 0&&t!==e&&this.responseFields([]),n},S.prototype.publish(`url`,``,`string`,`ESP Url (http://x.x.x.x:8010)`),S.prototype.publish(`wuid`,``,`string`,`Workunit ID`),S.prototype._origUrl=S.prototype.url,S.prototype.url=function(e){let t=S.prototype._origUrl.apply(this,arguments);return e!==void 0&&this.refreshMeta(),t},S.prototype._origWuid=S.prototype.wuid,S.prototype.wuid=function(e){let t=S.prototype._origWuid.apply(this,arguments);return e!==void 0&&this.refreshMeta(),t};var C=class LogicalFile extends ESPResult{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,n=!1){return new LogicalFile(e).fromDDL(t,n)}_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()}`}};C.prototype._class+=` LogicalFile`,C.prototype.publish(`url`,``,`string`,`ESP Url (http://x.x.x.x:8010)`),C.prototype.publish(`nodeGroup`,``,`string`,`Node Group`),C.prototype.publish(`logicalFile`,``,`string`,`Logical File Name`);var w=class RestField extends n.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()}},T=class RestService extends Datasource{_ec;_responseFields={};constructor(e){super(),this._ec=e}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(w.fromDDL));for(let t in e.outputs)this.responseFields(t,e.outputs[t].fields);return this}static fromDDL(e,t,n=!1){return new RestService(e).fromDDL(t,n)}hash(e={}){return(0,r.hashSum)({url:this.url(),action:this.action(),mode:this.mode(),...e})}label(){return this.action()}responseFields(e,t){return arguments.length===1?this._responseFields[e]||[]:(this._responseFields[e]=t,this)}validRequestFields(){return this.requestFields().filter(e=>e.valid())}_prevRequestHash;_prevPromise;_submitQ=new r.AsyncOrderedQueue;submit(e){let n=(0,r.hashSum)(e);if(!this._prevPromise||this._prevRequestHash!==n){this._prevRequestHash=n;let r=(0,t.createConnection)({baseUrl:this.url(),type:this.mode()});this._prevPromise=this._submitQ.push(r.send(this.action(),e))}return this._prevPromise}resultNames(){let e=[];for(let t in this._responseFields)e.push(t);return e}outputDDL(){let e={};return this.resultNames().forEach(t=>{e[t]={fields:this._responseFields[t]}}),e}};T.prototype._class+=` RestService`;var E=class RestResult extends Datasource{_ec;_origService;constructor(e){super(),this._ec=e,this._service=new T(this._ec)}validRequestFields(){return this.service().validRequestFields()}toDDL(){return this.service().toDDL()}fromDDL(e){return this.service().fromDDL(e),this}static fromDDL(e,t,n){return new RestResult(e).id(`${t.id()}_${n}`).service(t).resultName(n)}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(0,r.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[];let e=rowToFields(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=>{let t=this.resultName(),n=t?t.split(`.`):[];for(let t of n)e=(e||{})[t];return this._jsonData=e,e})}formatRequest(){let e={};return this.service().validRequestFields().forEach(t=>{e[t.fieldID()]=``}),e}exec(){return this.submit(this.formatRequest()).then(e=>{})}};E.prototype._class+=` RestResult`;var D=class Param extends n.PropertyExt{_ec;validate(e){let 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}constructor(e){super(),this._ec=e}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(0,r.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(){return this.source_exists()&&this.remoteField_exists()?this.sourceSelection().map(e=>e[this.remoteField()]):this.value_exists()?[this.value()]:[``]}exists(){return this.localField_exists()&&(this.source_exists()&&this.remoteField_exists()||this.value_exists())}};D.prototype._class+=` Param`;var RestResultRef=class extends DatasourceRef{_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(let t of this.validParams())e=e.concat(t.validate(`request`));return e}constructor(e){super(),this._ec=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=>D.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);let t=[];for(let t of this.validParams()){let n=t.sourceViz().hipiePipeline();e.inputs[this.id()]||(e.inputs[this.id()]=[]),e.inputs[this.id()].push(t.localField()),n.resolveFields(e,[t.remoteField()])}super.resolveFields(e,t)}validParams(){return this.request().filter(e=>e.exists())}refreshMeta(){return this.datasource().refreshMeta().then(()=>{let e=this.request(),t=(0,r.compare)(e.map(e=>e.localField()),this.datasource().validRequestFields().map(e=>e.fieldID())),n=e.filter(e=>t.update.indexOf(e.localField())>=0);this.request(n.concat(t.enter.map(e=>new D(this._ec).localField(e))))})}updatedBy(){return this.validParams().map(e=>e.source())}computeFields(e){return this.datasource().computeFields(e)}formatRequest(){let e=this.datasource().formatRequest();return this.request().forEach(t=>{e[t.localField()]!==void 0&&(e[t.localField()]=t.calcValue()||e[t.localField()])}),e}_prevRequestHash;_prevRequestPromise;exec(){let e=this.formatRequest(),t=(0,r.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}};RestResultRef.prototype._class+=` RestResultRef`,w.prototype.publish(`fieldID`,``,`string`,`RestField Label`),T.prototype.publish(`url`,``,`string`,`REST Url`),T.prototype.publish(`action`,``,`string`,`Query Set`),T.prototype.publish(`mode`,`get`,`set`,`Request mode`,[`get`,`post`]),T.prototype.publish(`requestFields`,[],`propertyArray`,`Multi Fields`,null,{autoExpand:w}),E.prototype.publish(`service`,null,`widget`,`Rest service`),E.prototype.publish(`resultName`,``,`string`,`Result Name`),E.prototype._origService=E.prototype.service,E.prototype.service=function(e){let t=E.prototype._origService.apply(this,arguments);return e!==void 0&&this._service.refreshMeta(),t},D.prototype.publish(`localField`,null,`string`,`Label`),D.prototype.publish(`source`,null,`set`,`Activity`,function(){return this.visualizationIDs()},{optional:!0,disable:e=>e.value_exists(),validate:e=>e.source_disabled()||e.visualizationIDs().indexOf(e.source())>=0}),D.prototype.publish(`remoteField`,null,`set`,`Source Field`,function(){return this.sourceFields()},{optional:!0,disable:e=>!e.source_exists()||e.value_exists(),validate:e=>e.remoteField_disabled()||e.sourceFields().indexOf(e.remoteField())>=0}),D.prototype.publish(`value`,null,`string`,`Static Value`,null,{optional:!0,disable:e=>e.source_exists(),validate:e=>e.value_disabled()||e.value_exists()}),RestResultRef.prototype.publish(`request`,[],`propertyArray`,`Request Fields`);function parseUrl(e){let t=e.split(`/WsEcl/submit/query/`);if(t.length<2)throw Error(`Invalid roxie URL: ${e}`);let n=t[0].split(`:`);if(n.length<3)throw Error(`Invalid roxie URL: ${e}`);let r=t[1].split(`/`);if(r.length<2)throw Error(`Invalid roxie URL: ${e}`);return{url:`${n[0]}:${n[1]}:${n[2]===`18002`?`18010`:`8010`}`,querySet:r[0],queryID:r[1]}}function isHipieRequest(e){return e.length>=8&&e.indexOf(`_changed`)===e.length-8}function isHipieResponse(e){return e.length>=8&&e.indexOf(`_changed`)===e.length-8||[`HIPIE_DDL`,`HIPIE_DDLGLOBALS`,`hipieversion`].indexOf(e)>=0}var O=class RoxieService extends Datasource{_ec;_query;_requestFields;_responseFields={};_type=`roxie`;constructor(e){super(),this._ec=e}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(let t in e.outputs)this.responseFields(t,e.outputs[t].fields);return this}static fromDDL(e,t,n=!1){return new RoxieService(e).fromDDL(t,n)}hash(e={}){return(0,r.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){let e=!!this._requestFields;this.refreshMetaPromise=new Promise((n,r)=>{let i=t.Query.attach({baseUrl:this.url(),hookSend:this._ec.hookSend()},this.querySet(),this.queryID());(!e||this.ignoreHipieRequest()||this.ignoreHipieResponse())&&n(i.refresh()),n(i)}).then(t=>{this._query=t,(!e||this.ignoreHipieRequest())&&(this._requestFields=t.requestFields().filter(e=>this._type===`roxie`||!isHipieRequest(e.id))),(!e||this.ignoreHipieResponse())&&t.resultNames().filter(e=>this._type===`roxie`||!isHipieResponse(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 arguments.length===1?this._responseFields[e]||[]:(this._responseFields[e]=t,this)}_prevRequestHash;_prevPromise;_submitQ=new r.AsyncOrderedQueue;submit(e){let t=(0,r.hashSum)(e);return(!this._prevPromise||this._prevRequestHash!==t)&&(this._prevRequestHash=t,this._prevPromise=this._submitQ.push(this._query.submit(e))),this._prevPromise}resultNames(){let e=[];for(let t in this._responseFields)e.push(t);return e}outputDDL(){let e={};return this.resultNames().forEach(t=>{e[t]={fields:this._responseFields[t]}}),e}};O.prototype._class+=` RoxieService`,O.prototype.publish(`url`,``,`string`,`ESP Url (http://x.x.x.x:8002)`),O.prototype.publish(`querySet`,``,`string`,`Query Set`),O.prototype.publish(`queryID`,``,`string`,`Query ID`),O.prototype.publish(`ignoreHipieRequest`,!1,`boolean`,`Ignore provided DDL request`),O.prototype.publish(`ignoreHipieResponse`,!1,`boolean`,`Ignore provided DDL response`);var k=class RoxieResult extends Datasource{_ec;_origService;constructor(e){super(),this._ec=e,this._service=new O(this._ec)}toDDL(){return this.service().toDDL()}fromDDL(e){return this.service().fromDDL(e),this}static fromDDL(e,t,n){return new RoxieResult(e).id(`${t.id()}_${n}`).service(t).resultName(n)}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(0,r.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)}};k.prototype._class+=` RoxieResult`,k.prototype.publish(`service`,null,`widget`,`Roxie service`),k.prototype.publish(`resultName`,``,`set`,`Result Name`,function(){return this._service===void 0?[]:this._service.resultNames()}),k.prototype._origService=k.prototype.service,k.prototype.service=function(e){let t=k.prototype._origService.apply(this,arguments);return e!==void 0&&this._service.refreshMeta(),t};var RoxieResultRef=class extends DatasourceRef{_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(let t of this.validParams())e=e.concat(t.validate(`request`));return e}constructor(e){super(),this._ec=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=>D.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);let t=[];for(let n of this.validParams()){t.push(n.localField());let r=n.sourceViz().hipiePipeline();e.inputs[this.id()]||(e.inputs[this.id()]=[]),e.inputs[this.id()].push(n.localField()),r.resolveFields(e,[n.remoteField()])}super.resolveFields(e,t)}validParams(){return this.request().filter(e=>e.exists())}refreshMeta(){return this.datasource().refreshMeta().then(()=>{let e=this.request(),t=(0,r.compare)(e.map(e=>e.localField()),this.datasource().requestFields().map(e=>e.id)),n=e.filter(e=>t.update.indexOf(e.localField())>=0);this.request(n.concat(t.enter.map(e=>new D(this._ec).localField(e))))})}updatedBy(){return this.validParams().map(e=>e.source())}computeFields(e){return()=>this.datasource().responseFields()}formatRequest(){let e={},t=!1,n=this.datasource().requestFields();for(let r of this.validParams()){let i=r.calcValue(),a=n.filter(e=>e.id===r.localField())[0],o;o=a.type===`set`?{Item:i}:i[0],o!==void 0&&(e[r.localField()]=o),t=!0}return t||(e.refresh=!0),e}_prevRequestHash;_prevRequestPromise;exec(){return super.exec().then(()=>{let e=this.formatRequest(),t=(0,r.hashSum)({hash:this.hash(),request:e});return this._prevRequestHash!==t&&(this._prevRequestHash=t,this._prevRequestPromise=this.datasource().submit(e).then(e=>{let t=this.datasource().resultName(),n=e[t];return n||=e[t.toLowerCase().replace(/ /g,`_`)],this.fixInt64(n)})),this._prevRequestPromise}).then(e=>{this._data=e})}inData(){return this._data}computeData(){return this._data}};RoxieResultRef.prototype._class+=` RoxieResultRef`,RoxieResultRef.prototype.publish(`request`,[],`propertyArray`,`Request Fields`);var HipieResultRef=class extends RoxieResultRef{fullUrl(e){let t=parseUrl(e);return this.datasource().service().url(t.url),this.datasource().service().querySet(t.querySet),this.datasource().service().queryID(t.queryID),this}formatRequest(){let e=super.formatRequest(),t={};for(let n in e)t[n]=e[n],t[`${n}_changed`]=!0;return t}};HipieResultRef.prototype._class+=` HipieResultRef`;var A=0,DSPicker=class extends ActivitySelection{_ec;_nullDatasource=b;_origDatasourceID;_origDatasourceRef;datasource(){return this.datasourceRef().datasource()}refreshRef(e){let t=this._ec.datasource(e);t instanceof y||t instanceof v||t instanceof C||t instanceof O?this.selection(new DatasourceRef().datasource(t)):t instanceof x?this.selection(new WUResultRef().datasource(t)):t instanceof k?this.selection(new HipieResultRef(this._ec).datasource(t)):t instanceof E&&this.selection(new RestResultRef(this._ec).datasource(t))}selection(e){let 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()}constructor(e){super(),this._ec=e,this._id=`ds_${++A}`;let t=this._ec.datasources()[0];this.datasourceID(t.id())}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()})`}`}))}};DSPicker.prototype._class+=` DSPicker`,DSPicker.prototype.publish(`datasourceID`,``,`set`,`Activity`,function(){return this.datasourceIDs()},{optional:!1}),DSPicker.prototype.publish(`datasourceRef`,``,`widget`,`Activity`),DSPicker.prototype._origDatasourceID=DSPicker.prototype.datasourceID,DSPicker.prototype.datasourceID=function(e){let t=this._datasourceID,n=DSPicker.prototype._origDatasourceID.apply(this,arguments);return e!==void 0&&t!==e&&this.refreshRef(e),n},DSPicker.prototype._origDatasourceRef=DSPicker.prototype.datasourceRef,DSPicker.prototype.datasourceRef=function(e){return ActivitySelection.prototype.selection.apply(this,arguments)};function createFilter(e,t,n){let r=typeof n==`string`;switch(e){case`==`:return e=>r&&typeof e[t]==`string`?e[t].trim()===n:e[t]===n;case`!=`:return e=>r&&typeof e[t]==`string`?e[t].trim()!==n:e[t]!==n;case`<`:return e=>e[t]<n;case`<=`:return e=>e[t]<=n;case`>`:return e=>e[t]>n;case`>=`:return e=>e[t]>=n;default:throw Error(`Unknown filter condition: ${e}`)}}var j=class ColumnMapping extends n.PropertyExt{_owner;validate(e){let 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(0,r.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){let t=this.remoteField();return e.map(e=>{let n=e[t];return typeof n==`string`?n.trim():n})}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){let t=this.localField(),n=this.remoteValues(e);switch(this.condition()){case`range`:return this.nullable()&&(n.length<2||n[0]===n[1])?e=>!0:e=>e[t]>=n[0]&&e[t]<=n[1];case`in`:return this.nullable()&&n.length===0?e=>!0:e=>n.some(n=>typeof e[t]==`string`?e[t].trim()===n:e[t]===n);default:let e=n[0];return this.nullable()&&(e==null||e===``)?e=>!0:createFilter(this.condition(),t,e)}}};j.prototype._class+=` ColumnMapping`;var M=class RemoteFilter extends n.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()&&this.validMappings().length===0&&t.push({source:`${e}.source.${this.source()}`,msg:`Invalid mappings: "${this.source()}"`,hint:`expected minimum of 1 mapping`});for(let n of this.validMappings())t=t.concat(n.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=>j.fromDDL(e))),this):this.validMappings().map(e=>e.toDDL())}visualizationIDs(){return this._owner.visualizationIDs()}hash(){return(0,r.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(let t of e)this.mappings().push(new j().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(){let e=this.sourceSelection(),t=this.validMappings().map(t=>t.createFilter(e));return e=>t.every(t=>t(e))}createFilterDescription(){let e=this.sourceSelection();return this.validMappings().map(t=>t.createFilterDescription(e)).join(`, `)}};M.prototype._class+=` Filter`;var N=class StaticFilter extends n.PropertyExt{_owner;validate(e){let 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){if(arguments.length===0)switch(this.valueType()){case`number`:return+this.value();default:return``+this.value()}return this.value(e),typeof e==`number`?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(0,r.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 createFilter(this.condition(),this.localField(),this.coerceValue())}};N.prototype._class+=` StaticFilter`;var P=class Filters extends Activity{_ec;static Filter=M;static Mapping=j;validate(){let e=[];for(let t of this.validFilters())e=e.concat(t.validate(`filter`));return e}constructor(e){super(),this._ec=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());let t=[],n=[];return e.forEach(e=>{i.DDL2.isIFilterCondition(e)?t.push(M.fromDDL(e)):n.push(N.fromDDL(e))}),this.remoteFilter(t),this.staticFilter(n),this}visualizationIDs(){return this._ec.elementIDs()}visualization(e){return this._ec.element(e)}hash(){return(0,r.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);let t=[];for(let n of this.validRemoteFilters()){let r=n.sourceViz().hipiePipeline(),i=[];for(let e of n.validMappings())t.push(e.localField()),i.push(e.remoteField());r.resolveFields(e,i)}super.resolveInFields(e,t)}exec(){return super.exec()}computeData(){let e=super.computeData();if(e.length===0||!this.exists())return e;let 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()]}};P.prototype._class+=` Filters`,j.prototype.publish(`remoteField`,null,`set`,`Filter Fields`,function(){return this.sourceOutFields()},{optional:!0,disable:e=>!e._owner.source(),validate:e=>e.sourceOutFields().indexOf(e.remoteField())>=0}),j.prototype.publish(`localField`,null,`set`,`Local Fields`,function(){return this.localFields()},{optional:!0,disable:e=>!e._owner.source(),validate:e=>e.localFields().indexOf(e.localField())>=0}),j.prototype.publish(`condition`,`==`,`set`,`Filter Fields`,[`==`,`!=`,`>`,`>=`,`<`,`<=`,`range`,`in`]),j.prototype.publish(`nullable`,!1,`boolean`,`Ignore null filters`),M.prototype.publish(`source`,null,`set`,`Activity`,function(){return this.visualizationIDs()},{optional:!0,validate:e=>e.visualizationIDs().indexOf(e.source())>=0}),M.prototype.publish(`mappings`,[],`propertyArray`,`Mappings`,null,{autoExpand:j}),N.prototype.publish(`localField`,null,`set`,`Local Fields`,function(){return this.localFields()},{optional:!0,validate:e=>e.localFields().indexOf(e.localField())>=0}),N.prototype.publish(`condition`,`==`,`set`,`Filter Fields`,[`==`,`!=`,`>`,`>=`,`<`,`<=`]),N.prototype.publish(`value`,``,`any`,`Static Value`),N.prototype.publish(`valueType`,`number`,`set`,`Static Value Type`,[`number`,`string`]),P.prototype.publish(`remoteFilter`,[],`propertyArray`,`Remote Filter`,null,{autoExpand:M}),P.prototype.publish(`staticFilter`,[],`propertyArray`,`Static Filter`,null,{autoExpand:N});var F=class GroupByColumn extends n.PropertyExt{_owner;validate(e){let 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(0,r.hashSum)(this.label())}columns(){return this._owner.inFieldIDs()}};F.prototype._class+=` GroupByColumn`;function localCount(e,t){return e.length}var I={count:localCount,min:n.min,max:n.max,mean:n.mean,median:n.median,variance:n.variance,deviation:n.deviation,sum:n.sum},L=class AggregateField extends n.PropertyExt{_owner;disableAggrColumn(){return!this.fieldID()||!this.aggrType()||this.aggrType()===`count`}disableBaseCountColumn(){return!this.fieldID()||!this.aggrType()||this.aggrType()!==`mean`}validate(e){let 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 this.aggrType()===`count`?{fieldID:this.fieldID(),type:`count`}:{fieldID:this.fieldID(),type:this.aggrType(),inFieldID:this.aggrColumn(),baseCountFieldID:this.baseCountColumn()}}fromDDL(e){let t=this.fieldID(e.fieldID).aggrType(e.type);return e.type!==`count`&&(t.aggrColumn(e.inFieldID),t.baseCountColumn(e.baseCountFieldID)),t}static fromDDL(e){return new AggregateField().fromDDL(e)}hash(){return(0,r.hashSum)({label:this.fieldID(),aggrType:this.aggrType(),aggrColumn:this.aggrColumn()})}columns(){return this._owner.inFieldIDs()}hasColumn(){return this.columns().length}aggregate(e){return I[this.aggrType()](e,e=>+e[this.aggrColumn()])}aggrFunc(){let e=I[this.aggrType()],t=this.aggrColumn(),n=this.baseCountColumn();return n?r=>e(r,e=>e[t]/+e[n]):n=>e(n,e=>+e[t])}};L.prototype._class+=` AggregateField`;var R=class GroupBy extends Activity{validate(){let e=[];for(let t of this.validGroupBy())e=e.concat(t.validate(`GroupBy.column`));for(let 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=>F.fromDDL(e))),this):this.validGroupBy().map(e=>e.toDDL())}aggregates(e){return arguments.length?(this.computedFields(e.map(e=>L.fromDDL(e))),this):this.validComputedFields().map(e=>e.toDDL())}hash(){return(0,r.hashSum)({groupBy:this.column().map(e=>e.hash()),computedFields:this.computedFields().map(e=>e.hash())})}appendGroupBys(e){for(let t of e)this.column().push(new F().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(let t of this.inFields())if(t.id===e)return t;return null}appendComputedFields(e){for(let t of e){let e=new L().owner(this).fieldID(t.label).aggrType(t.type);t.column!==void 0&&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);let t=[],n=this.validGroupBy();for(let e of n){let n=this.field(e.label()),r={type:n?n.type:`string`,id:e.label()};t.push(r)}for(let e of this.computedFields())if(e.fieldID()){let n={id:e.fieldID(),type:`number`};t.push(n)}if(this.details()){let e=t;if(this.exists()){let n={id:`values`,type:`dataset`,children:[]};t.push(n),e=n.children}let r=n.map(e=>e.label());e.push(...this.inFields().filter(e=>this.fullDetails()||r.indexOf(e.id)<0))}return()=>t}referencedFields(e){super.referencedFields(e);let t=[];for(let e of this.validGroupBy())t.push(e.label());for(let e of this.validComputedFields())e.aggrColumn()&&t.push(e.aggrColumn());super.resolveInFields(e,t)}computeData(){let e=super.computeData();if(e.length===0||!this.exists())return e;let t=this.validGroupBy().map(e=>e.label()),r=this.validComputedFields().map(e=>({label:e.fieldID(),aggrFunc:e.aggrFunc()})),i=(0,n.nest)().key(e=>{let n=``;for(let r of t)n+=`:`+e[r];return n}).entries(e).map(e=>{let n=e;delete n.key;for(let e of t)n[e]=n.values[0][e];for(let e of r)n[e.label]=e.aggrFunc(n.values);return n}),a=this.outFields();return i.map(e=>{let t={};for(let n of a)t[n.id]=e[n.id];return t})}};R.prototype._class+=` GroupBy`,F.prototype.publish(`label`,void 0,`set`,`Field`,function(){return this.columns()},{optional:!0,validate:e=>e.columns().indexOf(e.label())>=0}),L.prototype.publish(`fieldID`,null,`string`,`new Field ID`,null,{optional:!0,disable:e=>!e.hasColumn()}),L.prototype.publish(`aggrType`,`count`,`set`,`Aggregation Type`,[`count`,`min`,`max`,`sum`,`mean`,`median`,`variance`,`deviation`],{optional:!0,disable:e=>!e.fieldID()}),L.prototype.publish(`aggrColumn`,null,`set`,`Aggregation Field`,function(){return this.columns()},{optional:!0,disable:e=>e.disableAggrColumn(),validate:e=>e.columns().indexOf(e.aggrColumn())>=0}),L.prototype.publish(`baseCountColumn`,null,`set`,`Base Count Field`,function(){return this.columns()},{optional:!0,disable:e=>e.disableBaseCountColumn(),validate:e=>e.columns().indexOf(e.baseCountColumn())>=0}),R.prototype.publish(`column`,[],`propertyArray`,`Source Columns`,null,{autoExpand:F}),R.prototype.publish(`computedFields`,[],`propertyArray`,`Computed Fields`,null,{autoExpand:L}),R.prototype.publish(`details`,!1,`boolean`,`Show details`),R.prototype.publish(`fullDetails`,!1,`boolean`,`Show groupBy fileds in details`);var z=class Limit extends Activity{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(0,r.hashSum)({limit:this.rows()})}exists(){return this.rows_exists()&&this.rows()>0}computeData(){let e=super.computeData();return e.length===0||!this.exists()?e:e.slice(0,Math.min(this.rows(),e.length))}};z.prototype._class+=` Limit`,z.prototype.publish(`rows`,void 0,`number`,`Limit output`);var B=class ComputedMapping extends n.PropertyExt{_owner;validate(e){let 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)}};B.prototype._class+=` ComputedMapping`;var V=class ComputedField extends n.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){let 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()||this.type()!==`=`||!this.column1())return!1;let e=this._owner.field(this.column1());return!!(e&&e.type===`dataset`&&e.children)}children(){let e=this._owner.field(this.column1());return e&&e.type===`dataset`?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`=`:let 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){let 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=>B.fromDDL(e)):[]);break;default:t.column1(e.sourceFieldID1).column2(e.sourceFieldID2)}return t}static fromDDL(e){return new ComputedField().fromDDL(e)}hash(){return(0,r.hashSum)(this.toDDL())}columns(){return this._owner.fieldIDs()}computedField(){switch(this.type()){case`=`:let e=this.validChildFields();return e.length===0&&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){let t=this.hasChildFields(),n=this.validChildFields().map(t=>({label:t.label(),func:t.computeFunc(e)}));return r=>{let i=e&&t?{}:{...r};for(let e of n)i[e.label]=e.func(r);return e&&t&&(i.__lparam=r),i}}computeFunc(e){let t=this.column1(),i=this.column2();switch(this.type()){case`=`:return this.hasChildFields()?n=>(n[t].Row&&(0,r.isArray)(n[t].Row)?n[t].Row:n[t]).map(this.projection(e)):e=>e[t];case`*`:return e=>e[t]*+e[i];case`/`:return e=>e[t]/+e[i];case`+`:return e=>+e[t]+ +e[i];case`-`:return e=>e[t]-+e[i];case`scale`:let a=this.constValue();return e=>+e[t]*a;case`template`:let o=this.template();return e=>n.Utility.template(o,e);case`map`:let s=this.default(),c={};for(let e of this.mapping())c[e.value()]=e.newValue();return e=>c[e[t]]||s;default:return e=>e[t]}}fieldIDs(){let 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){let t=this._owner.field(this.column1());if(t)switch(t.type){case`dataset`:for(let n of t.children)if(n.id===e)return n;break;case`object`:return t.fields[e]}}};V.prototype._class+=` ComputedField`;var H=class MultiField extends n.PropertyExt{_owner;constructor(){super()}hash(){return(0,r.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(let n of this.validMultiFields())t=t.concat(n.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=>V.fromDDL(e))),this):this.validMultiFields().map(e=>e.toDDL())}fieldIDs(){return this._owner.fieldIDs()}field(e){return this._owner.field(e)}};H.prototype._class+=` MultiField`;var ProjectBase=class extends Activity{static ComputedField=V;_includeLParam=!1;_trim=!1;validate(){let e=[];for(let 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=>{switch(e.type){case`multi`:return H.fromDDL(e);default:return V.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(let t of this.inFields())if(t.id===e)return t;return null}clearComputedFields(){this.computedFields([])}appendComputedFields(e){for(let t of e){let e=new V().owner(this).label(t.label).type(t.type);t.column!==void 0&&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=[],n={};for(let e of this.validComputedFields())if(e instanceof H)for(let r of e.validMultiFields()){let e=r.computedField();t.push(e),n[e.id]=!0}else{let r=e.computedField();t.push(r),n[r.id]=!0}if(this._trim&&this.hasComputedFields()){if(this._includeLParam){let e={id:`__lparam`,type:`object`};t.push(e),n[e.id]=!0}}else t=t.concat(e.filter(e=>!n[e.id]));return()=>t}referencedFields(e){super.referencedFields(e);let t=[];for(let e of this.validComputedFields())if(e instanceof H)for(let n of e.validMultiFields())t.push(n.column1()),n.column2()&&t.push(n.column2());else if(e.type()===`template`)for(let r of n.Utility.templateFields(e.template()))t.push(r);else t.push(e.column1()),e.column2()&&t.push(e.column2());super.resolveInFields(e,t)}projection(){let e=this._trim,t=this.hasComputedFields(),n=[];for(let t of this.validComputedFields())if(t instanceof H)for(let r of t.validMultiFields())n.push({label:r.label(),func:r.computeFunc(e)});else n.push({label:t.label(),func:t.computeFunc(e)});return r=>{let i=e&&t?{}:{...r};for(let e of n)i[e.label]=e.func(r);return e&&t&&this._includeLParam&&(i.__lparam=r),i}}computeData(){let e=super.computeData();return e.length===0||!this.exists()?e:e.map(this.projection())}},U=class Project extends ProjectBase{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})}};U.prototype._class+=` Project`;var W=class Mappings extends ProjectBase{constructor(){super(),this._trim=!0,this._includeLParam=!0}toDDL(){return{type:`mappings`,transformations:this.transformations()}}fromDDL(e){let 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=>e.id!==`__lparam`).map(e=>e.id))}};W.prototype._class+=` Mappings`,B.prototype.publish(`value`,null,`any`,`Compare Value`,void 0,{validate:e=>!e.value()&&!e.newValue()||!!e.value()&&!!e.newValue()}),B.prototype.publish(`newValue`,null,`any`,`New Value`,void 0,{validate:e=>!e.value()&&!e.newValue()||!!e.value()&&!!e.newValue()}),V.prototype.publish(`label`,null,`string`,`Label`,null,{optional:!0}),V.prototype.publish(`type`,`mapping`,`set`,`Project type`,[`=`,`*`,`/`,`+`,`-`,`scale`,`template`,`map`],{optional:!0,disable:e=>!e.label()}),V.prototype.publish(`column1`,null,`set`,`Param 1`,function(){return this.columns()},{optional:!0,disable:e=>e.disableColumn1(),validate:e=>e.columns().indexOf(e.column1())>=0}),V.prototype.publish(`column2`,null,`set`,`Param 2`,function(){return this.columns()},{optional:!0,disable:e=>e.disableColumn2(),validate:e=>e.columns().indexOf(e.column2())>=0}),V.prototype.publish(`constValue`,null,`number`,`Const value`,null,{optional:!0,disable:e=>!e.label()||[`scale`].indexOf(e.type())<0}),V.prototype.publish(`template`,null,`string`,`template`,null,{optional:!0,disable:e=>!e.label()||[`template`].indexOf(e.type())<0}),V.prototype.publish(`default`,null,`any`,`Default Value`,null,{optional:!0,disable:e=>!e.label()||[`map`].indexOf(e.type())<0}),V.prototype.publish(`mapping`,[],`propertyArray`,`Mapped Values`,null,{autoExpand:B,disable:e=>e.disableMapping()}),V.prototype.publish(`childField`,[],`propertyArray`,`Child Fields`,null,{autoExpand:V,disable:e=>e.disableChildField()}),H.prototype.publish(`label`,``,`string`,`Label`),H.prototype.publish(`multiFields`,[],`propertyArray`,`Multi Fields`,null,{autoExpand:V}),ProjectBase.prototype.publish(`computedFields`,[],`propertyArray`,`Computed Fields`,null,{autoExpand:V});var G=class SortColumn extends n.PropertyExt{_owner;validate(e){let 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(0,r.hashSum)({sortColumn:this.fieldID(),descending:this.descending()})}fieldIDs(){return this._owner.fieldIDs()}field(e){return this._owner.inFields().filter(t=>t.id===e)[0]}};G.prototype._class+=` SortColumn`;var K=class Sort extends Activity{static Column=G;validate(){let e=[];for(let 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=>G.fromDDL(e))),this):this.validSortBy().map(e=>e.toDDL())}hash(){return(0,r.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(){let e=super.computeData(),t=[];for(let e of this.validSortBy())t.push({compare:e.descending()?n.descending:n.ascending,id:e.fieldID()});return t.length?[...e].sort((e,n)=>{for(let r of t){let t=r.compare(e[r.id],n[r.id]);if(t!==0)return t}return 0}):e}};K.prototype._class+=` Sort`,G.prototype.publish(`fieldID`,null,`set`,`Sort Field`,function(){return this.fieldIDs()},{optional:!0,validate:e=>e.fieldIDs().indexOf(e.fieldID())>=0}),G.prototype.publish(`descending`,!1,`boolean`,`Sort Field`),K.prototype.publish(`column`,[],`propertyArray`,`Source Columns`,null,{autoExpand:G});var HipiePipeline=class extends ActivityPipeline{_ec;_origDatasource;_origFilters;_origProject;_origGroupBy;_origSort;_origLimit;constructor(e,t){super(),this._ec=e,this._id=t,this._datasource=new DSPicker(this._ec),this._filters=new P(this._ec),this._project=new U,this._groupBy=new R,this._sort=new K,this._limit=new z,this.updateSequence()}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()}};HipiePipeline.prototype.publish(`datasource`,null,`widget`,`Data Source 2`),HipiePipeline.prototype.publish(`filters`,null,`widget`,`Client Filters`),HipiePipeline.prototype.publish(`project`,null,`widget`,`Project`),HipiePipeline.prototype.publish(`groupBy`,null,`widget`,`Group By`),HipiePipeline.prototype.publish(`sort`,null,`widget`,`Sort`),HipiePipeline.prototype.publish(`limit`,null,`widget`,`Limit output`);function wrapHipiePipelineProperty(e){let t=`_orig${e.charAt(0).toUpperCase()+e.slice(1)}`;HipiePipeline.prototype[t]=HipiePipeline.prototype[e],HipiePipeline.prototype[e]=function(e){let n=HipiePipeline.prototype[t].apply(this,arguments);return e!==void 0&&this.updateSequence(),n}}wrapHipiePipelineProperty(`datasource`),wrapHipiePipelineProperty(`filters`),wrapHipiePipelineProperty(`project`),wrapHipiePipelineProperty(`groupBy`),wrapHipiePipelineProperty(`sort`),wrapHipiePipelineProperty(`limit`);var NullView=class extends HipiePipeline{hash(){return super.hash()}_fetch(e,t){return Promise.resolve([])}};NullView.prototype._class+=` NullView`;var VizPopupPanel=class 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`;let n=this.widget().title();n&&(this.title(n),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()}};VizPopupPanel.prototype._class+=` marshaller_VizPopupPanel`;var VizChartPanel=class extends u.ChartPanel{_popup;_togglePopup=new n.ToggleButton().faChar(`fa-filter`).tooltip(`Filter`).on(`click`,()=>{this._popup.host(this);let e=this.locateClosestAncestor([`marshaller_DashboardDockPanel`,`marshaller_DashboardGrid`]).getBBox(!0),t=this._popup.widget(),n=this._togglePopup.getBBox();this._popup.pos({x:-e.x+n.x+n.width-t.minWidth(),y:-e.y+n.y+n.height}).resize({width:t.minWidth(),height:t.minHeight()}).visible(this._togglePopup.selected()).render(e=>{let t=`#`+e.id()+` .layout_Carousel .common_Widget`,n=e.element().node();if(n){let{height:r,width:i}=n.querySelector(t).getBoundingClientRect();e.resizeBodySync(i,r)}})});_origButtons;_filterButtons;constructor(){super(),this._origButtons=this.buttons(),this._filterButtons=[this._togglePopup,new n.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}};VizChartPanel.prototype._class+=` marshaller_VizChartPanel`,VizChartPanel.prototype.publish(`descriptionTemplate`,``,`string`),VizChartPanel.prototype.publish(`minWidth`,320,`number`,`Min Width`),VizChartPanel.prototype.publish(`minHeight`,240,`number`,`Min Height`);var q={Table:o.Table,FieldForm:s.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:l.ChoroplethCounties,USStatesChoropleth:l.ChoroplethStates,ClusterPins:l.Leaflet.ClusterPins,EntityRectList:n.EntityRectList,AdjacencyGraph:c.AdjacencyGraph,DataGraph:c.DataGraph},J=[];for(let e in q)J.push(e);function typeClass(e){return q[e]||o.Table}function typeNew(e){let t=new(q[e]||o.Table);return t instanceof s.FieldForm?t.validate(!1).allowEmptyRequest(!0):t instanceof c.AdjacencyGraph&&t.uidColumn(`uid`).labelColumn(`label`).iconColumn(`icon`).linksColumn(`links`).linkUidColumn(`uid`).linkLabelColumn(`label`),t}function typeInputs(e){return typeClass(e).__inputs||[]}var Visualization=class extends n.PropertyExt{_ec;_origVisibility;_origChartType;_origChartPanel;_hipiePipeline;constructor(e,t){super(),this._ec=e,this._hipiePipeline=t,this.mappings(new W),this.chartPanel(new VizChartPanel),this.typeChanged()}visualizationIDs(){return this._ec.elementIDs().filter(e=>e!==this.id())}_prevChartType;typeChanged(){if(this._prevChartType!==this._chartType){this._prevChartType=this._chartType,this.refreshMappings();let e=typeNew(this._chartType);this.chartPanel().widget(e)}}properties(e){return arguments.length?(this.chartPanel().deserialize(e),this):this.chartPanel().serialize()}refreshMappings(){let e=this.mappings();e.sourceActivity(this._hipiePipeline);let t=e.validComputedFields(),n=e.inFields(),r={};return e.computedFields(typeInputs(this._chartType).map((i,a)=>{let o=t[a];if(o)o instanceof H||o.label(i.id);else if(i.multi){o=new H().owner(e).label(i.id);let t=[];for(let e of n)(i.type===`any`||i.type===e.type)&&!r[e.id]&&(r[e.id]=!0,t.push(new V().label(e.id).type(`=`).column1(e.id)));o.multiFields(t)}else{o=new V().owner(e).label(i.id).type(`=`);for(let e of n)if((i.type===`any`||i.type===e.type)&&!r[e.id]){r[e.id]=!0,o.column1(e.id);break}}return o})),this}_prevFields=[];_prevLinkFields=[];_prevData=[];refreshData(){let e=this.mappings(),t=e.outFields(),n=this.toDBFields(t),r,i=[],a=this._ec.element(this.secondaryDataviewID());a&&(r=a.mappings().outFields(),i=this.toDBFields(r));let o=this._prevFields!==t||this._prevLinkFields!==r;if(o)if(this._prevFields=t,this.chartType()===`DataGraph`){let e=this.chartPanel().widget();e.vertexColumns(n.map(e=>e.label())),e.edgeColumns(i.map(e=>e.label()))}else this.chartPanel().fields(n.filter(e=>e.id()!==`__lparam`));else console.warn(`***${this.id()} Immutable Fields***`);let s=e.outData(),c=this._prevData!==s;if(c){this._prevData=s;let e=this.toDBData(n,s);if(this.chartType()===`DataGraph`){let t=this.chartPanel().widget();if(t.vertices(e),a){let e=a.mappings().outData(),n=this.toDBData(i,e);t.edges(n)}}else this.chartPanel().data(e)}else console.warn(`${this.id()} Immutable Data!`);return o||c?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){let t=[];for(let r of e||[]){let e=new n.Database.Field().type(this.fieldTypeTodbFieldType(r.type)).id(r.id).label(r.id);switch(r.type){case`dataset`:e.children(this.toDBFields(r.children));break;case`object`:break}t.push(e)}return t}toDBData(e,t){return((0,r.isArray)(t)?t:[t]).map(t=>{let n=[];for(let r of e)r.type()===`nested`?n.push(this.toDBData(r.children(),t[r.id()].Row||t[r.id()])):n.push(t[r.label()]);return n})}exec(){let e=[];if(this.secondaryDataviewID_exists()){let t=this.secondaryDataviewID(),n=this._ec.element(t);n&&e.push(n.visualization().exec())}let 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,n,r){}vertex_click(e,t,n){}};Visualization.prototype._class+=` Visualization`,Visualization.prototype.publishProxy(`title`,`_chartPanel`),Visualization.prototype.publishProxy(`description`,`_chartPanel`),Visualization.prototype.publish(`visibility`,i.DDL2.VisibilitySet[0],`set`,`Type`,i.DDL2.VisibilitySet),Visualization.prototype.publish(`chartType`,`Table`,`set`,`Type`,J),Visualization.prototype.publish(`secondaryDataviewID`,null,`set`,`Secondary Data View (e.g. graph edges)`,function(){return this.visualizationIDs()},{optional:!0}),Visualization.prototype.publish(`mappings`,null,`widget`,`Mappings`,void 0,{render:!1,internal:!0}),Visualization.prototype.publish(`chartPanel`,[],`widget`,`Widget`),Visualization.prototype._origVisibility=Visualization.prototype.visibility,Visualization.prototype.visibility=function(e){let t=this._visibility,n=Visualization.prototype._origVisibility.apply(this,arguments);return e!==void 0&&t!==e&&this.chartPanel().target(null),n},Visualization.prototype._origChartType=Visualization.prototype.chartType,Visualization.prototype.chartType=function(e,t){e!==void 0&&J.indexOf(e)===-1&&(e=`Table`);let n=Visualization.prototype._origChartType.apply(this,arguments);if(e!==void 0&&(this.typeChanged(),t)){let e=this.chartPanel().widget();for(let n in t)typeof e[n]==`function`&&e[n](t[n])}return n},Visualization.prototype._origChartPanel=Visualization.prototype.chartPanel,Visualization.prototype.chartPanel=function(e){let t=Visualization.prototype._origChartPanel.apply(this,arguments);if(e!==void 0){this._chartPanel.on(`click`,(e,t,n,r)=>this.click(e,t,n,r)).on(`vertex_click`,(e,t,n)=>this.vertex_click(e,t,n));for(let e in q)if(this._chartPanel.widget()instanceof q[e]){this._chartType=e;break}}return t};var State=class extends n.PropertyExt{constructor(){super(),this.selection([])}set(e){return(0,r.hashSum)(this.selection())===(0,r.hashSum)(e)?!1:(this.selection(e),!0)}removeInvalid(e){let t=this.selection(),n=[];for(let i of t)(0,r.find)(e,(e,t)=>{for(let t in i)if(i[t]!==e[t])return!1;return!0})&&n.push(i);return n.length===t.length?!1:(this.selection(n),!0)}};State.prototype._class+=` State`,State.prototype.publish(`selection`,[],`array`,`State`);var Y=0,Element=class extends n.PropertyExt{_ec;_vizChartPanel;_origVisualization;constructor(e){for(super(),this._ec=e;Y++,this._id=`e_${Y}`,this._ec.elementExists(this._id););let t=new HipiePipeline(this._ec,this._id);this.hipiePipeline(t),this._vizChartPanel=new Visualization(this._ec,this.hipiePipeline()).id(`viz_${Y}`).title(`Element ${Y}`),this._vizChartPanel.chartPanel().id(`cp_${Y}`),this.visualization(this._vizChartPanel),this.state(new State)}id(e){let 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(){let 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=[];let e=this.hipiePipeline();for(let t of[...e.activities(),this.mappings()])for(let e of t.validate())this._errors.push({elementID:this.id(),...e});return this._errors}_initialized=!1;refresh(){let e=this.hipiePipeline().filters().validFilters().map(e=>e.createFilterDescription());return this.visualization().chartPanel().description(e.join(`, `)),this.visualization().refresh().then(()=>{this._initialized=!0;let e=this.hipiePipeline().outData();this.visualization().chartType()===`FieldForm`?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(){let e=[];for(let 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)}};Element.prototype._class+=` Viz`,Element.prototype.publish(`hipiePipeline`,null,`widget`,`Data View`),Element.prototype.publish(`visualization`,null,`widget`,`Visualization`),Element.prototype.publish(`state`,null,`widget`,`State`),Element.prototype._origVisualization=Element.prototype.visualization,Element.prototype.visualization=function(e){let t=Element.prototype._origVisualization.apply(this,arguments);return e!==void 0&&this._visualization.on(`click`,(e,t,n,i)=>{if(i&&i.selection)this.selection(n?i.selection.map(e=>e.__lparam||e):[]);else{let t=(0,r.isArray)(e)?e:[e];this.selection(n?t.map(e=>e.__lparam||e):[])}}).on(`vertex_click`,(e,t,n)=>{let i=(0,r.isArray)(e)?e:[e];this.selection(n?i.map(e=>e.__lparam||e):[])}),t};var ElementContainer=class extends n.PropertyExt{_nullElement;_datasources=[b];_elements=[];constructor(){super(),this.clear(),this._nullElement=new Element(this)}clear(e){this._datasources=e===void 0?[b]:this._datasources,this._elements=e===void 0?[]: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=typeof e==`string`?this._elements.filter(t=>t.id()===e):e instanceof VizChartPanel?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){let t={};return e.__properties.content.map(e=>{let n=!!e.__properties.widget.__properties.chart,r=e,i=e.__properties.widget,a=n?e.__properties.widget.__properties.chart:e.__properties.widget.__properties.widget,o=e.__properties.widget.__id?e.__properties.widget.__id:e.__properties.widget.__properties.widget.__id;t[o]={id:o,package:a.__class.split(`_`)[0],object:a.__class.split(`_`)[1],cell:_get_params(r,[`chart`,`widget`,`fields`]),panel:_get_params(i,[`chart`,`widget`,`fields`]),widget:_get_params(a,[`fields`])}}),t;function _get_params(e,t){let n={};return Object.keys(e.__properties).filter(e=>t.indexOf(e)===-1).forEach(t=>n[t]=e.__properties[t]),n}}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){}};ElementContainer.prototype._class+=` dashboard_ElementContainer`,ElementContainer.prototype.publish(`samples`,10,`number`,`Number of samples`),ElementContainer.prototype.publish(`sampleSize`,100,`number`,`Sample size`);function responseText(e){if(!e.ok)throw Error(e.status+` `+e.statusText);return e.text()}function text_default(e,t){return fetch(e,t).then(responseText)}__name(text_default,`default`);var PopupManager=class extends n.Widget{_ec;_popups=[];_popupIdx={};popupPanels(){return this._popups||=[],this._popupIdx||={},this._popups}popupChartPanels(){return this.popupPanels().map(e=>e.widget())}addPopup(e){let t=this._ec.element(e),n=this.element().node(),r=new VizPopupPanel(this,t).target(n).widget(e).relativeTargetId(this.id()).size({width:e.minWidth(),height:e.minHeight()});this._popups.push(r),this._popupIdx[e.id()]={panel:r,monitorHandle:e.monitor(t=>{switch(t){case`minWidth`:case`minHeight`:r.resize({width:e.minWidth(),height:e.minHeight()}).render();break}})},this._ec.filteredBy(t.id()).forEach(e=>{e.visualization().chartPanel().popup(r)})}removePopup(e){let 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(){let e=(0,r.compare)(this.popupChartPanels(),this._ec.elements().filter(e=>e.visualization().visibility()===`flyout`).map(e=>e.visualization().chartPanel()));for(let t of e.exit)this.removePopup(t);for(let t of e.enter)this.addPopup(t);return this}vizActivation(){}},DashboardDockPanel=class extends d.DockPanel{_ec;constructor(e){super(),this._ec=e}tabTitle(e){return this.hideSingleTabs()?e.visualization().title?e.visualization().title():e.visualization().id():e.id()}titleClassed(e,t,n){let r=e.title.className.split(` `);n&&r.indexOf(t)<0?r.push(t):!n&&r.indexOf(t)>0&&(r=r.filter(e=>e!==t)),e.title.className=r.join(` `)}updateTitle(e){let t=this.getWidgetAdapter(e),n=this._ec.element(e),r=n.validate();t.title.label=this.tabTitle(n),this.titleClassed(t,`error`,r.length>0),t.title.caption=r.map(e=>`${e.source}: ${e.msg}`).join(`
2
2
  `)}activate(e){let t=this.getWidgetAdapter(e.visualization().chartPanel());t&&t.activate()}syncMinSize(e){return e.minWidth_exists()||e.minHeight_exists()?((0,n.select)(this.getWidgetAdapter(e).node).style(`min-width`,`${e.minWidth()}px`).style(`min-height`,`${e.minHeight()}px`),!0):!1}syncWidgets(){let e=(0,r.compare)(this.widgets(),this._ec.elements().filter(e=>e.visualization().visibility()===`normal`).map(e=>e.visualization().chartPanel())),t=!1;for(let t of e.exit)this.removeWidget(t);for(let n of e.enter){let e=this._ec.element(n);this.addWidget(n,this.tabTitle(e),`split-bottom`,void 0,this.hideSingleTabs()?void 0:this),t=this.syncMinSize(n)||t}for(let n of e.update)this.updateTitle(n),t=this.syncMinSize(n)||t;return t&&this.refit(),this}childActivation(e,t){super.childActivation(e,t),this.vizActivation(this._ec.element(e));for(let e of this.widgetAdapters())e===t?(e.addClass(`active`),this.titleClassed(e,`active`,!0),e.title.iconClass=`active`):(e.removeClass(`active`),this.titleClassed(e,`active`,!1),e.title.iconClass=``)}vizActivation(e){}canClose(e,t){let n=this._ec.element(e).id(),r=window.confirm(`Remove Widget "${n}"?`);return r&&(this._ec.clear(n),this.syncWidgets(),this.vizActivation(void 0)),r}syncPopups(){}};DashboardDockPanel.prototype._class+=` marshaller_DashboardDockPanel`,DashboardDockPanel.prototype.mixin(PopupManager);var DashboardGrid=class extends u.Grid{_ec;_layoutCache=[];constructor(e){super(),this._ec=e,this.designMode(!1),this.surfacePadding(`0`),this.surfaceBorderWidth(0)}updateGrid(e,t=0,n=!1){super.updateGrid(e,t,n),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){let t=ddl2_layout(e,10,10);this._layoutCache=t}else e instanceof Array&&(this._layoutCache=e);return this;function ddl2_layout(e,t,n){let r=[];return dive(e.main,0,0,t,n),r;function dive(e,t,n,i,a){e.children?e.type===`split-area`?e.orientation===`horizontal`?e.children.forEach((r,o)=>{let s=e.sizes[o]*i,c=a,l=o===0?t:t+e.sizes[0]*i,u=n;dive(e.children[o],l,u,s,c)}):e.orientation===`vertical`?e.children.forEach((r,o)=>{let s=i,c=e.sizes[o]*a,l=t,u=o===0?n:n+e.sizes[0]*a;dive(e.children[o],l,u,s,c)}):console.error(`wtf`):e.type===`tab-area`&&e.children.forEach((r,o)=>{let s=i,c=e.sizes[o]*a,l=t,u=o===0?n:n+e.sizes[0]*a;dive(e.children[o],l,u,s,c)}):r.push([t,n,i,a].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){let t=this.getWidgetCell(e.id()),n=this._ec.element(e),r=this.tabTitle(n);t.widget().title(r)}activate(e){}removeWidget(e){let t=this.getWidgetCell(e.id());this.clearContent(t)}syncMinSize(e){return e.minWidth_exists()||e.minHeight_exists()?(this.getWidgetCell(e.id()).element().style(`min-width`,`${e.minWidth()}px`).style(`min-height`,`${e.minHeight()}px`),!0):!1}syncWidgets(){let e=(0,r.compare)(this.widgets(),this._ec.elements().filter(e=>e.visualization().visibility()===`normal`).map(e=>e.visualization().chartPanel()));for(let t of e.exit)this.removeWidget(t);let t=0,n=0,i=[];for(let r of e.enter){let e=this._ec.element(r),a=this.content().length;if(this._layoutCache&&this._layoutCache[a]){let a=this._layoutCache.find(e=>e.id===r.id());if(a){let[r,i,o,s]=a.position;this.setContent(i,r,e.visualization().chartPanel(),``,s,o),r+o>t&&(t=r+o),i+s>n&&(n=i+s)}else i.push(e.visualization().chartPanel())}else i.push(e.visualization().chartPanel())}let a=this.content().reduce((e,t)=>Math.max(e,t.gridRow()+t.gridRowSpan()),0);i.forEach(e=>{this.setContent(a,0,e,``,3,3),a+=3});for(let t of e.update)this.updateTitle(t);return this}childActivation(e,t){this.vizActivation(this._ec.element(e))}postSelectionChange(){super.postSelectionChange();let e=this._selectionBag.get();e.length>0&&this.childActivation(e[0].widget.widget())}vizActivation(e){}canClose(e,t){let n=this._ec.element(e).id(),r=window.confirm(`Remove Widget "${n}"?`);return r&&(this._ec.clear(n),this.syncWidgets(),this.vizActivation(void 0)),r}syncPopups(){}};DashboardGrid.prototype._class+=` marshaller_DashboardGrid`,DashboardGrid.prototype.mixin(PopupManager);var X=(0,r.scopedLogger)(`marshaller/ddl2/ddl`),DDLDatasourceAdapter=class{_dsDedup;constructor(){}clear(){this._dsDedup={}}id(e){return e instanceof S?`${e.url()}/${e.wuid()}`:e instanceof O?`${e.url()}/${e.querySet()}/${e.queryID()}`:e instanceof T?`${e.url()}/${e.action()}`:e.id()}_resolveID(e){return this._dsDedup[this.id(e)].ds.id()}resolveID(e){if(e instanceof WUResultRef)return this._resolveID(e.datasource().wu());if(e instanceof RoxieResultRef||e instanceof HipieResultRef||e instanceof RestResultRef)return this._resolveID(e.datasource().service())}append(e){let t=e instanceof DSPicker?e.datasource():e,n=e instanceof DSPicker?e.datasourceRef():void 0,r=t.id(),i=t instanceof x?t.wu():t instanceof k||t instanceof E?t.service():t,a=this.id(i);this._dsDedup[a]||(this._dsDedup[a]={ds:i,result:{}}),this._dsDedup[a].result[r]||(this._dsDedup[a].result[r]={refType:t,ref:n})}getAll(){let e=[];for(let t in this._dsDedup){let n=this._dsDedup[t].ds.toDDL();if(n.type===`roxie`||n.type===`hipie`||n.type===`rest`){let e={};for(let n in this._dsDedup[t].result){let r=this._dsDedup[t].result[n].refType.toDDL(),i={inputs:{},outputs:{}};this._dsDedup[t].result[n].ref.referencedFields(i);for(let t in i.inputs)i.inputs[t].forEach(t=>{e[t]=r.inputs.filter(e=>e.id===t)[0]})}n.inputs=[];for(let t in e)n.inputs.push(e[t])}if(n.type===`wuresult`||n.type===`roxie`||n.type===`hipie`||n.type===`rest`){let e={};for(let n in this._dsDedup[t].result){let r=this._dsDedup[t].result[n].refType.toDDL();if(r.type===`wuresult`||r.type===`roxie`||r.type===`hipie`||r.type===`rest`)for(let t in r.outputs)e[t]=r.outputs[t]}n.outputs={};for(let t in e)n.outputs[t]=e[t]}e.push(n)}return e}},DDLAdapter=class{_dashboard;_ec;_dsWriteDedup=new DDLDatasourceAdapter;_dsReadDedup={};constructor(e){this._dashboard=e,this._ec=this._dashboard.elementContainer()}writeDatasources(){for(let 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 P.fromDDL(t,e)}writeProject(e){if(e.exists())return e.toDDL()}readProject(e){return U.fromDDL(e)}writeMappings(e){return e.exists()?e.toDDL():{type:`mappings`,transformations:[]}}readMappings(e){return W.fromDDL(e)}writeGroupBy(e){if(e.exists())return e.toDDL()}readGroupBy(e){return R.fromDDL(e)}writeSort(e){if(e.exists())return e.toDDL()}readSort(e){return K.fromDDL(e)}writeLimit(e){if(e.exists())return e.toDDL()}readLimit(e){return z.fromDDL(e)}readDatasourceRef(e,t,n){if(i.DDL2.isWUResultRef(e)){let n=this._dsReadDedup[e.id];t.datasourceID(n.output(e.output).id())}else i.DDL2.isRoxieServiceRef(e)?(t.datasourceID(`${e.id}_${e.output}`),t.datasourceRef().request(e.request.map(e=>D.fromDDL(this._ec,e)))):t.datasourceID(e.id);return this}writeActivities(e){return e.activities().map(e=>{if(e instanceof P)return this.writeFilters(e);if(e instanceof U)return this.writeProject(e);if(e instanceof R)return this.writeGroupBy(e);if(e instanceof K)return this.writeSort(e);if(e instanceof z)return this.writeLimit(e);if(e instanceof W)return this.writeMappings(e);e instanceof DSPicker||X.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){let n=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(n),this}writeViewDatasource(e){let t=e.toDDL();return t.id=this._dsWriteDedup.resolveID(e)||t.id,t}writeDDLViews(){let e={inputs:{},outputs:{}};for(let t of this._ec.elements())t.visualization().mappings().referencedFields(e);return this._ec.elements().map(e=>{let t=e.hipiePipeline(),n=t.datasource();if(n instanceof DSPicker){let r=n.datasourceRef();return{id:e.id(),datasource:this.writeViewDatasource(r),activities:this.writeActivities(t),visualization:this.writeVisualization(e.visualization())}}throw Error(`Missing DSPicker?`)})}writeProperties(){return{name:p,version:m,buildVersion:h,layout:this._dashboard.layout()}}readDDLViews(e){for(let t of e){let e=new Element(this._ec).id(t.id);this._ec.append(e);let n=e.hipiePipeline();this.readDatasourceRef(t.datasource,n.datasource(),this._ec);for(let e of t.activities){if(i.DDL2.isProjectActivity(e)){let t=this.readProject(e);n.project(t)}if(i.DDL2.isFilterActivity(e)){let t=this.readFilters(e,this._ec);n.filters(t)}if(i.DDL2.isGroupByActivity(e)){let t=this.readGroupBy(e);n.groupBy(t)}if(i.DDL2.isSortActivity(e)){let t=this.readSort(e);n.sort(t)}if(i.DDL2.isLimitActivity(e)){let t=this.readLimit(e);n.limit(t)}}this.readVisualization(t.visualization,e.visualization())}}readProperties(e){e&&e.layout&&this._dashboard.layoutObj(e.layout)}write(){return this._dsWriteDedup.clear(),{version:`2.2.1`,createdBy:{name:p,version:m},datasources:this.writeDatasources(),dataviews:this.writeDDLViews(),properties:this.writeProperties(),hipieProperties:this._dashboard.hipieProps()}}read(e){this._dsWriteDedup.clear();for(let t of e.datasources)switch(t.type){case`databomb`:this._ec.appendDatasource(y.fromDDL(t));break;case`form`:this._ec.appendDatasource(v.fromDDL(t));break;case`logicalfile`:this._ec.appendDatasource(C.fromDDL(this._ec,t));break;case`wuresult`:let e=S.fromDDL(this._ec,t);this._dsReadDedup[e.id()]=e;for(let n in t.outputs)this._ec.appendDatasource(e.output(n));break;case`roxie`:case`hipie`:let n=O.fromDDL(this._ec,t);this._dsReadDedup[n.id()]=n;for(let e in t.outputs)this._ec.appendDatasource(k.fromDDL(this._ec,n,e));break;case`rest`:let r=T.fromDDL(this._ec,t);this._dsReadDedup[r.id()]=r;for(let e in t.outputs)this._ec.appendDatasource(E.fromDDL(this._ec,r,e));break;default:X.warning(`Unknown ddl datasource type: ${t.type} `)}this.readDDLViews(e.dataviews),this.readProperties(e.properties),this._dashboard.hipieProps(e.hipieProperties)}},Imports=class{_moduleMap={};append(e){this._moduleMap[e.module]||(this._moduleMap[e.module]={}),this._moduleMap[e.module][e.class]=!0}write(){let e=[];for(let t in this._moduleMap){let n=[];for(let e in this._moduleMap[t])n.push(e);n.sort(),e.push(`import { ${n.join(`, `)} } from "${t}";`)}return e.join(`
3
3
  `)}};function createProps(e){let t={};for(let n of e.publishedProperties())if(e[n.id+`_modified`]()&&n.id!==`fields`){let r=e[n.id]();switch(n.type){case`propertyArray`:let e=r.map(createProps);e&&(t[n.id]=e);break;default:t[n.id]=r}}return t}var JavaScriptAdapter=class{_dashboard;_ec;_ddlAdapter;_ddlSchema;constructor(e){this._dashboard=e,this._ec=this._dashboard.elementContainer(),this._ddlAdapter=new DDLAdapter(this._dashboard),this._ddlSchema=this._ddlAdapter.write()}createProps(e,t,n=``){let r=[];for(let i of t.publishedProperties())if(t[i.id+`_exists`]())switch(i.type){case`string`:case`set`:r.push(`${e}.${i.id}("${t[i.id]()}")${n};`);break;case`number`:case`boolean`:r.push(`${e}.${i.id}(${t[i.id]()})${n};`);break;case`widget`:r=r.concat(this.createProps(`${e}.${i.id}()`,t[i.id]()));break;case`propertyArray`:i.ext&&r.push(`${e}.${i.id}([${t[i.id]()}])${n};`);break;default:break}return r}writeMeta(e){return``}safeID(e){return e&&e.replace(/ /g,`_`).replace(/\./g,`_`)}datasourceRefID(e){let t=e.datasource;return i.DDL2.isRoxieServiceRef(t)?`${this.safeID(t.id)}_${this.safeID(t.output)}_${this.safeID(e.id)}`:i.DDL2.isWUResultRef(t)?`${this.safeID(t.id)}_${this.safeID(t.output)}`:`${this.safeID(t.id)}`}_dedup={};writeDatasource(e){let t=e.datasource,n=[],r=this._ddlSchema.datasources.filter(e=>e.id===t.id)[0],i=t.output,a=this.datasourceRefID(e);if(!this._dedup[a])switch(this._dedup[a]=!0,r.type){case`wuresult`:let o=this.safeID(e.datasource.id);this._dedup[o]||(this._dedup[o]=!0,n.push(` export const ${o} = new marshaller.WU()
4
4
  .url("${r.url}")
@@ -96,6 +96,6 @@ export const dashboard = new marshaller.Dashboard(ec)
96
96
  const ddl = ${JSON.stringify(this._ddlSchema)};
97
97
  `}},Z=class Dashboard extends u.ChartPanel{_ec;_dockPanel;_designModeButton=new n.ToggleButton().faChar(`fa-object-group`).tooltip(`Design Mode...`).selected(!0).on(`click`,()=>{this._dockPanel instanceof DashboardGrid&&this._dockPanel.designMode(this._designModeButton.selected()).lazyRender()});_addButton=new n.Button().faChar(`fa-plus`).tooltip(`Add...`).on(`click`,()=>{let e=new Element(this._ec);this._ec.append(e),this.renderPromise().then(()=>{e.refresh().then(()=>{this.activate(e)})})});_removeButton=new n.Button().faChar(`fa-minus`).tooltip(`Remove...`).enabled(!1).on(`click`,()=>{let e=this._prevActive;e&&window.confirm(`Remove Widget "${e.id()}"?`)&&(this._ec.clear(e.id()),this.renderPromise().then(()=>{this.vizActivation(void 0)}))});_reloadButton=new n.Button().faChar(`fa-refresh`).tooltip(`Reload...`).on(`click`,()=>{let 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 n.Button().faChar(`fa-database`).tooltip(`Add Samples`).on(`click`,()=>{Promise.all([text_default(`https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/airports.csv`),text_default(`https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/carriers.csv`),text_default(`https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/stats.csv`)]).then(([e,t,n])=>{let r=this.addForm(`popup`,{type:`form`,id:`global_filter`,fields:[{type:`string`,id:`Airport`},{type:`string`,id:`Airline`}]});r.visualization().title(`Global Filter`).visibility(`flyout`).chartType(`FieldForm`);let i=this.addDatabomb(`airports`,e,`csv`,[new _().fieldID(`code`).type(`string`),new _().fieldID(`name`).type(`string`),new _().fieldID(`count`).type(`number`)],new P(this._ec).remoteFilter([new P.Filter().source(r.id()).mappings([new P.Mapping().remoteField(`Airport`).localField(`code`).nullable(!0)])]),new K().column([new K.Column().fieldID(`count`).descending(!0)]));i.chartPanel().title(`Airports`);let a=this.addDatabomb(`carriers`,t,`csv`,[new _().fieldID(`code`).type(`string`),new _().fieldID(`name`).type(`string`),new _().fieldID(`count`).type(`number`)],new P(this._ec).remoteFilter([new P.Filter().source(r.id()).mappings([new P.Mapping().remoteField(`Airline`).localField(`code`).nullable(!0)])]),new K().column([new K.Column().fieldID(`count`).descending(!0)]));a.chartPanel().title(`Airlines`);let o=this.addDatabomb(`stats`,n,`csv`,[],new P(this._ec).remoteFilter([new P.Filter().source(i.id()).mappings([new P.Mapping().remoteField(`code`).localField(`airport`)]),new P.Filter().source(a.id()).mappings([new P.Mapping().remoteField(`code`).localField(`carrier`).nullable(!0)])]));return o.chartPanel().title(`Stats`),Promise.all([r.refresh(),i.refresh(),a.refresh(),o.refresh()])}).then(()=>{this.render()})});addDatabomb(e,t,n=`csv`,r,...i){let a=new y().id(e).format(n).payload(t);r.length>0&&a.databombFields(r),this._ec.appendDatasource(a);let o=new Element(this._ec),s=o.hipiePipeline().datasource();s instanceof DSPicker&&s.datasourceID(a.id());for(let e of i)e instanceof P?o.hipiePipeline().filters(e):e instanceof U?o.hipiePipeline().project(e):e instanceof R?o.hipiePipeline().groupBy(e):e instanceof K?o.hipiePipeline().sort(e):e instanceof z&&o.hipiePipeline().limit(e);return this._ec.append(o),o}addForm(e,t){let n=new v().id(e).fromDDL(t);this._ec.appendDatasource(n);let r=new Element(this._ec),i=r.hipiePipeline().datasource();return i instanceof DSPicker&&i.datasourceID(n.id()),this._ec.append(r),r}static create(e,t){return new Promise((n,r)=>{let i=new ElementContainer,a=new Dashboard(i).target(e).hideSingleTabs(!0).titleVisible(!1).restore(t).render(e=>{i.refresh().then(()=>{n(a)})})})}constructor(e){super(),this._ec=e,this._ec.on(`vizStateChanged`,e=>{this.vizStateChanged(e)}),this.buttons([this._designModeButton,new n.Spacer,this._addButton,this._removeButton,new n.Spacer,this._reloadButton,new n.Spacer,this._addSamples]),this.ensureDockPanel(`dock`)}ensureDockPanel(e=`dock`){(e===`dock`&&!(this._dockPanel instanceof DashboardDockPanel)||e===`grid`&&!(this._dockPanel instanceof DashboardGrid))&&(this._dockPanel=(e===`dock`?new DashboardDockPanel(this._ec):new DashboardGrid(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){let t=new DDLAdapter(this);return arguments.length?(this._ec.clear(),t.read(e),this):t.write()}layoutObj(e){return this._dockPanel.layoutObj(e),this}save(){return new DDLAdapter(this).write()}serializeDDL(){return JSON.stringify(this.save())}deserializeDDL(e){return this.restore(JSON.parse(e))}restore(e,t=!1){return this.ensureDockPanel(e&&e.properties&&e.properties.layout instanceof Array?`grid`:`dock`),this._ec.clear(),new DDLAdapter(this).read(e),t&&this.renderPromise().then(()=>{this._ec.refresh()}),this}importDDL(e,t,n,r={}){let a=(0,i.isDDL2Schema)(e)?e:(0,i.upgrade)(e,t,n,!0,r);return this.restore(a,!0)}javascript(){return new JavaScriptAdapter(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 DashboardGrid).render(),this._removeButton.enabled(this._prevActive!==void 0).render()}update(e,t){this._dockPanel.syncWidgets(),super.update(e,t),this.updateButtonState()}_prevActive;vizActivation(e){this._prevActive=e,this._removeButton.enabled(e!==void 0).render()}vizStateChanged(e){}render(e){return this._dockPanel.syncPopups(),super.render(t=>{e&&e(t)})}};Z.prototype._class+=` dashboard_dashboard`;var DDLEditor=class extends d.SplitPanel{summary=`0 Errors`;_ddlEditor=new f.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{let e=this.ddl();try{let{success:t,errors:n}=(0,i.validate2)(e);t?this._errorTable.data([]):this._errorTable.data(n.map(e=>[e.instancePath,e.keyword,e.message,JSON.stringify(e.params)]))}catch{this._errorTable.data([[``,`Validation Failed`,``,``]])}}catch{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)}};DDLEditor.prototype._class+=` codemirror_DDLEditor`;var GraphAdapter=class{_ec;subgraphMap={};vertexMap={};edgeMap={};hierarchy=[];vertices=[];edges=[];constructor(e){this._ec=e}clear(){this.subgraphMap={},this.vertexMap={},this.edgeMap={},this.hierarchy=[],this.vertices=[],this.edges=[]}createSubgraph(e,t,n){let r=this.subgraphMap[e];return r||(r=new c.Subgraph().columns([`DS`]).data([[n]]),this.subgraphMap[e]=r),this.vertices.push(r),r.title(`${t}`),r.getBBox(!0),r}createVertex(e,t,n,r=``,i=`#dcf1ff`){let a=this.vertexMap[e];return a||(a=new c.Vertex().columns([`DS`]).data([[n]]).icon_diameter(0),this.vertexMap[e]=a),this.vertices.push(a),a.textbox_shape_colorFill(i).text(r?`${t}\n${r}`:`${t}`).tooltip(r),a.getBBox(!0),a}createEdge(e,t){let n=`${e}->${t}`,r=this.edgeMap[n];return r||(r=new c.Edge().sourceVertex(this.vertexMap[e]).targetVertex(this.vertexMap[t]),this.edgeMap[n]=r),this.edges.push(r),r}createDatasource(e){if(e instanceof DSPicker&&(e=e.selection().datasource()),e instanceof x){let t=`${e.url()}`,n=this.createSubgraph(t,`${t}`),r=`${e.url()}/${e.wuid()}`,i=this.createSubgraph(r,`${e.wuid()}`);this.hierarchy.push({parent:n,child:i});let a=`${r}/${e.resultName()}`,o=this.createVertex(a,e.resultName(),{activity:e});return this.hierarchy.push({parent:i,child:o}),a}else if(e instanceof C){let t=`${e.url()}`,n=this.createSubgraph(t,`${t}`),r=`${t}/${e.logicalFile()}`,i=this.createVertex(r,e.logicalFile(),{activity:e});return this.hierarchy.push({parent:n,child:i}),r}else if(e instanceof RoxieResultRef){let t=`${e.url()}`,n=this.createSubgraph(t,`${t}`),r=e.serviceID(),i=this.createSubgraph(r,e.querySet());this.hierarchy.push({parent:n,child:i});let a=r;this.hierarchy.push({parent:i,child:this.createVertex(a,e.queryID())});let o=`${r}/${e.resultName()}`;return this.hierarchy.push({parent:i,child:this.createVertex(o,e.resultName(),{activity:e})}),this.createEdge(a,o),o}else if(e instanceof k){let t=`${e.service().url()}`,n=this.createSubgraph(t,`${t}`),r=e.serviceID(),i=this.createSubgraph(r,e.service().querySet());this.hierarchy.push({parent:n,child:i});let a=`${r}/${e.service().queryID()}`,o=this.createSubgraph(a,e.service().queryID());this.hierarchy.push({parent:i,child:o});let s=`${a}/${e.resultName()}`;return this.hierarchy.push({parent:o,child:this.createVertex(s,e.resultName(),{activity:e})}),this.createEdge(a,s),s}else if(e instanceof RestResultRef){let t=`${e.url()}`,n=this.createSubgraph(t,`${t}`),r=e.serviceID(),i=this.createSubgraph(r,e.action());this.hierarchy.push({parent:n,child:i});let a=r;this.hierarchy.push({parent:i,child:this.createVertex(a,e.action())});let o=`${r}/${e.resultName()}`;return this.hierarchy.push({parent:i,child:this.createVertex(o,e.resultName(),{activity:e})}),this.createEdge(a,o),o}else if(e instanceof E){let t=`${e.service().url()}`,n=this.createSubgraph(t,`${t}`),r=e.serviceID(),i=`${t}/${e.service().action()}`,a=this.createSubgraph(r,e.service().action());this.hierarchy.push({parent:n,child:a});let o=`${i}/${e.resultName()}`;return this.hierarchy.push({parent:a,child:this.createVertex(o,e.resultName(),{activity:e})}),this.createEdge(i,o),o}else if(e instanceof v){let t=e.hash();return this.createVertex(t,e.label(),{activity:e}),t}else if(e instanceof y){let t=e.id();return this.createVertex(t,e.label(),{activity:e}),t}else{let t=e.hash();return this.createVertex(t,e.label(),{activity:e}),t}}createActivity(e,t,n,r){let i=this.createSubgraph(t.id(),`${t.id()}`,{view:t}),a=null,o=``;if(n.exists()){let e=n.validate();e.length&&(a=`pink`,o=e.map(e=>`${e.source}: ${e.msg}`).join(`
98
98
  `))}else a=`lightgrey`;let s=this.createVertex(n.id(),r||`${n.classID()}`,{view:t,activity:n},o,a);return e&&this.createEdge(e,n.id()),this.hierarchy.push({parent:i,child:s}),n.id()}createGraph(){this.hierarchy=[],this.vertices=[],this.edges=[],this._ec.elements().forEach(e=>{this.createDatasource(e.hipiePipeline().datasource())});let e={};for(let t of this._ec.elements()){let n=t.hipiePipeline(),r=this.createDatasource(n.datasource());for(let e of n.activities())r=this.createActivity(r,t,e);let i=t.visualization(),a=i.mappings(),o=this.createActivity(r,t,a,`Mappings`),s=`${i.id()}-sg`,c=this.createSubgraph(s,`Visualization`,{visualization:i});this.hierarchy.push({parent:this.subgraphMap[t.id()],child:c}),this.hierarchy.push({parent:c,child:this.vertexMap[a.id()]});let l=`${i.id()}-viz`,u=this.createVertex(l,i.chartPanel().widget().classID(),{view:t,chartPanel:i.chartPanel()});this.createEdge(o,l),this.hierarchy.push({parent:c,child:u});let d=`${i.id()}-state`,f=this.createVertex(d,`Selection`,{view:t,state:t.state()});this.createEdge(l,d).weight(10).strokeDasharray(`1,5`).text(`updates`),this.createEdge(r,d),this.hierarchy.push({parent:this.subgraphMap[t.id()],child:f}),r=d,e[n.id()]=r}for(let e of this._ec.elements()){let t=e.visualization(),n=this._ec.element(t.secondaryDataviewID());if(n){let e=n.visualization().mappings();this.createEdge(e.id(),`${t.id()}-viz`)}}for(let t of this._ec.elements()){let n=t.hipiePipeline();for(let t of n.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}}},DSTable=class extends u.ChartPanel{_ec;_addButton=new n.Button().faChar(`fa-plus`).tooltip(`Add...`).on(`click`,()=>{let e=this._addButton.element().node(),t=e.getBoundingClientRect();this._contextMenu.open({target:e,currentTarget:e,clientX:t.left,clientY:t.bottom})});_removeButton=new n.Button().faChar(`fa-minus`).tooltip(`Remove...`).enabled(!1).on(`click`,()=>{this.remove()});_cloneButton=new n.Button().faChar(`fa-clone`).tooltip(`Clone...`).enabled(!1).on(`click`,()=>{this._selectedDS2&&(this._selectedDS2 instanceof y?this.add(y.fromDDL(this._selectedDS2.toDDL(),!0)):this._selectedDS2 instanceof v?this.add(v.fromDDL(this._selectedDS2.toDDL(),!0)):this._selectedDS2 instanceof C?this.add(C.fromDDL(this._ec,this._selectedDS2.toDDL(),!0)):this._selectedDS2 instanceof E?this.add(new E(this._ec).service(T.fromDDL(this._ec,this._selectedDS2.service().toDDL(),!0)).resultName(this._selectedDS2.resultName())):this._selectedDS2 instanceof x?this.add(new x(this._ec).wu(S.fromDDL(this._ec,this._selectedDS2.wu().toDDL(),!0)).resultName(this._selectedDS2.resultName())):this._selectedDS2 instanceof k?this.add(new k(this._ec).service(O.fromDDL(this._ec,this._selectedDS2.service().toDDL(),!0)).resultName(this._selectedDS2.resultName())):console.warn(`Unknown datasoure type`))});_addSamples=new n.Button().faChar(`fa-database`).tooltip(`Add Samples`).on(`click`,()=>{text_default(`https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/airports.csv`).then(e=>{this.add(new y().format(`csv`).payload(e))}),text_default(`https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/carriers.csv`).then(e=>{this.add(new y().format(`csv`).payload(e))}),text_default(`https://raw.githubusercontent.com/hpcc-systems/Visualization/candidate-2.x.x/utils/data/data/stats.csv`).then(e=>{this.add(new y().format(`csv`).payload(e))}),this.add(new E(this._ec).service(new T(this._ec).url(`https://cmsapi.pulselive.com/`).action(`rugby/rankings/mru`).requestFields([new w().fieldID(`xxx`),new w().fieldID(`date`)])).resultName(`entries`)),this.add(new x(this._ec).wu(new S(this._ec).url(`http://localhost:8010`).wuid(`W20190802-112509`)).resultName(`Result 1`)),this.add(new C(this._ec).url(`http://localhost:8010`).logicalFile(`progguide::exampledata::peopleaccts`)),this.add(new C(this._ec).url(`http://localhost:8010`).logicalFile(`progguide::exampledata::people`));let e=new O(this._ec).url(`http://localhost:8002`).querySet(`roxie`).queryID(`peopleaccounts`);this.add(new k(this._ec).service(e).resultName(`Accounts`)),this.add(new v().formFields([new _().type(`number`).fieldID(`id`).value(8),new _().fieldID(`first_name`).value(`John`),new _().fieldID(`last_name`).value(`Doe`),new _().fieldID(`gender`).default(`M`),new _().type(`number`).fieldID(`age`)])),this.render()});_dstable=new o.Table;_selectedDS;_selectedDS2;_contextMenu;constructor(e){super(),this._ec=e,this.buttons([this._addButton,this._removeButton,new n.Spacer,this._cloneButton,new n.Spacer,this._addSamples]).widget(this._dstable).columns([`ID`,`Type`,`References`]).on(`click`,(e,t,n)=>{this._selectedDS2=e.__lparam,n&&e.References===0&&e.ID!==`Empty`?this._selectedDS=e.__lparam:delete this._selectedDS,this._removeButton.enabled(this._selectedDS!==void 0).render(),this._cloneButton.enabled(this._selectedDS2!==void 0).render()}),this.initMenu()}initMenu(){let e=new d.CommandRegistry;e.addCommand(`add_wu_result`,{label:`Workunit Result`,execute:()=>{this.add(new x(this._ec))}}),e.addCommand(`add_logicalfile`,{label:`Logical File`,execute:()=>{this.add(new C(this._ec))}}),e.addCommand(`add_roxie`,{label:`Roxie Service`,execute:()=>{this.add(new k(this._ec))}}),e.addCommand(`add_rest`,{label:`Rest`,execute:()=>{this.add(new E(this._ec))}}),e.addCommand(`add_databomb`,{label:`Databomb`,execute:()=>{this.add(new y)}}),e.addCommand(`add_form`,{label:`Form`,execute:()=>{this.add(new v)}}),this._contextMenu=new d.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){let t={};this._ec.elements().forEach(e=>{let n=e.hipiePipeline().datasource();n instanceof DSPicker&&(n=n.datasource()),t[n.id()]===void 0&&(t[n.id()]=0),t[n.id()]++});let n=this._ec.datasources().filter(e=>e.id()!==`Empty`).map(e=>(t[e.id()]===void 0&&(t[e.id()]=0),[e.id(),e.classID(),t[e.id()]||0,e])),r=JSON.stringify(t);return this._prevDataID!==r&&(this._prevDataID=r,this.data(n)),super.render(e)}},DVTable=class extends u.ChartPanel{_ec;_dvtable=new o.Table;constructor(e){super(),this._ec=e,this.titleVisible(!1).widget(this._dvtable).columns([`ID`,`Title`])}_prevDataID;render(e){let t=this._ec.elements().map(e=>[e.id(),e.visualization().title(),e]),n=(0,r.hashSum)(t.map(e=>e[0]));return this._prevDataID!==n&&(this._prevDataID=n,this.data(t)),super.render(e)}},PipelineSelectionButton=class extends n.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=>{let t=e.source.split(`.`);return t.splice(0,1),`${t.join(`.`)}: ${e.msg}`}).join(`
99
- `)):this.tooltip(this._label),this.render(),this):this._elementErrors}},PipelinePanel=class extends u.ChartPanel{_owner;datasource=new PipelineSelectionButton().faChar(`fa-database`).label(`Datasource`).selected(!0);filter=new PipelineSelectionButton().faChar(`fa-filter`).label(`Filter`);project=new PipelineSelectionButton().faChar(`fa-random`).label(`Project`);groupBy=new PipelineSelectionButton().faChar(`fa-object-group`).label(`Group By`);sort=new PipelineSelectionButton().faChar(`fa-sort-alpha-asc`).label(`Sort`);limit=new PipelineSelectionButton().faChar(`fa-list-ol`).label(`Limit`);mappings=new PipelineSelectionButton().faChar(`fa-random`).label(`Mappings`);chartPanel=new PipelineSelectionButton().faChar(`fa-area-chart`).label(`Visualization`);state=new PipelineSelectionButton().faChar(`fa-check-square-o`).label(`State`);debug=new PipelineSelectionButton().faChar(`fa-bug`).label(`Debug`);all=new PipelineSelectionButton().faChar(`fa-list`).label(`All`);_propEditor=new ee.PropertyEditor().show_header(!1).show_settings(!1).showFields(!1);_buttons=[this.datasource,this.filter,this.project,this.groupBy,this.sort,this.limit,new n.Spacer,this.mappings,this.chartPanel,new n.Spacer,this.state,this.debug,new n.Spacer,this.all];_pipelineButton=this.datasource;_pipelineSelection=new n.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,n,r)=>{r!==this._propEditor&&(this.propChanged(e,t,n,r),this.updateState())})}selectionButtons(){return this._pipelineSelection.buttons().filter(e=>e instanceof PipelineSelectionButton)}_propExt;propExt(e){return arguments.length?(this._propExt=e,this):this._propExt}peAsDatasource(){if(this._propExt instanceof Datasource||this._propExt instanceof DSPicker)return this._propExt;if(this._propExt instanceof Element)return this._propExt.hipiePipeline().datasource()}peAsFilter(){if(this._propExt instanceof P)return this._propExt;if(this._propExt instanceof Element)return this._propExt.hipiePipeline().filters()}peAsProject(){if(this._propExt instanceof U)return this._propExt;if(this._propExt instanceof Element)return this._propExt.hipiePipeline().project()}peAsGroupBy(){if(this._propExt instanceof R)return this._propExt;if(this._propExt instanceof Element)return this._propExt.hipiePipeline().groupBy()}peAsSort(){if(this._propExt instanceof K)return this._propExt;if(this._propExt instanceof Element)return this._propExt.hipiePipeline().sort()}peAsLimit(){if(this._propExt instanceof z)return this._propExt;if(this._propExt instanceof Element)return this._propExt.hipiePipeline().limit()}peAsMappings(){if(this._propExt instanceof W)return this._propExt;if(this._propExt instanceof Element)return this._propExt.visualization().mappings();if(this._propExt instanceof Visualization)return this._propExt.mappings()}peAsChartPanel(){if(this._propExt instanceof u.ChartPanel||this._propExt instanceof Visualization)return this._propExt;if(this._propExt instanceof Element)return this._propExt.visualization()}peAsState(){if(this._propExt instanceof State)return this._propExt;if(this._propExt instanceof Element)return this._propExt.state()}selectionButton(){if(this._pipelineButton&&this._pipelineButton.enabled())return this._pipelineButton;for(let e of this.selectionButtons())if(e.enabled())return e.selected(!0),e}_prevPropExt;_prevPipelineButton;update(e,t){super.update(e,t),this.updateState();let n=this.selectionButton();if(this._prevPropExt!==this._propExt||this._prevPipelineButton!==n){if(this._prevPropExt=this._propExt,this._prevPipelineButton=n,this._propExt&&n)switch(n){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);break}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 PipelineSelectionButton&&this.disableActivities().indexOf(e.label())>=0){this.updateButtonState(void 0,e);return}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:let t=this.peAsChartPanel();e.enabled(!!t);break;case this.state:let n=this.peAsState();e.enabled(!!n);break;case this.debug:e.enabled(!1);break;case this.all:e.enabled(!!this._propExt);break}e.selected()&&this.title(e.enabled()?e.label():``)})}propChanged(e,t,n,r){}};PipelinePanel.prototype._class+=` marshaller_PipelinePanel`;var DDLPreview$1=class extends u.ChartPanel{static{__name(this,`DDLPreview`)}_save=new n.Button().faChar(`fa-save`).tooltip(`Save`).on(`click`,()=>{let e=this.activity();e&&e.fromDDL&&e.fromDDL(this._jsonEditor.json()),this.updateToolbar()});_reset=new n.Button().faChar(`fa-undo`).tooltip(`Reset`).on(`click`,()=>{this._jsonEditor.text(this.jsonText()).lazyRender(),this.updateToolbar()});_jsonEditor=new f.JSONEditor().on(`changes`,e=>{this.updateToolbar()});constructor(){super(),this._titleBar.buttons([this._save,this._reset]),this.widget(this._jsonEditor)}_activity;activity(e){return e===void 0?this._activity:(this._activity!==e&&(this._activity=e,delete this._prevJson),this)}jsonText(){let e=this.activity();return e&&e.toDDL?JSON.stringify(e.toDDL(),void 0,4):``}_prevJson;update(e,t){super.update(e,t);let n=this.jsonText(),r=this._jsonEditor.text();(this._prevJson===void 0||this._prevJson===r)&&this._prevJson!==n&&(this._prevJson=n,this._jsonEditor.text(n)),this.updateToolbar()}updateToolbar(){let e=this.activity(),t=this.jsonText(),n=this._jsonEditor.text();this._save.enabled(e&&e.fromDDL&&t!==n).lazyRender(),this._reset.enabled(t!==n).lazyRender()}},PipelineSplitPanel=class extends d.SplitPanel{_rhsPropsPanel=new PipelinePanel(this).on(`propChanged`,(e,t,n,r)=>{this.propChanged(e,t,n,r)});_previewPanel=new d.TabPanel;_rhsDDLPreview=new DDLPreview$1;_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 Visualization?e.mappings():e,this._rhsDataPreview.datasource(new DatasourceAdapt(e instanceof Activity?e:void 0)).lazyRender(),this._rhsDDLPreview.activity(e).lazyRender()}refreshPreview(){let e=this._rhsDataPreview.datasource();e?e.exec().then(()=>{this._rhsDataPreview.invalidate().lazyRender(),this._rhsDDLPreview.lazyRender()}):this._rhsDDLPreview.lazyRender()}propChanged(e,t,n,r){}};PipelinePanel.prototype.publish(`disableActivities`,[],`array`,`Disabled pipeline items`),PipelineSplitPanel.prototype.publishProxy(`disableActivities`,`_rhsPropsPanel`);var Q=(0,r.scopedLogger)(`marshaller/dashy`),DDLPreview=class extends u.ChartPanel{_dashy;_save=new n.Button().faChar(`fa-save`).tooltip(`Save`).on(`click`,()=>{let e=JSON.parse(this._jsonEditor.text());this._dashy.importDDL(e),this.updateToolbar()});_reset=new n.Button().faChar(`fa-undo`).tooltip(`Reset`).on(`click`,()=>{this._jsonEditor.text(this._ddl).lazyRender(),this.updateToolbar()});_jsonEditor=new f.JSONEditor().on(`changes`,e=>{this.updateToolbar()});constructor(e){super(),this._dashy=e,this._titleBar.buttons([this._save,this._reset]),this.widget(this._jsonEditor)}_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(){let e=this._jsonEditor.text();this._save.enabled(this._ddl!==e).lazyRender(),this._reset.enabled(this._ddl!==e).lazyRender()}},$=class Dashy extends d.SplitPanel{_elementContainer=new ElementContainer;_lhsSheet=new d.TabPanel;_lhsDashboard=new Z(this._elementContainer).on(`vizActivation`,(e,t)=>{this.focus(this._lhsDashboard,e)}).on(`vizStateChanged`,e=>{for(let t of this._elementContainer.filteredBy(e.id()))this.focus()===t&&this._rhsSplitView.refreshPreview()});_lhsDataviews=new DVTable(this._elementContainer).on(`click`,(e,t,n,r)=>{this.focus(this._lhsDataviews,e.__lparam),this._rhsSplitView.refreshPreview()});_lhsDatasources=new DSTable(this._elementContainer).on(`click`,(e,t,n,r)=>{this.focus(this._lhsDatasources,e.__lparam),this._rhsSplitView.refreshPreview()});_graphAdapter=new GraphAdapter(this._elementContainer);_lhsPipeline=new c.Graph().layout(`Hierarchy`).allowDragging(!1).applyScaleOnLayout(!0).on(`vertex_click`,(e,t,n,r)=>{let i=e.__lparam[0]||{};this.focus(this._lhsPipeline,i.state||i.chartPanel||i.visualization||i.activity||i.view)}).on(`vertex_contextmenu`,(e,t,n,r)=>{});_lhsDebugSheet=new d.TabPanel;_lhsDebugDDLEditor=new DDLPreview(this);_lhsDebugDDLSchema=new f.JSONEditor().json(i.ddl2Schema);_lhsDebugJSEditor=new f.JSEditor;_lhsDebugCloneEC=new ElementContainer;_lhsDebugClone=new Z(this._lhsDebugCloneEC).hideSingleTabs(!0).titleVisible(!1);_lhsDebugDDLv1=new f.JSONEditor;_lhsDebugDDLv2=new f.JSONEditor;_rhsSplitView=new PipelineSplitPanel;_fileOpen;static create(e,t,n,r){return new Promise((i,a)=>{let o=new Dashy().target(e).render(e=>{t?e.importDDL(t,n,r).then(()=>{i(o)}):i(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(()=>{let e=this._elementContainer.elements();return e.length&&this._lhsDashboard.activate(e[0]),this._elementContainer.refresh()}).then(()=>{let e=!1;for(let t of this._elementContainer.validate())e=!0,Q.warning(t.elementID+` (`+t.source+`): `+t.msg);e&&this._lhsDashboard.renderPromise()})))}importDDL(e,t,n,r={}){let a=(0,i.isDDL2Schema)(e)?e:(0,i.upgrade)(e,t,n,!0,r),o=this.restore(a);return(0,i.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(){let e=this.focus();return e instanceof Element?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(){let e=this.save();this._lhsDebugCloneEC.clear(),this._lhsDebugClone.renderPromise().then(()=>{this._lhsDebugClone.restore(e),this._lhsDebugClone.renderPromise().then(()=>this._lhsDebugCloneEC.refresh()).then(()=>{for(let e of this._lhsDebugCloneEC.validate())Q.warning(e.elementID+` (`+e.source+`): `+e.msg)})})}initMenu(){let e=new d.CommandRegistry;e.addCommand(`dash_add`,{label:`Add View`,execute:()=>{let e=new Element(this._elementContainer);this._elementContainer.append(e),this.loadDashboard().then(()=>{e.refresh().then(()=>{this._lhsDashboard.activate(e)})})}}),e.addCommand(`dash_clear`,{label:`Clear`,execute:()=>{this.clear()}}),e.addCommand(`dash_save`,{label:`Save`,execute:()=>{let e=JSON.stringify(this.save(),null,` `);n.Utility.downloadString(`JSON`,e,`dashy`)}}),e.addCommand(`dash_load`,{label:`Open`,execute:()=>{this._fileOpen.property(`accept`,`.dashy,.json`),this._fileOpen.node().click()}});let t=new d.CommandPalette({commands:e});t.addItem({command:`addWUResult`,category:`Notebook`}),t.addItem({command:`addView`,category:`Notebook`}),t.addItem({command:`remove`,category:`Notebook`}),t.id=`palette`;let r=new d.ContextMenu({commands:e});r.addItem({command:`dash_add`,selector:`#${this._lhsDashboard.id()}`}),r.addItem({command:`dash_clear`,selector:`#${this._lhsDashboard.id()}`}),r.addItem({type:`separator`,selector:`#${this._lhsDashboard.id()}`}),r.addItem({command:`dash_load`,selector:`#${this.id()}`}),r.addItem({command:`dash_save`,selector:`#${this.id()}`}),document.addEventListener(`contextmenu`,e=>{r.open(e)&&e.preventDefault()})}addDatabomb(e,t,n){let r=new y().id(e).format(n).payload(t);this._elementContainer.appendDatasource(r);let i=new Element(this._elementContainer),a=i.hipiePipeline().datasource();a instanceof DSPicker&&a.datasourceID(r.id()),this._elementContainer.append(i),this.loadDashboard().then(()=>{i.refresh().then(()=>{this._lhsDashboard.activate(i)})})}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:this.loadRHSSplit();break;case this._lhsDatasources:this.loadRHSSplit();break;case this._lhsDashboard:this.loadRHSSplit();break;case this._lhsPipeline:this.loadRHSSplit(),this.loadGraph();break;case this._lhsDebugSheet:this._lhsDebugSheet.childActivation(this._lhsDebugSheet.active());break}}),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();break}}),this.initMenu(),this._rhsSplitView.on(`propChanged`,(e,t,n,r)=>{let i=this.focusAsElement();switch(i?i.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();break}});let n=this;this._fileOpen=t.append(`input`).attr(`type`,`file`).property(`accept`,`.dashy,.json`).style(`display`,`none`).on(`change`,function(){let e=this.files[0];for(;e;){let t=new FileReader;t.onload=(function(e){return function(e){try{let t=Array.isArray(e.target.result)?e.target.result[0]:e.target.result,r=JSON.parse(t);n.importDDL(r)}catch(e){alert(`ex when trying to parse json = `+e)}}})(e),t.readAsText(e);break}})}update(e,t){super.update(e,t)}};$.prototype._class+=` composite_Dashy`,$.prototype.publishProxy(`disableActivities`,`_rhsSplitView`),e.Activity=Activity,e.ActivityArray=ActivityArray,e.ActivityPipeline=ActivityPipeline,e.ActivitySelection=ActivitySelection,e.AggregateField=L,e.BUILD_VERSION=h,e.ColumnMapping=j,e.ComputedField=V,e.ComputedMapping=B,e.DDLAdapter=DDLAdapter,e.DDLEditor=DDLEditor,e.DSPicker=DSPicker,e.Dashboard=Z,e.Dashy=$,e.Databomb=y,e.Datasource=Datasource,e.DatasourceAdapt=DatasourceAdapt,e.DatasourceRef=DatasourceRef,e.ESPResult=ESPResult,e.Element=Element,e.ElementContainer=ElementContainer,e.Filters=P,e.Form=v,e.FormField=_,e.GraphAdapter=GraphAdapter,e.GroupBy=R,e.GroupByColumn=F,e.HipiePipeline=HipiePipeline,e.HipieResultRef=HipieResultRef,e.JavaScriptAdapter=JavaScriptAdapter,e.Limit=z,e.LogicalFile=C,e.Mappings=W,e.MultiField=H,e.NullView=NullView,e.PKG_NAME=p,e.PKG_VERSION=m,e.Project=U,e.ProjectBase=ProjectBase,e.RemoteFilter=M,e.RoxieResult=k,e.RoxieResultRef=RoxieResultRef,e.RoxieService=O,e.Sort=K,e.SortColumn=G,e.State=State,e.StaticFilter=N,e.Visualization=Visualization,e.VizChartPanel=VizChartPanel,e.VizPopupPanel=VizPopupPanel,e.VizTypeSet=J,e.WU=S,e.WUResult=x,e.WUResultRef=WUResultRef,e.createProps=createProps,e.emptyDatabomb=b,Object.defineProperty(e,"hookSend",{enumerable:!0,get:function(){return t.hookSend}}),e.rowToFields=rowToFields,e.schemaRow2IField=schemaRow2IField,e.schemaType2IFieldType=schemaType2IFieldType,e.stringify=stringify,e.wsEclSchemaRow2IField=wsEclSchemaRow2IField});
99
+ `)):this.tooltip(this._label),this.render(),this):this._elementErrors}},PipelinePanel=class extends u.ChartPanel{_owner;datasource=new PipelineSelectionButton().faChar(`fa-database`).label(`Datasource`).selected(!0);filter=new PipelineSelectionButton().faChar(`fa-filter`).label(`Filter`);project=new PipelineSelectionButton().faChar(`fa-random`).label(`Project`);groupBy=new PipelineSelectionButton().faChar(`fa-object-group`).label(`Group By`);sort=new PipelineSelectionButton().faChar(`fa-sort-alpha-asc`).label(`Sort`);limit=new PipelineSelectionButton().faChar(`fa-list-ol`).label(`Limit`);mappings=new PipelineSelectionButton().faChar(`fa-random`).label(`Mappings`);chartPanel=new PipelineSelectionButton().faChar(`fa-area-chart`).label(`Visualization`);state=new PipelineSelectionButton().faChar(`fa-check-square-o`).label(`State`);debug=new PipelineSelectionButton().faChar(`fa-bug`).label(`Debug`);all=new PipelineSelectionButton().faChar(`fa-list`).label(`All`);_propEditor=new ee.PropertyEditor().show_header(!1).show_settings(!1).showFields(!1);_buttons=[this.datasource,this.filter,this.project,this.groupBy,this.sort,this.limit,new n.Spacer,this.mappings,this.chartPanel,new n.Spacer,this.state,this.debug,new n.Spacer,this.all];_pipelineButton=this.datasource;_pipelineSelection=new n.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,n,r)=>{r!==this._propEditor&&(this.propChanged(e,t,n,r),this.updateState())})}selectionButtons(){return this._pipelineSelection.buttons().filter(e=>e instanceof PipelineSelectionButton)}_propExt;propExt(e){return arguments.length?(this._propExt=e,this):this._propExt}peAsDatasource(){if(this._propExt instanceof Datasource||this._propExt instanceof DSPicker)return this._propExt;if(this._propExt instanceof Element)return this._propExt.hipiePipeline().datasource()}peAsFilter(){if(this._propExt instanceof P)return this._propExt;if(this._propExt instanceof Element)return this._propExt.hipiePipeline().filters()}peAsProject(){if(this._propExt instanceof U)return this._propExt;if(this._propExt instanceof Element)return this._propExt.hipiePipeline().project()}peAsGroupBy(){if(this._propExt instanceof R)return this._propExt;if(this._propExt instanceof Element)return this._propExt.hipiePipeline().groupBy()}peAsSort(){if(this._propExt instanceof K)return this._propExt;if(this._propExt instanceof Element)return this._propExt.hipiePipeline().sort()}peAsLimit(){if(this._propExt instanceof z)return this._propExt;if(this._propExt instanceof Element)return this._propExt.hipiePipeline().limit()}peAsMappings(){if(this._propExt instanceof W)return this._propExt;if(this._propExt instanceof Element)return this._propExt.visualization().mappings();if(this._propExt instanceof Visualization)return this._propExt.mappings()}peAsChartPanel(){if(this._propExt instanceof u.ChartPanel||this._propExt instanceof Visualization)return this._propExt;if(this._propExt instanceof Element)return this._propExt.visualization()}peAsState(){if(this._propExt instanceof State)return this._propExt;if(this._propExt instanceof Element)return this._propExt.state()}selectionButton(){if(this._pipelineButton&&this._pipelineButton.enabled())return this._pipelineButton;for(let e of this.selectionButtons())if(e.enabled())return e.selected(!0),e}_prevPropExt;_prevPipelineButton;update(e,t){super.update(e,t),this.updateState();let n=this.selectionButton();if(this._prevPropExt!==this._propExt||this._prevPipelineButton!==n){if(this._prevPropExt=this._propExt,this._prevPipelineButton=n,this._propExt&&n)switch(n){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);break}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 PipelineSelectionButton&&this.disableActivities().indexOf(e.label())>=0){this.updateButtonState(void 0,e);return}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:let t=this.peAsChartPanel();e.enabled(!!t);break;case this.state:let n=this.peAsState();e.enabled(!!n);break;case this.debug:e.enabled(!1);break;case this.all:e.enabled(!!this._propExt);break}e.selected()&&this.title(e.enabled()?e.label():``)})}propChanged(e,t,n,r){}};PipelinePanel.prototype._class+=` marshaller_PipelinePanel`;var DDLPreview$1=class extends u.ChartPanel{static{__name(this,`DDLPreview`)}_save=new n.Button().faChar(`fa-save`).tooltip(`Save`).on(`click`,()=>{let e=this.activity();e&&e.fromDDL&&e.fromDDL(this._jsonEditor.json()),this.updateToolbar()});_reset=new n.Button().faChar(`fa-undo`).tooltip(`Reset`).on(`click`,()=>{this._jsonEditor.text(this.jsonText()).lazyRender(),this.updateToolbar()});_jsonEditor=new f.JSONEditor().on(`changes`,e=>{this.updateToolbar()});constructor(){super(),this._titleBar.buttons([this._save,this._reset]),this.widget(this._jsonEditor)}_activity;activity(e){return e===void 0?this._activity:(this._activity!==e&&(this._activity=e,delete this._prevJson),this)}jsonText(){let e=this.activity();return e&&e.toDDL?JSON.stringify(e.toDDL(),void 0,4):``}_prevJson;update(e,t){super.update(e,t);let n=this.jsonText(),r=this._jsonEditor.text();(this._prevJson===void 0||this._prevJson===r)&&this._prevJson!==n&&(this._prevJson=n,this._jsonEditor.text(n)),this.updateToolbar()}updateToolbar(){let e=this.activity(),t=this.jsonText(),n=this._jsonEditor.text();this._save.enabled(e&&e.fromDDL&&t!==n).lazyRender(),this._reset.enabled(t!==n).lazyRender()}},PipelineSplitPanel=class extends d.SplitPanel{_rhsPropsPanel=new PipelinePanel(this).on(`propChanged`,(e,t,n,r)=>{this.propChanged(e,t,n,r)});_previewPanel=new d.TabPanel;_rhsDDLPreview=new DDLPreview$1;_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 Visualization?e.mappings():e,this._rhsDataPreview.datasource(new DatasourceAdapt(e instanceof Activity?e:void 0)).lazyRender(),this._rhsDDLPreview.activity(e).lazyRender()}refreshPreview(){let e=this._rhsDataPreview.datasource();e?e.exec().then(()=>{this._rhsDataPreview.invalidate().lazyRender(),this._rhsDDLPreview.lazyRender()}):this._rhsDDLPreview.lazyRender()}propChanged(e,t,n,r){}};PipelinePanel.prototype.publish(`disableActivities`,[],`array`,`Disabled pipeline items`),PipelineSplitPanel.prototype.publishProxy(`disableActivities`,`_rhsPropsPanel`);var Q=(0,r.scopedLogger)(`marshaller/dashy`),DDLPreview=class extends u.ChartPanel{_dashy;_save=new n.Button().faChar(`fa-save`).tooltip(`Save`).on(`click`,()=>{let e=JSON.parse(this._jsonEditor.text());this._dashy.importDDL(e),this.updateToolbar()});_reset=new n.Button().faChar(`fa-undo`).tooltip(`Reset`).on(`click`,()=>{this._jsonEditor.text(this._ddl).lazyRender(),this.updateToolbar()});_jsonEditor=new f.JSONEditor().on(`changes`,e=>{this.updateToolbar()});constructor(e){super(),this._dashy=e,this._titleBar.buttons([this._save,this._reset]),this.widget(this._jsonEditor)}_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(){let e=this._jsonEditor.text();this._save.enabled(this._ddl!==e).lazyRender(),this._reset.enabled(this._ddl!==e).lazyRender()}},$=class Dashy extends d.SplitPanel{_elementContainer=new ElementContainer;_lhsSheet=new d.TabPanel;_lhsDashboard=new Z(this._elementContainer).on(`vizActivation`,(e,t)=>{this.focus(this._lhsDashboard,e)}).on(`vizStateChanged`,e=>{for(let t of this._elementContainer.filteredBy(e.id()))this.focus()===t&&this._rhsSplitView.refreshPreview()});_lhsDataviews=new DVTable(this._elementContainer).on(`click`,(e,t,n,r)=>{this.focus(this._lhsDataviews,e.__lparam),this._rhsSplitView.refreshPreview()});_lhsDatasources=new DSTable(this._elementContainer).on(`click`,(e,t,n,r)=>{this.focus(this._lhsDatasources,e.__lparam),this._rhsSplitView.refreshPreview()});_graphAdapter=new GraphAdapter(this._elementContainer);_lhsPipeline=new c.Graph().layout(`Hierarchy`).allowDragging(!1).applyScaleOnLayout(!0).on(`vertex_click`,(e,t,n,r)=>{let i=e.__lparam[0]||{};this.focus(this._lhsPipeline,i.state||i.chartPanel||i.visualization||i.activity||i.view)}).on(`vertex_contextmenu`,(e,t,n,r)=>{});_lhsDebugSheet=new d.TabPanel;_lhsDebugDDLEditor=new DDLPreview(this);_lhsDebugDDLSchema=new f.JSONEditor().json(i.ddl2Schema);_lhsDebugJSEditor=new f.JSEditor;_lhsDebugCloneEC=new ElementContainer;_lhsDebugClone=new Z(this._lhsDebugCloneEC).hideSingleTabs(!0).titleVisible(!1);_lhsDebugDDLv1=new f.JSONEditor;_lhsDebugDDLv2=new f.JSONEditor;_rhsSplitView=new PipelineSplitPanel;_fileOpen;static create(e,t,n,r){return new Promise((i,a)=>{let o=new Dashy().target(e).render(e=>{t?e.importDDL(t,n,r).then(()=>{i(o)}):i(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(()=>{let e=this._elementContainer.elements();return e.length&&this._lhsDashboard.activate(e[0]),this._elementContainer.refresh()}).then(()=>{let e=!1;for(let t of this._elementContainer.validate())e=!0,Q.warning(t.elementID+` (`+t.source+`): `+t.msg);e&&this._lhsDashboard.renderPromise()})))}importDDL(e,t,n,r={}){let a=(0,i.isDDL2Schema)(e)?e:(0,i.upgrade)(e,t,n,!0,r),o=this.restore(a);return(0,i.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(){let e=this.focus();return e instanceof Element?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(){let e=this.save();this._lhsDebugCloneEC.clear(),this._lhsDebugClone.renderPromise().then(()=>{this._lhsDebugClone.restore(e),this._lhsDebugClone.renderPromise().then(()=>this._lhsDebugCloneEC.refresh()).then(()=>{for(let e of this._lhsDebugCloneEC.validate())Q.warning(e.elementID+` (`+e.source+`): `+e.msg)})})}initMenu(){let e=new d.CommandRegistry;e.addCommand(`dash_add`,{label:`Add View`,execute:()=>{let e=new Element(this._elementContainer);this._elementContainer.append(e),this.loadDashboard().then(()=>{e.refresh().then(()=>{this._lhsDashboard.activate(e)})})}}),e.addCommand(`dash_clear`,{label:`Clear`,execute:()=>{this.clear()}}),e.addCommand(`dash_save`,{label:`Save`,execute:()=>{let e=JSON.stringify(this.save(),null,` `);n.Utility.downloadString(`JSON`,e,`dashy`)}}),e.addCommand(`dash_load`,{label:`Open`,execute:()=>{this._fileOpen.property(`accept`,`.dashy,.json`),this._fileOpen.node().click()}});let t=new d.CommandPalette({commands:e});t.addItem({command:`addWUResult`,category:`Notebook`}),t.addItem({command:`addView`,category:`Notebook`}),t.addItem({command:`remove`,category:`Notebook`}),t.id=`palette`;let r=new d.ContextMenu({commands:e});r.addItem({command:`dash_add`,selector:`#${this._lhsDashboard.id()}`}),r.addItem({command:`dash_clear`,selector:`#${this._lhsDashboard.id()}`}),r.addItem({type:`separator`,selector:`#${this._lhsDashboard.id()}`}),r.addItem({command:`dash_load`,selector:`#${this.id()}`}),r.addItem({command:`dash_save`,selector:`#${this.id()}`}),document.addEventListener(`contextmenu`,e=>{r.open(e)&&e.preventDefault()})}addDatabomb(e,t,n){let r=new y().id(e).format(n).payload(t);this._elementContainer.appendDatasource(r);let i=new Element(this._elementContainer),a=i.hipiePipeline().datasource();a instanceof DSPicker&&a.datasourceID(r.id()),this._elementContainer.append(i),this.loadDashboard().then(()=>{i.refresh().then(()=>{this._lhsDashboard.activate(i)})})}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:this.loadRHSSplit();break;case this._lhsDatasources:this.loadRHSSplit();break;case this._lhsDashboard:this.loadRHSSplit();break;case this._lhsPipeline:this.loadRHSSplit(),this.loadGraph();break;case this._lhsDebugSheet:let e=this._lhsDebugSheet.active(),t=this._lhsDebugSheet.getWidgetAdapter(e);this._lhsDebugSheet.childActivation(e,t);break}}),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();break}}),this.initMenu(),this._rhsSplitView.on(`propChanged`,(e,t,n,r)=>{let i=this.focusAsElement();switch(i?i.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();break}});let n=this;this._fileOpen=t.append(`input`).attr(`type`,`file`).property(`accept`,`.dashy,.json`).style(`display`,`none`).on(`change`,function(){let e=this.files[0];for(;e;){let t=new FileReader;t.onload=(function(e){return function(e){try{let t=Array.isArray(e.target.result)?e.target.result[0]:e.target.result,r=JSON.parse(t);n.importDDL(r)}catch(e){alert(`ex when trying to parse json = `+e)}}})(e),t.readAsText(e);break}})}update(e,t){super.update(e,t)}};$.prototype._class+=` composite_Dashy`,$.prototype.publishProxy(`disableActivities`,`_rhsSplitView`),e.Activity=Activity,e.ActivityArray=ActivityArray,e.ActivityPipeline=ActivityPipeline,e.ActivitySelection=ActivitySelection,e.AggregateField=L,e.BUILD_VERSION=h,e.ColumnMapping=j,e.ComputedField=V,e.ComputedMapping=B,e.DDLAdapter=DDLAdapter,e.DDLEditor=DDLEditor,e.DSPicker=DSPicker,e.Dashboard=Z,e.Dashy=$,e.Databomb=y,e.Datasource=Datasource,e.DatasourceAdapt=DatasourceAdapt,e.DatasourceRef=DatasourceRef,e.ESPResult=ESPResult,e.Element=Element,e.ElementContainer=ElementContainer,e.Filters=P,e.Form=v,e.FormField=_,e.GraphAdapter=GraphAdapter,e.GroupBy=R,e.GroupByColumn=F,e.HipiePipeline=HipiePipeline,e.HipieResultRef=HipieResultRef,e.JavaScriptAdapter=JavaScriptAdapter,e.Limit=z,e.LogicalFile=C,e.Mappings=W,e.MultiField=H,e.NullView=NullView,e.PKG_NAME=p,e.PKG_VERSION=m,e.Project=U,e.ProjectBase=ProjectBase,e.RemoteFilter=M,e.RoxieResult=k,e.RoxieResultRef=RoxieResultRef,e.RoxieService=O,e.Sort=K,e.SortColumn=G,e.State=State,e.StaticFilter=N,e.Visualization=Visualization,e.VizChartPanel=VizChartPanel,e.VizPopupPanel=VizPopupPanel,e.VizTypeSet=J,e.WU=S,e.WUResult=x,e.WUResultRef=WUResultRef,e.createProps=createProps,e.emptyDatabomb=b,Object.defineProperty(e,"hookSend",{enumerable:!0,get:function(){return t.hookSend}}),e.rowToFields=rowToFields,e.schemaRow2IField=schemaRow2IField,e.schemaType2IFieldType=schemaType2IFieldType,e.stringify=stringify,e.wsEclSchemaRow2IField=wsEclSchemaRow2IField});
100
100
  //# sourceMappingURL=index.umd.cjs.map
101
101
  (function(){try{if(typeof document<`u`){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:linear-gradient(#ff000080 0%,#fff 100%)}.common_SelectionButton.error{background:linear-gradient(#ff000080 0%,#fff0 80%)}body{margin:8px;padding:0;overflow:hidden}#placeholderXXX{width:100%;height:100vh}.graph_Graph .graphVertex>.subgraph .title rect{fill:#dcf1ff;border-bottom-width:0}.graph_Graph .graphVertex>.subgraph .title text{fill:#000}.graph_Graph .graphVertex>.subgraph rect{fill:none}.graph_Graph .graphVertex>.subgraph.selected rect,.graph_Graph .graphVertex .graph_Vertex.selected .common_Shape{stroke:red!important}.graph_Graph .common_Surface .common_Menu{visibility:hidden}.lm-MenuBar{color:#000000de;background:#fafafa;border-bottom:1px solid #ddd;padding-left:5px;font:13px Helvetica,Arial,sans-serif}.lm-MenuBar-menu{transform:translateY(-1px)}.lm-MenuBar-item{border-left:1px solid #0000;border-right:1px solid #0000;padding:4px 8px}.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 silver;border-right:1px solid silver;box-shadow:0 0 6px #0003}.lm-Menu{color:#000000de;background:#fff;border:1px solid silver;padding:3px 0;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{height:9px;padding:0}.lm-Menu-item[data-type=separator]>div:after{content:"";border-top:1px solid #ddd;display:block;position:relative;top:4px}.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{background:#f5f5f5;font-family:sans-serif}.lm-CommandPalette-search{padding:8px}.lm-CommandPalette-wrapper{background:#fff;border:1px solid #e0e0e0;padding:4px 6px}.lm-CommandPalette-input{border:none;outline:none;width:100%;font-size:16px}.lm-CommandPalette-header{color:#757575;cursor:pointer;background:#e1e1e1;padding:4px;font-size:12px;font-weight:600}.lm-CommandPalette-header:hover:before{content:"…";float:right;margin-right:4px}.lm-CommandPalette-header>mark{background-color:#0000;font-weight:700}.lm-CommandPalette-item{color:#757575;padding:4px 8px;font-size:13px;font-weight:500}.lm-CommandPalette-emptyMessage{color:#757575;text-align:center;padding:4px;font-size:12px;font-weight:600}.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:#0000;font-weight:700}.lm-CommandPalette-item.lm-mod-disabled mark{color:#0006}.lm-CommandPalette-itemCaption{color:#9e9e9e;font-size:11px;font-weight:400}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();