Commit 8f9e5541 authored by Nikola's avatar Nikola

Include perspective library, remove dependency on import statements

parent b9b73fce
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>97b00c61a5be7eb2e2c8.wasm</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/wasm</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
import 'https://cdn.jsdelivr.net/npm/@finos/perspective-viewer@2.7.1/dist/cdn/perspective-viewer.js';
import 'https://cdn.jsdelivr.net/npm/@finos/perspective-viewer-datagrid@2.7.1/dist/cdn/perspective-viewer-datagrid.js';
import 'https://cdn.jsdelivr.net/npm/@finos/perspective-viewer-d3fc@2.7.1/dist/cdn/perspective-viewer-d3fc.js';
/*This file has been created by using webpack with this configuration:
const PerspectivePlugin = require("@finos/perspective-webpack-plugin");
import {
worker
} from "https://cdn.jsdelivr.net/npm/@finos/perspective@2.7.1/dist/cdn/perspective.js";
var WORKER = worker();
(function (window, rJS) {
"use strict";
rJS(window)
.declareMethod("getTable", function (data) {
return WORKER.table(data);
});
}(window, rJS));
\ No newline at end of file
module.exports = {
entry: "input.js",
output: {
filename: "out.js",
path: "PATH",
},
plugins: [new PerspectivePlugin()],
module: {
rules: [
{
test: require.resolve("@finos/perspective"),
loader: "expose-loader",
options: {
exposes: ["worker","perspective"],
},
},
],
},
};
To update this file, please use a bundler to expose the worker object with window.Worker = worker().*/
(()=>{var e={748:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>Y,get_type_config:()=>B,override:()=>D,shared_worker:()=>J,websocket:()=>U,worker:()=>V});var o=r(488),i=r.n(o);const s=r.p+"97b00c61a5be7eb2e2c8.wasm";var n=Object.defineProperty,a={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(a,{COLUMN_SEPARATOR_STRING:()=>v,CONFIG_ALIASES:()=>_,CONFIG_VALID_KEYS:()=>h,DATA_TYPES:()=>l,FILTER_OPERATORS:()=>g,SORT_ORDERS:()=>u,SORT_ORDER_IDS:()=>c,TYPE_AGGREGATES:()=>m,TYPE_FILTERS:()=>k});var l={integer:"integer",float:"float",string:"string",boolean:"boolean",date:"date",datetime:"datetime",object:"object"},_={row_pivot:"group_by","row-pivot":"group_by","row-pivots":"group_by",col_pivot:"split_by",col_pivots:"split_by",column_pivot:"split_by","column-pivot":"split_by","column-pivots":"split_by",filters:"filter",sorts:"sort"},h=["version","viewport","group_by","split_by","aggregates","columns","filter","sort","computed_columns","expressions","group_by_depth","split_by_depth","filter_op"],d=["any","avg","abs sum","count","distinct count","dominant","first by index","last by index","last minus first","last","high","join","low","high minus low","max","mean","median","min","pct sum parent","pct sum grand total","stddev","sum","sum abs","sum not null","unique","var"],p=["any","count","distinct count","distinct leaf","dominant","first by index","join","last by index","last","unique"],u=["none","asc","desc","col asc","col desc","asc abs","desc abs","col asc abs","col desc abs"],c=[2,0,1,0,1,3,4,3,4],m={string:p,float:d,integer:d,boolean:["any","count","distinct count","distinct leaf","dominant","first by index","last by index","last","unique"],datetime:p,date:p},g={lessThan:"<",greaterThan:">",equals:"==",lessThanOrEquals:"<=",greaterThanOrEquals:">=",doesNotEqual:"!=",isNull:"is null",isNotNull:"is not null",isIn:"in",isNotIn:"not in",contains:"contains",bitwiseAnd:"&",bitwiseOr:"|",and:"and",or:"or",beginsWith:"begins with",endsWith:"ends with"},f=[g.bitwiseAnd,g.bitwiseOr,g.equals,g.doesNotEqual,g.or,g.and,g.isNull,g.isNotNull],y=[g.lessThan,g.greaterThan,g.equals,g.lessThanOrEquals,g.greaterThanOrEquals,g.doesNotEqual,g.isNull,g.isNotNull],b=[g.equals,g.contains,g.doesNotEqual,g.isIn,g.isNotIn,g.beginsWith,g.endsWith,g.isNull,g.isNotNull],w=[g.lessThan,g.greaterThan,g.equals,g.lessThanOrEquals,g.greaterThanOrEquals,g.doesNotEqual,g.isNull,g.isNotNull],v="|",k={string:b,float:y,integer:y,boolean:f,datetime:w,date:w},E={types:{float:{filter_operator:"==",aggregate:"sum",format:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}},string:{filter_operator:"==",aggregate:"count"},integer:{filter_operator:"==",aggregate:"sum",format:{}},boolean:{filter_operator:"==",aggregate:"count"},datetime:{filter_operator:"==",aggregate:"count",format:{dateStyle:"short",timeStyle:"medium"},null_value:-1},date:{filter_operator:"==",aggregate:"count",format:{dateStyle:"short"},null_value:-1}}};function O(e){return e&&"object"==typeof e&&!Array.isArray(e)}function T(e,...t){if(!t.length)return e;let r=t.shift();if(O(e)&&O(r))for(let t in r)O(r[t])?(e[t]||Object.assign(e,{[t]:{}}),T(e[t],r[t])):Object.assign(e,{[t]:r[t]});return T(e,...t)}function N(){return globalThis.__PERSPECTIVE_CONFIG__||(globalThis.__PERSPECTIVE_CONFIG__=T(E,globalThis.__TEMPLATE_CONFIG__||{})),globalThis.__PERSPECTIVE_CONFIG__}var S=new WeakMap,P=0;function A(e,t){return function(){let r,o=Array.prototype.slice.call(arguments,0,arguments.length);for(let e=o.length-1;e>=0;e--)"function"==typeof o[e]&&(r=o.splice(e,1)[0]);let i=S.get(r);S.delete(r);let s={cmd:t||"view_method",name:this._name,method:e,args:o,subscribe:!0,callback_id:i};this._worker.post(s,r,(()=>{})),this._worker.unsubscribe(t,r)}}function j(e,t){return function(){let r,o=Array.prototype.slice.call(arguments,0,arguments.length);for(let e=o.length-1;e>=0;e--)"function"==typeof o[e]&&(r=o.splice(e,1)[0]);P++,S.set(r,P);let i={cmd:t||"view_method",name:this._name,method:e,args:o,subscribe:!0,callback_id:P};this._worker.post(i,r,(()=>{}),!0)}}function x(e,t){return function(){var r=Array.prototype.slice.call(arguments,0,arguments.length);return new Promise(function(o,i){var s={cmd:t||"view_method",name:this._name,method:e,args:r,subscribe:!1};this._worker.post(s,o,i)}.bind(this))}}function I(e,t,r){return new Promise(((o,i)=>{this._worker=e,this._name=Math.random()+"",this._worker.post({cmd:"view",view_name:this._name,table_name:t,config:r},(()=>{o(this)}),i),!0===this._worker._initialized&&!this._worker._features?.wait_for_response&&o(this)}))}function q(e){let t=e;do{for(let r of Object.getOwnPropertyNames(t)){let t=e[r];"constructor"!==r&&"function"==typeof t&&(e[r]=t.bind(e))}}while(t=t!==Object&&Object.getPrototypeOf(t))}function R(e,t,r){return new Promise(((o,i)=>{this._worker=e,this._name=r.name||Math.random()+"",q(this),t.to_arrow?(this._worker.post({cmd:"table",name:this._name,args:[],options:r||{}}),t.to_arrow().then((e=>{this._worker.post({cmd:"table",name:this._name,args:[e],options:r||{}},(()=>{t.on_update((e=>{this.update(e.delta)}),{mode:"row"}),o(this)}),i)}))):this._worker.post({cmd:"table",name:this._name,args:[t],options:r||{}},(()=>{o(this)}),i),!0===this._worker._initialized&&!this._worker._features?.wait_for_response&&o(this)}))}function C(e,t){this._worker=e,this._name=t}I.prototype,I.prototype.get_config=x("get_config"),I.prototype.get_min_max=x("get_min_max"),I.prototype.to_json=x("to_json"),I.prototype.to_arrow=x("to_arrow"),I.prototype.to_columns=x("to_columns"),I.prototype.to_columns_string=x("to_columns_string"),I.prototype.to_csv=x("to_csv"),I.prototype.schema=x("schema"),I.prototype.expression_schema=x("expression_schema"),I.prototype.column_paths=x("column_paths"),I.prototype.num_columns=x("num_columns"),I.prototype.num_rows=x("num_rows"),I.prototype.dimensions=x("dimensions"),I.prototype.set_depth=x("set_depth"),I.prototype.get_row_expanded=x("get_row_expanded"),I.prototype.expand=x("expand"),I.prototype.collapse=x("collapse"),I.prototype.delete=x("delete"),I.prototype.col_to_js_typed_array=x("col_to_js_typed_array"),I.prototype.on_update=j("on_update","view_method"),I.prototype.remove_update=A("remove_update","view_method"),I.prototype.on_delete=j("on_delete","view_method"),I.prototype.remove_delete=A("remove_delete","view_method"),String.prototype.includes||(String.prototype.includes=function(e,t){return"number"!=typeof t&&(t=0),!(t+e.length>this.length)&&-1!==this.indexOf(e,t)}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(e,t){if(null==this)throw new TypeError('"this" is null or not defined');var r=Object(this),o=r.length>>>0;if(0===o)return!1;for(var i,s,n=0|t,a=Math.max(n>=0?n:o-Math.abs(n),0);a<o;){if((i=r[a])===(s=e)||"number"==typeof i&&"number"==typeof s&&isNaN(i)&&isNaN(s))return!0;a++}return!1}}),R.prototype.type="table",C.prototype=R.prototype,R.prototype.view=function(e){return new I(this._worker,this._name,e)},R.prototype.query_columns=x("query_columns","table_method"),R.prototype.get_index=x("get_index","table_method"),R.prototype.get_limit=x("get_limit","table_method"),R.prototype.get_num_views=x("get_num_views","table_method"),R.prototype.make_port=x("make_port","table_method"),R.prototype.remove_port=x("remove_port","table_method"),R.prototype.schema=x("schema","table_method"),R.prototype.validate_expressions=x("validate_expressions","table_method"),R.prototype.is_valid_filter=x("is_valid_filter","table_method"),R.prototype.size=x("size","table_method"),R.prototype.num_rows=x("num_rows","table_method"),R.prototype.num_columns=x("num_columns","table_method"),R.prototype.columns=x("columns","table_method"),R.prototype.clear=x("clear","table_method"),R.prototype.replace=x("replace","table_method"),R.prototype.delete=x("delete","table_method"),R.prototype.on_delete=j("on_delete","table_method"),R.prototype.remove=x("remove","table_method"),R.prototype.remove_delete=A("remove_delete","table_method"),R.prototype.update=function(e,t){return new Promise(((r,o)=>{this._worker.post({name:this._name,cmd:"table_method",method:"update",args:[e,t||{}]},r,o,!1)}))},R.prototype.execute=function(e){this._worker.post({cmd:"table_execute",name:this._name,f:e.toString()})};var z=class{constructor(){this._initialized=!1,this._worker={initialized:{value:!1},transferable:!1,msg_id:0,handlers:{},messages:[]},q(this)}unsubscribe(e,t){for(let e of Object.keys(this._worker.handlers))this._worker.handlers[e].resolve===t&&delete this._worker.handlers[e]}post(e,t,r,o=!1){++this._worker.msg_id,(t||r)&&(this._worker.handlers[this._worker.msg_id]={resolve:t,reject:r,keep_alive:o}),e.id=this._worker.msg_id,this._worker.initialized.value?this.send(e):this._worker.messages.push((()=>{this.send(e),("table"===e.cmd||"view"===e.cmd)&&!this._features?.wait_for_response&&t&&t()}))}async memory_usage(){return await new Promise(((e,t)=>{this.post({cmd:"memory_usage"},e,t)}))}async get_hosted_table_names(){return await new Promise(((e,t)=>{this.post({cmd:"get_hosted_table_names"},e,t)}))}initialize_profile_thread(){this._worker.initialized.value?this.send({id:-1,cmd:"init_profile_thread"}):this._worker.messages.push((()=>this.send({id:-1,cmd:"init_profile_thread"})))}send(){throw new Error("send() not implemented")}async open_table(e){return new C(this,e)}_handle(e){if(!this._worker.initialized.value){this._initialized||(this._initialized=!0);let t=this._worker.messages;if(this._worker.initialized.value=!0,this._worker.messages=[],e.data?.data){this._features={};for(let t of e.data.data)this._features[t]=!0}if(t)for(let e in t)t.hasOwnProperty(e)&&t[e]()}if(e.data.id){let t=this._worker.handlers[e.data.id];t&&(e.data.error?t.reject(e.data.error):t.resolve(e.data.data),t.keep_alive||delete this._worker.handlers[e.data.id])}}table(e,t){return new R(this,e,t||{})}terminate(){this._worker.terminate(),this._worker=void 0}},L=class extends z{_ping(){this._ping_loop&&this._ws.send("ping"),this._ping_loop=setTimeout(this._ping.bind(this),3e4)}_close(){clearTimeout(this._ping_loop),this._ping_loop=void 0,this._on_close_callback?.()}_onmessage(e){if("pong"!==e.data)if(this._pending_binary){let t=e.data;if(this._full_binary.set(new Uint8Array(t),this._total_chunk_length),this._total_chunk_length+=t.byteLength,this._total_chunk_length!==this._pending_binary_length)return;t=this._full_binary.buffer;let r={data:{id:this._pending_binary,data:t}};if(void 0!==this._pending_port_id){let e={port_id:this._pending_port_id,delta:t};r.data.data=e}this._handle(r),delete this._pending_binary,delete this._pending_binary_length,delete this._pending_port_id,this._total_chunk_length=0,this._full_binary=null}else(e=JSON.parse(e.data)).binary_length?(this._pending_binary=e.id,this._pending_binary_length=e.binary_length,e.data&&void 0!==e.data.port_id&&(this._pending_port_id=e.data.port_id),this._full_binary=new Uint8Array(this._pending_binary_length)):this._handle({data:e})}constructor(e){super(),this._ws=e,this._ws.binaryType="arraybuffer",this._full_binary,this._total_chunk_length=0,this._pending_binary_length=0,this._ws.onopen=()=>{this.send({id:-1,cmd:"init"})},this._ping(),this._ws.onclose=this._close.bind(this),this._ws.onmessage=this._onmessage.bind(this)}send(e){if(this._ws.readyState!==i().CLOSED){if(e.args&&e.args.length>0&&e.args[0]instanceof ArrayBuffer&&void 0!==e.args[0].byteLength){let t=e;return e.binary_length=e.args[0].byteLength,this._ws.send(JSON.stringify(t)),void this._ws.send(e.args[0])}this._ws.send(JSON.stringify(e))}else console.warn("Websocket connection is already closed.")}terminate(){return new Promise((e=>{this._on_close_callback=e,this._ws.close()}))}},M=!1,F=function(){let e;return function(){return e||(e=new class{async worker(){return await new Worker(r.p+"perspective.worker.js")}async wasm(){let e=await s;if(e instanceof ArrayBuffer&&!e.buffer&&(e=new Uint8Array(e)),e.buffer&&e.buffer instanceof ArrayBuffer)M=!0,length=e.byteLength,this._wasm=e;else if(e instanceof ArrayBuffer)length=e.byteLength,this._wasm=new Uint8Array(e);else{let t=await fetch(e);this._wasm=await t.arrayBuffer()}return this._wasm}}),e}}(),G=class extends z{constructor(e){var t;e&&(t=e,globalThis.__PERSPECTIVE_CONFIG__&&console.warn("Config already initialized!"),globalThis.__PERSPECTIVE_CONFIG__=T(E,t)),super(),this.register()}async register(){let e,t={cmd:"init",config:N()};if(typeof WebAssembly>"u")throw new Error("WebAssembly not supported.");for(var r in[e,t.buffer]=await Promise.all([F().worker(),F().wasm()]),this._worker)e[r]=this._worker[r];this._worker=e,this._worker.addEventListener("message",this._handle.bind(this)),this._worker.postMessage(t),this._detect_transferable()}send(e){this._worker.transferable&&e.args&&e.args[0]instanceof ArrayBuffer?this._worker.postMessage(e,[e.args[0]]):this._worker.postMessage(e)}terminate(){this._worker.terminate(),this._worker=void 0}get transferable(){return this._worker?.transferable||!1}get inline(){return M}_detect_transferable(){var e=new ArrayBuffer(1);this._worker.postMessage(e,[e]),this._worker.transferable=0===e.byteLength}},W=function(){let e,t;return{getInstance:function(r){void 0===e&&(e=new G(r));let o=JSON.stringify(r);if(t&&o!==t)throw new Error("Configuration object for shared_worker() has changed - this is probably a bug in your application.");return t=o,e}}}(),B=function e(t){let r={};if(N().types[t]&&Object.assign(r,N().types[t]),r.type){let t=e(r.type);return Object.assign(t,r),t}return r};function D(e){return F().set(e)}function V(e){return new G(e)}function U(e=window.location.origin.replace("http","ws")){return new L(new WebSocket(e))}function J(e){return W.getInstance(e)}var Y={override:D,worker:V,websocket:U,shared_worker:J,...Object.keys(a)}},488:e=>{"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}}},t={};function r(o){var i=t[o];if(void 0!==i)return i.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var o=t.getElementsByTagName("script");if(o.length)for(var i=o.length-1;i>-1&&!e;)e=o[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),(()=>{const e=r(748);window.Worker=e.worker()})()})();
\ No newline at end of file
(()=>{"use strict";var e={508:(e,t,r)=>{e.exports=r.p+"97b00c61a5be7eb2e2c8.wasm"}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.m=e,r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var i=n.length-1;i>-1&&!e;)e=n[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),r.b=self.location+"",(()=>{var e,t={};r.r(t),r.d(t,{COLUMN_SEPARATOR_STRING:()=>g,CONFIG_ALIASES:()=>o,CONFIG_VALID_KEYS:()=>s,DATA_TYPES:()=>i,FILTER_OPERATORS:()=>h,SORT_ORDERS:()=>c,SORT_ORDER_IDS:()=>u,TYPE_AGGREGATES:()=>d,TYPE_FILTERS:()=>y});const n=(e="file:///home/benutzer/perspective/node_modules/@finos/perspective/dist/pkg/web/perspective.cpp.js",function(t={}){var n,i,o=t;o.ready=new Promise(((e,t)=>{n=e,i=t}));var s,a=Object.assign({},o),l=[],c="./this.program",u=(e,t)=>{throw t},d="";"undefined"!=typeof document&&document.currentScript&&(d=document.currentScript.src),e&&(d=e),d=0!==d.indexOf("blob:")?d.substr(0,d.replace(/[?#].*/,"").lastIndexOf("/")+1):"";var h,p,f=o.print||console.log.bind(console),_=o.printErr||console.error.bind(console);Object.assign(o,a),a=null,o.arguments&&(l=o.arguments),o.thisProgram&&(c=o.thisProgram),o.quit&&(u=o.quit),o.wasmBinary&&(h=o.wasmBinary),"object"!=typeof WebAssembly&&F("no native wasm support detected");var m,g,y,v,b,w,T,$,P,k,C,O=!1;function A(){var e=p.buffer;o.HEAP8=g=new Int8Array(e),o.HEAP16=v=new Int16Array(e),o.HEAPU8=y=new Uint8Array(e),o.HEAPU16=b=new Uint16Array(e),o.HEAP32=w=new Int32Array(e),o.HEAPU32=T=new Uint32Array(e),o.HEAPF32=$=new Float32Array(e),o.HEAPF64=C=new Float64Array(e),o.HEAP64=P=new BigInt64Array(e),o.HEAPU64=k=new BigUint64Array(e)}var E=[],x=[],S=[],j=[],N=0,R=null,V=null;function F(e){o.onAbort&&o.onAbort(e),_(e="Aborted("+e+")"),O=!0,m=1,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var D,I,W=e=>e.startsWith("data:application/octet-stream;base64,");function M(e){if(e==D&&h)return new Uint8Array(h);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}function U(e,t,r){return function(e){return h||"function"!=typeof fetch?Promise.resolve().then((()=>M(e))):fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>M(e)))}(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{_(`failed to asynchronously prepare wasm: ${e}`),F(e)}))}o.locateFile?W(D="perspective.cpp.wasm")||(I=D,D=o.locateFile?o.locateFile(I,d):d+I):D=new URL(r(508),r.b).href;var z={848052:e=>{throw new Error(G(e))}};function H(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var q=e=>{for(;e.length>0;)e.shift()(o)},B=o.noExitRuntime||!0,L="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,J=(e,t,r)=>{for(var n=(t>>>=0)+r,i=t;e[i]&&!(i>=n);)++i;if(i-t>16&&e.buffer&&L)return L.decode(e.subarray(t,i));for(var o="";t<i;){var s=e[t++];if(128&s){var a=63&e[t++];if(192!=(224&s)){var l=63&e[t++];if((s=224==(240&s)?(15&s)<<12|a<<6|l:(7&s)<<18|a<<12|l<<6|63&e[t++])<65536)o+=String.fromCharCode(s);else{var c=s-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else o+=String.fromCharCode((31&s)<<6|a)}else o+=String.fromCharCode(s)}return o},G=(e,t)=>(e>>>=0)?J(y,e,t):"",Y=e=>e<-9007199254740992||e>9007199254740992?NaN:Number(e),X=(e,t,r,n)=>{if(!(n>0))return 0;for(var i=r>>>=0,o=r+n-1,s=0;s<e.length;++s){var a=e.charCodeAt(s);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s)),a<=127){if(r>=o)break;t[r++>>>0]=a}else if(a<=2047){if(r+1>=o)break;t[r++>>>0]=192|a>>6,t[r++>>>0]=128|63&a}else if(a<=65535){if(r+2>=o)break;t[r++>>>0]=224|a>>12,t[r++>>>0]=128|a>>6&63,t[r++>>>0]=128|63&a}else{if(r+3>=o)break;t[r++>>>0]=240|a>>18,t[r++>>>0]=128|a>>12&63,t[r++>>>0]=128|a>>6&63,t[r++>>>0]=128|63&a}}return t[r>>>0]=0,r-i},Z={},K=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Q(e){return this.fromWireType(w[e>>>2>>>0])}var ee,te,re,ne={},ie={},oe={},se=e=>{throw new ee(e)},ae=(e,t,r)=>{function n(t){var n=r(t);n.length!==e.length&&se("Mismatched type converter count");for(var i=0;i<e.length;++i)de(e[i],n[i])}e.forEach((function(e){oe[e]=t}));var i=new Array(t.length),o=[],s=0;t.forEach(((e,t)=>{ie.hasOwnProperty(e)?i[t]=ie[e]:(o.push(e),ne.hasOwnProperty(e)||(ne[e]=[]),ne[e].push((()=>{i[t]=ie[e],++s===o.length&&n(i)})))})),0===o.length&&n(i)},le=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},ce=e=>{for(var t="",r=e;y[r>>>0];)t+=te[y[r++>>>0]];return t},ue=e=>{throw new re(e)};function de(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t,r={}){var n=t.name;if(e||ue(`type "${n}" must have a positive integer typeid pointer`),ie.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;ue(`Cannot register type '${n}' twice`)}if(ie[e]=t,delete oe[e],ne.hasOwnProperty(e)){var i=ne[e];delete ne[e],i.forEach((e=>e()))}}(e,t,r)}var he,pe=(e,t,r)=>{switch(t){case 1:return r?e=>g[e>>>0>>>0]:e=>y[e>>>0>>>0];case 2:return r?e=>v[e>>>1>>>0]:e=>b[e>>>1>>>0];case 4:return r?e=>w[e>>>2>>>0]:e=>T[e>>>2>>>0];case 8:return r?e=>P[e>>>3]:e=>k[e>>>3];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},fe=e=>{ue(e.$$.ptrType.registeredClass.name+" instance already deleted")},_e=!1,me=e=>{},ge=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},ye=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var n=ye(e,t,r.baseClass);return null===n?null:r.downcast(n)},ve={},be=[],we=()=>{for(;be.length;){var e=be.pop();e.$$.deleteScheduled=!1,e.delete()}},Te={},$e=(e,t)=>(t.ptrType&&t.ptr||se("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&se("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Pe(Object.create(e,{$$:{value:t}})));var Pe=e=>"undefined"==typeof FinalizationRegistry?(Pe=e=>e,e):(_e=new FinalizationRegistry((e=>{ge(e.$$)})),Pe=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};_e.register(e,r,e)}return e},me=e=>_e.unregister(e),Pe(e));function ke(){}var Ce=(e,t)=>Object.defineProperty(t,"name",{value:e}),Oe=(e,t,r)=>{if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||ue(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}},Ae=(e,t,r)=>{o.hasOwnProperty(e)?((void 0===r||void 0!==o[e].overloadTable&&void 0!==o[e].overloadTable[r])&&ue(`Cannot register public name '${e}' twice`),Oe(o,e,e),o.hasOwnProperty(r)&&ue(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),o[e].overloadTable[r]=t):(o[e]=t,void 0!==r&&(o[e].numArguments=r))};function Ee(e,t,r,n,i,o,s,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=i,this.getActualType=o,this.upcast=s,this.downcast=a,this.pureVirtualFunctions=[]}var xe=(e,t,r)=>{for(;t!==r;)t.upcast||ue(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Se(e,t){if(null===t)return this.isReference&&ue(`null is not a valid ${this.name}`),0;t.$$||ue(`Cannot pass "${le(t)}" as a ${this.name}`),t.$$.ptr||ue(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xe(t.$$.ptr,r,this.registeredClass)}function je(e,t){var r;if(null===t)return this.isReference&&ue(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||ue(`Cannot pass "${le(t)}" as a ${this.name}`),t.$$.ptr||ue(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&ue(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;if(r=xe(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&ue("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:ue(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var i=t.clone();r=this.rawShare(r,Ze.toHandle((()=>i.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:ue("Unsupporting sharing policy")}return r}function Ne(e,t){if(null===t)return this.isReference&&ue(`null is not a valid ${this.name}`),0;t.$$||ue(`Cannot pass "${le(t)}" as a ${this.name}`),t.$$.ptr||ue(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&ue(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return xe(t.$$.ptr,r,this.registeredClass)}function Re(e){return this.fromWireType(T[e>>>2>>>0])}function Ve(e,t,r,n,i,o,s,a,l,c,u){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=i,this.pointeeType=o,this.sharingPolicy=s,this.rawGetPointee=a,this.rawConstructor=l,this.rawShare=c,this.rawDestructor=u,i||void 0!==t.baseClass?this.toWireType=je:n?(this.toWireType=Se,this.destructorFunction=null):(this.toWireType=Ne,this.destructorFunction=null)}var Fe,De,Ie=(e,t,r)=>{o.hasOwnProperty(e)||se("Replacing nonexistant public symbol"),void 0!==o[e].overloadTable&&void 0!==r?o[e].overloadTable[r]=t:(o[e]=t,o[e].argCount=r)},We=[],Me=(e,t)=>{e=ce(e);var r,n,i=((n=We[r=t])||(r>=We.length&&(We.length=r+1),We[r]=n=Fe.get(r)),n);return"function"!=typeof i&&ue(`unknown function pointer with signature ${e}: ${t}`),i},Ue=e=>{var t=Nt(e),r=ce(t);return St(t),r},ze=(e,t)=>{var r=[],n={};throw t.forEach((function e(t){n[t]||ie[t]||(oe[t]?oe[t].forEach(e):(r.push(t),n[t]=!0))})),new De(`${e}: `+r.map(Ue).join([", "]))},He=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(T[t+4*n>>>2>>>0]);return r};function qe(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=Ce(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var n=new r,i=e.apply(n,t);return i instanceof Object?i:n}function Be(e,t,r,n,i,o){var s=t.length;s<2&&ue("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==r,l=!1,c=1;c<t.length;++c)if(null!==t[c]&&void 0===t[c].destructorFunction){l=!0;break}var u="void"!==t[0].name,d="",h="";for(c=0;c<s-2;++c)d+=(0!==c?", ":"")+"arg"+c,h+=(0!==c?", ":"")+"arg"+c+"Wired";var p=`\n return function (${d}) {\n if (arguments.length !== ${s-2}) {\n throwBindingError('function ${e} called with ' + arguments.length + ' arguments, expected ${s-2}');\n }`;l&&(p+="var destructors = [];\n");var f=l?"destructors":"null",_=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],m=[ue,n,i,K,t[0],t[1]];for(a&&(p+="var thisWired = classParam.toWireType("+f+", this);\n"),c=0;c<s-2;++c)p+="var arg"+c+"Wired = argType"+c+".toWireType("+f+", arg"+c+"); // "+t[c+2].name+"\n",_.push("argType"+c),m.push(t[c+2]);if(a&&(h="thisWired"+(h.length>0?", ":"")+h),p+=(u||o?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",l)p+="runDestructors(destructors);\n";else for(c=a?1:2;c<t.length;++c){var g=1===c?"thisWired":"arg"+(c-2)+"Wired";null!==t[c].destructorFunction&&(p+=g+"_dtor("+g+"); // "+t[c].name+"\n",_.push(g+"_dtor"),m.push(t[c].destructorFunction))}u&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),p+="}\n",_.push(p);var y=qe(Function,_).apply(null,m);return Ce(e,y)}var Le=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e};function Je(){this.allocated=[void 0],this.freelist=[]}var Ge=new Je;function Ye(e){(e>>>=0)>=Ge.reserved&&0==--Ge.get(e).refcount&&Ge.free(e)}var Xe,Ze={toValue:e=>(e||ue("Cannot use deleted val. handle = "+e),Ge.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return Ge.allocate({refcount:1,value:e})}}},Ke=(e,t,r)=>{switch(t){case 1:return r?function(e){return this.fromWireType(g[e>>>0>>>0])}:function(e){return this.fromWireType(y[e>>>0>>>0])};case 2:return r?function(e){return this.fromWireType(v[e>>>1>>>0])}:function(e){return this.fromWireType(b[e>>>1>>>0])};case 4:return r?function(e){return this.fromWireType(w[e>>>2>>>0])}:function(e){return this.fromWireType(T[e>>>2>>>0])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Qe=(e,t)=>{var r=ie[e];return void 0===r&&ue(t+" has unknown type "+Ue(e)),r},et=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType($[e>>>2>>>0])};case 8:return function(e){return this.fromWireType(C[e>>>3>>>0])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},tt=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t},rt="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,nt=(e,t)=>{for(var r=e,n=r>>1,i=n+t/2;!(n>=i)&&b[n>>>0];)++n;if((r=n<<1)-e>32&&rt)return rt.decode(y.subarray(e>>>0,r>>>0));for(var o="",s=0;!(s>=t/2);++s){var a=v[e+2*s>>>1>>>0];if(0==a)break;o+=String.fromCharCode(a)}return o},it=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var n=t,i=(r-=2)<2*e.length?r/2:e.length,o=0;o<i;++o){var s=e.charCodeAt(o);v[t>>>1>>>0]=s,t+=2}return v[t>>>1>>>0]=0,t-n},ot=e=>2*e.length,st=(e,t)=>{for(var r=0,n="";!(r>=t/4);){var i=w[e+4*r>>>2>>>0];if(0==i)break;if(++r,i>=65536){var o=i-65536;n+=String.fromCharCode(55296|o>>10,56320|1023&o)}else n+=String.fromCharCode(i)}return n},at=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var n=t>>>=0,i=n+r-4,o=0;o<e.length;++o){var s=e.charCodeAt(o);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),w[t>>>2>>>0]=s,(t+=4)+4>i)break}return w[t>>>2>>>0]=0,t-n},lt=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t},ct=(e,t,r)=>{var n=[],i=e.toWireType(n,r);return n.length&&(T[t>>>2>>>0]=Ze.toHandle(n)),i},ut=[],dt={},ht=e=>{var t=dt[e];return void 0===t?ce(e):t},pt=()=>"object"==typeof globalThis?globalThis:Function("return this")();Reflect.construct,Xe=()=>performance.now();var ft,_t,mt=[],gt={},yt=()=>{if(!yt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:c||"./this.program"};for(var t in gt)void 0===gt[t]?delete e[t]:e[t]=gt[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);yt.strings=r}return yt.strings},vt=[null,[],[]],bt=e=>{m=e,B||(o.onExit&&o.onExit(e),O=!0),u(e,new H(e))},wt=e=>e%4==0&&(e%100!=0||e%400==0),Tt=(e,t)=>{for(var r=0,n=0;n<=t;r+=e[n++]);return r},$t=[31,29,31,30,31,30,31,31,30,31,30,31],Pt=[31,28,31,30,31,30,31,31,30,31,30,31],kt=(e,t)=>{for(var r=new Date(e.getTime());t>0;){var n=wt(r.getFullYear()),i=r.getMonth(),o=(n?$t:Pt)[i];if(!(t>o-r.getDate()))return r.setDate(r.getDate()+t),r;t-=o-r.getDate()+1,r.setDate(1),i<11?r.setMonth(i+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1))}return r},Ct=e=>parseInt(e);ee=o.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},(()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);te=e})(),re=o.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},Object.assign(ke.prototype,{isAliasOf(e){if(!(this instanceof ke))return!1;if(!(e instanceof ke))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,i=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)i=n.upcast(i),n=n.baseClass;return t===n&&r===i},clone(){if(this.$$.ptr||fe(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=Pe(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||fe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ue("Object already scheduled for deletion"),me(this),ge(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||fe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ue("Object already scheduled for deletion"),be.push(this),1===be.length&&he&&he(we),this.$$.deleteScheduled=!0,this}}),o.getInheritedInstanceCount=()=>Object.keys(Te).length,o.getLiveInheritedInstances=()=>{var e=[];for(var t in Te)Te.hasOwnProperty(t)&&e.push(Te[t]);return e},o.flushPendingDeletes=we,o.setDelayFunction=e=>{he=e,be.length&&he&&he(we)},Object.assign(Ve.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:8,readValueFromPointer:Re,deleteObject(e){null!==e&&e.delete()},fromWireType:function(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=((e,t)=>(t=((e,t)=>{for(void 0===t&&ue("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),Te[t]))(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function i(){return this.isSmartPointer?$e(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):$e(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var o,s=this.registeredClass.getActualType(t),a=ve[s];if(!a)return i.call(this);o=this.isConst?a.constPointerType:a.pointerType;var l=ye(t,this.registeredClass,o.registeredClass);return null===l?i.call(this):this.isSmartPointer?$e(o.registeredClass.instancePrototype,{ptrType:o,ptr:l,smartPtrType:this,smartPtr:e}):$e(o.registeredClass.instancePrototype,{ptrType:o,ptr:l})}}),De=o.UnboundTypeError=(ft=Error,(_t=Ce("UnboundTypeError",(function(e){this.name="UnboundTypeError",this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}))).prototype=Object.create(ft.prototype),_t.prototype.constructor=_t,_t.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},_t),Object.assign(Je.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}}),Ge.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),Ge.reserved=Ge.allocated.length,o.count_emval_handles=()=>{for(var e=0,t=Ge.reserved;t<Ge.allocated.length;++t)void 0!==Ge.allocated[t]&&++e;return e};var Ot,At={__syscall_ftruncate64:function(e,t){t=Y(t)},__syscall_getdents64:function(e,t,r){},_embind_finalize_value_object:function(e){var t=Z[e>>>=0];delete Z[e];var r=t.rawConstructor,n=t.rawDestructor,i=t.fields,o=i.map((e=>e.getterReturnType)).concat(i.map((e=>e.setterArgumentType)));ae([e],o,(e=>{var o={};return i.forEach(((t,r)=>{var n=t.fieldName,s=e[r],a=t.getter,l=t.getterContext,c=e[r+i.length],u=t.setter,d=t.setterContext;o[n]={read:e=>s.fromWireType(a(l,e)),write:(e,t)=>{var r=[];u(d,e,c.toWireType(r,t)),K(r)}}})),[{name:t.name,fromWireType:e=>{var t={};for(var r in o)t[r]=o[r].read(e);return n(e),t},toWireType:(e,t)=>{for(var i in o)if(!(i in t))throw new TypeError(`Missing field: "${i}"`);var s=r();for(i in o)o[i].write(s,t[i]);return null!==e&&e.push(n,s),s},argPackAdvance:8,readValueFromPointer:Q,destructorFunction:n}]}))},_embind_register_bigint:function(e,t,r,n,i){e>>>=0,r>>>=0;var o=-1!=(t=ce(t>>>=0)).indexOf("u");o&&(i=(1n<<64n)-1n),de(e,{name:t,fromWireType:e=>e,toWireType:function(e,r){if("bigint"!=typeof r&&"number"!=typeof r)throw new TypeError(`Cannot convert "${le(r)}" to ${this.name}`);if(r<n||r>i)throw new TypeError(`Passing a number "${le(r)}" from JS side to C/C++ side to an argument of type "${t}", which is outside the valid range [${n}, ${i}]!`);return r},argPackAdvance:8,readValueFromPointer:pe(t,r,!o),destructorFunction:null})},_embind_register_bool:function(e,t,r,n){de(e>>>=0,{name:t=ce(t>>>=0),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},argPackAdvance:8,readValueFromPointer:function(e){return this.fromWireType(y[e>>>0])},destructorFunction:null})},_embind_register_class:function(e,t,r,n,i,o,s,a,l,c,u,d,h){e>>>=0,t>>>=0,r>>>=0,n>>>=0,i>>>=0,o>>>=0,s>>>=0,a>>>=0,l>>>=0,c>>>=0,d>>>=0,h>>>=0,u=ce(u>>>=0),o=Me(i,o),a&&(a=Me(s,a)),c&&(c=Me(l,c)),h=Me(d,h);var p=(e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(u);Ae(p,(function(){ze(`Cannot construct ${u} due to unbound types`,[n])})),ae([e,t,r],n?[n]:[],(function(t){var r,i;t=t[0],i=n?(r=t.registeredClass).instancePrototype:ke.prototype;var s=Ce(u,(function(){if(Object.getPrototypeOf(this)!==l)throw new re("Use 'new' to construct "+u);if(void 0===d.constructor_body)throw new re(u+" has no accessible constructor");var e=d.constructor_body[arguments.length];if(void 0===e)throw new re(`Tried to invoke ctor of ${u} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(d.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),l=Object.create(i,{constructor:{value:s}});s.prototype=l;var d=new Ee(u,s,l,h,r,o,a,c);d.baseClass&&(void 0===d.baseClass.__derivedClasses&&(d.baseClass.__derivedClasses=[]),d.baseClass.__derivedClasses.push(d));var f=new Ve(u,d,!0,!1,!1),_=new Ve(u+"*",d,!1,!1,!1),m=new Ve(u+" const*",d,!1,!0,!1);return ve[e]={pointerType:_,constPointerType:m},Ie(p,s),[f,_,m]}))},_embind_register_class_constructor:function(e,t,r,n,i,o){e>>>=0,n>>>=0,i>>>=0,o>>>=0;var s=He(t,r>>>=0);i=Me(n,i),ae([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new re(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{ze(`Cannot construct ${e.name} due to unbound types`,s)},ae([],s,(n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Be(r,n,null,i,o),[]))),[]}))},_embind_register_class_function:function(e,t,r,n,i,o,s,a,l){e>>>=0,t>>>=0,i>>>=0,o>>>=0,s>>>=0;var c=He(r,n>>>=0);t=ce(t),t=Le(t),o=Me(i,o),ae([],[e],(function(e){var n=`${(e=e[0]).name}.${t}`;function i(){ze(`Cannot call ${n} due to unbound types`,c)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),a&&e.registeredClass.pureVirtualFunctions.push(t);var u=e.registeredClass.instancePrototype,d=u[t];return void 0===d||void 0===d.overloadTable&&d.className!==e.name&&d.argCount===r-2?(i.argCount=r-2,i.className=e.name,u[t]=i):(Oe(u,t,n),u[t].overloadTable[r-2]=i),ae([],c,(function(i){var a=Be(n,i,e,o,s,l);return void 0===u[t].overloadTable?(a.argCount=r-2,u[t]=a):u[t].overloadTable[r-2]=a,[]})),[]}))},_embind_register_emval:function(e,t){de(e>>>=0,{name:t=ce(t>>>=0),fromWireType:e=>{var t=Ze.toValue(e);return Ye(e),t},toWireType:(e,t)=>Ze.toHandle(t),argPackAdvance:8,readValueFromPointer:Q,destructorFunction:null})},_embind_register_enum:function(e,t,r,n){function i(){}e>>>=0,r>>>=0,t=ce(t>>>=0),i.values={},de(e,{name:t,constructor:i,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,argPackAdvance:8,readValueFromPointer:Ke(t,r,n),destructorFunction:null}),Ae(t,i)},_embind_register_enum_value:function(e,t,r){t>>>=0,r>>>=0;var n=Qe(e>>>=0,"enum");t=ce(t);var i=n.constructor,o=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:Ce(`${n.name}_${t}`,(function(){}))}});i.values[r]=o,i[t]=o},_embind_register_float:function(e,t,r){r>>>=0,de(e>>>=0,{name:t=ce(t>>>=0),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:8,readValueFromPointer:et(t,r),destructorFunction:null})},_embind_register_function:function(e,t,r,n,i,o,s){e>>>=0,n>>>=0,i>>>=0,o>>>=0;var a=He(t,r>>>=0);e=ce(e),e=Le(e),i=Me(n,i),Ae(e,(function(){ze(`Cannot call ${e} due to unbound types`,a)}),t-1),ae([],a,(function(r){var n=[r[0],null].concat(r.slice(1));return Ie(e,Be(e,n,null,i,o,s),t-1),[]}))},_embind_register_integer:function(e,t,r,n,i){e>>>=0,r>>>=0,t=ce(t>>>=0),-1===i&&(i=4294967295);var o=e=>e;if(0===n){var s=32-8*r;o=e=>e<<s>>>s}var a=t.includes("unsigned");de(e,{name:t,fromWireType:o,toWireType:a?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:8,readValueFromPointer:pe(t,r,0!==n),destructorFunction:null})},_embind_register_memory_view:function(e,t,r){r>>>=0;var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function i(e){var t=T[e>>>2>>>0],r=T[e+4>>>2>>>0];return new n(g.buffer,r,t)}de(e>>>=0,{name:r=ce(r),fromWireType:i,argPackAdvance:8,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},_embind_register_smart_ptr:function(e,t,r,n,i,o,s,a,l,c,u,d){e>>>=0,t>>>=0,i>>>=0,o>>>=0,s>>>=0,a>>>=0,l>>>=0,c>>>=0,u>>>=0,d>>>=0,r=ce(r>>>=0),o=Me(i,o),a=Me(s,a),c=Me(l,c),d=Me(u,d),ae([e],[t],(function(e){return e=e[0],[new Ve(r,e.registeredClass,!1,!1,!0,e,n,o,a,c,d)]}))},_embind_register_std_string:function(e,t){e>>>=0;var r="std::string"===(t=ce(t>>>=0));de(e,{name:t,fromWireType(e){var t,n=T[e>>>2>>>0],i=e+4;if(r)for(var o=i,s=0;s<=n;++s){var a=i+s;if(s==n||0==y[a>>>0]){var l=G(o,a-o);void 0===t?t=l:(t+=String.fromCharCode(0),t+=l),o=a+1}}else{var c=new Array(n);for(s=0;s<n;++s)c[s]=String.fromCharCode(y[i+s>>>0]);t=c.join("")}return St(e),t},toWireType(e,t){var n;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var i="string"==typeof t;i||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||ue("Cannot pass non-string to std::string"),n=r&&i?tt(t):t.length;var o=xt(4+n+1),s=o+4;if(T[o>>>2>>>0]=n,r&&i)X(t,y,s,n+1);else if(i)for(var a=0;a<n;++a){var l=t.charCodeAt(a);l>255&&(St(s),ue("String has UTF-16 code units that do not fit in 8 bits")),y[s+a>>>0]=l}else for(a=0;a<n;++a)y[s+a>>>0]=t[a];return null!==e&&e.push(St,o),o},argPackAdvance:8,readValueFromPointer:Re,destructorFunction(e){St(e)}})},_embind_register_std_wstring:function(e,t,r){var n,i,o,s,a;e>>>=0,t>>>=0,r=ce(r>>>=0),2===t?(n=nt,i=it,s=ot,o=()=>b,a=1):4===t&&(n=st,i=at,s=lt,o=()=>T,a=2),de(e,{name:r,fromWireType:e=>{for(var r,i=T[e>>>2>>>0],s=o(),l=e+4,c=0;c<=i;++c){var u=e+4+c*t;if(c==i||0==s[u>>>a]){var d=n(l,u-l);void 0===r?r=d:(r+=String.fromCharCode(0),r+=d),l=u+t}}return St(e),r},toWireType:(e,n)=>{"string"!=typeof n&&ue(`Cannot pass non-string to C++ string type ${r}`);var o=s(n),l=xt(4+o+t);return T[l>>>2]=o>>a,i(n,l+4,o+t),null!==e&&e.push(St,l),l},argPackAdvance:8,readValueFromPointer:Q,destructorFunction(e){St(e)}})},_embind_register_value_object:function(e,t,r,n,i,o){t>>>=0,r>>>=0,n>>>=0,i>>>=0,o>>>=0,Z[e>>>=0]={name:ce(t),rawConstructor:Me(r,n),rawDestructor:Me(i,o),fields:[]}},_embind_register_value_object_field:function(e,t,r,n,i,o,s,a,l,c){t>>>=0,r>>>=0,n>>>=0,i>>>=0,o>>>=0,s>>>=0,a>>>=0,l>>>=0,c>>>=0,Z[e>>>=0].fields.push({fieldName:ce(t),getterReturnType:r,getter:Me(n,i),getterContext:o,setterArgumentType:s,setter:Me(a,l),setterContext:c})},_embind_register_void:function(e,t){de(e>>>=0,{isVoid:!0,name:t=ce(t>>>=0),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},_emval_as:function(e,t,r){return e>>>=0,t>>>=0,r>>>=0,e=Ze.toValue(e),t=Qe(t,"emval::as"),ct(t,r,e)},_emval_call:function(e,t,r,n){return t>>>=0,r>>>=0,n>>>=0,(e=ut[e>>>=0])(null,t=Ze.toValue(t),r,n)},_emval_call_method:function(e,t,r,n,i){return t>>>=0,r>>>=0,n>>>=0,i>>>=0,(e=ut[e>>>=0])(t=Ze.toValue(t),t[r=ht(r)],n,i)},_emval_decref:Ye,_emval_get_global:function(e){return 0==(e>>>=0)?Ze.toHandle(pt()):(e=ht(e),Ze.toHandle(pt()[e]))},_emval_get_method_caller:function(e,t,r){var n=((e,t)=>{for(var r=new Array(e),n=0;n<e;++n)r[n]=Qe(T[t+4*n>>>2>>>0],"parameter "+n);return r})(e,t>>>=0),i=n.shift();e--;var o="return function (obj, func, destructorsRef, args) {\n",s=0,a=[];0===r&&a.push("obj");for(var l=["retType"],c=[i],u=0;u<e;++u)a.push("arg"+u),l.push("argType"+u),c.push(n[u]),o+=` var arg${u} = argType${u}.readValueFromPointer(args${s?"+"+s:""});\n`,s+=n[u].argPackAdvance;for(o+=` var rv = ${1===r?"new func":"func.call"}(${a.join(", ")});\n`,u=0;u<e;++u)n[u].deleteObject&&(o+=` argType${u}.deleteObject(arg${u});\n`);i.isVoid||(l.push("emval_returnValue"),c.push(ct),o+=" return emval_returnValue(retType, destructorsRef, rv);\n"),o+="};\n",l.push(o);var d,h,p=qe(Function,l).apply(null,c),f=`methodCaller<(${n.map((e=>e.name)).join(", ")}) => ${i.name}>`;return d=Ce(f,p),h=ut.length,ut.push(d),h},_emval_get_module_property:function(e){return e=ht(e>>>=0),Ze.toHandle(o[e])},_emval_get_property:function(e,t){return e>>>=0,t>>>=0,e=Ze.toValue(e),t=Ze.toValue(t),Ze.toHandle(e[t])},_emval_incref:function(e){(e>>>=0)>4&&(Ge.get(e).refcount+=1)},_emval_instanceof:function(e,t){return e>>>=0,t>>>=0,(e=Ze.toValue(e))instanceof Ze.toValue(t)},_emval_new_array:function(){return Ze.toHandle([])},_emval_new_cstring:function(e){return e>>>=0,Ze.toHandle(ht(e))},_emval_new_object:function(){return Ze.toHandle({})},_emval_run_destructors:function(e){e>>>=0;var t=Ze.toValue(e);K(t),Ye(e)},_emval_set_property:function(e,t,r){e>>>=0,t>>>=0,r>>>=0,e=Ze.toValue(e),t=Ze.toValue(t),r=Ze.toValue(r),e[t]=r},_emval_take_value:function(e,t){t>>>=0;var r=(e=Qe(e>>>=0,"_emval_take_value")).readValueFromPointer(t);return Ze.toHandle(r)},_emval_typeof:function(e){return e>>>=0,e=Ze.toValue(e),Ze.toHandle(typeof e)},clock_time_get:function(e,t,r){if(t=Y(t),r>>>=0,0!=(n=e)&&1!=n&&2!=n&&3!=n)return 28;var n,i;i=0===e?Date.now():Xe();var o=Math.round(1e3*i*1e3);return w[r>>>2>>>0]=o>>>0,w[r+4>>>2>>>0]=o/Math.pow(2,32)>>>0,0},emscripten_asm_const_int:function(e,t,r){return((e,t,r)=>{var n=((e,t)=>{var r;for(mt.length=0;r=y[e++>>>0];){var n=105!=r;t+=(n&=112!=r)&&t%8?4:0,mt.push(112==r?T[t>>>2>>>0]:106==r?P[t>>>3]:105==r?w[t>>>2>>>0]:C[t>>>3>>>0]),t+=n?8:4}return mt})(t,r);return z[e].apply(null,n)})(e>>>=0,t>>>=0,r>>>=0)},emscripten_notify_memory_growth:function(e){A()},environ_get:function(e,t){e>>>=0,t>>>=0;var r=0;return yt().forEach(((n,i)=>{var o=t+r;T[e+4*i>>>2>>>0]=o,((e,t)=>{for(var r=0;r<e.length;++r)g[t++>>>0>>>0]=e.charCodeAt(r);g[t>>>0>>>0]=0})(n,o),r+=n.length+1})),0},environ_sizes_get:function(e,t){e>>>=0,t>>>=0;var r=yt();T[e>>>2>>>0]=r.length;var n=0;return r.forEach((e=>n+=e.length+1)),T[t>>>2>>>0]=n,0},fd_close:e=>52,fd_read:function(e,t,r,n){return 52},fd_seek:function(e,t,r,n){return t=Y(t),70},fd_write:function(e,t,r,n){t>>>=0,r>>>=0,n>>>=0;for(var i,o,s,a=0,l=0;l<r;l++){var c=T[t>>>2>>>0],u=T[t+4>>>2>>>0];t+=8;for(var d=0;d<u;d++)i=e,o=y[c+d>>>0],s=void 0,s=vt[i],0===o||10===o?((1===i?f:_)(J(s,0)),s.length=0):s.push(o);a+=u}return T[n>>>2>>>0]=a,0},proc_exit:bt,strptime:function(e,t,r){e>>>=0,r>>>=0;for(var n=G(t>>>=0),i="\\!@#$^&*()+=-[]/{}|:<>?,.",o=0;o<25;++o)n=n.replace(new RegExp("\\"+i[o],"g"),"\\"+i[o]);var s={"%A":"%a","%B":"%b","%c":"%a %b %d %H:%M:%S %Y","%D":"%m\\/%d\\/%y","%e":"%d","%F":"%Y-%m-%d","%h":"%b","%R":"%H\\:%M","%r":"%I\\:%M\\:%S\\s%p","%T":"%H\\:%M\\:%S","%x":"%m\\/%d\\/(?:%y|%Y)","%X":"%H\\:%M\\:%S"};for(var a in s)n=n.replace(a,s[a]);var l={"%a":"(?:Sun(?:day)?)|(?:Mon(?:day)?)|(?:Tue(?:sday)?)|(?:Wed(?:nesday)?)|(?:Thu(?:rsday)?)|(?:Fri(?:day)?)|(?:Sat(?:urday)?)","%b":"(?:Jan(?:uary)?)|(?:Feb(?:ruary)?)|(?:Mar(?:ch)?)|(?:Apr(?:il)?)|May|(?:Jun(?:e)?)|(?:Jul(?:y)?)|(?:Aug(?:ust)?)|(?:Sep(?:tember)?)|(?:Oct(?:ober)?)|(?:Nov(?:ember)?)|(?:Dec(?:ember)?)","%C":"\\d\\d","%d":"0[1-9]|[1-9](?!\\d)|1\\d|2\\d|30|31","%H":"\\d(?!\\d)|[0,1]\\d|20|21|22|23","%I":"\\d(?!\\d)|0\\d|10|11|12","%j":"00[1-9]|0?[1-9](?!\\d)|0?[1-9]\\d(?!\\d)|[1,2]\\d\\d|3[0-6]\\d","%m":"0[1-9]|[1-9](?!\\d)|10|11|12","%M":"0\\d|\\d(?!\\d)|[1-5]\\d","%n":"\\s","%p":"AM|am|PM|pm|A\\.M\\.|a\\.m\\.|P\\.M\\.|p\\.m\\.","%S":"0\\d|\\d(?!\\d)|[1-5]\\d|60","%U":"0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53","%W":"0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53","%w":"[0-6]","%y":"\\d\\d","%Y":"\\d\\d\\d\\d","%%":"%","%t":"\\s"};for(var c in l)n=n.replace(c,"("+c+l[c]+")");var u=[];for(o=n.indexOf("%");o>=0;o=n.indexOf("%"))u.push(n[o+1]),n=n.replace(new RegExp("\\%"+n[o+1],"g"),"");var d,h,p,f=new RegExp("^"+n,"i").exec(G(e));if(f){var _,m=function(){function e(e,t,r){return"number"!=typeof e||isNaN(e)?t:e>=t?e<=r?e:r:t}return{year:e(w[r+20>>>2>>>0]+1900,1970,9999),month:e(w[r+16>>>2>>>0],0,11),day:e(w[r+12>>>2>>>0],1,31),hour:e(w[r+8>>>2>>>0],0,23),min:e(w[r+4>>>2>>>0],0,59),sec:e(w[r>>>2>>>0],0,59)}}(),g=e=>{var t=u.indexOf(e);if(t>=0)return f[t+1]};if((_=g("S"))&&(m.sec=Ct(_)),(_=g("M"))&&(m.min=Ct(_)),_=g("H"))m.hour=Ct(_);else if(_=g("I")){var y=Ct(_);(_=g("p"))&&(y+="P"===_.toUpperCase()[0]?12:0),m.hour=y}if(_=g("Y"))m.year=Ct(_);else if(_=g("y")){var v=Ct(_);(_=g("C"))?v+=100*Ct(_):v+=v<69?2e3:1900,m.year=v}if((_=g("m"))?m.month=Ct(_)-1:(_=g("b"))&&(m.month={JAN:0,FEB:1,MAR:2,APR:3,MAY:4,JUN:5,JUL:6,AUG:7,SEP:8,OCT:9,NOV:10,DEC:11}[_.substring(0,3).toUpperCase()]||0),_=g("d"))m.day=Ct(_);else if(_=g("j"))for(var b=Ct(_),T=wt(m.year),$=0;$<12;++$){var P=Tt(T?$t:Pt,$-1);b<=P+(T?$t:Pt)[$]&&(m.day=b-P)}else if(_=g("a")){var k=_.substring(0,3).toUpperCase();if(_=g("U")){var C={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6}[k],O=Ct(_);E=0===(A=new Date(m.year,0,1)).getDay()?kt(A,C+7*(O-1)):kt(A,7-A.getDay()+C+7*(O-1)),m.day=E.getDate(),m.month=E.getMonth()}else if(_=g("W")){var A,E;C={MON:0,TUE:1,WED:2,THU:3,FRI:4,SAT:5,SUN:6}[k],O=Ct(_),E=1===(A=new Date(m.year,0,1)).getDay()?kt(A,C+7*(O-1)):kt(A,7-A.getDay()+1+C+7*(O-1)),m.day=E.getDate(),m.month=E.getMonth()}}var x=new Date(m.year,m.month,m.day,m.hour,m.min,m.sec,0);return w[r>>>2>>>0]=x.getSeconds(),w[r+4>>>2>>>0]=x.getMinutes(),w[r+8>>>2>>>0]=x.getHours(),w[r+12>>>2>>>0]=x.getDate(),w[r+16>>>2>>>0]=x.getMonth(),w[r+20>>>2>>>0]=x.getFullYear()-1900,w[r+24>>>2>>>0]=x.getDay(),w[r+28>>>2>>>0]=Tt(wt(x.getFullYear())?$t:Pt,x.getMonth()-1)+x.getDate()-1,w[r+32>>>2>>>0]=0,e+(d=f[0],h=tt(d)+1,p=new Array(h),X(d,p,0,p.length),p).length-1}return 0}},Et=function(){var e,t,r,n,s={env:At,wasi_snapshot_preview1:At};function a(e,t){return Et=function(e){var t=e=>t=>e(t)>>>0,r=e=>()=>e()>>>0;return(e=Object.assign({},e)).malloc=t(e.malloc),e.__errno_location=r(e.__errno_location),e.__getTypeName=t(e.__getTypeName),e.stackSave=r(e.stackSave),e.stackAlloc=t(e.stackAlloc),e}(Et=e.exports),p=Et.memory,A(),Fe=Et.__indirect_function_table,function(e){if(N--,o.monitorRunDependencies&&o.monitorRunDependencies(N),0==N&&(null!==R&&(clearInterval(R),R=null),V)){var t=V;V=null,t()}}(),Et}if(N++,o.monitorRunDependencies&&o.monitorRunDependencies(N),o.instantiateWasm)try{return o.instantiateWasm(s,a)}catch(e){_(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return(e=h,t=D,r=s,n=function(e){a(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||W(t)||"function"!=typeof fetch?U(t,r,n):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(n,(function(e){return _(`wasm streaming compile failed: ${e}`),_("falling back to ArrayBuffer instantiation"),U(t,r,n)}))))).catch(i),{}}(),xt=e=>(xt=Et.malloc)(e),St=e=>(St=Et.free)(e),jt=o.__initialize=()=>(jt=o.__initialize=Et._initialize)(),Nt=e=>(Nt=Et.__getTypeName)(e);function Rt(e=l){function t(){Ot||(Ot=!0,o.calledRun=!0,O||(q(x),q(S),n(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),Vt&&function(e=[]){var t,r=jt;[c].concat(e);try{return r(),m=t=0,bt(t),0}catch(e){return(e=>{if(e instanceof H||"unwind"==e)return m;u(1,e)})(e)}}(e),function(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)e=o.postRun.shift(),j.unshift(e);var e;q(j)}()))}N>0||(function(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)e=o.preRun.shift(),E.unshift(e);var e;q(E)}(),N>0||(o.setStatus?(o.setStatus("Running..."),setTimeout((function(){setTimeout((function(){o.setStatus("")}),1),t()}),1)):t()))}if(V=function e(){Ot||Rt(),Ot||(V=e)},o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();var Vt=!0;return o.noInitialRun&&(Vt=!1),Rt(),t.ready}),i={integer:"integer",float:"float",string:"string",boolean:"boolean",date:"date",datetime:"datetime",object:"object"},o={row_pivot:"group_by","row-pivot":"group_by","row-pivots":"group_by",col_pivot:"split_by",col_pivots:"split_by",column_pivot:"split_by","column-pivot":"split_by","column-pivots":"split_by",filters:"filter",sorts:"sort"},s=["version","viewport","group_by","split_by","aggregates","columns","filter","sort","computed_columns","expressions","group_by_depth","split_by_depth","filter_op"],a=["any","avg","abs sum","count","distinct count","dominant","first by index","last by index","last minus first","last","high","join","low","high minus low","max","mean","median","min","pct sum parent","pct sum grand total","stddev","sum","sum abs","sum not null","unique","var"],l=["any","count","distinct count","distinct leaf","dominant","first by index","join","last by index","last","unique"],c=["none","asc","desc","col asc","col desc","asc abs","desc abs","col asc abs","col desc abs"],u=[2,0,1,0,1,3,4,3,4],d={string:l,float:a,integer:a,boolean:["any","count","distinct count","distinct leaf","dominant","first by index","last by index","last","unique"],datetime:l,date:l},h={lessThan:"<",greaterThan:">",equals:"==",lessThanOrEquals:"<=",greaterThanOrEquals:">=",doesNotEqual:"!=",isNull:"is null",isNotNull:"is not null",isIn:"in",isNotIn:"not in",contains:"contains",bitwiseAnd:"&",bitwiseOr:"|",and:"and",or:"or",beginsWith:"begins with",endsWith:"ends with"},p=[h.bitwiseAnd,h.bitwiseOr,h.equals,h.doesNotEqual,h.or,h.and,h.isNull,h.isNotNull],f=[h.lessThan,h.greaterThan,h.equals,h.lessThanOrEquals,h.greaterThanOrEquals,h.doesNotEqual,h.isNull,h.isNotNull],_=[h.equals,h.contains,h.doesNotEqual,h.isIn,h.isNotIn,h.beginsWith,h.endsWith,h.isNull,h.isNotNull],m=[h.lessThan,h.greaterThan,h.equals,h.lessThanOrEquals,h.greaterThanOrEquals,h.doesNotEqual,h.isNull,h.isNotNull],g="|",y={string:_,float:f,integer:f,boolean:p,datetime:m,date:m},v={types:{float:{filter_operator:"==",aggregate:"sum",format:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}},string:{filter_operator:"==",aggregate:"count"},integer:{filter_operator:"==",aggregate:"sum",format:{}},boolean:{filter_operator:"==",aggregate:"count"},datetime:{filter_operator:"==",aggregate:"count",format:{dateStyle:"short",timeStyle:"medium"},null_value:-1},date:{filter_operator:"==",aggregate:"count",format:{dateStyle:"short"},null_value:-1}}};function b(e){const t={};if($().types[e]&&Object.assign(t,$().types[e]),t.type){const e=b(t.type);return Object.assign(e,t),e}return t}function w(e){return e&&"object"==typeof e&&!Array.isArray(e)}function T(e,...t){if(!t.length)return e;const r=t.shift();if(w(e)&&w(r))for(const t in r)w(r[t])?(e[t]||Object.assign(e,{[t]:{}}),T(e[t],r[t])):Object.assign(e,{[t]:r[t]});return T(e,...t)}function $(){return globalThis.__PERSPECTIVE_CONFIG__||(globalThis.__PERSPECTIVE_CONFIG__=T(v,globalThis.__TEMPLATE_CONFIG__||{})),globalThis.__PERSPECTIVE_CONFIG__}function P(e){return e>=1&&e<=8?"integer":19===e?"string":10===e||9===e?"float":11===e?"boolean":12===e?"datetime":13===e?"date":void console.warn(`Unknown type for value ${e} with JS type ${typeof e}`)}function k(e){let t=e;do{for(const r of Object.getOwnPropertyNames(t)){const t=e[r];"constructor"!==r&&"function"==typeof t&&(e[r]=t.bind(e))}}while(t=t!==Object&&Object.getPrototypeOf(t))}String.prototype.includes||(String.prototype.includes=function(e,t){return"number"!=typeof t&&(t=0),!(t+e.length>this.length)&&-1!==this.indexOf(e,t)}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(e,t){if(null==this)throw new TypeError('"this" is null or not defined');var r=Object(this),n=r.length>>>0;if(0===n)return!1;for(var i,o,s=0|t,a=Math.max(s>=0?s:n-Math.abs(s),0);a<n;){if((i=r[a])===(o=e)||"number"==typeof i&&"number"==typeof o&&isNaN(i)&&isNaN(o))return!0;a++}return!1}});class C{constructor(){this.data_formats={row:0,column:1,schema:2},this.format=void 0,this.data=void 0,this.names=void 0,this.types=void 0,this.row_count=void 0}is_format(e){if(Array.isArray(e))return this.data_formats.row;if(Array.isArray(e[Object.keys(e)[0]]))return this.data_formats.column;if("string"==typeof e[Object.keys(e)[0]]||"function"==typeof e[Object.keys(e)[0]])return this.data_formats.schema;throw`Could not determine data format for ${JSON.stringify(e)}, with JS typeof ${typeof e}`}count_rows(e){return this.format===this.data_formats.row?e.length:this.format===this.data_formats.column?e[Object.keys(e)[0]].length:0}get_format(){return this.format}get(e,t){let r;if(this.format===this.data_formats.row){let n=this.data[t];n.hasOwnProperty(e)&&(r=n[e])}else if(this.format===this.data_formats.column)this.data.hasOwnProperty(e)&&(r=this.data[e][t]);else{if(this.format!==this.data_formats.schema)throw`Could not get() from dataset - ${this.data} is poorly formatted.`;r=void 0}return r}marshal(e,t,r){const n=this.names[e];let i=null===(o=this.get(n,t))||"null"===o?null:void 0===o||"undefined"===o?void 0:o;var o;if(null===i)return null;if(void 0!==i){switch(P(r.value)){case"float":case"integer":i=Number(i);break;case"boolean":i="string"==typeof i?"true"===i.toLowerCase():!!i;break;case"datetime":case"date":break;default:i+=""}return i}}clean(){this.names=void 0,this.types=void 0}init(e){this.data=e,this.format=this.is_format(this.data),this.row_count=this.count_rows(this.data);const t={};if(this.format===this.data_formats.row)e.length>0?this.names=Object.keys(e[0]):this.clean.names=[];else if(this.format===this.data_formats.column)this.names=Object.keys(e);else{if(this.format!==this.data_formats.schema)throw`Could not initialize - failed to determine format for ${e}`;this.names=Object.keys(e);for(const r of this.names){const n=b(e[r]);n.type&&(console.debug(`Converting "${e[r]}" to "${n.type}"`),t[r]=e[r],e[r]=n.type)}}return t}}const O=function(e){let t=[];for(let r=0;r<e.size();r++){let n=e.get(r);t.push(n)}return e.delete(),t},A=function(e){let t={},r=e.keys();for(let n=0;n<r.size();n++){let i=r.get(n);t[i]=e.get(i)}return e.delete(),r.delete(),t},E=function(e,t){for(const r of t)e.push_back(r);return e};function x(e){const t={};return"string"!=typeof e?Object.getOwnPropertyNames(e).forEach((r=>{t[r]=e[r]}),e):t.message=e,t}class S{constructor(e){this.perspective=e,this._tables={},this._views={},this._callback_cache=new Map}init(e){var t;e.config&&(t=e.config,globalThis.__PERSPECTIVE_CONFIG__&&console.warn("Config already initialized!"),globalThis.__PERSPECTIVE_CONFIG__=T(v,t)),e.data=["wait_for_response"],this.post(e)}post(e){throw new Error(`Posting ${e} failed - post() not implemented!`)}process(e,t){switch(e.cmd){case"init_profile_thread":this.perspective.initialize_profile_thread();break;case"get_hosted_table_names":this.post({id:e.id,data:Object.keys(this._tables)});break;case"memory_usage":this.post({id:e.id,data:this.perspective.memory_usage()});break;case"init":this.init(e);break;case"table":if(void 0===e.args[0])this._tables[e.name]=[];else try{const t=this._tables[e.name],r=this.perspective.table(e.args[0],e.options);if(r&&r.then)r.then((r=>{if(this._tables[e.name]=r,t)for(const e of t)this.process(e);this.post({id:e.id,data:e.name})})).catch((t=>this.process_error(e,t)));else{if(this._tables[e.name]=r,t)for(const e of t)this.process(e);this.post({id:e.id,data:e.name})}}catch(t){return void this.process_error(e,t)}break;case"table_generate":(0,eval)(e.args)((function(t){this._tables[e.name]=t,this.post({id:e.id,data:"created!"})}));break;case"table_execute":(0,eval)(e.f)(this._tables[e.name]);break;case"table_method":case"view_method":this.process_method_call(e);break;case"view":const r=this._tables[e.table_name];if(r&&Array.isArray(r))r.push(e),this._views[e.view_name]=[];else try{const r=this._views[e.view_name],n=this._tables[e.table_name].view(e.config);if(n&&n.then)n.then((n=>{if(this._views[e.view_name]=n,this._views[e.view_name].client_id=t,r)for(const e of r)this.process(e);this.post({id:e.id,data:e.view_name})})).catch((t=>this.process_error(e,t)));else{if(this._views[e.view_name]=n,this._views[e.view_name].client_id=t,r)for(const e of r)this.process(e);this.post({id:e.id,data:e.view_name})}}catch(t){return void this.process_error(e,t)}}}process_subscribe(e,t){try{let r;"on"===e.method.slice(0,2)?(r=n=>{let i={id:e.id,data:n};try{if(e.args&&e.args[0]&&"on_update"===e.method&&"row"===e.args[0].mode)return void this.post(i,[n.delta]);this.post(i)}catch(n){console.error(`Removing failed callback to \`${e.method}()\` (presumably due to failed connection)`);const i=e.method.substring(3);t[`remove_${i}`](r)}},e.callback_id&&this._callback_cache.set(e.callback_id,r)):e.callback_id&&(r=this._callback_cache.get(e.callback_id),this._callback_cache.delete(e.callback_id)),r?t[e.method](r,...e.args):console.error(`Callback not found for remote call "${JSON.stringify(e)}"`)}catch(t){return void this.process_error(e,t)}}process_method_call(e){let t,r;const n=e.view_name||e.name;if(t="table_method"===e.cmd?this._tables[n]:this._views[n],t||"view_method"!==e.cmd)if(t&&t.push)t.push(e);else try{if(e.subscribe)return void this.process_subscribe(e,t);r=t[e.method].apply(t,e.args),r instanceof Promise?r.then((t=>this.process_method_call_response(e,t))).catch((t=>this.process_error(e,t))):this.process_method_call_response(e,r)}catch(t){return void this.process_error(e,t)}else this.process_error(e,{message:"View method cancelled"})}process_method_call_response(e,t){"delete"===e.method&&delete this._views[e.name],"to_arrow"===e.method?this.post({id:e.id,data:t},[t]):this.post({id:e.id,data:t})}process_error(e,t){try{this.post({id:e.id,error:x(t)})}catch(e){console.error("Error handler failed: {}",t)}}clear_views(e){for(let t of Object.keys(this._views))if(this._views[t].client_id===e){try{this._views[t].delete()}catch(e){console.error(e)}delete this._views[t]}console.debug(`GC ${Object.keys(this._views).length} views in memory`)}}"undefined"!=typeof self&&void 0===self.performance&&(self.performance={now:Date.now});const j=new Set;globalThis.perspective=function(e){let r=e,n=new C;const i=["zero","one","two"];let a={};function l(e){const t=a[e];t&&(t._process(),c(e))}function c(e){a[e]?.delete(),delete a[e]}function u(e,t,n,i,o,s,c,u,d){n||(n=""),i||(i=4294967295);const h=(t=r.make_table(t,e,i,n,o,s,c,u,d)).get_pool(),p=t.get_id();return s||o==r.t_op.OP_DELETE?function(e,t){a[t]?e.delete():(a[t]=e,setTimeout((()=>l(t))))}(h,p):(h._process(),h.delete()),t}function d(e,t,n,i,o){this.name=o,this._View=void 0,this.table=e,this.config=n||{},this.view_config=i||new i,this.is_unit_context=""===this.table.index&&0===t&&0===this.view_config.group_by.length&&0===this.view_config.split_by.length&&0===this.view_config.filter.length&&0===this.view_config.sort.length&&0===this.view_config.expressions.length,this.is_unit_context?this._View=r.make_view_unit(e._Table,o,g,this.view_config,null):0===t?this._View=r.make_view_zero(e._Table,o,g,this.view_config,null):1===t?this._View=r.make_view_one(e._Table,o,g,this.view_config,null):2===t&&(this._View=r.make_view_two(e._Table,o,g,this.view_config,null)),this.ctx=this._View.get_context(),this.column_only=this._View.is_column_only(),this.update_callbacks=this.table.update_callbacks,this.overridden_types=this.table.overridden_types,this._delete_callbacks=[],k(this)}function h(e){let t=[];for(let n=0;n<e.size();n++){let i=e.get(n);t.push(r.scalar_to_val(i,!1,!0)),i.delete()}return e.delete(),t}d.prototype.get_config=function(){return JSON.parse(JSON.stringify(this.config))},d.prototype.delete=function(){c(this.table.get_id()),this._View.delete(),this.ctx.delete(),this.table.views.splice(this.table.views.indexOf(this),1),this.table=void 0;let e=0,t=0;for(;e<this.update_callbacks.length;){let r=this.update_callbacks[e];r.view!==this&&(this.update_callbacks[t++]=r),e++}this.update_callbacks.length=t,this._delete_callbacks.forEach((e=>e()))},d.prototype.sides=function(){return this._View.sides()},d.prototype._num_hidden=function(){let e=0;for(const t of this.config.sort)-1===this.config.columns.indexOf(t[0])&&e++;return e};const p=function(e){let t=[];for(let r=0;r<e.size();r++){let n=e.get(r);t.push(h(n))}return e.delete(),t};d.prototype.schema=function(e=!0){const t=A(this._View.schema());if(e)for(const e of Object.keys(t)){let r=e.split(g);r=r[r.length-1],this.overridden_types[r]&&b(this.overridden_types[r]).type===t[e]&&(t[e]=this.overridden_types[r])}return t},d.prototype.expression_schema=function(e=!0){const t=A(this._View.expression_schema());if(e)for(const e of Object.keys(t)){let r=e.split(g);r=r[r.length-1],this.overridden_types[r]&&b(this.overridden_types[r]).type===t[e]&&(t[e]=this.overridden_types[r])}return t},d.prototype._column_names=function(e=!1,t=0){return p(this._View.column_names(e,t)).map((e=>e.join(g)))},d.prototype.column_paths=function(){return p(this._View.column_paths()).map((e=>e.join(g)))},d.prototype.get_data_slice=function(e,t,n,o){if(this.is_unit_context)return r.get_data_slice_unit(this._View,e,t,n,o);{const s=this.sides();return r[`get_data_slice_${i[s]}`](this._View,e,t,n,o)}};const f=function(e){e=e||{};const t=this._View.num_columns()+(0===this.sides()?0:1),r=this._View.num_rows(),n=this._num_hidden(),i=this.sides()>0||this.column_only?1:0,o=this.config.viewport?this.config.viewport:{},s=e.start_row||(o.top?o.top:0),a=Math.min(r,void 0!==e.end_row?e.end_row:o.height?s+o.height:r),l=e.start_col||(o.left?o.left:0),c=Math.min(t,(void 0!==e.end_col?e.end_col+i:o.width?l+o.width:t)*(n+1));return e.start_row=Math.floor(s),e.end_row=Math.ceil(a),e.start_col=Math.floor(l),e.end_col=Math.ceil(c),e};d.prototype.get_min_max=function(e){if(this.is_unit_context)return r.get_min_max_unit(this._View,e);{const t=this.sides();return r[`get_min_max_${i[t]}`](this._View,e)}};const _=function(e,t,r){const n=this.num_rows(),i=t.start_row||0,o=t.end_row||n;let s,a,l=this._column_names().indexOf(e);if(-1===l)return;this.sides()>0&&l++,t.data_slice?s=t.data_slice.get_column_slice(l):(a=this.get_data_slice(i,o,l,l+1),s=a.get_slice());const c=r(s,this._View.get_column_dtype(l),l);return s.delete(),a&&a.delete(),c};function m(e,t){let r=0,n=0;for(;r<e.length;){const i=e[r];t(i,r,e)&&(e[n++]=i),r++}return e.length=n,e}function y(e){this.group_by=e.group_by||[],this.split_by=e.split_by||[],this.aggregates=e.aggregates||{},this.columns=e.columns,this.filter=e.filter||[],this.sort=e.sort||[],this.expressions=e.expressions||[],this.filter_op=e.filter_op||"and",this.group_by_depth=e.group_by_depth,this.split_by_depth=e.split_by_depth}function v(e,t,r,n){this._Table=e;const i=this._Table.get_gnode();this.gnode_id=i.get_id(),i.delete();const o=this._Table.get_pool();o.set_update_delegate(this),o.delete(),this.name=Math.random()+"",this.initialized=!1,this.index=t,this.limit=r,this.update_callbacks=[],this._delete_callbacks=[],this.views=[],this.overridden_types=n,k(this)}function w(e){let t=[];const r={},n=!Array.isArray(e);for(let i of n?Object.keys(e):e){const o=i;n&&(i=e[i]);let s,a={},l={},c=0;if(n)s=o;else{let e=i.match(/^\/\/(?<alias>.+?)\n/);e?.groups?.alias&&(s=e.groups.alias.trim()),s&&0!=s.length||(s=i)}let u=i.replace(/([a-zA-Z_]+[a-zA-Z0-9_]*)/g,(e=>"true"==e?"True":"false"==e?"False":e));u=u.replace(/\"(.*?[^\\])\"/g,((e,t)=>{if(t=t.replace(/\\"/g,'"'),void 0===a[t]){let e=`COLUMN${c}`;a[t]=e,l[e]=t}return c++,a[t]})),u=u.replace(/'(.*?[^\\])'/g,(e=>`intern(${e})`));const d=(e,t,r,n)=>{const i=e.indexOf(r);return`${e.substring(0,i)}'${n}'${e.substring(i+r.length)}`};u=u.replace(/(bucket|match|match_all|search|indexof)\(.*?,\s*(intern\(\'(.+)\'\)).*\)/g,d),u=u.replace(/(replace_all|replace)\(.*?,\s*(intern\(\'(.*)\'\)),.*\)/g,d);const h=[s,i,u,l];void 0!==r[s]?t[r[s]]=h:(t.push(h),r[s]=t.length-1)}return t}let T;d.prototype.to_columns=function(e){return JSON.parse(this.to_columns_string(e))},d.prototype.to_columns_string=function(e){l(this.table.get_id());const t=(e=f.bind(this)(e)).start_row,r=e.end_row,n=e.start_col,o=e.end_col,s=this._num_hidden(),a=e.formatted,c=!!e.index,u=!!e.id,d=!!e.leaves_only,h=this.sides(),p=0!==h&&!this.column_only,_=i[h],m=this.get_config(),g=m.columns.length,y=m.group_by.length;return this._View.to_columns(t,r,n,o,s,a,c,u,d,h,p,_,g,y)},d.prototype.to_json=function(e){const t=this.to_columns(e),r=Object.keys(t);return(t[r[0]]||[]).map(((e,n)=>{const i={};for(const e of r)i[e]=t[e][n];return i}))},d.prototype.to_csv=function(e){l(this.table.get_id());const t=(e=f.bind(this)(e)).start_row,n=e.end_row,i=e.start_col,o=e.end_col,s=this.sides();return this.is_unit_context?r.to_csv_unit(this._View,t,n,i,o):0===s?r.to_csv_zero(this._View,t,n,i,o):1===s?r.to_csv_one(this._View,t,n,i,o):2===s?r.to_csv_two(this._View,t,n,i,o):void 0},d.prototype.col_to_js_typed_array=function(e,t={}){l(this.table.get_id());const n=r.col_to_js_typed_array;return _.call(this,e,t,n)},d.prototype.to_arrow=function(e={}){l(this.table.get_id());const t=(e=f.bind(this)(e)).start_row,n=e.end_row,i=e.start_col,o=e.end_col,s=this.sides(),a=!("compression"in e)||"lz4"===e.compression;return this.is_unit_context?r.to_arrow_unit(this._View,t,n,i,o,a):0===s?r.to_arrow_zero(this._View,t,n,i,o,a):1===s?r.to_arrow_one(this._View,t,n,i,o,a):2===s?r.to_arrow_two(this._View,t,n,i,o,a):void 0},d.prototype.num_rows=function(){return l(this.table.get_id()),this._View.num_rows()},d.prototype.num_columns=function(){const e=this._View.num_columns(),t=this._num_hidden();return e-e/(this.config.columns.length+t)*t},d.prototype.dimensions=function(){return{num_table_rows:this.table.num_rows(),num_table_columns:this.table.num_columns(),num_view_rows:this._View.num_rows(),num_view_columns:this.num_columns()}},d.prototype.get_row_expanded=function(e){return this._View.get_row_expanded(e)},d.prototype.expand=function(e){return this._View.expand(e,this.config.group_by.length)},d.prototype.collapse=function(e){return this._View.collapse(e)},d.prototype.set_depth=function(e){return this._View.set_depth(e,this.config.group_by.length)},d.prototype._get_step_delta=async function(){let e,t=this._View.get_step_delta(0,2147483647);if(0===t.cells.size())e=this.to_json();else{let r={};for(let e=0;e<t.cells.size();e++)r[t.cells.get(e).row]=!0;r=Object.keys(r);const n=r.map((e=>this.to_json({start_row:Number.parseInt(e),end_row:Number.parseInt(e)+1})));e=[].concat.apply([],n)}return t.cells.delete(),e},d.prototype._get_row_delta=async function(){if(this.is_unit_context)return r.get_row_delta_unit(this._View);{const e=this.sides();return r[`get_row_delta_${i[e]}`](this._View)}},d.prototype.on_update=function(e,{mode:t="none"}={}){if(l(this.table.get_id()),-1===["none","row"].indexOf(t))throw new Error(`Invalid update mode "${t}" - valid modes are "none" and "row".`);"row"===t&&(this._View._get_deltas_enabled()||this._View._set_deltas_enabled(!0)),this.update_callbacks.push({view:this,orig_callback:e,callback:async(r,n)=>{void 0===n[r]&&(n[r]={});let i={port_id:r};"row"===t&&(void 0===n[r].row_delta&&(n[r].row_delta=await this._get_row_delta()),i.delta=n[r].row_delta),e(i)}})},d.prototype.remove_update=function(e){l(this.table.get_id());const t=this.update_callbacks.length;m(this.update_callbacks,(t=>t.orig_callback!==e)),console.assert(t>this.update_callbacks.length,'"callback" does not match a registered updater')},d.prototype.on_delete=function(e){this._delete_callbacks.push(e)},d.prototype.remove_delete=function(e){const t=this._delete_callbacks.length;m(this._delete_callbacks,(t=>t!==e)),console.assert(t>this._delete_callbacks.length,'"callback" does not match a registered delete callbacks')},y.prototype.get_group_by=function(){let e=r.make_string_vector();return E(e,this.group_by)},y.prototype.get_split_by=function(){let e=r.make_string_vector();return E(e,this.split_by)},y.prototype.get_columns=function(){let e=r.make_string_vector();return E(e,this.columns)},y.prototype.get_filter=function(){let e=r.make_2d_val_vector();for(let t of this.filter){let n=r.make_val_vector(),i=E(n,t);e.push_back(i)}return e},y.prototype.get_sort=function(){let e=r.make_2d_string_vector();for(let t of this.sort){let n=r.make_string_vector(),i=E(n,t);e.push_back(i)}return e},y.prototype.get_expressions=function(){let e=r.make_2d_val_vector();for(let t of this.expressions){let n=r.make_val_vector();for(let e of t)n.push_back(e);e.push_back(n)}return e},v.prototype.get_id=function(){return this._Table.get_id()},v.prototype.get_pool=function(){return this._Table.get_pool()},v.prototype.make_port=function(){return this._Table.make_port()},v.prototype.remove_port=function(){this._Table.remove_port()},v.prototype._update_callback=function(e){let t={};for(let r in this.update_callbacks)this.update_callbacks[r].callback(e,t)},v.prototype.get_index=function(){return this.index},v.prototype.get_limit=function(){return this.limit},v.prototype.clear=function(){l(this.get_id()),this._Table.reset_gnode(this.gnode_id)},v.prototype.get_num_views=function(){return this.views.length},v.prototype.replace=function(e){c(this.get_id()),this._Table.reset_gnode(this.gnode_id),this.update(e),l(this.get_id())},v.prototype.delete=function(){if(this.views.length>0)throw`Cannot delete Table as it still has ${this.views.length} registered View(s).`;c(this.get_id()),this._Table.unregister_gnode(this.gnode_id),this._Table.delete();for(const e of this._delete_callbacks)e()},v.prototype.on_delete=function(e){this._delete_callbacks.push(e)},v.prototype.remove_delete=function(e){const t=this._delete_callbacks.length;m(this._delete_callbacks,(t=>t!==e)),console.assert(t>this._delete_callbacks.length,'"callback" does not match a registered delete callbacks')},v.prototype.size=function(){return l(this._Table.get_id()),this._Table.size()},v.prototype.num_rows=function(){return this.size()},v.prototype.num_columns=function(){let e=this._Table.get_schema(),t=e.columns();const r=t.size();return t.delete(),e.delete(),r-1},v.prototype.schema=function(e=!0){let t=this._Table.get_schema(),r=t.columns(),n=t.types(),i={};for(let t=0;t<r.size();t++){const o=r.get(t);"psp_okey"!==o&&(e&&this.overridden_types[o]?i[o]=this.overridden_types[o]:i[o]=P(n.get(t).value))}return t.delete(),r.delete(),n.delete(),i},v.prototype.validate_expressions=function(e,t=!0){const n={expression_schema:{},expression_alias:{},errors:{}};if(!e||0===Object.keys(e).length)return n;e=w(e);let i=r.make_2d_val_vector();for(let t of e){let e=r.make_val_vector();for(let r of t)e.push_back(r);i.push_back(e),n.expression_alias[t[0]]=t[1]}const o=r.validate_expressions(this._Table,i),s=o.get_expression_schema(),a=o.get_expression_errors(),l=s.keys();for(let e=0;e<l.size();e++){const r=l.get(e);let i=s.get(r);t&&this.overridden_types[r]&&(i=this.overridden_types[r]),n.expression_schema[r]=i}const c=a.keys();for(let e=0;e<c.size();e++){const t=c.get(e),r=a.get(t);n.errors[t]=r}return c.delete(),l.delete(),a.delete(),s.delete(),o.delete(),n},v.prototype.is_valid_filter=function(e){if(e[1]===$.FILTER_OPERATORS.isNull||e[1]===$.FILTER_OPERATORS.isNotNull)return!0;let t=e[2];if(null===t)return!1;const n=this.schema();return!n[e[0]]||"date"!==n[e[0]]&&"datetime"!==n[e[0]]?null!=t:r.is_valid_datetime(e[2])},v.prototype.view=function(e={}){l(this._Table.get_id());let t={};for(const r of Object.keys(e))if(o[r]){if(t[o[r]])throw new Error(`Duplicate configuration parameter "${r}"`);j.has(r)||(console.warn(`Deprecated: "${r}" config parameter, please use "${o[r]}" instead`),j.add(r)),t[o[r]]=e[r]}else if("aggregate"===r){j.has("aggregate")||(console.warn('Deprecated: "aggregate" config parameter has been replaced by "aggregates" and "columns"'),j.add("aggregate")),t.aggregates={},t.columns=[];for(const r of e.aggregate)t.aggregates[r.column]=r.op,t.columns.push(r.column)}else{if(!(s.indexOf(r)>-1))throw new Error(`Unrecognized config parameter "${r}"`);t[r]=e[r]}t.group_by=t.group_by||[],t.split_by=t.split_by||[],t.aggregates=t.aggregates||{},t.filter=t.filter||[],t.sort=t.sort||[],t.expressions=t.expressions||{};const r=this.schema();if(void 0!==t.expressions&&(Array.isArray(t.expressions)&&console.warn("Legacy `expressions` format: "+JSON.stringify(t.expressions)),t.expressions=w(t.expressions)),void 0===t.columns&&(t.columns=this.columns(),null!=t.expressions))for(const e of t.expressions)t.columns.push(e[0]);if(t.filter.length>0)for(let e of t.filter){const t=r[e[0]];e[1]===$.FILTER_OPERATORS.isNull||e[1]===$.FILTER_OPERATORS.isNotNull||"date"!==t&&"datetime"!==t||(e[2]=new Date(e[2]))}let n,i=Math.random()+"";n=t.group_by.length>0||t.split_by.length>0?t.split_by&&t.split_by.length>0?2:1:0;let a=new d(this,n,t,new y(t),i);return this.views.push(a),a},v.prototype.query_columns=function(e,t){const r=this.view(e),n=r.to_columns(t);return r.delete(),n},v.prototype.update=function(e,t){let i;(t=t||{}).port_id=t.port_id||0;let o=this.columns(),s=this._Table.get_schema(),a=s.types(),l=!1,c=!1;if(i=n,e instanceof ArrayBuffer?(i=new Uint8Array(e),l=!0):"string"==typeof e?(","===e[0]&&(e="_"+e),c=!0,l=!0,i=e):(n.init(e),n.names=o.concat(n.names.filter((e=>"__INDEX__"===e))),n.types=O(a).slice(0,o.length),T&&T(n.row_count)),!l){if(0===i.row_count)return void console.warn("table.update called with no data - ignoring");-1!=n.names.indexOf("__INDEX__")&&(this.index?n.types.push(n.types[n.names.indexOf(this.index)]):n.types.push(r.t_dtype.DTYPE_INT32))}try{const e=r.t_op.OP_INSERT;u(i,this._Table,this.index,this.limit,e,!0,l,c,t.port_id).delete(),this.initialized=!0}catch(e){console.error(`Update failed: ${e}`)}finally{s.delete()}},v.prototype.remove=function(e,t){if(!this.index)return void console.error("Cannot call `remove()` on a Table without a user-specified index.");let i;(t=t||{}).port_id=t.port_id||0;let o=this.columns(),s=this._Table.get_schema(),a=s.types(),l=!1;(e=e.map((e=>({[this.index]:e}))))instanceof ArrayBuffer?(i=new Uint8Array(e),l=!0):(n.init(e),n.names=[this.index],n.types=[O(a)[o.indexOf(this.index)]],i=n);try{const e=r.t_op.OP_DELETE;u(i,this._Table,this.index,this.limit,e,!1,l,!1,t.port_id).delete(),this.initialized=!0}catch(e){console.error("Remove failed",e)}finally{s.delete()}},v.prototype.columns=function(){let e=this._Table.get_schema(),t=e.columns(),r=[];for(let e=0;e<t.size();e++){let n=t.get(e);"psp_okey"!==n&&r.push(n)}return e.delete(),t.delete(),r},v.prototype.execute=function(e){e(this)};const $={__module__:r,Server:S,worker:function(){return this},initialize_profile_thread:function(){if(void 0===T){let e=0,t=performance.now();setTimeout((function r(){let n=performance.now();console.log(`${(1e3*e/(n-t)).toFixed(2)} msgs/sec`),e=0,t=n,setTimeout(r,5e3)}),5e3),T=function(t){e+=t},console.log("Profiling initialized")}},memory_usage:function(){const e=performance.memory?JSON.parse(JSON.stringify(performance.memory,["totalJSHeapSize","usedJSHeapSize","jsHeapSizeLimit"])):process.memoryUsage();return e.wasmHeap=r.HEAP8.length,e},table:function(e,t){let i;(t=t||{}).index=t.index||null,t.limit=t.limit||null;let o,s=!1,a={},l=!1;if(e instanceof ArrayBuffer||"undefined"!=typeof Buffer&&e instanceof Buffer?(i=new Uint8Array(e),s=!0):"string"==typeof e?(","===e[0]&&(e="_"+e),l=!0,s=!0,i=e):(n.clean(),a=n.init(e),i=n),t.index&&t.limit)throw`Cannot specify both index '${t.index}' and limit '${t.limit}'.`;try{const e=r.t_op.OP_INSERT;return o=u(i,void 0,t.index,t.limit,e,!1,s,l,0),new v(o,t.index,t.limit,a)}catch(e){throw o&&o.delete(),console.error(`Table initialization failed: ${e}`),e}}};for(let e of Object.keys(t))$[e]=t[e];return"undefined"!=typeof self&&self.addEventListener&&new class extends S{constructor(e){super(e),self.addEventListener("message",(e=>this.process(e.data)),!1)}post(e,t){self.postMessage(e,t)}async init(e){let t=e.buffer;const n=(await WebAssembly.instantiate(t)).instance.exports,i=n.size(),o=n.offset();t=new Uint8Array(n.memory.buffer).slice(o,o+i),r=await r({wasmBinary:t,wasmJSMethod:"native-wasm",locateFile:e=>e}),r.init(),super.init(e)}}($),$}(n)})()})();
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>perspective.worker.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*global window, rJS */
/*jslint nomen: true, indent:2*/
// Provides perspective worker
(function (window, rJS) {
"use strict";
rJS(window)
.declareMethod("getTable", function (data) {
return window.Worker.table(data);
});
}(window, rJS));
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>perspective_base_gadget.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Perspective</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment