@milaboratories/pl-model-common 1.19.3 → 1.19.5

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.
@@ -70,48 +70,52 @@ export type BinaryPartitionedDataInfo<Blob> = {
70
70
  /** Map of stringified partition keys to binary chunks */
71
71
  parts: Record<string, BinaryChunk<Blob>>;
72
72
  };
73
- type ParquetChunkMappingAxis = {
73
+ export type ParquetChunkMappingAxis = {
74
74
  /** Data type (matches PColumn axis types) */
75
75
  type: 'Int' | 'Long' | 'String';
76
76
  /** Field name in the Parquet file */
77
77
  id: string;
78
78
  };
79
- type ParquetChunkMappingColumn = {
79
+ export type ParquetChunkMappingColumn = {
80
80
  /** Data type (matches PColumn value type) */
81
81
  type: 'Int' | 'Long' | 'Float' | 'Double' | 'String';
82
82
  /** Field name in the Parquet file */
83
83
  id: string;
84
84
  };
85
- type ParquetChunkStats = {
85
+ export type ParquetChunkMapping = {
86
+ /** Axes mappings - Parquet file is sorted by these fields in this order */
87
+ axes: ParquetChunkMappingAxis[];
88
+ /** Column mapping */
89
+ column: ParquetChunkMappingColumn;
90
+ };
91
+ export type ParquetChunkStats = {
86
92
  /** Number of rows in the chunk */
87
- numberOfRows?: number;
93
+ numberOfRows: number;
88
94
  /** Byte size information for storage optimization and query planning */
89
- size?: {
95
+ size: {
90
96
  /** Byte sizes for each axis column in the same order as axes mapping */
91
97
  axes: number[];
92
98
  /** Byte size for the data column */
93
99
  column: number;
94
100
  };
95
101
  };
96
- export type ParquetChunk<Blob> = {
97
- /** Parquet file (PTable) containing column data */
98
- data: Blob;
102
+ export type ParquetChunkMetadata = {
99
103
  /** Content hash calculated for the specific axes and data this chunk represents */
100
- dataDigest?: string;
101
- /** Axes mappings - Parquet file is sorted by these fields in this order */
102
- axes: ParquetChunkMappingAxis[];
103
- /** Column mapping */
104
- column: ParquetChunkMappingColumn;
104
+ dataDigest: string;
105
105
  /** Pre-computed statistics for optimization without blob download */
106
- stats?: ParquetChunkStats;
106
+ stats: Partial<ParquetChunkStats>;
107
107
  };
108
+ export type ParquetChunk<Blob> = {
109
+ /** Parquet file (PTable) containing column data */
110
+ data: Blob;
111
+ } & ParquetChunkMapping & Partial<ParquetChunkMetadata>;
108
112
  export type ParquetPartitionedDataInfo<Blob> = {
109
113
  /** Identifier for this data format ('ParquetPartitioned') */
110
114
  type: 'ParquetPartitioned';
111
115
  /** Number of leading axes used for partitioning */
112
116
  partitionKeyLength: number;
113
117
  /** Map of stringified partition keys to parquet files */
114
- parts: Record<string, ParquetChunk<Blob>>;
118
+ parts: Record<string, Blob>;
115
119
  };
116
120
  /**
117
121
  * Union type representing all possible data storage formats for PColumn data.
@@ -119,7 +123,7 @@ export type ParquetPartitionedDataInfo<Blob> = {
119
123
  *
120
124
  * @template Blob - Type parameter representing the storage reference type (could be ResourceInfo, PFrameBlobId, etc.)
121
125
  */
122
- export type DataInfo<Blob> = JsonDataInfo | JsonPartitionedDataInfo<Blob> | BinaryPartitionedDataInfo<Blob>;
126
+ export type DataInfo<Blob> = JsonDataInfo | JsonPartitionedDataInfo<Blob> | BinaryPartitionedDataInfo<Blob> | ParquetPartitionedDataInfo<Blob>;
123
127
  /**
124
128
  * Type guard function that checks if the given value is a valid DataInfo.
125
129
  *
@@ -136,6 +140,8 @@ export declare function isDataInfo<Blob>(value: unknown): value is DataInfo<Blob
136
140
  * @param mapFn - Function to transform blobs from type B1 to type B2
137
141
  * @returns A new DataInfo object with transformed blob references
138
142
  */
143
+ export declare function mapDataInfo<B1, B2>(dataInfo: ParquetPartitionedDataInfo<B1>, mapFn: (blob: B1) => B2): ParquetPartitionedDataInfo<B2>;
144
+ export declare function mapDataInfo<B1, B2>(dataInfo: Exclude<DataInfo<B1>, ParquetPartitionedDataInfo<B1>>, mapFn: (blob: B1) => B2): Exclude<DataInfo<B2>, ParquetPartitionedDataInfo<B2>>;
139
145
  export declare function mapDataInfo<B1, B2>(dataInfo: DataInfo<B1>, mapFn: (blob: B1) => B2): DataInfo<B2>;
140
146
  /**
141
147
  * @param dataInfo - The source DataInfo object
@@ -180,10 +186,18 @@ export interface BinaryPartitionedDataInfoEntries<Blob> {
180
186
  partitionKeyLength: number;
181
187
  parts: PColumnDataEntry<BinaryChunk<Blob>>[];
182
188
  }
189
+ /**
190
+ * Entry-based representation of ParquetPartitionedDataInfo
191
+ */
192
+ export interface ParquetPartitionedDataInfoEntries<Blob> {
193
+ type: 'ParquetPartitioned';
194
+ partitionKeyLength: number;
195
+ parts: PColumnDataEntry<Blob>[];
196
+ }
183
197
  /**
184
198
  * Union type representing all possible entry-based partitioned data storage formats
185
199
  */
186
- export type PartitionedDataInfoEntries<Blob> = JsonPartitionedDataInfoEntries<Blob> | BinaryPartitionedDataInfoEntries<Blob>;
200
+ export type PartitionedDataInfoEntries<Blob> = JsonPartitionedDataInfoEntries<Blob> | BinaryPartitionedDataInfoEntries<Blob> | ParquetPartitionedDataInfoEntries<Blob>;
187
201
  /**
188
202
  * Union type representing all possible entry-based data storage formats
189
203
  */
@@ -227,5 +241,4 @@ export declare function entriesToDataInfo<Blob>(dataInfoEntries: DataInfoEntries
227
241
  * @returns A new DataInfoEntries object with transformed blob references
228
242
  */
229
243
  export declare function mapDataInfoEntries<B1, B2>(dataInfoEntries: DataInfoEntries<B1>, mapFn: (blob: B1) => B2): DataInfoEntries<B2>;
230
- export {};
231
244
  //# sourceMappingURL=data_info.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data_info.d.ts","sourceRoot":"","sources":["../../../src/drivers/pframe/data_info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,wBAAwB;IACxB,GAAG,EAAE,UAAU,C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KAAK,EAAE,GACtB,eAAe,CAAC,EAAE,CAAC,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var ee=Object.defineProperty;var ne=(e,n,r)=>n in e?ee(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var f=(e,n,r)=>ne(e,typeof n!="symbol"?n+"":n,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("zod"),b=require("canonicalize");function re(e){if(e.code!==void 0)return{code:e.code,sdkVersion:e.sdkVersion,featureFlags:e.featureFlags}}function h(e){if(e!==void 0)return typeof e=="string"?{__renderLambda:!0,handle:e,retentive:!1}:e}function te(e){if(e.v3!==void 0){const{initialArgs:n,initialUiState:r,inputsValid:t,outputs:i,renderingMode:o,sdkVersion:s,featureFlags:a,sections:u,title:c,enrichmentTargets:l}=e.v3,{code:Z}=e;return{initialArgs:n,initialUiState:r,inputsValid:t,outputs:i,renderingMode:o,sdkVersion:s,featureFlags:a,sections:u,title:c,code:Z,enrichmentTargets:l}}else if(e.inputsValid!==void 0){const{sdkVersion:n,renderingMode:r,outputs:t,inputsValid:i,sections:o,initialArgs:s,code:a}=e,u=Object.keys(e);if(n===void 0||r===void 0||t===void 0||i===void 0||o===void 0||s===void 0)throw new Error(`Malformed config v2. SDK version ${n}; Fields = ${u.join(", ")}`);return{sdkVersion:n,renderingMode:r,initialArgs:s,outputs:Object.fromEntries(Object.entries(t).map(([c,l])=>[c,h(l)])),inputsValid:h(i),sections:h(o),initialUiState:void 0,code:a}}else if(e.renderingMode!==void 0){const{sdkVersion:n,canRun:r,renderingMode:t,outputs:i,sections:o,initialArgs:s,code:a}=e,u=Object.keys(e);if(t===void 0||i===void 0||r===void 0||o===void 0||s===void 0)throw new Error(`Malformed config v1. SDK version ${n}; Fields = ${u.join(", ")}`);return{sdkVersion:n??"unknown",renderingMode:t,initialArgs:s,outputs:Object.fromEntries(Object.entries(i).map(([c,l])=>[c,h(l)])),inputsValid:h(r),sections:h(o),initialUiState:void 0,code:a}}else{const{sdkVersion:n}=e,r=Object.keys(e);throw new Error(`Config format not supported: SDK = ${n}; Fields = ${r.join(", ")}`)}}function ie(e){return new URL(e).protocol=="plblob+folder:"}function oe(e){return new URL(e).protocol=="block-ui:"}const ae=m.z.object({from:m.z.number(),to:m.z.number()});function se(e,n){if(!(e==null||n==null))return{from:e,to:n}}function ue(e,n){if(e.from<0||e.to<0||e.from>=e.to)throw new Error(`${n}: invalid bytes range: ${e}`)}function ce(e){return e!==void 0&&e.startsWith("log+live://log/")}function k(e){throw new Error("Unexpected object: "+e)}const D="upload://upload/",j="index://index/";function J(e){return e.startsWith(D)}function T(e){return e.startsWith(j)}function N(e){if(T(e)){const n=e.slice(j.length);return JSON.parse(decodeURIComponent(n)).path}else if(J(e)){const n=e.slice(D.length);return JSON.parse(decodeURIComponent(n)).localPath}k(e)}function le(e){return e.replace(/^.*[\\/]/,"")}function de(e){return le(N(e))}function fe(e){if(!e||typeof e!="object")return!1;const n=e;if(!("type"in n))return!1;switch(n.type){case"Json":return typeof n.keyLength=="number"&&n.data!==void 0&&typeof n.data=="object";case"JsonPartitioned":return typeof n.partitionKeyLength=="number"&&n.parts!==void 0&&typeof n.parts=="object";case"BinaryPartitioned":return typeof n.partitionKeyLength=="number"&&n.parts!==void 0&&typeof n.parts=="object";default:return!1}}function me(e,n){if(e!==void 0)switch(e.type){case"Json":return e;case"JsonPartitioned":{const r={};for(const[t,i]of Object.entries(e.parts))r[t]=n(i);return{...e,parts:r}}case"BinaryPartitioned":{const r={};for(const[t,i]of Object.entries(e.parts))r[t]={index:n(i.index),values:n(i.values)};return{...e,parts:r}}}}function pe(e,n){switch(e.type){case"Json":break;case"JsonPartitioned":{for(const[r,t]of Object.entries(e.parts))n(t);break}case"BinaryPartitioned":{for(const[r,t]of Object.entries(e.parts))n(t.index),n(t.values);break}}}function L(e){if(!e||typeof e!="object")return!1;const n=e;if(!("type"in n))return!1;switch(n.type){case"Json":return typeof n.keyLength=="number"&&Array.isArray(n.data);case"JsonPartitioned":return typeof n.partitionKeyLength=="number"&&Array.isArray(n.parts);case"BinaryPartitioned":return typeof n.partitionKeyLength=="number"&&Array.isArray(n.parts);default:return!1}}function he(e){return L(e)?e.type==="JsonPartitioned"||e.type==="BinaryPartitioned":!1}function ye(e){switch(e.type){case"Json":{const n=Object.entries(e.data).map(([r,t])=>({key:JSON.parse(r),value:t}));return{type:"Json",keyLength:e.keyLength,data:n}}case"JsonPartitioned":{const n=Object.entries(e.parts).map(([r,t])=>({key:JSON.parse(r),value:t}));return{type:"JsonPartitioned",partitionKeyLength:e.partitionKeyLength,parts:n}}case"BinaryPartitioned":{const n=Object.entries(e.parts).map(([r,t])=>({key:JSON.parse(r),value:t}));return{type:"BinaryPartitioned",partitionKeyLength:e.partitionKeyLength,parts:n}}}}function be(e){switch(e.type){case"Json":{const n={};for(const r of e.data)n[JSON.stringify(r.key)]=r.value;return{type:"Json",keyLength:e.keyLength,data:n}}case"JsonPartitioned":{const n={};for(const r of e.parts)n[JSON.stringify(r.key)]=r.value;return{type:"JsonPartitioned",partitionKeyLength:e.partitionKeyLength,parts:n}}case"BinaryPartitioned":{const n={};for(const r of e.parts)n[JSON.stringify(r.key)]=r.value;return{type:"BinaryPartitioned",partitionKeyLength:e.partitionKeyLength,parts:n}}}}function ge(e,n){if(e!==void 0)switch(e.type){case"Json":return e;case"JsonPartitioned":{const r=e.parts.map(t=>({key:t.key,value:n(t.value)}));return{...e,parts:r}}case"BinaryPartitioned":{const r=e.parts.map(t=>({key:t.key,value:{index:n(t.value.index),values:n(t.value.values)}}));return{...e,parts:r}}}}function V(e,n){const r=Math.floor(n/8),t=1<<7-n%8;return(e[r]&t)>0}function ve(e,n){return V(e.absent,n)}function we(e,n){if(e.isNA)return V(e.isNA,n);const r=e.type,t=e.data[n];switch(r){case"Int":return t===-2147483648;case"Long":return t===-9007199254740991n;case"Float":return Number.isNaN(t);case"Double":return Number.isNaN(t);case"String":return t===null;case"Bytes":return t===null;default:throw Error(`unsupported data type: ${r}`)}}const $={type:"absent"};function Ae(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="absent"}const E=null;function B(e){return e===E}function Pe(e,n){return!(n?n(e):B(e))}function U(e,n,r){const t=e.type;if(t==="Bytes")throw Error("Bytes not yet supported");if(r&&"dataType"in r&&r.dataType!==void 0&&r.dataType!==t)throw Error(`expected column of type ${r.dataType}, got ${t}`);if(ve(e,n))return(r==null?void 0:r.absent)!==void 0?r.absent:$;if(we(e,n))return(r==null?void 0:r.na)!==void 0?r.na:E;const i=e.data[n];switch(t){case"Int":return i;case"Long":return Number(i);case"Float":return i;case"Double":return i;case"String":return i}}function ke(e,n,r){return U(e,n,r)}function Ee(e,n,r){return U(e,n,r)}function xe(e){return{kind:e.kind,valueType:e.valueType,name:e.name,domain:e.domain,parentAxes:e.parentAxes,axesId:x(e.axesSpec)}}function Se(e){return{columnId:e.id,spec:e.spec}}function p(e){const{type:n,name:r,domain:t}=e,i={type:n,name:r};return t&&Object.entries(t).length>0&&Object.assign(i,{domain:t}),i}function x(e){return e.map(p)}function Ie(e){return b(p(e))}function Ce(e,n){if(e===void 0)return n===void 0;if(n===void 0)return!0;for(const r in n)if(e[r]!==n[r])return!1;return!0}function z(e,n){return e.name===n.name&&Ce(e.domain,n.domain)}function Fe(e,n){return{...e,src:y(e.src,n)}}function y(e,n){switch(e.type){case"column":return{type:"column",column:n(e.column)};case"slicedColumn":return{type:"slicedColumn",column:n(e.column),newId:e.newId,axisFilters:e.axisFilters};case"inlineColumn":return e;case"inner":case"full":return{type:e.type,entries:e.entries.map(r=>y(r,n))};case"outer":return{type:"outer",primary:y(e.primary,n),secondary:e.secondary.map(r=>y(r,n))};default:k(e)}}function Re(e){switch(e.type){case"axis":return{type:"axis",id:e.id};case"column":return{type:"column",id:e.id}}}function M(e){return b(e)}function Oe(e){return JSON.parse(e)}function R(e){return b(p(e))}function O(e,n){return JSON.stringify([e,n])}class De{constructor(n){f(this,"domains",new Map);f(this,"axes",new Map);f(this,"domainPacks",[]);f(this,"domainPackToAnchor",new Map);this.anchors=n;const r=Object.entries(n);r.sort((t,i)=>t[0].localeCompare(i[0]));for(const[t,i]of r){for(let o=0;o<i.axesSpec.length;o++){const s=i.axesSpec[o],a=R(s);this.axes.set(a,{anchor:t,idx:o})}if(i.domain!==void 0){const o=Object.entries(i.domain);o.sort((s,a)=>s[0].localeCompare(a[0])),this.domainPackToAnchor.set(JSON.stringify(o),t),this.domainPacks.push(o.map(([s])=>s));for(const[s,a]of o){const u=O(s,a);this.domains.set(u,t)}}}}derive(n,r){const t={name:n.name,axes:[]};let i;if(n.domain!==void 0)e:for(const s of this.domainPacks){const a=[];for(const c of s){const l=n.domain[c];if(l!==void 0)a.push([c,l]);else break e}const u=this.domainPackToAnchor.get(JSON.stringify(a));if(u!==void 0){t.domainAnchor=u,i=new Set(s);break}}for(const[s,a]of Object.entries(n.domain??{})){if(i!==void 0&&i.has(s))continue;const u=O(s,a),c=this.domains.get(u);t.domain??(t.domain={}),t.domain[s]=c?{anchor:c}:a}if(t.axes=n.axesSpec.map(s=>{const a=R(s),u=this.axes.get(a);return u===void 0?p(s):u}),!r||r.length===0)return t;const o=[];for(const s of r){const[a,u]=s;if(typeof a=="number"){if(a<0||a>=n.axesSpec.length)throw new Error(`Axis index ${a} is out of bounds (0-${n.axesSpec.length-1})`);o.push([a,u])}else{const c=n.axesSpec.findIndex(l=>l.name===a);if(c===-1)throw new Error(`Axis with name "${a}" not found in the column specification`);o.push([c,u])}}return o.sort((s,a)=>s[0]-a[0]),{source:t,axisFilters:o}}deriveS(n,r){return M(this.derive(n,r))}}function je(e,n,r){const t={...n},i=(r==null?void 0:r.ignoreMissingDomains)??!1;if(t.domainAnchor!==void 0){const o=e[t.domainAnchor];if(!o)throw new Error(`Anchor "${t.domainAnchor}" not found`);const s=o.domain||{};t.domain={...s,...t.domain},delete t.domainAnchor}if(t.domain){const o={};for(const[s,a]of Object.entries(t.domain))if(typeof a=="string")o[s]=a;else{const u=e[a.anchor];if(!u)throw new Error(`Anchor "${a.anchor}" not found for domain key "${s}"`);if(!u.domain||u.domain[s]===void 0){if(!i)throw new Error(`Domain key "${s}" not found in anchor "${a.anchor}"`);continue}o[s]=u.domain[s]}t.domain=o}return t.axes&&(t.axes=t.axes.map(o=>Je(e,o))),t}function Je(e,n){if(!Te(n))return n;const r=n.anchor,t=e[r];if(!t)throw new Error(`Anchor "${r}" not found for axis reference`);if("idx"in n){if(n.idx<0||n.idx>=t.axesSpec.length)throw new Error(`Axis index ${n.idx} out of bounds for anchor "${r}"`);return t.axesSpec[n.idx]}else if("name"in n){const i=t.axesSpec.filter(o=>o.name===n.name);if(i.length>1)throw new Error(`Multiple axes with name "${n.name}" found in anchor "${r}"`);if(i.length===0)throw new Error(`Axis with name "${n.name}" not found in anchor "${r}"`);return i[0]}else if("id"in n){const i=t.axesSpec.filter(o=>z(n.id,p(o)));if(i.length>1)throw new Error(`Multiple matching axes found for matcher in anchor "${r}"`);if(i.length===0)throw new Error(`No matching axis found for matcher in anchor "${r}"`);return i[0]}throw new Error("Unsupported axis reference type")}function Te(e){return typeof e=="object"&&"anchor"in e}function Ne(e){return typeof e=="object"&&e!==null&&"source"in e&&"axisFilters"in e}function d(e){return e.kind==="PColumn"}function K(e){return d(e.spec)}function Le(e){return d(e.obj)}function Ve(e){return d(e.obj.spec)}function $e(e){if(!K(e))throw new Error(`not a PColumn (kind = ${e.spec.kind})`);return e}function Be(e,n){return e===void 0?void 0:{...e,data:n(e.data)}}function Ue(e){const n=new Map,r=t=>{switch(t.type){case"column":n.set(t.column.id,t.column);return;case"slicedColumn":n.set(t.column.id,t.column);return;case"inlineColumn":return;case"full":case"inner":for(const i of t.entries)r(i);return;case"outer":r(t.primary);for(const i of t.secondary)r(i);return;default:k(t)}};return r(e),[...n.values()]}function ze(e){throw new Error("Unexpected object: "+e)}function g(e,n){switch(e.type){case"and":for(const r of e.operands)if(!g(r,n))return!1;return!0;case"or":for(const r of e.operands)if(g(r,n))return!0;return!1;case"not":return!g(e.operand,n);case"name":return d(n)&&n.name===e.name;case"name_pattern":return d(n)&&!!n.name.match(e.pattern);case"annotation":return d(n)&&n.annotations!==void 0&&n.annotations[e.annotation]===e.value;case"annotation_pattern":return d(n)&&n.annotations!==void 0&&n.annotations[e.annotation]!==void 0&&!!n.annotations[e.annotation].match(e.pattern);case"has_axes":return d(n)&&e.axes.every(r=>n.axesSpec.some(t=>(r.type===void 0||r.type===t.type)&&(r.name===void 0||r.name===t.name)&&(r.domain===void 0||Object.keys(r.domain).length===0||t.domain!==void 0&&Object.entries(r.domain).every(([i,o])=>t.domain[i]===o))));default:ze(e)}}function A(e,n){if(e.name!==void 0&&e.name!==n.name)return!1;if(e.type!==void 0){if(Array.isArray(e.type)){if(!e.type.includes(n.type))return!1}else if(e.type!==n.type)return!1}if(e.domain!==void 0){const r=n.domain||{};for(const[t,i]of Object.entries(e.domain))if(r[t]!==i)return!1}return!0}function P(e,n){if(n.name!==void 0&&e.name!==n.name||n.namePattern!==void 0&&!new RegExp(n.namePattern).test(e.name))return!1;if(n.type!==void 0){if(Array.isArray(n.type)){if(!n.type.includes(e.valueType))return!1}else if(n.type!==e.valueType)return!1}if(n.domain!==void 0){const r=e.domain||{};for(const[t,i]of Object.entries(n.domain))if(r[t]!==i)return!1}if(n.axes!==void 0){const r=e.axesSpec.map(p);if(n.partialAxesMatch){for(const t of n.axes)if(!r.some(i=>A(t,i)))return!1}else{if(r.length!==n.axes.length)return!1;for(let t=0;t<n.axes.length;t++)if(!A(n.axes[t],r[t]))return!1}}if(n.annotations!==void 0){const r=e.annotations||{};for(const[t,i]of Object.entries(n.annotations))if(r[t]!==i)return!1}if(n.annotationPatterns!==void 0){const r=e.annotations||{};for(const[t,i]of Object.entries(n.annotationPatterns)){const o=r[t];if(o===void 0||!new RegExp(i).test(o))return!1}}return!0}function Me(e){return Array.isArray(e)?n=>e.some(r=>d(n)&&P(n,r)):n=>d(n)&&P(n,e)}function Ke(e){const n={kind:e.kind,name:e.name};return e.domain!==void 0&&(n.domain=e.domain),d(e)&&(n.axesSpec=x(e.axesSpec)),b(n)}const qe={href:"/"},_e=m.z.object({__isRef:m.z.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),blockId:m.z.string().describe("Upstream block id"),name:m.z.string().describe("Name of the output provided to the upstream block's output context"),requireEnrichments:m.z.literal(!0).optional().describe("True if current block that stores this reference in its args, may need enrichments for the references value originating from the blocks in between current and referenced block")}).describe("Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees.").readonly();function He(e){return typeof e=="object"&&e!==null&&"__isRef"in e&&e.__isRef===!0&&"blockId"in e&&"name"in e}function We(e,n,r=!1){return r?{__isRef:!0,blockId:e,name:n,requireEnrichments:!0}:{__isRef:!0,blockId:e,name:n}}function Ge(e,n=!0){if(n)return{...e,requireEnrichments:!0};{const{requireEnrichments:r,...t}=e;return t}}function Xe(e,n,r=!1){return e.blockId===n.blockId&&e.name===n.name&&(r||e.requireEnrichments===n.requireEnrichments)}function Qe(e,n){return e.ok?{ok:!0,value:n(e.value)}:e}function Ye(e){if(e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray)return new DataView(e.buffer,e.byteOffset,e.byteLength);if(e instanceof ArrayBuffer)return new DataView(e);throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray")}const Ze="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",en="0123456789ABCDEFGHIJKLMNOPQRSTUV",nn="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function q(e,n,r){r=r||{};let t,i;switch(n){case"RFC3548":case"RFC4648":t=Ze,i=!0;break;case"RFC4648-HEX":t=en,i=!0;break;case"Crockford":t=nn,i=!1;break;default:throw new Error("Unknown base32 variant: "+String(n))}const o=r.padding!==void 0?r.padding:i,s=Ye(e);let a=0,u=0,c="";for(let l=0;l<s.byteLength;l++)for(u=u<<8|s.getUint8(l),a+=8;a>=5;)c+=t[u>>>a-5&31],a-=5;if(a>0&&(c+=t[u<<5-a&31]),o)for(;c.length%8!==0;)c+="=";return c}const S=15,_=24,I=m.z.string().length(_).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");function rn(){const e=new Uint8Array(S);return crypto.getRandomValues(e),I.parse(q(e,"RFC4648"))}function H(e){if(e.length!==S)throw new Error(`Wrong number of bytes: ${e.length}`);return I.parse(q(e,"RFC4648"))}async function tn(e){const n=new TextEncoder,r=await crypto.subtle.digest("SHA-256",n.encode(e));return H(new Uint8Array(r.slice(0,15)))}function on(e){return JSON.stringify(e)}function an(e){return b(e)}function sn(e){return JSON.parse(e)}class un extends Error{constructor(){super(...arguments);f(this,"name","AbortError")}}class cn extends Error{constructor(){super(...arguments);f(this,"name","UiError")}}function ln(e){return e instanceof Error&&e.name==="AbortError"}function W(e){return e instanceof Error?e.name==="AbortError"||W(e.cause):!1}function dn(e){return e instanceof Error&&e.name==="AggregateError"}class G extends Error{constructor(){super(...arguments);f(this,"name","PFrameError")}}function fn(e){return e instanceof Error&&e.name==="PFrameError"}class mn extends G{constructor(){super(...arguments);f(this,"name","PFrameError.Driver")}}function pn(e){return e instanceof Error&&e.name==="PFrameError.Driver"}function hn(e){if(typeof e=="string")return`String value was thrown: ${e}`;if(e&&typeof e=="object")try{return`Plain object was thrown: ${JSON.stringify(e)}`}catch(n){return`Non-serializable object was thrown (JSON.stringify failed: ${n instanceof Error?n.message:String(n)}): ${String(e)}`}return`Non-Error value (${typeof e}) was thrown: ${e}`}function v(e){return e instanceof Error?e:new Error(hn(e))}function w(e){const n=e.cause?w(e.cause):void 0,r=new Error(e.message,n!==void 0?{cause:n}:void 0);return r.name=e.name||"Error",r.stack=e.stack,r}function C(e){const n=v(e),r=n.cause?C(n.cause):void 0;return{name:n.name,message:n.message,stack:n.stack,...n.cause!==void 0&&{cause:r}}}function yn(e){if(e.error)throw e.error instanceof Error?e.error:w(e.error);return e.value}function F(e){return e.error?{error:C(e.error)}:{value:e.value}}function bn(e){return e.error?{error:w(e.error)}:{value:e.value}}function X(e){try{return{value:e()}}catch(n){return{error:v(n)}}}async function Q(e){try{return{value:await e()}}catch(n){return{error:v(n)}}}function gn(e){const n=X(e);return F(n)}async function vn(e){const n=await Q(e);return F(n)}const wn=["supportsLazyState"],An=["requiresUIAPIVersion","requiresModelAPIVersion"];function Pn(e,n,r=!0){return e===void 0?!1:e[n]===r}function kn(e){return e===void 0?new Set:new Set(Object.entries(e).filter(([n,r])=>n.startsWith("requires")&&r===!0).map(([n])=>n))}function En(e){return e===void 0?new Set:new Set(Object.entries(e).filter(([n,r])=>n.startsWith("supports")&&r===!0).map(([n])=>n))}class Y extends Error{constructor(r){super(`Some of the block requirements are not supported by the runtime: ${Array.from(r.entries()).map(([t,i])=>`${t}: ${i}`).join(", ")}`);f(this,"name","IncompatibleFlagsError");this.incompatibleFlags=r}}class xn{constructor(){f(this,"supportedRequirements",new Map)}addSupportedRequirement(n,r=!0){return this.supportedRequirements.has(n)||this.supportedRequirements.set(n,new Set),this.supportedRequirements.get(n).add(r),this}getIncompatibleFlags(n){if(n===void 0)return;const r=new Map;for(const[t,i]of Object.entries(n))if(t.startsWith("requires")){if(i===void 0)continue;const o=this.supportedRequirements.get(t);(o===void 0||!o.has(i))&&r.set(t,i)}return r.size===0?void 0:r}checkCompatibility(n){return this.getIncompatibleFlags(n)===void 0}throwIfIncompatible(n){const r=this.getIncompatibleFlags(n);if(r!==void 0)throw new Y(r)}}exports.AbortError=un;exports.AllRequiresFeatureFlags=An;exports.AllSupportsFeatureFlags=wn;exports.AnchoredIdDeriver=De;exports.DefaultNavigationState=qe;exports.IncompatibleFlagsError=Y;exports.PFrameDriverError=mn;exports.PFrameError=G;exports.PTableAbsent=$;exports.PTableNA=E;exports.PlId=I;exports.PlIdBytes=S;exports.PlIdLength=_;exports.PlRef=_e;exports.RangeBytes=ae;exports.RuntimeCapabilities=xn;exports.UiError=cn;exports.canonicalizeAxisId=Ie;exports.canonicalizeJson=an;exports.checkBlockFlag=Pn;exports.createPlRef=We;exports.dataInfoToEntries=ye;exports.deriveNativeId=Ke;exports.deserializeError=w;exports.deserializeResult=bn;exports.digestPlId=tn;exports.ensureError=v;exports.ensurePColumn=$e;exports.entriesToDataInfo=be;exports.executePSpecPredicate=g;exports.extractAllColumns=Ue;exports.extractAllRequirements=kn;exports.extractAllSupports=En;exports.extractCodeWithInfo=re;exports.extractConfigGeneric=te;exports.getAxesId=x;exports.getAxisId=p;exports.getColumnIdAndSpec=Se;exports.getFileNameFromHandle=de;exports.getFilePathFromHandle=N;exports.getPColumnSpecId=xe;exports.getPTableColumnId=Re;exports.hasAbortError=W;exports.isAbortError=ln;exports.isAggregateError=dn;exports.isBlockUIURL=oe;exports.isDataInfo=fe;exports.isDataInfoEntries=L;exports.isFilteredPColumn=Ne;exports.isFolderURL=ie;exports.isImportFileHandleIndex=T;exports.isImportFileHandleUpload=J;exports.isLiveLog=ce;exports.isPColumn=K;exports.isPColumnResult=Ve;exports.isPColumnSpec=d;exports.isPColumnSpecResult=Le;exports.isPFrameDriverError=pn;exports.isPFrameError=fn;exports.isPTableAbsent=Ae;exports.isPTableNA=B;exports.isPTableValueAxis=Pe;exports.isPartitionedDataInfoEntries=he;exports.isPlRef=He;exports.mapDataInfo=me;exports.mapDataInfoEntries=ge;exports.mapJoinEntry=y;exports.mapPObjectData=Be;exports.mapPTableDef=Fe;exports.mapValueInVOE=Qe;exports.matchAxis=A;exports.matchAxisId=z;exports.matchPColumn=P;exports.newRangeBytesOpt=se;exports.pTableValue=ke;exports.pTableValueBranded=Ee;exports.parseColumnId=Oe;exports.parseJson=sn;exports.plId=H;exports.plRefsEqual=Xe;exports.resolveAnchors=je;exports.selectorsToPredicate=Me;exports.serializeError=C;exports.serializeResult=F;exports.stringifyColumnId=M;exports.stringifyJson=on;exports.uniquePlId=rn;exports.unwrapResult=yn;exports.validateRangeBytes=ue;exports.visitDataInfo=pe;exports.withEnrichments=Ge;exports.wrapAndSerialize=gn;exports.wrapAndSerializeAsync=vn;exports.wrapAsyncCallback=Q;exports.wrapCallback=X;
1
+ "use strict";var ee=Object.defineProperty;var ne=(e,n,r)=>n in e?ee(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var f=(e,n,r)=>ne(e,typeof n!="symbol"?n+"":n,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("zod"),b=require("canonicalize");function re(e){if(e.code!==void 0)return{code:e.code,sdkVersion:e.sdkVersion,featureFlags:e.featureFlags}}function h(e){if(e!==void 0)return typeof e=="string"?{__renderLambda:!0,handle:e,retentive:!1}:e}function te(e){if(e.v3!==void 0){const{initialArgs:n,initialUiState:r,inputsValid:t,outputs:i,renderingMode:o,sdkVersion:s,featureFlags:a,sections:u,title:c,enrichmentTargets:l}=e.v3,{code:Z}=e;return{initialArgs:n,initialUiState:r,inputsValid:t,outputs:i,renderingMode:o,sdkVersion:s,featureFlags:a,sections:u,title:c,code:Z,enrichmentTargets:l}}else if(e.inputsValid!==void 0){const{sdkVersion:n,renderingMode:r,outputs:t,inputsValid:i,sections:o,initialArgs:s,code:a}=e,u=Object.keys(e);if(n===void 0||r===void 0||t===void 0||i===void 0||o===void 0||s===void 0)throw new Error(`Malformed config v2. SDK version ${n}; Fields = ${u.join(", ")}`);return{sdkVersion:n,renderingMode:r,initialArgs:s,outputs:Object.fromEntries(Object.entries(t).map(([c,l])=>[c,h(l)])),inputsValid:h(i),sections:h(o),initialUiState:void 0,code:a}}else if(e.renderingMode!==void 0){const{sdkVersion:n,canRun:r,renderingMode:t,outputs:i,sections:o,initialArgs:s,code:a}=e,u=Object.keys(e);if(t===void 0||i===void 0||r===void 0||o===void 0||s===void 0)throw new Error(`Malformed config v1. SDK version ${n}; Fields = ${u.join(", ")}`);return{sdkVersion:n??"unknown",renderingMode:t,initialArgs:s,outputs:Object.fromEntries(Object.entries(i).map(([c,l])=>[c,h(l)])),inputsValid:h(r),sections:h(o),initialUiState:void 0,code:a}}else{const{sdkVersion:n}=e,r=Object.keys(e);throw new Error(`Config format not supported: SDK = ${n}; Fields = ${r.join(", ")}`)}}function ie(e){return new URL(e).protocol=="plblob+folder:"}function oe(e){return new URL(e).protocol=="block-ui:"}const ae=m.z.object({from:m.z.number(),to:m.z.number()});function se(e,n){if(!(e==null||n==null))return{from:e,to:n}}function ue(e,n){if(e.from<0||e.to<0||e.from>=e.to)throw new Error(`${n}: invalid bytes range: ${e}`)}function ce(e){return e!==void 0&&e.startsWith("log+live://log/")}function g(e){throw new Error("Unexpected object: "+e)}const j="upload://upload/",D="index://index/";function J(e){return e.startsWith(j)}function N(e){return e.startsWith(D)}function T(e){if(N(e)){const n=e.slice(D.length);return JSON.parse(decodeURIComponent(n)).path}else if(J(e)){const n=e.slice(j.length);return JSON.parse(decodeURIComponent(n)).localPath}g(e)}function le(e){return e.replace(/^.*[\\/]/,"")}function de(e){return le(T(e))}function fe(e){if(!e||typeof e!="object")return!1;const n=e;if(!("type"in n))return!1;switch(n.type){case"Json":return typeof n.keyLength=="number"&&n.data!==void 0&&typeof n.data=="object";case"JsonPartitioned":case"BinaryPartitioned":case"ParquetPartitioned":return typeof n.partitionKeyLength=="number"&&n.parts!==void 0&&typeof n.parts=="object";default:return!1}}function me(e,n){if(e!==void 0)switch(e.type){case"Json":return e;case"JsonPartitioned":{const r={};for(const[t,i]of Object.entries(e.parts))r[t]=n(i);return{...e,parts:r}}case"BinaryPartitioned":{const r={};for(const[t,i]of Object.entries(e.parts))r[t]={index:n(i.index),values:n(i.values)};return{...e,parts:r}}case"ParquetPartitioned":{const r={};for(const[t,i]of Object.entries(e.parts))r[t]=n(i);return{...e,parts:r}}}}function pe(e,n){switch(e.type){case"Json":break;case"JsonPartitioned":{Object.values(e.parts).forEach(n);break}case"BinaryPartitioned":{Object.values(e.parts).forEach(r=>{n(r.index),n(r.values)});break}case"ParquetPartitioned":{Object.values(e.parts).forEach(n);break}}}function L(e){if(!e||typeof e!="object")return!1;const n=e;if(!("type"in n))return!1;switch(n.type){case"Json":return typeof n.keyLength=="number"&&Array.isArray(n.data);case"JsonPartitioned":case"BinaryPartitioned":case"ParquetPartitioned":return typeof n.partitionKeyLength=="number"&&Array.isArray(n.parts);default:return!1}}function he(e){if(!L(e))return!1;switch(e.type){case"JsonPartitioned":case"BinaryPartitioned":case"ParquetPartitioned":return!0;default:return!1}}function ye(e){switch(e.type){case"Json":return{type:"Json",keyLength:e.keyLength,data:Object.entries(e.data).map(([n,r])=>({key:JSON.parse(n),value:r}))};case"JsonPartitioned":return{type:"JsonPartitioned",partitionKeyLength:e.partitionKeyLength,parts:Object.entries(e.parts).map(([n,r])=>({key:JSON.parse(n),value:r}))};case"BinaryPartitioned":return{type:"BinaryPartitioned",partitionKeyLength:e.partitionKeyLength,parts:Object.entries(e.parts).map(([n,r])=>({key:JSON.parse(n),value:r}))};case"ParquetPartitioned":return{type:"ParquetPartitioned",partitionKeyLength:e.partitionKeyLength,parts:Object.entries(e.parts).map(([n,r])=>({key:JSON.parse(n),value:r}))};default:g(e)}}function be(e){switch(e.type){case"Json":return{type:"Json",keyLength:e.keyLength,data:Object.fromEntries(e.data.map(({key:n,value:r})=>[JSON.stringify(n),r]))};case"JsonPartitioned":return{type:"JsonPartitioned",partitionKeyLength:e.partitionKeyLength,parts:Object.fromEntries(e.parts.map(({key:n,value:r})=>[JSON.stringify(n),r]))};case"BinaryPartitioned":return{type:"BinaryPartitioned",partitionKeyLength:e.partitionKeyLength,parts:Object.fromEntries(e.parts.map(({key:n,value:r})=>[JSON.stringify(n),r]))};case"ParquetPartitioned":return{type:"ParquetPartitioned",partitionKeyLength:e.partitionKeyLength,parts:Object.fromEntries(e.parts.map(({key:n,value:r})=>[JSON.stringify(n),r]))};default:g(e)}}function ge(e,n){if(e!==void 0)switch(e.type){case"Json":return e;case"JsonPartitioned":return{...e,parts:e.parts.map(r=>({key:r.key,value:n(r.value)}))};case"BinaryPartitioned":return{...e,parts:e.parts.map(r=>({key:r.key,value:{index:n(r.value.index),values:n(r.value.values)}}))};case"ParquetPartitioned":return{...e,parts:e.parts.map(r=>({key:r.key,value:n(r.value)}))}}}function V(e,n){const r=Math.floor(n/8),t=1<<7-n%8;return(e[r]&t)>0}function ve(e,n){return V(e.absent,n)}function Pe(e,n){if(e.isNA)return V(e.isNA,n);const r=e.type,t=e.data[n];switch(r){case"Int":return t===-2147483648;case"Long":return t===-9007199254740991n;case"Float":return Number.isNaN(t);case"Double":return Number.isNaN(t);case"String":return t===null;case"Bytes":return t===null;default:throw Error(`unsupported data type: ${r}`)}}const $={type:"absent"};function we(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="absent"}const E=null;function B(e){return e===E}function Ae(e,n){return!(n?n(e):B(e))}function U(e,n,r){const t=e.type;if(t==="Bytes")throw Error("Bytes not yet supported");if(r&&"dataType"in r&&r.dataType!==void 0&&r.dataType!==t)throw Error(`expected column of type ${r.dataType}, got ${t}`);if(ve(e,n))return(r==null?void 0:r.absent)!==void 0?r.absent:$;if(Pe(e,n))return(r==null?void 0:r.na)!==void 0?r.na:E;const i=e.data[n];switch(t){case"Int":return i;case"Long":return Number(i);case"Float":return i;case"Double":return i;case"String":return i}}function ke(e,n,r){return U(e,n,r)}function Ee(e,n,r){return U(e,n,r)}function xe(e){return{kind:e.kind,valueType:e.valueType,name:e.name,domain:e.domain,parentAxes:e.parentAxes,axesId:x(e.axesSpec)}}function Se(e){return{columnId:e.id,spec:e.spec}}function p(e){const{type:n,name:r,domain:t}=e,i={type:n,name:r};return t&&Object.entries(t).length>0&&Object.assign(i,{domain:t}),i}function x(e){return e.map(p)}function Ce(e){return b(p(e))}function Oe(e,n){if(e===void 0)return n===void 0;if(n===void 0)return!0;for(const r in n)if(e[r]!==n[r])return!1;return!0}function q(e,n){return e.name===n.name&&Oe(e.domain,n.domain)}function Ie(e,n){return{...e,src:y(e.src,n)}}function y(e,n){switch(e.type){case"column":return{type:"column",column:n(e.column)};case"slicedColumn":return{type:"slicedColumn",column:n(e.column),newId:e.newId,axisFilters:e.axisFilters};case"inlineColumn":return e;case"inner":case"full":return{type:e.type,entries:e.entries.map(r=>y(r,n))};case"outer":return{type:"outer",primary:y(e.primary,n),secondary:e.secondary.map(r=>y(r,n))};default:g(e)}}function Fe(e){switch(e.type){case"axis":return{type:"axis",id:e.id};case"column":return{type:"column",id:e.id}}}function z(e){return b(e)}function Re(e){return JSON.parse(e)}function F(e){return b(p(e))}function R(e,n){return JSON.stringify([e,n])}class je{constructor(n){f(this,"domains",new Map);f(this,"axes",new Map);f(this,"domainPacks",[]);f(this,"domainPackToAnchor",new Map);this.anchors=n;const r=Object.entries(n);r.sort((t,i)=>t[0].localeCompare(i[0]));for(const[t,i]of r){for(let o=0;o<i.axesSpec.length;o++){const s=i.axesSpec[o],a=F(s);this.axes.set(a,{anchor:t,idx:o})}if(i.domain!==void 0){const o=Object.entries(i.domain);o.sort((s,a)=>s[0].localeCompare(a[0])),this.domainPackToAnchor.set(JSON.stringify(o),t),this.domainPacks.push(o.map(([s])=>s));for(const[s,a]of o){const u=R(s,a);this.domains.set(u,t)}}}}derive(n,r){const t={name:n.name,axes:[]};let i;if(n.domain!==void 0)e:for(const s of this.domainPacks){const a=[];for(const c of s){const l=n.domain[c];if(l!==void 0)a.push([c,l]);else break e}const u=this.domainPackToAnchor.get(JSON.stringify(a));if(u!==void 0){t.domainAnchor=u,i=new Set(s);break}}for(const[s,a]of Object.entries(n.domain??{})){if(i!==void 0&&i.has(s))continue;const u=R(s,a),c=this.domains.get(u);t.domain??(t.domain={}),t.domain[s]=c?{anchor:c}:a}if(t.axes=n.axesSpec.map(s=>{const a=F(s),u=this.axes.get(a);return u===void 0?p(s):u}),!r||r.length===0)return t;const o=[];for(const s of r){const[a,u]=s;if(typeof a=="number"){if(a<0||a>=n.axesSpec.length)throw new Error(`Axis index ${a} is out of bounds (0-${n.axesSpec.length-1})`);o.push([a,u])}else{const c=n.axesSpec.findIndex(l=>l.name===a);if(c===-1)throw new Error(`Axis with name "${a}" not found in the column specification`);o.push([c,u])}}return o.sort((s,a)=>s[0]-a[0]),{source:t,axisFilters:o}}deriveS(n,r){return z(this.derive(n,r))}}function De(e,n,r){const t={...n},i=(r==null?void 0:r.ignoreMissingDomains)??!1;if(t.domainAnchor!==void 0){const o=e[t.domainAnchor];if(!o)throw new Error(`Anchor "${t.domainAnchor}" not found`);const s=o.domain||{};t.domain={...s,...t.domain},delete t.domainAnchor}if(t.domain){const o={};for(const[s,a]of Object.entries(t.domain))if(typeof a=="string")o[s]=a;else{const u=e[a.anchor];if(!u)throw new Error(`Anchor "${a.anchor}" not found for domain key "${s}"`);if(!u.domain||u.domain[s]===void 0){if(!i)throw new Error(`Domain key "${s}" not found in anchor "${a.anchor}"`);continue}o[s]=u.domain[s]}t.domain=o}return t.axes&&(t.axes=t.axes.map(o=>Je(e,o))),t}function Je(e,n){if(!Ne(n))return n;const r=n.anchor,t=e[r];if(!t)throw new Error(`Anchor "${r}" not found for axis reference`);if("idx"in n){if(n.idx<0||n.idx>=t.axesSpec.length)throw new Error(`Axis index ${n.idx} out of bounds for anchor "${r}"`);return t.axesSpec[n.idx]}else if("name"in n){const i=t.axesSpec.filter(o=>o.name===n.name);if(i.length>1)throw new Error(`Multiple axes with name "${n.name}" found in anchor "${r}"`);if(i.length===0)throw new Error(`Axis with name "${n.name}" not found in anchor "${r}"`);return i[0]}else if("id"in n){const i=t.axesSpec.filter(o=>q(n.id,p(o)));if(i.length>1)throw new Error(`Multiple matching axes found for matcher in anchor "${r}"`);if(i.length===0)throw new Error(`No matching axis found for matcher in anchor "${r}"`);return i[0]}throw new Error("Unsupported axis reference type")}function Ne(e){return typeof e=="object"&&"anchor"in e}function Te(e){return typeof e=="object"&&e!==null&&"source"in e&&"axisFilters"in e}function d(e){return e.kind==="PColumn"}function K(e){return d(e.spec)}function Le(e){return d(e.obj)}function Ve(e){return d(e.obj.spec)}function $e(e){if(!K(e))throw new Error(`not a PColumn (kind = ${e.spec.kind})`);return e}function Be(e,n){return e===void 0?void 0:{...e,data:n(e.data)}}function Ue(e){const n=new Map,r=t=>{switch(t.type){case"column":n.set(t.column.id,t.column);return;case"slicedColumn":n.set(t.column.id,t.column);return;case"inlineColumn":return;case"full":case"inner":for(const i of t.entries)r(i);return;case"outer":r(t.primary);for(const i of t.secondary)r(i);return;default:g(t)}};return r(e),[...n.values()]}function qe(e){throw new Error("Unexpected object: "+e)}function v(e,n){switch(e.type){case"and":for(const r of e.operands)if(!v(r,n))return!1;return!0;case"or":for(const r of e.operands)if(v(r,n))return!0;return!1;case"not":return!v(e.operand,n);case"name":return d(n)&&n.name===e.name;case"name_pattern":return d(n)&&!!n.name.match(e.pattern);case"annotation":return d(n)&&n.annotations!==void 0&&n.annotations[e.annotation]===e.value;case"annotation_pattern":return d(n)&&n.annotations!==void 0&&n.annotations[e.annotation]!==void 0&&!!n.annotations[e.annotation].match(e.pattern);case"has_axes":return d(n)&&e.axes.every(r=>n.axesSpec.some(t=>(r.type===void 0||r.type===t.type)&&(r.name===void 0||r.name===t.name)&&(r.domain===void 0||Object.keys(r.domain).length===0||t.domain!==void 0&&Object.entries(r.domain).every(([i,o])=>t.domain[i]===o))));default:qe(e)}}function A(e,n){if(e.name!==void 0&&e.name!==n.name)return!1;if(e.type!==void 0){if(Array.isArray(e.type)){if(!e.type.includes(n.type))return!1}else if(e.type!==n.type)return!1}if(e.domain!==void 0){const r=n.domain||{};for(const[t,i]of Object.entries(e.domain))if(r[t]!==i)return!1}return!0}function k(e,n){if(n.name!==void 0&&e.name!==n.name||n.namePattern!==void 0&&!new RegExp(n.namePattern).test(e.name))return!1;if(n.type!==void 0){if(Array.isArray(n.type)){if(!n.type.includes(e.valueType))return!1}else if(n.type!==e.valueType)return!1}if(n.domain!==void 0){const r=e.domain||{};for(const[t,i]of Object.entries(n.domain))if(r[t]!==i)return!1}if(n.axes!==void 0){const r=e.axesSpec.map(p);if(n.partialAxesMatch){for(const t of n.axes)if(!r.some(i=>A(t,i)))return!1}else{if(r.length!==n.axes.length)return!1;for(let t=0;t<n.axes.length;t++)if(!A(n.axes[t],r[t]))return!1}}if(n.annotations!==void 0){const r=e.annotations||{};for(const[t,i]of Object.entries(n.annotations))if(r[t]!==i)return!1}if(n.annotationPatterns!==void 0){const r=e.annotations||{};for(const[t,i]of Object.entries(n.annotationPatterns)){const o=r[t];if(o===void 0||!new RegExp(i).test(o))return!1}}return!0}function ze(e){return Array.isArray(e)?n=>e.some(r=>d(n)&&k(n,r)):n=>d(n)&&k(n,e)}function Ke(e){const n={kind:e.kind,name:e.name};return e.domain!==void 0&&(n.domain=e.domain),d(e)&&(n.axesSpec=x(e.axesSpec)),b(n)}const Me={href:"/"},_e=m.z.object({__isRef:m.z.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),blockId:m.z.string().describe("Upstream block id"),name:m.z.string().describe("Name of the output provided to the upstream block's output context"),requireEnrichments:m.z.literal(!0).optional().describe("True if current block that stores this reference in its args, may need enrichments for the references value originating from the blocks in between current and referenced block")}).describe("Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees.").readonly();function He(e){return typeof e=="object"&&e!==null&&"__isRef"in e&&e.__isRef===!0&&"blockId"in e&&"name"in e}function We(e,n,r=!1){return r?{__isRef:!0,blockId:e,name:n,requireEnrichments:!0}:{__isRef:!0,blockId:e,name:n}}function Ge(e,n=!0){if(n)return{...e,requireEnrichments:!0};{const{requireEnrichments:r,...t}=e;return t}}function Xe(e,n,r=!1){return e.blockId===n.blockId&&e.name===n.name&&(r||e.requireEnrichments===n.requireEnrichments)}function Qe(e,n){return e.ok?{ok:!0,value:n(e.value)}:e}function Ye(e){if(e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray)return new DataView(e.buffer,e.byteOffset,e.byteLength);if(e instanceof ArrayBuffer)return new DataView(e);throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray")}const Ze="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",en="0123456789ABCDEFGHIJKLMNOPQRSTUV",nn="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function M(e,n,r){r=r||{};let t,i;switch(n){case"RFC3548":case"RFC4648":t=Ze,i=!0;break;case"RFC4648-HEX":t=en,i=!0;break;case"Crockford":t=nn,i=!1;break;default:throw new Error("Unknown base32 variant: "+String(n))}const o=r.padding!==void 0?r.padding:i,s=Ye(e);let a=0,u=0,c="";for(let l=0;l<s.byteLength;l++)for(u=u<<8|s.getUint8(l),a+=8;a>=5;)c+=t[u>>>a-5&31],a-=5;if(a>0&&(c+=t[u<<5-a&31]),o)for(;c.length%8!==0;)c+="=";return c}const S=15,_=24,C=m.z.string().length(_).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");function rn(){const e=new Uint8Array(S);return crypto.getRandomValues(e),C.parse(M(e,"RFC4648"))}function H(e){if(e.length!==S)throw new Error(`Wrong number of bytes: ${e.length}`);return C.parse(M(e,"RFC4648"))}async function tn(e){const n=new TextEncoder,r=await crypto.subtle.digest("SHA-256",n.encode(e));return H(new Uint8Array(r.slice(0,15)))}function on(e){return JSON.stringify(e)}function an(e){return b(e)}function sn(e){return JSON.parse(e)}class un extends Error{constructor(){super(...arguments);f(this,"name","AbortError")}}class cn extends Error{constructor(){super(...arguments);f(this,"name","UiError")}}function ln(e){return e instanceof Error&&e.name==="AbortError"}function W(e){return e instanceof Error?e.name==="AbortError"||W(e.cause):!1}function dn(e){return e instanceof Error&&e.name==="AggregateError"}class G extends Error{constructor(){super(...arguments);f(this,"name","PFrameError")}}function fn(e){return e instanceof Error&&e.name==="PFrameError"}class mn extends G{constructor(){super(...arguments);f(this,"name","PFrameError.Driver")}}function pn(e){return e instanceof Error&&e.name==="PFrameError.Driver"}function hn(e){if(typeof e=="string")return`String value was thrown: ${e}`;if(e&&typeof e=="object")try{return`Plain object was thrown: ${JSON.stringify(e)}`}catch(n){return`Non-serializable object was thrown (JSON.stringify failed: ${n instanceof Error?n.message:String(n)}): ${String(e)}`}return`Non-Error value (${typeof e}) was thrown: ${e}`}function P(e){return e instanceof Error?e:new Error(hn(e))}function w(e){const n=e.cause?w(e.cause):void 0,r=new Error(e.message,n!==void 0?{cause:n}:void 0);return r.name=e.name||"Error",r.stack=e.stack,r}function O(e){const n=P(e),r=n.cause?O(n.cause):void 0;return{name:n.name,message:n.message,stack:n.stack,...n.cause!==void 0&&{cause:r}}}function yn(e){if(e.error)throw e.error instanceof Error?e.error:w(e.error);return e.value}function I(e){return e.error?{error:O(e.error)}:{value:e.value}}function bn(e){return e.error?{error:w(e.error)}:{value:e.value}}function X(e){try{return{value:e()}}catch(n){return{error:P(n)}}}async function Q(e){try{return{value:await e()}}catch(n){return{error:P(n)}}}function gn(e){const n=X(e);return I(n)}async function vn(e){const n=await Q(e);return I(n)}const Pn=["supportsLazyState"],wn=["requiresUIAPIVersion","requiresModelAPIVersion"];function An(e,n,r=!0){return e===void 0?!1:e[n]===r}function kn(e){return e===void 0?new Set:new Set(Object.entries(e).filter(([n,r])=>n.startsWith("requires")&&r===!0).map(([n])=>n))}function En(e){return e===void 0?new Set:new Set(Object.entries(e).filter(([n,r])=>n.startsWith("supports")&&r===!0).map(([n])=>n))}class Y extends Error{constructor(r){super(`Some of the block requirements are not supported by the runtime: ${Array.from(r.entries()).map(([t,i])=>`${t}: ${i}`).join(", ")}`);f(this,"name","IncompatibleFlagsError");this.incompatibleFlags=r}}class xn{constructor(){f(this,"supportedRequirements",new Map)}addSupportedRequirement(n,r=!0){return this.supportedRequirements.has(n)||this.supportedRequirements.set(n,new Set),this.supportedRequirements.get(n).add(r),this}getIncompatibleFlags(n){if(n===void 0)return;const r=new Map;for(const[t,i]of Object.entries(n))if(t.startsWith("requires")){if(i===void 0)continue;const o=this.supportedRequirements.get(t);(o===void 0||!o.has(i))&&r.set(t,i)}return r.size===0?void 0:r}checkCompatibility(n){return this.getIncompatibleFlags(n)===void 0}throwIfIncompatible(n){const r=this.getIncompatibleFlags(n);if(r!==void 0)throw new Y(r)}}exports.AbortError=un;exports.AllRequiresFeatureFlags=wn;exports.AllSupportsFeatureFlags=Pn;exports.AnchoredIdDeriver=je;exports.DefaultNavigationState=Me;exports.IncompatibleFlagsError=Y;exports.PFrameDriverError=mn;exports.PFrameError=G;exports.PTableAbsent=$;exports.PTableNA=E;exports.PlId=C;exports.PlIdBytes=S;exports.PlIdLength=_;exports.PlRef=_e;exports.RangeBytes=ae;exports.RuntimeCapabilities=xn;exports.UiError=cn;exports.canonicalizeAxisId=Ce;exports.canonicalizeJson=an;exports.checkBlockFlag=An;exports.createPlRef=We;exports.dataInfoToEntries=ye;exports.deriveNativeId=Ke;exports.deserializeError=w;exports.deserializeResult=bn;exports.digestPlId=tn;exports.ensureError=P;exports.ensurePColumn=$e;exports.entriesToDataInfo=be;exports.executePSpecPredicate=v;exports.extractAllColumns=Ue;exports.extractAllRequirements=kn;exports.extractAllSupports=En;exports.extractCodeWithInfo=re;exports.extractConfigGeneric=te;exports.getAxesId=x;exports.getAxisId=p;exports.getColumnIdAndSpec=Se;exports.getFileNameFromHandle=de;exports.getFilePathFromHandle=T;exports.getPColumnSpecId=xe;exports.getPTableColumnId=Fe;exports.hasAbortError=W;exports.isAbortError=ln;exports.isAggregateError=dn;exports.isBlockUIURL=oe;exports.isDataInfo=fe;exports.isDataInfoEntries=L;exports.isFilteredPColumn=Te;exports.isFolderURL=ie;exports.isImportFileHandleIndex=N;exports.isImportFileHandleUpload=J;exports.isLiveLog=ce;exports.isPColumn=K;exports.isPColumnResult=Ve;exports.isPColumnSpec=d;exports.isPColumnSpecResult=Le;exports.isPFrameDriverError=pn;exports.isPFrameError=fn;exports.isPTableAbsent=we;exports.isPTableNA=B;exports.isPTableValueAxis=Ae;exports.isPartitionedDataInfoEntries=he;exports.isPlRef=He;exports.mapDataInfo=me;exports.mapDataInfoEntries=ge;exports.mapJoinEntry=y;exports.mapPObjectData=Be;exports.mapPTableDef=Ie;exports.mapValueInVOE=Qe;exports.matchAxis=A;exports.matchAxisId=q;exports.matchPColumn=k;exports.newRangeBytesOpt=se;exports.pTableValue=ke;exports.pTableValueBranded=Ee;exports.parseColumnId=Re;exports.parseJson=sn;exports.plId=H;exports.plRefsEqual=Xe;exports.resolveAnchors=De;exports.selectorsToPredicate=ze;exports.serializeError=O;exports.serializeResult=I;exports.stringifyColumnId=z;exports.stringifyJson=on;exports.uniquePlId=rn;exports.unwrapResult=yn;exports.validateRangeBytes=ue;exports.visitDataInfo=pe;exports.withEnrichments=Ge;exports.wrapAndSerialize=gn;exports.wrapAndSerializeAsync=vn;exports.wrapAsyncCallback=Q;exports.wrapCallback=X;
2
2
  //# sourceMappingURL=index.js.map