@synnaxlabs/pluto 0.38.0 → 0.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/dist/{Animated-CBm9-vEt.js → Animated-BWcO40x5.js} +2 -2
  2. package/dist/{Animated-Cv0kRBvj.cjs → Animated-Cxl7iHik.cjs} +1 -1
  3. package/dist/{Item-DfHOrsI4.js → Item-BZvmqn4h.js} +4 -4
  4. package/dist/{Item-D4eTqW7p.cjs → Item-C4SOBynl.cjs} +1 -1
  5. package/dist/{LinePlot-BLovx_K1.js → LinePlot-B_tFyvNo.js} +1776 -1794
  6. package/dist/LinePlot-C_uxbSzY.cjs +56 -0
  7. package/dist/{Link-DsUveQ8_.js → Link-BIWA4Kdj.js} +1 -1
  8. package/dist/{Link-CcELhLK5.cjs → Link-DO2YbtQM.cjs} +1 -1
  9. package/dist/{Pack-SDIuOEWr.cjs → Pack-B7_tAsYd.cjs} +1 -1
  10. package/dist/{Pack-meMPpnLE.js → Pack-Di5J8hmU.js} +1 -1
  11. package/dist/{Toggle--8qqNnzb.cjs → Toggle-BOWYgKry.cjs} +61 -61
  12. package/dist/{Toggle-Bkpw4raJ.js → Toggle-DvdBHJvZ.js} +6983 -6992
  13. package/dist/{Video-M2UhBzQi.js → Video-CAbdyjCE.js} +1 -1
  14. package/dist/{Video-D9_mAnaf.cjs → Video-usN9Roxq.cjs} +1 -1
  15. package/dist/{aggregator-By11htYo.cjs → aggregator-B4RWbN9h.cjs} +34 -34
  16. package/dist/{aggregator-BpyoaCoW.js → aggregator-Bl15iClv.js} +2593 -2617
  17. package/dist/align.cjs +1 -1
  18. package/dist/align.js +1 -1
  19. package/dist/button.cjs +1 -1
  20. package/dist/button.js +1 -1
  21. package/dist/color.cjs +1 -1
  22. package/dist/color.js +1 -1
  23. package/dist/{css-CxwKC6TD.js → css-Bbri4zkj.js} +190 -184
  24. package/dist/css-DT9dIVAb.cjs +1 -0
  25. package/dist/css.cjs +1 -1
  26. package/dist/css.js +2 -2
  27. package/dist/dropdown.cjs +1 -1
  28. package/dist/dropdown.js +1 -1
  29. package/dist/ether.cjs +1 -1
  30. package/dist/ether.js +67 -71
  31. package/dist/{external-ByzAGKGm.cjs → external-8OKX45Jc.cjs} +1 -1
  32. package/dist/{external-biLn9KfP.cjs → external-9Q86X8hc.cjs} +1 -1
  33. package/dist/{external-DSHJn336.js → external-B45MvYg8.js} +4 -4
  34. package/dist/{external-BDxOWeCJ.js → external-BP5euc4j.js} +3 -3
  35. package/dist/external-Ba8go3wq.cjs +1 -0
  36. package/dist/{external-BDI5gGZT.js → external-C59dex28.js} +2 -2
  37. package/dist/{external-BlB1LKU5.cjs → external-CKXRIr4_.cjs} +1 -1
  38. package/dist/{external-CEAUuDRU.js → external-CML3oqyJ.js} +2 -2
  39. package/dist/{external-BdhgaSFj.cjs → external-CW61uh4b.cjs} +1 -1
  40. package/dist/{external-DaTbvfth.cjs → external-CWIwuJks.cjs} +1 -1
  41. package/dist/{external-BOqGZoJO.js → external-CcuRxo0Z.js} +27 -27
  42. package/dist/{external-Dvj3Y4C_.cjs → external-CigHe3w_.cjs} +1 -1
  43. package/dist/{external-NDebmx0l.js → external-Cm1kldLr.js} +13 -13
  44. package/dist/{external-Cc7R9gIf.js → external-DNjLBxYA.js} +4 -4
  45. package/dist/{external-BzzIJ4wP.js → external-DTDBfIqD.js} +1 -1
  46. package/dist/{external-DN8Ec8n8.cjs → external-DkXE1VK8.cjs} +1 -1
  47. package/dist/{external--jF6DCow.cjs → external-Dt4ggRt2.cjs} +1 -1
  48. package/dist/{external-CsLjI7EJ.js → external-DuGCS_ZD.js} +2 -2
  49. package/dist/{external-CqOmm0mk.js → external-DuK5v_sl.js} +38 -36
  50. package/dist/{external-mT9bNf0F.cjs → external-SsIgRo40.cjs} +1 -1
  51. package/dist/{external-hZWRSBEb.js → external-U33eEFR3.js} +14 -14
  52. package/dist/{external-CDa3lybi.js → external-bw66TR6V.js} +10 -10
  53. package/dist/{external---lrKeGh.cjs → external-kZBV4X9L.cjs} +1 -1
  54. package/dist/{external-Dqh2Lbnl.cjs → external-ok_ye4LF.cjs} +1 -1
  55. package/dist/header.cjs +1 -1
  56. package/dist/header.js +1 -1
  57. package/dist/index.cjs +7 -7
  58. package/dist/index.js +2867 -2875
  59. package/dist/input.cjs +1 -1
  60. package/dist/input.js +1 -1
  61. package/dist/list.cjs +1 -1
  62. package/dist/list.js +1 -1
  63. package/dist/menu.cjs +1 -1
  64. package/dist/menu.js +1 -1
  65. package/dist/src/aether/aether/aether.bench.d.ts +2 -0
  66. package/dist/src/aether/aether/aether.bench.d.ts.map +1 -0
  67. package/dist/src/aether/aether/aether.d.ts +143 -136
  68. package/dist/src/aether/aether/aether.d.ts.map +1 -1
  69. package/dist/src/aether/aether/{worker.spec.d.ts → aether.spec.spec.d.ts} +1 -1
  70. package/dist/src/aether/aether/aether.spec.spec.d.ts.map +1 -0
  71. package/dist/src/alamos/aether/alamos.d.ts +2 -2
  72. package/dist/src/alamos/aether/alamos.d.ts.map +1 -1
  73. package/dist/src/breadcrumb/Breadcrumb.d.ts +2 -2
  74. package/dist/src/breadcrumb/Breadcrumb.d.ts.map +1 -1
  75. package/dist/src/button/Button.d.ts +5 -5
  76. package/dist/src/button/Button.d.ts.map +1 -1
  77. package/dist/src/button/Toggle.d.ts +2 -2
  78. package/dist/src/channel/Select.d.ts +1 -1
  79. package/dist/src/channel/Select.d.ts.map +1 -1
  80. package/dist/src/color/Provider.d.ts.map +1 -1
  81. package/dist/src/hooks/effect.d.ts +2 -2
  82. package/dist/src/hooks/effect.d.ts.map +1 -1
  83. package/dist/src/icon/Icon.d.ts +11 -4
  84. package/dist/src/icon/Icon.d.ts.map +1 -1
  85. package/dist/src/menu/Item.d.ts.map +1 -1
  86. package/dist/src/os/Controls/Controls.d.ts.map +1 -1
  87. package/dist/src/os/use.d.ts.map +1 -1
  88. package/dist/src/pluto/aether/pluto.d.ts.map +1 -1
  89. package/dist/src/select/Alignment.d.ts +1 -1
  90. package/dist/src/select/Alignment.d.ts.map +1 -1
  91. package/dist/src/select/ComponentSize.d.ts.map +1 -1
  92. package/dist/src/select/Direction.d.ts +1 -1
  93. package/dist/src/select/Direction.d.ts.map +1 -1
  94. package/dist/src/status/Aggregator.d.ts +4 -6
  95. package/dist/src/status/Aggregator.d.ts.map +1 -1
  96. package/dist/src/status/aether/aggregator.d.ts +10 -4
  97. package/dist/src/status/aether/aggregator.d.ts.map +1 -1
  98. package/dist/src/synnax/aether/provider.d.ts +2 -2
  99. package/dist/src/synnax/aether/provider.d.ts.map +1 -1
  100. package/dist/src/table/aether/Table.d.ts +3 -1
  101. package/dist/src/table/aether/Table.d.ts.map +1 -1
  102. package/dist/src/table/cells/registry.d.ts.map +1 -1
  103. package/dist/src/table/external.d.ts.map +1 -1
  104. package/dist/src/tabs/types.d.ts +2 -2
  105. package/dist/src/tabs/types.d.ts.map +1 -1
  106. package/dist/src/tag/Tag.d.ts +1 -1
  107. package/dist/src/tag/Tag.d.ts.map +1 -1
  108. package/dist/src/telem/aether/context.d.ts +22 -22
  109. package/dist/src/telem/aether/context.d.ts.map +1 -1
  110. package/dist/src/telem/aether/factory.d.ts +1 -1
  111. package/dist/src/telem/aether/factory.d.ts.map +1 -1
  112. package/dist/src/telem/aether/provider.d.ts +3 -13
  113. package/dist/src/telem/aether/provider.d.ts.map +1 -1
  114. package/dist/src/telem/aether/remote.d.ts.map +1 -1
  115. package/dist/src/telem/client/client.d.ts +8 -12
  116. package/dist/src/telem/client/client.d.ts.map +1 -1
  117. package/dist/src/telem/control/aether/chip.d.ts +1 -2
  118. package/dist/src/telem/control/aether/chip.d.ts.map +1 -1
  119. package/dist/src/telem/control/aether/controller.d.ts +3 -2
  120. package/dist/src/telem/control/aether/controller.d.ts.map +1 -1
  121. package/dist/src/telem/control/aether/indicator.d.ts +1 -2
  122. package/dist/src/telem/control/aether/indicator.d.ts.map +1 -1
  123. package/dist/src/telem/control/aether/legend.d.ts +1 -1
  124. package/dist/src/telem/control/aether/legend.d.ts.map +1 -1
  125. package/dist/src/telem/control/aether/state.d.ts +1 -1
  126. package/dist/src/telem/control/aether/state.d.ts.map +1 -1
  127. package/dist/src/text/Editable.d.ts.map +1 -1
  128. package/dist/src/theming/Provider.d.ts.map +1 -1
  129. package/dist/src/theming/aether/provider.d.ts +1 -1
  130. package/dist/src/theming/aether/provider.d.ts.map +1 -1
  131. package/dist/src/tree/Tree.d.ts +1 -1
  132. package/dist/src/tree/Tree.d.ts.map +1 -1
  133. package/dist/src/tree/core.d.ts +1 -2
  134. package/dist/src/tree/core.d.ts.map +1 -1
  135. package/dist/src/triggers/Provider.d.ts.map +1 -1
  136. package/dist/src/util/canDisable.d.ts.map +1 -1
  137. package/dist/src/util/reflow.d.ts.map +1 -1
  138. package/dist/src/vis/axis/canvas.d.ts +1 -1
  139. package/dist/src/vis/axis/canvas.d.ts.map +1 -1
  140. package/dist/src/vis/button/aether/button.d.ts +1 -1
  141. package/dist/src/vis/button/aether/button.d.ts.map +1 -1
  142. package/dist/src/vis/canvas/aether/canvas.d.ts +9 -8
  143. package/dist/src/vis/canvas/aether/canvas.d.ts.map +1 -1
  144. package/dist/src/vis/diagram/Diagram.d.ts.map +1 -1
  145. package/dist/src/vis/diagram/aether/Diagram.d.ts +2 -2
  146. package/dist/src/vis/diagram/aether/Diagram.d.ts.map +1 -1
  147. package/dist/src/vis/eraser/aether/eraser.d.ts +4 -4
  148. package/dist/src/vis/eraser/aether/eraser.d.ts.map +1 -1
  149. package/dist/src/vis/light/aether/light.d.ts +2 -2
  150. package/dist/src/vis/light/aether/light.d.ts.map +1 -1
  151. package/dist/src/vis/line/aether/line.d.ts +2 -2
  152. package/dist/src/vis/line/aether/line.d.ts.map +1 -1
  153. package/dist/src/vis/lineplot/aether/LinePlot.d.ts +3 -3
  154. package/dist/src/vis/lineplot/aether/LinePlot.d.ts.map +1 -1
  155. package/dist/src/vis/lineplot/aether/axis.d.ts +2 -2
  156. package/dist/src/vis/lineplot/aether/axis.d.ts.map +1 -1
  157. package/dist/src/vis/lineplot/range/aether/annotation.d.ts +1 -1
  158. package/dist/src/vis/lineplot/range/aether/annotation.d.ts.map +1 -1
  159. package/dist/src/vis/lineplot/range/aether/provider.d.ts +1 -1
  160. package/dist/src/vis/lineplot/range/aether/provider.d.ts.map +1 -1
  161. package/dist/src/vis/lineplot/tooltip/aether/tooltip.d.ts +2 -2
  162. package/dist/src/vis/lineplot/tooltip/aether/tooltip.d.ts.map +1 -1
  163. package/dist/src/vis/log/Log.d.ts.map +1 -1
  164. package/dist/src/vis/log/aether/Log.d.ts +1 -1
  165. package/dist/src/vis/log/aether/Log.d.ts.map +1 -1
  166. package/dist/src/vis/log/index.d.ts.map +1 -1
  167. package/dist/src/vis/measure/aether/measure.d.ts +3 -3
  168. package/dist/src/vis/measure/aether/measure.d.ts.map +1 -1
  169. package/dist/src/vis/render/GLProgram.d.ts +1 -1
  170. package/dist/src/vis/render/GLProgram.d.ts.map +1 -1
  171. package/dist/src/vis/render/external.d.ts +0 -1
  172. package/dist/src/vis/render/external.d.ts.map +1 -1
  173. package/dist/src/vis/render/loop.d.ts +1 -1
  174. package/dist/src/vis/render/loop.d.ts.map +1 -1
  175. package/dist/src/vis/rule/aether/aether.d.ts +2 -2
  176. package/dist/src/vis/rule/aether/aether.d.ts.map +1 -1
  177. package/dist/src/vis/setpoint/aether/setpoint.d.ts +2 -2
  178. package/dist/src/vis/setpoint/aether/setpoint.d.ts.map +1 -1
  179. package/dist/src/vis/toggle/aether/toggle.d.ts +2 -2
  180. package/dist/src/vis/toggle/aether/toggle.d.ts.map +1 -1
  181. package/dist/src/vis/value/aether/value.d.ts +2 -2
  182. package/dist/src/vis/value/aether/value.d.ts.map +1 -1
  183. package/dist/src/worker/Context.d.ts.map +1 -1
  184. package/dist/tabs.cjs +1 -1
  185. package/dist/tabs.js +1 -1
  186. package/dist/text.cjs +1 -1
  187. package/dist/text.js +2 -2
  188. package/dist/theming.cjs +1 -1
  189. package/dist/theming.js +2 -2
  190. package/dist/{transformColorsToHex-1p-bBtDw.cjs → transformColorsToHex-CDwcIPob.cjs} +1 -1
  191. package/dist/{transformColorsToHex-CjnZ3Lo3.js → transformColorsToHex-CnZpPlL2.js} +1 -1
  192. package/dist/tree.cjs +1 -1
  193. package/dist/tree.js +1 -1
  194. package/dist/triggers.cjs +1 -1
  195. package/dist/triggers.js +1 -1
  196. package/dist/{units-Cq6pBqSd.cjs → units-BpKy5yTv.cjs} +1 -1
  197. package/dist/{units-Bz3KAVba.js → units-CNGjg1NV.js} +1 -1
  198. package/dist/video.cjs +1 -1
  199. package/dist/video.js +1 -1
  200. package/package.json +6 -5
  201. package/dist/LinePlot-BXBKDBXS.cjs +0 -56
  202. package/dist/css-CRd0zXr-.cjs +0 -1
  203. package/dist/external-BXEbAbxf.cjs +0 -1
  204. package/dist/src/aether/aether/worker.spec.d.ts.map +0 -1
  205. package/dist/src/aether/test/index.d.ts +0 -2
  206. package/dist/src/aether/test/index.d.ts.map +0 -1
  207. package/dist/src/aether/test/test.d.ts +0 -11
  208. package/dist/src/aether/test/test.d.ts.map +0 -1
  209. package/dist/src/telem/test/index.d.ts +0 -2
  210. package/dist/src/telem/test/index.d.ts.map +0 -1
  211. package/dist/src/telem/test/mock.d.ts +0 -33
  212. package/dist/src/telem/test/mock.d.ts.map +0 -1
  213. package/dist/src/vis/render/eraser.d.ts +0 -20
  214. package/dist/src/vis/render/eraser.d.ts.map +0 -1
