@launchsecure/launch-kit 0.0.25 → 0.0.26
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/README.md +50 -0
- package/dist/beacon/beacon.mjs +1016 -0
- package/dist/beacon/beacon.mjs.map +1 -0
- package/dist/beacon/beacon.umd.js +87 -0
- package/dist/beacon/beacon.umd.js.map +1 -0
- package/dist/beacon/index-DAIDnjfR.mjs +513 -0
- package/dist/beacon/index-DAIDnjfR.mjs.map +1 -0
- package/dist/beacon/types/capture/element.d.ts +3 -0
- package/dist/beacon/types/capture/element.d.ts.map +1 -0
- package/dist/beacon/types/capture/framework.d.ts +3 -0
- package/dist/beacon/types/capture/framework.d.ts.map +1 -0
- package/dist/beacon/types/capture/metadata.d.ts +3 -0
- package/dist/beacon/types/capture/metadata.d.ts.map +1 -0
- package/dist/beacon/types/capture/overlay.d.ts +7 -0
- package/dist/beacon/types/capture/overlay.d.ts.map +1 -0
- package/dist/beacon/types/capture/picker.d.ts +12 -0
- package/dist/beacon/types/capture/picker.d.ts.map +1 -0
- package/dist/beacon/types/capture/screenshot.d.ts +7 -0
- package/dist/beacon/types/capture/screenshot.d.ts.map +1 -0
- package/dist/beacon/types/capture/selector.d.ts +2 -0
- package/dist/beacon/types/capture/selector.d.ts.map +1 -0
- package/dist/beacon/types/element.d.ts +50 -0
- package/dist/beacon/types/element.d.ts.map +1 -0
- package/dist/beacon/types/index.d.ts +4 -0
- package/dist/beacon/types/index.d.ts.map +1 -0
- package/dist/beacon/types/transport/submit.d.ts +3 -0
- package/dist/beacon/types/transport/submit.d.ts.map +1 -0
- package/dist/beacon/types/types.d.ts +88 -0
- package/dist/beacon/types/types.d.ts.map +1 -0
- package/dist/beacon/types/ui/button.d.ts +2 -0
- package/dist/beacon/types/ui/button.d.ts.map +1 -0
- package/dist/beacon/types/ui/drawer.d.ts +31 -0
- package/dist/beacon/types/ui/drawer.d.ts.map +1 -0
- package/dist/beacon/types/ui/icons.d.ts +9 -0
- package/dist/beacon/types/ui/icons.d.ts.map +1 -0
- package/dist/beacon/types/ui/pick-mode-overlay.d.ts +25 -0
- package/dist/beacon/types/ui/pick-mode-overlay.d.ts.map +1 -0
- package/dist/beacon/types/ui/pin-popover.d.ts +14 -0
- package/dist/beacon/types/ui/pin-popover.d.ts.map +1 -0
- package/dist/chart-client/assets/{index-C8ANseEa.js → index-Bk1hawjD.js} +63 -58
- package/dist/chart-client/assets/index-DpaGa3bY.css +1 -0
- package/dist/chart-client/index.html +2 -2
- package/dist/client/assets/index-Bfel4OQ5.css +32 -0
- package/dist/client/assets/{index-Ds9UP_cj.js → index-eC-WuUWB.js} +58 -58
- package/dist/client/index.html +2 -2
- package/dist/council-client/assets/{index-Dc41S-R2.js → index-Cs_MVXHf.js} +14 -14
- package/dist/council-client/assets/index-P5kMsT5a.css +1 -0
- package/dist/council-client/index.html +2 -2
- package/dist/deck-client/assets/{_baseUniq-2gclQXo7.js → _baseUniq-C2xT_eYu.js} +1 -1
- package/dist/deck-client/assets/{arc-DcMY5Wm0.js → arc-CmVL9pGd.js} +1 -1
- package/dist/deck-client/assets/{architectureDiagram-Q4EWVU46-B8iirmmJ.js → architectureDiagram-Q4EWVU46-BSFgdjve.js} +1 -1
- package/dist/deck-client/assets/{blockDiagram-DXYQGD6D-B4JBLjmJ.js → blockDiagram-DXYQGD6D-DuLzscvP.js} +1 -1
- package/dist/deck-client/assets/{c4Diagram-AHTNJAMY-CojrJAk8.js → c4Diagram-AHTNJAMY-CfCJB8eY.js} +1 -1
- package/dist/deck-client/assets/channel-B4aNO8ZB.js +1 -0
- package/dist/deck-client/assets/{chunk-4BX2VUAB-Bmb_BMDo.js → chunk-4BX2VUAB-DxmLYTWZ.js} +1 -1
- package/dist/deck-client/assets/{chunk-4TB4RGXK-CumBy8qe.js → chunk-4TB4RGXK-CCnf7GFE.js} +1 -1
- package/dist/deck-client/assets/{chunk-55IACEB6-Ka8Hb1wD.js → chunk-55IACEB6-Db9DApcj.js} +1 -1
- package/dist/deck-client/assets/{chunk-EDXVE4YY-B3sIPiQo.js → chunk-EDXVE4YY-DmYDq8ZI.js} +1 -1
- package/dist/deck-client/assets/{chunk-FMBD7UC4-C1tYkaqu.js → chunk-FMBD7UC4-BGhUlF20.js} +1 -1
- package/dist/deck-client/assets/{chunk-OYMX7WX6-D7Wacbky.js → chunk-OYMX7WX6-CpEnicQZ.js} +1 -1
- package/dist/deck-client/assets/{chunk-QZHKN3VN-ChXI0vO3.js → chunk-QZHKN3VN-Doa7LKwf.js} +1 -1
- package/dist/deck-client/assets/{chunk-YZCP3GAM-BXhiqf8u.js → chunk-YZCP3GAM-CpkIlH6V.js} +1 -1
- package/dist/deck-client/assets/classDiagram-6PBFFD2Q-BHTI0yWz.js +1 -0
- package/dist/deck-client/assets/classDiagram-v2-HSJHXN6E-BHTI0yWz.js +1 -0
- package/dist/deck-client/assets/clone-HduFm7qU.js +1 -0
- package/dist/deck-client/assets/{cose-bilkent-S5V4N54A-Bqp3p68D.js → cose-bilkent-S5V4N54A-Bkh8Bfcb.js} +1 -1
- package/dist/deck-client/assets/{dagre-KV5264BT-BS-rtyhZ.js → dagre-KV5264BT-Bp0XpTgH.js} +1 -1
- package/dist/deck-client/assets/{diagram-5BDNPKRD-BIrj9YGI.js → diagram-5BDNPKRD-ZHiyGYPQ.js} +1 -1
- package/dist/deck-client/assets/{diagram-G4DWMVQ6-noHWPIg4.js → diagram-G4DWMVQ6-BW-Q8_H5.js} +1 -1
- package/dist/deck-client/assets/{diagram-MMDJMWI5-C2qHxvqV.js → diagram-MMDJMWI5-6I3LTafu.js} +1 -1
- package/dist/deck-client/assets/{diagram-TYMM5635-BytnGQr-.js → diagram-TYMM5635-CyM5YK28.js} +1 -1
- package/dist/deck-client/assets/{erDiagram-SMLLAGMA-BfK5m2YQ.js → erDiagram-SMLLAGMA-CjNxVJHk.js} +1 -1
- package/dist/deck-client/assets/{flowDiagram-DWJPFMVM-Cq925G1Z.js → flowDiagram-DWJPFMVM-BDQHuAJR.js} +1 -1
- package/dist/deck-client/assets/{ganttDiagram-T4ZO3ILL-DhhHPAmj.js → ganttDiagram-T4ZO3ILL-B7MnkpbP.js} +1 -1
- package/dist/deck-client/assets/{gitGraphDiagram-UUTBAWPF-B3Lc0h9q.js → gitGraphDiagram-UUTBAWPF-C9dZAcYD.js} +1 -1
- package/dist/deck-client/assets/{graph-RTawgVWm.js → graph-CjdBnzUy.js} +1 -1
- package/dist/deck-client/assets/{index-BfIfJXmS.js → index-DeIVPW63.js} +68 -68
- package/dist/deck-client/assets/index-LKZDAS9S.css +1 -0
- package/dist/deck-client/assets/{infoDiagram-42DDH7IO-BlR584kX.js → infoDiagram-42DDH7IO-C7d3iRC3.js} +1 -1
- package/dist/deck-client/assets/{ishikawaDiagram-UXIWVN3A-DygKoNGY.js → ishikawaDiagram-UXIWVN3A-BcYGKj09.js} +1 -1
- package/dist/deck-client/assets/{journeyDiagram-VCZTEJTY-BnaiYp9N.js → journeyDiagram-VCZTEJTY-DqFlRrOL.js} +1 -1
- package/dist/deck-client/assets/{kanban-definition-6JOO6SKY-BQBUBzJC.js → kanban-definition-6JOO6SKY-BJhPp1NR.js} +1 -1
- package/dist/deck-client/assets/{layout-DeZ8HI1T.js → layout-DIeS6GvK.js} +1 -1
- package/dist/deck-client/assets/{linear-C6roLi_9.js → linear-He_yJy5H.js} +1 -1
- package/dist/deck-client/assets/{min-CbUksbuI.js → min-DQ6Kx06t.js} +1 -1
- package/dist/deck-client/assets/{mindmap-definition-QFDTVHPH-iNxV62yN.js → mindmap-definition-QFDTVHPH-sQ62L8T2.js} +1 -1
- package/dist/deck-client/assets/{pieDiagram-DEJITSTG-DHVA0jaG.js → pieDiagram-DEJITSTG-BqCWmU2K.js} +1 -1
- package/dist/deck-client/assets/{quadrantDiagram-34T5L4WZ-DBeKKLUQ.js → quadrantDiagram-34T5L4WZ-rQ1TJOoe.js} +1 -1
- package/dist/deck-client/assets/{requirementDiagram-MS252O5E-CBwITx7p.js → requirementDiagram-MS252O5E-BO2MPBOM.js} +1 -1
- package/dist/deck-client/assets/{sankeyDiagram-XADWPNL6-BtE-1YTU.js → sankeyDiagram-XADWPNL6-BgsHEVex.js} +1 -1
- package/dist/deck-client/assets/{sequenceDiagram-FGHM5R23-DN96yPP2.js → sequenceDiagram-FGHM5R23-B3j1yMLU.js} +1 -1
- package/dist/deck-client/assets/{stateDiagram-FHFEXIEX-VUkKC2uJ.js → stateDiagram-FHFEXIEX-C8jFlZou.js} +1 -1
- package/dist/deck-client/assets/stateDiagram-v2-QKLJ7IA2-BoqepHW0.js +1 -0
- package/dist/deck-client/assets/{timeline-definition-GMOUNBTQ-oUeZhRns.js → timeline-definition-GMOUNBTQ-tM-qo4Zk.js} +1 -1
- package/dist/deck-client/assets/{vennDiagram-DHZGUBPP-D87fK90n.js → vennDiagram-DHZGUBPP-B0-6kOEu.js} +1 -1
- package/dist/deck-client/assets/wardley-RL74JXVD-HpBk07P-.js +162 -0
- package/dist/deck-client/assets/{wardleyDiagram-NUSXRM2D-Ca_i0QRA.js → wardleyDiagram-NUSXRM2D-BkA1NLDE.js} +1 -1
- package/dist/deck-client/assets/{xychartDiagram-5P7HB3ND-CUOJVIvq.js → xychartDiagram-5P7HB3ND-CEKGSuI-.js} +1 -1
- package/dist/deck-client/index.html +2 -2
- package/dist/server/chart-serve.js +990 -116
- package/dist/server/cli.js +28413 -6982
- package/dist/server/council-entry.js +0 -0
- package/dist/server/deck-mcp-entry.js +332 -3
- package/dist/server/deck-serve.js +288 -0
- package/dist/server/fb-wizard.js +0 -0
- package/dist/server/graph/queries/classify.scm +8 -0
- package/dist/server/graph/queries/exports.scm +7 -0
- package/dist/server/graph-mcp-entry.js +1639 -197
- package/dist/server/recall-entry.js +1112 -0
- package/package.json +47 -21
- package/dist/chart-client/assets/index--120d9P9.css +0 -1
- package/dist/client/assets/index-Bf8zdL3x.css +0 -32
- package/dist/council-client/assets/index-CofZh7pS.css +0 -1
- package/dist/deck-client/assets/channel-ERh5jKXV.js +0 -1
- package/dist/deck-client/assets/classDiagram-6PBFFD2Q-CMi1Gaev.js +0 -1
- package/dist/deck-client/assets/classDiagram-v2-HSJHXN6E-CMi1Gaev.js +0 -1
- package/dist/deck-client/assets/clone-DfWhlD4X.js +0 -1
- package/dist/deck-client/assets/index-765AIQ9z.css +0 -1
- package/dist/deck-client/assets/stateDiagram-v2-QKLJ7IA2-CA0IjulK.js +0 -1
- package/dist/deck-client/assets/wardley-RL74JXVD-DYbYcpDp.js +0 -162
- package/dist/server/deck-server/deck-mcp-entry.js +0 -1789
- package/dist/server/deck-server/deck-serve.js +0 -1275
- package/dist/server/server/chart-serve.js +0 -4643
- package/dist/server/server/cli.js +0 -13360
- package/dist/server/server/fb-wizard.js +0 -136
- package/dist/server/server/graph-mcp-entry.js +0 -6776
|
@@ -162,173 +162,178 @@ Error generating stack: `+s.message+`
|
|
|
162
162
|
*
|
|
163
163
|
* This source code is licensed under the ISC license.
|
|
164
164
|
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
-
*/const FR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"
|
|
165
|
+
*/const FR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]],BR=me("circle-minus",FR);/**
|
|
166
166
|
* @license lucide-react v0.576.0 - ISC
|
|
167
167
|
*
|
|
168
168
|
* This source code is licensed under the ISC license.
|
|
169
169
|
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
-
*/const HR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],UR=me("circle",HR);/**
|
|
170
|
+
*/const HR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],UR=me("circle-x",HR);/**
|
|
171
171
|
* @license lucide-react v0.576.0 - ISC
|
|
172
172
|
*
|
|
173
173
|
* This source code is licensed under the ISC license.
|
|
174
174
|
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
-
*/const VR=[["
|
|
175
|
+
*/const VR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],WR=me("circle",VR);/**
|
|
176
176
|
* @license lucide-react v0.576.0 - ISC
|
|
177
177
|
*
|
|
178
178
|
* This source code is licensed under the ISC license.
|
|
179
179
|
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
-
*/const
|
|
180
|
+
*/const GR=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Jv=me("copy",GR);/**
|
|
181
181
|
* @license lucide-react v0.576.0 - ISC
|
|
182
182
|
*
|
|
183
183
|
* This source code is licensed under the ISC license.
|
|
184
184
|
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
-
*/const
|
|
185
|
+
*/const YR=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Qm=me("database",YR);/**
|
|
186
186
|
* @license lucide-react v0.576.0 - ISC
|
|
187
187
|
*
|
|
188
188
|
* This source code is licensed under the ISC license.
|
|
189
189
|
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
-
*/const XR=[["path",{d:"
|
|
190
|
+
*/const XR=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],KR=me("file-code",XR);/**
|
|
191
191
|
* @license lucide-react v0.576.0 - ISC
|
|
192
192
|
*
|
|
193
193
|
* This source code is licensed under the ISC license.
|
|
194
194
|
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
-
*/const
|
|
195
|
+
*/const qR=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Hl=me("folder-open",qR);/**
|
|
196
196
|
* @license lucide-react v0.576.0 - ISC
|
|
197
197
|
*
|
|
198
198
|
* This source code is licensed under the ISC license.
|
|
199
199
|
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
-
*/const
|
|
200
|
+
*/const QR=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ey=me("folder",QR);/**
|
|
201
201
|
* @license lucide-react v0.576.0 - ISC
|
|
202
202
|
*
|
|
203
203
|
* This source code is licensed under the ISC license.
|
|
204
204
|
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
-
*/const ZR=[["circle",{cx:"
|
|
205
|
+
*/const ZR=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],JR=me("git-branch",ZR);/**
|
|
206
206
|
* @license lucide-react v0.576.0 - ISC
|
|
207
207
|
*
|
|
208
208
|
* This source code is licensed under the ISC license.
|
|
209
209
|
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
-
*/const
|
|
210
|
+
*/const eA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Zm=me("globe",eA);/**
|
|
211
211
|
* @license lucide-react v0.576.0 - ISC
|
|
212
212
|
*
|
|
213
213
|
* This source code is licensed under the ISC license.
|
|
214
214
|
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
-
*/const
|
|
215
|
+
*/const tA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],D_=me("info",tA);/**
|
|
216
216
|
* @license lucide-react v0.576.0 - ISC
|
|
217
217
|
*
|
|
218
218
|
* This source code is licensed under the ISC license.
|
|
219
219
|
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
-
*/const
|
|
220
|
+
*/const nA=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Ua=me("layers",nA);/**
|
|
221
221
|
* @license lucide-react v0.576.0 - ISC
|
|
222
222
|
*
|
|
223
223
|
* This source code is licensed under the ISC license.
|
|
224
224
|
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
-
*/const rA=[["
|
|
225
|
+
*/const rA=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],oA=me("layout-dashboard",rA);/**
|
|
226
226
|
* @license lucide-react v0.576.0 - ISC
|
|
227
227
|
*
|
|
228
228
|
* This source code is licensed under the ISC license.
|
|
229
229
|
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const
|
|
230
|
+
*/const iA=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],ty=me("link",iA);/**
|
|
231
231
|
* @license lucide-react v0.576.0 - ISC
|
|
232
232
|
*
|
|
233
233
|
* This source code is licensed under the ISC license.
|
|
234
234
|
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
-
*/const sA=[["path",{d:"
|
|
235
|
+
*/const sA=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],aA=me("list",sA);/**
|
|
236
236
|
* @license lucide-react v0.576.0 - ISC
|
|
237
237
|
*
|
|
238
238
|
* This source code is licensed under the ISC license.
|
|
239
239
|
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
-
*/const lA=[["path",{d:"
|
|
240
|
+
*/const lA=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],cA=me("map-pin",lA);/**
|
|
241
241
|
* @license lucide-react v0.576.0 - ISC
|
|
242
242
|
*
|
|
243
243
|
* This source code is licensed under the ISC license.
|
|
244
244
|
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
-
*/const uA=[["path",{d:"
|
|
245
|
+
*/const uA=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],dA=me("map",uA);/**
|
|
246
246
|
* @license lucide-react v0.576.0 - ISC
|
|
247
247
|
*
|
|
248
248
|
* This source code is licensed under the ISC license.
|
|
249
249
|
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
-
*/const fA=[["
|
|
250
|
+
*/const fA=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],hA=me("moon",fA);/**
|
|
251
251
|
* @license lucide-react v0.576.0 - ISC
|
|
252
252
|
*
|
|
253
253
|
* This source code is licensed under the ISC license.
|
|
254
254
|
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
-
*/const pA=[["
|
|
255
|
+
*/const pA=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],mA=me("network",pA);/**
|
|
256
256
|
* @license lucide-react v0.576.0 - ISC
|
|
257
257
|
*
|
|
258
258
|
* This source code is licensed under the ISC license.
|
|
259
259
|
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
-
*/const
|
|
260
|
+
*/const gA=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],ny=me("package",gA);/**
|
|
261
261
|
* @license lucide-react v0.576.0 - ISC
|
|
262
262
|
*
|
|
263
263
|
* This source code is licensed under the ISC license.
|
|
264
264
|
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
-
*/const vA=[["path",{d:"M5
|
|
265
|
+
*/const vA=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],yA=me("play",vA);/**
|
|
266
266
|
* @license lucide-react v0.576.0 - ISC
|
|
267
267
|
*
|
|
268
268
|
* This source code is licensed under the ISC license.
|
|
269
269
|
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
-
*/const
|
|
270
|
+
*/const xA=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],_s=me("plus",xA);/**
|
|
271
271
|
* @license lucide-react v0.576.0 - ISC
|
|
272
272
|
*
|
|
273
273
|
* This source code is licensed under the ISC license.
|
|
274
274
|
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
-
*/const
|
|
275
|
+
*/const wA=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],L_=me("refresh-cw",wA);/**
|
|
276
276
|
* @license lucide-react v0.576.0 - ISC
|
|
277
277
|
*
|
|
278
278
|
* This source code is licensed under the ISC license.
|
|
279
279
|
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
-
*/const
|
|
280
|
+
*/const bA=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],jf=me("rotate-ccw",bA);/**
|
|
281
281
|
* @license lucide-react v0.576.0 - ISC
|
|
282
282
|
*
|
|
283
283
|
* This source code is licensed under the ISC license.
|
|
284
284
|
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
-
*/const _A=[["
|
|
285
|
+
*/const _A=[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]],SA=me("route",_A);/**
|
|
286
286
|
* @license lucide-react v0.576.0 - ISC
|
|
287
287
|
*
|
|
288
288
|
* This source code is licensed under the ISC license.
|
|
289
289
|
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
-
*/const
|
|
290
|
+
*/const kA=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],ry=me("save",kA);/**
|
|
291
291
|
* @license lucide-react v0.576.0 - ISC
|
|
292
292
|
*
|
|
293
293
|
* This source code is licensed under the ISC license.
|
|
294
294
|
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
-
*/const CA=[["path",{d:"
|
|
295
|
+
*/const CA=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],NA=me("search",CA);/**
|
|
296
296
|
* @license lucide-react v0.576.0 - ISC
|
|
297
297
|
*
|
|
298
298
|
* This source code is licensed under the ISC license.
|
|
299
299
|
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
-
*/const
|
|
300
|
+
*/const EA=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],z_=me("settings",EA);/**
|
|
301
301
|
* @license lucide-react v0.576.0 - ISC
|
|
302
302
|
*
|
|
303
303
|
* This source code is licensed under the ISC license.
|
|
304
304
|
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
-
*/const
|
|
305
|
+
*/const jA=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],F_=me("shield-check",jA);/**
|
|
306
306
|
* @license lucide-react v0.576.0 - ISC
|
|
307
307
|
*
|
|
308
308
|
* This source code is licensed under the ISC license.
|
|
309
309
|
* See the LICENSE file in the root directory of this source tree.
|
|
310
|
-
*/const PA=[["path",{d:"M12
|
|
310
|
+
*/const PA=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],MA=me("sun",PA);/**
|
|
311
311
|
* @license lucide-react v0.576.0 - ISC
|
|
312
312
|
*
|
|
313
313
|
* This source code is licensed under the ISC license.
|
|
314
314
|
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
-
*/const RA=[["path",{d:"
|
|
315
|
+
*/const RA=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],AA=me("tag",RA);/**
|
|
316
316
|
* @license lucide-react v0.576.0 - ISC
|
|
317
317
|
*
|
|
318
318
|
* This source code is licensed under the ISC license.
|
|
319
319
|
* See the LICENSE file in the root directory of this source tree.
|
|
320
|
-
*/const
|
|
320
|
+
*/const TA=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Ss=me("trash-2",TA);/**
|
|
321
321
|
* @license lucide-react v0.576.0 - ISC
|
|
322
322
|
*
|
|
323
323
|
* This source code is licensed under the ISC license.
|
|
324
324
|
* See the LICENSE file in the root directory of this source tree.
|
|
325
|
-
*/const
|
|
325
|
+
*/const IA=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Jm=me("triangle-alert",IA);/**
|
|
326
326
|
* @license lucide-react v0.576.0 - ISC
|
|
327
327
|
*
|
|
328
328
|
* This source code is licensed under the ISC license.
|
|
329
329
|
* See the LICENSE file in the root directory of this source tree.
|
|
330
|
-
*/const IA=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],OA=me("zap",IA),$A=x.forwardRef(({...e},n)=>p.jsx("nav",{ref:n,"aria-label":"breadcrumb",...e}));$A.displayName="Breadcrumb";const DA=x.forwardRef(({className:e,...n},r)=>p.jsx("ol",{ref:r,className:ae("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...n}));DA.displayName="BreadcrumbList";const LA=x.forwardRef(({className:e,...n},r)=>p.jsx("li",{ref:r,className:ae("inline-flex items-center gap-1.5",e),...n}));LA.displayName="BreadcrumbItem";const zA=x.forwardRef(({asChild:e,className:n,...r},o)=>{const i=e?S_:"a";return p.jsx(i,{ref:o,className:ae("transition-colors hover:text-foreground",n),...r})});zA.displayName="BreadcrumbLink";const FA=x.forwardRef(({className:e,...n},r)=>p.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:ae("font-normal text-foreground",e),...n}));FA.displayName="BreadcrumbPage";const BA=Xm("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),B_=x.forwardRef(({className:e,variant:n,size:r,asChild:o=!1,...i},s)=>{const a=o?S_:"button";return p.jsx(a,{className:ae(BA({variant:n,size:r,className:e})),ref:s,...i})});B_.displayName="Button";const HA=x.forwardRef(({className:e,onClick:n,...r},o)=>{const i=x.useRef(null),[s,a]=x.useState(!1);return x.useEffect(()=>{var u;const l=i.current;if(!l)return;const c=!!n||((u=l.parentElement)==null?void 0:u.tagName)==="A"||!!l.querySelector(":scope > a");a(c)},[n]),p.jsx("div",{ref:l=>{i.current=l,typeof o=="function"?o(l):o&&(o.current=l)},className:ae("ls-card rounded-xl bg-card text-card-foreground",s&&"interactive",e),onClick:n,...r})});HA.displayName="Card";const UA=x.forwardRef(({className:e,...n},r)=>p.jsx("div",{ref:r,className:ae("flex flex-col space-y-1.5 p-6",e),...n}));UA.displayName="CardHeader";const VA=x.forwardRef(({className:e,...n},r)=>p.jsx("div",{ref:r,className:ae("font-semibold leading-none tracking-tight",e),...n}));VA.displayName="CardTitle";const WA=x.forwardRef(({className:e,...n},r)=>p.jsx("div",{ref:r,className:ae("text-sm text-muted-foreground",e),...n}));WA.displayName="CardDescription";const GA=x.forwardRef(({className:e,...n},r)=>p.jsx("div",{ref:r,className:ae("p-6 pt-0",e),...n}));GA.displayName="CardContent";const YA=x.forwardRef(({className:e,...n},r)=>p.jsx("div",{ref:r,className:ae("flex items-center p-6 pt-0",e),...n}));YA.displayName="CardFooter";function XA(e,n){const r=x.createContext(n),o=s=>{const{children:a,...l}=s,c=x.useMemo(()=>l,Object.values(l));return p.jsx(r.Provider,{value:c,children:a})};o.displayName=e+"Provider";function i(s){const a=x.useContext(r);if(a)return a;if(n!==void 0)return n;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,i]}function Qt(e,n=[]){let r=[];function o(s,a){const l=x.createContext(a),c=r.length;r=[...r,a];const u=d=>{var m;const{scope:h,children:g,...v}=d,b=((m=h==null?void 0:h[e])==null?void 0:m[c])||l,_=x.useMemo(()=>v,Object.values(v));return p.jsx(b.Provider,{value:_,children:g})};u.displayName=s+"Provider";function f(d,h){var b;const g=((b=h==null?void 0:h[e])==null?void 0:b[c])||l,v=x.useContext(g);if(v)return v;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[u,f]}const i=()=>{const s=r.map(a=>x.createContext(a));return function(l){const c=(l==null?void 0:l[e])||s;return x.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return i.scopeName=e,[o,KA(i,...n)]}function KA(...e){const n=e[0];if(e.length===1)return n;const r=()=>{const o=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=o.reduce((l,{useScope:c,scopeName:u})=>{const d=c(s)[`__scope${u}`];return{...l,...d}},{});return x.useMemo(()=>({[`__scope${n.scopeName}`]:a}),[a])}};return r.scopeName=n.scopeName,r}function re(e,n,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e==null||e(i),r===!1||!i.defaultPrevented)return n==null?void 0:n(i)}}var qA=Uu[" useInsertionEffect ".trim().toString()]||Ye;function Va({prop:e,defaultProp:n,onChange:r=()=>{},caller:o}){const[i,s,a]=QA({defaultProp:n,onChange:r}),l=e!==void 0,c=l?e:i;{const f=x.useRef(e!==void 0);x.useEffect(()=>{const d=f.current;d!==l&&console.warn(`${o} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=l},[l,o])}const u=x.useCallback(f=>{var d;if(l){const h=ZA(f)?f(e):f;h!==e&&((d=a.current)==null||d.call(a,h))}else s(f)},[l,e,s,a]);return[c,u]}function QA({defaultProp:e,onChange:n}){const[r,o]=x.useState(e),i=x.useRef(r),s=x.useRef(n);return qA(()=>{s.current=n},[n]),x.useEffect(()=>{var a;i.current!==r&&((a=s.current)==null||a.call(s,r),i.current=r)},[r,i]),[r,o,s]}function ZA(e){return typeof e=="function"}function eg(e){const n=x.useRef({value:e,previous:e});return x.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}function tg(e){const[n,r]=x.useState(void 0);return Ye(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;r({width:a,height:l})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else r(void 0)},[e]),n}function JA(e,n){return x.useReducer((r,o)=>n[r][o]??r,e)}var kt=e=>{const{present:n,children:r}=e,o=eT(n),i=typeof r=="function"?r({present:o.isPresent}):x.Children.only(r),s=xe(o.ref,tT(i));return typeof r=="function"||o.isPresent?x.cloneElement(i,{ref:s}):null};kt.displayName="Presence";function eT(e){const[n,r]=x.useState(),o=x.useRef(null),i=x.useRef(e),s=x.useRef("none"),a=e?"mounted":"unmounted",[l,c]=JA(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=Ul(o.current);s.current=l==="mounted"?u:"none"},[l]),Ye(()=>{const u=o.current,f=i.current;if(f!==e){const h=s.current,g=Ul(u);e?c("MOUNT"):g==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(f&&h!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Ye(()=>{if(n){let u;const f=n.ownerDocument.defaultView??window,d=g=>{const b=Ul(o.current).includes(CSS.escape(g.animationName));if(g.target===n&&b&&(c("ANIMATION_END"),!i.current)){const _=n.style.animationFillMode;n.style.animationFillMode="forwards",u=f.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=_)})}},h=g=>{g.target===n&&(s.current=Ul(o.current))};return n.addEventListener("animationstart",h),n.addEventListener("animationcancel",d),n.addEventListener("animationend",d),()=>{f.clearTimeout(u),n.removeEventListener("animationstart",h),n.removeEventListener("animationcancel",d),n.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[n,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:x.useCallback(u=>{o.current=u?getComputedStyle(u):null,r(u)},[])}}function Ul(e){return(e==null?void 0:e.animationName)||"none"}function tT(e){var o,i;let n=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Ao(e){const n=nT(e),r=x.forwardRef((o,i)=>{const{children:s,...a}=o,l=x.Children.toArray(s),c=l.find(oT);if(c){const u=c.props.children,f=l.map(d=>d===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:d);return p.jsx(n,{...a,ref:i,children:x.isValidElement(u)?x.cloneElement(u,void 0,f):null})}return p.jsx(n,{...a,ref:i,children:s})});return r.displayName=`${e}.Slot`,r}function nT(e){const n=x.forwardRef((r,o)=>{const{children:i,...s}=r;if(x.isValidElement(i)){const a=sT(i),l=iT(s,i.props);return i.type!==x.Fragment&&(l.ref=o?An(o,a):a),x.cloneElement(i,l)}return x.Children.count(i)>1?x.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var H_=Symbol("radix.slottable");function rT(e){const n=({children:r})=>p.jsx(p.Fragment,{children:r});return n.displayName=`${e}.Slottable`,n.__radixId=H_,n}function oT(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===H_}function iT(e,n){const r={...n};for(const o in n){const i=e[o],s=n[o];/^on[A-Z]/.test(o)?i&&s?r[o]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(r[o]=i):o==="style"?r[o]={...i,...s}:o==="className"&&(r[o]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}function sT(e){var o,i;let n=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var aT=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fe=aT.reduce((e,n)=>{const r=Ao(`Primitive.${n}`),o=x.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(c,{...l,ref:s})});return o.displayName=`Primitive.${n}`,{...e,[n]:o}},{});function U_(e,n){e&&ts.flushSync(()=>e.dispatchEvent(n))}var ud="Checkbox",[lT]=Qt(ud),[cT,ng]=lT(ud);function uT(e){const{__scopeCheckbox:n,checked:r,children:o,defaultChecked:i,disabled:s,form:a,name:l,onCheckedChange:c,required:u,value:f="on",internal_do_not_use_render:d}=e,[h,g]=Va({prop:r,defaultProp:i??!1,onChange:c,caller:ud}),[v,b]=x.useState(null),[_,m]=x.useState(null),w=x.useRef(!1),y=v?!!a||!!v.closest("form"):!0,S={checked:h,disabled:s,setChecked:g,control:v,setControl:b,name:l,form:a,value:f,hasConsumerStoppedPropagationRef:w,required:u,defaultChecked:Hr(i)?!1:i,isFormControl:y,bubbleInput:_,setBubbleInput:m};return p.jsx(cT,{scope:n,...S,children:dT(d)?d(S):o})}var V_="CheckboxTrigger",W_=x.forwardRef(({__scopeCheckbox:e,onKeyDown:n,onClick:r,...o},i)=>{const{control:s,value:a,disabled:l,checked:c,required:u,setControl:f,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:g,bubbleInput:v}=ng(V_,e),b=xe(i,f),_=x.useRef(c);return x.useEffect(()=>{const m=s==null?void 0:s.form;if(m){const w=()=>d(_.current);return m.addEventListener("reset",w),()=>m.removeEventListener("reset",w)}},[s,d]),p.jsx(fe.button,{type:"button",role:"checkbox","aria-checked":Hr(c)?"mixed":c,"aria-required":u,"data-state":q_(c),"data-disabled":l?"":void 0,disabled:l,value:a,...o,ref:b,onKeyDown:re(n,m=>{m.key==="Enter"&&m.preventDefault()}),onClick:re(r,m=>{d(w=>Hr(w)?!0:!w),v&&g&&(h.current=m.isPropagationStopped(),h.current||m.stopPropagation())})})});W_.displayName=V_;var rg=x.forwardRef((e,n)=>{const{__scopeCheckbox:r,name:o,checked:i,defaultChecked:s,required:a,disabled:l,value:c,onCheckedChange:u,form:f,...d}=e;return p.jsx(uT,{__scopeCheckbox:r,checked:i,defaultChecked:s,disabled:l,required:a,onCheckedChange:u,name:o,form:f,value:c,internal_do_not_use_render:({isFormControl:h})=>p.jsxs(p.Fragment,{children:[p.jsx(W_,{...d,ref:n,__scopeCheckbox:r}),h&&p.jsx(K_,{__scopeCheckbox:r})]})})});rg.displayName=ud;var G_="CheckboxIndicator",Y_=x.forwardRef((e,n)=>{const{__scopeCheckbox:r,forceMount:o,...i}=e,s=ng(G_,r);return p.jsx(kt,{present:o||Hr(s.checked)||s.checked===!0,children:p.jsx(fe.span,{"data-state":q_(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:n,style:{pointerEvents:"none",...e.style}})})});Y_.displayName=G_;var X_="CheckboxBubbleInput",K_=x.forwardRef(({__scopeCheckbox:e,...n},r)=>{const{control:o,hasConsumerStoppedPropagationRef:i,checked:s,defaultChecked:a,required:l,disabled:c,name:u,value:f,form:d,bubbleInput:h,setBubbleInput:g}=ng(X_,e),v=xe(r,g),b=eg(s),_=tg(o);x.useEffect(()=>{const w=h;if(!w)return;const y=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(y,"checked").set,C=!i.current;if(b!==s&&k){const N=new Event("click",{bubbles:C});w.indeterminate=Hr(s),k.call(w,Hr(s)?!1:s),w.dispatchEvent(N)}},[h,b,s,i]);const m=x.useRef(Hr(s)?!1:s);return p.jsx(fe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??m.current,required:l,disabled:c,name:u,value:f,form:d,...n,tabIndex:-1,ref:v,style:{...n.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});K_.displayName=X_;function dT(e){return typeof e=="function"}function Hr(e){return e==="indeterminate"}function q_(e){return Hr(e)?"indeterminate":e?"checked":"unchecked"}const fT=x.forwardRef(({className:e,...n},r)=>p.jsx(rg,{ref:r,className:ae("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...n,children:p.jsx(Y_,{className:ae("grid place-content-center text-current"),children:p.jsx(qm,{className:"h-4 w-4"})})}));fT.displayName=rg.displayName;var hT=Uu[" useId ".trim().toString()]||(()=>{}),pT=0;function Tt(e){const[n,r]=x.useState(hT());return Ye(()=>{r(o=>o??String(pT++))},[e]),n?`radix-${n}`:""}var oy=1,mT=.9,gT=.8,vT=.17,Pf=.1,Mf=.999,yT=.9999,xT=.99,wT=/[\\\/_+.#"@\[\(\{&]/,bT=/[\\\/_+.#"@\[\(\{&]/g,_T=/[\s-]/,Q_=/[\s-]/g;function rp(e,n,r,o,i,s,a){if(s===n.length)return i===e.length?oy:xT;var l=`${i},${s}`;if(a[l]!==void 0)return a[l];for(var c=o.charAt(s),u=r.indexOf(c,i),f=0,d,h,g,v;u>=0;)d=rp(e,n,r,o,u+1,s+1,a),d>f&&(u===i?d*=oy:wT.test(e.charAt(u-1))?(d*=gT,g=e.slice(i,u-1).match(bT),g&&i>0&&(d*=Math.pow(Mf,g.length))):_T.test(e.charAt(u-1))?(d*=mT,v=e.slice(i,u-1).match(Q_),v&&i>0&&(d*=Math.pow(Mf,v.length))):(d*=vT,i>0&&(d*=Math.pow(Mf,u-i))),e.charAt(u)!==n.charAt(s)&&(d*=yT)),(d<Pf&&r.charAt(u-1)===o.charAt(s+1)||o.charAt(s+1)===o.charAt(s)&&r.charAt(u-1)!==o.charAt(s))&&(h=rp(e,n,r,o,u+1,s+2,a),h*Pf>d&&(d=h*Pf)),d>f&&(f=d),u=r.indexOf(c,u+1);return a[l]=f,f}function iy(e){return e.toLowerCase().replace(Q_," ")}function ST(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,rp(e,n,iy(e),iy(n),0,0,{})}function kT(e,n=globalThis==null?void 0:globalThis.document){const r=Rn(e);x.useEffect(()=>{const o=i=>{i.key==="Escape"&&r(i)};return n.addEventListener("keydown",o,{capture:!0}),()=>n.removeEventListener("keydown",o,{capture:!0})},[r,n])}var CT="DismissableLayer",op="dismissableLayer.update",NT="dismissableLayer.pointerDownOutside",ET="dismissableLayer.focusOutside",sy,Z_=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),is=x.forwardRef((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,u=x.useContext(Z_),[f,d]=x.useState(null),h=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=x.useState({}),v=xe(n,N=>d(N)),b=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),m=b.indexOf(_),w=f?b.indexOf(f):-1,y=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=m,k=MT(N=>{const E=N.target,j=[...u.branches].some(A=>A.contains(E));!S||j||(i==null||i(N),a==null||a(N),N.defaultPrevented||l==null||l())},h),C=RT(N=>{const E=N.target;[...u.branches].some(A=>A.contains(E))||(s==null||s(N),a==null||a(N),N.defaultPrevented||l==null||l())},h);return kT(N=>{w===u.layers.size-1&&(o==null||o(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},h),x.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(sy=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),ay(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=sy)}},[f,h,r,u]),x.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),ay())},[f,u]),x.useEffect(()=>{const N=()=>g({});return document.addEventListener(op,N),()=>document.removeEventListener(op,N)},[]),p.jsx(fe.div,{...c,ref:v,style:{pointerEvents:y?S?"auto":"none":void 0,...e.style},onFocusCapture:re(e.onFocusCapture,C.onFocusCapture),onBlurCapture:re(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:re(e.onPointerDownCapture,k.onPointerDownCapture)})});is.displayName=CT;var jT="DismissableLayerBranch",PT=x.forwardRef((e,n)=>{const r=x.useContext(Z_),o=x.useRef(null),i=xe(n,o);return x.useEffect(()=>{const s=o.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),p.jsx(fe.div,{...e,ref:i})});PT.displayName=jT;function MT(e,n=globalThis==null?void 0:globalThis.document){const r=Rn(e),o=x.useRef(!1),i=x.useRef(()=>{});return x.useEffect(()=>{const s=l=>{if(l.target&&!o.current){let c=function(){J_(NT,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(n.removeEventListener("click",i.current),i.current=c,n.addEventListener("click",i.current,{once:!0})):c()}else n.removeEventListener("click",i.current);o.current=!1},a=window.setTimeout(()=>{n.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),n.removeEventListener("pointerdown",s),n.removeEventListener("click",i.current)}},[n,r]),{onPointerDownCapture:()=>o.current=!0}}function RT(e,n=globalThis==null?void 0:globalThis.document){const r=Rn(e),o=x.useRef(!1);return x.useEffect(()=>{const i=s=>{s.target&&!o.current&&J_(ET,r,{originalEvent:s},{discrete:!1})};return n.addEventListener("focusin",i),()=>n.removeEventListener("focusin",i)},[n,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function ay(){const e=new CustomEvent(op);document.dispatchEvent(e)}function J_(e,n,r,{discrete:o}){const i=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});n&&i.addEventListener(e,n,{once:!0}),o?U_(i,s):i.dispatchEvent(s)}var Rf="focusScope.autoFocusOnMount",Af="focusScope.autoFocusOnUnmount",ly={bubbles:!1,cancelable:!0},AT="FocusScope",Wa=x.forwardRef((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=e,[l,c]=x.useState(null),u=Rn(i),f=Rn(s),d=x.useRef(null),h=xe(n,b=>c(b)),g=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(o){let b=function(y){if(g.paused||!l)return;const S=y.target;l.contains(S)?d.current=S:_r(d.current,{select:!0})},_=function(y){if(g.paused||!l)return;const S=y.relatedTarget;S!==null&&(l.contains(S)||_r(d.current,{select:!0}))},m=function(y){if(document.activeElement===document.body)for(const k of y)k.removedNodes.length>0&&_r(l)};document.addEventListener("focusin",b),document.addEventListener("focusout",_);const w=new MutationObserver(m);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",_),w.disconnect()}}},[o,l,g.paused]),x.useEffect(()=>{if(l){uy.add(g);const b=document.activeElement;if(!l.contains(b)){const m=new CustomEvent(Rf,ly);l.addEventListener(Rf,u),l.dispatchEvent(m),m.defaultPrevented||(TT(LT(e2(l)),{select:!0}),document.activeElement===b&&_r(l))}return()=>{l.removeEventListener(Rf,u),setTimeout(()=>{const m=new CustomEvent(Af,ly);l.addEventListener(Af,f),l.dispatchEvent(m),m.defaultPrevented||_r(b??document.body,{select:!0}),l.removeEventListener(Af,f),uy.remove(g)},0)}}},[l,u,f,g]);const v=x.useCallback(b=>{if(!r&&!o||g.paused)return;const _=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,m=document.activeElement;if(_&&m){const w=b.currentTarget,[y,S]=IT(w);y&&S?!b.shiftKey&&m===S?(b.preventDefault(),r&&_r(y,{select:!0})):b.shiftKey&&m===y&&(b.preventDefault(),r&&_r(S,{select:!0})):m===w&&b.preventDefault()}},[r,o,g.paused]);return p.jsx(fe.div,{tabIndex:-1,...a,ref:h,onKeyDown:v})});Wa.displayName=AT;function TT(e,{select:n=!1}={}){const r=document.activeElement;for(const o of e)if(_r(o,{select:n}),document.activeElement!==r)return}function IT(e){const n=e2(e),r=cy(n,e),o=cy(n.reverse(),e);return[r,o]}function e2(e){const n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const i=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||i?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)n.push(r.currentNode);return n}function cy(e,n){for(const r of e)if(!OT(r,{upTo:n}))return r}function OT(e,{upTo:n}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(n!==void 0&&e===n)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function $T(e){return e instanceof HTMLInputElement&&"select"in e}function _r(e,{select:n=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&$T(e)&&n&&e.select()}}var uy=DT();function DT(){let e=[];return{add(n){const r=e[0];n!==r&&(r==null||r.pause()),e=dy(e,n),e.unshift(n)},remove(n){var r;e=dy(e,n),(r=e[0])==null||r.resume()}}}function dy(e,n){const r=[...e],o=r.indexOf(n);return o!==-1&&r.splice(o,1),r}function LT(e){return e.filter(n=>n.tagName!=="A")}var zT="Portal",ss=x.forwardRef((e,n)=>{var l;const{container:r,...o}=e,[i,s]=x.useState(!1);Ye(()=>s(!0),[]);const a=r||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?JM.createPortal(p.jsx(fe.div,{...o,ref:n}),a):null});ss.displayName=zT;var Tf=0;function dd(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??fy()),document.body.insertAdjacentElement("beforeend",e[1]??fy()),Tf++,()=>{Tf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),Tf--}},[])}function fy(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var kn=function(){return kn=Object.assign||function(n){for(var r,o=1,i=arguments.length;o<i;o++){r=arguments[o];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])}return n},kn.apply(this,arguments)};function t2(e,n){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,o=Object.getOwnPropertySymbols(e);i<o.length;i++)n.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(r[o[i]]=e[o[i]]);return r}function FT(e,n,r){if(r||arguments.length===2)for(var o=0,i=n.length,s;o<i;o++)(s||!(o in n))&&(s||(s=Array.prototype.slice.call(n,0,o)),s[o]=n[o]);return e.concat(s||Array.prototype.slice.call(n))}var Cc="right-scroll-bar-position",Nc="width-before-scroll-bar",BT="with-scroll-bars-hidden",HT="--removed-body-scroll-bar-size";function If(e,n){return typeof e=="function"?e(n):e&&(e.current=n),e}function UT(e,n){var r=x.useState(function(){return{value:e,callback:n,facade:{get current(){return r.value},set current(o){var i=r.value;i!==o&&(r.value=o,r.callback(o,i))}}}})[0];return r.callback=n,r.facade}var VT=typeof window<"u"?x.useLayoutEffect:x.useEffect,hy=new WeakMap;function WT(e,n){var r=UT(null,function(o){return e.forEach(function(i){return If(i,o)})});return VT(function(){var o=hy.get(r);if(o){var i=new Set(o),s=new Set(e),a=r.current;i.forEach(function(l){s.has(l)||If(l,null)}),s.forEach(function(l){i.has(l)||If(l,a)})}hy.set(r,e)},[e]),r}function GT(e){return e}function YT(e,n){n===void 0&&(n=GT);var r=[],o=!1,i={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(s){var a=n(s,o);return r.push(a),function(){r=r.filter(function(l){return l!==a})}},assignSyncMedium:function(s){for(o=!0;r.length;){var a=r;r=[],a.forEach(s)}r={push:function(l){return s(l)},filter:function(){return r}}},assignMedium:function(s){o=!0;var a=[];if(r.length){var l=r;r=[],l.forEach(s),a=r}var c=function(){var f=a;a=[],f.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(f){a.push(f),u()},filter:function(f){return a=a.filter(f),r}}}};return i}function XT(e){e===void 0&&(e={});var n=YT(null);return n.options=kn({async:!0,ssr:!1},e),n}var n2=function(e){var n=e.sideCar,r=t2(e,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=n.read();if(!o)throw new Error("Sidecar medium not found");return x.createElement(o,kn({},r))};n2.isSideCarExport=!0;function KT(e,n){return e.useMedium(n),n2}var r2=XT(),Of=function(){},fd=x.forwardRef(function(e,n){var r=x.useRef(null),o=x.useState({onScrollCapture:Of,onWheelCapture:Of,onTouchMoveCapture:Of}),i=o[0],s=o[1],a=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,f=e.enabled,d=e.shards,h=e.sideCar,g=e.noRelative,v=e.noIsolation,b=e.inert,_=e.allowPinchZoom,m=e.as,w=m===void 0?"div":m,y=e.gapMode,S=t2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=h,C=WT([r,n]),N=kn(kn({},S),i);return x.createElement(x.Fragment,null,f&&x.createElement(k,{sideCar:r2,removeScrollBar:u,shards:d,noRelative:g,noIsolation:v,inert:b,setCallbacks:s,allowPinchZoom:!!_,lockRef:r,gapMode:y}),a?x.cloneElement(x.Children.only(l),kn(kn({},N),{ref:C})):x.createElement(w,kn({},N,{className:c,ref:C}),l))});fd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};fd.classNames={fullWidth:Nc,zeroRight:Cc};var qT=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function QT(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var n=qT();return n&&e.setAttribute("nonce",n),e}function ZT(e,n){e.styleSheet?e.styleSheet.cssText=n:e.appendChild(document.createTextNode(n))}function JT(e){var n=document.head||document.getElementsByTagName("head")[0];n.appendChild(e)}var eI=function(){var e=0,n=null;return{add:function(r){e==0&&(n=QT())&&(ZT(n,r),JT(n)),e++},remove:function(){e--,!e&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},tI=function(){var e=eI();return function(n,r){x.useEffect(function(){return e.add(n),function(){e.remove()}},[n&&r])}},o2=function(){var e=tI(),n=function(r){var o=r.styles,i=r.dynamic;return e(o,i),null};return n},nI={left:0,top:0,right:0,gap:0},$f=function(e){return parseInt(e||"",10)||0},rI=function(e){var n=window.getComputedStyle(document.body),r=n[e==="padding"?"paddingLeft":"marginLeft"],o=n[e==="padding"?"paddingTop":"marginTop"],i=n[e==="padding"?"paddingRight":"marginRight"];return[$f(r),$f(o),$f(i)]},oI=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return nI;var n=rI(e),r=document.documentElement.clientWidth,o=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,o-r+n[2]-n[0])}},iI=o2(),Ei="data-scroll-locked",sI=function(e,n,r,o){var i=e.left,s=e.top,a=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
331
|
-
|
|
330
|
+
*/const OA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],uu=me("x",OA);/**
|
|
331
|
+
* @license lucide-react v0.576.0 - ISC
|
|
332
|
+
*
|
|
333
|
+
* This source code is licensed under the ISC license.
|
|
334
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
335
|
+
*/const $A=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],DA=me("zap",$A),LA=x.forwardRef(({...e},n)=>p.jsx("nav",{ref:n,"aria-label":"breadcrumb",...e}));LA.displayName="Breadcrumb";const zA=x.forwardRef(({className:e,...n},r)=>p.jsx("ol",{ref:r,className:ae("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...n}));zA.displayName="BreadcrumbList";const FA=x.forwardRef(({className:e,...n},r)=>p.jsx("li",{ref:r,className:ae("inline-flex items-center gap-1.5",e),...n}));FA.displayName="BreadcrumbItem";const BA=x.forwardRef(({asChild:e,className:n,...r},o)=>{const i=e?S_:"a";return p.jsx(i,{ref:o,className:ae("transition-colors hover:text-foreground",n),...r})});BA.displayName="BreadcrumbLink";const HA=x.forwardRef(({className:e,...n},r)=>p.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:ae("font-normal text-foreground",e),...n}));HA.displayName="BreadcrumbPage";const UA=Xm("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),B_=x.forwardRef(({className:e,variant:n,size:r,asChild:o=!1,...i},s)=>{const a=o?S_:"button";return p.jsx(a,{className:ae(UA({variant:n,size:r,className:e})),ref:s,...i})});B_.displayName="Button";const VA=x.forwardRef(({className:e,onClick:n,...r},o)=>{const i=x.useRef(null),[s,a]=x.useState(!1);return x.useEffect(()=>{var u;const l=i.current;if(!l)return;const c=!!n||((u=l.parentElement)==null?void 0:u.tagName)==="A"||!!l.querySelector(":scope > a");a(c)},[n]),p.jsx("div",{ref:l=>{i.current=l,typeof o=="function"?o(l):o&&(o.current=l)},className:ae("ls-card rounded-xl bg-card text-card-foreground",s&&"interactive",e),onClick:n,...r})});VA.displayName="Card";const WA=x.forwardRef(({className:e,...n},r)=>p.jsx("div",{ref:r,className:ae("flex flex-col space-y-1.5 p-6",e),...n}));WA.displayName="CardHeader";const GA=x.forwardRef(({className:e,...n},r)=>p.jsx("div",{ref:r,className:ae("font-semibold leading-none tracking-tight",e),...n}));GA.displayName="CardTitle";const YA=x.forwardRef(({className:e,...n},r)=>p.jsx("div",{ref:r,className:ae("text-sm text-muted-foreground",e),...n}));YA.displayName="CardDescription";const XA=x.forwardRef(({className:e,...n},r)=>p.jsx("div",{ref:r,className:ae("p-6 pt-0",e),...n}));XA.displayName="CardContent";const KA=x.forwardRef(({className:e,...n},r)=>p.jsx("div",{ref:r,className:ae("flex items-center p-6 pt-0",e),...n}));KA.displayName="CardFooter";function qA(e,n){const r=x.createContext(n),o=s=>{const{children:a,...l}=s,c=x.useMemo(()=>l,Object.values(l));return p.jsx(r.Provider,{value:c,children:a})};o.displayName=e+"Provider";function i(s){const a=x.useContext(r);if(a)return a;if(n!==void 0)return n;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,i]}function Qt(e,n=[]){let r=[];function o(s,a){const l=x.createContext(a),c=r.length;r=[...r,a];const u=d=>{var m;const{scope:h,children:g,...v}=d,b=((m=h==null?void 0:h[e])==null?void 0:m[c])||l,_=x.useMemo(()=>v,Object.values(v));return p.jsx(b.Provider,{value:_,children:g})};u.displayName=s+"Provider";function f(d,h){var b;const g=((b=h==null?void 0:h[e])==null?void 0:b[c])||l,v=x.useContext(g);if(v)return v;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[u,f]}const i=()=>{const s=r.map(a=>x.createContext(a));return function(l){const c=(l==null?void 0:l[e])||s;return x.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return i.scopeName=e,[o,QA(i,...n)]}function QA(...e){const n=e[0];if(e.length===1)return n;const r=()=>{const o=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=o.reduce((l,{useScope:c,scopeName:u})=>{const d=c(s)[`__scope${u}`];return{...l,...d}},{});return x.useMemo(()=>({[`__scope${n.scopeName}`]:a}),[a])}};return r.scopeName=n.scopeName,r}function re(e,n,{checkForDefaultPrevented:r=!0}={}){return function(i){if(e==null||e(i),r===!1||!i.defaultPrevented)return n==null?void 0:n(i)}}var ZA=Uu[" useInsertionEffect ".trim().toString()]||Ye;function Va({prop:e,defaultProp:n,onChange:r=()=>{},caller:o}){const[i,s,a]=JA({defaultProp:n,onChange:r}),l=e!==void 0,c=l?e:i;{const f=x.useRef(e!==void 0);x.useEffect(()=>{const d=f.current;d!==l&&console.warn(`${o} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=l},[l,o])}const u=x.useCallback(f=>{var d;if(l){const h=eT(f)?f(e):f;h!==e&&((d=a.current)==null||d.call(a,h))}else s(f)},[l,e,s,a]);return[c,u]}function JA({defaultProp:e,onChange:n}){const[r,o]=x.useState(e),i=x.useRef(r),s=x.useRef(n);return ZA(()=>{s.current=n},[n]),x.useEffect(()=>{var a;i.current!==r&&((a=s.current)==null||a.call(s,r),i.current=r)},[r,i]),[r,o,s]}function eT(e){return typeof e=="function"}function eg(e){const n=x.useRef({value:e,previous:e});return x.useMemo(()=>(n.current.value!==e&&(n.current.previous=n.current.value,n.current.value=e),n.current.previous),[e])}function tg(e){const[n,r]=x.useState(void 0);return Ye(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;r({width:a,height:l})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else r(void 0)},[e]),n}function tT(e,n){return x.useReducer((r,o)=>n[r][o]??r,e)}var kt=e=>{const{present:n,children:r}=e,o=nT(n),i=typeof r=="function"?r({present:o.isPresent}):x.Children.only(r),s=xe(o.ref,rT(i));return typeof r=="function"||o.isPresent?x.cloneElement(i,{ref:s}):null};kt.displayName="Presence";function nT(e){const[n,r]=x.useState(),o=x.useRef(null),i=x.useRef(e),s=x.useRef("none"),a=e?"mounted":"unmounted",[l,c]=tT(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const u=Ul(o.current);s.current=l==="mounted"?u:"none"},[l]),Ye(()=>{const u=o.current,f=i.current;if(f!==e){const h=s.current,g=Ul(u);e?c("MOUNT"):g==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(f&&h!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Ye(()=>{if(n){let u;const f=n.ownerDocument.defaultView??window,d=g=>{const b=Ul(o.current).includes(CSS.escape(g.animationName));if(g.target===n&&b&&(c("ANIMATION_END"),!i.current)){const _=n.style.animationFillMode;n.style.animationFillMode="forwards",u=f.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=_)})}},h=g=>{g.target===n&&(s.current=Ul(o.current))};return n.addEventListener("animationstart",h),n.addEventListener("animationcancel",d),n.addEventListener("animationend",d),()=>{f.clearTimeout(u),n.removeEventListener("animationstart",h),n.removeEventListener("animationcancel",d),n.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[n,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:x.useCallback(u=>{o.current=u?getComputedStyle(u):null,r(u)},[])}}function Ul(e){return(e==null?void 0:e.animationName)||"none"}function rT(e){var o,i;let n=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Ao(e){const n=oT(e),r=x.forwardRef((o,i)=>{const{children:s,...a}=o,l=x.Children.toArray(s),c=l.find(sT);if(c){const u=c.props.children,f=l.map(d=>d===c?x.Children.count(u)>1?x.Children.only(null):x.isValidElement(u)?u.props.children:null:d);return p.jsx(n,{...a,ref:i,children:x.isValidElement(u)?x.cloneElement(u,void 0,f):null})}return p.jsx(n,{...a,ref:i,children:s})});return r.displayName=`${e}.Slot`,r}function oT(e){const n=x.forwardRef((r,o)=>{const{children:i,...s}=r;if(x.isValidElement(i)){const a=lT(i),l=aT(s,i.props);return i.type!==x.Fragment&&(l.ref=o?An(o,a):a),x.cloneElement(i,l)}return x.Children.count(i)>1?x.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var H_=Symbol("radix.slottable");function iT(e){const n=({children:r})=>p.jsx(p.Fragment,{children:r});return n.displayName=`${e}.Slottable`,n.__radixId=H_,n}function sT(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===H_}function aT(e,n){const r={...n};for(const o in n){const i=e[o],s=n[o];/^on[A-Z]/.test(o)?i&&s?r[o]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(r[o]=i):o==="style"?r[o]={...i,...s}:o==="className"&&(r[o]=[i,s].filter(Boolean).join(" "))}return{...e,...r}}function lT(e){var o,i;let n=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var cT=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fe=cT.reduce((e,n)=>{const r=Ao(`Primitive.${n}`),o=x.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(c,{...l,ref:s})});return o.displayName=`Primitive.${n}`,{...e,[n]:o}},{});function U_(e,n){e&&ts.flushSync(()=>e.dispatchEvent(n))}var ud="Checkbox",[uT]=Qt(ud),[dT,ng]=uT(ud);function fT(e){const{__scopeCheckbox:n,checked:r,children:o,defaultChecked:i,disabled:s,form:a,name:l,onCheckedChange:c,required:u,value:f="on",internal_do_not_use_render:d}=e,[h,g]=Va({prop:r,defaultProp:i??!1,onChange:c,caller:ud}),[v,b]=x.useState(null),[_,m]=x.useState(null),w=x.useRef(!1),y=v?!!a||!!v.closest("form"):!0,S={checked:h,disabled:s,setChecked:g,control:v,setControl:b,name:l,form:a,value:f,hasConsumerStoppedPropagationRef:w,required:u,defaultChecked:Hr(i)?!1:i,isFormControl:y,bubbleInput:_,setBubbleInput:m};return p.jsx(dT,{scope:n,...S,children:hT(d)?d(S):o})}var V_="CheckboxTrigger",W_=x.forwardRef(({__scopeCheckbox:e,onKeyDown:n,onClick:r,...o},i)=>{const{control:s,value:a,disabled:l,checked:c,required:u,setControl:f,setChecked:d,hasConsumerStoppedPropagationRef:h,isFormControl:g,bubbleInput:v}=ng(V_,e),b=xe(i,f),_=x.useRef(c);return x.useEffect(()=>{const m=s==null?void 0:s.form;if(m){const w=()=>d(_.current);return m.addEventListener("reset",w),()=>m.removeEventListener("reset",w)}},[s,d]),p.jsx(fe.button,{type:"button",role:"checkbox","aria-checked":Hr(c)?"mixed":c,"aria-required":u,"data-state":q_(c),"data-disabled":l?"":void 0,disabled:l,value:a,...o,ref:b,onKeyDown:re(n,m=>{m.key==="Enter"&&m.preventDefault()}),onClick:re(r,m=>{d(w=>Hr(w)?!0:!w),v&&g&&(h.current=m.isPropagationStopped(),h.current||m.stopPropagation())})})});W_.displayName=V_;var rg=x.forwardRef((e,n)=>{const{__scopeCheckbox:r,name:o,checked:i,defaultChecked:s,required:a,disabled:l,value:c,onCheckedChange:u,form:f,...d}=e;return p.jsx(fT,{__scopeCheckbox:r,checked:i,defaultChecked:s,disabled:l,required:a,onCheckedChange:u,name:o,form:f,value:c,internal_do_not_use_render:({isFormControl:h})=>p.jsxs(p.Fragment,{children:[p.jsx(W_,{...d,ref:n,__scopeCheckbox:r}),h&&p.jsx(K_,{__scopeCheckbox:r})]})})});rg.displayName=ud;var G_="CheckboxIndicator",Y_=x.forwardRef((e,n)=>{const{__scopeCheckbox:r,forceMount:o,...i}=e,s=ng(G_,r);return p.jsx(kt,{present:o||Hr(s.checked)||s.checked===!0,children:p.jsx(fe.span,{"data-state":q_(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:n,style:{pointerEvents:"none",...e.style}})})});Y_.displayName=G_;var X_="CheckboxBubbleInput",K_=x.forwardRef(({__scopeCheckbox:e,...n},r)=>{const{control:o,hasConsumerStoppedPropagationRef:i,checked:s,defaultChecked:a,required:l,disabled:c,name:u,value:f,form:d,bubbleInput:h,setBubbleInput:g}=ng(X_,e),v=xe(r,g),b=eg(s),_=tg(o);x.useEffect(()=>{const w=h;if(!w)return;const y=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(y,"checked").set,C=!i.current;if(b!==s&&k){const N=new Event("click",{bubbles:C});w.indeterminate=Hr(s),k.call(w,Hr(s)?!1:s),w.dispatchEvent(N)}},[h,b,s,i]);const m=x.useRef(Hr(s)?!1:s);return p.jsx(fe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??m.current,required:l,disabled:c,name:u,value:f,form:d,...n,tabIndex:-1,ref:v,style:{...n.style,..._,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});K_.displayName=X_;function hT(e){return typeof e=="function"}function Hr(e){return e==="indeterminate"}function q_(e){return Hr(e)?"indeterminate":e?"checked":"unchecked"}const pT=x.forwardRef(({className:e,...n},r)=>p.jsx(rg,{ref:r,className:ae("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...n,children:p.jsx(Y_,{className:ae("grid place-content-center text-current"),children:p.jsx(qm,{className:"h-4 w-4"})})}));pT.displayName=rg.displayName;var mT=Uu[" useId ".trim().toString()]||(()=>{}),gT=0;function Tt(e){const[n,r]=x.useState(mT());return Ye(()=>{r(o=>o??String(gT++))},[e]),n?`radix-${n}`:""}var oy=1,vT=.9,yT=.8,xT=.17,Pf=.1,Mf=.999,wT=.9999,bT=.99,_T=/[\\\/_+.#"@\[\(\{&]/,ST=/[\\\/_+.#"@\[\(\{&]/g,kT=/[\s-]/,Q_=/[\s-]/g;function rp(e,n,r,o,i,s,a){if(s===n.length)return i===e.length?oy:bT;var l=`${i},${s}`;if(a[l]!==void 0)return a[l];for(var c=o.charAt(s),u=r.indexOf(c,i),f=0,d,h,g,v;u>=0;)d=rp(e,n,r,o,u+1,s+1,a),d>f&&(u===i?d*=oy:_T.test(e.charAt(u-1))?(d*=yT,g=e.slice(i,u-1).match(ST),g&&i>0&&(d*=Math.pow(Mf,g.length))):kT.test(e.charAt(u-1))?(d*=vT,v=e.slice(i,u-1).match(Q_),v&&i>0&&(d*=Math.pow(Mf,v.length))):(d*=xT,i>0&&(d*=Math.pow(Mf,u-i))),e.charAt(u)!==n.charAt(s)&&(d*=wT)),(d<Pf&&r.charAt(u-1)===o.charAt(s+1)||o.charAt(s+1)===o.charAt(s)&&r.charAt(u-1)!==o.charAt(s))&&(h=rp(e,n,r,o,u+1,s+2,a),h*Pf>d&&(d=h*Pf)),d>f&&(f=d),u=r.indexOf(c,u+1);return a[l]=f,f}function iy(e){return e.toLowerCase().replace(Q_," ")}function CT(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,rp(e,n,iy(e),iy(n),0,0,{})}function NT(e,n=globalThis==null?void 0:globalThis.document){const r=Rn(e);x.useEffect(()=>{const o=i=>{i.key==="Escape"&&r(i)};return n.addEventListener("keydown",o,{capture:!0}),()=>n.removeEventListener("keydown",o,{capture:!0})},[r,n])}var ET="DismissableLayer",op="dismissableLayer.update",jT="dismissableLayer.pointerDownOutside",PT="dismissableLayer.focusOutside",sy,Z_=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),is=x.forwardRef((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,u=x.useContext(Z_),[f,d]=x.useState(null),h=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=x.useState({}),v=xe(n,N=>d(N)),b=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),m=b.indexOf(_),w=f?b.indexOf(f):-1,y=u.layersWithOutsidePointerEventsDisabled.size>0,S=w>=m,k=AT(N=>{const E=N.target,j=[...u.branches].some(A=>A.contains(E));!S||j||(i==null||i(N),a==null||a(N),N.defaultPrevented||l==null||l())},h),C=TT(N=>{const E=N.target;[...u.branches].some(A=>A.contains(E))||(s==null||s(N),a==null||a(N),N.defaultPrevented||l==null||l())},h);return NT(N=>{w===u.layers.size-1&&(o==null||o(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},h),x.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(sy=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),ay(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=sy)}},[f,h,r,u]),x.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),ay())},[f,u]),x.useEffect(()=>{const N=()=>g({});return document.addEventListener(op,N),()=>document.removeEventListener(op,N)},[]),p.jsx(fe.div,{...c,ref:v,style:{pointerEvents:y?S?"auto":"none":void 0,...e.style},onFocusCapture:re(e.onFocusCapture,C.onFocusCapture),onBlurCapture:re(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:re(e.onPointerDownCapture,k.onPointerDownCapture)})});is.displayName=ET;var MT="DismissableLayerBranch",RT=x.forwardRef((e,n)=>{const r=x.useContext(Z_),o=x.useRef(null),i=xe(n,o);return x.useEffect(()=>{const s=o.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),p.jsx(fe.div,{...e,ref:i})});RT.displayName=MT;function AT(e,n=globalThis==null?void 0:globalThis.document){const r=Rn(e),o=x.useRef(!1),i=x.useRef(()=>{});return x.useEffect(()=>{const s=l=>{if(l.target&&!o.current){let c=function(){J_(jT,r,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(n.removeEventListener("click",i.current),i.current=c,n.addEventListener("click",i.current,{once:!0})):c()}else n.removeEventListener("click",i.current);o.current=!1},a=window.setTimeout(()=>{n.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),n.removeEventListener("pointerdown",s),n.removeEventListener("click",i.current)}},[n,r]),{onPointerDownCapture:()=>o.current=!0}}function TT(e,n=globalThis==null?void 0:globalThis.document){const r=Rn(e),o=x.useRef(!1);return x.useEffect(()=>{const i=s=>{s.target&&!o.current&&J_(PT,r,{originalEvent:s},{discrete:!1})};return n.addEventListener("focusin",i),()=>n.removeEventListener("focusin",i)},[n,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function ay(){const e=new CustomEvent(op);document.dispatchEvent(e)}function J_(e,n,r,{discrete:o}){const i=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});n&&i.addEventListener(e,n,{once:!0}),o?U_(i,s):i.dispatchEvent(s)}var Rf="focusScope.autoFocusOnMount",Af="focusScope.autoFocusOnUnmount",ly={bubbles:!1,cancelable:!0},IT="FocusScope",Wa=x.forwardRef((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=e,[l,c]=x.useState(null),u=Rn(i),f=Rn(s),d=x.useRef(null),h=xe(n,b=>c(b)),g=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(o){let b=function(y){if(g.paused||!l)return;const S=y.target;l.contains(S)?d.current=S:_r(d.current,{select:!0})},_=function(y){if(g.paused||!l)return;const S=y.relatedTarget;S!==null&&(l.contains(S)||_r(d.current,{select:!0}))},m=function(y){if(document.activeElement===document.body)for(const k of y)k.removedNodes.length>0&&_r(l)};document.addEventListener("focusin",b),document.addEventListener("focusout",_);const w=new MutationObserver(m);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",_),w.disconnect()}}},[o,l,g.paused]),x.useEffect(()=>{if(l){uy.add(g);const b=document.activeElement;if(!l.contains(b)){const m=new CustomEvent(Rf,ly);l.addEventListener(Rf,u),l.dispatchEvent(m),m.defaultPrevented||(OT(FT(e2(l)),{select:!0}),document.activeElement===b&&_r(l))}return()=>{l.removeEventListener(Rf,u),setTimeout(()=>{const m=new CustomEvent(Af,ly);l.addEventListener(Af,f),l.dispatchEvent(m),m.defaultPrevented||_r(b??document.body,{select:!0}),l.removeEventListener(Af,f),uy.remove(g)},0)}}},[l,u,f,g]);const v=x.useCallback(b=>{if(!r&&!o||g.paused)return;const _=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,m=document.activeElement;if(_&&m){const w=b.currentTarget,[y,S]=$T(w);y&&S?!b.shiftKey&&m===S?(b.preventDefault(),r&&_r(y,{select:!0})):b.shiftKey&&m===y&&(b.preventDefault(),r&&_r(S,{select:!0})):m===w&&b.preventDefault()}},[r,o,g.paused]);return p.jsx(fe.div,{tabIndex:-1,...a,ref:h,onKeyDown:v})});Wa.displayName=IT;function OT(e,{select:n=!1}={}){const r=document.activeElement;for(const o of e)if(_r(o,{select:n}),document.activeElement!==r)return}function $T(e){const n=e2(e),r=cy(n,e),o=cy(n.reverse(),e);return[r,o]}function e2(e){const n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const i=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||i?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)n.push(r.currentNode);return n}function cy(e,n){for(const r of e)if(!DT(r,{upTo:n}))return r}function DT(e,{upTo:n}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(n!==void 0&&e===n)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function LT(e){return e instanceof HTMLInputElement&&"select"in e}function _r(e,{select:n=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&<(e)&&n&&e.select()}}var uy=zT();function zT(){let e=[];return{add(n){const r=e[0];n!==r&&(r==null||r.pause()),e=dy(e,n),e.unshift(n)},remove(n){var r;e=dy(e,n),(r=e[0])==null||r.resume()}}}function dy(e,n){const r=[...e],o=r.indexOf(n);return o!==-1&&r.splice(o,1),r}function FT(e){return e.filter(n=>n.tagName!=="A")}var BT="Portal",ss=x.forwardRef((e,n)=>{var l;const{container:r,...o}=e,[i,s]=x.useState(!1);Ye(()=>s(!0),[]);const a=r||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?JM.createPortal(p.jsx(fe.div,{...o,ref:n}),a):null});ss.displayName=BT;var Tf=0;function dd(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??fy()),document.body.insertAdjacentElement("beforeend",e[1]??fy()),Tf++,()=>{Tf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),Tf--}},[])}function fy(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var kn=function(){return kn=Object.assign||function(n){for(var r,o=1,i=arguments.length;o<i;o++){r=arguments[o];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])}return n},kn.apply(this,arguments)};function t2(e,n){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,o=Object.getOwnPropertySymbols(e);i<o.length;i++)n.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(r[o[i]]=e[o[i]]);return r}function HT(e,n,r){if(r||arguments.length===2)for(var o=0,i=n.length,s;o<i;o++)(s||!(o in n))&&(s||(s=Array.prototype.slice.call(n,0,o)),s[o]=n[o]);return e.concat(s||Array.prototype.slice.call(n))}var Cc="right-scroll-bar-position",Nc="width-before-scroll-bar",UT="with-scroll-bars-hidden",VT="--removed-body-scroll-bar-size";function If(e,n){return typeof e=="function"?e(n):e&&(e.current=n),e}function WT(e,n){var r=x.useState(function(){return{value:e,callback:n,facade:{get current(){return r.value},set current(o){var i=r.value;i!==o&&(r.value=o,r.callback(o,i))}}}})[0];return r.callback=n,r.facade}var GT=typeof window<"u"?x.useLayoutEffect:x.useEffect,hy=new WeakMap;function YT(e,n){var r=WT(null,function(o){return e.forEach(function(i){return If(i,o)})});return GT(function(){var o=hy.get(r);if(o){var i=new Set(o),s=new Set(e),a=r.current;i.forEach(function(l){s.has(l)||If(l,null)}),s.forEach(function(l){i.has(l)||If(l,a)})}hy.set(r,e)},[e]),r}function XT(e){return e}function KT(e,n){n===void 0&&(n=XT);var r=[],o=!1,i={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(s){var a=n(s,o);return r.push(a),function(){r=r.filter(function(l){return l!==a})}},assignSyncMedium:function(s){for(o=!0;r.length;){var a=r;r=[],a.forEach(s)}r={push:function(l){return s(l)},filter:function(){return r}}},assignMedium:function(s){o=!0;var a=[];if(r.length){var l=r;r=[],l.forEach(s),a=r}var c=function(){var f=a;a=[],f.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),r={push:function(f){a.push(f),u()},filter:function(f){return a=a.filter(f),r}}}};return i}function qT(e){e===void 0&&(e={});var n=KT(null);return n.options=kn({async:!0,ssr:!1},e),n}var n2=function(e){var n=e.sideCar,r=t2(e,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=n.read();if(!o)throw new Error("Sidecar medium not found");return x.createElement(o,kn({},r))};n2.isSideCarExport=!0;function QT(e,n){return e.useMedium(n),n2}var r2=qT(),Of=function(){},fd=x.forwardRef(function(e,n){var r=x.useRef(null),o=x.useState({onScrollCapture:Of,onWheelCapture:Of,onTouchMoveCapture:Of}),i=o[0],s=o[1],a=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,f=e.enabled,d=e.shards,h=e.sideCar,g=e.noRelative,v=e.noIsolation,b=e.inert,_=e.allowPinchZoom,m=e.as,w=m===void 0?"div":m,y=e.gapMode,S=t2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=h,C=YT([r,n]),N=kn(kn({},S),i);return x.createElement(x.Fragment,null,f&&x.createElement(k,{sideCar:r2,removeScrollBar:u,shards:d,noRelative:g,noIsolation:v,inert:b,setCallbacks:s,allowPinchZoom:!!_,lockRef:r,gapMode:y}),a?x.cloneElement(x.Children.only(l),kn(kn({},N),{ref:C})):x.createElement(w,kn({},N,{className:c,ref:C}),l))});fd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};fd.classNames={fullWidth:Nc,zeroRight:Cc};var ZT=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function JT(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var n=ZT();return n&&e.setAttribute("nonce",n),e}function eI(e,n){e.styleSheet?e.styleSheet.cssText=n:e.appendChild(document.createTextNode(n))}function tI(e){var n=document.head||document.getElementsByTagName("head")[0];n.appendChild(e)}var nI=function(){var e=0,n=null;return{add:function(r){e==0&&(n=JT())&&(eI(n,r),tI(n)),e++},remove:function(){e--,!e&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},rI=function(){var e=nI();return function(n,r){x.useEffect(function(){return e.add(n),function(){e.remove()}},[n&&r])}},o2=function(){var e=rI(),n=function(r){var o=r.styles,i=r.dynamic;return e(o,i),null};return n},oI={left:0,top:0,right:0,gap:0},$f=function(e){return parseInt(e||"",10)||0},iI=function(e){var n=window.getComputedStyle(document.body),r=n[e==="padding"?"paddingLeft":"marginLeft"],o=n[e==="padding"?"paddingTop":"marginTop"],i=n[e==="padding"?"paddingRight":"marginRight"];return[$f(r),$f(o),$f(i)]},sI=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return oI;var n=iI(e),r=document.documentElement.clientWidth,o=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,o-r+n[2]-n[0])}},aI=o2(),Ei="data-scroll-locked",lI=function(e,n,r,o){var i=e.left,s=e.top,a=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
336
|
+
.`.concat(UT,` {
|
|
332
337
|
overflow: hidden `).concat(o,`;
|
|
333
338
|
padding-right: `).concat(l,"px ").concat(o,`;
|
|
334
339
|
}
|
|
@@ -362,28 +367,28 @@ Error generating stack: `+s.message+`
|
|
|
362
367
|
}
|
|
363
368
|
|
|
364
369
|
body[`).concat(Ei,`] {
|
|
365
|
-
`).concat(
|
|
370
|
+
`).concat(VT,": ").concat(l,`px;
|
|
366
371
|
}
|
|
367
|
-
`)},py=function(){var e=parseInt(document.body.getAttribute(Ei)||"0",10);return isFinite(e)?e:0},
|
|
372
|
+
`)},py=function(){var e=parseInt(document.body.getAttribute(Ei)||"0",10);return isFinite(e)?e:0},cI=function(){x.useEffect(function(){return document.body.setAttribute(Ei,(py()+1).toString()),function(){var e=py()-1;e<=0?document.body.removeAttribute(Ei):document.body.setAttribute(Ei,e.toString())}},[])},uI=function(e){var n=e.noRelative,r=e.noImportant,o=e.gapMode,i=o===void 0?"margin":o;cI();var s=x.useMemo(function(){return sI(i)},[i]);return x.createElement(aI,{styles:lI(s,!n,i,r?"":"!important")})},ip=!1;if(typeof window<"u")try{var Vl=Object.defineProperty({},"passive",{get:function(){return ip=!0,!0}});window.addEventListener("test",Vl,Vl),window.removeEventListener("test",Vl,Vl)}catch{ip=!1}var qo=ip?{passive:!1}:!1,dI=function(e){return e.tagName==="TEXTAREA"},i2=function(e,n){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[n]!=="hidden"&&!(r.overflowY===r.overflowX&&!dI(e)&&r[n]==="visible")},fI=function(e){return i2(e,"overflowY")},hI=function(e){return i2(e,"overflowX")},my=function(e,n){var r=n.ownerDocument,o=n;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var i=s2(e,o);if(i){var s=a2(e,o),a=s[1],l=s[2];if(a>l)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},pI=function(e){var n=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[n,r,o]},mI=function(e){var n=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[n,r,o]},s2=function(e,n){return e==="v"?fI(n):hI(n)},a2=function(e,n){return e==="v"?pI(n):mI(n)},gI=function(e,n){return e==="h"&&n==="rtl"?-1:1},vI=function(e,n,r,o,i){var s=gI(e,window.getComputedStyle(n).direction),a=s*o,l=r.target,c=n.contains(l),u=!1,f=a>0,d=0,h=0;do{if(!l)break;var g=a2(e,l),v=g[0],b=g[1],_=g[2],m=b-_-s*v;(v||m)&&s2(e,l)&&(d+=m,h+=v);var w=l.parentNode;l=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&l!==document.body||c&&(n.contains(l)||n===l));return(f&&Math.abs(d)<1||!f&&Math.abs(h)<1)&&(u=!0),u},Wl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},gy=function(e){return[e.deltaX,e.deltaY]},vy=function(e){return e&&"current"in e?e.current:e},yI=function(e,n){return e[0]===n[0]&&e[1]===n[1]},xI=function(e){return`
|
|
368
373
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
369
374
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
370
|
-
`)},
|
|
375
|
+
`)},wI=0,Qo=[];function bI(e){var n=x.useRef([]),r=x.useRef([0,0]),o=x.useRef(),i=x.useState(wI++)[0],s=x.useState(o2)[0],a=x.useRef(e);x.useEffect(function(){a.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var b=HT([e.lockRef.current],(e.shards||[]).map(vy),!0).filter(Boolean);return b.forEach(function(_){return _.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),b.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=x.useCallback(function(b,_){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!a.current.allowPinchZoom;var m=Wl(b),w=r.current,y="deltaX"in b?b.deltaX:w[0]-m[0],S="deltaY"in b?b.deltaY:w[1]-m[1],k,C=b.target,N=Math.abs(y)>Math.abs(S)?"h":"v";if("touches"in b&&N==="h"&&C.type==="range")return!1;var E=window.getSelection(),j=E&&E.anchorNode,A=j?j===C||j.contains(C):!1;if(A)return!1;var T=my(N,C);if(!T)return!0;if(T?k=N:(k=N==="v"?"h":"v",T=my(N,C)),!T)return!1;if(!o.current&&"changedTouches"in b&&(y||S)&&(o.current=k),!k)return!0;var D=o.current||k;return vI(D,_,b,D==="h"?y:S)},[]),c=x.useCallback(function(b){var _=b;if(!(!Qo.length||Qo[Qo.length-1]!==s)){var m="deltaY"in _?gy(_):Wl(_),w=n.current.filter(function(k){return k.name===_.type&&(k.target===_.target||_.target===k.shadowParent)&&yI(k.delta,m)})[0];if(w&&w.should){_.cancelable&&_.preventDefault();return}if(!w){var y=(a.current.shards||[]).map(vy).filter(Boolean).filter(function(k){return k.contains(_.target)}),S=y.length>0?l(_,y[0]):!a.current.noIsolation;S&&_.cancelable&&_.preventDefault()}}},[]),u=x.useCallback(function(b,_,m,w){var y={name:b,delta:_,target:m,should:w,shadowParent:_I(m)};n.current.push(y),setTimeout(function(){n.current=n.current.filter(function(S){return S!==y})},1)},[]),f=x.useCallback(function(b){r.current=Wl(b),o.current=void 0},[]),d=x.useCallback(function(b){u(b.type,gy(b),b.target,l(b,e.lockRef.current))},[]),h=x.useCallback(function(b){u(b.type,Wl(b),b.target,l(b,e.lockRef.current))},[]);x.useEffect(function(){return Qo.push(s),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:h}),document.addEventListener("wheel",c,qo),document.addEventListener("touchmove",c,qo),document.addEventListener("touchstart",f,qo),function(){Qo=Qo.filter(function(b){return b!==s}),document.removeEventListener("wheel",c,qo),document.removeEventListener("touchmove",c,qo),document.removeEventListener("touchstart",f,qo)}},[]);var g=e.removeScrollBar,v=e.inert;return x.createElement(x.Fragment,null,v?x.createElement(s,{styles:xI(i)}):null,g?x.createElement(uI,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function _I(e){for(var n=null;e!==null;)e instanceof ShadowRoot&&(n=e.host,e=e.host),e=e.parentNode;return n}const SI=QT(r2,bI);var Ga=x.forwardRef(function(e,n){return x.createElement(fd,kn({},e,{ref:n,sideCar:SI}))});Ga.classNames=fd.classNames;var kI=function(e){if(typeof document>"u")return null;var n=Array.isArray(e)?e[0]:e;return n.ownerDocument.body},Zo=new WeakMap,Gl=new WeakMap,Yl={},Df=0,l2=function(e){return e&&(e.host||l2(e.parentNode))},CI=function(e,n){return n.map(function(r){if(e.contains(r))return r;var o=l2(r);return o&&e.contains(o)?o:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},NI=function(e,n,r,o){var i=CI(n,Array.isArray(e)?e:[e]);Yl[r]||(Yl[r]=new WeakMap);var s=Yl[r],a=[],l=new Set,c=new Set(i),u=function(d){!d||l.has(d)||(l.add(d),u(d.parentNode))};i.forEach(u);var f=function(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,function(h){if(l.has(h))f(h);else try{var g=h.getAttribute(o),v=g!==null&&g!=="false",b=(Zo.get(h)||0)+1,_=(s.get(h)||0)+1;Zo.set(h,b),s.set(h,_),a.push(h),b===1&&v&&Gl.set(h,!0),_===1&&h.setAttribute(r,"true"),v||h.setAttribute(o,"true")}catch(m){console.error("aria-hidden: cannot operate on ",h,m)}})};return f(n),l.clear(),Df++,function(){a.forEach(function(d){var h=Zo.get(d)-1,g=s.get(d)-1;Zo.set(d,h),s.set(d,g),h||(Gl.has(d)||d.removeAttribute(o),Gl.delete(d)),g||d.removeAttribute(r)}),Df--,Df||(Zo=new WeakMap,Zo=new WeakMap,Gl=new WeakMap,Yl={})}},hd=function(e,n,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),i=kI(e);return i?(o.push.apply(o,Array.from(i.querySelectorAll("[aria-live], script"))),NI(o,i,r,"aria-hidden")):function(){return null}},pd="Dialog",[c2]=Qt(pd),[EI,vn]=c2(pd),u2=e=>{const{__scopeDialog:n,children:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=x.useRef(null),c=x.useRef(null),[u,f]=Va({prop:o,defaultProp:i??!1,onChange:s,caller:pd});return p.jsx(EI,{scope:n,triggerRef:l,contentRef:c,contentId:Tt(),titleId:Tt(),descriptionId:Tt(),open:u,onOpenChange:f,onOpenToggle:x.useCallback(()=>f(d=>!d),[f]),modal:a,children:r})};u2.displayName=pd;var d2="DialogTrigger",jI=x.forwardRef((e,n)=>{const{__scopeDialog:r,...o}=e,i=vn(d2,r),s=xe(n,i.triggerRef);return p.jsx(fe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":sg(i.open),...o,ref:s,onClick:re(e.onClick,i.onOpenToggle)})});jI.displayName=d2;var og="DialogPortal",[PI,f2]=c2(og,{forceMount:void 0}),h2=e=>{const{__scopeDialog:n,forceMount:r,children:o,container:i}=e,s=vn(og,n);return p.jsx(PI,{scope:n,forceMount:r,children:x.Children.map(o,a=>p.jsx(kt,{present:r||s.open,children:p.jsx(ss,{asChild:!0,container:i,children:a})}))})};h2.displayName=og;var du="DialogOverlay",p2=x.forwardRef((e,n)=>{const r=f2(du,e.__scopeDialog),{forceMount:o=r.forceMount,...i}=e,s=vn(du,e.__scopeDialog);return s.modal?p.jsx(kt,{present:o||s.open,children:p.jsx(RI,{...i,ref:n})}):null});p2.displayName=du;var MI=Ao("DialogOverlay.RemoveScroll"),RI=x.forwardRef((e,n)=>{const{__scopeDialog:r,...o}=e,i=vn(du,r);return p.jsx(Ga,{as:MI,allowPinchZoom:!0,shards:[i.contentRef],children:p.jsx(fe.div,{"data-state":sg(i.open),...o,ref:n,style:{pointerEvents:"auto",...o.style}})})}),To="DialogContent",m2=x.forwardRef((e,n)=>{const r=f2(To,e.__scopeDialog),{forceMount:o=r.forceMount,...i}=e,s=vn(To,e.__scopeDialog);return p.jsx(kt,{present:o||s.open,children:s.modal?p.jsx(AI,{...i,ref:n}):p.jsx(TI,{...i,ref:n})})});m2.displayName=To;var AI=x.forwardRef((e,n)=>{const r=vn(To,e.__scopeDialog),o=x.useRef(null),i=xe(n,r.contentRef,o);return x.useEffect(()=>{const s=o.current;if(s)return hd(s)},[]),p.jsx(g2,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:re(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=r.triggerRef.current)==null||a.focus()}),onPointerDownOutside:re(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&s.preventDefault()}),onFocusOutside:re(e.onFocusOutside,s=>s.preventDefault())})}),TI=x.forwardRef((e,n)=>{const r=vn(To,e.__scopeDialog),o=x.useRef(!1),i=x.useRef(!1);return p.jsx(g2,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,l;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(o.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:s=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((u=r.triggerRef.current)==null?void 0:u.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),g2=x.forwardRef((e,n)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,...a}=e,l=vn(To,r),c=x.useRef(null),u=xe(n,c);return dd(),p.jsxs(p.Fragment,{children:[p.jsx(Wa,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:s,children:p.jsx(is,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":sg(l.open),...a,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(II,{titleId:l.titleId}),p.jsx($I,{contentRef:c,descriptionId:l.descriptionId})]})]})}),ig="DialogTitle",v2=x.forwardRef((e,n)=>{const{__scopeDialog:r,...o}=e,i=vn(ig,r);return p.jsx(fe.h2,{id:i.titleId,...o,ref:n})});v2.displayName=ig;var y2="DialogDescription",x2=x.forwardRef((e,n)=>{const{__scopeDialog:r,...o}=e,i=vn(y2,r);return p.jsx(fe.p,{id:i.descriptionId,...o,ref:n})});x2.displayName=y2;var w2="DialogClose",b2=x.forwardRef((e,n)=>{const{__scopeDialog:r,...o}=e,i=vn(w2,r);return p.jsx(fe.button,{type:"button",...o,ref:n,onClick:re(e.onClick,()=>i.onOpenChange(!1))})});b2.displayName=w2;function sg(e){return e?"open":"closed"}var _2="DialogTitleWarning",[qG,S2]=qA(_2,{contentName:To,titleName:ig,docsSlug:"dialog"}),II=({titleId:e})=>{const n=S2(_2),r=`\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users.
|
|
371
376
|
|
|
372
377
|
If you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
373
378
|
|
|
374
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},TI="DialogDescriptionWarning",II=({contentRef:e,descriptionId:n})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${S2(TI).contentName}}.`;return x.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");n&&i&&(document.getElementById(n)||console.warn(o))},[o,e,n]),null},OI=u2,ag=h2,Ya=p2,Xa=m2,md=v2,gd=x2,k2=b2,ks='[cmdk-group=""]',Lf='[cmdk-group-items=""]',$I='[cmdk-group-heading=""]',C2='[cmdk-item=""]',yy=`${C2}:not([aria-disabled="true"])`,sp="cmdk-item-select",ii="data-value",DI=(e,n,r)=>ST(e,n,r),N2=x.createContext(void 0),Ka=()=>x.useContext(N2),E2=x.createContext(void 0),lg=()=>x.useContext(E2),j2=x.createContext(void 0),P2=x.forwardRef((e,n)=>{let r=si(()=>{var $,K;return{search:"",value:(K=($=e.value)!=null?$:e.defaultValue)!=null?K:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=si(()=>new Set),i=si(()=>new Map),s=si(()=>new Map),a=si(()=>new Set),l=M2(e),{label:c,children:u,value:f,onValueChange:d,filter:h,shouldFilter:g,loop:v,disablePointerSelection:b=!1,vimBindings:_=!0,...m}=e,w=Tt(),y=Tt(),S=Tt(),k=x.useRef(null),C=XI();Io(()=>{if(f!==void 0){let $=f.trim();r.current.value=$,N.emit()}},[f]),Io(()=>{C(6,F)},[]);let N=x.useMemo(()=>({subscribe:$=>(a.current.add($),()=>a.current.delete($)),snapshot:()=>r.current,setState:($,K,B)=>{var U,G,W,X;if(!Object.is(r.current[$],K)){if(r.current[$]=K,$==="search")D(),A(),C(1,T);else if($==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let q=document.getElementById(S);q?q.focus():(U=document.getElementById(w))==null||U.focus()}if(C(7,()=>{var q;r.current.selectedItemId=(q=P())==null?void 0:q.id,N.emit()}),B||C(5,F),((G=l.current)==null?void 0:G.value)!==void 0){let q=K??"";(X=(W=l.current).onValueChange)==null||X.call(W,q);return}}N.emit()}},emit:()=>{a.current.forEach($=>$())}}),[]),E=x.useMemo(()=>({value:($,K,B)=>{var U;K!==((U=s.current.get($))==null?void 0:U.value)&&(s.current.set($,{value:K,keywords:B}),r.current.filtered.items.set($,j(K,B)),C(2,()=>{A(),N.emit()}))},item:($,K)=>(o.current.add($),K&&(i.current.has(K)?i.current.get(K).add($):i.current.set(K,new Set([$]))),C(3,()=>{D(),A(),r.current.value||T(),N.emit()}),()=>{s.current.delete($),o.current.delete($),r.current.filtered.items.delete($);let B=P();C(4,()=>{D(),(B==null?void 0:B.getAttribute("id"))===$&&T(),N.emit()})}),group:$=>(i.current.has($)||i.current.set($,new Set),()=>{s.current.delete($),i.current.delete($)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:w,inputId:S,labelId:y,listInnerRef:k}),[]);function j($,K){var B,U;let G=(U=(B=l.current)==null?void 0:B.filter)!=null?U:DI;return $?G($,r.current.search,K):0}function A(){if(!r.current.search||l.current.shouldFilter===!1)return;let $=r.current.filtered.items,K=[];r.current.filtered.groups.forEach(U=>{let G=i.current.get(U),W=0;G.forEach(X=>{let q=$.get(X);W=Math.max(q,W)}),K.push([U,W])});let B=k.current;L().sort((U,G)=>{var W,X;let q=U.getAttribute("id"),te=G.getAttribute("id");return((W=$.get(te))!=null?W:0)-((X=$.get(q))!=null?X:0)}).forEach(U=>{let G=U.closest(Lf);G?G.appendChild(U.parentElement===G?U:U.closest(`${Lf} > *`)):B.appendChild(U.parentElement===B?U:U.closest(`${Lf} > *`))}),K.sort((U,G)=>G[1]-U[1]).forEach(U=>{var G;let W=(G=k.current)==null?void 0:G.querySelector(`${ks}[${ii}="${encodeURIComponent(U[0])}"]`);W==null||W.parentElement.appendChild(W)})}function T(){let $=L().find(B=>B.getAttribute("aria-disabled")!=="true"),K=$==null?void 0:$.getAttribute(ii);N.setState("value",K||void 0)}function D(){var $,K,B,U;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=o.current.size;return}r.current.filtered.groups=new Set;let G=0;for(let W of o.current){let X=(K=($=s.current.get(W))==null?void 0:$.value)!=null?K:"",q=(U=(B=s.current.get(W))==null?void 0:B.keywords)!=null?U:[],te=j(X,q);r.current.filtered.items.set(W,te),te>0&&G++}for(let[W,X]of i.current)for(let q of X)if(r.current.filtered.items.get(q)>0){r.current.filtered.groups.add(W);break}r.current.filtered.count=G}function F(){var $,K,B;let U=P();U&&((($=U.parentElement)==null?void 0:$.firstChild)===U&&((B=(K=U.closest(ks))==null?void 0:K.querySelector($I))==null||B.scrollIntoView({block:"nearest"})),U.scrollIntoView({block:"nearest"}))}function P(){var $;return($=k.current)==null?void 0:$.querySelector(`${C2}[aria-selected="true"]`)}function L(){var $;return Array.from((($=k.current)==null?void 0:$.querySelectorAll(yy))||[])}function I($){let K=L()[$];K&&N.setState("value",K.getAttribute(ii))}function z($){var K;let B=P(),U=L(),G=U.findIndex(X=>X===B),W=U[G+$];(K=l.current)!=null&&K.loop&&(W=G+$<0?U[U.length-1]:G+$===U.length?U[0]:U[G+$]),W&&N.setState("value",W.getAttribute(ii))}function R($){let K=P(),B=K==null?void 0:K.closest(ks),U;for(;B&&!U;)B=$>0?GI(B,ks):YI(B,ks),U=B==null?void 0:B.querySelector(yy);U?N.setState("value",U.getAttribute(ii)):z($)}let M=()=>I(L().length-1),O=$=>{$.preventDefault(),$.metaKey?M():$.altKey?R(1):z(1)},V=$=>{$.preventDefault(),$.metaKey?I(0):$.altKey?R(-1):z(-1)};return x.createElement(mt.div,{ref:n,tabIndex:-1,...m,"cmdk-root":"",onKeyDown:$=>{var K;(K=m.onKeyDown)==null||K.call(m,$);let B=$.nativeEvent.isComposing||$.keyCode===229;if(!($.defaultPrevented||B))switch($.key){case"n":case"j":{_&&$.ctrlKey&&O($);break}case"ArrowDown":{O($);break}case"p":case"k":{_&&$.ctrlKey&&V($);break}case"ArrowUp":{V($);break}case"Home":{$.preventDefault(),I(0);break}case"End":{$.preventDefault(),M();break}case"Enter":{$.preventDefault();let U=P();if(U){let G=new Event(sp);U.dispatchEvent(G)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:qI},c),vd(e,$=>x.createElement(E2.Provider,{value:N},x.createElement(N2.Provider,{value:E},$))))}),LI=x.forwardRef((e,n)=>{var r,o;let i=Tt(),s=x.useRef(null),a=x.useContext(j2),l=Ka(),c=M2(e),u=(o=(r=c.current)==null?void 0:r.forceMount)!=null?o:a==null?void 0:a.forceMount;Io(()=>{if(!u)return l.item(i,a==null?void 0:a.id)},[u]);let f=R2(i,s,[e.value,e.children,s],e.keywords),d=lg(),h=Gr(C=>C.value&&C.value===f.current),g=Gr(C=>u||l.filter()===!1?!0:C.search?C.filtered.items.get(i)>0:!0);x.useEffect(()=>{let C=s.current;if(!(!C||e.disabled))return C.addEventListener(sp,v),()=>C.removeEventListener(sp,v)},[g,e.onSelect,e.disabled]);function v(){var C,N;b(),(N=(C=c.current).onSelect)==null||N.call(C,f.current)}function b(){d.setState("value",f.current,!0)}if(!g)return null;let{disabled:_,value:m,onSelect:w,forceMount:y,keywords:S,...k}=e;return x.createElement(mt.div,{ref:An(s,n),...k,id:i,"cmdk-item":"",role:"option","aria-disabled":!!_,"aria-selected":!!h,"data-disabled":!!_,"data-selected":!!h,onPointerMove:_||l.getDisablePointerSelection()?void 0:b,onClick:_?void 0:v},e.children)}),zI=x.forwardRef((e,n)=>{let{heading:r,children:o,forceMount:i,...s}=e,a=Tt(),l=x.useRef(null),c=x.useRef(null),u=Tt(),f=Ka(),d=Gr(g=>i||f.filter()===!1?!0:g.search?g.filtered.groups.has(a):!0);Io(()=>f.group(a),[]),R2(a,l,[e.value,e.heading,c]);let h=x.useMemo(()=>({id:a,forceMount:i}),[i]);return x.createElement(mt.div,{ref:An(l,n),...s,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},r&&x.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},r),vd(e,g=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?u:void 0},x.createElement(j2.Provider,{value:h},g))))}),FI=x.forwardRef((e,n)=>{let{alwaysRender:r,...o}=e,i=x.useRef(null),s=Gr(a=>!a.search);return!r&&!s?null:x.createElement(mt.div,{ref:An(i,n),...o,"cmdk-separator":"",role:"separator"})}),BI=x.forwardRef((e,n)=>{let{onValueChange:r,...o}=e,i=e.value!=null,s=lg(),a=Gr(u=>u.search),l=Gr(u=>u.selectedItemId),c=Ka();return x.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),x.createElement(mt.input,{ref:n,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:i?e.value:a,onChange:u=>{i||s.setState("search",u.target.value),r==null||r(u.target.value)}})}),HI=x.forwardRef((e,n)=>{let{children:r,label:o="Suggestions",...i}=e,s=x.useRef(null),a=x.useRef(null),l=Gr(u=>u.selectedItemId),c=Ka();return x.useEffect(()=>{if(a.current&&s.current){let u=a.current,f=s.current,d,h=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let g=u.offsetHeight;f.style.setProperty("--cmdk-list-height",g.toFixed(1)+"px")})});return h.observe(u),()=>{cancelAnimationFrame(d),h.unobserve(u)}}},[]),x.createElement(mt.div,{ref:An(s,n),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":o,id:c.listId},vd(e,u=>x.createElement("div",{ref:An(a,c.listInnerRef),"cmdk-list-sizer":""},u)))}),UI=x.forwardRef((e,n)=>{let{open:r,onOpenChange:o,overlayClassName:i,contentClassName:s,container:a,...l}=e;return x.createElement(OI,{open:r,onOpenChange:o},x.createElement(ag,{container:a},x.createElement(Ya,{"cmdk-overlay":"",className:i}),x.createElement(Xa,{"aria-label":e.label,"cmdk-dialog":"",className:s},x.createElement(P2,{ref:n,...l}))))}),VI=x.forwardRef((e,n)=>Gr(r=>r.filtered.count===0)?x.createElement(mt.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),WI=x.forwardRef((e,n)=>{let{progress:r,children:o,label:i="Loading...",...s}=e;return x.createElement(mt.div,{ref:n,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},vd(e,a=>x.createElement("div",{"aria-hidden":!0},a)))}),Ct=Object.assign(P2,{List:HI,Item:LI,Input:BI,Group:zI,Separator:FI,Dialog:UI,Empty:VI,Loading:WI});function GI(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function YI(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function M2(e){let n=x.useRef(e);return Io(()=>{n.current=e}),n}var Io=typeof window>"u"?x.useEffect:x.useLayoutEffect;function si(e){let n=x.useRef();return n.current===void 0&&(n.current=e()),n}function Gr(e){let n=lg(),r=()=>e(n.snapshot());return x.useSyncExternalStore(n.subscribe,r,r)}function R2(e,n,r,o=[]){let i=x.useRef(),s=Ka();return Io(()=>{var a;let l=(()=>{var u;for(let f of r){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(u=f.current.textContent)==null?void 0:u.trim():i.current}})(),c=o.map(u=>u.trim());s.value(e,l,c),(a=n.current)==null||a.setAttribute(ii,l),i.current=l}),i}var XI=()=>{let[e,n]=x.useState(),r=si(()=>new Map);return Io(()=>{r.current.forEach(o=>o()),r.current=new Map},[e]),(o,i)=>{r.current.set(o,i),n({})}};function KI(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function vd({asChild:e,children:n},r){return e&&x.isValidElement(n)?x.cloneElement(KI(n),{ref:n.ref},r(n.props.children)):r(n)}var qI={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const QI=x.forwardRef(({className:e,...n},r)=>p.jsx(Ct,{ref:r,className:ae("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n}));QI.displayName=Ct.displayName;const ZI=x.forwardRef(({className:e,...n},r)=>p.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[p.jsx(kA,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),p.jsx(Ct.Input,{ref:r,className:ae("flex h-9 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n})]}));ZI.displayName=Ct.Input.displayName;const JI=x.forwardRef(({className:e,onWheel:n,...r},o)=>p.jsx(Ct.List,{ref:o,className:ae("overflow-y-auto overflow-x-hidden",e),style:{maxHeight:300},onWheel:n??(i=>{i.currentTarget.scrollTop+=i.deltaY}),...r}));JI.displayName=Ct.List.displayName;const e4=x.forwardRef((e,n)=>p.jsx(Ct.Empty,{ref:n,className:"py-6 text-center text-sm",...e}));e4.displayName=Ct.Empty.displayName;const t4=x.forwardRef(({className:e,...n},r)=>p.jsx(Ct.Group,{ref:r,className:ae("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...n}));t4.displayName=Ct.Group.displayName;const n4=x.forwardRef(({className:e,...n},r)=>p.jsx(Ct.Separator,{ref:r,className:ae("-mx-1 h-px bg-border",e),...n}));n4.displayName=Ct.Separator.displayName;const r4=x.forwardRef(({className:e,...n},r)=>p.jsx(Ct.Item,{ref:r,className:ae("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...n}));r4.displayName=Ct.Item.displayName;const o4=ag,A2=x.forwardRef(({className:e,...n},r)=>p.jsx(Ya,{ref:r,className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...n}));A2.displayName=Ya.displayName;const i4=x.forwardRef(({className:e,children:n,...r},o)=>p.jsxs(o4,{children:[p.jsx(A2,{}),p.jsxs(Xa,{ref:o,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[n,p.jsxs(k2,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[p.jsx(uu,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));i4.displayName=Xa.displayName;const s4=x.forwardRef(({className:e,...n},r)=>p.jsx(md,{ref:r,className:ae("text-lg font-semibold leading-none tracking-tight",e),...n}));s4.displayName=md.displayName;const a4=x.forwardRef(({className:e,...n},r)=>p.jsx(gd,{ref:r,className:ae("text-sm text-muted-foreground",e),...n}));a4.displayName=gd.displayName;function cg(e){const n=e+"CollectionProvider",[r,o]=Qt(n),[i,s]=r(n,{collectionRef:{current:null},itemMap:new Map}),a=b=>{const{scope:_,children:m}=b,w=it.useRef(null),y=it.useRef(new Map).current;return p.jsx(i,{scope:_,itemMap:y,collectionRef:w,children:m})};a.displayName=n;const l=e+"CollectionSlot",c=Ao(l),u=it.forwardRef((b,_)=>{const{scope:m,children:w}=b,y=s(l,m),S=xe(_,y.collectionRef);return p.jsx(c,{ref:S,children:w})});u.displayName=l;const f=e+"CollectionItemSlot",d="data-radix-collection-item",h=Ao(f),g=it.forwardRef((b,_)=>{const{scope:m,children:w,...y}=b,S=it.useRef(null),k=xe(_,S),C=s(f,m);return it.useEffect(()=>(C.itemMap.set(S,{ref:S,...y}),()=>void C.itemMap.delete(S))),p.jsx(h,{[d]:"",ref:k,children:w})});g.displayName=f;function v(b){const _=s(e+"CollectionConsumer",b);return it.useCallback(()=>{const w=_.collectionRef.current;if(!w)return[];const y=Array.from(w.querySelectorAll(`[${d}]`));return Array.from(_.itemMap.values()).sort((C,N)=>y.indexOf(C.ref.current)-y.indexOf(N.ref.current))},[_.collectionRef,_.itemMap])}return[{Provider:a,Slot:u,ItemSlot:g},v,o]}var l4=x.createContext(void 0);function T2(e){const n=x.useContext(l4);return e||n||"ltr"}const c4=["top","right","bottom","left"],Yr=Math.min,Mt=Math.max,fu=Math.round,Xl=Math.floor,Pn=e=>({x:e,y:e}),u4={left:"right",right:"left",bottom:"top",top:"bottom"};function ap(e,n,r){return Mt(e,Yr(n,r))}function ir(e,n){return typeof e=="function"?e(n):e}function sr(e){return e.split("-")[0]}function as(e){return e.split("-")[1]}function ug(e){return e==="x"?"y":"x"}function dg(e){return e==="y"?"height":"width"}function Cn(e){const n=e[0];return n==="t"||n==="b"?"y":"x"}function fg(e){return ug(Cn(e))}function d4(e,n,r){r===void 0&&(r=!1);const o=as(e),i=fg(e),s=dg(i);let a=i==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return n.reference[s]>n.floating[s]&&(a=hu(a)),[a,hu(a)]}function f4(e){const n=hu(e);return[lp(e),n,lp(n)]}function lp(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const xy=["left","right"],wy=["right","left"],h4=["top","bottom"],p4=["bottom","top"];function m4(e,n,r){switch(e){case"top":case"bottom":return r?n?wy:xy:n?xy:wy;case"left":case"right":return n?h4:p4;default:return[]}}function g4(e,n,r,o){const i=as(e);let s=m4(sr(e),r==="start",o);return i&&(s=s.map(a=>a+"-"+i),n&&(s=s.concat(s.map(lp)))),s}function hu(e){const n=sr(e);return u4[n]+e.slice(n.length)}function v4(e){return{top:0,right:0,bottom:0,left:0,...e}}function I2(e){return typeof e!="number"?v4(e):{top:e,right:e,bottom:e,left:e}}function pu(e){const{x:n,y:r,width:o,height:i}=e;return{width:o,height:i,top:r,left:n,right:n+o,bottom:r+i,x:n,y:r}}function by(e,n,r){let{reference:o,floating:i}=e;const s=Cn(n),a=fg(n),l=dg(a),c=sr(n),u=s==="y",f=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,h=o[l]/2-i[l]/2;let g;switch(c){case"top":g={x:f,y:o.y-i.height};break;case"bottom":g={x:f,y:o.y+o.height};break;case"right":g={x:o.x+o.width,y:d};break;case"left":g={x:o.x-i.width,y:d};break;default:g={x:o.x,y:o.y}}switch(as(n)){case"start":g[a]-=h*(r&&u?-1:1);break;case"end":g[a]+=h*(r&&u?-1:1);break}return g}async function y4(e,n){var r;n===void 0&&(n={});const{x:o,y:i,platform:s,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:h=!1,padding:g=0}=ir(n,e),v=I2(g),_=l[h?d==="floating"?"reference":"floating":d],m=pu(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(_)))==null||r?_:_.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:f,strategy:c})),w=d==="floating"?{x:o,y:i,width:a.floating.width,height:a.floating.height}:a.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),S=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},k=pu(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:y,strategy:c}):w);return{top:(m.top-k.top+v.top)/S.y,bottom:(k.bottom-m.bottom+v.bottom)/S.y,left:(m.left-k.left+v.left)/S.x,right:(k.right-m.right+v.right)/S.x}}const x4=50,w4=async(e,n,r)=>{const{placement:o="bottom",strategy:i="absolute",middleware:s=[],platform:a}=r,l=a.detectOverflow?a:{...a,detectOverflow:y4},c=await(a.isRTL==null?void 0:a.isRTL(n));let u=await a.getElementRects({reference:e,floating:n,strategy:i}),{x:f,y:d}=by(u,o,c),h=o,g=0;const v={};for(let b=0;b<s.length;b++){const _=s[b];if(!_)continue;const{name:m,fn:w}=_,{x:y,y:S,data:k,reset:C}=await w({x:f,y:d,initialPlacement:o,placement:h,strategy:i,middlewareData:v,rects:u,platform:l,elements:{reference:e,floating:n}});f=y??f,d=S??d,v[m]={...v[m],...k},C&&g<x4&&(g++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(u=C.rects===!0?await a.getElementRects({reference:e,floating:n,strategy:i}):C.rects),{x:f,y:d}=by(u,h,c)),b=-1)}return{x:f,y:d,placement:h,strategy:i,middlewareData:v}},b4=e=>({name:"arrow",options:e,async fn(n){const{x:r,y:o,placement:i,rects:s,platform:a,elements:l,middlewareData:c}=n,{element:u,padding:f=0}=ir(e,n)||{};if(u==null)return{};const d=I2(f),h={x:r,y:o},g=fg(i),v=dg(g),b=await a.getDimensions(u),_=g==="y",m=_?"top":"left",w=_?"bottom":"right",y=_?"clientHeight":"clientWidth",S=s.reference[v]+s.reference[g]-h[g]-s.floating[v],k=h[g]-s.reference[g],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let N=C?C[y]:0;(!N||!await(a.isElement==null?void 0:a.isElement(C)))&&(N=l.floating[y]||s.floating[v]);const E=S/2-k/2,j=N/2-b[v]/2-1,A=Yr(d[m],j),T=Yr(d[w],j),D=A,F=N-b[v]-T,P=N/2-b[v]/2+E,L=ap(D,P,F),I=!c.arrow&&as(i)!=null&&P!==L&&s.reference[v]/2-(P<D?A:T)-b[v]/2<0,z=I?P<D?P-D:P-F:0;return{[g]:h[g]+z,data:{[g]:L,centerOffset:P-L-z,...I&&{alignmentOffset:z}},reset:I}}}),_4=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(n){var r,o;const{placement:i,middlewareData:s,rects:a,initialPlacement:l,platform:c,elements:u}=n,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,..._}=ir(e,n);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const m=sr(i),w=Cn(l),y=sr(l)===l,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),k=h||(y||!b?[hu(l)]:f4(l)),C=v!=="none";!h&&C&&k.push(...g4(l,b,v,S));const N=[l,...k],E=await c.detectOverflow(n,_),j=[];let A=((o=s.flip)==null?void 0:o.overflows)||[];if(f&&j.push(E[m]),d){const P=d4(i,a,S);j.push(E[P[0]],E[P[1]])}if(A=[...A,{placement:i,overflows:j}],!j.every(P=>P<=0)){var T,D;const P=(((T=s.flip)==null?void 0:T.index)||0)+1,L=N[P];if(L&&(!(d==="alignment"?w!==Cn(L):!1)||A.every(R=>Cn(R.placement)===w?R.overflows[0]>0:!0)))return{data:{index:P,overflows:A},reset:{placement:L}};let I=(D=A.filter(z=>z.overflows[0]<=0).sort((z,R)=>z.overflows[1]-R.overflows[1])[0])==null?void 0:D.placement;if(!I)switch(g){case"bestFit":{var F;const z=(F=A.filter(R=>{if(C){const M=Cn(R.placement);return M===w||M==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(M=>M>0).reduce((M,O)=>M+O,0)]).sort((R,M)=>R[1]-M[1])[0])==null?void 0:F[0];z&&(I=z);break}case"initialPlacement":I=l;break}if(i!==I)return{reset:{placement:I}}}return{}}}};function _y(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function Sy(e){return c4.some(n=>e[n]>=0)}const S4=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:r,platform:o}=n,{strategy:i="referenceHidden",...s}=ir(e,n);switch(i){case"referenceHidden":{const a=await o.detectOverflow(n,{...s,elementContext:"reference"}),l=_y(a,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Sy(l)}}}case"escaped":{const a=await o.detectOverflow(n,{...s,altBoundary:!0}),l=_y(a,r.floating);return{data:{escapedOffsets:l,escaped:Sy(l)}}}default:return{}}}}},O2=new Set(["left","top"]);async function k4(e,n){const{placement:r,platform:o,elements:i}=e,s=await(o.isRTL==null?void 0:o.isRTL(i.floating)),a=sr(r),l=as(r),c=Cn(r)==="y",u=O2.has(a)?-1:1,f=s&&c?-1:1,d=ir(n,e);let{mainAxis:h,crossAxis:g,alignmentAxis:v}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof v=="number"&&(g=l==="end"?v*-1:v),c?{x:g*f,y:h*u}:{x:h*u,y:g*f}}const C4=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var r,o;const{x:i,y:s,placement:a,middlewareData:l}=n,c=await k4(n,e);return a===((r=l.offset)==null?void 0:r.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:a}}}}},N4=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:r,y:o,placement:i,platform:s}=n,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:m=>{let{x:w,y}=m;return{x:w,y}}},...u}=ir(e,n),f={x:r,y:o},d=await s.detectOverflow(n,u),h=Cn(sr(i)),g=ug(h);let v=f[g],b=f[h];if(a){const m=g==="y"?"top":"left",w=g==="y"?"bottom":"right",y=v+d[m],S=v-d[w];v=ap(y,v,S)}if(l){const m=h==="y"?"top":"left",w=h==="y"?"bottom":"right",y=b+d[m],S=b-d[w];b=ap(y,b,S)}const _=c.fn({...n,[g]:v,[h]:b});return{..._,data:{x:_.x-r,y:_.y-o,enabled:{[g]:a,[h]:l}}}}}},E4=function(e){return e===void 0&&(e={}),{options:e,fn(n){const{x:r,y:o,placement:i,rects:s,middlewareData:a}=n,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=ir(e,n),f={x:r,y:o},d=Cn(i),h=ug(d);let g=f[h],v=f[d];const b=ir(l,n),_=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(c){const y=h==="y"?"height":"width",S=s.reference[h]-s.floating[y]+_.mainAxis,k=s.reference[h]+s.reference[y]-_.mainAxis;g<S?g=S:g>k&&(g=k)}if(u){var m,w;const y=h==="y"?"width":"height",S=O2.has(sr(i)),k=s.reference[d]-s.floating[y]+(S&&((m=a.offset)==null?void 0:m[d])||0)+(S?0:_.crossAxis),C=s.reference[d]+s.reference[y]+(S?0:((w=a.offset)==null?void 0:w[d])||0)-(S?_.crossAxis:0);v<k?v=k:v>C&&(v=C)}return{[h]:g,[d]:v}}}},j4=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){var r,o;const{placement:i,rects:s,platform:a,elements:l}=n,{apply:c=()=>{},...u}=ir(e,n),f=await a.detectOverflow(n,u),d=sr(i),h=as(i),g=Cn(i)==="y",{width:v,height:b}=s.floating;let _,m;d==="top"||d==="bottom"?(_=d,m=h===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(m=d,_=h==="end"?"top":"bottom");const w=b-f.top-f.bottom,y=v-f.left-f.right,S=Yr(b-f[_],w),k=Yr(v-f[m],y),C=!n.middlewareData.shift;let N=S,E=k;if((r=n.middlewareData.shift)!=null&&r.enabled.x&&(E=y),(o=n.middlewareData.shift)!=null&&o.enabled.y&&(N=w),C&&!h){const A=Mt(f.left,0),T=Mt(f.right,0),D=Mt(f.top,0),F=Mt(f.bottom,0);g?E=v-2*(A!==0||T!==0?A+T:Mt(f.left,f.right)):N=b-2*(D!==0||F!==0?D+F:Mt(f.top,f.bottom))}await c({...n,availableWidth:E,availableHeight:N});const j=await a.getDimensions(l.floating);return v!==j.width||b!==j.height?{reset:{rects:!0}}:{}}}};function yd(){return typeof window<"u"}function ls(e){return $2(e)?(e.nodeName||"").toLowerCase():"#document"}function It(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function On(e){var n;return(n=($2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function $2(e){return yd()?e instanceof Node||e instanceof It(e).Node:!1}function mn(e){return yd()?e instanceof Element||e instanceof It(e).Element:!1}function ur(e){return yd()?e instanceof HTMLElement||e instanceof It(e).HTMLElement:!1}function ky(e){return!yd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof It(e).ShadowRoot}function qa(e){const{overflow:n,overflowX:r,overflowY:o,display:i}=gn(e);return/auto|scroll|overlay|hidden|clip/.test(n+o+r)&&i!=="inline"&&i!=="contents"}function P4(e){return/^(table|td|th)$/.test(ls(e))}function xd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const M4=/transform|translate|scale|rotate|perspective|filter/,R4=/paint|layout|strict|content/,fo=e=>!!e&&e!=="none";let zf;function hg(e){const n=mn(e)?gn(e):e;return fo(n.transform)||fo(n.translate)||fo(n.scale)||fo(n.rotate)||fo(n.perspective)||!pg()&&(fo(n.backdropFilter)||fo(n.filter))||M4.test(n.willChange||"")||R4.test(n.contain||"")}function A4(e){let n=Xr(e);for(;ur(n)&&!Bi(n);){if(hg(n))return n;if(xd(n))return null;n=Xr(n)}return null}function pg(){return zf==null&&(zf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),zf}function Bi(e){return/^(html|body|#document)$/.test(ls(e))}function gn(e){return It(e).getComputedStyle(e)}function wd(e){return mn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xr(e){if(ls(e)==="html")return e;const n=e.assignedSlot||e.parentNode||ky(e)&&e.host||On(e);return ky(n)?n.host:n}function D2(e){const n=Xr(e);return Bi(n)?e.ownerDocument?e.ownerDocument.body:e.body:ur(n)&&qa(n)?n:D2(n)}function ka(e,n,r){var o;n===void 0&&(n=[]),r===void 0&&(r=!0);const i=D2(e),s=i===((o=e.ownerDocument)==null?void 0:o.body),a=It(i);if(s){const l=cp(a);return n.concat(a,a.visualViewport||[],qa(i)?i:[],l&&r?ka(l):[])}else return n.concat(i,ka(i,[],r))}function cp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function L2(e){const n=gn(e);let r=parseFloat(n.width)||0,o=parseFloat(n.height)||0;const i=ur(e),s=i?e.offsetWidth:r,a=i?e.offsetHeight:o,l=fu(r)!==s||fu(o)!==a;return l&&(r=s,o=a),{width:r,height:o,$:l}}function mg(e){return mn(e)?e:e.contextElement}function ji(e){const n=mg(e);if(!ur(n))return Pn(1);const r=n.getBoundingClientRect(),{width:o,height:i,$:s}=L2(n);let a=(s?fu(r.width):r.width)/o,l=(s?fu(r.height):r.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const T4=Pn(0);function z2(e){const n=It(e);return!pg()||!n.visualViewport?T4:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function I4(e,n,r){return n===void 0&&(n=!1),!r||n&&r!==It(e)?!1:n}function Oo(e,n,r,o){n===void 0&&(n=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),s=mg(e);let a=Pn(1);n&&(o?mn(o)&&(a=ji(o)):a=ji(e));const l=I4(s,r,o)?z2(s):Pn(0);let c=(i.left+l.x)/a.x,u=(i.top+l.y)/a.y,f=i.width/a.x,d=i.height/a.y;if(s){const h=It(s),g=o&&mn(o)?It(o):o;let v=h,b=cp(v);for(;b&&o&&g!==v;){const _=ji(b),m=b.getBoundingClientRect(),w=gn(b),y=m.left+(b.clientLeft+parseFloat(w.paddingLeft))*_.x,S=m.top+(b.clientTop+parseFloat(w.paddingTop))*_.y;c*=_.x,u*=_.y,f*=_.x,d*=_.y,c+=y,u+=S,v=It(b),b=cp(v)}}return pu({width:f,height:d,x:c,y:u})}function bd(e,n){const r=wd(e).scrollLeft;return n?n.left+r:Oo(On(e)).left+r}function F2(e,n){const r=e.getBoundingClientRect(),o=r.left+n.scrollLeft-bd(e,r),i=r.top+n.scrollTop;return{x:o,y:i}}function O4(e){let{elements:n,rect:r,offsetParent:o,strategy:i}=e;const s=i==="fixed",a=On(o),l=n?xd(n.floating):!1;if(o===a||l&&s)return r;let c={scrollLeft:0,scrollTop:0},u=Pn(1);const f=Pn(0),d=ur(o);if((d||!d&&!s)&&((ls(o)!=="body"||qa(a))&&(c=wd(o)),d)){const g=Oo(o);u=ji(o),f.x=g.x+o.clientLeft,f.y=g.y+o.clientTop}const h=a&&!d&&!s?F2(a,c):Pn(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+f.x+h.x,y:r.y*u.y-c.scrollTop*u.y+f.y+h.y}}function $4(e){return Array.from(e.getClientRects())}function D4(e){const n=On(e),r=wd(e),o=e.ownerDocument.body,i=Mt(n.scrollWidth,n.clientWidth,o.scrollWidth,o.clientWidth),s=Mt(n.scrollHeight,n.clientHeight,o.scrollHeight,o.clientHeight);let a=-r.scrollLeft+bd(e);const l=-r.scrollTop;return gn(o).direction==="rtl"&&(a+=Mt(n.clientWidth,o.clientWidth)-i),{width:i,height:s,x:a,y:l}}const Cy=25;function L4(e,n){const r=It(e),o=On(e),i=r.visualViewport;let s=o.clientWidth,a=o.clientHeight,l=0,c=0;if(i){s=i.width,a=i.height;const f=pg();(!f||f&&n==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const u=bd(o);if(u<=0){const f=o.ownerDocument,d=f.body,h=getComputedStyle(d),g=f.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,v=Math.abs(o.clientWidth-d.clientWidth-g);v<=Cy&&(s-=v)}else u<=Cy&&(s+=u);return{width:s,height:a,x:l,y:c}}function z4(e,n){const r=Oo(e,!0,n==="fixed"),o=r.top+e.clientTop,i=r.left+e.clientLeft,s=ur(e)?ji(e):Pn(1),a=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,u=o*s.y;return{width:a,height:l,x:c,y:u}}function Ny(e,n,r){let o;if(n==="viewport")o=L4(e,r);else if(n==="document")o=D4(On(e));else if(mn(n))o=z4(n,r);else{const i=z2(e);o={x:n.x-i.x,y:n.y-i.y,width:n.width,height:n.height}}return pu(o)}function B2(e,n){const r=Xr(e);return r===n||!mn(r)||Bi(r)?!1:gn(r).position==="fixed"||B2(r,n)}function F4(e,n){const r=n.get(e);if(r)return r;let o=ka(e,[],!1).filter(l=>mn(l)&&ls(l)!=="body"),i=null;const s=gn(e).position==="fixed";let a=s?Xr(e):e;for(;mn(a)&&!Bi(a);){const l=gn(a),c=hg(a);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||qa(a)&&!c&&B2(e,a))?o=o.filter(f=>f!==a):i=l,a=Xr(a)}return n.set(e,o),o}function B4(e){let{element:n,boundary:r,rootBoundary:o,strategy:i}=e;const a=[...r==="clippingAncestors"?xd(n)?[]:F4(n,this._c):[].concat(r),o],l=Ny(n,a[0],i);let c=l.top,u=l.right,f=l.bottom,d=l.left;for(let h=1;h<a.length;h++){const g=Ny(n,a[h],i);c=Mt(g.top,c),u=Yr(g.right,u),f=Yr(g.bottom,f),d=Mt(g.left,d)}return{width:u-d,height:f-c,x:d,y:c}}function H4(e){const{width:n,height:r}=L2(e);return{width:n,height:r}}function U4(e,n,r){const o=ur(n),i=On(n),s=r==="fixed",a=Oo(e,!0,s,n);let l={scrollLeft:0,scrollTop:0};const c=Pn(0);function u(){c.x=bd(i)}if(o||!o&&!s)if((ls(n)!=="body"||qa(i))&&(l=wd(n)),o){const g=Oo(n,!0,s,n);c.x=g.x+n.clientLeft,c.y=g.y+n.clientTop}else i&&u();s&&!o&&i&&u();const f=i&&!o&&!s?F2(i,l):Pn(0),d=a.left+l.scrollLeft-c.x-f.x,h=a.top+l.scrollTop-c.y-f.y;return{x:d,y:h,width:a.width,height:a.height}}function Ff(e){return gn(e).position==="static"}function Ey(e,n){if(!ur(e)||gn(e).position==="fixed")return null;if(n)return n(e);let r=e.offsetParent;return On(e)===r&&(r=r.ownerDocument.body),r}function H2(e,n){const r=It(e);if(xd(e))return r;if(!ur(e)){let i=Xr(e);for(;i&&!Bi(i);){if(mn(i)&&!Ff(i))return i;i=Xr(i)}return r}let o=Ey(e,n);for(;o&&P4(o)&&Ff(o);)o=Ey(o,n);return o&&Bi(o)&&Ff(o)&&!hg(o)?r:o||A4(e)||r}const V4=async function(e){const n=this.getOffsetParent||H2,r=this.getDimensions,o=await r(e.floating);return{reference:U4(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function W4(e){return gn(e).direction==="rtl"}const G4={convertOffsetParentRelativeRectToViewportRelativeRect:O4,getDocumentElement:On,getClippingRect:B4,getOffsetParent:H2,getElementRects:V4,getClientRects:$4,getDimensions:H4,getScale:ji,isElement:mn,isRTL:W4};function U2(e,n){return e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height}function Y4(e,n){let r=null,o;const i=On(e);function s(){var l;clearTimeout(o),(l=r)==null||l.disconnect(),r=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:f,top:d,width:h,height:g}=u;if(l||n(),!h||!g)return;const v=Xl(d),b=Xl(i.clientWidth-(f+h)),_=Xl(i.clientHeight-(d+g)),m=Xl(f),y={rootMargin:-v+"px "+-b+"px "+-_+"px "+-m+"px",threshold:Mt(0,Yr(1,c))||1};let S=!0;function k(C){const N=C[0].intersectionRatio;if(N!==c){if(!S)return a();N?a(!1,N):o=setTimeout(()=>{a(!1,1e-7)},1e3)}N===1&&!U2(u,e.getBoundingClientRect())&&a(),S=!1}try{r=new IntersectionObserver(k,{...y,root:i.ownerDocument})}catch{r=new IntersectionObserver(k,y)}r.observe(e)}return a(!0),s}function X4(e,n,r,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,u=mg(e),f=i||s?[...u?ka(u):[],...n?ka(n):[]]:[];f.forEach(m=>{i&&m.addEventListener("scroll",r,{passive:!0}),s&&m.addEventListener("resize",r)});const d=u&&l?Y4(u,r):null;let h=-1,g=null;a&&(g=new ResizeObserver(m=>{let[w]=m;w&&w.target===u&&g&&n&&(g.unobserve(n),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var y;(y=g)==null||y.observe(n)})),r()}),u&&!c&&g.observe(u),n&&g.observe(n));let v,b=c?Oo(e):null;c&&_();function _(){const m=Oo(e);b&&!U2(b,m)&&r(),b=m,v=requestAnimationFrame(_)}return r(),()=>{var m;f.forEach(w=>{i&&w.removeEventListener("scroll",r),s&&w.removeEventListener("resize",r)}),d==null||d(),(m=g)==null||m.disconnect(),g=null,c&&cancelAnimationFrame(v)}}const K4=C4,q4=N4,Q4=_4,Z4=j4,J4=S4,jy=b4,eO=E4,tO=(e,n,r)=>{const o=new Map,i={platform:G4,...r},s={...i.platform,_c:o};return w4(e,n,{...i,platform:s})};var nO=typeof document<"u",rO=function(){},Ec=nO?x.useLayoutEffect:rO;function mu(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(typeof e=="function"&&e.toString()===n.toString())return!0;let r,o,i;if(e&&n&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==n.length)return!1;for(o=r;o--!==0;)if(!mu(e[o],n[o]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!{}.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){const s=i[o];if(!(s==="_owner"&&e.$$typeof)&&!mu(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}function V2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Py(e,n){const r=V2(e);return Math.round(n*r)/r}function Bf(e){const n=x.useRef(e);return Ec(()=>{n.current=e}),n}function oO(e){e===void 0&&(e={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[f,d]=x.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[h,g]=x.useState(o);mu(h,o)||g(o);const[v,b]=x.useState(null),[_,m]=x.useState(null),w=x.useCallback(R=>{R!==C.current&&(C.current=R,b(R))},[]),y=x.useCallback(R=>{R!==N.current&&(N.current=R,m(R))},[]),S=s||v,k=a||_,C=x.useRef(null),N=x.useRef(null),E=x.useRef(f),j=c!=null,A=Bf(c),T=Bf(i),D=Bf(u),F=x.useCallback(()=>{if(!C.current||!N.current)return;const R={placement:n,strategy:r,middleware:h};T.current&&(R.platform=T.current),tO(C.current,N.current,R).then(M=>{const O={...M,isPositioned:D.current!==!1};P.current&&!mu(E.current,O)&&(E.current=O,ts.flushSync(()=>{d(O)}))})},[h,n,r,T,D]);Ec(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(R=>({...R,isPositioned:!1})))},[u]);const P=x.useRef(!1);Ec(()=>(P.current=!0,()=>{P.current=!1}),[]),Ec(()=>{if(S&&(C.current=S),k&&(N.current=k),S&&k){if(A.current)return A.current(S,k,F);F()}},[S,k,F,A,j]);const L=x.useMemo(()=>({reference:C,floating:N,setReference:w,setFloating:y}),[w,y]),I=x.useMemo(()=>({reference:S,floating:k}),[S,k]),z=x.useMemo(()=>{const R={position:r,left:0,top:0};if(!I.floating)return R;const M=Py(I.floating,f.x),O=Py(I.floating,f.y);return l?{...R,transform:"translate("+M+"px, "+O+"px)",...V2(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:M,top:O}},[r,l,I.floating,f.x,f.y]);return x.useMemo(()=>({...f,update:F,refs:L,elements:I,floatingStyles:z}),[f,F,L,I,z])}const iO=e=>{function n(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:o,padding:i}=typeof e=="function"?e(r):e;return o&&n(o)?o.current!=null?jy({element:o.current,padding:i}).fn(r):{}:o?jy({element:o,padding:i}).fn(r):{}}}},sO=(e,n)=>{const r=K4(e);return{name:r.name,fn:r.fn,options:[e,n]}},aO=(e,n)=>{const r=q4(e);return{name:r.name,fn:r.fn,options:[e,n]}},lO=(e,n)=>({fn:eO(e).fn,options:[e,n]}),cO=(e,n)=>{const r=Q4(e);return{name:r.name,fn:r.fn,options:[e,n]}},uO=(e,n)=>{const r=Z4(e);return{name:r.name,fn:r.fn,options:[e,n]}},dO=(e,n)=>{const r=J4(e);return{name:r.name,fn:r.fn,options:[e,n]}},fO=(e,n)=>{const r=iO(e);return{name:r.name,fn:r.fn,options:[e,n]}};var hO="Arrow",W2=x.forwardRef((e,n)=>{const{children:r,width:o=10,height:i=5,...s}=e;return p.jsx(fe.svg,{...s,ref:n,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});W2.displayName=hO;var pO=W2,G2="Popper",[Y2,to]=Qt(G2),[KG,X2]=Y2(G2),K2="PopperAnchor",q2=x.forwardRef((e,n)=>{const{__scopePopper:r,virtualRef:o,...i}=e,s=X2(K2,r),a=x.useRef(null),l=xe(n,a),c=x.useRef(null);return x.useEffect(()=>{const u=c.current;c.current=(o==null?void 0:o.current)||a.current,u!==c.current&&s.onAnchorChange(c.current)}),o?null:p.jsx(fe.div,{...i,ref:l})});q2.displayName=K2;var gg="PopperContent",[mO,gO]=Y2(gg),Q2=x.forwardRef((e,n)=>{var W,X,q,te,ee,Q;const{__scopePopper:r,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:v,...b}=e,_=X2(gg,r),[m,w]=x.useState(null),y=xe(n,ne=>w(ne)),[S,k]=x.useState(null),C=tg(S),N=(C==null?void 0:C.width)??0,E=(C==null?void 0:C.height)??0,j=o+(s!=="center"?"-"+s:""),A=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},T=Array.isArray(u)?u:[u],D=T.length>0,F={padding:A,boundary:T.filter(yO),altBoundary:D},{refs:P,floatingStyles:L,placement:I,isPositioned:z,middlewareData:R}=oO({strategy:"fixed",placement:j,whileElementsMounted:(...ne)=>X4(...ne,{animationFrame:g==="always"}),elements:{reference:_.anchor},middleware:[sO({mainAxis:i+E,alignmentAxis:a}),c&&aO({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?lO():void 0,...F}),c&&cO({...F}),uO({...F,apply:({elements:ne,rects:ue,availableWidth:ye,availableHeight:pe})=>{const{width:ke,height:tt}=ue.reference,Xe=ne.floating.style;Xe.setProperty("--radix-popper-available-width",`${ye}px`),Xe.setProperty("--radix-popper-available-height",`${pe}px`),Xe.setProperty("--radix-popper-anchor-width",`${ke}px`),Xe.setProperty("--radix-popper-anchor-height",`${tt}px`)}}),S&&fO({element:S,padding:l}),xO({arrowWidth:N,arrowHeight:E}),h&&dO({strategy:"referenceHidden",...F})]}),[M,O]=eS(I),V=Rn(v);Ye(()=>{z&&(V==null||V())},[z,V]);const $=(W=R.arrow)==null?void 0:W.x,K=(X=R.arrow)==null?void 0:X.y,B=((q=R.arrow)==null?void 0:q.centerOffset)!==0,[U,G]=x.useState();return Ye(()=>{m&&G(window.getComputedStyle(m).zIndex)},[m]),p.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:z?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[(te=R.transformOrigin)==null?void 0:te.x,(ee=R.transformOrigin)==null?void 0:ee.y].join(" "),...((Q=R.hide)==null?void 0:Q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(mO,{scope:r,placedSide:M,onArrowChange:k,arrowX:$,arrowY:K,shouldHideArrow:B,children:p.jsx(fe.div,{"data-side":M,"data-align":O,...b,ref:y,style:{...b.style,animation:z?void 0:"none"}})})})});Q2.displayName=gg;var Z2="PopperArrow",vO={top:"bottom",right:"left",bottom:"top",left:"right"},J2=x.forwardRef(function(n,r){const{__scopePopper:o,...i}=n,s=gO(Z2,o),a=vO[s.placedSide];return p.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:p.jsx(pO,{...i,ref:r,style:{...i.style,display:"block"}})})});J2.displayName=Z2;function yO(e){return e!==null}var xO=e=>({name:"transformOrigin",options:e,fn(n){var _,m,w;const{placement:r,rects:o,middlewareData:i}=n,a=((_=i.arrow)==null?void 0:_.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,f]=eS(r),d={start:"0%",center:"50%",end:"100%"}[f],h=(((m=i.arrow)==null?void 0:m.x)??0)+l/2,g=(((w=i.arrow)==null?void 0:w.y)??0)+c/2;let v="",b="";return u==="bottom"?(v=a?d:`${h}px`,b=`${-c}px`):u==="top"?(v=a?d:`${h}px`,b=`${o.floating.height+c}px`):u==="right"?(v=`${-c}px`,b=a?d:`${g}px`):u==="left"&&(v=`${o.floating.width+c}px`,b=a?d:`${g}px`),{data:{x:v,y:b}}}});function eS(e){const[n,r="center"]=e.split("-");return[n,r]}var Qa=q2,_d=Q2,Sd=J2,Hf="rovingFocusGroup.onEntryFocus",wO={bubbles:!1,cancelable:!0},Za="RovingFocusGroup",[up,tS,bO]=cg(Za),[_O,kd]=Qt(Za,[bO]),[SO,kO]=_O(Za),nS=x.forwardRef((e,n)=>p.jsx(up.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(up.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(CO,{...e,ref:n})})}));nS.displayName=Za;var CO=x.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,orientation:o,loop:i=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...d}=e,h=x.useRef(null),g=xe(n,h),v=T2(s),[b,_]=Va({prop:a,defaultProp:l??null,onChange:c,caller:Za}),[m,w]=x.useState(!1),y=Rn(u),S=tS(r),k=x.useRef(!1),[C,N]=x.useState(0);return x.useEffect(()=>{const E=h.current;if(E)return E.addEventListener(Hf,y),()=>E.removeEventListener(Hf,y)},[y]),p.jsx(SO,{scope:r,orientation:o,dir:v,loop:i,currentTabStopId:b,onItemFocus:x.useCallback(E=>_(E),[_]),onItemShiftTab:x.useCallback(()=>w(!0),[]),onFocusableItemAdd:x.useCallback(()=>N(E=>E+1),[]),onFocusableItemRemove:x.useCallback(()=>N(E=>E-1),[]),children:p.jsx(fe.div,{tabIndex:m||C===0?-1:0,"data-orientation":o,...d,ref:g,style:{outline:"none",...e.style},onMouseDown:re(e.onMouseDown,()=>{k.current=!0}),onFocus:re(e.onFocus,E=>{const j=!k.current;if(E.target===E.currentTarget&&j&&!m){const A=new CustomEvent(Hf,wO);if(E.currentTarget.dispatchEvent(A),!A.defaultPrevented){const T=S().filter(I=>I.focusable),D=T.find(I=>I.active),F=T.find(I=>I.id===b),L=[D,F,...T].filter(Boolean).map(I=>I.ref.current);iS(L,f)}}k.current=!1}),onBlur:re(e.onBlur,()=>w(!1))})})}),rS="RovingFocusGroupItem",oS=x.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:i=!1,tabStopId:s,children:a,...l}=e,c=Tt(),u=s||c,f=kO(rS,r),d=f.currentTabStopId===u,h=tS(r),{onFocusableItemAdd:g,onFocusableItemRemove:v,currentTabStopId:b}=f;return x.useEffect(()=>{if(o)return g(),()=>v()},[o,g,v]),p.jsx(up.ItemSlot,{scope:r,id:u,focusable:o,active:i,children:p.jsx(fe.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...l,ref:n,onMouseDown:re(e.onMouseDown,_=>{o?f.onItemFocus(u):_.preventDefault()}),onFocus:re(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:re(e.onKeyDown,_=>{if(_.key==="Tab"&&_.shiftKey){f.onItemShiftTab();return}if(_.target!==_.currentTarget)return;const m=jO(_,f.orientation,f.dir);if(m!==void 0){if(_.metaKey||_.ctrlKey||_.altKey||_.shiftKey)return;_.preventDefault();let y=h().filter(S=>S.focusable).map(S=>S.ref.current);if(m==="last")y.reverse();else if(m==="prev"||m==="next"){m==="prev"&&y.reverse();const S=y.indexOf(_.currentTarget);y=f.loop?PO(y,S+1):y.slice(S+1)}setTimeout(()=>iS(y))}}),children:typeof a=="function"?a({isCurrentTabStop:d,hasTabStop:b!=null}):a})})});oS.displayName=rS;var NO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function EO(e,n){return n!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function jO(e,n,r){const o=EO(e.key,r);if(!(n==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(n==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return NO[o]}function iS(e,n=!1){const r=document.activeElement;for(const o of e)if(o===r||(o.focus({preventScroll:n}),document.activeElement!==r))return}function PO(e,n){return e.map((r,o)=>e[(n+o)%e.length])}var sS=nS,aS=oS,dp=["Enter"," "],MO=["ArrowDown","PageUp","Home"],lS=["ArrowUp","PageDown","End"],RO=[...MO,...lS],AO={ltr:[...dp,"ArrowRight"],rtl:[...dp,"ArrowLeft"]},TO={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Cd="Menu",[Ca,IO,OO]=cg(Cd),[Vo,cS]=Qt(Cd,[OO,to,kd]),vg=to(),uS=kd(),[qG,Wo]=Vo(Cd),[QG,Ja]=Vo(Cd),$O="MenuAnchor",yg=x.forwardRef((e,n)=>{const{__scopeMenu:r,...o}=e,i=vg(r);return p.jsx(Qa,{...i,...o,ref:n})});yg.displayName=$O;var xg="MenuPortal",[DO,dS]=Vo(xg,{forceMount:void 0}),fS=e=>{const{__scopeMenu:n,forceMount:r,children:o,container:i}=e,s=Wo(xg,n);return p.jsx(DO,{scope:n,forceMount:r,children:p.jsx(kt,{present:r||s.open,children:p.jsx(ss,{asChild:!0,container:i,children:o})})})};fS.displayName=xg;var Xt="MenuContent",[LO,wg]=Vo(Xt),hS=x.forwardRef((e,n)=>{const r=dS(Xt,e.__scopeMenu),{forceMount:o=r.forceMount,...i}=e,s=Wo(Xt,e.__scopeMenu),a=Ja(Xt,e.__scopeMenu);return p.jsx(Ca.Provider,{scope:e.__scopeMenu,children:p.jsx(kt,{present:o||s.open,children:p.jsx(Ca.Slot,{scope:e.__scopeMenu,children:a.modal?p.jsx(zO,{...i,ref:n}):p.jsx(FO,{...i,ref:n})})})})}),zO=x.forwardRef((e,n)=>{const r=Wo(Xt,e.__scopeMenu),o=x.useRef(null),i=xe(n,o);return x.useEffect(()=>{const s=o.current;if(s)return hd(s)},[]),p.jsx(bg,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:re(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),FO=x.forwardRef((e,n)=>{const r=Wo(Xt,e.__scopeMenu);return p.jsx(bg,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),BO=Ao("MenuContent.ScrollLock"),bg=x.forwardRef((e,n)=>{const{__scopeMenu:r,loop:o=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:d,onInteractOutside:h,onDismiss:g,disableOutsideScroll:v,...b}=e,_=Wo(Xt,r),m=Ja(Xt,r),w=vg(r),y=uS(r),S=IO(r),[k,C]=x.useState(null),N=x.useRef(null),E=xe(n,N,_.onContentChange),j=x.useRef(0),A=x.useRef(""),T=x.useRef(0),D=x.useRef(null),F=x.useRef("right"),P=x.useRef(0),L=v?Ga:x.Fragment,I=v?{as:BO,allowPinchZoom:!0}:void 0,z=M=>{var W,X;const O=A.current+M,V=S().filter(q=>!q.disabled),$=document.activeElement,K=(W=V.find(q=>q.ref.current===$))==null?void 0:W.textValue,B=V.map(q=>q.textValue),U=JO(B,O,K),G=(X=V.find(q=>q.textValue===U))==null?void 0:X.ref.current;(function q(te){A.current=te,window.clearTimeout(j.current),te!==""&&(j.current=window.setTimeout(()=>q(""),1e3))})(O),G&&setTimeout(()=>G.focus())};x.useEffect(()=>()=>window.clearTimeout(j.current),[]),dd();const R=x.useCallback(M=>{var V,$;return F.current===((V=D.current)==null?void 0:V.side)&&t$(M,($=D.current)==null?void 0:$.area)},[]);return p.jsx(LO,{scope:r,searchRef:A,onItemEnter:x.useCallback(M=>{R(M)&&M.preventDefault()},[R]),onItemLeave:x.useCallback(M=>{var O;R(M)||((O=N.current)==null||O.focus(),C(null))},[R]),onTriggerLeave:x.useCallback(M=>{R(M)&&M.preventDefault()},[R]),pointerGraceTimerRef:T,onPointerGraceIntentChange:x.useCallback(M=>{D.current=M},[]),children:p.jsx(L,{...I,children:p.jsx(Wa,{asChild:!0,trapped:i,onMountAutoFocus:re(s,M=>{var O;M.preventDefault(),(O=N.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:p.jsx(is,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:d,onInteractOutside:h,onDismiss:g,children:p.jsx(sS,{asChild:!0,...y,dir:m.dir,orientation:"vertical",loop:o,currentTabStopId:k,onCurrentTabStopIdChange:C,onEntryFocus:re(c,M=>{m.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(_d,{role:"menu","aria-orientation":"vertical","data-state":PS(_.open),"data-radix-menu-content":"",dir:m.dir,...w,...b,ref:E,style:{outline:"none",...b.style},onKeyDown:re(b.onKeyDown,M=>{const V=M.target.closest("[data-radix-menu-content]")===M.currentTarget,$=M.ctrlKey||M.altKey||M.metaKey,K=M.key.length===1;V&&(M.key==="Tab"&&M.preventDefault(),!$&&K&&z(M.key));const B=N.current;if(M.target!==B||!RO.includes(M.key))return;M.preventDefault();const G=S().filter(W=>!W.disabled).map(W=>W.ref.current);lS.includes(M.key)&&G.reverse(),QO(G)}),onBlur:re(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(j.current),A.current="")}),onPointerMove:re(e.onPointerMove,Na(M=>{const O=M.target,V=P.current!==M.clientX;if(M.currentTarget.contains(O)&&V){const $=M.clientX>P.current?"right":"left";F.current=$,P.current=M.clientX}}))})})})})})})});hS.displayName=Xt;var HO="MenuGroup",_g=x.forwardRef((e,n)=>{const{__scopeMenu:r,...o}=e;return p.jsx(fe.div,{role:"group",...o,ref:n})});_g.displayName=HO;var UO="MenuLabel",pS=x.forwardRef((e,n)=>{const{__scopeMenu:r,...o}=e;return p.jsx(fe.div,{...o,ref:n})});pS.displayName=UO;var gu="MenuItem",My="menu.itemSelect",Nd=x.forwardRef((e,n)=>{const{disabled:r=!1,onSelect:o,...i}=e,s=x.useRef(null),a=Ja(gu,e.__scopeMenu),l=wg(gu,e.__scopeMenu),c=xe(n,s),u=x.useRef(!1),f=()=>{const d=s.current;if(!r&&d){const h=new CustomEvent(My,{bubbles:!0,cancelable:!0});d.addEventListener(My,g=>o==null?void 0:o(g),{once:!0}),U_(d,h),h.defaultPrevented?u.current=!1:a.onClose()}};return p.jsx(mS,{...i,ref:c,disabled:r,onClick:re(e.onClick,f),onPointerDown:d=>{var h;(h=e.onPointerDown)==null||h.call(e,d),u.current=!0},onPointerUp:re(e.onPointerUp,d=>{var h;u.current||(h=d.currentTarget)==null||h.click()}),onKeyDown:re(e.onKeyDown,d=>{const h=l.searchRef.current!=="";r||h&&d.key===" "||dp.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Nd.displayName=gu;var mS=x.forwardRef((e,n)=>{const{__scopeMenu:r,disabled:o=!1,textValue:i,...s}=e,a=wg(gu,r),l=uS(r),c=x.useRef(null),u=xe(n,c),[f,d]=x.useState(!1),[h,g]=x.useState("");return x.useEffect(()=>{const v=c.current;v&&g((v.textContent??"").trim())},[s.children]),p.jsx(Ca.ItemSlot,{scope:r,disabled:o,textValue:i??h,children:p.jsx(aS,{asChild:!0,...l,focusable:!o,children:p.jsx(fe.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:u,onPointerMove:re(e.onPointerMove,Na(v=>{o?a.onItemLeave(v):(a.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:re(e.onPointerLeave,Na(v=>a.onItemLeave(v))),onFocus:re(e.onFocus,()=>d(!0)),onBlur:re(e.onBlur,()=>d(!1))})})})}),VO="MenuCheckboxItem",gS=x.forwardRef((e,n)=>{const{checked:r=!1,onCheckedChange:o,...i}=e;return p.jsx(bS,{scope:e.__scopeMenu,checked:r,children:p.jsx(Nd,{role:"menuitemcheckbox","aria-checked":vu(r)?"mixed":r,...i,ref:n,"data-state":kg(r),onSelect:re(i.onSelect,()=>o==null?void 0:o(vu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});gS.displayName=VO;var vS="MenuRadioGroup",[WO,GO]=Vo(vS,{value:void 0,onValueChange:()=>{}}),yS=x.forwardRef((e,n)=>{const{value:r,onValueChange:o,...i}=e,s=Rn(o);return p.jsx(WO,{scope:e.__scopeMenu,value:r,onValueChange:s,children:p.jsx(_g,{...i,ref:n})})});yS.displayName=vS;var xS="MenuRadioItem",wS=x.forwardRef((e,n)=>{const{value:r,...o}=e,i=GO(xS,e.__scopeMenu),s=r===i.value;return p.jsx(bS,{scope:e.__scopeMenu,checked:s,children:p.jsx(Nd,{role:"menuitemradio","aria-checked":s,...o,ref:n,"data-state":kg(s),onSelect:re(o.onSelect,()=>{var a;return(a=i.onValueChange)==null?void 0:a.call(i,r)},{checkForDefaultPrevented:!1})})})});wS.displayName=xS;var Sg="MenuItemIndicator",[bS,YO]=Vo(Sg,{checked:!1}),_S=x.forwardRef((e,n)=>{const{__scopeMenu:r,forceMount:o,...i}=e,s=YO(Sg,r);return p.jsx(kt,{present:o||vu(s.checked)||s.checked===!0,children:p.jsx(fe.span,{...i,ref:n,"data-state":kg(s.checked)})})});_S.displayName=Sg;var XO="MenuSeparator",SS=x.forwardRef((e,n)=>{const{__scopeMenu:r,...o}=e;return p.jsx(fe.div,{role:"separator","aria-orientation":"horizontal",...o,ref:n})});SS.displayName=XO;var KO="MenuArrow",kS=x.forwardRef((e,n)=>{const{__scopeMenu:r,...o}=e,i=vg(r);return p.jsx(Sd,{...i,...o,ref:n})});kS.displayName=KO;var qO="MenuSub",[ZG,CS]=Vo(qO),Ls="MenuSubTrigger",NS=x.forwardRef((e,n)=>{const r=Wo(Ls,e.__scopeMenu),o=Ja(Ls,e.__scopeMenu),i=CS(Ls,e.__scopeMenu),s=wg(Ls,e.__scopeMenu),a=x.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},f=x.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return x.useEffect(()=>f,[f]),x.useEffect(()=>{const d=l.current;return()=>{window.clearTimeout(d),c(null)}},[l,c]),p.jsx(yg,{asChild:!0,...u,children:p.jsx(mS,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":PS(r.open),...e,ref:An(n,i.onTriggerChange),onClick:d=>{var h;(h=e.onClick)==null||h.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:re(e.onPointerMove,Na(d=>{s.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!r.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),f()},100))})),onPointerLeave:re(e.onPointerLeave,Na(d=>{var g,v;f();const h=(g=r.content)==null?void 0:g.getBoundingClientRect();if(h){const b=(v=r.content)==null?void 0:v.dataset.side,_=b==="right",m=_?-5:5,w=h[_?"left":"right"],y=h[_?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:w,y:h.top},{x:y,y:h.top},{x:y,y:h.bottom},{x:w,y:h.bottom}],side:b}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:re(e.onKeyDown,d=>{var g;const h=s.searchRef.current!=="";e.disabled||h&&d.key===" "||AO[o.dir].includes(d.key)&&(r.onOpenChange(!0),(g=r.content)==null||g.focus(),d.preventDefault())})})})});NS.displayName=Ls;var ES="MenuSubContent",jS=x.forwardRef((e,n)=>{const r=dS(Xt,e.__scopeMenu),{forceMount:o=r.forceMount,...i}=e,s=Wo(Xt,e.__scopeMenu),a=Ja(Xt,e.__scopeMenu),l=CS(ES,e.__scopeMenu),c=x.useRef(null),u=xe(n,c);return p.jsx(Ca.Provider,{scope:e.__scopeMenu,children:p.jsx(kt,{present:o||s.open,children:p.jsx(Ca.Slot,{scope:e.__scopeMenu,children:p.jsx(bg,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:u,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var d;a.isUsingKeyboardRef.current&&((d=c.current)==null||d.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:re(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:re(e.onEscapeKeyDown,f=>{a.onClose(),f.preventDefault()}),onKeyDown:re(e.onKeyDown,f=>{var g;const d=f.currentTarget.contains(f.target),h=TO[a.dir].includes(f.key);d&&h&&(s.onOpenChange(!1),(g=l.trigger)==null||g.focus(),f.preventDefault())})})})})})});jS.displayName=ES;function PS(e){return e?"open":"closed"}function vu(e){return e==="indeterminate"}function kg(e){return vu(e)?"indeterminate":e?"checked":"unchecked"}function QO(e){const n=document.activeElement;for(const r of e)if(r===n||(r.focus(),document.activeElement!==n))return}function ZO(e,n){return e.map((r,o)=>e[(n+o)%e.length])}function JO(e,n,r){const i=n.length>1&&Array.from(n).every(u=>u===n[0])?n[0]:n,s=r?e.indexOf(r):-1;let a=ZO(e,Math.max(s,0));i.length===1&&(a=a.filter(u=>u!==r));const c=a.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function e$(e,n){const{x:r,y:o}=e;let i=!1;for(let s=0,a=n.length-1;s<n.length;a=s++){const l=n[s],c=n[a],u=l.x,f=l.y,d=c.x,h=c.y;f>o!=h>o&&r<(d-u)*(o-f)/(h-f)+u&&(i=!i)}return i}function t$(e,n){if(!n)return!1;const r={x:e.clientX,y:e.clientY};return e$(r,n)}function Na(e){return n=>n.pointerType==="mouse"?e(n):void 0}var n$=yg,r$=fS,o$=hS,i$=_g,s$=pS,a$=Nd,l$=gS,c$=yS,u$=wS,d$=_S,f$=SS,h$=kS,p$=NS,m$=jS,MS="DropdownMenu",[g$]=Qt(MS,[cS]),Nt=cS(),[JG,RS]=g$(MS),AS="DropdownMenuTrigger",v$=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,disabled:o=!1,...i}=e,s=RS(AS,r),a=Nt(r);return p.jsx(n$,{asChild:!0,...a,children:p.jsx(fe.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...i,ref:An(n,s.triggerRef),onPointerDown:re(e.onPointerDown,l=>{!o&&l.button===0&&l.ctrlKey===!1&&(s.onOpenToggle(),s.open||l.preventDefault())}),onKeyDown:re(e.onKeyDown,l=>{o||(["Enter"," "].includes(l.key)&&s.onOpenToggle(),l.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});v$.displayName=AS;var y$="DropdownMenuPortal",TS=e=>{const{__scopeDropdownMenu:n,...r}=e,o=Nt(n);return p.jsx(r$,{...o,...r})};TS.displayName=y$;var IS="DropdownMenuContent",OS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=RS(IS,r),s=Nt(r),a=x.useRef(!1);return p.jsx(o$,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...o,ref:n,onCloseAutoFocus:re(e.onCloseAutoFocus,l=>{var c;a.current||(c=i.triggerRef.current)==null||c.focus(),a.current=!1,l.preventDefault()}),onInteractOutside:re(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,f=c.button===2||u;(!i.modal||f)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});OS.displayName=IS;var x$="DropdownMenuGroup",w$=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(i$,{...i,...o,ref:n})});w$.displayName=x$;var b$="DropdownMenuLabel",$S=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(s$,{...i,...o,ref:n})});$S.displayName=b$;var _$="DropdownMenuItem",DS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(a$,{...i,...o,ref:n})});DS.displayName=_$;var S$="DropdownMenuCheckboxItem",LS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(l$,{...i,...o,ref:n})});LS.displayName=S$;var k$="DropdownMenuRadioGroup",C$=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(c$,{...i,...o,ref:n})});C$.displayName=k$;var N$="DropdownMenuRadioItem",zS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(u$,{...i,...o,ref:n})});zS.displayName=N$;var E$="DropdownMenuItemIndicator",FS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(d$,{...i,...o,ref:n})});FS.displayName=E$;var j$="DropdownMenuSeparator",BS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(f$,{...i,...o,ref:n})});BS.displayName=j$;var P$="DropdownMenuArrow",M$=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(h$,{...i,...o,ref:n})});M$.displayName=P$;var R$="DropdownMenuSubTrigger",HS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(p$,{...i,...o,ref:n})});HS.displayName=R$;var A$="DropdownMenuSubContent",US=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(m$,{...i,...o,ref:n,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});US.displayName=A$;var T$=TS,VS=OS,WS=$S,GS=DS,YS=LS,XS=zS,KS=FS,qS=BS,QS=HS,ZS=US;const I$=x.forwardRef(({className:e,inset:n,children:r,...o},i)=>p.jsxs(QS,{ref:i,className:ae("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n&&"pl-8",e),...o,children:[r,p.jsx(Fi,{className:"ml-auto"})]}));I$.displayName=QS.displayName;const O$=x.forwardRef(({className:e,...n},r)=>p.jsx(ZS,{ref:r,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n}));O$.displayName=ZS.displayName;const $$=x.forwardRef(({className:e,sideOffset:n=4,...r},o)=>p.jsx(T$,{children:p.jsx(VS,{ref:o,sideOffset:n,className:ae("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...r})}));$$.displayName=VS.displayName;const D$=x.forwardRef(({className:e,inset:n,...r},o)=>p.jsx(GS,{ref:o,className:ae("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",n&&"pl-8",e),...r}));D$.displayName=GS.displayName;const L$=x.forwardRef(({className:e,children:n,checked:r,...o},i)=>p.jsxs(YS,{ref:i,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...o,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(KS,{children:p.jsx(qm,{className:"h-4 w-4"})})}),n]}));L$.displayName=YS.displayName;const z$=x.forwardRef(({className:e,children:n,...r},o)=>p.jsxs(XS,{ref:o,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(KS,{children:p.jsx(UR,{className:"h-2 w-2 fill-current"})})}),n]}));z$.displayName=XS.displayName;const F$=x.forwardRef(({className:e,inset:n,...r},o)=>p.jsx(WS,{ref:o,className:ae("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",e),...r}));F$.displayName=WS.displayName;const B$=x.forwardRef(({className:e,...n},r)=>p.jsx(qS,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...n}));B$.displayName=qS.displayName;const H$=x.forwardRef(({className:e,type:n,...r},o)=>p.jsx("input",{type:n,className:ae("flex h-9 w-full rounded-md border border-transparent bg-input px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/50 placeholder:font-light focus-visible:outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:o,...r}));H$.displayName="Input";var U$="Label",JS=x.forwardRef((e,n)=>p.jsx(mt.label,{...e,ref:n,onMouseDown:r=>{var i;r.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));JS.displayName=U$;var ek=JS;const V$=Xm("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),W$=x.forwardRef(({className:e,...n},r)=>p.jsx(ek,{ref:r,className:ae(V$(),e),...n}));W$.displayName=ek.displayName;var tk="Popover",[nk]=Qt(tk,[to]),Ed=to(),[eY,no]=nk(tk),rk="PopoverAnchor",G$=x.forwardRef((e,n)=>{const{__scopePopover:r,...o}=e,i=no(rk,r),s=Ed(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:l}=i;return x.useEffect(()=>(a(),()=>l()),[a,l]),p.jsx(Qa,{...s,...o,ref:n})});G$.displayName=rk;var ok="PopoverTrigger",Y$=x.forwardRef((e,n)=>{const{__scopePopover:r,...o}=e,i=no(ok,r),s=Ed(r),a=xe(n,i.triggerRef),l=p.jsx(fe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ck(i.open),...o,ref:a,onClick:re(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?l:p.jsx(Qa,{asChild:!0,...s,children:l})});Y$.displayName=ok;var Cg="PopoverPortal",[X$,K$]=nk(Cg,{forceMount:void 0}),ik=e=>{const{__scopePopover:n,forceMount:r,children:o,container:i}=e,s=no(Cg,n);return p.jsx(X$,{scope:n,forceMount:r,children:p.jsx(kt,{present:r||s.open,children:p.jsx(ss,{asChild:!0,container:i,children:o})})})};ik.displayName=Cg;var Hi="PopoverContent",sk=x.forwardRef((e,n)=>{const r=K$(Hi,e.__scopePopover),{forceMount:o=r.forceMount,...i}=e,s=no(Hi,e.__scopePopover);return p.jsx(kt,{present:o||s.open,children:s.modal?p.jsx(Q$,{...i,ref:n}):p.jsx(Z$,{...i,ref:n})})});sk.displayName=Hi;var q$=Ao("PopoverContent.RemoveScroll"),Q$=x.forwardRef((e,n)=>{const r=no(Hi,e.__scopePopover),o=x.useRef(null),i=xe(n,o),s=x.useRef(!1);return x.useEffect(()=>{const a=o.current;if(a)return hd(a)},[]),p.jsx(Ga,{as:q$,allowPinchZoom:!0,children:p.jsx(ak,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:re(e.onCloseAutoFocus,a=>{var l;a.preventDefault(),s.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:re(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:re(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Z$=x.forwardRef((e,n)=>{const r=no(Hi,e.__scopePopover),o=x.useRef(!1),i=x.useRef(!1);return p.jsx(ak,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,l;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(o.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:s=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((u=r.triggerRef.current)==null?void 0:u.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),ak=x.forwardRef((e,n)=>{const{__scopePopover:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:f,...d}=e,h=no(Hi,r),g=Ed(r);return dd(),p.jsx(Wa,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:s,children:p.jsx(is,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:p.jsx(_d,{"data-state":ck(h.open),role:"dialog",id:h.contentId,...g,...d,ref:n,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),lk="PopoverClose",J$=x.forwardRef((e,n)=>{const{__scopePopover:r,...o}=e,i=no(lk,r);return p.jsx(fe.button,{type:"button",...o,ref:n,onClick:re(e.onClick,()=>i.onOpenChange(!1))})});J$.displayName=lk;var eD="PopoverArrow",tD=x.forwardRef((e,n)=>{const{__scopePopover:r,...o}=e,i=Ed(r);return p.jsx(Sd,{...i,...o,ref:n})});tD.displayName=eD;function ck(e){return e?"open":"closed"}var nD=ik,uk=sk;const rD=x.forwardRef(({className:e,align:n="start",sideOffset:r=4,...o},i)=>p.jsx(nD,{children:p.jsx(uk,{ref:i,align:n,sideOffset:r,className:ae("z-50 w-[var(--radix-popover-trigger-width)] rounded-md border bg-popover p-0 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));rD.displayName=uk.displayName;var Ng="Progress",Eg=100,[oD]=w_(Ng),[iD,sD]=oD(Ng),dk=x.forwardRef((e,n)=>{const{__scopeProgress:r,value:o=null,max:i,getValueLabel:s=aD,...a}=e;(i||i===0)&&!Ry(i)&&console.error(lD(`${i}`,"Progress"));const l=Ry(i)?i:Eg;o!==null&&!Ay(o,l)&&console.error(cD(`${o}`,"Progress"));const c=Ay(o,l)?o:null,u=yu(c)?s(c,l):void 0;return p.jsx(iD,{scope:r,value:c,max:l,children:p.jsx(mt.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":yu(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":pk(c,l),"data-value":c??void 0,"data-max":l,...a,ref:n})})});dk.displayName=Ng;var fk="ProgressIndicator",hk=x.forwardRef((e,n)=>{const{__scopeProgress:r,...o}=e,i=sD(fk,r);return p.jsx(mt.div,{"data-state":pk(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...o,ref:n})});hk.displayName=fk;function aD(e,n){return`${Math.round(e/n*100)}%`}function pk(e,n){return e==null?"indeterminate":e===n?"complete":"loading"}function yu(e){return typeof e=="number"}function Ry(e){return yu(e)&&!isNaN(e)&&e>0}function Ay(e,n){return yu(e)&&!isNaN(e)&&e<=n&&e>=0}function lD(e,n){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${n}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Eg}\`.`}function cD(e,n){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${n}\`. The \`value\` prop must be:
|
|
379
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},OI="DialogDescriptionWarning",$I=({contentRef:e,descriptionId:n})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${S2(OI).contentName}}.`;return x.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");n&&i&&(document.getElementById(n)||console.warn(o))},[o,e,n]),null},DI=u2,ag=h2,Ya=p2,Xa=m2,md=v2,gd=x2,k2=b2,ks='[cmdk-group=""]',Lf='[cmdk-group-items=""]',LI='[cmdk-group-heading=""]',C2='[cmdk-item=""]',yy=`${C2}:not([aria-disabled="true"])`,sp="cmdk-item-select",ii="data-value",zI=(e,n,r)=>CT(e,n,r),N2=x.createContext(void 0),Ka=()=>x.useContext(N2),E2=x.createContext(void 0),lg=()=>x.useContext(E2),j2=x.createContext(void 0),P2=x.forwardRef((e,n)=>{let r=si(()=>{var $,K;return{search:"",value:(K=($=e.value)!=null?$:e.defaultValue)!=null?K:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=si(()=>new Set),i=si(()=>new Map),s=si(()=>new Map),a=si(()=>new Set),l=M2(e),{label:c,children:u,value:f,onValueChange:d,filter:h,shouldFilter:g,loop:v,disablePointerSelection:b=!1,vimBindings:_=!0,...m}=e,w=Tt(),y=Tt(),S=Tt(),k=x.useRef(null),C=qI();Io(()=>{if(f!==void 0){let $=f.trim();r.current.value=$,N.emit()}},[f]),Io(()=>{C(6,F)},[]);let N=x.useMemo(()=>({subscribe:$=>(a.current.add($),()=>a.current.delete($)),snapshot:()=>r.current,setState:($,K,B)=>{var U,G,W,X;if(!Object.is(r.current[$],K)){if(r.current[$]=K,$==="search")D(),A(),C(1,T);else if($==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let q=document.getElementById(S);q?q.focus():(U=document.getElementById(w))==null||U.focus()}if(C(7,()=>{var q;r.current.selectedItemId=(q=P())==null?void 0:q.id,N.emit()}),B||C(5,F),((G=l.current)==null?void 0:G.value)!==void 0){let q=K??"";(X=(W=l.current).onValueChange)==null||X.call(W,q);return}}N.emit()}},emit:()=>{a.current.forEach($=>$())}}),[]),E=x.useMemo(()=>({value:($,K,B)=>{var U;K!==((U=s.current.get($))==null?void 0:U.value)&&(s.current.set($,{value:K,keywords:B}),r.current.filtered.items.set($,j(K,B)),C(2,()=>{A(),N.emit()}))},item:($,K)=>(o.current.add($),K&&(i.current.has(K)?i.current.get(K).add($):i.current.set(K,new Set([$]))),C(3,()=>{D(),A(),r.current.value||T(),N.emit()}),()=>{s.current.delete($),o.current.delete($),r.current.filtered.items.delete($);let B=P();C(4,()=>{D(),(B==null?void 0:B.getAttribute("id"))===$&&T(),N.emit()})}),group:$=>(i.current.has($)||i.current.set($,new Set),()=>{s.current.delete($),i.current.delete($)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:w,inputId:S,labelId:y,listInnerRef:k}),[]);function j($,K){var B,U;let G=(U=(B=l.current)==null?void 0:B.filter)!=null?U:zI;return $?G($,r.current.search,K):0}function A(){if(!r.current.search||l.current.shouldFilter===!1)return;let $=r.current.filtered.items,K=[];r.current.filtered.groups.forEach(U=>{let G=i.current.get(U),W=0;G.forEach(X=>{let q=$.get(X);W=Math.max(q,W)}),K.push([U,W])});let B=k.current;L().sort((U,G)=>{var W,X;let q=U.getAttribute("id"),te=G.getAttribute("id");return((W=$.get(te))!=null?W:0)-((X=$.get(q))!=null?X:0)}).forEach(U=>{let G=U.closest(Lf);G?G.appendChild(U.parentElement===G?U:U.closest(`${Lf} > *`)):B.appendChild(U.parentElement===B?U:U.closest(`${Lf} > *`))}),K.sort((U,G)=>G[1]-U[1]).forEach(U=>{var G;let W=(G=k.current)==null?void 0:G.querySelector(`${ks}[${ii}="${encodeURIComponent(U[0])}"]`);W==null||W.parentElement.appendChild(W)})}function T(){let $=L().find(B=>B.getAttribute("aria-disabled")!=="true"),K=$==null?void 0:$.getAttribute(ii);N.setState("value",K||void 0)}function D(){var $,K,B,U;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=o.current.size;return}r.current.filtered.groups=new Set;let G=0;for(let W of o.current){let X=(K=($=s.current.get(W))==null?void 0:$.value)!=null?K:"",q=(U=(B=s.current.get(W))==null?void 0:B.keywords)!=null?U:[],te=j(X,q);r.current.filtered.items.set(W,te),te>0&&G++}for(let[W,X]of i.current)for(let q of X)if(r.current.filtered.items.get(q)>0){r.current.filtered.groups.add(W);break}r.current.filtered.count=G}function F(){var $,K,B;let U=P();U&&((($=U.parentElement)==null?void 0:$.firstChild)===U&&((B=(K=U.closest(ks))==null?void 0:K.querySelector(LI))==null||B.scrollIntoView({block:"nearest"})),U.scrollIntoView({block:"nearest"}))}function P(){var $;return($=k.current)==null?void 0:$.querySelector(`${C2}[aria-selected="true"]`)}function L(){var $;return Array.from((($=k.current)==null?void 0:$.querySelectorAll(yy))||[])}function I($){let K=L()[$];K&&N.setState("value",K.getAttribute(ii))}function z($){var K;let B=P(),U=L(),G=U.findIndex(X=>X===B),W=U[G+$];(K=l.current)!=null&&K.loop&&(W=G+$<0?U[U.length-1]:G+$===U.length?U[0]:U[G+$]),W&&N.setState("value",W.getAttribute(ii))}function R($){let K=P(),B=K==null?void 0:K.closest(ks),U;for(;B&&!U;)B=$>0?XI(B,ks):KI(B,ks),U=B==null?void 0:B.querySelector(yy);U?N.setState("value",U.getAttribute(ii)):z($)}let M=()=>I(L().length-1),O=$=>{$.preventDefault(),$.metaKey?M():$.altKey?R(1):z(1)},V=$=>{$.preventDefault(),$.metaKey?I(0):$.altKey?R(-1):z(-1)};return x.createElement(mt.div,{ref:n,tabIndex:-1,...m,"cmdk-root":"",onKeyDown:$=>{var K;(K=m.onKeyDown)==null||K.call(m,$);let B=$.nativeEvent.isComposing||$.keyCode===229;if(!($.defaultPrevented||B))switch($.key){case"n":case"j":{_&&$.ctrlKey&&O($);break}case"ArrowDown":{O($);break}case"p":case"k":{_&&$.ctrlKey&&V($);break}case"ArrowUp":{V($);break}case"Home":{$.preventDefault(),I(0);break}case"End":{$.preventDefault(),M();break}case"Enter":{$.preventDefault();let U=P();if(U){let G=new Event(sp);U.dispatchEvent(G)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:ZI},c),vd(e,$=>x.createElement(E2.Provider,{value:N},x.createElement(N2.Provider,{value:E},$))))}),FI=x.forwardRef((e,n)=>{var r,o;let i=Tt(),s=x.useRef(null),a=x.useContext(j2),l=Ka(),c=M2(e),u=(o=(r=c.current)==null?void 0:r.forceMount)!=null?o:a==null?void 0:a.forceMount;Io(()=>{if(!u)return l.item(i,a==null?void 0:a.id)},[u]);let f=R2(i,s,[e.value,e.children,s],e.keywords),d=lg(),h=Gr(C=>C.value&&C.value===f.current),g=Gr(C=>u||l.filter()===!1?!0:C.search?C.filtered.items.get(i)>0:!0);x.useEffect(()=>{let C=s.current;if(!(!C||e.disabled))return C.addEventListener(sp,v),()=>C.removeEventListener(sp,v)},[g,e.onSelect,e.disabled]);function v(){var C,N;b(),(N=(C=c.current).onSelect)==null||N.call(C,f.current)}function b(){d.setState("value",f.current,!0)}if(!g)return null;let{disabled:_,value:m,onSelect:w,forceMount:y,keywords:S,...k}=e;return x.createElement(mt.div,{ref:An(s,n),...k,id:i,"cmdk-item":"",role:"option","aria-disabled":!!_,"aria-selected":!!h,"data-disabled":!!_,"data-selected":!!h,onPointerMove:_||l.getDisablePointerSelection()?void 0:b,onClick:_?void 0:v},e.children)}),BI=x.forwardRef((e,n)=>{let{heading:r,children:o,forceMount:i,...s}=e,a=Tt(),l=x.useRef(null),c=x.useRef(null),u=Tt(),f=Ka(),d=Gr(g=>i||f.filter()===!1?!0:g.search?g.filtered.groups.has(a):!0);Io(()=>f.group(a),[]),R2(a,l,[e.value,e.heading,c]);let h=x.useMemo(()=>({id:a,forceMount:i}),[i]);return x.createElement(mt.div,{ref:An(l,n),...s,"cmdk-group":"",role:"presentation",hidden:d?void 0:!0},r&&x.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},r),vd(e,g=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?u:void 0},x.createElement(j2.Provider,{value:h},g))))}),HI=x.forwardRef((e,n)=>{let{alwaysRender:r,...o}=e,i=x.useRef(null),s=Gr(a=>!a.search);return!r&&!s?null:x.createElement(mt.div,{ref:An(i,n),...o,"cmdk-separator":"",role:"separator"})}),UI=x.forwardRef((e,n)=>{let{onValueChange:r,...o}=e,i=e.value!=null,s=lg(),a=Gr(u=>u.search),l=Gr(u=>u.selectedItemId),c=Ka();return x.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),x.createElement(mt.input,{ref:n,...o,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:i?e.value:a,onChange:u=>{i||s.setState("search",u.target.value),r==null||r(u.target.value)}})}),VI=x.forwardRef((e,n)=>{let{children:r,label:o="Suggestions",...i}=e,s=x.useRef(null),a=x.useRef(null),l=Gr(u=>u.selectedItemId),c=Ka();return x.useEffect(()=>{if(a.current&&s.current){let u=a.current,f=s.current,d,h=new ResizeObserver(()=>{d=requestAnimationFrame(()=>{let g=u.offsetHeight;f.style.setProperty("--cmdk-list-height",g.toFixed(1)+"px")})});return h.observe(u),()=>{cancelAnimationFrame(d),h.unobserve(u)}}},[]),x.createElement(mt.div,{ref:An(s,n),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":o,id:c.listId},vd(e,u=>x.createElement("div",{ref:An(a,c.listInnerRef),"cmdk-list-sizer":""},u)))}),WI=x.forwardRef((e,n)=>{let{open:r,onOpenChange:o,overlayClassName:i,contentClassName:s,container:a,...l}=e;return x.createElement(DI,{open:r,onOpenChange:o},x.createElement(ag,{container:a},x.createElement(Ya,{"cmdk-overlay":"",className:i}),x.createElement(Xa,{"aria-label":e.label,"cmdk-dialog":"",className:s},x.createElement(P2,{ref:n,...l}))))}),GI=x.forwardRef((e,n)=>Gr(r=>r.filtered.count===0)?x.createElement(mt.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),YI=x.forwardRef((e,n)=>{let{progress:r,children:o,label:i="Loading...",...s}=e;return x.createElement(mt.div,{ref:n,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},vd(e,a=>x.createElement("div",{"aria-hidden":!0},a)))}),Ct=Object.assign(P2,{List:VI,Item:FI,Input:UI,Group:BI,Separator:HI,Dialog:WI,Empty:GI,Loading:YI});function XI(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function KI(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function M2(e){let n=x.useRef(e);return Io(()=>{n.current=e}),n}var Io=typeof window>"u"?x.useEffect:x.useLayoutEffect;function si(e){let n=x.useRef();return n.current===void 0&&(n.current=e()),n}function Gr(e){let n=lg(),r=()=>e(n.snapshot());return x.useSyncExternalStore(n.subscribe,r,r)}function R2(e,n,r,o=[]){let i=x.useRef(),s=Ka();return Io(()=>{var a;let l=(()=>{var u;for(let f of r){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(u=f.current.textContent)==null?void 0:u.trim():i.current}})(),c=o.map(u=>u.trim());s.value(e,l,c),(a=n.current)==null||a.setAttribute(ii,l),i.current=l}),i}var qI=()=>{let[e,n]=x.useState(),r=si(()=>new Map);return Io(()=>{r.current.forEach(o=>o()),r.current=new Map},[e]),(o,i)=>{r.current.set(o,i),n({})}};function QI(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function vd({asChild:e,children:n},r){return e&&x.isValidElement(n)?x.cloneElement(QI(n),{ref:n.ref},r(n.props.children)):r(n)}var ZI={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const JI=x.forwardRef(({className:e,...n},r)=>p.jsx(Ct,{ref:r,className:ae("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n}));JI.displayName=Ct.displayName;const e4=x.forwardRef(({className:e,...n},r)=>p.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[p.jsx(NA,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),p.jsx(Ct.Input,{ref:r,className:ae("flex h-9 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...n})]}));e4.displayName=Ct.Input.displayName;const t4=x.forwardRef(({className:e,onWheel:n,...r},o)=>p.jsx(Ct.List,{ref:o,className:ae("overflow-y-auto overflow-x-hidden",e),style:{maxHeight:300},onWheel:n??(i=>{i.currentTarget.scrollTop+=i.deltaY}),...r}));t4.displayName=Ct.List.displayName;const n4=x.forwardRef((e,n)=>p.jsx(Ct.Empty,{ref:n,className:"py-6 text-center text-sm",...e}));n4.displayName=Ct.Empty.displayName;const r4=x.forwardRef(({className:e,...n},r)=>p.jsx(Ct.Group,{ref:r,className:ae("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...n}));r4.displayName=Ct.Group.displayName;const o4=x.forwardRef(({className:e,...n},r)=>p.jsx(Ct.Separator,{ref:r,className:ae("-mx-1 h-px bg-border",e),...n}));o4.displayName=Ct.Separator.displayName;const i4=x.forwardRef(({className:e,...n},r)=>p.jsx(Ct.Item,{ref:r,className:ae("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...n}));i4.displayName=Ct.Item.displayName;const s4=ag,A2=x.forwardRef(({className:e,...n},r)=>p.jsx(Ya,{ref:r,className:ae("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...n}));A2.displayName=Ya.displayName;const a4=x.forwardRef(({className:e,children:n,...r},o)=>p.jsxs(s4,{children:[p.jsx(A2,{}),p.jsxs(Xa,{ref:o,className:ae("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[n,p.jsxs(k2,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[p.jsx(uu,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));a4.displayName=Xa.displayName;const l4=x.forwardRef(({className:e,...n},r)=>p.jsx(md,{ref:r,className:ae("text-lg font-semibold leading-none tracking-tight",e),...n}));l4.displayName=md.displayName;const c4=x.forwardRef(({className:e,...n},r)=>p.jsx(gd,{ref:r,className:ae("text-sm text-muted-foreground",e),...n}));c4.displayName=gd.displayName;function cg(e){const n=e+"CollectionProvider",[r,o]=Qt(n),[i,s]=r(n,{collectionRef:{current:null},itemMap:new Map}),a=b=>{const{scope:_,children:m}=b,w=it.useRef(null),y=it.useRef(new Map).current;return p.jsx(i,{scope:_,itemMap:y,collectionRef:w,children:m})};a.displayName=n;const l=e+"CollectionSlot",c=Ao(l),u=it.forwardRef((b,_)=>{const{scope:m,children:w}=b,y=s(l,m),S=xe(_,y.collectionRef);return p.jsx(c,{ref:S,children:w})});u.displayName=l;const f=e+"CollectionItemSlot",d="data-radix-collection-item",h=Ao(f),g=it.forwardRef((b,_)=>{const{scope:m,children:w,...y}=b,S=it.useRef(null),k=xe(_,S),C=s(f,m);return it.useEffect(()=>(C.itemMap.set(S,{ref:S,...y}),()=>void C.itemMap.delete(S))),p.jsx(h,{[d]:"",ref:k,children:w})});g.displayName=f;function v(b){const _=s(e+"CollectionConsumer",b);return it.useCallback(()=>{const w=_.collectionRef.current;if(!w)return[];const y=Array.from(w.querySelectorAll(`[${d}]`));return Array.from(_.itemMap.values()).sort((C,N)=>y.indexOf(C.ref.current)-y.indexOf(N.ref.current))},[_.collectionRef,_.itemMap])}return[{Provider:a,Slot:u,ItemSlot:g},v,o]}var u4=x.createContext(void 0);function T2(e){const n=x.useContext(u4);return e||n||"ltr"}const d4=["top","right","bottom","left"],Yr=Math.min,Mt=Math.max,fu=Math.round,Xl=Math.floor,Pn=e=>({x:e,y:e}),f4={left:"right",right:"left",bottom:"top",top:"bottom"};function ap(e,n,r){return Mt(e,Yr(n,r))}function ir(e,n){return typeof e=="function"?e(n):e}function sr(e){return e.split("-")[0]}function as(e){return e.split("-")[1]}function ug(e){return e==="x"?"y":"x"}function dg(e){return e==="y"?"height":"width"}function Cn(e){const n=e[0];return n==="t"||n==="b"?"y":"x"}function fg(e){return ug(Cn(e))}function h4(e,n,r){r===void 0&&(r=!1);const o=as(e),i=fg(e),s=dg(i);let a=i==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return n.reference[s]>n.floating[s]&&(a=hu(a)),[a,hu(a)]}function p4(e){const n=hu(e);return[lp(e),n,lp(n)]}function lp(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const xy=["left","right"],wy=["right","left"],m4=["top","bottom"],g4=["bottom","top"];function v4(e,n,r){switch(e){case"top":case"bottom":return r?n?wy:xy:n?xy:wy;case"left":case"right":return n?m4:g4;default:return[]}}function y4(e,n,r,o){const i=as(e);let s=v4(sr(e),r==="start",o);return i&&(s=s.map(a=>a+"-"+i),n&&(s=s.concat(s.map(lp)))),s}function hu(e){const n=sr(e);return f4[n]+e.slice(n.length)}function x4(e){return{top:0,right:0,bottom:0,left:0,...e}}function I2(e){return typeof e!="number"?x4(e):{top:e,right:e,bottom:e,left:e}}function pu(e){const{x:n,y:r,width:o,height:i}=e;return{width:o,height:i,top:r,left:n,right:n+o,bottom:r+i,x:n,y:r}}function by(e,n,r){let{reference:o,floating:i}=e;const s=Cn(n),a=fg(n),l=dg(a),c=sr(n),u=s==="y",f=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,h=o[l]/2-i[l]/2;let g;switch(c){case"top":g={x:f,y:o.y-i.height};break;case"bottom":g={x:f,y:o.y+o.height};break;case"right":g={x:o.x+o.width,y:d};break;case"left":g={x:o.x-i.width,y:d};break;default:g={x:o.x,y:o.y}}switch(as(n)){case"start":g[a]-=h*(r&&u?-1:1);break;case"end":g[a]+=h*(r&&u?-1:1);break}return g}async function w4(e,n){var r;n===void 0&&(n={});const{x:o,y:i,platform:s,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:h=!1,padding:g=0}=ir(n,e),v=I2(g),_=l[h?d==="floating"?"reference":"floating":d],m=pu(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(_)))==null||r?_:_.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:f,strategy:c})),w=d==="floating"?{x:o,y:i,width:a.floating.width,height:a.floating.height}:a.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),S=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},k=pu(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:y,strategy:c}):w);return{top:(m.top-k.top+v.top)/S.y,bottom:(k.bottom-m.bottom+v.bottom)/S.y,left:(m.left-k.left+v.left)/S.x,right:(k.right-m.right+v.right)/S.x}}const b4=50,_4=async(e,n,r)=>{const{placement:o="bottom",strategy:i="absolute",middleware:s=[],platform:a}=r,l=a.detectOverflow?a:{...a,detectOverflow:w4},c=await(a.isRTL==null?void 0:a.isRTL(n));let u=await a.getElementRects({reference:e,floating:n,strategy:i}),{x:f,y:d}=by(u,o,c),h=o,g=0;const v={};for(let b=0;b<s.length;b++){const _=s[b];if(!_)continue;const{name:m,fn:w}=_,{x:y,y:S,data:k,reset:C}=await w({x:f,y:d,initialPlacement:o,placement:h,strategy:i,middlewareData:v,rects:u,platform:l,elements:{reference:e,floating:n}});f=y??f,d=S??d,v[m]={...v[m],...k},C&&g<b4&&(g++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(u=C.rects===!0?await a.getElementRects({reference:e,floating:n,strategy:i}):C.rects),{x:f,y:d}=by(u,h,c)),b=-1)}return{x:f,y:d,placement:h,strategy:i,middlewareData:v}},S4=e=>({name:"arrow",options:e,async fn(n){const{x:r,y:o,placement:i,rects:s,platform:a,elements:l,middlewareData:c}=n,{element:u,padding:f=0}=ir(e,n)||{};if(u==null)return{};const d=I2(f),h={x:r,y:o},g=fg(i),v=dg(g),b=await a.getDimensions(u),_=g==="y",m=_?"top":"left",w=_?"bottom":"right",y=_?"clientHeight":"clientWidth",S=s.reference[v]+s.reference[g]-h[g]-s.floating[v],k=h[g]-s.reference[g],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let N=C?C[y]:0;(!N||!await(a.isElement==null?void 0:a.isElement(C)))&&(N=l.floating[y]||s.floating[v]);const E=S/2-k/2,j=N/2-b[v]/2-1,A=Yr(d[m],j),T=Yr(d[w],j),D=A,F=N-b[v]-T,P=N/2-b[v]/2+E,L=ap(D,P,F),I=!c.arrow&&as(i)!=null&&P!==L&&s.reference[v]/2-(P<D?A:T)-b[v]/2<0,z=I?P<D?P-D:P-F:0;return{[g]:h[g]+z,data:{[g]:L,centerOffset:P-L-z,...I&&{alignmentOffset:z}},reset:I}}}),k4=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(n){var r,o;const{placement:i,middlewareData:s,rects:a,initialPlacement:l,platform:c,elements:u}=n,{mainAxis:f=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,..._}=ir(e,n);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const m=sr(i),w=Cn(l),y=sr(l)===l,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),k=h||(y||!b?[hu(l)]:p4(l)),C=v!=="none";!h&&C&&k.push(...y4(l,b,v,S));const N=[l,...k],E=await c.detectOverflow(n,_),j=[];let A=((o=s.flip)==null?void 0:o.overflows)||[];if(f&&j.push(E[m]),d){const P=h4(i,a,S);j.push(E[P[0]],E[P[1]])}if(A=[...A,{placement:i,overflows:j}],!j.every(P=>P<=0)){var T,D;const P=(((T=s.flip)==null?void 0:T.index)||0)+1,L=N[P];if(L&&(!(d==="alignment"?w!==Cn(L):!1)||A.every(R=>Cn(R.placement)===w?R.overflows[0]>0:!0)))return{data:{index:P,overflows:A},reset:{placement:L}};let I=(D=A.filter(z=>z.overflows[0]<=0).sort((z,R)=>z.overflows[1]-R.overflows[1])[0])==null?void 0:D.placement;if(!I)switch(g){case"bestFit":{var F;const z=(F=A.filter(R=>{if(C){const M=Cn(R.placement);return M===w||M==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(M=>M>0).reduce((M,O)=>M+O,0)]).sort((R,M)=>R[1]-M[1])[0])==null?void 0:F[0];z&&(I=z);break}case"initialPlacement":I=l;break}if(i!==I)return{reset:{placement:I}}}return{}}}};function _y(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function Sy(e){return d4.some(n=>e[n]>=0)}const C4=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:r,platform:o}=n,{strategy:i="referenceHidden",...s}=ir(e,n);switch(i){case"referenceHidden":{const a=await o.detectOverflow(n,{...s,elementContext:"reference"}),l=_y(a,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Sy(l)}}}case"escaped":{const a=await o.detectOverflow(n,{...s,altBoundary:!0}),l=_y(a,r.floating);return{data:{escapedOffsets:l,escaped:Sy(l)}}}default:return{}}}}},O2=new Set(["left","top"]);async function N4(e,n){const{placement:r,platform:o,elements:i}=e,s=await(o.isRTL==null?void 0:o.isRTL(i.floating)),a=sr(r),l=as(r),c=Cn(r)==="y",u=O2.has(a)?-1:1,f=s&&c?-1:1,d=ir(n,e);let{mainAxis:h,crossAxis:g,alignmentAxis:v}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof v=="number"&&(g=l==="end"?v*-1:v),c?{x:g*f,y:h*u}:{x:h*u,y:g*f}}const E4=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var r,o;const{x:i,y:s,placement:a,middlewareData:l}=n,c=await N4(n,e);return a===((r=l.offset)==null?void 0:r.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:a}}}}},j4=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:r,y:o,placement:i,platform:s}=n,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:m=>{let{x:w,y}=m;return{x:w,y}}},...u}=ir(e,n),f={x:r,y:o},d=await s.detectOverflow(n,u),h=Cn(sr(i)),g=ug(h);let v=f[g],b=f[h];if(a){const m=g==="y"?"top":"left",w=g==="y"?"bottom":"right",y=v+d[m],S=v-d[w];v=ap(y,v,S)}if(l){const m=h==="y"?"top":"left",w=h==="y"?"bottom":"right",y=b+d[m],S=b-d[w];b=ap(y,b,S)}const _=c.fn({...n,[g]:v,[h]:b});return{..._,data:{x:_.x-r,y:_.y-o,enabled:{[g]:a,[h]:l}}}}}},P4=function(e){return e===void 0&&(e={}),{options:e,fn(n){const{x:r,y:o,placement:i,rects:s,middlewareData:a}=n,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=ir(e,n),f={x:r,y:o},d=Cn(i),h=ug(d);let g=f[h],v=f[d];const b=ir(l,n),_=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(c){const y=h==="y"?"height":"width",S=s.reference[h]-s.floating[y]+_.mainAxis,k=s.reference[h]+s.reference[y]-_.mainAxis;g<S?g=S:g>k&&(g=k)}if(u){var m,w;const y=h==="y"?"width":"height",S=O2.has(sr(i)),k=s.reference[d]-s.floating[y]+(S&&((m=a.offset)==null?void 0:m[d])||0)+(S?0:_.crossAxis),C=s.reference[d]+s.reference[y]+(S?0:((w=a.offset)==null?void 0:w[d])||0)-(S?_.crossAxis:0);v<k?v=k:v>C&&(v=C)}return{[h]:g,[d]:v}}}},M4=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){var r,o;const{placement:i,rects:s,platform:a,elements:l}=n,{apply:c=()=>{},...u}=ir(e,n),f=await a.detectOverflow(n,u),d=sr(i),h=as(i),g=Cn(i)==="y",{width:v,height:b}=s.floating;let _,m;d==="top"||d==="bottom"?(_=d,m=h===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(m=d,_=h==="end"?"top":"bottom");const w=b-f.top-f.bottom,y=v-f.left-f.right,S=Yr(b-f[_],w),k=Yr(v-f[m],y),C=!n.middlewareData.shift;let N=S,E=k;if((r=n.middlewareData.shift)!=null&&r.enabled.x&&(E=y),(o=n.middlewareData.shift)!=null&&o.enabled.y&&(N=w),C&&!h){const A=Mt(f.left,0),T=Mt(f.right,0),D=Mt(f.top,0),F=Mt(f.bottom,0);g?E=v-2*(A!==0||T!==0?A+T:Mt(f.left,f.right)):N=b-2*(D!==0||F!==0?D+F:Mt(f.top,f.bottom))}await c({...n,availableWidth:E,availableHeight:N});const j=await a.getDimensions(l.floating);return v!==j.width||b!==j.height?{reset:{rects:!0}}:{}}}};function yd(){return typeof window<"u"}function ls(e){return $2(e)?(e.nodeName||"").toLowerCase():"#document"}function It(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function On(e){var n;return(n=($2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function $2(e){return yd()?e instanceof Node||e instanceof It(e).Node:!1}function mn(e){return yd()?e instanceof Element||e instanceof It(e).Element:!1}function ur(e){return yd()?e instanceof HTMLElement||e instanceof It(e).HTMLElement:!1}function ky(e){return!yd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof It(e).ShadowRoot}function qa(e){const{overflow:n,overflowX:r,overflowY:o,display:i}=gn(e);return/auto|scroll|overlay|hidden|clip/.test(n+o+r)&&i!=="inline"&&i!=="contents"}function R4(e){return/^(table|td|th)$/.test(ls(e))}function xd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const A4=/transform|translate|scale|rotate|perspective|filter/,T4=/paint|layout|strict|content/,fo=e=>!!e&&e!=="none";let zf;function hg(e){const n=mn(e)?gn(e):e;return fo(n.transform)||fo(n.translate)||fo(n.scale)||fo(n.rotate)||fo(n.perspective)||!pg()&&(fo(n.backdropFilter)||fo(n.filter))||A4.test(n.willChange||"")||T4.test(n.contain||"")}function I4(e){let n=Xr(e);for(;ur(n)&&!Bi(n);){if(hg(n))return n;if(xd(n))return null;n=Xr(n)}return null}function pg(){return zf==null&&(zf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),zf}function Bi(e){return/^(html|body|#document)$/.test(ls(e))}function gn(e){return It(e).getComputedStyle(e)}function wd(e){return mn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xr(e){if(ls(e)==="html")return e;const n=e.assignedSlot||e.parentNode||ky(e)&&e.host||On(e);return ky(n)?n.host:n}function D2(e){const n=Xr(e);return Bi(n)?e.ownerDocument?e.ownerDocument.body:e.body:ur(n)&&qa(n)?n:D2(n)}function ka(e,n,r){var o;n===void 0&&(n=[]),r===void 0&&(r=!0);const i=D2(e),s=i===((o=e.ownerDocument)==null?void 0:o.body),a=It(i);if(s){const l=cp(a);return n.concat(a,a.visualViewport||[],qa(i)?i:[],l&&r?ka(l):[])}else return n.concat(i,ka(i,[],r))}function cp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function L2(e){const n=gn(e);let r=parseFloat(n.width)||0,o=parseFloat(n.height)||0;const i=ur(e),s=i?e.offsetWidth:r,a=i?e.offsetHeight:o,l=fu(r)!==s||fu(o)!==a;return l&&(r=s,o=a),{width:r,height:o,$:l}}function mg(e){return mn(e)?e:e.contextElement}function ji(e){const n=mg(e);if(!ur(n))return Pn(1);const r=n.getBoundingClientRect(),{width:o,height:i,$:s}=L2(n);let a=(s?fu(r.width):r.width)/o,l=(s?fu(r.height):r.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const O4=Pn(0);function z2(e){const n=It(e);return!pg()||!n.visualViewport?O4:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function $4(e,n,r){return n===void 0&&(n=!1),!r||n&&r!==It(e)?!1:n}function Oo(e,n,r,o){n===void 0&&(n=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),s=mg(e);let a=Pn(1);n&&(o?mn(o)&&(a=ji(o)):a=ji(e));const l=$4(s,r,o)?z2(s):Pn(0);let c=(i.left+l.x)/a.x,u=(i.top+l.y)/a.y,f=i.width/a.x,d=i.height/a.y;if(s){const h=It(s),g=o&&mn(o)?It(o):o;let v=h,b=cp(v);for(;b&&o&&g!==v;){const _=ji(b),m=b.getBoundingClientRect(),w=gn(b),y=m.left+(b.clientLeft+parseFloat(w.paddingLeft))*_.x,S=m.top+(b.clientTop+parseFloat(w.paddingTop))*_.y;c*=_.x,u*=_.y,f*=_.x,d*=_.y,c+=y,u+=S,v=It(b),b=cp(v)}}return pu({width:f,height:d,x:c,y:u})}function bd(e,n){const r=wd(e).scrollLeft;return n?n.left+r:Oo(On(e)).left+r}function F2(e,n){const r=e.getBoundingClientRect(),o=r.left+n.scrollLeft-bd(e,r),i=r.top+n.scrollTop;return{x:o,y:i}}function D4(e){let{elements:n,rect:r,offsetParent:o,strategy:i}=e;const s=i==="fixed",a=On(o),l=n?xd(n.floating):!1;if(o===a||l&&s)return r;let c={scrollLeft:0,scrollTop:0},u=Pn(1);const f=Pn(0),d=ur(o);if((d||!d&&!s)&&((ls(o)!=="body"||qa(a))&&(c=wd(o)),d)){const g=Oo(o);u=ji(o),f.x=g.x+o.clientLeft,f.y=g.y+o.clientTop}const h=a&&!d&&!s?F2(a,c):Pn(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-c.scrollLeft*u.x+f.x+h.x,y:r.y*u.y-c.scrollTop*u.y+f.y+h.y}}function L4(e){return Array.from(e.getClientRects())}function z4(e){const n=On(e),r=wd(e),o=e.ownerDocument.body,i=Mt(n.scrollWidth,n.clientWidth,o.scrollWidth,o.clientWidth),s=Mt(n.scrollHeight,n.clientHeight,o.scrollHeight,o.clientHeight);let a=-r.scrollLeft+bd(e);const l=-r.scrollTop;return gn(o).direction==="rtl"&&(a+=Mt(n.clientWidth,o.clientWidth)-i),{width:i,height:s,x:a,y:l}}const Cy=25;function F4(e,n){const r=It(e),o=On(e),i=r.visualViewport;let s=o.clientWidth,a=o.clientHeight,l=0,c=0;if(i){s=i.width,a=i.height;const f=pg();(!f||f&&n==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const u=bd(o);if(u<=0){const f=o.ownerDocument,d=f.body,h=getComputedStyle(d),g=f.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,v=Math.abs(o.clientWidth-d.clientWidth-g);v<=Cy&&(s-=v)}else u<=Cy&&(s+=u);return{width:s,height:a,x:l,y:c}}function B4(e,n){const r=Oo(e,!0,n==="fixed"),o=r.top+e.clientTop,i=r.left+e.clientLeft,s=ur(e)?ji(e):Pn(1),a=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,u=o*s.y;return{width:a,height:l,x:c,y:u}}function Ny(e,n,r){let o;if(n==="viewport")o=F4(e,r);else if(n==="document")o=z4(On(e));else if(mn(n))o=B4(n,r);else{const i=z2(e);o={x:n.x-i.x,y:n.y-i.y,width:n.width,height:n.height}}return pu(o)}function B2(e,n){const r=Xr(e);return r===n||!mn(r)||Bi(r)?!1:gn(r).position==="fixed"||B2(r,n)}function H4(e,n){const r=n.get(e);if(r)return r;let o=ka(e,[],!1).filter(l=>mn(l)&&ls(l)!=="body"),i=null;const s=gn(e).position==="fixed";let a=s?Xr(e):e;for(;mn(a)&&!Bi(a);){const l=gn(a),c=hg(a);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||qa(a)&&!c&&B2(e,a))?o=o.filter(f=>f!==a):i=l,a=Xr(a)}return n.set(e,o),o}function U4(e){let{element:n,boundary:r,rootBoundary:o,strategy:i}=e;const a=[...r==="clippingAncestors"?xd(n)?[]:H4(n,this._c):[].concat(r),o],l=Ny(n,a[0],i);let c=l.top,u=l.right,f=l.bottom,d=l.left;for(let h=1;h<a.length;h++){const g=Ny(n,a[h],i);c=Mt(g.top,c),u=Yr(g.right,u),f=Yr(g.bottom,f),d=Mt(g.left,d)}return{width:u-d,height:f-c,x:d,y:c}}function V4(e){const{width:n,height:r}=L2(e);return{width:n,height:r}}function W4(e,n,r){const o=ur(n),i=On(n),s=r==="fixed",a=Oo(e,!0,s,n);let l={scrollLeft:0,scrollTop:0};const c=Pn(0);function u(){c.x=bd(i)}if(o||!o&&!s)if((ls(n)!=="body"||qa(i))&&(l=wd(n)),o){const g=Oo(n,!0,s,n);c.x=g.x+n.clientLeft,c.y=g.y+n.clientTop}else i&&u();s&&!o&&i&&u();const f=i&&!o&&!s?F2(i,l):Pn(0),d=a.left+l.scrollLeft-c.x-f.x,h=a.top+l.scrollTop-c.y-f.y;return{x:d,y:h,width:a.width,height:a.height}}function Ff(e){return gn(e).position==="static"}function Ey(e,n){if(!ur(e)||gn(e).position==="fixed")return null;if(n)return n(e);let r=e.offsetParent;return On(e)===r&&(r=r.ownerDocument.body),r}function H2(e,n){const r=It(e);if(xd(e))return r;if(!ur(e)){let i=Xr(e);for(;i&&!Bi(i);){if(mn(i)&&!Ff(i))return i;i=Xr(i)}return r}let o=Ey(e,n);for(;o&&R4(o)&&Ff(o);)o=Ey(o,n);return o&&Bi(o)&&Ff(o)&&!hg(o)?r:o||I4(e)||r}const G4=async function(e){const n=this.getOffsetParent||H2,r=this.getDimensions,o=await r(e.floating);return{reference:W4(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Y4(e){return gn(e).direction==="rtl"}const X4={convertOffsetParentRelativeRectToViewportRelativeRect:D4,getDocumentElement:On,getClippingRect:U4,getOffsetParent:H2,getElementRects:G4,getClientRects:L4,getDimensions:V4,getScale:ji,isElement:mn,isRTL:Y4};function U2(e,n){return e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height}function K4(e,n){let r=null,o;const i=On(e);function s(){var l;clearTimeout(o),(l=r)==null||l.disconnect(),r=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:f,top:d,width:h,height:g}=u;if(l||n(),!h||!g)return;const v=Xl(d),b=Xl(i.clientWidth-(f+h)),_=Xl(i.clientHeight-(d+g)),m=Xl(f),y={rootMargin:-v+"px "+-b+"px "+-_+"px "+-m+"px",threshold:Mt(0,Yr(1,c))||1};let S=!0;function k(C){const N=C[0].intersectionRatio;if(N!==c){if(!S)return a();N?a(!1,N):o=setTimeout(()=>{a(!1,1e-7)},1e3)}N===1&&!U2(u,e.getBoundingClientRect())&&a(),S=!1}try{r=new IntersectionObserver(k,{...y,root:i.ownerDocument})}catch{r=new IntersectionObserver(k,y)}r.observe(e)}return a(!0),s}function q4(e,n,r,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,u=mg(e),f=i||s?[...u?ka(u):[],...n?ka(n):[]]:[];f.forEach(m=>{i&&m.addEventListener("scroll",r,{passive:!0}),s&&m.addEventListener("resize",r)});const d=u&&l?K4(u,r):null;let h=-1,g=null;a&&(g=new ResizeObserver(m=>{let[w]=m;w&&w.target===u&&g&&n&&(g.unobserve(n),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var y;(y=g)==null||y.observe(n)})),r()}),u&&!c&&g.observe(u),n&&g.observe(n));let v,b=c?Oo(e):null;c&&_();function _(){const m=Oo(e);b&&!U2(b,m)&&r(),b=m,v=requestAnimationFrame(_)}return r(),()=>{var m;f.forEach(w=>{i&&w.removeEventListener("scroll",r),s&&w.removeEventListener("resize",r)}),d==null||d(),(m=g)==null||m.disconnect(),g=null,c&&cancelAnimationFrame(v)}}const Q4=E4,Z4=j4,J4=k4,eO=M4,tO=C4,jy=S4,nO=P4,rO=(e,n,r)=>{const o=new Map,i={platform:X4,...r},s={...i.platform,_c:o};return _4(e,n,{...i,platform:s})};var oO=typeof document<"u",iO=function(){},Ec=oO?x.useLayoutEffect:iO;function mu(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(typeof e=="function"&&e.toString()===n.toString())return!0;let r,o,i;if(e&&n&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==n.length)return!1;for(o=r;o--!==0;)if(!mu(e[o],n[o]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!{}.hasOwnProperty.call(n,i[o]))return!1;for(o=r;o--!==0;){const s=i[o];if(!(s==="_owner"&&e.$$typeof)&&!mu(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}function V2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Py(e,n){const r=V2(e);return Math.round(n*r)/r}function Bf(e){const n=x.useRef(e);return Ec(()=>{n.current=e}),n}function sO(e){e===void 0&&(e={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[f,d]=x.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[h,g]=x.useState(o);mu(h,o)||g(o);const[v,b]=x.useState(null),[_,m]=x.useState(null),w=x.useCallback(R=>{R!==C.current&&(C.current=R,b(R))},[]),y=x.useCallback(R=>{R!==N.current&&(N.current=R,m(R))},[]),S=s||v,k=a||_,C=x.useRef(null),N=x.useRef(null),E=x.useRef(f),j=c!=null,A=Bf(c),T=Bf(i),D=Bf(u),F=x.useCallback(()=>{if(!C.current||!N.current)return;const R={placement:n,strategy:r,middleware:h};T.current&&(R.platform=T.current),rO(C.current,N.current,R).then(M=>{const O={...M,isPositioned:D.current!==!1};P.current&&!mu(E.current,O)&&(E.current=O,ts.flushSync(()=>{d(O)}))})},[h,n,r,T,D]);Ec(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(R=>({...R,isPositioned:!1})))},[u]);const P=x.useRef(!1);Ec(()=>(P.current=!0,()=>{P.current=!1}),[]),Ec(()=>{if(S&&(C.current=S),k&&(N.current=k),S&&k){if(A.current)return A.current(S,k,F);F()}},[S,k,F,A,j]);const L=x.useMemo(()=>({reference:C,floating:N,setReference:w,setFloating:y}),[w,y]),I=x.useMemo(()=>({reference:S,floating:k}),[S,k]),z=x.useMemo(()=>{const R={position:r,left:0,top:0};if(!I.floating)return R;const M=Py(I.floating,f.x),O=Py(I.floating,f.y);return l?{...R,transform:"translate("+M+"px, "+O+"px)",...V2(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:M,top:O}},[r,l,I.floating,f.x,f.y]);return x.useMemo(()=>({...f,update:F,refs:L,elements:I,floatingStyles:z}),[f,F,L,I,z])}const aO=e=>{function n(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:o,padding:i}=typeof e=="function"?e(r):e;return o&&n(o)?o.current!=null?jy({element:o.current,padding:i}).fn(r):{}:o?jy({element:o,padding:i}).fn(r):{}}}},lO=(e,n)=>{const r=Q4(e);return{name:r.name,fn:r.fn,options:[e,n]}},cO=(e,n)=>{const r=Z4(e);return{name:r.name,fn:r.fn,options:[e,n]}},uO=(e,n)=>({fn:nO(e).fn,options:[e,n]}),dO=(e,n)=>{const r=J4(e);return{name:r.name,fn:r.fn,options:[e,n]}},fO=(e,n)=>{const r=eO(e);return{name:r.name,fn:r.fn,options:[e,n]}},hO=(e,n)=>{const r=tO(e);return{name:r.name,fn:r.fn,options:[e,n]}},pO=(e,n)=>{const r=aO(e);return{name:r.name,fn:r.fn,options:[e,n]}};var mO="Arrow",W2=x.forwardRef((e,n)=>{const{children:r,width:o=10,height:i=5,...s}=e;return p.jsx(fe.svg,{...s,ref:n,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});W2.displayName=mO;var gO=W2,G2="Popper",[Y2,to]=Qt(G2),[QG,X2]=Y2(G2),K2="PopperAnchor",q2=x.forwardRef((e,n)=>{const{__scopePopper:r,virtualRef:o,...i}=e,s=X2(K2,r),a=x.useRef(null),l=xe(n,a),c=x.useRef(null);return x.useEffect(()=>{const u=c.current;c.current=(o==null?void 0:o.current)||a.current,u!==c.current&&s.onAnchorChange(c.current)}),o?null:p.jsx(fe.div,{...i,ref:l})});q2.displayName=K2;var gg="PopperContent",[vO,yO]=Y2(gg),Q2=x.forwardRef((e,n)=>{var W,X,q,te,ee,Q;const{__scopePopper:r,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:g="optimized",onPlaced:v,...b}=e,_=X2(gg,r),[m,w]=x.useState(null),y=xe(n,ne=>w(ne)),[S,k]=x.useState(null),C=tg(S),N=(C==null?void 0:C.width)??0,E=(C==null?void 0:C.height)??0,j=o+(s!=="center"?"-"+s:""),A=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},T=Array.isArray(u)?u:[u],D=T.length>0,F={padding:A,boundary:T.filter(wO),altBoundary:D},{refs:P,floatingStyles:L,placement:I,isPositioned:z,middlewareData:R}=sO({strategy:"fixed",placement:j,whileElementsMounted:(...ne)=>q4(...ne,{animationFrame:g==="always"}),elements:{reference:_.anchor},middleware:[lO({mainAxis:i+E,alignmentAxis:a}),c&&cO({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?uO():void 0,...F}),c&&dO({...F}),fO({...F,apply:({elements:ne,rects:ue,availableWidth:ye,availableHeight:pe})=>{const{width:ke,height:tt}=ue.reference,Xe=ne.floating.style;Xe.setProperty("--radix-popper-available-width",`${ye}px`),Xe.setProperty("--radix-popper-available-height",`${pe}px`),Xe.setProperty("--radix-popper-anchor-width",`${ke}px`),Xe.setProperty("--radix-popper-anchor-height",`${tt}px`)}}),S&&pO({element:S,padding:l}),bO({arrowWidth:N,arrowHeight:E}),h&&hO({strategy:"referenceHidden",...F})]}),[M,O]=eS(I),V=Rn(v);Ye(()=>{z&&(V==null||V())},[z,V]);const $=(W=R.arrow)==null?void 0:W.x,K=(X=R.arrow)==null?void 0:X.y,B=((q=R.arrow)==null?void 0:q.centerOffset)!==0,[U,G]=x.useState();return Ye(()=>{m&&G(window.getComputedStyle(m).zIndex)},[m]),p.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:z?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[(te=R.transformOrigin)==null?void 0:te.x,(ee=R.transformOrigin)==null?void 0:ee.y].join(" "),...((Q=R.hide)==null?void 0:Q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(vO,{scope:r,placedSide:M,onArrowChange:k,arrowX:$,arrowY:K,shouldHideArrow:B,children:p.jsx(fe.div,{"data-side":M,"data-align":O,...b,ref:y,style:{...b.style,animation:z?void 0:"none"}})})})});Q2.displayName=gg;var Z2="PopperArrow",xO={top:"bottom",right:"left",bottom:"top",left:"right"},J2=x.forwardRef(function(n,r){const{__scopePopper:o,...i}=n,s=yO(Z2,o),a=xO[s.placedSide];return p.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:p.jsx(gO,{...i,ref:r,style:{...i.style,display:"block"}})})});J2.displayName=Z2;function wO(e){return e!==null}var bO=e=>({name:"transformOrigin",options:e,fn(n){var _,m,w;const{placement:r,rects:o,middlewareData:i}=n,a=((_=i.arrow)==null?void 0:_.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,f]=eS(r),d={start:"0%",center:"50%",end:"100%"}[f],h=(((m=i.arrow)==null?void 0:m.x)??0)+l/2,g=(((w=i.arrow)==null?void 0:w.y)??0)+c/2;let v="",b="";return u==="bottom"?(v=a?d:`${h}px`,b=`${-c}px`):u==="top"?(v=a?d:`${h}px`,b=`${o.floating.height+c}px`):u==="right"?(v=`${-c}px`,b=a?d:`${g}px`):u==="left"&&(v=`${o.floating.width+c}px`,b=a?d:`${g}px`),{data:{x:v,y:b}}}});function eS(e){const[n,r="center"]=e.split("-");return[n,r]}var Qa=q2,_d=Q2,Sd=J2,Hf="rovingFocusGroup.onEntryFocus",_O={bubbles:!1,cancelable:!0},Za="RovingFocusGroup",[up,tS,SO]=cg(Za),[kO,kd]=Qt(Za,[SO]),[CO,NO]=kO(Za),nS=x.forwardRef((e,n)=>p.jsx(up.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(up.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(EO,{...e,ref:n})})}));nS.displayName=Za;var EO=x.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,orientation:o,loop:i=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...d}=e,h=x.useRef(null),g=xe(n,h),v=T2(s),[b,_]=Va({prop:a,defaultProp:l??null,onChange:c,caller:Za}),[m,w]=x.useState(!1),y=Rn(u),S=tS(r),k=x.useRef(!1),[C,N]=x.useState(0);return x.useEffect(()=>{const E=h.current;if(E)return E.addEventListener(Hf,y),()=>E.removeEventListener(Hf,y)},[y]),p.jsx(CO,{scope:r,orientation:o,dir:v,loop:i,currentTabStopId:b,onItemFocus:x.useCallback(E=>_(E),[_]),onItemShiftTab:x.useCallback(()=>w(!0),[]),onFocusableItemAdd:x.useCallback(()=>N(E=>E+1),[]),onFocusableItemRemove:x.useCallback(()=>N(E=>E-1),[]),children:p.jsx(fe.div,{tabIndex:m||C===0?-1:0,"data-orientation":o,...d,ref:g,style:{outline:"none",...e.style},onMouseDown:re(e.onMouseDown,()=>{k.current=!0}),onFocus:re(e.onFocus,E=>{const j=!k.current;if(E.target===E.currentTarget&&j&&!m){const A=new CustomEvent(Hf,_O);if(E.currentTarget.dispatchEvent(A),!A.defaultPrevented){const T=S().filter(I=>I.focusable),D=T.find(I=>I.active),F=T.find(I=>I.id===b),L=[D,F,...T].filter(Boolean).map(I=>I.ref.current);iS(L,f)}}k.current=!1}),onBlur:re(e.onBlur,()=>w(!1))})})}),rS="RovingFocusGroupItem",oS=x.forwardRef((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:i=!1,tabStopId:s,children:a,...l}=e,c=Tt(),u=s||c,f=NO(rS,r),d=f.currentTabStopId===u,h=tS(r),{onFocusableItemAdd:g,onFocusableItemRemove:v,currentTabStopId:b}=f;return x.useEffect(()=>{if(o)return g(),()=>v()},[o,g,v]),p.jsx(up.ItemSlot,{scope:r,id:u,focusable:o,active:i,children:p.jsx(fe.span,{tabIndex:d?0:-1,"data-orientation":f.orientation,...l,ref:n,onMouseDown:re(e.onMouseDown,_=>{o?f.onItemFocus(u):_.preventDefault()}),onFocus:re(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:re(e.onKeyDown,_=>{if(_.key==="Tab"&&_.shiftKey){f.onItemShiftTab();return}if(_.target!==_.currentTarget)return;const m=MO(_,f.orientation,f.dir);if(m!==void 0){if(_.metaKey||_.ctrlKey||_.altKey||_.shiftKey)return;_.preventDefault();let y=h().filter(S=>S.focusable).map(S=>S.ref.current);if(m==="last")y.reverse();else if(m==="prev"||m==="next"){m==="prev"&&y.reverse();const S=y.indexOf(_.currentTarget);y=f.loop?RO(y,S+1):y.slice(S+1)}setTimeout(()=>iS(y))}}),children:typeof a=="function"?a({isCurrentTabStop:d,hasTabStop:b!=null}):a})})});oS.displayName=rS;var jO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function PO(e,n){return n!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function MO(e,n,r){const o=PO(e.key,r);if(!(n==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(n==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return jO[o]}function iS(e,n=!1){const r=document.activeElement;for(const o of e)if(o===r||(o.focus({preventScroll:n}),document.activeElement!==r))return}function RO(e,n){return e.map((r,o)=>e[(n+o)%e.length])}var sS=nS,aS=oS,dp=["Enter"," "],AO=["ArrowDown","PageUp","Home"],lS=["ArrowUp","PageDown","End"],TO=[...AO,...lS],IO={ltr:[...dp,"ArrowRight"],rtl:[...dp,"ArrowLeft"]},OO={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Cd="Menu",[Ca,$O,DO]=cg(Cd),[Vo,cS]=Qt(Cd,[DO,to,kd]),vg=to(),uS=kd(),[ZG,Wo]=Vo(Cd),[JG,Ja]=Vo(Cd),LO="MenuAnchor",yg=x.forwardRef((e,n)=>{const{__scopeMenu:r,...o}=e,i=vg(r);return p.jsx(Qa,{...i,...o,ref:n})});yg.displayName=LO;var xg="MenuPortal",[zO,dS]=Vo(xg,{forceMount:void 0}),fS=e=>{const{__scopeMenu:n,forceMount:r,children:o,container:i}=e,s=Wo(xg,n);return p.jsx(zO,{scope:n,forceMount:r,children:p.jsx(kt,{present:r||s.open,children:p.jsx(ss,{asChild:!0,container:i,children:o})})})};fS.displayName=xg;var Xt="MenuContent",[FO,wg]=Vo(Xt),hS=x.forwardRef((e,n)=>{const r=dS(Xt,e.__scopeMenu),{forceMount:o=r.forceMount,...i}=e,s=Wo(Xt,e.__scopeMenu),a=Ja(Xt,e.__scopeMenu);return p.jsx(Ca.Provider,{scope:e.__scopeMenu,children:p.jsx(kt,{present:o||s.open,children:p.jsx(Ca.Slot,{scope:e.__scopeMenu,children:a.modal?p.jsx(BO,{...i,ref:n}):p.jsx(HO,{...i,ref:n})})})})}),BO=x.forwardRef((e,n)=>{const r=Wo(Xt,e.__scopeMenu),o=x.useRef(null),i=xe(n,o);return x.useEffect(()=>{const s=o.current;if(s)return hd(s)},[]),p.jsx(bg,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:re(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),HO=x.forwardRef((e,n)=>{const r=Wo(Xt,e.__scopeMenu);return p.jsx(bg,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),UO=Ao("MenuContent.ScrollLock"),bg=x.forwardRef((e,n)=>{const{__scopeMenu:r,loop:o=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:d,onInteractOutside:h,onDismiss:g,disableOutsideScroll:v,...b}=e,_=Wo(Xt,r),m=Ja(Xt,r),w=vg(r),y=uS(r),S=$O(r),[k,C]=x.useState(null),N=x.useRef(null),E=xe(n,N,_.onContentChange),j=x.useRef(0),A=x.useRef(""),T=x.useRef(0),D=x.useRef(null),F=x.useRef("right"),P=x.useRef(0),L=v?Ga:x.Fragment,I=v?{as:UO,allowPinchZoom:!0}:void 0,z=M=>{var W,X;const O=A.current+M,V=S().filter(q=>!q.disabled),$=document.activeElement,K=(W=V.find(q=>q.ref.current===$))==null?void 0:W.textValue,B=V.map(q=>q.textValue),U=t$(B,O,K),G=(X=V.find(q=>q.textValue===U))==null?void 0:X.ref.current;(function q(te){A.current=te,window.clearTimeout(j.current),te!==""&&(j.current=window.setTimeout(()=>q(""),1e3))})(O),G&&setTimeout(()=>G.focus())};x.useEffect(()=>()=>window.clearTimeout(j.current),[]),dd();const R=x.useCallback(M=>{var V,$;return F.current===((V=D.current)==null?void 0:V.side)&&r$(M,($=D.current)==null?void 0:$.area)},[]);return p.jsx(FO,{scope:r,searchRef:A,onItemEnter:x.useCallback(M=>{R(M)&&M.preventDefault()},[R]),onItemLeave:x.useCallback(M=>{var O;R(M)||((O=N.current)==null||O.focus(),C(null))},[R]),onTriggerLeave:x.useCallback(M=>{R(M)&&M.preventDefault()},[R]),pointerGraceTimerRef:T,onPointerGraceIntentChange:x.useCallback(M=>{D.current=M},[]),children:p.jsx(L,{...I,children:p.jsx(Wa,{asChild:!0,trapped:i,onMountAutoFocus:re(s,M=>{var O;M.preventDefault(),(O=N.current)==null||O.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:p.jsx(is,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:d,onInteractOutside:h,onDismiss:g,children:p.jsx(sS,{asChild:!0,...y,dir:m.dir,orientation:"vertical",loop:o,currentTabStopId:k,onCurrentTabStopIdChange:C,onEntryFocus:re(c,M=>{m.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(_d,{role:"menu","aria-orientation":"vertical","data-state":PS(_.open),"data-radix-menu-content":"",dir:m.dir,...w,...b,ref:E,style:{outline:"none",...b.style},onKeyDown:re(b.onKeyDown,M=>{const V=M.target.closest("[data-radix-menu-content]")===M.currentTarget,$=M.ctrlKey||M.altKey||M.metaKey,K=M.key.length===1;V&&(M.key==="Tab"&&M.preventDefault(),!$&&K&&z(M.key));const B=N.current;if(M.target!==B||!TO.includes(M.key))return;M.preventDefault();const G=S().filter(W=>!W.disabled).map(W=>W.ref.current);lS.includes(M.key)&&G.reverse(),JO(G)}),onBlur:re(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(j.current),A.current="")}),onPointerMove:re(e.onPointerMove,Na(M=>{const O=M.target,V=P.current!==M.clientX;if(M.currentTarget.contains(O)&&V){const $=M.clientX>P.current?"right":"left";F.current=$,P.current=M.clientX}}))})})})})})})});hS.displayName=Xt;var VO="MenuGroup",_g=x.forwardRef((e,n)=>{const{__scopeMenu:r,...o}=e;return p.jsx(fe.div,{role:"group",...o,ref:n})});_g.displayName=VO;var WO="MenuLabel",pS=x.forwardRef((e,n)=>{const{__scopeMenu:r,...o}=e;return p.jsx(fe.div,{...o,ref:n})});pS.displayName=WO;var gu="MenuItem",My="menu.itemSelect",Nd=x.forwardRef((e,n)=>{const{disabled:r=!1,onSelect:o,...i}=e,s=x.useRef(null),a=Ja(gu,e.__scopeMenu),l=wg(gu,e.__scopeMenu),c=xe(n,s),u=x.useRef(!1),f=()=>{const d=s.current;if(!r&&d){const h=new CustomEvent(My,{bubbles:!0,cancelable:!0});d.addEventListener(My,g=>o==null?void 0:o(g),{once:!0}),U_(d,h),h.defaultPrevented?u.current=!1:a.onClose()}};return p.jsx(mS,{...i,ref:c,disabled:r,onClick:re(e.onClick,f),onPointerDown:d=>{var h;(h=e.onPointerDown)==null||h.call(e,d),u.current=!0},onPointerUp:re(e.onPointerUp,d=>{var h;u.current||(h=d.currentTarget)==null||h.click()}),onKeyDown:re(e.onKeyDown,d=>{const h=l.searchRef.current!=="";r||h&&d.key===" "||dp.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Nd.displayName=gu;var mS=x.forwardRef((e,n)=>{const{__scopeMenu:r,disabled:o=!1,textValue:i,...s}=e,a=wg(gu,r),l=uS(r),c=x.useRef(null),u=xe(n,c),[f,d]=x.useState(!1),[h,g]=x.useState("");return x.useEffect(()=>{const v=c.current;v&&g((v.textContent??"").trim())},[s.children]),p.jsx(Ca.ItemSlot,{scope:r,disabled:o,textValue:i??h,children:p.jsx(aS,{asChild:!0,...l,focusable:!o,children:p.jsx(fe.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:u,onPointerMove:re(e.onPointerMove,Na(v=>{o?a.onItemLeave(v):(a.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:re(e.onPointerLeave,Na(v=>a.onItemLeave(v))),onFocus:re(e.onFocus,()=>d(!0)),onBlur:re(e.onBlur,()=>d(!1))})})})}),GO="MenuCheckboxItem",gS=x.forwardRef((e,n)=>{const{checked:r=!1,onCheckedChange:o,...i}=e;return p.jsx(bS,{scope:e.__scopeMenu,checked:r,children:p.jsx(Nd,{role:"menuitemcheckbox","aria-checked":vu(r)?"mixed":r,...i,ref:n,"data-state":kg(r),onSelect:re(i.onSelect,()=>o==null?void 0:o(vu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});gS.displayName=GO;var vS="MenuRadioGroup",[YO,XO]=Vo(vS,{value:void 0,onValueChange:()=>{}}),yS=x.forwardRef((e,n)=>{const{value:r,onValueChange:o,...i}=e,s=Rn(o);return p.jsx(YO,{scope:e.__scopeMenu,value:r,onValueChange:s,children:p.jsx(_g,{...i,ref:n})})});yS.displayName=vS;var xS="MenuRadioItem",wS=x.forwardRef((e,n)=>{const{value:r,...o}=e,i=XO(xS,e.__scopeMenu),s=r===i.value;return p.jsx(bS,{scope:e.__scopeMenu,checked:s,children:p.jsx(Nd,{role:"menuitemradio","aria-checked":s,...o,ref:n,"data-state":kg(s),onSelect:re(o.onSelect,()=>{var a;return(a=i.onValueChange)==null?void 0:a.call(i,r)},{checkForDefaultPrevented:!1})})})});wS.displayName=xS;var Sg="MenuItemIndicator",[bS,KO]=Vo(Sg,{checked:!1}),_S=x.forwardRef((e,n)=>{const{__scopeMenu:r,forceMount:o,...i}=e,s=KO(Sg,r);return p.jsx(kt,{present:o||vu(s.checked)||s.checked===!0,children:p.jsx(fe.span,{...i,ref:n,"data-state":kg(s.checked)})})});_S.displayName=Sg;var qO="MenuSeparator",SS=x.forwardRef((e,n)=>{const{__scopeMenu:r,...o}=e;return p.jsx(fe.div,{role:"separator","aria-orientation":"horizontal",...o,ref:n})});SS.displayName=qO;var QO="MenuArrow",kS=x.forwardRef((e,n)=>{const{__scopeMenu:r,...o}=e,i=vg(r);return p.jsx(Sd,{...i,...o,ref:n})});kS.displayName=QO;var ZO="MenuSub",[eY,CS]=Vo(ZO),Ls="MenuSubTrigger",NS=x.forwardRef((e,n)=>{const r=Wo(Ls,e.__scopeMenu),o=Ja(Ls,e.__scopeMenu),i=CS(Ls,e.__scopeMenu),s=wg(Ls,e.__scopeMenu),a=x.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},f=x.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return x.useEffect(()=>f,[f]),x.useEffect(()=>{const d=l.current;return()=>{window.clearTimeout(d),c(null)}},[l,c]),p.jsx(yg,{asChild:!0,...u,children:p.jsx(mS,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":PS(r.open),...e,ref:An(n,i.onTriggerChange),onClick:d=>{var h;(h=e.onClick)==null||h.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:re(e.onPointerMove,Na(d=>{s.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!r.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),f()},100))})),onPointerLeave:re(e.onPointerLeave,Na(d=>{var g,v;f();const h=(g=r.content)==null?void 0:g.getBoundingClientRect();if(h){const b=(v=r.content)==null?void 0:v.dataset.side,_=b==="right",m=_?-5:5,w=h[_?"left":"right"],y=h[_?"right":"left"];s.onPointerGraceIntentChange({area:[{x:d.clientX+m,y:d.clientY},{x:w,y:h.top},{x:y,y:h.top},{x:y,y:h.bottom},{x:w,y:h.bottom}],side:b}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(d),d.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:re(e.onKeyDown,d=>{var g;const h=s.searchRef.current!=="";e.disabled||h&&d.key===" "||IO[o.dir].includes(d.key)&&(r.onOpenChange(!0),(g=r.content)==null||g.focus(),d.preventDefault())})})})});NS.displayName=Ls;var ES="MenuSubContent",jS=x.forwardRef((e,n)=>{const r=dS(Xt,e.__scopeMenu),{forceMount:o=r.forceMount,...i}=e,s=Wo(Xt,e.__scopeMenu),a=Ja(Xt,e.__scopeMenu),l=CS(ES,e.__scopeMenu),c=x.useRef(null),u=xe(n,c);return p.jsx(Ca.Provider,{scope:e.__scopeMenu,children:p.jsx(kt,{present:o||s.open,children:p.jsx(Ca.Slot,{scope:e.__scopeMenu,children:p.jsx(bg,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:u,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var d;a.isUsingKeyboardRef.current&&((d=c.current)==null||d.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:re(e.onFocusOutside,f=>{f.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:re(e.onEscapeKeyDown,f=>{a.onClose(),f.preventDefault()}),onKeyDown:re(e.onKeyDown,f=>{var g;const d=f.currentTarget.contains(f.target),h=OO[a.dir].includes(f.key);d&&h&&(s.onOpenChange(!1),(g=l.trigger)==null||g.focus(),f.preventDefault())})})})})})});jS.displayName=ES;function PS(e){return e?"open":"closed"}function vu(e){return e==="indeterminate"}function kg(e){return vu(e)?"indeterminate":e?"checked":"unchecked"}function JO(e){const n=document.activeElement;for(const r of e)if(r===n||(r.focus(),document.activeElement!==n))return}function e$(e,n){return e.map((r,o)=>e[(n+o)%e.length])}function t$(e,n,r){const i=n.length>1&&Array.from(n).every(u=>u===n[0])?n[0]:n,s=r?e.indexOf(r):-1;let a=e$(e,Math.max(s,0));i.length===1&&(a=a.filter(u=>u!==r));const c=a.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function n$(e,n){const{x:r,y:o}=e;let i=!1;for(let s=0,a=n.length-1;s<n.length;a=s++){const l=n[s],c=n[a],u=l.x,f=l.y,d=c.x,h=c.y;f>o!=h>o&&r<(d-u)*(o-f)/(h-f)+u&&(i=!i)}return i}function r$(e,n){if(!n)return!1;const r={x:e.clientX,y:e.clientY};return n$(r,n)}function Na(e){return n=>n.pointerType==="mouse"?e(n):void 0}var o$=yg,i$=fS,s$=hS,a$=_g,l$=pS,c$=Nd,u$=gS,d$=yS,f$=wS,h$=_S,p$=SS,m$=kS,g$=NS,v$=jS,MS="DropdownMenu",[y$]=Qt(MS,[cS]),Nt=cS(),[tY,RS]=y$(MS),AS="DropdownMenuTrigger",x$=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,disabled:o=!1,...i}=e,s=RS(AS,r),a=Nt(r);return p.jsx(o$,{asChild:!0,...a,children:p.jsx(fe.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...i,ref:An(n,s.triggerRef),onPointerDown:re(e.onPointerDown,l=>{!o&&l.button===0&&l.ctrlKey===!1&&(s.onOpenToggle(),s.open||l.preventDefault())}),onKeyDown:re(e.onKeyDown,l=>{o||(["Enter"," "].includes(l.key)&&s.onOpenToggle(),l.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});x$.displayName=AS;var w$="DropdownMenuPortal",TS=e=>{const{__scopeDropdownMenu:n,...r}=e,o=Nt(n);return p.jsx(i$,{...o,...r})};TS.displayName=w$;var IS="DropdownMenuContent",OS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=RS(IS,r),s=Nt(r),a=x.useRef(!1);return p.jsx(s$,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...o,ref:n,onCloseAutoFocus:re(e.onCloseAutoFocus,l=>{var c;a.current||(c=i.triggerRef.current)==null||c.focus(),a.current=!1,l.preventDefault()}),onInteractOutside:re(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,f=c.button===2||u;(!i.modal||f)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});OS.displayName=IS;var b$="DropdownMenuGroup",_$=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(a$,{...i,...o,ref:n})});_$.displayName=b$;var S$="DropdownMenuLabel",$S=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(l$,{...i,...o,ref:n})});$S.displayName=S$;var k$="DropdownMenuItem",DS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(c$,{...i,...o,ref:n})});DS.displayName=k$;var C$="DropdownMenuCheckboxItem",LS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(u$,{...i,...o,ref:n})});LS.displayName=C$;var N$="DropdownMenuRadioGroup",E$=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(d$,{...i,...o,ref:n})});E$.displayName=N$;var j$="DropdownMenuRadioItem",zS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(f$,{...i,...o,ref:n})});zS.displayName=j$;var P$="DropdownMenuItemIndicator",FS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(h$,{...i,...o,ref:n})});FS.displayName=P$;var M$="DropdownMenuSeparator",BS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(p$,{...i,...o,ref:n})});BS.displayName=M$;var R$="DropdownMenuArrow",A$=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(m$,{...i,...o,ref:n})});A$.displayName=R$;var T$="DropdownMenuSubTrigger",HS=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(g$,{...i,...o,ref:n})});HS.displayName=T$;var I$="DropdownMenuSubContent",US=x.forwardRef((e,n)=>{const{__scopeDropdownMenu:r,...o}=e,i=Nt(r);return p.jsx(v$,{...i,...o,ref:n,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});US.displayName=I$;var O$=TS,VS=OS,WS=$S,GS=DS,YS=LS,XS=zS,KS=FS,qS=BS,QS=HS,ZS=US;const $$=x.forwardRef(({className:e,inset:n,children:r,...o},i)=>p.jsxs(QS,{ref:i,className:ae("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n&&"pl-8",e),...o,children:[r,p.jsx(Fi,{className:"ml-auto"})]}));$$.displayName=QS.displayName;const D$=x.forwardRef(({className:e,...n},r)=>p.jsx(ZS,{ref:r,className:ae("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n}));D$.displayName=ZS.displayName;const L$=x.forwardRef(({className:e,sideOffset:n=4,...r},o)=>p.jsx(O$,{children:p.jsx(VS,{ref:o,sideOffset:n,className:ae("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...r})}));L$.displayName=VS.displayName;const z$=x.forwardRef(({className:e,inset:n,...r},o)=>p.jsx(GS,{ref:o,className:ae("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",n&&"pl-8",e),...r}));z$.displayName=GS.displayName;const F$=x.forwardRef(({className:e,children:n,checked:r,...o},i)=>p.jsxs(YS,{ref:i,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...o,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(KS,{children:p.jsx(qm,{className:"h-4 w-4"})})}),n]}));F$.displayName=YS.displayName;const B$=x.forwardRef(({className:e,children:n,...r},o)=>p.jsxs(XS,{ref:o,className:ae("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(KS,{children:p.jsx(WR,{className:"h-2 w-2 fill-current"})})}),n]}));B$.displayName=XS.displayName;const H$=x.forwardRef(({className:e,inset:n,...r},o)=>p.jsx(WS,{ref:o,className:ae("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",e),...r}));H$.displayName=WS.displayName;const U$=x.forwardRef(({className:e,...n},r)=>p.jsx(qS,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...n}));U$.displayName=qS.displayName;const V$=x.forwardRef(({className:e,type:n,...r},o)=>p.jsx("input",{type:n,className:ae("flex h-9 w-full rounded-md border border-transparent bg-input px-3 py-1 text-base transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground/50 placeholder:font-light focus-visible:outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:o,...r}));V$.displayName="Input";var W$="Label",JS=x.forwardRef((e,n)=>p.jsx(mt.label,{...e,ref:n,onMouseDown:r=>{var i;r.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));JS.displayName=W$;var ek=JS;const G$=Xm("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Y$=x.forwardRef(({className:e,...n},r)=>p.jsx(ek,{ref:r,className:ae(G$(),e),...n}));Y$.displayName=ek.displayName;var tk="Popover",[nk]=Qt(tk,[to]),Ed=to(),[nY,no]=nk(tk),rk="PopoverAnchor",X$=x.forwardRef((e,n)=>{const{__scopePopover:r,...o}=e,i=no(rk,r),s=Ed(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:l}=i;return x.useEffect(()=>(a(),()=>l()),[a,l]),p.jsx(Qa,{...s,...o,ref:n})});X$.displayName=rk;var ok="PopoverTrigger",K$=x.forwardRef((e,n)=>{const{__scopePopover:r,...o}=e,i=no(ok,r),s=Ed(r),a=xe(n,i.triggerRef),l=p.jsx(fe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ck(i.open),...o,ref:a,onClick:re(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?l:p.jsx(Qa,{asChild:!0,...s,children:l})});K$.displayName=ok;var Cg="PopoverPortal",[q$,Q$]=nk(Cg,{forceMount:void 0}),ik=e=>{const{__scopePopover:n,forceMount:r,children:o,container:i}=e,s=no(Cg,n);return p.jsx(q$,{scope:n,forceMount:r,children:p.jsx(kt,{present:r||s.open,children:p.jsx(ss,{asChild:!0,container:i,children:o})})})};ik.displayName=Cg;var Hi="PopoverContent",sk=x.forwardRef((e,n)=>{const r=Q$(Hi,e.__scopePopover),{forceMount:o=r.forceMount,...i}=e,s=no(Hi,e.__scopePopover);return p.jsx(kt,{present:o||s.open,children:s.modal?p.jsx(J$,{...i,ref:n}):p.jsx(eD,{...i,ref:n})})});sk.displayName=Hi;var Z$=Ao("PopoverContent.RemoveScroll"),J$=x.forwardRef((e,n)=>{const r=no(Hi,e.__scopePopover),o=x.useRef(null),i=xe(n,o),s=x.useRef(!1);return x.useEffect(()=>{const a=o.current;if(a)return hd(a)},[]),p.jsx(Ga,{as:Z$,allowPinchZoom:!0,children:p.jsx(ak,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:re(e.onCloseAutoFocus,a=>{var l;a.preventDefault(),s.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:re(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:re(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),eD=x.forwardRef((e,n)=>{const r=no(Hi,e.__scopePopover),o=x.useRef(!1),i=x.useRef(!1);return p.jsx(ak,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,l;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(o.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:s=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((u=r.triggerRef.current)==null?void 0:u.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),ak=x.forwardRef((e,n)=>{const{__scopePopover:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:f,...d}=e,h=no(Hi,r),g=Ed(r);return dd(),p.jsx(Wa,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:i,onUnmountAutoFocus:s,children:p.jsx(is,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>h.onOpenChange(!1),children:p.jsx(_d,{"data-state":ck(h.open),role:"dialog",id:h.contentId,...g,...d,ref:n,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),lk="PopoverClose",tD=x.forwardRef((e,n)=>{const{__scopePopover:r,...o}=e,i=no(lk,r);return p.jsx(fe.button,{type:"button",...o,ref:n,onClick:re(e.onClick,()=>i.onOpenChange(!1))})});tD.displayName=lk;var nD="PopoverArrow",rD=x.forwardRef((e,n)=>{const{__scopePopover:r,...o}=e,i=Ed(r);return p.jsx(Sd,{...i,...o,ref:n})});rD.displayName=nD;function ck(e){return e?"open":"closed"}var oD=ik,uk=sk;const iD=x.forwardRef(({className:e,align:n="start",sideOffset:r=4,...o},i)=>p.jsx(oD,{children:p.jsx(uk,{ref:i,align:n,sideOffset:r,className:ae("z-50 w-[var(--radix-popover-trigger-width)] rounded-md border bg-popover p-0 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));iD.displayName=uk.displayName;var Ng="Progress",Eg=100,[sD]=w_(Ng),[aD,lD]=sD(Ng),dk=x.forwardRef((e,n)=>{const{__scopeProgress:r,value:o=null,max:i,getValueLabel:s=cD,...a}=e;(i||i===0)&&!Ry(i)&&console.error(uD(`${i}`,"Progress"));const l=Ry(i)?i:Eg;o!==null&&!Ay(o,l)&&console.error(dD(`${o}`,"Progress"));const c=Ay(o,l)?o:null,u=yu(c)?s(c,l):void 0;return p.jsx(aD,{scope:r,value:c,max:l,children:p.jsx(mt.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":yu(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":pk(c,l),"data-value":c??void 0,"data-max":l,...a,ref:n})})});dk.displayName=Ng;var fk="ProgressIndicator",hk=x.forwardRef((e,n)=>{const{__scopeProgress:r,...o}=e,i=lD(fk,r);return p.jsx(mt.div,{"data-state":pk(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...o,ref:n})});hk.displayName=fk;function cD(e,n){return`${Math.round(e/n*100)}%`}function pk(e,n){return e==null?"indeterminate":e===n?"complete":"loading"}function yu(e){return typeof e=="number"}function Ry(e){return yu(e)&&!isNaN(e)&&e>0}function Ay(e,n){return yu(e)&&!isNaN(e)&&e<=n&&e>=0}function uD(e,n){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${n}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Eg}\`.`}function dD(e,n){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${n}\`. The \`value\` prop must be:
|
|
375
380
|
- a positive number
|
|
376
381
|
- less than the value passed to \`max\` (or ${Eg} if no \`max\` prop is set)
|
|
377
382
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
378
383
|
|
|
379
|
-
Defaulting to \`null\`.`}var mk=dk,uD=hk;const dD=x.forwardRef(({className:e,value:n,...r},o)=>p.jsx(mk,{ref:o,className:ae("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...r,children:p.jsx(uD,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));dD.displayName=mk.displayName;function Ty(e,[n,r]){return Math.min(r,Math.max(n,e))}var gk=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),fD="VisuallyHidden",vk=x.forwardRef((e,n)=>p.jsx(fe.span,{...e,ref:n,style:{...gk,...e.style}}));vk.displayName=fD;var hD=vk,pD=[" ","Enter","ArrowUp","ArrowDown"],mD=[" ","Enter"],jd="Select",[jg,Pd,gD]=cg(jd),[cs]=Qt(jd,[gD,to]),Pg=to(),[tY,ro]=cs(jd),[nY,vD]=cs(jd),yk="SelectTrigger",xk=x.forwardRef((e,n)=>{const{__scopeSelect:r,disabled:o=!1,...i}=e,s=Pg(r),a=ro(yk,r),l=a.disabled||o,c=xe(n,a.onTriggerChange),u=Pd(r),f=x.useRef("touch"),[d,h,g]=Bk(b=>{const _=u().filter(y=>!y.disabled),m=_.find(y=>y.value===a.value),w=Hk(_,b,m);w!==void 0&&a.onValueChange(w.value)}),v=b=>{l||(a.onOpenChange(!0),g()),b&&(a.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return p.jsx(Qa,{asChild:!0,...s,children:p.jsx(fe.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Fk(a.value)?"":void 0,...i,ref:c,onClick:re(i.onClick,b=>{b.currentTarget.focus(),f.current!=="mouse"&&v(b)}),onPointerDown:re(i.onPointerDown,b=>{f.current=b.pointerType;const _=b.target;_.hasPointerCapture(b.pointerId)&&_.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(v(b),b.preventDefault())}),onKeyDown:re(i.onKeyDown,b=>{const _=d.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&h(b.key),!(_&&b.key===" ")&&pD.includes(b.key)&&(v(),b.preventDefault())})})})});xk.displayName=yk;var wk="SelectValue",yD=x.forwardRef((e,n)=>{const{__scopeSelect:r,className:o,style:i,children:s,placeholder:a="",...l}=e,c=ro(wk,r),{onValueNodeHasChildrenChange:u}=c,f=s!==void 0,d=xe(n,c.onValueNodeChange);return Ye(()=>{u(f)},[u,f]),p.jsx(fe.span,{...l,ref:d,style:{pointerEvents:"none"},children:Fk(c.value)?p.jsx(p.Fragment,{children:a}):s})});yD.displayName=wk;var xD="SelectIcon",bk=x.forwardRef((e,n)=>{const{__scopeSelect:r,children:o,...i}=e;return p.jsx(fe.span,{"aria-hidden":!0,...i,ref:n,children:o||"▼"})});bk.displayName=xD;var wD="SelectPortal",_k=e=>p.jsx(ss,{asChild:!0,...e});_k.displayName=wD;var $o="SelectContent",Sk=x.forwardRef((e,n)=>{const r=ro($o,e.__scopeSelect),[o,i]=x.useState();if(Ye(()=>{i(new DocumentFragment)},[]),!r.open){const s=o;return s?ts.createPortal(p.jsx(kk,{scope:e.__scopeSelect,children:p.jsx(jg.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),s):null}return p.jsx(Ck,{...e,ref:n})});Sk.displayName=$o;var nn=10,[kk,oo]=cs($o),bD="SelectContentImpl",_D=Ao("SelectContent.RemoveScroll"),Ck=x.forwardRef((e,n)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:a,side:l,sideOffset:c,align:u,alignOffset:f,arrowPadding:d,collisionBoundary:h,collisionPadding:g,sticky:v,hideWhenDetached:b,avoidCollisions:_,...m}=e,w=ro($o,r),[y,S]=x.useState(null),[k,C]=x.useState(null),N=xe(n,W=>S(W)),[E,j]=x.useState(null),[A,T]=x.useState(null),D=Pd(r),[F,P]=x.useState(!1),L=x.useRef(!1);x.useEffect(()=>{if(y)return hd(y)},[y]),dd();const I=x.useCallback(W=>{const[X,...q]=D().map(Q=>Q.ref.current),[te]=q.slice(-1),ee=document.activeElement;for(const Q of W)if(Q===ee||(Q==null||Q.scrollIntoView({block:"nearest"}),Q===X&&k&&(k.scrollTop=0),Q===te&&k&&(k.scrollTop=k.scrollHeight),Q==null||Q.focus(),document.activeElement!==ee))return},[D,k]),z=x.useCallback(()=>I([E,y]),[I,E,y]);x.useEffect(()=>{F&&z()},[F,z]);const{onOpenChange:R,triggerPointerDownPosRef:M}=w;x.useEffect(()=>{if(y){let W={x:0,y:0};const X=te=>{var ee,Q;W={x:Math.abs(Math.round(te.pageX)-(((ee=M.current)==null?void 0:ee.x)??0)),y:Math.abs(Math.round(te.pageY)-(((Q=M.current)==null?void 0:Q.y)??0))}},q=te=>{W.x<=10&&W.y<=10?te.preventDefault():y.contains(te.target)||R(!1),document.removeEventListener("pointermove",X),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",X),document.addEventListener("pointerup",q,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",X),document.removeEventListener("pointerup",q,{capture:!0})}}},[y,R,M]),x.useEffect(()=>{const W=()=>R(!1);return window.addEventListener("blur",W),window.addEventListener("resize",W),()=>{window.removeEventListener("blur",W),window.removeEventListener("resize",W)}},[R]);const[O,V]=Bk(W=>{const X=D().filter(ee=>!ee.disabled),q=X.find(ee=>ee.ref.current===document.activeElement),te=Hk(X,W,q);te&&setTimeout(()=>te.ref.current.focus())}),$=x.useCallback((W,X,q)=>{const te=!L.current&&!q;(w.value!==void 0&&w.value===X||te)&&(j(W),te&&(L.current=!0))},[w.value]),K=x.useCallback(()=>y==null?void 0:y.focus(),[y]),B=x.useCallback((W,X,q)=>{const te=!L.current&&!q;(w.value!==void 0&&w.value===X||te)&&T(W)},[w.value]),U=o==="popper"?fp:Nk,G=U===fp?{side:l,sideOffset:c,align:u,alignOffset:f,arrowPadding:d,collisionBoundary:h,collisionPadding:g,sticky:v,hideWhenDetached:b,avoidCollisions:_}:{};return p.jsx(kk,{scope:r,content:y,viewport:k,onViewportChange:C,itemRefCallback:$,selectedItem:E,onItemLeave:K,itemTextRefCallback:B,focusSelectedItem:z,selectedItemText:A,position:o,isPositioned:F,searchRef:O,children:p.jsx(Ga,{as:_D,allowPinchZoom:!0,children:p.jsx(Wa,{asChild:!0,trapped:w.open,onMountAutoFocus:W=>{W.preventDefault()},onUnmountAutoFocus:re(i,W=>{var X;(X=w.trigger)==null||X.focus({preventScroll:!0}),W.preventDefault()}),children:p.jsx(is,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:W=>W.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:p.jsx(U,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:W=>W.preventDefault(),...m,...G,onPlaced:()=>P(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...m.style},onKeyDown:re(m.onKeyDown,W=>{const X=W.ctrlKey||W.altKey||W.metaKey;if(W.key==="Tab"&&W.preventDefault(),!X&&W.key.length===1&&V(W.key),["ArrowUp","ArrowDown","Home","End"].includes(W.key)){let te=D().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);if(["ArrowUp","End"].includes(W.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(W.key)){const ee=W.target,Q=te.indexOf(ee);te=te.slice(Q+1)}setTimeout(()=>I(te)),W.preventDefault()}})})})})})})});Ck.displayName=bD;var SD="SelectItemAlignedPosition",Nk=x.forwardRef((e,n)=>{const{__scopeSelect:r,onPlaced:o,...i}=e,s=ro($o,r),a=oo($o,r),[l,c]=x.useState(null),[u,f]=x.useState(null),d=xe(n,N=>f(N)),h=Pd(r),g=x.useRef(!1),v=x.useRef(!0),{viewport:b,selectedItem:_,selectedItemText:m,focusSelectedItem:w}=a,y=x.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&b&&_&&m){const N=s.trigger.getBoundingClientRect(),E=u.getBoundingClientRect(),j=s.valueNode.getBoundingClientRect(),A=m.getBoundingClientRect();if(s.dir!=="rtl"){const ee=A.left-E.left,Q=j.left-ee,ne=N.left-Q,ue=N.width+ne,ye=Math.max(ue,E.width),pe=window.innerWidth-nn,ke=Ty(Q,[nn,Math.max(nn,pe-ye)]);l.style.minWidth=ue+"px",l.style.left=ke+"px"}else{const ee=E.right-A.right,Q=window.innerWidth-j.right-ee,ne=window.innerWidth-N.right-Q,ue=N.width+ne,ye=Math.max(ue,E.width),pe=window.innerWidth-nn,ke=Ty(Q,[nn,Math.max(nn,pe-ye)]);l.style.minWidth=ue+"px",l.style.right=ke+"px"}const T=h(),D=window.innerHeight-nn*2,F=b.scrollHeight,P=window.getComputedStyle(u),L=parseInt(P.borderTopWidth,10),I=parseInt(P.paddingTop,10),z=parseInt(P.borderBottomWidth,10),R=parseInt(P.paddingBottom,10),M=L+I+F+R+z,O=Math.min(_.offsetHeight*5,M),V=window.getComputedStyle(b),$=parseInt(V.paddingTop,10),K=parseInt(V.paddingBottom,10),B=N.top+N.height/2-nn,U=D-B,G=_.offsetHeight/2,W=_.offsetTop+G,X=L+I+W,q=M-X;if(X<=B){const ee=T.length>0&&_===T[T.length-1].ref.current;l.style.bottom="0px";const Q=u.clientHeight-b.offsetTop-b.offsetHeight,ne=Math.max(U,G+(ee?K:0)+Q+z),ue=X+ne;l.style.height=ue+"px"}else{const ee=T.length>0&&_===T[0].ref.current;l.style.top="0px";const ne=Math.max(B,L+b.offsetTop+(ee?$:0)+G)+q;l.style.height=ne+"px",b.scrollTop=X-B+b.offsetTop}l.style.margin=`${nn}px 0`,l.style.minHeight=O+"px",l.style.maxHeight=D+"px",o==null||o(),requestAnimationFrame(()=>g.current=!0)}},[h,s.trigger,s.valueNode,l,u,b,_,m,s.dir,o]);Ye(()=>y(),[y]);const[S,k]=x.useState();Ye(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const C=x.useCallback(N=>{N&&v.current===!0&&(y(),w==null||w(),v.current=!1)},[y,w]);return p.jsx(CD,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:g,onScrollButtonChange:C,children:p.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:p.jsx(fe.div,{...i,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Nk.displayName=SD;var kD="SelectPopperPosition",fp=x.forwardRef((e,n)=>{const{__scopeSelect:r,align:o="start",collisionPadding:i=nn,...s}=e,a=Pg(r);return p.jsx(_d,{...a,...s,ref:n,align:o,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});fp.displayName=kD;var[CD,Mg]=cs($o,{}),hp="SelectViewport",Ek=x.forwardRef((e,n)=>{const{__scopeSelect:r,nonce:o,...i}=e,s=oo(hp,r),a=Mg(hp,r),l=xe(n,s.onViewportChange),c=x.useRef(0);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),p.jsx(jg.Slot,{scope:r,children:p.jsx(fe.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:re(i.onScroll,u=>{const f=u.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:h}=a;if(h!=null&&h.current&&d){const g=Math.abs(c.current-f.scrollTop);if(g>0){const v=window.innerHeight-nn*2,b=parseFloat(d.style.minHeight),_=parseFloat(d.style.height),m=Math.max(b,_);if(m<v){const w=m+g,y=Math.min(v,w),S=w-y;d.style.height=y+"px",d.style.bottom==="0px"&&(f.scrollTop=S>0?S:0,d.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});Ek.displayName=hp;var jk="SelectGroup",[ND,ED]=cs(jk),jD=x.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e,i=Tt();return p.jsx(ND,{scope:r,id:i,children:p.jsx(fe.div,{role:"group","aria-labelledby":i,...o,ref:n})})});jD.displayName=jk;var Pk="SelectLabel",Mk=x.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e,i=ED(Pk,r);return p.jsx(fe.div,{id:i.id,...o,ref:n})});Mk.displayName=Pk;var xu="SelectItem",[PD,Rk]=cs(xu),Ak=x.forwardRef((e,n)=>{const{__scopeSelect:r,value:o,disabled:i=!1,textValue:s,...a}=e,l=ro(xu,r),c=oo(xu,r),u=l.value===o,[f,d]=x.useState(s??""),[h,g]=x.useState(!1),v=xe(n,w=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,w,o,i)}),b=Tt(),_=x.useRef("touch"),m=()=>{i||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.jsx(PD,{scope:r,value:o,disabled:i,textId:b,isSelected:u,onItemTextChange:x.useCallback(w=>{d(y=>y||((w==null?void 0:w.textContent)??"").trim())},[]),children:p.jsx(jg.ItemSlot,{scope:r,value:o,disabled:i,textValue:f,children:p.jsx(fe.div,{role:"option","aria-labelledby":b,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...a,ref:v,onFocus:re(a.onFocus,()=>g(!0)),onBlur:re(a.onBlur,()=>g(!1)),onClick:re(a.onClick,()=>{_.current!=="mouse"&&m()}),onPointerUp:re(a.onPointerUp,()=>{_.current==="mouse"&&m()}),onPointerDown:re(a.onPointerDown,w=>{_.current=w.pointerType}),onPointerMove:re(a.onPointerMove,w=>{var y;_.current=w.pointerType,i?(y=c.onItemLeave)==null||y.call(c):_.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:re(a.onPointerLeave,w=>{var y;w.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:re(a.onKeyDown,w=>{var S;((S=c.searchRef)==null?void 0:S.current)!==""&&w.key===" "||(mD.includes(w.key)&&m(),w.key===" "&&w.preventDefault())})})})})});Ak.displayName=xu;var zs="SelectItemText",Tk=x.forwardRef((e,n)=>{const{__scopeSelect:r,className:o,style:i,...s}=e,a=ro(zs,r),l=oo(zs,r),c=Rk(zs,r),u=vD(zs,r),[f,d]=x.useState(null),h=xe(n,m=>d(m),c.onItemTextChange,m=>{var w;return(w=l.itemTextRefCallback)==null?void 0:w.call(l,m,c.value,c.disabled)}),g=f==null?void 0:f.textContent,v=x.useMemo(()=>p.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:b,onNativeOptionRemove:_}=u;return Ye(()=>(b(v),()=>_(v)),[b,_,v]),p.jsxs(p.Fragment,{children:[p.jsx(fe.span,{id:c.textId,...s,ref:h}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?ts.createPortal(s.children,a.valueNode):null]})});Tk.displayName=zs;var Ik="SelectItemIndicator",Ok=x.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e;return Rk(Ik,r).isSelected?p.jsx(fe.span,{"aria-hidden":!0,...o,ref:n}):null});Ok.displayName=Ik;var pp="SelectScrollUpButton",$k=x.forwardRef((e,n)=>{const r=oo(pp,e.__scopeSelect),o=Mg(pp,e.__scopeSelect),[i,s]=x.useState(!1),a=xe(n,o.onScrollButtonChange);return Ye(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollTop>0;s(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),i?p.jsx(Lk,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});$k.displayName=pp;var mp="SelectScrollDownButton",Dk=x.forwardRef((e,n)=>{const r=oo(mp,e.__scopeSelect),o=Mg(mp,e.__scopeSelect),[i,s]=x.useState(!1),a=xe(n,o.onScrollButtonChange);return Ye(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<u;s(f)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),i?p.jsx(Lk,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Dk.displayName=mp;var Lk=x.forwardRef((e,n)=>{const{__scopeSelect:r,onAutoScroll:o,...i}=e,s=oo("SelectScrollButton",r),a=x.useRef(null),l=Pd(r),c=x.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return x.useEffect(()=>()=>c(),[c]),Ye(()=>{var f;const u=l().find(d=>d.ref.current===document.activeElement);(f=u==null?void 0:u.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),p.jsx(fe.div,{"aria-hidden":!0,...i,ref:n,style:{flexShrink:0,...i.style},onPointerDown:re(i.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(o,50))}),onPointerMove:re(i.onPointerMove,()=>{var u;(u=s.onItemLeave)==null||u.call(s),a.current===null&&(a.current=window.setInterval(o,50))}),onPointerLeave:re(i.onPointerLeave,()=>{c()})})}),MD="SelectSeparator",zk=x.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e;return p.jsx(fe.div,{"aria-hidden":!0,...o,ref:n})});zk.displayName=MD;var gp="SelectArrow",RD=x.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e,i=Pg(r),s=ro(gp,r),a=oo(gp,r);return s.open&&a.position==="popper"?p.jsx(Sd,{...i,...o,ref:n}):null});RD.displayName=gp;var AD="SelectBubbleInput",TD=x.forwardRef(({__scopeSelect:e,value:n,...r},o)=>{const i=x.useRef(null),s=xe(o,i),a=eg(n);return x.useEffect(()=>{const l=i.current;if(!l)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==n&&f){const d=new Event("change",{bubbles:!0});f.call(l,n),l.dispatchEvent(d)}},[a,n]),p.jsx(fe.select,{...r,style:{...gk,...r.style},ref:s,defaultValue:n})});TD.displayName=AD;function Fk(e){return e===""||e===void 0}function Bk(e){const n=Rn(e),r=x.useRef(""),o=x.useRef(0),i=x.useCallback(a=>{const l=r.current+a;n(l),function c(u){r.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>c(""),1e3))}(l)},[n]),s=x.useCallback(()=>{r.current="",window.clearTimeout(o.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(o.current),[]),[r,i,s]}function Hk(e,n,r){const i=n.length>1&&Array.from(n).every(u=>u===n[0])?n[0]:n,s=r?e.indexOf(r):-1;let a=ID(e,Math.max(s,0));i.length===1&&(a=a.filter(u=>u!==r));const c=a.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function ID(e,n){return e.map((r,o)=>e[(n+o)%e.length])}var Uk=xk,OD=bk,$D=_k,Vk=Sk,DD=Ek,Wk=Mk,Gk=Ak,LD=Tk,zD=Ok,Yk=$k,Xk=Dk,Kk=zk;const FD=x.forwardRef(({className:e,children:n,...r},o)=>p.jsxs(Uk,{ref:o,className:ae("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-transparent bg-input px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground/50 data-[placeholder]:font-light focus:outline-none focus:border-ring focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[n,p.jsx(OD,{asChild:!0,children:p.jsx(cd,{className:"h-4 w-4 opacity-50"})})]}));FD.displayName=Uk.displayName;const qk=x.forwardRef(({className:e,...n},r)=>p.jsx(Yk,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...n,children:p.jsx(DR,{className:"h-4 w-4"})}));qk.displayName=Yk.displayName;const Qk=x.forwardRef(({className:e,...n},r)=>p.jsx(Xk,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...n,children:p.jsx(cd,{className:"h-4 w-4"})}));Qk.displayName=Xk.displayName;const BD=x.forwardRef(({className:e,children:n,position:r="popper",...o},i)=>p.jsx($D,{children:p.jsxs(Vk,{ref:i,className:ae("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...o,children:[p.jsx(qk,{}),p.jsx(DD,{className:ae("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),p.jsx(Qk,{})]})}));BD.displayName=Vk.displayName;const HD=x.forwardRef(({className:e,...n},r)=>p.jsx(Wk,{ref:r,className:ae("px-2 py-1.5 text-sm font-semibold",e),...n}));HD.displayName=Wk.displayName;const UD=x.forwardRef(({className:e,children:n,...r},o)=>p.jsxs(Gk,{ref:o,className:ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[p.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(zD,{children:p.jsx(qm,{className:"h-4 w-4"})})}),p.jsx(LD,{children:n})]}));UD.displayName=Gk.displayName;const VD=x.forwardRef(({className:e,...n},r)=>p.jsx(Kk,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...n}));VD.displayName=Kk.displayName;var WD="Separator",Iy="horizontal",GD=["horizontal","vertical"],Zk=x.forwardRef((e,n)=>{const{decorative:r,orientation:o=Iy,...i}=e,s=YD(o)?o:Iy,l=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return p.jsx(mt.div,{"data-orientation":s,...l,...i,ref:n})});Zk.displayName=WD;function YD(e){return GD.includes(e)}var Jk=Zk;const XD=x.forwardRef(({className:e,orientation:n="horizontal",decorative:r=!0,...o},i)=>p.jsx(Jk,{ref:i,decorative:r,orientation:n,className:ae("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));XD.displayName=Jk.displayName;const KD=ag,eC=x.forwardRef(({className:e,...n},r)=>p.jsx(Ya,{className:ae("fixed inset-0 z-50 bg-black/80 [will-change:opacity] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...n,ref:r}));eC.displayName=Ya.displayName;const qD=Xm("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out [will-change:transform,opacity] data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),QD=x.forwardRef(({side:e="right",className:n,children:r,...o},i)=>p.jsxs(KD,{children:[p.jsx(eC,{}),p.jsxs(Xa,{ref:i,className:ae(qD({side:e}),n),...o,children:[p.jsxs(k2,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[p.jsx(uu,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]}),r]})]}));QD.displayName=Xa.displayName;const ZD=x.forwardRef(({className:e,...n},r)=>p.jsx(md,{ref:r,className:ae("text-lg font-semibold text-foreground",e),...n}));ZD.displayName=md.displayName;const JD=x.forwardRef(({className:e,...n},r)=>p.jsx(gd,{ref:r,className:ae("text-sm text-muted-foreground",e),...n}));JD.displayName=gd.displayName;var Md="Switch",[eL]=Qt(Md),[tL,nL]=eL(Md),tC=x.forwardRef((e,n)=>{const{__scopeSwitch:r,name:o,checked:i,defaultChecked:s,required:a,disabled:l,value:c="on",onCheckedChange:u,form:f,...d}=e,[h,g]=x.useState(null),v=xe(n,y=>g(y)),b=x.useRef(!1),_=h?f||!!h.closest("form"):!0,[m,w]=Va({prop:i,defaultProp:s??!1,onChange:u,caller:Md});return p.jsxs(tL,{scope:r,checked:m,disabled:l,children:[p.jsx(fe.button,{type:"button",role:"switch","aria-checked":m,"aria-required":a,"data-state":iC(m),"data-disabled":l?"":void 0,disabled:l,value:c,...d,ref:v,onClick:re(e.onClick,y=>{w(S=>!S),_&&(b.current=y.isPropagationStopped(),b.current||y.stopPropagation())})}),_&&p.jsx(oC,{control:h,bubbles:!b.current,name:o,value:c,checked:m,required:a,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});tC.displayName=Md;var nC="SwitchThumb",rC=x.forwardRef((e,n)=>{const{__scopeSwitch:r,...o}=e,i=nL(nC,r);return p.jsx(fe.span,{"data-state":iC(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:n})});rC.displayName=nC;var rL="SwitchBubbleInput",oC=x.forwardRef(({__scopeSwitch:e,control:n,checked:r,bubbles:o=!0,...i},s)=>{const a=x.useRef(null),l=xe(a,s),c=eg(r),u=tg(n);return x.useEffect(()=>{const f=a.current;if(!f)return;const d=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(d,"checked").set;if(c!==r&&g){const v=new Event("click",{bubbles:o});g.call(f,r),f.dispatchEvent(v)}},[c,r,o]),p.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});oC.displayName=rL;function iC(e){return e?"checked":"unchecked"}var sC=tC,oL=rC;const iL=x.forwardRef(({className:e,...n},r)=>p.jsx(sC,{ref:r,className:ae("peer inline-flex h-4 w-7 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...n,children:p.jsx(oL,{className:ae("pointer-events-none block h-3 w-3 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-3 data-[state=unchecked]:translate-x-0")})}));iL.displayName=sC.displayName;function sL(e){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}Array(12).fill(0);let vp=1;class aL{constructor(){this.subscribe=n=>(this.subscribers.push(n),()=>{const r=this.subscribers.indexOf(n);this.subscribers.splice(r,1)}),this.publish=n=>{this.subscribers.forEach(r=>r(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n]},this.create=n=>{var r;const{message:o,...i}=n,s=typeof(n==null?void 0:n.id)=="number"||((r=n.id)==null?void 0:r.length)>0?n.id:vp++,a=this.toasts.find(c=>c.id===s),l=n.dismissible===void 0?!0:n.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),a?this.toasts=this.toasts.map(c=>c.id===s?(this.publish({...c,...n,id:s,title:o}),{...c,...n,id:s,dismissible:l,title:o}):c):this.addToast({title:o,...i,dismissible:l,id:s}),s},this.dismiss=n=>(n?(this.dismissedToasts.add(n),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:n,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(o=>o({id:r.id,dismiss:!0}))}),n),this.message=(n,r)=>this.create({...r,message:n}),this.error=(n,r)=>this.create({...r,message:n,type:"error"}),this.success=(n,r)=>this.create({...r,type:"success",message:n}),this.info=(n,r)=>this.create({...r,type:"info",message:n}),this.warning=(n,r)=>this.create({...r,type:"warning",message:n}),this.loading=(n,r)=>this.create({...r,type:"loading",message:n}),this.promise=(n,r)=>{if(!r)return;let o;r.loading!==void 0&&(o=this.create({...r,promise:n,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const i=Promise.resolve(n instanceof Function?n():n);let s=o!==void 0,a;const l=i.then(async u=>{if(a=["resolve",u],it.isValidElement(u))s=!1,this.create({id:o,type:"default",message:u});else if(cL(u)&&!u.ok){s=!1;const d=typeof r.error=="function"?await r.error(`HTTP error! status: ${u.status}`):r.error,h=typeof r.description=="function"?await r.description(`HTTP error! status: ${u.status}`):r.description,v=typeof d=="object"&&!it.isValidElement(d)?d:{message:d};this.create({id:o,type:"error",description:h,...v})}else if(u instanceof Error){s=!1;const d=typeof r.error=="function"?await r.error(u):r.error,h=typeof r.description=="function"?await r.description(u):r.description,v=typeof d=="object"&&!it.isValidElement(d)?d:{message:d};this.create({id:o,type:"error",description:h,...v})}else if(r.success!==void 0){s=!1;const d=typeof r.success=="function"?await r.success(u):r.success,h=typeof r.description=="function"?await r.description(u):r.description,v=typeof d=="object"&&!it.isValidElement(d)?d:{message:d};this.create({id:o,type:"success",description:h,...v})}}).catch(async u=>{if(a=["reject",u],r.error!==void 0){s=!1;const f=typeof r.error=="function"?await r.error(u):r.error,d=typeof r.description=="function"?await r.description(u):r.description,g=typeof f=="object"&&!it.isValidElement(f)?f:{message:f};this.create({id:o,type:"error",description:d,...g})}}).finally(()=>{s&&(this.dismiss(o),o=void 0),r.finally==null||r.finally.call(r)}),c=()=>new Promise((u,f)=>l.then(()=>a[0]==="reject"?f(a[1]):u(a[1])).catch(f));return typeof o!="string"&&typeof o!="number"?{unwrap:c}:Object.assign(o,{unwrap:c})},this.custom=(n,r)=>{const o=(r==null?void 0:r.id)||vp++;return this.create({jsx:n(o),id:o,...r}),o},this.getActiveToasts=()=>this.toasts.filter(n=>!this.dismissedToasts.has(n.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Bt=new aL,lL=(e,n)=>{const r=(n==null?void 0:n.id)||vp++;return Bt.addToast({title:e,...n,id:r}),r},cL=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",uL=lL,dL=()=>Bt.toasts,fL=()=>Bt.getActiveToasts();Object.assign(uL,{success:Bt.success,info:Bt.info,warning:Bt.warning,error:Bt.error,custom:Bt.custom,message:Bt.message,promise:Bt.promise,dismiss:Bt.dismiss,loading:Bt.loading},{getHistory:dL,getToasts:fL});sL("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");var Rd="Tabs",[hL]=Qt(Rd,[kd]),aC=kd(),[pL,Rg]=hL(Rd),mL=x.forwardRef((e,n)=>{const{__scopeTabs:r,value:o,onValueChange:i,defaultValue:s,orientation:a="horizontal",dir:l,activationMode:c="automatic",...u}=e,f=T2(l),[d,h]=Va({prop:o,onChange:i,defaultProp:s??"",caller:Rd});return p.jsx(pL,{scope:r,baseId:Tt(),value:d,onValueChange:h,orientation:a,dir:f,activationMode:c,children:p.jsx(fe.div,{dir:f,"data-orientation":a,...u,ref:n})})});mL.displayName=Rd;var lC="TabsList",cC=x.forwardRef((e,n)=>{const{__scopeTabs:r,loop:o=!0,...i}=e,s=Rg(lC,r),a=aC(r);return p.jsx(sS,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:o,children:p.jsx(fe.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:n})})});cC.displayName=lC;var uC="TabsTrigger",dC=x.forwardRef((e,n)=>{const{__scopeTabs:r,value:o,disabled:i=!1,...s}=e,a=Rg(uC,r),l=aC(r),c=pC(a.baseId,o),u=mC(a.baseId,o),f=o===a.value;return p.jsx(aS,{asChild:!0,...l,focusable:!i,active:f,children:p.jsx(fe.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...s,ref:n,onMouseDown:re(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?a.onValueChange(o):d.preventDefault()}),onKeyDown:re(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&a.onValueChange(o)}),onFocus:re(e.onFocus,()=>{const d=a.activationMode!=="manual";!f&&!i&&d&&a.onValueChange(o)})})})});dC.displayName=uC;var fC="TabsContent",hC=x.forwardRef((e,n)=>{const{__scopeTabs:r,value:o,forceMount:i,children:s,...a}=e,l=Rg(fC,r),c=pC(l.baseId,o),u=mC(l.baseId,o),f=o===l.value,d=x.useRef(f);return x.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),p.jsx(kt,{present:i||f,children:({present:h})=>p.jsx(fe.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...a,ref:n,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&s})})});hC.displayName=fC;function pC(e,n){return`${e}-trigger-${n}`}function mC(e,n){return`${e}-content-${n}`}var gC=cC,vC=dC,yC=hC;const gL=x.forwardRef(({className:e,...n},r)=>p.jsx(gC,{ref:r,className:ae("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...n}));gL.displayName=gC.displayName;const vL=x.forwardRef(({className:e,...n},r)=>p.jsx(vC,{ref:r,className:ae("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-primary/10 data-[state=active]:text-primary data-[state=active]:shadow-sm",e),...n}));vL.displayName=vC.displayName;const yL=x.forwardRef(({className:e,...n},r)=>p.jsx(yC,{ref:r,className:ae("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...n}));yL.displayName=yC.displayName;const xL=x.forwardRef(({className:e,...n},r)=>p.jsx("textarea",{className:ae("flex min-h-[60px] w-full rounded-md border border-transparent bg-input px-3 py-2 text-base placeholder:text-muted-foreground/50 placeholder:font-light focus-visible:outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));xL.displayName="Textarea";var[Ad]=Qt("Tooltip",[to]),Ag=to(),wL="TooltipProvider",Oy="tooltip.open",[rY,xC]=Ad(wL),wC="Tooltip",[oY,el]=Ad(wC),yp="TooltipTrigger",bL=x.forwardRef((e,n)=>{const{__scopeTooltip:r,...o}=e,i=el(yp,r),s=xC(yp,r),a=Ag(r),l=x.useRef(null),c=xe(n,l,i.onTriggerChange),u=x.useRef(!1),f=x.useRef(!1),d=x.useCallback(()=>u.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),p.jsx(Qa,{asChild:!0,...a,children:p.jsx(fe.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...o,ref:c,onPointerMove:re(e.onPointerMove,h=>{h.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:re(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:re(e.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:re(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:re(e.onBlur,i.onClose),onClick:re(e.onClick,i.onClose)})})});bL.displayName=yp;var Tg="TooltipPortal",[_L,SL]=Ad(Tg,{forceMount:void 0}),bC=e=>{const{__scopeTooltip:n,forceMount:r,children:o,container:i}=e,s=el(Tg,n);return p.jsx(_L,{scope:n,forceMount:r,children:p.jsx(kt,{present:r||s.open,children:p.jsx(ss,{asChild:!0,container:i,children:o})})})};bC.displayName=Tg;var Ui="TooltipContent",_C=x.forwardRef((e,n)=>{const r=SL(Ui,e.__scopeTooltip),{forceMount:o=r.forceMount,side:i="top",...s}=e,a=el(Ui,e.__scopeTooltip);return p.jsx(kt,{present:o||a.open,children:a.disableHoverableContent?p.jsx(SC,{side:i,...s,ref:n}):p.jsx(kL,{side:i,...s,ref:n})})}),kL=x.forwardRef((e,n)=>{const r=el(Ui,e.__scopeTooltip),o=xC(Ui,e.__scopeTooltip),i=x.useRef(null),s=xe(n,i),[a,l]=x.useState(null),{trigger:c,onClose:u}=r,f=i.current,{onPointerInTransitChange:d}=o,h=x.useCallback(()=>{l(null),d(!1)},[d]),g=x.useCallback((v,b)=>{const _=v.currentTarget,m={x:v.clientX,y:v.clientY},w=PL(m,_.getBoundingClientRect()),y=ML(m,w),S=RL(b.getBoundingClientRect()),k=TL([...y,...S]);l(k),d(!0)},[d]);return x.useEffect(()=>()=>h(),[h]),x.useEffect(()=>{if(c&&f){const v=_=>g(_,f),b=_=>g(_,c);return c.addEventListener("pointerleave",v),f.addEventListener("pointerleave",b),()=>{c.removeEventListener("pointerleave",v),f.removeEventListener("pointerleave",b)}}},[c,f,g,h]),x.useEffect(()=>{if(a){const v=b=>{const _=b.target,m={x:b.clientX,y:b.clientY},w=(c==null?void 0:c.contains(_))||(f==null?void 0:f.contains(_)),y=!AL(m,a);w?h():y&&(h(),u())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,f,a,u,h]),p.jsx(SC,{...e,ref:s})}),[CL,NL]=Ad(wC,{isInside:!1}),EL=rT("TooltipContent"),SC=x.forwardRef((e,n)=>{const{__scopeTooltip:r,children:o,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:a,...l}=e,c=el(Ui,r),u=Ag(r),{onClose:f}=c;return x.useEffect(()=>(document.addEventListener(Oy,f),()=>document.removeEventListener(Oy,f)),[f]),x.useEffect(()=>{if(c.trigger){const d=h=>{const g=h.target;g!=null&&g.contains(c.trigger)&&f()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[c.trigger,f]),p.jsx(is,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:f,children:p.jsxs(_d,{"data-state":c.stateAttribute,...u,...l,ref:n,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(EL,{children:o}),p.jsx(CL,{scope:r,isInside:!0,children:p.jsx(hD,{id:c.contentId,role:"tooltip",children:i||o})})]})})});_C.displayName=Ui;var kC="TooltipArrow",jL=x.forwardRef((e,n)=>{const{__scopeTooltip:r,...o}=e,i=Ag(r);return NL(kC,r).isInside?null:p.jsx(Sd,{...i,...o,ref:n})});jL.displayName=kC;function PL(e,n){const r=Math.abs(n.top-e.y),o=Math.abs(n.bottom-e.y),i=Math.abs(n.right-e.x),s=Math.abs(n.left-e.x);switch(Math.min(r,o,i,s)){case s:return"left";case i:return"right";case r:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function ML(e,n,r=5){const o=[];switch(n){case"top":o.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":o.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":o.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":o.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return o}function RL(e){const{top:n,right:r,bottom:o,left:i}=e;return[{x:i,y:n},{x:r,y:n},{x:r,y:o},{x:i,y:o}]}function AL(e,n){const{x:r,y:o}=e;let i=!1;for(let s=0,a=n.length-1;s<n.length;a=s++){const l=n[s],c=n[a],u=l.x,f=l.y,d=c.x,h=c.y;f>o!=h>o&&r<(d-u)*(o-f)/(h-f)+u&&(i=!i)}return i}function TL(e){const n=e.slice();return n.sort((r,o)=>r.x<o.x?-1:r.x>o.x?1:r.y<o.y?-1:r.y>o.y?1:0),IL(n)}function IL(e){if(e.length<=1)return e.slice();const n=[];for(let o=0;o<e.length;o++){const i=e[o];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))n.pop();else break}n.push(i)}n.pop();const r=[];for(let o=e.length-1;o>=0;o--){const i=e[o];for(;r.length>=2;){const s=r[r.length-1],a=r[r.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))r.pop();else break}r.push(i)}return r.pop(),n.length===1&&r.length===1&&n[0].x===r[0].x&&n[0].y===r[0].y?n:n.concat(r)}var OL=bC,CC=_C;const $L=x.forwardRef(({className:e,sideOffset:n=4,...r},o)=>p.jsx(OL,{children:p.jsx(CC,{ref:o,sideOffset:n,className:ae("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...r})}));$L.displayName=CC.displayName;function DL(){const{setTheme:e,resolvedTheme:n}=s3();return p.jsxs(B_,{variant:"ghost",size:"icon",className:"relative h-8 w-8",onClick:()=>e(n==="dark"?"light":"dark"),children:[p.jsx(jA,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),p.jsx(dA,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),p.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}const NC=x.createContext({activeProject:".",setActiveProject:()=>{},projects:[],isMultiProject:!1,monorepoRoot:"",reloadProjects:async()=>{}});function Ig(){return x.useContext(NC)}function Go(){const{activeProject:e,isMultiProject:n}=Ig();return x.useCallback((r,o)=>{const i=new URLSearchParams(o);n&&e!=="."&&i.set("project",e);const s=i.toString();return s?`${r}?${s}`:r},[e,n])}function LL({children:e}){const[n,r]=x.useState([]),[o,i]=x.useState("."),[s,a]=x.useState(""),l=x.useCallback(async()=>{var u;try{const f=await fetch("/api/projects");if(!f.ok)return;const d=await f.json();r(d.projects??[]),a(d.monorepoRoot??""),((u=d.projects)==null?void 0:u.length)>0&&o==="."&&i(d.projects[0].root)}catch{}},[o]);x.useEffect(()=>{l()},[l]);const c=n.length>1;return p.jsx(NC.Provider,{value:{activeProject:o,setActiveProject:i,projects:n,isMultiProject:c,monorepoRoot:s,reloadProjects:l},children:e})}function zL(){return p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("circle",{cx:"6",cy:"6",r:"2.5"}),p.jsx("circle",{cx:"18",cy:"6",r:"2.5"}),p.jsx("circle",{cx:"12",cy:"14",r:"2.5"}),p.jsx("circle",{cx:"6",cy:"20",r:"1.8"}),p.jsx("circle",{cx:"18",cy:"20",r:"1.8"}),p.jsx("path",{d:"M7.6 7.6 10.7 12.5"}),p.jsx("path",{d:"M16.4 7.6 13.3 12.5"}),p.jsx("path",{d:"M10.5 15.5 7.2 19"}),p.jsx("path",{d:"M13.5 15.5 16.8 19"})]})}function FL(){var c;const{projects:e,activeProject:n,setActiveProject:r,isMultiProject:o}=Ig(),[i,s]=x.useState(!1),a=x.useRef(null);x.useEffect(()=>{if(!i)return;const u=f=>{a.current&&!a.current.contains(f.target)&&s(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]);const l=((c=e.find(u=>u.root===n))==null?void 0:c.name)??"Project";return o?p.jsxs("div",{className:"relative",ref:a,children:[p.jsxs("button",{onClick:()=>s(!i),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-lg border border-border/50 hover:bg-muted/50 transition-colors",children:[l,p.jsx(cd,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform ${i?"rotate-180":""}`})]}),i&&p.jsx("div",{className:"absolute top-full left-0 mt-1 w-56 rounded-lg border border-border bg-card shadow-lg z-50 py-1",children:e.map(u=>p.jsxs("button",{onClick:()=>{r(u.root),s(!1)},className:`flex items-center gap-2 w-full px-3 py-2 text-sm text-left hover:bg-muted/50 transition-colors ${u.root===n?"bg-purple-500/10 text-purple-400":""}`,children:[p.jsx("span",{className:"flex-1 truncate",children:u.name}),u.hasGraphs&&p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shrink-0",title:"Graphs generated"})]},u.root))})]}):p.jsx("span",{className:"text-sm font-medium text-muted-foreground px-2",children:l})}function BL(){return p.jsxs("header",{className:"sticky top-0 z-40 flex h-[var(--header-height)] items-center border-b bg-background/80 px-4 shadow-sm backdrop-blur-md",children:[p.jsxs("span",{className:"logo",children:[p.jsx("span",{className:"logo-icon",children:p.jsx(zL,{})}),p.jsx("span",{className:"logo-text",children:"LaunchChart"})]}),p.jsx("div",{className:"mx-4",children:p.jsx(FL,{})}),p.jsx("div",{className:"ml-auto flex items-center gap-2",children:p.jsx(DL,{})})]})}const HL=[{to:"/overview",label:"Overview",icon:nA},{to:"/modules",label:"Modules",icon:ld},{to:"/sitemap",label:"Sitemap",icon:cA},{to:"/journeys",label:"User Journeys",icon:bA},{to:"/project-graph",label:"Project Graph",icon:hA},{to:"/audit",label:"Audit",icon:F_},{to:"/settings",label:"Settings",icon:z_}],UL="sidebar-nav-item active relative flex items-center gap-3 overflow-hidden rounded-lg px-3 py-1.5 text-sm bg-gradient-to-r from-sidebar-primary/20 via-transparent via-80% to-transparent font-medium text-sidebar-foreground before:absolute before:left-0 before:top-0 before:h-full before:w-[3px] before:rounded-full before:bg-sidebar-primary",VL="sidebar-nav-item relative flex w-full items-center gap-3 overflow-hidden rounded-lg px-3 py-1.5 text-sm font-normal text-sidebar-muted-foreground transition-colors duration-200 hover:text-sidebar-foreground bg-transparent border-none cursor-pointer";function WL(){return p.jsx("aside",{className:"hidden lg:flex lg:flex-col w-[var(--sidebar-width)] sidebar-gradient",children:p.jsx("nav",{className:"flex-1 overflow-y-auto px-3 py-4",children:p.jsx("ul",{className:"space-y-1",children:HL.map(e=>{const n=e.icon;return p.jsx("li",{children:p.jsxs(n3,{to:e.to,className:({isActive:r})=>r?UL:VL,children:[p.jsx(n,{className:"h-4 w-4 shrink-0"}),e.label]})},e.to)})})})})}function GL(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,s,a,l=[],c=!0,u=!1;try{if(s=(r=r.call(e)).next,n===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(o=s.call(r)).done)&&(l.push(o.value),l.length!==n);c=!0);}catch(f){u=!0,i=f}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function YL(e,n,r){return n=t6(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function $y(e,n){return qL(e)||GL(e,n)||EC(e,n)||JL()}function XL(e){return KL(e)||QL(e)||EC(e)||ZL()}function KL(e){if(Array.isArray(e))return xp(e)}function qL(e){if(Array.isArray(e))return e}function QL(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function EC(e,n){if(e){if(typeof e=="string")return xp(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xp(e,n)}}function xp(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=new Array(n);r<n;r++)o[r]=e[r];return o}function ZL(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
380
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
381
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
382
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
383
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c6(e,n){return r6(e)||s6(e,n)||jC(e,n)||a6()}function Dy(e){return o6(e)||i6(e)||jC(e)||l6()}function jC(e,n){if(e){if(typeof e=="string")return wp(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?wp(e,n):void 0}}function u6(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.wrapperElementType,o=r===void 0?"div":r,i=n.nodeMapper,s=i===void 0?function(f){return f}:i,a=n.methodNames,l=a===void 0?[]:a,c=n.initPropNames,u=c===void 0?[]:c;return x.forwardRef(function(f,d){var h=x.useRef(),g=x.useMemo(function(){var _=Object.fromEntries(u.filter(function(m){return f.hasOwnProperty(m)}).map(function(m){return[m,f[m]]}));return e(_)},[]);Ly(function(){g(s(h.current))},x.useLayoutEffect),Ly(function(){return g._destructor instanceof Function?g._destructor:void 0});var v=x.useCallback(function(_){for(var m=arguments.length,w=new Array(m>1?m-1:0),y=1;y<m;y++)w[y-1]=arguments[y];return g[_]instanceof Function?g[_].apply(g,w):void 0},[g]),b=x.useRef({});return Object.keys(n6(f,[].concat(Dy(l),Dy(u)))).filter(function(_){return b.current[_]!==f[_]}).forEach(function(_){return v(_,f[_])}),b.current=f,x.useImperativeHandle(d,function(){return Object.fromEntries(l.map(function(_){return[_,function(){for(var m=arguments.length,w=new Array(m),y=0;y<m;y++)w[y]=arguments[y];return v.apply(void 0,[_].concat(w))}]}))},[v]),it.createElement(o,{ref:h})})}function Ly(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:x.useEffect,r=x.useRef(),o=x.useRef(!1),i=x.useRef(!1),s=x.useState(0),a=c6(s,2);a[0];var l=a[1];o.current&&(i.current=!0),n(function(){return o.current||(r.current=e(),o.current=!0),l(function(c){return c+1}),function(){i.current&&r.current&&r.current()}},[])}var bp="http://www.w3.org/1999/xhtml";const zy={svg:"http://www.w3.org/2000/svg",xhtml:bp,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Td(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),zy.hasOwnProperty(n)?{space:zy[n],local:e}:e}function d6(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===bp&&n.documentElement.namespaceURI===bp?n.createElement(e):n.createElementNS(r,e)}}function f6(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function PC(e){var n=Td(e);return(n.local?f6:d6)(n)}function h6(){}function Og(e){return e==null?h6:function(){return this.querySelector(e)}}function p6(e){typeof e!="function"&&(e=Og(e));for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i)for(var s=n[i],a=s.length,l=o[i]=new Array(a),c,u,f=0;f<a;++f)(c=s[f])&&(u=e.call(c,c.__data__,f,s))&&("__data__"in c&&(u.__data__=c.__data__),l[f]=u);return new $t(o,this._parents)}function m6(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function g6(){return[]}function MC(e){return e==null?g6:function(){return this.querySelectorAll(e)}}function v6(e){return function(){return m6(e.apply(this,arguments))}}function y6(e){typeof e=="function"?e=v6(e):e=MC(e);for(var n=this._groups,r=n.length,o=[],i=[],s=0;s<r;++s)for(var a=n[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&(o.push(e.call(c,c.__data__,u,a)),i.push(c));return new $t(o,i)}function RC(e){return function(){return this.matches(e)}}function AC(e){return function(n){return n.matches(e)}}var x6=Array.prototype.find;function w6(e){return function(){return x6.call(this.children,e)}}function b6(){return this.firstElementChild}function _6(e){return this.select(e==null?b6:w6(typeof e=="function"?e:AC(e)))}var S6=Array.prototype.filter;function k6(){return Array.from(this.children)}function C6(e){return function(){return S6.call(this.children,e)}}function N6(e){return this.selectAll(e==null?k6:C6(typeof e=="function"?e:AC(e)))}function E6(e){typeof e!="function"&&(e=RC(e));for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i)for(var s=n[i],a=s.length,l=o[i]=[],c,u=0;u<a;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new $t(o,this._parents)}function TC(e){return new Array(e.length)}function j6(){return new $t(this._enter||this._groups.map(TC),this._parents)}function wu(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}wu.prototype={constructor:wu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function P6(e){return function(){return e}}function M6(e,n,r,o,i,s){for(var a=0,l,c=n.length,u=s.length;a<u;++a)(l=n[a])?(l.__data__=s[a],o[a]=l):r[a]=new wu(e,s[a]);for(;a<c;++a)(l=n[a])&&(i[a]=l)}function R6(e,n,r,o,i,s,a){var l,c,u=new Map,f=n.length,d=s.length,h=new Array(f),g;for(l=0;l<f;++l)(c=n[l])&&(h[l]=g=a.call(c,c.__data__,l,n)+"",u.has(g)?i[l]=c:u.set(g,c));for(l=0;l<d;++l)g=a.call(e,s[l],l,s)+"",(c=u.get(g))?(o[l]=c,c.__data__=s[l],u.delete(g)):r[l]=new wu(e,s[l]);for(l=0;l<f;++l)(c=n[l])&&u.get(h[l])===c&&(i[l]=c)}function A6(e){return e.__data__}function T6(e,n){if(!arguments.length)return Array.from(this,A6);var r=n?R6:M6,o=this._parents,i=this._groups;typeof e!="function"&&(e=P6(e));for(var s=i.length,a=new Array(s),l=new Array(s),c=new Array(s),u=0;u<s;++u){var f=o[u],d=i[u],h=d.length,g=I6(e.call(f,f&&f.__data__,u,o)),v=g.length,b=l[u]=new Array(v),_=a[u]=new Array(v),m=c[u]=new Array(h);r(f,d,b,_,m,g,n);for(var w=0,y=0,S,k;w<v;++w)if(S=b[w]){for(w>=y&&(y=w+1);!(k=_[y])&&++y<v;);S._next=k||null}}return a=new $t(a,o),a._enter=l,a._exit=c,a}function I6(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function O6(){return new $t(this._exit||this._groups.map(TC),this._parents)}function $6(e,n,r){var o=this.enter(),i=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),n!=null&&(i=n(i),i&&(i=i.selection())),r==null?s.remove():r(s),o&&i?o.merge(i).order():i}function D6(e){for(var n=e.selection?e.selection():e,r=this._groups,o=n._groups,i=r.length,s=o.length,a=Math.min(i,s),l=new Array(i),c=0;c<a;++c)for(var u=r[c],f=o[c],d=u.length,h=l[c]=new Array(d),g,v=0;v<d;++v)(g=u[v]||f[v])&&(h[v]=g);for(;c<i;++c)l[c]=r[c];return new $t(l,this._parents)}function L6(){for(var e=this._groups,n=-1,r=e.length;++n<r;)for(var o=e[n],i=o.length-1,s=o[i],a;--i>=0;)(a=o[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function z6(e){e||(e=F6);function n(d,h){return d&&h?e(d.__data__,h.__data__):!d-!h}for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s){for(var a=r[s],l=a.length,c=i[s]=new Array(l),u,f=0;f<l;++f)(u=a[f])&&(c[f]=u);c.sort(n)}return new $t(i,this._parents).order()}function F6(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function B6(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function H6(){return Array.from(this)}function U6(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=e[n],i=0,s=o.length;i<s;++i){var a=o[i];if(a)return a}return null}function V6(){let e=0;for(const n of this)++e;return e}function W6(){return!this.node()}function G6(e){for(var n=this._groups,r=0,o=n.length;r<o;++r)for(var i=n[r],s=0,a=i.length,l;s<a;++s)(l=i[s])&&e.call(l,l.__data__,s,i);return this}function Y6(e){return function(){this.removeAttribute(e)}}function X6(e){return function(){this.removeAttributeNS(e.space,e.local)}}function K6(e,n){return function(){this.setAttribute(e,n)}}function q6(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function Q6(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function Z6(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function J6(e,n){var r=Td(e);if(arguments.length<2){var o=this.node();return r.local?o.getAttributeNS(r.space,r.local):o.getAttribute(r)}return this.each((n==null?r.local?X6:Y6:typeof n=="function"?r.local?Z6:Q6:r.local?q6:K6)(r,n))}function IC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function e8(e){return function(){this.style.removeProperty(e)}}function t8(e,n,r){return function(){this.style.setProperty(e,n,r)}}function n8(e,n,r){return function(){var o=n.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,r)}}function r8(e,n,r){return arguments.length>1?this.each((n==null?e8:typeof n=="function"?n8:t8)(e,n,r??"")):Vi(this.node(),e)}function Vi(e,n){return e.style.getPropertyValue(n)||IC(e).getComputedStyle(e,null).getPropertyValue(n)}function o8(e){return function(){delete this[e]}}function i8(e,n){return function(){this[e]=n}}function s8(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function a8(e,n){return arguments.length>1?this.each((n==null?o8:typeof n=="function"?s8:i8)(e,n)):this.node()[e]}function OC(e){return e.trim().split(/^|\s+/)}function $g(e){return e.classList||new $C(e)}function $C(e){this._node=e,this._names=OC(e.getAttribute("class")||"")}$C.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function DC(e,n){for(var r=$g(e),o=-1,i=n.length;++o<i;)r.add(n[o])}function LC(e,n){for(var r=$g(e),o=-1,i=n.length;++o<i;)r.remove(n[o])}function l8(e){return function(){DC(this,e)}}function c8(e){return function(){LC(this,e)}}function u8(e,n){return function(){(n.apply(this,arguments)?DC:LC)(this,e)}}function d8(e,n){var r=OC(e+"");if(arguments.length<2){for(var o=$g(this.node()),i=-1,s=r.length;++i<s;)if(!o.contains(r[i]))return!1;return!0}return this.each((typeof n=="function"?u8:n?l8:c8)(r,n))}function f8(){this.textContent=""}function h8(e){return function(){this.textContent=e}}function p8(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function m8(e){return arguments.length?this.each(e==null?f8:(typeof e=="function"?p8:h8)(e)):this.node().textContent}function g8(){this.innerHTML=""}function v8(e){return function(){this.innerHTML=e}}function y8(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function x8(e){return arguments.length?this.each(e==null?g8:(typeof e=="function"?y8:v8)(e)):this.node().innerHTML}function w8(){this.nextSibling&&this.parentNode.appendChild(this)}function b8(){return this.each(w8)}function _8(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function S8(){return this.each(_8)}function k8(e){var n=typeof e=="function"?e:PC(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function C8(){return null}function N8(e,n){var r=typeof e=="function"?e:PC(e),o=n==null?C8:typeof n=="function"?n:Og(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),o.apply(this,arguments)||null)})}function E8(){var e=this.parentNode;e&&e.removeChild(this)}function j8(){return this.each(E8)}function P8(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function M8(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function R8(e){return this.select(e?M8:P8)}function A8(e){return arguments.length?this.property("__data__",e):this.node().__data__}function T8(e){return function(n){e.call(this,n,this.__data__)}}function I8(e){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");return o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),{type:n,name:r}})}function O8(e){return function(){var n=this.__on;if(n){for(var r=0,o=-1,i=n.length,s;r<i;++r)s=n[r],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):n[++o]=s;++o?n.length=o:delete this.__on}}}function $8(e,n,r){return function(){var o=this.__on,i,s=T8(n);if(o){for(var a=0,l=o.length;a<l;++a)if((i=o[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=r),i.value=n;return}}this.addEventListener(e.type,s,r),i={type:e.type,name:e.name,value:n,listener:s,options:r},o?o.push(i):this.__on=[i]}}function D8(e,n,r){var o=I8(e+""),i,s=o.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,f;c<u;++c)for(i=0,f=l[c];i<s;++i)if((a=o[i]).type===f.type&&a.name===f.name)return f.value}return}for(l=n?$8:O8,i=0;i<s;++i)this.each(l(o[i],n,r));return this}function zC(e,n,r){var o=IC(e),i=o.CustomEvent;typeof i=="function"?i=new i(n,r):(i=o.document.createEvent("Event"),r?(i.initEvent(n,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(n,!1,!1)),e.dispatchEvent(i)}function L8(e,n){return function(){return zC(this,e,n)}}function z8(e,n){return function(){return zC(this,e,n.apply(this,arguments))}}function F8(e,n){return this.each((typeof n=="function"?z8:L8)(e,n))}function*B8(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=e[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&(yield a)}var FC=[null];function $t(e,n){this._groups=e,this._parents=n}function tl(){return new $t([[document.documentElement]],FC)}function H8(){return this}$t.prototype=tl.prototype={constructor:$t,select:p6,selectAll:y6,selectChild:_6,selectChildren:N6,filter:E6,data:T6,enter:j6,exit:O6,join:$6,merge:D6,selection:H8,order:L6,sort:z6,call:B6,nodes:H6,node:U6,size:V6,empty:W6,each:G6,attr:J6,style:r8,property:a8,classed:d8,text:m8,html:x8,raise:b8,lower:S8,append:k8,insert:N8,remove:j8,clone:R8,datum:A8,on:D8,dispatch:F8,[Symbol.iterator]:B8};function at(e){return typeof e=="string"?new $t([[document.querySelector(e)]],[document.documentElement]):new $t([[e]],FC)}function U8(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Ht(e,n){if(e=U8(e),n===void 0&&(n=e.currentTarget),n){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var o=r.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(n.getScreenCTM().inverse()),[o.x,o.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[e.clientX-i.left-n.clientLeft,e.clientY-i.top-n.clientTop]}}return[e.pageX,e.pageY]}var V8={value:()=>{}};function nl(){for(var e=0,n=arguments.length,r={},o;e<n;++e){if(!(o=arguments[e]+"")||o in r||/[\s.]/.test(o))throw new Error("illegal type: "+o);r[o]=[]}return new jc(r)}function jc(e){this._=e}function W8(e,n){return e.trim().split(/^|\s+/).map(function(r){var o="",i=r.indexOf(".");if(i>=0&&(o=r.slice(i+1),r=r.slice(0,i)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:o}})}jc.prototype=nl.prototype={constructor:jc,on:function(e,n){var r=this._,o=W8(e+"",r),i,s=-1,a=o.length;if(arguments.length<2){for(;++s<a;)if((i=(e=o[s]).type)&&(i=G8(r[i],e.name)))return i;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++s<a;)if(i=(e=o[s]).type)r[i]=Fy(r[i],e.name,n);else if(n==null)for(i in r)r[i]=Fy(r[i],e.name,null);return this},copy:function(){var e={},n=this._;for(var r in n)e[r]=n[r].slice();return new jc(e)},call:function(e,n){if((i=arguments.length-2)>0)for(var r=new Array(i),o=0,i,s;o<i;++o)r[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,i=s.length;o<i;++o)s[o].value.apply(n,r)},apply:function(e,n,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],i=0,s=o.length;i<s;++i)o[i].value.apply(n,r)}};function G8(e,n){for(var r=0,o=e.length,i;r<o;++r)if((i=e[r]).name===n)return i.value}function Fy(e,n,r){for(var o=0,i=e.length;o<i;++o)if(e[o].name===n){e[o]=V8,e=e.slice(0,o).concat(e.slice(o+1));break}return r!=null&&e.push({name:n,value:r}),e}const Y8={passive:!1},Ea={capture:!0,passive:!1};function Uf(e){e.stopImmediatePropagation()}function Pi(e){e.preventDefault(),e.stopImmediatePropagation()}function BC(e){var n=e.document.documentElement,r=at(e).on("dragstart.drag",Pi,Ea);"onselectstart"in n?r.on("selectstart.drag",Pi,Ea):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function HC(e,n){var r=e.document.documentElement,o=at(e).on("dragstart.drag",null);n&&(o.on("click.drag",Pi,Ea),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in r?o.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const Kl=e=>()=>e;function _p(e,{sourceEvent:n,subject:r,target:o,identifier:i,active:s,x:a,y:l,dx:c,dy:u,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:f}})}_p.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function X8(e){return!e.ctrlKey&&!e.button}function K8(){return this.parentNode}function q8(e,n){return n??{x:e.x,y:e.y}}function Q8(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dg(){var e=X8,n=K8,r=q8,o=Q8,i={},s=nl("start","drag","end"),a=0,l,c,u,f,d=0;function h(S){S.on("mousedown.drag",g).filter(o).on("touchstart.drag",_).on("touchmove.drag",m,Y8).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(S,k){if(!(f||!e.call(this,S,k))){var C=y(this,n.call(this,S,k),S,k,"mouse");C&&(at(S.view).on("mousemove.drag",v,Ea).on("mouseup.drag",b,Ea),BC(S.view),Uf(S),u=!1,l=S.clientX,c=S.clientY,C("start",S))}}function v(S){if(Pi(S),!u){var k=S.clientX-l,C=S.clientY-c;u=k*k+C*C>d}i.mouse("drag",S)}function b(S){at(S.view).on("mousemove.drag mouseup.drag",null),HC(S.view,u),Pi(S),i.mouse("end",S)}function _(S,k){if(e.call(this,S,k)){var C=S.changedTouches,N=n.call(this,S,k),E=C.length,j,A;for(j=0;j<E;++j)(A=y(this,N,S,k,C[j].identifier,C[j]))&&(Uf(S),A("start",S,C[j]))}}function m(S){var k=S.changedTouches,C=k.length,N,E;for(N=0;N<C;++N)(E=i[k[N].identifier])&&(Pi(S),E("drag",S,k[N]))}function w(S){var k=S.changedTouches,C=k.length,N,E;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),N=0;N<C;++N)(E=i[k[N].identifier])&&(Uf(S),E("end",S,k[N]))}function y(S,k,C,N,E,j){var A=s.copy(),T=Ht(j||C,k),D,F,P;if((P=r.call(S,new _p("beforestart",{sourceEvent:C,target:h,identifier:E,active:a,x:T[0],y:T[1],dx:0,dy:0,dispatch:A}),N))!=null)return D=P.x-T[0]||0,F=P.y-T[1]||0,function L(I,z,R){var M=T,O;switch(I){case"start":i[E]=L,O=a++;break;case"end":delete i[E],--a;case"drag":T=Ht(R||z,k),O=a;break}A.call(I,S,new _p(I,{sourceEvent:z,subject:P,target:h,identifier:E,active:O,x:T[0]+D,y:T[1]+F,dx:T[0]-M[0],dy:T[1]-M[1],dispatch:A}),N)}}return h.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Kl(!!S),h):e},h.container=function(S){return arguments.length?(n=typeof S=="function"?S:Kl(S),h):n},h.subject=function(S){return arguments.length?(r=typeof S=="function"?S:Kl(S),h):r},h.touchable=function(S){return arguments.length?(o=typeof S=="function"?S:Kl(!!S),h):o},h.on=function(){var S=s.on.apply(s,arguments);return S===s?h:S},h.clickDistance=function(S){return arguments.length?(d=(S=+S)*S,h):Math.sqrt(d)},h}function Lg(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function UC(e,n){var r=Object.create(e.prototype);for(var o in n)r[o]=n[o];return r}function rl(){}var ja=.7,bu=1/ja,Mi="\\s*([+-]?\\d+)\\s*",Pa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Mn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Z8=/^#([0-9a-f]{3,8})$/,J8=new RegExp(`^rgb\\(${Mi},${Mi},${Mi}\\)$`),ez=new RegExp(`^rgb\\(${Mn},${Mn},${Mn}\\)$`),tz=new RegExp(`^rgba\\(${Mi},${Mi},${Mi},${Pa}\\)$`),nz=new RegExp(`^rgba\\(${Mn},${Mn},${Mn},${Pa}\\)$`),rz=new RegExp(`^hsl\\(${Pa},${Mn},${Mn}\\)$`),oz=new RegExp(`^hsla\\(${Pa},${Mn},${Mn},${Pa}\\)$`),By={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};Lg(rl,Do,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Hy,formatHex:Hy,formatHex8:iz,formatHsl:sz,formatRgb:Uy,toString:Uy});function Hy(){return this.rgb().formatHex()}function iz(){return this.rgb().formatHex8()}function sz(){return VC(this).formatHsl()}function Uy(){return this.rgb().formatRgb()}function Do(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=Z8.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?Vy(n):r===3?new wt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?ql(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?ql(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=J8.exec(e))?new wt(n[1],n[2],n[3],1):(n=ez.exec(e))?new wt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=tz.exec(e))?ql(n[1],n[2],n[3],n[4]):(n=nz.exec(e))?ql(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=rz.exec(e))?Yy(n[1],n[2]/100,n[3]/100,1):(n=oz.exec(e))?Yy(n[1],n[2]/100,n[3]/100,n[4]):By.hasOwnProperty(e)?Vy(By[e]):e==="transparent"?new wt(NaN,NaN,NaN,0):null}function Vy(e){return new wt(e>>16&255,e>>8&255,e&255,1)}function ql(e,n,r,o){return o<=0&&(e=n=r=NaN),new wt(e,n,r,o)}function az(e){return e instanceof rl||(e=Do(e)),e?(e=e.rgb(),new wt(e.r,e.g,e.b,e.opacity)):new wt}function Sp(e,n,r,o){return arguments.length===1?az(e):new wt(e,n,r,o??1)}function wt(e,n,r,o){this.r=+e,this.g=+n,this.b=+r,this.opacity=+o}Lg(wt,Sp,UC(rl,{brighter(e){return e=e==null?bu:Math.pow(bu,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ja:Math.pow(ja,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wt(ko(this.r),ko(this.g),ko(this.b),_u(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:Wy,formatHex:Wy,formatHex8:lz,formatRgb:Gy,toString:Gy}));function Wy(){return`#${bo(this.r)}${bo(this.g)}${bo(this.b)}`}function lz(){return`#${bo(this.r)}${bo(this.g)}${bo(this.b)}${bo((isNaN(this.opacity)?1:this.opacity)*255)}`}function Gy(){const e=_u(this.opacity);return`${e===1?"rgb(":"rgba("}${ko(this.r)}, ${ko(this.g)}, ${ko(this.b)}${e===1?")":`, ${e})`}`}function _u(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ko(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function bo(e){return e=ko(e),(e<16?"0":"")+e.toString(16)}function Yy(e,n,r,o){return o<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new ln(e,n,r,o)}function VC(e){if(e instanceof ln)return new ln(e.h,e.s,e.l,e.opacity);if(e instanceof rl||(e=Do(e)),!e)return new ln;if(e instanceof ln)return e;e=e.rgb();var n=e.r/255,r=e.g/255,o=e.b/255,i=Math.min(n,r,o),s=Math.max(n,r,o),a=NaN,l=s-i,c=(s+i)/2;return l?(n===s?a=(r-o)/l+(r<o)*6:r===s?a=(o-n)/l+2:a=(n-r)/l+4,l/=c<.5?s+i:2-s-i,a*=60):l=c>0&&c<1?0:a,new ln(a,l,c,e.opacity)}function cz(e,n,r,o){return arguments.length===1?VC(e):new ln(e,n,r,o??1)}function ln(e,n,r,o){this.h=+e,this.s=+n,this.l=+r,this.opacity=+o}Lg(ln,cz,UC(rl,{brighter(e){return e=e==null?bu:Math.pow(bu,e),new ln(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ja:Math.pow(ja,e),new ln(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,o=r+(r<.5?r:1-r)*n,i=2*r-o;return new wt(Vf(e>=240?e-240:e+120,i,o),Vf(e,i,o),Vf(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new ln(Xy(this.h),Ql(this.s),Ql(this.l),_u(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=_u(this.opacity);return`${e===1?"hsl(":"hsla("}${Xy(this.h)}, ${Ql(this.s)*100}%, ${Ql(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Xy(e){return e=(e||0)%360,e<0?e+360:e}function Ql(e){return Math.max(0,Math.min(1,e||0))}function Vf(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const zg=e=>()=>e;function uz(e,n){return function(r){return e+r*n}}function dz(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(o){return Math.pow(e+o*n,r)}}function fz(e){return(e=+e)==1?WC:function(n,r){return r-n?dz(n,r,e):zg(isNaN(n)?r:n)}}function WC(e,n){var r=n-e;return r?uz(e,r):zg(isNaN(e)?n:e)}const Su=function e(n){var r=fz(n);function o(i,s){var a=r((i=Sp(i)).r,(s=Sp(s)).r),l=r(i.g,s.g),c=r(i.b,s.b),u=WC(i.opacity,s.opacity);return function(f){return i.r=a(f),i.g=l(f),i.b=c(f),i.opacity=u(f),i+""}}return o.gamma=e,o}(1);function hz(e,n){n||(n=[]);var r=e?Math.min(n.length,e.length):0,o=n.slice(),i;return function(s){for(i=0;i<r;++i)o[i]=e[i]*(1-s)+n[i]*s;return o}}function pz(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function mz(e,n){var r=n?n.length:0,o=e?Math.min(r,e.length):0,i=new Array(o),s=new Array(r),a;for(a=0;a<o;++a)i[a]=Js(e[a],n[a]);for(;a<r;++a)s[a]=n[a];return function(l){for(a=0;a<o;++a)s[a]=i[a](l);return s}}function gz(e,n){var r=new Date;return e=+e,n=+n,function(o){return r.setTime(e*(1-o)+n*o),r}}function _n(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}function vz(e,n){var r={},o={},i;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(i in n)i in e?r[i]=Js(e[i],n[i]):o[i]=n[i];return function(s){for(i in r)o[i]=r[i](s);return o}}var kp=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wf=new RegExp(kp.source,"g");function yz(e){return function(){return e}}function xz(e){return function(n){return e(n)+""}}function GC(e,n){var r=kp.lastIndex=Wf.lastIndex=0,o,i,s,a=-1,l=[],c=[];for(e=e+"",n=n+"";(o=kp.exec(e))&&(i=Wf.exec(n));)(s=i.index)>r&&(s=n.slice(r,s),l[a]?l[a]+=s:l[++a]=s),(o=o[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,c.push({i:a,x:_n(o,i)})),r=Wf.lastIndex;return r<n.length&&(s=n.slice(r),l[a]?l[a]+=s:l[++a]=s),l.length<2?c[0]?xz(c[0].x):yz(n):(n=c.length,function(u){for(var f=0,d;f<n;++f)l[(d=c[f]).i]=d.x(u);return l.join("")})}function Js(e,n){var r=typeof n,o;return n==null||r==="boolean"?zg(n):(r==="number"?_n:r==="string"?(o=Do(n))?(n=o,Su):GC:n instanceof Do?Su:n instanceof Date?gz:pz(n)?hz:Array.isArray(n)?mz:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?vz:_n)(e,n)}var Ky=180/Math.PI,Cp={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function YC(e,n,r,o,i,s){var a,l,c;return(a=Math.sqrt(e*e+n*n))&&(e/=a,n/=a),(c=e*r+n*o)&&(r-=e*c,o-=n*c),(l=Math.sqrt(r*r+o*o))&&(r/=l,o/=l,c/=l),e*o<n*r&&(e=-e,n=-n,c=-c,a=-a),{translateX:i,translateY:s,rotate:Math.atan2(n,e)*Ky,skewX:Math.atan(c)*Ky,scaleX:a,scaleY:l}}var Zl;function wz(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Cp:YC(n.a,n.b,n.c,n.d,n.e,n.f)}function bz(e){return e==null||(Zl||(Zl=document.createElementNS("http://www.w3.org/2000/svg","g")),Zl.setAttribute("transform",e),!(e=Zl.transform.baseVal.consolidate()))?Cp:(e=e.matrix,YC(e.a,e.b,e.c,e.d,e.e,e.f))}function XC(e,n,r,o){function i(u){return u.length?u.pop()+" ":""}function s(u,f,d,h,g,v){if(u!==d||f!==h){var b=g.push("translate(",null,n,null,r);v.push({i:b-4,x:_n(u,d)},{i:b-2,x:_n(f,h)})}else(d||h)&&g.push("translate("+d+n+h+r)}function a(u,f,d,h){u!==f?(u-f>180?f+=360:f-u>180&&(u+=360),h.push({i:d.push(i(d)+"rotate(",null,o)-2,x:_n(u,f)})):f&&d.push(i(d)+"rotate("+f+o)}function l(u,f,d,h){u!==f?h.push({i:d.push(i(d)+"skewX(",null,o)-2,x:_n(u,f)}):f&&d.push(i(d)+"skewX("+f+o)}function c(u,f,d,h,g,v){if(u!==d||f!==h){var b=g.push(i(g)+"scale(",null,",",null,")");v.push({i:b-4,x:_n(u,d)},{i:b-2,x:_n(f,h)})}else(d!==1||h!==1)&&g.push(i(g)+"scale("+d+","+h+")")}return function(u,f){var d=[],h=[];return u=e(u),f=e(f),s(u.translateX,u.translateY,f.translateX,f.translateY,d,h),a(u.rotate,f.rotate,d,h),l(u.skewX,f.skewX,d,h),c(u.scaleX,u.scaleY,f.scaleX,f.scaleY,d,h),u=f=null,function(g){for(var v=-1,b=h.length,_;++v<b;)d[(_=h[v]).i]=_.x(g);return d.join("")}}}var _z=XC(wz,"px, ","px)","deg)"),Sz=XC(bz,", ",")",")"),kz=1e-12;function qy(e){return((e=Math.exp(e))+1/e)/2}function Cz(e){return((e=Math.exp(e))-1/e)/2}function Nz(e){return((e=Math.exp(2*e))-1)/(e+1)}const Pc=function e(n,r,o){function i(s,a){var l=s[0],c=s[1],u=s[2],f=a[0],d=a[1],h=a[2],g=f-l,v=d-c,b=g*g+v*v,_,m;if(b<kz)m=Math.log(h/u)/n,_=function(N){return[l+N*g,c+N*v,u*Math.exp(n*N*m)]};else{var w=Math.sqrt(b),y=(h*h-u*u+o*b)/(2*u*r*w),S=(h*h-u*u-o*b)/(2*h*r*w),k=Math.log(Math.sqrt(y*y+1)-y),C=Math.log(Math.sqrt(S*S+1)-S);m=(C-k)/n,_=function(N){var E=N*m,j=qy(k),A=u/(r*w)*(j*Nz(n*E+k)-Cz(k));return[l+A*g,c+A*v,u*j/qy(n*E+k)]}}return _.duration=m*1e3*n/Math.SQRT2,_}return i.rho=function(s){var a=Math.max(.001,+s),l=a*a,c=l*l;return e(a,l,c)},i}(Math.SQRT2,2,4);var Wi=0,Fs=0,Cs=0,KC=1e3,ku,Bs,Cu=0,Lo=0,Id=0,Ma=typeof performance=="object"&&performance.now?performance:Date,qC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Fg(){return Lo||(qC(Ez),Lo=Ma.now()+Id)}function Ez(){Lo=0}function Nu(){this._call=this._time=this._next=null}Nu.prototype=Bg.prototype={constructor:Nu,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Fg():+r)+(n==null?0:+n),!this._next&&Bs!==this&&(Bs?Bs._next=this:ku=this,Bs=this),this._call=e,this._time=r,Np()},stop:function(){this._call&&(this._call=null,this._time=1/0,Np())}};function Bg(e,n,r){var o=new Nu;return o.restart(e,n,r),o}function jz(){Fg(),++Wi;for(var e=ku,n;e;)(n=Lo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Wi}function Qy(){Lo=(Cu=Ma.now())+Id,Wi=Fs=0;try{jz()}finally{Wi=0,Mz(),Lo=0}}function Pz(){var e=Ma.now(),n=e-Cu;n>KC&&(Id-=n,Cu=e)}function Mz(){for(var e,n=ku,r,o=1/0;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:ku=r);Bs=e,Np(o)}function Np(e){if(!Wi){Fs&&(Fs=clearTimeout(Fs));var n=e-Lo;n>24?(e<1/0&&(Fs=setTimeout(Qy,e-Ma.now()-Id)),Cs&&(Cs=clearInterval(Cs))):(Cs||(Cu=Ma.now(),Cs=setInterval(Pz,KC)),Wi=1,qC(Qy))}}function Zy(e,n,r){var o=new Nu;return n=n==null?0:+n,o.restart(i=>{o.stop(),e(i+n)},n,r),o}var Rz=nl("start","end","cancel","interrupt"),Az=[],QC=0,Jy=1,Ep=2,Mc=3,ex=4,jp=5,Rc=6;function Od(e,n,r,o,i,s){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;Tz(e,r,{name:n,index:o,group:i,on:Rz,tween:Az,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:QC})}function Hg(e,n){var r=yn(e,n);if(r.state>QC)throw new Error("too late; already scheduled");return r}function $n(e,n){var r=yn(e,n);if(r.state>Mc)throw new Error("too late; already running");return r}function yn(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function Tz(e,n,r){var o=e.__transition,i;o[n]=r,r.timer=Bg(s,0,r.time);function s(u){r.state=Jy,r.timer.restart(a,r.delay,r.time),r.delay<=u&&a(u-r.delay)}function a(u){var f,d,h,g;if(r.state!==Jy)return c();for(f in o)if(g=o[f],g.name===r.name){if(g.state===Mc)return Zy(a);g.state===ex?(g.state=Rc,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[f]):+f<n&&(g.state=Rc,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[f])}if(Zy(function(){r.state===Mc&&(r.state=ex,r.timer.restart(l,r.delay,r.time),l(u))}),r.state=Ep,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Ep){for(r.state=Mc,i=new Array(h=r.tween.length),f=0,d=-1;f<h;++f)(g=r.tween[f].value.call(e,e.__data__,r.index,r.group))&&(i[++d]=g);i.length=d+1}}function l(u){for(var f=u<r.duration?r.ease.call(null,u/r.duration):(r.timer.restart(c),r.state=jp,1),d=-1,h=i.length;++d<h;)i[d].call(e,f);r.state===jp&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=Rc,r.timer.stop(),delete o[n];for(var u in o)return;delete e.__transition}}function Ac(e,n){var r=e.__transition,o,i,s=!0,a;if(r){n=n==null?null:n+"";for(a in r){if((o=r[a]).name!==n){s=!1;continue}i=o.state>Ep&&o.state<jp,o.state=Rc,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete r[a]}s&&delete e.__transition}}function Iz(e){return this.each(function(){Ac(this,e)})}function Oz(e,n){var r,o;return function(){var i=$n(this,e),s=i.tween;if(s!==r){o=r=s;for(var a=0,l=o.length;a<l;++a)if(o[a].name===n){o=o.slice(),o.splice(a,1);break}}i.tween=o}}function $z(e,n,r){var o,i;if(typeof r!="function")throw new Error;return function(){var s=$n(this,e),a=s.tween;if(a!==o){i=(o=a).slice();for(var l={name:n,value:r},c=0,u=i.length;c<u;++c)if(i[c].name===n){i[c]=l;break}c===u&&i.push(l)}s.tween=i}}function Dz(e,n){var r=this._id;if(e+="",arguments.length<2){for(var o=yn(this.node(),r).tween,i=0,s=o.length,a;i<s;++i)if((a=o[i]).name===e)return a.value;return null}return this.each((n==null?Oz:$z)(r,e,n))}function Ug(e,n,r){var o=e._id;return e.each(function(){var i=$n(this,o);(i.value||(i.value={}))[n]=r.apply(this,arguments)}),function(i){return yn(i,o).value[n]}}function ZC(e,n){var r;return(typeof n=="number"?_n:n instanceof Do?Su:(r=Do(n))?(n=r,Su):GC)(e,n)}function Lz(e){return function(){this.removeAttribute(e)}}function zz(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Fz(e,n,r){var o,i=r+"",s;return function(){var a=this.getAttribute(e);return a===i?null:a===o?s:s=n(o=a,r)}}function Bz(e,n,r){var o,i=r+"",s;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===o?s:s=n(o=a,r)}}function Hz(e,n,r){var o,i,s;return function(){var a,l=r(this),c;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=l+"",a===c?null:a===o&&c===i?s:(i=c,s=n(o=a,l)))}}function Uz(e,n,r){var o,i,s;return function(){var a,l=r(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=l+"",a===c?null:a===o&&c===i?s:(i=c,s=n(o=a,l)))}}function Vz(e,n){var r=Td(e),o=r==="transform"?Sz:ZC;return this.attrTween(e,typeof n=="function"?(r.local?Uz:Hz)(r,o,Ug(this,"attr."+e,n)):n==null?(r.local?zz:Lz)(r):(r.local?Bz:Fz)(r,o,n))}function Wz(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function Gz(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function Yz(e,n){var r,o;function i(){var s=n.apply(this,arguments);return s!==o&&(r=(o=s)&&Gz(e,s)),r}return i._value=n,i}function Xz(e,n){var r,o;function i(){var s=n.apply(this,arguments);return s!==o&&(r=(o=s)&&Wz(e,s)),r}return i._value=n,i}function Kz(e,n){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;var o=Td(e);return this.tween(r,(o.local?Yz:Xz)(o,n))}function qz(e,n){return function(){Hg(this,e).delay=+n.apply(this,arguments)}}function Qz(e,n){return n=+n,function(){Hg(this,e).delay=n}}function Zz(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?qz:Qz)(n,e)):yn(this.node(),n).delay}function Jz(e,n){return function(){$n(this,e).duration=+n.apply(this,arguments)}}function e9(e,n){return n=+n,function(){$n(this,e).duration=n}}function t9(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?Jz:e9)(n,e)):yn(this.node(),n).duration}function n9(e,n){if(typeof n!="function")throw new Error;return function(){$n(this,e).ease=n}}function r9(e){var n=this._id;return arguments.length?this.each(n9(n,e)):yn(this.node(),n).ease}function o9(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;$n(this,e).ease=r}}function i9(e){if(typeof e!="function")throw new Error;return this.each(o9(this._id,e))}function s9(e){typeof e!="function"&&(e=RC(e));for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i)for(var s=n[i],a=s.length,l=o[i]=[],c,u=0;u<a;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new ar(o,this._parents,this._name,this._id)}function a9(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,r=e._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),l=0;l<s;++l)for(var c=n[l],u=r[l],f=c.length,d=a[l]=new Array(f),h,g=0;g<f;++g)(h=c[g]||u[g])&&(d[g]=h);for(;l<o;++l)a[l]=n[l];return new ar(a,this._parents,this._name,this._id)}function l9(e){return(e+"").trim().split(/^|\s+/).every(function(n){var r=n.indexOf(".");return r>=0&&(n=n.slice(0,r)),!n||n==="start"})}function c9(e,n,r){var o,i,s=l9(n)?Hg:$n;return function(){var a=s(this,e),l=a.on;l!==o&&(i=(o=l).copy()).on(n,r),a.on=i}}function u9(e,n){var r=this._id;return arguments.length<2?yn(this.node(),r).on.on(e):this.each(c9(r,e,n))}function d9(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function f9(){return this.on("end.remove",d9(this._id))}function h9(e){var n=this._name,r=this._id;typeof e!="function"&&(e=Og(e));for(var o=this._groups,i=o.length,s=new Array(i),a=0;a<i;++a)for(var l=o[a],c=l.length,u=s[a]=new Array(c),f,d,h=0;h<c;++h)(f=l[h])&&(d=e.call(f,f.__data__,h,l))&&("__data__"in f&&(d.__data__=f.__data__),u[h]=d,Od(u[h],n,r,h,u,yn(f,r)));return new ar(s,this._parents,n,r)}function p9(e){var n=this._name,r=this._id;typeof e!="function"&&(e=MC(e));for(var o=this._groups,i=o.length,s=[],a=[],l=0;l<i;++l)for(var c=o[l],u=c.length,f,d=0;d<u;++d)if(f=c[d]){for(var h=e.call(f,f.__data__,d,c),g,v=yn(f,r),b=0,_=h.length;b<_;++b)(g=h[b])&&Od(g,n,r,b,h,v);s.push(h),a.push(f)}return new ar(s,a,n,r)}var m9=tl.prototype.constructor;function g9(){return new m9(this._groups,this._parents)}function v9(e,n){var r,o,i;return function(){var s=Vi(this,e),a=(this.style.removeProperty(e),Vi(this,e));return s===a?null:s===r&&a===o?i:i=n(r=s,o=a)}}function JC(e){return function(){this.style.removeProperty(e)}}function y9(e,n,r){var o,i=r+"",s;return function(){var a=Vi(this,e);return a===i?null:a===o?s:s=n(o=a,r)}}function x9(e,n,r){var o,i,s;return function(){var a=Vi(this,e),l=r(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Vi(this,e))),a===c?null:a===o&&c===i?s:(i=c,s=n(o=a,l))}}function w9(e,n){var r,o,i,s="style."+n,a="end."+s,l;return function(){var c=$n(this,e),u=c.on,f=c.value[s]==null?l||(l=JC(n)):void 0;(u!==r||i!==f)&&(o=(r=u).copy()).on(a,i=f),c.on=o}}function b9(e,n,r){var o=(e+="")=="transform"?_z:ZC;return n==null?this.styleTween(e,v9(e,o)).on("end.style."+e,JC(e)):typeof n=="function"?this.styleTween(e,x9(e,o,Ug(this,"style."+e,n))).each(w9(this._id,e)):this.styleTween(e,y9(e,o,n),r).on("end.style."+e,null)}function _9(e,n,r){return function(o){this.style.setProperty(e,n.call(this,o),r)}}function S9(e,n,r){var o,i;function s(){var a=n.apply(this,arguments);return a!==i&&(o=(i=a)&&_9(e,a,r)),o}return s._value=n,s}function k9(e,n,r){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;return this.tween(o,S9(e,n,r??""))}function C9(e){return function(){this.textContent=e}}function N9(e){return function(){var n=e(this);this.textContent=n??""}}function E9(e){return this.tween("text",typeof e=="function"?N9(Ug(this,"text",e)):C9(e==null?"":e+""))}function j9(e){return function(n){this.textContent=e.call(this,n)}}function P9(e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&j9(i)),n}return o._value=e,o}function M9(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,P9(e))}function R9(){for(var e=this._name,n=this._id,r=eN(),o=this._groups,i=o.length,s=0;s<i;++s)for(var a=o[s],l=a.length,c,u=0;u<l;++u)if(c=a[u]){var f=yn(c,n);Od(c,e,r,u,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new ar(o,this._parents,e,r)}function A9(){var e,n,r=this,o=r._id,i=r.size();return new Promise(function(s,a){var l={value:a},c={value:function(){--i===0&&s()}};r.each(function(){var u=$n(this,o),f=u.on;f!==e&&(n=(e=f).copy(),n._.cancel.push(l),n._.interrupt.push(l),n._.end.push(c)),u.on=n}),i===0&&s()})}var T9=0;function ar(e,n,r,o){this._groups=e,this._parents=n,this._name=r,this._id=o}function eN(){return++T9}var Fn=tl.prototype;ar.prototype={constructor:ar,select:h9,selectAll:p9,selectChild:Fn.selectChild,selectChildren:Fn.selectChildren,filter:s9,merge:a9,selection:g9,transition:R9,call:Fn.call,nodes:Fn.nodes,node:Fn.node,size:Fn.size,empty:Fn.empty,each:Fn.each,on:u9,attr:Vz,attrTween:Kz,style:b9,styleTween:k9,text:E9,textTween:M9,remove:f9,tween:Dz,delay:Zz,duration:t9,ease:r9,easeVarying:i9,end:A9,[Symbol.iterator]:Fn[Symbol.iterator]};function I9(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var O9={time:null,delay:0,duration:250,ease:I9};function $9(e,n){for(var r;!(r=e.__transition)||!(r=r[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return r}function D9(e){var n,r;e instanceof ar?(n=e._id,e=e._name):(n=eN(),(r=O9).time=Fg(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,s=0;s<i;++s)for(var a=o[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&Od(c,e,n,u,a,r||$9(c,n));return new ar(o,this._parents,e,n)}tl.prototype.interrupt=Iz;tl.prototype.transition=D9;const Jl=e=>()=>e;function L9(e,{sourceEvent:n,target:r,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function qn(e,n,r){this.k=e,this.x=n,this.y=r}qn.prototype={constructor:qn,scale:function(e){return e===1?this:new qn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new qn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var $d=new qn(1,0,0);on.prototype=qn.prototype;function on(e){for(;!e.__zoom;)if(!(e=e.parentNode))return $d;return e.__zoom}function Gf(e){e.stopImmediatePropagation()}function Ns(e){e.preventDefault(),e.stopImmediatePropagation()}function z9(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function F9(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function tx(){return this.__zoom||$d}function B9(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function H9(){return navigator.maxTouchPoints||"ontouchstart"in this}function U9(e,n,r){var o=e.invertX(n[0][0])-r[0][0],i=e.invertX(n[1][0])-r[1][0],s=e.invertY(n[0][1])-r[0][1],a=e.invertY(n[1][1])-r[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function Vg(){var e=z9,n=F9,r=U9,o=B9,i=H9,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Pc,u=nl("start","zoom","end"),f,d,h,g=500,v=150,b=0,_=10;function m(P){P.property("__zoom",tx).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",j).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",T).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(P,L,I,z){var R=P.selection?P.selection():P;R.property("__zoom",tx),P!==R?k(P,L,I,z):R.interrupt().each(function(){C(this,arguments).event(z).start().zoom(null,typeof L=="function"?L.apply(this,arguments):L).end()})},m.scaleBy=function(P,L,I,z){m.scaleTo(P,function(){var R=this.__zoom.k,M=typeof L=="function"?L.apply(this,arguments):L;return R*M},I,z)},m.scaleTo=function(P,L,I,z){m.transform(P,function(){var R=n.apply(this,arguments),M=this.__zoom,O=I==null?S(R):typeof I=="function"?I.apply(this,arguments):I,V=M.invert(O),$=typeof L=="function"?L.apply(this,arguments):L;return r(y(w(M,$),O,V),R,a)},I,z)},m.translateBy=function(P,L,I,z){m.transform(P,function(){return r(this.__zoom.translate(typeof L=="function"?L.apply(this,arguments):L,typeof I=="function"?I.apply(this,arguments):I),n.apply(this,arguments),a)},null,z)},m.translateTo=function(P,L,I,z,R){m.transform(P,function(){var M=n.apply(this,arguments),O=this.__zoom,V=z==null?S(M):typeof z=="function"?z.apply(this,arguments):z;return r($d.translate(V[0],V[1]).scale(O.k).translate(typeof L=="function"?-L.apply(this,arguments):-L,typeof I=="function"?-I.apply(this,arguments):-I),M,a)},z,R)};function w(P,L){return L=Math.max(s[0],Math.min(s[1],L)),L===P.k?P:new qn(L,P.x,P.y)}function y(P,L,I){var z=L[0]-I[0]*P.k,R=L[1]-I[1]*P.k;return z===P.x&&R===P.y?P:new qn(P.k,z,R)}function S(P){return[(+P[0][0]+ +P[1][0])/2,(+P[0][1]+ +P[1][1])/2]}function k(P,L,I,z){P.on("start.zoom",function(){C(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(z).end()}).tween("zoom",function(){var R=this,M=arguments,O=C(R,M).event(z),V=n.apply(R,M),$=I==null?S(V):typeof I=="function"?I.apply(R,M):I,K=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),B=R.__zoom,U=typeof L=="function"?L.apply(R,M):L,G=c(B.invert($).concat(K/B.k),U.invert($).concat(K/U.k));return function(W){if(W===1)W=U;else{var X=G(W),q=K/X[2];W=new qn(q,$[0]-X[0]*q,$[1]-X[1]*q)}O.zoom(null,W)}})}function C(P,L,I){return!I&&P.__zooming||new N(P,L)}function N(P,L){this.that=P,this.args=L,this.active=0,this.sourceEvent=null,this.extent=n.apply(P,L),this.taps=0}N.prototype={event:function(P){return P&&(this.sourceEvent=P),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(P,L){return this.mouse&&P!=="mouse"&&(this.mouse[1]=L.invert(this.mouse[0])),this.touch0&&P!=="touch"&&(this.touch0[1]=L.invert(this.touch0[0])),this.touch1&&P!=="touch"&&(this.touch1[1]=L.invert(this.touch1[0])),this.that.__zoom=L,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(P){var L=at(this.that).datum();u.call(P,this.that,new L9(P,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:u}),L)}};function E(P,...L){if(!e.apply(this,arguments))return;var I=C(this,L).event(P),z=this.__zoom,R=Math.max(s[0],Math.min(s[1],z.k*Math.pow(2,o.apply(this,arguments)))),M=Ht(P);if(I.wheel)(I.mouse[0][0]!==M[0]||I.mouse[0][1]!==M[1])&&(I.mouse[1]=z.invert(I.mouse[0]=M)),clearTimeout(I.wheel);else{if(z.k===R)return;I.mouse=[M,z.invert(M)],Ac(this),I.start()}Ns(P),I.wheel=setTimeout(O,v),I.zoom("mouse",r(y(w(z,R),I.mouse[0],I.mouse[1]),I.extent,a));function O(){I.wheel=null,I.end()}}function j(P,...L){if(h||!e.apply(this,arguments))return;var I=P.currentTarget,z=C(this,L,!0).event(P),R=at(P.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",K,!0),M=Ht(P,I),O=P.clientX,V=P.clientY;BC(P.view),Gf(P),z.mouse=[M,this.__zoom.invert(M)],Ac(this),z.start();function $(B){if(Ns(B),!z.moved){var U=B.clientX-O,G=B.clientY-V;z.moved=U*U+G*G>b}z.event(B).zoom("mouse",r(y(z.that.__zoom,z.mouse[0]=Ht(B,I),z.mouse[1]),z.extent,a))}function K(B){R.on("mousemove.zoom mouseup.zoom",null),HC(B.view,z.moved),Ns(B),z.event(B).end()}}function A(P,...L){if(e.apply(this,arguments)){var I=this.__zoom,z=Ht(P.changedTouches?P.changedTouches[0]:P,this),R=I.invert(z),M=I.k*(P.shiftKey?.5:2),O=r(y(w(I,M),z,R),n.apply(this,L),a);Ns(P),l>0?at(this).transition().duration(l).call(k,O,z,P):at(this).call(m.transform,O,z,P)}}function T(P,...L){if(e.apply(this,arguments)){var I=P.touches,z=I.length,R=C(this,L,P.changedTouches.length===z).event(P),M,O,V,$;for(Gf(P),O=0;O<z;++O)V=I[O],$=Ht(V,this),$=[$,this.__zoom.invert($),V.identifier],R.touch0?!R.touch1&&R.touch0[2]!==$[2]&&(R.touch1=$,R.taps=0):(R.touch0=$,M=!0,R.taps=1+!!f);f&&(f=clearTimeout(f)),M&&(R.taps<2&&(d=$[0],f=setTimeout(function(){f=null},g)),Ac(this),R.start())}}function D(P,...L){if(this.__zooming){var I=C(this,L).event(P),z=P.changedTouches,R=z.length,M,O,V,$;for(Ns(P),M=0;M<R;++M)O=z[M],V=Ht(O,this),I.touch0&&I.touch0[2]===O.identifier?I.touch0[0]=V:I.touch1&&I.touch1[2]===O.identifier&&(I.touch1[0]=V);if(O=I.that.__zoom,I.touch1){var K=I.touch0[0],B=I.touch0[1],U=I.touch1[0],G=I.touch1[1],W=(W=U[0]-K[0])*W+(W=U[1]-K[1])*W,X=(X=G[0]-B[0])*X+(X=G[1]-B[1])*X;O=w(O,Math.sqrt(W/X)),V=[(K[0]+U[0])/2,(K[1]+U[1])/2],$=[(B[0]+G[0])/2,(B[1]+G[1])/2]}else if(I.touch0)V=I.touch0[0],$=I.touch0[1];else return;I.zoom("touch",r(y(O,V,$),I.extent,a))}}function F(P,...L){if(this.__zooming){var I=C(this,L).event(P),z=P.changedTouches,R=z.length,M,O;for(Gf(P),h&&clearTimeout(h),h=setTimeout(function(){h=null},g),M=0;M<R;++M)O=z[M],I.touch0&&I.touch0[2]===O.identifier?delete I.touch0:I.touch1&&I.touch1[2]===O.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(O=Ht(O,this),Math.hypot(d[0]-O[0],d[1]-O[1])<_)){var V=at(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(P){return arguments.length?(o=typeof P=="function"?P:Jl(+P),m):o},m.filter=function(P){return arguments.length?(e=typeof P=="function"?P:Jl(!!P),m):e},m.touchable=function(P){return arguments.length?(i=typeof P=="function"?P:Jl(!!P),m):i},m.extent=function(P){return arguments.length?(n=typeof P=="function"?P:Jl([[+P[0][0],+P[0][1]],[+P[1][0],+P[1][1]]]),m):n},m.scaleExtent=function(P){return arguments.length?(s[0]=+P[0],s[1]=+P[1],m):[s[0],s[1]]},m.translateExtent=function(P){return arguments.length?(a[0][0]=+P[0][0],a[1][0]=+P[1][0],a[0][1]=+P[0][1],a[1][1]=+P[1][1],m):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},m.constrain=function(P){return arguments.length?(r=P,m):r},m.duration=function(P){return arguments.length?(l=+P,m):l},m.interpolate=function(P){return arguments.length?(c=P,m):c},m.on=function(){var P=u.on.apply(u,arguments);return P===u?m:P},m.clickDistance=function(P){return arguments.length?(b=(P=+P)*P,m):Math.sqrt(b)},m.tapDistance=function(P){return arguments.length?(_=+P,m):_},m}class nx extends Map{constructor(n,r=G9){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),n!=null)for(const[o,i]of n)this.set(o,i)}get(n){return super.get(rx(this,n))}has(n){return super.has(rx(this,n))}set(n,r){return super.set(V9(this,n),r)}delete(n){return super.delete(W9(this,n))}}function rx({_intern:e,_key:n},r){const o=n(r);return e.has(o)?e.get(o):r}function V9({_intern:e,_key:n},r){const o=n(r);return e.has(o)?e.get(o):(e.set(o,r),r)}function W9({_intern:e,_key:n},r){const o=n(r);return e.has(o)&&(r=e.get(o),e.delete(o)),r}function G9(e){return e!==null&&typeof e=="object"?e.valueOf():e}function ox(e,n){let r;if(n===void 0)for(const o of e)o!=null&&(r<o||r===void 0&&o>=o)&&(r=o);else{let o=-1;for(let i of e)(i=n(i,++o,e))!=null&&(r<i||r===void 0&&i>=i)&&(r=i)}return r}function ix(e,n){let r;if(n===void 0)for(const o of e)o!=null&&(r>o||r===void 0&&o>=o)&&(r=o);else{let o=-1;for(let i of e)(i=n(i,++o,e))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}function Y9(e,n){let r=0;for(let o of e)(o=+o)&&(r+=o);return r}var X9=typeof global=="object"&&global&&global.Object===Object&&global,K9=typeof self=="object"&&self&&self.Object===Object&&self,tN=X9||K9||Function("return this")(),Eu=tN.Symbol,nN=Object.prototype,q9=nN.hasOwnProperty,Q9=nN.toString,Es=Eu?Eu.toStringTag:void 0;function Z9(e){var n=q9.call(e,Es),r=e[Es];try{e[Es]=void 0;var o=!0}catch{}var i=Q9.call(e);return o&&(n?e[Es]=r:delete e[Es]),i}var J9=Object.prototype,eF=J9.toString;function tF(e){return eF.call(e)}var nF="[object Null]",rF="[object Undefined]",sx=Eu?Eu.toStringTag:void 0;function oF(e){return e==null?e===void 0?rF:nF:sx&&sx in Object(e)?Z9(e):tF(e)}function iF(e){return e!=null&&typeof e=="object"}var sF="[object Symbol]";function aF(e){return typeof e=="symbol"||iF(e)&&oF(e)==sF}var lF=/\s/;function cF(e){for(var n=e.length;n--&&lF.test(e.charAt(n)););return n}var uF=/^\s+/;function dF(e){return e&&e.slice(0,cF(e)+1).replace(uF,"")}function ju(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var ax=NaN,fF=/^[-+]0x[0-9a-f]+$/i,hF=/^0b[01]+$/i,pF=/^0o[0-7]+$/i,mF=parseInt;function lx(e){if(typeof e=="number")return e;if(aF(e))return ax;if(ju(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=ju(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=dF(e);var r=hF.test(e);return r||pF.test(e)?mF(e.slice(2),r?2:8):fF.test(e)?ax:+e}var Yf=function(){return tN.Date.now()},gF="Expected a function",vF=Math.max,yF=Math.min;function rN(e,n,r){var o,i,s,a,l,c,u=0,f=!1,d=!1,h=!0;if(typeof e!="function")throw new TypeError(gF);n=lx(n)||0,ju(r)&&(f=!!r.leading,d="maxWait"in r,s=d?vF(lx(r.maxWait)||0,n):s,h="trailing"in r?!!r.trailing:h);function g(C){var N=o,E=i;return o=i=void 0,u=C,a=e.apply(E,N),a}function v(C){return u=C,l=setTimeout(m,n),f?g(C):a}function b(C){var N=C-c,E=C-u,j=n-N;return d?yF(j,s-E):j}function _(C){var N=C-c,E=C-u;return c===void 0||N>=n||N<0||d&&E>=s}function m(){var C=Yf();if(_(C))return w(C);l=setTimeout(m,b(C))}function w(C){return l=void 0,h&&o?g(C):(o=i=void 0,a)}function y(){l!==void 0&&clearTimeout(l),u=0,o=c=i=l=void 0}function S(){return l===void 0?a:w(Yf())}function k(){var C=Yf(),N=_(C);if(o=arguments,i=this,c=C,N){if(l===void 0)return v(c);if(d)return clearTimeout(l),l=setTimeout(m,n),g(c)}return l===void 0&&(l=setTimeout(m,n)),a}return k.cancel=y,k.flush=S,k}var xF="Expected a function";function wF(e,n,r){var o=!0,i=!0;if(typeof e!="function")throw new TypeError(xF);return ju(r)&&(o="leading"in r?!!r.leading:o,i="trailing"in r?!!r.trailing:i),rN(e,n,{leading:o,maxWait:n,trailing:i})}var Co=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Co.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?Co.Bounce.In(e*2)*.5:Co.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),Hs=function(){return performance.now()},oN=function(){function e(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,n)}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(r){return n._tweens[r]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var n,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];for(var i=0,s=r;i<s.length;i++){var a=s[i];(n=a._group)===null||n===void 0||n.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},e.prototype.remove=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var o=0,i=n;o<i.length;o++){var s=i[o];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(n){return!n.isPlaying()})},e.prototype.update=function(n,r){n===void 0&&(n=Hs()),r===void 0&&(r=!0);var o=Object.keys(this._tweens);if(o.length!==0)for(;o.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<o.length;i++){var s=this._tweens[o[i]],a=!r;s&&s.update(n,a)===!1&&!r&&this.remove(s)}o=Object.keys(this._tweensAddedDuringUpdate)}},e}(),Pp={Linear:function(e,n){var r=e.length-1,o=r*n,i=Math.floor(o),s=Pp.Utils.Linear;return n<0?s(e[0],e[1],o):n>1?s(e[r],e[r-1],r-o):s(e[i],e[i+1>r?r:i+1],o-i)},Utils:{Linear:function(e,n,r){return(n-e)*r+e}}},iN=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Mp=new oN,cx=function(){function e(n,r){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Co.Linear.None,this._interpolationFunction=Pp.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=iN.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=n,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=Mp,Mp.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(n,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,r){if(n===void 0&&(n=Hs()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var o in this._valuesStartRepeat)this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var s in this._valuesEnd)i[s]=this._valuesEnd[s];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,r,o,i,s){for(var a in o){var l=n[a],c=Array.isArray(l),u=c?"array":typeof l,f=!c&&Array.isArray(o[a]);if(!(u==="undefined"||u==="function")){if(f){var d=o[a];if(d.length===0)continue;for(var h=[l],g=0,v=d.length;g<v;g+=1){var b=this._handleRelativeValue(l,d[g]);if(isNaN(b)){f=!1,console.warn("Found invalid interpolation list. Skipping.");break}h.push(b)}f&&(o[a]=h)}if((u==="object"||c)&&l&&!f){r[a]=c?[]:{};var _=l;for(var m in _)r[a][m]=_[m];i[a]=c?[]:{};var d=o[a];if(!this._isDynamic){var w={};for(var m in d)w[m]=d[m];o[a]=d=w}this._setupProperties(_,r[a],d,i[a],s)}else(typeof r[a]>"u"||s)&&(r[a]=l),c||(r[a]*=1),f?i[a]=o[a].slice().reverse():i[a]=r[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(n){return n===void 0&&(n=Hs()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this)},e.prototype.resume=function(n){return n===void 0&&(n=Hs()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var n=0,r=this._chainedTweens.length;n<r;n++)this._chainedTweens[n].stop();return this},e.prototype.group=function(n){return n?(n.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var n;return(n=this._group)===null||n===void 0||n.remove(this),this},e.prototype.delay=function(n){return n===void 0&&(n=0),this._delayTime=n,this},e.prototype.repeat=function(n){return n===void 0&&(n=0),this._initialRepeat=n,this._repeat=n,this},e.prototype.repeatDelay=function(n){return this._repeatDelayTime=n,this},e.prototype.yoyo=function(n){return n===void 0&&(n=!1),this._yoyo=n,this},e.prototype.easing=function(n){return n===void 0&&(n=Co.Linear.None),this._easingFunction=n,this},e.prototype.interpolation=function(n){return n===void 0&&(n=Pp.Linear),this._interpolationFunction=n,this},e.prototype.chain=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return this._chainedTweens=n,this},e.prototype.onStart=function(n){return this._onStartCallback=n,this},e.prototype.onEveryStart=function(n){return this._onEveryStartCallback=n,this},e.prototype.onUpdate=function(n){return this._onUpdateCallback=n,this},e.prototype.onRepeat=function(n){return this._onRepeatCallback=n,this},e.prototype.onComplete=function(n){return this._onCompleteCallback=n,this},e.prototype.onStop=function(n){return this._onStopCallback=n,this},e.prototype.update=function(n,r){var o=this,i;if(n===void 0&&(n=Hs()),r===void 0&&(r=e.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(r)this.start(n,!0);else return!1;if(this._goToEnd=!1,n<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=n-this._startTime,l=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),c=this._duration+this._repeat*l,u=function(){if(o._duration===0||a>c)return 1;var b=Math.trunc(a/l),_=a-b*l,m=Math.min(_/o._duration,1);return m===0&&a===o._duration?1:m},f=u(),d=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,d),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||a>=this._duration)if(this._repeat>0){var h=Math.min(Math.trunc((a-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=h);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*h,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var g=0,v=this._chainedTweens.length;g<v;g++)this._chainedTweens[g].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(n,r,o,i){for(var s in o)if(r[s]!==void 0){var a=r[s]||0,l=o[s],c=Array.isArray(n[s]),u=Array.isArray(l),f=!c&&u;f?n[s]=this._interpolationFunction(l,i):typeof l=="object"&&l?this._updateProperties(n[s],a,l,i):(l=this._handleRelativeValue(a,l),typeof l=="number"&&(n[s]=a+(l-a)*i))}},e.prototype._handleRelativeValue=function(n,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?n+parseFloat(r):parseFloat(r)},e.prototype._swapEndStartRepeatValues=function(n){var r=this._valuesStartRepeat[n],o=this._valuesEnd[n];typeof o=="string"?this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(o):this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=r},e.autoStartOnUpdate=!1,e}();iN.nextId;var Tn=Mp;Tn.getAll.bind(Tn);Tn.removeAll.bind(Tn);Tn.add.bind(Tn);Tn.remove.bind(Tn);Tn.update.bind(Tn);function ux(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function bF(e){if(Array.isArray(e))return e}function _F(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function SF(e,n,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function kF(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,s,a,l=[],c=!0,u=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(o=s.call(r)).done)&&(l.push(o.value),l.length!==n);c=!0);}catch(f){u=!0,i=f}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function CF(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
384
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NF(e,n){return bF(e)||kF(e,n)||EF(e,n)||CF()}function EF(e,n){if(e){if(typeof e=="string")return ux(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ux(e,n):void 0}}var jF=SF(function e(n,r){var o=r.default,i=o===void 0?null:o,s=r.triggerUpdate,a=s===void 0?!0:s,l=r.onChange,c=l===void 0?function(u,f){}:l;_F(this,e),this.name=n,this.defaultVal=i,this.triggerUpdate=a,this.onChange=c});function Wg(e){var n=e.stateInit,r=n===void 0?function(){return{}}:n,o=e.props,i=o===void 0?{}:o,s=e.methods,a=s===void 0?{}:s,l=e.aliases,c=l===void 0?{}:l,u=e.init,f=u===void 0?function(){}:u,d=e.update,h=d===void 0?function(){}:d,g=Object.keys(i).map(function(v){return new jF(v,i[v])});return function v(){for(var b=arguments.length,_=new Array(b),m=0;m<b;m++)_[m]=arguments[m];var w=!!(this instanceof v&&this.constructor),y=w?_.shift():void 0,S=_[0],k=S===void 0?{}:S,C=Object.assign({},r instanceof Function?r(k):r,{initialised:!1}),N={};function E(T){return j(T,k),A(),E}var j=function(D,F){f.call(E,D,C,F),C.initialised=!0},A=rN(function(){C.initialised&&(h.call(E,C,N),N={})},1);return g.forEach(function(T){E[T.name]=D(T);function D(F){var P=F.name,L=F.triggerUpdate,I=L===void 0?!1:L,z=F.onChange,R=z===void 0?function(V,$){}:z,M=F.defaultVal,O=M===void 0?null:M;return function(V){var $=C[P];if(!arguments.length)return $;var K=V===void 0?O:V;return C[P]=K,R.call(E,K,C,$),!N.hasOwnProperty(P)&&(N[P]=$),I&&A(),E}}}),Object.keys(a).forEach(function(T){E[T]=function(){for(var D,F=arguments.length,P=new Array(F),L=0;L<F;L++)P[L]=arguments[L];return(D=a[T]).call.apply(D,[E,C].concat(P))}}),Object.entries(c).forEach(function(T){var D=NF(T,2),F=D[0],P=D[1];return E[F]=E[P]}),E.resetProps=function(){return g.forEach(function(T){E[T.name](T.defaultVal)}),E},E.resetProps(),C._rerender=A,w&&y&&E(y),E}}var _e=function(e){return typeof e=="function"?e:typeof e=="string"?function(n){return n[e]}:function(n){return e}};function Pu(e){"@babel/helpers - typeof";return Pu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Pu(e)}var PF=/^\s+/,MF=/\s+$/;function le(e,n){if(e=e||"",n=n||{},e instanceof le)return e;if(!(this instanceof le))return new le(e,n);var r=RF(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=n.format||r.format,this._gradientType=n.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}le.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var n=this.toRgb();return(n.r*299+n.g*587+n.b*114)/1e3},getLuminance:function(){var n=this.toRgb(),r,o,i,s,a,l;return r=n.r/255,o=n.g/255,i=n.b/255,r<=.03928?s=r/12.92:s=Math.pow((r+.055)/1.055,2.4),o<=.03928?a=o/12.92:a=Math.pow((o+.055)/1.055,2.4),i<=.03928?l=i/12.92:l=Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*a+.0722*l},setAlpha:function(n){return this._a=sN(n),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var n=fx(this._r,this._g,this._b);return{h:n.h*360,s:n.s,v:n.v,a:this._a}},toHsvString:function(){var n=fx(this._r,this._g,this._b),r=Math.round(n.h*360),o=Math.round(n.s*100),i=Math.round(n.v*100);return this._a==1?"hsv("+r+", "+o+"%, "+i+"%)":"hsva("+r+", "+o+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var n=dx(this._r,this._g,this._b);return{h:n.h*360,s:n.s,l:n.l,a:this._a}},toHslString:function(){var n=dx(this._r,this._g,this._b),r=Math.round(n.h*360),o=Math.round(n.s*100),i=Math.round(n.l*100);return this._a==1?"hsl("+r+", "+o+"%, "+i+"%)":"hsla("+r+", "+o+"%, "+i+"%, "+this._roundA+")"},toHex:function(n){return hx(this._r,this._g,this._b,n)},toHexString:function(n){return"#"+this.toHex(n)},toHex8:function(n){return OF(this._r,this._g,this._b,this._a,n)},toHex8String:function(n){return"#"+this.toHex8(n)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Me(this._r,255)*100)+"%",g:Math.round(Me(this._g,255)*100)+"%",b:Math.round(Me(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Me(this._r,255)*100)+"%, "+Math.round(Me(this._g,255)*100)+"%, "+Math.round(Me(this._b,255)*100)+"%)":"rgba("+Math.round(Me(this._r,255)*100)+"%, "+Math.round(Me(this._g,255)*100)+"%, "+Math.round(Me(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:YF[hx(this._r,this._g,this._b,!0)]||!1},toFilter:function(n){var r="#"+px(this._r,this._g,this._b,this._a),o=r,i=this._gradientType?"GradientType = 1, ":"";if(n){var s=le(n);o="#"+px(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+r+",endColorstr="+o+")"},toString:function(n){var r=!!n;n=n||this._format;var o=!1,i=this._a<1&&this._a>=0,s=!r&&i&&(n==="hex"||n==="hex6"||n==="hex3"||n==="hex4"||n==="hex8"||n==="name");return s?n==="name"&&this._a===0?this.toName():this.toRgbString():(n==="rgb"&&(o=this.toRgbString()),n==="prgb"&&(o=this.toPercentageRgbString()),(n==="hex"||n==="hex6")&&(o=this.toHexString()),n==="hex3"&&(o=this.toHexString(!0)),n==="hex4"&&(o=this.toHex8String(!0)),n==="hex8"&&(o=this.toHex8String()),n==="name"&&(o=this.toName()),n==="hsl"&&(o=this.toHslString()),n==="hsv"&&(o=this.toHsvString()),o||this.toHexString())},clone:function(){return le(this.toString())},_applyModification:function(n,r){var o=n.apply(null,[this].concat([].slice.call(r)));return this._r=o._r,this._g=o._g,this._b=o._b,this.setAlpha(o._a),this},lighten:function(){return this._applyModification(zF,arguments)},brighten:function(){return this._applyModification(FF,arguments)},darken:function(){return this._applyModification(BF,arguments)},desaturate:function(){return this._applyModification($F,arguments)},saturate:function(){return this._applyModification(DF,arguments)},greyscale:function(){return this._applyModification(LF,arguments)},spin:function(){return this._applyModification(HF,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(WF,arguments)},complement:function(){return this._applyCombination(UF,arguments)},monochromatic:function(){return this._applyCombination(GF,arguments)},splitcomplement:function(){return this._applyCombination(VF,arguments)},triad:function(){return this._applyCombination(mx,[3])},tetrad:function(){return this._applyCombination(mx,[4])}};le.fromRatio=function(e,n){if(Pu(e)=="object"){var r={};for(var o in e)e.hasOwnProperty(o)&&(o==="a"?r[o]=e[o]:r[o]=Us(e[o]));e=r}return le(e,n)};function RF(e){var n={r:0,g:0,b:0},r=1,o=null,i=null,s=null,a=!1,l=!1;return typeof e=="string"&&(e=QF(e)),Pu(e)=="object"&&(Bn(e.r)&&Bn(e.g)&&Bn(e.b)?(n=AF(e.r,e.g,e.b),a=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Bn(e.h)&&Bn(e.s)&&Bn(e.v)?(o=Us(e.s),i=Us(e.v),n=IF(e.h,o,i),a=!0,l="hsv"):Bn(e.h)&&Bn(e.s)&&Bn(e.l)&&(o=Us(e.s),s=Us(e.l),n=TF(e.h,o,s),a=!0,l="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=sN(r),{ok:a,format:e.format||l,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:r}}function AF(e,n,r){return{r:Me(e,255)*255,g:Me(n,255)*255,b:Me(r,255)*255}}function dx(e,n,r){e=Me(e,255),n=Me(n,255),r=Me(r,255);var o=Math.max(e,n,r),i=Math.min(e,n,r),s,a,l=(o+i)/2;if(o==i)s=a=0;else{var c=o-i;switch(a=l>.5?c/(2-o-i):c/(o+i),o){case e:s=(n-r)/c+(n<r?6:0);break;case n:s=(r-e)/c+2;break;case r:s=(e-n)/c+4;break}s/=6}return{h:s,s:a,l}}function TF(e,n,r){var o,i,s;e=Me(e,360),n=Me(n,100),r=Me(r,100);function a(u,f,d){return d<0&&(d+=1),d>1&&(d-=1),d<1/6?u+(f-u)*6*d:d<1/2?f:d<2/3?u+(f-u)*(2/3-d)*6:u}if(n===0)o=i=s=r;else{var l=r<.5?r*(1+n):r+n-r*n,c=2*r-l;o=a(c,l,e+1/3),i=a(c,l,e),s=a(c,l,e-1/3)}return{r:o*255,g:i*255,b:s*255}}function fx(e,n,r){e=Me(e,255),n=Me(n,255),r=Me(r,255);var o=Math.max(e,n,r),i=Math.min(e,n,r),s,a,l=o,c=o-i;if(a=o===0?0:c/o,o==i)s=0;else{switch(o){case e:s=(n-r)/c+(n<r?6:0);break;case n:s=(r-e)/c+2;break;case r:s=(e-n)/c+4;break}s/=6}return{h:s,s:a,v:l}}function IF(e,n,r){e=Me(e,360)*6,n=Me(n,100),r=Me(r,100);var o=Math.floor(e),i=e-o,s=r*(1-n),a=r*(1-i*n),l=r*(1-(1-i)*n),c=o%6,u=[r,a,s,s,l,r][c],f=[l,r,r,a,s,s][c],d=[s,s,l,r,r,a][c];return{r:u*255,g:f*255,b:d*255}}function hx(e,n,r,o){var i=[cn(Math.round(e).toString(16)),cn(Math.round(n).toString(16)),cn(Math.round(r).toString(16))];return o&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function OF(e,n,r,o,i){var s=[cn(Math.round(e).toString(16)),cn(Math.round(n).toString(16)),cn(Math.round(r).toString(16)),cn(aN(o))];return i&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function px(e,n,r,o){var i=[cn(aN(o)),cn(Math.round(e).toString(16)),cn(Math.round(n).toString(16)),cn(Math.round(r).toString(16))];return i.join("")}le.equals=function(e,n){return!e||!n?!1:le(e).toRgbString()==le(n).toRgbString()};le.random=function(){return le.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function $F(e,n){n=n===0?0:n||10;var r=le(e).toHsl();return r.s-=n/100,r.s=Dd(r.s),le(r)}function DF(e,n){n=n===0?0:n||10;var r=le(e).toHsl();return r.s+=n/100,r.s=Dd(r.s),le(r)}function LF(e){return le(e).desaturate(100)}function zF(e,n){n=n===0?0:n||10;var r=le(e).toHsl();return r.l+=n/100,r.l=Dd(r.l),le(r)}function FF(e,n){n=n===0?0:n||10;var r=le(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(n/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(n/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(n/100)))),le(r)}function BF(e,n){n=n===0?0:n||10;var r=le(e).toHsl();return r.l-=n/100,r.l=Dd(r.l),le(r)}function HF(e,n){var r=le(e).toHsl(),o=(r.h+n)%360;return r.h=o<0?360+o:o,le(r)}function UF(e){var n=le(e).toHsl();return n.h=(n.h+180)%360,le(n)}function mx(e,n){if(isNaN(n)||n<=0)throw new Error("Argument to polyad must be a positive number");for(var r=le(e).toHsl(),o=[le(e)],i=360/n,s=1;s<n;s++)o.push(le({h:(r.h+s*i)%360,s:r.s,l:r.l}));return o}function VF(e){var n=le(e).toHsl(),r=n.h;return[le(e),le({h:(r+72)%360,s:n.s,l:n.l}),le({h:(r+216)%360,s:n.s,l:n.l})]}function WF(e,n,r){n=n||6,r=r||30;var o=le(e).toHsl(),i=360/r,s=[le(e)];for(o.h=(o.h-(i*n>>1)+720)%360;--n;)o.h=(o.h+i)%360,s.push(le(o));return s}function GF(e,n){n=n||6;for(var r=le(e).toHsv(),o=r.h,i=r.s,s=r.v,a=[],l=1/n;n--;)a.push(le({h:o,s:i,v:s})),s=(s+l)%1;return a}le.mix=function(e,n,r){r=r===0?0:r||50;var o=le(e).toRgb(),i=le(n).toRgb(),s=r/100,a={r:(i.r-o.r)*s+o.r,g:(i.g-o.g)*s+o.g,b:(i.b-o.b)*s+o.b,a:(i.a-o.a)*s+o.a};return le(a)};le.readability=function(e,n){var r=le(e),o=le(n);return(Math.max(r.getLuminance(),o.getLuminance())+.05)/(Math.min(r.getLuminance(),o.getLuminance())+.05)};le.isReadable=function(e,n,r){var o=le.readability(e,n),i,s;switch(s=!1,i=ZF(r),i.level+i.size){case"AAsmall":case"AAAlarge":s=o>=4.5;break;case"AAlarge":s=o>=3;break;case"AAAsmall":s=o>=7;break}return s};le.mostReadable=function(e,n,r){var o=null,i=0,s,a,l,c;r=r||{},a=r.includeFallbackColors,l=r.level,c=r.size;for(var u=0;u<n.length;u++)s=le.readability(e,n[u]),s>i&&(i=s,o=le(n[u]));return le.isReadable(e,o,{level:l,size:c})||!a?o:(r.includeFallbackColors=!1,le.mostReadable(e,["#fff","#000"],r))};var Rp=le.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},YF=le.hexNames=XF(Rp);function XF(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function sN(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Me(e,n){KF(e)&&(e="100%");var r=qF(e);return e=Math.min(n,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*n,10)/100),Math.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function Dd(e){return Math.min(1,Math.max(0,e))}function jt(e){return parseInt(e,16)}function KF(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function qF(e){return typeof e=="string"&&e.indexOf("%")!=-1}function cn(e){return e.length==1?"0"+e:""+e}function Us(e){return e<=1&&(e=e*100+"%"),e}function aN(e){return Math.round(parseFloat(e)*255).toString(16)}function gx(e){return jt(e)/255}var tn=function(){var e="[-\\+]?\\d+%?",n="[-\\+]?\\d*\\.\\d+%?",r="(?:"+n+")|(?:"+e+")",o="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+o),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+o),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+o),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Bn(e){return!!tn.CSS_UNIT.exec(e)}function QF(e){e=e.replace(PF,"").replace(MF,"").toLowerCase();var n=!1;if(Rp[e])e=Rp[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=tn.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=tn.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=tn.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=tn.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=tn.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=tn.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=tn.hex8.exec(e))?{r:jt(r[1]),g:jt(r[2]),b:jt(r[3]),a:gx(r[4]),format:n?"name":"hex8"}:(r=tn.hex6.exec(e))?{r:jt(r[1]),g:jt(r[2]),b:jt(r[3]),format:n?"name":"hex"}:(r=tn.hex4.exec(e))?{r:jt(r[1]+""+r[1]),g:jt(r[2]+""+r[2]),b:jt(r[3]+""+r[3]),a:gx(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=tn.hex3.exec(e))?{r:jt(r[1]+""+r[1]),g:jt(r[2]+""+r[2]),b:jt(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function ZF(e){var n,r;return e=e||{level:"AA",size:"small"},n=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),n!=="AA"&&n!=="AAA"&&(n="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:n,size:r}}function Ap(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function JF(e){if(Array.isArray(e))return Ap(e)}function lN(e,n,r){if(typeof e=="function"?e===n:e.has(n))return arguments.length<3?n:r;throw new TypeError("Private element is not present on this object")}function e7(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function t7(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function zt(e,n){return e.get(lN(e,n))}function vx(e,n,r){e7(e,n),n.set(e,r)}function yx(e,n,r){return e.set(lN(e,n),r),r}function n7(e,n){for(var r=0;r<n.length;r++){var o=n[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,l7(o.key),o)}}function r7(e,n,r){return n&&n7(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function o7(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i7(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
385
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s7(e){return JF(e)||o7(e)||c7(e)||i7()}function a7(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function l7(e){var n=a7(e,"string");return typeof n=="symbol"?n:n+""}function c7(e,n){if(e){if(typeof e=="string")return Ap(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ap(e,n):void 0}}var u7=123,d7=function(n){return"#".concat(Math.min(n,Math.pow(2,24)).toString(16).padStart(6,"0"))},cN=function(n,r,o){return(n<<16)+(r<<8)+o},f7=function(n){var r=le(n).toRgb(),o=r.r,i=r.g,s=r.b;return cN(o,i,s)},xx=function(n,r){return n*u7%Math.pow(2,r)},ho=new WeakMap,Hn=new WeakMap,h7=function(){function e(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:6;t7(this,e),vx(this,ho,void 0),vx(this,Hn,void 0),yx(Hn,this,n),this.reset()}return r7(e,[{key:"reset",value:function(){yx(ho,this,["__reserved for background__"])}},{key:"register",value:function(r){if(zt(ho,this).length>=Math.pow(2,24-zt(Hn,this)))return null;var o=zt(ho,this).length,i=xx(o,zt(Hn,this)),s=d7(o+(i<<24-zt(Hn,this)));return zt(ho,this).push(r),s}},{key:"lookup",value:function(r){if(!r)return null;var o=typeof r=="string"?f7(r):cN.apply(void 0,s7(r));if(!o)return null;var i=o&Math.pow(2,24-zt(Hn,this))-1,s=o>>24-zt(Hn,this)&Math.pow(2,zt(Hn,this))-1;return xx(i,zt(Hn,this))!==s||i>=zt(ho,this).length?null:zt(ho,this)[i]}}])}(),ol,Ae,uN,dN,Cr,wx,fN,hN,Xf,Tc,ea,pN,Gg,Tp,Ip,Mu={},Ru=[],p7=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ld=Array.isArray;function Nn(e,n){for(var r in n)e[r]=n[r];return e}function Yg(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function m7(e,n,r){var o,i,s,a={};for(s in n)s=="key"?o=n[s]:s=="ref"?i=n[s]:a[s]=n[s];if(arguments.length>2&&(a.children=arguments.length>3?ol.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)a[s]===void 0&&(a[s]=e.defaultProps[s]);return ta(e,a,o,i,null)}function ta(e,n,r,o,i){var s={type:e,props:n,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++uN,__i:-1,__u:0};return i==null&&Ae.vnode!=null&&Ae.vnode(s),s}function zd(e){return e.children}function Ic(e,n){this.props=e,this.context=n}function Gi(e,n){if(n==null)return e.__?Gi(e.__,e.__i+1):null;for(var r;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Gi(e):null}function g7(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,o=[],i=[],s=Nn({},n);s.__v=n.__v+1,Ae.vnode&&Ae.vnode(s),Xg(e.__P,s,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,o,r??Gi(n),!!(32&n.__u),i),s.__v=n.__v,s.__.__k[s.__i]=s,yN(o,s,i),n.__e=n.__=null,s.__e!=r&&mN(s)}}function mN(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),mN(e)}function bx(e){(!e.__d&&(e.__d=!0)&&Cr.push(e)&&!Au.__r++||wx!=Ae.debounceRendering)&&((wx=Ae.debounceRendering)||fN)(Au)}function Au(){try{for(var e,n=1;Cr.length;)Cr.length>n&&Cr.sort(hN),e=Cr.shift(),n=Cr.length,g7(e)}finally{Cr.length=Au.__r=0}}function gN(e,n,r,o,i,s,a,l,c,u,f){var d,h,g,v,b,_,m,w=o&&o.__k||Ru,y=n.length;for(c=v7(r,n,w,c,y),d=0;d<y;d++)(g=r.__k[d])!=null&&(h=g.__i!=-1&&w[g.__i]||Mu,g.__i=d,_=Xg(e,g,h,i,s,a,l,c,u,f),v=g.__e,g.ref&&h.ref!=g.ref&&(h.ref&&Kg(h.ref,null,g),f.push(g.ref,g.__c||v,g)),b==null&&v!=null&&(b=v),(m=!!(4&g.__u))||h.__k===g.__k?(c=vN(g,c,e,m),m&&h.__e&&(h.__e=null)):typeof g.type=="function"&&_!==void 0?c=_:v&&(c=v.nextSibling),g.__u&=-7);return r.__e=b,c}function v7(e,n,r,o,i){var s,a,l,c,u,f=r.length,d=f,h=0;for(e.__k=new Array(i),s=0;s<i;s++)(a=n[s])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[s]=ta(null,a,null,null,null):Ld(a)?a=e.__k[s]=ta(zd,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[s]=ta(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[s]=a,c=s+h,a.__=e,a.__b=e.__b+1,l=null,(u=a.__i=y7(a,r,c,d))!=-1&&(d--,(l=r[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(i>f?h--:i<f&&h++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?h--:u==c+1?h++:(u>c?h--:h++,a.__u|=4))):e.__k[s]=null;if(d)for(s=0;s<f;s++)(l=r[s])!=null&&!(2&l.__u)&&(l.__e==o&&(o=Gi(l)),wN(l,l));return o}function vN(e,n,r,o){var i,s;if(typeof e.type=="function"){for(i=e.__k,s=0;i&&s<i.length;s++)i[s]&&(i[s].__=e,n=vN(i[s],n,r,o));return n}e.__e!=n&&(o&&(n&&e.type&&!n.parentNode&&(n=Gi(e)),r.insertBefore(e.__e,n||null)),n=e.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function y7(e,n,r,o){var i,s,a,l=e.key,c=e.type,u=n[r],f=u!=null&&(2&u.__u)==0;if(u===null&&l==null||f&&l==u.key&&c==u.type)return r;if(o>(f?1:0)){for(i=r-1,s=r+1;i>=0||s<n.length;)if((u=n[a=i>=0?i--:s++])!=null&&!(2&u.__u)&&l==u.key&&c==u.type)return a}return-1}function _x(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||p7.test(n)?r:r+"px"}function ec(e,n,r,o,i){var s,a;e:if(n=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(n in o)r&&n in r||_x(e.style,n,"");if(r)for(n in r)o&&r[n]==o[n]||_x(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")s=n!=(n=n.replace(pN,"$1")),a=n.toLowerCase(),n=a in e||n=="onFocusOut"||n=="onFocusIn"?a.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+s]=r,r?o?r[ea]=o[ea]:(r[ea]=Gg,e.addEventListener(n,s?Ip:Tp,s)):e.removeEventListener(n,s?Ip:Tp,s);else{if(i=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&r==1?"":r))}}function Sx(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[Tc]==null)n[Tc]=Gg++;else if(n[Tc]<r[ea])return;return r(Ae.event?Ae.event(n):n)}}}function Xg(e,n,r,o,i,s,a,l,c,u){var f,d,h,g,v,b,_,m,w,y,S,k,C,N,E,j=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(c=!!(32&r.__u),s=[l=n.__e=r.__e]),(f=Ae.__b)&&f(n);e:if(typeof j=="function")try{if(m=n.props,w=j.prototype&&j.prototype.render,y=(f=j.contextType)&&o[f.__c],S=f?y?y.props.value:f.__:o,r.__c?_=(d=n.__c=r.__c).__=d.__E:(w?n.__c=d=new j(m,S):(n.__c=d=new Ic(m,S),d.constructor=j,d.render=w7),y&&y.sub(d),d.state||(d.state={}),d.__n=o,h=d.__d=!0,d.__h=[],d._sb=[]),w&&d.__s==null&&(d.__s=d.state),w&&j.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Nn({},d.__s)),Nn(d.__s,j.getDerivedStateFromProps(m,d.__s))),g=d.props,v=d.state,d.__v=n,h)w&&j.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),w&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(w&&j.getDerivedStateFromProps==null&&m!==g&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(m,S),n.__v==r.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(m,d.__s,S)===!1){n.__v!=r.__v&&(d.props=m,d.state=d.__s,d.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(A){A&&(A.__=n)}),Ru.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(m,d.__s,S),w&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(g,v,b)})}if(d.context=S,d.props=m,d.__P=e,d.__e=!1,k=Ae.__r,C=0,w)d.state=d.__s,d.__d=!1,k&&k(n),f=d.render(d.props,d.state,d.context),Ru.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,k&&k(n),f=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++C<25);d.state=d.__s,d.getChildContext!=null&&(o=Nn(Nn({},o),d.getChildContext())),w&&!h&&d.getSnapshotBeforeUpdate!=null&&(b=d.getSnapshotBeforeUpdate(g,v)),N=f!=null&&f.type===zd&&f.key==null?xN(f.props.children):f,l=gN(e,Ld(N)?N:[N],n,r,o,i,s,a,l,c,u),d.base=n.__e,n.__u&=-161,d.__h.length&&a.push(d),_&&(d.__E=d.__=null)}catch(A){if(n.__v=null,c||s!=null)if(A.then){for(n.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;s[s.indexOf(l)]=null,n.__e=l}else{for(E=s.length;E--;)Yg(s[E]);Op(n)}else n.__e=r.__e,n.__k=r.__k,A.then||Op(n);Ae.__e(A,n,r)}else s==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):l=n.__e=x7(r.__e,n,r,o,i,s,a,c,u);return(f=Ae.diffed)&&f(n),128&n.__u?void 0:l}function Op(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Op))}function yN(e,n,r){for(var o=0;o<r.length;o++)Kg(r[o],r[++o],r[++o]);Ae.__c&&Ae.__c(n,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(s){s.call(i)})}catch(s){Ae.__e(s,i.__v)}})}function xN(e){return typeof e!="object"||e==null||e.__b>0?e:Ld(e)?e.map(xN):Nn({},e)}function x7(e,n,r,o,i,s,a,l,c){var u,f,d,h,g,v,b,_=r.props||Mu,m=n.props,w=n.type;if(w=="svg"?i="http://www.w3.org/2000/svg":w=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(u=0;u<s.length;u++)if((g=s[u])&&"setAttribute"in g==!!w&&(w?g.localName==w:g.nodeType==3)){e=g,s[u]=null;break}}if(e==null){if(w==null)return document.createTextNode(m);e=document.createElementNS(i,w,m.is&&m),l&&(Ae.__m&&Ae.__m(n,s),l=!1),s=null}if(w==null)_===m||l&&e.data==m||(e.data=m);else{if(s=s&&ol.call(e.childNodes),!l&&s!=null)for(_={},u=0;u<e.attributes.length;u++)_[(g=e.attributes[u]).name]=g.value;for(u in _)g=_[u],u=="dangerouslySetInnerHTML"?d=g:u=="children"||u in m||u=="value"&&"defaultValue"in m||u=="checked"&&"defaultChecked"in m||ec(e,u,null,g,i);for(u in m)g=m[u],u=="children"?h=g:u=="dangerouslySetInnerHTML"?f=g:u=="value"?v=g:u=="checked"?b=g:l&&typeof g!="function"||_[u]===g||ec(e,u,g,_[u],i);if(f)l||d&&(f.__html==d.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),n.__k=[];else if(d&&(e.innerHTML=""),gN(n.type=="template"?e.content:e,Ld(h)?h:[h],n,r,o,w=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,a,s?s[0]:r.__k&&Gi(r,0),l,c),s!=null)for(u=s.length;u--;)Yg(s[u]);l||(u="value",w=="progress"&&v==null?e.removeAttribute("value"):v!=null&&(v!==e[u]||w=="progress"&&!v||w=="option"&&v!=_[u])&&ec(e,u,v,_[u],i),u="checked",b!=null&&b!=e[u]&&ec(e,u,b,_[u],i))}return e}function Kg(e,n,r){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&n==null||(e.__u=e(n))}else e.current=n}catch(i){Ae.__e(i,r)}}function wN(e,n,r){var o,i;if(Ae.unmount&&Ae.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||Kg(o,null,n)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(s){Ae.__e(s,n)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&wN(o[i],n,r||typeof e.type!="function");r||Yg(e.__e),e.__c=e.__=e.__e=void 0}function w7(e,n,r){return this.constructor(e,r)}function b7(e,n,r){var o,i,s,a;n==document&&(n=document.documentElement),Ae.__&&Ae.__(e,n),i=(o=!1)?null:n.__k,s=[],a=[],Xg(n,e=n.__k=m7(zd,null,[e]),i||Mu,Mu,n.namespaceURI,i?null:n.firstChild?ol.call(n.childNodes):null,s,i?i.__e:n.firstChild,o,a),yN(s,e,a)}function bN(e,n,r){var o,i,s,a,l=Nn({},e.props);for(s in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),n)s=="key"?o=n[s]:s=="ref"?i=n[s]:l[s]=n[s]===void 0&&a!=null?a[s]:n[s];return arguments.length>2&&(l.children=arguments.length>3?ol.call(arguments,2):r),ta(e.type,l,o||e.key,i||e.ref,null)}ol=Ru.slice,Ae={__e:function(e,n,r,o){for(var i,s,a;n=n.__;)if((i=n.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,o||{}),a=i.__d),a)return i.__E=i}catch(l){e=l}throw e}},uN=0,dN=function(e){return e!=null&&e.constructor===void 0},Ic.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Nn({},this.state),typeof e=="function"&&(e=e(Nn({},r),this.props)),e&&Nn(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),bx(this))},Ic.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),bx(this))},Ic.prototype.render=zd,Cr=[],fN=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,hN=function(e,n){return e.__v.__b-n.__v.__b},Au.__r=0,Xf=Math.random().toString(8),Tc="__d"+Xf,ea="__a"+Xf,pN=/(PointerCapture)$|Capture$/i,Gg=0,Tp=Sx(!1),Ip=Sx(!0);function kx(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function _7(e){if(Array.isArray(e))return e}function S7(e,n,r){return(n=P7(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function k7(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,s,a,l=[],c=!0,u=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(o=s.call(r)).done)&&(l.push(o.value),l.length!==n);c=!0);}catch(f){u=!0,i=f}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function C7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
386
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cx(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,o)}return r}function
|
|
384
|
+
Defaulting to \`null\`.`}var mk=dk,fD=hk;const hD=x.forwardRef(({className:e,value:n,...r},o)=>p.jsx(mk,{ref:o,className:ae("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...r,children:p.jsx(fD,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(n||0)}%)`}})}));hD.displayName=mk.displayName;function Ty(e,[n,r]){return Math.min(r,Math.max(n,e))}var gk=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),pD="VisuallyHidden",vk=x.forwardRef((e,n)=>p.jsx(fe.span,{...e,ref:n,style:{...gk,...e.style}}));vk.displayName=pD;var mD=vk,gD=[" ","Enter","ArrowUp","ArrowDown"],vD=[" ","Enter"],jd="Select",[jg,Pd,yD]=cg(jd),[cs]=Qt(jd,[yD,to]),Pg=to(),[rY,ro]=cs(jd),[oY,xD]=cs(jd),yk="SelectTrigger",xk=x.forwardRef((e,n)=>{const{__scopeSelect:r,disabled:o=!1,...i}=e,s=Pg(r),a=ro(yk,r),l=a.disabled||o,c=xe(n,a.onTriggerChange),u=Pd(r),f=x.useRef("touch"),[d,h,g]=Bk(b=>{const _=u().filter(y=>!y.disabled),m=_.find(y=>y.value===a.value),w=Hk(_,b,m);w!==void 0&&a.onValueChange(w.value)}),v=b=>{l||(a.onOpenChange(!0),g()),b&&(a.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return p.jsx(Qa,{asChild:!0,...s,children:p.jsx(fe.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Fk(a.value)?"":void 0,...i,ref:c,onClick:re(i.onClick,b=>{b.currentTarget.focus(),f.current!=="mouse"&&v(b)}),onPointerDown:re(i.onPointerDown,b=>{f.current=b.pointerType;const _=b.target;_.hasPointerCapture(b.pointerId)&&_.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(v(b),b.preventDefault())}),onKeyDown:re(i.onKeyDown,b=>{const _=d.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&h(b.key),!(_&&b.key===" ")&&gD.includes(b.key)&&(v(),b.preventDefault())})})})});xk.displayName=yk;var wk="SelectValue",wD=x.forwardRef((e,n)=>{const{__scopeSelect:r,className:o,style:i,children:s,placeholder:a="",...l}=e,c=ro(wk,r),{onValueNodeHasChildrenChange:u}=c,f=s!==void 0,d=xe(n,c.onValueNodeChange);return Ye(()=>{u(f)},[u,f]),p.jsx(fe.span,{...l,ref:d,style:{pointerEvents:"none"},children:Fk(c.value)?p.jsx(p.Fragment,{children:a}):s})});wD.displayName=wk;var bD="SelectIcon",bk=x.forwardRef((e,n)=>{const{__scopeSelect:r,children:o,...i}=e;return p.jsx(fe.span,{"aria-hidden":!0,...i,ref:n,children:o||"▼"})});bk.displayName=bD;var _D="SelectPortal",_k=e=>p.jsx(ss,{asChild:!0,...e});_k.displayName=_D;var $o="SelectContent",Sk=x.forwardRef((e,n)=>{const r=ro($o,e.__scopeSelect),[o,i]=x.useState();if(Ye(()=>{i(new DocumentFragment)},[]),!r.open){const s=o;return s?ts.createPortal(p.jsx(kk,{scope:e.__scopeSelect,children:p.jsx(jg.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),s):null}return p.jsx(Ck,{...e,ref:n})});Sk.displayName=$o;var nn=10,[kk,oo]=cs($o),SD="SelectContentImpl",kD=Ao("SelectContent.RemoveScroll"),Ck=x.forwardRef((e,n)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:a,side:l,sideOffset:c,align:u,alignOffset:f,arrowPadding:d,collisionBoundary:h,collisionPadding:g,sticky:v,hideWhenDetached:b,avoidCollisions:_,...m}=e,w=ro($o,r),[y,S]=x.useState(null),[k,C]=x.useState(null),N=xe(n,W=>S(W)),[E,j]=x.useState(null),[A,T]=x.useState(null),D=Pd(r),[F,P]=x.useState(!1),L=x.useRef(!1);x.useEffect(()=>{if(y)return hd(y)},[y]),dd();const I=x.useCallback(W=>{const[X,...q]=D().map(Q=>Q.ref.current),[te]=q.slice(-1),ee=document.activeElement;for(const Q of W)if(Q===ee||(Q==null||Q.scrollIntoView({block:"nearest"}),Q===X&&k&&(k.scrollTop=0),Q===te&&k&&(k.scrollTop=k.scrollHeight),Q==null||Q.focus(),document.activeElement!==ee))return},[D,k]),z=x.useCallback(()=>I([E,y]),[I,E,y]);x.useEffect(()=>{F&&z()},[F,z]);const{onOpenChange:R,triggerPointerDownPosRef:M}=w;x.useEffect(()=>{if(y){let W={x:0,y:0};const X=te=>{var ee,Q;W={x:Math.abs(Math.round(te.pageX)-(((ee=M.current)==null?void 0:ee.x)??0)),y:Math.abs(Math.round(te.pageY)-(((Q=M.current)==null?void 0:Q.y)??0))}},q=te=>{W.x<=10&&W.y<=10?te.preventDefault():y.contains(te.target)||R(!1),document.removeEventListener("pointermove",X),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",X),document.addEventListener("pointerup",q,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",X),document.removeEventListener("pointerup",q,{capture:!0})}}},[y,R,M]),x.useEffect(()=>{const W=()=>R(!1);return window.addEventListener("blur",W),window.addEventListener("resize",W),()=>{window.removeEventListener("blur",W),window.removeEventListener("resize",W)}},[R]);const[O,V]=Bk(W=>{const X=D().filter(ee=>!ee.disabled),q=X.find(ee=>ee.ref.current===document.activeElement),te=Hk(X,W,q);te&&setTimeout(()=>te.ref.current.focus())}),$=x.useCallback((W,X,q)=>{const te=!L.current&&!q;(w.value!==void 0&&w.value===X||te)&&(j(W),te&&(L.current=!0))},[w.value]),K=x.useCallback(()=>y==null?void 0:y.focus(),[y]),B=x.useCallback((W,X,q)=>{const te=!L.current&&!q;(w.value!==void 0&&w.value===X||te)&&T(W)},[w.value]),U=o==="popper"?fp:Nk,G=U===fp?{side:l,sideOffset:c,align:u,alignOffset:f,arrowPadding:d,collisionBoundary:h,collisionPadding:g,sticky:v,hideWhenDetached:b,avoidCollisions:_}:{};return p.jsx(kk,{scope:r,content:y,viewport:k,onViewportChange:C,itemRefCallback:$,selectedItem:E,onItemLeave:K,itemTextRefCallback:B,focusSelectedItem:z,selectedItemText:A,position:o,isPositioned:F,searchRef:O,children:p.jsx(Ga,{as:kD,allowPinchZoom:!0,children:p.jsx(Wa,{asChild:!0,trapped:w.open,onMountAutoFocus:W=>{W.preventDefault()},onUnmountAutoFocus:re(i,W=>{var X;(X=w.trigger)==null||X.focus({preventScroll:!0}),W.preventDefault()}),children:p.jsx(is,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:W=>W.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:p.jsx(U,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:W=>W.preventDefault(),...m,...G,onPlaced:()=>P(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...m.style},onKeyDown:re(m.onKeyDown,W=>{const X=W.ctrlKey||W.altKey||W.metaKey;if(W.key==="Tab"&&W.preventDefault(),!X&&W.key.length===1&&V(W.key),["ArrowUp","ArrowDown","Home","End"].includes(W.key)){let te=D().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);if(["ArrowUp","End"].includes(W.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(W.key)){const ee=W.target,Q=te.indexOf(ee);te=te.slice(Q+1)}setTimeout(()=>I(te)),W.preventDefault()}})})})})})})});Ck.displayName=SD;var CD="SelectItemAlignedPosition",Nk=x.forwardRef((e,n)=>{const{__scopeSelect:r,onPlaced:o,...i}=e,s=ro($o,r),a=oo($o,r),[l,c]=x.useState(null),[u,f]=x.useState(null),d=xe(n,N=>f(N)),h=Pd(r),g=x.useRef(!1),v=x.useRef(!0),{viewport:b,selectedItem:_,selectedItemText:m,focusSelectedItem:w}=a,y=x.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&b&&_&&m){const N=s.trigger.getBoundingClientRect(),E=u.getBoundingClientRect(),j=s.valueNode.getBoundingClientRect(),A=m.getBoundingClientRect();if(s.dir!=="rtl"){const ee=A.left-E.left,Q=j.left-ee,ne=N.left-Q,ue=N.width+ne,ye=Math.max(ue,E.width),pe=window.innerWidth-nn,ke=Ty(Q,[nn,Math.max(nn,pe-ye)]);l.style.minWidth=ue+"px",l.style.left=ke+"px"}else{const ee=E.right-A.right,Q=window.innerWidth-j.right-ee,ne=window.innerWidth-N.right-Q,ue=N.width+ne,ye=Math.max(ue,E.width),pe=window.innerWidth-nn,ke=Ty(Q,[nn,Math.max(nn,pe-ye)]);l.style.minWidth=ue+"px",l.style.right=ke+"px"}const T=h(),D=window.innerHeight-nn*2,F=b.scrollHeight,P=window.getComputedStyle(u),L=parseInt(P.borderTopWidth,10),I=parseInt(P.paddingTop,10),z=parseInt(P.borderBottomWidth,10),R=parseInt(P.paddingBottom,10),M=L+I+F+R+z,O=Math.min(_.offsetHeight*5,M),V=window.getComputedStyle(b),$=parseInt(V.paddingTop,10),K=parseInt(V.paddingBottom,10),B=N.top+N.height/2-nn,U=D-B,G=_.offsetHeight/2,W=_.offsetTop+G,X=L+I+W,q=M-X;if(X<=B){const ee=T.length>0&&_===T[T.length-1].ref.current;l.style.bottom="0px";const Q=u.clientHeight-b.offsetTop-b.offsetHeight,ne=Math.max(U,G+(ee?K:0)+Q+z),ue=X+ne;l.style.height=ue+"px"}else{const ee=T.length>0&&_===T[0].ref.current;l.style.top="0px";const ne=Math.max(B,L+b.offsetTop+(ee?$:0)+G)+q;l.style.height=ne+"px",b.scrollTop=X-B+b.offsetTop}l.style.margin=`${nn}px 0`,l.style.minHeight=O+"px",l.style.maxHeight=D+"px",o==null||o(),requestAnimationFrame(()=>g.current=!0)}},[h,s.trigger,s.valueNode,l,u,b,_,m,s.dir,o]);Ye(()=>y(),[y]);const[S,k]=x.useState();Ye(()=>{u&&k(window.getComputedStyle(u).zIndex)},[u]);const C=x.useCallback(N=>{N&&v.current===!0&&(y(),w==null||w(),v.current=!1)},[y,w]);return p.jsx(ED,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:g,onScrollButtonChange:C,children:p.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:p.jsx(fe.div,{...i,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Nk.displayName=CD;var ND="SelectPopperPosition",fp=x.forwardRef((e,n)=>{const{__scopeSelect:r,align:o="start",collisionPadding:i=nn,...s}=e,a=Pg(r);return p.jsx(_d,{...a,...s,ref:n,align:o,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});fp.displayName=ND;var[ED,Mg]=cs($o,{}),hp="SelectViewport",Ek=x.forwardRef((e,n)=>{const{__scopeSelect:r,nonce:o,...i}=e,s=oo(hp,r),a=Mg(hp,r),l=xe(n,s.onViewportChange),c=x.useRef(0);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),p.jsx(jg.Slot,{scope:r,children:p.jsx(fe.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:re(i.onScroll,u=>{const f=u.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:h}=a;if(h!=null&&h.current&&d){const g=Math.abs(c.current-f.scrollTop);if(g>0){const v=window.innerHeight-nn*2,b=parseFloat(d.style.minHeight),_=parseFloat(d.style.height),m=Math.max(b,_);if(m<v){const w=m+g,y=Math.min(v,w),S=w-y;d.style.height=y+"px",d.style.bottom==="0px"&&(f.scrollTop=S>0?S:0,d.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});Ek.displayName=hp;var jk="SelectGroup",[jD,PD]=cs(jk),MD=x.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e,i=Tt();return p.jsx(jD,{scope:r,id:i,children:p.jsx(fe.div,{role:"group","aria-labelledby":i,...o,ref:n})})});MD.displayName=jk;var Pk="SelectLabel",Mk=x.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e,i=PD(Pk,r);return p.jsx(fe.div,{id:i.id,...o,ref:n})});Mk.displayName=Pk;var xu="SelectItem",[RD,Rk]=cs(xu),Ak=x.forwardRef((e,n)=>{const{__scopeSelect:r,value:o,disabled:i=!1,textValue:s,...a}=e,l=ro(xu,r),c=oo(xu,r),u=l.value===o,[f,d]=x.useState(s??""),[h,g]=x.useState(!1),v=xe(n,w=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,w,o,i)}),b=Tt(),_=x.useRef("touch"),m=()=>{i||(l.onValueChange(o),l.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.jsx(RD,{scope:r,value:o,disabled:i,textId:b,isSelected:u,onItemTextChange:x.useCallback(w=>{d(y=>y||((w==null?void 0:w.textContent)??"").trim())},[]),children:p.jsx(jg.ItemSlot,{scope:r,value:o,disabled:i,textValue:f,children:p.jsx(fe.div,{role:"option","aria-labelledby":b,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...a,ref:v,onFocus:re(a.onFocus,()=>g(!0)),onBlur:re(a.onBlur,()=>g(!1)),onClick:re(a.onClick,()=>{_.current!=="mouse"&&m()}),onPointerUp:re(a.onPointerUp,()=>{_.current==="mouse"&&m()}),onPointerDown:re(a.onPointerDown,w=>{_.current=w.pointerType}),onPointerMove:re(a.onPointerMove,w=>{var y;_.current=w.pointerType,i?(y=c.onItemLeave)==null||y.call(c):_.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:re(a.onPointerLeave,w=>{var y;w.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:re(a.onKeyDown,w=>{var S;((S=c.searchRef)==null?void 0:S.current)!==""&&w.key===" "||(vD.includes(w.key)&&m(),w.key===" "&&w.preventDefault())})})})})});Ak.displayName=xu;var zs="SelectItemText",Tk=x.forwardRef((e,n)=>{const{__scopeSelect:r,className:o,style:i,...s}=e,a=ro(zs,r),l=oo(zs,r),c=Rk(zs,r),u=xD(zs,r),[f,d]=x.useState(null),h=xe(n,m=>d(m),c.onItemTextChange,m=>{var w;return(w=l.itemTextRefCallback)==null?void 0:w.call(l,m,c.value,c.disabled)}),g=f==null?void 0:f.textContent,v=x.useMemo(()=>p.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:b,onNativeOptionRemove:_}=u;return Ye(()=>(b(v),()=>_(v)),[b,_,v]),p.jsxs(p.Fragment,{children:[p.jsx(fe.span,{id:c.textId,...s,ref:h}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?ts.createPortal(s.children,a.valueNode):null]})});Tk.displayName=zs;var Ik="SelectItemIndicator",Ok=x.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e;return Rk(Ik,r).isSelected?p.jsx(fe.span,{"aria-hidden":!0,...o,ref:n}):null});Ok.displayName=Ik;var pp="SelectScrollUpButton",$k=x.forwardRef((e,n)=>{const r=oo(pp,e.__scopeSelect),o=Mg(pp,e.__scopeSelect),[i,s]=x.useState(!1),a=xe(n,o.onScrollButtonChange);return Ye(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollTop>0;s(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),i?p.jsx(Lk,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});$k.displayName=pp;var mp="SelectScrollDownButton",Dk=x.forwardRef((e,n)=>{const r=oo(mp,e.__scopeSelect),o=Mg(mp,e.__scopeSelect),[i,s]=x.useState(!1),a=xe(n,o.onScrollButtonChange);return Ye(()=>{if(r.viewport&&r.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<u;s(f)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),i?p.jsx(Lk,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Dk.displayName=mp;var Lk=x.forwardRef((e,n)=>{const{__scopeSelect:r,onAutoScroll:o,...i}=e,s=oo("SelectScrollButton",r),a=x.useRef(null),l=Pd(r),c=x.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return x.useEffect(()=>()=>c(),[c]),Ye(()=>{var f;const u=l().find(d=>d.ref.current===document.activeElement);(f=u==null?void 0:u.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),p.jsx(fe.div,{"aria-hidden":!0,...i,ref:n,style:{flexShrink:0,...i.style},onPointerDown:re(i.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(o,50))}),onPointerMove:re(i.onPointerMove,()=>{var u;(u=s.onItemLeave)==null||u.call(s),a.current===null&&(a.current=window.setInterval(o,50))}),onPointerLeave:re(i.onPointerLeave,()=>{c()})})}),AD="SelectSeparator",zk=x.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e;return p.jsx(fe.div,{"aria-hidden":!0,...o,ref:n})});zk.displayName=AD;var gp="SelectArrow",TD=x.forwardRef((e,n)=>{const{__scopeSelect:r,...o}=e,i=Pg(r),s=ro(gp,r),a=oo(gp,r);return s.open&&a.position==="popper"?p.jsx(Sd,{...i,...o,ref:n}):null});TD.displayName=gp;var ID="SelectBubbleInput",OD=x.forwardRef(({__scopeSelect:e,value:n,...r},o)=>{const i=x.useRef(null),s=xe(o,i),a=eg(n);return x.useEffect(()=>{const l=i.current;if(!l)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==n&&f){const d=new Event("change",{bubbles:!0});f.call(l,n),l.dispatchEvent(d)}},[a,n]),p.jsx(fe.select,{...r,style:{...gk,...r.style},ref:s,defaultValue:n})});OD.displayName=ID;function Fk(e){return e===""||e===void 0}function Bk(e){const n=Rn(e),r=x.useRef(""),o=x.useRef(0),i=x.useCallback(a=>{const l=r.current+a;n(l),function c(u){r.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>c(""),1e3))}(l)},[n]),s=x.useCallback(()=>{r.current="",window.clearTimeout(o.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(o.current),[]),[r,i,s]}function Hk(e,n,r){const i=n.length>1&&Array.from(n).every(u=>u===n[0])?n[0]:n,s=r?e.indexOf(r):-1;let a=$D(e,Math.max(s,0));i.length===1&&(a=a.filter(u=>u!==r));const c=a.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function $D(e,n){return e.map((r,o)=>e[(n+o)%e.length])}var Uk=xk,DD=bk,LD=_k,Vk=Sk,zD=Ek,Wk=Mk,Gk=Ak,FD=Tk,BD=Ok,Yk=$k,Xk=Dk,Kk=zk;const HD=x.forwardRef(({className:e,children:n,...r},o)=>p.jsxs(Uk,{ref:o,className:ae("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-transparent bg-input px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground/50 data-[placeholder]:font-light focus:outline-none focus:border-ring focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[n,p.jsx(DD,{asChild:!0,children:p.jsx(cd,{className:"h-4 w-4 opacity-50"})})]}));HD.displayName=Uk.displayName;const qk=x.forwardRef(({className:e,...n},r)=>p.jsx(Yk,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...n,children:p.jsx(DR,{className:"h-4 w-4"})}));qk.displayName=Yk.displayName;const Qk=x.forwardRef(({className:e,...n},r)=>p.jsx(Xk,{ref:r,className:ae("flex cursor-default items-center justify-center py-1",e),...n,children:p.jsx(cd,{className:"h-4 w-4"})}));Qk.displayName=Xk.displayName;const UD=x.forwardRef(({className:e,children:n,position:r="popper",...o},i)=>p.jsx(LD,{children:p.jsxs(Vk,{ref:i,className:ae("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...o,children:[p.jsx(qk,{}),p.jsx(zD,{className:ae("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),p.jsx(Qk,{})]})}));UD.displayName=Vk.displayName;const VD=x.forwardRef(({className:e,...n},r)=>p.jsx(Wk,{ref:r,className:ae("px-2 py-1.5 text-sm font-semibold",e),...n}));VD.displayName=Wk.displayName;const WD=x.forwardRef(({className:e,children:n,...r},o)=>p.jsxs(Gk,{ref:o,className:ae("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[p.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(BD,{children:p.jsx(qm,{className:"h-4 w-4"})})}),p.jsx(FD,{children:n})]}));WD.displayName=Gk.displayName;const GD=x.forwardRef(({className:e,...n},r)=>p.jsx(Kk,{ref:r,className:ae("-mx-1 my-1 h-px bg-muted",e),...n}));GD.displayName=Kk.displayName;var YD="Separator",Iy="horizontal",XD=["horizontal","vertical"],Zk=x.forwardRef((e,n)=>{const{decorative:r,orientation:o=Iy,...i}=e,s=KD(o)?o:Iy,l=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return p.jsx(mt.div,{"data-orientation":s,...l,...i,ref:n})});Zk.displayName=YD;function KD(e){return XD.includes(e)}var Jk=Zk;const qD=x.forwardRef(({className:e,orientation:n="horizontal",decorative:r=!0,...o},i)=>p.jsx(Jk,{ref:i,decorative:r,orientation:n,className:ae("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));qD.displayName=Jk.displayName;const QD=ag,eC=x.forwardRef(({className:e,...n},r)=>p.jsx(Ya,{className:ae("fixed inset-0 z-50 bg-black/80 [will-change:opacity] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...n,ref:r}));eC.displayName=Ya.displayName;const ZD=Xm("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out [will-change:transform,opacity] data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),JD=x.forwardRef(({side:e="right",className:n,children:r,...o},i)=>p.jsxs(QD,{children:[p.jsx(eC,{}),p.jsxs(Xa,{ref:i,className:ae(ZD({side:e}),n),...o,children:[p.jsxs(k2,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[p.jsx(uu,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]}),r]})]}));JD.displayName=Xa.displayName;const eL=x.forwardRef(({className:e,...n},r)=>p.jsx(md,{ref:r,className:ae("text-lg font-semibold text-foreground",e),...n}));eL.displayName=md.displayName;const tL=x.forwardRef(({className:e,...n},r)=>p.jsx(gd,{ref:r,className:ae("text-sm text-muted-foreground",e),...n}));tL.displayName=gd.displayName;var Md="Switch",[nL]=Qt(Md),[rL,oL]=nL(Md),tC=x.forwardRef((e,n)=>{const{__scopeSwitch:r,name:o,checked:i,defaultChecked:s,required:a,disabled:l,value:c="on",onCheckedChange:u,form:f,...d}=e,[h,g]=x.useState(null),v=xe(n,y=>g(y)),b=x.useRef(!1),_=h?f||!!h.closest("form"):!0,[m,w]=Va({prop:i,defaultProp:s??!1,onChange:u,caller:Md});return p.jsxs(rL,{scope:r,checked:m,disabled:l,children:[p.jsx(fe.button,{type:"button",role:"switch","aria-checked":m,"aria-required":a,"data-state":iC(m),"data-disabled":l?"":void 0,disabled:l,value:c,...d,ref:v,onClick:re(e.onClick,y=>{w(S=>!S),_&&(b.current=y.isPropagationStopped(),b.current||y.stopPropagation())})}),_&&p.jsx(oC,{control:h,bubbles:!b.current,name:o,value:c,checked:m,required:a,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});tC.displayName=Md;var nC="SwitchThumb",rC=x.forwardRef((e,n)=>{const{__scopeSwitch:r,...o}=e,i=oL(nC,r);return p.jsx(fe.span,{"data-state":iC(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:n})});rC.displayName=nC;var iL="SwitchBubbleInput",oC=x.forwardRef(({__scopeSwitch:e,control:n,checked:r,bubbles:o=!0,...i},s)=>{const a=x.useRef(null),l=xe(a,s),c=eg(r),u=tg(n);return x.useEffect(()=>{const f=a.current;if(!f)return;const d=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(d,"checked").set;if(c!==r&&g){const v=new Event("click",{bubbles:o});g.call(f,r),f.dispatchEvent(v)}},[c,r,o]),p.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:l,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});oC.displayName=iL;function iC(e){return e?"checked":"unchecked"}var sC=tC,sL=rC;const aL=x.forwardRef(({className:e,...n},r)=>p.jsx(sC,{ref:r,className:ae("peer inline-flex h-4 w-7 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...n,children:p.jsx(sL,{className:ae("pointer-events-none block h-3 w-3 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-3 data-[state=unchecked]:translate-x-0")})}));aL.displayName=sC.displayName;function lL(e){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}Array(12).fill(0);let vp=1;class cL{constructor(){this.subscribe=n=>(this.subscribers.push(n),()=>{const r=this.subscribers.indexOf(n);this.subscribers.splice(r,1)}),this.publish=n=>{this.subscribers.forEach(r=>r(n))},this.addToast=n=>{this.publish(n),this.toasts=[...this.toasts,n]},this.create=n=>{var r;const{message:o,...i}=n,s=typeof(n==null?void 0:n.id)=="number"||((r=n.id)==null?void 0:r.length)>0?n.id:vp++,a=this.toasts.find(c=>c.id===s),l=n.dismissible===void 0?!0:n.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),a?this.toasts=this.toasts.map(c=>c.id===s?(this.publish({...c,...n,id:s,title:o}),{...c,...n,id:s,dismissible:l,title:o}):c):this.addToast({title:o,...i,dismissible:l,id:s}),s},this.dismiss=n=>(n?(this.dismissedToasts.add(n),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:n,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(o=>o({id:r.id,dismiss:!0}))}),n),this.message=(n,r)=>this.create({...r,message:n}),this.error=(n,r)=>this.create({...r,message:n,type:"error"}),this.success=(n,r)=>this.create({...r,type:"success",message:n}),this.info=(n,r)=>this.create({...r,type:"info",message:n}),this.warning=(n,r)=>this.create({...r,type:"warning",message:n}),this.loading=(n,r)=>this.create({...r,type:"loading",message:n}),this.promise=(n,r)=>{if(!r)return;let o;r.loading!==void 0&&(o=this.create({...r,promise:n,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const i=Promise.resolve(n instanceof Function?n():n);let s=o!==void 0,a;const l=i.then(async u=>{if(a=["resolve",u],it.isValidElement(u))s=!1,this.create({id:o,type:"default",message:u});else if(dL(u)&&!u.ok){s=!1;const d=typeof r.error=="function"?await r.error(`HTTP error! status: ${u.status}`):r.error,h=typeof r.description=="function"?await r.description(`HTTP error! status: ${u.status}`):r.description,v=typeof d=="object"&&!it.isValidElement(d)?d:{message:d};this.create({id:o,type:"error",description:h,...v})}else if(u instanceof Error){s=!1;const d=typeof r.error=="function"?await r.error(u):r.error,h=typeof r.description=="function"?await r.description(u):r.description,v=typeof d=="object"&&!it.isValidElement(d)?d:{message:d};this.create({id:o,type:"error",description:h,...v})}else if(r.success!==void 0){s=!1;const d=typeof r.success=="function"?await r.success(u):r.success,h=typeof r.description=="function"?await r.description(u):r.description,v=typeof d=="object"&&!it.isValidElement(d)?d:{message:d};this.create({id:o,type:"success",description:h,...v})}}).catch(async u=>{if(a=["reject",u],r.error!==void 0){s=!1;const f=typeof r.error=="function"?await r.error(u):r.error,d=typeof r.description=="function"?await r.description(u):r.description,g=typeof f=="object"&&!it.isValidElement(f)?f:{message:f};this.create({id:o,type:"error",description:d,...g})}}).finally(()=>{s&&(this.dismiss(o),o=void 0),r.finally==null||r.finally.call(r)}),c=()=>new Promise((u,f)=>l.then(()=>a[0]==="reject"?f(a[1]):u(a[1])).catch(f));return typeof o!="string"&&typeof o!="number"?{unwrap:c}:Object.assign(o,{unwrap:c})},this.custom=(n,r)=>{const o=(r==null?void 0:r.id)||vp++;return this.create({jsx:n(o),id:o,...r}),o},this.getActiveToasts=()=>this.toasts.filter(n=>!this.dismissedToasts.has(n.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Bt=new cL,uL=(e,n)=>{const r=(n==null?void 0:n.id)||vp++;return Bt.addToast({title:e,...n,id:r}),r},dL=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",fL=uL,hL=()=>Bt.toasts,pL=()=>Bt.getActiveToasts();Object.assign(fL,{success:Bt.success,info:Bt.info,warning:Bt.warning,error:Bt.error,custom:Bt.custom,message:Bt.message,promise:Bt.promise,dismiss:Bt.dismiss,loading:Bt.loading},{getHistory:hL,getToasts:pL});lL("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");var Rd="Tabs",[mL]=Qt(Rd,[kd]),aC=kd(),[gL,Rg]=mL(Rd),vL=x.forwardRef((e,n)=>{const{__scopeTabs:r,value:o,onValueChange:i,defaultValue:s,orientation:a="horizontal",dir:l,activationMode:c="automatic",...u}=e,f=T2(l),[d,h]=Va({prop:o,onChange:i,defaultProp:s??"",caller:Rd});return p.jsx(gL,{scope:r,baseId:Tt(),value:d,onValueChange:h,orientation:a,dir:f,activationMode:c,children:p.jsx(fe.div,{dir:f,"data-orientation":a,...u,ref:n})})});vL.displayName=Rd;var lC="TabsList",cC=x.forwardRef((e,n)=>{const{__scopeTabs:r,loop:o=!0,...i}=e,s=Rg(lC,r),a=aC(r);return p.jsx(sS,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:o,children:p.jsx(fe.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:n})})});cC.displayName=lC;var uC="TabsTrigger",dC=x.forwardRef((e,n)=>{const{__scopeTabs:r,value:o,disabled:i=!1,...s}=e,a=Rg(uC,r),l=aC(r),c=pC(a.baseId,o),u=mC(a.baseId,o),f=o===a.value;return p.jsx(aS,{asChild:!0,...l,focusable:!i,active:f,children:p.jsx(fe.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...s,ref:n,onMouseDown:re(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?a.onValueChange(o):d.preventDefault()}),onKeyDown:re(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&a.onValueChange(o)}),onFocus:re(e.onFocus,()=>{const d=a.activationMode!=="manual";!f&&!i&&d&&a.onValueChange(o)})})})});dC.displayName=uC;var fC="TabsContent",hC=x.forwardRef((e,n)=>{const{__scopeTabs:r,value:o,forceMount:i,children:s,...a}=e,l=Rg(fC,r),c=pC(l.baseId,o),u=mC(l.baseId,o),f=o===l.value,d=x.useRef(f);return x.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),p.jsx(kt,{present:i||f,children:({present:h})=>p.jsx(fe.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...a,ref:n,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&s})})});hC.displayName=fC;function pC(e,n){return`${e}-trigger-${n}`}function mC(e,n){return`${e}-content-${n}`}var gC=cC,vC=dC,yC=hC;const yL=x.forwardRef(({className:e,...n},r)=>p.jsx(gC,{ref:r,className:ae("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...n}));yL.displayName=gC.displayName;const xL=x.forwardRef(({className:e,...n},r)=>p.jsx(vC,{ref:r,className:ae("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-primary/10 data-[state=active]:text-primary data-[state=active]:shadow-sm",e),...n}));xL.displayName=vC.displayName;const wL=x.forwardRef(({className:e,...n},r)=>p.jsx(yC,{ref:r,className:ae("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...n}));wL.displayName=yC.displayName;const bL=x.forwardRef(({className:e,...n},r)=>p.jsx("textarea",{className:ae("flex min-h-[60px] w-full rounded-md border border-transparent bg-input px-3 py-2 text-base placeholder:text-muted-foreground/50 placeholder:font-light focus-visible:outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));bL.displayName="Textarea";var[Ad]=Qt("Tooltip",[to]),Ag=to(),_L="TooltipProvider",Oy="tooltip.open",[iY,xC]=Ad(_L),wC="Tooltip",[sY,el]=Ad(wC),yp="TooltipTrigger",SL=x.forwardRef((e,n)=>{const{__scopeTooltip:r,...o}=e,i=el(yp,r),s=xC(yp,r),a=Ag(r),l=x.useRef(null),c=xe(n,l,i.onTriggerChange),u=x.useRef(!1),f=x.useRef(!1),d=x.useCallback(()=>u.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),p.jsx(Qa,{asChild:!0,...a,children:p.jsx(fe.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...o,ref:c,onPointerMove:re(e.onPointerMove,h=>{h.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:re(e.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:re(e.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:re(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:re(e.onBlur,i.onClose),onClick:re(e.onClick,i.onClose)})})});SL.displayName=yp;var Tg="TooltipPortal",[kL,CL]=Ad(Tg,{forceMount:void 0}),bC=e=>{const{__scopeTooltip:n,forceMount:r,children:o,container:i}=e,s=el(Tg,n);return p.jsx(kL,{scope:n,forceMount:r,children:p.jsx(kt,{present:r||s.open,children:p.jsx(ss,{asChild:!0,container:i,children:o})})})};bC.displayName=Tg;var Ui="TooltipContent",_C=x.forwardRef((e,n)=>{const r=CL(Ui,e.__scopeTooltip),{forceMount:o=r.forceMount,side:i="top",...s}=e,a=el(Ui,e.__scopeTooltip);return p.jsx(kt,{present:o||a.open,children:a.disableHoverableContent?p.jsx(SC,{side:i,...s,ref:n}):p.jsx(NL,{side:i,...s,ref:n})})}),NL=x.forwardRef((e,n)=>{const r=el(Ui,e.__scopeTooltip),o=xC(Ui,e.__scopeTooltip),i=x.useRef(null),s=xe(n,i),[a,l]=x.useState(null),{trigger:c,onClose:u}=r,f=i.current,{onPointerInTransitChange:d}=o,h=x.useCallback(()=>{l(null),d(!1)},[d]),g=x.useCallback((v,b)=>{const _=v.currentTarget,m={x:v.clientX,y:v.clientY},w=RL(m,_.getBoundingClientRect()),y=AL(m,w),S=TL(b.getBoundingClientRect()),k=OL([...y,...S]);l(k),d(!0)},[d]);return x.useEffect(()=>()=>h(),[h]),x.useEffect(()=>{if(c&&f){const v=_=>g(_,f),b=_=>g(_,c);return c.addEventListener("pointerleave",v),f.addEventListener("pointerleave",b),()=>{c.removeEventListener("pointerleave",v),f.removeEventListener("pointerleave",b)}}},[c,f,g,h]),x.useEffect(()=>{if(a){const v=b=>{const _=b.target,m={x:b.clientX,y:b.clientY},w=(c==null?void 0:c.contains(_))||(f==null?void 0:f.contains(_)),y=!IL(m,a);w?h():y&&(h(),u())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,f,a,u,h]),p.jsx(SC,{...e,ref:s})}),[EL,jL]=Ad(wC,{isInside:!1}),PL=iT("TooltipContent"),SC=x.forwardRef((e,n)=>{const{__scopeTooltip:r,children:o,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:a,...l}=e,c=el(Ui,r),u=Ag(r),{onClose:f}=c;return x.useEffect(()=>(document.addEventListener(Oy,f),()=>document.removeEventListener(Oy,f)),[f]),x.useEffect(()=>{if(c.trigger){const d=h=>{const g=h.target;g!=null&&g.contains(c.trigger)&&f()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[c.trigger,f]),p.jsx(is,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:f,children:p.jsxs(_d,{"data-state":c.stateAttribute,...u,...l,ref:n,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(PL,{children:o}),p.jsx(EL,{scope:r,isInside:!0,children:p.jsx(mD,{id:c.contentId,role:"tooltip",children:i||o})})]})})});_C.displayName=Ui;var kC="TooltipArrow",ML=x.forwardRef((e,n)=>{const{__scopeTooltip:r,...o}=e,i=Ag(r);return jL(kC,r).isInside?null:p.jsx(Sd,{...i,...o,ref:n})});ML.displayName=kC;function RL(e,n){const r=Math.abs(n.top-e.y),o=Math.abs(n.bottom-e.y),i=Math.abs(n.right-e.x),s=Math.abs(n.left-e.x);switch(Math.min(r,o,i,s)){case s:return"left";case i:return"right";case r:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function AL(e,n,r=5){const o=[];switch(n){case"top":o.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":o.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":o.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":o.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return o}function TL(e){const{top:n,right:r,bottom:o,left:i}=e;return[{x:i,y:n},{x:r,y:n},{x:r,y:o},{x:i,y:o}]}function IL(e,n){const{x:r,y:o}=e;let i=!1;for(let s=0,a=n.length-1;s<n.length;a=s++){const l=n[s],c=n[a],u=l.x,f=l.y,d=c.x,h=c.y;f>o!=h>o&&r<(d-u)*(o-f)/(h-f)+u&&(i=!i)}return i}function OL(e){const n=e.slice();return n.sort((r,o)=>r.x<o.x?-1:r.x>o.x?1:r.y<o.y?-1:r.y>o.y?1:0),$L(n)}function $L(e){if(e.length<=1)return e.slice();const n=[];for(let o=0;o<e.length;o++){const i=e[o];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))n.pop();else break}n.push(i)}n.pop();const r=[];for(let o=e.length-1;o>=0;o--){const i=e[o];for(;r.length>=2;){const s=r[r.length-1],a=r[r.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))r.pop();else break}r.push(i)}return r.pop(),n.length===1&&r.length===1&&n[0].x===r[0].x&&n[0].y===r[0].y?n:n.concat(r)}var DL=bC,CC=_C;const LL=x.forwardRef(({className:e,sideOffset:n=4,...r},o)=>p.jsx(DL,{children:p.jsx(CC,{ref:o,sideOffset:n,className:ae("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...r})}));LL.displayName=CC.displayName;x.createContext(!1);function zL(){const{setTheme:e,resolvedTheme:n}=s3();return p.jsxs(B_,{variant:"ghost",size:"icon",className:"relative h-8 w-8",onClick:()=>e(n==="dark"?"light":"dark"),children:[p.jsx(MA,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),p.jsx(hA,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),p.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}const NC=x.createContext({activeProject:".",setActiveProject:()=>{},projects:[],isMultiProject:!1,monorepoRoot:"",reloadProjects:async()=>{}});function Ig(){return x.useContext(NC)}function Go(){const{activeProject:e,isMultiProject:n}=Ig();return x.useCallback((r,o)=>{const i=new URLSearchParams(o);n&&e!=="."&&i.set("project",e);const s=i.toString();return s?`${r}?${s}`:r},[e,n])}function FL({children:e}){const[n,r]=x.useState([]),[o,i]=x.useState("."),[s,a]=x.useState(""),l=x.useCallback(async()=>{var u;try{const f=await fetch("/api/projects");if(!f.ok)return;const d=await f.json();r(d.projects??[]),a(d.monorepoRoot??""),((u=d.projects)==null?void 0:u.length)>0&&o==="."&&i(d.projects[0].root)}catch{}},[o]);x.useEffect(()=>{l()},[l]);const c=n.length>1;return p.jsx(NC.Provider,{value:{activeProject:o,setActiveProject:i,projects:n,isMultiProject:c,monorepoRoot:s,reloadProjects:l},children:e})}function BL(){return p.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[p.jsx("circle",{cx:"6",cy:"6",r:"2.5"}),p.jsx("circle",{cx:"18",cy:"6",r:"2.5"}),p.jsx("circle",{cx:"12",cy:"14",r:"2.5"}),p.jsx("circle",{cx:"6",cy:"20",r:"1.8"}),p.jsx("circle",{cx:"18",cy:"20",r:"1.8"}),p.jsx("path",{d:"M7.6 7.6 10.7 12.5"}),p.jsx("path",{d:"M16.4 7.6 13.3 12.5"}),p.jsx("path",{d:"M10.5 15.5 7.2 19"}),p.jsx("path",{d:"M13.5 15.5 16.8 19"})]})}function HL(){var c;const{projects:e,activeProject:n,setActiveProject:r,isMultiProject:o}=Ig(),[i,s]=x.useState(!1),a=x.useRef(null);x.useEffect(()=>{if(!i)return;const u=f=>{a.current&&!a.current.contains(f.target)&&s(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]);const l=((c=e.find(u=>u.root===n))==null?void 0:c.name)??"Project";return o?p.jsxs("div",{className:"relative",ref:a,children:[p.jsxs("button",{onClick:()=>s(!i),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-lg border border-border/50 hover:bg-muted/50 transition-colors",children:[l,p.jsx(cd,{className:`h-3.5 w-3.5 text-muted-foreground transition-transform ${i?"rotate-180":""}`})]}),i&&p.jsx("div",{className:"absolute top-full left-0 mt-1 w-56 rounded-lg border border-border bg-card shadow-lg z-50 py-1",children:e.map(u=>p.jsxs("button",{onClick:()=>{r(u.root),s(!1)},className:`flex items-center gap-2 w-full px-3 py-2 text-sm text-left hover:bg-muted/50 transition-colors ${u.root===n?"bg-purple-500/10 text-purple-400":""}`,children:[p.jsx("span",{className:"flex-1 truncate",children:u.name}),u.hasGraphs&&p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-green-500 shrink-0",title:"Graphs generated"})]},u.root))})]}):p.jsx("span",{className:"text-sm font-medium text-muted-foreground px-2",children:l})}function UL(){return p.jsxs("header",{className:"sticky top-0 z-40 flex h-[var(--header-height)] items-center border-b bg-background/80 px-4 shadow-sm backdrop-blur-md",children:[p.jsxs("span",{className:"logo",children:[p.jsx("span",{className:"logo-icon",children:p.jsx(BL,{})}),p.jsx("span",{className:"logo-text",children:"LaunchChart"})]}),p.jsx("div",{className:"mx-4",children:p.jsx(HL,{})}),p.jsx("div",{className:"ml-auto flex items-center gap-2",children:p.jsx(zL,{})})]})}const VL=[{to:"/overview",label:"Overview",icon:oA},{to:"/modules",label:"Modules",icon:ld},{to:"/sitemap",label:"Sitemap",icon:dA},{to:"/journeys",label:"User Journeys",icon:SA},{to:"/project-graph",label:"Project Graph",icon:mA},{to:"/audit",label:"Audit",icon:F_},{to:"/settings",label:"Settings",icon:z_}],WL="sidebar-nav-item active relative flex items-center gap-3 overflow-hidden rounded-lg px-3 py-1.5 text-sm bg-gradient-to-r from-sidebar-primary/20 via-transparent via-80% to-transparent font-medium text-sidebar-foreground before:absolute before:left-0 before:top-0 before:h-full before:w-[3px] before:rounded-full before:bg-sidebar-primary",GL="sidebar-nav-item relative flex w-full items-center gap-3 overflow-hidden rounded-lg px-3 py-1.5 text-sm font-normal text-sidebar-muted-foreground transition-colors duration-200 hover:text-sidebar-foreground bg-transparent border-none cursor-pointer";function YL(){return p.jsx("aside",{className:"hidden lg:flex lg:flex-col w-[var(--sidebar-width)] sidebar-gradient",children:p.jsx("nav",{className:"flex-1 overflow-y-auto px-3 py-4",children:p.jsx("ul",{className:"space-y-1",children:VL.map(e=>{const n=e.icon;return p.jsx("li",{children:p.jsxs(n3,{to:e.to,className:({isActive:r})=>r?WL:GL,children:[p.jsx(n,{className:"h-4 w-4 shrink-0"}),e.label]})},e.to)})})})})}function XL(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,s,a,l=[],c=!0,u=!1;try{if(s=(r=r.call(e)).next,n===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(o=s.call(r)).done)&&(l.push(o.value),l.length!==n);c=!0);}catch(f){u=!0,i=f}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function KL(e,n,r){return n=r6(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function $y(e,n){return ZL(e)||XL(e,n)||EC(e,n)||t6()}function qL(e){return QL(e)||JL(e)||EC(e)||e6()}function QL(e){if(Array.isArray(e))return xp(e)}function ZL(e){if(Array.isArray(e))return e}function JL(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function EC(e,n){if(e){if(typeof e=="string")return xp(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xp(e,n)}}function xp(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=new Array(n);r<n;r++)o[r]=e[r];return o}function e6(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
385
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function t6(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
386
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n6(e,n){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function r6(e){var n=n6(e,"string");return typeof n=="symbol"?n:String(n)}var o6=function(n,r){var o=new Set(r);return Object.assign.apply(Object,[{}].concat(qL(Object.entries(n).filter(function(i){var s=$y(i,1),a=s[0];return!o.has(a)}).map(function(i){var s=$y(i,2),a=s[0],l=s[1];return KL({},a,l)}))))};function wp(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function i6(e){if(Array.isArray(e))return e}function s6(e){if(Array.isArray(e))return wp(e)}function a6(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function l6(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,s,a,l=[],c=!0,u=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(o=s.call(r)).done)&&(l.push(o.value),l.length!==n);c=!0);}catch(f){u=!0,i=f}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function c6(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
387
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u6(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
388
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function d6(e,n){return i6(e)||l6(e,n)||jC(e,n)||c6()}function Dy(e){return s6(e)||a6(e)||jC(e)||u6()}function jC(e,n){if(e){if(typeof e=="string")return wp(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?wp(e,n):void 0}}function f6(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.wrapperElementType,o=r===void 0?"div":r,i=n.nodeMapper,s=i===void 0?function(f){return f}:i,a=n.methodNames,l=a===void 0?[]:a,c=n.initPropNames,u=c===void 0?[]:c;return x.forwardRef(function(f,d){var h=x.useRef(),g=x.useMemo(function(){var _=Object.fromEntries(u.filter(function(m){return f.hasOwnProperty(m)}).map(function(m){return[m,f[m]]}));return e(_)},[]);Ly(function(){g(s(h.current))},x.useLayoutEffect),Ly(function(){return g._destructor instanceof Function?g._destructor:void 0});var v=x.useCallback(function(_){for(var m=arguments.length,w=new Array(m>1?m-1:0),y=1;y<m;y++)w[y-1]=arguments[y];return g[_]instanceof Function?g[_].apply(g,w):void 0},[g]),b=x.useRef({});return Object.keys(o6(f,[].concat(Dy(l),Dy(u)))).filter(function(_){return b.current[_]!==f[_]}).forEach(function(_){return v(_,f[_])}),b.current=f,x.useImperativeHandle(d,function(){return Object.fromEntries(l.map(function(_){return[_,function(){for(var m=arguments.length,w=new Array(m),y=0;y<m;y++)w[y]=arguments[y];return v.apply(void 0,[_].concat(w))}]}))},[v]),it.createElement(o,{ref:h})})}function Ly(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:x.useEffect,r=x.useRef(),o=x.useRef(!1),i=x.useRef(!1),s=x.useState(0),a=d6(s,2);a[0];var l=a[1];o.current&&(i.current=!0),n(function(){return o.current||(r.current=e(),o.current=!0),l(function(c){return c+1}),function(){i.current&&r.current&&r.current()}},[])}var bp="http://www.w3.org/1999/xhtml";const zy={svg:"http://www.w3.org/2000/svg",xhtml:bp,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Td(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),zy.hasOwnProperty(n)?{space:zy[n],local:e}:e}function h6(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===bp&&n.documentElement.namespaceURI===bp?n.createElement(e):n.createElementNS(r,e)}}function p6(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function PC(e){var n=Td(e);return(n.local?p6:h6)(n)}function m6(){}function Og(e){return e==null?m6:function(){return this.querySelector(e)}}function g6(e){typeof e!="function"&&(e=Og(e));for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i)for(var s=n[i],a=s.length,l=o[i]=new Array(a),c,u,f=0;f<a;++f)(c=s[f])&&(u=e.call(c,c.__data__,f,s))&&("__data__"in c&&(u.__data__=c.__data__),l[f]=u);return new $t(o,this._parents)}function v6(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function y6(){return[]}function MC(e){return e==null?y6:function(){return this.querySelectorAll(e)}}function x6(e){return function(){return v6(e.apply(this,arguments))}}function w6(e){typeof e=="function"?e=x6(e):e=MC(e);for(var n=this._groups,r=n.length,o=[],i=[],s=0;s<r;++s)for(var a=n[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&(o.push(e.call(c,c.__data__,u,a)),i.push(c));return new $t(o,i)}function RC(e){return function(){return this.matches(e)}}function AC(e){return function(n){return n.matches(e)}}var b6=Array.prototype.find;function _6(e){return function(){return b6.call(this.children,e)}}function S6(){return this.firstElementChild}function k6(e){return this.select(e==null?S6:_6(typeof e=="function"?e:AC(e)))}var C6=Array.prototype.filter;function N6(){return Array.from(this.children)}function E6(e){return function(){return C6.call(this.children,e)}}function j6(e){return this.selectAll(e==null?N6:E6(typeof e=="function"?e:AC(e)))}function P6(e){typeof e!="function"&&(e=RC(e));for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i)for(var s=n[i],a=s.length,l=o[i]=[],c,u=0;u<a;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new $t(o,this._parents)}function TC(e){return new Array(e.length)}function M6(){return new $t(this._enter||this._groups.map(TC),this._parents)}function wu(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}wu.prototype={constructor:wu,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function R6(e){return function(){return e}}function A6(e,n,r,o,i,s){for(var a=0,l,c=n.length,u=s.length;a<u;++a)(l=n[a])?(l.__data__=s[a],o[a]=l):r[a]=new wu(e,s[a]);for(;a<c;++a)(l=n[a])&&(i[a]=l)}function T6(e,n,r,o,i,s,a){var l,c,u=new Map,f=n.length,d=s.length,h=new Array(f),g;for(l=0;l<f;++l)(c=n[l])&&(h[l]=g=a.call(c,c.__data__,l,n)+"",u.has(g)?i[l]=c:u.set(g,c));for(l=0;l<d;++l)g=a.call(e,s[l],l,s)+"",(c=u.get(g))?(o[l]=c,c.__data__=s[l],u.delete(g)):r[l]=new wu(e,s[l]);for(l=0;l<f;++l)(c=n[l])&&u.get(h[l])===c&&(i[l]=c)}function I6(e){return e.__data__}function O6(e,n){if(!arguments.length)return Array.from(this,I6);var r=n?T6:A6,o=this._parents,i=this._groups;typeof e!="function"&&(e=R6(e));for(var s=i.length,a=new Array(s),l=new Array(s),c=new Array(s),u=0;u<s;++u){var f=o[u],d=i[u],h=d.length,g=$6(e.call(f,f&&f.__data__,u,o)),v=g.length,b=l[u]=new Array(v),_=a[u]=new Array(v),m=c[u]=new Array(h);r(f,d,b,_,m,g,n);for(var w=0,y=0,S,k;w<v;++w)if(S=b[w]){for(w>=y&&(y=w+1);!(k=_[y])&&++y<v;);S._next=k||null}}return a=new $t(a,o),a._enter=l,a._exit=c,a}function $6(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function D6(){return new $t(this._exit||this._groups.map(TC),this._parents)}function L6(e,n,r){var o=this.enter(),i=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),n!=null&&(i=n(i),i&&(i=i.selection())),r==null?s.remove():r(s),o&&i?o.merge(i).order():i}function z6(e){for(var n=e.selection?e.selection():e,r=this._groups,o=n._groups,i=r.length,s=o.length,a=Math.min(i,s),l=new Array(i),c=0;c<a;++c)for(var u=r[c],f=o[c],d=u.length,h=l[c]=new Array(d),g,v=0;v<d;++v)(g=u[v]||f[v])&&(h[v]=g);for(;c<i;++c)l[c]=r[c];return new $t(l,this._parents)}function F6(){for(var e=this._groups,n=-1,r=e.length;++n<r;)for(var o=e[n],i=o.length-1,s=o[i],a;--i>=0;)(a=o[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function B6(e){e||(e=H6);function n(d,h){return d&&h?e(d.__data__,h.__data__):!d-!h}for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s){for(var a=r[s],l=a.length,c=i[s]=new Array(l),u,f=0;f<l;++f)(u=a[f])&&(c[f]=u);c.sort(n)}return new $t(i,this._parents).order()}function H6(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function U6(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function V6(){return Array.from(this)}function W6(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=e[n],i=0,s=o.length;i<s;++i){var a=o[i];if(a)return a}return null}function G6(){let e=0;for(const n of this)++e;return e}function Y6(){return!this.node()}function X6(e){for(var n=this._groups,r=0,o=n.length;r<o;++r)for(var i=n[r],s=0,a=i.length,l;s<a;++s)(l=i[s])&&e.call(l,l.__data__,s,i);return this}function K6(e){return function(){this.removeAttribute(e)}}function q6(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Q6(e,n){return function(){this.setAttribute(e,n)}}function Z6(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function J6(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function e8(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function t8(e,n){var r=Td(e);if(arguments.length<2){var o=this.node();return r.local?o.getAttributeNS(r.space,r.local):o.getAttribute(r)}return this.each((n==null?r.local?q6:K6:typeof n=="function"?r.local?e8:J6:r.local?Z6:Q6)(r,n))}function IC(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function n8(e){return function(){this.style.removeProperty(e)}}function r8(e,n,r){return function(){this.style.setProperty(e,n,r)}}function o8(e,n,r){return function(){var o=n.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,r)}}function i8(e,n,r){return arguments.length>1?this.each((n==null?n8:typeof n=="function"?o8:r8)(e,n,r??"")):Vi(this.node(),e)}function Vi(e,n){return e.style.getPropertyValue(n)||IC(e).getComputedStyle(e,null).getPropertyValue(n)}function s8(e){return function(){delete this[e]}}function a8(e,n){return function(){this[e]=n}}function l8(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function c8(e,n){return arguments.length>1?this.each((n==null?s8:typeof n=="function"?l8:a8)(e,n)):this.node()[e]}function OC(e){return e.trim().split(/^|\s+/)}function $g(e){return e.classList||new $C(e)}function $C(e){this._node=e,this._names=OC(e.getAttribute("class")||"")}$C.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function DC(e,n){for(var r=$g(e),o=-1,i=n.length;++o<i;)r.add(n[o])}function LC(e,n){for(var r=$g(e),o=-1,i=n.length;++o<i;)r.remove(n[o])}function u8(e){return function(){DC(this,e)}}function d8(e){return function(){LC(this,e)}}function f8(e,n){return function(){(n.apply(this,arguments)?DC:LC)(this,e)}}function h8(e,n){var r=OC(e+"");if(arguments.length<2){for(var o=$g(this.node()),i=-1,s=r.length;++i<s;)if(!o.contains(r[i]))return!1;return!0}return this.each((typeof n=="function"?f8:n?u8:d8)(r,n))}function p8(){this.textContent=""}function m8(e){return function(){this.textContent=e}}function g8(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function v8(e){return arguments.length?this.each(e==null?p8:(typeof e=="function"?g8:m8)(e)):this.node().textContent}function y8(){this.innerHTML=""}function x8(e){return function(){this.innerHTML=e}}function w8(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function b8(e){return arguments.length?this.each(e==null?y8:(typeof e=="function"?w8:x8)(e)):this.node().innerHTML}function _8(){this.nextSibling&&this.parentNode.appendChild(this)}function S8(){return this.each(_8)}function k8(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function C8(){return this.each(k8)}function N8(e){var n=typeof e=="function"?e:PC(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function E8(){return null}function j8(e,n){var r=typeof e=="function"?e:PC(e),o=n==null?E8:typeof n=="function"?n:Og(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),o.apply(this,arguments)||null)})}function P8(){var e=this.parentNode;e&&e.removeChild(this)}function M8(){return this.each(P8)}function R8(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function A8(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function T8(e){return this.select(e?A8:R8)}function I8(e){return arguments.length?this.property("__data__",e):this.node().__data__}function O8(e){return function(n){e.call(this,n,this.__data__)}}function $8(e){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");return o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),{type:n,name:r}})}function D8(e){return function(){var n=this.__on;if(n){for(var r=0,o=-1,i=n.length,s;r<i;++r)s=n[r],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):n[++o]=s;++o?n.length=o:delete this.__on}}}function L8(e,n,r){return function(){var o=this.__on,i,s=O8(n);if(o){for(var a=0,l=o.length;a<l;++a)if((i=o[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=r),i.value=n;return}}this.addEventListener(e.type,s,r),i={type:e.type,name:e.name,value:n,listener:s,options:r},o?o.push(i):this.__on=[i]}}function z8(e,n,r){var o=$8(e+""),i,s=o.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,f;c<u;++c)for(i=0,f=l[c];i<s;++i)if((a=o[i]).type===f.type&&a.name===f.name)return f.value}return}for(l=n?L8:D8,i=0;i<s;++i)this.each(l(o[i],n,r));return this}function zC(e,n,r){var o=IC(e),i=o.CustomEvent;typeof i=="function"?i=new i(n,r):(i=o.document.createEvent("Event"),r?(i.initEvent(n,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(n,!1,!1)),e.dispatchEvent(i)}function F8(e,n){return function(){return zC(this,e,n)}}function B8(e,n){return function(){return zC(this,e,n.apply(this,arguments))}}function H8(e,n){return this.each((typeof n=="function"?B8:F8)(e,n))}function*U8(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=e[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&(yield a)}var FC=[null];function $t(e,n){this._groups=e,this._parents=n}function tl(){return new $t([[document.documentElement]],FC)}function V8(){return this}$t.prototype=tl.prototype={constructor:$t,select:g6,selectAll:w6,selectChild:k6,selectChildren:j6,filter:P6,data:O6,enter:M6,exit:D6,join:L6,merge:z6,selection:V8,order:F6,sort:B6,call:U6,nodes:V6,node:W6,size:G6,empty:Y6,each:X6,attr:t8,style:i8,property:c8,classed:h8,text:v8,html:b8,raise:S8,lower:C8,append:N8,insert:j8,remove:M8,clone:T8,datum:I8,on:z8,dispatch:H8,[Symbol.iterator]:U8};function at(e){return typeof e=="string"?new $t([[document.querySelector(e)]],[document.documentElement]):new $t([[e]],FC)}function W8(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Ht(e,n){if(e=W8(e),n===void 0&&(n=e.currentTarget),n){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var o=r.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(n.getScreenCTM().inverse()),[o.x,o.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[e.clientX-i.left-n.clientLeft,e.clientY-i.top-n.clientTop]}}return[e.pageX,e.pageY]}var G8={value:()=>{}};function nl(){for(var e=0,n=arguments.length,r={},o;e<n;++e){if(!(o=arguments[e]+"")||o in r||/[\s.]/.test(o))throw new Error("illegal type: "+o);r[o]=[]}return new jc(r)}function jc(e){this._=e}function Y8(e,n){return e.trim().split(/^|\s+/).map(function(r){var o="",i=r.indexOf(".");if(i>=0&&(o=r.slice(i+1),r=r.slice(0,i)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:o}})}jc.prototype=nl.prototype={constructor:jc,on:function(e,n){var r=this._,o=Y8(e+"",r),i,s=-1,a=o.length;if(arguments.length<2){for(;++s<a;)if((i=(e=o[s]).type)&&(i=X8(r[i],e.name)))return i;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++s<a;)if(i=(e=o[s]).type)r[i]=Fy(r[i],e.name,n);else if(n==null)for(i in r)r[i]=Fy(r[i],e.name,null);return this},copy:function(){var e={},n=this._;for(var r in n)e[r]=n[r].slice();return new jc(e)},call:function(e,n){if((i=arguments.length-2)>0)for(var r=new Array(i),o=0,i,s;o<i;++o)r[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,i=s.length;o<i;++o)s[o].value.apply(n,r)},apply:function(e,n,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],i=0,s=o.length;i<s;++i)o[i].value.apply(n,r)}};function X8(e,n){for(var r=0,o=e.length,i;r<o;++r)if((i=e[r]).name===n)return i.value}function Fy(e,n,r){for(var o=0,i=e.length;o<i;++o)if(e[o].name===n){e[o]=G8,e=e.slice(0,o).concat(e.slice(o+1));break}return r!=null&&e.push({name:n,value:r}),e}const K8={passive:!1},Ea={capture:!0,passive:!1};function Uf(e){e.stopImmediatePropagation()}function Pi(e){e.preventDefault(),e.stopImmediatePropagation()}function BC(e){var n=e.document.documentElement,r=at(e).on("dragstart.drag",Pi,Ea);"onselectstart"in n?r.on("selectstart.drag",Pi,Ea):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function HC(e,n){var r=e.document.documentElement,o=at(e).on("dragstart.drag",null);n&&(o.on("click.drag",Pi,Ea),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in r?o.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const Kl=e=>()=>e;function _p(e,{sourceEvent:n,subject:r,target:o,identifier:i,active:s,x:a,y:l,dx:c,dy:u,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:f}})}_p.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function q8(e){return!e.ctrlKey&&!e.button}function Q8(){return this.parentNode}function Z8(e,n){return n??{x:e.x,y:e.y}}function J8(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dg(){var e=q8,n=Q8,r=Z8,o=J8,i={},s=nl("start","drag","end"),a=0,l,c,u,f,d=0;function h(S){S.on("mousedown.drag",g).filter(o).on("touchstart.drag",_).on("touchmove.drag",m,K8).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(S,k){if(!(f||!e.call(this,S,k))){var C=y(this,n.call(this,S,k),S,k,"mouse");C&&(at(S.view).on("mousemove.drag",v,Ea).on("mouseup.drag",b,Ea),BC(S.view),Uf(S),u=!1,l=S.clientX,c=S.clientY,C("start",S))}}function v(S){if(Pi(S),!u){var k=S.clientX-l,C=S.clientY-c;u=k*k+C*C>d}i.mouse("drag",S)}function b(S){at(S.view).on("mousemove.drag mouseup.drag",null),HC(S.view,u),Pi(S),i.mouse("end",S)}function _(S,k){if(e.call(this,S,k)){var C=S.changedTouches,N=n.call(this,S,k),E=C.length,j,A;for(j=0;j<E;++j)(A=y(this,N,S,k,C[j].identifier,C[j]))&&(Uf(S),A("start",S,C[j]))}}function m(S){var k=S.changedTouches,C=k.length,N,E;for(N=0;N<C;++N)(E=i[k[N].identifier])&&(Pi(S),E("drag",S,k[N]))}function w(S){var k=S.changedTouches,C=k.length,N,E;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),N=0;N<C;++N)(E=i[k[N].identifier])&&(Uf(S),E("end",S,k[N]))}function y(S,k,C,N,E,j){var A=s.copy(),T=Ht(j||C,k),D,F,P;if((P=r.call(S,new _p("beforestart",{sourceEvent:C,target:h,identifier:E,active:a,x:T[0],y:T[1],dx:0,dy:0,dispatch:A}),N))!=null)return D=P.x-T[0]||0,F=P.y-T[1]||0,function L(I,z,R){var M=T,O;switch(I){case"start":i[E]=L,O=a++;break;case"end":delete i[E],--a;case"drag":T=Ht(R||z,k),O=a;break}A.call(I,S,new _p(I,{sourceEvent:z,subject:P,target:h,identifier:E,active:O,x:T[0]+D,y:T[1]+F,dx:T[0]-M[0],dy:T[1]-M[1],dispatch:A}),N)}}return h.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Kl(!!S),h):e},h.container=function(S){return arguments.length?(n=typeof S=="function"?S:Kl(S),h):n},h.subject=function(S){return arguments.length?(r=typeof S=="function"?S:Kl(S),h):r},h.touchable=function(S){return arguments.length?(o=typeof S=="function"?S:Kl(!!S),h):o},h.on=function(){var S=s.on.apply(s,arguments);return S===s?h:S},h.clickDistance=function(S){return arguments.length?(d=(S=+S)*S,h):Math.sqrt(d)},h}function Lg(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function UC(e,n){var r=Object.create(e.prototype);for(var o in n)r[o]=n[o];return r}function rl(){}var ja=.7,bu=1/ja,Mi="\\s*([+-]?\\d+)\\s*",Pa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Mn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ez=/^#([0-9a-f]{3,8})$/,tz=new RegExp(`^rgb\\(${Mi},${Mi},${Mi}\\)$`),nz=new RegExp(`^rgb\\(${Mn},${Mn},${Mn}\\)$`),rz=new RegExp(`^rgba\\(${Mi},${Mi},${Mi},${Pa}\\)$`),oz=new RegExp(`^rgba\\(${Mn},${Mn},${Mn},${Pa}\\)$`),iz=new RegExp(`^hsl\\(${Pa},${Mn},${Mn}\\)$`),sz=new RegExp(`^hsla\\(${Pa},${Mn},${Mn},${Pa}\\)$`),By={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};Lg(rl,Do,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Hy,formatHex:Hy,formatHex8:az,formatHsl:lz,formatRgb:Uy,toString:Uy});function Hy(){return this.rgb().formatHex()}function az(){return this.rgb().formatHex8()}function lz(){return VC(this).formatHsl()}function Uy(){return this.rgb().formatRgb()}function Do(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=ez.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?Vy(n):r===3?new wt(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?ql(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?ql(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=tz.exec(e))?new wt(n[1],n[2],n[3],1):(n=nz.exec(e))?new wt(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=rz.exec(e))?ql(n[1],n[2],n[3],n[4]):(n=oz.exec(e))?ql(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=iz.exec(e))?Yy(n[1],n[2]/100,n[3]/100,1):(n=sz.exec(e))?Yy(n[1],n[2]/100,n[3]/100,n[4]):By.hasOwnProperty(e)?Vy(By[e]):e==="transparent"?new wt(NaN,NaN,NaN,0):null}function Vy(e){return new wt(e>>16&255,e>>8&255,e&255,1)}function ql(e,n,r,o){return o<=0&&(e=n=r=NaN),new wt(e,n,r,o)}function cz(e){return e instanceof rl||(e=Do(e)),e?(e=e.rgb(),new wt(e.r,e.g,e.b,e.opacity)):new wt}function Sp(e,n,r,o){return arguments.length===1?cz(e):new wt(e,n,r,o??1)}function wt(e,n,r,o){this.r=+e,this.g=+n,this.b=+r,this.opacity=+o}Lg(wt,Sp,UC(rl,{brighter(e){return e=e==null?bu:Math.pow(bu,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ja:Math.pow(ja,e),new wt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new wt(ko(this.r),ko(this.g),ko(this.b),_u(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:Wy,formatHex:Wy,formatHex8:uz,formatRgb:Gy,toString:Gy}));function Wy(){return`#${bo(this.r)}${bo(this.g)}${bo(this.b)}`}function uz(){return`#${bo(this.r)}${bo(this.g)}${bo(this.b)}${bo((isNaN(this.opacity)?1:this.opacity)*255)}`}function Gy(){const e=_u(this.opacity);return`${e===1?"rgb(":"rgba("}${ko(this.r)}, ${ko(this.g)}, ${ko(this.b)}${e===1?")":`, ${e})`}`}function _u(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ko(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function bo(e){return e=ko(e),(e<16?"0":"")+e.toString(16)}function Yy(e,n,r,o){return o<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new ln(e,n,r,o)}function VC(e){if(e instanceof ln)return new ln(e.h,e.s,e.l,e.opacity);if(e instanceof rl||(e=Do(e)),!e)return new ln;if(e instanceof ln)return e;e=e.rgb();var n=e.r/255,r=e.g/255,o=e.b/255,i=Math.min(n,r,o),s=Math.max(n,r,o),a=NaN,l=s-i,c=(s+i)/2;return l?(n===s?a=(r-o)/l+(r<o)*6:r===s?a=(o-n)/l+2:a=(n-r)/l+4,l/=c<.5?s+i:2-s-i,a*=60):l=c>0&&c<1?0:a,new ln(a,l,c,e.opacity)}function dz(e,n,r,o){return arguments.length===1?VC(e):new ln(e,n,r,o??1)}function ln(e,n,r,o){this.h=+e,this.s=+n,this.l=+r,this.opacity=+o}Lg(ln,dz,UC(rl,{brighter(e){return e=e==null?bu:Math.pow(bu,e),new ln(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ja:Math.pow(ja,e),new ln(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,o=r+(r<.5?r:1-r)*n,i=2*r-o;return new wt(Vf(e>=240?e-240:e+120,i,o),Vf(e,i,o),Vf(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new ln(Xy(this.h),Ql(this.s),Ql(this.l),_u(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=_u(this.opacity);return`${e===1?"hsl(":"hsla("}${Xy(this.h)}, ${Ql(this.s)*100}%, ${Ql(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Xy(e){return e=(e||0)%360,e<0?e+360:e}function Ql(e){return Math.max(0,Math.min(1,e||0))}function Vf(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const zg=e=>()=>e;function fz(e,n){return function(r){return e+r*n}}function hz(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(o){return Math.pow(e+o*n,r)}}function pz(e){return(e=+e)==1?WC:function(n,r){return r-n?hz(n,r,e):zg(isNaN(n)?r:n)}}function WC(e,n){var r=n-e;return r?fz(e,r):zg(isNaN(e)?n:e)}const Su=function e(n){var r=pz(n);function o(i,s){var a=r((i=Sp(i)).r,(s=Sp(s)).r),l=r(i.g,s.g),c=r(i.b,s.b),u=WC(i.opacity,s.opacity);return function(f){return i.r=a(f),i.g=l(f),i.b=c(f),i.opacity=u(f),i+""}}return o.gamma=e,o}(1);function mz(e,n){n||(n=[]);var r=e?Math.min(n.length,e.length):0,o=n.slice(),i;return function(s){for(i=0;i<r;++i)o[i]=e[i]*(1-s)+n[i]*s;return o}}function gz(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function vz(e,n){var r=n?n.length:0,o=e?Math.min(r,e.length):0,i=new Array(o),s=new Array(r),a;for(a=0;a<o;++a)i[a]=Js(e[a],n[a]);for(;a<r;++a)s[a]=n[a];return function(l){for(a=0;a<o;++a)s[a]=i[a](l);return s}}function yz(e,n){var r=new Date;return e=+e,n=+n,function(o){return r.setTime(e*(1-o)+n*o),r}}function _n(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}function xz(e,n){var r={},o={},i;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(i in n)i in e?r[i]=Js(e[i],n[i]):o[i]=n[i];return function(s){for(i in r)o[i]=r[i](s);return o}}var kp=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wf=new RegExp(kp.source,"g");function wz(e){return function(){return e}}function bz(e){return function(n){return e(n)+""}}function GC(e,n){var r=kp.lastIndex=Wf.lastIndex=0,o,i,s,a=-1,l=[],c=[];for(e=e+"",n=n+"";(o=kp.exec(e))&&(i=Wf.exec(n));)(s=i.index)>r&&(s=n.slice(r,s),l[a]?l[a]+=s:l[++a]=s),(o=o[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,c.push({i:a,x:_n(o,i)})),r=Wf.lastIndex;return r<n.length&&(s=n.slice(r),l[a]?l[a]+=s:l[++a]=s),l.length<2?c[0]?bz(c[0].x):wz(n):(n=c.length,function(u){for(var f=0,d;f<n;++f)l[(d=c[f]).i]=d.x(u);return l.join("")})}function Js(e,n){var r=typeof n,o;return n==null||r==="boolean"?zg(n):(r==="number"?_n:r==="string"?(o=Do(n))?(n=o,Su):GC:n instanceof Do?Su:n instanceof Date?yz:gz(n)?mz:Array.isArray(n)?vz:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?xz:_n)(e,n)}var Ky=180/Math.PI,Cp={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function YC(e,n,r,o,i,s){var a,l,c;return(a=Math.sqrt(e*e+n*n))&&(e/=a,n/=a),(c=e*r+n*o)&&(r-=e*c,o-=n*c),(l=Math.sqrt(r*r+o*o))&&(r/=l,o/=l,c/=l),e*o<n*r&&(e=-e,n=-n,c=-c,a=-a),{translateX:i,translateY:s,rotate:Math.atan2(n,e)*Ky,skewX:Math.atan(c)*Ky,scaleX:a,scaleY:l}}var Zl;function _z(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Cp:YC(n.a,n.b,n.c,n.d,n.e,n.f)}function Sz(e){return e==null||(Zl||(Zl=document.createElementNS("http://www.w3.org/2000/svg","g")),Zl.setAttribute("transform",e),!(e=Zl.transform.baseVal.consolidate()))?Cp:(e=e.matrix,YC(e.a,e.b,e.c,e.d,e.e,e.f))}function XC(e,n,r,o){function i(u){return u.length?u.pop()+" ":""}function s(u,f,d,h,g,v){if(u!==d||f!==h){var b=g.push("translate(",null,n,null,r);v.push({i:b-4,x:_n(u,d)},{i:b-2,x:_n(f,h)})}else(d||h)&&g.push("translate("+d+n+h+r)}function a(u,f,d,h){u!==f?(u-f>180?f+=360:f-u>180&&(u+=360),h.push({i:d.push(i(d)+"rotate(",null,o)-2,x:_n(u,f)})):f&&d.push(i(d)+"rotate("+f+o)}function l(u,f,d,h){u!==f?h.push({i:d.push(i(d)+"skewX(",null,o)-2,x:_n(u,f)}):f&&d.push(i(d)+"skewX("+f+o)}function c(u,f,d,h,g,v){if(u!==d||f!==h){var b=g.push(i(g)+"scale(",null,",",null,")");v.push({i:b-4,x:_n(u,d)},{i:b-2,x:_n(f,h)})}else(d!==1||h!==1)&&g.push(i(g)+"scale("+d+","+h+")")}return function(u,f){var d=[],h=[];return u=e(u),f=e(f),s(u.translateX,u.translateY,f.translateX,f.translateY,d,h),a(u.rotate,f.rotate,d,h),l(u.skewX,f.skewX,d,h),c(u.scaleX,u.scaleY,f.scaleX,f.scaleY,d,h),u=f=null,function(g){for(var v=-1,b=h.length,_;++v<b;)d[(_=h[v]).i]=_.x(g);return d.join("")}}}var kz=XC(_z,"px, ","px)","deg)"),Cz=XC(Sz,", ",")",")"),Nz=1e-12;function qy(e){return((e=Math.exp(e))+1/e)/2}function Ez(e){return((e=Math.exp(e))-1/e)/2}function jz(e){return((e=Math.exp(2*e))-1)/(e+1)}const Pc=function e(n,r,o){function i(s,a){var l=s[0],c=s[1],u=s[2],f=a[0],d=a[1],h=a[2],g=f-l,v=d-c,b=g*g+v*v,_,m;if(b<Nz)m=Math.log(h/u)/n,_=function(N){return[l+N*g,c+N*v,u*Math.exp(n*N*m)]};else{var w=Math.sqrt(b),y=(h*h-u*u+o*b)/(2*u*r*w),S=(h*h-u*u-o*b)/(2*h*r*w),k=Math.log(Math.sqrt(y*y+1)-y),C=Math.log(Math.sqrt(S*S+1)-S);m=(C-k)/n,_=function(N){var E=N*m,j=qy(k),A=u/(r*w)*(j*jz(n*E+k)-Ez(k));return[l+A*g,c+A*v,u*j/qy(n*E+k)]}}return _.duration=m*1e3*n/Math.SQRT2,_}return i.rho=function(s){var a=Math.max(.001,+s),l=a*a,c=l*l;return e(a,l,c)},i}(Math.SQRT2,2,4);var Wi=0,Fs=0,Cs=0,KC=1e3,ku,Bs,Cu=0,Lo=0,Id=0,Ma=typeof performance=="object"&&performance.now?performance:Date,qC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Fg(){return Lo||(qC(Pz),Lo=Ma.now()+Id)}function Pz(){Lo=0}function Nu(){this._call=this._time=this._next=null}Nu.prototype=Bg.prototype={constructor:Nu,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Fg():+r)+(n==null?0:+n),!this._next&&Bs!==this&&(Bs?Bs._next=this:ku=this,Bs=this),this._call=e,this._time=r,Np()},stop:function(){this._call&&(this._call=null,this._time=1/0,Np())}};function Bg(e,n,r){var o=new Nu;return o.restart(e,n,r),o}function Mz(){Fg(),++Wi;for(var e=ku,n;e;)(n=Lo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Wi}function Qy(){Lo=(Cu=Ma.now())+Id,Wi=Fs=0;try{Mz()}finally{Wi=0,Az(),Lo=0}}function Rz(){var e=Ma.now(),n=e-Cu;n>KC&&(Id-=n,Cu=e)}function Az(){for(var e,n=ku,r,o=1/0;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:ku=r);Bs=e,Np(o)}function Np(e){if(!Wi){Fs&&(Fs=clearTimeout(Fs));var n=e-Lo;n>24?(e<1/0&&(Fs=setTimeout(Qy,e-Ma.now()-Id)),Cs&&(Cs=clearInterval(Cs))):(Cs||(Cu=Ma.now(),Cs=setInterval(Rz,KC)),Wi=1,qC(Qy))}}function Zy(e,n,r){var o=new Nu;return n=n==null?0:+n,o.restart(i=>{o.stop(),e(i+n)},n,r),o}var Tz=nl("start","end","cancel","interrupt"),Iz=[],QC=0,Jy=1,Ep=2,Mc=3,ex=4,jp=5,Rc=6;function Od(e,n,r,o,i,s){var a=e.__transition;if(!a)e.__transition={};else if(r in a)return;Oz(e,r,{name:n,index:o,group:i,on:Tz,tween:Iz,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:QC})}function Hg(e,n){var r=yn(e,n);if(r.state>QC)throw new Error("too late; already scheduled");return r}function $n(e,n){var r=yn(e,n);if(r.state>Mc)throw new Error("too late; already running");return r}function yn(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function Oz(e,n,r){var o=e.__transition,i;o[n]=r,r.timer=Bg(s,0,r.time);function s(u){r.state=Jy,r.timer.restart(a,r.delay,r.time),r.delay<=u&&a(u-r.delay)}function a(u){var f,d,h,g;if(r.state!==Jy)return c();for(f in o)if(g=o[f],g.name===r.name){if(g.state===Mc)return Zy(a);g.state===ex?(g.state=Rc,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[f]):+f<n&&(g.state=Rc,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[f])}if(Zy(function(){r.state===Mc&&(r.state=ex,r.timer.restart(l,r.delay,r.time),l(u))}),r.state=Ep,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Ep){for(r.state=Mc,i=new Array(h=r.tween.length),f=0,d=-1;f<h;++f)(g=r.tween[f].value.call(e,e.__data__,r.index,r.group))&&(i[++d]=g);i.length=d+1}}function l(u){for(var f=u<r.duration?r.ease.call(null,u/r.duration):(r.timer.restart(c),r.state=jp,1),d=-1,h=i.length;++d<h;)i[d].call(e,f);r.state===jp&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=Rc,r.timer.stop(),delete o[n];for(var u in o)return;delete e.__transition}}function Ac(e,n){var r=e.__transition,o,i,s=!0,a;if(r){n=n==null?null:n+"";for(a in r){if((o=r[a]).name!==n){s=!1;continue}i=o.state>Ep&&o.state<jp,o.state=Rc,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete r[a]}s&&delete e.__transition}}function $z(e){return this.each(function(){Ac(this,e)})}function Dz(e,n){var r,o;return function(){var i=$n(this,e),s=i.tween;if(s!==r){o=r=s;for(var a=0,l=o.length;a<l;++a)if(o[a].name===n){o=o.slice(),o.splice(a,1);break}}i.tween=o}}function Lz(e,n,r){var o,i;if(typeof r!="function")throw new Error;return function(){var s=$n(this,e),a=s.tween;if(a!==o){i=(o=a).slice();for(var l={name:n,value:r},c=0,u=i.length;c<u;++c)if(i[c].name===n){i[c]=l;break}c===u&&i.push(l)}s.tween=i}}function zz(e,n){var r=this._id;if(e+="",arguments.length<2){for(var o=yn(this.node(),r).tween,i=0,s=o.length,a;i<s;++i)if((a=o[i]).name===e)return a.value;return null}return this.each((n==null?Dz:Lz)(r,e,n))}function Ug(e,n,r){var o=e._id;return e.each(function(){var i=$n(this,o);(i.value||(i.value={}))[n]=r.apply(this,arguments)}),function(i){return yn(i,o).value[n]}}function ZC(e,n){var r;return(typeof n=="number"?_n:n instanceof Do?Su:(r=Do(n))?(n=r,Su):GC)(e,n)}function Fz(e){return function(){this.removeAttribute(e)}}function Bz(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hz(e,n,r){var o,i=r+"",s;return function(){var a=this.getAttribute(e);return a===i?null:a===o?s:s=n(o=a,r)}}function Uz(e,n,r){var o,i=r+"",s;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===o?s:s=n(o=a,r)}}function Vz(e,n,r){var o,i,s;return function(){var a,l=r(this),c;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=l+"",a===c?null:a===o&&c===i?s:(i=c,s=n(o=a,l)))}}function Wz(e,n,r){var o,i,s;return function(){var a,l=r(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=l+"",a===c?null:a===o&&c===i?s:(i=c,s=n(o=a,l)))}}function Gz(e,n){var r=Td(e),o=r==="transform"?Cz:ZC;return this.attrTween(e,typeof n=="function"?(r.local?Wz:Vz)(r,o,Ug(this,"attr."+e,n)):n==null?(r.local?Bz:Fz)(r):(r.local?Uz:Hz)(r,o,n))}function Yz(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function Xz(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function Kz(e,n){var r,o;function i(){var s=n.apply(this,arguments);return s!==o&&(r=(o=s)&&Xz(e,s)),r}return i._value=n,i}function qz(e,n){var r,o;function i(){var s=n.apply(this,arguments);return s!==o&&(r=(o=s)&&Yz(e,s)),r}return i._value=n,i}function Qz(e,n){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;var o=Td(e);return this.tween(r,(o.local?Kz:qz)(o,n))}function Zz(e,n){return function(){Hg(this,e).delay=+n.apply(this,arguments)}}function Jz(e,n){return n=+n,function(){Hg(this,e).delay=n}}function e9(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?Zz:Jz)(n,e)):yn(this.node(),n).delay}function t9(e,n){return function(){$n(this,e).duration=+n.apply(this,arguments)}}function n9(e,n){return n=+n,function(){$n(this,e).duration=n}}function r9(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?t9:n9)(n,e)):yn(this.node(),n).duration}function o9(e,n){if(typeof n!="function")throw new Error;return function(){$n(this,e).ease=n}}function i9(e){var n=this._id;return arguments.length?this.each(o9(n,e)):yn(this.node(),n).ease}function s9(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;$n(this,e).ease=r}}function a9(e){if(typeof e!="function")throw new Error;return this.each(s9(this._id,e))}function l9(e){typeof e!="function"&&(e=RC(e));for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i)for(var s=n[i],a=s.length,l=o[i]=[],c,u=0;u<a;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new ar(o,this._parents,this._name,this._id)}function c9(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,r=e._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),l=0;l<s;++l)for(var c=n[l],u=r[l],f=c.length,d=a[l]=new Array(f),h,g=0;g<f;++g)(h=c[g]||u[g])&&(d[g]=h);for(;l<o;++l)a[l]=n[l];return new ar(a,this._parents,this._name,this._id)}function u9(e){return(e+"").trim().split(/^|\s+/).every(function(n){var r=n.indexOf(".");return r>=0&&(n=n.slice(0,r)),!n||n==="start"})}function d9(e,n,r){var o,i,s=u9(n)?Hg:$n;return function(){var a=s(this,e),l=a.on;l!==o&&(i=(o=l).copy()).on(n,r),a.on=i}}function f9(e,n){var r=this._id;return arguments.length<2?yn(this.node(),r).on.on(e):this.each(d9(r,e,n))}function h9(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function p9(){return this.on("end.remove",h9(this._id))}function m9(e){var n=this._name,r=this._id;typeof e!="function"&&(e=Og(e));for(var o=this._groups,i=o.length,s=new Array(i),a=0;a<i;++a)for(var l=o[a],c=l.length,u=s[a]=new Array(c),f,d,h=0;h<c;++h)(f=l[h])&&(d=e.call(f,f.__data__,h,l))&&("__data__"in f&&(d.__data__=f.__data__),u[h]=d,Od(u[h],n,r,h,u,yn(f,r)));return new ar(s,this._parents,n,r)}function g9(e){var n=this._name,r=this._id;typeof e!="function"&&(e=MC(e));for(var o=this._groups,i=o.length,s=[],a=[],l=0;l<i;++l)for(var c=o[l],u=c.length,f,d=0;d<u;++d)if(f=c[d]){for(var h=e.call(f,f.__data__,d,c),g,v=yn(f,r),b=0,_=h.length;b<_;++b)(g=h[b])&&Od(g,n,r,b,h,v);s.push(h),a.push(f)}return new ar(s,a,n,r)}var v9=tl.prototype.constructor;function y9(){return new v9(this._groups,this._parents)}function x9(e,n){var r,o,i;return function(){var s=Vi(this,e),a=(this.style.removeProperty(e),Vi(this,e));return s===a?null:s===r&&a===o?i:i=n(r=s,o=a)}}function JC(e){return function(){this.style.removeProperty(e)}}function w9(e,n,r){var o,i=r+"",s;return function(){var a=Vi(this,e);return a===i?null:a===o?s:s=n(o=a,r)}}function b9(e,n,r){var o,i,s;return function(){var a=Vi(this,e),l=r(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Vi(this,e))),a===c?null:a===o&&c===i?s:(i=c,s=n(o=a,l))}}function _9(e,n){var r,o,i,s="style."+n,a="end."+s,l;return function(){var c=$n(this,e),u=c.on,f=c.value[s]==null?l||(l=JC(n)):void 0;(u!==r||i!==f)&&(o=(r=u).copy()).on(a,i=f),c.on=o}}function S9(e,n,r){var o=(e+="")=="transform"?kz:ZC;return n==null?this.styleTween(e,x9(e,o)).on("end.style."+e,JC(e)):typeof n=="function"?this.styleTween(e,b9(e,o,Ug(this,"style."+e,n))).each(_9(this._id,e)):this.styleTween(e,w9(e,o,n),r).on("end.style."+e,null)}function k9(e,n,r){return function(o){this.style.setProperty(e,n.call(this,o),r)}}function C9(e,n,r){var o,i;function s(){var a=n.apply(this,arguments);return a!==i&&(o=(i=a)&&k9(e,a,r)),o}return s._value=n,s}function N9(e,n,r){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;return this.tween(o,C9(e,n,r??""))}function E9(e){return function(){this.textContent=e}}function j9(e){return function(){var n=e(this);this.textContent=n??""}}function P9(e){return this.tween("text",typeof e=="function"?j9(Ug(this,"text",e)):E9(e==null?"":e+""))}function M9(e){return function(n){this.textContent=e.call(this,n)}}function R9(e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&M9(i)),n}return o._value=e,o}function A9(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,R9(e))}function T9(){for(var e=this._name,n=this._id,r=eN(),o=this._groups,i=o.length,s=0;s<i;++s)for(var a=o[s],l=a.length,c,u=0;u<l;++u)if(c=a[u]){var f=yn(c,n);Od(c,e,r,u,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new ar(o,this._parents,e,r)}function I9(){var e,n,r=this,o=r._id,i=r.size();return new Promise(function(s,a){var l={value:a},c={value:function(){--i===0&&s()}};r.each(function(){var u=$n(this,o),f=u.on;f!==e&&(n=(e=f).copy(),n._.cancel.push(l),n._.interrupt.push(l),n._.end.push(c)),u.on=n}),i===0&&s()})}var O9=0;function ar(e,n,r,o){this._groups=e,this._parents=n,this._name=r,this._id=o}function eN(){return++O9}var Fn=tl.prototype;ar.prototype={constructor:ar,select:m9,selectAll:g9,selectChild:Fn.selectChild,selectChildren:Fn.selectChildren,filter:l9,merge:c9,selection:y9,transition:T9,call:Fn.call,nodes:Fn.nodes,node:Fn.node,size:Fn.size,empty:Fn.empty,each:Fn.each,on:f9,attr:Gz,attrTween:Qz,style:S9,styleTween:N9,text:P9,textTween:A9,remove:p9,tween:zz,delay:e9,duration:r9,ease:i9,easeVarying:a9,end:I9,[Symbol.iterator]:Fn[Symbol.iterator]};function $9(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var D9={time:null,delay:0,duration:250,ease:$9};function L9(e,n){for(var r;!(r=e.__transition)||!(r=r[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return r}function z9(e){var n,r;e instanceof ar?(n=e._id,e=e._name):(n=eN(),(r=D9).time=Fg(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,s=0;s<i;++s)for(var a=o[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&Od(c,e,n,u,a,r||L9(c,n));return new ar(o,this._parents,e,n)}tl.prototype.interrupt=$z;tl.prototype.transition=z9;const Jl=e=>()=>e;function F9(e,{sourceEvent:n,target:r,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function qn(e,n,r){this.k=e,this.x=n,this.y=r}qn.prototype={constructor:qn,scale:function(e){return e===1?this:new qn(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new qn(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var $d=new qn(1,0,0);on.prototype=qn.prototype;function on(e){for(;!e.__zoom;)if(!(e=e.parentNode))return $d;return e.__zoom}function Gf(e){e.stopImmediatePropagation()}function Ns(e){e.preventDefault(),e.stopImmediatePropagation()}function B9(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function H9(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function tx(){return this.__zoom||$d}function U9(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function V9(){return navigator.maxTouchPoints||"ontouchstart"in this}function W9(e,n,r){var o=e.invertX(n[0][0])-r[0][0],i=e.invertX(n[1][0])-r[1][0],s=e.invertY(n[0][1])-r[0][1],a=e.invertY(n[1][1])-r[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function Vg(){var e=B9,n=H9,r=W9,o=U9,i=V9,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Pc,u=nl("start","zoom","end"),f,d,h,g=500,v=150,b=0,_=10;function m(P){P.property("__zoom",tx).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",j).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",T).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(P,L,I,z){var R=P.selection?P.selection():P;R.property("__zoom",tx),P!==R?k(P,L,I,z):R.interrupt().each(function(){C(this,arguments).event(z).start().zoom(null,typeof L=="function"?L.apply(this,arguments):L).end()})},m.scaleBy=function(P,L,I,z){m.scaleTo(P,function(){var R=this.__zoom.k,M=typeof L=="function"?L.apply(this,arguments):L;return R*M},I,z)},m.scaleTo=function(P,L,I,z){m.transform(P,function(){var R=n.apply(this,arguments),M=this.__zoom,O=I==null?S(R):typeof I=="function"?I.apply(this,arguments):I,V=M.invert(O),$=typeof L=="function"?L.apply(this,arguments):L;return r(y(w(M,$),O,V),R,a)},I,z)},m.translateBy=function(P,L,I,z){m.transform(P,function(){return r(this.__zoom.translate(typeof L=="function"?L.apply(this,arguments):L,typeof I=="function"?I.apply(this,arguments):I),n.apply(this,arguments),a)},null,z)},m.translateTo=function(P,L,I,z,R){m.transform(P,function(){var M=n.apply(this,arguments),O=this.__zoom,V=z==null?S(M):typeof z=="function"?z.apply(this,arguments):z;return r($d.translate(V[0],V[1]).scale(O.k).translate(typeof L=="function"?-L.apply(this,arguments):-L,typeof I=="function"?-I.apply(this,arguments):-I),M,a)},z,R)};function w(P,L){return L=Math.max(s[0],Math.min(s[1],L)),L===P.k?P:new qn(L,P.x,P.y)}function y(P,L,I){var z=L[0]-I[0]*P.k,R=L[1]-I[1]*P.k;return z===P.x&&R===P.y?P:new qn(P.k,z,R)}function S(P){return[(+P[0][0]+ +P[1][0])/2,(+P[0][1]+ +P[1][1])/2]}function k(P,L,I,z){P.on("start.zoom",function(){C(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(z).end()}).tween("zoom",function(){var R=this,M=arguments,O=C(R,M).event(z),V=n.apply(R,M),$=I==null?S(V):typeof I=="function"?I.apply(R,M):I,K=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),B=R.__zoom,U=typeof L=="function"?L.apply(R,M):L,G=c(B.invert($).concat(K/B.k),U.invert($).concat(K/U.k));return function(W){if(W===1)W=U;else{var X=G(W),q=K/X[2];W=new qn(q,$[0]-X[0]*q,$[1]-X[1]*q)}O.zoom(null,W)}})}function C(P,L,I){return!I&&P.__zooming||new N(P,L)}function N(P,L){this.that=P,this.args=L,this.active=0,this.sourceEvent=null,this.extent=n.apply(P,L),this.taps=0}N.prototype={event:function(P){return P&&(this.sourceEvent=P),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(P,L){return this.mouse&&P!=="mouse"&&(this.mouse[1]=L.invert(this.mouse[0])),this.touch0&&P!=="touch"&&(this.touch0[1]=L.invert(this.touch0[0])),this.touch1&&P!=="touch"&&(this.touch1[1]=L.invert(this.touch1[0])),this.that.__zoom=L,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(P){var L=at(this.that).datum();u.call(P,this.that,new F9(P,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:u}),L)}};function E(P,...L){if(!e.apply(this,arguments))return;var I=C(this,L).event(P),z=this.__zoom,R=Math.max(s[0],Math.min(s[1],z.k*Math.pow(2,o.apply(this,arguments)))),M=Ht(P);if(I.wheel)(I.mouse[0][0]!==M[0]||I.mouse[0][1]!==M[1])&&(I.mouse[1]=z.invert(I.mouse[0]=M)),clearTimeout(I.wheel);else{if(z.k===R)return;I.mouse=[M,z.invert(M)],Ac(this),I.start()}Ns(P),I.wheel=setTimeout(O,v),I.zoom("mouse",r(y(w(z,R),I.mouse[0],I.mouse[1]),I.extent,a));function O(){I.wheel=null,I.end()}}function j(P,...L){if(h||!e.apply(this,arguments))return;var I=P.currentTarget,z=C(this,L,!0).event(P),R=at(P.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",K,!0),M=Ht(P,I),O=P.clientX,V=P.clientY;BC(P.view),Gf(P),z.mouse=[M,this.__zoom.invert(M)],Ac(this),z.start();function $(B){if(Ns(B),!z.moved){var U=B.clientX-O,G=B.clientY-V;z.moved=U*U+G*G>b}z.event(B).zoom("mouse",r(y(z.that.__zoom,z.mouse[0]=Ht(B,I),z.mouse[1]),z.extent,a))}function K(B){R.on("mousemove.zoom mouseup.zoom",null),HC(B.view,z.moved),Ns(B),z.event(B).end()}}function A(P,...L){if(e.apply(this,arguments)){var I=this.__zoom,z=Ht(P.changedTouches?P.changedTouches[0]:P,this),R=I.invert(z),M=I.k*(P.shiftKey?.5:2),O=r(y(w(I,M),z,R),n.apply(this,L),a);Ns(P),l>0?at(this).transition().duration(l).call(k,O,z,P):at(this).call(m.transform,O,z,P)}}function T(P,...L){if(e.apply(this,arguments)){var I=P.touches,z=I.length,R=C(this,L,P.changedTouches.length===z).event(P),M,O,V,$;for(Gf(P),O=0;O<z;++O)V=I[O],$=Ht(V,this),$=[$,this.__zoom.invert($),V.identifier],R.touch0?!R.touch1&&R.touch0[2]!==$[2]&&(R.touch1=$,R.taps=0):(R.touch0=$,M=!0,R.taps=1+!!f);f&&(f=clearTimeout(f)),M&&(R.taps<2&&(d=$[0],f=setTimeout(function(){f=null},g)),Ac(this),R.start())}}function D(P,...L){if(this.__zooming){var I=C(this,L).event(P),z=P.changedTouches,R=z.length,M,O,V,$;for(Ns(P),M=0;M<R;++M)O=z[M],V=Ht(O,this),I.touch0&&I.touch0[2]===O.identifier?I.touch0[0]=V:I.touch1&&I.touch1[2]===O.identifier&&(I.touch1[0]=V);if(O=I.that.__zoom,I.touch1){var K=I.touch0[0],B=I.touch0[1],U=I.touch1[0],G=I.touch1[1],W=(W=U[0]-K[0])*W+(W=U[1]-K[1])*W,X=(X=G[0]-B[0])*X+(X=G[1]-B[1])*X;O=w(O,Math.sqrt(W/X)),V=[(K[0]+U[0])/2,(K[1]+U[1])/2],$=[(B[0]+G[0])/2,(B[1]+G[1])/2]}else if(I.touch0)V=I.touch0[0],$=I.touch0[1];else return;I.zoom("touch",r(y(O,V,$),I.extent,a))}}function F(P,...L){if(this.__zooming){var I=C(this,L).event(P),z=P.changedTouches,R=z.length,M,O;for(Gf(P),h&&clearTimeout(h),h=setTimeout(function(){h=null},g),M=0;M<R;++M)O=z[M],I.touch0&&I.touch0[2]===O.identifier?delete I.touch0:I.touch1&&I.touch1[2]===O.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(O=Ht(O,this),Math.hypot(d[0]-O[0],d[1]-O[1])<_)){var V=at(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(P){return arguments.length?(o=typeof P=="function"?P:Jl(+P),m):o},m.filter=function(P){return arguments.length?(e=typeof P=="function"?P:Jl(!!P),m):e},m.touchable=function(P){return arguments.length?(i=typeof P=="function"?P:Jl(!!P),m):i},m.extent=function(P){return arguments.length?(n=typeof P=="function"?P:Jl([[+P[0][0],+P[0][1]],[+P[1][0],+P[1][1]]]),m):n},m.scaleExtent=function(P){return arguments.length?(s[0]=+P[0],s[1]=+P[1],m):[s[0],s[1]]},m.translateExtent=function(P){return arguments.length?(a[0][0]=+P[0][0],a[1][0]=+P[1][0],a[0][1]=+P[0][1],a[1][1]=+P[1][1],m):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},m.constrain=function(P){return arguments.length?(r=P,m):r},m.duration=function(P){return arguments.length?(l=+P,m):l},m.interpolate=function(P){return arguments.length?(c=P,m):c},m.on=function(){var P=u.on.apply(u,arguments);return P===u?m:P},m.clickDistance=function(P){return arguments.length?(b=(P=+P)*P,m):Math.sqrt(b)},m.tapDistance=function(P){return arguments.length?(_=+P,m):_},m}class nx extends Map{constructor(n,r=X9){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),n!=null)for(const[o,i]of n)this.set(o,i)}get(n){return super.get(rx(this,n))}has(n){return super.has(rx(this,n))}set(n,r){return super.set(G9(this,n),r)}delete(n){return super.delete(Y9(this,n))}}function rx({_intern:e,_key:n},r){const o=n(r);return e.has(o)?e.get(o):r}function G9({_intern:e,_key:n},r){const o=n(r);return e.has(o)?e.get(o):(e.set(o,r),r)}function Y9({_intern:e,_key:n},r){const o=n(r);return e.has(o)&&(r=e.get(o),e.delete(o)),r}function X9(e){return e!==null&&typeof e=="object"?e.valueOf():e}function ox(e,n){let r;if(n===void 0)for(const o of e)o!=null&&(r<o||r===void 0&&o>=o)&&(r=o);else{let o=-1;for(let i of e)(i=n(i,++o,e))!=null&&(r<i||r===void 0&&i>=i)&&(r=i)}return r}function ix(e,n){let r;if(n===void 0)for(const o of e)o!=null&&(r>o||r===void 0&&o>=o)&&(r=o);else{let o=-1;for(let i of e)(i=n(i,++o,e))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}function K9(e,n){let r=0;for(let o of e)(o=+o)&&(r+=o);return r}var q9=typeof global=="object"&&global&&global.Object===Object&&global,Q9=typeof self=="object"&&self&&self.Object===Object&&self,tN=q9||Q9||Function("return this")(),Eu=tN.Symbol,nN=Object.prototype,Z9=nN.hasOwnProperty,J9=nN.toString,Es=Eu?Eu.toStringTag:void 0;function eF(e){var n=Z9.call(e,Es),r=e[Es];try{e[Es]=void 0;var o=!0}catch{}var i=J9.call(e);return o&&(n?e[Es]=r:delete e[Es]),i}var tF=Object.prototype,nF=tF.toString;function rF(e){return nF.call(e)}var oF="[object Null]",iF="[object Undefined]",sx=Eu?Eu.toStringTag:void 0;function sF(e){return e==null?e===void 0?iF:oF:sx&&sx in Object(e)?eF(e):rF(e)}function aF(e){return e!=null&&typeof e=="object"}var lF="[object Symbol]";function cF(e){return typeof e=="symbol"||aF(e)&&sF(e)==lF}var uF=/\s/;function dF(e){for(var n=e.length;n--&&uF.test(e.charAt(n)););return n}var fF=/^\s+/;function hF(e){return e&&e.slice(0,dF(e)+1).replace(fF,"")}function ju(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var ax=NaN,pF=/^[-+]0x[0-9a-f]+$/i,mF=/^0b[01]+$/i,gF=/^0o[0-7]+$/i,vF=parseInt;function lx(e){if(typeof e=="number")return e;if(cF(e))return ax;if(ju(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=ju(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=hF(e);var r=mF.test(e);return r||gF.test(e)?vF(e.slice(2),r?2:8):pF.test(e)?ax:+e}var Yf=function(){return tN.Date.now()},yF="Expected a function",xF=Math.max,wF=Math.min;function rN(e,n,r){var o,i,s,a,l,c,u=0,f=!1,d=!1,h=!0;if(typeof e!="function")throw new TypeError(yF);n=lx(n)||0,ju(r)&&(f=!!r.leading,d="maxWait"in r,s=d?xF(lx(r.maxWait)||0,n):s,h="trailing"in r?!!r.trailing:h);function g(C){var N=o,E=i;return o=i=void 0,u=C,a=e.apply(E,N),a}function v(C){return u=C,l=setTimeout(m,n),f?g(C):a}function b(C){var N=C-c,E=C-u,j=n-N;return d?wF(j,s-E):j}function _(C){var N=C-c,E=C-u;return c===void 0||N>=n||N<0||d&&E>=s}function m(){var C=Yf();if(_(C))return w(C);l=setTimeout(m,b(C))}function w(C){return l=void 0,h&&o?g(C):(o=i=void 0,a)}function y(){l!==void 0&&clearTimeout(l),u=0,o=c=i=l=void 0}function S(){return l===void 0?a:w(Yf())}function k(){var C=Yf(),N=_(C);if(o=arguments,i=this,c=C,N){if(l===void 0)return v(c);if(d)return clearTimeout(l),l=setTimeout(m,n),g(c)}return l===void 0&&(l=setTimeout(m,n)),a}return k.cancel=y,k.flush=S,k}var bF="Expected a function";function _F(e,n,r){var o=!0,i=!0;if(typeof e!="function")throw new TypeError(bF);return ju(r)&&(o="leading"in r?!!r.leading:o,i="trailing"in r?!!r.trailing:i),rN(e,n,{leading:o,maxWait:n,trailing:i})}var Co=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Co.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?Co.Bounce.In(e*2)*.5:Co.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),Hs=function(){return performance.now()},oN=function(){function e(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,n)}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(r){return n._tweens[r]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var n,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];for(var i=0,s=r;i<s.length;i++){var a=s[i];(n=a._group)===null||n===void 0||n.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},e.prototype.remove=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var o=0,i=n;o<i.length;o++){var s=i[o];s._group=void 0,delete this._tweens[s.getId()],delete this._tweensAddedDuringUpdate[s.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(n){return!n.isPlaying()})},e.prototype.update=function(n,r){n===void 0&&(n=Hs()),r===void 0&&(r=!0);var o=Object.keys(this._tweens);if(o.length!==0)for(;o.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<o.length;i++){var s=this._tweens[o[i]],a=!r;s&&s.update(n,a)===!1&&!r&&this.remove(s)}o=Object.keys(this._tweensAddedDuringUpdate)}},e}(),Pp={Linear:function(e,n){var r=e.length-1,o=r*n,i=Math.floor(o),s=Pp.Utils.Linear;return n<0?s(e[0],e[1],o):n>1?s(e[r],e[r-1],r-o):s(e[i],e[i+1>r?r:i+1],o-i)},Utils:{Linear:function(e,n,r){return(n-e)*r+e}}},iN=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Mp=new oN,cx=function(){function e(n,r){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Co.Linear.None,this._interpolationFunction=Pp.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=iN.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=n,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=Mp,Mp.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(n,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,r){if(n===void 0&&(n=Hs()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var o in this._valuesStartRepeat)this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var s in this._valuesEnd)i[s]=this._valuesEnd[s];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,r,o,i,s){for(var a in o){var l=n[a],c=Array.isArray(l),u=c?"array":typeof l,f=!c&&Array.isArray(o[a]);if(!(u==="undefined"||u==="function")){if(f){var d=o[a];if(d.length===0)continue;for(var h=[l],g=0,v=d.length;g<v;g+=1){var b=this._handleRelativeValue(l,d[g]);if(isNaN(b)){f=!1,console.warn("Found invalid interpolation list. Skipping.");break}h.push(b)}f&&(o[a]=h)}if((u==="object"||c)&&l&&!f){r[a]=c?[]:{};var _=l;for(var m in _)r[a][m]=_[m];i[a]=c?[]:{};var d=o[a];if(!this._isDynamic){var w={};for(var m in d)w[m]=d[m];o[a]=d=w}this._setupProperties(_,r[a],d,i[a],s)}else(typeof r[a]>"u"||s)&&(r[a]=l),c||(r[a]*=1),f?i[a]=o[a].slice().reverse():i[a]=r[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(n){return n===void 0&&(n=Hs()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this)},e.prototype.resume=function(n){return n===void 0&&(n=Hs()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var n=0,r=this._chainedTweens.length;n<r;n++)this._chainedTweens[n].stop();return this},e.prototype.group=function(n){return n?(n.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var n;return(n=this._group)===null||n===void 0||n.remove(this),this},e.prototype.delay=function(n){return n===void 0&&(n=0),this._delayTime=n,this},e.prototype.repeat=function(n){return n===void 0&&(n=0),this._initialRepeat=n,this._repeat=n,this},e.prototype.repeatDelay=function(n){return this._repeatDelayTime=n,this},e.prototype.yoyo=function(n){return n===void 0&&(n=!1),this._yoyo=n,this},e.prototype.easing=function(n){return n===void 0&&(n=Co.Linear.None),this._easingFunction=n,this},e.prototype.interpolation=function(n){return n===void 0&&(n=Pp.Linear),this._interpolationFunction=n,this},e.prototype.chain=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return this._chainedTweens=n,this},e.prototype.onStart=function(n){return this._onStartCallback=n,this},e.prototype.onEveryStart=function(n){return this._onEveryStartCallback=n,this},e.prototype.onUpdate=function(n){return this._onUpdateCallback=n,this},e.prototype.onRepeat=function(n){return this._onRepeatCallback=n,this},e.prototype.onComplete=function(n){return this._onCompleteCallback=n,this},e.prototype.onStop=function(n){return this._onStopCallback=n,this},e.prototype.update=function(n,r){var o=this,i;if(n===void 0&&(n=Hs()),r===void 0&&(r=e.autoStartOnUpdate),this._isPaused)return!0;var s;if(!this._goToEnd&&!this._isPlaying)if(r)this.start(n,!0);else return!1;if(this._goToEnd=!1,n<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=n-this._startTime,l=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),c=this._duration+this._repeat*l,u=function(){if(o._duration===0||a>c)return 1;var b=Math.trunc(a/l),_=a-b*l,m=Math.min(_/o._duration,1);return m===0&&a===o._duration?1:m},f=u(),d=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,d),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||a>=this._duration)if(this._repeat>0){var h=Math.min(Math.trunc((a-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=h);for(s in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[s]=="string"&&(this._valuesStartRepeat[s]=this._valuesStartRepeat[s]+parseFloat(this._valuesEnd[s])),this._yoyo&&this._swapEndStartRepeatValues(s),this._valuesStart[s]=this._valuesStartRepeat[s];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*h,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var g=0,v=this._chainedTweens.length;g<v;g++)this._chainedTweens[g].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(n,r,o,i){for(var s in o)if(r[s]!==void 0){var a=r[s]||0,l=o[s],c=Array.isArray(n[s]),u=Array.isArray(l),f=!c&&u;f?n[s]=this._interpolationFunction(l,i):typeof l=="object"&&l?this._updateProperties(n[s],a,l,i):(l=this._handleRelativeValue(a,l),typeof l=="number"&&(n[s]=a+(l-a)*i))}},e.prototype._handleRelativeValue=function(n,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?n+parseFloat(r):parseFloat(r)},e.prototype._swapEndStartRepeatValues=function(n){var r=this._valuesStartRepeat[n],o=this._valuesEnd[n];typeof o=="string"?this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(o):this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=r},e.autoStartOnUpdate=!1,e}();iN.nextId;var Tn=Mp;Tn.getAll.bind(Tn);Tn.removeAll.bind(Tn);Tn.add.bind(Tn);Tn.remove.bind(Tn);Tn.update.bind(Tn);function ux(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function SF(e){if(Array.isArray(e))return e}function kF(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function CF(e,n,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function NF(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,s,a,l=[],c=!0,u=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(o=s.call(r)).done)&&(l.push(o.value),l.length!==n);c=!0);}catch(f){u=!0,i=f}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function EF(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
389
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jF(e,n){return SF(e)||NF(e,n)||PF(e,n)||EF()}function PF(e,n){if(e){if(typeof e=="string")return ux(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ux(e,n):void 0}}var MF=CF(function e(n,r){var o=r.default,i=o===void 0?null:o,s=r.triggerUpdate,a=s===void 0?!0:s,l=r.onChange,c=l===void 0?function(u,f){}:l;kF(this,e),this.name=n,this.defaultVal=i,this.triggerUpdate=a,this.onChange=c});function Wg(e){var n=e.stateInit,r=n===void 0?function(){return{}}:n,o=e.props,i=o===void 0?{}:o,s=e.methods,a=s===void 0?{}:s,l=e.aliases,c=l===void 0?{}:l,u=e.init,f=u===void 0?function(){}:u,d=e.update,h=d===void 0?function(){}:d,g=Object.keys(i).map(function(v){return new MF(v,i[v])});return function v(){for(var b=arguments.length,_=new Array(b),m=0;m<b;m++)_[m]=arguments[m];var w=!!(this instanceof v&&this.constructor),y=w?_.shift():void 0,S=_[0],k=S===void 0?{}:S,C=Object.assign({},r instanceof Function?r(k):r,{initialised:!1}),N={};function E(T){return j(T,k),A(),E}var j=function(D,F){f.call(E,D,C,F),C.initialised=!0},A=rN(function(){C.initialised&&(h.call(E,C,N),N={})},1);return g.forEach(function(T){E[T.name]=D(T);function D(F){var P=F.name,L=F.triggerUpdate,I=L===void 0?!1:L,z=F.onChange,R=z===void 0?function(V,$){}:z,M=F.defaultVal,O=M===void 0?null:M;return function(V){var $=C[P];if(!arguments.length)return $;var K=V===void 0?O:V;return C[P]=K,R.call(E,K,C,$),!N.hasOwnProperty(P)&&(N[P]=$),I&&A(),E}}}),Object.keys(a).forEach(function(T){E[T]=function(){for(var D,F=arguments.length,P=new Array(F),L=0;L<F;L++)P[L]=arguments[L];return(D=a[T]).call.apply(D,[E,C].concat(P))}}),Object.entries(c).forEach(function(T){var D=jF(T,2),F=D[0],P=D[1];return E[F]=E[P]}),E.resetProps=function(){return g.forEach(function(T){E[T.name](T.defaultVal)}),E},E.resetProps(),C._rerender=A,w&&y&&E(y),E}}var _e=function(e){return typeof e=="function"?e:typeof e=="string"?function(n){return n[e]}:function(n){return e}};function Pu(e){"@babel/helpers - typeof";return Pu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Pu(e)}var RF=/^\s+/,AF=/\s+$/;function le(e,n){if(e=e||"",n=n||{},e instanceof le)return e;if(!(this instanceof le))return new le(e,n);var r=TF(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=n.format||r.format,this._gradientType=n.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}le.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var n=this.toRgb();return(n.r*299+n.g*587+n.b*114)/1e3},getLuminance:function(){var n=this.toRgb(),r,o,i,s,a,l;return r=n.r/255,o=n.g/255,i=n.b/255,r<=.03928?s=r/12.92:s=Math.pow((r+.055)/1.055,2.4),o<=.03928?a=o/12.92:a=Math.pow((o+.055)/1.055,2.4),i<=.03928?l=i/12.92:l=Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*a+.0722*l},setAlpha:function(n){return this._a=sN(n),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var n=fx(this._r,this._g,this._b);return{h:n.h*360,s:n.s,v:n.v,a:this._a}},toHsvString:function(){var n=fx(this._r,this._g,this._b),r=Math.round(n.h*360),o=Math.round(n.s*100),i=Math.round(n.v*100);return this._a==1?"hsv("+r+", "+o+"%, "+i+"%)":"hsva("+r+", "+o+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var n=dx(this._r,this._g,this._b);return{h:n.h*360,s:n.s,l:n.l,a:this._a}},toHslString:function(){var n=dx(this._r,this._g,this._b),r=Math.round(n.h*360),o=Math.round(n.s*100),i=Math.round(n.l*100);return this._a==1?"hsl("+r+", "+o+"%, "+i+"%)":"hsla("+r+", "+o+"%, "+i+"%, "+this._roundA+")"},toHex:function(n){return hx(this._r,this._g,this._b,n)},toHexString:function(n){return"#"+this.toHex(n)},toHex8:function(n){return DF(this._r,this._g,this._b,this._a,n)},toHex8String:function(n){return"#"+this.toHex8(n)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Me(this._r,255)*100)+"%",g:Math.round(Me(this._g,255)*100)+"%",b:Math.round(Me(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Me(this._r,255)*100)+"%, "+Math.round(Me(this._g,255)*100)+"%, "+Math.round(Me(this._b,255)*100)+"%)":"rgba("+Math.round(Me(this._r,255)*100)+"%, "+Math.round(Me(this._g,255)*100)+"%, "+Math.round(Me(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:KF[hx(this._r,this._g,this._b,!0)]||!1},toFilter:function(n){var r="#"+px(this._r,this._g,this._b,this._a),o=r,i=this._gradientType?"GradientType = 1, ":"";if(n){var s=le(n);o="#"+px(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+r+",endColorstr="+o+")"},toString:function(n){var r=!!n;n=n||this._format;var o=!1,i=this._a<1&&this._a>=0,s=!r&&i&&(n==="hex"||n==="hex6"||n==="hex3"||n==="hex4"||n==="hex8"||n==="name");return s?n==="name"&&this._a===0?this.toName():this.toRgbString():(n==="rgb"&&(o=this.toRgbString()),n==="prgb"&&(o=this.toPercentageRgbString()),(n==="hex"||n==="hex6")&&(o=this.toHexString()),n==="hex3"&&(o=this.toHexString(!0)),n==="hex4"&&(o=this.toHex8String(!0)),n==="hex8"&&(o=this.toHex8String()),n==="name"&&(o=this.toName()),n==="hsl"&&(o=this.toHslString()),n==="hsv"&&(o=this.toHsvString()),o||this.toHexString())},clone:function(){return le(this.toString())},_applyModification:function(n,r){var o=n.apply(null,[this].concat([].slice.call(r)));return this._r=o._r,this._g=o._g,this._b=o._b,this.setAlpha(o._a),this},lighten:function(){return this._applyModification(BF,arguments)},brighten:function(){return this._applyModification(HF,arguments)},darken:function(){return this._applyModification(UF,arguments)},desaturate:function(){return this._applyModification(LF,arguments)},saturate:function(){return this._applyModification(zF,arguments)},greyscale:function(){return this._applyModification(FF,arguments)},spin:function(){return this._applyModification(VF,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(YF,arguments)},complement:function(){return this._applyCombination(WF,arguments)},monochromatic:function(){return this._applyCombination(XF,arguments)},splitcomplement:function(){return this._applyCombination(GF,arguments)},triad:function(){return this._applyCombination(mx,[3])},tetrad:function(){return this._applyCombination(mx,[4])}};le.fromRatio=function(e,n){if(Pu(e)=="object"){var r={};for(var o in e)e.hasOwnProperty(o)&&(o==="a"?r[o]=e[o]:r[o]=Us(e[o]));e=r}return le(e,n)};function TF(e){var n={r:0,g:0,b:0},r=1,o=null,i=null,s=null,a=!1,l=!1;return typeof e=="string"&&(e=JF(e)),Pu(e)=="object"&&(Bn(e.r)&&Bn(e.g)&&Bn(e.b)?(n=IF(e.r,e.g,e.b),a=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Bn(e.h)&&Bn(e.s)&&Bn(e.v)?(o=Us(e.s),i=Us(e.v),n=$F(e.h,o,i),a=!0,l="hsv"):Bn(e.h)&&Bn(e.s)&&Bn(e.l)&&(o=Us(e.s),s=Us(e.l),n=OF(e.h,o,s),a=!0,l="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=sN(r),{ok:a,format:e.format||l,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:r}}function IF(e,n,r){return{r:Me(e,255)*255,g:Me(n,255)*255,b:Me(r,255)*255}}function dx(e,n,r){e=Me(e,255),n=Me(n,255),r=Me(r,255);var o=Math.max(e,n,r),i=Math.min(e,n,r),s,a,l=(o+i)/2;if(o==i)s=a=0;else{var c=o-i;switch(a=l>.5?c/(2-o-i):c/(o+i),o){case e:s=(n-r)/c+(n<r?6:0);break;case n:s=(r-e)/c+2;break;case r:s=(e-n)/c+4;break}s/=6}return{h:s,s:a,l}}function OF(e,n,r){var o,i,s;e=Me(e,360),n=Me(n,100),r=Me(r,100);function a(u,f,d){return d<0&&(d+=1),d>1&&(d-=1),d<1/6?u+(f-u)*6*d:d<1/2?f:d<2/3?u+(f-u)*(2/3-d)*6:u}if(n===0)o=i=s=r;else{var l=r<.5?r*(1+n):r+n-r*n,c=2*r-l;o=a(c,l,e+1/3),i=a(c,l,e),s=a(c,l,e-1/3)}return{r:o*255,g:i*255,b:s*255}}function fx(e,n,r){e=Me(e,255),n=Me(n,255),r=Me(r,255);var o=Math.max(e,n,r),i=Math.min(e,n,r),s,a,l=o,c=o-i;if(a=o===0?0:c/o,o==i)s=0;else{switch(o){case e:s=(n-r)/c+(n<r?6:0);break;case n:s=(r-e)/c+2;break;case r:s=(e-n)/c+4;break}s/=6}return{h:s,s:a,v:l}}function $F(e,n,r){e=Me(e,360)*6,n=Me(n,100),r=Me(r,100);var o=Math.floor(e),i=e-o,s=r*(1-n),a=r*(1-i*n),l=r*(1-(1-i)*n),c=o%6,u=[r,a,s,s,l,r][c],f=[l,r,r,a,s,s][c],d=[s,s,l,r,r,a][c];return{r:u*255,g:f*255,b:d*255}}function hx(e,n,r,o){var i=[cn(Math.round(e).toString(16)),cn(Math.round(n).toString(16)),cn(Math.round(r).toString(16))];return o&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function DF(e,n,r,o,i){var s=[cn(Math.round(e).toString(16)),cn(Math.round(n).toString(16)),cn(Math.round(r).toString(16)),cn(aN(o))];return i&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function px(e,n,r,o){var i=[cn(aN(o)),cn(Math.round(e).toString(16)),cn(Math.round(n).toString(16)),cn(Math.round(r).toString(16))];return i.join("")}le.equals=function(e,n){return!e||!n?!1:le(e).toRgbString()==le(n).toRgbString()};le.random=function(){return le.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function LF(e,n){n=n===0?0:n||10;var r=le(e).toHsl();return r.s-=n/100,r.s=Dd(r.s),le(r)}function zF(e,n){n=n===0?0:n||10;var r=le(e).toHsl();return r.s+=n/100,r.s=Dd(r.s),le(r)}function FF(e){return le(e).desaturate(100)}function BF(e,n){n=n===0?0:n||10;var r=le(e).toHsl();return r.l+=n/100,r.l=Dd(r.l),le(r)}function HF(e,n){n=n===0?0:n||10;var r=le(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(n/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(n/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(n/100)))),le(r)}function UF(e,n){n=n===0?0:n||10;var r=le(e).toHsl();return r.l-=n/100,r.l=Dd(r.l),le(r)}function VF(e,n){var r=le(e).toHsl(),o=(r.h+n)%360;return r.h=o<0?360+o:o,le(r)}function WF(e){var n=le(e).toHsl();return n.h=(n.h+180)%360,le(n)}function mx(e,n){if(isNaN(n)||n<=0)throw new Error("Argument to polyad must be a positive number");for(var r=le(e).toHsl(),o=[le(e)],i=360/n,s=1;s<n;s++)o.push(le({h:(r.h+s*i)%360,s:r.s,l:r.l}));return o}function GF(e){var n=le(e).toHsl(),r=n.h;return[le(e),le({h:(r+72)%360,s:n.s,l:n.l}),le({h:(r+216)%360,s:n.s,l:n.l})]}function YF(e,n,r){n=n||6,r=r||30;var o=le(e).toHsl(),i=360/r,s=[le(e)];for(o.h=(o.h-(i*n>>1)+720)%360;--n;)o.h=(o.h+i)%360,s.push(le(o));return s}function XF(e,n){n=n||6;for(var r=le(e).toHsv(),o=r.h,i=r.s,s=r.v,a=[],l=1/n;n--;)a.push(le({h:o,s:i,v:s})),s=(s+l)%1;return a}le.mix=function(e,n,r){r=r===0?0:r||50;var o=le(e).toRgb(),i=le(n).toRgb(),s=r/100,a={r:(i.r-o.r)*s+o.r,g:(i.g-o.g)*s+o.g,b:(i.b-o.b)*s+o.b,a:(i.a-o.a)*s+o.a};return le(a)};le.readability=function(e,n){var r=le(e),o=le(n);return(Math.max(r.getLuminance(),o.getLuminance())+.05)/(Math.min(r.getLuminance(),o.getLuminance())+.05)};le.isReadable=function(e,n,r){var o=le.readability(e,n),i,s;switch(s=!1,i=e7(r),i.level+i.size){case"AAsmall":case"AAAlarge":s=o>=4.5;break;case"AAlarge":s=o>=3;break;case"AAAsmall":s=o>=7;break}return s};le.mostReadable=function(e,n,r){var o=null,i=0,s,a,l,c;r=r||{},a=r.includeFallbackColors,l=r.level,c=r.size;for(var u=0;u<n.length;u++)s=le.readability(e,n[u]),s>i&&(i=s,o=le(n[u]));return le.isReadable(e,o,{level:l,size:c})||!a?o:(r.includeFallbackColors=!1,le.mostReadable(e,["#fff","#000"],r))};var Rp=le.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},KF=le.hexNames=qF(Rp);function qF(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function sN(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Me(e,n){QF(e)&&(e="100%");var r=ZF(e);return e=Math.min(n,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*n,10)/100),Math.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function Dd(e){return Math.min(1,Math.max(0,e))}function jt(e){return parseInt(e,16)}function QF(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function ZF(e){return typeof e=="string"&&e.indexOf("%")!=-1}function cn(e){return e.length==1?"0"+e:""+e}function Us(e){return e<=1&&(e=e*100+"%"),e}function aN(e){return Math.round(parseFloat(e)*255).toString(16)}function gx(e){return jt(e)/255}var tn=function(){var e="[-\\+]?\\d+%?",n="[-\\+]?\\d*\\.\\d+%?",r="(?:"+n+")|(?:"+e+")",o="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+o),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+o),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+o),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Bn(e){return!!tn.CSS_UNIT.exec(e)}function JF(e){e=e.replace(RF,"").replace(AF,"").toLowerCase();var n=!1;if(Rp[e])e=Rp[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=tn.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=tn.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=tn.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=tn.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=tn.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=tn.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=tn.hex8.exec(e))?{r:jt(r[1]),g:jt(r[2]),b:jt(r[3]),a:gx(r[4]),format:n?"name":"hex8"}:(r=tn.hex6.exec(e))?{r:jt(r[1]),g:jt(r[2]),b:jt(r[3]),format:n?"name":"hex"}:(r=tn.hex4.exec(e))?{r:jt(r[1]+""+r[1]),g:jt(r[2]+""+r[2]),b:jt(r[3]+""+r[3]),a:gx(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=tn.hex3.exec(e))?{r:jt(r[1]+""+r[1]),g:jt(r[2]+""+r[2]),b:jt(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function e7(e){var n,r;return e=e||{level:"AA",size:"small"},n=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),n!=="AA"&&n!=="AAA"&&(n="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:n,size:r}}function Ap(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function t7(e){if(Array.isArray(e))return Ap(e)}function lN(e,n,r){if(typeof e=="function"?e===n:e.has(n))return arguments.length<3?n:r;throw new TypeError("Private element is not present on this object")}function n7(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function r7(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function zt(e,n){return e.get(lN(e,n))}function vx(e,n,r){n7(e,n),n.set(e,r)}function yx(e,n,r){return e.set(lN(e,n),r),r}function o7(e,n){for(var r=0;r<n.length;r++){var o=n[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,u7(o.key),o)}}function i7(e,n,r){return n&&o7(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s7(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a7(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
390
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function l7(e){return t7(e)||s7(e)||d7(e)||a7()}function c7(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function u7(e){var n=c7(e,"string");return typeof n=="symbol"?n:n+""}function d7(e,n){if(e){if(typeof e=="string")return Ap(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ap(e,n):void 0}}var f7=123,h7=function(n){return"#".concat(Math.min(n,Math.pow(2,24)).toString(16).padStart(6,"0"))},cN=function(n,r,o){return(n<<16)+(r<<8)+o},p7=function(n){var r=le(n).toRgb(),o=r.r,i=r.g,s=r.b;return cN(o,i,s)},xx=function(n,r){return n*f7%Math.pow(2,r)},ho=new WeakMap,Hn=new WeakMap,m7=function(){function e(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:6;r7(this,e),vx(this,ho,void 0),vx(this,Hn,void 0),yx(Hn,this,n),this.reset()}return i7(e,[{key:"reset",value:function(){yx(ho,this,["__reserved for background__"])}},{key:"register",value:function(r){if(zt(ho,this).length>=Math.pow(2,24-zt(Hn,this)))return null;var o=zt(ho,this).length,i=xx(o,zt(Hn,this)),s=h7(o+(i<<24-zt(Hn,this)));return zt(ho,this).push(r),s}},{key:"lookup",value:function(r){if(!r)return null;var o=typeof r=="string"?p7(r):cN.apply(void 0,l7(r));if(!o)return null;var i=o&Math.pow(2,24-zt(Hn,this))-1,s=o>>24-zt(Hn,this)&Math.pow(2,zt(Hn,this))-1;return xx(i,zt(Hn,this))!==s||i>=zt(ho,this).length?null:zt(ho,this)[i]}}])}(),ol,Ae,uN,dN,Cr,wx,fN,hN,Xf,Tc,ea,pN,Gg,Tp,Ip,Mu={},Ru=[],g7=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ld=Array.isArray;function Nn(e,n){for(var r in n)e[r]=n[r];return e}function Yg(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function v7(e,n,r){var o,i,s,a={};for(s in n)s=="key"?o=n[s]:s=="ref"?i=n[s]:a[s]=n[s];if(arguments.length>2&&(a.children=arguments.length>3?ol.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)a[s]===void 0&&(a[s]=e.defaultProps[s]);return ta(e,a,o,i,null)}function ta(e,n,r,o,i){var s={type:e,props:n,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++uN,__i:-1,__u:0};return i==null&&Ae.vnode!=null&&Ae.vnode(s),s}function zd(e){return e.children}function Ic(e,n){this.props=e,this.context=n}function Gi(e,n){if(n==null)return e.__?Gi(e.__,e.__i+1):null;for(var r;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Gi(e):null}function y7(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,o=[],i=[],s=Nn({},n);s.__v=n.__v+1,Ae.vnode&&Ae.vnode(s),Xg(e.__P,s,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,o,r??Gi(n),!!(32&n.__u),i),s.__v=n.__v,s.__.__k[s.__i]=s,yN(o,s,i),n.__e=n.__=null,s.__e!=r&&mN(s)}}function mN(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),mN(e)}function bx(e){(!e.__d&&(e.__d=!0)&&Cr.push(e)&&!Au.__r++||wx!=Ae.debounceRendering)&&((wx=Ae.debounceRendering)||fN)(Au)}function Au(){try{for(var e,n=1;Cr.length;)Cr.length>n&&Cr.sort(hN),e=Cr.shift(),n=Cr.length,y7(e)}finally{Cr.length=Au.__r=0}}function gN(e,n,r,o,i,s,a,l,c,u,f){var d,h,g,v,b,_,m,w=o&&o.__k||Ru,y=n.length;for(c=x7(r,n,w,c,y),d=0;d<y;d++)(g=r.__k[d])!=null&&(h=g.__i!=-1&&w[g.__i]||Mu,g.__i=d,_=Xg(e,g,h,i,s,a,l,c,u,f),v=g.__e,g.ref&&h.ref!=g.ref&&(h.ref&&Kg(h.ref,null,g),f.push(g.ref,g.__c||v,g)),b==null&&v!=null&&(b=v),(m=!!(4&g.__u))||h.__k===g.__k?(c=vN(g,c,e,m),m&&h.__e&&(h.__e=null)):typeof g.type=="function"&&_!==void 0?c=_:v&&(c=v.nextSibling),g.__u&=-7);return r.__e=b,c}function x7(e,n,r,o,i){var s,a,l,c,u,f=r.length,d=f,h=0;for(e.__k=new Array(i),s=0;s<i;s++)(a=n[s])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[s]=ta(null,a,null,null,null):Ld(a)?a=e.__k[s]=ta(zd,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[s]=ta(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[s]=a,c=s+h,a.__=e,a.__b=e.__b+1,l=null,(u=a.__i=w7(a,r,c,d))!=-1&&(d--,(l=r[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(i>f?h--:i<f&&h++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?h--:u==c+1?h++:(u>c?h--:h++,a.__u|=4))):e.__k[s]=null;if(d)for(s=0;s<f;s++)(l=r[s])!=null&&!(2&l.__u)&&(l.__e==o&&(o=Gi(l)),wN(l,l));return o}function vN(e,n,r,o){var i,s;if(typeof e.type=="function"){for(i=e.__k,s=0;i&&s<i.length;s++)i[s]&&(i[s].__=e,n=vN(i[s],n,r,o));return n}e.__e!=n&&(o&&(n&&e.type&&!n.parentNode&&(n=Gi(e)),r.insertBefore(e.__e,n||null)),n=e.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function w7(e,n,r,o){var i,s,a,l=e.key,c=e.type,u=n[r],f=u!=null&&(2&u.__u)==0;if(u===null&&l==null||f&&l==u.key&&c==u.type)return r;if(o>(f?1:0)){for(i=r-1,s=r+1;i>=0||s<n.length;)if((u=n[a=i>=0?i--:s++])!=null&&!(2&u.__u)&&l==u.key&&c==u.type)return a}return-1}function _x(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||g7.test(n)?r:r+"px"}function ec(e,n,r,o,i){var s,a;e:if(n=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(n in o)r&&n in r||_x(e.style,n,"");if(r)for(n in r)o&&r[n]==o[n]||_x(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")s=n!=(n=n.replace(pN,"$1")),a=n.toLowerCase(),n=a in e||n=="onFocusOut"||n=="onFocusIn"?a.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+s]=r,r?o?r[ea]=o[ea]:(r[ea]=Gg,e.addEventListener(n,s?Ip:Tp,s)):e.removeEventListener(n,s?Ip:Tp,s);else{if(i=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&r==1?"":r))}}function Sx(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n[Tc]==null)n[Tc]=Gg++;else if(n[Tc]<r[ea])return;return r(Ae.event?Ae.event(n):n)}}}function Xg(e,n,r,o,i,s,a,l,c,u){var f,d,h,g,v,b,_,m,w,y,S,k,C,N,E,j=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(c=!!(32&r.__u),s=[l=n.__e=r.__e]),(f=Ae.__b)&&f(n);e:if(typeof j=="function")try{if(m=n.props,w=j.prototype&&j.prototype.render,y=(f=j.contextType)&&o[f.__c],S=f?y?y.props.value:f.__:o,r.__c?_=(d=n.__c=r.__c).__=d.__E:(w?n.__c=d=new j(m,S):(n.__c=d=new Ic(m,S),d.constructor=j,d.render=_7),y&&y.sub(d),d.state||(d.state={}),d.__n=o,h=d.__d=!0,d.__h=[],d._sb=[]),w&&d.__s==null&&(d.__s=d.state),w&&j.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Nn({},d.__s)),Nn(d.__s,j.getDerivedStateFromProps(m,d.__s))),g=d.props,v=d.state,d.__v=n,h)w&&j.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),w&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(w&&j.getDerivedStateFromProps==null&&m!==g&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(m,S),n.__v==r.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(m,d.__s,S)===!1){n.__v!=r.__v&&(d.props=m,d.state=d.__s,d.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(A){A&&(A.__=n)}),Ru.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(m,d.__s,S),w&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(g,v,b)})}if(d.context=S,d.props=m,d.__P=e,d.__e=!1,k=Ae.__r,C=0,w)d.state=d.__s,d.__d=!1,k&&k(n),f=d.render(d.props,d.state,d.context),Ru.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,k&&k(n),f=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++C<25);d.state=d.__s,d.getChildContext!=null&&(o=Nn(Nn({},o),d.getChildContext())),w&&!h&&d.getSnapshotBeforeUpdate!=null&&(b=d.getSnapshotBeforeUpdate(g,v)),N=f!=null&&f.type===zd&&f.key==null?xN(f.props.children):f,l=gN(e,Ld(N)?N:[N],n,r,o,i,s,a,l,c,u),d.base=n.__e,n.__u&=-161,d.__h.length&&a.push(d),_&&(d.__E=d.__=null)}catch(A){if(n.__v=null,c||s!=null)if(A.then){for(n.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;s[s.indexOf(l)]=null,n.__e=l}else{for(E=s.length;E--;)Yg(s[E]);Op(n)}else n.__e=r.__e,n.__k=r.__k,A.then||Op(n);Ae.__e(A,n,r)}else s==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):l=n.__e=b7(r.__e,n,r,o,i,s,a,c,u);return(f=Ae.diffed)&&f(n),128&n.__u?void 0:l}function Op(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Op))}function yN(e,n,r){for(var o=0;o<r.length;o++)Kg(r[o],r[++o],r[++o]);Ae.__c&&Ae.__c(n,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(s){s.call(i)})}catch(s){Ae.__e(s,i.__v)}})}function xN(e){return typeof e!="object"||e==null||e.__b>0?e:Ld(e)?e.map(xN):Nn({},e)}function b7(e,n,r,o,i,s,a,l,c){var u,f,d,h,g,v,b,_=r.props||Mu,m=n.props,w=n.type;if(w=="svg"?i="http://www.w3.org/2000/svg":w=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(u=0;u<s.length;u++)if((g=s[u])&&"setAttribute"in g==!!w&&(w?g.localName==w:g.nodeType==3)){e=g,s[u]=null;break}}if(e==null){if(w==null)return document.createTextNode(m);e=document.createElementNS(i,w,m.is&&m),l&&(Ae.__m&&Ae.__m(n,s),l=!1),s=null}if(w==null)_===m||l&&e.data==m||(e.data=m);else{if(s=s&&ol.call(e.childNodes),!l&&s!=null)for(_={},u=0;u<e.attributes.length;u++)_[(g=e.attributes[u]).name]=g.value;for(u in _)g=_[u],u=="dangerouslySetInnerHTML"?d=g:u=="children"||u in m||u=="value"&&"defaultValue"in m||u=="checked"&&"defaultChecked"in m||ec(e,u,null,g,i);for(u in m)g=m[u],u=="children"?h=g:u=="dangerouslySetInnerHTML"?f=g:u=="value"?v=g:u=="checked"?b=g:l&&typeof g!="function"||_[u]===g||ec(e,u,g,_[u],i);if(f)l||d&&(f.__html==d.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),n.__k=[];else if(d&&(e.innerHTML=""),gN(n.type=="template"?e.content:e,Ld(h)?h:[h],n,r,o,w=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,a,s?s[0]:r.__k&&Gi(r,0),l,c),s!=null)for(u=s.length;u--;)Yg(s[u]);l||(u="value",w=="progress"&&v==null?e.removeAttribute("value"):v!=null&&(v!==e[u]||w=="progress"&&!v||w=="option"&&v!=_[u])&&ec(e,u,v,_[u],i),u="checked",b!=null&&b!=e[u]&&ec(e,u,b,_[u],i))}return e}function Kg(e,n,r){try{if(typeof e=="function"){var o=typeof e.__u=="function";o&&e.__u(),o&&n==null||(e.__u=e(n))}else e.current=n}catch(i){Ae.__e(i,r)}}function wN(e,n,r){var o,i;if(Ae.unmount&&Ae.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||Kg(o,null,n)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(s){Ae.__e(s,n)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&wN(o[i],n,r||typeof e.type!="function");r||Yg(e.__e),e.__c=e.__=e.__e=void 0}function _7(e,n,r){return this.constructor(e,r)}function S7(e,n,r){var o,i,s,a;n==document&&(n=document.documentElement),Ae.__&&Ae.__(e,n),i=(o=!1)?null:n.__k,s=[],a=[],Xg(n,e=n.__k=v7(zd,null,[e]),i||Mu,Mu,n.namespaceURI,i?null:n.firstChild?ol.call(n.childNodes):null,s,i?i.__e:n.firstChild,o,a),yN(s,e,a)}function bN(e,n,r){var o,i,s,a,l=Nn({},e.props);for(s in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),n)s=="key"?o=n[s]:s=="ref"?i=n[s]:l[s]=n[s]===void 0&&a!=null?a[s]:n[s];return arguments.length>2&&(l.children=arguments.length>3?ol.call(arguments,2):r),ta(e.type,l,o||e.key,i||e.ref,null)}ol=Ru.slice,Ae={__e:function(e,n,r,o){for(var i,s,a;n=n.__;)if((i=n.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,o||{}),a=i.__d),a)return i.__E=i}catch(l){e=l}throw e}},uN=0,dN=function(e){return e!=null&&e.constructor===void 0},Ic.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Nn({},this.state),typeof e=="function"&&(e=e(Nn({},r),this.props)),e&&Nn(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),bx(this))},Ic.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),bx(this))},Ic.prototype.render=zd,Cr=[],fN=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,hN=function(e,n){return e.__v.__b-n.__v.__b},Au.__r=0,Xf=Math.random().toString(8),Tc="__d"+Xf,ea="__a"+Xf,pN=/(PointerCapture)$|Capture$/i,Gg=0,Tp=Sx(!1),Ip=Sx(!0);function kx(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function k7(e){if(Array.isArray(e))return e}function C7(e,n,r){return(n=R7(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function N7(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,s,a,l=[],c=!0,u=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(o=s.call(r)).done)&&(l.push(o.value),l.length!==n);c=!0);}catch(f){u=!0,i=f}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function E7(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
391
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cx(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,o)}return r}function j7(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Cx(Object(r),!0).forEach(function(o){C7(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cx(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function P7(e,n){return k7(e)||N7(e,n)||A7(e,n)||E7()}function M7(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function R7(e){var n=M7(e,"string");return typeof n=="symbol"?n:n+""}function Tu(e){"@babel/helpers - typeof";return Tu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Tu(e)}function A7(e,n){if(e){if(typeof e=="string")return kx(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?kx(e,n):void 0}}var $p=function(n){if(Tu(n)!=="object")return n;var r=bN(n);if(r.props){var o;r.props=j7({},r.props),r!=null&&(o=r.props)!==null&&o!==void 0&&o.children&&(r.props.children=Array.isArray(r.props.children)?r.props.children.map($p):$p(r.props.children))}return r},T7=function(n){return dN(bN(n))},I7=function(n,r){delete r.__k,S7($p(n),r)};function O7(e,n){n===void 0&&(n={});var r=n.insertAt;if(!(typeof document>"u")){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",r==="top"&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var $7=`.float-tooltip-kap {
|
|
387
392
|
position: absolute;
|
|
388
393
|
width: max-content; /* prevent shrinking near right edge */
|
|
389
394
|
max-width: max(50%, 150px);
|
|
@@ -394,9 +399,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
394
399
|
background: rgba(0,0,0,0.6);
|
|
395
400
|
pointer-events: none;
|
|
396
401
|
}
|
|
397
|
-
`;T7(I7);var O7=Wg({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(n,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.style,s=i===void 0?{}:i,a=!!n&&Tu(n)==="object"&&!!n.node&&typeof n.node=="function",l=at(a?n.node():n);l.style("position")==="static"&&l.style("position","relative"),r.tooltipEl=l.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(u){var f=E7(u,2),d=f[0],h=f[1];return r.tooltipEl.style(d,h)}),r.tooltipEl.style("left","-10000px").style("display","none");var c="tooltip-".concat(Math.round(Math.random()*1e12));r.mouseInside=!1,l.on("mousemove.".concat(c),function(u){r.mouseInside=!0;var f=Ht(u),d=l.node(),h=d.offsetWidth,g=d.offsetHeight,v=[r.offsetX===null||r.offsetX===void 0?"-".concat(f[0]/h*100,"%"):typeof r.offsetX=="number"?"calc(-50% + ".concat(r.offsetX,"px)"):r.offsetX,r.offsetY===null||r.offsetY===void 0?g>130&&g-f[1]<100?"calc(-100% - 6px)":"21px":typeof r.offsetY=="number"?r.offsetY<0?"calc(-100% - ".concat(Math.abs(r.offsetY),"px)"):"".concat(r.offsetY,"px"):r.offsetY];r.tooltipEl.style("left",f[0]+"px").style("top",f[1]+"px").style("transform","translate(".concat(v.join(","),")")),r.content&&r.tooltipEl.style("display","inline")}),l.on("mouseover.".concat(c),function(){r.mouseInside=!0,r.content&&r.tooltipEl.style("display","inline")}),l.on("mouseout.".concat(c),function(){r.mouseInside=!1,r.tooltipEl.style("display","none")})},update:function(n){n.tooltipEl.style("display",n.content&&n.mouseInside?"inline":"none"),n.content?n.content instanceof HTMLElement?(n.tooltipEl.text(""),n.tooltipEl.append(function(){return n.content})):typeof n.content=="string"?n.tooltipEl.html(n.content):R7(n.content)?(n.tooltipEl.text(""),A7(n.content,n.tooltipEl.node())):(n.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",n.content,n.content.toString())):n.tooltipEl.text("")}});function $7(e,n,r){var o,i=1;e==null&&(e=0),n==null&&(n=0),r==null&&(r=0);function s(){var a,l=o.length,c,u=0,f=0,d=0;for(a=0;a<l;++a)c=o[a],u+=c.x||0,f+=c.y||0,d+=c.z||0;for(u=(u/l-e)*i,f=(f/l-n)*i,d=(d/l-r)*i,a=0;a<l;++a)c=o[a],u&&(c.x-=u),f&&(c.y-=f),d&&(c.z-=d)}return s.initialize=function(a){o=a},s.x=function(a){return arguments.length?(e=+a,s):e},s.y=function(a){return arguments.length?(n=+a,s):n},s.z=function(a){return arguments.length?(r=+a,s):r},s.strength=function(a){return arguments.length?(i=+a,s):i},s}function D7(e){const n=+this._x.call(null,e);return _N(this.cover(n),n,e)}function _N(e,n,r){if(isNaN(n))return e;var o,i=e._root,s={data:r},a=e._x0,l=e._x1,c,u,f,d,h;if(!i)return e._root=s,e;for(;i.length;)if((f=n>=(c=(a+l)/2))?a=c:l=c,o=i,!(i=i[d=+f]))return o[d]=s,e;if(u=+e._x.call(null,i.data),n===u)return s.next=i,o?o[d]=s:e._root=s,e;do o=o?o[d]=new Array(2):e._root=new Array(2),(f=n>=(c=(a+l)/2))?a=c:l=c;while((d=+f)==(h=+(u>=c)));return o[h]=i,o[d]=s,e}function L7(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n);let o=1/0,i=-1/0;for(let s=0,a;s<n;++s)isNaN(a=+this._x.call(null,e[s]))||(r[s]=a,a<o&&(o=a),a>i&&(i=a));if(o>i)return this;this.cover(o).cover(i);for(let s=0;s<n;++s)_N(this,r[s],e[s]);return this}function z7(e){if(isNaN(e=+e))return this;var n=this._x0,r=this._x1;if(isNaN(n))r=(n=Math.floor(e))+1;else{for(var o=r-n||1,i=this._root,s,a;n>e||e>=r;)switch(a=+(e<n),s=new Array(2),s[a]=i,i=s,o*=2,a){case 0:r=n+o;break;case 1:n=r-o;break}this._root&&this._root.length&&(this._root=i)}return this._x0=n,this._x1=r,this}function F7(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function B7(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function Jn(e,n,r){this.node=e,this.x0=n,this.x1=r}function H7(e,n){var r,o=this._x0,i,s,a=this._x1,l=[],c=this._root,u,f;for(c&&l.push(new Jn(c,o,a)),n==null?n=1/0:(o=e-n,a=e+n);u=l.pop();)if(!(!(c=u.node)||(i=u.x0)>a||(s=u.x1)<o))if(c.length){var d=(i+s)/2;l.push(new Jn(c[1],d,s),new Jn(c[0],i,d)),(f=+(e>=d))&&(u=l[l.length-1],l[l.length-1]=l[l.length-1-f],l[l.length-1-f]=u)}else{var h=Math.abs(e-+this._x.call(null,c.data));h<n&&(n=h,o=e-h,a=e+h,r=c.data)}return r}function U7(e){if(isNaN(c=+this._x.call(null,e)))return this;var n,r=this._root,o,i,s,a=this._x0,l=this._x1,c,u,f,d,h;if(!r)return this;if(r.length)for(;;){if((f=c>=(u=(a+l)/2))?a=u:l=u,n=r,!(r=r[d=+f]))return this;if(!r.length)break;n[d+1&1]&&(o=n,h=d)}for(;r.data!==e;)if(i=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,i?(s?i.next=s:delete i.next,this):n?(s?n[d]=s:delete n[d],(r=n[0]||n[1])&&r===(n[1]||n[0])&&!r.length&&(o?o[h]=r:this._root=r),this):(this._root=s,this)}function V7(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function W7(){return this._root}function G7(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function Y7(e){var n=[],r,o=this._root,i,s,a;for(o&&n.push(new Jn(o,this._x0,this._x1));r=n.pop();)if(!e(o=r.node,s=r.x0,a=r.x1)&&o.length){var l=(s+a)/2;(i=o[1])&&n.push(new Jn(i,l,a)),(i=o[0])&&n.push(new Jn(i,s,l))}return this}function X7(e){var n=[],r=[],o;for(this._root&&n.push(new Jn(this._root,this._x0,this._x1));o=n.pop();){var i=o.node;if(i.length){var s,a=o.x0,l=o.x1,c=(a+l)/2;(s=i[0])&&n.push(new Jn(s,a,c)),(s=i[1])&&n.push(new Jn(s,c,l))}r.push(o)}for(;o=r.pop();)e(o.node,o.x0,o.x1);return this}function K7(e){return e[0]}function q7(e){return arguments.length?(this._x=e,this):this._x}function SN(e,n){var r=new qg(n??K7,NaN,NaN);return e==null?r:r.addAll(e)}function qg(e,n,r){this._x=e,this._x0=n,this._x1=r,this._root=void 0}function Nx(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Et=SN.prototype=qg.prototype;Et.copy=function(){var e=new qg(this._x,this._x0,this._x1),n=this._root,r,o;if(!n)return e;if(!n.length)return e._root=Nx(n),e;for(r=[{source:n,target:e._root=new Array(2)}];n=r.pop();)for(var i=0;i<2;++i)(o=n.source[i])&&(o.length?r.push({source:o,target:n.target[i]=new Array(2)}):n.target[i]=Nx(o));return e};Et.add=D7;Et.addAll=L7;Et.cover=z7;Et.data=F7;Et.extent=B7;Et.find=H7;Et.remove=U7;Et.removeAll=V7;Et.root=W7;Et.size=G7;Et.visit=Y7;Et.visitAfter=X7;Et.x=q7;function Q7(e){const n=+this._x.call(null,e),r=+this._y.call(null,e);return kN(this.cover(n,r),n,r,e)}function kN(e,n,r,o){if(isNaN(n)||isNaN(r))return e;var i,s=e._root,a={data:o},l=e._x0,c=e._y0,u=e._x1,f=e._y1,d,h,g,v,b,_,m,w;if(!s)return e._root=a,e;for(;s.length;)if((b=n>=(d=(l+u)/2))?l=d:u=d,(_=r>=(h=(c+f)/2))?c=h:f=h,i=s,!(s=s[m=_<<1|b]))return i[m]=a,e;if(g=+e._x.call(null,s.data),v=+e._y.call(null,s.data),n===g&&r===v)return a.next=s,i?i[m]=a:e._root=a,e;do i=i?i[m]=new Array(4):e._root=new Array(4),(b=n>=(d=(l+u)/2))?l=d:u=d,(_=r>=(h=(c+f)/2))?c=h:f=h;while((m=_<<1|b)===(w=(v>=h)<<1|g>=d));return i[w]=s,i[m]=a,e}function Z7(e){var n,r,o=e.length,i,s,a=new Array(o),l=new Array(o),c=1/0,u=1/0,f=-1/0,d=-1/0;for(r=0;r<o;++r)isNaN(i=+this._x.call(null,n=e[r]))||isNaN(s=+this._y.call(null,n))||(a[r]=i,l[r]=s,i<c&&(c=i),i>f&&(f=i),s<u&&(u=s),s>d&&(d=s));if(c>f||u>d)return this;for(this.cover(c,u).cover(f,d),r=0;r<o;++r)kN(this,a[r],l[r],e[r]);return this}function J7(e,n){if(isNaN(e=+e)||isNaN(n=+n))return this;var r=this._x0,o=this._y0,i=this._x1,s=this._y1;if(isNaN(r))i=(r=Math.floor(e))+1,s=(o=Math.floor(n))+1;else{for(var a=i-r||1,l=this._root,c,u;r>e||e>=i||o>n||n>=s;)switch(u=(n<o)<<1|e<r,c=new Array(4),c[u]=l,l=c,a*=2,u){case 0:i=r+a,s=o+a;break;case 1:r=i-a,s=o+a;break;case 2:i=r+a,o=s-a;break;case 3:r=i-a,o=s-a;break}this._root&&this._root.length&&(this._root=l)}return this._x0=r,this._y0=o,this._x1=i,this._y1=s,this}function eB(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function tB(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function dt(e,n,r,o,i){this.node=e,this.x0=n,this.y0=r,this.x1=o,this.y1=i}function nB(e,n,r){var o,i=this._x0,s=this._y0,a,l,c,u,f=this._x1,d=this._y1,h=[],g=this._root,v,b;for(g&&h.push(new dt(g,i,s,f,d)),r==null?r=1/0:(i=e-r,s=n-r,f=e+r,d=n+r,r*=r);v=h.pop();)if(!(!(g=v.node)||(a=v.x0)>f||(l=v.y0)>d||(c=v.x1)<i||(u=v.y1)<s))if(g.length){var _=(a+c)/2,m=(l+u)/2;h.push(new dt(g[3],_,m,c,u),new dt(g[2],a,m,_,u),new dt(g[1],_,l,c,m),new dt(g[0],a,l,_,m)),(b=(n>=m)<<1|e>=_)&&(v=h[h.length-1],h[h.length-1]=h[h.length-1-b],h[h.length-1-b]=v)}else{var w=e-+this._x.call(null,g.data),y=n-+this._y.call(null,g.data),S=w*w+y*y;if(S<r){var k=Math.sqrt(r=S);i=e-k,s=n-k,f=e+k,d=n+k,o=g.data}}return o}function rB(e){if(isNaN(f=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var n,r=this._root,o,i,s,a=this._x0,l=this._y0,c=this._x1,u=this._y1,f,d,h,g,v,b,_,m;if(!r)return this;if(r.length)for(;;){if((v=f>=(h=(a+c)/2))?a=h:c=h,(b=d>=(g=(l+u)/2))?l=g:u=g,n=r,!(r=r[_=b<<1|v]))return this;if(!r.length)break;(n[_+1&3]||n[_+2&3]||n[_+3&3])&&(o=n,m=_)}for(;r.data!==e;)if(i=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,i?(s?i.next=s:delete i.next,this):n?(s?n[_]=s:delete n[_],(r=n[0]||n[1]||n[2]||n[3])&&r===(n[3]||n[2]||n[1]||n[0])&&!r.length&&(o?o[m]=r:this._root=r),this):(this._root=s,this)}function oB(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function iB(){return this._root}function sB(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function aB(e){var n=[],r,o=this._root,i,s,a,l,c;for(o&&n.push(new dt(o,this._x0,this._y0,this._x1,this._y1));r=n.pop();)if(!e(o=r.node,s=r.x0,a=r.y0,l=r.x1,c=r.y1)&&o.length){var u=(s+l)/2,f=(a+c)/2;(i=o[3])&&n.push(new dt(i,u,f,l,c)),(i=o[2])&&n.push(new dt(i,s,f,u,c)),(i=o[1])&&n.push(new dt(i,u,a,l,f)),(i=o[0])&&n.push(new dt(i,s,a,u,f))}return this}function lB(e){var n=[],r=[],o;for(this._root&&n.push(new dt(this._root,this._x0,this._y0,this._x1,this._y1));o=n.pop();){var i=o.node;if(i.length){var s,a=o.x0,l=o.y0,c=o.x1,u=o.y1,f=(a+c)/2,d=(l+u)/2;(s=i[0])&&n.push(new dt(s,a,l,f,d)),(s=i[1])&&n.push(new dt(s,f,l,c,d)),(s=i[2])&&n.push(new dt(s,a,d,f,u)),(s=i[3])&&n.push(new dt(s,f,d,c,u))}r.push(o)}for(;o=r.pop();)e(o.node,o.x0,o.y0,o.x1,o.y1);return this}function cB(e){return e[0]}function uB(e){return arguments.length?(this._x=e,this):this._x}function dB(e){return e[1]}function fB(e){return arguments.length?(this._y=e,this):this._y}function CN(e,n,r){var o=new Qg(n??cB,r??dB,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function Qg(e,n,r,o,i,s){this._x=e,this._y=n,this._x0=r,this._y0=o,this._x1=i,this._y1=s,this._root=void 0}function Ex(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var gt=CN.prototype=Qg.prototype;gt.copy=function(){var e=new Qg(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,r,o;if(!n)return e;if(!n.length)return e._root=Ex(n),e;for(r=[{source:n,target:e._root=new Array(4)}];n=r.pop();)for(var i=0;i<4;++i)(o=n.source[i])&&(o.length?r.push({source:o,target:n.target[i]=new Array(4)}):n.target[i]=Ex(o));return e};gt.add=Q7;gt.addAll=Z7;gt.cover=J7;gt.data=eB;gt.extent=tB;gt.find=nB;gt.remove=rB;gt.removeAll=oB;gt.root=iB;gt.size=sB;gt.visit=aB;gt.visitAfter=lB;gt.x=uB;gt.y=fB;function hB(e){const n=+this._x.call(null,e),r=+this._y.call(null,e),o=+this._z.call(null,e);return NN(this.cover(n,r,o),n,r,o,e)}function NN(e,n,r,o,i){if(isNaN(n)||isNaN(r)||isNaN(o))return e;var s,a=e._root,l={data:i},c=e._x0,u=e._y0,f=e._z0,d=e._x1,h=e._y1,g=e._z1,v,b,_,m,w,y,S,k,C,N,E;if(!a)return e._root=l,e;for(;a.length;)if((S=n>=(v=(c+d)/2))?c=v:d=v,(k=r>=(b=(u+h)/2))?u=b:h=b,(C=o>=(_=(f+g)/2))?f=_:g=_,s=a,!(a=a[N=C<<2|k<<1|S]))return s[N]=l,e;if(m=+e._x.call(null,a.data),w=+e._y.call(null,a.data),y=+e._z.call(null,a.data),n===m&&r===w&&o===y)return l.next=a,s?s[N]=l:e._root=l,e;do s=s?s[N]=new Array(8):e._root=new Array(8),(S=n>=(v=(c+d)/2))?c=v:d=v,(k=r>=(b=(u+h)/2))?u=b:h=b,(C=o>=(_=(f+g)/2))?f=_:g=_;while((N=C<<2|k<<1|S)===(E=(y>=_)<<2|(w>=b)<<1|m>=v));return s[E]=a,s[N]=l,e}function pB(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n),o=new Float64Array(n),i=new Float64Array(n);let s=1/0,a=1/0,l=1/0,c=-1/0,u=-1/0,f=-1/0;for(let d=0,h,g,v,b;d<n;++d)isNaN(g=+this._x.call(null,h=e[d]))||isNaN(v=+this._y.call(null,h))||isNaN(b=+this._z.call(null,h))||(r[d]=g,o[d]=v,i[d]=b,g<s&&(s=g),g>c&&(c=g),v<a&&(a=v),v>u&&(u=v),b<l&&(l=b),b>f&&(f=b));if(s>c||a>u||l>f)return this;this.cover(s,a,l).cover(c,u,f);for(let d=0;d<n;++d)NN(this,r[d],o[d],i[d],e[d]);return this}function mB(e,n,r){if(isNaN(e=+e)||isNaN(n=+n)||isNaN(r=+r))return this;var o=this._x0,i=this._y0,s=this._z0,a=this._x1,l=this._y1,c=this._z1;if(isNaN(o))a=(o=Math.floor(e))+1,l=(i=Math.floor(n))+1,c=(s=Math.floor(r))+1;else{for(var u=a-o||1,f=this._root,d,h;o>e||e>=a||i>n||n>=l||s>r||r>=c;)switch(h=(r<s)<<2|(n<i)<<1|e<o,d=new Array(8),d[h]=f,f=d,u*=2,h){case 0:a=o+u,l=i+u,c=s+u;break;case 1:o=a-u,l=i+u,c=s+u;break;case 2:a=o+u,i=l-u,c=s+u;break;case 3:o=a-u,i=l-u,c=s+u;break;case 4:a=o+u,l=i+u,s=c-u;break;case 5:o=a-u,l=i+u,s=c-u;break;case 6:a=o+u,i=l-u,s=c-u;break;case 7:o=a-u,i=l-u,s=c-u;break}this._root&&this._root.length&&(this._root=f)}return this._x0=o,this._y0=i,this._z0=s,this._x1=a,this._y1=l,this._z1=c,this}function gB(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function vB(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Ce(e,n,r,o,i,s,a){this.node=e,this.x0=n,this.y0=r,this.z0=o,this.x1=i,this.y1=s,this.z1=a}function yB(e,n,r,o){var i,s=this._x0,a=this._y0,l=this._z0,c,u,f,d,h,g,v=this._x1,b=this._y1,_=this._z1,m=[],w=this._root,y,S;for(w&&m.push(new Ce(w,s,a,l,v,b,_)),o==null?o=1/0:(s=e-o,a=n-o,l=r-o,v=e+o,b=n+o,_=r+o,o*=o);y=m.pop();)if(!(!(w=y.node)||(c=y.x0)>v||(u=y.y0)>b||(f=y.z0)>_||(d=y.x1)<s||(h=y.y1)<a||(g=y.z1)<l))if(w.length){var k=(c+d)/2,C=(u+h)/2,N=(f+g)/2;m.push(new Ce(w[7],k,C,N,d,h,g),new Ce(w[6],c,C,N,k,h,g),new Ce(w[5],k,u,N,d,C,g),new Ce(w[4],c,u,N,k,C,g),new Ce(w[3],k,C,f,d,h,N),new Ce(w[2],c,C,f,k,h,N),new Ce(w[1],k,u,f,d,C,N),new Ce(w[0],c,u,f,k,C,N)),(S=(r>=N)<<2|(n>=C)<<1|e>=k)&&(y=m[m.length-1],m[m.length-1]=m[m.length-1-S],m[m.length-1-S]=y)}else{var E=e-+this._x.call(null,w.data),j=n-+this._y.call(null,w.data),A=r-+this._z.call(null,w.data),T=E*E+j*j+A*A;if(T<o){var D=Math.sqrt(o=T);s=e-D,a=n-D,l=r-D,v=e+D,b=n+D,_=r+D,i=w.data}}return i}const xB=(e,n,r,o,i,s)=>Math.sqrt((e-o)**2+(n-i)**2+(r-s)**2);function wB(e,n,r,o){const i=[],s=e-o,a=n-o,l=r-o,c=e+o,u=n+o,f=r+o;return this.visit((d,h,g,v,b,_,m)=>{if(!d.length)do{const w=d.data;xB(e,n,r,this._x(w),this._y(w),this._z(w))<=o&&i.push(w)}while(d=d.next);return h>c||g>u||v>f||b<s||_<a||m<l}),i}function bB(e){if(isNaN(h=+this._x.call(null,e))||isNaN(g=+this._y.call(null,e))||isNaN(v=+this._z.call(null,e)))return this;var n,r=this._root,o,i,s,a=this._x0,l=this._y0,c=this._z0,u=this._x1,f=this._y1,d=this._z1,h,g,v,b,_,m,w,y,S,k,C;if(!r)return this;if(r.length)for(;;){if((w=h>=(b=(a+u)/2))?a=b:u=b,(y=g>=(_=(l+f)/2))?l=_:f=_,(S=v>=(m=(c+d)/2))?c=m:d=m,n=r,!(r=r[k=S<<2|y<<1|w]))return this;if(!r.length)break;(n[k+1&7]||n[k+2&7]||n[k+3&7]||n[k+4&7]||n[k+5&7]||n[k+6&7]||n[k+7&7])&&(o=n,C=k)}for(;r.data!==e;)if(i=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,i?(s?i.next=s:delete i.next,this):n?(s?n[k]=s:delete n[k],(r=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&r===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!r.length&&(o?o[C]=r:this._root=r),this):(this._root=s,this)}function _B(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function SB(){return this._root}function kB(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function CB(e){var n=[],r,o=this._root,i,s,a,l,c,u,f;for(o&&n.push(new Ce(o,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=n.pop();)if(!e(o=r.node,s=r.x0,a=r.y0,l=r.z0,c=r.x1,u=r.y1,f=r.z1)&&o.length){var d=(s+c)/2,h=(a+u)/2,g=(l+f)/2;(i=o[7])&&n.push(new Ce(i,d,h,g,c,u,f)),(i=o[6])&&n.push(new Ce(i,s,h,g,d,u,f)),(i=o[5])&&n.push(new Ce(i,d,a,g,c,h,f)),(i=o[4])&&n.push(new Ce(i,s,a,g,d,h,f)),(i=o[3])&&n.push(new Ce(i,d,h,l,c,u,g)),(i=o[2])&&n.push(new Ce(i,s,h,l,d,u,g)),(i=o[1])&&n.push(new Ce(i,d,a,l,c,h,g)),(i=o[0])&&n.push(new Ce(i,s,a,l,d,h,g))}return this}function NB(e){var n=[],r=[],o;for(this._root&&n.push(new Ce(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));o=n.pop();){var i=o.node;if(i.length){var s,a=o.x0,l=o.y0,c=o.z0,u=o.x1,f=o.y1,d=o.z1,h=(a+u)/2,g=(l+f)/2,v=(c+d)/2;(s=i[0])&&n.push(new Ce(s,a,l,c,h,g,v)),(s=i[1])&&n.push(new Ce(s,h,l,c,u,g,v)),(s=i[2])&&n.push(new Ce(s,a,g,c,h,f,v)),(s=i[3])&&n.push(new Ce(s,h,g,c,u,f,v)),(s=i[4])&&n.push(new Ce(s,a,l,v,h,g,d)),(s=i[5])&&n.push(new Ce(s,h,l,v,u,g,d)),(s=i[6])&&n.push(new Ce(s,a,g,v,h,f,d)),(s=i[7])&&n.push(new Ce(s,h,g,v,u,f,d))}r.push(o)}for(;o=r.pop();)e(o.node,o.x0,o.y0,o.z0,o.x1,o.y1,o.z1);return this}function EB(e){return e[0]}function jB(e){return arguments.length?(this._x=e,this):this._x}function PB(e){return e[1]}function MB(e){return arguments.length?(this._y=e,this):this._y}function RB(e){return e[2]}function AB(e){return arguments.length?(this._z=e,this):this._z}function EN(e,n,r,o){var i=new Zg(n??EB,r??PB,o??RB,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function Zg(e,n,r,o,i,s,a,l,c){this._x=e,this._y=n,this._z=r,this._x0=o,this._y0=i,this._z0=s,this._x1=a,this._y1=l,this._z1=c,this._root=void 0}function jx(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var et=EN.prototype=Zg.prototype;et.copy=function(){var e=new Zg(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root,r,o;if(!n)return e;if(!n.length)return e._root=jx(n),e;for(r=[{source:n,target:e._root=new Array(8)}];n=r.pop();)for(var i=0;i<8;++i)(o=n.source[i])&&(o.length?r.push({source:o,target:n.target[i]=new Array(8)}):n.target[i]=jx(o));return e};et.add=hB;et.addAll=pB;et.cover=mB;et.data=gB;et.extent=vB;et.find=yB;et.findAllWithinRadius=wB;et.remove=bB;et.removeAll=_B;et.root=SB;et.size=kB;et.visit=CB;et.visitAfter=NB;et.x=jB;et.y=MB;et.z=AB;function Qn(e){return function(){return e}}function Yn(e){return(e()-.5)*1e-6}function TB(e){return e.index}function Px(e,n){var r=e.get(n);if(!r)throw new Error("node not found: "+n);return r}function IB(e){var n=TB,r=h,o,i=Qn(30),s,a,l,c,u,f,d=1;e==null&&(e=[]);function h(m){return 1/Math.min(c[m.source.index],c[m.target.index])}function g(m){for(var w=0,y=e.length;w<d;++w)for(var S=0,k,C,N,E=0,j=0,A=0,T,D;S<y;++S)k=e[S],C=k.source,N=k.target,E=N.x+N.vx-C.x-C.vx||Yn(f),l>1&&(j=N.y+N.vy-C.y-C.vy||Yn(f)),l>2&&(A=N.z+N.vz-C.z-C.vz||Yn(f)),T=Math.sqrt(E*E+j*j+A*A),T=(T-s[S])/T*m*o[S],E*=T,j*=T,A*=T,N.vx-=E*(D=u[S]),l>1&&(N.vy-=j*D),l>2&&(N.vz-=A*D),C.vx+=E*(D=1-D),l>1&&(C.vy+=j*D),l>2&&(C.vz+=A*D)}function v(){if(a){var m,w=a.length,y=e.length,S=new Map(a.map((C,N)=>[n(C,N,a),C])),k;for(m=0,c=new Array(w);m<y;++m)k=e[m],k.index=m,typeof k.source!="object"&&(k.source=Px(S,k.source)),typeof k.target!="object"&&(k.target=Px(S,k.target)),c[k.source.index]=(c[k.source.index]||0)+1,c[k.target.index]=(c[k.target.index]||0)+1;for(m=0,u=new Array(y);m<y;++m)k=e[m],u[m]=c[k.source.index]/(c[k.source.index]+c[k.target.index]);o=new Array(y),b(),s=new Array(y),_()}}function b(){if(a)for(var m=0,w=e.length;m<w;++m)o[m]=+r(e[m],m,e)}function _(){if(a)for(var m=0,w=e.length;m<w;++m)s[m]=+i(e[m],m,e)}return g.initialize=function(m,...w){a=m,f=w.find(y=>typeof y=="function")||Math.random,l=w.find(y=>[1,2,3].includes(y))||2,v()},g.links=function(m){return arguments.length?(e=m,v(),g):e},g.id=function(m){return arguments.length?(n=m,g):n},g.iterations=function(m){return arguments.length?(d=+m,g):d},g.strength=function(m){return arguments.length?(r=typeof m=="function"?m:Qn(+m),b(),g):r},g.distance=function(m){return arguments.length?(i=typeof m=="function"?m:Qn(+m),_(),g):i},g}const OB=1664525,$B=1013904223,Mx=4294967296;function DB(){let e=1;return()=>(e=(OB*e+$B)%Mx)/Mx}var Rx=3;function Kf(e){return e.x}function Ax(e){return e.y}function LB(e){return e.z}var zB=10,FB=Math.PI*(3-Math.sqrt(5)),BB=Math.PI*20/(9+Math.sqrt(221));function HB(e,n){n=n||2;var r=Math.min(Rx,Math.max(1,Math.round(n))),o,i=1,s=.001,a=1-Math.pow(s,1/300),l=0,c=.6,u=new Map,f=Bg(g),d=nl("tick","end"),h=DB();e==null&&(e=[]);function g(){v(),d.call("tick",o),i<s&&(f.stop(),d.call("end",o))}function v(m){var w,y=e.length,S;m===void 0&&(m=1);for(var k=0;k<m;++k)for(i+=(l-i)*a,u.forEach(function(C){C(i)}),w=0;w<y;++w)S=e[w],S.fx==null?S.x+=S.vx*=c:(S.x=S.fx,S.vx=0),r>1&&(S.fy==null?S.y+=S.vy*=c:(S.y=S.fy,S.vy=0)),r>2&&(S.fz==null?S.z+=S.vz*=c:(S.z=S.fz,S.vz=0));return o}function b(){for(var m=0,w=e.length,y;m<w;++m){if(y=e[m],y.index=m,y.fx!=null&&(y.x=y.fx),y.fy!=null&&(y.y=y.fy),y.fz!=null&&(y.z=y.fz),isNaN(y.x)||r>1&&isNaN(y.y)||r>2&&isNaN(y.z)){var S=zB*(r>2?Math.cbrt(.5+m):r>1?Math.sqrt(.5+m):m),k=m*FB,C=m*BB;r===1?y.x=S:r===2?(y.x=S*Math.cos(k),y.y=S*Math.sin(k)):(y.x=S*Math.sin(k)*Math.cos(C),y.y=S*Math.cos(k),y.z=S*Math.sin(k)*Math.sin(C))}(isNaN(y.vx)||r>1&&isNaN(y.vy)||r>2&&isNaN(y.vz))&&(y.vx=0,r>1&&(y.vy=0),r>2&&(y.vz=0))}}function _(m){return m.initialize&&m.initialize(e,h,r),m}return b(),o={tick:v,restart:function(){return f.restart(g),o},stop:function(){return f.stop(),o},numDimensions:function(m){return arguments.length?(r=Math.min(Rx,Math.max(1,Math.round(m))),u.forEach(_),o):r},nodes:function(m){return arguments.length?(e=m,b(),u.forEach(_),o):e},alpha:function(m){return arguments.length?(i=+m,o):i},alphaMin:function(m){return arguments.length?(s=+m,o):s},alphaDecay:function(m){return arguments.length?(a=+m,o):+a},alphaTarget:function(m){return arguments.length?(l=+m,o):l},velocityDecay:function(m){return arguments.length?(c=1-m,o):1-c},randomSource:function(m){return arguments.length?(h=m,u.forEach(_),o):h},force:function(m,w){return arguments.length>1?(w==null?u.delete(m):u.set(m,_(w)),o):u.get(m)},find:function(){var m=Array.prototype.slice.call(arguments),w=m.shift()||0,y=(r>1?m.shift():null)||0,S=(r>2?m.shift():null)||0,k=m.shift()||1/0,C=0,N=e.length,E,j,A,T,D,F;for(k*=k,C=0;C<N;++C)D=e[C],E=w-D.x,j=y-(D.y||0),A=S-(D.z||0),T=E*E+j*j+A*A,T<k&&(F=D,k=T);return F},on:function(m,w){return arguments.length>1?(d.on(m,w),o):d.on(m)}}}function UB(){var e,n,r,o,i,s=Qn(-30),a,l=1,c=1/0,u=.81;function f(v){var b,_=e.length,m=(n===1?SN(e,Kf):n===2?CN(e,Kf,Ax):n===3?EN(e,Kf,Ax,LB):null).visitAfter(h);for(i=v,b=0;b<_;++b)r=e[b],m.visit(g)}function d(){if(e){var v,b=e.length,_;for(a=new Array(b),v=0;v<b;++v)_=e[v],a[_.index]=+s(_,v,e)}}function h(v){var b=0,_,m,w=0,y,S,k,C,N=v.length;if(N){for(y=S=k=C=0;C<N;++C)(_=v[C])&&(m=Math.abs(_.value))&&(b+=_.value,w+=m,y+=m*(_.x||0),S+=m*(_.y||0),k+=m*(_.z||0));b*=Math.sqrt(4/N),v.x=y/w,n>1&&(v.y=S/w),n>2&&(v.z=k/w)}else{_=v,_.x=_.data.x,n>1&&(_.y=_.data.y),n>2&&(_.z=_.data.z);do b+=a[_.data.index];while(_=_.next)}v.value=b}function g(v,b,_,m,w){if(!v.value)return!0;var y=[_,m,w][n-1],S=v.x-r.x,k=n>1?v.y-r.y:0,C=n>2?v.z-r.z:0,N=y-b,E=S*S+k*k+C*C;if(N*N/u<E)return E<c&&(S===0&&(S=Yn(o),E+=S*S),n>1&&k===0&&(k=Yn(o),E+=k*k),n>2&&C===0&&(C=Yn(o),E+=C*C),E<l&&(E=Math.sqrt(l*E)),r.vx+=S*v.value*i/E,n>1&&(r.vy+=k*v.value*i/E),n>2&&(r.vz+=C*v.value*i/E)),!0;if(v.length||E>=c)return;(v.data!==r||v.next)&&(S===0&&(S=Yn(o),E+=S*S),n>1&&k===0&&(k=Yn(o),E+=k*k),n>2&&C===0&&(C=Yn(o),E+=C*C),E<l&&(E=Math.sqrt(l*E)));do v.data!==r&&(N=a[v.data.index]*i/E,r.vx+=S*N,n>1&&(r.vy+=k*N),n>2&&(r.vz+=C*N));while(v=v.next)}return f.initialize=function(v,...b){e=v,o=b.find(_=>typeof _=="function")||Math.random,n=b.find(_=>[1,2,3].includes(_))||2,d()},f.strength=function(v){return arguments.length?(s=typeof v=="function"?v:Qn(+v),d(),f):s},f.distanceMin=function(v){return arguments.length?(l=v*v,f):Math.sqrt(l)},f.distanceMax=function(v){return arguments.length?(c=v*v,f):Math.sqrt(c)},f.theta=function(v){return arguments.length?(u=v*v,f):Math.sqrt(u)},f}function VB(e,n,r,o){var i,s,a=Qn(.1),l,c;typeof e!="function"&&(e=Qn(+e)),n==null&&(n=0),r==null&&(r=0),o==null&&(o=0);function u(d){for(var h=0,g=i.length;h<g;++h){var v=i[h],b=v.x-n||1e-6,_=(v.y||0)-r||1e-6,m=(v.z||0)-o||1e-6,w=Math.sqrt(b*b+_*_+m*m),y=(c[h]-w)*l[h]*d/w;v.vx+=b*y,s>1&&(v.vy+=_*y),s>2&&(v.vz+=m*y)}}function f(){if(i){var d,h=i.length;for(l=new Array(h),c=new Array(h),d=0;d<h;++d)c[d]=+e(i[d],d,i),l[d]=isNaN(c[d])?0:+a(i[d],d,i)}}return u.initialize=function(d,...h){i=d,s=h.find(g=>[1,2,3].includes(g))||2,f()},u.strength=function(d){return arguments.length?(a=typeof d=="function"?d:Qn(+d),f(),u):a},u.radius=function(d){return arguments.length?(e=typeof d=="function"?d:Qn(+d),f(),u):e},u.x=function(d){return arguments.length?(n=+d,u):n},u.y=function(d){return arguments.length?(r=+d,u):r},u.z=function(d){return arguments.length?(o=+d,u):o},u}const{abs:js,cos:Un,sin:Jo,acos:WB,atan2:Ps,sqrt:yr,pow:Ft}=Math;function Ms(e){return e<0?-Ft(-e,1/3):Ft(e,1/3)}const jN=Math.PI,tc=2*jN,xr=jN/2,GB=1e-6,qf=Number.MAX_SAFE_INTEGER||9007199254740991,Qf=Number.MIN_SAFE_INTEGER||-9007199254740991,YB={x:0,y:0,z:0},J={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){const r=n(e);let o=r.x*r.x+r.y*r.y;return typeof r.z<"u"&&(o+=r.z*r.z),yr(o)},compute:function(e,n,r){if(e===0)return n[0].t=0,n[0];const o=n.length-1;if(e===1)return n[o].t=1,n[o];const i=1-e;let s=n;if(o===0)return n[0].t=e,n[0];if(o===1){const l={x:i*s[0].x+e*s[1].x,y:i*s[0].y+e*s[1].y,t:e};return r&&(l.z=i*s[0].z+e*s[1].z),l}if(o<4){let l=i*i,c=e*e,u,f,d,h=0;o===2?(s=[s[0],s[1],s[2],YB],u=l,f=i*e*2,d=c):o===3&&(u=l*i,f=l*e*3,d=i*c*3,h=e*c);const g={x:u*s[0].x+f*s[1].x+d*s[2].x+h*s[3].x,y:u*s[0].y+f*s[1].y+d*s[2].y+h*s[3].y,t:e};return r&&(g.z=u*s[0].z+f*s[1].z+d*s[2].z+h*s[3].z),g}const a=JSON.parse(JSON.stringify(n));for(;a.length>1;){for(let l=0;l<a.length-1;l++)a[l]={x:a[l].x+(a[l+1].x-a[l].x)*e,y:a[l].y+(a[l+1].y-a[l].y)*e},typeof a[l].z<"u"&&(a[l].z=a[l].z+(a[l+1].z-a[l].z)*e);a.splice(a.length-1,1)}return a[0].t=e,a[0]},computeWithRatios:function(e,n,r,o){const i=1-e,s=r,a=n;let l=s[0],c=s[1],u=s[2],f=s[3],d;if(l*=i,c*=e,a.length===2)return d=l+c,{x:(l*a[0].x+c*a[1].x)/d,y:(l*a[0].y+c*a[1].y)/d,z:o?(l*a[0].z+c*a[1].z)/d:!1,t:e};if(l*=i,c*=2*i,u*=e*e,a.length===3)return d=l+c+u,{x:(l*a[0].x+c*a[1].x+u*a[2].x)/d,y:(l*a[0].y+c*a[1].y+u*a[2].y)/d,z:o?(l*a[0].z+c*a[1].z+u*a[2].z)/d:!1,t:e};if(l*=i,c*=1.5*i,u*=3*i,f*=e*e*e,a.length===4)return d=l+c+u+f,{x:(l*a[0].x+c*a[1].x+u*a[2].x+f*a[3].x)/d,y:(l*a[0].y+c*a[1].y+u*a[2].y+f*a[3].y)/d,z:o?(l*a[0].z+c*a[1].z+u*a[2].z+f*a[3].z)/d:!1,t:e}},derive:function(e,n){const r=[];for(let o=e,i=o.length,s=i-1;i>1;i--,s--){const a=[];for(let l=0,c;l<s;l++)c={x:s*(o[l+1].x-o[l].x),y:s*(o[l+1].y-o[l].y)},n&&(c.z=s*(o[l+1].z-o[l].z)),a.push(c);r.push(a),o=a}return r},between:function(e,n,r){return n<=e&&e<=r||J.approximately(e,n)||J.approximately(e,r)},approximately:function(e,n,r){return js(e-n)<=(r||GB)},length:function(e){const r=J.Tvalues.length;let o=0;for(let i=0,s;i<r;i++)s=.5*J.Tvalues[i]+.5,o+=J.Cvalues[i]*J.arcfn(s,e);return .5*o},map:function(e,n,r,o,i){const s=r-n,a=i-o,l=e-n,c=l/s;return o+a*c},lerp:function(e,n,r){const o={x:n.x+e*(r.x-n.x),y:n.y+e*(r.y-n.y)};return n.z!==void 0&&r.z!==void 0&&(o.z=n.z+e*(r.z-n.z)),o},pointToString:function(e){let n=e.x+"/"+e.y;return typeof e.z<"u"&&(n+="/"+e.z),n},pointsToString:function(e){return"["+e.map(J.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,n,r){const o=n.x-e.x,i=n.y-e.y,s=r.x-e.x,a=r.y-e.y,l=o*a-i*s,c=o*s+i*a;return Ps(l,c)},round:function(e,n){const r=""+e,o=r.indexOf(".");return parseFloat(r.substring(0,o+1+n))},dist:function(e,n){const r=e.x-n.x,o=e.y-n.y;return yr(r*r+o*o)},closest:function(e,n){let r=Ft(2,63),o,i;return e.forEach(function(s,a){i=J.dist(n,s),i<r&&(r=i,o=a)}),{mdist:r,mpos:o}},abcratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=Ft(e,n)+Ft(1-e,n),o=r-1;return js(o/r)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=Ft(1-e,n),o=Ft(e,n)+r;return r/o},lli8:function(e,n,r,o,i,s,a,l){const c=(e*o-n*r)*(i-a)-(e-r)*(i*l-s*a),u=(e*o-n*r)*(s-l)-(n-o)*(i*l-s*a),f=(e-r)*(s-l)-(n-o)*(i-a);return f==0?!1:{x:c/f,y:u/f}},lli4:function(e,n,r,o){const i=e.x,s=e.y,a=n.x,l=n.y,c=r.x,u=r.y,f=o.x,d=o.y;return J.lli8(i,s,a,l,c,u,f,d)},lli:function(e,n){return J.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new je(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=qf,r=qf,o=Qf,i=Qf;return e.forEach(function(s){const a=s.bbox();n>a.x.min&&(n=a.x.min),r>a.y.min&&(r=a.y.min),o<a.x.max&&(o=a.x.max),i<a.y.max&&(i=a.y.max)}),{x:{min:n,mid:(n+o)/2,max:o,size:o-n},y:{min:r,mid:(r+i)/2,max:i,size:i-r}}},shapeintersections:function(e,n,r,o,i){if(!J.bboxoverlap(n,o))return[];const s=[],a=[e.startcap,e.forward,e.back,e.endcap],l=[r.startcap,r.forward,r.back,r.endcap];return a.forEach(function(c){c.virtual||l.forEach(function(u){if(u.virtual)return;const f=c.intersects(u,i);f.length>0&&(f.c1=c,f.c2=u,f.s1=e,f.s2=r,s.push(f))})}),s},makeshape:function(e,n,r){const o=n.points.length,i=e.points.length,s=J.makeline(n.points[o-1],e.points[0]),a=J.makeline(e.points[i-1],n.points[0]),l={startcap:s,forward:e,back:n,endcap:a,bbox:J.findbbox([s,e,n,a])};return l.intersections=function(c){return J.shapeintersections(l,l.bbox,c,c.bbox,r)},l},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let o=qf,i=Qf,s,a;r.indexOf(0)===-1&&(r=[0].concat(r)),r.indexOf(1)===-1&&r.push(1);for(let l=0,c=r.length;l<c;l++)s=r[l],a=e.get(s),a[n]<o&&(o=a[n]),a[n]>i&&(i=a[n]);return{min:o,mid:(o+i)/2,max:i,size:i-o}},align:function(e,n){const r=n.p1.x,o=n.p1.y,i=-Ps(n.p2.y-o,n.p2.x-r),s=function(a){return{x:(a.x-r)*Un(i)-(a.y-o)*Jo(i),y:(a.x-r)*Jo(i)+(a.y-o)*Un(i)}};return e.map(s)},roots:function(e,n){n=n||{p1:{x:0,y:0},p2:{x:1,y:0}};const r=e.length-1,o=J.align(e,n),i=function(N){return 0<=N&&N<=1};if(r===2){const N=o[0].y,E=o[1].y,j=o[2].y,A=N-2*E+j;if(A!==0){const T=-yr(E*E-N*j),D=-N+E,F=-(T+D)/A,P=-(-T+D)/A;return[F,P].filter(i)}else if(E!==j&&A===0)return[(2*E-j)/(2*E-2*j)].filter(i);return[]}const s=o[0].y,a=o[1].y,l=o[2].y,c=o[3].y;let u=-s+3*a-3*l+c,f=3*s-6*a+3*l,d=-3*s+3*a,h=s;if(J.approximately(u,0)){if(J.approximately(f,0))return J.approximately(d,0)?[]:[-h/d].filter(i);const N=yr(d*d-4*f*h),E=2*f;return[(N-d)/E,(-d-N)/E].filter(i)}f/=u,d/=u,h/=u;const g=(3*d-f*f)/3,v=g/3,b=(2*f*f*f-9*f*d+27*h)/27,_=b/2,m=_*_+v*v*v;let w,y,S,k,C;if(m<0){const N=-g/3,E=N*N*N,j=yr(E),A=-b/(2*j),T=A<-1?-1:A>1?1:A,D=WB(T),F=Ms(j),P=2*F;return S=P*Un(D/3)-f/3,k=P*Un((D+tc)/3)-f/3,C=P*Un((D+2*tc)/3)-f/3,[S,k,C].filter(i)}else{if(m===0)return w=_<0?Ms(-_):-Ms(_),S=2*w-f/3,k=-w-f/3,[S,k].filter(i);{const N=yr(m);return w=Ms(-_+N),y=Ms(_+N),[w-y-f/3].filter(i)}}},droots:function(e){if(e.length===3){const n=e[0],r=e[1],o=e[2],i=n-2*r+o;if(i!==0){const s=-yr(r*r-n*o),a=-n+r,l=-(s+a)/i,c=-(-s+a)/i;return[l,c]}else if(r!==o&&i===0)return[(2*r-o)/(2*(r-o))];return[]}if(e.length===2){const n=e[0],r=e[1];return n!==r?[n/(n-r)]:[]}return[]},curvature:function(e,n,r,o,i){let s,a,l,c,u=0,f=0;const d=J.compute(e,n),h=J.compute(e,r),g=d.x*d.x+d.y*d.y;if(o?(s=yr(Ft(d.y*h.z-h.y*d.z,2)+Ft(d.z*h.x-h.z*d.x,2)+Ft(d.x*h.y-h.x*d.y,2)),a=Ft(g+d.z*d.z,3/2)):(s=d.x*h.y-d.y*h.x,a=Ft(g,3/2)),s===0||a===0)return{k:0,r:0};if(u=s/a,f=a/s,!i){const v=J.curvature(e-.001,n,r,o,!0).k,b=J.curvature(e+.001,n,r,o,!0).k;c=(b-u+(u-v))/2,l=(js(b-u)+js(u-v))/2}return{k:u,r:f,dk:c,adk:l}},inflections:function(e){if(e.length<4)return[];const n=J.align(e,{p1:e[0],p2:e.slice(-1)[0]}),r=n[2].x*n[1].y,o=n[3].x*n[1].y,i=n[1].x*n[2].y,s=n[3].x*n[2].y,a=18*(-3*r+2*o+3*i-s),l=18*(3*r-o-3*i),c=18*(i-r);if(J.approximately(a,0)){if(!J.approximately(l,0)){let h=-c/l;if(0<=h&&h<=1)return[h]}return[]}const u=2*a;if(J.approximately(u,0))return[];const f=l*l-4*a*c;if(f<0)return[];const d=Math.sqrt(f);return[(d-l)/u,-(l+d)/u].filter(function(h){return 0<=h&&h<=1})},bboxoverlap:function(e,n){const r=["x","y"],o=r.length;for(let i=0,s,a,l,c;i<o;i++)if(s=r[i],a=e[s].mid,l=n[s].mid,c=(e[s].size+n[s].size)/2,js(a-l)>=c)return!1;return!0},expandbox:function(e,n){n.x.min<e.x.min&&(e.x.min=n.x.min),n.y.min<e.y.min&&(e.y.min=n.y.min),n.z&&n.z.min<e.z.min&&(e.z.min=n.z.min),n.x.max>e.x.max&&(e.x.max=n.x.max),n.y.max>e.y.max&&(e.y.max=n.y.max),n.z&&n.z.max>e.z.max&&(e.z.max=n.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,n,r){const o=e.bbox(),i=n.bbox(),s=1e5,a=r||.5;if(o.x.size+o.y.size<a&&i.x.size+i.y.size<a)return[(s*(e._t1+e._t2)/2|0)/s+"/"+(s*(n._t1+n._t2)/2|0)/s];let l=e.split(.5),c=n.split(.5),u=[{left:l.left,right:c.left},{left:l.left,right:c.right},{left:l.right,right:c.right},{left:l.right,right:c.left}];u=u.filter(function(d){return J.bboxoverlap(d.left.bbox(),d.right.bbox())});let f=[];return u.length===0||(u.forEach(function(d){f=f.concat(J.pairiteration(d.left,d.right,a))}),f=f.filter(function(d,h){return f.indexOf(d)===h})),f},getccenter:function(e,n,r){const o=n.x-e.x,i=n.y-e.y,s=r.x-n.x,a=r.y-n.y,l=o*Un(xr)-i*Jo(xr),c=o*Jo(xr)+i*Un(xr),u=s*Un(xr)-a*Jo(xr),f=s*Jo(xr)+a*Un(xr),d=(e.x+n.x)/2,h=(e.y+n.y)/2,g=(n.x+r.x)/2,v=(n.y+r.y)/2,b=d+l,_=h+c,m=g+u,w=v+f,y=J.lli8(d,h,b,_,g,v,m,w),S=J.dist(y,e);let k=Ps(e.y-y.y,e.x-y.x),C=Ps(n.y-y.y,n.x-y.x),N=Ps(r.y-y.y,r.x-y.x),E;return k<N?((k>C||C>N)&&(k+=tc),k>N&&(E=N,N=k,k=E)):N<C&&C<k?(E=N,N=k,k=E):N+=tc,y.s=k,y.e=N,y.r=S,y},numberSort:function(e,n){return e-n}};class na{constructor(n){this.curves=[],this._3d=!1,n&&(this.curves=n,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map(function(n){return J.pointsToString(n.points)}).join(", ")+"]"}addCurve(n){this.curves.push(n),this._3d=this._3d||n._3d}length(){return this.curves.map(function(n){return n.length()}).reduce(function(n,r){return n+r})}curve(n){return this.curves[n]}bbox(){const n=this.curves;for(var r=n[0].bbox(),o=1;o<n.length;o++)J.expandbox(r,n[o].bbox());return r}offset(n){const r=[];return this.curves.forEach(function(o){r.push(...o.offset(n))}),new na(r)}}const{abs:Rs,min:Tx,max:Ix,cos:XB,sin:KB,acos:qB,sqrt:As}=Math,QB=Math.PI;class je{constructor(n){let r=n&&n.forEach?n:Array.from(arguments).slice(),o=!1;if(typeof r[0]=="object"){o=r.length;const g=[];r.forEach(function(v){["x","y","z"].forEach(function(b){typeof v[b]<"u"&&g.push(v[b])})}),r=g}let i=!1;const s=r.length;if(o){if(o>4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");i=!0}}else if(s!==6&&s!==8&&s!==9&&s!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const a=this._3d=!i&&(s===9||s===12)||n&&n[0]&&typeof n[0].z<"u",l=this.points=[];for(let g=0,v=a?3:2;g<s;g+=v){var c={x:r[g],y:r[g+1]};a&&(c.z=r[g+2]),l.push(c)}const u=this.order=l.length-1,f=this.dims=["x","y"];a&&f.push("z"),this.dimlen=f.length;const d=J.align(l,{p1:l[0],p2:l[u]}),h=J.dist(l[0],l[u]);this._linear=d.reduce((g,v)=>g+Rs(v.y),0)<h/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(n,r,o,i){if(typeof i>"u"&&(i=.5),i===0)return new je(r,r,o);if(i===1)return new je(n,r,r);const s=je.getABC(2,n,r,o,i);return new je(n,s.A,o)}static cubicFromPoints(n,r,o,i,s){typeof i>"u"&&(i=.5);const a=je.getABC(3,n,r,o,i);typeof s>"u"&&(s=J.dist(r,a.C));const l=s*(1-i)/i,c=J.dist(n,o),u=(o.x-n.x)/c,f=(o.y-n.y)/c,d=s*u,h=s*f,g=l*u,v=l*f,b={x:r.x-d,y:r.y-h},_={x:r.x+g,y:r.y+v},m=a.A,w={x:m.x+(b.x-m.x)/(1-i),y:m.y+(b.y-m.y)/(1-i)},y={x:m.x+(_.x-m.x)/i,y:m.y+(_.y-m.y)/i},S={x:n.x+(w.x-n.x)/i,y:n.y+(w.y-n.y)/i},k={x:o.x+(y.x-o.x)/(1-i),y:o.y+(y.y-o.y)/(1-i)};return new je(n,S,k,o)}static getUtils(){return J}getUtils(){return je.getUtils()}static get PolyBezier(){return na}valueOf(){return this.toString()}toString(){return J.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const n=this.points,r=n[0].x,o=n[0].y,i=["M",r,o,this.order===2?"Q":"C"];for(let s=1,a=n.length;s<a;s++)i.push(n[s].x),i.push(n[s].y);return i.join(" ")}setRatios(n){if(n.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=n,this._lut=[]}verify(){const n=this.coordDigest();n!==this._print&&(this._print=n,this.update())}coordDigest(){return this.points.map(function(n,r){return""+r+n.x+n.y+(n.z?n.z:0)}).join("")}update(){this._lut=[],this.dpoints=J.derive(this.points,this._3d),this.computedirection()}computedirection(){const n=this.points,r=J.angle(n[0],n[this.order],n[1]);this.clockwise=r>0}length(){return J.length(this.derivative.bind(this))}static getABC(n=2,r,o,i,s=.5){const a=J.projectionratio(s,n),l=1-a,c={x:a*r.x+l*i.x,y:a*r.y+l*i.y},u=J.abcratio(s,n);return{A:{x:o.x+(o.x-c.x)/u,y:o.y+(o.y-c.y)/u},B:o,C:c,S:r,E:i}}getABC(n,r){r=r||this.get(n);let o=this.points[0],i=this.points[this.order];return je.getABC(this.order,o,r,i,n)}getLUT(n){if(this.verify(),n=n||100,this._lut.length===n+1)return this._lut;this._lut=[],n++,this._lut=[];for(let r=0,o,i;r<n;r++)i=r/(n-1),o=this.compute(i),o.t=i,this._lut.push(o);return this._lut}on(n,r){r=r||5;const o=this.getLUT(),i=[];for(let s=0,a,l=0;s<o.length;s++)a=o[s],J.dist(a,n)<r&&(i.push(a),l+=s/o.length);return i.length?t/=i.length:!1}project(n){const r=this.getLUT(),o=r.length-1,i=J.closest(r,n),s=i.mpos,a=(s-1)/o,l=(s+1)/o,c=.1/o;let u=i.mdist,f=a,d=f,h;u+=1;for(let g;f<l+c;f+=c)h=this.compute(f),g=J.dist(n,h),g<u&&(u=g,d=f);return d=d<0?0:d>1?1:d,h=this.compute(d),h.t=d,h.d=u,h}get(n){return this.compute(n)}point(n){return this.points[n]}compute(n){return this.ratios?J.computeWithRatios(n,this.points,this.ratios,this._3d):J.compute(n,this.points,this._3d,this.ratios)}raise(){const n=this.points,r=[n[0]],o=n.length;for(let i=1,s,a;i<o;i++)s=n[i],a=n[i-1],r[i]={x:(o-i)/o*s.x+i/o*a.x,y:(o-i)/o*s.y+i/o*a.y};return r[o]=n[o-1],new je(r)}derivative(n){return J.compute(n,this.dpoints[0],this._3d)}dderivative(n){return J.compute(n,this.dpoints[1],this._3d)}align(){let n=this.points;return new je(J.align(n,{p1:n[0],p2:n[n.length-1]}))}curvature(n){return J.curvature(n,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return J.inflections(this.points)}normal(n){return this._3d?this.__normal3(n):this.__normal2(n)}__normal2(n){const r=this.derivative(n),o=As(r.x*r.x+r.y*r.y);return{t:n,x:-r.y/o,y:r.x/o}}__normal3(n){const r=this.derivative(n),o=this.derivative(n+.01),i=As(r.x*r.x+r.y*r.y+r.z*r.z),s=As(o.x*o.x+o.y*o.y+o.z*o.z);r.x/=i,r.y/=i,r.z/=i,o.x/=s,o.y/=s,o.z/=s;const a={x:o.y*r.z-o.z*r.y,y:o.z*r.x-o.x*r.z,z:o.x*r.y-o.y*r.x},l=As(a.x*a.x+a.y*a.y+a.z*a.z);a.x/=l,a.y/=l,a.z/=l;const c=[a.x*a.x,a.x*a.y-a.z,a.x*a.z+a.y,a.x*a.y+a.z,a.y*a.y,a.y*a.z-a.x,a.x*a.z-a.y,a.y*a.z+a.x,a.z*a.z];return{t:n,x:c[0]*r.x+c[1]*r.y+c[2]*r.z,y:c[3]*r.x+c[4]*r.y+c[5]*r.z,z:c[6]*r.x+c[7]*r.y+c[8]*r.z}}hull(n){let r=this.points,o=[],i=[],s=0;for(i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],this.order===3&&(i[s++]=r[3]);r.length>1;){o=[];for(let a=0,l,c=r.length-1;a<c;a++)l=J.lerp(n,r[a],r[a+1]),i[s++]=l,o.push(l);r=o}return i}split(n,r){if(n===0&&r)return this.split(r).left;if(r===1)return this.split(n).right;const o=this.hull(n),i={left:this.order===2?new je([o[0],o[3],o[5]]):new je([o[0],o[4],o[7],o[9]]),right:this.order===2?new je([o[5],o[4],o[2]]):new je([o[9],o[8],o[6],o[3]]),span:o};return i.left._t1=J.map(0,0,1,this._t1,this._t2),i.left._t2=J.map(n,0,1,this._t1,this._t2),i.right._t1=J.map(n,0,1,this._t1,this._t2),i.right._t2=J.map(1,0,1,this._t1,this._t2),r?(r=J.map(r,n,1,0,1),i.right.split(r).left):i}extrema(){const n={};let r=[];return this.dims.forEach((function(o){let i=function(a){return a[o]},s=this.dpoints[0].map(i);n[o]=J.droots(s),this.order===3&&(s=this.dpoints[1].map(i),n[o]=n[o].concat(J.droots(s))),n[o]=n[o].filter(function(a){return a>=0&&a<=1}),r=r.concat(n[o].sort(J.numberSort))}).bind(this)),n.values=r.sort(J.numberSort).filter(function(o,i){return r.indexOf(o)===i}),n}bbox(){const n=this.extrema(),r={};return this.dims.forEach((function(o){r[o]=J.getminmax(this,o,n[o])}).bind(this)),r}overlaps(n){const r=this.bbox(),o=n.bbox();return J.bboxoverlap(r,o)}offset(n,r){if(typeof r<"u"){const o=this.get(n),i=this.normal(n),s={c:o,n:i,x:o.x+i.x*r,y:o.y+i.y*r};return this._3d&&(s.z=o.z+i.z*r),s}if(this._linear){const o=this.normal(0),i=this.points.map(function(s){const a={x:s.x+n*o.x,y:s.y+n*o.y};return s.z&&o.z&&(a.z=s.z+n*o.z),a});return[new je(i)]}return this.reduce().map(function(o){return o._linear?o.offset(n)[0]:o.scale(n)})}simple(){if(this.order===3){const i=J.angle(this.points[0],this.points[3],this.points[1]),s=J.angle(this.points[0],this.points[3],this.points[2]);if(i>0&&s<0||i<0&&s>0)return!1}const n=this.normal(0),r=this.normal(1);let o=n.x*r.x+n.y*r.y;return this._3d&&(o+=n.z*r.z),Rs(qB(o))<QB/3}reduce(){let n,r=0,o=0,i=.01,s,a=[],l=[],c=this.extrema().values;for(c.indexOf(0)===-1&&(c=[0].concat(c)),c.indexOf(1)===-1&&c.push(1),r=c[0],n=1;n<c.length;n++)o=c[n],s=this.split(r,o),s._t1=r,s._t2=o,a.push(s),r=o;return a.forEach(function(u){for(r=0,o=0;o<=1;)for(o=r+i;o<=1+i;o+=i)if(s=u.split(r,o),!s.simple()){if(o-=i,Rs(r-o)<i)return[];s=u.split(r,o),s._t1=J.map(r,0,1,u._t1,u._t2),s._t2=J.map(o,0,1,u._t1,u._t2),l.push(s),r=o;break}r<1&&(s=u.split(r,1),s._t1=J.map(r,0,1,u._t1,u._t2),s._t2=u._t2,l.push(s))}),l}translate(n,r,o){o=typeof o=="number"?o:r;const i=this.order;let s=this.points.map((a,l)=>(1-l/i)*r+l/i*o);return new je(this.points.map((a,l)=>({x:a.x+n.x*s[l],y:a.y+n.y*s[l]})))}scale(n){const r=this.order;let o=!1;if(typeof n=="function"&&(o=n),o&&r===2)return this.raise().scale(o);const i=this.clockwise,s=this.points;if(this._linear)return this.translate(this.normal(0),o?o(0):n,o?o(1):n);const a=o?o(0):n,l=o?o(1):n,c=[this.offset(0,10),this.offset(1,10)],u=[],f=J.lli4(c[0],c[0].c,c[1],c[1].c);if(!f)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(d){const h=u[d*r]=J.copy(s[d*r]);h.x+=(d?l:a)*c[d].n.x,h.y+=(d?l:a)*c[d].n.y}),o?([0,1].forEach(function(d){if(!(r===2&&d)){var h=s[d+1],g={x:h.x-f.x,y:h.y-f.y},v=o?o((d+1)/r):n;o&&!i&&(v=-v);var b=As(g.x*g.x+g.y*g.y);g.x/=b,g.y/=b,u[d+1]={x:h.x+v*g.x,y:h.y+v*g.y}}}),new je(u)):([0,1].forEach(d=>{if(r===2&&d)return;const h=u[d*r],g=this.derivative(d),v={x:h.x+g.x,y:h.y+g.y};u[d+1]=J.lli4(h,v,f,s[d+1])}),new je(u))}outline(n,r,o,i){if(r=r===void 0?n:r,this._linear){const k=this.normal(0),C=this.points[0],N=this.points[this.points.length-1];let E,j,A;o===void 0&&(o=n,i=r),E={x:C.x+k.x*n,y:C.y+k.y*n},A={x:N.x+k.x*o,y:N.y+k.y*o},j={x:(E.x+A.x)/2,y:(E.y+A.y)/2};const T=[E,j,A];E={x:C.x-k.x*r,y:C.y-k.y*r},A={x:N.x-k.x*i,y:N.y-k.y*i},j={x:(E.x+A.x)/2,y:(E.y+A.y)/2};const D=[A,j,E],F=J.makeline(D[2],T[0]),P=J.makeline(T[2],D[0]),L=[F,new je(T),P,new je(D)];return new na(L)}const s=this.reduce(),a=s.length,l=[];let c=[],u,f=0,d=this.length();const h=typeof o<"u"&&typeof i<"u";function g(k,C,N,E,j){return function(A){const T=E/N,D=(E+j)/N,F=C-k;return J.map(A,0,1,k+T*F,k+D*F)}}s.forEach(function(k){const C=k.length();h?(l.push(k.scale(g(n,o,d,f,C))),c.push(k.scale(g(-r,-i,d,f,C)))):(l.push(k.scale(n)),c.push(k.scale(-r))),f+=C}),c=c.map(function(k){return u=k.points,u[3]?k.points=[u[3],u[2],u[1],u[0]]:k.points=[u[2],u[1],u[0]],k}).reverse();const v=l[0].points[0],b=l[a-1].points[l[a-1].points.length-1],_=c[a-1].points[c[a-1].points.length-1],m=c[0].points[0],w=J.makeline(_,v),y=J.makeline(b,m),S=[w].concat(l).concat([y]).concat(c);return new na(S)}outlineshapes(n,r,o){r=r||n;const i=this.outline(n,r).curves,s=[];for(let a=1,l=i.length;a<l/2;a++){const c=J.makeshape(i[a],i[l-a],o);c.startcap.virtual=a>1,c.endcap.virtual=a<l/2-1,s.push(c)}return s}intersects(n,r){return n?n.p1&&n.p2?this.lineIntersects(n):(n instanceof je&&(n=n.reduce()),this.curveintersects(this.reduce(),n,r)):this.selfintersects(r)}lineIntersects(n){const r=Tx(n.p1.x,n.p2.x),o=Tx(n.p1.y,n.p2.y),i=Ix(n.p1.x,n.p2.x),s=Ix(n.p1.y,n.p2.y);return J.roots(this.points,n).filter(a=>{var l=this.get(a);return J.between(l.x,r,i)&&J.between(l.y,o,s)})}selfintersects(n){const r=this.reduce(),o=r.length-2,i=[];for(let s=0,a,l,c;s<o;s++)l=r.slice(s,s+1),c=r.slice(s+2),a=this.curveintersects(l,c,n),i.push(...a);return i}curveintersects(n,r,o){const i=[];n.forEach(function(a){r.forEach(function(l){a.overlaps(l)&&i.push({left:a,right:l})})});let s=[];return i.forEach(function(a){const l=J.pairiteration(a.left,a.right,o);l.length>0&&(s=s.concat(l))}),s}arcs(n){return n=n||.5,this._iterate(n,[])}_error(n,r,o,i){const s=(i-o)/4,a=this.get(o+s),l=this.get(i-s),c=J.dist(n,r),u=J.dist(n,a),f=J.dist(n,l);return Rs(u-c)+Rs(f-c)}_iterate(n,r){let o=0,i=1,s;do{s=0,i=1;let a=this.get(o),l,c,u,f,d=!1,h=!1,g,v=i,b=1;do if(h=d,f=u,v=(o+i)/2,l=this.get(v),c=this.get(i),u=J.getccenter(a,l,c),u.interval={start:o,end:i},d=this._error(u,a,o,i)<=n,g=h&&!d,g||(b=i),d){if(i>=1){if(u.interval.end=b=1,f=u,i>1){let m={x:u.x+u.r*XB(u.e),y:u.y+u.r*KB(u.e)};u.e+=J.angle({x:u.x,y:u.y},m,this.get(1))}break}i=i+(i-o)/2}else i=v;while(!g&&s++<100);if(s>=100)break;f=f||u,r.push(f),o=b}while(i<1);return r}}function Dp(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function ZB(e){if(Array.isArray(e))return e}function JB(e){if(Array.isArray(e))return Dp(e)}function eH(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function tH(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,s,a,l=[],c=!0,u=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(o=s.call(r)).done)&&(l.push(o.value),l.length!==n);c=!0);}catch(f){u=!0,i=f}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function nH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
398
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
399
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
402
|
+
`;O7($7);var D7=Wg({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(n,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.style,s=i===void 0?{}:i,a=!!n&&Tu(n)==="object"&&!!n.node&&typeof n.node=="function",l=at(a?n.node():n);l.style("position")==="static"&&l.style("position","relative"),r.tooltipEl=l.append("div").attr("class","float-tooltip-kap"),Object.entries(s).forEach(function(u){var f=P7(u,2),d=f[0],h=f[1];return r.tooltipEl.style(d,h)}),r.tooltipEl.style("left","-10000px").style("display","none");var c="tooltip-".concat(Math.round(Math.random()*1e12));r.mouseInside=!1,l.on("mousemove.".concat(c),function(u){r.mouseInside=!0;var f=Ht(u),d=l.node(),h=d.offsetWidth,g=d.offsetHeight,v=[r.offsetX===null||r.offsetX===void 0?"-".concat(f[0]/h*100,"%"):typeof r.offsetX=="number"?"calc(-50% + ".concat(r.offsetX,"px)"):r.offsetX,r.offsetY===null||r.offsetY===void 0?g>130&&g-f[1]<100?"calc(-100% - 6px)":"21px":typeof r.offsetY=="number"?r.offsetY<0?"calc(-100% - ".concat(Math.abs(r.offsetY),"px)"):"".concat(r.offsetY,"px"):r.offsetY];r.tooltipEl.style("left",f[0]+"px").style("top",f[1]+"px").style("transform","translate(".concat(v.join(","),")")),r.content&&r.tooltipEl.style("display","inline")}),l.on("mouseover.".concat(c),function(){r.mouseInside=!0,r.content&&r.tooltipEl.style("display","inline")}),l.on("mouseout.".concat(c),function(){r.mouseInside=!1,r.tooltipEl.style("display","none")})},update:function(n){n.tooltipEl.style("display",n.content&&n.mouseInside?"inline":"none"),n.content?n.content instanceof HTMLElement?(n.tooltipEl.text(""),n.tooltipEl.append(function(){return n.content})):typeof n.content=="string"?n.tooltipEl.html(n.content):T7(n.content)?(n.tooltipEl.text(""),I7(n.content,n.tooltipEl.node())):(n.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",n.content,n.content.toString())):n.tooltipEl.text("")}});function L7(e,n,r){var o,i=1;e==null&&(e=0),n==null&&(n=0),r==null&&(r=0);function s(){var a,l=o.length,c,u=0,f=0,d=0;for(a=0;a<l;++a)c=o[a],u+=c.x||0,f+=c.y||0,d+=c.z||0;for(u=(u/l-e)*i,f=(f/l-n)*i,d=(d/l-r)*i,a=0;a<l;++a)c=o[a],u&&(c.x-=u),f&&(c.y-=f),d&&(c.z-=d)}return s.initialize=function(a){o=a},s.x=function(a){return arguments.length?(e=+a,s):e},s.y=function(a){return arguments.length?(n=+a,s):n},s.z=function(a){return arguments.length?(r=+a,s):r},s.strength=function(a){return arguments.length?(i=+a,s):i},s}function z7(e){const n=+this._x.call(null,e);return _N(this.cover(n),n,e)}function _N(e,n,r){if(isNaN(n))return e;var o,i=e._root,s={data:r},a=e._x0,l=e._x1,c,u,f,d,h;if(!i)return e._root=s,e;for(;i.length;)if((f=n>=(c=(a+l)/2))?a=c:l=c,o=i,!(i=i[d=+f]))return o[d]=s,e;if(u=+e._x.call(null,i.data),n===u)return s.next=i,o?o[d]=s:e._root=s,e;do o=o?o[d]=new Array(2):e._root=new Array(2),(f=n>=(c=(a+l)/2))?a=c:l=c;while((d=+f)==(h=+(u>=c)));return o[h]=i,o[d]=s,e}function F7(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n);let o=1/0,i=-1/0;for(let s=0,a;s<n;++s)isNaN(a=+this._x.call(null,e[s]))||(r[s]=a,a<o&&(o=a),a>i&&(i=a));if(o>i)return this;this.cover(o).cover(i);for(let s=0;s<n;++s)_N(this,r[s],e[s]);return this}function B7(e){if(isNaN(e=+e))return this;var n=this._x0,r=this._x1;if(isNaN(n))r=(n=Math.floor(e))+1;else{for(var o=r-n||1,i=this._root,s,a;n>e||e>=r;)switch(a=+(e<n),s=new Array(2),s[a]=i,i=s,o*=2,a){case 0:r=n+o;break;case 1:n=r-o;break}this._root&&this._root.length&&(this._root=i)}return this._x0=n,this._x1=r,this}function H7(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function U7(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function Jn(e,n,r){this.node=e,this.x0=n,this.x1=r}function V7(e,n){var r,o=this._x0,i,s,a=this._x1,l=[],c=this._root,u,f;for(c&&l.push(new Jn(c,o,a)),n==null?n=1/0:(o=e-n,a=e+n);u=l.pop();)if(!(!(c=u.node)||(i=u.x0)>a||(s=u.x1)<o))if(c.length){var d=(i+s)/2;l.push(new Jn(c[1],d,s),new Jn(c[0],i,d)),(f=+(e>=d))&&(u=l[l.length-1],l[l.length-1]=l[l.length-1-f],l[l.length-1-f]=u)}else{var h=Math.abs(e-+this._x.call(null,c.data));h<n&&(n=h,o=e-h,a=e+h,r=c.data)}return r}function W7(e){if(isNaN(c=+this._x.call(null,e)))return this;var n,r=this._root,o,i,s,a=this._x0,l=this._x1,c,u,f,d,h;if(!r)return this;if(r.length)for(;;){if((f=c>=(u=(a+l)/2))?a=u:l=u,n=r,!(r=r[d=+f]))return this;if(!r.length)break;n[d+1&1]&&(o=n,h=d)}for(;r.data!==e;)if(i=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,i?(s?i.next=s:delete i.next,this):n?(s?n[d]=s:delete n[d],(r=n[0]||n[1])&&r===(n[1]||n[0])&&!r.length&&(o?o[h]=r:this._root=r),this):(this._root=s,this)}function G7(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function Y7(){return this._root}function X7(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function K7(e){var n=[],r,o=this._root,i,s,a;for(o&&n.push(new Jn(o,this._x0,this._x1));r=n.pop();)if(!e(o=r.node,s=r.x0,a=r.x1)&&o.length){var l=(s+a)/2;(i=o[1])&&n.push(new Jn(i,l,a)),(i=o[0])&&n.push(new Jn(i,s,l))}return this}function q7(e){var n=[],r=[],o;for(this._root&&n.push(new Jn(this._root,this._x0,this._x1));o=n.pop();){var i=o.node;if(i.length){var s,a=o.x0,l=o.x1,c=(a+l)/2;(s=i[0])&&n.push(new Jn(s,a,c)),(s=i[1])&&n.push(new Jn(s,c,l))}r.push(o)}for(;o=r.pop();)e(o.node,o.x0,o.x1);return this}function Q7(e){return e[0]}function Z7(e){return arguments.length?(this._x=e,this):this._x}function SN(e,n){var r=new qg(n??Q7,NaN,NaN);return e==null?r:r.addAll(e)}function qg(e,n,r){this._x=e,this._x0=n,this._x1=r,this._root=void 0}function Nx(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Et=SN.prototype=qg.prototype;Et.copy=function(){var e=new qg(this._x,this._x0,this._x1),n=this._root,r,o;if(!n)return e;if(!n.length)return e._root=Nx(n),e;for(r=[{source:n,target:e._root=new Array(2)}];n=r.pop();)for(var i=0;i<2;++i)(o=n.source[i])&&(o.length?r.push({source:o,target:n.target[i]=new Array(2)}):n.target[i]=Nx(o));return e};Et.add=z7;Et.addAll=F7;Et.cover=B7;Et.data=H7;Et.extent=U7;Et.find=V7;Et.remove=W7;Et.removeAll=G7;Et.root=Y7;Et.size=X7;Et.visit=K7;Et.visitAfter=q7;Et.x=Z7;function J7(e){const n=+this._x.call(null,e),r=+this._y.call(null,e);return kN(this.cover(n,r),n,r,e)}function kN(e,n,r,o){if(isNaN(n)||isNaN(r))return e;var i,s=e._root,a={data:o},l=e._x0,c=e._y0,u=e._x1,f=e._y1,d,h,g,v,b,_,m,w;if(!s)return e._root=a,e;for(;s.length;)if((b=n>=(d=(l+u)/2))?l=d:u=d,(_=r>=(h=(c+f)/2))?c=h:f=h,i=s,!(s=s[m=_<<1|b]))return i[m]=a,e;if(g=+e._x.call(null,s.data),v=+e._y.call(null,s.data),n===g&&r===v)return a.next=s,i?i[m]=a:e._root=a,e;do i=i?i[m]=new Array(4):e._root=new Array(4),(b=n>=(d=(l+u)/2))?l=d:u=d,(_=r>=(h=(c+f)/2))?c=h:f=h;while((m=_<<1|b)===(w=(v>=h)<<1|g>=d));return i[w]=s,i[m]=a,e}function eB(e){var n,r,o=e.length,i,s,a=new Array(o),l=new Array(o),c=1/0,u=1/0,f=-1/0,d=-1/0;for(r=0;r<o;++r)isNaN(i=+this._x.call(null,n=e[r]))||isNaN(s=+this._y.call(null,n))||(a[r]=i,l[r]=s,i<c&&(c=i),i>f&&(f=i),s<u&&(u=s),s>d&&(d=s));if(c>f||u>d)return this;for(this.cover(c,u).cover(f,d),r=0;r<o;++r)kN(this,a[r],l[r],e[r]);return this}function tB(e,n){if(isNaN(e=+e)||isNaN(n=+n))return this;var r=this._x0,o=this._y0,i=this._x1,s=this._y1;if(isNaN(r))i=(r=Math.floor(e))+1,s=(o=Math.floor(n))+1;else{for(var a=i-r||1,l=this._root,c,u;r>e||e>=i||o>n||n>=s;)switch(u=(n<o)<<1|e<r,c=new Array(4),c[u]=l,l=c,a*=2,u){case 0:i=r+a,s=o+a;break;case 1:r=i-a,s=o+a;break;case 2:i=r+a,o=s-a;break;case 3:r=i-a,o=s-a;break}this._root&&this._root.length&&(this._root=l)}return this._x0=r,this._y0=o,this._x1=i,this._y1=s,this}function nB(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function rB(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function dt(e,n,r,o,i){this.node=e,this.x0=n,this.y0=r,this.x1=o,this.y1=i}function oB(e,n,r){var o,i=this._x0,s=this._y0,a,l,c,u,f=this._x1,d=this._y1,h=[],g=this._root,v,b;for(g&&h.push(new dt(g,i,s,f,d)),r==null?r=1/0:(i=e-r,s=n-r,f=e+r,d=n+r,r*=r);v=h.pop();)if(!(!(g=v.node)||(a=v.x0)>f||(l=v.y0)>d||(c=v.x1)<i||(u=v.y1)<s))if(g.length){var _=(a+c)/2,m=(l+u)/2;h.push(new dt(g[3],_,m,c,u),new dt(g[2],a,m,_,u),new dt(g[1],_,l,c,m),new dt(g[0],a,l,_,m)),(b=(n>=m)<<1|e>=_)&&(v=h[h.length-1],h[h.length-1]=h[h.length-1-b],h[h.length-1-b]=v)}else{var w=e-+this._x.call(null,g.data),y=n-+this._y.call(null,g.data),S=w*w+y*y;if(S<r){var k=Math.sqrt(r=S);i=e-k,s=n-k,f=e+k,d=n+k,o=g.data}}return o}function iB(e){if(isNaN(f=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var n,r=this._root,o,i,s,a=this._x0,l=this._y0,c=this._x1,u=this._y1,f,d,h,g,v,b,_,m;if(!r)return this;if(r.length)for(;;){if((v=f>=(h=(a+c)/2))?a=h:c=h,(b=d>=(g=(l+u)/2))?l=g:u=g,n=r,!(r=r[_=b<<1|v]))return this;if(!r.length)break;(n[_+1&3]||n[_+2&3]||n[_+3&3])&&(o=n,m=_)}for(;r.data!==e;)if(i=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,i?(s?i.next=s:delete i.next,this):n?(s?n[_]=s:delete n[_],(r=n[0]||n[1]||n[2]||n[3])&&r===(n[3]||n[2]||n[1]||n[0])&&!r.length&&(o?o[m]=r:this._root=r),this):(this._root=s,this)}function sB(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function aB(){return this._root}function lB(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function cB(e){var n=[],r,o=this._root,i,s,a,l,c;for(o&&n.push(new dt(o,this._x0,this._y0,this._x1,this._y1));r=n.pop();)if(!e(o=r.node,s=r.x0,a=r.y0,l=r.x1,c=r.y1)&&o.length){var u=(s+l)/2,f=(a+c)/2;(i=o[3])&&n.push(new dt(i,u,f,l,c)),(i=o[2])&&n.push(new dt(i,s,f,u,c)),(i=o[1])&&n.push(new dt(i,u,a,l,f)),(i=o[0])&&n.push(new dt(i,s,a,u,f))}return this}function uB(e){var n=[],r=[],o;for(this._root&&n.push(new dt(this._root,this._x0,this._y0,this._x1,this._y1));o=n.pop();){var i=o.node;if(i.length){var s,a=o.x0,l=o.y0,c=o.x1,u=o.y1,f=(a+c)/2,d=(l+u)/2;(s=i[0])&&n.push(new dt(s,a,l,f,d)),(s=i[1])&&n.push(new dt(s,f,l,c,d)),(s=i[2])&&n.push(new dt(s,a,d,f,u)),(s=i[3])&&n.push(new dt(s,f,d,c,u))}r.push(o)}for(;o=r.pop();)e(o.node,o.x0,o.y0,o.x1,o.y1);return this}function dB(e){return e[0]}function fB(e){return arguments.length?(this._x=e,this):this._x}function hB(e){return e[1]}function pB(e){return arguments.length?(this._y=e,this):this._y}function CN(e,n,r){var o=new Qg(n??dB,r??hB,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function Qg(e,n,r,o,i,s){this._x=e,this._y=n,this._x0=r,this._y0=o,this._x1=i,this._y1=s,this._root=void 0}function Ex(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var gt=CN.prototype=Qg.prototype;gt.copy=function(){var e=new Qg(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,r,o;if(!n)return e;if(!n.length)return e._root=Ex(n),e;for(r=[{source:n,target:e._root=new Array(4)}];n=r.pop();)for(var i=0;i<4;++i)(o=n.source[i])&&(o.length?r.push({source:o,target:n.target[i]=new Array(4)}):n.target[i]=Ex(o));return e};gt.add=J7;gt.addAll=eB;gt.cover=tB;gt.data=nB;gt.extent=rB;gt.find=oB;gt.remove=iB;gt.removeAll=sB;gt.root=aB;gt.size=lB;gt.visit=cB;gt.visitAfter=uB;gt.x=fB;gt.y=pB;function mB(e){const n=+this._x.call(null,e),r=+this._y.call(null,e),o=+this._z.call(null,e);return NN(this.cover(n,r,o),n,r,o,e)}function NN(e,n,r,o,i){if(isNaN(n)||isNaN(r)||isNaN(o))return e;var s,a=e._root,l={data:i},c=e._x0,u=e._y0,f=e._z0,d=e._x1,h=e._y1,g=e._z1,v,b,_,m,w,y,S,k,C,N,E;if(!a)return e._root=l,e;for(;a.length;)if((S=n>=(v=(c+d)/2))?c=v:d=v,(k=r>=(b=(u+h)/2))?u=b:h=b,(C=o>=(_=(f+g)/2))?f=_:g=_,s=a,!(a=a[N=C<<2|k<<1|S]))return s[N]=l,e;if(m=+e._x.call(null,a.data),w=+e._y.call(null,a.data),y=+e._z.call(null,a.data),n===m&&r===w&&o===y)return l.next=a,s?s[N]=l:e._root=l,e;do s=s?s[N]=new Array(8):e._root=new Array(8),(S=n>=(v=(c+d)/2))?c=v:d=v,(k=r>=(b=(u+h)/2))?u=b:h=b,(C=o>=(_=(f+g)/2))?f=_:g=_;while((N=C<<2|k<<1|S)===(E=(y>=_)<<2|(w>=b)<<1|m>=v));return s[E]=a,s[N]=l,e}function gB(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n),o=new Float64Array(n),i=new Float64Array(n);let s=1/0,a=1/0,l=1/0,c=-1/0,u=-1/0,f=-1/0;for(let d=0,h,g,v,b;d<n;++d)isNaN(g=+this._x.call(null,h=e[d]))||isNaN(v=+this._y.call(null,h))||isNaN(b=+this._z.call(null,h))||(r[d]=g,o[d]=v,i[d]=b,g<s&&(s=g),g>c&&(c=g),v<a&&(a=v),v>u&&(u=v),b<l&&(l=b),b>f&&(f=b));if(s>c||a>u||l>f)return this;this.cover(s,a,l).cover(c,u,f);for(let d=0;d<n;++d)NN(this,r[d],o[d],i[d],e[d]);return this}function vB(e,n,r){if(isNaN(e=+e)||isNaN(n=+n)||isNaN(r=+r))return this;var o=this._x0,i=this._y0,s=this._z0,a=this._x1,l=this._y1,c=this._z1;if(isNaN(o))a=(o=Math.floor(e))+1,l=(i=Math.floor(n))+1,c=(s=Math.floor(r))+1;else{for(var u=a-o||1,f=this._root,d,h;o>e||e>=a||i>n||n>=l||s>r||r>=c;)switch(h=(r<s)<<2|(n<i)<<1|e<o,d=new Array(8),d[h]=f,f=d,u*=2,h){case 0:a=o+u,l=i+u,c=s+u;break;case 1:o=a-u,l=i+u,c=s+u;break;case 2:a=o+u,i=l-u,c=s+u;break;case 3:o=a-u,i=l-u,c=s+u;break;case 4:a=o+u,l=i+u,s=c-u;break;case 5:o=a-u,l=i+u,s=c-u;break;case 6:a=o+u,i=l-u,s=c-u;break;case 7:o=a-u,i=l-u,s=c-u;break}this._root&&this._root.length&&(this._root=f)}return this._x0=o,this._y0=i,this._z0=s,this._x1=a,this._y1=l,this._z1=c,this}function yB(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function xB(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Ce(e,n,r,o,i,s,a){this.node=e,this.x0=n,this.y0=r,this.z0=o,this.x1=i,this.y1=s,this.z1=a}function wB(e,n,r,o){var i,s=this._x0,a=this._y0,l=this._z0,c,u,f,d,h,g,v=this._x1,b=this._y1,_=this._z1,m=[],w=this._root,y,S;for(w&&m.push(new Ce(w,s,a,l,v,b,_)),o==null?o=1/0:(s=e-o,a=n-o,l=r-o,v=e+o,b=n+o,_=r+o,o*=o);y=m.pop();)if(!(!(w=y.node)||(c=y.x0)>v||(u=y.y0)>b||(f=y.z0)>_||(d=y.x1)<s||(h=y.y1)<a||(g=y.z1)<l))if(w.length){var k=(c+d)/2,C=(u+h)/2,N=(f+g)/2;m.push(new Ce(w[7],k,C,N,d,h,g),new Ce(w[6],c,C,N,k,h,g),new Ce(w[5],k,u,N,d,C,g),new Ce(w[4],c,u,N,k,C,g),new Ce(w[3],k,C,f,d,h,N),new Ce(w[2],c,C,f,k,h,N),new Ce(w[1],k,u,f,d,C,N),new Ce(w[0],c,u,f,k,C,N)),(S=(r>=N)<<2|(n>=C)<<1|e>=k)&&(y=m[m.length-1],m[m.length-1]=m[m.length-1-S],m[m.length-1-S]=y)}else{var E=e-+this._x.call(null,w.data),j=n-+this._y.call(null,w.data),A=r-+this._z.call(null,w.data),T=E*E+j*j+A*A;if(T<o){var D=Math.sqrt(o=T);s=e-D,a=n-D,l=r-D,v=e+D,b=n+D,_=r+D,i=w.data}}return i}const bB=(e,n,r,o,i,s)=>Math.sqrt((e-o)**2+(n-i)**2+(r-s)**2);function _B(e,n,r,o){const i=[],s=e-o,a=n-o,l=r-o,c=e+o,u=n+o,f=r+o;return this.visit((d,h,g,v,b,_,m)=>{if(!d.length)do{const w=d.data;bB(e,n,r,this._x(w),this._y(w),this._z(w))<=o&&i.push(w)}while(d=d.next);return h>c||g>u||v>f||b<s||_<a||m<l}),i}function SB(e){if(isNaN(h=+this._x.call(null,e))||isNaN(g=+this._y.call(null,e))||isNaN(v=+this._z.call(null,e)))return this;var n,r=this._root,o,i,s,a=this._x0,l=this._y0,c=this._z0,u=this._x1,f=this._y1,d=this._z1,h,g,v,b,_,m,w,y,S,k,C;if(!r)return this;if(r.length)for(;;){if((w=h>=(b=(a+u)/2))?a=b:u=b,(y=g>=(_=(l+f)/2))?l=_:f=_,(S=v>=(m=(c+d)/2))?c=m:d=m,n=r,!(r=r[k=S<<2|y<<1|w]))return this;if(!r.length)break;(n[k+1&7]||n[k+2&7]||n[k+3&7]||n[k+4&7]||n[k+5&7]||n[k+6&7]||n[k+7&7])&&(o=n,C=k)}for(;r.data!==e;)if(i=r,!(r=r.next))return this;return(s=r.next)&&delete r.next,i?(s?i.next=s:delete i.next,this):n?(s?n[k]=s:delete n[k],(r=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&r===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!r.length&&(o?o[C]=r:this._root=r),this):(this._root=s,this)}function kB(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function CB(){return this._root}function NB(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function EB(e){var n=[],r,o=this._root,i,s,a,l,c,u,f;for(o&&n.push(new Ce(o,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=n.pop();)if(!e(o=r.node,s=r.x0,a=r.y0,l=r.z0,c=r.x1,u=r.y1,f=r.z1)&&o.length){var d=(s+c)/2,h=(a+u)/2,g=(l+f)/2;(i=o[7])&&n.push(new Ce(i,d,h,g,c,u,f)),(i=o[6])&&n.push(new Ce(i,s,h,g,d,u,f)),(i=o[5])&&n.push(new Ce(i,d,a,g,c,h,f)),(i=o[4])&&n.push(new Ce(i,s,a,g,d,h,f)),(i=o[3])&&n.push(new Ce(i,d,h,l,c,u,g)),(i=o[2])&&n.push(new Ce(i,s,h,l,d,u,g)),(i=o[1])&&n.push(new Ce(i,d,a,l,c,h,g)),(i=o[0])&&n.push(new Ce(i,s,a,l,d,h,g))}return this}function jB(e){var n=[],r=[],o;for(this._root&&n.push(new Ce(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));o=n.pop();){var i=o.node;if(i.length){var s,a=o.x0,l=o.y0,c=o.z0,u=o.x1,f=o.y1,d=o.z1,h=(a+u)/2,g=(l+f)/2,v=(c+d)/2;(s=i[0])&&n.push(new Ce(s,a,l,c,h,g,v)),(s=i[1])&&n.push(new Ce(s,h,l,c,u,g,v)),(s=i[2])&&n.push(new Ce(s,a,g,c,h,f,v)),(s=i[3])&&n.push(new Ce(s,h,g,c,u,f,v)),(s=i[4])&&n.push(new Ce(s,a,l,v,h,g,d)),(s=i[5])&&n.push(new Ce(s,h,l,v,u,g,d)),(s=i[6])&&n.push(new Ce(s,a,g,v,h,f,d)),(s=i[7])&&n.push(new Ce(s,h,g,v,u,f,d))}r.push(o)}for(;o=r.pop();)e(o.node,o.x0,o.y0,o.z0,o.x1,o.y1,o.z1);return this}function PB(e){return e[0]}function MB(e){return arguments.length?(this._x=e,this):this._x}function RB(e){return e[1]}function AB(e){return arguments.length?(this._y=e,this):this._y}function TB(e){return e[2]}function IB(e){return arguments.length?(this._z=e,this):this._z}function EN(e,n,r,o){var i=new Zg(n??PB,r??RB,o??TB,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function Zg(e,n,r,o,i,s,a,l,c){this._x=e,this._y=n,this._z=r,this._x0=o,this._y0=i,this._z0=s,this._x1=a,this._y1=l,this._z1=c,this._root=void 0}function jx(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var et=EN.prototype=Zg.prototype;et.copy=function(){var e=new Zg(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root,r,o;if(!n)return e;if(!n.length)return e._root=jx(n),e;for(r=[{source:n,target:e._root=new Array(8)}];n=r.pop();)for(var i=0;i<8;++i)(o=n.source[i])&&(o.length?r.push({source:o,target:n.target[i]=new Array(8)}):n.target[i]=jx(o));return e};et.add=mB;et.addAll=gB;et.cover=vB;et.data=yB;et.extent=xB;et.find=wB;et.findAllWithinRadius=_B;et.remove=SB;et.removeAll=kB;et.root=CB;et.size=NB;et.visit=EB;et.visitAfter=jB;et.x=MB;et.y=AB;et.z=IB;function Qn(e){return function(){return e}}function Yn(e){return(e()-.5)*1e-6}function OB(e){return e.index}function Px(e,n){var r=e.get(n);if(!r)throw new Error("node not found: "+n);return r}function $B(e){var n=OB,r=h,o,i=Qn(30),s,a,l,c,u,f,d=1;e==null&&(e=[]);function h(m){return 1/Math.min(c[m.source.index],c[m.target.index])}function g(m){for(var w=0,y=e.length;w<d;++w)for(var S=0,k,C,N,E=0,j=0,A=0,T,D;S<y;++S)k=e[S],C=k.source,N=k.target,E=N.x+N.vx-C.x-C.vx||Yn(f),l>1&&(j=N.y+N.vy-C.y-C.vy||Yn(f)),l>2&&(A=N.z+N.vz-C.z-C.vz||Yn(f)),T=Math.sqrt(E*E+j*j+A*A),T=(T-s[S])/T*m*o[S],E*=T,j*=T,A*=T,N.vx-=E*(D=u[S]),l>1&&(N.vy-=j*D),l>2&&(N.vz-=A*D),C.vx+=E*(D=1-D),l>1&&(C.vy+=j*D),l>2&&(C.vz+=A*D)}function v(){if(a){var m,w=a.length,y=e.length,S=new Map(a.map((C,N)=>[n(C,N,a),C])),k;for(m=0,c=new Array(w);m<y;++m)k=e[m],k.index=m,typeof k.source!="object"&&(k.source=Px(S,k.source)),typeof k.target!="object"&&(k.target=Px(S,k.target)),c[k.source.index]=(c[k.source.index]||0)+1,c[k.target.index]=(c[k.target.index]||0)+1;for(m=0,u=new Array(y);m<y;++m)k=e[m],u[m]=c[k.source.index]/(c[k.source.index]+c[k.target.index]);o=new Array(y),b(),s=new Array(y),_()}}function b(){if(a)for(var m=0,w=e.length;m<w;++m)o[m]=+r(e[m],m,e)}function _(){if(a)for(var m=0,w=e.length;m<w;++m)s[m]=+i(e[m],m,e)}return g.initialize=function(m,...w){a=m,f=w.find(y=>typeof y=="function")||Math.random,l=w.find(y=>[1,2,3].includes(y))||2,v()},g.links=function(m){return arguments.length?(e=m,v(),g):e},g.id=function(m){return arguments.length?(n=m,g):n},g.iterations=function(m){return arguments.length?(d=+m,g):d},g.strength=function(m){return arguments.length?(r=typeof m=="function"?m:Qn(+m),b(),g):r},g.distance=function(m){return arguments.length?(i=typeof m=="function"?m:Qn(+m),_(),g):i},g}const DB=1664525,LB=1013904223,Mx=4294967296;function zB(){let e=1;return()=>(e=(DB*e+LB)%Mx)/Mx}var Rx=3;function Kf(e){return e.x}function Ax(e){return e.y}function FB(e){return e.z}var BB=10,HB=Math.PI*(3-Math.sqrt(5)),UB=Math.PI*20/(9+Math.sqrt(221));function VB(e,n){n=n||2;var r=Math.min(Rx,Math.max(1,Math.round(n))),o,i=1,s=.001,a=1-Math.pow(s,1/300),l=0,c=.6,u=new Map,f=Bg(g),d=nl("tick","end"),h=zB();e==null&&(e=[]);function g(){v(),d.call("tick",o),i<s&&(f.stop(),d.call("end",o))}function v(m){var w,y=e.length,S;m===void 0&&(m=1);for(var k=0;k<m;++k)for(i+=(l-i)*a,u.forEach(function(C){C(i)}),w=0;w<y;++w)S=e[w],S.fx==null?S.x+=S.vx*=c:(S.x=S.fx,S.vx=0),r>1&&(S.fy==null?S.y+=S.vy*=c:(S.y=S.fy,S.vy=0)),r>2&&(S.fz==null?S.z+=S.vz*=c:(S.z=S.fz,S.vz=0));return o}function b(){for(var m=0,w=e.length,y;m<w;++m){if(y=e[m],y.index=m,y.fx!=null&&(y.x=y.fx),y.fy!=null&&(y.y=y.fy),y.fz!=null&&(y.z=y.fz),isNaN(y.x)||r>1&&isNaN(y.y)||r>2&&isNaN(y.z)){var S=BB*(r>2?Math.cbrt(.5+m):r>1?Math.sqrt(.5+m):m),k=m*HB,C=m*UB;r===1?y.x=S:r===2?(y.x=S*Math.cos(k),y.y=S*Math.sin(k)):(y.x=S*Math.sin(k)*Math.cos(C),y.y=S*Math.cos(k),y.z=S*Math.sin(k)*Math.sin(C))}(isNaN(y.vx)||r>1&&isNaN(y.vy)||r>2&&isNaN(y.vz))&&(y.vx=0,r>1&&(y.vy=0),r>2&&(y.vz=0))}}function _(m){return m.initialize&&m.initialize(e,h,r),m}return b(),o={tick:v,restart:function(){return f.restart(g),o},stop:function(){return f.stop(),o},numDimensions:function(m){return arguments.length?(r=Math.min(Rx,Math.max(1,Math.round(m))),u.forEach(_),o):r},nodes:function(m){return arguments.length?(e=m,b(),u.forEach(_),o):e},alpha:function(m){return arguments.length?(i=+m,o):i},alphaMin:function(m){return arguments.length?(s=+m,o):s},alphaDecay:function(m){return arguments.length?(a=+m,o):+a},alphaTarget:function(m){return arguments.length?(l=+m,o):l},velocityDecay:function(m){return arguments.length?(c=1-m,o):1-c},randomSource:function(m){return arguments.length?(h=m,u.forEach(_),o):h},force:function(m,w){return arguments.length>1?(w==null?u.delete(m):u.set(m,_(w)),o):u.get(m)},find:function(){var m=Array.prototype.slice.call(arguments),w=m.shift()||0,y=(r>1?m.shift():null)||0,S=(r>2?m.shift():null)||0,k=m.shift()||1/0,C=0,N=e.length,E,j,A,T,D,F;for(k*=k,C=0;C<N;++C)D=e[C],E=w-D.x,j=y-(D.y||0),A=S-(D.z||0),T=E*E+j*j+A*A,T<k&&(F=D,k=T);return F},on:function(m,w){return arguments.length>1?(d.on(m,w),o):d.on(m)}}}function WB(){var e,n,r,o,i,s=Qn(-30),a,l=1,c=1/0,u=.81;function f(v){var b,_=e.length,m=(n===1?SN(e,Kf):n===2?CN(e,Kf,Ax):n===3?EN(e,Kf,Ax,FB):null).visitAfter(h);for(i=v,b=0;b<_;++b)r=e[b],m.visit(g)}function d(){if(e){var v,b=e.length,_;for(a=new Array(b),v=0;v<b;++v)_=e[v],a[_.index]=+s(_,v,e)}}function h(v){var b=0,_,m,w=0,y,S,k,C,N=v.length;if(N){for(y=S=k=C=0;C<N;++C)(_=v[C])&&(m=Math.abs(_.value))&&(b+=_.value,w+=m,y+=m*(_.x||0),S+=m*(_.y||0),k+=m*(_.z||0));b*=Math.sqrt(4/N),v.x=y/w,n>1&&(v.y=S/w),n>2&&(v.z=k/w)}else{_=v,_.x=_.data.x,n>1&&(_.y=_.data.y),n>2&&(_.z=_.data.z);do b+=a[_.data.index];while(_=_.next)}v.value=b}function g(v,b,_,m,w){if(!v.value)return!0;var y=[_,m,w][n-1],S=v.x-r.x,k=n>1?v.y-r.y:0,C=n>2?v.z-r.z:0,N=y-b,E=S*S+k*k+C*C;if(N*N/u<E)return E<c&&(S===0&&(S=Yn(o),E+=S*S),n>1&&k===0&&(k=Yn(o),E+=k*k),n>2&&C===0&&(C=Yn(o),E+=C*C),E<l&&(E=Math.sqrt(l*E)),r.vx+=S*v.value*i/E,n>1&&(r.vy+=k*v.value*i/E),n>2&&(r.vz+=C*v.value*i/E)),!0;if(v.length||E>=c)return;(v.data!==r||v.next)&&(S===0&&(S=Yn(o),E+=S*S),n>1&&k===0&&(k=Yn(o),E+=k*k),n>2&&C===0&&(C=Yn(o),E+=C*C),E<l&&(E=Math.sqrt(l*E)));do v.data!==r&&(N=a[v.data.index]*i/E,r.vx+=S*N,n>1&&(r.vy+=k*N),n>2&&(r.vz+=C*N));while(v=v.next)}return f.initialize=function(v,...b){e=v,o=b.find(_=>typeof _=="function")||Math.random,n=b.find(_=>[1,2,3].includes(_))||2,d()},f.strength=function(v){return arguments.length?(s=typeof v=="function"?v:Qn(+v),d(),f):s},f.distanceMin=function(v){return arguments.length?(l=v*v,f):Math.sqrt(l)},f.distanceMax=function(v){return arguments.length?(c=v*v,f):Math.sqrt(c)},f.theta=function(v){return arguments.length?(u=v*v,f):Math.sqrt(u)},f}function GB(e,n,r,o){var i,s,a=Qn(.1),l,c;typeof e!="function"&&(e=Qn(+e)),n==null&&(n=0),r==null&&(r=0),o==null&&(o=0);function u(d){for(var h=0,g=i.length;h<g;++h){var v=i[h],b=v.x-n||1e-6,_=(v.y||0)-r||1e-6,m=(v.z||0)-o||1e-6,w=Math.sqrt(b*b+_*_+m*m),y=(c[h]-w)*l[h]*d/w;v.vx+=b*y,s>1&&(v.vy+=_*y),s>2&&(v.vz+=m*y)}}function f(){if(i){var d,h=i.length;for(l=new Array(h),c=new Array(h),d=0;d<h;++d)c[d]=+e(i[d],d,i),l[d]=isNaN(c[d])?0:+a(i[d],d,i)}}return u.initialize=function(d,...h){i=d,s=h.find(g=>[1,2,3].includes(g))||2,f()},u.strength=function(d){return arguments.length?(a=typeof d=="function"?d:Qn(+d),f(),u):a},u.radius=function(d){return arguments.length?(e=typeof d=="function"?d:Qn(+d),f(),u):e},u.x=function(d){return arguments.length?(n=+d,u):n},u.y=function(d){return arguments.length?(r=+d,u):r},u.z=function(d){return arguments.length?(o=+d,u):o},u}const{abs:js,cos:Un,sin:Jo,acos:YB,atan2:Ps,sqrt:yr,pow:Ft}=Math;function Ms(e){return e<0?-Ft(-e,1/3):Ft(e,1/3)}const jN=Math.PI,tc=2*jN,xr=jN/2,XB=1e-6,qf=Number.MAX_SAFE_INTEGER||9007199254740991,Qf=Number.MIN_SAFE_INTEGER||-9007199254740991,KB={x:0,y:0,z:0},J={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){const r=n(e);let o=r.x*r.x+r.y*r.y;return typeof r.z<"u"&&(o+=r.z*r.z),yr(o)},compute:function(e,n,r){if(e===0)return n[0].t=0,n[0];const o=n.length-1;if(e===1)return n[o].t=1,n[o];const i=1-e;let s=n;if(o===0)return n[0].t=e,n[0];if(o===1){const l={x:i*s[0].x+e*s[1].x,y:i*s[0].y+e*s[1].y,t:e};return r&&(l.z=i*s[0].z+e*s[1].z),l}if(o<4){let l=i*i,c=e*e,u,f,d,h=0;o===2?(s=[s[0],s[1],s[2],KB],u=l,f=i*e*2,d=c):o===3&&(u=l*i,f=l*e*3,d=i*c*3,h=e*c);const g={x:u*s[0].x+f*s[1].x+d*s[2].x+h*s[3].x,y:u*s[0].y+f*s[1].y+d*s[2].y+h*s[3].y,t:e};return r&&(g.z=u*s[0].z+f*s[1].z+d*s[2].z+h*s[3].z),g}const a=JSON.parse(JSON.stringify(n));for(;a.length>1;){for(let l=0;l<a.length-1;l++)a[l]={x:a[l].x+(a[l+1].x-a[l].x)*e,y:a[l].y+(a[l+1].y-a[l].y)*e},typeof a[l].z<"u"&&(a[l].z=a[l].z+(a[l+1].z-a[l].z)*e);a.splice(a.length-1,1)}return a[0].t=e,a[0]},computeWithRatios:function(e,n,r,o){const i=1-e,s=r,a=n;let l=s[0],c=s[1],u=s[2],f=s[3],d;if(l*=i,c*=e,a.length===2)return d=l+c,{x:(l*a[0].x+c*a[1].x)/d,y:(l*a[0].y+c*a[1].y)/d,z:o?(l*a[0].z+c*a[1].z)/d:!1,t:e};if(l*=i,c*=2*i,u*=e*e,a.length===3)return d=l+c+u,{x:(l*a[0].x+c*a[1].x+u*a[2].x)/d,y:(l*a[0].y+c*a[1].y+u*a[2].y)/d,z:o?(l*a[0].z+c*a[1].z+u*a[2].z)/d:!1,t:e};if(l*=i,c*=1.5*i,u*=3*i,f*=e*e*e,a.length===4)return d=l+c+u+f,{x:(l*a[0].x+c*a[1].x+u*a[2].x+f*a[3].x)/d,y:(l*a[0].y+c*a[1].y+u*a[2].y+f*a[3].y)/d,z:o?(l*a[0].z+c*a[1].z+u*a[2].z+f*a[3].z)/d:!1,t:e}},derive:function(e,n){const r=[];for(let o=e,i=o.length,s=i-1;i>1;i--,s--){const a=[];for(let l=0,c;l<s;l++)c={x:s*(o[l+1].x-o[l].x),y:s*(o[l+1].y-o[l].y)},n&&(c.z=s*(o[l+1].z-o[l].z)),a.push(c);r.push(a),o=a}return r},between:function(e,n,r){return n<=e&&e<=r||J.approximately(e,n)||J.approximately(e,r)},approximately:function(e,n,r){return js(e-n)<=(r||XB)},length:function(e){const r=J.Tvalues.length;let o=0;for(let i=0,s;i<r;i++)s=.5*J.Tvalues[i]+.5,o+=J.Cvalues[i]*J.arcfn(s,e);return .5*o},map:function(e,n,r,o,i){const s=r-n,a=i-o,l=e-n,c=l/s;return o+a*c},lerp:function(e,n,r){const o={x:n.x+e*(r.x-n.x),y:n.y+e*(r.y-n.y)};return n.z!==void 0&&r.z!==void 0&&(o.z=n.z+e*(r.z-n.z)),o},pointToString:function(e){let n=e.x+"/"+e.y;return typeof e.z<"u"&&(n+="/"+e.z),n},pointsToString:function(e){return"["+e.map(J.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,n,r){const o=n.x-e.x,i=n.y-e.y,s=r.x-e.x,a=r.y-e.y,l=o*a-i*s,c=o*s+i*a;return Ps(l,c)},round:function(e,n){const r=""+e,o=r.indexOf(".");return parseFloat(r.substring(0,o+1+n))},dist:function(e,n){const r=e.x-n.x,o=e.y-n.y;return yr(r*r+o*o)},closest:function(e,n){let r=Ft(2,63),o,i;return e.forEach(function(s,a){i=J.dist(n,s),i<r&&(r=i,o=a)}),{mdist:r,mpos:o}},abcratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=Ft(e,n)+Ft(1-e,n),o=r-1;return js(o/r)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=Ft(1-e,n),o=Ft(e,n)+r;return r/o},lli8:function(e,n,r,o,i,s,a,l){const c=(e*o-n*r)*(i-a)-(e-r)*(i*l-s*a),u=(e*o-n*r)*(s-l)-(n-o)*(i*l-s*a),f=(e-r)*(s-l)-(n-o)*(i-a);return f==0?!1:{x:c/f,y:u/f}},lli4:function(e,n,r,o){const i=e.x,s=e.y,a=n.x,l=n.y,c=r.x,u=r.y,f=o.x,d=o.y;return J.lli8(i,s,a,l,c,u,f,d)},lli:function(e,n){return J.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new je(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=qf,r=qf,o=Qf,i=Qf;return e.forEach(function(s){const a=s.bbox();n>a.x.min&&(n=a.x.min),r>a.y.min&&(r=a.y.min),o<a.x.max&&(o=a.x.max),i<a.y.max&&(i=a.y.max)}),{x:{min:n,mid:(n+o)/2,max:o,size:o-n},y:{min:r,mid:(r+i)/2,max:i,size:i-r}}},shapeintersections:function(e,n,r,o,i){if(!J.bboxoverlap(n,o))return[];const s=[],a=[e.startcap,e.forward,e.back,e.endcap],l=[r.startcap,r.forward,r.back,r.endcap];return a.forEach(function(c){c.virtual||l.forEach(function(u){if(u.virtual)return;const f=c.intersects(u,i);f.length>0&&(f.c1=c,f.c2=u,f.s1=e,f.s2=r,s.push(f))})}),s},makeshape:function(e,n,r){const o=n.points.length,i=e.points.length,s=J.makeline(n.points[o-1],e.points[0]),a=J.makeline(e.points[i-1],n.points[0]),l={startcap:s,forward:e,back:n,endcap:a,bbox:J.findbbox([s,e,n,a])};return l.intersections=function(c){return J.shapeintersections(l,l.bbox,c,c.bbox,r)},l},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let o=qf,i=Qf,s,a;r.indexOf(0)===-1&&(r=[0].concat(r)),r.indexOf(1)===-1&&r.push(1);for(let l=0,c=r.length;l<c;l++)s=r[l],a=e.get(s),a[n]<o&&(o=a[n]),a[n]>i&&(i=a[n]);return{min:o,mid:(o+i)/2,max:i,size:i-o}},align:function(e,n){const r=n.p1.x,o=n.p1.y,i=-Ps(n.p2.y-o,n.p2.x-r),s=function(a){return{x:(a.x-r)*Un(i)-(a.y-o)*Jo(i),y:(a.x-r)*Jo(i)+(a.y-o)*Un(i)}};return e.map(s)},roots:function(e,n){n=n||{p1:{x:0,y:0},p2:{x:1,y:0}};const r=e.length-1,o=J.align(e,n),i=function(N){return 0<=N&&N<=1};if(r===2){const N=o[0].y,E=o[1].y,j=o[2].y,A=N-2*E+j;if(A!==0){const T=-yr(E*E-N*j),D=-N+E,F=-(T+D)/A,P=-(-T+D)/A;return[F,P].filter(i)}else if(E!==j&&A===0)return[(2*E-j)/(2*E-2*j)].filter(i);return[]}const s=o[0].y,a=o[1].y,l=o[2].y,c=o[3].y;let u=-s+3*a-3*l+c,f=3*s-6*a+3*l,d=-3*s+3*a,h=s;if(J.approximately(u,0)){if(J.approximately(f,0))return J.approximately(d,0)?[]:[-h/d].filter(i);const N=yr(d*d-4*f*h),E=2*f;return[(N-d)/E,(-d-N)/E].filter(i)}f/=u,d/=u,h/=u;const g=(3*d-f*f)/3,v=g/3,b=(2*f*f*f-9*f*d+27*h)/27,_=b/2,m=_*_+v*v*v;let w,y,S,k,C;if(m<0){const N=-g/3,E=N*N*N,j=yr(E),A=-b/(2*j),T=A<-1?-1:A>1?1:A,D=YB(T),F=Ms(j),P=2*F;return S=P*Un(D/3)-f/3,k=P*Un((D+tc)/3)-f/3,C=P*Un((D+2*tc)/3)-f/3,[S,k,C].filter(i)}else{if(m===0)return w=_<0?Ms(-_):-Ms(_),S=2*w-f/3,k=-w-f/3,[S,k].filter(i);{const N=yr(m);return w=Ms(-_+N),y=Ms(_+N),[w-y-f/3].filter(i)}}},droots:function(e){if(e.length===3){const n=e[0],r=e[1],o=e[2],i=n-2*r+o;if(i!==0){const s=-yr(r*r-n*o),a=-n+r,l=-(s+a)/i,c=-(-s+a)/i;return[l,c]}else if(r!==o&&i===0)return[(2*r-o)/(2*(r-o))];return[]}if(e.length===2){const n=e[0],r=e[1];return n!==r?[n/(n-r)]:[]}return[]},curvature:function(e,n,r,o,i){let s,a,l,c,u=0,f=0;const d=J.compute(e,n),h=J.compute(e,r),g=d.x*d.x+d.y*d.y;if(o?(s=yr(Ft(d.y*h.z-h.y*d.z,2)+Ft(d.z*h.x-h.z*d.x,2)+Ft(d.x*h.y-h.x*d.y,2)),a=Ft(g+d.z*d.z,3/2)):(s=d.x*h.y-d.y*h.x,a=Ft(g,3/2)),s===0||a===0)return{k:0,r:0};if(u=s/a,f=a/s,!i){const v=J.curvature(e-.001,n,r,o,!0).k,b=J.curvature(e+.001,n,r,o,!0).k;c=(b-u+(u-v))/2,l=(js(b-u)+js(u-v))/2}return{k:u,r:f,dk:c,adk:l}},inflections:function(e){if(e.length<4)return[];const n=J.align(e,{p1:e[0],p2:e.slice(-1)[0]}),r=n[2].x*n[1].y,o=n[3].x*n[1].y,i=n[1].x*n[2].y,s=n[3].x*n[2].y,a=18*(-3*r+2*o+3*i-s),l=18*(3*r-o-3*i),c=18*(i-r);if(J.approximately(a,0)){if(!J.approximately(l,0)){let h=-c/l;if(0<=h&&h<=1)return[h]}return[]}const u=2*a;if(J.approximately(u,0))return[];const f=l*l-4*a*c;if(f<0)return[];const d=Math.sqrt(f);return[(d-l)/u,-(l+d)/u].filter(function(h){return 0<=h&&h<=1})},bboxoverlap:function(e,n){const r=["x","y"],o=r.length;for(let i=0,s,a,l,c;i<o;i++)if(s=r[i],a=e[s].mid,l=n[s].mid,c=(e[s].size+n[s].size)/2,js(a-l)>=c)return!1;return!0},expandbox:function(e,n){n.x.min<e.x.min&&(e.x.min=n.x.min),n.y.min<e.y.min&&(e.y.min=n.y.min),n.z&&n.z.min<e.z.min&&(e.z.min=n.z.min),n.x.max>e.x.max&&(e.x.max=n.x.max),n.y.max>e.y.max&&(e.y.max=n.y.max),n.z&&n.z.max>e.z.max&&(e.z.max=n.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,n,r){const o=e.bbox(),i=n.bbox(),s=1e5,a=r||.5;if(o.x.size+o.y.size<a&&i.x.size+i.y.size<a)return[(s*(e._t1+e._t2)/2|0)/s+"/"+(s*(n._t1+n._t2)/2|0)/s];let l=e.split(.5),c=n.split(.5),u=[{left:l.left,right:c.left},{left:l.left,right:c.right},{left:l.right,right:c.right},{left:l.right,right:c.left}];u=u.filter(function(d){return J.bboxoverlap(d.left.bbox(),d.right.bbox())});let f=[];return u.length===0||(u.forEach(function(d){f=f.concat(J.pairiteration(d.left,d.right,a))}),f=f.filter(function(d,h){return f.indexOf(d)===h})),f},getccenter:function(e,n,r){const o=n.x-e.x,i=n.y-e.y,s=r.x-n.x,a=r.y-n.y,l=o*Un(xr)-i*Jo(xr),c=o*Jo(xr)+i*Un(xr),u=s*Un(xr)-a*Jo(xr),f=s*Jo(xr)+a*Un(xr),d=(e.x+n.x)/2,h=(e.y+n.y)/2,g=(n.x+r.x)/2,v=(n.y+r.y)/2,b=d+l,_=h+c,m=g+u,w=v+f,y=J.lli8(d,h,b,_,g,v,m,w),S=J.dist(y,e);let k=Ps(e.y-y.y,e.x-y.x),C=Ps(n.y-y.y,n.x-y.x),N=Ps(r.y-y.y,r.x-y.x),E;return k<N?((k>C||C>N)&&(k+=tc),k>N&&(E=N,N=k,k=E)):N<C&&C<k?(E=N,N=k,k=E):N+=tc,y.s=k,y.e=N,y.r=S,y},numberSort:function(e,n){return e-n}};class na{constructor(n){this.curves=[],this._3d=!1,n&&(this.curves=n,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map(function(n){return J.pointsToString(n.points)}).join(", ")+"]"}addCurve(n){this.curves.push(n),this._3d=this._3d||n._3d}length(){return this.curves.map(function(n){return n.length()}).reduce(function(n,r){return n+r})}curve(n){return this.curves[n]}bbox(){const n=this.curves;for(var r=n[0].bbox(),o=1;o<n.length;o++)J.expandbox(r,n[o].bbox());return r}offset(n){const r=[];return this.curves.forEach(function(o){r.push(...o.offset(n))}),new na(r)}}const{abs:Rs,min:Tx,max:Ix,cos:qB,sin:QB,acos:ZB,sqrt:As}=Math,JB=Math.PI;class je{constructor(n){let r=n&&n.forEach?n:Array.from(arguments).slice(),o=!1;if(typeof r[0]=="object"){o=r.length;const g=[];r.forEach(function(v){["x","y","z"].forEach(function(b){typeof v[b]<"u"&&g.push(v[b])})}),r=g}let i=!1;const s=r.length;if(o){if(o>4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");i=!0}}else if(s!==6&&s!==8&&s!==9&&s!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const a=this._3d=!i&&(s===9||s===12)||n&&n[0]&&typeof n[0].z<"u",l=this.points=[];for(let g=0,v=a?3:2;g<s;g+=v){var c={x:r[g],y:r[g+1]};a&&(c.z=r[g+2]),l.push(c)}const u=this.order=l.length-1,f=this.dims=["x","y"];a&&f.push("z"),this.dimlen=f.length;const d=J.align(l,{p1:l[0],p2:l[u]}),h=J.dist(l[0],l[u]);this._linear=d.reduce((g,v)=>g+Rs(v.y),0)<h/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(n,r,o,i){if(typeof i>"u"&&(i=.5),i===0)return new je(r,r,o);if(i===1)return new je(n,r,r);const s=je.getABC(2,n,r,o,i);return new je(n,s.A,o)}static cubicFromPoints(n,r,o,i,s){typeof i>"u"&&(i=.5);const a=je.getABC(3,n,r,o,i);typeof s>"u"&&(s=J.dist(r,a.C));const l=s*(1-i)/i,c=J.dist(n,o),u=(o.x-n.x)/c,f=(o.y-n.y)/c,d=s*u,h=s*f,g=l*u,v=l*f,b={x:r.x-d,y:r.y-h},_={x:r.x+g,y:r.y+v},m=a.A,w={x:m.x+(b.x-m.x)/(1-i),y:m.y+(b.y-m.y)/(1-i)},y={x:m.x+(_.x-m.x)/i,y:m.y+(_.y-m.y)/i},S={x:n.x+(w.x-n.x)/i,y:n.y+(w.y-n.y)/i},k={x:o.x+(y.x-o.x)/(1-i),y:o.y+(y.y-o.y)/(1-i)};return new je(n,S,k,o)}static getUtils(){return J}getUtils(){return je.getUtils()}static get PolyBezier(){return na}valueOf(){return this.toString()}toString(){return J.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const n=this.points,r=n[0].x,o=n[0].y,i=["M",r,o,this.order===2?"Q":"C"];for(let s=1,a=n.length;s<a;s++)i.push(n[s].x),i.push(n[s].y);return i.join(" ")}setRatios(n){if(n.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=n,this._lut=[]}verify(){const n=this.coordDigest();n!==this._print&&(this._print=n,this.update())}coordDigest(){return this.points.map(function(n,r){return""+r+n.x+n.y+(n.z?n.z:0)}).join("")}update(){this._lut=[],this.dpoints=J.derive(this.points,this._3d),this.computedirection()}computedirection(){const n=this.points,r=J.angle(n[0],n[this.order],n[1]);this.clockwise=r>0}length(){return J.length(this.derivative.bind(this))}static getABC(n=2,r,o,i,s=.5){const a=J.projectionratio(s,n),l=1-a,c={x:a*r.x+l*i.x,y:a*r.y+l*i.y},u=J.abcratio(s,n);return{A:{x:o.x+(o.x-c.x)/u,y:o.y+(o.y-c.y)/u},B:o,C:c,S:r,E:i}}getABC(n,r){r=r||this.get(n);let o=this.points[0],i=this.points[this.order];return je.getABC(this.order,o,r,i,n)}getLUT(n){if(this.verify(),n=n||100,this._lut.length===n+1)return this._lut;this._lut=[],n++,this._lut=[];for(let r=0,o,i;r<n;r++)i=r/(n-1),o=this.compute(i),o.t=i,this._lut.push(o);return this._lut}on(n,r){r=r||5;const o=this.getLUT(),i=[];for(let s=0,a,l=0;s<o.length;s++)a=o[s],J.dist(a,n)<r&&(i.push(a),l+=s/o.length);return i.length?t/=i.length:!1}project(n){const r=this.getLUT(),o=r.length-1,i=J.closest(r,n),s=i.mpos,a=(s-1)/o,l=(s+1)/o,c=.1/o;let u=i.mdist,f=a,d=f,h;u+=1;for(let g;f<l+c;f+=c)h=this.compute(f),g=J.dist(n,h),g<u&&(u=g,d=f);return d=d<0?0:d>1?1:d,h=this.compute(d),h.t=d,h.d=u,h}get(n){return this.compute(n)}point(n){return this.points[n]}compute(n){return this.ratios?J.computeWithRatios(n,this.points,this.ratios,this._3d):J.compute(n,this.points,this._3d,this.ratios)}raise(){const n=this.points,r=[n[0]],o=n.length;for(let i=1,s,a;i<o;i++)s=n[i],a=n[i-1],r[i]={x:(o-i)/o*s.x+i/o*a.x,y:(o-i)/o*s.y+i/o*a.y};return r[o]=n[o-1],new je(r)}derivative(n){return J.compute(n,this.dpoints[0],this._3d)}dderivative(n){return J.compute(n,this.dpoints[1],this._3d)}align(){let n=this.points;return new je(J.align(n,{p1:n[0],p2:n[n.length-1]}))}curvature(n){return J.curvature(n,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return J.inflections(this.points)}normal(n){return this._3d?this.__normal3(n):this.__normal2(n)}__normal2(n){const r=this.derivative(n),o=As(r.x*r.x+r.y*r.y);return{t:n,x:-r.y/o,y:r.x/o}}__normal3(n){const r=this.derivative(n),o=this.derivative(n+.01),i=As(r.x*r.x+r.y*r.y+r.z*r.z),s=As(o.x*o.x+o.y*o.y+o.z*o.z);r.x/=i,r.y/=i,r.z/=i,o.x/=s,o.y/=s,o.z/=s;const a={x:o.y*r.z-o.z*r.y,y:o.z*r.x-o.x*r.z,z:o.x*r.y-o.y*r.x},l=As(a.x*a.x+a.y*a.y+a.z*a.z);a.x/=l,a.y/=l,a.z/=l;const c=[a.x*a.x,a.x*a.y-a.z,a.x*a.z+a.y,a.x*a.y+a.z,a.y*a.y,a.y*a.z-a.x,a.x*a.z-a.y,a.y*a.z+a.x,a.z*a.z];return{t:n,x:c[0]*r.x+c[1]*r.y+c[2]*r.z,y:c[3]*r.x+c[4]*r.y+c[5]*r.z,z:c[6]*r.x+c[7]*r.y+c[8]*r.z}}hull(n){let r=this.points,o=[],i=[],s=0;for(i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],this.order===3&&(i[s++]=r[3]);r.length>1;){o=[];for(let a=0,l,c=r.length-1;a<c;a++)l=J.lerp(n,r[a],r[a+1]),i[s++]=l,o.push(l);r=o}return i}split(n,r){if(n===0&&r)return this.split(r).left;if(r===1)return this.split(n).right;const o=this.hull(n),i={left:this.order===2?new je([o[0],o[3],o[5]]):new je([o[0],o[4],o[7],o[9]]),right:this.order===2?new je([o[5],o[4],o[2]]):new je([o[9],o[8],o[6],o[3]]),span:o};return i.left._t1=J.map(0,0,1,this._t1,this._t2),i.left._t2=J.map(n,0,1,this._t1,this._t2),i.right._t1=J.map(n,0,1,this._t1,this._t2),i.right._t2=J.map(1,0,1,this._t1,this._t2),r?(r=J.map(r,n,1,0,1),i.right.split(r).left):i}extrema(){const n={};let r=[];return this.dims.forEach((function(o){let i=function(a){return a[o]},s=this.dpoints[0].map(i);n[o]=J.droots(s),this.order===3&&(s=this.dpoints[1].map(i),n[o]=n[o].concat(J.droots(s))),n[o]=n[o].filter(function(a){return a>=0&&a<=1}),r=r.concat(n[o].sort(J.numberSort))}).bind(this)),n.values=r.sort(J.numberSort).filter(function(o,i){return r.indexOf(o)===i}),n}bbox(){const n=this.extrema(),r={};return this.dims.forEach((function(o){r[o]=J.getminmax(this,o,n[o])}).bind(this)),r}overlaps(n){const r=this.bbox(),o=n.bbox();return J.bboxoverlap(r,o)}offset(n,r){if(typeof r<"u"){const o=this.get(n),i=this.normal(n),s={c:o,n:i,x:o.x+i.x*r,y:o.y+i.y*r};return this._3d&&(s.z=o.z+i.z*r),s}if(this._linear){const o=this.normal(0),i=this.points.map(function(s){const a={x:s.x+n*o.x,y:s.y+n*o.y};return s.z&&o.z&&(a.z=s.z+n*o.z),a});return[new je(i)]}return this.reduce().map(function(o){return o._linear?o.offset(n)[0]:o.scale(n)})}simple(){if(this.order===3){const i=J.angle(this.points[0],this.points[3],this.points[1]),s=J.angle(this.points[0],this.points[3],this.points[2]);if(i>0&&s<0||i<0&&s>0)return!1}const n=this.normal(0),r=this.normal(1);let o=n.x*r.x+n.y*r.y;return this._3d&&(o+=n.z*r.z),Rs(ZB(o))<JB/3}reduce(){let n,r=0,o=0,i=.01,s,a=[],l=[],c=this.extrema().values;for(c.indexOf(0)===-1&&(c=[0].concat(c)),c.indexOf(1)===-1&&c.push(1),r=c[0],n=1;n<c.length;n++)o=c[n],s=this.split(r,o),s._t1=r,s._t2=o,a.push(s),r=o;return a.forEach(function(u){for(r=0,o=0;o<=1;)for(o=r+i;o<=1+i;o+=i)if(s=u.split(r,o),!s.simple()){if(o-=i,Rs(r-o)<i)return[];s=u.split(r,o),s._t1=J.map(r,0,1,u._t1,u._t2),s._t2=J.map(o,0,1,u._t1,u._t2),l.push(s),r=o;break}r<1&&(s=u.split(r,1),s._t1=J.map(r,0,1,u._t1,u._t2),s._t2=u._t2,l.push(s))}),l}translate(n,r,o){o=typeof o=="number"?o:r;const i=this.order;let s=this.points.map((a,l)=>(1-l/i)*r+l/i*o);return new je(this.points.map((a,l)=>({x:a.x+n.x*s[l],y:a.y+n.y*s[l]})))}scale(n){const r=this.order;let o=!1;if(typeof n=="function"&&(o=n),o&&r===2)return this.raise().scale(o);const i=this.clockwise,s=this.points;if(this._linear)return this.translate(this.normal(0),o?o(0):n,o?o(1):n);const a=o?o(0):n,l=o?o(1):n,c=[this.offset(0,10),this.offset(1,10)],u=[],f=J.lli4(c[0],c[0].c,c[1],c[1].c);if(!f)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(d){const h=u[d*r]=J.copy(s[d*r]);h.x+=(d?l:a)*c[d].n.x,h.y+=(d?l:a)*c[d].n.y}),o?([0,1].forEach(function(d){if(!(r===2&&d)){var h=s[d+1],g={x:h.x-f.x,y:h.y-f.y},v=o?o((d+1)/r):n;o&&!i&&(v=-v);var b=As(g.x*g.x+g.y*g.y);g.x/=b,g.y/=b,u[d+1]={x:h.x+v*g.x,y:h.y+v*g.y}}}),new je(u)):([0,1].forEach(d=>{if(r===2&&d)return;const h=u[d*r],g=this.derivative(d),v={x:h.x+g.x,y:h.y+g.y};u[d+1]=J.lli4(h,v,f,s[d+1])}),new je(u))}outline(n,r,o,i){if(r=r===void 0?n:r,this._linear){const k=this.normal(0),C=this.points[0],N=this.points[this.points.length-1];let E,j,A;o===void 0&&(o=n,i=r),E={x:C.x+k.x*n,y:C.y+k.y*n},A={x:N.x+k.x*o,y:N.y+k.y*o},j={x:(E.x+A.x)/2,y:(E.y+A.y)/2};const T=[E,j,A];E={x:C.x-k.x*r,y:C.y-k.y*r},A={x:N.x-k.x*i,y:N.y-k.y*i},j={x:(E.x+A.x)/2,y:(E.y+A.y)/2};const D=[A,j,E],F=J.makeline(D[2],T[0]),P=J.makeline(T[2],D[0]),L=[F,new je(T),P,new je(D)];return new na(L)}const s=this.reduce(),a=s.length,l=[];let c=[],u,f=0,d=this.length();const h=typeof o<"u"&&typeof i<"u";function g(k,C,N,E,j){return function(A){const T=E/N,D=(E+j)/N,F=C-k;return J.map(A,0,1,k+T*F,k+D*F)}}s.forEach(function(k){const C=k.length();h?(l.push(k.scale(g(n,o,d,f,C))),c.push(k.scale(g(-r,-i,d,f,C)))):(l.push(k.scale(n)),c.push(k.scale(-r))),f+=C}),c=c.map(function(k){return u=k.points,u[3]?k.points=[u[3],u[2],u[1],u[0]]:k.points=[u[2],u[1],u[0]],k}).reverse();const v=l[0].points[0],b=l[a-1].points[l[a-1].points.length-1],_=c[a-1].points[c[a-1].points.length-1],m=c[0].points[0],w=J.makeline(_,v),y=J.makeline(b,m),S=[w].concat(l).concat([y]).concat(c);return new na(S)}outlineshapes(n,r,o){r=r||n;const i=this.outline(n,r).curves,s=[];for(let a=1,l=i.length;a<l/2;a++){const c=J.makeshape(i[a],i[l-a],o);c.startcap.virtual=a>1,c.endcap.virtual=a<l/2-1,s.push(c)}return s}intersects(n,r){return n?n.p1&&n.p2?this.lineIntersects(n):(n instanceof je&&(n=n.reduce()),this.curveintersects(this.reduce(),n,r)):this.selfintersects(r)}lineIntersects(n){const r=Tx(n.p1.x,n.p2.x),o=Tx(n.p1.y,n.p2.y),i=Ix(n.p1.x,n.p2.x),s=Ix(n.p1.y,n.p2.y);return J.roots(this.points,n).filter(a=>{var l=this.get(a);return J.between(l.x,r,i)&&J.between(l.y,o,s)})}selfintersects(n){const r=this.reduce(),o=r.length-2,i=[];for(let s=0,a,l,c;s<o;s++)l=r.slice(s,s+1),c=r.slice(s+2),a=this.curveintersects(l,c,n),i.push(...a);return i}curveintersects(n,r,o){const i=[];n.forEach(function(a){r.forEach(function(l){a.overlaps(l)&&i.push({left:a,right:l})})});let s=[];return i.forEach(function(a){const l=J.pairiteration(a.left,a.right,o);l.length>0&&(s=s.concat(l))}),s}arcs(n){return n=n||.5,this._iterate(n,[])}_error(n,r,o,i){const s=(i-o)/4,a=this.get(o+s),l=this.get(i-s),c=J.dist(n,r),u=J.dist(n,a),f=J.dist(n,l);return Rs(u-c)+Rs(f-c)}_iterate(n,r){let o=0,i=1,s;do{s=0,i=1;let a=this.get(o),l,c,u,f,d=!1,h=!1,g,v=i,b=1;do if(h=d,f=u,v=(o+i)/2,l=this.get(v),c=this.get(i),u=J.getccenter(a,l,c),u.interval={start:o,end:i},d=this._error(u,a,o,i)<=n,g=h&&!d,g||(b=i),d){if(i>=1){if(u.interval.end=b=1,f=u,i>1){let m={x:u.x+u.r*qB(u.e),y:u.y+u.r*QB(u.e)};u.e+=J.angle({x:u.x,y:u.y},m,this.get(1))}break}i=i+(i-o)/2}else i=v;while(!g&&s++<100);if(s>=100)break;f=f||u,r.push(f),o=b}while(i<1);return r}}function Dp(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function eH(e){if(Array.isArray(e))return e}function tH(e){if(Array.isArray(e))return Dp(e)}function nH(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function rH(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,s,a,l=[],c=!0,u=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(o=s.call(r)).done)&&(l.push(o.value),l.length!==n);c=!0);}catch(f){u=!0,i=f}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function oH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
403
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iH(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
404
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sH(e,n){if(e==null)return{};var r,o,i=aH(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],n.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function aH(e,n){if(e==null)return{};var r={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(n.includes(o))continue;r[o]=e[o]}return r}function lH(e,n){return eH(e)||rH(e,n)||PN(e,n)||oH()}function cH(e){return tH(e)||nH(e)||PN(e)||iH()}function uH(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function dH(e){var n=uH(e,"string");return typeof n=="symbol"?n:n+""}function PN(e,n){if(e){if(typeof e=="string")return Dp(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Dp(e,n):void 0}}var fH=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=(n instanceof Array?n.length?n:[void 0]:[n]).map(function(l){return{keyAccessor:l,isProp:!(l instanceof Function)}}),s=e.reduce(function(l,c){var u=l,f=c;return i.forEach(function(d,h){var g=d.keyAccessor,v=d.isProp,b;if(v){var _=f,m=_[g],w=sH(_,[g].map(dH));b=m,f=w}else b=g(f,h);h+1<i.length?(u.hasOwnProperty(b)||(u[b]={}),u=u[b]):r?(u.hasOwnProperty(b)||(u[b]=[]),u[b].push(f)):u[b]=f}),l},{});r instanceof Function&&function l(c){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;u===i.length?Object.keys(c).forEach(function(f){return c[f]=r(c[f])}):Object.values(c).forEach(function(f){return l(f,u+1)})}(s);var a=s;return o&&(a=[],function l(c){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];u.length===i.length?a.push({keys:u,vals:c}):Object.entries(c).forEach(function(f){var d=lH(f,2),h=d[0],g=d[1];return l(g,[].concat(cH(u),[h]))})}(s),n instanceof Array&&n.length===0&&a.length===1&&(a[0].keys=[])),a};function hH(e,n){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(n).domain(e);break}return this}const Ox=Symbol("implicit");function MN(){var e=new nx,n=[],r=[],o=Ox;function i(s){let a=e.get(s);if(a===void 0){if(o!==Ox)return o;e.set(s,a=n.push(s)-1)}return r[a%r.length]}return i.domain=function(s){if(!arguments.length)return n.slice();n=[],e=new nx;for(const a of s)e.has(a)||e.set(a,n.push(a)-1);return i},i.range=function(s){return arguments.length?(r=Array.from(s),i):r.slice()},i.unknown=function(s){return arguments.length?(o=s,i):o},i.copy=function(){return MN(n,r).unknown(o)},hH.apply(i,arguments),i}function pH(e){for(var n=e.length/6|0,r=new Array(n),o=0;o<n;)r[o]="#"+e.slice(o*6,++o*6);return r}const mH=pH("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function gH(e,n){n===void 0&&(n={});var r=n.insertAt;if(!(typeof document>"u")){var o=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",r==="top"&&o.firstChild?o.insertBefore(i,o.firstChild):o.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var vH=`.force-graph-container canvas {
|
|
400
405
|
display: block;
|
|
401
406
|
user-select: none;
|
|
402
407
|
outline: none;
|
|
@@ -419,9 +424,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
419
424
|
cursor: -moz-grabbing;
|
|
420
425
|
cursor: -webkit-grabbing;
|
|
421
426
|
}
|
|
422
|
-
`;
|
|
423
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
424
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dx(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,o)}return r}function ei(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Dx(Object(r),!0).forEach(function(o){Ra(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dx(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function ra(e,n){return gH(e)||xH(e,n)||AN(e,n)||wH()}function Wt(e){return vH(e)||yH(e)||AN(e)||bH()}function _H(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function SH(e){var n=_H(e,"string");return typeof n=="symbol"?n:n+""}function zp(e){"@babel/helpers - typeof";return zp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},zp(e)}function AN(e,n){if(e){if(typeof e=="string")return Lp(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Lp(e,n):void 0}}var kH=MN(hH);function Lx(e,n,r){!n||typeof r!="string"||e.filter(function(o){return!o[r]}).forEach(function(o){o[r]=kH(n(o))})}function CH(e,n){var r=e.nodes,o=e.links,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=i.nodeFilter,a=s===void 0?function(){return!0}:s,l=i.onLoopError,c=l===void 0?function(g){throw"Invalid DAG structure! Found cycle in node path: ".concat(g.join(" -> "),".")}:l,u={};r.forEach(function(g){return u[n(g)]={data:g,out:[],depth:-1,skip:!a(g)}}),o.forEach(function(g){var v=g.source,b=g.target,_=S(v),m=S(b);if(!u.hasOwnProperty(_))throw"Missing source node with id: ".concat(_);if(!u.hasOwnProperty(m))throw"Missing target node with id: ".concat(m);var w=u[_],y=u[m];w.out.push(y);function S(k){return zp(k)==="object"?n(k):k}});var f=[];h(Object.values(u));var d=Object.assign.apply(Object,[{}].concat(Wt(Object.entries(u).filter(function(g){var v=ra(g,2),b=v[1];return!b.skip}).map(function(g){var v=ra(g,2),b=v[0],_=v[1];return Ra({},b,_.depth)}))));return d;function h(g){for(var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,_=function(){var S=g[m];if(v.indexOf(S)!==-1){var k=[].concat(Wt(v.slice(v.indexOf(S))),[S]).map(function(C){return n(C.data)});return f.some(function(C){return C.length===k.length&&C.every(function(N,E){return N===k[E]})})||(f.push(k),c(k)),1}b>S.depth&&(S.depth=b,h(S.out,[].concat(Wt(v),[S]),b+(S.skip?0:1)))},m=0,w=g.length;m<w;m++)_()}}var NH=2,ot=function(n,r){return r.onNeedsRedraw&&r.onNeedsRedraw()},zx=function(n,r){if(!r.isShadow){var o=_e(r.linkDirectionalParticles);r.graphData.links.forEach(function(i){var s=Math.round(Math.abs(o(i)));s?i.__photons=Wt(Array(s)).map(function(){return{}}):delete i.__photons})}},Iu=Wg({props:{graphData:{default:{nodes:[],links:[]},onChange:function(n,r){r.engineRunning=!1,zx(n,r)}},dagMode:{onChange:function(n,r){!n&&(r.graphData.nodes||[]).forEach(function(o){return o.fx=o.fy=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(n){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4,triggerUpdate:!1,onChange:ot},nodeId:{default:"id"},nodeVal:{default:"val",triggerUpdate:!1,onChange:ot},nodeColor:{default:"color",triggerUpdate:!1,onChange:ot},nodeAutoColorBy:{},nodeCanvasObject:{triggerUpdate:!1,onChange:ot},nodeCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:ot},nodeVisibility:{default:!0,triggerUpdate:!1,onChange:ot},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0,triggerUpdate:!1,onChange:ot},linkColor:{default:"color",triggerUpdate:!1,onChange:ot},linkAutoColorBy:{},linkLineDash:{triggerUpdate:!1,onChange:ot},linkWidth:{default:1,triggerUpdate:!1,onChange:ot},linkCurvature:{default:0,triggerUpdate:!1,onChange:ot},linkCanvasObject:{triggerUpdate:!1,onChange:ot},linkCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:ot},linkDirectionalArrowLength:{default:0,triggerUpdate:!1,onChange:ot},linkDirectionalArrowColor:{triggerUpdate:!1,onChange:ot},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1,onChange:ot},linkDirectionalParticles:{default:0,triggerUpdate:!1,onChange:zx},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:4,triggerUpdate:!1},linkDirectionalParticleColor:{triggerUpdate:!1},linkDirectionalParticleCanvasObject:{triggerUpdate:!1},globalScale:{default:1,triggerUpdate:!1},d3AlphaMin:{default:0,triggerUpdate:!1},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaDecay(n)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaTarget(n)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.velocityDecay(n)}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1},onNeedsRedraw:{triggerUpdate:!1},isShadow:{default:!1,triggerUpdate:!1}},methods:{d3Force:function(n,r,o){return o===void 0?n.forceLayout.force(r):(n.forceLayout.force(r,o),this)},d3ReheatSimulation:function(n){return n.forceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(n){return n.cntTicks=0,n.startTickTime=new Date,n.engineRunning=!0,this},isEngineRunning:function(n){return!!n.engineRunning},tickFrame:function(n){return!n.isShadow&&r(),i(),!n.isShadow&&s(),!n.isShadow&&a(),o(),this;function r(){n.engineRunning&&(++n.cntTicks>n.cooldownTicks||new Date-n.startTickTime>n.cooldownTime||n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin?(n.engineRunning=!1,n.onEngineStop()):(n.forceLayout.tick(),n.onEngineTick()))}function o(){var l=_e(n.nodeVisibility),c=_e(n.nodeVal),u=_e(n.nodeColor),f=_e(n.nodeCanvasObjectMode),d=n.ctx,h=n.isShadow/n.globalScale,g=n.graphData.nodes.filter(l);d.save(),g.forEach(function(v){var b=f(v);if(n.nodeCanvasObject&&(b==="before"||b==="replace")&&(n.nodeCanvasObject(v,d,n.globalScale),b==="replace")){d.restore();return}var _=Math.sqrt(Math.max(0,c(v)||1))*n.nodeRelSize+h;d.beginPath(),d.arc(v.x,v.y,_,0,2*Math.PI,!1),d.fillStyle=u(v)||"rgba(31, 120, 180, 0.92)",d.fill(),n.nodeCanvasObject&&b==="after"&&n.nodeCanvasObject(v,n.ctx,n.globalScale)}),d.restore()}function i(){var l=_e(n.linkVisibility),c=_e(n.linkColor),u=_e(n.linkWidth),f=_e(n.linkLineDash),d=_e(n.linkCurvature),h=_e(n.linkCanvasObjectMode),g=n.ctx,v=n.isShadow*2,b=n.graphData.links.filter(l);b.forEach(C);var _=[],m=[],w=b;if(n.linkCanvasObject){var y=[],S=[];b.forEach(function(N){return({before:_,after:m,replace:y}[h(N)]||S).push(N)}),w=[].concat(Wt(_),m,S),_=_.concat(y)}g.save(),_.forEach(function(N){return n.linkCanvasObject(N,g,n.globalScale)}),g.restore();var k=uH(w,[c,u,f]);g.save(),Object.entries(k).forEach(function(N){var E=ra(N,2),j=E[0],A=E[1],T=!j||j==="undefined"?"rgba(0,0,0,0.15)":j;Object.entries(A).forEach(function(D){var F=ra(D,2),P=F[0],L=F[1],I=(P||1)/n.globalScale+v;Object.entries(L).forEach(function(z){var R=ra(z,2);R[0];var M=R[1],O=f(M[0]);g.beginPath(),M.forEach(function(V){var $=V.source,K=V.target;if(!(!$||!K||!$.hasOwnProperty("x")||!K.hasOwnProperty("x"))){g.moveTo($.x,$.y);var B=V.__controlPoints;B?g[B.length===2?"quadraticCurveTo":"bezierCurveTo"].apply(g,Wt(B).concat([K.x,K.y])):g.lineTo(K.x,K.y)}}),g.strokeStyle=T,g.lineWidth=I,g.setLineDash(O||[]),g.stroke()})})}),g.restore(),g.save(),m.forEach(function(N){return n.linkCanvasObject(N,g,n.globalScale)}),g.restore();function C(N){var E=d(N);if(!E){N.__controlPoints=null;return}var j=N.source,A=N.target;if(!(!j||!A||!j.hasOwnProperty("x")||!A.hasOwnProperty("x"))){var T=Math.sqrt(Math.pow(A.x-j.x,2)+Math.pow(A.y-j.y,2));if(T>0){var D=Math.atan2(A.y-j.y,A.x-j.x),F=T*E,P={x:(j.x+A.x)/2+F*Math.cos(D-Math.PI/2),y:(j.y+A.y)/2+F*Math.sin(D-Math.PI/2)};N.__controlPoints=[P.x,P.y]}else{var L=E*70;N.__controlPoints=[A.x,A.y-L,A.x+L,A.y]}}}}function s(){var l=1.6,c=.2,u=_e(n.linkDirectionalArrowLength),f=_e(n.linkDirectionalArrowRelPos),d=_e(n.linkVisibility),h=_e(n.linkDirectionalArrowColor||n.linkColor),g=_e(n.nodeVal),v=n.ctx;v.save(),n.graphData.links.filter(d).forEach(function(b){var _=u(b);if(!(!_||_<0)){var m=b.source,w=b.target;if(!(!m||!w||!m.hasOwnProperty("x")||!w.hasOwnProperty("x"))){var y=Math.sqrt(Math.max(0,g(m)||1))*n.nodeRelSize,S=Math.sqrt(Math.max(0,g(w)||1))*n.nodeRelSize,k=Math.min(1,Math.max(0,f(b))),C=h(b)||"rgba(0,0,0,0.28)",N=_/l/2,E=b.__controlPoints&&$x(je,[m.x,m.y].concat(Wt(b.__controlPoints),[w.x,w.y])),j=E?function(I){return E.get(I)}:function(I){return{x:m.x+(w.x-m.x)*I||0,y:m.y+(w.y-m.y)*I||0}},A=E?E.length():Math.sqrt(Math.pow(w.x-m.x,2)+Math.pow(w.y-m.y,2)),T=y+_+(A-y-S-_)*k,D=j(T/A),F=j((T-_)/A),P=j((T-_*(1-c))/A),L=Math.atan2(D.y-F.y,D.x-F.x)-Math.PI/2;v.beginPath(),v.moveTo(D.x,D.y),v.lineTo(F.x+N*Math.cos(L),F.y+N*Math.sin(L)),v.lineTo(P.x,P.y),v.lineTo(F.x-N*Math.cos(L),F.y-N*Math.sin(L)),v.fillStyle=C,v.fill()}}}),v.restore()}function a(){var l=_e(n.linkDirectionalParticles),c=_e(n.linkDirectionalParticleSpeed),u=_e(n.linkDirectionalParticleOffset),f=_e(n.linkDirectionalParticleWidth),d=_e(n.linkVisibility),h=_e(n.linkDirectionalParticleColor||n.linkColor),g=n.ctx;g.save(),n.graphData.links.filter(d).forEach(function(v){var b=l(v);if(!(!v.hasOwnProperty("__photons")||!v.__photons.length)){var _=v.source,m=v.target;if(!(!_||!m||!_.hasOwnProperty("x")||!m.hasOwnProperty("x"))){var w=c(v),y=Math.abs(u(v)),S=v.__photons||[],k=Math.max(0,f(v)/2)/Math.sqrt(n.globalScale),C=h(v)||"rgba(0,0,0,0.28)";g.fillStyle=C;var N=v.__controlPoints?$x(je,[_.x,_.y].concat(Wt(v.__controlPoints),[m.x,m.y])):null,E=0,j=!1;S.forEach(function(A){var T=!!A.__singleHop;if(A.hasOwnProperty("__progressRatio")||(A.__progressRatio=T?w<0?1:0:(E+y)/b),!T&&E++,A.__progressRatio+=w,A.__progressRatio>=1||A.__progressRatio<0)if(!T)A.__progressRatio=A.__progressRatio%1,A.__progressRatio<0&&A.__progressRatio++;else{j=!0;return}var D=A.__progressRatio,F=N?N.get(D):{x:_.x+(m.x-_.x)*D||0,y:_.y+(m.y-_.y)*D||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(F.x,F.y,v,g,n.globalScale):(g.beginPath(),g.arc(F.x,F.y,k,0,2*Math.PI,!1),g.fill())}),j&&(v.__photons=v.__photons.filter(function(A){return!A.__singleHop||A.__progressRatio<=1&&A.__progressRatio>=0}))}}}),g.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:HB().force("link",IB()).force("charge",UB()).force("center",$7()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(n,r){r.ctx=n},update:function(n,r){n.engineRunning=!1,n.onUpdate(),n.nodeAutoColorBy!==null&&Lx(n.graphData.nodes,_e(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&Lx(n.graphData.links,_e(n.linkAutoColorBy),n.linkColor),n.graphData.links.forEach(function(h){h.source=h[n.linkSource],h.target=h[n.linkTarget]}),n.forceLayout.stop().alpha(1).nodes(n.graphData.nodes);var o=n.forceLayout.force("link");o&&o.id(function(h){return h[n.nodeId]}).links(n.graphData.links);var i=n.dagMode&&CH(n.graphData,function(h){return h[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),s=Math.max.apply(Math,Wt(Object.values(i||[]))),a=n.dagLevelDistance||n.graphData.nodes.length/(s||1)*NH*(["radialin","radialout"].indexOf(n.dagMode)!==-1?.7:1);if(["lr","rl","td","bu"].includes(r.dagMode)){var l=["lr","rl"].includes(r.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(h){return delete h[l]})}if(["lr","rl","td","bu"].includes(n.dagMode)){var c=["rl","bu"].includes(n.dagMode),u=function(g){return(i[g[n.nodeId]]-s/2)*a*(c?-1:1)},f=["lr","rl"].includes(n.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(h){return h[f]=u(h)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?VB(function(h){var g=i[h[n.nodeId]]||-1;return(n.dagMode==="radialin"?s-g:g)*a}).strength(function(h){return n.dagNodeFilter(h)?1:0}):null);for(var d=0;d<n.warmupTicks&&!(n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin);d++)n.forceLayout.tick();this.resetCountdown(),n.onFinishUpdate()}});function TN(e,n){var r=e instanceof Array?e:[e],o=new n;return o._destructor&&o._destructor(),{linkProp:function(s){return{default:o[s](),onChange:function(l,c){r.forEach(function(u){return c[u][s](l)})},triggerUpdate:!1}},linkMethod:function(s){return function(a){for(var l=arguments.length,c=new Array(l>1?l-1:0),u=1;u<l;u++)c[u-1]=arguments[u];var f=[];return r.forEach(function(d){var h=a[d],g=h[s].apply(h,c);g!==h&&f.push(g)}),f.length?f[0]:this}}}}var EH=800,jH=4,PH=5,IN=TN("forceGraph",Iu),MH=TN(["forceGraph","shadowGraph"],Iu),RH=Object.assign.apply(Object,Wt(["nodeColor","nodeAutoColorBy","nodeCanvasObject","nodeCanvasObjectMode","linkColor","linkAutoColorBy","linkLineDash","linkWidth","linkCanvasObject","linkCanvasObjectMode","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleCanvasObject","dagMode","dagLevelDistance","dagNodeFilter","onDagError","d3AlphaMin","d3AlphaDecay","d3VelocityDecay","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].map(function(e){return Ra({},e,IN.linkProp(e))})).concat(Wt(["nodeRelSize","nodeId","nodeVal","nodeVisibility","linkSource","linkTarget","linkVisibility","linkCurvature"].map(function(e){return Ra({},e,MH.linkProp(e))})))),AH=Object.assign.apply(Object,Wt(["d3Force","d3ReheatSimulation","emitParticle"].map(function(e){return Ra({},e,IN.linkMethod(e))})));function Zf(e){if(e.canvas){var n=e.canvas.width,r=e.canvas.height;n===300&&r===150&&(n=r=0);var o=window.devicePixelRatio;n/=o,r/=o,[e.canvas,e.shadowCanvas].forEach(function(s){s.style.width="".concat(e.width,"px"),s.style.height="".concat(e.height,"px"),s.width=e.width*o,s.height=e.height*o,!n&&!r&&s.getContext("2d").scale(o,o)});var i=on(e.canvas).k;e.zoom.translateBy(e.zoom.__baseElem,(e.width-n)/2/i,(e.height-r)/2/i),e.needsRedraw=!0}}function ON(e){var n=window.devicePixelRatio;e.setTransform(n,0,0,n,0,0)}function Fx(e,n,r){e.save(),ON(e),e.clearRect(0,0,n,r),e.restore()}var TH=Wg({props:ei({width:{default:window.innerWidth,onChange:function(n,r){return Zf(r)},triggerUpdate:!1},height:{default:window.innerHeight,onChange:function(n,r){return Zf(r)},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(n,r){[n.nodes,n.links].every(function(i){return(i||[]).every(function(s){return!s.hasOwnProperty("__indexColor")})})&&r.colorTracker.reset(),[{type:"Node",objs:n.nodes},{type:"Link",objs:n.links}].forEach(o),r.forceGraph.graphData(n),r.shadowGraph.graphData(n);function o(i){var s=i.type,a=i.objs;a.filter(function(l){if(!l.hasOwnProperty("__indexColor"))return!0;var c=r.colorTracker.lookup(l.__indexColor);return!c||!c.hasOwnProperty("d")||c.d!==l}).forEach(function(l){l.__indexColor=r.colorTracker.register({type:s,d:l})})}},triggerUpdate:!1},backgroundColor:{onChange:function(n,r){r.canvas&&n&&(r.canvas.style.background=n)},triggerUpdate:!1},nodeLabel:{default:"name",triggerUpdate:!1},nodePointerAreaPaint:{onChange:function(n,r){r.shadowGraph.nodeCanvasObject(n?function(o,i,s){return n(o,o.__indexColor,i,s)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkPointerAreaPaint:{onChange:function(n,r){r.shadowGraph.linkCanvasObject(n?function(o,i,s){return n(o,o.__indexColor,i,s)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:4,triggerUpdate:!1},minZoom:{default:.01,onChange:function(n,r){r.zoom.scaleExtent([n,r.zoom.scaleExtent()[1]])},triggerUpdate:!1},maxZoom:{default:1e3,onChange:function(n,r){r.zoom.scaleExtent([r.zoom.scaleExtent()[0],n])},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},enableZoomInteraction:{default:!0,triggerUpdate:!1},enablePanInteraction:{default:!0,triggerUpdate:!1},enableZoomPanInteraction:{default:!0,triggerUpdate:!1},enablePointerInteraction:{default:!0,onChange:function(n,r){r.hoverObj=null},triggerUpdate:!1},autoPauseRedraw:{default:!0,triggerUpdate:!1},onNodeDrag:{default:function(){},triggerUpdate:!1},onNodeDragEnd:{default:function(){},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},onZoom:{triggerUpdate:!1},onZoomEnd:{triggerUpdate:!1},onRenderFramePre:{triggerUpdate:!1},onRenderFramePost:{triggerUpdate:!1}},RH),aliases:{stopAnimation:"pauseAnimation"},methods:ei({graph2ScreenCoords:function(n,r,o){var i=on(n.canvas);return{x:r*i.k+i.x,y:o*i.k+i.y}},screen2GraphCoords:function(n,r,o){var i=on(n.canvas);return{x:(r-i.x)/i.k,y:(o-i.y)/i.k}},centerAt:function(n,r,o,i){if(!n.canvas)return null;if(r!==void 0||o!==void 0){var s=Object.assign({},r!==void 0?{x:r}:{},o!==void 0?{y:o}:{});return i?n.tweenGroup.add(new cx(a()).to(s,i).easing(Co.Quadratic.Out).onUpdate(l).onComplete(function(){n.tweenGroup.remove(this)}).start()):l(s),this}return a();function a(){var c=on(n.canvas);return{x:(n.width/2-c.x)/c.k,y:(n.height/2-c.y)/c.k}}function l(c){var u=c.x,f=c.y;n.zoom.translateTo(n.zoom.__baseElem,u===void 0?a().x:u,f===void 0?a().y:f),n.needsRedraw=!0}},zoom:function(n,r,o){if(!n.canvas)return null;if(r!==void 0)return o?n.tweenGroup.add(new cx({k:i()}).to({k:r},o).easing(Co.Quadratic.Out).onUpdate(function(a){var l=a.k;return s(l)}).onComplete(function(){n.tweenGroup.remove(this)}).start()):s(r),this;return i();function i(){return on(n.canvas).k}function s(a){n.zoom.scaleTo(n.zoom.__baseElem,a),n.needsRedraw=!0}},zoomToFit:function(n){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,i=arguments.length,s=new Array(i>3?i-3:0),a=3;a<i;a++)s[a-3]=arguments[a];var l=this.getGraphBbox.apply(this,s);if(l){var c={x:(l.x[0]+l.x[1])/2,y:(l.y[0]+l.y[1])/2},u=Math.max(1e-12,Math.min(1e12,(n.width-o*2)/(l.x[1]-l.x[0]),(n.height-o*2)/(l.y[1]-l.y[0])));this.centerAt(c.x,c.y,r),this.zoom(u,r)}return this},getGraphBbox:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},o=_e(n.nodeVal),i=function(l){return Math.sqrt(Math.max(0,o(l)||1))*n.nodeRelSize},s=n.graphData.nodes.filter(r).map(function(a){return{x:a.x,y:a.y,r:i(a)}});return s.length?{x:[ix(s,function(a){return a.x-a.r}),ox(s,function(a){return a.x+a.r})],y:[ix(s,function(a){return a.y-a.r}),ox(s,function(a){return a.y+a.r})]}:null},pauseAnimation:function(n){return n.animationFrameRequestId&&(cancelAnimationFrame(n.animationFrameRequestId),n.animationFrameRequestId=null),this},resumeAnimation:function(n){return n.animationFrameRequestId||this._animationCycle(),this},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},AH),stateInit:function(){return{lastSetZoom:1,zoom:Vg(),forceGraph:new Iu,shadowGraph:new Iu().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new h7,tweenGroup:new oN}},init:function(n,r){var o=this;n.innerHTML="";var i=document.createElement("div");i.classList.add("force-graph-container"),i.style.position="relative",n.appendChild(i),r.canvas=document.createElement("canvas"),r.backgroundColor&&(r.canvas.style.background=r.backgroundColor),i.appendChild(r.canvas),r.shadowCanvas=document.createElement("canvas");var s=r.canvas.getContext("2d"),a=r.shadowCanvas.getContext("2d",{willReadFrequently:!0}),l={x:-1e12,y:-1e12},c=function(){var d=null,h=window.devicePixelRatio,g=l.x>0&&l.y>0?a.getImageData(l.x*h,l.y*h,1,1):null;return g&&(d=r.colorTracker.lookup(g.data)),d};at(r.canvas).call(Dg().subject(function(){if(!r.enableNodeDrag)return null;var f=c();return f&&f.type==="Node"?f.d:null}).on("start",function(f){var d=f.subject;d.__initialDragPos={x:d.x,y:d.y,fx:d.fx,fy:d.fy},f.active||(d.fx=d.x,d.fy=d.y),r.canvas.classList.add("grabbable")}).on("drag",function(f){var d=f.subject,h=d.__initialDragPos,g=f,v=on(r.canvas).k,b={x:h.x+(g.x-h.x)/v-d.x,y:h.y+(g.y-h.y)/v-d.y};["x","y"].forEach(function(_){return d["f".concat(_)]=d[_]=h[_]+(g[_]-h[_])/v}),!(!d.__dragged&&PH>=Math.sqrt(Y9(["x","y"].map(function(_){return Math.pow(f[_]-h[_],2)}))))&&(r.forceGraph.d3AlphaTarget(.3).resetCountdown(),r.isPointerDragging=!0,d.__dragged=!0,r.onNodeDrag(d,b))}).on("end",function(f){var d=f.subject,h=d.__initialDragPos,g={x:d.x-h.x,y:d.y-h.y};h.fx===void 0&&(d.fx=void 0),h.fy===void 0&&(d.fy=void 0),delete d.__initialDragPos,r.forceGraph.d3AlphaTarget()&&r.forceGraph.d3AlphaTarget(0).resetCountdown(),r.canvas.classList.remove("grabbable"),r.isPointerDragging=!1,d.__dragged&&(delete d.__dragged,r.onNodeDragEnd(d,g))})),r.zoom(r.zoom.__baseElem=at(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(f){return!f.button&&r.enableZoomPanInteraction&&(f.type!=="wheel"||_e(r.enableZoomInteraction)(f))&&(f.type==="wheel"||_e(r.enablePanInteraction)(f))}).on("zoom",function(f){var d=f.transform;[s,a].forEach(function(h){ON(h),h.translate(d.x,d.y),h.scale(d.k,d.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom(ei(ei({},d),o.centerAt())),r.needsRedraw=!0}).on("end",function(f){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd(ei(ei({},f.transform),o.centerAt()))}),Zf(r),r.forceGraph.onNeedsRedraw(function(){return r.needsRedraw=!0}).onFinishUpdate(function(){on(r.canvas).k===r.lastSetZoom&&r.graphData.nodes.length&&(r.zoom.scaleTo(r.zoom.__baseElem,r.lastSetZoom=jH/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new O7(i),["pointermove","pointerdown"].forEach(function(f){return i.addEventListener(f,function(d){f==="pointerdown"&&(r.isPointerPressed=!0,r.pointerDownEvent=d),!r.isPointerDragging&&d.type==="pointermove"&&r.onBackgroundClick&&(d.pressure>0||r.isPointerPressed)&&(d.pointerType==="mouse"||d.movementX===void 0||[d.movementX,d.movementY].some(function(v){return Math.abs(v)>1}))&&(r.isPointerDragging=!0);var h=g(i);l.x=d.pageX-h.left,l.y=d.pageY-h.top;function g(v){var b=v.getBoundingClientRect(),_=window.pageXOffset||document.documentElement.scrollLeft,m=window.pageYOffset||document.documentElement.scrollTop;return{top:b.top+m,left:b.left+_}}},{passive:!0})}),i.addEventListener("pointerup",function(f){if(r.isPointerPressed){if(r.isPointerPressed=!1,r.isPointerDragging){r.isPointerDragging=!1;return}var d=[f,r.pointerDownEvent];requestAnimationFrame(function(){if(f.button===0)if(r.hoverObj){var h=r["on".concat(r.hoverObj.type,"Click")];h&&h.apply(void 0,[r.hoverObj.d].concat(d))}else r.onBackgroundClick&&r.onBackgroundClick.apply(r,d);if(f.button===2)if(r.hoverObj){var g=r["on".concat(r.hoverObj.type,"RightClick")];g&&g.apply(void 0,[r.hoverObj.d].concat(d))}else r.onBackgroundRightClick&&r.onBackgroundRightClick.apply(r,d)})}},{passive:!0}),i.addEventListener("contextmenu",function(f){return!r.onBackgroundRightClick&&!r.onNodeRightClick&&!r.onLinkRightClick?!0:(f.preventDefault(),!1)}),r.forceGraph(s),r.shadowGraph(a);var u=wF(function(){Fx(a,r.width,r.height),r.shadowGraph.linkWidth(function(d){return _e(r.linkWidth)(d)+r.linkHoverPrecision});var f=on(r.canvas);r.shadowGraph.globalScale(f.k).tickFrame()},EH);r.flushShadowCanvas=u.flush,(this._animationCycle=function f(){var d=!r.autoPauseRedraw||!!r.needsRedraw||r.forceGraph.isEngineRunning()||r.graphData.links.some(function(y){return y.__photons&&y.__photons.length});if(r.needsRedraw=!1,r.enablePointerInteraction){var h=r.isPointerDragging?null:c();if(h!==r.hoverObj){var g=r.hoverObj,v=g?g.type:null,b=h?h.type:null;if(v&&v!==b){var _=r["on".concat(v,"Hover")];_&&_(null,g.d)}if(b){var m=r["on".concat(b,"Hover")];m&&m(h.d,v===b?g.d:null)}r.tooltip.content(h&&_e(r["".concat(h.type.toLowerCase(),"Label")])(h.d)||null),r.canvas.classList[(h&&r["on".concat(b,"Click")]||!h&&r.onBackgroundClick)&&_e(r.showPointerCursor)(h==null?void 0:h.d)?"add":"remove"]("clickable"),r.hoverObj=h}d&&u()}if(d){Fx(s,r.width,r.height);var w=on(r.canvas).k;r.onRenderFramePre&&r.onRenderFramePre(s,w),r.forceGraph.globalScale(w).tickFrame(),r.onRenderFramePost&&r.onRenderFramePost(s,w)}r.tweenGroup.update(),r.animationFrameRequestId=requestAnimationFrame(f)})()},update:function(n){}}),$N={exports:{}},IH="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",OH=IH,$H=OH;function DN(){}function LN(){}LN.resetWarningCache=DN;var DH=function(){function e(o,i,s,a,l,c){if(c!==$H){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function n(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:n,element:e,elementType:e,instanceOf:n,node:e,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:LN,resetWarningCache:DN};return r.PropTypes=r,r};$N.exports=DH();var LH=$N.exports;const H=Bu(LH),Fd={width:H.number,height:H.number,graphData:H.shape({nodes:H.arrayOf(H.object).isRequired,links:H.arrayOf(H.object).isRequired}),backgroundColor:H.string,nodeRelSize:H.number,nodeId:H.string,nodeLabel:H.oneOfType([H.string,H.func]),nodeVal:H.oneOfType([H.number,H.string,H.func]),nodeVisibility:H.oneOfType([H.bool,H.string,H.func]),nodeColor:H.oneOfType([H.string,H.func]),nodeAutoColorBy:H.oneOfType([H.string,H.func]),onNodeHover:H.func,onNodeClick:H.func,linkSource:H.string,linkTarget:H.string,linkLabel:H.oneOfType([H.string,H.func]),linkVisibility:H.oneOfType([H.bool,H.string,H.func]),linkColor:H.oneOfType([H.string,H.func]),linkAutoColorBy:H.oneOfType([H.string,H.func]),linkWidth:H.oneOfType([H.number,H.string,H.func]),linkCurvature:H.oneOfType([H.number,H.string,H.func]),linkDirectionalArrowLength:H.oneOfType([H.number,H.string,H.func]),linkDirectionalArrowColor:H.oneOfType([H.string,H.func]),linkDirectionalArrowRelPos:H.oneOfType([H.number,H.string,H.func]),linkDirectionalParticles:H.oneOfType([H.number,H.string,H.func]),linkDirectionalParticleSpeed:H.oneOfType([H.number,H.string,H.func]),linkDirectionalParticleOffset:H.oneOfType([H.number,H.string,H.func]),linkDirectionalParticleWidth:H.oneOfType([H.number,H.string,H.func]),linkDirectionalParticleColor:H.oneOfType([H.string,H.func]),onLinkHover:H.func,onLinkClick:H.func,dagMode:H.oneOf(["td","bu","lr","rl","zin","zout","radialin","radialout"]),dagLevelDistance:H.number,dagNodeFilter:H.func,onDagError:H.func,d3AlphaMin:H.number,d3AlphaDecay:H.number,d3VelocityDecay:H.number,warmupTicks:H.number,cooldownTicks:H.number,cooldownTime:H.number,onEngineTick:H.func,onEngineStop:H.func,getGraphBbox:H.func},zN={zoomToFit:H.func,onNodeRightClick:H.func,onNodeDrag:H.func,onNodeDragEnd:H.func,onLinkRightClick:H.func,linkHoverPrecision:H.number,onBackgroundClick:H.func,onBackgroundRightClick:H.func,showPointerCursor:H.oneOfType([H.bool,H.func]),enablePointerInteraction:H.bool,enableNodeDrag:H.bool},Jg={showNavInfo:H.bool,nodeOpacity:H.number,nodeResolution:H.number,nodeThreeObject:H.oneOfType([H.object,H.string,H.func]),nodeThreeObjectExtend:H.oneOfType([H.bool,H.string,H.func]),nodePositionUpdate:H.func,linkOpacity:H.number,linkResolution:H.number,linkCurveRotation:H.oneOfType([H.number,H.string,H.func]),linkMaterial:H.oneOfType([H.object,H.string,H.func]),linkThreeObject:H.oneOfType([H.object,H.string,H.func]),linkThreeObjectExtend:H.oneOfType([H.bool,H.string,H.func]),linkPositionUpdate:H.func,linkDirectionalArrowResolution:H.number,linkDirectionalParticleResolution:H.number,linkDirectionalParticleThreeObject:H.oneOfType([H.object,H.string,H.func]),forceEngine:H.oneOf(["d3","ngraph"]),ngraphPhysics:H.object,numDimensions:H.oneOf([1,2,3])},zH=Object.assign({},Fd,zN,{linkLineDash:H.oneOfType([H.arrayOf(H.number),H.string,H.func]),nodeCanvasObjectMode:H.oneOfType([H.string,H.func]),nodeCanvasObject:H.func,nodePointerAreaPaint:H.func,linkCanvasObjectMode:H.oneOfType([H.string,H.func]),linkCanvasObject:H.func,linkPointerAreaPaint:H.func,linkDirectionalParticleCanvasObject:H.func,autoPauseRedraw:H.bool,minZoom:H.number,maxZoom:H.number,enableZoomInteraction:H.oneOfType([H.bool,H.func]),enablePanInteraction:H.oneOfType([H.bool,H.func]),onZoom:H.func,onZoomEnd:H.func,onRenderFramePre:H.func,onRenderFramePost:H.func});Object.assign({},Fd,zN,Jg,{enableNavigationControls:H.bool,controlType:H.oneOf(["trackball","orbit","fly"]),rendererConfig:H.object,extraRenderers:H.arrayOf(H.shape({render:H.func.isRequired}))});Object.assign({},Fd,Jg,{nodeDesc:H.oneOfType([H.string,H.func]),linkDesc:H.oneOfType([H.string,H.func])});Object.assign({},Fd,Jg,{markerAttrs:H.object,yOffset:H.number,glScale:H.number});const e0=u6(TH,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});e0.displayName="ForceGraph2D";e0.propTypes=zH;const Ts={ui:"#60a5fa",api:"#34d399",db:"#f59e0b"},FH="rgba(244, 114, 182, 0.6)",BH="rgba(148, 163, 184, 0.25)";function HH(){const[e,n]=x.useState(null),[r,o]=x.useState(null),[i,s]=x.useState(!0),[a,l]=x.useState(!1),[c,u]=x.useState(new Set(["ui","api","db"])),[f,d]=x.useState(null),h=x.useRef(null),[g,v]=x.useState({width:0,height:0}),b=Go(),_=x.useCallback((y=!1)=>{y?l(!0):s(!0),o(null),fetch(b("/api/project-graph",y?{regenerate:"1"}:void 0)).then(S=>S.json()).then(S=>{"error"in S?o(S.error):n(S)}).catch(S=>o(String(S))).finally(()=>{s(!1),l(!1)})},[b]);x.useEffect(()=>{_(!1)},[_]),x.useEffect(()=>{if(!h.current)return;const y=h.current,S=()=>v({width:y.clientWidth,height:y.clientHeight});S();const k=new ResizeObserver(S);return k.observe(y),()=>k.disconnect()},[e]);const m=x.useMemo(()=>{if(!e)return{nodes:[],links:[]};const y=e.nodes.filter(C=>c.has(C.layer)),S=new Set(y.map(C=>C.id)),k=e.links.filter(C=>{const N=typeof C.source=="string"?C.source:C.source.id,E=typeof C.target=="string"?C.target:C.target.id;return S.has(N)&&S.has(E)});return{nodes:y,links:k}},[e,c]),w=y=>{const S=new Set(c);S.has(y)?S.delete(y):S.add(y),S.size!==0&&u(S)};return p.jsxs("div",{className:"flex h-full flex-col",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-sidebar-border px-6 py-3",children:[p.jsx("h1",{className:"text-lg font-semibold",children:"Project Graph"}),e&&p.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.nodes.length," nodes · ",m.links.length," links"]}),p.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[["ui","api","db"].map(y=>p.jsxs("button",{type:"button",onClick:()=>w(y),className:"flex items-center gap-1.5 rounded-md border border-sidebar-border px-2.5 py-1 text-xs transition-opacity",style:{opacity:c.has(y)?1:.4,borderColor:c.has(y)?Ts[y]:void 0},children:[p.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:Ts[y]}}),y.toUpperCase(),e&&` (${e.stats.byLayer[y]})`]},y)),p.jsx("button",{type:"button",onClick:()=>_(!0),disabled:a||i,className:"rounded-md border border-sidebar-border px-2.5 py-1 text-xs hover:bg-sidebar-accent disabled:opacity-50",children:a?"Regenerating…":"Regenerate"})]})]}),p.jsxs("div",{ref:h,className:"relative flex-1 overflow-hidden",children:[i&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground",children:"Loading graph…"}),r&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-destructive",children:r}),e&&g.width>0&&p.jsx(e0,{width:g.width,height:g.height,graphData:m,nodeId:"id",nodeLabel:y=>`${y.layer}/${y.type}: ${y.name}`,nodeRelSize:3,nodeColor:y=>Ts[y.layer],linkColor:y=>y.cross?FH:BH,linkWidth:y=>y.cross?1:.5,linkDirectionalParticles:0,cooldownTicks:120,onNodeHover:y=>d(y),backgroundColor:"transparent",nodeCanvasObjectMode:()=>"after",nodeCanvasObject:(y,S,k)=>{if(k<1.4||y.x===void 0||y.y===void 0)return;const C=y.name,N=11/k;S.font=`${N}px -apple-system, system-ui, sans-serif`;const E=S.measureText(C).width,j=3/k,A=1.5/k;S.fillStyle="rgba(15, 15, 20, 0.75)",S.fillRect(y.x-E/2-j,y.y+5/k-A,E+j*2,N+A*2),S.textAlign="center",S.textBaseline="top",S.fillStyle=Ts[y.layer],S.fillText(C,y.x,y.y+5/k)}}),f&&p.jsxs("div",{className:"pointer-events-none absolute bottom-4 left-4 max-w-md rounded-lg border border-sidebar-border bg-background/90 px-3 py-2 text-xs shadow-lg backdrop-blur",children:[p.jsxs("div",{className:"font-semibold",style:{color:Ts[f.layer]},children:[f.layer.toUpperCase()," · ",f.type]}),p.jsx("div",{className:"font-mono",children:f.name}),p.jsx("div",{className:"text-muted-foreground",children:f.path}),f.module&&p.jsxs("div",{className:"text-muted-foreground",children:["module: ",f.module]})]})]})]})}function er(e){var n;return((n=e.tags)==null?void 0:n.module)??e.module??null}function t0(e){var n;return(n=e.tags)!=null&&n.screen?e.tags.screen==="true":e.type==="page"||e.type==="layout"}function Aa(e){return e.split(/[-_]/).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function Kr(e){if(e.route){const n=e.route.split("/").filter(Boolean).filter(r=>!r.startsWith("(")&&!r.startsWith(":")&&!r.startsWith("["));return n.length>0?n[n.length-1].split(/[-_]/).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "):"Home"}return e.name}const UH=new Set(["lib","db","config","external","middleware","server-lib","services","mcp","layout","shared-ui"]);function VH(){const[e,n]=x.useState(null),[r,o]=x.useState("loading"),[i,s]=x.useState(null),[a,l]=x.useState(!1),c=Go(),u=x.useCallback(async()=>{try{const g=await fetch(c("/api/raw-graphs"));if(!g.ok)throw new Error(`HTTP ${g.status}`);const v=await g.json();n(v);const b=!!(v.ui||v.api||v.db);o(b?"ready":"empty")}catch(g){s(String(g)),o("error")}},[c]);x.useEffect(()=>{u()},[u]);const f=x.useCallback(async()=>{l(!0),s(null);try{const g=await fetch(c("/api/generate-graph"),{method:"POST"});if(!g.ok)throw new Error(`HTTP ${g.status}`);const v=await g.json();if(!v.ok)throw new Error(v.error??"Generation failed");n({ui:v.ui,api:v.api,db:v.db});const b=!!(v.ui||v.api||v.db);o(b?"ready":"empty")}catch(g){s(String(g))}finally{l(!1)}},[]),{moduleBuckets:d,counts:h}=x.useMemo(()=>{if(!(e!=null&&e.ui)||!(e!=null&&e.api)||!(e!=null&&e.db))return{moduleBuckets:[],counts:null};const g=e.ui.nodes.filter(w=>t0(w)&&er(w)&&!UH.has(er(w))),v=new Map;for(const w of g){const y=er(w);v.has(y)||v.set(y,[]),v.get(y).push(w)}const b=[],_=new Map;for(const[w,y]of v)y.length===1?b.push(...y):_.set(w,y);const m=[..._.entries()].map(([w,y])=>({module:w,screens:y})).sort((w,y)=>y.screens.length-w.screens.length);return b.length>0&&m.push({module:"misc",screens:b}),{moduleBuckets:m,counts:{screens:g.length,modules:m.length,endpoints:e.api.nodes.length,tables:e.db.nodes.length,components:e.ui.nodes.filter(w=>w.type==="component").length}}},[e]);return r==="loading"?p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading overview…"})}):r==="empty"?p.jsx(WH,{onGenerate:f,busy:a,error:i}):r==="error"?p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsxs("div",{className:"max-w-md text-center",children:[p.jsx("p",{className:"text-sm text-foreground",children:"Failed to load graph"}),p.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:i}),p.jsx("button",{type:"button",onClick:u,className:"mt-4 rounded-md border border-sidebar-border px-3 py-1.5 text-xs text-foreground hover:bg-sidebar-accent",children:"Retry"})]})}):h?p.jsx("div",{className:"h-full overflow-y-auto",children:p.jsxs("div",{className:"mx-auto max-w-6xl px-8 py-8",children:[p.jsxs("header",{className:"mb-8 flex items-start justify-between gap-4",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Project Overview"}),p.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"A high-level map of the modules, screens, and systems in this project."})]}),p.jsxs("button",{type:"button",onClick:f,disabled:a,className:"flex shrink-0 items-center gap-1.5 rounded-md border border-sidebar-border px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60",children:[p.jsx(L_,{className:`h-3 w-3 ${a?"animate-spin":""}`}),a?"Regenerating…":"Regenerate graph"]})]}),i&&p.jsx("div",{className:"mb-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:i}),p.jsxs("div",{className:"mb-8 grid grid-cols-2 gap-3 md:grid-cols-4",children:[p.jsx(nc,{icon:p.jsx(ld,{className:"h-4 w-4"}),label:"Modules",value:h.modules}),p.jsx(nc,{icon:p.jsx(Ua,{className:"h-4 w-4"}),label:"Screens",value:h.screens}),p.jsx(nc,{icon:p.jsx(Zm,{className:"h-4 w-4"}),label:"API endpoints",value:h.endpoints}),p.jsx(nc,{icon:p.jsx(Qm,{className:"h-4 w-4"}),label:"Database tables",value:h.tables})]}),p.jsxs("section",{children:[p.jsx("h2",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Capability map"}),p.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:d.map(g=>p.jsx(GH,{module:g.module,screens:g.screens},g.module))})]})]})}):null}function WH({onGenerate:e,busy:n,error:r}){return p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsxs("div",{className:"max-w-md text-center",children:[p.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-sidebar-primary/15 text-sidebar-primary",children:p.jsx(OA,{className:"h-6 w-6"})}),p.jsx("h2",{className:"mt-4 text-lg font-semibold text-foreground",children:"No graph yet"}),p.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"LaunchChart hasn't generated a project graph for this workspace. Generate one to see modules, screens, API endpoints, and database tables."}),p.jsxs("button",{type:"button",onClick:e,disabled:n,className:"mt-6 inline-flex items-center gap-2 rounded-md bg-sidebar-primary px-4 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-sidebar-primary/90 disabled:cursor-not-allowed disabled:opacity-60",children:[p.jsx(L_,{className:`h-4 w-4 ${n?"animate-spin":""}`}),n?"Generating…":"Generate graph"]}),p.jsx("p",{className:"mt-3 text-[11px] text-muted-foreground",children:"This scans your source tree — takes a few seconds."}),r&&p.jsx("div",{className:"mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:r})]})})}function nc({icon:e,label:n,value:r}){return p.jsxs("div",{className:"rounded-lg border border-sidebar-border bg-background/40 px-4 py-3",children:[p.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e,p.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",children:n})]}),p.jsx("p",{className:"mt-1 text-2xl font-semibold tabular-nums text-foreground",children:r})]})}function GH({module:e,screens:n}){const r=n.slice(0,6),o=n.length-r.length;return p.jsxs("div",{className:"rounded-lg border border-sidebar-border bg-background/40 p-5 transition-colors hover:border-sidebar-primary/50",children:[p.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[p.jsx("h3",{className:"text-base font-semibold text-foreground",children:Aa(e)}),p.jsxs("span",{className:"rounded bg-sidebar-accent px-2 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:[n.length," screens"]})]}),p.jsxs("ul",{className:"space-y-1",children:[r.map(i=>p.jsxs("li",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[p.jsx("span",{className:"h-1 w-1 shrink-0 rounded-full bg-sidebar-primary/60"}),p.jsx("span",{className:"truncate text-foreground/90",children:Kr(i)})]},i.id)),o>0&&p.jsxs("li",{className:"pl-3 pt-1 text-[11px] italic text-muted-foreground",children:["+",o," more"]})]})]})}function Ue(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let r=0,o;r<e.length;r++)(o=Ue(e[r]))!==""&&(n+=(n&&" ")+o);else for(let r in e)e[r]&&(n+=(n&&" ")+r);return n}const In={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:e=>`Node type "${e}" 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:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:n,sourceHandle:r,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r:o}", edge id: ${n}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Ta=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],FN=["Enter"," ","Escape"],BN={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:n,y:r})=>`Moved selected node ${e}. New position, x: ${n}, y: ${r}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Yi;(function(e){e.Strict="strict",e.Loose="loose"})(Yi||(Yi={}));var No;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(No||(No={}));var Ia;(function(e){e.Partial="partial",e.Full="full"})(Ia||(Ia={}));const HN={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Pr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Pr||(Pr={}));var Ou;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ou||(Ou={}));var ce;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ce||(ce={}));const Bx={[ce.Left]:ce.Right,[ce.Right]:ce.Left,[ce.Top]:ce.Bottom,[ce.Bottom]:ce.Top};function UN(e){return e===null?null:e?"valid":"invalid"}const VN=e=>"id"in e&&"source"in e&&"target"in e,YH=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),n0=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),il=(e,n=[0,0])=>{const{width:r,height:o}=dr(e),i=e.origin??n,s=r*i[0],a=o*i[1];return{x:e.position.x-s,y:e.position.y-a}},XH=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((o,i)=>{const s=typeof i=="string";let a=!n.nodeLookup&&!s?i:void 0;n.nodeLookup&&(a=s?n.nodeLookup.get(i):n0(i)?i:n.nodeLookup.get(i.id));const l=a?$u(a,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Bd(o,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Hd(r)},sl=(e,n={})=>{let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(i=>{(n.filter===void 0||n.filter(i))&&(r=Bd(r,$u(i)),o=!0)}),o?Hd(r):{x:0,y:0,width:0,height:0}},r0=(e,n,[r,o,i]=[0,0,1],s=!1,a=!1)=>{const l={...ll(n,[r,o,i]),width:n.width/i,height:n.height/i},c=[];for(const u of e.values()){const{measured:f,selectable:d=!0,hidden:h=!1}=u;if(a&&!d||h)continue;const g=f.width??u.width??u.initialWidth??null,v=f.height??u.height??u.initialHeight??null,b=Oa(l,Ki(u)),_=(g??0)*(v??0),m=s&&b>0;(!u.internals.handleBounds||m||b>=_||u.dragging)&&c.push(u)}return c},KH=(e,n)=>{const r=new Set;return e.forEach(o=>{r.add(o.id)}),n.filter(o=>r.has(o.source)||r.has(o.target))};function qH(e,n){const r=new Map,o=n!=null&&n.nodes?new Set(n.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((n==null?void 0:n.includeHiddenNodes)||!i.hidden)&&(!o||o.has(i.id))&&r.set(i.id,i)}),r}async function QH({nodes:e,width:n,height:r,panZoom:o,minZoom:i,maxZoom:s},a){if(e.size===0)return Promise.resolve(!0);const l=qH(e,a),c=sl(l),u=o0(c,n,r,(a==null?void 0:a.minZoom)??i,(a==null?void 0:a.maxZoom)??s,(a==null?void 0:a.padding)??.1);return await o.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),Promise.resolve(!0)}function WN({nodeId:e,nextPosition:n,nodeLookup:r,nodeOrigin:o=[0,0],nodeExtent:i,onError:s}){const a=r.get(e),l=a.parentId?r.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},f=a.origin??o;let d=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)s==null||s("005",In.error005());else{const g=l.measured.width,v=l.measured.height;g&&v&&(d=[[c,u],[c+g,u+v]])}else l&&qi(a.extent)&&(d=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=qi(d)?zo(n,d,a.measured):n;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",In.error015())),{position:{x:h.x-c+(a.measured.width??0)*f[0],y:h.y-u+(a.measured.height??0)*f[1]},positionAbsolute:h}}async function ZH({nodesToRemove:e=[],edgesToRemove:n=[],nodes:r,edges:o,onBeforeDelete:i}){const s=new Set(e.map(h=>h.id)),a=[];for(const h of r){if(h.deletable===!1)continue;const g=s.has(h.id),v=!g&&h.parentId&&a.find(b=>b.id===h.parentId);(g||v)&&a.push(h)}const l=new Set(n.map(h=>h.id)),c=o.filter(h=>h.deletable!==!1),f=KH(a,c);for(const h of c)l.has(h.id)&&!f.find(v=>v.id===h.id)&&f.push(h);if(!i)return{edges:f,nodes:a};const d=await i({nodes:a,edges:f});return typeof d=="boolean"?d?{edges:f,nodes:a}:{edges:[],nodes:[]}:d}const Xi=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),zo=(e={x:0,y:0},n,r)=>({x:Xi(e.x,n[0][0],n[1][0]-((r==null?void 0:r.width)??0)),y:Xi(e.y,n[0][1],n[1][1]-((r==null?void 0:r.height)??0))});function GN(e,n,r){const{width:o,height:i}=dr(r),{x:s,y:a}=r.internals.positionAbsolute;return zo(e,[[s,a],[s+o,a+i]],n)}const Hx=(e,n,r)=>e<n?Xi(Math.abs(e-n),1,n)/n:e>r?-Xi(Math.abs(e-r),1,n)/n:0,YN=(e,n,r=15,o=40)=>{const i=Hx(e.x,o,n.width-o)*r,s=Hx(e.y,o,n.height-o)*r;return[i,s]},Bd=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),Fp=({x:e,y:n,width:r,height:o})=>({x:e,y:n,x2:e+r,y2:n+o}),Hd=({x:e,y:n,x2:r,y2:o})=>({x:e,y:n,width:r-e,height:o-n}),Ki=(e,n=[0,0])=>{var i,s;const{x:r,y:o}=n0(e)?e.internals.positionAbsolute:il(e,n);return{x:r,y:o,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},$u=(e,n=[0,0])=>{var i,s;const{x:r,y:o}=n0(e)?e.internals.positionAbsolute:il(e,n);return{x:r,y:o,x2:r+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:o+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},XN=(e,n)=>Hd(Bd(Fp(e),Fp(n))),Oa=(e,n)=>{const r=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),o=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(r*o)},Ux=e=>un(e.width)&&un(e.height)&&un(e.x)&&un(e.y),un=e=>!isNaN(e)&&isFinite(e),JH=(e,n)=>{},al=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),ll=({x:e,y:n},[r,o,i],s=!1,a=[1,1])=>{const l={x:(e-r)/i,y:(n-o)/i};return s?al(l,a):l},Du=({x:e,y:n},[r,o,i])=>({x:e*i+r,y:n*i+o});function ti(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(n*r*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function eU(e,n,r){if(typeof e=="string"||typeof e=="number"){const o=ti(e,r),i=ti(e,n);return{top:o,right:i,bottom:o,left:i,x:i*2,y:o*2}}if(typeof e=="object"){const o=ti(e.top??e.y??0,r),i=ti(e.bottom??e.y??0,r),s=ti(e.left??e.x??0,n),a=ti(e.right??e.x??0,n);return{top:o,right:a,bottom:i,left:s,x:s+a,y:o+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function tU(e,n,r,o,i,s){const{x:a,y:l}=Du(e,[n,r,o]),{x:c,y:u}=Du({x:e.x+e.width,y:e.y+e.height},[n,r,o]),f=i-c,d=s-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(d)}}const o0=(e,n,r,o,i,s)=>{const a=eU(s,n,r),l=(n-a.x)/e.width,c=(r-a.y)/e.height,u=Math.min(l,c),f=Xi(u,o,i),d=e.x+e.width/2,h=e.y+e.height/2,g=n/2-d*f,v=r/2-h*f,b=tU(e,g,v,f,n,r),_={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:g-_.left+_.right,y:v-_.top+_.bottom,zoom:f}},$a=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function qi(e){return e!=null&&e!=="parent"}function dr(e){var n,r;return{width:((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}}function KN(e){var n,r;return(((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth)!==void 0&&(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight)!==void 0}function qN(e,n={width:0,height:0},r,o,i){const s={...e},a=o.get(r);if(a){const l=a.origin||i;s.x+=a.internals.positionAbsolute.x-(n.width??0)*l[0],s.y+=a.internals.positionAbsolute.y-(n.height??0)*l[1]}return s}function Vx(e,n){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}function nU(){let e,n;return{promise:new Promise((o,i)=>{e=o,n=i}),resolve:e,reject:n}}function rU(e){return{...BN,...e||{}}}function oa(e,{snapGrid:n=[0,0],snapToGrid:r=!1,transform:o,containerBounds:i}){const{x:s,y:a}=dn(e),l=ll({x:s-((i==null?void 0:i.left)??0),y:a-((i==null?void 0:i.top)??0)},o),{x:c,y:u}=r?al(l,n):l;return{xSnapped:c,ySnapped:u,...l}}const i0=e=>({width:e.offsetWidth,height:e.offsetHeight}),QN=e=>{var n;return((n=e==null?void 0:e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},oU=["INPUT","SELECT","TEXTAREA"];function ZN(e){var o,i;const n=((i=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:i[0])||e.target;return(n==null?void 0:n.nodeType)!==1?!1:oU.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const JN=e=>"clientX"in e,dn=(e,n)=>{var s,a;const r=JN(e),o=r?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,i=r?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:o-((n==null?void 0:n.left)??0),y:i-((n==null?void 0:n.top)??0)}},Wx=(e,n,r,o,i)=>{const s=n.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-r.left)/o,y:(l.top-r.top)/o,...i0(a)}})};function eE({sourceX:e,sourceY:n,targetX:r,targetY:o,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:l}){const c=e*.125+i*.375+a*.375+r*.125,u=n*.125+s*.375+l*.375+o*.125,f=Math.abs(c-e),d=Math.abs(u-n);return[c,u,f,d]}function rc(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function Gx({pos:e,x1:n,y1:r,x2:o,y2:i,c:s}){switch(e){case ce.Left:return[n-rc(n-o,s),r];case ce.Right:return[n+rc(o-n,s),r];case ce.Top:return[n,r-rc(r-i,s)];case ce.Bottom:return[n,r+rc(i-r,s)]}}function tE({sourceX:e,sourceY:n,sourcePosition:r=ce.Bottom,targetX:o,targetY:i,targetPosition:s=ce.Top,curvature:a=.25}){const[l,c]=Gx({pos:r,x1:e,y1:n,x2:o,y2:i,c:a}),[u,f]=Gx({pos:s,x1:o,y1:i,x2:e,y2:n,c:a}),[d,h,g,v]=eE({sourceX:e,sourceY:n,targetX:o,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:f});return[`M${e},${n} C${l},${c} ${u},${f} ${o},${i}`,d,h,g,v]}function nE({sourceX:e,sourceY:n,targetX:r,targetY:o}){const i=Math.abs(r-e)/2,s=r<e?r+i:r-i,a=Math.abs(o-n)/2,l=o<n?o+a:o-a;return[s,l,i,a]}function iU({sourceNode:e,targetNode:n,selected:r=!1,zIndex:o=0,elevateOnSelect:i=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const a=i&&r?o+1e3:o,l=Math.max(e.parentId||i&&e.selected?e.internals.z:0,n.parentId||i&&n.selected?n.internals.z:0);return a+l}function sU({sourceNode:e,targetNode:n,width:r,height:o,transform:i}){const s=Bd($u(e),$u(n));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const a={x:-i[0]/i[2],y:-i[1]/i[2],width:r/i[2],height:o/i[2]};return Oa(a,Hd(s))>0}const aU=({source:e,sourceHandle:n,target:r,targetHandle:o})=>`xy-edge__${e}${n||""}-${r}${o||""}`,lU=(e,n)=>n.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),cU=(e,n,r={})=>{if(!e.source||!e.target)return n;const o=r.getEdgeId||aU;let i;return VN(e)?i={...e}:i={...e,id:o(e)},lU(i,n)?n:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,n.concat(i))};function rE({sourceX:e,sourceY:n,targetX:r,targetY:o}){const[i,s,a,l]=nE({sourceX:e,sourceY:n,targetX:r,targetY:o});return[`M ${e},${n}L ${r},${o}`,i,s,a,l]}const Yx={[ce.Left]:{x:-1,y:0},[ce.Right]:{x:1,y:0},[ce.Top]:{x:0,y:-1},[ce.Bottom]:{x:0,y:1}},uU=({source:e,sourcePosition:n=ce.Bottom,target:r})=>n===ce.Left||n===ce.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},Xx=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function dU({source:e,sourcePosition:n=ce.Bottom,target:r,targetPosition:o=ce.Top,center:i,offset:s,stepPosition:a}){const l=Yx[n],c=Yx[o],u={x:e.x+l.x*s,y:e.y+l.y*s},f={x:r.x+c.x*s,y:r.y+c.y*s},d=uU({source:u,sourcePosition:n,target:f}),h=d.x!==0?"x":"y",g=d[h];let v=[],b,_;const m={x:0,y:0},w={x:0,y:0},[,,y,S]=nE({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(l[h]*c[h]===-1){h==="x"?(b=i.x??u.x+(f.x-u.x)*a,_=i.y??(u.y+f.y)/2):(b=i.x??(u.x+f.x)/2,_=i.y??u.y+(f.y-u.y)*a);const E=[{x:b,y:u.y},{x:b,y:f.y}],j=[{x:u.x,y:_},{x:f.x,y:_}];l[h]===g?v=h==="x"?E:j:v=h==="x"?j:E}else{const E=[{x:u.x,y:f.y}],j=[{x:f.x,y:u.y}];if(h==="x"?v=l.x===g?j:E:v=l.y===g?E:j,n===o){const P=Math.abs(e[h]-r[h]);if(P<=s){const L=Math.min(s-1,s-P);l[h]===g?m[h]=(u[h]>e[h]?-1:1)*L:w[h]=(f[h]>r[h]?-1:1)*L}}if(n!==o){const P=h==="x"?"y":"x",L=l[h]===c[P],I=u[P]>f[P],z=u[P]<f[P];(l[h]===1&&(!L&&I||L&&z)||l[h]!==1&&(!L&&z||L&&I))&&(v=h==="x"?E:j)}const A={x:u.x+m.x,y:u.y+m.y},T={x:f.x+w.x,y:f.y+w.y},D=Math.max(Math.abs(A.x-v[0].x),Math.abs(T.x-v[0].x)),F=Math.max(Math.abs(A.y-v[0].y),Math.abs(T.y-v[0].y));D>=F?(b=(A.x+T.x)/2,_=v[0].y):(b=v[0].x,_=(A.y+T.y)/2)}const k={x:u.x+m.x,y:u.y+m.y},C={x:f.x+w.x,y:f.y+w.y};return[[e,...k.x!==v[0].x||k.y!==v[0].y?[k]:[],...v,...C.x!==v[v.length-1].x||C.y!==v[v.length-1].y?[C]:[],r],b,_,y,S]}function fU(e,n,r,o){const i=Math.min(Xx(e,n)/2,Xx(n,r)/2,o),{x:s,y:a}=n;if(e.x===s&&s===r.x||e.y===a&&a===r.y)return`L${s} ${a}`;if(e.y===a){const u=e.x<r.x?-1:1,f=e.y<r.y?1:-1;return`L ${s+i*u},${a}Q ${s},${a} ${s},${a+i*f}`}const l=e.x<r.x?1:-1,c=e.y<r.y?-1:1;return`L ${s},${a+i*c}Q ${s},${a} ${s+i*l},${a}`}function Bp({sourceX:e,sourceY:n,sourcePosition:r=ce.Bottom,targetX:o,targetY:i,targetPosition:s=ce.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:f=.5}){const[d,h,g,v,b]=dU({source:{x:e,y:n},sourcePosition:r,target:{x:o,y:i},targetPosition:s,center:{x:l,y:c},offset:u,stepPosition:f});let _=`M${d[0].x} ${d[0].y}`;for(let m=1;m<d.length-1;m++)_+=fU(d[m-1],d[m],d[m+1],a);return _+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[_,h,g,v,b]}function Kx(e){var n;return e&&!!(e.internals.handleBounds||(n=e.handles)!=null&&n.length)&&!!(e.measured.width||e.width||e.initialWidth)}function hU(e){var d;const{sourceNode:n,targetNode:r}=e;if(!Kx(n)||!Kx(r))return null;const o=n.internals.handleBounds||qx(n.handles),i=r.internals.handleBounds||qx(r.handles),s=Qx((o==null?void 0:o.source)??[],e.sourceHandle),a=Qx(e.connectionMode===Yi.Strict?(i==null?void 0:i.target)??[]:((i==null?void 0:i.target)??[]).concat((i==null?void 0:i.source)??[]),e.targetHandle);if(!s||!a)return(d=e.onError)==null||d.call(e,"008",In.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(s==null?void 0:s.position)||ce.Bottom,c=(a==null?void 0:a.position)||ce.Top,u=Fo(n,s,l),f=Fo(r,a,c);return{sourceX:u.x,sourceY:u.y,targetX:f.x,targetY:f.y,sourcePosition:l,targetPosition:c}}function qx(e){if(!e)return null;const n=[],r=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?n.push(o):o.type==="target"&&r.push(o);return{source:n,target:r}}function Fo(e,n,r=ce.Left,o=!1){const i=((n==null?void 0:n.x)??0)+e.internals.positionAbsolute.x,s=((n==null?void 0:n.y)??0)+e.internals.positionAbsolute.y,{width:a,height:l}=n??dr(e);if(o)return{x:i+a/2,y:s+l/2};switch((n==null?void 0:n.position)??r){case ce.Top:return{x:i+a/2,y:s};case ce.Right:return{x:i+a,y:s+l/2};case ce.Bottom:return{x:i+a/2,y:s+l};case ce.Left:return{x:i,y:s+l/2}}}function Qx(e,n){return e&&(n?e.find(r=>r.id===n):e[0])||null}function Hp(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function pU(e,{id:n,defaultColor:r,defaultMarkerStart:o,defaultMarkerEnd:i}){const s=new Set;return e.reduce((a,l)=>([l.markerStart||o,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const u=Hp(c,n);s.has(u)||(a.push({id:u,color:c.color||r,...c}),s.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const oE=1e3,mU=10,s0={nodeOrigin:[0,0],nodeExtent:Ta,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},gU={...s0,checkEquality:!0};function a0(e,n){const r={...e};for(const o in n)n[o]!==void 0&&(r[o]=n[o]);return r}function vU(e,n,r){const o=a0(s0,r);for(const i of e.values())if(i.parentId)c0(i,e,n,o);else{const s=il(i,o.nodeOrigin),a=qi(i.extent)?i.extent:o.nodeExtent,l=zo(s,a,dr(i));i.internals.positionAbsolute=l}}function yU(e,n){if(!e.handles)return e.measured?n==null?void 0:n.internals.handleBounds:void 0;const r=[],o=[];for(const i of e.handles){const s={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?r.push(s):i.type==="target"&&o.push(s)}return{source:r,target:o}}function l0(e){return e==="manual"}function Up(e,n,r,o={}){var f,d;const i=a0(gU,o),s={i:0},a=new Map(n),l=i!=null&&i.elevateNodesOnSelect&&!l0(i.zIndexMode)?oE:0;let c=e.length>0,u=!1;n.clear(),r.clear();for(const h of e){let g=a.get(h.id);if(i.checkEquality&&h===(g==null?void 0:g.internals.userNode))n.set(h.id,g);else{const v=il(h,i.nodeOrigin),b=qi(h.extent)?h.extent:i.nodeExtent,_=zo(v,b,dr(h));g={...i.defaults,...h,measured:{width:(f=h.measured)==null?void 0:f.width,height:(d=h.measured)==null?void 0:d.height},internals:{positionAbsolute:_,handleBounds:yU(h,g),z:iE(h,l,i.zIndexMode),userNode:h}},n.set(h.id,g)}(g.measured===void 0||g.measured.width===void 0||g.measured.height===void 0)&&!g.hidden&&(c=!1),h.parentId&&c0(g,n,r,o,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function xU(e,n){if(!e.parentId)return;const r=n.get(e.parentId);r?r.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function c0(e,n,r,o,i){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=a0(s0,o),u=e.parentId,f=n.get(u);if(!f){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}xU(e,r),i&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++i.i,f.internals.z=f.internals.z+i.i*mU),i&&f.internals.rootParentIndex!==void 0&&(i.i=f.internals.rootParentIndex);const d=s&&!l0(c)?oE:0,{x:h,y:g,z:v}=wU(e,f,a,l,d,c),{positionAbsolute:b}=e.internals,_=h!==b.x||g!==b.y;(_||v!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:h,y:g}:b,z:v}})}function iE(e,n,r){const o=un(e.zIndex)?e.zIndex:0;return l0(r)?o:o+(e.selected?n:0)}function wU(e,n,r,o,i,s){const{x:a,y:l}=n.internals.positionAbsolute,c=dr(e),u=il(e,r),f=qi(e.extent)?zo(u,e.extent,c):u;let d=zo({x:a+f.x,y:l+f.y},o,c);e.extent==="parent"&&(d=GN(d,c,n));const h=iE(e,i,s),g=n.internals.z??0;return{x:d.x,y:d.y,z:g>=h?g+1:h}}function u0(e,n,r,o=[0,0]){var a;const i=[],s=new Map;for(const l of e){const c=n.get(l.parentId);if(!c)continue;const u=((a=s.get(l.parentId))==null?void 0:a.expandedRect)??Ki(c),f=XN(u,l.rect);s.set(l.parentId,{expandedRect:f,parent:c})}return s.size>0&&s.forEach(({expandedRect:l,parent:c},u)=>{var y;const f=c.internals.positionAbsolute,d=dr(c),h=c.origin??o,g=l.x<f.x?Math.round(Math.abs(f.x-l.x)):0,v=l.y<f.y?Math.round(Math.abs(f.y-l.y)):0,b=Math.max(d.width,Math.round(l.width)),_=Math.max(d.height,Math.round(l.height)),m=(b-d.width)*h[0],w=(_-d.height)*h[1];(g>0||v>0||m||w)&&(i.push({id:u,type:"position",position:{x:c.position.x-g+m,y:c.position.y-v+w}}),(y=r.get(u))==null||y.forEach(S=>{e.some(k=>k.id===S.id)||i.push({id:S.id,type:"position",position:{x:S.position.x+g,y:S.position.y+v}})})),(d.width<l.width||d.height<l.height||g||v)&&i.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:b+(g?h[0]*g-m:0),height:_+(v?h[1]*v-w:0)}})}),i}function bU(e,n,r,o,i,s,a){const l=o==null?void 0:o.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const u=[],f=window.getComputedStyle(l),{m22:d}=new window.DOMMatrixReadOnly(f.transform),h=[];for(const g of e.values()){const v=n.get(g.id);if(!v)continue;if(v.hidden){n.set(v.id,{...v,internals:{...v.internals,handleBounds:void 0}}),c=!0;continue}const b=i0(g.nodeElement),_=v.measured.width!==b.width||v.measured.height!==b.height;if(!!(b.width&&b.height&&(_||!v.internals.handleBounds||g.force))){const w=g.nodeElement.getBoundingClientRect(),y=qi(v.extent)?v.extent:s;let{positionAbsolute:S}=v.internals;v.parentId&&v.extent==="parent"?S=GN(S,b,n.get(v.parentId)):y&&(S=zo(S,y,b));const k={...v,measured:b,internals:{...v.internals,positionAbsolute:S,handleBounds:{source:Wx("source",g.nodeElement,w,d,v.id),target:Wx("target",g.nodeElement,w,d,v.id)}}};n.set(v.id,k),v.parentId&&c0(k,n,r,{nodeOrigin:i,zIndexMode:a}),c=!0,_&&(u.push({id:v.id,type:"dimensions",dimensions:b}),v.expandParent&&v.parentId&&h.push({id:v.id,parentId:v.parentId,rect:Ki(k,i)}))}}if(h.length>0){const g=u0(h,n,r,i);u.push(...g)}return{changes:u,updatedInternals:c}}async function _U({delta:e,panZoom:n,transform:r,translateExtent:o,width:i,height:s}){if(!n||!e.x&&!e.y)return Promise.resolve(!1);const a=await n.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[i,s]],o),l=!!a&&(a.x!==r[0]||a.y!==r[1]||a.k!==r[2]);return Promise.resolve(l)}function Zx(e,n,r,o,i,s){let a=i;const l=o.get(a)||new Map;o.set(a,l.set(r,n)),a=`${i}-${e}`;const c=o.get(a)||new Map;if(o.set(a,c.set(r,n)),s){a=`${i}-${e}-${s}`;const u=o.get(a)||new Map;o.set(a,u.set(r,n))}}function sE(e,n,r){e.clear(),n.clear();for(const o of r){const{source:i,target:s,sourceHandle:a=null,targetHandle:l=null}=o,c={edgeId:o.id,source:i,target:s,sourceHandle:a,targetHandle:l},u=`${i}-${a}--${s}-${l}`,f=`${s}-${l}--${i}-${a}`;Zx("source",c,f,e,i,a),Zx("target",c,u,e,s,l),n.set(o.id,o)}}function aE(e,n){if(!e.parentId)return!1;const r=n.get(e.parentId);return r?r.selected?!0:aE(r,n):!1}function Jx(e,n,r){var i;let o=e;do{if((i=o==null?void 0:o.matches)!=null&&i.call(o,n))return!0;if(o===r)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function SU(e,n,r,o){const i=new Map;for(const[s,a]of e)if((a.selected||a.id===o)&&(!a.parentId||!aE(a,e))&&(a.draggable||n&&typeof a.draggable>"u")){const l=e.get(s);l&&i.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:r.x-l.internals.positionAbsolute.x,y:r.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}function Jf({nodeId:e,dragItems:n,nodeLookup:r,dragging:o=!0}){var a,l,c;const i=[];for(const[u,f]of n){const d=(a=r.get(u))==null?void 0:a.internals.userNode;d&&i.push({...d,position:f.position,dragging:o})}if(!e)return[i[0],i];const s=(l=r.get(e))==null?void 0:l.internals.userNode;return[s?{...s,position:((c=n.get(e))==null?void 0:c.position)||s.position,dragging:o}:i[0],i]}function kU({dragItems:e,snapGrid:n,x:r,y:o}){const i=e.values().next().value;if(!i)return null;const s={x:r-i.distance.x,y:o-i.distance.y},a=al(s,n);return{x:a.x-s.x,y:a.y-s.y}}function CU({onNodeMouseDown:e,getStoreItems:n,onDragStart:r,onDrag:o,onDragStop:i}){let s={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},f=null,d=!1,h=null,g=!1,v=!1,b=null;function _({noDragClassName:w,handleSelector:y,domNode:S,isSelectable:k,nodeId:C,nodeClickDistance:N=0}){h=at(S);function E({x:D,y:F}){const{nodeLookup:P,nodeExtent:L,snapGrid:I,snapToGrid:z,nodeOrigin:R,onNodeDrag:M,onSelectionDrag:O,onError:V,updateNodePositions:$}=n();s={x:D,y:F};let K=!1;const B=l.size>1,U=B&&L?Fp(sl(l)):null,G=B&&z?kU({dragItems:l,snapGrid:I,x:D,y:F}):null;for(const[W,X]of l){if(!P.has(W))continue;let q={x:D-X.distance.x,y:F-X.distance.y};z&&(q=G?{x:Math.round(q.x+G.x),y:Math.round(q.y+G.y)}:al(q,I));let te=null;if(B&&L&&!X.extent&&U){const{positionAbsolute:ne}=X.internals,ue=ne.x-U.x+L[0][0],ye=ne.x+X.measured.width-U.x2+L[1][0],pe=ne.y-U.y+L[0][1],ke=ne.y+X.measured.height-U.y2+L[1][1];te=[[ue,pe],[ye,ke]]}const{position:ee,positionAbsolute:Q}=WN({nodeId:W,nextPosition:q,nodeLookup:P,nodeExtent:te||L,nodeOrigin:R,onError:V});K=K||X.position.x!==ee.x||X.position.y!==ee.y,X.position=ee,X.internals.positionAbsolute=Q}if(v=v||K,!!K&&($(l,!0),b&&(o||M||!C&&O))){const[W,X]=Jf({nodeId:C,dragItems:l,nodeLookup:P});o==null||o(b,l,W,X),M==null||M(b,W,X),C||O==null||O(b,X)}}async function j(){if(!f)return;const{transform:D,panBy:F,autoPanSpeed:P,autoPanOnNodeDrag:L}=n();if(!L){c=!1,cancelAnimationFrame(a);return}const[I,z]=YN(u,f,P);(I!==0||z!==0)&&(s.x=(s.x??0)-I/D[2],s.y=(s.y??0)-z/D[2],await F({x:I,y:z})&&E(s)),a=requestAnimationFrame(j)}function A(D){var B;const{nodeLookup:F,multiSelectionActive:P,nodesDraggable:L,transform:I,snapGrid:z,snapToGrid:R,selectNodesOnDrag:M,onNodeDragStart:O,onSelectionDragStart:V,unselectNodesAndEdges:$}=n();d=!0,(!M||!k)&&!P&&C&&((B=F.get(C))!=null&&B.selected||$()),k&&M&&C&&(e==null||e(C));const K=oa(D.sourceEvent,{transform:I,snapGrid:z,snapToGrid:R,containerBounds:f});if(s=K,l=SU(F,L,K,C),l.size>0&&(r||O||!C&&V)){const[U,G]=Jf({nodeId:C,dragItems:l,nodeLookup:F});r==null||r(D.sourceEvent,l,U,G),O==null||O(D.sourceEvent,U,G),C||V==null||V(D.sourceEvent,G)}}const T=Dg().clickDistance(N).on("start",D=>{const{domNode:F,nodeDragThreshold:P,transform:L,snapGrid:I,snapToGrid:z}=n();f=(F==null?void 0:F.getBoundingClientRect())||null,g=!1,v=!1,b=D.sourceEvent,P===0&&A(D),s=oa(D.sourceEvent,{transform:L,snapGrid:I,snapToGrid:z,containerBounds:f}),u=dn(D.sourceEvent,f)}).on("drag",D=>{const{autoPanOnNodeDrag:F,transform:P,snapGrid:L,snapToGrid:I,nodeDragThreshold:z,nodeLookup:R}=n(),M=oa(D.sourceEvent,{transform:P,snapGrid:L,snapToGrid:I,containerBounds:f});if(b=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||C&&!R.has(C))&&(g=!0),!g){if(!c&&F&&d&&(c=!0,j()),!d){const O=dn(D.sourceEvent,f),V=O.x-u.x,$=O.y-u.y;Math.sqrt(V*V+$*$)>z&&A(D)}(s.x!==M.xSnapped||s.y!==M.ySnapped)&&l&&d&&(u=dn(D.sourceEvent,f),E(M))}}).on("end",D=>{if(!(!d||g)&&(c=!1,d=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:F,updateNodePositions:P,onNodeDragStop:L,onSelectionDragStop:I}=n();if(v&&(P(l,!1),v=!1),i||L||!C&&I){const[z,R]=Jf({nodeId:C,dragItems:l,nodeLookup:F,dragging:!1});i==null||i(D.sourceEvent,l,z,R),L==null||L(D.sourceEvent,z,R),C||I==null||I(D.sourceEvent,R)}}}).filter(D=>{const F=D.target;return!D.button&&(!w||!Jx(F,`.${w}`,S))&&(!y||Jx(F,y,S))});h.call(T)}function m(){h==null||h.on(".drag",null)}return{update:_,destroy:m}}function NU(e,n,r){const o=[],i={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const s of n.values())Oa(i,Ki(s))>0&&o.push(s);return o}const EU=250;function jU(e,n,r,o){var l,c;let i=[],s=1/0;const a=NU(e,r,n+EU);for(const u of a){const f=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of f){if(o.nodeId===d.nodeId&&o.type===d.type&&o.id===d.id)continue;const{x:h,y:g}=Fo(u,d,d.position,!0),v=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(g-e.y,2));v>n||(v<s?(i=[{...d,x:h,y:g}],s=v):v===s&&i.push({...d,x:h,y:g}))}}if(!i.length)return null;if(i.length>1){const u=o.type==="source"?"target":"source";return i.find(f=>f.type===u)??i[0]}return i[0]}function lE(e,n,r,o,i,s=!1){var u,f,d;const a=o.get(e);if(!a)return null;const l=i==="strict"?(u=a.internals.handleBounds)==null?void 0:u[n]:[...((f=a.internals.handleBounds)==null?void 0:f.source)??[],...((d=a.internals.handleBounds)==null?void 0:d.target)??[]],c=(r?l==null?void 0:l.find(h=>h.id===r):l==null?void 0:l[0])??null;return c&&s?{...c,...Fo(a,c,c.position,!0)}:c}function cE(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function PU(e,n){let r=null;return n?r=!0:e&&!n&&(r=!1),r}const uE=()=>!0;function MU(e,{connectionMode:n,connectionRadius:r,handleId:o,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:f,flowId:d,panBy:h,cancelConnection:g,onConnectStart:v,onConnect:b,onConnectEnd:_,isValidConnection:m=uE,onReconnectEnd:w,updateConnection:y,getTransform:S,getFromHandle:k,autoPanSpeed:C,dragThreshold:N=1,handleDomNode:E}){const j=QN(e.target);let A=0,T;const{x:D,y:F}=dn(e),P=cE(s,E),L=l==null?void 0:l.getBoundingClientRect();let I=!1;if(!L||!P)return;const z=lE(i,P,o,c,n);if(!z)return;let R=dn(e,L),M=!1,O=null,V=!1,$=null;function K(){if(!f||!L)return;const[ee,Q]=YN(R,L,C);h({x:ee,y:Q}),A=requestAnimationFrame(K)}const B={...z,nodeId:i,type:P,position:z.position},U=c.get(i);let W={inProgress:!0,isValid:null,from:Fo(U,B,ce.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:U,to:R,toHandle:null,toPosition:Bx[B.position],toNode:null,pointer:R};function X(){I=!0,y(W),v==null||v(e,{nodeId:i,handleId:o,handleType:P})}N===0&&X();function q(ee){if(!I){const{x:ke,y:tt}=dn(ee),Xe=ke-D,Zt=tt-F;if(!(Xe*Xe+Zt*Zt>N*N))return;X()}if(!k()||!B){te(ee);return}const Q=S();R=dn(ee,L),T=jU(ll(R,Q,!1,[1,1]),r,c,B),M||(K(),M=!0);const ne=dE(ee,{handle:T,connectionMode:n,fromNodeId:i,fromHandleId:o,fromType:a?"target":"source",isValidConnection:m,doc:j,lib:u,flowId:d,nodeLookup:c});$=ne.handleDomNode,O=ne.connection,V=PU(!!T,ne.isValid);const ue=c.get(i),ye=ue?Fo(ue,B,ce.Left,!0):W.from,pe={...W,from:ye,isValid:V,to:ne.toHandle&&V?Du({x:ne.toHandle.x,y:ne.toHandle.y},Q):R,toHandle:ne.toHandle,toPosition:V&&ne.toHandle?ne.toHandle.position:Bx[B.position],toNode:ne.toHandle?c.get(ne.toHandle.nodeId):null,pointer:R};y(pe),W=pe}function te(ee){if(!("touches"in ee&&ee.touches.length>0)){if(I){(T||$)&&O&&V&&(b==null||b(O));const{inProgress:Q,...ne}=W,ue={...ne,toPosition:W.toHandle?W.toPosition:null};_==null||_(ee,ue),s&&(w==null||w(ee,ue))}g(),cancelAnimationFrame(A),M=!1,V=!1,O=null,$=null,j.removeEventListener("mousemove",q),j.removeEventListener("mouseup",te),j.removeEventListener("touchmove",q),j.removeEventListener("touchend",te)}}j.addEventListener("mousemove",q),j.addEventListener("mouseup",te),j.addEventListener("touchmove",q),j.addEventListener("touchend",te)}function dE(e,{handle:n,connectionMode:r,fromNodeId:o,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=uE,nodeLookup:f}){const d=s==="target",h=n?a.querySelector(`.${l}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:g,y:v}=dn(e),b=a.elementFromPoint(g,v),_=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:h,m={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const w=cE(void 0,_),y=_.getAttribute("data-nodeid"),S=_.getAttribute("data-handleid"),k=_.classList.contains("connectable"),C=_.classList.contains("connectableend");if(!y||!w)return m;const N={source:d?y:o,sourceHandle:d?S:i,target:d?o:y,targetHandle:d?i:S};m.connection=N;const j=k&&C&&(r===Yi.Strict?d&&w==="source"||!d&&w==="target":y!==o||S!==i);m.isValid=j&&u(N),m.toHandle=lE(y,w,S,f,r,!0)}return m}const Vp={onPointerDown:MU,isValid:dE};function RU({domNode:e,panZoom:n,getTransform:r,getViewScale:o}){const i=at(e);function s({translateExtent:l,width:c,height:u,zoomStep:f=1,pannable:d=!0,zoomable:h=!0,inversePan:g=!1}){const v=y=>{if(y.sourceEvent.type!=="wheel"||!n)return;const S=r(),k=y.sourceEvent.ctrlKey&&$a()?10:1,C=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*f,N=S[2]*Math.pow(2,C*k);n.scaleTo(N)};let b=[0,0];const _=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(b=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},m=y=>{const S=r();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!n)return;const k=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],C=[k[0]-b[0],k[1]-b[1]];b=k;const N=o()*Math.max(S[2],Math.log(S[2]))*(g?-1:1),E={x:S[0]-C[0]*N,y:S[1]-C[1]*N},j=[[0,0],[c,u]];n.setViewportConstrained({x:E.x,y:E.y,zoom:S[2]},j,l)},w=Vg().on("start",_).on("zoom",d?m:null).on("zoom.wheel",h?v:null);i.call(w,{})}function a(){i.on("zoom",null)}return{update:s,destroy:a,pointer:Ht}}const Ud=e=>({x:e.x,y:e.y,zoom:e.k}),eh=({x:e,y:n,zoom:r})=>$d.translate(e,n).scale(r),xi=(e,n)=>e.target.closest(`.${n}`),fE=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),AU=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,th=(e,n=0,r=AU,o=()=>{})=>{const i=typeof n=="number"&&n>0;return i||o(),i?e.transition().duration(n).ease(r).on("end",o):e},hE=e=>{const n=e.ctrlKey&&$a()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function TU({zoomPanValues:e,noWheelClassName:n,d3Selection:r,d3Zoom:o,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return f=>{if(xi(f,n))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const d=r.property("__zoom").k||1;if(f.ctrlKey&&a){const _=Ht(f),m=hE(f),w=d*Math.pow(2,m);o.scaleTo(r,w,_,f);return}const h=f.deltaMode===1?20:1;let g=i===No.Vertical?0:f.deltaX*h,v=i===No.Horizontal?0:f.deltaY*h;!$a()&&f.shiftKey&&i!==No.Vertical&&(g=f.deltaY*h,v=0),o.translateBy(r,-(g/d)*s,-(v/d)*s,{internal:!0});const b=Ud(r.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(f,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(f,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(f,b))}}function IU({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:r}){return function(o,i){const s=o.type==="wheel",a=!n&&s&&!o.ctrlKey,l=xi(o,e);if(o.ctrlKey&&s&&l&&o.preventDefault(),a||l)return null;o.preventDefault(),r.call(this,o,i)}}function OU({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:r}){return o=>{var s,a,l;if((s=o.sourceEvent)!=null&&s.internal)return;const i=Ud(o.transform);e.mouseButton=((a=o.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((l=o.sourceEvent)==null?void 0:l.type)==="mousedown"&&n(!0),r&&(r==null||r(o.sourceEvent,i))}}function $U({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:r,onTransformChange:o,onPanZoom:i}){return s=>{var a,l;e.usedRightMouseButton=!!(r&&fE(n,e.mouseButton??0)),(a=s.sourceEvent)!=null&&a.sync||o([s.transform.x,s.transform.y,s.transform.k]),i&&!((l=s.sourceEvent)!=null&&l.internal)&&(i==null||i(s.sourceEvent,Ud(s.transform)))}}function DU({zoomPanValues:e,panOnDrag:n,panOnScroll:r,onDraggingChange:o,onPanZoomEnd:i,onPaneContextMenu:s}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,s&&fE(n,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,o(!1),i)){const c=Ud(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(a.sourceEvent,c)},r?150:0)}}}function LU({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:o,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:f}){return d=>{var _;const h=e||n,g=r&&d.ctrlKey,v=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(xi(d,`${u}-flow__node`)||xi(d,`${u}-flow__edge`)))return!0;if(!o&&!h&&!i&&!s&&!r||a||f&&!v||xi(d,l)&&v||xi(d,c)&&(!v||i&&v&&!e)||!r&&d.ctrlKey&&v)return!1;if(!r&&d.type==="touchstart"&&((_=d.touches)==null?void 0:_.length)>1)return d.preventDefault(),!1;if(!h&&!i&&!g&&v||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const b=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||v)&&b}}function zU({domNode:e,minZoom:n,maxZoom:r,translateExtent:o,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),d=Vg().scaleExtent([n,r]).translateExtent(o),h=at(e).call(d);w({x:i.x,y:i.y,zoom:Xi(i.zoom,n,r)},[[0,0],[f.width,f.height]],o);const g=h.on("wheel.zoom"),v=h.on("dblclick.zoom");d.wheelDelta(hE);function b(T,D){return h?new Promise(F=>{d==null||d.interpolate((D==null?void 0:D.interpolate)==="linear"?Js:Pc).transform(th(h,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>F(!0)),T)}):Promise.resolve(!1)}function _({noWheelClassName:T,noPanClassName:D,onPaneContextMenu:F,userSelectionActive:P,panOnScroll:L,panOnDrag:I,panOnScrollMode:z,panOnScrollSpeed:R,preventScrolling:M,zoomOnPinch:O,zoomOnScroll:V,zoomOnDoubleClick:$,zoomActivationKeyPressed:K,lib:B,onTransformChange:U,connectionInProgress:G,paneClickDistance:W,selectionOnDrag:X}){P&&!u.isZoomingOrPanning&&m();const q=L&&!K&&!P;d.clickDistance(X?1/0:!un(W)||W<0?0:W);const te=q?TU({zoomPanValues:u,noWheelClassName:T,d3Selection:h,d3Zoom:d,panOnScrollMode:z,panOnScrollSpeed:R,zoomOnPinch:O,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):IU({noWheelClassName:T,preventScrolling:M,d3ZoomHandler:g});if(h.on("wheel.zoom",te,{passive:!1}),!P){const Q=OU({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});d.on("start",Q);const ne=$U({zoomPanValues:u,panOnDrag:I,onPaneContextMenu:!!F,onPanZoom:s,onTransformChange:U});d.on("zoom",ne);const ue=DU({zoomPanValues:u,panOnDrag:I,panOnScroll:L,onPaneContextMenu:F,onPanZoomEnd:l,onDraggingChange:c});d.on("end",ue)}const ee=LU({zoomActivationKeyPressed:K,panOnDrag:I,zoomOnScroll:V,panOnScroll:L,zoomOnDoubleClick:$,zoomOnPinch:O,userSelectionActive:P,noPanClassName:D,noWheelClassName:T,lib:B,connectionInProgress:G});d.filter(ee),$?h.on("dblclick.zoom",v):h.on("dblclick.zoom",null)}function m(){d.on("zoom",null)}async function w(T,D,F){const P=eh(T),L=d==null?void 0:d.constrain()(P,D,F);return L&&await b(L),new Promise(I=>I(L))}async function y(T,D){const F=eh(T);return await b(F,D),new Promise(P=>P(F))}function S(T){if(h){const D=eh(T),F=h.property("__zoom");(F.k!==T.zoom||F.x!==T.x||F.y!==T.y)&&(d==null||d.transform(h,D,null,{sync:!0}))}}function k(){const T=h?on(h.node()):{x:0,y:0,k:1};return{x:T.x,y:T.y,zoom:T.k}}function C(T,D){return h?new Promise(F=>{d==null||d.interpolate((D==null?void 0:D.interpolate)==="linear"?Js:Pc).scaleTo(th(h,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>F(!0)),T)}):Promise.resolve(!1)}function N(T,D){return h?new Promise(F=>{d==null||d.interpolate((D==null?void 0:D.interpolate)==="linear"?Js:Pc).scaleBy(th(h,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>F(!0)),T)}):Promise.resolve(!1)}function E(T){d==null||d.scaleExtent(T)}function j(T){d==null||d.translateExtent(T)}function A(T){const D=!un(T)||T<0?0:T;d==null||d.clickDistance(D)}return{update:_,destroy:m,setViewport:y,setViewportConstrained:w,getViewport:k,scaleTo:C,scaleBy:N,setScaleExtent:E,setTranslateExtent:j,syncViewport:S,setClickDistance:A}}var Qi;(function(e){e.Line="line",e.Handle="handle"})(Qi||(Qi={}));function FU({width:e,prevWidth:n,height:r,prevHeight:o,affectsX:i,affectsY:s}){const a=e-n,l=r-o,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function e1(e){const n=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),o=e.includes("left"),i=e.includes("top");return{isHorizontal:n,isVertical:r,affectsX:o,affectsY:i}}function wr(e,n){return Math.max(0,n-e)}function br(e,n){return Math.max(0,e-n)}function oc(e,n,r){return Math.max(0,n-e,e-r)}function t1(e,n){return e?!n:n}function BU(e,n,r,o,i,s,a,l){let{affectsX:c,affectsY:u}=n;const{isHorizontal:f,isVertical:d}=n,h=f&&d,{xSnapped:g,ySnapped:v}=r,{minWidth:b,maxWidth:_,minHeight:m,maxHeight:w}=o,{x:y,y:S,width:k,height:C,aspectRatio:N}=e;let E=Math.floor(f?g-e.pointerX:0),j=Math.floor(d?v-e.pointerY:0);const A=k+(c?-E:E),T=C+(u?-j:j),D=-s[0]*k,F=-s[1]*C;let P=oc(A,b,_),L=oc(T,m,w);if(a){let R=0,M=0;c&&E<0?R=wr(y+E+D,a[0][0]):!c&&E>0&&(R=br(y+A+D,a[1][0])),u&&j<0?M=wr(S+j+F,a[0][1]):!u&&j>0&&(M=br(S+T+F,a[1][1])),P=Math.max(P,R),L=Math.max(L,M)}if(l){let R=0,M=0;c&&E>0?R=br(y+E,l[0][0]):!c&&E<0&&(R=wr(y+A,l[1][0])),u&&j>0?M=br(S+j,l[0][1]):!u&&j<0&&(M=wr(S+T,l[1][1])),P=Math.max(P,R),L=Math.max(L,M)}if(i){if(f){const R=oc(A/N,m,w)*N;if(P=Math.max(P,R),a){let M=0;!c&&!u||c&&!u&&h?M=br(S+F+A/N,a[1][1])*N:M=wr(S+F+(c?E:-E)/N,a[0][1])*N,P=Math.max(P,M)}if(l){let M=0;!c&&!u||c&&!u&&h?M=wr(S+A/N,l[1][1])*N:M=br(S+(c?E:-E)/N,l[0][1])*N,P=Math.max(P,M)}}if(d){const R=oc(T*N,b,_)/N;if(L=Math.max(L,R),a){let M=0;!c&&!u||u&&!c&&h?M=br(y+T*N+D,a[1][0])/N:M=wr(y+(u?j:-j)*N+D,a[0][0])/N,L=Math.max(L,M)}if(l){let M=0;!c&&!u||u&&!c&&h?M=wr(y+T*N,l[1][0])/N:M=br(y+(u?j:-j)*N,l[0][0])/N,L=Math.max(L,M)}}}j=j+(j<0?L:-L),E=E+(E<0?P:-P),i&&(h?A>T*N?j=(t1(c,u)?-E:E)/N:E=(t1(c,u)?-j:j)*N:f?(j=E/N,u=c):(E=j*N,c=u));const I=c?y+E:y,z=u?S+j:S;return{width:k+(c?-E:E),height:C+(u?-j:j),x:s[0]*E*(c?-1:1)+I,y:s[1]*j*(u?-1:1)+z}}const pE={width:0,height:0,x:0,y:0},HU={...pE,pointerX:0,pointerY:0,aspectRatio:1};function UU(e){return[[0,0],[e.measured.width,e.measured.height]]}function VU(e,n,r){const o=n.position.x+e.position.x,i=n.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,l=r[0]*s,c=r[1]*a;return[[o-l,i-c],[o+s-l,i+a-c]]}function WU({domNode:e,nodeId:n,getStoreItems:r,onChange:o,onEnd:i}){const s=at(e);let a={controlDirection:e1("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:f,keepAspectRatio:d,resizeDirection:h,onResizeStart:g,onResize:v,onResizeEnd:b,shouldResize:_}){let m={...pE},w={...HU};a={boundaries:f,resizeDirection:h,keepAspectRatio:d,controlDirection:e1(u)};let y,S=null,k=[],C,N,E,j=!1;const A=Dg().on("start",T=>{const{nodeLookup:D,transform:F,snapGrid:P,snapToGrid:L,nodeOrigin:I,paneDomNode:z}=r();if(y=D.get(n),!y)return;S=(z==null?void 0:z.getBoundingClientRect())??null;const{xSnapped:R,ySnapped:M}=oa(T.sourceEvent,{transform:F,snapGrid:P,snapToGrid:L,containerBounds:S});m={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},w={...m,pointerX:R,pointerY:M,aspectRatio:m.width/m.height},C=void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(C=D.get(y.parentId),N=C&&y.extent==="parent"?UU(C):void 0),k=[],E=void 0;for(const[O,V]of D)if(V.parentId===n&&(k.push({id:O,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const $=VU(V,y,V.origin??I);E?E=[[Math.min($[0][0],E[0][0]),Math.min($[0][1],E[0][1])],[Math.max($[1][0],E[1][0]),Math.max($[1][1],E[1][1])]]:E=$}g==null||g(T,{...m})}).on("drag",T=>{const{transform:D,snapGrid:F,snapToGrid:P,nodeOrigin:L}=r(),I=oa(T.sourceEvent,{transform:D,snapGrid:F,snapToGrid:P,containerBounds:S}),z=[];if(!y)return;const{x:R,y:M,width:O,height:V}=m,$={},K=y.origin??L,{width:B,height:U,x:G,y:W}=BU(w,a.controlDirection,I,a.boundaries,a.keepAspectRatio,K,N,E),X=B!==O,q=U!==V,te=G!==R&&X,ee=W!==M&&q;if(!te&&!ee&&!X&&!q)return;if((te||ee||K[0]===1||K[1]===1)&&($.x=te?G:m.x,$.y=ee?W:m.y,m.x=$.x,m.y=$.y,k.length>0)){const ye=G-R,pe=W-M;for(const ke of k)ke.position={x:ke.position.x-ye+K[0]*(B-O),y:ke.position.y-pe+K[1]*(U-V)},z.push(ke)}if((X||q)&&($.width=X&&(!a.resizeDirection||a.resizeDirection==="horizontal")?B:m.width,$.height=q&&(!a.resizeDirection||a.resizeDirection==="vertical")?U:m.height,m.width=$.width,m.height=$.height),C&&y.expandParent){const ye=K[0]*($.width??0);$.x&&$.x<ye&&(m.x=ye,w.x=w.x-($.x-ye));const pe=K[1]*($.height??0);$.y&&$.y<pe&&(m.y=pe,w.y=w.y-($.y-pe))}const Q=FU({width:m.width,prevWidth:O,height:m.height,prevHeight:V,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),ne={...m,direction:Q};(_==null?void 0:_(T,ne))!==!1&&(j=!0,v==null||v(T,ne),o($,z))}).on("end",T=>{j&&(b==null||b(T,{...m}),i==null||i({...m}),j=!1)});s.call(A)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}var mE={exports:{}},gE={};/**
|
|
427
|
+
`;gH(vH);function Lp(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,o=Array(n);r<n;r++)o[r]=e[r];return o}function yH(e){if(Array.isArray(e))return e}function xH(e){if(Array.isArray(e))return Lp(e)}function $x(e,n,r){if(RN())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,n);var i=new(e.bind.apply(e,o));return i}function Ra(e,n,r){return(n=CH(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function RN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(RN=function(){return!!e})()}function wH(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function bH(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var o,i,s,a,l=[],c=!0,u=!1;try{if(s=(r=r.call(e)).next,n!==0)for(;!(c=(o=s.call(r)).done)&&(l.push(o.value),l.length!==n);c=!0);}catch(f){u=!0,i=f}finally{try{if(!c&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function _H(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
428
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SH(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
429
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dx(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,o)}return r}function ei(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Dx(Object(r),!0).forEach(function(o){Ra(e,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dx(Object(r)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(r,o))})}return e}function ra(e,n){return yH(e)||bH(e,n)||AN(e,n)||_H()}function Wt(e){return xH(e)||wH(e)||AN(e)||SH()}function kH(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function CH(e){var n=kH(e,"string");return typeof n=="symbol"?n:n+""}function zp(e){"@babel/helpers - typeof";return zp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},zp(e)}function AN(e,n){if(e){if(typeof e=="string")return Lp(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Lp(e,n):void 0}}var NH=MN(mH);function Lx(e,n,r){!n||typeof r!="string"||e.filter(function(o){return!o[r]}).forEach(function(o){o[r]=NH(n(o))})}function EH(e,n){var r=e.nodes,o=e.links,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=i.nodeFilter,a=s===void 0?function(){return!0}:s,l=i.onLoopError,c=l===void 0?function(g){throw"Invalid DAG structure! Found cycle in node path: ".concat(g.join(" -> "),".")}:l,u={};r.forEach(function(g){return u[n(g)]={data:g,out:[],depth:-1,skip:!a(g)}}),o.forEach(function(g){var v=g.source,b=g.target,_=S(v),m=S(b);if(!u.hasOwnProperty(_))throw"Missing source node with id: ".concat(_);if(!u.hasOwnProperty(m))throw"Missing target node with id: ".concat(m);var w=u[_],y=u[m];w.out.push(y);function S(k){return zp(k)==="object"?n(k):k}});var f=[];h(Object.values(u));var d=Object.assign.apply(Object,[{}].concat(Wt(Object.entries(u).filter(function(g){var v=ra(g,2),b=v[1];return!b.skip}).map(function(g){var v=ra(g,2),b=v[0],_=v[1];return Ra({},b,_.depth)}))));return d;function h(g){for(var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,_=function(){var S=g[m];if(v.indexOf(S)!==-1){var k=[].concat(Wt(v.slice(v.indexOf(S))),[S]).map(function(C){return n(C.data)});return f.some(function(C){return C.length===k.length&&C.every(function(N,E){return N===k[E]})})||(f.push(k),c(k)),1}b>S.depth&&(S.depth=b,h(S.out,[].concat(Wt(v),[S]),b+(S.skip?0:1)))},m=0,w=g.length;m<w;m++)_()}}var jH=2,ot=function(n,r){return r.onNeedsRedraw&&r.onNeedsRedraw()},zx=function(n,r){if(!r.isShadow){var o=_e(r.linkDirectionalParticles);r.graphData.links.forEach(function(i){var s=Math.round(Math.abs(o(i)));s?i.__photons=Wt(Array(s)).map(function(){return{}}):delete i.__photons})}},Iu=Wg({props:{graphData:{default:{nodes:[],links:[]},onChange:function(n,r){r.engineRunning=!1,zx(n,r)}},dagMode:{onChange:function(n,r){!n&&(r.graphData.nodes||[]).forEach(function(o){return o.fx=o.fy=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(n){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4,triggerUpdate:!1,onChange:ot},nodeId:{default:"id"},nodeVal:{default:"val",triggerUpdate:!1,onChange:ot},nodeColor:{default:"color",triggerUpdate:!1,onChange:ot},nodeAutoColorBy:{},nodeCanvasObject:{triggerUpdate:!1,onChange:ot},nodeCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:ot},nodeVisibility:{default:!0,triggerUpdate:!1,onChange:ot},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0,triggerUpdate:!1,onChange:ot},linkColor:{default:"color",triggerUpdate:!1,onChange:ot},linkAutoColorBy:{},linkLineDash:{triggerUpdate:!1,onChange:ot},linkWidth:{default:1,triggerUpdate:!1,onChange:ot},linkCurvature:{default:0,triggerUpdate:!1,onChange:ot},linkCanvasObject:{triggerUpdate:!1,onChange:ot},linkCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:ot},linkDirectionalArrowLength:{default:0,triggerUpdate:!1,onChange:ot},linkDirectionalArrowColor:{triggerUpdate:!1,onChange:ot},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1,onChange:ot},linkDirectionalParticles:{default:0,triggerUpdate:!1,onChange:zx},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:4,triggerUpdate:!1},linkDirectionalParticleColor:{triggerUpdate:!1},linkDirectionalParticleCanvasObject:{triggerUpdate:!1},globalScale:{default:1,triggerUpdate:!1},d3AlphaMin:{default:0,triggerUpdate:!1},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaDecay(n)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaTarget(n)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.velocityDecay(n)}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1},onNeedsRedraw:{triggerUpdate:!1},isShadow:{default:!1,triggerUpdate:!1}},methods:{d3Force:function(n,r,o){return o===void 0?n.forceLayout.force(r):(n.forceLayout.force(r,o),this)},d3ReheatSimulation:function(n){return n.forceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(n){return n.cntTicks=0,n.startTickTime=new Date,n.engineRunning=!0,this},isEngineRunning:function(n){return!!n.engineRunning},tickFrame:function(n){return!n.isShadow&&r(),i(),!n.isShadow&&s(),!n.isShadow&&a(),o(),this;function r(){n.engineRunning&&(++n.cntTicks>n.cooldownTicks||new Date-n.startTickTime>n.cooldownTime||n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin?(n.engineRunning=!1,n.onEngineStop()):(n.forceLayout.tick(),n.onEngineTick()))}function o(){var l=_e(n.nodeVisibility),c=_e(n.nodeVal),u=_e(n.nodeColor),f=_e(n.nodeCanvasObjectMode),d=n.ctx,h=n.isShadow/n.globalScale,g=n.graphData.nodes.filter(l);d.save(),g.forEach(function(v){var b=f(v);if(n.nodeCanvasObject&&(b==="before"||b==="replace")&&(n.nodeCanvasObject(v,d,n.globalScale),b==="replace")){d.restore();return}var _=Math.sqrt(Math.max(0,c(v)||1))*n.nodeRelSize+h;d.beginPath(),d.arc(v.x,v.y,_,0,2*Math.PI,!1),d.fillStyle=u(v)||"rgba(31, 120, 180, 0.92)",d.fill(),n.nodeCanvasObject&&b==="after"&&n.nodeCanvasObject(v,n.ctx,n.globalScale)}),d.restore()}function i(){var l=_e(n.linkVisibility),c=_e(n.linkColor),u=_e(n.linkWidth),f=_e(n.linkLineDash),d=_e(n.linkCurvature),h=_e(n.linkCanvasObjectMode),g=n.ctx,v=n.isShadow*2,b=n.graphData.links.filter(l);b.forEach(C);var _=[],m=[],w=b;if(n.linkCanvasObject){var y=[],S=[];b.forEach(function(N){return({before:_,after:m,replace:y}[h(N)]||S).push(N)}),w=[].concat(Wt(_),m,S),_=_.concat(y)}g.save(),_.forEach(function(N){return n.linkCanvasObject(N,g,n.globalScale)}),g.restore();var k=fH(w,[c,u,f]);g.save(),Object.entries(k).forEach(function(N){var E=ra(N,2),j=E[0],A=E[1],T=!j||j==="undefined"?"rgba(0,0,0,0.15)":j;Object.entries(A).forEach(function(D){var F=ra(D,2),P=F[0],L=F[1],I=(P||1)/n.globalScale+v;Object.entries(L).forEach(function(z){var R=ra(z,2);R[0];var M=R[1],O=f(M[0]);g.beginPath(),M.forEach(function(V){var $=V.source,K=V.target;if(!(!$||!K||!$.hasOwnProperty("x")||!K.hasOwnProperty("x"))){g.moveTo($.x,$.y);var B=V.__controlPoints;B?g[B.length===2?"quadraticCurveTo":"bezierCurveTo"].apply(g,Wt(B).concat([K.x,K.y])):g.lineTo(K.x,K.y)}}),g.strokeStyle=T,g.lineWidth=I,g.setLineDash(O||[]),g.stroke()})})}),g.restore(),g.save(),m.forEach(function(N){return n.linkCanvasObject(N,g,n.globalScale)}),g.restore();function C(N){var E=d(N);if(!E){N.__controlPoints=null;return}var j=N.source,A=N.target;if(!(!j||!A||!j.hasOwnProperty("x")||!A.hasOwnProperty("x"))){var T=Math.sqrt(Math.pow(A.x-j.x,2)+Math.pow(A.y-j.y,2));if(T>0){var D=Math.atan2(A.y-j.y,A.x-j.x),F=T*E,P={x:(j.x+A.x)/2+F*Math.cos(D-Math.PI/2),y:(j.y+A.y)/2+F*Math.sin(D-Math.PI/2)};N.__controlPoints=[P.x,P.y]}else{var L=E*70;N.__controlPoints=[A.x,A.y-L,A.x+L,A.y]}}}}function s(){var l=1.6,c=.2,u=_e(n.linkDirectionalArrowLength),f=_e(n.linkDirectionalArrowRelPos),d=_e(n.linkVisibility),h=_e(n.linkDirectionalArrowColor||n.linkColor),g=_e(n.nodeVal),v=n.ctx;v.save(),n.graphData.links.filter(d).forEach(function(b){var _=u(b);if(!(!_||_<0)){var m=b.source,w=b.target;if(!(!m||!w||!m.hasOwnProperty("x")||!w.hasOwnProperty("x"))){var y=Math.sqrt(Math.max(0,g(m)||1))*n.nodeRelSize,S=Math.sqrt(Math.max(0,g(w)||1))*n.nodeRelSize,k=Math.min(1,Math.max(0,f(b))),C=h(b)||"rgba(0,0,0,0.28)",N=_/l/2,E=b.__controlPoints&&$x(je,[m.x,m.y].concat(Wt(b.__controlPoints),[w.x,w.y])),j=E?function(I){return E.get(I)}:function(I){return{x:m.x+(w.x-m.x)*I||0,y:m.y+(w.y-m.y)*I||0}},A=E?E.length():Math.sqrt(Math.pow(w.x-m.x,2)+Math.pow(w.y-m.y,2)),T=y+_+(A-y-S-_)*k,D=j(T/A),F=j((T-_)/A),P=j((T-_*(1-c))/A),L=Math.atan2(D.y-F.y,D.x-F.x)-Math.PI/2;v.beginPath(),v.moveTo(D.x,D.y),v.lineTo(F.x+N*Math.cos(L),F.y+N*Math.sin(L)),v.lineTo(P.x,P.y),v.lineTo(F.x-N*Math.cos(L),F.y-N*Math.sin(L)),v.fillStyle=C,v.fill()}}}),v.restore()}function a(){var l=_e(n.linkDirectionalParticles),c=_e(n.linkDirectionalParticleSpeed),u=_e(n.linkDirectionalParticleOffset),f=_e(n.linkDirectionalParticleWidth),d=_e(n.linkVisibility),h=_e(n.linkDirectionalParticleColor||n.linkColor),g=n.ctx;g.save(),n.graphData.links.filter(d).forEach(function(v){var b=l(v);if(!(!v.hasOwnProperty("__photons")||!v.__photons.length)){var _=v.source,m=v.target;if(!(!_||!m||!_.hasOwnProperty("x")||!m.hasOwnProperty("x"))){var w=c(v),y=Math.abs(u(v)),S=v.__photons||[],k=Math.max(0,f(v)/2)/Math.sqrt(n.globalScale),C=h(v)||"rgba(0,0,0,0.28)";g.fillStyle=C;var N=v.__controlPoints?$x(je,[_.x,_.y].concat(Wt(v.__controlPoints),[m.x,m.y])):null,E=0,j=!1;S.forEach(function(A){var T=!!A.__singleHop;if(A.hasOwnProperty("__progressRatio")||(A.__progressRatio=T?w<0?1:0:(E+y)/b),!T&&E++,A.__progressRatio+=w,A.__progressRatio>=1||A.__progressRatio<0)if(!T)A.__progressRatio=A.__progressRatio%1,A.__progressRatio<0&&A.__progressRatio++;else{j=!0;return}var D=A.__progressRatio,F=N?N.get(D):{x:_.x+(m.x-_.x)*D||0,y:_.y+(m.y-_.y)*D||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(F.x,F.y,v,g,n.globalScale):(g.beginPath(),g.arc(F.x,F.y,k,0,2*Math.PI,!1),g.fill())}),j&&(v.__photons=v.__photons.filter(function(A){return!A.__singleHop||A.__progressRatio<=1&&A.__progressRatio>=0}))}}}),g.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:VB().force("link",$B()).force("charge",WB()).force("center",L7()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(n,r){r.ctx=n},update:function(n,r){n.engineRunning=!1,n.onUpdate(),n.nodeAutoColorBy!==null&&Lx(n.graphData.nodes,_e(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&Lx(n.graphData.links,_e(n.linkAutoColorBy),n.linkColor),n.graphData.links.forEach(function(h){h.source=h[n.linkSource],h.target=h[n.linkTarget]}),n.forceLayout.stop().alpha(1).nodes(n.graphData.nodes);var o=n.forceLayout.force("link");o&&o.id(function(h){return h[n.nodeId]}).links(n.graphData.links);var i=n.dagMode&&EH(n.graphData,function(h){return h[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),s=Math.max.apply(Math,Wt(Object.values(i||[]))),a=n.dagLevelDistance||n.graphData.nodes.length/(s||1)*jH*(["radialin","radialout"].indexOf(n.dagMode)!==-1?.7:1);if(["lr","rl","td","bu"].includes(r.dagMode)){var l=["lr","rl"].includes(r.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(h){return delete h[l]})}if(["lr","rl","td","bu"].includes(n.dagMode)){var c=["rl","bu"].includes(n.dagMode),u=function(g){return(i[g[n.nodeId]]-s/2)*a*(c?-1:1)},f=["lr","rl"].includes(n.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(h){return h[f]=u(h)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?GB(function(h){var g=i[h[n.nodeId]]||-1;return(n.dagMode==="radialin"?s-g:g)*a}).strength(function(h){return n.dagNodeFilter(h)?1:0}):null);for(var d=0;d<n.warmupTicks&&!(n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin);d++)n.forceLayout.tick();this.resetCountdown(),n.onFinishUpdate()}});function TN(e,n){var r=e instanceof Array?e:[e],o=new n;return o._destructor&&o._destructor(),{linkProp:function(s){return{default:o[s](),onChange:function(l,c){r.forEach(function(u){return c[u][s](l)})},triggerUpdate:!1}},linkMethod:function(s){return function(a){for(var l=arguments.length,c=new Array(l>1?l-1:0),u=1;u<l;u++)c[u-1]=arguments[u];var f=[];return r.forEach(function(d){var h=a[d],g=h[s].apply(h,c);g!==h&&f.push(g)}),f.length?f[0]:this}}}}var PH=800,MH=4,RH=5,IN=TN("forceGraph",Iu),AH=TN(["forceGraph","shadowGraph"],Iu),TH=Object.assign.apply(Object,Wt(["nodeColor","nodeAutoColorBy","nodeCanvasObject","nodeCanvasObjectMode","linkColor","linkAutoColorBy","linkLineDash","linkWidth","linkCanvasObject","linkCanvasObjectMode","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleCanvasObject","dagMode","dagLevelDistance","dagNodeFilter","onDagError","d3AlphaMin","d3AlphaDecay","d3VelocityDecay","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].map(function(e){return Ra({},e,IN.linkProp(e))})).concat(Wt(["nodeRelSize","nodeId","nodeVal","nodeVisibility","linkSource","linkTarget","linkVisibility","linkCurvature"].map(function(e){return Ra({},e,AH.linkProp(e))})))),IH=Object.assign.apply(Object,Wt(["d3Force","d3ReheatSimulation","emitParticle"].map(function(e){return Ra({},e,IN.linkMethod(e))})));function Zf(e){if(e.canvas){var n=e.canvas.width,r=e.canvas.height;n===300&&r===150&&(n=r=0);var o=window.devicePixelRatio;n/=o,r/=o,[e.canvas,e.shadowCanvas].forEach(function(s){s.style.width="".concat(e.width,"px"),s.style.height="".concat(e.height,"px"),s.width=e.width*o,s.height=e.height*o,!n&&!r&&s.getContext("2d").scale(o,o)});var i=on(e.canvas).k;e.zoom.translateBy(e.zoom.__baseElem,(e.width-n)/2/i,(e.height-r)/2/i),e.needsRedraw=!0}}function ON(e){var n=window.devicePixelRatio;e.setTransform(n,0,0,n,0,0)}function Fx(e,n,r){e.save(),ON(e),e.clearRect(0,0,n,r),e.restore()}var OH=Wg({props:ei({width:{default:window.innerWidth,onChange:function(n,r){return Zf(r)},triggerUpdate:!1},height:{default:window.innerHeight,onChange:function(n,r){return Zf(r)},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(n,r){[n.nodes,n.links].every(function(i){return(i||[]).every(function(s){return!s.hasOwnProperty("__indexColor")})})&&r.colorTracker.reset(),[{type:"Node",objs:n.nodes},{type:"Link",objs:n.links}].forEach(o),r.forceGraph.graphData(n),r.shadowGraph.graphData(n);function o(i){var s=i.type,a=i.objs;a.filter(function(l){if(!l.hasOwnProperty("__indexColor"))return!0;var c=r.colorTracker.lookup(l.__indexColor);return!c||!c.hasOwnProperty("d")||c.d!==l}).forEach(function(l){l.__indexColor=r.colorTracker.register({type:s,d:l})})}},triggerUpdate:!1},backgroundColor:{onChange:function(n,r){r.canvas&&n&&(r.canvas.style.background=n)},triggerUpdate:!1},nodeLabel:{default:"name",triggerUpdate:!1},nodePointerAreaPaint:{onChange:function(n,r){r.shadowGraph.nodeCanvasObject(n?function(o,i,s){return n(o,o.__indexColor,i,s)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkPointerAreaPaint:{onChange:function(n,r){r.shadowGraph.linkCanvasObject(n?function(o,i,s){return n(o,o.__indexColor,i,s)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:4,triggerUpdate:!1},minZoom:{default:.01,onChange:function(n,r){r.zoom.scaleExtent([n,r.zoom.scaleExtent()[1]])},triggerUpdate:!1},maxZoom:{default:1e3,onChange:function(n,r){r.zoom.scaleExtent([r.zoom.scaleExtent()[0],n])},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},enableZoomInteraction:{default:!0,triggerUpdate:!1},enablePanInteraction:{default:!0,triggerUpdate:!1},enableZoomPanInteraction:{default:!0,triggerUpdate:!1},enablePointerInteraction:{default:!0,onChange:function(n,r){r.hoverObj=null},triggerUpdate:!1},autoPauseRedraw:{default:!0,triggerUpdate:!1},onNodeDrag:{default:function(){},triggerUpdate:!1},onNodeDragEnd:{default:function(){},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},onZoom:{triggerUpdate:!1},onZoomEnd:{triggerUpdate:!1},onRenderFramePre:{triggerUpdate:!1},onRenderFramePost:{triggerUpdate:!1}},TH),aliases:{stopAnimation:"pauseAnimation"},methods:ei({graph2ScreenCoords:function(n,r,o){var i=on(n.canvas);return{x:r*i.k+i.x,y:o*i.k+i.y}},screen2GraphCoords:function(n,r,o){var i=on(n.canvas);return{x:(r-i.x)/i.k,y:(o-i.y)/i.k}},centerAt:function(n,r,o,i){if(!n.canvas)return null;if(r!==void 0||o!==void 0){var s=Object.assign({},r!==void 0?{x:r}:{},o!==void 0?{y:o}:{});return i?n.tweenGroup.add(new cx(a()).to(s,i).easing(Co.Quadratic.Out).onUpdate(l).onComplete(function(){n.tweenGroup.remove(this)}).start()):l(s),this}return a();function a(){var c=on(n.canvas);return{x:(n.width/2-c.x)/c.k,y:(n.height/2-c.y)/c.k}}function l(c){var u=c.x,f=c.y;n.zoom.translateTo(n.zoom.__baseElem,u===void 0?a().x:u,f===void 0?a().y:f),n.needsRedraw=!0}},zoom:function(n,r,o){if(!n.canvas)return null;if(r!==void 0)return o?n.tweenGroup.add(new cx({k:i()}).to({k:r},o).easing(Co.Quadratic.Out).onUpdate(function(a){var l=a.k;return s(l)}).onComplete(function(){n.tweenGroup.remove(this)}).start()):s(r),this;return i();function i(){return on(n.canvas).k}function s(a){n.zoom.scaleTo(n.zoom.__baseElem,a),n.needsRedraw=!0}},zoomToFit:function(n){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,i=arguments.length,s=new Array(i>3?i-3:0),a=3;a<i;a++)s[a-3]=arguments[a];var l=this.getGraphBbox.apply(this,s);if(l){var c={x:(l.x[0]+l.x[1])/2,y:(l.y[0]+l.y[1])/2},u=Math.max(1e-12,Math.min(1e12,(n.width-o*2)/(l.x[1]-l.x[0]),(n.height-o*2)/(l.y[1]-l.y[0])));this.centerAt(c.x,c.y,r),this.zoom(u,r)}return this},getGraphBbox:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},o=_e(n.nodeVal),i=function(l){return Math.sqrt(Math.max(0,o(l)||1))*n.nodeRelSize},s=n.graphData.nodes.filter(r).map(function(a){return{x:a.x,y:a.y,r:i(a)}});return s.length?{x:[ix(s,function(a){return a.x-a.r}),ox(s,function(a){return a.x+a.r})],y:[ix(s,function(a){return a.y-a.r}),ox(s,function(a){return a.y+a.r})]}:null},pauseAnimation:function(n){return n.animationFrameRequestId&&(cancelAnimationFrame(n.animationFrameRequestId),n.animationFrameRequestId=null),this},resumeAnimation:function(n){return n.animationFrameRequestId||this._animationCycle(),this},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},IH),stateInit:function(){return{lastSetZoom:1,zoom:Vg(),forceGraph:new Iu,shadowGraph:new Iu().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new m7,tweenGroup:new oN}},init:function(n,r){var o=this;n.innerHTML="";var i=document.createElement("div");i.classList.add("force-graph-container"),i.style.position="relative",n.appendChild(i),r.canvas=document.createElement("canvas"),r.backgroundColor&&(r.canvas.style.background=r.backgroundColor),i.appendChild(r.canvas),r.shadowCanvas=document.createElement("canvas");var s=r.canvas.getContext("2d"),a=r.shadowCanvas.getContext("2d",{willReadFrequently:!0}),l={x:-1e12,y:-1e12},c=function(){var d=null,h=window.devicePixelRatio,g=l.x>0&&l.y>0?a.getImageData(l.x*h,l.y*h,1,1):null;return g&&(d=r.colorTracker.lookup(g.data)),d};at(r.canvas).call(Dg().subject(function(){if(!r.enableNodeDrag)return null;var f=c();return f&&f.type==="Node"?f.d:null}).on("start",function(f){var d=f.subject;d.__initialDragPos={x:d.x,y:d.y,fx:d.fx,fy:d.fy},f.active||(d.fx=d.x,d.fy=d.y),r.canvas.classList.add("grabbable")}).on("drag",function(f){var d=f.subject,h=d.__initialDragPos,g=f,v=on(r.canvas).k,b={x:h.x+(g.x-h.x)/v-d.x,y:h.y+(g.y-h.y)/v-d.y};["x","y"].forEach(function(_){return d["f".concat(_)]=d[_]=h[_]+(g[_]-h[_])/v}),!(!d.__dragged&&RH>=Math.sqrt(K9(["x","y"].map(function(_){return Math.pow(f[_]-h[_],2)}))))&&(r.forceGraph.d3AlphaTarget(.3).resetCountdown(),r.isPointerDragging=!0,d.__dragged=!0,r.onNodeDrag(d,b))}).on("end",function(f){var d=f.subject,h=d.__initialDragPos,g={x:d.x-h.x,y:d.y-h.y};h.fx===void 0&&(d.fx=void 0),h.fy===void 0&&(d.fy=void 0),delete d.__initialDragPos,r.forceGraph.d3AlphaTarget()&&r.forceGraph.d3AlphaTarget(0).resetCountdown(),r.canvas.classList.remove("grabbable"),r.isPointerDragging=!1,d.__dragged&&(delete d.__dragged,r.onNodeDragEnd(d,g))})),r.zoom(r.zoom.__baseElem=at(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(f){return!f.button&&r.enableZoomPanInteraction&&(f.type!=="wheel"||_e(r.enableZoomInteraction)(f))&&(f.type==="wheel"||_e(r.enablePanInteraction)(f))}).on("zoom",function(f){var d=f.transform;[s,a].forEach(function(h){ON(h),h.translate(d.x,d.y),h.scale(d.k,d.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom(ei(ei({},d),o.centerAt())),r.needsRedraw=!0}).on("end",function(f){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd(ei(ei({},f.transform),o.centerAt()))}),Zf(r),r.forceGraph.onNeedsRedraw(function(){return r.needsRedraw=!0}).onFinishUpdate(function(){on(r.canvas).k===r.lastSetZoom&&r.graphData.nodes.length&&(r.zoom.scaleTo(r.zoom.__baseElem,r.lastSetZoom=MH/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new D7(i),["pointermove","pointerdown"].forEach(function(f){return i.addEventListener(f,function(d){f==="pointerdown"&&(r.isPointerPressed=!0,r.pointerDownEvent=d),!r.isPointerDragging&&d.type==="pointermove"&&r.onBackgroundClick&&(d.pressure>0||r.isPointerPressed)&&(d.pointerType==="mouse"||d.movementX===void 0||[d.movementX,d.movementY].some(function(v){return Math.abs(v)>1}))&&(r.isPointerDragging=!0);var h=g(i);l.x=d.pageX-h.left,l.y=d.pageY-h.top;function g(v){var b=v.getBoundingClientRect(),_=window.pageXOffset||document.documentElement.scrollLeft,m=window.pageYOffset||document.documentElement.scrollTop;return{top:b.top+m,left:b.left+_}}},{passive:!0})}),i.addEventListener("pointerup",function(f){if(r.isPointerPressed){if(r.isPointerPressed=!1,r.isPointerDragging){r.isPointerDragging=!1;return}var d=[f,r.pointerDownEvent];requestAnimationFrame(function(){if(f.button===0)if(r.hoverObj){var h=r["on".concat(r.hoverObj.type,"Click")];h&&h.apply(void 0,[r.hoverObj.d].concat(d))}else r.onBackgroundClick&&r.onBackgroundClick.apply(r,d);if(f.button===2)if(r.hoverObj){var g=r["on".concat(r.hoverObj.type,"RightClick")];g&&g.apply(void 0,[r.hoverObj.d].concat(d))}else r.onBackgroundRightClick&&r.onBackgroundRightClick.apply(r,d)})}},{passive:!0}),i.addEventListener("contextmenu",function(f){return!r.onBackgroundRightClick&&!r.onNodeRightClick&&!r.onLinkRightClick?!0:(f.preventDefault(),!1)}),r.forceGraph(s),r.shadowGraph(a);var u=_F(function(){Fx(a,r.width,r.height),r.shadowGraph.linkWidth(function(d){return _e(r.linkWidth)(d)+r.linkHoverPrecision});var f=on(r.canvas);r.shadowGraph.globalScale(f.k).tickFrame()},PH);r.flushShadowCanvas=u.flush,(this._animationCycle=function f(){var d=!r.autoPauseRedraw||!!r.needsRedraw||r.forceGraph.isEngineRunning()||r.graphData.links.some(function(y){return y.__photons&&y.__photons.length});if(r.needsRedraw=!1,r.enablePointerInteraction){var h=r.isPointerDragging?null:c();if(h!==r.hoverObj){var g=r.hoverObj,v=g?g.type:null,b=h?h.type:null;if(v&&v!==b){var _=r["on".concat(v,"Hover")];_&&_(null,g.d)}if(b){var m=r["on".concat(b,"Hover")];m&&m(h.d,v===b?g.d:null)}r.tooltip.content(h&&_e(r["".concat(h.type.toLowerCase(),"Label")])(h.d)||null),r.canvas.classList[(h&&r["on".concat(b,"Click")]||!h&&r.onBackgroundClick)&&_e(r.showPointerCursor)(h==null?void 0:h.d)?"add":"remove"]("clickable"),r.hoverObj=h}d&&u()}if(d){Fx(s,r.width,r.height);var w=on(r.canvas).k;r.onRenderFramePre&&r.onRenderFramePre(s,w),r.forceGraph.globalScale(w).tickFrame(),r.onRenderFramePost&&r.onRenderFramePost(s,w)}r.tweenGroup.update(),r.animationFrameRequestId=requestAnimationFrame(f)})()},update:function(n){}}),$N={exports:{}},$H="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",DH=$H,LH=DH;function DN(){}function LN(){}LN.resetWarningCache=DN;var zH=function(){function e(o,i,s,a,l,c){if(c!==LH){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function n(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:n,element:e,elementType:e,instanceOf:n,node:e,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:LN,resetWarningCache:DN};return r.PropTypes=r,r};$N.exports=zH();var FH=$N.exports;const H=Bu(FH),Fd={width:H.number,height:H.number,graphData:H.shape({nodes:H.arrayOf(H.object).isRequired,links:H.arrayOf(H.object).isRequired}),backgroundColor:H.string,nodeRelSize:H.number,nodeId:H.string,nodeLabel:H.oneOfType([H.string,H.func]),nodeVal:H.oneOfType([H.number,H.string,H.func]),nodeVisibility:H.oneOfType([H.bool,H.string,H.func]),nodeColor:H.oneOfType([H.string,H.func]),nodeAutoColorBy:H.oneOfType([H.string,H.func]),onNodeHover:H.func,onNodeClick:H.func,linkSource:H.string,linkTarget:H.string,linkLabel:H.oneOfType([H.string,H.func]),linkVisibility:H.oneOfType([H.bool,H.string,H.func]),linkColor:H.oneOfType([H.string,H.func]),linkAutoColorBy:H.oneOfType([H.string,H.func]),linkWidth:H.oneOfType([H.number,H.string,H.func]),linkCurvature:H.oneOfType([H.number,H.string,H.func]),linkDirectionalArrowLength:H.oneOfType([H.number,H.string,H.func]),linkDirectionalArrowColor:H.oneOfType([H.string,H.func]),linkDirectionalArrowRelPos:H.oneOfType([H.number,H.string,H.func]),linkDirectionalParticles:H.oneOfType([H.number,H.string,H.func]),linkDirectionalParticleSpeed:H.oneOfType([H.number,H.string,H.func]),linkDirectionalParticleOffset:H.oneOfType([H.number,H.string,H.func]),linkDirectionalParticleWidth:H.oneOfType([H.number,H.string,H.func]),linkDirectionalParticleColor:H.oneOfType([H.string,H.func]),onLinkHover:H.func,onLinkClick:H.func,dagMode:H.oneOf(["td","bu","lr","rl","zin","zout","radialin","radialout"]),dagLevelDistance:H.number,dagNodeFilter:H.func,onDagError:H.func,d3AlphaMin:H.number,d3AlphaDecay:H.number,d3VelocityDecay:H.number,warmupTicks:H.number,cooldownTicks:H.number,cooldownTime:H.number,onEngineTick:H.func,onEngineStop:H.func,getGraphBbox:H.func},zN={zoomToFit:H.func,onNodeRightClick:H.func,onNodeDrag:H.func,onNodeDragEnd:H.func,onLinkRightClick:H.func,linkHoverPrecision:H.number,onBackgroundClick:H.func,onBackgroundRightClick:H.func,showPointerCursor:H.oneOfType([H.bool,H.func]),enablePointerInteraction:H.bool,enableNodeDrag:H.bool},Jg={showNavInfo:H.bool,nodeOpacity:H.number,nodeResolution:H.number,nodeThreeObject:H.oneOfType([H.object,H.string,H.func]),nodeThreeObjectExtend:H.oneOfType([H.bool,H.string,H.func]),nodePositionUpdate:H.func,linkOpacity:H.number,linkResolution:H.number,linkCurveRotation:H.oneOfType([H.number,H.string,H.func]),linkMaterial:H.oneOfType([H.object,H.string,H.func]),linkThreeObject:H.oneOfType([H.object,H.string,H.func]),linkThreeObjectExtend:H.oneOfType([H.bool,H.string,H.func]),linkPositionUpdate:H.func,linkDirectionalArrowResolution:H.number,linkDirectionalParticleResolution:H.number,linkDirectionalParticleThreeObject:H.oneOfType([H.object,H.string,H.func]),forceEngine:H.oneOf(["d3","ngraph"]),ngraphPhysics:H.object,numDimensions:H.oneOf([1,2,3])},BH=Object.assign({},Fd,zN,{linkLineDash:H.oneOfType([H.arrayOf(H.number),H.string,H.func]),nodeCanvasObjectMode:H.oneOfType([H.string,H.func]),nodeCanvasObject:H.func,nodePointerAreaPaint:H.func,linkCanvasObjectMode:H.oneOfType([H.string,H.func]),linkCanvasObject:H.func,linkPointerAreaPaint:H.func,linkDirectionalParticleCanvasObject:H.func,autoPauseRedraw:H.bool,minZoom:H.number,maxZoom:H.number,enableZoomInteraction:H.oneOfType([H.bool,H.func]),enablePanInteraction:H.oneOfType([H.bool,H.func]),onZoom:H.func,onZoomEnd:H.func,onRenderFramePre:H.func,onRenderFramePost:H.func});Object.assign({},Fd,zN,Jg,{enableNavigationControls:H.bool,controlType:H.oneOf(["trackball","orbit","fly"]),rendererConfig:H.object,extraRenderers:H.arrayOf(H.shape({render:H.func.isRequired}))});Object.assign({},Fd,Jg,{nodeDesc:H.oneOfType([H.string,H.func]),linkDesc:H.oneOfType([H.string,H.func])});Object.assign({},Fd,Jg,{markerAttrs:H.object,yOffset:H.number,glScale:H.number});const e0=f6(OH,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});e0.displayName="ForceGraph2D";e0.propTypes=BH;const Ts={ui:"#60a5fa",api:"#34d399",db:"#f59e0b"},HH="rgba(244, 114, 182, 0.6)",UH="rgba(148, 163, 184, 0.25)";function VH(){const[e,n]=x.useState(null),[r,o]=x.useState(null),[i,s]=x.useState(!0),[a,l]=x.useState(!1),[c,u]=x.useState(new Set(["ui","api","db"])),[f,d]=x.useState(null),h=x.useRef(null),[g,v]=x.useState({width:0,height:0}),b=Go(),_=x.useCallback((y=!1)=>{y?l(!0):s(!0),o(null),fetch(b("/api/project-graph",y?{regenerate:"1"}:void 0)).then(S=>S.json()).then(S=>{"error"in S?o(S.error):n(S)}).catch(S=>o(String(S))).finally(()=>{s(!1),l(!1)})},[b]);x.useEffect(()=>{_(!1)},[_]),x.useEffect(()=>{if(!h.current)return;const y=h.current,S=()=>v({width:y.clientWidth,height:y.clientHeight});S();const k=new ResizeObserver(S);return k.observe(y),()=>k.disconnect()},[e]);const m=x.useMemo(()=>{if(!e)return{nodes:[],links:[]};const y=e.nodes.filter(C=>c.has(C.layer)),S=new Set(y.map(C=>C.id)),k=e.links.filter(C=>{const N=typeof C.source=="string"?C.source:C.source.id,E=typeof C.target=="string"?C.target:C.target.id;return S.has(N)&&S.has(E)});return{nodes:y,links:k}},[e,c]),w=y=>{const S=new Set(c);S.has(y)?S.delete(y):S.add(y),S.size!==0&&u(S)};return p.jsxs("div",{className:"flex h-full flex-col",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-sidebar-border px-6 py-3",children:[p.jsx("h1",{className:"text-lg font-semibold",children:"Project Graph"}),e&&p.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.nodes.length," nodes · ",m.links.length," links"]}),p.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[["ui","api","db"].map(y=>p.jsxs("button",{type:"button",onClick:()=>w(y),className:"flex items-center gap-1.5 rounded-md border border-sidebar-border px-2.5 py-1 text-xs transition-opacity",style:{opacity:c.has(y)?1:.4,borderColor:c.has(y)?Ts[y]:void 0},children:[p.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:Ts[y]}}),y.toUpperCase(),e&&` (${e.stats.byLayer[y]})`]},y)),p.jsx("button",{type:"button",onClick:()=>_(!0),disabled:a||i,className:"rounded-md border border-sidebar-border px-2.5 py-1 text-xs hover:bg-sidebar-accent disabled:opacity-50",children:a?"Regenerating…":"Regenerate"})]})]}),p.jsxs("div",{ref:h,className:"relative flex-1 overflow-hidden",children:[i&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground",children:"Loading graph…"}),r&&p.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-destructive",children:r}),e&&g.width>0&&p.jsx(e0,{width:g.width,height:g.height,graphData:m,nodeId:"id",nodeLabel:y=>`${y.layer}/${y.type}: ${y.name}`,nodeRelSize:3,nodeColor:y=>Ts[y.layer],linkColor:y=>y.cross?HH:UH,linkWidth:y=>y.cross?1:.5,linkDirectionalParticles:0,cooldownTicks:120,onNodeHover:y=>d(y),backgroundColor:"transparent",nodeCanvasObjectMode:()=>"after",nodeCanvasObject:(y,S,k)=>{if(k<1.4||y.x===void 0||y.y===void 0)return;const C=y.name,N=11/k;S.font=`${N}px -apple-system, system-ui, sans-serif`;const E=S.measureText(C).width,j=3/k,A=1.5/k;S.fillStyle="rgba(15, 15, 20, 0.75)",S.fillRect(y.x-E/2-j,y.y+5/k-A,E+j*2,N+A*2),S.textAlign="center",S.textBaseline="top",S.fillStyle=Ts[y.layer],S.fillText(C,y.x,y.y+5/k)}}),f&&p.jsxs("div",{className:"pointer-events-none absolute bottom-4 left-4 max-w-md rounded-lg border border-sidebar-border bg-background/90 px-3 py-2 text-xs shadow-lg backdrop-blur",children:[p.jsxs("div",{className:"font-semibold",style:{color:Ts[f.layer]},children:[f.layer.toUpperCase()," · ",f.type]}),p.jsx("div",{className:"font-mono",children:f.name}),p.jsx("div",{className:"text-muted-foreground",children:f.path}),f.module&&p.jsxs("div",{className:"text-muted-foreground",children:["module: ",f.module]})]})]})]})}function er(e){var n;return((n=e.tags)==null?void 0:n.module)??e.module??null}function t0(e){var n;return(n=e.tags)!=null&&n.screen?e.tags.screen==="true":e.type==="page"||e.type==="layout"}function Aa(e){return e.split(/[-_]/).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function Kr(e){if(e.route){const n=e.route.split("/").filter(Boolean).filter(r=>!r.startsWith("(")&&!r.startsWith(":")&&!r.startsWith("["));return n.length>0?n[n.length-1].split(/[-_]/).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "):"Home"}return e.name}const WH=new Set(["lib","db","config","external","middleware","server-lib","services","mcp","layout","shared-ui"]);function GH(){const[e,n]=x.useState(null),[r,o]=x.useState("loading"),[i,s]=x.useState(null),[a,l]=x.useState(!1),c=Go(),u=x.useCallback(async()=>{try{const g=await fetch(c("/api/raw-graphs"));if(!g.ok)throw new Error(`HTTP ${g.status}`);const v=await g.json();n(v);const b=!!(v.ui||v.api||v.db);o(b?"ready":"empty")}catch(g){s(String(g)),o("error")}},[c]);x.useEffect(()=>{u()},[u]);const f=x.useCallback(async()=>{l(!0),s(null);try{const g=await fetch(c("/api/generate-graph"),{method:"POST"});if(!g.ok)throw new Error(`HTTP ${g.status}`);const v=await g.json();if(!v.ok)throw new Error(v.error??"Generation failed");n({ui:v.ui,api:v.api,db:v.db});const b=!!(v.ui||v.api||v.db);o(b?"ready":"empty")}catch(g){s(String(g))}finally{l(!1)}},[]),{moduleBuckets:d,counts:h}=x.useMemo(()=>{if(!(e!=null&&e.ui)||!(e!=null&&e.api)||!(e!=null&&e.db))return{moduleBuckets:[],counts:null};const g=e.ui.nodes.filter(w=>t0(w)&&er(w)&&!WH.has(er(w))),v=new Map;for(const w of g){const y=er(w);v.has(y)||v.set(y,[]),v.get(y).push(w)}const b=[],_=new Map;for(const[w,y]of v)y.length===1?b.push(...y):_.set(w,y);const m=[..._.entries()].map(([w,y])=>({module:w,screens:y})).sort((w,y)=>y.screens.length-w.screens.length);return b.length>0&&m.push({module:"misc",screens:b}),{moduleBuckets:m,counts:{screens:g.length,modules:m.length,endpoints:e.api.nodes.length,tables:e.db.nodes.length,components:e.ui.nodes.filter(w=>w.type==="component").length}}},[e]);return r==="loading"?p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading overview…"})}):r==="empty"?p.jsx(YH,{onGenerate:f,busy:a,error:i}):r==="error"?p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsxs("div",{className:"max-w-md text-center",children:[p.jsx("p",{className:"text-sm text-foreground",children:"Failed to load graph"}),p.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:i}),p.jsx("button",{type:"button",onClick:u,className:"mt-4 rounded-md border border-sidebar-border px-3 py-1.5 text-xs text-foreground hover:bg-sidebar-accent",children:"Retry"})]})}):h?p.jsx("div",{className:"h-full overflow-y-auto",children:p.jsxs("div",{className:"mx-auto max-w-6xl px-8 py-8",children:[p.jsxs("header",{className:"mb-8 flex items-start justify-between gap-4",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Project Overview"}),p.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"A high-level map of the modules, screens, and systems in this project."})]}),p.jsxs("button",{type:"button",onClick:f,disabled:a,className:"flex shrink-0 items-center gap-1.5 rounded-md border border-sidebar-border px-3 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60",children:[p.jsx(L_,{className:`h-3 w-3 ${a?"animate-spin":""}`}),a?"Regenerating…":"Regenerate graph"]})]}),i&&p.jsx("div",{className:"mb-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:i}),p.jsxs("div",{className:"mb-8 grid grid-cols-2 gap-3 md:grid-cols-4",children:[p.jsx(nc,{icon:p.jsx(ld,{className:"h-4 w-4"}),label:"Modules",value:h.modules}),p.jsx(nc,{icon:p.jsx(Ua,{className:"h-4 w-4"}),label:"Screens",value:h.screens}),p.jsx(nc,{icon:p.jsx(Zm,{className:"h-4 w-4"}),label:"API endpoints",value:h.endpoints}),p.jsx(nc,{icon:p.jsx(Qm,{className:"h-4 w-4"}),label:"Database tables",value:h.tables})]}),p.jsxs("section",{children:[p.jsx("h2",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Capability map"}),p.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:d.map(g=>p.jsx(XH,{module:g.module,screens:g.screens},g.module))})]})]})}):null}function YH({onGenerate:e,busy:n,error:r}){return p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsxs("div",{className:"max-w-md text-center",children:[p.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-sidebar-primary/15 text-sidebar-primary",children:p.jsx(DA,{className:"h-6 w-6"})}),p.jsx("h2",{className:"mt-4 text-lg font-semibold text-foreground",children:"No graph yet"}),p.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"LaunchChart hasn't generated a project graph for this workspace. Generate one to see modules, screens, API endpoints, and database tables."}),p.jsxs("button",{type:"button",onClick:e,disabled:n,className:"mt-6 inline-flex items-center gap-2 rounded-md bg-sidebar-primary px-4 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-sidebar-primary/90 disabled:cursor-not-allowed disabled:opacity-60",children:[p.jsx(L_,{className:`h-4 w-4 ${n?"animate-spin":""}`}),n?"Generating…":"Generate graph"]}),p.jsx("p",{className:"mt-3 text-[11px] text-muted-foreground",children:"This scans your source tree — takes a few seconds."}),r&&p.jsx("div",{className:"mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:r})]})})}function nc({icon:e,label:n,value:r}){return p.jsxs("div",{className:"rounded-lg border border-sidebar-border bg-background/40 px-4 py-3",children:[p.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e,p.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",children:n})]}),p.jsx("p",{className:"mt-1 text-2xl font-semibold tabular-nums text-foreground",children:r})]})}function XH({module:e,screens:n}){const r=n.slice(0,6),o=n.length-r.length;return p.jsxs("div",{className:"rounded-lg border border-sidebar-border bg-background/40 p-5 transition-colors hover:border-sidebar-primary/50",children:[p.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[p.jsx("h3",{className:"text-base font-semibold text-foreground",children:Aa(e)}),p.jsxs("span",{className:"rounded bg-sidebar-accent px-2 py-0.5 text-[10px] font-medium tabular-nums text-muted-foreground",children:[n.length," screens"]})]}),p.jsxs("ul",{className:"space-y-1",children:[r.map(i=>p.jsxs("li",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[p.jsx("span",{className:"h-1 w-1 shrink-0 rounded-full bg-sidebar-primary/60"}),p.jsx("span",{className:"truncate text-foreground/90",children:Kr(i)})]},i.id)),o>0&&p.jsxs("li",{className:"pl-3 pt-1 text-[11px] italic text-muted-foreground",children:["+",o," more"]})]})]})}function Ue(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let r=0,o;r<e.length;r++)(o=Ue(e[r]))!==""&&(n+=(n&&" ")+o);else for(let r in e)e[r]&&(n+=(n&&" ")+r);return n}const In={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:e=>`Node type "${e}" 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:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:n,sourceHandle:r,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r:o}", edge id: ${n}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Ta=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],FN=["Enter"," ","Escape"],BN={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:n,y:r})=>`Moved selected node ${e}. New position, x: ${n}, y: ${r}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Yi;(function(e){e.Strict="strict",e.Loose="loose"})(Yi||(Yi={}));var No;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(No||(No={}));var Ia;(function(e){e.Partial="partial",e.Full="full"})(Ia||(Ia={}));const HN={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Pr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Pr||(Pr={}));var Ou;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ou||(Ou={}));var ce;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ce||(ce={}));const Bx={[ce.Left]:ce.Right,[ce.Right]:ce.Left,[ce.Top]:ce.Bottom,[ce.Bottom]:ce.Top};function UN(e){return e===null?null:e?"valid":"invalid"}const VN=e=>"id"in e&&"source"in e&&"target"in e,KH=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),n0=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),il=(e,n=[0,0])=>{const{width:r,height:o}=dr(e),i=e.origin??n,s=r*i[0],a=o*i[1];return{x:e.position.x-s,y:e.position.y-a}},qH=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((o,i)=>{const s=typeof i=="string";let a=!n.nodeLookup&&!s?i:void 0;n.nodeLookup&&(a=s?n.nodeLookup.get(i):n0(i)?i:n.nodeLookup.get(i.id));const l=a?$u(a,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Bd(o,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Hd(r)},sl=(e,n={})=>{let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(i=>{(n.filter===void 0||n.filter(i))&&(r=Bd(r,$u(i)),o=!0)}),o?Hd(r):{x:0,y:0,width:0,height:0}},r0=(e,n,[r,o,i]=[0,0,1],s=!1,a=!1)=>{const l={...ll(n,[r,o,i]),width:n.width/i,height:n.height/i},c=[];for(const u of e.values()){const{measured:f,selectable:d=!0,hidden:h=!1}=u;if(a&&!d||h)continue;const g=f.width??u.width??u.initialWidth??null,v=f.height??u.height??u.initialHeight??null,b=Oa(l,Ki(u)),_=(g??0)*(v??0),m=s&&b>0;(!u.internals.handleBounds||m||b>=_||u.dragging)&&c.push(u)}return c},QH=(e,n)=>{const r=new Set;return e.forEach(o=>{r.add(o.id)}),n.filter(o=>r.has(o.source)||r.has(o.target))};function ZH(e,n){const r=new Map,o=n!=null&&n.nodes?new Set(n.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((n==null?void 0:n.includeHiddenNodes)||!i.hidden)&&(!o||o.has(i.id))&&r.set(i.id,i)}),r}async function JH({nodes:e,width:n,height:r,panZoom:o,minZoom:i,maxZoom:s},a){if(e.size===0)return Promise.resolve(!0);const l=ZH(e,a),c=sl(l),u=o0(c,n,r,(a==null?void 0:a.minZoom)??i,(a==null?void 0:a.maxZoom)??s,(a==null?void 0:a.padding)??.1);return await o.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),Promise.resolve(!0)}function WN({nodeId:e,nextPosition:n,nodeLookup:r,nodeOrigin:o=[0,0],nodeExtent:i,onError:s}){const a=r.get(e),l=a.parentId?r.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},f=a.origin??o;let d=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)s==null||s("005",In.error005());else{const g=l.measured.width,v=l.measured.height;g&&v&&(d=[[c,u],[c+g,u+v]])}else l&&qi(a.extent)&&(d=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=qi(d)?zo(n,d,a.measured):n;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",In.error015())),{position:{x:h.x-c+(a.measured.width??0)*f[0],y:h.y-u+(a.measured.height??0)*f[1]},positionAbsolute:h}}async function eU({nodesToRemove:e=[],edgesToRemove:n=[],nodes:r,edges:o,onBeforeDelete:i}){const s=new Set(e.map(h=>h.id)),a=[];for(const h of r){if(h.deletable===!1)continue;const g=s.has(h.id),v=!g&&h.parentId&&a.find(b=>b.id===h.parentId);(g||v)&&a.push(h)}const l=new Set(n.map(h=>h.id)),c=o.filter(h=>h.deletable!==!1),f=QH(a,c);for(const h of c)l.has(h.id)&&!f.find(v=>v.id===h.id)&&f.push(h);if(!i)return{edges:f,nodes:a};const d=await i({nodes:a,edges:f});return typeof d=="boolean"?d?{edges:f,nodes:a}:{edges:[],nodes:[]}:d}const Xi=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),zo=(e={x:0,y:0},n,r)=>({x:Xi(e.x,n[0][0],n[1][0]-((r==null?void 0:r.width)??0)),y:Xi(e.y,n[0][1],n[1][1]-((r==null?void 0:r.height)??0))});function GN(e,n,r){const{width:o,height:i}=dr(r),{x:s,y:a}=r.internals.positionAbsolute;return zo(e,[[s,a],[s+o,a+i]],n)}const Hx=(e,n,r)=>e<n?Xi(Math.abs(e-n),1,n)/n:e>r?-Xi(Math.abs(e-r),1,n)/n:0,YN=(e,n,r=15,o=40)=>{const i=Hx(e.x,o,n.width-o)*r,s=Hx(e.y,o,n.height-o)*r;return[i,s]},Bd=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),Fp=({x:e,y:n,width:r,height:o})=>({x:e,y:n,x2:e+r,y2:n+o}),Hd=({x:e,y:n,x2:r,y2:o})=>({x:e,y:n,width:r-e,height:o-n}),Ki=(e,n=[0,0])=>{var i,s;const{x:r,y:o}=n0(e)?e.internals.positionAbsolute:il(e,n);return{x:r,y:o,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},$u=(e,n=[0,0])=>{var i,s;const{x:r,y:o}=n0(e)?e.internals.positionAbsolute:il(e,n);return{x:r,y:o,x2:r+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:o+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},XN=(e,n)=>Hd(Bd(Fp(e),Fp(n))),Oa=(e,n)=>{const r=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),o=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(r*o)},Ux=e=>un(e.width)&&un(e.height)&&un(e.x)&&un(e.y),un=e=>!isNaN(e)&&isFinite(e),tU=(e,n)=>{},al=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),ll=({x:e,y:n},[r,o,i],s=!1,a=[1,1])=>{const l={x:(e-r)/i,y:(n-o)/i};return s?al(l,a):l},Du=({x:e,y:n},[r,o,i])=>({x:e*i+r,y:n*i+o});function ti(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(n*r*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function nU(e,n,r){if(typeof e=="string"||typeof e=="number"){const o=ti(e,r),i=ti(e,n);return{top:o,right:i,bottom:o,left:i,x:i*2,y:o*2}}if(typeof e=="object"){const o=ti(e.top??e.y??0,r),i=ti(e.bottom??e.y??0,r),s=ti(e.left??e.x??0,n),a=ti(e.right??e.x??0,n);return{top:o,right:a,bottom:i,left:s,x:s+a,y:o+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function rU(e,n,r,o,i,s){const{x:a,y:l}=Du(e,[n,r,o]),{x:c,y:u}=Du({x:e.x+e.width,y:e.y+e.height},[n,r,o]),f=i-c,d=s-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(d)}}const o0=(e,n,r,o,i,s)=>{const a=nU(s,n,r),l=(n-a.x)/e.width,c=(r-a.y)/e.height,u=Math.min(l,c),f=Xi(u,o,i),d=e.x+e.width/2,h=e.y+e.height/2,g=n/2-d*f,v=r/2-h*f,b=rU(e,g,v,f,n,r),_={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:g-_.left+_.right,y:v-_.top+_.bottom,zoom:f}},$a=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function qi(e){return e!=null&&e!=="parent"}function dr(e){var n,r;return{width:((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}}function KN(e){var n,r;return(((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth)!==void 0&&(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight)!==void 0}function qN(e,n={width:0,height:0},r,o,i){const s={...e},a=o.get(r);if(a){const l=a.origin||i;s.x+=a.internals.positionAbsolute.x-(n.width??0)*l[0],s.y+=a.internals.positionAbsolute.y-(n.height??0)*l[1]}return s}function Vx(e,n){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}function oU(){let e,n;return{promise:new Promise((o,i)=>{e=o,n=i}),resolve:e,reject:n}}function iU(e){return{...BN,...e||{}}}function oa(e,{snapGrid:n=[0,0],snapToGrid:r=!1,transform:o,containerBounds:i}){const{x:s,y:a}=dn(e),l=ll({x:s-((i==null?void 0:i.left)??0),y:a-((i==null?void 0:i.top)??0)},o),{x:c,y:u}=r?al(l,n):l;return{xSnapped:c,ySnapped:u,...l}}const i0=e=>({width:e.offsetWidth,height:e.offsetHeight}),QN=e=>{var n;return((n=e==null?void 0:e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},sU=["INPUT","SELECT","TEXTAREA"];function ZN(e){var o,i;const n=((i=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:i[0])||e.target;return(n==null?void 0:n.nodeType)!==1?!1:sU.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const JN=e=>"clientX"in e,dn=(e,n)=>{var s,a;const r=JN(e),o=r?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,i=r?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:o-((n==null?void 0:n.left)??0),y:i-((n==null?void 0:n.top)??0)}},Wx=(e,n,r,o,i)=>{const s=n.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-r.left)/o,y:(l.top-r.top)/o,...i0(a)}})};function eE({sourceX:e,sourceY:n,targetX:r,targetY:o,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:l}){const c=e*.125+i*.375+a*.375+r*.125,u=n*.125+s*.375+l*.375+o*.125,f=Math.abs(c-e),d=Math.abs(u-n);return[c,u,f,d]}function rc(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function Gx({pos:e,x1:n,y1:r,x2:o,y2:i,c:s}){switch(e){case ce.Left:return[n-rc(n-o,s),r];case ce.Right:return[n+rc(o-n,s),r];case ce.Top:return[n,r-rc(r-i,s)];case ce.Bottom:return[n,r+rc(i-r,s)]}}function tE({sourceX:e,sourceY:n,sourcePosition:r=ce.Bottom,targetX:o,targetY:i,targetPosition:s=ce.Top,curvature:a=.25}){const[l,c]=Gx({pos:r,x1:e,y1:n,x2:o,y2:i,c:a}),[u,f]=Gx({pos:s,x1:o,y1:i,x2:e,y2:n,c:a}),[d,h,g,v]=eE({sourceX:e,sourceY:n,targetX:o,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:f});return[`M${e},${n} C${l},${c} ${u},${f} ${o},${i}`,d,h,g,v]}function nE({sourceX:e,sourceY:n,targetX:r,targetY:o}){const i=Math.abs(r-e)/2,s=r<e?r+i:r-i,a=Math.abs(o-n)/2,l=o<n?o+a:o-a;return[s,l,i,a]}function aU({sourceNode:e,targetNode:n,selected:r=!1,zIndex:o=0,elevateOnSelect:i=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const a=i&&r?o+1e3:o,l=Math.max(e.parentId||i&&e.selected?e.internals.z:0,n.parentId||i&&n.selected?n.internals.z:0);return a+l}function lU({sourceNode:e,targetNode:n,width:r,height:o,transform:i}){const s=Bd($u(e),$u(n));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const a={x:-i[0]/i[2],y:-i[1]/i[2],width:r/i[2],height:o/i[2]};return Oa(a,Hd(s))>0}const cU=({source:e,sourceHandle:n,target:r,targetHandle:o})=>`xy-edge__${e}${n||""}-${r}${o||""}`,uU=(e,n)=>n.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),dU=(e,n,r={})=>{if(!e.source||!e.target)return n;const o=r.getEdgeId||cU;let i;return VN(e)?i={...e}:i={...e,id:o(e)},uU(i,n)?n:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,n.concat(i))};function rE({sourceX:e,sourceY:n,targetX:r,targetY:o}){const[i,s,a,l]=nE({sourceX:e,sourceY:n,targetX:r,targetY:o});return[`M ${e},${n}L ${r},${o}`,i,s,a,l]}const Yx={[ce.Left]:{x:-1,y:0},[ce.Right]:{x:1,y:0},[ce.Top]:{x:0,y:-1},[ce.Bottom]:{x:0,y:1}},fU=({source:e,sourcePosition:n=ce.Bottom,target:r})=>n===ce.Left||n===ce.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},Xx=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function hU({source:e,sourcePosition:n=ce.Bottom,target:r,targetPosition:o=ce.Top,center:i,offset:s,stepPosition:a}){const l=Yx[n],c=Yx[o],u={x:e.x+l.x*s,y:e.y+l.y*s},f={x:r.x+c.x*s,y:r.y+c.y*s},d=fU({source:u,sourcePosition:n,target:f}),h=d.x!==0?"x":"y",g=d[h];let v=[],b,_;const m={x:0,y:0},w={x:0,y:0},[,,y,S]=nE({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(l[h]*c[h]===-1){h==="x"?(b=i.x??u.x+(f.x-u.x)*a,_=i.y??(u.y+f.y)/2):(b=i.x??(u.x+f.x)/2,_=i.y??u.y+(f.y-u.y)*a);const E=[{x:b,y:u.y},{x:b,y:f.y}],j=[{x:u.x,y:_},{x:f.x,y:_}];l[h]===g?v=h==="x"?E:j:v=h==="x"?j:E}else{const E=[{x:u.x,y:f.y}],j=[{x:f.x,y:u.y}];if(h==="x"?v=l.x===g?j:E:v=l.y===g?E:j,n===o){const P=Math.abs(e[h]-r[h]);if(P<=s){const L=Math.min(s-1,s-P);l[h]===g?m[h]=(u[h]>e[h]?-1:1)*L:w[h]=(f[h]>r[h]?-1:1)*L}}if(n!==o){const P=h==="x"?"y":"x",L=l[h]===c[P],I=u[P]>f[P],z=u[P]<f[P];(l[h]===1&&(!L&&I||L&&z)||l[h]!==1&&(!L&&z||L&&I))&&(v=h==="x"?E:j)}const A={x:u.x+m.x,y:u.y+m.y},T={x:f.x+w.x,y:f.y+w.y},D=Math.max(Math.abs(A.x-v[0].x),Math.abs(T.x-v[0].x)),F=Math.max(Math.abs(A.y-v[0].y),Math.abs(T.y-v[0].y));D>=F?(b=(A.x+T.x)/2,_=v[0].y):(b=v[0].x,_=(A.y+T.y)/2)}const k={x:u.x+m.x,y:u.y+m.y},C={x:f.x+w.x,y:f.y+w.y};return[[e,...k.x!==v[0].x||k.y!==v[0].y?[k]:[],...v,...C.x!==v[v.length-1].x||C.y!==v[v.length-1].y?[C]:[],r],b,_,y,S]}function pU(e,n,r,o){const i=Math.min(Xx(e,n)/2,Xx(n,r)/2,o),{x:s,y:a}=n;if(e.x===s&&s===r.x||e.y===a&&a===r.y)return`L${s} ${a}`;if(e.y===a){const u=e.x<r.x?-1:1,f=e.y<r.y?1:-1;return`L ${s+i*u},${a}Q ${s},${a} ${s},${a+i*f}`}const l=e.x<r.x?1:-1,c=e.y<r.y?-1:1;return`L ${s},${a+i*c}Q ${s},${a} ${s+i*l},${a}`}function Bp({sourceX:e,sourceY:n,sourcePosition:r=ce.Bottom,targetX:o,targetY:i,targetPosition:s=ce.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:f=.5}){const[d,h,g,v,b]=hU({source:{x:e,y:n},sourcePosition:r,target:{x:o,y:i},targetPosition:s,center:{x:l,y:c},offset:u,stepPosition:f});let _=`M${d[0].x} ${d[0].y}`;for(let m=1;m<d.length-1;m++)_+=pU(d[m-1],d[m],d[m+1],a);return _+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[_,h,g,v,b]}function Kx(e){var n;return e&&!!(e.internals.handleBounds||(n=e.handles)!=null&&n.length)&&!!(e.measured.width||e.width||e.initialWidth)}function mU(e){var d;const{sourceNode:n,targetNode:r}=e;if(!Kx(n)||!Kx(r))return null;const o=n.internals.handleBounds||qx(n.handles),i=r.internals.handleBounds||qx(r.handles),s=Qx((o==null?void 0:o.source)??[],e.sourceHandle),a=Qx(e.connectionMode===Yi.Strict?(i==null?void 0:i.target)??[]:((i==null?void 0:i.target)??[]).concat((i==null?void 0:i.source)??[]),e.targetHandle);if(!s||!a)return(d=e.onError)==null||d.call(e,"008",In.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(s==null?void 0:s.position)||ce.Bottom,c=(a==null?void 0:a.position)||ce.Top,u=Fo(n,s,l),f=Fo(r,a,c);return{sourceX:u.x,sourceY:u.y,targetX:f.x,targetY:f.y,sourcePosition:l,targetPosition:c}}function qx(e){if(!e)return null;const n=[],r=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?n.push(o):o.type==="target"&&r.push(o);return{source:n,target:r}}function Fo(e,n,r=ce.Left,o=!1){const i=((n==null?void 0:n.x)??0)+e.internals.positionAbsolute.x,s=((n==null?void 0:n.y)??0)+e.internals.positionAbsolute.y,{width:a,height:l}=n??dr(e);if(o)return{x:i+a/2,y:s+l/2};switch((n==null?void 0:n.position)??r){case ce.Top:return{x:i+a/2,y:s};case ce.Right:return{x:i+a,y:s+l/2};case ce.Bottom:return{x:i+a/2,y:s+l};case ce.Left:return{x:i,y:s+l/2}}}function Qx(e,n){return e&&(n?e.find(r=>r.id===n):e[0])||null}function Hp(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function gU(e,{id:n,defaultColor:r,defaultMarkerStart:o,defaultMarkerEnd:i}){const s=new Set;return e.reduce((a,l)=>([l.markerStart||o,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const u=Hp(c,n);s.has(u)||(a.push({id:u,color:c.color||r,...c}),s.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const oE=1e3,vU=10,s0={nodeOrigin:[0,0],nodeExtent:Ta,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},yU={...s0,checkEquality:!0};function a0(e,n){const r={...e};for(const o in n)n[o]!==void 0&&(r[o]=n[o]);return r}function xU(e,n,r){const o=a0(s0,r);for(const i of e.values())if(i.parentId)c0(i,e,n,o);else{const s=il(i,o.nodeOrigin),a=qi(i.extent)?i.extent:o.nodeExtent,l=zo(s,a,dr(i));i.internals.positionAbsolute=l}}function wU(e,n){if(!e.handles)return e.measured?n==null?void 0:n.internals.handleBounds:void 0;const r=[],o=[];for(const i of e.handles){const s={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?r.push(s):i.type==="target"&&o.push(s)}return{source:r,target:o}}function l0(e){return e==="manual"}function Up(e,n,r,o={}){var f,d;const i=a0(yU,o),s={i:0},a=new Map(n),l=i!=null&&i.elevateNodesOnSelect&&!l0(i.zIndexMode)?oE:0;let c=e.length>0,u=!1;n.clear(),r.clear();for(const h of e){let g=a.get(h.id);if(i.checkEquality&&h===(g==null?void 0:g.internals.userNode))n.set(h.id,g);else{const v=il(h,i.nodeOrigin),b=qi(h.extent)?h.extent:i.nodeExtent,_=zo(v,b,dr(h));g={...i.defaults,...h,measured:{width:(f=h.measured)==null?void 0:f.width,height:(d=h.measured)==null?void 0:d.height},internals:{positionAbsolute:_,handleBounds:wU(h,g),z:iE(h,l,i.zIndexMode),userNode:h}},n.set(h.id,g)}(g.measured===void 0||g.measured.width===void 0||g.measured.height===void 0)&&!g.hidden&&(c=!1),h.parentId&&c0(g,n,r,o,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function bU(e,n){if(!e.parentId)return;const r=n.get(e.parentId);r?r.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function c0(e,n,r,o,i){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=a0(s0,o),u=e.parentId,f=n.get(u);if(!f){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bU(e,r),i&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++i.i,f.internals.z=f.internals.z+i.i*vU),i&&f.internals.rootParentIndex!==void 0&&(i.i=f.internals.rootParentIndex);const d=s&&!l0(c)?oE:0,{x:h,y:g,z:v}=_U(e,f,a,l,d,c),{positionAbsolute:b}=e.internals,_=h!==b.x||g!==b.y;(_||v!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:h,y:g}:b,z:v}})}function iE(e,n,r){const o=un(e.zIndex)?e.zIndex:0;return l0(r)?o:o+(e.selected?n:0)}function _U(e,n,r,o,i,s){const{x:a,y:l}=n.internals.positionAbsolute,c=dr(e),u=il(e,r),f=qi(e.extent)?zo(u,e.extent,c):u;let d=zo({x:a+f.x,y:l+f.y},o,c);e.extent==="parent"&&(d=GN(d,c,n));const h=iE(e,i,s),g=n.internals.z??0;return{x:d.x,y:d.y,z:g>=h?g+1:h}}function u0(e,n,r,o=[0,0]){var a;const i=[],s=new Map;for(const l of e){const c=n.get(l.parentId);if(!c)continue;const u=((a=s.get(l.parentId))==null?void 0:a.expandedRect)??Ki(c),f=XN(u,l.rect);s.set(l.parentId,{expandedRect:f,parent:c})}return s.size>0&&s.forEach(({expandedRect:l,parent:c},u)=>{var y;const f=c.internals.positionAbsolute,d=dr(c),h=c.origin??o,g=l.x<f.x?Math.round(Math.abs(f.x-l.x)):0,v=l.y<f.y?Math.round(Math.abs(f.y-l.y)):0,b=Math.max(d.width,Math.round(l.width)),_=Math.max(d.height,Math.round(l.height)),m=(b-d.width)*h[0],w=(_-d.height)*h[1];(g>0||v>0||m||w)&&(i.push({id:u,type:"position",position:{x:c.position.x-g+m,y:c.position.y-v+w}}),(y=r.get(u))==null||y.forEach(S=>{e.some(k=>k.id===S.id)||i.push({id:S.id,type:"position",position:{x:S.position.x+g,y:S.position.y+v}})})),(d.width<l.width||d.height<l.height||g||v)&&i.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:b+(g?h[0]*g-m:0),height:_+(v?h[1]*v-w:0)}})}),i}function SU(e,n,r,o,i,s,a){const l=o==null?void 0:o.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const u=[],f=window.getComputedStyle(l),{m22:d}=new window.DOMMatrixReadOnly(f.transform),h=[];for(const g of e.values()){const v=n.get(g.id);if(!v)continue;if(v.hidden){n.set(v.id,{...v,internals:{...v.internals,handleBounds:void 0}}),c=!0;continue}const b=i0(g.nodeElement),_=v.measured.width!==b.width||v.measured.height!==b.height;if(!!(b.width&&b.height&&(_||!v.internals.handleBounds||g.force))){const w=g.nodeElement.getBoundingClientRect(),y=qi(v.extent)?v.extent:s;let{positionAbsolute:S}=v.internals;v.parentId&&v.extent==="parent"?S=GN(S,b,n.get(v.parentId)):y&&(S=zo(S,y,b));const k={...v,measured:b,internals:{...v.internals,positionAbsolute:S,handleBounds:{source:Wx("source",g.nodeElement,w,d,v.id),target:Wx("target",g.nodeElement,w,d,v.id)}}};n.set(v.id,k),v.parentId&&c0(k,n,r,{nodeOrigin:i,zIndexMode:a}),c=!0,_&&(u.push({id:v.id,type:"dimensions",dimensions:b}),v.expandParent&&v.parentId&&h.push({id:v.id,parentId:v.parentId,rect:Ki(k,i)}))}}if(h.length>0){const g=u0(h,n,r,i);u.push(...g)}return{changes:u,updatedInternals:c}}async function kU({delta:e,panZoom:n,transform:r,translateExtent:o,width:i,height:s}){if(!n||!e.x&&!e.y)return Promise.resolve(!1);const a=await n.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[i,s]],o),l=!!a&&(a.x!==r[0]||a.y!==r[1]||a.k!==r[2]);return Promise.resolve(l)}function Zx(e,n,r,o,i,s){let a=i;const l=o.get(a)||new Map;o.set(a,l.set(r,n)),a=`${i}-${e}`;const c=o.get(a)||new Map;if(o.set(a,c.set(r,n)),s){a=`${i}-${e}-${s}`;const u=o.get(a)||new Map;o.set(a,u.set(r,n))}}function sE(e,n,r){e.clear(),n.clear();for(const o of r){const{source:i,target:s,sourceHandle:a=null,targetHandle:l=null}=o,c={edgeId:o.id,source:i,target:s,sourceHandle:a,targetHandle:l},u=`${i}-${a}--${s}-${l}`,f=`${s}-${l}--${i}-${a}`;Zx("source",c,f,e,i,a),Zx("target",c,u,e,s,l),n.set(o.id,o)}}function aE(e,n){if(!e.parentId)return!1;const r=n.get(e.parentId);return r?r.selected?!0:aE(r,n):!1}function Jx(e,n,r){var i;let o=e;do{if((i=o==null?void 0:o.matches)!=null&&i.call(o,n))return!0;if(o===r)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function CU(e,n,r,o){const i=new Map;for(const[s,a]of e)if((a.selected||a.id===o)&&(!a.parentId||!aE(a,e))&&(a.draggable||n&&typeof a.draggable>"u")){const l=e.get(s);l&&i.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:r.x-l.internals.positionAbsolute.x,y:r.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}function Jf({nodeId:e,dragItems:n,nodeLookup:r,dragging:o=!0}){var a,l,c;const i=[];for(const[u,f]of n){const d=(a=r.get(u))==null?void 0:a.internals.userNode;d&&i.push({...d,position:f.position,dragging:o})}if(!e)return[i[0],i];const s=(l=r.get(e))==null?void 0:l.internals.userNode;return[s?{...s,position:((c=n.get(e))==null?void 0:c.position)||s.position,dragging:o}:i[0],i]}function NU({dragItems:e,snapGrid:n,x:r,y:o}){const i=e.values().next().value;if(!i)return null;const s={x:r-i.distance.x,y:o-i.distance.y},a=al(s,n);return{x:a.x-s.x,y:a.y-s.y}}function EU({onNodeMouseDown:e,getStoreItems:n,onDragStart:r,onDrag:o,onDragStop:i}){let s={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},f=null,d=!1,h=null,g=!1,v=!1,b=null;function _({noDragClassName:w,handleSelector:y,domNode:S,isSelectable:k,nodeId:C,nodeClickDistance:N=0}){h=at(S);function E({x:D,y:F}){const{nodeLookup:P,nodeExtent:L,snapGrid:I,snapToGrid:z,nodeOrigin:R,onNodeDrag:M,onSelectionDrag:O,onError:V,updateNodePositions:$}=n();s={x:D,y:F};let K=!1;const B=l.size>1,U=B&&L?Fp(sl(l)):null,G=B&&z?NU({dragItems:l,snapGrid:I,x:D,y:F}):null;for(const[W,X]of l){if(!P.has(W))continue;let q={x:D-X.distance.x,y:F-X.distance.y};z&&(q=G?{x:Math.round(q.x+G.x),y:Math.round(q.y+G.y)}:al(q,I));let te=null;if(B&&L&&!X.extent&&U){const{positionAbsolute:ne}=X.internals,ue=ne.x-U.x+L[0][0],ye=ne.x+X.measured.width-U.x2+L[1][0],pe=ne.y-U.y+L[0][1],ke=ne.y+X.measured.height-U.y2+L[1][1];te=[[ue,pe],[ye,ke]]}const{position:ee,positionAbsolute:Q}=WN({nodeId:W,nextPosition:q,nodeLookup:P,nodeExtent:te||L,nodeOrigin:R,onError:V});K=K||X.position.x!==ee.x||X.position.y!==ee.y,X.position=ee,X.internals.positionAbsolute=Q}if(v=v||K,!!K&&($(l,!0),b&&(o||M||!C&&O))){const[W,X]=Jf({nodeId:C,dragItems:l,nodeLookup:P});o==null||o(b,l,W,X),M==null||M(b,W,X),C||O==null||O(b,X)}}async function j(){if(!f)return;const{transform:D,panBy:F,autoPanSpeed:P,autoPanOnNodeDrag:L}=n();if(!L){c=!1,cancelAnimationFrame(a);return}const[I,z]=YN(u,f,P);(I!==0||z!==0)&&(s.x=(s.x??0)-I/D[2],s.y=(s.y??0)-z/D[2],await F({x:I,y:z})&&E(s)),a=requestAnimationFrame(j)}function A(D){var B;const{nodeLookup:F,multiSelectionActive:P,nodesDraggable:L,transform:I,snapGrid:z,snapToGrid:R,selectNodesOnDrag:M,onNodeDragStart:O,onSelectionDragStart:V,unselectNodesAndEdges:$}=n();d=!0,(!M||!k)&&!P&&C&&((B=F.get(C))!=null&&B.selected||$()),k&&M&&C&&(e==null||e(C));const K=oa(D.sourceEvent,{transform:I,snapGrid:z,snapToGrid:R,containerBounds:f});if(s=K,l=CU(F,L,K,C),l.size>0&&(r||O||!C&&V)){const[U,G]=Jf({nodeId:C,dragItems:l,nodeLookup:F});r==null||r(D.sourceEvent,l,U,G),O==null||O(D.sourceEvent,U,G),C||V==null||V(D.sourceEvent,G)}}const T=Dg().clickDistance(N).on("start",D=>{const{domNode:F,nodeDragThreshold:P,transform:L,snapGrid:I,snapToGrid:z}=n();f=(F==null?void 0:F.getBoundingClientRect())||null,g=!1,v=!1,b=D.sourceEvent,P===0&&A(D),s=oa(D.sourceEvent,{transform:L,snapGrid:I,snapToGrid:z,containerBounds:f}),u=dn(D.sourceEvent,f)}).on("drag",D=>{const{autoPanOnNodeDrag:F,transform:P,snapGrid:L,snapToGrid:I,nodeDragThreshold:z,nodeLookup:R}=n(),M=oa(D.sourceEvent,{transform:P,snapGrid:L,snapToGrid:I,containerBounds:f});if(b=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||C&&!R.has(C))&&(g=!0),!g){if(!c&&F&&d&&(c=!0,j()),!d){const O=dn(D.sourceEvent,f),V=O.x-u.x,$=O.y-u.y;Math.sqrt(V*V+$*$)>z&&A(D)}(s.x!==M.xSnapped||s.y!==M.ySnapped)&&l&&d&&(u=dn(D.sourceEvent,f),E(M))}}).on("end",D=>{if(!(!d||g)&&(c=!1,d=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:F,updateNodePositions:P,onNodeDragStop:L,onSelectionDragStop:I}=n();if(v&&(P(l,!1),v=!1),i||L||!C&&I){const[z,R]=Jf({nodeId:C,dragItems:l,nodeLookup:F,dragging:!1});i==null||i(D.sourceEvent,l,z,R),L==null||L(D.sourceEvent,z,R),C||I==null||I(D.sourceEvent,R)}}}).filter(D=>{const F=D.target;return!D.button&&(!w||!Jx(F,`.${w}`,S))&&(!y||Jx(F,y,S))});h.call(T)}function m(){h==null||h.on(".drag",null)}return{update:_,destroy:m}}function jU(e,n,r){const o=[],i={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const s of n.values())Oa(i,Ki(s))>0&&o.push(s);return o}const PU=250;function MU(e,n,r,o){var l,c;let i=[],s=1/0;const a=jU(e,r,n+PU);for(const u of a){const f=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of f){if(o.nodeId===d.nodeId&&o.type===d.type&&o.id===d.id)continue;const{x:h,y:g}=Fo(u,d,d.position,!0),v=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(g-e.y,2));v>n||(v<s?(i=[{...d,x:h,y:g}],s=v):v===s&&i.push({...d,x:h,y:g}))}}if(!i.length)return null;if(i.length>1){const u=o.type==="source"?"target":"source";return i.find(f=>f.type===u)??i[0]}return i[0]}function lE(e,n,r,o,i,s=!1){var u,f,d;const a=o.get(e);if(!a)return null;const l=i==="strict"?(u=a.internals.handleBounds)==null?void 0:u[n]:[...((f=a.internals.handleBounds)==null?void 0:f.source)??[],...((d=a.internals.handleBounds)==null?void 0:d.target)??[]],c=(r?l==null?void 0:l.find(h=>h.id===r):l==null?void 0:l[0])??null;return c&&s?{...c,...Fo(a,c,c.position,!0)}:c}function cE(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function RU(e,n){let r=null;return n?r=!0:e&&!n&&(r=!1),r}const uE=()=>!0;function AU(e,{connectionMode:n,connectionRadius:r,handleId:o,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:f,flowId:d,panBy:h,cancelConnection:g,onConnectStart:v,onConnect:b,onConnectEnd:_,isValidConnection:m=uE,onReconnectEnd:w,updateConnection:y,getTransform:S,getFromHandle:k,autoPanSpeed:C,dragThreshold:N=1,handleDomNode:E}){const j=QN(e.target);let A=0,T;const{x:D,y:F}=dn(e),P=cE(s,E),L=l==null?void 0:l.getBoundingClientRect();let I=!1;if(!L||!P)return;const z=lE(i,P,o,c,n);if(!z)return;let R=dn(e,L),M=!1,O=null,V=!1,$=null;function K(){if(!f||!L)return;const[ee,Q]=YN(R,L,C);h({x:ee,y:Q}),A=requestAnimationFrame(K)}const B={...z,nodeId:i,type:P,position:z.position},U=c.get(i);let W={inProgress:!0,isValid:null,from:Fo(U,B,ce.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:U,to:R,toHandle:null,toPosition:Bx[B.position],toNode:null,pointer:R};function X(){I=!0,y(W),v==null||v(e,{nodeId:i,handleId:o,handleType:P})}N===0&&X();function q(ee){if(!I){const{x:ke,y:tt}=dn(ee),Xe=ke-D,Zt=tt-F;if(!(Xe*Xe+Zt*Zt>N*N))return;X()}if(!k()||!B){te(ee);return}const Q=S();R=dn(ee,L),T=MU(ll(R,Q,!1,[1,1]),r,c,B),M||(K(),M=!0);const ne=dE(ee,{handle:T,connectionMode:n,fromNodeId:i,fromHandleId:o,fromType:a?"target":"source",isValidConnection:m,doc:j,lib:u,flowId:d,nodeLookup:c});$=ne.handleDomNode,O=ne.connection,V=RU(!!T,ne.isValid);const ue=c.get(i),ye=ue?Fo(ue,B,ce.Left,!0):W.from,pe={...W,from:ye,isValid:V,to:ne.toHandle&&V?Du({x:ne.toHandle.x,y:ne.toHandle.y},Q):R,toHandle:ne.toHandle,toPosition:V&&ne.toHandle?ne.toHandle.position:Bx[B.position],toNode:ne.toHandle?c.get(ne.toHandle.nodeId):null,pointer:R};y(pe),W=pe}function te(ee){if(!("touches"in ee&&ee.touches.length>0)){if(I){(T||$)&&O&&V&&(b==null||b(O));const{inProgress:Q,...ne}=W,ue={...ne,toPosition:W.toHandle?W.toPosition:null};_==null||_(ee,ue),s&&(w==null||w(ee,ue))}g(),cancelAnimationFrame(A),M=!1,V=!1,O=null,$=null,j.removeEventListener("mousemove",q),j.removeEventListener("mouseup",te),j.removeEventListener("touchmove",q),j.removeEventListener("touchend",te)}}j.addEventListener("mousemove",q),j.addEventListener("mouseup",te),j.addEventListener("touchmove",q),j.addEventListener("touchend",te)}function dE(e,{handle:n,connectionMode:r,fromNodeId:o,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=uE,nodeLookup:f}){const d=s==="target",h=n?a.querySelector(`.${l}-flow__handle[data-id="${c}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:g,y:v}=dn(e),b=a.elementFromPoint(g,v),_=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:h,m={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const w=cE(void 0,_),y=_.getAttribute("data-nodeid"),S=_.getAttribute("data-handleid"),k=_.classList.contains("connectable"),C=_.classList.contains("connectableend");if(!y||!w)return m;const N={source:d?y:o,sourceHandle:d?S:i,target:d?o:y,targetHandle:d?i:S};m.connection=N;const j=k&&C&&(r===Yi.Strict?d&&w==="source"||!d&&w==="target":y!==o||S!==i);m.isValid=j&&u(N),m.toHandle=lE(y,w,S,f,r,!0)}return m}const Vp={onPointerDown:AU,isValid:dE};function TU({domNode:e,panZoom:n,getTransform:r,getViewScale:o}){const i=at(e);function s({translateExtent:l,width:c,height:u,zoomStep:f=1,pannable:d=!0,zoomable:h=!0,inversePan:g=!1}){const v=y=>{if(y.sourceEvent.type!=="wheel"||!n)return;const S=r(),k=y.sourceEvent.ctrlKey&&$a()?10:1,C=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*f,N=S[2]*Math.pow(2,C*k);n.scaleTo(N)};let b=[0,0];const _=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(b=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},m=y=>{const S=r();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!n)return;const k=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],C=[k[0]-b[0],k[1]-b[1]];b=k;const N=o()*Math.max(S[2],Math.log(S[2]))*(g?-1:1),E={x:S[0]-C[0]*N,y:S[1]-C[1]*N},j=[[0,0],[c,u]];n.setViewportConstrained({x:E.x,y:E.y,zoom:S[2]},j,l)},w=Vg().on("start",_).on("zoom",d?m:null).on("zoom.wheel",h?v:null);i.call(w,{})}function a(){i.on("zoom",null)}return{update:s,destroy:a,pointer:Ht}}const Ud=e=>({x:e.x,y:e.y,zoom:e.k}),eh=({x:e,y:n,zoom:r})=>$d.translate(e,n).scale(r),xi=(e,n)=>e.target.closest(`.${n}`),fE=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),IU=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,th=(e,n=0,r=IU,o=()=>{})=>{const i=typeof n=="number"&&n>0;return i||o(),i?e.transition().duration(n).ease(r).on("end",o):e},hE=e=>{const n=e.ctrlKey&&$a()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function OU({zoomPanValues:e,noWheelClassName:n,d3Selection:r,d3Zoom:o,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return f=>{if(xi(f,n))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const d=r.property("__zoom").k||1;if(f.ctrlKey&&a){const _=Ht(f),m=hE(f),w=d*Math.pow(2,m);o.scaleTo(r,w,_,f);return}const h=f.deltaMode===1?20:1;let g=i===No.Vertical?0:f.deltaX*h,v=i===No.Horizontal?0:f.deltaY*h;!$a()&&f.shiftKey&&i!==No.Vertical&&(g=f.deltaY*h,v=0),o.translateBy(r,-(g/d)*s,-(v/d)*s,{internal:!0});const b=Ud(r.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(f,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(f,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(f,b))}}function $U({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:r}){return function(o,i){const s=o.type==="wheel",a=!n&&s&&!o.ctrlKey,l=xi(o,e);if(o.ctrlKey&&s&&l&&o.preventDefault(),a||l)return null;o.preventDefault(),r.call(this,o,i)}}function DU({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:r}){return o=>{var s,a,l;if((s=o.sourceEvent)!=null&&s.internal)return;const i=Ud(o.transform);e.mouseButton=((a=o.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((l=o.sourceEvent)==null?void 0:l.type)==="mousedown"&&n(!0),r&&(r==null||r(o.sourceEvent,i))}}function LU({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:r,onTransformChange:o,onPanZoom:i}){return s=>{var a,l;e.usedRightMouseButton=!!(r&&fE(n,e.mouseButton??0)),(a=s.sourceEvent)!=null&&a.sync||o([s.transform.x,s.transform.y,s.transform.k]),i&&!((l=s.sourceEvent)!=null&&l.internal)&&(i==null||i(s.sourceEvent,Ud(s.transform)))}}function zU({zoomPanValues:e,panOnDrag:n,panOnScroll:r,onDraggingChange:o,onPanZoomEnd:i,onPaneContextMenu:s}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,s&&fE(n,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,o(!1),i)){const c=Ud(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(a.sourceEvent,c)},r?150:0)}}}function FU({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:o,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:f}){return d=>{var _;const h=e||n,g=r&&d.ctrlKey,v=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(xi(d,`${u}-flow__node`)||xi(d,`${u}-flow__edge`)))return!0;if(!o&&!h&&!i&&!s&&!r||a||f&&!v||xi(d,l)&&v||xi(d,c)&&(!v||i&&v&&!e)||!r&&d.ctrlKey&&v)return!1;if(!r&&d.type==="touchstart"&&((_=d.touches)==null?void 0:_.length)>1)return d.preventDefault(),!1;if(!h&&!i&&!g&&v||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const b=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||v)&&b}}function BU({domNode:e,minZoom:n,maxZoom:r,translateExtent:o,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),d=Vg().scaleExtent([n,r]).translateExtent(o),h=at(e).call(d);w({x:i.x,y:i.y,zoom:Xi(i.zoom,n,r)},[[0,0],[f.width,f.height]],o);const g=h.on("wheel.zoom"),v=h.on("dblclick.zoom");d.wheelDelta(hE);function b(T,D){return h?new Promise(F=>{d==null||d.interpolate((D==null?void 0:D.interpolate)==="linear"?Js:Pc).transform(th(h,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>F(!0)),T)}):Promise.resolve(!1)}function _({noWheelClassName:T,noPanClassName:D,onPaneContextMenu:F,userSelectionActive:P,panOnScroll:L,panOnDrag:I,panOnScrollMode:z,panOnScrollSpeed:R,preventScrolling:M,zoomOnPinch:O,zoomOnScroll:V,zoomOnDoubleClick:$,zoomActivationKeyPressed:K,lib:B,onTransformChange:U,connectionInProgress:G,paneClickDistance:W,selectionOnDrag:X}){P&&!u.isZoomingOrPanning&&m();const q=L&&!K&&!P;d.clickDistance(X?1/0:!un(W)||W<0?0:W);const te=q?OU({zoomPanValues:u,noWheelClassName:T,d3Selection:h,d3Zoom:d,panOnScrollMode:z,panOnScrollSpeed:R,zoomOnPinch:O,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):$U({noWheelClassName:T,preventScrolling:M,d3ZoomHandler:g});if(h.on("wheel.zoom",te,{passive:!1}),!P){const Q=DU({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});d.on("start",Q);const ne=LU({zoomPanValues:u,panOnDrag:I,onPaneContextMenu:!!F,onPanZoom:s,onTransformChange:U});d.on("zoom",ne);const ue=zU({zoomPanValues:u,panOnDrag:I,panOnScroll:L,onPaneContextMenu:F,onPanZoomEnd:l,onDraggingChange:c});d.on("end",ue)}const ee=FU({zoomActivationKeyPressed:K,panOnDrag:I,zoomOnScroll:V,panOnScroll:L,zoomOnDoubleClick:$,zoomOnPinch:O,userSelectionActive:P,noPanClassName:D,noWheelClassName:T,lib:B,connectionInProgress:G});d.filter(ee),$?h.on("dblclick.zoom",v):h.on("dblclick.zoom",null)}function m(){d.on("zoom",null)}async function w(T,D,F){const P=eh(T),L=d==null?void 0:d.constrain()(P,D,F);return L&&await b(L),new Promise(I=>I(L))}async function y(T,D){const F=eh(T);return await b(F,D),new Promise(P=>P(F))}function S(T){if(h){const D=eh(T),F=h.property("__zoom");(F.k!==T.zoom||F.x!==T.x||F.y!==T.y)&&(d==null||d.transform(h,D,null,{sync:!0}))}}function k(){const T=h?on(h.node()):{x:0,y:0,k:1};return{x:T.x,y:T.y,zoom:T.k}}function C(T,D){return h?new Promise(F=>{d==null||d.interpolate((D==null?void 0:D.interpolate)==="linear"?Js:Pc).scaleTo(th(h,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>F(!0)),T)}):Promise.resolve(!1)}function N(T,D){return h?new Promise(F=>{d==null||d.interpolate((D==null?void 0:D.interpolate)==="linear"?Js:Pc).scaleBy(th(h,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>F(!0)),T)}):Promise.resolve(!1)}function E(T){d==null||d.scaleExtent(T)}function j(T){d==null||d.translateExtent(T)}function A(T){const D=!un(T)||T<0?0:T;d==null||d.clickDistance(D)}return{update:_,destroy:m,setViewport:y,setViewportConstrained:w,getViewport:k,scaleTo:C,scaleBy:N,setScaleExtent:E,setTranslateExtent:j,syncViewport:S,setClickDistance:A}}var Qi;(function(e){e.Line="line",e.Handle="handle"})(Qi||(Qi={}));function HU({width:e,prevWidth:n,height:r,prevHeight:o,affectsX:i,affectsY:s}){const a=e-n,l=r-o,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function e1(e){const n=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),o=e.includes("left"),i=e.includes("top");return{isHorizontal:n,isVertical:r,affectsX:o,affectsY:i}}function wr(e,n){return Math.max(0,n-e)}function br(e,n){return Math.max(0,e-n)}function oc(e,n,r){return Math.max(0,n-e,e-r)}function t1(e,n){return e?!n:n}function UU(e,n,r,o,i,s,a,l){let{affectsX:c,affectsY:u}=n;const{isHorizontal:f,isVertical:d}=n,h=f&&d,{xSnapped:g,ySnapped:v}=r,{minWidth:b,maxWidth:_,minHeight:m,maxHeight:w}=o,{x:y,y:S,width:k,height:C,aspectRatio:N}=e;let E=Math.floor(f?g-e.pointerX:0),j=Math.floor(d?v-e.pointerY:0);const A=k+(c?-E:E),T=C+(u?-j:j),D=-s[0]*k,F=-s[1]*C;let P=oc(A,b,_),L=oc(T,m,w);if(a){let R=0,M=0;c&&E<0?R=wr(y+E+D,a[0][0]):!c&&E>0&&(R=br(y+A+D,a[1][0])),u&&j<0?M=wr(S+j+F,a[0][1]):!u&&j>0&&(M=br(S+T+F,a[1][1])),P=Math.max(P,R),L=Math.max(L,M)}if(l){let R=0,M=0;c&&E>0?R=br(y+E,l[0][0]):!c&&E<0&&(R=wr(y+A,l[1][0])),u&&j>0?M=br(S+j,l[0][1]):!u&&j<0&&(M=wr(S+T,l[1][1])),P=Math.max(P,R),L=Math.max(L,M)}if(i){if(f){const R=oc(A/N,m,w)*N;if(P=Math.max(P,R),a){let M=0;!c&&!u||c&&!u&&h?M=br(S+F+A/N,a[1][1])*N:M=wr(S+F+(c?E:-E)/N,a[0][1])*N,P=Math.max(P,M)}if(l){let M=0;!c&&!u||c&&!u&&h?M=wr(S+A/N,l[1][1])*N:M=br(S+(c?E:-E)/N,l[0][1])*N,P=Math.max(P,M)}}if(d){const R=oc(T*N,b,_)/N;if(L=Math.max(L,R),a){let M=0;!c&&!u||u&&!c&&h?M=br(y+T*N+D,a[1][0])/N:M=wr(y+(u?j:-j)*N+D,a[0][0])/N,L=Math.max(L,M)}if(l){let M=0;!c&&!u||u&&!c&&h?M=wr(y+T*N,l[1][0])/N:M=br(y+(u?j:-j)*N,l[0][0])/N,L=Math.max(L,M)}}}j=j+(j<0?L:-L),E=E+(E<0?P:-P),i&&(h?A>T*N?j=(t1(c,u)?-E:E)/N:E=(t1(c,u)?-j:j)*N:f?(j=E/N,u=c):(E=j*N,c=u));const I=c?y+E:y,z=u?S+j:S;return{width:k+(c?-E:E),height:C+(u?-j:j),x:s[0]*E*(c?-1:1)+I,y:s[1]*j*(u?-1:1)+z}}const pE={width:0,height:0,x:0,y:0},VU={...pE,pointerX:0,pointerY:0,aspectRatio:1};function WU(e){return[[0,0],[e.measured.width,e.measured.height]]}function GU(e,n,r){const o=n.position.x+e.position.x,i=n.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,l=r[0]*s,c=r[1]*a;return[[o-l,i-c],[o+s-l,i+a-c]]}function YU({domNode:e,nodeId:n,getStoreItems:r,onChange:o,onEnd:i}){const s=at(e);let a={controlDirection:e1("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:f,keepAspectRatio:d,resizeDirection:h,onResizeStart:g,onResize:v,onResizeEnd:b,shouldResize:_}){let m={...pE},w={...VU};a={boundaries:f,resizeDirection:h,keepAspectRatio:d,controlDirection:e1(u)};let y,S=null,k=[],C,N,E,j=!1;const A=Dg().on("start",T=>{const{nodeLookup:D,transform:F,snapGrid:P,snapToGrid:L,nodeOrigin:I,paneDomNode:z}=r();if(y=D.get(n),!y)return;S=(z==null?void 0:z.getBoundingClientRect())??null;const{xSnapped:R,ySnapped:M}=oa(T.sourceEvent,{transform:F,snapGrid:P,snapToGrid:L,containerBounds:S});m={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},w={...m,pointerX:R,pointerY:M,aspectRatio:m.width/m.height},C=void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(C=D.get(y.parentId),N=C&&y.extent==="parent"?WU(C):void 0),k=[],E=void 0;for(const[O,V]of D)if(V.parentId===n&&(k.push({id:O,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const $=GU(V,y,V.origin??I);E?E=[[Math.min($[0][0],E[0][0]),Math.min($[0][1],E[0][1])],[Math.max($[1][0],E[1][0]),Math.max($[1][1],E[1][1])]]:E=$}g==null||g(T,{...m})}).on("drag",T=>{const{transform:D,snapGrid:F,snapToGrid:P,nodeOrigin:L}=r(),I=oa(T.sourceEvent,{transform:D,snapGrid:F,snapToGrid:P,containerBounds:S}),z=[];if(!y)return;const{x:R,y:M,width:O,height:V}=m,$={},K=y.origin??L,{width:B,height:U,x:G,y:W}=UU(w,a.controlDirection,I,a.boundaries,a.keepAspectRatio,K,N,E),X=B!==O,q=U!==V,te=G!==R&&X,ee=W!==M&&q;if(!te&&!ee&&!X&&!q)return;if((te||ee||K[0]===1||K[1]===1)&&($.x=te?G:m.x,$.y=ee?W:m.y,m.x=$.x,m.y=$.y,k.length>0)){const ye=G-R,pe=W-M;for(const ke of k)ke.position={x:ke.position.x-ye+K[0]*(B-O),y:ke.position.y-pe+K[1]*(U-V)},z.push(ke)}if((X||q)&&($.width=X&&(!a.resizeDirection||a.resizeDirection==="horizontal")?B:m.width,$.height=q&&(!a.resizeDirection||a.resizeDirection==="vertical")?U:m.height,m.width=$.width,m.height=$.height),C&&y.expandParent){const ye=K[0]*($.width??0);$.x&&$.x<ye&&(m.x=ye,w.x=w.x-($.x-ye));const pe=K[1]*($.height??0);$.y&&$.y<pe&&(m.y=pe,w.y=w.y-($.y-pe))}const Q=HU({width:m.width,prevWidth:O,height:m.height,prevHeight:V,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),ne={...m,direction:Q};(_==null?void 0:_(T,ne))!==!1&&(j=!0,v==null||v(T,ne),o($,z))}).on("end",T=>{j&&(b==null||b(T,{...m}),i==null||i({...m}),j=!1)});s.call(A)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}var mE={exports:{}},gE={};/**
|
|
425
430
|
* @license React
|
|
426
431
|
* use-sync-external-store-shim/with-selector.production.js
|
|
427
432
|
*
|
|
@@ -429,13 +434,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
429
434
|
*
|
|
430
435
|
* This source code is licensed under the MIT license found in the
|
|
431
436
|
* LICENSE file in the root directory of this source tree.
|
|
432
|
-
*/var Vd=x,
|
|
437
|
+
*/var Vd=x,XU=N_;function KU(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var qU=typeof Object.is=="function"?Object.is:KU,QU=XU.useSyncExternalStore,ZU=Vd.useRef,JU=Vd.useEffect,eV=Vd.useMemo,tV=Vd.useDebugValue;gE.useSyncExternalStoreWithSelector=function(e,n,r,o,i){var s=ZU(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=eV(function(){function c(g){if(!u){if(u=!0,f=g,g=o(g),i!==void 0&&a.hasValue){var v=a.value;if(i(v,g))return d=v}return d=g}if(v=d,qU(f,g))return v;var b=o(g);return i!==void 0&&i(v,b)?(f=g,v):(f=g,d=b)}var u=!1,f,d,h=r===void 0?null:r;return[function(){return c(n())},h===null?void 0:function(){return c(h())}]},[n,r,o,i]);var l=QU(e,s[0],s[1]);return JU(function(){a.hasValue=!0,a.value=l},[l]),tV(l),l};mE.exports=gE;var nV=mE.exports;const rV=Bu(nV),oV={},n1=e=>{let n;const r=new Set,o=(f,d)=>{const h=typeof f=="function"?f(n):f;if(!Object.is(h,n)){const g=n;n=d??(typeof h!="object"||h===null)?h:Object.assign({},n,h),r.forEach(v=>v(n,g))}},i=()=>n,c={setState:o,getState:i,getInitialState:()=>u,subscribe:f=>(r.add(f),()=>r.delete(f)),destroy:()=>{(oV?"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."),r.clear()}},u=n=e(o,i,c);return c},iV=e=>e?n1(e):n1,{useDebugValue:sV}=it,{useSyncExternalStoreWithSelector:aV}=rV,lV=e=>e;function vE(e,n=lV,r){const o=aV(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,r);return sV(o),o}const r1=(e,n)=>{const r=iV(e),o=(i,s=n)=>vE(r,i,s);return Object.assign(o,r),o},cV=(e,n)=>e?r1(e,n):r1;function Te(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[o,i]of e)if(!Object.is(i,n.get(o)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const o of e)if(!n.has(o))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(const o of r)if(!Object.prototype.hasOwnProperty.call(n,o)||!Object.is(e[o],n[o]))return!1;return!0}const Wd=x.createContext(null),uV=Wd.Provider,yE=In.error001();function we(e,n){const r=x.useContext(Wd);if(r===null)throw new Error(yE);return vE(r,e,n)}function Ie(){const e=x.useContext(Wd);if(e===null)throw new Error(yE);return x.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const o1={display:"none"},dV={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},xE="react-flow__node-desc",wE="react-flow__edge-desc",fV="react-flow__aria-live",hV=e=>e.ariaLiveMessage,pV=e=>e.ariaLabelConfig;function mV({rfId:e}){const n=we(hV);return p.jsx("div",{id:`${fV}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:dV,children:n})}function gV({rfId:e,disableKeyboardA11y:n}){const r=we(pV);return p.jsxs(p.Fragment,{children:[p.jsx("div",{id:`${xE}-${e}`,style:o1,children:n?r["node.a11yDescription.default"]:r["node.a11yDescription.keyboardDisabled"]}),p.jsx("div",{id:`${wE}-${e}`,style:o1,children:r["edge.a11yDescription.default"]}),!n&&p.jsx(mV,{rfId:e})]})}const Gd=x.forwardRef(({position:e="top-left",children:n,className:r,style:o,...i},s)=>{const a=`${e}`.split("-");return p.jsx("div",{className:Ue(["react-flow__panel",r,...a]),style:o,ref:s,...i,children:n})});Gd.displayName="Panel";function vV({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:p.jsx(Gd,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:p.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const yV=e=>{const n=[],r=[];for(const[,o]of e.nodeLookup)o.selected&&n.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&r.push(o);return{selectedNodes:n,selectedEdges:r}},ic=e=>e.id;function xV(e,n){return Te(e.selectedNodes.map(ic),n.selectedNodes.map(ic))&&Te(e.selectedEdges.map(ic),n.selectedEdges.map(ic))}function wV({onSelectionChange:e}){const n=Ie(),{selectedNodes:r,selectedEdges:o}=we(yV,xV);return x.useEffect(()=>{const i={nodes:r,edges:o};e==null||e(i),n.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[r,o,e]),null}const bV=e=>!!e.onSelectionChangeHandlers;function _V({onSelectionChange:e}){const n=we(bV);return e||n?p.jsx(wV,{onSelectionChange:e}):null}const Wp=typeof window<"u"?x.useLayoutEffect:x.useEffect,bE=[0,0],SV={x:0,y:0,zoom:1},kV=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],i1=[...kV,"rfId"],CV=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),s1={translateExtent:Ta,nodeOrigin:bE,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function NV(e){const{setNodes:n,setEdges:r,setMinZoom:o,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=we(CV,Te),u=Ie();Wp(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=s1,l()}),[]);const f=x.useRef(s1);return Wp(()=>{for(const d of i1){const h=e[d],g=f.current[d];h!==g&&(typeof e[d]>"u"||(d==="nodes"?n(h):d==="edges"?r(h):d==="minZoom"?o(h):d==="maxZoom"?i(h):d==="translateExtent"?s(h):d==="nodeExtent"?a(h):d==="ariaLabelConfig"?u.setState({ariaLabelConfig:iU(h)}):d==="fitView"?u.setState({fitViewQueued:h}):d==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[d]:h})))}f.current=e},i1.map(d=>e[d])),null}function a1(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function EV(e){var o;const[n,r]=x.useState(e==="system"?null:e);return x.useEffect(()=>{if(e!=="system"){r(e);return}const i=a1(),s=()=>r(i!=null&&i.matches?"dark":"light");return s(),i==null||i.addEventListener("change",s),()=>{i==null||i.removeEventListener("change",s)}},[e]),n!==null?n:(o=a1())!=null&&o.matches?"dark":"light"}const l1=typeof document<"u"?document:null;function Da(e=null,n={target:l1,actInsideInputWithModifier:!0}){const[r,o]=x.useState(!1),i=x.useRef(!1),s=x.useRef(new Set([])),[a,l]=x.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
|
|
433
438
|
`).replace(`
|
|
434
439
|
|
|
435
440
|
`,`
|
|
436
441
|
+`).split(`
|
|
437
|
-
`)),f=u.reduce((d,h)=>d.concat(...h),[]);return[u,f]}return[[],[]]},[e]);return x.useEffect(()=>{const c=(n==null?void 0:n.target)??l1,u=(n==null?void 0:n.actInsideInputWithModifier)??!0;if(e!==null){const f=g=>{var _,m;if(i.current=g.ctrlKey||g.metaKey||g.shiftKey||g.altKey,(!i.current||i.current&&!u)&&ZN(g))return!1;const b=u1(g.code,l);if(s.current.add(g[b]),c1(a,s.current,!1)){const w=((m=(_=g.composedPath)==null?void 0:_.call(g))==null?void 0:m[0])||g.target,y=(w==null?void 0:w.nodeName)==="BUTTON"||(w==null?void 0:w.nodeName)==="A";n.preventDefault!==!1&&(i.current||!y)&&g.preventDefault(),o(!0)}},d=g=>{const v=u1(g.code,l);c1(a,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(g[v]),g.key==="Meta"&&s.current.clear(),i.current=!1},h=()=>{s.current.clear(),o(!1)};return c==null||c.addEventListener("keydown",f),c==null||c.addEventListener("keyup",d),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",f),c==null||c.removeEventListener("keyup",d),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,o]),r}function c1(e,n,r){return e.filter(o=>r||o.length===n.size).some(o=>o.every(i=>n.has(i)))}function u1(e,n){return n.includes(e)?"code":"key"}const NV=()=>{const e=Ie();return x.useMemo(()=>({zoomIn:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1.2,n):Promise.resolve(!1)},zoomOut:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1/1.2,n):Promise.resolve(!1)},zoomTo:(n,r)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(n,r):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(n,r)=>{const{transform:[o,i,s],panZoom:a}=e.getState();return a?(await a.setViewport({x:n.x??o,y:n.y??i,zoom:n.zoom??s},r),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[n,r,o]=e.getState().transform;return{x:n,y:r,zoom:o}},setCenter:async(n,r,o)=>e.getState().setCenter(n,r,o),fitBounds:async(n,r)=>{const{width:o,height:i,minZoom:s,maxZoom:a,panZoom:l}=e.getState(),c=o0(n,o,i,s,a,(r==null?void 0:r.padding)??.1);return l?(await l.setViewport(c,{duration:r==null?void 0:r.duration,ease:r==null?void 0:r.ease,interpolate:r==null?void 0:r.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(n,r={})=>{const{transform:o,snapGrid:i,snapToGrid:s,domNode:a}=e.getState();if(!a)return n;const{x:l,y:c}=a.getBoundingClientRect(),u={x:n.x-l,y:n.y-c},f=r.snapGrid??i,d=r.snapToGrid??s;return ll(u,o,d,f)},flowToScreenPosition:n=>{const{transform:r,domNode:o}=e.getState();if(!o)return n;const{x:i,y:s}=o.getBoundingClientRect(),a=Du(n,r);return{x:a.x+i,y:a.y+s}}}),[])};function _E(e,n){const r=[],o=new Map,i=[];for(const s of e)if(s.type==="add"){i.push(s);continue}else if(s.type==="remove"||s.type==="replace")o.set(s.id,[s]);else{const a=o.get(s.id);a?a.push(s):o.set(s.id,[s])}for(const s of n){const a=o.get(s.id);if(!a){r.push(s);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){r.push({...a[0].item});continue}const l={...s};for(const c of a)EV(c,l);r.push(l)}return i.length&&i.forEach(s=>{s.index!==void 0?r.splice(s.index,0,{...s.item}):r.push({...s.item})}),r}function EV(e,n){switch(e.type){case"select":{n.selected=e.selected;break}case"position":{typeof e.position<"u"&&(n.position=e.position),typeof e.dragging<"u"&&(n.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(n.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(n.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(n.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(n.resizing=e.resizing);break}}}function jV(e,n){return _E(e,n)}function PV(e,n){return _E(e,n)}function go(e,n){return{id:e,type:"select",selected:n}}function wi(e,n=new Set,r=!1){const o=[];for(const[i,s]of e){const a=n.has(i);!(s.selected===void 0&&!a)&&s.selected!==a&&(r&&(s.selected=a),o.push(go(s.id,a)))}return o}function d1({items:e=[],lookup:n}){var i;const r=[],o=new Map(e.map(s=>[s.id,s]));for(const[s,a]of e.entries()){const l=n.get(a.id),c=((i=l==null?void 0:l.internals)==null?void 0:i.userNode)??l;c!==void 0&&c!==a&&r.push({id:a.id,item:a,type:"replace"}),c===void 0&&r.push({item:a,type:"add",index:s})}for(const[s]of n)o.get(s)===void 0&&r.push({id:s,type:"remove"});return r}function f1(e){return{id:e.id,type:"remove"}}const h1=e=>YH(e),MV=e=>VN(e);function SE(e){return x.forwardRef(e)}function p1(e){const[n,r]=x.useState(BigInt(0)),[o]=x.useState(()=>RV(()=>r(i=>i+BigInt(1))));return Wp(()=>{const i=o.get();i.length&&(e(i),o.reset())},[n]),o}function RV(e){let n=[];return{get:()=>n,reset:()=>{n=[]},push:r=>{n.push(r),e()}}}const kE=x.createContext(null);function AV({children:e}){const n=Ie(),r=x.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:f,onNodesChange:d,nodeLookup:h,fitViewQueued:g,onNodesChangeMiddlewareMap:v}=n.getState();let b=c;for(const m of l)b=typeof m=="function"?m(b):m;let _=d1({items:b,lookup:h});for(const m of v.values())_=m(_);f&&u(b),_.length>0?d==null||d(_):g&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:w,setNodes:y}=n.getState();m&&y(w)})},[]),o=p1(r),i=x.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:f,onEdgesChange:d,edgeLookup:h}=n.getState();let g=c;for(const v of l)g=typeof v=="function"?v(g):v;f?u(g):d&&d(d1({items:g,lookup:h}))},[]),s=p1(i),a=x.useMemo(()=>({nodeQueue:o,edgeQueue:s}),[]);return p.jsx(kE.Provider,{value:a,children:e})}function TV(){const e=x.useContext(kE);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const IV=e=>!!e.panZoom;function d0(){const e=NV(),n=Ie(),r=TV(),o=we(IV),i=x.useMemo(()=>{const s=d=>n.getState().nodeLookup.get(d),a=d=>{r.nodeQueue.push(d)},l=d=>{r.edgeQueue.push(d)},c=d=>{var m,w;const{nodeLookup:h,nodeOrigin:g}=n.getState(),v=h1(d)?d:h.get(d.id),b=v.parentId?qN(v.position,v.measured,v.parentId,h,g):v.position,_={...v,position:b,width:((m=v.measured)==null?void 0:m.width)??v.width,height:((w=v.measured)==null?void 0:w.height)??v.height};return Ki(_)},u=(d,h,g={replace:!1})=>{a(v=>v.map(b=>{if(b.id===d){const _=typeof h=="function"?h(b):h;return g.replace&&h1(_)?_:{...b,..._}}return b}))},f=(d,h,g={replace:!1})=>{l(v=>v.map(b=>{if(b.id===d){const _=typeof h=="function"?h(b):h;return g.replace&&MV(_)?_:{...b,..._}}return b}))};return{getNodes:()=>n.getState().nodes.map(d=>({...d})),getNode:d=>{var h;return(h=s(d))==null?void 0:h.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:d=[]}=n.getState();return d.map(h=>({...h}))},getEdge:d=>n.getState().edgeLookup.get(d),setNodes:a,setEdges:l,addNodes:d=>{const h=Array.isArray(d)?d:[d];r.nodeQueue.push(g=>[...g,...h])},addEdges:d=>{const h=Array.isArray(d)?d:[d];r.edgeQueue.push(g=>[...g,...h])},toObject:()=>{const{nodes:d=[],edges:h=[],transform:g}=n.getState(),[v,b,_]=g;return{nodes:d.map(m=>({...m})),edges:h.map(m=>({...m})),viewport:{x:v,y:b,zoom:_}}},deleteElements:async({nodes:d=[],edges:h=[]})=>{const{nodes:g,edges:v,onNodesDelete:b,onEdgesDelete:_,triggerNodeChanges:m,triggerEdgeChanges:w,onDelete:y,onBeforeDelete:S}=n.getState(),{nodes:k,edges:C}=await ZH({nodesToRemove:d,edgesToRemove:h,nodes:g,edges:v,onBeforeDelete:S}),N=C.length>0,E=k.length>0;if(N){const j=C.map(f1);_==null||_(C),w(j)}if(E){const j=k.map(f1);b==null||b(k),m(j)}return(E||N)&&(y==null||y({nodes:k,edges:C})),{deletedNodes:k,deletedEdges:C}},getIntersectingNodes:(d,h=!0,g)=>{const v=Ux(d),b=v?d:c(d),_=g!==void 0;return b?(g||n.getState().nodes).filter(m=>{const w=n.getState().nodeLookup.get(m.id);if(w&&!v&&(m.id===d.id||!w.internals.positionAbsolute))return!1;const y=Ki(_?m:w),S=Oa(y,b);return h&&S>0||S>=y.width*y.height||S>=b.width*b.height}):[]},isNodeIntersecting:(d,h,g=!0)=>{const b=Ux(d)?d:c(d);if(!b)return!1;const _=Oa(b,h);return g&&_>0||_>=h.width*h.height||_>=b.width*b.height},updateNode:u,updateNodeData:(d,h,g={replace:!1})=>{u(d,v=>{const b=typeof h=="function"?h(v):h;return g.replace?{...v,data:b}:{...v,data:{...v.data,...b}}},g)},updateEdge:f,updateEdgeData:(d,h,g={replace:!1})=>{f(d,v=>{const b=typeof h=="function"?h(v):h;return g.replace?{...v,data:b}:{...v,data:{...v.data,...b}}},g)},getNodesBounds:d=>{const{nodeLookup:h,nodeOrigin:g}=n.getState();return XH(d,{nodeLookup:h,nodeOrigin:g})},getHandleConnections:({type:d,id:h,nodeId:g})=>{var v;return Array.from(((v=n.getState().connectionLookup.get(`${g}-${d}${h?`-${h}`:""}`))==null?void 0:v.values())??[])},getNodeConnections:({type:d,handleId:h,nodeId:g})=>{var v;return Array.from(((v=n.getState().connectionLookup.get(`${g}${d?h?`-${d}-${h}`:`-${d}`:""}`))==null?void 0:v.values())??[])},fitView:async d=>{const h=n.getState().fitViewResolver??nU();return n.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:h}),r.nodeQueue.push(g=>[...g]),h.promise}}},[]);return x.useMemo(()=>({...i,...e,viewportInitialized:o}),[o])}const m1=e=>e.selected,OV=typeof window<"u"?window:void 0;function $V({deleteKeyCode:e,multiSelectionKeyCode:n}){const r=Ie(),{deleteElements:o}=d0(),i=Da(e,{actInsideInputWithModifier:!1}),s=Da(n,{target:OV});x.useEffect(()=>{if(i){const{edges:a,nodes:l}=r.getState();o({nodes:l.filter(m1),edges:a.filter(m1)}),r.setState({nodesSelectionActive:!1})}},[i]),x.useEffect(()=>{r.setState({multiSelectionActive:s})},[s])}function DV(e){const n=Ie();x.useEffect(()=>{const r=()=>{var i,s,a,l;if(!e.current||!(((s=(i=e.current).checkVisibility)==null?void 0:s.call(i))??!0))return!1;const o=i0(e.current);(o.height===0||o.width===0)&&((l=(a=n.getState()).onError)==null||l.call(a,"004",In.error004())),n.setState({width:o.width||500,height:o.height||500})};if(e.current){r(),window.addEventListener("resize",r);const o=new ResizeObserver(()=>r());return o.observe(e.current),()=>{window.removeEventListener("resize",r),o&&e.current&&o.unobserve(e.current)}}},[])}const Yd={position:"absolute",width:"100%",height:"100%",top:0,left:0},LV=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function zV({onPaneContextMenu:e,zoomOnScroll:n=!0,zoomOnPinch:r=!0,panOnScroll:o=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=No.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:f,maxZoom:d,zoomActivationKeyCode:h,preventScrolling:g=!0,children:v,noWheelClassName:b,noPanClassName:_,onViewportChange:m,isControlledViewport:w,paneClickDistance:y,selectionOnDrag:S}){const k=Ie(),C=x.useRef(null),{userSelectionActive:N,lib:E,connectionInProgress:j}=we(LV,Te),A=Da(h),T=x.useRef();DV(C);const D=x.useCallback(F=>{m==null||m({x:F[0],y:F[1],zoom:F[2]}),w||k.setState({transform:F})},[m,w]);return x.useEffect(()=>{if(C.current){T.current=zU({domNode:C.current,minZoom:f,maxZoom:d,translateExtent:u,viewport:c,onDraggingChange:I=>k.setState(z=>z.paneDragging===I?z:{paneDragging:I}),onPanZoomStart:(I,z)=>{const{onViewportChangeStart:R,onMoveStart:M}=k.getState();M==null||M(I,z),R==null||R(z)},onPanZoom:(I,z)=>{const{onViewportChange:R,onMove:M}=k.getState();M==null||M(I,z),R==null||R(z)},onPanZoomEnd:(I,z)=>{const{onViewportChangeEnd:R,onMoveEnd:M}=k.getState();M==null||M(I,z),R==null||R(z)}});const{x:F,y:P,zoom:L}=T.current.getViewport();return k.setState({panZoom:T.current,transform:[F,P,L],domNode:C.current.closest(".react-flow")}),()=>{var I;(I=T.current)==null||I.destroy()}}},[]),x.useEffect(()=>{var F;(F=T.current)==null||F.update({onPaneContextMenu:e,zoomOnScroll:n,zoomOnPinch:r,panOnScroll:o,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:A,preventScrolling:g,noPanClassName:_,userSelectionActive:N,noWheelClassName:b,lib:E,onTransformChange:D,connectionInProgress:j,selectionOnDrag:S,paneClickDistance:y})},[e,n,r,o,i,s,a,l,A,g,_,N,b,E,D,j,S,y]),p.jsx("div",{className:"react-flow__renderer",ref:C,style:Yd,children:v})}const FV=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function BV(){const{userSelectionActive:e,userSelectionRect:n}=we(FV,Te);return e&&n?p.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const nh=(e,n)=>r=>{r.target===n.current&&(e==null||e(r))},HV=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function UV({isSelecting:e,selectionKeyPressed:n,selectionMode:r=Ia.Full,panOnDrag:o,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:f,onPaneMouseEnter:d,onPaneMouseMove:h,onPaneMouseLeave:g,children:v}){const b=Ie(),{userSelectionActive:_,elementsSelectable:m,dragging:w,connectionInProgress:y}=we(HV,Te),S=m&&(e||_),k=x.useRef(null),C=x.useRef(),N=x.useRef(new Set),E=x.useRef(new Set),j=x.useRef(!1),A=R=>{if(j.current||y){j.current=!1;return}c==null||c(R),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},T=R=>{if(Array.isArray(o)&&(o!=null&&o.includes(2))){R.preventDefault();return}u==null||u(R)},D=f?R=>f(R):void 0,F=R=>{j.current&&(R.stopPropagation(),j.current=!1)},P=R=>{var U,G;const{domNode:M}=b.getState();if(C.current=M==null?void 0:M.getBoundingClientRect(),!C.current)return;const O=R.target===k.current;if(!O&&!!R.target.closest(".nokey")||!e||!(s&&O||n)||R.button!==0||!R.isPrimary)return;(G=(U=R.target)==null?void 0:U.setPointerCapture)==null||G.call(U,R.pointerId),j.current=!1;const{x:K,y:B}=dn(R.nativeEvent,C.current);b.setState({userSelectionRect:{width:0,height:0,startX:K,startY:B,x:K,y:B}}),O||(R.stopPropagation(),R.preventDefault())},L=R=>{const{userSelectionRect:M,transform:O,nodeLookup:V,edgeLookup:$,connectionLookup:K,triggerNodeChanges:B,triggerEdgeChanges:U,defaultEdgeOptions:G,resetSelectedElements:W}=b.getState();if(!C.current||!M)return;const{x:X,y:q}=dn(R.nativeEvent,C.current),{startX:te,startY:ee}=M;if(!j.current){const pe=n?0:i;if(Math.hypot(X-te,q-ee)<=pe)return;W(),a==null||a(R)}j.current=!0;const Q={startX:te,startY:ee,x:X<te?X:te,y:q<ee?q:ee,width:Math.abs(X-te),height:Math.abs(q-ee)},ne=N.current,ue=E.current;N.current=new Set(r0(V,Q,O,r===Ia.Partial,!0).map(pe=>pe.id)),E.current=new Set;const ye=(G==null?void 0:G.selectable)??!0;for(const pe of N.current){const ke=K.get(pe);if(ke)for(const{edgeId:tt}of ke.values()){const Xe=$.get(tt);Xe&&(Xe.selectable??ye)&&E.current.add(tt)}}if(!Vx(ne,N.current)){const pe=wi(V,N.current,!0);B(pe)}if(!Vx(ue,E.current)){const pe=wi($,E.current);U(pe)}b.setState({userSelectionRect:Q,userSelectionActive:!0,nodesSelectionActive:!1})},I=R=>{var M,O;R.button===0&&((O=(M=R.target)==null?void 0:M.releasePointerCapture)==null||O.call(M,R.pointerId),!_&&R.target===k.current&&b.getState().userSelectionRect&&(A==null||A(R)),b.setState({userSelectionActive:!1,userSelectionRect:null}),j.current&&(l==null||l(R),b.setState({nodesSelectionActive:N.current.size>0})))},z=o===!0||Array.isArray(o)&&o.includes(0);return p.jsxs("div",{className:Ue(["react-flow__pane",{draggable:z,dragging:w,selection:e}]),onClick:S?void 0:nh(A,k),onContextMenu:nh(T,k),onWheel:nh(D,k),onPointerEnter:S?void 0:d,onPointerMove:S?L:h,onPointerUp:S?I:void 0,onPointerDownCapture:S?P:void 0,onClickCapture:S?F:void 0,onPointerLeave:g,ref:k,style:Yd,children:[v,p.jsx(BV,{})]})}function Gp({id:e,store:n,unselect:r=!1,nodeRef:o}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:l,onError:c}=n.getState(),u=l.get(e);if(!u){c==null||c("012",In.error012(e));return}n.setState({nodesSelectionActive:!1}),u.selected?(r||u.selected&&a)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var f;return(f=o==null?void 0:o.current)==null?void 0:f.blur()})):i([e])}function CE({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:o,nodeId:i,isSelectable:s,nodeClickDistance:a}){const l=Ie(),[c,u]=x.useState(!1),f=x.useRef();return x.useEffect(()=>{f.current=CU({getStoreItems:()=>l.getState(),onNodeMouseDown:d=>{Gp({id:d,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),x.useEffect(()=>{if(!(n||!e.current||!f.current))return f.current.update({noDragClassName:r,handleSelector:o,domNode:e.current,isSelectable:s,nodeId:i,nodeClickDistance:a}),()=>{var d;(d=f.current)==null||d.destroy()}},[r,o,n,s,e,i,a]),c}const VV=e=>n=>n.selected&&(n.draggable||e&&typeof n.draggable>"u");function NE(){const e=Ie();return x.useCallback(r=>{const{nodeExtent:o,snapToGrid:i,snapGrid:s,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:f}=e.getState(),d=new Map,h=VV(a),g=i?s[0]:5,v=i?s[1]:5,b=r.direction.x*g*r.factor,_=r.direction.y*v*r.factor;for(const[,m]of u){if(!h(m))continue;let w={x:m.internals.positionAbsolute.x+b,y:m.internals.positionAbsolute.y+_};i&&(w=al(w,s));const{position:y,positionAbsolute:S}=WN({nodeId:m.id,nextPosition:w,nodeLookup:u,nodeExtent:o,nodeOrigin:f,onError:l});m.position=y,m.internals.positionAbsolute=S,d.set(m.id,m)}c(d)},[])}const f0=x.createContext(null),WV=f0.Provider;f0.Consumer;const EE=()=>x.useContext(f0),GV=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),YV=(e,n,r)=>o=>{const{connectionClickStartHandle:i,connectionMode:s,connection:a}=o,{fromHandle:l,toHandle:c,isValid:u}=a,f=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===n&&(c==null?void 0:c.type)===r;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===n&&(l==null?void 0:l.type)===r,connectingTo:f,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===n&&(i==null?void 0:i.type)===r,isPossibleEndHandle:s===Yi.Strict?(l==null?void 0:l.type)!==r:e!==(l==null?void 0:l.nodeId)||n!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!i,valid:f&&u}};function XV({type:e="source",position:n=ce.Top,isValidConnection:r,isConnectable:o=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:f,onTouchStart:d,...h},g){var L,I;const v=a||null,b=e==="target",_=Ie(),m=EE(),{connectOnClick:w,noPanClassName:y,rfId:S}=we(GV,Te),{connectingFrom:k,connectingTo:C,clickConnecting:N,isPossibleEndHandle:E,connectionInProcess:j,clickConnectionInProcess:A,valid:T}=we(YV(m,v,e),Te);m||(I=(L=_.getState()).onError)==null||I.call(L,"010",In.error010());const D=z=>{const{defaultEdgeOptions:R,onConnect:M,hasDefaultEdges:O}=_.getState(),V={...R,...z};if(O){const{edges:$,setEdges:K}=_.getState();K(cU(V,$))}M==null||M(V),l==null||l(V)},F=z=>{if(!m)return;const R=JN(z.nativeEvent);if(i&&(R&&z.button===0||!R)){const M=_.getState();Vp.onPointerDown(z.nativeEvent,{handleDomNode:z.currentTarget,autoPanOnConnect:M.autoPanOnConnect,connectionMode:M.connectionMode,connectionRadius:M.connectionRadius,domNode:M.domNode,nodeLookup:M.nodeLookup,lib:M.lib,isTarget:b,handleId:v,nodeId:m,flowId:M.rfId,panBy:M.panBy,cancelConnection:M.cancelConnection,onConnectStart:M.onConnectStart,onConnectEnd:(...O)=>{var V,$;return($=(V=_.getState()).onConnectEnd)==null?void 0:$.call(V,...O)},updateConnection:M.updateConnection,onConnect:D,isValidConnection:r||((...O)=>{var V,$;return(($=(V=_.getState()).isValidConnection)==null?void 0:$.call(V,...O))??!0}),getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:M.autoPanSpeed,dragThreshold:M.connectionDragThreshold})}R?f==null||f(z):d==null||d(z)},P=z=>{const{onClickConnectStart:R,onClickConnectEnd:M,connectionClickStartHandle:O,connectionMode:V,isValidConnection:$,lib:K,rfId:B,nodeLookup:U,connection:G}=_.getState();if(!m||!O&&!i)return;if(!O){R==null||R(z.nativeEvent,{nodeId:m,handleId:v,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:m,type:e,id:v}});return}const W=QN(z.target),X=r||$,{connection:q,isValid:te}=Vp.isValid(z.nativeEvent,{handle:{nodeId:m,id:v,type:e},connectionMode:V,fromNodeId:O.nodeId,fromHandleId:O.id||null,fromType:O.type,isValidConnection:X,flowId:B,doc:W,lib:K,nodeLookup:U});te&&q&&D(q);const ee=structuredClone(G);delete ee.inProgress,ee.toPosition=ee.toHandle?ee.toHandle.position:null,M==null||M(z,ee),_.setState({connectionClickStartHandle:null})};return p.jsx("div",{"data-handleid":v,"data-nodeid":m,"data-handlepos":n,"data-id":`${S}-${m}-${v}-${e}`,className:Ue(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",y,u,{source:!b,target:b,connectable:o,connectablestart:i,connectableend:s,clickconnecting:N,connectingfrom:k,connectingto:C,valid:T,connectionindicator:o&&(!j||E)&&(j||A?s:i)}]),onMouseDown:F,onTouchStart:F,onClick:w?P:void 0,ref:g,...h,children:c})}const Lu=x.memo(SE(XV));function KV({data:e,isConnectable:n,sourcePosition:r=ce.Bottom}){return p.jsxs(p.Fragment,{children:[e==null?void 0:e.label,p.jsx(Lu,{type:"source",position:r,isConnectable:n})]})}function qV({data:e,isConnectable:n,targetPosition:r=ce.Top,sourcePosition:o=ce.Bottom}){return p.jsxs(p.Fragment,{children:[p.jsx(Lu,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label,p.jsx(Lu,{type:"source",position:o,isConnectable:n})]})}function QV(){return null}function ZV({data:e,isConnectable:n,targetPosition:r=ce.Top}){return p.jsxs(p.Fragment,{children:[p.jsx(Lu,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label]})}const zu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},g1={input:KV,default:qV,output:ZV,group:QV};function JV(e){var n,r,o,i;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((n=e.style)==null?void 0:n.width),height:e.height??e.initialHeight??((r=e.style)==null?void 0:r.height)}:{width:e.width??((o=e.style)==null?void 0:o.width),height:e.height??((i=e.style)==null?void 0:i.height)}}const eW=e=>{const{width:n,height:r,x:o,y:i}=sl(e.nodeLookup,{filter:s=>!!s.selected});return{width:un(n)?n:null,height:un(r)?r:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${i}px)`}};function tW({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const o=Ie(),{width:i,height:s,transformString:a,userSelectionActive:l}=we(eW,Te),c=NE(),u=x.useRef(null);x.useEffect(()=>{var g;r||(g=u.current)==null||g.focus({preventScroll:!0})},[r]);const f=!l&&i!==null&&s!==null;if(CE({nodeRef:u,disabled:!f}),!f)return null;const d=e?g=>{const v=o.getState().nodes.filter(b=>b.selected);e(g,v)}:void 0,h=g=>{Object.prototype.hasOwnProperty.call(zu,g.key)&&(g.preventDefault(),c({direction:zu[g.key],factor:g.shiftKey?4:1}))};return p.jsx("div",{className:Ue(["react-flow__nodesselection","react-flow__container",n]),style:{transform:a},children:p.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:r?void 0:-1,onKeyDown:r?void 0:h,style:{width:i,height:s}})})}const v1=typeof window<"u"?window:void 0,nW=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function jE({children:e,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:f,selectionMode:d,onSelectionStart:h,onSelectionEnd:g,multiSelectionKeyCode:v,panActivationKeyCode:b,zoomActivationKeyCode:_,elementsSelectable:m,zoomOnScroll:w,zoomOnPinch:y,panOnScroll:S,panOnScrollSpeed:k,panOnScrollMode:C,zoomOnDoubleClick:N,panOnDrag:E,defaultViewport:j,translateExtent:A,minZoom:T,maxZoom:D,preventScrolling:F,onSelectionContextMenu:P,noWheelClassName:L,noPanClassName:I,disableKeyboardA11y:z,onViewportChange:R,isControlledViewport:M}){const{nodesSelectionActive:O,userSelectionActive:V}=we(nW,Te),$=Da(u,{target:v1}),K=Da(b,{target:v1}),B=K||E,U=K||S,G=f&&B!==!0,W=$||V||G;return $V({deleteKeyCode:c,multiSelectionKeyCode:v}),p.jsx(zV,{onPaneContextMenu:s,elementsSelectable:m,zoomOnScroll:w,zoomOnPinch:y,panOnScroll:U,panOnScrollSpeed:k,panOnScrollMode:C,zoomOnDoubleClick:N,panOnDrag:!$&&B,defaultViewport:j,translateExtent:A,minZoom:T,maxZoom:D,zoomActivationKeyCode:_,preventScrolling:F,noWheelClassName:L,noPanClassName:I,onViewportChange:R,isControlledViewport:M,paneClickDistance:l,selectionOnDrag:G,children:p.jsxs(UV,{onSelectionStart:h,onSelectionEnd:g,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:B,isSelecting:!!W,selectionMode:d,selectionKeyPressed:$,paneClickDistance:l,selectionOnDrag:G,children:[e,O&&p.jsx(tW,{onSelectionContextMenu:P,noPanClassName:I,disableKeyboardA11y:z})]})})}jE.displayName="FlowRenderer";const rW=x.memo(jE),oW=e=>n=>e?r0(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map(r=>r.id):Array.from(n.nodeLookup.keys());function iW(e){return we(x.useCallback(oW(e),[e]),Te)}const sW=e=>e.updateNodeInternals;function aW(){const e=we(sW),[n]=x.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(r=>{const o=new Map;r.forEach(i=>{const s=i.target.getAttribute("data-id");o.set(s,{id:s,nodeElement:i.target,force:!0})}),e(o)}));return x.useEffect(()=>()=>{n==null||n.disconnect()},[n]),n}function lW({node:e,nodeType:n,hasDimensions:r,resizeObserver:o}){const i=Ie(),s=x.useRef(null),a=x.useRef(null),l=x.useRef(e.sourcePosition),c=x.useRef(e.targetPosition),u=x.useRef(n),f=r&&!!e.internals.handleBounds;return x.useEffect(()=>{s.current&&!e.hidden&&(!f||a.current!==s.current)&&(a.current&&(o==null||o.unobserve(a.current)),o==null||o.observe(s.current),a.current=s.current)},[f,e.hidden]),x.useEffect(()=>()=>{a.current&&(o==null||o.unobserve(a.current),a.current=null)},[]),x.useEffect(()=>{if(s.current){const d=u.current!==n,h=l.current!==e.sourcePosition,g=c.current!==e.targetPosition;(d||h||g)&&(u.current=n,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),s}function cW({id:e,onClick:n,onMouseEnter:r,onMouseMove:o,onMouseLeave:i,onContextMenu:s,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:f,resizeObserver:d,noDragClassName:h,noPanClassName:g,disableKeyboardA11y:v,rfId:b,nodeTypes:_,nodeClickDistance:m,onError:w}){const{node:y,internals:S,isParent:k}=we(X=>{const q=X.nodeLookup.get(e),te=X.parentLookup.has(e);return{node:q,internals:q.internals,isParent:te}},Te);let C=y.type||"default",N=(_==null?void 0:_[C])||g1[C];N===void 0&&(w==null||w("003",In.error003(C)),C="default",N=(_==null?void 0:_.default)||g1.default);const E=!!(y.draggable||l&&typeof y.draggable>"u"),j=!!(y.selectable||c&&typeof y.selectable>"u"),A=!!(y.connectable||u&&typeof y.connectable>"u"),T=!!(y.focusable||f&&typeof y.focusable>"u"),D=Ie(),F=KN(y),P=lW({node:y,nodeType:C,hasDimensions:F,resizeObserver:d}),L=CE({nodeRef:P,disabled:y.hidden||!E,noDragClassName:h,handleSelector:y.dragHandle,nodeId:e,isSelectable:j,nodeClickDistance:m}),I=NE();if(y.hidden)return null;const z=dr(y),R=JV(y),M=j||E||n||r||o||i,O=r?X=>r(X,{...S.userNode}):void 0,V=o?X=>o(X,{...S.userNode}):void 0,$=i?X=>i(X,{...S.userNode}):void 0,K=s?X=>s(X,{...S.userNode}):void 0,B=a?X=>a(X,{...S.userNode}):void 0,U=X=>{const{selectNodesOnDrag:q,nodeDragThreshold:te}=D.getState();j&&(!q||!E||te>0)&&Gp({id:e,store:D,nodeRef:P}),n&&n(X,{...S.userNode})},G=X=>{if(!(ZN(X.nativeEvent)||v)){if(FN.includes(X.key)&&j){const q=X.key==="Escape";Gp({id:e,store:D,unselect:q,nodeRef:P})}else if(E&&y.selected&&Object.prototype.hasOwnProperty.call(zu,X.key)){X.preventDefault();const{ariaLabelConfig:q}=D.getState();D.setState({ariaLiveMessage:q["node.a11yDescription.ariaLiveMessage"]({direction:X.key.replace("Arrow","").toLowerCase(),x:~~S.positionAbsolute.x,y:~~S.positionAbsolute.y})}),I({direction:zu[X.key],factor:X.shiftKey?4:1})}}},W=()=>{var ue;if(v||!((ue=P.current)!=null&&ue.matches(":focus-visible")))return;const{transform:X,width:q,height:te,autoPanOnNodeFocus:ee,setCenter:Q}=D.getState();if(!ee)return;r0(new Map([[e,y]]),{x:0,y:0,width:q,height:te},X,!0).length>0||Q(y.position.x+z.width/2,y.position.y+z.height/2,{zoom:X[2]})};return p.jsx("div",{className:Ue(["react-flow__node",`react-flow__node-${C}`,{[g]:E},y.className,{selected:y.selected,selectable:j,parent:k,draggable:E,dragging:L}]),ref:P,style:{zIndex:S.z,transform:`translate(${S.positionAbsolute.x}px,${S.positionAbsolute.y}px)`,pointerEvents:M?"all":"none",visibility:F?"visible":"hidden",...y.style,...R},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:O,onMouseMove:V,onMouseLeave:$,onContextMenu:K,onClick:U,onDoubleClick:B,onKeyDown:T?G:void 0,tabIndex:T?0:void 0,onFocus:T?W:void 0,role:y.ariaRole??(T?"group":void 0),"aria-roledescription":"node","aria-describedby":v?void 0:`${xE}-${b}`,"aria-label":y.ariaLabel,...y.domAttributes,children:p.jsx(WV,{value:e,children:p.jsx(N,{id:e,data:y.data,type:C,positionAbsoluteX:S.positionAbsolute.x,positionAbsoluteY:S.positionAbsolute.y,selected:y.selected??!1,selectable:j,draggable:E,deletable:y.deletable??!0,isConnectable:A,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:L,dragHandle:y.dragHandle,zIndex:S.z,parentId:y.parentId,...z})})})}var uW=x.memo(cW);const dW=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function PE(e){const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:o,elementsSelectable:i,onError:s}=we(dW,Te),a=iW(e.onlyRenderVisibleElements),l=aW();return p.jsx("div",{className:"react-flow__nodes",style:Yd,children:a.map(c=>p.jsx(uW,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:n,nodesConnectable:r,nodesFocusable:o,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}PE.displayName="NodeRenderer";const fW=x.memo(PE);function hW(e){return we(x.useCallback(r=>{if(!e)return r.edges.map(i=>i.id);const o=[];if(r.width&&r.height)for(const i of r.edges){const s=r.nodeLookup.get(i.source),a=r.nodeLookup.get(i.target);s&&a&&sU({sourceNode:s,targetNode:a,width:r.width,height:r.height,transform:r.transform})&&o.push(i.id)}return o},[e]),Te)}const pW=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e}};return p.jsx("polyline",{className:"arrow",style:r,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},mW=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e,fill:e}};return p.jsx("polyline",{className:"arrowclosed",style:r,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},y1={[Ou.Arrow]:pW,[Ou.ArrowClosed]:mW};function gW(e){const n=Ie();return x.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call(y1,e)?y1[e]:((s=(i=n.getState()).onError)==null||s.call(i,"009",In.error009(e)),null)},[e])}const vW=({id:e,type:n,color:r,width:o=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=gW(n);return c?p.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0",children:p.jsx(c,{color:r,strokeWidth:a})}):null},ME=({defaultColor:e,rfId:n})=>{const r=we(s=>s.edges),o=we(s=>s.defaultEdgeOptions),i=x.useMemo(()=>pU(r,{id:n,defaultColor:e,defaultMarkerStart:o==null?void 0:o.markerStart,defaultMarkerEnd:o==null?void 0:o.markerEnd}),[r,o,n,e]);return i.length?p.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:p.jsx("defs",{children:i.map(s=>p.jsx(vW,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};ME.displayName="MarkerDefinitions";var yW=x.memo(ME);function RE({x:e,y:n,label:r,labelStyle:o,labelShowBg:i=!0,labelBgStyle:s,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...f}){const[d,h]=x.useState({x:1,y:0,width:0,height:0}),g=Ue(["react-flow__edge-textwrapper",u]),v=x.useRef(null);return x.useEffect(()=>{if(v.current){const b=v.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[r]),r?p.jsxs("g",{transform:`translate(${e-d.width/2} ${n-d.height/2})`,className:g,visibility:d.width?"visible":"hidden",...f,children:[i&&p.jsx("rect",{width:d.width+2*a[0],x:-a[0],y:-a[1],height:d.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:l,ry:l}),p.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:v,style:o,children:r}),c]}):null}RE.displayName="EdgeText";const xW=x.memo(RE);function Xd({path:e,labelX:n,labelY:r,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...f}){return p.jsxs(p.Fragment,{children:[p.jsx("path",{...f,d:e,fill:"none",className:Ue(["react-flow__edge-path",f.className])}),u?p.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,o&&un(n)&&un(r)?p.jsx(xW,{x:n,y:r,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function x1({pos:e,x1:n,y1:r,x2:o,y2:i}){return e===ce.Left||e===ce.Right?[.5*(n+o),r]:[n,.5*(r+i)]}function AE({sourceX:e,sourceY:n,sourcePosition:r=ce.Bottom,targetX:o,targetY:i,targetPosition:s=ce.Top}){const[a,l]=x1({pos:r,x1:e,y1:n,x2:o,y2:i}),[c,u]=x1({pos:s,x1:o,y1:i,x2:e,y2:n}),[f,d,h,g]=eE({sourceX:e,sourceY:n,targetX:o,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${n} C${a},${l} ${c},${u} ${o},${i}`,f,d,h,g]}function TE(e){return x.memo(({id:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g,style:v,markerEnd:b,markerStart:_,interactionWidth:m})=>{const[w,y,S]=AE({sourceX:r,sourceY:o,sourcePosition:a,targetX:i,targetY:s,targetPosition:l}),k=e.isInternal?void 0:n;return p.jsx(Xd,{id:k,path:w,labelX:y,labelY:S,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g,style:v,markerEnd:b,markerStart:_,interactionWidth:m})})}const wW=TE({isInternal:!1}),IE=TE({isInternal:!0});wW.displayName="SimpleBezierEdge";IE.displayName="SimpleBezierEdgeInternal";function OE(e){return x.memo(({id:n,sourceX:r,sourceY:o,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:h,sourcePosition:g=ce.Bottom,targetPosition:v=ce.Top,markerEnd:b,markerStart:_,pathOptions:m,interactionWidth:w})=>{const[y,S,k]=Bp({sourceX:r,sourceY:o,sourcePosition:g,targetX:i,targetY:s,targetPosition:v,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset,stepPosition:m==null?void 0:m.stepPosition}),C=e.isInternal?void 0:n;return p.jsx(Xd,{id:C,path:y,labelX:S,labelY:k,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:h,markerEnd:b,markerStart:_,interactionWidth:w})})}const $E=OE({isInternal:!1}),DE=OE({isInternal:!0});$E.displayName="SmoothStepEdge";DE.displayName="SmoothStepEdgeInternal";function LE(e){return x.memo(({id:n,...r})=>{var i;const o=e.isInternal?void 0:n;return p.jsx($E,{...r,id:o,pathOptions:x.useMemo(()=>{var s;return{borderRadius:0,offset:(s=r.pathOptions)==null?void 0:s.offset}},[(i=r.pathOptions)==null?void 0:i.offset])})})}const bW=LE({isInternal:!1}),zE=LE({isInternal:!0});bW.displayName="StepEdge";zE.displayName="StepEdgeInternal";function FE(e){return x.memo(({id:n,sourceX:r,sourceY:o,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:h,markerEnd:g,markerStart:v,interactionWidth:b})=>{const[_,m,w]=rE({sourceX:r,sourceY:o,targetX:i,targetY:s}),y=e.isInternal?void 0:n;return p.jsx(Xd,{id:y,path:_,labelX:m,labelY:w,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:h,markerEnd:g,markerStart:v,interactionWidth:b})})}const _W=FE({isInternal:!1}),BE=FE({isInternal:!0});_W.displayName="StraightEdge";BE.displayName="StraightEdgeInternal";function HE(e){return x.memo(({id:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:a=ce.Bottom,targetPosition:l=ce.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g,style:v,markerEnd:b,markerStart:_,pathOptions:m,interactionWidth:w})=>{const[y,S,k]=tE({sourceX:r,sourceY:o,sourcePosition:a,targetX:i,targetY:s,targetPosition:l,curvature:m==null?void 0:m.curvature}),C=e.isInternal?void 0:n;return p.jsx(Xd,{id:C,path:y,labelX:S,labelY:k,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g,style:v,markerEnd:b,markerStart:_,interactionWidth:w})})}const SW=HE({isInternal:!1}),UE=HE({isInternal:!0});SW.displayName="BezierEdge";UE.displayName="BezierEdgeInternal";const w1={default:UE,straight:BE,step:zE,smoothstep:DE,simplebezier:IE},b1={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},kW=(e,n,r)=>r===ce.Left?e-n:r===ce.Right?e+n:e,CW=(e,n,r)=>r===ce.Top?e-n:r===ce.Bottom?e+n:e,_1="react-flow__edgeupdater";function S1({position:e,centerX:n,centerY:r,radius:o=10,onMouseDown:i,onMouseEnter:s,onMouseOut:a,type:l}){return p.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:a,className:Ue([_1,`${_1}-${l}`]),cx:kW(n,o,e),cy:CW(r,o,e),r:o,stroke:"transparent",fill:"transparent"})}function NW({isReconnectable:e,reconnectRadius:n,edge:r,sourceX:o,sourceY:i,targetX:s,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:f,onReconnectEnd:d,setReconnecting:h,setUpdateHover:g}){const v=Ie(),b=(S,k)=>{if(S.button!==0)return;const{autoPanOnConnect:C,domNode:N,connectionMode:E,connectionRadius:j,lib:A,onConnectStart:T,cancelConnection:D,nodeLookup:F,rfId:P,panBy:L,updateConnection:I}=v.getState(),z=k.type==="target",R=(V,$)=>{h(!1),d==null||d(V,r,k.type,$)},M=V=>u==null?void 0:u(r,V),O=(V,$)=>{h(!0),f==null||f(S,r,k.type),T==null||T(V,$)};Vp.onPointerDown(S.nativeEvent,{autoPanOnConnect:C,connectionMode:E,connectionRadius:j,domNode:N,handleId:k.id,nodeId:k.nodeId,nodeLookup:F,isTarget:z,edgeUpdaterType:k.type,lib:A,flowId:P,cancelConnection:D,panBy:L,isValidConnection:(...V)=>{var $,K;return((K=($=v.getState()).isValidConnection)==null?void 0:K.call($,...V))??!0},onConnect:M,onConnectStart:O,onConnectEnd:(...V)=>{var $,K;return(K=($=v.getState()).onConnectEnd)==null?void 0:K.call($,...V)},onReconnectEnd:R,updateConnection:I,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,dragThreshold:v.getState().connectionDragThreshold,handleDomNode:S.currentTarget})},_=S=>b(S,{nodeId:r.target,id:r.targetHandle??null,type:"target"}),m=S=>b(S,{nodeId:r.source,id:r.sourceHandle??null,type:"source"}),w=()=>g(!0),y=()=>g(!1);return p.jsxs(p.Fragment,{children:[(e===!0||e==="source")&&p.jsx(S1,{position:l,centerX:o,centerY:i,radius:n,onMouseDown:_,onMouseEnter:w,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&p.jsx(S1,{position:c,centerX:s,centerY:a,radius:n,onMouseDown:m,onMouseEnter:w,onMouseOut:y,type:"target"})]})}function EW({id:e,edgesFocusable:n,edgesReconnectable:r,elementsSelectable:o,onClick:i,onDoubleClick:s,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:g,rfId:v,edgeTypes:b,noPanClassName:_,onError:m,disableKeyboardA11y:w}){let y=we(Q=>Q.edgeLookup.get(e));const S=we(Q=>Q.defaultEdgeOptions);y=S?{...S,...y}:y;let k=y.type||"default",C=(b==null?void 0:b[k])||w1[k];C===void 0&&(m==null||m("011",In.error011(k)),k="default",C=(b==null?void 0:b.default)||w1.default);const N=!!(y.focusable||n&&typeof y.focusable>"u"),E=typeof d<"u"&&(y.reconnectable||r&&typeof y.reconnectable>"u"),j=!!(y.selectable||o&&typeof y.selectable>"u"),A=x.useRef(null),[T,D]=x.useState(!1),[F,P]=x.useState(!1),L=Ie(),{zIndex:I,sourceX:z,sourceY:R,targetX:M,targetY:O,sourcePosition:V,targetPosition:$}=we(x.useCallback(Q=>{const ne=Q.nodeLookup.get(y.source),ue=Q.nodeLookup.get(y.target);if(!ne||!ue)return{zIndex:y.zIndex,...b1};const ye=hU({id:e,sourceNode:ne,targetNode:ue,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:Q.connectionMode,onError:m});return{zIndex:iU({selected:y.selected,zIndex:y.zIndex,sourceNode:ne,targetNode:ue,elevateOnSelect:Q.elevateEdgesOnSelect,zIndexMode:Q.zIndexMode}),...ye||b1}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),Te),K=x.useMemo(()=>y.markerStart?`url('#${Hp(y.markerStart,v)}')`:void 0,[y.markerStart,v]),B=x.useMemo(()=>y.markerEnd?`url('#${Hp(y.markerEnd,v)}')`:void 0,[y.markerEnd,v]);if(y.hidden||z===null||R===null||M===null||O===null)return null;const U=Q=>{var pe;const{addSelectedEdges:ne,unselectNodesAndEdges:ue,multiSelectionActive:ye}=L.getState();j&&(L.setState({nodesSelectionActive:!1}),y.selected&&ye?(ue({nodes:[],edges:[y]}),(pe=A.current)==null||pe.blur()):ne([e])),i&&i(Q,y)},G=s?Q=>{s(Q,{...y})}:void 0,W=a?Q=>{a(Q,{...y})}:void 0,X=l?Q=>{l(Q,{...y})}:void 0,q=c?Q=>{c(Q,{...y})}:void 0,te=u?Q=>{u(Q,{...y})}:void 0,ee=Q=>{var ne;if(!w&&FN.includes(Q.key)&&j){const{unselectNodesAndEdges:ue,addSelectedEdges:ye}=L.getState();Q.key==="Escape"?((ne=A.current)==null||ne.blur(),ue({edges:[y]})):ye([e])}};return p.jsx("svg",{style:{zIndex:I},children:p.jsxs("g",{className:Ue(["react-flow__edge",`react-flow__edge-${k}`,y.className,_,{selected:y.selected,animated:y.animated,inactive:!j&&!i,updating:T,selectable:j}]),onClick:U,onDoubleClick:G,onContextMenu:W,onMouseEnter:X,onMouseMove:q,onMouseLeave:te,onKeyDown:N?ee:void 0,tabIndex:N?0:void 0,role:y.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":N?`${wE}-${v}`:void 0,ref:A,...y.domAttributes,children:[!F&&p.jsx(C,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:j,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:z,sourceY:R,targetX:M,targetY:O,sourcePosition:V,targetPosition:$,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:K,markerEnd:B,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),E&&p.jsx(NW,{edge:y,isReconnectable:E,reconnectRadius:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:g,sourceX:z,sourceY:R,targetX:M,targetY:O,sourcePosition:V,targetPosition:$,setUpdateHover:D,setReconnecting:P})]})})}var jW=x.memo(EW);const PW=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function VE({defaultMarkerColor:e,onlyRenderVisibleElements:n,rfId:r,edgeTypes:o,noPanClassName:i,onReconnect:s,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:f,reconnectRadius:d,onEdgeDoubleClick:h,onReconnectStart:g,onReconnectEnd:v,disableKeyboardA11y:b}){const{edgesFocusable:_,edgesReconnectable:m,elementsSelectable:w,onError:y}=we(PW,Te),S=hW(n);return p.jsxs("div",{className:"react-flow__edges",children:[p.jsx(yW,{defaultColor:e,rfId:r}),S.map(k=>p.jsx(jW,{id:k,edgesFocusable:_,edgesReconnectable:m,elementsSelectable:w,noPanClassName:i,onReconnect:s,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:f,reconnectRadius:d,onDoubleClick:h,onReconnectStart:g,onReconnectEnd:v,rfId:r,onError:y,edgeTypes:o,disableKeyboardA11y:b},k))]})}VE.displayName="EdgeRenderer";const MW=x.memo(VE),RW=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function AW({children:e}){const n=we(RW);return p.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}function TW(e){const n=d0(),r=x.useRef(!1);x.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const IW=e=>{var n;return(n=e.panZoom)==null?void 0:n.syncViewport};function OW(e){const n=we(IW),r=Ie();return x.useEffect(()=>{e&&(n==null||n(e),r.setState({transform:[e.x,e.y,e.zoom]}))},[e,n]),null}function $W(e){return e.connection.inProgress?{...e.connection,to:ll(e.connection.to,e.transform)}:{...e.connection}}function DW(e){return $W}function LW(e){const n=DW();return we(n,Te)}const zW=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function FW({containerStyle:e,style:n,type:r,component:o}){const{nodesConnectable:i,width:s,height:a,isValid:l,inProgress:c}=we(zW,Te);return!(s&&i&&c)?null:p.jsx("svg",{style:e,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:p.jsx("g",{className:Ue(["react-flow__connection",UN(l)]),children:p.jsx(WE,{style:n,type:r,CustomComponent:o,isValid:l})})})}const WE=({style:e,type:n=Pr.Bezier,CustomComponent:r,isValid:o})=>{const{inProgress:i,from:s,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:f,toHandle:d,toPosition:h,pointer:g}=LW();if(!i)return;if(r)return p.jsx(r,{connectionLineType:n,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:UN(o),toNode:f,toHandle:d,pointer:g});let v="";const b={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(n){case Pr.Bezier:[v]=tE(b);break;case Pr.SimpleBezier:[v]=AE(b);break;case Pr.Step:[v]=Bp({...b,borderRadius:0});break;case Pr.SmoothStep:[v]=Bp(b);break;default:[v]=rE(b)}return p.jsx("path",{d:v,fill:"none",className:"react-flow__connection-path",style:e})};WE.displayName="ConnectionLine";const BW={};function k1(e=BW){x.useRef(e),Ie(),x.useEffect(()=>{},[e])}function HW(){Ie(),x.useRef(!1),x.useEffect(()=>{},[])}function GE({nodeTypes:e,edgeTypes:n,onInit:r,onNodeClick:o,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:f,onSelectionContextMenu:d,onSelectionStart:h,onSelectionEnd:g,connectionLineType:v,connectionLineStyle:b,connectionLineComponent:_,connectionLineContainerStyle:m,selectionKeyCode:w,selectionOnDrag:y,selectionMode:S,multiSelectionKeyCode:k,panActivationKeyCode:C,zoomActivationKeyCode:N,deleteKeyCode:E,onlyRenderVisibleElements:j,elementsSelectable:A,defaultViewport:T,translateExtent:D,minZoom:F,maxZoom:P,preventScrolling:L,defaultMarkerColor:I,zoomOnScroll:z,zoomOnPinch:R,panOnScroll:M,panOnScrollSpeed:O,panOnScrollMode:V,zoomOnDoubleClick:$,panOnDrag:K,onPaneClick:B,onPaneMouseEnter:U,onPaneMouseMove:G,onPaneMouseLeave:W,onPaneScroll:X,onPaneContextMenu:q,paneClickDistance:te,nodeClickDistance:ee,onEdgeContextMenu:Q,onEdgeMouseEnter:ne,onEdgeMouseMove:ue,onEdgeMouseLeave:ye,reconnectRadius:pe,onReconnect:ke,onReconnectStart:tt,onReconnectEnd:Xe,noDragClassName:Zt,noWheelClassName:fr,noPanClassName:Dn,disableKeyboardA11y:hr,nodeExtent:pr,rfId:io,viewport:Ln,onViewportChange:so}){return k1(e),k1(n),HW(),TW(r),OW(Ln),p.jsx(rW,{onPaneClick:B,onPaneMouseEnter:U,onPaneMouseMove:G,onPaneMouseLeave:W,onPaneContextMenu:q,onPaneScroll:X,paneClickDistance:te,deleteKeyCode:E,selectionKeyCode:w,selectionOnDrag:y,selectionMode:S,onSelectionStart:h,onSelectionEnd:g,multiSelectionKeyCode:k,panActivationKeyCode:C,zoomActivationKeyCode:N,elementsSelectable:A,zoomOnScroll:z,zoomOnPinch:R,zoomOnDoubleClick:$,panOnScroll:M,panOnScrollSpeed:O,panOnScrollMode:V,panOnDrag:K,defaultViewport:T,translateExtent:D,minZoom:F,maxZoom:P,onSelectionContextMenu:d,preventScrolling:L,noDragClassName:Zt,noWheelClassName:fr,noPanClassName:Dn,disableKeyboardA11y:hr,onViewportChange:so,isControlledViewport:!!Ln,children:p.jsxs(AW,{children:[p.jsx(MW,{edgeTypes:n,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:ke,onReconnectStart:tt,onReconnectEnd:Xe,onlyRenderVisibleElements:j,onEdgeContextMenu:Q,onEdgeMouseEnter:ne,onEdgeMouseMove:ue,onEdgeMouseLeave:ye,reconnectRadius:pe,defaultMarkerColor:I,noPanClassName:Dn,disableKeyboardA11y:hr,rfId:io}),p.jsx(FW,{style:b,type:v,component:_,containerStyle:m}),p.jsx("div",{className:"react-flow__edgelabel-renderer"}),p.jsx(fW,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:f,nodeClickDistance:ee,onlyRenderVisibleElements:j,noPanClassName:Dn,noDragClassName:Zt,disableKeyboardA11y:hr,nodeExtent:pr,rfId:io}),p.jsx("div",{className:"react-flow__viewport-portal"})]})})}GE.displayName="GraphView";const UW=x.memo(GE),C1=({nodes:e,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:f,nodeExtent:d,zIndexMode:h="basic"}={})=>{const g=new Map,v=new Map,b=new Map,_=new Map,m=o??n??[],w=r??e??[],y=f??[0,0],S=d??Ta;sE(b,_,m);const{nodesInitialized:k}=Up(w,g,v,{nodeOrigin:y,nodeExtent:S,zIndexMode:h});let C=[0,0,1];if(a&&i&&s){const N=sl(g,{filter:T=>!!((T.width||T.initialWidth)&&(T.height||T.initialHeight))}),{x:E,y:j,zoom:A}=o0(N,i,s,c,u,(l==null?void 0:l.padding)??.1);C=[E,j,A]}return{rfId:"1",width:i??0,height:s??0,transform:C,nodes:w,nodesInitialized:k,nodeLookup:g,parentLookup:v,edges:m,edgeLookup:_,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:r!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Ta,nodeExtent:S,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Yi.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...HN},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:JH,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:BN,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},VW=({nodes:e,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:f,nodeExtent:d,zIndexMode:h})=>aV((g,v)=>{async function b(){const{nodeLookup:_,panZoom:m,fitViewOptions:w,fitViewResolver:y,width:S,height:k,minZoom:C,maxZoom:N}=v();m&&(await QH({nodes:_,width:S,height:k,panZoom:m,minZoom:C,maxZoom:N},w),y==null||y.resolve(!0),g({fitViewResolver:null}))}return{...C1({nodes:e,edges:n,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:f,nodeExtent:d,defaultNodes:r,defaultEdges:o,zIndexMode:h}),setNodes:_=>{const{nodeLookup:m,parentLookup:w,nodeOrigin:y,elevateNodesOnSelect:S,fitViewQueued:k,zIndexMode:C,nodesSelectionActive:N}=v(),{nodesInitialized:E,hasSelectedNodes:j}=Up(_,m,w,{nodeOrigin:y,nodeExtent:d,elevateNodesOnSelect:S,checkEquality:!0,zIndexMode:C}),A=N&&j;k&&E?(b(),g({nodes:_,nodesInitialized:E,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:A})):g({nodes:_,nodesInitialized:E,nodesSelectionActive:A})},setEdges:_=>{const{connectionLookup:m,edgeLookup:w}=v();sE(m,w,_),g({edges:_})},setDefaultNodesAndEdges:(_,m)=>{if(_){const{setNodes:w}=v();w(_),g({hasDefaultNodes:!0})}if(m){const{setEdges:w}=v();w(m),g({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:m,nodeLookup:w,parentLookup:y,domNode:S,nodeOrigin:k,nodeExtent:C,debug:N,fitViewQueued:E,zIndexMode:j}=v(),{changes:A,updatedInternals:T}=bU(_,w,y,S,k,C,j);T&&(vU(w,y,{nodeOrigin:k,nodeExtent:C,zIndexMode:j}),E?(b(),g({fitViewQueued:!1,fitViewOptions:void 0})):g({}),(A==null?void 0:A.length)>0&&(N&&console.log("React Flow: trigger node changes",A),m==null||m(A)))},updateNodePositions:(_,m=!1)=>{const w=[];let y=[];const{nodeLookup:S,triggerNodeChanges:k,connection:C,updateConnection:N,onNodesChangeMiddlewareMap:E}=v();for(const[j,A]of _){const T=S.get(j),D=!!(T!=null&&T.expandParent&&(T!=null&&T.parentId)&&(A!=null&&A.position)),F={id:j,type:"position",position:D?{x:Math.max(0,A.position.x),y:Math.max(0,A.position.y)}:A.position,dragging:m};if(T&&C.inProgress&&C.fromNode.id===T.id){const P=Fo(T,C.fromHandle,ce.Left,!0);N({...C,from:P})}D&&T.parentId&&w.push({id:j,parentId:T.parentId,rect:{...A.internals.positionAbsolute,width:A.measured.width??0,height:A.measured.height??0}}),y.push(F)}if(w.length>0){const{parentLookup:j,nodeOrigin:A}=v(),T=u0(w,S,j,A);y.push(...T)}for(const j of E.values())y=j(y);k(y)},triggerNodeChanges:_=>{const{onNodesChange:m,setNodes:w,nodes:y,hasDefaultNodes:S,debug:k}=v();if(_!=null&&_.length){if(S){const C=jV(_,y);w(C)}k&&console.log("React Flow: trigger node changes",_),m==null||m(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:m,setEdges:w,edges:y,hasDefaultEdges:S,debug:k}=v();if(_!=null&&_.length){if(S){const C=PV(_,y);w(C)}k&&console.log("React Flow: trigger edge changes",_),m==null||m(_)}},addSelectedNodes:_=>{const{multiSelectionActive:m,edgeLookup:w,nodeLookup:y,triggerNodeChanges:S,triggerEdgeChanges:k}=v();if(m){const C=_.map(N=>go(N,!0));S(C);return}S(wi(y,new Set([..._]),!0)),k(wi(w))},addSelectedEdges:_=>{const{multiSelectionActive:m,edgeLookup:w,nodeLookup:y,triggerNodeChanges:S,triggerEdgeChanges:k}=v();if(m){const C=_.map(N=>go(N,!0));k(C);return}k(wi(w,new Set([..._]))),S(wi(y,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:m}={})=>{const{edges:w,nodes:y,nodeLookup:S,triggerNodeChanges:k,triggerEdgeChanges:C}=v(),N=_||y,E=m||w,j=[];for(const T of N){if(!T.selected)continue;const D=S.get(T.id);D&&(D.selected=!1),j.push(go(T.id,!1))}const A=[];for(const T of E)T.selected&&A.push(go(T.id,!1));k(j),C(A)},setMinZoom:_=>{const{panZoom:m,maxZoom:w}=v();m==null||m.setScaleExtent([_,w]),g({minZoom:_})},setMaxZoom:_=>{const{panZoom:m,minZoom:w}=v();m==null||m.setScaleExtent([w,_]),g({maxZoom:_})},setTranslateExtent:_=>{var m;(m=v().panZoom)==null||m.setTranslateExtent(_),g({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:m,triggerNodeChanges:w,triggerEdgeChanges:y,elementsSelectable:S}=v();if(!S)return;const k=m.reduce((N,E)=>E.selected?[...N,go(E.id,!1)]:N,[]),C=_.reduce((N,E)=>E.selected?[...N,go(E.id,!1)]:N,[]);w(k),y(C)},setNodeExtent:_=>{const{nodes:m,nodeLookup:w,parentLookup:y,nodeOrigin:S,elevateNodesOnSelect:k,nodeExtent:C,zIndexMode:N}=v();_[0][0]===C[0][0]&&_[0][1]===C[0][1]&&_[1][0]===C[1][0]&&_[1][1]===C[1][1]||(Up(m,w,y,{nodeOrigin:S,nodeExtent:_,elevateNodesOnSelect:k,checkEquality:!1,zIndexMode:N}),g({nodeExtent:_}))},panBy:_=>{const{transform:m,width:w,height:y,panZoom:S,translateExtent:k}=v();return _U({delta:_,panZoom:S,transform:m,translateExtent:k,width:w,height:y})},setCenter:async(_,m,w)=>{const{width:y,height:S,maxZoom:k,panZoom:C}=v();if(!C)return Promise.resolve(!1);const N=typeof(w==null?void 0:w.zoom)<"u"?w.zoom:k;return await C.setViewport({x:y/2-_*N,y:S/2-m*N,zoom:N},{duration:w==null?void 0:w.duration,ease:w==null?void 0:w.ease,interpolate:w==null?void 0:w.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{g({connection:{...HN}})},updateConnection:_=>{g({connection:_})},reset:()=>g({...C1()})}},Object.is);function Kd({initialNodes:e,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:s,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:f,nodeExtent:d,zIndexMode:h,children:g}){const[v]=x.useState(()=>VW({nodes:e,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:f,nodeExtent:d,zIndexMode:h}));return p.jsx(lV,{value:v,children:p.jsx(AV,{children:g})})}function WW({children:e,nodes:n,edges:r,defaultNodes:o,defaultEdges:i,width:s,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:f,nodeOrigin:d,nodeExtent:h,zIndexMode:g}){return x.useContext(Wd)?p.jsx(p.Fragment,{children:e}):p.jsx(Kd,{initialNodes:n,initialEdges:r,defaultNodes:o,defaultEdges:i,initialWidth:s,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:f,nodeOrigin:d,nodeExtent:h,zIndexMode:g,children:e})}const GW={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function YW({nodes:e,edges:n,defaultNodes:r,defaultEdges:o,className:i,nodeTypes:s,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:f,onMoveStart:d,onMoveEnd:h,onConnect:g,onConnectStart:v,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:m,onNodeMouseEnter:w,onNodeMouseMove:y,onNodeMouseLeave:S,onNodeContextMenu:k,onNodeDoubleClick:C,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:j,onNodesDelete:A,onEdgesDelete:T,onDelete:D,onSelectionChange:F,onSelectionDragStart:P,onSelectionDrag:L,onSelectionDragStop:I,onSelectionContextMenu:z,onSelectionStart:R,onSelectionEnd:M,onBeforeDelete:O,connectionMode:V,connectionLineType:$=Pr.Bezier,connectionLineStyle:K,connectionLineComponent:B,connectionLineContainerStyle:U,deleteKeyCode:G="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:X=!1,selectionMode:q=Ia.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:ee=$a()?"Meta":"Control",zoomActivationKeyCode:Q=$a()?"Meta":"Control",snapToGrid:ne,snapGrid:ue,onlyRenderVisibleElements:ye=!1,selectNodesOnDrag:pe,nodesDraggable:ke,autoPanOnNodeFocus:tt,nodesConnectable:Xe,nodesFocusable:Zt,nodeOrigin:fr=bE,edgesFocusable:Dn,edgesReconnectable:hr,elementsSelectable:pr=!0,defaultViewport:io=bV,minZoom:Ln=.5,maxZoom:so=2,translateExtent:us=Ta,preventScrolling:cl=!0,nodeExtent:ds,defaultMarkerColor:Yo="#b1b1b7",zoomOnScroll:fs=!0,zoomOnPinch:qd=!0,panOnScroll:ul=!1,panOnScrollSpeed:dl=.5,panOnScrollMode:fl=No.Free,zoomOnDoubleClick:hl=!0,panOnDrag:pl=!0,onPaneClick:ml,onPaneMouseEnter:gl,onPaneMouseMove:vl,onPaneMouseLeave:yl,onPaneScroll:xl,onPaneContextMenu:Y,paneClickDistance:de=1,nodeClickDistance:he=0,children:Fe,onReconnect:ct,onReconnectStart:ao,onReconnectEnd:xn,onEdgeContextMenu:lo,onEdgeDoubleClick:Xo,onEdgeMouseEnter:wl,onEdgeMouseMove:bl,onEdgeMouseLeave:co,reconnectRadius:vt=10,onNodesChange:QE,onEdgesChange:ZE,noDragClassName:JE="nodrag",noWheelClassName:ej="nowheel",noPanClassName:v0="nopan",fitView:y0,fitViewOptions:x0,connectOnClick:tj,attributionPosition:nj,proOptions:rj,defaultEdgeOptions:oj,elevateNodesOnSelect:ij=!0,elevateEdgesOnSelect:sj=!1,disableKeyboardA11y:w0=!1,autoPanOnConnect:aj,autoPanOnNodeDrag:lj,autoPanSpeed:cj,connectionRadius:uj,isValidConnection:dj,onError:fj,style:hj,id:b0,nodeDragThreshold:pj,connectionDragThreshold:mj,viewport:gj,onViewportChange:vj,width:yj,height:xj,colorMode:wj="light",debug:bj,onScroll:_l,ariaLabelConfig:_j,zIndexMode:_0="basic",...Sj},kj){const Qd=b0||"1",Cj=CV(wj),Nj=x.useCallback(S0=>{S0.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),_l==null||_l(S0)},[_l]);return p.jsx("div",{"data-testid":"rf__wrapper",...Sj,onScroll:Nj,style:{...hj,...GW},ref:kj,className:Ue(["react-flow",i,Cj]),id:b0,role:"application",children:p.jsxs(WW,{nodes:e,edges:n,width:yj,height:xj,fitView:y0,fitViewOptions:x0,minZoom:Ln,maxZoom:so,nodeOrigin:fr,nodeExtent:ds,zIndexMode:_0,children:[p.jsx(kV,{nodes:e,edges:n,defaultNodes:r,defaultEdges:o,onConnect:g,onConnectStart:v,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:m,nodesDraggable:ke,autoPanOnNodeFocus:tt,nodesConnectable:Xe,nodesFocusable:Zt,edgesFocusable:Dn,edgesReconnectable:hr,elementsSelectable:pr,elevateNodesOnSelect:ij,elevateEdgesOnSelect:sj,minZoom:Ln,maxZoom:so,nodeExtent:ds,onNodesChange:QE,onEdgesChange:ZE,snapToGrid:ne,snapGrid:ue,connectionMode:V,translateExtent:us,connectOnClick:tj,defaultEdgeOptions:oj,fitView:y0,fitViewOptions:x0,onNodesDelete:A,onEdgesDelete:T,onDelete:D,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:j,onSelectionDrag:L,onSelectionDragStart:P,onSelectionDragStop:I,onMove:f,onMoveStart:d,onMoveEnd:h,noPanClassName:v0,nodeOrigin:fr,rfId:Qd,autoPanOnConnect:aj,autoPanOnNodeDrag:lj,autoPanSpeed:cj,onError:fj,connectionRadius:uj,isValidConnection:dj,selectNodesOnDrag:pe,nodeDragThreshold:pj,connectionDragThreshold:mj,onBeforeDelete:O,debug:bj,ariaLabelConfig:_j,zIndexMode:_0}),p.jsx(UW,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:w,onNodeMouseMove:y,onNodeMouseLeave:S,onNodeContextMenu:k,onNodeDoubleClick:C,nodeTypes:s,edgeTypes:a,connectionLineType:$,connectionLineStyle:K,connectionLineComponent:B,connectionLineContainerStyle:U,selectionKeyCode:W,selectionOnDrag:X,selectionMode:q,deleteKeyCode:G,multiSelectionKeyCode:ee,panActivationKeyCode:te,zoomActivationKeyCode:Q,onlyRenderVisibleElements:ye,defaultViewport:io,translateExtent:us,minZoom:Ln,maxZoom:so,preventScrolling:cl,zoomOnScroll:fs,zoomOnPinch:qd,zoomOnDoubleClick:hl,panOnScroll:ul,panOnScrollSpeed:dl,panOnScrollMode:fl,panOnDrag:pl,onPaneClick:ml,onPaneMouseEnter:gl,onPaneMouseMove:vl,onPaneMouseLeave:yl,onPaneScroll:xl,onPaneContextMenu:Y,paneClickDistance:de,nodeClickDistance:he,onSelectionContextMenu:z,onSelectionStart:R,onSelectionEnd:M,onReconnect:ct,onReconnectStart:ao,onReconnectEnd:xn,onEdgeContextMenu:lo,onEdgeDoubleClick:Xo,onEdgeMouseEnter:wl,onEdgeMouseMove:bl,onEdgeMouseLeave:co,reconnectRadius:vt,defaultMarkerColor:Yo,noDragClassName:JE,noWheelClassName:ej,noPanClassName:v0,rfId:Qd,disableKeyboardA11y:w0,nodeExtent:ds,viewport:gj,onViewportChange:vj}),p.jsx(wV,{onSelectionChange:F}),Fe,p.jsx(mV,{proOptions:rj,position:nj}),p.jsx(pV,{rfId:Qd,disableKeyboardA11y:w0})]})})}var h0=SE(YW);function XW({dimensions:e,lineWidth:n,variant:r,className:o}){return p.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ue(["react-flow__background-pattern",r,o])})}function KW({radius:e,className:n}){return p.jsx("circle",{cx:e,cy:e,r:e,className:Ue(["react-flow__background-pattern","dots",n])})}var Ur;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ur||(Ur={}));const qW={[Ur.Dots]:1,[Ur.Lines]:1,[Ur.Cross]:6},QW=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function YE({id:e,variant:n=Ur.Dots,gap:r=20,size:o,lineWidth:i=1,offset:s=0,color:a,bgColor:l,style:c,className:u,patternClassName:f}){const d=x.useRef(null),{transform:h,patternId:g}=we(QW,Te),v=o||qW[n],b=n===Ur.Dots,_=n===Ur.Cross,m=Array.isArray(r)?r:[r,r],w=[m[0]*h[2]||1,m[1]*h[2]||1],y=v*h[2],S=Array.isArray(s)?s:[s,s],k=_?[y,y]:w,C=[S[0]*h[2]||1+k[0]/2,S[1]*h[2]||1+k[1]/2],N=`${g}${e||""}`;return p.jsxs("svg",{className:Ue(["react-flow__background",u]),style:{...c,...Yd,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:d,"data-testid":"rf__background",children:[p.jsx("pattern",{id:N,x:h[0]%w[0],y:h[1]%w[1],width:w[0],height:w[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:b?p.jsx(KW,{radius:y/2,className:f}):p.jsx(XW,{dimensions:k,lineWidth:i,variant:n,className:f})}),p.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}YE.displayName="Background";const p0=x.memo(YE);function ZW(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:p.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function JW(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:p.jsx("path",{d:"M0 0h32v4.2H0z"})})}function eG(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:p.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function tG(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:p.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function nG(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:p.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function sc({children:e,className:n,...r}){return p.jsx("button",{type:"button",className:Ue(["react-flow__controls-button",n]),...r,children:e})}const rG=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function XE({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:o=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:f,position:d="bottom-left",orientation:h="vertical","aria-label":g}){const v=Ie(),{isInteractive:b,minZoomReached:_,maxZoomReached:m,ariaLabelConfig:w}=we(rG,Te),{zoomIn:y,zoomOut:S,fitView:k}=d0(),C=()=>{y(),s==null||s()},N=()=>{S(),a==null||a()},E=()=>{k(i),l==null||l()},j=()=>{v.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},A=h==="horizontal"?"horizontal":"vertical";return p.jsxs(Gd,{className:Ue(["react-flow__controls",A,u]),position:d,style:e,"data-testid":"rf__controls","aria-label":g??w["controls.ariaLabel"],children:[n&&p.jsxs(p.Fragment,{children:[p.jsx(sc,{onClick:C,className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:m,children:p.jsx(ZW,{})}),p.jsx(sc,{onClick:N,className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:_,children:p.jsx(JW,{})})]}),r&&p.jsx(sc,{className:"react-flow__controls-fitview",onClick:E,title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:p.jsx(eG,{})}),o&&p.jsx(sc,{className:"react-flow__controls-interactive",onClick:j,title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:b?p.jsx(nG,{}):p.jsx(tG,{})}),f]})}XE.displayName="Controls";const m0=x.memo(XE);function oG({id:e,x:n,y:r,width:o,height:i,style:s,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:f,shapeRendering:d,selected:h,onClick:g}){const{background:v,backgroundColor:b}=s||{},_=a||v||b;return p.jsx("rect",{className:Ue(["react-flow__minimap-node",{selected:h},u]),x:n,y:r,rx:f,ry:f,width:o,height:i,style:{fill:_,stroke:l,strokeWidth:c},shapeRendering:d,onClick:g?m=>g(m,e):void 0})}const iG=x.memo(oG),sG=e=>e.nodes.map(n=>n.id),rh=e=>e instanceof Function?e:()=>e;function aG({nodeStrokeColor:e,nodeColor:n,nodeClassName:r="",nodeBorderRadius:o=5,nodeStrokeWidth:i,nodeComponent:s=iG,onClick:a}){const l=we(sG,Te),c=rh(n),u=rh(e),f=rh(r),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return p.jsx(p.Fragment,{children:l.map(h=>p.jsx(cG,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:f,nodeBorderRadius:o,nodeStrokeWidth:i,NodeComponent:s,onClick:a,shapeRendering:d},h))})}function lG({id:e,nodeColorFunc:n,nodeStrokeColorFunc:r,nodeClassNameFunc:o,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:f,y:d,width:h,height:g}=we(v=>{const b=v.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const _=b.internals.userNode,{x:m,y:w}=b.internals.positionAbsolute,{width:y,height:S}=dr(_);return{node:_,x:m,y:w,width:y,height:S}},Te);return!u||u.hidden||!KN(u)?null:p.jsx(l,{x:f,y:d,width:h,height:g,style:u.style,selected:!!u.selected,className:o(u),color:n(u),borderRadius:i,strokeColor:r(u),strokeWidth:s,shapeRendering:a,onClick:c,id:u.id})}const cG=x.memo(lG);var uG=x.memo(aG);const dG=200,fG=150,hG=e=>!e.hidden,pG=e=>{const n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:e.nodeLookup.size>0?XN(sl(e.nodeLookup,{filter:hG}),n):n,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},mG="react-flow__minimap-desc";function KE({style:e,className:n,nodeStrokeColor:r,nodeColor:o,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:f,maskStrokeWidth:d,position:h="bottom-right",onClick:g,onNodeClick:v,pannable:b=!1,zoomable:_=!1,ariaLabel:m,inversePan:w,zoomStep:y=1,offsetScale:S=5}){const k=Ie(),C=x.useRef(null),{boundingRect:N,viewBB:E,rfId:j,panZoom:A,translateExtent:T,flowWidth:D,flowHeight:F,ariaLabelConfig:P}=we(pG,Te),L=(e==null?void 0:e.width)??dG,I=(e==null?void 0:e.height)??fG,z=N.width/L,R=N.height/I,M=Math.max(z,R),O=M*L,V=M*I,$=S*M,K=N.x-(O-N.width)/2-$,B=N.y-(V-N.height)/2-$,U=O+$*2,G=V+$*2,W=`${mG}-${j}`,X=x.useRef(0),q=x.useRef();X.current=M,x.useEffect(()=>{if(C.current&&A)return q.current=RU({domNode:C.current,panZoom:A,getTransform:()=>k.getState().transform,getViewScale:()=>X.current}),()=>{var ne;(ne=q.current)==null||ne.destroy()}},[A]),x.useEffect(()=>{var ne;(ne=q.current)==null||ne.update({translateExtent:T,width:D,height:F,inversePan:w,pannable:b,zoomStep:y,zoomable:_})},[b,_,w,y,T,D,F]);const te=g?ne=>{var pe;const[ue,ye]=((pe=q.current)==null?void 0:pe.pointer(ne))||[0,0];g(ne,{x:ue,y:ye})}:void 0,ee=v?x.useCallback((ne,ue)=>{const ye=k.getState().nodeLookup.get(ue).internals.userNode;v(ne,ye)},[]):void 0,Q=m??P["minimap.ariaLabel"];return p.jsx(Gd,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*M:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:Ue(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:p.jsxs("svg",{width:L,height:I,viewBox:`${K} ${B} ${U} ${G}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":W,ref:C,onClick:te,children:[Q&&p.jsx("title",{id:W,children:Q}),p.jsx(uG,{onClick:ee,nodeColor:o,nodeStrokeColor:r,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:a,nodeComponent:l}),p.jsx("path",{className:"react-flow__minimap-mask",d:`M${K-$},${B-$}h${U+$*2}v${G+$*2}h${-U-$*2}z
|
|
438
|
-
M${E.x},${E.y}h${E.width}v${E.height}h${-E.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}KE.displayName="MiniMap";x.memo(KE);const gG=e=>n=>e?`${Math.max(1/n.transform[2],1)}`:void 0,vG={[Qi.Line]:"right",[Qi.Handle]:"bottom-right"};function yG({nodeId:e,position:n,variant:r=Qi.Handle,className:o,style:i=void 0,children:s,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:h,autoScale:g=!0,shouldResize:v,onResizeStart:b,onResize:_,onResizeEnd:m}){const w=EE(),y=typeof e=="string"?e:w,S=Ie(),k=x.useRef(null),C=r===Qi.Handle,N=we(x.useCallback(gG(C&&g),[C,g]),Te),E=x.useRef(null),j=n??vG[r];x.useEffect(()=>{if(!(!k.current||!y))return E.current||(E.current=WU({domNode:k.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:T,transform:D,snapGrid:F,snapToGrid:P,nodeOrigin:L,domNode:I}=S.getState();return{nodeLookup:T,transform:D,snapGrid:F,snapToGrid:P,nodeOrigin:L,paneDomNode:I}},onChange:(T,D)=>{const{triggerNodeChanges:F,nodeLookup:P,parentLookup:L,nodeOrigin:I}=S.getState(),z=[],R={x:T.x,y:T.y},M=P.get(y);if(M&&M.expandParent&&M.parentId){const O=M.origin??I,V=T.width??M.measured.width??0,$=T.height??M.measured.height??0,K={id:M.id,parentId:M.parentId,rect:{width:V,height:$,...qN({x:T.x??M.position.x,y:T.y??M.position.y},{width:V,height:$},M.parentId,P,O)}},B=u0([K],P,L,I);z.push(...B),R.x=T.x?Math.max(O[0]*V,T.x):void 0,R.y=T.y?Math.max(O[1]*$,T.y):void 0}if(R.x!==void 0&&R.y!==void 0){const O={id:y,type:"position",position:{...R}};z.push(O)}if(T.width!==void 0&&T.height!==void 0){const V={id:y,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:T.width,height:T.height}};z.push(V)}for(const O of D){const V={...O,type:"position"};z.push(V)}F(z)},onEnd:({width:T,height:D})=>{const F={id:y,type:"dimensions",resizing:!1,dimensions:{width:T,height:D}};S.getState().triggerNodeChanges([F])}})),E.current.update({controlPosition:j,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:f},keepAspectRatio:d,resizeDirection:h,onResizeStart:b,onResize:_,onResizeEnd:m,shouldResize:v}),()=>{var T;(T=E.current)==null||T.destroy()}},[j,l,c,u,f,d,b,_,m,v]);const A=j.split("-");return p.jsx("div",{className:Ue(["react-flow__resize-control","nodrag",...A,r,o]),ref:k,style:{...i,scale:N,...a&&{[C?"backgroundColor":"borderColor"]:a}},children:s})}x.memo(yG);const N1=3,ac={screen:0,hook:160,api:340,table:520},Yp=220,E1=40;function lc(e,n){const r=new Map,o=e.length,s=-(o*Yp+(o-1)*E1)/2;return e.forEach((a,l)=>{r.set(a,{x:s+l*(Yp+E1),y:n})}),r}function j1(e,n,r){const o=e.map(i=>{const a=(r.get(i)??[]).map(c=>{var u;return((u=n.get(c))==null?void 0:u.x)??0}),l=a.length>0?a.reduce((c,u)=>c+u,0)/a.length:0;return{id:i,avg:l}});return o.sort((i,s)=>i.avg-s.avg),o.map(i=>i.id)}function cc(e){const n={width:Yp,padding:"10px 12px",borderRadius:10,border:"1px solid rgba(255, 255, 255, 0.14)",background:"rgba(48, 50, 72, 0.96)",color:"#f2f2f6",fontSize:12,fontFamily:"inherit",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.4)"};return e==="screen"?{...n,borderColor:"rgba(139, 92, 246, 0.9)",background:"linear-gradient(135deg, rgba(139,92,246,0.45) 0%, rgba(58, 48, 90, 0.96) 100%)",boxShadow:"0 2px 14px rgba(139, 92, 246, 0.25)"}:e==="api"?{...n,borderColor:"rgba(139, 92, 246, 0.55)"}:e==="table"?{...n,borderColor:"rgba(34, 197, 94, 0.55)",background:"rgba(38, 58, 48, 0.96)"}:n}function uc(e,n,r){const o=e==="screen"?Ua:e==="hook"?YR:e==="api"?Zm:Qm;return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[p.jsx(o,{style:{width:12,height:12,opacity:.7}}),p.jsx("span",{style:{fontWeight:600},children:n})]}),r&&p.jsx("span",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:10,opacity:.7,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r})]})}function xG({screen:e,graphs:n,onNodeSelect:r,selectedNodeId:o}){const{nodes:i,edges:s,empty:a}=x.useMemo(()=>{if(!n.ui||!n.api||!n.db)return{nodes:[],edges:[],empty:!0};const m=new Map;for(const B of n.ui.edges)B.type==="imports"&&(m.has(B.source)||m.set(B.source,[]),m.get(B.source).push(B.target));const w=new Set([e.id]);{let B=[e.id];for(let U=0;U<N1&&B.length>0;U++){const G=[];for(const W of B)for(const X of m.get(W)??[])w.has(X)||(w.add(X),G.push(X));B=G}}const y=new Map;for(const B of n.ui.cross_refs??[])B.type!=="calls_api"&&B.type!=="references_api"||B.layer!=="api"||w.has(B.source)&&(y.has(B.source)||y.set(B.source,[]),y.get(B.source).push(B.target));const S=new Set;for(const B of y.values())for(const U of B)S.add(U);if(S.size===0)return{nodes:[],edges:[],empty:!0};const k=(m.get(e.id)??[]).filter(B=>B!==e.id),C=[],N=new Map;for(const B of k){const U=new Set([B]);let G=[B];for(let X=0;X<N1&&G.length>0;X++){const q=[];for(const te of G)for(const ee of m.get(te)??[])U.has(ee)||(U.add(ee),q.push(ee));G=q}const W=new Set;for(const X of U)for(const q of y.get(X)??[])W.add(q);W.size>0&&(C.push(B),N.set(B,W))}const E=new Set(y.get(e.id)??[]),j=n.api.nodes.filter(B=>S.has(B.id)),A=new Set,T=new Map;for(const B of j){const U=(B.db_models??[]).map(G=>G);T.set(B.id,U);for(const G of U)A.add(G)}const D=n.db.nodes.filter(B=>A.has(B.name)||A.has(B.name.toLowerCase())),F=new Map;for(const B of D)F.set(B.name,B.id),F.set(B.name.toLowerCase(),B.id);const P=[],L=[],I=lc([e.id],ac.screen);P.push({id:`screen:${e.id}`,position:I.get(e.id),data:{label:uc("screen",Kr(e),e.route??void 0)},style:cc("screen"),sourcePosition:"bottom",targetPosition:"top"});const z=[...C].sort((B,U)=>{const G=[...N.get(B)??[]],W=[...N.get(U)??[]],X=j.map(te=>te.id),q=te=>{const ee=te.map(Q=>X.indexOf(Q)).filter(Q=>Q>=0);return ee.length>0?ee.reduce((Q,ne)=>Q+ne,0)/ee.length:0};return q(G)-q(W)});if(z.length>0){const B=lc(z,ac.hook);for(const U of z){const G=U.split("/").pop()??U;P.push({id:`hook:${U}`,position:B.get(U),data:{label:uc("hook",G.replace(/\.tsx?$/,""),U)},style:cc("hook"),sourcePosition:"bottom",targetPosition:"top"}),L.push({id:`e:screen-${U}`,source:`screen:${e.id}`,target:`hook:${U}`,animated:!1,style:{stroke:"rgba(139,92,246,0.95)"}})}}const R=new Map;for(const B of C){const U=P.find(G=>G.id===`hook:${B}`);U&&R.set(B,U.position)}R.set(e.id,I.get(e.id));const M=new Map;for(const B of S){const U=[];E.has(B)&&U.push(e.id);for(const[G,W]of N.entries())W.has(B)&&U.push(G);M.set(B,U)}const O=j1(j.map(B=>B.id),R,M);if(O.length>0){const B=lc(O,ac.api);for(const U of j)P.push({id:`api:${U.id}`,position:B.get(U.id),data:{label:uc("api",`${U.methods.join(",")} ${U.path.split("/").pop()||"/"}`,U.path)},style:cc("api"),sourcePosition:"bottom",targetPosition:"top"});for(const U of E)S.has(U)&&L.push({id:`e:screen-api-${U}`,source:`screen:${e.id}`,target:`api:${U}`,style:{stroke:"rgba(139,92,246,0.95)"}});for(const[U,G]of N.entries())for(const W of G)L.push({id:`e:${U}-${W}`,source:`hook:${U}`,target:`api:${W}`,style:{stroke:"rgba(139,92,246,0.95)"}})}const V=new Map;for(const B of O){const U=P.find(G=>G.id===`api:${B}`);U&&V.set(B,U.position)}const $=new Map;for(const B of j){const U=T.get(B.id)??[];for(const G of U){const W=F.get(G)??F.get(G.toLowerCase());W&&($.has(W)||$.set(W,[]),$.get(W).push(B.id))}}const K=j1(D.map(B=>B.id),V,$);if(K.length>0){const B=lc(K,ac.table);for(const U of D)P.push({id:`table:${U.id}`,position:B.get(U.id),data:{label:uc("table",U.name)},style:cc("table"),sourcePosition:"bottom",targetPosition:"top"});for(const U of j){const G=T.get(U.id)??[];for(const W of G){const X=F.get(W)??F.get(W.toLowerCase());X&&L.push({id:`e:${U.id}-${X}`,source:`api:${U.id}`,target:`table:${X}`,style:{stroke:"rgba(34,197,94,0.95)"}})}}}return{nodes:P,edges:L,empty:!1}},[e,n]),l=x.useRef(null),c=i,u=s,f=x.useCallback(m=>{const w=l.current;if(!w)return;const y=new Set([m]),S=new Set;for(const k of s)k.source===m&&(y.add(k.target),S.add(k.id)),k.target===m&&(y.add(k.source),S.add(k.id));w.querySelectorAll(".react-flow__node").forEach(k=>{const C=k.getAttribute("data-id")??"";k.style.opacity=y.has(C)?"1":"0.15",k.style.transition="opacity 120ms ease"}),w.querySelectorAll(".react-flow__edge").forEach(k=>{const C=k.getAttribute("data-id")??"",N=S.has(C);k.style.opacity=N?"1":"0.08",k.style.transition="opacity 120ms ease",N&&k.classList.add("animated")})},[s]),d=x.useCallback(()=>{const m=l.current;m&&(m.querySelectorAll(".react-flow__node").forEach(w=>{w.style.opacity="",w.style.transition=""}),m.querySelectorAll(".react-flow__edge").forEach(w=>{w.style.opacity="",w.style.transition="",w.classList.remove("animated")}))},[]),h=x.useCallback((m,w)=>{f(w.id)},[f]),g=x.useCallback(()=>{d()},[d]),v=(m,w)=>{const[y,...S]=w.id.split(":"),k=S.join(":"),C={screen:"ui",hook:"ui",api:"api",table:"db"};r==null||r(k,C[y]??"ui")};if(a)return p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsxs("div",{className:"text-center",children:[p.jsx("h3",{className:"text-sm font-semibold text-foreground",children:Kr(e)}),p.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"No API or database dependencies detected for this screen."})]})});const{focusedNodes:b,focusedEdges:_}=x.useMemo(()=>{var k;if(!o)return{focusedNodes:c,focusedEdges:u};const m=(k=c.find(C=>{const[,...N]=C.id.split(":");return N.join(":")===o}))==null?void 0:k.id;if(!m)return{focusedNodes:c,focusedEdges:u};const w=new Set([m]);for(const C of u)C.source===m&&w.add(C.target),C.target===m&&w.add(C.source);const y=c.filter(C=>w.has(C.id)),S=u.filter(C=>w.has(C.source)&&w.has(C.target));return{focusedNodes:y,focusedEdges:S}},[c,u,o]);return p.jsx("div",{ref:l,className:"relative h-full w-full",children:p.jsx(Kd,{children:p.jsxs(h0,{nodes:b,edges:_,fitView:!0,fitViewOptions:{padding:.3},proOptions:{hideAttribution:!0},minZoom:.2,maxZoom:1.5,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,onNodeMouseEnter:h,onNodeMouseLeave:g,onNodeClick:v,children:[p.jsx(p0,{color:"rgba(255,255,255,0.05)",gap:24}),p.jsx(m0,{showInteractive:!1})]},o??"full")})})}const Oc=220,P1=40,wG=110,bG=0,_G=180,ni=6;function M1(e){const n={width:Oc,padding:"10px 12px",borderRadius:10,border:"1px solid rgba(255, 255, 255, 0.14)",background:"rgba(48, 50, 72, 0.96)",color:"#f2f2f6",fontSize:12,fontFamily:"inherit",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.4)"};return e?{...n,borderColor:"rgba(139, 92, 246, 0.9)",background:"linear-gradient(135deg, rgba(139,92,246,0.45) 0%, rgba(58, 48, 90, 0.96) 100%)",boxShadow:"0 2px 14px rgba(139, 92, 246, 0.25)"}:{...n,cursor:"pointer"}}function R1(e,n,r){const o=r?ld:Ua;return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[p.jsx(o,{style:{width:12,height:12,opacity:.7}}),p.jsx("span",{style:{fontWeight:600},children:e})]}),n&&p.jsx("span",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:10,opacity:.7,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]})}function SG({module:e,screens:n,onScreenClick:r}){const{nodes:o,edges:i}=x.useMemo(()=>{const a=[],l=[];Math.max(1,Math.ceil(n.length/ni)),Math.min(ni,n.length);const c=0;return a.push({id:`module:${e}`,position:{x:c-Oc/2,y:bG},data:{label:R1(Aa(e),`${n.length} screens`,!0)},style:M1(!0),sourcePosition:"bottom",targetPosition:"top",selectable:!1,draggable:!1}),n.forEach((u,f)=>{const d=Math.floor(f/ni),h=f%ni,g=Math.min(ni,n.length-d*ni),v=g*Oc+(g-1)*P1,_=c-v/2+h*(Oc+P1),m=_G+d*wG;a.push({id:`screen:${u.id}`,position:{x:_,y:m},data:{label:R1(Kr(u),u.route??void 0,!1),screenId:u.id},style:M1(!1),sourcePosition:"bottom",targetPosition:"top",draggable:!1}),l.push({id:`e:module-${u.id}`,source:`module:${e}`,target:`screen:${u.id}`,style:{stroke:"rgba(139,92,246,0.95)"}})}),{nodes:a,edges:l}},[e,n]),s=(a,l)=>{const c=l.data.screenId;c&&r(c)};return p.jsx("div",{className:"h-full w-full",children:p.jsx(Kd,{children:p.jsxs(h0,{nodes:o,edges:i,fitView:!0,fitViewOptions:{padding:.2},proOptions:{hideAttribution:!0},minZoom:.2,maxZoom:1.5,nodesConnectable:!1,onNodeClick:s,children:[p.jsx(p0,{color:"rgba(255,255,255,0.05)",gap:24}),p.jsx(m0,{showInteractive:!1})]})})})}function kG(e,n,r){var o;if(n==="ui"&&r.ui){const i=r.ui.nodes.find(s=>s.id===e);if(i)return{id:i.id,name:i.name,type:i.type,layer:n,route:i.route,module:((o=i.tags)==null?void 0:o.module)??i.module??null,exports:i.exports,tags:i.tags}}if(n==="api"&&r.api){const i=r.api.nodes.find(s=>s.id===e);if(i)return{id:i.id,name:i.name,type:i.type,layer:n,methods:i.methods,path:i.path,db_models:i.db_models,tags:i.tags}}if(n==="db"&&r.db){const i=r.db.nodes.find(s=>s.id===e);if(i)return{id:i.id,name:i.name,type:i.type,layer:n,columns:i.columns,tags:i.tags}}return null}function CG(e,n,r){const o=[];if(n==="ui"&&r.ui)for(const i of r.ui.edges){if(i.source===e){const s=r.ui.nodes.find(a=>a.id===i.target);s&&o.push({nodeId:i.target,nodeName:s.name,edgeType:i.type,direction:"outgoing"})}if(i.target===e){const s=r.ui.nodes.find(a=>a.id===i.source);s&&o.push({nodeId:i.source,nodeName:s.name,edgeType:i.type,direction:"incoming"})}}return o}function NG(e,n){const r=[],o=[];if(!n.ui)return{to:r,from:o};for(const i of n.ui.edges)if(i.type==="navigates"){if(i.source===e){const s=n.ui.nodes.find(a=>a.id===i.target);s&&r.push(s)}if(i.target===e){const s=n.ui.nodes.find(a=>a.id===i.source);s&&o.push(s)}}return{to:r,from:o}}const EG={ui:Ua,api:Zm,db:Qm},jG={page:"bg-violet-500/20 text-violet-300",layout:"bg-indigo-500/20 text-indigo-300",component:"bg-blue-500/20 text-blue-300",hook:"bg-sky-500/20 text-sky-300",context:"bg-teal-500/20 text-teal-300",util:"bg-slate-500/20 text-slate-300",config:"bg-amber-500/20 text-amber-300",endpoint:"bg-violet-500/20 text-violet-300",table:"bg-emerald-500/20 text-emerald-300",enum:"bg-orange-500/20 text-orange-300"};function PG({type:e}){const n=jG[e]??"bg-zinc-500/20 text-zinc-300";return p.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider ${n}`,children:e})}function ri({children:e}){return p.jsx("h3",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-slate-400",children:e})}function dc({label:e,edges:n,icon:r,onNavigate:o}){return n.length===0?null:p.jsxs("div",{className:"mb-3",children:[p.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-slate-500",children:[p.jsx(r,{className:"h-3 w-3"}),e,p.jsxs("span",{className:"text-slate-600",children:["(",n.length,")"]})]}),p.jsx("ul",{className:"space-y-0.5",children:n.map(i=>p.jsx("li",{children:p.jsxs("button",{type:"button",onClick:()=>o(i.nodeId),className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-slate-300 transition-colors hover:bg-slate-700/50 hover:text-slate-100",children:[p.jsx(Fi,{className:"h-3 w-3 shrink-0 text-slate-500"}),p.jsx("span",{className:"truncate",children:i.nodeName}),p.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-slate-600",children:i.edgeType})]})},`${i.direction}-${i.edgeType}-${i.nodeId}`))})]})}function MG({filePath:e}){const[n,r]=x.useState(null),[o,i]=x.useState(!0),[s,a]=x.useState(null),l=Go();if(x.useEffect(()=>{i(!0),a(null),r(null);const u=[e];e.startsWith("src/")||u.push(`src/${e}`);async function f(){for(const d of u)try{const h=await fetch(l("/api/file-content",{path:d}));if(!h.ok)continue;const g=await h.json();r(g.content),i(!1);return}catch{continue}a("File not found"),i(!1)}f()},[e]),o)return p.jsx("p",{className:"px-3 py-2 text-xs text-slate-500",children:"Loading source..."});if(s)return p.jsxs("p",{className:"px-3 py-2 text-xs text-red-400",children:["Failed to load: ",s]});if(!n)return null;const c=n.split(`
|
|
439
|
-
`);return p.jsx("div",{className:"overflow-auto rounded border border-slate-700/50 bg-slate-900/80",children:p.jsx("pre",{className:"p-3 text-[11px] leading-[1.6]",children:p.jsx("code",{children:c.map((u,f)=>p.jsxs("div",{className:"flex",children:[p.jsx("span",{className:"mr-4 inline-block w-8 select-none text-right text-slate-600",children:f+1}),p.jsx("span",{className:"flex-1 text-slate-300",children:u||" "})]},f))})})})}function qE({nodeId:e,nodeLayer:n,graphs:r,onClose:o,onNavigate:i}){const s=kG(e,n,r),a=CG(e,n,r),l=n==="ui"?NG(e,r):{to:[],from:[]},c=a.filter(v=>v.edgeType==="renders"&&v.direction==="outgoing"),u=a.filter(v=>v.edgeType==="renders"&&v.direction==="incoming"),f=a.filter(v=>v.edgeType==="imports"&&v.direction==="outgoing"),d=a.filter(v=>v.edgeType==="imports"&&v.direction==="incoming");if(!s)return p.jsx("div",{className:"flex h-full flex-col bg-slate-900/95",children:p.jsxs("div",{className:"flex items-center justify-between border-b border-slate-700/50 px-4 py-3",children:[p.jsx("span",{className:"text-sm text-slate-400",children:"Node not found"}),p.jsx("button",{type:"button",onClick:o,className:"rounded p-1 hover:bg-slate-700/50",children:p.jsx(uu,{className:"h-4 w-4 text-slate-400"})})]})});const h=EG[n],g=v=>i(v,"ui");return p.jsxs("div",{className:"flex h-full flex-col bg-slate-900/95 overflow-hidden",children:[p.jsxs("div",{className:"flex items-center gap-3 border-b border-slate-700/50 px-5 py-4",children:[p.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-slate-800",children:p.jsx(h,{className:"h-4 w-4 text-slate-400"})}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h2",{className:"truncate text-sm font-semibold text-slate-100",children:s.name}),p.jsx(PG,{type:s.type})]}),p.jsx("p",{className:"mt-0.5 truncate font-mono text-[10px] text-slate-500",children:s.id})]}),p.jsx("button",{type:"button",onClick:o,className:"rounded-md p-1.5 text-slate-400 transition-colors hover:bg-slate-700/50 hover:text-slate-200",children:p.jsx(uu,{className:"h-4 w-4"})})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-5",children:[p.jsxs("section",{children:[p.jsx(ri,{children:"Info"}),p.jsxs("div",{className:"space-y-1.5 text-xs",children:[s.module&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-16 shrink-0 text-slate-500",children:"Module"}),p.jsx("span",{className:`text-slate-300 ${s.module==="untagged"?"text-yellow-500/70 italic":""}`,children:s.module})]}),s.route&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-16 shrink-0 text-slate-500",children:"Route"}),p.jsx("span",{className:"font-mono text-slate-300",children:s.route})]}),s.methods&&s.methods.length>0&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-16 shrink-0 text-slate-500",children:"Methods"}),p.jsx("span",{className:"flex gap-1",children:s.methods.map(v=>p.jsx("span",{className:"rounded bg-violet-500/15 px-1.5 py-0.5 font-mono text-[10px] text-violet-300",children:v},v))})]}),s.path&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-16 shrink-0 text-slate-500",children:"Path"}),p.jsx("span",{className:"font-mono text-slate-300",children:s.path})]}),s.exports&&s.exports.length>0&&p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx("span",{className:"w-16 shrink-0 pt-0.5 text-slate-500",children:"Exports"}),p.jsx("div",{className:"flex flex-wrap gap-1",children:s.exports.map(v=>p.jsx("span",{className:"rounded bg-slate-700/50 px-1.5 py-0.5 font-mono text-[10px] text-slate-300",children:v},v))})]}),s.db_models&&s.db_models.length>0&&p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx("span",{className:"w-16 shrink-0 pt-0.5 text-slate-500",children:"Models"}),p.jsx("div",{className:"flex flex-wrap gap-1",children:s.db_models.map(v=>p.jsx("span",{className:"rounded bg-emerald-500/15 px-1.5 py-0.5 font-mono text-[10px] text-emerald-300",children:v},v))})]})]})]}),s.tags&&Object.keys(s.tags).length>0&&p.jsxs("section",{children:[p.jsx(ri,{children:"Tags"}),p.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(s.tags).map(([v,b])=>p.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] ${v==="module"||v==="screen"?"bg-purple-500/15 text-purple-300":"bg-sky-500/15 text-sky-300"}`,children:[p.jsxs("span",{className:"font-medium",children:[v,":"]}),p.jsx("span",{children:b})]},v))})]}),s.columns&&s.columns.length>0&&p.jsxs("section",{children:[p.jsx(ri,{children:"Columns"}),p.jsx("div",{className:"overflow-hidden rounded border border-slate-700/50",children:p.jsxs("table",{className:"w-full text-xs",children:[p.jsx("thead",{children:p.jsxs("tr",{className:"border-b border-slate-700/50 bg-slate-800/50",children:[p.jsx("th",{className:"px-3 py-1.5 text-left font-medium text-slate-400",children:"Name"}),p.jsx("th",{className:"px-3 py-1.5 text-left font-medium text-slate-400",children:"Type"})]})}),p.jsx("tbody",{children:s.columns.map(v=>p.jsxs("tr",{className:"border-b border-slate-800/50 last:border-0",children:[p.jsx("td",{className:"px-3 py-1.5 font-mono text-slate-300",children:v.name}),p.jsx("td",{className:"px-3 py-1.5 font-mono text-slate-500",children:v.type})]},v.name))})]})})]}),(c.length>0||u.length>0||f.length>0||d.length>0)&&p.jsxs("section",{children:[p.jsx(ri,{children:"Component Tree"}),p.jsx(dc,{label:"Renders",edges:c,icon:RR,onNavigate:g}),p.jsx(dc,{label:"Rendered by",edges:u,icon:Km,onNavigate:g}),p.jsx(dc,{label:"Imports",edges:f,icon:ny,onNavigate:g}),p.jsx(dc,{label:"Imported by",edges:d,icon:ny,onNavigate:g})]}),(l.to.length>0||l.from.length>0)&&p.jsxs("section",{children:[p.jsx(ri,{children:"Navigation"}),l.to.length>0&&p.jsxs("div",{className:"mb-3",children:[p.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-slate-500",children:[p.jsx(ty,{className:"h-3 w-3"}),"Navigates to",p.jsxs("span",{className:"text-slate-600",children:["(",l.to.length,")"]})]}),p.jsx("ul",{className:"space-y-0.5",children:l.to.map(v=>p.jsx("li",{children:p.jsxs("button",{type:"button",onClick:()=>g(v.id),className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-slate-300 transition-colors hover:bg-slate-700/50 hover:text-slate-100",children:[p.jsx(Fi,{className:"h-3 w-3 shrink-0 text-slate-500"}),p.jsx("span",{className:"truncate",children:v.name}),v.route&&p.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-slate-600",children:v.route})]})},v.id))})]}),l.from.length>0&&p.jsxs("div",{className:"mb-3",children:[p.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-slate-500",children:[p.jsx(ty,{className:"h-3 w-3"}),"Navigated from",p.jsxs("span",{className:"text-slate-600",children:["(",l.from.length,")"]})]}),p.jsx("ul",{className:"space-y-0.5",children:l.from.map(v=>p.jsx("li",{children:p.jsxs("button",{type:"button",onClick:()=>g(v.id),className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-slate-300 transition-colors hover:bg-slate-700/50 hover:text-slate-100",children:[p.jsx(Fi,{className:"h-3 w-3 shrink-0 text-slate-500"}),p.jsx("span",{className:"truncate",children:v.name}),v.route&&p.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-slate-600",children:v.route})]})},v.id))})]})]}),p.jsxs("section",{children:[p.jsx(ri,{children:"Source Code"}),p.jsx(MG,{filePath:s.id})]})]})]})}function RG(){var w;const[e,n]=x.useState(null),[r,o]=x.useState(null),[i,s]=x.useState(null),[a,l]=x.useState(null),[c,u]=x.useState(null),[f,d]=x.useState("ui"),h=Go();x.useEffect(()=>{fetch(h("/api/raw-graphs")).then(y=>{if(!y.ok)throw new Error(`HTTP ${y.status}`);return y.json()}).then(y=>n(y)).catch(y=>o(String(y)))},[h]);const g=x.useMemo(()=>e!=null&&e.ui?e.ui.nodes.filter(y=>t0(y)&&er(y)):[],[e]),v=x.useMemo(()=>{const y=new Map;for(const N of g){const E=er(N);y.has(E)||y.set(E,[]),y.get(E).push(N)}const S=[],k=new Map;for(const[N,E]of y)E.length===1?S.push(...E):k.set(N,E);const C=[...k.entries()].map(([N,E])=>({module:N,screens:E})).sort((N,E)=>E.screens.length-N.screens.length);return S.length>0&&C.push({module:"misc",screens:S}),C.sort((N,E)=>N.module==="untagged"?1:E.module==="untagged"?-1:N.module==="misc"?1:E.module==="misc"?-1:E.screens.length-N.screens.length),C},[g]),b=i??((w=v[0])==null?void 0:w.module)??null,_=x.useMemo(()=>{var y;return b?((y=v.find(S=>S.module===b))==null?void 0:y.screens)??[]:[]},[v,b]),m=x.useMemo(()=>!(e!=null&&e.ui)||!a?null:e.ui.nodes.find(y=>y.id===a)??null,[e,a]);return r?p.jsx(TG,{message:r}):e?p.jsxs("div",{className:"flex h-full min-h-0",children:[p.jsxs("div",{className:`flex w-64 flex-col border-r border-sidebar-border bg-sidebar-background/40 ${c?"hidden":""}`,children:[p.jsxs("div",{className:"border-b border-sidebar-border px-4 py-3",children:[p.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Modules"}),p.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[v.length," modules · ",g.length," screens"]})]}),p.jsx("ul",{className:"flex-1 overflow-y-auto px-2 py-2",children:v.map(y=>{const S=y.module===b;return p.jsx("li",{children:p.jsxs("button",{type:"button",onClick:()=>{s(y.module),l(null),u(null)},className:`flex w-full items-center justify-between rounded-md px-3 py-2 text-sm transition-colors ${S?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"} ${y.module==="untagged"?"border border-dashed border-yellow-500/30":""}`,children:[p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(Ua,{className:`h-3.5 w-3.5 shrink-0 ${y.module==="untagged"?"text-yellow-500/70":"opacity-70"}`}),Aa(y.module)]}),p.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:y.screens.length})]})},y.module)})})]}),p.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:m?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-3 border-b border-sidebar-border px-6 py-4",children:[p.jsxs("button",{type:"button",onClick:()=>{l(null),u(null)},className:"flex items-center gap-1.5 rounded-md border border-sidebar-border px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-foreground",children:[p.jsx(Km,{className:"h-3 w-3"}),"Back"]}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h1",{className:"truncate text-lg font-semibold text-foreground",children:Kr(m)}),m.route&&p.jsx("p",{className:"mt-0.5 truncate font-mono text-[11px] text-muted-foreground",children:m.route})]})]}),p.jsx("div",{className:"flex-1 min-h-0",children:p.jsx(xG,{screen:m,graphs:e,selectedNodeId:c,onNodeSelect:(y,S)=>{u(y),d(S)}})})]}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"border-b border-sidebar-border px-6 py-4",children:[p.jsx("h1",{className:"text-lg font-semibold text-foreground",children:b?Aa(b):"Select a module"}),p.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:[_.length," screens · click a screen to drill in"]})]}),p.jsx("div",{className:"flex-1 min-h-0",children:b&&_.length>0?p.jsx(SG,{module:b,screens:_,onScreenClick:l},b):p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx("p",{className:"text-sm text-muted-foreground",children:b?"No screens in this module.":"Select a module."})})})]})}),c&&e&&p.jsx("div",{className:"flex w-[420px] shrink-0 flex-col border-l border-sidebar-border bg-slate-900/95",children:p.jsx(qE,{nodeId:c,nodeLayer:f,graphs:e,onClose:()=>u(null),onNavigate:(y,S)=>{u(y),d(S)}})})]}):p.jsx(AG,{})}function AG(){return p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading graph data…"})})}function TG({message:e}){return p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsxs("div",{className:"max-w-md text-center",children:[p.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Failed to load graph"}),p.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:e})]})})}function IG(){return p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsxs("div",{className:"text-center",children:[p.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"User Journeys"}),p.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"User journey flowcharts coming soon."})]})})}const OG={admin:"#8b5cf6",auth:"#f59e0b",settings:"#6366f1",project:"#3b82f6",org:"#10b981",root:"#64748b",misc:"#94a3b8"};function Fu(e){return e?OG[e]??`hsl(${Math.abs($G(e))%360}, 60%, 55%)`:"#64748b"}function $G(e){let n=0;for(let r=0;r<e.length;r++)n=Math.imul(31,n)+e.charCodeAt(r)|0;return n}function DG(e){const n=e.ui.nodes.filter(l=>t0(l)),r=new Set(n.map(l=>l.id)),o=new Map;for(const l of e.ui.edges)(l.type==="imports"||l.type==="renders")&&(o.has(l.target)||o.set(l.target,new Set),o.get(l.target).add(l.source));function i(l){const c=new Set,u=new Set,f=[l];for(;f.length>0;){const d=f.pop();if(!u.has(d)){if(u.add(d),r.has(d)){c.add(d);continue}for(const h of o.get(d)??[])f.push(h)}}return c}const s=new Map,a=new Map;for(const l of e.ui.edges){if(l.type!=="navigates"||!r.has(l.target))continue;const c=r.has(l.source)?[l.source]:[...i(l.source)];for(const u of c)u!==l.target&&(s.has(u)||s.set(u,new Set),s.get(u).add(l.target),a.has(l.target)||a.set(l.target,new Set),a.get(l.target).add(u))}return{screens:n,screenIdSet:r,outgoing:s,incoming:a}}function LG(e){const n={segment:"/",fullRoute:"/",screen:null,children:[]},r=[...e].sort((o,i)=>(o.route??"").split("/").length-(i.route??"").split("/").length);for(const o of r){if(!o.route)continue;if(o.route==="/"){n.screen=o;continue}const i=o.route.split("/").filter(Boolean);let s=n;for(let a=0;a<i.length;a++){const l=i[a],c="/"+i.slice(0,a+1).join("/");let u=s.children.find(f=>f.segment===l);u||(u={segment:l,fullRoute:c,screen:null,children:[]},s.children.push(u)),s=u}s.screen=o}return n}function g0({node:e,depth:n,onSelect:r,selectedId:o}){var f;const[i,s]=x.useState(n<2),a=e.children.length>0,l=e.screen?er(e.screen):null,c=Fu(l),u=((f=e.screen)==null?void 0:f.id)===o;return p.jsxs("div",{children:[p.jsxs("div",{className:`flex items-center gap-1 py-0.5 px-1.5 rounded transition-colors cursor-pointer text-xs ${u?"bg-purple-500/20 text-foreground":"text-muted-foreground hover:bg-white/5 hover:text-foreground"}`,style:{paddingLeft:n*14+4},onClick:()=>{e.screen&&r(e.screen.id),a&&s(!i)},children:[a?p.jsx("button",{onClick:d=>{d.stopPropagation(),s(!i)},className:"p-0.5 shrink-0",children:i?p.jsx(cd,{className:"h-2.5 w-2.5"}):p.jsx(Fi,{className:"h-2.5 w-2.5"})}):p.jsx("span",{className:"w-3.5"}),e.screen&&p.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:c}}),p.jsx("span",{className:"truncate",children:e.screen?Kr(e.screen):e.segment})]}),i&&a&&e.children.sort((d,h)=>d.segment.localeCompare(h.segment)).map(d=>p.jsx(g0,{node:d,depth:n+1,onSelect:r,selectedId:o},d.fullRoute))]})}const oh=200,en=200,fc=56,A1=120,oi=30;function zG({focusId:e,screens:n,outgoing:r,incoming:o,onNavigate:i,onDetail:s}){var y,S;const a=x.useRef(null),l=x.useMemo(()=>new Map(n.map(k=>[k.id,k])),[n]),c=l.get(e),{flowNodes:u,flowEdges:f}=x.useMemo(()=>{var P;if(!c)return{flowNodes:[],flowEdges:[]};const k=[...r.get(e)??[]].filter(L=>l.has(L)),C=[...o.get(e)??[]].filter(L=>l.has(L)),N=[],E=[],j=(L,I,z,R)=>{const M=l.get(L),O=er(M),V=Fu(O);return{id:L,position:{x:I,y:z},data:{label:p.jsxs("div",{style:{pointerEvents:"none"},children:[p.jsx("div",{style:{fontWeight:R?700:500,fontSize:R?13:11,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Kr(M)}),p.jsx("div",{style:{fontSize:9,opacity:.5,marginTop:2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:M.route}),O&&O!=="root"&&p.jsx("div",{style:{fontSize:8,marginTop:2,color:V,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:500},children:Aa(O)})]})},style:{width:R?en+40:en,height:R?fc+10:fc,background:R?`linear-gradient(135deg, ${V}30, ${V}15)`:`linear-gradient(135deg, ${V}15, ${V}08)`,border:`${R?2:1}px solid ${V}${R?"80":"40"}`,borderRadius:10,padding:"8px 12px",color:"#e2e8f0",cursor:R?"default":"pointer",boxShadow:R?`0 0 20px ${V}20`:"none"},sourcePosition:"bottom",targetPosition:"top"}},T=-(C.length*(en+oi)-oi)/2+en/2;for(let L=0;L<C.length;L++){const I=C[L];N.push(j(I,T+L*(en+oi)-en/2,oh-A1-fc,!1));const z=((P=r.get(e))==null?void 0:P.has(I))??!1;E.push({id:`in-${I}`,source:I,target:e,type:"smoothstep",animated:!0,style:{stroke:z?"rgba(251,191,36,0.5)":"rgba(139,92,246,0.5)",strokeWidth:1.5,strokeDasharray:z?"4 4":void 0},markerEnd:{type:"arrowclosed",color:z?"rgba(251,191,36,0.7)":"rgba(139,92,246,0.7)"},label:z?"↺":void 0,labelStyle:{fontSize:12,fill:"#fbbf24"}})}N.push(j(e,-en/2-20,oh,!0));const F=-(k.length*(en+oi)-oi)/2+en/2;for(let L=0;L<k.length;L++){const I=k[L];C.includes(I)||(N.push(j(I,F+L*(en+oi)-en/2,oh+A1+fc+10,!1)),E.push({id:`out-${I}`,source:e,target:I,type:"smoothstep",animated:!0,style:{stroke:"rgba(139,92,246,0.5)",strokeWidth:1.5},markerEnd:{type:"arrowclosed",color:"rgba(139,92,246,0.7)"}}))}return{flowNodes:N,flowEdges:E}},[e,c,l,r,o]),d=x.useCallback(k=>{const C=a.current;if(!C)return;const N=new Set([k]),E=new Set;for(const j of f)j.source===k&&(N.add(j.target),E.add(j.id)),j.target===k&&(N.add(j.source),E.add(j.id));C.querySelectorAll(".react-flow__node").forEach(j=>{j.style.opacity=N.has(j.getAttribute("data-id")??"")?"1":"0.25",j.style.transition="opacity 120ms ease"}),C.querySelectorAll(".react-flow__edge").forEach(j=>{const A=j.getAttribute("data-id")??"";j.style.opacity=E.has(A)?"1":"0.1",j.style.transition="opacity 120ms ease"})},[f]),h=x.useCallback(()=>{const k=a.current;k&&(k.querySelectorAll(".react-flow__node").forEach(C=>{C.style.opacity="",C.style.transition=""}),k.querySelectorAll(".react-flow__edge").forEach(C=>{C.style.opacity="",C.style.transition=""}))},[]),g=x.useCallback((k,C)=>{C.id!==e&&d(C.id)},[d,e]),v=x.useCallback(()=>h(),[h]),b=x.useCallback((k,C)=>{C.id!==e&&i(C.id)},[e,i]),_=x.useCallback((k,C)=>s(C.id),[s]);if(!c)return null;const m=((y=o.get(e))==null?void 0:y.size)??0,w=((S=r.get(e))==null?void 0:S.size)??0;return p.jsxs("div",{className:"flex flex-1 flex-col min-h-0",children:[p.jsxs("div",{className:"px-5 py-3 border-b border-sidebar-border/50",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:Fu(er(c))}}),p.jsx("h2",{className:"text-sm font-semibold text-foreground",children:Kr(c)}),p.jsx("span",{className:"font-mono text-[10px] text-muted-foreground/50",children:c.route})]}),p.jsxs("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:[m," incoming · ",w," outgoing",m===0&&w===0&&" · no navigation links detected",p.jsx("span",{className:"ml-2 opacity-50",children:"click to navigate · double-click for details"})]})]}),p.jsx("div",{ref:a,className:"flex-1 min-h-0",children:p.jsx(Kd,{children:p.jsxs(h0,{nodes:u,edges:f,fitView:!0,fitViewOptions:{padding:.4},proOptions:{hideAttribution:!0},minZoom:.3,maxZoom:1.5,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,onNodeMouseEnter:g,onNodeMouseLeave:v,onNodeClick:b,onNodeDoubleClick:_,children:[p.jsx(p0,{color:"rgba(255,255,255,0.03)",gap:24}),p.jsx(m0,{showInteractive:!1})]},e)})})]})}function FG({tree:e,noRouteScreens:n,onSelect:r,selectedId:o}){return p.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:[p.jsx(g0,{node:e,depth:0,onSelect:r,selectedId:o}),n.length>0&&p.jsxs("div",{className:"mt-4 pt-3 border-t border-sidebar-border",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1.5 px-1.5",children:[p.jsx(Jm,{className:"h-3 w-3 text-yellow-500/70"}),p.jsxs("span",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wider",children:["Layouts (",n.length,")"]})]}),n.map(i=>p.jsxs("button",{onClick:()=>r(i.id),className:`flex items-center gap-1.5 w-full px-3 py-0.5 rounded text-xs transition-colors ${o===i.id?"bg-purple-500/15 text-foreground":"text-muted-foreground hover:bg-white/5"}`,children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:Fu(er(i))}}),i.name]},i.id))]})]})}function BG(){const[e,n]=x.useState(null),[r,o]=x.useState(null),[i,s]=x.useState(null),[a,l]=x.useState(null),[c,u]=x.useState("visual"),[f,d]=x.useState([]),h=Go();x.useEffect(()=>{fetch(h("/api/raw-graphs")).then(k=>{if(!k.ok)throw new Error(`HTTP ${k.status}`);return k.json()}).then(k=>n(k)).catch(k=>o(String(k)))},[h]);const{screens:g,outgoing:v,incoming:b,tree:_,noRouteScreens:m,navCount:w}=x.useMemo(()=>{if(!(e!=null&&e.ui))return{screens:[],outgoing:new Map,incoming:new Map,tree:null,noRouteScreens:[],navCount:0};const k=DG(e),C=k.screens.filter(j=>j.route),N=k.screens.filter(j=>!j.route);let E=0;for(const j of k.outgoing.values())E+=j.size;return{screens:k.screens,outgoing:k.outgoing,incoming:k.incoming,tree:LG(C),noRouteScreens:N,navCount:E}},[e]);x.useEffect(()=>{if(!i&&g.length>0){const k=g.find(C=>C.route==="/");s((k==null?void 0:k.id)??g[0].id)}},[g,i]);const y=x.useCallback(k=>{d(C=>i?[...C,i]:C),s(k)},[i]),S=x.useCallback(()=>{d(k=>{const C=[...k],N=C.pop();return N&&s(N),C})},[]);return r?p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx("p",{className:"text-sm text-red-400",children:r})}):!e||!_?p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):p.jsxs("div",{className:"flex h-full min-h-0",children:[p.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[p.jsxs("div",{className:"border-b border-sidebar-border px-6 py-3 flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[c==="visual"&&f.length>0&&p.jsx("button",{onClick:S,className:"p-1 rounded-md hover:bg-white/10 text-muted-foreground hover:text-foreground transition-colors",children:p.jsx(Km,{className:"h-4 w-4"})}),p.jsx(aA,{className:"h-5 w-5 text-muted-foreground"}),p.jsxs("div",{children:[p.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Sitemap"}),p.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:[g.filter(k=>k.route).length," screens · ",w," links"]})]})]}),p.jsxs("div",{className:"flex items-center gap-1 bg-muted/30 rounded-lg p-0.5",children:[p.jsxs("button",{onClick:()=>u("visual"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${c==="visual"?"bg-purple-600 text-white":"text-muted-foreground hover:text-foreground"}`,children:[p.jsx(QR,{className:"h-3.5 w-3.5"}),"Visual"]}),p.jsxs("button",{onClick:()=>u("list"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${c==="list"?"bg-purple-600 text-white":"text-muted-foreground hover:text-foreground"}`,children:[p.jsx(iA,{className:"h-3.5 w-3.5"}),"List"]})]})]}),c==="list"?p.jsx(FG,{tree:_,noRouteScreens:m,onSelect:k=>{s(k),u("visual")},selectedId:i}):i?p.jsx(zG,{focusId:i,screens:g,outgoing:v,incoming:b,onNavigate:y,onDetail:l}):null]}),c==="visual"&&p.jsxs("div",{className:"w-56 shrink-0 border-l border-sidebar-border overflow-y-auto bg-sidebar-background/30",children:[p.jsx("div",{className:"px-3 py-2 border-b border-sidebar-border/50",children:p.jsx("h3",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"All Screens"})}),p.jsx("div",{className:"py-1",children:p.jsx(g0,{node:_,depth:0,onSelect:y,selectedId:i})})]}),a&&e&&p.jsx("div",{className:"flex w-[400px] shrink-0 flex-col border-l border-sidebar-border bg-slate-900/95",children:p.jsx(qE,{nodeId:a,nodeLayer:"ui",graphs:e,onClose:()=>l(null),onNavigate:k=>{l(null),y(k)}})})]})}function T1({onSelect:e,onClose:n,buildUrl:r}){const[o,i]=x.useState(null),[s,a]=x.useState(!0),l=x.useCallback(async c=>{a(!0);try{const u=await fetch(r("/api/browse-dir",c?{path:c}:void 0));if(!u.ok)throw new Error(`HTTP ${u.status}`);i(await u.json())}catch{}finally{a(!1)}},[]);return x.useEffect(()=>{l()},[l]),o?p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:n,children:p.jsxs("div",{className:"bg-card border border-border rounded-xl w-[480px] max-h-[70vh] flex flex-col",onClick:c=>c.stopPropagation(),children:[p.jsxs("div",{className:"p-4 border-b border-border/50",children:[p.jsx("h3",{className:"text-sm font-semibold mb-1",children:"Select App Directory"}),p.jsx("code",{className:"text-xs text-muted-foreground break-all",children:o.current})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto p-2 min-h-[200px]",children:[s&&p.jsx("div",{className:"text-xs text-muted-foreground p-2",children:"Loading..."}),o.parent&&p.jsxs("button",{onClick:()=>l(o.parent),className:"flex items-center gap-2 w-full px-3 py-2 rounded-lg text-sm text-muted-foreground hover:bg-muted/50 transition-colors",children:[p.jsx(ey,{className:"h-4 w-4 shrink-0"}),".."]}),o.dirs.map(c=>p.jsxs("button",{onClick:()=>l(`${o.current}/${c}`),className:"flex items-center gap-2 w-full px-3 py-2 rounded-lg text-sm hover:bg-muted/50 transition-colors text-left",children:[p.jsx(ey,{className:"h-4 w-4 shrink-0 text-purple-400"}),c,p.jsx(Fi,{className:"h-3 w-3 ml-auto text-muted-foreground"})]},c)),o.dirs.length===0&&!o.parent&&p.jsx("div",{className:"text-xs text-muted-foreground p-3",children:"No subdirectories"})]}),p.jsxs("div",{className:"p-3 border-t border-border/50 flex items-center justify-between",children:[p.jsx("span",{className:"text-xs text-muted-foreground",children:o.relative==="."?"(project root)":o.relative}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:n,className:"px-3 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors",children:"Cancel"}),p.jsx("button",{onClick:()=>e(o.relative==="."?".":o.relative),className:"px-3 py-1.5 text-sm rounded-lg bg-purple-600 hover:bg-purple-500 text-white font-medium transition-colors",children:"Select This Folder"})]})]})]})}):p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:n,children:p.jsx("div",{className:"bg-card border border-border rounded-xl p-6 w-[480px] text-sm text-muted-foreground",children:"Loading..."})})}function HG(){var ul,dl,fl,hl,pl,ml,gl,vl,yl,xl;const[e,n]=x.useState(null),[r,o]=x.useState(!0),[i,s]=x.useState(!1),[a,l]=x.useState(!1),[c,u]=x.useState(null),[f,d]=x.useState(new Set),[h,g]=x.useState([]),[v,b]=x.useState(""),[_,m]=x.useState("crosslayer"),[w,y]=x.useState("api-binding"),[S,k]=x.useState(""),[C,N]=x.useState(null),[E,j]=x.useState(""),[A,T]=x.useState(""),[D,F]=x.useState([]),[P,L]=x.useState(""),[I,z]=x.useState(null),[R,M]=x.useState(!1),O=Go(),{projects:V,reloadProjects:$,isMultiProject:K}=Ig(),[B,U]=x.useState([]),[G,W]=x.useState(""),[X,q]=x.useState(""),[te,ee]=x.useState(new Set),[Q,ne]=x.useState({module:!0,screen:!0}),[ue,ye]=x.useState([]),[pe,ke]=x.useState([]),[tt,Xe]=x.useState(""),[Zt,fr]=x.useState(""),[Dn,hr]=x.useState(""),pr=x.useCallback(async()=>{try{const Y=await fetch(O("/api/detected-paths"));Y.ok&&N(await Y.json())}catch{}},[O]),io=x.useCallback(async()=>{try{const Y=await fetch("/api/projects");if(!Y.ok)return;const he=(await Y.json()).projects??[];(he.length>1||he.some(Fe=>Fe.root!=="."))&&U(he.map(Fe=>({name:Fe.name,root:Fe.root})))}catch{}},[]),Ln=x.useCallback(async()=>{var Y,de,he,Fe,ct,ao,xn,lo,Xo,wl,bl;try{const co=await fetch(O("/api/parser-config"));if(!co.ok)throw new Error(`HTTP ${co.status}`);const vt=await co.json();n(vt),d(new Set(((Y=vt.config.parsers)==null?void 0:Y.disabled)??[])),g(((de=vt.config.parsers)==null?void 0:de.custom)??[]),k(vt.config.port?String(vt.config.port):""),j(((he=vt.config.paths)==null?void 0:he.appDir)??""),T(((Fe=vt.config.paths)==null?void 0:Fe.dbDir)??""),F(((ct=vt.config.paths)==null?void 0:ct.srcRoots)??[]),ee(new Set(((ao=vt.config.taggers)==null?void 0:ao.disabled)??[])),ne(((xn=vt.config.taggers)==null?void 0:xn.trackUntagged)??{module:!0,screen:!0}),ye(((Xo=(lo=vt.config.taggers)==null?void 0:lo.module)==null?void 0:Xo.rules)??[]),ke(((bl=(wl=vt.config.taggers)==null?void 0:wl.module)==null?void 0:bl.trivialGroups)??[]),o(!1)}catch(co){u(String(co)),o(!1)}},[]);x.useEffect(()=>{Ln(),pr(),io()},[Ln,pr,io]);const so=x.useCallback(async()=>{s(!0),l(!1),u(null);try{const Y={};te.size>0&&(Y.disabled=[...te]),Object.keys(Q).length>0&&(Y.trackUntagged=Q);const de={};ue.length>0&&(de.rules=ue),pe.length>0&&(de.trivialGroups=pe),Object.keys(de).length>0&&(Y.module=de);const he=S.trim()?parseInt(S.trim(),10):void 0,Fe={};E.trim()&&(Fe.appDir=E.trim()),A.trim()&&(Fe.dbDir=A.trim());const ct=D.map(Xo=>Xo.trim()).filter(Boolean);ct.length>0&&(Fe.srcRoots=ct);const ao=Object.keys(Fe).length>0?Fe:void 0,xn={...he&&!isNaN(he)&&{port:he},...ao&&{paths:ao},parsers:{disabled:[...f],custom:h.length>0?h:void 0},...Object.keys(Y).length>0&&{taggers:Y}};xn.parsers.disabled.length===0&&delete xn.parsers.disabled,xn.parsers.custom||delete xn.parsers.custom;const lo=await fetch(O("/api/parser-config"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(xn)});if(!lo.ok)throw new Error(`HTTP ${lo.status}`);l(!0),pr(),setTimeout(()=>l(!1),3e3)}catch(Y){u(String(Y))}finally{s(!1)}},[f,h,te,Q,ue,pe,S,E,A,D,pr,O]),us=Y=>{d(de=>{const he=new Set(de);return he.has(Y)?he.delete(Y):he.add(Y),he})},cl=()=>{if(!v.trim())return;const Y={path:v.trim(),layer:_};_==="crosslayer"&&(Y.concern=w),g(de=>[...de,Y]),b("")},ds=Y=>{g(de=>de.filter((he,Fe)=>Fe!==Y))};if(r)return p.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"Loading configuration..."});const Yo=Y=>Y.split("-").map(de=>de[0].toUpperCase()+de.slice(1)).join(" "),fs=Object.entries((e==null?void 0:e.crosslayerParsers)??{}),qd=[...((e==null?void 0:e.detection)??[]).map(Y=>({...Y,layer:Y.layers.join(", "),label:Y.label||Yo(Y.id),concern:null})),...fs.flatMap(([Y,de])=>de.map(he=>({id:he.id,layer:Y,label:he.label||Yo(he.id),detected:!0,layers:[Y],concern:Y})))];return p.jsxs("div",{className:"h-full overflow-y-auto p-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-6",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(z_,{className:"h-6 w-6 text-muted-foreground"}),p.jsx("h1",{className:"text-xl font-semibold",children:"Parser Configuration"})]}),p.jsxs("button",{onClick:so,disabled:i,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-purple-600 hover:bg-purple-500 text-white text-sm font-medium transition-colors disabled:opacity-50",children:[a?p.jsx(jr,{className:"h-4 w-4"}):p.jsx(ry,{className:"h-4 w-4"}),i?"Saving...":a?"Saved":"Save"]})]}),c&&p.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-red-500/10 text-red-400 text-sm mb-6",children:[p.jsx(wo,{className:"h-4 w-4 shrink-0"}),c]}),p.jsxs("section",{className:"mb-6 space-y-3",children:[p.jsx("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Layer Directories"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Override auto-detected source directories per layer. Leave empty for auto-detection. Paths are relative to project root."}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"p-4 rounded-lg border border-border/50 bg-card space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("label",{className:"text-sm text-muted-foreground w-24 shrink-0",children:"UI"}),p.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[p.jsx("input",{type:"text",value:E,onChange:Y=>j(Y.target.value),placeholder:((ul=C==null?void 0:C.detected)==null?void 0:ul.appDir)??"src/app",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsxs("button",{onClick:()=>z("app"),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors",title:"Browse folders",children:[p.jsx(Hl,{className:"h-4 w-4"}),"Browse"]}),E&&p.jsx("button",{onClick:()=>j(""),className:"flex items-center gap-1.5 px-2 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors text-muted-foreground",title:"Reset to auto-detect",children:p.jsx(jf,{className:"h-3.5 w-3.5"})})]})]}),p.jsx("div",{className:"flex items-center gap-2 pl-[108px]",children:(dl=C==null?void 0:C.overrides)!=null&&dl.appDir?p.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-purple-500/10 text-purple-400",children:"Manual override"}):(fl=C==null?void 0:C.detected)!=null&&fl.appDir?p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-green-500/10 text-green-400",children:[p.jsx(jr,{className:"h-3 w-3"}),"Auto-detected: ",C.detected.appDir]}):p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-yellow-500/10 text-yellow-400",children:[p.jsx(wo,{className:"h-3 w-3"}),"Not detected"]})}),p.jsx("p",{className:"text-xs text-muted-foreground pl-[108px]",children:"Pages and layout directory. Auto-detects src/app or app/."})]}),p.jsx("div",{className:"p-4 rounded-lg border border-border/50 bg-card",children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("label",{className:"text-sm text-muted-foreground w-24 shrink-0",children:"API"}),p.jsxs("div",{className:"flex-1",children:[p.jsx("span",{className:"text-sm text-muted-foreground",children:((hl=C==null?void 0:C.detected)==null?void 0:hl.apiDir)??"src/app/api"}),p.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground ml-3",children:"Derived from UI dir"})]})]})}),p.jsxs("div",{className:"p-4 rounded-lg border border-border/50 bg-card space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("label",{className:"text-sm text-muted-foreground w-24 shrink-0",children:"DB"}),p.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[p.jsx("input",{type:"text",value:A,onChange:Y=>T(Y.target.value),placeholder:((pl=C==null?void 0:C.detected)==null?void 0:pl.dbDir)??"prisma",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsxs("button",{onClick:()=>z("db"),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors",title:"Browse folders",children:[p.jsx(Hl,{className:"h-4 w-4"}),"Browse"]}),A&&p.jsx("button",{onClick:()=>T(""),className:"flex items-center gap-1.5 px-2 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors text-muted-foreground",title:"Reset to auto-detect",children:p.jsx(jf,{className:"h-3.5 w-3.5"})})]})]}),p.jsxs("div",{className:"flex items-center gap-2 pl-[108px]",children:[(ml=C==null?void 0:C.overrides)!=null&&ml.dbDir?p.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-purple-500/10 text-purple-400",children:"Manual override"}):(gl=C==null?void 0:C.detected)!=null&&gl.dbDir?p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-green-500/10 text-green-400",children:[p.jsx(jr,{className:"h-3 w-3"}),"Auto-detected: ",C.detected.dbDir]}):p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-yellow-500/10 text-yellow-400",children:[p.jsx(wo,{className:"h-3 w-3"}),"Not detected"]}),((vl=C==null?void 0:C.detected)==null?void 0:vl.dbKind)&&C.detected.dbKind!=="none"&&p.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground",children:C.detected.dbKind==="prisma"?"Prisma schema":"SQL migrations"})]}),p.jsx("p",{className:"text-xs text-muted-foreground pl-[108px]",children:"Schema and migration directory. Auto-detects prisma/, supabase/, drizzle/, db/migrations/, migrations/."})]}),p.jsxs("div",{className:"p-4 rounded-lg border border-border/50 bg-card space-y-3",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("label",{className:"text-sm text-muted-foreground w-24 shrink-0 pt-1",children:"Source Roots"}),p.jsxs("div",{className:"flex-1 space-y-2",children:[D.length>0?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"flex flex-wrap gap-1.5",children:D.map((Y,de)=>p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs bg-purple-500/10 text-purple-400",children:[Y,p.jsx("button",{onClick:()=>F(he=>he.filter((Fe,ct)=>ct!==de)),className:"text-red-400 hover:text-red-300 ml-0.5",title:"Remove",children:p.jsx(Ss,{className:"h-3 w-3"})})]},de))}),p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-purple-500/10 text-purple-400",children:["Manual override (",D.length,")"]})]}):(yl=C==null?void 0:C.detected)!=null&&yl.srcRoots&&C.detected.srcRoots.length>0?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"flex flex-wrap gap-1.5",children:C.detected.srcRoots.map(Y=>p.jsx("span",{className:"inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs bg-green-500/10 text-green-400",children:Y},Y))}),p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-green-500/10 text-green-400",children:[p.jsx(jr,{className:"h-3 w-3"}),"Auto-detected (",C.detected.srcRoots.length,")"]})]}):p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-yellow-500/10 text-yellow-400",children:[p.jsx(wo,{className:"h-3 w-3"}),"Not detected"]}),p.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[p.jsx("input",{type:"text",value:P,onChange:Y=>L(Y.target.value),placeholder:"e.g. components, hooks, packages/shared",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground",onKeyDown:Y=>{Y.key==="Enter"&&P.trim()&&(F(de=>[...de,P.trim()]),L(""))}}),p.jsxs("button",{onClick:()=>z("srcRoot"),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors",title:"Browse folders",children:[p.jsx(Hl,{className:"h-4 w-4"}),"Browse"]}),p.jsx("button",{onClick:()=>{P.trim()&&(F(Y=>[...Y,P.trim()]),L(""))},className:"p-1.5 rounded-lg border border-border/50 hover:bg-muted transition-colors",title:"Add",children:p.jsx(_s,{className:"h-4 w-4"})}),D.length>0&&p.jsx("button",{onClick:()=>F([]),className:"flex items-center gap-1.5 px-2 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors text-muted-foreground",title:"Reset to auto-detect",children:p.jsx(jf,{className:"h-3.5 w-3.5"})})]})]})]}),p.jsx("p",{className:"text-xs text-muted-foreground pl-[108px]",children:"Directories scanned for source files. Adding any entry switches off auto-detection — list every root you want indexed (the app dir is always included)."}),((xl=C==null?void 0:C.detected)==null?void 0:xl.conventionFiles)&&C.detected.conventionFiles.length>0&&p.jsxs("div",{className:"pl-[108px] flex items-center gap-2 flex-wrap",children:[p.jsx("span",{className:"text-xs text-muted-foreground",children:"Convention files:"}),C.detected.conventionFiles.map(Y=>p.jsx("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs bg-muted text-muted-foreground",children:Y},Y))]})]})]})]}),p.jsxs("section",{className:"mb-6 space-y-3",children:[p.jsx("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Server"}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("label",{className:"text-sm text-muted-foreground w-24 shrink-0",children:"Port"}),p.jsx("input",{type:"text",value:S,onChange:Y=>k(Y.target.value),placeholder:"Random",className:"w-32 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsx("span",{className:"text-xs text-muted-foreground",children:"Leave empty for random port on each start"})]})]}),p.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-6",children:[p.jsxs("div",{className:"space-y-6",children:[p.jsxs("section",{className:"space-y-3",children:[p.jsx("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Stack Detection"}),p.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 xl:grid-cols-1 gap-2",children:((e==null?void 0:e.detection)??[]).map(Y=>p.jsxs("div",{className:`flex items-center gap-2 p-3 rounded-lg border ${Y.detected?"border-green-500/30 bg-green-500/5":"border-border/50 bg-muted/20 opacity-50"}`,children:[Y.detected?p.jsx(jr,{className:"h-4 w-4 text-green-500 shrink-0"}):p.jsx(BR,{className:"h-4 w-4 text-muted-foreground shrink-0"}),p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium",children:Y.label||Y.id}),p.jsxs("div",{className:"text-xs text-muted-foreground",children:[Y.layers.join(", ")," layer"]})]})]},Y.id))})]}),fs.map(([Y,de])=>p.jsxs("section",{className:"space-y-3",children:[p.jsxs("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:[Yo(Y)," Parsers"]}),p.jsx("div",{className:"space-y-2",children:de.map(he=>p.jsx("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border/50 bg-card",children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("button",{onClick:()=>us(he.id),className:`w-10 h-5 rounded-full transition-colors relative shrink-0 ${f.has(he.id)?"bg-muted":"bg-purple-600"}`,children:p.jsx("span",{className:`block absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white transition-all ${f.has(he.id)?"left-0.5":"left-[22px]"}`})}),p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium",children:he.label||Yo(he.id)}),p.jsx("div",{className:"text-xs text-muted-foreground",children:he.id})]})]})},he.id))})]},Y))]}),p.jsxs("div",{className:"space-y-6",children:[p.jsxs("section",{className:"space-y-3",children:[p.jsx("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Layer Parsers"}),p.jsx("div",{className:"space-y-2",children:qd.filter(Y=>!Y.concern).map(Y=>p.jsx("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border/50 bg-card",children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("button",{onClick:()=>us(Y.id),className:`w-10 h-5 rounded-full transition-colors relative shrink-0 ${f.has(Y.id)?"bg-muted":"bg-purple-600"}`,children:p.jsx("span",{className:`block absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white transition-all ${f.has(Y.id)?"left-0.5":"left-[22px]"}`})}),p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium",children:Y.label}),p.jsxs("div",{className:"text-xs text-muted-foreground",children:[Y.id," — ",Y.layer]})]})]})},Y.id))})]}),p.jsxs("section",{className:"space-y-3",children:[p.jsx("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Custom Parsers"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"JS files exporting a parser object. Path relative to project root."}),h.length>0&&p.jsx("div",{className:"space-y-2",children:h.map((Y,de)=>p.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border border-border/50 bg-card",children:[p.jsx("code",{className:"text-xs flex-1 text-muted-foreground",children:Y.path}),p.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:Y.layer}),Y.concern&&p.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-purple-500/10 text-purple-400",children:Y.concern}),p.jsx("button",{onClick:()=>ds(de),className:"text-red-400 hover:text-red-300",children:p.jsx(Ss,{className:"h-3.5 w-3.5"})})]},de))}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"text",value:v,onChange:Y=>b(Y.target.value),placeholder:"./parsers/my-parser.js",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground",onKeyDown:Y=>Y.key==="Enter"&&cl()}),p.jsxs("select",{value:_,onChange:Y=>m(Y.target.value),className:"px-2 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground",children:[p.jsx("option",{value:"crosslayer",children:"crosslayer"}),p.jsx("option",{value:"ui",children:"ui"}),p.jsx("option",{value:"api",children:"api"}),p.jsx("option",{value:"db",children:"db"})]}),_==="crosslayer"&&p.jsx("input",{type:"text",value:w,onChange:Y=>y(Y.target.value),placeholder:"api-binding",list:"concern-suggestions",className:"w-32 px-2 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsx("button",{onClick:cl,className:"p-1.5 rounded-lg border border-border/50 hover:bg-muted transition-colors",children:p.jsx(_s,{className:"h-4 w-4"})})]}),p.jsx("datalist",{id:"concern-suggestions",children:fs.map(([Y])=>p.jsx("option",{value:Y},Y))})]})]})]}),p.jsxs("div",{className:"mt-8 border-t border-border/30 pt-6",children:[p.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[p.jsx(MA,{className:"h-5 w-5 text-muted-foreground"}),p.jsx("h2",{className:"text-lg font-semibold",children:"Taggers"})]}),p.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-6",children:[p.jsxs("section",{className:"space-y-3",children:[p.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Built-in Taggers"}),[{id:"module",label:"Module",description:"Assigns modules from directory structure"},{id:"screen",label:"Screen",description:"Marks pages and layouts as screens"}].map(Y=>p.jsxs("div",{className:"p-3 rounded-lg border border-border/50 bg-card space-y-2",children:[p.jsx("div",{className:"flex items-center justify-between",children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("button",{onClick:()=>ee(de=>{const he=new Set(de);return he.has(Y.id)?he.delete(Y.id):he.add(Y.id),he}),className:`w-10 h-5 rounded-full transition-colors relative shrink-0 ${te.has(Y.id)?"bg-muted":"bg-purple-600"}`,children:p.jsx("span",{className:`block absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white transition-all ${te.has(Y.id)?"left-0.5":"left-[22px]"}`})}),p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium",children:Y.label}),p.jsx("div",{className:"text-xs text-muted-foreground",children:Y.description})]})]})}),p.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground pl-[52px]",children:[p.jsx("input",{type:"checkbox",checked:Q[Y.id]??!0,onChange:de=>ne(he=>({...he,[Y.id]:de.target.checked})),className:"accent-purple-600"}),"Track untagged nodes"]})]},Y.id))]}),p.jsxs("section",{className:"space-y-3",children:[p.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Module Rules"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Custom glob patterns to assign modules. Matched before auto-detection."}),ue.length>0&&p.jsx("div",{className:"space-y-2",children:ue.map((Y,de)=>p.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border border-border/50 bg-card",children:[p.jsx("code",{className:"text-xs flex-1 text-muted-foreground",children:Y.match}),p.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-purple-500/10 text-purple-400",children:Y.module}),p.jsx("button",{onClick:()=>ye(he=>he.filter((Fe,ct)=>ct!==de)),className:"text-red-400 hover:text-red-300",children:p.jsx(Ss,{className:"h-3.5 w-3.5"})})]},de))}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"text",value:Zt,onChange:Y=>fr(Y.target.value),placeholder:"app/(admin)/**",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsx("input",{type:"text",value:Dn,onChange:Y=>hr(Y.target.value),placeholder:"admin",className:"w-28 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsx("button",{onClick:()=>{Zt.trim()&&Dn.trim()&&(ye(Y=>[...Y,{match:Zt.trim(),module:Dn.trim()}]),fr(""),hr(""))},className:"p-1.5 rounded-lg border border-border/50 hover:bg-muted transition-colors",children:p.jsx(_s,{className:"h-4 w-4"})})]})]}),p.jsxs("section",{className:"space-y-3",children:[p.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Trivial Route Groups"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Route groups that are auth/layout wrappers, not feature modules. These are skipped during module detection."}),pe.length>0&&p.jsx("div",{className:"flex flex-wrap gap-1.5",children:pe.map((Y,de)=>p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs bg-muted text-muted-foreground",children:["(",Y,")",p.jsx("button",{onClick:()=>ke(he=>he.filter((Fe,ct)=>ct!==de)),className:"text-red-400 hover:text-red-300 ml-0.5",children:p.jsx(Ss,{className:"h-3 w-3"})})]},de))}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"text",value:tt,onChange:Y=>Xe(Y.target.value),placeholder:"protected",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground",onKeyDown:Y=>{Y.key==="Enter"&&tt.trim()&&(ke(de=>[...de,tt.trim()]),Xe(""))}}),p.jsx("button",{onClick:()=>{tt.trim()&&(ke(Y=>[...Y,tt.trim()]),Xe(""))},className:"p-1.5 rounded-lg border border-border/50 hover:bg-muted transition-colors",children:p.jsx(_s,{className:"h-4 w-4"})})]})]})]})]}),p.jsxs("div",{className:"mt-8 border-t border-border/30 pt-6",children:[p.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[p.jsx(ld,{className:"h-5 w-5 text-muted-foreground"}),p.jsx("h2",{className:"text-lg font-semibold",children:"Projects"})]}),p.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure sub-projects for monorepo support. Each project gets its own graph, selectable from the header dropdown. Leave empty for single-project mode."}),B.length>0&&p.jsx("div",{className:"space-y-2 mb-4",children:B.map((Y,de)=>p.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg border border-border/50 bg-card",children:[p.jsx("span",{className:"text-sm font-medium flex-1",children:Y.name}),p.jsx("code",{className:"text-xs text-muted-foreground",children:Y.root}),p.jsx("button",{onClick:()=>U(he=>he.filter((Fe,ct)=>ct!==de)),className:"text-red-400 hover:text-red-300",children:p.jsx(Ss,{className:"h-3.5 w-3.5"})})]},de))}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"text",value:G,onChange:Y=>W(Y.target.value),placeholder:"Project name",className:"w-40 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsxs("div",{className:"flex-1 flex items-center gap-1",children:[p.jsx("input",{type:"text",value:X,onChange:Y=>q(Y.target.value),placeholder:"Relative path (e.g. apps/dashboard)",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsx("button",{onClick:()=>M(!0),className:"p-1.5 rounded-lg border border-border/50 hover:bg-muted transition-colors",title:"Browse folders",children:p.jsx(Hl,{className:"h-4 w-4"})})]}),p.jsx("button",{onClick:()=>{G.trim()&&X.trim()&&(U(Y=>[...Y,{name:G.trim(),root:X.trim()}]),W(""),q(""))},className:"p-1.5 rounded-lg border border-border/50 hover:bg-muted transition-colors",children:p.jsx(_s,{className:"h-4 w-4"})})]}),p.jsxs("button",{onClick:async()=>{try{const Y=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projects:B})});if(!Y.ok)throw new Error(`HTTP ${Y.status}`);$()}catch(Y){u(String(Y))}},className:"mt-3 flex items-center gap-2 px-4 py-2 rounded-lg bg-purple-600 hover:bg-purple-500 text-white text-sm font-medium transition-colors",children:[p.jsx(ry,{className:"h-4 w-4"}),"Save Projects"]})]}),I&&I!=="project"&&p.jsx(T1,{buildUrl:O,onSelect:Y=>{I==="app"?j(Y):I==="db"?T(Y):I==="srcRoot"&&Y&&!D.includes(Y)&&F(de=>[...de,Y]),z(null)},onClose:()=>z(null)}),R&&p.jsx(T1,{buildUrl:O,onSelect:Y=>{q(Y),M(!1)},onClose:()=>M(!1)})]})}const UG=["all","db","api","ui","static"],VG={error:{icon:wo,color:"text-red-400",bg:"bg-red-500/10",border:"border-red-500/30",label:"Error"},warning:{icon:Jm,color:"text-yellow-400",bg:"bg-yellow-500/10",border:"border-yellow-500/30",label:"Warning"},info:{icon:D_,color:"text-blue-400",bg:"bg-blue-500/10",border:"border-blue-500/30",label:"Info"}};function WG(){const[e,n]=x.useState(null),[r,o]=x.useState(!1),[i,s]=x.useState(null),[a,l]=x.useState("all"),[c,u]=x.useState(null),f=Go(),d=x.useCallback(async()=>{o(!0),s(null);try{const m=await fetch(f("/api/audit",{layer:a}));if(!m.ok)throw new Error(`HTTP ${m.status}`);n(await m.json())}catch(m){s(String(m))}finally{o(!1)}},[a,f]);x.useEffect(()=>{d()},[d]);const h=x.useCallback((m,w)=>{navigator.clipboard.writeText(w),u(m),setTimeout(()=>u(null),2e3)},[]),g=(e==null?void 0:e.reports.reduce((m,w)=>m+w.findings.length,0))??0,v=(e==null?void 0:e.reports.reduce((m,w)=>m+w.summary.errors,0))??0,b=(e==null?void 0:e.reports.reduce((m,w)=>m+w.summary.warnings,0))??0,_=(e==null?void 0:e.reports.reduce((m,w)=>m+w.summary.info,0))??0;return p.jsxs("div",{className:"h-full overflow-y-auto p-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-6",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(F_,{className:"h-6 w-6 text-muted-foreground"}),p.jsx("h1",{className:"text-xl font-semibold",children:"Audit"})]}),p.jsxs("button",{onClick:d,disabled:r,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-purple-600 hover:bg-purple-500 text-white text-sm font-medium transition-colors disabled:opacity-50",children:[p.jsx(gA,{className:"h-4 w-4"}),r?"Running...":"Run Audit"]})]}),i&&p.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-red-500/10 text-red-400 text-sm mb-6",children:[p.jsx(wo,{className:"h-4 w-4 shrink-0"}),i]}),p.jsx("div",{className:"flex gap-1 mb-6 p-1 rounded-lg bg-muted/30 w-fit",children:UG.map(m=>p.jsx("button",{onClick:()=>l(m),className:`px-4 py-1.5 text-sm rounded-md transition-colors ${a===m?"bg-purple-600 text-white font-medium":"text-muted-foreground hover:text-foreground"}`,children:m},m))}),e&&!r&&p.jsxs("div",{className:"flex items-center gap-4 mb-6 p-3 rounded-lg border border-border/50 bg-card",children:[p.jsxs("span",{className:"text-sm font-medium",children:[g," findings"]}),v>0&&p.jsxs("span",{className:"flex items-center gap-1 text-xs text-red-400",children:[p.jsx(wo,{className:"h-3 w-3"})," ",v," errors"]}),b>0&&p.jsxs("span",{className:"flex items-center gap-1 text-xs text-yellow-400",children:[p.jsx(Jm,{className:"h-3 w-3"})," ",b," warnings"]}),_>0&&p.jsxs("span",{className:"flex items-center gap-1 text-xs text-blue-400",children:[p.jsx(D_,{className:"h-3 w-3"})," ",_," info"]}),g>0&&p.jsxs("button",{onClick:()=>e.prompt&&h("all",e.prompt),className:"ml-auto flex items-center gap-1.5 px-3 py-1 text-xs rounded-md border border-border/50 hover:bg-muted transition-colors",children:[c==="all"?p.jsx(jr,{className:"h-3 w-3 text-green-400"}):p.jsx(Jv,{className:"h-3 w-3"}),c==="all"?"Copied":"Copy All as AI Prompt"]})]}),r&&p.jsx("div",{className:"text-sm text-muted-foreground",children:"Running audit checks..."}),e&&!r&&p.jsx("div",{className:"space-y-4",children:e.reports.map(m=>p.jsxs("section",{className:"rounded-lg border border-border/50 bg-card overflow-hidden",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border/30",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground uppercase",children:m.layer}),p.jsx("span",{className:"text-sm font-medium",children:m.check.replace(/_/g," ")}),m.findings.length===0?p.jsxs("span",{className:"text-xs text-green-400 flex items-center gap-1",children:[p.jsx(jr,{className:"h-3 w-3"})," passed"]}):p.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.findings.length," finding",m.findings.length!==1?"s":""]})]}),m.findings.length>0&&p.jsxs("button",{onClick:()=>{const w=GG(m);h(m.check,w)},className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md border border-border/50 hover:bg-muted transition-colors",children:[c===m.check?p.jsx(jr,{className:"h-3 w-3 text-green-400"}):p.jsx(Jv,{className:"h-3 w-3"}),c===m.check?"Copied":"Copy as AI Prompt"]})]}),m.findings.length>0&&p.jsx("div",{className:"divide-y divide-border/20",children:m.findings.map(w=>{const y=VG[w.severity],S=y.icon;return p.jsxs("div",{className:`flex items-start gap-3 p-3 ${y.bg}`,children:[p.jsx(S,{className:`h-4 w-4 shrink-0 mt-0.5 ${y.color}`}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("div",{className:"text-sm font-medium",children:w.title}),p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:w.detail}),w.file&&p.jsxs("code",{className:"text-xs text-muted-foreground mt-1 block",children:[w.file,w.line?`:${w.line}`:""]})]})]},w.id)})})]},`${m.layer}:${m.check}`))})]})}function GG(e){const n=[];n.push(`Fix these ${e.findings.length} ${e.check.replace(/_/g," ")} issues:
|
|
442
|
+
`)),f=u.reduce((d,h)=>d.concat(...h),[]);return[u,f]}return[[],[]]},[e]);return x.useEffect(()=>{const c=(n==null?void 0:n.target)??l1,u=(n==null?void 0:n.actInsideInputWithModifier)??!0;if(e!==null){const f=g=>{var _,m;if(i.current=g.ctrlKey||g.metaKey||g.shiftKey||g.altKey,(!i.current||i.current&&!u)&&ZN(g))return!1;const b=u1(g.code,l);if(s.current.add(g[b]),c1(a,s.current,!1)){const w=((m=(_=g.composedPath)==null?void 0:_.call(g))==null?void 0:m[0])||g.target,y=(w==null?void 0:w.nodeName)==="BUTTON"||(w==null?void 0:w.nodeName)==="A";n.preventDefault!==!1&&(i.current||!y)&&g.preventDefault(),o(!0)}},d=g=>{const v=u1(g.code,l);c1(a,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(g[v]),g.key==="Meta"&&s.current.clear(),i.current=!1},h=()=>{s.current.clear(),o(!1)};return c==null||c.addEventListener("keydown",f),c==null||c.addEventListener("keyup",d),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",f),c==null||c.removeEventListener("keyup",d),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,o]),r}function c1(e,n,r){return e.filter(o=>r||o.length===n.size).some(o=>o.every(i=>n.has(i)))}function u1(e,n){return n.includes(e)?"code":"key"}const jV=()=>{const e=Ie();return x.useMemo(()=>({zoomIn:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1.2,n):Promise.resolve(!1)},zoomOut:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1/1.2,n):Promise.resolve(!1)},zoomTo:(n,r)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(n,r):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(n,r)=>{const{transform:[o,i,s],panZoom:a}=e.getState();return a?(await a.setViewport({x:n.x??o,y:n.y??i,zoom:n.zoom??s},r),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[n,r,o]=e.getState().transform;return{x:n,y:r,zoom:o}},setCenter:async(n,r,o)=>e.getState().setCenter(n,r,o),fitBounds:async(n,r)=>{const{width:o,height:i,minZoom:s,maxZoom:a,panZoom:l}=e.getState(),c=o0(n,o,i,s,a,(r==null?void 0:r.padding)??.1);return l?(await l.setViewport(c,{duration:r==null?void 0:r.duration,ease:r==null?void 0:r.ease,interpolate:r==null?void 0:r.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(n,r={})=>{const{transform:o,snapGrid:i,snapToGrid:s,domNode:a}=e.getState();if(!a)return n;const{x:l,y:c}=a.getBoundingClientRect(),u={x:n.x-l,y:n.y-c},f=r.snapGrid??i,d=r.snapToGrid??s;return ll(u,o,d,f)},flowToScreenPosition:n=>{const{transform:r,domNode:o}=e.getState();if(!o)return n;const{x:i,y:s}=o.getBoundingClientRect(),a=Du(n,r);return{x:a.x+i,y:a.y+s}}}),[])};function _E(e,n){const r=[],o=new Map,i=[];for(const s of e)if(s.type==="add"){i.push(s);continue}else if(s.type==="remove"||s.type==="replace")o.set(s.id,[s]);else{const a=o.get(s.id);a?a.push(s):o.set(s.id,[s])}for(const s of n){const a=o.get(s.id);if(!a){r.push(s);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){r.push({...a[0].item});continue}const l={...s};for(const c of a)PV(c,l);r.push(l)}return i.length&&i.forEach(s=>{s.index!==void 0?r.splice(s.index,0,{...s.item}):r.push({...s.item})}),r}function PV(e,n){switch(e.type){case"select":{n.selected=e.selected;break}case"position":{typeof e.position<"u"&&(n.position=e.position),typeof e.dragging<"u"&&(n.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(n.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(n.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(n.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(n.resizing=e.resizing);break}}}function MV(e,n){return _E(e,n)}function RV(e,n){return _E(e,n)}function go(e,n){return{id:e,type:"select",selected:n}}function wi(e,n=new Set,r=!1){const o=[];for(const[i,s]of e){const a=n.has(i);!(s.selected===void 0&&!a)&&s.selected!==a&&(r&&(s.selected=a),o.push(go(s.id,a)))}return o}function d1({items:e=[],lookup:n}){var i;const r=[],o=new Map(e.map(s=>[s.id,s]));for(const[s,a]of e.entries()){const l=n.get(a.id),c=((i=l==null?void 0:l.internals)==null?void 0:i.userNode)??l;c!==void 0&&c!==a&&r.push({id:a.id,item:a,type:"replace"}),c===void 0&&r.push({item:a,type:"add",index:s})}for(const[s]of n)o.get(s)===void 0&&r.push({id:s,type:"remove"});return r}function f1(e){return{id:e.id,type:"remove"}}const h1=e=>KH(e),AV=e=>VN(e);function SE(e){return x.forwardRef(e)}function p1(e){const[n,r]=x.useState(BigInt(0)),[o]=x.useState(()=>TV(()=>r(i=>i+BigInt(1))));return Wp(()=>{const i=o.get();i.length&&(e(i),o.reset())},[n]),o}function TV(e){let n=[];return{get:()=>n,reset:()=>{n=[]},push:r=>{n.push(r),e()}}}const kE=x.createContext(null);function IV({children:e}){const n=Ie(),r=x.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:f,onNodesChange:d,nodeLookup:h,fitViewQueued:g,onNodesChangeMiddlewareMap:v}=n.getState();let b=c;for(const m of l)b=typeof m=="function"?m(b):m;let _=d1({items:b,lookup:h});for(const m of v.values())_=m(_);f&&u(b),_.length>0?d==null||d(_):g&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:w,setNodes:y}=n.getState();m&&y(w)})},[]),o=p1(r),i=x.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:f,onEdgesChange:d,edgeLookup:h}=n.getState();let g=c;for(const v of l)g=typeof v=="function"?v(g):v;f?u(g):d&&d(d1({items:g,lookup:h}))},[]),s=p1(i),a=x.useMemo(()=>({nodeQueue:o,edgeQueue:s}),[]);return p.jsx(kE.Provider,{value:a,children:e})}function OV(){const e=x.useContext(kE);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const $V=e=>!!e.panZoom;function d0(){const e=jV(),n=Ie(),r=OV(),o=we($V),i=x.useMemo(()=>{const s=d=>n.getState().nodeLookup.get(d),a=d=>{r.nodeQueue.push(d)},l=d=>{r.edgeQueue.push(d)},c=d=>{var m,w;const{nodeLookup:h,nodeOrigin:g}=n.getState(),v=h1(d)?d:h.get(d.id),b=v.parentId?qN(v.position,v.measured,v.parentId,h,g):v.position,_={...v,position:b,width:((m=v.measured)==null?void 0:m.width)??v.width,height:((w=v.measured)==null?void 0:w.height)??v.height};return Ki(_)},u=(d,h,g={replace:!1})=>{a(v=>v.map(b=>{if(b.id===d){const _=typeof h=="function"?h(b):h;return g.replace&&h1(_)?_:{...b,..._}}return b}))},f=(d,h,g={replace:!1})=>{l(v=>v.map(b=>{if(b.id===d){const _=typeof h=="function"?h(b):h;return g.replace&&AV(_)?_:{...b,..._}}return b}))};return{getNodes:()=>n.getState().nodes.map(d=>({...d})),getNode:d=>{var h;return(h=s(d))==null?void 0:h.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:d=[]}=n.getState();return d.map(h=>({...h}))},getEdge:d=>n.getState().edgeLookup.get(d),setNodes:a,setEdges:l,addNodes:d=>{const h=Array.isArray(d)?d:[d];r.nodeQueue.push(g=>[...g,...h])},addEdges:d=>{const h=Array.isArray(d)?d:[d];r.edgeQueue.push(g=>[...g,...h])},toObject:()=>{const{nodes:d=[],edges:h=[],transform:g}=n.getState(),[v,b,_]=g;return{nodes:d.map(m=>({...m})),edges:h.map(m=>({...m})),viewport:{x:v,y:b,zoom:_}}},deleteElements:async({nodes:d=[],edges:h=[]})=>{const{nodes:g,edges:v,onNodesDelete:b,onEdgesDelete:_,triggerNodeChanges:m,triggerEdgeChanges:w,onDelete:y,onBeforeDelete:S}=n.getState(),{nodes:k,edges:C}=await eU({nodesToRemove:d,edgesToRemove:h,nodes:g,edges:v,onBeforeDelete:S}),N=C.length>0,E=k.length>0;if(N){const j=C.map(f1);_==null||_(C),w(j)}if(E){const j=k.map(f1);b==null||b(k),m(j)}return(E||N)&&(y==null||y({nodes:k,edges:C})),{deletedNodes:k,deletedEdges:C}},getIntersectingNodes:(d,h=!0,g)=>{const v=Ux(d),b=v?d:c(d),_=g!==void 0;return b?(g||n.getState().nodes).filter(m=>{const w=n.getState().nodeLookup.get(m.id);if(w&&!v&&(m.id===d.id||!w.internals.positionAbsolute))return!1;const y=Ki(_?m:w),S=Oa(y,b);return h&&S>0||S>=y.width*y.height||S>=b.width*b.height}):[]},isNodeIntersecting:(d,h,g=!0)=>{const b=Ux(d)?d:c(d);if(!b)return!1;const _=Oa(b,h);return g&&_>0||_>=h.width*h.height||_>=b.width*b.height},updateNode:u,updateNodeData:(d,h,g={replace:!1})=>{u(d,v=>{const b=typeof h=="function"?h(v):h;return g.replace?{...v,data:b}:{...v,data:{...v.data,...b}}},g)},updateEdge:f,updateEdgeData:(d,h,g={replace:!1})=>{f(d,v=>{const b=typeof h=="function"?h(v):h;return g.replace?{...v,data:b}:{...v,data:{...v.data,...b}}},g)},getNodesBounds:d=>{const{nodeLookup:h,nodeOrigin:g}=n.getState();return qH(d,{nodeLookup:h,nodeOrigin:g})},getHandleConnections:({type:d,id:h,nodeId:g})=>{var v;return Array.from(((v=n.getState().connectionLookup.get(`${g}-${d}${h?`-${h}`:""}`))==null?void 0:v.values())??[])},getNodeConnections:({type:d,handleId:h,nodeId:g})=>{var v;return Array.from(((v=n.getState().connectionLookup.get(`${g}${d?h?`-${d}-${h}`:`-${d}`:""}`))==null?void 0:v.values())??[])},fitView:async d=>{const h=n.getState().fitViewResolver??oU();return n.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:h}),r.nodeQueue.push(g=>[...g]),h.promise}}},[]);return x.useMemo(()=>({...i,...e,viewportInitialized:o}),[o])}const m1=e=>e.selected,DV=typeof window<"u"?window:void 0;function LV({deleteKeyCode:e,multiSelectionKeyCode:n}){const r=Ie(),{deleteElements:o}=d0(),i=Da(e,{actInsideInputWithModifier:!1}),s=Da(n,{target:DV});x.useEffect(()=>{if(i){const{edges:a,nodes:l}=r.getState();o({nodes:l.filter(m1),edges:a.filter(m1)}),r.setState({nodesSelectionActive:!1})}},[i]),x.useEffect(()=>{r.setState({multiSelectionActive:s})},[s])}function zV(e){const n=Ie();x.useEffect(()=>{const r=()=>{var i,s,a,l;if(!e.current||!(((s=(i=e.current).checkVisibility)==null?void 0:s.call(i))??!0))return!1;const o=i0(e.current);(o.height===0||o.width===0)&&((l=(a=n.getState()).onError)==null||l.call(a,"004",In.error004())),n.setState({width:o.width||500,height:o.height||500})};if(e.current){r(),window.addEventListener("resize",r);const o=new ResizeObserver(()=>r());return o.observe(e.current),()=>{window.removeEventListener("resize",r),o&&e.current&&o.unobserve(e.current)}}},[])}const Yd={position:"absolute",width:"100%",height:"100%",top:0,left:0},FV=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function BV({onPaneContextMenu:e,zoomOnScroll:n=!0,zoomOnPinch:r=!0,panOnScroll:o=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=No.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:f,maxZoom:d,zoomActivationKeyCode:h,preventScrolling:g=!0,children:v,noWheelClassName:b,noPanClassName:_,onViewportChange:m,isControlledViewport:w,paneClickDistance:y,selectionOnDrag:S}){const k=Ie(),C=x.useRef(null),{userSelectionActive:N,lib:E,connectionInProgress:j}=we(FV,Te),A=Da(h),T=x.useRef();zV(C);const D=x.useCallback(F=>{m==null||m({x:F[0],y:F[1],zoom:F[2]}),w||k.setState({transform:F})},[m,w]);return x.useEffect(()=>{if(C.current){T.current=BU({domNode:C.current,minZoom:f,maxZoom:d,translateExtent:u,viewport:c,onDraggingChange:I=>k.setState(z=>z.paneDragging===I?z:{paneDragging:I}),onPanZoomStart:(I,z)=>{const{onViewportChangeStart:R,onMoveStart:M}=k.getState();M==null||M(I,z),R==null||R(z)},onPanZoom:(I,z)=>{const{onViewportChange:R,onMove:M}=k.getState();M==null||M(I,z),R==null||R(z)},onPanZoomEnd:(I,z)=>{const{onViewportChangeEnd:R,onMoveEnd:M}=k.getState();M==null||M(I,z),R==null||R(z)}});const{x:F,y:P,zoom:L}=T.current.getViewport();return k.setState({panZoom:T.current,transform:[F,P,L],domNode:C.current.closest(".react-flow")}),()=>{var I;(I=T.current)==null||I.destroy()}}},[]),x.useEffect(()=>{var F;(F=T.current)==null||F.update({onPaneContextMenu:e,zoomOnScroll:n,zoomOnPinch:r,panOnScroll:o,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:A,preventScrolling:g,noPanClassName:_,userSelectionActive:N,noWheelClassName:b,lib:E,onTransformChange:D,connectionInProgress:j,selectionOnDrag:S,paneClickDistance:y})},[e,n,r,o,i,s,a,l,A,g,_,N,b,E,D,j,S,y]),p.jsx("div",{className:"react-flow__renderer",ref:C,style:Yd,children:v})}const HV=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function UV(){const{userSelectionActive:e,userSelectionRect:n}=we(HV,Te);return e&&n?p.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const nh=(e,n)=>r=>{r.target===n.current&&(e==null||e(r))},VV=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function WV({isSelecting:e,selectionKeyPressed:n,selectionMode:r=Ia.Full,panOnDrag:o,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:f,onPaneMouseEnter:d,onPaneMouseMove:h,onPaneMouseLeave:g,children:v}){const b=Ie(),{userSelectionActive:_,elementsSelectable:m,dragging:w,connectionInProgress:y}=we(VV,Te),S=m&&(e||_),k=x.useRef(null),C=x.useRef(),N=x.useRef(new Set),E=x.useRef(new Set),j=x.useRef(!1),A=R=>{if(j.current||y){j.current=!1;return}c==null||c(R),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},T=R=>{if(Array.isArray(o)&&(o!=null&&o.includes(2))){R.preventDefault();return}u==null||u(R)},D=f?R=>f(R):void 0,F=R=>{j.current&&(R.stopPropagation(),j.current=!1)},P=R=>{var U,G;const{domNode:M}=b.getState();if(C.current=M==null?void 0:M.getBoundingClientRect(),!C.current)return;const O=R.target===k.current;if(!O&&!!R.target.closest(".nokey")||!e||!(s&&O||n)||R.button!==0||!R.isPrimary)return;(G=(U=R.target)==null?void 0:U.setPointerCapture)==null||G.call(U,R.pointerId),j.current=!1;const{x:K,y:B}=dn(R.nativeEvent,C.current);b.setState({userSelectionRect:{width:0,height:0,startX:K,startY:B,x:K,y:B}}),O||(R.stopPropagation(),R.preventDefault())},L=R=>{const{userSelectionRect:M,transform:O,nodeLookup:V,edgeLookup:$,connectionLookup:K,triggerNodeChanges:B,triggerEdgeChanges:U,defaultEdgeOptions:G,resetSelectedElements:W}=b.getState();if(!C.current||!M)return;const{x:X,y:q}=dn(R.nativeEvent,C.current),{startX:te,startY:ee}=M;if(!j.current){const pe=n?0:i;if(Math.hypot(X-te,q-ee)<=pe)return;W(),a==null||a(R)}j.current=!0;const Q={startX:te,startY:ee,x:X<te?X:te,y:q<ee?q:ee,width:Math.abs(X-te),height:Math.abs(q-ee)},ne=N.current,ue=E.current;N.current=new Set(r0(V,Q,O,r===Ia.Partial,!0).map(pe=>pe.id)),E.current=new Set;const ye=(G==null?void 0:G.selectable)??!0;for(const pe of N.current){const ke=K.get(pe);if(ke)for(const{edgeId:tt}of ke.values()){const Xe=$.get(tt);Xe&&(Xe.selectable??ye)&&E.current.add(tt)}}if(!Vx(ne,N.current)){const pe=wi(V,N.current,!0);B(pe)}if(!Vx(ue,E.current)){const pe=wi($,E.current);U(pe)}b.setState({userSelectionRect:Q,userSelectionActive:!0,nodesSelectionActive:!1})},I=R=>{var M,O;R.button===0&&((O=(M=R.target)==null?void 0:M.releasePointerCapture)==null||O.call(M,R.pointerId),!_&&R.target===k.current&&b.getState().userSelectionRect&&(A==null||A(R)),b.setState({userSelectionActive:!1,userSelectionRect:null}),j.current&&(l==null||l(R),b.setState({nodesSelectionActive:N.current.size>0})))},z=o===!0||Array.isArray(o)&&o.includes(0);return p.jsxs("div",{className:Ue(["react-flow__pane",{draggable:z,dragging:w,selection:e}]),onClick:S?void 0:nh(A,k),onContextMenu:nh(T,k),onWheel:nh(D,k),onPointerEnter:S?void 0:d,onPointerMove:S?L:h,onPointerUp:S?I:void 0,onPointerDownCapture:S?P:void 0,onClickCapture:S?F:void 0,onPointerLeave:g,ref:k,style:Yd,children:[v,p.jsx(UV,{})]})}function Gp({id:e,store:n,unselect:r=!1,nodeRef:o}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:l,onError:c}=n.getState(),u=l.get(e);if(!u){c==null||c("012",In.error012(e));return}n.setState({nodesSelectionActive:!1}),u.selected?(r||u.selected&&a)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var f;return(f=o==null?void 0:o.current)==null?void 0:f.blur()})):i([e])}function CE({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:o,nodeId:i,isSelectable:s,nodeClickDistance:a}){const l=Ie(),[c,u]=x.useState(!1),f=x.useRef();return x.useEffect(()=>{f.current=EU({getStoreItems:()=>l.getState(),onNodeMouseDown:d=>{Gp({id:d,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),x.useEffect(()=>{if(!(n||!e.current||!f.current))return f.current.update({noDragClassName:r,handleSelector:o,domNode:e.current,isSelectable:s,nodeId:i,nodeClickDistance:a}),()=>{var d;(d=f.current)==null||d.destroy()}},[r,o,n,s,e,i,a]),c}const GV=e=>n=>n.selected&&(n.draggable||e&&typeof n.draggable>"u");function NE(){const e=Ie();return x.useCallback(r=>{const{nodeExtent:o,snapToGrid:i,snapGrid:s,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:f}=e.getState(),d=new Map,h=GV(a),g=i?s[0]:5,v=i?s[1]:5,b=r.direction.x*g*r.factor,_=r.direction.y*v*r.factor;for(const[,m]of u){if(!h(m))continue;let w={x:m.internals.positionAbsolute.x+b,y:m.internals.positionAbsolute.y+_};i&&(w=al(w,s));const{position:y,positionAbsolute:S}=WN({nodeId:m.id,nextPosition:w,nodeLookup:u,nodeExtent:o,nodeOrigin:f,onError:l});m.position=y,m.internals.positionAbsolute=S,d.set(m.id,m)}c(d)},[])}const f0=x.createContext(null),YV=f0.Provider;f0.Consumer;const EE=()=>x.useContext(f0),XV=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),KV=(e,n,r)=>o=>{const{connectionClickStartHandle:i,connectionMode:s,connection:a}=o,{fromHandle:l,toHandle:c,isValid:u}=a,f=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===n&&(c==null?void 0:c.type)===r;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===n&&(l==null?void 0:l.type)===r,connectingTo:f,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===n&&(i==null?void 0:i.type)===r,isPossibleEndHandle:s===Yi.Strict?(l==null?void 0:l.type)!==r:e!==(l==null?void 0:l.nodeId)||n!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!i,valid:f&&u}};function qV({type:e="source",position:n=ce.Top,isValidConnection:r,isConnectable:o=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:f,onTouchStart:d,...h},g){var L,I;const v=a||null,b=e==="target",_=Ie(),m=EE(),{connectOnClick:w,noPanClassName:y,rfId:S}=we(XV,Te),{connectingFrom:k,connectingTo:C,clickConnecting:N,isPossibleEndHandle:E,connectionInProcess:j,clickConnectionInProcess:A,valid:T}=we(KV(m,v,e),Te);m||(I=(L=_.getState()).onError)==null||I.call(L,"010",In.error010());const D=z=>{const{defaultEdgeOptions:R,onConnect:M,hasDefaultEdges:O}=_.getState(),V={...R,...z};if(O){const{edges:$,setEdges:K}=_.getState();K(dU(V,$))}M==null||M(V),l==null||l(V)},F=z=>{if(!m)return;const R=JN(z.nativeEvent);if(i&&(R&&z.button===0||!R)){const M=_.getState();Vp.onPointerDown(z.nativeEvent,{handleDomNode:z.currentTarget,autoPanOnConnect:M.autoPanOnConnect,connectionMode:M.connectionMode,connectionRadius:M.connectionRadius,domNode:M.domNode,nodeLookup:M.nodeLookup,lib:M.lib,isTarget:b,handleId:v,nodeId:m,flowId:M.rfId,panBy:M.panBy,cancelConnection:M.cancelConnection,onConnectStart:M.onConnectStart,onConnectEnd:(...O)=>{var V,$;return($=(V=_.getState()).onConnectEnd)==null?void 0:$.call(V,...O)},updateConnection:M.updateConnection,onConnect:D,isValidConnection:r||((...O)=>{var V,$;return(($=(V=_.getState()).isValidConnection)==null?void 0:$.call(V,...O))??!0}),getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:M.autoPanSpeed,dragThreshold:M.connectionDragThreshold})}R?f==null||f(z):d==null||d(z)},P=z=>{const{onClickConnectStart:R,onClickConnectEnd:M,connectionClickStartHandle:O,connectionMode:V,isValidConnection:$,lib:K,rfId:B,nodeLookup:U,connection:G}=_.getState();if(!m||!O&&!i)return;if(!O){R==null||R(z.nativeEvent,{nodeId:m,handleId:v,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:m,type:e,id:v}});return}const W=QN(z.target),X=r||$,{connection:q,isValid:te}=Vp.isValid(z.nativeEvent,{handle:{nodeId:m,id:v,type:e},connectionMode:V,fromNodeId:O.nodeId,fromHandleId:O.id||null,fromType:O.type,isValidConnection:X,flowId:B,doc:W,lib:K,nodeLookup:U});te&&q&&D(q);const ee=structuredClone(G);delete ee.inProgress,ee.toPosition=ee.toHandle?ee.toHandle.position:null,M==null||M(z,ee),_.setState({connectionClickStartHandle:null})};return p.jsx("div",{"data-handleid":v,"data-nodeid":m,"data-handlepos":n,"data-id":`${S}-${m}-${v}-${e}`,className:Ue(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",y,u,{source:!b,target:b,connectable:o,connectablestart:i,connectableend:s,clickconnecting:N,connectingfrom:k,connectingto:C,valid:T,connectionindicator:o&&(!j||E)&&(j||A?s:i)}]),onMouseDown:F,onTouchStart:F,onClick:w?P:void 0,ref:g,...h,children:c})}const Lu=x.memo(SE(qV));function QV({data:e,isConnectable:n,sourcePosition:r=ce.Bottom}){return p.jsxs(p.Fragment,{children:[e==null?void 0:e.label,p.jsx(Lu,{type:"source",position:r,isConnectable:n})]})}function ZV({data:e,isConnectable:n,targetPosition:r=ce.Top,sourcePosition:o=ce.Bottom}){return p.jsxs(p.Fragment,{children:[p.jsx(Lu,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label,p.jsx(Lu,{type:"source",position:o,isConnectable:n})]})}function JV(){return null}function eW({data:e,isConnectable:n,targetPosition:r=ce.Top}){return p.jsxs(p.Fragment,{children:[p.jsx(Lu,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label]})}const zu={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},g1={input:QV,default:ZV,output:eW,group:JV};function tW(e){var n,r,o,i;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((n=e.style)==null?void 0:n.width),height:e.height??e.initialHeight??((r=e.style)==null?void 0:r.height)}:{width:e.width??((o=e.style)==null?void 0:o.width),height:e.height??((i=e.style)==null?void 0:i.height)}}const nW=e=>{const{width:n,height:r,x:o,y:i}=sl(e.nodeLookup,{filter:s=>!!s.selected});return{width:un(n)?n:null,height:un(r)?r:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${i}px)`}};function rW({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const o=Ie(),{width:i,height:s,transformString:a,userSelectionActive:l}=we(nW,Te),c=NE(),u=x.useRef(null);x.useEffect(()=>{var g;r||(g=u.current)==null||g.focus({preventScroll:!0})},[r]);const f=!l&&i!==null&&s!==null;if(CE({nodeRef:u,disabled:!f}),!f)return null;const d=e?g=>{const v=o.getState().nodes.filter(b=>b.selected);e(g,v)}:void 0,h=g=>{Object.prototype.hasOwnProperty.call(zu,g.key)&&(g.preventDefault(),c({direction:zu[g.key],factor:g.shiftKey?4:1}))};return p.jsx("div",{className:Ue(["react-flow__nodesselection","react-flow__container",n]),style:{transform:a},children:p.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:r?void 0:-1,onKeyDown:r?void 0:h,style:{width:i,height:s}})})}const v1=typeof window<"u"?window:void 0,oW=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function jE({children:e,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:f,selectionMode:d,onSelectionStart:h,onSelectionEnd:g,multiSelectionKeyCode:v,panActivationKeyCode:b,zoomActivationKeyCode:_,elementsSelectable:m,zoomOnScroll:w,zoomOnPinch:y,panOnScroll:S,panOnScrollSpeed:k,panOnScrollMode:C,zoomOnDoubleClick:N,panOnDrag:E,defaultViewport:j,translateExtent:A,minZoom:T,maxZoom:D,preventScrolling:F,onSelectionContextMenu:P,noWheelClassName:L,noPanClassName:I,disableKeyboardA11y:z,onViewportChange:R,isControlledViewport:M}){const{nodesSelectionActive:O,userSelectionActive:V}=we(oW,Te),$=Da(u,{target:v1}),K=Da(b,{target:v1}),B=K||E,U=K||S,G=f&&B!==!0,W=$||V||G;return LV({deleteKeyCode:c,multiSelectionKeyCode:v}),p.jsx(BV,{onPaneContextMenu:s,elementsSelectable:m,zoomOnScroll:w,zoomOnPinch:y,panOnScroll:U,panOnScrollSpeed:k,panOnScrollMode:C,zoomOnDoubleClick:N,panOnDrag:!$&&B,defaultViewport:j,translateExtent:A,minZoom:T,maxZoom:D,zoomActivationKeyCode:_,preventScrolling:F,noWheelClassName:L,noPanClassName:I,onViewportChange:R,isControlledViewport:M,paneClickDistance:l,selectionOnDrag:G,children:p.jsxs(WV,{onSelectionStart:h,onSelectionEnd:g,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:B,isSelecting:!!W,selectionMode:d,selectionKeyPressed:$,paneClickDistance:l,selectionOnDrag:G,children:[e,O&&p.jsx(rW,{onSelectionContextMenu:P,noPanClassName:I,disableKeyboardA11y:z})]})})}jE.displayName="FlowRenderer";const iW=x.memo(jE),sW=e=>n=>e?r0(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map(r=>r.id):Array.from(n.nodeLookup.keys());function aW(e){return we(x.useCallback(sW(e),[e]),Te)}const lW=e=>e.updateNodeInternals;function cW(){const e=we(lW),[n]=x.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(r=>{const o=new Map;r.forEach(i=>{const s=i.target.getAttribute("data-id");o.set(s,{id:s,nodeElement:i.target,force:!0})}),e(o)}));return x.useEffect(()=>()=>{n==null||n.disconnect()},[n]),n}function uW({node:e,nodeType:n,hasDimensions:r,resizeObserver:o}){const i=Ie(),s=x.useRef(null),a=x.useRef(null),l=x.useRef(e.sourcePosition),c=x.useRef(e.targetPosition),u=x.useRef(n),f=r&&!!e.internals.handleBounds;return x.useEffect(()=>{s.current&&!e.hidden&&(!f||a.current!==s.current)&&(a.current&&(o==null||o.unobserve(a.current)),o==null||o.observe(s.current),a.current=s.current)},[f,e.hidden]),x.useEffect(()=>()=>{a.current&&(o==null||o.unobserve(a.current),a.current=null)},[]),x.useEffect(()=>{if(s.current){const d=u.current!==n,h=l.current!==e.sourcePosition,g=c.current!==e.targetPosition;(d||h||g)&&(u.current=n,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),s}function dW({id:e,onClick:n,onMouseEnter:r,onMouseMove:o,onMouseLeave:i,onContextMenu:s,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:f,resizeObserver:d,noDragClassName:h,noPanClassName:g,disableKeyboardA11y:v,rfId:b,nodeTypes:_,nodeClickDistance:m,onError:w}){const{node:y,internals:S,isParent:k}=we(X=>{const q=X.nodeLookup.get(e),te=X.parentLookup.has(e);return{node:q,internals:q.internals,isParent:te}},Te);let C=y.type||"default",N=(_==null?void 0:_[C])||g1[C];N===void 0&&(w==null||w("003",In.error003(C)),C="default",N=(_==null?void 0:_.default)||g1.default);const E=!!(y.draggable||l&&typeof y.draggable>"u"),j=!!(y.selectable||c&&typeof y.selectable>"u"),A=!!(y.connectable||u&&typeof y.connectable>"u"),T=!!(y.focusable||f&&typeof y.focusable>"u"),D=Ie(),F=KN(y),P=uW({node:y,nodeType:C,hasDimensions:F,resizeObserver:d}),L=CE({nodeRef:P,disabled:y.hidden||!E,noDragClassName:h,handleSelector:y.dragHandle,nodeId:e,isSelectable:j,nodeClickDistance:m}),I=NE();if(y.hidden)return null;const z=dr(y),R=tW(y),M=j||E||n||r||o||i,O=r?X=>r(X,{...S.userNode}):void 0,V=o?X=>o(X,{...S.userNode}):void 0,$=i?X=>i(X,{...S.userNode}):void 0,K=s?X=>s(X,{...S.userNode}):void 0,B=a?X=>a(X,{...S.userNode}):void 0,U=X=>{const{selectNodesOnDrag:q,nodeDragThreshold:te}=D.getState();j&&(!q||!E||te>0)&&Gp({id:e,store:D,nodeRef:P}),n&&n(X,{...S.userNode})},G=X=>{if(!(ZN(X.nativeEvent)||v)){if(FN.includes(X.key)&&j){const q=X.key==="Escape";Gp({id:e,store:D,unselect:q,nodeRef:P})}else if(E&&y.selected&&Object.prototype.hasOwnProperty.call(zu,X.key)){X.preventDefault();const{ariaLabelConfig:q}=D.getState();D.setState({ariaLiveMessage:q["node.a11yDescription.ariaLiveMessage"]({direction:X.key.replace("Arrow","").toLowerCase(),x:~~S.positionAbsolute.x,y:~~S.positionAbsolute.y})}),I({direction:zu[X.key],factor:X.shiftKey?4:1})}}},W=()=>{var ue;if(v||!((ue=P.current)!=null&&ue.matches(":focus-visible")))return;const{transform:X,width:q,height:te,autoPanOnNodeFocus:ee,setCenter:Q}=D.getState();if(!ee)return;r0(new Map([[e,y]]),{x:0,y:0,width:q,height:te},X,!0).length>0||Q(y.position.x+z.width/2,y.position.y+z.height/2,{zoom:X[2]})};return p.jsx("div",{className:Ue(["react-flow__node",`react-flow__node-${C}`,{[g]:E},y.className,{selected:y.selected,selectable:j,parent:k,draggable:E,dragging:L}]),ref:P,style:{zIndex:S.z,transform:`translate(${S.positionAbsolute.x}px,${S.positionAbsolute.y}px)`,pointerEvents:M?"all":"none",visibility:F?"visible":"hidden",...y.style,...R},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:O,onMouseMove:V,onMouseLeave:$,onContextMenu:K,onClick:U,onDoubleClick:B,onKeyDown:T?G:void 0,tabIndex:T?0:void 0,onFocus:T?W:void 0,role:y.ariaRole??(T?"group":void 0),"aria-roledescription":"node","aria-describedby":v?void 0:`${xE}-${b}`,"aria-label":y.ariaLabel,...y.domAttributes,children:p.jsx(YV,{value:e,children:p.jsx(N,{id:e,data:y.data,type:C,positionAbsoluteX:S.positionAbsolute.x,positionAbsoluteY:S.positionAbsolute.y,selected:y.selected??!1,selectable:j,draggable:E,deletable:y.deletable??!0,isConnectable:A,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:L,dragHandle:y.dragHandle,zIndex:S.z,parentId:y.parentId,...z})})})}var fW=x.memo(dW);const hW=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function PE(e){const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:o,elementsSelectable:i,onError:s}=we(hW,Te),a=aW(e.onlyRenderVisibleElements),l=cW();return p.jsx("div",{className:"react-flow__nodes",style:Yd,children:a.map(c=>p.jsx(fW,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:n,nodesConnectable:r,nodesFocusable:o,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}PE.displayName="NodeRenderer";const pW=x.memo(PE);function mW(e){return we(x.useCallback(r=>{if(!e)return r.edges.map(i=>i.id);const o=[];if(r.width&&r.height)for(const i of r.edges){const s=r.nodeLookup.get(i.source),a=r.nodeLookup.get(i.target);s&&a&&lU({sourceNode:s,targetNode:a,width:r.width,height:r.height,transform:r.transform})&&o.push(i.id)}return o},[e]),Te)}const gW=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e}};return p.jsx("polyline",{className:"arrow",style:r,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},vW=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e,fill:e}};return p.jsx("polyline",{className:"arrowclosed",style:r,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},y1={[Ou.Arrow]:gW,[Ou.ArrowClosed]:vW};function yW(e){const n=Ie();return x.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call(y1,e)?y1[e]:((s=(i=n.getState()).onError)==null||s.call(i,"009",In.error009(e)),null)},[e])}const xW=({id:e,type:n,color:r,width:o=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=yW(n);return c?p.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0",children:p.jsx(c,{color:r,strokeWidth:a})}):null},ME=({defaultColor:e,rfId:n})=>{const r=we(s=>s.edges),o=we(s=>s.defaultEdgeOptions),i=x.useMemo(()=>gU(r,{id:n,defaultColor:e,defaultMarkerStart:o==null?void 0:o.markerStart,defaultMarkerEnd:o==null?void 0:o.markerEnd}),[r,o,n,e]);return i.length?p.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:p.jsx("defs",{children:i.map(s=>p.jsx(xW,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};ME.displayName="MarkerDefinitions";var wW=x.memo(ME);function RE({x:e,y:n,label:r,labelStyle:o,labelShowBg:i=!0,labelBgStyle:s,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...f}){const[d,h]=x.useState({x:1,y:0,width:0,height:0}),g=Ue(["react-flow__edge-textwrapper",u]),v=x.useRef(null);return x.useEffect(()=>{if(v.current){const b=v.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[r]),r?p.jsxs("g",{transform:`translate(${e-d.width/2} ${n-d.height/2})`,className:g,visibility:d.width?"visible":"hidden",...f,children:[i&&p.jsx("rect",{width:d.width+2*a[0],x:-a[0],y:-a[1],height:d.height+2*a[1],className:"react-flow__edge-textbg",style:s,rx:l,ry:l}),p.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:v,style:o,children:r}),c]}):null}RE.displayName="EdgeText";const bW=x.memo(RE);function Xd({path:e,labelX:n,labelY:r,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...f}){return p.jsxs(p.Fragment,{children:[p.jsx("path",{...f,d:e,fill:"none",className:Ue(["react-flow__edge-path",f.className])}),u?p.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,o&&un(n)&&un(r)?p.jsx(bW,{x:n,y:r,label:o,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function x1({pos:e,x1:n,y1:r,x2:o,y2:i}){return e===ce.Left||e===ce.Right?[.5*(n+o),r]:[n,.5*(r+i)]}function AE({sourceX:e,sourceY:n,sourcePosition:r=ce.Bottom,targetX:o,targetY:i,targetPosition:s=ce.Top}){const[a,l]=x1({pos:r,x1:e,y1:n,x2:o,y2:i}),[c,u]=x1({pos:s,x1:o,y1:i,x2:e,y2:n}),[f,d,h,g]=eE({sourceX:e,sourceY:n,targetX:o,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${n} C${a},${l} ${c},${u} ${o},${i}`,f,d,h,g]}function TE(e){return x.memo(({id:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g,style:v,markerEnd:b,markerStart:_,interactionWidth:m})=>{const[w,y,S]=AE({sourceX:r,sourceY:o,sourcePosition:a,targetX:i,targetY:s,targetPosition:l}),k=e.isInternal?void 0:n;return p.jsx(Xd,{id:k,path:w,labelX:y,labelY:S,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g,style:v,markerEnd:b,markerStart:_,interactionWidth:m})})}const _W=TE({isInternal:!1}),IE=TE({isInternal:!0});_W.displayName="SimpleBezierEdge";IE.displayName="SimpleBezierEdgeInternal";function OE(e){return x.memo(({id:n,sourceX:r,sourceY:o,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:h,sourcePosition:g=ce.Bottom,targetPosition:v=ce.Top,markerEnd:b,markerStart:_,pathOptions:m,interactionWidth:w})=>{const[y,S,k]=Bp({sourceX:r,sourceY:o,sourcePosition:g,targetX:i,targetY:s,targetPosition:v,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset,stepPosition:m==null?void 0:m.stepPosition}),C=e.isInternal?void 0:n;return p.jsx(Xd,{id:C,path:y,labelX:S,labelY:k,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:h,markerEnd:b,markerStart:_,interactionWidth:w})})}const $E=OE({isInternal:!1}),DE=OE({isInternal:!0});$E.displayName="SmoothStepEdge";DE.displayName="SmoothStepEdgeInternal";function LE(e){return x.memo(({id:n,...r})=>{var i;const o=e.isInternal?void 0:n;return p.jsx($E,{...r,id:o,pathOptions:x.useMemo(()=>{var s;return{borderRadius:0,offset:(s=r.pathOptions)==null?void 0:s.offset}},[(i=r.pathOptions)==null?void 0:i.offset])})})}const SW=LE({isInternal:!1}),zE=LE({isInternal:!0});SW.displayName="StepEdge";zE.displayName="StepEdgeInternal";function FE(e){return x.memo(({id:n,sourceX:r,sourceY:o,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:h,markerEnd:g,markerStart:v,interactionWidth:b})=>{const[_,m,w]=rE({sourceX:r,sourceY:o,targetX:i,targetY:s}),y=e.isInternal?void 0:n;return p.jsx(Xd,{id:y,path:_,labelX:m,labelY:w,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:h,markerEnd:g,markerStart:v,interactionWidth:b})})}const kW=FE({isInternal:!1}),BE=FE({isInternal:!0});kW.displayName="StraightEdge";BE.displayName="StraightEdgeInternal";function HE(e){return x.memo(({id:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:a=ce.Bottom,targetPosition:l=ce.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g,style:v,markerEnd:b,markerStart:_,pathOptions:m,interactionWidth:w})=>{const[y,S,k]=tE({sourceX:r,sourceY:o,sourcePosition:a,targetX:i,targetY:s,targetPosition:l,curvature:m==null?void 0:m.curvature}),C=e.isInternal?void 0:n;return p.jsx(Xd,{id:C,path:y,labelX:S,labelY:k,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:g,style:v,markerEnd:b,markerStart:_,interactionWidth:w})})}const CW=HE({isInternal:!1}),UE=HE({isInternal:!0});CW.displayName="BezierEdge";UE.displayName="BezierEdgeInternal";const w1={default:UE,straight:BE,step:zE,smoothstep:DE,simplebezier:IE},b1={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},NW=(e,n,r)=>r===ce.Left?e-n:r===ce.Right?e+n:e,EW=(e,n,r)=>r===ce.Top?e-n:r===ce.Bottom?e+n:e,_1="react-flow__edgeupdater";function S1({position:e,centerX:n,centerY:r,radius:o=10,onMouseDown:i,onMouseEnter:s,onMouseOut:a,type:l}){return p.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:a,className:Ue([_1,`${_1}-${l}`]),cx:NW(n,o,e),cy:EW(r,o,e),r:o,stroke:"transparent",fill:"transparent"})}function jW({isReconnectable:e,reconnectRadius:n,edge:r,sourceX:o,sourceY:i,targetX:s,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:f,onReconnectEnd:d,setReconnecting:h,setUpdateHover:g}){const v=Ie(),b=(S,k)=>{if(S.button!==0)return;const{autoPanOnConnect:C,domNode:N,connectionMode:E,connectionRadius:j,lib:A,onConnectStart:T,cancelConnection:D,nodeLookup:F,rfId:P,panBy:L,updateConnection:I}=v.getState(),z=k.type==="target",R=(V,$)=>{h(!1),d==null||d(V,r,k.type,$)},M=V=>u==null?void 0:u(r,V),O=(V,$)=>{h(!0),f==null||f(S,r,k.type),T==null||T(V,$)};Vp.onPointerDown(S.nativeEvent,{autoPanOnConnect:C,connectionMode:E,connectionRadius:j,domNode:N,handleId:k.id,nodeId:k.nodeId,nodeLookup:F,isTarget:z,edgeUpdaterType:k.type,lib:A,flowId:P,cancelConnection:D,panBy:L,isValidConnection:(...V)=>{var $,K;return((K=($=v.getState()).isValidConnection)==null?void 0:K.call($,...V))??!0},onConnect:M,onConnectStart:O,onConnectEnd:(...V)=>{var $,K;return(K=($=v.getState()).onConnectEnd)==null?void 0:K.call($,...V)},onReconnectEnd:R,updateConnection:I,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,dragThreshold:v.getState().connectionDragThreshold,handleDomNode:S.currentTarget})},_=S=>b(S,{nodeId:r.target,id:r.targetHandle??null,type:"target"}),m=S=>b(S,{nodeId:r.source,id:r.sourceHandle??null,type:"source"}),w=()=>g(!0),y=()=>g(!1);return p.jsxs(p.Fragment,{children:[(e===!0||e==="source")&&p.jsx(S1,{position:l,centerX:o,centerY:i,radius:n,onMouseDown:_,onMouseEnter:w,onMouseOut:y,type:"source"}),(e===!0||e==="target")&&p.jsx(S1,{position:c,centerX:s,centerY:a,radius:n,onMouseDown:m,onMouseEnter:w,onMouseOut:y,type:"target"})]})}function PW({id:e,edgesFocusable:n,edgesReconnectable:r,elementsSelectable:o,onClick:i,onDoubleClick:s,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:g,rfId:v,edgeTypes:b,noPanClassName:_,onError:m,disableKeyboardA11y:w}){let y=we(Q=>Q.edgeLookup.get(e));const S=we(Q=>Q.defaultEdgeOptions);y=S?{...S,...y}:y;let k=y.type||"default",C=(b==null?void 0:b[k])||w1[k];C===void 0&&(m==null||m("011",In.error011(k)),k="default",C=(b==null?void 0:b.default)||w1.default);const N=!!(y.focusable||n&&typeof y.focusable>"u"),E=typeof d<"u"&&(y.reconnectable||r&&typeof y.reconnectable>"u"),j=!!(y.selectable||o&&typeof y.selectable>"u"),A=x.useRef(null),[T,D]=x.useState(!1),[F,P]=x.useState(!1),L=Ie(),{zIndex:I,sourceX:z,sourceY:R,targetX:M,targetY:O,sourcePosition:V,targetPosition:$}=we(x.useCallback(Q=>{const ne=Q.nodeLookup.get(y.source),ue=Q.nodeLookup.get(y.target);if(!ne||!ue)return{zIndex:y.zIndex,...b1};const ye=mU({id:e,sourceNode:ne,targetNode:ue,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:Q.connectionMode,onError:m});return{zIndex:aU({selected:y.selected,zIndex:y.zIndex,sourceNode:ne,targetNode:ue,elevateOnSelect:Q.elevateEdgesOnSelect,zIndexMode:Q.zIndexMode}),...ye||b1}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),Te),K=x.useMemo(()=>y.markerStart?`url('#${Hp(y.markerStart,v)}')`:void 0,[y.markerStart,v]),B=x.useMemo(()=>y.markerEnd?`url('#${Hp(y.markerEnd,v)}')`:void 0,[y.markerEnd,v]);if(y.hidden||z===null||R===null||M===null||O===null)return null;const U=Q=>{var pe;const{addSelectedEdges:ne,unselectNodesAndEdges:ue,multiSelectionActive:ye}=L.getState();j&&(L.setState({nodesSelectionActive:!1}),y.selected&&ye?(ue({nodes:[],edges:[y]}),(pe=A.current)==null||pe.blur()):ne([e])),i&&i(Q,y)},G=s?Q=>{s(Q,{...y})}:void 0,W=a?Q=>{a(Q,{...y})}:void 0,X=l?Q=>{l(Q,{...y})}:void 0,q=c?Q=>{c(Q,{...y})}:void 0,te=u?Q=>{u(Q,{...y})}:void 0,ee=Q=>{var ne;if(!w&&FN.includes(Q.key)&&j){const{unselectNodesAndEdges:ue,addSelectedEdges:ye}=L.getState();Q.key==="Escape"?((ne=A.current)==null||ne.blur(),ue({edges:[y]})):ye([e])}};return p.jsx("svg",{style:{zIndex:I},children:p.jsxs("g",{className:Ue(["react-flow__edge",`react-flow__edge-${k}`,y.className,_,{selected:y.selected,animated:y.animated,inactive:!j&&!i,updating:T,selectable:j}]),onClick:U,onDoubleClick:G,onContextMenu:W,onMouseEnter:X,onMouseMove:q,onMouseLeave:te,onKeyDown:N?ee:void 0,tabIndex:N?0:void 0,role:y.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":N?`${wE}-${v}`:void 0,ref:A,...y.domAttributes,children:[!F&&p.jsx(C,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:j,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:z,sourceY:R,targetX:M,targetY:O,sourcePosition:V,targetPosition:$,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:K,markerEnd:B,pathOptions:"pathOptions"in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),E&&p.jsx(jW,{edge:y,isReconnectable:E,reconnectRadius:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:g,sourceX:z,sourceY:R,targetX:M,targetY:O,sourcePosition:V,targetPosition:$,setUpdateHover:D,setReconnecting:P})]})})}var MW=x.memo(PW);const RW=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function VE({defaultMarkerColor:e,onlyRenderVisibleElements:n,rfId:r,edgeTypes:o,noPanClassName:i,onReconnect:s,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:f,reconnectRadius:d,onEdgeDoubleClick:h,onReconnectStart:g,onReconnectEnd:v,disableKeyboardA11y:b}){const{edgesFocusable:_,edgesReconnectable:m,elementsSelectable:w,onError:y}=we(RW,Te),S=mW(n);return p.jsxs("div",{className:"react-flow__edges",children:[p.jsx(wW,{defaultColor:e,rfId:r}),S.map(k=>p.jsx(MW,{id:k,edgesFocusable:_,edgesReconnectable:m,elementsSelectable:w,noPanClassName:i,onReconnect:s,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:f,reconnectRadius:d,onDoubleClick:h,onReconnectStart:g,onReconnectEnd:v,rfId:r,onError:y,edgeTypes:o,disableKeyboardA11y:b},k))]})}VE.displayName="EdgeRenderer";const AW=x.memo(VE),TW=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function IW({children:e}){const n=we(TW);return p.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}function OW(e){const n=d0(),r=x.useRef(!1);x.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const $W=e=>{var n;return(n=e.panZoom)==null?void 0:n.syncViewport};function DW(e){const n=we($W),r=Ie();return x.useEffect(()=>{e&&(n==null||n(e),r.setState({transform:[e.x,e.y,e.zoom]}))},[e,n]),null}function LW(e){return e.connection.inProgress?{...e.connection,to:ll(e.connection.to,e.transform)}:{...e.connection}}function zW(e){return LW}function FW(e){const n=zW();return we(n,Te)}const BW=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function HW({containerStyle:e,style:n,type:r,component:o}){const{nodesConnectable:i,width:s,height:a,isValid:l,inProgress:c}=we(BW,Te);return!(s&&i&&c)?null:p.jsx("svg",{style:e,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:p.jsx("g",{className:Ue(["react-flow__connection",UN(l)]),children:p.jsx(WE,{style:n,type:r,CustomComponent:o,isValid:l})})})}const WE=({style:e,type:n=Pr.Bezier,CustomComponent:r,isValid:o})=>{const{inProgress:i,from:s,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:f,toHandle:d,toPosition:h,pointer:g}=FW();if(!i)return;if(r)return p.jsx(r,{connectionLineType:n,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:UN(o),toNode:f,toHandle:d,pointer:g});let v="";const b={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(n){case Pr.Bezier:[v]=tE(b);break;case Pr.SimpleBezier:[v]=AE(b);break;case Pr.Step:[v]=Bp({...b,borderRadius:0});break;case Pr.SmoothStep:[v]=Bp(b);break;default:[v]=rE(b)}return p.jsx("path",{d:v,fill:"none",className:"react-flow__connection-path",style:e})};WE.displayName="ConnectionLine";const UW={};function k1(e=UW){x.useRef(e),Ie(),x.useEffect(()=>{},[e])}function VW(){Ie(),x.useRef(!1),x.useEffect(()=>{},[])}function GE({nodeTypes:e,edgeTypes:n,onInit:r,onNodeClick:o,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:f,onSelectionContextMenu:d,onSelectionStart:h,onSelectionEnd:g,connectionLineType:v,connectionLineStyle:b,connectionLineComponent:_,connectionLineContainerStyle:m,selectionKeyCode:w,selectionOnDrag:y,selectionMode:S,multiSelectionKeyCode:k,panActivationKeyCode:C,zoomActivationKeyCode:N,deleteKeyCode:E,onlyRenderVisibleElements:j,elementsSelectable:A,defaultViewport:T,translateExtent:D,minZoom:F,maxZoom:P,preventScrolling:L,defaultMarkerColor:I,zoomOnScroll:z,zoomOnPinch:R,panOnScroll:M,panOnScrollSpeed:O,panOnScrollMode:V,zoomOnDoubleClick:$,panOnDrag:K,onPaneClick:B,onPaneMouseEnter:U,onPaneMouseMove:G,onPaneMouseLeave:W,onPaneScroll:X,onPaneContextMenu:q,paneClickDistance:te,nodeClickDistance:ee,onEdgeContextMenu:Q,onEdgeMouseEnter:ne,onEdgeMouseMove:ue,onEdgeMouseLeave:ye,reconnectRadius:pe,onReconnect:ke,onReconnectStart:tt,onReconnectEnd:Xe,noDragClassName:Zt,noWheelClassName:fr,noPanClassName:Dn,disableKeyboardA11y:hr,nodeExtent:pr,rfId:io,viewport:Ln,onViewportChange:so}){return k1(e),k1(n),VW(),OW(r),DW(Ln),p.jsx(iW,{onPaneClick:B,onPaneMouseEnter:U,onPaneMouseMove:G,onPaneMouseLeave:W,onPaneContextMenu:q,onPaneScroll:X,paneClickDistance:te,deleteKeyCode:E,selectionKeyCode:w,selectionOnDrag:y,selectionMode:S,onSelectionStart:h,onSelectionEnd:g,multiSelectionKeyCode:k,panActivationKeyCode:C,zoomActivationKeyCode:N,elementsSelectable:A,zoomOnScroll:z,zoomOnPinch:R,zoomOnDoubleClick:$,panOnScroll:M,panOnScrollSpeed:O,panOnScrollMode:V,panOnDrag:K,defaultViewport:T,translateExtent:D,minZoom:F,maxZoom:P,onSelectionContextMenu:d,preventScrolling:L,noDragClassName:Zt,noWheelClassName:fr,noPanClassName:Dn,disableKeyboardA11y:hr,onViewportChange:so,isControlledViewport:!!Ln,children:p.jsxs(IW,{children:[p.jsx(AW,{edgeTypes:n,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:ke,onReconnectStart:tt,onReconnectEnd:Xe,onlyRenderVisibleElements:j,onEdgeContextMenu:Q,onEdgeMouseEnter:ne,onEdgeMouseMove:ue,onEdgeMouseLeave:ye,reconnectRadius:pe,defaultMarkerColor:I,noPanClassName:Dn,disableKeyboardA11y:hr,rfId:io}),p.jsx(HW,{style:b,type:v,component:_,containerStyle:m}),p.jsx("div",{className:"react-flow__edgelabel-renderer"}),p.jsx(pW,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:f,nodeClickDistance:ee,onlyRenderVisibleElements:j,noPanClassName:Dn,noDragClassName:Zt,disableKeyboardA11y:hr,nodeExtent:pr,rfId:io}),p.jsx("div",{className:"react-flow__viewport-portal"})]})})}GE.displayName="GraphView";const WW=x.memo(GE),C1=({nodes:e,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:f,nodeExtent:d,zIndexMode:h="basic"}={})=>{const g=new Map,v=new Map,b=new Map,_=new Map,m=o??n??[],w=r??e??[],y=f??[0,0],S=d??Ta;sE(b,_,m);const{nodesInitialized:k}=Up(w,g,v,{nodeOrigin:y,nodeExtent:S,zIndexMode:h});let C=[0,0,1];if(a&&i&&s){const N=sl(g,{filter:T=>!!((T.width||T.initialWidth)&&(T.height||T.initialHeight))}),{x:E,y:j,zoom:A}=o0(N,i,s,c,u,(l==null?void 0:l.padding)??.1);C=[E,j,A]}return{rfId:"1",width:i??0,height:s??0,transform:C,nodes:w,nodesInitialized:k,nodeLookup:g,parentLookup:v,edges:m,edgeLookup:_,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:r!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Ta,nodeExtent:S,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Yi.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...HN},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:tU,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:BN,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},GW=({nodes:e,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:f,nodeExtent:d,zIndexMode:h})=>cV((g,v)=>{async function b(){const{nodeLookup:_,panZoom:m,fitViewOptions:w,fitViewResolver:y,width:S,height:k,minZoom:C,maxZoom:N}=v();m&&(await JH({nodes:_,width:S,height:k,panZoom:m,minZoom:C,maxZoom:N},w),y==null||y.resolve(!0),g({fitViewResolver:null}))}return{...C1({nodes:e,edges:n,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:f,nodeExtent:d,defaultNodes:r,defaultEdges:o,zIndexMode:h}),setNodes:_=>{const{nodeLookup:m,parentLookup:w,nodeOrigin:y,elevateNodesOnSelect:S,fitViewQueued:k,zIndexMode:C,nodesSelectionActive:N}=v(),{nodesInitialized:E,hasSelectedNodes:j}=Up(_,m,w,{nodeOrigin:y,nodeExtent:d,elevateNodesOnSelect:S,checkEquality:!0,zIndexMode:C}),A=N&&j;k&&E?(b(),g({nodes:_,nodesInitialized:E,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:A})):g({nodes:_,nodesInitialized:E,nodesSelectionActive:A})},setEdges:_=>{const{connectionLookup:m,edgeLookup:w}=v();sE(m,w,_),g({edges:_})},setDefaultNodesAndEdges:(_,m)=>{if(_){const{setNodes:w}=v();w(_),g({hasDefaultNodes:!0})}if(m){const{setEdges:w}=v();w(m),g({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:m,nodeLookup:w,parentLookup:y,domNode:S,nodeOrigin:k,nodeExtent:C,debug:N,fitViewQueued:E,zIndexMode:j}=v(),{changes:A,updatedInternals:T}=SU(_,w,y,S,k,C,j);T&&(xU(w,y,{nodeOrigin:k,nodeExtent:C,zIndexMode:j}),E?(b(),g({fitViewQueued:!1,fitViewOptions:void 0})):g({}),(A==null?void 0:A.length)>0&&(N&&console.log("React Flow: trigger node changes",A),m==null||m(A)))},updateNodePositions:(_,m=!1)=>{const w=[];let y=[];const{nodeLookup:S,triggerNodeChanges:k,connection:C,updateConnection:N,onNodesChangeMiddlewareMap:E}=v();for(const[j,A]of _){const T=S.get(j),D=!!(T!=null&&T.expandParent&&(T!=null&&T.parentId)&&(A!=null&&A.position)),F={id:j,type:"position",position:D?{x:Math.max(0,A.position.x),y:Math.max(0,A.position.y)}:A.position,dragging:m};if(T&&C.inProgress&&C.fromNode.id===T.id){const P=Fo(T,C.fromHandle,ce.Left,!0);N({...C,from:P})}D&&T.parentId&&w.push({id:j,parentId:T.parentId,rect:{...A.internals.positionAbsolute,width:A.measured.width??0,height:A.measured.height??0}}),y.push(F)}if(w.length>0){const{parentLookup:j,nodeOrigin:A}=v(),T=u0(w,S,j,A);y.push(...T)}for(const j of E.values())y=j(y);k(y)},triggerNodeChanges:_=>{const{onNodesChange:m,setNodes:w,nodes:y,hasDefaultNodes:S,debug:k}=v();if(_!=null&&_.length){if(S){const C=MV(_,y);w(C)}k&&console.log("React Flow: trigger node changes",_),m==null||m(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:m,setEdges:w,edges:y,hasDefaultEdges:S,debug:k}=v();if(_!=null&&_.length){if(S){const C=RV(_,y);w(C)}k&&console.log("React Flow: trigger edge changes",_),m==null||m(_)}},addSelectedNodes:_=>{const{multiSelectionActive:m,edgeLookup:w,nodeLookup:y,triggerNodeChanges:S,triggerEdgeChanges:k}=v();if(m){const C=_.map(N=>go(N,!0));S(C);return}S(wi(y,new Set([..._]),!0)),k(wi(w))},addSelectedEdges:_=>{const{multiSelectionActive:m,edgeLookup:w,nodeLookup:y,triggerNodeChanges:S,triggerEdgeChanges:k}=v();if(m){const C=_.map(N=>go(N,!0));k(C);return}k(wi(w,new Set([..._]))),S(wi(y,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:m}={})=>{const{edges:w,nodes:y,nodeLookup:S,triggerNodeChanges:k,triggerEdgeChanges:C}=v(),N=_||y,E=m||w,j=[];for(const T of N){if(!T.selected)continue;const D=S.get(T.id);D&&(D.selected=!1),j.push(go(T.id,!1))}const A=[];for(const T of E)T.selected&&A.push(go(T.id,!1));k(j),C(A)},setMinZoom:_=>{const{panZoom:m,maxZoom:w}=v();m==null||m.setScaleExtent([_,w]),g({minZoom:_})},setMaxZoom:_=>{const{panZoom:m,minZoom:w}=v();m==null||m.setScaleExtent([w,_]),g({maxZoom:_})},setTranslateExtent:_=>{var m;(m=v().panZoom)==null||m.setTranslateExtent(_),g({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:m,triggerNodeChanges:w,triggerEdgeChanges:y,elementsSelectable:S}=v();if(!S)return;const k=m.reduce((N,E)=>E.selected?[...N,go(E.id,!1)]:N,[]),C=_.reduce((N,E)=>E.selected?[...N,go(E.id,!1)]:N,[]);w(k),y(C)},setNodeExtent:_=>{const{nodes:m,nodeLookup:w,parentLookup:y,nodeOrigin:S,elevateNodesOnSelect:k,nodeExtent:C,zIndexMode:N}=v();_[0][0]===C[0][0]&&_[0][1]===C[0][1]&&_[1][0]===C[1][0]&&_[1][1]===C[1][1]||(Up(m,w,y,{nodeOrigin:S,nodeExtent:_,elevateNodesOnSelect:k,checkEquality:!1,zIndexMode:N}),g({nodeExtent:_}))},panBy:_=>{const{transform:m,width:w,height:y,panZoom:S,translateExtent:k}=v();return kU({delta:_,panZoom:S,transform:m,translateExtent:k,width:w,height:y})},setCenter:async(_,m,w)=>{const{width:y,height:S,maxZoom:k,panZoom:C}=v();if(!C)return Promise.resolve(!1);const N=typeof(w==null?void 0:w.zoom)<"u"?w.zoom:k;return await C.setViewport({x:y/2-_*N,y:S/2-m*N,zoom:N},{duration:w==null?void 0:w.duration,ease:w==null?void 0:w.ease,interpolate:w==null?void 0:w.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{g({connection:{...HN}})},updateConnection:_=>{g({connection:_})},reset:()=>g({...C1()})}},Object.is);function Kd({initialNodes:e,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:s,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:f,nodeExtent:d,zIndexMode:h,children:g}){const[v]=x.useState(()=>GW({nodes:e,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:f,nodeExtent:d,zIndexMode:h}));return p.jsx(uV,{value:v,children:p.jsx(IV,{children:g})})}function YW({children:e,nodes:n,edges:r,defaultNodes:o,defaultEdges:i,width:s,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:f,nodeOrigin:d,nodeExtent:h,zIndexMode:g}){return x.useContext(Wd)?p.jsx(p.Fragment,{children:e}):p.jsx(Kd,{initialNodes:n,initialEdges:r,defaultNodes:o,defaultEdges:i,initialWidth:s,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:f,nodeOrigin:d,nodeExtent:h,zIndexMode:g,children:e})}const XW={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function KW({nodes:e,edges:n,defaultNodes:r,defaultEdges:o,className:i,nodeTypes:s,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:f,onMoveStart:d,onMoveEnd:h,onConnect:g,onConnectStart:v,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:m,onNodeMouseEnter:w,onNodeMouseMove:y,onNodeMouseLeave:S,onNodeContextMenu:k,onNodeDoubleClick:C,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:j,onNodesDelete:A,onEdgesDelete:T,onDelete:D,onSelectionChange:F,onSelectionDragStart:P,onSelectionDrag:L,onSelectionDragStop:I,onSelectionContextMenu:z,onSelectionStart:R,onSelectionEnd:M,onBeforeDelete:O,connectionMode:V,connectionLineType:$=Pr.Bezier,connectionLineStyle:K,connectionLineComponent:B,connectionLineContainerStyle:U,deleteKeyCode:G="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:X=!1,selectionMode:q=Ia.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:ee=$a()?"Meta":"Control",zoomActivationKeyCode:Q=$a()?"Meta":"Control",snapToGrid:ne,snapGrid:ue,onlyRenderVisibleElements:ye=!1,selectNodesOnDrag:pe,nodesDraggable:ke,autoPanOnNodeFocus:tt,nodesConnectable:Xe,nodesFocusable:Zt,nodeOrigin:fr=bE,edgesFocusable:Dn,edgesReconnectable:hr,elementsSelectable:pr=!0,defaultViewport:io=SV,minZoom:Ln=.5,maxZoom:so=2,translateExtent:us=Ta,preventScrolling:cl=!0,nodeExtent:ds,defaultMarkerColor:Yo="#b1b1b7",zoomOnScroll:fs=!0,zoomOnPinch:qd=!0,panOnScroll:ul=!1,panOnScrollSpeed:dl=.5,panOnScrollMode:fl=No.Free,zoomOnDoubleClick:hl=!0,panOnDrag:pl=!0,onPaneClick:ml,onPaneMouseEnter:gl,onPaneMouseMove:vl,onPaneMouseLeave:yl,onPaneScroll:xl,onPaneContextMenu:Y,paneClickDistance:de=1,nodeClickDistance:he=0,children:Fe,onReconnect:ct,onReconnectStart:ao,onReconnectEnd:xn,onEdgeContextMenu:lo,onEdgeDoubleClick:Xo,onEdgeMouseEnter:wl,onEdgeMouseMove:bl,onEdgeMouseLeave:co,reconnectRadius:vt=10,onNodesChange:QE,onEdgesChange:ZE,noDragClassName:JE="nodrag",noWheelClassName:ej="nowheel",noPanClassName:v0="nopan",fitView:y0,fitViewOptions:x0,connectOnClick:tj,attributionPosition:nj,proOptions:rj,defaultEdgeOptions:oj,elevateNodesOnSelect:ij=!0,elevateEdgesOnSelect:sj=!1,disableKeyboardA11y:w0=!1,autoPanOnConnect:aj,autoPanOnNodeDrag:lj,autoPanSpeed:cj,connectionRadius:uj,isValidConnection:dj,onError:fj,style:hj,id:b0,nodeDragThreshold:pj,connectionDragThreshold:mj,viewport:gj,onViewportChange:vj,width:yj,height:xj,colorMode:wj="light",debug:bj,onScroll:_l,ariaLabelConfig:_j,zIndexMode:_0="basic",...Sj},kj){const Qd=b0||"1",Cj=EV(wj),Nj=x.useCallback(S0=>{S0.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),_l==null||_l(S0)},[_l]);return p.jsx("div",{"data-testid":"rf__wrapper",...Sj,onScroll:Nj,style:{...hj,...XW},ref:kj,className:Ue(["react-flow",i,Cj]),id:b0,role:"application",children:p.jsxs(YW,{nodes:e,edges:n,width:yj,height:xj,fitView:y0,fitViewOptions:x0,minZoom:Ln,maxZoom:so,nodeOrigin:fr,nodeExtent:ds,zIndexMode:_0,children:[p.jsx(NV,{nodes:e,edges:n,defaultNodes:r,defaultEdges:o,onConnect:g,onConnectStart:v,onConnectEnd:b,onClickConnectStart:_,onClickConnectEnd:m,nodesDraggable:ke,autoPanOnNodeFocus:tt,nodesConnectable:Xe,nodesFocusable:Zt,edgesFocusable:Dn,edgesReconnectable:hr,elementsSelectable:pr,elevateNodesOnSelect:ij,elevateEdgesOnSelect:sj,minZoom:Ln,maxZoom:so,nodeExtent:ds,onNodesChange:QE,onEdgesChange:ZE,snapToGrid:ne,snapGrid:ue,connectionMode:V,translateExtent:us,connectOnClick:tj,defaultEdgeOptions:oj,fitView:y0,fitViewOptions:x0,onNodesDelete:A,onEdgesDelete:T,onDelete:D,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:j,onSelectionDrag:L,onSelectionDragStart:P,onSelectionDragStop:I,onMove:f,onMoveStart:d,onMoveEnd:h,noPanClassName:v0,nodeOrigin:fr,rfId:Qd,autoPanOnConnect:aj,autoPanOnNodeDrag:lj,autoPanSpeed:cj,onError:fj,connectionRadius:uj,isValidConnection:dj,selectNodesOnDrag:pe,nodeDragThreshold:pj,connectionDragThreshold:mj,onBeforeDelete:O,debug:bj,ariaLabelConfig:_j,zIndexMode:_0}),p.jsx(WW,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:w,onNodeMouseMove:y,onNodeMouseLeave:S,onNodeContextMenu:k,onNodeDoubleClick:C,nodeTypes:s,edgeTypes:a,connectionLineType:$,connectionLineStyle:K,connectionLineComponent:B,connectionLineContainerStyle:U,selectionKeyCode:W,selectionOnDrag:X,selectionMode:q,deleteKeyCode:G,multiSelectionKeyCode:ee,panActivationKeyCode:te,zoomActivationKeyCode:Q,onlyRenderVisibleElements:ye,defaultViewport:io,translateExtent:us,minZoom:Ln,maxZoom:so,preventScrolling:cl,zoomOnScroll:fs,zoomOnPinch:qd,zoomOnDoubleClick:hl,panOnScroll:ul,panOnScrollSpeed:dl,panOnScrollMode:fl,panOnDrag:pl,onPaneClick:ml,onPaneMouseEnter:gl,onPaneMouseMove:vl,onPaneMouseLeave:yl,onPaneScroll:xl,onPaneContextMenu:Y,paneClickDistance:de,nodeClickDistance:he,onSelectionContextMenu:z,onSelectionStart:R,onSelectionEnd:M,onReconnect:ct,onReconnectStart:ao,onReconnectEnd:xn,onEdgeContextMenu:lo,onEdgeDoubleClick:Xo,onEdgeMouseEnter:wl,onEdgeMouseMove:bl,onEdgeMouseLeave:co,reconnectRadius:vt,defaultMarkerColor:Yo,noDragClassName:JE,noWheelClassName:ej,noPanClassName:v0,rfId:Qd,disableKeyboardA11y:w0,nodeExtent:ds,viewport:gj,onViewportChange:vj}),p.jsx(_V,{onSelectionChange:F}),Fe,p.jsx(vV,{proOptions:rj,position:nj}),p.jsx(gV,{rfId:Qd,disableKeyboardA11y:w0})]})})}var h0=SE(KW);function qW({dimensions:e,lineWidth:n,variant:r,className:o}){return p.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ue(["react-flow__background-pattern",r,o])})}function QW({radius:e,className:n}){return p.jsx("circle",{cx:e,cy:e,r:e,className:Ue(["react-flow__background-pattern","dots",n])})}var Ur;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ur||(Ur={}));const ZW={[Ur.Dots]:1,[Ur.Lines]:1,[Ur.Cross]:6},JW=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function YE({id:e,variant:n=Ur.Dots,gap:r=20,size:o,lineWidth:i=1,offset:s=0,color:a,bgColor:l,style:c,className:u,patternClassName:f}){const d=x.useRef(null),{transform:h,patternId:g}=we(JW,Te),v=o||ZW[n],b=n===Ur.Dots,_=n===Ur.Cross,m=Array.isArray(r)?r:[r,r],w=[m[0]*h[2]||1,m[1]*h[2]||1],y=v*h[2],S=Array.isArray(s)?s:[s,s],k=_?[y,y]:w,C=[S[0]*h[2]||1+k[0]/2,S[1]*h[2]||1+k[1]/2],N=`${g}${e||""}`;return p.jsxs("svg",{className:Ue(["react-flow__background",u]),style:{...c,...Yd,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:d,"data-testid":"rf__background",children:[p.jsx("pattern",{id:N,x:h[0]%w[0],y:h[1]%w[1],width:w[0],height:w[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:b?p.jsx(QW,{radius:y/2,className:f}):p.jsx(qW,{dimensions:k,lineWidth:i,variant:n,className:f})}),p.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}YE.displayName="Background";const p0=x.memo(YE);function eG(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:p.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function tG(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:p.jsx("path",{d:"M0 0h32v4.2H0z"})})}function nG(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:p.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function rG(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:p.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function oG(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:p.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function sc({children:e,className:n,...r}){return p.jsx("button",{type:"button",className:Ue(["react-flow__controls-button",n]),...r,children:e})}const iG=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function XE({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:o=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:f,position:d="bottom-left",orientation:h="vertical","aria-label":g}){const v=Ie(),{isInteractive:b,minZoomReached:_,maxZoomReached:m,ariaLabelConfig:w}=we(iG,Te),{zoomIn:y,zoomOut:S,fitView:k}=d0(),C=()=>{y(),s==null||s()},N=()=>{S(),a==null||a()},E=()=>{k(i),l==null||l()},j=()=>{v.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},A=h==="horizontal"?"horizontal":"vertical";return p.jsxs(Gd,{className:Ue(["react-flow__controls",A,u]),position:d,style:e,"data-testid":"rf__controls","aria-label":g??w["controls.ariaLabel"],children:[n&&p.jsxs(p.Fragment,{children:[p.jsx(sc,{onClick:C,className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:m,children:p.jsx(eG,{})}),p.jsx(sc,{onClick:N,className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:_,children:p.jsx(tG,{})})]}),r&&p.jsx(sc,{className:"react-flow__controls-fitview",onClick:E,title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:p.jsx(nG,{})}),o&&p.jsx(sc,{className:"react-flow__controls-interactive",onClick:j,title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:b?p.jsx(oG,{}):p.jsx(rG,{})}),f]})}XE.displayName="Controls";const m0=x.memo(XE);function sG({id:e,x:n,y:r,width:o,height:i,style:s,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:f,shapeRendering:d,selected:h,onClick:g}){const{background:v,backgroundColor:b}=s||{},_=a||v||b;return p.jsx("rect",{className:Ue(["react-flow__minimap-node",{selected:h},u]),x:n,y:r,rx:f,ry:f,width:o,height:i,style:{fill:_,stroke:l,strokeWidth:c},shapeRendering:d,onClick:g?m=>g(m,e):void 0})}const aG=x.memo(sG),lG=e=>e.nodes.map(n=>n.id),rh=e=>e instanceof Function?e:()=>e;function cG({nodeStrokeColor:e,nodeColor:n,nodeClassName:r="",nodeBorderRadius:o=5,nodeStrokeWidth:i,nodeComponent:s=aG,onClick:a}){const l=we(lG,Te),c=rh(n),u=rh(e),f=rh(r),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return p.jsx(p.Fragment,{children:l.map(h=>p.jsx(dG,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:f,nodeBorderRadius:o,nodeStrokeWidth:i,NodeComponent:s,onClick:a,shapeRendering:d},h))})}function uG({id:e,nodeColorFunc:n,nodeStrokeColorFunc:r,nodeClassNameFunc:o,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:f,y:d,width:h,height:g}=we(v=>{const b=v.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const _=b.internals.userNode,{x:m,y:w}=b.internals.positionAbsolute,{width:y,height:S}=dr(_);return{node:_,x:m,y:w,width:y,height:S}},Te);return!u||u.hidden||!KN(u)?null:p.jsx(l,{x:f,y:d,width:h,height:g,style:u.style,selected:!!u.selected,className:o(u),color:n(u),borderRadius:i,strokeColor:r(u),strokeWidth:s,shapeRendering:a,onClick:c,id:u.id})}const dG=x.memo(uG);var fG=x.memo(cG);const hG=200,pG=150,mG=e=>!e.hidden,gG=e=>{const n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:e.nodeLookup.size>0?XN(sl(e.nodeLookup,{filter:mG}),n):n,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},vG="react-flow__minimap-desc";function KE({style:e,className:n,nodeStrokeColor:r,nodeColor:o,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:f,maskStrokeWidth:d,position:h="bottom-right",onClick:g,onNodeClick:v,pannable:b=!1,zoomable:_=!1,ariaLabel:m,inversePan:w,zoomStep:y=1,offsetScale:S=5}){const k=Ie(),C=x.useRef(null),{boundingRect:N,viewBB:E,rfId:j,panZoom:A,translateExtent:T,flowWidth:D,flowHeight:F,ariaLabelConfig:P}=we(gG,Te),L=(e==null?void 0:e.width)??hG,I=(e==null?void 0:e.height)??pG,z=N.width/L,R=N.height/I,M=Math.max(z,R),O=M*L,V=M*I,$=S*M,K=N.x-(O-N.width)/2-$,B=N.y-(V-N.height)/2-$,U=O+$*2,G=V+$*2,W=`${vG}-${j}`,X=x.useRef(0),q=x.useRef();X.current=M,x.useEffect(()=>{if(C.current&&A)return q.current=TU({domNode:C.current,panZoom:A,getTransform:()=>k.getState().transform,getViewScale:()=>X.current}),()=>{var ne;(ne=q.current)==null||ne.destroy()}},[A]),x.useEffect(()=>{var ne;(ne=q.current)==null||ne.update({translateExtent:T,width:D,height:F,inversePan:w,pannable:b,zoomStep:y,zoomable:_})},[b,_,w,y,T,D,F]);const te=g?ne=>{var pe;const[ue,ye]=((pe=q.current)==null?void 0:pe.pointer(ne))||[0,0];g(ne,{x:ue,y:ye})}:void 0,ee=v?x.useCallback((ne,ue)=>{const ye=k.getState().nodeLookup.get(ue).internals.userNode;v(ne,ye)},[]):void 0,Q=m??P["minimap.ariaLabel"];return p.jsx(Gd,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*M:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:Ue(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:p.jsxs("svg",{width:L,height:I,viewBox:`${K} ${B} ${U} ${G}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":W,ref:C,onClick:te,children:[Q&&p.jsx("title",{id:W,children:Q}),p.jsx(fG,{onClick:ee,nodeColor:o,nodeStrokeColor:r,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:a,nodeComponent:l}),p.jsx("path",{className:"react-flow__minimap-mask",d:`M${K-$},${B-$}h${U+$*2}v${G+$*2}h${-U-$*2}z
|
|
443
|
+
M${E.x},${E.y}h${E.width}v${E.height}h${-E.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}KE.displayName="MiniMap";x.memo(KE);const yG=e=>n=>e?`${Math.max(1/n.transform[2],1)}`:void 0,xG={[Qi.Line]:"right",[Qi.Handle]:"bottom-right"};function wG({nodeId:e,position:n,variant:r=Qi.Handle,className:o,style:i=void 0,children:s,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:h,autoScale:g=!0,shouldResize:v,onResizeStart:b,onResize:_,onResizeEnd:m}){const w=EE(),y=typeof e=="string"?e:w,S=Ie(),k=x.useRef(null),C=r===Qi.Handle,N=we(x.useCallback(yG(C&&g),[C,g]),Te),E=x.useRef(null),j=n??xG[r];x.useEffect(()=>{if(!(!k.current||!y))return E.current||(E.current=YU({domNode:k.current,nodeId:y,getStoreItems:()=>{const{nodeLookup:T,transform:D,snapGrid:F,snapToGrid:P,nodeOrigin:L,domNode:I}=S.getState();return{nodeLookup:T,transform:D,snapGrid:F,snapToGrid:P,nodeOrigin:L,paneDomNode:I}},onChange:(T,D)=>{const{triggerNodeChanges:F,nodeLookup:P,parentLookup:L,nodeOrigin:I}=S.getState(),z=[],R={x:T.x,y:T.y},M=P.get(y);if(M&&M.expandParent&&M.parentId){const O=M.origin??I,V=T.width??M.measured.width??0,$=T.height??M.measured.height??0,K={id:M.id,parentId:M.parentId,rect:{width:V,height:$,...qN({x:T.x??M.position.x,y:T.y??M.position.y},{width:V,height:$},M.parentId,P,O)}},B=u0([K],P,L,I);z.push(...B),R.x=T.x?Math.max(O[0]*V,T.x):void 0,R.y=T.y?Math.max(O[1]*$,T.y):void 0}if(R.x!==void 0&&R.y!==void 0){const O={id:y,type:"position",position:{...R}};z.push(O)}if(T.width!==void 0&&T.height!==void 0){const V={id:y,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:T.width,height:T.height}};z.push(V)}for(const O of D){const V={...O,type:"position"};z.push(V)}F(z)},onEnd:({width:T,height:D})=>{const F={id:y,type:"dimensions",resizing:!1,dimensions:{width:T,height:D}};S.getState().triggerNodeChanges([F])}})),E.current.update({controlPosition:j,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:f},keepAspectRatio:d,resizeDirection:h,onResizeStart:b,onResize:_,onResizeEnd:m,shouldResize:v}),()=>{var T;(T=E.current)==null||T.destroy()}},[j,l,c,u,f,d,b,_,m,v]);const A=j.split("-");return p.jsx("div",{className:Ue(["react-flow__resize-control","nodrag",...A,r,o]),ref:k,style:{...i,scale:N,...a&&{[C?"backgroundColor":"borderColor"]:a}},children:s})}x.memo(wG);const N1=3,ac={screen:0,hook:160,api:340,table:520},Yp=220,E1=40;function lc(e,n){const r=new Map,o=e.length,s=-(o*Yp+(o-1)*E1)/2;return e.forEach((a,l)=>{r.set(a,{x:s+l*(Yp+E1),y:n})}),r}function j1(e,n,r){const o=e.map(i=>{const a=(r.get(i)??[]).map(c=>{var u;return((u=n.get(c))==null?void 0:u.x)??0}),l=a.length>0?a.reduce((c,u)=>c+u,0)/a.length:0;return{id:i,avg:l}});return o.sort((i,s)=>i.avg-s.avg),o.map(i=>i.id)}function cc(e){const n={width:Yp,padding:"10px 12px",borderRadius:10,border:"1px solid rgba(255, 255, 255, 0.14)",background:"rgba(48, 50, 72, 0.96)",color:"#f2f2f6",fontSize:12,fontFamily:"inherit",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.4)"};return e==="screen"?{...n,borderColor:"rgba(139, 92, 246, 0.9)",background:"linear-gradient(135deg, rgba(139,92,246,0.45) 0%, rgba(58, 48, 90, 0.96) 100%)",boxShadow:"0 2px 14px rgba(139, 92, 246, 0.25)"}:e==="api"?{...n,borderColor:"rgba(139, 92, 246, 0.55)"}:e==="table"?{...n,borderColor:"rgba(34, 197, 94, 0.55)",background:"rgba(38, 58, 48, 0.96)"}:n}function uc(e,n,r){const o=e==="screen"?Ua:e==="hook"?KR:e==="api"?Zm:Qm;return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[p.jsx(o,{style:{width:12,height:12,opacity:.7}}),p.jsx("span",{style:{fontWeight:600},children:n})]}),r&&p.jsx("span",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:10,opacity:.7,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r})]})}function bG({screen:e,graphs:n,onNodeSelect:r,selectedNodeId:o}){const{nodes:i,edges:s,empty:a}=x.useMemo(()=>{if(!n.ui||!n.api||!n.db)return{nodes:[],edges:[],empty:!0};const m=new Map;for(const B of n.ui.edges)B.type==="imports"&&(m.has(B.source)||m.set(B.source,[]),m.get(B.source).push(B.target));const w=new Set([e.id]);{let B=[e.id];for(let U=0;U<N1&&B.length>0;U++){const G=[];for(const W of B)for(const X of m.get(W)??[])w.has(X)||(w.add(X),G.push(X));B=G}}const y=new Map;for(const B of n.ui.cross_refs??[])B.type!=="calls_api"&&B.type!=="references_api"||B.layer!=="api"||w.has(B.source)&&(y.has(B.source)||y.set(B.source,[]),y.get(B.source).push(B.target));const S=new Set;for(const B of y.values())for(const U of B)S.add(U);if(S.size===0)return{nodes:[],edges:[],empty:!0};const k=(m.get(e.id)??[]).filter(B=>B!==e.id),C=[],N=new Map;for(const B of k){const U=new Set([B]);let G=[B];for(let X=0;X<N1&&G.length>0;X++){const q=[];for(const te of G)for(const ee of m.get(te)??[])U.has(ee)||(U.add(ee),q.push(ee));G=q}const W=new Set;for(const X of U)for(const q of y.get(X)??[])W.add(q);W.size>0&&(C.push(B),N.set(B,W))}const E=new Set(y.get(e.id)??[]),j=n.api.nodes.filter(B=>S.has(B.id)),A=new Set,T=new Map;for(const B of j){const U=(B.db_models??[]).map(G=>G);T.set(B.id,U);for(const G of U)A.add(G)}const D=n.db.nodes.filter(B=>A.has(B.name)||A.has(B.name.toLowerCase())),F=new Map;for(const B of D)F.set(B.name,B.id),F.set(B.name.toLowerCase(),B.id);const P=[],L=[],I=lc([e.id],ac.screen);P.push({id:`screen:${e.id}`,position:I.get(e.id),data:{label:uc("screen",Kr(e),e.route??void 0)},style:cc("screen"),sourcePosition:"bottom",targetPosition:"top"});const z=[...C].sort((B,U)=>{const G=[...N.get(B)??[]],W=[...N.get(U)??[]],X=j.map(te=>te.id),q=te=>{const ee=te.map(Q=>X.indexOf(Q)).filter(Q=>Q>=0);return ee.length>0?ee.reduce((Q,ne)=>Q+ne,0)/ee.length:0};return q(G)-q(W)});if(z.length>0){const B=lc(z,ac.hook);for(const U of z){const G=U.split("/").pop()??U;P.push({id:`hook:${U}`,position:B.get(U),data:{label:uc("hook",G.replace(/\.tsx?$/,""),U)},style:cc("hook"),sourcePosition:"bottom",targetPosition:"top"}),L.push({id:`e:screen-${U}`,source:`screen:${e.id}`,target:`hook:${U}`,animated:!1,style:{stroke:"rgba(139,92,246,0.95)"}})}}const R=new Map;for(const B of C){const U=P.find(G=>G.id===`hook:${B}`);U&&R.set(B,U.position)}R.set(e.id,I.get(e.id));const M=new Map;for(const B of S){const U=[];E.has(B)&&U.push(e.id);for(const[G,W]of N.entries())W.has(B)&&U.push(G);M.set(B,U)}const O=j1(j.map(B=>B.id),R,M);if(O.length>0){const B=lc(O,ac.api);for(const U of j)P.push({id:`api:${U.id}`,position:B.get(U.id),data:{label:uc("api",`${U.methods.join(",")} ${U.path.split("/").pop()||"/"}`,U.path)},style:cc("api"),sourcePosition:"bottom",targetPosition:"top"});for(const U of E)S.has(U)&&L.push({id:`e:screen-api-${U}`,source:`screen:${e.id}`,target:`api:${U}`,style:{stroke:"rgba(139,92,246,0.95)"}});for(const[U,G]of N.entries())for(const W of G)L.push({id:`e:${U}-${W}`,source:`hook:${U}`,target:`api:${W}`,style:{stroke:"rgba(139,92,246,0.95)"}})}const V=new Map;for(const B of O){const U=P.find(G=>G.id===`api:${B}`);U&&V.set(B,U.position)}const $=new Map;for(const B of j){const U=T.get(B.id)??[];for(const G of U){const W=F.get(G)??F.get(G.toLowerCase());W&&($.has(W)||$.set(W,[]),$.get(W).push(B.id))}}const K=j1(D.map(B=>B.id),V,$);if(K.length>0){const B=lc(K,ac.table);for(const U of D)P.push({id:`table:${U.id}`,position:B.get(U.id),data:{label:uc("table",U.name)},style:cc("table"),sourcePosition:"bottom",targetPosition:"top"});for(const U of j){const G=T.get(U.id)??[];for(const W of G){const X=F.get(W)??F.get(W.toLowerCase());X&&L.push({id:`e:${U.id}-${X}`,source:`api:${U.id}`,target:`table:${X}`,style:{stroke:"rgba(34,197,94,0.95)"}})}}}return{nodes:P,edges:L,empty:!1}},[e,n]),l=x.useRef(null),c=i,u=s,f=x.useCallback(m=>{const w=l.current;if(!w)return;const y=new Set([m]),S=new Set;for(const k of s)k.source===m&&(y.add(k.target),S.add(k.id)),k.target===m&&(y.add(k.source),S.add(k.id));w.querySelectorAll(".react-flow__node").forEach(k=>{const C=k.getAttribute("data-id")??"";k.style.opacity=y.has(C)?"1":"0.15",k.style.transition="opacity 120ms ease"}),w.querySelectorAll(".react-flow__edge").forEach(k=>{const C=k.getAttribute("data-id")??"",N=S.has(C);k.style.opacity=N?"1":"0.08",k.style.transition="opacity 120ms ease",N&&k.classList.add("animated")})},[s]),d=x.useCallback(()=>{const m=l.current;m&&(m.querySelectorAll(".react-flow__node").forEach(w=>{w.style.opacity="",w.style.transition=""}),m.querySelectorAll(".react-flow__edge").forEach(w=>{w.style.opacity="",w.style.transition="",w.classList.remove("animated")}))},[]),h=x.useCallback((m,w)=>{f(w.id)},[f]),g=x.useCallback(()=>{d()},[d]),v=(m,w)=>{const[y,...S]=w.id.split(":"),k=S.join(":"),C={screen:"ui",hook:"ui",api:"api",table:"db"};r==null||r(k,C[y]??"ui")};if(a)return p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsxs("div",{className:"text-center",children:[p.jsx("h3",{className:"text-sm font-semibold text-foreground",children:Kr(e)}),p.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"No API or database dependencies detected for this screen."})]})});const{focusedNodes:b,focusedEdges:_}=x.useMemo(()=>{var k;if(!o)return{focusedNodes:c,focusedEdges:u};const m=(k=c.find(C=>{const[,...N]=C.id.split(":");return N.join(":")===o}))==null?void 0:k.id;if(!m)return{focusedNodes:c,focusedEdges:u};const w=new Set([m]);for(const C of u)C.source===m&&w.add(C.target),C.target===m&&w.add(C.source);const y=c.filter(C=>w.has(C.id)),S=u.filter(C=>w.has(C.source)&&w.has(C.target));return{focusedNodes:y,focusedEdges:S}},[c,u,o]);return p.jsx("div",{ref:l,className:"relative h-full w-full",children:p.jsx(Kd,{children:p.jsxs(h0,{nodes:b,edges:_,fitView:!0,fitViewOptions:{padding:.3},proOptions:{hideAttribution:!0},minZoom:.2,maxZoom:1.5,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,onNodeMouseEnter:h,onNodeMouseLeave:g,onNodeClick:v,children:[p.jsx(p0,{color:"rgba(255,255,255,0.05)",gap:24}),p.jsx(m0,{showInteractive:!1})]},o??"full")})})}const Oc=220,P1=40,_G=110,SG=0,kG=180,ni=6;function M1(e){const n={width:Oc,padding:"10px 12px",borderRadius:10,border:"1px solid rgba(255, 255, 255, 0.14)",background:"rgba(48, 50, 72, 0.96)",color:"#f2f2f6",fontSize:12,fontFamily:"inherit",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.4)"};return e?{...n,borderColor:"rgba(139, 92, 246, 0.9)",background:"linear-gradient(135deg, rgba(139,92,246,0.45) 0%, rgba(58, 48, 90, 0.96) 100%)",boxShadow:"0 2px 14px rgba(139, 92, 246, 0.25)"}:{...n,cursor:"pointer"}}function R1(e,n,r){const o=r?ld:Ua;return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3},children:[p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[p.jsx(o,{style:{width:12,height:12,opacity:.7}}),p.jsx("span",{style:{fontWeight:600},children:e})]}),n&&p.jsx("span",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:10,opacity:.7,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]})}function CG({module:e,screens:n,onScreenClick:r}){const{nodes:o,edges:i}=x.useMemo(()=>{const a=[],l=[];Math.max(1,Math.ceil(n.length/ni)),Math.min(ni,n.length);const c=0;return a.push({id:`module:${e}`,position:{x:c-Oc/2,y:SG},data:{label:R1(Aa(e),`${n.length} screens`,!0)},style:M1(!0),sourcePosition:"bottom",targetPosition:"top",selectable:!1,draggable:!1}),n.forEach((u,f)=>{const d=Math.floor(f/ni),h=f%ni,g=Math.min(ni,n.length-d*ni),v=g*Oc+(g-1)*P1,_=c-v/2+h*(Oc+P1),m=kG+d*_G;a.push({id:`screen:${u.id}`,position:{x:_,y:m},data:{label:R1(Kr(u),u.route??void 0,!1),screenId:u.id},style:M1(!1),sourcePosition:"bottom",targetPosition:"top",draggable:!1}),l.push({id:`e:module-${u.id}`,source:`module:${e}`,target:`screen:${u.id}`,style:{stroke:"rgba(139,92,246,0.95)"}})}),{nodes:a,edges:l}},[e,n]),s=(a,l)=>{const c=l.data.screenId;c&&r(c)};return p.jsx("div",{className:"h-full w-full",children:p.jsx(Kd,{children:p.jsxs(h0,{nodes:o,edges:i,fitView:!0,fitViewOptions:{padding:.2},proOptions:{hideAttribution:!0},minZoom:.2,maxZoom:1.5,nodesConnectable:!1,onNodeClick:s,children:[p.jsx(p0,{color:"rgba(255,255,255,0.05)",gap:24}),p.jsx(m0,{showInteractive:!1})]})})})}function NG(e,n,r){var o;if(n==="ui"&&r.ui){const i=r.ui.nodes.find(s=>s.id===e);if(i)return{id:i.id,name:i.name,type:i.type,layer:n,route:i.route,module:((o=i.tags)==null?void 0:o.module)??i.module??null,exports:i.exports,tags:i.tags}}if(n==="api"&&r.api){const i=r.api.nodes.find(s=>s.id===e);if(i)return{id:i.id,name:i.name,type:i.type,layer:n,methods:i.methods,path:i.path,db_models:i.db_models,tags:i.tags}}if(n==="db"&&r.db){const i=r.db.nodes.find(s=>s.id===e);if(i)return{id:i.id,name:i.name,type:i.type,layer:n,columns:i.columns,tags:i.tags}}return null}function EG(e,n,r){const o=[];if(n==="ui"&&r.ui)for(const i of r.ui.edges){if(i.source===e){const s=r.ui.nodes.find(a=>a.id===i.target);s&&o.push({nodeId:i.target,nodeName:s.name,edgeType:i.type,direction:"outgoing"})}if(i.target===e){const s=r.ui.nodes.find(a=>a.id===i.source);s&&o.push({nodeId:i.source,nodeName:s.name,edgeType:i.type,direction:"incoming"})}}return o}function jG(e,n){const r=[],o=[];if(!n.ui)return{to:r,from:o};for(const i of n.ui.edges)if(i.type==="navigates"){if(i.source===e){const s=n.ui.nodes.find(a=>a.id===i.target);s&&r.push(s)}if(i.target===e){const s=n.ui.nodes.find(a=>a.id===i.source);s&&o.push(s)}}return{to:r,from:o}}const PG={ui:Ua,api:Zm,db:Qm},MG={page:"bg-violet-500/20 text-violet-300",layout:"bg-indigo-500/20 text-indigo-300",component:"bg-blue-500/20 text-blue-300",hook:"bg-sky-500/20 text-sky-300",context:"bg-teal-500/20 text-teal-300",util:"bg-slate-500/20 text-slate-300",config:"bg-amber-500/20 text-amber-300",endpoint:"bg-violet-500/20 text-violet-300",table:"bg-emerald-500/20 text-emerald-300",enum:"bg-orange-500/20 text-orange-300"};function RG({type:e}){const n=MG[e]??"bg-zinc-500/20 text-zinc-300";return p.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider ${n}`,children:e})}function ri({children:e}){return p.jsx("h3",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-slate-400",children:e})}function dc({label:e,edges:n,icon:r,onNavigate:o}){return n.length===0?null:p.jsxs("div",{className:"mb-3",children:[p.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-slate-500",children:[p.jsx(r,{className:"h-3 w-3"}),e,p.jsxs("span",{className:"text-slate-600",children:["(",n.length,")"]})]}),p.jsx("ul",{className:"space-y-0.5",children:n.map(i=>p.jsx("li",{children:p.jsxs("button",{type:"button",onClick:()=>o(i.nodeId),className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-slate-300 transition-colors hover:bg-slate-700/50 hover:text-slate-100",children:[p.jsx(Fi,{className:"h-3 w-3 shrink-0 text-slate-500"}),p.jsx("span",{className:"truncate",children:i.nodeName}),p.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-slate-600",children:i.edgeType})]})},`${i.direction}-${i.edgeType}-${i.nodeId}`))})]})}function AG({filePath:e}){const[n,r]=x.useState(null),[o,i]=x.useState(!0),[s,a]=x.useState(null),l=Go();if(x.useEffect(()=>{i(!0),a(null),r(null);const u=[e];e.startsWith("src/")||u.push(`src/${e}`);async function f(){for(const d of u)try{const h=await fetch(l("/api/file-content",{path:d}));if(!h.ok)continue;const g=await h.json();r(g.content),i(!1);return}catch{continue}a("File not found"),i(!1)}f()},[e]),o)return p.jsx("p",{className:"px-3 py-2 text-xs text-slate-500",children:"Loading source..."});if(s)return p.jsxs("p",{className:"px-3 py-2 text-xs text-red-400",children:["Failed to load: ",s]});if(!n)return null;const c=n.split(`
|
|
444
|
+
`);return p.jsx("div",{className:"overflow-auto rounded border border-slate-700/50 bg-slate-900/80",children:p.jsx("pre",{className:"p-3 text-[11px] leading-[1.6]",children:p.jsx("code",{children:c.map((u,f)=>p.jsxs("div",{className:"flex",children:[p.jsx("span",{className:"mr-4 inline-block w-8 select-none text-right text-slate-600",children:f+1}),p.jsx("span",{className:"flex-1 text-slate-300",children:u||" "})]},f))})})})}function qE({nodeId:e,nodeLayer:n,graphs:r,onClose:o,onNavigate:i}){const s=NG(e,n,r),a=EG(e,n,r),l=n==="ui"?jG(e,r):{to:[],from:[]},c=a.filter(v=>v.edgeType==="renders"&&v.direction==="outgoing"),u=a.filter(v=>v.edgeType==="renders"&&v.direction==="incoming"),f=a.filter(v=>v.edgeType==="imports"&&v.direction==="outgoing"),d=a.filter(v=>v.edgeType==="imports"&&v.direction==="incoming");if(!s)return p.jsx("div",{className:"flex h-full flex-col bg-slate-900/95",children:p.jsxs("div",{className:"flex items-center justify-between border-b border-slate-700/50 px-4 py-3",children:[p.jsx("span",{className:"text-sm text-slate-400",children:"Node not found"}),p.jsx("button",{type:"button",onClick:o,className:"rounded p-1 hover:bg-slate-700/50",children:p.jsx(uu,{className:"h-4 w-4 text-slate-400"})})]})});const h=PG[n],g=v=>i(v,"ui");return p.jsxs("div",{className:"flex h-full flex-col bg-slate-900/95 overflow-hidden",children:[p.jsxs("div",{className:"flex items-center gap-3 border-b border-slate-700/50 px-5 py-4",children:[p.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-slate-800",children:p.jsx(h,{className:"h-4 w-4 text-slate-400"})}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h2",{className:"truncate text-sm font-semibold text-slate-100",children:s.name}),p.jsx(RG,{type:s.type})]}),p.jsx("p",{className:"mt-0.5 truncate font-mono text-[10px] text-slate-500",children:s.id})]}),p.jsx("button",{type:"button",onClick:o,className:"rounded-md p-1.5 text-slate-400 transition-colors hover:bg-slate-700/50 hover:text-slate-200",children:p.jsx(uu,{className:"h-4 w-4"})})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-5",children:[p.jsxs("section",{children:[p.jsx(ri,{children:"Info"}),p.jsxs("div",{className:"space-y-1.5 text-xs",children:[s.module&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-16 shrink-0 text-slate-500",children:"Module"}),p.jsx("span",{className:`text-slate-300 ${s.module==="untagged"?"text-yellow-500/70 italic":""}`,children:s.module})]}),s.route&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-16 shrink-0 text-slate-500",children:"Route"}),p.jsx("span",{className:"font-mono text-slate-300",children:s.route})]}),s.methods&&s.methods.length>0&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-16 shrink-0 text-slate-500",children:"Methods"}),p.jsx("span",{className:"flex gap-1",children:s.methods.map(v=>p.jsx("span",{className:"rounded bg-violet-500/15 px-1.5 py-0.5 font-mono text-[10px] text-violet-300",children:v},v))})]}),s.path&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-16 shrink-0 text-slate-500",children:"Path"}),p.jsx("span",{className:"font-mono text-slate-300",children:s.path})]}),s.exports&&s.exports.length>0&&p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx("span",{className:"w-16 shrink-0 pt-0.5 text-slate-500",children:"Exports"}),p.jsx("div",{className:"flex flex-wrap gap-1",children:s.exports.map(v=>p.jsx("span",{className:"rounded bg-slate-700/50 px-1.5 py-0.5 font-mono text-[10px] text-slate-300",children:v},v))})]}),s.db_models&&s.db_models.length>0&&p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx("span",{className:"w-16 shrink-0 pt-0.5 text-slate-500",children:"Models"}),p.jsx("div",{className:"flex flex-wrap gap-1",children:s.db_models.map(v=>p.jsx("span",{className:"rounded bg-emerald-500/15 px-1.5 py-0.5 font-mono text-[10px] text-emerald-300",children:v},v))})]})]})]}),s.tags&&Object.keys(s.tags).length>0&&p.jsxs("section",{children:[p.jsx(ri,{children:"Tags"}),p.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(s.tags).map(([v,b])=>p.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] ${v==="module"||v==="screen"?"bg-purple-500/15 text-purple-300":"bg-sky-500/15 text-sky-300"}`,children:[p.jsxs("span",{className:"font-medium",children:[v,":"]}),p.jsx("span",{children:b})]},v))})]}),s.columns&&s.columns.length>0&&p.jsxs("section",{children:[p.jsx(ri,{children:"Columns"}),p.jsx("div",{className:"overflow-hidden rounded border border-slate-700/50",children:p.jsxs("table",{className:"w-full text-xs",children:[p.jsx("thead",{children:p.jsxs("tr",{className:"border-b border-slate-700/50 bg-slate-800/50",children:[p.jsx("th",{className:"px-3 py-1.5 text-left font-medium text-slate-400",children:"Name"}),p.jsx("th",{className:"px-3 py-1.5 text-left font-medium text-slate-400",children:"Type"})]})}),p.jsx("tbody",{children:s.columns.map(v=>p.jsxs("tr",{className:"border-b border-slate-800/50 last:border-0",children:[p.jsx("td",{className:"px-3 py-1.5 font-mono text-slate-300",children:v.name}),p.jsx("td",{className:"px-3 py-1.5 font-mono text-slate-500",children:v.type})]},v.name))})]})})]}),(c.length>0||u.length>0||f.length>0||d.length>0)&&p.jsxs("section",{children:[p.jsx(ri,{children:"Component Tree"}),p.jsx(dc,{label:"Renders",edges:c,icon:RR,onNavigate:g}),p.jsx(dc,{label:"Rendered by",edges:u,icon:Km,onNavigate:g}),p.jsx(dc,{label:"Imports",edges:f,icon:ny,onNavigate:g}),p.jsx(dc,{label:"Imported by",edges:d,icon:ny,onNavigate:g})]}),(l.to.length>0||l.from.length>0)&&p.jsxs("section",{children:[p.jsx(ri,{children:"Navigation"}),l.to.length>0&&p.jsxs("div",{className:"mb-3",children:[p.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-slate-500",children:[p.jsx(ty,{className:"h-3 w-3"}),"Navigates to",p.jsxs("span",{className:"text-slate-600",children:["(",l.to.length,")"]})]}),p.jsx("ul",{className:"space-y-0.5",children:l.to.map(v=>p.jsx("li",{children:p.jsxs("button",{type:"button",onClick:()=>g(v.id),className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-slate-300 transition-colors hover:bg-slate-700/50 hover:text-slate-100",children:[p.jsx(Fi,{className:"h-3 w-3 shrink-0 text-slate-500"}),p.jsx("span",{className:"truncate",children:v.name}),v.route&&p.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-slate-600",children:v.route})]})},v.id))})]}),l.from.length>0&&p.jsxs("div",{className:"mb-3",children:[p.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wider text-slate-500",children:[p.jsx(ty,{className:"h-3 w-3"}),"Navigated from",p.jsxs("span",{className:"text-slate-600",children:["(",l.from.length,")"]})]}),p.jsx("ul",{className:"space-y-0.5",children:l.from.map(v=>p.jsx("li",{children:p.jsxs("button",{type:"button",onClick:()=>g(v.id),className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-slate-300 transition-colors hover:bg-slate-700/50 hover:text-slate-100",children:[p.jsx(Fi,{className:"h-3 w-3 shrink-0 text-slate-500"}),p.jsx("span",{className:"truncate",children:v.name}),v.route&&p.jsx("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-slate-600",children:v.route})]})},v.id))})]})]}),p.jsxs("section",{children:[p.jsx(ri,{children:"Source Code"}),p.jsx(AG,{filePath:s.id})]})]})]})}function TG(){var w;const[e,n]=x.useState(null),[r,o]=x.useState(null),[i,s]=x.useState(null),[a,l]=x.useState(null),[c,u]=x.useState(null),[f,d]=x.useState("ui"),h=Go();x.useEffect(()=>{fetch(h("/api/raw-graphs")).then(y=>{if(!y.ok)throw new Error(`HTTP ${y.status}`);return y.json()}).then(y=>n(y)).catch(y=>o(String(y)))},[h]);const g=x.useMemo(()=>e!=null&&e.ui?e.ui.nodes.filter(y=>t0(y)&&er(y)):[],[e]),v=x.useMemo(()=>{const y=new Map;for(const N of g){const E=er(N);y.has(E)||y.set(E,[]),y.get(E).push(N)}const S=[],k=new Map;for(const[N,E]of y)E.length===1?S.push(...E):k.set(N,E);const C=[...k.entries()].map(([N,E])=>({module:N,screens:E})).sort((N,E)=>E.screens.length-N.screens.length);return S.length>0&&C.push({module:"misc",screens:S}),C.sort((N,E)=>N.module==="untagged"?1:E.module==="untagged"?-1:N.module==="misc"?1:E.module==="misc"?-1:E.screens.length-N.screens.length),C},[g]),b=i??((w=v[0])==null?void 0:w.module)??null,_=x.useMemo(()=>{var y;return b?((y=v.find(S=>S.module===b))==null?void 0:y.screens)??[]:[]},[v,b]),m=x.useMemo(()=>!(e!=null&&e.ui)||!a?null:e.ui.nodes.find(y=>y.id===a)??null,[e,a]);return r?p.jsx(OG,{message:r}):e?p.jsxs("div",{className:"flex h-full min-h-0",children:[p.jsxs("div",{className:`flex w-64 flex-col border-r border-sidebar-border bg-sidebar-background/40 ${c?"hidden":""}`,children:[p.jsxs("div",{className:"border-b border-sidebar-border px-4 py-3",children:[p.jsx("h2",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Modules"}),p.jsxs("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[v.length," modules · ",g.length," screens"]})]}),p.jsx("ul",{className:"flex-1 overflow-y-auto px-2 py-2",children:v.map(y=>{const S=y.module===b;return p.jsx("li",{children:p.jsxs("button",{type:"button",onClick:()=>{s(y.module),l(null),u(null)},className:`flex w-full items-center justify-between rounded-md px-3 py-2 text-sm transition-colors ${S?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"} ${y.module==="untagged"?"border border-dashed border-yellow-500/30":""}`,children:[p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx(Ua,{className:`h-3.5 w-3.5 shrink-0 ${y.module==="untagged"?"text-yellow-500/70":"opacity-70"}`}),Aa(y.module)]}),p.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:y.screens.length})]})},y.module)})})]}),p.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:m?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-3 border-b border-sidebar-border px-6 py-4",children:[p.jsxs("button",{type:"button",onClick:()=>{l(null),u(null)},className:"flex items-center gap-1.5 rounded-md border border-sidebar-border px-2.5 py-1 text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-foreground",children:[p.jsx(Km,{className:"h-3 w-3"}),"Back"]}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h1",{className:"truncate text-lg font-semibold text-foreground",children:Kr(m)}),m.route&&p.jsx("p",{className:"mt-0.5 truncate font-mono text-[11px] text-muted-foreground",children:m.route})]})]}),p.jsx("div",{className:"flex-1 min-h-0",children:p.jsx(bG,{screen:m,graphs:e,selectedNodeId:c,onNodeSelect:(y,S)=>{u(y),d(S)}})})]}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"border-b border-sidebar-border px-6 py-4",children:[p.jsx("h1",{className:"text-lg font-semibold text-foreground",children:b?Aa(b):"Select a module"}),p.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:[_.length," screens · click a screen to drill in"]})]}),p.jsx("div",{className:"flex-1 min-h-0",children:b&&_.length>0?p.jsx(CG,{module:b,screens:_,onScreenClick:l},b):p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx("p",{className:"text-sm text-muted-foreground",children:b?"No screens in this module.":"Select a module."})})})]})}),c&&e&&p.jsx("div",{className:"flex w-[420px] shrink-0 flex-col border-l border-sidebar-border bg-slate-900/95",children:p.jsx(qE,{nodeId:c,nodeLayer:f,graphs:e,onClose:()=>u(null),onNavigate:(y,S)=>{u(y),d(S)}})})]}):p.jsx(IG,{})}function IG(){return p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading graph data…"})})}function OG({message:e}){return p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsxs("div",{className:"max-w-md text-center",children:[p.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Failed to load graph"}),p.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:e})]})})}function $G(){return p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsxs("div",{className:"text-center",children:[p.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"User Journeys"}),p.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"User journey flowcharts coming soon."})]})})}const DG={admin:"#8b5cf6",auth:"#f59e0b",settings:"#6366f1",project:"#3b82f6",org:"#10b981",root:"#64748b",misc:"#94a3b8"};function Fu(e){return e?DG[e]??`hsl(${Math.abs(LG(e))%360}, 60%, 55%)`:"#64748b"}function LG(e){let n=0;for(let r=0;r<e.length;r++)n=Math.imul(31,n)+e.charCodeAt(r)|0;return n}function zG(e){const n=e.ui.nodes.filter(l=>t0(l)),r=new Set(n.map(l=>l.id)),o=new Map;for(const l of e.ui.edges)(l.type==="imports"||l.type==="renders")&&(o.has(l.target)||o.set(l.target,new Set),o.get(l.target).add(l.source));function i(l){const c=new Set,u=new Set,f=[l];for(;f.length>0;){const d=f.pop();if(!u.has(d)){if(u.add(d),r.has(d)){c.add(d);continue}for(const h of o.get(d)??[])f.push(h)}}return c}const s=new Map,a=new Map;for(const l of e.ui.edges){if(l.type!=="navigates"||!r.has(l.target))continue;const c=r.has(l.source)?[l.source]:[...i(l.source)];for(const u of c)u!==l.target&&(s.has(u)||s.set(u,new Set),s.get(u).add(l.target),a.has(l.target)||a.set(l.target,new Set),a.get(l.target).add(u))}return{screens:n,screenIdSet:r,outgoing:s,incoming:a}}function FG(e){const n={segment:"/",fullRoute:"/",screen:null,children:[]},r=[...e].sort((o,i)=>(o.route??"").split("/").length-(i.route??"").split("/").length);for(const o of r){if(!o.route)continue;if(o.route==="/"){n.screen=o;continue}const i=o.route.split("/").filter(Boolean);let s=n;for(let a=0;a<i.length;a++){const l=i[a],c="/"+i.slice(0,a+1).join("/");let u=s.children.find(f=>f.segment===l);u||(u={segment:l,fullRoute:c,screen:null,children:[]},s.children.push(u)),s=u}s.screen=o}return n}function g0({node:e,depth:n,onSelect:r,selectedId:o}){var f;const[i,s]=x.useState(n<2),a=e.children.length>0,l=e.screen?er(e.screen):null,c=Fu(l),u=((f=e.screen)==null?void 0:f.id)===o;return p.jsxs("div",{children:[p.jsxs("div",{className:`flex items-center gap-1 py-0.5 px-1.5 rounded transition-colors cursor-pointer text-xs ${u?"bg-purple-500/20 text-foreground":"text-muted-foreground hover:bg-white/5 hover:text-foreground"}`,style:{paddingLeft:n*14+4},onClick:()=>{e.screen&&r(e.screen.id),a&&s(!i)},children:[a?p.jsx("button",{onClick:d=>{d.stopPropagation(),s(!i)},className:"p-0.5 shrink-0",children:i?p.jsx(cd,{className:"h-2.5 w-2.5"}):p.jsx(Fi,{className:"h-2.5 w-2.5"})}):p.jsx("span",{className:"w-3.5"}),e.screen&&p.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:c}}),p.jsx("span",{className:"truncate",children:e.screen?Kr(e.screen):e.segment})]}),i&&a&&e.children.sort((d,h)=>d.segment.localeCompare(h.segment)).map(d=>p.jsx(g0,{node:d,depth:n+1,onSelect:r,selectedId:o},d.fullRoute))]})}const oh=200,en=200,fc=56,A1=120,oi=30;function BG({focusId:e,screens:n,outgoing:r,incoming:o,onNavigate:i,onDetail:s}){var y,S;const a=x.useRef(null),l=x.useMemo(()=>new Map(n.map(k=>[k.id,k])),[n]),c=l.get(e),{flowNodes:u,flowEdges:f}=x.useMemo(()=>{var P;if(!c)return{flowNodes:[],flowEdges:[]};const k=[...r.get(e)??[]].filter(L=>l.has(L)),C=[...o.get(e)??[]].filter(L=>l.has(L)),N=[],E=[],j=(L,I,z,R)=>{const M=l.get(L),O=er(M),V=Fu(O);return{id:L,position:{x:I,y:z},data:{label:p.jsxs("div",{style:{pointerEvents:"none"},children:[p.jsx("div",{style:{fontWeight:R?700:500,fontSize:R?13:11,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:Kr(M)}),p.jsx("div",{style:{fontSize:9,opacity:.5,marginTop:2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:M.route}),O&&O!=="root"&&p.jsx("div",{style:{fontSize:8,marginTop:2,color:V,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:500},children:Aa(O)})]})},style:{width:R?en+40:en,height:R?fc+10:fc,background:R?`linear-gradient(135deg, ${V}30, ${V}15)`:`linear-gradient(135deg, ${V}15, ${V}08)`,border:`${R?2:1}px solid ${V}${R?"80":"40"}`,borderRadius:10,padding:"8px 12px",color:"#e2e8f0",cursor:R?"default":"pointer",boxShadow:R?`0 0 20px ${V}20`:"none"},sourcePosition:"bottom",targetPosition:"top"}},T=-(C.length*(en+oi)-oi)/2+en/2;for(let L=0;L<C.length;L++){const I=C[L];N.push(j(I,T+L*(en+oi)-en/2,oh-A1-fc,!1));const z=((P=r.get(e))==null?void 0:P.has(I))??!1;E.push({id:`in-${I}`,source:I,target:e,type:"smoothstep",animated:!0,style:{stroke:z?"rgba(251,191,36,0.5)":"rgba(139,92,246,0.5)",strokeWidth:1.5,strokeDasharray:z?"4 4":void 0},markerEnd:{type:"arrowclosed",color:z?"rgba(251,191,36,0.7)":"rgba(139,92,246,0.7)"},label:z?"↺":void 0,labelStyle:{fontSize:12,fill:"#fbbf24"}})}N.push(j(e,-en/2-20,oh,!0));const F=-(k.length*(en+oi)-oi)/2+en/2;for(let L=0;L<k.length;L++){const I=k[L];C.includes(I)||(N.push(j(I,F+L*(en+oi)-en/2,oh+A1+fc+10,!1)),E.push({id:`out-${I}`,source:e,target:I,type:"smoothstep",animated:!0,style:{stroke:"rgba(139,92,246,0.5)",strokeWidth:1.5},markerEnd:{type:"arrowclosed",color:"rgba(139,92,246,0.7)"}}))}return{flowNodes:N,flowEdges:E}},[e,c,l,r,o]),d=x.useCallback(k=>{const C=a.current;if(!C)return;const N=new Set([k]),E=new Set;for(const j of f)j.source===k&&(N.add(j.target),E.add(j.id)),j.target===k&&(N.add(j.source),E.add(j.id));C.querySelectorAll(".react-flow__node").forEach(j=>{j.style.opacity=N.has(j.getAttribute("data-id")??"")?"1":"0.25",j.style.transition="opacity 120ms ease"}),C.querySelectorAll(".react-flow__edge").forEach(j=>{const A=j.getAttribute("data-id")??"";j.style.opacity=E.has(A)?"1":"0.1",j.style.transition="opacity 120ms ease"})},[f]),h=x.useCallback(()=>{const k=a.current;k&&(k.querySelectorAll(".react-flow__node").forEach(C=>{C.style.opacity="",C.style.transition=""}),k.querySelectorAll(".react-flow__edge").forEach(C=>{C.style.opacity="",C.style.transition=""}))},[]),g=x.useCallback((k,C)=>{C.id!==e&&d(C.id)},[d,e]),v=x.useCallback(()=>h(),[h]),b=x.useCallback((k,C)=>{C.id!==e&&i(C.id)},[e,i]),_=x.useCallback((k,C)=>s(C.id),[s]);if(!c)return null;const m=((y=o.get(e))==null?void 0:y.size)??0,w=((S=r.get(e))==null?void 0:S.size)??0;return p.jsxs("div",{className:"flex flex-1 flex-col min-h-0",children:[p.jsxs("div",{className:"px-5 py-3 border-b border-sidebar-border/50",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:Fu(er(c))}}),p.jsx("h2",{className:"text-sm font-semibold text-foreground",children:Kr(c)}),p.jsx("span",{className:"font-mono text-[10px] text-muted-foreground/50",children:c.route})]}),p.jsxs("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:[m," incoming · ",w," outgoing",m===0&&w===0&&" · no navigation links detected",p.jsx("span",{className:"ml-2 opacity-50",children:"click to navigate · double-click for details"})]})]}),p.jsx("div",{ref:a,className:"flex-1 min-h-0",children:p.jsx(Kd,{children:p.jsxs(h0,{nodes:u,edges:f,fitView:!0,fitViewOptions:{padding:.4},proOptions:{hideAttribution:!0},minZoom:.3,maxZoom:1.5,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,onNodeMouseEnter:g,onNodeMouseLeave:v,onNodeClick:b,onNodeDoubleClick:_,children:[p.jsx(p0,{color:"rgba(255,255,255,0.03)",gap:24}),p.jsx(m0,{showInteractive:!1})]},e)})})]})}function HG({tree:e,noRouteScreens:n,onSelect:r,selectedId:o}){return p.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3",children:[p.jsx(g0,{node:e,depth:0,onSelect:r,selectedId:o}),n.length>0&&p.jsxs("div",{className:"mt-4 pt-3 border-t border-sidebar-border",children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1.5 px-1.5",children:[p.jsx(Jm,{className:"h-3 w-3 text-yellow-500/70"}),p.jsxs("span",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wider",children:["Layouts (",n.length,")"]})]}),n.map(i=>p.jsxs("button",{onClick:()=>r(i.id),className:`flex items-center gap-1.5 w-full px-3 py-0.5 rounded text-xs transition-colors ${o===i.id?"bg-purple-500/15 text-foreground":"text-muted-foreground hover:bg-white/5"}`,children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:Fu(er(i))}}),i.name]},i.id))]})]})}function UG(){const[e,n]=x.useState(null),[r,o]=x.useState(null),[i,s]=x.useState(null),[a,l]=x.useState(null),[c,u]=x.useState("visual"),[f,d]=x.useState([]),h=Go();x.useEffect(()=>{fetch(h("/api/raw-graphs")).then(k=>{if(!k.ok)throw new Error(`HTTP ${k.status}`);return k.json()}).then(k=>n(k)).catch(k=>o(String(k)))},[h]);const{screens:g,outgoing:v,incoming:b,tree:_,noRouteScreens:m,navCount:w}=x.useMemo(()=>{if(!(e!=null&&e.ui))return{screens:[],outgoing:new Map,incoming:new Map,tree:null,noRouteScreens:[],navCount:0};const k=zG(e),C=k.screens.filter(j=>j.route),N=k.screens.filter(j=>!j.route);let E=0;for(const j of k.outgoing.values())E+=j.size;return{screens:k.screens,outgoing:k.outgoing,incoming:k.incoming,tree:FG(C),noRouteScreens:N,navCount:E}},[e]);x.useEffect(()=>{if(!i&&g.length>0){const k=g.find(C=>C.route==="/");s((k==null?void 0:k.id)??g[0].id)}},[g,i]);const y=x.useCallback(k=>{d(C=>i?[...C,i]:C),s(k)},[i]),S=x.useCallback(()=>{d(k=>{const C=[...k],N=C.pop();return N&&s(N),C})},[]);return r?p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx("p",{className:"text-sm text-red-400",children:r})}):!e||!_?p.jsx("div",{className:"flex h-full items-center justify-center",children:p.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})}):p.jsxs("div",{className:"flex h-full min-h-0",children:[p.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[p.jsxs("div",{className:"border-b border-sidebar-border px-6 py-3 flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[c==="visual"&&f.length>0&&p.jsx("button",{onClick:S,className:"p-1 rounded-md hover:bg-white/10 text-muted-foreground hover:text-foreground transition-colors",children:p.jsx(Km,{className:"h-4 w-4"})}),p.jsx(cA,{className:"h-5 w-5 text-muted-foreground"}),p.jsxs("div",{children:[p.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Sitemap"}),p.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:[g.filter(k=>k.route).length," screens · ",w," links"]})]})]}),p.jsxs("div",{className:"flex items-center gap-1 bg-muted/30 rounded-lg p-0.5",children:[p.jsxs("button",{onClick:()=>u("visual"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${c==="visual"?"bg-purple-600 text-white":"text-muted-foreground hover:text-foreground"}`,children:[p.jsx(JR,{className:"h-3.5 w-3.5"}),"Visual"]}),p.jsxs("button",{onClick:()=>u("list"),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors ${c==="list"?"bg-purple-600 text-white":"text-muted-foreground hover:text-foreground"}`,children:[p.jsx(aA,{className:"h-3.5 w-3.5"}),"List"]})]})]}),c==="list"?p.jsx(HG,{tree:_,noRouteScreens:m,onSelect:k=>{s(k),u("visual")},selectedId:i}):i?p.jsx(BG,{focusId:i,screens:g,outgoing:v,incoming:b,onNavigate:y,onDetail:l}):null]}),c==="visual"&&p.jsxs("div",{className:"w-56 shrink-0 border-l border-sidebar-border overflow-y-auto bg-sidebar-background/30",children:[p.jsx("div",{className:"px-3 py-2 border-b border-sidebar-border/50",children:p.jsx("h3",{className:"text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"All Screens"})}),p.jsx("div",{className:"py-1",children:p.jsx(g0,{node:_,depth:0,onSelect:y,selectedId:i})})]}),a&&e&&p.jsx("div",{className:"flex w-[400px] shrink-0 flex-col border-l border-sidebar-border bg-slate-900/95",children:p.jsx(qE,{nodeId:a,nodeLayer:"ui",graphs:e,onClose:()=>l(null),onNavigate:k=>{l(null),y(k)}})})]})}function T1({onSelect:e,onClose:n,buildUrl:r}){const[o,i]=x.useState(null),[s,a]=x.useState(!0),l=x.useCallback(async c=>{a(!0);try{const u=await fetch(r("/api/browse-dir",c?{path:c}:void 0));if(!u.ok)throw new Error(`HTTP ${u.status}`);i(await u.json())}catch{}finally{a(!1)}},[]);return x.useEffect(()=>{l()},[l]),o?p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:n,children:p.jsxs("div",{className:"bg-card border border-border rounded-xl w-[480px] max-h-[70vh] flex flex-col",onClick:c=>c.stopPropagation(),children:[p.jsxs("div",{className:"p-4 border-b border-border/50",children:[p.jsx("h3",{className:"text-sm font-semibold mb-1",children:"Select App Directory"}),p.jsx("code",{className:"text-xs text-muted-foreground break-all",children:o.current})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto p-2 min-h-[200px]",children:[s&&p.jsx("div",{className:"text-xs text-muted-foreground p-2",children:"Loading..."}),o.parent&&p.jsxs("button",{onClick:()=>l(o.parent),className:"flex items-center gap-2 w-full px-3 py-2 rounded-lg text-sm text-muted-foreground hover:bg-muted/50 transition-colors",children:[p.jsx(ey,{className:"h-4 w-4 shrink-0"}),".."]}),o.dirs.map(c=>p.jsxs("button",{onClick:()=>l(`${o.current}/${c}`),className:"flex items-center gap-2 w-full px-3 py-2 rounded-lg text-sm hover:bg-muted/50 transition-colors text-left",children:[p.jsx(ey,{className:"h-4 w-4 shrink-0 text-purple-400"}),c,p.jsx(Fi,{className:"h-3 w-3 ml-auto text-muted-foreground"})]},c)),o.dirs.length===0&&!o.parent&&p.jsx("div",{className:"text-xs text-muted-foreground p-3",children:"No subdirectories"})]}),p.jsxs("div",{className:"p-3 border-t border-border/50 flex items-center justify-between",children:[p.jsx("span",{className:"text-xs text-muted-foreground",children:o.relative==="."?"(project root)":o.relative}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("button",{onClick:n,className:"px-3 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors",children:"Cancel"}),p.jsx("button",{onClick:()=>e(o.relative==="."?".":o.relative),className:"px-3 py-1.5 text-sm rounded-lg bg-purple-600 hover:bg-purple-500 text-white font-medium transition-colors",children:"Select This Folder"})]})]})]})}):p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:n,children:p.jsx("div",{className:"bg-card border border-border rounded-xl p-6 w-[480px] text-sm text-muted-foreground",children:"Loading..."})})}function VG(){var ul,dl,fl,hl,pl,ml,gl,vl,yl,xl;const[e,n]=x.useState(null),[r,o]=x.useState(!0),[i,s]=x.useState(!1),[a,l]=x.useState(!1),[c,u]=x.useState(null),[f,d]=x.useState(new Set),[h,g]=x.useState([]),[v,b]=x.useState(""),[_,m]=x.useState("crosslayer"),[w,y]=x.useState("api-binding"),[S,k]=x.useState(""),[C,N]=x.useState(null),[E,j]=x.useState(""),[A,T]=x.useState(""),[D,F]=x.useState([]),[P,L]=x.useState(""),[I,z]=x.useState(null),[R,M]=x.useState(!1),O=Go(),{projects:V,reloadProjects:$,isMultiProject:K}=Ig(),[B,U]=x.useState([]),[G,W]=x.useState(""),[X,q]=x.useState(""),[te,ee]=x.useState(new Set),[Q,ne]=x.useState({module:!0,screen:!0}),[ue,ye]=x.useState([]),[pe,ke]=x.useState([]),[tt,Xe]=x.useState(""),[Zt,fr]=x.useState(""),[Dn,hr]=x.useState(""),pr=x.useCallback(async()=>{try{const Y=await fetch(O("/api/detected-paths"));Y.ok&&N(await Y.json())}catch{}},[O]),io=x.useCallback(async()=>{try{const Y=await fetch("/api/projects");if(!Y.ok)return;const he=(await Y.json()).projects??[];(he.length>1||he.some(Fe=>Fe.root!=="."))&&U(he.map(Fe=>({name:Fe.name,root:Fe.root})))}catch{}},[]),Ln=x.useCallback(async()=>{var Y,de,he,Fe,ct,ao,xn,lo,Xo,wl,bl;try{const co=await fetch(O("/api/parser-config"));if(!co.ok)throw new Error(`HTTP ${co.status}`);const vt=await co.json();n(vt),d(new Set(((Y=vt.config.parsers)==null?void 0:Y.disabled)??[])),g(((de=vt.config.parsers)==null?void 0:de.custom)??[]),k(vt.config.port?String(vt.config.port):""),j(((he=vt.config.paths)==null?void 0:he.appDir)??""),T(((Fe=vt.config.paths)==null?void 0:Fe.dbDir)??""),F(((ct=vt.config.paths)==null?void 0:ct.srcRoots)??[]),ee(new Set(((ao=vt.config.taggers)==null?void 0:ao.disabled)??[])),ne(((xn=vt.config.taggers)==null?void 0:xn.trackUntagged)??{module:!0,screen:!0}),ye(((Xo=(lo=vt.config.taggers)==null?void 0:lo.module)==null?void 0:Xo.rules)??[]),ke(((bl=(wl=vt.config.taggers)==null?void 0:wl.module)==null?void 0:bl.trivialGroups)??[]),o(!1)}catch(co){u(String(co)),o(!1)}},[]);x.useEffect(()=>{Ln(),pr(),io()},[Ln,pr,io]);const so=x.useCallback(async()=>{s(!0),l(!1),u(null);try{const Y={};te.size>0&&(Y.disabled=[...te]),Object.keys(Q).length>0&&(Y.trackUntagged=Q);const de={};ue.length>0&&(de.rules=ue),pe.length>0&&(de.trivialGroups=pe),Object.keys(de).length>0&&(Y.module=de);const he=S.trim()?parseInt(S.trim(),10):void 0,Fe={};E.trim()&&(Fe.appDir=E.trim()),A.trim()&&(Fe.dbDir=A.trim());const ct=D.map(Xo=>Xo.trim()).filter(Boolean);ct.length>0&&(Fe.srcRoots=ct);const ao=Object.keys(Fe).length>0?Fe:void 0,xn={...he&&!isNaN(he)&&{port:he},...ao&&{paths:ao},parsers:{disabled:[...f],custom:h.length>0?h:void 0},...Object.keys(Y).length>0&&{taggers:Y}};xn.parsers.disabled.length===0&&delete xn.parsers.disabled,xn.parsers.custom||delete xn.parsers.custom;const lo=await fetch(O("/api/parser-config"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(xn)});if(!lo.ok)throw new Error(`HTTP ${lo.status}`);l(!0),pr(),setTimeout(()=>l(!1),3e3)}catch(Y){u(String(Y))}finally{s(!1)}},[f,h,te,Q,ue,pe,S,E,A,D,pr,O]),us=Y=>{d(de=>{const he=new Set(de);return he.has(Y)?he.delete(Y):he.add(Y),he})},cl=()=>{if(!v.trim())return;const Y={path:v.trim(),layer:_};_==="crosslayer"&&(Y.concern=w),g(de=>[...de,Y]),b("")},ds=Y=>{g(de=>de.filter((he,Fe)=>Fe!==Y))};if(r)return p.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"Loading configuration..."});const Yo=Y=>Y.split("-").map(de=>de[0].toUpperCase()+de.slice(1)).join(" "),fs=Object.entries((e==null?void 0:e.crosslayerParsers)??{}),qd=[...((e==null?void 0:e.detection)??[]).map(Y=>({...Y,layer:Y.layers.join(", "),label:Y.label||Yo(Y.id),concern:null})),...fs.flatMap(([Y,de])=>de.map(he=>({id:he.id,layer:Y,label:he.label||Yo(he.id),detected:!0,layers:[Y],concern:Y})))];return p.jsxs("div",{className:"h-full overflow-y-auto p-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-6",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(z_,{className:"h-6 w-6 text-muted-foreground"}),p.jsx("h1",{className:"text-xl font-semibold",children:"Parser Configuration"})]}),p.jsxs("button",{onClick:so,disabled:i,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-purple-600 hover:bg-purple-500 text-white text-sm font-medium transition-colors disabled:opacity-50",children:[a?p.jsx(jr,{className:"h-4 w-4"}):p.jsx(ry,{className:"h-4 w-4"}),i?"Saving...":a?"Saved":"Save"]})]}),c&&p.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-red-500/10 text-red-400 text-sm mb-6",children:[p.jsx(wo,{className:"h-4 w-4 shrink-0"}),c]}),p.jsxs("section",{className:"mb-6 space-y-3",children:[p.jsx("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Layer Directories"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Override auto-detected source directories per layer. Leave empty for auto-detection. Paths are relative to project root."}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"p-4 rounded-lg border border-border/50 bg-card space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("label",{className:"text-sm text-muted-foreground w-24 shrink-0",children:"UI"}),p.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[p.jsx("input",{type:"text",value:E,onChange:Y=>j(Y.target.value),placeholder:((ul=C==null?void 0:C.detected)==null?void 0:ul.appDir)??"src/app",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsxs("button",{onClick:()=>z("app"),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors",title:"Browse folders",children:[p.jsx(Hl,{className:"h-4 w-4"}),"Browse"]}),E&&p.jsx("button",{onClick:()=>j(""),className:"flex items-center gap-1.5 px-2 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors text-muted-foreground",title:"Reset to auto-detect",children:p.jsx(jf,{className:"h-3.5 w-3.5"})})]})]}),p.jsx("div",{className:"flex items-center gap-2 pl-[108px]",children:(dl=C==null?void 0:C.overrides)!=null&&dl.appDir?p.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-purple-500/10 text-purple-400",children:"Manual override"}):(fl=C==null?void 0:C.detected)!=null&&fl.appDir?p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-green-500/10 text-green-400",children:[p.jsx(jr,{className:"h-3 w-3"}),"Auto-detected: ",C.detected.appDir]}):p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-yellow-500/10 text-yellow-400",children:[p.jsx(wo,{className:"h-3 w-3"}),"Not detected"]})}),p.jsx("p",{className:"text-xs text-muted-foreground pl-[108px]",children:"Pages and layout directory. Auto-detects src/app or app/."})]}),p.jsx("div",{className:"p-4 rounded-lg border border-border/50 bg-card",children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("label",{className:"text-sm text-muted-foreground w-24 shrink-0",children:"API"}),p.jsxs("div",{className:"flex-1",children:[p.jsx("span",{className:"text-sm text-muted-foreground",children:((hl=C==null?void 0:C.detected)==null?void 0:hl.apiDir)??"src/app/api"}),p.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground ml-3",children:"Derived from UI dir"})]})]})}),p.jsxs("div",{className:"p-4 rounded-lg border border-border/50 bg-card space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("label",{className:"text-sm text-muted-foreground w-24 shrink-0",children:"DB"}),p.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[p.jsx("input",{type:"text",value:A,onChange:Y=>T(Y.target.value),placeholder:((pl=C==null?void 0:C.detected)==null?void 0:pl.dbDir)??"prisma",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsxs("button",{onClick:()=>z("db"),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors",title:"Browse folders",children:[p.jsx(Hl,{className:"h-4 w-4"}),"Browse"]}),A&&p.jsx("button",{onClick:()=>T(""),className:"flex items-center gap-1.5 px-2 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors text-muted-foreground",title:"Reset to auto-detect",children:p.jsx(jf,{className:"h-3.5 w-3.5"})})]})]}),p.jsxs("div",{className:"flex items-center gap-2 pl-[108px]",children:[(ml=C==null?void 0:C.overrides)!=null&&ml.dbDir?p.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-purple-500/10 text-purple-400",children:"Manual override"}):(gl=C==null?void 0:C.detected)!=null&&gl.dbDir?p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-green-500/10 text-green-400",children:[p.jsx(jr,{className:"h-3 w-3"}),"Auto-detected: ",C.detected.dbDir]}):p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-yellow-500/10 text-yellow-400",children:[p.jsx(wo,{className:"h-3 w-3"}),"Not detected"]}),((vl=C==null?void 0:C.detected)==null?void 0:vl.dbKind)&&C.detected.dbKind!=="none"&&p.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground",children:C.detected.dbKind==="prisma"?"Prisma schema":"SQL migrations"})]}),p.jsx("p",{className:"text-xs text-muted-foreground pl-[108px]",children:"Schema and migration directory. Auto-detects prisma/, supabase/, drizzle/, db/migrations/, migrations/."})]}),p.jsxs("div",{className:"p-4 rounded-lg border border-border/50 bg-card space-y-3",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsx("label",{className:"text-sm text-muted-foreground w-24 shrink-0 pt-1",children:"Source Roots"}),p.jsxs("div",{className:"flex-1 space-y-2",children:[D.length>0?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"flex flex-wrap gap-1.5",children:D.map((Y,de)=>p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs bg-purple-500/10 text-purple-400",children:[Y,p.jsx("button",{onClick:()=>F(he=>he.filter((Fe,ct)=>ct!==de)),className:"text-red-400 hover:text-red-300 ml-0.5",title:"Remove",children:p.jsx(Ss,{className:"h-3 w-3"})})]},de))}),p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-purple-500/10 text-purple-400",children:["Manual override (",D.length,")"]})]}):(yl=C==null?void 0:C.detected)!=null&&yl.srcRoots&&C.detected.srcRoots.length>0?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"flex flex-wrap gap-1.5",children:C.detected.srcRoots.map(Y=>p.jsx("span",{className:"inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs bg-green-500/10 text-green-400",children:Y},Y))}),p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-green-500/10 text-green-400",children:[p.jsx(jr,{className:"h-3 w-3"}),"Auto-detected (",C.detected.srcRoots.length,")"]})]}):p.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-yellow-500/10 text-yellow-400",children:[p.jsx(wo,{className:"h-3 w-3"}),"Not detected"]}),p.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[p.jsx("input",{type:"text",value:P,onChange:Y=>L(Y.target.value),placeholder:"e.g. components, hooks, packages/shared",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground",onKeyDown:Y=>{Y.key==="Enter"&&P.trim()&&(F(de=>[...de,P.trim()]),L(""))}}),p.jsxs("button",{onClick:()=>z("srcRoot"),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors",title:"Browse folders",children:[p.jsx(Hl,{className:"h-4 w-4"}),"Browse"]}),p.jsx("button",{onClick:()=>{P.trim()&&(F(Y=>[...Y,P.trim()]),L(""))},className:"p-1.5 rounded-lg border border-border/50 hover:bg-muted transition-colors",title:"Add",children:p.jsx(_s,{className:"h-4 w-4"})}),D.length>0&&p.jsx("button",{onClick:()=>F([]),className:"flex items-center gap-1.5 px-2 py-1.5 text-sm rounded-lg border border-border/50 hover:bg-muted transition-colors text-muted-foreground",title:"Reset to auto-detect",children:p.jsx(jf,{className:"h-3.5 w-3.5"})})]})]})]}),p.jsx("p",{className:"text-xs text-muted-foreground pl-[108px]",children:"Directories scanned for source files. Adding any entry switches off auto-detection — list every root you want indexed (the app dir is always included)."}),((xl=C==null?void 0:C.detected)==null?void 0:xl.conventionFiles)&&C.detected.conventionFiles.length>0&&p.jsxs("div",{className:"pl-[108px] flex items-center gap-2 flex-wrap",children:[p.jsx("span",{className:"text-xs text-muted-foreground",children:"Convention files:"}),C.detected.conventionFiles.map(Y=>p.jsx("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs bg-muted text-muted-foreground",children:Y},Y))]})]})]})]}),p.jsxs("section",{className:"mb-6 space-y-3",children:[p.jsx("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Server"}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("label",{className:"text-sm text-muted-foreground w-24 shrink-0",children:"Port"}),p.jsx("input",{type:"text",value:S,onChange:Y=>k(Y.target.value),placeholder:"Random",className:"w-32 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsx("span",{className:"text-xs text-muted-foreground",children:"Leave empty for random port on each start"})]})]}),p.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-6",children:[p.jsxs("div",{className:"space-y-6",children:[p.jsxs("section",{className:"space-y-3",children:[p.jsx("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Stack Detection"}),p.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 xl:grid-cols-1 gap-2",children:((e==null?void 0:e.detection)??[]).map(Y=>p.jsxs("div",{className:`flex items-center gap-2 p-3 rounded-lg border ${Y.detected?"border-green-500/30 bg-green-500/5":"border-border/50 bg-muted/20 opacity-50"}`,children:[Y.detected?p.jsx(jr,{className:"h-4 w-4 text-green-500 shrink-0"}):p.jsx(UR,{className:"h-4 w-4 text-muted-foreground shrink-0"}),p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium",children:Y.label||Y.id}),p.jsxs("div",{className:"text-xs text-muted-foreground",children:[Y.layers.join(", ")," layer"]})]})]},Y.id))})]}),fs.map(([Y,de])=>p.jsxs("section",{className:"space-y-3",children:[p.jsxs("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:[Yo(Y)," Parsers"]}),p.jsx("div",{className:"space-y-2",children:de.map(he=>p.jsx("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border/50 bg-card",children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("button",{onClick:()=>us(he.id),className:`w-10 h-5 rounded-full transition-colors relative shrink-0 ${f.has(he.id)?"bg-muted":"bg-purple-600"}`,children:p.jsx("span",{className:`block absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white transition-all ${f.has(he.id)?"left-0.5":"left-[22px]"}`})}),p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium",children:he.label||Yo(he.id)}),p.jsx("div",{className:"text-xs text-muted-foreground",children:he.id})]})]})},he.id))})]},Y))]}),p.jsxs("div",{className:"space-y-6",children:[p.jsxs("section",{className:"space-y-3",children:[p.jsx("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Layer Parsers"}),p.jsx("div",{className:"space-y-2",children:qd.filter(Y=>!Y.concern).map(Y=>p.jsx("div",{className:"flex items-center justify-between p-3 rounded-lg border border-border/50 bg-card",children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("button",{onClick:()=>us(Y.id),className:`w-10 h-5 rounded-full transition-colors relative shrink-0 ${f.has(Y.id)?"bg-muted":"bg-purple-600"}`,children:p.jsx("span",{className:`block absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white transition-all ${f.has(Y.id)?"left-0.5":"left-[22px]"}`})}),p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium",children:Y.label}),p.jsxs("div",{className:"text-xs text-muted-foreground",children:[Y.id," — ",Y.layer]})]})]})},Y.id))})]}),p.jsxs("section",{className:"space-y-3",children:[p.jsx("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Custom Parsers"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"JS files exporting a parser object. Path relative to project root."}),h.length>0&&p.jsx("div",{className:"space-y-2",children:h.map((Y,de)=>p.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border border-border/50 bg-card",children:[p.jsx("code",{className:"text-xs flex-1 text-muted-foreground",children:Y.path}),p.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:Y.layer}),Y.concern&&p.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-purple-500/10 text-purple-400",children:Y.concern}),p.jsx("button",{onClick:()=>ds(de),className:"text-red-400 hover:text-red-300",children:p.jsx(Ss,{className:"h-3.5 w-3.5"})})]},de))}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"text",value:v,onChange:Y=>b(Y.target.value),placeholder:"./parsers/my-parser.js",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground",onKeyDown:Y=>Y.key==="Enter"&&cl()}),p.jsxs("select",{value:_,onChange:Y=>m(Y.target.value),className:"px-2 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground",children:[p.jsx("option",{value:"crosslayer",children:"crosslayer"}),p.jsx("option",{value:"ui",children:"ui"}),p.jsx("option",{value:"api",children:"api"}),p.jsx("option",{value:"db",children:"db"})]}),_==="crosslayer"&&p.jsx("input",{type:"text",value:w,onChange:Y=>y(Y.target.value),placeholder:"api-binding",list:"concern-suggestions",className:"w-32 px-2 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsx("button",{onClick:cl,className:"p-1.5 rounded-lg border border-border/50 hover:bg-muted transition-colors",children:p.jsx(_s,{className:"h-4 w-4"})})]}),p.jsx("datalist",{id:"concern-suggestions",children:fs.map(([Y])=>p.jsx("option",{value:Y},Y))})]})]})]}),p.jsxs("div",{className:"mt-8 border-t border-border/30 pt-6",children:[p.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[p.jsx(AA,{className:"h-5 w-5 text-muted-foreground"}),p.jsx("h2",{className:"text-lg font-semibold",children:"Taggers"})]}),p.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-6",children:[p.jsxs("section",{className:"space-y-3",children:[p.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Built-in Taggers"}),[{id:"module",label:"Module",description:"Assigns modules from directory structure"},{id:"screen",label:"Screen",description:"Marks pages and layouts as screens"}].map(Y=>p.jsxs("div",{className:"p-3 rounded-lg border border-border/50 bg-card space-y-2",children:[p.jsx("div",{className:"flex items-center justify-between",children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("button",{onClick:()=>ee(de=>{const he=new Set(de);return he.has(Y.id)?he.delete(Y.id):he.add(Y.id),he}),className:`w-10 h-5 rounded-full transition-colors relative shrink-0 ${te.has(Y.id)?"bg-muted":"bg-purple-600"}`,children:p.jsx("span",{className:`block absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white transition-all ${te.has(Y.id)?"left-0.5":"left-[22px]"}`})}),p.jsxs("div",{children:[p.jsx("div",{className:"text-sm font-medium",children:Y.label}),p.jsx("div",{className:"text-xs text-muted-foreground",children:Y.description})]})]})}),p.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground pl-[52px]",children:[p.jsx("input",{type:"checkbox",checked:Q[Y.id]??!0,onChange:de=>ne(he=>({...he,[Y.id]:de.target.checked})),className:"accent-purple-600"}),"Track untagged nodes"]})]},Y.id))]}),p.jsxs("section",{className:"space-y-3",children:[p.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Module Rules"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Custom glob patterns to assign modules. Matched before auto-detection."}),ue.length>0&&p.jsx("div",{className:"space-y-2",children:ue.map((Y,de)=>p.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg border border-border/50 bg-card",children:[p.jsx("code",{className:"text-xs flex-1 text-muted-foreground",children:Y.match}),p.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-purple-500/10 text-purple-400",children:Y.module}),p.jsx("button",{onClick:()=>ye(he=>he.filter((Fe,ct)=>ct!==de)),className:"text-red-400 hover:text-red-300",children:p.jsx(Ss,{className:"h-3.5 w-3.5"})})]},de))}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"text",value:Zt,onChange:Y=>fr(Y.target.value),placeholder:"app/(admin)/**",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsx("input",{type:"text",value:Dn,onChange:Y=>hr(Y.target.value),placeholder:"admin",className:"w-28 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsx("button",{onClick:()=>{Zt.trim()&&Dn.trim()&&(ye(Y=>[...Y,{match:Zt.trim(),module:Dn.trim()}]),fr(""),hr(""))},className:"p-1.5 rounded-lg border border-border/50 hover:bg-muted transition-colors",children:p.jsx(_s,{className:"h-4 w-4"})})]})]}),p.jsxs("section",{className:"space-y-3",children:[p.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:"Trivial Route Groups"}),p.jsx("p",{className:"text-xs text-muted-foreground",children:"Route groups that are auth/layout wrappers, not feature modules. These are skipped during module detection."}),pe.length>0&&p.jsx("div",{className:"flex flex-wrap gap-1.5",children:pe.map((Y,de)=>p.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-xs bg-muted text-muted-foreground",children:["(",Y,")",p.jsx("button",{onClick:()=>ke(he=>he.filter((Fe,ct)=>ct!==de)),className:"text-red-400 hover:text-red-300 ml-0.5",children:p.jsx(Ss,{className:"h-3 w-3"})})]},de))}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"text",value:tt,onChange:Y=>Xe(Y.target.value),placeholder:"protected",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground",onKeyDown:Y=>{Y.key==="Enter"&&tt.trim()&&(ke(de=>[...de,tt.trim()]),Xe(""))}}),p.jsx("button",{onClick:()=>{tt.trim()&&(ke(Y=>[...Y,tt.trim()]),Xe(""))},className:"p-1.5 rounded-lg border border-border/50 hover:bg-muted transition-colors",children:p.jsx(_s,{className:"h-4 w-4"})})]})]})]})]}),p.jsxs("div",{className:"mt-8 border-t border-border/30 pt-6",children:[p.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[p.jsx(ld,{className:"h-5 w-5 text-muted-foreground"}),p.jsx("h2",{className:"text-lg font-semibold",children:"Projects"})]}),p.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Configure sub-projects for monorepo support. Each project gets its own graph, selectable from the header dropdown. Leave empty for single-project mode."}),B.length>0&&p.jsx("div",{className:"space-y-2 mb-4",children:B.map((Y,de)=>p.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg border border-border/50 bg-card",children:[p.jsx("span",{className:"text-sm font-medium flex-1",children:Y.name}),p.jsx("code",{className:"text-xs text-muted-foreground",children:Y.root}),p.jsx("button",{onClick:()=>U(he=>he.filter((Fe,ct)=>ct!==de)),className:"text-red-400 hover:text-red-300",children:p.jsx(Ss,{className:"h-3.5 w-3.5"})})]},de))}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("input",{type:"text",value:G,onChange:Y=>W(Y.target.value),placeholder:"Project name",className:"w-40 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsxs("div",{className:"flex-1 flex items-center gap-1",children:[p.jsx("input",{type:"text",value:X,onChange:Y=>q(Y.target.value),placeholder:"Relative path (e.g. apps/dashboard)",className:"flex-1 px-3 py-1.5 text-sm rounded-lg border border-border/50 bg-background text-foreground placeholder:text-muted-foreground"}),p.jsx("button",{onClick:()=>M(!0),className:"p-1.5 rounded-lg border border-border/50 hover:bg-muted transition-colors",title:"Browse folders",children:p.jsx(Hl,{className:"h-4 w-4"})})]}),p.jsx("button",{onClick:()=>{G.trim()&&X.trim()&&(U(Y=>[...Y,{name:G.trim(),root:X.trim()}]),W(""),q(""))},className:"p-1.5 rounded-lg border border-border/50 hover:bg-muted transition-colors",children:p.jsx(_s,{className:"h-4 w-4"})})]}),p.jsxs("button",{onClick:async()=>{try{const Y=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projects:B})});if(!Y.ok)throw new Error(`HTTP ${Y.status}`);$()}catch(Y){u(String(Y))}},className:"mt-3 flex items-center gap-2 px-4 py-2 rounded-lg bg-purple-600 hover:bg-purple-500 text-white text-sm font-medium transition-colors",children:[p.jsx(ry,{className:"h-4 w-4"}),"Save Projects"]})]}),I&&I!=="project"&&p.jsx(T1,{buildUrl:O,onSelect:Y=>{I==="app"?j(Y):I==="db"?T(Y):I==="srcRoot"&&Y&&!D.includes(Y)&&F(de=>[...de,Y]),z(null)},onClose:()=>z(null)}),R&&p.jsx(T1,{buildUrl:O,onSelect:Y=>{q(Y),M(!1)},onClose:()=>M(!1)})]})}const WG=["all","db","api","ui","static","security"],GG={error:{icon:wo,color:"text-red-400",bg:"bg-red-500/10",border:"border-red-500/30",label:"Error"},warning:{icon:Jm,color:"text-yellow-400",bg:"bg-yellow-500/10",border:"border-yellow-500/30",label:"Warning"},info:{icon:D_,color:"text-blue-400",bg:"bg-blue-500/10",border:"border-blue-500/30",label:"Info"}};function YG(){const[e,n]=x.useState(null),[r,o]=x.useState(!1),[i,s]=x.useState(null),[a,l]=x.useState("all"),[c,u]=x.useState(null),f=Go(),d=x.useCallback(async()=>{o(!0),s(null);try{const m=await fetch(f("/api/audit",{layer:a}));if(!m.ok)throw new Error(`HTTP ${m.status}`);n(await m.json())}catch(m){s(String(m))}finally{o(!1)}},[a,f]);x.useEffect(()=>{d()},[d]);const h=x.useCallback((m,w)=>{navigator.clipboard.writeText(w),u(m),setTimeout(()=>u(null),2e3)},[]),g=(e==null?void 0:e.reports.reduce((m,w)=>m+w.findings.length,0))??0,v=(e==null?void 0:e.reports.reduce((m,w)=>m+w.summary.errors,0))??0,b=(e==null?void 0:e.reports.reduce((m,w)=>m+w.summary.warnings,0))??0,_=(e==null?void 0:e.reports.reduce((m,w)=>m+w.summary.info,0))??0;return p.jsxs("div",{className:"h-full overflow-y-auto p-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-6",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(F_,{className:"h-6 w-6 text-muted-foreground"}),p.jsx("h1",{className:"text-xl font-semibold",children:"Audit"})]}),p.jsxs("button",{onClick:d,disabled:r,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-purple-600 hover:bg-purple-500 text-white text-sm font-medium transition-colors disabled:opacity-50",children:[p.jsx(yA,{className:"h-4 w-4"}),r?"Running...":"Run Audit"]})]}),i&&p.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-red-500/10 text-red-400 text-sm mb-6",children:[p.jsx(wo,{className:"h-4 w-4 shrink-0"}),i]}),p.jsx("div",{className:"flex gap-1 mb-6 p-1 rounded-lg bg-muted/30 w-fit",children:WG.map(m=>p.jsx("button",{onClick:()=>l(m),className:`px-4 py-1.5 text-sm rounded-md transition-colors ${a===m?"bg-purple-600 text-white font-medium":"text-muted-foreground hover:text-foreground"}`,children:m},m))}),e&&!r&&p.jsxs("div",{className:"flex items-center gap-4 mb-6 p-3 rounded-lg border border-border/50 bg-card",children:[p.jsxs("span",{className:"text-sm font-medium",children:[g," findings"]}),v>0&&p.jsxs("span",{className:"flex items-center gap-1 text-xs text-red-400",children:[p.jsx(wo,{className:"h-3 w-3"})," ",v," errors"]}),b>0&&p.jsxs("span",{className:"flex items-center gap-1 text-xs text-yellow-400",children:[p.jsx(Jm,{className:"h-3 w-3"})," ",b," warnings"]}),_>0&&p.jsxs("span",{className:"flex items-center gap-1 text-xs text-blue-400",children:[p.jsx(D_,{className:"h-3 w-3"})," ",_," info"]}),g>0&&p.jsxs("button",{onClick:()=>e.prompt&&h("all",e.prompt),className:"ml-auto flex items-center gap-1.5 px-3 py-1 text-xs rounded-md border border-border/50 hover:bg-muted transition-colors",children:[c==="all"?p.jsx(jr,{className:"h-3 w-3 text-green-400"}):p.jsx(Jv,{className:"h-3 w-3"}),c==="all"?"Copied":"Copy All as AI Prompt"]})]}),r&&p.jsx("div",{className:"text-sm text-muted-foreground",children:"Running audit checks..."}),e&&!r&&p.jsx("div",{className:"space-y-4",children:e.reports.map(m=>p.jsxs("section",{className:"rounded-lg border border-border/50 bg-card overflow-hidden",children:[p.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border/30",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground uppercase",children:m.layer}),p.jsx("span",{className:"text-sm font-medium",children:m.check.replace(/_/g," ")}),m.status==="skipped"?p.jsxs("span",{className:"text-xs text-yellow-400 flex items-center gap-1",title:m.skipReason??"comparison target missing",children:[p.jsx(BR,{className:"h-3 w-3"})," skipped — ",m.skipReason??"comparison target missing"]}):m.findings.length===0?p.jsxs("span",{className:"text-xs text-green-400 flex items-center gap-1",children:[p.jsx(jr,{className:"h-3 w-3"})," passed"]}):p.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.findings.length," finding",m.findings.length!==1?"s":""]})]}),m.findings.length>0&&p.jsxs("button",{onClick:()=>{const w=XG(m);h(m.check,w)},className:"flex items-center gap-1.5 px-2.5 py-1 text-xs rounded-md border border-border/50 hover:bg-muted transition-colors",children:[c===m.check?p.jsx(jr,{className:"h-3 w-3 text-green-400"}):p.jsx(Jv,{className:"h-3 w-3"}),c===m.check?"Copied":"Copy as AI Prompt"]})]}),m.findings.length>0&&p.jsx("div",{className:"divide-y divide-border/20",children:m.findings.map(w=>{const y=GG[w.severity],S=y.icon;return p.jsxs("div",{className:`flex items-start gap-3 p-3 ${y.bg}`,children:[p.jsx(S,{className:`h-4 w-4 shrink-0 mt-0.5 ${y.color}`}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("div",{className:"text-sm font-medium",children:w.title}),p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:w.detail}),w.file&&p.jsxs("code",{className:"text-xs text-muted-foreground mt-1 block",children:[w.file,w.line?`:${w.line}`:""]})]})]},w.id)})})]},`${m.layer}:${m.check}`))})]})}function XG(e){const n=[];n.push(`Fix these ${e.findings.length} ${e.check.replace(/_/g," ")} issues:
|
|
440
445
|
`);for(const r of e.findings){const o=r.severity==="error"?"ERROR":r.severity==="warning"?"WARNING":"INFO",i=r.file?` (${r.file}${r.line?`:${r.line}`:""})`:"";n.push(`- [${o}] ${r.title}${i}`),n.push(` ${r.detail}`)}return n.join(`
|
|
441
|
-
`)}function
|
|
446
|
+
`)}function KG(){return p.jsx(FL,{children:p.jsxs("div",{className:"flex h-screen flex-col overflow-hidden bg-background text-foreground",children:[p.jsx(UL,{}),p.jsxs("div",{className:"flex flex-1 min-h-0",children:[p.jsx(YL,{}),p.jsx("main",{className:"flex-1 min-h-0 overflow-hidden content-gradient",children:p.jsxs(V5,{children:[p.jsx(Vn,{path:"/overview",element:p.jsx(GH,{})}),p.jsx(Vn,{path:"/modules",element:p.jsx(TG,{})}),p.jsx(Vn,{path:"/sitemap",element:p.jsx(UG,{})}),p.jsx(Vn,{path:"/journeys",element:p.jsx($G,{})}),p.jsx(Vn,{path:"/project-graph",element:p.jsx(VH,{})}),p.jsx(Vn,{path:"/audit",element:p.jsx(YG,{})}),p.jsx(Vn,{path:"/settings",element:p.jsx(VG,{})}),p.jsx(Vn,{path:"*",element:p.jsx(H5,{to:"/overview",replace:!0})})]})})]})]})})}ih.createRoot(document.getElementById("root")).render(p.jsx(it.StrictMode,{children:p.jsx(Z5,{children:p.jsx(l3,{children:p.jsx(KG,{})})})}));
|