@synnaxlabs/pluto 0.38.0 → 0.38.1
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-CBm9-vEt.js → Animated-BWcO40x5.js} +2 -2
- package/dist/{Animated-Cv0kRBvj.cjs → Animated-Cxl7iHik.cjs} +1 -1
- package/dist/{Item-DfHOrsI4.js → Item-BZvmqn4h.js} +4 -4
- package/dist/{Item-D4eTqW7p.cjs → Item-C4SOBynl.cjs} +1 -1
- package/dist/{LinePlot-BLovx_K1.js → LinePlot-B_tFyvNo.js} +1776 -1794
- package/dist/LinePlot-C_uxbSzY.cjs +56 -0
- package/dist/{Link-DsUveQ8_.js → Link-BIWA4Kdj.js} +1 -1
- package/dist/{Link-CcELhLK5.cjs → Link-DO2YbtQM.cjs} +1 -1
- package/dist/{Pack-SDIuOEWr.cjs → Pack-B7_tAsYd.cjs} +1 -1
- package/dist/{Pack-meMPpnLE.js → Pack-Di5J8hmU.js} +1 -1
- package/dist/{Toggle--8qqNnzb.cjs → Toggle-BOWYgKry.cjs} +61 -61
- package/dist/{Toggle-Bkpw4raJ.js → Toggle-DvdBHJvZ.js} +6983 -6992
- package/dist/{Video-M2UhBzQi.js → Video-CAbdyjCE.js} +1 -1
- package/dist/{Video-D9_mAnaf.cjs → Video-usN9Roxq.cjs} +1 -1
- package/dist/{aggregator-By11htYo.cjs → aggregator-B4RWbN9h.cjs} +34 -34
- package/dist/{aggregator-BpyoaCoW.js → aggregator-Bl15iClv.js} +2593 -2617
- package/dist/align.cjs +1 -1
- package/dist/align.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/{css-CxwKC6TD.js → css-Bbri4zkj.js} +190 -184
- package/dist/css-DT9dIVAb.cjs +1 -0
- package/dist/css.cjs +1 -1
- package/dist/css.js +2 -2
- package/dist/dropdown.cjs +1 -1
- package/dist/dropdown.js +1 -1
- package/dist/ether.cjs +1 -1
- package/dist/ether.js +67 -71
- package/dist/{external-ByzAGKGm.cjs → external-8OKX45Jc.cjs} +1 -1
- package/dist/{external-biLn9KfP.cjs → external-9Q86X8hc.cjs} +1 -1
- package/dist/{external-DSHJn336.js → external-B45MvYg8.js} +4 -4
- package/dist/{external-BDxOWeCJ.js → external-BP5euc4j.js} +3 -3
- package/dist/external-Ba8go3wq.cjs +1 -0
- package/dist/{external-BDI5gGZT.js → external-C59dex28.js} +2 -2
- package/dist/{external-BlB1LKU5.cjs → external-CKXRIr4_.cjs} +1 -1
- package/dist/{external-CEAUuDRU.js → external-CML3oqyJ.js} +2 -2
- package/dist/{external-BdhgaSFj.cjs → external-CW61uh4b.cjs} +1 -1
- package/dist/{external-DaTbvfth.cjs → external-CWIwuJks.cjs} +1 -1
- package/dist/{external-BOqGZoJO.js → external-CcuRxo0Z.js} +27 -27
- package/dist/{external-Dvj3Y4C_.cjs → external-CigHe3w_.cjs} +1 -1
- package/dist/{external-NDebmx0l.js → external-Cm1kldLr.js} +13 -13
- package/dist/{external-Cc7R9gIf.js → external-DNjLBxYA.js} +4 -4
- package/dist/{external-BzzIJ4wP.js → external-DTDBfIqD.js} +1 -1
- package/dist/{external-DN8Ec8n8.cjs → external-DkXE1VK8.cjs} +1 -1
- package/dist/{external--jF6DCow.cjs → external-Dt4ggRt2.cjs} +1 -1
- package/dist/{external-CsLjI7EJ.js → external-DuGCS_ZD.js} +2 -2
- package/dist/{external-CqOmm0mk.js → external-DuK5v_sl.js} +38 -36
- package/dist/{external-mT9bNf0F.cjs → external-SsIgRo40.cjs} +1 -1
- package/dist/{external-hZWRSBEb.js → external-U33eEFR3.js} +14 -14
- package/dist/{external-CDa3lybi.js → external-bw66TR6V.js} +10 -10
- package/dist/{external---lrKeGh.cjs → external-kZBV4X9L.cjs} +1 -1
- package/dist/{external-Dqh2Lbnl.cjs → external-ok_ye4LF.cjs} +1 -1
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.js +2867 -2875
- 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/src/aether/aether/aether.bench.d.ts +2 -0
- package/dist/src/aether/aether/aether.bench.d.ts.map +1 -0
- package/dist/src/aether/aether/aether.d.ts +143 -136
- package/dist/src/aether/aether/aether.d.ts.map +1 -1
- package/dist/src/aether/aether/{worker.spec.d.ts → aether.spec.spec.d.ts} +1 -1
- package/dist/src/aether/aether/aether.spec.spec.d.ts.map +1 -0
- package/dist/src/alamos/aether/alamos.d.ts +2 -2
- package/dist/src/alamos/aether/alamos.d.ts.map +1 -1
- package/dist/src/breadcrumb/Breadcrumb.d.ts +2 -2
- package/dist/src/breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/src/button/Button.d.ts +5 -5
- package/dist/src/button/Button.d.ts.map +1 -1
- package/dist/src/button/Toggle.d.ts +2 -2
- package/dist/src/channel/Select.d.ts +1 -1
- package/dist/src/channel/Select.d.ts.map +1 -1
- package/dist/src/color/Provider.d.ts.map +1 -1
- package/dist/src/hooks/effect.d.ts +2 -2
- package/dist/src/hooks/effect.d.ts.map +1 -1
- package/dist/src/icon/Icon.d.ts +11 -4
- package/dist/src/icon/Icon.d.ts.map +1 -1
- package/dist/src/menu/Item.d.ts.map +1 -1
- package/dist/src/os/Controls/Controls.d.ts.map +1 -1
- package/dist/src/os/use.d.ts.map +1 -1
- package/dist/src/pluto/aether/pluto.d.ts.map +1 -1
- package/dist/src/select/Alignment.d.ts +1 -1
- package/dist/src/select/Alignment.d.ts.map +1 -1
- package/dist/src/select/ComponentSize.d.ts.map +1 -1
- package/dist/src/select/Direction.d.ts +1 -1
- package/dist/src/select/Direction.d.ts.map +1 -1
- package/dist/src/status/Aggregator.d.ts +4 -6
- package/dist/src/status/Aggregator.d.ts.map +1 -1
- package/dist/src/status/aether/aggregator.d.ts +10 -4
- package/dist/src/status/aether/aggregator.d.ts.map +1 -1
- package/dist/src/synnax/aether/provider.d.ts +2 -2
- package/dist/src/synnax/aether/provider.d.ts.map +1 -1
- package/dist/src/table/aether/Table.d.ts +3 -1
- package/dist/src/table/aether/Table.d.ts.map +1 -1
- package/dist/src/table/cells/registry.d.ts.map +1 -1
- package/dist/src/table/external.d.ts.map +1 -1
- package/dist/src/tabs/types.d.ts +2 -2
- package/dist/src/tabs/types.d.ts.map +1 -1
- package/dist/src/tag/Tag.d.ts +1 -1
- package/dist/src/tag/Tag.d.ts.map +1 -1
- package/dist/src/telem/aether/context.d.ts +22 -22
- package/dist/src/telem/aether/context.d.ts.map +1 -1
- package/dist/src/telem/aether/factory.d.ts +1 -1
- package/dist/src/telem/aether/factory.d.ts.map +1 -1
- package/dist/src/telem/aether/provider.d.ts +3 -13
- package/dist/src/telem/aether/provider.d.ts.map +1 -1
- package/dist/src/telem/aether/remote.d.ts.map +1 -1
- package/dist/src/telem/client/client.d.ts +8 -12
- package/dist/src/telem/client/client.d.ts.map +1 -1
- package/dist/src/telem/control/aether/chip.d.ts +1 -2
- package/dist/src/telem/control/aether/chip.d.ts.map +1 -1
- package/dist/src/telem/control/aether/controller.d.ts +3 -2
- package/dist/src/telem/control/aether/controller.d.ts.map +1 -1
- package/dist/src/telem/control/aether/indicator.d.ts +1 -2
- package/dist/src/telem/control/aether/indicator.d.ts.map +1 -1
- package/dist/src/telem/control/aether/legend.d.ts +1 -1
- package/dist/src/telem/control/aether/legend.d.ts.map +1 -1
- package/dist/src/telem/control/aether/state.d.ts +1 -1
- package/dist/src/telem/control/aether/state.d.ts.map +1 -1
- package/dist/src/text/Editable.d.ts.map +1 -1
- package/dist/src/theming/Provider.d.ts.map +1 -1
- package/dist/src/theming/aether/provider.d.ts +1 -1
- package/dist/src/theming/aether/provider.d.ts.map +1 -1
- package/dist/src/tree/Tree.d.ts +1 -1
- package/dist/src/tree/Tree.d.ts.map +1 -1
- package/dist/src/tree/core.d.ts +1 -2
- package/dist/src/tree/core.d.ts.map +1 -1
- package/dist/src/triggers/Provider.d.ts.map +1 -1
- package/dist/src/util/canDisable.d.ts.map +1 -1
- package/dist/src/util/reflow.d.ts.map +1 -1
- package/dist/src/vis/axis/canvas.d.ts +1 -1
- package/dist/src/vis/axis/canvas.d.ts.map +1 -1
- package/dist/src/vis/button/aether/button.d.ts +1 -1
- package/dist/src/vis/button/aether/button.d.ts.map +1 -1
- package/dist/src/vis/canvas/aether/canvas.d.ts +9 -8
- package/dist/src/vis/canvas/aether/canvas.d.ts.map +1 -1
- package/dist/src/vis/diagram/Diagram.d.ts.map +1 -1
- package/dist/src/vis/diagram/aether/Diagram.d.ts +2 -2
- package/dist/src/vis/diagram/aether/Diagram.d.ts.map +1 -1
- package/dist/src/vis/eraser/aether/eraser.d.ts +4 -4
- package/dist/src/vis/eraser/aether/eraser.d.ts.map +1 -1
- package/dist/src/vis/light/aether/light.d.ts +2 -2
- package/dist/src/vis/light/aether/light.d.ts.map +1 -1
- package/dist/src/vis/line/aether/line.d.ts +2 -2
- package/dist/src/vis/line/aether/line.d.ts.map +1 -1
- package/dist/src/vis/lineplot/aether/LinePlot.d.ts +3 -3
- package/dist/src/vis/lineplot/aether/LinePlot.d.ts.map +1 -1
- package/dist/src/vis/lineplot/aether/axis.d.ts +2 -2
- package/dist/src/vis/lineplot/aether/axis.d.ts.map +1 -1
- package/dist/src/vis/lineplot/range/aether/annotation.d.ts +1 -1
- package/dist/src/vis/lineplot/range/aether/annotation.d.ts.map +1 -1
- package/dist/src/vis/lineplot/range/aether/provider.d.ts +1 -1
- package/dist/src/vis/lineplot/range/aether/provider.d.ts.map +1 -1
- package/dist/src/vis/lineplot/tooltip/aether/tooltip.d.ts +2 -2
- package/dist/src/vis/lineplot/tooltip/aether/tooltip.d.ts.map +1 -1
- package/dist/src/vis/log/Log.d.ts.map +1 -1
- package/dist/src/vis/log/aether/Log.d.ts +1 -1
- package/dist/src/vis/log/aether/Log.d.ts.map +1 -1
- package/dist/src/vis/log/index.d.ts.map +1 -1
- package/dist/src/vis/measure/aether/measure.d.ts +3 -3
- package/dist/src/vis/measure/aether/measure.d.ts.map +1 -1
- package/dist/src/vis/render/GLProgram.d.ts +1 -1
- package/dist/src/vis/render/GLProgram.d.ts.map +1 -1
- package/dist/src/vis/render/external.d.ts +0 -1
- package/dist/src/vis/render/external.d.ts.map +1 -1
- package/dist/src/vis/render/loop.d.ts +1 -1
- package/dist/src/vis/render/loop.d.ts.map +1 -1
- package/dist/src/vis/rule/aether/aether.d.ts +2 -2
- package/dist/src/vis/rule/aether/aether.d.ts.map +1 -1
- package/dist/src/vis/setpoint/aether/setpoint.d.ts +2 -2
- package/dist/src/vis/setpoint/aether/setpoint.d.ts.map +1 -1
- package/dist/src/vis/toggle/aether/toggle.d.ts +2 -2
- package/dist/src/vis/toggle/aether/toggle.d.ts.map +1 -1
- package/dist/src/vis/value/aether/value.d.ts +2 -2
- package/dist/src/vis/value/aether/value.d.ts.map +1 -1
- package/dist/src/worker/Context.d.ts.map +1 -1
- 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/{transformColorsToHex-1p-bBtDw.cjs → transformColorsToHex-CDwcIPob.cjs} +1 -1
- package/dist/{transformColorsToHex-CjnZ3Lo3.js → transformColorsToHex-CnZpPlL2.js} +1 -1
- 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/dist/{units-Cq6pBqSd.cjs → units-BpKy5yTv.cjs} +1 -1
- package/dist/{units-Bz3KAVba.js → units-CNGjg1NV.js} +1 -1
- package/dist/video.cjs +1 -1
- package/dist/video.js +1 -1
- package/package.json +6 -5
- package/dist/LinePlot-BXBKDBXS.cjs +0 -56
- package/dist/css-CRd0zXr-.cjs +0 -1
- package/dist/external-BXEbAbxf.cjs +0 -1
- package/dist/src/aether/aether/worker.spec.d.ts.map +0 -1
- package/dist/src/aether/test/index.d.ts +0 -2
- package/dist/src/aether/test/index.d.ts.map +0 -1
- package/dist/src/aether/test/test.d.ts +0 -11
- package/dist/src/aether/test/test.d.ts.map +0 -1
- package/dist/src/telem/test/index.d.ts +0 -2
- package/dist/src/telem/test/index.d.ts.map +0 -1
- package/dist/src/telem/test/mock.d.ts +0 -33
- package/dist/src/telem/test/mock.d.ts.map +0 -1
- package/dist/src/vis/render/eraser.d.ts +0 -20
- package/dist/src/vis/render/eraser.d.ts.map +0 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";var yi=Object.defineProperty;var wi=(e,n,t)=>n in e?yi(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var h=(e,n,t)=>wi(e,typeof n!="symbol"?n+"":n,t);const d=require("./aggregator-B4RWbN9h.cjs"),p=require("zod"),l=require("./css-DT9dIVAb.cjs");var Ti=Object.defineProperty,bi=(e,n,t)=>n in e?Ti(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Ge=(e,n,t)=>bi(e,typeof n!="symbol"?n+"":n,t);class xi{constructor(n,t){Ge(this,"handlers"),Ge(this,"transform"),Ge(this,"closer"),this.transform=n,this.handlers=t??new Map}onChange(n){return this.handlers.set(n,null),()=>this.handlers.delete(n)}notify(n){let t=n;if(this.transform!=null){const[r,s]=this.transform(n);if(!s)return;t=r}this.handlers.forEach((r,s)=>s(t))}setCloser(n){this.closer=n}async close(){var n;return await((n=this.closer)==null?void 0:n.call(this))}}class vi{constructor(n){Ge(this,"handlers"),this.handlers=n??new Map}onChange(n){return this.handlers.set(n,null),()=>this.handlers.delete(n)}notify(n){this.handlers.forEach((t,r)=>r(n))}}const Qn=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:vi,Observer:xi},Symbol.toStringTag,{value:"Module"})),K="layout",Gn="data",et="tool";var V;let N=(V=class{constructor(n){h(this,"f");this.f=n}static control(n,t){n.set(V.CONTEXT_KEY,new V(t),!1)}static useRequest(n){return n.get(V.CONTEXT_KEY).f}static useOptionalRequest(n){var t;return((t=n.getOptional(V.CONTEXT_KEY))==null?void 0:t.f)??null}static requestRender(n,t){this.useRequest(n)(t)}},h(V,"CONTEXT_KEY","pluto-vis-renderer"),V);const Si=p.z.object({props:d.wg.nullable(),state:d.bg.connectivity.connectionStateZ.nullable()}),Jn={synnax:null,state:d.bg.connectivity.DEFAULT};var at;let Fe=(at=class extends d.Composite{constructor(){super(...arguments);h(this,"schema",at.stateZ)}async afterUpdate(t){var r;if(t.setPreviously(tr)||zn(t,Jn),this.state.props==null){this.internal.synnax!=null&&(this.setState(s=>({...s,state:d.bg.connectivity.DEFAULT})),(r=this.internal.synnax)==null||r.close(),this.internal.synnax=null),zn(t,this.internal);return}this.prevState.props!=null&&d._.equal(this.state.props,this.prevState.props)&&this.internal.synnax!=null||(this.internal.synnax=new d.bg(this.state.props),this.internal.synnax.connectivity.onChange(s=>this.setState(a=>({...a,state:s}))),zn(t,this.internal))}},h(at,"TYPE","synnax.Provider"),h(at,"stateZ",Si),at);const tr="pluto-client-context",zn=(e,n)=>e.set(tr,n),Me=e=>e.get(tr).synnax,Ts={[Fe.TYPE]:Fe},Ci=Object.freeze(Object.defineProperty({__proto__:null,Provider:Fe,REGISTRY:Ts,ZERO_CONTEXT_VALUE:Jn,use:Me},Symbol.toStringTag,{value:"Module"}));class it extends Qn.Observer{async cleanup(){}}class He extends it{async set(){return await Promise.resolve()}}h(He,"TYPE","noop-boolean-sink");const vn={type:He.TYPE,props:{},variant:"sink",valueType:"boolean"};class qe extends it{async set(){return await Promise.resolve()}}h(qe,"TYPE","noop-numeric-sink");const bs={type:qe.TYPE,props:{},variant:"sink",valueType:"number"};class je extends it{async value(){return await Promise.resolve(!1)}}h(je,"TYPE","noop-boolean-source");const er={type:je.TYPE,props:{},variant:"source",valueType:"boolean"};class We extends it{async value(){return 0}}h(We,"TYPE","noop-numeric-source");const xs={type:We.TYPE,props:{},variant:"source",valueType:"number"};class Ve extends it{async value(){return""}}h(Ve,"TYPE","noop-string-source");const vs={type:Ve.TYPE,props:{},variant:"source",valueType:"string"};class Xe extends it{async value(){return{key:"noop",variant:"disabled",message:"unknown",time:d.m.now()}}}h(Xe,"TYPE","noop-status-source");const nr={type:Xe.TYPE,props:{},variant:"source",valueType:"status"};class Ke extends it{async value(){return l.ZERO}}h(Ke,"TYPE","noop-color-source");const Sn={type:Ke.TYPE,props:{},variant:"source",valueType:"color"};class Qe extends it{async value(){return[l.H.ZERO,[]]}}h(Qe,"TYPE","noop-series");const Ss={type:Qe.TYPE,props:{},variant:"source",valueType:"series"},Ei={[He.TYPE]:He,[qe.TYPE]:qe,[je.TYPE]:je,[We.TYPE]:We,[Xe.TYPE]:Xe,[Ke.TYPE]:Ke,[Ve.TYPE]:Ve,[Qe.TYPE]:Qe};class Cs{constructor(){h(this,"type","noop")}create(n){const t=Ei[n.type];return t==null?null:new t}}const Pi=p.z.instanceof(ArrayBuffer),Ye=p.z.object({type:p.z.string(),variant:p.z.enum(["source","sink","source-transformer","sink-transformer"]),valueType:p.z.string(),props:p.z.any(),transfer:p.z.array(Pi).optional()}),ot=Ye.extend({variant:p.z.literal("source")}),Cn=Ye.extend({variant:p.z.literal("sink")}),Es=Ye.extend({variant:p.z.literal("source-transformer")}),Ps=Ye.extend({variant:p.z.literal("sink-transformer")}),Je=ot.extend({valueType:p.z.literal("series")}),rr=ot.extend({valueType:p.z.literal("boolean")}),En=Cn.extend({valueType:p.z.literal("boolean")}),ki=Ps.extend({valueType:p.z.literal("boolean")}),Ri=Es.extend({valueType:p.z.literal("boolean")}),ks=ot.extend({valueType:p.z.literal("number")}),Rs=Cn.extend({valueType:p.z.literal("number")}),sr=ot.extend({valueType:p.z.literal("color")}),ar=ot.extend({valueType:p.z.literal("status")}),ir=ot.extend({valueType:p.z.literal("string")});class Pn extends Qn.BaseObserver{constructor(t){super();h(this,"props_");h(this,"uProps_");h(this,"schema");this.uProps_=t}get props(){if(this.props_==null){const t=this._schema.safeParse(this.uProps_);if(t.success)this.props_=t.data;else throw new d.L(`[BaseTelem] - expected props to be valid, but found the following errors:
|
|
2
|
+
${t.error.message}`)}return this.props_}get _schema(){if(this.schema==null)throw new d.L(`[BaseTelem] - expected subclass to define props schema, but none was found.
|
|
3
|
+
Make sure to define a property 'schema' on the class.`);return this.schema}async cleanup(){}}class _ extends Pn{}class kn extends Pn{}class pt extends _{constructor(){super(...arguments);h(this,"sources",{})}get source(){const[t]=Object.values(this.sources);if(t==null)throw new d.L("[UnarySourceTransformer] - expected source to exist, but none was found.");return t}async value(){return this.transform(await this.source.value())}onChange(t){return this.source.onChange(()=>{this.source.value().then(r=>{this.shouldNotify(r)&&t()}).catch(console.error)})}setSources(t){this.sources=t}shouldNotify(t){return!0}transform(t){throw new d.L(`[UnarySourceTransformer] - expected subclass to define transform method, but none was found.
|
|
4
|
+
Make sure to define a method 'transform' on the class.`)}}class Ms extends _{constructor(){super(...arguments);h(this,"sources",{})}async value(){const t=Object.fromEntries(await Promise.all(Object.entries(this.sources).map(async([r,s])=>[r,await s.value()])));return this.transform(t)}setSources(t){this.sources={...this.sources,...t}}transform(t){throw new d.L(`[MultiSourceTransformer] - expected subclass to define transform method, but none was found.
|
|
5
|
+
Make sure to define a method 'transform' on the class.`)}}class Ys extends Pn{constructor(){super(...arguments);h(this,"sinks",{})}get sink(){const[t]=Object.values(this.sinks);if(t==null)throw new d.L("[UnarySinkTransformer] - expected sink to exist, but none was found.");return t}async set(t){return await this.sink.set(this.transform(t))}setSinks(t){this.sinks={...this.sinks,...t}}transform(t){throw new d.L(`[UnarySinkTransformer] - expected subclass to define transform method, but none was found.
|
|
6
|
+
Make sure to define a method 'transform' on the class.`)}}const or=p.z.object({from:p.z.string(),to:p.z.string()}),lr=p.z.object({connections:p.z.array(or),outlet:p.z.string(),segments:p.z.record(ot)});class cr{constructor(n){h(this,"type","pipeline");h(this,"factory");this.factory=n}create(n){switch(n.type){case oe.TYPE:return new oe(n.props,this.factory);case le.TYPE:return new le(n.props,this.factory);default:return null}}}class oe extends _{constructor(t,r){super(t);h(this,"schema",lr);h(this,"sources",{});const{connections:s,segments:a}=this.props;Object.entries(a).forEach(([i,o])=>{const c=r.create(o);c!=null&&(this.sources[i]=c)}),s.forEach(({from:i,to:o})=>{const c=this.sources[i],u=this.sources[o];c==null||u==null||"setSources"in u&&u.setSources({[i]:c})})}get outlet(){const{outlet:t}=this.props,r=this.sources[t];if(r==null)throw new d.L(`[SourcePipeline] - expected source to exist at outlet '${t}', but none was found.`);return r}async value(){return await this.outlet.value()}onChange(t){return this.outlet.onChange(t)}async cleanup(){await Promise.all(Object.values(this.sources).map(async t=>{var r;return await((r=t.cleanup)==null?void 0:r.call(t))}))}}h(oe,"TYPE","source-pipeline");const zs=(e,n)=>({variant:"source",props:n,type:oe.TYPE,valueType:e}),ur=p.z.object({connections:p.z.array(or),inlet:p.z.string(),segments:p.z.record(Cn)});class le extends kn{constructor(t,r){super(t);h(this,"schema",ur);h(this,"sinks",{});const{connections:s,segments:a}=this.props;Object.entries(a).forEach(([i,o])=>{const c=r.create(o);c!=null&&(this.sinks[i]=c)}),s.forEach(({from:i,to:o})=>{const c=this.sinks[i],u=this.sinks[o];c==null||u==null||"setSinks"in c&&c.setSinks({[o]:u})})}get inlet(){const{inlet:t}=this.props,r=this.sinks[t];if(r==null)throw new d.L(`[SinkPipeline] - expected source to exist at inlet '${t}', but none was found.`);return r}async set(t){return await this.inlet.set(t)}async cleanup(){await Promise.all(Object.values(this.sinks).map(async t=>{var r;return await((r=t.cleanup)==null?void 0:r.call(t))}))}}h(le,"TYPE","sink-pipeline");const Ds=(e,n)=>({variant:"sink",props:n,type:le.TYPE,valueType:e}),hr=p.z.object({channel:p.z.number().or(p.z.string())});class ce extends _{constructor(t,r){super(r);h(this,"client");h(this,"removeStreamHandler",null);h(this,"channelKey",0);h(this,"schema",hr);h(this,"leadingBuffer",null);h(this,"valid",!1);this.client=t}get testingOnlyLeadingBuffer(){return this.leadingBuffer}get testingOnlyValid(){return this.valid}async cleanup(){var t,r;await((t=this.removeStreamHandler)==null?void 0:t.call(this)),this.valid=!1,(r=this.leadingBuffer)==null||r.release(),this.leadingBuffer=null,this.removeStreamHandler=null}async value(){if(d.w$1(this.props.channel))return 0;if(this.channelKey===0){const t=await dr(this.client,this.props.channel,!1);if(t==null)return 0;this.channelKey=t.key}return this.valid||await this.read(),this.leadingBuffer==null||this.leadingBuffer.length===0?0:this.leadingBuffer.at(-1,!0)}async read(){this.valid=!0,await this.updateStreamHandler()}async updateStreamHandler(){var r;await((r=this.removeStreamHandler)==null?void 0:r.call(this));const t=s=>{var o;const i=s[this.channelKey].data;if(i.length!==0){const c=i[i.length-1];c.acquire(),(o=this.leadingBuffer)==null||o.release(),this.leadingBuffer=c}this.notify()};this.removeStreamHandler=await this.client.stream(t,[this.channelKey])}}h(ce,"TYPE","stream-channel-value");const dr=async(e,n,t)=>{let r=await e.retrieveChannel(n);if(r==null)return null;if(!t||r.isIndex)return{key:r.key,dataType:r.dataType,virtual:r.virtual};if(d.Fg.isCalculated(r)){const s=await d.Fg.resolveCalculatedIndex(e.retrieveChannel.bind(e),r);if(s==null)throw new d.L("Cannot resolve calculated index");return r=await e.retrieveChannel(s),r==null?null:{key:r.key,dataType:d.g.TIMESTAMP,virtual:!1}}if(r.virtual)throw new d.L("Cannot plot data from virtual channels");return{key:r.index,dataType:d.g.TIMESTAMP,virtual:!1}},Mi=p.z.object({timeRange:d.E.z,channel:p.z.number().or(p.z.string()),useIndexOfChannel:p.z.boolean().optional().default(!1)});class ue extends _{constructor(t,r){super(r);h(this,"client");h(this,"data",[]);h(this,"valid",!1);h(this,"schema",Mi);this.client=t}async cleanup(){this.data.forEach(t=>t.release()),this.valid=!1}async value(){const{timeRange:t,channel:r,useIndexOfChannel:s}=this.props;if(t.isZero||r===0)return[l.H.ZERO,[]];const a=await dr(this.client,r,s);if(a==null)return[l.H.ZERO,[]];this.valid||await this.readFixed(a.key);let i=l.H.max(this.data.map(o=>o.bounds));return a.dataType.equals(d.g.TIMESTAMP)&&(i={upper:Math.min(i.upper,Number(this.props.timeRange.end.valueOf())),lower:Math.max(i.lower,Number(this.props.timeRange.start.valueOf()))}),[i,this.data]}async readFixed(t){const s=(await this.client.read(this.props.timeRange,[t]))[t].data;s.forEach(a=>a.acquire()),this.data=s,this.valid=!0}}h(ue,"TYPE","series-source");const Yi=p.z.object({channel:p.z.number().or(p.z.string()),useIndexOfChannel:p.z.boolean().optional().default(!1),timeSpan:d.w.z,keepFor:d.w.z.optional()});class he extends _{constructor(t,r){super(r);h(this,"client");h(this,"data",[]);h(this,"stopStreaming");h(this,"valid",!1);h(this,"schema",Yi);this.client=t}async value(){const{channel:t,useIndexOfChannel:r,timeSpan:s}=this.props;if(t===0)return[l.H.ZERO,[]];const a=d.m.now(),i=await dr(this.client,t,r);if(i==null)return[l.H.ZERO,[]];if(this.valid||await this.read(i),i.dataType.isVariable)return[l.H.ZERO,this.data];let o=l.H.max(this.data.filter(c=>c.timeRange.end.after(a.sub(s))).map(c=>c.bounds));return i.dataType.equals(d.g.TIMESTAMP)&&(o={upper:o.upper,lower:Math.max(o.lower,o.upper-Number(s.valueOf()))}),[o,this.data]}async read({key:t,virtual:r}){const s=d.m.now().spanRange(-this.props.timeSpan);if(!r){const i=(await this.client.read(s,[t]))[t].data;i.forEach(o=>o.acquire()),this.data.push(...i)}await this.updateStreamHandler(t),this.valid=!0}async updateStreamHandler(t){this.stopStreaming!=null&&await this.stopStreaming();const r=s=>{const a=s[t].data;a.forEach(i=>i.acquire()),this.data.push(...a),this.gcOutOfRangeData(),this.notify()};this.stopStreaming=await this.client.stream(r,[t])}gcOutOfRangeData(){const t=d.m.now().sub(this.props.keepFor??this.props.timeSpan),r=this.data.findIndex(s=>s.timeRange.end.before(t));r!==-1&&(this.data.splice(r,1).forEach(s=>s.release()),this.gcOutOfRangeData())}async cleanup(){var t;await((t=this.stopStreaming)==null?void 0:t.call(this)),this.stopStreaming=void 0,this.data.forEach(r=>r.release())}}h(he,"TYPE","dynamic-series-source");const zi={[ue.TYPE]:ue,[he.TYPE]:he,[ce.TYPE]:ce};class Ls{constructor(n){h(this,"type","remote");h(this,"client");this.client=n}create(n){const t=zi[n.type];return t==null?null:new t(this.client,n.props)}}const Os=e=>({type:ue.TYPE,props:e,variant:"source",valueType:"series"}),As=e=>({type:he.TYPE,props:e,variant:"source",valueType:"series"}),Zs=e=>({type:ce.TYPE,props:e,variant:"source",valueType:"number"});class Ns{constructor(){h(this,"type","static")}create(n){switch(n.type){case tn.TYPE:return new tn(n.props);case de.TYPE:return new de(n.props);case fe.TYPE:return new fe(n.props);case pe.TYPE:return new pe(n.props);case ge.TYPE:return new ge(n.props);default:return null}}}const fr=p.z.object({data:p.z.array(d.Lt),offsets:p.z.array(p.z.number()).optional().default([])});class tn extends _{constructor(t){super(t);h(this,"data");h(this,"schema",fr);this.data=this.props.data.map((r,s)=>new d.Z({data:r,dataType:d.g.FLOAT32,timeRange:d.E.ZERO,sampleOffset:this.props.offsets[s]??0}))}async value(){return[l.H.max(this.data.map(r=>r.bounds)),this.data]}}h(tn,"TYPE","static-series");const Is=fr.extend({rate:d.$.z,yOffset:p.z.number().optional().default(0),scroll:p.z.number().optional().default(0),startPosition:p.z.number().optional().default(0),scrollBounds:p.z.boolean().optional().default(!1)});class de extends _{constructor(t){super(t);h(this,"schema",Is);h(this,"position");h(this,"interval");h(this,"data");this.position=this.props.startPosition,this.start(this.props.rate),this.data=this.props.data.map((r,s)=>new d.Z({data:r,dataType:d.g.FLOAT32,timeRange:d.E.ZERO,sampleOffset:this.props.offsets[s]??0}))}async value(){const t=this.data.map(s=>s.slice(0,this.position));if(this.props.scrollBounds){const s=t[0].data[this.position-this.props.scroll<0?0:this.position-this.props.scroll],a=t[0].data[this.position-1];return[{lower:Number(s),upper:Number(a)},t]}return[l.H.max(t.map(s=>s.bounds)),t]}start(t){this.interval!=null&&clearInterval(this.interval),this.interval=setInterval(()=>{var r;(r=this.notify)==null||r.call(this),this.position++},t.period.milliseconds)}async cleanup(){clearInterval(this.interval),this.interval=void 0}}h(de,"TYPE","iterative-series");const $s=p.z.number();class fe extends _{constructor(){super(...arguments);h(this,"schema",$s)}async value(){return this.props}}h(fe,"TYPE","static-numeric");const Us=p.z.string();class pe extends _{constructor(){super(...arguments);h(this,"schema",Us)}async value(){return this.props}}h(pe,"TYPE","static-string");const Bs=l.crudeZ;class ge extends _{constructor(){super(...arguments);h(this,"schema",Bs)}async value(){return new l.Color(this.props)}}h(ge,"TYPE","static-color");const Di=e=>({type:tn.TYPE,props:e,variant:"source",valueType:"series"}),Li=e=>({type:de.TYPE,props:e,variant:"source",valueType:"series"}),Oi=e=>({type:fe.TYPE,props:e,variant:"source",valueType:"number"}),Ai=e=>({type:pe.TYPE,props:e,variant:"source",valueType:"string"}),Zi=e=>({type:ge.TYPE,props:e,variant:"source",valueType:"color"}),Ni=["standard","scientific","engineering"],Gs=p.z.enum(Ni),Ii=(e,n,t)=>{if(Number.isNaN(e))return"NaN";if(e===1/0)return"∞";if(e===-1/0)return"-∞";if(t==="standard")return e.toFixed(n);if(e===0)return n===0?"0ᴇ0":`0.${"0".repeat(n)}ᴇ0`;let r;return t==="scientific"?r=Math.floor(Math.log10(Math.abs(e))):r=Math.floor(Math.log10(Math.abs(e))/3)*3,`${(e/10**r).toFixed(n)}ᴇ${r}`};class _s{constructor(){h(this,"type","transformer")}create(n){switch(n.type){case kt.TYPE:return new kt(n.props);case Rt.TYPE:return new Rt(n.props);case Mt.TYPE:return new Mt(n.props);case Yt.TYPE:return new Yt(n.props);case zt.TYPE:return new zt(n.props);case Dt.TYPE:return new Dt(n.props);case Lt.TYPE:return new Lt(n.props);case Ot.TYPE:return new Ot(n.props)}return null}}const $i=p.z.object({truthy:p.z.number().optional().default(1),falsy:p.z.number().optional().default(0)}),Fs=e=>({props:e,type:kt.TYPE,variant:"sink",valueType:"boolean"}),Kt=class Kt extends Ys{constructor(){super(...arguments);h(this,"schema",Kt.propsZ)}transform(t){return t?this.props.truthy:this.props.falsy}};h(Kt,"TYPE","boolean-numeric-converter-sink"),h(Kt,"propsZ",$i);let kt=Kt;const pr=p.z.object({trueBound:l.H.bounds}),Hs=e=>({props:e,type:Rt.TYPE,variant:"source",valueType:"boolean"}),Qt=class Qt extends pt{constructor(){super(...arguments);h(this,"schema",Qt.propsZ);h(this,"curr",null)}shouldNotify(t){const r=l.H.contains(this.props.trueBound,t)!==this.curr;return this.curr=l.H.contains(this.props.trueBound,t),r}transform(t){return this.curr=l.H.contains(this.props.trueBound,t),this.curr}};h(Qt,"TYPE","boolean-source"),h(Qt,"propsZ",pr);let Rt=Qt;const qs=p.z.object({}),Jt=class Jt extends Ms{constructor(){super(...arguments);h(this,"schema",Jt.propsZ)}transform(t){return Object.values(t).reduce((r,s)=>r+s,0)/Object.keys(t).length}};h(Jt,"TYPE","mean"),h(Jt,"propsZ",qs);let Mt=Jt;const Ui=e=>({props:e,type:Mt.TYPE,variant:"source",valueType:"boolean"}),js=p.z.object({trueVariant:d.variantZ.optional().default("success")}),te=class te extends pt{constructor(){super(...arguments);h(this,"schema",te.propsZ)}transform(t){return t.variant===this.props.trueVariant}};h(te,"TYPE","boolean-status"),h(te,"propsZ",js);let Yt=te;const Bi=e=>({props:e,type:Yt.TYPE,variant:"source",valueType:"boolean"}),gr=p.z.object({precision:p.z.number().optional().default(2),prefix:p.z.string().optional().default(""),suffix:p.z.string().optional().default(""),notation:Gs.optional().default("standard")}),ee=class ee extends pt{constructor(){super(...arguments);h(this,"schema",ee.propsZ)}transform(t){return`${this.props.prefix}${Ii(t,this.props.precision,this.props.notation)}${this.props.suffix}`}};h(ee,"TYPE","stringify-number"),h(ee,"propsZ",gr);let zt=ee;const Ws=e=>({props:e,type:zt.TYPE,variant:"source",valueType:"string"}),mr=p.z.object({windowSize:p.z.number().optional().default(5)});class Dt extends pt{constructor(){super(...arguments);h(this,"schema",mr);h(this,"values",[])}transform(t){return this.props.windowSize<2?t:this.values.reduce((r,s)=>r+s,0)/this.values.length}shouldNotify(t){return this.props.windowSize<2?!0:(this.values.length>this.props.windowSize&&(this.values=[]),this.values.push(t),this.values.length===this.props.windowSize)}}h(Dt,"TYPE","rolling-average"),h(Dt,"propsZ",qs);const Vs=e=>({props:e,type:Dt.TYPE,variant:"source",valueType:"number"}),Xs=p.z.object({gradient:l.gradientZ}),ne=class ne extends pt{constructor(){super(...arguments);h(this,"schema",ne.propsZ)}transform(t){return l.fromGradient(this.props.gradient,t)}};h(ne,"TYPE","color-gradient"),h(ne,"propsZ",Xs);let Lt=ne;const Ks=e=>({props:e,type:Lt.TYPE,variant:"source",valueType:"color"}),Qs=p.z.object({scale:l.b.transform}),re=class re extends pt{constructor(){super(...arguments);h(this,"schema",re.propsZ)}transform(t){const{offset:r,scale:s}=this.props.scale;return t*s+r}};h(re,"TYPE","scale-number"),h(re,"propsZ",Qs);let Ot=re;const Js=e=>({props:e,type:Ot.TYPE,variant:"source",valueType:"number"});class yr{constructor(n){h(this,"factories");h(this,"type","compound");this.factories=n}add(n){this.factories=[...this.factories.filter(t=>t.type!==n.type),n]}create(n){for(const t of this.factories){const r=t.create(n);if(r!=null)return r}return null}}const ta=e=>{const n=[new _s,new Ns,new Cs],t=new yr(n);return e!=null&&t.add(new Ls(e)),t.add(new cr(t)),t};let ea=class na{constructor(n,t){h(this,"factory");h(this,"key");h(this,"parent");this.factory=n,this.key=d.xt.id(),this.parent=t}child(n,t){const r=new yr([...this.factory.factories,...d.A(n)]);return r.add(new cr(r)),new na(r,t)}create(n){const t=this.factory.create(n);if(t==null)throw new d.xe(`Telemetry service could not find a source for type ${n.type}`);return t}};const wr="pluto-telem-context",Rn=e=>e.get(wr),ra=(e,n)=>e.set(wr,n),sa=(e,n,t)=>{var a;const r=Rn(e);if(r!=null&&t!=null&&r.key===((a=t==null?void 0:t.parent)==null?void 0:a.key))return t;const s=r.child(n,r);return e.set(wr,s),s};class aa{constructor(n,t,r){h(this,"spec");h(this,"wrapped");h(this,"prevProv");this.wrapped=n,this.spec=r,this.prevProv=t}shouldUpdate(n,t){return this.prevProv.key!==n.key||!d._.equal(this.spec,t)}}class $r extends aa{async value(){return await this.wrapped.value()}async cleanup(){var n,t;await((t=(n=this.wrapped).cleanup)==null?void 0:t.call(n))}onChange(n){return this.wrapped.onChange(n)}}class Ur extends aa{async set(n){return await this.wrapped.set(n)}async cleanup(){var n,t;await((t=(n=this.wrapped).cleanup)==null?void 0:t.call(n))}}const H=async(e,n,t)=>{var s;const r=Rn(e);if(t instanceof $r){if(!t.shouldUpdate(r,n))return t;await((s=t.cleanup)==null?void 0:s.call(t))}return new $r(r.create(n),r,n)},ze=async(e,n,t)=>{var s;const r=Rn(e);if(t instanceof Ur){if(!t.shouldUpdate(r,n))return t;await((s=t.cleanup)==null?void 0:s.call(t))}return new Ur(r.create(n),r,n)},ia=p.z.object({include:p.z.string().array().optional(),exclude:p.z.string().array().optional(),level:p.z.enum(d.g$1.LOG_LEVELS).optional().default("info")}),_n="alamos-provider";var Bn;let Fn=(Bn=class extends d.Composite{constructor(){super(...arguments);h(this,"schema",ia)}async afterUpdate(t){if(t.getOptional(_n)!=null)return;const s=[],{include:a,exclude:i,level:o}=this.state;(a!=null||i!=null)&&s.push(d.g$1.logLevelKeyFiler({include:a,exclude:i})),o!=null&&s.push(d.g$1.logThresholdFilter(o)),s.length===0&&s.push(()=>!1),this.internal.ins=new d.g$1.Instrumentation({key:"aether",logger:new d.g$1.Logger({filters:s})}),t.set(_n,this.internal.ins)}},h(Bn,"TYPE","alamos.Provider"),Bn);const De=(e,n)=>{const t=e.get(_n);if(t==null)throw new Error("No instrumentation provider");return n==null?t:t.child(n)},Gi={[Fn.TYPE]:Fn},oa=(e,n)=>e.dataType.isVariable||e.dataType.equals(d.g.UINT8)?e:(n==null&&e.dataType.equals(d.g.TIMESTAMP)&&(n=BigInt(e.data[0])),e.convert(d.g.FLOAT32,n)),_i=e=>e.isVariable||e.equals(d.g.UINT8)?e:d.g.FLOAT32,la=()=>({purgedSeries:0,purgedBytes:d.x.bytes(0)}),ca={instrumentation:d.g$1.NOOP,staleEntryThreshold:d.w.seconds(20)};class Fi{constructor(n){h(this,"data",[]);h(this,"props");this.props={...ca,...n}}write(n){n.length!==0&&(n.forEach(t=>this.writeOne(oa(t))),this.checkIntegrity(n))}dirtyRead(n){const t=this.data.filter(({data:i})=>i.timeRange.overlapsWith(n)).map(({data:i})=>i);if(t.length===0)return{series:[],gaps:[n]};const r=t.map((i,o)=>o===0?d.E.ZERO:new d.E(t[o-1].timeRange.end,i.timeRange.start)).filter(i=>!i.isZero&&i.isValid),s=new d.E(n.start,t[0].timeRange.start),a=new d.E(t[t.length-1].timeRange.end,n.end);return s.isValid&&!s.isZero&&r.unshift(s),a.isValid&&!a.isZero&&r.push(a),{series:t,gaps:r}}gc(){const{staleEntryThreshold:n}=this.props,t=la(),r=this.data.filter(s=>{const a=s.data.refCount>0||d.m.since(s.addedAt).lessThan(n);return a||(t.purgedBytes=t.purgedBytes.add(s.data.byteCapacity)),a});return t.purgedSeries=this.data.length-r.length,this.data=r,t}close(){this.data=[]}writeOne(n){const{instrumentation:{L:t}}=this.props;if(n.length===0)return;const r=l.H.buildInsertionPlan(this.data.map(c=>c.data.alignmentBounds),n.alignmentBounds);if(r===null)return t.debug("Found no viable insertion plan",{inserting:n.digest,cacheContents:this.data.map(c=>c.data.digest)});const{removeBefore:s,removeAfter:a,insertInto:i,deleteInBetween:o}=r;n=n.slice(s,n.data.length-Number(a)),n.length!==0&&this.data.splice(i,o,{data:n,addedAt:d.m.now()})}checkIntegrity(n){const{instrumentation:{L:t}}=this.props,r=this.data.map(a=>a.data.alignmentBounds);if(r.some((a,i)=>r.some((o,c)=>i===c?!1:l.H.overlapsWith(a,o))))throw t.debug("Cache is in an invalid state - bounds overlap!",()=>({write:n.map(a=>a.digest),cacheContents:this.data.map(a=>a.data.digest)})),new Error("Invalid state")}}const Hi=100,qi=1e6,ji=1e4,Wi=100,Vi=40;class Xi{constructor(n){h(this,"props");h(this,"counter",0);h(this,"curr");h(this,"avgRate",0);h(this,"timeOfLastWrite");h(this,"totalWrites",0);h(this,"now",()=>d.m.now());this.props=n,this.curr=null,n.testingNow!=null&&(this.now=n.testingNow),this.timeOfLastWrite=this.now()}get length(){var n;return((n=this.curr)==null?void 0:n.length)??0}get leadingBuffer(){return this.curr}write(n){const t=n.flatMap(r=>this._write(r));return{flushed:t.flatMap(r=>r.flushed),allocated:t.flatMap(r=>r.allocated)}}allocate(n,t,r){this.counter++;const s=this.props.dataType.isVariable,a=this.props.dataType.equals(d.g.TIMESTAMP);return d.Z.alloc({capacity:s?n*Vi:n,dataType:_i(this.props.dataType),timeRange:r.range(d.m.MAX),sampleOffset:a?BigInt(r.valueOf()):0,glBufferUsage:"dynamic",alignment:t,key:`dynamic-${this.counter}`})}_write(n){const t=this.nextBufferSize(),r={flushed:[],allocated:[]};if(this.curr==null)this.curr=this.allocate(t,n.alignment,this.now()),r.allocated.push(this.curr);else if(Math.abs(Number(this.curr.alignment+BigInt(this.curr.length)-n.alignment))>1){const c=this.now();this.curr.timeRange.end=c,r.flushed.push(this.curr),this.curr=this.allocate(t,n.alignment,c),r.allocated.push(this.curr)}const s=oa(n,this.curr.sampleOffset),a=this.curr.write(s);if(a===n.length)return this.updateAvgRate(n),r;const i=this.now();this.curr.timeRange.end=i,r.flushed.push(this.curr),this.curr=this.allocate(t,n.alignment+BigInt(a),i),r.allocated.push(this.curr);const o=this._write(n.slice(a));return r.flushed.push(...o.flushed),r.allocated.push(...o.allocated),r}updateAvgRate(n){if(typeof this.props.dynamicBufferSize=="number")return;const t=n.length/this.now().span(this.timeOfLastWrite).seconds;this.totalWrites>0&&isFinite(t)&&t>0&&(this.avgRate=(this.avgRate*(this.totalWrites-1)+t)/this.totalWrites),this.totalWrites++,this.timeOfLastWrite=this.now()}nextBufferSize(){const{dynamicBufferSize:n}=this.props;if(typeof n=="number")return n;if(this.totalWrites<Wi)return ji;const t=l.G$1.roundToNearestMagnitude(this.avgRate*n.seconds);return Math.round(Math.max(Math.min(t,qi),Hi))}close(){this.curr=null}}class Ki{constructor(n){h(this,"channel");h(this,"closed",!1);h(this,"ins");h(this,"static");h(this,"dynamic");this.channel=n.channel,this.ins=n.instrumentation??d.g$1.NOOP,this.static=new Fi(n),this.dynamic=new Xi({dynamicBufferSize:n.dynamicBufferSize,dataType:this.channel.dataType})}writeDynamic(n){if(this.closed)return this.ins.L.warn(`Ignoring attempted dynamic write to a closed cache for channel ${this.channel.name}`),[];const{flushed:t,allocated:r}=this.dynamic.write(n);return t.length>0&&this.static.write(t),r}get leadingBuffer(){return this.dynamic.leadingBuffer}writeStatic(n){if(this.closed)return this.ins.L.warn(`Ignoring attempted static write to a closed cache for channel ${this.channel.name}`);this.static.write(n)}read(n){return this.closed?(this.ins.L.warn(`Ignoring attempted dirty read from a closed cache for channel ${this.channel.name}`),{series:[],gaps:[]}):this.static.dirtyRead(n)}gc(){return this.closed?(this.ins.L.warn(`Ignoring attempted garbage collection on a closed cache for channel ${this.channel.name}`),{purgedSeries:0,purgedBytes:d.x.bytes(0)}):this.static.gc()}close(){this.closed=!0,this.dynamic.close(),this.static.close()}}const Qi=d.S$1.seconds(60);class Ji{constructor(n){h(this,"props");h(this,"cache",new Map);h(this,"gcInterval");this.props={dynamicBufferSize:Qi,gcInterval:d.S$1.seconds(30),...ca,...n},this.gcInterval=setInterval(()=>this.gc(),this.props.gcInterval.milliseconds)}async populateMissing(n){const{instrumentation:t,channelRetriever:r,dynamicBufferSize:s}=this.props,a=[];for(const o of n)this.cache.has(o)||a.push(o);if(a.length===0)return;const i=await r.retrieve(a);for(const o of i){const c=new Ki({channel:o,dynamicBufferSize:s,instrumentation:t.child(`cache-${o.name}-${o.key}`)});this.cache.has(o.key)||this.cache.set(o.key,c)}}get(n){const t=this.cache.get(n);if(t!=null)return t;throw new d.xe(`cache entry for ${n} not found`)}gc(){const{instrumentation:{L:n}}=this.props;n.info("starting garbage collection");const t=la();this.cache.forEach(r=>{const s=r.gc();t.purgedSeries+=s.purgedSeries,t.purgedBytes=t.purgedBytes.add(s.purgedBytes)}),n.info("garbage collection complete",{purgedSeries:t.purgedSeries,purgedBytes:t.purgedBytes.toString()},!0)}close(){clearInterval(this.gcInterval),this.cache.forEach(n=>n.close()),this.cache.clear()}}class en{constructor(n,t){h(this,"channel");h(this,"data");this.channel=n,this.data=t}get timeRange(){if(this.data.length===0)return d.K.ZERO;const n=this.data[0].timeRange,t=this.data[this.data.length-1].timeRange;return new d.K(n.start,t.end)}get digest(){return{channel:this.channel.key,timeRange:this.timeRange.toPrettyString(),series:this.data.map(n=>n.digest)}}}const Dn=e=>e.map(n=>n.digest);class to{constructor(n){h(this,"props");h(this,"debouncedRead");h(this,"guarded",{mu:new d.Mutex,requests:new Map});this.props={instrumentation:d.g$1.NOOP,batchDebounce:d.w.milliseconds(50),...n},this.debouncedRead=d.o(()=>{this.batchRead()},this.props.batchDebounce.milliseconds)}async read(n,t){const{instrumentation:{L:r},cache:s}=this.props;r.debug("starting read",{tr:n.toPrettyString(),channels:t});const a=performance.now(),i=new Map,o={};await s.populateMissing(t);try{for(const f of t){const g=s.get(f),{series:m,gaps:w}=g.read(n);w.length===0&&(o[f]=new en(g.channel,m)),w.forEach(b=>{const v=i.get(b.toString());v==null?i.set(b.toString(),[b,new Set([f])]):i.set(b.toString(),[b,new Set([...v[1],f])])})}if(i.size===0)return r.debug("read satisfied by cache",()=>({tr:n.toPrettyString(),channels:t,responses:Dn(Object.values(o)),time:d.w.milliseconds(performance.now()-a).toString()})),o;r.debug("read cache miss",()=>({tr:n.toPrettyString(),channels:t,toFetch:Array.from(i.values()).map(([f,g])=>({timeRange:f.toPrettyString(),channels:g})),responses:Dn(Object.values(o))}));const{mu:c,requests:u}=this.guarded;for(const[,[f,g]]of i)await new Promise((m,w)=>{c.runExclusive(async()=>{u.set([f,g],{resolve:m,reject:w}),this.debouncedRead()})})}catch(c){throw r.error("read failed",{tr:n.toPrettyString(),channels:t,error:c}),c}for(const c of t){const u=s.get(c),{series:f}=u.read(n);o[c]=new en(u.channel,f)}return r.debug("read satisfied by fetch",()=>({tr:n.toPrettyString(),channels:t,responses:Dn(Object.values(o)),time:d.w.milliseconds(performance.now()-a).toString()})),o}async batchRead(){const{instrumentation:{L:n},readRemote:t,cache:r}=this.props,{mu:s,requests:a}=this.guarded;await s.runExclusive(async()=>{const i=[];try{a.forEach((o,c)=>{const[u,f]=c,g=i.find(([m])=>m.start.span(u.start).lessThan(d.w.milliseconds(5))&&m.end.span(u.end).lessThan(d.w.milliseconds(5)));g==null?i.push([u,f]):g[1]=new Set([...g[1],...f])}),n.debug("batch read",{toFetch:i.map(([o,c])=>({timeRange:o.toPrettyString(),channels:c}))});for(const[o,c]of i){const u=Array.from(c),f=await t(o,u);u.forEach(g=>{const m=r.get(g),w=f.get(g);m.writeStatic(w.series)})}a.forEach(o=>o.resolve())}catch(o){n.error("batch read failed",{error:o},!0),a.forEach(c=>c.reject(o))}finally{a.clear()}})}}class eo{constructor(n){h(this,"props");h(this,"mu",new d.Mutex);h(this,"listeners",new Map);h(this,"streamerRunLoop",null);h(this,"streamer",null);h(this,"closed",!1);this.props={instrumentation:d.g$1.NOOP,...n}}async stream(n,t){const{cache:r,instrumentation:{L:s}}=this.props;return await r.populateMissing(t),await this.mu.runExclusive(async()=>{s.debug("adding stream handler",{keys:t}),this.listeners.set(n,{valid:!0,keys:t});const a={};for(const i of t){const o=r.get(i),c=o.leadingBuffer!=null?[o.leadingBuffer]:[];a[i]=new en(o.channel,c)}return n(a),await this.updateStreamer(),async()=>await this.removeStreamHandler(n)})}async removeStreamHandler(n){const{instrumentation:{L:t}}=this.props;await this.mu.runExclusive(()=>{const r=this.listeners.get(n);r!=null&&(r.valid=!1)}),setTimeout(()=>{this.mu.runExclusive(async()=>{if(t.debug("removing stream handler"),this.listeners.delete(n))return await this.updateStreamer();t.warn("attempted to remove non-existent stream handler")})},5e3)}async updateStreamer(){var a,i;if(this.closed)return;const{instrumentation:{L:n},core:t}=this.props,r=new Set;if(this.listeners.forEach(o=>o.keys.forEach(c=>r.add(c))),r.size===0){n.info("no keys to stream, closing streamer"),(a=this.streamer)==null||a.close(),this.streamerRunLoop!=null&&await this.streamerRunLoop,this.streamer=null,n.info("streamer closed successfully");return}const s=Array.from(r);if(d.F.primitiveArrays(s,((i=this.streamer)==null?void 0:i.keys)??[])===d.F.EQUAL){n.debug("streamer keys unchanged",{keys:s});return}this.streamer==null&&(n.info("creating new streamer",{keys:s}),this.streamer=await t.openStreamer(s),this.streamerRunLoop=this.runStreamer(this.streamer)),n.debug("updating streamer",{prev:this.streamer.keys,next:s});try{await this.streamer.update(s)}catch(o){throw n.error("failed to update streamer",{error:o}),o}}async runStreamer(n){const{cache:t,instrumentation:{L:r}}=this.props;try{for await(const s of n){const a=[];for(const i of s.keys){const o=s.get(i),c=t.get(i),u=c.writeDynamic(o.series);a.push(new en(c.channel,u))}this.listeners.forEach((i,o)=>{if(!i.valid)return;const c=a.filter(f=>i.keys.includes(f.channel.key));if(c.length===0)return;const u=Object.fromEntries(c.map(f=>[f.channel.key,f]));o(u)})}}catch(s){throw r.error("streamer run loop failed",{error:s},!0),s}}async close(){var n;(n=this.streamer)==null||n.close(),this.streamerRunLoop!=null&&await this.streamerRunLoop,this.closed=!0}}class no{constructor(){h(this,"key",d.xt.id())}async retrieveChannel(){return null}async read(){return{}}async stream(){return async()=>{}}async close(){}}class ro{constructor({instrumentation:n,core:t}){h(this,"key",d.xt.id());h(this,"ins");h(this,"cache");h(this,"reader");h(this,"streamer");h(this,"channelRetriever");this.ins=n??d.g$1.NOOP,this.channelRetriever=t.channels.createDebouncedBatchRetriever(10),this.cache=new Ji({channelRetriever:this.channelRetriever,instrumentation:this.ins.child("cache")}),this.reader=new to({cache:this.cache,readRemote:async(r,s)=>await t.read(r,s),instrumentation:this.ins.child("reader")}),this.streamer=new eo({cache:this.cache,core:t,instrumentation:this.ins.child("streamer")})}async retrieveChannel(n){const t=await this.channelRetriever.retrieve([n]);if(t.length===0)throw new d.se(`channel ${n} not found`);return t[0]}async read(n,t){return await this.reader.read(n,t)}async stream(n,t){return await this.streamer.stream(n,t)}async close(){this.ins.L.info("closing client",{key:this.key}),await this.streamer.close(),this.cache.close()}}const Tr=p.z.object({}),se=class se extends d.Composite{constructor(){super(...arguments);h(this,"schema",se.stateZ);h(this,"prevClient",null)}async afterUpdate(t){const r=Me(t),s=De(t,"telem");if(this.internal.instrumentation=s.child("provider"),!(r!==this.prevClient))return;this.prevClient=r;const i=r==null?new no:new ro({core:r,instrumentation:s}),o=ta(i),c=new ea(o);ra(t,c)}};h(se,"TYPE","telem.Provider"),h(se,"stateZ",Tr);let At=se;const ua={[At.TYPE]:At},so=Object.freeze(Object.defineProperty({__proto__:null,AbstractSink:kn,AbstractSource:_,Base:Pn,BaseProvider:At,BooleanStatus:Yt,ChannelData:ue,ColorGradient:Lt,CompoundTelemFactory:yr,Context:ea,FixedColorSource:ge,FixedNumber:fe,FixedString:pe,IterativeSeries:de,Mean:Mt,MultiSourceTransformer:Ms,NoopFactory:Cs,PipelineFactory:cr,REGISTRY:ua,RemoteFactory:Ls,RollingAverage:Dt,ScaleNumber:Ot,SetPoint:kt,SinkPipeline:le,SourcePipeline:oe,StaticFactory:Ns,StreamChannelData:he,StreamChannelValue:ce,StringifyNumber:zt,TransformerFactory:_s,UnarySinkTransformer:Ys,UnarySourceTransformer:pt,WithinBounds:Rt,booleanSinkSpecZ:En,booleanSinkTransformerSpecZ:ki,booleanSourceSpecZ:rr,booleanSourceTransformerSpecZ:Ri,booleanStatus:Bi,booleanStatusProps:js,channelData:Os,colorGradient:Ks,colorGradientProps:Xs,colorSourceSpecZ:sr,connectionZ:or,createFactory:ta,fixedArray:Di,fixedColor:Zi,fixedColorSourcePropsZ:Bs,fixedNumber:Oi,fixedNumberPropsZ:$s,fixedSeriesPropsZ:fr,fixedString:Ai,fixedStringPropsZ:Us,iterativeArray:Li,iterativeSeriesPropsZ:Is,mean:Ui,noopBooleanSinkSpec:vn,noopBooleanSourceSpec:er,noopColorSourceSpec:Sn,noopNumericSinkSpec:bs,noopNumericSourceSpec:xs,noopSeriesSourceSpec:Ss,noopStatusSourceSpec:nr,noopStringSourceSpec:vs,numberSinkSpecZ:Rs,numberSourceSpecZ:ks,providerStateZ:Tr,rollingAverage:Vs,rollingAverageProps:mr,scaleNumber:Js,scaleNumberProps:Qs,seriesSourceSpecZ:Je,setContext:ra,setpoint:Fs,sinkPipeline:Ds,sinkPipelinePropsZ:ur,sinkSpecZ:Cn,sinkTransformerSpecZ:Ps,sourcePipeline:zs,sourcePipelinePropsZ:lr,sourceSpecZ:ot,sourceTransformerSpecZ:Es,specZ:Ye,statusSourceSpecZ:ar,streamChannelData:As,streamChannelValue:Zs,streamChannelValuePropsZ:hr,stringSourceSpecZ:ir,stringifyNumber:Ws,stringifyNumberProps:gr,useChildContext:sa,useContext:Rn,useSink:ze,useSource:H,withinBounds:Hs,withinBoundsProps:pr},Symbol.toStringTag,{value:"Module"})),ha=p.z.object({key:p.z.string(),size:p.z.number(),order:p.z.number(),loc:l.K.outer});p.z.record(ha);const ut=(e,n)=>Object.values(n).filter(({loc:t})=>t===e).sort((t,r)=>r.order-t.order),ao=(e,n,t)=>{const r=n[e];if(r==null)return l.G.ZERO;const s=l.K.construct(r.loc),a=ut(s,n),i=l.K.construct(l.g.swap(l.K.direction(s))),o=ut(i,n),c=a.findIndex(({key:g})=>g===e),u=a.slice(0,c).reduce((g,{size:m})=>g+m,0),f=o.reduce((g,{size:m})=>g+m,0);switch(s){case"left":return l.G.translate(l.Tt.topLeft(t),[u,f]);case"right":return l.G.translate(l.Tt.topRight(t),[u-r.size,f]);case"top":return l.G.translate(l.Tt.topLeft(t),[f,u]);default:return l.G.translate(l.Tt.bottomLeft(t),[f,-u-r.size])}},io=(e,n)=>{const t=ut("left",e),r=ut("right",e),s=ut("top",e),a=ut("bottom",e),i=t.reduce((f,{size:g})=>f+g,0),o=r.reduce((f,{size:g})=>f+g,0),c=s.reduce((f,{size:g})=>f+g,0),u=a.reduce((f,{size:g})=>f+g,0);return l.Tt.construct(l.G.translate(l.Tt.topLeft(n),{x:i,y:c}),l.Tt.width(n)-i-o,l.Tt.height(n)-c-u)};function _e(e,n){return e==null||n==null?NaN:e<n?-1:e>n?1:e>=n?0:NaN}function oo(e,n){return e==null||n==null?NaN:n<e?-1:n>e?1:n>=e?0:NaN}function br(e){let n,t,r;e.length!==2?(n=_e,t=(o,c)=>_e(e(o),c),r=(o,c)=>e(o)-c):(n=e===_e||e===oo?e:lo,t=e,r=e);function s(o,c,u=0,f=o.length){if(u<f){if(n(c,c)!==0)return f;do{const g=u+f>>>1;t(o[g],c)<0?u=g+1:f=g}while(u<f)}return u}function a(o,c,u=0,f=o.length){if(u<f){if(n(c,c)!==0)return f;do{const g=u+f>>>1;t(o[g],c)<=0?u=g+1:f=g}while(u<f)}return u}function i(o,c,u=0,f=o.length){const g=s(o,c,u,f-1);return g>u&&r(o[g-1],c)>-r(o[g],c)?g-1:g}return{left:s,center:i,right:a}}function lo(){return 0}function co(e){return e===null?NaN:+e}const uo=br(_e),ho=uo.right;br(co).center;const fo=Math.sqrt(50),po=Math.sqrt(10),go=Math.sqrt(2);function nn(e,n,t){const r=(n-e)/Math.max(0,t),s=Math.floor(Math.log10(r)),a=r/Math.pow(10,s),i=a>=fo?10:a>=po?5:a>=go?2:1;let o,c,u;return s<0?(u=Math.pow(10,-s)/i,o=Math.round(e*u),c=Math.round(n*u),o/u<e&&++o,c/u>n&&--c,u=-u):(u=Math.pow(10,s)*i,o=Math.round(e/u),c=Math.round(n/u),o*u<e&&++o,c*u>n&&--c),c<o&&.5<=t&&t<2?nn(e,n,t*2):[o,c,u]}function mo(e,n,t){if(n=+n,e=+e,t=+t,!(t>0))return[];if(e===n)return[e];const r=n<e,[s,a,i]=r?nn(n,e,t):nn(e,n,t);if(!(a>=s))return[];const o=a-s+1,c=new Array(o);if(r)if(i<0)for(let u=0;u<o;++u)c[u]=(a-u)/-i;else for(let u=0;u<o;++u)c[u]=(a-u)*i;else if(i<0)for(let u=0;u<o;++u)c[u]=(s+u)/-i;else for(let u=0;u<o;++u)c[u]=(s+u)*i;return c}function Hn(e,n,t){return n=+n,e=+e,t=+t,nn(e,n,t)[2]}function qn(e,n,t){n=+n,e=+e,t=+t;const r=n<e,s=r?Hn(n,e,t):Hn(e,n,t);return(r?-1:1)*(s<0?1/-s:s)}function da(e,n){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(n).domain(e);break}return this}function xr(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function fa(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function Le(){}var me=.7,rn=1/me,Pt="\\s*([+-]?\\d+)\\s*",ye="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",X="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yo=/^#([0-9a-f]{3,8})$/,wo=new RegExp(`^rgb\\(${Pt},${Pt},${Pt}\\)$`),To=new RegExp(`^rgb\\(${X},${X},${X}\\)$`),bo=new RegExp(`^rgba\\(${Pt},${Pt},${Pt},${ye}\\)$`),xo=new RegExp(`^rgba\\(${X},${X},${X},${ye}\\)$`),vo=new RegExp(`^hsl\\(${ye},${X},${X}\\)$`),So=new RegExp(`^hsla\\(${ye},${X},${X},${ye}\\)$`),Br={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};xr(Le,Zt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Gr,formatHex:Gr,formatHex8:Co,formatHsl:Eo,formatRgb:_r,toString:_r});function Gr(){return this.rgb().formatHex()}function Co(){return this.rgb().formatHex8()}function Eo(){return pa(this).formatHsl()}function _r(){return this.rgb().formatRgb()}function Zt(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=yo.exec(e))?(t=n[1].length,n=parseInt(n[1],16),t===6?Fr(n):t===3?new U(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):t===8?Ie(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):t===4?Ie(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=wo.exec(e))?new U(n[1],n[2],n[3],1):(n=To.exec(e))?new U(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=bo.exec(e))?Ie(n[1],n[2],n[3],n[4]):(n=xo.exec(e))?Ie(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=vo.exec(e))?jr(n[1],n[2]/100,n[3]/100,1):(n=So.exec(e))?jr(n[1],n[2]/100,n[3]/100,n[4]):Br.hasOwnProperty(e)?Fr(Br[e]):e==="transparent"?new U(NaN,NaN,NaN,0):null}function Fr(e){return new U(e>>16&255,e>>8&255,e&255,1)}function Ie(e,n,t,r){return r<=0&&(e=n=t=NaN),new U(e,n,t,r)}function Po(e){return e instanceof Le||(e=Zt(e)),e?(e=e.rgb(),new U(e.r,e.g,e.b,e.opacity)):new U}function jn(e,n,t,r){return arguments.length===1?Po(e):new U(e,n,t,r??1)}function U(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}xr(U,jn,fa(Le,{brighter(e){return e=e==null?rn:Math.pow(rn,e),new U(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?me:Math.pow(me,e),new U(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new U(dt(this.r),dt(this.g),dt(this.b),sn(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:Hr,formatHex:Hr,formatHex8:ko,formatRgb:qr,toString:qr}));function Hr(){return`#${ht(this.r)}${ht(this.g)}${ht(this.b)}`}function ko(){return`#${ht(this.r)}${ht(this.g)}${ht(this.b)}${ht((isNaN(this.opacity)?1:this.opacity)*255)}`}function qr(){const e=sn(this.opacity);return`${e===1?"rgb(":"rgba("}${dt(this.r)}, ${dt(this.g)}, ${dt(this.b)}${e===1?")":`, ${e})`}`}function sn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function dt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ht(e){return e=dt(e),(e<16?"0":"")+e.toString(16)}function jr(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new j(e,n,t,r)}function pa(e){if(e instanceof j)return new j(e.h,e.s,e.l,e.opacity);if(e instanceof Le||(e=Zt(e)),!e)return new j;if(e instanceof j)return e;e=e.rgb();var n=e.r/255,t=e.g/255,r=e.b/255,s=Math.min(n,t,r),a=Math.max(n,t,r),i=NaN,o=a-s,c=(a+s)/2;return o?(n===a?i=(t-r)/o+(t<r)*6:t===a?i=(r-n)/o+2:i=(n-t)/o+4,o/=c<.5?a+s:2-a-s,i*=60):o=c>0&&c<1?0:i,new j(i,o,c,e.opacity)}function Ro(e,n,t,r){return arguments.length===1?pa(e):new j(e,n,t,r??1)}function j(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}xr(j,Ro,fa(Le,{brighter(e){return e=e==null?rn:Math.pow(rn,e),new j(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?me:Math.pow(me,e),new j(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,s=2*t-r;return new U(Ln(e>=240?e-240:e+120,s,r),Ln(e,s,r),Ln(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new j(Wr(this.h),$e(this.s),$e(this.l),sn(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 e=sn(this.opacity);return`${e===1?"hsl(":"hsla("}${Wr(this.h)}, ${$e(this.s)*100}%, ${$e(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Wr(e){return e=(e||0)%360,e<0?e+360:e}function $e(e){return Math.max(0,Math.min(1,e||0))}function Ln(e,n,t){return(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)*255}const vr=e=>()=>e;function Mo(e,n){return function(t){return e+t*n}}function Yo(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}function zo(e){return(e=+e)==1?ga:function(n,t){return t-n?Yo(n,t,e):vr(isNaN(n)?t:n)}}function ga(e,n){var t=n-e;return t?Mo(e,t):vr(isNaN(e)?n:e)}const Wn=function e(n){var t=zo(n);function r(s,a){var i=t((s=jn(s)).r,(a=jn(a)).r),o=t(s.g,a.g),c=t(s.b,a.b),u=ga(s.opacity,a.opacity);return function(f){return s.r=i(f),s.g=o(f),s.b=c(f),s.opacity=u(f),s+""}}return r.gamma=e,r}(1);function Do(e,n){n||(n=[]);var t=e?Math.min(n.length,e.length):0,r=n.slice(),s;return function(a){for(s=0;s<t;++s)r[s]=e[s]*(1-a)+n[s]*a;return r}}function Lo(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Oo(e,n){var t=n?n.length:0,r=e?Math.min(t,e.length):0,s=new Array(r),a=new Array(t),i;for(i=0;i<r;++i)s[i]=Sr(e[i],n[i]);for(;i<t;++i)a[i]=n[i];return function(o){for(i=0;i<r;++i)a[i]=s[i](o);return a}}function Ao(e,n){var t=new Date;return e=+e,n=+n,function(r){return t.setTime(e*(1-r)+n*r),t}}function we(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}function Zo(e,n){var t={},r={},s;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(s in n)s in e?t[s]=Sr(e[s],n[s]):r[s]=n[s];return function(a){for(s in t)r[s]=t[s](a);return r}}var Vn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,On=new RegExp(Vn.source,"g");function No(e){return function(){return e}}function Io(e){return function(n){return e(n)+""}}function ma(e,n){var t=Vn.lastIndex=On.lastIndex=0,r,s,a,i=-1,o=[],c=[];for(e=e+"",n=n+"";(r=Vn.exec(e))&&(s=On.exec(n));)(a=s.index)>t&&(a=n.slice(t,a),o[i]?o[i]+=a:o[++i]=a),(r=r[0])===(s=s[0])?o[i]?o[i]+=s:o[++i]=s:(o[++i]=null,c.push({i,x:we(r,s)})),t=On.lastIndex;return t<n.length&&(a=n.slice(t),o[i]?o[i]+=a:o[++i]=a),o.length<2?c[0]?Io(c[0].x):No(n):(n=c.length,function(u){for(var f=0,g;f<n;++f)o[(g=c[f]).i]=g.x(u);return o.join("")})}function Sr(e,n){var t=typeof n,r;return n==null||t==="boolean"?vr(n):(t==="number"?we:t==="string"?(r=Zt(n))?(n=r,Wn):ma:n instanceof Zt?Wn:n instanceof Date?Ao:Lo(n)?Do:Array.isArray(n)?Oo:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?Zo:we)(e,n)}function $o(e,n){return e=+e,n=+n,function(t){return Math.round(e*(1-t)+n*t)}}function Uo(e){return function(){return e}}function Bo(e){return+e}var Vr=[0,1];function xt(e){return e}function Xn(e,n){return(n-=e=+e)?function(t){return(t-e)/n}:Uo(isNaN(n)?NaN:.5)}function Go(e,n){var t;return e>n&&(t=e,e=n,n=t),function(r){return Math.max(e,Math.min(n,r))}}function _o(e,n,t){var r=e[0],s=e[1],a=n[0],i=n[1];return s<r?(r=Xn(s,r),a=t(i,a)):(r=Xn(r,s),a=t(a,i)),function(o){return a(r(o))}}function Fo(e,n,t){var r=Math.min(e.length,n.length)-1,s=new Array(r),a=new Array(r),i=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),n=n.slice().reverse());++i<r;)s[i]=Xn(e[i],e[i+1]),a[i]=t(n[i],n[i+1]);return function(o){var c=ho(e,o,1,r)-1;return a[c](s[c](o))}}function ya(e,n){return n.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Ho(){var e=Vr,n=Vr,t=Sr,r,s,a,i=xt,o,c,u;function f(){var m=Math.min(e.length,n.length);return i!==xt&&(i=Go(e[0],e[m-1])),o=m>2?Fo:_o,c=u=null,g}function g(m){return m==null||isNaN(m=+m)?a:(c||(c=o(e.map(r),n,t)))(r(i(m)))}return g.invert=function(m){return i(s((u||(u=o(n,e.map(r),we)))(m)))},g.domain=function(m){return arguments.length?(e=Array.from(m,Bo),f()):e.slice()},g.range=function(m){return arguments.length?(n=Array.from(m),f()):n.slice()},g.rangeRound=function(m){return n=Array.from(m),t=$o,f()},g.clamp=function(m){return arguments.length?(i=m?!0:xt,f()):i!==xt},g.interpolate=function(m){return arguments.length?(t=m,f()):t},g.unknown=function(m){return arguments.length?(a=m,g):a},function(m,w){return r=m,s=w,f()}}function wa(){return Ho()(xt,xt)}function qo(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function an(e,n){if((t=(e=n?e.toExponential(n-1):e.toExponential()).indexOf("e"))<0)return null;var t,r=e.slice(0,t);return[r.length>1?r[0]+r.slice(2):r,+e.slice(t+1)]}function Nt(e){return e=an(Math.abs(e)),e?e[1]:NaN}function jo(e,n){return function(t,r){for(var s=t.length,a=[],i=0,o=e[0],c=0;s>0&&o>0&&(c+o+1>r&&(o=Math.max(1,r-c)),a.push(t.substring(s-=o,s+o)),!((c+=o+1)>r));)o=e[i=(i+1)%e.length];return a.reverse().join(n)}}function Wo(e){return function(n){return n.replace(/[0-9]/g,function(t){return e[+t]})}}var Vo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function on(e){if(!(n=Vo.exec(e)))throw new Error("invalid format: "+e);var n;return new Cr({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}on.prototype=Cr.prototype;function Cr(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Cr.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 Xo(e){t:for(var n=e.length,t=1,r=-1,s;t<n;++t)switch(e[t]){case".":r=s=t;break;case"0":r===0&&(r=t),s=t;break;default:if(!+e[t])break t;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(s+1):e}var Ta;function Ko(e,n){var t=an(e,n);if(!t)return e+"";var r=t[0],s=t[1],a=s-(Ta=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,i=r.length;return a===i?r:a>i?r+new Array(a-i+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+an(e,Math.max(0,n+a-1))[0]}function Xr(e,n){var t=an(e,n);if(!t)return e+"";var r=t[0],s=t[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const Kr={"%":(e,n)=>(e*100).toFixed(n),b:e=>Math.round(e).toString(2),c:e=>e+"",d:qo,e:(e,n)=>e.toExponential(n),f:(e,n)=>e.toFixed(n),g:(e,n)=>e.toPrecision(n),o:e=>Math.round(e).toString(8),p:(e,n)=>Xr(e*100,n),r:Xr,s:Ko,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Qr(e){return e}var Jr=Array.prototype.map,ts=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Qo(e){var n=e.grouping===void 0||e.thousands===void 0?Qr:jo(Jr.call(e.grouping,Number),e.thousands+""),t=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",s=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?Qr:Wo(Jr.call(e.numerals,String)),i=e.percent===void 0?"%":e.percent+"",o=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(g){g=on(g);var m=g.fill,w=g.align,b=g.sign,v=g.symbol,S=g.zero,M=g.width,D=g.comma,P=g.precision,z=g.trim,A=g.type;A==="n"?(D=!0,A="g"):Kr[A]||(P===void 0&&(P=12),z=!0,A="g"),(S||m==="0"&&w==="=")&&(S=!0,m="0",w="=");var x=v==="$"?t:v==="#"&&/[boxX]/.test(A)?"0"+A.toLowerCase():"",Z=v==="$"?r:/[%p]/.test(A)?i:"",lt=Kr[A],Yn=/[defgprs%]/.test(A);P=P===void 0?6:/[gprs]/.test(A)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function Ze(E){var Q=x,I=Z,st,Ne,yt;if(A==="c")I=lt(E)+I,E="";else{E=+E;var wt=E<0||1/E<0;if(E=isNaN(E)?c:lt(Math.abs(E),P),z&&(E=Xo(E)),wt&&+E==0&&b!=="+"&&(wt=!1),Q=(wt?b==="("?b:o:b==="-"||b==="("?"":b)+Q,I=(A==="s"?ts[8+Ta/3]:"")+I+(wt&&b==="("?")":""),Yn){for(st=-1,Ne=E.length;++st<Ne;)if(yt=E.charCodeAt(st),48>yt||yt>57){I=(yt===46?s+E.slice(st+1):E.slice(st))+I,E=E.slice(0,st);break}}}D&&!S&&(E=n(E,1/0));var Tt=Q.length+E.length+I.length,q=Tt<M?new Array(M-Tt+1).join(m):"";switch(D&&S&&(E=n(q+E,q.length?M-I.length:1/0),q=""),w){case"<":E=Q+E+I+q;break;case"=":E=Q+q+E+I;break;case"^":E=q.slice(0,Tt=q.length>>1)+Q+E+I+q.slice(Tt);break;default:E=q+Q+E+I;break}return a(E)}return Ze.toString=function(){return g+""},Ze}function f(g,m){var w=u((g=on(g),g.type="f",g)),b=Math.max(-8,Math.min(8,Math.floor(Nt(m)/3)))*3,v=Math.pow(10,-b),S=ts[8+b/3];return function(M){return w(v*M)+S}}return{format:u,formatPrefix:f}}var Ue,ba,xa;Jo({thousands:",",grouping:[3],currency:["$",""]});function Jo(e){return Ue=Qo(e),ba=Ue.format,xa=Ue.formatPrefix,Ue}function tl(e){return Math.max(0,-Nt(Math.abs(e)))}function el(e,n){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Nt(n)/3)))*3-Nt(Math.abs(e)))}function nl(e,n){return e=Math.abs(e),n=Math.abs(n)-e,Math.max(0,Nt(n)-Nt(e))+1}function rl(e,n,t,r){var s=qn(e,n,t),a;switch(r=on(r??",f"),r.type){case"s":{var i=Math.max(Math.abs(e),Math.abs(n));return r.precision==null&&!isNaN(a=el(s,i))&&(r.precision=a),xa(r,i)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=nl(s,Math.max(Math.abs(e),Math.abs(n))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=tl(s))&&(r.precision=a-(r.type==="%")*2);break}}return ba(r)}function sl(e){var n=e.domain;return e.ticks=function(t){var r=n();return mo(r[0],r[r.length-1],t??10)},e.tickFormat=function(t,r){var s=n();return rl(s[0],s[s.length-1],t??10,r)},e.nice=function(t){t==null&&(t=10);var r=n(),s=0,a=r.length-1,i=r[s],o=r[a],c,u,f=10;for(o<i&&(u=i,i=o,o=u,u=s,s=a,a=u);f-- >0;){if(u=Hn(i,o,t),u===c)return r[s]=i,r[a]=o,n(r);if(u>0)i=Math.floor(i/u)*u,o=Math.ceil(o/u)*u;else if(u<0)i=Math.ceil(i*u)/u,o=Math.floor(o*u)/u;else break;c=u}return e},e}function va(){var e=wa();return e.copy=function(){return ya(e,va())},da.apply(e,arguments),sl(e)}function al(e,n){e=e.slice();var t=0,r=e.length-1,s=e[t],a=e[r],i;return a<s&&(i=t,t=r,r=i,i=s,s=a,a=i),e[t]=n.floor(s),e[r]=n.ceil(a),e}const An=new Date,Zn=new Date;function L(e,n,t,r){function s(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return s.floor=a=>(e(a=new Date(+a)),a),s.ceil=a=>(e(a=new Date(a-1)),n(a,1),e(a),a),s.round=a=>{const i=s(a),o=s.ceil(a);return a-i<o-a?i:o},s.offset=(a,i)=>(n(a=new Date(+a),i==null?1:Math.floor(i)),a),s.range=(a,i,o)=>{const c=[];if(a=s.ceil(a),o=o==null?1:Math.floor(o),!(a<i)||!(o>0))return c;let u;do c.push(u=new Date(+a)),n(a,o),e(a);while(u<a&&a<i);return c},s.filter=a=>L(i=>{if(i>=i)for(;e(i),!a(i);)i.setTime(i-1)},(i,o)=>{if(i>=i)if(o<0)for(;++o<=0;)for(;n(i,-1),!a(i););else for(;--o>=0;)for(;n(i,1),!a(i););}),t&&(s.count=(a,i)=>(An.setTime(+a),Zn.setTime(+i),e(An),e(Zn),Math.floor(t(An,Zn))),s.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?s.filter(r?i=>r(i)%a===0:i=>s.count(0,i)%a===0):s)),s}const ln=L(()=>{},(e,n)=>{e.setTime(+e+n)},(e,n)=>n-e);ln.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?L(n=>{n.setTime(Math.floor(n/e)*e)},(n,t)=>{n.setTime(+n+t*e)},(n,t)=>(t-n)/e):ln);ln.range;const J=1e3,F=J*60,tt=F*60,nt=tt*24,Er=nt*7,es=nt*30,Nn=nt*365,vt=L(e=>{e.setTime(e-e.getMilliseconds())},(e,n)=>{e.setTime(+e+n*J)},(e,n)=>(n-e)/J,e=>e.getUTCSeconds());vt.range;const Pr=L(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*J)},(e,n)=>{e.setTime(+e+n*F)},(e,n)=>(n-e)/F,e=>e.getMinutes());Pr.range;const il=L(e=>{e.setUTCSeconds(0,0)},(e,n)=>{e.setTime(+e+n*F)},(e,n)=>(n-e)/F,e=>e.getUTCMinutes());il.range;const kr=L(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*J-e.getMinutes()*F)},(e,n)=>{e.setTime(+e+n*tt)},(e,n)=>(n-e)/tt,e=>e.getHours());kr.range;const ol=L(e=>{e.setUTCMinutes(0,0,0)},(e,n)=>{e.setTime(+e+n*tt)},(e,n)=>(n-e)/tt,e=>e.getUTCHours());ol.range;const Oe=L(e=>e.setHours(0,0,0,0),(e,n)=>e.setDate(e.getDate()+n),(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*F)/nt,e=>e.getDate()-1);Oe.range;const Rr=L(e=>{e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n)},(e,n)=>(n-e)/nt,e=>e.getUTCDate()-1);Rr.range;const ll=L(e=>{e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n)},(e,n)=>(n-e)/nt,e=>Math.floor(e/nt));ll.range;function gt(e){return L(n=>{n.setDate(n.getDate()-(n.getDay()+7-e)%7),n.setHours(0,0,0,0)},(n,t)=>{n.setDate(n.getDate()+t*7)},(n,t)=>(t-n-(t.getTimezoneOffset()-n.getTimezoneOffset())*F)/Er)}const Mn=gt(0),cn=gt(1),cl=gt(2),ul=gt(3),It=gt(4),hl=gt(5),dl=gt(6);Mn.range;cn.range;cl.range;ul.range;It.range;hl.range;dl.range;function mt(e){return L(n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-e)%7),n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCDate(n.getUTCDate()+t*7)},(n,t)=>(t-n)/Er)}const Sa=mt(0),un=mt(1),fl=mt(2),pl=mt(3),$t=mt(4),gl=mt(5),ml=mt(6);Sa.range;un.range;fl.range;pl.range;$t.range;gl.range;ml.range;const Mr=L(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,n)=>{e.setMonth(e.getMonth()+n)},(e,n)=>n.getMonth()-e.getMonth()+(n.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Mr.range;const yl=L(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCMonth(e.getUTCMonth()+n)},(e,n)=>n.getUTCMonth()-e.getUTCMonth()+(n.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());yl.range;const rt=L(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n)},(e,n)=>n.getFullYear()-e.getFullYear(),e=>e.getFullYear());rt.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:L(n=>{n.setFullYear(Math.floor(n.getFullYear()/e)*e),n.setMonth(0,1),n.setHours(0,0,0,0)},(n,t)=>{n.setFullYear(n.getFullYear()+t*e)});rt.range;const ft=L(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n)},(e,n)=>n.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ft.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:L(n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/e)*e),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCFullYear(n.getUTCFullYear()+t*e)});ft.range;function wl(e,n,t,r,s,a){const i=[[vt,1,J],[vt,5,5*J],[vt,15,15*J],[vt,30,30*J],[a,1,F],[a,5,5*F],[a,15,15*F],[a,30,30*F],[s,1,tt],[s,3,3*tt],[s,6,6*tt],[s,12,12*tt],[r,1,nt],[r,2,2*nt],[t,1,Er],[n,1,es],[n,3,3*es],[e,1,Nn]];function o(u,f,g){const m=f<u;m&&([u,f]=[f,u]);const w=g&&typeof g.range=="function"?g:c(u,f,g),b=w?w.range(u,+f+1):[];return m?b.reverse():b}function c(u,f,g){const m=Math.abs(f-u)/g,w=br(([,,S])=>S).right(i,m);if(w===i.length)return e.every(qn(u/Nn,f/Nn,g));if(w===0)return ln.every(Math.max(qn(u,f,g),1));const[b,v]=i[m/i[w-1][2]<i[w][2]/m?w-1:w];return b.every(v)}return[o,c]}const[Tl,bl]=wl(rt,Mr,Mn,Oe,kr,Pr);function In(e){if(0<=e.y&&e.y<100){var n=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return n.setFullYear(e.y),n}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function $n(e){if(0<=e.y&&e.y<100){var n=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return n.setUTCFullYear(e.y),n}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function jt(e,n,t){return{y:e,m:n,d:t,H:0,M:0,S:0,L:0}}function xl(e){var n=e.dateTime,t=e.date,r=e.time,s=e.periods,a=e.days,i=e.shortDays,o=e.months,c=e.shortMonths,u=Wt(s),f=Vt(s),g=Wt(a),m=Vt(a),w=Wt(i),b=Vt(i),v=Wt(o),S=Vt(o),M=Wt(c),D=Vt(c),P={a:wt,A:Tt,b:q,B:li,c:null,d:os,e:os,f:Fl,g:tc,G:nc,H:Bl,I:Gl,j:_l,L:Ca,m:Hl,M:ql,p:ci,q:ui,Q:us,s:hs,S:jl,u:Wl,U:Vl,V:Xl,w:Kl,W:Ql,x:null,X:null,y:Jl,Y:ec,Z:rc,"%":cs},z={a:hi,A:di,b:fi,B:pi,c:null,d:ls,e:ls,f:oc,g:yc,G:Tc,H:sc,I:ac,j:ic,L:Pa,m:lc,M:cc,p:gi,q:mi,Q:us,s:hs,S:uc,u:hc,U:dc,V:fc,w:pc,W:gc,x:null,X:null,y:mc,Y:wc,Z:bc,"%":cs},A={a:Ze,A:E,b:Q,B:I,c:st,d:as,e:as,f:Nl,g:ss,G:rs,H:is,I:is,j:Ll,L:Zl,m:Dl,M:Ol,p:Yn,q:zl,Q:$l,s:Ul,S:Al,u:Pl,U:kl,V:Rl,w:El,W:Ml,x:Ne,X:yt,y:ss,Y:rs,Z:Yl,"%":Il};P.x=x(t,P),P.X=x(r,P),P.c=x(n,P),z.x=x(t,z),z.X=x(r,z),z.c=x(n,z);function x(T,C){return function(k){var y=[],$=-1,Y=0,B=T.length,G,ct,Ir;for(k instanceof Date||(k=new Date(+k));++$<B;)T.charCodeAt($)===37&&(y.push(T.slice(Y,$)),(ct=ns[G=T.charAt(++$)])!=null?G=T.charAt(++$):ct=G==="e"?" ":"0",(Ir=C[G])&&(G=Ir(k,ct)),y.push(G),Y=$+1);return y.push(T.slice(Y,$)),y.join("")}}function Z(T,C){return function(k){var y=jt(1900,void 0,1),$=lt(y,T,k+="",0),Y,B;if($!=k.length)return null;if("Q"in y)return new Date(y.Q);if("s"in y)return new Date(y.s*1e3+("L"in y?y.L:0));if(C&&!("Z"in y)&&(y.Z=0),"p"in y&&(y.H=y.H%12+y.p*12),y.m===void 0&&(y.m="q"in y?y.q:0),"V"in y){if(y.V<1||y.V>53)return null;"w"in y||(y.w=1),"Z"in y?(Y=$n(jt(y.y,0,1)),B=Y.getUTCDay(),Y=B>4||B===0?un.ceil(Y):un(Y),Y=Rr.offset(Y,(y.V-1)*7),y.y=Y.getUTCFullYear(),y.m=Y.getUTCMonth(),y.d=Y.getUTCDate()+(y.w+6)%7):(Y=In(jt(y.y,0,1)),B=Y.getDay(),Y=B>4||B===0?cn.ceil(Y):cn(Y),Y=Oe.offset(Y,(y.V-1)*7),y.y=Y.getFullYear(),y.m=Y.getMonth(),y.d=Y.getDate()+(y.w+6)%7)}else("W"in y||"U"in y)&&("w"in y||(y.w="u"in y?y.u%7:"W"in y?1:0),B="Z"in y?$n(jt(y.y,0,1)).getUTCDay():In(jt(y.y,0,1)).getDay(),y.m=0,y.d="W"in y?(y.w+6)%7+y.W*7-(B+5)%7:y.w+y.U*7-(B+6)%7);return"Z"in y?(y.H+=y.Z/100|0,y.M+=y.Z%100,$n(y)):In(y)}}function lt(T,C,k,y){for(var $=0,Y=C.length,B=k.length,G,ct;$<Y;){if(y>=B)return-1;if(G=C.charCodeAt($++),G===37){if(G=C.charAt($++),ct=A[G in ns?C.charAt($++):G],!ct||(y=ct(T,k,y))<0)return-1}else if(G!=k.charCodeAt(y++))return-1}return y}function Yn(T,C,k){var y=u.exec(C.slice(k));return y?(T.p=f.get(y[0].toLowerCase()),k+y[0].length):-1}function Ze(T,C,k){var y=w.exec(C.slice(k));return y?(T.w=b.get(y[0].toLowerCase()),k+y[0].length):-1}function E(T,C,k){var y=g.exec(C.slice(k));return y?(T.w=m.get(y[0].toLowerCase()),k+y[0].length):-1}function Q(T,C,k){var y=M.exec(C.slice(k));return y?(T.m=D.get(y[0].toLowerCase()),k+y[0].length):-1}function I(T,C,k){var y=v.exec(C.slice(k));return y?(T.m=S.get(y[0].toLowerCase()),k+y[0].length):-1}function st(T,C,k){return lt(T,n,C,k)}function Ne(T,C,k){return lt(T,t,C,k)}function yt(T,C,k){return lt(T,r,C,k)}function wt(T){return i[T.getDay()]}function Tt(T){return a[T.getDay()]}function q(T){return c[T.getMonth()]}function li(T){return o[T.getMonth()]}function ci(T){return s[+(T.getHours()>=12)]}function ui(T){return 1+~~(T.getMonth()/3)}function hi(T){return i[T.getUTCDay()]}function di(T){return a[T.getUTCDay()]}function fi(T){return c[T.getUTCMonth()]}function pi(T){return o[T.getUTCMonth()]}function gi(T){return s[+(T.getUTCHours()>=12)]}function mi(T){return 1+~~(T.getUTCMonth()/3)}return{format:function(T){var C=x(T+="",P);return C.toString=function(){return T},C},parse:function(T){var C=Z(T+="",!1);return C.toString=function(){return T},C},utcFormat:function(T){var C=x(T+="",z);return C.toString=function(){return T},C},utcParse:function(T){var C=Z(T+="",!0);return C.toString=function(){return T},C}}}var ns={"-":"",_:" ",0:"0"},O=/^\s*\d+/,vl=/^%/,Sl=/[\\^$*+?|[\]().{}]/g;function R(e,n,t){var r=e<0?"-":"",s=(r?-e:e)+"",a=s.length;return r+(a<t?new Array(t-a+1).join(n)+s:s)}function Cl(e){return e.replace(Sl,"\\$&")}function Wt(e){return new RegExp("^(?:"+e.map(Cl).join("|")+")","i")}function Vt(e){return new Map(e.map((n,t)=>[n.toLowerCase(),t]))}function El(e,n,t){var r=O.exec(n.slice(t,t+1));return r?(e.w=+r[0],t+r[0].length):-1}function Pl(e,n,t){var r=O.exec(n.slice(t,t+1));return r?(e.u=+r[0],t+r[0].length):-1}function kl(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.U=+r[0],t+r[0].length):-1}function Rl(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.V=+r[0],t+r[0].length):-1}function Ml(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.W=+r[0],t+r[0].length):-1}function rs(e,n,t){var r=O.exec(n.slice(t,t+4));return r?(e.y=+r[0],t+r[0].length):-1}function ss(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),t+r[0].length):-1}function Yl(e,n,t){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(t,t+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),t+r[0].length):-1}function zl(e,n,t){var r=O.exec(n.slice(t,t+1));return r?(e.q=r[0]*3-3,t+r[0].length):-1}function Dl(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.m=r[0]-1,t+r[0].length):-1}function as(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.d=+r[0],t+r[0].length):-1}function Ll(e,n,t){var r=O.exec(n.slice(t,t+3));return r?(e.m=0,e.d=+r[0],t+r[0].length):-1}function is(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.H=+r[0],t+r[0].length):-1}function Ol(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.M=+r[0],t+r[0].length):-1}function Al(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.S=+r[0],t+r[0].length):-1}function Zl(e,n,t){var r=O.exec(n.slice(t,t+3));return r?(e.L=+r[0],t+r[0].length):-1}function Nl(e,n,t){var r=O.exec(n.slice(t,t+6));return r?(e.L=Math.floor(r[0]/1e3),t+r[0].length):-1}function Il(e,n,t){var r=vl.exec(n.slice(t,t+1));return r?t+r[0].length:-1}function $l(e,n,t){var r=O.exec(n.slice(t));return r?(e.Q=+r[0],t+r[0].length):-1}function Ul(e,n,t){var r=O.exec(n.slice(t));return r?(e.s=+r[0],t+r[0].length):-1}function os(e,n){return R(e.getDate(),n,2)}function Bl(e,n){return R(e.getHours(),n,2)}function Gl(e,n){return R(e.getHours()%12||12,n,2)}function _l(e,n){return R(1+Oe.count(rt(e),e),n,3)}function Ca(e,n){return R(e.getMilliseconds(),n,3)}function Fl(e,n){return Ca(e,n)+"000"}function Hl(e,n){return R(e.getMonth()+1,n,2)}function ql(e,n){return R(e.getMinutes(),n,2)}function jl(e,n){return R(e.getSeconds(),n,2)}function Wl(e){var n=e.getDay();return n===0?7:n}function Vl(e,n){return R(Mn.count(rt(e)-1,e),n,2)}function Ea(e){var n=e.getDay();return n>=4||n===0?It(e):It.ceil(e)}function Xl(e,n){return e=Ea(e),R(It.count(rt(e),e)+(rt(e).getDay()===4),n,2)}function Kl(e){return e.getDay()}function Ql(e,n){return R(cn.count(rt(e)-1,e),n,2)}function Jl(e,n){return R(e.getFullYear()%100,n,2)}function tc(e,n){return e=Ea(e),R(e.getFullYear()%100,n,2)}function ec(e,n){return R(e.getFullYear()%1e4,n,4)}function nc(e,n){var t=e.getDay();return e=t>=4||t===0?It(e):It.ceil(e),R(e.getFullYear()%1e4,n,4)}function rc(e){var n=e.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+R(n/60|0,"0",2)+R(n%60,"0",2)}function ls(e,n){return R(e.getUTCDate(),n,2)}function sc(e,n){return R(e.getUTCHours(),n,2)}function ac(e,n){return R(e.getUTCHours()%12||12,n,2)}function ic(e,n){return R(1+Rr.count(ft(e),e),n,3)}function Pa(e,n){return R(e.getUTCMilliseconds(),n,3)}function oc(e,n){return Pa(e,n)+"000"}function lc(e,n){return R(e.getUTCMonth()+1,n,2)}function cc(e,n){return R(e.getUTCMinutes(),n,2)}function uc(e,n){return R(e.getUTCSeconds(),n,2)}function hc(e){var n=e.getUTCDay();return n===0?7:n}function dc(e,n){return R(Sa.count(ft(e)-1,e),n,2)}function ka(e){var n=e.getUTCDay();return n>=4||n===0?$t(e):$t.ceil(e)}function fc(e,n){return e=ka(e),R($t.count(ft(e),e)+(ft(e).getUTCDay()===4),n,2)}function pc(e){return e.getUTCDay()}function gc(e,n){return R(un.count(ft(e)-1,e),n,2)}function mc(e,n){return R(e.getUTCFullYear()%100,n,2)}function yc(e,n){return e=ka(e),R(e.getUTCFullYear()%100,n,2)}function wc(e,n){return R(e.getUTCFullYear()%1e4,n,4)}function Tc(e,n){var t=e.getUTCDay();return e=t>=4||t===0?$t(e):$t.ceil(e),R(e.getUTCFullYear()%1e4,n,4)}function bc(){return"+0000"}function cs(){return"%"}function us(e){return+e}function hs(e){return Math.floor(+e/1e3)}var bt,Ra;xc({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 xc(e){return bt=xl(e),Ra=bt.format,bt.parse,bt.utcFormat,bt.utcParse,bt}function vc(e){return new Date(e)}function Sc(e){return e instanceof Date?+e:+new Date(+e)}function Ma(e,n,t,r,s,a,i,o,c,u){var f=wa(),g=f.invert,m=f.domain,w=u(".%L"),b=u(":%S"),v=u("%I:%M"),S=u("%I %p"),M=u("%a %d"),D=u("%b %d"),P=u("%B"),z=u("%Y");function A(x){return(c(x)<x?w:o(x)<x?b:i(x)<x?v:a(x)<x?S:r(x)<x?s(x)<x?M:D:t(x)<x?P:z)(x)}return f.invert=function(x){return new Date(g(x))},f.domain=function(x){return arguments.length?m(Array.from(x,Sc)):m().map(vc)},f.ticks=function(x){var Z=m();return e(Z[0],Z[Z.length-1],x??10)},f.tickFormat=function(x,Z){return Z==null?A:u(Z)},f.nice=function(x){var Z=m();return(!x||typeof x.range!="function")&&(x=n(Z[0],Z[Z.length-1],x??10)),x?m(al(Z,x)):f},f.copy=function(){return ya(f,Ma(e,n,t,r,s,a,i,o,c,u))},f}function Cc(){return da.apply(Ma(Tl,bl,rt,Mr,Mn,Oe,kr,Pr,vt,Ra).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}const Yr=p.z.enum(["linear","time"]),zr=p.z.object({tickSpacing:p.z.number().default(75),type:Yr.optional().default("linear")}),Kn=e=>{const n=zr.parse(e);return kc[n.type](n)};class Ec{constructor(n){h(this,"props");this.props=n}generate({decimalToDataScale:n,size:t}){const r=[0,t],s=[new d.m(n.pos(0)).date(),new d.m(n.pos(1)).date()],a=Cc().domain(s).range(r);return a.ticks(Ya(t,this.props.tickSpacing)).map(o=>({label:this.tickLabel(o),position:a(o)}))}tickLabel(n){const t=new d.m(n).date();let r=`:${t.getSeconds()}`;if(t.getMilliseconds()!==0){const a=Math.round(t.getMilliseconds()).toString().padStart(3,"0").replace(/0+$/,"");r+=`.${a}`}return t.getSeconds()===0&&t.getMilliseconds()===0&&(r=`${t.getHours()}:${t.getMinutes().toString().padStart(2,"0")}`),r}}class Pc{constructor(n){h(this,"props");this.props=n}generate({decimalToDataScale:n,size:t}){const r=[0,t],s=[n.pos(0),n.pos(1)],a=va().domain(s).range(r),i=Ya(t,this.props.tickSpacing);return a.ticks(i).map(c=>({label:this.tickLabel(c),position:a(c)}))}tickLabel(n){return n.toString()}}const Ya=(e,n)=>{const t=Math.floor(e/n);return t>0?t:1},kc={linear:e=>new Pc(e),time:e=>new Ec(e)},Dr=zr.extend({color:l.Color.z,type:Yr.optional().default("linear"),font:p.z.string(),showGrid:p.z.boolean().optional().default(!0),location:l.K.outer,gridColor:l.Color.z}),W=4;class ds{constructor(n,t){h(this,"numberDims");h(this,"negativeWidth");h(this,"periodWidth");h(this,"colonWidth");this.numberDims=d.dimensions("0",t,n),this.negativeWidth=d.dimensions("-",t,n).width,this.periodWidth=d.dimensions(".",t,n).width,this.colonWidth=d.dimensions(":",t,n).width}get(n){const t={width:0,height:this.numberDims.height};let r=n.length;return n.includes(".")&&(t.width+=this.periodWidth,r-=1),n.startsWith("-")&&(t.width+=this.negativeWidth,r-=1),n.includes(":")&&(t.width+=this.colonWidth,r-=1),t.width+=r*this.numberDims.width,t}}let za=class{constructor(n,t){h(this,"renderCtx");h(this,"state");h(this,"tickFactory");h(this,"dimensions");this.renderCtx=n,this.state=t,this.tickFactory=Kn(this.state),this.dimensions=new ds(n.lower2d,t.font)}setState(n){this.state=d.prettyParse(Dr,n),this.tickFactory=Kn(n),this.dimensions=new ds(this.renderCtx.lower2d,this.state.font)}render(n){const{lower2d:t}=this.renderCtx;switch(t.font=this.state.font,t.fillStyle=this.state.color.hex,t.lineWidth=1,this.state.location){case"left":return this.drawLeft(n);case"right":return this.drawRight(n);case"top":return this.drawTop(n);default:return this.drawBottom(n)}}drawBottom(n){const{lower2d:t}=this.renderCtx,{plot:r}=n,s=l.Tt.width(r),a=l.Tt.height(r),i=n.position,o=this.tickFactory.generate({...n,size:s});return this.maybeDrawGrid(s,o,u=>[l.G.translate(i,"x",u.position),l.G.translate(i,{x:u.position,y:-a})]),t.strokeStyle=this.state.color.hex,this.drawLine(i,l.G.translate(i,"x",s)),{size:this.drawTicks(o,(u,f)=>{t.moveTo(i.x+f.position,i.y),t.lineTo(i.x+f.position,i.y+W),t.stroke(),t.fillText(f.label,i.x+f.position-u.width/2,i.y+5+u.height)}).height+W+6}}drawTop(n){const{lower2d:t}=this.renderCtx,{plot:r}=n,s=l.Tt.width(r),a=l.Tt.height(r),i=l.G.translate(n.position,"y",n.size),o=this.tickFactory.generate({...n,size:s});return this.maybeDrawGrid(s,o,u=>[l.G.translate(i,"x",u.position),l.G.translate(i,{x:u.position,y:a})]),t.strokeStyle=this.state.color.hex,this.drawLine(i,l.G.translate(i,"x",s)),{size:this.drawTicks(o,(u,f)=>{t.moveTo(i.x+f.position,i.y),t.lineTo(i.x+f.position,i.y-W),t.stroke(),t.fillText(f.label,i.x+f.position-u.width/2,i.y-5-u.height)}).height+W}}drawLeft(n){const{lower2d:t}=this.renderCtx,{plot:r}=n,s=l.Tt.height(r),a=l.Tt.width(r),i=l.G.translate(n.position,"x",n.size),o=this.tickFactory.generate({...n,size:s});return this.maybeDrawGrid(s,o,u=>[l.G.translate(i,"y",u.position),l.G.translate(i,{x:a,y:u.position})]),t.strokeStyle=this.state.color.hex,this.drawLine(i,l.G.translate(i,"y",s)),{size:this.drawTicks(o,(u,f)=>{t.moveTo(i.x,i.y+f.position),t.lineTo(i.x-W,i.y+f.position),t.stroke(),t.fillText(f.label,i.x-u.width-W*2,i.y+f.position+u.height/3)}).width+W*2}}drawRight(n){const{lower2d:t}=this.renderCtx,{plot:r}=n,s=l.Tt.height(r),a=l.Tt.width(r),i=n.position,o=this.tickFactory.generate({...n,size:s});return this.maybeDrawGrid(s,o,u=>[l.G.translate(i,"y",u.position),l.G.translate(i,{x:-a,y:u.position})]),t.strokeStyle=this.state.color.hex,this.drawLine(i,l.G.translate(i,"y",s)),{size:this.drawTicks(o,(u,f)=>{t.moveTo(i.x,i.y+f.position),t.lineTo(i.x+W,i.y+f.position),t.stroke(),t.fillText(f.label,i.x+W+2,i.y+f.position+u.height/3)}).width+W*2}}drawLine(n,t){const{lower2d:r}=this.renderCtx;r.beginPath(),r.moveTo(...l.G.couple(n)),r.lineTo(...l.G.couple(t)),r.stroke()}drawTicks(n,t){let r=l._.ZERO;return n.forEach(s=>{const a=this.dimensions.get(s.label);r=l._.max([r,a]),t(a,s)}),r}maybeDrawGrid(n,t,r){const{showGrid:s,gridColor:a}=this.state;if(s){const i=l.H.construct(-1,1),o=l.H.construct(n-1,n+1);this.renderCtx.lower2d.strokeStyle=a.hex,t.filter(({position:c})=>!l.H.contains(i,c)&&!l.H.contains(o,c)).forEach(c=>this.drawLine(...r(c)))}}};const Ae=Dr.extend({bounds:l.H.bounds.optional(),autoBounds:p.z.object({lower:p.z.boolean().optional().default(!0),upper:p.z.boolean().optional().default(!0)}).or(p.z.boolean().optional().default(!0)),autoBoundPadding:p.z.number().optional(),autoBoundUpdateInterval:d.w.z.optional().default(d.w.seconds(10)),size:p.z.number().optional().default(0),label:p.z.string().optional().default(""),labelSize:p.z.number().optional().default(0)}).partial({color:!0,font:!0,gridColor:!0}),Rc=2,Mc=7,Da=(e,n)=>l.H.contains({lower:e-Mc,upper:e+Rc},n),Yc=l.H.DECIMAL,fs=d.m.now(),zc={lower:Number(fs.valueOf()),upper:Number(fs.add(d.w.HOUR).valueOf())},La=e=>e==="linear"?Yc:zc,Dc=(e,n=.1,t)=>{const r=l.H.max(e.filter(l.H.isFinite));if(!l.H.isFinite(r))return La(t);const{lower:s,upper:a}=r;if(a===s)return{lower:s-1,upper:a+1};const i=(a-s)*n;return{lower:s-i,upper:a+i}},Lc=.01,Oc=.1;class Oa extends d.Composite{async afterUpdate(n){var r,s;this.internal.render=d.Context.use(n);const t=d.use(n);(r=this.state).autoBoundPadding??(r.autoBoundPadding=l.g.construct(this.state.location)==="x"?Oc:Lc),this.internal.core=new za(this.internal.render,{color:t.colors.gray.l8,font:d.fontString(t,{level:"small"}),gridColor:t.colors.gray.l1,...this.state}),N.requestRender(n,K),(s=this.internal).updateBounds??(s.updateBounds=d.r(a=>this.setState(i=>({...i,bounds:a})),this.state.autoBoundUpdateInterval.milliseconds))}async afterDelete(n){N.requestRender(n,K)}renderAxis(n,t){if(!n.canvases.includes("lower2d"))return;const{core:r}=this.internal,{grid:s,container:a}=n,i=ao(`${this.type}-${this.key}`,s,a),o={...n,position:i,decimalToDataScale:t,size:this.state.size+this.state.labelSize},{size:c}=r.render(o);Da(this.state.size,c)||this.setState(u=>({...u,size:c}))}async bounds(n,t){var u,f;if(n&&this.internal.boundSnapshot!=null)return[this.internal.boundSnapshot,null];const{lower:r,upper:s}=Aa(this.state.autoBounds);if(!r&&!s&&this.state.bounds!=null)return this.internal.boundSnapshot=this.state.bounds,[this.state.bounds,null];const a=g=>({upper:s||this.state.bounds==null?g.upper:this.state.bounds.upper,lower:r||this.state.bounds==null?g.lower:this.state.bounds.lower});let i,o=null;try{const g=await t();i=Dc(g,this.state.autoBoundPadding,this.state.type)}catch(g){i=La(this.state.type),o=g}const c=a(i);return this.internal.boundSnapshot=c,(this.state.bounds==null||r&&this.state.bounds.lower!==c.lower||s&&this.state.bounds.upper!==c.upper)&&((f=(u=this.internal).updateBounds)==null||f.call(u,c)),[c,o]}async dataToDecimalScale(n,t,r){const[s,a]=await this.bounds(n,t),i=l.g.swap(l.g.construct(this.state.location));return[l.b.Scale.scale(s).scale(1).translate(-l.Tt.root(r)[i]).magnify(1/l.Tt.dim(r,i)),a]}}const Aa=e=>typeof e=="boolean"?{lower:e,upper:e}:{lower:(e==null?void 0:e.lower)??!0,upper:(e==null?void 0:e.upper)??!0},ps=`#version 300 es
|
|
7
|
+
precision lowp float;
|
|
8
|
+
|
|
9
|
+
uniform lowp vec4 u_color;
|
|
10
|
+
out vec4 fragColor;
|
|
11
|
+
|
|
12
|
+
void main(void) {
|
|
13
|
+
fragColor = u_color;
|
|
14
|
+
}
|
|
15
|
+
`,Ac=`#version 300 es
|
|
16
|
+
|
|
17
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
18
|
+
//
|
|
19
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
20
|
+
// licenses/BSL.txt.
|
|
21
|
+
//
|
|
22
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
23
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
24
|
+
// included in the file licenses/APL.txt.
|
|
25
|
+
|
|
26
|
+
in mediump float a_x;
|
|
27
|
+
in mediump float a_y;
|
|
28
|
+
in mediump vec2 a_translate;
|
|
29
|
+
|
|
30
|
+
uniform mediump vec2 u_scale_aggregate;
|
|
31
|
+
uniform mediump vec2 u_offset_aggregate;
|
|
32
|
+
|
|
33
|
+
void main(void) {
|
|
34
|
+
gl_Position = vec4((u_scale_aggregate * vec2(a_x, a_y) + u_offset_aggregate) + a_translate, 0.0, 1.0);
|
|
35
|
+
}
|
|
36
|
+
`,Zc=`#version 300 es
|
|
37
|
+
|
|
38
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
39
|
+
//
|
|
40
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
41
|
+
// licenses/BSL.txt.
|
|
42
|
+
//
|
|
43
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
44
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
45
|
+
// included in the file licenses/APL.txt.
|
|
46
|
+
|
|
47
|
+
in mediump float a_x;
|
|
48
|
+
in mediump uint a_y;
|
|
49
|
+
in mediump vec2 a_translate;
|
|
50
|
+
|
|
51
|
+
uniform mediump vec2 u_scale_aggregate;
|
|
52
|
+
uniform mediump vec2 u_offset_aggregate;
|
|
53
|
+
|
|
54
|
+
void main(void) {
|
|
55
|
+
gl_Position = vec4((u_scale_aggregate * vec2(a_x, float(a_y)) + u_offset_aggregate) + a_translate, 0.0, 1.0);
|
|
56
|
+
}`,Za=p.z.object({x:Je,y:Je,label:p.z.string().optional(),color:l.Color.z,strokeWidth:p.z.number().default(1),downsample:p.z.number().min(1).max(50).optional().default(1)}),Nc=(e,n,t)=>e===-1||n===-1||e>=t.length?NaN:Number(t[e].at(n)),Ic=d.w.milliseconds(2);l.G.NAN,l.G.NAN,l.ZERO;const $c=(e,n)=>n.equals(d.g.UINT8)?e.UNSIGNED_BYTE:e.FLOAT;class gs extends d.GLProgram{constructor(t,r,s){super(t,r,s);h(this,"translationBufferCache",new Map);h(this,"attrLocations",{});this.translationBufferCache=new Map,this.attrLocations={x:this.renderCtx.gl.getAttribLocation(this.prog,"a_x"),y:this.renderCtx.gl.getAttribLocation(this.prog,"a_y"),translate:this.renderCtx.gl.getAttribLocation(this.prog,"a_translate")}}bindState({strokeWidth:t,color:r}){return this.uniformColor("u_color",r),this.attrStrokeWidth(t)}bindScale(t,r){const s=l.G.scale(t.scale,r.scale),a=l.G.translate(l.G.scale(r.scale,t.offset),r.offset);this.uniformXY("u_scale_aggregate",s),this.uniformXY("u_offset_aggregate",a)}draw({x:t,y:r,count:s,downsample:a,xOffset:i,yOffset:o},c,u,f){const{gl:g}=this.renderCtx;this.bindAttrBuffer("x",t.glBuffer,a,i,u),this.bindAttrBuffer("y",r.glBuffer,a,o,f),g.drawArraysInstanced(g.LINE_STRIP,0,s/a,c)}bindAttrBuffer(t,r,s,a=0,i){const{gl:o}=this.renderCtx;o.bindBuffer(o.ARRAY_BUFFER,r);const c=o.getAttribLocation(this.prog,`a_${t}`),u=$c(o,i),f=i.density.valueOf();i.equals(d.g.UINT8)?o.vertexAttribIPointer(c,1,u,f*s,f*a):o.vertexAttribPointer(c,1,u,!1,f*s,f*a),o.enableVertexAttribArray(c)}getAndBindTranslationBuffer(t){const{gl:r}=this.renderCtx,s=`${this.renderCtx.aspect}:${t}`,a=this.translationBufferCache.get(s);if(a!=null)return r.bindBuffer(r.ARRAY_BUFFER,a.glBuffer),a;const i=r.createBuffer();if(i==null)throw new d.xe("Failed to create buffer from WebGL context");const o=Bc(this.renderCtx.aspect,t);r.bindBuffer(r.ARRAY_BUFFER,i),r.bufferData(r.ARRAY_BUFFER,o,r.DYNAMIC_DRAW);const c={glBuffer:i,jsBuffer:o};return this.translationBufferCache.set(s,c),c}attrStrokeWidth(t){const{gl:r}=this.renderCtx,{jsBuffer:s}=this.getAndBindTranslationBuffer(t),a=r.getAttribLocation(this.prog,"a_translate");return r.vertexAttribPointer(a,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(a),r.vertexAttribDivisor(a,1),s.length/2}}const St=class St{constructor(n){h(this,"uint8HybridProgram");h(this,"float32Program");this.uint8HybridProgram=new gs(n,Zc,ps),this.float32Program=new gs(n,Ac,ps)}get gl(){return this.uint8HybridProgram.renderCtx.gl}getProgram(n){return n.equals(d.g.UINT8)?this.uint8HybridProgram:this.float32Program}static create(n,t){const r=new St(t);return n.set(St.CONTEXT_KEY,r),r}static use(n){const t=n.get(St.CONTEXT_KEY);if(t==null)throw new d.xe("GLProgram not found");return t}};h(St,"CONTEXT_KEY","pluto-line-gl-program");let hn=St;class Te extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Za)}async afterUpdate(t){var s,a;if(this.deleted)return;const{internal:r}=this;r.xTelem=await H(t,this.state.x,r.xTelem),r.yTelem=await H(t,this.state.y,r.yTelem),r.instrumentation=De(t,"line"),r.ctx=hn.use(t),r.requestRender=N.useRequest(t),(s=r.stopListeningXTelem)==null||s.call(r),(a=r.stopListeningYTelem)==null||a.call(r),r.stopListeningXTelem=r.xTelem.onChange(()=>r.requestRender(Gn)),r.stopListeningYTelem=r.yTelem.onChange(()=>r.requestRender(Gn)),r.requestRender(K)}async afterDelete(){var r,s,a,i;const{internal:t}=this;await((s=(r=t.xTelem).cleanup)==null?void 0:s.call(r)),await((i=(a=t.yTelem).cleanup)==null?void 0:i.call(a)),t.requestRender(K)}async xBounds(){return(await this.internal.xTelem.value())[0]}async yBounds(){return(await this.internal.yTelem.value())[0]}async findByXValue(t,r){const{xTelem:s,yTelem:a}=this.internal,[,i]=await s.value();let[o,c]=[-1,-1];i.find((M,D)=>{const P=M.binarySearch(r),z=P>=0&&P<M.length;return z&&([o,c]=[P,D]),z});const{key:u}=this,{color:f,label:g}=this.state,m={key:u,color:f,label:g,position:{x:0,y:0},value:{x:NaN,y:NaN}};if(o===-1||c===-1)return m;const w=i[c];m.value.x=Nc(c,o,i);const[,b]=await a.value(),v=b.find(M=>l.H.contains(M.alignmentBounds,w.alignment+BigInt(o)));if(v==null)return m;const S=Number(v.alignment-w.alignment);return m.value.y=Number(v.at(o-S)),m.position={x:t.dataToDecimalScale.x.pos(m.value.x),y:t.dataToDecimalScale.y.pos(m.value.y)},m}async render(t){if(this.deleted)return;const{downsample:r}=this.state,{xTelem:s,yTelem:a,ctx:i}=this.internal,{dataToDecimalScale:o,exposure:c}=t,[[,u],[,f]]=await Promise.all([s.value(),a.value()]);if(u.forEach(S=>S.updateGLBuffer(i.gl)),f.forEach(S=>S.updateGLBuffer(i.gl)),u.length===0||f.length===0)return;const g=i.getProgram(f[0].dataType),m=jc(u,f,c,r,Ic);this.internal.instrumentation.L.debug("render",()=>({key:this.key,downsample:r,scale:o.transform,props:t.region,ops:Wc(m)}));const w=g.setAsActive(),b=g.bindState(this.state),v=g.renderCtx.scaleRegion(t.region).transform;m.forEach(S=>{const M=Hc(o,S).transform;g.bindScale(M,v),g.draw(S,b,u[0].dataType,f[0].dataType)}),w()}}h(Te,"TYPE","line");const Uc=5e3,Bc=(e,n)=>Fc(_c(e),n).map((t,r)=>Math.floor(r/Gc)*(1/(Uc*e))*t),Gc=5,_c=e=>new Float32Array([0,0,0,e,0,-e,1,0,-1,0]),Fc=(e,n)=>{const t=new Float32Array(e.length*n);for(let r=0;r<n;r++)t.set(e,r*e.length);return t},Hc=(e,n)=>e.translate(e.x.dim(Number(n.x.sampleOffset)),e.y.dim(Number(n.y.sampleOffset))),qc={[Te.TYPE]:Te},jc=(e,n,t,r,s)=>{if(e.length===0||n.length===0)return[];const a=[];return e.forEach(i=>n.forEach(o=>{if(!Vc(i,o,s))return;let c=0,u=0;i.alignment<o.alignment?c=Number(o.alignment-i.alignment):o.alignment<i.alignment&&(u=Number(i.alignment-o.alignment));const f=Math.min(i.length-c,o.length-u);if(f===0)return;const g=l.Y(Math.round(t*4*f),r,51);a.push({x:i,y:o,xOffset:c,yOffset:u,count:f,downsample:g})})),a},Wc=e=>e.map(n=>({...n,x:n.x.digest,y:n.y.digest})),Vc=(e,n,t)=>{if(!(e._timeRange!=null&&n._timeRange!=null))throw new d.xe(`Encountered series without time range in buildDrawOperations. X series present: ${e._timeRange!=null}, Y series present: ${n._timeRange!=null}`);const s=e.timeRange.overlapsWith(n.timeRange,t),a=l.H.overlapsWith(e.alignmentBounds,n.alignmentBounds);return s&&a};class qt{constructor(n,t){h(this,"canvas");h(this,"theme");this.canvas=n,this.theme=t}rule({direction:n,region:t,position:r,...s}){return n==="x"?this.line({start:l.G.construct(l.Tt.left(t),r),end:l.G.construct(l.Tt.right(t),r),...s}):this.line({start:l.G.construct(r,l.Tt.top(t)),end:l.G.construct(r,l.Tt.bottom(t)),...s})}line({stroke:n,lineWidth:t,lineDash:r,start:s,end:a}){const i=this.canvas;i.strokeStyle=n.hex,i.lineWidth=t,i.setLineDash([r]),i.beginPath(),i.moveTo(...l.G.couple(s)),i.lineTo(...l.G.couple(a)),i.stroke()}circle({fill:n,radius:t,position:r}){const s=this.canvas;s.fillStyle=n.hex,s.beginPath(),s.arc(...l.G.couple(r),t,0,2*Math.PI),s.fill()}resolveColor(n,t){return n==null?this.resolveColor(t):typeof n=="function"?n(this.theme):new l.Color(n)}border({region:n,color:t,width:r,radius:s,location:a}){const i=this.canvas;i.strokeStyle=this.resolveColor(t,this.theme.colors.border).hex,i.lineWidth=r??this.theme.sizes.border.width,s??(s=this.theme.sizes.border.radius),a==null||a===!0?s>0?(i.roundRect(...l.G.couple(l.Tt.topLeft(n)),...l.G.couple(l.Tt.dims(n)),s),i.stroke()):(i.rect(...l.G.couple(l.Tt.topLeft(n)),...l.G.couple(l.Tt.dims(n))),i.stroke()):d.A(a).forEach(o=>{const[c,u]=l.Tt.edgePoints(n,o);i.beginPath(),i.moveTo(...l.G.couple(c)),i.lineTo(...l.G.couple(u)),i.stroke()})}container({region:n,bordered:t=!0,rounded:r=!0,borderColor:s,borderRadius:a,borderWidth:i,backgroundColor:o}){a??(a=this.theme.sizes.border.radius),i??(i=1);const c=this.canvas;c.fillStyle=this.resolveColor(o,this.theme.colors.gray.l1).hex,c.strokeStyle=this.resolveColor(s,this.theme.colors.border).hex,c.setLineDash([]),c.lineWidth=1,c.beginPath(),r?c.roundRect(...l.G.couple(l.Tt.topLeft(n)),...l.G.couple(l.Tt.dims(n)),a):c.rect(...l.G.couple(l.Tt.topLeft(n)),...l.G.couple(l.Tt.dims(n))),c.fill(),t&&this.border({region:n,color:s,radius:a,width:i,location:t})}textContainer(n){const[t,r]=this.spacedTextDrawF(n);t.width+=12,t.height+=12;const{root:s=l.K.TOP_LEFT,offset:a=l.G.ZERO}=n,i={...n.position};s.x==="right"?i.x-=t.width+a.x:i.x+=a.x,s.y==="bottom"?i.y-=t.height+a.y:i.y+=a.y,this.container({region:l.Tt.construct(i,t.width,t.height),...n}),this.canvas.filter="none",r(l.G.translate(i,[6,6]))}spacedTextDrawF({text:n,direction:t,spacing:r=1,level:s="p"}){const a=d.fontString(this.theme,{level:s}),i=n.map(u=>d.dimensions(u,a,this.canvas)),o=this.theme.sizes.base*r,c=Math.max(...i.map(u=>u[l.g.dimension(t)]))+o;return[{[l.g.dimension(l.g.swap(t))]:Math.max(...i.map(u=>u[l.g.dimension(l.g.swap(t))])),[l.g.dimension(t)]:c*n.length-o},u=>{const f=d.fontString(this.theme,{level:s});this.canvas.font=f,this.canvas.fillStyle=this.theme.colors.text.hex,this.canvas.textBaseline="top",n.forEach((g,m)=>{this.canvas.fillText(g,u.x,u.y+c*m)})}]}drawTextInCenter({box:n,text:t,level:r}){const s=d.dimensions(t,this.canvas.font,this.canvas),a=l.Tt.positionInCenter(l.Tt.construct(l.G.ZERO,s),n);return this.text({text:t,position:l.Tt.topLeft(a),level:r})}text({text:n,position:t,level:r="p",weight:s,shade:a,maxWidth:i,code:o}){this.canvas.font=d.fontString(this.theme,{level:r,weight:s,code:o}),a==null?this.canvas.fillStyle=this.theme.colors.text.hex:this.canvas.fillStyle=this.theme.colors.gray[`l${a}`].hex,this.canvas.textBaseline="top";let c;i!=null&&(c=this.canvas.scissor(l.Tt.construct(t,i,1e3))),this.canvas.fillText(n,t.x,t.y),c==null||c()}}const Lr=p.z.object({position:p.z.number().optional(),pixelPosition:p.z.number().optional(),dragging:p.z.boolean(),lineWidth:p.z.number().optional().default(1),lineDash:p.z.number().optional().default(20),color:l.Color.z}),Xc=3;class Ut extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Lr);h(this,"lastUpdateRef",null)}async afterUpdate(t){this.internal.renderCtx=d.Context.use(t);const r=d.use(t);this.internal.draw=new qt(this.internal.renderCtx.upper2d,r),N.requestRender(t,et)}async afterDelete(t){N.requestRender(t,et)}updatePositions({decimalToDataScale:t,plot:r}){const s=this.state.dragging,a=this.prevState.dragging&&!s;if((s||a)&&this.state.pixelPosition!=null){if(this.lastUpdateRef??(this.lastUpdateRef=this.state.pixelPosition),Math.abs(this.state.pixelPosition-this.lastUpdateRef)<Xc&&!a)return this.state.pixelPosition;this.lastUpdateRef=this.state.pixelPosition;const c=t.pos(this.state.pixelPosition/l.Tt.height(r));return this.setState(u=>({...u,position:c})),this.state.pixelPosition}if(this.state.position==null){const o=t.pos(.5);this.setState(c=>({...c,position:o}))}const i=t.reverse().pos(this.state.position)*l.Tt.height(r);if(!isNaN(i)){if(this.state.pixelPosition!=null&&Math.abs(i-this.state.pixelPosition)<1)return this.state.pixelPosition;this.setState(o=>({...o,pixelPosition:i}))}return i}async render(t){if(this.deleted)return;const{renderCtx:r}=this.internal,{location:s,plot:a}=t,i=l.K.direction(s),{upper2d:o}=r,c=this.internal.draw,u=this.updatePositions(t)+l.Tt.top(t.plot);c.rule({stroke:this.state.color,lineWidth:this.state.lineWidth,lineDash:this.state.lineDash,direction:i,region:a,position:u}),o.fillStyle=this.state.color.hex,o.lineJoin="round",o.lineWidth=3.5,o.lineCap="round",o.beginPath();const f=4;if(s==="left"){const g=l.Tt.left(a)-1;o.moveTo(g,u),o.lineTo(g-f,u-f),o.lineTo(g-f,u+f)}else s==="right"&&(o.moveTo(l.Tt.right(a),u),o.lineTo(l.Tt.right(a)+f,u-f),o.lineTo(l.Tt.right(a)+f,u+f));o.closePath(),o.stroke()}}h(Ut,"TYPE","Rule");const Na={[Ut.TYPE]:Ut},Kc=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:Na,Rule:Ut,ruleStateZ:Lr},Symbol.toStringTag,{value:"Module"})),Qc=Ae.extend({location:l.K.x.optional().default("left")}),ms=2,Jc=e=>l.Tt.signedWidth(e)<ms||l.Tt.signedHeight(e)<ms;class be extends Oa{constructor(){super(...arguments);h(this,"schema",Ae)}async xBounds(){return l.H.max((await Promise.all(this.lines.map(async t=>await t.xBounds()))).filter(t=>l.H.isFinite(t)))}async render(t){if(this.deleted)return;const[r,s]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport),a=r.invert().reverse();if(this.renderAxis(t,a),await this.renderLines(t,r),await this.renderRules(t,a),s!=null)throw s}async renderLines({xDataToDecimalScale:t,plot:r,canvases:s,exposure:a},i){if(!s.includes("gl")||Jc(r))return;const o={region:r,dataToDecimalScale:new l.b.XY(t,i),exposure:a};await Promise.all(this.lines.map(async c=>await c.render(o)))}async renderRules({container:t,plot:r,canvases:s},a){if(!s.includes("upper2d"))return;const{location:i}=this.state,{render:o}=this.internal,c=l.Tt.construct(l.Tt.left(t),l.Tt.top(r),l.Tt.width(t),l.Tt.height(r)),u=o.scissor(c,l.G.ZERO,["upper2d"]),f={container:t,plot:r,decimalToDataScale:a,location:i};await Promise.all(this.rules.map(async g=>await g.render(f))),u()}async findByXValue({xDataToDecimalScale:t,plot:r,viewport:s,hold:a,exposure:i},o){const[c,u]=await this.dataToDecimalScale(a,this.dataBounds.bind(this),s);if(u!=null)throw u;const f=new l.b.XY(t,c),g={region:r,dataToDecimalScale:f,exposure:i};return(await Promise.all(this.lines.map(async m=>await m.findByXValue(g,o)))).map(m=>({...m,units:this.state.label}))}async dataBounds(){return await Promise.all(this.lines.map(async t=>await t.yBounds()))}get lines(){return this.childrenOfType(Te.TYPE)}get rules(){return this.childrenOfType(Ut.TYPE)}}h(be,"TYPE","YAxis");const Ia=p.z.object({start:d.m.z,end:d.m.z});class dn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Ia)}async afterUpdate(t){this.internal.render=d.Context.use(t),this.internal.draw=new qt(this.internal.render.upper2d,d.use(t))}async render(){}}h(dn,"TYPE","range-annotation");const tu=p.z.object({region:l.Tt.box,clearOverScan:l.G.crudeZ.optional().default(0),visible:p.z.boolean().optional().default(!0)}),Un=["upper2d","lower2d"],Ct=class Ct extends d.Composite{constructor(){super(...arguments);h(this,"schema",Ct.stateZ)}async afterUpdate(t){const{internal:r}=this;r.renderCtx=d.Context.use(t),r.handleException=d.useExceptionHandler(t),N.control(t,()=>this.requestRender("low")),this.requestRender("high")}async afterDelete(){this.requestRender("high")}async render(){if(this.deleted)return;const t=l.Tt.copy(this.state.region);if(!this.state.visible)return async()=>this.internal.renderCtx.erase(this.state.region,this.state.clearOverScan,...Un);const{renderCtx:r,handleException:s}=this.internal,a=l.b.XY.translate(l.Tt.topLeft(this.state.region)),i=r.scissor(this.state.region,l.G.construct(this.state.clearOverScan),Un);try{for(const o of this.children)await o.render({viewportScale:a})}catch(o){s(o,"Failed to render table")}finally{i()}return async()=>{this.internal.renderCtx.erase(t,this.state.clearOverScan)}}requestRender(t){const{renderCtx:r}=this.internal;r.loop.set({key:`${Ct.TYPE}-${this.key}`,render:this.render.bind(this),priority:t,canvases:Un})}};h(Ct,"TYPE","Table"),h(Ct,"stateZ",tu);let xe=Ct;const eu={[xe.TYPE]:xe},$a=p.z.object({triggered:p.z.boolean(),status:d.specZ$1,sink:En.optional().default(vn),source:ar.optional().default(nr)});class fn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",$a)}async afterUpdate(t){var a,i,o;const{sink:r,source:s}=this.state;this.internal.source=await H(t,s,this.internal.source),this.internal.sink=await ze(t,r,this.internal.sink),this.state.triggered&&!this.prevState.triggered&&await this.internal.sink.set(((a=this.state.status.data)==null?void 0:a.authority)!==d.kp.Absolute.valueOf()),await this.updateEnabledState(),(o=(i=this.internal).stopListening)==null||o.call(i),this.internal.stopListening=this.internal.source.onChange(()=>{this.updateEnabledState()})}async updateEnabledState(){const t=await this.internal.source.value();d._.equal(t,this.state.status)||this.setState(r=>({...r,status:t,triggered:!1}))}async afterDelete(){var t,r,s,a;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t)),await((a=(s=this.internal.sink).cleanup)==null?void 0:a.call(s))}render(){}}h(fn,"TYPE","Chip");const Ua=p.z.object({}),ys="control-state-provider",Ba=d.rp.stateZ.extend({subjectColor:l.Color.z});class Bt extends d.Composite{constructor(){super(...arguments);h(this,"schema",Ua);h(this,"colors",new Map);h(this,"tracker");h(this,"disconnectTrackerChange");h(this,"obs",new Qn.Observer)}static use(t){return t.get(ys)}async afterUpdate(t){const{internal:r}=this;r.instrumentation=De(t,"control-state");const s=d.use(t);r.palette=s.colors.visualization.palettes.default,r.defaultColor=s.colors.gray.l6;const a=Me(t);r.client!=null&&a===r.client||(r.client=a,t.set(ys,this),await this.maybeCloseTracker(),r.client!=null&&(this.internal.instrumentation.L.debug("starting state tracker"),await this.openTracker(r.client)))}async maybeCloseTracker(){var t;this.tracker!=null&&(this.internal.instrumentation.L.debug("stopping state tracker"),(t=this.disconnectTrackerChange)==null||t.call(this),await this.tracker.close(),this.tracker=void 0)}async afterDelete(){await this.maybeCloseTracker()}onChange(t){return this.obs.onChange(t)}get(t){return Array.isArray(t)?d.c.unique(t).map(r=>this.getOne(r)).filter(r=>r!=null):this.getOne(t)}getOne(t){if(this.tracker==null)return;const r=this.tracker.states.get(t);if(r!=null)return{...r,subjectColor:this.colors.get(r.subject.key)??this.internal.defaultColor}}async openTracker(t){var a;const{internal:r}=this,{instrumentation:s}=r;try{this.tracker=await t.control.openStateTracker()}catch{s.L.error("failed to open state tracker");return}(a=this.disconnectTrackerChange)==null||a.call(this),this.disconnectTrackerChange=this.tracker.onChange(i=>{if(s.L.debug("transfer",{transfers:i.map(o=>d.rp.transferString(o))}),this.tracker==null)throw new d.xe("tracker is null inside it's own onChange callback!");this.updateColors(this.tracker),this.obs.notify(i)})}updateColors(t){const r=t.subjects(),s=r.map(o=>o.key),a=Array.from(this.colors.values());this.colors.forEach((o,c)=>!s.includes(c)&&this.colors.delete(c));const{palette:i}=this.internal;r.forEach(o=>{if(this.colors.has(o.key))return;const c=i.find(u=>!a.includes(u))??i[0];this.colors.set(o.key,c),a.push(c)})}}h(Bt,"TYPE","StateProvider");const Ga=["acquired","released","overridden","failed"],_a=p.z.enum(Ga),Fa=p.z.object({name:p.z.string(),authority:p.z.number().default(0),acquireTrigger:p.z.number(),status:_a.optional(),needsControlOf:d.Fg.keyZ.array().optional().default([])});class pn extends d.Composite{constructor(){super(...arguments);h(this,"schema",Fa);h(this,"registry",new Map);h(this,"writer")}async afterUpdate(t){const{internal:r}=this;r.instrumentation=De(t),(r.prevTrigger==null||Math.abs(this.state.acquireTrigger-r.prevTrigger)>1)&&(r.prevTrigger=this.state.acquireTrigger);const s=Me(t),a=Bt.use(t);r.client=s,r.client==null&&await this.release(),r.stateProv=a,r.telemCtx=sa(t,this,r.telemCtx),r.addStatus=d.useAggregator(t),this.state.acquireTrigger>r.prevTrigger?await this.acquire():this.state.acquireTrigger<r.prevTrigger&&await this.release()}async afterDelete(){await this.release()}async updateNeedsControlOf(){const{client:t}=this.internal;if(t==null)return;const r=new Set([]);for(const a of this.registry.keys())(await a.needsControlOf(t)).forEach(o=>o!==0&&r.add(o));const s=Array.from(r);d.F.unorderedPrimitiveArrays(this.state.needsControlOf,s)!==d.F.EQUAL&&this.setState(a=>({...a,needsControlOf:s}))}async acquire(){this.internal.prevTrigger=this.state.acquireTrigger;const{client:t,addStatus:r}=this.internal;if(t==null)return r({message:`Cannot acquire control on ${this.state.name} because no cluster has been connected.`,variant:"warning"});try{await this.updateNeedsControlOf();const s=this.state.needsControlOf;if(s.length===0)return r({message:`Cannot acquire control on ${this.state.name} because there are no channels to control.`,variant:"warning"});const a=d.k.now().sub(d.w.milliseconds(1));this.writer=await t.openWriter({start:a,channels:s,controlSubject:{key:this.key,name:this.state.name},authorities:this.state.authority,enableAutoCommit:!0}),this.setState(i=>({...i,status:"acquired"}))}catch(s){if(this.setState(a=>({...a,status:"failed"})),!(s instanceof Error))throw s;r({variant:"error",message:`${this.state.name} failed to acquire control`,description:s.message})}}async release(){var t;this.internal.prevTrigger=this.state.acquireTrigger;try{await((t=this.writer)==null?void 0:t.close()),this.setState(r=>({...r,status:"released"}))}catch(r){this.internal.addStatus({message:`${this.state.name} failed to release control: ${r.message}`,variant:"error"})}finally{this.writer=void 0}}async set(t){var r;this.writer==null&&await this.acquire(),await((r=this.writer)==null?void 0:r.write(t))}async setAuthority(t,r){var s;this.writer==null&&await this.acquire(),await((s=this.writer)==null?void 0:s.setAuthority(Object.fromEntries(t.map(a=>[a,r]))))}async releaseAuthority(t){var r;this.writer==null&&await this.acquire(),await((r=this.writer)==null?void 0:r.setAuthority(Object.fromEntries(t.map(s=>[s,this.state.authority]))))}deleteTelem(t){this.registry.delete(t),this.updateNeedsControlOf()}create(t){const s=(()=>{switch(t.type){case ve.TYPE:{const a=new ve(this,t.props);return this.registry.set(a,null),a}case Ce.TYPE:{const a=new Ce(this,this.internal.stateProv,t.props);return this.registry.set(a,null),a}case Se.TYPE:return new Se(this,t.props);default:return null}})();return s!=null&&this.updateNeedsControlOf(),s}}h(pn,"TYPE","Controller");const Ha=p.z.object({channel:p.z.number()});class ve extends kn{constructor(t,r){super(r);h(this,"controller");h(this,"schema",Ha);this.controller=t}invalidate(){}async cleanup(){this.controller.deleteTelem(this)}async needsControlOf(t){if(this.props.channel===0)return[];const r=await t.channels.retrieve(this.props.channel),s=[r.key];return r.index!==0&&s.push(r.index),s}async set(t){const{client:r}=this.controller.internal;if(r==null)return;const s=await r.channels.retrieve(this.props.channel),a={[s.key]:t};if(s.index!==0){const i=await r.channels.retrieve(s.index);a[i.key]=d.k.now()}await this.controller.set(a)}}h(ve,"TYPE","controlled-numeric-telem-sink");const nu=e=>({type:ve.TYPE,props:e,variant:"sink",valueType:"number"}),qa=p.z.object({authority:p.z.number().default(d.rp.Authority.Absolute.valueOf()),channel:p.z.number()});class Se extends kn{constructor(t,r){super(r);h(this,"controller");h(this,"schema",qa);this.controller=t}async cleanup(){this.controller.deleteTelem(this)}async needsControlOf(t){const r=await t.channels.retrieve(this.props.channel),s=[r.key];return r.index!==0&&s.push(r.index),s}async set(t){const{controller:r}=this,{client:s}=r.internal;if(s==null)return;const a=await s.channels.retrieve(this.props.channel),i=[a.key];a.index!==0&&i.push(a.index),t?await this.controller.setAuthority(i,this.props.authority):await this.controller.releaseAuthority(i)}}h(Se,"TYPE","acquire-channel-control");const ru=e=>({type:Se.TYPE,props:e,variant:"sink",valueType:"boolean"}),ja=p.z.object({channel:p.z.number()});class Ce extends _{constructor(t,r,s){super(s);h(this,"prov");h(this,"valid",!1);h(this,"stopListening");h(this,"controller");h(this,"schema",ja);this.prov=r,this.controller=t}async needsControlOf(){return[]}maybeRevalidate(){var s;if(this.valid)return;const{channel:t}=this.props;(s=this.stopListening)==null||s.call(this);const r=d.U.filterTransfersByChannelKey(t);this.stopListening=this.prov.onChange(a=>{var i;r(a).length!==0&&((i=this.notify)==null||i.call(this))}),this.valid=!0}async value(){this.maybeRevalidate();const t=d.k.now();if(this.props.channel===0)return{key:this.controller.key,variant:"disabled",message:"No Channel",time:t,data:{valid:!1,authority:0}};const r=this.prov.get(this.props.channel);return r==null?{key:this.controller.key,variant:"disabled",message:"Uncontrolled",time:t,data:{valid:!0,color:void 0,authority:0}}:{key:r.subject.key,variant:r.subject.key===this.controller.key?"success":"error",message:`Controlled by ${r.subject.name}`,time:t,data:{valid:!0,color:r.subjectColor,authority:r.authority}}}async cleanup(){var t;this.controller.deleteTelem(this),(t=this.stopListening)==null||t.call(this)}}h(Ce,"TYPE","controlled-status-source");const su=e=>({type:Ce.TYPE,props:e,variant:"source",valueType:"status"}),Wa=p.z.object({statusSource:ar.optional().default(nr),colorSource:sr.optional().default(Sn),status:d.specZ$1,color:l.Color.z.optional()});class gn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Wa);h(this,"stopListeningStatus");h(this,"stopListeningColor")}async afterUpdate(t){var i,o;const{internal:r}=this,{statusSource:s,colorSource:a}=this.state;r.statusSource=await H(t,s,r.statusSource),r.colorSource=await H(t,a,r.colorSource),await this.updateState(),(i=this.stopListeningStatus)==null||i.call(this),this.stopListeningStatus=r.statusSource.onChange(()=>{this.updateState()}),(o=this.stopListeningColor)==null||o.call(this),this.stopListeningColor=r.colorSource.onChange(()=>{this.updateState()})}async afterDelete(){var t,r,s,a;await((r=(t=this.internal.statusSource).cleanup)==null?void 0:r.call(t)),await((a=(s=this.internal.colorSource).cleanup)==null?void 0:a.call(s))}async render(){}async updateState(){const t=await this.internal.colorSource.value(),r=await this.internal.statusSource.value();t.equals(this.state.color)&&r.message===this.state.status.message||this.setState(s=>({...s,color:t,status:r}))}}h(gn,"TYPE","Indicator");const Va=p.z.object({needsControlOf:d.Fg.keyZ.array(),states:Ba.array()});class mn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Va)}async afterUpdate(t){var o;const{internal:r}=this;r.stateProv=Bt.use(t);const s=this.state.needsControlOf;(o=r.disconnectStateProv)==null||o.call(r);const a=d.U.filterTransfersByChannelKey(...s),i=r.stateProv.get(s);this.setState(c=>({...c,states:i})),r.disconnectStateProv=r.stateProv.onChange(c=>{if(a(c).length===0)return;const u=r.stateProv.get(s);this.setState(f=>({...f,states:u}))})}async afterDelete(){var r;const{internal:t}=this;(r=t.disconnectStateProv)==null||r.call(t)}async render(){}}h(mn,"TYPE","Legend");const au={[pn.TYPE]:pn,[Bt.TYPE]:Bt,[gn.TYPE]:gn,[fn.TYPE]:fn,[mn.TYPE]:mn},Xa=p.z.object({trigger:p.z.number(),sink:En.optional().default(vn)});class yn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Xa)}async afterUpdate(t){var a;const{sink:r}=this.state;(a=this.internal).prevTrigger??(a.prevTrigger=this.state.trigger),this.internal.sink=await ze(t,r,this.internal.sink);const s=this.internal.prevTrigger;this.internal.prevTrigger=this.state.trigger,!(this.state.trigger<=s)&&await this.internal.sink.set(!0)}render(){}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var r,s;const{internal:t}=this;await((s=(r=t.sink).cleanup)==null?void 0:s.call(r))}}h(yn,"TYPE","Button");const iu={[yn.TYPE]:yn},Or=p.z.object({dpr:p.z.number(),region:l.Tt.box,bootstrap:p.z.boolean().optional().default(!1),bootstrapped:p.z.boolean().optional().default(!1),glCanvas:p.z.any().optional(),upper2dCanvas:p.z.any().optional(),lower2dCanvas:p.z.any().optional(),os:d.S.osZ});class Ee extends d.Composite{constructor(){super(...arguments);h(this,"schema",Or);h(this,"renderCtx",null)}async afterUpdate(t){if(this.renderCtx==null){if(!this.state.bootstrap)return;const{glCanvas:r,lower2dCanvas:s,upper2dCanvas:a,os:i}=this.state;if(r==null||s==null||a==null)throw new d.xe("[vis.worker.Canvas] - expected render context bootstrap to include all canvases");this.renderCtx=d.Context.create(t,r,s,a,i),hn.create(t,this.renderCtx),this.setState(o=>({...o,bootstrap:!1,bootstrapped:!0,glCanvas:void 0,lower2dCanvas:void 0,upper2dCanvas:void 0}))}else this.renderCtx.update(t);this.renderCtx.resize(this.state.region,this.state.dpr)}}h(Ee,"TYPE","Canvas");const Ka={[Ee.TYPE]:Ee},ou=Object.freeze(Object.defineProperty({__proto__:null,Canvas:Ee,REGISTRY:Ka,canvasStateZ:Or},Symbol.toStringTag,{value:"Module"})),Ar=p.z.object({position:l.G.xy,zoom:p.z.number(),region:l.Tt.box,clearOverScan:l.G.crudeZ.optional().default(10),visible:p.z.boolean().optional().default(!0)}),Be=["upper2d","lower2d"],Et=class Et extends d.Composite{constructor(){super(...arguments);h(this,"schema",Et.stateZ)}async afterUpdate(t){this.internal.renderCtx=d.Context.use(t),this.internal.addStatus=d.useAggregator(t),N.control(t,()=>this.requestRender("low")),this.requestRender("high")}async afterDelete(){this.requestRender("high")}async render(){if(this.deleted)return;const{renderCtx:t,addStatus:r}=this.internal,{zoom:s,position:a}=this.state,i=l.Tt.construct(this.state.region);if(!this.state.visible)return async()=>t.erase(i,this.state.clearOverScan,...Be);const o=t.scissor(i,l.G.ZERO,Be),c=l.b.XY.magnify(l.G.construct(s)).translate(l.Tt.topLeft(i)).translate(a);try{await Promise.all(this.children.map(async f=>await f.render({viewportScale:c})))}catch(f){if(!(f instanceof Error))throw f;r({variant:"error",message:"Failed to render diagram",description:f.message})}finally{o()}const u=l.Tt.copy(this.state.region);return async()=>{this.internal.renderCtx.erase(u,this.state.clearOverScan,...Be)}}requestRender(t){const{renderCtx:r}=this.internal;r.loop.set({key:`${Et.TYPE}-${this.key}`,render:this.render.bind(this),priority:t,canvases:Be})}};h(Et,"TYPE","Diagram"),h(Et,"stateZ",Ar);let Gt=Et;const Qa={[Gt.TYPE]:Gt},lu=Object.freeze(Object.defineProperty({__proto__:null,Diagram:Gt,REGISTRY:Qa,diagramStateZ:Ar},Symbol.toStringTag,{value:"Module"})),Ja=p.z.object({enabled:p.z.boolean(),source:rr.optional().default(er)});class wn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Ja)}async afterUpdate(t){var a;this.internal.addStatus=d.useOptionalAggregator(t);const{source:r}=this.state,{internal:s}=this;this.internal.source=await H(t,r,this.internal.source),await this.updateEnabledState(),(a=s.stopListening)==null||a.call(s),s.stopListening=s.source.onChange(()=>{this.updateEnabledState().catch(this.reportError.bind(this))})}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Light: ${t.message}`})}async updateEnabledState(){const t=await this.internal.source.value();t!==this.state.enabled&&this.setState(r=>({...r,enabled:t}))}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var t,r;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t))}async render(){}}h(wn,"TYPE","Light");const cu={[wn.TYPE]:wn},Zr=p.z.object({position:l.G.xy.or(p.z.null()),textColor:l.Color.z.optional().default(l.ZERO),backgroundColor:l.Color.z.optional().default(l.ZERO),borderColor:l.Color.z.optional().default(l.ZERO),ruleColor:l.Color.z.optional().default(l.ZERO),ruleStrokeWidth:p.z.number().optional().default(1),ruleStrokeDash:p.z.number().default(0)});class _t extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Zr)}async afterUpdate(t){const r=d.use(t);this.state.textColor.isZero&&(this.state.textColor=r.colors.text),this.state.backgroundColor.isZero&&(this.state.backgroundColor=r.colors.gray.l1),this.state.borderColor.isZero&&(this.state.borderColor=r.colors.border),this.state.ruleColor.isZero&&(this.state.ruleColor=r.colors.gray.l5),this.internal.dotColor=r.colors.text,this.internal.dotColorContrast=r.colors.textInverted,this.internal.render=d.Context.use(t),this.internal.draw=new qt(this.internal.render.upper2d,r),N.requestRender(t,et)}async afterDelete(t){N.requestRender(t,et)}async render(t){if(this.deleted||this.state.position==null)return;const{region:r}=t,s=l.b.XY.scale(l.Tt.DECIMAL).scale(r),a=l.b.XY.scale(r).scale(l.Tt.DECIMAL),i=await t.findByXDecimal(a.x.pos(this.state.position.x)),o=i.filter(b=>l.G.isFinite(b.value)),{draw:c}=this.internal,u=o.reduce((b,v)=>b+v.position.x,0)/o.length,f=new d.m(o.reduce((b,v)=>b+v.value.x,0)/o.length),g=s.x.pos(u);if(!l.H.contains(l.Tt.xBounds(r),g))return;c.rule({stroke:this.state.ruleColor,lineWidth:this.state.ruleStrokeWidth,lineDash:this.state.ruleStrokeDash,direction:"y",region:r,position:g}),o.forEach(b=>{const v=s.pos(b.position);c.circle({fill:b.color.setAlpha(.5),radius:8,position:v}),c.circle({fill:b.color.setAlpha(.8),radius:5,position:v}),c.circle({fill:b.color.pickByContrast(this.internal.dotColor,this.internal.dotColorContrast),radius:2,position:v})});const m=i.map(b=>`${b.label??""}: ${b.value.y.toFixed(2)}`);m.unshift(`Time: ${f.fString("preciseDate","local")}`);const w=a.pos(this.state.position);c.textContainer({text:m,backgroundColor:this.state.backgroundColor,borderColor:this.state.borderColor,position:this.state.position,direction:"y",level:"small",spacing:.5,offset:{x:12,y:12},root:{x:w.x>.8?"right":"left",y:w.y>.8?"top":"bottom"}})}}h(_t,"TYPE","tooltip");const ti={[_t.TYPE]:_t},uu=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:ti,Tooltip:_t,tooltipStateZ:Zr},Symbol.toStringTag,{value:"Module"})),ei=p.z.object({region:l.Tt.box,wheelPos:p.z.number(),scrolling:p.z.boolean(),empty:p.z.boolean(),visible:p.z.boolean(),telem:Je.optional().default(Ss),font:d.levelZ.optional().default("p"),color:l.Color.z.optional().default(l.ZERO),overshoot:l.G.xy.optional().default({x:0,y:0})}),hu=.98,Xt="lower2d",du={offset:0n,offsetRef:0n,scrollRef:0},ae=class ae extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ae.z);h(this,"values",new d.Dt([]));h(this,"scrollState",du)}async afterUpdate(t){var f;const{internal:r}=this;r.render=d.Context.use(t),r.theme=d.use(t),this.state.color.isZero?this.internal.textColor=r.theme.colors.gray.l8:r.textColor=this.state.color,r.telem=await H(t,this.state.telem,r.telem);const s=d.useExceptionHandler(t),{scrolling:a,wheelPos:i}=this.state;if(this.state.scrolling&&!this.prevState.scrolling){const g=this.values.alignmentBounds.upper-1n;this.scrollState={offset:g,offsetRef:g,scrollRef:this.state.wheelPos}}else if(a){const{scrollState:g,values:m}=this,w=Math.ceil((i-this.scrollState.scrollRef)/this.lineHeight);g.offset=this.values.traverseAlignment(g.offsetRef,-BigInt(w)),g.offset<m.alignmentBounds.lower+BigInt(this.visibleLineCount)&&(g.offset=m.alignmentBounds.lower,this.setState(b=>({...b,wheelPos:this.prevState.wheelPos}))),g.offset>=m.alignmentBounds.upper&&this.setState(b=>({...b,scrolling:!1}))}const[c,u]=await this.internal.telem.value();this.values=new d.Dt(u),this.checkEmpty(),(f=r.stopListeningTelem)==null||f.call(r),r.stopListeningTelem=r.telem.onChange(()=>{this.internal.telem.value().then(([g,m])=>{this.checkEmpty(),this.values=new d.Dt(m),this.requestRender()}).catch(g=>s(g,"Failed to update log"))}),this.requestRender()}checkEmpty(){const t=this.values.length===0;t!==this.state.empty&&this.setState(r=>({...r,empty:t}))}async afterDelete(){var s;const{telem:t,render:r}=this.internal;await((s=t.cleanup)==null?void 0:s.call(t)),r.erase(l.Tt.construct(this.state.region),l.G.ZERO,Xt)}async requestRender(){const{render:t}=this.internal;await t.loop.set({key:`${this.type}-${this.key}`,render:async()=>await this.render(),priority:"high",canvases:[Xt]})}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((l.Tt.height(this.state.region)-12)/this.lineHeight),this.values.length)}async render(){const{render:t}=this.internal,r=this.state.region;if(l.Tt.areaIsZero(r))return;if(!this.state.visible)return async()=>t.erase(r,l.G.ZERO,Xt);let s;if(!this.state.scrolling)s=this.values.subIterator(this.values.length-this.visibleLineCount,this.values.length);else{const f=this.values.traverseAlignment(this.scrollState.offset,-BigInt(this.visibleLineCount));s=this.values.subAlignmentSpanIterator(f,this.visibleLineCount)}const a=this.state.region,i=t[Xt],o=new qt(i,this.internal.theme),c=t.scissor(a,l.G.ZERO,[Xt]);this.renderElements(o,s),this.renderScrollbar(o),c();const u=l.Tt.copy(this.state.region);return async({canvases:f})=>t.erase(u,this.state.overshoot,...f)}renderScrollbar(t){const r=this.state.region,s=l.Tt.height(r)/this.totalHeight*l.Tt.height(r);if(s>=l.Tt.height(r)*hu)return;let a=l.Tt.bottom(r)-s;this.state.scrolling&&(a-=Number(this.values.distance(this.values.alignmentBounds.upper,this.scrollState.offset))/this.values.length*l.Tt.height(r)),a<0&&(a=l.Tt.top(r)),t.container({region:l.Tt.construct({x:l.Tt.right(r)-6,y:a},{width:6,height:s}),bordered:!1,backgroundColor:i=>i.colors.gray.l4})}renderElements(t,r){const s=this.state.region;let a=0;for(const i of r){const o=this.values.dataType.equals(d.g.JSON)?JSON.stringify(i):i.toString();t.text({text:o,level:this.state.font,shade:9,position:l.G.translate(l.Tt.topLeft(s),{x:6,y:a*this.lineHeight+6}),code:!0}),a++}}};h(ae,"TYPE","log"),h(ae,"z",ei);let Pe=ae;const fu={[Pe.TYPE]:Pe},Nr=p.z.object({one:l.G.xy.nullable(),two:l.G.xy.nullable(),hover:l.G.xy.nullable(),color:p.z.union([l.Color.z,p.z.object({verticalLine:l.Color.z.optional().default(l.ZERO),horizontalLine:l.Color.z.optional().default(l.ZERO),obliqueLine:l.Color.z.optional().default(l.ZERO)})]).optional().default(l.ZERO),strokeWidth:p.z.number().optional().default(1),strokeDash:p.z.number().optional().default(2)});class Ft extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Nr)}async afterUpdate(t){const r=d.Context.use(t);this.internal.theme=d.use(t),this.internal.renderCtx=r,this.internal.draw=new qt(r.upper2d,this.internal.theme),N.requestRender(t,et)}async afterDelete(t){N.requestRender(t,K)}get verticalLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.verticalLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.verticalLine}get horizontalLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.horizontalLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.horizontalLine}get obliqueLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.obliqueLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.obliqueLine}async find(t){const{one:r,two:s}=this.state;if(r==null||s==null)return null;const{one:a,two:i}=this.prevState,{dataOne:o,dataTwo:c}=this.internal;if(a!=null&&l.G.equals(r,a)&&i!=null&&l.G.equals(s,i)&&o!=null&&c!=null){const[S,M]=[await t.findByXValue(o.x),await t.findByXValue(c.x)];return S.length===0||M.length===0?null:[S.sort((D,P)=>l.G.distance(o,D.value)-l.G.distance(o,P.value))[0],M.sort((D,P)=>l.G.distance(c,D.value)-l.G.distance(c,P.value))[0]]}const u=l.b.XY.scale(t.region).scale(l.Tt.DECIMAL),[f,g]=[u.pos(r),u.pos(s)],[m,w]=[await t.findByXDecimal(f.x),await t.findByXDecimal(g.x)];if(m.length===0||w.length===0)return null;const[b,v]=[m.sort((S,M)=>l.G.distance(f,S.position)-l.G.distance(f,M.position))[0],w.sort((S,M)=>l.G.distance(g,S.position)-l.G.distance(g,M.position))[0]];return this.internal.dataOne=b.value,this.internal.dataTwo=v.value,[b,v]}async renderHover(t){if(this.state.hover==null)return;const r=this.state.hover,s=l.b.XY.scale(t.region).scale(l.Tt.DECIMAL),a=s.pos(r),i=await t.findByXDecimal(s.pos(r).x);if(i.length===0)return;const o=i.sort((u,f)=>l.G.distance(a,u.position)-l.G.distance(a,f.position))[0],{draw:c}=this.internal;c.circle({fill:o.color.setAlpha(.5),radius:9,position:s.reverse().pos(o.position)})}async render(t){if(this.deleted)return;await this.renderHover(t);const r=await this.find(t);if(r==null)return;const[s,a]=r,{draw:i}=this.internal,{strokeDash:o,strokeWidth:c}=this.state,u=l.b.XY.scale(l.Tt.DECIMAL).scale(t.region),f=u.pos(s.position),g=u.pos(a.position),m=new d.w(Math.abs(s.value.x-a.value.x)),w=Math.abs(s.value.y-a.value.y),b=w/m.seconds;i.line({start:l.G.construct(f.x,f.y),end:l.G.construct(f.x,g.y),stroke:this.verticalLineColor,lineDash:o,lineWidth:c}),i.textContainer({text:[`${w.toFixed(2)} ${s.units??""}`],direction:"x",position:l.G.construct(f.x,(f.y+g.y)/2),level:"small"}),i.line({start:l.G.construct(f.x,g.y),end:l.G.construct(g.x,g.y),stroke:this.horizontalLineColor,lineDash:o,lineWidth:c}),i.textContainer({text:[m.truncate(d.w.MILLISECOND).toString()],direction:"x",position:l.G.construct((f.x+g.x)/2,g.y),level:"small"}),i.line({start:l.G.construct(f.x,f.y),end:l.G.construct(g.x,g.y),stroke:this.obliqueLineColor,lineDash:o,lineWidth:c}),i.textContainer({text:[`${b.toFixed(2)} ${s.units??""} / S`],direction:"x",position:l.G.construct((f.x+g.x)/2,(f.y+g.y)/2),level:"small"}),i.circle({fill:s.color.setAlpha(.5),radius:8,position:f}),i.circle({fill:s.color.setAlpha(.8),radius:5,position:f}),i.circle({fill:new l.Color("#ffffff"),radius:2,position:f}),i.circle({fill:a.color.setAlpha(.5),radius:8,position:g}),i.circle({fill:a.color.setAlpha(.8),radius:5,position:g}),i.circle({fill:new l.Color("#ffffff"),radius:2,position:g})}}h(Ft,"TYPE","measure");const ni={[Ft.TYPE]:Ft},pu=Object.freeze(Object.defineProperty({__proto__:null,Measure:Ft,REGISTRY:ni,measureStateZ:Nr},Symbol.toStringTag,{value:"Module"})),ri=p.z.object({trigger:p.z.number(),command:p.z.number().optional(),value:p.z.number(),sink:Rs.optional().default(bs),source:ks.optional().default(xs)});class Tn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ri)}async afterUpdate(t){var u;this.internal.addStatus=d.useOptionalAggregator(t);const{sink:r,source:s,trigger:a,command:i}=this.state,{internal:o}=this;o.prevTrigger??(o.prevTrigger=a),this.internal.source=await H(t,s,this.internal.source),o.sink=await ze(t,r,o.sink);const c=o.prevTrigger;o.prevTrigger=a,a>c&&i!=null&&await this.internal.sink.set(i),await this.updateValue(),(u=o.stopListening)==null||u.call(o),o.stopListening=o.source.onChange(()=>{this.updateValue().catch(this.reportError.bind(this))})}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Setpoint: ${t.message}`})}async updateValue(){const t=await this.internal.source.value();t!==this.state.value&&this.setState(r=>({...r,value:t,triggered:!1}))}async afterDelete(){var r,s,a,i;const{internal:t}=this;t.stopListening(),await((s=(r=t.source).cleanup)==null?void 0:s.call(r)),await((i=(a=t.sink).cleanup)==null?void 0:i.call(a))}async render(){}}h(Tn,"TYPE","Setpoint");const gu={[Tn.TYPE]:Tn},si=p.z.object({triggered:p.z.boolean(),enabled:p.z.boolean(),sink:En.optional().default(vn),source:rr.optional().default(er)});class bn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",si)}async afterUpdate(t){var u;this.internal.addStatus=d.useOptionalAggregator(t);const{sink:r,source:s,triggered:a,enabled:i}=this.state,{triggered:o}=this.prevState,{internal:c}=this;c.source=await H(t,s,c.source),c.sink=await ze(t,r,c.sink),a&&!o&&await c.sink.set(!i),await this.updateEnabledState(),(u=c.stopListening)==null||u.call(c),c.stopListening=c.source.onChange(()=>{this.updateEnabledState().catch(this.reportError.bind(this))})}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Toggle: ${t.message}`})}async updateEnabledState(){const t=await this.internal.source.value();t!==this.state.enabled&&this.setState(r=>({...r,enabled:t,triggered:!1}))}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var t,r,s,a;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t)),await((a=(s=this.internal.sink).cleanup)==null?void 0:a.call(s))}async render(){}}h(bn,"TYPE","Toggle");const mu={[bn.TYPE]:bn},yu=p.z.object({box:l.Tt.box,telem:ir.optional().default(vs),backgroundTelem:sr.optional().default(Sn),level:d.levelZ.optional().default("p"),color:l.Color.z.optional().default(l.ZERO),precision:p.z.number().optional().default(2),minWidth:p.z.number().optional().default(60),width:p.z.number().optional(),notation:Gs.optional().default("standard"),location:l.K.xy.optional().default({x:"left",y:"center"})}),wu=["upper2d","lower2d"],ie=class ie extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ie.z)}async afterUpdate(t){var s,a;const{internal:r}=this;r.renderCtx=d.Context.use(t),r.theme=d.use(t),this.state.color.isZero?this.internal.textColor=r.theme.colors.gray.l8:r.textColor=this.state.color,r.telem=await H(t,this.state.telem,r.telem),(s=r.stopListening)==null||s.call(r),r.stopListening=this.internal.telem.onChange(()=>this.requestRender()),r.backgroundTelem=await H(t,this.state.backgroundTelem,r.backgroundTelem),(a=r.stopListeningBackground)==null||a.call(r),r.stopListeningBackground=this.internal.backgroundTelem.onChange(()=>this.requestRender()),this.internal.requestRender=N.useOptionalRequest(t),this.requestRender()}async afterDelete(){var r,s,a,i,o,c;const{internal:t}=this;(r=t.stopListening)==null||r.call(t),(s=t.stopListeningBackground)==null||s.call(t),await((i=(a=t.telem).cleanup)==null?void 0:i.call(a)),await((c=(o=t.backgroundTelem).cleanup)==null?void 0:c.call(o)),t.requestRender==null?t.renderCtx.erase(l.Tt.construct(this.state.box),l.G.ZERO,...wu):t.requestRender(K)}requestRender(){const{requestRender:t}=this.internal;t!=null?t(K):this.render({})}get fontHeight(){const{theme:t}=this.internal;return t.typography[this.state.level].size*t.sizes.base}maybeUpdateWidth(t){const{theme:r}=this.internal,s=t+r.sizes.base+this.fontHeight;this.state.width==null||this.state.width+this.fontHeight*.5<s||this.state.minWidth>s&&this.state.width!==this.state.minWidth?this.setState(a=>({...a,width:Math.max(s,a.minWidth)})):this.state.width-this.fontHeight>s&&this.setState(a=>({...a,width:Math.max(s,a.minWidth)}))}async render({viewportScale:t=l.b.XY.IDENTITY}){const{renderCtx:r,telem:s,backgroundTelem:a}=this.internal,i=l.Tt.construct(this.state.box);if(l.Tt.areaIsZero(i))return;const{location:o}=this.state,c=r.lower2d.applyScale(t);let u=await s.value();const f=d.fontString(this.internal.theme,{level:this.state.level,code:!0});c.font=f;const g=this.fontHeight,m=u[0]=="-";m&&(u=u.slice(1));const{theme:w}=this.internal,b=d.dimensions(u,f,c).width+w.sizes.base;this.internal.requestRender==null&&r.erase(l.Tt.construct(this.prevState.box)),this.maybeUpdateWidth(b);const v={...l.G.ZERO};o.x==="left"&&(v.x=6+g*.75),o.x==="center"&&(v.x=l.Tt.width(i)/2-b/2),o.y==="center"&&(v.y=l.Tt.height(i)/2);const S=l.G.translate(l.Tt.topLeft(i),v),M=c.scissor(i,void 0);let D=!0;if(this.state.backgroundTelem.type!=Sn.type){const P=r.lower2d.applyScale(t),z=await a.value();D=z.isZero,z.isZero||(P.fillStyle=z.hex,P.rect(...l.G.couple(l.Tt.topLeft(i)),l.Tt.width(i),l.Tt.height(i)),P.fill(),c.fillStyle=z.pickByContrast(w.colors.gray.l0,w.colors.gray.l9).hex)}D&&(c.fillStyle=this.internal.textColor.hex),c.textBaseline="middle",m&&c.fillText("-",...l.G.couple(l.G.translateX(S,-g*.6))),c.fillText(u,...l.G.couple(S)),M()}};h(ie,"TYPE","value"),h(ie,"z",yu);let Ht=ie;const ai={[Ht.TYPE]:Ht},Tu=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:ai,Value:Ht},Symbol.toStringTag,{value:"Module"})),bu=d.mp.payloadZ.extend({viewport:l.H.bounds}),ws=e=>l.Color.z.safeParse(e).success,ii=p.z.object({cursor:l.G.xy.or(p.z.null()),hovered:bu.or(p.z.null()),count:p.z.number()});class ke extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ii);h(this,"fetchedInitial",d.E.ZERO)}async afterUpdate(t){const{internal:r}=this;r.render=d.Context.use(t),r.draw=new qt(r.render.upper2d,d.use(t)),r.ranges??(r.ranges=new Map);const s=Me(t);s!=null&&(r.client=s,r.tracker==null&&(r.tracker=await r.client.ranges.openTracker(),r.tracker.onChange(a=>{a.forEach(i=>{i.variant==="delete"?r.ranges.delete(i.key):ws(i.value.color)&&r.ranges.set(i.key,i.value)}),N.requestRender(t,et),this.setState(i=>({...i,count:r.ranges.size}))}),N.requestRender(t,et)))}async fetchInitial(t){const{internal:r}=this;if(r.client==null||this.fetchedInitial.roughlyEquals(t,d.w.minutes(1)))return;this.fetchedInitial=t,(await r.client.ranges.retrieve(t)).forEach(a=>{ws(a.color)&&r.ranges.set(a.key,a)}),this.setState(a=>({...a,count:r.ranges.size}))}async render(t){const{dataToDecimalScale:r,region:s,viewport:a,timeRange:i}=t;await this.fetchInitial(i);const{draw:o,ranges:c}=this.internal,u=r.scale(l.Tt.xBounds(s)),f=this.state.cursor==null?null:this.state.cursor.x;let g=null;const m=o.canvas.scissor(l.Tt.construct({x:l.Tt.left(s),y:l.Tt.top(s)-35},{x:l.Tt.right(s),y:l.Tt.bottom(s)}));c.forEach(w=>{const b=l.Color.z.safeParse(w.color);if(!b.success)return;const v=b.data;let S=u.pos(Number(w.timeRange.start.valueOf()));const M=u.pos(Number(w.timeRange.end.valueOf()));if(M<l.Tt.left(s)||S>l.Tt.right(s))return;S=l.Y(S,l.Tt.left(s)-2,l.Tt.right(s)-1);let D=!1;f!=null&&(D=l.H.contains({lower:S,upper:M},f)),D&&(g={key:w.key,name:w.name,color:w.color,timeRange:w.timeRange,viewport:{lower:r.scale(l.Tt.xBounds(a)).pos(Number(w.timeRange.start.valueOf())),upper:r.scale(l.Tt.xBounds(a)).pos(Number(w.timeRange.end.valueOf()))}}),o.container({region:l.Tt.construct({x:S,y:l.Tt.top(s)-1},{x:M,y:l.Tt.bottom(s)-1}),backgroundColor:v.setAlpha(.2),bordered:!1});const P=l.Tt.construct({x:S+1,y:l.Tt.top(s)-34},{x:M-1,y:l.Tt.top(s)-12});o.container({region:P,backgroundColor:l.Tt.width(P)<20?v.setAlpha(.4):z=>D?z.colors.gray.l2:z.colors.gray.l0,bordered:!0,borderWidth:1,borderRadius:2,borderColor:v.setAlpha(.8)}),o.text({text:w.name,position:{x:S+8,y:l.Tt.top(s)-30},level:"small",shade:8,weight:500,maxWidth:M-S-16})}),m(),g!=null?this.setState(w=>({...w,hovered:g})):this.state.hovered&&this.setState(w=>({...w,hovered:null}))}}h(ke,"TYPE","range-provider");const xu={[dn.TYPE]:dn,[ke.TYPE]:ke},vu=Ae;class Re extends Oa{constructor(){super(...arguments);h(this,"schema",Ae)}async render(t){if(this.deleted)return;const[r,s]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(this.renderAxis(t,r.reverse()),await this.renderYAxes(t,r),await this.renderRangeAnnotations(t,r),s!=null)throw s}async findByXDecimal(t,r){const[s,a]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(a!=null)throw a;return await this.findByXValue(t,s.reverse().pos(r))}async findByXValue(t,r){const[s,a]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(a!=null)throw a;const i={...t,xDataToDecimalScale:s},o=this.yAxes.map(async c=>await c.findByXValue(i,r));return(await Promise.all(o)).flat()}async renderYAxes(t,r){const s={...t,xDataToDecimalScale:r};await Promise.all(this.yAxes.map(async a=>await a.render(s)))}get yAxes(){return this.childrenOfType(be.TYPE)}get rangeAnnotations(){return this.childrenOfType(ke.TYPE)}async renderRangeAnnotations(t,r){const[s,a]=await this.bounds(t.hold,this.dataBounds.bind(this));if(a!=null)throw a;await Promise.all(this.rangeAnnotations.map(async i=>await i.render({dataToDecimalScale:r,region:t.plot,viewport:t.viewport,timeRange:new d.E(s.lower,s.upper)})))}async dataBounds(){return await Promise.all(this.yAxes.map(async t=>await t.xBounds()))}}h(Re,"TYPE","XAxis");const oi=p.z.object({container:l.Tt.box,viewport:l.Tt.box,hold:p.z.boolean().optional().default(!1),grid:p.z.record(ha),visible:p.z.boolean().optional().default(!0),clearOverScan:l.G.crudeZ.optional().default(l.G.ZERO)}),Su=(e,n)=>{const t=l.Tt.width(e)*Math.sqrt(l.Tt.height(e)),r=l.Tt.width(n)*Math.sqrt(l.Tt.height(n));return t/r};class xn extends d.Composite{constructor(){super(...arguments);h(this,"schema",oi)}async afterUpdate(t){this.internal.instrumentation=De(t,"lineplot"),this.internal.aggregate=d.useAggregator(t),this.internal.renderCtx=d.Context.use(t),N.control(t,r=>this.requestRender("low",r)),this.requestRender("high",K)}async afterDelete(t){this.internal.renderCtx=d.Context.use(t),this.requestRender("high",K)}async findByXDecimal(t){const r={...this.state,plot:this.calculatePlot(),exposure:this.exposure},s=this.axes.flatMap(async a=>await a.findByXDecimal(r,t));return(await Promise.all(s)).flat()}async findByXValue(t){const r={...this.state,plot:this.calculatePlot(),exposure:this.exposure},s=this.axes.flatMap(async a=>await a.findByXValue(r,t));return(await Promise.all(s)).flat()}get axes(){return this.childrenOfType(Re.TYPE)}get tooltips(){return this.childrenOfType(_t.TYPE)}get measures(){return this.childrenOfType(Ft.TYPE)}get exposure(){return Su(this.state.viewport,this.state.container)}async renderAxes(t,r){const s={...this.state,plot:t,canvases:r,exposure:this.exposure};await Promise.all(this.axes.map(async a=>await a.render(s)))}async renderTooltips(t,r){const s={findByXDecimal:this.findByXDecimal.bind(this),region:t,canvases:r};await Promise.all(this.tooltips.map(async a=>await a.render(s)))}async renderMeasures(t){const r={findByXDecimal:this.findByXDecimal.bind(this),findByXValue:this.findByXValue.bind(this),region:t};await Promise.all(this.measures.map(async s=>await s.render(r)))}calculatePlot(){return io(this.state.grid,this.state.container)}async render(t){const{renderCtx:r}=this.internal,{instrumentation:s}=this.internal;if(this.deleted){s.L.debug("deleted, skipping render",{key:this.key});return}if(!this.state.visible)return s.L.debug("not visible, skipping render",{key:this.key}),async({canvases:f})=>r.erase(this.state.container,this.state.clearOverScan,...f);const a=this.calculatePlot();s.L.debug("rendering",{key:this.key,viewport:this.state.viewport,container:this.state.container,grid:this.state.grid,plot:a,canvases:t});const i=l.G.construct(this.state.clearOverScan),o=r.scissor(this.state.container,i,t.filter(f=>f!=="gl")),c=r.scissor(a,l.G.ZERO,t.filter(f=>f==="gl"));try{await this.renderAxes(a,t),await this.renderTooltips(a,t),await this.renderMeasures(a),r.gl.finish(),r.gl.flush(),r.gl.finish()}catch(f){if(f.message.toLowerCase().includes("bigint"))return;this.internal.aggregate({key:`${this.type}-${this.key}`,variant:"error",message:f.message})}finally{o(),c()}s.L.debug("rendered",{key:this.key});const u=l.Tt.copy(this.state.container);return async({canvases:f})=>r.erase(u,this.state.clearOverScan,...f)}requestRender(t,r){const{renderCtx:s}=this.internal;let a=["upper2d","lower2d","gl"];r===et&&(a=["upper2d"]),s.loop.set({key:`${this.type}-${this.key}`,render:async()=>await this.render(a),priority:t,canvases:a})}}h(xn,"TYPE","LinePlot");const Cu={[xn.TYPE]:xn,[Re.TYPE]:Re,[be.TYPE]:be};exports.AcquireChannelControl=Se;exports.Annotation=dn;exports.AuthoritySource=Ce;exports.BaseProvider=At;exports.Button=yn;exports.Canvas=za;exports.Canvas$1=Ee;exports.Chip=fn;exports.Controller=N;exports.Controller$1=pn;exports.Diagram=lu;exports.Diagram$1=Gt;exports.Indicator=gn;exports.Legend=mn;exports.Light=wn;exports.Line=Te;exports.LinePlot=xn;exports.Log=Pe;exports.Measure=Ft;exports.Provider=Fe;exports.Provider$1=ke;exports.Provider$2=Fn;exports.REASON_DATA=Gn;exports.REASON_LAYOUT=K;exports.REASON_TOOL=et;exports.REGISTRY=Gi;exports.REGISTRY$1=iu;exports.REGISTRY$10=Na;exports.REGISTRY$11=gu;exports.REGISTRY$12=Ts;exports.REGISTRY$13=ua;exports.REGISTRY$14=mu;exports.REGISTRY$15=ti;exports.REGISTRY$16=ai;exports.REGISTRY$17=fu;exports.REGISTRY$18=eu;exports.REGISTRY$2=Ka;exports.REGISTRY$3=au;exports.REGISTRY$4=Qa;exports.REGISTRY$5=cu;exports.REGISTRY$6=qc;exports.REGISTRY$7=Cu;exports.REGISTRY$8=ni;exports.REGISTRY$9=xu;exports.Rule=Ut;exports.STATUSES=Ga;exports.SetChannelValue=ve;exports.Setpoint=Tn;exports.StateProvider=Bt;exports.Table=xe;exports.Toggle=bn;exports.Tooltip=_t;exports.Value=Ht;exports.XAxis=Re;exports.YAxis=be;exports.ZERO_CONTEXT_VALUE=Jn;exports.acquireChannelControl=ru;exports.acquireChannelControlPropsZ=qa;exports.aether=Kc;exports.annotationStateZ=Ia;exports.authoritySource=su;exports.authoritySourceProps=ja;exports.axisStateZ=Dr;exports.buttonStateZ=Xa;exports.canvas=ou;exports.canvasStateZ=Or;exports.channelData=Os;exports.chipStateZ=$a;exports.color=Zt;exports.colorGradient=Ks;exports.controllerStateZ=Fa;exports.coreAxisStateZ=Ae;exports.diagramStateZ=Ar;exports.external=so;exports.indicatorStateZ=Wa;exports.interpolateNumber=we;exports.interpolateRgb=Wn;exports.interpolateString=ma;exports.legendStateZ=Va;exports.lightStateZ=Ja;exports.linePlotStateZ=oi;exports.logState=ei;exports.measure=pu;exports.measureStateZ=Nr;exports.newTickFactory=Kn;exports.parseAutoBounds=Aa;exports.provider=Ci;exports.providerStateZ=ii;exports.providerStateZ$1=ia;exports.providerStateZ$2=Tr;exports.regions=ut;exports.rollingAverage=Vs;exports.rollingAverageProps=mr;exports.ruleStateZ=Lr;exports.scaleNumber=Js;exports.setChannelValue=nu;exports.setChannelValuePropsZ=Ha;exports.setpoint=Fs;exports.setpointStateZ=ri;exports.sinkPipeline=Ds;exports.sinkPipelinePropsZ=ur;exports.sourcePipeline=zs;exports.sourcePipelinePropsZ=lr;exports.stateProviderStateZ=Ua;exports.stateZ=Za;exports.statusZ=_a;exports.streamChannelData=As;exports.streamChannelValue=Zs;exports.streamChannelValuePropsZ=hr;exports.stringSourceSpecZ=ir;exports.stringifyNumber=Ws;exports.stringifyNumberProps=gr;exports.sugaredStateZ=Ba;exports.tickFactoryProps=zr;exports.tickType=Yr;exports.toggleStateZ=si;exports.tooltip=uu;exports.tooltipStateZ=Zr;exports.value=Tu;exports.withinBounds=Hs;exports.withinBoundsProps=pr;exports.withinSizeThreshold=Da;exports.xAxisStateZ=vu;exports.yAxisStateZ=Qc;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("./jsx-runtime-D8EVjfnb.cjs"),r=require("./Toggle
|
|
1
|
+
"use strict";const o=require("./jsx-runtime-D8EVjfnb.cjs"),r=require("./Toggle-BOWYgKry.cjs"),n="://",E=`https${n}`,c=({href:t,target:s,autoFormat:i=!1,...u})=>{let e=t;return i&&t!=null&&!t.includes(n)&&(e=E+e),o.jsxRuntimeExports.jsx(r.Button,{el:"a",href:e,target:s,...u})};exports.Link=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("./jsx-runtime-D8EVjfnb.cjs"),e=require("./css-
|
|
1
|
+
"use strict";const i=require("./jsx-runtime-D8EVjfnb.cjs"),e=require("./css-DT9dIVAb.cjs"),k=require("react"),C=({el:t,children:r,...n})=>k.createElement(t,n,r),v=Object.freeze(Object.defineProperty({__proto__:null,Element:C},Symbol.toStringTag,{value:"Module"})),w=["start","center","end","stretch"],y=["start","center","end","spaceBetween","spaceAround","spaceEvenly"],j=(t,r)=>r??(t==="right"||t==="bottom"),m=({style:t,align:r,className:n,grow:s,shrink:c,empty:u=!1,size:a="medium",justify:p="start",reverse:o,direction:S="y",wrap:d=!1,bordered:l=!1,borderShade:N,borderWidth:E,rounded:h=!1,el:B="div",background:x,...I})=>{const b=e.g.construct(S);o=j(S,o);let f;return u?[a,f]=[0,0]:typeof a=="number"&&(f=`${a}rem`),t={gap:f,flexDirection:M(b,o),justifyContent:R[p],alignItems:r,flexWrap:d?"wrap":"nowrap",borderWidth:E,borderColor:e.CSS.shadeVar(N),...t},s!=null&&(t.flexGrow=Number(s)),c!=null&&(t.flexShrink=Number(c)),x!=null&&(t.backgroundColor=e.CSS.shadeVar(x)),i.jsxRuntimeExports.jsx(C,{el:B,className:e.CSS(e.CSS.B("space"),e.CSS.dir(b),e.CSS.bordered(l),e.CSS.rounded(h),typeof a=="string"&&e.CSS.BM("space",a),n),style:t,...I})},M=(t,r)=>{const n=t==="x"?"row":"column";return r?`${n}-reverse`:n},R={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly"},T=({className:t,justify:r="center",align:n="center",ref:s,...c})=>i.jsxRuntimeExports.jsx(m,{ref:s,justify:r,align:n,className:e.CSS(e.CSS.BM("space","centered"),t),...c}),g=({className:t,size:r="medium",reverse:n=!1,direction:s="x",bordered:c=!0,borderShade:u=3,rounded:a=!0,shadow:p=!1,borderWidth:o,style:S,...d})=>{const l={[e.CSS.var("pack-border-shade")]:e.CSS.shadeVar(u),...S};return o!=null&&(l[e.CSS.var("pack-border-width")]=`${o}px`),i.jsxRuntimeExports.jsx(m,{direction:s,reverse:n,className:e.CSS(e.CSS.B("pack"),p&&e.CSS.BM("pack","shadow"),e.CSS.dir(s),typeof r!="number"&&e.CSS.BM("pack",r),n&&e.CSS.BM("pack","reverse"),t),style:l,bordered:c,rounded:a,...d,empty:!0})};exports.ALIGNMENTS=w;exports.Center=T;exports.Element=C;exports.Generic=v;exports.JUSTIFICATIONS=y;exports.Pack=g;exports.Space=m;exports.shouldReverse=j;
|