@@ -1,56 +0,0 @@
1
- "use strict";var pa=Object.defineProperty;var ga=(e,n,t)=>n in e?pa(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var h=(e,n,t)=>ga(e,typeof n!="symbol"?n+"":n,t);const d=require("./aggregator-By11htYo.cjs"),p=require("zod"),l=require("./css-CRd0zXr-.cjs");var ma=Object.defineProperty,ya=(e,n,t)=>n in e?ma(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Ge=(e,n,t)=>ya(e,typeof n!="symbol"?n+"":n,t);class xa{constructor(n,t){Ge(this,"handlers"),Ge(this,"transform"),Ge(this,"closer"),this.transform=n,this.handlers=t??new Map}onChange(n){return this.handlers.set(n,null),()=>this.handlers.delete(n)}notify(n){let t=n;if(this.transform!=null){const[r,s]=this.transform(n);if(!s)return;t=r}this.handlers.forEach((r,s)=>s(t))}setCloser(n){this.closer=n}async close(){var n;return await((n=this.closer)==null?void 0:n.call(this))}}class wa{constructor(n){Ge(this,"handlers"),this.handlers=n??new Map}onChange(n){return this.handlers.set(n,null),()=>this.handlers.delete(n)}notify(n){this.handlers.forEach((t,r)=>r(n))}}const Qn=Object.freeze(Object.defineProperty({__proto__:null,BaseObserver:wa,Observer:xa},Symbol.toStringTag,{value:"Module"})),K="layout",Gn="data",et="tool";var V;let N=(V=class{constructor(n){h(this,"f");this.f=n}static control(n,t){n.set(V.CONTEXT_KEY,new V(t),!1)}static useRequest(n){return n.get(V.CONTEXT_KEY).f}static useOptionalRequest(n){var t;return((t=n.getOptional(V.CONTEXT_KEY))==null?void 0:t.f)??null}static requestRender(n,t){this.useRequest(n)(t)}},h(V,"CONTEXT_KEY","pluto-vis-renderer"),V);const ba=p.z.object({props:d.gg.nullable(),state:d.pg.connectivity.connectionStateZ.nullable()}),Jn={synnax:null,state:d.pg.connectivity.DEFAULT};var it;let Fe=(it=class extends d.Composite{constructor(){super(...arguments);h(this,"schema",it.stateZ)}async afterUpdate(){var t;if(this.ctx.has(tr)||zn(this.ctx,Jn),this.state.props==null){this.internal.synnax!=null&&(this.setState(r=>({...r,state:d.pg.connectivity.DEFAULT})),(t=this.internal.synnax)==null||t.close(),this.internal.synnax=null),zn(this.ctx,this.internal);return}this.prevState.props!=null&&d._.equal(this.state.props,this.prevState.props)&&this.internal.synnax!=null||(this.internal.synnax=new d.pg(this.state.props),this.internal.synnax.connectivity.onChange(r=>this.setState(s=>({...s,state:r}))),zn(this.ctx,this.internal))}},h(it,"TYPE","SynnaxProvider"),h(it,"stateZ",ba),it);const tr="pluto-client-context",zn=(e,n)=>e.set(tr,n),Re=e=>e.get(tr).synnax,ms={[Fe.TYPE]:Fe},va=Object.freeze(Object.defineProperty({__proto__:null,Provider:Fe,REGISTRY:ms,ZERO_CONTEXT_VALUE:Jn,use:Re},Symbol.toStringTag,{value:"Module"})),ys="pluto-telem-context",Tn=e=>e.get(ys),xs=(e,n)=>e.set(ys,n),ws=(e,n)=>Tn(e).registerFactory(n);class Zr{constructor(n,t,r){h(this,"spec");h(this,"wrapped");h(this,"prevKey");this.wrapped=n,this.spec=r,this.prevKey=t.clusterKey}async value(){return await this.wrapped.value()}async cleanup(){var n,t;await((t=(n=this.wrapped).cleanup)==null?void 0:t.call(n))}onChange(n){return this.wrapped.onChange(n)}shouldUpdate(n,t){return this.prevKey!==n.clusterKey||!d._.equal(this.spec,t)}}class Nr{constructor(n,t,r){h(this,"spec");h(this,"prov");h(this,"prevKey");h(this,"wrapped");this.wrapped=n,this.spec=r,this.prov=t,this.prevKey=t.clusterKey}async set(n){return await this.wrapped.set(n)}async cleanup(){var n,t;await((t=(n=this.wrapped).cleanup)==null?void 0:t.call(n))}shouldUpdate(n,t){return this.prevKey!==n.clusterKey||!d._.equal(this.spec,t)}}const H=async(e,n,t)=>{var s;const r=Tn(e);if(t instanceof Zr){if(!t.shouldUpdate(r,n))return t;await((s=t.cleanup)==null?void 0:s.call(t))}return new Zr(r.create(n),r,n)},Ye=async(e,n,t)=>{var s;const r=Tn(e);if(t instanceof Nr){if(!t.shouldUpdate(r,n))return t;await((s=t.cleanup)==null?void 0:s.call(t))}return new Nr(r.create(n),r,n)};class at extends Qn.Observer{async cleanup(){}}class He extends at{async set(){return await Promise.resolve()}}h(He,"TYPE","noop-boolean-sink");const Sn={type:He.TYPE,props:{},variant:"sink",valueType:"boolean"};class qe extends at{async set(){return await Promise.resolve()}}h(qe,"TYPE","noop-numeric-sink");const bs={type:qe.TYPE,props:{},variant:"sink",valueType:"number"};class je extends at{async value(){return await Promise.resolve(!1)}}h(je,"TYPE","noop-boolean-source");const er={type:je.TYPE,props:{},variant:"source",valueType:"boolean"};class We extends at{async value(){return 0}}h(We,"TYPE","noop-numeric-source");const vs={type:We.TYPE,props:{},variant:"source",valueType:"number"};class Ve extends at{async value(){return""}}h(Ve,"TYPE","noop-string-source");const Ts={type:Ve.TYPE,props:{},variant:"source",valueType:"string"};class Xe extends at{async value(){return{key:"noop",variant:"disabled",message:"unknown",time:d.m.now()}}}h(Xe,"TYPE","noop-status-source");const nr={type:Xe.TYPE,props:{},variant:"source",valueType:"status"};class Ke extends at{async value(){return l.ZERO}}h(Ke,"TYPE","noop-color-source");const En={type:Ke.TYPE,props:{},variant:"source",valueType:"color"};class Qe extends at{async value(){return[l.H.ZERO,[]]}}h(Qe,"TYPE","noop-series");const Ss={type:Qe.TYPE,props:{},variant:"source",valueType:"series"},Ta={[He.TYPE]:He,[qe.TYPE]:qe,[je.TYPE]:je,[We.TYPE]:We,[Xe.TYPE]:Xe,[Ke.TYPE]:Ke,[Ve.TYPE]:Ve,[Qe.TYPE]:Qe};class Es{constructor(){h(this,"type","noop")}create(n){const t=Ta[n.type];return t==null?null:new t}}const Sa=p.z.instanceof(ArrayBuffer),ze=p.z.object({type:p.z.string(),variant:p.z.enum(["source","sink","source-transformer","sink-transformer"]),valueType:p.z.string(),props:p.z.any(),transfer:p.z.array(Sa).optional()}),ot=ze.extend({variant:p.z.literal("source")}),Cn=ze.extend({variant:p.z.literal("sink")}),Cs=ze.extend({variant:p.z.literal("source-transformer")}),Ms=ze.extend({variant:p.z.literal("sink-transformer")}),Je=ot.extend({valueType:p.z.literal("series")}),rr=ot.extend({valueType:p.z.literal("boolean")}),Mn=Cn.extend({valueType:p.z.literal("boolean")}),Ea=Ms.extend({valueType:p.z.literal("boolean")}),Ca=Cs.extend({valueType:p.z.literal("boolean")}),Ps=ot.extend({valueType:p.z.literal("number")}),ks=Cn.extend({valueType:p.z.literal("number")}),sr=ot.extend({valueType:p.z.literal("color")}),ir=ot.extend({valueType:p.z.literal("status")}),ar=ot.extend({valueType:p.z.literal("string")});class Pn extends Qn.BaseObserver{constructor(t){super();h(this,"props_");h(this,"uProps_");h(this,"schema");this.uProps_=t}get props(){if(this.props_==null){const t=this._schema.safeParse(this.uProps_);if(t.success)this.props_=t.data;else throw new d.L(`[BaseTelem] - expected props to be valid, but found the following errors:
2
- ${t.error.message}`)}return this.props_}get _schema(){if(this.schema==null)throw new d.L(`[BaseTelem] - expected subclass to define props schema, but none was found.
3
- Make sure to define a property 'schema' on the class.`);return this.schema}async cleanup(){}}class _ extends Pn{}class kn extends Pn{}class pt extends _{constructor(){super(...arguments);h(this,"sources",{})}get source(){const[t]=Object.values(this.sources);if(t==null)throw new d.L("[UnarySourceTransformer] - expected source to exist, but none was found.");return t}async value(){return this.transform(await this.source.value())}onChange(t){return this.source.onChange(()=>{this.source.value().then(r=>{this.shouldNotify(r)&&t()}).catch(console.error)})}setSources(t){this.sources=t}shouldNotify(t){return!0}transform(t){throw new d.L(`[UnarySourceTransformer] - expected subclass to define transform method, but none was found.
4
- Make sure to define a method 'transform' on the class.`)}}class Rs extends _{constructor(){super(...arguments);h(this,"sources",{})}async value(){const t=Object.fromEntries(await Promise.all(Object.entries(this.sources).map(async([r,s])=>[r,await s.value()])));return this.transform(t)}setSources(t){this.sources={...this.sources,...t}}transform(t){throw new d.L(`[MultiSourceTransformer] - expected subclass to define transform method, but none was found.
5
- Make sure to define a method 'transform' on the class.`)}}class Ys extends Pn{constructor(){super(...arguments);h(this,"sinks",{})}get sink(){const[t]=Object.values(this.sinks);if(t==null)throw new d.L("[UnarySinkTransformer] - expected sink to exist, but none was found.");return t}async set(t){return await this.sink.set(this.transform(t))}setSinks(t){this.sinks={...this.sinks,...t}}transform(t){throw new d.L(`[UnarySinkTransformer] - expected subclass to define transform method, but none was found.
6
- Make sure to define a method 'transform' on the class.`)}}const or=p.z.object({from:p.z.string(),to:p.z.string()}),lr=p.z.object({connections:p.z.array(or),outlet:p.z.string(),segments:p.z.record(ot)});class zs{constructor(n){h(this,"type","pipeline");h(this,"factory");this.factory=n}create(n){switch(n.type){case oe.TYPE:return new oe(n.props,this.factory);case le.TYPE:return new le(n.props,this.factory);default:return null}}}class oe extends _{constructor(t,r){super(t);h(this,"schema",lr);h(this,"sources",{});const{connections:s,segments:i}=this.props;Object.entries(i).forEach(([a,o])=>{const c=r.create(o);c!=null&&(this.sources[a]=c)}),s.forEach(({from:a,to:o})=>{const c=this.sources[a],u=this.sources[o];c==null||u==null||"setSources"in u&&u.setSources({[a]:c})})}get outlet(){const{outlet:t}=this.props,r=this.sources[t];if(r==null)throw new d.L(`[SourcePipeline] - expected source to exist at outlet '${t}', but none was found.`);return r}async value(){return await this.outlet.value()}onChange(t){return this.outlet.onChange(t)}async cleanup(){await Promise.all(Object.values(this.sources).map(async t=>{var r;return await((r=t.cleanup)==null?void 0:r.call(t))}))}}h(oe,"TYPE","source-pipeline");const Ds=(e,n)=>({variant:"source",props:n,type:oe.TYPE,valueType:e}),cr=p.z.object({connections:p.z.array(or),inlet:p.z.string(),segments:p.z.record(Cn)});class le extends kn{constructor(t,r){super(t);h(this,"schema",cr);h(this,"sinks",{});const{connections:s,segments:i}=this.props;Object.entries(i).forEach(([a,o])=>{const c=r.create(o);c!=null&&(this.sinks[a]=c)}),s.forEach(({from:a,to:o})=>{const c=this.sinks[a],u=this.sinks[o];c==null||u==null||"setSinks"in c&&c.setSinks({[o]:u})})}get inlet(){const{inlet:t}=this.props,r=this.sinks[t];if(r==null)throw new d.L(`[SinkPipeline] - expected source to exist at inlet '${t}', but none was found.`);return r}async set(t){return await this.inlet.set(t)}async cleanup(){await Promise.all(Object.values(this.sinks).map(async t=>{var r;return await((r=t.cleanup)==null?void 0:r.call(t))}))}}h(le,"TYPE","sink-pipeline");const Ls=(e,n)=>({variant:"sink",props:n,type:le.TYPE,valueType:e}),ur=p.z.object({channel:p.z.number().or(p.z.string())});class ce extends _{constructor(t,r){super(r);h(this,"client");h(this,"removeStreamHandler",null);h(this,"channelKey",0);h(this,"schema",ur);h(this,"leadingBuffer",null);h(this,"valid",!1);this.client=t}get testingOnlyLeadingBuffer(){return this.leadingBuffer}get testingOnlyValid(){return this.valid}async cleanup(){var t,r;await((t=this.removeStreamHandler)==null?void 0:t.call(this)),this.valid=!1,(r=this.leadingBuffer)==null||r.release(),this.leadingBuffer=null,this.removeStreamHandler=null}async value(){return d.w$1(this.props.channel)||(this.channelKey===0&&(this.channelKey=(await hr(this.client,this.props.channel,!1)).key),this.valid||await this.read(),this.leadingBuffer==null||this.leadingBuffer.length===0)?0:this.leadingBuffer.at(-1,!0)}async read(){this.valid=!0,await this.updateStreamHandler()}async updateStreamHandler(){var r;await((r=this.removeStreamHandler)==null?void 0:r.call(this));const t=s=>{var o;const a=s[this.channelKey].data;if(a.length!==0){const c=a[a.length-1];c.acquire(),(o=this.leadingBuffer)==null||o.release(),this.leadingBuffer=c}this.notify()};this.removeStreamHandler=await this.client.stream(t,[this.channelKey])}}h(ce,"TYPE","stream-channel-value");const hr=async(e,n,t)=>{let r=await e.retrieveChannel(n);if(!t||r.isIndex)return{key:r.key,dataType:r.dataType,virtual:r.virtual};if(d.zg.isCalculated(r)){const s=await d.zg.resolveCalculatedIndex(e.retrieveChannel.bind(e),r);if(s==null)throw new d.L("Cannot resolve calculated index");return r=await e.retrieveChannel(s),{key:r.key,dataType:d.g.TIMESTAMP,virtual:!1}}if(r.virtual)throw new d.L("Cannot plot data from virtual channels");return{key:r.index,dataType:d.g.TIMESTAMP,virtual:!1}},Ma=p.z.object({timeRange:d.E.z,channel:p.z.number().or(p.z.string()),useIndexOfChannel:p.z.boolean().optional().default(!1)});class ue extends _{constructor(t,r){super(r);h(this,"client");h(this,"data",[]);h(this,"valid",!1);h(this,"schema",Ma);this.client=t}async cleanup(){this.data.forEach(t=>t.release()),this.valid=!1}async value(){const{timeRange:t,channel:r,useIndexOfChannel:s}=this.props;if(t.isZero||r===0)return[l.H.ZERO,[]];const i=await hr(this.client,r,s);this.valid||await this.readFixed(i.key);let a=l.H.max(this.data.map(o=>o.bounds));return i.dataType.equals(d.g.TIMESTAMP)&&(a={upper:Math.min(a.upper,Number(this.props.timeRange.end.valueOf())),lower:Math.max(a.lower,Number(this.props.timeRange.start.valueOf()))}),[a,this.data]}async readFixed(t){const s=(await this.client.read(this.props.timeRange,[t]))[t].data;s.forEach(i=>i.acquire()),this.data=s,this.valid=!0}}h(ue,"TYPE","series-source");const Pa=p.z.object({channel:p.z.number().or(p.z.string()),useIndexOfChannel:p.z.boolean().optional().default(!1),timeSpan:d.w.z,keepFor:d.w.z.optional()});class he extends _{constructor(t,r){super(r);h(this,"client");h(this,"data",[]);h(this,"stopStreaming");h(this,"valid",!1);h(this,"schema",Pa);this.client=t}async value(){const{channel:t,useIndexOfChannel:r,timeSpan:s}=this.props;if(t===0)return[l.H.ZERO,[]];const i=d.m.now(),a=await hr(this.client,t,r);if(this.valid||await this.read(a),a.dataType.isVariable)return[l.H.ZERO,this.data];let o=l.H.max(this.data.filter(c=>c.timeRange.end.after(i.sub(s))).map(c=>c.bounds));return a.dataType.equals(d.g.TIMESTAMP)&&(o={upper:o.upper,lower:Math.max(o.lower,o.upper-Number(s.valueOf()))}),[o,this.data]}async read({key:t,virtual:r}){const s=d.m.now().spanRange(-this.props.timeSpan);if(!r){const a=(await this.client.read(s,[t]))[t].data;a.forEach(o=>o.acquire()),this.data.push(...a)}await this.updateStreamHandler(t),this.valid=!0}async updateStreamHandler(t){this.stopStreaming!=null&&await this.stopStreaming();const r=s=>{const i=s[t].data;i.forEach(a=>a.acquire()),this.data.push(...i),this.gcOutOfRangeData(),this.notify()};this.stopStreaming=await this.client.stream(r,[t])}gcOutOfRangeData(){const t=d.m.now().sub(this.props.keepFor??this.props.timeSpan),r=this.data.findIndex(s=>s.timeRange.end.before(t));r!==-1&&(this.data.splice(r,1).forEach(s=>s.release()),this.gcOutOfRangeData())}async cleanup(){var t;await((t=this.stopStreaming)==null?void 0:t.call(this)),this.stopStreaming=void 0,this.data.forEach(r=>r.release())}}h(he,"TYPE","dynamic-series-source");const ka={[ue.TYPE]:ue,[he.TYPE]:he,[ce.TYPE]:ce};class Os{constructor(n){h(this,"type","remote");h(this,"client");this.client=n}create(n){const t=ka[n.type];return t==null?null:new t(this.client,n.props)}}const As=e=>({type:ue.TYPE,props:e,variant:"source",valueType:"series"}),Zs=e=>({type:he.TYPE,props:e,variant:"source",valueType:"series"}),Ns=e=>({type:ce.TYPE,props:e,variant:"source",valueType:"number"});class Is{constructor(){h(this,"type","static")}create(n){switch(n.type){case tn.TYPE:return new tn(n.props);case de.TYPE:return new de(n.props);case fe.TYPE:return new fe(n.props);case pe.TYPE:return new pe(n.props);case ge.TYPE:return new ge(n.props);default:return null}}}const dr=p.z.object({data:p.z.array(d.Lt),offsets:p.z.array(p.z.number()).optional().default([])});class tn extends _{constructor(t){super(t);h(this,"data");h(this,"schema",dr);this.data=this.props.data.map((r,s)=>new d.Z({data:r,dataType:d.g.FLOAT32,timeRange:d.E.ZERO,sampleOffset:this.props.offsets[s]??0}))}async value(){return[l.H.max(this.data.map(r=>r.bounds)),this.data]}}h(tn,"TYPE","static-series");const $s=dr.extend({rate:d.$.z,yOffset:p.z.number().optional().default(0),scroll:p.z.number().optional().default(0),startPosition:p.z.number().optional().default(0),scrollBounds:p.z.boolean().optional().default(!1)});class de extends _{constructor(t){super(t);h(this,"schema",$s);h(this,"position");h(this,"interval");h(this,"data");this.position=this.props.startPosition,this.start(this.props.rate),this.data=this.props.data.map((r,s)=>new d.Z({data:r,dataType:d.g.FLOAT32,timeRange:d.E.ZERO,sampleOffset:this.props.offsets[s]??0}))}async value(){const t=this.data.map(s=>s.slice(0,this.position));if(this.props.scrollBounds){const s=t[0].data[this.position-this.props.scroll<0?0:this.position-this.props.scroll],i=t[0].data[this.position-1];return[{lower:Number(s),upper:Number(i)},t]}return[l.H.max(t.map(s=>s.bounds)),t]}start(t){this.interval!=null&&clearInterval(this.interval),this.interval=setInterval(()=>{var r;(r=this.notify)==null||r.call(this),this.position++},t.period.milliseconds)}async cleanup(){clearInterval(this.interval),this.interval=void 0}}h(de,"TYPE","iterative-series");const Us=p.z.number();class fe extends _{constructor(){super(...arguments);h(this,"schema",Us)}async value(){return this.props}}h(fe,"TYPE","static-numeric");const Bs=p.z.string();class pe extends _{constructor(){super(...arguments);h(this,"schema",Bs)}async value(){return this.props}}h(pe,"TYPE","static-string");const Gs=l.crudeZ;class ge extends _{constructor(){super(...arguments);h(this,"schema",Gs)}async value(){return new l.Color(this.props)}}h(ge,"TYPE","static-color");const Ra=e=>({type:tn.TYPE,props:e,variant:"source",valueType:"series"}),Ya=e=>({type:de.TYPE,props:e,variant:"source",valueType:"series"}),za=e=>({type:fe.TYPE,props:e,variant:"source",valueType:"number"}),Da=e=>({type:pe.TYPE,props:e,variant:"source",valueType:"string"}),La=e=>({type:ge.TYPE,props:e,variant:"source",valueType:"color"}),Oa=["standard","scientific","engineering"],_s=p.z.enum(Oa),Aa=(e,n,t)=>{if(Number.isNaN(e))return"NaN";if(e===1/0)return"∞";if(e===-1/0)return"-∞";if(t==="standard")return e.toFixed(n);if(e===0)return n===0?"0ᴇ0":`0.${"0".repeat(n)}ᴇ0`;let r;return t==="scientific"?r=Math.floor(Math.log10(Math.abs(e))):r=Math.floor(Math.log10(Math.abs(e))/3)*3,`${(e/10**r).toFixed(n)}ᴇ${r}`};class Fs{constructor(){h(this,"type","transformer")}create(n){switch(n.type){case kt.TYPE:return new kt(n.props);case Rt.TYPE:return new Rt(n.props);case Yt.TYPE:return new Yt(n.props);case zt.TYPE:return new zt(n.props);case Dt.TYPE:return new Dt(n.props);case Lt.TYPE:return new Lt(n.props);case Ot.TYPE:return new Ot(n.props);case At.TYPE:return new At(n.props)}return null}}const Za=p.z.object({truthy:p.z.number().optional().default(1),falsy:p.z.number().optional().default(0)}),Hs=e=>({props:e,type:kt.TYPE,variant:"sink",valueType:"boolean"}),Qt=class Qt extends Ys{constructor(){super(...arguments);h(this,"schema",Qt.propsZ)}transform(t){return t?this.props.truthy:this.props.falsy}};h(Qt,"TYPE","boolean-numeric-converter-sink"),h(Qt,"propsZ",Za);let kt=Qt;const fr=p.z.object({trueBound:l.H.bounds}),qs=e=>({props:e,type:Rt.TYPE,variant:"source",valueType:"boolean"}),Jt=class Jt extends pt{constructor(){super(...arguments);h(this,"schema",Jt.propsZ);h(this,"curr",null)}shouldNotify(t){const r=l.H.contains(this.props.trueBound,t)!==this.curr;return this.curr=l.H.contains(this.props.trueBound,t),r}transform(t){return this.curr=l.H.contains(this.props.trueBound,t),this.curr}};h(Jt,"TYPE","boolean-source"),h(Jt,"propsZ",fr);let Rt=Jt;const js=p.z.object({}),te=class te extends Rs{constructor(){super(...arguments);h(this,"schema",te.propsZ)}transform(t){return Object.values(t).reduce((r,s)=>r+s,0)/Object.keys(t).length}};h(te,"TYPE","mean"),h(te,"propsZ",js);let Yt=te;const Na=e=>({props:e,type:Yt.TYPE,variant:"source",valueType:"boolean"}),Ws=p.z.object({trueVariant:d.variantZ.optional().default("success")}),ee=class ee extends pt{constructor(){super(...arguments);h(this,"schema",ee.propsZ)}transform(t){return t.variant===this.props.trueVariant}};h(ee,"TYPE","boolean-status"),h(ee,"propsZ",Ws);let zt=ee;const Ia=e=>({props:e,type:zt.TYPE,variant:"source",valueType:"boolean"}),pr=p.z.object({precision:p.z.number().optional().default(2),prefix:p.z.string().optional().default(""),suffix:p.z.string().optional().default(""),notation:_s.optional().default("standard")}),ne=class ne extends pt{constructor(){super(...arguments);h(this,"schema",ne.propsZ)}transform(t){return`${this.props.prefix}${Aa(t,this.props.precision,this.props.notation)}${this.props.suffix}`}};h(ne,"TYPE","stringify-number"),h(ne,"propsZ",pr);let Dt=ne;const Vs=e=>({props:e,type:Dt.TYPE,variant:"source",valueType:"string"}),gr=p.z.object({windowSize:p.z.number().optional().default(5)});class Lt extends pt{constructor(){super(...arguments);h(this,"schema",gr);h(this,"values",[])}transform(t){return this.props.windowSize<2?t:this.values.reduce((r,s)=>r+s,0)/this.values.length}shouldNotify(t){return this.props.windowSize<2?!0:(this.values.length>this.props.windowSize&&(this.values=[]),this.values.push(t),this.values.length===this.props.windowSize)}}h(Lt,"TYPE","rolling-average"),h(Lt,"propsZ",js);const Xs=e=>({props:e,type:Lt.TYPE,variant:"source",valueType:"number"}),Ks=p.z.object({gradient:l.gradientZ}),re=class re extends pt{constructor(){super(...arguments);h(this,"schema",re.propsZ)}transform(t){return l.fromGradient(this.props.gradient,t)}};h(re,"TYPE","color-gradient"),h(re,"propsZ",Ks);let Ot=re;const Qs=e=>({props:e,type:Ot.TYPE,variant:"source",valueType:"color"}),Js=p.z.object({scale:l.b.transform}),se=class se extends pt{constructor(){super(...arguments);h(this,"schema",se.propsZ)}transform(t){const{offset:r,scale:s}=this.props.scale;return t*s+r}};h(se,"TYPE","scale-number"),h(se,"propsZ",Js);let At=se;const ti=e=>({props:e,type:At.TYPE,variant:"source",valueType:"number"});class ei{constructor(n){h(this,"factories");h(this,"type","compound");this.factories=n}add(n){this.factories=[...this.factories.filter(t=>t.type!==n.type),n]}create(n){for(const t of this.factories){const r=t.create(n);if(r!=null)return r}return null}}const ni=e=>{const n=[new Fs,new Is,new Es],t=new ei(n);return e!=null&&t.add(new Os(e)),t.add(new zs(t)),t},ri=p.z.object({include:p.z.string().array().optional(),exclude:p.z.string().array().optional(),level:p.z.enum(d.g$1.LOG_LEVELS).optional().default("info")}),_n="alamos-provider";var Bn;let Fn=(Bn=class extends d.Composite{constructor(){super(...arguments);h(this,"schema",ri)}async afterUpdate(){if(this.ctx.getOptional(_n)!=null)return;const r=[],{include:s,exclude:i,level:a}=this.state;(s!=null||i!=null)&&r.push(d.g$1.logLevelKeyFiler({include:s,exclude:i})),a!=null&&r.push(d.g$1.logThresholdFilter(a)),r.length===0&&r.push(()=>!1),this.internal.ins=new d.g$1.Instrumentation({key:"aether",logger:new d.g$1.Logger({filters:r})}),this.ctx.set(_n,this.internal.ins)}},h(Bn,"TYPE","AlamosProvider"),Bn);const De=(e,n)=>{const t=e.get(_n);if(t==null)throw new Error("No instrumentation provider");return n==null?t:t.child(n)},$a={[Fn.TYPE]:Fn},si=(e,n)=>e.dataType.isVariable||e.dataType.equals(d.g.UINT8)?e:(n==null&&e.dataType.equals(d.g.TIMESTAMP)&&(n=BigInt(e.data[0])),e.convert(d.g.FLOAT32,n)),Ua=e=>e.isVariable||e.equals(d.g.UINT8)?e:d.g.FLOAT32,ii=()=>({purgedSeries:0,purgedBytes:d.x.bytes(0)}),ai={instrumentation:d.g$1.NOOP,staleEntryThreshold:d.w.seconds(20)};class Ba{constructor(n){h(this,"data",[]);h(this,"props");this.props={...ai,...n}}write(n){n.length!==0&&(n.forEach(t=>this.writeOne(si(t))),this.checkIntegrity(n))}dirtyRead(n){const t=this.data.filter(({data:a})=>a.timeRange.overlapsWith(n)).map(({data:a})=>a);if(t.length===0)return{series:[],gaps:[n]};const r=t.map((a,o)=>o===0?d.E.ZERO:new d.E(t[o-1].timeRange.end,a.timeRange.start)).filter(a=>!a.isZero&&a.isValid),s=new d.E(n.start,t[0].timeRange.start),i=new d.E(t[t.length-1].timeRange.end,n.end);return s.isValid&&!s.isZero&&r.unshift(s),i.isValid&&!i.isZero&&r.push(i),{series:t,gaps:r}}gc(){const{staleEntryThreshold:n}=this.props,t=ii(),r=this.data.filter(s=>{const i=s.data.refCount>0||d.m.since(s.addedAt).lessThan(n);return i||(t.purgedBytes=t.purgedBytes.add(s.data.byteCapacity)),i});return t.purgedSeries=this.data.length-r.length,this.data=r,t}close(){this.data=[]}writeOne(n){const{instrumentation:{L:t}}=this.props;if(n.length===0)return;const r=l.H.buildInsertionPlan(this.data.map(c=>c.data.alignmentBounds),n.alignmentBounds);if(r===null)return t.debug("Found no viable insertion plan",{inserting:n.digest,cacheContents:this.data.map(c=>c.data.digest)});const{removeBefore:s,removeAfter:i,insertInto:a,deleteInBetween:o}=r;n=n.slice(s,n.data.length-Number(i)),n.length!==0&&this.data.splice(a,o,{data:n,addedAt:d.m.now()})}checkIntegrity(n){const{instrumentation:{L:t}}=this.props,r=this.data.map(i=>i.data.alignmentBounds);if(r.some((i,a)=>r.some((o,c)=>a===c?!1:l.H.overlapsWith(i,o))))throw t.debug("Cache is in an invalid state - bounds overlap!",()=>({write:n.map(i=>i.digest),cacheContents:this.data.map(i=>i.data.digest)})),new Error("Invalid state")}}const Ga=100,_a=1e6,Fa=1e4,Ha=100,qa=40;class ja{constructor(n){h(this,"props");h(this,"counter",0);h(this,"curr");h(this,"avgRate",0);h(this,"timeOfLastWrite");h(this,"totalWrites",0);h(this,"now",()=>d.m.now());this.props=n,this.curr=null,n.testingNow!=null&&(this.now=n.testingNow),this.timeOfLastWrite=this.now()}get length(){var n;return((n=this.curr)==null?void 0:n.length)??0}get leadingBuffer(){return this.curr}write(n){const t=n.flatMap(r=>this._write(r));return{flushed:t.flatMap(r=>r.flushed),allocated:t.flatMap(r=>r.allocated)}}allocate(n,t,r){this.counter++;const s=this.props.dataType.isVariable,i=this.props.dataType.equals(d.g.TIMESTAMP);return d.Z.alloc({capacity:s?n*qa:n,dataType:Ua(this.props.dataType),timeRange:r.range(d.m.MAX),sampleOffset:i?BigInt(r.valueOf()):0,glBufferUsage:"dynamic",alignment:t,key:`dynamic-${this.counter}`})}_write(n){const t=this.nextBufferSize(),r={flushed:[],allocated:[]};if(this.curr==null)this.curr=this.allocate(t,n.alignment,this.now()),r.allocated.push(this.curr);else if(Math.abs(Number(this.curr.alignment+BigInt(this.curr.length)-n.alignment))>1){const c=this.now();this.curr.timeRange.end=c,r.flushed.push(this.curr),this.curr=this.allocate(t,n.alignment,c),r.allocated.push(this.curr)}const s=si(n,this.curr.sampleOffset),i=this.curr.write(s);if(i===n.length)return this.updateAvgRate(n),r;const a=this.now();this.curr.timeRange.end=a,r.flushed.push(this.curr),this.curr=this.allocate(t,n.alignment+BigInt(i),a),r.allocated.push(this.curr);const o=this._write(n.slice(i));return r.flushed.push(...o.flushed),r.allocated.push(...o.allocated),r}updateAvgRate(n){if(typeof this.props.dynamicBufferSize=="number")return;const t=n.length/this.now().span(this.timeOfLastWrite).seconds;this.totalWrites>0&&isFinite(t)&&t>0&&(this.avgRate=(this.avgRate*(this.totalWrites-1)+t)/this.totalWrites),this.totalWrites++,this.timeOfLastWrite=this.now()}nextBufferSize(){const{dynamicBufferSize:n}=this.props;if(typeof n=="number")return n;if(this.totalWrites<Ha)return Fa;const t=l.G$1.roundToNearestMagnitude(this.avgRate*n.seconds);return Math.round(Math.max(Math.min(t,_a),Ga))}close(){this.curr=null}}class Wa{constructor(n){h(this,"channel");h(this,"closed",!1);h(this,"ins");h(this,"static");h(this,"dynamic");this.channel=n.channel,this.ins=n.instrumentation??d.g$1.NOOP,this.static=new Ba(n),this.dynamic=new ja({dynamicBufferSize:n.dynamicBufferSize,dataType:this.channel.dataType})}writeDynamic(n){if(this.closed)return this.ins.L.warn(`Ignoring attempted dynamic write to a closed cache for channel ${this.channel.name}`),[];const{flushed:t,allocated:r}=this.dynamic.write(n);return t.length>0&&this.static.write(t),r}get leadingBuffer(){return this.dynamic.leadingBuffer}writeStatic(n){if(this.closed)return this.ins.L.warn(`Ignoring attempted static write to a closed cache for channel ${this.channel.name}`);this.static.write(n)}read(n){return this.closed?(this.ins.L.warn(`Ignoring attempted dirty read from a closed cache for channel ${this.channel.name}`),{series:[],gaps:[]}):this.static.dirtyRead(n)}gc(){return this.closed?(this.ins.L.warn(`Ignoring attempted garbage collection on a closed cache for channel ${this.channel.name}`),{purgedSeries:0,purgedBytes:d.x.bytes(0)}):this.static.gc()}close(){this.closed=!0,this.dynamic.close(),this.static.close()}}const Va=d.S$1.seconds(60);class Xa{constructor(n){h(this,"props");h(this,"cache",new Map);h(this,"gcInterval");this.props={dynamicBufferSize:Va,gcInterval:d.S$1.seconds(30),...ai,...n},this.gcInterval=setInterval(()=>this.gc(),this.props.gcInterval.milliseconds)}async populateMissing(n){const{instrumentation:t,channelRetriever:r,dynamicBufferSize:s}=this.props,i=[];for(const o of n)this.cache.has(o)||i.push(o);if(i.length===0)return;const a=await r.retrieve(i);for(const o of a){const c=new Wa({channel:o,dynamicBufferSize:s,instrumentation:t.child(`cache-${o.name}-${o.key}`)});this.cache.has(o.key)||this.cache.set(o.key,c)}}get(n){const t=this.cache.get(n);if(t!=null)return t;throw new d.xe(`cache entry for ${n} not found`)}gc(){const{instrumentation:{L:n}}=this.props;n.info("starting garbage collection");const t=ii();this.cache.forEach(r=>{const s=r.gc();t.purgedSeries+=s.purgedSeries,t.purgedBytes=t.purgedBytes.add(s.purgedBytes)}),n.info("garbage collection complete",{purgedSeries:t.purgedSeries,purgedBytes:t.purgedBytes.toString()},!0)}close(){clearInterval(this.gcInterval),this.cache.forEach(n=>n.close()),this.cache.clear()}}class en{constructor(n,t){h(this,"channel");h(this,"data");this.channel=n,this.data=t}get timeRange(){if(this.data.length===0)return d.K.ZERO;const n=this.data[0].timeRange,t=this.data[this.data.length-1].timeRange;return new d.K(n.start,t.end)}get digest(){return{channel:this.channel.key,timeRange:this.timeRange.toPrettyString(),series:this.data.map(n=>n.digest)}}}const Dn=e=>e.map(n=>n.digest);class Ka{constructor(n){h(this,"props");h(this,"debouncedRead");h(this,"guarded",{mu:new d.Mutex,requests:new Map});this.props={instrumentation:d.g$1.NOOP,batchDebounce:d.w.milliseconds(50),...n},this.debouncedRead=d.o(()=>{this.batchRead()},this.props.batchDebounce.milliseconds)}async read(n,t){const{instrumentation:{L:r},cache:s}=this.props;r.debug("starting read",{tr:n.toPrettyString(),channels:t});const i=performance.now(),a=new Map,o={};await s.populateMissing(t);try{for(const f of t){const g=s.get(f),{series:m,gaps:w}=g.read(n);w.length===0&&(o[f]=new en(g.channel,m)),w.forEach(b=>{const T=a.get(b.toString());T==null?a.set(b.toString(),[b,new Set([f])]):a.set(b.toString(),[b,new Set([...T[1],f])])})}if(a.size===0)return r.debug("read satisfied by cache",()=>({tr:n.toPrettyString(),channels:t,responses:Dn(Object.values(o)),time:d.w.milliseconds(performance.now()-i).toString()})),o;r.debug("read cache miss",()=>({tr:n.toPrettyString(),channels:t,toFetch:Array.from(a.values()).map(([f,g])=>({timeRange:f.toPrettyString(),channels:g})),responses:Dn(Object.values(o))}));const{mu:c,requests:u}=this.guarded;for(const[,[f,g]]of a)await new Promise((m,w)=>{c.runExclusive(async()=>{u.set([f,g],{resolve:m,reject:w}),this.debouncedRead()})})}catch(c){throw r.error("read failed",{tr:n.toPrettyString(),channels:t,error:c}),c}for(const c of t){const u=s.get(c),{series:f}=u.read(n);o[c]=new en(u.channel,f)}return r.debug("read satisfied by fetch",()=>({tr:n.toPrettyString(),channels:t,responses:Dn(Object.values(o)),time:d.w.milliseconds(performance.now()-i).toString()})),o}async batchRead(){const{instrumentation:{L:n},readRemote:t,cache:r}=this.props,{mu:s,requests:i}=this.guarded;await s.runExclusive(async()=>{const a=[];try{i.forEach((o,c)=>{const[u,f]=c,g=a.find(([m])=>m.start.span(u.start).lessThan(d.w.milliseconds(5))&&m.end.span(u.end).lessThan(d.w.milliseconds(5)));g==null?a.push([u,f]):g[1]=new Set([...g[1],...f])}),n.debug("batch read",{toFetch:a.map(([o,c])=>({timeRange:o.toPrettyString(),channels:c}))});for(const[o,c]of a){const u=Array.from(c),f=await t(o,u);u.forEach(g=>{const m=r.get(g),w=f.get(g);m.writeStatic(w.series)})}i.forEach(o=>o.resolve())}catch(o){n.error("batch read failed",{error:o},!0),i.forEach(c=>c.reject(o))}finally{i.clear()}})}}class Qa{constructor(n){h(this,"props");h(this,"mu",new d.Mutex);h(this,"listeners",new Map);h(this,"streamerRunLoop",null);h(this,"streamer",null);h(this,"closed",!1);this.props={instrumentation:d.g$1.NOOP,...n}}async stream(n,t){const{cache:r,instrumentation:{L:s}}=this.props;return await r.populateMissing(t),await this.mu.runExclusive(async()=>{s.debug("adding stream handler",{keys:t}),this.listeners.set(n,{valid:!0,keys:t});const i={};for(const a of t){const o=r.get(a),c=o.leadingBuffer!=null?[o.leadingBuffer]:[];i[a]=new en(o.channel,c)}return n(i),await this.updateStreamer(),async()=>await this.removeStreamHandler(n)})}async removeStreamHandler(n){const{instrumentation:{L:t}}=this.props;await this.mu.runExclusive(()=>{const r=this.listeners.get(n);r!=null&&(r.valid=!1)}),setTimeout(()=>{this.mu.runExclusive(async()=>{if(t.debug("removing stream handler"),this.listeners.delete(n))return await this.updateStreamer();t.warn("attempted to remove non-existent stream handler")})},5e3)}async updateStreamer(){var i,a;if(this.closed)return;const{instrumentation:{L:n},core:t}=this.props,r=new Set;if(this.listeners.forEach(o=>o.keys.forEach(c=>r.add(c))),r.size===0){n.info("no keys to stream, closing streamer"),(i=this.streamer)==null||i.close(),this.streamerRunLoop!=null&&await this.streamerRunLoop,this.streamer=null,n.info("streamer closed successfully");return}const s=Array.from(r);if(d.F.primitiveArrays(s,((a=this.streamer)==null?void 0:a.keys)??[])===d.F.EQUAL){n.debug("streamer keys unchanged",{keys:s});return}this.streamer==null&&(n.info("creating new streamer",{keys:s}),this.streamer=await t.openStreamer(s),this.streamerRunLoop=this.runStreamer(this.streamer)),n.debug("updating streamer",{prev:this.streamer.keys,next:s});try{await this.streamer.update(s)}catch(o){throw n.error("failed to update streamer",{error:o}),o}}async runStreamer(n){const{cache:t,instrumentation:{L:r}}=this.props;try{for await(const s of n){const i=[];for(const a of s.keys){const o=s.get(a),c=t.get(a),u=c.writeDynamic(o.series);i.push(new en(c.channel,u))}this.listeners.forEach((a,o)=>{if(!a.valid)return;const c=i.filter(f=>a.keys.includes(f.channel.key));if(c.length===0)return;const u=Object.fromEntries(c.map(f=>[f.channel.key,f]));o(u)})}}catch(s){throw r.error("streamer run loop failed",{error:s},!0),s}}async close(){var n;(n=this.streamer)==null||n.close(),this.streamerRunLoop!=null&&await this.streamerRunLoop,this.closed=!0}}class Ja{constructor(){h(this,"key",d.xt.id());h(this,"_client",null)}async swap(n){var t;this.key=d.xt.id(),await((t=this._client)==null?void 0:t.close()),this._client=n}async retrieveChannel(n){return await this.client.retrieveChannel(n)}async read(n,t){return await this.client.read(n,t)}async stream(n,t){return await this.client.stream(n,t)}async close(){await this.client.close()}get client(){if(this._client==null)throw new d.se("No cluster has been connected");return this._client}}class to{constructor({instrumentation:n,core:t}){h(this,"key",d.xt.id());h(this,"ins");h(this,"cache");h(this,"reader");h(this,"streamer");h(this,"channelRetriever");this.ins=n??d.g$1.NOOP,this.channelRetriever=t.channels.createDebouncedBatchRetriever(10),this.cache=new Xa({channelRetriever:this.channelRetriever,instrumentation:this.ins.child("cache")}),this.reader=new Ka({cache:this.cache,readRemote:async(r,s)=>await t.read(r,s),instrumentation:this.ins.child("reader")}),this.streamer=new Qa({cache:this.cache,core:t,instrumentation:this.ins.child("streamer")})}async retrieveChannel(n){const t=await this.channelRetriever.retrieve([n]);if(t.length===0)throw new d.se(`channel ${n} not found`);return t[0]}async read(n,t){return await this.reader.read(n,t)}async stream(n,t){return await this.streamer.stream(n,t)}async close(){this.ins.L.info("closing client",{key:this.key}),await this.streamer.close(),this.cache.close()}}const mr=p.z.object({}),St=class St extends d.Composite{constructor(){super(...arguments);h(this,"client",new Ja);h(this,"factory",ni(this.client));h(this,"schema",St.stateZ);h(this,"prevClient",null)}create(t){const{instrumentation:r}=this.internal;r.L.debug("creating telem",{spec:t});const s=this.factory.create(t);if(s==null)throw new d.xe(`Telemetry service could not find a source for type ${t.type}`);return s}get clusterKey(){return this.client.key}registerFactory(t){this.factory.add(t)}equals(t){return t instanceof St?this.client._client===t.client._client:!1}async afterUpdate(){const t=Re(this.ctx),r=De(this.ctx,"telem");this.internal.instrumentation=r.child("provider"),t!==this.prevClient&&(r.L.info("swapping client",{client:t}),t==null?await this.client.swap(null):await this.client.swap(new to({core:t,instrumentation:r})),this.prevClient=t,xs(this.ctx,this))}};h(St,"TYPE","TelemProvider"),h(St,"stateZ",mr);let Zt=St;const oi={[Zt.TYPE]:Zt},eo=Object.freeze(Object.defineProperty({__proto__:null,AbstractSink:kn,AbstractSource:_,Base:Pn,BaseProvider:Zt,BooleanStatus:zt,ChannelData:ue,ColorGradient:Ot,CompoundTelemFactory:ei,FixedColorSource:ge,FixedNumber:fe,FixedString:pe,IterativeSeries:de,Mean:Yt,MultiSourceTransformer:Rs,NoopFactory:Es,PipelineFactory:zs,REGISTRY:oi,RemoteFactory:Os,RollingAverage:Lt,ScaleNumber:At,SetPoint:kt,SinkPipeline:le,SourcePipeline:oe,StaticFactory:Is,StreamChannelData:he,StreamChannelValue:ce,StringifyNumber:Dt,TransformerFactory:Fs,UnarySinkTransformer:Ys,UnarySourceTransformer:pt,WithinBounds:Rt,booleanSinkSpecZ:Mn,booleanSinkTransformerSpecZ:Ea,booleanSourceSpecZ:rr,booleanSourceTransformerSpecZ:Ca,booleanStatus:Ia,booleanStatusProps:Ws,channelData:As,colorGradient:Qs,colorGradientProps:Ks,colorSourceSpecZ:sr,connectionZ:or,factory:ni,fixedArray:Ra,fixedColor:La,fixedColorSourcePropsZ:Gs,fixedNumber:za,fixedNumberPropsZ:Us,fixedSeriesPropsZ:dr,fixedString:Da,fixedStringPropsZ:Bs,iterativeArray:Ya,iterativeSeriesPropsZ:$s,mean:Na,noopBooleanSinkSpec:Sn,noopBooleanSourceSpec:er,noopColorSourceSpec:En,noopNumericSinkSpec:bs,noopNumericSourceSpec:vs,noopSeriesSourceSpec:Ss,noopStatusSourceSpec:nr,noopStringSourceSpec:Ts,numberSinkSpecZ:ks,numberSourceSpecZ:Ps,providerStateZ:mr,registerFactory:ws,rollingAverage:Xs,rollingAverageProps:gr,scaleNumber:ti,scaleNumberProps:Js,seriesSourceSpecZ:Je,setProvider:xs,setpoint:Hs,sinkPipeline:Ls,sinkPipelinePropsZ:cr,sinkSpecZ:Cn,sinkTransformerSpecZ:Ms,sourcePipeline:Ds,sourcePipelinePropsZ:lr,sourceSpecZ:ot,sourceTransformerSpecZ:Cs,specZ:ze,statusSourceSpecZ:ir,streamChannelData:Zs,streamChannelValue:Ns,streamChannelValuePropsZ:ur,stringSourceSpecZ:ar,stringifyNumber:Vs,stringifyNumberProps:pr,useProvider:Tn,useSink:Ye,useSource:H,withinBounds:qs,withinBoundsProps:fr},Symbol.toStringTag,{value:"Module"})),li=p.z.object({key:p.z.string(),size:p.z.number(),order:p.z.number(),loc:l.K.outer});p.z.record(li);const ut=(e,n)=>Object.values(n).filter(({loc:t})=>t===e).sort((t,r)=>r.order-t.order),no=(e,n,t)=>{const r=n[e];if(r==null)return l.G.ZERO;const s=l.K.construct(r.loc),i=ut(s,n),a=l.K.construct(l.g.swap(l.K.direction(s))),o=ut(a,n),c=i.findIndex(({key:g})=>g===e),u=i.slice(0,c).reduce((g,{size:m})=>g+m,0),f=o.reduce((g,{size:m})=>g+m,0);switch(s){case"left":return l.G.translate(l.Mt.topLeft(t),[u,f]);case"right":return l.G.translate(l.Mt.topRight(t),[u-r.size,f]);case"top":return l.G.translate(l.Mt.topLeft(t),[f,u]);default:return l.G.translate(l.Mt.bottomLeft(t),[f,-u-r.size])}},ro=(e,n)=>{const t=ut("left",e),r=ut("right",e),s=ut("top",e),i=ut("bottom",e),a=t.reduce((f,{size:g})=>f+g,0),o=r.reduce((f,{size:g})=>f+g,0),c=s.reduce((f,{size:g})=>f+g,0),u=i.reduce((f,{size:g})=>f+g,0);return l.Mt.construct(l.G.translate(l.Mt.topLeft(n),{x:a,y:c}),l.Mt.width(n)-a-o,l.Mt.height(n)-c-u)};function _e(e,n){return e==null||n==null?NaN:e<n?-1:e>n?1:e>=n?0:NaN}function so(e,n){return e==null||n==null?NaN:n<e?-1:n>e?1:n>=e?0:NaN}function yr(e){let n,t,r;e.length!==2?(n=_e,t=(o,c)=>_e(e(o),c),r=(o,c)=>e(o)-c):(n=e===_e||e===so?e:io,t=e,r=e);function s(o,c,u=0,f=o.length){if(u<f){if(n(c,c)!==0)return f;do{const g=u+f>>>1;t(o[g],c)<0?u=g+1:f=g}while(u<f)}return u}function i(o,c,u=0,f=o.length){if(u<f){if(n(c,c)!==0)return f;do{const g=u+f>>>1;t(o[g],c)<=0?u=g+1:f=g}while(u<f)}return u}function a(o,c,u=0,f=o.length){const g=s(o,c,u,f-1);return g>u&&r(o[g-1],c)>-r(o[g],c)?g-1:g}return{left:s,center:a,right:i}}function io(){return 0}function ao(e){return e===null?NaN:+e}const oo=yr(_e),lo=oo.right;yr(ao).center;const co=Math.sqrt(50),uo=Math.sqrt(10),ho=Math.sqrt(2);function nn(e,n,t){const r=(n-e)/Math.max(0,t),s=Math.floor(Math.log10(r)),i=r/Math.pow(10,s),a=i>=co?10:i>=uo?5:i>=ho?2:1;let o,c,u;return s<0?(u=Math.pow(10,-s)/a,o=Math.round(e*u),c=Math.round(n*u),o/u<e&&++o,c/u>n&&--c,u=-u):(u=Math.pow(10,s)*a,o=Math.round(e/u),c=Math.round(n/u),o*u<e&&++o,c*u>n&&--c),c<o&&.5<=t&&t<2?nn(e,n,t*2):[o,c,u]}function fo(e,n,t){if(n=+n,e=+e,t=+t,!(t>0))return[];if(e===n)return[e];const r=n<e,[s,i,a]=r?nn(n,e,t):nn(e,n,t);if(!(i>=s))return[];const o=i-s+1,c=new Array(o);if(r)if(a<0)for(let u=0;u<o;++u)c[u]=(i-u)/-a;else for(let u=0;u<o;++u)c[u]=(i-u)*a;else if(a<0)for(let u=0;u<o;++u)c[u]=(s+u)/-a;else for(let u=0;u<o;++u)c[u]=(s+u)*a;return c}function Hn(e,n,t){return n=+n,e=+e,t=+t,nn(e,n,t)[2]}function qn(e,n,t){n=+n,e=+e,t=+t;const r=n<e,s=r?Hn(n,e,t):Hn(e,n,t);return(r?-1:1)*(s<0?1/-s:s)}function ci(e,n){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(n).domain(e);break}return this}function xr(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function ui(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function Le(){}var me=.7,rn=1/me,Pt="\\s*([+-]?\\d+)\\s*",ye="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",X="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",po=/^#([0-9a-f]{3,8})$/,go=new RegExp(`^rgb\\(${Pt},${Pt},${Pt}\\)$`),mo=new RegExp(`^rgb\\(${X},${X},${X}\\)$`),yo=new RegExp(`^rgba\\(${Pt},${Pt},${Pt},${ye}\\)$`),xo=new RegExp(`^rgba\\(${X},${X},${X},${ye}\\)$`),wo=new RegExp(`^hsl\\(${ye},${X},${X}\\)$`),bo=new RegExp(`^hsla\\(${ye},${X},${X},${ye}\\)$`),Ir={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};xr(Le,Nt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:$r,formatHex:$r,formatHex8:vo,formatHsl:To,formatRgb:Ur,toString:Ur});function $r(){return this.rgb().formatHex()}function vo(){return this.rgb().formatHex8()}function To(){return hi(this).formatHsl()}function Ur(){return this.rgb().formatRgb()}function Nt(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=po.exec(e))?(t=n[1].length,n=parseInt(n[1],16),t===6?Br(n):t===3?new U(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):t===8?Ie(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):t===4?Ie(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=go.exec(e))?new U(n[1],n[2],n[3],1):(n=mo.exec(e))?new U(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=yo.exec(e))?Ie(n[1],n[2],n[3],n[4]):(n=xo.exec(e))?Ie(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=wo.exec(e))?Fr(n[1],n[2]/100,n[3]/100,1):(n=bo.exec(e))?Fr(n[1],n[2]/100,n[3]/100,n[4]):Ir.hasOwnProperty(e)?Br(Ir[e]):e==="transparent"?new U(NaN,NaN,NaN,0):null}function Br(e){return new U(e>>16&255,e>>8&255,e&255,1)}function Ie(e,n,t,r){return r<=0&&(e=n=t=NaN),new U(e,n,t,r)}function So(e){return e instanceof Le||(e=Nt(e)),e?(e=e.rgb(),new U(e.r,e.g,e.b,e.opacity)):new U}function jn(e,n,t,r){return arguments.length===1?So(e):new U(e,n,t,r??1)}function U(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}xr(U,jn,ui(Le,{brighter(e){return e=e==null?rn:Math.pow(rn,e),new U(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?me:Math.pow(me,e),new U(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new U(dt(this.r),dt(this.g),dt(this.b),sn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Gr,formatHex:Gr,formatHex8:Eo,formatRgb:_r,toString:_r}));function Gr(){return`#${ht(this.r)}${ht(this.g)}${ht(this.b)}`}function Eo(){return`#${ht(this.r)}${ht(this.g)}${ht(this.b)}${ht((isNaN(this.opacity)?1:this.opacity)*255)}`}function _r(){const e=sn(this.opacity);return`${e===1?"rgb(":"rgba("}${dt(this.r)}, ${dt(this.g)}, ${dt(this.b)}${e===1?")":`, ${e})`}`}function sn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function dt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ht(e){return e=dt(e),(e<16?"0":"")+e.toString(16)}function Fr(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new j(e,n,t,r)}function hi(e){if(e instanceof j)return new j(e.h,e.s,e.l,e.opacity);if(e instanceof Le||(e=Nt(e)),!e)return new j;if(e instanceof j)return e;e=e.rgb();var n=e.r/255,t=e.g/255,r=e.b/255,s=Math.min(n,t,r),i=Math.max(n,t,r),a=NaN,o=i-s,c=(i+s)/2;return o?(n===i?a=(t-r)/o+(t<r)*6:t===i?a=(r-n)/o+2:a=(n-t)/o+4,o/=c<.5?i+s:2-i-s,a*=60):o=c>0&&c<1?0:a,new j(a,o,c,e.opacity)}function Co(e,n,t,r){return arguments.length===1?hi(e):new j(e,n,t,r??1)}function j(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}xr(j,Co,ui(Le,{brighter(e){return e=e==null?rn:Math.pow(rn,e),new j(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?me:Math.pow(me,e),new j(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,s=2*t-r;return new U(Ln(e>=240?e-240:e+120,s,r),Ln(e,s,r),Ln(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new j(Hr(this.h),$e(this.s),$e(this.l),sn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=sn(this.opacity);return`${e===1?"hsl(":"hsla("}${Hr(this.h)}, ${$e(this.s)*100}%, ${$e(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Hr(e){return e=(e||0)%360,e<0?e+360:e}function $e(e){return Math.max(0,Math.min(1,e||0))}function Ln(e,n,t){return(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)*255}const wr=e=>()=>e;function Mo(e,n){return function(t){return e+t*n}}function Po(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}function ko(e){return(e=+e)==1?di:function(n,t){return t-n?Po(n,t,e):wr(isNaN(n)?t:n)}}function di(e,n){var t=n-e;return t?Mo(e,t):wr(isNaN(e)?n:e)}const Wn=function e(n){var t=ko(n);function r(s,i){var a=t((s=jn(s)).r,(i=jn(i)).r),o=t(s.g,i.g),c=t(s.b,i.b),u=di(s.opacity,i.opacity);return function(f){return s.r=a(f),s.g=o(f),s.b=c(f),s.opacity=u(f),s+""}}return r.gamma=e,r}(1);function Ro(e,n){n||(n=[]);var t=e?Math.min(n.length,e.length):0,r=n.slice(),s;return function(i){for(s=0;s<t;++s)r[s]=e[s]*(1-i)+n[s]*i;return r}}function Yo(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function zo(e,n){var t=n?n.length:0,r=e?Math.min(t,e.length):0,s=new Array(r),i=new Array(t),a;for(a=0;a<r;++a)s[a]=br(e[a],n[a]);for(;a<t;++a)i[a]=n[a];return function(o){for(a=0;a<r;++a)i[a]=s[a](o);return i}}function Do(e,n){var t=new Date;return e=+e,n=+n,function(r){return t.setTime(e*(1-r)+n*r),t}}function xe(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}function Lo(e,n){var t={},r={},s;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(s in n)s in e?t[s]=br(e[s],n[s]):r[s]=n[s];return function(i){for(s in t)r[s]=t[s](i);return r}}var Vn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,On=new RegExp(Vn.source,"g");function Oo(e){return function(){return e}}function Ao(e){return function(n){return e(n)+""}}function fi(e,n){var t=Vn.lastIndex=On.lastIndex=0,r,s,i,a=-1,o=[],c=[];for(e=e+"",n=n+"";(r=Vn.exec(e))&&(s=On.exec(n));)(i=s.index)>t&&(i=n.slice(t,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,c.push({i:a,x:xe(r,s)})),t=On.lastIndex;return t<n.length&&(i=n.slice(t),o[a]?o[a]+=i:o[++a]=i),o.length<2?c[0]?Ao(c[0].x):Oo(n):(n=c.length,function(u){for(var f=0,g;f<n;++f)o[(g=c[f]).i]=g.x(u);return o.join("")})}function br(e,n){var t=typeof n,r;return n==null||t==="boolean"?wr(n):(t==="number"?xe:t==="string"?(r=Nt(n))?(n=r,Wn):fi:n instanceof Nt?Wn:n instanceof Date?Do:Yo(n)?Ro:Array.isArray(n)?zo:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?Lo:xe)(e,n)}function Zo(e,n){return e=+e,n=+n,function(t){return Math.round(e*(1-t)+n*t)}}function No(e){return function(){return e}}function Io(e){return+e}var qr=[0,1];function vt(e){return e}function Xn(e,n){return(n-=e=+e)?function(t){return(t-e)/n}:No(isNaN(n)?NaN:.5)}function $o(e,n){var t;return e>n&&(t=e,e=n,n=t),function(r){return Math.max(e,Math.min(n,r))}}function Uo(e,n,t){var r=e[0],s=e[1],i=n[0],a=n[1];return s<r?(r=Xn(s,r),i=t(a,i)):(r=Xn(r,s),i=t(i,a)),function(o){return i(r(o))}}function Bo(e,n,t){var r=Math.min(e.length,n.length)-1,s=new Array(r),i=new Array(r),a=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),n=n.slice().reverse());++a<r;)s[a]=Xn(e[a],e[a+1]),i[a]=t(n[a],n[a+1]);return function(o){var c=lo(e,o,1,r)-1;return i[c](s[c](o))}}function pi(e,n){return n.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Go(){var e=qr,n=qr,t=br,r,s,i,a=vt,o,c,u;function f(){var m=Math.min(e.length,n.length);return a!==vt&&(a=$o(e[0],e[m-1])),o=m>2?Bo:Uo,c=u=null,g}function g(m){return m==null||isNaN(m=+m)?i:(c||(c=o(e.map(r),n,t)))(r(a(m)))}return g.invert=function(m){return a(s((u||(u=o(n,e.map(r),xe)))(m)))},g.domain=function(m){return arguments.length?(e=Array.from(m,Io),f()):e.slice()},g.range=function(m){return arguments.length?(n=Array.from(m),f()):n.slice()},g.rangeRound=function(m){return n=Array.from(m),t=Zo,f()},g.clamp=function(m){return arguments.length?(a=m?!0:vt,f()):a!==vt},g.interpolate=function(m){return arguments.length?(t=m,f()):t},g.unknown=function(m){return arguments.length?(i=m,g):i},function(m,w){return r=m,s=w,f()}}function gi(){return Go()(vt,vt)}function _o(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function an(e,n){if((t=(e=n?e.toExponential(n-1):e.toExponential()).indexOf("e"))<0)return null;var t,r=e.slice(0,t);return[r.length>1?r[0]+r.slice(2):r,+e.slice(t+1)]}function It(e){return e=an(Math.abs(e)),e?e[1]:NaN}function Fo(e,n){return function(t,r){for(var s=t.length,i=[],a=0,o=e[0],c=0;s>0&&o>0&&(c+o+1>r&&(o=Math.max(1,r-c)),i.push(t.substring(s-=o,s+o)),!((c+=o+1)>r));)o=e[a=(a+1)%e.length];return i.reverse().join(n)}}function Ho(e){return function(n){return n.replace(/[0-9]/g,function(t){return e[+t]})}}var qo=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function on(e){if(!(n=qo.exec(e)))throw new Error("invalid format: "+e);var n;return new vr({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}on.prototype=vr.prototype;function vr(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}vr.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 jo(e){t:for(var n=e.length,t=1,r=-1,s;t<n;++t)switch(e[t]){case".":r=s=t;break;case"0":r===0&&(r=t),s=t;break;default:if(!+e[t])break t;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(s+1):e}var mi;function Wo(e,n){var t=an(e,n);if(!t)return e+"";var r=t[0],s=t[1],i=s-(mi=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,a=r.length;return i===a?r:i>a?r+new Array(i-a+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+an(e,Math.max(0,n+i-1))[0]}function jr(e,n){var t=an(e,n);if(!t)return e+"";var r=t[0],s=t[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const Wr={"%":(e,n)=>(e*100).toFixed(n),b:e=>Math.round(e).toString(2),c:e=>e+"",d:_o,e:(e,n)=>e.toExponential(n),f:(e,n)=>e.toFixed(n),g:(e,n)=>e.toPrecision(n),o:e=>Math.round(e).toString(8),p:(e,n)=>jr(e*100,n),r:jr,s:Wo,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Vr(e){return e}var Xr=Array.prototype.map,Kr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Vo(e){var n=e.grouping===void 0||e.thousands===void 0?Vr:Fo(Xr.call(e.grouping,Number),e.thousands+""),t=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",s=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?Vr:Ho(Xr.call(e.numerals,String)),a=e.percent===void 0?"%":e.percent+"",o=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(g){g=on(g);var m=g.fill,w=g.align,b=g.sign,T=g.symbol,S=g.zero,R=g.width,D=g.comma,M=g.precision,z=g.trim,A=g.type;A==="n"?(D=!0,A="g"):Wr[A]||(M===void 0&&(M=12),z=!0,A="g"),(S||m==="0"&&w==="=")&&(S=!0,m="0",w="=");var v=T==="$"?t:T==="#"&&/[boxX]/.test(A)?"0"+A.toLowerCase():"",Z=T==="$"?r:/[%p]/.test(A)?a:"",lt=Wr[A],Yn=/[defgprs%]/.test(A);M=M===void 0?6:/[gprs]/.test(A)?Math.max(1,Math.min(21,M)):Math.max(0,Math.min(20,M));function Ze(C){var Q=v,I=Z,st,Ne,yt;if(A==="c")I=lt(C)+I,C="";else{C=+C;var xt=C<0||1/C<0;if(C=isNaN(C)?c:lt(Math.abs(C),M),z&&(C=jo(C)),xt&&+C==0&&b!=="+"&&(xt=!1),Q=(xt?b==="("?b:o:b==="-"||b==="("?"":b)+Q,I=(A==="s"?Kr[8+mi/3]:"")+I+(xt&&b==="("?")":""),Yn){for(st=-1,Ne=C.length;++st<Ne;)if(yt=C.charCodeAt(st),48>yt||yt>57){I=(yt===46?s+C.slice(st+1):C.slice(st))+I,C=C.slice(0,st);break}}}D&&!S&&(C=n(C,1/0));var wt=Q.length+C.length+I.length,q=wt<R?new Array(R-wt+1).join(m):"";switch(D&&S&&(C=n(q+C,q.length?R-I.length:1/0),q=""),w){case"<":C=Q+C+I+q;break;case"=":C=Q+q+C+I;break;case"^":C=q.slice(0,wt=q.length>>1)+Q+C+I+q.slice(wt);break;default:C=q+Q+C+I;break}return i(C)}return Ze.toString=function(){return g+""},Ze}function f(g,m){var w=u((g=on(g),g.type="f",g)),b=Math.max(-8,Math.min(8,Math.floor(It(m)/3)))*3,T=Math.pow(10,-b),S=Kr[8+b/3];return function(R){return w(T*R)+S}}return{format:u,formatPrefix:f}}var Ue,yi,xi;Xo({thousands:",",grouping:[3],currency:["$",""]});function Xo(e){return Ue=Vo(e),yi=Ue.format,xi=Ue.formatPrefix,Ue}function Ko(e){return Math.max(0,-It(Math.abs(e)))}function Qo(e,n){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(It(n)/3)))*3-It(Math.abs(e)))}function Jo(e,n){return e=Math.abs(e),n=Math.abs(n)-e,Math.max(0,It(n)-It(e))+1}function tl(e,n,t,r){var s=qn(e,n,t),i;switch(r=on(r??",f"),r.type){case"s":{var a=Math.max(Math.abs(e),Math.abs(n));return r.precision==null&&!isNaN(i=Qo(s,a))&&(r.precision=i),xi(r,a)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=Jo(s,Math.max(Math.abs(e),Math.abs(n))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=Ko(s))&&(r.precision=i-(r.type==="%")*2);break}}return yi(r)}function el(e){var n=e.domain;return e.ticks=function(t){var r=n();return fo(r[0],r[r.length-1],t??10)},e.tickFormat=function(t,r){var s=n();return tl(s[0],s[s.length-1],t??10,r)},e.nice=function(t){t==null&&(t=10);var r=n(),s=0,i=r.length-1,a=r[s],o=r[i],c,u,f=10;for(o<a&&(u=a,a=o,o=u,u=s,s=i,i=u);f-- >0;){if(u=Hn(a,o,t),u===c)return r[s]=a,r[i]=o,n(r);if(u>0)a=Math.floor(a/u)*u,o=Math.ceil(o/u)*u;else if(u<0)a=Math.ceil(a*u)/u,o=Math.floor(o*u)/u;else break;c=u}return e},e}function wi(){var e=gi();return e.copy=function(){return pi(e,wi())},ci.apply(e,arguments),el(e)}function nl(e,n){e=e.slice();var t=0,r=e.length-1,s=e[t],i=e[r],a;return i<s&&(a=t,t=r,r=a,a=s,s=i,i=a),e[t]=n.floor(s),e[r]=n.ceil(i),e}const An=new Date,Zn=new Date;function L(e,n,t,r){function s(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return s.floor=i=>(e(i=new Date(+i)),i),s.ceil=i=>(e(i=new Date(i-1)),n(i,1),e(i),i),s.round=i=>{const a=s(i),o=s.ceil(i);return i-a<o-i?a:o},s.offset=(i,a)=>(n(i=new Date(+i),a==null?1:Math.floor(a)),i),s.range=(i,a,o)=>{const c=[];if(i=s.ceil(i),o=o==null?1:Math.floor(o),!(i<a)||!(o>0))return c;let u;do c.push(u=new Date(+i)),n(i,o),e(i);while(u<i&&i<a);return c},s.filter=i=>L(a=>{if(a>=a)for(;e(a),!i(a);)a.setTime(a-1)},(a,o)=>{if(a>=a)if(o<0)for(;++o<=0;)for(;n(a,-1),!i(a););else for(;--o>=0;)for(;n(a,1),!i(a););}),t&&(s.count=(i,a)=>(An.setTime(+i),Zn.setTime(+a),e(An),e(Zn),Math.floor(t(An,Zn))),s.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?s.filter(r?a=>r(a)%i===0:a=>s.count(0,a)%i===0):s)),s}const ln=L(()=>{},(e,n)=>{e.setTime(+e+n)},(e,n)=>n-e);ln.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?L(n=>{n.setTime(Math.floor(n/e)*e)},(n,t)=>{n.setTime(+n+t*e)},(n,t)=>(t-n)/e):ln);ln.range;const J=1e3,F=J*60,tt=F*60,nt=tt*24,Tr=nt*7,Qr=nt*30,Nn=nt*365,Tt=L(e=>{e.setTime(e-e.getMilliseconds())},(e,n)=>{e.setTime(+e+n*J)},(e,n)=>(n-e)/J,e=>e.getUTCSeconds());Tt.range;const Sr=L(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*J)},(e,n)=>{e.setTime(+e+n*F)},(e,n)=>(n-e)/F,e=>e.getMinutes());Sr.range;const rl=L(e=>{e.setUTCSeconds(0,0)},(e,n)=>{e.setTime(+e+n*F)},(e,n)=>(n-e)/F,e=>e.getUTCMinutes());rl.range;const Er=L(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*J-e.getMinutes()*F)},(e,n)=>{e.setTime(+e+n*tt)},(e,n)=>(n-e)/tt,e=>e.getHours());Er.range;const sl=L(e=>{e.setUTCMinutes(0,0,0)},(e,n)=>{e.setTime(+e+n*tt)},(e,n)=>(n-e)/tt,e=>e.getUTCHours());sl.range;const Oe=L(e=>e.setHours(0,0,0,0),(e,n)=>e.setDate(e.getDate()+n),(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*F)/nt,e=>e.getDate()-1);Oe.range;const Cr=L(e=>{e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n)},(e,n)=>(n-e)/nt,e=>e.getUTCDate()-1);Cr.range;const il=L(e=>{e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n)},(e,n)=>(n-e)/nt,e=>Math.floor(e/nt));il.range;function gt(e){return L(n=>{n.setDate(n.getDate()-(n.getDay()+7-e)%7),n.setHours(0,0,0,0)},(n,t)=>{n.setDate(n.getDate()+t*7)},(n,t)=>(t-n-(t.getTimezoneOffset()-n.getTimezoneOffset())*F)/Tr)}const Rn=gt(0),cn=gt(1),al=gt(2),ol=gt(3),$t=gt(4),ll=gt(5),cl=gt(6);Rn.range;cn.range;al.range;ol.range;$t.range;ll.range;cl.range;function mt(e){return L(n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-e)%7),n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCDate(n.getUTCDate()+t*7)},(n,t)=>(t-n)/Tr)}const bi=mt(0),un=mt(1),ul=mt(2),hl=mt(3),Ut=mt(4),dl=mt(5),fl=mt(6);bi.range;un.range;ul.range;hl.range;Ut.range;dl.range;fl.range;const Mr=L(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,n)=>{e.setMonth(e.getMonth()+n)},(e,n)=>n.getMonth()-e.getMonth()+(n.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Mr.range;const pl=L(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCMonth(e.getUTCMonth()+n)},(e,n)=>n.getUTCMonth()-e.getUTCMonth()+(n.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());pl.range;const rt=L(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n)},(e,n)=>n.getFullYear()-e.getFullYear(),e=>e.getFullYear());rt.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:L(n=>{n.setFullYear(Math.floor(n.getFullYear()/e)*e),n.setMonth(0,1),n.setHours(0,0,0,0)},(n,t)=>{n.setFullYear(n.getFullYear()+t*e)});rt.range;const ft=L(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n)},(e,n)=>n.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ft.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:L(n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/e)*e),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},(n,t)=>{n.setUTCFullYear(n.getUTCFullYear()+t*e)});ft.range;function gl(e,n,t,r,s,i){const a=[[Tt,1,J],[Tt,5,5*J],[Tt,15,15*J],[Tt,30,30*J],[i,1,F],[i,5,5*F],[i,15,15*F],[i,30,30*F],[s,1,tt],[s,3,3*tt],[s,6,6*tt],[s,12,12*tt],[r,1,nt],[r,2,2*nt],[t,1,Tr],[n,1,Qr],[n,3,3*Qr],[e,1,Nn]];function o(u,f,g){const m=f<u;m&&([u,f]=[f,u]);const w=g&&typeof g.range=="function"?g:c(u,f,g),b=w?w.range(u,+f+1):[];return m?b.reverse():b}function c(u,f,g){const m=Math.abs(f-u)/g,w=yr(([,,S])=>S).right(a,m);if(w===a.length)return e.every(qn(u/Nn,f/Nn,g));if(w===0)return ln.every(Math.max(qn(u,f,g),1));const[b,T]=a[m/a[w-1][2]<a[w][2]/m?w-1:w];return b.every(T)}return[o,c]}const[ml,yl]=gl(rt,Mr,Rn,Oe,Er,Sr);function In(e){if(0<=e.y&&e.y<100){var n=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return n.setFullYear(e.y),n}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function $n(e){if(0<=e.y&&e.y<100){var n=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return n.setUTCFullYear(e.y),n}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Wt(e,n,t){return{y:e,m:n,d:t,H:0,M:0,S:0,L:0}}function xl(e){var n=e.dateTime,t=e.date,r=e.time,s=e.periods,i=e.days,a=e.shortDays,o=e.months,c=e.shortMonths,u=Vt(s),f=Xt(s),g=Vt(i),m=Xt(i),w=Vt(a),b=Xt(a),T=Vt(o),S=Xt(o),R=Vt(c),D=Xt(c),M={a:xt,A:wt,b:q,B:ia,c:null,d:ss,e:ss,f:Bl,g:Kl,G:Jl,H:Il,I:$l,j:Ul,L:vi,m:Gl,M:_l,p:aa,q:oa,Q:os,s:ls,S:Fl,u:Hl,U:ql,V:jl,w:Wl,W:Vl,x:null,X:null,y:Xl,Y:Ql,Z:tc,"%":as},z={a:la,A:ca,b:ua,B:ha,c:null,d:is,e:is,f:sc,g:pc,G:mc,H:ec,I:nc,j:rc,L:Si,m:ic,M:ac,p:da,q:fa,Q:os,s:ls,S:oc,u:lc,U:cc,V:uc,w:hc,W:dc,x:null,X:null,y:fc,Y:gc,Z:yc,"%":as},A={a:Ze,A:C,b:Q,B:I,c:st,d:ns,e:ns,f:Ol,g:es,G:ts,H:rs,I:rs,j:Yl,L:Ll,m:Rl,M:zl,p:Yn,q:kl,Q:Zl,s:Nl,S:Dl,u:Sl,U:El,V:Cl,w:Tl,W:Ml,x:Ne,X:yt,y:es,Y:ts,Z:Pl,"%":Al};M.x=v(t,M),M.X=v(r,M),M.c=v(n,M),z.x=v(t,z),z.X=v(r,z),z.c=v(n,z);function v(x,E){return function(P){var y=[],$=-1,Y=0,B=x.length,G,ct,Ar;for(P instanceof Date||(P=new Date(+P));++$<B;)x.charCodeAt($)===37&&(y.push(x.slice(Y,$)),(ct=Jr[G=x.charAt(++$)])!=null?G=x.charAt(++$):ct=G==="e"?" ":"0",(Ar=E[G])&&(G=Ar(P,ct)),y.push(G),Y=$+1);return y.push(x.slice(Y,$)),y.join("")}}function Z(x,E){return function(P){var y=Wt(1900,void 0,1),$=lt(y,x,P+="",0),Y,B;if($!=P.length)return null;if("Q"in y)return new Date(y.Q);if("s"in y)return new Date(y.s*1e3+("L"in y?y.L:0));if(E&&!("Z"in y)&&(y.Z=0),"p"in y&&(y.H=y.H%12+y.p*12),y.m===void 0&&(y.m="q"in y?y.q:0),"V"in y){if(y.V<1||y.V>53)return null;"w"in y||(y.w=1),"Z"in y?(Y=$n(Wt(y.y,0,1)),B=Y.getUTCDay(),Y=B>4||B===0?un.ceil(Y):un(Y),Y=Cr.offset(Y,(y.V-1)*7),y.y=Y.getUTCFullYear(),y.m=Y.getUTCMonth(),y.d=Y.getUTCDate()+(y.w+6)%7):(Y=In(Wt(y.y,0,1)),B=Y.getDay(),Y=B>4||B===0?cn.ceil(Y):cn(Y),Y=Oe.offset(Y,(y.V-1)*7),y.y=Y.getFullYear(),y.m=Y.getMonth(),y.d=Y.getDate()+(y.w+6)%7)}else("W"in y||"U"in y)&&("w"in y||(y.w="u"in y?y.u%7:"W"in y?1:0),B="Z"in y?$n(Wt(y.y,0,1)).getUTCDay():In(Wt(y.y,0,1)).getDay(),y.m=0,y.d="W"in y?(y.w+6)%7+y.W*7-(B+5)%7:y.w+y.U*7-(B+6)%7);return"Z"in y?(y.H+=y.Z/100|0,y.M+=y.Z%100,$n(y)):In(y)}}function lt(x,E,P,y){for(var $=0,Y=E.length,B=P.length,G,ct;$<Y;){if(y>=B)return-1;if(G=E.charCodeAt($++),G===37){if(G=E.charAt($++),ct=A[G in Jr?E.charAt($++):G],!ct||(y=ct(x,P,y))<0)return-1}else if(G!=P.charCodeAt(y++))return-1}return y}function Yn(x,E,P){var y=u.exec(E.slice(P));return y?(x.p=f.get(y[0].toLowerCase()),P+y[0].length):-1}function Ze(x,E,P){var y=w.exec(E.slice(P));return y?(x.w=b.get(y[0].toLowerCase()),P+y[0].length):-1}function C(x,E,P){var y=g.exec(E.slice(P));return y?(x.w=m.get(y[0].toLowerCase()),P+y[0].length):-1}function Q(x,E,P){var y=R.exec(E.slice(P));return y?(x.m=D.get(y[0].toLowerCase()),P+y[0].length):-1}function I(x,E,P){var y=T.exec(E.slice(P));return y?(x.m=S.get(y[0].toLowerCase()),P+y[0].length):-1}function st(x,E,P){return lt(x,n,E,P)}function Ne(x,E,P){return lt(x,t,E,P)}function yt(x,E,P){return lt(x,r,E,P)}function xt(x){return a[x.getDay()]}function wt(x){return i[x.getDay()]}function q(x){return c[x.getMonth()]}function ia(x){return o[x.getMonth()]}function aa(x){return s[+(x.getHours()>=12)]}function oa(x){return 1+~~(x.getMonth()/3)}function la(x){return a[x.getUTCDay()]}function ca(x){return i[x.getUTCDay()]}function ua(x){return c[x.getUTCMonth()]}function ha(x){return o[x.getUTCMonth()]}function da(x){return s[+(x.getUTCHours()>=12)]}function fa(x){return 1+~~(x.getUTCMonth()/3)}return{format:function(x){var E=v(x+="",M);return E.toString=function(){return x},E},parse:function(x){var E=Z(x+="",!1);return E.toString=function(){return x},E},utcFormat:function(x){var E=v(x+="",z);return E.toString=function(){return x},E},utcParse:function(x){var E=Z(x+="",!0);return E.toString=function(){return x},E}}}var Jr={"-":"",_:" ",0:"0"},O=/^\s*\d+/,wl=/^%/,bl=/[\\^$*+?|[\]().{}]/g;function k(e,n,t){var r=e<0?"-":"",s=(r?-e:e)+"",i=s.length;return r+(i<t?new Array(t-i+1).join(n)+s:s)}function vl(e){return e.replace(bl,"\\$&")}function Vt(e){return new RegExp("^(?:"+e.map(vl).join("|")+")","i")}function Xt(e){return new Map(e.map((n,t)=>[n.toLowerCase(),t]))}function Tl(e,n,t){var r=O.exec(n.slice(t,t+1));return r?(e.w=+r[0],t+r[0].length):-1}function Sl(e,n,t){var r=O.exec(n.slice(t,t+1));return r?(e.u=+r[0],t+r[0].length):-1}function El(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.U=+r[0],t+r[0].length):-1}function Cl(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.V=+r[0],t+r[0].length):-1}function Ml(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.W=+r[0],t+r[0].length):-1}function ts(e,n,t){var r=O.exec(n.slice(t,t+4));return r?(e.y=+r[0],t+r[0].length):-1}function es(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),t+r[0].length):-1}function Pl(e,n,t){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(t,t+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),t+r[0].length):-1}function kl(e,n,t){var r=O.exec(n.slice(t,t+1));return r?(e.q=r[0]*3-3,t+r[0].length):-1}function Rl(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.m=r[0]-1,t+r[0].length):-1}function ns(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.d=+r[0],t+r[0].length):-1}function Yl(e,n,t){var r=O.exec(n.slice(t,t+3));return r?(e.m=0,e.d=+r[0],t+r[0].length):-1}function rs(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.H=+r[0],t+r[0].length):-1}function zl(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.M=+r[0],t+r[0].length):-1}function Dl(e,n,t){var r=O.exec(n.slice(t,t+2));return r?(e.S=+r[0],t+r[0].length):-1}function Ll(e,n,t){var r=O.exec(n.slice(t,t+3));return r?(e.L=+r[0],t+r[0].length):-1}function Ol(e,n,t){var r=O.exec(n.slice(t,t+6));return r?(e.L=Math.floor(r[0]/1e3),t+r[0].length):-1}function Al(e,n,t){var r=wl.exec(n.slice(t,t+1));return r?t+r[0].length:-1}function Zl(e,n,t){var r=O.exec(n.slice(t));return r?(e.Q=+r[0],t+r[0].length):-1}function Nl(e,n,t){var r=O.exec(n.slice(t));return r?(e.s=+r[0],t+r[0].length):-1}function ss(e,n){return k(e.getDate(),n,2)}function Il(e,n){return k(e.getHours(),n,2)}function $l(e,n){return k(e.getHours()%12||12,n,2)}function Ul(e,n){return k(1+Oe.count(rt(e),e),n,3)}function vi(e,n){return k(e.getMilliseconds(),n,3)}function Bl(e,n){return vi(e,n)+"000"}function Gl(e,n){return k(e.getMonth()+1,n,2)}function _l(e,n){return k(e.getMinutes(),n,2)}function Fl(e,n){return k(e.getSeconds(),n,2)}function Hl(e){var n=e.getDay();return n===0?7:n}function ql(e,n){return k(Rn.count(rt(e)-1,e),n,2)}function Ti(e){var n=e.getDay();return n>=4||n===0?$t(e):$t.ceil(e)}function jl(e,n){return e=Ti(e),k($t.count(rt(e),e)+(rt(e).getDay()===4),n,2)}function Wl(e){return e.getDay()}function Vl(e,n){return k(cn.count(rt(e)-1,e),n,2)}function Xl(e,n){return k(e.getFullYear()%100,n,2)}function Kl(e,n){return e=Ti(e),k(e.getFullYear()%100,n,2)}function Ql(e,n){return k(e.getFullYear()%1e4,n,4)}function Jl(e,n){var t=e.getDay();return e=t>=4||t===0?$t(e):$t.ceil(e),k(e.getFullYear()%1e4,n,4)}function tc(e){var n=e.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+k(n/60|0,"0",2)+k(n%60,"0",2)}function is(e,n){return k(e.getUTCDate(),n,2)}function ec(e,n){return k(e.getUTCHours(),n,2)}function nc(e,n){return k(e.getUTCHours()%12||12,n,2)}function rc(e,n){return k(1+Cr.count(ft(e),e),n,3)}function Si(e,n){return k(e.getUTCMilliseconds(),n,3)}function sc(e,n){return Si(e,n)+"000"}function ic(e,n){return k(e.getUTCMonth()+1,n,2)}function ac(e,n){return k(e.getUTCMinutes(),n,2)}function oc(e,n){return k(e.getUTCSeconds(),n,2)}function lc(e){var n=e.getUTCDay();return n===0?7:n}function cc(e,n){return k(bi.count(ft(e)-1,e),n,2)}function Ei(e){var n=e.getUTCDay();return n>=4||n===0?Ut(e):Ut.ceil(e)}function uc(e,n){return e=Ei(e),k(Ut.count(ft(e),e)+(ft(e).getUTCDay()===4),n,2)}function hc(e){return e.getUTCDay()}function dc(e,n){return k(un.count(ft(e)-1,e),n,2)}function fc(e,n){return k(e.getUTCFullYear()%100,n,2)}function pc(e,n){return e=Ei(e),k(e.getUTCFullYear()%100,n,2)}function gc(e,n){return k(e.getUTCFullYear()%1e4,n,4)}function mc(e,n){var t=e.getUTCDay();return e=t>=4||t===0?Ut(e):Ut.ceil(e),k(e.getUTCFullYear()%1e4,n,4)}function yc(){return"+0000"}function as(){return"%"}function os(e){return+e}function ls(e){return Math.floor(+e/1e3)}var bt,Ci;xc({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function xc(e){return bt=xl(e),Ci=bt.format,bt.parse,bt.utcFormat,bt.utcParse,bt}function wc(e){return new Date(e)}function bc(e){return e instanceof Date?+e:+new Date(+e)}function Mi(e,n,t,r,s,i,a,o,c,u){var f=gi(),g=f.invert,m=f.domain,w=u(".%L"),b=u(":%S"),T=u("%I:%M"),S=u("%I %p"),R=u("%a %d"),D=u("%b %d"),M=u("%B"),z=u("%Y");function A(v){return(c(v)<v?w:o(v)<v?b:a(v)<v?T:i(v)<v?S:r(v)<v?s(v)<v?R:D:t(v)<v?M:z)(v)}return f.invert=function(v){return new Date(g(v))},f.domain=function(v){return arguments.length?m(Array.from(v,bc)):m().map(wc)},f.ticks=function(v){var Z=m();return e(Z[0],Z[Z.length-1],v??10)},f.tickFormat=function(v,Z){return Z==null?A:u(Z)},f.nice=function(v){var Z=m();return(!v||typeof v.range!="function")&&(v=n(Z[0],Z[Z.length-1],v??10)),v?m(nl(Z,v)):f},f.copy=function(){return pi(f,Mi(e,n,t,r,s,i,a,o,c,u))},f}function vc(){return ci.apply(Mi(ml,yl,rt,Mr,Rn,Oe,Er,Sr,Tt,Ci).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}const Pr=p.z.enum(["linear","time"]),kr=p.z.object({tickSpacing:p.z.number().default(75),type:Pr.optional().default("linear")}),Kn=e=>{const n=kr.parse(e);return Ec[n.type](n)};class Tc{constructor(n){h(this,"props");this.props=n}generate({decimalToDataScale:n,size:t}){const r=[0,t],s=[new d.m(n.pos(0)).date(),new d.m(n.pos(1)).date()],i=vc().domain(s).range(r);return i.ticks(Pi(t,this.props.tickSpacing)).map(o=>({label:this.tickLabel(o),position:i(o)}))}tickLabel(n){const t=new d.m(n).date();let r=`:${t.getSeconds()}`;if(t.getMilliseconds()!==0){const i=Math.round(t.getMilliseconds()).toString().padStart(3,"0").replace(/0+$/,"");r+=`.${i}`}return t.getSeconds()===0&&t.getMilliseconds()===0&&(r=`${t.getHours()}:${t.getMinutes().toString().padStart(2,"0")}`),r}}class Sc{constructor(n){h(this,"props");this.props=n}generate({decimalToDataScale:n,size:t}){const r=[0,t],s=[n.pos(0),n.pos(1)],i=wi().domain(s).range(r),a=Pi(t,this.props.tickSpacing);return i.ticks(a).map(c=>({label:this.tickLabel(c),position:i(c)}))}tickLabel(n){return n.toString()}}const Pi=(e,n)=>{const t=Math.floor(e/n);return t>0?t:1},Ec={linear:e=>new Sc(e),time:e=>new Tc(e)},Rr=kr.extend({color:l.Color.z,type:Pr.optional().default("linear"),font:p.z.string(),showGrid:p.z.boolean().optional().default(!0),location:l.K.outer,gridColor:l.Color.z}),W=4;class cs{constructor(n,t){h(this,"numberDims");h(this,"negativeWidth");h(this,"periodWidth");h(this,"colonWidth");this.numberDims=d.dimensions("0",t,n),this.negativeWidth=d.dimensions("-",t,n).width,this.periodWidth=d.dimensions(".",t,n).width,this.colonWidth=d.dimensions(":",t,n).width}get(n){const t={width:0,height:this.numberDims.height};let r=n.length;return n.includes(".")&&(t.width+=this.periodWidth,r-=1),n.startsWith("-")&&(t.width+=this.negativeWidth,r-=1),n.includes(":")&&(t.width+=this.colonWidth,r-=1),t.width+=r*this.numberDims.width,t}}let ki=class{constructor(n,t){h(this,"ctx");h(this,"state");h(this,"tickFactory");h(this,"dimensions");this.ctx=n,this.state=t,this.tickFactory=Kn(this.state),this.dimensions=new cs(n.lower2d,t.font)}setState(n){this.state=d.prettyParse(Rr,n),this.tickFactory=Kn(n),this.dimensions=new cs(this.ctx.lower2d,this.state.font)}render(n){const{lower2d:t}=this.ctx;switch(t.font=this.state.font,t.fillStyle=this.state.color.hex,t.lineWidth=1,this.state.location){case"left":return this.drawLeft(n);case"right":return this.drawRight(n);case"top":return this.drawTop(n);default:return this.drawBottom(n)}}drawBottom(n){const{lower2d:t}=this.ctx,{plot:r}=n,s=l.Mt.width(r),i=l.Mt.height(r),a=n.position,o=this.tickFactory.generate({...n,size:s});return this.maybeDrawGrid(s,o,u=>[l.G.translate(a,"x",u.position),l.G.translate(a,{x:u.position,y:-i})]),t.strokeStyle=this.state.color.hex,this.drawLine(a,l.G.translate(a,"x",s)),{size:this.drawTicks(o,(u,f)=>{t.moveTo(a.x+f.position,a.y),t.lineTo(a.x+f.position,a.y+W),t.stroke(),t.fillText(f.label,a.x+f.position-u.width/2,a.y+5+u.height)}).height+W+6}}drawTop(n){const{lower2d:t}=this.ctx,{plot:r}=n,s=l.Mt.width(r),i=l.Mt.height(r),a=l.G.translate(n.position,"y",n.size),o=this.tickFactory.generate({...n,size:s});return this.maybeDrawGrid(s,o,u=>[l.G.translate(a,"x",u.position),l.G.translate(a,{x:u.position,y:i})]),t.strokeStyle=this.state.color.hex,this.drawLine(a,l.G.translate(a,"x",s)),{size:this.drawTicks(o,(u,f)=>{t.moveTo(a.x+f.position,a.y),t.lineTo(a.x+f.position,a.y-W),t.stroke(),t.fillText(f.label,a.x+f.position-u.width/2,a.y-5-u.height)}).height+W}}drawLeft(n){const{lower2d:t}=this.ctx,{plot:r}=n,s=l.Mt.height(r),i=l.Mt.width(r),a=l.G.translate(n.position,"x",n.size),o=this.tickFactory.generate({...n,size:s});return this.maybeDrawGrid(s,o,u=>[l.G.translate(a,"y",u.position),l.G.translate(a,{x:i,y:u.position})]),t.strokeStyle=this.state.color.hex,this.drawLine(a,l.G.translate(a,"y",s)),{size:this.drawTicks(o,(u,f)=>{t.moveTo(a.x,a.y+f.position),t.lineTo(a.x-W,a.y+f.position),t.stroke(),t.fillText(f.label,a.x-u.width-W*2,a.y+f.position+u.height/3)}).width+W*2}}drawRight(n){const{lower2d:t}=this.ctx,{plot:r}=n,s=l.Mt.height(r),i=l.Mt.width(r),a=n.position,o=this.tickFactory.generate({...n,size:s});return this.maybeDrawGrid(s,o,u=>[l.G.translate(a,"y",u.position),l.G.translate(a,{x:-i,y:u.position})]),t.strokeStyle=this.state.color.hex,this.drawLine(a,l.G.translate(a,"y",s)),{size:this.drawTicks(o,(u,f)=>{t.moveTo(a.x,a.y+f.position),t.lineTo(a.x+W,a.y+f.position),t.stroke(),t.fillText(f.label,a.x+W+2,a.y+f.position+u.height/3)}).width+W*2}}drawLine(n,t){const{lower2d:r}=this.ctx;r.beginPath(),r.moveTo(...l.G.couple(n)),r.lineTo(...l.G.couple(t)),r.stroke()}drawTicks(n,t){let r=l._.ZERO;return n.forEach(s=>{const i=this.dimensions.get(s.label);r=l._.max([r,i]),t(i,s)}),r}maybeDrawGrid(n,t,r){const{showGrid:s,gridColor:i}=this.state;if(s){const a=l.H.construct(-1,1),o=l.H.construct(n-1,n+1);this.ctx.lower2d.strokeStyle=i.hex,t.filter(({position:c})=>!l.H.contains(a,c)&&!l.H.contains(o,c)).forEach(c=>this.drawLine(...r(c)))}}};const Ae=Rr.extend({bounds:l.H.bounds.optional(),autoBounds:p.z.object({lower:p.z.boolean().optional().default(!0),upper:p.z.boolean().optional().default(!0)}).or(p.z.boolean().optional().default(!0)),autoBoundPadding:p.z.number().optional(),autoBoundUpdateInterval:d.w.z.optional().default(d.w.seconds(10)),size:p.z.number().optional().default(0),label:p.z.string().optional().default(""),labelSize:p.z.number().optional().default(0)}).partial({color:!0,font:!0,gridColor:!0}),Cc=2,Mc=7,Ri=(e,n)=>l.H.contains({lower:e-Mc,upper:e+Cc},n),Pc=l.H.DECIMAL,us=d.m.now(),kc={lower:Number(us.valueOf()),upper:Number(us.add(d.w.HOUR).valueOf())},Yi=e=>e==="linear"?Pc:kc,Rc=(e,n=.1,t)=>{const r=l.H.max(e.filter(l.H.isFinite));if(!l.H.isFinite(r))return Yi(t);const{lower:s,upper:i}=r;if(i===s)return{lower:s-1,upper:i+1};const a=(i-s)*n;return{lower:s-a,upper:i+a}},Yc=.01,zc=.1;class zi extends d.Composite{async afterUpdate(){var t,r;this.internal.render=d.Context.use(this.ctx);const n=d.use(this.ctx);(t=this.state).autoBoundPadding??(t.autoBoundPadding=l.g.construct(this.state.location)==="x"?zc:Yc),this.internal.core=new ki(this.internal.render,{color:n.colors.gray.l8,font:d.fontString(n,{level:"small"}),gridColor:n.colors.gray.l1,...this.state}),N.requestRender(this.ctx,K),(r=this.internal).updateBounds??(r.updateBounds=d.r(s=>this.setState(i=>({...i,bounds:s})),this.state.autoBoundUpdateInterval.milliseconds))}async afterDelete(){N.requestRender(this.ctx,K)}renderAxis(n,t){if(!n.canvases.includes("lower2d"))return;const{core:r}=this.internal,{grid:s,container:i}=n,a=no(`${this.type}-${this.key}`,s,i),o={...n,position:a,decimalToDataScale:t,size:this.state.size+this.state.labelSize},{size:c}=r.render(o);Ri(this.state.size,c)||this.setState(u=>({...u,size:c}))}async bounds(n,t){var u,f;if(n&&this.internal.boundSnapshot!=null)return[this.internal.boundSnapshot,null];const{lower:r,upper:s}=Di(this.state.autoBounds);if(!r&&!s&&this.state.bounds!=null)return this.internal.boundSnapshot=this.state.bounds,[this.state.bounds,null];const i=g=>({upper:s||this.state.bounds==null?g.upper:this.state.bounds.upper,lower:r||this.state.bounds==null?g.lower:this.state.bounds.lower});let a,o=null;try{const g=await t();a=Rc(g,this.state.autoBoundPadding,this.state.type)}catch(g){a=Yi(this.state.type),o=g}const c=i(a);return this.internal.boundSnapshot=c,(this.state.bounds==null||r&&this.state.bounds.lower!==c.lower||s&&this.state.bounds.upper!==c.upper)&&((f=(u=this.internal).updateBounds)==null||f.call(u,c)),[c,o]}async dataToDecimalScale(n,t,r){const[s,i]=await this.bounds(n,t),a=l.g.swap(l.g.construct(this.state.location));return[l.b.Scale.scale(s).scale(1).translate(-l.Mt.root(r)[a]).magnify(1/l.Mt.dim(r,a)),i]}}const Di=e=>typeof e=="boolean"?{lower:e,upper:e}:{lower:(e==null?void 0:e.lower)??!0,upper:(e==null?void 0:e.upper)??!0},hs=`#version 300 es
7
- precision lowp float;
8
-
9
- uniform lowp vec4 u_color;
10
- out vec4 fragColor;
11
-
12
- void main(void) {
13
- fragColor = u_color;
14
- }
15
- `,Dc=`#version 300 es
16
-
17
- // Copyright 2024 Synnax Labs, Inc.
18
- //
19
- // Use of this software is governed by the Business Source License included in the file
20
- // licenses/BSL.txt.
21
- //
22
- // As of the Change Date specified in that file, in accordance with the Business Source
23
- // License, use of this software will be governed by the Apache License, Version 2.0,
24
- // included in the file licenses/APL.txt.
25
-
26
- in mediump float a_x;
27
- in mediump float a_y;
28
- in mediump vec2 a_translate;
29
-
30
- uniform mediump vec2 u_scale_aggregate;
31
- uniform mediump vec2 u_offset_aggregate;
32
-
33
- void main(void) {
34
- gl_Position = vec4((u_scale_aggregate * vec2(a_x, a_y) + u_offset_aggregate) + a_translate, 0.0, 1.0);
35
- }
36
- `,Lc=`#version 300 es
37
-
38
- // Copyright 2024 Synnax Labs, Inc.
39
- //
40
- // Use of this software is governed by the Business Source License included in the file
41
- // licenses/BSL.txt.
42
- //
43
- // As of the Change Date specified in that file, in accordance with the Business Source
44
- // License, use of this software will be governed by the Apache License, Version 2.0,
45
- // included in the file licenses/APL.txt.
46
-
47
- in mediump float a_x;
48
- in mediump uint a_y;
49
- in mediump vec2 a_translate;
50
-
51
- uniform mediump vec2 u_scale_aggregate;
52
- uniform mediump vec2 u_offset_aggregate;
53
-
54
- void main(void) {
55
- gl_Position = vec4((u_scale_aggregate * vec2(a_x, float(a_y)) + u_offset_aggregate) + a_translate, 0.0, 1.0);
56
- }`,Li=p.z.object({x:Je,y:Je,label:p.z.string().optional(),color:l.Color.z,strokeWidth:p.z.number().default(1),downsample:p.z.number().min(1).max(50).optional().default(1)}),Oc=(e,n,t)=>e===-1||n===-1||e>=t.length?NaN:Number(t[e].at(n)),Ac=d.w.milliseconds(2);l.G.NAN,l.G.NAN,l.ZERO;const Zc=(e,n)=>n.equals(d.g.UINT8)?e.UNSIGNED_BYTE:e.FLOAT;class ds extends d.GLProgram{constructor(t,r,s){super(t,r,s);h(this,"translationBufferCache",new Map);h(this,"attrLocations",{});this.translationBufferCache=new Map,this.attrLocations={x:this.ctx.gl.getAttribLocation(this.prog,"a_x"),y:this.ctx.gl.getAttribLocation(this.prog,"a_y"),translate:this.ctx.gl.getAttribLocation(this.prog,"a_translate")}}bindState({strokeWidth:t,color:r}){return this.uniformColor("u_color",r),this.attrStrokeWidth(t)}bindScale(t,r){const s=l.G.scale(t.scale,r.scale),i=l.G.translate(l.G.scale(r.scale,t.offset),r.offset);this.uniformXY("u_scale_aggregate",s),this.uniformXY("u_offset_aggregate",i)}draw({x:t,y:r,count:s,downsample:i,xOffset:a,yOffset:o},c,u,f){const{gl:g}=this.ctx;this.bindAttrBuffer("x",t.glBuffer,i,a,u),this.bindAttrBuffer("y",r.glBuffer,i,o,f),g.drawArraysInstanced(g.LINE_STRIP,0,s/i,c)}bindAttrBuffer(t,r,s,i=0,a){const{gl:o}=this.ctx;o.bindBuffer(o.ARRAY_BUFFER,r);const c=o.getAttribLocation(this.prog,`a_${t}`),u=Zc(o,a),f=a.density.valueOf();a.equals(d.g.UINT8)?o.vertexAttribIPointer(c,1,u,f*s,f*i):o.vertexAttribPointer(c,1,u,!1,f*s,f*i),o.enableVertexAttribArray(c)}getAndBindTranslationBuffer(t){const{gl:r}=this.ctx,s=`${this.ctx.aspect}:${t}`,i=this.translationBufferCache.get(s);if(i!=null)return r.bindBuffer(r.ARRAY_BUFFER,i.glBuffer),i;const a=r.createBuffer();if(a==null)throw new d.xe("Failed to create buffer from WebGL context");const o=Ic(this.ctx.aspect,t);r.bindBuffer(r.ARRAY_BUFFER,a),r.bufferData(r.ARRAY_BUFFER,o,r.DYNAMIC_DRAW);const c={glBuffer:a,jsBuffer:o};return this.translationBufferCache.set(s,c),c}attrStrokeWidth(t){const{gl:r}=this.ctx,{jsBuffer:s}=this.getAndBindTranslationBuffer(t),i=r.getAttribLocation(this.prog,"a_translate");return r.vertexAttribPointer(i,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(i),r.vertexAttribDivisor(i,1),s.length/2}}const Et=class Et{constructor(n){h(this,"uint8HybridProgram");h(this,"float32Program");this.uint8HybridProgram=new ds(n,Lc,hs),this.float32Program=new ds(n,Dc,hs)}get gl(){return this.uint8HybridProgram.ctx.gl}getProgram(n){return n.equals(d.g.UINT8)?this.uint8HybridProgram:this.float32Program}static create(n){const t=d.Context.use(n),r=new Et(t);return n.set(Et.CONTEXT_KEY,r),r}static use(n){const t=n.get(Et.CONTEXT_KEY);if(t==null)throw new d.xe("GLProgram not found");return t}};h(Et,"CONTEXT_KEY","pluto-line-gl-program");let hn=Et;class we extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Li)}async afterUpdate(){var r,s;if(this.deleted)return;const{internal:t}=this;t.xTelem=await H(this.ctx,this.state.x,t.xTelem),t.yTelem=await H(this.ctx,this.state.y,t.yTelem),t.instrumentation=De(this.ctx,"line"),t.ctx=hn.use(this.ctx),t.requestRender=N.useRequest(this.ctx),(r=t.stopListeningXTelem)==null||r.call(t),(s=t.stopListeningYTelem)==null||s.call(t),t.stopListeningXTelem=t.xTelem.onChange(()=>t.requestRender(Gn)),t.stopListeningYTelem=t.yTelem.onChange(()=>t.requestRender(Gn)),t.requestRender(K)}async afterDelete(){var r,s,i,a;const{internal:t}=this;await((s=(r=t.xTelem).cleanup)==null?void 0:s.call(r)),await((a=(i=t.yTelem).cleanup)==null?void 0:a.call(i)),t.requestRender(K)}async xBounds(){return(await this.internal.xTelem.value())[0]}async yBounds(){return(await this.internal.yTelem.value())[0]}async findByXValue(t,r){const{xTelem:s,yTelem:i}=this.internal,[,a]=await s.value();let[o,c]=[-1,-1];a.find((R,D)=>{const M=R.binarySearch(r),z=M>=0&&M<R.length;return z&&([o,c]=[M,D]),z});const{key:u}=this,{color:f,label:g}=this.state,m={key:u,color:f,label:g,position:{x:0,y:0},value:{x:NaN,y:NaN}};if(o===-1||c===-1)return m;const w=a[c];m.value.x=Oc(c,o,a);const[,b]=await i.value(),T=b.find(R=>l.H.contains(R.alignmentBounds,w.alignment+BigInt(o)));if(T==null)return m;const S=Number(T.alignment-w.alignment);return m.value.y=Number(T.at(o-S)),m.position={x:t.dataToDecimalScale.x.pos(m.value.x),y:t.dataToDecimalScale.y.pos(m.value.y)},m}async render(t){if(this.deleted)return;const{downsample:r}=this.state,{xTelem:s,yTelem:i,ctx:a}=this.internal,{dataToDecimalScale:o,exposure:c}=t,[[,u],[,f]]=await Promise.all([s.value(),i.value()]);if(u.forEach(S=>S.updateGLBuffer(a.gl)),f.forEach(S=>S.updateGLBuffer(a.gl)),u.length===0||f.length===0)return;const g=a.getProgram(f[0].dataType),m=Fc(u,f,c,r,Ac);this.internal.instrumentation.L.debug("render",()=>({key:this.key,downsample:r,scale:o.transform,props:t.region,ops:Hc(m)}));const w=g.setAsActive(),b=g.bindState(this.state),T=g.ctx.scaleRegion(t.region).transform;m.forEach(S=>{const R=Gc(o,S).transform;g.bindScale(R,T),g.draw(S,b,u[0].dataType,f[0].dataType)}),w()}}h(we,"TYPE","line");const Nc=5e3,Ic=(e,n)=>Bc(Uc(e),n).map((t,r)=>Math.floor(r/$c)*(1/(Nc*e))*t),$c=5,Uc=e=>new Float32Array([0,0,0,e,0,-e,1,0,-1,0]),Bc=(e,n)=>{const t=new Float32Array(e.length*n);for(let r=0;r<n;r++)t.set(e,r*e.length);return t},Gc=(e,n)=>e.translate(e.x.dim(Number(n.x.sampleOffset)),e.y.dim(Number(n.y.sampleOffset))),_c={[we.TYPE]:we},Fc=(e,n,t,r,s)=>{if(e.length===0||n.length===0)return[];const i=[];return e.forEach(a=>n.forEach(o=>{if(!qc(a,o,s))return;let c=0,u=0;a.alignment<o.alignment?c=Number(o.alignment-a.alignment):o.alignment<a.alignment&&(u=Number(a.alignment-o.alignment));const f=Math.min(a.length-c,o.length-u);if(f===0)return;const g=l.Y(Math.round(t*4*f),r,51);i.push({x:a,y:o,xOffset:c,yOffset:u,count:f,downsample:g})})),i},Hc=e=>e.map(n=>({...n,x:n.x.digest,y:n.y.digest})),qc=(e,n,t)=>{if(!(e._timeRange!=null&&n._timeRange!=null))throw new d.xe(`Encountered series without time range in buildDrawOperations. X series present: ${e._timeRange!=null}, Y series present: ${n._timeRange!=null}`);const s=e.timeRange.overlapsWith(n.timeRange,t),i=l.H.overlapsWith(e.alignmentBounds,n.alignmentBounds);return s&&i};class jt{constructor(n,t){h(this,"canvas");h(this,"theme");this.canvas=n,this.theme=t}rule({direction:n,region:t,position:r,...s}){return n==="x"?this.line({start:l.G.construct(l.Mt.left(t),r),end:l.G.construct(l.Mt.right(t),r),...s}):this.line({start:l.G.construct(r,l.Mt.top(t)),end:l.G.construct(r,l.Mt.bottom(t)),...s})}line({stroke:n,lineWidth:t,lineDash:r,start:s,end:i}){const a=this.canvas;a.strokeStyle=n.hex,a.lineWidth=t,a.setLineDash([r]),a.beginPath(),a.moveTo(...l.G.couple(s)),a.lineTo(...l.G.couple(i)),a.stroke()}circle({fill:n,radius:t,position:r}){const s=this.canvas;s.fillStyle=n.hex,s.beginPath(),s.arc(...l.G.couple(r),t,0,2*Math.PI),s.fill()}resolveColor(n,t){return n==null?this.resolveColor(t):typeof n=="function"?n(this.theme):new l.Color(n)}border({region:n,color:t,width:r,radius:s,location:i}){const a=this.canvas;a.strokeStyle=this.resolveColor(t,this.theme.colors.border).hex,a.lineWidth=r??this.theme.sizes.border.width,s??(s=this.theme.sizes.border.radius),i==null||i===!0?s>0?(a.roundRect(...l.G.couple(l.Mt.topLeft(n)),...l.G.couple(l.Mt.dims(n)),s),a.stroke()):(a.rect(...l.G.couple(l.Mt.topLeft(n)),...l.G.couple(l.Mt.dims(n))),a.stroke()):d.A(i).forEach(o=>{const[c,u]=l.Mt.edgePoints(n,o);a.beginPath(),a.moveTo(...l.G.couple(c)),a.lineTo(...l.G.couple(u)),a.stroke()})}container({region:n,bordered:t=!0,rounded:r=!0,borderColor:s,borderRadius:i,borderWidth:a,backgroundColor:o}){i??(i=this.theme.sizes.border.radius),a??(a=1);const c=this.canvas;c.fillStyle=this.resolveColor(o,this.theme.colors.gray.l1).hex,c.strokeStyle=this.resolveColor(s,this.theme.colors.border).hex,c.setLineDash([]),c.lineWidth=1,c.beginPath(),r?c.roundRect(...l.G.couple(l.Mt.topLeft(n)),...l.G.couple(l.Mt.dims(n)),i):c.rect(...l.G.couple(l.Mt.topLeft(n)),...l.G.couple(l.Mt.dims(n))),c.fill(),t&&this.border({region:n,color:s,radius:i,width:a,location:t})}textContainer(n){const[t,r]=this.spacedTextDrawF(n);t.width+=12,t.height+=12;const{root:s=l.K.TOP_LEFT,offset:i=l.G.ZERO}=n,a={...n.position};s.x==="right"?a.x-=t.width+i.x:a.x+=i.x,s.y==="bottom"?a.y-=t.height+i.y:a.y+=i.y,this.container({region:l.Mt.construct(a,t.width,t.height),...n}),this.canvas.filter="none",r(l.G.translate(a,[6,6]))}spacedTextDrawF({text:n,direction:t,spacing:r=1,level:s="p"}){const i=d.fontString(this.theme,{level:s}),a=n.map(u=>d.dimensions(u,i,this.canvas)),o=this.theme.sizes.base*r,c=Math.max(...a.map(u=>u[l.g.dimension(t)]))+o;return[{[l.g.dimension(l.g.swap(t))]:Math.max(...a.map(u=>u[l.g.dimension(l.g.swap(t))])),[l.g.dimension(t)]:c*n.length-o},u=>{const f=d.fontString(this.theme,{level:s});this.canvas.font=f,this.canvas.fillStyle=this.theme.colors.text.hex,this.canvas.textBaseline="top",n.forEach((g,m)=>{this.canvas.fillText(g,u.x,u.y+c*m)})}]}drawTextInCenter({box:n,text:t,level:r}){const s=d.dimensions(t,this.canvas.font,this.canvas),i=l.Mt.positionInCenter(l.Mt.construct(l.G.ZERO,s),n);return this.text({text:t,position:l.Mt.topLeft(i),level:r})}text({text:n,position:t,level:r="p",weight:s,shade:i,maxWidth:a,code:o}){this.canvas.font=d.fontString(this.theme,{level:r,weight:s,code:o}),i==null?this.canvas.fillStyle=this.theme.colors.text.hex:this.canvas.fillStyle=this.theme.colors.gray[`l${i}`].hex,this.canvas.textBaseline="top";let c;a!=null&&(c=this.canvas.scissor(l.Mt.construct(t,a,1e3))),this.canvas.fillText(n,t.x,t.y),c==null||c()}}const Yr=p.z.object({position:p.z.number().optional(),pixelPosition:p.z.number().optional(),dragging:p.z.boolean(),lineWidth:p.z.number().optional().default(1),lineDash:p.z.number().optional().default(20),color:l.Color.z}),jc=3;class Bt extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Yr);h(this,"lastUpdateRef",null)}async afterUpdate(){this.internal.renderCtx=d.Context.use(this.ctx);const t=d.use(this.ctx);this.internal.draw=new jt(this.internal.renderCtx.upper2d,t),N.requestRender(this.ctx,et)}async afterDelete(){N.requestRender(this.ctx,et)}updatePositions({decimalToDataScale:t,plot:r}){const s=this.state.dragging,i=this.prevState.dragging&&!s;if((s||i)&&this.state.pixelPosition!=null){if(this.lastUpdateRef??(this.lastUpdateRef=this.state.pixelPosition),Math.abs(this.state.pixelPosition-this.lastUpdateRef)<jc&&!i)return this.state.pixelPosition;this.lastUpdateRef=this.state.pixelPosition;const c=t.pos(this.state.pixelPosition/l.Mt.height(r));return this.setState(u=>({...u,position:c})),this.state.pixelPosition}if(this.state.position==null){const o=t.pos(.5);this.setState(c=>({...c,position:o}))}const a=t.reverse().pos(this.state.position)*l.Mt.height(r);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}async render(t){if(this.deleted)return;const{renderCtx:r}=this.internal,{location:s,plot:i}=t,a=l.K.direction(s),{upper2d:o}=r,c=this.internal.draw,u=this.updatePositions(t)+l.Mt.top(t.plot);c.rule({stroke:this.state.color,lineWidth:this.state.lineWidth,lineDash:this.state.lineDash,direction:a,region:i,position:u}),o.fillStyle=this.state.color.hex,o.lineJoin="round",o.lineWidth=3.5,o.lineCap="round",o.beginPath();const f=4;if(s==="left"){const g=l.Mt.left(i)-1;o.moveTo(g,u),o.lineTo(g-f,u-f),o.lineTo(g-f,u+f)}else s==="right"&&(o.moveTo(l.Mt.right(i),u),o.lineTo(l.Mt.right(i)+f,u-f),o.lineTo(l.Mt.right(i)+f,u+f));o.closePath(),o.stroke()}}h(Bt,"TYPE","Rule");const Oi={[Bt.TYPE]:Bt},Wc=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:Oi,Rule:Bt,ruleStateZ:Yr},Symbol.toStringTag,{value:"Module"})),Vc=Ae.extend({location:l.K.x.optional().default("left")}),fs=2,Xc=e=>l.Mt.signedWidth(e)<fs||l.Mt.signedHeight(e)<fs;class be extends zi{constructor(){super(...arguments);h(this,"schema",Ae)}async xBounds(){return l.H.max((await Promise.all(this.lines.map(async t=>await t.xBounds()))).filter(t=>l.H.isFinite(t)))}async render(t){if(this.deleted)return;const[r,s]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport),i=r.invert().reverse();if(this.renderAxis(t,i),await this.renderLines(t,r),await this.renderRules(t,i),s!=null)throw s}async renderLines({xDataToDecimalScale:t,plot:r,canvases:s,exposure:i},a){if(!s.includes("gl")||Xc(r))return;const o={region:r,dataToDecimalScale:new l.b.XY(t,a),exposure:i};await Promise.all(this.lines.map(async c=>await c.render(o)))}async renderRules({container:t,plot:r,canvases:s},i){if(!s.includes("upper2d"))return;const{location:a}=this.state,{render:o}=this.internal,c=l.Mt.construct(l.Mt.left(t),l.Mt.top(r),l.Mt.width(t),l.Mt.height(r)),u=o.scissor(c,l.G.ZERO,["upper2d"]),f={container:t,plot:r,decimalToDataScale:i,location:a};await Promise.all(this.rules.map(async g=>await g.render(f))),u()}async findByXValue({xDataToDecimalScale:t,plot:r,viewport:s,hold:i,exposure:a},o){const[c,u]=await this.dataToDecimalScale(i,this.dataBounds.bind(this),s);if(u!=null)throw u;const f=new l.b.XY(t,c),g={region:r,dataToDecimalScale:f,exposure:a};return(await Promise.all(this.lines.map(async m=>await m.findByXValue(g,o)))).map(m=>({...m,units:this.state.label}))}async dataBounds(){return await Promise.all(this.lines.map(async t=>await t.yBounds()))}get lines(){return this.childrenOfType(we.TYPE)}get rules(){return this.childrenOfType(Bt.TYPE)}}h(be,"TYPE","YAxis");const Ai=p.z.object({start:d.m.z,end:d.m.z});class dn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Ai)}async afterUpdate(){this.internal.render=d.Context.use(this.ctx),this.internal.draw=new jt(this.internal.render.upper2d,d.use(this.ctx))}async render(){}}h(dn,"TYPE","range-annotation");const Kc=p.z.object({region:l.Mt.box,clearOverScan:l.G.crudeZ.optional().default(0),visible:p.z.boolean().optional().default(!0)}),Un=["upper2d","lower2d"],Ct=class Ct extends d.Composite{constructor(){super(...arguments);h(this,"schema",Ct.stateZ)}async afterUpdate(){const{internal:t}=this;t.renderCtx=d.Context.use(this.ctx),N.control(this.ctx,()=>this.requestRender("low")),this.requestRender("high")}async afterDelete(){this.requestRender("high")}async render(){if(this.deleted)return;const t=l.Mt.copy(this.state.region);if(!this.state.visible)return async()=>this.internal.renderCtx.erase(this.state.region,this.state.clearOverScan,...Un);const{renderCtx:r}=this.internal,s=l.b.XY.translate(l.Mt.topLeft(this.state.region)),i=r.scissor(this.state.region,l.G.construct(this.state.clearOverScan),Un);try{for(const a of this.children)await a.render({viewportScale:s})}catch(a){console.error(a)}finally{i()}return async()=>{this.internal.renderCtx.erase(t,this.state.clearOverScan)}}requestRender(t){const{renderCtx:r}=this.internal;r.loop.set({key:`${Ct.TYPE}-${this.key}`,render:this.render.bind(this),priority:t,canvases:Un})}};h(Ct,"TYPE","Table"),h(Ct,"stateZ",Kc);let ve=Ct;const Qc={[ve.TYPE]:ve},Zi=p.z.object({triggered:p.z.boolean(),status:d.specZ$1,sink:Mn.optional().default(Sn),source:ir.optional().default(nr)});class fn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Zi)}async afterUpdate(){var s,i,a;const{sink:t,source:r}=this.state;this.internal.source=await H(this.ctx,r,this.internal.source),this.internal.sink=await Ye(this.ctx,t,this.internal.sink),this.state.triggered&&!this.prevState.triggered&&this.internal.sink.set(((s=this.state.status.data)==null?void 0:s.authority)!==d.Np.Absolute.valueOf()).catch(console.error),await this.updateEnabledState(),(a=(i=this.internal).stopListening)==null||a.call(i),this.internal.stopListening=this.internal.source.onChange(()=>{this.updateEnabledState()})}async updateEnabledState(){const t=await this.internal.source.value();t.time.equals(this.state.status.time)||this.setState(r=>({...r,status:t,triggered:!1}))}async afterDelete(){this.asyncAfterDelete().catch(console.error)}async asyncAfterDelete(){var t,r,s,i;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t)),await((i=(s=this.internal.sink).cleanup)==null?void 0:i.call(s))}render(){}}h(fn,"TYPE","Chip");const Ni=p.z.object({}),ps="control-state-provider",Ii=d.ep.stateZ.extend({subjectColor:l.Color.z});class Gt extends d.Composite{constructor(){super(...arguments);h(this,"schema",Ni);h(this,"colors",new Map);h(this,"tracker");h(this,"disconnectTrackerChange");h(this,"obs",new Qn.Observer)}static use(t){return t.get(ps)}async afterUpdate(){const{internal:t}=this;t.instrumentation=De(this.ctx,"control-state");const r=d.use(this.ctx);t.palette=r.colors.visualization.palettes.default,t.defaultColor=r.colors.gray.l6;const s=Re(this.ctx);t.client!=null&&s===t.client||(t.client=s,this.ctx.set(ps,this),await this.maybeCloseTracker(),t.client!=null&&(this.internal.instrumentation.L.debug("starting state tracker"),await this.openTracker(t.client)))}async maybeCloseTracker(){var t;this.tracker!=null&&(this.internal.instrumentation.L.debug("stopping state tracker"),(t=this.disconnectTrackerChange)==null||t.call(this),await this.tracker.close(),this.tracker=void 0)}async afterDelete(){await this.maybeCloseTracker()}onChange(t){return this.obs.onChange(t)}get(t){return Array.isArray(t)?d.c.unique(t).map(r=>this.getOne(r)).filter(r=>r!=null):this.getOne(t)}getOne(t){if(this.tracker==null)return;const r=this.tracker.states.get(t);if(r!=null)return{...r,subjectColor:this.colors.get(r.subject.key)??this.internal.defaultColor}}async openTracker(t){var i;const{internal:r}=this,{instrumentation:s}=r;try{this.tracker=await t.control.openStateTracker()}catch{s.L.error("failed to open state tracker");return}(i=this.disconnectTrackerChange)==null||i.call(this),this.disconnectTrackerChange=this.tracker.onChange(a=>{if(s.L.debug("transfer",{transfers:a.map(o=>d.ep.transferString(o))}),this.tracker==null)throw new d.xe("tracker is null inside it's own onChange callback!");this.updateColors(this.tracker),this.obs.notify(a)})}updateColors(t){const r=t.subjects(),s=r.map(o=>o.key),i=Array.from(this.colors.values());this.colors.forEach((o,c)=>!s.includes(c)&&this.colors.delete(c));const{palette:a}=this.internal;r.forEach(o=>{if(this.colors.has(o.key))return;const c=a.find(u=>!i.includes(u))??a[0];this.colors.set(o.key,c),i.push(c)})}}h(Gt,"TYPE","StateProvider");const $i=["acquired","released","overridden","failed"],Ui=p.z.enum($i),Bi=p.z.object({name:p.z.string(),authority:p.z.number().default(0),acquireTrigger:p.z.number(),status:Ui.optional(),needsControlOf:d.zg.keyZ.array().optional().default([])});class pn extends d.Composite{constructor(){super(...arguments);h(this,"schema",Bi);h(this,"registry",new Map);h(this,"writer")}async afterUpdate(){this.internal.instrumentation=De(this.ctx),(this.internal.prevTrigger==null||Math.abs(this.state.acquireTrigger-this.internal.prevTrigger)>1)&&(this.internal.prevTrigger=this.state.acquireTrigger);const t=Re(this.ctx),r=Gt.use(this.ctx);this.internal.client=t,this.internal.client==null&&await this.release(),this.internal.stateProv=r,ws(this.ctx,this),this.internal.addStatus=d.useAggregate(this.ctx),this.state.acquireTrigger>this.internal.prevTrigger?await this.acquire():this.state.acquireTrigger<this.internal.prevTrigger&&await this.release()}async afterDelete(){await this.release()}async updateNeedsControlOf(){const{client:t}=this.internal;if(t==null)return;const r=new Set([]);for(const i of this.registry.keys())(await i.needsControlOf(t)).forEach(o=>o!==0&&r.add(o));const s=Array.from(r);d.F.unorderedPrimitiveArrays(this.state.needsControlOf,s)!==d.F.EQUAL&&this.setState(i=>({...i,needsControlOf:s}))}async acquire(){this.internal.prevTrigger=this.state.acquireTrigger;const{client:t,addStatus:r}=this.internal;if(t==null)return r({message:`Cannot acquire control on ${this.state.name} because no cluster has been connected.`,variant:"warning"});try{await this.updateNeedsControlOf();const s=this.state.needsControlOf;if(s.length===0)return r({message:`Cannot acquire control on ${this.state.name} because there are no channels to control.`,variant:"warning"});const i=d.k.now().sub(d.w.milliseconds(1));this.writer=await t.openWriter({start:i,channels:s,controlSubject:{key:this.key,name:this.state.name},authorities:this.state.authority,enableAutoCommit:!0}),this.setState(a=>({...a,status:"acquired"}))}catch(s){if(this.setState(i=>({...i,status:"failed"})),!(s instanceof Error))throw s;r({variant:"error",message:`${this.state.name} failed to acquire control`,description:s.message})}}async release(){var t;this.internal.prevTrigger=this.state.acquireTrigger;try{await((t=this.writer)==null?void 0:t.close()),this.setState(r=>({...r,status:"released"}))}catch(r){this.internal.addStatus({message:`${this.state.name} failed to release control: ${r.message}`,variant:"error"})}finally{this.writer=void 0}}async set(t){var r;this.writer==null&&await this.acquire(),await((r=this.writer)==null?void 0:r.write(t))}async setAuthority(t,r){var s;this.writer==null&&await this.acquire(),await((s=this.writer)==null?void 0:s.setAuthority(Object.fromEntries(t.map(i=>[i,r]))))}async releaseAuthority(t){var r;this.writer==null&&await this.acquire(),await((r=this.writer)==null?void 0:r.setAuthority(Object.fromEntries(t.map(s=>[s,this.state.authority]))))}deleteTelem(t){this.registry.delete(t),this.updateNeedsControlOf()}create(t){const s=(()=>{switch(t.type){case Te.TYPE:{const i=new Te(this,t.props);return this.registry.set(i,null),i}case Ee.TYPE:{const i=new Ee(this,this.internal.stateProv,t.props);return this.registry.set(i,null),i}case Se.TYPE:return new Se(this,t.props);default:return null}})();return s!=null&&this.updateNeedsControlOf(),s}}h(pn,"TYPE","Controller");const Gi=p.z.object({channel:p.z.number()});class Te extends kn{constructor(t,r){super(r);h(this,"controller");h(this,"schema",Gi);this.controller=t}invalidate(){}async cleanup(){this.controller.deleteTelem(this)}async needsControlOf(t){if(this.props.channel===0)return[];const r=await t.channels.retrieve(this.props.channel),s=[r.key];return r.index!==0&&s.push(r.index),s}async set(t){const{client:r}=this.controller.internal;if(r==null)return;const s=await r.channels.retrieve(this.props.channel),i={[s.key]:t};if(s.index!==0){const a=await r.channels.retrieve(s.index);i[a.key]=d.k.now()}await this.controller.set(i)}}h(Te,"TYPE","controlled-numeric-telem-sink");const Jc=e=>({type:Te.TYPE,props:e,variant:"sink",valueType:"number"}),_i=p.z.object({authority:p.z.number().default(d.ep.Authority.Absolute.valueOf()),channel:p.z.number()});class Se extends kn{constructor(t,r){super(r);h(this,"controller");h(this,"schema",_i);this.controller=t}async cleanup(){this.controller.deleteTelem(this)}async needsControlOf(t){const r=await t.channels.retrieve(this.props.channel),s=[r.key];return r.index!==0&&s.push(r.index),s}async set(t){const{controller:r}=this,{client:s}=r.internal;if(s==null)return;const i=await s.channels.retrieve(this.props.channel),a=[i.key];i.index!==0&&a.push(i.index),t?await this.controller.setAuthority(a,this.props.authority):await this.controller.releaseAuthority(a)}}h(Se,"TYPE","acquire-channel-control");const tu=e=>({type:Se.TYPE,props:e,variant:"sink",valueType:"boolean"}),Fi=p.z.object({channel:p.z.number()});class Ee extends _{constructor(t,r,s){super(s);h(this,"prov");h(this,"valid",!1);h(this,"stopListening");h(this,"controller");h(this,"schema",Fi);this.prov=r,this.controller=t}async needsControlOf(){return[]}maybeRevalidate(){var s;if(this.valid)return;const{channel:t}=this.props;(s=this.stopListening)==null||s.call(this);const r=d.U.filterTransfersByChannelKey(t);this.stopListening=this.prov.onChange(i=>{var a;r(i).length!==0&&((a=this.notify)==null||a.call(this))}),this.valid=!0}async value(){this.maybeRevalidate();const t=d.k.now();if(this.props.channel===0)return{key:this.controller.key,variant:"disabled",message:"No Channel",time:t,data:{valid:!1,authority:0}};const r=this.prov.get(this.props.channel);return r==null?{key:this.controller.key,variant:"disabled",message:"Uncontrolled",time:t,data:{valid:!0,color:void 0,authority:0}}:{key:r.subject.key,variant:r.subject.key===this.controller.key?"success":"error",message:`Controlled by ${r.subject.name}`,time:t,data:{valid:!0,color:r.subjectColor,authority:r.authority}}}async cleanup(){var t;this.controller.deleteTelem(this),(t=this.stopListening)==null||t.call(this)}}h(Ee,"TYPE","controlled-status-source");const eu=e=>({type:Ee.TYPE,props:e,variant:"source",valueType:"status"}),Hi=p.z.object({statusSource:ir.optional().default(nr),colorSource:sr.optional().default(En),status:d.specZ$1,color:l.Color.z.optional()});class gn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Hi);h(this,"stopListeningStatus");h(this,"stopListeningColor")}async afterUpdate(){var r,s;const{internal:t}=this;t.statusSource=await H(this.ctx,this.state.statusSource,t.statusSource),t.colorSource=await H(this.ctx,this.state.colorSource,t.colorSource),await this.updateState(),(r=this.stopListeningStatus)==null||r.call(this),this.stopListeningStatus=t.statusSource.onChange(()=>{this.updateState()}),(s=this.stopListeningColor)==null||s.call(this),this.stopListeningColor=t.colorSource.onChange(()=>{this.updateState()})}async afterDelete(){this.internalAfterDelete().catch(console.error)}async internalAfterDelete(){var t,r,s,i;await((r=(t=this.internal.statusSource).cleanup)==null?void 0:r.call(t)),await((i=(s=this.internal.colorSource).cleanup)==null?void 0:i.call(s))}async render(){}async updateState(){const t=await this.internal.colorSource.value(),r=await this.internal.statusSource.value();t.equals(this.state.color)&&r.message===this.state.status.message||this.setState(s=>({...s,color:t,status:r}))}}h(gn,"TYPE","Indicator");const qi=p.z.object({needsControlOf:d.zg.keyZ.array(),states:Ii.array()});class mn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",qi)}async afterUpdate(){var a;const{internal:t}=this;t.stateProv=Gt.use(this.ctx);const r=this.state.needsControlOf;(a=t.disconnectStateProv)==null||a.call(t);const s=d.U.filterTransfersByChannelKey(...r),i=t.stateProv.get(r);this.setState(o=>({...o,states:i})),t.disconnectStateProv=t.stateProv.onChange(o=>{if(s(o).length===0)return;const c=t.stateProv.get(r);this.setState(u=>({...u,states:c}))})}async afterDelete(){var r;const{internal:t}=this;(r=t.disconnectStateProv)==null||r.call(t)}async render(){}}h(mn,"TYPE","Legend");const nu={[pn.TYPE]:pn,[Gt.TYPE]:Gt,[gn.TYPE]:gn,[fn.TYPE]:fn,[mn.TYPE]:mn},ji=p.z.object({trigger:p.z.number(),sink:Mn.optional().default(Sn)});class yn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ji)}async afterUpdate(){var s;const{sink:t}=this.state;(s=this.internal).prevTrigger??(s.prevTrigger=this.state.trigger),this.internal.sink=await Ye(this.ctx,t,this.internal.sink);const r=this.internal.prevTrigger;this.internal.prevTrigger=this.state.trigger,!(this.state.trigger<=r)&&this.internal.sink.set(!0).catch(console.error)}render(){}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var r,s;const{internal:t}=this;await((s=(r=t.sink).cleanup)==null?void 0:s.call(r))}}h(yn,"TYPE","Button");const ru={[yn.TYPE]:yn},zr=p.z.object({dpr:p.z.number(),region:l.Mt.box,bootstrap:p.z.boolean().optional().default(!1),bootstrapped:p.z.boolean().optional().default(!1),glCanvas:p.z.any().optional(),upper2dCanvas:p.z.any().optional(),lower2dCanvas:p.z.any().optional(),os:d.S.osZ});class Ce extends d.Composite{constructor(){super(...arguments);h(this,"schema",zr);h(this,"renderContextSet",!1)}async afterUpdate(){let t=d.Context.useOptional(this.ctx);if(t==null){if(this.renderContextSet)throw new d.xe("[vis.worker.Canvas] - expected render context to be set");if(!this.state.bootstrap)return;const{glCanvas:r,lower2dCanvas:s,upper2dCanvas:i,os:a}=this.state;if(r==null||s==null||i==null)throw new d.xe("[vis.worker.Canvas] - expected render context bootstrap to include all canvases");t=d.Context.create(this.ctx,r,s,i,a),hn.create(this.ctx),this.setState(o=>({...o,bootstrap:!1,bootstrapped:!0,glCanvas:void 0,lower2dCanvas:void 0,upper2dCanvas:void 0}))}else t.update(this.ctx);t.resize(this.state.region,this.state.dpr)}}h(Ce,"TYPE","Canvas");const Wi={[Ce.TYPE]:Ce},su=Object.freeze(Object.defineProperty({__proto__:null,Canvas:Ce,REGISTRY:Wi,canvasStateZ:zr},Symbol.toStringTag,{value:"Module"})),Dr=p.z.object({position:l.G.xy,zoom:p.z.number(),region:l.Mt.box,clearOverScan:l.G.crudeZ.optional().default(10),visible:p.z.boolean().optional().default(!0)}),Be=["upper2d","lower2d"],Mt=class Mt extends d.Composite{constructor(){super(...arguments);h(this,"schema",Mt.stateZ)}async afterUpdate(){this.internal.renderCtx=d.Context.use(this.ctx),this.internal.addStatus=d.useAggregate(this.ctx),N.control(this.ctx,()=>this.requestRender("low")),this.requestRender("high")}async afterDelete(){this.requestRender("high")}async render(){if(this.deleted)return;const{renderCtx:t,addStatus:r}=this.internal,{zoom:s,position:i}=this.state,a=l.Mt.construct(this.state.region);if(!this.state.visible)return async()=>t.erase(a,this.state.clearOverScan,...Be);const o=t.scissor(a,l.G.ZERO,Be),c=l.b.XY.magnify(l.G.construct(s)).translate(l.Mt.topLeft(a)).translate(i);try{await Promise.all(this.children.map(async f=>await f.render({viewportScale:c})))}catch(f){if(!(f instanceof Error))throw f;r({variant:"error",message:"Failed to render diagram",description:f.message})}finally{o()}const u=l.Mt.copy(this.state.region);return async()=>{this.internal.renderCtx.erase(u,this.state.clearOverScan,...Be)}}requestRender(t){const{renderCtx:r}=this.internal;r.loop.set({key:`${Mt.TYPE}-${this.key}`,render:this.render.bind(this),priority:t,canvases:Be})}};h(Mt,"TYPE","Diagram"),h(Mt,"stateZ",Dr);let _t=Mt;const Vi={[_t.TYPE]:_t},iu=Object.freeze(Object.defineProperty({__proto__:null,Diagram:_t,REGISTRY:Vi,diagramStateZ:Dr},Symbol.toStringTag,{value:"Module"})),Xi=p.z.object({enabled:p.z.boolean(),source:rr.optional().default(er)});class xn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Xi)}async afterUpdate(){var s;this.internal.addStatus=d.useOptionalAggregate(this.ctx);const{source:t}=this.state,{internal:r}=this;this.internal.source=await H(this.ctx,t,this.internal.source),await this.updateEnabledState(),(s=r.stopListening)==null||s.call(r),r.stopListening=r.source.onChange(()=>this.updateEnabledState().catch(this.reportError.bind(this)))}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Light: ${t.message}`})}async updateEnabledState(){const t=await this.internal.source.value();t!==this.state.enabled&&this.setState(r=>({...r,enabled:t}))}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var t,r;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t))}async render(){}}h(xn,"TYPE","Light");const au={[xn.TYPE]:xn},Lr=p.z.object({position:l.G.xy.or(p.z.null()),textColor:l.Color.z.optional().default(l.ZERO),backgroundColor:l.Color.z.optional().default(l.ZERO),borderColor:l.Color.z.optional().default(l.ZERO),ruleColor:l.Color.z.optional().default(l.ZERO),ruleStrokeWidth:p.z.number().optional().default(1),ruleStrokeDash:p.z.number().default(0)});class Ft extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Lr)}async afterUpdate(){const t=d.use(this.ctx);this.state.textColor.isZero&&(this.state.textColor=t.colors.text),this.state.backgroundColor.isZero&&(this.state.backgroundColor=t.colors.gray.l1),this.state.borderColor.isZero&&(this.state.borderColor=t.colors.border),this.state.ruleColor.isZero&&(this.state.ruleColor=t.colors.gray.l5),this.internal.dotColor=t.colors.text,this.internal.dotColorContrast=t.colors.textInverted,this.internal.render=d.Context.use(this.ctx),this.internal.draw=new jt(this.internal.render.upper2d,t),N.requestRender(this.ctx,et)}async afterDelete(){N.requestRender(this.ctx,et)}async render(t){if(this.deleted||this.state.position==null)return;const{region:r}=t,s=l.b.XY.scale(l.Mt.DECIMAL).scale(r),i=l.b.XY.scale(r).scale(l.Mt.DECIMAL),a=await t.findByXDecimal(i.x.pos(this.state.position.x)),o=a.filter(b=>l.G.isFinite(b.value)),{draw:c}=this.internal,u=o.reduce((b,T)=>b+T.position.x,0)/o.length,f=new d.m(o.reduce((b,T)=>b+T.value.x,0)/o.length),g=s.x.pos(u);if(!l.H.contains(l.Mt.xBounds(r),g))return;c.rule({stroke:this.state.ruleColor,lineWidth:this.state.ruleStrokeWidth,lineDash:this.state.ruleStrokeDash,direction:"y",region:r,position:g}),o.forEach(b=>{const T=s.pos(b.position);c.circle({fill:b.color.setAlpha(.5),radius:8,position:T}),c.circle({fill:b.color.setAlpha(.8),radius:5,position:T}),c.circle({fill:b.color.pickByContrast(this.internal.dotColor,this.internal.dotColorContrast),radius:2,position:T})});const m=a.map(b=>`${b.label??""}: ${b.value.y.toFixed(2)}`);m.unshift(`Time: ${f.fString("preciseDate","local")}`);const w=i.pos(this.state.position);c.textContainer({text:m,backgroundColor:this.state.backgroundColor,borderColor:this.state.borderColor,position:this.state.position,direction:"y",level:"small",spacing:.5,offset:{x:12,y:12},root:{x:w.x>.8?"right":"left",y:w.y>.8?"top":"bottom"}})}}h(Ft,"TYPE","tooltip");const Ki={[Ft.TYPE]:Ft},ou=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:Ki,Tooltip:Ft,tooltipStateZ:Lr},Symbol.toStringTag,{value:"Module"})),Qi=p.z.object({region:l.Mt.box,wheelPos:p.z.number(),scrolling:p.z.boolean(),empty:p.z.boolean(),visible:p.z.boolean(),telem:Je.optional().default(Ss),font:d.levelZ.optional().default("p"),color:l.Color.z.optional().default(l.ZERO),overshoot:l.G.xy.optional().default({x:0,y:0})}),lu=.98,Kt="lower2d",cu={offset:0n,offsetRef:0n,scrollRef:0},ie=class ie extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ie.z);h(this,"values",new d.Dt([]));h(this,"scrollState",cu)}async afterUpdate(){var c;const{internal:t}=this;t.render=d.Context.use(this.ctx),t.theme=d.use(this.ctx),this.state.color.isZero?this.internal.textColor=t.theme.colors.gray.l8:t.textColor=this.state.color,t.telem=await H(this.ctx,this.state.telem,t.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:f}=this,g=Math.ceil((s-this.scrollState.scrollRef)/this.lineHeight);u.offset=this.values.traverseAlignment(u.offsetRef,-BigInt(g)),u.offset<f.alignmentBounds.lower+BigInt(this.visibleLineCount)&&(u.offset=f.alignmentBounds.lower,this.setState(m=>({...m,wheelPos:this.prevState.wheelPos}))),u.offset>=f.alignmentBounds.upper&&this.setState(m=>({...m,scrolling:!1}))}const[a,o]=await this.internal.telem.value();this.values=new d.Dt(o),this.checkEmpty(),(c=t.stopListeningTelem)==null||c.call(t),t.stopListeningTelem=t.telem.onChange(()=>{this.internal.telem.value().then(([u,f])=>{this.checkEmpty(),this.values=new d.Dt(f),this.requestRender()})}),this.requestRender()}checkEmpty(){const t=this.values.length===0;t!==this.state.empty&&this.setState(r=>({...r,empty:t}))}async afterDelete(){var s;const{telem:t,render:r}=this.internal;await((s=t.cleanup)==null?void 0:s.call(t)),r.erase(l.Mt.construct(this.state.region),l.G.ZERO,Kt)}requestRender(){const{render:t}=this.internal;t.loop.set({key:`${this.type}-${this.key}`,render:async()=>await this.render(),priority:"high",canvases:[Kt]})}get lineHeight(){return this.internal.theme.typography[this.state.font].size*this.internal.theme.sizes.base}get totalHeight(){return Math.ceil(this.values.length*this.lineHeight)}get visibleLineCount(){return Math.min(Math.floor((l.Mt.height(this.state.region)-12)/this.lineHeight),this.values.length)}async render(){const{render:t}=this.internal,r=this.state.region;if(l.Mt.areaIsZero(r))return;if(!this.state.visible)return async()=>t.erase(r,l.G.ZERO,Kt);let s;if(!this.state.scrolling)s=this.values.subIterator(this.values.length-this.visibleLineCount,this.values.length);else{const f=this.values.traverseAlignment(this.scrollState.offset,-BigInt(this.visibleLineCount));s=this.values.subAlignmentSpanIterator(f,this.visibleLineCount)}const i=this.state.region,a=t[Kt],o=new jt(a,this.internal.theme),c=t.scissor(i,l.G.ZERO,[Kt]);this.renderElements(o,s),this.renderScrollbar(o),c();const u=l.Mt.copy(this.state.region);return async({canvases:f})=>t.erase(u,this.state.overshoot,...f)}renderScrollbar(t){const r=this.state.region,s=l.Mt.height(r)/this.totalHeight*l.Mt.height(r);if(s>=l.Mt.height(r)*lu)return;let i=l.Mt.bottom(r)-s;this.state.scrolling&&(i-=Number(this.values.distance(this.values.alignmentBounds.upper,this.scrollState.offset))/this.values.length*l.Mt.height(r)),i<0&&(i=l.Mt.top(r)),t.container({region:l.Mt.construct({x:l.Mt.right(r)-6,y:i},{width:6,height:s}),bordered:!1,backgroundColor:a=>a.colors.gray.l4})}renderElements(t,r){const s=this.state.region;let i=0;for(const a of r){const o=this.values.dataType.equals(d.g.JSON)?JSON.stringify(a):a.toString();t.text({text:o,level:this.state.font,shade:9,position:l.G.translate(l.Mt.topLeft(s),{x:6,y:i*this.lineHeight+6}),code:!0}),i++}}};h(ie,"TYPE","log"),h(ie,"z",Qi);let Me=ie;const uu={[Me.TYPE]:Me},Or=p.z.object({one:l.G.xy.nullable(),two:l.G.xy.nullable(),hover:l.G.xy.nullable(),color:p.z.union([l.Color.z,p.z.object({verticalLine:l.Color.z.optional().default(l.ZERO),horizontalLine:l.Color.z.optional().default(l.ZERO),obliqueLine:l.Color.z.optional().default(l.ZERO)})]).optional().default(l.ZERO),strokeWidth:p.z.number().optional().default(1),strokeDash:p.z.number().optional().default(2)});class Ht extends d.Leaf{constructor(){super(...arguments);h(this,"schema",Or)}async afterUpdate(){const t=d.Context.use(this.ctx);this.internal.theme=d.use(this.ctx),this.internal.render=t,this.internal.draw=new jt(t.upper2d,this.internal.theme),N.requestRender(this.ctx,et)}async afterDelete(){N.requestRender(this.ctx,K)}get verticalLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.verticalLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.verticalLine}get horizontalLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.horizontalLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.horizontalLine}get obliqueLineColor(){return this.state.color instanceof l.Color?this.state.color.isZero?this.internal.theme.colors.gray.l6:this.state.color:this.state.color.obliqueLine.isZero?this.internal.theme.colors.gray.l6:this.state.color.obliqueLine}async find(t){const{one:r,two:s}=this.state;if(r==null||s==null)return null;const{one:i,two:a}=this.prevState,{dataOne:o,dataTwo:c}=this.internal;if(i!=null&&l.G.equals(r,i)&&a!=null&&l.G.equals(s,a)&&o!=null&&c!=null){const[S,R]=[await t.findByXValue(o.x),await t.findByXValue(c.x)];return S.length===0||R.length===0?null:[S.sort((D,M)=>l.G.distance(o,D.value)-l.G.distance(o,M.value))[0],R.sort((D,M)=>l.G.distance(c,D.value)-l.G.distance(c,M.value))[0]]}const u=l.b.XY.scale(t.region).scale(l.Mt.DECIMAL),[f,g]=[u.pos(r),u.pos(s)],[m,w]=[await t.findByXDecimal(f.x),await t.findByXDecimal(g.x)];if(m.length===0||w.length===0)return null;const[b,T]=[m.sort((S,R)=>l.G.distance(f,S.position)-l.G.distance(f,R.position))[0],w.sort((S,R)=>l.G.distance(g,S.position)-l.G.distance(g,R.position))[0]];return this.internal.dataOne=b.value,this.internal.dataTwo=T.value,[b,T]}async renderHover(t){if(this.state.hover==null)return;const r=this.state.hover,s=l.b.XY.scale(t.region).scale(l.Mt.DECIMAL),i=s.pos(r),a=await t.findByXDecimal(s.pos(r).x);if(a.length===0)return;const o=a.sort((u,f)=>l.G.distance(i,u.position)-l.G.distance(i,f.position))[0],{draw:c}=this.internal;c.circle({fill:o.color.setAlpha(.5),radius:9,position:s.reverse().pos(o.position)})}async render(t){if(this.deleted)return;await this.renderHover(t);const r=await this.find(t);if(r==null)return;const[s,i]=r,{draw:a}=this.internal,{strokeDash:o,strokeWidth:c}=this.state,u=l.b.XY.scale(l.Mt.DECIMAL).scale(t.region),f=u.pos(s.position),g=u.pos(i.position),m=new d.w(Math.abs(s.value.x-i.value.x)),w=Math.abs(s.value.y-i.value.y),b=w/m.seconds;a.line({start:l.G.construct(f.x,f.y),end:l.G.construct(f.x,g.y),stroke:this.verticalLineColor,lineDash:o,lineWidth:c}),a.textContainer({text:[`${w.toFixed(2)} ${s.units??""}`],direction:"x",position:l.G.construct(f.x,(f.y+g.y)/2),level:"small"}),a.line({start:l.G.construct(f.x,g.y),end:l.G.construct(g.x,g.y),stroke:this.horizontalLineColor,lineDash:o,lineWidth:c}),a.textContainer({text:[m.truncate(d.w.MILLISECOND).toString()],direction:"x",position:l.G.construct((f.x+g.x)/2,g.y),level:"small"}),a.line({start:l.G.construct(f.x,f.y),end:l.G.construct(g.x,g.y),stroke:this.obliqueLineColor,lineDash:o,lineWidth:c}),a.textContainer({text:[`${b.toFixed(2)} ${s.units??""} / S`],direction:"x",position:l.G.construct((f.x+g.x)/2,(f.y+g.y)/2),level:"small"}),a.circle({fill:s.color.setAlpha(.5),radius:8,position:f}),a.circle({fill:s.color.setAlpha(.8),radius:5,position:f}),a.circle({fill:new l.Color("#ffffff"),radius:2,position:f}),a.circle({fill:i.color.setAlpha(.5),radius:8,position:g}),a.circle({fill:i.color.setAlpha(.8),radius:5,position:g}),a.circle({fill:new l.Color("#ffffff"),radius:2,position:g})}}h(Ht,"TYPE","measure");const Ji={[Ht.TYPE]:Ht},hu=Object.freeze(Object.defineProperty({__proto__:null,Measure:Ht,REGISTRY:Ji,measureStateZ:Or},Symbol.toStringTag,{value:"Module"})),ta=p.z.object({trigger:p.z.number(),command:p.z.number().optional(),value:p.z.number(),sink:ks.optional().default(bs),source:Ps.optional().default(vs)});class wn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ta)}async afterUpdate(){var c;this.internal.addStatus=d.useOptionalAggregate(this.ctx);const{sink:t,source:r,trigger:s,command:i}=this.state,{internal:a}=this;a.prevTrigger??(a.prevTrigger=s),this.internal.source=await H(this.ctx,r,this.internal.source),a.sink=await Ye(this.ctx,t,a.sink);const o=a.prevTrigger;a.prevTrigger=s,s>o&&i!=null&&this.internal.sink.set(i),await this.updateValue(),(c=a.stopListening)==null||c.call(a),a.stopListening=a.source.onChange(()=>{this.updateValue().catch(this.reportError.bind(this))})}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Setpoint: ${t.message}`})}async updateValue(){const t=await this.internal.source.value();t!==this.state.value&&this.setState(r=>({...r,value:t,triggered:!1}))}async afterDelete(){var r,s,i,a;const{internal:t}=this;t.stopListening(),await((s=(r=t.source).cleanup)==null?void 0:s.call(r)),await((a=(i=t.sink).cleanup)==null?void 0:a.call(i))}async render(){}}h(wn,"TYPE","Setpoint");const du={[wn.TYPE]:wn},ea=p.z.object({triggered:p.z.boolean(),enabled:p.z.boolean(),sink:Mn.optional().default(Sn),source:rr.optional().default(er)});class bn extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ea)}async afterUpdate(){var c;this.internal.addStatus=d.useOptionalAggregate(this.ctx);const{sink:t,source:r,triggered:s,enabled:i}=this.state,{triggered:a}=this.prevState,{internal:o}=this;this.internal.source=await H(this.ctx,r,this.internal.source),o.sink=await Ye(this.ctx,t,o.sink),s&&!a&&await o.sink.set(!i),await this.updateEnabledState(),(c=o.stopListening)==null||c.call(o),o.stopListening=o.source.onChange(()=>{this.updateEnabledState().catch(this.reportError.bind(this))})}reportError(t){this.internal.addStatus({key:this.key,variant:"error",message:`Failed to update Toggle: ${t.message}`})}async updateEnabledState(){const t=await this.internal.source.value();t!==this.state.enabled&&this.setState(r=>({...r,enabled:t,triggered:!1}))}async afterDelete(){await this.internalAfterDelete()}async internalAfterDelete(){var t,r,s,i;this.internal.stopListening(),await((r=(t=this.internal.source).cleanup)==null?void 0:r.call(t)),await((i=(s=this.internal.sink).cleanup)==null?void 0:i.call(s))}async render(){}}h(bn,"TYPE","Toggle");const fu={[bn.TYPE]:bn},pu=p.z.object({box:l.Mt.box,telem:ar.optional().default(Ts),backgroundTelem:sr.optional().default(En),level:d.levelZ.optional().default("p"),color:l.Color.z.optional().default(l.ZERO),precision:p.z.number().optional().default(2),minWidth:p.z.number().optional().default(60),width:p.z.number().optional(),notation:_s.optional().default("standard"),location:l.K.xy.optional().default({x:"left",y:"center"})}),gu=["upper2d","lower2d"],ae=class ae extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ae.z)}async afterUpdate(){var r,s;const{internal:t}=this;t.render=d.Context.use(this.ctx),t.theme=d.use(this.ctx),this.state.color.isZero?this.internal.textColor=t.theme.colors.gray.l8:t.textColor=this.state.color,t.telem=await H(this.ctx,this.state.telem,t.telem),(r=t.stopListening)==null||r.call(t),t.stopListening=this.internal.telem.onChange(()=>this.requestRender()),t.backgroundTelem=await H(this.ctx,this.state.backgroundTelem,t.backgroundTelem),(s=t.stopListeningBackground)==null||s.call(t),t.stopListeningBackground=this.internal.backgroundTelem.onChange(()=>this.requestRender()),this.internal.requestRender=N.useOptionalRequest(this.ctx),this.requestRender()}async afterDelete(){var r,s,i,a,o,c;const{internal:t}=this;(r=t.stopListening)==null||r.call(t),(s=t.stopListeningBackground)==null||s.call(t),await((a=(i=t.telem).cleanup)==null?void 0:a.call(i)),await((c=(o=t.backgroundTelem).cleanup)==null?void 0:c.call(o)),t.requestRender==null?t.render.erase(l.Mt.construct(this.state.box),l.G.ZERO,...gu):t.requestRender(K)}requestRender(){const{requestRender:t}=this.internal;t!=null?t(K):this.render({})}get fontHeight(){const{theme:t}=this.internal;return t.typography[this.state.level].size*t.sizes.base}maybeUpdateWidth(t){const{theme:r}=this.internal,s=t+r.sizes.base+this.fontHeight;this.state.width==null||this.state.width+this.fontHeight*.5<s||this.state.minWidth>s&&this.state.width!==this.state.minWidth?this.setState(i=>({...i,width:Math.max(s,i.minWidth)})):this.state.width-this.fontHeight>s&&this.setState(i=>({...i,width:Math.max(s,i.minWidth)}))}async render({viewportScale:t=l.b.XY.IDENTITY}){const{render:r,telem:s,backgroundTelem:i}=this.internal,a=l.Mt.construct(this.state.box);if(l.Mt.areaIsZero(a))return;const{location:o}=this.state,c=r.lower2d.applyScale(t);let u=await s.value();const f=d.fontString(this.internal.theme,{level:this.state.level,code:!0});c.font=f;const g=this.fontHeight,m=u[0]=="-";m&&(u=u.slice(1));const{theme:w}=this.internal,b=d.dimensions(u,f,c).width+w.sizes.base;this.internal.requestRender==null&&r.erase(l.Mt.construct(this.prevState.box)),this.maybeUpdateWidth(b);const T={...l.G.ZERO};o.x==="left"&&(T.x=6+g*.75),o.x==="center"&&(T.x=l.Mt.width(a)/2-b/2),o.y==="center"&&(T.y=l.Mt.height(a)/2);const S=l.G.translate(l.Mt.topLeft(a),T),R=c.scissor(a,void 0);let D=!0;if(this.state.backgroundTelem.type!=En.type){const M=r.lower2d.applyScale(t),z=await i.value();D=z.isZero,z.isZero||(M.fillStyle=z.hex,M.rect(...l.G.couple(l.Mt.topLeft(a)),l.Mt.width(a),l.Mt.height(a)),M.fill(),c.fillStyle=z.pickByContrast(w.colors.gray.l0,w.colors.gray.l9).hex)}D&&(c.fillStyle=this.internal.textColor.hex),c.textBaseline="middle",m&&c.fillText("-",...l.G.couple(l.G.translateX(S,-g*.6))),c.fillText(u,...l.G.couple(S)),R()}};h(ae,"TYPE","value"),h(ae,"z",pu);let qt=ae;const na={[qt.TYPE]:qt},mu=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:na,Value:qt},Symbol.toStringTag,{value:"Module"})),yu=d.yp.payloadZ.extend({viewport:l.H.bounds}),gs=e=>l.Color.z.safeParse(e).success,ra=p.z.object({cursor:l.G.xy.or(p.z.null()),hovered:yu.or(p.z.null()),count:p.z.number()});class Pe extends d.Leaf{constructor(){super(...arguments);h(this,"schema",ra);h(this,"fetchedInitial",d.E.ZERO)}async afterUpdate(){const{internal:t}=this;t.render=d.Context.use(this.ctx),t.draw=new jt(t.render.upper2d,d.use(this.ctx)),t.ranges??(t.ranges=new Map);const r=Re(this.ctx);r!=null&&(t.client=r,t.tracker==null&&(t.tracker=await t.client.ranges.openTracker(),t.tracker.onChange(async s=>{s.forEach(async i=>{i.variant==="delete"?t.ranges.delete(i.key):gs(i.value.color)&&t.ranges.set(i.key,i.value)}),N.requestRender(this.ctx,et),this.setState(i=>({...i,count:t.ranges.size}))}),N.requestRender(this.ctx,et)))}async fetchInitial(t){const{internal:r}=this;if(r.client==null||this.fetchedInitial.roughlyEquals(t,d.w.minutes(1)))return;this.fetchedInitial=t,(await r.client.ranges.retrieve(t)).forEach(i=>{gs(i.color)&&r.ranges.set(i.key,i)}),this.setState(i=>({...i,count:r.ranges.size}))}async render(t){const{dataToDecimalScale:r,region:s,viewport:i,timeRange:a}=t;await this.fetchInitial(a);const{draw:o,ranges:c}=this.internal,u=r.scale(l.Mt.xBounds(s)),f=this.state.cursor==null?null:this.state.cursor.x;let g=null;const m=o.canvas.scissor(l.Mt.construct({x:l.Mt.left(s),y:l.Mt.top(s)-35},{x:l.Mt.right(s),y:l.Mt.bottom(s)}));c.forEach(w=>{const b=l.Color.z.safeParse(w.color);if(!b.success)return;const T=b.data;let S=u.pos(Number(w.timeRange.start.valueOf()));const R=u.pos(Number(w.timeRange.end.valueOf()));if(R<l.Mt.left(s)||S>l.Mt.right(s))return;S=l.Y(S,l.Mt.left(s)-2,l.Mt.right(s)-1);let D=!1;f!=null&&(D=l.H.contains({lower:S,upper:R},f)),D&&(g={key:w.key,name:w.name,color:w.color,timeRange:w.timeRange,viewport:{lower:r.scale(l.Mt.xBounds(i)).pos(Number(w.timeRange.start.valueOf())),upper:r.scale(l.Mt.xBounds(i)).pos(Number(w.timeRange.end.valueOf()))}}),o.container({region:l.Mt.construct({x:S,y:l.Mt.top(s)-1},{x:R,y:l.Mt.bottom(s)-1}),backgroundColor:T.setAlpha(.2),bordered:!1});const M=l.Mt.construct({x:S+1,y:l.Mt.top(s)-34},{x:R-1,y:l.Mt.top(s)-12});o.container({region:M,backgroundColor:l.Mt.width(M)<20?T.setAlpha(.4):z=>D?z.colors.gray.l2:z.colors.gray.l0,bordered:!0,borderWidth:1,borderRadius:2,borderColor:T.setAlpha(.8)}),o.text({text:w.name,position:{x:S+8,y:l.Mt.top(s)-30},level:"small",shade:8,weight:500,maxWidth:R-S-16})}),m(),g!=null?this.setState(w=>({...w,hovered:g})):this.state.hovered&&this.setState(w=>({...w,hovered:null}))}}h(Pe,"TYPE","range-provider");const xu={[dn.TYPE]:dn,[Pe.TYPE]:Pe},wu=Ae;class ke extends zi{constructor(){super(...arguments);h(this,"schema",Ae)}async render(t){if(this.deleted)return;const[r,s]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(this.renderAxis(t,r.reverse()),await this.renderYAxes(t,r),await this.renderRangeAnnotations(t,r),s!=null)throw s}async findByXDecimal(t,r){const[s,i]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(i!=null)throw i;return await this.findByXValue(t,s.reverse().pos(r))}async findByXValue(t,r){const[s,i]=await this.dataToDecimalScale(t.hold,this.dataBounds.bind(this),t.viewport);if(i!=null)throw i;const a={...t,xDataToDecimalScale:s},o=this.yAxes.map(async c=>await c.findByXValue(a,r));return(await Promise.all(o)).flat()}async renderYAxes(t,r){const s={...t,xDataToDecimalScale:r};await Promise.all(this.yAxes.map(async i=>await i.render(s)))}get yAxes(){return this.childrenOfType(be.TYPE)}get rangeAnnotations(){return this.childrenOfType(Pe.TYPE)}async renderRangeAnnotations(t,r){const[s,i]=await this.bounds(t.hold,this.dataBounds.bind(this));if(i!=null)throw i;await Promise.all(this.rangeAnnotations.map(async a=>await a.render({dataToDecimalScale:r,region:t.plot,viewport:t.viewport,timeRange:new d.E(s.lower,s.upper)})))}async dataBounds(){return await Promise.all(this.yAxes.map(async t=>await t.xBounds()))}}h(ke,"TYPE","XAxis");const sa=p.z.object({container:l.Mt.box,viewport:l.Mt.box,hold:p.z.boolean().optional().default(!1),grid:p.z.record(li),visible:p.z.boolean().optional().default(!0),clearOverScan:l.G.crudeZ.optional().default(l.G.ZERO)}),bu=(e,n)=>{const t=l.Mt.width(e)*Math.sqrt(l.Mt.height(e)),r=l.Mt.width(n)*Math.sqrt(l.Mt.height(n));return t/r};class vn extends d.Composite{constructor(){super(...arguments);h(this,"schema",sa)}async afterUpdate(){this.internal.instrumentation=De(this.ctx,"lineplot"),this.internal.aggregate=d.useAggregate(this.ctx),this.internal.renderCtx=d.Context.use(this.ctx),N.control(this.ctx,t=>this.requestRender("low",t)),this.requestRender("high",K)}async afterDelete(){this.internal.renderCtx=d.Context.use(this.ctx),this.requestRender("high",K)}async findByXDecimal(t){const r={...this.state,plot:this.calculatePlot(),exposure:this.exposure},s=this.axes.flatMap(async i=>await i.findByXDecimal(r,t));return(await Promise.all(s)).flat()}async findByXValue(t){const r={...this.state,plot:this.calculatePlot(),exposure:this.exposure},s=this.axes.flatMap(async i=>await i.findByXValue(r,t));return(await Promise.all(s)).flat()}get axes(){return this.childrenOfType(ke.TYPE)}get tooltips(){return this.childrenOfType(Ft.TYPE)}get measures(){return this.childrenOfType(Ht.TYPE)}get exposure(){return bu(this.state.viewport,this.state.container)}async renderAxes(t,r){const s={...this.state,plot:t,canvases:r,exposure:this.exposure};await Promise.all(this.axes.map(async i=>await i.render(s)))}async renderTooltips(t,r){const s={findByXDecimal:this.findByXDecimal.bind(this),region:t,canvases:r};await Promise.all(this.tooltips.map(async i=>await i.render(s)))}async renderMeasures(t){const r={findByXDecimal:this.findByXDecimal.bind(this),findByXValue:this.findByXValue.bind(this),region:t};await Promise.all(this.measures.map(async s=>await s.render(r)))}calculatePlot(){return ro(this.state.grid,this.state.container)}async render(t){const{renderCtx:r}=this.internal,{instrumentation:s}=this.internal;if(this.deleted){s.L.debug("deleted, skipping render",{key:this.key});return}if(!this.state.visible)return s.L.debug("not visible, skipping render",{key:this.key}),async({canvases:f})=>r.erase(this.state.container,this.state.clearOverScan,...f);const i=this.calculatePlot();s.L.debug("rendering",{key:this.key,viewport:this.state.viewport,container:this.state.container,grid:this.state.grid,plot:i,canvases:t});const a=l.G.construct(this.state.clearOverScan),o=r.scissor(this.state.container,a,t.filter(f=>f!=="gl")),c=r.scissor(i,l.G.ZERO,t.filter(f=>f==="gl"));try{await this.renderAxes(i,t),await this.renderTooltips(i,t),await this.renderMeasures(i),r.gl.finish(),r.gl.flush(),r.gl.finish()}catch(f){if(f.message.toLowerCase().includes("bigint"))return;this.internal.aggregate({key:`${this.type}-${this.key}`,variant:"error",message:f.message})}finally{o(),c()}s.L.debug("rendered",{key:this.key});const u=l.Mt.copy(this.state.container);return async({canvases:f})=>r.erase(u,this.state.clearOverScan,...f)}requestRender(t,r){const{renderCtx:s}=this.internal;let i=["upper2d","lower2d","gl"];r===et&&(i=["upper2d"]),s.loop.set({key:`${this.type}-${this.key}`,render:async()=>await this.render(i),priority:t,canvases:i})}}h(vn,"TYPE","LinePlot");const vu={[vn.TYPE]:vn,[ke.TYPE]:ke,[be.TYPE]:be};exports.AcquireChannelControl=Se;exports.Annotation=dn;exports.AuthoritySource=Ee;exports.BaseProvider=Zt;exports.Button=yn;exports.Canvas=ki;exports.Canvas$1=Ce;exports.Chip=fn;exports.Controller=N;exports.Controller$1=pn;exports.Diagram=iu;exports.Diagram$1=_t;exports.Indicator=gn;exports.Legend=mn;exports.Light=xn;exports.Line=we;exports.LinePlot=vn;exports.Log=Me;exports.Measure=Ht;exports.Provider=Fe;exports.Provider$1=Pe;exports.Provider$2=Fn;exports.REASON_DATA=Gn;exports.REASON_LAYOUT=K;exports.REASON_TOOL=et;exports.REGISTRY=$a;exports.REGISTRY$1=ru;exports.REGISTRY$10=Oi;exports.REGISTRY$11=du;exports.REGISTRY$12=ms;exports.REGISTRY$13=oi;exports.REGISTRY$14=fu;exports.REGISTRY$15=Ki;exports.REGISTRY$16=na;exports.REGISTRY$17=uu;exports.REGISTRY$18=Qc;exports.REGISTRY$2=Wi;exports.REGISTRY$3=nu;exports.REGISTRY$4=Vi;exports.REGISTRY$5=au;exports.REGISTRY$6=_c;exports.REGISTRY$7=vu;exports.REGISTRY$8=Ji;exports.REGISTRY$9=xu;exports.Rule=Bt;exports.STATUSES=$i;exports.SetChannelValue=Te;exports.Setpoint=wn;exports.StateProvider=Gt;exports.Table=ve;exports.Toggle=bn;exports.Tooltip=Ft;exports.Value=qt;exports.XAxis=ke;exports.YAxis=be;exports.ZERO_CONTEXT_VALUE=Jn;exports.acquireChannelControl=tu;exports.acquireChannelControlPropsZ=_i;exports.aether=Wc;exports.annotationStateZ=Ai;exports.authoritySource=eu;exports.authoritySourceProps=Fi;exports.axisStateZ=Rr;exports.buttonStateZ=ji;exports.canvas=su;exports.canvasStateZ=zr;exports.channelData=As;exports.chipStateZ=Zi;exports.color=Nt;exports.colorGradient=Qs;exports.controllerStateZ=Bi;exports.coreAxisStateZ=Ae;exports.diagramStateZ=Dr;exports.external=eo;exports.indicatorStateZ=Hi;exports.interpolateNumber=xe;exports.interpolateRgb=Wn;exports.interpolateString=fi;exports.legendStateZ=qi;exports.lightStateZ=Xi;exports.linePlotStateZ=sa;exports.logState=Qi;exports.measure=hu;exports.measureStateZ=Or;exports.newTickFactory=Kn;exports.parseAutoBounds=Di;exports.provider=va;exports.providerStateZ=ra;exports.providerStateZ$1=ri;exports.providerStateZ$2=mr;exports.regions=ut;exports.rollingAverage=Xs;exports.rollingAverageProps=gr;exports.ruleStateZ=Yr;exports.scaleNumber=ti;exports.setChannelValue=Jc;exports.setChannelValuePropsZ=Gi;exports.setpoint=Hs;exports.setpointStateZ=ta;exports.sinkPipeline=Ls;exports.sinkPipelinePropsZ=cr;exports.sourcePipeline=Ds;exports.sourcePipelinePropsZ=lr;exports.stateProviderStateZ=Ni;exports.stateZ=Li;exports.statusZ=Ui;exports.streamChannelData=Zs;exports.streamChannelValue=Ns;exports.streamChannelValuePropsZ=ur;exports.stringSourceSpecZ=ar;exports.stringifyNumber=Vs;exports.stringifyNumberProps=pr;exports.sugaredStateZ=Ii;exports.tickFactoryProps=kr;exports.tickType=Pr;exports.toggleStateZ=ea;exports.tooltip=ou;exports.tooltipStateZ=Lr;exports.value=mu;exports.withinBounds=qs;exports.withinBoundsProps=fr;exports.withinSizeThreshold=Ri;exports.xAxisStateZ=wu;exports.yAxisStateZ=Vc;
@@ -1 +0,0 @@
1
- "use strict";var Pt=Object.defineProperty;var Ht=(t,e,r)=>e in t?Pt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var C=(t,e,r)=>Ht(t,typeof e!="symbol"?e+"":e,r);const i=require("zod"),Q=i.z.tuple([i.z.number(),i.z.number()]);i.z.tuple([i.z.bigint(),i.z.bigint()]);const ve=i.z.object({width:i.z.number(),height:i.z.number()}),Yt=i.z.object({signedWidth:i.z.number(),signedHeight:i.z.number()}),kt=["width","height"];i.z.enum(kt);const Wt=["start","center","end"],Ft=["signedWidth","signedHeight"];i.z.enum(Ft);const k=i.z.object({x:i.z.number(),y:i.z.number()}),De=i.z.object({clientX:i.z.number(),clientY:i.z.number()}),Me=["x","y"],je=i.z.enum(Me),qe=["top","right","bottom","left"],Xt=i.z.enum(qe),ee=["left","right"],Te=i.z.enum(ee),te=["top","bottom"],Se=i.z.enum(te),Ie=["center"],he=i.z.enum(Ie),Dt=[...qe,...Ie],re=i.z.enum(Dt);i.z.enum(Wt);const qt=["first","last"];i.z.enum(qt);const Ge=i.z.object({lower:i.z.number(),upper:i.z.number()}),Gt=i.z.object({lower:i.z.bigint(),upper:i.z.bigint()});i.z.union([Ge,Q]);i.z.union([Gt,Q]);const Vt=i.z.union([je,re]),Ut=i.z.union([je,re,i.z.instanceof(String)]),S=t=>typeof t=="bigint"||t instanceof BigInt,Y=(t,e)=>S(t)?t.valueOf()-BigInt(e.valueOf().valueOf()):t.valueOf()-Number(e.valueOf()),Ve=(t,e)=>S(t)?t.valueOf()+BigInt(e.valueOf().valueOf()):t+Number(e.valueOf()),Kt=(t,e,r=1e-4)=>Math.abs(t-e)<r,fe=(t,e)=>S(t)?t===BigInt(e.valueOf().valueOf()):t===Number(e.valueOf()),Jt=t=>{const e=10**Math.floor(Math.log10(t));return Math.round(t/e)*e},Ue=(t,e)=>S(t)?t.valueOf()<BigInt(e.valueOf())?t:BigInt(e.valueOf()):t.valueOf()<Number(e.valueOf())?t:Number(e.valueOf()),Qt=(t,e)=>S(t)?t.valueOf()>BigInt(e.valueOf())?t:BigInt(e.valueOf()):t.valueOf()>Number(e.valueOf())?t:Number(e.valueOf()),Ke=t=>S(t)||t instanceof BigInt?t.valueOf()<0n?-t:t:t.valueOf()<0?-t:t,Je=(t,e)=>S(t)?t.valueOf()*BigInt(e.valueOf()):t.valueOf()*Number(e.valueOf()),er=(t,e)=>S(t)?t.valueOf()/BigInt(e.valueOf()):t.valueOf()/Number(e.valueOf()),tr=Object.freeze(Object.defineProperty({__proto__:null,abs:Ke,add:Ve,closeTo:Kt,div:er,equal:fe,max:Qt,min:Ue,mult:Je,roundToNearestMagnitude:Jt,sub:Y},Symbol.toStringTag,{value:"Module"})),p=(t,e)=>{const r={};if(typeof t=="number"||typeof t=="bigint")e!=null?(r.lower=t,r.upper=e):(r.lower=typeof t=="bigint"?0n:0,r.upper=t);else if(Array.isArray(t)){if(t.length!==2)throw new Error("bounds: expected array of length 2");[r.lower,r.upper]=t}else return ye(t);return ye(r)},rr=Object.freeze({lower:0,upper:0}),nr=Object.freeze({lower:-1/0,upper:1/0}),or=Object.freeze({lower:0,upper:1}),sr=Object.freeze({lower:-1,upper:1}),ir=(t,e)=>{if(t==null&&e==null)return!0;if(t==null||e==null)return!1;const r=p(t),n=p(e);return(r==null?void 0:r.lower)===(n==null?void 0:n.lower)&&(r==null?void 0:r.upper)===(n==null?void 0:n.upper)},ye=t=>t.lower>t.upper?{lower:t.upper,upper:t.lower}:t,Qe=(t,e)=>{const r=p(t);return e<r.lower?r.lower:e>=r.upper?r.upper-(typeof r.upper=="number"?1:1n):e},v=(t,e)=>{const r=p(t);if(typeof e=="number"||typeof e=="bigint")return e>=r.lower&&e<r.upper;const n=p(e);return n.lower>=r.lower&&n.upper<=r.upper},ur=(t,e)=>{const r=p(t),n=p(e);return r.lower===n.lower?!0:n.upper===r.lower||n.lower===r.upper?!1:v(r,n.upper)||v(r,n.lower)||v(n,r.upper)||v(n,r.lower)},ne=t=>{const e=p(t);return e.upper-e.lower},lr=t=>{const e=p(t);return typeof e.lower=="bigint"?e.lower===0n&&e.upper===0n:e.lower===0&&e.upper===0},cr=t=>{const e=ne(t);return typeof e=="number"?e===0:e===0n},ar=t=>{const e=p(t);return typeof e.lower=="bigint"?!0:Number.isFinite(e.lower)&&Number.isFinite(e.upper)},pr=t=>{const e=p(t);return(e.upper+e.lower)/2},hr=t=>({lower:Math.min(...t.map(e=>p(e).lower)),upper:Math.max(...t.map(e=>p(e).upper))}),fr=t=>({lower:Math.max(...t.map(e=>p(e).lower)),upper:Math.min(...t.map(e=>p(e).upper))}),yr=t=>{const e=p(t),r=typeof e.lower=="bigint";return Array.from({length:Number(ne(t))},(n,o)=>r?e.lower+BigInt(o):e.lower+o)},de=(t,e)=>{const r=t.map(s=>p(s)),n=r.findIndex(s=>v(s,e)||e<s.lower);if(n===-1)return{index:t.length,position:0};const o=r[n];return v(o,e)?{index:n,position:Number(e-o.lower)}:{index:n,position:0}},ce={removeBefore:0,removeAfter:0,insertInto:0,deleteInBetween:0},dr=(t,e)=>{const r=t.map(a=>p(a)),n=p(e);if(r.length===0)return ce;const o=de(r,n.lower),s=de(r,n.upper);if(o.index===t.length)return{...ce,insertInto:t.length};if(s.index===0)return{...ce,removeAfter:s.position};if(o.index===s.index)return o.position!==0&&s.position!==0?null:{removeAfter:s.position,removeBefore:o.position,insertInto:o.index,deleteInBetween:0};let u=s.index-o.index,l=o.index,c=Y(Number(ne(r[o.index])),o.position);return o.position!==0?(u-=1,l+=1):c=0,{removeBefore:c,removeAfter:s.position,insertInto:l,deleteInBetween:u}},et=(t,e,r)=>{const n=t.map(l=>p(l)),o=r>0?1:r<0?-1:0;if(o===0)return e;let s=r,u=e;for(;fe(s,0)===!1;){const l=n.findIndex(c=>o>0?u>=c.lower&&u<c.upper:u>c.lower&&u<=c.upper);if(l!==-1){const c=n[l];let a;if(o>0?a=Y(c.upper,u):a=Y(u,c.lower),a>0){const h=Ue(Ke(s),a);if(u=Ve(u,o>0?h:-h),s=Y(s,o>0?h:-h),fe(s,0))return u;continue}}if(o>0){const c=n.filter(a=>a.lower>u);if(c.length>0)u=c[0].lower;else return u}else{const c=n.filter(a=>a.upper<u);if(c.length>0)u=c[c.length-1].upper;else return u}}return u},tt=(t,e,r)=>{const n=t.map(u=>p(u));if(e===r)return typeof e=="bigint"?0n:0;const o=e<r?p([e,r]):p([r,e]);let s=typeof e=="bigint"?0n:0;for(const u of n){const l=u.lower>o.lower?u.lower:o.lower,c=u.upper<o.upper?u.upper:o.upper;if(l<c){const a=c-l;s=s+a}}return s},gr=Object.freeze(Object.defineProperty({__proto__:null,CLIP:sr,DECIMAL:or,INFINITE:nr,ZERO:rr,bounds:Ge,buildInsertionPlan:dr,clamp:Qe,construct:p,contains:v,distance:tt,equals:ir,findInsertPosition:de,isFinite:ar,isZero:lr,linspace:yr,makeValid:ye,max:hr,mean:pr,min:fr,overlapsWith:ur,span:ne,spanIsZero:cr,traverse:et},Symbol.toStringTag,{value:"Module"})),rt=Vt,O=t=>Me.includes(t)?t:te.includes(t)?"y":"x",br=t=>O(t)==="x"?"y":"x",xr=t=>O(t)==="x"?"width":"height",mr=t=>O(t)==="x"?"left":"top",wr=t=>rt.safeParse(t).success,$r=t=>O(t)==="x"?"signedWidth":"signedHeight",nt=Object.freeze(Object.defineProperty({__proto__:null,construct:O,crude:rt,dimension:xr,direction:je,isDirection:wr,location:mr,signedDimension:$r,swap:br},Symbol.toStringTag,{value:"Module"})),zr=t=>{const e=t.replace(/_[a-z]/g,r=>r[1].toUpperCase());return e.length>1&&e[0]===e[0].toUpperCase()&&e[1]===e[1].toUpperCase()||e.length===0?e:e[0].toLowerCase()+e.slice(1)},Ee=t=>{const e=(r,n=ge)=>{if(typeof r=="string")return t(r);if(Array.isArray(r))return r.map(u=>e(u,n));if(!ae(r))return r;n=vr(n);const o={},s=r;return Object.keys(s).forEach(u=>{let l=s[u];const c=t(u);n.recursive&&(ae(l)?We(l,n.keepTypesOnRecursion)||(l=e(l,n)):n.recursiveInArray&&ke(l)&&(l=[...l].map(a=>{let h=a;return ae(a)?We(h,n.keepTypesOnRecursion)||(h=e(a,n)):ke(a)&&(h=e({key:a},n).key),h}))),o[c]=l}),o};return e},ot=Ee(zr),Or=t=>t.replace(/([a-z0-9])([A-Z])/g,(e,r,n)=>`${r}_${n.toLowerCase()}`),st=Ee(Or),it=t=>t.length===0?t:t[0].toUpperCase()+t.slice(1),ge={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},vr=(t=ge)=>(t.recursive==null?t=ge:t.recursiveInArray??(t.recursiveInArray=!1),t),ke=t=>t!=null&&Array.isArray(t),ae=t=>t!=null&&typeof t=="object"&&!Array.isArray(t),We=(t,e)=>(e||[]).some(r=>t instanceof r),Mr=t=>t.replace(/\s+/g,"-").replace(/([a-z0-9])([A-Z])/g,(e,r,n)=>`${r}-${n.toLowerCase()}`).toLowerCase(),jr=Ee(Mr),Tr=Object.freeze(Object.defineProperty({__proto__:null,camelToSnake:st,capitalize:it,snakeToCamel:ot,toKebab:jr},Symbol.toStringTag,{value:"Module"})),Sr=Te,Ir=Se,Er=he,Br={top:"bottom",right:"left",bottom:"top",left:"right",center:"center"},Nr={top:"left",right:"top",bottom:"right",left:"bottom",center:"center"},Cr=Ut,T=t=>t instanceof String||!Me.includes(t)?t:t==="x"?"left":"top",ut=t=>Br[T(t)],Ar=t=>Nr[T(t)],W=t=>{const e=T(t);return e==="top"||e==="bottom"?"y":"x"},lt=i.z.object({x:Te.or(he),y:Se.or(he)}),ct=i.z.object({x:Te,y:Se}),R=Object.freeze({x:"left",y:"top"}),Be=Object.freeze({x:"right",y:"top"}),oe=Object.freeze({x:"left",y:"bottom"}),Ne=Object.freeze({x:"right",y:"bottom"}),se=Object.freeze({x:"center",y:"center"}),at=Object.freeze({x:"center",y:"top"}),pt=Object.freeze({x:"center",y:"bottom"}),ht=Object.freeze({x:"right",y:"center"}),ft=Object.freeze({x:"left",y:"center"}),yt=Object.freeze([ft,ht,at,pt,R,Be,oe,Ne,se]),ie=(t,e)=>t.x===e.x&&t.y===e.y,dt=(t,e)=>{if(typeof e=="object"){let r=!0;return"x"in e&&(t.x===e.x||(r=!1)),"y"in e&&(t.y===e.y||(r=!1)),r}return t.x===e||t.y===e},gt=t=>[t.x,t.y],V=t=>W(T(t))==="x",Rr=t=>W(T(t))==="y",Lr=t=>`${t.x}${it(t.y)}`,_r=(t,e)=>{let r,n;if(typeof t=="object"&&"x"in t?(r=t.x,n=t.y):(r=T(t),n=T(e??t)),W(r)===W(n)&&r!=="center"&&n!=="center")throw new Error(`[XYLocation] - encountered two locations with the same direction: ${r.toString()} - ${n.toString()}`);const o={...se};return r==="center"?V(n)?[o.x,o.y]=[n,r]:[o.x,o.y]=[r,n]:n==="center"?V(r)?[o.x,o.y]=[r,n]:[o.x,o.y]=[n,r]:V(r)?[o.x,o.y]=[r,n]:[o.x,o.y]=[n,r],o},Ce=Object.freeze(Object.defineProperty({__proto__:null,BOTTOM_CENTER:pt,BOTTOM_LEFT:oe,BOTTOM_RIGHT:Ne,CENTER:se,CENTER_LOCATIONS:Ie,LEFT_CENTER:ft,RIGHT_CENTER:ht,TOP_CENTER:at,TOP_LEFT:R,TOP_RIGHT:Be,XY_LOCATIONS:yt,X_LOCATIONS:ee,Y_LOCATIONS:te,center:Er,construct:T,constructXY:_r,corner:ct,crude:Cr,direction:W,isX:V,isY:Rr,location:re,outer:Xt,rotate90:Ar,swap:ut,x:Sr,xy:lt,xyCouple:gt,xyEquals:ie,xyMatches:dt,xyToString:Lr,y:Ir},Symbol.toStringTag,{value:"Module"})),be=i.z.union([i.z.number(),k,Q,ve,Yt,De]),y=(t,e)=>{if(typeof t=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return t==="x"?{x:e,y:0}:{x:0,y:e}}return typeof t=="number"?{x:t,y:e??t}:Array.isArray(t)?{x:t[0],y:t[1]}:"signedWidth"in t?{x:t.signedWidth,y:t.signedHeight}:"clientX"in t?{x:t.clientX,y:t.clientY}:"width"in t?{x:t.width,y:t.height}:{x:t.x,y:t.y}},x=Object.freeze({x:0,y:0}),bt=Object.freeze({x:1,y:1}),Zr=Object.freeze({x:1/0,y:1/0}),Pr=Object.freeze({x:NaN,y:NaN}),J=(t,e,r=0)=>{const n=y(t),o=y(e);return r===0?n.x===o.x&&n.y===o.y:Math.abs(n.x-o.x)<=r&&Math.abs(n.y-o.y)<=r},Hr=t=>J(t,x),Ae=(t,e,r)=>{const n=y(t),o=y(e,r);return{x:n.x*o.x,y:n.y*o.y}},xt=(t,e)=>{const r=y(t);return{x:r.x+e,y:r.y}},mt=(t,e)=>{const r=y(t);return{x:r.x,y:r.y+e}},F=(t,e,r,...n)=>typeof e=="string"&&typeof r=="number"?e==="x"?xt(t,r):mt(t,r):[t,e,r??x,...n].reduce((o,s)=>{const u=y(s);return{x:o.x+u.x,y:o.y+u.y}},x),Yr=(t,e,r)=>{const n=y(t);return e==="x"?{x:r,y:n.y}:{x:n.x,y:r}},kr=(t,e)=>{const r=y(t),n=y(e);return Math.sqrt((r.x-n.x)**2+(r.y-n.y)**2)},Wr=(t,e)=>{const r=y(t),n=y(e);return{x:n.x-r.x,y:n.y-r.y}},Fr=t=>{const e=y(t);return Number.isNaN(e.x)||Number.isNaN(e.y)},Xr=t=>{const e=y(t);return Number.isFinite(e.x)&&Number.isFinite(e.y)},Dr=t=>{const e=y(t);return[e.x,e.y]},qr=t=>{const e=y(t);return{left:e.x,top:e.y}},xe=(t,e=0)=>{const r=y(t);return{x:Number(r.x.toFixed(e)),y:Number(r.y.toFixed(e))}},Z=(t,e)=>{const r=y(t),n=y(e);return{x:r.x-n.x,y:r.y-n.y}},P=t=>{const e=y(t),r=Math.hypot(e.x,e.y);return r===0?{x:0,y:0}:{x:-e.y/r,y:e.x/r}},wt=t=>{const e=y(t),r=Math.hypot(e.x,e.y);return r===0?{x:0,y:0}:{x:e.x/r,y:e.y/r}},$t=(...t)=>{const e=t.reduce((r,n)=>F(r,n),x);return Ae(e,1/t.length)},Gr=(t,e)=>{const r=[];for(let n=0;n<t.length;n++){const o=t[n];let s,u,l,c;if(n===0){const a=t[n+1],h=Z(a,o);u=P(h),l=u,c=e}else if(n===t.length-1){const a=t[n-1],h=Z(o,a);s=P(h),l=s,c=e}else{const a=t[n-1],h=t[n+1],I=Z(o,a),_=Z(h,o);s=P(I),u=P(_);const Zt=Math.acos((I.x*_.x+I.y*_.y)/(Math.hypot(I.x,I.y)*Math.hypot(_.x,_.y))),Ye=Math.sin(Zt/2);Ye===0?c=e:c=e/Ye,l=wt($t(s,u))}r.push(Ae(l,c))}return r},Vr=Object.freeze(Object.defineProperty({__proto__:null,INFINITY:Zr,NAN:Pr,ONE:bt,ZERO:x,average:$t,calculateMiters:Gr,clientXY:De,construct:y,couple:Dr,crudeZ:be,css:qr,distance:kr,equals:J,isFinite:Xr,isNan:Fr,isZero:Hr,normal:P,normalize:wt,scale:Ae,set:Yr,sub:Z,translate:F,translateX:xt,translateY:mt,translation:Wr,truncate:xe,xy:k},Symbol.toStringTag,{value:"Module"})),X=i.z.union([i.z.number(),i.z.string()]),Ur=i.z.object({top:X,left:X,width:X,height:X}),Kr=i.z.object({left:i.z.number(),top:i.z.number(),right:i.z.number(),bottom:i.z.number()}),Jr=i.z.object({one:k,two:k,root:ct}),zt={one:x,two:x,root:R},Qr={one:x,two:bt,root:oe},Ot=(t,e)=>({one:t.one,two:t.two,root:e??t.root}),f=(t,e,r=0,n=0,o)=>{const s={one:{...x},two:{...x},root:o??R};if(typeof t=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return s.one={x:t,y:e},s.two={x:s.one.x+r,y:s.one.y+n},s}return"one"in t&&"two"in t&&"root"in t?{...t,root:o??t.root}:("getBoundingClientRect"in t&&(t=t.getBoundingClientRect()),"left"in t?(s.one={x:t.left,y:t.top},s.two={x:t.right,y:t.bottom},s):(s.one=t,e==null?s.two={x:s.one.x+r,y:s.one.y+n}:typeof e=="number"?s.two={x:s.one.x+e,y:s.one.y+r}:"width"in e?s.two={x:s.one.x+e.width,y:s.one.y+e.height}:"signedWidth"in e?s.two={x:s.one.x+e.signedWidth,y:s.one.y+e.signedHeight}:s.two=e,s))},en=(t,e,r)=>{const n=f(t);if(typeof e=="string"){if(r==null)throw new Error("Invalid arguments for resize");const o=O(e);return f(n.one,void 0,o==="x"?r:$(n),o==="y"?r:z(n),n.root)}return f(n.one,e,void 0,void 0,n.root)},tn=(t,e,r=!0)=>{const n=f(t);let o=(s,u)=>s<u;return r&&(o=(s,u)=>s<=u),"one"in e?o(M(n),M(e))&&o(E(e),E(n))&&o(j(n),j(e))&&o(B(e),B(n)):o(M(n),e.x)&&o(e.x,E(n))&&o(j(n),e.y)&&o(e.y,B(n))},rn=(t,e)=>J(t.one,e.one)&&J(t.two,e.two)&&ie(t.root,e.root),vt=t=>({width:$(t),height:z(t)}),nn=t=>({signedWidth:ue(t),signedHeight:le(t)}),on=t=>({top:j(t),left:M(t),width:$(t),height:z(t)}),Re=(t,e,r=!1)=>{const n=O(e)==="y"?le(t):ue(t);return r?n:Math.abs(n)},L=(t,e)=>{const r=f(t);return{x:e.x==="center"?me(r).x:N(r,e.x),y:e.y==="center"?me(r).y:N(r,e.y)}},N=(t,e)=>{const r=f(t),n=gt(r.root).includes(e)?Math.min:Math.max;return ee.includes(e)?n(r.one.x,r.two.x):n(r.one.y,r.two.y)},sn=t=>t.one.x===t.two.x&&t.one.y===t.two.y,$=t=>Re(t,"x"),z=t=>Re(t,"y"),ue=t=>{const e=f(t);return e.two.x-e.one.x},le=t=>{const e=f(t);return e.two.y-e.one.y},Mt=t=>L(t,R),un=t=>L(t,Be),ln=t=>L(t,oe),cn=t=>L(t,Ne),E=t=>N(t,"right"),B=t=>N(t,"bottom"),M=t=>N(t,"left"),j=t=>N(t,"top"),me=t=>F(Mt(t),{x:ue(t)/2,y:le(t)/2}),Le=t=>{const e=f(t);return e.root.x==="left"?M(e):E(e)},_e=t=>{const e=f(t);return e.root.y==="top"?j(e):B(e)},an=t=>({x:Le(t),y:_e(t)}),U=t=>{const e=f(t);return{lower:e.one.x,upper:e.two.x}},K=t=>{const e=f(t);return{lower:e.one.y,upper:e.two.y}},pn=(t,e)=>Ot(t,e),hn=(t,e)=>{const r=f(t),n=ee.includes(e)?"x":te.includes(e)?"y":null;if(n===null)throw new Error(`Invalid location: ${Ce}`);const o=e==="top"||e==="left"?Math.min:Math.max,s={...r.one},u={...r.two};return s[n]=o(r.one[n],r.two[n]),u[n]=o(r.one[n],r.two[n]),[s,u]},fn=(t,e)=>{const r=f(t),n=f(e),o=Le(n)+($(n)-$(r))/2,s=_e(n)+(z(n)-z(r))/2;return f({x:o,y:s},vt(r))},jt=t=>typeof t!="object"||t==null?!1:"one"in t&&"two"in t&&"root"in t,yn=t=>$(t)/z(t),dn=(t,e,r)=>{if(typeof e=="string"){if(r==null)throw new Error("Undefined amount passed into box.translate");const o=O(e);e=y(o,r)}const n=f(t);return f(F(n.one,e),F(n.two,e),void 0,void 0,n.root)},Tt=(t,e)=>{const r=Math.max(M(t),M(e)),n=Math.max(j(t),j(e)),o=Math.min(E(t),E(e)),s=Math.min(B(t),B(e));return r>o||n>s?zt:f({x:r,y:n},{x:o,y:s},void 0,void 0,t.root)},St=t=>$(t)*z(t),gn=(t,e)=>{const r=f(t);return f(xe(r.one,e),xe(r.two,e),void 0,void 0,r.root)},It=(t,e,r,n,o,s)=>{const u={x:t,y:e},l={x:t+r,y:e+n};return o.x!==s.x&&(o.x==="center"?(u.x-=r/2,l.x-=r/2):(u.x-=r,l.x-=r)),o.y!==s.y&&(o.y==="center"?(u.y-=n/2,l.y-=n/2):(u.y-=n,l.y-=n)),f(u,l,void 0,void 0,s)},bn=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:Qr,ZERO:zt,area:St,areaIsZero:sn,aspect:yn,bottom:B,bottomLeft:ln,bottomRight:cn,box:Jr,center:me,construct:f,constructWithAlternateRoot:It,contains:tn,copy:Ot,css:on,cssBox:Ur,dim:Re,dims:vt,domRect:Kr,edgePoints:hn,equals:rn,height:z,intersection:Tt,isBox:jt,left:M,loc:N,positionInCenter:fn,reRoot:pn,resize:en,right:E,root:an,signedDims:nn,signedHeight:le,signedWidth:ue,top:j,topLeft:Mt,topRight:un,translate:dn,truncate:gn,width:$,x:Le,xBounds:U,xyLoc:L,y:_e,yBounds:K},Symbol.toStringTag,{value:"Module"})),Et=i.z.object({signedWidth:i.z.number(),signedHeight:i.z.number()}),xn=i.z.union([ve,Et,k,Q]),mn={width:0,height:0},wn={width:1,height:1},g=(t,e)=>typeof t=="number"?{width:t,height:e??t}:Array.isArray(t)?{width:t[0],height:t[1]}:"x"in t?{width:t.x,height:t.y}:"signedWidth"in t?{width:t.signedWidth,height:t.signedHeight}:{...t},$n=(t,e)=>{if(e==null)return!1;const r=g(t),n=g(e);return r.width===n.width&&r.height===n.height},zn=t=>{const e=g(t);return{width:e.height,height:e.width}},On=t=>{const e=g(t);return`0 0 ${e.width} ${e.height}`},vn=t=>{const e=g(t);return[e.width,e.height]},Mn=t=>({width:Math.max(...t.map(e=>g(e).width)),height:Math.max(...t.map(e=>g(e).height))}),jn=t=>({width:Math.min(...t.map(e=>g(e).width)),height:Math.min(...t.map(e=>g(e).height))}),Tn=(t,e)=>{const r=g(t);return{width:r.width*e,height:r.height*e}},Sn=Object.freeze(Object.defineProperty({__proto__:null,DECIMAL:wn,ZERO:mn,construct:g,couple:vn,crude:xn,dimensions:ve,equals:$n,max:Mn,min:jn,scale:Tn,signed:Et,svgViewBox:On,swap:zn},Symbol.toStringTag,{value:"Module"}));var In=Object.defineProperty,En=(t,e,r)=>e in t?In(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,w=(t,e,r)=>En(t,typeof e!="symbol"?e+"":e,r);const Bt=(t,e,r)=>e!==void 0&&t<e?e:r!==void 0&&t>r?r:t,Bn=i.z.object({offset:be,scale:be}),Nn=i.z.object({offset:i.z.number(),scale:i.z.number()}),Cn=t=>(e,r,n,o)=>r==="dimension"?[e,n]:[e,o?n-t:n+t],An=t=>(e,r,n,o)=>[e,o?n/t:n*t],Rn=t=>(e,r,n)=>{if(e===null)return[t,n];const{lower:o,upper:s}=e,{lower:u,upper:l}=t,c=s-o,a=l-u;if(r==="dimension")return[t,n*(a/c)];const h=(n-o)*(a/c)+u;return[t,h]},Ln=t=>(e,r,n)=>[t,n],_n=()=>(t,e,r)=>{if(t===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[t,r];const{lower:n,upper:o}=t;return[t,o-(r-n)]},Zn=t=>(e,r,n)=>{const{lower:o,upper:s}=t;return n=Bt(n,o,s),[e,n]},we=class H{constructor(){w(this,"ops",[]),w(this,"currBounds",null),w(this,"currType",null),w(this,"reversed",!1),this.ops=[]}static translate(e){return new H().translate(e)}static magnify(e){return new H().magnify(e)}static scale(e,r){return new H().scale(e,r)}translate(e){const r=this.new(),n=Cn(e);return n.type="translate",r.ops.push(n),r}magnify(e){const r=this.new(),n=An(e);return n.type="magnify",r.ops.push(n),r}scale(e,r){const n=p(e,r),o=this.new(),s=Rn(n);return s.type="scale",o.ops.push(s),o}clamp(e,r){const n=p(e,r),o=this.new(),s=Zn(n);return s.type="clamp",o.ops.push(s),o}reBound(e,r){const n=p(e,r),o=this.new(),s=Ln(n);return s.type="re-bound",o.ops.push(s),o}invert(){const e=_n();e.type="invert";const r=this.new();return r.ops.push(e),r}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new H;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,r){return this.currBounds=null,this.ops.reduce(([n,o],s)=>s(n,e,o,this.reversed),[null,r])[1]}reverse(){const e=this.new();e.ops.reverse();const r=[];return e.ops.forEach((n,o)=>{if(n.type==="scale"||r.some(([u,l])=>o>=u&&o<=l))return;const s=e.ops.findIndex((u,l)=>u.type==="scale"&&l>o);s!==-1&&r.push([o,s])}),r.forEach(([n,o])=>{const s=e.ops.slice(n,o);s.unshift(e.ops[o]),e.ops.splice(n,o-n+1,...s)}),e.reversed=!e.reversed,e}get transform(){return{scale:this.dim(1),offset:this.pos(0)}}};w(we,"IDENTITY",new we);let $e=we;const ze=class m{constructor(e=new $e,r=new $e,n=null){w(this,"x"),w(this,"y"),w(this,"currRoot"),this.x=e,this.y=r,this.currRoot=n}static translate(e,r){return new m().translate(e,r)}static translateX(e){return new m().translateX(e)}static translateY(e){return new m().translateY(e)}static clamp(e){return new m().clamp(e)}static magnify(e){return new m().magnify(e)}static scale(e){return new m().scale(e)}static reBound(e){return new m().reBound(e)}translate(e,r){const n=y(e,r),o=this.copy();return o.x=this.x.translate(n.x),o.y=this.y.translate(n.y),o}translateX(e){const r=this.copy();return r.x=this.x.translate(e),r}translateY(e){const r=this.copy();return r.y=this.y.translate(e),r}magnify(e){const r=this.copy();return r.x=this.x.magnify(e.x),r.y=this.y.magnify(e.y),r}scale(e){const r=this.copy();if(jt(e)){const n=this.currRoot;return r.currRoot=e.root,n!=null&&!ie(n,e.root)&&(n.x!==e.root.x&&(r.x=r.x.invert()),n.y!==e.root.y&&(r.y=r.y.invert())),r.x=r.x.scale(U(e)),r.y=r.y.scale(K(e)),r}return r.x=r.x.scale(e.width),r.y=r.y.scale(e.height),r}reBound(e){const r=this.copy();return r.x=this.x.reBound(U(e)),r.y=this.y.reBound(K(e)),r}clamp(e){const r=this.copy();return r.x=this.x.clamp(U(e)),r.y=this.y.clamp(K(e)),r}copy(){const e=new m;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}dim(e){return{x:this.x.dim(e.x),y:this.y.dim(e.y)}}box(e){return f(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}get transform(){return{scale:this.dim({x:1,y:1}),offset:this.pos({x:0,y:0})}}};w(ze,"IDENTITY",new ze);let Pn=ze;const Hn=Object.freeze(Object.defineProperty({__proto__:null,Scale:$e,XY:Pn,crudeXYTransform:Bn,transform:Nn},Symbol.toStringTag,{value:"Module"}));function Nt(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(r=Nt(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Ct(){for(var t,e,r=0,n="",o=arguments.length;r<o;r++)(t=arguments[r])&&(e=Nt(t))&&(n&&(n+=" "),n+=e);return n}const Yn=Ct,Fe="-",Xe="__",D="--",Ze=t=>{const e=(...r)=>Yn(...r);return e.B=r=>t+Fe+r,e.E=r=>t+Xe+r,e.M=r=>t+D+r,e.BM=(r,n)=>e.B(r)+D+n,e.BE=(r,n)=>e.B(r)+Xe+n,e.BEM=(r,n,o)=>e.BE(r,n)+D+o,e.extend=r=>Ze(e.B(r)),e.var=r=>D+t+Fe+r,e},kn=/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i,Oe=i.z.string().regex(kn),A=i.z.number().min(0).max(255),Wn=i.z.number().min(0).max(1),Pe=i.z.tuple([A,A,A,Wn]),At=i.z.tuple([A,A,A]),Rt=i.z.object({rgba255:Pe}),Fn=t=>t==null?void 0:new d(t).hex,Xn=t=>{if(t==null)return;const e=d.z.safeParse(t);if(e.success)return e.data.rgbaCSS;if(typeof t=="string")return t;throw e.error},b=class b{constructor(e,r=1){C(this,"rgba255");if(typeof e=="string")this.rgba255=b.fromHex(e,r);else if(Array.isArray(e)){if(e.length<3||e.length>4)throw new Error(`Invalid color: [${e.join(", ")}]`);this.rgba255=e.length===3?[...e,r??1]:e}else this.rgba255=e.rgba255}equals(e){if(e==null)return!1;const r=new b(e);return this.rgba255.every((n,o)=>n===r.rgba255[o])}get hex(){const[e,r,n,o]=this.rgba255;return`#${q(e)}${q(r)}${q(n)}${o===1?"":q(o*255)}`}get rgbaCSS(){const[e,r,n,o]=this.rgba255;return`rgba(${e}, ${r}, ${n}, ${o})`}get rgbCSS(){return`rgb(${this.rgbString})`}get rgbString(){const[e,r,n]=this.rgba255;return`${e}, ${r}, ${n}`}get rgba1(){return[...this.rgb1,this.rgba255[3]]}get rgb1(){return[this.rgba255[0]/255,this.rgba255[1]/255,this.rgba255[2]/255]}get r(){return this.rgba255[0]}get g(){return this.rgba255[1]}get b(){return this.rgba255[2]}get a(){return this.rgba255[3]}get isZero(){return this.equals(He)}get hsla(){return Gn(this.rgba255)}setAlpha(e){const[r,n,o]=this.rgba255;if(e>100)throw new Error(`Color opacity must be between 0 and 100, got ${e}`);return e>1&&(e/=100),new b([r,n,o,e])}get luminance(){const[e,r,n]=this.rgb1.map(o=>o<=.03928?o/12.92:((o+.055)/1.055)**2.4);return Number((.2126*e+.7152*r+.0722*n).toFixed(3))}get grayness(){const[e,r,n]=this.rgb1;return 1-(Math.max(e,r,n)-Math.min(e,r,n))}contrast(e){const r=new b(e),n=this.luminance,o=r.luminance;return(Math.max(n,o)+.5)/(Math.min(n,o)+.5)}pickByContrast(...e){if(e.length===0)throw new Error("[Color.pickByContrast] - must provide at least one color");const[r]=e.map(n=>new b(n)).sort((n,o)=>this.contrast(o)-this.contrast(n));return r}get isDark(){return this.luminance<.5}get isLight(){return!this.isDark}static fromHex(e,r=1){if(!Oe.safeParse(e).success)throw new Error(`Invalid hex color: ${e}`);return e=Dn(e),[G(e,0),G(e,2),G(e,4),e.length===8?G(e,6)/255:r]}};C(b,"z",i.z.union([Oe,Pe,At,i.z.instanceof(b),Rt]).transform(e=>new b(e)));let d=b;const He=new d([0,0,0,0]),q=t=>Math.floor(t).toString(16).padStart(2,"0"),G=(t,e)=>parseInt(t.slice(e,e+2),16),Dn=t=>t.startsWith("#")?t.slice(1):t,qn=t=>{let[e,r,n]=t;const o=t[3];e/=360,r/=100,n/=100;let s,u,l;if(r===0)s=u=l=n;else{const c=n<.5?n*(1+r):n+r-n*r,a=2*n-c;s=pe(a,c,e+1/3),u=pe(a,c,e),l=pe(a,c,e-1/3)}return[Math.round(s*255),Math.round(u*255),Math.round(l*255),o]},pe=(t,e,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t),Gn=t=>{let[e,r,n]=t;const o=t[3];e/=255,r/=255,n/=255,e/=255,r/=255,n/=255;const s=Math.max(e,r,n),u=Math.min(e,r,n);let l,c,a=(s+u)/2;if(s===u)l=c=0;else{const h=s-u;c=a>.5?h/(2-s-u):h/(s+u),s===e?l=(r-n)/h+(r<n?6:0):s===r?l=(n-e)/h+2:l=(e-r)/h+4,l/=6}return l*=360,c*=100,a*=100,[Math.round(l),Math.round(c),Math.round(a),o]},Lt=i.z.union([Oe,Pe,i.z.instanceof(d),i.z.string(),At,Rt]),_t=i.z.object({key:i.z.string(),color:Lt,position:i.z.number(),switched:i.z.boolean().optional()}),Vn=i.z.array(_t),Un=(t,e)=>{if(t.length===0)return He;if(t=t.slice().sort((r,n)=>r.position-n.position),e<=t[0].position)return new d(t[0].color);if(e>=t[t.length-1].position)return new d(t[t.length-1].color);for(let r=0;r<t.length-1;r++){const n=t[r],o=t[r+1];if(e>=n.position&&e<=o.position){if(e===n.position)return new d(n.color);if(e===o.position)return new d(o.color);const s=(e-n.position)/(o.position-n.position),u=new d(n.color),l=new d(o.color),c=Math.round(u.r+s*(l.r-u.r)),a=Math.round(u.g+s*(l.g-u.g)),h=Math.round(u.b+s*(l.b-u.b)),I=u.a+s*(l.a-u.a);return new d([c,a,h,I])}}return new d(t[t.length-1].color)},Kn=i.z.object({key:i.z.string(),name:i.z.string(),color:d.z}),Jn=i.z.object({key:i.z.string(),name:i.z.string(),swatches:i.z.array(Kn)});class Qn{constructor(e=""){C(this,"rows",[]);C(this,"columns",[]);C(this,"prefix");this.prefix=e}row(e,r,n){const{prefix:o}=this;return this.rows.push({startLabel:o+e,endLabel:o+r,size:n}),this}col(e,r,n){const{prefix:o}=this;return this.columns.push({startLabel:o+e,endLabel:o+r,size:n}),this}build(){return{display:"grid",gridTemplateRows:this.rows.map((e,r)=>{let n=r===0?"[":"";return n+=`${e.startLabel}] ${e.size}${typeof e.size=="number"?"px":""} [${e.endLabel}`,n+=r===this.rows.length-1?"]":"",n}).join(" "),gridTemplateColumns:this.columns.map((e,r)=>{let n=r===0?"[":"";return n+=`${e.startLabel}] ${e.size}${typeof e.size=="number"?"px":""} [${e.endLabel}`,n+=r===this.columns.length-1?"]":"",n}).join(" ")}}}const eo=(t,e)=>Object.entries(e).forEach(([r,n])=>n!=null&&t.style.setProperty(r,`${n}`)),to=(t,e)=>Array.from(t.style).forEach(r=>{r.startsWith(e)&&t.style.removeProperty(r)}),ro=t=>{const e=Ze(t);return e.visible=r=>e.M(r?"visible":"hidden"),e.expanded=r=>e.M(r?"expanded":"collapsed"),e.loc=r=>e.M(Ce.construct(r)),e.disabled=r=>r===!0&&e.M("disabled"),e.align=r=>e.M(r),e.dir=r=>r!=null&&e.M(nt.construct(r)),e.size=r=>typeof r=="string"&&e.M(r),e.sharp=r=>r!==!1&&e.M("sharp"),e.rounded=r=>r!==!1&&e.M("rounded"),e.bordered=r=>typeof r=="boolean"?r&&e.M("bordered"):r!=null?e.M(`bordered-${r}`):e.M("bordered"),e.selected=r=>r&&e.M("selected"),e.altColor=r=>r&&e.M("alt-color"),e.editable=r=>r&&e.M("editable"),e.noSelect=e.M("no-select"),e.noWrap=r=>r&&e.M("no-wrap"),e.applyVars=eo,e.removeVars=to,e.newGridBuilder=r=>new Qn(r),e.dropRegion=r=>r&&e.B("haul-drop-region"),e.px=r=>`${r}px`,e.inheritDims=(r=!0)=>r&&e.M("inherit-dims"),e.shade=r=>e.M(`shade-${r}`),e.shadeVar=r=>{if(r!=null)return`var(--${t}-gray-l${r})`},e.levelSizeVar=r=>`var(--${t}-${r}-size)`,e},no=ro("pluto");exports.$=yt;exports.B=ie;exports.C=ot;exports.CSS=no;exports.Color=d;exports.D=dt;exports.G=Vr;exports.G$1=tr;exports.H=gr;exports.K=Ce;exports.M=Je;exports.Mt=bn;exports.P=ut;exports.T=Qe;exports.T$1=R;exports.U=et;exports.V=tt;exports.Y=Bt;exports.ZERO=He;exports._=Sn;exports.a=v;exports.a$1=$;exports.b=Hn;exports.c=re;exports.c$1=f;exports.clsx=Ct;exports.crudeZ=Lt;exports.cssString=Xn;exports.d=Tr;exports.f=z;exports.fromGradient=Un;exports.fromHSLA=qn;exports.g=nt;exports.g$1=L;exports.gradientZ=Vn;exports.gt=It;exports.i=p;exports.k=st;exports.mt=St;exports.newBEM=Ze;exports.paletteZ=Jn;exports.stopZ=_t;exports.t=O;exports.toHex=Fn;exports.w=lt;exports.wt=Tt;exports.x=se;
@@ -1 +0,0 @@
1
- "use strict";const j=require("./aggregator-By11htYo.cjs"),R=require("./jsx-runtime-D8EVjfnb.cjs"),o=require("./Toggle--8qqNnzb.cjs"),C=require("react"),se=require("./Link-CcELhLK5.cjs"),le=require("./Animated-Cv0kRBvj.cjs"),p=require("./css-CRd0zXr-.cjs");require("./Pack-SDIuOEWr.cjs");const Y=(e,t)=>t.includes(e.key),z=(e,t)=>j.F.stringsWithNumbers(e.name,t.name),H=(e,t=z)=>{typeof t=="function"&&e.sort(t);let r=!1;for(let n=0;n<e.length;n++){const s=e[n];s.forcePosition!=null&&n!==s.forcePosition&&(r=!0,e.splice(n,1),e.splice(s.forcePosition,0,s))}return r?H(e,!1):e},K=({nodes:e,expanded:t,depth:r=0,sort:n,path:s=""})=>{r===0&&n!=!1&&(e=e.sort((a,c)=>a.name.localeCompare(c.name)));const l=[];return e.forEach((a,c)=>{const i=`${s}${a.key}/`,h=Y(a,t);l.push({...a,depth:r,expanded:h,index:c,path:i}),h&&a.children!=null&&(a.children=H(a.children,n),l.push(...K({nodes:a.children,expanded:t,depth:r+1,sort:n,path:i})))}),l},ae=({tree:e,destination:t,keys:r})=>(r=j.A(r),r.forEach(n=>{const s=N({tree:e,key:n});s!=null&&(V({tree:e,keys:n}),J({tree:e,destination:t,additions:s}))}),e),V=({tree:e,keys:t})=>{t=j.A(t);const r=e.map(n=>n.key);return t.forEach(n=>{var l;const s=r.indexOf(n);if(s!==-1)e.splice(s,1);else{const a=$({tree:e,key:n});a!=null&&(a.children=(l=a.children)==null?void 0:l.filter(c=>c.key!==n))}}),e},J=({tree:e,destination:t,additions:r})=>{r=j.A(r);const n=N({tree:e,key:t});if(n==null)throw new Error(`Could not find node with key ${t}`);n.children??(n.children=[]);const s=j.c.by(r,a=>a.key,!1),l=s.map(a=>a.key);return n.children=[...s,...n.children.filter(a=>!l.includes(a.key))],e},ie=({tree:e,key:t,updater:r,throwOnMissing:n=!0})=>{var a,c;const s=N({tree:e,key:t});if(s==null){if(n)throw new Error(`Could not find node with key ${t}`);return e}const l=$({tree:e,key:t});if(l!=null){const i=(a=l.children)==null?void 0:a.findIndex(h=>h.key===t);i!=null&&i!==-1&&((c=l.children)==null||c.splice(i,1,r(s)))}else e.splice(e.findIndex(i=>i.key===t),1,r(s));return e},ce=({tree:e,parent:t,updater:r,throwOnMissing:n=!0})=>{const s=N({tree:e,key:t});if(s==null){if(n)throw new Error(`Could not find node with key ${t}`);return e}return s.children=r(s.children??[]),e},N=({tree:e,key:t,depth:r=0})=>{for(let n=0;n<e.length;n++){const s=e[n];if(s.key===t){const l=s;return l.depth=r,l.position=n,l}if(s.children!=null){const l=N({tree:s.children,key:t,depth:r+1});if(l!=null)return l}}return null},oe=({tree:e,keys:t})=>{const r=[];for(const n of t){const s=N({tree:e,key:n});s!=null&&r.push(s)}return r},$=({tree:e,key:t})=>{for(const r of e)if(r.children!=null){if(r.children.some(s=>s.key===t))return r;const n=$({tree:r.children,key:t});if(n!=null)return n}return null},Q=e=>e.map(t=>({...t,children:Q(t.children??[])})),Z=(...e)=>{const t=[];return e.forEach(r=>{t.push(r),r.children!=null&&t.push(...Z(...r.children))}),t},M="tree-item",de=[["Shift"]],ue=e=>{const{onExpand:t,nodes:r,initialExpanded:n=[],sort:s,selected:l,onSelectedChange:a}=e??{},[c,i,h]=o.useCombinedStateAndRef(n),[d,T]=j.usePassthrough({initial:[],value:l,onChange:a}),k=C.useMemo(()=>K({nodes:r,expanded:c,sort:s}),[r,c,s]),v=o.useSyncedRef(k),w=o.useHeldRef({triggers:de}),P=C.useCallback((f,{clicked:u})=>{T(f);const S=v.current.find(b=>b.key===u);if((S==null?void 0:S.hasChildren)===!1||u==null||w.current.held)return;const y=h.current,I=y.some(b=>b===u)?"contract":"expand";let E;I==="contract"?E=y.filter(b=>b!==u):E=[...y,u],i(E),t==null||t({current:E,action:I,clicked:u})},[t,v,i,T]),m=C.useCallback(f=>{i(u=>j.c.unique([...u,f])),t==null||t({current:c,action:"expand",clicked:f})},[i]),A=C.useCallback(f=>{i(u=>u.filter(S=>S!==f)),t==null||t({current:c,action:"contract",clicked:f})},[i]),_=C.useCallback(()=>i([]),[i]);return{onSelect:P,selected:d,expanded:c,contract:A,expand:m,nodes:k,clearExpanded:_}},G=C.memo(({entry:e,selected:t,onSelect:r,onDrop:n,onRename:s,onSuccessfulDrop:l,onDoubleClick:a,loading:c=!1,useMargin:i=!0,translate:h})=>{const{key:d,hasChildren:T=!1,allowRename:k=!1,children:v,icon:w,name:P,depth:m,expanded:A,href:_,haulItems:f=[]}=e,{getSelected:u}=o.useSelectionUtils(),{getSourceData:S}=o.useDataUtilContext(),y=T||v!=null&&v.length>0,I=[];y&&I.push(R.jsxRuntimeExports.jsx(le.Animated,{enabled:A,enabledLoc:"bottom",disabledLoc:"right"},"caret")),w!=null&&I.push(w);const E=[];c&&E.push(R.jsxRuntimeExports.jsx(o.yt.Loading,{className:p.CSS.B("loading-indicator")},"loading-indicator"));const[b,q]=C.useState(!1),{startDrag:U,...D}=o.useDragAndDrop({type:"Tree.Item",key:d,canDrop:C.useCallback(({items:g,source:O})=>{const x=g.map(L=>L.key);return q(!1),O.type==="Tree.Item"&&!x.includes(d)},[]),onDrop:C.useCallback(g=>(n==null?void 0:n(d,g))??[],[d,n]),onDragOver:C.useCallback(()=>q(!0),[])}),ee=()=>{const g=u(),O=S().filter(x=>g.includes(x.key));if(g.includes(d)){const x=O.map(({key:L,haulItems:B,depth:W})=>[{type:M,key:L,data:{depth:W}},...(B==null?void 0:B.map(X=>({...X,data:{...X.data,depth:W}})))??[]]).flat();return U(x,L=>l==null?void 0:l(d,L))}U([{type:M,key:d,data:{depth:m}},...f.map(x=>({...x,data:{...x.data,depth:m}}))],x=>l==null?void 0:l(d,x))},te=i?"marginLeft":"paddingLeft";let F=m*2+1;y&&i&&(F-=1);const ne={id:d,variant:"text",draggable:f.length>0,className:p.CSS(p.CSS.BE("list","item"),o.CONTEXT_TARGET,b&&p.CSS.M("dragging-over"),t&&o.CONTEXT_SELECTED,p.CSS.selected(t),y&&p.CSS.M("has-children"),p.CSS.BM("depth",m.toString())),onDragLeave:()=>q(!1),onDragStart:ee,onClick:()=>r==null?void 0:r(d),style:{border:"none",position:h!=null?"absolute":"relative",transform:`translateY(${h}px)`,[te]:`${F}rem`,"--pluto-tree-indicator-offset":`${m*1.5+(m===0?0:.5)}rem`},startIcon:I,iconSpacing:"small",noWrap:!0,endIcon:E,onDoubleClick:g=>a==null?void 0:a(d,g),href:_,...D},re=_!=null?se.Link:o.Button;return R.jsxRuntimeExports.jsx(re,{className:p.CSS.BE("list","item"),...ne,children:R.jsxRuntimeExports.jsx(o.MaybeEditable,{id:`text-${d}`,level:"p",allowDoubleClick:!1,value:P,disabled:!k,onChange:g=>s==null?void 0:s(d,g)})})});G.displayName="Tree.Item";const fe=o.componentRenderProp(G),he=({nodes:e,selected:t=[],onSelect:r,onDrop:n,onRename:s,onSuccessfulDrop:l,onDoubleClick:a,className:c,children:i=fe,itemHeight:h=27,useMargin:d=!1,showRules:T=!1,virtual:k=!0,clearExpanded:v,expand:w,contract:P,emptyContent:m,loading:A,..._})=>{const f=k?o.Core.Virtual:o.Core;return R.jsxRuntimeExports.jsx(o.List,{data:e,emptyContent:m,children:R.jsxRuntimeExports.jsx(o.Selector,{value:t,onChange:r,allowMultiple:!0,replaceOnSingle:!0,children:R.jsxRuntimeExports.jsx(f,{itemHeight:h,className:p.CSS(c,p.CSS.B("tree"),T&&p.CSS.M("rules")),..._,children:({key:u,...S})=>i({...S,key:u,loading:A===u,useMargin:d,onDrop:n,onRename:s,onSuccessfulDrop:l,onDoubleClick:a})})})})},pe=(e,t)=>o.edit(`text-${e}`,t),me=e=>o.asyncEdit(`text-${e}`),ge=Object.freeze(Object.defineProperty({__proto__:null,DefaultItem:G,HAUL_TYPE:M,Tree:he,asyncRename:me,deepCopy:Q,defaultSort:z,findNode:N,findNodeParent:$,findNodes:oe,flatten:K,getDescendants:Z,moveNode:ae,removeNode:V,setNode:J,shouldExpand:Y,sortAndSplice:H,startRenaming:pe,updateNode:ie,updateNodeChildren:ce,use:ue},Symbol.toStringTag,{value:"Module"}));exports.external=ge;
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker.spec.d.ts","sourceRoot":"","sources":["../../../../src/aether/aether/worker.spec.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,YAAY;;;;;;EAEvB,CAAC"}
@@ -1,2 +0,0 @@
1
- export * as aetherTest from './test';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/aether/test/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC"}
@@ -1,11 +0,0 @@
1
- import { Mock } from 'vitest';
2
- import { aether } from '../aether';
3
- interface TestLeaf<T extends aether.Component> {
4
- component: T;
5
- setState: (state: any) => Promise<void>;
6
- delete: () => Promise<void>;
7
- stateChange: Mock;
8
- }
9
- export declare const render: <T extends aether.Component>(constructor: aether.ComponentConstructor, initialState: any, setOnContext: (ctx: aether.Context) => void) => Promise<TestLeaf<T>>;
10
- export {};
11
- //# sourceMappingURL=test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../../src/aether/test/test.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,IAAI,EAAK,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,UAAU,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,SAAS;IAC3C,SAAS,EAAE,CAAC,CAAC;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,WAAW,EAAE,IAAI,CAAC;CACnB;AAED,eAAO,MAAM,MAAM,GAAU,CAAC,SAAS,MAAM,CAAC,SAAS,eACxC,MAAM,CAAC,oBAAoB,gBAC1B,GAAG,gBACH,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,KAAK,IAAI,KAC1C,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAyBrB,CAAC"}
@@ -1,2 +0,0 @@
1
- export * as testTelem from './mock';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/telem/test/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC"}
@@ -1,33 +0,0 @@
1
- import { observe } from '@synnaxlabs/x';
2
- import { Mock } from 'vitest';
3
- import { telem } from '../aether';
4
- declare class Base {
5
- cleanupStub: Mock;
6
- cleanup(): Promise<void>;
7
- }
8
- export declare class BooleanSink extends Base implements telem.BooleanSink {
9
- value: boolean | null;
10
- fn: Mock;
11
- set(value: boolean): Promise<void>;
12
- }
13
- export declare const booleanSinkSpec: telem.BooleanSinkSpec;
14
- export declare class BooleanSource extends observe.Observer<void> implements telem.BooleanSource {
15
- private iValue;
16
- cleanupStub: Mock;
17
- constructor(value?: boolean);
18
- setValue(value: boolean): void;
19
- value(): Promise<boolean>;
20
- cleanup(): Promise<void>;
21
- }
22
- export declare const booleanSourceSpec: telem.BooleanSourceSpec;
23
- export declare const FACTORY: telem.Factory;
24
- export declare class Provider implements telem.Provider {
25
- clusterKey: string;
26
- key: string;
27
- equals(): boolean;
28
- created: Record<string, telem.Telem>;
29
- registerFactory(): void;
30
- create<T>(spec: telem.Spec): T;
31
- }
32
- export {};
33
- //# sourceMappingURL=mock.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../../src/telem/test/mock.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,KAAK,IAAI,EAAM,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,cAAM,IAAI;IACR,WAAW,EAAE,IAAI,CAAW;IAEtB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B;AAED,qBAAa,WAAY,SAAQ,IAAK,YAAW,KAAK,CAAC,WAAW;IAChE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAQ;IAC7B,EAAE,EAAE,IAAI,CAAW;IAEb,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAIzC;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,eAKnC,CAAC;AAEF,qBAAa,aACX,SAAQ,OAAO,CAAC,QAAQ,CAAC,IAAI,CAC7B,YAAW,KAAK,CAAC,aAAa;IAE9B,OAAO,CAAC,MAAM,CAAU;IACxB,WAAW,EAAE,IAAI,CAAW;gBAEhB,KAAK,GAAE,OAAe;IAKlC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAKxB,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC;IAIzB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,iBAKrC,CAAC;AAOF,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,OAM3B,CAAC;AAEF,qBAAa,QAAS,YAAW,KAAK,CAAC,QAAQ;IAC7C,UAAU,EAAE,MAAM,CAAU;IAC5B,GAAG,EAAE,MAAM,CAAU;IAErB,MAAM,IAAI,OAAO;IAIjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAM;IAE1C,eAAe,IAAI,IAAI;IAEvB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,GAAG,CAAC;CAK/B"}
@@ -1,20 +0,0 @@
1
- import { box, xy } from '@synnaxlabs/x';
2
- import { CanvasVariant, Context } from './context';
3
- export declare class Eraser {
4
- prevErase: {
5
- one: {
6
- x: number;
7
- y: number;
8
- };
9
- two: {
10
- x: number;
11
- y: number;
12
- };
13
- root: {
14
- x: "right" | "left";
15
- y: "top" | "bottom";
16
- };
17
- };
18
- erase(ctx: Context, next: box.Box, prev: box.Box, overscan: xy.Crude, canvases: CanvasVariant[]): void;
19
- }
20
- //# sourceMappingURL=eraser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eraser.d.ts","sourceRoot":"","sources":["../../../../src/vis/render/eraser.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAExE,qBAAa,MAAM;IACjB,SAAS;;;;;;;;;;;;;MAAY;IAErB,KAAK,CACH,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,GAAG,CAAC,GAAG,EACb,IAAI,EAAE,GAAG,CAAC,GAAG,EACb,QAAQ,EAAE,EAAE,CAAC,KAAK,EAClB,QAAQ,EAAE,aAAa,EAAE,GACxB,IAAI;CAMR"}