@synnaxlabs/pluto 0.44.1 → 0.44.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Animated-KCUNFDvN.js → Animated-D5cL3URg.js} +1 -1
- package/dist/{Animated-3QNTHym1.cjs → Animated-DnsZ5vvU.cjs} +1 -1
- package/dist/{Menu-BFD8DPDp.js → Menu-C-MABQ1r.js} +1 -1
- package/dist/{Menu-BPH8apK8.cjs → Menu-vR5-lqo4.cjs} +1 -1
- package/dist/{Toggle-BHiPL61M.cjs → Toggle-Ckdi4fKV.cjs} +1 -1
- package/dist/{Toggle-1E6vrl6G.js → Toggle-Dol9oHzM.js} +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/color.cjs +1 -1
- package/dist/color.js +1 -1
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +1 -1
- package/dist/ether.cjs +1 -1
- package/dist/ether.js +2 -2
- package/dist/{external-BmaCxlPM.js → external-B5RyMtMy.js} +2 -2
- package/dist/{external-B1mnn7_J.js → external-B8qSW3N8.js} +1 -1
- package/dist/{external-CKvxjJs5.cjs → external-BGCkpetp.cjs} +1 -1
- package/dist/{external-DRcsXa_0.cjs → external-BJ91nMtQ.cjs} +1 -1
- package/dist/{external-B16icDUE.js → external-BYJw6DJV.js} +1 -1
- package/dist/{external-DTzGaj9d.js → external-B_NFroo8.js} +2 -2
- package/dist/{external-BzGhOwHW.js → external-CJZTgfAH.js} +2 -2
- package/dist/{external-Bx2weRCW.cjs → external-CS6l_QN4.cjs} +1 -1
- package/dist/{external-k23HUvy8.js → external-CU_XHLqP.js} +141 -141
- package/dist/{external-DWSWz3Rk.js → external-CVNscTLA.js} +2 -2
- package/dist/{external-Bmv3JTk3.cjs → external-CY2bvy20.cjs} +1 -1
- package/dist/{external-lMAel8Te.cjs → external-CkvXTCCL.cjs} +1 -1
- package/dist/{external-CtwEvFYE.cjs → external-ClD4VLgc.cjs} +1 -1
- package/dist/external-CtooTI5M.cjs +1 -0
- package/dist/{external-DIRuVzOZ.cjs → external-DFsKdN71.cjs} +1 -1
- package/dist/{external-DF7sP0pe.cjs → external-DNHOS3w0.cjs} +1 -1
- package/dist/{external-DPN-ziJs.js → external-DOd9BcLC.js} +1 -1
- package/dist/{external-BDFD5v83.cjs → external-DPqPAgoV.cjs} +1 -1
- package/dist/{external-T7fQRFNS.cjs → external-DXY1bIut.cjs} +1 -1
- package/dist/{external-Dr5azzr8.cjs → external-DZqxSCvz.cjs} +1 -1
- package/dist/{external-R1cRWCTB.js → external-DnnHYQqD.js} +1 -1
- package/dist/{external-DIE22vag.js → external-Ylv9Wts9.js} +2 -2
- package/dist/{external-DJ4pzZBh.cjs → external-_eEnQPcq.cjs} +1 -1
- package/dist/{external-BgZRkFq4.js → external-b2X_jilF.js} +2 -2
- package/dist/{external-Bx2Al5fy.js → external-pm79tCDD.js} +1 -1
- package/dist/{external-5PfK-PF3.js → external-xfHaehZH.js} +1 -1
- package/dist/flex.cjs +1 -1
- package/dist/flex.js +1 -1
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.js +4630 -4595
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +1 -1
- package/dist/{provider-BhLG7kqF.js → provider-Bp-CLkh2.js} +1734 -1624
- package/dist/provider-DBSsDoFS.cjs +53 -0
- package/dist/src/channel/LinePlot.d.ts +2 -0
- package/dist/src/channel/LinePlot.d.ts.map +1 -1
- package/dist/src/icon/registry.d.ts +1 -0
- package/dist/src/icon/registry.d.ts.map +1 -1
- package/dist/src/input/Text.d.ts +3 -2
- package/dist/src/input/Text.d.ts.map +1 -1
- package/dist/src/telem/aether/transformers.d.ts +28 -2
- package/dist/src/telem/aether/transformers.d.ts.map +1 -1
- package/dist/src/vis/diagram/Diagram.d.ts +6 -0
- package/dist/src/vis/diagram/Diagram.d.ts.map +1 -1
- package/dist/src/vis/line/aether/line.d.ts +9 -2
- package/dist/src/vis/line/aether/line.d.ts.map +1 -1
- package/dist/{symbols-DzAWrATO.cjs → symbols-B15FeAg9.cjs} +42 -42
- package/dist/{symbols-5jPiWw_d.js → symbols-Lz5vQQDw.js} +5777 -5762
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text.cjs +1 -1
- package/dist/text.js +2 -2
- package/dist/theming.cjs +1 -1
- package/dist/theming.js +2 -2
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +1 -1
- package/dist/triggers.cjs +1 -1
- package/dist/triggers.js +1 -1
- package/package.json +5 -5
- package/dist/external-DMB49R_H.cjs +0 -1
- package/dist/provider-DVZt686Q.cjs +0 -53
package/dist/tabs.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-CS6l_QN4.cjs");exports.Tabs=e.external;
|
package/dist/tabs.js
CHANGED
package/dist/text.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./symbols-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./symbols-B15FeAg9.cjs");const e=require("./external-DPqPAgoV.cjs");exports.Text=e.external;
|
package/dist/text.js
CHANGED
package/dist/theming.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./symbols-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./symbols-B15FeAg9.cjs");const e=require("./external-DZqxSCvz.cjs");exports.Theming=e.external;
|
package/dist/theming.js
CHANGED
package/dist/tree.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-CkvXTCCL.cjs");exports.Tree=e.external;
|
package/dist/tree.js
CHANGED
package/dist/triggers.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./external-ClD4VLgc.cjs");exports.Triggers=e.external;
|
package/dist/triggers.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synnaxlabs/pluto",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@fontsource-variable/inter": "^5.2.6",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"zod": "^4.0.2",
|
|
23
23
|
"@synnaxlabs/alamos": "^0.44.0",
|
|
24
24
|
"@synnaxlabs/freighter": "0.44.0",
|
|
25
|
-
"@synnaxlabs/
|
|
26
|
-
"@synnaxlabs/
|
|
25
|
+
"@synnaxlabs/client": "^0.44.1",
|
|
26
|
+
"@synnaxlabs/x": "^0.44.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@juggle/resize-observer": "^3.4.0",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"typescript": "^5.8.3",
|
|
45
45
|
"vite": "^7.0.4",
|
|
46
46
|
"vitest": "^3.2.4",
|
|
47
|
+
"@synnaxlabs/vite-plugin": "^0.43.0",
|
|
47
48
|
"@synnaxlabs/tsconfig": "^0.43.0",
|
|
48
49
|
"eslint-config-synnaxlabs": "^0.43.0",
|
|
49
|
-
"stylelint-config-synnaxlabs": "^0.43.0"
|
|
50
|
-
"@synnaxlabs/vite-plugin": "^0.43.0"
|
|
50
|
+
"stylelint-config-synnaxlabs": "^0.43.0"
|
|
51
51
|
},
|
|
52
52
|
"files": [
|
|
53
53
|
"dist"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./symbols-DzAWrATO.cjs"),t=require("./Toggle-BHiPL61M.cjs"),o=Object.freeze(Object.defineProperty({__proto__:null,Button:e.Button,Toggle:t.Toggle},Symbol.toStringTag,{value:"Module"}));exports.external=o;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("./css-9yccD6t_.cjs"),d=require("zod"),p=require("./eraser-CLWNvWDn.cjs"),Ke=require("./fontString-BptzSQcY.cjs");class yo{handlers;transform;closer;constructor(e,n){this.transform=e,this.handlers=n??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){let n=e;if(this.transform!=null){const[r,i]=this.transform(e);if(!i)return;n=r}this.handlers.forEach((r,i)=>i(n))}setCloser(e){this.closer=e}async close(){return await this.closer?.()}}class vo{handlers;constructor(e){this.handlers=e??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){this.handlers.forEach((n,r)=>r(e))}}const Kt=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:vo,Observer:yo},Symbol.toStringTag,{value:"Module"})),Nn="pluto-vis-renderer",qt=(t,e)=>{t.set(Nn,e,!1)},Ft=t=>t.get(Nn),ss=t=>t.getOptional(Nn),X=(t,e)=>Ft(t)(e),dn=(t,e)=>async n=>{let r;n.changed.dataType.equals(s.r.JSON)?r=n.changed.parseJSON(t):r=Array.from(n.changed).map(i=>t.parse(i));for(const i of r)await e({...n,changed:i})},bo=t=>async e=>{for(const n of e.changed.toStrings())await t({...e,changed:n})},xo=new Error("request for lock canceled");var So=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function l(h){try{c(r.next(h))}catch(f){a(f)}}function u(h){try{c(r.throw(h))}catch(f){a(f)}}function c(h){h.done?o(h.value):i(h.value).then(l,u)}c((r=r.apply(t,e||[])).next())})};class wo{constructor(e,n=xo){this._value=e,this._cancelError=n,this._queue=[],this._weightedWaiters=[]}acquire(e=1,n=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((r,i)=>{const o={resolve:r,reject:i,weight:e,priority:n},a=is(this._queue,l=>n<=l.priority);a===-1&&e<=this._value?this._dispatchItem(o):this._queue.splice(a+1,0,o)})}runExclusive(e){return So(this,arguments,void 0,function*(n,r=1,i=0){const[o,a]=yield this.acquire(r,i);try{return yield n(o)}finally{a()}})}waitForUnlock(e=1,n=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,n)?Promise.resolve():new Promise(r=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),To(this._weightedWaiters[e-1],{resolve:r,priority:n})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const n=this._value;this._value-=e.weight,e.resolve([n,this._newReleaser(e.weight)])}_newReleaser(e){let n=!1;return()=>{n||(n=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const n=this._weightedWaiters[e-1];n&&(n.forEach(r=>r.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let n=this._value;n>0;n--){const r=this._weightedWaiters[n-1];if(!r)continue;const i=r.findIndex(o=>o.priority<=e);(i===-1?r:r.splice(0,i)).forEach(o=>o.resolve())}}}_couldLockImmediately(e,n){return(this._queue.length===0||this._queue[0].priority<n)&&e<=this._value}}function To(t,e){const n=is(t,r=>e.priority<=r.priority);t.splice(n+1,0,e)}function is(t,e){for(let n=t.length-1;n>=0;n--)if(e(t[n]))return n;return-1}var Eo=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function l(h){try{c(r.next(h))}catch(f){a(f)}}function u(h){try{c(r.throw(h))}catch(f){a(f)}}function c(h){h.done?o(h.value):i(h.value).then(l,u)}c((r=r.apply(t,e||[])).next())})};class os{constructor(e){this._semaphore=new wo(1,e)}acquire(){return Eo(this,arguments,void 0,function*(e=0){const[,n]=yield this._semaphore.acquire(1,e);return n})}runExclusive(e,n=0){return this._semaphore.runExclusive(()=>e(),1,n)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const Co=d.z.object({props:p.Kp.nullable(),state:p.Xp.connectivity.connectionStateZ.nullable()}),Bn={client:null};let pt=class as extends p.Composite{static TYPE="synnax.Provider";static stateZ=Co;schema=as.stateZ;afterUpdate(e){if(e.wasSetPreviously(Un)||nn(e,Bn),this.state.props==null){this.internal.client!=null&&(this.internal.client?.close(),this.internal.client=null),nn(e,this.internal);return}this.prevState.props!=null&&p.m.equal(this.state.props,this.prevState.props)&&this.internal.client!=null||(this.internal.client=new p.Xp(this.state.props),nn(e,this.internal))}};const Un="pluto-client-context",nn=(t,e)=>t.set(Un,e),Ze=t=>t.get(Un)?.client??null,ls={[pt.TYPE]:pt},Po=Object.freeze(Object.defineProperty({__proto__:null,Provider:pt,REGISTRY:ls,ZERO_CONTEXT_VALUE:Bn,use:Ze},Symbol.toStringTag,{value:"Module"})),ko=d.z.object({region:s.Ho.box,clearOverScan:s.K.crudeZ.optional().default(0),visible:d.z.boolean().optional().default(!0)}),Er=["upper2d","lower2d"];class Te extends p.Composite{static TYPE="Table";static stateZ=ko;schema=Te.stateZ;afterUpdate(e){const{internal:n}=this;n.renderCtx=p.Context.use(e),n.handleError=p.useErrorHandler(e),qt(e,()=>{this.state.visible&&this.requestRender("low")}),!(!this.state.visible&&!this.prevState.visible)&&this.requestRender("high")}afterDelete(){this.requestRender("high")}render(){if(this.deleted)return;const e=s.Ho.copy(this.state.region);if(!this.state.visible)return()=>this.internal.renderCtx.erase(e,this.state.clearOverScan);const{renderCtx:n,handleError:r}=this.internal,i=s.C.XY.translate(s.Ho.topLeft(this.state.region)),o=n.scissor(this.state.region,s.K.construct(this.state.clearOverScan),Er);try{for(const a of this.children)a.render({viewportScale:i})}catch(a){r(a,"Failed to render table")}finally{o()}return()=>this.internal.renderCtx.erase(e,this.state.clearOverScan)}requestRender(e){const{renderCtx:n}=this.internal;n.loop.set({key:`${Te.TYPE}-${this.key}`,render:this.render.bind(this),priority:e,canvases:Er})}}const Ro={[Te.TYPE]:Te};class ne extends Kt.Observer{cleanup(){}}class fn extends ne{static TYPE="noop-boolean-sink";set(){}}const Wt={type:fn.TYPE,props:{},variant:"sink",valueType:"boolean"};class pn extends ne{static TYPE="noop-numeric-sink";set(){}}const cs={type:pn.TYPE,props:{},variant:"sink",valueType:"number"};class gn extends ne{static TYPE="noop-boolean-source";value(){return!1}}const $n={type:gn.TYPE,props:{},variant:"source",valueType:"boolean"};class mn extends ne{static TYPE="noop-numeric-source";value(){return 0}}const us={type:mn.TYPE,props:{},variant:"source",valueType:"number"};class yn extends ne{static TYPE="noop-string-source";value(){return""}}const hs={type:yn.TYPE,props:{},variant:"source",valueType:"string"};class vn extends ne{static TYPE="noop-status-source";value(){return{key:"noop",variant:"disabled",message:"unknown",time:s.n.now()}}}const Kn={type:vn.TYPE,props:{},variant:"source",valueType:"status"};class bn extends ne{static TYPE="noop-color-source";value(){return s.ir.ZERO}}const jt={type:bn.TYPE,props:{},variant:"source",valueType:"color"};class xn extends ne{static TYPE="noop-series";value(){return[s.W.ZERO,new s.Vt([])]}}const ds={type:xn.TYPE,props:{},variant:"source",valueType:"series"},Mo={[fn.TYPE]:fn,[pn.TYPE]:pn,[gn.TYPE]:gn,[mn.TYPE]:mn,[vn.TYPE]:vn,[bn.TYPE]:bn,[yn.TYPE]:yn,[xn.TYPE]:xn};class fs{type="noop";create(e){const n=Mo[e.type];return n==null?null:new n}}const Lo=d.z.instanceof(ArrayBuffer),tt=d.z.object({type:d.z.string(),variant:d.z.enum(["source","sink","source-transformer","sink-transformer"]),valueType:d.z.string(),props:d.z.any(),transfer:d.z.array(Lo).optional()}),re=tt.extend({variant:d.z.literal("source")}),Vt=tt.extend({variant:d.z.literal("sink")}),ps=tt.extend({variant:d.z.literal("source-transformer")}),gs=tt.extend({variant:d.z.literal("sink-transformer")}),gt=re.extend({valueType:d.z.literal("series")}),qn=re.extend({valueType:d.z.literal("boolean")}),Gt=Vt.extend({valueType:d.z.literal("boolean")}),Oo=gs.extend({valueType:d.z.literal("boolean")}),Yo=ps.extend({valueType:d.z.literal("boolean")}),ms=re.extend({valueType:d.z.literal("number")}),ys=Vt.extend({valueType:d.z.literal("number")}),Fn=re.extend({valueType:d.z.literal("color")}),Wn=re.extend({valueType:d.z.literal("status")}),jn=re.extend({valueType:d.z.literal("string")});let Xt=class extends Kt.BaseObserver{props_=void 0;uProps_=void 0;constructor(e){super(),this.uProps_=e}get props(){if(this.props_==null){const e=this.schema.safeParse(this.uProps_);if(e.success)this.props_=e.data;else throw new p.P(`[BaseTelem] - expected props to be valid, but found the following errors:
|
|
2
|
-
${e.error.message}`)}return this.props_}cleanup(){}};class B extends Xt{}class Qt extends Xt{}class ue extends B{source_=void 0;get source(){if(this.source_==null)throw new p.P("[UnarySourceTransformer] - expected source to exist, but none was found.");return this.source_}value(){return this.transform(this.source.value())}onChange(e){return this.source.onChange(()=>{this.shouldNotify(this.source.value())&&e()})}setSources(e){this.source_=Object.values(e)[0]}shouldNotify(e){return!0}}class vs extends B{sources={};value(){const e=Object.fromEntries(Object.entries(this.sources).map(([n,r])=>[n,r.value()]));return this.transform(e)}setSources(e){this.sources={...this.sources,...e}}}class bs extends Xt{sinks={};get sink(){const[e]=Object.values(this.sinks);if(e==null)throw new p.P("[UnarySinkTransformer] - expected sink to exist, but none was found.");return e}set(...e){return this.sink.set(...this.transform(...e))}setSinks(e){this.sinks={...this.sinks,...e}}}const Vn=d.z.object({from:d.z.string(),to:d.z.string()}),Gn=d.z.object({connections:d.z.array(Vn),outlet:d.z.string(),segments:d.z.record(d.z.string(),re)});class Xn{type="pipeline";factory;constructor(e){this.factory=e}create(e){switch(e.type){case mt.TYPE:return new mt(e.props,this.factory);case yt.TYPE:return new yt(e.props,this.factory);default:return null}}}class mt extends B{static TYPE="source-pipeline";schema=Gn;sources={};get outlet(){const{outlet:e}=this.props,n=this.sources[e];if(n==null)throw new p.P(`[SourcePipeline] - expected source to exist at outlet '${e}', but none was found.`);return n}constructor(e,n){super(e);const{connections:r,segments:i}=this.props;Object.entries(i).forEach(([o,a])=>{const l=n.create(a);l!=null&&(this.sources[o]=l)}),r.forEach(({from:o,to:a})=>{const l=this.sources[o],u=this.sources[a];l==null||u==null||"setSources"in u&&u.setSources({[o]:l})})}value(){return this.outlet.value()}onChange(e){return this.outlet.onChange(e)}cleanup(){Object.values(this.sources).forEach(e=>e.cleanup?.())}}const xs=(t,e)=>({variant:"source",props:e,type:mt.TYPE,valueType:t}),Qn=d.z.object({connections:d.z.array(Vn),inlet:d.z.string(),segments:d.z.record(d.z.string(),Vt)});class yt extends Qt{static TYPE="sink-pipeline";schema=Qn;sinks={};get inlet(){const{inlet:e}=this.props,n=this.sinks[e];if(n==null)throw new p.P(`[SinkPipeline] - expected source to exist at inlet '${e}', but none was found.`);return n}constructor(e,n){super(e);const{connections:r,segments:i}=this.props;Object.entries(i).forEach(([o,a])=>{const l=n.create(a);l!=null&&(this.sinks[o]=l)}),r.forEach(({from:o,to:a})=>{const l=this.sinks[o],u=this.sinks[a];l==null||u==null||"setSinks"in l&&l.setSinks({[a]:u})})}set(...e){return this.inlet.set(...e)}cleanup(){Object.values(this.sinks).forEach(e=>e.cleanup?.())}}const Ss=(t,e)=>({variant:"sink",props:e,type:yt.TYPE,valueType:t}),Jn=d.z.object({channel:d.z.number().or(d.z.string())});class vt extends B{static TYPE="stream-channel-value";schema=Jn;client;removeStreamHandler=null;leadingBuffer=null;valid=!1;onStatusChange;constructor(e,n,r){super(n),this.client=e,this.onStatusChange=r?.onStatusChange}get testingOnlyLeadingBuffer(){return this.leadingBuffer}get testingOnlyValid(){return this.valid}cleanup(){this.removeStreamHandler?.(),this.valid=!1,this.leadingBuffer?.release(),this.leadingBuffer=null,this.removeStreamHandler=null}value(){return s.F.isZero(this.props.channel)||(this.valid||this.read(),this.leadingBuffer==null||this.leadingBuffer.length===0)?0:this.leadingBuffer.at(-1,!0)}async read(){try{this.valid=!0,this.removeStreamHandler?.();const e=await this.client.retrieveChannel(this.props.channel),n=r=>{const i=r.get(e.key);if(i==null)return;const o=i.series.at(-1);o!=null&&(o.acquire(),this.leadingBuffer?.release(),this.leadingBuffer=o),this.notify()};this.removeStreamHandler=await this.client.stream(n,[e.key]),this.notify()}catch(e){this.valid=!1,this.onStatusChange?.(s._r.fromException(e,"failed to stream channel value"))}}}const ws=async(t,e,n)=>{const r=await t.retrieveChannel(e),i=p.xm.isCalculated(r);if(!n||r.isIndex)return{key:r.key,dataType:r.dataType,virtual:r.virtual,isCalculated:i};if(i){const o=await p.xm.resolveCalculatedIndex(t.retrieveChannel.bind(t),r);if(o==null)throw new p.Ft("Failed to resolve calculated index");return{key:(await t.retrieveChannel(o)).key,dataType:s.r.TIMESTAMP,virtual:!1,isCalculated:i}}if(r.virtual)throw new p.Ft("cannot use virtual channels as a data source");return{key:r.index,dataType:s.r.TIMESTAMP,virtual:!1,isCalculated:i}},Do=d.z.object({timeRange:s.w.z,channel:d.z.number().or(d.z.string()),useIndexOfChannel:d.z.boolean().optional().default(!1)});class bt extends B{static TYPE="series-source";client;schema=Do;data=new s.Vt;valid=!1;channel=null;onStatusChange;constructor(e,n,r){super(n),this.client=e,this.onStatusChange=r?.onStatusChange}cleanup(){this.data.release(),this.valid=!1,this.channel=null}value(){const{channel:e,timeRange:n}=this.props;if(n.isZero||e===0)return[s.W.ZERO,this.data];this.valid||this.read();const{channel:r,data:i}=this;if(r==null)return[s.W.ZERO,this.data];let o=i.bounds;return r.dataType.equals(s.r.TIMESTAMP)&&(o=s.W.min([o,n.numericBounds])),[o,i]}async read(){try{this.valid=!0;const{timeRange:e,channel:n,useIndexOfChannel:r}=this.props;this.channel=await ws(this.client,n,r);const i=await this.client.read(e,this.channel.key);i.acquire(),this.data=i,this.notify()}catch(e){this.valid=!1,this.onStatusChange?.(s._r.fromException(e,"failed to read channel data"))}}}const _o=d.z.object({channel:d.z.number().or(d.z.string()),useIndexOfChannel:d.z.boolean().optional().default(!1),timeSpan:s.a.z,keepFor:s.a.z.optional()});class xt extends B{static TYPE="dynamic-series-source";client;data=new s.Vt([]);now;onStatusChange;channel=null;stopStreaming;valid=!1;schema=_o;constructor(e,n,r,i=()=>s.n.now()){super(n),this.client=e,this.now=i,this.onStatusChange=r?.onStatusChange}value(){const{channel:e,timeSpan:n}=this.props;if(e===0)return[s.W.ZERO,this.data];this.valid||this.read();const{data:r,channel:i}=this,o=this.now();if(i!=null&&i.dataType.isVariable)return[s.W.ZERO,this.data];const a=r.series.filter(u=>u.timeRange.end.after(o.sub(n))).map(u=>u.bounds),l=s.W.max(a);return i!=null&&i.dataType.equals(s.r.TIMESTAMP)&&(l.lower=Math.max(l.lower,l.upper-Number(n.valueOf()))),[l,this.data]}async read(){try{this.valid=!0;const{channel:e,useIndexOfChannel:n,timeSpan:r}=this.props;this.channel=await ws(this.client,e,n);const i=this.now().spanRange(-r);if(!this.channel.virtual||this.channel.isCalculated){const a=await this.client.read(i,this.channel.key);a.acquire(),this.data.push(a)}this.stopStreaming?.();const o=a=>{if(this.channel==null)return;const l=a.get(this.channel.key);l!=null&&(l.acquire(),this.data.push(l),this.notify(),this.gcOutOfRangeData())};this.stopStreaming=await this.client.stream(o,[this.channel.key]),this.notify()}catch(e){this.valid=!1,this.onStatusChange?.(s._r.fromException(e,"failed to stream channel data"))}}gcOutOfRangeData(){const e=this.now().sub(this.props.keepFor??this.props.timeSpan),n=this.data.series.findIndex(r=>r.timeRange.end.before(e));n!==-1&&(this.data.series.splice(n,1).forEach(r=>r.release()),this.gcOutOfRangeData())}cleanup(){this.stopStreaming?.(),this.stopStreaming=void 0,this.data.release(),this.valid=!1}}const zo={[bt.TYPE]:bt,[xt.TYPE]:xt,[vt.TYPE]:vt};class Ts{type="remote";client;constructor(e){this.client=e}create(e,n){const r=zo[e.type];return r==null?null:new r(this.client,e.props,n)}}const Es=t=>({type:bt.TYPE,props:t,variant:"source",valueType:"series"}),Cs=t=>({type:xt.TYPE,props:t,variant:"source",valueType:"series"}),Ps=t=>({type:vt.TYPE,props:t,variant:"source",valueType:"number"});class ks{type="static";create(e){switch(e.type){case Sn.TYPE:return new Sn(e.props);case St.TYPE:return new St(e.props);case wt.TYPE:return new wt(e.props);case Tt.TYPE:return new Tt(e.props);case Et.TYPE:return new Et(e.props);default:return null}}}const er=d.z.object({data:d.z.array(s.Yt),offsets:d.z.array(d.z.number()).optional().default([])});class Sn extends B{data;schema=er;static TYPE="static-series";constructor(e){super(e),this.data=this.props.data.map((n,r)=>new s.I({data:n,dataType:s.r.FLOAT32,timeRange:s.w.ZERO,sampleOffset:this.props.offsets[r]??0}))}value(){return[s.W.max(this.data.map(n=>n.bounds)),this.data]}}const Rs=er.extend({rate:s.E.z,yOffset:d.z.number().optional().default(0),scroll:d.z.number().optional().default(0),startPosition:d.z.number().optional().default(0),scrollBounds:d.z.boolean().optional().default(!1)});class St extends B{static TYPE="iterative-series";schema=Rs;position;interval;data;constructor(e){super(e),this.position=this.props.startPosition,this.start(this.props.rate),this.data=this.props.data.map((n,r)=>new s.I({data:n,dataType:s.r.FLOAT32,timeRange:s.w.ZERO,sampleOffset:this.props.offsets[r]??0}))}value(){const e=this.data.map(r=>r.slice(0,this.position));if(this.props.scrollBounds){const r=e[0].data[this.position-this.props.scroll<0?0:this.position-this.props.scroll],i=e[0].data[this.position-1];return[{lower:Number(r),upper:Number(i)},new s.Vt(e)]}return[s.W.max(e.map(r=>r.bounds)),new s.Vt(e)]}start(e){this.interval!=null&&clearInterval(this.interval),this.interval=setInterval(()=>{this.notify?.(),this.position++},e.period.milliseconds)}cleanup(){clearInterval(this.interval),this.interval=void 0}}const Ms=d.z.number();class wt extends B{static TYPE="static-numeric";schema=Ms;value(){return this.props}}const Ls=d.z.string();class Tt extends B{static TYPE="static-string";schema=Ls;value(){return this.props}}const Os=s.ir.crudeZ;class Et extends B{static TYPE="static-color";schema=Os;value(){return s.ir.construct(this.props)}}const Ao=t=>({type:Sn.TYPE,props:t,variant:"source",valueType:"series"}),Zo=t=>({type:St.TYPE,props:t,variant:"source",valueType:"series"}),Ho=t=>({type:wt.TYPE,props:t,variant:"source",valueType:"number"}),Io=t=>({type:Tt.TYPE,props:t,variant:"source",valueType:"string"}),No=t=>({type:Et.TYPE,props:t,variant:"source",valueType:"color"});class Ys{type="transformer";create(e){switch(e.type){case Ee.TYPE:return new Ee(e.props);case Ce.TYPE:return new Ce(e.props);case Pe.TYPE:return new Pe(e.props);case ke.TYPE:return new ke(e.props);case Re.TYPE:return new Re(e.props);case Ct.TYPE:return new Ct(e.props);case Me.TYPE:return new Me(e.props);case Le.TYPE:return new Le(e.props)}return null}}const Bo=d.z.object({truthy:d.z.number().optional().default(1),falsy:d.z.number().optional().default(0)}),Ds=t=>({props:t,type:Ee.TYPE,variant:"sink",valueType:"boolean"});class Ee extends bs{static TYPE="boolean-numeric-converter-sink";static propsZ=Bo;schema=Ee.propsZ;transform(...e){return e.map(n=>n?this.props.truthy:this.props.falsy)}}const tr=d.z.object({trueBound:s.W.bounds}),_s=t=>({props:t,type:Ce.TYPE,variant:"source",valueType:"boolean"});class Ce extends ue{static TYPE="boolean-source";static propsZ=tr;schema=Ce.propsZ;curr=null;shouldNotify(e){const n=s.W.contains(this.props.trueBound,e)!==this.curr;return this.curr=s.W.contains(this.props.trueBound,e),n}transform(e){return this.curr=s.W.contains(this.props.trueBound,e),this.curr}}const zs=d.z.object({});class Pe extends vs{static TYPE="mean";static propsZ=zs;schema=Pe.propsZ;transform(e){return Object.values(e).reduce((n,r)=>n+r,0)/Object.keys(e).length}}const Uo=t=>({props:t,type:Pe.TYPE,variant:"source",valueType:"boolean"}),As=d.z.object({trueVariant:s._r.variantZ.optional().default("success")});class ke extends ue{static TYPE="boolean-status";static propsZ=As;schema=ke.propsZ;transform(e){return e.variant===this.props.trueVariant}}const $o=t=>({props:t,type:ke.TYPE,variant:"source",valueType:"boolean"}),nr=d.z.object({precision:d.z.number().optional().default(2),prefix:d.z.string().optional().default(""),suffix:d.z.string().optional().default(""),notation:s.mr.notationZ.optional().default("standard")});class Re extends ue{static TYPE="stringify-number";static propsZ=nr;schema=Re.propsZ;transform(e){const{precision:n,prefix:r,suffix:i,notation:o}=this.props;return`${r}${s.mr.stringifyNumber(e,n,o)}${i}`}}const Zs=t=>({props:t,type:Re.TYPE,variant:"source",valueType:"string"}),rr=d.z.object({windowSize:d.z.number().optional().default(5)});class Ct extends ue{static TYPE="rolling-average";static propsZ=zs;schema=rr;values=[];transform(e){return this.props.windowSize<2?e:this.values.reduce((n,r)=>n+r,0)/this.values.length}shouldNotify(e){return this.props.windowSize<2?!0:(this.values.length>this.props.windowSize&&(this.values=[]),this.values.push(e),this.values.length===this.props.windowSize)}}const Hs=t=>({props:t,type:Ct.TYPE,variant:"source",valueType:"number"}),Is=d.z.object({gradient:s.ir.gradientZ});class Me extends ue{static TYPE="color-gradient";static propsZ=Is;schema=Me.propsZ;transform(e){return s.ir.fromGradient(this.props.gradient,e)}}const Ns=t=>({props:t,type:Me.TYPE,variant:"source",valueType:"color"}),Bs=d.z.object({scale:s.C.transform});class Le extends ue{static TYPE="scale-number";static propsZ=Bs;schema=Le.propsZ;transform(e){const{offset:n,scale:r}=this.props.scale;return e*r+n}}const Us=t=>({props:t,type:Le.TYPE,variant:"source",valueType:"number"});class sr{factories;type="compound";constructor(e){this.factories=e}add(e){this.factories=[...this.factories.filter(n=>n.type!==e.type),e]}create(e,n){for(const r of this.factories){const i=r.create(e,n);if(i!=null)return i}return null}}const $s=t=>{const e=[new Ys,new ks,new fs],n=new sr(e);return t!=null&&n.add(new Ts(t)),n.add(new Xn(n)),n};let Ks=class qs{factory;key;parent;constructor(e,n){this.factory=e,this.key=s.$t.create(),this.parent=n}child(e,n){const r=new sr([...this.factory.factories,...p.t.toArray(e)]);return r.add(new Xn(r)),new qs(r,n)}create(e,n){const r=this.factory.create(e,n);if(r==null)throw new p.lt(`Telemetry service could not find a source for type ${e.type}`);return r}};const nt="pluto-telem-context",Jt=t=>t.get(nt),Fs=(t,e)=>t.set(nt,e),Ws=(t,e,n)=>{const r=Jt(t);if(r!=null&&n!=null&&r.key===n?.parent?.key)return n;const i=r.child(e,r);return t.set(nt,i),i};class js{spec;wrapped;prevProv;constructor(e,n,r){this.wrapped=e,this.spec=r,this.prevProv=n}shouldUpdate(e,n){return this.prevProv.key!==e.key||!p.m.equal(this.spec,n)}}class Cr extends js{value(){return this.wrapped.value()}cleanup(){this.wrapped.cleanup?.()}onChange(e){return this.wrapped.onChange(e)}}class Pr extends js{set(...e){this.wrapped.set(...e)}cleanup(){this.wrapped.cleanup?.()}}const K=(t,e,n,r)=>{const i=Jt(t);if(n instanceof Cr){if(!n.shouldUpdate(i,e))return n;n.cleanup?.()}return new Cr(i.create(e,r),i,e)},rt=(t,e,n,r)=>{const i=Jt(t);if(n instanceof Pr){if(!n.shouldUpdate(i,e))return n;n.cleanup?.()}return new Pr(i.create(e,r),i,e)},Vs=(t,e)=>t.dataType.isVariable||t.dataType.equals(s.r.UINT8)?t:(e==null&&t.dataType.equals(s.r.TIMESTAMP)&&(e=BigInt(t.data[0])),t.convert(s.r.FLOAT32,e)),Ko=t=>t.isVariable||t.equals(s.r.UINT8)?t:s.r.FLOAT32,Gs=()=>({purgedSeries:0,purgedBytes:s.h.bytes(0)}),Xs={instrumentation:p.g.NOOP,staleEntryThreshold:s.a.seconds(20)};class qo{data=[];props;constructor(e){this.props={...Xs,...e}}write(e){e.length!==0&&(e.series.forEach(n=>this.writeOne(Vs(n))),this.checkIntegrity(e))}dirtyRead(e){const n=this.data.filter(({data:a})=>a.timeRange.overlapsWith(e)).map(({data:a})=>a);if(n.length===0)return{series:new s.Vt([]),gaps:[e]};const r=n.map((a,l)=>l===0?s.w.ZERO:new s.w(n[l-1].timeRange.end,a.timeRange.start)).filter(a=>!a.isZero&&a.isValid),i=new s.w(e.start,n[0].timeRange.start),o=new s.w(n[n.length-1].timeRange.end,e.end);return i.isValid&&!i.isZero&&r.unshift(i),o.isValid&&!o.isZero&&r.push(o),{series:new s.Vt(n),gaps:r}}gc(){const{staleEntryThreshold:e}=this.props,n=Gs(),r=this.data.filter(i=>{const o=i.data.refCount>0||s.n.since(i.addedAt).lessThan(e);return o||(n.purgedBytes=n.purgedBytes.add(i.data.byteCapacity)),o});return n.purgedSeries=this.data.length-r.length,this.data=r,n}close(){this.data=[]}writeOne(e){const{instrumentation:{L:n}}=this.props;if(e.length===0)return;const r=s.W.buildInsertionPlan(this.data.map(u=>u.data.alignmentBounds),e.alignmentBounds);if(r===null)return n.debug("Found no viable insertion plan",{inserting:e.digest,cacheContents:this.data.map(u=>u.data.digest)});const{removeBefore:i,removeAfter:o,insertInto:a,deleteInBetween:l}=r;e=e.slice(i,e.data.length-o),e.length!==0&&this.data.splice(a,l,{data:e,addedAt:s.n.now()})}checkIntegrity(e){const{instrumentation:{L:n}}=this.props,r=this.data.map(o=>o.data.alignmentBounds);if(r.some((o,a)=>r.some((l,u)=>a===u?!1:s.W.overlapsWith(o,l))))throw n.debug("Cache is in an invalid state - bounds overlap!",()=>({write:e.series.map(o=>o.digest),cacheContents:this.data.map(o=>o.data.digest)})),new Error("Invalid state")}}const Fo=100,Wo=1e6,jo=1e4,Vo=100,Go=40;class Xo{props;counter=0;curr;avgRate=0;timeOfLastWrite;totalWrites=0;now=()=>s.n.now();constructor(e){this.props=e,this.curr=null,e.now!=null&&(this.now=e.now),this.timeOfLastWrite=this.now()}get length(){return this.curr?.length??0}get leadingBuffer(){return this.curr}write(e){const n=e.series.flatMap(r=>this._write(r));return{flushed:new s.Vt(n.flatMap(r=>r.flushed.series)),allocated:new s.Vt(n.flatMap(r=>r.allocated.series))}}allocate(e,n,r){this.counter++;const i=this.props.dataType.isVariable,o=this.props.dataType.equals(s.r.TIMESTAMP);return s.I.alloc({capacity:i?e*Go:e,dataType:Ko(this.props.dataType),timeRange:r.range(s.n.MAX),sampleOffset:o?r.valueOf():0,glBufferUsage:"dynamic",alignment:n,key:`dynamic-${this.counter}`})}_write(e){const n=this.nextBufferSize(),r={flushed:new s.Vt([]),allocated:new s.Vt([])};if(this.curr==null)this.curr=this.allocate(n,e.alignment,this.now()),r.allocated.push(this.curr);else if(Math.abs(Number(this.curr.alignment+BigInt(this.curr.length)-e.alignment))>1){const u=this.now();this.curr.timeRange.end=u,r.flushed.push(this.curr),this.curr=this.allocate(n,e.alignment,u),r.allocated.push(this.curr)}const i=Vs(e,this.curr.sampleOffset),o=this.curr.write(i);if(o===e.length)return this.updateAvgRate(e),r;const a=this.now();this.curr.timeRange.end=a,r.flushed.push(this.curr),this.curr=this.allocate(n,e.alignment+BigInt(o),a),r.allocated.push(this.curr);const l=this._write(e.slice(o));return r.flushed.push(l.flushed),r.allocated.push(l.allocated),r}updateAvgRate(e){if(typeof this.props.dynamicBufferSize=="number")return;const n=e.length/this.now().span(this.timeOfLastWrite).seconds;this.totalWrites>0&&isFinite(n)&&n>0&&(this.avgRate=(this.avgRate*(this.totalWrites-1)+n)/this.totalWrites),this.totalWrites++,this.timeOfLastWrite=this.now()}nextBufferSize(){const{dynamicBufferSize:e}=this.props;if(typeof e=="number")return e;if(this.totalWrites<Vo)return jo;const n=s.nr.roundToNearestMagnitude(this.avgRate*e.seconds);return Math.round(Math.max(Math.min(n,Wo),Fo))}close(){this.curr=null}}class Qo{channel;closed=!1;ins;static;dynamic;constructor(e){this.channel=e.channel,this.ins=e.instrumentation??p.g.NOOP,this.static=new qo(e),this.dynamic=new Xo({dynamicBufferSize:e.dynamicBufferSize,dataType:this.channel.dataType})}writeDynamic(e){if(this.closed)return this.ins.L.warn(`Ignoring attempted dynamic write to a closed cache for channel ${this.channel.name}`),new s.Vt([]);const{flushed:n,allocated:r}=this.dynamic.write(e);return n.length>0&&this.static.write(n),r}get leadingBuffer(){return this.dynamic.leadingBuffer}writeStatic(e){if(this.closed)return this.ins.L.warn(`Ignoring attempted static write to a closed cache for channel ${this.channel.name}`);this.static.write(e)}read(e){return this.closed?(this.ins.L.warn(`Ignoring attempted dirty read from a closed cache for channel ${this.channel.name}`),{series:new s.Vt([]),gaps:[e]}):this.static.dirtyRead(e)}gc(){return this.closed?(this.ins.L.warn(`Ignoring attempted garbage collection on a closed cache for channel ${this.channel.name}`),{purgedSeries:0,purgedBytes:s.h.bytes(0)}):this.static.gc()}close(){this.closed=!0,this.dynamic.close(),this.static.close()}}const Jo=p.O$1.seconds(60);class ea{props;cache=new Map;gcInterval;constructor(e){this.props={dynamicBufferSize:Jo,gcInterval:p.O$1.seconds(30),...Xs,...e},this.gcInterval=setInterval(()=>this.gc(),this.props.gcInterval.milliseconds)}async populateMissing(e){const{instrumentation:n,channelRetriever:r,dynamicBufferSize:i}=this.props,o=[];for(const l of e)this.cache.has(l)||o.push(l);if(o.length===0)return;(await r.retrieve(o)).forEach(l=>{if(this.cache.has(l.key))return;const u=new Qo({channel:l,dynamicBufferSize:i,instrumentation:n.child(`cache-${l.name}-${l.key}`)});this.cache.set(l.key,u)})}get(e){const n=this.cache.get(e);if(n!=null)return n;throw new p.lt(`cache entry for ${e} not found`)}gc(){const{instrumentation:{L:e}}=this.props;e.info("starting garbage collection");const n=Gs();this.cache.forEach(r=>{const i=r.gc();n.purgedSeries+=i.purgedSeries,n.purgedBytes=n.purgedBytes.add(i.purgedBytes)}),e.info("garbage collection complete",{purgedSeries:n.purgedSeries,purgedBytes:n.purgedBytes.toString()},!0)}close(){clearInterval(this.gcInterval),this.cache.forEach(e=>e.close()),this.cache.clear()}}class ta{args;debouncedRead;mu=s.wr.newMutex({requests:new Set,closed:!1});constructor(e){this.args={...e,instrumentation:e.instrumentation??p.g.NOOP,batchDebounce:e.batchDebounce??s.a.milliseconds(50),overlapThreshold:e.overlapThreshold??s.a.milliseconds(5)};const n=this.args.batchDebounce.milliseconds;this.debouncedRead=p.o(()=>void this.batchRead(),n)}async read(e,n){const{cache:r}=this.args;await r.populateMissing([n]);const i=r.get(n),{series:o,gaps:a}=i.read(e);if(a.length===0)return o;const{mu:l}=this;return await new Promise((u,c)=>{l.runExclusive(async()=>{l.closed||l.requests.add({channel:n,gaps:a,resolve:u,reject:c})}),this.debouncedRead()}),i.read(e).series}async batchRead(){const{readRemote:e,cache:n,overlapThreshold:r}=this.args,{mu:i}=this;await i.runExclusive(async()=>{const o=a=>i.requests.forEach(({resolve:l,reject:u})=>a==null?l():u(a));try{if(i.closed)return o();const a=[];i.requests.forEach(({channel:l,gaps:u})=>u.forEach(c=>{const h=a.find(f=>f.gap.equals(c,r));h==null?a.push({gap:c,channels:new Set([l])}):(h.channels.add(l),h.gap=s.w.max(h.gap,c))})),await Promise.all(a.map(async({gap:l,channels:u})=>{const c=await e(l,Array.from(u));u.forEach(h=>n.get(h).writeStatic(c.get(h)))})),o()}catch(a){o(a)}finally{i.requests.clear()}})}async close(){await this.mu.runExclusive(async()=>{this.mu.closed=!0})}}let na=class{props;mu=new os;listeners=new Map;streamerRunLoop=null;streamer=null;closed=!1;constructor(e){this.props={instrumentation:p.g.NOOP,...e,streamUpdateDelay:new s.a(e.streamUpdateDelay??s.a.seconds(5))}}async stream(e,n){const{cache:r,instrumentation:i}=this.props;return this.closed?()=>{}:(await r.populateMissing(n),await this.mu.runExclusive(async()=>{i.L.debug("adding stream handler",{keys:n}),this.listeners.set(e,{valid:!0,keys:new Set(n)});const o=new Map(n.map(a=>{const l=r.get(a);return[a,new s.Vt(p.t.toArray(l.leadingBuffer))]}));return e(o),await this.updateStreamer(),()=>this.removeStreamHandler(e)}))}removeStreamHandler(e){const{instrumentation:n}=this.props;this.mu.runExclusive(()=>{const r=this.listeners.get(e);r!=null&&(r.valid=!1)}),setTimeout(()=>{this.mu.runExclusive(async()=>{if(n.L.debug("removing stream handler"),this.listeners.delete(e))return await this.updateStreamer();n.L.warn("attempted to remove non-existent stream handler")})},this.props.streamUpdateDelay.milliseconds)}async updateStreamer(){if(this.closed)return;const{instrumentation:e}=this.props;try{const n=new Set;if(this.listeners.forEach(o=>o.keys.forEach(a=>n.add(a))),n.size===0){e.L.info("no keys to stream, closing streamer"),this.streamer?.close(),this.streamerRunLoop!=null&&await this.streamerRunLoop,this.streamer=null,e.L.info("streamer closed successfully");return}const r=Array.from(n);if(s.O.primitiveArrays(r,this.streamer?.keys??[])===s.O.EQUAL){e.L.debug("streamer keys unchanged",{keys:r});return}this.streamer==null&&(e.L.info("creating new streamer",{keys:r}),this.streamer=await this.props.openStreamer(r),this.streamerRunLoop=this.runStreamer(this.streamer)),e.L.debug("updating streamer",{prev:this.streamer.keys,next:r}),await this.streamer.update(r)}catch(n){throw e.L.error("failed to update streamer",{error:n}),n}}async runStreamer(e){const{cache:n,instrumentation:r}=this.props;try{for await(const i of e){const o=new Map;for(const a of i.keys){const l=i.get(a),c=n.get(a).writeDynamic(l);o.set(a,c)}o.size!==0&&this.listeners.forEach(({valid:a},l)=>a&&l(o))}}catch(i){throw r.L.error("streamer run loop failed",{error:i},!0),i}}async close(){const{instrumentation:e}=this.props;try{this.streamer?.close(),this.streamerRunLoop!=null&&await this.streamerRunLoop}catch(n){e.L.error("failed to close streamer",{error:n})}this.closed=!0}};class ra{async retrieveChannel(){throw new p.Ft("NoopClient does not support retrieving channels")}async read(){return new s.Vt([])}async stream(){return async()=>{}}async close(){}}class sa{ins;cache;reader;streamer;channelRetriever;constructor({instrumentation:e,core:n}){this.ins=e,this.channelRetriever=n.channels.createDebouncedBatchRetriever(10),this.cache=new ea({channelRetriever:this.channelRetriever,instrumentation:this.ins.child("cache")}),this.reader=new ta({cache:this.cache,readRemote:n.read.bind(n),instrumentation:this.ins.child("reader")}),this.streamer=new na({cache:this.cache,openStreamer:async r=>p.Zm.HardenedStreamer.open(n.openStreamer.bind(n),r),instrumentation:this.ins.child("streamer")})}async retrieveChannel(e){const n=await this.channelRetriever.retrieve([e]);if(n.length===0)throw new p.ke(`channel ${e} not found`);return n[0]}async read(e,n){return await this.reader.read(e,n)}async stream(e,n){return await this.streamer.stream(e,n)}async close(){this.ins.L.info("closing client"),await this.streamer.close(),await this.reader.close(),this.cache.close()}}const ir=d.z.object({});class Oe extends p.Composite{static TYPE="telem.Provider";static stateZ=ir;schema=Oe.stateZ;prevCore=null;client=null;afterUpdate(e){const{internal:n}=this,r=Ze(e),i=p.useErrorHandler(e);if(n.instrumentation=p.useInstrumentation(e,"telem").child("provider"),!(r!==this.prevCore||!e.wasSetPreviously(nt)))return;this.prevCore=r,this.client!=null&&i(async()=>{if(this.client==null)throw new Error("no client to close");await this.client.close()},"failed to close client"),this.client=r==null?new ra:new sa({core:r,instrumentation:n.instrumentation});const a=$s(this.client),l=new Ks(a);Fs(e,l)}}const Qs={[Oe.TYPE]:Oe},ia=Object.freeze(Object.defineProperty({__proto__:null,AbstractSink:Qt,AbstractSource:B,Base:Xt,BaseProvider:Oe,BooleanStatus:ke,CONTEXT_KEY:nt,ChannelData:bt,ColorGradient:Me,CompoundTelemFactory:sr,Context:Ks,FixedColorSource:Et,FixedNumber:wt,FixedString:Tt,IterativeSeries:St,Mean:Pe,MultiSourceTransformer:vs,NoopFactory:fs,PipelineFactory:Xn,REGISTRY:Qs,RemoteFactory:Ts,RollingAverage:Ct,ScaleNumber:Le,SetPoint:Ee,SinkPipeline:yt,SourcePipeline:mt,StaticFactory:ks,StreamChannelData:xt,StreamChannelValue:vt,StringifyNumber:Re,TransformerFactory:Ys,UnarySinkTransformer:bs,UnarySourceTransformer:ue,WithinBounds:Ce,booleanSinkSpecZ:Gt,booleanSinkTransformerSpecZ:Oo,booleanSourceSpecZ:qn,booleanSourceTransformerSpecZ:Yo,booleanStatus:$o,booleanStatusProps:As,channelData:Es,colorGradient:Ns,colorGradientProps:Is,colorSourceSpecZ:Fn,connectionZ:Vn,createFactory:$s,fixedArray:Ao,fixedColor:No,fixedColorSourcePropsZ:Os,fixedNumber:Ho,fixedNumberPropsZ:Ms,fixedSeriesPropsZ:er,fixedString:Io,fixedStringPropsZ:Ls,iterativeArray:Zo,iterativeSeriesPropsZ:Rs,mean:Uo,noopBooleanSinkSpec:Wt,noopBooleanSourceSpec:$n,noopColorSourceSpec:jt,noopNumericSinkSpec:cs,noopNumericSourceSpec:us,noopSeriesSourceSpec:ds,noopStatusSourceSpec:Kn,noopStringSourceSpec:hs,numberSinkSpecZ:ys,numberSourceSpecZ:ms,providerStateZ:ir,rollingAverage:Hs,rollingAverageProps:rr,scaleNumber:Us,scaleNumberProps:Bs,seriesSourceSpecZ:gt,setContext:Fs,setpoint:Ds,sinkPipeline:Ss,sinkPipelinePropsZ:Qn,sinkSpecZ:Vt,sinkTransformerSpecZ:gs,sourcePipeline:xs,sourcePipelinePropsZ:Gn,sourceSpecZ:re,sourceTransformerSpecZ:ps,specZ:tt,statusSourceSpecZ:Wn,streamChannelData:Cs,streamChannelValue:Ps,streamChannelValuePropsZ:Jn,stringSourceSpecZ:jn,stringifyNumber:Zs,stringifyNumberProps:nr,useChildContext:Ws,useContext:Jt,useSink:rt,useSource:K,withinBounds:_s,withinBoundsProps:tr},Symbol.toStringTag,{value:"Module"})),Js=d.z.object({authority:s.ar.authorityZ.optional(),valid:d.z.boolean().optional()}).default({authority:void 0,valid:!1}),ei=d.z.object({triggered:d.z.boolean(),status:s._r.statusZ(Js),sink:Gt.optional().default(Wt),source:Wn.optional().default(Kn)});class wn extends p.Leaf{static TYPE="Chip";schema=ei;afterUpdate(e){const{internal:n}=this,{sink:r,source:i}=this.state;n.source=K(e,i,n.source),n.sink=rt(e,r,n.sink),this.state.triggered&&!this.prevState.triggered&&n.sink.set(this.state.status.details?.authority!==s.ar.ABSOLUTE_AUTHORITY),this.updateEnabledState(),n.stopListening?.(),n.stopListening=n.source.onChange(()=>this.updateEnabledState())}updateEnabledState(){const e=this.internal.source.value();p.m.equal(e,this.state.status)||this.setState(n=>({...n,status:e,triggered:!1}))}afterDelete(){this.internal.stopListening(),this.internal.source.cleanup?.(),this.internal.sink.cleanup?.()}render(){}}const ti=d.z.object({}),kr="control-state-provider",ni=p.Lm.stateZ.extend({subjectColor:s.ir.colorZ});class qe extends p.Composite{static TYPE="StateProvider";schema=ti;colors=new Map;tracker;disconnectTrackerChange;obs=new Kt.Observer;static use(e){return e.get(kr)}afterUpdate(e){const{internal:n}=this;n.instrumentation=p.useInstrumentation(e,"control-state");const r=p.use(e);n.palette=r.colors.visualization.palettes.default,n.defaultColor=r.colors.gray.l8;const i=Ze(e);if(n.client!=null&&i===n.client)return;n.client=i,e.set(kr,this),p.useErrorHandler(e)(async()=>{await this.maybeCloseTracker(),n.client!=null&&(this.internal.instrumentation.L.debug("starting state tracker"),await this.openTracker(n.client))},"failed to open control state tracker")}async maybeCloseTracker(){this.tracker!=null&&(this.internal.instrumentation.L.debug("stopping state tracker"),this.disconnectTrackerChange?.(),await this.tracker.close(),this.tracker=void 0)}afterDelete(e){p.useErrorHandler(e)(async()=>{await this.maybeCloseTracker()},"failed to close control state tracker")}onChange(e){return this.obs.onChange(e)}get(e){return Array.isArray(e)?s.c.unique(e).map(n=>this.getOne(n)).filter(n=>n!=null):this.getOne(e)}getOne(e){if(this.tracker==null)return;const n=this.tracker.states.get(e);if(n!=null)return{...n,subjectColor:this.colors.get(n.subject.key)??this.internal.defaultColor}}async openTracker(e){const{internal:n}=this,{instrumentation:r}=n;try{this.tracker=await e.control.openStateTracker()}catch{r.L.error("failed to open state tracker");return}this.disconnectTrackerChange?.(),this.disconnectTrackerChange=this.tracker.onChange(i=>{if(r.L.debug("transfer",{transfers:i.map(o=>p.Lm.transferString(o))}),this.tracker==null)throw new p.lt("tracker is null inside it's own onChange callback!");this.updateColors(this.tracker),this.obs.notify(i)})}updateColors(e){const n=e.subjects(),r=n.map(a=>a.key),i=Array.from(this.colors.values());this.colors.forEach((a,l)=>!r.includes(l)&&this.colors.delete(l));const{palette:o}=this.internal;n.forEach(a=>{if(this.colors.has(a.key))return;const l=o.find(u=>!i.includes(u))??o[0];this.colors.set(a.key,l),i.push(l)})}}const ri=["acquired","released","overridden","failed"],si=d.z.enum(ri),ii=d.z.object({name:d.z.string(),authority:d.z.number().default(0),acquireTrigger:d.z.number(),status:si.optional(),needsControlOf:p.xm.keyZ.array().optional().default([])});class Tn extends p.Composite{static TYPE="Controller";schema=ii;registry=new Map;writer;afterUpdate(e){const{internal:n}=this;n.instrumentation=p.useInstrumentation(e),n.addStatus=p.useAdder(e),n.runAsync=p.useErrorHandler(e),(n.prevTrigger==null||Math.abs(this.state.acquireTrigger-n.prevTrigger)>1)&&(n.prevTrigger=this.state.acquireTrigger);const r=Ze(e),i=qe.use(e);n.stateProv=i,n.telemCtx=Ws(e,this,n.telemCtx),n.client=r,n.runAsync(async()=>{n.client==null&&await this.release(),this.state.acquireTrigger>n.prevTrigger?await this.acquire():this.state.acquireTrigger<n.prevTrigger&&await this.release()},"failed to acquire control")}afterDelete(){const{internal:e}=this;e.runAsync(async()=>await this.release(),"failed to release control")}async updateNeedsControlOf(){const{client:e}=this.internal;if(e==null)return;const n=new Set([]);for(const i of this.registry.keys())(await i.needsControlOf(e)).forEach(a=>a!==0&&n.add(a));const r=Array.from(n);s.O.unorderedPrimitiveArrays(this.state.needsControlOf,r)!==s.O.EQUAL&&this.setState(i=>({...i,needsControlOf:r}))}async acquire(){this.internal.prevTrigger=this.state.acquireTrigger;const{client:e,addStatus:n}=this.internal;if(e==null)return n({message:`Cannot acquire control on ${this.state.name} because no cluster has been connected.`,variant:"warning"});try{await this.updateNeedsControlOf();const r=this.state.needsControlOf;if(r.length===0)return n({message:`Cannot acquire control on ${this.state.name} because there are no channels to control.`,variant:"warning"});const i=p.S.now().sub(s.a.milliseconds(1));this.writer=await e.openWriter({start:i,channels:r,controlSubject:{key:this.key,name:this.state.name},authorities:this.state.authority,enableAutoCommit:!0}),this.setState(o=>({...o,status:"acquired"}))}catch(r){if(this.setState(i=>({...i,status:"failed"})),!(r instanceof Error))throw r;n({variant:"error",message:`${this.state.name} failed to acquire control`,description:r.message})}}async release(){this.internal.prevTrigger=this.state.acquireTrigger;try{await this.writer?.close()}catch(e){this.internal.addStatus({message:`${this.state.name} failed to release control: ${e.message}`,variant:"error"})}finally{this.setState(e=>({...e,status:"released"})),this.writer=void 0}}async set(e){this.writer==null&&await this.acquire(),await this.writer?.write(e)}async setAuthority(e,n){this.writer==null&&await this.acquire(),await this.writer?.setAuthority(Object.fromEntries(e.map(r=>[r,n])))}async releaseAuthority(e){this.writer==null&&await this.acquire(),await this.writer?.setAuthority(Object.fromEntries(e.map(n=>[n,this.state.authority])))}deleteTelem(e){this.registry.delete(e),this.updateNeedsControlOf()}create(e){const{internal:n}=this,i=(()=>{switch(e.type){case Pt.TYPE:{const o=new Pt(this,n.runAsync,e.props);return this.registry.set(o,null),o}case Rt.TYPE:{const o=new Rt(this,this.internal.stateProv,e.props);return this.registry.set(o,null),o}case kt.TYPE:return new kt(this,n.runAsync,e.props);default:return null}})();return i!=null&&this.updateNeedsControlOf(),i}}const oi=d.z.object({channel:d.z.number()});class Pt extends Qt{static TYPE="controlled-numeric-telem-sink";controller;runAsync;schema=oi;constructor(e,n,r){super(r),this.controller=e,this.runAsync=n}invalidate(){}cleanup(){this.controller.deleteTelem(this)}async needsControlOf(e){if(this.props.channel===0)return[];const n=await e.channels.retrieve(this.props.channel),r=[n.key];return n.index!==0&&r.push(n.index),r}set(...e){this.runAsync(async()=>{const{client:n}=this.controller.internal;if(n==null)throw new p.wm("No cluster connected");if(this.props.channel===0)throw new p.P("No command channel specified for actuator");const r=await n.channels.retrieve(this.props.channel),i={[r.key]:e};if(r.index!==0){const o=await n.channels.retrieve(r.index),a=p.S.now();i[o.key]=Array.from({length:e.length},(l,u)=>a.add(s.a.nanoseconds(u)))}await this.controller.set(i)},"Failed to command channel")}}const oa=t=>({type:Pt.TYPE,props:t,variant:"sink",valueType:"number"}),ai=d.z.object({authority:d.z.number().default(p.Lm.ABSOLUTE_AUTHORITY),channel:d.z.number()});class kt extends Qt{static TYPE="acquire-channel-control";controller;runAsync;schema=ai;constructor(e,n,r){super(r),this.controller=e,this.runAsync=n}cleanup(){this.controller.deleteTelem(this)}async needsControlOf(e){const n=await e.channels.retrieve(this.props.channel),r=[n.key];return n.index!==0&&r.push(n.index),r}set(e){this.runAsync(async()=>{const{controller:n}=this,{client:r}=n.internal;if(r==null)return;const i=await r.channels.retrieve(this.props.channel),o=[i.key];i.index!==0&&o.push(i.index),e?await this.controller.setAuthority(o,this.props.authority):await this.controller.releaseAuthority(o)},"failed to set channel authority")}}const aa=t=>({type:kt.TYPE,props:t,variant:"sink",valueType:"boolean"}),li=d.z.object({channel:d.z.number()}),la=d.z.object({valid:d.z.boolean(),color:s.ir.colorZ.optional(),authority:d.z.number()});class Rt extends B{static TYPE="controlled-status-source";prov;valid=!1;stopListening;controller;schema=li;constructor(e,n,r){super(r),this.prov=n,this.controller=e}async needsControlOf(){return[]}maybeRevalidate(){if(this.valid)return;const{channel:e}=this.props;this.stopListening?.();const n=s.ar.filterTransfersByChannelKey(e);this.stopListening=this.prov.onChange(r=>{n(r).length!==0&&this.notify?.()}),this.valid=!0}value(){this.maybeRevalidate();const e=p.S.now();if(this.props.channel===0)return{key:this.controller.key,variant:"disabled",message:"No Channel",time:e,details:{valid:!1,authority:0}};const n=this.prov.get(this.props.channel);return n==null?{key:this.controller.key,variant:"disabled",message:"Uncontrolled",time:e,details:{valid:!0,color:void 0,authority:0}}:{key:n.subject.key,variant:n.subject.key===this.controller.key?"success":"error",message:`Controlled by ${n.subject.name}`,time:e,details:{valid:!0,color:n.subjectColor,authority:n.authority}}}cleanup(){this.controller.deleteTelem(this),this.stopListening?.()}}const ca=t=>({type:Rt.TYPE,props:t,variant:"source",valueType:"status"}),ci=d.z.object({color:s.ir.colorZ.optional()}).default({color:void 0}),ui=d.z.object({statusSource:Wn.optional().default(Kn),colorSource:Fn.optional().default(jt),status:s._r.statusZ(ci),color:s.ir.colorZ.optional()});class En extends p.Leaf{static TYPE="Indicator";schema=ui;stopListeningStatus;stopListeningColor;afterUpdate(e){const{internal:n}=this,{statusSource:r,colorSource:i}=this.state;n.statusSource=K(e,r,n.statusSource),n.colorSource=K(e,i,n.colorSource),this.updateState(),this.stopListeningStatus?.(),this.stopListeningColor?.(),this.stopListeningStatus=n.statusSource.onChange(this.updateState.bind(this)),this.stopListeningColor=n.colorSource.onChange(this.updateState.bind(this))}afterDelete(){this.internal.statusSource.cleanup?.(),this.internal.colorSource.cleanup?.()}render(){}updateState(){const e=this.internal.colorSource.value(),n=this.internal.statusSource.value();s.ir.equals(e,this.state.color)&&n.message===this.state.status.message||this.setState(r=>({...r,color:e,status:n}))}}const hi=d.z.object({needsControlOf:p.xm.keyZ.array(),states:ni.array()});class Cn extends p.Leaf{static TYPE="Legend";schema=hi;afterUpdate(e){const{internal:n}=this;n.stateProv=qe.use(e);const r=this.state.needsControlOf;n.disconnectStateProv?.();const i=s.ar.filterTransfersByChannelKey(...r),o=n.stateProv.get(r);this.setState(a=>({...a,states:o})),n.disconnectStateProv=n.stateProv.onChange(a=>{if(i(a).length===0)return;const l=n.stateProv.get(r);this.setState(u=>({...u,states:l}))})}afterDelete(){const{internal:e}=this;e.disconnectStateProv?.()}render(){}}const ua={[Tn.TYPE]:Tn,[qe.TYPE]:qe,[En.TYPE]:En,[wn.TYPE]:wn,[Cn.TYPE]:Cn},di=["fire","momentary","pulse"],ha=d.z.enum(di),fi=d.z.object({trigger:d.z.number(),sink:Gt.optional().default(Wt),mode:ha.optional().default("fire")}),pi=2,gi=1;class Pn extends p.Leaf{static TYPE="Button";schema=fi;afterUpdate(e){const{sink:n,mode:r,trigger:i}=this.state,{internal:o}=this;o.prevTrigger??=i,o.sink=rt(e,n,o.sink);const a=o.prevTrigger;o.prevTrigger=i;const l=i===a+pi;i===a+gi?r=="fire"?this.internal.sink.set(!0):r=="momentary"&&this.internal.sink.set(!1):l&&(r=="momentary"?this.internal.sink.set(!0):r=="pulse"&&this.internal.sink.set(!0,!1))}afterDelete(){this.internal.sink.cleanup?.()}}const da={[Pn.TYPE]:Pn},Rr=`#version 300 es
|
|
3
|
-
precision lowp float;
|
|
4
|
-
|
|
5
|
-
uniform lowp vec4 u_color;
|
|
6
|
-
out vec4 fragColor;
|
|
7
|
-
|
|
8
|
-
void main(void) {
|
|
9
|
-
fragColor = u_color;
|
|
10
|
-
}
|
|
11
|
-
`,fa=`#version 300 es
|
|
12
|
-
|
|
13
|
-
// Copyright 2025 Synnax Labs, Inc.
|
|
14
|
-
//
|
|
15
|
-
// Use of this software is governed by the Business Source License included in the file
|
|
16
|
-
// licenses/BSL.txt.
|
|
17
|
-
//
|
|
18
|
-
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
19
|
-
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
20
|
-
// included in the file licenses/APL.txt.
|
|
21
|
-
|
|
22
|
-
in mediump float a_x;
|
|
23
|
-
in mediump float a_y;
|
|
24
|
-
in mediump vec2 a_translate;
|
|
25
|
-
|
|
26
|
-
uniform mediump vec2 u_scale_aggregate;
|
|
27
|
-
uniform mediump vec2 u_offset_aggregate;
|
|
28
|
-
|
|
29
|
-
void main(void) {
|
|
30
|
-
gl_Position = vec4((u_scale_aggregate * vec2(a_x, a_y) + u_offset_aggregate) + a_translate, 0.0, 1.0);
|
|
31
|
-
}
|
|
32
|
-
`,pa=`#version 300 es
|
|
33
|
-
|
|
34
|
-
// Copyright 2025 Synnax Labs, Inc.
|
|
35
|
-
//
|
|
36
|
-
// Use of this software is governed by the Business Source License included in the file
|
|
37
|
-
// licenses/BSL.txt.
|
|
38
|
-
//
|
|
39
|
-
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
40
|
-
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
41
|
-
// included in the file licenses/APL.txt.
|
|
42
|
-
|
|
43
|
-
in mediump float a_x;
|
|
44
|
-
in mediump uint a_y;
|
|
45
|
-
in mediump vec2 a_translate;
|
|
46
|
-
|
|
47
|
-
uniform mediump vec2 u_scale_aggregate;
|
|
48
|
-
uniform mediump vec2 u_offset_aggregate;
|
|
49
|
-
|
|
50
|
-
void main(void) {
|
|
51
|
-
gl_Position = vec4((u_scale_aggregate * vec2(a_x, float(a_y)) + u_offset_aggregate) + a_translate, 0.0, 1.0);
|
|
52
|
-
}
|
|
53
|
-
`,mi=d.z.object({x:gt,y:gt,label:d.z.string().optional(),color:s.ir.colorZ,strokeWidth:d.z.number().default(1),downsample:d.z.number().min(1).max(50).optional().default(1),visible:d.z.boolean().optional().default(!0)}),ga=(t,e,n)=>t===-1||e===-1||t>=n.series.length?NaN:Number(n.series[t].at(e)),ma=s.a.milliseconds(2);s.K.NAN,s.K.NAN,s.ir.ZERO,s.W.ZERO;const ya=(t,e)=>e.equals(s.r.UINT8)?t.UNSIGNED_BYTE:t.FLOAT;class Mr extends p.GLProgram{translationBufferCache=new Map;constructor(e,n,r){super(e,n,r),this.translationBufferCache=new Map}bindState({strokeWidth:e,color:n}){return this.uniformColor("u_color",n),this.attrStrokeWidth(e)}bindScale(e,n){const r=s.K.scale(e.scale,n.scale),i=s.K.translate(s.K.scale(n.scale,e.offset),n.offset);this.uniformXY("u_scale_aggregate",r),this.uniformXY("u_offset_aggregate",i)}draw({x:e,y:n,count:r,downsample:i,xOffset:o,yOffset:a},l,u,c){const{gl:h}=this.renderCtx;this.bindAttrBuffer("x",e.glBuffer,i,o,u),this.bindAttrBuffer("y",n.glBuffer,i,a,c),h.drawArraysInstanced(h.LINE_STRIP,0,r/i,l)}bindAttrBuffer(e,n,r,i=0,o){const{gl:a}=this.renderCtx;a.bindBuffer(a.ARRAY_BUFFER,n);const l=a.getAttribLocation(this.prog,`a_${e}`),u=ya(a,o),c=o.density.valueOf();o.equals(s.r.UINT8)?a.vertexAttribIPointer(l,1,u,c*r,c*i):a.vertexAttribPointer(l,1,u,!1,c*r,c*i),a.enableVertexAttribArray(l)}getAndBindTranslationBuffer(e){const{gl:n}=this.renderCtx,r=`${this.renderCtx.aspect}:${e}`,i=this.translationBufferCache.get(r);if(i!=null)return n.bindBuffer(n.ARRAY_BUFFER,i.glBuffer),i;const o=n.createBuffer();if(o==null)throw new p.lt("Failed to create buffer from WebGL context");const a=ba(this.renderCtx.aspect,e);n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,a,n.DYNAMIC_DRAW);const l={glBuffer:o,jsBuffer:a};return this.translationBufferCache.set(r,l),l}attrStrokeWidth(e){const{gl:n}=this.renderCtx,{jsBuffer:r}=this.getAndBindTranslationBuffer(e),i=n.getAttribLocation(this.prog,"a_translate");return n.vertexAttribPointer(i,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(i),n.vertexAttribDivisor(i,1),r.length/2}}class Se{static CONTEXT_KEY="pluto-line-gl-program";uint8HybridProgram;float32Program;constructor(e){this.uint8HybridProgram=new Mr(e,pa,Rr),this.float32Program=new Mr(e,fa,Rr)}get gl(){return this.uint8HybridProgram.renderCtx.gl}getProgram(e){return e.equals(s.r.UINT8)?this.uint8HybridProgram:this.float32Program}static create(e,n){const r=new Se(n);return e.set(Se.CONTEXT_KEY,r),r}static use(e){const n=e.get(Se.CONTEXT_KEY);if(n==null)throw new p.lt("GLProgram not found");return n}}class Mt extends p.Leaf{static TYPE="line";schema=mi;afterUpdate(e){const{internal:n}=this,r={onStatusChange:p.useAdder(e)};n.xTelem=K(e,this.state.x,n.xTelem,r),n.yTelem=K(e,this.state.y,n.yTelem,r),n.instrumentation=p.useInstrumentation(e,"line"),n.lineCtx=Se.use(e),n.requestRender=Ft(e),n.stopListeningXTelem?.(),n.stopListeningYTelem?.(),n.stopListeningXTelem=n.xTelem.onChange(()=>n.requestRender("data")),n.stopListeningYTelem=n.yTelem.onChange(()=>n.requestRender("data")),n.requestRender("layout")}afterDelete(){const{internal:e}=this;e.xTelem.cleanup?.(),e.yTelem.cleanup?.(),e.requestRender("layout")}xBounds(){return this.internal.xTelem.value()[0]}yBounds(){return this.internal.yTelem.value()[0]}findByXValue(e,n){const{xTelem:r,yTelem:i}=this.internal,[,o]=r.value();let[a,l]=[-1,-1];o.series.find((x,R)=>{const L=x.binarySearch(n),k=L>=0&&L<x.length;return k&&([a,l]=[L,R]),k});const{key:u}=this,{color:c,label:h}=this.state,f={key:u,color:c,label:h,position:{x:0,y:0},value:{x:NaN,y:NaN},bounds:{lower:0,upper:0}};if(a===-1||l===-1||!this.state.visible)return f;const g=o.series[l];f.value.x=ga(l,a,o);const[,v]=i.value(),w=v.series.find(x=>s.W.contains(x.alignmentBounds,g.alignment+BigInt(a)));if(w==null)return f;const b=Number(w.alignment-g.alignment);return f.value.y=Number(w.at(a-b)),f.bounds={...w.bounds},f.position={x:e.dataToDecimalScale.x.pos(f.value.x),y:e.dataToDecimalScale.y.pos(f.value.y)},f}render(e){if(this.deleted||!this.state.visible)return;const{downsample:n}=this.state,{xTelem:r,yTelem:i,lineCtx:o}=this.internal,{dataToDecimalScale:a,exposure:l}=e,[[,u],[,c]]=[r.value(),i.value()];if(u.updateGLBuffer(o.gl),c.updateGLBuffer(o.gl),u.length===0||c.length===0)return;const h=o.getProgram(c.dataType),f=Ca(u,c,l,n,ma);this.internal.instrumentation.L.debug("render",()=>({key:this.key,downsample:n,scale:a.transform,props:e.region,ops:Pa(f)}));const g=h.setAsActive(),v=h.bindState(this.state),w=h.renderCtx.scaleRegion(e.region).transform;f.forEach(b=>{const x=Ta(a,b).transform;h.bindScale(x,w),h.draw(b,v,u.dataType,c.dataType)}),g()}}const va=5e3,ba=(t,e)=>wa(Sa(t),e).map((n,r)=>Math.floor(r/xa)*(1/(va*t))*n),xa=5,Sa=t=>new Float32Array([0,0,0,t,0,-t,1,0,-1,0]),wa=(t,e)=>{const n=new Float32Array(t.length*e);for(let r=0;r<e;r++)n.set(t,r*t.length);return n},Ta=(t,e)=>t.translate(t.x.dim(Number(e.x.sampleOffset)),t.y.dim(Number(e.y.sampleOffset))),Ea={[Mt.TYPE]:Mt},Ca=(t,e,n,r,i)=>{if(t.series.length===0||e.series.length===0)return[];const o=[];return t.series.forEach(a=>e.series.forEach(l=>{if(!ka(a,l,i))return;let u=0,c=0;a.alignment<l.alignment?u=Number(l.alignment-a.alignment):l.alignment<a.alignment&&(c=Number(a.alignment-l.alignment));const h=Math.min(a.length-u,l.length-c);if(h===0)return;const f=s.R(Math.round(n*4*h),r,51);o.push({x:a,y:l,xOffset:u,yOffset:c,count:h,downsample:f})})),o},Pa=t=>t.map(e=>({...e,x:e.x.digest,y:e.y.digest})),ka=(t,e,n)=>{const r=t.timeRange.overlapsWith(e.timeRange,n),i=s.W.overlapsWith(t.alignmentBounds,e.alignmentBounds);return r&&i},or=d.z.object({dpr:d.z.number(),region:s.Ho.box,bootstrap:d.z.boolean().optional().default(!1),bootstrapped:d.z.boolean().optional().default(!1),glCanvas:d.z.any().optional(),upper2dCanvas:d.z.any().optional(),lower2dCanvas:d.z.any().optional(),os:s.S.osZ});class Lt extends p.Composite{static TYPE="Canvas";schema=or;renderCtx=null;afterUpdate(e){if(this.renderCtx==null){if(!this.state.bootstrap)return;const{glCanvas:n,lower2dCanvas:r,upper2dCanvas:i,os:o}=this.state;if(n==null||r==null||i==null)throw new p.lt("[vis.worker.Canvas] - expected render context bootstrap to include all canvases");this.renderCtx=p.Context.create(e,n,r,i,o),Se.create(e,this.renderCtx),this.setState(a=>({...a,bootstrap:!1,bootstrapped:!0,glCanvas:void 0,lower2dCanvas:void 0,upper2dCanvas:void 0}))}else this.renderCtx.update(e);this.renderCtx.resize(this.state.region,this.state.dpr)}}const yi={[Lt.TYPE]:Lt},Ra=Object.freeze(Object.defineProperty({__proto__:null,Canvas:Lt,REGISTRY:yi,canvasStateZ:or},Symbol.toStringTag,{value:"Module"})),ar=d.z.object({position:s.K.xy,zoom:d.z.number(),region:s.Ho.box,clearOverScan:s.K.crudeZ.optional().default(10),visible:d.z.boolean().optional().default(!0)}),ct=["upper2d","lower2d"];class le extends p.Composite{static TYPE="Diagram";static stateZ=ar;schema=le.stateZ;afterUpdate(e){this.internal.renderCtx=p.Context.use(e),this.internal.handleError=p.useErrorHandler(e),qt(e,()=>{this.state.visible&&this.requestRender("low")}),!(!this.state.visible&&!this.prevState.visible)&&(this.internal.viewportScale=s.C.XY.magnify(s.K.construct(this.state.zoom)).translate(s.Ho.topLeft(this.state.region)).translate(this.state.position),this.requestRender("high"))}afterDelete(){this.requestRender("high")}render(){if(this.deleted)return;const{renderCtx:e,handleError:n,viewportScale:r}=this.internal,i=s.Ho.construct(this.state.region);if(!this.state.visible)return()=>e.erase(i,this.state.clearOverScan,...ct);const o=e.scissor(i,s.K.ZERO,ct);try{this.children.forEach(l=>l.render?.({viewportScale:r}))}catch(l){n(l,"failed to render diagram")}finally{o()}const a=s.Ho.copy(this.state.region);return()=>{e.lower2d.fillStyle=s.ir.hex(s.ir.BLACK),e.lower2d.fillRect(...s.K.couple(s.Ho.topLeft(a)),s.Ho.width(a),s.Ho.height(a)),e.erase(a,this.state.clearOverScan,...ct)}}requestRender(e){const{renderCtx:n}=this.internal;n.loop.set({key:`${le.TYPE}-${this.key}`,render:this.render.bind(this),priority:e,canvases:ct})}}const vi={[le.TYPE]:le},Ma=Object.freeze(Object.defineProperty({__proto__:null,Diagram:le,REGISTRY:vi,diagramStateZ:ar},Symbol.toStringTag,{value:"Module"})),bi=d.z.object({enabled:d.z.boolean(),source:qn.optional().default($n)});class kn extends p.Leaf{static TYPE="Light";schema=bi;afterUpdate(e){this.internal.addStatus=p.useOptionalAdder(e);const{source:n}=this.state,{internal:r}=this;this.internal.source=K(e,n,this.internal.source),r.stopListening?.(),r.stopListening=r.source.onChange(()=>this.updateEnabledState())}updateEnabledState(){const e=this.internal.source.value();e!==this.state.enabled&&this.setState(n=>({...n,enabled:e}))}afterDelete(){this.internal.stopListening(),this.internal.source.cleanup?.()}}const La={[kn.TYPE]:kn},Oa=d.object({request:d.string(),bounds:d.record(d.string(),s.W.bounds)}),xi=d.object({request:d.string(),response:Oa});class Ot extends p.Leaf{static TYPE="Bounds";schema=xi;afterUpdate(e){this.state.request!==this.prevState.request&&this.setState(n=>({...n,response:{request:n.request,bounds:this.internal.getBounds()}}))}render(e){this.internal.getBounds=e.getBounds}}const Si=d.z.object({key:d.z.string(),size:d.z.number(),order:d.z.number(),loc:s.K$1.outer});d.z.record(d.z.string(),Si);const ie=(t,e)=>Object.values(e).filter(({loc:n})=>n===t).sort((n,r)=>r.order-n.order),Ya=(t,e,n)=>{const r=e[t];if(r==null)return s.K.ZERO;const i=s.K$1.construct(r.loc),o=ie(i,e),a=s.K$1.construct(s.g.swap(s.K$1.direction(i))),l=ie(a,e),u=o.findIndex(({key:f})=>f===t),c=o.slice(0,u).reduce((f,{size:g})=>f+g,0),h=l.reduce((f,{size:g})=>f+g,0);switch(i){case"left":return s.K.translate(s.Ho.topLeft(n),[c,h]);case"right":return s.K.translate(s.Ho.topRight(n),[c-r.size,h]);case"top":return s.K.translate(s.Ho.topLeft(n),[h,c]);default:return s.K.translate(s.Ho.bottomLeft(n),[h,-c-r.size])}},Da=(t,e)=>{const n=ie("left",t),r=ie("right",t),i=ie("top",t),o=ie("bottom",t),a=n.reduce((h,{size:f})=>h+f,0),l=r.reduce((h,{size:f})=>h+f,0),u=i.reduce((h,{size:f})=>h+f,0),c=o.reduce((h,{size:f})=>h+f,0);return s.Ho.construct(s.K.translate(s.Ho.topLeft(e),{x:a,y:u}),s.Ho.width(e)-a-l,s.Ho.height(e)-u-c)};function ft(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function _a(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function lr(t){let e,n,r;t.length!==2?(e=ft,n=(l,u)=>ft(t(l),u),r=(l,u)=>t(l)-u):(e=t===ft||t===_a?t:za,n=t,r=t);function i(l,u,c=0,h=l.length){if(c<h){if(e(u,u)!==0)return h;do{const f=c+h>>>1;n(l[f],u)<0?c=f+1:h=f}while(c<h)}return c}function o(l,u,c=0,h=l.length){if(c<h){if(e(u,u)!==0)return h;do{const f=c+h>>>1;n(l[f],u)<=0?c=f+1:h=f}while(c<h)}return c}function a(l,u,c=0,h=l.length){const f=i(l,u,c,h-1);return f>c&&r(l[f-1],u)>-r(l[f],u)?f-1:f}return{left:i,center:a,right:o}}function za(){return 0}function Aa(t){return t===null?NaN:+t}const Za=lr(ft),Ha=Za.right;lr(Aa).center;const Ia=Math.sqrt(50),Na=Math.sqrt(10),Ba=Math.sqrt(2);function Yt(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=Ia?10:o>=Na?5:o>=Ba?2:1;let l,u,c;return i<0?(c=Math.pow(10,-i)/a,l=Math.round(t*c),u=Math.round(e*c),l/c<t&&++l,u/c>e&&--u,c=-c):(c=Math.pow(10,i)*a,l=Math.round(t/c),u=Math.round(e/c),l*c<t&&++l,u*c>e&&--u),u<l&&.5<=n&&n<2?Yt(t,e,n*2):[l,u,c]}function Ua(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[i,o,a]=r?Yt(e,t,n):Yt(t,e,n);if(!(o>=i))return[];const l=o-i+1,u=new Array(l);if(r)if(a<0)for(let c=0;c<l;++c)u[c]=(o-c)/-a;else for(let c=0;c<l;++c)u[c]=(o-c)*a;else if(a<0)for(let c=0;c<l;++c)u[c]=(i+c)/-a;else for(let c=0;c<l;++c)u[c]=(i+c)*a;return u}function Rn(t,e,n){return e=+e,t=+t,n=+n,Yt(t,e,n)[2]}function Mn(t,e,n){e=+e,t=+t,n=+n;const r=e<t,i=r?Rn(e,t,n):Rn(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function wi(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function cr(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ti(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function st(){}var Fe=.7,Dt=1/Fe,we="\\s*([+-]?\\d+)\\s*",We="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",W="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$a=/^#([0-9a-f]{3,8})$/,Ka=new RegExp(`^rgb\\(${we},${we},${we}\\)$`),qa=new RegExp(`^rgb\\(${W},${W},${W}\\)$`),Fa=new RegExp(`^rgba\\(${we},${we},${we},${We}\\)$`),Wa=new RegExp(`^rgba\\(${W},${W},${W},${We}\\)$`),ja=new RegExp(`^hsl\\(${We},${W},${W}\\)$`),Va=new RegExp(`^hsla\\(${We},${W},${W},${We}\\)$`),Lr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};cr(st,Ye,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Or,formatHex:Or,formatHex8:Ga,formatHsl:Xa,formatRgb:Yr,toString:Yr});function Or(){return this.rgb().formatHex()}function Ga(){return this.rgb().formatHex8()}function Xa(){return Ei(this).formatHsl()}function Yr(){return this.rgb().formatRgb()}function Ye(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=$a.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Dr(e):n===3?new H(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?ut(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?ut(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Ka.exec(t))?new H(e[1],e[2],e[3],1):(e=qa.exec(t))?new H(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Fa.exec(t))?ut(e[1],e[2],e[3],e[4]):(e=Wa.exec(t))?ut(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=ja.exec(t))?Ar(e[1],e[2]/100,e[3]/100,1):(e=Va.exec(t))?Ar(e[1],e[2]/100,e[3]/100,e[4]):Lr.hasOwnProperty(t)?Dr(Lr[t]):t==="transparent"?new H(NaN,NaN,NaN,0):null}function Dr(t){return new H(t>>16&255,t>>8&255,t&255,1)}function ut(t,e,n,r){return r<=0&&(t=e=n=NaN),new H(t,e,n,r)}function Qa(t){return t instanceof st||(t=Ye(t)),t?(t=t.rgb(),new H(t.r,t.g,t.b,t.opacity)):new H}function Ln(t,e,n,r){return arguments.length===1?Qa(t):new H(t,e,n,r??1)}function H(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}cr(H,Ln,Ti(st,{brighter(t){return t=t==null?Dt:Math.pow(Dt,t),new H(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Fe:Math.pow(Fe,t),new H(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new H(ae(this.r),ae(this.g),ae(this.b),_t(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:_r,formatHex:_r,formatHex8:Ja,formatRgb:zr,toString:zr}));function _r(){return`#${oe(this.r)}${oe(this.g)}${oe(this.b)}`}function Ja(){return`#${oe(this.r)}${oe(this.g)}${oe(this.b)}${oe((isNaN(this.opacity)?1:this.opacity)*255)}`}function zr(){const t=_t(this.opacity);return`${t===1?"rgb(":"rgba("}${ae(this.r)}, ${ae(this.g)}, ${ae(this.b)}${t===1?")":`, ${t})`}`}function _t(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ae(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function oe(t){return t=ae(t),(t<16?"0":"")+t.toString(16)}function Ar(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new F(t,e,n,r)}function Ei(t){if(t instanceof F)return new F(t.h,t.s,t.l,t.opacity);if(t instanceof st||(t=Ye(t)),!t)return new F;if(t instanceof F)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,l=o-i,u=(o+i)/2;return l?(e===o?a=(n-r)/l+(n<r)*6:n===o?a=(r-e)/l+2:a=(e-n)/l+4,l/=u<.5?o+i:2-o-i,a*=60):l=u>0&&u<1?0:a,new F(a,l,u,t.opacity)}function el(t,e,n,r){return arguments.length===1?Ei(t):new F(t,e,n,r??1)}function F(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}cr(F,el,Ti(st,{brighter(t){return t=t==null?Dt:Math.pow(Dt,t),new F(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Fe:Math.pow(Fe,t),new F(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new H(rn(t>=240?t-240:t+120,i,r),rn(t,i,r),rn(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new F(Zr(this.h),ht(this.s),ht(this.l),_t(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=_t(this.opacity);return`${t===1?"hsl(":"hsla("}${Zr(this.h)}, ${ht(this.s)*100}%, ${ht(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Zr(t){return t=(t||0)%360,t<0?t+360:t}function ht(t){return Math.max(0,Math.min(1,t||0))}function rn(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const ur=t=>()=>t;function tl(t,e){return function(n){return t+n*e}}function nl(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function rl(t){return(t=+t)==1?Ci:function(e,n){return n-e?nl(e,n,t):ur(isNaN(e)?n:e)}}function Ci(t,e){var n=e-t;return n?tl(t,n):ur(isNaN(t)?e:t)}const On=function t(e){var n=rl(e);function r(i,o){var a=n((i=Ln(i)).r,(o=Ln(o)).r),l=n(i.g,o.g),u=n(i.b,o.b),c=Ci(i.opacity,o.opacity);return function(h){return i.r=a(h),i.g=l(h),i.b=u(h),i.opacity=c(h),i+""}}return r.gamma=t,r}(1);function sl(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=t[i]*(1-o)+e[i]*o;return r}}function il(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function ol(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),o=new Array(n),a;for(a=0;a<r;++a)i[a]=en(t[a],e[a]);for(;a<n;++a)o[a]=e[a];return function(l){for(a=0;a<r;++a)o[a]=i[a](l);return o}}function al(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function je(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function ll(t,e){var n={},r={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=en(t[i],e[i]):r[i]=e[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var Yn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sn=new RegExp(Yn.source,"g");function cl(t){return function(){return t}}function ul(t){return function(e){return t(e)+""}}function Pi(t,e){var n=Yn.lastIndex=sn.lastIndex=0,r,i,o,a=-1,l=[],u=[];for(t=t+"",e=e+"";(r=Yn.exec(t))&&(i=sn.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),l[a]?l[a]+=o:l[++a]=o),(r=r[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,u.push({i:a,x:je(r,i)})),n=sn.lastIndex;return n<e.length&&(o=e.slice(n),l[a]?l[a]+=o:l[++a]=o),l.length<2?u[0]?ul(u[0].x):cl(e):(e=u.length,function(c){for(var h=0,f;h<e;++h)l[(f=u[h]).i]=f.x(c);return l.join("")})}function en(t,e){var n=typeof e,r;return e==null||n==="boolean"?ur(e):(n==="number"?je:n==="string"?(r=Ye(e))?(e=r,On):Pi:e instanceof Ye?On:e instanceof Date?al:il(e)?sl:Array.isArray(e)?ol:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?ll:je)(t,e)}function hl(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function dl(t){return function(){return t}}function fl(t){return+t}var Hr=[0,1];function be(t){return t}function Dn(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:dl(isNaN(e)?NaN:.5)}function pl(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function gl(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i<r?(r=Dn(i,r),o=n(a,o)):(r=Dn(r,i),o=n(o,a)),function(l){return o(r(l))}}function ml(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<r;)i[a]=Dn(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(l){var u=Ha(t,l,1,r)-1;return o[u](i[u](l))}}function ki(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function yl(){var t=Hr,e=Hr,n=en,r,i,o,a=be,l,u,c;function h(){var g=Math.min(t.length,e.length);return a!==be&&(a=pl(t[0],t[g-1])),l=g>2?ml:gl,u=c=null,f}function f(g){return g==null||isNaN(g=+g)?o:(u||(u=l(t.map(r),e,n)))(r(a(g)))}return f.invert=function(g){return a(i((c||(c=l(e,t.map(r),je)))(g)))},f.domain=function(g){return arguments.length?(t=Array.from(g,fl),h()):t.slice()},f.range=function(g){return arguments.length?(e=Array.from(g),h()):e.slice()},f.rangeRound=function(g){return e=Array.from(g),n=hl,h()},f.clamp=function(g){return arguments.length?(a=g?!0:be,h()):a!==be},f.interpolate=function(g){return arguments.length?(n=g,h()):n},f.unknown=function(g){return arguments.length?(o=g,f):o},function(g,v){return r=g,i=v,h()}}function Ri(){return yl()(be,be)}function vl(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function zt(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function De(t){return t=zt(Math.abs(t)),t?t[1]:NaN}function bl(t,e){return function(n,r){for(var i=n.length,o=[],a=0,l=t[0],u=0;i>0&&l>0&&(u+l+1>r&&(l=Math.max(1,r-u)),o.push(n.substring(i-=l,i+l)),!((u+=l+1)>r));)l=t[a=(a+1)%t.length];return o.reverse().join(e)}}function xl(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Sl=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function At(t){if(!(e=Sl.exec(t)))throw new Error("invalid format: "+t);var e;return new hr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}At.prototype=hr.prototype;function hr(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}hr.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function wl(t){e:for(var e=t.length,n=1,r=-1,i;n<e;++n)switch(t[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var Mi;function Tl(t,e){var n=zt(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Mi=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+zt(t,Math.max(0,e+o-1))[0]}function Ir(t,e){var n=zt(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const Nr={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:vl,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Ir(t*100,e),r:Ir,s:Tl,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Br(t){return t}var Ur=Array.prototype.map,$r=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function El(t){var e=t.grouping===void 0||t.thousands===void 0?Br:bl(Ur.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?Br:xl(Ur.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",u=t.nan===void 0?"NaN":t.nan+"";function c(f){f=At(f);var g=f.fill,v=f.align,w=f.sign,b=f.symbol,x=f.zero,R=f.width,L=f.comma,k=f.precision,O=f.trim,D=f.type;D==="n"?(L=!0,D="g"):Nr[D]||(k===void 0&&(k=12),O=!0,D="g"),(x||g==="0"&&v==="=")&&(x=!0,g="0",v="=");var S=b==="$"?n:b==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():"",Y=b==="$"?r:/[%p]/.test(D)?a:"",ee=Nr[D],Ie=/[defgprs%]/.test(D);k=k===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,k)):Math.max(0,Math.min(20,k));function pe(E){var j=S,A=Y,te,lt,ge;if(D==="c")A=ee(E)+A,E="";else{E=+E;var me=E<0||1/E<0;if(E=isNaN(E)?u:ee(Math.abs(E),k),O&&(E=wl(E)),me&&+E==0&&w!=="+"&&(me=!1),j=(me?w==="("?w:l:w==="-"||w==="("?"":w)+j,A=(D==="s"?$r[8+Mi/3]:"")+A+(me&&w==="("?")":""),Ie){for(te=-1,lt=E.length;++te<lt;)if(ge=E.charCodeAt(te),48>ge||ge>57){A=(ge===46?i+E.slice(te+1):E.slice(te))+A,E=E.slice(0,te);break}}}L&&!x&&(E=e(E,1/0));var ye=j.length+E.length+A.length,q=ye<R?new Array(R-ye+1).join(g):"";switch(L&&x&&(E=e(q+E,q.length?R-A.length:1/0),q=""),v){case"<":E=j+E+A+q;break;case"=":E=j+q+E+A;break;case"^":E=q.slice(0,ye=q.length>>1)+j+E+A+q.slice(ye);break;default:E=q+j+E+A;break}return o(E)}return pe.toString=function(){return f+""},pe}function h(f,g){var v=c((f=At(f),f.type="f",f)),w=Math.max(-8,Math.min(8,Math.floor(De(g)/3)))*3,b=Math.pow(10,-w),x=$r[8+w/3];return function(R){return v(b*R)+x}}return{format:c,formatPrefix:h}}var dt,Li,Oi;Cl({thousands:",",grouping:[3],currency:["$",""]});function Cl(t){return dt=El(t),Li=dt.format,Oi=dt.formatPrefix,dt}function Pl(t){return Math.max(0,-De(Math.abs(t)))}function kl(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(De(e)/3)))*3-De(Math.abs(t)))}function Rl(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,De(e)-De(t))+1}function Ml(t,e,n,r){var i=Mn(t,e,n),o;switch(r=At(r??",f"),r.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=kl(i,a))&&(r.precision=o),Oi(r,a)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=Rl(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=Pl(i))&&(r.precision=o-(r.type==="%")*2);break}}return Li(r)}function Ll(t){var e=t.domain;return t.ticks=function(n){var r=e();return Ua(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return Ml(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,o=r.length-1,a=r[i],l=r[o],u,c,h=10;for(l<a&&(c=a,a=l,l=c,c=i,i=o,o=c);h-- >0;){if(c=Rn(a,l,n),c===u)return r[i]=a,r[o]=l,e(r);if(c>0)a=Math.floor(a/c)*c,l=Math.ceil(l/c)*c;else if(c<0)a=Math.ceil(a*c)/c,l=Math.floor(l*c)/c;else break;u=c}return t},t}function Yi(){var t=Ri();return t.copy=function(){return ki(t,Yi())},wi.apply(t,arguments),Ll(t)}function Ol(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],o=t[r],a;return o<i&&(a=n,n=r,r=a,a=i,i=o,o=a),t[n]=e.floor(i),t[r]=e.ceil(o),t}const on=new Date,an=new Date;function _(t,e,n,r){function i(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(t(o=new Date(+o)),o),i.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),i.round=o=>{const a=i(o),l=i.ceil(o);return o-a<l-o?a:l},i.offset=(o,a)=>(e(o=new Date(+o),a==null?1:Math.floor(a)),o),i.range=(o,a,l)=>{const u=[];if(o=i.ceil(o),l=l==null?1:Math.floor(l),!(o<a)||!(l>0))return u;let c;do u.push(c=new Date(+o)),e(o,l),t(o);while(c<o&&o<a);return u},i.filter=o=>_(a=>{if(a>=a)for(;t(a),!o(a);)a.setTime(a-1)},(a,l)=>{if(a>=a)if(l<0)for(;++l<=0;)for(;e(a,-1),!o(a););else for(;--l>=0;)for(;e(a,1),!o(a););}),n&&(i.count=(o,a)=>(on.setTime(+o),an.setTime(+a),t(on),t(an),Math.floor(n(on,an))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?a=>r(a)%o===0:a=>i.count(0,a)%o===0):i)),i}const Zt=_(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Zt.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?_(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Zt);Zt.range;const V=1e3,U=V*60,G=U*60,Q=G*24,dr=Q*7,Kr=Q*30,ln=Q*365,xe=_(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*V)},(t,e)=>(e-t)/V,t=>t.getUTCSeconds());xe.range;const fr=_(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*V)},(t,e)=>{t.setTime(+t+e*U)},(t,e)=>(e-t)/U,t=>t.getMinutes());fr.range;const Yl=_(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*U)},(t,e)=>(e-t)/U,t=>t.getUTCMinutes());Yl.range;const pr=_(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*V-t.getMinutes()*U)},(t,e)=>{t.setTime(+t+e*G)},(t,e)=>(e-t)/G,t=>t.getHours());pr.range;const Dl=_(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*G)},(t,e)=>(e-t)/G,t=>t.getUTCHours());Dl.range;const it=_(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*U)/Q,t=>t.getDate()-1);it.range;const gr=_(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Q,t=>t.getUTCDate()-1);gr.range;const _l=_(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Q,t=>Math.floor(t/Q));_l.range;function he(t){return _(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*U)/dr)}const tn=he(0),Ht=he(1),zl=he(2),Al=he(3),_e=he(4),Zl=he(5),Hl=he(6);tn.range;Ht.range;zl.range;Al.range;_e.range;Zl.range;Hl.range;function de(t){return _(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/dr)}const Di=de(0),It=de(1),Il=de(2),Nl=de(3),ze=de(4),Bl=de(5),Ul=de(6);Di.range;It.range;Il.range;Nl.range;ze.range;Bl.range;Ul.range;const mr=_(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());mr.range;const $l=_(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());$l.range;const J=_(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());J.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:_(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});J.range;const ce=_(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());ce.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:_(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});ce.range;function Kl(t,e,n,r,i,o){const a=[[xe,1,V],[xe,5,5*V],[xe,15,15*V],[xe,30,30*V],[o,1,U],[o,5,5*U],[o,15,15*U],[o,30,30*U],[i,1,G],[i,3,3*G],[i,6,6*G],[i,12,12*G],[r,1,Q],[r,2,2*Q],[n,1,dr],[e,1,Kr],[e,3,3*Kr],[t,1,ln]];function l(c,h,f){const g=h<c;g&&([c,h]=[h,c]);const v=f&&typeof f.range=="function"?f:u(c,h,f),w=v?v.range(c,+h+1):[];return g?w.reverse():w}function u(c,h,f){const g=Math.abs(h-c)/f,v=lr(([,,x])=>x).right(a,g);if(v===a.length)return t.every(Mn(c/ln,h/ln,f));if(v===0)return Zt.every(Math.max(Mn(c,h,f),1));const[w,b]=a[g/a[v-1][2]<a[v][2]/g?v-1:v];return w.every(b)}return[l,u]}const[ql,Fl]=Kl(J,mr,tn,it,pr,fr);function cn(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function un(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Ne(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function Wl(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,l=t.months,u=t.shortMonths,c=Be(i),h=Ue(i),f=Be(o),g=Ue(o),v=Be(a),w=Ue(a),b=Be(l),x=Ue(l),R=Be(u),L=Ue(u),k={a:me,A:ye,b:q,B:ao,c:null,d:Gr,e:Gr,f:mc,g:Pc,G:Rc,H:fc,I:pc,j:gc,L:_i,m:yc,M:vc,p:lo,q:co,Q:Jr,s:es,S:bc,u:xc,U:Sc,V:wc,w:Tc,W:Ec,x:null,X:null,y:Cc,Y:kc,Z:Mc,"%":Qr},O={a:uo,A:ho,b:fo,B:po,c:null,d:Xr,e:Xr,f:Dc,g:$c,G:qc,H:Lc,I:Oc,j:Yc,L:Ai,m:_c,M:zc,p:go,q:mo,Q:Jr,s:es,S:Ac,u:Zc,U:Hc,V:Ic,w:Nc,W:Bc,x:null,X:null,y:Uc,Y:Kc,Z:Fc,"%":Qr},D={a:pe,A:E,b:j,B:A,c:te,d:jr,e:jr,f:cc,g:Wr,G:Fr,H:Vr,I:Vr,j:ic,L:lc,m:sc,M:oc,p:Ie,q:rc,Q:hc,s:dc,S:ac,u:Ql,U:Jl,V:ec,w:Xl,W:tc,x:lt,X:ge,y:Wr,Y:Fr,Z:nc,"%":uc};k.x=S(n,k),k.X=S(r,k),k.c=S(e,k),O.x=S(n,O),O.X=S(r,O),O.c=S(e,O);function S(y,T){return function(C){var m=[],Z=-1,M=0,I=y.length,N,se,Tr;for(C instanceof Date||(C=new Date(+C));++Z<I;)y.charCodeAt(Z)===37&&(m.push(y.slice(M,Z)),(se=qr[N=y.charAt(++Z)])!=null?N=y.charAt(++Z):se=N==="e"?" ":"0",(Tr=T[N])&&(N=Tr(C,se)),m.push(N),M=Z+1);return m.push(y.slice(M,Z)),m.join("")}}function Y(y,T){return function(C){var m=Ne(1900,void 0,1),Z=ee(m,y,C+="",0),M,I;if(Z!=C.length)return null;if("Q"in m)return new Date(m.Q);if("s"in m)return new Date(m.s*1e3+("L"in m?m.L:0));if(T&&!("Z"in m)&&(m.Z=0),"p"in m&&(m.H=m.H%12+m.p*12),m.m===void 0&&(m.m="q"in m?m.q:0),"V"in m){if(m.V<1||m.V>53)return null;"w"in m||(m.w=1),"Z"in m?(M=un(Ne(m.y,0,1)),I=M.getUTCDay(),M=I>4||I===0?It.ceil(M):It(M),M=gr.offset(M,(m.V-1)*7),m.y=M.getUTCFullYear(),m.m=M.getUTCMonth(),m.d=M.getUTCDate()+(m.w+6)%7):(M=cn(Ne(m.y,0,1)),I=M.getDay(),M=I>4||I===0?Ht.ceil(M):Ht(M),M=it.offset(M,(m.V-1)*7),m.y=M.getFullYear(),m.m=M.getMonth(),m.d=M.getDate()+(m.w+6)%7)}else("W"in m||"U"in m)&&("w"in m||(m.w="u"in m?m.u%7:"W"in m?1:0),I="Z"in m?un(Ne(m.y,0,1)).getUTCDay():cn(Ne(m.y,0,1)).getDay(),m.m=0,m.d="W"in m?(m.w+6)%7+m.W*7-(I+5)%7:m.w+m.U*7-(I+6)%7);return"Z"in m?(m.H+=m.Z/100|0,m.M+=m.Z%100,un(m)):cn(m)}}function ee(y,T,C,m){for(var Z=0,M=T.length,I=C.length,N,se;Z<M;){if(m>=I)return-1;if(N=T.charCodeAt(Z++),N===37){if(N=T.charAt(Z++),se=D[N in qr?T.charAt(Z++):N],!se||(m=se(y,C,m))<0)return-1}else if(N!=C.charCodeAt(m++))return-1}return m}function Ie(y,T,C){var m=c.exec(T.slice(C));return m?(y.p=h.get(m[0].toLowerCase()),C+m[0].length):-1}function pe(y,T,C){var m=v.exec(T.slice(C));return m?(y.w=w.get(m[0].toLowerCase()),C+m[0].length):-1}function E(y,T,C){var m=f.exec(T.slice(C));return m?(y.w=g.get(m[0].toLowerCase()),C+m[0].length):-1}function j(y,T,C){var m=R.exec(T.slice(C));return m?(y.m=L.get(m[0].toLowerCase()),C+m[0].length):-1}function A(y,T,C){var m=b.exec(T.slice(C));return m?(y.m=x.get(m[0].toLowerCase()),C+m[0].length):-1}function te(y,T,C){return ee(y,e,T,C)}function lt(y,T,C){return ee(y,n,T,C)}function ge(y,T,C){return ee(y,r,T,C)}function me(y){return a[y.getDay()]}function ye(y){return o[y.getDay()]}function q(y){return u[y.getMonth()]}function ao(y){return l[y.getMonth()]}function lo(y){return i[+(y.getHours()>=12)]}function co(y){return 1+~~(y.getMonth()/3)}function uo(y){return a[y.getUTCDay()]}function ho(y){return o[y.getUTCDay()]}function fo(y){return u[y.getUTCMonth()]}function po(y){return l[y.getUTCMonth()]}function go(y){return i[+(y.getUTCHours()>=12)]}function mo(y){return 1+~~(y.getUTCMonth()/3)}return{format:function(y){var T=S(y+="",k);return T.toString=function(){return y},T},parse:function(y){var T=Y(y+="",!1);return T.toString=function(){return y},T},utcFormat:function(y){var T=S(y+="",O);return T.toString=function(){return y},T},utcParse:function(y){var T=Y(y+="",!0);return T.toString=function(){return y},T}}}var qr={"-":"",_:" ",0:"0"},z=/^\s*\d+/,jl=/^%/,Vl=/[\\^$*+?|[\]().{}]/g;function P(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function Gl(t){return t.replace(Vl,"\\$&")}function Be(t){return new RegExp("^(?:"+t.map(Gl).join("|")+")","i")}function Ue(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function Xl(t,e,n){var r=z.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Ql(t,e,n){var r=z.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Jl(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function ec(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function tc(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Fr(t,e,n){var r=z.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Wr(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function nc(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function rc(t,e,n){var r=z.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function sc(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function jr(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function ic(t,e,n){var r=z.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Vr(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function oc(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ac(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function lc(t,e,n){var r=z.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function cc(t,e,n){var r=z.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function uc(t,e,n){var r=jl.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function hc(t,e,n){var r=z.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function dc(t,e,n){var r=z.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Gr(t,e){return P(t.getDate(),e,2)}function fc(t,e){return P(t.getHours(),e,2)}function pc(t,e){return P(t.getHours()%12||12,e,2)}function gc(t,e){return P(1+it.count(J(t),t),e,3)}function _i(t,e){return P(t.getMilliseconds(),e,3)}function mc(t,e){return _i(t,e)+"000"}function yc(t,e){return P(t.getMonth()+1,e,2)}function vc(t,e){return P(t.getMinutes(),e,2)}function bc(t,e){return P(t.getSeconds(),e,2)}function xc(t){var e=t.getDay();return e===0?7:e}function Sc(t,e){return P(tn.count(J(t)-1,t),e,2)}function zi(t){var e=t.getDay();return e>=4||e===0?_e(t):_e.ceil(t)}function wc(t,e){return t=zi(t),P(_e.count(J(t),t)+(J(t).getDay()===4),e,2)}function Tc(t){return t.getDay()}function Ec(t,e){return P(Ht.count(J(t)-1,t),e,2)}function Cc(t,e){return P(t.getFullYear()%100,e,2)}function Pc(t,e){return t=zi(t),P(t.getFullYear()%100,e,2)}function kc(t,e){return P(t.getFullYear()%1e4,e,4)}function Rc(t,e){var n=t.getDay();return t=n>=4||n===0?_e(t):_e.ceil(t),P(t.getFullYear()%1e4,e,4)}function Mc(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+P(e/60|0,"0",2)+P(e%60,"0",2)}function Xr(t,e){return P(t.getUTCDate(),e,2)}function Lc(t,e){return P(t.getUTCHours(),e,2)}function Oc(t,e){return P(t.getUTCHours()%12||12,e,2)}function Yc(t,e){return P(1+gr.count(ce(t),t),e,3)}function Ai(t,e){return P(t.getUTCMilliseconds(),e,3)}function Dc(t,e){return Ai(t,e)+"000"}function _c(t,e){return P(t.getUTCMonth()+1,e,2)}function zc(t,e){return P(t.getUTCMinutes(),e,2)}function Ac(t,e){return P(t.getUTCSeconds(),e,2)}function Zc(t){var e=t.getUTCDay();return e===0?7:e}function Hc(t,e){return P(Di.count(ce(t)-1,t),e,2)}function Zi(t){var e=t.getUTCDay();return e>=4||e===0?ze(t):ze.ceil(t)}function Ic(t,e){return t=Zi(t),P(ze.count(ce(t),t)+(ce(t).getUTCDay()===4),e,2)}function Nc(t){return t.getUTCDay()}function Bc(t,e){return P(It.count(ce(t)-1,t),e,2)}function Uc(t,e){return P(t.getUTCFullYear()%100,e,2)}function $c(t,e){return t=Zi(t),P(t.getUTCFullYear()%100,e,2)}function Kc(t,e){return P(t.getUTCFullYear()%1e4,e,4)}function qc(t,e){var n=t.getUTCDay();return t=n>=4||n===0?ze(t):ze.ceil(t),P(t.getUTCFullYear()%1e4,e,4)}function Fc(){return"+0000"}function Qr(){return"%"}function Jr(t){return+t}function es(t){return Math.floor(+t/1e3)}var ve,Hi;Wc({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Wc(t){return ve=Wl(t),Hi=ve.format,ve.parse,ve.utcFormat,ve.utcParse,ve}function jc(t){return new Date(t)}function Vc(t){return t instanceof Date?+t:+new Date(+t)}function Ii(t,e,n,r,i,o,a,l,u,c){var h=Ri(),f=h.invert,g=h.domain,v=c(".%L"),w=c(":%S"),b=c("%I:%M"),x=c("%I %p"),R=c("%a %d"),L=c("%b %d"),k=c("%B"),O=c("%Y");function D(S){return(u(S)<S?v:l(S)<S?w:a(S)<S?b:o(S)<S?x:r(S)<S?i(S)<S?R:L:n(S)<S?k:O)(S)}return h.invert=function(S){return new Date(f(S))},h.domain=function(S){return arguments.length?g(Array.from(S,Vc)):g().map(jc)},h.ticks=function(S){var Y=g();return t(Y[0],Y[Y.length-1],S??10)},h.tickFormat=function(S,Y){return Y==null?D:c(Y)},h.nice=function(S){var Y=g();return(!S||typeof S.range!="function")&&(S=e(Y[0],Y[Y.length-1],S??10)),S?g(Ol(Y,S)):h},h.copy=function(){return ki(h,Ii(t,e,n,r,i,o,a,l,u,c))},h}function Gc(){return wi.apply(Ii(ql,Fl,J,mr,tn,it,pr,fr,xe,Hi).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}const ts=[s.a.NANOSECOND,s.a.nanoseconds(2),s.a.nanoseconds(5),s.a.nanoseconds(10),s.a.nanoseconds(20),s.a.nanoseconds(50),s.a.nanoseconds(100),s.a.nanoseconds(200),s.a.nanoseconds(500),s.a.MICROSECOND,s.a.microseconds(2),s.a.microseconds(5),s.a.microseconds(10),s.a.microseconds(20),s.a.microseconds(50),s.a.microseconds(100),s.a.microseconds(200),s.a.microseconds(500),s.a.MILLISECOND,s.a.milliseconds(2),s.a.milliseconds(5),s.a.milliseconds(10),s.a.milliseconds(20),s.a.milliseconds(50),s.a.milliseconds(100),s.a.milliseconds(200),s.a.milliseconds(500),s.a.SECOND];class Xc{_domain;_range;_span;constructor(){this._domain=[new s.n(0n),new s.n(1n)],this._range=[0,1],this._span=this._domain[1].span(this._domain[0])}domain(e){return e===void 0?this._domain:(this._domain=[new s.n(e[0]),new s.n(e[1])],this._span=this._domain[1].span(this._domain[0]),this)}range(e){return e===void 0?this._range:(this._range=e,this)}scale(e){const r=new s.n(e).valueOf(),i=this._domain[0].valueOf(),o=this._domain[1].valueOf()-i,a=this._range[1]-this._range[0];return Number(r-i)/Number(o)*a+this._range[0]}ticks(e){const n=this.calculateOptimalStep(e).valueOf(),r=this._domain[0].valueOf(),i=this._domain[1].valueOf(),o=(r+n-1n)/n*n,a=Number((i-o)/n);return Array.from({length:a+1},(l,u)=>{const c=o+BigInt(u)*n;return new s.n(c)}).filter(l=>l.afterEq(this._domain[0])&&l.beforeEq(this._domain[1]))}calculateOptimalStep(e){const n=this._span.valueOf()/BigInt(Math.ceil(e));let r=ts[0];for(const i of ts){if(i.valueOf()>n)break;r=i}return r}formatTick(e){return this._span.lessThan(s.a.microseconds(50))?`${e.remainder(s.a.MILLISECOND).microseconds.toString()}µs`:`${e.remainder(s.a.SECOND).milliseconds.toString()}ms`}}const Qc=()=>new Xc,yr=d.z.enum(["linear","time"]),vr=d.z.object({tickSpacing:d.z.number().default(75),type:yr.optional().default("linear")}),_n=t=>{const e=vr.parse(t);return tu[e.type](e)};class Jc{props;prevScaleSize;prevDomain;currTicks;normalScale;preciseScale;constructor(e){this.props=e,this.normalScale=Gc(),this.preciseScale=Qc(),this.prevScaleSize=0,this.prevDomain=new s.w(new s.n(0),new s.n(0)),this.currTicks=[]}create({decimalToDataScale:e,size:n}){const r=new s.w(new s.n(e.pos(0)),new s.n(e.pos(1)));if(this.prevDomain.equals(r)&&this.prevScaleSize===n)return this.currTicks;if(this.prevDomain=r,this.prevScaleSize!==n){const i=[0,n];this.preciseScale.range(i),this.normalScale.range(i),this.prevScaleSize=n}if(r.span.milliseconds<5){this.preciseScale.domain([r.start,r.end]);const i=zn(n,this.props.tickSpacing)/2,o=this.preciseScale.ticks(i);this.currTicks=o.map(a=>({label:this.preciseScale.formatTick(a),position:this.preciseScale.scale(a)}))}else{this.normalScale.domain([r.start.date(),r.end.date()]);const i=this.normalScale.ticks(zn(n,this.props.tickSpacing));this.currTicks=i.map(o=>({label:this.normalTickLabel(o),position:this.normalScale(o)}))}return this.currTicks}normalTickLabel(e){let n=`:${e.getSeconds()}`;const r=e.getMilliseconds();if(r!==0){const i=Math.round(e.getMilliseconds()).toString().padStart(3,"0").replace(/0+$/,"");n+=`.${i}`}return e.getSeconds()===0&&r===0&&(n=`${e.getHours()}:${e.getMinutes().toString().padStart(2,"0")}`),n}}class eu{props;prevDomain;prevScaleSize;currTicks;d3Scale;constructor(e){this.props=e,this.prevDomain=s.W.construct(0,0),this.prevScaleSize=0,this.currTicks=[],this.d3Scale=Yi()}create({decimalToDataScale:e,size:n}){const r={lower:e.pos(0),upper:e.pos(1)};if(s.W.equals(this.prevDomain,r)&&this.prevScaleSize===n)return this.currTicks;s.W.equals(this.prevDomain,r)||(this.d3Scale=this.d3Scale.domain([r.lower,r.upper])),this.prevScaleSize!==n&&(this.d3Scale=this.d3Scale.range([0,n])),this.prevDomain=r,this.prevScaleSize=n;const i=zn(n,this.props.tickSpacing),o=this.d3Scale.ticks(i);return this.currTicks=o.map(a=>({label:this.tickLabel(a),position:this.d3Scale(a)})),this.currTicks}tickLabel(e){return e.toString()}}const zn=(t,e)=>{const n=Math.floor(t/e);return n>0?n:1},tu={linear:t=>new eu(t),time:t=>new Jc(t)},br=vr.extend({color:s.ir.colorZ,type:yr.optional().default("linear"),font:d.z.string(),showGrid:d.z.boolean().optional().default(!0),location:s.K$1.outer,gridColor:s.ir.colorZ}),$=5,Ve=6,ot={useAtlas:!0},nu={bottom:(t,e)=>new Bi(t,e),top:(t,e)=>new Ui(t,e),left:(t,e)=>new ru(t,e),right:(t,e)=>new $i(t,e)},Ni=(t,e,n)=>nu[t](e,n);class fe{renderCtx;state;tickFactory;constructor(e,n){this.renderCtx=e,this.state=n,this.tickFactory=_n(this.state)}setState(e){this.state=p.prettyParse(br,e),this.tickFactory=_n(e)}drawLine(e,n){const{lower2d:r}=this.renderCtx;r.moveTo(...s.K.couple(e)),r.lineTo(...s.K.couple(n))}drawTicks(e,n){let r=s._.ZERO;return e.forEach(i=>{const o=this.renderCtx.lower2d.textDimensions(i.label,ot);r=s._.max([r,o]),n(o,i)}),r}static START_BOUND=s.W.construct(-1,1);maybeDrawGrid(e,n,r){const{showGrid:i,gridColor:o}=this.state;if(i){const a=fe.START_BOUND,l=s.W.construct(e-1,e+1),{lower2d:u}=this.renderCtx;u.beginPath(),u.strokeStyle=s.ir.hex(o),n.forEach(c=>{s.W.contains(a,c.position)||s.W.contains(l,c.position)||this.drawLine(...r(c))}),u.stroke()}}setColor(e){const n=s.ir.hex(e);this.renderCtx.lower2d.strokeStyle=n,this.renderCtx.lower2d.fillStyle=n,this.renderCtx.lower2d.font=this.state.font}}class Bi extends fe{render(e){const{lower2d:n}=this.renderCtx,{plot:r,position:i}=e,{width:o,height:a}=s.Ho.dims(r),l=this.tickFactory.create({...e,size:o});n.beginPath(),this.setColor(this.state.color),this.drawLine(i,s.K.translate(i,"x",o));const u=this.drawTicks(l,(c,h)=>{this.drawLine(s.K.translateX(i,h.position),s.K.translate(i,{x:h.position,y:$})),n.fillText(h.label,i.x+h.position-c.width/2,i.y+$+c.height+Ve,void 0,ot)});return n.stroke(),this.maybeDrawGrid(o,l,c=>[s.K.translate(i,"x",c.position),s.K.translate(i,{x:c.position,y:-a})]),{size:u.height+$+Ve}}}class Ui extends fe{render(e){const{lower2d:n}=this.renderCtx,{plot:r}=e,{width:i,height:o}=s.Ho.dims(r),a=s.K.translate(e.position,"y",e.size),l=this.tickFactory.create({...e,size:i});n.beginPath(),this.setColor(this.state.color),this.drawLine(a,s.K.translate(a,"x",i));const u=this.drawTicks(l,(c,h)=>{this.drawLine(s.K.translateX(a,h.position),s.K.translate(a,{x:h.position,y:-$})),n.fillText(h.label,a.x+h.position-c.width/2,a.y-$-c.height-Ve,void 0,ot)});return n.stroke(),this.maybeDrawGrid(i,l,c=>[s.K.translate(a,"x",c.position),s.K.translate(a,{x:c.position,y:o})]),{size:u.height+$}}}class ru extends fe{render(e){const{lower2d:n}=this.renderCtx,{plot:r,position:i}=e,{height:o,width:a}=s.Ho.dims(r),l=s.K.translate(i,"x",e.size),u=this.tickFactory.create({...e,size:o});n.beginPath(),this.setColor(this.state.color),this.drawLine(l,s.K.translate(l,"y",o));const c=this.drawTicks(u,(h,f)=>{this.drawLine(s.K.translateY(l,f.position),s.K.translate(l,{x:-$,y:f.position})),n.fillText(f.label,l.x-h.width-$*2,l.y+f.position+h.height/2,void 0,ot)});return n.stroke(),this.maybeDrawGrid(o,u,h=>[s.K.translate(l,"y",h.position),s.K.translate(l,{x:a,y:h.position})]),{size:c.width+$*2}}}class $i extends fe{render(e){const{lower2d:n}=this.renderCtx,{plot:r,position:i}=e,{height:o,width:a}=s.Ho.dims(r),l=this.tickFactory.create({...e,size:o});n.beginPath(),this.setColor(this.state.color),this.drawLine(i,s.K.translateY(i,o));const u=this.drawTicks(l,(c,h)=>{this.drawLine(s.K.translateY(i,h.position),s.K.translate(i,{x:$,y:h.position})),n.fillText(h.label,i.x+$+Ve,i.y+h.position+c.height/2,void 0,ot)});return n.stroke(),this.maybeDrawGrid(o,l,c=>[s.K.translateY(i,c.position),s.K.translate(i,{x:-a,y:c.position})]),{size:u.width+$+Ve}}}const at=br.extend({axisKey:d.z.string().optional(),bounds:s.W.bounds.optional(),autoBounds:d.z.object({lower:d.z.boolean().optional().default(!0),upper:d.z.boolean().optional().default(!0)}).or(d.z.boolean().optional().default(!0)),autoBoundPadding:d.z.number().optional(),autoBoundUpdateInterval:s.a.z.optional().default(s.a.seconds(10)),size:d.z.number().optional().default(0),label:d.z.string().optional().default(""),labelSize:d.z.number().optional().default(0)}).partial({color:!0,font:!0,gridColor:!0}),su=2,iu=7,Ki=(t,e)=>s.W.contains({lower:t-iu,upper:t+su},e),ou=s.W.DECIMAL,ns=s.n.now(),au={lower:Number(ns.valueOf()),upper:Number(ns.add(s.a.HOUR).valueOf())},qi=t=>t==="linear"?ou:au,lu=(t,e=.1,n)=>{const r=s.W.max(t.filter(s.W.isFinite));if(!s.W.isFinite(r))return qi(n);const{lower:i,upper:o}=r;if(o===i)return{lower:i-1,upper:o+1};const a=(o-i)*e;return{lower:i-a,upper:o+a}},cu=.01,uu=.1;class Fi extends p.Composite{afterUpdate(e){const{internal:n}=this,{location:r,autoBoundUpdateInterval:i}=this.state;n.render=p.Context.use(e);const o=p.use(e),a=s.g.construct(r);this.state.autoBoundPadding??=a==="x"?uu:cu,n.core=Ni(r,n.render,{color:o.colors.gray.l10,font:Ke.fontString(o,{level:"small",code:!0}),gridColor:o.colors.gray.l1,...this.state}),X(e,"layout"),n.updateBounds??=p.r(l=>this.setState(u=>({...u,bounds:l})),i.milliseconds)}afterDelete(e){X(e,"layout")}renderAxis(e,n){if(!e.canvases.includes("lower2d"))return;const{core:r}=this.internal,{grid:i,container:o}=e,a=Ya(`${this.type}-${this.key}`,i,o),l={...e,position:a,decimalToDataScale:n,size:this.state.size+this.state.labelSize},{size:u}=r.render(l);Ki(this.state.size,u)||this.setState(c=>({...c,size:u}))}iBounds(e,n){if(e&&this.internal.boundSnapshot!=null)return[this.internal.boundSnapshot,null];const{lower:r,upper:i}=Wi(this.state.autoBounds);if(!r&&!i&&this.state.bounds!=null)return this.internal.boundSnapshot=this.state.bounds,[this.state.bounds,null];const o=c=>({upper:i||this.state.bounds==null?c.upper:this.state.bounds.upper,lower:r||this.state.bounds==null?c.lower:this.state.bounds.lower});let a,l=null;try{const c=n();a=lu(c,this.state.autoBoundPadding,this.state.type)}catch(c){a=qi(this.state.type),l=c}const u=o(a);return this.internal.boundSnapshot=u,(this.state.bounds==null||r&&this.state.bounds.lower!==u.lower||i&&this.state.bounds.upper!==u.upper)&&this.internal.updateBounds?.(u),[u,l]}dataToDecimalScale(e,n,r){const[i,o]=this.iBounds(e,n),a=s.g.swap(s.g.construct(this.state.location));return[s.C.Scale.scale(i).scale(1).translate(-s.Ho.root(r)[a]).magnify(1/s.Ho.dim(r,a)),o]}}const Wi=t=>typeof t=="boolean"?{lower:t,upper:t}:{lower:t?.lower??!0,upper:t?.upper??!0};class He{canvas;theme;constructor(e,n){this.canvas=e,this.theme=n}rule({direction:e,region:n,position:r,...i}){return e==="x"?this.line({start:s.K.construct(s.Ho.left(n),r),end:s.K.construct(s.Ho.right(n),r),...i}):this.line({start:s.K.construct(r,s.Ho.top(n)),end:s.K.construct(r,s.Ho.bottom(n)),...i})}line({stroke:e,lineWidth:n,lineDash:r,start:i,end:o}){const a=this.canvas;a.strokeStyle=s.ir.hex(e),a.lineWidth=n,a.setLineDash([r]),a.beginPath(),a.moveTo(...s.K.couple(i)),a.lineTo(...s.K.couple(o)),a.stroke()}circle({fill:e,radius:n,position:r}){const i=this.canvas;i.fillStyle=s.ir.hex(e),i.beginPath(),i.arc(...s.K.couple(r),n,0,2*Math.PI),i.fill()}resolveColor(e,n){return e==null?n==null?this.theme.colors.text:this.resolveColor(n):typeof e=="function"?e(this.theme):s.ir.construct(e)}border({region:e,color:n,width:r,radius:i,location:o}){const a=this.canvas;a.strokeStyle=s.ir.hex(this.resolveColor(n,this.theme.colors.border)),a.lineWidth=r??this.theme.sizes.border.width,i??=this.theme.sizes.border.radius,o==null||o===!0?i>0?(a.roundRect(...s.K.couple(s.Ho.topLeft(e)),...s.K.couple(s.Ho.dims(e)),i),a.stroke()):(a.rect(...s.K.couple(s.Ho.topLeft(e)),...s.K.couple(s.Ho.dims(e))),a.stroke()):p.t.toArray(o).forEach(l=>{const[u,c]=s.Ho.edgePoints(e,l);a.beginPath(),a.moveTo(...s.K.couple(u)),a.lineTo(...s.K.couple(c)),a.stroke()})}container({region:e,bordered:n=!0,rounded:r=!0,borderColor:i,borderRadius:o,borderWidth:a,backgroundColor:l}){o??=this.theme.sizes.border.radius,a??=1;const u=this.canvas;u.fillStyle=s.ir.hex(this.resolveColor(l,this.theme.colors.gray.l1)),u.strokeStyle=s.ir.hex(this.resolveColor(i,this.theme.colors.border)),u.setLineDash([]),u.lineWidth=1,u.beginPath(),r?u.roundRect(...s.K.couple(s.Ho.topLeft(e)),...s.K.couple(s.Ho.dims(e)),o):u.rect(...s.K.couple(s.Ho.topLeft(e)),...s.K.couple(s.Ho.dims(e))),u.fill(),n&&this.border({region:e,color:i,radius:o,width:a,location:n})}textContainer(e){const[n,r]=this.spacedTextDrawF(e);n.width+=12,n.height+=12;const{root:i=s.K$1.TOP_LEFT,offset:o=s.K.ZERO}=e,a={...e.position};i.x==="right"?a.x-=n.width+o.x:a.x+=o.x,i.y==="bottom"?a.y-=n.height+o.y:a.y+=o.y,this.container({region:s.Ho.construct(a,n.width,n.height),...e}),this.canvas.filter="none",r(s.K.translate(a,[6,6]))}spacedTextDrawF({text:e,direction:n,spacing:r=1,level:i="p"}){const o=Ke.fontString(this.theme,{level:i}),a=e.map(c=>p.dimensions(c,o,this.canvas)),l=this.theme.sizes.base*r,u=Math.max(...a.map(c=>c[s.g.dimension(n)]))+l;return[{[s.g.dimension(s.g.swap(n))]:Math.max(...a.map(c=>c[s.g.dimension(s.g.swap(n))])),[s.g.dimension(n)]:u*e.length-l},c=>{const h=Ke.fontString(this.theme,{level:i});this.canvas.font=h,this.canvas.fillStyle=s.ir.hex(this.theme.colors.text),this.canvas.textBaseline="top",e.forEach((f,g)=>{this.canvas.fillText(f,c.x,c.y+u*g)})}]}list({length:e,itemHeight:n,width:r,spacing:i=0,position:o,draw:a,root:l=s.K$1.TOP_LEFT,offset:u=s.K.ZERO,padding:c=s.K.ZERO}){const h=e*n+c.y*2+i*(e-1),f=r+c.x*2,g={...o};l.x==="right"?g.x-=r+u.x*2:g.x+=u.x,l.y==="top"?g.y-=h+u.y*2:g.y+=u.y,this.container({region:s.Ho.construct(g,{width:f,height:h}),backgroundColor:v=>v.colors.gray.l1});for(let v=0;v<e;v++){const w=s.Ho.construct(s.K.construct(g.x+c.x,g.y+v*n+c.y+i*v),r,n);a(v,w)}}drawTextInCenter({box:e,text:n,level:r}){const i=p.dimensions(n,this.canvas.font,this.canvas),o=s.Ho.positionInCenter(s.Ho.construct(s.K.ZERO,i),e);return this.text({text:n,position:s.Ho.topLeft(o),level:r})}text({text:e,position:n,level:r="p",weight:i,shade:o,maxWidth:a,code:l,justify:u="left",align:c="top",color:h}){this.canvas.font=Ke.fontString(this.theme,{level:r,weight:i,code:l}),h!=null?this.canvas.fillStyle=s.ir.hex(this.resolveColor(h)):o==null?this.canvas.fillStyle=s.ir.hex(this.theme.colors.text):this.canvas.fillStyle=s.ir.hex(this.theme.colors.gray[`l${o}`]),this.canvas.textAlign=u,this.canvas.textBaseline=c;let f;a!=null&&(f=this.canvas.scissor(s.Ho.construct(n,a,1e3))),this.canvas.fillText(e,n.x,n.y),f?.()}}const xr=d.z.object({position:d.z.number().optional(),pixelPosition:d.z.number().optional(),dragging:d.z.boolean(),lineWidth:d.z.number().optional().default(1),lineDash:d.z.number().optional().default(20),color:s.ir.colorZ}),hu=3;class Ge extends p.Leaf{static TYPE="Rule";schema=xr;lastUpdateRef=null;afterUpdate(e){this.internal.renderCtx=p.Context.use(e);const n=p.use(e);this.internal.draw=new He(this.internal.renderCtx.upper2d,n),X(e,"tool")}afterDelete(e){X(e,"tool")}updatePositions({decimalToDataScale:e,plot:n}){const r=this.state.dragging,i=this.prevState.dragging&&!r;if((r||i)&&this.state.pixelPosition!=null){if(this.lastUpdateRef??=this.state.pixelPosition,Math.abs(this.state.pixelPosition-this.lastUpdateRef)<hu&&!i)return this.state.pixelPosition;this.lastUpdateRef=this.state.pixelPosition;const l=e.pos(this.state.pixelPosition/s.Ho.height(n));return this.setState(u=>({...u,position:l})),this.state.pixelPosition}if(this.state.position==null){const a=e.pos(.5);this.setState(l=>({...l,position:a}))}const o=e.reverse().pos(this.state.position)*s.Ho.height(n);if(!isNaN(o)){if(this.state.pixelPosition!=null&&Math.abs(o-this.state.pixelPosition)<1)return this.state.pixelPosition;this.setState(a=>({...a,pixelPosition:o}))}return o}render(e){if(this.deleted)return;const{renderCtx:n}=this.internal,{location:r,plot:i}=e,o=s.K$1.direction(r),{upper2d:a}=n,l=this.internal.draw,u=this.updatePositions(e)+s.Ho.top(e.plot);l.rule({stroke:this.state.color,lineWidth:this.state.lineWidth,lineDash:this.state.lineDash,direction:o,region:i,position:u}),a.fillStyle=s.ir.hex(this.state.color),a.lineJoin="round",a.lineWidth=3.5,a.lineCap="round",a.beginPath();const c=4;if(r==="left"){const h=s.Ho.left(i)-1;a.moveTo(h,u),a.lineTo(h-c,u-c),a.lineTo(h-c,u+c)}else r==="right"&&(a.moveTo(s.Ho.right(i),u),a.lineTo(s.Ho.right(i)+c,u-c),a.lineTo(s.Ho.right(i)+c,u+c));a.closePath(),a.stroke()}}const ji={[Ge.TYPE]:Ge},du=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:ji,Rule:Ge,ruleStateZ:xr},Symbol.toStringTag,{value:"Module"})),fu=at.extend({location:s.K$1.x.optional().default("left")}),rs=2,pu=t=>s.Ho.signedWidth(t)<rs||s.Ho.signedHeight(t)<rs;class Nt extends Fi{static TYPE="YAxis";schema=at;xBounds(){return s.W.max(this.lines.map(e=>e.xBounds()).filter(e=>s.W.isFinite(e)))}bounds(e){const[n,r]=this.iBounds(e,this.dataBounds.bind(this));if(r!=null)throw r;return n}render(e){if(this.deleted)return;const[n,r]=this.dataToDecimalScale(e.hold,this.dataBounds.bind(this),e.viewport),i=n.invert().reverse();if(this.renderAxis(e,i),this.renderLines(e,n),this.renderRules(e,i),r!=null)throw r}renderLines({xDataToDecimalScale:e,plot:n,canvases:r,exposure:i},o){if(!r.includes("gl")||pu(n))return;const a={region:n,dataToDecimalScale:new s.C.XY(e,o),exposure:i};this.lines.forEach(l=>l.render(a))}renderRules({container:e,plot:n,canvases:r},i){if(!r.includes("upper2d"))return;const{location:o}=this.state,{render:a}=this.internal,l=s.Ho.construct(s.Ho.left(e),s.Ho.top(n),s.Ho.width(e),s.Ho.height(n)),u=a.scissor(l,s.K.ZERO,["upper2d"]),c={container:e,plot:n,decimalToDataScale:i,location:o};this.rules.map(h=>h.render(c)),u()}findByXValue({xDataToDecimalScale:e,plot:n,viewport:r,hold:i,exposure:o},a){const[l,u]=this.dataToDecimalScale(i,this.dataBounds.bind(this),r);if(u!=null)throw u;const c=new s.C.XY(e,l),h={region:n,dataToDecimalScale:c,exposure:o};return this.lines.map(f=>({...f.findByXValue(h,a),units:this.state.label}))}dataBounds(){return this.lines.map(e=>e.yBounds())}get lines(){return this.childrenOfType(Mt.TYPE)}get rules(){return this.childrenOfType(Ge.TYPE)}}const Vi=d.z.object({start:s.n.z,end:s.n.z});class An extends p.Leaf{static TYPE="range-annotation";schema=Vi;afterUpdate(e){this.internal.render=p.Context.use(e),this.internal.draw=new He(this.internal.render.upper2d,p.use(e))}}const gu=p.Km.payloadZ.extend({viewport:s.W.bounds}),Gi=d.z.object({cursor:s.K.xy.or(d.z.null()),hovered:gu.or(d.z.null()),count:d.z.number()});let Bt=class extends p.Leaf{static TYPE="range-provider";schema=Gi;fetchedInitial=s.w.ZERO;afterUpdate(e){const{internal:n}=this;n.render=p.Context.use(e),n.draw=new He(n.render.upper2d,p.use(e)),n.requestRender=Ft(e),n.runAsync=p.useErrorHandler(e),n.ranges??=new Map;const r=Ze(e);n.requestRender("tool"),r!=null&&(n.client=r,n.removeListener=Uu(e,[{channel:p.Km.SET_CHANNEL_NAME,onChange:dn(p.Km.payloadZ,async({changed:i})=>{n.client!=null&&(s.ir.isCrude(i.color)&&n.ranges.set(i.key,n.client.ranges.sugarOne(i)),this.setState(o=>({...o,count:n.ranges.size})),n.requestRender("tool"))})},{channel:p.Km.DELETE_CHANNEL_NAME,onChange:dn(p.Km.keyZ,async({changed:i})=>{n.ranges.delete(i),this.setState(o=>({...o,count:n.ranges.size})),n.requestRender("tool")})}],n.removeListener))}fetchInitial(e){const{internal:n}=this,{client:r,runAsync:i}=n;r==null||this.fetchedInitial.equals(e,s.a.minutes(1))||(this.fetchedInitial=e,i(async()=>{(await r.ranges.retrieve(e)).forEach(a=>{s.ir.isCrude(a.color)&&n.ranges.set(a.key,a)}),this.setState(a=>({...a,count:n.ranges.size}))},"failed to fetch initial ranges"))}render(e){const{dataToDecimalScale:n,region:r,viewport:i,timeRange:o}=e;this.fetchInitial(o);const{draw:a,ranges:l}=this.internal,u=n.scale(s.Ho.xBounds(r)),c=this.state.cursor==null?null:this.state.cursor.x;let h=null;const f=a.canvas.scissor(s.Ho.construct({x:s.Ho.left(r),y:s.Ho.top(r)-35},{x:s.Ho.right(r),y:s.Ho.bottom(r)}));l.forEach(g=>{const v=s.ir.colorZ.safeParse(g.color);if(!v.success)return;const w=v.data;let b=u.pos(Number(g.timeRange.start.valueOf()));const x=u.pos(Number(g.timeRange.end.valueOf()));if(x<s.Ho.left(r)||b>s.Ho.right(r))return;b=s.R(b,s.Ho.left(r)-2,s.Ho.right(r)-1);let R=!1;c!=null&&(R=s.W.contains({lower:b,upper:x},c)),R&&(h={key:g.key,parent:g.parent,name:g.name,color:g.color,labels:g.labels,timeRange:g.timeRange,viewport:{lower:n.scale(s.Ho.xBounds(i)).pos(Number(g.timeRange.start.valueOf())),upper:n.scale(s.Ho.xBounds(i)).pos(Number(g.timeRange.end.valueOf()))}}),a.container({region:s.Ho.construct({x:b,y:s.Ho.top(r)-1},{x,y:s.Ho.bottom(r)-1}),backgroundColor:s.ir.setAlpha(w,.2),bordered:!1});const L=s.Ho.construct({x:b+1,y:s.Ho.top(r)-34},{x:x-1,y:s.Ho.top(r)-12});a.container({region:L,backgroundColor:s.Ho.width(L)<20?s.ir.setAlpha(w,.4):k=>R?k.colors.gray.l2:k.colors.gray.l0,bordered:!0,borderWidth:1,borderRadius:2,borderColor:s.ir.setAlpha(w,.8)}),a.text({text:g.name,position:{x:b+8,y:s.Ho.top(r)-30},level:"small",shade:10,weight:500,maxWidth:x-b-16})}),f(),h!=null?this.setState(g=>({...g,hovered:h})):this.state.hovered&&this.setState(g=>({...g,hovered:null}))}};const mu={[An.TYPE]:An,[Bt.TYPE]:Bt},yu=at;class Ut extends Fi{static TYPE="XAxis";schema=at;render(e){if(this.deleted)return;const[n,r]=this.dataToDecimalScale(e.hold,this.dataBounds.bind(this),e.viewport);if(this.renderAxis(e,n.reverse()),this.renderYAxes(e,n),this.renderRangeAnnotations(e,n),r!=null)throw r}findByXDecimal(e,n){const[r,i]=this.dataToDecimalScale(e.hold,this.dataBounds.bind(this),e.viewport);if(i!=null)throw i;return this.findByXValue(e,r.reverse().pos(n))}findByXValue(e,n){const[r,i]=this.dataToDecimalScale(e.hold,this.dataBounds.bind(this),e.viewport);if(i!=null)throw i;const o={...e,xDataToDecimalScale:r};return this.yAxes.map(a=>a.findByXValue(o,n)).flat()}renderYAxes(e,n){const r={...e,xDataToDecimalScale:n};this.yAxes.forEach(i=>i.render(r))}get yAxes(){return this.childrenOfType(Nt.TYPE)}get rangeAnnotations(){return this.childrenOfType(Bt.TYPE)}bounds(e){const[n,r]=this.iBounds(e,this.dataBounds.bind(this));if(r!=null)throw r;return n}renderRangeAnnotations(e,n){const r=this.bounds(e.hold);this.rangeAnnotations.forEach(i=>i.render({dataToDecimalScale:n,region:e.plot,viewport:e.viewport,timeRange:new s.w(r.lower,r.upper)}))}dataBounds(){return this.yAxes.map(e=>e.xBounds())}}const vu=s.K.construct(12),bu=3,xu=14,Su=s.K.construct(6),Sr=d.z.object({position:s.K.xy.or(d.z.null()),textColor:s.ir.colorZ.optional().default(s.ir.ZERO),backgroundColor:s.ir.colorZ.optional().default(s.ir.ZERO),borderColor:s.ir.colorZ.optional().default(s.ir.ZERO),ruleColor:s.ir.colorZ.optional().default(s.ir.ZERO),ruleStrokeWidth:d.z.number().optional().default(1),ruleStrokeDash:d.z.number().default(0)});class Xe extends p.Leaf{static TYPE="tooltip";schema=Sr;afterUpdate(e){const n=p.use(e);s.ir.isZero(this.state.textColor)&&(this.state.textColor=n.colors.text),s.ir.isZero(this.state.backgroundColor)&&(this.state.backgroundColor=n.colors.gray.l1),s.ir.isZero(this.state.borderColor)&&(this.state.borderColor=n.colors.border),s.ir.isZero(this.state.ruleColor)&&(this.state.ruleColor=n.colors.gray.l7),this.internal.dotColor=n.colors.text,this.internal.dotColorContrast=n.colors.textInverted,this.internal.render=p.Context.use(e),this.internal.draw=new He(this.internal.render.upper2d,n),X(e,"tool")}afterDelete(e){X(e,"tool")}render(e){if(this.deleted||this.state.position==null)return;const{region:n}=e,r=s.C.XY.scale(s.Ho.DECIMAL).scale(n),i=s.C.XY.scale(n).scale(s.Ho.DECIMAL),o=e.findByXDecimal(i.x.pos(this.state.position.x)),a=o.filter(b=>s.K.isFinite(b.value)),{draw:l}=this.internal,u=a.reduce((b,x)=>b+x.position.x,0)/a.length,c=new s.n(a.reduce((b,x)=>b+x.value.x,0)/a.length),h=r.x.pos(u);if(!s.W.contains(s.Ho.xBounds(n),h))return;l.rule({stroke:this.state.ruleColor,lineWidth:this.state.ruleStrokeWidth,lineDash:this.state.ruleStrokeDash,direction:"y",region:n,position:h}),a.forEach(b=>{const x=r.pos(b.position);l.circle({fill:s.ir.setAlpha(b.color,.5),radius:8,position:x}),l.circle({fill:s.ir.setAlpha(b.color,.8),radius:5,position:x}),l.circle({fill:s.ir.pickByContrast(b.color,this.internal.dotColor,this.internal.dotColorContrast),radius:2,position:x})});const f=i.pos(this.state.position),g={...s.K$1.TOP_LEFT};f.x>.6&&(g.x="right"),f.y>.6&&(g.y="bottom");let v=o.reduce((b,x)=>Math.max(b,x.label?.length??0),0);const w=c.fString("preciseDate","local").length;w>v&&(v=w),l.list({root:g,offset:vu,length:a.length+1,padding:Su,itemHeight:xu,spacing:bu,width:v*7+48,position:this.state.position,draw:(b,x)=>{let R="",L="",k=this.state.textColor;if(b===0)R="Time",L=c.fString("preciseDate","local");else{const O=a[b-1];R=O.label??"",L=s.nr.roundBySpan(O.value.y,O.bounds).toString(),k=O.color}l.text({position:s.Ho.topLeft(x),text:R,level:"small",weight:500,color:k}),l.text({position:s.K.translateY(s.Ho.topRight(x),-1),text:L,level:"small",justify:"right",code:!0,shade:10})}})}}const Xi={[Xe.TYPE]:Xe},wu=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:Xi,Tooltip:Xe,tooltipStateZ:Sr},Symbol.toStringTag,{value:"Module"})),wr=d.z.object({one:s.K.xy.nullable(),two:s.K.xy.nullable(),hover:s.K.xy.nullable(),color:d.z.union([s.ir.colorZ,d.z.object({verticalLine:s.ir.colorZ.optional().default(s.ir.ZERO),horizontalLine:s.ir.colorZ.optional().default(s.ir.ZERO),obliqueLine:s.ir.colorZ.optional().default(s.ir.ZERO)})]).optional().default(s.ir.ZERO),strokeWidth:d.z.number().optional().default(1),strokeDash:d.z.number().optional().default(2)});class Qe extends p.Leaf{static TYPE="measure";schema=wr;afterUpdate(e){const n=p.Context.use(e);this.internal.theme=p.use(e),this.internal.renderCtx=n,this.internal.draw=new He(n.upper2d,this.internal.theme),X(e,"tool")}afterDelete(e){X(e,"layout")}get verticalLineColor(){return s.ir.isColor(this.state.color)?s.ir.isZero(this.state.color)?this.internal.theme.colors.gray.l8:this.state.color:s.ir.isZero(this.state.color.verticalLine)?this.internal.theme.colors.gray.l8:this.state.color.verticalLine}get horizontalLineColor(){return s.ir.isColor(this.state.color)?s.ir.isZero(this.state.color)?this.internal.theme.colors.gray.l8:this.state.color:s.ir.isZero(this.state.color.horizontalLine)?this.internal.theme.colors.gray.l8:this.state.color.horizontalLine}get obliqueLineColor(){return s.ir.isColor(this.state.color)?s.ir.isZero(this.state.color)?this.internal.theme.colors.gray.l8:this.state.color:s.ir.isZero(this.state.color.obliqueLine)?this.internal.theme.colors.gray.l8:this.state.color.obliqueLine}find(e){const{one:n,two:r}=this.state;if(n==null||r==null)return null;const{one:i,two:o}=this.prevState,{dataOne:a,dataTwo:l}=this.internal;if(i!=null&&s.K.equals(n,i)&&o!=null&&s.K.equals(r,o)&&a!=null&&l!=null){const[b,x]=[e.findByXValue(a.x),e.findByXValue(l.x)];return b.length===0||x.length===0?null:[b.sort((R,L)=>s.K.distance(a,R.value)-s.K.distance(a,L.value))[0],x.sort((R,L)=>s.K.distance(l,R.value)-s.K.distance(l,L.value))[0]]}const u=s.C.XY.scale(e.region).scale(s.Ho.DECIMAL),[c,h]=[u.pos(n),u.pos(r)],[f,g]=[e.findByXDecimal(c.x),e.findByXDecimal(h.x)];if(f.length===0||g.length===0)return null;const[v,w]=[f.sort((b,x)=>s.K.distance(c,b.position)-s.K.distance(c,x.position))[0],g.sort((b,x)=>s.K.distance(h,b.position)-s.K.distance(h,x.position))[0]];return this.internal.dataOne=v.value,this.internal.dataTwo=w.value,[v,w]}renderHover(e){if(this.state.hover==null)return;const n=this.state.hover,r=s.C.XY.scale(e.region).scale(s.Ho.DECIMAL),i=r.pos(n),o=e.findByXDecimal(r.pos(n).x);if(o.length===0)return;const a=o.sort((u,c)=>s.K.distance(i,u.position)-s.K.distance(i,c.position))[0],{draw:l}=this.internal;l.circle({fill:s.ir.setAlpha(a.color,.5),radius:9,position:r.reverse().pos(a.position)})}render(e){if(this.deleted)return;this.renderHover(e);const n=this.find(e);if(n==null)return;const[r,i]=n,{draw:o}=this.internal,{strokeDash:a,strokeWidth:l}=this.state,u=s.C.XY.scale(s.Ho.DECIMAL).scale(e.region),c=u.pos(r.position),h=u.pos(i.position),f=new s.a(Math.abs(r.value.x-i.value.x)),g=Math.abs(r.value.y-i.value.y),v=g/f.seconds;o.line({start:s.K.construct(c.x,c.y),end:s.K.construct(c.x,h.y),stroke:this.verticalLineColor,lineDash:a,lineWidth:l}),o.textContainer({text:[`${g.toFixed(2)} ${r.units??""}`],direction:"x",position:s.K.construct(c.x,(c.y+h.y)/2),level:"small"}),o.line({start:s.K.construct(c.x,h.y),end:s.K.construct(h.x,h.y),stroke:this.horizontalLineColor,lineDash:a,lineWidth:l}),o.textContainer({text:[f.truncate(s.a.MILLISECOND).toString()],direction:"x",position:s.K.construct((c.x+h.x)/2,h.y),level:"small"}),o.line({start:s.K.construct(c.x,c.y),end:s.K.construct(h.x,h.y),stroke:this.obliqueLineColor,lineDash:a,lineWidth:l}),o.textContainer({text:[`${v.toFixed(2)} ${r.units??""} / S`],direction:"x",position:s.K.construct((c.x+h.x)/2,(c.y+h.y)/2),level:"small"}),o.circle({fill:s.ir.setAlpha(r.color,.5),radius:8,position:c}),o.circle({fill:s.ir.setAlpha(r.color,.8),radius:5,position:c}),o.circle({fill:s.ir.WHITE,radius:2,position:c}),o.circle({fill:s.ir.setAlpha(i.color,.5),radius:8,position:h}),o.circle({fill:s.ir.setAlpha(i.color,.8),radius:5,position:h}),o.circle({fill:s.ir.WHITE,radius:2,position:h})}}const Qi={[Qe.TYPE]:Qe},Tu=Object.freeze(Object.defineProperty({__proto__:null,Measure:Qe,REGISTRY:Qi,measureStateZ:wr},Symbol.toStringTag,{value:"Module"})),Ji=d.z.object({container:s.Ho.box,viewport:s.Ho.box,hold:d.z.boolean().optional().default(!1),grid:d.z.record(d.z.string(),Si),visible:d.z.boolean().optional().default(!0),clearOverScan:s.K.crudeZ.optional().default(s.K.ZERO)}),Eu=(t,e)=>{const n=s.Ho.width(t)*Math.sqrt(s.Ho.height(t)),r=s.Ho.width(e)*Math.sqrt(s.Ho.height(e));return n/r},Cu=["upper2d","lower2d","gl"],Pu=["upper2d"];class Zn extends p.Composite{static TYPE="LinePlot";schema=Ji;afterUpdate(e){this.internal.instrumentation=p.useInstrumentation(e,"lineplot"),this.internal.handleError=p.useErrorHandler(e),this.internal.renderCtx=p.Context.use(e),qt(e,n=>{this.state.visible&&this.requestRender("low",n)}),!(!this.state.visible&&!this.prevState.visible)&&this.requestRender("high","layout")}afterDelete(e){this.internal.renderCtx=p.Context.use(e),this.requestRender("high","layout")}findByXDecimal(e){const n={...this.state,plot:this.calculatePlot(),exposure:this.exposure};return this.axes.flatMap(r=>r.findByXDecimal(n,e)).flat()}findByXValue(e){const n={...this.state,plot:this.calculatePlot(),exposure:this.exposure};return this.axes.flatMap(r=>r.findByXValue(n,e)).flat()}get axes(){return this.childrenOfType(Ut.TYPE)}get tooltips(){return this.childrenOfType(Xe.TYPE)}get measures(){return this.childrenOfType(Qe.TYPE)}get bounds(){return this.childrenOfType(Ot.TYPE)}get exposure(){return Eu(this.state.viewport,this.state.container)}renderAxes(e,n){const r={...this.state,plot:e,canvases:n,exposure:this.exposure};this.axes.forEach(i=>i.render(r))}renderTooltips(e,n){const r={findByXDecimal:this.findByXDecimal.bind(this),region:e,canvases:n};this.tooltips.forEach(i=>i.render(r))}renderBounds(){this.bounds.forEach(e=>e.render({getBounds:()=>{const n={};return this.axes.forEach(r=>{const i=r.state.axisKey??r.key;n[i]=r.bounds(this.state.hold),r.yAxes.forEach(o=>{const a=o.state.axisKey??o.key;n[a]=o.bounds(this.state.hold)})}),n}}))}renderMeasures(e){const n={findByXDecimal:this.findByXDecimal.bind(this),findByXValue:this.findByXValue.bind(this),region:e};this.measures.forEach(r=>r.render(n))}calculatePlot(){return Da(this.state.grid,this.state.container)}render(e){const{instrumentation:n,renderCtx:r,handleError:i}=this.internal;if(this.deleted){n.L.debug("deleted, skipping render",{key:this.key});return}if(!this.state.visible)return n.L.debug("not visible, skipping render",{key:this.key}),({canvases:h})=>r.erase(this.state.container,this.state.clearOverScan,...h);const o=this.calculatePlot();n.L.debug("rendering",{key:this.key,viewport:this.state.viewport,container:this.state.container,grid:this.state.grid,plot:o,canvases:e});const a=s.K.construct(this.state.clearOverScan),l=r.scissor(this.state.container,a,e.filter(h=>h!=="gl")),u=r.scissor(o,s.K.ZERO,e.filter(h=>h==="gl"));try{this.renderAxes(o,e),this.renderTooltips(o,e),this.renderMeasures(o),this.renderBounds()}catch(h){i(h,"failed to render line plot")}finally{l(),u()}n.L.debug("rendered",{key:this.key});const c=s.Ho.copy(this.state.container);return({canvases:h})=>r.erase(c,this.state.clearOverScan,...h)}requestRender(e,n){const{renderCtx:r}=this.internal;let i=Cu;n==="tool"&&(i=Pu),r.loop.set({key:`${this.type}-${this.key}`,render:()=>this.render(i),priority:e,canvases:i})}}const ku={[Zn.TYPE]:Zn,[Ut.TYPE]:Ut,[Nt.TYPE]:Nt,[Ot.TYPE]:Ot},eo=d.z.object({region:s.Ho.box,wheelPos:d.z.number(),scrolling:d.z.boolean(),empty:d.z.boolean(),visible:d.z.boolean(),telem:gt.optional().default(ds),font:p.levelZ.optional().default("p"),color:s.ir.colorZ.optional().default(s.ir.ZERO),overshoot:s.K.xy.optional().default({x:0,y:0})}),Ru=.98,$e="lower2d",Mu={offset:0n,offsetRef:0n,scrollRef:0};class Je extends p.Leaf{static TYPE="log";static z=eo;schema=Je.z;values=new s.Vt([]);scrollState=Mu;afterUpdate(e){const{internal:n}=this;n.render=p.Context.use(e),n.theme=p.use(e),s.ir.isZero(this.state.color)?this.internal.textColor=n.theme.colors.gray.l11:n.textColor=this.state.color,n.telem=K(e,this.state.telem,n.telem);const{scrolling:r,wheelPos:i}=this.state;if(this.state.scrolling&&!this.prevState.scrolling){const u=this.values.alignmentBounds.upper-1n;this.scrollState={offset:u,offsetRef:u,scrollRef:this.state.wheelPos}}else if(r){const{scrollState:u,values:c}=this,h=Math.ceil((i-this.scrollState.scrollRef)/this.lineHeight);u.offset=this.values.traverseAlignment(u.offsetRef,-BigInt(h)),u.offset<c.alignmentBounds.lower+BigInt(this.visibleLineCount)&&(u.offset=c.alignmentBounds.lower,this.setState(f=>({...f,wheelPos:this.prevState.wheelPos}))),u.offset>=c.alignmentBounds.upper&&this.setState(f=>({...f,scrolling:!1}))}const[a,l]=this.internal.telem.value();this.values=l,this.checkEmpty(),n.stopListeningTelem?.(),n.stopListeningTelem=n.telem.onChange(()=>{const[u,c]=this.internal.telem.value();this.checkEmpty(),this.values=c,this.requestRender()}),!(!this.state.visible&&!this.prevState.visible)&&this.requestRender()}checkEmpty(){const e=this.values.length===0;e!==this.state.empty&&this.setState(n=>({...n,empty:e}))}afterDelete(){const{telem:e,render:n}=this.internal;e.cleanup?.(),n.erase(s.Ho.construct(this.state.region),s.K.ZERO,$e)}requestRender(){const{render:e}=this.internal;e.loop.set({key:`${this.type}-${this.key}`,render:()=>this.render(),priority:"high",canvases:[$e]})}get lineHeight(){return this.internal.theme.typography[this.state.font].size*this.internal.theme.sizes.base}get totalHeight(){return Math.ceil(this.values.length*this.lineHeight)}get visibleLineCount(){return Math.min(Math.floor((s.Ho.height(this.state.region)-12)/this.lineHeight),this.values.length)}render(){const{render:e}=this.internal,n=this.state.region;if(s.Ho.areaIsZero(n))return;if(!this.state.visible)return()=>e.erase(n,s.K.ZERO,$e);let r;if(!this.state.scrolling)r=this.values.subIterator(this.values.length-this.visibleLineCount,this.values.length);else{const c=this.values.traverseAlignment(this.scrollState.offset,-BigInt(this.visibleLineCount));r=this.values.subAlignmentSpanIterator(c,this.visibleLineCount)}const i=this.state.region,o=e[$e],a=new He(o,this.internal.theme),l=e.scissor(i,s.K.ZERO,[$e]);this.renderElements(a,r),this.renderScrollbar(a),l();const u=s.Ho.copy(this.state.region);return({canvases:c})=>e.erase(u,this.state.overshoot,...c)}renderScrollbar(e){const n=this.state.region,r=s.Ho.height(n)/this.totalHeight*s.Ho.height(n);if(r>=s.Ho.height(n)*Ru)return;let i=s.Ho.bottom(n)-r;this.state.scrolling&&(i-=Number(this.values.distance(this.values.alignmentBounds.upper,this.scrollState.offset))/this.values.length*s.Ho.height(n)),i<0&&(i=s.Ho.top(n)),e.container({region:s.Ho.construct({x:s.Ho.right(n)-6,y:i},{width:6,height:r}),bordered:!1,backgroundColor:o=>o.colors.gray.l6})}renderElements(e,n){const r=this.state.region;let i=0;for(const o of n){const a=this.values.dataType.equals(s.r.JSON)?JSON.stringify(o):o.toString();e.text({text:a,level:this.state.font,shade:11,position:s.K.translate(s.Ho.topLeft(r),{x:6,y:i*this.lineHeight+6}),code:!0}),i++}}}const Lu={[Je.TYPE]:Je},to=d.z.object({trigger:d.z.number(),command:d.z.number().optional(),value:d.z.number(),sink:ys.optional().default(cs),source:ms.optional().default(us)});class Hn extends p.Leaf{static TYPE="Setpoint";schema=to;afterUpdate(e){const{sink:n,source:r,trigger:i,command:o}=this.state,{internal:a}=this;a.prevTrigger??=i,(async()=>{this.internal.source=K(e,r,this.internal.source),a.sink=rt(e,n,a.sink);const l=a.prevTrigger;a.prevTrigger=i,i>l&&o!=null&&this.internal.sink.set(o),this.updateValue(),a.stopListening?.(),a.stopListening=a.source.onChange(()=>this.updateValue())})()}updateValue(){const e=this.internal.source.value();e!==this.state.value&&this.setState(n=>({...n,value:e,triggered:!1}))}afterDelete(){const{internal:e}=this;e.stopListening(),e.source.cleanup?.(),e.sink.cleanup?.()}}const Ou={[Hn.TYPE]:Hn},no=d.z.object({triggered:d.z.boolean(),enabled:d.z.boolean(),sink:Gt.optional().default(Wt),source:qn.optional().default($n)});class In extends p.Leaf{static TYPE="Toggle";schema=no;afterUpdate(e){this.internal.addStatus=p.useOptionalAdder(e);const{sink:n,source:r,triggered:i,enabled:o}=this.state,{triggered:a}=this.prevState,{internal:l}=this;l.source=K(e,r,l.source),l.sink=rt(e,n,l.sink),i&&!a&&l.sink.set(!o),this.updateEnabledState(),l.stopListening?.(),l.stopListening=l.source.onChange(()=>this.updateEnabledState())}updateEnabledState(){const e=this.internal.source.value();e!==this.state.enabled&&this.setState(n=>({...n,enabled:e,triggered:!1}))}afterDelete(){this.internal.stopListening(),this.internal.source.cleanup?.(),this.internal.sink.cleanup?.()}}const Yu={[In.TYPE]:In},hn={useAtlas:!0},Du=d.z.object({box:s.Ho.box,telem:jn.optional().default(hs),backgroundTelem:Fn.optional().default(jt),level:p.levelZ.optional().default("p"),color:s.ir.colorZ.optional().default(s.ir.ZERO),precision:d.z.number().optional().default(2),minWidth:d.z.number().optional().default(60),width:d.z.number().optional(),notation:s.mr.notationZ.optional().default("standard"),location:s.K$1.xy.optional().default({x:"left",y:"center"}),useWidthForBackground:d.z.boolean().optional().default(!1),valueBackgroundShift:s.K.xy.optional().default(s.K.ZERO),valueBackgroundOverScan:s.K.xy.optional().default(s.K.ZERO)}),_u=["upper2d","lower2d"];class Ae extends p.Leaf{static TYPE="value";static z=Du;schema=Ae.z;afterUpdate(e){const{internal:n}=this;n.renderCtx=p.Context.use(e),n.theme=p.use(e),s.ir.isZero(this.state.color)?n.textColor=n.theme.colors.gray.l10:n.textColor=this.state.color,n.telem=K(e,this.state.telem,n.telem),n.stopListening?.(),n.stopListening=n.telem.onChange(()=>this.requestRender()),n.fontString=Ke.fontString(n.theme,{level:this.state.level,code:!0}),n.backgroundTelem=K(e,this.state.backgroundTelem,n.backgroundTelem),n.stopListeningBackground?.(),n.stopListeningBackground=n.backgroundTelem.onChange(()=>this.requestRender()),n.requestRender=ss(e),this.requestRender()}afterDelete(){const{internal:e}=this;e.stopListening?.(),e.stopListeningBackground?.(),e.telem.cleanup?.(),e.backgroundTelem.cleanup?.(),e.requestRender==null?e.renderCtx.erase(s.Ho.construct(this.state.box),s.K.ZERO,..._u):e.requestRender("layout")}requestRender(){const{requestRender:e}=this.internal;e!=null?e("layout"):this.render({})}get fontHeight(){const{theme:e}=this.internal;return e.typography[this.state.level].size*e.sizes.base}maybeUpdateWidth(e){const{theme:n}=this.internal,r=e+n.sizes.base+this.fontHeight;this.state.width==null||this.state.width+this.fontHeight*.5<r||this.state.minWidth>r&&this.state.width!==this.state.minWidth?this.setState(i=>({...i,width:Math.max(r,i.minWidth)})):this.state.width-this.fontHeight>r&&this.setState(i=>({...i,width:Math.max(r,i.minWidth)}))}render({viewportScale:e=s.C.XY.IDENTITY}){const{renderCtx:n,telem:r,backgroundTelem:i,fontString:o,requestRender:a}=this.internal,{location:l,box:u}=this.state;if(s.Ho.areaIsZero(u))return;const c=s.Ho.topLeft(u),h=s.Ho.width(u),f=s.Ho.height(u),g=n.lower2d.applyScale(e);let v=r.value();g.font=o;const w=this.fontHeight,b=v[0]=="-";b&&(v=v.slice(1));const{theme:x}=this.internal,R=g.textDimensions(v,hn),L=R.width+x.sizes.base,k=R.height;a==null&&n.erase(s.Ho.construct(this.prevState.box)),this.maybeUpdateWidth(L);const O={...s.K.ZERO};l.x==="left"?O.x=6+w*.75:l.x==="center"&&(O.x=h/2-L/2),l.y==="center"&&(O.y=f/2+k/2);const D=s.K.translate(c,O);let S=!0;if(this.state.backgroundTelem.type!=jt.type){const Y=i.value();if(!s.ir.isZero(Y)){S=!1,g.fillStyle=s.ir.hex(Y);const Ie=this.state.useWidthForBackground?this.state.width??this.state.minWidth:s.Ho.width(u);g.fillRect(...s.K.couple(s.K.translate(c,this.state.valueBackgroundShift)),Ie+this.state.valueBackgroundOverScan.x,f+this.state.valueBackgroundOverScan.y);const pe=s.ir.pickByContrast(Y,x.colors.gray.l0,x.colors.gray.l11);g.fillStyle=s.ir.hex(pe)}}S&&(g.fillStyle=s.ir.hex(this.internal.textColor)),b&&g.fillText("-",...s.K.couple(s.K.translateX(D,-w*.6)),void 0,hn),g.fillText(v,...s.K.couple(D),void 0,hn)}}const ro={[Ae.TYPE]:Ae},zu=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:ro,Value:Ae},Symbol.toStringTag,{value:"Module"})),Au=(t,e)=>{const n=t.includes("delete"),r=e.includes("delete");return n&&!r?-1:!n&&r?1:0};class so{handlers=new Map;streamerMutex=s.wr.newMutex({streamer:null});handleError;debouncedRemoveHandler;openStreamer=null;constructor({handleError:e,removalDelay:n=0}){this.handleError=e,this.debouncedRemoveHandler=p.o(r=>{this.handleError(this.updateStreamer.bind(this),`Failed to remove ${r} from the Sync.Provider streamer`)},s.a.fromMilliseconds(n).milliseconds)}handleChange(e){const n=[...e.uniqueNames];n.sort(Au),n.forEach(r=>{this.handlers.forEach((i,o)=>{if(i===r)try{o(e)}catch(a){this.handleError(a,`Error calling Sync Frame Handler on channel(s): ${i}`)}})})}async close(){return await this.streamerMutex.runExclusive(this.unprotectedClose.bind(this))}async unprotectedClose(){const e=this.streamerMutex.streamer;this.streamerMutex.streamer=null,e!=null&&await e.close(),this.handlers.clear(),this.openStreamer=null}async updateStreamer(e){await this.streamerMutex.runExclusive(async()=>{if(e!=null&&(this.openStreamer=e),this.openStreamer==null)return;const n=new Set(this.handlers.values()),r=this.streamerMutex.streamer;if(r!=null)return n.size===0?await this.unprotectedClose():await r.update(Array.from(n));if(n.size===0)return;const i=await p.Zm.HardenedStreamer.open(this.openStreamer,Array.from(n));this.streamerMutex.streamer=new p.Zm.ObservableStreamer(i),this.streamerMutex.streamer.onChange(this.handleChange.bind(this))})}addListener(e,n,r){const i=new Set(this.handlers.values());return this.handlers.set(e,n),i.has(n)||this.handleError(async()=>{await this.updateStreamer(),r?.()},`Failed to add ${n} to the Sync.Provider streamer`),()=>{this.handlers.delete(e),this.debouncedRemoveHandler(n)}}}const io=d.object({}),Zu={addListener:null},$t="flux-context",Hu=(t,e)=>t.set($t,e);class et extends p.Composite{static TYPE="flux.Provider";static stateZ=io;schema=et.stateZ;afterUpdate(e){const{internal:n}=this;e.wasSetPreviously($t)||Hu(e,Zu);const r=Ze(e),i=p.useErrorHandler(e);if(n.streamer??=new so({handleError:i}),r==null)return;i(async()=>await n.streamer.updateStreamer(r.openStreamer.bind(r)),"Failed to update Flux.Provider streamer");const o={addListener:({channel:a,handler:l,onOpen:u})=>n.streamer.addListener(l,a,u)};e.set($t,o)}}const Iu={[et.TYPE]:et},Nu=()=>()=>{},Bu=t=>t.get($t).addListener??Nu,oo=(t,e,n)=>{const r=p.t.toArray(n).map(({channel:i,onChange:o})=>t({channel:i,handler:a=>{e(async()=>await o({changed:a.get(i)}),`Error in Flux.useListener on channel ${i}`)}}));return()=>r.forEach(i=>i())},Uu=(t,e,n)=>{if(n!=null)return n;const r=Bu(t),i=p.useErrorHandler(t);return oo(r,i,e)};exports.AcquireChannelControl=kt;exports.Annotation=An;exports.AuthoritySource=Rt;exports.Base=fe;exports.BaseProvider=Oe;exports.Bottom=Bi;exports.BoundQuerier=Ot;exports.Button=Pn;exports.Canvas=Lt;exports.Chip=wn;exports.Controller=Tn;exports.Diagram=Ma;exports.Diagram$1=le;exports.Indicator=En;exports.Legend=Cn;exports.Light=kn;exports.Line=Mt;exports.LinePlot=Zn;exports.Log=Je;exports.MODES=di;exports.MOUSE_DOWN_INCREMENT=pi;exports.MOUSE_UP_INCREMENT=gi;exports.Measure=Qe;exports.Mutex=os;exports.Provider=pt;exports.Provider$1=et;exports.Provider$2=Bt;exports.REGISTRY=ku;exports.REGISTRY$1=Iu;exports.REGISTRY$10=ji;exports.REGISTRY$11=mu;exports.REGISTRY$12=Qi;exports.REGISTRY$13=Ea;exports.REGISTRY$14=La;exports.REGISTRY$15=vi;exports.REGISTRY$16=ua;exports.REGISTRY$17=yi;exports.REGISTRY$18=da;exports.REGISTRY$2=Ro;exports.REGISTRY$3=Lu;exports.REGISTRY$4=ro;exports.REGISTRY$5=Xi;exports.REGISTRY$6=Yu;exports.REGISTRY$7=Qs;exports.REGISTRY$8=ls;exports.REGISTRY$9=Ou;exports.Right=$i;exports.Rule=Ge;exports.STATUSES=ri;exports.SetChannelValue=Pt;exports.Setpoint=Hn;exports.StateProvider=qe;exports.Streamer=so;exports.Table=Te;exports.Toggle=In;exports.Tooltip=Xe;exports.Top=Ui;exports.Value=Ae;exports.XAxis=Ut;exports.YAxis=Nt;exports.ZERO_CONTEXT_VALUE=Bn;exports.a=Kt;exports.acquireChannelControl=aa;exports.acquireChannelControlPropsZ=ai;exports.aether=du;exports.annotationStateZ=Vi;exports.authoritySource=ca;exports.authoritySourceDetailsZ=la;exports.authoritySourceProps=li;exports.axisStateZ=br;exports.boundQuerierStateZ=xi;exports.buttonStateZ=fi;exports.canvas=Ra;exports.canvasStateZ=or;exports.channelData=Es;exports.chipStateZ=ei;exports.chipStatusDetailsZ=Js;exports.color=Ye;exports.colorGradient=Ns;exports.control=qt;exports.controllerStateZ=ii;exports.coreAxisStateZ=at;exports.diagramStateZ=ar;exports.external=ia;exports.indicatorStateZ=ui;exports.indicatorStatusDetailsZ=ci;exports.interpolate=en;exports.interpolateNumber=je;exports.interpolateRgb=On;exports.interpolateString=Pi;exports.legendStateZ=hi;exports.lightStateZ=bi;exports.linePlotStateZ=Ji;exports.logState=eo;exports.measure=Tu;exports.measureStateZ=wr;exports.mountListeners=oo;exports.newCanvas=Ni;exports.newTickFactory=_n;exports.parseAutoBounds=Wi;exports.parsedHandler=dn;exports.provider=Po;exports.providerStateZ=io;exports.providerStateZ$1=Gi;exports.providerStateZ$2=ir;exports.regions=ie;exports.request=X;exports.rollingAverage=Hs;exports.rollingAverageProps=rr;exports.ruleStateZ=xr;exports.scaleNumber=Us;exports.setChannelValue=oa;exports.setChannelValuePropsZ=oi;exports.setpoint=Ds;exports.setpointStateZ=to;exports.sinkPipeline=Ss;exports.sinkPipelinePropsZ=Qn;exports.sourcePipeline=xs;exports.sourcePipelinePropsZ=Gn;exports.stateProviderStateZ=ti;exports.stateZ=mi;exports.statusZ=si;exports.streamChannelData=Cs;exports.streamChannelValue=Ps;exports.streamChannelValuePropsZ=Jn;exports.stringHandler=bo;exports.stringSourceSpecZ=jn;exports.stringifyNumber=Zs;exports.stringifyNumberProps=nr;exports.sugaredStateZ=ni;exports.tickFactoryProps=vr;exports.tickType=yr;exports.toggleStateZ=no;exports.tooltip=wu;exports.tooltipStateZ=Sr;exports.useOptionalRequestor=ss;exports.useRequestor=Ft;exports.value=zu;exports.withinBounds=_s;exports.withinBoundsProps=tr;exports.withinSizeThreshold=Ki;exports.xAxisStateZ=yu;exports.yAxisStateZ=fu;
|