@synnaxlabs/pluto 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Center-8mBjm1cO.js +126 -0
- package/dist/{Center-gEKkAkdh.js.map → Center-8mBjm1cO.js.map} +1 -1
- package/dist/Center-ER_owvfX.cjs +2 -0
- package/dist/{Center-ZAcURh-3.cjs.map → Center-ER_owvfX.cjs.map} +1 -1
- package/dist/Header-9CR1VnwV.js +34 -0
- package/dist/{Header-7x6367IV.js.map → Header-9CR1VnwV.js.map} +1 -1
- package/dist/Header-PpcdP7hn.cjs +2 -0
- package/dist/{Header-5YX6FUn6.cjs.map → Header-PpcdP7hn.cjs.map} +1 -1
- package/dist/Item--h4UWJZo.js +80 -0
- package/dist/{Item-owLU4Xop.js.map → Item--h4UWJZo.js.map} +1 -1
- package/dist/Item-EBiM5yGJ.cjs +2 -0
- package/dist/{Item-HWzX7RK2.cjs.map → Item-EBiM5yGJ.cjs.map} +1 -1
- package/dist/Item-_og4CdwZ.cjs +2 -0
- package/dist/{Item-rkSKzZoh.cjs.map → Item-_og4CdwZ.cjs.map} +1 -1
- package/dist/Item-kbCoFEj2.js +137 -0
- package/dist/{Item-EDdYN2NK.js.map → Item-kbCoFEj2.js.map} +1 -1
- package/dist/Keyboard-IWRXgioJ.js +14 -0
- package/dist/{Keyboard-mE03PKwA.js.map → Keyboard-IWRXgioJ.js.map} +1 -1
- package/dist/Keyboard-bXNOi0bP.cjs +2 -0
- package/dist/{Keyboard-w372197S.cjs.map → Keyboard-bXNOi0bP.cjs.map} +1 -1
- package/dist/Link-16dbGK7G.cjs +2 -0
- package/dist/{Link-xlTZan29.cjs.map → Link-16dbGK7G.cjs.map} +1 -1
- package/dist/Link-fRQvqiYx.js +11 -0
- package/dist/{Link-laNlv47N.js.map → Link-fRQvqiYx.js.map} +1 -1
- package/dist/SelectLevel-DrdlLBOs.cjs +2 -0
- package/dist/{SelectLevel-bGb0dRXh.cjs.map → SelectLevel-DrdlLBOs.cjs.map} +1 -1
- package/dist/SelectLevel-Uod3Ez6y.js +121 -0
- package/dist/{SelectLevel-cewIWtOv.js.map → SelectLevel-Uod3Ez6y.js.map} +1 -1
- package/dist/Selector-8rTHUToj.cjs +2 -0
- package/dist/{Selector-hQLSIYum.cjs.map → Selector-8rTHUToj.cjs.map} +1 -1
- package/dist/Selector-R4SumEUV.js +233 -0
- package/dist/{Selector-R3lL41_i.js.map → Selector-R4SumEUV.js.map} +1 -1
- package/dist/Swatch--Prmb5q_.cjs +2 -0
- package/dist/Swatch--Prmb5q_.cjs.map +1 -0
- package/dist/Swatch-IH4OmVdd.js +82 -0
- package/dist/Swatch-IH4OmVdd.js.map +1 -0
- package/dist/TimeRangeChip-jI9Nn9z8.js +7384 -0
- package/dist/TimeRangeChip-jI9Nn9z8.js.map +1 -0
- package/dist/TimeRangeChip-jQH9NacG.cjs +50 -0
- package/dist/TimeRangeChip-jQH9NacG.cjs.map +1 -0
- package/dist/Toggle-HVxv8bv2.js +10648 -0
- package/dist/Toggle-HVxv8bv2.js.map +1 -0
- package/dist/Toggle-QnKinMl4.cjs +73 -0
- package/dist/Toggle-QnKinMl4.cjs.map +1 -0
- package/dist/Video-iiPAk_ej.cjs +2 -0
- package/dist/{Video-a7BUKvzF.cjs.map → Video-iiPAk_ej.cjs.map} +1 -1
- package/dist/Video-vyIORMaH.js +11 -0
- package/dist/{Video-Vpwp5ao1.js.map → Video-vyIORMaH.js.map} +1 -1
- package/dist/aether.cjs +1 -89
- package/dist/aether.cjs.map +1 -1
- package/dist/aether.js +76 -80
- package/dist/aether.js.map +1 -1
- package/dist/align.cjs +1 -9
- package/dist/align.cjs.map +1 -1
- package/dist/align.js +5 -5
- package/dist/button.cjs +1 -14
- package/dist/button.cjs.map +1 -1
- package/dist/button.js +9 -8
- package/dist/button.js.map +1 -1
- package/dist/color-9QRifwqk.js +9 -0
- package/dist/color-9QRifwqk.js.map +1 -0
- package/dist/color-gJTR__ef.cjs +2 -0
- package/dist/color-gJTR__ef.cjs.map +1 -0
- package/dist/color.cjs +2 -0
- package/dist/color.cjs.map +1 -0
- package/dist/color.js +16 -0
- package/dist/color.js.map +1 -0
- package/dist/component-LA8IXGSG.js +17961 -0
- package/dist/component-LA8IXGSG.js.map +1 -0
- package/dist/component-dgLAEMbt.cjs +23 -0
- package/dist/component-dgLAEMbt.cjs.map +1 -0
- package/dist/css-5RvvUhjr.js +6414 -0
- package/dist/{css-NTD4Xm8x.js.map → css-5RvvUhjr.js.map} +1 -1
- package/dist/css-s9KpanYu.cjs +8 -0
- package/dist/{css-V3VUT_Js.cjs.map → css-s9KpanYu.cjs.map} +1 -1
- package/dist/css.cjs +2 -0
- package/dist/css.cjs.map +1 -0
- package/dist/css.js +10 -0
- package/dist/css.js.map +1 -0
- package/dist/dimensions--C45ahLe.js +20 -0
- package/dist/{dimensions-guJ5PHmb.js.map → dimensions--C45ahLe.js.map} +1 -1
- package/dist/dimensions-HfZjDJQz.cjs +2 -0
- package/dist/{dimensions-Sej0Zly9.cjs.map → dimensions-HfZjDJQz.cjs.map} +1 -1
- package/dist/dropdown.cjs +1 -12
- package/dist/dropdown.cjs.map +1 -1
- package/dist/dropdown.js +7 -6
- package/dist/dropdown.js.map +1 -1
- package/dist/external--jsfNkbo.cjs +2 -0
- package/dist/external--jsfNkbo.cjs.map +1 -0
- package/dist/external-1DGLK9F2.js +17 -0
- package/dist/external-1DGLK9F2.js.map +1 -0
- package/dist/external-4h9H4Y_N.js +21 -0
- package/dist/external-4h9H4Y_N.js.map +1 -0
- package/dist/external-4uqucf0m.js +67 -0
- package/dist/{external-QuVTCnGl.js.map → external-4uqucf0m.js.map} +1 -1
- package/dist/external-A_eQgT5T.cjs +2 -0
- package/dist/external-A_eQgT5T.cjs.map +1 -0
- package/dist/external-FCO_hdNr.js +24 -0
- package/dist/external-FCO_hdNr.js.map +1 -0
- package/dist/external-HZ6f2KvU.cjs +2 -0
- package/dist/external-HZ6f2KvU.cjs.map +1 -0
- package/dist/external-LPdjowBG.cjs +2 -0
- package/dist/external-LPdjowBG.cjs.map +1 -0
- package/dist/external-O1b3FJKI.cjs +2 -0
- package/dist/external-O1b3FJKI.cjs.map +1 -0
- package/dist/external-RGdrJX7y.cjs +2 -0
- package/dist/{external-9Ncn2J9B.cjs.map → external-RGdrJX7y.cjs.map} +1 -1
- package/dist/external-WiHGqQPA.js +30 -0
- package/dist/external-WiHGqQPA.js.map +1 -0
- package/dist/external-eWu6hCLU.cjs +2 -0
- package/dist/external-eWu6hCLU.cjs.map +1 -0
- package/dist/external-kvAz85mu.js +18 -0
- package/dist/external-kvAz85mu.js.map +1 -0
- package/dist/external-mpVdVPF1.js +88 -0
- package/dist/external-mpVdVPF1.js.map +1 -0
- package/dist/external-nTDD8IMd.cjs +2 -0
- package/dist/external-nTDD8IMd.cjs.map +1 -0
- package/dist/external-phknItOL.js +15 -0
- package/dist/external-phknItOL.js.map +1 -0
- package/dist/external-rGcWjp84.cjs +2 -0
- package/dist/{external-zBiIxeDG.cjs.map → external-rGcWjp84.cjs.map} +1 -1
- package/dist/external-r_2-tYfC.js +88 -0
- package/dist/{external-up1sE3F6.js.map → external-r_2-tYfC.js.map} +1 -1
- package/dist/external-sHbzLUrP.js +17 -0
- package/dist/external-sHbzLUrP.js.map +1 -0
- package/dist/external-tZiYBM94.cjs +2 -0
- package/dist/external-tZiYBM94.cjs.map +1 -0
- package/dist/external-tnCo64yx.cjs +2 -0
- package/dist/external-tnCo64yx.cjs.map +1 -0
- package/dist/external-uR-7_68y.js +16 -0
- package/dist/external-uR-7_68y.js.map +1 -0
- package/dist/external-uSIsCKNG.js +15 -0
- package/dist/external-uSIsCKNG.js.map +1 -0
- package/dist/external-z6BLlxur.cjs +2 -0
- package/dist/external-z6BLlxur.cjs.map +1 -0
- package/dist/font-HpLrwPSD.js +16 -0
- package/dist/{font-t7KoGNFX.js.map → font-HpLrwPSD.js.map} +1 -1
- package/dist/font-yosRgv9n.cjs +2 -0
- package/dist/{font-wlgaMRYN.cjs.map → font-yosRgv9n.cjs.map} +1 -1
- package/dist/fontString-_dtZSiPk.cjs +2 -0
- package/dist/{fontString-i24UxKCQ.cjs.map → fontString-_dtZSiPk.cjs.map} +1 -1
- package/dist/fontString-lodjYTYz.js +12 -0
- package/dist/{fontString-RKvYIr5H.js.map → fontString-lodjYTYz.js.map} +1 -1
- package/dist/header.cjs +1 -14
- package/dist/header.cjs.map +1 -1
- package/dist/header.js +9 -8
- package/dist/header.js.map +1 -1
- package/dist/index.cjs +1 -1174
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +737 -930
- package/dist/index.js.map +1 -1
- package/dist/input/Input.stories.d.ts +1 -0
- package/dist/input/TextArea.d.ts +20 -0
- package/dist/input/external.d.ts +1 -0
- package/dist/input/types.d.ts +4 -2
- package/dist/input.cjs +1 -14
- package/dist/input.cjs.map +1 -1
- package/dist/input.js +9 -8
- package/dist/input.js.map +1 -1
- package/dist/jsx-runtime-NmMXPjeo.js +632 -0
- package/dist/{jsx-runtime-rX5tAIG2.js.map → jsx-runtime-NmMXPjeo.js.map} +1 -1
- package/dist/jsx-runtime-evvPGacs.cjs +28 -0
- package/dist/{jsx-runtime-N1ikfypN.cjs.map → jsx-runtime-evvPGacs.cjs.map} +1 -1
- package/dist/list.cjs +1 -26
- package/dist/list.cjs.map +1 -1
- package/dist/list.js +21 -19
- package/dist/list.js.map +1 -1
- package/dist/menu.cjs +1 -15
- package/dist/menu.cjs.map +1 -1
- package/dist/menu.js +10 -9
- package/dist/menu.js.map +1 -1
- package/dist/style.css +1 -3119
- package/dist/table-MJysJcCC.js +10312 -0
- package/dist/table-MJysJcCC.js.map +1 -0
- package/dist/table-NIrLpFOm.cjs +69 -0
- package/dist/table-NIrLpFOm.cjs.map +1 -0
- package/dist/tabs.cjs +1 -14
- package/dist/tabs.cjs.map +1 -1
- package/dist/tabs.js +9 -8
- package/dist/tabs.js.map +1 -1
- package/dist/text.cjs +1 -16
- package/dist/text.cjs.map +1 -1
- package/dist/text.js +11 -10
- package/dist/text.js.map +1 -1
- package/dist/theming.cjs +1 -15
- package/dist/theming.cjs.map +1 -1
- package/dist/theming.js +10 -9
- package/dist/theming.js.map +1 -1
- package/dist/tree.cjs +1 -25
- package/dist/tree.cjs.map +1 -1
- package/dist/tree.js +20 -18
- package/dist/tree.js.map +1 -1
- package/dist/triggers.cjs +1 -15
- package/dist/triggers.cjs.map +1 -1
- package/dist/triggers.js +10 -9
- package/dist/triggers.js.map +1 -1
- package/dist/useDrag-4o21IpGy.js +36 -0
- package/dist/{useDrag-rQt5hv4R.js.map → useDrag-4o21IpGy.js.map} +1 -1
- package/dist/useDrag-l_moa7e3.cjs +2 -0
- package/dist/{useDrag-KRQ7DTg1.cjs.map → useDrag-l_moa7e3.cjs.map} +1 -1
- package/dist/video.cjs +1 -9
- package/dist/video.cjs.map +1 -1
- package/dist/video.js +3 -3
- package/package.json +61 -51
- package/dist/Center-ZAcURh-3.cjs +0 -148
- package/dist/Center-gEKkAkdh.js +0 -149
- package/dist/Header-5YX6FUn6.cjs +0 -35
- package/dist/Header-7x6367IV.js +0 -36
- package/dist/Item-EDdYN2NK.js +0 -171
- package/dist/Item-HWzX7RK2.cjs +0 -170
- package/dist/Item-owLU4Xop.js +0 -97
- package/dist/Item-rkSKzZoh.cjs +0 -96
- package/dist/Keyboard-mE03PKwA.js +0 -14
- package/dist/Keyboard-w372197S.cjs +0 -13
- package/dist/Link-laNlv47N.js +0 -13
- package/dist/Link-xlTZan29.cjs +0 -12
- package/dist/SelectLevel-bGb0dRXh.cjs +0 -152
- package/dist/SelectLevel-cewIWtOv.js +0 -153
- package/dist/Selector-R3lL41_i.js +0 -267
- package/dist/Selector-hQLSIYum.cjs +0 -266
- package/dist/TimeRangeChip-XXXLMCrf.cjs +0 -9316
- package/dist/TimeRangeChip-XXXLMCrf.cjs.map +0 -1
- package/dist/TimeRangeChip-eDCX5pUC.js +0 -9301
- package/dist/TimeRangeChip-eDCX5pUC.js.map +0 -1
- package/dist/Toggle-eOKYw1OT.cjs +0 -13664
- package/dist/Toggle-eOKYw1OT.cjs.map +0 -1
- package/dist/Toggle-kLunfJtR.js +0 -13665
- package/dist/Toggle-kLunfJtR.js.map +0 -1
- package/dist/Video-Vpwp5ao1.js +0 -12
- package/dist/Video-a7BUKvzF.cjs +0 -11
- package/dist/component-joFaJiQW.cjs +0 -24719
- package/dist/component-joFaJiQW.cjs.map +0 -1
- package/dist/component-k78Jq9I7.js +0 -24720
- package/dist/component-k78Jq9I7.js.map +0 -1
- package/dist/css-NTD4Xm8x.js +0 -9206
- package/dist/css-V3VUT_Js.cjs +0 -9204
- package/dist/dimensions-Sej0Zly9.cjs +0 -26
- package/dist/dimensions-guJ5PHmb.js +0 -27
- package/dist/external-2Aicsb3l.js +0 -88
- package/dist/external-2Aicsb3l.js.map +0 -1
- package/dist/external-9Ncn2J9B.cjs +0 -93
- package/dist/external-9RCzxzgZ.js +0 -30
- package/dist/external-9RCzxzgZ.js.map +0 -1
- package/dist/external-9pS8-DvV.js +0 -15
- package/dist/external-9pS8-DvV.js.map +0 -1
- package/dist/external-KxlyA74C.js +0 -20
- package/dist/external-KxlyA74C.js.map +0 -1
- package/dist/external-OSLzuRs1.cjs +0 -14
- package/dist/external-OSLzuRs1.cjs.map +0 -1
- package/dist/external-PS3nzqUn.cjs +0 -23
- package/dist/external-PS3nzqUn.cjs.map +0 -1
- package/dist/external-QRmqSjV0.js +0 -18
- package/dist/external-QRmqSjV0.js.map +0 -1
- package/dist/external-QuVTCnGl.js +0 -71
- package/dist/external-U5HRPaDI.cjs +0 -17
- package/dist/external-U5HRPaDI.cjs.map +0 -1
- package/dist/external-_CtRDtih.js +0 -17
- package/dist/external-_CtRDtih.js.map +0 -1
- package/dist/external-eQU48hM4.cjs +0 -87
- package/dist/external-eQU48hM4.cjs.map +0 -1
- package/dist/external-kbDFnfuk.js +0 -24
- package/dist/external-kbDFnfuk.js.map +0 -1
- package/dist/external-oX1JmOFf.js +0 -17
- package/dist/external-oX1JmOFf.js.map +0 -1
- package/dist/external-oZe6tF4A.cjs +0 -14
- package/dist/external-oZe6tF4A.cjs.map +0 -1
- package/dist/external-tVcmKSsT.cjs +0 -19
- package/dist/external-tVcmKSsT.cjs.map +0 -1
- package/dist/external-up1sE3F6.js +0 -94
- package/dist/external-uvx0b-Jw.cjs +0 -16
- package/dist/external-uvx0b-Jw.cjs.map +0 -1
- package/dist/external-vXBQOmKv.js +0 -15
- package/dist/external-vXBQOmKv.js.map +0 -1
- package/dist/external-yiqRIIvW.cjs +0 -16
- package/dist/external-yiqRIIvW.cjs.map +0 -1
- package/dist/external-zBiIxeDG.cjs +0 -70
- package/dist/external-zw9fckWT.cjs +0 -29
- package/dist/external-zw9fckWT.cjs.map +0 -1
- package/dist/font-t7KoGNFX.js +0 -17
- package/dist/font-wlgaMRYN.cjs +0 -16
- package/dist/fontString-RKvYIr5H.js +0 -13
- package/dist/fontString-i24UxKCQ.cjs +0 -12
- package/dist/jsx-runtime-N1ikfypN.cjs +0 -931
- package/dist/jsx-runtime-rX5tAIG2.js +0 -932
- package/dist/table-8MFXzE4C.js +0 -13664
- package/dist/table-8MFXzE4C.js.map +0 -1
- package/dist/table-VNkSG_Cj.cjs +0 -13661
- package/dist/table-VNkSG_Cj.cjs.map +0 -1
- package/dist/useDrag-KRQ7DTg1.cjs +0 -48
- package/dist/useDrag-rQt5hv4R.js +0 -49
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";var eh=Object.defineProperty;var nh=(t,e,n)=>e in t?eh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var y=(t,e,n)=>(nh(t,typeof e!="symbol"?e+"":e,n),n);const f=require("./css-s9KpanYu.cjs"),P=require("zod"),Z=require("./component-dgLAEMbt.cjs"),m=require("react");require("react-dom");const xn=require("./fontString-_dtZSiPk.cjs"),mr=require("./dimensions-HfZjDJQz.cjs"),gn=Object.freeze(Object.defineProperty({__proto__:null,Instrumentation:Z.C,LOG_LEVELS:Z.j,Logger:Z.x,NOOP:Z.Re,NoopSpan:Z.Ae,Tracer:Z.R,_Span:Z.Ee,logLevelKeyFiler:Z.Pe,logThresholdFilter:Z.xe},Symbol.toStringTag,{value:"Module"})),rh=P.z.union([P.z.instanceof(ArrayBuffer)]),Hn=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(rh).optional()}),Jt=Hn.extend({variant:P.z.literal("source")}),as=Hn.extend({variant:P.z.literal("sink")}),Da=Hn.extend({variant:P.z.literal("source-transformer")}),$a=Hn.extend({variant:P.z.literal("sink-transformer")}),Ks=Jt.extend({valueType:P.z.literal("series")}),Oa=Jt.extend({valueType:P.z.literal("boolean")}),cs=as.extend({valueType:P.z.literal("boolean")}),sh=$a.extend({valueType:P.z.literal("boolean")}),oh=Da.extend({valueType:P.z.literal("boolean")}),ih=Jt.extend({valueType:P.z.literal("number")}),ah=as.extend({valueType:P.z.literal("number")}),za=Jt.extend({valueType:P.z.literal("color")}),vo=Jt.extend({valueType:P.z.literal("status")}),bo=Jt.extend({valueType:P.z.literal("string")});class ls extends f.observe.Observer{constructor(n){super();y(this,"props_");y(this,"uProps_");y(this,"schema");this.uProps_=n}get props(){if(this.props_==null){const n=this._schema.safeParse(this.uProps_);if(n.success)this.props_=n.data;else throw new Z.ValidationError(`[BaseTelem] - expected props to be valid, but found the following errors:
|
|
2
|
+
${n.error.message}`)}return this.props_}get _schema(){if(this.schema==null)throw new Z.ValidationError(`[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}cleanup(){}}class Tt extends ls{}class us extends ls{}class hs extends Tt{constructor(){super(...arguments);y(this,"sources",{})}get source(){const[n]=Object.values(this.sources);if(n==null)throw new Z.ValidationError("[UnarySourceTransformer] - expected source to exist, but none was found.");return n}async value(){return this.transform(await this.source.value())}onChange(n){return this.source.onChange(()=>{this.source.value().then(r=>{this.shouldNotify(r)&&n()}).catch(console.error)})}setSources(n){this.sources=n}shouldNotify(n){return!0}transform(n){throw new Z.ValidationError(`[UnarySourceTransformer] - expected subclass to define transform method, but none was found.
|
|
4
|
+
Make sure to define a method 'transform' on the class.`)}}class Ya extends Tt{constructor(){super(...arguments);y(this,"sources",{})}async value(){const n=Object.fromEntries(await Promise.all(Object.entries(this.sources).map(async([r,s])=>[r,await s.value()])));return this.transform(n)}setSources(n){this.sources={...this.sources,...n}}transform(n){throw new Z.ValidationError(`[MultiSourceTransformer] - expected subclass to define transform method, but none was found.
|
|
5
|
+
Make sure to define a method 'transform' on the class.`)}}class La extends ls{constructor(){super(...arguments);y(this,"sinks",{})}get sink(){const[n]=Object.values(this.sinks);if(n==null)throw new Z.ValidationError("[UnarySinkTransformer] - expected sink to exist, but none was found.");return n}async set(n){return await this.sink.set(this.transform(n))}setSinks(n){this.sinks={...this.sinks,...n}}transform(n){throw new Z.ValidationError(`[UnarySinkTransformer] - expected subclass to define transform method, but none was found.
|
|
6
|
+
Make sure to define a method 'transform' on the class.`)}}const Ia="pluto-telem-context",Vn=t=>t.get(Ia),Ba=(t,e)=>t.set(Ia,e),Fa=(t,e)=>Vn(t).registerFactory(e),ch=(t,e,n,r)=>{const s=Vn(t);return e.key!==s.key?!0:!(e.equals(s)||f.external.equal(n,r))};class hi{constructor(e,n,r){y(this,"spec");y(this,"prov");y(this,"wrapped");this.wrapped=e,this.spec=r,this.prov=n}async value(){return await this.wrapped.value()}cleanup(){var e,n;(n=(e=this.wrapped).cleanup)==null||n.call(e)}onChange(e){return this.wrapped.onChange(e)}shouldUpdate(e,n){return!this.prov.equals(e)||!f.external.equal(this.spec,n)}}class fi{constructor(e,n,r){y(this,"spec");y(this,"prov");y(this,"wrapped");this.wrapped=e,this.spec=r,this.prov=n}async set(e){return await this.wrapped.set(e)}cleanup(){var e,n;(n=(e=this.wrapped).cleanup)==null||n.call(e)}shouldUpdate(e,n){return!this.prov.equals(e)||!f.external.equal(this.spec,n)}}const Ut=(t,e,n)=>{var s;const r=Vn(t);if(n instanceof hi){if(!n.shouldUpdate(r,e))return n;(s=n.cleanup)==null||s.call(n)}return new hi(r.create(e),r,e)},fs=(t,e,n)=>{var s;const r=Vn(t);if(n instanceof fi){if(!n.shouldUpdate(r,e))return n;(s=n.cleanup)==null||s.call(n)}return new fi(r.create(e),r,e)};class xe extends f.observe.Observer{cleanup(){}}class yr extends xe{async set(){return await Promise.resolve()}}y(yr,"TYPE","noop-boolean-sink");const ds={type:yr.TYPE,props:{},variant:"sink",valueType:"boolean"};class xr extends xe{async set(){return await Promise.resolve()}}y(xr,"TYPE","noop-numeric-sink");const lh={type:xr.TYPE,props:{},variant:"sink",valueType:"number"};class wr extends xe{async value(){return await Promise.resolve(!1)}}y(wr,"TYPE","noop-boolean-source");const Ua={type:wr.TYPE,props:{},variant:"source",valueType:"boolean"};class Sr extends xe{async value(){return 0}}y(Sr,"TYPE","noop-numeric-source");const uh={type:Sr.TYPE,props:{},variant:"source",valueType:"number"};class vr extends xe{async value(){return""}}y(vr,"TYPE","noop-string-source");const Eo={type:vr.TYPE,props:{},variant:"source",valueType:"string"};class br extends xe{async value(){return{key:"noop",variant:"disabled",message:"unknown",time:f.TimeStamp.now()}}}y(br,"TYPE","noop-status-source");const To={type:br.TYPE,props:{},variant:"source",valueType:"status"};class Er extends xe{async value(){return f.ZERO}}y(Er,"TYPE","noop-color-source");const Za={type:Er.TYPE,props:{},variant:"source",valueType:"color"},hh={[yr.TYPE]:yr,[xr.TYPE]:xr,[wr.TYPE]:wr,[Sr.TYPE]:Sr,[br.TYPE]:br,[Er.TYPE]:Er,[vr.TYPE]:vr};class Ha{constructor(){y(this,"type","noop")}create(e){const n=hh[e.type];return n==null?null:new n}}const Va=P.z.object({from:P.z.string(),to:P.z.string()}),qa=P.z.object({connections:P.z.array(Va),outlet:P.z.string(),segments:P.z.record(Jt)});class Xa{constructor(e){y(this,"type","pipeline");y(this,"factory");this.factory=e}create(e){switch(e.type){case Cn.TYPE:return new Cn(e.props,this.factory);case Pn.TYPE:return new Pn(e.props,this.factory);default:return null}}}class Cn extends Tt{constructor(n,r){super(n);y(this,"schema",qa);y(this,"sources",{});const{connections:s,segments:o}=this.props;Object.entries(o).forEach(([i,a])=>{const l=r.create(a);l!=null&&(this.sources[i]=l)}),s.forEach(({from:i,to:a})=>{const l=this.sources[i],c=this.sources[a];l==null||c==null||"setSources"in c&&c.setSources({[i]:l})})}get outlet(){const{outlet:n}=this.props,r=this.sources[n];if(r==null)throw new Z.ValidationError(`[SourcePipeline] - expected source to exist at outlet '${n}', but none was found.`);return r}async value(){return await this.outlet.value()}onChange(n){return this.outlet.onChange(n)}cleanup(){Object.values(this.sources).forEach(n=>{var r;return(r=n.cleanup)==null?void 0:r.call(n)})}}y(Cn,"TYPE","source-pipeline");const fh=(t,e)=>({variant:"source",props:e,type:Cn.TYPE,valueType:t}),Wa=P.z.object({connections:P.z.array(Va),inlet:P.z.string(),segments:P.z.record(as)});class Pn extends us{constructor(n,r){super(n);y(this,"schema",Wa);y(this,"sinks",{});const{connections:s,segments:o}=this.props;Object.entries(o).forEach(([i,a])=>{const l=r.create(a);l!=null&&(this.sinks[i]=l)}),s.forEach(({from:i,to:a})=>{const l=this.sinks[i],c=this.sinks[a];l==null||c==null||"setSinks"in l&&l.setSinks({[a]:c})})}get inlet(){const{inlet:n}=this.props,r=this.sinks[n];if(r==null)throw new Z.ValidationError(`[SinkPipeline] - expected source to exist at inlet '${n}', but none was found.`);return r}async set(n){return await this.inlet.set(n)}cleanup(){Object.values(this.sinks).forEach(n=>{var r;return(r=n.cleanup)==null?void 0:r.call(n)})}}y(Pn,"TYPE","sink-pipeline");const dh=(t,e)=>({variant:"sink",props:e,type:Pn.TYPE,valueType:t}),Ga=P.z.object({channel:P.z.number()});class Mn extends Tt{constructor(n,r){super(r);y(this,"removeStreamHandler",null);y(this,"schema",Ga);y(this,"valid",!1);y(this,"leadingBuffer",null);y(this,"client");this.client=n}cleanup(){var n;(n=this.removeStreamHandler)==null||n.call(this),this.valid=!1,this.leadingBuffer=null,this.removeStreamHandler=null}async value(){if(this.props.channel===0||(this.valid||await this.read(),this.leadingBuffer==null||this.leadingBuffer.length===0))return 0;const n=this.leadingBuffer.data[this.leadingBuffer.length-1];return Number(f.addSamples(n,this.leadingBuffer.sampleOffset))}async read(){this.valid=!0;const{channel:n}=this.props,r=f.TimeStamp.now().sub(f.TimeStamp.seconds(10)).spanRange(f.TimeSpan.seconds(20)),s=await this.client.read(r,[n]);this.leadingBuffer=s[n].data[0],await this.updateStreamHandler()}async updateStreamHandler(){var s;(s=this.removeStreamHandler)==null||s.call(this);const{channel:n}=this.props,r=o=>{var a;const i=o[n];i.data.length>0&&(this.leadingBuffer=i.data[i.data.length-1]),(a=this.notify)==null||a.call(this)};this.removeStreamHandler=await this.client.stream(r,[n])}}y(Mn,"TYPE","range-point");const Ka=async(t,e,n)=>{if(!n)return await t.retrieveChannel(e);const r=await t.retrieveChannel(e);return await t.retrieveChannel(r.index)},ph=P.z.object({timeRange:f.TimeRange.z,channel:P.z.number(),index:P.z.boolean().optional().default(!1)});class Rn extends Tt{constructor(n,r){super(r);y(this,"client");y(this,"data",[]);y(this,"schema",ph);y(this,"valid",!1);this.client=n}cleanup(){this.valid=!1}async value(){const n=await Ka(this.client,this.props.channel,this.props.index);this.valid||await this.readFixed(n.key);let r=f.bounds.max(this.data.map(s=>s.bounds));return n.dataType.equals(f.DataType.TIMESTAMP)&&(r={upper:Math.min(r.upper,this.props.timeRange.end.valueOf()),lower:Math.max(r.lower,this.props.timeRange.start.valueOf())}),[r,this.data]}async readFixed(n){const r=await this.client.read(this.props.timeRange,[n]);this.data=r[n].data,this.valid=!0}}y(Rn,"TYPE","series-source");const gh=P.z.object({channel:P.z.number(),index:P.z.boolean().optional().default(!1),timeSpan:f.TimeSpan.z});class kn extends Tt{constructor(n,r){super(r);y(this,"client");y(this,"data",[]);y(this,"stopStreaming");y(this,"valid",!1);y(this,"schema",gh);this.client=n}async value(){const{channel:n,index:r,timeSpan:s}=this.props,o=await Ka(this.client,n,r);this.valid||await this.read(o.key);let i=f.bounds.max(this.data.map(a=>a.bounds));return o.dataType.equals(f.DataType.TIMESTAMP)&&(i={upper:i.upper,lower:Math.max(i.lower,i.upper-s.valueOf())}),[i,this.data]}invalidate(){this.valid=!1,this.notify()}async read(n){const r=f.TimeStamp.now().spanRange(-this.props.timeSpan),s=await this.client.read(r,[n]);this.data.push(...s[n].data),await this.updateStreamHandler(n),this.valid=!0}async updateStreamHandler(n){var s;(s=this.stopStreaming)==null||s.call(this);const r=o=>{const i=o[n];this.data.push(...i.data),this.notify()};this.stopStreaming=await this.client.stream(r,[n])}cleanup(){var n;(n=this.stopStreaming)==null||n.call(this),this.stopStreaming=void 0}}y(kn,"TYPE","dynamic-series-source");const di={[Rn.TYPE]:Rn,[kn.TYPE]:kn,[Mn.TYPE]:Mn};class ja{constructor(e){y(this,"type","remote");y(this,"client");this.client=e}create(e){return e.type in di?new di[e.type](this.client,e.props):null}}const mh=t=>({type:Rn.TYPE,props:t,variant:"source",valueType:"series"}),yh=t=>({type:kn.TYPE,props:t,variant:"source",valueType:"series"}),xh=t=>({type:Mn.TYPE,props:t,variant:"source",valueType:"number"});class Qa{constructor(){y(this,"type","static")}create(e){switch(e.type){case Tr.TYPE:return new Tr(e.props);case Nn.TYPE:return new Nn(e.props);case An.TYPE:return new An(e.props);case Dn.TYPE:return new Dn(e.props);default:return null}}}const Ja=P.z.object({data:P.z.array(f.nativeTypedArray),offsets:P.z.array(P.z.number()).optional().default([])});class Tr extends Tt{constructor(n){super(n);y(this,"data");this.data=this.props.data.map((r,s)=>new f.Series(r,f.DataType.FLOAT32,f.TimeRange.ZERO,this.props.offsets[s]??0))}async value(){return[f.bounds.max(this.data.map(r=>r.bounds)),this.data]}}y(Tr,"TYPE","static-series");const tc=Ja.extend({rate:f.Rate.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 Nn extends Tt{constructor(n){super(n);y(this,"schema",tc);y(this,"position");y(this,"interval");y(this,"data");this.position=this.props.startPosition,this.start(this.props.rate),this.data=this.props.data.map((r,s)=>new f.Series(r,f.DataType.FLOAT32,f.TimeRange.ZERO,this.props.offsets[s]??0))}async value(){const n=this.data.map(s=>s.slice(0,this.position));if(this.props.scrollBounds){const s=n[0].data[this.position-this.props.scroll<0?0:this.position-this.props.scroll],o=n[0].data[this.position-1];return[{lower:Number(s),upper:Number(o)},n]}return[f.bounds.max(n.map(s=>s.bounds)),n]}start(n){this.interval!=null&&clearInterval(this.interval),this.interval=setInterval(()=>{var r;(r=this.notify)==null||r.call(this),this.position++},n.period.milliseconds)}cleanup(){clearInterval(this.interval),this.interval=void 0}}y(Nn,"TYPE","iterative-series");const ec=P.z.number();class An extends Tt{constructor(){super(...arguments);y(this,"schema",ec)}async value(){return this.props}}y(An,"TYPE","static-numeric");const nc=P.z.string();class Dn extends Tt{constructor(){super(...arguments);y(this,"schema",nc)}async value(){return this.props}}y(Dn,"TYPE","static-string");const wh=t=>({type:Tr.TYPE,props:t,variant:"source",valueType:"series"}),Sh=t=>({type:Nn.TYPE,props:t,variant:"source",valueType:"series"}),vh=t=>({type:An.TYPE,props:t,variant:"source",valueType:"number"}),bh=t=>({type:Dn.TYPE,props:t,variant:"source",valueType:"string"});class rc{constructor(){y(this,"type","transformer")}create(e){switch(e.type){case Le.TYPE:return new Le(e.props);case Ie.TYPE:return new Ie(e.props);case Be.TYPE:return new Be(e.props);case Fe.TYPE:return new Fe(e.props);case Ue.TYPE:return new Ue(e.props)}return null}}const Eh=P.z.object({truthy:P.z.number().optional().default(1),falsy:P.z.number().optional().default(0)}),Th=t=>({props:t,type:Le.TYPE,variant:"sink",valueType:"boolean"}),wn=class wn extends La{constructor(){super(...arguments);y(this,"schema",wn.propsZ)}transform(n){return n?this.props.truthy:this.props.falsy}};y(wn,"TYPE","boolean-numeric-converter-sink"),y(wn,"propsZ",Eh);let Le=wn;const _h=P.z.object({trueBound:f.bounds.bounds}),Ch=t=>({props:t,type:Ie.TYPE,variant:"source",valueType:"boolean"}),Sn=class Sn extends hs{constructor(){super(...arguments);y(this,"schema",Sn.propsZ);y(this,"curr",null)}shouldNotify(n){return f.bounds.contains(this.props.trueBound,n)!==this.curr}transform(n){return this.curr=f.bounds.contains(this.props.trueBound,n),this.curr}};y(Sn,"TYPE","boolean-source"),y(Sn,"propsZ",_h);let Ie=Sn;const Ph=P.z.object({}),vn=class vn extends Ya{constructor(){super(...arguments);y(this,"schema",vn.propsZ)}transform(n){return Object.values(n).reduce((r,s)=>r+s,0)/Object.keys(n).length}};y(vn,"TYPE","mean"),y(vn,"propsZ",Ph);let Be=vn;const Mh=t=>({props:t,type:Be.TYPE,variant:"source",valueType:"boolean"}),sc=P.z.object({trueVariant:Z.variantZ.optional().default("success")}),bn=class bn extends hs{constructor(){super(...arguments);y(this,"schema",bn.propsZ)}transform(n){return n.variant===this.props.trueVariant}};y(bn,"TYPE","boolean-status"),y(bn,"propsZ",sc);let Fe=bn;const Rh=t=>({props:t,type:Fe.TYPE,variant:"source",valueType:"boolean"}),oc=P.z.object({precision:P.z.number().optional().default(2),prefix:P.z.string().optional().default(""),suffix:P.z.string().optional().default("")}),En=class En extends hs{constructor(){super(...arguments);y(this,"schema",En.propsZ)}transform(n){return`${this.props.prefix}${n.toFixed(this.props.precision)}${this.props.suffix}`}};y(En,"TYPE","stringify-number"),y(En,"propsZ",oc);let Ue=En;const kh=t=>({props:t,type:Ue.TYPE,variant:"source",valueType:"string"});class ic{constructor(e){y(this,"factories");y(this,"type","compound");this.factories=e}add(e){this.factories=[...this.factories.filter(n=>n.type!==e.type),e]}create(e){for(const n of this.factories){const r=n.create(e);if(r!=null)return r}return null}}const ac=t=>{const e=[new rc,new Qa,new Ha],n=new ic(e);return t!=null&&n.add(new ja(t)),n.add(new Xa(n)),n},cc=P.z.object({include:P.z.string().array().optional(),exclude:P.z.string().array().optional(),level:P.z.enum(gn.LOG_LEVELS).optional().default("info")}),js="alamos-provider";var Ws;let Qs=(Ws=class extends Z.Composite{constructor(){super(...arguments);y(this,"schema",cc)}afterUpdate(){if(this.ctx.getOptional(js)!=null)return;const r=[],{include:s,exclude:o,level:i}=this.state;(s!=null||o!=null)&&r.push(gn.logLevelKeyFiler({include:s,exclude:o})),i!=null&&r.push(gn.logThresholdFilter(i)),r.length===0&&r.push(()=>!1),this.internal.ins=new gn.Instrumentation({key:"aether",logger:new gn.Logger({filters:r})}),this.ctx.set(js,this.internal.ins)}},y(Ws,"TYPE","AlamosProvider"),Ws);const qn=(t,e)=>{const n=t.get(js);if(n==null)throw new Error("No instrumentation provider");return e==null?n:n.child(e)},Nh={[Qs.TYPE]:Qs},Ah=P.z.object({props:Z.synnaxPropsZ.nullable(),state:Z.Synnax.connectivity.connectionStateZ.nullable()}),_o={synnax:null,state:Z.Synnax.connectivity.DEFAULT};var fe;let _r=(fe=class extends Z.Composite{constructor(){super(...arguments);y(this,"schema",fe.stateZ)}afterUpdate(){var n;if(this.ctx.has(Co)||pi(this.ctx,_o),this.state.props==null){this.internal.synnax!=null&&(this.setState(r=>({...r,state:Z.Synnax.connectivity.DEFAULT})),(n=this.internal.synnax)==null||n.close(),this.internal.synnax=null);return}this.prevState.props!=null&&f.external.equal(this.state.props,this.prevState.props)&&this.internal.synnax!=null||(this.internal.synnax=new Z.Synnax(this.state.props),this.internal.synnax.connectivity.onChange(r=>this.setState(s=>({...s,state:r}))),pi(this.ctx,this.internal))}},y(fe,"TYPE","SynnaxProvider"),y(fe,"stateZ",Ah),fe);const Co="pluto-client-context",pi=(t,e)=>t.set(Co,e),ps=t=>t.get(Co).synnax,lc={[_r.TYPE]:_r},Dh=Object.freeze(Object.defineProperty({__proto__:null,Provider:_r,REGISTRY:lc,ZERO_CONTEXT_VALUE:_o,use:ps},Symbol.toStringTag,{value:"Module"})),$h=new Error("request for lock canceled");var Oh=function(t,e,n,r){function s(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(h){i(h)}}function l(u){try{c(r.throw(u))}catch(h){i(h)}}function c(u){u.done?o(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};class zh{constructor(e,n=$h){this._value=e,this._cancelError=n,this._weightedQueues=[],this._weightedWaiters=[]}acquire(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((n,r)=>{this._weightedQueues[e-1]||(this._weightedQueues[e-1]=[]),this._weightedQueues[e-1].push({resolve:n,reject:r}),this._dispatch()})}runExclusive(e,n=1){return Oh(this,void 0,void 0,function*(){const[r,s]=yield this.acquire(n);try{return yield e(r)}finally{s()}})}waitForUnlock(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise(n=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),this._weightedWaiters[e-1].push(n),this._dispatch()})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatch()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatch()}cancel(){this._weightedQueues.forEach(e=>e.forEach(n=>n.reject(this._cancelError))),this._weightedQueues=[]}_dispatch(){var e;for(let n=this._value;n>0;n--){const r=(e=this._weightedQueues[n-1])===null||e===void 0?void 0:e.shift();if(!r)continue;const s=this._value,o=n;this._value-=n,n=this._value+1,r.resolve([s,this._newReleaser(o)])}this._drainUnlockWaiters()}_newReleaser(e){let n=!1;return()=>{n||(n=!0,this.release(e))}}_drainUnlockWaiters(){for(let e=this._value;e>0;e--)this._weightedWaiters[e-1]&&(this._weightedWaiters[e-1].forEach(n=>n()),this._weightedWaiters[e-1]=[])}}var Yh=function(t,e,n,r){function s(o){return o instanceof n?o:new n(function(i){i(o)})}return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(h){i(h)}}function l(u){try{c(r.throw(u))}catch(h){i(h)}}function c(u){u.done?o(u.value):s(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})};class Po{constructor(e){this._semaphore=new zh(1,e)}acquire(){return Yh(this,void 0,void 0,function*(){const[,e]=yield this._semaphore.acquire();return e})}runExclusive(e){return this._semaphore.runExclusive(()=>e())}isLocked(){return this._semaphore.isLocked()}waitForUnlock(){return this._semaphore.waitForUnlock()}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const uc=(t,e)=>(e==null&&t.dataType.equals(f.DataType.TIMESTAMP)&&(e=BigInt(t.data[0])),t.convert(f.DataType.FLOAT32,e));class Lh{constructor(e,n){y(this,"buffer");y(this,"cap");y(this,"dataType");this.cap=e,this.dataType=n,this.buffer=null}get length(){var e;return((e=this.buffer)==null?void 0:e.length)??0}write(e){const n=e.flatMap(r=>this._write(r));return{flushed:n.flatMap(r=>r.flushed),allocated:n.flatMap(r=>r.allocated)}}allocate(e,n){const r=f.TimeStamp.now();return f.Series.alloc(e,f.DataType.FLOAT32,r.spanRange(f.TimeStamp.MAX),this.dataType.equals(f.DataType.TIMESTAMP)?r.valueOf():0,"dynamic",n)}_write(e){const n={flushed:[],allocated:[]};this.buffer==null?(this.buffer=this.allocate(this.cap,e.alignment),n.allocated.push(this.buffer)):Math.abs(this.buffer.alignment+this.buffer.length-e.alignment)>1&&(n.flushed.push(this.buffer),this.buffer=this.allocate(this.cap,e.alignment),n.allocated.push(this.buffer));const r=uc(e,this.buffer.sampleOffset),s=this.buffer.write(r);if(s===e.length)return n;n.flushed.push(this.buffer),this.buffer=this.allocate(this.cap,e.alignment+s),n.allocated.push(this.buffer);const o=this._write(e.slice(s));return n.flushed.push(...o.flushed),n.allocated.push(...o.allocated),n}}class Ih{constructor(){y(this,"mu",new Po);y(this,"entries");this.entries=[]}get extent(){if(this.entries.length===0)return f.TimeRange.ZERO;const e=this.entries[0].timeRange,n=this.entries[this.entries.length-1].timeRange;return new f.TimeRange(e.start,n.end)}get gaps(){return this.entries.map(e=>e.gap)}write(e,n){if(n.length===0||n.length===0||this.entries.some(o=>o.timeRange.overlapsWith(e)))return;n=n.map(o=>uc(o));const r=new gi(e,n),s=this.getInsertionIndex(e);if(s!==this.entries.length&&(r.gap=new f.TimeRange(this.entries[s].timeRange.end,e.end)),s!==0){const o=this.entries[s-1];o.gap=new f.TimeRange(o.timeRange.end,e.start)}this.entries.splice(s,0,new gi(e,n))}getInsertionIndex(e){let n=0;for(;n<this.entries.length&&this.entries[n].timeRange.start<e.start;)n++;return n}async dirtyReadForWrite(e){const n=await this.mu.acquire();return{...this.dirtyRead(e),done:n}}dirtyRead(e){const n=this.entries.filter(i=>i.timeRange.overlapsWith(e));if(n.length===0)return{series:[],gaps:[e]};const r=n.map(i=>i.gap).filter((i,a)=>a!==n.length-1&&!i.isZero),s=new f.TimeRange(e.start,n[0].timeRange.start),o=new f.TimeRange(n[n.length-1].timeRange.end,e.end);return s.isValid&&!s.isZero&&r.unshift(s),o.isValid&&!o.isZero&&r.push(o),{series:n.flatMap(i=>i.data).filter(i=>i.timeRange.overlapsWith(e)),gaps:r}}}class gi{constructor(e,n){y(this,"timeRange");y(this,"data");y(this,"gap");this.timeRange=e,this.data=n,this.gap=f.TimeRange.ZERO}}class Bh{constructor(e,n){y(this,"channel");y(this,"static");y(this,"dynamic");this.static=new Ih,this.dynamic=new Lh(e,n.dataType),this.channel=n}writeDynamic(e){const{flushed:n,allocated:r}=this.dynamic.write(e);return n.length>0&&this.static.write(new Z.TimeRange(n[0].timeRange.start,n[n.length-1].timeRange.end),n),r}writeStatic(e,n){this.static.write(e,n)}dirtyRead(e){return this.static.dirtyRead(e)}async dirtyReadForStaticWrite(e){return await this.static.dirtyReadForWrite(e)}}const Fh=1e4;class Uh{constructor(){y(this,"_client",null)}swap(e){var n;(n=this._client)==null||n.close(),this._client=e}async retrieveChannel(e){return await this.client.retrieveChannel(e)}async read(e,n){return await this.client.read(e,n)}async stream(e,n){return await this.client.stream(e,n)}close(){this.client.close()}get client(){if(this._client==null)throw new Z.QueryError("No cluster has been connected");return this._client}}class Zh{constructor(e,n){y(this,"key",Z.nanoid());y(this,"core");y(this,"ins");y(this,"mu",new Po);y(this,"cache",new Map);y(this,"listeners",new Map);y(this,"_streamer",null);this.core=e,this.ins=n}async retrieveChannel(e){return await this.core.channels.retrieve(e)}async read(e,n){this.ins.L.debug("starting read",{tr:e.toPrettyString(),channels:n});const r=performance.now(),s=new Map,o=[],i={};try{for(const a of n){const l=await this.getCache(a),{series:c,gaps:u,done:h}=await l.dirtyReadForStaticWrite(e);o.push(h),u.length===0&&(i[a]=new Qn(l.channel,c)),u.forEach(d=>{const p=s.get(d.toString());p==null?s.set(d.toString(),[d,[a]]):s.set(d.toString(),[d,[...p[1],a]])})}if(s.size===0)return this.ins.L.debug("read satisfied by cache",{tr:e.toPrettyString(),channels:n,responses:Ps(Object.values(i)),time:f.TimeSpan.milliseconds(performance.now()-r).toString()}),i;this.ins.L.debug("read cache miss",{tr:e.toPrettyString(),channels:n,toFetch:Array.from(s.values()).map(([a,l])=>({timeRange:a.toPrettyString(),channels:l})),responses:Ps(Object.values(i))});for(const[,[a,l]]of s){const c=await this.core.telem.read(a,l);for(const u of l)(await this.getCache(u)).writeStatic(a,c.get(u))}}finally{o.forEach(a=>a())}for(const a of n){const l=await this.getCache(a),{series:c}=l.dirtyRead(e);i[a]=new Qn(l.channel,c)}return this.ins.L.debug("read satisfied by fetch",{tr:e.toPrettyString(),channels:n,responses:Ps(Object.values(i)),time:f.TimeSpan.milliseconds(performance.now()-r).toString()}),i}async stream(e,n){return await this.mu.runExclusive(async()=>{this.ins.L.debug("updating stream",{keys:n}),this.listeners.set(e,n);const r={};for(const s of n){const o=await this.getCache(s);r[s]=new Qn(o.channel,o.dynamic.buffer!=null?[o.dynamic.buffer]:[])}return e(r),await this.updateStreamer(),()=>this.removeStreamHandler(e)})}close(){var e;this.ins.L.info("closing client",{key:this.key}),this.cache.clear(),(e=this._streamer)==null||e.close()}removeStreamHandler(e){this.mu.runExclusive(async()=>{if(this.ins.L.debug("removing stream handler",{handler:e}),this.listeners.delete(e))return await this.updateStreamer();this.ins.L.warn("attempted to remove non-existent stream handler",{handler:e})})}async getCache(e){const n=this.cache.get(e);if(n!=null)return n;const r=await this.core.channels.retrieve(e),s=new Bh(Fh,r);return this.cache.set(e,s),s}async updateStreamer(){var r,s;const e=new Set;if(this.listeners.forEach(o=>o.forEach(i=>e.add(i))),e.size===0){this.ins.L.info("no keys to stream, closing streamer"),(r=this._streamer)==null||r.close(),this._streamer=null;return}const n=Array.from(e);f.compare.primitiveArrays(n,((s=this._streamer)==null?void 0:s.keys)??[])!==f.compare.EQUAL&&(this._streamer==null&&(this.ins.L.info("creating new streamer",{keys:n}),this._streamer=await this.core.telem.newStreamer(n),this.start(this._streamer)),this.ins.L.debug("updating streamer",{prev:this._streamer.keys,next:n}),await this._streamer.update(n))}async start(e){for await(const n of e){const r=[];for(const s of n.keys){const o=n.get(s),i=await this.getCache(s),a=i.writeDynamic(o);r.push(new Qn(i.channel,a))}this.listeners.forEach((s,o)=>{const i=r.filter(l=>s.includes(l.channel.key));if(i.length===0)return;const a=Object.fromEntries(i.map(l=>[l.channel.key,l]));o(a)})}}}const Ps=t=>t.map(e=>e.digest);class Qn{constructor(e,n){y(this,"channel");y(this,"data");this.channel=e,this.data=n}get timeRange(){if(this.data.length===0)return f.TimeRange.ZERO;const e=this.data[0].timeRange,n=this.data[this.data.length-1].timeRange;return new f.TimeRange(e.start,n.end)}get digest(){return{channel:this.channel.key,timeRange:this.timeRange.toPrettyString(),series:this.data.map(e=>e.digest)}}}const hc=P.z.object({}),Ae=class Ae extends Z.Composite{constructor(){super(...arguments);y(this,"client",new Uh);y(this,"factory",ac(this.client));y(this,"schema",Ae.stateZ)}create(n){const{instrumentation:r}=this.internal;r.L.debug("creating telem",{spec:n});const s=this.factory.create(n);if(s==null)throw new Z.UnexpectedError(`Telemetry service could not find a source for type ${n.type}`);return s}registerFactory(n){this.factory.add(n)}equals(n){return n instanceof Ae?this.client._client===n.client._client:!1}afterUpdate(){const n=ps(this.ctx),r=qn(this.ctx,"telem");return this.internal.instrumentation=r.child("provider"),n!=null&&(r.L.info("swapping client",{client:n}),this.client.swap(new Zh(n,this.internal.instrumentation))),Ba(this.ctx,this)}};y(Ae,"TYPE","TelemProvider"),y(Ae,"stateZ",hc);let $n=Ae;const Hh={[$n.TYPE]:$n},Vh=`precision mediump float;
|
|
7
|
+
uniform highp vec4 u_color;
|
|
8
|
+
|
|
9
|
+
void main(void) {
|
|
10
|
+
gl_FragColor = u_color;
|
|
11
|
+
}
|
|
12
|
+
`,qh=`attribute float a_x;
|
|
13
|
+
attribute float a_y;
|
|
14
|
+
attribute vec2 a_translate;
|
|
15
|
+
|
|
16
|
+
uniform vec2 u_region_scale;
|
|
17
|
+
uniform vec2 u_region_offset;
|
|
18
|
+
uniform vec2 u_scale;
|
|
19
|
+
uniform vec2 u_offset;
|
|
20
|
+
|
|
21
|
+
void main(void) {
|
|
22
|
+
vec2 transformed = u_region_scale * (u_scale * vec2(a_x,a_y) + u_offset) + u_region_offset;
|
|
23
|
+
transformed = transformed + a_translate;
|
|
24
|
+
gl_Position = vec4(transformed, 0.0, 1.0);
|
|
25
|
+
}
|
|
26
|
+
`;class Cr{constructor(e,n=f.scale.XY.IDENTITY){y(this,"scale_");y(this,"wrapped");this.wrapped=e,this.scale_=n}reset(){this.wrapped.reset()}applyScale(e){return new Cr(this,e)}get canvas(){return this.wrapped.canvas}get miterLimit(){return this.wrapped.miterLimit}set miterLimit(e){this.wrapped.miterLimit=this.scale_.x.dim(e)}get globalAlpha(){return this.wrapped.globalAlpha}set globalAlpha(e){this.wrapped.globalAlpha=e}get globalCompositeOperation(){return this.wrapped.globalCompositeOperation}set globalCompositeOperation(e){this.wrapped.globalCompositeOperation=e}get fillStyle(){return this.wrapped.fillStyle}set fillStyle(e){this.wrapped.fillStyle=e}get strokeStyle(){return this.wrapped.strokeStyle}set strokeStyle(e){this.wrapped.strokeStyle=e}commit(){this.wrapped.commit()}drawImage(e,n,r,s,o,i,a,l,c){this.wrapped.drawImage(e,n,r,s,o,i,a,l,c)}beginPath(){this.wrapped.beginPath()}clip(e,n){this.wrapped.clip(e,n)}fill(e,n){if(e==null)return this.wrapped.fill();this.wrapped.fill(e,n)}isPointInPath(e,n,r,s){return this.wrapped.isPointInPath(e,n,r,s)}isPointInStroke(e,n,r){return this.wrapped.isPointInStroke(e,n,r)}stroke(e){if(e==null)return this.wrapped.stroke();this.wrapped.stroke(e)}createConicGradient(e,n,r){return this.wrapped.createConicGradient(e,n,r)}createLinearGradient(e,n,r,s){return this.wrapped.createLinearGradient(e,n,r,s)}createPattern(e,n){return this.wrapped.createPattern(e,n)}createRadialGradient(e,n,r,s,o,i){return this.wrapped.createRadialGradient(e,n,r,s,o,i)}get filter(){return this.wrapped.filter}set filter(e){this.wrapped.filter=e}createImageData(e,n,r){return this.wrapped.createImageData(e,n,r)}getImageData(e,n,r,s,o){return this.wrapped.getImageData(e,n,r,s,o)}putImageData(e,n,r,s,o,i,a){this.wrapped.putImageData(e,n,r,s,o,i,a)}get imageSmoothingEnabled(){return this.wrapped.imageSmoothingEnabled}set imageSmoothingEnabled(e){this.wrapped.imageSmoothingEnabled=e}get imageSmoothingQuality(){return this.wrapped.imageSmoothingQuality}set imageSmoothingQuality(e){this.wrapped.imageSmoothingQuality=e}arc(e,n,r,s,o,i){this.wrapped.arc(this.scale_.x.pos(e),this.scale_.y.pos(n),this.scale_.x.dim(r),s,o,i)}arcTo(e,n,r,s,o){this.wrapped.arcTo(this.scale_.x.pos(e),this.scale_.y.pos(n),this.scale_.x.pos(r),this.scale_.y.pos(s),this.scale_.x.dim(o))}bezierCurveTo(e,n,r,s,o,i){this.wrapped.bezierCurveTo(this.scale_.x.pos(e),this.scale_.y.pos(n),this.scale_.x.pos(r),this.scale_.y.pos(s),this.scale_.x.pos(o),this.scale_.y.pos(i))}closePath(){this.wrapped.closePath()}ellipse(e,n,r,s,o,i,a,l){this.wrapped.ellipse(this.scale_.x.pos(e),this.scale_.y.pos(n),this.scale_.x.dim(r),this.scale_.y.dim(s),o,i,a,l)}lineTo(e,n){this.wrapped.lineTo(this.scale_.x.pos(e),this.scale_.y.pos(n))}moveTo(e,n){this.wrapped.moveTo(this.scale_.x.pos(e),this.scale_.y.pos(n))}quadraticCurveTo(e,n,r,s){this.wrapped.quadraticCurveTo(this.scale_.x.pos(e),this.scale_.y.pos(n),this.scale_.x.pos(r),this.scale_.y.pos(s))}rect(e,n,r,s){this.wrapped.rect(this.scale_.x.pos(e),this.scale_.y.pos(n),this.scale_.x.dim(r),this.scale_.y.dim(s))}roundRect(e,n,r,s,o){this.wrapped.roundRect(this.scale_.x.pos(e),this.scale_.y.pos(n),this.scale_.x.dim(r),this.scale_.y.dim(s),typeof o=="number"?this.scale_.x.dim(o):o)}get lineCap(){return this.wrapped.lineCap}set lineCap(e){this.wrapped.lineCap=e}get lineDashOffset(){return this.wrapped.lineDashOffset}set lineDashOffset(e){this.wrapped.lineDashOffset=this.scale_.x.dim(e)}get lineJoin(){return this.wrapped.lineJoin}set lineJoin(e){this.wrapped.lineJoin=e}get lineWidth(){return this.wrapped.lineWidth}set lineWidth(e){this.wrapped.lineWidth=this.scale_.x.dim(e)}getLineDash(){return this.wrapped.getLineDash()}setLineDash(e){const n=Array.from(e).map(r=>this.scale_.x.dim(r));this.wrapped.setLineDash(n)}clearRect(e,n,r,s){this.wrapped.clearRect(e,n,r,s)}fillRect(e,n,r,s){this.wrapped.fillRect(this.scale_.x.pos(e),this.scale_.y.pos(n),this.scale_.x.dim(r),this.scale_.y.dim(s))}strokeRect(e,n,r,s){this.wrapped.strokeRect(this.scale_.x.pos(e),this.scale_.y.pos(n),this.scale_.x.dim(r),this.scale_.y.dim(s))}get shadowBlur(){return this.wrapped.shadowBlur}set shadowBlur(e){this.wrapped.shadowBlur=e}get shadowColor(){return this.wrapped.shadowColor}set shadowColor(e){this.wrapped.shadowColor=e}get shadowOffsetX(){return this.wrapped.shadowOffsetX}set shadowOffsetX(e){this.wrapped.shadowOffsetX=e}get shadowOffsetY(){return this.wrapped.shadowOffsetY}restore(){this.wrapped.restore()}save(){this.wrapped.save()}fillText(e,n,r,s){this.wrapped.fillText(e,this.scale_.x.pos(n),this.scale_.y.pos(r),s!=null?this.scale_.x.dim(s):void 0)}measureText(e){this.wrapped.font=Ms(this.wrapped.font,this.scale_.x.reverse());const n=this.wrapped.measureText(e);return this.wrapped.font=Ms(this.wrapped.font,this.scale_.x),n}strokeText(e,n,r,s){this.wrapped.strokeText(e,this.scale_.x.pos(n),this.scale_.y.pos(r),s!=null?this.scale_.x.dim(s):void 0)}get direction(){return this.wrapped.direction}set direction(e){this.wrapped.direction=e}get font(){return this.wrapped.font}set font(e){this.wrapped.font=Ms(e,this.scale_.x)}get fontKerning(){return this.wrapped.fontKerning}set fontKerning(e){this.wrapped.fontKerning=e}get textAlign(){return this.wrapped.textAlign}set textAlign(e){this.wrapped.textAlign=e}get textBaseline(){return this.wrapped.textBaseline}set textBaseline(e){this.wrapped.textBaseline=e}getTransform(){return this.wrapped.getTransform()}resetTransform(){this.wrapped.resetTransform()}rotate(e){this.wrapped.rotate(e)}scale(e,n){this.wrapped.scale(e,n)}setTransform(e,n,r,s,o,i){this.wrapped.setTransform(e,n,r,s,o,i)}transform(e,n,r,s,o,i){this.wrapped.transform(e,n,r,s,o,i)}translate(e,n){this.wrapped.translate(e,n)}}const mi=/(\d+(\.\d+)?)px/,Ms=(t,e)=>{var s;const n=Number((s=t.match(mi))==null?void 0:s[1]);if(n==null)return t;const r=e.dim(n);return t.replace(mi,`${r}px`)},Xh=`precision mediump float;
|
|
27
|
+
|
|
28
|
+
void main(void) {
|
|
29
|
+
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
30
|
+
}
|
|
31
|
+
`,Wh=`attribute vec4 a_position;
|
|
32
|
+
|
|
33
|
+
void main(void) {
|
|
34
|
+
gl_Position = a_position;
|
|
35
|
+
}
|
|
36
|
+
`,yi=t=>new Error(`failed to compile webgl program: ${t}`),Gh=new Error("null shader encountered");class Mo{constructor(e,n,r){y(this,"ctx");y(this,"prog");y(this,"vertShader");y(this,"fragShader");this.ctx=e;const s=e.gl.createProgram();if(s==null)throw yi("failed to create program");this.prog=s,this.vertShader=n,this.fragShader=r,this.compile()}setAsActive(){return this.ctx.gl.useProgram(this.prog),()=>this.ctx.gl.useProgram(null)}uniformXY(e,n){this.ctx.gl.uniform2fv(this.getUniformLoc(e),f.xy.couple(f.xy.construct(n)))}uniformColor(e,n){this.ctx.gl.uniform4fv(this.getUniformLoc(e),n.rgba1)}getUniformLoc(e){const n=this.ctx.gl.getUniformLocation(this.prog,e);if(n==null)throw new Error(`unexpected missing uniform ${e}`);return n}compile(){const e=this.ctx.gl;this.compileShader(this.vertShader,e.VERTEX_SHADER),this.compileShader(this.fragShader,e.FRAGMENT_SHADER),e.linkProgram(this.prog)}compileShader(e,n){const r=this.ctx.gl,s=r.createShader(n);if(s==null)throw Gh;if(r.shaderSource(s,e),r.compileShader(s),!r.getShaderParameter(s,r.COMPILE_STATUS)){const i=r.getShaderInfoLog(s);throw r.deleteShader(s),yi(i??"unknown")}r.attachShader(this.prog,s)}}const Kh=new Float32Array([0,0,0,0,0,0]);class jh extends Mo{constructor(n){super(n,Wh,Xh);y(this,"positionBuffer");this.positionBuffer=n.gl.createBuffer(),n.gl.bindBuffer(n.gl.ARRAY_BUFFER,this.positionBuffer),n.gl.bufferData(n.gl.ARRAY_BUFFER,Kh,n.gl.STATIC_DRAW)}exec(){const{gl:n}=this.ctx,r=n.getAttribLocation(this.prog,"a_position");n.bindBuffer(n.ARRAY_BUFFER,this.positionBuffer);const s=n.createVertexArray();n.bindVertexArray(s),n.enableVertexAttribArray(r),n.vertexAttribPointer(r,2,n.FLOAT,!1,0,0),this.setAsActive(),n.drawArrays(n.TRIANGLES,0,3)}}const xi={high:1,low:0};class fc{constructor(){y(this,"mutex",new Po);y(this,"requests",new Map);y(this,"cleanup",new Map);this.start()}async set(e){await this.mutex.runExclusive(()=>{const n=this.requests.get(e.key);if(n==null){this.requests.set(e.key,e);return}const r=xi[e.priority]>=xi[n.priority],s=e.canvases.length>=n.canvases.length;r&&s&&this.requests.set(e.key,e)})}async render(){await this.mutex.runExclusive(async()=>{if(this.requests.size===0)return;const{requests:e,cleanup:n}=this;for(const[r,s]of n.entries()){const o=e.get(r);o!=null&&(s(o),n.delete(r))}for(const r of e.values()){const s=await r.render();s!=null&&this.cleanup.set(r.key,s)}this.requests.clear()})}async start(){do{try{await this.render()}catch(e){console.error(e)}await this.sleep()}while(!0)}async sleep(){return await new Promise(requestAnimationFrame)}}var At;let gt=(At=class{constructor(e,n,r,s){y(this,"glCanvas");y(this,"upper2dCanvas");y(this,"lower2dCanvas");y(this,"gl");y(this,"lower2d");y(this,"upper2d");y(this,"region");y(this,"dpr");y(this,"loop");y(this,"clearProgram");y(this,"os");this.upper2dCanvas=r,this.lower2dCanvas=n,this.glCanvas=e,this.os=s,this.loop=new fc;const o=this.lower2dCanvas.getContext("2d");if(o==null)throw new Error("Could not get 2D context");this.lower2d=new Cr(o);const i=this.upper2dCanvas.getContext("2d");if(i==null)throw new Error("Could not get 2D context");this.upper2d=new Cr(i);const a=this.glCanvas.getContext("webgl2",{preserveDrawingBuffer:!0,depth:!1});if(a==null)throw new Error("Could not get WebGL context");this.gl=a,this.region=f.box$1.ZERO,this.dpr=1,this.os==="Windows"&&(this.clearProgram=new jh(this))}static create(e,n,r,s,o){const i=new At(n,r,s,o);return e.set(At.CONTEXT_KEY,i),i}static useOptional(e){return e.getOptional(At.CONTEXT_KEY)}static use(e){return e.get(At.CONTEXT_KEY)}update(e){e.set(At.CONTEXT_KEY,this)}resize(e,n){f.box$1.equals(this.region,e)&&this.dpr===n||(this.region=e,this.dpr=n,this.resizeCanvas(this.glCanvas),this.resizeCanvas(this.upper2dCanvas),this.resizeCanvas(this.lower2dCanvas),this.lower2d.scale(this.dpr,this.dpr),this.upper2d.scale(this.dpr,this.dpr),this.gl.viewport(0,0,f.box$1.width(e)*n,f.box$1.height(e)*n))}resizeCanvas(e){e.width=f.box$1.width(this.region)*this.dpr,e.height=f.box$1.height(this.region)*this.dpr}get aspect(){return f.box$1.aspect(this.region)}scaleRegion(e){return new f.scale.XY(f.scale.Scale.scale(0,1).scale(f.box$1.width(e)).translate(f.box$1.left(e)).reBound(f.box$1.width(this.region)).scale(-1,1),f.scale.Scale.scale(0,1).scale(f.box$1.height(e)).invert().translate(f.box$1.top(e)).reBound(f.box$1.height(this.region)).scale(-1,1).invert())}scissor(e,n=f.xy.ZERO,r){const s=[];return r.includes("upper2d")&&s.push(this.scissorCanvas(this.upper2d,e,n)),r.includes("lower2d")&&s.push(this.scissorCanvas(this.lower2d,e,n)),r.includes("gl")&&s.push(this.scissorGL(e,n)),()=>s.forEach(o=>o())}scissorCanvas(e,n,r=f.xy.ZERO){const s=new Path2D;return n=Jn(n,r),s.rect(...f.xy.couple(f.box$1.topLeft(n)),...f.dimensions.couple(f.box$1.dims(n))),e.save(),e.clip(s),()=>e.restore()}scissorGL(e,n=f.xy.ZERO){return this.gl.enable(this.gl.SCISSOR_TEST),e=Jn(e,n),this.gl.scissor(f.box$1.left(e)*this.dpr,(f.box$1.height(this.region)-f.box$1.bottom(e))*this.dpr,f.box$1.width(e)*this.dpr,f.box$1.height(e)*this.dpr),()=>this.gl.disable(this.gl.SCISSOR_TEST)}erase(e,n=f.xy.ZERO,...r){n=f.xy.construct(n),r.length===0&&(r=["upper2d","lower2d","gl"]),r.includes("upper2d")&&this.eraseCanvas(this.upper2d,e,n),r.includes("lower2d")&&this.eraseCanvas(this.lower2d,e,n),r.includes("gl")&&this.eraseGL(e,n)}eraseGL(e,n=f.xy.ZERO){var o;const{gl:r}=this,s=this.scissorGL(Jn(e,n));r.clearColor(...f.ZERO.rgba1),r.clear(r.COLOR_BUFFER_BIT),this.os==="Windows"&&((o=this.clearProgram)==null||o.exec()),s()}eraseCanvas(e,n,r=f.xy.ZERO){const s=Jn(n,r);e.clearRect(...f.xy.couple(f.box$1.topLeft(s)),...f.dimensions.couple(f.box$1.dims(s)))}},y(At,"CONTEXT_KEY",f.CSS.B("render-context")),At);const Jn=(t,e)=>f.box$1.construct(f.box$1.left(t)-e.x,f.box$1.top(t)-e.y,f.box$1.width(t)+e.x*2,f.box$1.height(t)+e.y*2);let Xn=class{constructor(){y(this,"prevErase",f.box$1.ZERO)}erase(e,n,r,s,o){!f.box$1.equals(r,n)&&!f.box$1.equals(this.prevErase,r)?(e.erase(r,s,...o),this.prevErase=r):e.erase(n,s,...o)}};const $t="layout",Js="data",pe="tool";var Ft;let xt=(Ft=class{constructor(e){y(this,"f");this.f=e}static control(e,n){e.set(Ft.CONTEXT_KEY,new Ft(n))}static useRequest(e){return e.get(Ft.CONTEXT_KEY).f}static useOptionalRequest(e){var n;return((n=e.getOptional(Ft.CONTEXT_KEY))==null?void 0:n.f)??null}static requestRender(e,n){this.useRequest(e)(n)}},y(Ft,"CONTEXT_KEY","pluto-vis-renderer"),Ft);const wi=f.DataType.FLOAT32.density.valueOf(),dc=P.z.object({x:Ks,y:Ks,label:P.z.string().optional(),color:f.Color.z,strokeWidth:P.z.number().default(1),downsample:P.z.number().min(1).max(50).optional().default(1)});f.xy.NAN,f.xy.NAN,f.ZERO;const De=class De extends Mo{constructor(n){super(n,qh,Vh);y(this,"translationBuffer");this.translationBuffer=n.gl.createBuffer()}bindPropsAndState({dataToDecimalScale:n,region:r},{strokeWidth:s,color:o}){const i=f.scale.xyScaleToTransform(n),a=f.scale.xyScaleToTransform(this.ctx.scaleRegion(r));return this.uniformXY("u_region_scale",a.scale),this.uniformXY("u_region_offset",a.offset),this.uniformColor("u_color",o),this.uniformXY("u_scale",i.scale),this.uniformXY("u_offset",i.offset),this.attrStrokeWidth(s)}draw({x:n,y:r,count:s,downsample:o,xOffset:i,yOffset:a},l){const{gl:c}=this.ctx;this.bindAttrBuffer("x",n.glBuffer,o,i),this.bindAttrBuffer("y",r.glBuffer,o,a),c.drawArraysInstanced(c.LINE_STRIP,0,s/o,l)}static create(n){const r=gt.use(n),s=new De(r);return n.set(De.CONTEXT_KEY,s),s}static use(n){return n.get(De.CONTEXT_KEY)}bindAttrBuffer(n,r,s,o=0){const{gl:i}=this.ctx;i.bindBuffer(i.ARRAY_BUFFER,r);const a=i.getAttribLocation(this.prog,`a_${n}`);i.vertexAttribPointer(a,1,i.FLOAT,!1,wi*s,wi*o),i.enableVertexAttribArray(a)}attrStrokeWidth(n){const{gl:r}=this.ctx;r.bindBuffer(r.ARRAY_BUFFER,this.translationBuffer);const s=Jh(this.ctx.aspect,n);r.bufferData(r.ARRAY_BUFFER,s,r.DYNAMIC_DRAW);const o=r.getAttribLocation(this.prog,"a_translate");return r.vertexAttribPointer(o,2,r.FLOAT,!1,0,0),r.enableVertexAttribArray(o),r.vertexAttribDivisor(o,1),s.length/2}};y(De,"CONTEXT_KEY","pluto-line-gl-program");let Pr=De;class On extends Z.Leaf{constructor(){super(...arguments);y(this,"schema",dc)}afterUpdate(){const{internal:n}=this;n.xTelem=Ut(this.ctx,this.state.x,n.xTelem),n.yTelem=Ut(this.ctx,this.state.y,n.yTelem),n.instrumentation=qn(this.ctx,"line"),n.prog=Pr.use(this.ctx),n.requestRender=xt.useRequest(this.ctx),n.xTelem.onChange(()=>n.requestRender(Js)),n.yTelem.onChange(()=>n.requestRender(Js)),n.requestRender($t)}afterDelete(){var r,s,o,i;const{internal:n}=this;(s=(r=n.xTelem).cleanup)==null||s.call(r),(i=(o=n.yTelem).cleanup)==null||i.call(o),n.requestRender($t)}async xBounds(){const[n]=await this.internal.xTelem.value();return n}async yBounds(){const[n]=await this.internal.yTelem.value();return n}async findByXValue(n,r){const{xTelem:s}=this.internal,[,o]=await s.value();let[i,a]=[-1,-1];o.find((p,S)=>{const x=p.binarySearch(r),b=x!==-1&&x!==p.length;return b&&([i,a]=[x,S]),b});const l=await this.xyValue(a,i),{key:c}=this,{color:u,label:h}=this.state,d={x:n.dataToDecimalScale.x.pos(l.x),y:n.dataToDecimalScale.y.pos(l.y)};return{key:c,color:u,label:h,value:l,position:d}}async render(n){const{downsample:r}=this.state,{xTelem:s,yTelem:o,prog:i}=this.internal,{dataToDecimalScale:a}=n,[,l]=await s.value();l.forEach(d=>d.updateGLBuffer(i.ctx.gl));const[,c]=await o.value();c.forEach(d=>d.updateGLBuffer(i.ctx.gl));const u=of(l,c,r);this.internal.instrumentation.L.debug("render",{key:this.key,downsample:r,scale:f.scale.xyScaleToTransform(a),props:n.region,ops:af(u)});const h=i.setAsActive();u.forEach(d=>{const{x:p,y:S}=d,x={...n,dataToDecimalScale:rf(a,p,S)},b=i.bindPropsAndState(x,this.state);i.draw(d,b)}),h()}async xyValue(n,r){const{xTelem:s,yTelem:o}=this.internal,[,i]=await s.value(),[,a]=await o.value();return f.xy.construct(this.getValue(n,r,i),this.getValue(n,r,a))}getValue(n,r,s){return n===-1||r===-1||n>=s.length?NaN:Number(s[n].at(r))}}y(On,"TYPE","line");const Qh=5e3,Jh=(t,e)=>nf(ef(t),Math.ceil(e)-1).map((n,r)=>Math.floor(r/tf)*(1/(Qh*t))*n),tf=5,ef=t=>new Float32Array([0,0,0,t,0,-t,1,0,-1,0]),nf=(t,e)=>{const n=new Float32Array(t.length*e);for(let r=0;r<e;r++)n.set(t,r*t.length);return n},rf=(t,e,n)=>t.translate(t.x.dim(Number(e.sampleOffset)),t.y.dim(Number(n.sampleOffset))),sf={[On.TYPE]:On},of=(t,e,n)=>{if(t.length===0||e.length===0)return[];const r=[];return t.forEach(s=>{const o=f.bounds.construct(s.alignment,s.alignment+s.length);e.filter(a=>f.bounds.overlapsWith(o,f.bounds.construct(a.alignment,a.alignment+a.length))).forEach(a=>{if(a._timeRange!=null&&s._timeRange!=null&&!a.timeRange.overlapsWith(s.timeRange))return;let l=0,c=0;s.alignment<a.alignment?l=a.alignment-s.alignment:a.alignment<s.alignment&&(c=s.alignment-a.alignment);const u=Math.min(s.length-l,a.length-c);u>0&&r.push({x:s,y:a,xOffset:l,yOffset:c,count:u,downsample:n})})}),r},af=t=>t.map(e=>({...e,x:e.x.digest,y:e.y.digest})),Ro=P.z.object({dpr:P.z.number(),region:f.box$1.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:f.external$1.osZ});var Gs;let Mr=(Gs=class extends Z.Composite{constructor(){super(...arguments);y(this,"schema",Ro);y(this,"renderContextSet",!1)}afterUpdate(){let n=gt.useOptional(this.ctx);if(n==null){if(this.renderContextSet)throw new Z.UnexpectedError("[vis.worker.Canvas] - expected render context to be set");if(!this.state.bootstrap)return;const{glCanvas:r,lower2dCanvas:s,upper2dCanvas:o,os:i}=this.state;if(r==null||s==null||o==null)throw new Z.UnexpectedError("[vis.worker.Canvas] - expected render context bootstrap to include all canvases");n=gt.create(this.ctx,r,s,o,i),Pr.create(this.ctx),this.setState(a=>({...a,bootstrap:!1,bootstrapped:!0,glCanvas:void 0,lower2dCanvas:void 0,upper2dCanvas:void 0}))}else n.update(this.ctx);n.resize(this.state.region,this.state.dpr)}},y(Gs,"TYPE","Canvas"),Gs);const pc={[Mr.TYPE]:Mr},cf=Object.freeze(Object.defineProperty({__proto__:null,Canvas:Mr,REGISTRY:pc,canvasStateZ:Ro},Symbol.toStringTag,{value:"Module"})),lf=P.z.object({key:P.z.string(),size:P.z.number(),order:f.spatial.order,loc:f.location.outer}),le=(t,e)=>e.filter(({loc:n})=>n===t).sort((n,r)=>f.compare.order(n.order,r.order)),uf=(t,e,n)=>{const r=e.find(({key:h})=>h===t);if(r==null)return f.xy.ZERO;const s=f.location.construct(r.loc),o=le(s,e),i=f.location.construct(f.direction$1.swap(f.location.direction(s))),a=le(i,e),l=o.findIndex(({key:h})=>h===t),c=o.slice(0,l).reduce((h,{size:d})=>h+d,0),u=a.reduce((h,{size:d})=>h+d,0);switch(s){case"left":return f.xy.translate(f.box$1.topLeft(n),[c,u]);case"right":return f.xy.translate(f.box$1.topRight(n),[c-r.size,u]);case"top":return f.xy.translate(f.box$1.topLeft(n),[c,u]);default:return f.xy.translate(f.box$1.bottomLeft(n),[u,c-r.size])}},hf=(t,e)=>{const n=le("left",t),r=le("right",t),s=le("top",t),o=le("bottom",t),i=n.reduce((u,{size:h})=>u+h,0),a=r.reduce((u,{size:h})=>u+h,0),l=s.reduce((u,{size:h})=>u+h,0),c=o.reduce((u,{size:h})=>u+h,0);return f.box$1.construct(f.xy.translate(f.box$1.topLeft(e),{x:i,y:l}),f.box$1.width(e)-i-a,f.box$1.height(e)-l-c)};function hr(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ff(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function ko(t){let e,n,r;t.length!==2?(e=hr,n=(a,l)=>hr(t(a),l),r=(a,l)=>t(a)-l):(e=t===hr||t===ff?t:df,n=t,r=t);function s(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{const h=c+u>>>1;n(a[h],l)<0?c=h+1:u=h}while(c<u)}return c}function o(a,l,c=0,u=a.length){if(c<u){if(e(l,l)!==0)return u;do{const h=c+u>>>1;n(a[h],l)<=0?c=h+1:u=h}while(c<u)}return c}function i(a,l,c=0,u=a.length){const h=s(a,l,c,u-1);return h>c&&r(a[h-1],l)>-r(a[h],l)?h-1:h}return{left:s,center:i,right:o}}function df(){return 0}function pf(t){return t===null?NaN:+t}const gf=ko(hr),mf=gf.right;ko(pf).center;const yf=mf,xf=Math.sqrt(50),wf=Math.sqrt(10),Sf=Math.sqrt(2);function Rr(t,e,n){const r=(e-t)/Math.max(0,n),s=Math.floor(Math.log10(r)),o=r/Math.pow(10,s),i=o>=xf?10:o>=wf?5:o>=Sf?2:1;let a,l,c;return s<0?(c=Math.pow(10,-s)/i,a=Math.round(t*c),l=Math.round(e*c),a/c<t&&++a,l/c>e&&--l,c=-c):(c=Math.pow(10,s)*i,a=Math.round(t/c),l=Math.round(e/c),a*c<t&&++a,l*c>e&&--l),l<a&&.5<=n&&n<2?Rr(t,e,n*2):[a,l,c]}function vf(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[s,o,i]=r?Rr(e,t,n):Rr(t,e,n);if(!(o>=s))return[];const a=o-s+1,l=new Array(a);if(r)if(i<0)for(let c=0;c<a;++c)l[c]=(o-c)/-i;else for(let c=0;c<a;++c)l[c]=(o-c)*i;else if(i<0)for(let c=0;c<a;++c)l[c]=(s+c)/-i;else for(let c=0;c<a;++c)l[c]=(s+c)*i;return l}function to(t,e,n){return e=+e,t=+t,n=+n,Rr(t,e,n)[2]}function eo(t,e,n){e=+e,t=+t,n=+n;const r=e<t,s=r?to(e,t,n):to(t,e,n);return(r?-1:1)*(s<0?1/-s:s)}function gc(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function No(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function mc(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Wn(){}var zn=.7,kr=1/zn,$e="\\s*([+-]?\\d+)\\s*",Yn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Dt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",bf=/^#([0-9a-f]{3,8})$/,Ef=new RegExp(`^rgb\\(${$e},${$e},${$e}\\)$`),Tf=new RegExp(`^rgb\\(${Dt},${Dt},${Dt}\\)$`),_f=new RegExp(`^rgba\\(${$e},${$e},${$e},${Yn}\\)$`),Cf=new RegExp(`^rgba\\(${Dt},${Dt},${Dt},${Yn}\\)$`),Pf=new RegExp(`^hsl\\(${Yn},${Dt},${Dt}\\)$`),Mf=new RegExp(`^hsla\\(${Yn},${Dt},${Dt},${Yn}\\)$`),Si={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};No(Wn,ge,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:vi,formatHex:vi,formatHex8:Rf,formatHsl:kf,formatRgb:bi,toString:bi});function vi(){return this.rgb().formatHex()}function Rf(){return this.rgb().formatHex8()}function kf(){return yc(this).formatHsl()}function bi(){return this.rgb().formatRgb()}function ge(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=bf.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Ei(e):n===3?new mt(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?tr(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?tr(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Ef.exec(t))?new mt(e[1],e[2],e[3],1):(e=Tf.exec(t))?new mt(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=_f.exec(t))?tr(e[1],e[2],e[3],e[4]):(e=Cf.exec(t))?tr(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Pf.exec(t))?Ci(e[1],e[2]/100,e[3]/100,1):(e=Mf.exec(t))?Ci(e[1],e[2]/100,e[3]/100,e[4]):Si.hasOwnProperty(t)?Ei(Si[t]):t==="transparent"?new mt(NaN,NaN,NaN,0):null}function Ei(t){return new mt(t>>16&255,t>>8&255,t&255,1)}function tr(t,e,n,r){return r<=0&&(t=e=n=NaN),new mt(t,e,n,r)}function Nf(t){return t instanceof Wn||(t=ge(t)),t?(t=t.rgb(),new mt(t.r,t.g,t.b,t.opacity)):new mt}function no(t,e,n,r){return arguments.length===1?Nf(t):new mt(t,e,n,r??1)}function mt(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}No(mt,no,mc(Wn,{brighter(t){return t=t==null?kr:Math.pow(kr,t),new mt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?zn:Math.pow(zn,t),new mt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new mt(de(this.r),de(this.g),de(this.b),Nr(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:Ti,formatHex:Ti,formatHex8:Af,formatRgb:_i,toString:_i}));function Ti(){return`#${ue(this.r)}${ue(this.g)}${ue(this.b)}`}function Af(){return`#${ue(this.r)}${ue(this.g)}${ue(this.b)}${ue((isNaN(this.opacity)?1:this.opacity)*255)}`}function _i(){const t=Nr(this.opacity);return`${t===1?"rgb(":"rgba("}${de(this.r)}, ${de(this.g)}, ${de(this.b)}${t===1?")":`, ${t})`}`}function Nr(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function de(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ue(t){return t=de(t),(t<16?"0":"")+t.toString(16)}function Ci(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ct(t,e,n,r)}function yc(t){if(t instanceof Ct)return new Ct(t.h,t.s,t.l,t.opacity);if(t instanceof Wn||(t=ge(t)),!t)return new Ct;if(t instanceof Ct)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,s=Math.min(e,n,r),o=Math.max(e,n,r),i=NaN,a=o-s,l=(o+s)/2;return a?(e===o?i=(n-r)/a+(n<r)*6:n===o?i=(r-e)/a+2:i=(e-n)/a+4,a/=l<.5?o+s:2-o-s,i*=60):a=l>0&&l<1?0:i,new Ct(i,a,l,t.opacity)}function Df(t,e,n,r){return arguments.length===1?yc(t):new Ct(t,e,n,r??1)}function Ct(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}No(Ct,Df,mc(Wn,{brighter(t){return t=t==null?kr:Math.pow(kr,t),new Ct(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?zn:Math.pow(zn,t),new Ct(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,s=2*n-r;return new mt(Rs(t>=240?t-240:t+120,s,r),Rs(t,s,r),Rs(t<120?t+240:t-120,s,r),this.opacity)},clamp(){return new Ct(Pi(this.h),er(this.s),er(this.l),Nr(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Nr(this.opacity);return`${t===1?"hsl(":"hsla("}${Pi(this.h)}, ${er(this.s)*100}%, ${er(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Pi(t){return t=(t||0)%360,t<0?t+360:t}function er(t){return Math.max(0,Math.min(1,t||0))}function Rs(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Ao=t=>()=>t;function $f(t,e){return function(n){return t+n*e}}function Of(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function zf(t){return(t=+t)==1?xc:function(e,n){return n-e?Of(e,n,t):Ao(isNaN(e)?n:e)}}function xc(t,e){var n=e-t;return n?$f(t,n):Ao(isNaN(t)?e:t)}const Ar=function t(e){var n=zf(e);function r(s,o){var i=n((s=no(s)).r,(o=no(o)).r),a=n(s.g,o.g),l=n(s.b,o.b),c=xc(s.opacity,o.opacity);return function(u){return s.r=i(u),s.g=a(u),s.b=l(u),s.opacity=c(u),s+""}}return r.gamma=t,r}(1);function Yf(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),s;return function(o){for(s=0;s<n;++s)r[s]=t[s]*(1-o)+e[s]*o;return r}}function Lf(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function If(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,s=new Array(r),o=new Array(n),i;for(i=0;i<r;++i)s[i]=Do(t[i],e[i]);for(;i<n;++i)o[i]=e[i];return function(a){for(i=0;i<r;++i)o[i]=s[i](a);return o}}function Bf(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function _t(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Ff(t,e){var n={},r={},s;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(s in e)s in t?n[s]=Do(t[s],e[s]):r[s]=e[s];return function(o){for(s in n)r[s]=n[s](o);return r}}var ro=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ks=new RegExp(ro.source,"g");function Uf(t){return function(){return t}}function Zf(t){return function(e){return t(e)+""}}function wc(t,e){var n=ro.lastIndex=ks.lastIndex=0,r,s,o,i=-1,a=[],l=[];for(t=t+"",e=e+"";(r=ro.exec(t))&&(s=ks.exec(e));)(o=s.index)>n&&(o=e.slice(n,o),a[i]?a[i]+=o:a[++i]=o),(r=r[0])===(s=s[0])?a[i]?a[i]+=s:a[++i]=s:(a[++i]=null,l.push({i,x:_t(r,s)})),n=ks.lastIndex;return n<e.length&&(o=e.slice(n),a[i]?a[i]+=o:a[++i]=o),a.length<2?l[0]?Zf(l[0].x):Uf(e):(e=l.length,function(c){for(var u=0,h;u<e;++u)a[(h=l[u]).i]=h.x(c);return a.join("")})}function Do(t,e){var n=typeof e,r;return e==null||n==="boolean"?Ao(e):(n==="number"?_t:n==="string"?(r=ge(e))?(e=r,Ar):wc:e instanceof ge?Ar:e instanceof Date?Bf:Lf(e)?Yf:Array.isArray(e)?If:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Ff:_t)(t,e)}function Hf(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Mi=180/Math.PI,so={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Sc(t,e,n,r,s,o){var i,a,l;return(i=Math.sqrt(t*t+e*e))&&(t/=i,e/=i),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,l/=a),t*r<e*n&&(t=-t,e=-e,l=-l,i=-i),{translateX:s,translateY:o,rotate:Math.atan2(e,t)*Mi,skewX:Math.atan(l)*Mi,scaleX:i,scaleY:a}}var nr;function Vf(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?so:Sc(e.a,e.b,e.c,e.d,e.e,e.f)}function qf(t){return t==null||(nr||(nr=document.createElementNS("http://www.w3.org/2000/svg","g")),nr.setAttribute("transform",t),!(t=nr.transform.baseVal.consolidate()))?so:(t=t.matrix,Sc(t.a,t.b,t.c,t.d,t.e,t.f))}function vc(t,e,n,r){function s(c){return c.length?c.pop()+" ":""}function o(c,u,h,d,p,S){if(c!==h||u!==d){var x=p.push("translate(",null,e,null,n);S.push({i:x-4,x:_t(c,h)},{i:x-2,x:_t(u,d)})}else(h||d)&&p.push("translate("+h+e+d+n)}function i(c,u,h,d){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),d.push({i:h.push(s(h)+"rotate(",null,r)-2,x:_t(c,u)})):u&&h.push(s(h)+"rotate("+u+r)}function a(c,u,h,d){c!==u?d.push({i:h.push(s(h)+"skewX(",null,r)-2,x:_t(c,u)}):u&&h.push(s(h)+"skewX("+u+r)}function l(c,u,h,d,p,S){if(c!==h||u!==d){var x=p.push(s(p)+"scale(",null,",",null,")");S.push({i:x-4,x:_t(c,h)},{i:x-2,x:_t(u,d)})}else(h!==1||d!==1)&&p.push(s(p)+"scale("+h+","+d+")")}return function(c,u){var h=[],d=[];return c=t(c),u=t(u),o(c.translateX,c.translateY,u.translateX,u.translateY,h,d),i(c.rotate,u.rotate,h,d),a(c.skewX,u.skewX,h,d),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,h,d),c=u=null,function(p){for(var S=-1,x=d.length,b;++S<x;)h[(b=d[S]).i]=b.x(p);return h.join("")}}}var Xf=vc(Vf,"px, ","px)","deg)"),Wf=vc(qf,", ",")",")"),Gf=1e-12;function Ri(t){return((t=Math.exp(t))+1/t)/2}function Kf(t){return((t=Math.exp(t))-1/t)/2}function jf(t){return((t=Math.exp(2*t))-1)/(t+1)}const Qf=function t(e,n,r){function s(o,i){var a=o[0],l=o[1],c=o[2],u=i[0],h=i[1],d=i[2],p=u-a,S=h-l,x=p*p+S*S,b,v;if(x<Gf)v=Math.log(d/c)/e,b=function(A){return[a+A*p,l+A*S,c*Math.exp(e*A*v)]};else{var M=Math.sqrt(x),C=(d*d-c*c+r*x)/(2*c*n*M),w=(d*d-c*c-r*x)/(2*d*n*M),N=Math.log(Math.sqrt(C*C+1)-C),E=Math.log(Math.sqrt(w*w+1)-w);v=(E-N)/e,b=function(A){var O=A*v,Y=Ri(N),H=c/(n*M)*(Y*jf(e*O+N)-Kf(N));return[a+H*p,l+H*S,c*Y/Ri(e*O+N)]}}return b.duration=v*1e3*e/Math.SQRT2,b}return s.rho=function(o){var i=Math.max(.001,+o),a=i*i,l=a*a;return t(i,a,l)},s}(Math.SQRT2,2,4);function Jf(t){return function(){return t}}function td(t){return+t}var ki=[0,1];function Re(t){return t}function oo(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:Jf(isNaN(e)?NaN:.5)}function ed(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function nd(t,e,n){var r=t[0],s=t[1],o=e[0],i=e[1];return s<r?(r=oo(s,r),o=n(i,o)):(r=oo(r,s),o=n(o,i)),function(a){return o(r(a))}}function rd(t,e,n){var r=Math.min(t.length,e.length)-1,s=new Array(r),o=new Array(r),i=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++i<r;)s[i]=oo(t[i],t[i+1]),o[i]=n(e[i],e[i+1]);return function(a){var l=yf(t,a,1,r)-1;return o[l](s[l](a))}}function bc(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function sd(){var t=ki,e=ki,n=Do,r,s,o,i=Re,a,l,c;function u(){var d=Math.min(t.length,e.length);return i!==Re&&(i=ed(t[0],t[d-1])),a=d>2?rd:nd,l=c=null,h}function h(d){return d==null||isNaN(d=+d)?o:(l||(l=a(t.map(r),e,n)))(r(i(d)))}return h.invert=function(d){return i(s((c||(c=a(e,t.map(r),_t)))(d)))},h.domain=function(d){return arguments.length?(t=Array.from(d,td),u()):t.slice()},h.range=function(d){return arguments.length?(e=Array.from(d),u()):e.slice()},h.rangeRound=function(d){return e=Array.from(d),n=Hf,u()},h.clamp=function(d){return arguments.length?(i=d?!0:Re,u()):i!==Re},h.interpolate=function(d){return arguments.length?(n=d,u()):n},h.unknown=function(d){return arguments.length?(o=d,h):o},function(d,p){return r=d,s=p,u()}}function Ec(){return sd()(Re,Re)}function od(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Dr(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Ze(t){return t=Dr(Math.abs(t)),t?t[1]:NaN}function id(t,e){return function(n,r){for(var s=n.length,o=[],i=0,a=t[0],l=0;s>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),o.push(n.substring(s-=a,s+a)),!((l+=a+1)>r));)a=t[i=(i+1)%t.length];return o.reverse().join(e)}}function ad(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var cd=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $r(t){if(!(e=cd.exec(t)))throw new Error("invalid format: "+t);var e;return new $o({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}$r.prototype=$o.prototype;function $o(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}$o.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 ld(t){t:for(var e=t.length,n=1,r=-1,s;n<e;++n)switch(t[n]){case".":r=s=n;break;case"0":r===0&&(r=n),s=n;break;default:if(!+t[n])break t;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(s+1):t}var Tc;function ud(t,e){var n=Dr(t,e);if(!n)return t+"";var r=n[0],s=n[1],o=s-(Tc=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,i=r.length;return o===i?r:o>i?r+new Array(o-i+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Dr(t,Math.max(0,e+o-1))[0]}function Ni(t,e){var n=Dr(t,e);if(!n)return t+"";var r=n[0],s=n[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const Ai={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:od,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Ni(t*100,e),r:Ni,s:ud,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Di(t){return t}var $i=Array.prototype.map,Oi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function hd(t){var e=t.grouping===void 0||t.thousands===void 0?Di:id($i.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",s=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?Di:ad($i.call(t.numerals,String)),i=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(h){h=$r(h);var d=h.fill,p=h.align,S=h.sign,x=h.symbol,b=h.zero,v=h.width,M=h.comma,C=h.precision,w=h.trim,N=h.type;N==="n"?(M=!0,N="g"):Ai[N]||(C===void 0&&(C=12),w=!0,N="g"),(b||d==="0"&&p==="=")&&(b=!0,d="0",p="=");var E=x==="$"?n:x==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():"",A=x==="$"?r:/[%p]/.test(N)?i:"",O=Ai[N],Y=/[defgprs%]/.test(N);C=C===void 0?6:/[gprs]/.test(N)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function H(D){var U=E,R=A,g,k,_;if(N==="c")R=O(D)+R,D="";else{D=+D;var z=D<0||1/D<0;if(D=isNaN(D)?l:O(Math.abs(D),C),w&&(D=ld(D)),z&&+D==0&&S!=="+"&&(z=!1),U=(z?S==="("?S:a:S==="-"||S==="("?"":S)+U,R=(N==="s"?Oi[8+Tc/3]:"")+R+(z&&S==="("?")":""),Y){for(g=-1,k=D.length;++g<k;)if(_=D.charCodeAt(g),48>_||_>57){R=(_===46?s+D.slice(g+1):D.slice(g))+R,D=D.slice(0,g);break}}}M&&!b&&(D=e(D,1/0));var I=U.length+D.length+R.length,T=I<v?new Array(v-I+1).join(d):"";switch(M&&b&&(D=e(T+D,T.length?v-R.length:1/0),T=""),p){case"<":D=U+D+R+T;break;case"=":D=U+T+D+R;break;case"^":D=T.slice(0,I=T.length>>1)+U+D+R+T.slice(I);break;default:D=T+U+D+R;break}return o(D)}return H.toString=function(){return h+""},H}function u(h,d){var p=c((h=$r(h),h.type="f",h)),S=Math.max(-8,Math.min(8,Math.floor(Ze(d)/3)))*3,x=Math.pow(10,-S),b=Oi[8+S/3];return function(v){return p(x*v)+b}}return{format:c,formatPrefix:u}}var rr,_c,Cc;fd({thousands:",",grouping:[3],currency:["$",""]});function fd(t){return rr=hd(t),_c=rr.format,Cc=rr.formatPrefix,rr}function dd(t){return Math.max(0,-Ze(Math.abs(t)))}function pd(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ze(e)/3)))*3-Ze(Math.abs(t)))}function gd(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Ze(e)-Ze(t))+1}function md(t,e,n,r){var s=eo(t,e,n),o;switch(r=$r(r??",f"),r.type){case"s":{var i=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=pd(s,i))&&(r.precision=o),Cc(r,i)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=gd(s,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=dd(s))&&(r.precision=o-(r.type==="%")*2);break}}return _c(r)}function yd(t){var e=t.domain;return t.ticks=function(n){var r=e();return vf(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var s=e();return md(s[0],s[s.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),s=0,o=r.length-1,i=r[s],a=r[o],l,c,u=10;for(a<i&&(c=i,i=a,a=c,c=s,s=o,o=c);u-- >0;){if(c=to(i,a,n),c===l)return r[s]=i,r[o]=a,e(r);if(c>0)i=Math.floor(i/c)*c,a=Math.ceil(a/c)*c;else if(c<0)i=Math.ceil(i*c)/c,a=Math.floor(a*c)/c;else break;l=c}return t},t}function Pc(){var t=Ec();return t.copy=function(){return bc(t,Pc())},gc.apply(t,arguments),yd(t)}function xd(t,e){t=t.slice();var n=0,r=t.length-1,s=t[n],o=t[r],i;return o<s&&(i=n,n=r,r=i,i=s,s=o,o=i),t[n]=e.floor(s),t[r]=e.ceil(o),t}const Ns=new Date,As=new Date;function ut(t,e,n,r){function s(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return s.floor=o=>(t(o=new Date(+o)),o),s.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),s.round=o=>{const i=s(o),a=s.ceil(o);return o-i<a-o?i:a},s.offset=(o,i)=>(e(o=new Date(+o),i==null?1:Math.floor(i)),o),s.range=(o,i,a)=>{const l=[];if(o=s.ceil(o),a=a==null?1:Math.floor(a),!(o<i)||!(a>0))return l;let c;do l.push(c=new Date(+o)),e(o,a),t(o);while(c<o&&o<i);return l},s.filter=o=>ut(i=>{if(i>=i)for(;t(i),!o(i);)i.setTime(i-1)},(i,a)=>{if(i>=i)if(a<0)for(;++a<=0;)for(;e(i,-1),!o(i););else for(;--a>=0;)for(;e(i,1),!o(i););}),n&&(s.count=(o,i)=>(Ns.setTime(+o),As.setTime(+i),t(Ns),t(As),Math.floor(n(Ns,As))),s.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?s.filter(r?i=>r(i)%o===0:i=>s.count(0,i)%o===0):s)),s}const Or=ut(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Or.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?ut(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Or);Or.range;const Lt=1e3,bt=Lt*60,It=bt*60,Zt=It*24,Oo=Zt*7,zi=Zt*30,Ds=Zt*365,ke=ut(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Lt)},(t,e)=>(e-t)/Lt,t=>t.getUTCSeconds());ke.range;const zo=ut(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Lt)},(t,e)=>{t.setTime(+t+e*bt)},(t,e)=>(e-t)/bt,t=>t.getMinutes());zo.range;const wd=ut(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*bt)},(t,e)=>(e-t)/bt,t=>t.getUTCMinutes());wd.range;const Yo=ut(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Lt-t.getMinutes()*bt)},(t,e)=>{t.setTime(+t+e*It)},(t,e)=>(e-t)/It,t=>t.getHours());Yo.range;const Sd=ut(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*It)},(t,e)=>(e-t)/It,t=>t.getUTCHours());Sd.range;const Gn=ut(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*bt)/Zt,t=>t.getDate()-1);Gn.range;const Lo=ut(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Zt,t=>t.getUTCDate()-1);Lo.range;const vd=ut(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Zt,t=>Math.floor(t/Zt));vd.range;function we(t){return ut(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*bt)/Oo)}const gs=we(0),zr=we(1),bd=we(2),Ed=we(3),He=we(4),Td=we(5),_d=we(6);gs.range;zr.range;bd.range;Ed.range;He.range;Td.range;_d.range;function Se(t){return ut(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Oo)}const Mc=Se(0),Yr=Se(1),Cd=Se(2),Pd=Se(3),Ve=Se(4),Md=Se(5),Rd=Se(6);Mc.range;Yr.range;Cd.range;Pd.range;Ve.range;Md.range;Rd.range;const Io=ut(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Io.range;const kd=ut(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());kd.range;const Ht=ut(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Ht.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ut(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Ht.range;const me=ut(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());me.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ut(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});me.range;function Nd(t,e,n,r,s,o){const i=[[ke,1,Lt],[ke,5,5*Lt],[ke,15,15*Lt],[ke,30,30*Lt],[o,1,bt],[o,5,5*bt],[o,15,15*bt],[o,30,30*bt],[s,1,It],[s,3,3*It],[s,6,6*It],[s,12,12*It],[r,1,Zt],[r,2,2*Zt],[n,1,Oo],[e,1,zi],[e,3,3*zi],[t,1,Ds]];function a(c,u,h){const d=u<c;d&&([c,u]=[u,c]);const p=h&&typeof h.range=="function"?h:l(c,u,h),S=p?p.range(c,+u+1):[];return d?S.reverse():S}function l(c,u,h){const d=Math.abs(u-c)/h,p=ko(([,,b])=>b).right(i,d);if(p===i.length)return t.every(eo(c/Ds,u/Ds,h));if(p===0)return Or.every(Math.max(eo(c,u,h),1));const[S,x]=i[d/i[p-1][2]<i[p][2]/d?p-1:p];return S.every(x)}return[a,l]}const[Ad,Dd]=Nd(Ht,Io,gs,Gn,Yo,zo);function $s(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Os(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function an(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function $d(t){var e=t.dateTime,n=t.date,r=t.time,s=t.periods,o=t.days,i=t.shortDays,a=t.months,l=t.shortMonths,c=cn(s),u=ln(s),h=cn(o),d=ln(o),p=cn(i),S=ln(i),x=cn(a),b=ln(a),v=cn(l),M=ln(l),C={a:z,A:I,b:T,B:$,c:null,d:Ui,e:Ui,f:rp,g:dp,G:gp,H:tp,I:ep,j:np,L:Rc,m:sp,M:op,p:B,q:V,Q:Vi,s:qi,S:ip,u:ap,U:cp,V:lp,w:up,W:hp,x:null,X:null,y:fp,Y:pp,Z:mp,"%":Hi},w={a:q,A:W,b:Q,B:et,c:null,d:Zi,e:Zi,f:Sp,g:kp,G:Ap,H:yp,I:xp,j:wp,L:Nc,m:vp,M:bp,p:nt,q:st,Q:Vi,s:qi,S:Ep,u:Tp,U:_p,V:Cp,w:Pp,W:Mp,x:null,X:null,y:Rp,Y:Np,Z:Dp,"%":Hi},N={a:H,A:D,b:U,B:R,c:g,d:Bi,e:Bi,f:Kd,g:Ii,G:Li,H:Fi,I:Fi,j:qd,L:Gd,m:Vd,M:Xd,p:Y,q:Hd,Q:Qd,s:Jd,S:Wd,u:Id,U:Bd,V:Fd,w:Ld,W:Ud,x:k,X:_,y:Ii,Y:Li,Z:Zd,"%":jd};C.x=E(n,C),C.X=E(r,C),C.c=E(e,C),w.x=E(n,w),w.X=E(r,w),w.c=E(e,w);function E(F,X){return function(K){var L=[],it=-1,j=0,J=F.length,ot,ct,G;for(K instanceof Date||(K=new Date(+K));++it<J;)F.charCodeAt(it)===37&&(L.push(F.slice(j,it)),(ct=Yi[ot=F.charAt(++it)])!=null?ot=F.charAt(++it):ct=ot==="e"?" ":"0",(G=X[ot])&&(ot=G(K,ct)),L.push(ot),j=it+1);return L.push(F.slice(j,it)),L.join("")}}function A(F,X){return function(K){var L=an(1900,void 0,1),it=O(L,F,K+="",0),j,J;if(it!=K.length)return null;if("Q"in L)return new Date(L.Q);if("s"in L)return new Date(L.s*1e3+("L"in L?L.L:0));if(X&&!("Z"in L)&&(L.Z=0),"p"in L&&(L.H=L.H%12+L.p*12),L.m===void 0&&(L.m="q"in L?L.q:0),"V"in L){if(L.V<1||L.V>53)return null;"w"in L||(L.w=1),"Z"in L?(j=Os(an(L.y,0,1)),J=j.getUTCDay(),j=J>4||J===0?Yr.ceil(j):Yr(j),j=Lo.offset(j,(L.V-1)*7),L.y=j.getUTCFullYear(),L.m=j.getUTCMonth(),L.d=j.getUTCDate()+(L.w+6)%7):(j=$s(an(L.y,0,1)),J=j.getDay(),j=J>4||J===0?zr.ceil(j):zr(j),j=Gn.offset(j,(L.V-1)*7),L.y=j.getFullYear(),L.m=j.getMonth(),L.d=j.getDate()+(L.w+6)%7)}else("W"in L||"U"in L)&&("w"in L||(L.w="u"in L?L.u%7:"W"in L?1:0),J="Z"in L?Os(an(L.y,0,1)).getUTCDay():$s(an(L.y,0,1)).getDay(),L.m=0,L.d="W"in L?(L.w+6)%7+L.W*7-(J+5)%7:L.w+L.U*7-(J+6)%7);return"Z"in L?(L.H+=L.Z/100|0,L.M+=L.Z%100,Os(L)):$s(L)}}function O(F,X,K,L){for(var it=0,j=X.length,J=K.length,ot,ct;it<j;){if(L>=J)return-1;if(ot=X.charCodeAt(it++),ot===37){if(ot=X.charAt(it++),ct=N[ot in Yi?X.charAt(it++):ot],!ct||(L=ct(F,K,L))<0)return-1}else if(ot!=K.charCodeAt(L++))return-1}return L}function Y(F,X,K){var L=c.exec(X.slice(K));return L?(F.p=u.get(L[0].toLowerCase()),K+L[0].length):-1}function H(F,X,K){var L=p.exec(X.slice(K));return L?(F.w=S.get(L[0].toLowerCase()),K+L[0].length):-1}function D(F,X,K){var L=h.exec(X.slice(K));return L?(F.w=d.get(L[0].toLowerCase()),K+L[0].length):-1}function U(F,X,K){var L=v.exec(X.slice(K));return L?(F.m=M.get(L[0].toLowerCase()),K+L[0].length):-1}function R(F,X,K){var L=x.exec(X.slice(K));return L?(F.m=b.get(L[0].toLowerCase()),K+L[0].length):-1}function g(F,X,K){return O(F,e,X,K)}function k(F,X,K){return O(F,n,X,K)}function _(F,X,K){return O(F,r,X,K)}function z(F){return i[F.getDay()]}function I(F){return o[F.getDay()]}function T(F){return l[F.getMonth()]}function $(F){return a[F.getMonth()]}function B(F){return s[+(F.getHours()>=12)]}function V(F){return 1+~~(F.getMonth()/3)}function q(F){return i[F.getUTCDay()]}function W(F){return o[F.getUTCDay()]}function Q(F){return l[F.getUTCMonth()]}function et(F){return a[F.getUTCMonth()]}function nt(F){return s[+(F.getUTCHours()>=12)]}function st(F){return 1+~~(F.getUTCMonth()/3)}return{format:function(F){var X=E(F+="",C);return X.toString=function(){return F},X},parse:function(F){var X=A(F+="",!1);return X.toString=function(){return F},X},utcFormat:function(F){var X=E(F+="",w);return X.toString=function(){return F},X},utcParse:function(F){var X=A(F+="",!0);return X.toString=function(){return F},X}}}var Yi={"-":"",_:" ",0:"0"},ft=/^\s*\d+/,Od=/^%/,zd=/[\\^$*+?|[\]().{}]/g;function rt(t,e,n){var r=t<0?"-":"",s=(r?-t:t)+"",o=s.length;return r+(o<n?new Array(n-o+1).join(e)+s:s)}function Yd(t){return t.replace(zd,"\\$&")}function cn(t){return new RegExp("^(?:"+t.map(Yd).join("|")+")","i")}function ln(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function Ld(t,e,n){var r=ft.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Id(t,e,n){var r=ft.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Bd(t,e,n){var r=ft.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Fd(t,e,n){var r=ft.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Ud(t,e,n){var r=ft.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Li(t,e,n){var r=ft.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Ii(t,e,n){var r=ft.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Zd(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Hd(t,e,n){var r=ft.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Vd(t,e,n){var r=ft.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Bi(t,e,n){var r=ft.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function qd(t,e,n){var r=ft.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Fi(t,e,n){var r=ft.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Xd(t,e,n){var r=ft.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Wd(t,e,n){var r=ft.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Gd(t,e,n){var r=ft.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Kd(t,e,n){var r=ft.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function jd(t,e,n){var r=Od.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Qd(t,e,n){var r=ft.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Jd(t,e,n){var r=ft.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Ui(t,e){return rt(t.getDate(),e,2)}function tp(t,e){return rt(t.getHours(),e,2)}function ep(t,e){return rt(t.getHours()%12||12,e,2)}function np(t,e){return rt(1+Gn.count(Ht(t),t),e,3)}function Rc(t,e){return rt(t.getMilliseconds(),e,3)}function rp(t,e){return Rc(t,e)+"000"}function sp(t,e){return rt(t.getMonth()+1,e,2)}function op(t,e){return rt(t.getMinutes(),e,2)}function ip(t,e){return rt(t.getSeconds(),e,2)}function ap(t){var e=t.getDay();return e===0?7:e}function cp(t,e){return rt(gs.count(Ht(t)-1,t),e,2)}function kc(t){var e=t.getDay();return e>=4||e===0?He(t):He.ceil(t)}function lp(t,e){return t=kc(t),rt(He.count(Ht(t),t)+(Ht(t).getDay()===4),e,2)}function up(t){return t.getDay()}function hp(t,e){return rt(zr.count(Ht(t)-1,t),e,2)}function fp(t,e){return rt(t.getFullYear()%100,e,2)}function dp(t,e){return t=kc(t),rt(t.getFullYear()%100,e,2)}function pp(t,e){return rt(t.getFullYear()%1e4,e,4)}function gp(t,e){var n=t.getDay();return t=n>=4||n===0?He(t):He.ceil(t),rt(t.getFullYear()%1e4,e,4)}function mp(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+rt(e/60|0,"0",2)+rt(e%60,"0",2)}function Zi(t,e){return rt(t.getUTCDate(),e,2)}function yp(t,e){return rt(t.getUTCHours(),e,2)}function xp(t,e){return rt(t.getUTCHours()%12||12,e,2)}function wp(t,e){return rt(1+Lo.count(me(t),t),e,3)}function Nc(t,e){return rt(t.getUTCMilliseconds(),e,3)}function Sp(t,e){return Nc(t,e)+"000"}function vp(t,e){return rt(t.getUTCMonth()+1,e,2)}function bp(t,e){return rt(t.getUTCMinutes(),e,2)}function Ep(t,e){return rt(t.getUTCSeconds(),e,2)}function Tp(t){var e=t.getUTCDay();return e===0?7:e}function _p(t,e){return rt(Mc.count(me(t)-1,t),e,2)}function Ac(t){var e=t.getUTCDay();return e>=4||e===0?Ve(t):Ve.ceil(t)}function Cp(t,e){return t=Ac(t),rt(Ve.count(me(t),t)+(me(t).getUTCDay()===4),e,2)}function Pp(t){return t.getUTCDay()}function Mp(t,e){return rt(Yr.count(me(t)-1,t),e,2)}function Rp(t,e){return rt(t.getUTCFullYear()%100,e,2)}function kp(t,e){return t=Ac(t),rt(t.getUTCFullYear()%100,e,2)}function Np(t,e){return rt(t.getUTCFullYear()%1e4,e,4)}function Ap(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Ve(t):Ve.ceil(t),rt(t.getUTCFullYear()%1e4,e,4)}function Dp(){return"+0000"}function Hi(){return"%"}function Vi(t){return+t}function qi(t){return Math.floor(+t/1e3)}var Te,Dc;$p({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 $p(t){return Te=$d(t),Dc=Te.format,Te.parse,Te.utcFormat,Te.utcParse,Te}function Op(t){return new Date(t)}function zp(t){return t instanceof Date?+t:+new Date(+t)}function $c(t,e,n,r,s,o,i,a,l,c){var u=Ec(),h=u.invert,d=u.domain,p=c(".%L"),S=c(":%S"),x=c("%I:%M"),b=c("%I %p"),v=c("%a %d"),M=c("%b %d"),C=c("%B"),w=c("%Y");function N(E){return(l(E)<E?p:a(E)<E?S:i(E)<E?x:o(E)<E?b:r(E)<E?s(E)<E?v:M:n(E)<E?C:w)(E)}return u.invert=function(E){return new Date(h(E))},u.domain=function(E){return arguments.length?d(Array.from(E,zp)):d().map(Op)},u.ticks=function(E){var A=d();return t(A[0],A[A.length-1],E??10)},u.tickFormat=function(E,A){return A==null?N:c(A)},u.nice=function(E){var A=d();return(!E||typeof E.range!="function")&&(E=e(A[0],A[A.length-1],E??10)),E?d(xd(A,E)):u},u.copy=function(){return bc(u,$c(t,e,n,r,s,o,i,a,l,c))},u}function Yp(){return gc.apply($c(Ad,Dd,Ht,Io,gs,Gn,Yo,zo,ke,Dc).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}const Oc=P.z.enum(["linear","time"]),zc=P.z.object({tickSpacing:P.z.number().default(75),type:Oc.optional().default("linear")}),Xi=t=>{const e=zc.parse(t);return Bp[e.type](e)};class Lp{constructor(e){y(this,"props");this.props=e}generate({decimalToDataScale:e,size:n}){const r=[0,n],s=[new f.TimeStamp(e.pos(0)).date(),new f.TimeStamp(e.pos(1)).date()],o=Yp().domain(s).range(r);return o.ticks(Yc(n,this.props.tickSpacing)).map(a=>({label:this.tickLabel(a),position:o(a)}))}tickLabel(e){const n=new f.TimeStamp(e).date();let r=`:${n.getSeconds()}`;if(n.getMilliseconds()!==0){const o=Math.round(n.getMilliseconds()).toString().padStart(3,"0").replace(/0+$/,"");r+=`.${o}`}return n.getSeconds()===0&&n.getMilliseconds()===0&&(r=`${n.getHours()}:${n.getMinutes().toString().padStart(2,"0")}`),r}}class Ip{constructor(e){y(this,"props");this.props=e}generate({decimalToDataScale:e,size:n}){const r=[0,n],s=[e.pos(0),e.pos(1)],o=Pc().domain(s).range(r),i=Yc(n,this.props.tickSpacing);return o.ticks(i).map(l=>({label:this.tickLabel(l),position:o(l)}))}tickLabel(e){return e.toString()}}const Yc=(t,e)=>{const n=Math.floor(t/e);return n>0?n:1},Bp={linear:t=>new Ip(t),time:t=>new Lp(t)},Lc=zc.extend({color:f.Color.z,type:Oc.optional().default("linear"),font:P.z.string(),showGrid:P.z.boolean().optional().default(!0),location:f.location.outer,gridColor:f.Color.z,size:P.z.number().default(0)}),kt=4;class Fp{constructor(e,n){y(this,"ctx");y(this,"state");y(this,"tickFactory");this.ctx=e,this.state=n,this.tickFactory=Xi(this.state)}setState(e){this.state=Z.prettyParse(Lc,e),this.tickFactory=Xi(e)}render(e){const{lower2d:n}=this.ctx;switch(n.font=this.state.font,n.fillStyle=this.state.color.hex,n.lineWidth=1,this.state.location){case"left":return this.drawLeft(e);case"right":return this.drawRight(e);case"top":return this.drawTop(e);default:return this.drawBottom(e)}}drawBottom(e){const{lower2d:n}=this.ctx,{plot:r}=e,s=f.box$1.width(r),o=f.box$1.height(r),i=e.position,a=this.tickFactory.generate({...e,size:s});return this.maybeDrawGrid(s,a,c=>[f.xy.translateX(i,c.position),f.xy.translate(i,{x:c.position,y:-o})]),n.strokeStyle=this.state.color.hex,this.drawLine(i,f.xy.translateX(i,s)),{size:this.drawTicks(a,(c,u)=>{n.moveTo(i.x+u.position,i.y),n.lineTo(i.x+u.position,i.y+kt),n.stroke(),n.fillText(u.label,i.x+u.position-c.width/2,i.y+5+c.height)}).height+kt}}drawTop(e){const{lower2d:n}=this.ctx,{plot:r}=e,s=f.box$1.width(r),o=f.box$1.height(r),i=f.xy.translateY(e.position,this.state.size),a=this.tickFactory.generate({...e,size:s});return this.maybeDrawGrid(s,a,c=>[f.xy.translateX(i,c.position),f.xy.translate(i,{x:c.position,y:o})]),n.strokeStyle=this.state.color.hex,this.drawLine(i,f.xy.translateX(i,s)),{size:this.drawTicks(a,(c,u)=>{n.moveTo(i.x+u.position,i.y),n.lineTo(i.x+u.position,i.y-kt),n.stroke(),n.fillText(u.label,i.x+u.position-c.width/2,i.y-5-c.height)}).height+kt}}drawLeft(e){const{lower2d:n}=this.ctx,{plot:r}=e,s=f.box$1.height(r),o=f.box$1.width(r),i=f.xy.translateX(e.position,this.state.size),a=this.tickFactory.generate({...e,size:s});return this.maybeDrawGrid(s,a,c=>[f.xy.translateY(i,c.position),f.xy.translate(i,{x:o,y:c.position})]),n.strokeStyle=this.state.color.hex,this.drawLine(i,f.xy.translateY(i,s)),{size:this.drawTicks(a,(c,u)=>{n.moveTo(i.x,i.y+u.position),n.lineTo(i.x-kt,i.y+u.position),n.stroke(),n.fillText(u.label,i.x-c.width-kt*2,i.y+u.position+c.height/3)}).width+kt*2}}drawRight(e){const{lower2d:n}=this.ctx,{plot:r}=e,s=f.box$1.height(r),o=f.box$1.width(r),i=e.position,a=this.tickFactory.generate({...e,size:s});return this.maybeDrawGrid(s,a,c=>[f.xy.translateY(i,c.position),f.xy.translate(i,{x:-o,y:c.position})]),n.strokeStyle=this.state.color.hex,this.drawLine(i,f.xy.translateY(i,s)),{size:this.drawTicks(a,(c,u)=>{n.moveTo(i.x,i.y+u.position),n.lineTo(i.x+kt,i.y+u.position),n.stroke(),n.fillText(u.label,i.x+kt+2,i.y+u.position+c.height/3)}).width+kt*2}}drawLine(e,n){const{lower2d:r}=this.ctx;r.beginPath(),r.moveTo(...f.xy.couple(e)),r.lineTo(...f.xy.couple(n)),r.stroke()}drawTicks(e,n){let r=f.dimensions.ZERO;return e.forEach(s=>{const o=mr.dimensions(s.label,this.state.font,this.ctx.lower2d);r=f.dimensions.max([r,o]),n(o,s)}),r}maybeDrawGrid(e,n,r){const{showGrid:s,gridColor:o}=this.state;if(s){const i=f.bounds.construct(-1,1),a=f.bounds.construct(e-1,e+1);this.ctx.lower2d.strokeStyle=o.hex,n.filter(({position:l})=>!f.bounds.contains(i,l)&&!f.bounds.contains(a,l)).forEach(l=>this.drawLine(...r(l)))}}}const Kn=Lc.extend({bounds:f.bounds.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:f.TimeSpan.z.optional().default(f.TimeSpan.seconds(1)),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}),Up=2,Zp=7,Ic=(t,e)=>f.bounds.contains({lower:t-Zp,upper:t+Up},e),Hp=f.bounds.DECIMAL,Wi=f.TimeStamp.now(),Vp={lower:Wi.valueOf(),upper:Wi.add(f.TimeSpan.HOUR).valueOf()},Bc=t=>t==="linear"?Hp:Vp,qp=(t,e=.1,n)=>{const r=f.bounds.max(t.filter(f.bounds.isFinite));if(!f.bounds.isFinite(r))return Bc(n);const{lower:s,upper:o}=r;if(o===s)return{lower:s-1,upper:o+1};const i=(o-s)*e;return{lower:s-i,upper:o+i}},Xp=.01,Wp=.1;class Fc extends Z.Composite{afterUpdate(){var n;this.internal.render=gt.use(this.ctx);const e=Z.use(this.ctx);(n=this.state).autoBoundPadding??(n.autoBoundPadding=f.direction$1.construct(this.state.location)==="x"?Wp:Xp),this.internal.core=new Fp(this.internal.render,{color:e.colors.gray.l8,font:xn.fontString(e,"small"),gridColor:e.colors.gray.l2,...this.state,size:this.state.size+this.state.labelSize}),xt.requestRender(this.ctx,$t),this.internal.updateBounds==null&&(this.internal.updateBounds=f.throttle(r=>{this.setState(s=>({...s,bounds:r}))},this.state.autoBoundUpdateInterval.milliseconds))}afterDelete(){xt.requestRender(this.ctx,$t)}renderAxis(e,n){if(!e.canvases.includes("lower2d"))return;const{core:r}=this.internal,{grid:s,container:o}=e,i=uf(this.key,s,o),a={...e,position:i,decimalToDataScale:n},{size:l}=r.render(a);Ic(this.state.size,l)||this.setState(c=>({...c,size:l}))}async bounds(e,n){var c,u;if(e&&this.internal.boundSnapshot!=null)return[this.internal.boundSnapshot,null];const{lower:r,upper:s}=Uc(this.state.autoBounds);if(!r&&!s&&this.state.bounds!=null)return this.internal.boundSnapshot=this.state.bounds,[this.state.bounds,null];const o=h=>({upper:s||this.state.bounds==null?h.upper:this.state.bounds.upper,lower:r||this.state.bounds==null?h.lower:this.state.bounds.lower});let i,a=null;try{const h=await n();i=qp(h,this.state.autoBoundPadding,this.state.type)}catch(h){i=Bc(this.state.type),a=h}const l=o(i);return this.internal.boundSnapshot=l,(this.state.bounds==null||r&&this.state.bounds.lower!==l.lower||s&&this.state.bounds.upper!==l.upper)&&((u=(c=this.internal).updateBounds)==null||u.call(c,l)),[l,a]}async dataToDecimalScale(e,n,r){const[s,o]=await this.bounds(e,n),i=f.direction$1.swap(f.direction$1.construct(this.state.location));return[f.scale.Scale.scale(s).scale(1).translate(-f.box$1.root(r)[i]).magnify(1/f.box$1.dim(r,i)),o]}}const Uc=t=>typeof t=="boolean"?{lower:t,upper:t}:{lower:(t==null?void 0:t.lower)??!0,upper:(t==null?void 0:t.upper)??!0},Gp=Kn;class Ln extends Fc{constructor(){super(...arguments);y(this,"schema",Kn)}async render(n){if(this.deleted)return;const[r,s]=await this.dataToDecimalScale(n.hold,this.dataBounds.bind(this),n.viewport);if(this.renderAxis(n,r.reverse()),await this.renderYAxes(n,r),s!=null)throw s}async findByXDecimal(n,r){const[s,o]=await this.dataToDecimalScale(n.hold,this.dataBounds.bind(this),n.viewport);if(o!=null)throw o;return await this.findByXValue(n,s.reverse().pos(r))}async findByXValue(n,r){const[s,o]=await this.dataToDecimalScale(n.hold,this.dataBounds.bind(this),n.viewport);if(o!=null)throw o;const i={...n,xDataToDecimalScale:s},a=this.children.map(async l=>await l.findByXValue(i,r));return(await Promise.all(a)).flat()}async renderYAxes(n,r){const s={...n,xDataToDecimalScale:r};await Promise.all(this.children.map(async o=>await o.render(s)))}async dataBounds(){return await Promise.all(this.children.map(async n=>await n.xBounds()))}}y(Ln,"TYPE",f.CSS.BE("line-plot","x-axis"));class ms{constructor(e,n){y(this,"canvas");y(this,"theme");this.canvas=e,this.theme=n}rule({direction:e,region:n,position:r,...s}){return e==="x"?this.line({start:f.xy.construct(f.box$1.left(n),r),end:f.xy.construct(f.box$1.right(n),r),...s}):this.line({start:f.xy.construct(r,f.box$1.top(n)),end:f.xy.construct(r,f.box$1.bottom(n)),...s})}line({stroke:e,lineWidth:n,lineDash:r,start:s,end:o}){const i=this.canvas;i.strokeStyle=e.hex,i.lineWidth=n,i.setLineDash([r]),i.beginPath(),i.moveTo(...f.xy.couple(s)),i.lineTo(...f.xy.couple(o)),i.stroke()}circle({fill:e,radius:n,position:r}){const s=this.canvas;s.fillStyle=e.hex,s.beginPath(),s.arc(...f.xy.couple(r),n,0,2*Math.PI),s.fill()}container({region:e,bordered:n=!0,rounded:r=!0,borderColor:s,borderRadius:o,borderWidth:i,backgroundColor:a}){s==null&&(s=this.theme.colors.border),a==null&&(a=this.theme.colors.gray.l1),o==null&&(o=this.theme.sizes.border.radius),i==null&&(i=1);const l=this.canvas;l.fillStyle=a.hex,l.strokeStyle=s.hex,l.setLineDash([]),l.lineWidth=1,l.beginPath(),r?l.roundRect(...f.xy.couple(f.box$1.topLeft(e)),...f.xy.couple(f.box$1.dims(e)),o):l.rect(...f.xy.couple(f.box$1.topLeft(e)),...f.xy.couple(f.box$1.dims(e))),l.fill(),n&&l.stroke()}textContainer(e){const[n,r]=this.spacedTextDrawF(e),{position:s}=e;this.container({region:f.box$1.construct(s,n.width+12,n.height+12),...e}),r(f.xy.translate(s,[6,6]))}spacedTextDrawF({text:e,direction:n,spacing:r=1,level:s="p"}){const o=xn.fontString(this.theme,s),i=e.map(c=>mr.dimensions(c,o,this.canvas)),a=this.theme.sizes.base*r,l=Math.max(...i.map(c=>c[f.direction$1.dimension(n)]))+a;return[{[f.direction$1.dimension(f.direction$1.swap(n))]:Math.max(...i.map(c=>c[f.direction$1.dimension(f.direction$1.swap(n))])),[f.direction$1.dimension(n)]:l*e.length-a},c=>{const u=xn.fontString(this.theme,s);this.canvas.font=u,this.canvas.fillStyle=this.theme.colors.text.hex,this.canvas.textBaseline="top",e.forEach((h,d)=>{this.canvas.fillText(h,c.x,c.y+l*d)})}]}drawTextInCenter({text:e,box:n,level:r="p"}){this.canvas.font=xn.fontString(this.theme,r),this.canvas.fillStyle=this.theme.colors.text.hex;const s=mr.dimensions(e,this.canvas.font,this.canvas),o=f.box$1.positionInCenter(f.box$1.construct(f.xy.ZERO,s),n);this.canvas.fillText(e,f.box$1.left(o),f.box$1.bottom(o))}}const Bo=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:f.Color.z});class qe extends Z.Leaf{constructor(){super(...arguments);y(this,"schema",Bo)}afterUpdate(){this.internal.renderCtx=gt.use(this.ctx);const n=Z.use(this.ctx);this.internal.draw=new ms(this.internal.renderCtx.upper2d,n),xt.requestRender(this.ctx,pe)}afterDelete(){xt.requestRender(this.ctx,pe)}updatePositions({decimalToDataScale:n,plot:r,container:s}){if(this.state.dragging&&this.state.pixelPosition!=null){const i=n.pos((this.state.pixelPosition-f.box$1.top(r)+f.box$1.top(s))/f.box$1.height(r));return this.setState(a=>({...a,position:i})),this.state.pixelPosition}if(this.state.position==null){const i=n.pos(.5);this.setState(a=>({...a,position:i}))}const o=n.reverse().pos(this.state.position)*f.box$1.height(r)+f.box$1.top(r)-f.box$1.top(s);return isNaN(o)||this.setState(i=>({...i,pixelPosition:o})),o}async render(n){if(this.deleted)return;const{renderCtx:r}=this.internal,{location:s,plot:o}=n,i=f.location.direction(s),{upper2d:a}=r,l=this.internal.draw;let c=this.updatePositions(n);c+=f.box$1.top(n.container),l.rule({stroke:this.state.color,lineWidth:this.state.lineWidth,lineDash:this.state.lineDash,direction:i,region:o,position:c}),a.fillStyle=this.state.color.hex,a.beginPath(),s==="left"?(a.moveTo(f.box$1.left(o),c),a.lineTo(f.box$1.left(o)-5,c-5),a.lineTo(f.box$1.left(o)-5,c+5)):s==="right"&&(a.moveTo(f.box$1.right(o),c),a.lineTo(f.box$1.right(o)+5,c-5),a.lineTo(f.box$1.right(o)+5,c+5)),a.closePath(),a.fill()}}y(qe,"TYPE","Rule");const Zc={[qe.TYPE]:qe},Kp=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:Zc,Rule:qe,ruleStateZ:Bo},Symbol.toStringTag,{value:"Module"})),jp=Kn.extend({location:f.location.x.optional().default("left")});class Lr extends Fc{constructor(){super(...arguments);y(this,"schema",Kn)}async xBounds(){return f.bounds.max(await Promise.all(this.lines.map(async n=>await n.xBounds())))}async render(n){if(this.deleted)return;const[r,s]=await this.dataToDecimalScale(n.hold,this.dataBounds.bind(this),n.viewport),o=r.invert().reverse();if(this.renderAxis(n,o),await this.renderLines(n,r),await this.renderRules(n,o),s!=null)throw s}async renderLines({xDataToDecimalScale:n,plot:r,canvases:s},o){if(!s.includes("gl"))return;const i={region:r,dataToDecimalScale:new f.scale.XY(n,o)};await Promise.all(this.lines.map(async a=>await a.render(i)))}async renderRules({container:n,plot:r,canvases:s},o){if(!s.includes("upper2d"))return;const{location:i}=this.state,{render:a}=this.internal,l=f.box$1.construct(f.box$1.left(n),f.box$1.top(r),f.box$1.width(n),f.box$1.height(r)),c=a.scissor(l,f.xy.ZERO,["upper2d"]),u={container:n,plot:r,decimalToDataScale:o,location:i};await Promise.all(this.rules.map(async h=>await h.render(u))),c()}async findByXValue({xDataToDecimalScale:n,plot:r,viewport:s,hold:o},i){const[a,l]=await this.dataToDecimalScale(o,this.dataBounds.bind(this),s);if(l!=null)throw l;const c=new f.scale.XY(n,a),u={region:r,dataToDecimalScale:c};return(await Promise.all(this.lines.map(async h=>await h.findByXValue(u,i)))).map(h=>({...h,units:this.state.label}))}async dataBounds(){return await Promise.all(this.lines.map(async n=>await n.yBounds()))}get lines(){return this.childrenOfType(On.TYPE)}get rules(){return this.childrenOfType(qe.TYPE)}}y(Lr,"TYPE",f.CSS.BE("line-plot","y-axis"));const Fo=P.z.object({position:f.xy.xy.or(P.z.null()),textColor:f.Color.z.optional().default(f.ZERO),backgroundColor:f.Color.z.optional().default(f.ZERO),borderColor:f.Color.z.optional().default(f.ZERO),ruleColor:f.Color.z.optional().default(f.ZERO),ruleStrokeWidth:P.z.number().optional().default(1),ruleStrokeDash:P.z.number().default(0)});class Xe extends Z.Leaf{constructor(){super(...arguments);y(this,"schema",Fo)}afterUpdate(){const n=Z.use(this.ctx);this.state.textColor.isZero&&(this.state.textColor=n.colors.text),this.state.backgroundColor.isZero&&(this.state.backgroundColor=n.colors.gray.l1),this.state.borderColor.isZero&&(this.state.borderColor=n.colors.border),this.state.ruleColor.isZero&&(this.state.ruleColor=n.colors.gray.l5),this.internal.dotColor=n.colors.text,this.internal.dotColorContrast=n.colors.textContrast,this.internal.render=gt.use(this.ctx),this.internal.draw=new ms(this.internal.render.upper2d,n),xt.requestRender(this.ctx,pe)}afterDelete(){xt.requestRender(this.ctx,pe)}async render(n){if(this.deleted||this.state.position==null)return;const{region:r}=n,s=f.scale.XY.scale(f.box$1.DECIMAL).scale(r),o=f.scale.XY.scale(r).scale(f.box$1.DECIMAL),i=await n.findByXDecimal(o.x.pos(this.state.position.x)),{draw:a}=this.internal,l=i.reduce((h,d)=>h+d.position.x,0)/i.length,c=s.x.pos(l);if(!f.bounds.contains(f.box$1.xBounds(r),c))return;a.rule({stroke:this.state.ruleColor,lineWidth:this.state.ruleStrokeWidth,lineDash:this.state.ruleStrokeDash,direction:"y",region:r,position:c}),i.forEach(h=>{const d=s.pos(h.position);a.circle({fill:h.color.setAlpha(.5),radius:8,position:d}),a.circle({fill:h.color.setAlpha(.8),radius:5,position:d}),a.circle({fill:h.color.pickByContrast(this.internal.dotColor,this.internal.dotColorContrast),radius:2,position:d})});const u=i.map(h=>`${h.label??""}: ${h.value.y.toFixed(2)}`);a.textContainer({text:u,backgroundColor:this.state.backgroundColor,borderColor:this.state.borderColor,position:f.xy.translate(this.state.position,[10,10]),direction:"y",level:"small",spacing:1})}}y(Xe,"TYPE","tooltip");const Hc={[Xe.TYPE]:Xe},Qp=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:Hc,Tooltip:Xe,tooltipStateZ:Fo},Symbol.toStringTag,{value:"Module"})),Uo=P.z.object({one:f.xy.xy.nullable(),two:f.xy.xy.nullable(),hover:f.xy.xy.nullable(),color:P.z.union([f.Color.z,P.z.object({verticalLine:f.Color.z.optional().default(f.ZERO),horizontalLine:f.Color.z.optional().default(f.ZERO),obliqueLine:f.Color.z.optional().default(f.ZERO)})]).optional().default(f.ZERO),strokeWidth:P.z.number().optional().default(1),strokeDash:P.z.number().optional().default(2)});class We extends Z.Leaf{constructor(){super(...arguments);y(this,"schema",Uo)}afterUpdate(){const n=gt.use(this.ctx);this.internal.theme=Z.use(this.ctx),this.internal.render=n,this.internal.draw=new ms(n.upper2d,this.internal.theme),xt.requestRender(this.ctx,pe)}afterDelete(){xt.requestRender(this.ctx,$t)}get verticalLineColor(){return this.state.color instanceof f.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 f.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 f.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(n){const{one:r,two:s}=this.state;if(r==null||s==null)return null;const{one:o,two:i}=this.prevState,{dataOne:a,dataTwo:l}=this.internal;if(o!=null&&f.xy.equals(r,o)&&i!=null&&f.xy.equals(s,i)&&a!=null&&l!=null){const[b,v]=[await n.findByXValue(a.x),await n.findByXValue(l.x)];return b.length===0||v.length===0?null:[b.sort((M,C)=>f.xy.distance(a,M.value)-f.xy.distance(a,C.value))[0],v.sort((M,C)=>f.xy.distance(l,M.value)-f.xy.distance(l,C.value))[0]]}const c=f.scale.XY.scale(n.region).scale(f.box$1.DECIMAL),[u,h]=[c.pos(r),c.pos(s)],[d,p]=[await n.findByXDecimal(u.x),await n.findByXDecimal(h.x)];if(d.length===0||p.length===0)return null;const[S,x]=[d.sort((b,v)=>f.xy.distance(u,b.position)-f.xy.distance(u,v.position))[0],p.sort((b,v)=>f.xy.distance(h,b.position)-f.xy.distance(h,v.position))[0]];return this.internal.dataOne=S.value,this.internal.dataTwo=x.value,[S,x]}async renderHover(n){if(this.state.hover==null)return;const r=this.state.hover,s=f.scale.XY.scale(n.region).scale(f.box$1.DECIMAL),o=s.pos(r),i=await n.findByXDecimal(s.pos(r).x);if(i.length===0)return;const a=i.sort((c,u)=>f.xy.distance(o,c.position)-f.xy.distance(o,u.position))[0],{draw:l}=this.internal;l.circle({fill:a.color.setAlpha(.5),radius:9,position:s.reverse().pos(a.position)})}async render(n){if(this.deleted)return;await this.renderHover(n);const r=await this.find(n);if(r==null)return;const[s,o]=r,{draw:i}=this.internal,{strokeDash:a,strokeWidth:l}=this.state,c=f.scale.XY.scale(f.box$1.DECIMAL).scale(n.region),u=c.pos(s.position),h=c.pos(o.position),d=new f.TimeSpan(Math.abs(s.value.x-o.value.x)),p=Math.abs(s.value.y-o.value.y),S=p/d.seconds;i.line({start:f.xy.construct(u.x,u.y),end:f.xy.construct(u.x,h.y),stroke:this.verticalLineColor,lineDash:a,lineWidth:l}),i.textContainer({text:[`${p.toFixed(2)} ${s.units??""}`],direction:"x",position:f.xy.construct(u.x,(u.y+h.y)/2),level:"small"}),i.line({start:f.xy.construct(u.x,h.y),end:f.xy.construct(h.x,h.y),stroke:this.horizontalLineColor,lineDash:a,lineWidth:l}),i.textContainer({text:[d.truncate(f.TimeSpan.MILLISECOND).toString()],direction:"x",position:f.xy.construct((u.x+h.x)/2,h.y),level:"small"}),i.line({start:f.xy.construct(u.x,u.y),end:f.xy.construct(h.x,h.y),stroke:this.obliqueLineColor,lineDash:a,lineWidth:l}),i.textContainer({text:[`${S.toFixed(2)} ${s.units??""} / S`],direction:"x",position:f.xy.construct((u.x+h.x)/2,(u.y+h.y)/2),level:"small"}),i.circle({fill:s.color.setAlpha(.5),radius:8,position:u}),i.circle({fill:s.color.setAlpha(.8),radius:5,position:u}),i.circle({fill:new f.Color("#ffffff"),radius:2,position:u}),i.circle({fill:o.color.setAlpha(.5),radius:8,position:h}),i.circle({fill:o.color.setAlpha(.8),radius:5,position:h}),i.circle({fill:new f.Color("#ffffff"),radius:2,position:h})}}y(We,"TYPE","measure");const Vc={[We.TYPE]:We},Jp=Object.freeze(Object.defineProperty({__proto__:null,Measure:We,REGISTRY:Vc,measureStateZ:Uo},Symbol.toStringTag,{value:"Module"})),qc=P.z.object({container:f.box$1.box,viewport:f.box$1.box,hold:P.z.boolean().optional().default(!1),grid:P.z.array(lf),clearOverscan:f.xy.crudeZ});class Ir extends Z.Composite{constructor(){super(...arguments);y(this,"eraser",new Xn);y(this,"schema",qc)}afterUpdate(){this.internal.instrumentation=qn(this.ctx,"lineplot"),this.internal.aggregate=Z.useAggregate(this.ctx),this.internal.renderCtx=gt.use(this.ctx),xt.control(this.ctx,n=>this.requestRender("low",n)),this.requestRender("high",$t)}afterDelete(){this.internal.renderCtx=gt.use(this.ctx),this.requestRender("high",$t)}async findByXDecimal(n){const r={...this.state,plot:this.calculatePlot()},s=this.axes.flatMap(async o=>await o.findByXDecimal(r,n));return(await Promise.all(s)).flat()}async findByXValue(n){const r={...this.state,plot:this.calculatePlot()},s=this.axes.flatMap(async o=>await o.findByXValue(r,n));return(await Promise.all(s)).flat()}get axes(){return this.childrenOfType(Ln.TYPE)}get tooltips(){return this.childrenOfType(Xe.TYPE)}get measures(){return this.childrenOfType(We.TYPE)}async renderAxes(n,r){const s={...this.state,plot:n,canvases:r};await Promise.all(this.axes.map(async o=>await o.render(s)))}async renderTooltips(n,r){const s={findByXDecimal:this.findByXDecimal.bind(this),region:n,canvases:r};await Promise.all(this.tooltips.map(async o=>await o.render(s)))}async renderMeasures(n,r){const s={findByXDecimal:this.findByXDecimal.bind(this),findByXValue:this.findByXValue.bind(this),region:n,canvases:r};await Promise.all(this.measures.map(async o=>await o.render(s)))}calculatePlot(){return hf(this.state.grid,this.state.container)}async render(n){const{instrumentation:r}=this.internal;if(this.deleted){r.L.debug("deleted, skipping render",{key:this.key});return}const s=this.calculatePlot();r.L.debug("rendering",{key:this.key,viewport:this.state.viewport,container:this.state.container,grid:this.state.grid,plot:s,canvases:n});const{renderCtx:o}=this.internal,i=f.xy.construct(this.state.clearOverscan),a=o.scissor(this.state.container,i,n.filter(c=>c!=="gl")),l=o.scissor(s,f.xy.ZERO,n.filter(c=>c==="gl"));try{await this.renderAxes(s,n),await this.renderTooltips(s,n),await this.renderMeasures(s,n),o.gl.flush()}catch(c){this.internal.aggregate({variant:"error",message:c.message})}finally{a(),l()}return({canvases:c})=>{this.eraser.erase(o,this.state.container,this.prevState.container,this.state.clearOverscan,c)}}requestRender(n,r){const{renderCtx:s}=this.internal;let o=["upper2d","lower2d","gl"];r===pe&&(o=["upper2d"]),s.loop.set({key:`${this.type}-${this.key}`,render:async()=>await this.render(o),priority:n,canvases:o})}}y(Ir,"TYPE","LinePlot");const tg={[Ir.TYPE]:Ir,[Ln.TYPE]:Ln,[Lr.TYPE]:Lr},Xc=P.z.object({region:f.box$1.box});class Br extends Z.Leaf{constructor(){super(...arguments);y(this,"schema",Xc);y(this,"eraser",new Xn)}afterUpdate(){this.internal.render=gt.use(this.ctx),this.internal.render.loop.set({key:`${this.type}-${this.key}`,render:this.render.bind(this),priority:"high",canvases:["gl","lower2d","upper2d"]})}async render(){return async({canvases:n})=>{this.eraser.erase(this.internal.render,this.state.region,this.prevState.region,f.xy.construct(0),n)}}}y(Br,"TYPE","eraser");const eg={[Br.TYPE]:Br};function vt(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n<t.length;n++)(r=vt(t[n]))!==""&&(e+=(e&&" ")+r);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var io={exports:{}},zs={},sr={exports:{}},Ys={};/**
|
|
37
|
+
* @license React
|
|
38
|
+
* use-sync-external-store-shim.development.js
|
|
39
|
+
*
|
|
40
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
41
|
+
*
|
|
42
|
+
* This source code is licensed under the MIT license found in the
|
|
43
|
+
* LICENSE file in the root directory of this source tree.
|
|
44
|
+
*/var Gi;function ng(){return Gi||(Gi=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=m,e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(C){{for(var w=arguments.length,N=new Array(w>1?w-1:0),E=1;E<w;E++)N[E-1]=arguments[E];r("error",C,N)}}function r(C,w,N){{var E=e.ReactDebugCurrentFrame,A=E.getStackAddendum();A!==""&&(w+="%s",N=N.concat([A]));var O=N.map(function(Y){return String(Y)});O.unshift("Warning: "+w),Function.prototype.apply.call(console[C],console,O)}}function s(C,w){return C===w&&(C!==0||1/C===1/w)||C!==C&&w!==w}var o=typeof Object.is=="function"?Object.is:s,i=t.useState,a=t.useEffect,l=t.useLayoutEffect,c=t.useDebugValue,u=!1,h=!1;function d(C,w,N){u||t.startTransition!==void 0&&(u=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var E=w();if(!h){var A=w();o(E,A)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),h=!0)}var O=i({inst:{value:E,getSnapshot:w}}),Y=O[0].inst,H=O[1];return l(function(){Y.value=E,Y.getSnapshot=w,p(Y)&&H({inst:Y})},[C,E,w]),a(function(){p(Y)&&H({inst:Y});var D=function(){p(Y)&&H({inst:Y})};return C(D)},[C]),c(E),E}function p(C){var w=C.getSnapshot,N=C.value;try{var E=w();return!o(N,E)}catch{return!0}}function S(C,w,N){return w()}var x=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",b=!x,v=b?S:d,M=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:v;Ys.useSyncExternalStore=M,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Ys}var Ls={};/**
|
|
45
|
+
* @license React
|
|
46
|
+
* use-sync-external-store-shim.production.min.js
|
|
47
|
+
*
|
|
48
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
49
|
+
*
|
|
50
|
+
* This source code is licensed under the MIT license found in the
|
|
51
|
+
* LICENSE file in the root directory of this source tree.
|
|
52
|
+
*/var Ki;function rg(){if(Ki)return Ls;Ki=1;var t=m;function e(h,d){return h===d&&(h!==0||1/h===1/d)||h!==h&&d!==d}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,o=t.useLayoutEffect,i=t.useDebugValue;function a(h,d){var p=d(),S=r({inst:{value:p,getSnapshot:d}}),x=S[0].inst,b=S[1];return o(function(){x.value=p,x.getSnapshot=d,l(x)&&b({inst:x})},[h,p,d]),s(function(){return l(x)&&b({inst:x}),h(function(){l(x)&&b({inst:x})})},[h]),i(p),p}function l(h){var d=h.getSnapshot;h=h.value;try{var p=d();return!n(h,p)}catch{return!0}}function c(h,d){return d()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Ls.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Ls}var ji;function Wc(){return ji||(ji=1,process.env.NODE_ENV==="production"?sr.exports=rg():sr.exports=ng()),sr.exports}/**
|
|
53
|
+
* @license React
|
|
54
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
55
|
+
*
|
|
56
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
57
|
+
*
|
|
58
|
+
* This source code is licensed under the MIT license found in the
|
|
59
|
+
* LICENSE file in the root directory of this source tree.
|
|
60
|
+
*/var Qi;function sg(){return Qi||(Qi=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=m,e=Wc();function n(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var r=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,o=t.useRef,i=t.useEffect,a=t.useMemo,l=t.useDebugValue;function c(u,h,d,p,S){var x=o(null),b;x.current===null?(b={hasValue:!1,value:null},x.current=b):b=x.current;var v=a(function(){var N=!1,E,A,O=function(U){if(!N){N=!0,E=U;var R=p(U);if(S!==void 0&&b.hasValue){var g=b.value;if(S(g,R))return A=g,g}return A=R,R}var k=E,_=A;if(r(k,U))return _;var z=p(U);return S!==void 0&&S(_,z)?_:(E=U,A=z,z)},Y=d===void 0?null:d,H=function(){return O(h())},D=Y===null?void 0:function(){return O(Y())};return[H,D]},[h,d,p,S]),M=v[0],C=v[1],w=s(u,M,C);return i(function(){b.hasValue=!0,b.value=w},[w]),l(w),w}zs.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),zs}var Is={};/**
|
|
61
|
+
* @license React
|
|
62
|
+
* use-sync-external-store-shim/with-selector.production.min.js
|
|
63
|
+
*
|
|
64
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
65
|
+
*
|
|
66
|
+
* This source code is licensed under the MIT license found in the
|
|
67
|
+
* LICENSE file in the root directory of this source tree.
|
|
68
|
+
*/var Ji;function og(){if(Ji)return Is;Ji=1;var t=m,e=Wc();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,o=t.useRef,i=t.useEffect,a=t.useMemo,l=t.useDebugValue;return Is.useSyncExternalStoreWithSelector=function(c,u,h,d,p){var S=o(null);if(S.current===null){var x={hasValue:!1,value:null};S.current=x}else x=S.current;S=a(function(){function v(E){if(!M){if(M=!0,C=E,E=d(E),p!==void 0&&x.hasValue){var A=x.value;if(p(A,E))return w=A}return w=E}if(A=w,r(C,E))return A;var O=d(E);return p!==void 0&&p(A,O)?A:(C=E,w=O)}var M=!1,C,w,N=h===void 0?null:h;return[function(){return v(u())},N===null?void 0:function(){return v(N())}]},[u,h,d,p]);var b=s(c,S[0],S[1]);return i(function(){x.hasValue=!0,x.value=b},[b]),l(b),b},Is}process.env.NODE_ENV==="production"?io.exports=og():io.exports=sg();var ig=io.exports;const ag=Z.getDefaultExportFromCjs(ig);var cg={BASE_URL:"/pluto/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const ta=t=>{let e;const n=new Set,r=(l,c)=>{const u=typeof l=="function"?l(e):l;if(!Object.is(u,e)){const h=e;e=c??(typeof u!="object"||u===null)?u:Object.assign({},e,u),n.forEach(d=>d(e,h))}},s=()=>e,a={setState:r,getState:s,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{(cg?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return e=t(r,s,a),a},lg=t=>t?ta(t):ta,{useDebugValue:ug}=m,{useSyncExternalStoreWithSelector:hg}=ag;function Gc(t,e=t.getState,n){const r=hg(t.subscribe,t.getState,t.getServerState||t.getState,e,n);return ug(r),r}const ea=(t,e)=>{const n=lg(t),r=(s,o=e)=>Gc(n,s,o);return Object.assign(r,n),r},fg=(t,e)=>t?ea(t,e):ea;function pt(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,s]of t)if(!Object.is(s,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(e,n[r])||!Object.is(t[n[r]],e[n[r]]))return!1;return!0}var dg={value:()=>{}};function ys(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new fr(n)}function fr(t){this._=t}function pg(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}fr.prototype=ys.prototype={constructor:fr,on:function(t,e){var n=this._,r=pg(t+"",n),s,o=-1,i=r.length;if(arguments.length<2){for(;++o<i;)if((s=(t=r[o]).type)&&(s=gg(n[s],t.name)))return s;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<i;)if(s=(t=r[o]).type)n[s]=na(n[s],t.name,e);else if(e==null)for(s in n)n[s]=na(n[s],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new fr(t)},call:function(t,e){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,o;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],r=0,s=o.length;r<s;++r)o[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],s=0,o=r.length;s<o;++s)r[s].value.apply(e,n)}};function gg(t,e){for(var n=0,r=t.length,s;n<r;++n)if((s=t[n]).name===e)return s.value}function na(t,e,n){for(var r=0,s=t.length;r<s;++r)if(t[r].name===e){t[r]=dg,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var ao="http://www.w3.org/1999/xhtml";const ra={svg:"http://www.w3.org/2000/svg",xhtml:ao,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function xs(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),ra.hasOwnProperty(e)?{space:ra[e],local:t}:t}function mg(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===ao&&e.documentElement.namespaceURI===ao?e.createElement(t):e.createElementNS(n,t)}}function yg(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Kc(t){var e=xs(t);return(e.local?yg:mg)(e)}function xg(){}function Zo(t){return t==null?xg:function(){return this.querySelector(t)}}function wg(t){typeof t!="function"&&(t=Zo(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var o=e[s],i=o.length,a=r[s]=new Array(i),l,c,u=0;u<i;++u)(l=o[u])&&(c=t.call(l,l.__data__,u,o))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new wt(r,this._parents)}function Sg(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function vg(){return[]}function jc(t){return t==null?vg:function(){return this.querySelectorAll(t)}}function bg(t){return function(){return Sg(t.apply(this,arguments))}}function Eg(t){typeof t=="function"?t=bg(t):t=jc(t);for(var e=this._groups,n=e.length,r=[],s=[],o=0;o<n;++o)for(var i=e[o],a=i.length,l,c=0;c<a;++c)(l=i[c])&&(r.push(t.call(l,l.__data__,c,i)),s.push(l));return new wt(r,s)}function Qc(t){return function(){return this.matches(t)}}function Jc(t){return function(e){return e.matches(t)}}var Tg=Array.prototype.find;function _g(t){return function(){return Tg.call(this.children,t)}}function Cg(){return this.firstElementChild}function Pg(t){return this.select(t==null?Cg:_g(typeof t=="function"?t:Jc(t)))}var Mg=Array.prototype.filter;function Rg(){return Array.from(this.children)}function kg(t){return function(){return Mg.call(this.children,t)}}function Ng(t){return this.selectAll(t==null?Rg:kg(typeof t=="function"?t:Jc(t)))}function Ag(t){typeof t!="function"&&(t=Qc(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var o=e[s],i=o.length,a=r[s]=[],l,c=0;c<i;++c)(l=o[c])&&t.call(l,l.__data__,c,o)&&a.push(l);return new wt(r,this._parents)}function tl(t){return new Array(t.length)}function Dg(){return new wt(this._enter||this._groups.map(tl),this._parents)}function Fr(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Fr.prototype={constructor:Fr,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function $g(t){return function(){return t}}function Og(t,e,n,r,s,o){for(var i=0,a,l=e.length,c=o.length;i<c;++i)(a=e[i])?(a.__data__=o[i],r[i]=a):n[i]=new Fr(t,o[i]);for(;i<l;++i)(a=e[i])&&(s[i]=a)}function zg(t,e,n,r,s,o,i){var a,l,c=new Map,u=e.length,h=o.length,d=new Array(u),p;for(a=0;a<u;++a)(l=e[a])&&(d[a]=p=i.call(l,l.__data__,a,e)+"",c.has(p)?s[a]=l:c.set(p,l));for(a=0;a<h;++a)p=i.call(t,o[a],a,o)+"",(l=c.get(p))?(r[a]=l,l.__data__=o[a],c.delete(p)):n[a]=new Fr(t,o[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(d[a])===l&&(s[a]=l)}function Yg(t){return t.__data__}function Lg(t,e){if(!arguments.length)return Array.from(this,Yg);var n=e?zg:Og,r=this._parents,s=this._groups;typeof t!="function"&&(t=$g(t));for(var o=s.length,i=new Array(o),a=new Array(o),l=new Array(o),c=0;c<o;++c){var u=r[c],h=s[c],d=h.length,p=Ig(t.call(u,u&&u.__data__,c,r)),S=p.length,x=a[c]=new Array(S),b=i[c]=new Array(S),v=l[c]=new Array(d);n(u,h,x,b,v,p,e);for(var M=0,C=0,w,N;M<S;++M)if(w=x[M]){for(M>=C&&(C=M+1);!(N=b[C])&&++C<S;);w._next=N||null}}return i=new wt(i,r),i._enter=a,i._exit=l,i}function Ig(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Bg(){return new wt(this._exit||this._groups.map(tl),this._parents)}function Fg(t,e,n){var r=this.enter(),s=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(s=e(s),s&&(s=s.selection())),n==null?o.remove():n(o),r&&s?r.merge(s).order():s}function Ug(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,s=n.length,o=r.length,i=Math.min(s,o),a=new Array(s),l=0;l<i;++l)for(var c=n[l],u=r[l],h=c.length,d=a[l]=new Array(h),p,S=0;S<h;++S)(p=c[S]||u[S])&&(d[S]=p);for(;l<s;++l)a[l]=n[l];return new wt(a,this._parents)}function Zg(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],s=r.length-1,o=r[s],i;--s>=0;)(i=r[s])&&(o&&i.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(i,o),o=i);return this}function Hg(t){t||(t=Vg);function e(h,d){return h&&d?t(h.__data__,d.__data__):!h-!d}for(var n=this._groups,r=n.length,s=new Array(r),o=0;o<r;++o){for(var i=n[o],a=i.length,l=s[o]=new Array(a),c,u=0;u<a;++u)(c=i[u])&&(l[u]=c);l.sort(e)}return new wt(s,this._parents).order()}function Vg(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function qg(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Xg(){return Array.from(this)}function Wg(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],s=0,o=r.length;s<o;++s){var i=r[s];if(i)return i}return null}function Gg(){let t=0;for(const e of this)++t;return t}function Kg(){return!this.node()}function jg(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var s=e[n],o=0,i=s.length,a;o<i;++o)(a=s[o])&&t.call(a,a.__data__,o,s);return this}function Qg(t){return function(){this.removeAttribute(t)}}function Jg(t){return function(){this.removeAttributeNS(t.space,t.local)}}function tm(t,e){return function(){this.setAttribute(t,e)}}function em(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function nm(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function rm(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function sm(t,e){var n=xs(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?Jg:Qg:typeof e=="function"?n.local?rm:nm:n.local?em:tm)(n,e))}function el(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function om(t){return function(){this.style.removeProperty(t)}}function im(t,e,n){return function(){this.style.setProperty(t,e,n)}}function am(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function cm(t,e,n){return arguments.length>1?this.each((e==null?om:typeof e=="function"?am:im)(t,e,n??"")):Ge(this.node(),t)}function Ge(t,e){return t.style.getPropertyValue(e)||el(t).getComputedStyle(t,null).getPropertyValue(e)}function lm(t){return function(){delete this[t]}}function um(t,e){return function(){this[t]=e}}function hm(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function fm(t,e){return arguments.length>1?this.each((e==null?lm:typeof e=="function"?hm:um)(t,e)):this.node()[t]}function nl(t){return t.trim().split(/^|\s+/)}function Ho(t){return t.classList||new rl(t)}function rl(t){this._node=t,this._names=nl(t.getAttribute("class")||"")}rl.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function sl(t,e){for(var n=Ho(t),r=-1,s=e.length;++r<s;)n.add(e[r])}function ol(t,e){for(var n=Ho(t),r=-1,s=e.length;++r<s;)n.remove(e[r])}function dm(t){return function(){sl(this,t)}}function pm(t){return function(){ol(this,t)}}function gm(t,e){return function(){(e.apply(this,arguments)?sl:ol)(this,t)}}function mm(t,e){var n=nl(t+"");if(arguments.length<2){for(var r=Ho(this.node()),s=-1,o=n.length;++s<o;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof e=="function"?gm:e?dm:pm)(n,e))}function ym(){this.textContent=""}function xm(t){return function(){this.textContent=t}}function wm(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Sm(t){return arguments.length?this.each(t==null?ym:(typeof t=="function"?wm:xm)(t)):this.node().textContent}function vm(){this.innerHTML=""}function bm(t){return function(){this.innerHTML=t}}function Em(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Tm(t){return arguments.length?this.each(t==null?vm:(typeof t=="function"?Em:bm)(t)):this.node().innerHTML}function _m(){this.nextSibling&&this.parentNode.appendChild(this)}function Cm(){return this.each(_m)}function Pm(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Mm(){return this.each(Pm)}function Rm(t){var e=typeof t=="function"?t:Kc(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function km(){return null}function Nm(t,e){var n=typeof t=="function"?t:Kc(t),r=e==null?km:typeof e=="function"?e:Zo(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Am(){var t=this.parentNode;t&&t.removeChild(this)}function Dm(){return this.each(Am)}function $m(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Om(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function zm(t){return this.select(t?Om:$m)}function Ym(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Lm(t){return function(e){t.call(this,e,this.__data__)}}function Im(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function Bm(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,s=e.length,o;n<s;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++r]=o;++r?e.length=r:delete this.__on}}}function Fm(t,e,n){return function(){var r=this.__on,s,o=Lm(e);if(r){for(var i=0,a=r.length;i<a;++i)if((s=r[i]).type===t.type&&s.name===t.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=o,s.options=n),s.value=e;return}}this.addEventListener(t.type,o,n),s={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(s):this.__on=[s]}}function Um(t,e,n){var r=Im(t+""),s,o=r.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(s=0,u=a[l];s<o;++s)if((i=r[s]).type===u.type&&i.name===u.name)return u.value}return}for(a=e?Fm:Bm,s=0;s<o;++s)this.each(a(r[s],e,n));return this}function il(t,e,n){var r=el(t),s=r.CustomEvent;typeof s=="function"?s=new s(e,n):(s=r.document.createEvent("Event"),n?(s.initEvent(e,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(e,!1,!1)),t.dispatchEvent(s)}function Zm(t,e){return function(){return il(this,t,e)}}function Hm(t,e){return function(){return il(this,t,e.apply(this,arguments))}}function Vm(t,e){return this.each((typeof e=="function"?Hm:Zm)(t,e))}function*qm(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],s=0,o=r.length,i;s<o;++s)(i=r[s])&&(yield i)}var al=[null];function wt(t,e){this._groups=t,this._parents=e}function jn(){return new wt([[document.documentElement]],al)}function Xm(){return this}wt.prototype=jn.prototype={constructor:wt,select:wg,selectAll:Eg,selectChild:Pg,selectChildren:Ng,filter:Ag,data:Lg,enter:Dg,exit:Bg,join:Fg,merge:Ug,selection:Xm,order:Zg,sort:Hg,call:qg,nodes:Xg,node:Wg,size:Gg,empty:Kg,each:jg,attr:sm,style:cm,property:fm,classed:mm,text:Sm,html:Tm,raise:Cm,lower:Mm,append:Rm,insert:Nm,remove:Dm,clone:zm,datum:Ym,on:Um,dispatch:Vm,[Symbol.iterator]:qm};function Pt(t){return typeof t=="string"?new wt([[document.querySelector(t)]],[document.documentElement]):new wt([[t]],al)}function Wm(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Nt(t,e){if(t=Wm(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}}return[t.pageX,t.pageY]}const Gm={passive:!1},In={capture:!0,passive:!1};function Bs(t){t.stopImmediatePropagation()}function Oe(t){t.preventDefault(),t.stopImmediatePropagation()}function cl(t){var e=t.document.documentElement,n=Pt(t).on("dragstart.drag",Oe,In);"onselectstart"in e?n.on("selectstart.drag",Oe,In):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function ll(t,e){var n=t.document.documentElement,r=Pt(t).on("dragstart.drag",null);e&&(r.on("click.drag",Oe,In),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const or=t=>()=>t;function co(t,{sourceEvent:e,subject:n,target:r,identifier:s,active:o,x:i,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}co.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Km(t){return!t.ctrlKey&&!t.button}function jm(){return this.parentNode}function Qm(t,e){return e??{x:t.x,y:t.y}}function Jm(){return navigator.maxTouchPoints||"ontouchstart"in this}function ty(){var t=Km,e=jm,n=Qm,r=Jm,s={},o=ys("start","drag","end"),i=0,a,l,c,u,h=0;function d(w){w.on("mousedown.drag",p).filter(r).on("touchstart.drag",b).on("touchmove.drag",v,Gm).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,N){if(!(u||!t.call(this,w,N))){var E=C(this,e.call(this,w,N),w,N,"mouse");E&&(Pt(w.view).on("mousemove.drag",S,In).on("mouseup.drag",x,In),cl(w.view),Bs(w),c=!1,a=w.clientX,l=w.clientY,E("start",w))}}function S(w){if(Oe(w),!c){var N=w.clientX-a,E=w.clientY-l;c=N*N+E*E>h}s.mouse("drag",w)}function x(w){Pt(w.view).on("mousemove.drag mouseup.drag",null),ll(w.view,c),Oe(w),s.mouse("end",w)}function b(w,N){if(t.call(this,w,N)){var E=w.changedTouches,A=e.call(this,w,N),O=E.length,Y,H;for(Y=0;Y<O;++Y)(H=C(this,A,w,N,E[Y].identifier,E[Y]))&&(Bs(w),H("start",w,E[Y]))}}function v(w){var N=w.changedTouches,E=N.length,A,O;for(A=0;A<E;++A)(O=s[N[A].identifier])&&(Oe(w),O("drag",w,N[A]))}function M(w){var N=w.changedTouches,E=N.length,A,O;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),A=0;A<E;++A)(O=s[N[A].identifier])&&(Bs(w),O("end",w,N[A]))}function C(w,N,E,A,O,Y){var H=o.copy(),D=Nt(Y||E,N),U,R,g;if((g=n.call(w,new co("beforestart",{sourceEvent:E,target:d,identifier:O,active:i,x:D[0],y:D[1],dx:0,dy:0,dispatch:H}),A))!=null)return U=g.x-D[0]||0,R=g.y-D[1]||0,function k(_,z,I){var T=D,$;switch(_){case"start":s[O]=k,$=i++;break;case"end":delete s[O],--i;case"drag":D=Nt(I||z,N),$=i;break}H.call(_,w,new co(_,{sourceEvent:z,subject:g,target:d,identifier:O,active:$,x:D[0]+U,y:D[1]+R,dx:D[0]-T[0],dy:D[1]-T[1],dispatch:H}),A)}}return d.filter=function(w){return arguments.length?(t=typeof w=="function"?w:or(!!w),d):t},d.container=function(w){return arguments.length?(e=typeof w=="function"?w:or(w),d):e},d.subject=function(w){return arguments.length?(n=typeof w=="function"?w:or(w),d):n},d.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:or(!!w),d):r},d.on=function(){var w=o.on.apply(o,arguments);return w===o?d:w},d.clickDistance=function(w){return arguments.length?(h=(w=+w)*w,d):Math.sqrt(h)},d}var Ke=0,mn=0,un=0,ul=1e3,Ur,yn,Zr=0,ye=0,ws=0,Bn=typeof performance=="object"&&performance.now?performance:Date,hl=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Vo(){return ye||(hl(ey),ye=Bn.now()+ws)}function ey(){ye=0}function Hr(){this._call=this._time=this._next=null}Hr.prototype=fl.prototype={constructor:Hr,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Vo():+n)+(e==null?0:+e),!this._next&&yn!==this&&(yn?yn._next=this:Ur=this,yn=this),this._call=t,this._time=n,lo()},stop:function(){this._call&&(this._call=null,this._time=1/0,lo())}};function fl(t,e,n){var r=new Hr;return r.restart(t,e,n),r}function ny(){Vo(),++Ke;for(var t=Ur,e;t;)(e=ye-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ke}function sa(){ye=(Zr=Bn.now())+ws,Ke=mn=0;try{ny()}finally{Ke=0,sy(),ye=0}}function ry(){var t=Bn.now(),e=t-Zr;e>ul&&(ws-=e,Zr=t)}function sy(){for(var t,e=Ur,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ur=n);yn=t,lo(r)}function lo(t){if(!Ke){mn&&(mn=clearTimeout(mn));var e=t-ye;e>24?(t<1/0&&(mn=setTimeout(sa,t-Bn.now()-ws)),un&&(un=clearInterval(un))):(un||(Zr=Bn.now(),un=setInterval(ry,ul)),Ke=1,hl(sa))}}function oa(t,e,n){var r=new Hr;return e=e==null?0:+e,r.restart(s=>{r.stop(),t(s+e)},e,n),r}var oy=ys("start","end","cancel","interrupt"),iy=[],dl=0,ia=1,uo=2,dr=3,aa=4,ho=5,pr=6;function Ss(t,e,n,r,s,o){var i=t.__transition;if(!i)t.__transition={};else if(n in i)return;ay(t,n,{name:e,index:r,group:s,on:oy,tween:iy,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:dl})}function qo(t,e){var n=Mt(t,e);if(n.state>dl)throw new Error("too late; already scheduled");return n}function Ot(t,e){var n=Mt(t,e);if(n.state>dr)throw new Error("too late; already running");return n}function Mt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function ay(t,e,n){var r=t.__transition,s;r[e]=n,n.timer=fl(o,0,n.time);function o(c){n.state=ia,n.timer.restart(i,n.delay,n.time),n.delay<=c&&i(c-n.delay)}function i(c){var u,h,d,p;if(n.state!==ia)return l();for(u in r)if(p=r[u],p.name===n.name){if(p.state===dr)return oa(i);p.state===aa?(p.state=pr,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete r[u]):+u<e&&(p.state=pr,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete r[u])}if(oa(function(){n.state===dr&&(n.state=aa,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=uo,n.on.call("start",t,t.__data__,n.index,n.group),n.state===uo){for(n.state=dr,s=new Array(d=n.tween.length),u=0,h=-1;u<d;++u)(p=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(s[++h]=p);s.length=h+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=ho,1),h=-1,d=s.length;++h<d;)s[h].call(t,u);n.state===ho&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){n.state=pr,n.timer.stop(),delete r[e];for(var c in r)return;delete t.__transition}}function gr(t,e){var n=t.__transition,r,s,o=!0,i;if(n){e=e==null?null:e+"";for(i in n){if((r=n[i]).name!==e){o=!1;continue}s=r.state>uo&&r.state<ho,r.state=pr,r.timer.stop(),r.on.call(s?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[i]}o&&delete t.__transition}}function cy(t){return this.each(function(){gr(this,t)})}function ly(t,e){var n,r;return function(){var s=Ot(this,t),o=s.tween;if(o!==n){r=n=o;for(var i=0,a=r.length;i<a;++i)if(r[i].name===e){r=r.slice(),r.splice(i,1);break}}s.tween=r}}function uy(t,e,n){var r,s;if(typeof n!="function")throw new Error;return function(){var o=Ot(this,t),i=o.tween;if(i!==r){s=(r=i).slice();for(var a={name:e,value:n},l=0,c=s.length;l<c;++l)if(s[l].name===e){s[l]=a;break}l===c&&s.push(a)}o.tween=s}}function hy(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=Mt(this.node(),n).tween,s=0,o=r.length,i;s<o;++s)if((i=r[s]).name===t)return i.value;return null}return this.each((e==null?ly:uy)(n,t,e))}function Xo(t,e,n){var r=t._id;return t.each(function(){var s=Ot(this,r);(s.value||(s.value={}))[e]=n.apply(this,arguments)}),function(s){return Mt(s,r).value[e]}}function pl(t,e){var n;return(typeof e=="number"?_t:e instanceof ge?Ar:(n=ge(e))?(e=n,Ar):wc)(t,e)}function fy(t){return function(){this.removeAttribute(t)}}function dy(t){return function(){this.removeAttributeNS(t.space,t.local)}}function py(t,e,n){var r,s=n+"",o;return function(){var i=this.getAttribute(t);return i===s?null:i===r?o:o=e(r=i,n)}}function gy(t,e,n){var r,s=n+"",o;return function(){var i=this.getAttributeNS(t.space,t.local);return i===s?null:i===r?o:o=e(r=i,n)}}function my(t,e,n){var r,s,o;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(t):(i=this.getAttribute(t),l=a+"",i===l?null:i===r&&l===s?o:(s=l,o=e(r=i,a)))}}function yy(t,e,n){var r,s,o;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(t.space,t.local):(i=this.getAttributeNS(t.space,t.local),l=a+"",i===l?null:i===r&&l===s?o:(s=l,o=e(r=i,a)))}}function xy(t,e){var n=xs(t),r=n==="transform"?Wf:pl;return this.attrTween(t,typeof e=="function"?(n.local?yy:my)(n,r,Xo(this,"attr."+t,e)):e==null?(n.local?dy:fy)(n):(n.local?gy:py)(n,r,e))}function wy(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Sy(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function vy(t,e){var n,r;function s(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Sy(t,o)),n}return s._value=e,s}function by(t,e){var n,r;function s(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&wy(t,o)),n}return s._value=e,s}function Ey(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=xs(t);return this.tween(n,(r.local?vy:by)(r,e))}function Ty(t,e){return function(){qo(this,t).delay=+e.apply(this,arguments)}}function _y(t,e){return e=+e,function(){qo(this,t).delay=e}}function Cy(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Ty:_y)(e,t)):Mt(this.node(),e).delay}function Py(t,e){return function(){Ot(this,t).duration=+e.apply(this,arguments)}}function My(t,e){return e=+e,function(){Ot(this,t).duration=e}}function Ry(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Py:My)(e,t)):Mt(this.node(),e).duration}function ky(t,e){if(typeof e!="function")throw new Error;return function(){Ot(this,t).ease=e}}function Ny(t){var e=this._id;return arguments.length?this.each(ky(e,t)):Mt(this.node(),e).ease}function Ay(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;Ot(this,t).ease=n}}function Dy(t){if(typeof t!="function")throw new Error;return this.each(Ay(this._id,t))}function $y(t){typeof t!="function"&&(t=Qc(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var o=e[s],i=o.length,a=r[s]=[],l,c=0;c<i;++c)(l=o[c])&&t.call(l,l.__data__,c,o)&&a.push(l);return new Vt(r,this._parents,this._name,this._id)}function Oy(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,s=n.length,o=Math.min(r,s),i=new Array(r),a=0;a<o;++a)for(var l=e[a],c=n[a],u=l.length,h=i[a]=new Array(u),d,p=0;p<u;++p)(d=l[p]||c[p])&&(h[p]=d);for(;a<r;++a)i[a]=e[a];return new Vt(i,this._parents,this._name,this._id)}function zy(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function Yy(t,e,n){var r,s,o=zy(e)?qo:Ot;return function(){var i=o(this,t),a=i.on;a!==r&&(s=(r=a).copy()).on(e,n),i.on=s}}function Ly(t,e){var n=this._id;return arguments.length<2?Mt(this.node(),n).on.on(t):this.each(Yy(n,t,e))}function Iy(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function By(){return this.on("end.remove",Iy(this._id))}function Fy(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Zo(t));for(var r=this._groups,s=r.length,o=new Array(s),i=0;i<s;++i)for(var a=r[i],l=a.length,c=o[i]=new Array(l),u,h,d=0;d<l;++d)(u=a[d])&&(h=t.call(u,u.__data__,d,a))&&("__data__"in u&&(h.__data__=u.__data__),c[d]=h,Ss(c[d],e,n,d,c,Mt(u,n)));return new Vt(o,this._parents,e,n)}function Uy(t){var e=this._name,n=this._id;typeof t!="function"&&(t=jc(t));for(var r=this._groups,s=r.length,o=[],i=[],a=0;a<s;++a)for(var l=r[a],c=l.length,u,h=0;h<c;++h)if(u=l[h]){for(var d=t.call(u,u.__data__,h,l),p,S=Mt(u,n),x=0,b=d.length;x<b;++x)(p=d[x])&&Ss(p,e,n,x,d,S);o.push(d),i.push(u)}return new Vt(o,i,e,n)}var Zy=jn.prototype.constructor;function Hy(){return new Zy(this._groups,this._parents)}function Vy(t,e){var n,r,s;return function(){var o=Ge(this,t),i=(this.style.removeProperty(t),Ge(this,t));return o===i?null:o===n&&i===r?s:s=e(n=o,r=i)}}function gl(t){return function(){this.style.removeProperty(t)}}function qy(t,e,n){var r,s=n+"",o;return function(){var i=Ge(this,t);return i===s?null:i===r?o:o=e(r=i,n)}}function Xy(t,e,n){var r,s,o;return function(){var i=Ge(this,t),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(t),Ge(this,t))),i===l?null:i===r&&l===s?o:(s=l,o=e(r=i,a))}}function Wy(t,e){var n,r,s,o="style."+e,i="end."+o,a;return function(){var l=Ot(this,t),c=l.on,u=l.value[o]==null?a||(a=gl(e)):void 0;(c!==n||s!==u)&&(r=(n=c).copy()).on(i,s=u),l.on=r}}function Gy(t,e,n){var r=(t+="")=="transform"?Xf:pl;return e==null?this.styleTween(t,Vy(t,r)).on("end.style."+t,gl(t)):typeof e=="function"?this.styleTween(t,Xy(t,r,Xo(this,"style."+t,e))).each(Wy(this._id,t)):this.styleTween(t,qy(t,r,e),n).on("end.style."+t,null)}function Ky(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function jy(t,e,n){var r,s;function o(){var i=e.apply(this,arguments);return i!==s&&(r=(s=i)&&Ky(t,i,n)),r}return o._value=e,o}function Qy(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,jy(t,e,n??""))}function Jy(t){return function(){this.textContent=t}}function t0(t){return function(){var e=t(this);this.textContent=e??""}}function e0(t){return this.tween("text",typeof t=="function"?t0(Xo(this,"text",t)):Jy(t==null?"":t+""))}function n0(t){return function(e){this.textContent=t.call(this,e)}}function r0(t){var e,n;function r(){var s=t.apply(this,arguments);return s!==n&&(e=(n=s)&&n0(s)),e}return r._value=t,r}function s0(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,r0(t))}function o0(){for(var t=this._name,e=this._id,n=ml(),r=this._groups,s=r.length,o=0;o<s;++o)for(var i=r[o],a=i.length,l,c=0;c<a;++c)if(l=i[c]){var u=Mt(l,e);Ss(l,t,n,c,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Vt(r,this._parents,t,n)}function i0(){var t,e,n=this,r=n._id,s=n.size();return new Promise(function(o,i){var a={value:i},l={value:function(){--s===0&&o()}};n.each(function(){var c=Ot(this,r),u=c.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),c.on=e}),s===0&&o()})}var a0=0;function Vt(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function ml(){return++a0}var Yt=jn.prototype;Vt.prototype={constructor:Vt,select:Fy,selectAll:Uy,selectChild:Yt.selectChild,selectChildren:Yt.selectChildren,filter:$y,merge:Oy,selection:Hy,transition:o0,call:Yt.call,nodes:Yt.nodes,node:Yt.node,size:Yt.size,empty:Yt.empty,each:Yt.each,on:Ly,attr:xy,attrTween:Ey,style:Gy,styleTween:Qy,text:e0,textTween:s0,remove:By,tween:hy,delay:Cy,duration:Ry,ease:Ny,easeVarying:Dy,end:i0,[Symbol.iterator]:Yt[Symbol.iterator]};function c0(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var l0={time:null,delay:0,duration:250,ease:c0};function u0(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function h0(t){var e,n;t instanceof Vt?(e=t._id,t=t._name):(e=ml(),(n=l0).time=Vo(),t=t==null?null:t+"");for(var r=this._groups,s=r.length,o=0;o<s;++o)for(var i=r[o],a=i.length,l,c=0;c<a;++c)(l=i[c])&&Ss(l,t,e,c,i,n||u0(l,e));return new Vt(r,this._parents,t,e)}jn.prototype.interrupt=cy;jn.prototype.transition=h0;const ir=t=>()=>t;function f0(t,{sourceEvent:e,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function Bt(t,e,n){this.k=t,this.x=e,this.y=n}Bt.prototype={constructor:Bt,scale:function(t){return t===1?this:new Bt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Bt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var jt=new Bt(1,0,0);Bt.prototype;function Fs(t){t.stopImmediatePropagation()}function hn(t){t.preventDefault(),t.stopImmediatePropagation()}function d0(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function p0(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function ca(){return this.__zoom||jt}function g0(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function m0(){return navigator.maxTouchPoints||"ontouchstart"in this}function y0(t,e,n){var r=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],i=t.invertY(e[1][1])-n[1][1];return t.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i))}function x0(){var t=d0,e=p0,n=y0,r=g0,s=m0,o=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Qf,c=ys("start","zoom","end"),u,h,d,p=500,S=150,x=0,b=10;function v(g){g.property("__zoom",ca).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",Y).on("dblclick.zoom",H).filter(s).on("touchstart.zoom",D).on("touchmove.zoom",U).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(g,k,_,z){var I=g.selection?g.selection():g;I.property("__zoom",ca),g!==I?N(g,k,_,z):I.interrupt().each(function(){E(this,arguments).event(z).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},v.scaleBy=function(g,k,_,z){v.scaleTo(g,function(){var I=this.__zoom.k,T=typeof k=="function"?k.apply(this,arguments):k;return I*T},_,z)},v.scaleTo=function(g,k,_,z){v.transform(g,function(){var I=e.apply(this,arguments),T=this.__zoom,$=_==null?w(I):typeof _=="function"?_.apply(this,arguments):_,B=T.invert($),V=typeof k=="function"?k.apply(this,arguments):k;return n(C(M(T,V),$,B),I,i)},_,z)},v.translateBy=function(g,k,_,z){v.transform(g,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof _=="function"?_.apply(this,arguments):_),e.apply(this,arguments),i)},null,z)},v.translateTo=function(g,k,_,z,I){v.transform(g,function(){var T=e.apply(this,arguments),$=this.__zoom,B=z==null?w(T):typeof z=="function"?z.apply(this,arguments):z;return n(jt.translate(B[0],B[1]).scale($.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof _=="function"?-_.apply(this,arguments):-_),T,i)},z,I)};function M(g,k){return k=Math.max(o[0],Math.min(o[1],k)),k===g.k?g:new Bt(k,g.x,g.y)}function C(g,k,_){var z=k[0]-_[0]*g.k,I=k[1]-_[1]*g.k;return z===g.x&&I===g.y?g:new Bt(g.k,z,I)}function w(g){return[(+g[0][0]+ +g[1][0])/2,(+g[0][1]+ +g[1][1])/2]}function N(g,k,_,z){g.on("start.zoom",function(){E(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(z).end()}).tween("zoom",function(){var I=this,T=arguments,$=E(I,T).event(z),B=e.apply(I,T),V=_==null?w(B):typeof _=="function"?_.apply(I,T):_,q=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),W=I.__zoom,Q=typeof k=="function"?k.apply(I,T):k,et=l(W.invert(V).concat(q/W.k),Q.invert(V).concat(q/Q.k));return function(nt){if(nt===1)nt=Q;else{var st=et(nt),F=q/st[2];nt=new Bt(F,V[0]-st[0]*F,V[1]-st[1]*F)}$.zoom(null,nt)}})}function E(g,k,_){return!_&&g.__zooming||new A(g,k)}function A(g,k){this.that=g,this.args=k,this.active=0,this.sourceEvent=null,this.extent=e.apply(g,k),this.taps=0}A.prototype={event:function(g){return g&&(this.sourceEvent=g),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(g,k){return this.mouse&&g!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&g!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&g!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(g){var k=Pt(this.that).datum();c.call(g,this.that,new f0(g,{sourceEvent:this.sourceEvent,target:v,type:g,transform:this.that.__zoom,dispatch:c}),k)}};function O(g,...k){if(!t.apply(this,arguments))return;var _=E(this,k).event(g),z=this.__zoom,I=Math.max(o[0],Math.min(o[1],z.k*Math.pow(2,r.apply(this,arguments)))),T=Nt(g);if(_.wheel)(_.mouse[0][0]!==T[0]||_.mouse[0][1]!==T[1])&&(_.mouse[1]=z.invert(_.mouse[0]=T)),clearTimeout(_.wheel);else{if(z.k===I)return;_.mouse=[T,z.invert(T)],gr(this),_.start()}hn(g),_.wheel=setTimeout($,S),_.zoom("mouse",n(C(M(z,I),_.mouse[0],_.mouse[1]),_.extent,i));function $(){_.wheel=null,_.end()}}function Y(g,...k){if(d||!t.apply(this,arguments))return;var _=g.currentTarget,z=E(this,k,!0).event(g),I=Pt(g.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",q,!0),T=Nt(g,_),$=g.clientX,B=g.clientY;cl(g.view),Fs(g),z.mouse=[T,this.__zoom.invert(T)],gr(this),z.start();function V(W){if(hn(W),!z.moved){var Q=W.clientX-$,et=W.clientY-B;z.moved=Q*Q+et*et>x}z.event(W).zoom("mouse",n(C(z.that.__zoom,z.mouse[0]=Nt(W,_),z.mouse[1]),z.extent,i))}function q(W){I.on("mousemove.zoom mouseup.zoom",null),ll(W.view,z.moved),hn(W),z.event(W).end()}}function H(g,...k){if(t.apply(this,arguments)){var _=this.__zoom,z=Nt(g.changedTouches?g.changedTouches[0]:g,this),I=_.invert(z),T=_.k*(g.shiftKey?.5:2),$=n(C(M(_,T),z,I),e.apply(this,k),i);hn(g),a>0?Pt(this).transition().duration(a).call(N,$,z,g):Pt(this).call(v.transform,$,z,g)}}function D(g,...k){if(t.apply(this,arguments)){var _=g.touches,z=_.length,I=E(this,k,g.changedTouches.length===z).event(g),T,$,B,V;for(Fs(g),$=0;$<z;++$)B=_[$],V=Nt(B,this),V=[V,this.__zoom.invert(V),B.identifier],I.touch0?!I.touch1&&I.touch0[2]!==V[2]&&(I.touch1=V,I.taps=0):(I.touch0=V,T=!0,I.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(I.taps<2&&(h=V[0],u=setTimeout(function(){u=null},p)),gr(this),I.start())}}function U(g,...k){if(this.__zooming){var _=E(this,k).event(g),z=g.changedTouches,I=z.length,T,$,B,V;for(hn(g),T=0;T<I;++T)$=z[T],B=Nt($,this),_.touch0&&_.touch0[2]===$.identifier?_.touch0[0]=B:_.touch1&&_.touch1[2]===$.identifier&&(_.touch1[0]=B);if($=_.that.__zoom,_.touch1){var q=_.touch0[0],W=_.touch0[1],Q=_.touch1[0],et=_.touch1[1],nt=(nt=Q[0]-q[0])*nt+(nt=Q[1]-q[1])*nt,st=(st=et[0]-W[0])*st+(st=et[1]-W[1])*st;$=M($,Math.sqrt(nt/st)),B=[(q[0]+Q[0])/2,(q[1]+Q[1])/2],V=[(W[0]+et[0])/2,(W[1]+et[1])/2]}else if(_.touch0)B=_.touch0[0],V=_.touch0[1];else return;_.zoom("touch",n(C($,B,V),_.extent,i))}}function R(g,...k){if(this.__zooming){var _=E(this,k).event(g),z=g.changedTouches,I=z.length,T,$;for(Fs(g),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),T=0;T<I;++T)$=z[T],_.touch0&&_.touch0[2]===$.identifier?delete _.touch0:_.touch1&&_.touch1[2]===$.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&($=Nt($,this),Math.hypot(h[0]-$[0],h[1]-$[1])<b)){var B=Pt(this).on("dblclick.zoom");B&&B.apply(this,arguments)}}}return v.wheelDelta=function(g){return arguments.length?(r=typeof g=="function"?g:ir(+g),v):r},v.filter=function(g){return arguments.length?(t=typeof g=="function"?g:ir(!!g),v):t},v.touchable=function(g){return arguments.length?(s=typeof g=="function"?g:ir(!!g),v):s},v.extent=function(g){return arguments.length?(e=typeof g=="function"?g:ir([[+g[0][0],+g[0][1]],[+g[1][0],+g[1][1]]]),v):e},v.scaleExtent=function(g){return arguments.length?(o[0]=+g[0],o[1]=+g[1],v):[o[0],o[1]]},v.translateExtent=function(g){return arguments.length?(i[0][0]=+g[0][0],i[1][0]=+g[1][0],i[0][1]=+g[0][1],i[1][1]=+g[1][1],v):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},v.constrain=function(g){return arguments.length?(n=g,v):n},v.duration=function(g){return arguments.length?(a=+g,v):a},v.interpolate=function(g){return arguments.length?(l=g,v):l},v.on=function(){var g=c.on.apply(c,arguments);return g===c?v:g},v.clickDistance=function(g){return arguments.length?(x=(g=+g)*g,v):Math.sqrt(x)},v.tapDistance=function(g){return arguments.length?(b=+g,v):b},v}const vs=m.createContext(null),w0=vs.Provider,St={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},yl=St.error001();function at(t,e){const n=m.useContext(vs);if(n===null)throw new Error(yl);return Gc(n,t,e)}const ht=()=>{const t=m.useContext(vs);if(t===null)throw new Error(yl);return m.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},S0=t=>t.userSelectionActive?"none":"all";function v0({position:t,children:e,className:n,style:r,...s}){const o=at(S0),i=`${t}`.split("-");return m.createElement("div",{className:vt(["react-flow__panel",n,...i]),style:{...r,pointerEvents:o},...s},e)}function b0({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:m.createElement(v0,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},m.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const E0=({x:t,y:e,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:o={},labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...u})=>{const h=m.useRef(null),[d,p]=m.useState({x:0,y:0,width:0,height:0}),S=vt(["react-flow__edge-textwrapper",c]);return m.useEffect(()=>{if(h.current){const x=h.current.getBBox();p({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),typeof n>"u"||!n?null:m.createElement("g",{transform:`translate(${t-d.width/2} ${e-d.height/2})`,className:S,visibility:d.width?"visible":"hidden",...u},s&&m.createElement("rect",{width:d.width+2*i[0],x:-i[0],y:-i[1],height:d.height+2*i[1],className:"react-flow__edge-textbg",style:o,rx:a,ry:a}),m.createElement("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:h,style:r},n),l)};var T0=m.memo(E0);const Wo=t=>({width:t.offsetWidth,height:t.offsetHeight}),je=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Go=(t={x:0,y:0},e)=>({x:je(t.x,e[0][0],e[1][0]),y:je(t.y,e[0][1],e[1][1])}),la=(t,e,n)=>t<e?je(Math.abs(t-e),1,50)/50:t>n?-je(Math.abs(t-n),1,50)/50:0,xl=(t,e)=>{const n=la(t.x,35,e.width-35)*20,r=la(t.y,35,e.height-35)*20;return[n,r]},wl=t=>{var e;return((e=t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},_0=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),Ko=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),C0=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),ua=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),fo=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},P0=t=>Et(t.width)&&Et(t.height)&&Et(t.x)&&Et(t.y),Et=t=>!isNaN(t)&&isFinite(t),lt=Symbol.for("internals"),Sl=["Enter"," ","Escape"],Vr=(t,e)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${e} Help: https://reactflow.dev/error#${t}`)},M0=t=>"nativeEvent"in t;function po(t){var s,o;const e=M0(t)?t.nativeEvent:t,n=((o=(s=e.composedPath)==null?void 0:s.call(e))==null?void 0:o[0])||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const vl=t=>"clientX"in t,Qt=(t,e)=>{var o,i;const n=vl(t),r=n?t.clientX:(o=t.touches)==null?void 0:o[0].clientX,s=n?t.clientY:(i=t.touches)==null?void 0:i[0].clientY;return{x:r-((e==null?void 0:e.left)??0),y:s-((e==null?void 0:e.top)??0)}},qr=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0},en=({id:t,path:e,labelX:n,labelY:r,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,markerEnd:h,markerStart:d,interactionWidth:p=20})=>m.createElement(m.Fragment,null,m.createElement("path",{id:t,style:u,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:h,markerStart:d}),p&&m.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:p,className:"react-flow__edge-interaction"}),s&&Et(n)&&Et(r)?m.createElement(T0,{x:n,y:r,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null);en.displayName="BaseEdge";function fn(t,e,n){return n===void 0?n:r=>{const s=e().edges.find(o=>o.id===t);s&&n(r,{...s})}}function bl({sourceX:t,sourceY:e,targetX:n,targetY:r}){const s=Math.abs(n-t)/2,o=n<t?n+s:n-s,i=Math.abs(r-e)/2,a=r<e?r+i:r-i;return[o,a,s,i]}function El({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:s,sourceControlY:o,targetControlX:i,targetControlY:a}){const l=t*.125+s*.375+i*.375+n*.125,c=e*.125+o*.375+a*.375+r*.125,u=Math.abs(l-t),h=Math.abs(c-e);return[l,c,u,h]}exports.ConnectionMode=void 0;(function(t){t.Strict="strict",t.Loose="loose"})(exports.ConnectionMode||(exports.ConnectionMode={}));var he;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(he||(he={}));var Fn;(function(t){t.Partial="partial",t.Full="full"})(Fn||(Fn={}));var Kt;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Kt||(Kt={}));var Xr;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Xr||(Xr={}));exports.Position=void 0;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(exports.Position||(exports.Position={}));function ha({pos:t,x1:e,y1:n,x2:r,y2:s}){return t===exports.Position.Left||t===exports.Position.Right?[.5*(e+r),n]:[e,.5*(n+s)]}function Tl({sourceX:t,sourceY:e,sourcePosition:n=exports.Position.Bottom,targetX:r,targetY:s,targetPosition:o=exports.Position.Top}){const[i,a]=ha({pos:n,x1:t,y1:e,x2:r,y2:s}),[l,c]=ha({pos:o,x1:r,y1:s,x2:t,y2:e}),[u,h,d,p]=El({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${t},${e} C${i},${a} ${l},${c} ${r},${s}`,u,h,d,p]}const jo=m.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:s=exports.Position.Bottom,targetPosition:o=exports.Position.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:h,style:d,markerEnd:p,markerStart:S,interactionWidth:x})=>{const[b,v,M]=Tl({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:o});return m.createElement(en,{path:b,labelX:v,labelY:M,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:h,style:d,markerEnd:p,markerStart:S,interactionWidth:x})});jo.displayName="SimpleBezierEdge";const fa={[exports.Position.Left]:{x:-1,y:0},[exports.Position.Right]:{x:1,y:0},[exports.Position.Top]:{x:0,y:-1},[exports.Position.Bottom]:{x:0,y:1}},R0=({source:t,sourcePosition:e=exports.Position.Bottom,target:n})=>e===exports.Position.Left||e===exports.Position.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},da=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function k0({source:t,sourcePosition:e=exports.Position.Bottom,target:n,targetPosition:r=exports.Position.Top,center:s,offset:o}){const i=fa[e],a=fa[r],l={x:t.x+i.x*o,y:t.y+i.y*o},c={x:n.x+a.x*o,y:n.y+a.y*o},u=R0({source:l,sourcePosition:e,target:c}),h=u.x!==0?"x":"y",d=u[h];let p=[],S,x;const b={x:0,y:0},v={x:0,y:0},[M,C,w,N]=bl({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(i[h]*a[h]===-1){S=s.x||M,x=s.y||C;const A=[{x:S,y:l.y},{x:S,y:c.y}],O=[{x:l.x,y:x},{x:c.x,y:x}];i[h]===d?p=h==="x"?A:O:p=h==="x"?O:A}else{const A=[{x:l.x,y:c.y}],O=[{x:c.x,y:l.y}];if(h==="x"?p=i.x===d?O:A:p=i.y===d?A:O,e===r){const R=Math.abs(t[h]-n[h]);if(R<=o){const g=Math.min(o-1,o-R);i[h]===d?b[h]=(l[h]>t[h]?-1:1)*g:v[h]=(c[h]>n[h]?-1:1)*g}}if(e!==r){const R=h==="x"?"y":"x",g=i[h]===a[R],k=l[R]>c[R],_=l[R]<c[R];(i[h]===1&&(!g&&k||g&&_)||i[h]!==1&&(!g&&_||g&&k))&&(p=h==="x"?A:O)}const Y={x:l.x+b.x,y:l.y+b.y},H={x:c.x+v.x,y:c.y+v.y},D=Math.max(Math.abs(Y.x-p[0].x),Math.abs(H.x-p[0].x)),U=Math.max(Math.abs(Y.y-p[0].y),Math.abs(H.y-p[0].y));D>=U?(S=(Y.x+H.x)/2,x=p[0].y):(S=p[0].x,x=(Y.y+H.y)/2)}return[[t,{x:l.x+b.x,y:l.y+b.y},...p,{x:c.x+v.x,y:c.y+v.y},n],S,x,w,N]}function N0(t,e,n,r){const s=Math.min(da(t,e)/2,da(e,n)/2,r),{x:o,y:i}=e;if(t.x===o&&o===n.x||t.y===i&&i===n.y)return`L${o} ${i}`;if(t.y===i){const c=t.x<n.x?-1:1,u=t.y<n.y?1:-1;return`L ${o+s*c},${i}Q ${o},${i} ${o},${i+s*u}`}const a=t.x<n.x?1:-1,l=t.y<n.y?-1:1;return`L ${o},${i+s*l}Q ${o},${i} ${o+s*a},${i}`}function go({sourceX:t,sourceY:e,sourcePosition:n=exports.Position.Bottom,targetX:r,targetY:s,targetPosition:o=exports.Position.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20}){const[u,h,d,p,S]=k0({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:s},targetPosition:o,center:{x:a,y:l},offset:c});return[u.reduce((b,v,M)=>{let C="";return M>0&&M<u.length-1?C=N0(u[M-1],v,u[M+1],i):C=`${M===0?"M":"L"}${v.x} ${v.y}`,b+=C,b},""),h,d,p,S]}const bs=m.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,sourcePosition:h=exports.Position.Bottom,targetPosition:d=exports.Position.Top,markerEnd:p,markerStart:S,pathOptions:x,interactionWidth:b})=>{const[v,M,C]=go({sourceX:t,sourceY:e,sourcePosition:h,targetX:n,targetY:r,targetPosition:d,borderRadius:x==null?void 0:x.borderRadius,offset:x==null?void 0:x.offset});return m.createElement(en,{path:v,labelX:M,labelY:C,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,markerEnd:p,markerStart:S,interactionWidth:b})});bs.displayName="SmoothStepEdge";const Qo=m.memo(t=>{var e;return m.createElement(bs,{...t,pathOptions:m.useMemo(()=>{var n;return{borderRadius:0,offset:(n=t.pathOptions)==null?void 0:n.offset}},[(e=t.pathOptions)==null?void 0:e.offset])})});Qo.displayName="StepEdge";function A0({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[s,o,i,a]=bl({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,s,o,i,a]}const Jo=m.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,markerEnd:h,markerStart:d,interactionWidth:p})=>{const[S,x,b]=A0({sourceX:t,sourceY:e,targetX:n,targetY:r});return m.createElement(en,{path:S,labelX:x,labelY:b,label:s,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,style:u,markerEnd:h,markerStart:d,interactionWidth:p})});Jo.displayName="StraightEdge";function ar(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function pa({pos:t,x1:e,y1:n,x2:r,y2:s,c:o}){switch(t){case exports.Position.Left:return[e-ar(e-r,o),n];case exports.Position.Right:return[e+ar(r-e,o),n];case exports.Position.Top:return[e,n-ar(n-s,o)];case exports.Position.Bottom:return[e,n+ar(s-n,o)]}}function _l({sourceX:t,sourceY:e,sourcePosition:n=exports.Position.Bottom,targetX:r,targetY:s,targetPosition:o=exports.Position.Top,curvature:i=.25}){const[a,l]=pa({pos:n,x1:t,y1:e,x2:r,y2:s,c:i}),[c,u]=pa({pos:o,x1:r,y1:s,x2:t,y2:e,c:i}),[h,d,p,S]=El({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${t},${e} C${a},${l} ${c},${u} ${r},${s}`,h,d,p,S]}const Wr=m.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:s=exports.Position.Bottom,targetPosition:o=exports.Position.Top,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:h,style:d,markerEnd:p,markerStart:S,pathOptions:x,interactionWidth:b})=>{const[v,M,C]=_l({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:o,curvature:x==null?void 0:x.curvature});return m.createElement(en,{path:v,labelX:M,labelY:C,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:h,style:d,markerEnd:p,markerStart:S,interactionWidth:b})});Wr.displayName="BezierEdge";const ti=m.createContext(null),D0=ti.Provider;ti.Consumer;const $0=()=>m.useContext(ti),O0=t=>"id"in t&&"source"in t&&"target"in t,Cl=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`reactflow__edge-${t}${e||""}-${n}${r||""}`,mo=(t,e)=>typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`,z0=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),Pl=(t,e)=>{if(!t.source||!t.target)return Vr("006",St.error006()),e;let n;return O0(t)?n={...t}:n={...t,id:Cl(t)},z0(n,e)?e:e.concat(n)},Y0=(t,e,n,r={shouldReplaceId:!0})=>{const{id:s,...o}=t;if(!e.source||!e.target)return Vr("006",St.error006()),n;if(!n.find(l=>l.id===s))return Vr("007",St.error007(s)),n;const a={...o,id:r.shouldReplaceId?Cl(e):s,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle};return n.filter(l=>l.id!==s).concat(a)},yo=({x:t,y:e},[n,r,s],o,[i,a])=>{const l={x:(t-n)/s,y:(e-r)/s};return o?{x:i*Math.round(l.x/i),y:a*Math.round(l.y/a)}:l},Ml=({x:t,y:e},[n,r,s])=>({x:t*s+n,y:e*s+r}),ze=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],r=(t.height??0)*e[1],s={x:t.position.x-n,y:t.position.y-r};return{...s,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-r}:s}},ei=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,s)=>{const{x:o,y:i}=ze(s,e).positionAbsolute;return _0(r,Ko({x:o,y:i,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return C0(n)},Rl=(t,e,[n,r,s]=[0,0,1],o=!1,i=!1,a=[0,0])=>{const l={x:(e.x-n)/s,y:(e.y-r)/s,width:e.width/s,height:e.height/s},c=[];return t.forEach(u=>{const{width:h,height:d,selectable:p=!0,hidden:S=!1}=u;if(i&&!p||S)return!1;const{positionAbsolute:x}=ze(u,a),b={x:x.x,y:x.y,width:h||0,height:d||0},v=fo(l,b),M=typeof h>"u"||typeof d>"u"||h===null||d===null,C=o&&v>0,w=(h||0)*(d||0);(M||C||v>=w||u.dragging)&&c.push(u)}),c},kl=(t,e)=>{const n=t.map(r=>r.id);return e.filter(r=>n.includes(r.source)||n.includes(r.target))},Nl=(t,e,n,r,s,o=.1)=>{const i=e/(t.width*(1+o)),a=n/(t.height*(1+o)),l=Math.min(i,a),c=je(l,r,s),u=t.x+t.width/2,h=t.y+t.height/2,d=e/2-u*c,p=n/2-h*c;return{x:d,y:p,zoom:c}},ce=(t,e=0)=>t.transition().duration(e);function ga(t,e,n,r){return(e[n]||[]).reduce((s,o)=>{var i,a;return`${t.id}-${o.id}-${n}`!==r&&s.push({id:o.id||null,type:n,nodeId:t.id,x:(((i=t.positionAbsolute)==null?void 0:i.x)??0)+o.x+o.width/2,y:(((a=t.positionAbsolute)==null?void 0:a.y)??0)+o.y+o.height/2}),s},[])}function L0(t,e,n,r,s,o){const{x:i,y:a}=Qt(t),c=e.elementsFromPoint(i,a).find(S=>S.classList.contains("react-flow__handle"));if(c){const S=c.getAttribute("data-nodeid");if(S){const x=ni(void 0,c),b=c.getAttribute("data-handleid"),v=o({nodeId:S,id:b,type:x});if(v){const M=s.find(C=>C.nodeId===S&&C.type===x&&C.id===b);return{handle:{id:b,type:x,nodeId:S,x:(M==null?void 0:M.x)||n.x,y:(M==null?void 0:M.y)||n.y},validHandleResult:v}}}}let u=[],h=1/0;if(s.forEach(S=>{const x=Math.sqrt((S.x-n.x)**2+(S.y-n.y)**2);if(x<=r){const b=o(S);x<=h&&(x<h?u=[{handle:S,validHandleResult:b}]:x===h&&u.push({handle:S,validHandleResult:b}),h=x)}}),!u.length)return{handle:null,validHandleResult:Al()};if(u.length===1)return u[0];const d=u.some(({validHandleResult:S})=>S.isValid),p=u.some(({handle:S})=>S.type==="target");return u.find(({handle:S,validHandleResult:x})=>p?S.type==="target":d?x.isValid:!0)||u[0]}const I0={source:null,target:null,sourceHandle:null,targetHandle:null},Al=()=>({handleDomNode:null,isValid:!1,connection:I0,endHandle:null});function Dl(t,e,n,r,s,o,i){const a=s==="target",l=i.querySelector(`.react-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),c={...Al(),handleDomNode:l};if(l){const u=ni(void 0,l),h=l.getAttribute("data-nodeid"),d=l.getAttribute("data-handleid"),p=l.classList.contains("connectable"),S=l.classList.contains("connectableend"),x={source:a?h:n,sourceHandle:a?d:r,target:a?n:h,targetHandle:a?r:d};c.connection=x,p&&S&&(e===exports.ConnectionMode.Strict?a&&u==="source"||!a&&u==="target":h!==n||d!==r)&&(c.endHandle={nodeId:h,handleId:d,type:u},c.isValid=o(x))}return c}function B0({nodes:t,nodeId:e,handleId:n,handleType:r}){return t.reduce((s,o)=>{if(o[lt]){const{handleBounds:i}=o[lt];let a=[],l=[];i&&(a=ga(o,i,"source",`${e}-${n}-${r}`),l=ga(o,i,"target",`${e}-${n}-${r}`)),s.push(...a,...l)}return s},[])}function ni(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function Us(t){t==null||t.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function F0(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function $l({event:t,handleId:e,nodeId:n,onConnect:r,isTarget:s,getState:o,setState:i,isValidConnection:a,edgeUpdaterType:l,onEdgeUpdateEnd:c}){const u=wl(t.target),{connectionMode:h,domNode:d,autoPanOnConnect:p,connectionRadius:S,onConnectStart:x,panBy:b,getNodes:v,cancelConnection:M}=o();let C=0,w;const{x:N,y:E}=Qt(t),A=u==null?void 0:u.elementFromPoint(N,E),O=ni(l,A),Y=d==null?void 0:d.getBoundingClientRect();if(!Y||!O)return;let H,D=Qt(t,Y),U=!1,R=null,g=!1,k=null;const _=B0({nodes:v(),nodeId:n,handleId:e,handleType:O}),z=()=>{if(!p)return;const[$,B]=xl(D,Y);b({x:$,y:B}),C=requestAnimationFrame(z)};i({connectionPosition:D,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:O,connectionStartHandle:{nodeId:n,handleId:e,type:O},connectionEndHandle:null}),x==null||x(t,{nodeId:n,handleId:e,handleType:O});function I($){const{transform:B}=o();D=Qt($,Y);const{handle:V,validHandleResult:q}=L0($,u,yo(D,B,!1,[1,1]),S,_,W=>Dl(W,h,n,e,s?"target":"source",a,u));if(w=V,U||(z(),U=!0),k=q.handleDomNode,R=q.connection,g=q.isValid,i({connectionPosition:w&&g?Ml({x:w.x,y:w.y},B):D,connectionStatus:F0(!!w,g),connectionEndHandle:q.endHandle}),!w&&!g&&!k)return Us(H);R.source!==R.target&&k&&(Us(H),H=k,k.classList.add("connecting","react-flow__handle-connecting"),k.classList.toggle("valid",g),k.classList.toggle("react-flow__handle-valid",g))}function T($){var B,V;(w||k)&&R&&g&&(r==null||r(R)),(V=(B=o()).onConnectEnd)==null||V.call(B,$),l&&(c==null||c($)),Us(H),M(),cancelAnimationFrame(C),U=!1,g=!1,R=null,k=null,u.removeEventListener("mousemove",I),u.removeEventListener("mouseup",T),u.removeEventListener("touchmove",I),u.removeEventListener("touchend",T)}u.addEventListener("mousemove",I),u.addEventListener("mouseup",T),u.addEventListener("touchmove",I),u.addEventListener("touchend",T)}const ma=()=>!0,U0=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),Z0=(t,e,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:o,connectionClickStartHandle:i}=r;return{connecting:(s==null?void 0:s.nodeId)===t&&(s==null?void 0:s.handleId)===e&&(s==null?void 0:s.type)===n||(o==null?void 0:o.nodeId)===t&&(o==null?void 0:o.handleId)===e&&(o==null?void 0:o.type)===n,clickConnecting:(i==null?void 0:i.nodeId)===t&&(i==null?void 0:i.handleId)===e&&(i==null?void 0:i.type)===n}},Ol=m.forwardRef(({type:t="source",position:e=exports.Position.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:o=!0,id:i,onConnect:a,children:l,className:c,onMouseDown:u,onTouchStart:h,...d},p)=>{var Y,H;const S=i||null,x=t==="target",b=ht(),v=$0(),{connectOnClick:M,noPanClassName:C}=at(U0,pt),{connecting:w,clickConnecting:N}=at(Z0(v,S,t),pt);v||(H=(Y=b.getState()).onError)==null||H.call(Y,"010",St.error010());const E=D=>{const{defaultEdgeOptions:U,onConnect:R,hasDefaultEdges:g}=b.getState(),k={...U,...D};if(g){const{edges:_,setEdges:z}=b.getState();z(Pl(k,_))}R==null||R(k),a==null||a(k)},A=D=>{if(!v)return;const U=vl(D);s&&(U&&D.button===0||!U)&&$l({event:D,handleId:S,nodeId:v,onConnect:E,isTarget:x,getState:b.getState,setState:b.setState,isValidConnection:n||b.getState().isValidConnection||ma}),U?u==null||u(D):h==null||h(D)},O=D=>{const{onClickConnectStart:U,onClickConnectEnd:R,connectionClickStartHandle:g,connectionMode:k,isValidConnection:_}=b.getState();if(!v||!g&&!s)return;if(!g){U==null||U(D,{nodeId:v,handleId:S,handleType:t}),b.setState({connectionClickStartHandle:{nodeId:v,type:t,handleId:S}});return}const z=wl(D.target),I=n||_||ma,{connection:T,isValid:$}=Dl({nodeId:v,id:S,type:t},k,g.nodeId,g.handleId||null,g.type,I,z);$&&E(T),R==null||R(D),b.setState({connectionClickStartHandle:null})};return m.createElement("div",{"data-handleid":S,"data-nodeid":v,"data-handlepos":e,"data-id":`${v}-${S}-${t}`,className:vt(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",C,c,{source:!x,target:x,connectable:r,connectablestart:s,connectableend:o,connecting:N,connectionindicator:r&&(s&&!w||o&&w)}]),onMouseDown:A,onTouchStart:A,onClick:M?O:void 0,ref:p,...d},l)});Ol.displayName="Handle";var Un=m.memo(Ol);const zl=({data:t,isConnectable:e,targetPosition:n=exports.Position.Top,sourcePosition:r=exports.Position.Bottom})=>m.createElement(m.Fragment,null,m.createElement(Un,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,m.createElement(Un,{type:"source",position:r,isConnectable:e}));zl.displayName="DefaultNode";var xo=m.memo(zl);const Yl=({data:t,isConnectable:e,sourcePosition:n=exports.Position.Bottom})=>m.createElement(m.Fragment,null,t==null?void 0:t.label,m.createElement(Un,{type:"source",position:n,isConnectable:e}));Yl.displayName="InputNode";var Ll=m.memo(Yl);const Il=({data:t,isConnectable:e,targetPosition:n=exports.Position.Top})=>m.createElement(m.Fragment,null,m.createElement(Un,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label);Il.displayName="OutputNode";var Bl=m.memo(Il);const ri=()=>null;ri.displayName="GroupNode";const H0=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected)}),cr=t=>t.id;function V0(t,e){return pt(t.selectedNodes.map(cr),e.selectedNodes.map(cr))&&pt(t.selectedEdges.map(cr),e.selectedEdges.map(cr))}const Fl=m.memo(({onSelectionChange:t})=>{const e=ht(),{selectedNodes:n,selectedEdges:r}=at(H0,V0);return m.useEffect(()=>{const s={nodes:n,edges:r};t==null||t(s),e.getState().onSelectionChange.forEach(o=>o(s))},[n,r,t]),null});Fl.displayName="SelectionListener";const q0=t=>!!t.onSelectionChange;function X0({onSelectionChange:t}){const e=at(q0);return t||e?m.createElement(Fl,{onSelectionChange:t}):null}const W0=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function _e(t,e){m.useEffect(()=>{typeof t<"u"&&e(t)},[t])}function tt(t,e,n){m.useEffect(()=>{typeof e<"u"&&n({[t]:e})},[e])}const G0=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:o,onConnectEnd:i,onClickConnectStart:a,onClickConnectEnd:l,nodesDraggable:c,nodesConnectable:u,nodesFocusable:h,edgesFocusable:d,edgesUpdatable:p,elevateNodesOnSelect:S,minZoom:x,maxZoom:b,nodeExtent:v,onNodesChange:M,onEdgesChange:C,elementsSelectable:w,connectionMode:N,snapGrid:E,snapToGrid:A,translateExtent:O,connectOnClick:Y,defaultEdgeOptions:H,fitView:D,fitViewOptions:U,onNodesDelete:R,onEdgesDelete:g,onNodeDrag:k,onNodeDragStart:_,onNodeDragStop:z,onSelectionDrag:I,onSelectionDragStart:T,onSelectionDragStop:$,noPanClassName:B,nodeOrigin:V,rfId:q,autoPanOnConnect:W,autoPanOnNodeDrag:Q,onError:et,connectionRadius:nt,isValidConnection:st,nodeDragThreshold:F})=>{const{setNodes:X,setEdges:K,setDefaultNodesAndEdges:L,setMinZoom:it,setMaxZoom:j,setTranslateExtent:J,setNodeExtent:ot,reset:ct}=at(W0,pt),G=ht();return m.useEffect(()=>{const te=r==null?void 0:r.map(ee=>({...ee,...H}));return L(n,te),()=>{ct()}},[]),tt("defaultEdgeOptions",H,G.setState),tt("connectionMode",N,G.setState),tt("onConnect",s,G.setState),tt("onConnectStart",o,G.setState),tt("onConnectEnd",i,G.setState),tt("onClickConnectStart",a,G.setState),tt("onClickConnectEnd",l,G.setState),tt("nodesDraggable",c,G.setState),tt("nodesConnectable",u,G.setState),tt("nodesFocusable",h,G.setState),tt("edgesFocusable",d,G.setState),tt("edgesUpdatable",p,G.setState),tt("elementsSelectable",w,G.setState),tt("elevateNodesOnSelect",S,G.setState),tt("snapToGrid",A,G.setState),tt("snapGrid",E,G.setState),tt("onNodesChange",M,G.setState),tt("onEdgesChange",C,G.setState),tt("connectOnClick",Y,G.setState),tt("fitViewOnInit",D,G.setState),tt("fitViewOnInitOptions",U,G.setState),tt("onNodesDelete",R,G.setState),tt("onEdgesDelete",g,G.setState),tt("onNodeDrag",k,G.setState),tt("onNodeDragStart",_,G.setState),tt("onNodeDragStop",z,G.setState),tt("onSelectionDrag",I,G.setState),tt("onSelectionDragStart",T,G.setState),tt("onSelectionDragStop",$,G.setState),tt("noPanClassName",B,G.setState),tt("nodeOrigin",V,G.setState),tt("rfId",q,G.setState),tt("autoPanOnConnect",W,G.setState),tt("autoPanOnNodeDrag",Q,G.setState),tt("onError",et,G.setState),tt("connectionRadius",nt,G.setState),tt("isValidConnection",st,G.setState),tt("nodeDragThreshold",F,G.setState),_e(t,X),_e(e,K),_e(x,it),_e(b,j),_e(O,J),_e(v,ot),null},ya={display:"none"},K0={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ul="react-flow__node-desc",Zl="react-flow__edge-desc",j0="react-flow__aria-live",Q0=t=>t.ariaLiveMessage;function J0({rfId:t}){const e=at(Q0);return m.createElement("div",{id:`${j0}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:K0},e)}function tx({rfId:t,disableKeyboardA11y:e}){return m.createElement(m.Fragment,null,m.createElement("div",{id:`${Ul}-${t}`,style:ya},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),m.createElement("div",{id:`${Zl}-${t}`,style:ya},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&m.createElement(J0,{rfId:t}))}var Zn=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,r]=m.useState(!1),s=m.useRef(!1),o=m.useRef(new Set([])),[i,a]=m.useMemo(()=>{if(t!==null){const c=(Array.isArray(t)?t:[t]).filter(h=>typeof h=="string").map(h=>h.split("+")),u=c.reduce((h,d)=>h.concat(...d),[]);return[c,u]}return[[],[]]},[t]);return m.useEffect(()=>{const l=typeof document<"u"?document:null,c=(e==null?void 0:e.target)||l;if(t!==null){const u=p=>{if(s.current=p.ctrlKey||p.metaKey||p.shiftKey,(!s.current||s.current&&!e.actInsideInputWithModifier)&&po(p))return!1;const x=wa(p.code,a);o.current.add(p[x]),xa(i,o.current,!1)&&(p.preventDefault(),r(!0))},h=p=>{if((!s.current||s.current&&!e.actInsideInputWithModifier)&&po(p))return!1;const x=wa(p.code,a);xa(i,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(p[x]),p.key==="Meta"&&o.current.clear(),s.current=!1},d=()=>{o.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",u),c==null||c.addEventListener("keyup",h),window.addEventListener("blur",d),()=>{c==null||c.removeEventListener("keydown",u),c==null||c.removeEventListener("keyup",h),window.removeEventListener("blur",d)}}},[t,r]),n};function xa(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(s=>e.has(s)))}function wa(t,e){return e.includes(t)?"code":"key"}function Hl(t,e,n,r){var i,a;if(!t.parentNode)return n;const s=e.get(t.parentNode),o=ze(s,r);return Hl(s,e,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((i=s[lt])==null?void 0:i.z)??0)>(n.z??0)?((a=s[lt])==null?void 0:a.z)??0:n.z??0},r)}function Vl(t,e,n){t.forEach(r=>{var s;if(r.parentNode&&!t.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:o,y:i,z:a}=Hl(r,t,{...r.position,z:((s=r[lt])==null?void 0:s.z)??0},e);r.positionAbsolute={x:o,y:i},r[lt].z=a,n!=null&&n[r.id]&&(r[lt].isParent=!0)}})}function Zs(t,e,n,r){const s=new Map,o={},i=r?1e3:0;return t.forEach(a=>{var h;const l=(Et(a.zIndex)?a.zIndex:0)+(a.selected?i:0),c=e.get(a.id),u={width:c==null?void 0:c.width,height:c==null?void 0:c.height,...a,positionAbsolute:{x:a.position.x,y:a.position.y}};a.parentNode&&(u.parentNode=a.parentNode,o[a.parentNode]=!0),Object.defineProperty(u,lt,{enumerable:!1,value:{handleBounds:(h=c==null?void 0:c[lt])==null?void 0:h.handleBounds,z:l}}),s.set(a.id,u)}),Vl(s,n,o),s}function ql(t,e={}){const{getNodes:n,width:r,height:s,minZoom:o,maxZoom:i,d3Zoom:a,d3Selection:l,fitViewOnInitDone:c,fitViewOnInit:u,nodeOrigin:h}=t(),d=e.initial&&!c&&u;if(a&&l&&(d||!e.initial)){const S=n().filter(b=>{var M;const v=e.includeHiddenNodes?b.width&&b.height:!b.hidden;return(M=e.nodes)!=null&&M.length?v&&e.nodes.some(C=>C.id===b.id):v}),x=S.every(b=>b.width&&b.height);if(S.length>0&&x){const b=ei(S,h),{x:v,y:M,zoom:C}=Nl(b,r,s,e.minZoom??o,e.maxZoom??i,e.padding??.1),w=jt.translate(v,M).scale(C);return typeof e.duration=="number"&&e.duration>0?a.transform(ce(l,e.duration),w):a.transform(l,w),!0}}return!1}function ex(t,e){return t.forEach(n=>{const r=e.get(n.id);r&&e.set(r.id,{...r,[lt]:r[lt],selected:n.selected})}),new Map(e)}function nx(t,e){return e.map(n=>{const r=t.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function lr({changedNodes:t,changedEdges:e,get:n,set:r}){const{nodeInternals:s,edges:o,onNodesChange:i,onEdgesChange:a,hasDefaultNodes:l,hasDefaultEdges:c}=n();t!=null&&t.length&&(l&&r({nodeInternals:ex(t,s)}),i==null||i(t)),e!=null&&e.length&&(c&&r({edges:nx(e,o)}),a==null||a(e))}const Ce=()=>{},rx={zoomIn:Ce,zoomOut:Ce,zoomTo:Ce,getZoom:()=>1,setViewport:Ce,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ce,fitBounds:Ce,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},sx=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),ox=()=>{const t=ht(),{d3Zoom:e,d3Selection:n}=at(sx,pt);return m.useMemo(()=>n&&e?{zoomIn:s=>e.scaleBy(ce(n,s==null?void 0:s.duration),1.2),zoomOut:s=>e.scaleBy(ce(n,s==null?void 0:s.duration),1/1.2),zoomTo:(s,o)=>e.scaleTo(ce(n,o==null?void 0:o.duration),s),getZoom:()=>t.getState().transform[2],setViewport:(s,o)=>{const[i,a,l]=t.getState().transform,c=jt.translate(s.x??i,s.y??a).scale(s.zoom??l);e.transform(ce(n,o==null?void 0:o.duration),c)},getViewport:()=>{const[s,o,i]=t.getState().transform;return{x:s,y:o,zoom:i}},fitView:s=>ql(t.getState,s),setCenter:(s,o,i)=>{const{width:a,height:l,maxZoom:c}=t.getState(),u=typeof(i==null?void 0:i.zoom)<"u"?i.zoom:c,h=a/2-s*u,d=l/2-o*u,p=jt.translate(h,d).scale(u);e.transform(ce(n,i==null?void 0:i.duration),p)},fitBounds:(s,o)=>{const{width:i,height:a,minZoom:l,maxZoom:c}=t.getState(),{x:u,y:h,zoom:d}=Nl(s,i,a,l,c,(o==null?void 0:o.padding)??.1),p=jt.translate(u,h).scale(d);e.transform(ce(n,o==null?void 0:o.duration),p)},project:s=>{const{transform:o,snapToGrid:i,snapGrid:a}=t.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),yo(s,o,i,a)},screenToFlowPosition:s=>{const{transform:o,snapToGrid:i,snapGrid:a,domNode:l}=t.getState();if(!l)return s;const{x:c,y:u}=l.getBoundingClientRect(),h={x:s.x-c,y:s.y-u};return yo(h,o,i,a)},flowToScreenPosition:s=>{const{transform:o,domNode:i}=t.getState();if(!i)return s;const{x:a,y:l}=i.getBoundingClientRect(),c=Ml(s,o);return{x:c.x+a,y:c.y+l}},viewportInitialized:!0}:rx,[e,n])};function Es(){const t=ox(),e=ht(),n=m.useCallback(()=>e.getState().getNodes().map(x=>({...x})),[]),r=m.useCallback(x=>e.getState().nodeInternals.get(x),[]),s=m.useCallback(()=>{const{edges:x=[]}=e.getState();return x.map(b=>({...b}))},[]),o=m.useCallback(x=>{const{edges:b=[]}=e.getState();return b.find(v=>v.id===x)},[]),i=m.useCallback(x=>{const{getNodes:b,setNodes:v,hasDefaultNodes:M,onNodesChange:C}=e.getState(),w=b(),N=typeof x=="function"?x(w):x;if(M)v(N);else if(C){const E=N.length===0?w.map(A=>({type:"remove",id:A.id})):N.map(A=>({item:A,type:"reset"}));C(E)}},[]),a=m.useCallback(x=>{const{edges:b=[],setEdges:v,hasDefaultEdges:M,onEdgesChange:C}=e.getState(),w=typeof x=="function"?x(b):x;if(M)v(w);else if(C){const N=w.length===0?b.map(E=>({type:"remove",id:E.id})):w.map(E=>({item:E,type:"reset"}));C(N)}},[]),l=m.useCallback(x=>{const b=Array.isArray(x)?x:[x],{getNodes:v,setNodes:M,hasDefaultNodes:C,onNodesChange:w}=e.getState();if(C){const E=[...v(),...b];M(E)}else if(w){const N=b.map(E=>({item:E,type:"add"}));w(N)}},[]),c=m.useCallback(x=>{const b=Array.isArray(x)?x:[x],{edges:v=[],setEdges:M,hasDefaultEdges:C,onEdgesChange:w}=e.getState();if(C)M([...v,...b]);else if(w){const N=b.map(E=>({item:E,type:"add"}));w(N)}},[]),u=m.useCallback(()=>{const{getNodes:x,edges:b=[],transform:v}=e.getState(),[M,C,w]=v;return{nodes:x().map(N=>({...N})),edges:b.map(N=>({...N})),viewport:{x:M,y:C,zoom:w}}},[]),h=m.useCallback(({nodes:x,edges:b})=>{const{nodeInternals:v,getNodes:M,edges:C,hasDefaultNodes:w,hasDefaultEdges:N,onNodesDelete:E,onEdgesDelete:A,onNodesChange:O,onEdgesChange:Y}=e.getState(),H=(x||[]).map(k=>k.id),D=(b||[]).map(k=>k.id),U=M().reduce((k,_)=>{const z=!H.includes(_.id)&&_.parentNode&&k.find(T=>T.id===_.parentNode);return(typeof _.deletable=="boolean"?_.deletable:!0)&&(H.includes(_.id)||z)&&k.push(_),k},[]),R=C.filter(k=>typeof k.deletable=="boolean"?k.deletable:!0),g=R.filter(k=>D.includes(k.id));if(U||g){const k=kl(U,R),_=[...g,...k],z=_.reduce((I,T)=>(I.includes(T.id)||I.push(T.id),I),[]);if((N||w)&&(N&&e.setState({edges:C.filter(I=>!z.includes(I.id))}),w&&(U.forEach(I=>{v.delete(I.id)}),e.setState({nodeInternals:new Map(v)}))),z.length>0&&(A==null||A(_),Y&&Y(z.map(I=>({id:I,type:"remove"})))),U.length>0&&(E==null||E(U),O)){const I=U.map(T=>({id:T.id,type:"remove"}));O(I)}}},[]),d=m.useCallback(x=>{const b=P0(x),v=b?null:e.getState().nodeInternals.get(x.id);return[b?x:ua(v),v,b]},[]),p=m.useCallback((x,b=!0,v)=>{const[M,C,w]=d(x);return M?(v||e.getState().getNodes()).filter(N=>{if(!w&&(N.id===C.id||!N.positionAbsolute))return!1;const E=ua(N),A=fo(E,M);return b&&A>0||A>=M.width*M.height}):[]},[]),S=m.useCallback((x,b,v=!0)=>{const[M]=d(x);if(!M)return!1;const C=fo(M,b);return v&&C>0||C>=M.width*M.height},[]);return m.useMemo(()=>({...t,getNodes:n,getNode:r,getEdges:s,getEdge:o,setNodes:i,setEdges:a,addNodes:l,addEdges:c,toObject:u,deleteElements:h,getIntersectingNodes:p,isNodeIntersecting:S}),[t,n,r,s,o,i,a,l,c,u,h,p,S])}const ix={actInsideInputWithModifier:!1};var ax=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{const n=ht(),{deleteElements:r}=Es(),s=Zn(t,ix),o=Zn(e);m.useEffect(()=>{if(s){const{edges:i,getNodes:a}=n.getState(),l=a().filter(u=>u.selected),c=i.filter(u=>u.selected);r({nodes:l,edges:c}),n.setState({nodesSelectionActive:!1})}},[s]),m.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function cx(t){const e=ht();m.useEffect(()=>{let n;const r=()=>{var o,i;if(!t.current)return;const s=Wo(t.current);(s.height===0||s.width===0)&&((i=(o=e.getState()).onError)==null||i.call(o,"004",St.error004())),e.setState({width:s.width||500,height:s.height||500})};return r(),window.addEventListener("resize",r),t.current&&(n=new ResizeObserver(()=>r()),n.observe(t.current)),()=>{window.removeEventListener("resize",r),n&&t.current&&n.unobserve(t.current)}},[])}const si={position:"absolute",width:"100%",height:"100%",top:0,left:0},lx=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,ur=t=>({x:t.x,y:t.y,zoom:t.k}),Pe=(t,e)=>t.target.closest(`.${e}`),Sa=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),va=t=>{const e=t.ctrlKey&&qr()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},ux=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),hx=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:o=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=he.Free,zoomOnDoubleClick:c=!0,elementsSelectable:u,panOnDrag:h=!0,defaultViewport:d,translateExtent:p,minZoom:S,maxZoom:x,zoomActivationKeyCode:b,preventScrolling:v=!0,children:M,noWheelClassName:C,noPanClassName:w})=>{const N=m.useRef(),E=ht(),A=m.useRef(!1),O=m.useRef(!1),Y=m.useRef(null),H=m.useRef({x:0,y:0,zoom:0}),{d3Zoom:D,d3Selection:U,d3ZoomHandler:R,userSelectionActive:g}=at(ux,pt),k=Zn(b),_=m.useRef(0),z=m.useRef(!1),I=m.useRef();return cx(Y),m.useEffect(()=>{if(Y.current){const T=Y.current.getBoundingClientRect(),$=x0().scaleExtent([S,x]).translateExtent(p),B=Pt(Y.current).call($),V=jt.translate(d.x,d.y).scale(je(d.zoom,S,x)),q=[[0,0],[T.width,T.height]],W=$.constrain()(V,q,p);$.transform(B,W),$.wheelDelta(va),E.setState({d3Zoom:$,d3Selection:B,d3ZoomHandler:B.on("wheel.zoom"),transform:[W.x,W.y,W.k],domNode:Y.current.closest(".react-flow")})}},[]),m.useEffect(()=>{U&&D&&(i&&!k&&!g?U.on("wheel.zoom",T=>{if(Pe(T,C))return!1;T.preventDefault(),T.stopImmediatePropagation();const $=U.property("__zoom").k||1,B=qr();if(T.ctrlKey&&o&&B){const F=Nt(T),X=va(T),K=$*Math.pow(2,X);D.scaleTo(U,K,F,T);return}const V=T.deltaMode===1?20:1;let q=l===he.Vertical?0:T.deltaX*V,W=l===he.Horizontal?0:T.deltaY*V;!B&&T.shiftKey&&l!==he.Vertical&&(q=T.deltaY*V,W=0),D.translateBy(U,-(q/$)*a,-(W/$)*a,{internal:!0});const Q=ur(U.property("__zoom")),{onViewportChangeStart:et,onViewportChange:nt,onViewportChangeEnd:st}=E.getState();clearTimeout(I.current),z.current||(z.current=!0,e==null||e(T,Q),et==null||et(Q)),z.current&&(t==null||t(T,Q),nt==null||nt(Q),I.current=setTimeout(()=>{n==null||n(T,Q),st==null||st(Q),z.current=!1},150))},{passive:!1}):typeof R<"u"&&U.on("wheel.zoom",function(T,$){if(!v||Pe(T,C))return null;T.preventDefault(),R.call(this,T,$)},{passive:!1}))},[g,i,l,U,D,R,k,o,v,C,e,t,n]),m.useEffect(()=>{D&&D.on("start",T=>{var V,q;if(!T.sourceEvent||T.sourceEvent.internal)return null;_.current=(V=T.sourceEvent)==null?void 0:V.button;const{onViewportChangeStart:$}=E.getState(),B=ur(T.transform);A.current=!0,H.current=B,((q=T.sourceEvent)==null?void 0:q.type)==="mousedown"&&E.setState({paneDragging:!0}),$==null||$(B),e==null||e(T.sourceEvent,B)})},[D,e]),m.useEffect(()=>{D&&(g&&!A.current?D.on("zoom",null):g||D.on("zoom",T=>{var B;const{onViewportChange:$}=E.getState();if(E.setState({transform:[T.transform.x,T.transform.y,T.transform.k]}),O.current=!!(r&&Sa(h,_.current??0)),(t||$)&&!((B=T.sourceEvent)!=null&&B.internal)){const V=ur(T.transform);$==null||$(V),t==null||t(T.sourceEvent,V)}}))},[g,D,t,h,r]),m.useEffect(()=>{D&&D.on("end",T=>{if(!T.sourceEvent||T.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=E.getState();if(A.current=!1,E.setState({paneDragging:!1}),r&&Sa(h,_.current??0)&&!O.current&&r(T.sourceEvent),O.current=!1,(n||$)&&lx(H.current,T.transform)){const B=ur(T.transform);H.current=B,clearTimeout(N.current),N.current=setTimeout(()=>{$==null||$(B),n==null||n(T.sourceEvent,B)},i?150:0)}})},[D,i,h,n,r]),m.useEffect(()=>{D&&D.filter(T=>{const $=k||s,B=o&&T.ctrlKey;if((h===!0||Array.isArray(h)&&h.includes(1))&&T.button===1&&T.type==="mousedown"&&(Pe(T,"react-flow__node")||Pe(T,"react-flow__edge")))return!0;if(!h&&!$&&!i&&!c&&!o||g||!c&&T.type==="dblclick"||Pe(T,C)&&T.type==="wheel"||Pe(T,w)&&(T.type!=="wheel"||i&&T.type==="wheel"&&!k)||!o&&T.ctrlKey&&T.type==="wheel"||!$&&!i&&!B&&T.type==="wheel"||!h&&(T.type==="mousedown"||T.type==="touchstart")||Array.isArray(h)&&!h.includes(T.button)&&(T.type==="mousedown"||T.type==="touchstart"))return!1;const V=Array.isArray(h)&&h.includes(T.button)||!T.button||T.button<=1;return(!T.ctrlKey||T.type==="wheel")&&V})},[g,D,s,o,i,c,h,u,k]),m.createElement("div",{className:"react-flow__renderer",ref:Y,style:si},M)},fx=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function dx(){const{userSelectionActive:t,userSelectionRect:e}=at(fx,pt);return t&&e?m.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function ba(t,e){const n=t.find(r=>r.id===e.parentNode);if(n){const r=e.position.x+e.width-n.width,s=e.position.y+e.height-n.height;if(r>0||s>0||e.position.x<0||e.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),s>0&&(n.style.height+=s),e.position.x<0){const o=Math.abs(e.position.x);n.position.x=n.position.x-o,n.style.width+=o,e.position.x=0}if(e.position.y<0){const o=Math.abs(e.position.y);n.position.y=n.position.y-o,n.style.height+=o,e.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function Xl(t,e){if(t.some(r=>r.type==="reset"))return t.filter(r=>r.type==="reset").map(r=>r.item);const n=t.filter(r=>r.type==="add").map(r=>r.item);return e.reduce((r,s)=>{const o=t.filter(a=>a.id===s.id);if(o.length===0)return r.push(s),r;const i={...s};for(const a of o)if(a)switch(a.type){case"select":{i.selected=a.selected;break}case"position":{typeof a.position<"u"&&(i.position=a.position),typeof a.positionAbsolute<"u"&&(i.positionAbsolute=a.positionAbsolute),typeof a.dragging<"u"&&(i.dragging=a.dragging),i.expandParent&&ba(r,i);break}case"dimensions":{typeof a.dimensions<"u"&&(i.width=a.dimensions.width,i.height=a.dimensions.height),typeof a.updateStyle<"u"&&(i.style={...i.style||{},...a.dimensions}),typeof a.resizing=="boolean"&&(i.resizing=a.resizing),i.expandParent&&ba(r,i);break}case"remove":return r}return r.push(i),r},n)}function Wl(t,e){return Xl(t,e)}function px(t,e){return Xl(t,e)}const Gt=(t,e)=>({id:t,type:"select",selected:e});function Ne(t,e){return t.reduce((n,r)=>{const s=e.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(Gt(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(Gt(r.id,!1))),n},[])}const Hs=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},gx=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),Gl=m.memo(({isSelecting:t,selectionMode:e=Fn.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:o,onPaneContextMenu:i,onPaneScroll:a,onPaneMouseEnter:l,onPaneMouseMove:c,onPaneMouseLeave:u,children:h})=>{const d=m.useRef(null),p=ht(),S=m.useRef(0),x=m.useRef(0),b=m.useRef(),{userSelectionActive:v,elementsSelectable:M,dragging:C}=at(gx,pt),w=()=>{p.setState({userSelectionActive:!1,userSelectionRect:null}),S.current=0,x.current=0},N=R=>{o==null||o(R),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},E=R=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){R.preventDefault();return}i==null||i(R)},A=a?R=>a(R):void 0,O=R=>{const{resetSelectedElements:g,domNode:k}=p.getState();if(b.current=k==null?void 0:k.getBoundingClientRect(),!M||!t||R.button!==0||R.target!==d.current||!b.current)return;const{x:_,y:z}=Qt(R,b.current);g(),p.setState({userSelectionRect:{width:0,height:0,startX:_,startY:z,x:_,y:z}}),r==null||r(R)},Y=R=>{const{userSelectionRect:g,nodeInternals:k,edges:_,transform:z,onNodesChange:I,onEdgesChange:T,nodeOrigin:$,getNodes:B}=p.getState();if(!t||!b.current||!g)return;p.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=Qt(R,b.current),q=g.startX??0,W=g.startY??0,Q={...g,x:V.x<q?V.x:q,y:V.y<W?V.y:W,width:Math.abs(V.x-q),height:Math.abs(V.y-W)},et=B(),nt=Rl(k,Q,z,e===Fn.Partial,!0,$),st=kl(nt,_).map(X=>X.id),F=nt.map(X=>X.id);if(S.current!==F.length){S.current=F.length;const X=Ne(et,F);X.length&&(I==null||I(X))}if(x.current!==st.length){x.current=st.length;const X=Ne(_,st);X.length&&(T==null||T(X))}p.setState({userSelectionRect:Q})},H=R=>{if(R.button!==0)return;const{userSelectionRect:g}=p.getState();!v&&g&&R.target===d.current&&(N==null||N(R)),p.setState({nodesSelectionActive:S.current>0}),w(),s==null||s(R)},D=R=>{v&&(p.setState({nodesSelectionActive:S.current>0}),s==null||s(R)),w()},U=M&&(t||v);return m.createElement("div",{className:vt(["react-flow__pane",{dragging:C,selection:t}]),onClick:U?void 0:Hs(N,d),onContextMenu:Hs(E,d),onWheel:Hs(A,d),onMouseEnter:U?void 0:l,onMouseDown:U?O:void 0,onMouseMove:U?Y:c,onMouseUp:U?H:void 0,onMouseLeave:U?D:u,ref:d,style:si},h,m.createElement(dx,null))});Gl.displayName="Pane";function Kl(t,e){if(!t.parentNode)return!1;const n=e.get(t.parentNode);return n?n.selected?!0:Kl(n,e):!1}function Ea(t,e,n){let r=t;do{if(r!=null&&r.matches(e))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function mx(t,e,n,r){return Array.from(t.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||!Kl(s,t))&&(s.draggable||e&&typeof s.draggable>"u")).map(s=>{var o,i;return{id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=s.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((i=s.positionAbsolute)==null?void 0:i.y)??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode,width:s.width,height:s.height,expandParent:s.expandParent}})}function yx(t,e){return!e||e==="parent"?e:[e[0],[e[1][0]-(t.width||0),e[1][1]-(t.height||0)]]}function jl(t,e,n,r,s=[0,0],o){const i=yx(t,t.extent||r);let a=i;if(t.extent==="parent"&&!t.expandParent)if(t.parentNode&&t.width&&t.height){const u=n.get(t.parentNode),{x:h,y:d}=ze(u,s).positionAbsolute;a=u&&Et(h)&&Et(d)&&Et(u.width)&&Et(u.height)?[[h+t.width*s[0],d+t.height*s[1]],[h+u.width-t.width+t.width*s[0],d+u.height-t.height+t.height*s[1]]]:a}else o==null||o("005",St.error005()),a=i;else if(t.extent&&t.parentNode&&t.extent!=="parent"){const u=n.get(t.parentNode),{x:h,y:d}=ze(u,s).positionAbsolute;a=[[t.extent[0][0]+h,t.extent[0][1]+d],[t.extent[1][0]+h,t.extent[1][1]+d]]}let l={x:0,y:0};if(t.parentNode){const u=n.get(t.parentNode);l=ze(u,s).positionAbsolute}const c=a&&a!=="parent"?Go(e,a):e;return{position:{x:c.x-l.x,y:c.y-l.y},positionAbsolute:c}}function Vs({nodeId:t,dragItems:e,nodeInternals:n}){const r=e.map(s=>({...n.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[t?r.find(s=>s.id===t):r[0],r]}const Ta=(t,e,n,r)=>{const s=e.querySelectorAll(t);if(!s||!s.length)return null;const o=Array.from(s),i=e.getBoundingClientRect(),a={x:i.width*r[0],y:i.height*r[1]};return o.map(l=>{const c=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(c.left-i.left-a.x)/n,y:(c.top-i.top-a.y)/n,...Wo(l)}})};function dn(t,e,n){return n===void 0?n:r=>{const s=e().nodeInternals.get(t);s&&n(r,{...s})}}function wo({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:o,multiSelectionActive:i,nodeInternals:a,onError:l}=e.getState(),c=a.get(t);if(!c){l==null||l("012",St.error012(t));return}e.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&i)&&(o({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):s([t])}function xx(){const t=ht();return m.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:o}=t.getState(),i=n.touches?n.touches[0].clientX:n.clientX,a=n.touches?n.touches[0].clientY:n.clientY,l={x:(i-r[0])/r[2],y:(a-r[1])/r[2]};return{xSnapped:o?s[0]*Math.round(l.x/s[0]):l.x,ySnapped:o?s[1]*Math.round(l.y/s[1]):l.y,...l}},[])}function qs(t){return(e,n,r)=>t==null?void 0:t(e,r)}function Ql({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:o,selectNodesOnDrag:i}){const a=ht(),[l,c]=m.useState(!1),u=m.useRef([]),h=m.useRef({x:null,y:null}),d=m.useRef(0),p=m.useRef(null),S=m.useRef({x:0,y:0}),x=m.useRef(null),b=m.useRef(!1),v=m.useRef(!1),M=xx();return m.useEffect(()=>{if(t!=null&&t.current){const C=Pt(t.current),w=({x:A,y:O})=>{const{nodeInternals:Y,onNodeDrag:H,onSelectionDrag:D,updateNodePositions:U,nodeExtent:R,snapGrid:g,snapToGrid:k,nodeOrigin:_,onError:z}=a.getState();h.current={x:A,y:O};let I=!1,T={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&R){const B=ei(u.current,_);T=Ko(B)}if(u.current=u.current.map(B=>{const V={x:A-B.distance.x,y:O-B.distance.y};k&&(V.x=g[0]*Math.round(V.x/g[0]),V.y=g[1]*Math.round(V.y/g[1]));const q=[[R[0][0],R[0][1]],[R[1][0],R[1][1]]];u.current.length>1&&R&&!B.extent&&(q[0][0]=B.positionAbsolute.x-T.x+R[0][0],q[1][0]=B.positionAbsolute.x+(B.width??0)-T.x2+R[1][0],q[0][1]=B.positionAbsolute.y-T.y+R[0][1],q[1][1]=B.positionAbsolute.y+(B.height??0)-T.y2+R[1][1]);const W=jl(B,V,Y,q,_,z);return I=I||B.position.x!==W.position.x||B.position.y!==W.position.y,B.position=W.position,B.positionAbsolute=W.positionAbsolute,B}),!I)return;U(u.current,!0,!0),c(!0);const $=s?H:qs(D);if($&&x.current){const[B,V]=Vs({nodeId:s,dragItems:u.current,nodeInternals:Y});$(x.current,B,V)}},N=()=>{if(!p.current)return;const[A,O]=xl(S.current,p.current);if(A!==0||O!==0){const{transform:Y,panBy:H}=a.getState();h.current.x=(h.current.x??0)-A/Y[2],h.current.y=(h.current.y??0)-O/Y[2],H({x:A,y:O})&&w(h.current)}d.current=requestAnimationFrame(N)},E=A=>{var _;const{nodeInternals:O,multiSelectionActive:Y,nodesDraggable:H,unselectNodesAndEdges:D,onNodeDragStart:U,onSelectionDragStart:R}=a.getState();v.current=!0;const g=s?U:qs(R);(!i||!o)&&!Y&&s&&((_=O.get(s))!=null&&_.selected||D()),s&&o&&i&&wo({id:s,store:a,nodeRef:t});const k=M(A);if(h.current=k,u.current=mx(O,H,k,s),g&&u.current){const[z,I]=Vs({nodeId:s,dragItems:u.current,nodeInternals:O});g(A.sourceEvent,z,I)}};if(e)C.on(".drag",null);else{const A=ty().on("start",O=>{const{domNode:Y,nodeDragThreshold:H}=a.getState();H===0&&E(O);const D=M(O);h.current=D,p.current=(Y==null?void 0:Y.getBoundingClientRect())||null,S.current=Qt(O.sourceEvent,p.current)}).on("drag",O=>{var U,R;const Y=M(O),{autoPanOnNodeDrag:H,nodeDragThreshold:D}=a.getState();if(!b.current&&v.current&&H&&(b.current=!0,N()),!v.current){const g=Y.xSnapped-(((U=h==null?void 0:h.current)==null?void 0:U.x)??0),k=Y.ySnapped-(((R=h==null?void 0:h.current)==null?void 0:R.y)??0);Math.sqrt(g*g+k*k)>D&&E(O)}(h.current.x!==Y.xSnapped||h.current.y!==Y.ySnapped)&&u.current&&v.current&&(x.current=O.sourceEvent,S.current=Qt(O.sourceEvent,p.current),w(Y))}).on("end",O=>{if(v.current&&(c(!1),b.current=!1,v.current=!1,cancelAnimationFrame(d.current),u.current)){const{updateNodePositions:Y,nodeInternals:H,onNodeDragStop:D,onSelectionDragStop:U}=a.getState(),R=s?D:qs(U);if(Y(u.current,!1,!1),R){const[g,k]=Vs({nodeId:s,dragItems:u.current,nodeInternals:H});R(O.sourceEvent,g,k)}}}).filter(O=>{const Y=O.target;return!O.button&&(!n||!Ea(Y,`.${n}`,t))&&(!r||Ea(Y,r,t))});return C.call(A),()=>{C.on(".drag",null)}}}},[t,e,n,r,o,a,s,i,M]),l}function Jl(){const t=ht();return m.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:o,getNodes:i,snapToGrid:a,snapGrid:l,onError:c,nodesDraggable:u}=t.getState(),h=i().filter(M=>M.selected&&(M.draggable||u&&typeof M.draggable>"u")),d=a?l[0]:5,p=a?l[1]:5,S=n.isShiftPressed?4:1,x=n.x*d*S,b=n.y*p*S,v=h.map(M=>{if(M.positionAbsolute){const C={x:M.positionAbsolute.x+x,y:M.positionAbsolute.y+b};a&&(C.x=l[0]*Math.round(C.x/l[0]),C.y=l[1]*Math.round(C.y/l[1]));const{positionAbsolute:w,position:N}=jl(M,C,r,s,void 0,c);M.position=N,M.positionAbsolute=w}return M});o(v,!0,!1)},[])}const Ye={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var pn=t=>{const e=({id:n,type:r,data:s,xPos:o,yPos:i,xPosOrigin:a,yPosOrigin:l,selected:c,onClick:u,onMouseEnter:h,onMouseMove:d,onMouseLeave:p,onContextMenu:S,onDoubleClick:x,style:b,className:v,isDraggable:M,isSelectable:C,isConnectable:w,isFocusable:N,selectNodesOnDrag:E,sourcePosition:A,targetPosition:O,hidden:Y,resizeObserver:H,dragHandle:D,zIndex:U,isParent:R,noDragClassName:g,noPanClassName:k,initialized:_,disableKeyboardA11y:z,ariaLabel:I,rfId:T})=>{const $=ht(),B=m.useRef(null),V=m.useRef(A),q=m.useRef(O),W=m.useRef(r),Q=C||M||u||h||d||p,et=Jl(),nt=dn(n,$.getState,h),st=dn(n,$.getState,d),F=dn(n,$.getState,p),X=dn(n,$.getState,S),K=dn(n,$.getState,x),L=J=>{const{nodeDragThreshold:ot}=$.getState();if(C&&(!E||!M||ot>0)&&wo({id:n,store:$,nodeRef:B}),u){const ct=$.getState().nodeInternals.get(n);ct&&u(J,{...ct})}},it=J=>{if(!po(J))if(Sl.includes(J.key)&&C){const ot=J.key==="Escape";wo({id:n,store:$,unselect:ot,nodeRef:B})}else!z&&M&&c&&Object.prototype.hasOwnProperty.call(Ye,J.key)&&($.setState({ariaLiveMessage:`Moved selected node ${J.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~i}`}),et({x:Ye[J.key].x,y:Ye[J.key].y,isShiftPressed:J.shiftKey}))};m.useEffect(()=>{if(B.current&&!Y){const J=B.current;return H==null||H.observe(J),()=>H==null?void 0:H.unobserve(J)}},[Y]),m.useEffect(()=>{const J=W.current!==r,ot=V.current!==A,ct=q.current!==O;B.current&&(J||ot||ct)&&(J&&(W.current=r),ot&&(V.current=A),ct&&(q.current=O),$.getState().updateNodeDimensions([{id:n,nodeElement:B.current,forceUpdate:!0}]))},[n,r,A,O]);const j=Ql({nodeRef:B,disabled:Y||!M,noDragClassName:g,handleSelector:D,nodeId:n,isSelectable:C,selectNodesOnDrag:E});return Y?null:m.createElement("div",{className:vt(["react-flow__node",`react-flow__node-${r}`,{[k]:M},v,{selected:c,selectable:C,parent:R,dragging:j}]),ref:B,style:{zIndex:U,transform:`translate(${a}px,${l}px)`,pointerEvents:Q?"all":"none",visibility:_?"visible":"hidden",...b},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:nt,onMouseMove:st,onMouseLeave:F,onContextMenu:X,onClick:L,onDoubleClick:K,onKeyDown:N?it:void 0,tabIndex:N?0:void 0,role:N?"button":void 0,"aria-describedby":z?void 0:`${Ul}-${T}`,"aria-label":I},m.createElement(D0,{value:n},m.createElement(t,{id:n,data:s,type:r,xPos:o,yPos:i,selected:c,isConnectable:w,sourcePosition:A,targetPosition:O,dragging:j,dragHandle:D,zIndex:U})))};return e.displayName="NodeWrapper",m.memo(e)};const wx=t=>{const e=t.getNodes().filter(n=>n.selected);return{...ei(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};function Sx({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=ht(),{width:s,height:o,x:i,y:a,transformString:l,userSelectionActive:c}=at(wx,pt),u=Jl(),h=m.useRef(null);if(m.useEffect(()=>{var S;n||(S=h.current)==null||S.focus({preventScroll:!0})},[n]),Ql({nodeRef:h}),c||!s||!o)return null;const d=t?S=>{const x=r.getState().getNodes().filter(b=>b.selected);t(S,x)}:void 0,p=S=>{Object.prototype.hasOwnProperty.call(Ye,S.key)&&u({x:Ye[S.key].x,y:Ye[S.key].y,isShiftPressed:S.shiftKey})};return m.createElement("div",{className:vt(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l}},m.createElement("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p,style:{width:s,height:o,top:a,left:i}}))}var vx=m.memo(Sx);const bx=t=>t.nodesSelectionActive,tu=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:i,deleteKeyCode:a,onMove:l,onMoveStart:c,onMoveEnd:u,selectionKeyCode:h,selectionOnDrag:d,selectionMode:p,onSelectionStart:S,onSelectionEnd:x,multiSelectionKeyCode:b,panActivationKeyCode:v,zoomActivationKeyCode:M,elementsSelectable:C,zoomOnScroll:w,zoomOnPinch:N,panOnScroll:E,panOnScrollSpeed:A,panOnScrollMode:O,zoomOnDoubleClick:Y,panOnDrag:H,defaultViewport:D,translateExtent:U,minZoom:R,maxZoom:g,preventScrolling:k,onSelectionContextMenu:_,noWheelClassName:z,noPanClassName:I,disableKeyboardA11y:T})=>{const $=at(bx),B=Zn(h),V=Zn(v),q=V||H,W=V||E,Q=B||d&&q!==!0;return ax({deleteKeyCode:a,multiSelectionKeyCode:b}),m.createElement(hx,{onMove:l,onMoveStart:c,onMoveEnd:u,onPaneContextMenu:o,elementsSelectable:C,zoomOnScroll:w,zoomOnPinch:N,panOnScroll:W,panOnScrollSpeed:A,panOnScrollMode:O,zoomOnDoubleClick:Y,panOnDrag:!B&&q,defaultViewport:D,translateExtent:U,minZoom:R,maxZoom:g,zoomActivationKeyCode:M,preventScrolling:k,noWheelClassName:z,noPanClassName:I},m.createElement(Gl,{onSelectionStart:S,onSelectionEnd:x,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:i,panOnDrag:q,isSelecting:!!Q,selectionMode:p},t,$&&m.createElement(vx,{onSelectionContextMenu:_,noPanClassName:I,disableKeyboardA11y:T})))};tu.displayName="FlowRenderer";var Ex=m.memo(tu);function Tx(t){return at(m.useCallback(n=>t?Rl(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[t]))}function _x(t){const e={input:pn(t.input||Ll),default:pn(t.default||xo),output:pn(t.output||Bl),group:pn(t.group||ri)},n={},r=Object.keys(t).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,o)=>(s[o]=pn(t[o]||xo),s),n);return{...e,...r}}const Cx=({x:t,y:e,width:n,height:r,origin:s})=>!n||!r?{x:t,y:e}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:t,y:e}:{x:t-n*s[0],y:e-r*s[1]},Px=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),eu=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:o,onError:i}=at(Px,pt),a=Tx(t.onlyRenderVisibleElements),l=m.useRef(),c=m.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const u=new ResizeObserver(h=>{const d=h.map(p=>({id:p.target.getAttribute("data-id"),nodeElement:p.target,forceUpdate:!0}));o(d)});return l.current=u,u},[]);return m.useEffect(()=>()=>{var u;(u=l==null?void 0:l.current)==null||u.disconnect()},[]),m.createElement("div",{className:"react-flow__nodes",style:si},a.map(u=>{var N,E;let h=u.type||"default";t.nodeTypes[h]||(i==null||i("003",St.error003(h)),h="default");const d=t.nodeTypes[h]||t.nodeTypes.default,p=!!(u.draggable||e&&typeof u.draggable>"u"),S=!!(u.selectable||s&&typeof u.selectable>"u"),x=!!(u.connectable||n&&typeof u.connectable>"u"),b=!!(u.focusable||r&&typeof u.focusable>"u"),v=t.nodeExtent?Go(u.positionAbsolute,t.nodeExtent):u.positionAbsolute,M=(v==null?void 0:v.x)??0,C=(v==null?void 0:v.y)??0,w=Cx({x:M,y:C,width:u.width??0,height:u.height??0,origin:t.nodeOrigin});return m.createElement(d,{key:u.id,id:u.id,className:u.className,style:u.style,type:h,data:u.data,sourcePosition:u.sourcePosition||exports.Position.Bottom,targetPosition:u.targetPosition||exports.Position.Top,hidden:u.hidden,xPos:M,yPos:C,xPosOrigin:w.x,yPosOrigin:w.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!u.selected,isDraggable:p,isSelectable:S,isConnectable:x,isFocusable:b,resizeObserver:c,dragHandle:u.dragHandle,zIndex:((N=u[lt])==null?void 0:N.z)??0,isParent:!!((E=u[lt])!=null&&E.isParent),noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!u.width&&!!u.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:u.ariaLabel})}))};eu.displayName="NodeRenderer";var Mx=m.memo(eu);const Rx=(t,e,n)=>n===exports.Position.Left?t-e:n===exports.Position.Right?t+e:t,kx=(t,e,n)=>n===exports.Position.Top?t-e:n===exports.Position.Bottom?t+e:t,_a="react-flow__edgeupdater",Ca=({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:o,onMouseOut:i,type:a})=>m.createElement("circle",{onMouseDown:s,onMouseEnter:o,onMouseOut:i,className:vt([_a,`${_a}-${a}`]),cx:Rx(e,r,t),cy:kx(n,r,t),r,stroke:"transparent",fill:"transparent"}),Nx=()=>!0;var Me=t=>{const e=({id:n,className:r,type:s,data:o,onClick:i,onEdgeDoubleClick:a,selected:l,animated:c,label:u,labelStyle:h,labelShowBg:d,labelBgStyle:p,labelBgPadding:S,labelBgBorderRadius:x,style:b,source:v,target:M,sourceX:C,sourceY:w,targetX:N,targetY:E,sourcePosition:A,targetPosition:O,elementsSelectable:Y,hidden:H,sourceHandleId:D,targetHandleId:U,onContextMenu:R,onMouseEnter:g,onMouseMove:k,onMouseLeave:_,edgeUpdaterRadius:z,onEdgeUpdate:I,onEdgeUpdateStart:T,onEdgeUpdateEnd:$,markerEnd:B,markerStart:V,rfId:q,ariaLabel:W,isFocusable:Q,isUpdatable:et,pathOptions:nt,interactionWidth:st})=>{const F=m.useRef(null),[X,K]=m.useState(!1),[L,it]=m.useState(!1),j=ht(),J=m.useMemo(()=>`url(#${mo(V,q)})`,[V,q]),ot=m.useMemo(()=>`url(#${mo(B,q)})`,[B,q]);if(H)return null;const ct=dt=>{var Rt;const{edges:yt,addSelectedEdges:se,unselectNodesAndEdges:oe,multiSelectionActive:ie}=j.getState(),zt=yt.find(sn=>sn.id===n);zt&&(Y&&(j.setState({nodesSelectionActive:!1}),zt.selected&&ie?(oe({nodes:[],edges:[zt]}),(Rt=F.current)==null||Rt.blur()):se([n])),i&&i(dt,zt))},G=fn(n,j.getState,a),te=fn(n,j.getState,R),ee=fn(n,j.getState,g),nn=fn(n,j.getState,k),ve=fn(n,j.getState,_),ne=(dt,yt)=>{if(dt.button!==0)return;const{edges:se,isValidConnection:oe}=j.getState(),ie=yt?M:v,zt=(yt?U:D)||null,Rt=yt?"target":"source",sn=oe||Nx,Ts=yt,on=se.find(ae=>ae.id===n);it(!0),T==null||T(dt,on,Rt);const _s=ae=>{it(!1),$==null||$(ae,on,Rt)};$l({event:dt,handleId:zt,nodeId:ie,onConnect:ae=>I==null?void 0:I(on,ae),isTarget:Ts,getState:j.getState,setState:j.setState,isValidConnection:sn,edgeUpdaterType:Rt,onEdgeUpdateEnd:_s})},qt=dt=>ne(dt,!0),be=dt=>ne(dt,!1),Xt=()=>K(!0),re=()=>K(!1),rn=!Y&&!i,Ee=dt=>{var yt;if(Sl.includes(dt.key)&&Y){const{unselectNodesAndEdges:se,addSelectedEdges:oe,edges:ie}=j.getState();dt.key==="Escape"?((yt=F.current)==null||yt.blur(),se({edges:[ie.find(Rt=>Rt.id===n)]})):oe([n])}};return m.createElement("g",{className:vt(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:l,animated:c,inactive:rn,updating:X}]),onClick:ct,onDoubleClick:G,onContextMenu:te,onMouseEnter:ee,onMouseMove:nn,onMouseLeave:ve,onKeyDown:Q?Ee:void 0,tabIndex:Q?0:void 0,role:Q?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":W===null?void 0:W||`Edge from ${v} to ${M}`,"aria-describedby":Q?`${Zl}-${q}`:void 0,ref:F},!L&&m.createElement(t,{id:n,source:v,target:M,selected:l,animated:c,label:u,labelStyle:h,labelShowBg:d,labelBgStyle:p,labelBgPadding:S,labelBgBorderRadius:x,data:o,style:b,sourceX:C,sourceY:w,targetX:N,targetY:E,sourcePosition:A,targetPosition:O,sourceHandleId:D,targetHandleId:U,markerStart:J,markerEnd:ot,pathOptions:nt,interactionWidth:st}),et&&m.createElement(m.Fragment,null,(et==="source"||et===!0)&&m.createElement(Ca,{position:A,centerX:C,centerY:w,radius:z,onMouseDown:qt,onMouseEnter:Xt,onMouseOut:re,type:"source"}),(et==="target"||et===!0)&&m.createElement(Ca,{position:O,centerX:N,centerY:E,radius:z,onMouseDown:be,onMouseEnter:Xt,onMouseOut:re,type:"target"})))};return e.displayName="EdgeWrapper",m.memo(e)};function Ax(t){const e={default:Me(t.default||Wr),straight:Me(t.bezier||Jo),step:Me(t.step||Qo),smoothstep:Me(t.step||bs),simplebezier:Me(t.simplebezier||jo)},n={},r=Object.keys(t).filter(s=>!["default","bezier"].includes(s)).reduce((s,o)=>(s[o]=Me(t[o]||Wr),s),n);return{...e,...r}}function Pa(t,e,n=null){const r=((n==null?void 0:n.x)||0)+e.x,s=((n==null?void 0:n.y)||0)+e.y,o=(n==null?void 0:n.width)||e.width,i=(n==null?void 0:n.height)||e.height;switch(t){case exports.Position.Top:return{x:r+o/2,y:s};case exports.Position.Right:return{x:r+o,y:s+i/2};case exports.Position.Bottom:return{x:r+o/2,y:s+i};case exports.Position.Left:return{x:r,y:s+i/2}}}function Ma(t,e){return t?t.length===1||!e?t[0]:e&&t.find(n=>n.id===e)||null:null}const Dx=(t,e,n,r,s,o)=>{const i=Pa(n,t,e),a=Pa(o,r,s);return{sourceX:i.x,sourceY:i.y,targetX:a.x,targetY:a.y}};function $x({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:o,width:i,height:a,transform:l}){const c={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+s),y2:Math.max(t.y+r,e.y+o)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const u=Ko({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:i/l[2],height:a/l[2]}),h=Math.max(0,Math.min(u.x2,c.x2)-Math.max(u.x,c.x)),d=Math.max(0,Math.min(u.y2,c.y2)-Math.max(u.y,c.y));return Math.ceil(h*d)>0}function Ra(t){var r,s,o,i,a;const e=((r=t==null?void 0:t[lt])==null?void 0:r.handleBounds)||null,n=e&&(t==null?void 0:t.width)&&(t==null?void 0:t.height)&&typeof((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.x)<"u"&&typeof((o=t==null?void 0:t.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((i=t==null?void 0:t.positionAbsolute)==null?void 0:i.x)||0,y:((a=t==null?void 0:t.positionAbsolute)==null?void 0:a.y)||0,width:(t==null?void 0:t.width)||0,height:(t==null?void 0:t.height)||0},e,!!n]}const Ox=[{level:0,isMaxLevel:!0,edges:[]}];function zx(t,e,n=!1){let r=-1;const s=t.reduce((i,a)=>{var u,h;const l=Et(a.zIndex);let c=l?a.zIndex:0;if(n){const d=e.get(a.target),p=e.get(a.source),S=a.selected||(d==null?void 0:d.selected)||(p==null?void 0:p.selected),x=Math.max(((u=p==null?void 0:p[lt])==null?void 0:u.z)||0,((h=d==null?void 0:d[lt])==null?void 0:h.z)||0,1e3);c=(l?a.zIndex:0)+(S?x:0)}return i[c]?i[c].push(a):i[c]=[a],r=c>r?c:r,i},{}),o=Object.entries(s).map(([i,a])=>{const l=+i;return{edges:a,level:l,isMaxLevel:l===r}});return o.length===0?Ox:o}function Yx(t,e,n){const r=at(m.useCallback(s=>t?s.edges.filter(o=>{const i=e.get(o.source),a=e.get(o.target);return(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&$x({sourcePos:i.positionAbsolute||{x:0,y:0},targetPos:a.positionAbsolute||{x:0,y:0},sourceWidth:i.width,sourceHeight:i.height,targetWidth:a.width,targetHeight:a.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[t,e]));return zx(r,e,n)}const Lx=({color:t="none",strokeWidth:e=1})=>m.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),Ix=({color:t="none",strokeWidth:e=1})=>m.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),ka={[Xr.Arrow]:Lx,[Xr.ArrowClosed]:Ix};function Bx(t){const e=ht();return m.useMemo(()=>{var s,o;return Object.prototype.hasOwnProperty.call(ka,t)?ka[t]:((o=(s=e.getState()).onError)==null||o.call(s,"009",St.error009(t)),null)},[t])}const Fx=({id:t,type:e,color:n,width:r=12.5,height:s=12.5,markerUnits:o="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=Bx(e);return l?m.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:a,refX:"0",refY:"0"},m.createElement(l,{color:n,strokeWidth:i})):null},Ux=({defaultColor:t,rfId:e})=>n=>{const r=[];return n.edges.reduce((s,o)=>([o.markerStart,o.markerEnd].forEach(i=>{if(i&&typeof i=="object"){const a=mo(i,e);r.includes(a)||(s.push({id:a,color:i.color||t,...i}),r.push(a))}}),s),[]).sort((s,o)=>s.id.localeCompare(o.id))},nu=({defaultColor:t,rfId:e})=>{const n=at(m.useCallback(Ux({defaultColor:t,rfId:e}),[t,e]),(r,s)=>!(r.length!==s.length||r.some((o,i)=>o.id!==s[i].id)));return m.createElement("defs",null,n.map(r=>m.createElement(Fx,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};nu.displayName="MarkerDefinitions";var Zx=m.memo(nu);const Hx=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),ru=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:o,onEdgeUpdate:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:h,edgeUpdaterRadius:d,onEdgeDoubleClick:p,onEdgeUpdateStart:S,onEdgeUpdateEnd:x,children:b})=>{const{edgesFocusable:v,edgesUpdatable:M,elementsSelectable:C,width:w,height:N,connectionMode:E,nodeInternals:A,onError:O}=at(Hx,pt),Y=Yx(e,A,n);return w?m.createElement(m.Fragment,null,Y.map(({level:H,edges:D,isMaxLevel:U})=>m.createElement("svg",{key:H,style:{zIndex:H},width:w,height:N,className:"react-flow__edges react-flow__container"},U&&m.createElement(Zx,{defaultColor:t,rfId:r}),m.createElement("g",null,D.map(R=>{const[g,k,_]=Ra(A.get(R.source)),[z,I,T]=Ra(A.get(R.target));if(!_||!T)return null;let $=R.type||"default";s[$]||(O==null||O("011",St.error011($)),$="default");const B=s[$]||s.default,V=E===exports.ConnectionMode.Strict?I.target:(I.target??[]).concat(I.source??[]),q=Ma(k.source,R.sourceHandle),W=Ma(V,R.targetHandle),Q=(q==null?void 0:q.position)||exports.Position.Bottom,et=(W==null?void 0:W.position)||exports.Position.Top,nt=!!(R.focusable||v&&typeof R.focusable>"u"),st=typeof i<"u"&&(R.updatable||M&&typeof R.updatable>"u");if(!q||!W)return O==null||O("008",St.error008(q,R)),null;const{sourceX:F,sourceY:X,targetX:K,targetY:L}=Dx(g,q,Q,z,W,et);return m.createElement(B,{key:R.id,id:R.id,className:vt([R.className,o]),type:$,data:R.data,selected:!!R.selected,animated:!!R.animated,hidden:!!R.hidden,label:R.label,labelStyle:R.labelStyle,labelShowBg:R.labelShowBg,labelBgStyle:R.labelBgStyle,labelBgPadding:R.labelBgPadding,labelBgBorderRadius:R.labelBgBorderRadius,style:R.style,source:R.source,target:R.target,sourceHandleId:R.sourceHandle,targetHandleId:R.targetHandle,markerEnd:R.markerEnd,markerStart:R.markerStart,sourceX:F,sourceY:X,targetX:K,targetY:L,sourcePosition:Q,targetPosition:et,elementsSelectable:C,onEdgeUpdate:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:h,edgeUpdaterRadius:d,onEdgeDoubleClick:p,onEdgeUpdateStart:S,onEdgeUpdateEnd:x,rfId:r,ariaLabel:R.ariaLabel,isFocusable:nt,isUpdatable:st,pathOptions:"pathOptions"in R?R.pathOptions:void 0,interactionWidth:R.interactionWidth})})))),b):null};ru.displayName="EdgeRenderer";var Vx=m.memo(ru);const qx=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function Xx({children:t}){const e=at(qx);return m.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}function Wx(t){const e=Es(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const Gx={[exports.Position.Left]:exports.Position.Right,[exports.Position.Right]:exports.Position.Left,[exports.Position.Top]:exports.Position.Bottom,[exports.Position.Bottom]:exports.Position.Top},su=({nodeId:t,handleType:e,style:n,type:r=Kt.Bezier,CustomComponent:s,connectionStatus:o})=>{var E,A,O;const{fromNode:i,handleId:a,toX:l,toY:c,connectionMode:u}=at(m.useCallback(Y=>({fromNode:Y.nodeInternals.get(t),handleId:Y.connectionHandleId,toX:(Y.connectionPosition.x-Y.transform[0])/Y.transform[2],toY:(Y.connectionPosition.y-Y.transform[1])/Y.transform[2],connectionMode:Y.connectionMode}),[t]),pt),h=(E=i==null?void 0:i[lt])==null?void 0:E.handleBounds;let d=h==null?void 0:h[e];if(u===exports.ConnectionMode.Loose&&(d=d||(h==null?void 0:h[e==="source"?"target":"source"])),!i||!d)return null;const p=a?d.find(Y=>Y.id===a):d[0],S=p?p.x+p.width/2:(i.width??0)/2,x=p?p.y+p.height/2:i.height??0,b=(((A=i.positionAbsolute)==null?void 0:A.x)??0)+S,v=(((O=i.positionAbsolute)==null?void 0:O.y)??0)+x,M=p==null?void 0:p.position,C=M?Gx[M]:null;if(!M||!C)return null;if(s)return m.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:i,fromHandle:p,fromX:b,fromY:v,toX:l,toY:c,fromPosition:M,toPosition:C,connectionStatus:o});let w="";const N={sourceX:b,sourceY:v,sourcePosition:M,targetX:l,targetY:c,targetPosition:C};return r===Kt.Bezier?[w]=_l(N):r===Kt.Step?[w]=go({...N,borderRadius:0}):r===Kt.SmoothStep?[w]=go(N):r===Kt.SimpleBezier?[w]=Tl(N):w=`M${b},${v} ${l},${c}`,m.createElement("path",{d:w,fill:"none",className:"react-flow__connection-path",style:n})};su.displayName="ConnectionLine";const Kx=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function jx({containerStyle:t,style:e,type:n,component:r}){const{nodeId:s,handleType:o,nodesConnectable:i,width:a,height:l,connectionStatus:c}=at(Kx,pt);return!(s&&o&&a&&i)?null:m.createElement("svg",{style:t,width:a,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container"},m.createElement("g",{className:vt(["react-flow__connection",c])},m.createElement(su,{nodeId:s,handleType:o,style:e,type:n,CustomComponent:r,connectionStatus:c})))}function Na(t,e){const n=m.useRef(null),r=ht();return m.useMemo(()=>{var o,i;if(process.env.NODE_ENV==="development"){const a=Object.keys(t);pt(n.current,a)&&((i=(o=r.getState()).onError)==null||i.call(o,"002",St.error002())),n.current=a}return e(t)},[t])}const ou=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:o,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:c,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:d,onNodeContextMenu:p,onSelectionContextMenu:S,onSelectionStart:x,onSelectionEnd:b,connectionLineType:v,connectionLineStyle:M,connectionLineComponent:C,connectionLineContainerStyle:w,selectionKeyCode:N,selectionOnDrag:E,selectionMode:A,multiSelectionKeyCode:O,panActivationKeyCode:Y,zoomActivationKeyCode:H,deleteKeyCode:D,onlyRenderVisibleElements:U,elementsSelectable:R,selectNodesOnDrag:g,defaultViewport:k,translateExtent:_,minZoom:z,maxZoom:I,preventScrolling:T,defaultMarkerColor:$,zoomOnScroll:B,zoomOnPinch:V,panOnScroll:q,panOnScrollSpeed:W,panOnScrollMode:Q,zoomOnDoubleClick:et,panOnDrag:nt,onPaneClick:st,onPaneMouseEnter:F,onPaneMouseMove:X,onPaneMouseLeave:K,onPaneScroll:L,onPaneContextMenu:it,onEdgeUpdate:j,onEdgeContextMenu:J,onEdgeMouseEnter:ot,onEdgeMouseMove:ct,onEdgeMouseLeave:G,edgeUpdaterRadius:te,onEdgeUpdateStart:ee,onEdgeUpdateEnd:nn,noDragClassName:ve,noWheelClassName:ne,noPanClassName:qt,elevateEdgesOnSelect:be,disableKeyboardA11y:Xt,nodeOrigin:re,nodeExtent:rn,rfId:Ee})=>{const dt=Na(t,_x),yt=Na(e,Ax);return Wx(o),m.createElement(Ex,{onPaneClick:st,onPaneMouseEnter:F,onPaneMouseMove:X,onPaneMouseLeave:K,onPaneContextMenu:it,onPaneScroll:L,deleteKeyCode:D,selectionKeyCode:N,selectionOnDrag:E,selectionMode:A,onSelectionStart:x,onSelectionEnd:b,multiSelectionKeyCode:O,panActivationKeyCode:Y,zoomActivationKeyCode:H,elementsSelectable:R,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:B,zoomOnPinch:V,zoomOnDoubleClick:et,panOnScroll:q,panOnScrollSpeed:W,panOnScrollMode:Q,panOnDrag:nt,defaultViewport:k,translateExtent:_,minZoom:z,maxZoom:I,onSelectionContextMenu:S,preventScrolling:T,noDragClassName:ve,noWheelClassName:ne,noPanClassName:qt,disableKeyboardA11y:Xt},m.createElement(Xx,null,m.createElement(Vx,{edgeTypes:yt,onEdgeClick:a,onEdgeDoubleClick:c,onEdgeUpdate:j,onlyRenderVisibleElements:U,onEdgeContextMenu:J,onEdgeMouseEnter:ot,onEdgeMouseMove:ct,onEdgeMouseLeave:G,onEdgeUpdateStart:ee,onEdgeUpdateEnd:nn,edgeUpdaterRadius:te,defaultMarkerColor:$,noPanClassName:qt,elevateEdgesOnSelect:!!be,disableKeyboardA11y:Xt,rfId:Ee},m.createElement(jx,{style:M,type:v,component:C,containerStyle:w})),m.createElement("div",{className:"react-flow__edgelabel-renderer"}),m.createElement(Mx,{nodeTypes:dt,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:h,onNodeMouseLeave:d,onNodeContextMenu:p,selectNodesOnDrag:g,onlyRenderVisibleElements:U,noPanClassName:qt,noDragClassName:ve,disableKeyboardA11y:Xt,nodeOrigin:re,nodeExtent:rn,rfId:Ee})))};ou.displayName="GraphView";var Qx=m.memo(ou);const So=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Wt={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:So,nodeExtent:So,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:exports.ConnectionMode.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:Vr,isValidConnection:void 0},Jx=()=>fg((t,e)=>({...Wt,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:o}=e();t({nodeInternals:Zs(n,r,s,o)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=e();t({edges:n.map(s=>({...r,...s}))})},setDefaultNodesAndEdges:(n,r)=>{const s=typeof n<"u",o=typeof r<"u",i=s?Zs(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:i,edges:o?r:[],hasDefaultNodes:s,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:o,fitViewOnInitDone:i,fitViewOnInitOptions:a,domNode:l,nodeOrigin:c}=e(),u=l==null?void 0:l.querySelector(".react-flow__viewport");if(!u)return;const h=window.getComputedStyle(u),{m22:d}=new window.DOMMatrixReadOnly(h.transform),p=n.reduce((x,b)=>{const v=s.get(b.id);if(v){const M=Wo(b.nodeElement);!!(M.width&&M.height&&(v.width!==M.width||v.height!==M.height||b.forceUpdate))&&(s.set(v.id,{...v,[lt]:{...v[lt],handleBounds:{source:Ta(".source",b.nodeElement,d,c),target:Ta(".target",b.nodeElement,d,c)}},...M}),x.push({id:v.id,type:"dimensions",dimensions:M}))}return x},[]);Vl(s,c);const S=i||o&&!i&&ql(e,{initial:!0,...a});t({nodeInternals:new Map(s),fitViewOnInitDone:S}),(p==null?void 0:p.length)>0&&(r==null||r(p))},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:o}=e(),i=n.map(a=>{const l={id:a.id,type:"position",dragging:s};return r&&(l.positionAbsolute=a.positionAbsolute,l.position=a.position),l});o(i)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:o,nodeOrigin:i,getNodes:a,elevateNodesOnSelect:l}=e();if(n!=null&&n.length){if(o){const c=Wl(n,a()),u=Zs(c,s,i,l);t({nodeInternals:u})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:o}=e();let i,a=null;r?i=n.map(l=>Gt(l,!0)):(i=Ne(o(),n),a=Ne(s,[])),lr({changedNodes:i,changedEdges:a,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:o}=e();let i,a=null;r?i=n.map(l=>Gt(l,!0)):(i=Ne(s,n),a=Ne(o(),[])),lr({changedNodes:a,changedEdges:i,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:o}=e(),i=n||o(),a=r||s,l=i.map(u=>(u.selected=!1,Gt(u.id,!1))),c=a.map(u=>Gt(u.id,!1));lr({changedNodes:l,changedEdges:c,get:e,set:t})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:s}=e();r==null||r.scaleExtent([n,s]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:s}=e();r==null||r.scaleExtent([s,n]),t({maxZoom:n})},setTranslateExtent:n=>{var r;(r=e().d3Zoom)==null||r.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=e(),o=r().filter(a=>a.selected).map(a=>Gt(a.id,!1)),i=n.filter(a=>a.selected).map(a=>Gt(a.id,!1));lr({changedNodes:o,changedEdges:i,get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:r}=e();r.forEach(s=>{s.positionAbsolute=Go(s.position,n)}),t({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:o,d3Zoom:i,d3Selection:a,translateExtent:l}=e();if(!i||!a||!n.x&&!n.y)return!1;const c=jt.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),u=[[0,0],[s,o]],h=i==null?void 0:i.constrain()(c,u,l);return i.transform(a,h),r[0]!==h.x||r[1]!==h.y||r[2]!==h.k},cancelConnection:()=>t({connectionNodeId:Wt.connectionNodeId,connectionHandleId:Wt.connectionHandleId,connectionHandleType:Wt.connectionHandleType,connectionStatus:Wt.connectionStatus,connectionStartHandle:Wt.connectionStartHandle,connectionEndHandle:Wt.connectionEndHandle}),reset:()=>t({...Wt})}),Object.is),oi=({children:t})=>{const e=m.useRef(null);return e.current||(e.current=Jx()),m.createElement(w0,{value:e.current},t)};oi.displayName="ReactFlowProvider";const iu=({children:t})=>m.useContext(vs)?m.createElement(m.Fragment,null,t):m.createElement(oi,null,t);iu.displayName="ReactFlowWrapper";const tw={input:Ll,default:xo,output:Bl,group:ri},ew={default:Wr,straight:Jo,step:Qo,smoothstep:bs,simplebezier:jo},nw=[0,0],rw=[15,15],sw={x:0,y:0,zoom:1},ow={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},au=m.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:o=tw,edgeTypes:i=ew,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:u,onMoveStart:h,onMoveEnd:d,onConnect:p,onConnectStart:S,onConnectEnd:x,onClickConnectStart:b,onClickConnectEnd:v,onNodeMouseEnter:M,onNodeMouseMove:C,onNodeMouseLeave:w,onNodeContextMenu:N,onNodeDoubleClick:E,onNodeDragStart:A,onNodeDrag:O,onNodeDragStop:Y,onNodesDelete:H,onEdgesDelete:D,onSelectionChange:U,onSelectionDragStart:R,onSelectionDrag:g,onSelectionDragStop:k,onSelectionContextMenu:_,onSelectionStart:z,onSelectionEnd:I,connectionMode:T=exports.ConnectionMode.Strict,connectionLineType:$=Kt.Bezier,connectionLineStyle:B,connectionLineComponent:V,connectionLineContainerStyle:q,deleteKeyCode:W="Backspace",selectionKeyCode:Q="Shift",selectionOnDrag:et=!1,selectionMode:nt=Fn.Full,panActivationKeyCode:st="Space",multiSelectionKeyCode:F=qr()?"Meta":"Control",zoomActivationKeyCode:X=qr()?"Meta":"Control",snapToGrid:K=!1,snapGrid:L=rw,onlyRenderVisibleElements:it=!1,selectNodesOnDrag:j=!0,nodesDraggable:J,nodesConnectable:ot,nodesFocusable:ct,nodeOrigin:G=nw,edgesFocusable:te,edgesUpdatable:ee,elementsSelectable:nn,defaultViewport:ve=sw,minZoom:ne=.5,maxZoom:qt=2,translateExtent:be=So,preventScrolling:Xt=!0,nodeExtent:re,defaultMarkerColor:rn="#b1b1b7",zoomOnScroll:Ee=!0,zoomOnPinch:dt=!0,panOnScroll:yt=!1,panOnScrollSpeed:se=.5,panOnScrollMode:oe=he.Free,zoomOnDoubleClick:ie=!0,panOnDrag:zt=!0,onPaneClick:Rt,onPaneMouseEnter:sn,onPaneMouseMove:Ts,onPaneMouseLeave:on,onPaneScroll:_s,onPaneContextMenu:ai,children:ae,onEdgeUpdate:_u,onEdgeContextMenu:Cu,onEdgeDoubleClick:Pu,onEdgeMouseEnter:Mu,onEdgeMouseMove:Ru,onEdgeMouseLeave:ku,onEdgeUpdateStart:Nu,onEdgeUpdateEnd:Au,edgeUpdaterRadius:Du=10,onNodesChange:$u,onEdgesChange:Ou,noDragClassName:zu="nodrag",noWheelClassName:Yu="nowheel",noPanClassName:ci="nopan",fitView:Lu=!1,fitViewOptions:Iu,connectOnClick:Bu=!0,attributionPosition:Fu,proOptions:Uu,defaultEdgeOptions:Zu,elevateNodesOnSelect:Hu=!0,elevateEdgesOnSelect:Vu=!1,disableKeyboardA11y:li=!1,autoPanOnConnect:qu=!0,autoPanOnNodeDrag:Xu=!0,connectionRadius:Wu=20,isValidConnection:Gu,onError:Ku,style:ju,id:ui,nodeDragThreshold:Qu,...Ju},th)=>{const Cs=ui||"1";return m.createElement("div",{...Ju,style:{...ju,...ow},ref:th,className:vt(["react-flow",s]),"data-testid":"rf__wrapper",id:ui},m.createElement(iu,null,m.createElement(Qx,{onInit:c,onMove:u,onMoveStart:h,onMoveEnd:d,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:M,onNodeMouseMove:C,onNodeMouseLeave:w,onNodeContextMenu:N,onNodeDoubleClick:E,nodeTypes:o,edgeTypes:i,connectionLineType:$,connectionLineStyle:B,connectionLineComponent:V,connectionLineContainerStyle:q,selectionKeyCode:Q,selectionOnDrag:et,selectionMode:nt,deleteKeyCode:W,multiSelectionKeyCode:F,panActivationKeyCode:st,zoomActivationKeyCode:X,onlyRenderVisibleElements:it,selectNodesOnDrag:j,defaultViewport:ve,translateExtent:be,minZoom:ne,maxZoom:qt,preventScrolling:Xt,zoomOnScroll:Ee,zoomOnPinch:dt,zoomOnDoubleClick:ie,panOnScroll:yt,panOnScrollSpeed:se,panOnScrollMode:oe,panOnDrag:zt,onPaneClick:Rt,onPaneMouseEnter:sn,onPaneMouseMove:Ts,onPaneMouseLeave:on,onPaneScroll:_s,onPaneContextMenu:ai,onSelectionContextMenu:_,onSelectionStart:z,onSelectionEnd:I,onEdgeUpdate:_u,onEdgeContextMenu:Cu,onEdgeDoubleClick:Pu,onEdgeMouseEnter:Mu,onEdgeMouseMove:Ru,onEdgeMouseLeave:ku,onEdgeUpdateStart:Nu,onEdgeUpdateEnd:Au,edgeUpdaterRadius:Du,defaultMarkerColor:rn,noDragClassName:zu,noWheelClassName:Yu,noPanClassName:ci,elevateEdgesOnSelect:Vu,rfId:Cs,disableKeyboardA11y:li,nodeOrigin:G,nodeExtent:re}),m.createElement(G0,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:S,onConnectEnd:x,onClickConnectStart:b,onClickConnectEnd:v,nodesDraggable:J,nodesConnectable:ot,nodesFocusable:ct,edgesFocusable:te,edgesUpdatable:ee,elementsSelectable:nn,elevateNodesOnSelect:Hu,minZoom:ne,maxZoom:qt,nodeExtent:re,onNodesChange:$u,onEdgesChange:Ou,snapToGrid:K,snapGrid:L,connectionMode:T,translateExtent:be,connectOnClick:Bu,defaultEdgeOptions:Zu,fitView:Lu,fitViewOptions:Iu,onNodesDelete:H,onEdgesDelete:D,onNodeDragStart:A,onNodeDrag:O,onNodeDragStop:Y,onSelectionDrag:g,onSelectionDragStart:R,onSelectionDragStop:k,noPanClassName:ci,nodeOrigin:G,rfId:Cs,autoPanOnConnect:qu,autoPanOnNodeDrag:Xu,onError:Ku,connectionRadius:Wu,isValidConnection:Gu,nodeDragThreshold:Qu}),m.createElement(X0,{onSelectionChange:U}),ae,m.createElement(b0,{proOptions:Uu,position:Fu}),m.createElement(tx,{rfId:Cs,disableKeyboardA11y:li})))});au.displayName="ReactFlow";function iw(){const t=ht();return m.useCallback(e=>{const{domNode:n,updateNodeDimensions:r}=t.getState(),o=(Array.isArray(e)?e:[e]).reduce((i,a)=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${a}"]`);return l&&i.push({id:a,nodeElement:l,forceUpdate:!0}),i},[]);requestAnimationFrame(()=>r(o))},[])}function aw({onStart:t,onChange:e,onEnd:n}){const r=ht();m.useEffect(()=>{r.setState({onViewportChangeStart:t})},[t]),m.useEffect(()=>{r.setState({onViewportChange:e})},[e]),m.useEffect(()=>{r.setState({onViewportChangeEnd:n})},[n])}const cu=t=>t.map(e=>({...e,id:e.key,type:"custom",data:{}})),lu=t=>t.map(({segments:e,color:n,...r})=>({...r,id:r.key,data:{segments:e,color:n}})),cw=t=>t.map(e=>({key:e.id,selected:e.selected,...e})),lw=(t,e)=>t.map(n=>{var r;return n.data==null&&(n.data={segments:[],selected:!1}),{key:n.id,segments:n.data.segments,selected:n.selected,color:(r=n.data)==null?void 0:r.color,...n}}),uw=t=>({...t.position,zoom:t.zoom}),uu=t=>({position:f.xy.construct(t),zoom:t.zoom}),hw=(t,e)=>cw(e(cu(t))),fw=(t,e)=>lw(e(lu(t))),ii=P.z.object({position:f.xy.xy,zoom:P.z.number(),region:f.box$1.box,clearOverscan:f.xy.crudeZ.optional().default(10)}),Xs=["upper2d","lower2d"],hu=()=>{const t=Es();return m.useRef(uu(t.getViewport())).current},Tn=class Tn extends Z.Composite{constructor(){super(...arguments);y(this,"eraser",new Xn);y(this,"schema",Tn.stateZ)}afterUpdate(){this.internal.renderCtx=gt.use(this.ctx),this.internal.addStatus=Z.useAggregate(this.ctx),xt.control(this.ctx,()=>this.requestRender()),this.requestRender()}afterDelete(){this.requestRender()}async render(){if(this.deleted)return;const{renderCtx:n,addStatus:r}=this.internal,{zoom:s,position:o}=this.state,i=f.box$1.construct(this.state.region),a=n.scissor(i,f.xy.ZERO,Xs),l=f.scale.XY.magnify(f.xy.construct(s)).translate(f.box$1.topLeft(i)).translate(o);try{await Promise.all(this.children.map(async c=>await c.render({viewportScale:l})))}catch(c){r({variant:"error",message:c.message})}finally{a()}return()=>this.eraser.erase(this.internal.renderCtx,this.state.region,this.prevState.region,this.state.clearOverscan,Xs)}requestRender(){const{renderCtx:n}=this.internal;n.loop.set({key:this.key,render:async()=>await this.render(),priority:"high",canvases:Xs})}};y(Tn,"TYPE","Diagram"),y(Tn,"stateZ",ii);let Qe=Tn;const fu={[Qe.TYPE]:Qe},dw=Object.freeze(Object.defineProperty({__proto__:null,Diagram:Qe,REGISTRY:fu,diagramStateZ:ii,useInitialViewport:hu},Symbol.toStringTag,{value:"Module"})),du=P.z.object({}),Aa="control-state-provider",pw=Z.external.stateZ.extend({subjectColor:f.Color.z});class Je extends Z.Composite{constructor(){super(...arguments);y(this,"schema",du);y(this,"colors",new Map);y(this,"tracker");y(this,"disconnectTrackerChange");y(this,"obs",new f.observe.Observer)}static use(n){return n.get(Aa)}afterUpdate(){this.internal.instrumentation=qn(this.ctx,"control-state");const n=Z.use(this.ctx);this.internal.palette=n.colors.visualization.palettes.default,this.internal.defaultColor=n.colors.gray.l6;const r=ps(this.ctx);r!==this.internal.client&&(this.internal.client=r,this.ctx.set(Aa,this),this.internal.client!=null&&(this.internal.instrumentation.L.debug("starting state tracker"),this.startUpdating(this.internal.client)))}afterDelete(){var n,r;(n=this.disconnectTrackerChange)==null||n.call(this),(r=this.tracker)==null||r.close().catch(s=>this.internal.instrumentation.L.error("error",{error:s}))}onChange(n){return this.obs.onChange(n)}get(n){return Array.isArray(n)?f.unique(n).map(r=>this.getOne(r)).filter(r=>r!=null):this.getOne(n)}getOne(n){if(this.tracker==null)return;const r=this.tracker.states.get(n);if(r!=null)return{...r,subjectColor:this.colors.get(r.subject.key)??this.internal.defaultColor}}async startUpdating(n){const{instrumentation:r}=this.internal;try{this.tracker=await Z.external.StateTracker.open(n.telem)}catch{r.L.error("failed to open state tracker");return}this.disconnectTrackerChange=this.tracker.onChange(s=>{if(r.L.debug("transfer",{transfers:s.map(o=>Z.external.transferString(o))}),this.tracker==null)throw new Z.UnexpectedError("tracker is null inside it's own onChange callback!");this.updateColors(this.tracker),this.obs.notify(s)})}updateColors(n){const r=n.subjects(),s=r.map(a=>a.key),o=Array.from(this.colors.values());this.colors.forEach((a,l)=>!s.includes(l)&&this.colors.delete(l));const{palette:i}=this.internal;r.forEach(a=>{if(this.colors.has(a.key))return;const l=i.find(c=>!o.includes(c))??i[0];this.colors.set(a.key,l),o.push(l)})}}y(Je,"TYPE","StateProvider");const gw=["acquired","released","overridden","failed"],mw=P.z.enum(gw),pu=P.z.object({name:P.z.string(),authority:P.z.number().default(0),acquireTrigger:P.z.number(),status:mw.optional(),needsControlOf:Z.external$6.keyZ.array().optional().default([])});class Gr extends Z.Composite{constructor(){super(...arguments);y(this,"schema",pu);y(this,"registry",new Map);y(this,"writer")}afterUpdate(){this.internal.instrumentation=qn(this.ctx),(this.internal.prevTrigger==null||Math.abs(this.state.acquireTrigger-this.internal.prevTrigger)>1)&&(this.internal.prevTrigger=this.state.acquireTrigger);const n=ps(this.ctx),r=Je.use(this.ctx);this.internal.client=n,this.internal.stateProv=r,Fa(this.ctx,this),this.internal.addStatus=Z.useAggregate(this.ctx),this.state.acquireTrigger>this.internal.prevTrigger?(this.acquire(),this.internal.prevTrigger=this.state.acquireTrigger):this.state.acquireTrigger<this.internal.prevTrigger&&(this.release(),this.internal.prevTrigger=this.state.acquireTrigger)}afterDelete(){this.release()}async updateNeedsControlOf(){if(this.internal.client==null)throw new Z.UnexpectedError("No cluster connected but channelKeys were requested");const n=new Set([]);for(const s of this.registry.keys())(await s.needsControlOf(this.internal.client)).forEach(i=>i!==0&&n.add(i));const r=Array.from(n);f.compare.unorderedPrimitiveArrays(this.state.needsControlOf,r)!==f.compare.EQUAL&&this.setState(s=>({...s,needsControlOf:r}))}async acquire(){const{client:n,addStatus:r}=this.internal;if(n==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} - no channels to control!`,variant:"warning"});this.writer=await n.telem.newWriter({start:Z.TimeStamp.now(),channels:s,controlSubject:{key:this.key,name:this.state.name},authorities:this.state.authority}),this.setState(o=>({...o,status:"acquired"})),r({message:`Acquired control on ${this.state.name}`,variant:"success"})}catch(s){this.setState(o=>({...o,status:"failed"})),r({message:`${this.state.name} failed to acquire control: ${s.message}`,variant:"error"})}}async release(){var n;await((n=this.writer)==null?void 0:n.close()),!this.deleted&&(this.setState(r=>({...r,status:"released"})),this.writer!=null&&this.internal.addStatus({message:`Released control on ${this.state.name}.`,variant:"success"}),this.writer=void 0)}async set(n){var r;this.writer==null&&await this.acquire(),await((r=this.writer)==null?void 0:r.write(n))}async setAuthority(n,r){var s;this.writer==null&&await this.acquire(),await((s=this.writer)==null?void 0:s.setAuthority(Object.fromEntries(n.map(o=>[o,r]))))}async releaseAuthority(n){var r;this.writer==null&&await this.acquire(),await((r=this.writer)==null?void 0:r.setAuthority(Object.fromEntries(n.map(s=>[s,this.state.authority]))))}deleteTelem(n){this.registry.delete(n),this.updateNeedsControlOf()}create(n){const s=(()=>{switch(n.type){case Kr.TYPE:{const o=new Kr(this,n.props);return this.registry.set(o,null),o}case Qr.TYPE:{const o=new Qr(this,this.internal.stateProv,n.props);return this.registry.set(o,null),o}case jr.TYPE:return new jr(this,n.props);default:return null}})();return s!=null&&this.updateNeedsControlOf(),s}}y(Gr,"TYPE","Controller");const gu=P.z.object({channel:P.z.number()});class Kr extends us{constructor(n,r){super(r);y(this,"controller");y(this,"schema",gu);this.controller=n}invalidate(){}cleanup(){this.controller.deleteTelem(this)}async needsControlOf(n){if(this.props.channel===0)return[];const r=await n.channels.retrieve(this.props.channel),s=[r.key];return r.index!==0&&s.push(r.index),s}async set(n){const{client:r}=this.controller.internal;if(r==null)return;const s=await r.channels.retrieve(this.props.channel),o=await r.channels.retrieve(s.index),i=new Z.external$5.Frame([s.key,o.key],[new Z.Series(new s.dataType.Array([n])),new Z.Series(new o.dataType.Array([BigInt(Z.TimeStamp.now())]))]);await this.controller.set(i)}}y(Kr,"TYPE","controlled-numeric-telem-sink");const yw=t=>({type:Kr.TYPE,props:t,variant:"sink",valueType:"number"}),xw=P.z.object({authority:P.z.number().default(Z.Authority.ABSOLUTE.valueOf()),channel:P.z.number()});class jr extends us{constructor(n,r){super(r);y(this,"controller");y(this,"schema",xw);this.controller=n}cleanup(){this.controller.deleteTelem(this)}async needsControlOf(n){const r=await n.channels.retrieve(this.props.channel),s=[r.key];return r.index!==0&&s.push(r.index),s}async set(n){const{controller:r}=this,{client:s}=r.internal;if(s==null)return;const o=await s.channels.retrieve(this.props.channel),i=[o.key];o.index!==0&&i.push(o.index),n?await this.controller.setAuthority(i,this.props.authority):await this.controller.releaseAuthority(i)}}y(jr,"TYPE","acquire-channel-control");const ww=t=>({type:jr.TYPE,props:t,variant:"sink",valueType:"boolean"}),Sw=P.z.object({channel:P.z.number()});class Qr extends Tt{constructor(n,r,s){super(s);y(this,"prov");y(this,"valid",!1);y(this,"stopListening");y(this,"controller");y(this,"schema",Sw);this.prov=r,this.controller=n}async needsControlOf(){return[]}maybeRevalidate(){var s;if(this.valid)return;const{channel:n}=this.props;(s=this.stopListening)==null||s.call(this);const r=Z.external.filterTransfersByChannelKey(n);this.stopListening=this.prov.onChange(o=>{var i;r(o).length!==0&&((i=this.notify)==null||i.call(this))}),this.valid=!0}async value(){this.maybeRevalidate();const n=this.prov.get(this.props.channel),r=Z.TimeStamp.now();return n==null?{key:this.controller.key,variant:"disabled",message:"Uncontrolled",time:r}:{key:n.subject.key,variant:n.subject.key===this.controller.key?"success":"error",message:`Controlled by ${n.subject.name}`,time:r,data:{color:n.subjectColor,authority:n.authority}}}cleanup(){var n;this.controller.deleteTelem(this),(n=this.stopListening)==null||n.call(this)}}y(Qr,"TYPE","controlled-status-source");const vw=t=>({type:Qr.TYPE,props:t,variant:"source",valueType:"status"}),mu=P.z.object({statusSource:vo.optional().default(To),colorSource:za.optional().default(Za),status:Z.specZ$1,color:f.Color.z.optional()});class Jr extends Z.Leaf{constructor(){super(...arguments);y(this,"schema",mu)}afterUpdate(){const{internal:n}=this;n.statusSource=Ut(this.ctx,this.state.statusSource,n.statusSource),n.colorSource=Ut(this.ctx,this.state.colorSource,n.colorSource),this.updateState(),n.statusSource.onChange(()=>{this.updateState()}),n.colorSource.onChange(()=>{this.updateState()})}afterDelete(){var n,r,s,o;(r=(n=this.internal.statusSource).cleanup)==null||r.call(n),(o=(s=this.internal.colorSource).cleanup)==null||o.call(s)}async render(){}async updateState(){const n=await this.internal.colorSource.value(),r=await this.internal.statusSource.value();n.equals(this.state.color)&&r.message===this.state.status.message||this.setState(s=>({...s,color:n,status:r}))}}y(Jr,"TYPE","Indicator");const yu=P.z.object({triggered:P.z.boolean(),status:Z.specZ$1,sink:cs.optional().default(ds),source:vo.optional().default(To)});class ts extends Z.Leaf{constructor(){super(...arguments);y(this,"schema",yu)}afterUpdate(){const{sink:n,source:r}=this.state;this.internal.source=Ut(this.ctx,r,this.internal.source),this.internal.sink=fs(this.ctx,n,this.internal.sink),this.state.triggered&&!this.prevState.triggered&&this.internal.sink.set(this.state.status.variant!=="success").catch(console.error),(async()=>{var s,o;await this.updateEnabledState(),(o=(s=this.internal).stopListening)==null||o.call(s),this.internal.stopListening=this.internal.source.onChange(()=>{this.updateEnabledState()})})()}async updateEnabledState(){const n=await this.internal.source.value();n.time.equals(this.state.status.time)||this.setState(r=>({...r,status:n,triggered:!1}))}afterDelete(){var n,r,s,o;(r=(n=this.internal.source).cleanup)==null||r.call(n),(o=(s=this.internal.sink).cleanup)==null||o.call(s)}render(){}}y(ts,"TYPE","Chip");const xu=P.z.object({needsControlOf:Z.external$6.keyZ.array(),states:pw.array()});class es extends Z.Leaf{constructor(){super(...arguments);y(this,"schema",xu)}afterUpdate(){var i;const{internal:n}=this;n.stateProv=Je.use(this.ctx);const r=this.state.needsControlOf;(i=n.disconnectStateProv)==null||i.call(n);const s=Z.external.filterTransfersByChannelKey(...r),o=n.stateProv.get(r);this.setState(a=>({...a,states:o})),n.disconnectStateProv=n.stateProv.onChange(a=>{if(s(a).length===0)return;const l=n.stateProv.get(r);this.setState(c=>({...c,states:l}))})}afterDelete(){var r;const{internal:n}=this;(r=n.disconnectStateProv)==null||r.call(n)}async render(){}}y(es,"TYPE","Legend");const bw={[Gr.TYPE]:Gr,[Je.TYPE]:Je,[Jr.TYPE]:Jr,[ts.TYPE]:ts,[es.TYPE]:es},wu=P.z.object({trigger:P.z.number(),sink:cs.optional().default(ds)});class ns extends Z.Leaf{constructor(){super(...arguments);y(this,"schema",wu)}afterUpdate(){const{internal:n}=this;n.sink=fs(this.ctx,this.state.sink,n.sink),this.state.trigger>this.prevState.trigger&&this.internal.sink.set(!0).catch(console.error)}render(){}afterDelete(){var r,s;const{internal:n}=this;(s=(r=n.sink).cleanup)==null||s.call(r)}}y(ns,"TYPE","Button");const Ew={[ns.TYPE]:ns},Su=P.z.object({triggered:P.z.boolean(),enabled:P.z.boolean(),sink:cs.optional().default(ds),source:Oa.optional().default(Ua)});class rs extends Z.Leaf{constructor(){super(...arguments);y(this,"schema",Su)}afterUpdate(){const{sink:n,source:r}=this.state;this.internal.source=Ut(this.ctx,r,this.internal.source),this.internal.sink=fs(this.ctx,n,this.internal.sink),this.state.triggered&&!this.prevState.triggered&&this.internal.sink.set(!this.state.enabled).catch(console.error),(async()=>{var s,o;await this.updateEnabledState(),(o=(s=this.internal).stopListening)==null||o.call(s),this.internal.stopListening=this.internal.source.onChange(()=>{this.updateEnabledState()})})()}async updateEnabledState(){const n=await this.internal.source.value();n!==this.state.enabled&&this.setState(r=>({...r,enabled:n,triggered:!1}))}afterDelete(){var n,r,s,o;(r=(n=this.internal.source).cleanup)==null||r.call(n),(o=(s=this.internal.sink).cleanup)==null||o.call(s)}render(){}}y(rs,"TYPE","Toggle");const Tw={[rs.TYPE]:rs},_w=P.z.object({box:f.box$1.box,telem:bo.optional().default(Eo),font:P.z.string().optional().default(""),color:f.Color.z.optional().default(f.ZERO),precision:P.z.number().optional().default(2),width:P.z.number().optional().default(100)}),_n=class _n extends Z.Leaf{constructor(){super(...arguments);y(this,"schema",_n.z)}afterUpdate(){const{internal:n}=this;n.render=gt.use(this.ctx);const r=Z.use(this.ctx);this.state.font.length===0&&(this.state.font=xn.fontString(r,"p")),this.state.color.isZero?this.internal.textColor=r.colors.gray.l8:n.textColor=this.state.color,n.telem=Ut(this.ctx,this.state.telem,n.telem),this.internal.telem.onChange(()=>this.requestRender()),this.internal.requestRender=xt.useOptionalRequest(this.ctx),this.requestRender()}afterDelete(){var o;const{requestRender:n,telem:r,render:s}=this.internal;(o=r.cleanup)==null||o.call(r),n==null?s.erase(f.box$1.construct(this.state.box),f.xy.ZERO,"lower2d"):n($t)}requestRender(){const{requestRender:n}=this.internal;n!=null?n($t):this.render({})}async render({viewportScale:n=f.scale.XY.IDENTITY}){const{render:r,telem:s}=this.internal,o=f.box$1.construct(this.state.box);if(f.box$1.isZero(o))return;const i=r.lower2d.applyScale(n),a=await s.value();i.font=this.state.font;const l=mr.dimensions(a,this.state.font,i);this.internal.requestRender==null&&r.erase(f.box$1.construct(this.prevState.box)),this.state.width<l.width&&this.setState(u=>({...u,width:l.width}));const c=f.xy.couple(f.xy.translate(f.box$1.topLeft(o),{x:f.box$1.width(o)/2,y:f.box$1.height(o)/2},{y:l.height/2,x:-l.width/2}));i.fillStyle=this.internal.textColor.hex,i.fillText(a,...c)}};y(_n,"TYPE","value"),y(_n,"z",_w);let tn=_n;const vu={[tn.TYPE]:tn},Cw=Object.freeze(Object.defineProperty({__proto__:null,REGISTRY:vu,Value:tn},Symbol.toStringTag,{value:"Module"})),bu=P.z.object({region:f.box$1.box,widths:P.z.array(P.z.number())});class ss extends Z.Composite{constructor(){super(...arguments);y(this,"schema",bu);y(this,"erase",new Xn)}afterUpdate(){this.internal.renderCtx=gt.use(this.ctx),this.internal.renderCtx.loop.set({key:this.key,render:async()=>await this.render(),canvases:["upper2d"],priority:"high"})}async render(){let n=f.box$1.top(this.state.region);for(const r of this.children)await r.render({pos:{x:f.box$1.left(this.state.region),y:n},widths:this.state.widths}),n+=await r.height();return async({canvases:r})=>{var s;this.erase.erase(this.internal.renderCtx,this.state.region,(s=this.prevState)==null?void 0:s.region,f.xy.construct(10),r)}}}y(ss,"TYPE","Table");const Eu=P.z.object({height:P.z.number()});class os extends Z.Composite{constructor(){super(...arguments);y(this,"schema",Eu)}async render({pos:n,widths:r}){const s=this.state.height;let o=n.x;const i=0;for(const a of this.children)await a.render({box:f.box$1.construct(o,n.y,r[i],s)}),o+=r[i]}async height(){return this.state.height}}y(os,"TYPE","TR");const Tu=P.z.object({stringSource:bo.optional().default(Eo),level:P.z.string().optional().default("small"),color:f.Color.z.optional().default(f.ZERO)});class is extends Z.Leaf{constructor(){super(...arguments);y(this,"schema",Tu)}afterUpdate(){const{internal:n}=this;n.stringSource=Ut(this.ctx,this.state.stringSource,n.stringSource),n.draw=new ms(gt.use(this.ctx).upper2d,Z.use(this.ctx))}async render({box:n}){const r=await this.internal.stringSource.value();this.internal.draw.drawTextInCenter({text:r,level:"small",box:n})}}y(is,"TYPE","StringTD");const Pw={[ss.TYPE]:ss,[os.TYPE]:os,[is.TYPE]:is};exports.AbstractSink=us;exports.AbstractSource=Tt;exports.Base=ls;exports.BaseEdge=en;exports.BaseProvider=$n;exports.BooleanStatus=Fe;exports.Button=ns;exports.Canvas=Mr;exports.ChannelData=Rn;exports.Chip=ts;exports.CompoundTelemFactory=ic;exports.Context=gt;exports.Controller=xt;exports.Controller$1=Gr;exports.Diagram=dw;exports.Diagram$1=Qe;exports.Eraser=Xn;exports.Eraser$1=Br;exports.FixedNumber=An;exports.FixedString=Dn;exports.GLProgram=Mo;exports.Handle$1=Un;exports.Indicator=Jr;exports.IterativeSeries=Nn;exports.Legend=es;exports.Line=On;exports.LinePlot=Ir;exports.Loop=fc;exports.Mean=Be;exports.Measure=We;exports.MultiSourceTransformer=Ya;exports.NoopFactory=Ha;exports.PipelineFactory=Xa;exports.Provider=_r;exports.Provider$1=Qs;exports.REASON_DATA=Js;exports.REASON_LAYOUT=$t;exports.REASON_TOOL=pe;exports.REGISTRY=Hh;exports.REGISTRY$1=tg;exports.REGISTRY$10=Vc;exports.REGISTRY$11=bw;exports.REGISTRY$12=Ew;exports.REGISTRY$13=Nh;exports.REGISTRY$14=eg;exports.REGISTRY$15=Pw;exports.REGISTRY$2=pc;exports.REGISTRY$3=lc;exports.REGISTRY$4=sf;exports.REGISTRY$5=vu;exports.REGISTRY$6=Tw;exports.REGISTRY$7=fu;exports.REGISTRY$8=Zc;exports.REGISTRY$9=Hc;exports.ReactFlow=au;exports.ReactFlowProvider=oi;exports.RemoteFactory=ja;exports.Rule=qe;exports.Setpoint=Le;exports.SinkPipeline=Pn;exports.SourcePipeline=Cn;exports.StateProvider=Je;exports.StaticFactory=Qa;exports.StreamChannelData=kn;exports.StreamChannelValue=Mn;exports.StringTD=is;exports.StringifyNumber=Ue;exports.TR=os;exports.Table=ss;exports.Toggle=rs;exports.Tooltip=Xe;exports.TransformerFactory=rc;exports.UnarySinkTransformer=La;exports.UnarySourceTransformer=hs;exports.Value=tn;exports.WithinBounds=Ie;exports.XAxis=Ln;exports.YAxis=Lr;exports.ZERO_CONTEXT_VALUE=_o;exports.acquireChannelControl=ww;exports.addEdge=Pl;exports.aether=Kp;exports.applyEdgeChanges=px;exports.applyNodeChanges=Wl;exports.authoritySource=vw;exports.booleanSinkSpecZ=cs;exports.booleanSinkTransformerSpecZ=sh;exports.booleanSourceSpecZ=Oa;exports.booleanSourceTransformerSpecZ=oh;exports.booleanStatus=Rh;exports.booleanStatusProps=sc;exports.buttonStateZ=wu;exports.canvas=cf;exports.canvasStateZ=Ro;exports.cc=vt;exports.channelData=mh;exports.chipStateZ=yu;exports.colorSourceSpecZ=za;exports.controllerStateZ=pu;exports.coreAxisStateZ=Kn;exports.diagramStateZ=ii;exports.edgeConverter=fw;exports.eraserStateZ=Xc;exports.factory=ac;exports.filterGridPositions=le;exports.fixedArray=wh;exports.fixedNumber=vh;exports.fixedNumberPropsZ=ec;exports.fixedSeriesPropsZ=Ja;exports.fixedString=bh;exports.fixedStringPropsZ=nc;exports.indicatorStateZ=mu;exports.iterativeArray=Sh;exports.iterativeSeriesPropsZ=tc;exports.legendStateZ=xu;exports.linePlotStateZ=qc;exports.mean=Mh;exports.measure=Jp;exports.measureStateZ=Uo;exports.nodeConverter=hw;exports.noopBooleanSinkSpec=ds;exports.noopBooleanSourceSpec=Ua;exports.noopColorSourceSpec=Za;exports.noopNumericSinkSpec=lh;exports.noopNumericSourceSpec=uh;exports.noopStatusSourceSpec=To;exports.noopStringSourceSpec=Eo;exports.numberSinkSpecZ=ah;exports.numberSourceSpecZ=ih;exports.parseAutoBounds=Uc;exports.provider=Dh;exports.providerStateZ=hc;exports.providerStateZ$1=cc;exports.registerFactory=Fa;exports.ruleStateZ=Bo;exports.seriesSourceSpecZ=Ks;exports.setChannelValue=yw;exports.setChannelValuePropsZ=gu;exports.setProvider=Ba;exports.setpoint=Th;exports.shallow$1=pt;exports.shouldUpdate=ch;exports.sinkPipeline=dh;exports.sinkPipelinePropsZ=Wa;exports.sinkSpecZ=as;exports.sinkTransformerSpecZ=$a;exports.sourcePipeline=fh;exports.sourcePipelinePropsZ=qa;exports.sourceSpecZ=Jt;exports.sourceTransformerSpecZ=Da;exports.specZ=Hn;exports.stateProviderStateZ=du;exports.stateZ=dc;exports.statusSourceSpecZ=vo;exports.streamChannelData=yh;exports.streamChannelValue=xh;exports.streamChannelValuePropsZ=Ga;exports.stringSourceSpecZ=bo;exports.stringTDStateZ=Tu;exports.stringifyNumber=kh;exports.stringifyNumberProps=oc;exports.tableStateZ=bu;exports.toggleStateZ=Su;exports.tooltip=Qp;exports.tooltipStateZ=Fo;exports.trStateZ=Eu;exports.translateEdgesForward=lu;exports.translateNodesForward=cu;exports.translateViewportBackward=uu;exports.translateViewportForward=uw;exports.updateEdge=Y0;exports.useInitialViewport=hu;exports.useOnViewportChange=aw;exports.useProvider=Vn;exports.useReactFlow=Es;exports.useSink=fs;exports.useSource=Ut;exports.useStore=at;exports.useUpdateNodeInternals=iw;exports.value=Cw;exports.withinBounds=Ch;exports.withinSizeThreshold=Ic;exports.xAxisStateZ=Gp;exports.yAxisStateZ=jp;
|
|
69
|
+
//# sourceMappingURL=table-NIrLpFOm.cjs.map
|