@synnaxlabs/pluto 0.44.2 → 0.44.3
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-D5cL3URg.js → Animated-BHxq6Pmm.js} +2 -2
- package/dist/{Animated-DnsZ5vvU.cjs → Animated-DEXELMDa.cjs} +1 -1
- package/dist/LinePlot-BJ10hKs7.cjs +53 -0
- package/dist/{provider-Bp-CLkh2.js → LinePlot-VIcFjuPQ.js} +4543 -4448
- package/dist/{Toggle-Dol9oHzM.js → Toggle-C--I90ch.js} +1 -1
- package/dist/{Toggle-Ckdi4fKV.cjs → Toggle-CCsw0kkq.cjs} +1 -1
- package/dist/{Video-BidrtYj_.cjs → Video-BbRLzkdH.cjs} +1 -1
- package/dist/{Video-Cm8ZBqid.js → Video-DdsVXhnt.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-Dl9aM7Jz.js → css-BKrX40Df.js} +713 -685
- package/dist/css-TyQvZIXQ.cjs +8 -0
- package/dist/css.cjs +1 -1
- package/dist/css.js +2 -2
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +1 -1
- package/dist/eraser-Bxknv-HS.cjs +63 -0
- package/dist/{eraser-CZknVTjw.js → eraser-DtXU7kOS.js} +4811 -4746
- package/dist/ether.cjs +1 -1
- package/dist/ether.js +66 -63
- package/dist/{external-CU_XHLqP.js → external-BApQK7XP.js} +3 -3
- package/dist/{external-CkvXTCCL.cjs → external-BBXhtVjD.cjs} +1 -1
- package/dist/{external-xfHaehZH.js → external-BOmNpcyI.js} +20 -20
- package/dist/{external-ClD4VLgc.cjs → external-BPF50O_x.cjs} +1 -1
- package/dist/{external-DOd9BcLC.js → external-BT0nByPv.js} +2 -2
- package/dist/{external-BGCkpetp.cjs → external-BUAnicLg.cjs} +1 -1
- package/dist/{external-_eEnQPcq.cjs → external-BaRBYE0N.cjs} +1 -1
- package/dist/{external-B8qSW3N8.js → external-BmfZaFKB.js} +3 -3
- package/dist/external-BsyCwXWB.cjs +1 -0
- package/dist/{external-B5RyMtMy.js → external-Bt-WjDvD.js} +8 -8
- package/dist/{external-B_NFroo8.js → external-CEMgElRx.js} +10 -10
- package/dist/{external-DFsKdN71.cjs → external-COBt6FnN.cjs} +1 -1
- package/dist/{external-DXY1bIut.cjs → external-CZSk2V5E.cjs} +1 -1
- package/dist/{external-CY2bvy20.cjs → external-Cw5iYImi.cjs} +1 -1
- package/dist/{external-Ylv9Wts9.js → external-Dgui980d.js} +74 -75
- package/dist/external-Dwfn2jsF.js +42 -0
- package/dist/external-EMhi5ISu.cjs +1 -0
- package/dist/{external-DPqPAgoV.cjs → external-Jee63xkv.cjs} +1 -1
- package/dist/{external-CJZTgfAH.js → external-NUi5IwGn.js} +20 -20
- package/dist/{external-DnnHYQqD.js → external-ONwuyKzG.js} +27 -27
- package/dist/{external-DZqxSCvz.cjs → external-TAYJZFme.cjs} +1 -1
- package/dist/external-bvOijYCw.cjs +1 -0
- package/dist/{external-pm79tCDD.js → external-dkXc0y5z.js} +20 -20
- package/dist/{external-BYJw6DJV.js → external-n4gJTJfw.js} +23 -23
- package/dist/{external-b2X_jilF.js → external-tHxdTvxn.js} +2 -2
- package/dist/{external-BJ91nMtQ.cjs → external-yddEc8os.cjs} +1 -1
- package/dist/flex.cjs +1 -1
- package/dist/flex.js +1 -1
- package/dist/{fontString-BptzSQcY.cjs → fontString-BWGnZU-8.cjs} +1 -1
- package/dist/{fontString-Bm52S4Lo.js → fontString-D2-HUuI_.js} +2 -2
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.js +10291 -10365
- 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/pluto.css +1 -1
- package/dist/src/channel/AliasInput.d.ts +3 -1
- package/dist/src/channel/AliasInput.d.ts.map +1 -1
- package/dist/src/channel/Select.d.ts.map +1 -1
- package/dist/src/channel/external.d.ts +0 -2
- package/dist/src/channel/external.d.ts.map +1 -1
- package/dist/src/channel/queries.d.ts +84 -6
- package/dist/src/channel/queries.d.ts.map +1 -1
- package/dist/src/dialog/Frame.d.ts.map +1 -1
- package/dist/src/flux/Provider.d.ts +9 -7
- package/dist/src/flux/Provider.d.ts.map +1 -1
- package/dist/src/flux/aether/external.d.ts +4 -3
- package/dist/src/flux/aether/external.d.ts.map +1 -1
- package/dist/src/flux/aether/provider.d.ts +31 -25
- package/dist/src/flux/aether/provider.d.ts.map +1 -1
- package/dist/src/flux/core/client.d.ts +21 -0
- package/dist/src/flux/core/client.d.ts.map +1 -0
- package/dist/src/flux/core/external.d.ts +4 -0
- package/dist/src/flux/core/external.d.ts.map +1 -0
- package/dist/src/flux/core/index.d.ts +2 -0
- package/dist/src/flux/core/index.d.ts.map +1 -0
- package/dist/src/flux/core/params.d.ts.map +1 -0
- package/dist/src/flux/core/store.d.ts +128 -0
- package/dist/src/flux/core/store.d.ts.map +1 -0
- package/dist/src/flux/core/store.spec.d.ts +2 -0
- package/dist/src/flux/core/store.spec.d.ts.map +1 -0
- package/dist/src/flux/core/streamer.d.ts +31 -0
- package/dist/src/flux/core/streamer.d.ts.map +1 -0
- package/dist/src/flux/core/streamer.spec.d.ts.map +1 -0
- package/dist/src/flux/external.d.ts +3 -5
- package/dist/src/flux/external.d.ts.map +1 -1
- package/dist/src/flux/form.d.ts +6 -3
- package/dist/src/flux/form.d.ts.map +1 -1
- package/dist/src/flux/list.d.ts +13 -13
- package/dist/src/flux/list.d.ts.map +1 -1
- package/dist/src/flux/result.d.ts +10 -9
- package/dist/src/flux/result.d.ts.map +1 -1
- package/dist/src/flux/retrieve.d.ts +18 -39
- package/dist/src/flux/retrieve.d.ts.map +1 -1
- package/dist/src/flux/update.d.ts +12 -7
- package/dist/src/flux/update.d.ts.map +1 -1
- package/dist/src/form/state.d.ts +3 -1
- package/dist/src/form/state.d.ts.map +1 -1
- package/dist/src/form/use.d.ts +1 -0
- package/dist/src/form/use.d.ts.map +1 -1
- package/dist/src/hardware/device/queries.d.ts +12 -4
- package/dist/src/hardware/device/queries.d.ts.map +1 -1
- package/dist/src/hardware/rack/external.d.ts +0 -3
- package/dist/src/hardware/rack/external.d.ts.map +1 -1
- package/dist/src/hardware/rack/queries.d.ts +13 -0
- package/dist/src/hardware/rack/queries.d.ts.map +1 -1
- package/dist/src/hardware/task/queries.d.ts +12 -5
- package/dist/src/hardware/task/queries.d.ts.map +1 -1
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/useDestructors.d.ts +7 -0
- package/dist/src/hooks/useDestructors.d.ts.map +1 -0
- package/dist/src/label/queries.d.ts +21 -19
- package/dist/src/label/queries.d.ts.map +1 -1
- package/dist/src/menu/ContextMenu.d.ts +1 -0
- package/dist/src/menu/ContextMenu.d.ts.map +1 -1
- package/dist/src/mosaic/tree.d.ts.map +1 -1
- package/dist/src/ontology/queries.d.ts +19 -4
- package/dist/src/ontology/queries.d.ts.map +1 -1
- package/dist/src/pluto/Pluto.d.ts +23 -2
- package/dist/src/pluto/Pluto.d.ts.map +1 -1
- package/dist/src/pluto/aether/pluto.d.ts.map +1 -1
- package/dist/src/ranger/aether/index.d.ts +2 -0
- package/dist/src/ranger/aether/index.d.ts.map +1 -0
- package/dist/src/ranger/aether/queries.d.ts +11 -0
- package/dist/src/ranger/aether/queries.d.ts.map +1 -0
- package/dist/src/ranger/queries.d.ts +28 -22
- package/dist/src/ranger/queries.d.ts.map +1 -1
- package/dist/src/state/state.d.ts +1 -1
- package/dist/src/state/state.d.ts.map +1 -1
- package/dist/src/status/Aggregator.d.ts +3 -0
- package/dist/src/status/Aggregator.d.ts.map +1 -1
- package/dist/src/status/Summary.d.ts.map +1 -1
- package/dist/src/status/aether/aggregator.d.ts +2 -12
- package/dist/src/status/aether/aggregator.d.ts.map +1 -1
- package/dist/src/status/aether/errorHandler.d.ts +15 -0
- package/dist/src/status/aether/errorHandler.d.ts.map +1 -0
- package/dist/src/status/aether/errorHandler.spec.d.ts +2 -0
- package/dist/src/status/aether/errorHandler.spec.d.ts.map +1 -0
- package/dist/src/status/aether/external.d.ts +3 -0
- package/dist/src/status/aether/external.d.ts.map +1 -0
- package/dist/src/status/aether/index.d.ts +1 -1
- package/dist/src/status/aether/index.d.ts.map +1 -1
- package/dist/src/testutil/Synnax.d.ts +6 -1
- package/dist/src/testutil/Synnax.d.ts.map +1 -1
- package/dist/src/text/Editable.d.ts.map +1 -1
- package/dist/src/vis/lineplot/range/aether/provider.d.ts +6 -18
- package/dist/src/vis/lineplot/range/aether/provider.d.ts.map +1 -1
- package/dist/src/vis/schematic/Forms.d.ts.map +1 -1
- package/dist/src/vis/value/TelemForm.d.ts.map +1 -1
- package/dist/src/workspace/queries.d.ts +8 -0
- package/dist/src/workspace/queries.d.ts.map +1 -1
- package/dist/{symbols-B15FeAg9.cjs → symbols-DWZqHjhU.cjs} +45 -45
- package/dist/{symbols-Lz5vQQDw.js → symbols-aLnytgtc.js} +6093 -6048
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text.cjs +1 -1
- package/dist/text.js +2 -2
- package/dist/theming.cjs +1 -1
- package/dist/theming.js +2 -2
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +1 -1
- package/dist/triggers.cjs +1 -1
- package/dist/triggers.js +1 -1
- package/dist/{units-BGkvnLO-.cjs → units-XE06scfL.cjs} +1 -1
- package/dist/{units-HcS_zslH.js → units-ny6lkoIv.js} +1 -1
- package/dist/video.cjs +1 -1
- package/dist/video.js +1 -1
- package/package.json +5 -5
- package/dist/Menu-C-MABQ1r.js +0 -61
- package/dist/Menu-vR5-lqo4.cjs +0 -1
- package/dist/css-9yccD6t_.cjs +0 -8
- package/dist/eraser-CLWNvWDn.cjs +0 -63
- package/dist/external-CS6l_QN4.cjs +0 -1
- package/dist/external-CVNscTLA.js +0 -42
- package/dist/external-CtooTI5M.cjs +0 -1
- package/dist/external-DNHOS3w0.cjs +0 -1
- package/dist/provider-DBSsDoFS.cjs +0 -53
- package/dist/src/channel/AliasContext.d.ts +0 -19
- package/dist/src/channel/AliasContext.d.ts.map +0 -1
- package/dist/src/channel/AliasProvider.d.ts +0 -6
- package/dist/src/channel/AliasProvider.d.ts.map +0 -1
- package/dist/src/flux/Context.d.ts +0 -4
- package/dist/src/flux/Context.d.ts.map +0 -1
- package/dist/src/flux/aether/listeners.d.ts +0 -16
- package/dist/src/flux/aether/listeners.d.ts.map +0 -1
- package/dist/src/flux/aether/params.d.ts.map +0 -1
- package/dist/src/flux/aether/streamer.d.ts +0 -22
- package/dist/src/flux/aether/streamer.d.ts.map +0 -1
- package/dist/src/flux/aether/streamer.spec.d.ts.map +0 -1
- package/dist/src/flux/aether/types.d.ts +0 -13
- package/dist/src/flux/aether/types.d.ts.map +0 -1
- package/dist/src/flux/listeners.d.ts +0 -4
- package/dist/src/flux/listeners.d.ts.map +0 -1
- package/dist/src/flux/listeners.spec.d.ts +0 -2
- package/dist/src/flux/listeners.spec.d.ts.map +0 -1
- package/dist/src/flux/useMountListeners.d.ts +0 -7
- package/dist/src/flux/useMountListeners.d.ts.map +0 -1
- package/dist/src/hardware/rack/synchronizers.d.ts +0 -3
- package/dist/src/hardware/rack/synchronizers.d.ts.map +0 -1
- package/dist/src/hardware/rack/use.d.ts +0 -3
- package/dist/src/hardware/rack/use.d.ts.map +0 -1
- package/dist/src/hardware/rack/useStatus.d.ts +0 -3
- package/dist/src/hardware/rack/useStatus.d.ts.map +0 -1
- /package/dist/src/flux/{aether → core}/params.d.ts +0 -0
- /package/dist/src/flux/{aether → core}/streamer.spec.d.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("./jsx-runtime-CITbqOLs.cjs"),o=require("./css-9yccD6t_.cjs"),x=require("react"),a=require("./symbols-B15FeAg9.cjs"),P=require("./eraser-CLWNvWDn.cjs");require("react-dom");require("./Menu-vR5-lqo4.cjs");const d=require("zod"),w=x.createContext({tabs:[]}),z=w,y=()=>x.use(w),O="tabs-selector",L=({className:r,altColor:t=!1,size:e="medium",direction:l="x",contextMenu:n,addTooltip:c,...u})=>{const{tabs:S,selected:j,onSelect:b,onClose:B,closable:g,onDragEnd:v,onDragStart:D,onDrop:R,onRename:E,onCreate:f}=y(),h=a.useContextMenu(),[N,C]=x.useState(!1);return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[n!=null&&s.jsxRuntimeExports.jsx(a.ContextMenu,{style:{height:"fit-content"},...h,menu:n}),s.jsxRuntimeExports.jsxs(a.Box,{className:o.CSS(o.CSS.B(O),r,h.className,N&&o.CSS.M("drag-over")),size:e,align:"center",justify:"between",empty:!0,direction:l,onContextMenu:h.open,onDrop:R,...u,children:[s.jsxRuntimeExports.jsxs(a.Box,{direction:l,className:o.CSS.BE(O,"tabs"),empty:!0,children:[S.map(p=>s.jsxRuntimeExports.jsx(J,{selected:j,altColor:t,onSelect:b,onClose:B,onDragStart:D,onDragEnd:v,onRename:E,closable:p.closable??g,size:e,...p},p.tabKey)),R!=null&&s.jsxRuntimeExports.jsx(a.Box,{onDragOver:()=>C(!0),onDragLeave:()=>C(!1),onDragEnd:()=>C(!1),onDrop:()=>C(!1),grow:!0})]}),f!=null&&s.jsxRuntimeExports.jsx(a.Box,{className:o.CSS.BE(O,"actions"),children:s.jsxRuntimeExports.jsx(a.Button,{size:e,sharp:!0,onClick:f,tooltip:c,variant:"text",children:s.jsxRuntimeExports.jsx(a.Add,{})})})]})]})},X=({unsavedChanges:r,...t})=>{const e=s.jsxRuntimeExports.jsx(a.Close,{...t});return r?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(a.Circle,{}),e]}):e},G=r=>{const t=o.Ho.construct(r.target.closest(".pluto-tabs-selector__btn")),e=o.K.construct(r);return o.C.Scale.scale(o.Ho.left(t),o.Ho.right(t)).scale(0,1).pos(e.x)<.5?"left":"right"},$=({loading:r,icon:t,level:e="p"})=>(r&&(t=s.jsxRuntimeExports.jsx(a.Loading,{})),a.resolve(t,{className:o.CSS.BE(O,"icon"),style:{color:o.CSS.colorVar(9),height:o.CSS.levelSizeVar(e),width:o.CSS.levelSizeVar(e)}})),J=({selected:r,altColor:t=!1,onSelect:e,onClose:l,tabKey:n,name:c,onDragStart:u,onDragEnd:S,onRename:j,closable:b=!0,icon:B,size:g,editable:v=!0,unsavedChanges:D=!1,loading:R=!1,onDrop:E})=>{const f=x.useCallback(i=>u?.(i,{tabKey:n,name:c}),[u,n,c]),h=x.useCallback(i=>S?.(i,{tabKey:n,name:c}),[S,n,c]),N=x.useCallback(i=>{i.preventDefault(),i.stopPropagation(),l?.(n)},[l,n]),C=x.useCallback(()=>e?.(n),[e,n]),[p,m]=x.useState(null),T=x.useCallback(i=>{m(G(i))},[m,E]),_=x.useCallback(i=>{E?.(i),m(null)},[E,m]),k=r===n,F=P.COMPONENT_SIZE_LEVELS[g];return s.jsxRuntimeExports.jsxs(a.Button,{el:"div",size:g,id:n,variant:"text",sharp:!0,className:o.CSS(a.CONTEXT_TARGET,k&&a.CONTEXT_SELECTED,o.CSS.selected(k),o.CSS.altColor(t),b&&l!=null&&o.CSS.M("closable"),o.CSS.editable(v&&j!=null),p!=null&&o.CSS.M("drag-over"),p!=null&&o.CSS.loc(p)),draggable:!0,justify:"center",align:"center",empty:!0,tabIndex:0,preventClick:k,onClick:C,onDragOver:T,onDrop:_,onDragLeave:()=>m(null),onDragStart:f,onDragEnd:i=>{m(null),h(i)},bordered:!1,rounded:!1,children:[s.jsxRuntimeExports.jsx($,{loading:R,icon:B,level:F}),s.jsxRuntimeExports.jsx(Q,{name:c,tabKey:n,onRename:j,editable:v,level:P.COMPONENT_SIZE_LEVELS[g]}),b&&l!=null&&s.jsxRuntimeExports.jsx(a.Button,{"aria-label":"pluto-tabs__close",onClick:N,className:o.CSS.E("close"),variant:"text",sharp:!0,children:s.jsxRuntimeExports.jsx(X,{unsavedChanges:D})})]})},Q=({onRename:r,name:t,tabKey:e,editable:l=!0,level:n})=>r==null||!l?s.jsxRuntimeExports.jsx(a.Text,{overflow:"ellipsis",level:n,children:t}):s.jsxRuntimeExports.jsx(a.Editable,{level:n,id:o.CSS.B(`tab-${e}`),onChange:c=>r?.(e,c),value:t,overflow:"ellipsis"}),q=(r="",t=[])=>{if(t.length!==0)return t.find(e=>e.tabKey===r)!=null?r:t[t.length-1]?.tabKey},M=(r,t,e)=>{if(t=t.trim(),t.length===0)return e;const l=e.find(n=>n.tabKey===r);return l==null||l.name===t?e:e.map(n=>n.tabKey===r?{...n,name:t}:n)},I=({tabs:r,content:t,selected:e,onSelect:l})=>{const[n,c]=P.usePurePassthrough({initial:e??r[0]?.tabKey??"",value:e,onChange:l}),u=a.useSyncedRef(e??n),S=x.useCallback(j=>{c(j),u.current==null&&l?.(j)},[n,l]);return{tabs:r,selected:n,content:t,onSelect:S}},V=({id:r,content:t,children:e,onSelect:l,selected:n,selectedAltColor:c,closable:u,tabs:S,onClose:j,onDragStart:b,onDragEnd:B,onCreate:g,onRename:v,emptyContent:D,className:R,onDragOver:E,onDrop:f,contextMenu:h,addTooltip:N,size:C="medium",direction:p="y",x:m,y:T,..._})=>s.jsxRuntimeExports.jsx(a.Box,{id:r,empty:!0,className:o.CSS(o.CSS.B("tabs"),R),direction:p,x:m,y:T,onDragOver:E,onDrop:f,..._,children:s.jsxRuntimeExports.jsxs(z,{value:{tabs:S,emptyContent:D,selected:n,closable:u,content:e??t,onSelect:l,onClose:j,onDragStart:b,onDragEnd:B,onRename:v,onCreate:g,onDrop:f},children:[s.jsxRuntimeExports.jsx(L,{size:C,direction:o.g.swap(p),altColor:c,contextMenu:h,addTooltip:N}),s.jsxRuntimeExports.jsx(Z,{})]})}),Z=()=>{const{tabs:r,selected:t,content:e,emptyContent:l,onSelect:n}=y();let c=null;const u=r.find(S=>S.tabKey===t);return t==null||u==null?c=l??null:e!=null?typeof e=="function"?c=e(u):c=e:u.content!=null&&(c=u.content),s.jsxRuntimeExports.jsx("div",{className:o.CSS.B("tabs-content"),onClick:()=>t!=null&&n?.(t),children:c})},H=d.z.object({tabKey:d.z.string(),name:d.z.string(),closable:d.z.boolean().optional(),icon:d.z.unknown().optional(),editable:d.z.boolean().optional(),visible:d.z.boolean().optional(),unsavedChanges:d.z.boolean().optional(),loading:d.z.boolean().optional()}),A=H.extend({content:d.z.unknown().optional()}),U=Object.freeze(Object.defineProperty({__proto__:null,Content:Z,Provider:z,Selector:L,Tabs:V,rename:M,resetSelection:q,specZ:H,tabZ:A,useContext:y,useStatic:I},Symbol.toStringTag,{value:"Module"}));exports.Tabs=V;exports.external=U;exports.rename=M;exports.resetSelection=q;exports.tabZ=A;exports.useStatic=I;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { B as d, f, g as T, h as E, j as _ } from "./symbols-Lz5vQQDw.js";
|
|
2
|
-
import { j } from "./jsx-runtime-C5mzlN2N.js";
|
|
3
|
-
import { u as o, D as g, M as k } from "./Menu-C-MABQ1r.js";
|
|
4
|
-
import { C as e } from "./css-Dl9aM7Jz.js";
|
|
5
|
-
const v = ({
|
|
6
|
-
itemKey: t,
|
|
7
|
-
className: n,
|
|
8
|
-
onClick: s,
|
|
9
|
-
size: r,
|
|
10
|
-
...a
|
|
11
|
-
}) => {
|
|
12
|
-
const { onClick: c, selected: l, level: i = "p", gap: u, background: m } = o(), C = (x) => {
|
|
13
|
-
c(t), s?.(x);
|
|
14
|
-
}, p = l === t;
|
|
15
|
-
return /* @__PURE__ */ j.jsx(
|
|
16
|
-
d,
|
|
17
|
-
{
|
|
18
|
-
contrast: m,
|
|
19
|
-
level: i,
|
|
20
|
-
overflow: "nowrap",
|
|
21
|
-
onClick: C,
|
|
22
|
-
variant: "text",
|
|
23
|
-
className: e(e.B("menu-item"), e.selected(p), n),
|
|
24
|
-
size: r,
|
|
25
|
-
gap: u,
|
|
26
|
-
...a
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
}, B = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
30
|
-
__proto__: null,
|
|
31
|
-
CONTEXT_SELECTED: f,
|
|
32
|
-
CONTEXT_TARGET: T,
|
|
33
|
-
ContextMenu: E,
|
|
34
|
-
Divider: g,
|
|
35
|
-
Item: v,
|
|
36
|
-
Menu: k,
|
|
37
|
-
useContext: o,
|
|
38
|
-
useContextMenu: _
|
|
39
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
40
|
-
export {
|
|
41
|
-
B as e
|
|
42
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./symbols-B15FeAg9.cjs"),t=require("./Toggle-Ckdi4fKV.cjs"),o=Object.freeze(Object.defineProperty({__proto__:null,Button:e.Button,Toggle:t.Toggle},Symbol.toStringTag,{value:"Module"}));exports.external=o;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./symbols-B15FeAg9.cjs"),d=require("./jsx-runtime-CITbqOLs.cjs"),t=require("./Menu-vR5-lqo4.cjs"),n=require("./css-9yccD6t_.cjs"),_=({itemKey:o,className:s,onClick:r,size:u,...c})=>{const{onClick:l,selected:C,level:i="p",gap:x,background:T}=t.useContext(),a=S=>{l(o),r?.(S)},E=C===o;return d.jsxRuntimeExports.jsx(e.Button,{contrast:T,level:i,overflow:"nowrap",onClick:a,variant:"text",className:n.CSS(n.CSS.B("menu-item"),n.CSS.selected(E),s),size:u,gap:x,...c})},M=Object.freeze(Object.defineProperty({__proto__:null,CONTEXT_SELECTED:e.CONTEXT_SELECTED,CONTEXT_TARGET:e.CONTEXT_TARGET,ContextMenu:e.ContextMenu,Divider:t.Divider,Item:_,Menu:t.Menu,useContext:t.useContext,useContextMenu:e.useContextMenu},Symbol.toStringTag,{value:"Module"}));exports.external=M;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";const i=require("./css-9yccD6t_.cjs"),d=require("zod"),p=require("./eraser-CLWNvWDn.cjs"),Ke=require("./fontString-BptzSQcY.cjs");class ba{handlers;transform;closer;constructor(e,n){this.transform=e,this.handlers=n??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){let n=e;if(this.transform!=null){const[r,s]=this.transform(e);if(!s)return;n=r}this.handlers.forEach((r,s)=>s(n))}setCloser(e){this.closer=e}async close(){return await this.closer?.()}}class xa{handlers;constructor(e){this.handlers=e??new Map}onChange(e){return this.handlers.set(e,null),()=>this.handlers.delete(e)}notify(e){this.handlers.forEach((n,r)=>r(e))}}const qt=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:xa,Observer:ba},Symbol.toStringTag,{value:"Module"})),Bn="pluto-vis-renderer",Ft=(t,e)=>{t.set(Bn,e,!1)},Wt=t=>t.get(Bn),as=t=>t.getOptional(Bn),X=(t,e)=>Wt(t)(e),fn=(t,e)=>async n=>{let r;n.changed.dataType.equals(i.r.JSON)?r=n.changed.parseJSON(t):r=Array.from(n.changed).map(s=>t.parse(s));for(const s of r)await e({...n,changed:s})},Sa=t=>async e=>{for(const n of e.changed.toStrings())await t({...e,changed:n})},wa=new Error("request for lock canceled");var Ta=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(h){try{c(r.next(h))}catch(f){o(f)}}function u(h){try{c(r.throw(h))}catch(f){o(f)}}function c(h){h.done?a(h.value):s(h.value).then(l,u)}c((r=r.apply(t,e||[])).next())})};class Ea{constructor(e,n=wa){this._value=e,this._cancelError=n,this._queue=[],this._weightedWaiters=[]}acquire(e=1,n=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((r,s)=>{const a={resolve:r,reject:s,weight:e,priority:n},o=os(this._queue,l=>n<=l.priority);o===-1&&e<=this._value?this._dispatchItem(a):this._queue.splice(o+1,0,a)})}runExclusive(e){return Ta(this,arguments,void 0,function*(n,r=1,s=0){const[a,o]=yield this.acquire(r,s);try{return yield n(a)}finally{o()}})}waitForUnlock(e=1,n=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,n)?Promise.resolve():new Promise(r=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),Ca(this._weightedWaiters[e-1],{resolve:r,priority:n})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const n=this._value;this._value-=e.weight,e.resolve([n,this._newReleaser(e.weight)])}_newReleaser(e){let n=!1;return()=>{n||(n=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const n=this._weightedWaiters[e-1];n&&(n.forEach(r=>r.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let n=this._value;n>0;n--){const r=this._weightedWaiters[n-1];if(!r)continue;const s=r.findIndex(a=>a.priority<=e);(s===-1?r:r.splice(0,s)).forEach(a=>a.resolve())}}}_couldLockImmediately(e,n){return(this._queue.length===0||this._queue[0].priority<n)&&e<=this._value}}function Ca(t,e){const n=os(t,r=>e.priority<=r.priority);t.splice(n+1,0,e)}function os(t,e){for(let n=t.length-1;n>=0;n--)if(e(t[n]))return n;return-1}var Pa=function(t,e,n,r){function s(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function l(h){try{c(r.next(h))}catch(f){o(f)}}function u(h){try{c(r.throw(h))}catch(f){o(f)}}function c(h){h.done?a(h.value):s(h.value).then(l,u)}c((r=r.apply(t,e||[])).next())})};class ls{constructor(e){this._semaphore=new Ea(1,e)}acquire(){return Pa(this,arguments,void 0,function*(e=0){const[,n]=yield this._semaphore.acquire(1,e);return n})}runExclusive(e,n=0){return this._semaphore.runExclusive(()=>e(),1,n)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const ka=d.z.object({props:p.Kp.nullable(),state:p.Xp.connectivity.connectionStateZ.nullable()}),Un={client:null};let mt=class cs extends p.Composite{static TYPE="synnax.Provider";static stateZ=ka;schema=cs.stateZ;afterUpdate(e){if(e.wasSetPreviously($n)||rn(e,Un),this.state.props==null){this.internal.client!=null&&(this.internal.client?.close(),this.internal.client=null),rn(e,this.internal);return}this.prevState.props!=null&&p.m.equal(this.state.props,this.prevState.props)&&this.internal.client!=null||(this.internal.client=new p.Xp(this.state.props),rn(e,this.internal))}};const $n="pluto-client-context",rn=(t,e)=>t.set($n,e),Ze=t=>t.get($n)?.client??null,us={[mt.TYPE]:mt},Ra=Object.freeze(Object.defineProperty({__proto__:null,Provider:mt,REGISTRY:us,ZERO_CONTEXT_VALUE:Un,use:Ze},Symbol.toStringTag,{value:"Module"})),Ma=d.z.object({region:i.Ho.box,clearOverScan:i.K.crudeZ.optional().default(0),visible:d.z.boolean().optional().default(!0)}),Pr=["upper2d","lower2d"];class Te extends p.Composite{static TYPE="Table";static stateZ=Ma;schema=Te.stateZ;afterUpdate(e){const{internal:n}=this;n.renderCtx=p.Context.use(e),n.handleError=p.useErrorHandler(e),Ft(e,()=>{this.state.visible&&this.requestRender("low")}),!(!this.state.visible&&!this.prevState.visible)&&this.requestRender("high")}afterDelete(){this.requestRender("high")}render(){if(this.deleted)return;const e=i.Ho.copy(this.state.region);if(!this.state.visible)return()=>this.internal.renderCtx.erase(e,this.state.clearOverScan);const{renderCtx:n,handleError:r}=this.internal,s=i.C.XY.translate(i.Ho.topLeft(this.state.region)),a=n.scissor(this.state.region,i.K.construct(this.state.clearOverScan),Pr);try{for(const o of this.children)o.render({viewportScale:s})}catch(o){r(o,"Failed to render table")}finally{a()}return()=>this.internal.renderCtx.erase(e,this.state.clearOverScan)}requestRender(e){const{renderCtx:n}=this.internal;n.loop.set({key:`${Te.TYPE}-${this.key}`,render:this.render.bind(this),priority:e,canvases:Pr})}}const La={[Te.TYPE]:Te};class ne extends qt.Observer{cleanup(){}}class pn extends ne{static TYPE="noop-boolean-sink";set(){}}const jt={type:pn.TYPE,props:{},variant:"sink",valueType:"boolean"};class mn extends ne{static TYPE="noop-numeric-sink";set(){}}const hs={type:mn.TYPE,props:{},variant:"sink",valueType:"number"};class gn extends ne{static TYPE="noop-boolean-source";value(){return!1}}const Kn={type:gn.TYPE,props:{},variant:"source",valueType:"boolean"};class yn extends ne{static TYPE="noop-numeric-source";value(){return 0}}const ds={type:yn.TYPE,props:{},variant:"source",valueType:"number"};class vn extends ne{static TYPE="noop-string-source";value(){return""}}const fs={type:vn.TYPE,props:{},variant:"source",valueType:"string"};class bn extends ne{static TYPE="noop-status-source";value(){return{key:"noop",variant:"disabled",message:"unknown",time:i.n.now()}}}const qn={type:bn.TYPE,props:{},variant:"source",valueType:"status"};class xn extends ne{static TYPE="noop-color-source";value(){return i.ir.ZERO}}const Vt={type:xn.TYPE,props:{},variant:"source",valueType:"color"};class Sn extends ne{static TYPE="noop-series";value(){return[i.W.ZERO,new i.Vt([])]}}const ps={type:Sn.TYPE,props:{},variant:"source",valueType:"series"},Oa={[pn.TYPE]:pn,[mn.TYPE]:mn,[gn.TYPE]:gn,[yn.TYPE]:yn,[bn.TYPE]:bn,[xn.TYPE]:xn,[vn.TYPE]:vn,[Sn.TYPE]:Sn};class ms{type="noop";create(e){const n=Oa[e.type];return n==null?null:new n}}const Da=d.z.instanceof(ArrayBuffer),nt=d.z.object({type:d.z.string(),variant:d.z.enum(["source","sink","source-transformer","sink-transformer"]),valueType:d.z.string(),props:d.z.any(),transfer:d.z.array(Da).optional()}),re=nt.extend({variant:d.z.literal("source")}),Gt=nt.extend({variant:d.z.literal("sink")}),gs=nt.extend({variant:d.z.literal("source-transformer")}),ys=nt.extend({variant:d.z.literal("sink-transformer")}),gt=re.extend({valueType:d.z.literal("series")}),Fn=re.extend({valueType:d.z.literal("boolean")}),Xt=Gt.extend({valueType:d.z.literal("boolean")}),Ya=ys.extend({valueType:d.z.literal("boolean")}),_a=gs.extend({valueType:d.z.literal("boolean")}),vs=re.extend({valueType:d.z.literal("number")}),bs=Gt.extend({valueType:d.z.literal("number")}),Wn=re.extend({valueType:d.z.literal("color")}),jn=re.extend({valueType:d.z.literal("status")}),Vn=re.extend({valueType:d.z.literal("string")});let Qt=class extends qt.BaseObserver{props_=void 0;uProps_=void 0;constructor(e){super(),this.uProps_=e}get props(){if(this.props_==null){const e=this.schema.safeParse(this.uProps_);if(e.success)this.props_=e.data;else throw new p.P(`[BaseTelem] - expected props to be valid, but found the following errors:
|
|
2
|
-
${e.error.message}`)}return this.props_}cleanup(){}};class B extends Qt{}class Jt extends Qt{}class ue extends B{source_=void 0;get source(){if(this.source_==null)throw new p.P("[UnarySourceTransformer] - expected source to exist, but none was found.");return this.source_}value(){return this.transform(this.source.value())}onChange(e){return this.source.onChange(()=>{this.shouldNotify(this.source.value())&&e()})}setSources(e){this.source_=Object.values(e)[0]}shouldNotify(e){return!0}}class xs extends B{sources={};value(){const e=Object.fromEntries(Object.entries(this.sources).map(([n,r])=>[n,r.value()]));return this.transform(e)}setSources(e){this.sources={...this.sources,...e}}}class Ss extends Qt{sinks={};get sink(){const[e]=Object.values(this.sinks);if(e==null)throw new p.P("[UnarySinkTransformer] - expected sink to exist, but none was found.");return e}set(...e){return this.sink.set(...this.transform(...e))}setSinks(e){this.sinks={...this.sinks,...e}}}const Gn=d.z.object({from:d.z.string(),to:d.z.string()}),Xn=d.z.object({connections:d.z.array(Gn),outlet:d.z.string(),segments:d.z.record(d.z.string(),re)});class Qn{type="pipeline";factory;constructor(e){this.factory=e}create(e){switch(e.type){case yt.TYPE:return new yt(e.props,this.factory);case vt.TYPE:return new vt(e.props,this.factory);default:return null}}}class yt extends B{static TYPE="source-pipeline";schema=Xn;sources={};get outlet(){const{outlet:e}=this.props,n=this.sources[e];if(n==null)throw new p.P(`[SourcePipeline] - expected source to exist at outlet '${e}', but none was found.`);return n}constructor(e,n){super(e);const{connections:r,segments:s}=this.props;Object.entries(s).forEach(([a,o])=>{const l=n.create(o);l!=null&&(this.sources[a]=l)}),r.forEach(({from:a,to:o})=>{const l=this.sources[a],u=this.sources[o];l==null||u==null||"setSources"in u&&u.setSources({[a]:l})})}value(){return this.outlet.value()}onChange(e){return this.outlet.onChange(e)}cleanup(){Object.values(this.sources).forEach(e=>e.cleanup?.())}}const ws=(t,e)=>({variant:"source",props:e,type:yt.TYPE,valueType:t}),Jn=d.z.object({connections:d.z.array(Gn),inlet:d.z.string(),segments:d.z.record(d.z.string(),Gt)});class vt extends Jt{static TYPE="sink-pipeline";schema=Jn;sinks={};get inlet(){const{inlet:e}=this.props,n=this.sinks[e];if(n==null)throw new p.P(`[SinkPipeline] - expected source to exist at inlet '${e}', but none was found.`);return n}constructor(e,n){super(e);const{connections:r,segments:s}=this.props;Object.entries(s).forEach(([a,o])=>{const l=n.create(o);l!=null&&(this.sinks[a]=l)}),r.forEach(({from:a,to:o})=>{const l=this.sinks[a],u=this.sinks[o];l==null||u==null||"setSinks"in l&&l.setSinks({[o]:u})})}set(...e){return this.inlet.set(...e)}cleanup(){Object.values(this.sinks).forEach(e=>e.cleanup?.())}}const Ts=(t,e)=>({variant:"sink",props:e,type:vt.TYPE,valueType:t}),er=d.z.object({channel:d.z.number().or(d.z.string())});class bt extends B{static TYPE="stream-channel-value";schema=er;client;removeStreamHandler=null;leadingBuffer=null;valid=!1;onStatusChange;constructor(e,n,r){super(n),this.client=e,this.onStatusChange=r?.onStatusChange}get testingOnlyLeadingBuffer(){return this.leadingBuffer}get testingOnlyValid(){return this.valid}cleanup(){this.removeStreamHandler?.(),this.valid=!1,this.leadingBuffer?.release(),this.leadingBuffer=null,this.removeStreamHandler=null}value(){return i.F.isZero(this.props.channel)||(this.valid||this.read(),this.leadingBuffer==null||this.leadingBuffer.length===0)?0:this.leadingBuffer.at(-1,!0)}async read(){try{this.valid=!0,this.removeStreamHandler?.();const e=await this.client.retrieveChannel(this.props.channel),n=r=>{const s=r.get(e.key);if(s==null)return;const a=s.series.at(-1);a!=null&&(a.acquire(),this.leadingBuffer?.release(),this.leadingBuffer=a),this.notify()};this.removeStreamHandler=await this.client.stream(n,[e.key]),this.notify()}catch(e){this.valid=!1,this.onStatusChange?.(i._r.fromException(e,"failed to stream channel value"))}}}const Es=async(t,e,n)=>{const r=await t.retrieveChannel(e),s=p.xm.isCalculated(r);if(!n||r.isIndex)return{key:r.key,dataType:r.dataType,virtual:r.virtual,isCalculated:s};if(s){const a=await p.xm.resolveCalculatedIndex(t.retrieveChannel.bind(t),r);if(a==null)throw new p.Ft("Failed to resolve calculated index");return{key:(await t.retrieveChannel(a)).key,dataType:i.r.TIMESTAMP,virtual:!1,isCalculated:s}}if(r.virtual)throw new p.Ft("cannot use virtual channels as a data source");return{key:r.index,dataType:i.r.TIMESTAMP,virtual:!1,isCalculated:s}},za=d.z.object({timeRange:i.w.z,channel:d.z.number().or(d.z.string()),useIndexOfChannel:d.z.boolean().optional().default(!1)});class xt extends B{static TYPE="series-source";client;schema=za;data=new i.Vt;valid=!1;channel=null;onStatusChange;constructor(e,n,r){super(n),this.client=e,this.onStatusChange=r?.onStatusChange}cleanup(){this.data.release(),this.valid=!1,this.channel=null}value(){const{channel:e,timeRange:n}=this.props;if(n.isZero||e===0)return[i.W.ZERO,this.data];this.valid||this.read();const{channel:r,data:s}=this;if(r==null)return[i.W.ZERO,this.data];let a=s.bounds;return r.dataType.equals(i.r.TIMESTAMP)&&(a=i.W.min([a,n.numericBounds])),[a,s]}async read(){try{this.valid=!0;const{timeRange:e,channel:n,useIndexOfChannel:r}=this.props;this.channel=await Es(this.client,n,r);const s=await this.client.read(e,this.channel.key);s.acquire(),this.data=s,this.notify()}catch(e){this.valid=!1,this.onStatusChange?.(i._r.fromException(e,"failed to read channel data"))}}}const Aa=d.z.object({channel:d.z.number().or(d.z.string()),useIndexOfChannel:d.z.boolean().optional().default(!1),timeSpan:i.a.z,keepFor:i.a.z.optional()});class St extends B{static TYPE="dynamic-series-source";client;data=new i.Vt([]);now;onStatusChange;channel=null;stopStreaming;valid=!1;schema=Aa;constructor(e,n,r,s=()=>i.n.now()){super(n),this.client=e,this.now=s,this.onStatusChange=r?.onStatusChange}value(){const{channel:e,timeSpan:n}=this.props;if(e===0)return[i.W.ZERO,this.data];this.valid||this.read();const{data:r,channel:s}=this,a=this.now();if(s!=null&&s.dataType.isVariable)return[i.W.ZERO,this.data];const o=r.series.filter(u=>u.timeRange.end.after(a.sub(n))).map(u=>u.bounds),l=i.W.max(o);return s!=null&&s.dataType.equals(i.r.TIMESTAMP)&&(l.lower=Math.max(l.lower,l.upper-Number(n.valueOf()))),[l,this.data]}async read(){try{this.valid=!0;const{channel:e,useIndexOfChannel:n,timeSpan:r}=this.props;this.channel=await Es(this.client,e,n);const s=this.now().spanRange(-r);if(!this.channel.virtual||this.channel.isCalculated){const o=await this.client.read(s,this.channel.key);o.acquire(),this.data.push(o)}this.stopStreaming?.();const a=o=>{if(this.channel==null)return;const l=o.get(this.channel.key);l!=null&&(l.acquire(),this.data.push(l),this.notify(),this.gcOutOfRangeData())};this.stopStreaming=await this.client.stream(a,[this.channel.key]),this.notify()}catch(e){this.valid=!1,this.onStatusChange?.(i._r.fromException(e,"failed to stream channel data"))}}gcOutOfRangeData(){const e=this.now().sub(this.props.keepFor??this.props.timeSpan),n=this.data.series.findIndex(r=>r.timeRange.end.before(e));n!==-1&&(this.data.series.splice(n,1).forEach(r=>r.release()),this.gcOutOfRangeData())}cleanup(){this.stopStreaming?.(),this.stopStreaming=void 0,this.data.release(),this.valid=!1}}const Za={[xt.TYPE]:xt,[St.TYPE]:St,[bt.TYPE]:bt};class Cs{type="remote";client;constructor(e){this.client=e}create(e,n){const r=Za[e.type];return r==null?null:new r(this.client,e.props,n)}}const Ps=t=>({type:xt.TYPE,props:t,variant:"source",valueType:"series"}),ks=t=>({type:St.TYPE,props:t,variant:"source",valueType:"series"}),Rs=t=>({type:bt.TYPE,props:t,variant:"source",valueType:"number"});class Ms{type="static";create(e){switch(e.type){case wn.TYPE:return new wn(e.props);case wt.TYPE:return new wt(e.props);case Tt.TYPE:return new Tt(e.props);case Et.TYPE:return new Et(e.props);case Ct.TYPE:return new Ct(e.props);default:return null}}}const tr=d.z.object({data:d.z.array(i.Yt),offsets:d.z.array(d.z.number()).optional().default([])});class wn extends B{data;schema=tr;static TYPE="static-series";constructor(e){super(e),this.data=this.props.data.map((n,r)=>new i.I({data:n,dataType:i.r.FLOAT32,timeRange:i.w.ZERO,sampleOffset:this.props.offsets[r]??0}))}value(){return[i.W.max(this.data.map(n=>n.bounds)),this.data]}}const Ls=tr.extend({rate:i.E.z,yOffset:d.z.number().optional().default(0),scroll:d.z.number().optional().default(0),startPosition:d.z.number().optional().default(0),scrollBounds:d.z.boolean().optional().default(!1)});class wt extends B{static TYPE="iterative-series";schema=Ls;position;interval;data;constructor(e){super(e),this.position=this.props.startPosition,this.start(this.props.rate),this.data=this.props.data.map((n,r)=>new i.I({data:n,dataType:i.r.FLOAT32,timeRange:i.w.ZERO,sampleOffset:this.props.offsets[r]??0}))}value(){const e=this.data.map(r=>r.slice(0,this.position));if(this.props.scrollBounds){const r=e[0].data[this.position-this.props.scroll<0?0:this.position-this.props.scroll],s=e[0].data[this.position-1];return[{lower:Number(r),upper:Number(s)},new i.Vt(e)]}return[i.W.max(e.map(r=>r.bounds)),new i.Vt(e)]}start(e){this.interval!=null&&clearInterval(this.interval),this.interval=setInterval(()=>{this.notify?.(),this.position++},e.period.milliseconds)}cleanup(){clearInterval(this.interval),this.interval=void 0}}const Os=d.z.number();class Tt extends B{static TYPE="static-numeric";schema=Os;value(){return this.props}}const Ds=d.z.string();class Et extends B{static TYPE="static-string";schema=Ds;value(){return this.props}}const Ys=i.ir.crudeZ;class Ct extends B{static TYPE="static-color";schema=Ys;value(){return i.ir.construct(this.props)}}const Ia=t=>({type:wn.TYPE,props:t,variant:"source",valueType:"series"}),Ha=t=>({type:wt.TYPE,props:t,variant:"source",valueType:"series"}),Na=t=>({type:Tt.TYPE,props:t,variant:"source",valueType:"number"}),Ba=t=>({type:Et.TYPE,props:t,variant:"source",valueType:"string"}),Ua=t=>({type:Ct.TYPE,props:t,variant:"source",valueType:"color"});class _s{type="transformer";create(e){switch(e.type){case Ee.TYPE:return new Ee(e.props);case Ce.TYPE:return new Ce(e.props);case Pe.TYPE:return new Pe(e.props);case ke.TYPE:return new ke(e.props);case Re.TYPE:return new Re(e.props);case Pt.TYPE:return new Pt(e.props);case Me.TYPE:return new Me(e.props);case Le.TYPE:return new Le(e.props)}return null}}const $a=d.z.object({truthy:d.z.number().optional().default(1),falsy:d.z.number().optional().default(0)}),zs=t=>({props:t,type:Ee.TYPE,variant:"sink",valueType:"boolean"});class Ee extends Ss{static TYPE="boolean-numeric-converter-sink";static propsZ=$a;schema=Ee.propsZ;transform(...e){return e.map(n=>n?this.props.truthy:this.props.falsy)}}const nr=d.z.object({trueBound:i.W.bounds}),As=t=>({props:t,type:Ce.TYPE,variant:"source",valueType:"boolean"});class Ce extends ue{static TYPE="boolean-source";static propsZ=nr;schema=Ce.propsZ;curr=null;shouldNotify(e){const n=i.W.contains(this.props.trueBound,e)!==this.curr;return this.curr=i.W.contains(this.props.trueBound,e),n}transform(e){return this.curr=i.W.contains(this.props.trueBound,e),this.curr}}const Zs=d.z.object({});class Pe extends xs{static TYPE="mean";static propsZ=Zs;schema=Pe.propsZ;transform(e){return Object.values(e).reduce((n,r)=>n+r,0)/Object.keys(e).length}}const Ka=t=>({props:t,type:Pe.TYPE,variant:"source",valueType:"boolean"}),Is=d.z.object({trueVariant:i._r.variantZ.optional().default("success")});class ke extends ue{static TYPE="boolean-status";static propsZ=Is;schema=ke.propsZ;transform(e){return e.variant===this.props.trueVariant}}const qa=t=>({props:t,type:ke.TYPE,variant:"source",valueType:"boolean"}),rr=d.z.object({precision:d.z.number().optional().default(2),prefix:d.z.string().optional().default(""),suffix:d.z.string().optional().default(""),notation:i.mr.notationZ.optional().default("standard")});class Re extends ue{static TYPE="stringify-number";static propsZ=rr;schema=Re.propsZ;transform(e){const{precision:n,prefix:r,suffix:s,notation:a}=this.props;return`${r}${i.mr.stringifyNumber(e,n,a)}${s}`}}const Hs=t=>({props:t,type:Re.TYPE,variant:"source",valueType:"string"}),sr=d.z.object({windowSize:d.z.number().optional().default(5)});class Pt extends ue{static TYPE="rolling-average";static propsZ=Zs;schema=sr;values=[];transform(e){return this.props.windowSize<2?e:this.values.reduce((n,r)=>n+r,0)/this.values.length}shouldNotify(e){return this.props.windowSize<2?!0:(this.values.length>this.props.windowSize&&(this.values=[]),this.values.push(e),this.values.length===this.props.windowSize)}}const Ns=t=>({props:t,type:Pt.TYPE,variant:"source",valueType:"number"}),Bs=d.z.object({gradient:i.ir.gradientZ});class Me extends ue{static TYPE="color-gradient";static propsZ=Bs;schema=Me.propsZ;transform(e){return i.ir.fromGradient(this.props.gradient,e)}}const Us=t=>({props:t,type:Me.TYPE,variant:"source",valueType:"color"}),$s=d.z.object({scale:i.C.transform});class Le extends ue{static TYPE="scale-number";static propsZ=$s;schema=Le.propsZ;transform(e){const{offset:n,scale:r}=this.props.scale;return e*r+n}}const Ks=t=>({props:t,type:Le.TYPE,variant:"source",valueType:"number"}),ir=d.z.enum(["average","minmax","decimate"]),Fa=d.z.object({mode:ir,windowSize:d.z.number().optional().default(5)}),Wa=t=>({props:t,type:qe.TYPE,variant:"source",valueType:"number"}),qs=(t,e,n)=>{const r=e.length*n;for(let s=r;s<t.length;s+=n){const a=t.sub(s,s+1);a!==void 0&&e.write(a)}},ja=(t,e,n)=>{const r=e.length*n;for(let s=r;s<t.length&&!(s+n>t.length);s+=n){const a=Math.min(s+n,t.length);let o=0,l=0;for(let u=s;u<a;u++){const c=t.at(u);c!==void 0&&typeof c=="number"&&(o+=c,l++)}l>0&&e.write(new i.I({data:[o/l],dataType:t.dataType}))}},Va=(t,e,n)=>{const r=e.length/2*n;for(let s=r;s<t.length;s+=n){const a=Math.min(s+n,t.length);let o=1/0,l=-1/0,u=!1;for(let c=s;c<a;c++){const h=t.at(c);h!==void 0&&typeof h=="number"&&(o=Math.min(o,h),l=Math.max(l,h),u=!0)}u&&e.write(new i.I({data:[o,l],dataType:t.dataType}))}},Ga={decimate:qs,average:ja,minmax:Va};class qe{static TYPE="series-downsampler";_downsample=null;cache=new i.Vt;props;constructor(e){this.props=e}downsample(e){return this._downsample==null&&(e.series[0].sampleOffset!==0?this._downsample=qs:this._downsample=Ga[this.props.mode]),this._downsample}transform(e){if(this.props.mode==="decimate"||this.props.windowSize<=1)return e;if(e.series.length===0)return this.cache;for(;this.cache.series.length>0&&!this.cache.series[0].key.startsWith(e.series[0].key);)this.cache.series.shift();return e.series.forEach((n,r)=>{let s=this.cache.series.at(r);if(s==null){const a=this.props.mode==="minmax"?Math.ceil(n.capacity/this.props.windowSize)*2:Math.ceil(n.capacity/this.props.windowSize);s=i.I.alloc({key:n.key+i.$t.create(),dataType:n.dataType,capacity:a,alignment:n.alignment,sampleOffset:n.sampleOffset,timeRange:n.timeRange}),this.cache.push(s)}else if(!s.key.startsWith(n.key))throw new p.lt(`[SeriesDownsampler] - expected series with key ${n.key} to be in cache, but found ${s.key}`);this.downsample(e)(n,s,this.props.windowSize)}),this.cache}}const Xa=t=>({props:t,type:qe.TYPE,variant:"source",valueType:"series"});class ar{factories;type="compound";constructor(e){this.factories=e}add(e){this.factories=[...this.factories.filter(n=>n.type!==e.type),e]}create(e,n){for(const r of this.factories){const s=r.create(e,n);if(s!=null)return s}return null}}const Fs=t=>{const e=[new _s,new Ms,new ms],n=new ar(e);return t!=null&&n.add(new Cs(t)),n.add(new Qn(n)),n};let Ws=class js{factory;key;parent;constructor(e,n){this.factory=e,this.key=i.$t.create(),this.parent=n}child(e,n){const r=new ar([...this.factory.factories,...p.t.toArray(e)]);return r.add(new Qn(r)),new js(r,n)}create(e,n){const r=this.factory.create(e,n);if(r==null)throw new p.lt(`Telemetry service could not find a source for type ${e.type}`);return r}};const rt="pluto-telem-context",en=t=>t.get(rt),Vs=(t,e)=>t.set(rt,e),Gs=(t,e,n)=>{const r=en(t);if(r!=null&&n!=null&&r.key===n?.parent?.key)return n;const s=r.child(e,r);return t.set(rt,s),s};class Xs{spec;wrapped;prevProv;constructor(e,n,r){this.wrapped=e,this.spec=r,this.prevProv=n}shouldUpdate(e,n){return this.prevProv.key!==e.key||!p.m.equal(this.spec,n)}}class kr extends Xs{value(){return this.wrapped.value()}cleanup(){this.wrapped.cleanup?.()}onChange(e){return this.wrapped.onChange(e)}}class Rr extends Xs{set(...e){this.wrapped.set(...e)}cleanup(){this.wrapped.cleanup?.()}}const K=(t,e,n,r)=>{const s=en(t);if(n instanceof kr){if(!n.shouldUpdate(s,e))return n;n.cleanup?.()}return new kr(s.create(e,r),s,e)},st=(t,e,n,r)=>{const s=en(t);if(n instanceof Rr){if(!n.shouldUpdate(s,e))return n;n.cleanup?.()}return new Rr(s.create(e,r),s,e)},Qs=(t,e)=>t.dataType.isVariable||t.dataType.equals(i.r.UINT8)?t:(e==null&&t.dataType.equals(i.r.TIMESTAMP)&&(e=BigInt(t.data[0])),t.convert(i.r.FLOAT32,e)),Qa=t=>t.isVariable||t.equals(i.r.UINT8)?t:i.r.FLOAT32,Js=()=>({purgedSeries:0,purgedBytes:i.h.bytes(0)}),ei={instrumentation:p.g.NOOP,staleEntryThreshold:i.a.seconds(20)};class Ja{data=[];props;constructor(e){this.props={...ei,...e}}write(e){e.length!==0&&(e.series.forEach(n=>this.writeOne(Qs(n))),this.checkIntegrity(e))}dirtyRead(e){const n=this.data.filter(({data:o})=>o.timeRange.overlapsWith(e)).map(({data:o})=>o);if(n.length===0)return{series:new i.Vt([]),gaps:[e]};const r=n.map((o,l)=>l===0?i.w.ZERO:new i.w(n[l-1].timeRange.end,o.timeRange.start)).filter(o=>!o.isZero&&o.isValid),s=new i.w(e.start,n[0].timeRange.start),a=new i.w(n[n.length-1].timeRange.end,e.end);return s.isValid&&!s.isZero&&r.unshift(s),a.isValid&&!a.isZero&&r.push(a),{series:new i.Vt(n),gaps:r}}gc(){const{staleEntryThreshold:e}=this.props,n=Js(),r=this.data.filter(s=>{const a=s.data.refCount>0||i.n.since(s.addedAt).lessThan(e);return a||(n.purgedBytes=n.purgedBytes.add(s.data.byteCapacity)),a});return n.purgedSeries=this.data.length-r.length,this.data=r,n}close(){this.data=[]}writeOne(e){const{instrumentation:{L:n}}=this.props;if(e.length===0)return;const r=i.W.buildInsertionPlan(this.data.map(u=>u.data.alignmentBounds),e.alignmentBounds);if(r===null)return n.debug("Found no viable insertion plan",{inserting:e.digest,cacheContents:this.data.map(u=>u.data.digest)});const{removeBefore:s,removeAfter:a,insertInto:o,deleteInBetween:l}=r;e=e.slice(s,e.data.length-a),e.length!==0&&this.data.splice(o,l,{data:e,addedAt:i.n.now()})}checkIntegrity(e){const{instrumentation:{L:n}}=this.props,r=this.data.map(a=>a.data.alignmentBounds);if(r.some((a,o)=>r.some((l,u)=>o===u?!1:i.W.overlapsWith(a,l))))throw n.debug("Cache is in an invalid state - bounds overlap!",()=>({write:e.series.map(a=>a.digest),cacheContents:this.data.map(a=>a.data.digest)})),new Error("Invalid state")}}const eo=100,to=1e6,no=1e4,ro=100,so=40;class io{props;counter=0;curr;avgRate=0;timeOfLastWrite;totalWrites=0;now=()=>i.n.now();constructor(e){this.props=e,this.curr=null,e.now!=null&&(this.now=e.now),this.timeOfLastWrite=this.now()}get length(){return this.curr?.length??0}get leadingBuffer(){return this.curr}write(e){const n=e.series.flatMap(r=>this._write(r));return{flushed:new i.Vt(n.flatMap(r=>r.flushed.series)),allocated:new i.Vt(n.flatMap(r=>r.allocated.series))}}allocate(e,n,r){this.counter++;const s=this.props.dataType.isVariable,a=this.props.dataType.equals(i.r.TIMESTAMP);return i.I.alloc({capacity:s?e*so:e,dataType:Qa(this.props.dataType),timeRange:r.range(i.n.MAX),sampleOffset:a?r.valueOf():0,glBufferUsage:"dynamic",alignment:n,key:`dynamic-${this.counter}`})}_write(e){const n=this.nextBufferSize(),r={flushed:new i.Vt([]),allocated:new i.Vt([])};if(this.curr==null)this.curr=this.allocate(n,e.alignment,this.now()),r.allocated.push(this.curr);else if(Math.abs(Number(this.curr.alignment+BigInt(this.curr.length)-e.alignment))>1){const u=this.now();this.curr.timeRange.end=u,r.flushed.push(this.curr),this.curr=this.allocate(n,e.alignment,u),r.allocated.push(this.curr)}const s=Qs(e,this.curr.sampleOffset),a=this.curr.write(s);if(a===e.length)return this.updateAvgRate(e),r;const o=this.now();this.curr.timeRange.end=o,r.flushed.push(this.curr),this.curr=this.allocate(n,e.alignment+BigInt(a),o),r.allocated.push(this.curr);const l=this._write(e.slice(a));return r.flushed.push(l.flushed),r.allocated.push(l.allocated),r}updateAvgRate(e){if(typeof this.props.dynamicBufferSize=="number")return;const n=e.length/this.now().span(this.timeOfLastWrite).seconds;this.totalWrites>0&&isFinite(n)&&n>0&&(this.avgRate=(this.avgRate*(this.totalWrites-1)+n)/this.totalWrites),this.totalWrites++,this.timeOfLastWrite=this.now()}nextBufferSize(){const{dynamicBufferSize:e}=this.props;if(typeof e=="number")return e;if(this.totalWrites<ro)return no;const n=i.nr.roundToNearestMagnitude(this.avgRate*e.seconds);return Math.round(Math.max(Math.min(n,to),eo))}close(){this.curr=null}}class ao{channel;closed=!1;ins;static;dynamic;constructor(e){this.channel=e.channel,this.ins=e.instrumentation??p.g.NOOP,this.static=new Ja(e),this.dynamic=new io({dynamicBufferSize:e.dynamicBufferSize,dataType:this.channel.dataType})}writeDynamic(e){if(this.closed)return this.ins.L.warn(`Ignoring attempted dynamic write to a closed cache for channel ${this.channel.name}`),new i.Vt([]);const{flushed:n,allocated:r}=this.dynamic.write(e);return n.length>0&&this.static.write(n),r}get leadingBuffer(){return this.dynamic.leadingBuffer}writeStatic(e){if(this.closed)return this.ins.L.warn(`Ignoring attempted static write to a closed cache for channel ${this.channel.name}`);this.static.write(e)}read(e){return this.closed?(this.ins.L.warn(`Ignoring attempted dirty read from a closed cache for channel ${this.channel.name}`),{series:new i.Vt([]),gaps:[e]}):this.static.dirtyRead(e)}gc(){return this.closed?(this.ins.L.warn(`Ignoring attempted garbage collection on a closed cache for channel ${this.channel.name}`),{purgedSeries:0,purgedBytes:i.h.bytes(0)}):this.static.gc()}close(){this.closed=!0,this.dynamic.close(),this.static.close()}}const oo=p.O$1.seconds(60);class lo{props;cache=new Map;gcInterval;constructor(e){this.props={dynamicBufferSize:oo,gcInterval:p.O$1.seconds(30),...ei,...e},this.gcInterval=setInterval(()=>this.gc(),this.props.gcInterval.milliseconds)}async populateMissing(e){const{instrumentation:n,channelRetriever:r,dynamicBufferSize:s}=this.props,a=[];for(const l of e)this.cache.has(l)||a.push(l);if(a.length===0)return;(await r.retrieve(a)).forEach(l=>{if(this.cache.has(l.key))return;const u=new ao({channel:l,dynamicBufferSize:s,instrumentation:n.child(`cache-${l.name}-${l.key}`)});this.cache.set(l.key,u)})}get(e){const n=this.cache.get(e);if(n!=null)return n;throw new p.lt(`cache entry for ${e} not found`)}gc(){const{instrumentation:{L:e}}=this.props;e.info("starting garbage collection");const n=Js();this.cache.forEach(r=>{const s=r.gc();n.purgedSeries+=s.purgedSeries,n.purgedBytes=n.purgedBytes.add(s.purgedBytes)}),e.info("garbage collection complete",{purgedSeries:n.purgedSeries,purgedBytes:n.purgedBytes.toString()},!0)}close(){clearInterval(this.gcInterval),this.cache.forEach(e=>e.close()),this.cache.clear()}}class co{args;debouncedRead;mu=i.wr.newMutex({requests:new Set,closed:!1});constructor(e){this.args={...e,instrumentation:e.instrumentation??p.g.NOOP,batchDebounce:e.batchDebounce??i.a.milliseconds(50),overlapThreshold:e.overlapThreshold??i.a.milliseconds(5)};const n=this.args.batchDebounce.milliseconds;this.debouncedRead=p.o(()=>void this.batchRead(),n)}async read(e,n){const{cache:r}=this.args;await r.populateMissing([n]);const s=r.get(n),{series:a,gaps:o}=s.read(e);if(o.length===0)return a;const{mu:l}=this;return await new Promise((u,c)=>{l.runExclusive(async()=>{l.closed||l.requests.add({channel:n,gaps:o,resolve:u,reject:c})}),this.debouncedRead()}),s.read(e).series}async batchRead(){const{readRemote:e,cache:n,overlapThreshold:r}=this.args,{mu:s}=this;await s.runExclusive(async()=>{const a=o=>s.requests.forEach(({resolve:l,reject:u})=>o==null?l():u(o));try{if(s.closed)return a();const o=[];s.requests.forEach(({channel:l,gaps:u})=>u.forEach(c=>{const h=o.find(f=>f.gap.equals(c,r));h==null?o.push({gap:c,channels:new Set([l])}):(h.channels.add(l),h.gap=i.w.max(h.gap,c))})),await Promise.all(o.map(async({gap:l,channels:u})=>{const c=await e(l,Array.from(u));u.forEach(h=>n.get(h).writeStatic(c.get(h)))})),a()}catch(o){a(o)}finally{s.requests.clear()}})}async close(){await this.mu.runExclusive(async()=>{this.mu.closed=!0})}}let uo=class{props;mu=new ls;listeners=new Map;streamerRunLoop=null;streamer=null;closed=!1;constructor(e){this.props={instrumentation:p.g.NOOP,...e,streamUpdateDelay:new i.a(e.streamUpdateDelay??i.a.seconds(5))}}async stream(e,n){const{cache:r,instrumentation:s}=this.props;return this.closed?()=>{}:(await r.populateMissing(n),await this.mu.runExclusive(async()=>{s.L.debug("adding stream handler",{keys:n}),this.listeners.set(e,{valid:!0,keys:new Set(n)});const a=new Map(n.map(o=>{const l=r.get(o);return[o,new i.Vt(p.t.toArray(l.leadingBuffer))]}));return e(a),await this.updateStreamer(),()=>this.removeStreamHandler(e)}))}removeStreamHandler(e){const{instrumentation:n}=this.props;this.mu.runExclusive(()=>{const r=this.listeners.get(e);r!=null&&(r.valid=!1)}),setTimeout(()=>{this.mu.runExclusive(async()=>{if(n.L.debug("removing stream handler"),this.listeners.delete(e))return await this.updateStreamer();n.L.warn("attempted to remove non-existent stream handler")})},this.props.streamUpdateDelay.milliseconds)}async updateStreamer(){if(this.closed)return;const{instrumentation:e}=this.props;try{const n=new Set;if(this.listeners.forEach(a=>a.keys.forEach(o=>n.add(o))),n.size===0){e.L.info("no keys to stream, closing streamer"),this.streamer?.close(),this.streamerRunLoop!=null&&await this.streamerRunLoop,this.streamer=null,e.L.info("streamer closed successfully");return}const r=Array.from(n);if(i.O.primitiveArrays(r,this.streamer?.keys??[])===i.O.EQUAL){e.L.debug("streamer keys unchanged",{keys:r});return}this.streamer==null&&(e.L.info("creating new streamer",{keys:r}),this.streamer=await this.props.openStreamer(r),this.streamerRunLoop=this.runStreamer(this.streamer)),e.L.debug("updating streamer",{prev:this.streamer.keys,next:r}),await this.streamer.update(r)}catch(n){throw e.L.error("failed to update streamer",{error:n}),n}}async runStreamer(e){const{cache:n,instrumentation:r}=this.props;try{for await(const s of e){const a=new Map;for(const o of s.keys){const l=s.get(o),c=n.get(o).writeDynamic(l);a.set(o,c)}a.size!==0&&this.listeners.forEach(({valid:o},l)=>o&&l(a))}}catch(s){throw r.L.error("streamer run loop failed",{error:s},!0),s}}async close(){const{instrumentation:e}=this.props;try{this.streamer?.close(),this.streamerRunLoop!=null&&await this.streamerRunLoop}catch(n){e.L.error("failed to close streamer",{error:n})}this.closed=!0}};class ho{async retrieveChannel(){throw new p.Ft("NoopClient does not support retrieving channels")}async read(){return new i.Vt([])}async stream(){return async()=>{}}async close(){}}class fo{ins;cache;reader;streamer;channelRetriever;constructor({instrumentation:e,core:n}){this.ins=e,this.channelRetriever=n.channels.createDebouncedBatchRetriever(10),this.cache=new lo({channelRetriever:this.channelRetriever,instrumentation:this.ins.child("cache")}),this.reader=new co({cache:this.cache,readRemote:n.read.bind(n),instrumentation:this.ins.child("reader")}),this.streamer=new uo({cache:this.cache,openStreamer:async r=>p.Zm.HardenedStreamer.open(n.openStreamer.bind(n),r),instrumentation:this.ins.child("streamer")})}async retrieveChannel(e){const n=await this.channelRetriever.retrieve([e]);if(n.length===0)throw new p.ke(`channel ${e} not found`);return n[0]}async read(e,n){return await this.reader.read(e,n)}async stream(e,n){return await this.streamer.stream(e,n)}async close(){this.ins.L.info("closing client"),await this.streamer.close(),await this.reader.close(),this.cache.close()}}const or=d.z.object({});class Oe extends p.Composite{static TYPE="telem.Provider";static stateZ=or;schema=Oe.stateZ;prevCore=null;client=null;afterUpdate(e){const{internal:n}=this,r=Ze(e),s=p.useErrorHandler(e);if(n.instrumentation=p.useInstrumentation(e,"telem").child("provider"),!(r!==this.prevCore||!e.wasSetPreviously(rt)))return;this.prevCore=r,this.client!=null&&s(async()=>{if(this.client==null)throw new Error("no client to close");await this.client.close()},"failed to close client"),this.client=r==null?new ho:new fo({core:r,instrumentation:n.instrumentation});const o=Fs(this.client),l=new Ws(o);Vs(e,l)}}const ti={[Oe.TYPE]:Oe},po=Object.freeze(Object.defineProperty({__proto__:null,AbstractSink:Jt,AbstractSource:B,Base:Qt,BaseProvider:Oe,BooleanStatus:ke,CONTEXT_KEY:rt,ChannelData:xt,ColorGradient:Me,CompoundTelemFactory:ar,Context:Ws,FixedColorSource:Ct,FixedNumber:Tt,FixedString:Et,IterativeSeries:wt,Mean:Pe,MultiSourceTransformer:xs,NoopFactory:ms,PipelineFactory:Qn,REGISTRY:ti,RemoteFactory:Cs,RollingAverage:Pt,ScaleNumber:Le,SeriesDownsampler:qe,SetPoint:Ee,SinkPipeline:vt,SourcePipeline:yt,StaticFactory:Ms,StreamChannelData:St,StreamChannelValue:bt,StringifyNumber:Re,TransformerFactory:_s,UnarySinkTransformer:Ss,UnarySourceTransformer:ue,WithinBounds:Ce,booleanSinkSpecZ:Xt,booleanSinkTransformerSpecZ:Ya,booleanSourceSpecZ:Fn,booleanSourceTransformerSpecZ:_a,booleanStatus:qa,booleanStatusProps:Is,channelData:Ps,colorGradient:Us,colorGradientProps:Bs,colorSourceSpecZ:Wn,connectionZ:Gn,createFactory:Fs,downsampleMode:Wa,downsampleModeProps:Fa,downsampleModeZ:ir,fixedArray:Ia,fixedColor:Ua,fixedColorSourcePropsZ:Ys,fixedNumber:Na,fixedNumberPropsZ:Os,fixedSeriesPropsZ:tr,fixedString:Ba,fixedStringPropsZ:Ds,iterativeArray:Ha,iterativeSeriesPropsZ:Ls,mean:Ka,noopBooleanSinkSpec:jt,noopBooleanSourceSpec:Kn,noopColorSourceSpec:Vt,noopNumericSinkSpec:hs,noopNumericSourceSpec:ds,noopSeriesSourceSpec:ps,noopStatusSourceSpec:qn,noopStringSourceSpec:fs,numberSinkSpecZ:bs,numberSourceSpecZ:vs,providerStateZ:or,rollingAverage:Ns,rollingAverageProps:sr,scaleNumber:Ks,scaleNumberProps:$s,seriesDownsampler:Xa,seriesSourceSpecZ:gt,setContext:Vs,setpoint:zs,sinkPipeline:Ts,sinkPipelinePropsZ:Jn,sinkSpecZ:Gt,sinkTransformerSpecZ:ys,sourcePipeline:ws,sourcePipelinePropsZ:Xn,sourceSpecZ:re,sourceTransformerSpecZ:gs,specZ:nt,statusSourceSpecZ:jn,streamChannelData:ks,streamChannelValue:Rs,streamChannelValuePropsZ:er,stringSourceSpecZ:Vn,stringifyNumber:Hs,stringifyNumberProps:rr,useChildContext:Gs,useContext:en,useSink:st,useSource:K,withinBounds:As,withinBoundsProps:nr},Symbol.toStringTag,{value:"Module"})),ni=d.z.object({authority:i.ar.authorityZ.optional(),valid:d.z.boolean().optional()}).default({authority:void 0,valid:!1}),ri=d.z.object({triggered:d.z.boolean(),status:i._r.statusZ(ni),sink:Xt.optional().default(jt),source:jn.optional().default(qn)});class Tn extends p.Leaf{static TYPE="Chip";schema=ri;afterUpdate(e){const{internal:n}=this,{sink:r,source:s}=this.state;n.source=K(e,s,n.source),n.sink=st(e,r,n.sink),this.state.triggered&&!this.prevState.triggered&&n.sink.set(this.state.status.details?.authority!==i.ar.ABSOLUTE_AUTHORITY),this.updateEnabledState(),n.stopListening?.(),n.stopListening=n.source.onChange(()=>this.updateEnabledState())}updateEnabledState(){const e=this.internal.source.value();p.m.equal(e,this.state.status)||this.setState(n=>({...n,status:e,triggered:!1}))}afterDelete(){this.internal.stopListening(),this.internal.source.cleanup?.(),this.internal.sink.cleanup?.()}render(){}}const si=d.z.object({}),Mr="control-state-provider",ii=p.Lm.stateZ.extend({subjectColor:i.ir.colorZ});class Fe extends p.Composite{static TYPE="StateProvider";schema=si;colors=new Map;tracker;disconnectTrackerChange;obs=new qt.Observer;static use(e){return e.get(Mr)}afterUpdate(e){const{internal:n}=this;n.instrumentation=p.useInstrumentation(e,"control-state");const r=p.use(e);n.palette=r.colors.visualization.palettes.default,n.defaultColor=r.colors.gray.l8;const s=Ze(e);if(n.client!=null&&s===n.client)return;n.client=s,e.set(Mr,this),p.useErrorHandler(e)(async()=>{await this.maybeCloseTracker(),n.client!=null&&(this.internal.instrumentation.L.debug("starting state tracker"),await this.openTracker(n.client))},"failed to open control state tracker")}async maybeCloseTracker(){this.tracker!=null&&(this.internal.instrumentation.L.debug("stopping state tracker"),this.disconnectTrackerChange?.(),await this.tracker.close(),this.tracker=void 0)}afterDelete(e){p.useErrorHandler(e)(async()=>{await this.maybeCloseTracker()},"failed to close control state tracker")}onChange(e){return this.obs.onChange(e)}get(e){return Array.isArray(e)?i.c.unique(e).map(n=>this.getOne(n)).filter(n=>n!=null):this.getOne(e)}getOne(e){if(this.tracker==null)return;const n=this.tracker.states.get(e);if(n!=null)return{...n,subjectColor:this.colors.get(n.subject.key)??this.internal.defaultColor}}async openTracker(e){const{internal:n}=this,{instrumentation:r}=n;try{this.tracker=await e.control.openStateTracker()}catch{r.L.error("failed to open state tracker");return}this.disconnectTrackerChange?.(),this.disconnectTrackerChange=this.tracker.onChange(s=>{if(r.L.debug("transfer",{transfers:s.map(a=>p.Lm.transferString(a))}),this.tracker==null)throw new p.lt("tracker is null inside it's own onChange callback!");this.updateColors(this.tracker),this.obs.notify(s)})}updateColors(e){const n=e.subjects(),r=n.map(o=>o.key),s=Array.from(this.colors.values());this.colors.forEach((o,l)=>!r.includes(l)&&this.colors.delete(l));const{palette:a}=this.internal;n.forEach(o=>{if(this.colors.has(o.key))return;const l=a.find(u=>!s.includes(u))??a[0];this.colors.set(o.key,l),s.push(l)})}}const ai=["acquired","released","overridden","failed"],oi=d.z.enum(ai),li=d.z.object({name:d.z.string(),authority:d.z.number().default(0),acquireTrigger:d.z.number(),status:oi.optional(),needsControlOf:p.xm.keyZ.array().optional().default([])});class En extends p.Composite{static TYPE="Controller";schema=li;registry=new Map;writer;afterUpdate(e){const{internal:n}=this;n.instrumentation=p.useInstrumentation(e),n.addStatus=p.useAdder(e),n.runAsync=p.useErrorHandler(e),(n.prevTrigger==null||Math.abs(this.state.acquireTrigger-n.prevTrigger)>1)&&(n.prevTrigger=this.state.acquireTrigger);const r=Ze(e),s=Fe.use(e);n.stateProv=s,n.telemCtx=Gs(e,this,n.telemCtx),n.client=r,n.runAsync(async()=>{n.client==null&&await this.release(),this.state.acquireTrigger>n.prevTrigger?await this.acquire():this.state.acquireTrigger<n.prevTrigger&&await this.release()},"failed to acquire control")}afterDelete(){const{internal:e}=this;e.runAsync(async()=>await this.release(),"failed to release control")}async updateNeedsControlOf(){const{client:e}=this.internal;if(e==null)return;const n=new Set([]);for(const s of this.registry.keys())(await s.needsControlOf(e)).forEach(o=>o!==0&&n.add(o));const r=Array.from(n);i.O.unorderedPrimitiveArrays(this.state.needsControlOf,r)!==i.O.EQUAL&&this.setState(s=>({...s,needsControlOf:r}))}async acquire(){this.internal.prevTrigger=this.state.acquireTrigger;const{client:e,addStatus:n}=this.internal;if(e==null)return n({message:`Cannot acquire control on ${this.state.name} because no cluster has been connected.`,variant:"warning"});try{await this.updateNeedsControlOf();const r=this.state.needsControlOf;if(r.length===0)return n({message:`Cannot acquire control on ${this.state.name} because there are no channels to control.`,variant:"warning"});const s=p.S.now().sub(i.a.milliseconds(1));this.writer=await e.openWriter({start:s,channels:r,controlSubject:{key:this.key,name:this.state.name},authorities:this.state.authority,enableAutoCommit:!0}),this.setState(a=>({...a,status:"acquired"}))}catch(r){if(this.setState(s=>({...s,status:"failed"})),!(r instanceof Error))throw r;n({variant:"error",message:`${this.state.name} failed to acquire control`,description:r.message})}}async release(){this.internal.prevTrigger=this.state.acquireTrigger;try{await this.writer?.close()}catch(e){this.internal.addStatus({message:`${this.state.name} failed to release control: ${e.message}`,variant:"error"})}finally{this.setState(e=>({...e,status:"released"})),this.writer=void 0}}async set(e){this.writer==null&&await this.acquire(),await this.writer?.write(e)}async setAuthority(e,n){this.writer==null&&await this.acquire(),await this.writer?.setAuthority(Object.fromEntries(e.map(r=>[r,n])))}async releaseAuthority(e){this.writer==null&&await this.acquire(),await this.writer?.setAuthority(Object.fromEntries(e.map(n=>[n,this.state.authority])))}deleteTelem(e){this.registry.delete(e),this.updateNeedsControlOf()}create(e){const{internal:n}=this,s=(()=>{switch(e.type){case kt.TYPE:{const a=new kt(this,n.runAsync,e.props);return this.registry.set(a,null),a}case Mt.TYPE:{const a=new Mt(this,this.internal.stateProv,e.props);return this.registry.set(a,null),a}case Rt.TYPE:return new Rt(this,n.runAsync,e.props);default:return null}})();return s!=null&&this.updateNeedsControlOf(),s}}const ci=d.z.object({channel:d.z.number()});class kt extends Jt{static TYPE="controlled-numeric-telem-sink";controller;runAsync;schema=ci;constructor(e,n,r){super(r),this.controller=e,this.runAsync=n}invalidate(){}cleanup(){this.controller.deleteTelem(this)}async needsControlOf(e){if(this.props.channel===0)return[];const n=await e.channels.retrieve(this.props.channel),r=[n.key];return n.index!==0&&r.push(n.index),r}set(...e){this.runAsync(async()=>{const{client:n}=this.controller.internal;if(n==null)throw new p.wm("No cluster connected");if(this.props.channel===0)throw new p.P("No command channel specified for actuator");const r=await n.channels.retrieve(this.props.channel),s={[r.key]:e};if(r.index!==0){const a=await n.channels.retrieve(r.index),o=p.S.now();s[a.key]=Array.from({length:e.length},(l,u)=>o.add(i.a.nanoseconds(u)))}await this.controller.set(s)},"Failed to command channel")}}const mo=t=>({type:kt.TYPE,props:t,variant:"sink",valueType:"number"}),ui=d.z.object({authority:d.z.number().default(p.Lm.ABSOLUTE_AUTHORITY),channel:d.z.number()});class Rt extends Jt{static TYPE="acquire-channel-control";controller;runAsync;schema=ui;constructor(e,n,r){super(r),this.controller=e,this.runAsync=n}cleanup(){this.controller.deleteTelem(this)}async needsControlOf(e){const n=await e.channels.retrieve(this.props.channel),r=[n.key];return n.index!==0&&r.push(n.index),r}set(e){this.runAsync(async()=>{const{controller:n}=this,{client:r}=n.internal;if(r==null)return;const s=await r.channels.retrieve(this.props.channel),a=[s.key];s.index!==0&&a.push(s.index),e?await this.controller.setAuthority(a,this.props.authority):await this.controller.releaseAuthority(a)},"failed to set channel authority")}}const go=t=>({type:Rt.TYPE,props:t,variant:"sink",valueType:"boolean"}),hi=d.z.object({channel:d.z.number()}),yo=d.z.object({valid:d.z.boolean(),color:i.ir.colorZ.optional(),authority:d.z.number()});class Mt extends B{static TYPE="controlled-status-source";prov;valid=!1;stopListening;controller;schema=hi;constructor(e,n,r){super(r),this.prov=n,this.controller=e}async needsControlOf(){return[]}maybeRevalidate(){if(this.valid)return;const{channel:e}=this.props;this.stopListening?.();const n=i.ar.filterTransfersByChannelKey(e);this.stopListening=this.prov.onChange(r=>{n(r).length!==0&&this.notify?.()}),this.valid=!0}value(){this.maybeRevalidate();const e=p.S.now();if(this.props.channel===0)return{key:this.controller.key,variant:"disabled",message:"No Channel",time:e,details:{valid:!1,authority:0}};const n=this.prov.get(this.props.channel);return n==null?{key:this.controller.key,variant:"disabled",message:"Uncontrolled",time:e,details:{valid:!0,color:void 0,authority:0}}:{key:n.subject.key,variant:n.subject.key===this.controller.key?"success":"error",message:`Controlled by ${n.subject.name}`,time:e,details:{valid:!0,color:n.subjectColor,authority:n.authority}}}cleanup(){this.controller.deleteTelem(this),this.stopListening?.()}}const vo=t=>({type:Mt.TYPE,props:t,variant:"source",valueType:"status"}),di=d.z.object({color:i.ir.colorZ.optional()}).default({color:void 0}),fi=d.z.object({statusSource:jn.optional().default(qn),colorSource:Wn.optional().default(Vt),status:i._r.statusZ(di),color:i.ir.colorZ.optional()});class Cn extends p.Leaf{static TYPE="Indicator";schema=fi;stopListeningStatus;stopListeningColor;afterUpdate(e){const{internal:n}=this,{statusSource:r,colorSource:s}=this.state;n.statusSource=K(e,r,n.statusSource),n.colorSource=K(e,s,n.colorSource),this.updateState(),this.stopListeningStatus?.(),this.stopListeningColor?.(),this.stopListeningStatus=n.statusSource.onChange(this.updateState.bind(this)),this.stopListeningColor=n.colorSource.onChange(this.updateState.bind(this))}afterDelete(){this.internal.statusSource.cleanup?.(),this.internal.colorSource.cleanup?.()}render(){}updateState(){const e=this.internal.colorSource.value(),n=this.internal.statusSource.value();i.ir.equals(e,this.state.color)&&n.message===this.state.status.message||this.setState(r=>({...r,color:e,status:n}))}}const pi=d.z.object({needsControlOf:p.xm.keyZ.array(),states:ii.array()});class Pn extends p.Leaf{static TYPE="Legend";schema=pi;afterUpdate(e){const{internal:n}=this;n.stateProv=Fe.use(e);const r=this.state.needsControlOf;n.disconnectStateProv?.();const s=i.ar.filterTransfersByChannelKey(...r),a=n.stateProv.get(r);this.setState(o=>({...o,states:a})),n.disconnectStateProv=n.stateProv.onChange(o=>{if(s(o).length===0)return;const l=n.stateProv.get(r);this.setState(u=>({...u,states:l}))})}afterDelete(){const{internal:e}=this;e.disconnectStateProv?.()}render(){}}const bo={[En.TYPE]:En,[Fe.TYPE]:Fe,[Cn.TYPE]:Cn,[Tn.TYPE]:Tn,[Pn.TYPE]:Pn},mi=["fire","momentary","pulse"],xo=d.z.enum(mi),gi=d.z.object({trigger:d.z.number(),sink:Xt.optional().default(jt),mode:xo.optional().default("fire")}),yi=2,vi=1;class kn extends p.Leaf{static TYPE="Button";schema=gi;afterUpdate(e){const{sink:n,mode:r,trigger:s}=this.state,{internal:a}=this;a.prevTrigger??=s,a.sink=st(e,n,a.sink);const o=a.prevTrigger;a.prevTrigger=s;const l=s===o+yi;s===o+vi?r=="fire"?this.internal.sink.set(!0):r=="momentary"&&this.internal.sink.set(!1):l&&(r=="momentary"?this.internal.sink.set(!0):r=="pulse"&&this.internal.sink.set(!0,!1))}afterDelete(){this.internal.sink.cleanup?.()}}const So={[kn.TYPE]:kn},Lr=`#version 300 es
|
|
3
|
-
precision lowp float;
|
|
4
|
-
|
|
5
|
-
uniform lowp vec4 u_color;
|
|
6
|
-
out vec4 fragColor;
|
|
7
|
-
|
|
8
|
-
void main(void) {
|
|
9
|
-
fragColor = u_color;
|
|
10
|
-
}
|
|
11
|
-
`,wo=`#version 300 es
|
|
12
|
-
|
|
13
|
-
// Copyright 2025 Synnax Labs, Inc.
|
|
14
|
-
//
|
|
15
|
-
// Use of this software is governed by the Business Source License included in the file
|
|
16
|
-
// licenses/BSL.txt.
|
|
17
|
-
//
|
|
18
|
-
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
19
|
-
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
20
|
-
// included in the file licenses/APL.txt.
|
|
21
|
-
|
|
22
|
-
in mediump float a_x;
|
|
23
|
-
in mediump float a_y;
|
|
24
|
-
in mediump vec2 a_translate;
|
|
25
|
-
|
|
26
|
-
uniform mediump vec2 u_scale_aggregate;
|
|
27
|
-
uniform mediump vec2 u_offset_aggregate;
|
|
28
|
-
|
|
29
|
-
void main(void) {
|
|
30
|
-
gl_Position = vec4((u_scale_aggregate * vec2(a_x, a_y) + u_offset_aggregate) + a_translate, 0.0, 1.0);
|
|
31
|
-
}
|
|
32
|
-
`,To=`#version 300 es
|
|
33
|
-
|
|
34
|
-
// Copyright 2025 Synnax Labs, Inc.
|
|
35
|
-
//
|
|
36
|
-
// Use of this software is governed by the Business Source License included in the file
|
|
37
|
-
// licenses/BSL.txt.
|
|
38
|
-
//
|
|
39
|
-
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
40
|
-
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
41
|
-
// included in the file licenses/APL.txt.
|
|
42
|
-
|
|
43
|
-
in mediump float a_x;
|
|
44
|
-
in mediump uint a_y;
|
|
45
|
-
in mediump vec2 a_translate;
|
|
46
|
-
|
|
47
|
-
uniform mediump vec2 u_scale_aggregate;
|
|
48
|
-
uniform mediump vec2 u_offset_aggregate;
|
|
49
|
-
|
|
50
|
-
void main(void) {
|
|
51
|
-
gl_Position = vec4((u_scale_aggregate * vec2(a_x, float(a_y)) + u_offset_aggregate) + a_translate, 0.0, 1.0);
|
|
52
|
-
}
|
|
53
|
-
`,bi=d.z.object({x:gt,y:gt,label:d.z.string().optional(),color:i.ir.colorZ,strokeWidth:d.z.number().default(1),downsample:d.z.number().min(1).max(50).default(1),downsampleMode:ir.default("decimate"),visible:d.z.boolean().optional().default(!0)}),Eo=(t,e,n)=>t===-1||e===-1||t>=n.series.length?NaN:Number(n.series[t].at(e)),Co=i.a.milliseconds(2);i.K.NAN,i.K.NAN,i.ir.ZERO,i.W.ZERO;const Po=(t,e)=>e.equals(i.r.UINT8)?t.UNSIGNED_BYTE:t.FLOAT;class Or extends p.GLProgram{translationBufferCache=new Map;constructor(e,n,r){super(e,n,r),this.translationBufferCache=new Map}bindState({strokeWidth:e,color:n}){return this.uniformColor("u_color",n),this.attrStrokeWidth(e)}bindScale(e,n){const r=i.K.scale(e.scale,n.scale),s=i.K.translate(i.K.scale(n.scale,e.offset),n.offset);this.uniformXY("u_scale_aggregate",r),this.uniformXY("u_offset_aggregate",s)}draw({x:e,y:n,count:r,downsample:s,xOffset:a,yOffset:o},l,u,c){const{gl:h}=this.renderCtx;this.bindAttrBuffer("x",e.glBuffer,s,a,u),this.bindAttrBuffer("y",n.glBuffer,s,o,c),h.drawArraysInstanced(h.LINE_STRIP,0,r/s,l)}bindAttrBuffer(e,n,r,s=0,a){const{gl:o}=this.renderCtx;o.bindBuffer(o.ARRAY_BUFFER,n);const l=o.getAttribLocation(this.prog,`a_${e}`),u=Po(o,a),c=a.density.valueOf();a.equals(i.r.UINT8)?o.vertexAttribIPointer(l,1,u,c*r,c*s):o.vertexAttribPointer(l,1,u,!1,c*r,c*s),o.enableVertexAttribArray(l)}getAndBindTranslationBuffer(e){const{gl:n}=this.renderCtx,r=`${this.renderCtx.aspect}:${e}`,s=this.translationBufferCache.get(r);if(s!=null)return n.bindBuffer(n.ARRAY_BUFFER,s.glBuffer),s;const a=n.createBuffer();if(a==null)throw new p.lt("Failed to create buffer from WebGL context");const o=Ro(this.renderCtx.aspect,e);n.bindBuffer(n.ARRAY_BUFFER,a),n.bufferData(n.ARRAY_BUFFER,o,n.DYNAMIC_DRAW);const l={glBuffer:a,jsBuffer:o};return this.translationBufferCache.set(r,l),l}attrStrokeWidth(e){const{gl:n}=this.renderCtx,{jsBuffer:r}=this.getAndBindTranslationBuffer(e),s=n.getAttribLocation(this.prog,"a_translate");return n.vertexAttribPointer(s,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(s),n.vertexAttribDivisor(s,1),r.length/2}}class Se{static CONTEXT_KEY="pluto-line-gl-program";uint8HybridProgram;float32Program;constructor(e){this.uint8HybridProgram=new Or(e,To,Lr),this.float32Program=new Or(e,wo,Lr)}get gl(){return this.uint8HybridProgram.renderCtx.gl}getProgram(e){return e.equals(i.r.UINT8)?this.uint8HybridProgram:this.float32Program}static create(e,n){const r=new Se(n);return e.set(Se.CONTEXT_KEY,r),r}static use(e){const n=e.get(Se.CONTEXT_KEY);if(n==null)throw new p.lt("GLProgram not found");return n}}class Lt extends p.Leaf{static TYPE="line";schema=bi;afterUpdate(e){const{internal:n}=this,r={onStatusChange:p.useAdder(e)};n.xTelem=K(e,this.state.x,n.xTelem,r),n.yTelem=K(e,this.state.y,n.yTelem,r),n.instrumentation=p.useInstrumentation(e,"line"),n.lineCtx=Se.use(e),n.requestRender=Wt(e),n.stopListeningXTelem?.(),n.stopListeningYTelem?.(),n.stopListeningXTelem=n.xTelem.onChange(()=>n.requestRender("data")),n.stopListeningYTelem=n.yTelem.onChange(()=>n.requestRender("data")),n.requestRender("layout"),(n.xDownsampler?.props.mode!==this.state.downsampleMode||n.xDownsampler?.props.windowSize!==this.state.downsample)&&(n.xDownsampler=new qe({mode:this.state.downsampleMode,windowSize:this.state.downsample}),n.yDownsampler=new qe({mode:this.state.downsampleMode,windowSize:this.state.downsample}))}afterDelete(){const{internal:e}=this;e.xTelem.cleanup?.(),e.yTelem.cleanup?.(),e.requestRender("layout")}xBounds(){return this.internal.xTelem.value()[0]}yBounds(){return this.internal.yTelem.value()[0]}findByXValue(e,n){const{xTelem:r,yTelem:s}=this.internal;let[,a]=r.value();a=this.internal.xDownsampler.transform(a);let[o,l]=[-1,-1];a.series.find((x,k)=>{const M=x.binarySearch(n),R=M>=0&&M<x.length;return R&&([o,l]=[M,k]),R});const{key:u}=this,{color:c,label:h}=this.state,f={key:u,color:c,label:h,position:{x:0,y:0},value:{x:NaN,y:NaN},bounds:{lower:0,upper:0}};if(o===-1||l===-1||!this.state.visible)return f;const m=a.series[l];f.value.x=Eo(l,o,a);let[,v]=s.value();v=this.internal.yDownsampler.transform(v);const w=v.series.find(x=>i.W.contains(x.alignmentBounds,m.alignment+BigInt(o)));if(w==null)return f;const b=Number(w.alignment-m.alignment);return f.value.y=Number(w.at(o-b)),f.bounds={...w.bounds},f.position={x:e.dataToDecimalScale.x.pos(f.value.x),y:e.dataToDecimalScale.y.pos(f.value.y)},f}render(e){if(this.deleted||!this.state.visible)return;const{downsample:n}=this.state,{xTelem:r,yTelem:s,lineCtx:a,xDownsampler:o,yDownsampler:l}=this.internal,{dataToDecimalScale:u,exposure:c}=e;let[[,h],[,f]]=[r.value(),s.value()];if(h=o.transform(h),f=l.transform(f),h.updateGLBuffer(a.gl),f.updateGLBuffer(a.gl),h.length===0||f.length===0)return;const m=a.getProgram(f.dataType),v=_o(h,f,c,n,this.state.downsampleMode,Co);this.internal.instrumentation.L.debug("render",()=>({key:this.key,downsample:n,scale:u.transform,props:e.region,ops:zo(v)}));const w=m.setAsActive(),b=m.bindState(this.state),x=m.renderCtx.scaleRegion(e.region).transform;v.forEach(k=>{const M=Do(u,k).transform;m.bindScale(M,x),m.draw(k,b,h.dataType,f.dataType)}),w()}}const ko=5e3,Ro=(t,e)=>Oo(Lo(t),e).map((n,r)=>Math.floor(r/Mo)*(1/(ko*t))*n),Mo=5,Lo=t=>new Float32Array([0,0,0,t,0,-t,1,0,-1,0]),Oo=(t,e)=>{const n=new Float32Array(t.length*e);for(let r=0;r<e;r++)n.set(t,r*t.length);return n},Do=(t,e)=>t.translate(t.x.dim(Number(e.x.sampleOffset)),t.y.dim(Number(e.y.sampleOffset))),Yo={[Lt.TYPE]:Lt},_o=(t,e,n,r,s,a)=>{if(t.series.length===0||e.series.length===0)return[];const o=[];return t.series.forEach(l=>e.series.forEach(u=>{if(!Ao(l,u,a))return;let c=0,h=0;l.alignment<u.alignment?c=Number(u.alignment-l.alignment):u.alignment<l.alignment&&(h=Number(l.alignment-u.alignment));const f=Math.min(l.length-c,u.length-h);if(f===0)return;let m=i.R(Math.round(n*4*f),r,51);s!=="decimate"&&(m=1),o.push({x:l,y:u,xOffset:c,yOffset:h,count:f,downsample:m})})),o},zo=t=>t.map(e=>({...e,x:e.x.digest,y:e.y.digest})),Ao=(t,e,n)=>{const r=t.timeRange.overlapsWith(e.timeRange,n),s=i.W.overlapsWith(t.alignmentBounds,e.alignmentBounds);return r&&s},lr=d.z.object({dpr:d.z.number(),region:i.Ho.box,bootstrap:d.z.boolean().optional().default(!1),bootstrapped:d.z.boolean().optional().default(!1),glCanvas:d.z.any().optional(),upper2dCanvas:d.z.any().optional(),lower2dCanvas:d.z.any().optional(),os:i.S.osZ});class Ot extends p.Composite{static TYPE="Canvas";schema=lr;renderCtx=null;afterUpdate(e){if(this.renderCtx==null){if(!this.state.bootstrap)return;const{glCanvas:n,lower2dCanvas:r,upper2dCanvas:s,os:a}=this.state;if(n==null||r==null||s==null)throw new p.lt("[vis.worker.Canvas] - expected render context bootstrap to include all canvases");this.renderCtx=p.Context.create(e,n,r,s,a),Se.create(e,this.renderCtx),this.setState(o=>({...o,bootstrap:!1,bootstrapped:!0,glCanvas:void 0,lower2dCanvas:void 0,upper2dCanvas:void 0}))}else this.renderCtx.update(e);this.renderCtx.resize(this.state.region,this.state.dpr)}}const xi={[Ot.TYPE]:Ot},Zo=Object.freeze(Object.defineProperty({__proto__:null,Canvas:Ot,REGISTRY:xi,canvasStateZ:lr},Symbol.toStringTag,{value:"Module"})),cr=d.z.object({position:i.K.xy,zoom:d.z.number(),region:i.Ho.box,clearOverScan:i.K.crudeZ.optional().default(10),visible:d.z.boolean().optional().default(!0)}),ut=["upper2d","lower2d"];class le extends p.Composite{static TYPE="Diagram";static stateZ=cr;schema=le.stateZ;afterUpdate(e){this.internal.renderCtx=p.Context.use(e),this.internal.handleError=p.useErrorHandler(e),Ft(e,()=>{this.state.visible&&this.requestRender("low")}),!(!this.state.visible&&!this.prevState.visible)&&(this.internal.viewportScale=i.C.XY.magnify(i.K.construct(this.state.zoom)).translate(i.Ho.topLeft(this.state.region)).translate(this.state.position),this.requestRender("high"))}afterDelete(){this.requestRender("high")}render(){if(this.deleted)return;const{renderCtx:e,handleError:n,viewportScale:r}=this.internal,s=i.Ho.construct(this.state.region);if(!this.state.visible)return()=>e.erase(s,this.state.clearOverScan,...ut);const a=e.scissor(s,i.K.ZERO,ut);try{this.children.forEach(l=>l.render?.({viewportScale:r}))}catch(l){n(l,"failed to render diagram")}finally{a()}const o=i.Ho.copy(this.state.region);return()=>{e.lower2d.fillStyle=i.ir.hex(i.ir.BLACK),e.lower2d.fillRect(...i.K.couple(i.Ho.topLeft(o)),i.Ho.width(o),i.Ho.height(o)),e.erase(o,this.state.clearOverScan,...ut)}}requestRender(e){const{renderCtx:n}=this.internal;n.loop.set({key:`${le.TYPE}-${this.key}`,render:this.render.bind(this),priority:e,canvases:ut})}}const Si={[le.TYPE]:le},Io=Object.freeze(Object.defineProperty({__proto__:null,Diagram:le,REGISTRY:Si,diagramStateZ:cr},Symbol.toStringTag,{value:"Module"})),wi=d.z.object({enabled:d.z.boolean(),source:Fn.optional().default(Kn)});class Rn extends p.Leaf{static TYPE="Light";schema=wi;afterUpdate(e){this.internal.addStatus=p.useOptionalAdder(e);const{source:n}=this.state,{internal:r}=this;this.internal.source=K(e,n,this.internal.source),r.stopListening?.(),r.stopListening=r.source.onChange(()=>this.updateEnabledState())}updateEnabledState(){const e=this.internal.source.value();e!==this.state.enabled&&this.setState(n=>({...n,enabled:e}))}afterDelete(){this.internal.stopListening(),this.internal.source.cleanup?.()}}const Ho={[Rn.TYPE]:Rn},No=d.object({request:d.string(),bounds:d.record(d.string(),i.W.bounds)}),Ti=d.object({request:d.string(),response:No});class Dt extends p.Leaf{static TYPE="Bounds";schema=Ti;afterUpdate(e){this.state.request!==this.prevState.request&&this.setState(n=>({...n,response:{request:n.request,bounds:this.internal.getBounds()}}))}render(e){this.internal.getBounds=e.getBounds}}const Ei=d.z.object({key:d.z.string(),size:d.z.number(),order:d.z.number(),loc:i.K$1.outer});d.z.record(d.z.string(),Ei);const ie=(t,e)=>Object.values(e).filter(({loc:n})=>n===t).sort((n,r)=>r.order-n.order),Bo=(t,e,n)=>{const r=e[t];if(r==null)return i.K.ZERO;const s=i.K$1.construct(r.loc),a=ie(s,e),o=i.K$1.construct(i.g.swap(i.K$1.direction(s))),l=ie(o,e),u=a.findIndex(({key:f})=>f===t),c=a.slice(0,u).reduce((f,{size:m})=>f+m,0),h=l.reduce((f,{size:m})=>f+m,0);switch(s){case"left":return i.K.translate(i.Ho.topLeft(n),[c,h]);case"right":return i.K.translate(i.Ho.topRight(n),[c-r.size,h]);case"top":return i.K.translate(i.Ho.topLeft(n),[h,c]);default:return i.K.translate(i.Ho.bottomLeft(n),[h,-c-r.size])}},Uo=(t,e)=>{const n=ie("left",t),r=ie("right",t),s=ie("top",t),a=ie("bottom",t),o=n.reduce((h,{size:f})=>h+f,0),l=r.reduce((h,{size:f})=>h+f,0),u=s.reduce((h,{size:f})=>h+f,0),c=a.reduce((h,{size:f})=>h+f,0);return i.Ho.construct(i.K.translate(i.Ho.topLeft(e),{x:o,y:u}),i.Ho.width(e)-o-l,i.Ho.height(e)-u-c)};function pt(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function $o(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function ur(t){let e,n,r;t.length!==2?(e=pt,n=(l,u)=>pt(t(l),u),r=(l,u)=>t(l)-u):(e=t===pt||t===$o?t:Ko,n=t,r=t);function s(l,u,c=0,h=l.length){if(c<h){if(e(u,u)!==0)return h;do{const f=c+h>>>1;n(l[f],u)<0?c=f+1:h=f}while(c<h)}return c}function a(l,u,c=0,h=l.length){if(c<h){if(e(u,u)!==0)return h;do{const f=c+h>>>1;n(l[f],u)<=0?c=f+1:h=f}while(c<h)}return c}function o(l,u,c=0,h=l.length){const f=s(l,u,c,h-1);return f>c&&r(l[f-1],u)>-r(l[f],u)?f-1:f}return{left:s,center:o,right:a}}function Ko(){return 0}function qo(t){return t===null?NaN:+t}const Fo=ur(pt),Wo=Fo.right;ur(qo).center;const jo=Math.sqrt(50),Vo=Math.sqrt(10),Go=Math.sqrt(2);function Yt(t,e,n){const r=(e-t)/Math.max(0,n),s=Math.floor(Math.log10(r)),a=r/Math.pow(10,s),o=a>=jo?10:a>=Vo?5:a>=Go?2:1;let l,u,c;return s<0?(c=Math.pow(10,-s)/o,l=Math.round(t*c),u=Math.round(e*c),l/c<t&&++l,u/c>e&&--u,c=-c):(c=Math.pow(10,s)*o,l=Math.round(t/c),u=Math.round(e/c),l*c<t&&++l,u*c>e&&--u),u<l&&.5<=n&&n<2?Yt(t,e,n*2):[l,u,c]}function Xo(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[s,a,o]=r?Yt(e,t,n):Yt(t,e,n);if(!(a>=s))return[];const l=a-s+1,u=new Array(l);if(r)if(o<0)for(let c=0;c<l;++c)u[c]=(a-c)/-o;else for(let c=0;c<l;++c)u[c]=(a-c)*o;else if(o<0)for(let c=0;c<l;++c)u[c]=(s+c)/-o;else for(let c=0;c<l;++c)u[c]=(s+c)*o;return u}function Mn(t,e,n){return e=+e,t=+t,n=+n,Yt(t,e,n)[2]}function Ln(t,e,n){e=+e,t=+t,n=+n;const r=e<t,s=r?Mn(e,t,n):Mn(t,e,n);return(r?-1:1)*(s<0?1/-s:s)}function Ci(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function hr(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Pi(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function it(){}var We=.7,_t=1/We,we="\\s*([+-]?\\d+)\\s*",je="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",W="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Qo=/^#([0-9a-f]{3,8})$/,Jo=new RegExp(`^rgb\\(${we},${we},${we}\\)$`),el=new RegExp(`^rgb\\(${W},${W},${W}\\)$`),tl=new RegExp(`^rgba\\(${we},${we},${we},${je}\\)$`),nl=new RegExp(`^rgba\\(${W},${W},${W},${je}\\)$`),rl=new RegExp(`^hsl\\(${je},${W},${W}\\)$`),sl=new RegExp(`^hsla\\(${je},${W},${W},${je}\\)$`),Dr={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};hr(it,De,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Yr,formatHex:Yr,formatHex8:il,formatHsl:al,formatRgb:_r,toString:_r});function Yr(){return this.rgb().formatHex()}function il(){return this.rgb().formatHex8()}function al(){return ki(this).formatHsl()}function _r(){return this.rgb().formatRgb()}function De(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Qo.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?zr(e):n===3?new I(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?ht(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?ht(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Jo.exec(t))?new I(e[1],e[2],e[3],1):(e=el.exec(t))?new I(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=tl.exec(t))?ht(e[1],e[2],e[3],e[4]):(e=nl.exec(t))?ht(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=rl.exec(t))?Ir(e[1],e[2]/100,e[3]/100,1):(e=sl.exec(t))?Ir(e[1],e[2]/100,e[3]/100,e[4]):Dr.hasOwnProperty(t)?zr(Dr[t]):t==="transparent"?new I(NaN,NaN,NaN,0):null}function zr(t){return new I(t>>16&255,t>>8&255,t&255,1)}function ht(t,e,n,r){return r<=0&&(t=e=n=NaN),new I(t,e,n,r)}function ol(t){return t instanceof it||(t=De(t)),t?(t=t.rgb(),new I(t.r,t.g,t.b,t.opacity)):new I}function On(t,e,n,r){return arguments.length===1?ol(t):new I(t,e,n,r??1)}function I(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}hr(I,On,Pi(it,{brighter(t){return t=t==null?_t:Math.pow(_t,t),new I(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?We:Math.pow(We,t),new I(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new I(oe(this.r),oe(this.g),oe(this.b),zt(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:Ar,formatHex:Ar,formatHex8:ll,formatRgb:Zr,toString:Zr}));function Ar(){return`#${ae(this.r)}${ae(this.g)}${ae(this.b)}`}function ll(){return`#${ae(this.r)}${ae(this.g)}${ae(this.b)}${ae((isNaN(this.opacity)?1:this.opacity)*255)}`}function Zr(){const t=zt(this.opacity);return`${t===1?"rgb(":"rgba("}${oe(this.r)}, ${oe(this.g)}, ${oe(this.b)}${t===1?")":`, ${t})`}`}function zt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function oe(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ae(t){return t=oe(t),(t<16?"0":"")+t.toString(16)}function Ir(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new F(t,e,n,r)}function ki(t){if(t instanceof F)return new F(t.h,t.s,t.l,t.opacity);if(t instanceof it||(t=De(t)),!t)return new F;if(t instanceof F)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,s=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,l=a-s,u=(a+s)/2;return l?(e===a?o=(n-r)/l+(n<r)*6:n===a?o=(r-e)/l+2:o=(e-n)/l+4,l/=u<.5?a+s:2-a-s,o*=60):l=u>0&&u<1?0:o,new F(o,l,u,t.opacity)}function cl(t,e,n,r){return arguments.length===1?ki(t):new F(t,e,n,r??1)}function F(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}hr(F,cl,Pi(it,{brighter(t){return t=t==null?_t:Math.pow(_t,t),new F(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?We:Math.pow(We,t),new F(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,s=2*n-r;return new I(sn(t>=240?t-240:t+120,s,r),sn(t,s,r),sn(t<120?t+240:t-120,s,r),this.opacity)},clamp(){return new F(Hr(this.h),dt(this.s),dt(this.l),zt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=zt(this.opacity);return`${t===1?"hsl(":"hsla("}${Hr(this.h)}, ${dt(this.s)*100}%, ${dt(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Hr(t){return t=(t||0)%360,t<0?t+360:t}function dt(t){return Math.max(0,Math.min(1,t||0))}function sn(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const dr=t=>()=>t;function ul(t,e){return function(n){return t+n*e}}function hl(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function dl(t){return(t=+t)==1?Ri:function(e,n){return n-e?hl(e,n,t):dr(isNaN(e)?n:e)}}function Ri(t,e){var n=e-t;return n?ul(t,n):dr(isNaN(t)?e:t)}const Dn=function t(e){var n=dl(e);function r(s,a){var o=n((s=On(s)).r,(a=On(a)).r),l=n(s.g,a.g),u=n(s.b,a.b),c=Ri(s.opacity,a.opacity);return function(h){return s.r=o(h),s.g=l(h),s.b=u(h),s.opacity=c(h),s+""}}return r.gamma=t,r}(1);function fl(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),s;return function(a){for(s=0;s<n;++s)r[s]=t[s]*(1-a)+e[s]*a;return r}}function pl(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function ml(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,s=new Array(r),a=new Array(n),o;for(o=0;o<r;++o)s[o]=tn(t[o],e[o]);for(;o<n;++o)a[o]=e[o];return function(l){for(o=0;o<r;++o)a[o]=s[o](l);return a}}function gl(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Ve(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function yl(t,e){var n={},r={},s;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(s in e)s in t?n[s]=tn(t[s],e[s]):r[s]=e[s];return function(a){for(s in n)r[s]=n[s](a);return r}}var Yn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,an=new RegExp(Yn.source,"g");function vl(t){return function(){return t}}function bl(t){return function(e){return t(e)+""}}function Mi(t,e){var n=Yn.lastIndex=an.lastIndex=0,r,s,a,o=-1,l=[],u=[];for(t=t+"",e=e+"";(r=Yn.exec(t))&&(s=an.exec(e));)(a=s.index)>n&&(a=e.slice(n,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,u.push({i:o,x:Ve(r,s)})),n=an.lastIndex;return n<e.length&&(a=e.slice(n),l[o]?l[o]+=a:l[++o]=a),l.length<2?u[0]?bl(u[0].x):vl(e):(e=u.length,function(c){for(var h=0,f;h<e;++h)l[(f=u[h]).i]=f.x(c);return l.join("")})}function tn(t,e){var n=typeof e,r;return e==null||n==="boolean"?dr(e):(n==="number"?Ve:n==="string"?(r=De(e))?(e=r,Dn):Mi:e instanceof De?Dn:e instanceof Date?gl:pl(e)?fl:Array.isArray(e)?ml:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?yl:Ve)(t,e)}function xl(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function Sl(t){return function(){return t}}function wl(t){return+t}var Nr=[0,1];function be(t){return t}function _n(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:Sl(isNaN(e)?NaN:.5)}function Tl(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function El(t,e,n){var r=t[0],s=t[1],a=e[0],o=e[1];return s<r?(r=_n(s,r),a=n(o,a)):(r=_n(r,s),a=n(a,o)),function(l){return a(r(l))}}function Cl(t,e,n){var r=Math.min(t.length,e.length)-1,s=new Array(r),a=new Array(r),o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)s[o]=_n(t[o],t[o+1]),a[o]=n(e[o],e[o+1]);return function(l){var u=Wo(t,l,1,r)-1;return a[u](s[u](l))}}function Li(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Pl(){var t=Nr,e=Nr,n=tn,r,s,a,o=be,l,u,c;function h(){var m=Math.min(t.length,e.length);return o!==be&&(o=Tl(t[0],t[m-1])),l=m>2?Cl:El,u=c=null,f}function f(m){return m==null||isNaN(m=+m)?a:(u||(u=l(t.map(r),e,n)))(r(o(m)))}return f.invert=function(m){return o(s((c||(c=l(e,t.map(r),Ve)))(m)))},f.domain=function(m){return arguments.length?(t=Array.from(m,wl),h()):t.slice()},f.range=function(m){return arguments.length?(e=Array.from(m),h()):e.slice()},f.rangeRound=function(m){return e=Array.from(m),n=xl,h()},f.clamp=function(m){return arguments.length?(o=m?!0:be,h()):o!==be},f.interpolate=function(m){return arguments.length?(n=m,h()):n},f.unknown=function(m){return arguments.length?(a=m,f):a},function(m,v){return r=m,s=v,h()}}function Oi(){return Pl()(be,be)}function kl(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function At(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Ye(t){return t=At(Math.abs(t)),t?t[1]:NaN}function Rl(t,e){return function(n,r){for(var s=n.length,a=[],o=0,l=t[0],u=0;s>0&&l>0&&(u+l+1>r&&(l=Math.max(1,r-u)),a.push(n.substring(s-=l,s+l)),!((u+=l+1)>r));)l=t[o=(o+1)%t.length];return a.reverse().join(e)}}function Ml(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Ll=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Zt(t){if(!(e=Ll.exec(t)))throw new Error("invalid format: "+t);var e;return new fr({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Zt.prototype=fr.prototype;function fr(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}fr.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 Ol(t){e:for(var e=t.length,n=1,r=-1,s;n<e;++n)switch(t[n]){case".":r=s=n;break;case"0":r===0&&(r=n),s=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(s+1):t}var Di;function Dl(t,e){var n=At(t,e);if(!n)return t+"";var r=n[0],s=n[1],a=s-(Di=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+At(t,Math.max(0,e+a-1))[0]}function Br(t,e){var n=At(t,e);if(!n)return t+"";var r=n[0],s=n[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 Ur={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:kl,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Br(t*100,e),r:Br,s:Dl,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function $r(t){return t}var Kr=Array.prototype.map,qr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Yl(t){var e=t.grouping===void 0||t.thousands===void 0?$r:Rl(Kr.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",s=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?$r:Ml(Kr.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",u=t.nan===void 0?"NaN":t.nan+"";function c(f){f=Zt(f);var m=f.fill,v=f.align,w=f.sign,b=f.symbol,x=f.zero,k=f.width,M=f.comma,R=f.precision,O=f.trim,Y=f.type;Y==="n"?(M=!0,Y="g"):Ur[Y]||(R===void 0&&(R=12),O=!0,Y="g"),(x||m==="0"&&v==="=")&&(x=!0,m="0",v="=");var S=b==="$"?n:b==="#"&&/[boxX]/.test(Y)?"0"+Y.toLowerCase():"",D=b==="$"?r:/[%p]/.test(Y)?o:"",ee=Ur[Y],He=/[defgprs%]/.test(Y);R=R===void 0?6:/[gprs]/.test(Y)?Math.max(1,Math.min(21,R)):Math.max(0,Math.min(20,R));function pe(E){var j=S,A=D,te,ct,me;if(Y==="c")A=ee(E)+A,E="";else{E=+E;var ge=E<0||1/E<0;if(E=isNaN(E)?u:ee(Math.abs(E),R),O&&(E=Ol(E)),ge&&+E==0&&w!=="+"&&(ge=!1),j=(ge?w==="("?w:l:w==="-"||w==="("?"":w)+j,A=(Y==="s"?qr[8+Di/3]:"")+A+(ge&&w==="("?")":""),He){for(te=-1,ct=E.length;++te<ct;)if(me=E.charCodeAt(te),48>me||me>57){A=(me===46?s+E.slice(te+1):E.slice(te))+A,E=E.slice(0,te);break}}}M&&!x&&(E=e(E,1/0));var ye=j.length+E.length+A.length,q=ye<k?new Array(k-ye+1).join(m):"";switch(M&&x&&(E=e(q+E,q.length?k-A.length:1/0),q=""),v){case"<":E=j+E+A+q;break;case"=":E=j+q+E+A;break;case"^":E=q.slice(0,ye=q.length>>1)+j+E+A+q.slice(ye);break;default:E=q+j+E+A;break}return a(E)}return pe.toString=function(){return f+""},pe}function h(f,m){var v=c((f=Zt(f),f.type="f",f)),w=Math.max(-8,Math.min(8,Math.floor(Ye(m)/3)))*3,b=Math.pow(10,-w),x=qr[8+w/3];return function(k){return v(b*k)+x}}return{format:c,formatPrefix:h}}var ft,Yi,_i;_l({thousands:",",grouping:[3],currency:["$",""]});function _l(t){return ft=Yl(t),Yi=ft.format,_i=ft.formatPrefix,ft}function zl(t){return Math.max(0,-Ye(Math.abs(t)))}function Al(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ye(e)/3)))*3-Ye(Math.abs(t)))}function Zl(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Ye(e)-Ye(t))+1}function Il(t,e,n,r){var s=Ln(t,e,n),a;switch(r=Zt(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(a=Al(s,o))&&(r.precision=a),_i(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=Zl(s,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=zl(s))&&(r.precision=a-(r.type==="%")*2);break}}return Yi(r)}function Hl(t){var e=t.domain;return t.ticks=function(n){var r=e();return Xo(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var s=e();return Il(s[0],s[s.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),s=0,a=r.length-1,o=r[s],l=r[a],u,c,h=10;for(l<o&&(c=o,o=l,l=c,c=s,s=a,a=c);h-- >0;){if(c=Mn(o,l,n),c===u)return r[s]=o,r[a]=l,e(r);if(c>0)o=Math.floor(o/c)*c,l=Math.ceil(l/c)*c;else if(c<0)o=Math.ceil(o*c)/c,l=Math.floor(l*c)/c;else break;u=c}return t},t}function zi(){var t=Oi();return t.copy=function(){return Li(t,zi())},Ci.apply(t,arguments),Hl(t)}function Nl(t,e){t=t.slice();var n=0,r=t.length-1,s=t[n],a=t[r],o;return a<s&&(o=n,n=r,r=o,o=s,s=a,a=o),t[n]=e.floor(s),t[r]=e.ceil(a),t}const on=new Date,ln=new Date;function _(t,e,n,r){function s(a){return t(a=arguments.length===0?new Date:new Date(+a)),a}return s.floor=a=>(t(a=new Date(+a)),a),s.ceil=a=>(t(a=new Date(a-1)),e(a,1),t(a),a),s.round=a=>{const o=s(a),l=s.ceil(a);return a-o<l-a?o:l},s.offset=(a,o)=>(e(a=new Date(+a),o==null?1:Math.floor(o)),a),s.range=(a,o,l)=>{const u=[];if(a=s.ceil(a),l=l==null?1:Math.floor(l),!(a<o)||!(l>0))return u;let c;do u.push(c=new Date(+a)),e(a,l),t(a);while(c<a&&a<o);return u},s.filter=a=>_(o=>{if(o>=o)for(;t(o),!a(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;e(o,-1),!a(o););else for(;--l>=0;)for(;e(o,1),!a(o););}),n&&(s.count=(a,o)=>(on.setTime(+a),ln.setTime(+o),t(on),t(ln),Math.floor(n(on,ln))),s.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?s.filter(r?o=>r(o)%a===0:o=>s.count(0,o)%a===0):s)),s}const It=_(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);It.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?_(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):It);It.range;const V=1e3,U=V*60,G=U*60,Q=G*24,pr=Q*7,Fr=Q*30,cn=Q*365,xe=_(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*V)},(t,e)=>(e-t)/V,t=>t.getUTCSeconds());xe.range;const mr=_(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*V)},(t,e)=>{t.setTime(+t+e*U)},(t,e)=>(e-t)/U,t=>t.getMinutes());mr.range;const Bl=_(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*U)},(t,e)=>(e-t)/U,t=>t.getUTCMinutes());Bl.range;const gr=_(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*V-t.getMinutes()*U)},(t,e)=>{t.setTime(+t+e*G)},(t,e)=>(e-t)/G,t=>t.getHours());gr.range;const Ul=_(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*G)},(t,e)=>(e-t)/G,t=>t.getUTCHours());Ul.range;const at=_(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*U)/Q,t=>t.getDate()-1);at.range;const yr=_(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Q,t=>t.getUTCDate()-1);yr.range;const $l=_(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Q,t=>Math.floor(t/Q));$l.range;function he(t){return _(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*U)/pr)}const nn=he(0),Ht=he(1),Kl=he(2),ql=he(3),_e=he(4),Fl=he(5),Wl=he(6);nn.range;Ht.range;Kl.range;ql.range;_e.range;Fl.range;Wl.range;function de(t){return _(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/pr)}const Ai=de(0),Nt=de(1),jl=de(2),Vl=de(3),ze=de(4),Gl=de(5),Xl=de(6);Ai.range;Nt.range;jl.range;Vl.range;ze.range;Gl.range;Xl.range;const vr=_(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());vr.range;const Ql=_(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Ql.range;const J=_(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());J.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:_(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});J.range;const ce=_(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());ce.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:_(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});ce.range;function Jl(t,e,n,r,s,a){const o=[[xe,1,V],[xe,5,5*V],[xe,15,15*V],[xe,30,30*V],[a,1,U],[a,5,5*U],[a,15,15*U],[a,30,30*U],[s,1,G],[s,3,3*G],[s,6,6*G],[s,12,12*G],[r,1,Q],[r,2,2*Q],[n,1,pr],[e,1,Fr],[e,3,3*Fr],[t,1,cn]];function l(c,h,f){const m=h<c;m&&([c,h]=[h,c]);const v=f&&typeof f.range=="function"?f:u(c,h,f),w=v?v.range(c,+h+1):[];return m?w.reverse():w}function u(c,h,f){const m=Math.abs(h-c)/f,v=ur(([,,x])=>x).right(o,m);if(v===o.length)return t.every(Ln(c/cn,h/cn,f));if(v===0)return It.every(Math.max(Ln(c,h,f),1));const[w,b]=o[m/o[v-1][2]<o[v][2]/m?v-1:v];return w.every(b)}return[l,u]}const[ec,tc]=Jl(J,vr,nn,at,gr,mr);function un(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function hn(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Ne(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function nc(t){var e=t.dateTime,n=t.date,r=t.time,s=t.periods,a=t.days,o=t.shortDays,l=t.months,u=t.shortMonths,c=Be(s),h=Ue(s),f=Be(a),m=Ue(a),v=Be(o),w=Ue(o),b=Be(l),x=Ue(l),k=Be(u),M=Ue(u),R={a:ge,A:ye,b:q,B:ua,c:null,d:Qr,e:Qr,f:Cc,g:zc,G:Zc,H:wc,I:Tc,j:Ec,L:Zi,m:Pc,M:kc,p:ha,q:da,Q:ts,s:ns,S:Rc,u:Mc,U:Lc,V:Oc,w:Dc,W:Yc,x:null,X:null,y:_c,Y:Ac,Z:Ic,"%":es},O={a:fa,A:pa,b:ma,B:ga,c:null,d:Jr,e:Jr,f:Uc,g:Qc,G:eu,H:Hc,I:Nc,j:Bc,L:Hi,m:$c,M:Kc,p:ya,q:va,Q:ts,s:ns,S:qc,u:Fc,U:Wc,V:jc,w:Vc,W:Gc,x:null,X:null,y:Xc,Y:Jc,Z:tu,"%":es},Y={a:pe,A:E,b:j,B:A,c:te,d:Gr,e:Gr,f:vc,g:Vr,G:jr,H:Xr,I:Xr,j:pc,L:yc,m:fc,M:mc,p:He,q:dc,Q:xc,s:Sc,S:gc,u:oc,U:lc,V:cc,w:ac,W:uc,x:ct,X:me,y:Vr,Y:jr,Z:hc,"%":bc};R.x=S(n,R),R.X=S(r,R),R.c=S(e,R),O.x=S(n,O),O.X=S(r,O),O.c=S(e,O);function S(y,T){return function(C){var g=[],Z=-1,L=0,H=y.length,N,se,Cr;for(C instanceof Date||(C=new Date(+C));++Z<H;)y.charCodeAt(Z)===37&&(g.push(y.slice(L,Z)),(se=Wr[N=y.charAt(++Z)])!=null?N=y.charAt(++Z):se=N==="e"?" ":"0",(Cr=T[N])&&(N=Cr(C,se)),g.push(N),L=Z+1);return g.push(y.slice(L,Z)),g.join("")}}function D(y,T){return function(C){var g=Ne(1900,void 0,1),Z=ee(g,y,C+="",0),L,H;if(Z!=C.length)return null;if("Q"in g)return new Date(g.Q);if("s"in g)return new Date(g.s*1e3+("L"in g?g.L:0));if(T&&!("Z"in g)&&(g.Z=0),"p"in g&&(g.H=g.H%12+g.p*12),g.m===void 0&&(g.m="q"in g?g.q:0),"V"in g){if(g.V<1||g.V>53)return null;"w"in g||(g.w=1),"Z"in g?(L=hn(Ne(g.y,0,1)),H=L.getUTCDay(),L=H>4||H===0?Nt.ceil(L):Nt(L),L=yr.offset(L,(g.V-1)*7),g.y=L.getUTCFullYear(),g.m=L.getUTCMonth(),g.d=L.getUTCDate()+(g.w+6)%7):(L=un(Ne(g.y,0,1)),H=L.getDay(),L=H>4||H===0?Ht.ceil(L):Ht(L),L=at.offset(L,(g.V-1)*7),g.y=L.getFullYear(),g.m=L.getMonth(),g.d=L.getDate()+(g.w+6)%7)}else("W"in g||"U"in g)&&("w"in g||(g.w="u"in g?g.u%7:"W"in g?1:0),H="Z"in g?hn(Ne(g.y,0,1)).getUTCDay():un(Ne(g.y,0,1)).getDay(),g.m=0,g.d="W"in g?(g.w+6)%7+g.W*7-(H+5)%7:g.w+g.U*7-(H+6)%7);return"Z"in g?(g.H+=g.Z/100|0,g.M+=g.Z%100,hn(g)):un(g)}}function ee(y,T,C,g){for(var Z=0,L=T.length,H=C.length,N,se;Z<L;){if(g>=H)return-1;if(N=T.charCodeAt(Z++),N===37){if(N=T.charAt(Z++),se=Y[N in Wr?T.charAt(Z++):N],!se||(g=se(y,C,g))<0)return-1}else if(N!=C.charCodeAt(g++))return-1}return g}function He(y,T,C){var g=c.exec(T.slice(C));return g?(y.p=h.get(g[0].toLowerCase()),C+g[0].length):-1}function pe(y,T,C){var g=v.exec(T.slice(C));return g?(y.w=w.get(g[0].toLowerCase()),C+g[0].length):-1}function E(y,T,C){var g=f.exec(T.slice(C));return g?(y.w=m.get(g[0].toLowerCase()),C+g[0].length):-1}function j(y,T,C){var g=k.exec(T.slice(C));return g?(y.m=M.get(g[0].toLowerCase()),C+g[0].length):-1}function A(y,T,C){var g=b.exec(T.slice(C));return g?(y.m=x.get(g[0].toLowerCase()),C+g[0].length):-1}function te(y,T,C){return ee(y,e,T,C)}function ct(y,T,C){return ee(y,n,T,C)}function me(y,T,C){return ee(y,r,T,C)}function ge(y){return o[y.getDay()]}function ye(y){return a[y.getDay()]}function q(y){return u[y.getMonth()]}function ua(y){return l[y.getMonth()]}function ha(y){return s[+(y.getHours()>=12)]}function da(y){return 1+~~(y.getMonth()/3)}function fa(y){return o[y.getUTCDay()]}function pa(y){return a[y.getUTCDay()]}function ma(y){return u[y.getUTCMonth()]}function ga(y){return l[y.getUTCMonth()]}function ya(y){return s[+(y.getUTCHours()>=12)]}function va(y){return 1+~~(y.getUTCMonth()/3)}return{format:function(y){var T=S(y+="",R);return T.toString=function(){return y},T},parse:function(y){var T=D(y+="",!1);return T.toString=function(){return y},T},utcFormat:function(y){var T=S(y+="",O);return T.toString=function(){return y},T},utcParse:function(y){var T=D(y+="",!0);return T.toString=function(){return y},T}}}var Wr={"-":"",_:" ",0:"0"},z=/^\s*\d+/,rc=/^%/,sc=/[\\^$*+?|[\]().{}]/g;function P(t,e,n){var r=t<0?"-":"",s=(r?-t:t)+"",a=s.length;return r+(a<n?new Array(n-a+1).join(e)+s:s)}function ic(t){return t.replace(sc,"\\$&")}function Be(t){return new RegExp("^(?:"+t.map(ic).join("|")+")","i")}function Ue(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function ac(t,e,n){var r=z.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function oc(t,e,n){var r=z.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function lc(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function cc(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function uc(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function jr(t,e,n){var r=z.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Vr(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function hc(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function dc(t,e,n){var r=z.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function fc(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Gr(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function pc(t,e,n){var r=z.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Xr(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function mc(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function gc(t,e,n){var r=z.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function yc(t,e,n){var r=z.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function vc(t,e,n){var r=z.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function bc(t,e,n){var r=rc.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function xc(t,e,n){var r=z.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Sc(t,e,n){var r=z.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Qr(t,e){return P(t.getDate(),e,2)}function wc(t,e){return P(t.getHours(),e,2)}function Tc(t,e){return P(t.getHours()%12||12,e,2)}function Ec(t,e){return P(1+at.count(J(t),t),e,3)}function Zi(t,e){return P(t.getMilliseconds(),e,3)}function Cc(t,e){return Zi(t,e)+"000"}function Pc(t,e){return P(t.getMonth()+1,e,2)}function kc(t,e){return P(t.getMinutes(),e,2)}function Rc(t,e){return P(t.getSeconds(),e,2)}function Mc(t){var e=t.getDay();return e===0?7:e}function Lc(t,e){return P(nn.count(J(t)-1,t),e,2)}function Ii(t){var e=t.getDay();return e>=4||e===0?_e(t):_e.ceil(t)}function Oc(t,e){return t=Ii(t),P(_e.count(J(t),t)+(J(t).getDay()===4),e,2)}function Dc(t){return t.getDay()}function Yc(t,e){return P(Ht.count(J(t)-1,t),e,2)}function _c(t,e){return P(t.getFullYear()%100,e,2)}function zc(t,e){return t=Ii(t),P(t.getFullYear()%100,e,2)}function Ac(t,e){return P(t.getFullYear()%1e4,e,4)}function Zc(t,e){var n=t.getDay();return t=n>=4||n===0?_e(t):_e.ceil(t),P(t.getFullYear()%1e4,e,4)}function Ic(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+P(e/60|0,"0",2)+P(e%60,"0",2)}function Jr(t,e){return P(t.getUTCDate(),e,2)}function Hc(t,e){return P(t.getUTCHours(),e,2)}function Nc(t,e){return P(t.getUTCHours()%12||12,e,2)}function Bc(t,e){return P(1+yr.count(ce(t),t),e,3)}function Hi(t,e){return P(t.getUTCMilliseconds(),e,3)}function Uc(t,e){return Hi(t,e)+"000"}function $c(t,e){return P(t.getUTCMonth()+1,e,2)}function Kc(t,e){return P(t.getUTCMinutes(),e,2)}function qc(t,e){return P(t.getUTCSeconds(),e,2)}function Fc(t){var e=t.getUTCDay();return e===0?7:e}function Wc(t,e){return P(Ai.count(ce(t)-1,t),e,2)}function Ni(t){var e=t.getUTCDay();return e>=4||e===0?ze(t):ze.ceil(t)}function jc(t,e){return t=Ni(t),P(ze.count(ce(t),t)+(ce(t).getUTCDay()===4),e,2)}function Vc(t){return t.getUTCDay()}function Gc(t,e){return P(Nt.count(ce(t)-1,t),e,2)}function Xc(t,e){return P(t.getUTCFullYear()%100,e,2)}function Qc(t,e){return t=Ni(t),P(t.getUTCFullYear()%100,e,2)}function Jc(t,e){return P(t.getUTCFullYear()%1e4,e,4)}function eu(t,e){var n=t.getUTCDay();return t=n>=4||n===0?ze(t):ze.ceil(t),P(t.getUTCFullYear()%1e4,e,4)}function tu(){return"+0000"}function es(){return"%"}function ts(t){return+t}function ns(t){return Math.floor(+t/1e3)}var ve,Bi;nu({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 nu(t){return ve=nc(t),Bi=ve.format,ve.parse,ve.utcFormat,ve.utcParse,ve}function ru(t){return new Date(t)}function su(t){return t instanceof Date?+t:+new Date(+t)}function Ui(t,e,n,r,s,a,o,l,u,c){var h=Oi(),f=h.invert,m=h.domain,v=c(".%L"),w=c(":%S"),b=c("%I:%M"),x=c("%I %p"),k=c("%a %d"),M=c("%b %d"),R=c("%B"),O=c("%Y");function Y(S){return(u(S)<S?v:l(S)<S?w:o(S)<S?b:a(S)<S?x:r(S)<S?s(S)<S?k:M:n(S)<S?R:O)(S)}return h.invert=function(S){return new Date(f(S))},h.domain=function(S){return arguments.length?m(Array.from(S,su)):m().map(ru)},h.ticks=function(S){var D=m();return t(D[0],D[D.length-1],S??10)},h.tickFormat=function(S,D){return D==null?Y:c(D)},h.nice=function(S){var D=m();return(!S||typeof S.range!="function")&&(S=e(D[0],D[D.length-1],S??10)),S?m(Nl(D,S)):h},h.copy=function(){return Li(h,Ui(t,e,n,r,s,a,o,l,u,c))},h}function iu(){return Ci.apply(Ui(ec,tc,J,vr,nn,at,gr,mr,xe,Bi).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}const rs=[i.a.NANOSECOND,i.a.nanoseconds(2),i.a.nanoseconds(5),i.a.nanoseconds(10),i.a.nanoseconds(20),i.a.nanoseconds(50),i.a.nanoseconds(100),i.a.nanoseconds(200),i.a.nanoseconds(500),i.a.MICROSECOND,i.a.microseconds(2),i.a.microseconds(5),i.a.microseconds(10),i.a.microseconds(20),i.a.microseconds(50),i.a.microseconds(100),i.a.microseconds(200),i.a.microseconds(500),i.a.MILLISECOND,i.a.milliseconds(2),i.a.milliseconds(5),i.a.milliseconds(10),i.a.milliseconds(20),i.a.milliseconds(50),i.a.milliseconds(100),i.a.milliseconds(200),i.a.milliseconds(500),i.a.SECOND];class au{_domain;_range;_span;constructor(){this._domain=[new i.n(0n),new i.n(1n)],this._range=[0,1],this._span=this._domain[1].span(this._domain[0])}domain(e){return e===void 0?this._domain:(this._domain=[new i.n(e[0]),new i.n(e[1])],this._span=this._domain[1].span(this._domain[0]),this)}range(e){return e===void 0?this._range:(this._range=e,this)}scale(e){const r=new i.n(e).valueOf(),s=this._domain[0].valueOf(),a=this._domain[1].valueOf()-s,o=this._range[1]-this._range[0];return Number(r-s)/Number(a)*o+this._range[0]}ticks(e){const n=this.calculateOptimalStep(e).valueOf(),r=this._domain[0].valueOf(),s=this._domain[1].valueOf(),a=(r+n-1n)/n*n,o=Number((s-a)/n);return Array.from({length:o+1},(l,u)=>{const c=a+BigInt(u)*n;return new i.n(c)}).filter(l=>l.afterEq(this._domain[0])&&l.beforeEq(this._domain[1]))}calculateOptimalStep(e){const n=this._span.valueOf()/BigInt(Math.ceil(e));let r=rs[0];for(const s of rs){if(s.valueOf()>n)break;r=s}return r}formatTick(e){return this._span.lessThan(i.a.microseconds(50))?`${e.remainder(i.a.MILLISECOND).microseconds.toString()}µs`:`${e.remainder(i.a.SECOND).milliseconds.toString()}ms`}}const ou=()=>new au,br=d.z.enum(["linear","time"]),xr=d.z.object({tickSpacing:d.z.number().default(75),type:br.optional().default("linear")}),zn=t=>{const e=xr.parse(t);return uu[e.type](e)};class lu{props;prevScaleSize;prevDomain;currTicks;normalScale;preciseScale;constructor(e){this.props=e,this.normalScale=iu(),this.preciseScale=ou(),this.prevScaleSize=0,this.prevDomain=new i.w(new i.n(0),new i.n(0)),this.currTicks=[]}create({decimalToDataScale:e,size:n}){const r=new i.w(new i.n(e.pos(0)),new i.n(e.pos(1)));if(this.prevDomain.equals(r)&&this.prevScaleSize===n)return this.currTicks;if(this.prevDomain=r,this.prevScaleSize!==n){const s=[0,n];this.preciseScale.range(s),this.normalScale.range(s),this.prevScaleSize=n}if(r.span.milliseconds<5){this.preciseScale.domain([r.start,r.end]);const s=An(n,this.props.tickSpacing)/2,a=this.preciseScale.ticks(s);this.currTicks=a.map(o=>({label:this.preciseScale.formatTick(o),position:this.preciseScale.scale(o)}))}else{this.normalScale.domain([r.start.date(),r.end.date()]);const s=this.normalScale.ticks(An(n,this.props.tickSpacing));this.currTicks=s.map(a=>({label:this.normalTickLabel(a),position:this.normalScale(a)}))}return this.currTicks}normalTickLabel(e){let n=`:${e.getSeconds()}`;const r=e.getMilliseconds();if(r!==0){const s=Math.round(e.getMilliseconds()).toString().padStart(3,"0").replace(/0+$/,"");n+=`.${s}`}return e.getSeconds()===0&&r===0&&(n=`${e.getHours()}:${e.getMinutes().toString().padStart(2,"0")}`),n}}class cu{props;prevDomain;prevScaleSize;currTicks;d3Scale;constructor(e){this.props=e,this.prevDomain=i.W.construct(0,0),this.prevScaleSize=0,this.currTicks=[],this.d3Scale=zi()}create({decimalToDataScale:e,size:n}){const r={lower:e.pos(0),upper:e.pos(1)};if(i.W.equals(this.prevDomain,r)&&this.prevScaleSize===n)return this.currTicks;i.W.equals(this.prevDomain,r)||(this.d3Scale=this.d3Scale.domain([r.lower,r.upper])),this.prevScaleSize!==n&&(this.d3Scale=this.d3Scale.range([0,n])),this.prevDomain=r,this.prevScaleSize=n;const s=An(n,this.props.tickSpacing),a=this.d3Scale.ticks(s);return this.currTicks=a.map(o=>({label:this.tickLabel(o),position:this.d3Scale(o)})),this.currTicks}tickLabel(e){return e.toString()}}const An=(t,e)=>{const n=Math.floor(t/e);return n>0?n:1},uu={linear:t=>new cu(t),time:t=>new lu(t)},Sr=xr.extend({color:i.ir.colorZ,type:br.optional().default("linear"),font:d.z.string(),showGrid:d.z.boolean().optional().default(!0),location:i.K$1.outer,gridColor:i.ir.colorZ}),$=5,Ge=6,ot={useAtlas:!0},hu={bottom:(t,e)=>new Ki(t,e),top:(t,e)=>new qi(t,e),left:(t,e)=>new du(t,e),right:(t,e)=>new Fi(t,e)},$i=(t,e,n)=>hu[t](e,n);class fe{renderCtx;state;tickFactory;constructor(e,n){this.renderCtx=e,this.state=n,this.tickFactory=zn(this.state)}setState(e){this.state=p.prettyParse(Sr,e),this.tickFactory=zn(e)}drawLine(e,n){const{lower2d:r}=this.renderCtx;r.moveTo(...i.K.couple(e)),r.lineTo(...i.K.couple(n))}drawTicks(e,n){let r=i._.ZERO;return e.forEach(s=>{const a=this.renderCtx.lower2d.textDimensions(s.label,ot);r=i._.max([r,a]),n(a,s)}),r}static START_BOUND=i.W.construct(-1,1);maybeDrawGrid(e,n,r){const{showGrid:s,gridColor:a}=this.state;if(s){const o=fe.START_BOUND,l=i.W.construct(e-1,e+1),{lower2d:u}=this.renderCtx;u.beginPath(),u.strokeStyle=i.ir.hex(a),n.forEach(c=>{i.W.contains(o,c.position)||i.W.contains(l,c.position)||this.drawLine(...r(c))}),u.stroke()}}setColor(e){const n=i.ir.hex(e);this.renderCtx.lower2d.strokeStyle=n,this.renderCtx.lower2d.fillStyle=n,this.renderCtx.lower2d.font=this.state.font}}class Ki extends fe{render(e){const{lower2d:n}=this.renderCtx,{plot:r,position:s}=e,{width:a,height:o}=i.Ho.dims(r),l=this.tickFactory.create({...e,size:a});n.beginPath(),this.setColor(this.state.color),this.drawLine(s,i.K.translate(s,"x",a));const u=this.drawTicks(l,(c,h)=>{this.drawLine(i.K.translateX(s,h.position),i.K.translate(s,{x:h.position,y:$})),n.fillText(h.label,s.x+h.position-c.width/2,s.y+$+c.height+Ge,void 0,ot)});return n.stroke(),this.maybeDrawGrid(a,l,c=>[i.K.translate(s,"x",c.position),i.K.translate(s,{x:c.position,y:-o})]),{size:u.height+$+Ge}}}class qi extends fe{render(e){const{lower2d:n}=this.renderCtx,{plot:r}=e,{width:s,height:a}=i.Ho.dims(r),o=i.K.translate(e.position,"y",e.size),l=this.tickFactory.create({...e,size:s});n.beginPath(),this.setColor(this.state.color),this.drawLine(o,i.K.translate(o,"x",s));const u=this.drawTicks(l,(c,h)=>{this.drawLine(i.K.translateX(o,h.position),i.K.translate(o,{x:h.position,y:-$})),n.fillText(h.label,o.x+h.position-c.width/2,o.y-$-c.height-Ge,void 0,ot)});return n.stroke(),this.maybeDrawGrid(s,l,c=>[i.K.translate(o,"x",c.position),i.K.translate(o,{x:c.position,y:a})]),{size:u.height+$}}}class du extends fe{render(e){const{lower2d:n}=this.renderCtx,{plot:r,position:s}=e,{height:a,width:o}=i.Ho.dims(r),l=i.K.translate(s,"x",e.size),u=this.tickFactory.create({...e,size:a});n.beginPath(),this.setColor(this.state.color),this.drawLine(l,i.K.translate(l,"y",a));const c=this.drawTicks(u,(h,f)=>{this.drawLine(i.K.translateY(l,f.position),i.K.translate(l,{x:-$,y:f.position})),n.fillText(f.label,l.x-h.width-$*2,l.y+f.position+h.height/2,void 0,ot)});return n.stroke(),this.maybeDrawGrid(a,u,h=>[i.K.translate(l,"y",h.position),i.K.translate(l,{x:o,y:h.position})]),{size:c.width+$*2}}}class Fi extends fe{render(e){const{lower2d:n}=this.renderCtx,{plot:r,position:s}=e,{height:a,width:o}=i.Ho.dims(r),l=this.tickFactory.create({...e,size:a});n.beginPath(),this.setColor(this.state.color),this.drawLine(s,i.K.translateY(s,a));const u=this.drawTicks(l,(c,h)=>{this.drawLine(i.K.translateY(s,h.position),i.K.translate(s,{x:$,y:h.position})),n.fillText(h.label,s.x+$+Ge,s.y+h.position+c.height/2,void 0,ot)});return n.stroke(),this.maybeDrawGrid(a,l,c=>[i.K.translateY(s,c.position),i.K.translate(s,{x:-o,y:c.position})]),{size:u.width+$+Ge}}}const lt=Sr.extend({axisKey:d.z.string().optional(),bounds:i.W.bounds.optional(),autoBounds:d.z.object({lower:d.z.boolean().optional().default(!0),upper:d.z.boolean().optional().default(!0)}).or(d.z.boolean().optional().default(!0)),autoBoundPadding:d.z.number().optional(),autoBoundUpdateInterval:i.a.z.optional().default(i.a.seconds(10)),size:d.z.number().optional().default(0),label:d.z.string().optional().default(""),labelSize:d.z.number().optional().default(0)}).partial({color:!0,font:!0,gridColor:!0}),fu=2,pu=7,Wi=(t,e)=>i.W.contains({lower:t-pu,upper:t+fu},e),mu=i.W.DECIMAL,ss=i.n.now(),gu={lower:Number(ss.valueOf()),upper:Number(ss.add(i.a.HOUR).valueOf())},ji=t=>t==="linear"?mu:gu,yu=(t,e=.1,n)=>{const r=i.W.max(t.filter(i.W.isFinite));if(!i.W.isFinite(r))return ji(n);const{lower:s,upper:a}=r;if(a===s)return{lower:s-1,upper:a+1};const o=(a-s)*e;return{lower:s-o,upper:a+o}},vu=.01,bu=.1;class Vi extends p.Composite{afterUpdate(e){const{internal:n}=this,{location:r,autoBoundUpdateInterval:s}=this.state;n.render=p.Context.use(e);const a=p.use(e),o=i.g.construct(r);this.state.autoBoundPadding??=o==="x"?bu:vu,n.core=$i(r,n.render,{color:a.colors.gray.l10,font:Ke.fontString(a,{level:"small",code:!0}),gridColor:a.colors.gray.l1,...this.state}),X(e,"layout"),n.updateBounds??=p.r(l=>this.setState(u=>({...u,bounds:l})),s.milliseconds)}afterDelete(e){X(e,"layout")}renderAxis(e,n){if(!e.canvases.includes("lower2d"))return;const{core:r}=this.internal,{grid:s,container:a}=e,o=Bo(`${this.type}-${this.key}`,s,a),l={...e,position:o,decimalToDataScale:n,size:this.state.size+this.state.labelSize},{size:u}=r.render(l);Wi(this.state.size,u)||this.setState(c=>({...c,size:u}))}iBounds(e,n){if(e&&this.internal.boundSnapshot!=null)return[this.internal.boundSnapshot,null];const{lower:r,upper:s}=Gi(this.state.autoBounds);if(!r&&!s&&this.state.bounds!=null)return this.internal.boundSnapshot=this.state.bounds,[this.state.bounds,null];const a=c=>({upper:s||this.state.bounds==null?c.upper:this.state.bounds.upper,lower:r||this.state.bounds==null?c.lower:this.state.bounds.lower});let o,l=null;try{const c=n();o=yu(c,this.state.autoBoundPadding,this.state.type)}catch(c){o=ji(this.state.type),l=c}const u=a(o);return this.internal.boundSnapshot=u,(this.state.bounds==null||r&&this.state.bounds.lower!==u.lower||s&&this.state.bounds.upper!==u.upper)&&this.internal.updateBounds?.(u),[u,l]}dataToDecimalScale(e,n,r){const[s,a]=this.iBounds(e,n),o=i.g.swap(i.g.construct(this.state.location));return[i.C.Scale.scale(s).scale(1).translate(-i.Ho.root(r)[o]).magnify(1/i.Ho.dim(r,o)),a]}}const Gi=t=>typeof t=="boolean"?{lower:t,upper:t}:{lower:t?.lower??!0,upper:t?.upper??!0};class Ie{canvas;theme;constructor(e,n){this.canvas=e,this.theme=n}rule({direction:e,region:n,position:r,...s}){return e==="x"?this.line({start:i.K.construct(i.Ho.left(n),r),end:i.K.construct(i.Ho.right(n),r),...s}):this.line({start:i.K.construct(r,i.Ho.top(n)),end:i.K.construct(r,i.Ho.bottom(n)),...s})}line({stroke:e,lineWidth:n,lineDash:r,start:s,end:a}){const o=this.canvas;o.strokeStyle=i.ir.hex(e),o.lineWidth=n,o.setLineDash([r]),o.beginPath(),o.moveTo(...i.K.couple(s)),o.lineTo(...i.K.couple(a)),o.stroke()}circle({fill:e,radius:n,position:r}){const s=this.canvas;s.fillStyle=i.ir.hex(e),s.beginPath(),s.arc(...i.K.couple(r),n,0,2*Math.PI),s.fill()}resolveColor(e,n){return e==null?n==null?this.theme.colors.text:this.resolveColor(n):typeof e=="function"?e(this.theme):i.ir.construct(e)}border({region:e,color:n,width:r,radius:s,location:a}){const o=this.canvas;o.strokeStyle=i.ir.hex(this.resolveColor(n,this.theme.colors.border)),o.lineWidth=r??this.theme.sizes.border.width,s??=this.theme.sizes.border.radius,a==null||a===!0?s>0?(o.roundRect(...i.K.couple(i.Ho.topLeft(e)),...i.K.couple(i.Ho.dims(e)),s),o.stroke()):(o.rect(...i.K.couple(i.Ho.topLeft(e)),...i.K.couple(i.Ho.dims(e))),o.stroke()):p.t.toArray(a).forEach(l=>{const[u,c]=i.Ho.edgePoints(e,l);o.beginPath(),o.moveTo(...i.K.couple(u)),o.lineTo(...i.K.couple(c)),o.stroke()})}container({region:e,bordered:n=!0,rounded:r=!0,borderColor:s,borderRadius:a,borderWidth:o,backgroundColor:l}){a??=this.theme.sizes.border.radius,o??=1;const u=this.canvas;u.fillStyle=i.ir.hex(this.resolveColor(l,this.theme.colors.gray.l1)),u.strokeStyle=i.ir.hex(this.resolveColor(s,this.theme.colors.border)),u.setLineDash([]),u.lineWidth=1,u.beginPath(),r?u.roundRect(...i.K.couple(i.Ho.topLeft(e)),...i.K.couple(i.Ho.dims(e)),a):u.rect(...i.K.couple(i.Ho.topLeft(e)),...i.K.couple(i.Ho.dims(e))),u.fill(),n&&this.border({region:e,color:s,radius:a,width:o,location:n})}textContainer(e){const[n,r]=this.spacedTextDrawF(e);n.width+=12,n.height+=12;const{root:s=i.K$1.TOP_LEFT,offset:a=i.K.ZERO}=e,o={...e.position};s.x==="right"?o.x-=n.width+a.x:o.x+=a.x,s.y==="bottom"?o.y-=n.height+a.y:o.y+=a.y,this.container({region:i.Ho.construct(o,n.width,n.height),...e}),this.canvas.filter="none",r(i.K.translate(o,[6,6]))}spacedTextDrawF({text:e,direction:n,spacing:r=1,level:s="p"}){const a=Ke.fontString(this.theme,{level:s}),o=e.map(c=>p.dimensions(c,a,this.canvas)),l=this.theme.sizes.base*r,u=Math.max(...o.map(c=>c[i.g.dimension(n)]))+l;return[{[i.g.dimension(i.g.swap(n))]:Math.max(...o.map(c=>c[i.g.dimension(i.g.swap(n))])),[i.g.dimension(n)]:u*e.length-l},c=>{const h=Ke.fontString(this.theme,{level:s});this.canvas.font=h,this.canvas.fillStyle=i.ir.hex(this.theme.colors.text),this.canvas.textBaseline="top",e.forEach((f,m)=>{this.canvas.fillText(f,c.x,c.y+u*m)})}]}list({length:e,itemHeight:n,width:r,spacing:s=0,position:a,draw:o,root:l=i.K$1.TOP_LEFT,offset:u=i.K.ZERO,padding:c=i.K.ZERO}){const h=e*n+c.y*2+s*(e-1),f=r+c.x*2,m={...a};l.x==="right"?m.x-=r+u.x*2:m.x+=u.x,l.y==="top"?m.y-=h+u.y*2:m.y+=u.y,this.container({region:i.Ho.construct(m,{width:f,height:h}),backgroundColor:v=>v.colors.gray.l1});for(let v=0;v<e;v++){const w=i.Ho.construct(i.K.construct(m.x+c.x,m.y+v*n+c.y+s*v),r,n);o(v,w)}}drawTextInCenter({box:e,text:n,level:r}){const s=p.dimensions(n,this.canvas.font,this.canvas),a=i.Ho.positionInCenter(i.Ho.construct(i.K.ZERO,s),e);return this.text({text:n,position:i.Ho.topLeft(a),level:r})}text({text:e,position:n,level:r="p",weight:s,shade:a,maxWidth:o,code:l,justify:u="left",align:c="top",color:h}){this.canvas.font=Ke.fontString(this.theme,{level:r,weight:s,code:l}),h!=null?this.canvas.fillStyle=i.ir.hex(this.resolveColor(h)):a==null?this.canvas.fillStyle=i.ir.hex(this.theme.colors.text):this.canvas.fillStyle=i.ir.hex(this.theme.colors.gray[`l${a}`]),this.canvas.textAlign=u,this.canvas.textBaseline=c;let f;o!=null&&(f=this.canvas.scissor(i.Ho.construct(n,o,1e3))),this.canvas.fillText(e,n.x,n.y),f?.()}}const wr=d.z.object({position:d.z.number().optional(),pixelPosition:d.z.number().optional(),dragging:d.z.boolean(),lineWidth:d.z.number().optional().default(1),lineDash:d.z.number().optional().default(20),color:i.ir.colorZ}),xu=3;class Xe extends p.Leaf{static TYPE="Rule";schema=wr;lastUpdateRef=null;afterUpdate(e){this.internal.renderCtx=p.Context.use(e);const n=p.use(e);this.internal.draw=new Ie(this.internal.renderCtx.upper2d,n),X(e,"tool")}afterDelete(e){X(e,"tool")}updatePositions({decimalToDataScale:e,plot:n}){const r=this.state.dragging,s=this.prevState.dragging&&!r;if((r||s)&&this.state.pixelPosition!=null){if(this.lastUpdateRef??=this.state.pixelPosition,Math.abs(this.state.pixelPosition-this.lastUpdateRef)<xu&&!s)return this.state.pixelPosition;this.lastUpdateRef=this.state.pixelPosition;const l=e.pos(this.state.pixelPosition/i.Ho.height(n));return this.setState(u=>({...u,position:l})),this.state.pixelPosition}if(this.state.position==null){const o=e.pos(.5);this.setState(l=>({...l,position:o}))}const a=e.reverse().pos(this.state.position)*i.Ho.height(n);if(!isNaN(a)){if(this.state.pixelPosition!=null&&Math.abs(a-this.state.pixelPosition)<1)return this.state.pixelPosition;this.setState(o=>({...o,pixelPosition:a}))}return a}render(e){if(this.deleted)return;const{renderCtx:n}=this.internal,{location:r,plot:s}=e,a=i.K$1.direction(r),{upper2d:o}=n,l=this.internal.draw,u=this.updatePositions(e)+i.Ho.top(e.plot);l.rule({stroke:this.state.color,lineWidth:this.state.lineWidth,lineDash:this.state.lineDash,direction:a,region:s,position:u}),o.fillStyle=i.ir.hex(this.state.color),o.lineJoin="round",o.lineWidth=3.5,o.lineCap="round",o.beginPath();const c=4;if(r==="left"){const h=i.Ho.left(s)-1;o.moveTo(h,u),o.lineTo(h-c,u-c),o.lineTo(h-c,u+c)}else r==="right"&&(o.moveTo(i.Ho.right(s),u),o.lineTo(i.Ho.right(s)+c,u-c),o.lineTo(i.Ho.right(s)+c,u+c));o.closePath(),o.stroke()}}const Xi={[Xe.TYPE]:Xe},Su=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:Xi,Rule:Xe,ruleStateZ:wr},Symbol.toStringTag,{value:"Module"})),wu=lt.extend({location:i.K$1.x.optional().default("left")}),is=2,Tu=t=>i.Ho.signedWidth(t)<is||i.Ho.signedHeight(t)<is;class Bt extends Vi{static TYPE="YAxis";schema=lt;xBounds(){return i.W.max(this.lines.map(e=>e.xBounds()).filter(e=>i.W.isFinite(e)))}bounds(e){const[n,r]=this.iBounds(e,this.dataBounds.bind(this));if(r!=null)throw r;return n}render(e){if(this.deleted)return;const[n,r]=this.dataToDecimalScale(e.hold,this.dataBounds.bind(this),e.viewport),s=n.invert().reverse();if(this.renderAxis(e,s),this.renderLines(e,n),this.renderRules(e,s),r!=null)throw r}renderLines({xDataToDecimalScale:e,plot:n,canvases:r,exposure:s},a){if(!r.includes("gl")||Tu(n))return;const o={region:n,dataToDecimalScale:new i.C.XY(e,a),exposure:s};this.lines.forEach(l=>l.render(o))}renderRules({container:e,plot:n,canvases:r},s){if(!r.includes("upper2d"))return;const{location:a}=this.state,{render:o}=this.internal,l=i.Ho.construct(i.Ho.left(e),i.Ho.top(n),i.Ho.width(e),i.Ho.height(n)),u=o.scissor(l,i.K.ZERO,["upper2d"]),c={container:e,plot:n,decimalToDataScale:s,location:a};this.rules.map(h=>h.render(c)),u()}findByXValue({xDataToDecimalScale:e,plot:n,viewport:r,hold:s,exposure:a},o){const[l,u]=this.dataToDecimalScale(s,this.dataBounds.bind(this),r);if(u!=null)throw u;const c=new i.C.XY(e,l),h={region:n,dataToDecimalScale:c,exposure:a};return this.lines.map(f=>({...f.findByXValue(h,o),units:this.state.label}))}dataBounds(){return this.lines.map(e=>e.yBounds())}get lines(){return this.childrenOfType(Lt.TYPE)}get rules(){return this.childrenOfType(Xe.TYPE)}}const Qi=d.z.object({start:i.n.z,end:i.n.z});class Zn extends p.Leaf{static TYPE="range-annotation";schema=Qi;afterUpdate(e){this.internal.render=p.Context.use(e),this.internal.draw=new Ie(this.internal.render.upper2d,p.use(e))}}const Eu=p.Km.payloadZ.extend({viewport:i.W.bounds}),Ji=d.z.object({cursor:i.K.xy.or(d.z.null()),hovered:Eu.or(d.z.null()),count:d.z.number()});let Ut=class extends p.Leaf{static TYPE="range-provider";schema=Ji;fetchedInitial=i.w.ZERO;afterUpdate(e){const{internal:n}=this;n.render=p.Context.use(e),n.draw=new Ie(n.render.upper2d,p.use(e)),n.requestRender=Wt(e),n.runAsync=p.useErrorHandler(e),n.ranges??=new Map;const r=Ze(e);n.requestRender("tool"),r!=null&&(n.client=r,n.removeListener=Xu(e,[{channel:p.Km.SET_CHANNEL_NAME,onChange:fn(p.Km.payloadZ,async({changed:s})=>{n.client!=null&&(i.ir.isCrude(s.color)&&n.ranges.set(s.key,n.client.ranges.sugarOne(s)),this.setState(a=>({...a,count:n.ranges.size})),n.requestRender("tool"))})},{channel:p.Km.DELETE_CHANNEL_NAME,onChange:fn(p.Km.keyZ,async({changed:s})=>{n.ranges.delete(s),this.setState(a=>({...a,count:n.ranges.size})),n.requestRender("tool")})}],n.removeListener))}fetchInitial(e){const{internal:n}=this,{client:r,runAsync:s}=n;r==null||this.fetchedInitial.equals(e,i.a.minutes(1))||(this.fetchedInitial=e,s(async()=>{(await r.ranges.retrieve(e)).forEach(o=>{i.ir.isCrude(o.color)&&n.ranges.set(o.key,o)}),this.setState(o=>({...o,count:n.ranges.size}))},"failed to fetch initial ranges"))}render(e){const{dataToDecimalScale:n,region:r,viewport:s,timeRange:a}=e;this.fetchInitial(a);const{draw:o,ranges:l}=this.internal,u=n.scale(i.Ho.xBounds(r)),c=this.state.cursor==null?null:this.state.cursor.x;let h=null;const f=o.canvas.scissor(i.Ho.construct({x:i.Ho.left(r),y:i.Ho.top(r)-35},{x:i.Ho.right(r),y:i.Ho.bottom(r)}));l.forEach(m=>{const v=i.ir.colorZ.safeParse(m.color);if(!v.success)return;const w=v.data;let b=u.pos(Number(m.timeRange.start.valueOf()));const x=u.pos(Number(m.timeRange.end.valueOf()));if(x<i.Ho.left(r)||b>i.Ho.right(r))return;b=i.R(b,i.Ho.left(r)-2,i.Ho.right(r)-1);let k=!1;c!=null&&(k=i.W.contains({lower:b,upper:x},c)),k&&(h={key:m.key,parent:m.parent,name:m.name,color:m.color,labels:m.labels,timeRange:m.timeRange,viewport:{lower:n.scale(i.Ho.xBounds(s)).pos(Number(m.timeRange.start.valueOf())),upper:n.scale(i.Ho.xBounds(s)).pos(Number(m.timeRange.end.valueOf()))}}),o.container({region:i.Ho.construct({x:b,y:i.Ho.top(r)-1},{x,y:i.Ho.bottom(r)-1}),backgroundColor:i.ir.setAlpha(w,.2),bordered:!1});const M=i.Ho.construct({x:b+1,y:i.Ho.top(r)-34},{x:x-1,y:i.Ho.top(r)-12});o.container({region:M,backgroundColor:i.Ho.width(M)<20?i.ir.setAlpha(w,.4):R=>k?R.colors.gray.l2:R.colors.gray.l0,bordered:!0,borderWidth:1,borderRadius:2,borderColor:i.ir.setAlpha(w,.8)}),o.text({text:m.name,position:{x:b+8,y:i.Ho.top(r)-30},level:"small",shade:10,weight:500,maxWidth:x-b-16})}),f(),h!=null?this.setState(m=>({...m,hovered:h})):this.state.hovered&&this.setState(m=>({...m,hovered:null}))}};const Cu={[Zn.TYPE]:Zn,[Ut.TYPE]:Ut},Pu=lt;class $t extends Vi{static TYPE="XAxis";schema=lt;render(e){if(this.deleted)return;const[n,r]=this.dataToDecimalScale(e.hold,this.dataBounds.bind(this),e.viewport);if(this.renderAxis(e,n.reverse()),this.renderYAxes(e,n),this.renderRangeAnnotations(e,n),r!=null)throw r}findByXDecimal(e,n){const[r,s]=this.dataToDecimalScale(e.hold,this.dataBounds.bind(this),e.viewport);if(s!=null)throw s;return this.findByXValue(e,r.reverse().pos(n))}findByXValue(e,n){const[r,s]=this.dataToDecimalScale(e.hold,this.dataBounds.bind(this),e.viewport);if(s!=null)throw s;const a={...e,xDataToDecimalScale:r};return this.yAxes.map(o=>o.findByXValue(a,n)).flat()}renderYAxes(e,n){const r={...e,xDataToDecimalScale:n};this.yAxes.forEach(s=>s.render(r))}get yAxes(){return this.childrenOfType(Bt.TYPE)}get rangeAnnotations(){return this.childrenOfType(Ut.TYPE)}bounds(e){const[n,r]=this.iBounds(e,this.dataBounds.bind(this));if(r!=null)throw r;return n}renderRangeAnnotations(e,n){const r=this.bounds(e.hold);this.rangeAnnotations.forEach(s=>s.render({dataToDecimalScale:n,region:e.plot,viewport:e.viewport,timeRange:new i.w(r.lower,r.upper)}))}dataBounds(){return this.yAxes.map(e=>e.xBounds())}}const ku=i.K.construct(12),Ru=3,Mu=14,Lu=i.K.construct(6),Tr=d.z.object({position:i.K.xy.or(d.z.null()),textColor:i.ir.colorZ.optional().default(i.ir.ZERO),backgroundColor:i.ir.colorZ.optional().default(i.ir.ZERO),borderColor:i.ir.colorZ.optional().default(i.ir.ZERO),ruleColor:i.ir.colorZ.optional().default(i.ir.ZERO),ruleStrokeWidth:d.z.number().optional().default(1),ruleStrokeDash:d.z.number().default(0)});class Qe extends p.Leaf{static TYPE="tooltip";schema=Tr;afterUpdate(e){const n=p.use(e);i.ir.isZero(this.state.textColor)&&(this.state.textColor=n.colors.text),i.ir.isZero(this.state.backgroundColor)&&(this.state.backgroundColor=n.colors.gray.l1),i.ir.isZero(this.state.borderColor)&&(this.state.borderColor=n.colors.border),i.ir.isZero(this.state.ruleColor)&&(this.state.ruleColor=n.colors.gray.l7),this.internal.dotColor=n.colors.text,this.internal.dotColorContrast=n.colors.textInverted,this.internal.render=p.Context.use(e),this.internal.draw=new Ie(this.internal.render.upper2d,n),X(e,"tool")}afterDelete(e){X(e,"tool")}render(e){if(this.deleted||this.state.position==null)return;const{region:n}=e,r=i.C.XY.scale(i.Ho.DECIMAL).scale(n),s=i.C.XY.scale(n).scale(i.Ho.DECIMAL),a=e.findByXDecimal(s.x.pos(this.state.position.x)),o=a.filter(b=>i.K.isFinite(b.value)),{draw:l}=this.internal,u=o.reduce((b,x)=>b+x.position.x,0)/o.length,c=new i.n(o.reduce((b,x)=>b+x.value.x,0)/o.length),h=r.x.pos(u);if(!i.W.contains(i.Ho.xBounds(n),h))return;l.rule({stroke:this.state.ruleColor,lineWidth:this.state.ruleStrokeWidth,lineDash:this.state.ruleStrokeDash,direction:"y",region:n,position:h}),o.forEach(b=>{const x=r.pos(b.position);l.circle({fill:i.ir.setAlpha(b.color,.5),radius:8,position:x}),l.circle({fill:i.ir.setAlpha(b.color,.8),radius:5,position:x}),l.circle({fill:i.ir.pickByContrast(b.color,this.internal.dotColor,this.internal.dotColorContrast),radius:2,position:x})});const f=s.pos(this.state.position),m={...i.K$1.TOP_LEFT};f.x>.6&&(m.x="right"),f.y>.6&&(m.y="bottom");let v=a.reduce((b,x)=>Math.max(b,x.label?.length??0),0);const w=c.fString("preciseDate","local").length;w>v&&(v=w),l.list({root:m,offset:ku,length:o.length+1,padding:Lu,itemHeight:Mu,spacing:Ru,width:v*7+48,position:this.state.position,draw:(b,x)=>{let k="",M="",R=this.state.textColor;if(b===0)k="Time",M=c.fString("preciseDate","local");else{const O=o[b-1];k=O.label??"",M=i.nr.roundBySpan(O.value.y,O.bounds).toString(),R=O.color}l.text({position:i.Ho.topLeft(x),text:k,level:"small",weight:500,color:R}),l.text({position:i.K.translateY(i.Ho.topRight(x),-1),text:M,level:"small",justify:"right",code:!0,shade:10})}})}}const ea={[Qe.TYPE]:Qe},Ou=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:ea,Tooltip:Qe,tooltipStateZ:Tr},Symbol.toStringTag,{value:"Module"})),Er=d.z.object({one:i.K.xy.nullable(),two:i.K.xy.nullable(),hover:i.K.xy.nullable(),color:d.z.union([i.ir.colorZ,d.z.object({verticalLine:i.ir.colorZ.optional().default(i.ir.ZERO),horizontalLine:i.ir.colorZ.optional().default(i.ir.ZERO),obliqueLine:i.ir.colorZ.optional().default(i.ir.ZERO)})]).optional().default(i.ir.ZERO),strokeWidth:d.z.number().optional().default(1),strokeDash:d.z.number().optional().default(2)});class Je extends p.Leaf{static TYPE="measure";schema=Er;afterUpdate(e){const n=p.Context.use(e);this.internal.theme=p.use(e),this.internal.renderCtx=n,this.internal.draw=new Ie(n.upper2d,this.internal.theme),X(e,"tool")}afterDelete(e){X(e,"layout")}get verticalLineColor(){return i.ir.isColor(this.state.color)?i.ir.isZero(this.state.color)?this.internal.theme.colors.gray.l8:this.state.color:i.ir.isZero(this.state.color.verticalLine)?this.internal.theme.colors.gray.l8:this.state.color.verticalLine}get horizontalLineColor(){return i.ir.isColor(this.state.color)?i.ir.isZero(this.state.color)?this.internal.theme.colors.gray.l8:this.state.color:i.ir.isZero(this.state.color.horizontalLine)?this.internal.theme.colors.gray.l8:this.state.color.horizontalLine}get obliqueLineColor(){return i.ir.isColor(this.state.color)?i.ir.isZero(this.state.color)?this.internal.theme.colors.gray.l8:this.state.color:i.ir.isZero(this.state.color.obliqueLine)?this.internal.theme.colors.gray.l8:this.state.color.obliqueLine}find(e){const{one:n,two:r}=this.state;if(n==null||r==null)return null;const{one:s,two:a}=this.prevState,{dataOne:o,dataTwo:l}=this.internal;if(s!=null&&i.K.equals(n,s)&&a!=null&&i.K.equals(r,a)&&o!=null&&l!=null){const[b,x]=[e.findByXValue(o.x),e.findByXValue(l.x)];return b.length===0||x.length===0?null:[b.sort((k,M)=>i.K.distance(o,k.value)-i.K.distance(o,M.value))[0],x.sort((k,M)=>i.K.distance(l,k.value)-i.K.distance(l,M.value))[0]]}const u=i.C.XY.scale(e.region).scale(i.Ho.DECIMAL),[c,h]=[u.pos(n),u.pos(r)],[f,m]=[e.findByXDecimal(c.x),e.findByXDecimal(h.x)];if(f.length===0||m.length===0)return null;const[v,w]=[f.sort((b,x)=>i.K.distance(c,b.position)-i.K.distance(c,x.position))[0],m.sort((b,x)=>i.K.distance(h,b.position)-i.K.distance(h,x.position))[0]];return this.internal.dataOne=v.value,this.internal.dataTwo=w.value,[v,w]}renderHover(e){if(this.state.hover==null)return;const n=this.state.hover,r=i.C.XY.scale(e.region).scale(i.Ho.DECIMAL),s=r.pos(n),a=e.findByXDecimal(r.pos(n).x);if(a.length===0)return;const o=a.sort((u,c)=>i.K.distance(s,u.position)-i.K.distance(s,c.position))[0],{draw:l}=this.internal;l.circle({fill:i.ir.setAlpha(o.color,.5),radius:9,position:r.reverse().pos(o.position)})}render(e){if(this.deleted)return;this.renderHover(e);const n=this.find(e);if(n==null)return;const[r,s]=n,{draw:a}=this.internal,{strokeDash:o,strokeWidth:l}=this.state,u=i.C.XY.scale(i.Ho.DECIMAL).scale(e.region),c=u.pos(r.position),h=u.pos(s.position),f=new i.a(Math.abs(r.value.x-s.value.x)),m=Math.abs(r.value.y-s.value.y),v=m/f.seconds;a.line({start:i.K.construct(c.x,c.y),end:i.K.construct(c.x,h.y),stroke:this.verticalLineColor,lineDash:o,lineWidth:l}),a.textContainer({text:[`${m.toFixed(2)} ${r.units??""}`],direction:"x",position:i.K.construct(c.x,(c.y+h.y)/2),level:"small"}),a.line({start:i.K.construct(c.x,h.y),end:i.K.construct(h.x,h.y),stroke:this.horizontalLineColor,lineDash:o,lineWidth:l}),a.textContainer({text:[f.truncate(i.a.MILLISECOND).toString()],direction:"x",position:i.K.construct((c.x+h.x)/2,h.y),level:"small"}),a.line({start:i.K.construct(c.x,c.y),end:i.K.construct(h.x,h.y),stroke:this.obliqueLineColor,lineDash:o,lineWidth:l}),a.textContainer({text:[`${v.toFixed(2)} ${r.units??""} / S`],direction:"x",position:i.K.construct((c.x+h.x)/2,(c.y+h.y)/2),level:"small"}),a.circle({fill:i.ir.setAlpha(r.color,.5),radius:8,position:c}),a.circle({fill:i.ir.setAlpha(r.color,.8),radius:5,position:c}),a.circle({fill:i.ir.WHITE,radius:2,position:c}),a.circle({fill:i.ir.setAlpha(s.color,.5),radius:8,position:h}),a.circle({fill:i.ir.setAlpha(s.color,.8),radius:5,position:h}),a.circle({fill:i.ir.WHITE,radius:2,position:h})}}const ta={[Je.TYPE]:Je},Du=Object.freeze(Object.defineProperty({__proto__:null,Measure:Je,REGISTRY:ta,measureStateZ:Er},Symbol.toStringTag,{value:"Module"})),na=d.z.object({container:i.Ho.box,viewport:i.Ho.box,hold:d.z.boolean().optional().default(!1),grid:d.z.record(d.z.string(),Ei),visible:d.z.boolean().optional().default(!0),clearOverScan:i.K.crudeZ.optional().default(i.K.ZERO)}),Yu=(t,e)=>{const n=i.Ho.width(t)*Math.sqrt(i.Ho.height(t)),r=i.Ho.width(e)*Math.sqrt(i.Ho.height(e));return n/r},_u=["upper2d","lower2d","gl"],zu=["upper2d"];class In extends p.Composite{static TYPE="LinePlot";schema=na;afterUpdate(e){this.internal.instrumentation=p.useInstrumentation(e,"lineplot"),this.internal.handleError=p.useErrorHandler(e),this.internal.renderCtx=p.Context.use(e),Ft(e,n=>{this.state.visible&&this.requestRender("low",n)}),!(!this.state.visible&&!this.prevState.visible)&&this.requestRender("high","layout")}afterDelete(e){this.internal.renderCtx=p.Context.use(e),this.requestRender("high","layout")}findByXDecimal(e){const n={...this.state,plot:this.calculatePlot(),exposure:this.exposure};return this.axes.flatMap(r=>r.findByXDecimal(n,e)).flat()}findByXValue(e){const n={...this.state,plot:this.calculatePlot(),exposure:this.exposure};return this.axes.flatMap(r=>r.findByXValue(n,e)).flat()}get axes(){return this.childrenOfType($t.TYPE)}get tooltips(){return this.childrenOfType(Qe.TYPE)}get measures(){return this.childrenOfType(Je.TYPE)}get bounds(){return this.childrenOfType(Dt.TYPE)}get exposure(){return Yu(this.state.viewport,this.state.container)}renderAxes(e,n){const r={...this.state,plot:e,canvases:n,exposure:this.exposure};this.axes.forEach(s=>s.render(r))}renderTooltips(e,n){const r={findByXDecimal:this.findByXDecimal.bind(this),region:e,canvases:n};this.tooltips.forEach(s=>s.render(r))}renderBounds(){this.bounds.forEach(e=>e.render({getBounds:()=>{const n={};return this.axes.forEach(r=>{const s=r.state.axisKey??r.key;n[s]=r.bounds(this.state.hold),r.yAxes.forEach(a=>{const o=a.state.axisKey??a.key;n[o]=a.bounds(this.state.hold)})}),n}}))}renderMeasures(e){const n={findByXDecimal:this.findByXDecimal.bind(this),findByXValue:this.findByXValue.bind(this),region:e};this.measures.forEach(r=>r.render(n))}calculatePlot(){return Uo(this.state.grid,this.state.container)}render(e){const{instrumentation:n,renderCtx:r,handleError:s}=this.internal;if(this.deleted){n.L.debug("deleted, skipping render",{key:this.key});return}if(!this.state.visible)return n.L.debug("not visible, skipping render",{key:this.key}),({canvases:h})=>r.erase(this.state.container,this.state.clearOverScan,...h);const a=this.calculatePlot();n.L.debug("rendering",{key:this.key,viewport:this.state.viewport,container:this.state.container,grid:this.state.grid,plot:a,canvases:e});const o=i.K.construct(this.state.clearOverScan),l=r.scissor(this.state.container,o,e.filter(h=>h!=="gl")),u=r.scissor(a,i.K.ZERO,e.filter(h=>h==="gl"));try{this.renderAxes(a,e),this.renderTooltips(a,e),this.renderMeasures(a),this.renderBounds()}catch(h){s(h,"failed to render line plot")}finally{l(),u()}n.L.debug("rendered",{key:this.key});const c=i.Ho.copy(this.state.container);return({canvases:h})=>r.erase(c,this.state.clearOverScan,...h)}requestRender(e,n){const{renderCtx:r}=this.internal;let s=_u;n==="tool"&&(s=zu),r.loop.set({key:`${this.type}-${this.key}`,render:()=>this.render(s),priority:e,canvases:s})}}const Au={[In.TYPE]:In,[$t.TYPE]:$t,[Bt.TYPE]:Bt,[Dt.TYPE]:Dt},ra=d.z.object({region:i.Ho.box,wheelPos:d.z.number(),scrolling:d.z.boolean(),empty:d.z.boolean(),visible:d.z.boolean(),telem:gt.optional().default(ps),font:p.levelZ.optional().default("p"),color:i.ir.colorZ.optional().default(i.ir.ZERO),overshoot:i.K.xy.optional().default({x:0,y:0})}),Zu=.98,$e="lower2d",Iu={offset:0n,offsetRef:0n,scrollRef:0};class et extends p.Leaf{static TYPE="log";static z=ra;schema=et.z;values=new i.Vt([]);scrollState=Iu;afterUpdate(e){const{internal:n}=this;n.render=p.Context.use(e),n.theme=p.use(e),i.ir.isZero(this.state.color)?this.internal.textColor=n.theme.colors.gray.l11:n.textColor=this.state.color,n.telem=K(e,this.state.telem,n.telem);const{scrolling:r,wheelPos:s}=this.state;if(this.state.scrolling&&!this.prevState.scrolling){const u=this.values.alignmentBounds.upper-1n;this.scrollState={offset:u,offsetRef:u,scrollRef:this.state.wheelPos}}else if(r){const{scrollState:u,values:c}=this,h=Math.ceil((s-this.scrollState.scrollRef)/this.lineHeight);u.offset=this.values.traverseAlignment(u.offsetRef,-BigInt(h)),u.offset<c.alignmentBounds.lower+BigInt(this.visibleLineCount)&&(u.offset=c.alignmentBounds.lower,this.setState(f=>({...f,wheelPos:this.prevState.wheelPos}))),u.offset>=c.alignmentBounds.upper&&this.setState(f=>({...f,scrolling:!1}))}const[o,l]=this.internal.telem.value();this.values=l,this.checkEmpty(),n.stopListeningTelem?.(),n.stopListeningTelem=n.telem.onChange(()=>{const[u,c]=this.internal.telem.value();this.checkEmpty(),this.values=c,this.requestRender()}),!(!this.state.visible&&!this.prevState.visible)&&this.requestRender()}checkEmpty(){const e=this.values.length===0;e!==this.state.empty&&this.setState(n=>({...n,empty:e}))}afterDelete(){const{telem:e,render:n}=this.internal;e.cleanup?.(),n.erase(i.Ho.construct(this.state.region),i.K.ZERO,$e)}requestRender(){const{render:e}=this.internal;e.loop.set({key:`${this.type}-${this.key}`,render:()=>this.render(),priority:"high",canvases:[$e]})}get lineHeight(){return this.internal.theme.typography[this.state.font].size*this.internal.theme.sizes.base}get totalHeight(){return Math.ceil(this.values.length*this.lineHeight)}get visibleLineCount(){return Math.min(Math.floor((i.Ho.height(this.state.region)-12)/this.lineHeight),this.values.length)}render(){const{render:e}=this.internal,n=this.state.region;if(i.Ho.areaIsZero(n))return;if(!this.state.visible)return()=>e.erase(n,i.K.ZERO,$e);let r;if(!this.state.scrolling)r=this.values.subIterator(this.values.length-this.visibleLineCount,this.values.length);else{const c=this.values.traverseAlignment(this.scrollState.offset,-BigInt(this.visibleLineCount));r=this.values.subAlignmentSpanIterator(c,this.visibleLineCount)}const s=this.state.region,a=e[$e],o=new Ie(a,this.internal.theme),l=e.scissor(s,i.K.ZERO,[$e]);this.renderElements(o,r),this.renderScrollbar(o),l();const u=i.Ho.copy(this.state.region);return({canvases:c})=>e.erase(u,this.state.overshoot,...c)}renderScrollbar(e){const n=this.state.region,r=i.Ho.height(n)/this.totalHeight*i.Ho.height(n);if(r>=i.Ho.height(n)*Zu)return;let s=i.Ho.bottom(n)-r;this.state.scrolling&&(s-=Number(this.values.distance(this.values.alignmentBounds.upper,this.scrollState.offset))/this.values.length*i.Ho.height(n)),s<0&&(s=i.Ho.top(n)),e.container({region:i.Ho.construct({x:i.Ho.right(n)-6,y:s},{width:6,height:r}),bordered:!1,backgroundColor:a=>a.colors.gray.l6})}renderElements(e,n){const r=this.state.region;let s=0;for(const a of n){const o=this.values.dataType.equals(i.r.JSON)?JSON.stringify(a):a.toString();e.text({text:o,level:this.state.font,shade:11,position:i.K.translate(i.Ho.topLeft(r),{x:6,y:s*this.lineHeight+6}),code:!0}),s++}}}const Hu={[et.TYPE]:et},sa=d.z.object({trigger:d.z.number(),command:d.z.number().optional(),value:d.z.number(),sink:bs.optional().default(hs),source:vs.optional().default(ds)});class Hn extends p.Leaf{static TYPE="Setpoint";schema=sa;afterUpdate(e){const{sink:n,source:r,trigger:s,command:a}=this.state,{internal:o}=this;o.prevTrigger??=s,(async()=>{this.internal.source=K(e,r,this.internal.source),o.sink=st(e,n,o.sink);const l=o.prevTrigger;o.prevTrigger=s,s>l&&a!=null&&this.internal.sink.set(a),this.updateValue(),o.stopListening?.(),o.stopListening=o.source.onChange(()=>this.updateValue())})()}updateValue(){const e=this.internal.source.value();e!==this.state.value&&this.setState(n=>({...n,value:e,triggered:!1}))}afterDelete(){const{internal:e}=this;e.stopListening(),e.source.cleanup?.(),e.sink.cleanup?.()}}const Nu={[Hn.TYPE]:Hn},ia=d.z.object({triggered:d.z.boolean(),enabled:d.z.boolean(),sink:Xt.optional().default(jt),source:Fn.optional().default(Kn)});class Nn extends p.Leaf{static TYPE="Toggle";schema=ia;afterUpdate(e){this.internal.addStatus=p.useOptionalAdder(e);const{sink:n,source:r,triggered:s,enabled:a}=this.state,{triggered:o}=this.prevState,{internal:l}=this;l.source=K(e,r,l.source),l.sink=st(e,n,l.sink),s&&!o&&l.sink.set(!a),this.updateEnabledState(),l.stopListening?.(),l.stopListening=l.source.onChange(()=>this.updateEnabledState())}updateEnabledState(){const e=this.internal.source.value();e!==this.state.enabled&&this.setState(n=>({...n,enabled:e,triggered:!1}))}afterDelete(){this.internal.stopListening(),this.internal.source.cleanup?.(),this.internal.sink.cleanup?.()}}const Bu={[Nn.TYPE]:Nn},dn={useAtlas:!0},Uu=d.z.object({box:i.Ho.box,telem:Vn.optional().default(fs),backgroundTelem:Wn.optional().default(Vt),level:p.levelZ.optional().default("p"),color:i.ir.colorZ.optional().default(i.ir.ZERO),precision:d.z.number().optional().default(2),minWidth:d.z.number().optional().default(60),width:d.z.number().optional(),notation:i.mr.notationZ.optional().default("standard"),location:i.K$1.xy.optional().default({x:"left",y:"center"}),useWidthForBackground:d.z.boolean().optional().default(!1),valueBackgroundShift:i.K.xy.optional().default(i.K.ZERO),valueBackgroundOverScan:i.K.xy.optional().default(i.K.ZERO)}),$u=["upper2d","lower2d"];class Ae extends p.Leaf{static TYPE="value";static z=Uu;schema=Ae.z;afterUpdate(e){const{internal:n}=this;n.renderCtx=p.Context.use(e),n.theme=p.use(e),i.ir.isZero(this.state.color)?n.textColor=n.theme.colors.gray.l10:n.textColor=this.state.color,n.telem=K(e,this.state.telem,n.telem),n.stopListening?.(),n.stopListening=n.telem.onChange(()=>this.requestRender()),n.fontString=Ke.fontString(n.theme,{level:this.state.level,code:!0}),n.backgroundTelem=K(e,this.state.backgroundTelem,n.backgroundTelem),n.stopListeningBackground?.(),n.stopListeningBackground=n.backgroundTelem.onChange(()=>this.requestRender()),n.requestRender=as(e),this.requestRender()}afterDelete(){const{internal:e}=this;e.stopListening?.(),e.stopListeningBackground?.(),e.telem.cleanup?.(),e.backgroundTelem.cleanup?.(),e.requestRender==null?e.renderCtx.erase(i.Ho.construct(this.state.box),i.K.ZERO,...$u):e.requestRender("layout")}requestRender(){const{requestRender:e}=this.internal;e!=null?e("layout"):this.render({})}get fontHeight(){const{theme:e}=this.internal;return e.typography[this.state.level].size*e.sizes.base}maybeUpdateWidth(e){const{theme:n}=this.internal,r=e+n.sizes.base+this.fontHeight;this.state.width==null||this.state.width+this.fontHeight*.5<r||this.state.minWidth>r&&this.state.width!==this.state.minWidth?this.setState(s=>({...s,width:Math.max(r,s.minWidth)})):this.state.width-this.fontHeight>r&&this.setState(s=>({...s,width:Math.max(r,s.minWidth)}))}render({viewportScale:e=i.C.XY.IDENTITY}){const{renderCtx:n,telem:r,backgroundTelem:s,fontString:a,requestRender:o}=this.internal,{location:l,box:u}=this.state;if(i.Ho.areaIsZero(u))return;const c=i.Ho.topLeft(u),h=i.Ho.width(u),f=i.Ho.height(u),m=n.lower2d.applyScale(e);let v=r.value();m.font=a;const w=this.fontHeight,b=v[0]=="-";b&&(v=v.slice(1));const{theme:x}=this.internal,k=m.textDimensions(v,dn),M=k.width+x.sizes.base,R=k.height;o==null&&n.erase(i.Ho.construct(this.prevState.box)),this.maybeUpdateWidth(M);const O={...i.K.ZERO};l.x==="left"?O.x=6+w*.75:l.x==="center"&&(O.x=h/2-M/2),l.y==="center"&&(O.y=f/2+R/2);const Y=i.K.translate(c,O);let S=!0;if(this.state.backgroundTelem.type!=Vt.type){const D=s.value();if(!i.ir.isZero(D)){S=!1,m.fillStyle=i.ir.hex(D);const He=this.state.useWidthForBackground?this.state.width??this.state.minWidth:i.Ho.width(u);m.fillRect(...i.K.couple(i.K.translate(c,this.state.valueBackgroundShift)),He+this.state.valueBackgroundOverScan.x,f+this.state.valueBackgroundOverScan.y);const pe=i.ir.pickByContrast(D,x.colors.gray.l0,x.colors.gray.l11);m.fillStyle=i.ir.hex(pe)}}S&&(m.fillStyle=i.ir.hex(this.internal.textColor)),b&&m.fillText("-",...i.K.couple(i.K.translateX(Y,-w*.6)),void 0,dn),m.fillText(v,...i.K.couple(Y),void 0,dn)}}const aa={[Ae.TYPE]:Ae},Ku=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:aa,Value:Ae},Symbol.toStringTag,{value:"Module"})),qu=(t,e)=>{const n=t.includes("delete"),r=e.includes("delete");return n&&!r?-1:!n&&r?1:0};class oa{handlers=new Map;streamerMutex=i.wr.newMutex({streamer:null});handleError;debouncedRemoveHandler;openStreamer=null;constructor({handleError:e,removalDelay:n=0}){this.handleError=e,this.debouncedRemoveHandler=p.o(r=>{this.handleError(this.updateStreamer.bind(this),`Failed to remove ${r} from the Sync.Provider streamer`)},i.a.fromMilliseconds(n).milliseconds)}handleChange(e){const n=[...e.uniqueNames];n.sort(qu),n.forEach(r=>{this.handlers.forEach((s,a)=>{if(s===r)try{a(e)}catch(o){this.handleError(o,`Error calling Sync Frame Handler on channel(s): ${s}`)}})})}async close(){return await this.streamerMutex.runExclusive(this.unprotectedClose.bind(this))}async unprotectedClose(){const e=this.streamerMutex.streamer;this.streamerMutex.streamer=null,e!=null&&await e.close(),this.handlers.clear(),this.openStreamer=null}async updateStreamer(e){await this.streamerMutex.runExclusive(async()=>{if(e!=null&&(this.openStreamer=e),this.openStreamer==null)return;const n=new Set(this.handlers.values()),r=this.streamerMutex.streamer;if(r!=null)return n.size===0?await this.unprotectedClose():await r.update(Array.from(n));if(n.size===0)return;const s=await p.Zm.HardenedStreamer.open(this.openStreamer,Array.from(n));this.streamerMutex.streamer=new p.Zm.ObservableStreamer(s),this.streamerMutex.streamer.onChange(this.handleChange.bind(this))})}addListener(e,n,r){const s=new Set(this.handlers.values());return this.handlers.set(e,n),s.has(n)||this.handleError(async()=>{await this.updateStreamer(),r?.()},`Failed to add ${n} to the Sync.Provider streamer`),()=>{this.handlers.delete(e),this.debouncedRemoveHandler(n)}}}const la=d.object({}),Fu={addListener:null},Kt="flux-context",Wu=(t,e)=>t.set(Kt,e);class tt extends p.Composite{static TYPE="flux.Provider";static stateZ=la;schema=tt.stateZ;afterUpdate(e){const{internal:n}=this;e.wasSetPreviously(Kt)||Wu(e,Fu);const r=Ze(e),s=p.useErrorHandler(e);if(n.streamer??=new oa({handleError:s}),r==null)return;s(async()=>await n.streamer.updateStreamer(r.openStreamer.bind(r)),"Failed to update Flux.Provider streamer");const a={addListener:({channel:o,handler:l,onOpen:u})=>n.streamer.addListener(l,o,u)};e.set(Kt,a)}}const ju={[tt.TYPE]:tt},Vu=()=>()=>{},Gu=t=>t.get(Kt).addListener??Vu,ca=(t,e,n)=>{const r=p.t.toArray(n).map(({channel:s,onChange:a})=>t({channel:s,handler:o=>{e(async()=>await a({changed:o.get(s)}),`Error in Flux.useListener on channel ${s}`)}}));return()=>r.forEach(s=>s())},Xu=(t,e,n)=>{if(n!=null)return n;const r=Gu(t),s=p.useErrorHandler(t);return ca(r,s,e)};exports.AcquireChannelControl=Rt;exports.Annotation=Zn;exports.AuthoritySource=Mt;exports.Base=fe;exports.BaseProvider=Oe;exports.Bottom=Ki;exports.BoundQuerier=Dt;exports.Button=kn;exports.Canvas=Ot;exports.Chip=Tn;exports.Controller=En;exports.Diagram=Io;exports.Diagram$1=le;exports.Indicator=Cn;exports.Legend=Pn;exports.Light=Rn;exports.Line=Lt;exports.LinePlot=In;exports.Log=et;exports.MODES=mi;exports.MOUSE_DOWN_INCREMENT=yi;exports.MOUSE_UP_INCREMENT=vi;exports.Measure=Je;exports.Mutex=ls;exports.Provider=mt;exports.Provider$1=tt;exports.Provider$2=Ut;exports.REGISTRY=Au;exports.REGISTRY$1=ju;exports.REGISTRY$10=Xi;exports.REGISTRY$11=Cu;exports.REGISTRY$12=ta;exports.REGISTRY$13=Yo;exports.REGISTRY$14=Ho;exports.REGISTRY$15=Si;exports.REGISTRY$16=bo;exports.REGISTRY$17=xi;exports.REGISTRY$18=So;exports.REGISTRY$2=La;exports.REGISTRY$3=Hu;exports.REGISTRY$4=aa;exports.REGISTRY$5=ea;exports.REGISTRY$6=Bu;exports.REGISTRY$7=ti;exports.REGISTRY$8=us;exports.REGISTRY$9=Nu;exports.Right=Fi;exports.Rule=Xe;exports.STATUSES=ai;exports.SetChannelValue=kt;exports.Setpoint=Hn;exports.StateProvider=Fe;exports.Streamer=oa;exports.Table=Te;exports.Toggle=Nn;exports.Tooltip=Qe;exports.Top=qi;exports.Value=Ae;exports.XAxis=$t;exports.YAxis=Bt;exports.ZERO_CONTEXT_VALUE=Un;exports.a=qt;exports.acquireChannelControl=go;exports.acquireChannelControlPropsZ=ui;exports.aether=Su;exports.annotationStateZ=Qi;exports.authoritySource=vo;exports.authoritySourceDetailsZ=yo;exports.authoritySourceProps=hi;exports.axisStateZ=Sr;exports.boundQuerierStateZ=Ti;exports.buttonStateZ=gi;exports.canvas=Zo;exports.canvasStateZ=lr;exports.channelData=Ps;exports.chipStateZ=ri;exports.chipStatusDetailsZ=ni;exports.color=De;exports.colorGradient=Us;exports.control=Ft;exports.controllerStateZ=li;exports.coreAxisStateZ=lt;exports.diagramStateZ=cr;exports.external=po;exports.indicatorStateZ=fi;exports.indicatorStatusDetailsZ=di;exports.interpolate=tn;exports.interpolateNumber=Ve;exports.interpolateRgb=Dn;exports.interpolateString=Mi;exports.legendStateZ=pi;exports.lightStateZ=wi;exports.linePlotStateZ=na;exports.logState=ra;exports.measure=Du;exports.measureStateZ=Er;exports.mountListeners=ca;exports.newCanvas=$i;exports.newTickFactory=zn;exports.parseAutoBounds=Gi;exports.parsedHandler=fn;exports.provider=Ra;exports.providerStateZ=la;exports.providerStateZ$1=Ji;exports.providerStateZ$2=or;exports.regions=ie;exports.request=X;exports.rollingAverage=Ns;exports.rollingAverageProps=sr;exports.ruleStateZ=wr;exports.scaleNumber=Ks;exports.setChannelValue=mo;exports.setChannelValuePropsZ=ci;exports.setpoint=zs;exports.setpointStateZ=sa;exports.sinkPipeline=Ts;exports.sinkPipelinePropsZ=Jn;exports.sourcePipeline=ws;exports.sourcePipelinePropsZ=Xn;exports.stateProviderStateZ=si;exports.stateZ=bi;exports.statusZ=oi;exports.streamChannelData=ks;exports.streamChannelValue=Rs;exports.streamChannelValuePropsZ=er;exports.stringHandler=Sa;exports.stringSourceSpecZ=Vn;exports.stringifyNumber=Hs;exports.stringifyNumberProps=rr;exports.sugaredStateZ=ii;exports.tickFactoryProps=xr;exports.tickType=br;exports.toggleStateZ=ia;exports.tooltip=Ou;exports.tooltipStateZ=Tr;exports.useOptionalRequestor=as;exports.useRequestor=Wt;exports.value=Ku;exports.withinBounds=As;exports.withinBoundsProps=nr;exports.withinSizeThreshold=Wi;exports.xAxisStateZ=Pu;exports.yAxisStateZ=wu;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { channel, ranger } from '@synnaxlabs/client';
|
|
2
|
-
export interface Aliases extends Record<channel.Key, string> {
|
|
3
|
-
}
|
|
4
|
-
export interface AliasSetter {
|
|
5
|
-
(key: channel.Key, alias: string): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export interface AliasContextValue {
|
|
8
|
-
activeRange?: ranger.Key | string | null;
|
|
9
|
-
aliases: Aliases;
|
|
10
|
-
getName: (key: channel.Key) => Promise<string | undefined>;
|
|
11
|
-
setAlias: AliasSetter | null;
|
|
12
|
-
}
|
|
13
|
-
export declare const Context: import('react').Context<AliasContextValue | undefined>;
|
|
14
|
-
export declare const useActiveRange: () => ranger.Key | string | null | undefined;
|
|
15
|
-
export declare const useAlias: (key: channel.Key) => string | null;
|
|
16
|
-
export declare const useAliases: () => Aliases;
|
|
17
|
-
export declare const useName: (key: channel.Key, defaultName?: string) => [string, (newName: string) => void];
|
|
18
|
-
export declare const useAliasSetter: () => AliasSetter | null;
|
|
19
|
-
//# sourceMappingURL=AliasContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AliasContext.d.ts","sourceRoot":"","sources":["../../../src/channel/AliasContext.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAA+B,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAQvF,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC;CAAG;AAE/D,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC,GAAG,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC3D,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,OAAO,wDAA0D,CAAC;AAQ/E,eAAO,MAAM,cAAc,QAAO,MAAM,CAAC,GAAG,GAAG,MAAM,GAAG,IAAI,GAAG,SACrC,CAAC;AAE3B,eAAO,MAAM,QAAQ,GAAI,KAAK,OAAO,CAAC,GAAG,KAAG,MAAM,GAAG,IAClB,CAAC;AAEpC,eAAO,MAAM,UAAU,QAAO,OAA+B,CAAC;AAE9D,eAAO,MAAM,OAAO,GAClB,KAAK,OAAO,CAAC,GAAG,EAChB,cAAa,MAAW,KACvB,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CA+CpC,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,WAAW,GAAG,IAA6B,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
-
export interface AliasProviderProps extends PropsWithChildren {
|
|
3
|
-
activeRange?: string | null;
|
|
4
|
-
}
|
|
5
|
-
export declare const AliasProvider: ({ activeRange, ...rest }: AliasProviderProps) => ReactElement;
|
|
6
|
-
//# sourceMappingURL=AliasProvider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AliasProvider.d.ts","sourceRoot":"","sources":["../../../src/channel/AliasProvider.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAIlB,MAAM,OAAO,CAAC;AASf,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,aAAa,GAAI,0BAG3B,kBAAkB,KAAG,YAyEvB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../../src/flux/Context.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,eAAO,MAAM,OAAO,+CAA4C,CAAC;AAEjE,eAAO,MAAM,cAAc,QAAO,aAA4C,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { channel } from '@synnaxlabs/client';
|
|
2
|
-
import { MultiSeries } from '@synnaxlabs/x';
|
|
3
|
-
import { default as z } from 'zod';
|
|
4
|
-
export interface ListenerSpec<Value, Extra> {
|
|
5
|
-
channel: channel.Name;
|
|
6
|
-
onChange: ListenerHandler<Value, Extra>;
|
|
7
|
-
}
|
|
8
|
-
export type ListenerArgs<Value, Extra> = {
|
|
9
|
-
changed: Value;
|
|
10
|
-
} & Extra;
|
|
11
|
-
export interface ListenerHandler<Value, Extra> {
|
|
12
|
-
(args: ListenerArgs<Value, Extra>): Promise<unknown> | unknown;
|
|
13
|
-
}
|
|
14
|
-
export declare const parsedHandler: <Z extends z.ZodType, Extra>(schema: Z, onChange: ListenerHandler<z.output<Z>, Extra>) => ListenerHandler<MultiSeries, Extra>;
|
|
15
|
-
export declare const stringHandler: <Extra>(onChange: ListenerHandler<string, Extra>) => ListenerHandler<MultiSeries, Extra>;
|
|
16
|
-
//# sourceMappingURL=listeners.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"listeners.d.ts","sourceRoot":"","sources":["../../../../src/flux/aether/listeners.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,MAAM,WAAW,YAAY,CAAC,KAAK,EAAE,KAAK;IACxC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC;IACtB,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;CACzC;AAED,MAAM,MAAM,YAAY,CAAC,KAAK,EAAE,KAAK,IAAI;IACvC,OAAO,EAAE,KAAK,CAAC;CAChB,GAAG,KAAK,CAAC;AAEV,MAAM,WAAW,eAAe,CAAC,KAAK,EAAE,KAAK;IAC3C,CAAC,IAAI,EAAE,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CAChE;AAED,eAAO,MAAM,aAAa,GACvB,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,KAAK,EACzB,QAAQ,CAAC,EACT,UAAU,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,KAC5C,eAAe,CAAC,WAAW,EAAE,KAAK,CAOpC,CAAC;AAEJ,eAAO,MAAM,aAAa,GACvB,KAAK,EACJ,UAAU,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,KACvC,eAAe,CAAC,WAAW,EAAE,KAAK,CAIpC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../../../src/flux/aether/params.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,2CAA2C;AAC3C,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { channel, framer } from '@synnaxlabs/client';
|
|
2
|
-
import { CrudeTimeSpan } from '@synnaxlabs/x';
|
|
3
|
-
import { FrameHandler } from './types';
|
|
4
|
-
import { Status } from '../../status';
|
|
5
|
-
export interface StreamerArgs {
|
|
6
|
-
handleError: Status.ErrorHandler;
|
|
7
|
-
removalDelay?: CrudeTimeSpan;
|
|
8
|
-
}
|
|
9
|
-
export declare class Streamer {
|
|
10
|
-
private readonly handlers;
|
|
11
|
-
private readonly streamerMutex;
|
|
12
|
-
private readonly handleError;
|
|
13
|
-
private readonly debouncedRemoveHandler;
|
|
14
|
-
private openStreamer;
|
|
15
|
-
constructor({ handleError, removalDelay }: StreamerArgs);
|
|
16
|
-
private handleChange;
|
|
17
|
-
close(): Promise<void>;
|
|
18
|
-
private unprotectedClose;
|
|
19
|
-
updateStreamer(streamOpener?: framer.StreamOpener): Promise<void>;
|
|
20
|
-
addListener(handler: FrameHandler, channel: channel.Name, onOpen?: () => void): () => void;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=streamer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streamer.d.ts","sourceRoot":"","sources":["../../../../src/flux/aether/streamer.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,KAAK,aAAa,EAA4B,MAAM,eAAe,CAAC;AAE7E,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAiBvC,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC,YAAY,CAAC;IACjC,YAAY,CAAC,EAAE,aAAa,CAAC;CAC9B;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8C;IACvE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAE3B;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAsB;IAClD,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAkC;IACzE,OAAO,CAAC,YAAY,CAAoC;gBAE5C,EAAE,WAAW,EAAE,YAAgB,EAAE,EAAE,YAAY;IAU3D,OAAO,CAAC,YAAY;IAkBd,KAAK;YAIG,gBAAgB;IAQxB,cAAc,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBvE,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,IAAI;CAa9E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streamer.spec.d.ts","sourceRoot":"","sources":["../../../../src/flux/aether/streamer.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { channel, framer } from '@synnaxlabs/client';
|
|
2
|
-
import { Destructor, observe } from '@synnaxlabs/x';
|
|
3
|
-
export interface FrameHandler extends observe.Handler<framer.Frame> {
|
|
4
|
-
}
|
|
5
|
-
export interface Subscriber {
|
|
6
|
-
channel: channel.Name;
|
|
7
|
-
handler: FrameHandler;
|
|
8
|
-
onOpen?: () => void;
|
|
9
|
-
}
|
|
10
|
-
export interface ListenerAdder {
|
|
11
|
-
(subscriber: Subscriber): Destructor;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/flux/aether/types.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;CAAG;AAEtE,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC;IACtB,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"listeners.d.ts","sourceRoot":"","sources":["../../../src/flux/listeners.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAIrC,eAAO,MAAM,WAAW,GACtB,WAAW,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,KACnF,IAOF,CAAC"}
|