@platforma-sdk/model 1.25.0 → 1.26.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.
- package/dist/components/PlDataTable.d.ts +4 -4
- package/dist/components/PlDataTable.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +868 -591
- package/dist/index.mjs.map +1 -1
- package/dist/render/api.d.ts +54 -21
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/internal.d.ts +4 -3
- package/dist/render/internal.d.ts.map +1 -1
- package/dist/render/util/axis_filtering.d.ts +14 -0
- package/dist/render/util/axis_filtering.d.ts.map +1 -0
- package/dist/render/util/index.d.ts +1 -0
- package/dist/render/util/index.d.ts.map +1 -1
- package/dist/render/util/pcolumn_data.d.ts +11 -1
- package/dist/render/util/pcolumn_data.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/PlDataTable.ts +6 -5
- package/src/render/api.ts +349 -160
- package/src/render/internal.ts +4 -2
- package/src/render/util/axis_filtering.ts +120 -0
- package/src/render/util/index.ts +1 -0
- package/src/render/util/pcolumn_data.ts +191 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxisSpec, JoinEntry, PColumn, PColumnIdAndSpec, PColumnSpec, PColumnValues, PTableHandle, PTableRecordFilter, PTableSorting } from '@milaboratories/pl-model-common';
|
|
1
|
+
import { AxisSpec, DataInfo, JoinEntry, PColumn, PColumnIdAndSpec, PColumnSpec, PColumnValues, PTableHandle, PTableRecordFilter, PTableSorting } from '@milaboratories/pl-model-common';
|
|
2
2
|
import { RenderCtx, TreeNodeAccessor } from '../render';
|
|
3
3
|
/** Data table state */
|
|
4
4
|
export type PlDataTableGridState = {
|
|
@@ -257,10 +257,10 @@ export type CreatePlDataTableOps = {
|
|
|
257
257
|
* @param tableState table ui state
|
|
258
258
|
* @returns
|
|
259
259
|
*/
|
|
260
|
-
export declare function createPlDataTable<A, U>(ctx: RenderCtx<A, U>, columns: PColumn<TreeNodeAccessor | PColumnValues
|
|
261
|
-
export declare function createPlDataTable<A, U>(ctx: RenderCtx<A, U>, columns: PColumn<TreeNodeAccessor | PColumnValues
|
|
260
|
+
export declare function createPlDataTable<A, U>(ctx: RenderCtx<A, U>, columns: PColumn<TreeNodeAccessor | PColumnValues | DataInfo<TreeNodeAccessor>>[], tableState: PlDataTableState | undefined): PTableHandle | undefined;
|
|
261
|
+
export declare function createPlDataTable<A, U>(ctx: RenderCtx<A, U>, columns: PColumn<TreeNodeAccessor | PColumnValues | DataInfo<TreeNodeAccessor>>[], tableState: PlDataTableState | undefined, ops: CreatePlDataTableOps): PTableHandle | undefined;
|
|
262
262
|
/** @deprecated use method with extended ops as the last argument */
|
|
263
|
-
export declare function createPlDataTable<A, U>(ctx: RenderCtx<A, U>, columns: PColumn<TreeNodeAccessor | PColumnValues
|
|
263
|
+
export declare function createPlDataTable<A, U>(ctx: RenderCtx<A, U>, columns: PColumn<TreeNodeAccessor | PColumnValues | DataInfo<TreeNodeAccessor>>[], tableState: PlDataTableState | undefined, filters: PTableRecordFilter[]): PTableHandle | undefined;
|
|
264
264
|
/** Create sheet entries for PlDataTable */
|
|
265
265
|
export declare function createPlDataTableSheet<A, U>(ctx: RenderCtx<A, U>, axis: AxisSpec, values: (string | number)[]): PlDataTableSheet;
|
|
266
266
|
//# sourceMappingURL=PlDataTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlDataTable.d.ts","sourceRoot":"","sources":["../../src/components/PlDataTable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,aAAa,EAEb,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACd,MAAM,iCAAiC,CAAC;AAMzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,gBAAgB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,GAC5B,YAAY,GAAG,SAAS,CAAC;AA6F5B,2CAA2C;AAC3C,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,CAAC,EACzC,GAAG,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAC1B,gBAAgB,CAUlB"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Oe=Object.defineProperty;var Le=(t,e,n)=>e in t?Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var T=(t,e,n)=>Le(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@milaboratories/pl-model-common"),E=require("zod");class ue extends Error{constructor(e,n){super(`${e.length}${n?"+":""} errors, first error: `+e[0]),this.errors=e,this.moreErrors=n}}function ce(t){if(!t.ok)throw new ue(t.errors,t.moreErrors);return t.value}function Fe(t){return new Proxy(t,{get(e,n){return ce(e[n])}})}function v(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null?N(t):t}function k(t){return{type:"GetFromCtx",variable:t}}function De(t){return{type:"Isolate",cfg:t}}const Ee=k("$args"),ke=k("$it"),je=k("$prod"),Ve=k("$staging"),Ne=k("$ui");function N(t){return{type:"Immediate",value:t}}function re(t){const e={};for(const[n,s]of Object.entries(t))e[n]=v(s);return{type:"MakeObject",template:e}}function Ue(...t){const e=[];for(const n of t)e.push(v(n));return{type:"MakeArray",template:e}}function B(t,e){return{type:"GetJsonField",source:v(t),field:v(e)}}function Be(t,e,n="$it"){return{type:"MapRecordValues",source:t,mapping:e,itVar:n}}function Me(t,e,n="$it"){return{type:"MapArrayValues",source:t,mapping:e,itVar:n}}function Je(t){return{type:"Flatten",source:t}}function $e(t){return{type:"IsEmpty",arg:t}}function Ge(t){return{type:"Not",operand:t}}function We(t,e){return{type:"And",operand1:t,operand2:e}}function Ke(t,e){return{type:"Or",operand1:t,operand2:e}}function He(t,e){return{type:"GetResourceField",source:v(t),field:v(e)}}function ze(){return function(t){return{type:"GetResourceValueAsJson",source:v(t)}}}function qe(t,e,n="$it"){return{type:"MapResourceFields",source:t,mapping:e,itVar:n}}function Ye(t){return{type:"GetBlobContent",source:v(t)}}function Xe(t){return{type:"GetBlobContentAsString",source:v(t)}}function Qe(){return function(t){return{type:"GetBlobContentAsJson",source:v(t)}}}function Ze(t){return{type:"GetDownloadedBlobContent",source:v(t)}}function et(t){return{type:"GetOnDemandBlobContent",source:v(t)}}function tt(t,e){return{type:"ExtractArchiveAndGetURL",format:e,source:v(t)}}function nt(t){return{type:"GetImportProgress",source:v(t)}}function st(t,e){return{type:"GetLastLogs",source:v(t),lines:e}}function it(t,e){return{type:"GetProgressLog",source:v(t),patternToSearch:e}}function rt(t,e){return{type:"GetProgressLogWithInfo",source:v(t),patternToSearch:e}}function ot(t){return{type:"GetLogHandle",source:v(t)}}function at(){return typeof globalThis.getPlatforma<"u"||typeof globalThis.platforma<"u"}function de(t){if(t&&typeof globalThis.getPlatforma=="function")return globalThis.getPlatforma(t);if(typeof globalThis.platforma<"u")return globalThis.platforma;throw new Error("Can't get platforma instance.")}function lt(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx}function m(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx;throw new Error("Not in config rendering context")}function $(t,e){const n=lt();if(n===void 0)return!1;if(t in n.callbackRegistry)throw new Error(`Callback with key ${t} already registered.`);return n.callbackRegistry[t]=e,!0}const Z=new Map;function ut(t,e){t in m().callbackRegistry||(m().callbackRegistry[t]=n=>{for(const s of Z.get(t))s(n)},Z.set(t,[])),Z.get(t).push(e)}class I{constructor(e,n=s=>s){T(this,"isResolved",!1);T(this,"resolvedValue");this.handle=e,this.postProcess=n,ut(e,s=>{this.resolvedValue=n(s),this.isResolved=!0})}map(e){return new I(this.handle,n=>e(this.postProcess(n)))}mapDefined(e){return new I(this.handle,n=>{const s=this.postProcess(n);return s?e(s):void 0})}toJSON(){return this.isResolved?this.resolvedValue:{__awaited_futures__:[this.handle]}}}function z(t,e){return t===void 0?void 0:e(t)}class S{constructor(e,n){this.handle=e,this.resolvePath=n}resolve(...e){const n=e.map(s=>({assertFieldType:"Input",...typeof s=="string"?{field:s}:s}));return this.resolveWithCommon({},...n)}resolveOutput(...e){const n=e.map(s=>({assertFieldType:"Output",...typeof s=="string"?{field:s}:s}));return this.resolveWithCommon({},...n)}resolveInput(...e){const n=e.map(s=>({assertFieldType:"Input",...typeof s=="string"?{field:s}:s}));return this.resolveWithCommon({},...n)}resolveAny(...e){return this.resolveWithCommon({},...e)}resolveWithCommon(e,...n){const s=[...this.resolvePath,...n.map(i=>typeof i=="string"?i:i.field)];return z(m().resolveWithCommon(this.handle,e,...n),i=>new S(i,s))}get resourceType(){return m().getResourceType(this.handle)}getInputsLocked(){return m().getInputsLocked(this.handle)}getOutputsLocked(){return m().getOutputsLocked(this.handle)}getIsReadyOrError(){return m().getIsReadyOrError(this.handle)}getIsFinal(){return m().getIsFinal(this.handle)}getError(){const e=[...this.resolvePath,"error"];return z(m().getError(this.handle),n=>new S(n,e))}listInputFields(){return m().listInputFields(this.handle)}listOutputFields(){return m().listOutputFields(this.handle)}listDynamicFields(){return m().listDynamicFields(this.handle)}getKeyValueBase64(e){return m().getKeyValueBase64(this.handle,e)}getKeyValueAsString(e){return m().getKeyValueAsString(this.handle,e)}getKeyValueAsJson(e){const n=this.getKeyValueAsString(e);if(n==null)throw new Error("Resource has no content.");return JSON.parse(n)}getDataBase64(){return m().getDataBase64(this.handle)}getDataAsString(){return m().getDataAsString(this.handle)}getDataAsJson(){const e=this.getDataAsString();if(e==null)throw new Error("Resource has no content.");return JSON.parse(e)}getPColumns(e=!1,n=""){const s=this.parsePObjectCollection(e,n);return s===void 0?void 0:Object.entries(s).map(([,r])=>{if(!l.isPColumn(r))throw new Error(`not a PColumn (kind = ${r.spec.kind})`);return r})}parsePObjectCollection(e=!1,n=""){const s=m().parsePObjectCollection(this.handle,e,n,...this.resolvePath);if(s===void 0)return;const i={};for(const[r,o]of Object.entries(s)){const c=[...this.resolvePath,r];i[r]=l.mapPObjectData(o,d=>new S(d,c))}return i}getFileContentAsBase64(){return new I(m().getBlobContentAsBase64(this.handle))}getFileContentAsString(){return new I(m().getBlobContentAsString(this.handle))}getFileContentAsJson(){return new I(m().getBlobContentAsString(this.handle)).mapDefined(e=>JSON.parse(e))}getBlobContentAsBase64(){return this.getFileContentAsBase64()}getBlobContentAsString(){return this.getFileContentAsString()}getFileHandle(){return new I(m().getDownloadedBlobContentHandle(this.handle))}getDownloadedBlobHandle(){return this.getFileHandle()}getRemoteFileHandle(){return new I(m().getOnDemandBlobContentHandle(this.handle))}getOnDemandBlobHandle(){return this.getRemoteFileHandle()}extractArchiveAndGetURL(e){return new I(m().extractArchiveAndGetURL(this.handle,e))}getImportProgress(){return new I(m().getImportProgress(this.handle))}getLastLogs(e){return new I(m().getLastLogs(this.handle,e))}getProgressLog(e){return new I(m().getProgressLog(this.handle,e))}getProgressLogWithInfo(e){return new I(m().getProgressLogWithInfo(this.handle,e))}getLogHandle(){return new I(m().getLogHandle(this.handle))}allFieldsResolved(e="Input"){switch(e){case"Input":return this.getInputsLocked()&&this.listInputFields().every(n=>this.resolve({field:n,assertFieldType:"Input"})!==void 0);case"Output":return this.getOutputsLocked()&&this.listOutputFields().every(n=>this.resolve({field:n,assertFieldType:"Output"})!==void 0)}}mapFields(e,n){const{fieldType:s,requireLocked:i,skipUnresolved:r}={fieldType:"Input",requireLocked:!0,skipUnresolved:!1,...n},o=e;if(i&&(s==="Input"&&!this.getInputsLocked()||s==="Output"&&!this.getOutputsLocked()))return;let d=(s==="Input"?this.listInputFields():s==="Output"?this.listOutputFields():this.listDynamicFields()).map(a=>[a,this.resolve({field:a,assertFieldType:s})]);return r&&(d=d.filter(a=>a[1]!==void 0)),d.map(([a,g])=>o(a,g))}}const pe="staging",fe="main",ct={inlineColumnsSupport:!0,activeArgs:!0};function he(t){return typeof t=="object"&&t!==null&&"__awaited_futures__"in t}function te(t,e,n){if(e.has(n))return;if(e.add(n),typeof n==="object")if(he(n))n.__awaited_futures__.forEach(i=>t.add(i));else if(Array.isArray(n))for(const i of n)te(t,e,i);else for(const[,i]of Object.entries(n))i!==n&&te(t,e,i)}function dt(t){const e=new Set;return te(e,new Set,t),e}const pt=Object.freeze(Object.defineProperty({__proto__:null,GlobalCfgRenderCtxFeatureFlags:ct,MainAccessorName:fe,StagingAccessorName:pe,getAllFutureAwaits:dt,isFutureAwait:he},Symbol.toStringTag,{value:"Module"})),ge="pl7.app/label",me="pl7.app/trace",ye=E.z.object({type:E.z.string(),importance:E.z.number().optional(),id:E.z.string().optional(),label:E.z.string()}),be=E.z.array(ye),ft=.001,ht="__LABEL__",oe="__LABEL__@1";function G(t,e,n={}){const s=new Map,i=new Map,r=t.map(u=>{var O,J;const h=e(u);let f,b,_;"spec"in h&&typeof h.spec=="object"?(f=h.spec,b=h.prefixTrace,_=h.suffixTrace):f=h;const P=(O=f.annotations)==null?void 0:O[ge],A=(J=f.annotations)==null?void 0:J[me],y=(A?be.safeParse(JSON.parse(A)).data:void 0)??[],C=[...b??[],...y,..._??[]];if(P){const R={label:P,type:ht,importance:-2};n.addLabelAsSuffix?C.push(R):C.splice(0,0,R)}const L=[],x=new Map;for(let R=C.length-1;R>=0;--R){const{type:F}=C[R],X=C[R].importance??0,Q=(x.get(F)??0)+1;x.set(F,Q);const j=`${F}@${Q}`;i.set(j,(i.get(j)??0)+1),s.set(j,Math.max(s.get(j)??Number.NEGATIVE_INFINITY,X-(C.length-R)*ft)),L.push({...C[R],fullType:j,occurenceIndex:Q})}return L.reverse(),{value:u,spec:f,label:P,fullTrace:L}}),o=[],c=[],d=[...s];d.sort(([,u],[,h])=>h-u);for(const[u]of d)u.endsWith("@1")||i.get(u)===t.length?o.push(u):c.push(u);const a=u=>r.map(h=>{const f=h.fullTrace.filter(_=>u.has(_.fullType)).map(_=>_.label),b=n.separator??" / ";return{label:f.join(b),value:h.value}});if(o.length===0){if(c.length!==0)throw new Error("Assertion error.");return a(new Set(oe))}let g=0,p=0;for(;g<o.length;){const u=new Set;n.includeNativeLabel&&u.add(oe);for(let f=0;f<g;++f)u.add(o[f]);u.add(o[p]);const h=a(u);if(new Set(h.map(f=>f.label)).size===t.length)return h;p++,p==o.length&&(g++,p=g)}return a(new Set([...o,...c]))}const M="PColumnData/",q=M+"ResourceMap",Y=M+"Partitioned/ResourceMap",ne=M+"JsonPartitioned",W=M+"BinaryPartitioned",ve=M+"Partitioned/",se=ve+"JsonPartitioned",K=ve+"BinaryPartitioned";function Ae(t,e,n,s=[],i){if(t===void 0)return!1;switch(t.resourceType.name){case q:{let r=t.getInputsLocked();for(const o of t.listInputFields()){const c=t.resolve({field:o,assertFieldType:"Input"}),d=[...s,...JSON.parse(o)],a=c===void 0?void 0:e(c);a===void 0&&(r=!1),(a!==void 0||i)&&n.push({key:d,value:a})}return r}case Y:{let r=t.getInputsLocked();for(const o of t.listInputFields()){const c=t.resolve({field:o,assertFieldType:"Input"});if(c===void 0)r=!1;else{const d=[...s,...JSON.parse(o)],a=Ae(c,e,n,d,i);r=r&&a}}return r}default:throw new Error(`Unknown resource type: ${t.resourceType.name}`)}}function gt(t,e,n=!1){const s=[];return{isComplete:Ae(t,e,s,[],n),data:s}}const ae=t=>{if(!t.endsWith(".index")){if(t.endsWith(".values"))return t.substring(0,t.length-7);throw Error(`key must ends on .index/.values for binary p-column, got: ${t}`)}};function _e(t){if(!t)return;const e=t.resourceType.name,n=t.getDataAsJson(),s=[];let i=0;switch(e){case q:i=n.keyLength;break;case Y:i=n.partitionKeyLength+n.keyLength;break;case ne:case W:i=n.partitionKeyLength;break;case K:case se:i=n.superPartitionKeyLength+n.partitionKeyLength;break}switch(e){case q:case ne:case W:for(let r of t.listInputFields()){if(e===W){const c=ae(r);if(c)r=c;else continue}const o=[...JSON.parse(r)];s.push(o)}break;case Y:case K:case se:for(const r of t.listInputFields()){const o=[...JSON.parse(r)],c=t.resolve({field:r,assertFieldType:"Input"});if(c!==void 0)for(let d of c.listInputFields()){if(e===K){const g=ae(d);if(g)d=g;else continue}const a=[...o,...JSON.parse(d)];s.push(a)}}break}return{data:s,keyLength:i}}function Ie(t){const e=_e(t);if(!e)return;const{data:n,keyLength:s}=e,i=[];for(let r=0;r<s;++r)i.push(new Set);for(const r of n){if(r.length!==s)throw new Error("key length does not match partition length");for(let o=0;o<s;++o)i[o].add(r[o])}return i.map(r=>Array.from(r.values()))}function ee(t,e){if(t===void 0)return e===void 0;if(e===void 0)return!0;for(const n in e)if(t[n]!==e[n])return!1;return!0}class Pe{constructor(){T(this,"ctx",m());T(this,"defaultLabelFn",(e,n)=>{var s;return((s=e.annotations)==null?void 0:s["pl7.app/label"])??"Unlabelled"})}calculateOptions(e){return this.ctx.calculateOptions(e)}getOptions(e,n){const s=typeof e=="function"?e:l.selectorsToPredicate(e),i=this.getSpecs().entries.filter(r=>s(r.obj));return typeof n=="object"||typeof n>"u"?G(i,r=>r.obj,n??{}).map(({value:{ref:r},label:o})=>({ref:r,label:o})):i.map(r=>({ref:r.ref,label:n(r.obj,r.ref)}))}getCanonicalOptions(e,n,s){const i={};if(!(e instanceof l.AnchoredIdDeriver))for(const[a,g]of Object.entries(e))if(l.isPlRef(g)){const p=this.getPColumnSpecByRef(g);if(!p)return;i[a]=p}else i[a]=g;const r=typeof n=="function"?n:l.selectorsToPredicate(Array.isArray(n)?n.map(a=>l.resolveAnchors(i,a)):l.resolveAnchors(i,n)),o=this.getSpecs().entries.filter(({obj:a})=>l.isPColumnSpec(a)?r(a):!1);if(o.length===0)return[];const c=e instanceof l.AnchoredIdDeriver?e:new l.AnchoredIdDeriver(i),d=typeof n=="object"&&!Array.isArray(n)&&"axes"in n&&n.axes!==void 0&&n.partialAxesMatch===void 0?n.axes.map((a,g)=>"split"in a&&a.split===!0?g:-1).filter(a=>a!==-1):[];if(d.sort((a,g)=>a-g),d.length>0){const a=[],g=d[d.length-1];for(const{ref:u,obj:h}of o){if(!l.isPColumnSpec(h))continue;const f=this.getDataByRef(u);if(!f||!l.isPColumn(f))continue;const b=Ie(f.data);if(!b)continue;if(g>=b.length)throw new Error(`Not enough partition keys for the requested split axes in column ${h.name}`);const _=d.map(y=>this.findLabels(l.getAxisId(h.axesSpec[y]))),P=[],A=(y,C)=>{if(C>=d.length){P.push([...y]);return}const L=d[C],x=b[L];for(const O of x)y.push(O),A(y,C+1),y.pop()};A([],0);for(const y of P){const C=y.map((x,O)=>{const J=d[O],R=l.canonicalizeAxisId(l.getAxisId(h.axesSpec[J])),F=_[O],X=(F==null?void 0:F[x])??String(x);return{type:`split:${R}`,label:X,importance:1e6}}),L=d.map((x,O)=>[x,y[O]]);a.push({obj:h,ref:u,filteringTrace:C,filters:L})}}return G(a,u=>({spec:u.obj,suffixTrace:u.filteringTrace}),s??{}).map(u=>({value:c.deriveS(u.value.obj,u.value.filters),label:u.label}))}return G(o,a=>a.obj,s??{}).map(({value:{obj:a},label:g})=>({value:c.deriveS(a),label:g}))}getDataFromResultPool(){return this.getData()}getData(){const e=this.ctx.getDataFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:new S(n.obj.data,[n.ref.blockId,n.ref.name])}}))}}getDataWithErrorsFromResultPool(){return this.getDataWithErrors()}getDataWithErrors(){const e=this.ctx.getDataWithErrorsFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:l.mapValueInVOE(n.obj.data,s=>new S(s,[n.ref.blockId,n.ref.name]))}}))}}getSpecsFromResultPool(){return this.getSpecs()}getSpecs(){return this.ctx.getSpecsFromResultPool()}getDataByRef(e){var n;return typeof this.ctx.getDataFromResultPoolByRef>"u"?(n=this.getData().entries.find(s=>s.ref.blockId===e.blockId&&s.ref.name===e.name))==null?void 0:n.obj:l.mapPObjectData(this.ctx.getDataFromResultPoolByRef(e.blockId,e.name),s=>new S(s,[e.blockId,e.name]))}getPColumnByRef(e){const n=this.getDataByRef(e);if(n)return l.ensurePColumn(n)}getPColumnSpecByRef(e){const n=this.getSpecByRef(e);if(n){if(!l.isPColumnSpec(n))throw new Error(`not a PColumn spec (kind = ${n.kind})`);return n}}getSpecByRef(e){return this.ctx.getSpecFromResultPoolByRef(e.blockId,e.name)}findDataWithCompatibleSpec(e){const n=[];e:for(const s of this.getData().entries){if(!l.isPColumnSpec(s.obj.spec))continue;const i=s.obj.spec;if(e.name===i.name&&e.valueType===i.valueType&&e.axesSpec.length===i.axesSpec.length&&ee(e.domain,i.domain)){for(let r=0;r<e.axesSpec.length;++r){const o=e.axesSpec[r],c=i.axesSpec[r];if(o.name!==c.name||o.type!==c.type||!ee(o.domain,c.domain))continue e}n.push(s.obj)}}return n}findLabels(e){const n=this.getData();for(const s of n.entries){if(!l.isPColumn(s.obj))continue;const i=s.obj.spec;if(i.name==="pl7.app/label"&&i.axesSpec.length===1&&i.axesSpec[0].name===e.name&&i.axesSpec[0].type===e.type&&ee(e.domain,i.axesSpec[0].domain)){if(s.obj.data.resourceType.name!=="PColumnData/Json")throw Error(`Expected JSON column for labels, got: ${s.obj.data.resourceType.name}`);return Object.fromEntries(Object.entries(s.obj.data.getDataAsJson().data).map(o=>[JSON.parse(o[0])[0],o[1]]))}}}}class V{constructor(){T(this,"ctx");T(this,"args");T(this,"uiState");T(this,"_activeArgsCache");T(this,"resultPool",new Pe);this.ctx=m(),this.args=JSON.parse(this.ctx.args),this.uiState=this.ctx.uiState!==void 0?JSON.parse(this.ctx.uiState):{}}get activeArgs(){return this._activeArgsCache===void 0&&(this._activeArgsCache={v:this.ctx.activeArgs?JSON.parse(this.ctx.activeArgs):void 0}),this._activeArgsCache.v}getNamedAccessor(e){return z(this.ctx.getAccessorHandleByName(e),n=>new S(n,[e]))}get prerun(){return this.getNamedAccessor(pe)}get outputs(){return this.getNamedAccessor(fe)}findLabels(e){return this.resultPool.findLabels(e)}verifyInlineColumnsSupport(e){var i;const n=e.some(r=>!(r.data instanceof S)),s=((i=this.ctx.featureFlags)==null?void 0:i.inlineColumnsSupport)===!0;if(n&&!s)throw Error("inline columns not supported")}createPFrame(e){return this.verifyInlineColumnsSupport(e),this.ctx.createPFrame(e.map(n=>l.mapPObjectData(n,s=>s instanceof S?s.handle:s)))}createPTable(e){let n;return"columns"in e?n={src:{type:"full",entries:e.columns.map(s=>({type:"column",column:s}))},filters:e.filters??[],sorting:e.sorting??[]}:n=e,this.verifyInlineColumnsSupport(l.extractAllColumns(n.src)),this.ctx.createPTable(l.mapPTableDef(n,s=>l.mapPObjectData(s,i=>i instanceof S?i.handle:i)))}getBlockLabel(e){return this.ctx.getBlockLabel(e)}getCurrentUnstableMarker(){if(!(typeof this.ctx.getCurrentUnstableMarker>"u"))return this.ctx.getCurrentUnstableMarker()}}const U="1.25.0";function Se(t){return t.__renderLambda===!0}function H(t){if(t!==void 0)return Se(t)?t.handle:t}function D(t){if(t!==void 0)return typeof t=="string"?{__renderLambda:!0,handle:t,retentive:!1}:t}function mt(t){if(t.v3!==void 0){const{initialArgs:e,initialUiState:n,inputsValid:s,outputs:i,renderingMode:r,sdkVersion:o,sections:c,title:d}=t.v3,{code:a}=t;return{initialArgs:e,initialUiState:n,inputsValid:s,outputs:i,renderingMode:r,sdkVersion:o,sections:c,title:d,code:a}}else if(t.inputsValid!==void 0){const{sdkVersion:e,renderingMode:n,outputs:s,inputsValid:i,sections:r,initialArgs:o,code:c}=t,d=Object.keys(t);if(e===void 0||n===void 0||s===void 0||i===void 0||r===void 0||o===void 0)throw new Error(`Malformed config v2. SDK version ${e}; Fields = ${d.join(", ")}`);return{sdkVersion:e,renderingMode:n,initialArgs:o,outputs:Object.fromEntries(Object.entries(s).map(([a,g])=>[a,D(g)])),inputsValid:D(i),sections:D(r),initialUiState:void 0,code:c}}else if(t.renderingMode!==void 0){const{sdkVersion:e,canRun:n,renderingMode:s,outputs:i,sections:r,initialArgs:o,code:c}=t,d=Object.keys(t);if(s===void 0||i===void 0||n===void 0||r===void 0||o===void 0)throw new Error(`Malformed config v1. SDK version ${e}; Fields = ${d.join(", ")}`);return{sdkVersion:e??"unknown",renderingMode:s,initialArgs:o,outputs:Object.fromEntries(Object.entries(i).map(([a,g])=>[a,D(g)])),inputsValid:D(n),sections:D(r),initialUiState:void 0,code:c}}else{const{sdkVersion:e}=t,n=Object.keys(t);throw new Error(`Config format not supported: SDK = ${e}; Fields = ${n.join(", ")}`)}}class w{constructor(e,n,s,i,r,o,c){this._renderingMode=e,this._initialArgs=n,this._initialUiState=s,this._outputs=i,this._inputsValid=r,this._sections=o,this._title=c}static create(e="Heavy"){return new w(e,void 0,{},{},N(!0),N([]),void 0)}output(e,n,s={}){if(typeof n=="function"){const i=`output#${e}`;return $(i,()=>n(new V)),new w(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:{__renderLambda:!0,handle:i,...s}},this._inputsValid,this._sections,this._title)}else return new w(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:n},this._inputsValid,this._sections,this._title)}retentiveOutput(e,n){return this.output(e,n,{retentive:!0})}argsValid(e){return typeof e=="function"?($("inputsValid",()=>e(new V)),new w(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,{__renderLambda:!0,handle:"inputsValid"},this._sections,this._title)):new w(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,e,this._sections,this._title)}sections(e){return Array.isArray(e)?this.sections(N(e)):typeof e=="function"?($("sections",()=>e(new V)),new w(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,{__renderLambda:!0,handle:"sections"},this._title)):new w(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,e,this._title)}title(e){return $("title",()=>e(new V)),new w(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,{__renderLambda:!0,handle:"title"})}initialArgs(e){return new w(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title)}withArgs(e){return new w(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title)}withUiState(e){return new w(this._renderingMode,this._initialArgs,e,this._outputs,this._inputsValid,this._sections,this._title)}done(){if(this._initialArgs===void 0)throw new Error("Initial arguments not set.");const e={v3:{sdkVersion:U,renderingMode:this._renderingMode,initialArgs:this._initialArgs,initialUiState:this._initialUiState,inputsValid:this._inputsValid,sections:this._sections,title:this._title,outputs:this._outputs},sdkVersion:U,renderingMode:this._renderingMode,initialArgs:this._initialArgs,inputsValid:H(this._inputsValid),sections:H(this._sections),outputs:Object.fromEntries(Object.entries(this._outputs).map(([n,s])=>[n,H(s)]))};return at()?de({sdkVersion:U}):{config:e}}}function yt(t,e,n,s){var a,g;Array.isArray(s)&&(s={filters:s});const i=t.resultPool.getData().entries.map(p=>p.obj).filter(l.isPColumn).filter(p=>p.spec.name==="pl7.app/label"&&p.spec.axesSpec.length===1),r=(p,u)=>{let h=p.toString();if(u)for(const f in u)h+=f,h+=u[f];return h},o=new Map;for(const p of e)for(const u of p.spec.axesSpec){const h=l.getAxisId(u);for(const f of i){const b=f.spec.axesSpec[0],_=l.getAxisId(f.spec.axesSpec[0]);if(l.matchAxisId(h,_)){const P=Object.keys(h.domain??{}).length,A=Object.keys(_.domain??{}).length;if(P>A){const y=r(f.id,h.domain);o.set(y,{id:y,spec:{...f.spec,axesSpec:[{...h,annotations:b.annotations}]},data:f.data})}else o.set(r(f.id),f)}}}if([...e,...o.values()].some(p=>p.data instanceof S&&!p.data.getIsReadyOrError()))return;let c=e;const d=[];if(s!=null&&s.coreColumnPredicate){c=[];for(const p of e)s.coreColumnPredicate(p.spec)?c.push(p):d.push(p)}return d.push(...o.values()),t.createPTable({src:{type:"outer",primary:{type:(s==null?void 0:s.coreJoinType)??"full",entries:c.map(p=>({type:"column",column:p}))},secondary:d.map(p=>({type:"column",column:p}))},filters:[...(s==null?void 0:s.filters)??[],...((a=n==null?void 0:n.pTableParams)==null?void 0:a.filters)??[]],sorting:((g=n==null?void 0:n.pTableParams)==null?void 0:g.sorting)??[]})}function bt(t,e,n){const s=t.findLabels(e);return{axis:e,options:n.map(i=>({value:i,label:(s==null?void 0:s[i])??i.toString()})),defaultValue:n[0]}}const vt=(t,e)=>{let n=t.toString();return e==null||e.forEach(s=>{if(s)for(const[i,r]of Object.entries(s))n+=i,n+=r}),n};function At(t){if(!t.length)return[];let e=[[]];return t.forEach(n=>{const s=[];n.forEach(i=>{s.push(...e.map(r=>[...r,i]))}),e=s}),e}function _t(t,e){const n=t.spec.axesSpec.map(l.getAxisId);return e.spec.axesSpec.map(l.getAxisId).every(i=>n.some(r=>l.matchAxisId(r,i)&&l.matchAxisId(i,r)))}function Ce(t,e){const n=t.spec.axesSpec.map(l.getAxisId);return e.spec.axesSpec.map(l.getAxisId).every(i=>n.some(r=>l.matchAxisId(r,i)))}const we="pl7.app/graph/isVirtual",ie="pl7.app/label";function le(t,e){const n=t.spec.axesSpec.map(l.getAxisId),s=e.spec.axesSpec.map(l.getAxisId);if(_t(t,e))return[];if(!Ce(t,e))return[];const o=s.map(p=>n.filter(u=>l.matchAxisId(u,p))),c=At(o),d=new Set,a=new Set,g=c.map(p=>{const u=new Set;return p.map((h,f)=>{const b=e.spec.axesSpec[f].domain,_=h.domain;return Object.entries(_??{}).forEach(([P,A])=>{if((b==null?void 0:b[P])===void 0){const y=JSON.stringify([P,A]);u.add(y),d.add(y)}}),{...h,annotations:e.spec.axesSpec[f].annotations}}),u});return[...d].forEach(p=>{g.some(u=>!u.has(p))&&a.add(p)}),c.map((p,u)=>{var P;const h=vt(e.id,p.map(A=>A.domain)),f=((P=e.spec.annotations)==null?void 0:P[ie])??"",b=[...g[u]].filter(A=>a.has(A)).sort().map(A=>{var y;return(y=JSON.parse(A))==null?void 0:y[1]}).join(" / "),_={...e.spec.annotations,[we]:"true"};return(f||b)&&(_[ie]=f&&b?f+" / "+b:f+b),{id:h,spec:{...e.spec,axesSpec:p.map((A,y)=>({...A,annotations:e.spec.axesSpec[y].annotations})),annotations:_},data:e.data}})}function Re(t){const e=[];for(let n=0;n<t.length;n++)for(let s=n+1;s<t.length;s++){const i=t[n],r=t[s];e.push(...le(i,r),...le(r,i))}return e}function Te(t,e){const n=[...t];for(const s of e)for(const i of t){if(i.id===s.id)break;if(Ce(i,s)){n.push(s);break}}return n}const It=["Int","Long","Float","Double","String","Bytes"];function Pt(t,e){if(e===void 0)return;const n=t.resultPool.getData().entries.map(r=>r.obj).filter(l.isPColumn).filter(r=>It.includes(r.spec.valueType)),s=Te(e,n),i=[...s,...Re(s)];if(!i.some(r=>r.data instanceof S&&!r.data.getIsReadyOrError()))return t.createPFrame(i)}class St{constructor(e){this.handle=e}async findColumns(e){return await platforma.pFrameDriver.findColumns(this.handle,e)}async getColumnSpec(e){return await platforma.pFrameDriver.getColumnSpec(this.handle,e)}async listColumns(){return await platforma.pFrameDriver.listColumns(this.handle)}async calculateTableData(e){return await platforma.pFrameDriver.calculateTableData(this.handle,e)}async getUniqueValues(e){return await platforma.pFrameDriver.getUniqueValues(this.handle,e)}}function xe(t){return re({__isRef:!0,blockId:B(t,"blockId"),name:B(t,"name")})}function Ct(t){return re({ref:xe(B(t,"ref")),label:B(t,"label")})}const wt={sdkVersion:U};function Rt(){return de({sdkVersion:U})}function Tt(t){if(typeof globalThis.getEnvironmentValue=="function")return globalThis.getEnvironmentValue(t)}exports.Args=Ee;exports.BlockModel=w;exports.CurrentSdkInfo=wt;exports.FutureRef=I;exports.IS_VIRTUAL_COLUMN=we;exports.It=ke;exports.JsRenderInternal=pt;exports.LABEL_ANNOTATION=ie;exports.MainOutputs=je;exports.OutputError=ue;exports.PAnnotationLabel=ge;exports.PAnnotationTrace=me;exports.PFrameImpl=St;exports.RT_BINARY_PARTITIONED=W;exports.RT_BINARY_SUPER_PARTITIONED=K;exports.RT_JSON_PARTITIONED=ne;exports.RT_JSON_SUPER_PARTITIONED=se;exports.RT_RESOURCE_MAP=q;exports.RT_RESOURCE_MAP_PARTITIONED=Y;exports.RenderCtx=V;exports.ResultPool=Pe;exports.StagingOutputs=Ve;exports.Trace=be;exports.TraceEntry=ye;exports.TreeNodeAccessor=S;exports.UiState=Ne;exports.and=We;exports.createPFrameForGraphs=Pt;exports.createPlDataTable=yt;exports.createPlDataTableSheet=bt;exports.deriveLabels=G;exports.downgradeCfgOrLambda=H;exports.enrichColumnsWithCompatible=Te;exports.extractArchiveAndGetURL=tt;exports.extractConfig=mt;exports.flatten=Je;exports.fromPlOption=Ct;exports.fromPlRef=xe;exports.getAdditionalColumns=Re;exports.getBlobContent=Ye;exports.getBlobContentAsJson=Qe;exports.getBlobContentAsString=Xe;exports.getDownloadedBlobContent=Ze;exports.getEnvironmentValue=Tt;exports.getFromCfg=k;exports.getImmediate=N;exports.getImportProgress=nt;exports.getJsonField=B;exports.getLastLogs=st;exports.getLogHandle=ot;exports.getOnDemandBlobContent=et;exports.getPartitionKeysList=_e;exports.getProgressLog=it;exports.getProgressLogWithInfo=rt;exports.getRawPlatformaInstance=Rt;exports.getResourceField=He;exports.getResourceValueAsJson=ze;exports.getUniquePartitionKeys=Ie;exports.ifDef=z;exports.isConfigLambda=Se;exports.isEmpty=$e;exports.isolate=De;exports.makeArray=Ue;exports.makeObject=re;exports.mapArrayValues=Me;exports.mapRecordValues=Be;exports.mapResourceFields=qe;exports.not=Ge;exports.or=Ke;exports.parseResourceMap=gt;exports.readOutput=ce;exports.wrapOutputs=Fe;Object.keys(l).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>l[t]})});
|
|
1
|
+
"use strict";var De=Object.defineProperty;var Ee=(t,e,n)=>e in t?De(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var L=(t,e,n)=>Ee(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@milaboratories/pl-model-common"),k=require("zod");class pe extends Error{constructor(e,n){super(`${e.length}${n?"+":""} errors, first error: `+e[0]),this.errors=e,this.moreErrors=n}}function de(t){if(!t.ok)throw new pe(t.errors,t.moreErrors);return t.value}function ke(t){return new Proxy(t,{get(e,n){return de(e[n])}})}function v(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null?$(t):t}function N(t){return{type:"GetFromCtx",variable:t}}function je(t){return{type:"Isolate",cfg:t}}const Ve=N("$args"),Ne=N("$it"),Ke=N("$prod"),Be=N("$staging"),Ue=N("$ui");function $(t){return{type:"Immediate",value:t}}function ae(t){const e={};for(const[n,r]of Object.entries(t))e[n]=v(r);return{type:"MakeObject",template:e}}function Je(...t){const e=[];for(const n of t)e.push(v(n));return{type:"MakeArray",template:e}}function W(t,e){return{type:"GetJsonField",source:v(t),field:v(e)}}function Me(t,e,n="$it"){return{type:"MapRecordValues",source:t,mapping:e,itVar:n}}function $e(t,e,n="$it"){return{type:"MapArrayValues",source:t,mapping:e,itVar:n}}function Ge(t){return{type:"Flatten",source:t}}function We(t){return{type:"IsEmpty",arg:t}}function He(t){return{type:"Not",operand:t}}function ze(t,e){return{type:"And",operand1:t,operand2:e}}function qe(t,e){return{type:"Or",operand1:t,operand2:e}}function Ye(t,e){return{type:"GetResourceField",source:v(t),field:v(e)}}function Xe(){return function(t){return{type:"GetResourceValueAsJson",source:v(t)}}}function Qe(t,e,n="$it"){return{type:"MapResourceFields",source:t,mapping:e,itVar:n}}function Ze(t){return{type:"GetBlobContent",source:v(t)}}function et(t){return{type:"GetBlobContentAsString",source:v(t)}}function tt(){return function(t){return{type:"GetBlobContentAsJson",source:v(t)}}}function nt(t){return{type:"GetDownloadedBlobContent",source:v(t)}}function rt(t){return{type:"GetOnDemandBlobContent",source:v(t)}}function st(t,e){return{type:"ExtractArchiveAndGetURL",format:e,source:v(t)}}function it(t){return{type:"GetImportProgress",source:v(t)}}function ot(t,e){return{type:"GetLastLogs",source:v(t),lines:e}}function at(t,e){return{type:"GetProgressLog",source:v(t),patternToSearch:e}}function lt(t,e){return{type:"GetProgressLogWithInfo",source:v(t),patternToSearch:e}}function ut(t){return{type:"GetLogHandle",source:v(t)}}function ct(){return typeof globalThis.getPlatforma<"u"||typeof globalThis.platforma<"u"}function fe(t){if(t&&typeof globalThis.getPlatforma=="function")return globalThis.getPlatforma(t);if(typeof globalThis.platforma<"u")return globalThis.platforma;throw new Error("Can't get platforma instance.")}function pt(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx}function g(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx;throw new Error("Not in config rendering context")}function X(t,e){const n=pt();if(n===void 0)return!1;if(t in n.callbackRegistry)throw new Error(`Callback with key ${t} already registered.`);return n.callbackRegistry[t]=e,!0}const te=new Map;function dt(t,e){t in g().callbackRegistry||(g().callbackRegistry[t]=n=>{for(const r of te.get(t))r(n)},te.set(t,[])),te.get(t).push(e)}class w{constructor(e,n=r=>r){L(this,"isResolved",!1);L(this,"resolvedValue");this.handle=e,this.postProcess=n,dt(e,r=>{this.resolvedValue=n(r),this.isResolved=!0})}map(e){return new w(this.handle,n=>e(this.postProcess(n)))}mapDefined(e){return new w(this.handle,n=>{const r=this.postProcess(n);return r?e(r):void 0})}toJSON(){return this.isResolved?this.resolvedValue:{__awaited_futures__:[this.handle]}}}function Z(t,e){return t===void 0?void 0:e(t)}class _{constructor(e,n){this.handle=e,this.resolvePath=n}resolve(...e){const n=e.map(r=>({assertFieldType:"Input",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveOutput(...e){const n=e.map(r=>({assertFieldType:"Output",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveInput(...e){const n=e.map(r=>({assertFieldType:"Input",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveAny(...e){return this.resolveWithCommon({},...e)}resolveWithCommon(e,...n){const r=[...this.resolvePath,...n.map(i=>typeof i=="string"?i:i.field)];return Z(g().resolveWithCommon(this.handle,e,...n),i=>new _(i,r))}get resourceType(){return g().getResourceType(this.handle)}getInputsLocked(){return g().getInputsLocked(this.handle)}getOutputsLocked(){return g().getOutputsLocked(this.handle)}getIsReadyOrError(){return g().getIsReadyOrError(this.handle)}getIsFinal(){return g().getIsFinal(this.handle)}getError(){const e=[...this.resolvePath,"error"];return Z(g().getError(this.handle),n=>new _(n,e))}listInputFields(){return g().listInputFields(this.handle)}listOutputFields(){return g().listOutputFields(this.handle)}listDynamicFields(){return g().listDynamicFields(this.handle)}getKeyValueBase64(e){return g().getKeyValueBase64(this.handle,e)}getKeyValueAsString(e){return g().getKeyValueAsString(this.handle,e)}getKeyValueAsJson(e){const n=this.getKeyValueAsString(e);if(n==null)throw new Error("Resource has no content.");return JSON.parse(n)}getDataBase64(){return g().getDataBase64(this.handle)}getDataAsString(){return g().getDataAsString(this.handle)}getDataAsJson(){const e=this.getDataAsString();if(e==null)throw new Error("Resource has no content.");return JSON.parse(e)}getPColumns(e=!1,n=""){const r=this.parsePObjectCollection(e,n);return r===void 0?void 0:Object.entries(r).map(([,s])=>{if(!p.isPColumn(s))throw new Error(`not a PColumn (kind = ${s.spec.kind})`);return s})}parsePObjectCollection(e=!1,n=""){const r=g().parsePObjectCollection(this.handle,e,n,...this.resolvePath);if(r===void 0)return;const i={};for(const[s,o]of Object.entries(r)){const a=[...this.resolvePath,s];i[s]=p.mapPObjectData(o,c=>new _(c,a))}return i}getFileContentAsBase64(){return new w(g().getBlobContentAsBase64(this.handle))}getFileContentAsString(){return new w(g().getBlobContentAsString(this.handle))}getFileContentAsJson(){return new w(g().getBlobContentAsString(this.handle)).mapDefined(e=>JSON.parse(e))}getBlobContentAsBase64(){return this.getFileContentAsBase64()}getBlobContentAsString(){return this.getFileContentAsString()}getFileHandle(){return new w(g().getDownloadedBlobContentHandle(this.handle))}getDownloadedBlobHandle(){return this.getFileHandle()}getRemoteFileHandle(){return new w(g().getOnDemandBlobContentHandle(this.handle))}getOnDemandBlobHandle(){return this.getRemoteFileHandle()}extractArchiveAndGetURL(e){return new w(g().extractArchiveAndGetURL(this.handle,e))}getImportProgress(){return new w(g().getImportProgress(this.handle))}getLastLogs(e){return new w(g().getLastLogs(this.handle,e))}getProgressLog(e){return new w(g().getProgressLog(this.handle,e))}getProgressLogWithInfo(e){return new w(g().getProgressLogWithInfo(this.handle,e))}getLogHandle(){return new w(g().getLogHandle(this.handle))}allFieldsResolved(e="Input"){switch(e){case"Input":return this.getInputsLocked()&&this.listInputFields().every(n=>this.resolve({field:n,assertFieldType:"Input"})!==void 0);case"Output":return this.getOutputsLocked()&&this.listOutputFields().every(n=>this.resolve({field:n,assertFieldType:"Output"})!==void 0)}}mapFields(e,n){const{fieldType:r,requireLocked:i,skipUnresolved:s}={fieldType:"Input",requireLocked:!0,skipUnresolved:!1,...n},o=e;if(i&&(r==="Input"&&!this.getInputsLocked()||r==="Output"&&!this.getOutputsLocked()))return;let c=(r==="Input"?this.listInputFields():r==="Output"?this.listOutputFields():this.listDynamicFields()).map(l=>[l,this.resolve({field:l,assertFieldType:r})]);return s&&(c=c.filter(l=>l[1]!==void 0)),c.map(([l,y])=>o(l,y))}}const he="staging",ge="main",ft={explicitColumnsSupport:!0,inlineColumnsSupport:!0,activeArgs:!0};function me(t){return typeof t=="object"&&t!==null&&"__awaited_futures__"in t}function re(t,e,n){if(e.has(n))return;if(e.add(n),typeof n==="object")if(me(n))n.__awaited_futures__.forEach(i=>t.add(i));else if(Array.isArray(n))for(const i of n)re(t,e,i);else for(const[,i]of Object.entries(n))i!==n&&re(t,e,i)}function ht(t){const e=new Set;return re(e,new Set,t),e}const gt=Object.freeze(Object.defineProperty({__proto__:null,GlobalCfgRenderCtxFeatureFlags:ft,MainAccessorName:ge,StagingAccessorName:he,getAllFutureAwaits:ht,isFutureAwait:me},Symbol.toStringTag,{value:"Module"})),ye="pl7.app/label",be="pl7.app/trace",ve=k.z.object({type:k.z.string(),importance:k.z.number().optional(),id:k.z.string().optional(),label:k.z.string()}),Ae=k.z.array(ve),mt=.001,yt="__LABEL__",le="__LABEL__@1";function se(t,e,n={}){const r=new Map,i=new Map,s=t.map(h=>{var O,F;const d=e(h);let f,b,m;"spec"in d&&typeof d.spec=="object"?(f=d.spec,b=d.prefixTrace,m=d.suffixTrace):f=d;const A=(O=f.annotations)==null?void 0:O[ye],P=(F=f.annotations)==null?void 0:F[be],I=(P?Ae.safeParse(JSON.parse(P)).data:void 0)??[],T=[...b??[],...I,...m??[]];if(A){const x={label:A,type:yt,importance:-2};n.addLabelAsSuffix?T.push(x):T.splice(0,0,x)}const C=[],R=new Map;for(let x=T.length-1;x>=0;--x){const{type:K}=T[x],B=T[x].importance??0,U=(R.get(K)??0)+1;R.set(K,U);const J=`${K}@${U}`;i.set(J,(i.get(J)??0)+1),r.set(J,Math.max(r.get(J)??Number.NEGATIVE_INFINITY,B-(T.length-x)*mt)),C.push({...T[x],fullType:J,occurenceIndex:U})}return C.reverse(),{value:h,spec:f,label:A,fullTrace:C}}),o=[],a=[],c=[...r];c.sort(([,h],[,d])=>d-h);for(const[h]of c)h.endsWith("@1")||i.get(h)===t.length?o.push(h):a.push(h);const l=h=>s.map(d=>{const f=d.fullTrace.filter(m=>h.has(m.fullType)).map(m=>m.label),b=n.separator??" / ";return{label:f.join(b),value:d.value}});if(o.length===0){if(a.length!==0)throw new Error("Assertion error.");return l(new Set(le))}let y=0,u=0;for(;y<o.length;){const h=new Set;n.includeNativeLabel&&h.add(le);for(let f=0;f<y;++f)h.add(o[f]);h.add(o[u]);const d=l(h);if(new Set(d.map(f=>f.label)).size===t.length)return d;u++,u==o.length&&(y++,u=y)}return l(new Set([...o,...a]))}const Y="PColumnData/",H=Y+"ResourceMap",z=Y+"Partitioned/ResourceMap",j=Y+"JsonPartitioned",D=Y+"BinaryPartitioned",Pe=Y+"Partitioned/",q=Pe+"JsonPartitioned",V=Pe+"BinaryPartitioned";function Ie(t,e,n,r=[],i){if(t===void 0)return!1;switch(t.resourceType.name){case H:{let s=t.getInputsLocked();for(const o of t.listInputFields()){const a=t.resolve({field:o,assertFieldType:"Input"}),c=[...r,...JSON.parse(o)],l=a===void 0?void 0:e(a);l===void 0&&(s=!1),(l!==void 0||i)&&n.push({key:c,value:l})}return s}case z:{let s=t.getInputsLocked();for(const o of t.listInputFields()){const a=t.resolve({field:o,assertFieldType:"Input"});if(a===void 0)s=!1;else{const c=[...r,...JSON.parse(o)],l=Ie(a,e,n,c,i);s=s&&l}}return s}default:throw new Error(`Unknown resource type: ${t.resourceType.name}`)}}function bt(t,e,n=!1){const r=[];return{isComplete:Ie(t,e,r,[],n),data:r}}const ie=t=>{if(t.endsWith(".index"))return{baseKey:t.substring(0,t.length-6),type:"index"};if(t.endsWith(".values"))return{baseKey:t.substring(0,t.length-7),type:"values"};throw new Error(`key must ends on .index/.values for binary p-column, got: ${t}`)};function we(t){if(!t)return;const e=t.resourceType.name,n=t.getDataAsJson(),r=[];let i=0;switch(e){case H:i=n.keyLength;break;case z:i=n.partitionKeyLength+n.keyLength;break;case j:case D:i=n.partitionKeyLength;break;case V:case q:i=n.superPartitionKeyLength+n.partitionKeyLength;break}switch(e){case H:case j:case D:for(let s of t.listInputFields()){e===D&&(s=ie(s).baseKey);const o=[...JSON.parse(s)];r.push(o)}break;case z:case V:case q:for(const s of t.listInputFields()){const o=[...JSON.parse(s)],a=t.resolve({field:s,assertFieldType:"Input"});if(a!==void 0)for(let c of a.listInputFields()){e===V&&(c=ie(c).baseKey);const l=[...o,...JSON.parse(c)];r.push(l)}}break}return{data:r,keyLength:i}}function xe(t){const e=we(t);if(!e)return;const{data:n,keyLength:r}=e,i=[];for(let s=0;s<r;++s)i.push(new Set);for(const s of n){if(s.length!==r)throw new Error("key length does not match partition length");for(let o=0;o<r;++o)i[o].add(s[o])}return i.map(s=>Array.from(s.values()))}function ee(t,e=[]){if(t===void 0)return;const n=t.resourceType.name,r=t.getDataAsJson();if(e.length>0&&(n===q||n===V))throw new Error(`Unexpected nested super-partitioned resource: ${n}`);switch(n){case H:case z:throw new Error(`Only data columns are supported, got: ${n}`);case j:{if(typeof(r==null?void 0:r.partitionKeyLength)!="number")throw new Error(`Missing partitionKeyLength in metadata for ${n}`);const i=[];for(const s of t.listInputFields()){const o=t.resolve({field:s,assertFieldType:"Input"});if(o===void 0)return;const a=[...e,...JSON.parse(s)];i.push({key:a,value:o})}return{type:"JsonPartitioned",partitionKeyLength:r.partitionKeyLength,parts:i}}case D:{if(typeof(r==null?void 0:r.partitionKeyLength)!="number")throw new Error(`Missing partitionKeyLength in metadata for ${n}`);const i=[],s=new Map;for(const o of t.listInputFields()){const a=ie(o),c=t.resolve({field:o,assertFieldType:"Input"});if(c===void 0)return;let l=s.get(a.baseKey);l||(l={},s.set(a.baseKey,l)),a.type==="index"?l.index=c:l.values=c}for(const[o,a]of s.entries()){if(!a.index||!a.values)return;const c=[...e,...JSON.parse(o)];i.push({key:c,value:{index:a.index,values:a.values}})}return{type:"BinaryPartitioned",partitionKeyLength:r.partitionKeyLength,parts:i}}case q:{if(typeof(r==null?void 0:r.superPartitionKeyLength)!="number"||typeof(r==null?void 0:r.partitionKeyLength)!="number")throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n}`);const i=r.superPartitionKeyLength+r.partitionKeyLength,s=[];for(const o of t.listInputFields()){const a=t.resolve({field:o,assertFieldType:"Input"});if(a===void 0)return;if(a.resourceType.name!==j)throw new Error(`Expected ${j} inside ${n}, but got ${a.resourceType.name}`);const c=ee(a,JSON.parse(o));if(c===void 0)return;if(c.type!=="JsonPartitioned")throw new Error(`Unexpected inner result type for ${n}: ${c.type}`);s.push(...c.parts)}return{type:"JsonPartitioned",partitionKeyLength:i,parts:s}}case V:{if(typeof(r==null?void 0:r.superPartitionKeyLength)!="number"||typeof(r==null?void 0:r.partitionKeyLength)!="number")throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n}`);const i=r.superPartitionKeyLength+r.partitionKeyLength,s=[];for(const o of t.listInputFields()){const a=t.resolve({field:o,assertFieldType:"Input"});if(a===void 0)return;if(a.resourceType.name!==D)throw new Error(`Expected ${D} inside ${n}, but got ${a.resourceType.name}`);const c=ee(a,JSON.parse(o));if(c===void 0)return;if(c.type!=="BinaryPartitioned")throw new Error(`Unexpected inner result type for ${n}: ${c.type}`);s.push(...c.parts)}return{type:"BinaryPartitioned",partitionKeyLength:i,parts:s}}default:throw new Error(`Unknown resource type: ${n}`)}}function Se(t,e){const n=[...e].sort((s,o)=>o[0]-s[0]);if(t.type==="JsonPartitioned"||t.type==="BinaryPartitioned"){const{partitionKeyLength:s}=t;for(const[o]of e)if(o>=s)throw new Error(`Can't filter on non-partitioned axis ${o}. Must be >= ${s}`)}else if(t.type==="Json"){const{keyLength:s}=t;for(const[o]of e)if(o>=s)throw new Error(`Can't filter on non-data axis ${o}. Must be >= ${s}`)}const r=s=>{for(const[o,a]of n)if(s[o]!==a)return!1;return!0},i=s=>{const o=[...s];for(const[a]of n)o.splice(a,1);return o};switch(t.type){case"Json":{const s=t.data.filter(o=>r(o.key)).map(o=>({key:i(o.key),value:o.value}));return{type:"Json",keyLength:t.keyLength-e.length,data:s}}case"JsonPartitioned":{const s=t.parts.filter(o=>r(o.key)).map(o=>({key:i(o.key),value:o.value}));return{type:"JsonPartitioned",partitionKeyLength:t.partitionKeyLength-e.length,parts:s}}case"BinaryPartitioned":{const s=t.parts.filter(o=>r(o.key)).map(o=>({key:i(o.key),value:o.value}));return{type:"BinaryPartitioned",partitionKeyLength:t.partitionKeyLength-e.length,parts:s}}}}function ne(t,e){if(t===void 0)return e===void 0;if(e===void 0)return!0;for(const n in e)if(t[n]!==e[n])return!1;return!0}function ue(t){return p.mapPObjectData(t,e=>e instanceof _?e.handle:p.isDataInfo(e)?p.mapDataInfo(e,n=>n.handle):e)}function vt(t){if(t)return t.map(e=>({type:`split:${p.canonicalizeAxisId(e.axisId)}`,label:e.label,importance:1e6}))}function At(t){if(t)return t.map(e=>[e.axisIdx,e.value])}class _e{constructor(){L(this,"ctx",g())}calculateOptions(e){return this.ctx.calculateOptions(e)}getOptions(e,n){const r=typeof e=="function"?e:p.selectorsToPredicate(e),i=this.getSpecs().entries.filter(s=>r(s.obj));return typeof n=="object"||typeof n>"u"?se(i,s=>s.obj,n??{}).map(({value:{ref:s},label:o})=>({ref:s,label:o})):i.map(s=>({ref:s.ref,label:n(s.obj,s.ref)}))}getUniversalPColumnEntries(e,n,r){const i={};if(!(e instanceof p.AnchoredIdDeriver))for(const[l,y]of Object.entries(e))if(p.isPlRef(y)){const u=this.getPColumnSpecByRef(y);if(!u)return;i[l]=u}else i[l]=y;const s=typeof n=="function"?[n]:Array.isArray(n)?n:[n],o=e instanceof p.AnchoredIdDeriver?e:new p.AnchoredIdDeriver(i),a=[];for(const l of s){const y=typeof l=="function"?l:p.selectorsToPredicate(p.resolveAnchors(i,l)),u=this.getSpecs().entries.filter(({obj:d})=>p.isPColumnSpec(d)?y(d):!1);if(u.length===0)continue;const h=typeof l=="object"&&"axes"in l&&l.axes!==void 0&&l.partialAxesMatch===void 0?l.axes.map((d,f)=>"split"in d&&d.split===!0?f:-1).filter(d=>d!==-1):[];if(h.sort((d,f)=>d-f),h.length>0){const d=h[h.length-1];for(const{ref:f,obj:b}of u){if(!p.isPColumnSpec(b))throw new Error(`Assertion failed: expected PColumnSpec, got ${b.kind}`);const m=this.getDataByRef(f);if(!m){if(r!=null&&r.dontWaitAllData)continue;return}if(!p.isPColumn(m))throw new Error(`Assertion failed: expected PColumn, got ${m.spec.kind}`);const A=xe(m.data);if(!A){if(r!=null&&r.dontWaitAllData)continue;return}if(d>=A.length)throw new Error(`Not enough partition keys for the requested split axes in column ${b.name}`);const P=h.map(C=>this.findLabels(p.getAxisId(b.axesSpec[C]))),I=[],T=(C,R)=>{if(R>=h.length){I.push([...C]);return}const O=h[R],F=A[O];for(const x of F)C.push(x),T(C,R+1),C.pop()};T([],0);for(const C of I){const R=C.map((O,F)=>{const x=h[F],K=p.getAxisId(b.axesSpec[x]),B=P[F],U=(B==null?void 0:B[O])??String(O);return{axisIdx:x,axisId:K,value:O,label:U}});a.push({obj:b,ref:f,axisFilters:R})}}}else for(const{ref:d,obj:f}of u)p.isPColumnSpec(f)&&a.push({obj:f,ref:d})}return a.length===0?[]:se(a,l=>({spec:l.obj,suffixTrace:vt(l.axisFilters)}),(r==null?void 0:r.labelOps)??{}).map(l=>({id:o.deriveS(l.value.obj,At(l.value.axisFilters)),obj:l.value.obj,ref:l.value.ref,axisFilters:l.value.axisFilters,label:l.label}))}getAnchoredPColumns(e,n,r){const i={...r,labelOps:{includeNativeLabel:!0,...(r==null?void 0:r.labelOps)||{}}},s=this.getUniversalPColumnEntries(e,n,i);if(!s||s.length===0)return;const o=[];for(const a of s){const c=this.getPColumnByRef(a.ref);if(!c)return;const l=ee(c.data);if(!l)return;let y=l,u={...c.spec};if(a.axisFilters&&a.axisFilters.length>0){const d=a.axisFilters.map(m=>[m.axisIdx,m.value]);y=Se(l,d);const f=[...a.axisFilters].map(m=>m.axisIdx).sort((m,A)=>A-m),b=[...u.axesSpec];for(const m of f)b.splice(m,1);u={...u,axesSpec:b}}const h=p.entriesToDataInfo(y);u.annotations?u={...u,annotations:{...u.annotations,"pl7.app/label":a.label}}:u={...u,annotations:{"pl7.app/label":a.label}},o.push({id:a.id,spec:u,data:h})}return o}getCanonicalOptions(e,n,r){const i=this.getUniversalPColumnEntries(e,n,r);if(i)return i.map(s=>({value:s.id,label:s.label}))}getDataFromResultPool(){return this.getData()}getData(){const e=this.ctx.getDataFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:new _(n.obj.data,[n.ref.blockId,n.ref.name])}}))}}getDataWithErrorsFromResultPool(){return this.getDataWithErrors()}getDataWithErrors(){const e=this.ctx.getDataWithErrorsFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:p.mapValueInVOE(n.obj.data,r=>new _(r,[n.ref.blockId,n.ref.name]))}}))}}getSpecsFromResultPool(){return this.getSpecs()}getSpecs(){return this.ctx.getSpecsFromResultPool()}getDataByRef(e){var r;if(typeof this.ctx.getDataFromResultPoolByRef>"u")return(r=this.getData().entries.find(i=>i.ref.blockId===e.blockId&&i.ref.name===e.name))==null?void 0:r.obj;const n=this.ctx.getDataFromResultPoolByRef(e.blockId,e.name);if(n)return p.mapPObjectData(n,i=>new _(i,[e.blockId,e.name]))}getPColumnByRef(e){const n=this.getDataByRef(e);if(n)return p.ensurePColumn(n)}getPColumnSpecByRef(e){const n=this.getSpecByRef(e);if(n){if(!p.isPColumnSpec(n))throw new Error(`not a PColumn spec (kind = ${n.kind})`);return n}}getSpecByRef(e){return this.ctx.getSpecFromResultPoolByRef(e.blockId,e.name)}findDataWithCompatibleSpec(e){const n=[];e:for(const r of this.getData().entries){if(!p.isPColumnSpec(r.obj.spec))continue;const i=r.obj.spec;if(e.name===i.name&&e.valueType===i.valueType&&e.axesSpec.length===i.axesSpec.length&&ne(e.domain,i.domain)){for(let s=0;s<e.axesSpec.length;++s){const o=e.axesSpec[s],a=i.axesSpec[s];if(o.name!==a.name||o.type!==a.type||!ne(o.domain,a.domain))continue e}n.push(r.obj)}}return n}findLabels(e){const n=this.getData();for(const r of n.entries){if(!p.isPColumn(r.obj))continue;const i=r.obj.spec;if(i.name==="pl7.app/label"&&i.axesSpec.length===1&&i.axesSpec[0].name===e.name&&i.axesSpec[0].type===e.type&&ne(e.domain,i.axesSpec[0].domain)){if(r.obj.data.resourceType.name!=="PColumnData/Json")throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);return Object.fromEntries(Object.entries(r.obj.data.getDataAsJson().data).map(o=>[JSON.parse(o[0])[0],o[1]]))}}}}class M{constructor(){L(this,"ctx");L(this,"args");L(this,"uiState");L(this,"_activeArgsCache");L(this,"resultPool",new _e);this.ctx=g(),this.args=JSON.parse(this.ctx.args),this.uiState=this.ctx.uiState!==void 0?JSON.parse(this.ctx.uiState):{}}get activeArgs(){return this._activeArgsCache===void 0&&(this._activeArgsCache={v:this.ctx.activeArgs?JSON.parse(this.ctx.activeArgs):void 0}),this._activeArgsCache.v}getNamedAccessor(e){return Z(this.ctx.getAccessorHandleByName(e),n=>new _(n,[e]))}get prerun(){return this.getNamedAccessor(he)}get outputs(){return this.getNamedAccessor(ge)}findLabels(e){return this.resultPool.findLabels(e)}verifyInlineAndExplicitColumnsSupport(e){var i;const n=e.some(s=>!(s.data instanceof _)||p.isDataInfo(s.data)),r=((i=this.ctx.featureFlags)==null?void 0:i.inlineColumnsSupport)===!0;if(n&&!r)throw Error("Inline or explicit columns not supported")}createPFrame(e){return this.verifyInlineAndExplicitColumnsSupport(e),this.ctx.createPFrame(e.map(n=>ue(n)))}createPTable(e){let n;return"columns"in e?n={src:{type:"full",entries:e.columns.map(r=>({type:"column",column:r}))},filters:e.filters??[],sorting:e.sorting??[]}:n=e,this.verifyInlineAndExplicitColumnsSupport(p.extractAllColumns(n.src)),this.ctx.createPTable(p.mapPTableDef(n,r=>ue(r)))}getBlockLabel(e){return this.ctx.getBlockLabel(e)}getCurrentUnstableMarker(){if(!(typeof this.ctx.getCurrentUnstableMarker>"u"))return this.ctx.getCurrentUnstableMarker()}}const G="1.26.0";function Ce(t){return t.__renderLambda===!0}function Q(t){if(t!==void 0)return Ce(t)?t.handle:t}function E(t){if(t!==void 0)return typeof t=="string"?{__renderLambda:!0,handle:t,retentive:!1}:t}function Pt(t){if(t.v3!==void 0){const{initialArgs:e,initialUiState:n,inputsValid:r,outputs:i,renderingMode:s,sdkVersion:o,sections:a,title:c}=t.v3,{code:l}=t;return{initialArgs:e,initialUiState:n,inputsValid:r,outputs:i,renderingMode:s,sdkVersion:o,sections:a,title:c,code:l}}else if(t.inputsValid!==void 0){const{sdkVersion:e,renderingMode:n,outputs:r,inputsValid:i,sections:s,initialArgs:o,code:a}=t,c=Object.keys(t);if(e===void 0||n===void 0||r===void 0||i===void 0||s===void 0||o===void 0)throw new Error(`Malformed config v2. SDK version ${e}; Fields = ${c.join(", ")}`);return{sdkVersion:e,renderingMode:n,initialArgs:o,outputs:Object.fromEntries(Object.entries(r).map(([l,y])=>[l,E(y)])),inputsValid:E(i),sections:E(s),initialUiState:void 0,code:a}}else if(t.renderingMode!==void 0){const{sdkVersion:e,canRun:n,renderingMode:r,outputs:i,sections:s,initialArgs:o,code:a}=t,c=Object.keys(t);if(r===void 0||i===void 0||n===void 0||s===void 0||o===void 0)throw new Error(`Malformed config v1. SDK version ${e}; Fields = ${c.join(", ")}`);return{sdkVersion:e??"unknown",renderingMode:r,initialArgs:o,outputs:Object.fromEntries(Object.entries(i).map(([l,y])=>[l,E(y)])),inputsValid:E(n),sections:E(s),initialUiState:void 0,code:a}}else{const{sdkVersion:e}=t,n=Object.keys(t);throw new Error(`Config format not supported: SDK = ${e}; Fields = ${n.join(", ")}`)}}class S{constructor(e,n,r,i,s,o,a){this._renderingMode=e,this._initialArgs=n,this._initialUiState=r,this._outputs=i,this._inputsValid=s,this._sections=o,this._title=a}static create(e="Heavy"){return new S(e,void 0,{},{},$(!0),$([]),void 0)}output(e,n,r={}){if(typeof n=="function"){const i=`output#${e}`;return X(i,()=>n(new M)),new S(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:{__renderLambda:!0,handle:i,...r}},this._inputsValid,this._sections,this._title)}else return new S(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:n},this._inputsValid,this._sections,this._title)}retentiveOutput(e,n){return this.output(e,n,{retentive:!0})}argsValid(e){return typeof e=="function"?(X("inputsValid",()=>e(new M)),new S(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,{__renderLambda:!0,handle:"inputsValid"},this._sections,this._title)):new S(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,e,this._sections,this._title)}sections(e){return Array.isArray(e)?this.sections($(e)):typeof e=="function"?(X("sections",()=>e(new M)),new S(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,{__renderLambda:!0,handle:"sections"},this._title)):new S(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,e,this._title)}title(e){return X("title",()=>e(new M)),new S(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,{__renderLambda:!0,handle:"title"})}initialArgs(e){return new S(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title)}withArgs(e){return new S(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title)}withUiState(e){return new S(this._renderingMode,this._initialArgs,e,this._outputs,this._inputsValid,this._sections,this._title)}done(){if(this._initialArgs===void 0)throw new Error("Initial arguments not set.");const e={v3:{sdkVersion:G,renderingMode:this._renderingMode,initialArgs:this._initialArgs,initialUiState:this._initialUiState,inputsValid:this._inputsValid,sections:this._sections,title:this._title,outputs:this._outputs},sdkVersion:G,renderingMode:this._renderingMode,initialArgs:this._initialArgs,inputsValid:Q(this._inputsValid),sections:Q(this._sections),outputs:Object.fromEntries(Object.entries(this._outputs).map(([n,r])=>[n,Q(r)]))};return ct()?fe({sdkVersion:G}):{config:e}}}function It(t,e,n,r){var l,y;Array.isArray(r)&&(r={filters:r});const i=t.resultPool.getData().entries.map(u=>u.obj).filter(p.isPColumn).filter(u=>u.spec.name==="pl7.app/label"&&u.spec.axesSpec.length===1),s=(u,h)=>{let d=u.toString();if(h)for(const f in h)d+=f,d+=h[f];return d},o=new Map;for(const u of e)for(const h of u.spec.axesSpec){const d=p.getAxisId(h);for(const f of i){const b=f.spec.axesSpec[0],m=p.getAxisId(f.spec.axesSpec[0]);if(p.matchAxisId(d,m)){const A=Object.keys(d.domain??{}).length,P=Object.keys(m.domain??{}).length;if(A>P){const I=s(f.id,d.domain);o.set(I,{id:I,spec:{...f.spec,axesSpec:[{...d,annotations:b.annotations}]},data:f.data})}else o.set(s(f.id),f)}}}if([...e,...o.values()].some(u=>u.data instanceof _&&!u.data.getIsReadyOrError()))return;let a=e;const c=[];if(r!=null&&r.coreColumnPredicate){a=[];for(const u of e)r.coreColumnPredicate(u.spec)?a.push(u):c.push(u)}return c.push(...o.values()),t.createPTable({src:{type:"outer",primary:{type:(r==null?void 0:r.coreJoinType)??"full",entries:a.map(u=>({type:"column",column:u}))},secondary:c.map(u=>({type:"column",column:u}))},filters:[...(r==null?void 0:r.filters)??[],...((l=n==null?void 0:n.pTableParams)==null?void 0:l.filters)??[]],sorting:((y=n==null?void 0:n.pTableParams)==null?void 0:y.sorting)??[]})}function wt(t,e,n){const r=t.resultPool.findLabels(e);return{axis:e,options:n.map(i=>({value:i,label:(r==null?void 0:r[i])??i.toString()})),defaultValue:n[0]}}const xt=(t,e)=>{let n=t.toString();return e==null||e.forEach(r=>{if(r)for(const[i,s]of Object.entries(r))n+=i,n+=s}),n};function St(t){if(!t.length)return[];let e=[[]];return t.forEach(n=>{const r=[];n.forEach(i=>{r.push(...e.map(s=>[...s,i]))}),e=r}),e}function _t(t,e){const n=t.spec.axesSpec.map(p.getAxisId);return e.spec.axesSpec.map(p.getAxisId).every(i=>n.some(s=>p.matchAxisId(s,i)&&p.matchAxisId(i,s)))}function Te(t,e){const n=t.spec.axesSpec.map(p.getAxisId);return e.spec.axesSpec.map(p.getAxisId).every(i=>n.some(s=>p.matchAxisId(s,i)))}const Le="pl7.app/graph/isVirtual",oe="pl7.app/label";function ce(t,e){const n=t.spec.axesSpec.map(p.getAxisId),r=e.spec.axesSpec.map(p.getAxisId);if(_t(t,e))return[];if(!Te(t,e))return[];const o=r.map(u=>n.filter(h=>p.matchAxisId(h,u))),a=St(o),c=new Set,l=new Set,y=a.map(u=>{const h=new Set;return u.map((d,f)=>{const b=e.spec.axesSpec[f].domain,m=d.domain;return Object.entries(m??{}).forEach(([A,P])=>{if((b==null?void 0:b[A])===void 0){const I=JSON.stringify([A,P]);h.add(I),c.add(I)}}),{...d,annotations:e.spec.axesSpec[f].annotations}}),h});return[...c].forEach(u=>{y.some(h=>!h.has(u))&&l.add(u)}),a.map((u,h)=>{var A;const d=xt(e.id,u.map(P=>P.domain)),f=((A=e.spec.annotations)==null?void 0:A[oe])??"",b=[...y[h]].filter(P=>l.has(P)).sort().map(P=>{var I;return(I=JSON.parse(P))==null?void 0:I[1]}).join(" / "),m={...e.spec.annotations,[Le]:"true"};return(f||b)&&(m[oe]=f&&b?f+" / "+b:f+b),{id:d,spec:{...e.spec,axesSpec:u.map((P,I)=>({...P,annotations:e.spec.axesSpec[I].annotations})),annotations:m},data:e.data}})}function Re(t){const e=[];for(let n=0;n<t.length;n++)for(let r=n+1;r<t.length;r++){const i=t[n],s=t[r];e.push(...ce(i,s),...ce(s,i))}return e}function Oe(t,e){const n=[...t];for(const r of e)for(const i of t){if(i.id===r.id)break;if(Te(i,r)){n.push(r);break}}return n}const Ct=["Int","Long","Float","Double","String","Bytes"];function Tt(t,e){if(e===void 0)return;const n=t.resultPool.getData().entries.map(s=>s.obj).filter(p.isPColumn).filter(s=>Ct.includes(s.spec.valueType)),r=Oe(e,n),i=[...r,...Re(r)];if(!i.some(s=>s.data instanceof _&&!s.data.getIsReadyOrError()))return t.createPFrame(i)}class Lt{constructor(e){this.handle=e}async findColumns(e){return await platforma.pFrameDriver.findColumns(this.handle,e)}async getColumnSpec(e){return await platforma.pFrameDriver.getColumnSpec(this.handle,e)}async listColumns(){return await platforma.pFrameDriver.listColumns(this.handle)}async calculateTableData(e){return await platforma.pFrameDriver.calculateTableData(this.handle,e)}async getUniqueValues(e){return await platforma.pFrameDriver.getUniqueValues(this.handle,e)}}function Fe(t){return ae({__isRef:!0,blockId:W(t,"blockId"),name:W(t,"name")})}function Rt(t){return ae({ref:Fe(W(t,"ref")),label:W(t,"label")})}const Ot={sdkVersion:G};function Ft(){return fe({sdkVersion:G})}function Dt(t){if(typeof globalThis.getEnvironmentValue=="function")return globalThis.getEnvironmentValue(t)}exports.Args=Ve;exports.BlockModel=S;exports.CurrentSdkInfo=Ot;exports.FutureRef=w;exports.IS_VIRTUAL_COLUMN=Le;exports.It=Ne;exports.JsRenderInternal=gt;exports.LABEL_ANNOTATION=oe;exports.MainOutputs=Ke;exports.OutputError=pe;exports.PAnnotationLabel=ye;exports.PAnnotationTrace=be;exports.PFrameImpl=Lt;exports.RT_BINARY_PARTITIONED=D;exports.RT_BINARY_SUPER_PARTITIONED=V;exports.RT_JSON_PARTITIONED=j;exports.RT_JSON_SUPER_PARTITIONED=q;exports.RT_RESOURCE_MAP=H;exports.RT_RESOURCE_MAP_PARTITIONED=z;exports.RenderCtx=M;exports.ResultPool=_e;exports.StagingOutputs=Be;exports.Trace=Ae;exports.TraceEntry=ve;exports.TreeNodeAccessor=_;exports.UiState=Ue;exports.and=ze;exports.createPFrameForGraphs=Tt;exports.createPlDataTable=It;exports.createPlDataTableSheet=wt;exports.deriveLabels=se;exports.downgradeCfgOrLambda=Q;exports.enrichColumnsWithCompatible=Oe;exports.extractArchiveAndGetURL=st;exports.extractConfig=Pt;exports.filterDataInfoEntries=Se;exports.flatten=Ge;exports.fromPlOption=Rt;exports.fromPlRef=Fe;exports.getAdditionalColumns=Re;exports.getBlobContent=Ze;exports.getBlobContentAsJson=tt;exports.getBlobContentAsString=et;exports.getDownloadedBlobContent=nt;exports.getEnvironmentValue=Dt;exports.getFromCfg=N;exports.getImmediate=$;exports.getImportProgress=it;exports.getJsonField=W;exports.getLastLogs=ot;exports.getLogHandle=ut;exports.getOnDemandBlobContent=rt;exports.getPartitionKeysList=we;exports.getProgressLog=at;exports.getProgressLogWithInfo=lt;exports.getRawPlatformaInstance=Ft;exports.getResourceField=Ye;exports.getResourceValueAsJson=Xe;exports.getUniquePartitionKeys=xe;exports.ifDef=Z;exports.isConfigLambda=Ce;exports.isEmpty=We;exports.isolate=je;exports.makeArray=Je;exports.makeObject=ae;exports.mapArrayValues=$e;exports.mapRecordValues=Me;exports.mapResourceFields=Qe;exports.not=He;exports.or=qe;exports.parsePColumnData=ee;exports.parseResourceMap=bt;exports.readOutput=de;exports.wrapOutputs=ke;Object.keys(p).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>p[t]})});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|